diff --git a/gallery/bower_components/vega/.bower.json b/gallery/bower_components/vega/.bower.json index 7d2b5cb0a7..db56adc783 100644 --- a/gallery/bower_components/vega/.bower.json +++ b/gallery/bower_components/vega/.bower.json @@ -37,14 +37,14 @@ "src", "test" ], - "version": "2.2.6", - "_release": "2.2.6", + "version": "2.3.0", + "_release": "2.3.0", "_resolution": { "type": "version", - "tag": "v2.2.6", - "commit": "006d941b0c96f4f6f6ef8f78ca7336b02385c6c0" + "tag": "v2.3.0", + "commit": "84c4cad5fa0d06fceb2845a6427b232ce7bbf8b1" }, "_source": "git://github.com/trifacta/vega.git", - "_target": "^2.2.6", + "_target": "^2.3.0", "_originalSource": "vega" } \ No newline at end of file diff --git a/gallery/bower_components/vega/package.json b/gallery/bower_components/vega/package.json index 2c220042c0..539a2ead00 100644 --- a/gallery/bower_components/vega/package.json +++ b/gallery/bower_components/vega/package.json @@ -1,6 +1,6 @@ { "name": "vega", - "version": "2.2.6", + "version": "2.3.0", "description": "The Vega visualization grammar.", "keywords": [ "vega", @@ -34,13 +34,13 @@ "dependencies": { "d3": "^3.5.6", "d3-geo-projection": "^0.2.15", - "d3.layout.cloud": "^1.1.1", + "d3-cloud": "^1.2.0", "datalib": "^1.4.6", "topojson": "^1.6.19", "vega-dataflow": "^1.2.5", "vega-expression": "^1.0.3", "vega-logging": "^1.0.1", - "vega-scenegraph": "^1.0.10", + "vega-scenegraph": "^1.0.11", "yargs": "^3.15.0" }, "devDependencies": { @@ -92,7 +92,6 @@ }, "browserify-shim": { "d3": "global:d3", - "d3.layout.cloud": "global:d3.layout.cloud", "canvas": "global:canvas", "topojson": "global:topojson" } diff --git a/gallery/bower_components/vega/vega-schema.json b/gallery/bower_components/vega/vega-schema.json index a0bf913df8..857517abb5 100644 --- a/gallery/bower_components/vega/vega-schema.json +++ b/gallery/bower_components/vega/vega-schema.json @@ -954,6 +954,91 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "enum": [ + "circle", + "square", + "cross", + "diamond", + "triangle-up", + "triangle-down" + ] + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ @@ -1124,6 +1209,93 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "enum": [ + "linear", + "step-before", + "step-after", + "basis", + "basis-open", + "cardinal", + "cardinal-open", + "monotone" + ] + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ @@ -1282,6 +1454,88 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "enum": [ + "left", + "right", + "center" + ] + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ @@ -1430,25 +1684,107 @@ ] }, { - "type": "object", - "allOf": [ - { - "$ref": "#/refs/stringModifiers" - }, - { - "oneOf": [ - { - "$ref": "#/refs/signal", - "required": [ - "signal" - ] - }, - { - "properties": { - "value": { - "enum": [ - "top", - "middle", + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "enum": [ + "top", + "middle", + "bottom" + ] + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "enum": [ + "top", + "middle", "bottom" ] } @@ -1679,1592 +2015,658 @@ ] } }, - "transform": { - "type": "array", - "items": { - "oneOf": [ - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Aggregate transform", - "description": "Compute summary aggregate statistics", - "type": "object", - "properties": { - "type": { - "enum": [ - "aggregate" - ] + "aggregateTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Aggregate transform", + "description": "Compute summary aggregate statistics", + "type": "object", + "properties": { + "type": { + "enum": [ + "aggregate" + ] + }, + "groupby": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" }, - "groupby": { + { + "$ref": "#/refs/signal" + } + ] + }, + "description": "A list of fields to split the data into groups." + }, + "summarize": { + "oneOf": [ + { + "type": "object", + "additionalProperties": { "type": "array", + "description": "An array of aggregate functions.", "items": { "oneOf": [ { - "type": "string" + "enum": [ + "values", + "count", + "valid", + "missing", + "distinct", + "sum", + "mean", + "average", + "variance", + "variancep", + "stdev", + "stdevp", + "median", + "q1", + "q3", + "modeskew", + "min", + "max", + "argmin", + "argmax" + ] }, { "$ref": "#/refs/signal" } ] - }, - "description": "A list of fields to split the data into groups." - }, - "summarize": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "array", - "description": "An array of aggregate functions.", - "items": { - "oneOf": [ - { - "enum": [ - "values", - "count", - "valid", - "missing", - "distinct", - "sum", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "median", - "q1", - "q3", - "modeskew", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] + } + } + }, + { + "type": "array", + "items": { + "type": "object", + "properties": { + "field": { + "description": "The name of the field to aggregate.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" } - } + ] }, - { + "ops": { "type": "array", + "description": "An array of aggregate functions.", "items": { - "type": "object", - "properties": { - "field": { - "description": "The name of the field to aggregate.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } + "oneOf": [ + { + "enum": [ + "values", + "count", + "valid", + "missing", + "distinct", + "sum", + "mean", + "average", + "variance", + "variancep", + "stdev", + "stdevp", + "median", + "q1", + "q3", + "modeskew", + "min", + "max", + "argmin", + "argmax" ] }, - "ops": { - "type": "array", - "description": "An array of aggregate functions.", - "items": { - "oneOf": [ - { - "enum": [ - "values", - "count", - "valid", - "missing", - "distinct", - "sum", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "median", - "q1", - "q3", - "modeskew", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } + { + "$ref": "#/refs/signal" + } + ] + } + }, + "as": { + "type": "array", + "description": "An optional array of names to use for the output fields.", + "items": { + "oneOf": [ + { + "type": "string" }, - "as": { - "type": "array", - "description": "An optional array of names to use for the output fields.", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } + { + "$ref": "#/refs/signal" } - }, - "additionalProperties": false, - "required": [ - "field", - "ops" ] } } + }, + "additionalProperties": false, + "required": [ + "field", + "ops" ] } + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "binTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Bin transform", + "description": "Bins values into quantitative bins (e.g., for a histogram).", + "type": "object", + "properties": { + "type": { + "enum": [ + "bin" + ] + }, + "field": { + "oneOf": [ + { + "type": "string" }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Bin transform", - "description": "Bins values into quantitative bins (e.g., for a histogram).", - "type": "object", - "properties": { - "type": { - "enum": [ - "bin" - ] - }, - "field": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The name of the field to bin values from." - }, - "min": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The minimum bin value to consider." - }, - "max": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The maximum bin value to consider." - }, - "base": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The number base to use for automatic bin determination.", - "default": 10 - }, - "maxbins": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The maximum number of allowable bins.", - "default": 20 - }, - "step": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "An exact step size to use between bins. If provided, options such as maxbins will be ignored." - }, - "steps": { - "description": "An array of allowable step sizes to choose from.", - "oneOf": [ - { - "type": "array", - "items": { - "type": "number" - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minstep": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "A minimum allowable step size (particularly useful for integer values)." - }, - "div": { - "description": "An array of scale factors indicating allowable subdivisions.", - "oneOf": [ - { - "type": "array", - "items": { - "type": "number" - }, - "default": [ - 5, - 2 - ] - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "bin": { - "type": "string", - "default": "bin" - } - }, - "additionalProperties": false + { + "$ref": "#/refs/signal" + } + ], + "description": "The name of the field to bin values from." + }, + "min": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The minimum bin value to consider." + }, + "max": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The maximum bin value to consider." + }, + "base": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The number base to use for automatic bin determination.", + "default": 10 + }, + "maxbins": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The maximum number of allowable bins.", + "default": 20 + }, + "step": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "An exact step size to use between bins. If provided, options such as maxbins will be ignored." + }, + "steps": { + "description": "An array of allowable step sizes to choose from.", + "oneOf": [ + { + "type": "array", + "items": { + "type": "number" } }, - "additionalProperties": false, - "required": [ - "type", - "field", - "min", - "max" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Cross transform", - "description": "Compute the cross-product of two data sets.", - "type": "object", - "properties": { - "type": { - "enum": [ - "cross" - ] - }, - "with": { - "type": "string", - "description": "The name of the secondary data set to cross with the primary data. If unspecified, the primary data is crossed with itself." - }, - "diagonal": { - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "If false, items along the \"diagonal\" of the cross-product (those elements with the same index in their respective array) will not be included in the output.", - "default": true - }, - "filter": { - "type": "string", - "description": "A string containing an expression (in JavaScript syntax) to filter the resulting data elements." + { + "$ref": "#/refs/signal" + } + ] + }, + "minstep": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "A minimum allowable step size (particularly useful for integer values)." + }, + "div": { + "description": "An array of scale factors indicating allowable subdivisions.", + "oneOf": [ + { + "type": "array", + "items": { + "type": "number" }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "left": { - "type": "string", - "default": "a" - }, - "right": { - "type": "string", - "default": "b" - } - }, - "additionalProperties": false - } + "default": [ + 5, + 2 + ] }, - "additionalProperties": false, - "required": [ - "type" - ] + { + "$ref": "#/refs/signal" + } + ] + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "start": { + "type": "string", + "default": "bin_start" + }, + "end": { + "type": "string", + "default": "bin_end" + } }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "CountPattern transform", - "type": "object", - "properties": { - "type": { - "enum": [ - "countpattern" - ] - }, - "field": { - "description": "The field containing the text to analyze.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "data" - }, - "pattern": { - "description": "A regexp pattern for matching words in text.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "[\\w']+" - }, - "case": { - "description": "Text case transformation to apply.", - "oneOf": [ - { - "enum": [ - "lower", - "upper", - "none" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "lower" - }, - "stopwords": { - "description": "A regexp pattern for matching stopwords to omit.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "" - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "text": { - "type": "string", - "default": "text" - }, - "count": { - "type": "string", - "default": "count" - } - }, - "additionalProperties": false - } + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type", + "field" + ] + }, + "crossTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Cross transform", + "description": "Compute the cross-product of two data sets.", + "type": "object", + "properties": { + "type": { + "enum": [ + "cross" + ] + }, + "with": { + "type": "string", + "description": "The name of the secondary data set to cross with the primary data. If unspecified, the primary data is crossed with itself." + }, + "diagonal": { + "oneOf": [ + { + "type": "boolean" }, - "additionalProperties": false, - "required": [ - "type" - ] + { + "$ref": "#/refs/signal" + } + ], + "description": "If false, items along the \"diagonal\" of the cross-product (those elements with the same index in their respective array) will not be included in the output.", + "default": true + }, + "filter": { + "type": "string", + "description": "A string containing an expression (in JavaScript syntax) to filter the resulting data elements." + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "left": { + "type": "string", + "default": "a" + }, + "right": { + "type": "string", + "default": "b" + } }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "LinkPath transform", - "description": "Computes a path definition for connecting nodes within a node-link network or tree diagram.", - "type": "object", - "properties": { - "type": { - "enum": [ - "linkpath" - ] - }, - "sourceX": { - "description": "The data field that references the source x-coordinate for this link.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "_source" - }, - "sourceY": { - "description": "The data field that references the source y-coordinate for this link.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "_source" - }, - "targetX": { - "description": "The data field that references the target x-coordinate for this link.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "_target" - }, - "targetY": { - "description": "The data field that references the target y-coordinate for this link.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "_target" - }, - "tension": { - "description": "A tension parameter for the \"tightness\" of \"curve\"-shaped links.", - "oneOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 1 - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.2 - }, - "shape": { - "description": "The path shape to use", - "oneOf": [ - { - "enum": [ - "line", - "curve", - "diagonal", - "diagonalX", - "diagonalY" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "line" - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "path": { - "type": "string", - "default": "layout_path" - } - }, - "additionalProperties": false - } + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "countpatternTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "CountPattern transform", + "type": "object", + "properties": { + "type": { + "enum": [ + "countpattern" + ] + }, + "field": { + "description": "The field containing the text to analyze.", + "oneOf": [ + { + "type": "string" }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Facet transform", - "description": "A special aggregate transform that organizes a data set into groups or \"facets\".", - "type": "object", - "properties": { - "type": { - "enum": [ - "facet" - ] - }, - "groupby": { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "description": "A list of fields to split the data into groups." - }, - "summarize": { - "oneOf": [ - { - "type": "object", - "additionalProperties": { - "type": "array", - "description": "An array of aggregate functions.", - "items": { - "oneOf": [ - { - "enum": [ - "values", - "count", - "valid", - "missing", - "distinct", - "sum", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "median", - "q1", - "q3", - "modeskew", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - } - }, - { - "type": "array", - "items": { - "type": "object", - "properties": { - "field": { - "description": "The name of the field to aggregate.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "ops": { - "type": "array", - "description": "An array of aggregate functions.", - "items": { - "oneOf": [ - { - "enum": [ - "values", - "count", - "valid", - "missing", - "distinct", - "sum", - "mean", - "average", - "variance", - "variancep", - "stdev", - "stdevp", - "median", - "q1", - "q3", - "modeskew", - "min", - "max", - "argmin", - "argmax" - ] - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "as": { - "type": "array", - "description": "An optional array of names to use for the output fields.", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - } - }, - "additionalProperties": false, - "required": [ - "field", - "ops" - ] - } - } - ] - }, - "transform": { - "$ref": "#/defs/transform" - } + { + "$ref": "#/refs/signal" + } + ], + "default": "data" + }, + "pattern": { + "description": "A regexp pattern for matching words in text.", + "oneOf": [ + { + "type": "string" }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Filter transform", - "description": "Filters elements from a data set to remove unwanted items.", - "type": "object", - "properties": { - "type": { - "enum": [ - "filter" - ] - }, - "test": { - "type": "string", - "description": "A string containing an expression (in JavaScript syntax) for the filter predicate." - } + { + "$ref": "#/refs/signal" + } + ], + "default": "[\\w']+" + }, + "case": { + "description": "Text case transformation to apply.", + "oneOf": [ + { + "enum": [ + "lower", + "upper", + "none" + ] }, - "additionalProperties": false, - "required": [ - "type", - "test" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Fold transform", - "description": "Collapse (\"fold\") one or more data properties into two properties.", - "type": "object", - "properties": { - "type": { - "enum": [ - "fold" - ] - }, - "fields": { - "oneOf": [ - { - "type": "array", - "description": "An array of field references indicating the data properties to fold.", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 1, - "uniqueItems": true - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "key": { - "type": "string", - "default": "key" - }, - "value": { - "type": "string", - "default": "value" - } - }, - "additionalProperties": false - } + { + "$ref": "#/refs/signal" + } + ], + "default": "lower" + }, + "stopwords": { + "description": "A regexp pattern for matching stopwords to omit.", + "oneOf": [ + { + "type": "string" }, - "additionalProperties": false, - "required": [ - "type", - "fields" - ] + { + "$ref": "#/refs/signal" + } + ], + "default": "" + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "text": { + "type": "string", + "default": "text" + }, + "count": { + "type": "string", + "default": "count" + } }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Force transform", - "description": "Performs force-directed layout for network data.", - "type": "object", - "properties": { - "type": { - "enum": [ - "force" - ] - }, - "size": { - "description": "The dimensions [width, height] of this force layout.", - "oneOf": [ - { - "type": "array", - "minItems": 2, - "maxItems": 2, - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - 500, - 500 - ] - }, - "links": { - "type": "string", - "description": "The name of the link (edge) data set." - }, - "linkDistance": { - "description": "Determines the length of edges, in pixels.", - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 20 - }, - "linkStrength": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "Determines the tension of edges (the spring constant).", - "default": 1 - }, - "charge": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The strength of the charge each node exerts.", - "default": -30 - }, - "chargeDistance": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The maximum distance over which charge forces are applied.", - "default": null - }, - "iterations": { - "description": "The number of iterations to run the force directed layout.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 500 - }, - "friction": { - "description": "The strength of the friction force used to stabilize the layout.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.9 - }, - "theta": { - "description": "The theta parameter for the Barnes-Hut algorithm, which is used to compute charge forces between nodes.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.8 - }, - "gravity": { - "description": "The strength of the pseudo-gravity force that pulls nodes towards the center of the layout area.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.1 - }, - "alpha": { - "description": "A \"temperature\" parameter that determines how much node positions are adjusted at each step.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0.1 - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "x": { - "type": "string", - "default": "layout_x" - }, - "y": { - "type": "string", - "default": "layout_y" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": [ - "type", - "links" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Formula transform", - "description": "Extends data elements with new values according to a calculation formula.", - "type": "object", - "properties": { - "type": { - "enum": [ - "formula" - ] - }, - "field": { - "type": "string", - "description": "The property name in which to store the computed formula value." - }, - "expr": { - "type": "string", - "description": "A string containing an expression (in JavaScript syntax) for the formula." - } - }, - "required": [ - "type", - "field", - "expr" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Geo transform", - "description": "Performs a cartographic projection. Given longitude and latitude values, sets corresponding x and y properties for a mark.", - "type": "object", - "properties": { - "type": { - "enum": [ - "geo" - ] - }, - "lon": { - "description": "The input longitude values.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "lat": { - "description": "The input latitude values.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "x": { - "type": "string", - "default": "layout_x" - }, - "y": { - "type": "string", - "default": "layout_y" - } - }, - "additionalProperties": false - }, - "projection": { - "description": "The type of cartographic projection to use.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "mercator" - }, - "center": { - "description": "The center of the projection.", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "translate": { - "description": "The translation of the projection.", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "rotate": { - "description": "The rotation of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "scale": { - "description": "The scale of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "precision": { - "description": "The desired precision of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "clipAngle": { - "description": "The clip angle of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "clipExtent": { - "description": "The clip extent of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - "required": [ - "type", - "lon", - "lat" - ], - "additionalProperties": false - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "GeoPath transform", - "description": "Creates paths for geographic regions, such as countries, states and counties.", - "type": "object", - "properties": { - "type": { - "enum": [ - "geopath" - ] - }, - "field": { - "description": "The data field containing GeoJSON Feature data.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "path": { - "type": "string", - "default": "layout_path" - } - }, - "additionalProperties": false - }, - "projection": { - "description": "The type of cartographic projection to use.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "mercator" - }, - "center": { - "description": "The center of the projection.", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "translate": { - "description": "The translation of the projection.", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "rotate": { - "description": "The rotation of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "scale": { - "description": "The scale of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "precision": { - "description": "The desired precision of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "clipAngle": { - "description": "The clip angle of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "clipExtent": { - "description": "The clip extent of the projection.", - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - } + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "linkpathTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "LinkPath transform", + "description": "Computes a path definition for connecting nodes within a node-link network or tree diagram.", + "type": "object", + "properties": { + "type": { + "enum": [ + "linkpath" + ] + }, + "sourceX": { + "description": "The data field that references the source x-coordinate for this link.", + "oneOf": [ + { + "type": "string" }, - "required": [ - "type" - ], - "additionalProperties": false + { + "$ref": "#/refs/signal" + } + ], + "default": "_source" + }, + "sourceY": { + "description": "The data field that references the source y-coordinate for this link.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "_source" + }, + "targetX": { + "description": "The data field that references the target x-coordinate for this link.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "_target" + }, + "targetY": { + "description": "The data field that references the target y-coordinate for this link.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "_target" + }, + "tension": { + "description": "A tension parameter for the \"tightness\" of \"curve\"-shaped links.", + "oneOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 1 + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0.2 + }, + "shape": { + "description": "The path shape to use", + "oneOf": [ + { + "enum": [ + "line", + "curve", + "diagonal", + "diagonalX", + "diagonalY" + ] + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "line" + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "path": { + "type": "string", + "default": "layout_path" + } }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Lookup transform", - "description": "Extends a data set by looking up values in another data set.", - "type": "object", - "properties": { - "type": { - "enum": [ - "lookup" - ] - }, - "on": { - "type": "string", - "description": "The name of the secondary data set on which to lookup values." - }, - "onKey": { - "description": "The key field to lookup, or null for index-based lookup.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "facetTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Facet transform", + "description": "A special aggregate transform that organizes a data set into groups or \"facets\".", + "type": "object", + "properties": { + "type": { + "enum": [ + "facet" + ] + }, + "groupby": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" }, - "keys": { - "description": "One or more fields in the primary data set to match against the secondary data set.", + { + "$ref": "#/refs/signal" + } + ] + }, + "description": "A list of fields to split the data into groups." + }, + "summarize": { + "oneOf": [ + { + "type": "object", + "additionalProperties": { "type": "array", + "description": "An array of aggregate functions.", "items": { "oneOf": [ { - "type": "string" + "enum": [ + "values", + "count", + "valid", + "missing", + "distinct", + "sum", + "mean", + "average", + "variance", + "variancep", + "stdev", + "stdevp", + "median", + "q1", + "q3", + "modeskew", + "min", + "max", + "argmin", + "argmax" + ] }, { "$ref": "#/refs/signal" } ] } - }, - "as": { - "type": "array", - "description": "The names of the fields in which to store looked-up values.", - "items": { - "type": "string" - } - }, - "default": { - "description": "The default value to use if a lookup match fails." - } - }, - "required": [ - "type", - "on", - "as", - "keys" - ], - "additionalProperties": false - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Pie transform", - "description": "Computes a pie chart layout.", - "type": "object", - "properties": { - "type": { - "enum": [ - "pie" - ] - }, - "field": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "description": "The data values to encode as angular spans. If this property is omitted, all pie slices will have equal spans." - }, - "startAngle": { - "oneOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 6.283185307179586 - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0 - }, - "endAngle": { - "oneOf": [ - { - "type": "number", - "minimum": 0, - "maximum": 6.283185307179586 - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 6.283185307179586 - }, - "sort": { - "description": " If true, will sort the data prior to computing angles.", - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": false - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "start": { - "type": "string", - "default": "layout_start" - }, - "end": { - "type": "string", - "default": "layout_end" - }, - "mid": { - "type": "string", - "default": "layout_mid" - } - } - } - }, - "required": [ - "type" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Sort transform", - "description": "Sorts the values of a data set.", - "type": "object", - "properties": { - "type": { - "enum": [ - "sort" - ] - }, - "by": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ], - "description": "A list of fields to use as sort criteria." } }, - "required": [ - "type", - "by" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Stack transform", - "description": "Computes layout values for stacked graphs, as in stacked bar charts or stream graphs.", - "type": "object", - "properties": { - "type": { - "enum": [ - "stack" - ] - }, - "groupby": { - "description": "A list of fields to split the data into groups (stacks).", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "sortby": { - "description": "A list of fields to determine the sort order of stacks.", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - } - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "field": { - "description": "The data field that determines the thickness/height of stacks.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "offset": { - "description": "The baseline offset", - "oneOf": [ - { - "enum": [ - "zero", - "silhouette", - "wiggle", - "expand" - ] - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "zero" - }, - "output": { + { + "type": "array", + "items": { "type": "object", - "description": "Rename the output data fields", "properties": { - "start": { - "type": "string", - "default": "layout_start" + "field": { + "description": "The name of the field to aggregate.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] }, - "end": { - "type": "string", - "default": "layout_end" + "ops": { + "type": "array", + "description": "An array of aggregate functions.", + "items": { + "oneOf": [ + { + "enum": [ + "values", + "count", + "valid", + "missing", + "distinct", + "sum", + "mean", + "average", + "variance", + "variancep", + "stdev", + "stdevp", + "median", + "q1", + "q3", + "modeskew", + "min", + "max", + "argmin", + "argmax" + ] + }, + { + "$ref": "#/refs/signal" + } + ] + } }, - "mid": { - "type": "string", - "default": "layout_mid" - } - }, - "additionalProperties": false - } - }, - "additionalProperties": false, - "required": [ - "type", - "groupby", - "field" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Treemap transform", - "type": "object", - "properties": { - "type": { - "enum": [ - "treemap" - ] - }, - "sort": { - "description": "A list of fields to use as sort criteria for sibling nodes.", - "oneOf": [ - { + "as": { "type": "array", + "description": "An optional array of names to use for the output fields.", "items": { "oneOf": [ { @@ -3275,90 +2677,531 @@ } ] } + } + }, + "additionalProperties": false, + "required": [ + "field", + "ops" + ] + } + } + ] + }, + "transform": { + "$ref": "#/defs/transform" + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "filterTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Filter transform", + "description": "Filters elements from a data set to remove unwanted items.", + "type": "object", + "properties": { + "type": { + "enum": [ + "filter" + ] + }, + "test": { + "type": "string", + "description": "A string containing an expression (in JavaScript syntax) for the filter predicate." + } + }, + "additionalProperties": false, + "required": [ + "type", + "test" + ] + }, + "foldTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Fold transform", + "description": "Collapse (\"fold\") one or more data properties into two properties.", + "type": "object", + "properties": { + "type": { + "enum": [ + "fold" + ] + }, + "fields": { + "oneOf": [ + { + "type": "array", + "description": "An array of field references indicating the data properties to fold.", + "items": { + "oneOf": [ + { + "type": "string" }, { "$ref": "#/refs/signal" } - ], - "default": [ - "-value" ] }, - "children": { - "description": "A data field that represents the children array", + "minItems": 1, + "uniqueItems": true + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "key": { + "type": "string", + "default": "key" + }, + "value": { + "type": "string", + "default": "value" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type", + "fields" + ] + }, + "forceTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Force transform", + "description": "Performs force-directed layout for network data.", + "type": "object", + "properties": { + "type": { + "enum": [ + "force" + ] + }, + "size": { + "description": "The dimensions [width, height] of this force layout.", + "oneOf": [ + { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { "oneOf": [ { - "type": "string" + "type": "number" }, { "$ref": "#/refs/signal" } ] - }, - "field": { - "description": "The values to use to determine the area of each leaf-level treemap cell.", + } + }, + { + "$ref": "#/refs/signal" + } + ], + "default": [ + 500, + 500 + ] + }, + "links": { + "type": "string", + "description": "The name of the link (edge) data set." + }, + "linkDistance": { + "description": "Determines the length of edges, in pixels.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 20 + }, + "linkStrength": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "Determines the tension of edges (the spring constant).", + "default": 1 + }, + "charge": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The strength of the charge each node exerts.", + "default": -30 + }, + "chargeDistance": { + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The maximum distance over which charge forces are applied.", + "default": null + }, + "iterations": { + "description": "The number of iterations to run the force directed layout.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 500 + }, + "friction": { + "description": "The strength of the friction force used to stabilize the layout.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0.9 + }, + "theta": { + "description": "The theta parameter for the Barnes-Hut algorithm, which is used to compute charge forces between nodes.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0.8 + }, + "gravity": { + "description": "The strength of the pseudo-gravity force that pulls nodes towards the center of the layout area.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0.1 + }, + "alpha": { + "description": "A \"temperature\" parameter that determines how much node positions are adjusted at each step.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0.1 + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "x": { + "type": "string", + "default": "layout_x" + }, + "y": { + "type": "string", + "default": "layout_y" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type", + "links" + ] + }, + "formulaTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Formula transform", + "description": "Extends data elements with new values according to a calculation formula.", + "type": "object", + "properties": { + "type": { + "enum": [ + "formula" + ] + }, + "field": { + "type": "string", + "description": "The property name in which to store the computed formula value." + }, + "expr": { + "type": "string", + "description": "A string containing an expression (in JavaScript syntax) for the formula." + } + }, + "required": [ + "type", + "field", + "expr" + ] + }, + "geoTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Geo transform", + "description": "Performs a cartographic projection. Given longitude and latitude values, sets corresponding x and y properties for a mark.", + "type": "object", + "properties": { + "type": { + "enum": [ + "geo" + ] + }, + "lon": { + "description": "The input longitude values.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "lat": { + "description": "The input latitude values.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "x": { + "type": "string", + "default": "layout_x" + }, + "y": { + "type": "string", + "default": "layout_y" + } + }, + "additionalProperties": false + }, + "projection": { + "description": "The type of cartographic projection to use.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "mercator" + }, + "center": { + "description": "The center of the projection.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { - "type": "string" + "type": "number" }, { "$ref": "#/refs/signal" } ] }, - "size": { - "description": "The dimensions of the treemap layout", + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "translate": { + "description": "The translation of the projection.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 + "type": "number" }, { "$ref": "#/refs/signal" } - ], - "default": [ - 500, - 500 ] }, - "round": { - "description": "If true, treemap cell dimensions will be rounded to integer pixels.", - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": true - }, - "sticky": { - "description": "If true, repeated runs of the treemap will use cached partition boundaries.", - "oneOf": [ - { - "type": "boolean" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": false - }, - "ratio": { - "description": "The target aspect ratio for the layout to optimize.", + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "rotate": { + "description": "The rotation of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "scale": { + "description": "The scale of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "precision": { + "description": "The desired precision of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "clipAngle": { + "description": "The clip angle of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "clipExtent": { + "description": "The clip extent of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + } + }, + "required": [ + "type", + "lon", + "lat" + ], + "additionalProperties": false + }, + "geopathTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "GeoPath transform", + "description": "Creates paths for geographic regions, such as countries, states and counties.", + "type": "object", + "properties": { + "type": { + "enum": [ + "geopath" + ] + }, + "field": { + "description": "The data field containing GeoJSON Feature data.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "path": { + "type": "string", + "default": "layout_path" + } + }, + "additionalProperties": false + }, + "projection": { + "description": "The type of cartographic projection to use.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "mercator" + }, + "center": { + "description": "The center of the projection.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "number" @@ -3366,125 +3209,167 @@ { "$ref": "#/refs/signal" } - ], - "default": 1.618033988749895 + ] }, - "padding": { + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "translate": { + "description": "The translation of the projection.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "number" }, - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 4, - "maxItems": 4 - }, { "$ref": "#/refs/signal" } - ], - "description": "he padding (in pixels) to provide around internal nodes in the treemap." + ] }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "x": { - "type": "string", - "default": "layout_x" - }, - "y": { - "type": "string", - "default": "layout_y" - }, - "width": { - "type": "string", - "default": "layout_width" - }, - "height": { - "type": "string", - "default": "layout_height" - }, - "depth": { - "type": "string", - "default": "layout_depth" - } - }, - "additionalProperties": false - } + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "rotate": { + "description": "The rotation of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "scale": { + "description": "The scale of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "precision": { + "description": "The desired precision of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "clipAngle": { + "description": "The clip angle of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "clipExtent": { + "description": "The clip extent of the projection.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ] + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "imputeTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Impute transform", + "description": "Performs imputation of missing values.", + "type": "object", + "properties": { + "type": { + "enum": [ + "impute" + ] + }, + "method": { + "description": "The imputation method to use.", + "oneOf": [ + { + "enum": [ + "value", + "mean", + "median", + "min", + "max" + ] }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Voronoi transform", - "type": "object", - "properties": { - "type": { - "enum": [ - "voronoi" - ] - }, - "clipExtent": { - "description": "The min and max points at which to clip the voronoi diagram.", - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 - }, - { - "$ref": "#/refs/signal" - } - ], - "default": [ - [ - -100000, - -100000 - ], - [ - 100000, - 100000 - ] - ] - }, - "x": { - "description": "The input x coordinates.", + { + "$ref": "#/refs/signal" + } + ], + "default": "value" + }, + "value": { + "description": "The value to use for missing data if the method is 'value'.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "type": "boolean" + }, + { + "type": "null" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0 + }, + "field": { + "description": "The data field to impute.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "groupby": { + "description": "A list of fields to group the data into series.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "string" @@ -3493,9 +3378,19 @@ "$ref": "#/refs/signal" } ] - }, - "y": { - "description": "The input y coordinates.", + } + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "orderby": { + "description": "A list of fields to determine ordering within series.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "string" @@ -3504,63 +3399,233 @@ "$ref": "#/refs/signal" } ] - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "path": { - "type": "string", - "default": "layout_path" - } - }, - "additionalProperties": false } }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - { - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Wordcloud transform", - "type": "object", - "properties": { - "type": { - "enum": [ - "wordcloud" - ] + { + "$ref": "#/refs/signal" + } + ] + } + }, + "additionalProperties": false, + "required": [ + "type", + "groupby", + "orderby", + "field" + ] + }, + "lookupTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Lookup transform", + "description": "Extends a data set by looking up values in another data set.", + "type": "object", + "properties": { + "type": { + "enum": [ + "lookup" + ] + }, + "on": { + "type": "string", + "description": "The name of the secondary data set on which to lookup values." + }, + "onKey": { + "description": "The key field to lookup, or null for index-based lookup.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "keys": { + "description": "One or more fields in the primary data set to match against the secondary data set.", + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" }, - "size": { - "description": "The dimensions of the wordcloud layout", + { + "$ref": "#/refs/signal" + } + ] + } + }, + "as": { + "type": "array", + "description": "The names of the fields in which to store looked-up values.", + "items": { + "type": "string" + } + }, + "default": { + "description": "The default value to use if a lookup match fails." + } + }, + "required": [ + "type", + "on", + "as", + "keys" + ], + "additionalProperties": false + }, + "pieTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Pie transform", + "description": "Computes a pie chart layout.", + "type": "object", + "properties": { + "type": { + "enum": [ + "pie" + ] + }, + "field": { + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "The data values to encode as angular spans. If this property is omitted, all pie slices will have equal spans." + }, + "startAngle": { + "oneOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 6.283185307179586 + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0 + }, + "endAngle": { + "oneOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 6.283185307179586 + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 6.283185307179586 + }, + "sort": { + "description": " If true, will sort the data prior to computing angles.", + "oneOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": false + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "start": { + "type": "string", + "default": "layout_start" + }, + "end": { + "type": "string", + "default": "layout_end" + }, + "mid": { + "type": "string", + "default": "layout_mid" + } + } + } + }, + "required": [ + "type" + ] + }, + "sortTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Sort transform", + "description": "Sorts the values of a data set.", + "type": "object", + "properties": { + "type": { + "enum": [ + "sort" + ] + }, + "by": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "description": "A list of fields to use as sort criteria." + } + }, + "required": [ + "type", + "by" + ] + }, + "stackTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Stack transform", + "description": "Computes layout values for stacked graphs, as in stacked bar charts or stream graphs.", + "type": "object", + "properties": { + "type": { + "enum": [ + "stack" + ] + }, + "groupby": { + "description": "A list of fields to split the data into groups (stacks).", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { - "type": "array", - "items": { - "oneOf": [ - { - "type": "number" - }, - { - "$ref": "#/refs/signal" - } - ] - }, - "minItems": 2, - "maxItems": 2 + "type": "string" }, { "$ref": "#/refs/signal" } - ], - "default": [ - 900, - 500 ] - }, - "font": { - "description": "The font face to use for a word.", + } + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "sortby": { + "description": "A list of fields to determine the sort order of stacks.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "string" @@ -3568,11 +3633,84 @@ { "$ref": "#/refs/signal" } - ], - "default": "sans-serif" - }, - "fontStyle": { - "description": "The font style to use for a word.", + ] + } + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "field": { + "description": "The data field that determines the thickness/height of stacks.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "offset": { + "description": "The baseline offset", + "oneOf": [ + { + "enum": [ + "zero", + "center", + "normalize" + ] + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "zero" + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "start": { + "type": "string", + "default": "layout_start" + }, + "end": { + "type": "string", + "default": "layout_end" + }, + "mid": { + "type": "string", + "default": "layout_mid" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type", + "groupby", + "field" + ] + }, + "treemapTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Treemap transform", + "type": "object", + "properties": { + "type": { + "enum": [ + "treemap" + ] + }, + "sort": { + "description": "A list of fields to use as sort criteria for sibling nodes.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "string" @@ -3580,46 +3718,180 @@ { "$ref": "#/refs/signal" } - ], - "default": "normal" - }, - "fontWeight": { - "description": "The font weight to use for a word.", + ] + } + }, + { + "$ref": "#/refs/signal" + } + ], + "default": [ + "-value" + ] + }, + "children": { + "description": "A data field that represents the children array", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "field": { + "description": "The values to use to determine the area of each leaf-level treemap cell.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "size": { + "description": "The dimensions of the treemap layout", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { - "type": "string" + "type": "number" }, { "$ref": "#/refs/signal" } - ], - "default": "normal" + ] }, - "fontSize": { - "description": "The font size to use for a word.", + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ], + "default": [ + 500, + 500 + ] + }, + "round": { + "description": "If true, treemap cell dimensions will be rounded to integer pixels.", + "oneOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": true + }, + "sticky": { + "description": "If true, repeated runs of the treemap will use cached partition boundaries.", + "oneOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": false + }, + "ratio": { + "description": "The target aspect ratio for the layout to optimize.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 1.618033988749895 + }, + "padding": { + "oneOf": [ + { + "type": "number" + }, + { + "type": "array", + "items": { "oneOf": [ { "type": "number" }, - { - "type": "string" - }, { "$ref": "#/refs/signal" } - ], - "default": 14 + ] }, - "fontScale": { - "description": "The minimum and maximum scaled font sizes, or null to prevent scaling.", + "minItems": 4, + "maxItems": 4 + }, + { + "$ref": "#/refs/signal" + } + ], + "description": "he padding (in pixels) to provide around internal nodes in the treemap." + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "x": { + "type": "string", + "default": "layout_x" + }, + "y": { + "type": "string", + "default": "layout_y" + }, + "width": { + "type": "string", + "default": "layout_width" + }, + "height": { + "type": "string", + "default": "layout_height" + }, + "depth": { + "type": "string", + "default": "layout_depth" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "voronoiTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Voronoi transform", + "type": "object", + "properties": { + "type": { + "enum": [ + "voronoi" + ] + }, + "clipExtent": { + "description": "The min and max points at which to clip the voronoi diagram.", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ - { - "type": "null" - }, { "type": "array", - "minItems": 2, - "maxItems": 2, "items": { "oneOf": [ { @@ -3629,58 +3901,171 @@ "$ref": "#/refs/signal" } ] - } + }, + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" } - ], - "default": [ - 10, - 50 ] }, - "rotate": { - "description": "The field or number to set the roration angle (in degrees).", + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ], + "default": [ + [ + -100000, + -100000 + ], + [ + 100000, + 100000 + ] + ] + }, + "x": { + "description": "The input x coordinates.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "y": { + "description": "The input y coordinates.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ] + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "path": { + "type": "string", + "default": "layout_path" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "wordcloudTransform": { + "$schema": "http://json-schema.org/draft-04/schema#", + "title": "Wordcloud transform", + "type": "object", + "properties": { + "type": { + "enum": [ + "wordcloud" + ] + }, + "size": { + "description": "The dimensions of the wordcloud layout", + "oneOf": [ + { + "type": "array", + "items": { "oneOf": [ { "type": "number" }, - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": 0 - }, - "text": { - "description": "The field containing the text to use for each word.", - "oneOf": [ - { - "type": "string" - }, - { - "$ref": "#/refs/signal" - } - ], - "default": "data" - }, - "spiral": { - "description": "The type of spiral used for positioning words, either 'archimedean' or 'rectangular'.", - "oneOf": [ - { - "enum": [ - "archimedean", - "rectangular" - ] - }, { "$ref": "#/refs/signal" } - ], - "default": "archimedean" + ] }, - "padding": { - "description": "The padding around each word.", + "minItems": 2, + "maxItems": 2 + }, + { + "$ref": "#/refs/signal" + } + ], + "default": [ + 900, + 500 + ] + }, + "font": { + "description": "The font face to use for a word.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "sans-serif" + }, + "fontStyle": { + "description": "The font style to use for a word.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "normal" + }, + "fontWeight": { + "description": "The font weight to use for a word.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "normal" + }, + "fontSize": { + "description": "The font size to use for a word.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 14 + }, + "fontScale": { + "description": "The minimum and maximum scaled font sizes, or null to prevent scaling.", + "oneOf": [ + { + "type": "null" + }, + { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { "oneOf": [ { "type": "number" @@ -3688,49 +4073,173 @@ { "$ref": "#/refs/signal" } - ], - "default": 1 - }, - "output": { - "type": "object", - "description": "Rename the output data fields", - "properties": { - "x": { - "type": "string", - "default": "layout_x" - }, - "y": { - "type": "string", - "default": "layout_y" - }, - "font": { - "type": "string", - "default": "layout_font" - }, - "fontSize": { - "type": "string", - "default": "layout_fontSize" - }, - "fontStyle": { - "type": "string", - "default": "layout_fontStyle" - }, - "fontWeight": { - "type": "string", - "default": "layout_fontWeight" - }, - "rotate": { - "type": "string", - "default": "layout_rotate" - } - }, - "additionalProperties": false + ] } + } + ], + "default": [ + 10, + 50 + ] + }, + "rotate": { + "description": "The field or number to set the roration angle (in degrees).", + "oneOf": [ + { + "type": "number" }, - "additionalProperties": false, - "required": [ - "type" - ] + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 0 + }, + "text": { + "description": "The field containing the text to use for each word.", + "oneOf": [ + { + "type": "string" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "data" + }, + "spiral": { + "description": "The type of spiral used for positioning words, either 'archimedean' or 'rectangular'.", + "oneOf": [ + { + "enum": [ + "archimedean", + "rectangular" + ] + }, + { + "$ref": "#/refs/signal" + } + ], + "default": "archimedean" + }, + "padding": { + "description": "The padding around each word.", + "oneOf": [ + { + "type": "number" + }, + { + "$ref": "#/refs/signal" + } + ], + "default": 1 + }, + "output": { + "type": "object", + "description": "Rename the output data fields", + "properties": { + "x": { + "type": "string", + "default": "layout_x" + }, + "y": { + "type": "string", + "default": "layout_y" + }, + "font": { + "type": "string", + "default": "layout_font" + }, + "fontSize": { + "type": "string", + "default": "layout_fontSize" + }, + "fontStyle": { + "type": "string", + "default": "layout_fontStyle" + }, + "fontWeight": { + "type": "string", + "default": "layout_fontWeight" + }, + "rotate": { + "type": "string", + "default": "layout_rotate" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "required": [ + "type" + ] + }, + "transform": { + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/defs/aggregateTransform" + }, + { + "$ref": "#/defs/binTransform" + }, + { + "$ref": "#/defs/crossTransform" + }, + { + "$ref": "#/defs/countpatternTransform" + }, + { + "$ref": "#/defs/linkpathTransform" + }, + { + "$ref": "#/defs/facetTransform" + }, + { + "$ref": "#/defs/filterTransform" + }, + { + "$ref": "#/defs/foldTransform" + }, + { + "$ref": "#/defs/forceTransform" + }, + { + "$ref": "#/defs/formulaTransform" + }, + { + "$ref": "#/defs/geoTransform" + }, + { + "$ref": "#/defs/geopathTransform" + }, + { + "$ref": "#/defs/imputeTransform" + }, + { + "$ref": "#/defs/lookupTransform" + }, + { + "$ref": "#/defs/pieTransform" + }, + { + "$ref": "#/defs/sortTransform" + }, + { + "$ref": "#/defs/stackTransform" + }, + { + "$ref": "#/defs/treemapTransform" + }, + { + "$ref": "#/defs/voronoiTransform" + }, + { + "$ref": "#/defs/wordcloudTransform" } ] } @@ -4357,12 +4866,90 @@ } ] } - } - }, - "additionalProperties": false, - "required": [ - "rule" - ] + } + }, + "additionalProperties": false, + "required": [ + "rule" + ] + }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "type": {} + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } }, { "type": "object", @@ -4503,6 +5090,84 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/numberModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "type": "number" + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ @@ -4652,6 +5317,94 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "type": "string" + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + }, + { + "properties": { + "template": { + "type": "string" + } + }, + "required": [ + "template" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ @@ -4801,6 +5554,84 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "type": "boolean" + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ @@ -4940,6 +5771,84 @@ "rule" ] }, + { + "type": "array", + "items": { + "allOf": [ + { + "type": "object", + "properties": { + "predicate": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "required": [ + "name" + ] + } + ] + } + } + }, + { + "type": "object", + "allOf": [ + { + "$ref": "#/refs/stringModifiers" + }, + { + "oneOf": [ + { + "$ref": "#/refs/signal", + "required": [ + "signal" + ] + }, + { + "properties": { + "value": { + "type": "array" + } + }, + "required": [ + "value" + ] + }, + { + "properties": { + "field": { + "$ref": "#/refs/field" + } + }, + "required": [ + "field" + ] + }, + { + "properties": { + "band": { + "type": "boolean" + } + }, + "required": [ + "band" + ] + } + ] + } + ] + } + ] + } + }, { "type": "object", "allOf": [ diff --git a/gallery/bower_components/vega/vega.js b/gallery/bower_components/vega/vega.js index 7ad18d722a..856050b0b8 100644 --- a/gallery/bower_components/vega/vega.js +++ b/gallery/bower_components/vega/vega.js @@ -1,6 +1,6 @@ (function(f){if(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.vg = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 5, + ch = 1 << 11; + +module.exports = function() { + var size = [256, 256], + text = cloudText, + font = cloudFont, + fontSize = cloudFontSize, + fontStyle = cloudFontNormal, + fontWeight = cloudFontNormal, + rotate = cloudRotate, + padding = cloudPadding, + spiral = archimedeanSpiral, + words = [], + timeInterval = Infinity, + event = dispatch("word", "end"), + timer = null, + random = Math.random, + cloud = {}, + canvas = cloudCanvas; + + cloud.canvas = function(_) { + return arguments.length ? (canvas = functor(_), cloud) : canvas; + }; + + cloud.start = 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, i) { + d.text = text.call(this, d, i); + d.font = font.call(this, d, i); + d.style = fontStyle.call(this, d, i); + d.weight = fontWeight.call(this, d, i); + d.rotate = rotate.call(this, d, i); + d.size = ~~fontSize.call(this, d, i); + d.padding = padding.call(this, d, i); + return d; + }).sort(function(a, b) { return b.size - a.size; }); + + if (timer) clearInterval(timer); + timer = setInterval(step, 0); + step(); + + return cloud; + + function step() { + var start = Date.now(); + while (Date.now() - start < timeInterval && ++i < n && timer) { + 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); + event.word(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; + } + } + if (i >= n) { + cloud.stop(); + event.end(tags, bounds); + } + } + } + + cloud.stop = function() { + if (timer) { + clearInterval(timer); + timer = null; + } + return cloud; + }; + + 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 perimeter = [{x: 0, y: 0}, {x: size[0], y: size[1]}], + 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; + } + delete tag.sprite; + return true; + } + } + } + return false; + } + + cloud.timeInterval = function(_) { + return arguments.length ? (timeInterval = _ == null ? Infinity : _, cloud) : timeInterval; + }; + + cloud.words = function(_) { + return arguments.length ? (words = _, cloud) : words; + }; + + cloud.size = function(_) { + return arguments.length ? (size = [+_[0], +_[1]], cloud) : size; + }; + + cloud.font = function(_) { + return arguments.length ? (font = functor(_), cloud) : font; + }; + + cloud.fontStyle = function(_) { + return arguments.length ? (fontStyle = functor(_), cloud) : fontStyle; + }; + + cloud.fontWeight = function(_) { + return arguments.length ? (fontWeight = functor(_), cloud) : fontWeight; + }; + + cloud.rotate = function(_) { + return arguments.length ? (rotate = functor(_), cloud) : rotate; + }; + + cloud.text = function(_) { + return arguments.length ? (text = functor(_), cloud) : text; + }; + + cloud.spiral = function(_) { + return arguments.length ? (spiral = spirals[_] || _, cloud) : spiral; + }; + + cloud.fontSize = function(_) { + return arguments.length ? (fontSize = functor(_), cloud) : fontSize; + }; + + cloud.padding = function(_) { + return arguments.length ? (padding = functor(_), cloud) : padding; + }; + + cloud.random = function(_) { + return arguments.length ? (random = _, cloud) : random; + }; + + cloud.on = function() { + var value = event.on.apply(event, arguments); + return value === event ? cloud : value; + }; + + return cloud; +}; + +function cloudText(d) { + return d.text; +} + +function cloudFont() { + return "serif"; +} + +function cloudFontNormal() { + return "normal"; +} + +function cloudFontSize(d) { + return Math.sqrt(d.value); +} + +function cloudRotate() { + return (~~(Math.random() * 6) - 3) * 30; +} + +function cloudPadding() { + return 1; +} + +// 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; + --di; + while (++di < n) { + d = data[di]; + c.save(); + c.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font; + var 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; + var w = d.width, + w32 = w >> 5, + h = d.y1 - d.y0; + // Zero the buffer + for (var 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 (var j = 0; j < h; j++) { + for (var 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 cloudCanvas() { + return document.createElement("canvas"); +} + +function functor(d) { + return typeof d === "function" ? d : function() { return d; }; +} + +var spirals = { + archimedean: archimedeanSpiral, + rectangular: rectangularSpiral +}; + +},{"d3-dispatch":4}],4:[function(require,module,exports){ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + factory((global.dispatch = {})); +}(this, function (exports) { 'use strict'; + + function Dispatch(types) { + var i = -1, + n = types.length, + callbacksByType = {}, + callbackByName = {}, + type, + that = this; + + that.on = function(type, callback) { + type = parseType(type); + + // Return the current callback, if any. + if (arguments.length < 2) { + return (callback = callbackByName[type.name]) && callback.value; + } + + // If a type was specified… + if (type.type) { + var callbacks = callbacksByType[type.type], + callback0 = callbackByName[type.name], + i; + + // Remove the current callback, if any, using copy-on-remove. + if (callback0) { + callback0.value = null; + i = callbacks.indexOf(callback0); + callbacksByType[type.type] = callbacks = callbacks.slice(0, i).concat(callbacks.slice(i + 1)); + delete callbackByName[type.name]; + } + + // Add the new callback, if any. + if (callback) { + callback = {value: callback}; + callbackByName[type.name] = callback; + callbacks.push(callback); + } + } + + // Otherwise, if a null callback was specified, remove all callbacks with the given name. + else if (callback == null) { + for (var otherType in callbacksByType) { + if (callback = callbackByName[otherType + type.name]) { + callback.value = null; + var callbacks = callbacksByType[otherType], i = callbacks.indexOf(callback); + callbacksByType[otherType] = callbacks.slice(0, i).concat(callbacks.slice(i + 1)); + delete callbackByName[callback.name]; + } + } + } + + return that; + }; + + while (++i < n) { + type = types[i] + ""; + if (!type || (type in that)) throw new Error("illegal or duplicate type: " + type); + callbacksByType[type] = []; + that[type] = applier(type); + } + + function parseType(type) { + var i = (type += "").indexOf("."), name = type; + if (i >= 0) type = type.slice(0, i); else name += "."; + if (type && !callbacksByType.hasOwnProperty(type)) throw new Error("unknown type: " + type); + return {type: type, name: name}; + } + + function applier(type) { + return function() { + var callbacks = callbacksByType[type], // Defensive reference; copy-on-remove. + callback, + callbackValue, + i = -1, + n = callbacks.length; + + while (++i < n) { + if (callbackValue = (callback = callbacks[i]).value) { + callbackValue.apply(this, arguments); + } + } + + return that; + }; + } + } + + function dispatch() { + return new Dispatch(arguments); + } + + dispatch.prototype = Dispatch.prototype; // allow instanceof + + exports.dispatch = dispatch; + +})); +},{}],5:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -146,26 +652,7 @@ module.exports = { exports.dsv = dsv; })); -},{}],4:[function(require,module,exports){ -if (typeof Map === "undefined") { - Map = function() { this.clear(); }; - Map.prototype = { - set: function(k, v) { this._[k] = v; return this; }, - get: function(k) { return this._[k]; }, - has: function(k) { return k in this._; }, - delete: function(k) { return k in this._ && delete this._[k]; }, - clear: function() { this._ = Object.create(null); }, - get size() { var n = 0; for (var k in this._) ++n; return n; }, - forEach: function(c) { for (var k in this._) c(this._[k], k, this); } - }; -} else (function() { - var m = new Map; - if (m.set(0, 0) !== m) { - m = m.set; - Map.prototype.set = function() { m.apply(this, arguments); return this; }; - } -})(); - +},{}],6:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -574,25 +1061,26 @@ if (typeof Map === "undefined") { return Math.max(0, -exponent(Math.abs(step))); } - var localeDefinitions = (new Map) - .set("ca-ES", caEs) - .set("de-DE", deDe) - .set("en-CA", enCa) - .set("en-GB", enGb) - .set("en-US", enUs) - .set("es-ES", esEs) - .set("fi-FI", fiFi) - .set("fr-CA", frCa) - .set("fr-FR", frFr) - .set("he-IL", heIl) - .set("it-IT", itIt) - .set("ja-JP", jaJp) - .set("mk-MK", mkMk) - .set("nl-NL", nlNl) - .set("pl-PL", plPl) - .set("pt-BR", ptBr) - .set("ru-RU", ruRu) - .set("zh-CN", zhCn); + var localeDefinitions = { + "ca-ES": caEs, + "de-DE": deDe, + "en-CA": enCa, + "en-GB": enGb, + "en-US": enUs, + "es-ES": esEs, + "fi-FI": fiFi, + "fr-CA": frCa, + "fr-FR": frFr, + "he-IL": heIl, + "it-IT": itIt, + "ja-JP": jaJp, + "mk-MK": mkMk, + "nl-NL": nlNl, + "pl-PL": plPl, + "pt-BR": ptBr, + "ru-RU": ruRu, + "zh-CN": zhCn + }; var defaultLocale = locale(enUs); exports.format = defaultLocale.format; @@ -600,8 +1088,8 @@ if (typeof Map === "undefined") { function localeFormat(definition) { if (typeof definition === "string") { - definition = localeDefinitions.get(definition); - if (!definition) return null; + if (!localeDefinitions.hasOwnProperty(definition)) return null; + definition = localeDefinitions[definition]; } return locale(definition); } @@ -614,26 +1102,7 @@ if (typeof Map === "undefined") { exports.precisionRound = precisionRound; })); -},{}],5:[function(require,module,exports){ -if (typeof Map === "undefined") { - Map = function() { this.clear(); }; - Map.prototype = { - set: function(k, v) { this._[k] = v; return this; }, - get: function(k) { return this._[k]; }, - has: function(k) { return k in this._; }, - delete: function(k) { return k in this._ && delete this._[k]; }, - clear: function() { this._ = Object.create(null); }, - get size() { var n = 0; for (var k in this._) ++n; return n; }, - forEach: function(c) { for (var k in this._) c(this._[k], k, this); } - }; -} else (function() { - var m = new Map; - if (m.set(0, 0) !== m) { - m = m.set; - Map.prototype.set = function() { m.apply(this, arguments); return this; }; - } -})(); - +},{}],7:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -1169,22 +1638,22 @@ if (typeof Map === "undefined") { function parseShortWeekday(d, string, i) { var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + 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.get(n[0].toLowerCase()), i + n[0].length) : -1; + 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.get(n[0].toLowerCase()), i + n[0].length) : -1; + 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.get(n[0].toLowerCase()), i + n[0].length) : -1; + return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; } function parseLocaleDateTime(d, string, i) { @@ -1200,7 +1669,7 @@ if (typeof Map === "undefined") { } function parsePeriod(d, string, i) { - var n = periodLookup.get(string.slice(i, i += 2).toLowerCase()); + var n = periodLookup[string.slice(i, i += 2).toLowerCase()]; return n == null ? -1 : (d.p = n, i); } @@ -1281,8 +1750,8 @@ if (typeof Map === "undefined") { } function formatLookup(names) { - var map = new Map, i = -1, n = names.length; - while (++i < n) map.set(names[i].toLowerCase(), i); + var map = {}, i = -1, n = names.length; + while (++i < n) map[names[i].toLowerCase()] = i; return map; } @@ -1312,9 +1781,14 @@ if (typeof Map === "undefined") { } function parseZone(d, string, i) { - return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) - ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset! - : -1; + var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6)); + if (n) { + d.Z = n[1] ? 0 // 'Z' for UTC + : n[3] ? -(n[2] + n[3]) // sign differs from getTimezoneOffset! + : -n[2] * 100; + return i + n[0].length; + } + return -1; } function parseMonthNumber(d, string, i) { @@ -1497,25 +1971,26 @@ if (typeof Map === "undefined") { var isoFormat = formatIso; - var localeDefinitions = (new Map) - .set("ca-ES", caEs) - .set("de-DE", deDe) - .set("en-CA", enCa) - .set("en-GB", enGb) - .set("en-US", enUs) - .set("es-ES", esEs) - .set("fi-FI", fiFi) - .set("fr-CA", frCa) - .set("fr-FR", frFr) - .set("he-IL", heIl) - .set("it-IT", itIt) - .set("ja-JP", jaJp) - .set("mk-MK", mkMk) - .set("nl-NL", nlNl) - .set("pl-PL", plPl) - .set("pt-BR", ptBr) - .set("ru-RU", ruRu) - .set("zh-CN", zhCn); + var localeDefinitions = { + "ca-ES": caEs, + "de-DE": deDe, + "en-CA": enCa, + "en-GB": enGb, + "en-US": enUs, + "es-ES": esEs, + "fi-FI": fiFi, + "fr-CA": frCa, + "fr-FR": frFr, + "he-IL": heIl, + "it-IT": itIt, + "ja-JP": jaJp, + "mk-MK": mkMk, + "nl-NL": nlNl, + "pl-PL": plPl, + "pt-BR": ptBr, + "ru-RU": ruRu, + "zh-CN": zhCn + }; var defaultLocale = locale(enUs); exports.format = defaultLocale.format; @@ -1523,8 +1998,8 @@ if (typeof Map === "undefined") { function localeFormat(definition) { if (typeof definition === "string") { - definition = localeDefinitions.get(definition); - if (!definition) return null; + if (!localeDefinitions.hasOwnProperty(definition)) return null; + definition = localeDefinitions[definition]; } return locale(definition); } @@ -1534,7 +2009,7 @@ if (typeof Map === "undefined") { exports.isoFormat = isoFormat; })); -},{}],6:[function(require,module,exports){ +},{}],8:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -1824,7 +2299,7 @@ if (typeof Map === "undefined") { exports.utcYear = utcYear; })); -},{}],7:[function(require,module,exports){ +},{}],9:[function(require,module,exports){ var util = require('../util'), Measures = require('./measures'), Collector = require('./collector'); @@ -2132,7 +2607,7 @@ proto._consolidate = function() { }; module.exports = Aggregator; -},{"../util":29,"./collector":8,"./measures":10}],8:[function(require,module,exports){ +},{"../util":31,"./collector":10,"./measures":12}],10:[function(require,module,exports){ var util = require('../util'); var stats = require('../stats'); @@ -2250,7 +2725,7 @@ proto.q3 = function(get) { module.exports = Collector; -},{"../stats":26,"../util":29}],9:[function(require,module,exports){ +},{"../stats":28,"../util":31}],11:[function(require,module,exports){ var util = require('../util'); var Aggregator = require('./aggregator'); @@ -2265,7 +2740,7 @@ module.exports = function() { .summarize({'*':'values'}); }; -},{"../util":29,"./aggregator":7}],10:[function(require,module,exports){ +},{"../util":31,"./aggregator":9}],12:[function(require,module,exports){ var util = require('../util'); var types = { @@ -2447,7 +2922,7 @@ function create(agg, stream, accessor, mutator) { types.create = create; module.exports = types; -},{"../stats":26,"../util":29}],11:[function(require,module,exports){ +},{"../stats":28,"../util":31}],13:[function(require,module,exports){ var util = require('../util'), time = require('../time'), EPSILON = 1e-15; @@ -2562,7 +3037,7 @@ bins.date = function(opt) { module.exports = bins; -},{"../time":28,"../util":29}],12:[function(require,module,exports){ +},{"../time":30,"../util":31}],14:[function(require,module,exports){ var bins = require('./bins'), gen = require('../generate'), type = require('../import/type'), @@ -2647,7 +3122,7 @@ module.exports = { $bin: $bin, histogram: histogram }; -},{"../generate":14,"../import/type":23,"../stats":26,"../util":29,"./bins":11}],13:[function(require,module,exports){ +},{"../generate":16,"../import/type":25,"../stats":28,"../util":31,"./bins":13}],15:[function(require,module,exports){ var d3_time = require('d3-time'), d3_timeF = require('d3-time-format'), d3_numberF = require('d3-format'), @@ -2797,7 +3272,7 @@ function utcAutoFormat() { }; } -},{"d3-format":4,"d3-time":6,"d3-time-format":5}],14:[function(require,module,exports){ +},{"d3-format":6,"d3-time":8,"d3-time-format":7}],16:[function(require,module,exports){ var gen = module.exports = {}; gen.repeat = function(val, n) { @@ -2876,7 +3351,7 @@ gen.random.normal = function(mean, stdev) { f.samples = function(n) { return gen.zeros(n).map(f); }; return f; }; -},{}],15:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ var util = require('../../util'); var d3_dsv = require('d3-dsv'); @@ -2896,7 +3371,7 @@ dsv.delimiter = function(delim) { }; module.exports = dsv; -},{"../../util":29,"d3-dsv":3}],16:[function(require,module,exports){ +},{"../../util":31,"d3-dsv":5}],18:[function(require,module,exports){ var dsv = require('./dsv'); module.exports = { @@ -2907,7 +3382,7 @@ module.exports = { csv: dsv.delimiter(','), tsv: dsv.delimiter('\t') }; -},{"./dsv":15,"./json":17,"./topojson":18,"./treejson":19}],17:[function(require,module,exports){ +},{"./dsv":17,"./json":19,"./topojson":20,"./treejson":21}],19:[function(require,module,exports){ var util = require('../../util'); module.exports = function(data, format) { @@ -2919,7 +3394,7 @@ module.exports = function(data, format) { return d; }; -},{"../../util":29}],18:[function(require,module,exports){ +},{"../../util":31}],20:[function(require,module,exports){ (function (global){ var json = require('./json'); @@ -2950,7 +3425,7 @@ reader.topojson = (typeof window !== "undefined" ? window['topojson'] : typeof g module.exports = reader; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./json":17}],19:[function(require,module,exports){ +},{"./json":19}],21:[function(require,module,exports){ var json = require('./json'); module.exports = function(data, format) { @@ -2975,7 +3450,7 @@ function toTable(root, childrenField) { visit(root, null); return (table.root = root, table); } -},{"./json":17}],20:[function(require,module,exports){ +},{"./json":19}],22:[function(require,module,exports){ // Matches absolute URLs with optional protocol // https://... file://... //... var protocol_re = /^([A-Za-z]+:)?\/\//; @@ -3143,7 +3618,7 @@ load.useXHR = (typeof XMLHttpRequest !== 'undefined'); module.exports = load; -},{"fs":2,"request":2,"sync-request":2,"url":2}],21:[function(require,module,exports){ +},{"fs":2,"request":2,"sync-request":2,"url":2}],23:[function(require,module,exports){ var util = require('../util'); var type = require('./type'); var formats = require('./formats'); @@ -3174,7 +3649,7 @@ function parse(data, types) { read.formats = formats; module.exports = read; -},{"../util":29,"./formats":16,"./type":23}],22:[function(require,module,exports){ +},{"../util":31,"./formats":18,"./type":25}],24:[function(require,module,exports){ var util = require('../util'); var load = require('./load'); var read = require('./read'); @@ -3212,7 +3687,7 @@ module.exports = util return out; }, {}); -},{"../util":29,"./load":20,"./read":21}],23:[function(require,module,exports){ +},{"../util":31,"./load":22,"./read":23}],25:[function(require,module,exports){ var util = require('../util'); var TYPES = '__types__'; @@ -3303,7 +3778,7 @@ type.infer = infer; type.inferAll = inferAll; type.parsers = PARSERS; module.exports = type; -},{"../util":29}],24:[function(require,module,exports){ +},{"../util":31}],26:[function(require,module,exports){ var util = require('./util'); var dl = { @@ -3328,7 +3803,7 @@ util.extend(dl, require('./stats')); util.extend(dl, require('./import/readers')); module.exports = dl; -},{"./aggregate/aggregator":7,"./aggregate/groupby":9,"./bins/bins":11,"./bins/histogram":12,"./format":13,"./generate":14,"./import/load":20,"./import/read":21,"./import/readers":22,"./import/type":23,"./print":25,"./stats":26,"./template":27,"./time":28,"./util":29}],25:[function(require,module,exports){ +},{"./aggregate/aggregator":9,"./aggregate/groupby":11,"./bins/bins":13,"./bins/histogram":14,"./format":15,"./generate":16,"./import/load":22,"./import/read":23,"./import/readers":24,"./import/type":25,"./print":27,"./stats":28,"./template":29,"./time":30,"./util":31}],27:[function(require,module,exports){ var util = require('./util'); var type = require('./import/type'); var stats = require('./stats'); @@ -3427,7 +3902,7 @@ function printCategoricalProfile(p) { .map(function(v) { return ' \'' + v + '\' (' + u[v] + ')'; }); return list.concat(top).join('\n'); } -},{"./import/type":23,"./stats":26,"./template":27,"./util":29}],26:[function(require,module,exports){ +},{"./import/type":25,"./stats":28,"./template":29,"./util":31}],28:[function(require,module,exports){ var util = require('./util'); var type = require('./import/type'); var gen = require('./generate'); @@ -3916,7 +4391,7 @@ stats.summary = function(data, fields) { }; module.exports = stats; -},{"./generate":14,"./import/type":23,"./util":29}],27:[function(require,module,exports){ +},{"./generate":16,"./import/type":25,"./util":31}],29:[function(require,module,exports){ var util = require('./util'), format = require('./format'); @@ -4134,7 +4609,7 @@ function template_format(pattern, key, fmt) { return context.format_map[key]; } -},{"./format":13,"./util":29}],28:[function(require,module,exports){ +},{"./format":15,"./util":31}],30:[function(require,module,exports){ var d3_time = require('d3-time'); var tempDate = new Date(), @@ -4305,7 +4780,7 @@ function toUnitMap(units) { module.exports = toUnitMap(locale); module.exports.utc = toUnitMap(utc); -},{"d3-time":6}],29:[function(require,module,exports){ +},{"d3-time":8}],31:[function(require,module,exports){ var buffer = require('buffer'), time = require('./time'), utc = time.utc; @@ -4623,7 +5098,7 @@ function truncateOnWord(s, len, rev) { var truncate_word_re = /([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/; -},{"./time":28,"buffer":2}],30:[function(require,module,exports){ +},{"./time":30,"buffer":2}],32:[function(require,module,exports){ var DEPS = require('./Dependencies').ALL; function create(cs, reflow) { @@ -4655,7 +5130,7 @@ module.exports = { create: create, copy: copy }; -},{"./Dependencies":33}],31:[function(require,module,exports){ +},{"./Dependencies":35}],33:[function(require,module,exports){ var log = require('vega-logging'), Tuple = require('./Tuple'), Base = require('./Node').prototype; @@ -4698,7 +5173,7 @@ prototype.evaluate = function(input) { }; module.exports = Collector; -},{"./Node":36,"./Tuple":38,"vega-logging":45}],32:[function(require,module,exports){ +},{"./Node":38,"./Tuple":40,"vega-logging":47}],34:[function(require,module,exports){ var log = require('vega-logging'), ChangeSet = require('./ChangeSet'), Collector = require('./Collector'), @@ -4868,6 +5343,10 @@ function DataSourceInput(ds) { ds._data = ds._data.concat(delta.add); } + if (delta.sort) { + ds._data.sort(delta.sort); + } + // if reflowing, add any other tuples not currently in changeset if (input.reflow) { delta.mod = delta.mod.concat( @@ -4952,13 +5431,13 @@ function DataSourceListener(ds) { module.exports = DataSource; -},{"./ChangeSet":30,"./Collector":31,"./Node":36,"./Tuple":38,"vega-logging":45}],33:[function(require,module,exports){ +},{"./ChangeSet":32,"./Collector":33,"./Node":38,"./Tuple":40,"vega-logging":47}],35:[function(require,module,exports){ var deps = module.exports = { ALL: ['data', 'fields', 'scales', 'signals'] }; deps.ALL.forEach(function(k) { deps[k.toUpperCase()] = k; }); -},{}],34:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ var dl = require('datalib'), Heap = require('./Heap'), ChangeSet = require('./ChangeSet'), @@ -5160,7 +5639,7 @@ prototype.preprocess = function(branch) { }; prototype.connect = function(branch) { - var collector, node, data, signals, i, n, j, m; + var collector, node, data, signals, i, n, j, m, x, y; // connect the pipeline for (i=0, n=branch.length; i 0) branch[i-1].addListener(node); @@ -5241,7 +5728,7 @@ prototype.evaluate = function(pulse, node) { module.exports = Graph; -},{"./ChangeSet":30,"./Collector":31,"./DataSource":32,"./Dependencies":33,"./Heap":35,"./Signal":37,"./Tuple":38,"datalib":24}],35:[function(require,module,exports){ +},{"./ChangeSet":32,"./Collector":33,"./DataSource":34,"./Dependencies":35,"./Heap":37,"./Signal":39,"./Tuple":40,"datalib":26}],37:[function(require,module,exports){ function Heap(comparator) { this.cmp = comparator; this.nodes = []; @@ -5338,7 +5825,7 @@ function _siftup(array, idx, cmp) { module.exports = Heap; -},{}],36:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ var DEPS = require('./Dependencies').ALL, nodeID = 0; @@ -5529,7 +6016,7 @@ Node.reset = function() { nodeID = 0; }; module.exports = Node; -},{"./Dependencies":33}],37:[function(require,module,exports){ +},{"./Dependencies":35}],39:[function(require,module,exports){ var ChangeSet = require('./ChangeSet'), Node = require('./Node'), // jshint ignore:line Base = Node.prototype; @@ -5605,7 +6092,7 @@ prototype.off = function(handler) { module.exports = Signal; -},{"./ChangeSet":30,"./Node":36}],38:[function(require,module,exports){ +},{"./ChangeSet":32,"./Node":38}],40:[function(require,module,exports){ var tupleID = 0; function ingest(datum) { @@ -5675,7 +6162,7 @@ module.exports = { } }; -},{}],39:[function(require,module,exports){ +},{}],41:[function(require,module,exports){ module.exports = { ChangeSet: require('./ChangeSet'), Collector: require('./Collector'), @@ -5688,7 +6175,7 @@ module.exports = { debug: require('vega-logging').debug }; -},{"./ChangeSet":30,"./Collector":31,"./DataSource":32,"./Dependencies":33,"./Graph":34,"./Node":36,"./Signal":37,"./Tuple":38,"vega-logging":45}],40:[function(require,module,exports){ +},{"./ChangeSet":32,"./Collector":33,"./DataSource":34,"./Dependencies":35,"./Graph":36,"./Node":38,"./Signal":39,"./Tuple":40,"vega-logging":47}],42:[function(require,module,exports){ function toMap(list) { var map = {}, i, n; for (i=0, n=list.length; i 0) { + if (group.fill && util.fill(g, group, opac)) { + g.fillRect(gx, gy, w, h); + } + if (group.stroke && util.stroke(g, group, opac)) { + g.strokeRect(gx, gy, w, h); + } + } + } - // render group contents + // setup graphics context g.save(); g.translate(gx, gy); if (group.clip) { g.beginPath(); - g.rect(0, 0, group.width || 0, group.height || 0); + g.rect(0, 0, w, h); g.clip(); } - if (bounds) bounds.translate(-gx, -gy); + // draw group contents for (j=0, m=axes.length; j=0;) { - group = items[i]; - dx = group.x || 0; - dy = group.y || 0; + var groups = scene.items || EMPTY, subscene, + group, axes, items, legends, hits, dx, dy, i, j, b; + + for (i=groups.length; --i>=0;) { + group = groups[i]; + + // first hit test against bounding box + // if a group is clipped, that should be handled by the bounds check. + b = group.bounds; + if (b && !b.contains(gx, gy)) continue; + + // passed bounds check, so test sub-groups + axes = group.axisItems || EMPTY; + items = group.items || EMPTY; + legends = group.legendItems || EMPTY; + dx = (group.x || 0); + dy = (group.y || 0); g.save(); g.translate(dx, dy); - for (j=group.items.length; --j >= 0;) { - subscene = group.items[j]; - if (subscene.interactive === false) continue; - hits = this.pick(subscene, x, y, gx-dx, gy-dy); - if (hits) { - g.restore(); - return hits; + dx = gx - dx; + dy = gy - dy; + for (j=legends.length; --j>=0;) { + subscene = legends[j]; + if (subscene.interactive !== false) { + hits = this.pick(subscene, x, y, dx, dy); + if (hits) { g.restore(); return hits; } + } + } + for (j=axes.length; --j>=0;) { + subscene = axes[j]; + if (subscene.interactive !== false && subscene.layer !== 'back') { + hits = this.pick(subscene, x, y, dx, dy); + if (hits) { g.restore(); return hits; } + } + } + for (j=items.length; --j>=0;) { + subscene = items[j]; + if (subscene.interactive !== false) { + hits = this.pick(subscene, x, y, dx, dy); + if (hits) { g.restore(); return hits; } + } + } + for (j=axes.length; --j>=0;) { + subscene = axes[j]; + if (subscene.interative !== false && subscene.layer === 'back') { + hits = this.pick(subscene, x, y, dx, dy); + if (hits) { g.restore(); return hits; } } } g.restore(); + + if (scene.interactive !== false && (group.fill || group.stroke) && + dx >= 0 && dx <= group.width && dy >= 0 && dy <= group.height) { + return group; + } } - return scene.interactive !== false ? pickSelf(g, scene, x, y, gx, gy) : null; + return null; } -var pickSelf = util.pick(hit); - module.exports = { draw: draw, pick: pick }; -},{"./rect":63,"./util":67}],59:[function(require,module,exports){ +},{"./util":69}],61:[function(require,module,exports){ var util = require('./util'); function draw(g, scene, bounds) { @@ -9412,7 +9947,7 @@ module.exports = { draw: draw, pick: util.pick() }; -},{"./util":67}],60:[function(require,module,exports){ +},{"./util":69}],62:[function(require,module,exports){ module.exports = { arc: require('./arc'), area: require('./area'), @@ -9426,7 +9961,7 @@ module.exports = { text: require('./text') }; -},{"./arc":56,"./area":57,"./group":58,"./image":59,"./line":61,"./path":62,"./rect":63,"./rule":64,"./symbol":65,"./text":66}],61:[function(require,module,exports){ +},{"./arc":58,"./area":59,"./group":60,"./image":61,"./line":63,"./path":64,"./rect":65,"./rule":66,"./symbol":67,"./text":68}],63:[function(require,module,exports){ var util = require('./util'), parse = require('../../../path/parse'), render = require('../../../path/render'), @@ -9461,7 +9996,7 @@ module.exports = { nested: true }; -},{"../../../path/parse":49,"../../../path/render":50,"../../../util/svg":83,"./util":67}],62:[function(require,module,exports){ +},{"../../../path/parse":51,"../../../path/render":52,"../../../util/svg":85,"./util":69}],64:[function(require,module,exports){ var util = require('./util'), parse = require('../../../path/parse'), render = require('../../../path/render'); @@ -9477,7 +10012,7 @@ module.exports = { pick: util.pickPath(path) }; -},{"../../../path/parse":49,"../../../path/render":50,"./util":67}],63:[function(require,module,exports){ +},{"../../../path/parse":51,"../../../path/render":52,"./util":69}],65:[function(require,module,exports){ var util = require('./util'); function draw(g, scene, bounds) { @@ -9512,7 +10047,7 @@ module.exports = { draw: draw, pick: util.pick() }; -},{"./util":67}],64:[function(require,module,exports){ +},{"./util":69}],66:[function(require,module,exports){ var util = require('./util'); function draw(g, scene, bounds) { @@ -9569,7 +10104,7 @@ module.exports = { pick: util.pick(hit) }; -},{"./util":67}],65:[function(require,module,exports){ +},{"./util":69}],67:[function(require,module,exports){ var util = require('./util'); var sqrt3 = Math.sqrt(3), @@ -9643,7 +10178,7 @@ module.exports = { draw: util.drawAll(path), pick: util.pickPath(path) }; -},{"./util":67}],66:[function(require,module,exports){ +},{"./util":69}],68:[function(require,module,exports){ var Bounds = require('../../../util/Bounds'), textBounds = require('../../../util/bound').text, text = require('../../../util/text'), @@ -9718,7 +10253,7 @@ module.exports = { pick: util.pick(hit) }; -},{"../../../util/Bounds":74,"../../../util/bound":79,"../../../util/text":84,"./util":67}],67:[function(require,module,exports){ +},{"../../../util/Bounds":76,"../../../util/bound":81,"../../../util/text":86,"./util":69}],69:[function(require,module,exports){ function drawPathOne(path, g, o, items) { if (path(g, items)) return; @@ -9867,13 +10402,13 @@ module.exports = { gradient: gradient }; -},{}],68:[function(require,module,exports){ +},{}],70:[function(require,module,exports){ module.exports = { 'canvas': require('./canvas'), 'svg': require('./svg') }; -},{"./canvas":55,"./svg":72}],69:[function(require,module,exports){ +},{"./canvas":57,"./svg":74}],71:[function(require,module,exports){ var DOM = require('../../util/dom'), Handler = require('../Handler'); @@ -9939,7 +10474,7 @@ prototype.off = function(type, handler) { module.exports = SVGHandler; -},{"../../util/dom":81,"../Handler":51}],70:[function(require,module,exports){ +},{"../../util/dom":83,"../Handler":53}],72:[function(require,module,exports){ var ImageLoader = require('../../util/ImageLoader'), Renderer = require('../Renderer'), text = require('../../util/text'), @@ -10195,8 +10730,7 @@ prototype.drawMark = function(el, scene, index, mdef) { for (i=0, n=items.length; i b ? 1 : a >= b ? 0 : NaN; + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; }); if (vars.x2) { @@ -14293,14 +14839,14 @@ function properties(model, mark, spec) { code += "\n d += set(o, 'y', o.yc);" ; } } - + if (hasPath(mark, vars)) code += "\n d += (item.touch(), 1);"; code += "\n if (trans) trans.interpolate(item, o);"; code += "\n return d > 0;"; try { /* jshint evil:true */ - var encoder = Function('item', 'group', 'trans', 'db', + var encoder = Function('item', 'group', 'trans', 'db', 'signals', 'predicates', code); encoder.tpl = Tuple; encoder.util = dl; @@ -14377,7 +14923,7 @@ function rule(model, name, rules) { "\n d += set(o, "+dl.str(name)+", "+ref.val+");"; code += rules[i+1] ? "\n } else " : " }"; } else { - code += "{" + + code += "{" + "\n d += set(o, "+dl.str(name)+", "+ref.val+");"+ "\n }\n"; } @@ -14403,7 +14949,7 @@ function valueRef(config, name, ref) { } // initialize value - var val = null, scale = null, + var val = null, scale = null, deps = dependencies(), sgRef = null, fRef = null, sRef = null, tmpl = {}; @@ -14413,9 +14959,9 @@ function valueRef(config, name, ref) { var f = dl.field(k), a = f.shift(); if (a === 'parent' || a === 'group') { - deps.nested.push({ + deps.nested.push({ parent: a === 'parent', - group: a === 'group', + group: a === 'group', level: 1 }); } else if (a === 'datum') { @@ -14432,7 +14978,7 @@ function valueRef(config, name, ref) { if (ref.signal !== undefined) { sgRef = dl.field(ref.signal); - val = 'signals['+sgRef.map(dl.str).join('][')+']'; + val = 'signals['+sgRef.map(dl.str).join('][')+']'; deps.signals.push(sgRef.shift()); } @@ -14452,13 +14998,13 @@ function valueRef(config, name, ref) { // run through scale function if val specified. // if no val, scale function is predicate arg. if (val !== null || ref.band || ref.mult || ref.offset) { - val = scale + (ref.band ? '.rangeBand()' : + val = scale + (ref.band ? '.rangeBand()' : '('+(val !== null ? val : 'item.datum.data')+')'); } else { val = scale; } } - + // multiply, offset, return value val = '(' + (ref.mult?(dl.number(ref.mult)+' * '):'') + val + ')' + (ref.offset ? ' + ' + dl.number(ref.offset) : ''); @@ -14488,7 +15034,7 @@ function colorRef(config, type, x, y, z) { function fieldRef(ref) { if (dl.isString(ref)) { return {val: dl.field(ref).map(dl.str).join('][')}; - } + } // Resolve nesting/parent lookups var l = ref.level || 1, @@ -14543,7 +15089,7 @@ function scaleRef(ref) { module.exports = properties; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"datalib":24,"vega-dataflow":39,"vega-logging":45}],103:[function(require,module,exports){ +},{"datalib":26,"vega-dataflow":41,"vega-logging":47}],105:[function(require,module,exports){ var dl = require('datalib'), SIGNALS = require('vega-dataflow').Dependencies.SIGNALS, expr = require('./expr'); @@ -14570,13 +15116,13 @@ function parseSignals(model, spec) { if (s.expr) { s.expr = expr(s.expr); signal.evaluate = function(input) { - var val = exprVal(model, s); + var val = exprVal(model, s), + sg = input.signals; if (val !== signal.value() || signal.verbose()) { signal.value(val); - input.signals[s.name] = 1; - return input; + sg[s.name] = 1; } - return model.doNotPropagate; + return sg[s.name] ? input : model.doNotPropagate; }; signal.dependency(SIGNALS, s.expr.globals); s.expr.globals.forEach(function(dep) { @@ -14617,7 +15163,7 @@ parseSignals.scale = function scale(model, spec, value, datum, evt) { }; module.exports = parseSignals; -},{"./expr":94,"datalib":24,"vega-dataflow":39}],104:[function(require,module,exports){ +},{"./expr":96,"datalib":26,"vega-dataflow":41}],106:[function(require,module,exports){ var dl = require('datalib'), log = require('vega-logging'), Model = require('../core/Model'), @@ -14674,7 +15220,7 @@ function parseSpec(spec, callback) { } module.exports = parseSpec; -},{"../core/Model":86,"../core/View":87,"./":95,"datalib":24,"vega-logging":45}],105:[function(require,module,exports){ +},{"../core/Model":88,"../core/View":89,"./":97,"datalib":26,"vega-logging":47}],107:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), dl = require('datalib'), @@ -14907,7 +15453,7 @@ function parseStreams(view) { module.exports = parseStreams; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./events":93,"./expr":94,"./signals":103,"datalib":24,"vega-dataflow":39}],106:[function(require,module,exports){ +},{"./events":95,"./expr":96,"./signals":105,"datalib":26,"vega-dataflow":41}],108:[function(require,module,exports){ var dl = require('datalib'), transforms = require('../transforms/index'); @@ -14927,7 +15473,7 @@ function parseTransforms(model, def) { } module.exports = parseTransforms; -},{"../transforms/index":139,"datalib":24}],107:[function(require,module,exports){ +},{"../transforms/index":142,"datalib":26}],109:[function(require,module,exports){ var dl = require('datalib'), df = require('vega-dataflow'), Node = df.Node, // jshint ignore:line @@ -14980,7 +15526,7 @@ proto.evaluate = function(input) { }; module.exports = Bounder; -},{"./Encoder":109,"datalib":24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],108:[function(require,module,exports){ +},{"./Encoder":111,"datalib":26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],110:[function(require,module,exports){ var dl = require('datalib'), log = require('vega-logging'), Item = require('vega-scenegraph').Item, @@ -15161,31 +15707,28 @@ proto.evaluate = function(input) { def = this._mark.def, props = def.properties || {}, update = props.update || {}, - output, fullUpdate, fcs, data, name; + output = ChangeSet.create(input), + fullUpdate, fcs, data, name; if (this._ds) { - output = ChangeSet.create(input); - // We need to determine if any encoder dependencies have been updated. // However, the encoder's data source will likely be updated, and shouldn't // trigger all items to mod. data = output.data[(name=this._ds.name())]; - delete output.data[name]; + output.data[name] = null; fullUpdate = this._encoder.reevaluate(output); output.data[name] = data; - // If a scale or signal in the update propset has been updated, - // send forward all items for reencoding if we do an early return. - if (fullUpdate) output.mod = this._mark.items.slice(); - fcs = this._ds.last(); if (!fcs) throw Error('Builder evaluated before backing DataSource.'); if (fcs.stamp > this._stamp) { - output = join.call(this, fcs, this._ds.values(), true, fullUpdate); + join.call(this, fcs, output, this._ds.values(), true, fullUpdate); + } else if (fullUpdate) { + output.mod = this._mark.items.slice(); } } else { data = dl.isFunction(this._def.from) ? this._def.from() : [Sentinel]; - output = join.call(this, input, data); + join.call(this, input, output, data); } // Stash output before Bounder for downstream reactive geometry. @@ -15222,9 +15765,8 @@ function newItem() { return item; } -function join(input, data, ds, fullUpdate) { - var output = ChangeSet.create(input), - keyf = keyFunction(this._def.key || (ds ? '_id' : null)), +function join(input, output, data, ds, fullUpdate) { + var keyf = keyFunction(this._def.key || (ds ? '_id' : null)), prev = this._mark.items || [], rem = ds ? input.rem : prev, mod = Tuple.idMap((!ds || fullUpdate) ? data : input.mod), @@ -15289,7 +15831,7 @@ function keyFunction(key) { } module.exports = Builder; -},{"../parse/data":92,"./Bounder":107,"./Encoder":109,"datalib":24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],109:[function(require,module,exports){ +},{"../parse/data":94,"./Bounder":109,"./Encoder":111,"datalib":26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],111:[function(require,module,exports){ var dl = require('datalib'), log = require('vega-logging'), df = require('vega-dataflow'), @@ -15476,7 +16018,7 @@ Encoder.update = function(graph, trans, request, items, dirty) { }; module.exports = Encoder; -},{"./Builder":108,"datalib":24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],110:[function(require,module,exports){ +},{"./Builder":110,"datalib":26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],112:[function(require,module,exports){ var dl = require('datalib'), df = require('vega-dataflow'), Node = df.Node, // jshint ignore:line @@ -15746,7 +16288,7 @@ function buildLegends(input, group) { } module.exports = GroupBuilder; -},{"../parse/axes":90,"../parse/legends":96,"./Builder":108,"./Scale":111,"datalib":24,"vega-dataflow":39,"vega-logging":45}],111:[function(require,module,exports){ +},{"../parse/axes":92,"../parse/legends":98,"./Builder":110,"./Scale":113,"datalib":26,"vega-dataflow":41,"vega-logging":47}],113:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), dl = require('datalib'), @@ -15865,7 +16407,7 @@ function ordinal(scale, rng, group) { outer = def.outerPadding == null ? pad : signal.call(this, def.outerPadding), points = def.points && signal.call(this, def.points), round = signal.call(this, def.round) || def.round == null, - domain, str; + domain, str, spatial=true; // range pre-processing for data-driven ranges if (dl.isObject(def.range) && !dl.isArray(def.range)) { @@ -15882,63 +16424,78 @@ function ordinal(scale, rng, group) { } // range - if (dl.equal(prev.range, rng)) return; + if (!dl.equal(prev.range, rng)) { + // width-defined range + if (def.bandWidth) { + var bw = signal.call(this, def.bandWidth), + len = domain.length, + space = def.points ? (pad*bw) : (pad*bw*(len-1) + 2*outer), + start; + if (rng[0] > rng[1]) { + start = rng[1] || 0; + rng = [start + (bw * len + space), start]; + } else { + start = rng[0] || 0; + rng = [start, start + (bw * len + space)]; + } + } - // width-defined range - if (def.bandWidth) { - var bw = signal.call(this, def.bandWidth), - len = domain.length, - space = def.points ? (pad*bw) : (pad*bw*(len-1) + 2*outer), - start; - if (rng[0] > rng[1]) { - start = rng[1] || 0; - rng = [start + (bw * len + space), start]; + str = typeof rng[0] === 'string'; + if (str || rng.length > 2 || rng.length===1 || dataDrivenRange) { + scale.range(rng); // color or shape values + spatial = false; + } else if (points && round) { + scale.rangeRoundPoints(rng, pad); + } else if (points) { + scale.rangePoints(rng, pad); + } else if (round) { + scale.rangeRoundBands(rng, pad, outer); } else { - start = rng[0] || 0; - rng = [start, start + (bw * len + space)]; + scale.rangeBands(rng, pad, outer); } - } - str = typeof rng[0] === 'string'; - if (str || rng.length > 2 || rng.length===1 || dataDrivenRange) { - scale.range(rng); // color or shape values - } else if (points && round) { - scale.rangeRoundPoints(rng, pad); - } else if (points) { - scale.rangePoints(rng, pad); - } else if (round) { - scale.rangeRoundBands(rng, pad, outer); - } else { - scale.rangeBands(rng, pad, outer); + prev.range = rng; + this._updated = true; } - if (!scale.invert) { - scale.invert = function(x, y) { - if (arguments.length === 1) { - return scale.domain()[d3.bisect(scale.range(), x) - 1]; - } else if (arguments.length === 2) { // Invert extents - if (!dl.isNumber(x) || !dl.isNumber(y)) { - throw Error('Extents to ordinal invert are not numbers ('+x+', '+y+').'); - } + if (!scale.invert && spatial) invertOrdinal(scale); +} - var points = [], - rng = scale.range(), - i = 0, len = rng.length, r; +// "Polyfill" ordinal scale inversion. Currently, only ordinal scales +// with ordered numeric ranges are supported. +var bisect = d3.bisector(dl.numcmp).right, + findAsc = function(a, x) { return bisect(a,x) - 1; }, + findDsc = d3.bisector(function(a,b) { return -1 * dl.numcmp(a,b); }).left; - for(; i n) b = n; + + return (asc ? dl.range(a, b+1) : dl.range(b, a-1, -1)) + .map(function(i) { return domain[i]; }); + } + }; } function quantitative(scale, rng, group) { @@ -16244,7 +16801,7 @@ function range(group) { module.exports = Scale; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../transforms/Aggregate":116,"datalib":24,"vega-dataflow":39,"vega-logging":45}],112:[function(require,module,exports){ +},{"../transforms/Aggregate":118,"datalib":26,"vega-dataflow":41,"vega-logging":47}],114:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), bound = require('vega-scenegraph').bound, @@ -16351,7 +16908,7 @@ function step(elapsed) { module.exports = Transition; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Builder":108,"vega-dataflow":39,"vega-scenegraph":46}],113:[function(require,module,exports){ +},{"./Builder":110,"vega-dataflow":41,"vega-scenegraph":48}],115:[function(require,module,exports){ var dl = require('datalib'), Tuple = require('vega-dataflow').Tuple, parseMark = require('../parse/mark'); @@ -16953,7 +17510,7 @@ function axisDomain(config) { } module.exports = axs; -},{"../parse/mark":97,"datalib":24,"vega-dataflow":39}],114:[function(require,module,exports){ +},{"../parse/mark":99,"datalib":26,"vega-dataflow":41}],116:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), dl = require('datalib'), @@ -17500,7 +18057,7 @@ function vg_hLegendLabels(config) { module.exports = lgnd; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../parse/mark":97,"../parse/properties":102,"datalib":24,"vega-scenegraph":46}],115:[function(require,module,exports){ +},{"../parse/mark":99,"../parse/properties":104,"datalib":26,"vega-scenegraph":48}],117:[function(require,module,exports){ module.exports = function visit(node, func) { var i, n, s, m, items; if (func(node)) return true; @@ -17514,7 +18071,7 @@ module.exports = function visit(node, func) { } } }; -},{}],116:[function(require,module,exports){ +},{}],118:[function(require,module,exports){ var dl = require('datalib'), df = require('vega-dataflow'), log = require('vega-logging'), @@ -17669,7 +18226,6 @@ function getFields(aggr) { prototype.transform = function(input, reset) { log.debug(input, ['aggregate']); - this._input = input; // Used by Facetor._on_keep. var output = ChangeSet.create(input), aggr = this.aggr(), @@ -17722,11 +18278,11 @@ prototype.transform = function(input, reset) { for (i=0; i', default: [5, 2]} }); - this._output = {bin: 'bin'}; + this._output = { + start: 'bin_start', + end: 'bin_end' + }; return this.mutates(true); } -var prototype = (Bin.prototype = Object.create(Transform.prototype)); +var prototype = (Bin.prototype = Object.create(BatchTransform.prototype)); prototype.constructor = Bin; -prototype.transform = function(input) { +prototype.extent = function(data) { + // TODO only recompute extent upon data or field change? + var e = [this.param('min'), this.param('max')], d; + if (e[0] == null || e[1] == null) { + d = dl.extent(data, this.param('field').accessor); + if (e[0] == null) e[0] = d[0]; + if (e[1] == null) e[1] = d[1]; + } + return e; +}; + +prototype.batchTransform = function(input, data) { log.debug(input, ['binning']); - var output = this._output.bin, + var extent = this.extent(data), + output = this._output, step = this.param('step'), steps = this.param('steps'), minstep = this.param('minstep'), get = this.param('field').accessor, opt = { - min: this.param('min'), - max: this.param('max'), + min: extent[0], + max: extent[1], base: this.param('base'), maxbins: this.param('maxbins'), div: this.param('div') @@ -17797,24 +18369,26 @@ prototype.transform = function(input) { if (step) opt.step = step; if (steps) opt.steps = steps; if (minstep) opt.minstep = minstep; - var b = bins(opt); + var b = dl.bins(opt); function update(d) { var v = get(d); v = v == null ? null : b.start + b.step * ~~((v - b.start) / b.step); - Tuple.set(d, output, v); + Tuple.set(d, output.start, v); + Tuple.set(d, output.end, v + b.step); } input.add.forEach(update); input.mod.forEach(update); input.rem.forEach(update); - input.fields[output] = 1; + input.fields[output.start] = 1; + input.fields[output.end] = 1; return input; }; module.exports = Bin; -},{"./Transform":135,"datalib":24,"vega-dataflow":39,"vega-logging":45}],119:[function(require,module,exports){ +},{"./BatchTransform":119,"./Transform":138,"datalib":26,"vega-dataflow":41,"vega-logging":47}],121:[function(require,module,exports){ var df = require('vega-dataflow'), Tuple = df.Tuple, log = require('vega-logging'), @@ -17939,7 +18513,7 @@ prototype._rem = function(tuples, get) { }; module.exports = CountPattern; -},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],120:[function(require,module,exports){ +},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],122:[function(require,module,exports){ var df = require('vega-dataflow'), ChangeSet = df.ChangeSet, Tuple = df.Tuple, @@ -18060,7 +18634,7 @@ prototype.batchTransform = function(input, data) { }; module.exports = Cross; -},{"./BatchTransform":117,"./Transform":135,"vega-dataflow":39,"vega-logging":45}],121:[function(require,module,exports){ +},{"./BatchTransform":119,"./Transform":138,"vega-dataflow":41,"vega-logging":47}],123:[function(require,module,exports){ var Transform = require('./Transform'), Aggregate = require('./Aggregate'); @@ -18093,7 +18667,7 @@ prototype.aggr = function() { }; module.exports = Facet; -},{"../parse/transforms":106,"./Aggregate":116,"./Transform":135}],122:[function(require,module,exports){ +},{"../parse/transforms":108,"./Aggregate":118,"./Transform":138}],124:[function(require,module,exports){ var dl = require('datalib'), Aggregator = dl.Aggregator, Base = Aggregator.prototype, @@ -18192,7 +18766,7 @@ prototype._on_keep = function(cell) { }; module.exports = Facetor; -},{"datalib":24,"vega-dataflow":39,"vega-logging":45}],123:[function(require,module,exports){ +},{"datalib":26,"vega-dataflow":41,"vega-logging":47}],125:[function(require,module,exports){ var df = require('vega-dataflow'), SIGNALS = df.Dependencies.SIGNALS, log = require('vega-logging'), @@ -18248,7 +18822,7 @@ prototype.transform = function(input) { }; module.exports = Filter; -},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],124:[function(require,module,exports){ +},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],126:[function(require,module,exports){ var df = require('vega-dataflow'), Tuple = df.Tuple, log = require('vega-logging'), @@ -18320,7 +18894,7 @@ prototype.transform = function(input, reset) { }; module.exports = Fold; -},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],125:[function(require,module,exports){ +},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],127:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), df = require('vega-dataflow'), @@ -18530,7 +19104,7 @@ prototype.update = function(active) { module.exports = Force; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],126:[function(require,module,exports){ +},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],128:[function(require,module,exports){ var df = require('vega-dataflow'), Tuple = df.Tuple, SIGNALS = df.Dependencies.SIGNALS, @@ -18573,7 +19147,7 @@ prototype.transform = function(input) { }; module.exports = Formula; -},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],127:[function(require,module,exports){ +},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],129:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), dl = require('datalib'), @@ -18664,7 +19238,7 @@ prototype.transform = function(input) { module.exports = Geo; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Transform":135,"datalib":24,"vega-dataflow":39,"vega-logging":45}],128:[function(require,module,exports){ +},{"./Transform":138,"datalib":26,"vega-dataflow":41,"vega-logging":47}],130:[function(require,module,exports){ (function (global){ var d3 = (typeof window !== "undefined" ? window['d3'] : typeof global !== "undefined" ? global['d3'] : null), dl = require('datalib'), @@ -18714,7 +19288,111 @@ prototype.transform = function(input) { module.exports = GeoPath; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./Geo":127,"./Transform":135,"datalib":24,"vega-dataflow":39,"vega-logging":45}],129:[function(require,module,exports){ +},{"./Geo":129,"./Transform":138,"datalib":26,"vega-dataflow":41,"vega-logging":47}],131:[function(require,module,exports){ +var dl = require('datalib'), + log = require('vega-logging'), + Tuple = require('vega-dataflow').Tuple, + Transform = require('./Transform'), + BatchTransform = require('./BatchTransform'); + +function Impute(graph) { + BatchTransform.prototype.init.call(this, graph); + Transform.addParameters(this, { + groupby: {type: 'array'}, + orderby: {type: 'array'}, + field: {type: 'field'}, + method: {type: 'value', default: 'value'}, + value: {type: 'value', default: 0} + }); + + return this.router(true).produces(true); +} + +var prototype = (Impute.prototype = Object.create(BatchTransform.prototype)); +prototype.constructor = Impute; + +prototype.batchTransform = function(input, data) { + log.debug(input, ['imputing']); + + var groupby = this.param('groupby'), + orderby = this.param('orderby'), + method = this.param('method'), + value = this.param('value'), + field = this.param('field'), + get = field.accessor, + name = field.field, + prev = this._imputed || [], curr = [], + groups = partition(data, groupby.accessor, orderby.accessor), + domain = groups.domain, + group, i, j, n, m, t; + + function getval(x) { + return x == null ? null : get(x); + } + + for (j=0, m=groups.length; j> 5,\n ch = 1 << 11;\n\nmodule.exports = function() {\n var size = [256, 256],\n text = cloudText,\n font = cloudFont,\n fontSize = cloudFontSize,\n fontStyle = cloudFontNormal,\n fontWeight = cloudFontNormal,\n rotate = cloudRotate,\n padding = cloudPadding,\n spiral = archimedeanSpiral,\n words = [],\n timeInterval = Infinity,\n event = dispatch(\"word\", \"end\"),\n timer = null,\n random = Math.random,\n cloud = {},\n canvas = cloudCanvas;\n\n cloud.canvas = function(_) {\n return arguments.length ? (canvas = functor(_), cloud) : canvas;\n };\n\n cloud.start = function() {\n var contextAndRatio = getContext(canvas()),\n board = zeroArray((size[0] >> 5) * size[1]),\n bounds = null,\n n = words.length,\n i = -1,\n tags = [],\n data = words.map(function(d, i) {\n d.text = text.call(this, d, i);\n d.font = font.call(this, d, i);\n d.style = fontStyle.call(this, d, i);\n d.weight = fontWeight.call(this, d, i);\n d.rotate = rotate.call(this, d, i);\n d.size = ~~fontSize.call(this, d, i);\n d.padding = padding.call(this, d, i);\n return d;\n }).sort(function(a, b) { return b.size - a.size; });\n\n if (timer) clearInterval(timer);\n timer = setInterval(step, 0);\n step();\n\n return cloud;\n\n function step() {\n var start = Date.now();\n while (Date.now() - start < timeInterval && ++i < n && timer) {\n var d = data[i];\n d.x = (size[0] * (random() + .5)) >> 1;\n d.y = (size[1] * (random() + .5)) >> 1;\n cloudSprite(contextAndRatio, d, data, i);\n if (d.hasText && place(board, d, bounds)) {\n tags.push(d);\n event.word(d);\n if (bounds) cloudBounds(bounds, d);\n else bounds = [{x: d.x + d.x0, y: d.y + d.y0}, {x: d.x + d.x1, y: d.y + d.y1}];\n // Temporary hack\n d.x -= size[0] >> 1;\n d.y -= size[1] >> 1;\n }\n }\n if (i >= n) {\n cloud.stop();\n event.end(tags, bounds);\n }\n }\n }\n\n cloud.stop = function() {\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n return cloud;\n };\n\n function getContext(canvas) {\n canvas.width = canvas.height = 1;\n var ratio = Math.sqrt(canvas.getContext(\"2d\").getImageData(0, 0, 1, 1).data.length >> 2);\n canvas.width = (cw << 5) / ratio;\n canvas.height = ch / ratio;\n\n var context = canvas.getContext(\"2d\");\n context.fillStyle = context.strokeStyle = \"red\";\n context.textAlign = \"center\";\n\n return {context: context, ratio: ratio};\n }\n\n function place(board, tag, bounds) {\n var perimeter = [{x: 0, y: 0}, {x: size[0], y: size[1]}],\n startX = tag.x,\n startY = tag.y,\n maxDelta = Math.sqrt(size[0] * size[0] + size[1] * size[1]),\n s = spiral(size),\n dt = random() < .5 ? 1 : -1,\n t = -dt,\n dxdy,\n dx,\n dy;\n\n while (dxdy = s(t += dt)) {\n dx = ~~dxdy[0];\n dy = ~~dxdy[1];\n\n if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break;\n\n tag.x = startX + dx;\n tag.y = startY + dy;\n\n if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 ||\n tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue;\n // TODO only check for collisions within current bounds.\n if (!bounds || !cloudCollide(tag, board, size[0])) {\n if (!bounds || collideRects(tag, bounds)) {\n var sprite = tag.sprite,\n w = tag.width >> 5,\n sw = size[0] >> 5,\n lx = tag.x - (w << 4),\n sx = lx & 0x7f,\n msx = 32 - sx,\n h = tag.y1 - tag.y0,\n x = (tag.y + tag.y0) * sw + (lx >> 5),\n last;\n for (var j = 0; j < h; j++) {\n last = 0;\n for (var i = 0; i <= w; i++) {\n board[x + i] |= (last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0);\n }\n x += sw;\n }\n delete tag.sprite;\n return true;\n }\n }\n }\n return false;\n }\n\n cloud.timeInterval = function(_) {\n return arguments.length ? (timeInterval = _ == null ? Infinity : _, cloud) : timeInterval;\n };\n\n cloud.words = function(_) {\n return arguments.length ? (words = _, cloud) : words;\n };\n\n cloud.size = function(_) {\n return arguments.length ? (size = [+_[0], +_[1]], cloud) : size;\n };\n\n cloud.font = function(_) {\n return arguments.length ? (font = functor(_), cloud) : font;\n };\n\n cloud.fontStyle = function(_) {\n return arguments.length ? (fontStyle = functor(_), cloud) : fontStyle;\n };\n\n cloud.fontWeight = function(_) {\n return arguments.length ? (fontWeight = functor(_), cloud) : fontWeight;\n };\n\n cloud.rotate = function(_) {\n return arguments.length ? (rotate = functor(_), cloud) : rotate;\n };\n\n cloud.text = function(_) {\n return arguments.length ? (text = functor(_), cloud) : text;\n };\n\n cloud.spiral = function(_) {\n return arguments.length ? (spiral = spirals[_] || _, cloud) : spiral;\n };\n\n cloud.fontSize = function(_) {\n return arguments.length ? (fontSize = functor(_), cloud) : fontSize;\n };\n\n cloud.padding = function(_) {\n return arguments.length ? (padding = functor(_), cloud) : padding;\n };\n\n cloud.random = function(_) {\n return arguments.length ? (random = _, cloud) : random;\n };\n\n cloud.on = function() {\n var value = event.on.apply(event, arguments);\n return value === event ? cloud : value;\n };\n\n return cloud;\n};\n\nfunction cloudText(d) {\n return d.text;\n}\n\nfunction cloudFont() {\n return \"serif\";\n}\n\nfunction cloudFontNormal() {\n return \"normal\";\n}\n\nfunction cloudFontSize(d) {\n return Math.sqrt(d.value);\n}\n\nfunction cloudRotate() {\n return (~~(Math.random() * 6) - 3) * 30;\n}\n\nfunction cloudPadding() {\n return 1;\n}\n\n// Fetches a monochrome sprite bitmap for the specified text.\n// Load in batches for speed.\nfunction cloudSprite(contextAndRatio, d, data, di) {\n if (d.sprite) return;\n var c = contextAndRatio.context,\n ratio = contextAndRatio.ratio;\n\n c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio);\n var x = 0,\n y = 0,\n maxh = 0,\n n = data.length;\n --di;\n while (++di < n) {\n d = data[di];\n c.save();\n c.font = d.style + \" \" + d.weight + \" \" + ~~((d.size + 1) / ratio) + \"px \" + d.font;\n var w = c.measureText(d.text + \"m\").width * ratio,\n h = d.size << 1;\n if (d.rotate) {\n var sr = Math.sin(d.rotate * cloudRadians),\n cr = Math.cos(d.rotate * cloudRadians),\n wcr = w * cr,\n wsr = w * sr,\n hcr = h * cr,\n hsr = h * sr;\n w = (Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f) >> 5 << 5;\n h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr));\n } else {\n w = (w + 0x1f) >> 5 << 5;\n }\n if (h > maxh) maxh = h;\n if (x + w >= (cw << 5)) {\n x = 0;\n y += maxh;\n maxh = 0;\n }\n if (y + h >= ch) break;\n c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio);\n if (d.rotate) c.rotate(d.rotate * cloudRadians);\n c.fillText(d.text, 0, 0);\n if (d.padding) c.lineWidth = 2 * d.padding, c.strokeText(d.text, 0, 0);\n c.restore();\n d.width = w;\n d.height = h;\n d.xoff = x;\n d.yoff = y;\n d.x1 = w >> 1;\n d.y1 = h >> 1;\n d.x0 = -d.x1;\n d.y0 = -d.y1;\n d.hasText = true;\n x += w;\n }\n var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data,\n sprite = [];\n while (--di >= 0) {\n d = data[di];\n if (!d.hasText) continue;\n var w = d.width,\n w32 = w >> 5,\n h = d.y1 - d.y0;\n // Zero the buffer\n for (var i = 0; i < h * w32; i++) sprite[i] = 0;\n x = d.xoff;\n if (x == null) return;\n y = d.yoff;\n var seen = 0,\n seenRow = -1;\n for (var j = 0; j < h; j++) {\n for (var i = 0; i < w; i++) {\n var k = w32 * j + (i >> 5),\n m = pixels[((y + j) * (cw << 5) + (x + i)) << 2] ? 1 << (31 - (i % 32)) : 0;\n sprite[k] |= m;\n seen |= m;\n }\n if (seen) seenRow = j;\n else {\n d.y0++;\n h--;\n j--;\n y++;\n }\n }\n d.y1 = d.y0 + seenRow;\n d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32);\n }\n}\n\n// Use mask-based collision detection.\nfunction cloudCollide(tag, board, sw) {\n sw >>= 5;\n var sprite = tag.sprite,\n w = tag.width >> 5,\n lx = tag.x - (w << 4),\n sx = lx & 0x7f,\n msx = 32 - sx,\n h = tag.y1 - tag.y0,\n x = (tag.y + tag.y0) * sw + (lx >> 5),\n last;\n for (var j = 0; j < h; j++) {\n last = 0;\n for (var i = 0; i <= w; i++) {\n if (((last << msx) | (i < w ? (last = sprite[j * w + i]) >>> sx : 0))\n & board[x + i]) return true;\n }\n x += sw;\n }\n return false;\n}\n\nfunction cloudBounds(bounds, d) {\n var b0 = bounds[0],\n b1 = bounds[1];\n if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0;\n if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0;\n if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1;\n if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1;\n}\n\nfunction collideRects(a, b) {\n 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;\n}\n\nfunction archimedeanSpiral(size) {\n var e = size[0] / size[1];\n return function(t) {\n return [e * (t *= .1) * Math.cos(t), t * Math.sin(t)];\n };\n}\n\nfunction rectangularSpiral(size) {\n var dy = 4,\n dx = dy * size[0] / size[1],\n x = 0,\n y = 0;\n return function(t) {\n var sign = t < 0 ? -1 : 1;\n // See triangular numbers: T_n = n * (n + 1) / 2.\n switch ((Math.sqrt(1 + 4 * sign * t) - sign) & 3) {\n case 0: x += dx; break;\n case 1: y += dy; break;\n case 2: x -= dx; break;\n default: y -= dy; break;\n }\n return [x, y];\n };\n}\n\n// TODO reuse arrays?\nfunction zeroArray(n) {\n var a = [],\n i = -1;\n while (++i < n) a[i] = 0;\n return a;\n}\n\nfunction cloudCanvas() {\n return document.createElement(\"canvas\");\n}\n\nfunction functor(d) {\n return typeof d === \"function\" ? d : function() { return d; };\n}\n\nvar spirals = {\n archimedean: archimedeanSpiral,\n rectangular: rectangularSpiral\n};\n", + "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.dispatch = {}));\n}(this, function (exports) { 'use strict';\n\n function Dispatch(types) {\n var i = -1,\n n = types.length,\n callbacksByType = {},\n callbackByName = {},\n type,\n that = this;\n\n that.on = function(type, callback) {\n type = parseType(type);\n\n // Return the current callback, if any.\n if (arguments.length < 2) {\n return (callback = callbackByName[type.name]) && callback.value;\n }\n\n // If a type was specified…\n if (type.type) {\n var callbacks = callbacksByType[type.type],\n callback0 = callbackByName[type.name],\n i;\n\n // Remove the current callback, if any, using copy-on-remove.\n if (callback0) {\n callback0.value = null;\n i = callbacks.indexOf(callback0);\n callbacksByType[type.type] = callbacks = callbacks.slice(0, i).concat(callbacks.slice(i + 1));\n delete callbackByName[type.name];\n }\n\n // Add the new callback, if any.\n if (callback) {\n callback = {value: callback};\n callbackByName[type.name] = callback;\n callbacks.push(callback);\n }\n }\n\n // Otherwise, if a null callback was specified, remove all callbacks with the given name.\n else if (callback == null) {\n for (var otherType in callbacksByType) {\n if (callback = callbackByName[otherType + type.name]) {\n callback.value = null;\n var callbacks = callbacksByType[otherType], i = callbacks.indexOf(callback);\n callbacksByType[otherType] = callbacks.slice(0, i).concat(callbacks.slice(i + 1));\n delete callbackByName[callback.name];\n }\n }\n }\n\n return that;\n };\n\n while (++i < n) {\n type = types[i] + \"\";\n if (!type || (type in that)) throw new Error(\"illegal or duplicate type: \" + type);\n callbacksByType[type] = [];\n that[type] = applier(type);\n }\n\n function parseType(type) {\n var i = (type += \"\").indexOf(\".\"), name = type;\n if (i >= 0) type = type.slice(0, i); else name += \".\";\n if (type && !callbacksByType.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n return {type: type, name: name};\n }\n\n function applier(type) {\n return function() {\n var callbacks = callbacksByType[type], // Defensive reference; copy-on-remove.\n callback,\n callbackValue,\n i = -1,\n n = callbacks.length;\n\n while (++i < n) {\n if (callbackValue = (callback = callbacks[i]).value) {\n callbackValue.apply(this, arguments);\n }\n }\n\n return that;\n };\n }\n }\n\n function dispatch() {\n return new Dispatch(arguments);\n }\n\n dispatch.prototype = Dispatch.prototype; // allow instanceof\n\n exports.dispatch = dispatch;\n\n}));", "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.dsv = {}));\n}(this, function (exports) { 'use strict';\n\n var dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n]\"),\n delimiterCode = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var o;\n return parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = new Function(\"d\", \"return {\" + row.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n o = f ? function(row, i) { return f(a(row), i); } : a;\n });\n }\n\n function parseRows(text, f) {\n var EOL = {}, // sentinel value for end-of-line\n EOF = {}, // sentinel value for end-of-file\n rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // the current line number\n t, // the current token\n eol; // is the current token followed by EOL?\n\n function token() {\n if (I >= N) return EOF; // special case: end of file\n if (eol) return eol = false, EOL; // special case: end of line\n\n // special case: quotes\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case: find next delimiter or newline\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true; // \\n\n else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \\r|\\r\\n\n else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n\n // special case: last token before EOF\n return text.slice(j);\n }\n\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n\n return rows;\n }\n\n function format(rows) {\n if (Array.isArray(rows[0])) return formatRows(rows); // deprecated; use formatRows\n var fieldSet = Object.create(null), fields = [];\n\n // Compute unique fields in order of discovery.\n rows.forEach(function(row) {\n for (var field in row) {\n if (!((field += \"\") in fieldSet)) {\n fields.push(fieldSet[field] = field);\n }\n }\n });\n\n return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return reFormat.test(text) ? \"\\\"\" + text.replace(/\\\"/g, \"\\\"\\\"\") + \"\\\"\" : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n }\n\n exports.csv = dsv(\",\");\n exports.tsv = dsv(\"\\t\");\n\n exports.dsv = dsv;\n\n}));", - "if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.format = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"¥\", \"\"]\n };\n\n var ruRu = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0руб.\"]\n };\n\n var ptBr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"R$\", \"\"]\n };\n\n var plPl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"zł\"]\n };\n\n var nlNl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\\xa0\", \"\"]\n };\n\n var mkMk = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0ден.\"]\n };\n\n var jaJp = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"\", \"円\"]\n };\n\n var itIt = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\", \"\"]\n };\n\n var heIl = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"₪\", \"\"]\n };\n\n var frFr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var frCa = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"$\"]\n };\n\n var fiFi = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var esEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var enUs = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var enGb = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"£\", \"\"]\n };\n\n var enCa = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var deDe = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var caEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n\n // Computes the decimal coefficient and exponent of the specified number x with\n // significant digits p, where x is positive and p is in [1, 21] or undefined.\n // For example, formatDecimal(1.23) returns [\"123\", 0].\n function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n\n function exponent(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n }\n\n var prefixExponent;\n\n function formatPrefixAuto(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, p + i - 1)[0]; // less than 1y!\n }\n\n function formatRounded(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n }\n\n function formatDefault(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n }\n\n var formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n };\n\n\n // [[fill]align][sign][symbol][0][width][,][.precision][type]\n var re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\n function formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n }\n\n function FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n }\n\n FormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n };\n\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n }\n\n var prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\n function identity(x) {\n return x;\n }\n\n function locale(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal;\n\n function format(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? \"%\" : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n return function(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Convert negative to positive, and compute the prefix.\n // Note that -0 is not less than 0, but 1 / -0 is!\n var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);\n\n // Perform the initial formatting.\n value = formatType(value, precision);\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n var i = -1, n = value.length, c;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": return valuePrefix + value + valueSuffix + padding;\n case \"=\": return valuePrefix + padding + value + valueSuffix;\n case \"^\": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n }\n return padding + valuePrefix + value + valueSuffix;\n };\n }\n\n function formatPrefix(specifier, value) {\n var f = format((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: format,\n formatPrefix: formatPrefix\n };\n }\n\n function precisionRound(step, max) {\n return Math.max(0, exponent(Math.abs(max)) - exponent(Math.abs(step))) + 1;\n }\n\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.formatPrefix = defaultLocale.formatPrefix;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.formatSpecifier = formatSpecifier;\n exports.precisionFixed = precisionFixed;\n exports.precisionPrefix = precisionPrefix;\n exports.precisionRound = precisionRound;\n\n}));", - "if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var jaJp = {\n dateTime: \"%Y %b %e %a %X\",\n date: \"%Y/%m/%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\n shortDays: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"],\n months: [\"睦月\", \"如月\", \"弥生\", \"卯月\", \"皐月\", \"水無月\", \"文月\", \"葉月\", \"長月\", \"神無月\", \"霜月\", \"師走\"],\n shortMonths: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));", + "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.format = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"¥\", \"\"]\n };\n\n var ruRu = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0руб.\"]\n };\n\n var ptBr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"R$\", \"\"]\n };\n\n var plPl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"zł\"]\n };\n\n var nlNl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\\xa0\", \"\"]\n };\n\n var mkMk = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0ден.\"]\n };\n\n var jaJp = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"\", \"円\"]\n };\n\n var itIt = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\", \"\"]\n };\n\n var heIl = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"₪\", \"\"]\n };\n\n var frFr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var frCa = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"$\"]\n };\n\n var fiFi = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var esEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var enUs = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var enGb = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"£\", \"\"]\n };\n\n var enCa = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var deDe = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var caEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n\n // Computes the decimal coefficient and exponent of the specified number x with\n // significant digits p, where x is positive and p is in [1, 21] or undefined.\n // For example, formatDecimal(1.23) returns [\"123\", 0].\n function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n\n function exponent(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n }\n\n var prefixExponent;\n\n function formatPrefixAuto(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, p + i - 1)[0]; // less than 1y!\n }\n\n function formatRounded(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n }\n\n function formatDefault(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n }\n\n var formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n };\n\n\n // [[fill]align][sign][symbol][0][width][,][.precision][type]\n var re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\n function formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n }\n\n function FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n }\n\n FormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n };\n\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n }\n\n var prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\n function identity(x) {\n return x;\n }\n\n function locale(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal;\n\n function format(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? \"%\" : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n return function(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Convert negative to positive, and compute the prefix.\n // Note that -0 is not less than 0, but 1 / -0 is!\n var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);\n\n // Perform the initial formatting.\n value = formatType(value, precision);\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n var i = -1, n = value.length, c;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": return valuePrefix + value + valueSuffix + padding;\n case \"=\": return valuePrefix + padding + value + valueSuffix;\n case \"^\": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n }\n return padding + valuePrefix + value + valueSuffix;\n };\n }\n\n function formatPrefix(specifier, value) {\n var f = format((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: format,\n formatPrefix: formatPrefix\n };\n }\n\n function precisionRound(step, max) {\n return Math.max(0, exponent(Math.abs(max)) - exponent(Math.abs(step))) + 1;\n }\n\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n\n var localeDefinitions = {\n \"ca-ES\": caEs,\n \"de-DE\": deDe,\n \"en-CA\": enCa,\n \"en-GB\": enGb,\n \"en-US\": enUs,\n \"es-ES\": esEs,\n \"fi-FI\": fiFi,\n \"fr-CA\": frCa,\n \"fr-FR\": frFr,\n \"he-IL\": heIl,\n \"it-IT\": itIt,\n \"ja-JP\": jaJp,\n \"mk-MK\": mkMk,\n \"nl-NL\": nlNl,\n \"pl-PL\": plPl,\n \"pt-BR\": ptBr,\n \"ru-RU\": ruRu,\n \"zh-CN\": zhCn\n };\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.formatPrefix = defaultLocale.formatPrefix;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n if (!localeDefinitions.hasOwnProperty(definition)) return null;\n definition = localeDefinitions[definition];\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.formatSpecifier = formatSpecifier;\n exports.precisionFixed = precisionFixed;\n exports.precisionPrefix = precisionPrefix;\n exports.precisionRound = precisionRound;\n\n}));", + "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var jaJp = {\n dateTime: \"%Y %b %e %a %X\",\n date: \"%Y/%m/%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\n shortDays: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"],\n months: [\"睦月\", \"如月\", \"弥生\", \"卯月\", \"皐月\", \"水無月\", \"文月\", \"葉月\", \"長月\", \"神無月\", \"霜月\", \"師走\"],\n shortMonths: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup[string.slice(i, i += 2).toLowerCase()];\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = {}, i = -1, n = names.length;\n while (++i < n) map[names[i].toLowerCase()] = i;\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?:\\:?(\\d\\d))?/.exec(string.slice(i, i + 6));\n if (n) {\n d.Z = n[1] ? 0 // 'Z' for UTC\n : n[3] ? -(n[2] + n[3]) // sign differs from getTimezoneOffset!\n : -n[2] * 100;\n return i + n[0].length;\n }\n return -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = {\n \"ca-ES\": caEs,\n \"de-DE\": deDe,\n \"en-CA\": enCa,\n \"en-GB\": enGb,\n \"en-US\": enUs,\n \"es-ES\": esEs,\n \"fi-FI\": fiFi,\n \"fr-CA\": frCa,\n \"fr-FR\": frFr,\n \"he-IL\": heIl,\n \"it-IT\": itIt,\n \"ja-JP\": jaJp,\n \"mk-MK\": mkMk,\n \"nl-NL\": nlNl,\n \"pl-PL\": plPl,\n \"pt-BR\": ptBr,\n \"ru-RU\": ruRu,\n \"zh-CN\": zhCn\n };\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n if (!localeDefinitions.hasOwnProperty(definition)) return null;\n definition = localeDefinitions[definition];\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));", "(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.time = {}));\n}(this, function (exports) { 'use strict';\n\n var t1 = new Date;\n\n var t0 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var second = newInterval(function(date) {\n date.setMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.seconds = second.range;\n\n var minute = newInterval(function(date) {\n date.setSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.minutes = minute.range;\n\n var hour = newInterval(function(date) {\n date.setMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.hours = hour.range;\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n exports.days = day.range;\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n exports.sunday = weekday(0);\n\n exports.sundays = exports.sunday.range;\n\n exports.monday = weekday(1);\n\n exports.mondays = exports.monday.range;\n\n exports.tuesday = weekday(2);\n\n exports.tuesdays = exports.tuesday.range;\n\n exports.wednesday = weekday(3);\n\n exports.wednesdays = exports.wednesday.range;\n\n exports.thursday = weekday(4);\n\n exports.thursdays = exports.thursday.range;\n\n exports.friday = weekday(5);\n\n exports.fridays = exports.friday.range;\n\n exports.saturday = weekday(6);\n\n exports.saturdays = exports.saturday.range;\n\n var week = exports.sunday;\n\n exports.weeks = week.range;\n\n var month = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n });\n\n exports.months = month.range;\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n exports.years = year.range;\n\n var utcSecond = newInterval(function(date) {\n date.setUTCMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.utcSeconds = utcSecond.range;\n\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.utcMinutes = utcMinute.range;\n\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.utcHours = utcHour.range;\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n exports.utcDays = utcDay.range;\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n exports.utcSunday = utcWeekday(0);\n\n exports.utcSundays = exports.utcSunday.range;\n\n exports.utcMonday = utcWeekday(1);\n\n exports.utcMondays = exports.utcMonday.range;\n\n exports.utcTuesday = utcWeekday(2);\n\n exports.utcTuesdays = exports.utcTuesday.range;\n\n exports.utcWednesday = utcWeekday(3);\n\n exports.utcWednesdays = exports.utcWednesday.range;\n\n exports.utcThursday = utcWeekday(4);\n\n exports.utcThursdays = exports.utcThursday.range;\n\n exports.utcFriday = utcWeekday(5);\n\n exports.utcFridays = exports.utcFriday.range;\n\n exports.utcSaturday = utcWeekday(6);\n\n exports.utcSaturdays = exports.utcSaturday.range;\n\n var utcWeek = exports.utcSunday;\n\n exports.utcWeeks = utcWeek.range;\n\n var utcMonth = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(1);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n });\n\n exports.utcMonths = utcMonth.range;\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n exports.utcYears = utcYear.range;\n\n exports.interval = newInterval;\n exports.second = second;\n exports.minute = minute;\n exports.hour = hour;\n exports.day = day;\n exports.week = week;\n exports.month = month;\n exports.year = year;\n exports.utcSecond = utcSecond;\n exports.utcMinute = utcMinute;\n exports.utcHour = utcHour;\n exports.utcDay = utcDay;\n exports.utcWeek = utcWeek;\n exports.utcMonth = utcMonth;\n exports.utcYear = utcYear;\n\n}));", "var util = require('../util'),\n Measures = require('./measures'),\n Collector = require('./collector');\n\nfunction Aggregator() {\n this._cells = {};\n this._aggr = [];\n this._stream = false;\n}\n\nvar Flags = Aggregator.Flags = {\n ADD_CELL: 1,\n MOD_CELL: 2\n};\n\nvar proto = Aggregator.prototype;\n\n// Parameters\n\nproto.stream = function(v) {\n if (v == null) return this._stream;\n this._stream = !!v;\n this._aggr = [];\n return this;\n};\n\n// key accessor to use for streaming removes\nproto.key = function(key) {\n if (key == null) return this._key;\n this._key = util.$(key);\n return this;\n};\n\n// Input: array of objects of the form\n// {name: string, get: function}\nproto.groupby = function(dims) {\n this._dims = util.array(dims).map(function(d, i) {\n d = util.isString(d) ? {name: d, get: util.$(d)}\n : util.isFunction(d) ? {name: util.name(d) || d.name || ('_' + i), get: d}\n : (d.name && util.isFunction(d.get)) ? d : null;\n if (d == null) throw 'Invalid groupby argument: ' + d;\n return d;\n });\n return this.clear();\n};\n\n// Input: array of objects of the form\n// {name: string, ops: [string, ...]}\nproto.summarize = function(fields) {\n fields = summarize_args(fields);\n this._count = true;\n var aggr = (this._aggr = []),\n m, f, i, j, op, as, get;\n\n for (i=0; i 0) {\n // consolidate collector values\n if (cell.collect) {\n cell.data.values();\n }\n // update tuple properties\n for (i=0; i 0) {\n m[a[i]] -= 1;\n } else {\n x[j++] = a[i];\n }\n }\n } else if (k) {\n // has unique key field, so use that\n m = util.toMap(r, k);\n for (i=0, j=0, n=a.length; i 1 ?\n function(x) { return s.reduce(function(x,f) { return x[f]; }, x); } :\n function(x) { return x[f]; }\n );\n};\n\n// short-cut for accessor\nu.$ = u.accessor;\n\nu.mutator = function(f) {\n var s;\n return u.isString(f) && (s=u.field(f)).length > 1 ?\n function(x, v) {\n for (var i=0; i y) return sign[i];\n }\n return 0;\n };\n};\n\nu.cmp = function(a, b) {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else if (a >= b) {\n return 0;\n } else if (a === null) {\n return -1;\n } else if (b === null) {\n return 1;\n }\n return NaN;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i 1) {\n for (var i=1, n=ref.length; i 0) {\n node = pq.peek();\n pulse = pulses[node._id];\n\n if (node.rank() !== node.qrank()) {\n // A node's rank might change during a propagation. Re-queue if so.\n pq.replace(node.qrank(true));\n } else {\n // Evaluate node and propagate pulse.\n pq.pop();\n pulses[node._id] = null;\n listeners = node._listeners;\n pulse = this.evaluate(pulse, node);\n\n // Propagate the pulse. \n if (pulse !== this.doNotPropagate) {\n // Ensure reflow pulses always send reflow pulses even if skipped.\n if (!pulse.reflow && node.reflows()) {\n pulse = ChangeSet.create(pulse, true);\n }\n\n for (i=0, len=listeners.length; i 0) branch[i-1].addListener(node);\n }\n\n return branch;\n};\n\nprototype.disconnect = function(branch) {\n var collector, node, data, signals, i, n, j, m;\n\n for (i=0, n=branch.length; i= pulse.stamp,\n run = node.router() || pulse.add.length || pulse.rem.length;\n\n return run || !reflowed || node.reevaluate(pulse);\n};\n\nprototype.evaluate = function(pulse, node) {\n if (!this.reevaluate(pulse, node)) return pulse;\n pulse = node.evaluate(pulse);\n node.last(pulse.stamp);\n return pulse;\n};\n\nmodule.exports = Graph;\n", + "var dl = require('datalib'),\n Heap = require('./Heap'),\n ChangeSet = require('./ChangeSet'),\n DataSource = require('./DataSource'),\n Collector = require('./Collector'),\n Tuple = require('./Tuple'),\n Signal = require('./Signal'),\n Deps = require('./Dependencies');\n\nfunction Graph() {\n}\n\nvar prototype = Graph.prototype;\n\nprototype.init = function() {\n this._stamp = 0;\n this._rank = 0;\n\n this._data = {};\n this._signals = {};\n\n this.doNotPropagate = {};\n};\n\nprototype.rank = function() {\n return ++this._rank;\n};\n\nprototype.values = function(type, names, hash) {\n var data = (type === Deps.SIGNALS ? this._signals : this._data),\n n = (names !== undefined ? names : dl.keys(data)),\n vals, i;\n\n if (Array.isArray(n)) {\n vals = hash || {};\n for (i=0; i 1) {\n for (var i=1, n=ref.length; i 0) {\n node = pq.peek();\n pulse = pulses[node._id];\n\n if (node.rank() !== node.qrank()) {\n // A node's rank might change during a propagation. Re-queue if so.\n pq.replace(node.qrank(true));\n } else {\n // Evaluate node and propagate pulse.\n pq.pop();\n pulses[node._id] = null;\n listeners = node._listeners;\n pulse = this.evaluate(pulse, node);\n\n // Propagate the pulse. \n if (pulse !== this.doNotPropagate) {\n // Ensure reflow pulses always send reflow pulses even if skipped.\n if (!pulse.reflow && node.reflows()) {\n pulse = ChangeSet.create(pulse, true);\n }\n\n for (i=0, len=listeners.length; i 0) branch[i-1].addListener(node);\n }\n\n return branch;\n};\n\nprototype.disconnect = function(branch) {\n var collector, node, data, signals, i, n, j, m;\n\n for (i=0, n=branch.length; i= pulse.stamp,\n run = node.router() || pulse.add.length || pulse.rem.length;\n\n return run || !reflowed || node.reevaluate(pulse);\n};\n\nprototype.evaluate = function(pulse, node) {\n if (!this.reevaluate(pulse, node)) return pulse;\n pulse = node.evaluate(pulse);\n node.last(pulse.stamp);\n return pulse;\n};\n\nmodule.exports = Graph;\n", "function Heap(comparator) {\n this.cmp = comparator;\n this.nodes = [];\n}\n\nvar prototype = Heap.prototype;\n\nprototype.size = function() {\n return this.nodes.length;\n};\n\nprototype.clear = function() {\n return (this.nodes = [], this);\n};\n\nprototype.peek = function() {\n return this.nodes[0];\n};\n\nprototype.push = function(x) {\n var array = this.nodes;\n array.push(x);\n return _siftdown(array, 0, array.length-1, this.cmp);\n};\n\nprototype.pop = function() {\n var array = this.nodes,\n last = array.pop(),\n item;\n\n if (array.length) {\n item = array[0];\n array[0] = last;\n _siftup(array, 0, this.cmp);\n } else {\n item = last;\n }\n return item;\n};\n\nprototype.replace = function(item) {\n var array = this.nodes,\n retval = array[0];\n array[0] = item;\n _siftup(array, 0, this.cmp);\n return retval;\n};\n\nprototype.pushpop = function(item) {\n var array = this.nodes, ref = array[0];\n if (array.length && this.cmp(ref, item) < 0) {\n array[0] = item;\n item = ref;\n _siftup(array, 0, this.cmp);\n }\n return item;\n};\n\nfunction _siftdown(array, start, idx, cmp) {\n var item, parent, pidx;\n\n item = array[idx];\n while (idx > start) {\n pidx = (idx - 1) >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return (array[idx] = item);\n}\n\nfunction _siftup(array, idx, cmp) {\n var start = idx,\n end = array.length,\n item = array[idx],\n cidx = 2 * idx + 1, ridx;\n\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = 2 * idx + 1;\n }\n array[idx] = item;\n return _siftdown(array, start, idx, cmp);\n}\n\nmodule.exports = Heap;\n", "var DEPS = require('./Dependencies').ALL,\n nodeID = 0;\n\nfunction Node(graph) {\n if (graph) this.init(graph);\n}\n\nvar Flags = Node.Flags = {\n Router: 0x01, // Responsible for propagating tuples, cannot be skipped.\n Collector: 0x02, // Holds a materialized dataset, pulse node to reflow.\n Produces: 0x04, // Produces new tuples. \n Mutates: 0x08, // Sets properties of incoming tuples.\n Reflows: 0x10, // Forwards a reflow pulse.\n Batch: 0x20 // Performs batch data processing, needs collector.\n};\n\nvar prototype = Node.prototype;\n\nprototype.init = function(graph) {\n this._id = ++nodeID;\n this._graph = graph;\n this._rank = graph.rank(); // Topological sort by rank\n this._qrank = null; // Rank when enqueued for propagation\n this._stamp = 0; // Last stamp seen\n\n this._listeners = [];\n this._listeners._ids = {}; // To prevent duplicate listeners\n\n // Initialize dependencies.\n this._deps = {};\n for (var i=0, n=DEPS.length; i l._rank) {\n var q = [l],\n g = this._graph, cur;\n while (q.length) {\n cur = q.shift();\n cur._rank = g.rank();\n q.unshift.apply(q, cur.listeners());\n }\n }\n\n return this;\n};\n\nprototype.removeListener = function(l) {\n if (!this._listeners._ids[l._id]) return false;\n \n var idx = this._listeners.indexOf(l),\n b = idx >= 0;\n\n if (b) {\n this._listeners.splice(idx, 1);\n this._listeners._ids[l._id] = null;\n }\n return b;\n};\n\nprototype.disconnect = function() {\n this._listeners = [];\n this._listeners._ids = {};\n};\n\n// Evaluate this dataflow node for the current pulse.\n// Subclasses should override to perform custom processing.\nprototype.evaluate = function(pulse) {\n return pulse;\n};\n\n// Should this node be re-evaluated for the current pulse?\n// Searches pulse to see if any dependencies have updated.\nprototype.reevaluate = function(pulse) {\n var prop, dep, i, n, j, m;\n\n for (i=0, n=DEPS.length; i=0;) {\n if (!handler || h[i].handler === handler) {\n x = h.splice(i, 1)[0];\n this.removeListener(x.node);\n }\n }\n\n return this;\n};\n\nmodule.exports = Signal;\n", @@ -193,19 +198,19 @@ "var parser = require('./parser'),\n codegen = require('./codegen');\n \nvar expr = module.exports = {\n parse: function(input, opt) {\n return parser.parse('('+input+')', opt);\n },\n code: function(opt) {\n return codegen(opt);\n },\n compiler: function(args, opt) {\n args = args.slice();\n var generator = codegen(opt),\n len = args.length,\n compile = function(str) {\n var value = generator(expr.parse(str));\n args[len] = '\"use strict\"; return (' + value.code + ');';\n value.fn = Function.apply(null, args);\n return value;\n };\n compile.codegen = generator;\n return compile;\n },\n functions: require('./functions'),\n constants: require('./constants')\n};\n", "/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \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*/\n/* istanbul ignore next */\nmodule.exports = (function() {\n 'use strict';\n\n var Token,\n TokenName,\n Syntax,\n PropertyKind,\n Messages,\n Regex,\n source,\n strict,\n index,\n lineNumber,\n lineStart,\n length,\n lookahead,\n state,\n extra;\n\n Token = {\n BooleanLiteral: 1,\n EOF: 2,\n Identifier: 3,\n Keyword: 4,\n NullLiteral: 5,\n NumericLiteral: 6,\n Punctuator: 7,\n StringLiteral: 8,\n RegularExpression: 9\n };\n\n TokenName = {};\n TokenName[Token.BooleanLiteral] = 'Boolean';\n TokenName[Token.EOF] = '';\n TokenName[Token.Identifier] = 'Identifier';\n TokenName[Token.Keyword] = 'Keyword';\n TokenName[Token.NullLiteral] = 'Null';\n TokenName[Token.NumericLiteral] = 'Numeric';\n TokenName[Token.Punctuator] = 'Punctuator';\n TokenName[Token.StringLiteral] = 'String';\n TokenName[Token.RegularExpression] = 'RegularExpression';\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n ArrayExpression: 'ArrayExpression',\n BinaryExpression: 'BinaryExpression',\n CallExpression: 'CallExpression',\n ConditionalExpression: 'ConditionalExpression',\n ExpressionStatement: 'ExpressionStatement',\n Identifier: 'Identifier',\n Literal: 'Literal',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n ObjectExpression: 'ObjectExpression',\n Program: 'Program',\n Property: 'Property',\n UnaryExpression: 'UnaryExpression'\n };\n\n PropertyKind = {\n Data: 1,\n Get: 2,\n Set: 4\n };\n\n // Error messages should be identical to V8.\n Messages = {\n UnexpectedToken: 'Unexpected token %0',\n UnexpectedNumber: 'Unexpected number',\n UnexpectedString: 'Unexpected string',\n UnexpectedIdentifier: 'Unexpected identifier',\n UnexpectedReserved: 'Unexpected reserved word',\n UnexpectedEOS: 'Unexpected end of input',\n NewlineAfterThrow: 'Illegal newline after throw',\n InvalidRegExp: 'Invalid regular expression',\n UnterminatedRegExp: 'Invalid regular expression: missing /',\n InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n NoCatchOrFinally: 'Missing catch or finally after try',\n UnknownLabel: 'Undefined label \\'%0\\'',\n Redeclaration: '%0 \\'%1\\' has already been declared',\n IllegalContinue: 'Illegal continue statement',\n IllegalBreak: 'Illegal break statement',\n IllegalReturn: 'Illegal return statement',\n StrictModeWith: 'Strict mode code may not include a with statement',\n StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',\n AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',\n AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',\n StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n StrictReservedWord: 'Use of future reserved word in strict mode'\n };\n\n // See also tools/generate-unicode-regex.py.\n Regex = {\n NonAsciiIdentifierStart: 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]'),\n NonAsciiIdentifierPart: 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-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\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]')\n };\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\n function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }\n\n function isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n }\n\n function isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n }\n\n function isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n }\n\n // 7.2 White Space\n\n function 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\n function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }\n\n // 7.6 Identifier Names and Identifiers\n\n function 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) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n }\n\n function 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) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n }\n\n // 7.6.1.2 Future Reserved Words\n\n function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }\n\n function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }\n\n // 7.6.1.1 Keywords\n\n function isKeyword(id) {\n if (strict && isStrictModeReservedWord(id)) {\n return true;\n }\n\n // 'const' is specialized as Keyword in V8.\n // 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.\n // Some others are from future reserved words.\n\n switch (id.length) {\n case 2:\n return (id === 'if') || (id === 'in') || (id === 'do');\n case 3:\n return (id === 'var') || (id === 'for') || (id === 'new') ||\n (id === 'try') || (id === 'let');\n case 4:\n return (id === 'this') || (id === 'else') || (id === 'case') ||\n (id === 'void') || (id === 'with') || (id === 'enum');\n case 5:\n return (id === 'while') || (id === 'break') || (id === 'catch') ||\n (id === 'throw') || (id === 'const') || (id === 'yield') ||\n (id === 'class') || (id === 'super');\n case 6:\n return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n (id === 'switch') || (id === 'export') || (id === 'import');\n case 7:\n return (id === 'default') || (id === 'finally') || (id === 'extends');\n case 8:\n return (id === 'function') || (id === 'continue') || (id === 'debugger');\n case 10:\n return (id === 'instanceof');\n default:\n return false;\n }\n }\n\n function skipComment() {\n var ch, start;\n\n start = (index === 0);\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch)) {\n ++index;\n } else if (isLineTerminator(ch)) {\n ++index;\n if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n start = true;\n } else {\n break;\n }\n }\n }\n\n function 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 return '';\n }\n }\n return String.fromCharCode(code);\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, '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\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n id += ch;\n }\n }\n\n return id;\n }\n\n function 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\n function 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 = Token.Identifier;\n } else if (isKeyword(id)) {\n type = Token.Keyword;\n } else if (id === 'null') {\n type = Token.NullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = Token.BooleanLiteral;\n } else {\n type = Token.Identifier;\n }\n\n return {\n type: type,\n value: id,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.7 Punctuators\n\n function 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 if (extra.tokenize) {\n if (code === 0x28) {\n extra.openParenToken = extra.tokens.length;\n } else if (code === 0x7B) {\n extra.openCurlyToken = extra.tokens.length;\n }\n }\n return {\n type: Token.Punctuator,\n value: String.fromCharCode(code),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: source.slice(start, index),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch4,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch3,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch2,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch1,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n // 7.8.3 Numeric Literals\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt('0x' + number, 16),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseFloat(number),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.8.4 String Literals\n\n function scanStringLiteral() {\n var str = '', quote, start, ch, code, unescaped, restore, octal = false, startLineNumber, startLineStart;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\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 restore = index;\n unescaped = scanHexEscape(ch);\n if (unescaped) {\n str += unescaped;\n } else {\n index = restore;\n str += ch;\n }\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 ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.StringLiteral,\n value: str,\n octal: octal,\n startLineNumber: startLineNumber,\n startLineStart: startLineStart,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function testRegExp(pattern, flags) {\n var tmp = pattern,\n value;\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({}, Messages.InvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n value = new RegExp(tmp);\n } catch (e) {\n throwError({}, Messages.InvalidRegExp);\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\n function 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({}, Messages.UnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, Messages.UnterminatedRegExp);\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({}, Messages.UnterminatedRegExp);\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\n function scanRegExpFlags() {\n var ch, str, flags, restore;\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 ch = source[index];\n if (ch === 'u') {\n ++index;\n restore = index;\n ch = scanHexEscape('u');\n if (ch) {\n flags += ch;\n for (str += '\\\\u'; restore < index; ++restore) {\n str += source[restore];\n }\n } else {\n index = restore;\n flags += 'u';\n str += '\\\\u';\n }\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n } else {\n str += '\\\\';\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n return {\n value: flags,\n literal: str\n };\n }\n\n function 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 if (extra.tokenize) {\n return {\n type: Token.RegularExpression,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\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\n function collectRegex() {\n var pos, loc, regex, token;\n\n skipComment();\n\n pos = index;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n regex = scanRegExp();\n\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (!extra.tokenize) {\n // Pop the previous token, which is likely '/' or '/='\n if (extra.tokens.length > 0) {\n token = extra.tokens[extra.tokens.length - 1];\n if (token.range[0] === pos && token.type === 'Punctuator') {\n if (token.value === '/' || token.value === '/=') {\n extra.tokens.pop();\n }\n }\n }\n\n extra.tokens.push({\n type: 'RegularExpression',\n value: regex.literal,\n regex: regex.regex,\n range: [pos, index],\n loc: loc\n });\n }\n\n return regex;\n }\n\n function isIdentifierName(token) {\n return token.type === Token.Identifier ||\n token.type === Token.Keyword ||\n token.type === Token.BooleanLiteral ||\n token.type === Token.NullLiteral;\n }\n\n function advanceSlash() {\n var prevToken,\n checkToken;\n // Using the following algorithm:\n // https://github.com/mozilla/sweet.js/wiki/design\n prevToken = extra.tokens[extra.tokens.length - 1];\n if (!prevToken) {\n // Nothing before that: it cannot be a division.\n return collectRegex();\n }\n if (prevToken.type === 'Punctuator') {\n if (prevToken.value === ']') {\n return scanPunctuator();\n }\n if (prevToken.value === ')') {\n checkToken = extra.tokens[extra.openParenToken - 1];\n if (checkToken &&\n checkToken.type === 'Keyword' &&\n (checkToken.value === 'if' ||\n checkToken.value === 'while' ||\n checkToken.value === 'for' ||\n checkToken.value === 'with')) {\n return collectRegex();\n }\n return scanPunctuator();\n }\n if (prevToken.value === '}') {\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n if (extra.tokens[extra.openCurlyToken - 3] &&\n extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {\n // Anonymous function.\n checkToken = extra.tokens[extra.openCurlyToken - 4];\n if (!checkToken) {\n return scanPunctuator();\n }\n } else if (extra.tokens[extra.openCurlyToken - 4] &&\n extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {\n // Named function.\n checkToken = extra.tokens[extra.openCurlyToken - 5];\n if (!checkToken) {\n return collectRegex();\n }\n } else {\n return scanPunctuator();\n }\n return scanPunctuator();\n }\n return collectRegex();\n }\n if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {\n return collectRegex();\n }\n return scanPunctuator();\n }\n\n function advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: Token.EOF,\n lineNumber: lineNumber,\n lineStart: lineStart,\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 // Slash (/) U+002F can also start a regex.\n if (extra.tokenize && ch === 0x2F) {\n return advanceSlash();\n }\n\n return scanPunctuator();\n }\n\n function collectToken() {\n var loc, token, value, entry;\n\n skipComment();\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n token = advance();\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (token.type !== Token.EOF) {\n value = source.slice(token.start, token.end);\n entry = {\n type: TokenName[token.type],\n value: value,\n range: [token.start, token.end],\n loc: loc\n };\n if (token.regex) {\n entry.regex = {\n pattern: token.regex.pattern,\n flags: token.regex.flags\n };\n }\n extra.tokens.push(entry);\n }\n\n return token;\n }\n\n function lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n return token;\n }\n\n function peek() {\n var pos, line, start;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n index = pos;\n lineNumber = line;\n lineStart = start;\n }\n\n function Position() {\n this.line = lineNumber;\n this.column = index - lineStart;\n }\n\n function SourceLocation() {\n this.start = new Position();\n this.end = null;\n }\n\n function WrappingSourceLocation(startToken) {\n if (startToken.type === Token.StringLiteral) {\n this.start = {\n line: startToken.startLineNumber,\n column: startToken.start - startToken.startLineStart\n };\n } else {\n this.start = {\n line: startToken.lineNumber,\n column: startToken.start - startToken.lineStart\n };\n }\n this.end = null;\n }\n\n function Node() {\n // Skip comment.\n index = lookahead.start;\n if (lookahead.type === Token.StringLiteral) {\n lineNumber = lookahead.startLineNumber;\n lineStart = lookahead.startLineStart;\n } else {\n lineNumber = lookahead.lineNumber;\n lineStart = lookahead.lineStart;\n }\n if (extra.range) {\n this.range = [index, 0];\n }\n if (extra.loc) {\n this.loc = new SourceLocation();\n }\n }\n\n function WrappingNode(startToken) {\n if (extra.range) {\n this.range = [startToken.start, 0];\n }\n if (extra.loc) {\n this.loc = new WrappingSourceLocation(startToken);\n }\n }\n\n WrappingNode.prototype = Node.prototype = {\n\n finish: function () {\n if (extra.range) {\n this.range[1] = index;\n }\n if (extra.loc) {\n this.loc.end = new Position();\n if (extra.source) {\n this.loc.source = extra.source;\n }\n }\n },\n\n finishArrayExpression: function (elements) {\n this.type = Syntax.ArrayExpression;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishAssignmentExpression: function (operator, left, right) {\n this.type = Syntax.AssignmentExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBinaryExpression: function (operator, left, right) {\n this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishCallExpression: function (callee, args) {\n this.type = Syntax.CallExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishConditionalExpression: function (test, consequent, alternate) {\n this.type = Syntax.ConditionalExpression;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishExpressionStatement: function (expression) {\n this.type = Syntax.ExpressionStatement;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishIdentifier: function (name) {\n this.type = Syntax.Identifier;\n this.name = name;\n this.finish();\n return this;\n },\n\n finishLiteral: function (token) {\n this.type = Syntax.Literal;\n this.value = token.value;\n this.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (this.raw == '//') {\n this.raw = '/(?:)/';\n }\n this.regex = token.regex;\n }\n this.finish();\n return this;\n },\n\n finishMemberExpression: function (accessor, object, property) {\n this.type = Syntax.MemberExpression;\n this.computed = accessor === '[';\n this.object = object;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishObjectExpression: function (properties) {\n this.type = Syntax.ObjectExpression;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishProgram: function (body) {\n this.type = Syntax.Program;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishProperty: function (kind, key, value) {\n this.type = Syntax.Property;\n this.key = key;\n this.value = value;\n this.kind = kind;\n this.finish();\n return this;\n },\n\n finishUnaryExpression: function (operator, argument) {\n this.type = Syntax.UnaryExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = true;\n this.finish();\n return this;\n }\n };\n\n // Return true if there is a line terminator before the next token.\n\n function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }\n\n // Throw an exception\n\n function 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 if (typeof token.lineNumber === 'number') {\n error = new Error('Line ' + token.lineNumber + ': ' + msg);\n error.index = token.start;\n error.lineNumber = token.lineNumber;\n error.column = token.start - lineStart + 1;\n } else {\n error = new Error('Line ' + lineNumber + ': ' + msg);\n error.index = index;\n error.lineNumber = lineNumber;\n error.column = index - lineStart + 1;\n }\n\n error.description = msg;\n throw error;\n }\n\n function throwErrorTolerant() {\n try {\n throwError.apply(null, arguments);\n } catch (e) {\n if (extra.errors) {\n extra.errors.push(e);\n } else {\n throw e;\n }\n }\n }\n\n\n // Throw an exception because of the token.\n\n function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // Expect the next token to match the specified punctuator.\n // If not, an exception will be thrown.\n\n function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }\n\n /**\n * @name expectTolerant\n * @description Quietly expect the given token value when in tolerant mode, otherwise delegates\n * to expect(value)\n * @param {String} value The value we are expecting the lookahead token to have\n * @since 2.0\n */\n function expectTolerant(value) {\n if (extra.errors) {\n var token = lookahead;\n if (token.type !== Token.Punctuator && token.value !== value) {\n throwErrorTolerant(token, Messages.UnexpectedToken, token.value);\n } else {\n lex();\n }\n } else {\n expect(value);\n }\n }\n\n // Return true if the next token matches the specified punctuator.\n\n function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }\n\n // Return true if the next token matches the specified keyword\n\n function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }\n\n function consumeSemicolon() {\n var line;\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(index) === 0x3B || match(';')) {\n lex();\n return;\n }\n\n line = lineNumber;\n skipComment();\n if (lineNumber !== line) {\n return;\n }\n\n if (lookahead.type !== Token.EOF && !match('}')) {\n throwUnexpected(lookahead);\n }\n }\n\n // 11.1.4 Array Initialiser\n\n function parseArrayInitialiser() {\n var elements = [], node = new Node();\n\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseAssignmentExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return node.finishArrayExpression(elements);\n }\n\n // 11.1.5 Object Initialiser\n\n function parseObjectPropertyKey() {\n var token, node = new Node();\n\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 === Token.StringLiteral || token.type === Token.NumericLiteral) {\n if (strict && token.octal) {\n throwErrorTolerant(token, Messages.StrictOctalLiteral);\n }\n return node.finishLiteral(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseObjectProperty() {\n var token, key, id, value, node = new Node();\n\n token = lookahead;\n\n if (token.type === Token.Identifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', id, value);\n }\n if (token.type === Token.EOF || token.type === Token.Punctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', key, value);\n }\n }\n\n function parseObjectInitialiser() {\n var properties = [], property, name, key, kind, map = {}, toString = String, node = new Node();\n\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === Syntax.Identifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n if (map[key] === PropertyKind.Data) {\n if (strict && kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.StrictDuplicateProperty);\n } else if (kind !== PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n }\n } else {\n if (kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n } else if (map[key] & kind) {\n throwErrorTolerant({}, Messages.AccessorGetSet);\n }\n }\n map[key] |= kind;\n } else {\n map[key] = kind;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expectTolerant(',');\n }\n }\n\n expect('}');\n\n return node.finishObjectExpression(properties);\n }\n\n // 11.1.6 The Grouping Operator\n\n function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }\n\n\n // 11.1 Primary Expressions\n\n var legalKeywords = {\"if\":1, \"this\":1};\n\n function parsePrimaryExpression() {\n var type, token, expr, node;\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 node = new Node();\n\n if (type === Token.Identifier || legalKeywords[lookahead.value]) {\n expr = node.finishIdentifier(lex().value);\n } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n if (strict && lookahead.octal) {\n throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n }\n expr = node.finishLiteral(lex());\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\");\n } else if (type === Token.BooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = node.finishLiteral(token);\n } else if (type === Token.NullLiteral) {\n token = lex();\n token.value = null;\n expr = node.finishLiteral(token);\n } else if (match('/') || match('/=')) {\n if (typeof extra.tokens !== 'undefined') {\n expr = node.finishLiteral(collectRegex());\n } else {\n expr = node.finishLiteral(scanRegExp());\n }\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n }\n\n // 11.2 Left-Hand-Side Expressions\n\n function parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseAssignmentExpression());\n if (match(')')) {\n break;\n }\n expectTolerant(',');\n }\n }\n\n expect(')');\n\n return args;\n }\n\n function parseNonComputedProperty() {\n var token, node = new Node();\n\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n }\n\n function parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n }\n\n function parseLeftHandSideExpressionAllowCall() {\n var expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }\n\n // 11.3 Postfix Expressions\n\n function parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === Token.Punctuator) {\n if ((match('++') || match('--')) && !peekLineTerminator()) {\n throw new Error(\"Disabled.\");\n }\n }\n\n return expr;\n }\n\n // 11.4 Unary Operators\n\n function parseUnaryExpression() {\n var token, expr, startToken;\n\n if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(\"Disabled.\");\n } else if (match('+') || match('-') || match('~') || match('!')) {\n startToken = lookahead;\n token = lex();\n expr = parseUnaryExpression();\n expr = new WrappingNode(startToken).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\n function binaryPrecedence(token, allowIn) {\n var prec = 0;\n\n if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\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 prec = 7;\n break;\n\n case 'in':\n prec = allowIn ? 7 : 0;\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\n function 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, state.allowIn);\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, state.allowIn)) > 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 = new WrappingNode(markers[markers.length - 1]).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 expr = new WrappingNode(markers.pop()).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\n function parseConditionalExpression() {\n var expr, previousAllowIn, consequent, alternate, startToken;\n\n startToken = lookahead;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n previousAllowIn = state.allowIn;\n state.allowIn = true;\n consequent = parseAssignmentExpression();\n state.allowIn = previousAllowIn;\n expect(':');\n alternate = parseAssignmentExpression();\n\n expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n }\n\n // 11.13 Assignment Operators\n\n function parseAssignmentExpression() {\n var oldParenthesisCount, token, expr, startToken;\n\n oldParenthesisCount = state.parenthesisCount;\n\n startToken = lookahead;\n token = lookahead;\n\n expr = parseConditionalExpression();\n\n return expr;\n }\n\n // 11.14 Comma Operator\n\n function parseExpression() {\n var expr = parseAssignmentExpression();\n\n if (match(',')) {\n throw new Error(\"Disabled.\"); // no sequence expressions\n }\n\n return expr;\n }\n\n // 12.4 Expression Statement\n\n function parseExpressionStatement(node) {\n var expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 12 Statements\n\n function parseStatement() {\n var type = lookahead.type,\n expr,\n node;\n\n if (type === Token.EOF) {\n throwUnexpected(lookahead);\n }\n\n if (type === Token.Punctuator && lookahead.value === '{') {\n throw new Error(\"Disabled.\"); // block statement\n }\n\n node = new Node();\n\n if (type === Token.Punctuator) {\n switch (lookahead.value) {\n case ';':\n throw new Error(\"Disabled.\"); // empty statement\n case '(':\n return parseExpressionStatement(node);\n default:\n break;\n }\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\"); // keyword\n }\n\n expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 14 Program\n\n function parseSourceElement() {\n if (lookahead.type === Token.Keyword) {\n switch (lookahead.value) {\n case 'const':\n case 'let':\n throw new Error(\"Disabled.\");\n case 'function':\n throw new Error(\"Disabled.\");\n default:\n return parseStatement();\n }\n }\n\n if (lookahead.type !== Token.EOF) {\n return parseStatement();\n }\n }\n\n function parseSourceElements() {\n var sourceElement, sourceElements = [], token, directive, firstRestricted;\n\n while (index < length) {\n token = lookahead;\n if (token.type !== Token.StringLiteral) {\n break;\n }\n\n sourceElement = parseSourceElement();\n sourceElements.push(sourceElement);\n if (sourceElement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n while (index < length) {\n sourceElement = parseSourceElement();\n if (typeof sourceElement === 'undefined') {\n break;\n }\n sourceElements.push(sourceElement);\n }\n return sourceElements;\n }\n\n function parseProgram() {\n var body, node;\n\n skipComment();\n peek();\n node = new Node();\n strict = true; // assume strict\n\n body = parseSourceElements();\n return node.finishProgram(body);\n }\n\n function filterTokenLocation() {\n var i, entry, token, tokens = [];\n\n for (i = 0; i < extra.tokens.length; ++i) {\n entry = extra.tokens[i];\n token = {\n type: entry.type,\n value: entry.value\n };\n if (entry.regex) {\n token.regex = {\n pattern: entry.regex.pattern,\n flags: entry.regex.flags\n };\n }\n if (extra.range) {\n token.range = entry.range;\n }\n if (extra.loc) {\n token.loc = entry.loc;\n }\n tokens.push(token);\n }\n\n extra.tokens = tokens;\n }\n\n function tokenize(code, options) {\n var toString,\n tokens;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n\n // Options matching.\n options = options || {};\n\n // Of course we collect tokens here.\n options.tokens = true;\n extra.tokens = [];\n extra.tokenize = true;\n // The following two fields are necessary to compute the Regex tokens.\n extra.openParenToken = -1;\n extra.openCurlyToken = -1;\n\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n\n try {\n peek();\n if (lookahead.type === Token.EOF) {\n return extra.tokens;\n }\n\n lex();\n while (lookahead.type !== Token.EOF) {\n try {\n lex();\n } catch (lexError) {\n if (extra.errors) {\n extra.errors.push(lexError);\n // We have to break on the first error\n // to avoid infinite loops.\n break;\n } else {\n throw lexError;\n }\n }\n }\n\n filterTokenLocation();\n tokens = extra.tokens;\n if (typeof extra.errors !== 'undefined') {\n tokens.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n return tokens;\n }\n\n function parse(code, options) {\n var program, toString;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n parenthesisCount: 0,\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n if (typeof options !== 'undefined') {\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (extra.loc && options.source !== null && options.source !== undefined) {\n extra.source = toString(options.source);\n }\n\n if (typeof options.tokens === 'boolean' && options.tokens) {\n extra.tokens = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n }\n\n try {\n program = parseProgram();\n if (typeof extra.tokens !== 'undefined') {\n filterTokenLocation();\n program.tokens = extra.tokens;\n }\n if (typeof extra.errors !== 'undefined') {\n program.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n\n return program;\n }\n\n return {\n tokenize: tokenize,\n parse: parse\n };\n\n})();", "var ts = Date.now();\n\nfunction write(msg) {\n msg = '[Vega Log] ' + msg;\n console.log(msg);\n}\n\nfunction error(msg) {\n msg = '[Vega Err] ' + msg;\n console.error(msg);\n}\n\nfunction debug(input, args) {\n if (!debug.enable) return;\n var log = Function.prototype.bind.call(console.log, console);\n var state = {\n prevTime: Date.now() - ts,\n stamp: input.stamp\n };\n\n if (input.add) {\n state.add = input.add.length;\n state.mod = input.mod.length;\n state.rem = input.rem.length;\n state.reflow = !!input.reflow;\n }\n\n log.apply(console, (args.push(JSON.stringify(state)), args));\n ts = Date.now();\n}\n\nmodule.exports = {\n log: write,\n error: error,\n debug: (debug.enable = false, debug)\n};\n", - "module.exports = {\n path: require('./path'),\n render: require('./render'),\n Item: require('./util/Item'),\n bound: require('./util/bound'),\n Bounds: require('./util/Bounds'),\n Gradient: require('./util/Gradient'),\n toJSON: require('./util/scene').toJSON,\n fromJSON: require('./util/scene').fromJSON\n};", + "module.exports = {\n path: require('./path'),\n render: require('./render'),\n Item: require('./util/Item'),\n bound: require('./util/bound'),\n Bounds: require('./util/Bounds'),\n canvas: require('./util/canvas'),\n Gradient: require('./util/Gradient'),\n toJSON: require('./util/scene').toJSON,\n fromJSON: require('./util/scene').fromJSON\n};", "var segmentCache = {},\n bezierCache = {},\n join = [].join;\n\n// Copied from Inkscape svgtopdf, thanks!\nfunction segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {\n var key = join.call(arguments);\n if (segmentCache[key]) {\n return segmentCache[key];\n }\n\n var th = rotateX * (Math.PI/180);\n var sin_th = Math.sin(th);\n var cos_th = Math.cos(th);\n rx = Math.abs(rx);\n ry = Math.abs(ry);\n var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;\n var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;\n var pl = (px*px) / (rx*rx) + (py*py) / (ry*ry);\n if (pl > 1) {\n pl = Math.sqrt(pl);\n rx *= pl;\n ry *= pl;\n }\n\n var a00 = cos_th / rx;\n var a01 = sin_th / rx;\n var a10 = (-sin_th) / ry;\n var a11 = (cos_th) / ry;\n var x0 = a00 * ox + a01 * oy;\n var y0 = a10 * ox + a11 * oy;\n var x1 = a00 * x + a01 * y;\n var y1 = a10 * x + a11 * y;\n\n var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0);\n var sfactor_sq = 1 / d - 0.25;\n if (sfactor_sq < 0) sfactor_sq = 0;\n var sfactor = Math.sqrt(sfactor_sq);\n if (sweep == large) sfactor = -sfactor;\n var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0);\n var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0);\n\n var th0 = Math.atan2(y0-yc, x0-xc);\n var th1 = Math.atan2(y1-yc, x1-xc);\n\n var th_arc = th1-th0;\n if (th_arc < 0 && sweep === 1){\n th_arc += 2 * Math.PI;\n } else if (th_arc > 0 && sweep === 0) {\n th_arc -= 2 * Math.PI;\n }\n\n var segs = Math.ceil(Math.abs(th_arc / (Math.PI * 0.5 + 0.001)));\n var result = [];\n for (var i=0; i len) {\n for (j=1, m=parsed.length; j=0;) {\n if (h[i].type !== type) continue;\n if (!handler || h[i].handler === handler) h.splice(i, 1);\n }\n return this;\n};\n\nprototype.pickEvent = function(evt) {\n var rect = this._canvas.getBoundingClientRect(),\n pad = this._padding, x, y;\n return this.pick(this._scene,\n x = (evt.clientX - rect.left),\n y = (evt.clientY - rect.top),\n x - pad.left, y - pad.top);\n};\n\n// find the scenegraph item at the current mouse position\n// x, y -- the absolute x, y mouse coordinates on the canvas element\n// gx, gy -- the relative coordinates within the current group\nprototype.pick = function(scene, x, y, gx, gy) {\n var g = this.context(),\n mark = marks[scene.marktype];\n return mark.pick.call(this, g, scene, x, y, gx, gy);\n};\n\nmodule.exports = CanvasHandler;\n", + "var DOM = require('../../util/dom'),\n Handler = require('../Handler'),\n marks = require('./marks');\n\nfunction CanvasHandler() {\n Handler.call(this);\n this._down = null;\n this._touch = null;\n this._first = true;\n}\n\nvar base = Handler.prototype;\nvar prototype = (CanvasHandler.prototype = Object.create(base));\nprototype.constructor = CanvasHandler;\n\nprototype.initialize = function(el, pad, obj) {\n // add event listeners\n var canvas = this._canvas = DOM.find(el, 'canvas');\n if (canvas) {\n var that = this;\n this.events.forEach(function(type) {\n canvas.addEventListener(type, function(evt) {\n if (prototype[type]) {\n prototype[type].call(that, evt);\n } else {\n that.fire(type, evt);\n }\n });\n });\n }\n\n return base.initialize.call(this, el, pad, obj);\n};\n\nprototype.canvas = function() {\n return this._canvas;\n};\n\n// retrieve the current canvas context\nprototype.context = function() {\n return this._canvas.getContext('2d');\n};\n\n// supported events\nprototype.events = [\n 'keydown',\n 'keypress',\n 'keyup',\n 'mousedown',\n 'mouseup',\n 'mousemove',\n 'mouseout',\n 'mouseover',\n 'click',\n 'dblclick',\n 'wheel',\n 'mousewheel',\n 'touchstart',\n 'touchmove',\n 'touchend'\n];\n\n// to keep firefox happy\nprototype.DOMMouseScroll = function(evt) {\n this.fire('mousewheel', evt);\n};\n\nprototype.mousemove = function(evt) {\n var a = this._active,\n p = this.pickEvent(evt);\n\n if (p === a) {\n // active item and picked item are the same\n this.fire('mousemove', evt); // fire move\n } else {\n // active item and picked item are different\n this.fire('mouseout', evt); // fire out for prior active item\n this._active = p; // set new active item\n this.fire('mouseover', evt); // fire over for new active item\n this.fire('mousemove', evt); // fire move for new active item\n }\n};\n\nprototype.mouseout = function(evt) {\n this.fire('mouseout', evt);\n this._active = null;\n};\n\nprototype.mousedown = function(evt) {\n this._down = this._active;\n this.fire('mousedown', evt);\n};\n\nprototype.click = function(evt) {\n if (this._down === this._active) {\n this.fire('click', evt);\n this._down = null;\n }\n};\n\nprototype.touchstart = function(evt) {\n this._touch = this.pickEvent(evt.changedTouches[0]);\n\n if (this._first) {\n this._active = this._touch;\n this._first = false;\n }\n\n this.fire('touchstart', evt, true);\n};\n\nprototype.touchmove = function(evt) {\n this.fire('touchmove', evt, true);\n};\n\nprototype.touchend = function(evt) {\n this.fire('touchend', evt, true);\n this._touch = null;\n};\n\n// fire an event\nprototype.fire = function(type, evt, touch) {\n var a = touch ? this._touch : this._active,\n h = this._handlers[type], i, len;\n if (h) {\n evt.vegaType = type;\n for (i=0, len=h.length; i=0;) {\n if (h[i].type !== type) continue;\n if (!handler || h[i].handler === handler) h.splice(i, 1);\n }\n return this;\n};\n\nprototype.pickEvent = function(evt) {\n var rect = this._canvas.getBoundingClientRect(),\n pad = this._padding, x, y;\n return this.pick(this._scene,\n x = (evt.clientX - rect.left),\n y = (evt.clientY - rect.top),\n x - pad.left, y - pad.top);\n};\n\n// find the scenegraph item at the current mouse position\n// x, y -- the absolute x, y mouse coordinates on the canvas element\n// gx, gy -- the relative coordinates within the current group\nprototype.pick = function(scene, x, y, gx, gy) {\n var g = this.context(),\n mark = marks[scene.marktype];\n return mark.pick.call(this, g, scene, x, y, gx, gy);\n};\n\nmodule.exports = CanvasHandler;\n", "var DOM = require('../../util/dom'),\n Bounds = require('../../util/Bounds'),\n ImageLoader = require('../../util/ImageLoader'),\n Canvas = require('../../util/canvas'),\n Renderer = require('../Renderer'),\n marks = require('./marks');\n\nfunction CanvasRenderer(loadConfig) {\n Renderer.call(this);\n this._loader = new ImageLoader(loadConfig);\n}\n\nCanvasRenderer.RETINA = true;\n\nvar base = Renderer.prototype;\nvar prototype = (CanvasRenderer.prototype = Object.create(base));\nprototype.constructor = CanvasRenderer;\n\nprototype.initialize = function(el, width, height, padding) {\n this._canvas = Canvas.instance(width, height);\n if (el) {\n DOM.clear(el, 0).appendChild(this._canvas);\n this._canvas.setAttribute('class', 'marks');\n }\n return base.initialize.call(this, el, width, height, padding);\n};\n\nprototype.resize = function(width, height, padding) {\n base.resize.call(this, width, height, padding);\n Canvas.resize(this._canvas, this._width, this._height,\n this._padding, CanvasRenderer.RETINA);\n return this;\n};\n\nprototype.canvas = function() {\n return this._canvas;\n};\n\nprototype.context = function() {\n return this._canvas ? this._canvas.getContext('2d') : null;\n};\n\nprototype.pendingImages = function() {\n return this._loader.pending();\n};\n\nfunction clipToBounds(g, items) {\n if (!items) return null;\n\n var b = new Bounds(), i, n, item, mark, group;\n for (i=0, n=items.length; i=0;) {\n group = items[i];\n dx = group.x || 0;\n dy = group.y || 0;\n\n g.save();\n g.translate(dx, dy);\n for (j=group.items.length; --j >= 0;) {\n subscene = group.items[j];\n if (subscene.interactive === false) continue;\n hits = this.pick(subscene, x, y, gx-dx, gy-dy);\n if (hits) {\n g.restore();\n return hits;\n }\n }\n g.restore();\n }\n\n return scene.interactive !== false ? pickSelf(g, scene, x, y, gx, gy) : null;\n}\n\nvar pickSelf = util.pick(hit);\n\nmodule.exports = {\n draw: draw,\n pick: pick\n};\n", + "var util = require('./util'),\n EMPTY = [];\n\nfunction draw(g, scene, bounds) {\n if (!scene.items || !scene.items.length) return;\n\n var groups = scene.items,\n renderer = this,\n group, items, axes, legends, gx, gy, w, h, opac, i, n, j, m;\n\n for (i=0, n=groups.length; i 0) {\n if (group.fill && util.fill(g, group, opac)) {\n g.fillRect(gx, gy, w, h);\n }\n if (group.stroke && util.stroke(g, group, opac)) {\n g.strokeRect(gx, gy, w, h);\n }\n }\n }\n\n // setup graphics context\n g.save();\n g.translate(gx, gy);\n if (group.clip) {\n g.beginPath();\n g.rect(0, 0, w, h);\n g.clip();\n }\n if (bounds) bounds.translate(-gx, -gy);\n\n // draw group contents\n for (j=0, m=axes.length; j=0;) {\n group = groups[i];\n\n // first hit test against bounding box\n // if a group is clipped, that should be handled by the bounds check.\n b = group.bounds;\n if (b && !b.contains(gx, gy)) continue;\n\n // passed bounds check, so test sub-groups\n axes = group.axisItems || EMPTY;\n items = group.items || EMPTY;\n legends = group.legendItems || EMPTY;\n dx = (group.x || 0);\n dy = (group.y || 0);\n\n g.save();\n g.translate(dx, dy);\n dx = gx - dx;\n dy = gy - dy;\n for (j=legends.length; --j>=0;) {\n subscene = legends[j];\n if (subscene.interactive !== false) {\n hits = this.pick(subscene, x, y, dx, dy);\n if (hits) { g.restore(); return hits; }\n }\n }\n for (j=axes.length; --j>=0;) {\n subscene = axes[j];\n if (subscene.interactive !== false && subscene.layer !== 'back') {\n hits = this.pick(subscene, x, y, dx, dy);\n if (hits) { g.restore(); return hits; }\n }\n }\n for (j=items.length; --j>=0;) {\n subscene = items[j];\n if (subscene.interactive !== false) {\n hits = this.pick(subscene, x, y, dx, dy);\n if (hits) { g.restore(); return hits; }\n }\n }\n for (j=axes.length; --j>=0;) {\n subscene = axes[j];\n if (subscene.interative !== false && subscene.layer === 'back') {\n hits = this.pick(subscene, x, y, dx, dy);\n if (hits) { g.restore(); return hits; }\n }\n }\n g.restore();\n\n if (scene.interactive !== false && (group.fill || group.stroke) &&\n dx >= 0 && dx <= group.width && dy >= 0 && dy <= group.height) {\n return group;\n }\n }\n\n return null;\n}\n\nmodule.exports = {\n draw: draw,\n pick: pick\n};\n", "var util = require('./util');\n\nfunction draw(g, scene, bounds) {\n if (!scene.items || !scene.items.length) return;\n\n var renderer = this,\n items = scene.items, o;\n\n for (var i=0, len=items.length; i= 0;) {\n o = scene.items[i]; b = o.bounds;\n // first hit test against bounding box\n if ((b && !b.contains(gx, gy)) || !b) continue;\n // if in bounding box, perform more careful test\n if (test(g, o, x, y, gx, gy)) return o;\n }\n return null;\n };\n}\n\nfunction testPath(path, filled) {\n return function(g, o, x, y) {\n var item = Array.isArray(o) ? o[0] : o,\n fill = (filled == null) ? item.fill : filled,\n stroke = item.stroke && g.isPointInStroke, lw, lc;\n\n if (stroke) {\n lw = item.strokeWidth;\n lc = item.strokeCap;\n g.lineWidth = lw != null ? lw : 1;\n g.lineCap = lc != null ? lc : 'butt';\n }\n\n return path(g, o) ? false :\n (fill && g.isPointInPath(x, y)) ||\n (stroke && g.isPointInStroke(x, y));\n };\n}\n\nfunction pickPath(path) {\n return pick(testPath(path));\n}\n\nfunction fill(g, o, opacity) {\n opacity *= (o.fillOpacity==null ? 1 : o.fillOpacity);\n if (opacity > 0) {\n g.globalAlpha = opacity;\n g.fillStyle = color(g, o, o.fill);\n return true;\n } else {\n return false;\n }\n}\n\nfunction stroke(g, o, opacity) {\n var lw = (lw = o.strokeWidth) != null ? lw : 1, lc;\n if (lw <= 0) return false;\n\n opacity *= (o.strokeOpacity==null ? 1 : o.strokeOpacity);\n if (opacity > 0) {\n g.globalAlpha = opacity;\n g.strokeStyle = color(g, o, o.stroke);\n g.lineWidth = lw;\n g.lineCap = (lc = o.strokeCap) != null ? lc : 'butt';\n g.vgLineDash(o.strokeDash || null);\n g.vgLineDashOffset(o.strokeDashOffset || 0);\n return true;\n } else {\n return false;\n }\n}\n\nfunction color(g, o, value) {\n return (value.id) ?\n gradient(g, value, o.bounds) :\n value;\n}\n\nfunction gradient(g, p, b) {\n var w = b.width(),\n h = b.height(),\n x1 = b.x1 + p.x1 * w,\n y1 = b.y1 + p.y1 * h,\n x2 = b.x1 + p.x2 * w,\n y2 = b.y1 + p.y2 * h,\n grad = g.createLinearGradient(x1, y1, x2, y2),\n stop = p.stops,\n i, n;\n\n for (i=0, n=stop.length; i=0;) {\n if (h[i].type === type && !handler || h[i].handler === handler) {\n svg.removeEventListener(name, h[i].listener);\n h.splice(i, 1);\n }\n }\n return this;\n};\n\nmodule.exports = SVGHandler;\n", - "var ImageLoader = require('../../util/ImageLoader'),\n Renderer = require('../Renderer'),\n text = require('../../util/text'),\n DOM = require('../../util/dom'),\n SVG = require('../../util/svg'),\n ns = SVG.metadata.xmlns,\n marks = require('./marks');\n\nfunction SVGRenderer(loadConfig) {\n Renderer.call(this);\n this._loader = new ImageLoader(loadConfig);\n this._dirtyID = 0;\n}\n\nvar base = Renderer.prototype;\nvar prototype = (SVGRenderer.prototype = Object.create(base));\nprototype.constructor = SVGRenderer;\n\nprototype.initialize = function(el, width, height, padding) {\n if (el) {\n this._svg = DOM.child(el, 0, 'svg', ns, 'marks');\n DOM.clear(el, 1);\n // set the svg root group\n this._root = DOM.child(this._svg, 0, 'g', ns);\n DOM.clear(this._svg, 1);\n }\n\n // create the svg definitions cache\n this._defs = {\n clip_id: 1,\n gradient: {},\n clipping: {}\n };\n\n // set background color if defined\n this.background(this._bgcolor);\n\n return base.initialize.call(this, el, width, height, padding);\n};\n\nprototype.background = function(bgcolor) {\n if (arguments.length && this._svg) {\n this._svg.style.setProperty('background-color', bgcolor);\n }\n return base.background.apply(this, arguments);\n};\n\nprototype.resize = function(width, height, padding) {\n base.resize.call(this, width, height, padding);\n \n if (this._svg) {\n var w = this._width,\n h = this._height,\n p = this._padding;\n \n this._svg.setAttribute('width', w + p.left + p.right);\n this._svg.setAttribute('height', h + p.top + p.bottom);\n \n this._root.setAttribute('transform', 'translate('+p.left+','+p.top+')');\n }\n\n return this;\n};\n\nprototype.svg = function() {\n if (!this._svg) return null;\n\n var attr = {\n 'class': 'marks',\n 'width': this._width + this._padding.left + this._padding.right,\n 'height': this._height + this._padding.top + this._padding.bottom,\n };\n for (var key in SVG.metadata) {\n attr[key] = SVG.metadata[key];\n }\n\n return DOM.openTag('svg', attr) + this._svg.innerHTML + DOM.closeTag('svg');\n};\n\nprototype.imageURL = function(url) {\n return this._loader.imageURL(url);\n};\n\n\n// -- Render entry point --\n\nprototype.render = function(scene, items) {\n if (this._dirtyCheck(items)) {\n if (this._dirtyAll) this._resetDefs();\n this.draw(this._root, scene, -1);\n DOM.clear(this._root, 1);\n }\n this.updateDefs();\n return this;\n};\n\nprototype.draw = function(el, scene, index) {\n this.drawMark(el, scene, index, marks[scene.marktype]);\n};\n\n\n// -- Manage SVG definitions ('defs') block --\n\nprototype.updateDefs = function() {\n var svg = this._svg,\n defs = this._defs,\n el = defs.el,\n index = 0, id;\n\n for (id in defs.gradient) {\n if (!el) el = (defs.el = DOM.child(svg, 0, 'defs', ns));\n updateGradient(el, defs.gradient[id], index++);\n }\n\n for (id in defs.clipping) {\n if (!el) el = (defs.el = DOM.child(svg, 0, 'defs', ns));\n updateClipping(el, defs.clipping[id], index++);\n }\n\n // clean-up\n if (el) {\n if (index === 0) {\n svg.removeChild(el);\n defs.el = null;\n } else {\n DOM.clear(el, index); \n }\n }\n};\n\nfunction updateGradient(el, grad, index) {\n var i, n, stop;\n\n el = DOM.child(el, index, 'linearGradient', ns);\n el.setAttribute('id', grad.id);\n el.setAttribute('x1', grad.x1);\n el.setAttribute('x2', grad.x2);\n el.setAttribute('y1', grad.y1);\n el.setAttribute('y2', grad.y2);\n \n for (i=0, n=grad.stops.length; i 0) ? openTag('defs') + defs + closeTag('defs') : '';\n};\n\nprototype.imageURL = function(url) {\n return this._loader.imageURL(url);\n};\n\nvar object;\n\nfunction emit(name, value, ns, prefixed) {\n object[prefixed || name] = value;\n}\n\nprototype.attributes = function(attr, item) {\n object = {};\n attr(emit, item, this);\n return object;\n};\n\nprototype.mark = function(scene) {\n var mdef = MARKS[scene.marktype],\n tag = mdef.tag,\n attr = mdef.attr,\n nest = mdef.nest || false,\n data = nest ?\n (scene.items && scene.items.length ? [scene.items[0]] : []) :\n (scene.items || []),\n defs = this._defs,\n str = '',\n style, i, item;\n\n if (tag !== 'g' && scene.interactive === false) {\n style = 'style=\"pointer-events: none;\"';\n }\n\n // render opening group tag\n str += openTag('g', {\n 'class': DOM.cssClass(scene)\n }, style);\n\n // render contained elements\n for (i=0; i/g, '>');\n}\n\nmodule.exports = SVGStringRenderer;\n", "module.exports = {\n Handler: require('./SVGHandler'),\n Renderer: require('./SVGRenderer'),\n string: {\n Renderer : require('./SVGStringRenderer')\n }\n};", "var text = require('../../util/text'),\n SVG = require('../../util/svg'),\n textAlign = SVG.textAlign,\n path = SVG.path;\n\nfunction translateItem(o) {\n return translate(o.x || 0, o.y || 0);\n}\n\nfunction translate(x, y) {\n return 'translate(' + x + ',' + y + ')';\n}\n\nmodule.exports = {\n arc: {\n tag: 'path',\n type: 'arc',\n attr: function(emit, o) {\n emit('transform', translateItem(o));\n emit('d', path.arc(o));\n }\n },\n area: {\n tag: 'path',\n type: 'area',\n nest: true,\n attr: function(emit, o) {\n var items = o.mark.items;\n if (items.length) emit('d', path.area(items));\n }\n },\n group: {\n tag: 'g',\n type: 'group',\n attr: function(emit, o, renderer) {\n var id = null, defs, c;\n emit('transform', translateItem(o));\n if (o.clip) {\n defs = renderer._defs;\n id = o.clip_id || (o.clip_id = 'clip' + defs.clip_id++);\n c = defs.clipping[id] || (defs.clipping[id] = {id: id});\n c.width = o.width || 0;\n c.height = o.height || 0;\n }\n emit('clip-path', id ? ('url(#' + id + ')') : null);\n },\n background: function(emit, o) {\n emit('class', 'background');\n emit('width', o.width || 0);\n emit('height', o.height || 0);\n }\n },\n image: {\n tag: 'image',\n type: 'image',\n attr: function(emit, o, renderer) {\n var x = o.x || 0,\n y = o.y || 0,\n w = o.width || 0,\n h = o.height || 0,\n url = renderer.imageURL(o.url);\n\n x = x - (o.align === 'center' ? w/2 : o.align === 'right' ? w : 0);\n y = y - (o.baseline === 'middle' ? h/2 : o.baseline === 'bottom' ? h : 0);\n\n emit('href', url, 'http://www.w3.org/1999/xlink', 'xlink:href');\n emit('transform', translate(x, y));\n emit('width', w);\n emit('height', h);\n }\n },\n line: {\n tag: 'path',\n type: 'line',\n nest: true,\n attr: function(emit, o) {\n var items = o.mark.items;\n if (items.length) emit('d', path.line(items));\n }\n },\n path: {\n tag: 'path',\n type: 'path',\n attr: function(emit, o) {\n emit('transform', translateItem(o));\n emit('d', o.path);\n }\n },\n rect: {\n tag: 'rect',\n type: 'rect',\n nest: false,\n attr: function(emit, o) {\n emit('transform', translateItem(o));\n emit('width', o.width || 0);\n emit('height', o.height || 0);\n }\n },\n rule: {\n tag: 'line',\n type: 'rule',\n attr: function(emit, o) {\n emit('transform', translateItem(o));\n emit('x2', o.x2 != null ? o.x2 - (o.x||0) : 0);\n emit('y2', o.y2 != null ? o.y2 - (o.y||0) : 0);\n }\n },\n symbol: {\n tag: 'path',\n type: 'symbol',\n attr: function(emit, o) {\n emit('transform', translateItem(o));\n emit('d', path.symbol(o));\n }\n },\n text: {\n tag: 'text',\n type: 'text',\n nest: false,\n attr: function(emit, o) {\n var dx = (o.dx || 0),\n dy = (o.dy || 0) + text.offset(o),\n x = (o.x || 0),\n y = (o.y || 0),\n a = o.angle || 0,\n r = o.radius || 0, t;\n\n if (r) {\n t = (o.theta || 0) - Math.PI/2;\n x += r * Math.cos(t);\n y += r * Math.sin(t);\n }\n\n emit('text-anchor', textAlign[o.align] || 'start');\n \n if (a) {\n t = translate(x, y) + ' rotate('+a+')';\n if (dx || dy) t += ' ' + translate(dx, dy);\n } else {\n t = translate(x+dx, y+dy);\n }\n emit('transform', t);\n }\n }\n};\n", @@ -226,7 +231,7 @@ "var gradient_id = 0;\n\nfunction Gradient(type) {\n this.id = 'gradient_' + (gradient_id++);\n this.type = type || 'linear';\n this.stops = [];\n this.x1 = 0;\n this.x2 = 1;\n this.y1 = 0;\n this.y2 = 0;\n}\n\nvar prototype = Gradient.prototype;\n\nprototype.stop = function(offset, color) {\n this.stops.push({\n offset: offset,\n color: color\n });\n return this;\n};\n\nmodule.exports = Gradient;", "var load = require('datalib/src/import/load');\n\nfunction ImageLoader(loadConfig) {\n this._pending = 0;\n this._config = loadConfig || ImageLoader.Config; \n}\n\n// Overridable global default load configuration\nImageLoader.Config = null;\n\nvar prototype = ImageLoader.prototype;\n\nprototype.pending = function() {\n return this._pending;\n};\n\nprototype.params = function(uri) {\n var p = {url: uri}, k;\n for (k in this._config) { p[k] = this._config[k]; }\n return p;\n};\n\nprototype.imageURL = function(uri) {\n return load.sanitizeUrl(this.params(uri));\n};\n\nfunction browser(uri, callback) {\n var url = load.sanitizeUrl(this.params(uri));\n if (!url) { // error\n if (callback) callback(uri, null);\n return null;\n }\n\n var loader = this,\n image = new Image();\n\n loader._pending += 1;\n\n image.onload = function() {\n loader._pending -= 1;\n image.loaded = true;\n if (callback) callback(null, image);\n };\n image.src = url;\n\n return image;\n}\n\nfunction server(uri, callback) {\n var loader = this,\n image = new ((typeof window !== \"undefined\" ? window['canvas'] : typeof global !== \"undefined\" ? global['canvas'] : null).Image)();\n\n loader._pending += 1;\n\n load(this.params(uri), function(err, data) {\n loader._pending -= 1;\n if (err) {\n if (callback) callback(err, null);\n return null;\n }\n image.src = data;\n image.loaded = true;\n if (callback) callback(null, image);\n });\n\n return image;\n}\n\nprototype.loadImage = function(uri, callback) {\n return load.useXHR ?\n browser.call(this, uri, callback) :\n server.call(this, uri, callback);\n};\n\nmodule.exports = ImageLoader;\n", "function Item(mark) {\n this.mark = mark;\n}\n\nvar prototype = Item.prototype;\n\nprototype.hasPropertySet = function(name) {\n var props = this.mark.def.properties;\n return props && props[name] != null;\n};\n\nprototype.cousin = function(offset, index) {\n if (offset === 0) return this;\n offset = offset || -1;\n var mark = this.mark,\n group = mark.group,\n iidx = index==null ? mark.items.indexOf(this) : index,\n midx = group.items.indexOf(mark) + offset;\n return group.items[midx].items[iidx];\n};\n\nprototype.sibling = function(offset) {\n if (offset === 0) return this;\n offset = offset || -1;\n var mark = this.mark,\n iidx = mark.items.indexOf(this) + offset;\n return mark.items[iidx];\n};\n\nprototype.remove = function() {\n var item = this,\n list = item.mark.items,\n i = list.indexOf(item);\n if (i >= 0) {\n if (i===list.length-1) {\n list.pop();\n } else {\n list.splice(i, 1);\n }\n }\n return item;\n};\n\nprototype.touch = function() {\n if (this.pathCache) this.pathCache = null;\n};\n\nmodule.exports = Item;", - "var BoundsContext = require('./BoundsContext'),\n Bounds = require('./Bounds'),\n canvas = require('./canvas'),\n svg = require('./svg'),\n text = require('./text'),\n paths = require('../path'),\n parse = paths.parse,\n drawPath = paths.render,\n areaPath = svg.path.area,\n linePath = svg.path.line,\n halfpi = Math.PI / 2,\n sqrt3 = Math.sqrt(3),\n tan30 = Math.tan(30 * Math.PI / 180),\n g2D = null,\n bc = BoundsContext();\n\nfunction context() {\n return g2D || (g2D = canvas.instance(1,1).getContext('2d'));\n}\n\nfunction strokeBounds(o, bounds) {\n if (o.stroke && o.opacity !== 0 && o.stokeOpacity !== 0) {\n bounds.expand(o.strokeWidth != null ? o.strokeWidth : 1);\n }\n return bounds;\n}\n\nfunction pathBounds(o, path, bounds, x, y) {\n if (path == null) {\n bounds.set(0, 0, 0, 0);\n } else {\n drawPath(bc.bounds(bounds), path, x, y);\n strokeBounds(o, bounds);\n }\n return bounds;\n}\n\nfunction path(o, bounds) {\n var p = o.path ? o.pathCache || (o.pathCache = parse(o.path)) : null;\n return pathBounds(o, p, bounds, o.x, o.y);\n}\n\nfunction area(mark, bounds) {\n if (mark.items.length === 0) return bounds;\n var items = mark.items,\n item = items[0],\n p = item.pathCache || (item.pathCache = parse(areaPath(items)));\n return pathBounds(item, p, bounds);\n}\n\nfunction line(mark, bounds) {\n if (mark.items.length === 0) return bounds;\n var items = mark.items,\n item = items[0],\n p = item.pathCache || (item.pathCache = parse(linePath(items)));\n return pathBounds(item, p, bounds);\n}\n\nfunction rect(o, bounds) {\n var x, y;\n return strokeBounds(o, bounds.set(\n x = o.x || 0,\n y = o.y || 0,\n (x + o.width) || 0,\n (y + o.height) || 0\n ));\n}\n\nfunction image(o, bounds) {\n var x = o.x || 0,\n y = o.y || 0,\n w = o.width || 0,\n h = o.height || 0;\n x = x - (o.align === 'center' ? w/2 : (o.align === 'right' ? w : 0));\n y = y - (o.baseline === 'middle' ? h/2 : (o.baseline === 'bottom' ? h : 0));\n return bounds.set(x, y, x+w, y+h);\n}\n\nfunction rule(o, bounds) {\n var x1, y1;\n return strokeBounds(o, bounds.set(\n x1 = o.x || 0,\n y1 = o.y || 0,\n o.x2 != null ? o.x2 : x1,\n o.y2 != null ? o.y2 : y1\n ));\n}\n\nfunction arc(o, bounds) {\n var cx = o.x || 0,\n cy = o.y || 0,\n ir = o.innerRadius || 0,\n or = o.outerRadius || 0,\n sa = (o.startAngle || 0) - halfpi,\n ea = (o.endAngle || 0) - halfpi,\n xmin = Infinity, xmax = -Infinity,\n ymin = Infinity, ymax = -Infinity,\n a, i, n, x, y, ix, iy, ox, oy;\n\n var angles = [sa, ea],\n s = sa - (sa % halfpi);\n for (i=0; i<4 && s index) {\n el.removeChild(el.childNodes[--curr]);\n }\n return el;\n },\n remove: remove,\n // generate css class name for mark\n cssClass: function(mark) {\n return 'mark-' + mark.marktype + (mark.name ? ' '+mark.name : '');\n },\n // generate string for an opening xml tag\n // tag: the name of the xml tag\n // attr: hash of attribute name-value pairs to include\n // raw: additional raw string to include in tag markup\n openTag: function(tag, attr, raw) {\n var s = '<' + tag, key, val;\n if (attr) {\n for (key in attr) {\n val = attr[key];\n if (val != null) {\n s += ' ' + key + '=\"' + val + '\"';\n }\n }\n }\n if (raw) s += ' ' + raw;\n return s + '>';\n },\n // generate string for closing xml tag\n // tag: the name of the xml tag\n closeTag: function(tag) {\n return '';\n }\n};\n", "var bound = require('../util/bound');\n\nvar sets = [\n 'items',\n 'axisItems',\n 'legendItems'\n];\n\nvar keys = [\n 'marktype', 'name', 'interactive', 'clip',\n 'items', 'axisItems', 'legendItems', 'layer',\n 'x', 'y', 'width', 'height', 'align', 'baseline', // layout\n 'fill', 'fillOpacity', 'opacity', // fill\n 'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke\n 'strokeDash', 'strokeDashOffset', // stroke dash\n 'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc\n 'interpolate', 'tension', 'orient', // area, line\n 'url', // image\n 'path', // path\n 'x2', 'y2', // rule\n 'size', 'shape', // symbol\n 'text', 'angle', 'theta', 'radius', 'dx', 'dy', // text\n 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant' // font\n];\n\nfunction toJSON(scene, indent) {\n return JSON.stringify(scene, keys, indent);\n}\n\nfunction fromJSON(json) {\n var scene = (typeof json === 'string' ? JSON.parse(json) : json);\n return initialize(scene);\n}\n\nfunction initialize(scene) {\n var type = scene.marktype,\n i, n, s, m, items;\n\n for (s=0, m=sets.length; s 0) { wait(); } else { callback(this.canvas()); }\n};\n\nprototype.svg = function() {\n return (this._type === 'svg') ? this._renderer.svg() : null;\n};\n\nprototype.initialize = function() { \n var w = this._width,\n h = this._height,\n bg = this._bgcolor,\n pad = this._padding,\n config = this.model().config();\n\n if (this._viewport) {\n w = this._viewport[0] - (pad ? pad.left + pad.right : 0);\n h = this._viewport[1] - (pad ? pad.top + pad.bottom : 0);\n }\n\n this._renderer = (this._renderer || new this._io.Renderer(config.load))\n .initialize(null, w, h, pad)\n .background(bg);\n \n return this;\n};\n\nmodule.exports = HeadlessView;", "var dl = require('datalib'),\n df = require('vega-dataflow'),\n ChangeSet = df.ChangeSet,\n Base = df.Graph.prototype,\n Node = df.Node, // jshint ignore:line\n GroupBuilder = require('../scene/GroupBuilder'),\n visit = require('../scene/visit'),\n config = require('./config');\n\nfunction Model(cfg) {\n this._defs = {};\n this._predicates = {};\n this._scene = null;\n\n this._node = null;\n this._builder = null; // Top-level scenegraph builder\n\n this._reset = {axes: false, legends: false};\n\n this.config(cfg);\n Base.init.call(this);\n}\n\nvar prototype = (Model.prototype = Object.create(Base));\nprototype.constructor = Model;\n\nprototype.defs = function(defs) {\n if (!arguments.length) return this._defs;\n this._defs = defs;\n return this;\n};\n\nprototype.config = function(cfg) {\n if (!arguments.length) return this._config;\n this._config = Object.create(config);\n for (var name in cfg) {\n var x = cfg[name], y = this._config[name];\n if (dl.isObject(x) && dl.isObject(y)) {\n dl.extend(y, x);\n } else {\n this._config[name] = x;\n }\n }\n\n return this;\n};\n\nprototype.width = function(width) {\n if (this._defs) this._defs.width = width;\n if (this._defs && this._defs.marks) this._defs.marks.width = width;\n if (this._scene) {\n this._scene.items[0].width = width;\n this._scene.items[0]._dirty = true;\n }\n this._reset.axes = true;\n return this;\n};\n\nprototype.height = function(height) {\n if (this._defs) this._defs.height = height;\n if (this._defs && this._defs.marks) this._defs.marks.height = height;\n if (this._scene) {\n this._scene.items[0].height = height;\n this._scene.items[0]._dirty = true;\n }\n this._reset.axes = true;\n return this;\n};\n\nprototype.node = function() {\n return this._node || (this._node = new Node(this));\n};\n\nprototype.data = function() {\n var data = Base.data.apply(this, arguments);\n if (arguments.length > 1) { // new Datasource\n this.node().addListener(data.pipeline()[0]);\n }\n return data;\n};\n\nfunction predicates(name) {\n var m = this, pred = {};\n if (!dl.isArray(name)) return this._predicates[name];\n name.forEach(function(n) { pred[n] = m._predicates[n]; });\n return pred;\n}\n\nprototype.predicate = function(name, predicate) {\n if (arguments.length === 1) return predicates.call(this, name);\n return (this._predicates[name] = predicate);\n};\n\nprototype.predicates = function() { return this._predicates; };\n\nprototype.scene = function(renderer) {\n if (!arguments.length) return this._scene;\n if (this._builder) this.node().removeListener(this._builder.disconnect());\n this._builder = new GroupBuilder(this, this._defs.marks, this._scene={});\n this.node().addListener(this._builder.connect());\n var p = this._builder.pipeline();\n p[p.length-1].addListener(renderer);\n return this;\n};\n\nprototype.reset = function() {\n if (this._scene && this._reset.axes) {\n visit(this._scene, function(item) {\n if (item.axes) item.axes.forEach(function(axis) { axis.reset(); });\n });\n this._reset.axes = false;\n }\n if (this._scene && this._reset.legends) {\n visit(this._scene, function(item) {\n if (item.legends) item.legends.forEach(function(l) { l.reset(); });\n });\n this._reset.legends = false;\n }\n return this;\n};\n\nprototype.addListener = function(l) {\n this.node().addListener(l);\n};\n\nprototype.removeListener = function(l) {\n this.node().removeListener(l); \n};\n\nprototype.fire = function(cs) {\n if (!cs) cs = ChangeSet.create();\n this.propagate(cs, this.node());\n};\n\nmodule.exports = Model;", - "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n df = require('vega-dataflow'),\n sg = require('vega-scenegraph').render,\n log = require('vega-logging'),\n Deps = df.Dependencies,\n parseStreams = require('../parse/streams'),\n Encoder = require('../scene/Encoder'),\n Transition = require('../scene/Transition');\n\nfunction View(el, width, height) {\n this._el = null;\n this._model = null;\n this._width = this.__width = width || 500;\n this._height = this.__height = height || 300;\n this._bgcolor = null;\n this._autopad = 1;\n this._padding = {top:0, left:0, bottom:0, right:0};\n this._viewport = null;\n this._renderer = null;\n this._handler = null;\n this._streamer = null; // Targeted update for streaming changes\n this._changeset = null;\n this._repaint = true; // Full re-render on every re-init\n this._renderers = sg;\n this._io = null;\n this._api = {}; // Stash streaming data API sandboxes.\n}\n\nvar prototype = View.prototype;\n\nprototype.model = function(model) {\n if (!arguments.length) return this._model;\n if (this._model !== model) {\n this._model = model;\n this._streamer = new df.Node(model);\n this._streamer._rank = -1; // HACK: To reduce re-ranking churn.\n this._changeset = df.ChangeSet.create();\n if (this._handler) this._handler.model(model);\n }\n return this;\n};\n\n// Sandboxed streaming data API\nfunction streaming(src) {\n var view = this,\n ds = this._model.data(src),\n name = ds.name(),\n listener = ds.pipeline()[0],\n streamer = this._streamer,\n api = {};\n\n // If we have it stashed, don't create a new closure. \n if (this._api[src]) return this._api[src];\n\n api.insert = function(vals) {\n ds.insert(dl.duplicate(vals)); // Don't pollute the environment\n streamer.addListener(listener);\n view._changeset.data[name] = 1;\n return api;\n };\n\n api.update = function() {\n streamer.addListener(listener);\n view._changeset.data[name] = 1;\n return (ds.update.apply(ds, arguments), api);\n };\n\n api.remove = function() {\n streamer.addListener(listener);\n view._changeset.data[name] = 1;\n return (ds.remove.apply(ds, arguments), api);\n };\n\n api.values = function() { return ds.values(); }; \n\n return (this._api[src] = api);\n}\n\nprototype.data = function(data) {\n var v = this;\n if (!arguments.length) return v._model.values();\n else if (dl.isString(data)) return streaming.call(v, data);\n else if (dl.isObject(data)) {\n dl.keys(data).forEach(function(k) {\n var api = streaming.call(v, k);\n data[k](api);\n });\n }\n return this;\n};\n\nprototype.signal = function(name, value) {\n var m = this._model,\n cs = this._changeset,\n streamer = this._streamer,\n setter = name; \n\n if (!arguments.length) {\n return m.values(Deps.SIGNALS);\n } else if (arguments.length == 1 && dl.isString(name)) {\n return m.values(Deps.SIGNALS, name);\n }\n\n if (arguments.length == 2) {\n setter = {};\n setter[name] = value;\n }\n\n dl.keys(setter).forEach(function(k) {\n streamer.addListener(m.signal(k).value(setter[k]));\n cs.signals[k] = 1;\n cs.reflow = true;\n });\n\n return this;\n};\n\nprototype.width = function(width) {\n if (!arguments.length) return this.__width;\n if (this.__width !== width) {\n this._width = this.__width = width;\n this.model().width(width);\n this.initialize();\n if (this._strict) this._autopad = 1;\n }\n return this;\n};\n\nprototype.height = function(height) {\n if (!arguments.length) return this.__height;\n if (this.__height !== height) {\n this._height = this.__height = height;\n this.model().height(height);\n this.initialize();\n if (this._strict) this._autopad = 1;\n }\n return this;\n};\n\nprototype.background = function(bgcolor) {\n if (!arguments.length) return this._bgcolor;\n if (this._bgcolor !== bgcolor) {\n this._bgcolor = bgcolor;\n this.initialize();\n }\n return this;\n};\n\nprototype.padding = function(pad) {\n if (!arguments.length) return this._padding;\n if (this._padding !== pad) {\n if (dl.isString(pad)) {\n this._autopad = 1;\n this._padding = {top:0, left:0, bottom:0, right:0};\n this._strict = (pad === 'strict');\n } else {\n this._autopad = 0;\n this._padding = pad;\n this._strict = false;\n }\n if (this._renderer) this._renderer.resize(this._width, this._height, pad);\n if (this._handler) this._handler.padding(pad);\n }\n return (this._repaint = true, this);\n};\n\nprototype.autopad = function(opt) {\n if (this._autopad < 1) return this;\n else this._autopad = 0;\n\n var b = this.model().scene().bounds,\n pad = this._padding,\n config = this.model().config(),\n inset = config.autopadInset,\n l = b.x1 < 0 ? Math.ceil(-b.x1) + inset : 0,\n t = b.y1 < 0 ? Math.ceil(-b.y1) + inset : 0,\n r = b.x2 > this._width ? Math.ceil(+b.x2 - this._width) + inset : 0;\n b = b.y2 > this._height ? Math.ceil(+b.y2 - this._height) + inset : 0;\n pad = {left:l, top:t, right:r, bottom:b};\n\n if (this._strict) {\n this._autopad = 0;\n this._padding = pad;\n this._width = Math.max(0, this.__width - (l+r));\n this._height = Math.max(0, this.__height - (t+b));\n\n this._model.width(this._width)\n .height(this._height).reset();\n\n this.initialize()\n .update({props:'enter'}).update({props:'update'});\n } else {\n this.padding(pad).update(opt);\n }\n return this;\n};\n\nprototype.viewport = function(size) {\n if (!arguments.length) return this._viewport;\n if (this._viewport !== size) {\n this._viewport = size;\n this.initialize();\n }\n return this;\n};\n\nprototype.renderer = function(type) {\n if (!arguments.length) return this._renderer;\n if (this._renderers[type]) type = this._renderers[type];\n else if (dl.isString(type)) throw new Error('Unknown renderer: ' + type);\n else if (!type) throw new Error('No renderer specified');\n\n if (this._io !== type) {\n this._io = type;\n this._renderer = null;\n this.initialize();\n if (this._build) this.render();\n }\n return this;\n};\n\nprototype.initialize = function(el) {\n var v = this, prevHandler,\n w = v._width, h = v._height, pad = v._padding, bg = v._bgcolor,\n config = this.model().config();\n\n if (!arguments.length || el === null) {\n el = this._el ? this._el.parentNode : null;\n if (!el) return this; // This View cannot init w/o an\n }\n\n // clear pre-existing container\n d3.select(el).select('div.vega').remove();\n \n // add div container\n this._el = el = d3.select(el)\n .append('div')\n .attr('class', 'vega')\n .style('position', 'relative')\n .node();\n if (v._viewport) {\n d3.select(el)\n .style('width', (v._viewport[0] || w)+'px')\n .style('height', (v._viewport[1] || h)+'px')\n .style('overflow', 'auto');\n }\n\n // renderer\n sg.canvas.Renderer.RETINA = config.render.retina;\n v._renderer = (v._renderer || new this._io.Renderer(config.load))\n .initialize(el, w, h, pad)\n .background(bg);\n \n // input handler\n prevHandler = v._handler;\n v._handler = new this._io.Handler()\n .initialize(el, pad, v);\n\n if (prevHandler) {\n prevHandler.handlers().forEach(function(h) {\n v._handler.on(h.type, h.handler);\n });\n } else {\n // Register event listeners for signal stream definitions.\n v._detach = parseStreams(this);\n }\n \n return (this._repaint = true, this);\n};\n\nprototype.destroy = function() {\n if (this._detach) this._detach();\n};\n\nfunction build() {\n var v = this;\n v._renderNode = new df.Node(v._model)\n .router(true);\n\n v._renderNode.evaluate = function(input) {\n log.debug(input, ['rendering']);\n\n var s = v._model.scene(),\n h = v._handler;\n\n if (h && h.scene) h.scene(s);\n\n if (input.trans) {\n input.trans.start(function(items) { v._renderer.render(s, items); });\n } else if (v._repaint) {\n v._renderer.render(s);\n v._repaint = false;\n } else if (input.dirty.length) {\n v._renderer.render(s, input.dirty);\n }\n\n if (input.dirty.length) {\n input.dirty.forEach(function(i) { i._dirty = false; });\n s.items[0]._dirty = false;\n }\n\n // For all updated datasources, clear their previous values.\n for (var d in input.data) { v._model.data(d).synchronize(); }\n return input;\n };\n\n return (v._model.scene(v._renderNode), true); \n}\n\nprototype.update = function(opt) {\n opt = opt || {};\n var v = this,\n trans = opt.duration ? new Transition(opt.duration, opt.ease) : null;\n\n var cs = v._changeset;\n if (trans) cs.trans = trans;\n if (opt.props !== undefined) {\n if (dl.keys(cs.data).length > 0) {\n throw Error(\n 'New data values are not reflected in the visualization.' +\n ' Please call view.update() before updating a specified property set.'\n );\n }\n\n cs.reflow = true;\n cs.request = opt.props;\n }\n\n var built = v._build;\n v._build = v._build || build.call(this);\n\n // If specific items are specified, short-circuit dataflow graph.\n // Else-If there are streaming updates, perform a targeted propagation.\n // Otherwise, reevaluate the entire model (datasources + scene).\n if (opt.items && built) { \n Encoder.update(this._model, opt.trans, opt.props, opt.items, cs.dirty);\n v._renderNode.evaluate(cs);\n } else if (v._streamer.listeners().length && built) {\n v._model.propagate(cs, v._streamer);\n v._streamer.disconnect();\n } else {\n v._model.fire(cs);\n }\n\n v._changeset = df.ChangeSet.create();\n\n return v.autopad(opt);\n};\n\nprototype.toImageURL = function(type) {\n var v = this, Renderer;\n\n // lookup appropriate renderer\n switch (type || 'png') {\n case 'canvas':\n case 'png':\n Renderer = sg.canvas.Renderer; break;\n case 'svg':\n Renderer = sg.svg.string.Renderer; break;\n default: throw Error('Unrecognized renderer type: ' + type);\n }\n\n var retina = sg.canvas.Renderer.RETINA;\n sg.canvas.Renderer.RETINA = false; // ignore retina screen\n\n // render the scenegraph\n var ren = new Renderer(v._model.config.load)\n .initialize(null, v._width, v._height, v._padding)\n .render(v._model.scene());\n\n sg.canvas.Renderer.RETINA = retina; // restore retina settings\n\n // return data url\n if (type === 'svg') {\n var blob = new Blob([ren.svg()], {type: 'image/svg+xml'});\n return window.URL.createObjectURL(blob);\n } else {\n return ren.canvas().toDataURL('image/png');\n }\n};\n\nprototype.render = function(items) {\n this._renderer.render(this._model.scene(), items);\n return this;\n};\n\nprototype.on = function() {\n this._handler.on.apply(this._handler, arguments);\n return this;\n};\n\nprototype.onSignal = function(name, handler) {\n this._model.signal(name).on(handler);\n return this;\n};\n\nprototype.off = function() {\n this._handler.off.apply(this._handler, arguments);\n return this;\n};\n\nprototype.offSignal = function(name, handler) {\n this._model.signal(name).off(handler);\n return this;\n};\n\nView.factory = function(model) {\n var HeadlessView = require('./HeadlessView');\n return function(opt) {\n opt = opt || {};\n var defs = model.defs();\n var v = (opt.el ? new View() : new HeadlessView())\n .model(model)\n .renderer(opt.renderer || 'canvas')\n .width(defs.width)\n .height(defs.height)\n .background(defs.background)\n .padding(defs.padding)\n .viewport(defs.viewport)\n .initialize(opt.el);\n\n if (opt.data) v.data(opt.data);\n\n if (opt.hover !== false && opt.el) {\n v.on('mouseover', function(evt, item) {\n if (item && item.hasPropertySet('hover')) {\n this.update({props:'hover', items:item});\n }\n })\n .on('mouseout', function(evt, item) {\n if (item && item.hasPropertySet('hover')) {\n this.update({props:'update', items:item});\n }\n });\n }\n \n return v;\n }; \n};\n\nmodule.exports = View;", + "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n df = require('vega-dataflow'),\n sg = require('vega-scenegraph').render,\n log = require('vega-logging'),\n Deps = df.Dependencies,\n parseStreams = require('../parse/streams'),\n Encoder = require('../scene/Encoder'),\n Transition = require('../scene/Transition');\n\nfunction View(el, width, height) {\n this._el = null;\n this._model = null;\n this._width = this.__width = width || 500;\n this._height = this.__height = height || 300;\n this._bgcolor = null;\n this._autopad = 1;\n this._padding = {top:0, left:0, bottom:0, right:0};\n this._viewport = null;\n this._renderer = null;\n this._handler = null;\n this._streamer = null; // Targeted update for streaming changes\n this._changeset = null;\n this._repaint = true; // Full re-render on every re-init\n this._renderers = sg;\n this._io = null;\n this._api = {}; // Stash streaming data API sandboxes.\n}\n\nvar prototype = View.prototype;\n\nprototype.model = function(model) {\n if (!arguments.length) return this._model;\n if (this._model !== model) {\n this._model = model;\n this._streamer = new df.Node(model);\n this._streamer._rank = -1; // HACK: To reduce re-ranking churn.\n this._changeset = df.ChangeSet.create();\n if (this._handler) this._handler.model(model);\n }\n return this;\n};\n\n// Sandboxed streaming data API\nfunction streaming(src) {\n var view = this,\n ds = this._model.data(src),\n name = ds.name(),\n listener = ds.pipeline()[0],\n streamer = this._streamer,\n api = {};\n\n // If we have it stashed, don't create a new closure. \n if (this._api[src]) return this._api[src];\n\n api.insert = function(vals) {\n ds.insert(dl.duplicate(vals)); // Don't pollute the environment\n streamer.addListener(listener);\n view._changeset.data[name] = 1;\n return api;\n };\n\n api.update = function() {\n streamer.addListener(listener);\n view._changeset.data[name] = 1;\n return (ds.update.apply(ds, arguments), api);\n };\n\n api.remove = function() {\n streamer.addListener(listener);\n view._changeset.data[name] = 1;\n return (ds.remove.apply(ds, arguments), api);\n };\n\n api.values = function() { return ds.values(); }; \n\n return (this._api[src] = api);\n}\n\nprototype.data = function(data) {\n var v = this;\n if (!arguments.length) return v._model.values();\n else if (dl.isString(data)) return streaming.call(v, data);\n else if (dl.isObject(data)) {\n dl.keys(data).forEach(function(k) {\n var api = streaming.call(v, k);\n data[k](api);\n });\n }\n return this;\n};\n\nprototype.signal = function(name, value, propagate) {\n var m = this._model,\n cs = this._changeset,\n streamer = this._streamer,\n batch;\n\n // Getter. Returns the value for the specified signal, or\n // returns all signal values.\n if (!arguments.length) {\n return m.values(Deps.SIGNALS);\n } else if (arguments.length === 1 && dl.isString(name)) {\n return m.values(Deps.SIGNALS, name);\n }\n\n // Setter. Can be done in batch or individually. In either case,\n // the final argument determines if set values should propagate.\n if (dl.isObject(name)) {\n batch = name;\n propagate = value;\n } else {\n batch = {};\n batch[name] = value;\n }\n\n dl.keys(batch).forEach(function(k) {\n streamer.addListener(m.signal(k).value(batch[k]));\n if (propagate !== false) cs.signals[k] = 1;\n cs.reflow = true;\n });\n\n return this;\n};\n\nprototype.width = function(width) {\n if (!arguments.length) return this.__width;\n if (this.__width !== width) {\n this._width = this.__width = width;\n this.model().width(width);\n this.initialize();\n if (this._strict) this._autopad = 1;\n }\n return this;\n};\n\nprototype.height = function(height) {\n if (!arguments.length) return this.__height;\n if (this.__height !== height) {\n this._height = this.__height = height;\n this.model().height(height);\n this.initialize();\n if (this._strict) this._autopad = 1;\n }\n return this;\n};\n\nprototype.background = function(bgcolor) {\n if (!arguments.length) return this._bgcolor;\n if (this._bgcolor !== bgcolor) {\n this._bgcolor = bgcolor;\n this.initialize();\n }\n return this;\n};\n\nprototype.padding = function(pad) {\n if (!arguments.length) return this._padding;\n if (this._padding !== pad) {\n if (dl.isString(pad)) {\n this._autopad = 1;\n this._padding = {top:0, left:0, bottom:0, right:0};\n this._strict = (pad === 'strict');\n } else {\n this._autopad = 0;\n this._padding = pad;\n this._strict = false;\n }\n if (this._renderer) this._renderer.resize(this._width, this._height, pad);\n if (this._handler) this._handler.padding(pad);\n }\n return (this._repaint = true, this);\n};\n\nprototype.autopad = function(opt) {\n if (this._autopad < 1) return this;\n else this._autopad = 0;\n\n var b = this.model().scene().bounds,\n pad = this._padding,\n config = this.model().config(),\n inset = config.autopadInset,\n l = b.x1 < 0 ? Math.ceil(-b.x1) + inset : 0,\n t = b.y1 < 0 ? Math.ceil(-b.y1) + inset : 0,\n r = b.x2 > this._width ? Math.ceil(+b.x2 - this._width) + inset : 0;\n b = b.y2 > this._height ? Math.ceil(+b.y2 - this._height) + inset : 0;\n pad = {left:l, top:t, right:r, bottom:b};\n\n if (this._strict) {\n this._autopad = 0;\n this._padding = pad;\n this._width = Math.max(0, this.__width - (l+r));\n this._height = Math.max(0, this.__height - (t+b));\n\n this._model.width(this._width)\n .height(this._height).reset();\n\n this.initialize()\n .update({props:'enter'}).update({props:'update'});\n } else {\n this.padding(pad).update(opt);\n }\n return this;\n};\n\nprototype.viewport = function(size) {\n if (!arguments.length) return this._viewport;\n if (this._viewport !== size) {\n this._viewport = size;\n this.initialize();\n }\n return this;\n};\n\nprototype.renderer = function(type) {\n if (!arguments.length) return this._renderer;\n if (this._renderers[type]) type = this._renderers[type];\n else if (dl.isString(type)) throw new Error('Unknown renderer: ' + type);\n else if (!type) throw new Error('No renderer specified');\n\n if (this._io !== type) {\n this._io = type;\n this._renderer = null;\n this.initialize();\n if (this._build) this.render();\n }\n return this;\n};\n\nprototype.initialize = function(el) {\n var v = this, prevHandler,\n w = v._width, h = v._height, pad = v._padding, bg = v._bgcolor,\n config = this.model().config();\n\n if (!arguments.length || el === null) {\n el = this._el ? this._el.parentNode : null;\n if (!el) return this; // This View cannot init w/o an\n }\n\n // clear pre-existing container\n d3.select(el).select('div.vega').remove();\n \n // add div container\n this._el = el = d3.select(el)\n .append('div')\n .attr('class', 'vega')\n .style('position', 'relative')\n .node();\n if (v._viewport) {\n d3.select(el)\n .style('width', (v._viewport[0] || w)+'px')\n .style('height', (v._viewport[1] || h)+'px')\n .style('overflow', 'auto');\n }\n\n // renderer\n sg.canvas.Renderer.RETINA = config.render.retina;\n v._renderer = (v._renderer || new this._io.Renderer(config.load))\n .initialize(el, w, h, pad)\n .background(bg);\n \n // input handler\n prevHandler = v._handler;\n v._handler = new this._io.Handler()\n .initialize(el, pad, v);\n\n if (prevHandler) {\n prevHandler.handlers().forEach(function(h) {\n v._handler.on(h.type, h.handler);\n });\n } else {\n // Register event listeners for signal stream definitions.\n v._detach = parseStreams(this);\n }\n \n return (this._repaint = true, this);\n};\n\nprototype.destroy = function() {\n if (this._detach) this._detach();\n};\n\nfunction build() {\n var v = this;\n v._renderNode = new df.Node(v._model)\n .router(true);\n\n v._renderNode.evaluate = function(input) {\n log.debug(input, ['rendering']);\n\n var s = v._model.scene(),\n h = v._handler;\n\n if (h && h.scene) h.scene(s);\n\n if (input.trans) {\n input.trans.start(function(items) { v._renderer.render(s, items); });\n } else if (v._repaint) {\n v._renderer.render(s);\n v._repaint = false;\n } else if (input.dirty.length) {\n v._renderer.render(s, input.dirty);\n }\n\n if (input.dirty.length) {\n input.dirty.forEach(function(i) { i._dirty = false; });\n s.items[0]._dirty = false;\n }\n\n // For all updated datasources, clear their previous values.\n for (var d in input.data) { v._model.data(d).synchronize(); }\n return input;\n };\n\n return (v._model.scene(v._renderNode), true); \n}\n\nprototype.update = function(opt) {\n opt = opt || {};\n var v = this,\n trans = opt.duration ? new Transition(opt.duration, opt.ease) : null;\n\n var cs = v._changeset;\n if (trans) cs.trans = trans;\n if (opt.props !== undefined) {\n if (dl.keys(cs.data).length > 0) {\n throw Error(\n 'New data values are not reflected in the visualization.' +\n ' Please call view.update() before updating a specified property set.'\n );\n }\n\n cs.reflow = true;\n cs.request = opt.props;\n }\n\n var built = v._build;\n v._build = v._build || build.call(this);\n\n // If specific items are specified, short-circuit dataflow graph.\n // Else-If there are streaming updates, perform a targeted propagation.\n // Otherwise, reevaluate the entire model (datasources + scene).\n if (opt.items && built) { \n Encoder.update(this._model, opt.trans, opt.props, opt.items, cs.dirty);\n v._renderNode.evaluate(cs);\n } else if (v._streamer.listeners().length && built) {\n v._model.propagate(cs, v._streamer);\n v._streamer.disconnect();\n } else {\n v._model.fire(cs);\n }\n\n v._changeset = df.ChangeSet.create();\n\n return v.autopad(opt);\n};\n\nprototype.toImageURL = function(type) {\n var v = this, Renderer;\n\n // lookup appropriate renderer\n switch (type || 'png') {\n case 'canvas':\n case 'png':\n Renderer = sg.canvas.Renderer; break;\n case 'svg':\n Renderer = sg.svg.string.Renderer; break;\n default: throw Error('Unrecognized renderer type: ' + type);\n }\n\n var retina = sg.canvas.Renderer.RETINA;\n sg.canvas.Renderer.RETINA = false; // ignore retina screen\n\n // render the scenegraph\n var ren = new Renderer(v._model.config.load)\n .initialize(null, v._width, v._height, v._padding)\n .render(v._model.scene());\n\n sg.canvas.Renderer.RETINA = retina; // restore retina settings\n\n // return data url\n if (type === 'svg') {\n var blob = new Blob([ren.svg()], {type: 'image/svg+xml'});\n return window.URL.createObjectURL(blob);\n } else {\n return ren.canvas().toDataURL('image/png');\n }\n};\n\nprototype.render = function(items) {\n this._renderer.render(this._model.scene(), items);\n return this;\n};\n\nprototype.on = function() {\n this._handler.on.apply(this._handler, arguments);\n return this;\n};\n\nprototype.onSignal = function(name, handler) {\n this._model.signal(name).on(handler);\n return this;\n};\n\nprototype.off = function() {\n this._handler.off.apply(this._handler, arguments);\n return this;\n};\n\nprototype.offSignal = function(name, handler) {\n this._model.signal(name).off(handler);\n return this;\n};\n\nView.factory = function(model) {\n var HeadlessView = require('./HeadlessView');\n return function(opt) {\n opt = opt || {};\n var defs = model.defs();\n var v = (opt.el ? new View() : new HeadlessView())\n .model(model)\n .renderer(opt.renderer || 'canvas')\n .width(defs.width)\n .height(defs.height)\n .background(defs.background)\n .padding(defs.padding)\n .viewport(defs.viewport)\n .initialize(opt.el);\n\n if (opt.data) v.data(opt.data);\n\n if (opt.hover !== false && opt.el) {\n v.on('mouseover', function(evt, item) {\n if (item && item.hasPropertySet('hover')) {\n this.update({props:'hover', items:item});\n }\n })\n .on('mouseout', function(evt, item) {\n if (item && item.hasPropertySet('hover')) {\n this.update({props:'update', items:item});\n }\n });\n }\n \n return v;\n }; \n};\n\nmodule.exports = View;", "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n config = {};\n\nconfig.load = {\n // base url for loading external data files\n // used only for server-side operation\n baseURL: '',\n // Allows domain restriction when using data loading via XHR.\n // To enable, set it to a list of allowed domains\n // e.g., ['wikipedia.org', 'eff.org']\n domainWhiteList: false\n};\n\n// inset padding for automatic padding calculation\nconfig.autopadInset = 5;\n\n// extensible scale lookup table\n// all d3.scale.* instances also supported\nconfig.scale = {\n time: d3.time.scale,\n utc: d3.time.scale.utc\n};\n\n// default rendering settings\nconfig.render = {\n retina: true\n};\n\n// default axis properties\nconfig.axis = {\n orient: 'bottom',\n ticks: 10,\n padding: 3,\n axisColor: '#000',\n gridColor: '#000',\n gridOpacity: 0.15,\n tickColor: '#000',\n tickLabelColor: '#000',\n axisWidth: 1,\n tickWidth: 1,\n tickSize: 6,\n tickLabelFontSize: 11,\n tickLabelFont: 'sans-serif',\n titleColor: '#000',\n titleFont: 'sans-serif',\n titleFontSize: 11,\n titleFontWeight: 'bold',\n titleOffset: 35\n};\n\n// default legend properties\nconfig.legend = {\n orient: 'right',\n offset: 20,\n padding: 3,\n gradientStrokeColor: '#888',\n gradientStrokeWidth: 1,\n gradientHeight: 16,\n gradientWidth: 100,\n labelColor: '#000',\n labelFontSize: 10,\n labelFont: 'sans-serif',\n labelAlign: 'left',\n labelBaseline: 'middle',\n labelOffset: 8,\n symbolShape: 'circle',\n symbolSize: 50,\n symbolColor: '#888',\n symbolStrokeWidth: 1,\n titleColor: '#000',\n titleFont: 'sans-serif',\n titleFontSize: 11,\n titleFontWeight: 'bold'\n};\n\n// default color values\nconfig.color = {\n rgb: [128, 128, 128],\n lab: [50, 0, 0],\n hcl: [0, 0, 50],\n hsl: [0, 0, 0.5]\n};\n\n// default scale ranges\nconfig.range = {\n category10: d3.scale.category10().range(),\n category20: d3.scale.category20().range(),\n category20b: d3.scale.category20b().range(),\n category20c: d3.scale.category20c().range(),\n shapes: [\n 'circle',\n 'cross',\n 'diamond',\n 'square',\n 'triangle-down',\n 'triangle-up'\n ]\n};\n\nmodule.exports = config;", "var dl = require('datalib'),\n parse = require('../parse'),\n Scale = require('../scene/Scale'),\n config = require('./config');\n\nfunction compile(module, opt, schema) {\n var s = module.schema;\n if (!s) return;\n if (s.refs) dl.extend(schema.refs, s.refs);\n if (s.defs) dl.extend(schema.defs, s.defs);\n}\n\nmodule.exports = function(opt) {\n var schema = null;\n opt = opt || {};\n\n // Compile if we're not loading the schema from a URL. \n // Load from a URL to extend the existing base schema.\n if (opt.url) {\n schema = dl.json(dl.extend({url: opt.url}, config.load));\n } else {\n schema = {\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"title\": \"Vega Visualization Specification Language\",\n \"defs\": {}, \n \"refs\": {}, \n \"$ref\": \"#/defs/spec\"\n };\n\n dl.keys(parse).forEach(function(k) { compile(parse[k], opt, schema); });\n\n // Scales aren't in the parser, add schema manually\n compile(Scale, opt, schema);\n }\n\n // Extend schema to support custom mark properties or property sets.\n if (opt.properties) dl.keys(opt.properties).forEach(function(k) {\n schema.defs.propset.properties[k] = {\"$ref\": \"#/refs/\"+opt.properties[k]+\"Value\"};\n });\n\n if (opt.propertySets) dl.keys(opt.propertySets).forEach(function(k) {\n schema.defs.mark.properties.properties.properties[k] = {\"$ref\": \"#/defs/propset\"};\n });\n\n return schema;\n};", "var dl = require('datalib'),\n axs = require('../scene/axis');\n\nvar ORIENT = {\n \"x\": \"bottom\",\n \"y\": \"left\",\n \"top\": \"top\",\n \"bottom\": \"bottom\",\n \"left\": \"left\",\n \"right\": \"right\"\n};\n\nfunction parseAxes(model, spec, axes, group) {\n var config = model.config();\n (spec || []).forEach(function(def, index) {\n axes[index] = axes[index] || axs(model);\n parseAxis(config, def, index, axes[index], group);\n });\n}\n\nfunction parseAxis(config, def, index, axis, group) {\n // axis scale\n if (def.scale !== undefined) {\n axis.scale(group.scale(def.scale));\n }\n\n // axis orientation\n axis.orient(def.orient || ORIENT[def.type]);\n // axis offset\n axis.offset(def.offset || 0);\n // axis layer\n axis.layer(def.layer || \"front\");\n // axis grid lines\n axis.grid(def.grid || false);\n // axis title\n axis.title(def.title || null);\n // axis title offset\n axis.titleOffset(def.titleOffset != null ?\n def.titleOffset : config.axis.titleOffset);\n // axis values\n axis.tickValues(def.values || null);\n // axis label formatting\n axis.tickFormat(def.format || null);\n axis.tickFormatType(def.formatType || null);\n // axis tick subdivision\n axis.tickSubdivide(def.subdivide || 0);\n // axis tick padding\n axis.tickPadding(def.tickPadding || config.axis.padding);\n\n // axis tick size(s)\n var size = [];\n if (def.tickSize !== undefined) {\n for (var i=0; i<3; ++i) size.push(def.tickSize);\n } else {\n var ts = config.axis.tickSize;\n size = [ts, ts, ts];\n }\n if (def.tickSizeMajor != null) size[0] = def.tickSizeMajor;\n if (def.tickSizeMinor != null) size[1] = def.tickSizeMinor;\n if (def.tickSizeEnd != null) size[2] = def.tickSizeEnd;\n if (size.length) {\n axis.tickSize.apply(axis, size);\n }\n\n // axis tick count\n axis.tickCount(def.ticks || config.axis.ticks);\n\n // style properties\n var p = def.properties;\n if (p && p.ticks) {\n axis.majorTickProperties(p.majorTicks ?\n dl.extend({}, p.ticks, p.majorTicks) : p.ticks);\n axis.minorTickProperties(p.minorTicks ?\n dl.extend({}, p.ticks, p.minorTicks) : p.ticks);\n } else {\n axis.majorTickProperties(p && p.majorTicks || {});\n axis.minorTickProperties(p && p.minorTicks || {});\n }\n axis.tickLabelProperties(p && p.labels || {});\n axis.titleProperties(p && p.title || {});\n axis.gridLineProperties(p && p.grid || {});\n axis.domainProperties(p && p.axis || {});\n}\n\nmodule.exports = parseAxes;", @@ -249,23 +254,23 @@ "var dl = require('datalib'),\n log = require('vega-logging'),\n df = require('vega-dataflow'),\n Node = df.Node, // jshint ignore:line\n Tuple = df.Tuple,\n Deps = df.Dependencies;\n\nvar Types = {\n INSERT: \"insert\",\n REMOVE: \"remove\",\n TOGGLE: \"toggle\",\n CLEAR: \"clear\"\n};\n\nvar EMPTY = [];\n\nvar filter = function(field, value, src, dest) {\n for(var i = src.length-1; i >= 0; --i) {\n if (src[i][field] == value)\n dest.push.apply(dest, src.splice(i, 1));\n }\n};\n\nfunction parseModify(model, def, ds) {\n var signal = def.signal ? dl.field(def.signal) : null, \n signalName = signal ? signal[0] : null,\n predicate = def.predicate ? model.predicate(def.predicate.name || def.predicate) : null,\n reeval = (predicate === null),\n node = new Node(model).router(def.type === Types.CLEAR);\n\n node.evaluate = function(input) {\n if (predicate !== null) { // TODO: predicate args\n var db = model.values(Deps.DATA, predicate.data || EMPTY),\n sg = model.values(Deps.SIGNALS, predicate.signals || EMPTY);\n reeval = predicate.call(predicate, {}, db, sg, model._predicates);\n }\n\n log.debug(input, [def.type+\"ing\", reeval]);\n if (!reeval) return input;\n\n var datum = {}, \n value = signal ? model.signalRef(def.signal) : null,\n d = model.data(ds.name),\n t = null;\n\n datum[def.field] = value;\n\n // We have to modify ds._data so that subsequent pulses contain\n // our dynamic data. W/o modifying ds._data, only the output\n // collector will contain dynamic tuples. \n if (def.type === Types.INSERT) {\n t = Tuple.ingest(datum);\n input.add.push(t);\n d._data.push(t);\n } else if (def.type === Types.REMOVE) {\n filter(def.field, value, input.add, input.rem);\n filter(def.field, value, input.mod, input.rem);\n d._data = d._data.filter(function(x) { return x[def.field] !== value; });\n } else if (def.type === Types.TOGGLE) {\n var add = [], rem = [];\n filter(def.field, value, input.rem, add);\n filter(def.field, value, input.add, rem);\n filter(def.field, value, input.mod, rem);\n if (!(add.length || rem.length)) add.push(Tuple.ingest(datum));\n\n input.add.push.apply(input.add, add);\n d._data.push.apply(d._data, add);\n input.rem.push.apply(input.rem, rem);\n d._data = d._data.filter(function(x) { return rem.indexOf(x) === -1; });\n } else if (def.type === Types.CLEAR) {\n input.rem.push.apply(input.rem, input.add);\n input.rem.push.apply(input.rem, input.mod);\n input.add = [];\n input.mod = [];\n d._data = [];\n } \n\n input.fields[def.field] = 1;\n return input;\n };\n\n if (signalName) node.dependency(Deps.SIGNALS, signalName);\n \n if (predicate) {\n node.dependency(Deps.DATA, predicate.data);\n node.dependency(Deps.SIGNALS, predicate.signals);\n }\n \n return node;\n}\n\nmodule.exports = parseModify;", "var dl = require('datalib');\n\nfunction parsePadding(pad) {\n if (pad == null) return \"auto\";\n else if (dl.isString(pad)) return pad===\"strict\" ? \"strict\" : \"auto\";\n else if (dl.isObject(pad)) return pad;\n var p = dl.isNumber(pad) ? pad : 20;\n return {top:p, left:p, right:p, bottom:p};\n}\n\nmodule.exports = parsePadding;", "var dl = require('datalib');\n\nvar types = {\n '=': parseComparator,\n '==': parseComparator,\n '!=': parseComparator,\n '>': parseComparator,\n '>=': parseComparator,\n '<': parseComparator,\n '<=': parseComparator,\n 'and': parseLogical,\n '&&': parseLogical,\n 'or': parseLogical,\n '||': parseLogical,\n 'in': parseIn\n};\n\nvar nullScale = function() { return 0; };\nnullScale.invert = nullScale;\n\nfunction parsePredicates(model, spec) {\n (spec || []).forEach(function(s) {\n var parse = types[s.type](model, s);\n \n /* jshint evil:true */\n var pred = Function(\"args\", \"db\", \"signals\", \"predicates\", parse.code);\n pred.root = function() { return model.scene().items[0]; }; // For global scales\n pred.nullScale = nullScale;\n pred.isFunction = dl.isFunction;\n pred.signals = parse.signals;\n pred.data = parse.data;\n\n model.predicate(s.name, pred);\n });\n\n return spec;\n}\n\nfunction parseSignal(signal, signals) {\n var s = dl.field(signal),\n code = \"signals[\"+s.map(dl.str).join(\"][\")+\"]\";\n signals[s[0]] = 1;\n return code;\n}\n\nfunction parseOperands(model, operands) {\n var decl = [], defs = [],\n signals = {}, db = {};\n\n function setSignal(s) { signals[s] = 1; }\n function setData(d) { db[d] = 1; }\n\n dl.array(operands).forEach(function(o, i) {\n var name = \"o\" + i,\n def = \"\";\n\n if (o.value !== undefined) {\n def = dl.str(o.value);\n } else if (o.arg) {\n def = \"args[\"+dl.str(o.arg)+\"]\";\n } else if (o.signal) {\n def = parseSignal(o.signal, signals);\n } else if (o.predicate) {\n var ref = o.predicate,\n predName = ref && (ref.name || ref),\n pred = model.predicate(predName),\n p = \"predicates[\"+dl.str(predName)+\"]\";\n\n pred.signals.forEach(setSignal);\n pred.data.forEach(setData);\n\n if (dl.isObject(ref)) {\n dl.keys(ref).forEach(function(k) {\n if (k === \"name\") return;\n var i = ref[k];\n def += \"args[\"+dl.str(k)+\"] = \";\n if (i.signal) {\n def += parseSignal(i.signal, signals);\n } else if (i.arg) {\n def += \"args[\"+dl.str(i.arg)+\"]\";\n }\n def += \", \";\n }); \n } \n\n def += p+\".call(\"+p+\", args, db, signals, predicates)\";\n }\n\n decl.push(name);\n defs.push(name+\"=(\"+def+\")\");\n });\n\n return {\n code: \"var \" + decl.join(\", \") + \";\\n\" + defs.join(\";\\n\") + \";\\n\",\n signals: dl.keys(signals),\n data: dl.keys(db)\n };\n}\n\nfunction parseComparator(model, spec) {\n var ops = parseOperands(model, spec.operands);\n if (spec.type === '=') spec.type = '==';\n\n ops.code += \"o0 = o0 instanceof Date ? o0.getTime() : o0;\\n\" +\n \"o1 = o1 instanceof Date ? o1.getTime() : o1;\\n\";\n\n return {\n code: ops.code + \"return \" + [\"o0\", \"o1\"].join(spec.type) + \";\",\n signals: ops.signals,\n data: ops.data\n };\n}\n\nfunction parseLogical(model, spec) {\n var ops = parseOperands(model, spec.operands),\n o = [], i = 0, len = spec.operands.length;\n\n while (o.push(\"o\"+i++) < len);\n if (spec.type === 'and') spec.type = '&&';\n else if (spec.type === 'or') spec.type = '||';\n\n return {\n code: ops.code + \"return \" + o.join(spec.type) + \";\",\n signals: ops.signals,\n data: ops.data\n };\n}\n\nfunction parseIn(model, spec) {\n var o = [spec.item], code = \"\";\n if (spec.range) o.push.apply(o, spec.range);\n if (spec.scale) {\n code = parseScale(spec.scale, o);\n }\n\n var ops = parseOperands(model, o);\n code = ops.code + code + \"\\n var ordSet = null;\\n\";\n\n if (spec.data) {\n var field = dl.field(spec.field).map(dl.str);\n code += \"var where = function(d) { return d[\"+field.join(\"][\")+\"] == o0 };\\n\";\n code += \"return db[\"+dl.str(spec.data)+\"].filter(where).length > 0;\";\n } else if (spec.range) {\n // TODO: inclusive/exclusive range?\n if (spec.scale) {\n code += \"if (scale.length == 2) {\\n\" + // inverting ordinal scales\n \" ordSet = scale(o1, o2);\\n\" +\n \"} else {\\n\" +\n \" o1 = scale(o1);\\no2 = scale(o2);\\n\" +\n \"}\";\n }\n\n code += \"return ordSet !== null ? ordSet.indexOf(o0) !== -1 :\\n\" + \n \" o1 < o2 ? o1 <= o0 && o0 <= o2 : o2 <= o0 && o0 <= o1;\";\n }\n\n return {\n code: code, \n signals: ops.signals, \n data: ops.data.concat(spec.data ? [spec.data] : [])\n };\n}\n\n// Populate ops such that ultimate scale/inversion function will be in `scale` var. \nfunction parseScale(spec, ops) {\n var code = \"var scale = \", \n idx = ops.length;\n\n if (dl.isString(spec)) {\n ops.push({ value: spec });\n code += \"this.root().scale(o\"+idx+\")\";\n } else if (spec.arg) { // Scale function is being passed as an arg\n ops.push(spec);\n code += \"o\"+idx;\n } else if (spec.name) { // Full scale parameter {name: ..}\n ops.push(dl.isString(spec.name) ? {value: spec.name} : spec.name);\n code += \"(this.isFunction(o\"+idx+\") ? o\"+idx+\" : \";\n if (spec.scope) {\n ops.push(spec.scope);\n code += \"((o\"+(idx+1)+\".scale || this.root().scale)(o\"+idx+\") || this.nullScale)\";\n } else {\n code += \"this.root().scale(o\"+idx+\")\";\n }\n code += \")\";\n }\n\n if (spec.invert === true) { // Allow spec.invert.arg?\n code += \".invert\";\n }\n\n return code+\";\\n\";\n}\n\nmodule.exports = parsePredicates;", - "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n log = require('vega-logging'),\n Tuple = require('vega-dataflow').Tuple;\n\nvar DEPS = [\"signals\", \"scales\", \"data\", \"fields\"];\n\nfunction properties(model, mark, spec) {\n var config = model.config(),\n code = \"\",\n names = dl.keys(spec),\n i, len, name, ref, vars = {}, \n deps = {\n signals: {},\n scales: {},\n data: {},\n fields: {},\n nested: [],\n _nRefs: {}, // Temp stash to de-dupe nested refs.\n reflow: false\n };\n \n code += \"var o = trans ? {} : item, d=0, set=this.tpl.set, tmpl=signals||{}, t;\\n\" +\n // Stash for dl.template\n \"tmpl.datum = item.datum;\\n\" + \n \"tmpl.group = group;\\n\" + \n \"tmpl.parent = group.datum;\\n\";\n\n function handleDep(p) {\n if (ref[p] == null) return;\n var k = dl.array(ref[p]), i, n;\n for (i=0, n=k.length; i 0) ? \"\\n \" : \" \";\n if (ref.rule) {\n ref = rule(model, name, ref.rule);\n code += \"\\n \" + ref.code;\n } else {\n ref = valueRef(config, name, ref);\n code += \"d += set(o, \"+dl.str(name)+\", \"+ref.val+\");\";\n }\n\n vars[name] = true;\n DEPS.forEach(handleDep);\n deps.reflow = deps.reflow || ref.reflow;\n if (ref.nested.length) ref.nested.forEach(handleNestedRefs);\n }\n\n // If nested references are present, sort them based on their level\n // to speed up determination of whether encoders should be reeval'd.\n dl.keys(deps._nRefs).forEach(function(k) { deps.nested.push(deps._nRefs[k]); });\n deps.nested.sort(function(a, b) { \n a = a.level;\n b = b.level;\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; \n });\n\n if (vars.x2) {\n if (vars.x) {\n code += \"\\n if (o.x > o.x2) { \" +\n \"\\n t = o.x;\" +\n \"\\n d += set(o, 'x', o.x2);\" +\n \"\\n d += set(o, 'x2', t); \" +\n \"\\n };\";\n code += \"\\n d += set(o, 'width', (o.x2 - o.x));\";\n } else if (vars.width) {\n code += \"\\n d += set(o, 'x', (o.x2 - o.width));\";\n } else {\n code += \"\\n d += set(o, 'x', o.x2);\";\n }\n }\n\n if (vars.xc) {\n if (vars.width) {\n code += \"\\n d += set(o, 'x', (o.xc - o.width/2));\" ;\n } else {\n code += \"\\n d += set(o, 'x', o.xc);\" ;\n }\n }\n\n if (vars.y2) {\n if (vars.y) {\n code += \"\\n if (o.y > o.y2) { \" +\n \"\\n t = o.y;\" +\n \"\\n d += set(o, 'y', o.y2);\" +\n \"\\n d += set(o, 'y2', t);\" +\n \"\\n };\";\n code += \"\\n d += set(o, 'height', (o.y2 - o.y));\";\n } else if (vars.height) {\n code += \"\\n d += set(o, 'y', (o.y2 - o.height));\";\n } else {\n code += \"\\n d += set(o, 'y', o.y2);\";\n }\n }\n\n if (vars.yc) {\n if (vars.height) {\n code += \"\\n d += set(o, 'y', (o.yc - o.height/2));\" ;\n } else {\n code += \"\\n d += set(o, 'y', o.yc);\" ;\n }\n }\n \n if (hasPath(mark, vars)) code += \"\\n d += (item.touch(), 1);\";\n code += \"\\n if (trans) trans.interpolate(item, o);\";\n code += \"\\n return d > 0;\";\n\n try {\n /* jshint evil:true */\n var encoder = Function('item', 'group', 'trans', 'db', \n 'signals', 'predicates', code);\n encoder.tpl = Tuple;\n encoder.util = dl;\n encoder.d3 = d3; // For color spaces\n dl.extend(encoder, dl.template.context);\n return {\n encode: encoder,\n signals: dl.keys(deps.signals),\n scales: dl.keys(deps.scales),\n data: dl.keys(deps.data),\n fields: dl.keys(deps.fields),\n nested: deps.nested,\n reflow: deps.reflow\n };\n } catch (e) {\n log.error(e);\n log.log(code);\n }\n}\n\nfunction dependencies(a, b) {\n if (!dl.isObject(a)) {\n a = {reflow: false, nested: []};\n DEPS.forEach(function(d) { a[d] = []; });\n }\n\n if (dl.isObject(b)) {\n a.reflow = a.reflow || b.reflow;\n a.nested.push.apply(a.nested, b.nested);\n DEPS.forEach(function(d) { a[d].push.apply(a[d], b[d]); });\n }\n\n return a;\n}\n\nfunction hasPath(mark, vars) {\n return vars.path ||\n ((mark==='area' || mark==='line') &&\n (vars.x || vars.x2 || vars.width ||\n vars.y || vars.y2 || vars.height ||\n vars.tension || vars.interpolate));\n}\n\nfunction rule(model, name, rules) {\n var config = model.config(),\n deps = dependencies(),\n inputs = [], code = '';\n\n (rules||[]).forEach(function(r, i) {\n var def = r.predicate,\n predName = def && (def.name || def),\n pred = model.predicate(predName),\n p = 'predicates['+dl.str(predName)+']',\n input = [], args = name+'_arg'+i,\n ref;\n\n if (dl.isObject(def)) {\n dl.keys(def).forEach(function(k) {\n if (k === 'name') return;\n var ref = valueRef(config, i, def[k]);\n input.push(dl.str(k)+': '+ref.val);\n dependencies(deps, ref);\n });\n }\n\n ref = valueRef(config, name, r);\n dependencies(deps, ref);\n\n if (predName) {\n deps.signals.push.apply(deps.signals, pred.signals);\n deps.data.push.apply(deps.data, pred.data);\n inputs.push(args+\" = {\\n \"+input.join(\",\\n \")+\"\\n }\");\n code += \"if (\"+p+\".call(\"+p+\",\"+args+\", db, signals, predicates)) {\" +\n \"\\n d += set(o, \"+dl.str(name)+\", \"+ref.val+\");\";\n code += rules[i+1] ? \"\\n } else \" : \" }\";\n } else {\n code += \"{\" + \n \"\\n d += set(o, \"+dl.str(name)+\", \"+ref.val+\");\"+\n \"\\n }\\n\";\n }\n });\n\n code = \"var \" + inputs.join(\",\\n \") + \";\\n \" + code;\n return (deps.code = code, deps);\n}\n\nfunction valueRef(config, name, ref) {\n if (ref == null) return null;\n\n if (name==='fill' || name==='stroke') {\n if (ref.c) {\n return colorRef(config, 'hcl', ref.h, ref.c, ref.l);\n } else if (ref.h || ref.s) {\n return colorRef(config, 'hsl', ref.h, ref.s, ref.l);\n } else if (ref.l || ref.a) {\n return colorRef(config, 'lab', ref.l, ref.a, ref.b);\n } else if (ref.r || ref.g || ref.b) {\n return colorRef(config, 'rgb', ref.r, ref.g, ref.b);\n }\n }\n\n // initialize value\n var val = null, scale = null, \n deps = dependencies(),\n sgRef = null, fRef = null, sRef = null, tmpl = {};\n\n if (ref.template !== undefined) {\n val = dl.template.source(ref.template, 'tmpl', tmpl);\n dl.keys(tmpl).forEach(function(k) {\n var f = dl.field(k),\n a = f.shift();\n if (a === 'parent' || a === 'group') {\n deps.nested.push({ \n parent: a === 'parent',\n group: a === 'group', \n level: 1\n });\n } else if (a === 'datum') {\n deps.fields.push(f[0]);\n } else {\n deps.signals.push(a);\n }\n });\n }\n\n if (ref.value !== undefined) {\n val = dl.str(ref.value);\n }\n\n if (ref.signal !== undefined) {\n sgRef = dl.field(ref.signal);\n val = 'signals['+sgRef.map(dl.str).join('][')+']'; \n deps.signals.push(sgRef.shift());\n }\n\n if (ref.field !== undefined) {\n ref.field = dl.isString(ref.field) ? {datum: ref.field} : ref.field;\n fRef = fieldRef(ref.field);\n val = fRef.val;\n dependencies(deps, fRef);\n }\n\n if (ref.scale !== undefined) {\n sRef = scaleRef(ref.scale);\n scale = sRef.val;\n dependencies(deps, sRef);\n deps.scales.push(ref.scale.name || ref.scale);\n\n // run through scale function if val specified.\n // if no val, scale function is predicate arg.\n if (val !== null || ref.band || ref.mult || ref.offset) {\n val = scale + (ref.band ? '.rangeBand()' : \n '('+(val !== null ? val : 'item.datum.data')+')');\n } else {\n val = scale;\n }\n }\n \n // multiply, offset, return value\n val = '(' + (ref.mult?(dl.number(ref.mult)+' * '):'') + val + ')' +\n (ref.offset ? ' + ' + dl.number(ref.offset) : '');\n\n // Collate dependencies\n return (deps.val = val, deps);\n}\n\nfunction colorRef(config, type, x, y, z) {\n var xx = x ? valueRef(config, '', x) : config.color[type][0],\n yy = y ? valueRef(config, '', y) : config.color[type][1],\n zz = z ? valueRef(config, '', z) : config.color[type][2],\n deps = dependencies();\n\n [xx, yy, zz].forEach(function(v) {\n if (dl.isArray) return;\n dependencies(deps, v);\n });\n\n var val = '(this.d3.' + type + '(' + [xx.val, yy.val, zz.val].join(',') + ') + \"\")';\n return (deps.val = val, deps);\n}\n\n// {field: {datum: \"foo\"} } -> item.datum.foo\n// {field: {group: \"foo\"} } -> group.foo\n// {field: {parent: \"foo\"} } -> group.datum.foo\nfunction fieldRef(ref) {\n if (dl.isString(ref)) {\n return {val: dl.field(ref).map(dl.str).join('][')};\n } \n\n // Resolve nesting/parent lookups\n var l = ref.level || 1,\n nested = (ref.group || ref.parent) && l,\n scope = nested ? Array(l).join('group.mark.') : '',\n r = fieldRef(ref.datum || ref.group || ref.parent || ref.signal),\n val = r.val,\n deps = dependencies(null, r);\n\n if (ref.datum) {\n val = 'item.datum['+val+']';\n deps.fields.push(ref.datum);\n } else if (ref.group) {\n val = scope+'group['+val+']';\n deps.nested.push({ level: l, group: true });\n } else if (ref.parent) {\n val = scope+'group.datum['+val+']';\n deps.nested.push({ level: l, parent: true });\n } else if (ref.signal) {\n val = 'signals['+val+']';\n deps.signals.push(dl.field(ref.signal)[0]);\n deps.reflow = true;\n }\n\n return (deps.val = val, deps);\n}\n\n// {scale: \"x\"}\n// {scale: {name: \"x\"}},\n// {scale: fieldRef}\nfunction scaleRef(ref) {\n var scale = null,\n fr = null,\n deps = dependencies();\n\n if (dl.isString(ref)) {\n scale = dl.str(ref);\n } else if (ref.name) {\n scale = dl.isString(ref.name) ? dl.str(ref.name) : (fr = fieldRef(ref.name)).val;\n } else {\n scale = (fr = fieldRef(ref)).val;\n }\n\n scale = '(item.mark._scaleRefs['+scale+'] = 1, group.scale('+scale+'))';\n if (ref.invert) scale += '.invert';\n\n // Mark scale refs as they're dealt with separately in mark._scaleRefs.\n if (fr) fr.nested.forEach(function(g) { g.scale = true; });\n return fr ? (fr.val = scale, fr) : (deps.val = scale, deps);\n}\n\nmodule.exports = properties;", - "var dl = require('datalib'),\n SIGNALS = require('vega-dataflow').Dependencies.SIGNALS,\n expr = require('./expr');\n\nvar RESERVED = ['datum', 'event', 'signals']\n .concat(dl.keys(expr.codegen.functions));\n\nfunction parseSignals(model, spec) {\n // process each signal definition\n (spec || []).forEach(function(s) {\n if (RESERVED.indexOf(s.name) !== -1) {\n throw Error('Signal name \"'+s.name+'\" is a '+\n 'reserved keyword ('+RESERVED.join(', ')+').');\n }\n\n var signal = model.signal(s.name, s.init)\n .verbose(s.verbose);\n\n if (s.init && s.init.expr) {\n s.init.expr = expr(s.init.expr);\n signal.value(exprVal(model, s.init));\n }\n\n if (s.expr) {\n s.expr = expr(s.expr);\n signal.evaluate = function(input) {\n var val = exprVal(model, s);\n if (val !== signal.value() || signal.verbose()) {\n signal.value(val);\n input.signals[s.name] = 1;\n return input;\n }\n return model.doNotPropagate; \n };\n signal.dependency(SIGNALS, s.expr.globals);\n s.expr.globals.forEach(function(dep) {\n model.signal(dep).addListener(signal);\n });\n }\n });\n\n return spec;\n}\n\nfunction exprVal(model, spec) {\n var e = spec.expr,\n val = e.fn(null, null, model.values(SIGNALS, e.globals));\n return spec.scale ? parseSignals.scale(model, spec, val) : val;\n}\n\nparseSignals.scale = function scale(model, spec, value, datum, evt) {\n var def = spec.scale,\n name = def.name || def.signal || def,\n scope = def.scope, e;\n\n if (scope) {\n if (scope.signal) {\n scope = model.signalRef(scope.signal);\n } else if (dl.isString(scope)) { // Scope is an expression\n e = def._expr = (def._expr || expr(scope));\n scope = e.fn(datum, evt, model.values(SIGNALS, e.globals));\n }\n }\n\n if (!scope || !scope.scale) {\n scope = (scope && scope.mark) ? scope.mark.group : model.scene().items[0];\n }\n\n var s = scope.scale(name);\n return !s ? value : (def.invert ? s.invert(value) : s(value));\n};\n\nmodule.exports = parseSignals;", + "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n log = require('vega-logging'),\n Tuple = require('vega-dataflow').Tuple;\n\nvar DEPS = [\"signals\", \"scales\", \"data\", \"fields\"];\n\nfunction properties(model, mark, spec) {\n var config = model.config(),\n code = \"\",\n names = dl.keys(spec),\n i, len, name, ref, vars = {},\n deps = {\n signals: {},\n scales: {},\n data: {},\n fields: {},\n nested: [],\n _nRefs: {}, // Temp stash to de-dupe nested refs.\n reflow: false\n };\n\n code += \"var o = trans ? {} : item, d=0, set=this.tpl.set, tmpl=signals||{}, t;\\n\" +\n // Stash for dl.template\n \"tmpl.datum = item.datum;\\n\" +\n \"tmpl.group = group;\\n\" +\n \"tmpl.parent = group.datum;\\n\";\n\n function handleDep(p) {\n if (ref[p] == null) return;\n var k = dl.array(ref[p]), i, n;\n for (i=0, n=k.length; i 0) ? \"\\n \" : \" \";\n if (ref.rule) {\n ref = rule(model, name, ref.rule);\n code += \"\\n \" + ref.code;\n } else if (dl.isArray(ref)) {\n ref = rule(model, name, ref);\n code += \"\\n \" + ref.code;\n } else {\n ref = valueRef(config, name, ref);\n code += \"d += set(o, \"+dl.str(name)+\", \"+ref.val+\");\";\n }\n\n vars[name] = true;\n DEPS.forEach(handleDep);\n deps.reflow = deps.reflow || ref.reflow;\n if (ref.nested.length) ref.nested.forEach(handleNestedRefs);\n }\n\n // If nested references are present, sort them based on their level\n // to speed up determination of whether encoders should be reeval'd.\n dl.keys(deps._nRefs).forEach(function(k) { deps.nested.push(deps._nRefs[k]); });\n deps.nested.sort(function(a, b) {\n a = a.level;\n b = b.level;\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n });\n\n if (vars.x2) {\n if (vars.x) {\n code += \"\\n if (o.x > o.x2) { \" +\n \"\\n t = o.x;\" +\n \"\\n d += set(o, 'x', o.x2);\" +\n \"\\n d += set(o, 'x2', t); \" +\n \"\\n };\";\n code += \"\\n d += set(o, 'width', (o.x2 - o.x));\";\n } else if (vars.width) {\n code += \"\\n d += set(o, 'x', (o.x2 - o.width));\";\n } else {\n code += \"\\n d += set(o, 'x', o.x2);\";\n }\n }\n\n if (vars.xc) {\n if (vars.width) {\n code += \"\\n d += set(o, 'x', (o.xc - o.width/2));\" ;\n } else {\n code += \"\\n d += set(o, 'x', o.xc);\" ;\n }\n }\n\n if (vars.y2) {\n if (vars.y) {\n code += \"\\n if (o.y > o.y2) { \" +\n \"\\n t = o.y;\" +\n \"\\n d += set(o, 'y', o.y2);\" +\n \"\\n d += set(o, 'y2', t);\" +\n \"\\n };\";\n code += \"\\n d += set(o, 'height', (o.y2 - o.y));\";\n } else if (vars.height) {\n code += \"\\n d += set(o, 'y', (o.y2 - o.height));\";\n } else {\n code += \"\\n d += set(o, 'y', o.y2);\";\n }\n }\n\n if (vars.yc) {\n if (vars.height) {\n code += \"\\n d += set(o, 'y', (o.yc - o.height/2));\" ;\n } else {\n code += \"\\n d += set(o, 'y', o.yc);\" ;\n }\n }\n\n if (hasPath(mark, vars)) code += \"\\n d += (item.touch(), 1);\";\n code += \"\\n if (trans) trans.interpolate(item, o);\";\n code += \"\\n return d > 0;\";\n\n try {\n /* jshint evil:true */\n var encoder = Function('item', 'group', 'trans', 'db',\n 'signals', 'predicates', code);\n encoder.tpl = Tuple;\n encoder.util = dl;\n encoder.d3 = d3; // For color spaces\n dl.extend(encoder, dl.template.context);\n return {\n encode: encoder,\n signals: dl.keys(deps.signals),\n scales: dl.keys(deps.scales),\n data: dl.keys(deps.data),\n fields: dl.keys(deps.fields),\n nested: deps.nested,\n reflow: deps.reflow\n };\n } catch (e) {\n log.error(e);\n log.log(code);\n }\n}\n\nfunction dependencies(a, b) {\n if (!dl.isObject(a)) {\n a = {reflow: false, nested: []};\n DEPS.forEach(function(d) { a[d] = []; });\n }\n\n if (dl.isObject(b)) {\n a.reflow = a.reflow || b.reflow;\n a.nested.push.apply(a.nested, b.nested);\n DEPS.forEach(function(d) { a[d].push.apply(a[d], b[d]); });\n }\n\n return a;\n}\n\nfunction hasPath(mark, vars) {\n return vars.path ||\n ((mark==='area' || mark==='line') &&\n (vars.x || vars.x2 || vars.width ||\n vars.y || vars.y2 || vars.height ||\n vars.tension || vars.interpolate));\n}\n\nfunction rule(model, name, rules) {\n var config = model.config(),\n deps = dependencies(),\n inputs = [], code = '';\n\n (rules||[]).forEach(function(r, i) {\n var def = r.predicate,\n predName = def && (def.name || def),\n pred = model.predicate(predName),\n p = 'predicates['+dl.str(predName)+']',\n input = [], args = name+'_arg'+i,\n ref;\n\n if (dl.isObject(def)) {\n dl.keys(def).forEach(function(k) {\n if (k === 'name') return;\n var ref = valueRef(config, i, def[k]);\n input.push(dl.str(k)+': '+ref.val);\n dependencies(deps, ref);\n });\n }\n\n ref = valueRef(config, name, r);\n dependencies(deps, ref);\n\n if (predName) {\n deps.signals.push.apply(deps.signals, pred.signals);\n deps.data.push.apply(deps.data, pred.data);\n inputs.push(args+\" = {\\n \"+input.join(\",\\n \")+\"\\n }\");\n code += \"if (\"+p+\".call(\"+p+\",\"+args+\", db, signals, predicates)) {\" +\n \"\\n d += set(o, \"+dl.str(name)+\", \"+ref.val+\");\";\n code += rules[i+1] ? \"\\n } else \" : \" }\";\n } else {\n code += \"{\" +\n \"\\n d += set(o, \"+dl.str(name)+\", \"+ref.val+\");\"+\n \"\\n }\\n\";\n }\n });\n\n code = \"var \" + inputs.join(\",\\n \") + \";\\n \" + code;\n return (deps.code = code, deps);\n}\n\nfunction valueRef(config, name, ref) {\n if (ref == null) return null;\n\n if (name==='fill' || name==='stroke') {\n if (ref.c) {\n return colorRef(config, 'hcl', ref.h, ref.c, ref.l);\n } else if (ref.h || ref.s) {\n return colorRef(config, 'hsl', ref.h, ref.s, ref.l);\n } else if (ref.l || ref.a) {\n return colorRef(config, 'lab', ref.l, ref.a, ref.b);\n } else if (ref.r || ref.g || ref.b) {\n return colorRef(config, 'rgb', ref.r, ref.g, ref.b);\n }\n }\n\n // initialize value\n var val = null, scale = null,\n deps = dependencies(),\n sgRef = null, fRef = null, sRef = null, tmpl = {};\n\n if (ref.template !== undefined) {\n val = dl.template.source(ref.template, 'tmpl', tmpl);\n dl.keys(tmpl).forEach(function(k) {\n var f = dl.field(k),\n a = f.shift();\n if (a === 'parent' || a === 'group') {\n deps.nested.push({\n parent: a === 'parent',\n group: a === 'group',\n level: 1\n });\n } else if (a === 'datum') {\n deps.fields.push(f[0]);\n } else {\n deps.signals.push(a);\n }\n });\n }\n\n if (ref.value !== undefined) {\n val = dl.str(ref.value);\n }\n\n if (ref.signal !== undefined) {\n sgRef = dl.field(ref.signal);\n val = 'signals['+sgRef.map(dl.str).join('][')+']';\n deps.signals.push(sgRef.shift());\n }\n\n if (ref.field !== undefined) {\n ref.field = dl.isString(ref.field) ? {datum: ref.field} : ref.field;\n fRef = fieldRef(ref.field);\n val = fRef.val;\n dependencies(deps, fRef);\n }\n\n if (ref.scale !== undefined) {\n sRef = scaleRef(ref.scale);\n scale = sRef.val;\n dependencies(deps, sRef);\n deps.scales.push(ref.scale.name || ref.scale);\n\n // run through scale function if val specified.\n // if no val, scale function is predicate arg.\n if (val !== null || ref.band || ref.mult || ref.offset) {\n val = scale + (ref.band ? '.rangeBand()' :\n '('+(val !== null ? val : 'item.datum.data')+')');\n } else {\n val = scale;\n }\n }\n\n // multiply, offset, return value\n val = '(' + (ref.mult?(dl.number(ref.mult)+' * '):'') + val + ')' +\n (ref.offset ? ' + ' + dl.number(ref.offset) : '');\n\n // Collate dependencies\n return (deps.val = val, deps);\n}\n\nfunction colorRef(config, type, x, y, z) {\n var xx = x ? valueRef(config, '', x) : config.color[type][0],\n yy = y ? valueRef(config, '', y) : config.color[type][1],\n zz = z ? valueRef(config, '', z) : config.color[type][2],\n deps = dependencies();\n\n [xx, yy, zz].forEach(function(v) {\n if (dl.isArray) return;\n dependencies(deps, v);\n });\n\n var val = '(this.d3.' + type + '(' + [xx.val, yy.val, zz.val].join(',') + ') + \"\")';\n return (deps.val = val, deps);\n}\n\n// {field: {datum: \"foo\"} } -> item.datum.foo\n// {field: {group: \"foo\"} } -> group.foo\n// {field: {parent: \"foo\"} } -> group.datum.foo\nfunction fieldRef(ref) {\n if (dl.isString(ref)) {\n return {val: dl.field(ref).map(dl.str).join('][')};\n }\n\n // Resolve nesting/parent lookups\n var l = ref.level || 1,\n nested = (ref.group || ref.parent) && l,\n scope = nested ? Array(l).join('group.mark.') : '',\n r = fieldRef(ref.datum || ref.group || ref.parent || ref.signal),\n val = r.val,\n deps = dependencies(null, r);\n\n if (ref.datum) {\n val = 'item.datum['+val+']';\n deps.fields.push(ref.datum);\n } else if (ref.group) {\n val = scope+'group['+val+']';\n deps.nested.push({ level: l, group: true });\n } else if (ref.parent) {\n val = scope+'group.datum['+val+']';\n deps.nested.push({ level: l, parent: true });\n } else if (ref.signal) {\n val = 'signals['+val+']';\n deps.signals.push(dl.field(ref.signal)[0]);\n deps.reflow = true;\n }\n\n return (deps.val = val, deps);\n}\n\n// {scale: \"x\"}\n// {scale: {name: \"x\"}},\n// {scale: fieldRef}\nfunction scaleRef(ref) {\n var scale = null,\n fr = null,\n deps = dependencies();\n\n if (dl.isString(ref)) {\n scale = dl.str(ref);\n } else if (ref.name) {\n scale = dl.isString(ref.name) ? dl.str(ref.name) : (fr = fieldRef(ref.name)).val;\n } else {\n scale = (fr = fieldRef(ref)).val;\n }\n\n scale = '(item.mark._scaleRefs['+scale+'] = 1, group.scale('+scale+'))';\n if (ref.invert) scale += '.invert';\n\n // Mark scale refs as they're dealt with separately in mark._scaleRefs.\n if (fr) fr.nested.forEach(function(g) { g.scale = true; });\n return fr ? (fr.val = scale, fr) : (deps.val = scale, deps);\n}\n\nmodule.exports = properties;", + "var dl = require('datalib'),\n SIGNALS = require('vega-dataflow').Dependencies.SIGNALS,\n expr = require('./expr');\n\nvar RESERVED = ['datum', 'event', 'signals']\n .concat(dl.keys(expr.codegen.functions));\n\nfunction parseSignals(model, spec) {\n // process each signal definition\n (spec || []).forEach(function(s) {\n if (RESERVED.indexOf(s.name) !== -1) {\n throw Error('Signal name \"'+s.name+'\" is a '+\n 'reserved keyword ('+RESERVED.join(', ')+').');\n }\n\n var signal = model.signal(s.name, s.init)\n .verbose(s.verbose);\n\n if (s.init && s.init.expr) {\n s.init.expr = expr(s.init.expr);\n signal.value(exprVal(model, s.init));\n }\n\n if (s.expr) {\n s.expr = expr(s.expr);\n signal.evaluate = function(input) {\n var val = exprVal(model, s),\n sg = input.signals;\n if (val !== signal.value() || signal.verbose()) {\n signal.value(val);\n sg[s.name] = 1;\n }\n return sg[s.name] ? input : model.doNotPropagate; \n };\n signal.dependency(SIGNALS, s.expr.globals);\n s.expr.globals.forEach(function(dep) {\n model.signal(dep).addListener(signal);\n });\n }\n });\n\n return spec;\n}\n\nfunction exprVal(model, spec) {\n var e = spec.expr,\n val = e.fn(null, null, model.values(SIGNALS, e.globals));\n return spec.scale ? parseSignals.scale(model, spec, val) : val;\n}\n\nparseSignals.scale = function scale(model, spec, value, datum, evt) {\n var def = spec.scale,\n name = def.name || def.signal || def,\n scope = def.scope, e;\n\n if (scope) {\n if (scope.signal) {\n scope = model.signalRef(scope.signal);\n } else if (dl.isString(scope)) { // Scope is an expression\n e = def._expr = (def._expr || expr(scope));\n scope = e.fn(datum, evt, model.values(SIGNALS, e.globals));\n }\n }\n\n if (!scope || !scope.scale) {\n scope = (scope && scope.mark) ? scope.mark.group : model.scene().items[0];\n }\n\n var s = scope.scale(name);\n return !s ? value : (def.invert ? s.invert(value) : s(value));\n};\n\nmodule.exports = parseSignals;", "var dl = require('datalib'),\n log = require('vega-logging'),\n Model = require('../core/Model'),\n View = require('../core/View');\n\nfunction parseSpec(spec, callback) {\n var vf = arguments[arguments.length-1],\n viewFactory = arguments.length > 2 && dl.isFunction(vf) ? vf : View.factory,\n config = arguments[2] !== viewFactory ? arguments[2] : {},\n model = new Model(config);\n\n function parse(spec) {\n // protect against subsequent spec modification\n spec = dl.duplicate(spec);\n\n var parsers = require('./'),\n width = spec.width || 500,\n height = spec.height || 500,\n viewport = spec.viewport || null;\n\n model.defs({\n width: width,\n height: height,\n viewport: viewport,\n background: parsers.background(spec.background),\n padding: parsers.padding(spec.padding),\n signals: parsers.signals(model, spec.signals),\n predicates: parsers.predicates(model, spec.predicates),\n marks: parsers.marks(model, spec, width, height),\n data: parsers.data(model, spec.data, function() {\n callback(viewFactory(model));\n })\n }); \n }\n\n if (dl.isObject(spec)) {\n parse(spec);\n } else if (dl.isString(spec)) {\n var opts = dl.extend({url: spec}, model.config().load);\n dl.load(opts, function(err, data) {\n if (err) {\n log.error('LOADING SPECIFICATION FAILED: ' + err.statusText);\n } else {\n try { \n parse(JSON.parse(data)); \n } catch (e) { \n log.error('INVALID SPECIFICATION: Must be a valid JSON object. '+e); \n }\n }\n });\n } else {\n log.error('INVALID SPECIFICATION: Must be a valid JSON object or URL.');\n }\n}\n\nmodule.exports = parseSpec;", "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n df = require('vega-dataflow'),\n SIGNALS = df.Dependencies.SIGNALS,\n parseSignals = require('./signals'),\n selector = require('./events'),\n expr = require('./expr');\n\nvar GATEKEEPER = '_vgGATEKEEPER';\n\nvar vgEvent = {\n getGroup: function(name) { return name ? this.name[name] : this.group; },\n getXY: function(item) {\n var p = {x: this.x, y: this.y};\n if (typeof item === 'string') {\n item = this.name[item];\n }\n for (; item; item = item.mark && item.mark.group) {\n p.x -= item.x || 0;\n p.y -= item.y || 0;\n }\n return p;\n },\n getX: function(item) { return this.getXY(item).x; },\n getY: function(item) { return this.getXY(item).y; }\n};\n\nfunction parseStreams(view) {\n var model = view.model(),\n spec = model.defs().signals,\n registry = {handlers: {}, nodes: {}},\n internal = dl.duplicate(registry), // Internal event processing\n external = dl.duplicate(registry); // External event processing\n\n (spec || []).forEach(function(sig) {\n var signal = model.signal(sig.name);\n if (sig.expr) return; // Cannot have an expr and stream definition.\n\n (sig.streams || []).forEach(function(stream) {\n var sel = selector.parse(stream.type),\n exp = expr(stream.expr);\n mergedStream(signal, sel, exp, stream);\n });\n });\n\n // We register the event listeners all together so that if multiple\n // signals are registered on the same event, they will receive the\n // new value on the same pulse. \n dl.keys(internal.handlers).forEach(function(type) {\n view.on(type, function(evt, item) {\n evt.preventDefault(); // stop text selection\n extendEvent(evt, item);\n fire(internal, type, (item && item.datum) || {}, evt);\n });\n });\n\n // add external event listeners\n dl.keys(external.handlers).forEach(function(type) {\n if (typeof window === 'undefined') return; // No external support\n\n var h = external.handlers[type],\n t = type.split(':'), // --> no element pseudo-selectors\n elt = (t[0] === 'window') ? [window] :\n window.document.querySelectorAll(t[0]);\n\n function handler(evt) {\n extendEvent(evt);\n fire(external, type, d3.select(this).datum(), evt);\n }\n\n for (var i=0; i 0,\n i, ilen, j, jlen, group, legend;\n\n if (input.add.length || input.rem.length || !items.length || \n input.mod.length === items.length ||\n type === 'area' || type === 'line') {\n bound.mark(this._mark, null, isGrp && !hasLegends);\n } else {\n input.mod.forEach(function(item) { bound.item(item); });\n }\n\n if (isGrp && hasLegends) {\n for (i=0, ilen=items.length; i this._stamp) {\n output = join.call(this, fcs, this._ds.values(), true, fullUpdate);\n }\n } else {\n data = dl.isFunction(this._def.from) ? this._def.from() : [Sentinel];\n output = join.call(this, input, data);\n }\n\n // Stash output before Bounder for downstream reactive geometry.\n this._output = output = this._graph.evaluate(output, this._encoder);\n\n // Add any new scale references to the dependency list, and ensure\n // they're connected.\n if (update.nested && update.nested.length && this._status === CONNECTED) {\n dl.keys(this._mark._scaleRefs).forEach(function(s) {\n var scale = self._parent.scale(s);\n if (!scale) return;\n\n scale.addListener(self);\n self.dependency(Deps.SCALES, s);\n self._encoder.dependency(Deps.SCALES, s);\n });\n }\n\n // Supernodes calculate bounds too, but only on items marked dirty.\n if (this._isSuper) {\n output.mod = output.mod.filter(function(x) { return x._dirty; });\n output = this._graph.evaluate(output, this._bounder);\n }\n\n return output;\n};\n\nfunction newItem() {\n var item = Tuple.ingest(new Item(this._mark));\n\n // For the root node's item\n if (this._def.width) Tuple.set(item, 'width', this._def.width);\n if (this._def.height) Tuple.set(item, 'height', this._def.height);\n return item;\n}\n\nfunction join(input, data, ds, fullUpdate) {\n var output = ChangeSet.create(input),\n keyf = keyFunction(this._def.key || (ds ? '_id' : null)),\n prev = this._mark.items || [],\n rem = ds ? input.rem : prev,\n mod = Tuple.idMap((!ds || fullUpdate) ? data : input.mod),\n next = [],\n i, key, len, item, datum, enter, diff;\n\n // Only mark rems as exiting. Due to keyf, there may be an add/mod \n // tuple that replaces it.\n for (i=0, len=rem.length; i0) s += '|';\n s += String(f[i](d));\n }\n return s;\n };\n}\n\nmodule.exports = Builder;", + "var dl = require('datalib'),\n log = require('vega-logging'),\n Item = require('vega-scenegraph').Item,\n df = require('vega-dataflow'),\n Node = df.Node, // jshint ignore:line\n Deps = df.Dependencies,\n Tuple = df.Tuple,\n ChangeSet = df.ChangeSet,\n Sentinel = {},\n Encoder = require('./Encoder'),\n Bounder = require('./Bounder'),\n parseData = require('../parse/data');\n\nfunction Builder() { \n return arguments.length ? this.init.apply(this, arguments) : this;\n}\n\nvar Status = Builder.STATUS = {\n ENTER: 'enter',\n UPDATE: 'update',\n EXIT: 'exit'\n};\n\nvar CONNECTED = 1, DISCONNECTED = 2;\n\nvar proto = (Builder.prototype = new Node());\n\nproto.init = function(graph, def, mark, parent, parent_id, inheritFrom) {\n Node.prototype.init.call(this, graph)\n .router(true)\n .collector(true);\n\n this._def = def;\n this._mark = mark;\n this._from = (def.from ? def.from.data : null) || inheritFrom;\n this._ds = dl.isString(this._from) ? graph.data(this._from) : null;\n this._map = {};\n this._status = null; // Connected or disconnected?\n\n mark.def = def;\n mark.marktype = def.type;\n mark.interactive = (def.interactive !== false);\n mark.items = [];\n if (dl.isValid(def.name)) mark.name = def.name;\n\n this._parent = parent;\n this._parent_id = parent_id;\n\n if (def.from && (def.from.mark || def.from.transform || def.from.modify)) {\n inlineDs.call(this);\n }\n\n // Non-group mark builders are super nodes. Encoder and Bounder remain \n // separate operators but are embedded and called by Builder.evaluate.\n this._isSuper = (this._def.type !== 'group'); \n this._encoder = new Encoder(this._graph, this._mark, this);\n this._bounder = new Bounder(this._graph, this._mark);\n this._output = null; // Output changeset for reactive geom as Bounder reflows\n\n if (this._ds) { this._encoder.dependency(Deps.DATA, this._from); }\n\n // Since Builders are super nodes, copy over encoder dependencies\n // (bounder has no registered dependencies).\n this.dependency(Deps.DATA, this._encoder.dependency(Deps.DATA));\n this.dependency(Deps.SCALES, this._encoder.dependency(Deps.SCALES));\n this.dependency(Deps.SIGNALS, this._encoder.dependency(Deps.SIGNALS));\n\n return this;\n};\n\n// Reactive geometry and mark-level transformations are handled here \n// because they need their group's data-joined context. \nfunction inlineDs() {\n var from = this._def.from,\n geom = from.mark,\n src, name, spec, sibling, output, input;\n\n if (geom) {\n name = ['vg', this._parent_id, geom].join('_');\n spec = {\n name: name,\n transform: from.transform, \n modify: from.modify\n };\n } else {\n src = this._graph.data(this._from);\n name = ['vg', this._from, this._def.type, src.listeners(true).length].join('_');\n spec = {\n name: name,\n source: this._from,\n transform: from.transform,\n modify: from.modify\n };\n }\n\n this._from = name;\n this._ds = parseData.datasource(this._graph, spec);\n var node;\n\n if (geom) {\n sibling = this.sibling(geom);\n\n // Bounder reflows, so we need an intermediary node to propagate\n // the output constructed by the Builder.\n node = new Node(this._graph).addListener(this._ds.listener());\n node.evaluate = function() { return sibling._output; };\n\n if (sibling._isSuper) {\n sibling.addListener(node);\n } else {\n sibling._bounder.addListener(node);\n }\n } else {\n // At this point, we have a new datasource but it is empty as\n // the propagation cycle has already crossed the datasources. \n // So, we repulse just this datasource. This should be safe\n // as the ds isn't connected to the scenegraph yet.\n output = this._ds.source().last();\n input = ChangeSet.create(output);\n\n input.add = output.add;\n input.mod = output.mod;\n input.rem = output.rem;\n input.stamp = null;\n this._graph.propagate(input, this._ds.listener(), output.stamp);\n }\n}\n\nproto.ds = function() { return this._ds; };\nproto.parent = function() { return this._parent; };\nproto.encoder = function() { return this._encoder; };\nproto.pipeline = function() { return [this]; };\n\nproto.connect = function() {\n var builder = this;\n\n this._graph.connect(this.pipeline());\n this._encoder._scales.forEach(function(s) {\n if (!(s = builder._parent.scale(s))) return;\n s.addListener(builder);\n });\n\n if (this._parent) {\n if (this._isSuper) this.addListener(this._parent._collector);\n else this._bounder.addListener(this._parent._collector);\n }\n\n return (this._status = CONNECTED, this);\n};\n\nproto.disconnect = function() {\n var builder = this;\n if (!this._listeners.length) return this;\n\n function disconnectScales(scales) {\n for(var i=0, len=scales.length, s; i this._stamp) {\n join.call(this, fcs, output, this._ds.values(), true, fullUpdate);\n } else if (fullUpdate) {\n output.mod = this._mark.items.slice();\n }\n } else {\n data = dl.isFunction(this._def.from) ? this._def.from() : [Sentinel];\n join.call(this, input, output, data);\n }\n\n // Stash output before Bounder for downstream reactive geometry.\n this._output = output = this._graph.evaluate(output, this._encoder);\n\n // Add any new scale references to the dependency list, and ensure\n // they're connected.\n if (update.nested && update.nested.length && this._status === CONNECTED) {\n dl.keys(this._mark._scaleRefs).forEach(function(s) {\n var scale = self._parent.scale(s);\n if (!scale) return;\n\n scale.addListener(self);\n self.dependency(Deps.SCALES, s);\n self._encoder.dependency(Deps.SCALES, s);\n });\n }\n\n // Supernodes calculate bounds too, but only on items marked dirty.\n if (this._isSuper) {\n output.mod = output.mod.filter(function(x) { return x._dirty; });\n output = this._graph.evaluate(output, this._bounder);\n }\n\n return output;\n};\n\nfunction newItem() {\n var item = Tuple.ingest(new Item(this._mark));\n\n // For the root node's item\n if (this._def.width) Tuple.set(item, 'width', this._def.width);\n if (this._def.height) Tuple.set(item, 'height', this._def.height);\n return item;\n}\n\nfunction join(input, output, data, ds, fullUpdate) {\n var keyf = keyFunction(this._def.key || (ds ? '_id' : null)),\n prev = this._mark.items || [],\n rem = ds ? input.rem : prev,\n mod = Tuple.idMap((!ds || fullUpdate) ? data : input.mod),\n next = [],\n i, key, len, item, datum, enter, diff;\n\n // Only mark rems as exiting. Due to keyf, there may be an add/mod \n // tuple that replaces it.\n for (i=0, len=rem.length; i0) s += '|';\n s += String(f[i](d));\n }\n return s;\n };\n}\n\nmodule.exports = Builder;", "var dl = require('datalib'),\n log = require('vega-logging'),\n df = require('vega-dataflow'),\n Node = df.Node, // jshint ignore:line\n Deps = df.Dependencies,\n bound = require('vega-scenegraph').bound;\n\nvar EMPTY = {};\n\nfunction Encoder(graph, mark, builder) {\n var props = mark.def.properties || {},\n enter = props.enter,\n update = props.update,\n exit = props.exit;\n\n Node.prototype.init.call(this, graph);\n\n this._mark = mark;\n this._builder = builder;\n var s = this._scales = [];\n\n // Only scales used in the 'update' property set are set as\n // encoder depedencies to have targeted reevaluations. However,\n // we still want scales in 'enter' and 'exit' to be evaluated\n // before the encoder. \n if (enter) s.push.apply(s, enter.scales);\n\n if (update) {\n this.dependency(Deps.DATA, update.data);\n this.dependency(Deps.SIGNALS, update.signals);\n this.dependency(Deps.FIELDS, update.fields);\n this.dependency(Deps.SCALES, update.scales);\n s.push.apply(s, update.scales);\n }\n\n if (exit) s.push.apply(s, exit.scales);\n\n return this.mutates(true);\n}\n\nvar proto = (Encoder.prototype = new Node());\n\nproto.evaluate = function(input) {\n log.debug(input, ['encoding', this._mark.def.type]);\n var graph = this._graph,\n props = this._mark.def.properties || {},\n items = this._mark.items,\n enter = props.enter,\n update = props.update,\n exit = props.exit,\n dirty = input.dirty,\n preds = graph.predicates(),\n req = input.request,\n group = this._mark.group,\n guide = group && (group.mark.axis || group.mark.legend),\n db = EMPTY, sg = EMPTY, i, len, item, prop;\n\n if (req && !guide) {\n if ((prop = props[req]) && input.mod.length) {\n db = prop.data ? graph.values(Deps.DATA, prop.data) : null;\n sg = prop.signals ? graph.values(Deps.SIGNALS, prop.signals) : null;\n\n for (i=0, len=input.mod.length; i this._stamp) return true;\n }\n\n return false;\n}\n\n// Short-circuit encoder if user specifies items\nEncoder.update = function(graph, trans, request, items, dirty) {\n items = dl.array(items);\n var preds = graph.predicates(), \n db = graph.values(Deps.DATA),\n sg = graph.values(Deps.SIGNALS),\n i, len, item, props, prop;\n\n for (i=0, len=items.length; i 0,\n hasAxes = dl.array(this._def.axes).length > 0,\n hasLegends = dl.array(this._def.legends).length > 0,\n i, j, c, len, group, pipeline, def, inline = false;\n\n for (i=0, len=input.add.length; i=0; --i) {\n group = input.add[i];\n for (j=this._children[group._id].length-1; j>=0; --j) {\n c = this._children[group._id][j];\n c.builder.connect();\n pipeline = c.builder.pipeline();\n def = c.builder._def;\n\n // This new child needs to be built during this propagation cycle.\n // We could add its builder as a listener off the _recursor node, \n // but try to inline it if we can to minimize graph dispatches.\n inline = (def.type !== Types.GROUP);\n inline = inline && (this._graph.data(c.from) !== undefined); \n inline = inline && (pipeline[pipeline.length-1].listeners().length === 1); // Reactive geom source\n inline = inline && (def.from && !def.from.mark); // Reactive geom target\n c.inline = inline;\n\n if (inline) this._graph.evaluate(input, c.builder);\n else this._recursor.addListener(c.builder);\n }\n }\n\n function removeTemp(c) {\n if (c.type == Types.MARK && !c.inline &&\n builder._graph.data(c.from) !== undefined) {\n builder._recursor.removeListener(c.builder);\n }\n }\n\n function updateAxis(a) { \n var scale = a.scale();\n if (!input.scales[scale.scaleName]) return;\n a.reset().def();\n }\n \n function updateLegend(l) { \n var scale = l.size() || l.shape() || l.fill() || l.stroke();\n if (!input.scales[scale.scaleName]) return;\n l.reset().def();\n }\n\n for (i=0, len=input.mod.length; i rng[1]) {\n start = rng[1] || 0;\n rng = [start + (bw * len + space), start];\n } else {\n start = rng[0] || 0;\n rng = [start, start + (bw * len + space)];\n }\n }\n\n str = typeof rng[0] === 'string';\n if (str || rng.length > 2 || rng.length===1 || dataDrivenRange) {\n scale.range(rng); // color or shape values\n } else if (points && round) {\n scale.rangeRoundPoints(rng, pad);\n } else if (points) {\n scale.rangePoints(rng, pad);\n } else if (round) {\n scale.rangeRoundBands(rng, pad, outer);\n } else {\n scale.rangeBands(rng, pad, outer);\n }\n\n if (!scale.invert) {\n scale.invert = function(x, y) {\n if (arguments.length === 1) {\n return scale.domain()[d3.bisect(scale.range(), x) - 1];\n } else if (arguments.length === 2) { // Invert extents\n if (!dl.isNumber(x) || !dl.isNumber(y)) {\n throw Error('Extents to ordinal invert are not numbers ('+x+', '+y+').');\n }\n\n var points = [],\n rng = scale.range(),\n i = 0, len = rng.length, r;\n\n for(; i 0) return;\n if (exponent && def.type===Types.POWER) scale.exponent(exponent);\n if (clamp) scale.clamp(true);\n if (nice) {\n if (def.type === Types.TIME) {\n interval = d3.time[nice];\n if (!interval) log.error('Unrecognized interval: ' + interval);\n scale.nice(interval);\n } else {\n scale.nice();\n }\n }\n}\n\nfunction isUniques(scale) { \n return scale.type === Types.ORDINAL || scale.type === Types.QUANTILE; \n}\n\nfunction getRefs(def) { \n return def.fields || dl.array(def);\n}\n\nfunction inherits(refs) {\n return refs.some(function(r) {\n if (!r.data) return true;\n return r.data && dl.array(r.field).some(function(f) {\n return f.parent;\n });\n });\n}\n\nfunction getFields(ref, group) {\n return dl.array(ref.field).map(function(f) {\n return f.parent ?\n dl.accessor(f.parent)(group.datum) :\n f; // String or {'signal'}\n });\n}\n\n// Scale datarefs can be computed over multiple schema types. \n// This function determines the type of aggregator created, and\n// what data is sent to it: values, tuples, or multi-tuples that must\n// be standardized into a consistent schema. \nfunction aggrType(def, scale) {\n var refs = getRefs(def);\n\n // If we're operating over only a single domain, send full tuples\n // through for efficiency (fewer accessor creations/calls)\n if (refs.length == 1 && dl.array(refs[0].field).length == 1) {\n return Aggregate.TYPES.TUPLE;\n }\n\n // With quantitative scales, we only care about min/max.\n if (!isUniques(scale)) return Aggregate.TYPES.VALUE;\n\n // If we don't sort, then we can send values directly to aggrs as well\n if (!dl.isObject(def.sort)) return Aggregate.TYPES.VALUE;\n\n return Aggregate.TYPES.MULTI;\n}\n\nfunction getCache(which, def, scale, group) {\n var refs = getRefs(def),\n inherit = inherits(refs),\n atype = aggrType(def, scale),\n uniques = isUniques(scale),\n sort = def.sort,\n ck = '_'+which,\n fields = getFields(refs[0], group);\n\n if (scale[ck] || this[ck]) return scale[ck] || this[ck];\n\n var cache = new Aggregate(this._graph).type(atype),\n groupby, summarize;\n\n // If a scale's dataref doesn't inherit data from the group, we can\n // store the dataref aggregator at the Scale (dataflow node) level. \n if (inherit) {\n scale[ck] = cache;\n } else {\n this[ck] = cache;\n }\n\n if (uniques) {\n if (atype === Aggregate.TYPES.VALUE) {\n groupby = [{ name: DataRef.GROUPBY, get: dl.identity }];\n summarize = {'*': DataRef.COUNT};\n } else if (atype === Aggregate.TYPES.TUPLE) {\n groupby = [{ name: DataRef.GROUPBY, get: dl.$(fields[0]) }];\n summarize = dl.isObject(sort) ? [{\n field: DataRef.VALUE,\n get: dl.$(sort.field),\n ops: [sort.op]\n }] : {'*': DataRef.COUNT};\n } else { // atype === Aggregate.TYPES.MULTI\n groupby = DataRef.GROUPBY;\n summarize = [{ field: DataRef.VALUE, ops: [sort.op] }]; \n }\n } else {\n groupby = [];\n summarize = [{\n field: DataRef.VALUE,\n get: (atype == Aggregate.TYPES.TUPLE) ? dl.$(fields[0]) : dl.identity,\n ops: [DataRef.MIN, DataRef.MAX],\n as: [DataRef.MIN, DataRef.MAX]\n }];\n }\n\n cache.param('groupby', groupby)\n .param('summarize', summarize);\n\n return (cache._lastUpdate = -1, cache);\n}\n\nfunction dataRef(which, def, scale, group) {\n if (def == null) { return []; }\n if (dl.isArray(def)) return def.map(signal.bind(this));\n\n var self = this, graph = this._graph,\n refs = getRefs(def),\n inherit = inherits(refs),\n atype = aggrType(def, scale),\n cache = getCache.apply(this, arguments),\n sort = def.sort,\n uniques = isUniques(scale),\n i, rlen, j, flen, ref, fields, field, data, from, so, cmp;\n\n function addDep(s) {\n self.dependency(Deps.SIGNALS, s);\n }\n\n if (inherit || (!inherit && cache._lastUpdate < this._stamp)) {\n for (i=0, rlen=refs.length; i rng[1]) {\n start = rng[1] || 0;\n rng = [start + (bw * len + space), start];\n } else {\n start = rng[0] || 0;\n rng = [start, start + (bw * len + space)];\n }\n }\n\n str = typeof rng[0] === 'string';\n if (str || rng.length > 2 || rng.length===1 || dataDrivenRange) {\n scale.range(rng); // color or shape values\n spatial = false;\n } else if (points && round) {\n scale.rangeRoundPoints(rng, pad);\n } else if (points) {\n scale.rangePoints(rng, pad);\n } else if (round) {\n scale.rangeRoundBands(rng, pad, outer);\n } else {\n scale.rangeBands(rng, pad, outer);\n }\n\n prev.range = rng;\n this._updated = true;\n }\n\n if (!scale.invert && spatial) invertOrdinal(scale);\n}\n\n// \"Polyfill\" ordinal scale inversion. Currently, only ordinal scales\n// with ordered numeric ranges are supported. \nvar bisect = d3.bisector(dl.numcmp).right,\n findAsc = function(a, x) { return bisect(a,x) - 1; },\n findDsc = d3.bisector(function(a,b) { return -1 * dl.numcmp(a,b); }).left;\n\nfunction invertOrdinal(scale) {\n scale.invert = function(x, y) {\n var rng = scale.range(),\n asc = rng[0] < rng[1],\n find = asc ? findAsc : findDsc;\n\n if (arguments.length === 1) {\n if (!dl.isNumber(x)) {\n throw Error('Ordinal scale inversion is only supported for numeric input ('+x+').');\n }\n return scale.domain()[find(rng, x)];\n\n } else if (arguments.length === 2) { // Invert extents\n if (!dl.isNumber(x) || !dl.isNumber(y)) {\n throw Error('Extents to ordinal invert are not numbers ('+x+', '+y+').');\n }\n\n var domain = scale.domain(),\n a = find(rng, x),\n b = find(rng, y),\n n = rng.length - 1, r;\n if (b < a) { r = a; a = b; b = a; } // ensure a <= b\n if (a < 0) a = 0;\n if (b > n) b = n;\n\n return (asc ? dl.range(a, b+1) : dl.range(b, a-1, -1))\n .map(function(i) { return domain[i]; });\n }\n };\n}\n\nfunction quantitative(scale, rng, group) {\n var def = this._def,\n prev = scale._prev,\n round = signal.call(this, def.round),\n exponent = signal.call(this, def.exponent),\n clamp = signal.call(this, def.clamp),\n nice = signal.call(this, def.nice),\n domain, interval;\n\n // domain\n domain = (def.type === Types.QUANTILE) ?\n dataRef.call(this, DataRef.DOMAIN, def.domain, scale, group) :\n domainMinMax.call(this, scale, group);\n if (domain && !dl.equal(prev.domain, domain)) {\n scale.domain(domain);\n prev.domain = domain;\n this._updated = true;\n } \n\n // range\n // vertical scales should flip by default, so use XOR here\n if (signal.call(this, def.range) === 'height') rng = rng.reverse();\n if (dl.equal(prev.range, rng)) return;\n scale[round && scale.rangeRound ? 'rangeRound' : 'range'](rng);\n prev.range = rng;\n this._updated = true;\n\n // TODO: Support signals for these properties. Until then, only eval\n // them once.\n if (this._stamp > 0) return;\n if (exponent && def.type===Types.POWER) scale.exponent(exponent);\n if (clamp) scale.clamp(true);\n if (nice) {\n if (def.type === Types.TIME) {\n interval = d3.time[nice];\n if (!interval) log.error('Unrecognized interval: ' + interval);\n scale.nice(interval);\n } else {\n scale.nice();\n }\n }\n}\n\nfunction isUniques(scale) { \n return scale.type === Types.ORDINAL || scale.type === Types.QUANTILE; \n}\n\nfunction getRefs(def) { \n return def.fields || dl.array(def);\n}\n\nfunction inherits(refs) {\n return refs.some(function(r) {\n if (!r.data) return true;\n return r.data && dl.array(r.field).some(function(f) {\n return f.parent;\n });\n });\n}\n\nfunction getFields(ref, group) {\n return dl.array(ref.field).map(function(f) {\n return f.parent ?\n dl.accessor(f.parent)(group.datum) :\n f; // String or {'signal'}\n });\n}\n\n// Scale datarefs can be computed over multiple schema types. \n// This function determines the type of aggregator created, and\n// what data is sent to it: values, tuples, or multi-tuples that must\n// be standardized into a consistent schema. \nfunction aggrType(def, scale) {\n var refs = getRefs(def);\n\n // If we're operating over only a single domain, send full tuples\n // through for efficiency (fewer accessor creations/calls)\n if (refs.length == 1 && dl.array(refs[0].field).length == 1) {\n return Aggregate.TYPES.TUPLE;\n }\n\n // With quantitative scales, we only care about min/max.\n if (!isUniques(scale)) return Aggregate.TYPES.VALUE;\n\n // If we don't sort, then we can send values directly to aggrs as well\n if (!dl.isObject(def.sort)) return Aggregate.TYPES.VALUE;\n\n return Aggregate.TYPES.MULTI;\n}\n\nfunction getCache(which, def, scale, group) {\n var refs = getRefs(def),\n inherit = inherits(refs),\n atype = aggrType(def, scale),\n uniques = isUniques(scale),\n sort = def.sort,\n ck = '_'+which,\n fields = getFields(refs[0], group);\n\n if (scale[ck] || this[ck]) return scale[ck] || this[ck];\n\n var cache = new Aggregate(this._graph).type(atype),\n groupby, summarize;\n\n // If a scale's dataref doesn't inherit data from the group, we can\n // store the dataref aggregator at the Scale (dataflow node) level. \n if (inherit) {\n scale[ck] = cache;\n } else {\n this[ck] = cache;\n }\n\n if (uniques) {\n if (atype === Aggregate.TYPES.VALUE) {\n groupby = [{ name: DataRef.GROUPBY, get: dl.identity }];\n summarize = {'*': DataRef.COUNT};\n } else if (atype === Aggregate.TYPES.TUPLE) {\n groupby = [{ name: DataRef.GROUPBY, get: dl.$(fields[0]) }];\n summarize = dl.isObject(sort) ? [{\n field: DataRef.VALUE,\n get: dl.$(sort.field),\n ops: [sort.op]\n }] : {'*': DataRef.COUNT};\n } else { // atype === Aggregate.TYPES.MULTI\n groupby = DataRef.GROUPBY;\n summarize = [{ field: DataRef.VALUE, ops: [sort.op] }]; \n }\n } else {\n groupby = [];\n summarize = [{\n field: DataRef.VALUE,\n get: (atype == Aggregate.TYPES.TUPLE) ? dl.$(fields[0]) : dl.identity,\n ops: [DataRef.MIN, DataRef.MAX],\n as: [DataRef.MIN, DataRef.MAX]\n }];\n }\n\n cache.param('groupby', groupby)\n .param('summarize', summarize);\n\n return (cache._lastUpdate = -1, cache);\n}\n\nfunction dataRef(which, def, scale, group) {\n if (def == null) { return []; }\n if (dl.isArray(def)) return def.map(signal.bind(this));\n\n var self = this, graph = this._graph,\n refs = getRefs(def),\n inherit = inherits(refs),\n atype = aggrType(def, scale),\n cache = getCache.apply(this, arguments),\n sort = def.sort,\n uniques = isUniques(scale),\n i, rlen, j, flen, ref, fields, field, data, from, so, cmp;\n\n function addDep(s) {\n self.dependency(Deps.SIGNALS, s);\n }\n\n if (inherit || (!inherit && cache._lastUpdate < this._stamp)) {\n for (i=0, rlen=refs.length; i 1) f = 1;\n e = curr.ease(f);\n\n for (i=0, n=curr.length; i 0 ? (e = 1e-12, Math.ceil) : (e = -1e-12, Math.floor),\n e;\n function log(x) {\n return (domain[0] < 0 ?\n -Math.log(x > 0 ? 0 : -x) :\n Math.log(x < 0 ? 0 : x)) / Math.log(base);\n }\n function pow(x) {\n return domain[0] < 0 ? -Math.pow(base, -x) : Math.pow(base, x);\n }\n return function(d) {\n return pow(v(log(d) + e)) / d >= k ? f(d) : '';\n };\n }\n\n function getFormatter(formatType, str) {\n var fmt = dl.format,\n log = scale.type === 'log',\n domain, f;\n\n switch (formatType) {\n case NUMBER:\n domain = scale.domain();\n f = fmt.auto.number(domain, tickCount, str || (log ? '.1r' : null));\n return log ? logFilter(domain, tickCount, f) : f;\n case TIME: return (str ? fmt : fmt.auto).time(str);\n case UTC: return (str ? fmt : fmt.auto).utc(str);\n default: return String;\n }\n }\n \n function getTicks(format) {\n var major = tickValues || (scale.ticks ? scale.ticks(tickCount) : scale.domain()),\n minor = axisSubdivide(scale, major, tickSubdivide).map(ingest);\n major = major.map(function(d) { return (d = ingest(d), d.label = format(d.data), d); });\n return [major, minor];\n }\n\n axis.def = function() {\n if (!axisDef.type) axis_def(scale);\n\n var ticks = getTicks(getTickFormat());\n var tdata = title ? [title].map(ingest) : [];\n\n axisDef.marks[0].from = function() { return grid ? ticks[0] : []; };\n axisDef.marks[1].from = function() { return ticks[0]; };\n axisDef.marks[2].from = function() { return ticks[1]; };\n axisDef.marks[3].from = axisDef.marks[1].from;\n axisDef.marks[4].from = function() { return [1]; };\n axisDef.marks[5].from = function() { return tdata; };\n axisDef.offset = offset;\n axisDef.orient = orient;\n axisDef.layer = layer;\n\n return axisDef;\n };\n\n function axis_def(scale) {\n // setup scale mapping\n var newScale, oldScale, range;\n if (scale.type === ORDINAL) {\n newScale = {scale: scale.scaleName, offset: 0.5 + scale.rangeBand()/2};\n oldScale = newScale;\n } else {\n newScale = {scale: scale.scaleName, offset: 0.5};\n oldScale = {scale: scale.scaleName+':prev', offset: 0.5};\n }\n range = axisScaleRange(scale);\n\n // setup axis marks\n dl.extend(m.gridLines, axisTicks(config));\n dl.extend(m.majorTicks, axisTicks(config));\n dl.extend(m.minorTicks, axisTicks(config));\n dl.extend(m.tickLabels, axisTickLabels(config));\n dl.extend(m.domain, axisDomain(config));\n dl.extend(m.title, axisTitle(config));\n m.gridLines.properties.enter.stroke = {value: config.axis.gridColor};\n m.gridLines.properties.enter.strokeOpacity = {value: config.axis.gridOpacity};\n\n // extend axis marks based on axis orientation\n axisTicksExtend(orient, m.gridLines, oldScale, newScale, Infinity);\n axisTicksExtend(orient, m.majorTicks, oldScale, newScale, tickMajorSize);\n axisTicksExtend(orient, m.minorTicks, oldScale, newScale, tickMinorSize);\n axisLabelExtend(orient, m.tickLabels, oldScale, newScale, tickMajorSize, tickPadding);\n\n axisDomainExtend(orient, m.domain, range, tickEndSize);\n axisTitleExtend(orient, m.title, range, titleOffset); // TODO get offset\n \n // add / override custom style properties\n dl.extend(m.gridLines.properties.update, gridLineStyle);\n dl.extend(m.majorTicks.properties.update, majorTickStyle);\n dl.extend(m.minorTicks.properties.update, minorTickStyle);\n dl.extend(m.tickLabels.properties.update, tickLabelStyle);\n dl.extend(m.domain.properties.update, domainStyle);\n dl.extend(m.title.properties.update, titleStyle);\n\n var marks = [m.gridLines, m.majorTicks, m.minorTicks, m.tickLabels, m.domain, m.title];\n dl.extend(axisDef, {\n type: 'group',\n interactive: false,\n properties: { \n enter: {\n encode: axisUpdate,\n scales: [scale.scaleName],\n signals: [], data: []\n },\n update: {\n encode: axisUpdate,\n scales: [scale.scaleName],\n signals: [], data: []\n }\n }\n });\n\n axisDef.marks = marks.map(function(m) { return parseMark(model, m); });\n }\n\n axis.scale = function(x) {\n if (!arguments.length) return scale;\n if (scale !== x) { scale = x; reset(); }\n return axis;\n };\n\n axis.orient = function(x) {\n if (!arguments.length) return orient;\n if (orient !== x) {\n orient = x in axisOrients ? x + '' : config.axis.orient;\n reset();\n }\n return axis;\n };\n\n axis.title = function(x) {\n if (!arguments.length) return title;\n if (title !== x) { title = x; reset(); }\n return axis;\n };\n\n axis.tickCount = function(x) {\n if (!arguments.length) return tickCount;\n tickCount = x;\n return axis;\n };\n\n axis.tickValues = function(x) {\n if (!arguments.length) return tickValues;\n tickValues = x;\n return axis;\n };\n\n axis.tickFormat = function(x) {\n if (!arguments.length) return tickFormatString;\n if (tickFormatString !== x) {\n tickFormatString = x;\n reset();\n }\n return axis;\n };\n\n axis.tickFormatType = function(x) {\n if (!arguments.length) return tickFormatType;\n if (tickFormatType !== x) {\n tickFormatType = x;\n reset();\n }\n return axis;\n };\n\n axis.tickSize = function(x, y) {\n if (!arguments.length) return tickMajorSize;\n var n = arguments.length - 1,\n major = +x,\n minor = n > 1 ? +y : tickMajorSize,\n end = n > 0 ? +arguments[n] : tickMajorSize;\n\n if (tickMajorSize !== major ||\n tickMinorSize !== minor ||\n tickEndSize !== end) {\n reset();\n }\n\n tickMajorSize = major;\n tickMinorSize = minor;\n tickEndSize = end;\n return axis;\n };\n\n axis.tickSubdivide = function(x) {\n if (!arguments.length) return tickSubdivide;\n tickSubdivide = +x;\n return axis;\n };\n \n axis.offset = function(x) {\n if (!arguments.length) return offset;\n offset = dl.isObject(x) ? x : +x;\n return axis;\n };\n\n axis.tickPadding = function(x) {\n if (!arguments.length) return tickPadding;\n if (tickPadding !== +x) { tickPadding = +x; reset(); }\n return axis;\n };\n\n axis.titleOffset = function(x) {\n if (!arguments.length) return titleOffset;\n if (titleOffset !== +x) { titleOffset = +x; reset(); }\n return axis;\n };\n\n axis.layer = function(x) {\n if (!arguments.length) return layer;\n if (layer !== x) { layer = x; reset(); }\n return axis;\n };\n\n axis.grid = function(x) {\n if (!arguments.length) return grid;\n if (grid !== x) { grid = x; reset(); }\n return axis;\n };\n\n axis.gridLineProperties = function(x) {\n if (!arguments.length) return gridLineStyle;\n if (gridLineStyle !== x) { gridLineStyle = x; }\n return axis;\n };\n\n axis.majorTickProperties = function(x) {\n if (!arguments.length) return majorTickStyle;\n if (majorTickStyle !== x) { majorTickStyle = x; }\n return axis;\n };\n\n axis.minorTickProperties = function(x) {\n if (!arguments.length) return minorTickStyle;\n if (minorTickStyle !== x) { minorTickStyle = x; }\n return axis;\n };\n\n axis.tickLabelProperties = function(x) {\n if (!arguments.length) return tickLabelStyle;\n if (tickLabelStyle !== x) { tickLabelStyle = x; }\n return axis;\n };\n\n axis.titleProperties = function(x) {\n if (!arguments.length) return titleStyle;\n if (titleStyle !== x) { titleStyle = x; }\n return axis;\n };\n\n axis.domainProperties = function(x) {\n if (!arguments.length) return domainStyle;\n if (domainStyle !== x) { domainStyle = x; }\n return axis;\n };\n \n axis.reset = function() { \n reset(); \n return axis; \n };\n\n return axis;\n}\n\nvar axisOrients = {top: 1, right: 1, bottom: 1, left: 1};\n\nfunction axisSubdivide(scale, ticks, m) {\n var subticks = [];\n if (m && ticks.length > 1) {\n var extent = axisScaleExtent(scale.domain()),\n i = -1,\n n = ticks.length,\n d = (ticks[1] - ticks[0]) / ++m,\n j,\n v;\n while (++i < n) {\n for (j = m; --j > 0;) {\n if ((v = +ticks[i] - j * d) >= extent[0]) {\n subticks.push(v);\n }\n }\n }\n for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1];) {\n subticks.push(v);\n }\n }\n return subticks;\n}\n\nfunction axisScaleExtent(domain) {\n var start = domain[0], stop = domain[domain.length - 1];\n return start < stop ? [start, stop] : [stop, start];\n}\n\nfunction axisScaleRange(scale) {\n return scale.rangeExtent ?\n scale.rangeExtent() :\n axisScaleExtent(scale.range());\n}\n\nvar axisAlign = {\n bottom: 'center',\n top: 'center',\n left: 'right',\n right: 'left'\n};\n\nvar axisBaseline = {\n bottom: 'top',\n top: 'bottom',\n left: 'middle',\n right: 'middle'\n};\n\nfunction axisLabelExtend(orient, labels, oldScale, newScale, size, pad) {\n size = Math.max(size, 0) + pad;\n if (orient === 'left' || orient === 'top') {\n size *= -1;\n } \n if (orient === 'top' || orient === 'bottom') {\n dl.extend(labels.properties.enter, {\n x: oldScale,\n y: {value: size},\n });\n dl.extend(labels.properties.update, {\n x: newScale,\n y: {value: size},\n align: {value: 'center'},\n baseline: {value: axisBaseline[orient]}\n });\n } else {\n dl.extend(labels.properties.enter, {\n x: {value: size},\n y: oldScale,\n });\n dl.extend(labels.properties.update, {\n x: {value: size},\n y: newScale,\n align: {value: axisAlign[orient]},\n baseline: {value: 'middle'}\n });\n }\n}\n\nfunction axisTicksExtend(orient, ticks, oldScale, newScale, size) {\n var sign = (orient === 'left' || orient === 'top') ? -1 : 1;\n if (size === Infinity) {\n size = (orient === 'top' || orient === 'bottom') ?\n {field: {group: 'height', level: 2}, mult: -sign} :\n {field: {group: 'width', level: 2}, mult: -sign};\n } else {\n size = {value: sign * size};\n }\n if (orient === 'top' || orient === 'bottom') {\n dl.extend(ticks.properties.enter, {\n x: oldScale,\n y: {value: 0},\n y2: size\n });\n dl.extend(ticks.properties.update, {\n x: newScale,\n y: {value: 0},\n y2: size\n });\n dl.extend(ticks.properties.exit, {\n x: newScale,\n }); \n } else {\n dl.extend(ticks.properties.enter, {\n x: {value: 0},\n x2: size,\n y: oldScale\n });\n dl.extend(ticks.properties.update, {\n x: {value: 0},\n x2: size,\n y: newScale\n });\n dl.extend(ticks.properties.exit, {\n y: newScale,\n });\n }\n}\n\nfunction axisTitleExtend(orient, title, range, offset) {\n var mid = ~~((range[0] + range[1]) / 2),\n sign = (orient === 'top' || orient === 'left') ? -1 : 1;\n \n if (orient === 'bottom' || orient === 'top') {\n dl.extend(title.properties.update, {\n x: {value: mid},\n y: {value: sign*offset},\n angle: {value: 0}\n });\n } else {\n dl.extend(title.properties.update, {\n x: {value: sign*offset},\n y: {value: mid},\n angle: {value: orient === 'left' ? -90 : 90}\n });\n }\n}\n\nfunction axisDomainExtend(orient, domain, range, size) {\n var path;\n if (orient === 'top' || orient === 'left') {\n size = -1 * size;\n }\n if (orient === 'bottom' || orient === 'top') {\n path = 'M' + range[0] + ',' + size + 'V0H' + range[1] + 'V' + size;\n } else {\n path = 'M' + size + ',' + range[0] + 'H0V' + range[1] + 'H' + size;\n }\n domain.properties.update.path = {value: path};\n}\n\nfunction axisUpdate(item, group, trans) {\n var o = trans ? {} : item,\n offset = item.mark.def.offset,\n orient = item.mark.def.orient,\n width = group.width,\n height = group.height; // TODO fallback to global w,h?\n\n if (dl.isArray(offset)) {\n var ofx = offset[0],\n ofy = offset[1];\n\n switch (orient) {\n case 'left': { Tuple.set(o, 'x', -ofx); Tuple.set(o, 'y', ofy); break; }\n case 'right': { Tuple.set(o, 'x', width + ofx); Tuple.set(o, 'y', ofy); break; }\n case 'bottom': { Tuple.set(o, 'x', ofx); Tuple.set(o, 'y', height + ofy); break; }\n case 'top': { Tuple.set(o, 'x', ofx); Tuple.set(o, 'y', -ofy); break; }\n default: { Tuple.set(o, 'x', ofx); Tuple.set(o, 'y', ofy); }\n }\n } else {\n if (dl.isObject(offset)) {\n offset = -group.scale(offset.scale)(offset.value);\n }\n\n switch (orient) {\n case 'left': { Tuple.set(o, 'x', -offset); Tuple.set(o, 'y', 0); break; }\n case 'right': { Tuple.set(o, 'x', width + offset); Tuple.set(o, 'y', 0); break; }\n case 'bottom': { Tuple.set(o, 'x', 0); Tuple.set(o, 'y', height + offset); break; }\n case 'top': { Tuple.set(o, 'x', 0); Tuple.set(o, 'y', -offset); break; }\n default: { Tuple.set(o, 'x', 0); Tuple.set(o, 'y', 0); }\n }\n }\n\n if (trans) trans.interpolate(item, o);\n return true;\n}\n\nfunction axisTicks(config) {\n return {\n type: 'rule',\n interactive: false,\n key: 'data',\n properties: {\n enter: {\n stroke: {value: config.axis.tickColor},\n strokeWidth: {value: config.axis.tickWidth},\n opacity: {value: 1e-6}\n },\n exit: { opacity: {value: 1e-6} },\n update: { opacity: {value: 1} }\n }\n };\n}\n\nfunction axisTickLabels(config) {\n return {\n type: 'text',\n interactive: true,\n key: 'data',\n properties: {\n enter: {\n fill: {value: config.axis.tickLabelColor},\n font: {value: config.axis.tickLabelFont},\n fontSize: {value: config.axis.tickLabelFontSize},\n opacity: {value: 1e-6},\n text: {field: 'label'}\n },\n exit: { opacity: {value: 1e-6} },\n update: { opacity: {value: 1} }\n }\n };\n}\n\nfunction axisTitle(config) {\n return {\n type: 'text',\n interactive: true,\n properties: {\n enter: {\n font: {value: config.axis.titleFont},\n fontSize: {value: config.axis.titleFontSize},\n fontWeight: {value: config.axis.titleFontWeight},\n fill: {value: config.axis.titleColor},\n align: {value: 'center'},\n baseline: {value: 'middle'},\n text: {field: 'data'}\n },\n update: {}\n }\n };\n}\n\nfunction axisDomain(config) {\n return {\n type: 'path',\n interactive: false,\n properties: {\n enter: {\n x: {value: 0.5},\n y: {value: 0.5},\n stroke: {value: config.axis.axisColor},\n strokeWidth: {value: config.axis.axisWidth}\n },\n update: {}\n }\n };\n}\n\nmodule.exports = axs;", "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n Gradient = require('vega-scenegraph').Gradient,\n parseProperties = require('../parse/properties'),\n parseMark = require('../parse/mark');\n\nfunction lgnd(model) {\n var size = null,\n shape = null,\n fill = null,\n stroke = null,\n spacing = null,\n values = null,\n format = null,\n formatString = null,\n config = model.config(),\n title,\n orient = 'right',\n offset = config.legend.offset,\n padding = config.legend.padding,\n tickArguments = [5],\n legendStyle = {},\n symbolStyle = {},\n gradientStyle = {},\n titleStyle = {},\n labelStyle = {},\n m = { // Legend marks as references for updates\n titles: {},\n symbols: {},\n labels: {},\n gradient: {}\n };\n\n var legend = {},\n legendDef = {};\n\n function reset() { legendDef.type = null; }\n function ingest(d, i) { return {data: d, index: i}; }\n\n legend.def = function() {\n var scale = size || shape || fill || stroke;\n \n format = !formatString ? null : ((scale.type === 'time') ?\n dl.format.time(formatString) : dl.format.number(formatString));\n \n if (!legendDef.type) {\n legendDef = (scale===fill || scale===stroke) && !discrete(scale.type) ?\n quantDef(scale) : ordinalDef(scale); \n }\n legendDef.orient = orient;\n legendDef.offset = offset;\n legendDef.padding = padding;\n return legendDef;\n };\n\n function discrete(type) {\n return type==='ordinal' || type==='quantize' ||\n type==='quantile' || type==='threshold';\n }\n\n function ordinalDef(scale) {\n var def = o_legend_def(size, shape, fill, stroke);\n\n // generate data\n var data = (values == null ?\n (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) :\n values).map(ingest);\n var fmt = format==null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : String) : format;\n \n // determine spacing between legend entries\n var fs, range, offset, pad=5, domain = d3.range(data.length);\n if (size) {\n range = data.map(function(x) { return Math.sqrt(size(x.data)); });\n offset = d3.max(range);\n range = range.reduce(function(a,b,i,z) {\n if (i > 0) a[i] = a[i-1] + z[i-1]/2 + pad;\n return (a[i] += b/2, a); }, [0]).map(Math.round);\n } else {\n offset = Math.round(Math.sqrt(config.legend.symbolSize));\n range = spacing ||\n (fs = labelStyle.fontSize) && (fs.value + pad) ||\n (config.legend.labelFontSize + pad);\n range = domain.map(function(d,i) {\n return Math.round(offset/2 + i*range);\n });\n }\n\n // account for padding and title size\n var sz = padding, ts;\n if (title) {\n ts = titleStyle.fontSize;\n sz += 5 + ((ts && ts.value) || config.legend.titleFontSize);\n }\n for (var i=0, n=range.length; i'},\n summarize: {\n type: 'custom', \n set: function(summarize) {\n var signalDeps = {},\n tx = this._transform,\n i, len, f, fields, name, ops;\n\n if (!dl.isArray(fields = summarize)) { // Object syntax from dl\n fields = [];\n for (name in summarize) {\n ops = dl.array(summarize[name]);\n fields.push({field: name, ops: ops});\n }\n }\n\n function sg(x) { if (x.signal) signalDeps[x.signal] = 1; }\n\n for (i=0, len=fields.length; i'},\n summarize: {\n type: 'custom', \n set: function(summarize) {\n var signalDeps = {},\n tx = this._transform,\n i, len, f, fields, name, ops;\n\n if (!dl.isArray(fields = summarize)) { // Object syntax from dl\n fields = [];\n for (name in summarize) {\n ops = dl.array(summarize[name]);\n fields.push({field: name, ops: ops});\n }\n }\n\n function sg(x) { if (x.signal) signalDeps[x.signal] = 1; }\n\n for (i=0, len=fields.length; i', default: [5, 2]}\n });\n\n this._output = {bin: 'bin'};\n return this.mutates(true);\n}\n\nvar prototype = (Bin.prototype = Object.create(Transform.prototype));\nprototype.constructor = Bin;\n\nprototype.transform = function(input) {\n log.debug(input, ['binning']);\n\n var output = this._output.bin,\n step = this.param('step'),\n steps = this.param('steps'),\n minstep = this.param('minstep'),\n get = this.param('field').accessor,\n opt = {\n min: this.param('min'),\n max: this.param('max'),\n base: this.param('base'),\n maxbins: this.param('maxbins'),\n div: this.param('div')\n };\n\n if (step) opt.step = step;\n if (steps) opt.steps = steps;\n if (minstep) opt.minstep = minstep;\n var b = bins(opt);\n\n function update(d) {\n var v = get(d);\n v = v == null ? null\n : b.start + b.step * ~~((v - b.start) / b.step);\n Tuple.set(d, output, v);\n }\n input.add.forEach(update);\n input.mod.forEach(update);\n input.rem.forEach(update);\n\n input.fields[output] = 1;\n return input;\n};\n\nmodule.exports = Bin;", + "var dl = require('datalib'),\n Tuple = require('vega-dataflow').Tuple,\n log = require('vega-logging'),\n Transform = require('./Transform'),\n BatchTransform = require('./BatchTransform');\n\nfunction Bin(graph) {\n BatchTransform.prototype.init.call(this, graph);\n Transform.addParameters(this, {\n field: {type: 'field'},\n min: {type: 'value'},\n max: {type: 'value'},\n base: {type: 'value', default: 10},\n maxbins: {type: 'value', default: 20},\n step: {type: 'value'},\n steps: {type: 'value'},\n minstep: {type: 'value'},\n div: {type: 'array', default: [5, 2]}\n });\n\n this._output = {\n start: 'bin_start',\n end: 'bin_end'\n };\n return this.mutates(true);\n}\n\nvar prototype = (Bin.prototype = Object.create(BatchTransform.prototype));\nprototype.constructor = Bin;\n\nprototype.extent = function(data) {\n // TODO only recompute extent upon data or field change?\n var e = [this.param('min'), this.param('max')], d;\n if (e[0] == null || e[1] == null) {\n d = dl.extent(data, this.param('field').accessor);\n if (e[0] == null) e[0] = d[0];\n if (e[1] == null) e[1] = d[1];\n }\n return e;\n};\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['binning']);\n\n var extent = this.extent(data),\n output = this._output,\n step = this.param('step'),\n steps = this.param('steps'),\n minstep = this.param('minstep'),\n get = this.param('field').accessor,\n opt = {\n min: extent[0],\n max: extent[1],\n base: this.param('base'),\n maxbins: this.param('maxbins'),\n div: this.param('div')\n };\n\n if (step) opt.step = step;\n if (steps) opt.steps = steps;\n if (minstep) opt.minstep = minstep;\n var b = dl.bins(opt);\n\n function update(d) {\n var v = get(d);\n v = v == null ? null\n : b.start + b.step * ~~((v - b.start) / b.step);\n Tuple.set(d, output.start, v);\n Tuple.set(d, output.end, v + b.step);\n }\n input.add.forEach(update);\n input.mod.forEach(update);\n input.rem.forEach(update);\n\n input.fields[output.start] = 1;\n input.fields[output.end] = 1;\n return input;\n};\n\nmodule.exports = Bin;", "var df = require('vega-dataflow'),\n Tuple = df.Tuple,\n log = require('vega-logging'),\n Transform = require('./Transform');\n\nfunction CountPattern(graph) {\n Transform.prototype.init.call(this, graph);\n Transform.addParameters(this, {\n field: {type: 'field', default: 'data'},\n pattern: {type: 'value', default: '[\\\\w\\']+'},\n case: {type: 'value', default: 'lower'},\n stopwords: {type: 'value', default: ''}\n });\n\n this._output = {text: 'text', count: 'count'};\n\n return this.router(true).produces(true);\n}\n\nvar prototype = (CountPattern.prototype = Object.create(Transform.prototype));\nprototype.constructor = CountPattern;\n\nprototype.transform = function(input, reset) {\n log.debug(input, ['countpattern']);\n\n var get = this.param('field').accessor,\n pattern = this.param('pattern'),\n stop = this.param('stopwords'),\n rem = false;\n\n // update parameters\n if (this._stop !== stop) {\n this._stop = stop;\n this._stop_re = new RegExp('^' + stop + '$', 'i');\n reset = true;\n }\n\n if (this._pattern !== pattern) {\n this._pattern = pattern;\n this._match = new RegExp(this._pattern, 'g');\n reset = true;\n }\n\n if (reset) this._counts = {};\n\n function curr(t) { return (Tuple.prev_init(t), get(t)); }\n function prev(t) { return get(Tuple.prev(t)); }\n\n this._add(input.add, curr);\n if (!reset) this._rem(input.rem, prev);\n if (reset || (rem = input.fields[get.field])) {\n if (rem) this._rem(input.mod, prev);\n this._add(input.mod, curr);\n }\n\n // generate output tuples\n return this._changeset(input);\n};\n\nprototype._changeset = function(input) {\n var counts = this._counts,\n tuples = this._tuples || (this._tuples = {}),\n change = df.ChangeSet.create(input),\n out = this._output, w, t, c;\n\n for (w in counts) {\n t = tuples[w];\n c = counts[w] || 0;\n if (!t && c) {\n tuples[w] = (t = Tuple.ingest({}));\n t[out.text] = w;\n t[out.count] = c;\n change.add.push(t);\n } else if (c === 0) {\n if (t) change.rem.push(t);\n delete counts[w];\n delete tuples[w];\n } else if (t[out.count] !== c) {\n Tuple.set(t, out.count, c);\n change.mod.push(t);\n }\n }\n return change;\n};\n\nprototype._tokenize = function(text) {\n switch (this.param('case')) {\n case 'upper': text = text.toUpperCase(); break;\n case 'lower': text = text.toLowerCase(); break;\n }\n return text.match(this._match);\n};\n\nprototype._add = function(tuples, get) {\n var counts = this._counts,\n stop = this._stop_re,\n tok, i, j, t;\n\n for (j=0; j c.s) { // Removed tuples haven't been filtered yet\n c.c = c.c.filter(function(y) {\n var t = y[cross._output[left ? 'right' : 'left']];\n return cross._cache[t._id] !== null;\n });\n c.s = this._lastRem;\n }\n\n output.mod.push.apply(output.mod, c.c);\n}\n\nfunction rem(output, x) {\n output.rem.push.apply(output.rem, this._cache[x._id].c);\n this._cache[x._id] = null;\n this._lastRem = this._stamp;\n}\n\nfunction upFields(input, output) {\n if (input.add.length || input.rem.length) {\n output.fields[this._output.left] = 1; \n output.fields[this._output.right] = 1;\n }\n}\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['crossing']);\n\n var w = this.param('with'),\n f = this.param('filter'),\n diag = this.param('diagonal'),\n graph = this._graph,\n signals = graph.values(SIGNALS, this.dependency(SIGNALS)),\n test = f ? function(x) {return f(x, null, signals); } : null,\n selfCross = (!w.name),\n woutput = selfCross ? input : w.source.last(),\n wdata = selfCross ? data : w.source.values(),\n output = ChangeSet.create(input),\n r = rem.bind(this, output);\n\n input.rem.forEach(r);\n input.add.forEach(add.bind(this, output, true, wdata, diag, test));\n\n if (!selfCross && woutput.stamp > this._lastWith) {\n woutput.rem.forEach(r);\n woutput.add.forEach(add.bind(this, output, false, data, diag, test));\n woutput.mod.forEach(mod.bind(this, output, false));\n upFields.call(this, woutput, output);\n this._lastWith = woutput.stamp;\n }\n\n // Mods need to come after all removals have been run.\n input.mod.forEach(mod.bind(this, output, true));\n upFields.call(this, input, output);\n\n return output;\n};\n\nmodule.exports = Cross;", "var Transform = require('./Transform'),\n Aggregate = require('./Aggregate');\n\nfunction Facet(graph) {\n Transform.addParameters(this, {\n transform: {\n type: \"custom\",\n set: function(pipeline) {\n return (this._transform._pipeline = pipeline, this._transform);\n },\n get: function() {\n var parse = require('../parse/transforms'),\n facet = this._transform;\n return facet._pipeline.map(function(t) {\n return parse(facet._graph, t);\n });\n } \n }\n });\n\n this._pipeline = [];\n return Aggregate.call(this, graph);\n}\n\nvar prototype = (Facet.prototype = Object.create(Aggregate.prototype));\nprototype.constructor = Facet;\n\nprototype.aggr = function() {\n return Aggregate.prototype.aggr.call(this).facet(this);\n};\n\nmodule.exports = Facet;", @@ -276,6 +281,7 @@ "var df = require('vega-dataflow'),\n Tuple = df.Tuple,\n SIGNALS = df.Dependencies.SIGNALS,\n log = require('vega-logging'),\n Transform = require('./Transform');\n\nfunction Formula(graph) {\n Transform.prototype.init.call(this, graph);\n Transform.addParameters(this, {\n field: {type: 'value'},\n expr: {type: 'expr'}\n });\n\n return this.mutates(true);\n}\n\nvar prototype = (Formula.prototype = Object.create(Transform.prototype));\nprototype.constructor = Formula;\n\nprototype.transform = function(input) {\n log.debug(input, ['formulating']);\n\n var g = this._graph,\n field = this.param('field'),\n expr = this.param('expr'),\n signals = g.values(SIGNALS, this.dependency(SIGNALS));\n\n function set(x) {\n Tuple.set(x, field, expr(x, null, signals));\n }\n\n input.add.forEach(set);\n \n if (this.reevaluate(input)) {\n input.mod.forEach(set);\n }\n\n input.fields[field] = 1;\n return input;\n};\n\nmodule.exports = Formula;", "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n Tuple = require('vega-dataflow').Tuple,\n log = require('vega-logging'),\n Transform = require('./Transform');\n\nfunction Geo(graph) {\n Transform.prototype.init.call(this, graph);\n Transform.addParameters(this, Geo.Parameters);\n Transform.addParameters(this, {\n lon: {type: 'field'},\n lat: {type: 'field'}\n });\n\n this._output = {\n 'x': 'layout_x',\n 'y': 'layout_y'\n };\n return this.mutates(true);\n}\n\nGeo.Parameters = {\n projection: {type: 'value', default: 'mercator'},\n center: {type: 'array'},\n translate: {type: 'array'},\n rotate: {type: 'array'},\n scale: {type: 'value'},\n precision: {type: 'value'},\n clipAngle: {type: 'value'},\n clipExtent: {type: 'value'}\n};\n\nGeo.d3Projection = function() {\n var p = this.param('projection'),\n param = Geo.Parameters,\n proj, name, value;\n\n if (p !== this._mode) {\n this._mode = p;\n this._projection = d3.geo[p]();\n }\n proj = this._projection;\n\n for (name in param) {\n if (name === 'projection' || !proj[name]) continue;\n value = this.param(name);\n if (value === undefined || (dl.isArray(value) && value.length === 0)) {\n continue;\n }\n if (value !== proj[name]()) {\n proj[name](value);\n }\n }\n\n return proj;\n};\n\nvar prototype = (Geo.prototype = Object.create(Transform.prototype));\nprototype.constructor = Geo;\n\nprototype.transform = function(input) {\n log.debug(input, ['geo']);\n\n var output = this._output,\n lon = this.param('lon').accessor,\n lat = this.param('lat').accessor,\n proj = Geo.d3Projection.call(this);\n\n function set(t) {\n var ll = [lon(t), lat(t)];\n var xy = proj(ll) || [null, null];\n Tuple.set(t, output.x, xy[0]);\n Tuple.set(t, output.y, xy[1]);\n }\n\n input.add.forEach(set);\n if (this.reevaluate(input)) {\n input.mod.forEach(set);\n input.rem.forEach(set);\n }\n\n input.fields[output.x] = 1;\n input.fields[output.y] = 1;\n return input;\n};\n\nmodule.exports = Geo;", "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n dl = require('datalib'),\n Tuple = require('vega-dataflow').Tuple,\n log = require('vega-logging'),\n Geo = require('./Geo'),\n Transform = require('./Transform');\n\nfunction GeoPath(graph) {\n Transform.prototype.init.call(this, graph);\n Transform.addParameters(this, Geo.Parameters);\n Transform.addParameters(this, {\n field: {type: 'field', default: null},\n });\n\n this._output = {\n 'path': 'layout_path'\n };\n return this.mutates(true);\n}\n\nvar prototype = (GeoPath.prototype = Object.create(Transform.prototype));\nprototype.constructor = GeoPath;\n\nprototype.transform = function(input) {\n log.debug(input, ['geopath']);\n\n var output = this._output,\n geojson = this.param('field').accessor || dl.identity,\n proj = Geo.d3Projection.call(this),\n path = d3.geo.path().projection(proj);\n\n function set(t) {\n Tuple.set(t, output.path, path(geojson(t)));\n }\n\n input.add.forEach(set);\n if (this.reevaluate(input)) {\n input.mod.forEach(set);\n input.rem.forEach(set);\n }\n\n input.fields[output.path] = 1;\n return input;\n};\n\nmodule.exports = GeoPath;", + "var dl = require('datalib'),\n log = require('vega-logging'),\n Tuple = require('vega-dataflow').Tuple,\n Transform = require('./Transform'),\n BatchTransform = require('./BatchTransform');\n\nfunction Impute(graph) {\n BatchTransform.prototype.init.call(this, graph);\n Transform.addParameters(this, {\n groupby: {type: 'array'},\n orderby: {type: 'array'},\n field: {type: 'field'},\n method: {type: 'value', default: 'value'},\n value: {type: 'value', default: 0}\n });\n\n return this.router(true).produces(true);\n}\n\nvar prototype = (Impute.prototype = Object.create(BatchTransform.prototype));\nprototype.constructor = Impute;\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['imputing']);\n\n var groupby = this.param('groupby'),\n orderby = this.param('orderby'),\n method = this.param('method'),\n value = this.param('value'),\n field = this.param('field'),\n get = field.accessor,\n name = field.field,\n prev = this._imputed || [], curr = [],\n groups = partition(data, groupby.accessor, orderby.accessor),\n domain = groups.domain,\n group, i, j, n, m, t;\n\n function getval(x) {\n return x == null ? null : get(x);\n }\n\n for (j=0, m=groups.length; j'},\n keys: {type: 'array', default: ['data']},\n default: {type: 'value'}\n });\n\n return this.mutates(true);\n}\n\nvar prototype = (Lookup.prototype = Object.create(Transform.prototype));\nprototype.constructor = Lookup;\n\nprototype.transform = function(input, reset) {\n log.debug(input, ['lookup']);\n\n var on = this.param('on'),\n onLast = on.source.last(),\n onData = on.source.values(),\n onKey = this.param('onKey'),\n onF = onKey.field,\n keys = this.param('keys'),\n get = keys.accessor,\n as = this.param('as'),\n defaultValue = this.param('default'),\n lut = this._lut,\n i, v;\n\n // build lookup table on init, withKey modified, or tuple add/rem\n if (lut == null || this._on !== onF || onF && onLast.fields[onF] ||\n onLast.add.length || onLast.rem.length)\n {\n if (onF) { // build hash from withKey field\n onKey = onKey.accessor;\n for (lut={}, i=0; i', default: ['-value']},\n children: {type: 'field', default: 'children'},\n field: {type: 'field', default: 'value'},\n // treemap parameters\n size: {type: 'array', default: [500, 500]},\n round: {type: 'value', default: true},\n sticky: {type: 'value', default: false},\n ratio: {type: 'value', default: defaultRatio},\n padding: {type: 'value', default: null},\n mode: {type: 'value', default: 'squarify'}\n });\n\n this._layout = d3.layout.treemap();\n\n this._output = {\n 'x': 'layout_x',\n 'y': 'layout_y',\n 'width': 'layout_width',\n 'height': 'layout_height',\n 'depth': 'layout_depth',\n };\n return this.mutates(true);\n}\n\nvar prototype = (Treemap.prototype = Object.create(BatchTransform.prototype));\nprototype.constructor = Treemap;\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['treemap']);\n\n // get variables\n var layout = this._layout,\n output = this._output;\n\n // configure layout\n layout\n .sort(dl.comparator(this.param('sort').field))\n .children(this.param('children').accessor)\n .value(this.param('field').accessor)\n .size(this.param('size'))\n .round(this.param('round'))\n .sticky(this.param('sticky'))\n .ratio(this.param('ratio'))\n .padding(this.param('padding'))\n .mode(this.param('mode'))\n .nodes(data[0]);\n\n // copy layout values to nodes\n data.forEach(function(n) {\n Tuple.set(n, output.x, n.x);\n Tuple.set(n, output.y, n.y);\n Tuple.set(n, output.width, n.dx);\n Tuple.set(n, output.height, n.dy);\n Tuple.set(n, output.depth, n.depth);\n });\n\n // return changeset\n input.fields[output.x] = 1;\n input.fields[output.y] = 1;\n input.fields[output.width] = 1;\n input.fields[output.height] = 1;\n return input;\n};\n\nmodule.exports = Treemap;", "var d3 = (typeof window !== \"undefined\" ? window['d3'] : typeof global !== \"undefined\" ? global['d3'] : null),\n Tuple = require('vega-dataflow/src/Tuple'),\n log = require('vega-logging'),\n Transform = require('./Transform'),\n BatchTransform = require('./BatchTransform');\n\nfunction Voronoi(graph) {\n BatchTransform.prototype.init.call(this, graph);\n Transform.addParameters(this, {\n clipExtent: {type: 'array', default: [[-1e5,-1e5],[1e5,1e5]]},\n x: {type: 'field', default: 'layout_x'},\n y: {type: 'field', default: 'layout_y'}\n });\n\n this._layout = d3.geom.voronoi();\n this._output = {'path': 'layout_path'};\n\n return this.mutates(true);\n}\n\nvar prototype = (Voronoi.prototype = Object.create(BatchTransform.prototype));\nprototype.constructor = Voronoi;\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['voronoi']);\n\n // get variables\n var pathname = this._output.path;\n\n // configure layout\n var polygons = this._layout\n .clipExtent(this.param('clipExtent'))\n .x(this.param('x').accessor)\n .y(this.param('y').accessor)\n (data);\n\n // build and assign path strings\n for (var i=0; i', default: [900, 500]},\n text: {type: 'field', default: 'data'},\n rotate: {type: 'field|value', default: 0},\n font: {type: 'field|value', default: {value: 'sans-serif'}},\n fontSize: {type: 'field|value', default: 14},\n fontStyle: {type: 'field|value', default: {value: 'normal'}},\n fontWeight: {type: 'field|value', default: {value: 'normal'}},\n fontScale: {type: 'array', default: [10, 50]},\n padding: {type: 'value', default: 1},\n spiral: {type: 'value', default: 'archimedean'}\n });\n\n this._layout = d3_cloud();\n\n this._output = {\n 'x': 'layout_x',\n 'y': 'layout_y',\n 'font': 'layout_font',\n 'fontSize': 'layout_fontSize',\n 'fontStyle': 'layout_fontStyle',\n 'fontWeight': 'layout_fontWeight',\n 'rotate': 'layout_rotate',\n };\n\n return this.mutates(true);\n}\n\nvar prototype = (Wordcloud.prototype = Object.create(BatchTransform.prototype));\nprototype.constructor = Wordcloud;\n\nfunction get(p) {\n return (p && p.accessor) || p;\n}\n\nfunction wrap(tuple) {\n var x = Object.create(tuple);\n x._tuple = tuple;\n return x;\n}\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['wordcloud']);\n\n // get variables\n var layout = this._layout,\n output = this._output,\n fontSize = this.param('fontSize'),\n range = fontSize.accessor && this.param('fontScale'),\n size, scale;\n fontSize = fontSize.accessor || d3.functor(fontSize);\n \n // create font size scaling function as needed\n if (range.length) {\n scale = d3.scale.sqrt()\n .domain(dl.extent(data, size=fontSize))\n .range(range);\n fontSize = function(x) { return scale(size(x)); };\n }\n\n // configure layout\n layout\n .size(this.param('size'))\n .text(get(this.param('text')))\n .padding(this.param('padding'))\n .spiral(this.param('spiral'))\n .rotate(get(this.param('rotate')))\n .font(get(this.param('font')))\n .fontStyle(get(this.param('fontStyle')))\n .fontWeight(get(this.param('fontWeight')))\n .fontSize(fontSize)\n .words(data.map(wrap)) // wrap to avoid tuple writes\n .on('end', function(words) {\n var size = layout.size(),\n dx = size[0] >> 1,\n dy = size[1] >> 1,\n w, t, i, len;\n\n for (i=0, len=words.length; i', default: [900, 500]},\n text: {type: 'field', default: 'data'},\n rotate: {type: 'field|value', default: 0},\n font: {type: 'field|value', default: {value: 'sans-serif'}},\n fontSize: {type: 'field|value', default: 14},\n fontStyle: {type: 'field|value', default: {value: 'normal'}},\n fontWeight: {type: 'field|value', default: {value: 'normal'}},\n fontScale: {type: 'array', default: [10, 50]},\n padding: {type: 'value', default: 1},\n spiral: {type: 'value', default: 'archimedean'}\n });\n\n this._layout = d3_cloud().canvas(canvas.instance);\n\n this._output = {\n 'x': 'layout_x',\n 'y': 'layout_y',\n 'font': 'layout_font',\n 'fontSize': 'layout_fontSize',\n 'fontStyle': 'layout_fontStyle',\n 'fontWeight': 'layout_fontWeight',\n 'rotate': 'layout_rotate',\n };\n\n return this.mutates(true);\n}\n\nvar prototype = (Wordcloud.prototype = Object.create(BatchTransform.prototype));\nprototype.constructor = Wordcloud;\n\nfunction get(p) {\n return (p && p.accessor) || p;\n}\n\nfunction wrap(tuple) {\n var x = Object.create(tuple);\n x._tuple = tuple;\n return x;\n}\n\nprototype.batchTransform = function(input, data) {\n log.debug(input, ['wordcloud']);\n\n // get variables\n var layout = this._layout,\n output = this._output,\n fontSize = this.param('fontSize'),\n range = fontSize.accessor && this.param('fontScale'),\n size, scale;\n fontSize = fontSize.accessor || d3.functor(fontSize);\n \n // create font size scaling function as needed\n if (range.length) {\n scale = d3.scale.sqrt()\n .domain(dl.extent(data, size=fontSize))\n .range(range);\n fontSize = function(x) { return scale(size(x)); };\n }\n\n // configure layout\n layout\n .size(this.param('size'))\n .text(get(this.param('text')))\n .padding(this.param('padding'))\n .spiral(this.param('spiral'))\n .rotate(get(this.param('rotate')))\n .font(get(this.param('font')))\n .fontStyle(get(this.param('fontStyle')))\n .fontWeight(get(this.param('fontWeight')))\n .fontSize(fontSize)\n .words(data.map(wrap)) // wrap to avoid tuple writes\n .on('end', function(words) {\n var size = layout.size(),\n dx = size[0] >> 1,\n dy = size[1] >> 1,\n w, t, i, len;\n\n for (i=0, len=words.length; i=l)return s;if(i)return i=!1,a;var t=c;if(34===e.charCodeAt(t)){for(var n=t;n++c;){var r=e.charCodeAt(c++),o=1;if(10===r)i=!0;else if(13===r)i=!0,10===e.charCodeAt(c)&&(++c,++o);else if(r!==u)continue;return e.slice(t,c-o)}return e.slice(t)}for(var r,i,a={},s={},o=[],l=e.length,c=0,d=0;(r=n())!==s;){for(var f=[];r!==a&&r!==s;)f.push(r),r=n();t&&null==(f=t(f,d++))||o.push(f)}return o}function r(t){if(Array.isArray(t[0]))return i(t);var n=Object.create(null),r=[];return t.forEach(function(e){for(var t in e)(t+="")in n||r.push(n[t]=t)}),[r.map(s).join(e)].concat(t.map(function(t){return r.map(function(e){return s(t[e])}).join(e)})).join("\n")}function i(e){return e.map(a).join("\n")}function a(t){return t.map(s).join(e)}function s(e){return o.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var o=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return{parse:t,parseRows:n,format:r,formatRows:i}};e.csv=t(","),e.tsv=t(" "),e.dsv=t})},{}],4:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof e&&e.amd?e(["exports"],i):i(t.format={})}(this,function(e){"use strict";function t(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function n(e){return e=t(Math.abs(e)),e?e[1]:NaN}function r(e,n){var r=t(e,n);if(!r)return e+"";var i=r[0],a=r[1],s=a-(g=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+t(e,n+s-1)[0]}function i(e,n){var r=t(e,n);if(!r)return e+"";var i=r[0],a=r[1];return 0>a?"0."+new Array(-a).join("0")+i:i.length>a+1?i.slice(0,a+1)+"."+i.slice(a+1):i+new Array(a-i.length+2).join("0")}function a(e,t){e=e.toPrecision(t);e:for(var n,r=e.length,i=1,a=-1;r>i;++i)switch(e[i]){case".":a=n=i;break;case"0":0===a&&(a=i),n=i;break;case"e":break e;default:a>0&&(a=0)}return a>0?e.slice(0,a)+e.slice(n+1):e}function s(e){return new o(e)}function o(e){if(!(t=O.exec(e)))throw new Error("invalid format: "+e);var t,n=t[1]||" ",r=t[2]||">",i=t[3]||"-",a=t[4]||"",s=!!t[5],o=t[6]&&+t[6],u=!!t[7],l=t[8]&&+t[8].slice(1),c=t[9]||"";"n"===c?(u=!0,c="g"):I[c]||(c=""),(s||"0"===n&&"="===r)&&(s=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=i,this.symbol=a,this.zero=s,this.width=o,this.comma=u,this.precision=l,this.type=c}function u(e,t){return function(n,r){for(var i=n.length,a=[],s=0,o=e[0],u=0;i>0&&o>0&&(u+o+1>r&&(o=Math.max(1,r-u)),a.push(n.substring(i-=o,i+o)),!((u+=o+1)>r));)o=e[s=(s+1)%e.length];return a.reverse().join(t)}}function l(e){return e}function c(e){function t(e){e=s(e);var t=e.fill,n=e.align,r=e.sign,u=e.symbol,l=e.zero,c=e.width,d=e.comma,f=e.precision,h=e.type,p="$"===u?a[0]:"#"===u&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",m="$"===u?a[1]:/[%p]/.test(h)?"%":"",v=I[h],y=!h||/[defgprs%]/.test(h);return f=null==f?h?6:12:/[gprs]/.test(h)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),function(e){var a=p,s=m;if("c"===h)s=v(e)+s,e="";else{e=+e;var u=(0>e||0>1/e)&&(e*=-1,!0);if(e=v(e,f),a=(u?"("===r?r:"-":"-"===r||"("===r?"":r)+a,s=s+("s"===h?j[8+g/3]:"")+(u&&"("===r?")":""),y)for(var _,b=-1,x=e.length;++b_||_>57){s=(46===_?o+e.slice(b+1):e.slice(b))+s,e=e.slice(0,b);break}}d&&!l&&(e=i(e,1/0));var w=a.length+e.length+s.length,k=c>w?new Array(c-w+1).join(t):"";switch(d&&l&&(e=i(k+e,k.length?c-s.length:1/0),k=""),n){case"<":return a+e+s+k;case"=":return a+k+e+s;case"^":return k.slice(0,w=k.length>>1)+a+e+s+k.slice(w)}return k+a+e+s}}function r(e,r){var i=t((e=s(e),e.type="f",e)),a=3*Math.max(-8,Math.min(8,Math.floor(n(r)/3))),o=Math.pow(10,-a),u=j[8+a/3];return function(e){return i(o*e)+u}}var i=e.grouping&&e.thousands?u(e.grouping,e.thousands):l,a=e.currency,o=e.decimal;return{format:t,formatPrefix:r}}function d(e,t){return Math.max(0,n(Math.abs(t))-n(Math.abs(e)))+1}function f(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(t)/3)))-n(Math.abs(e)))}function h(e){return Math.max(0,-n(Math.abs(e)))}function p(e){return"string"!=typeof e||(e=U.get(e))?c(e):null}var g,m={decimal:".",thousands:",",grouping:[3],currency:["¥",""]},v={decimal:",",thousands:" ",grouping:[3],currency:[""," руб."]},y={decimal:",",thousands:".",grouping:[3],currency:["R$",""]},_={decimal:",",thousands:".",grouping:[3],currency:["","zł"]},b={decimal:",",thousands:".",grouping:[3],currency:["€ ",""]},x={decimal:",",thousands:".",grouping:[3],currency:[""," ден."]},w={decimal:".",thousands:",",grouping:[3],currency:["","円"]},k={decimal:",",thousands:".",grouping:[3],currency:["€",""]},S={decimal:".",thousands:",",grouping:[3],currency:["₪",""]},M={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},T={decimal:",",thousands:" ",grouping:[3],currency:["","$"]},A={decimal:",",thousands:" ",grouping:[3],currency:[""," €"]},E={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},L={decimal:".",thousands:",",grouping:[3],currency:["$",""]},C={decimal:".",thousands:",",grouping:[3],currency:["£",""]},D={decimal:".",thousands:",",grouping:[3],currency:["$",""]},P={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},N={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},I={"":a,"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return i(100*e,t)},r:i,s:r,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},O=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;o.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var j=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],U=(new Map).set("ca-ES",N).set("de-DE",P).set("en-CA",D).set("en-GB",C).set("en-US",L).set("es-ES",E).set("fi-FI",A).set("fr-CA",T).set("fr-FR",M).set("he-IL",S).set("it-IT",k).set("ja-JP",w).set("mk-MK",x).set("nl-NL",b).set("pl-PL",_).set("pt-BR",y).set("ru-RU",v).set("zh-CN",m),z=c(L);e.format=z.format,e.formatPrefix=z.formatPrefix,e.localeFormat=p,e.formatSpecifier=s,e.precisionFixed=h,e.precisionPrefix=f,e.precisionRound=d})},{}],5:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof e&&e.amd?e(["exports"],i):i(t.timeFormat={})}(this,function(e){"use strict";function t(e,n,r){function i(t){return e(t=new Date(+t)),t}return i.floor=i,i.round=function(t){var r=new Date(+t),i=new Date(t-1);return e(r),e(i),n(i,1),i-t>t-r?r:i},i.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},i.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},i.range=function(t,r,i){var a=[];if(t=new Date(t-1),r=new Date(+r),i=null==i?1:Math.floor(i),!(r>t&&i>0))return a;for(n(t,1),e(t),r>t&&a.push(new Date(+t));n(t,i),e(t),r>t;)a.push(new Date(+t));return a},i.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(i.count=function(t,n){return xe.setTime(+t),we.setTime(+n),e(xe),e(we),Math.floor(r(xe,we))}),i}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}function i(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function a(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function s(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function o(e){function t(e,t){return function(n){for(var r,i,a,s=[],o=-1,u=0,l=e.length;++os;){if(r>=u)return-1;if(i=t.charCodeAt(s++),37===i){if(i=t.charAt(s++),a=je[i in De?t.charAt(s++):i],!a||(r=a(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function o(e,t,n){var r=Ae.exec(t.slice(n));return r?(e.w=Ee.get(r[0].toLowerCase()),n+r[0].length):-1}function u(e,t,n){var r=Me.exec(t.slice(n));return r?(e.w=Te.get(r[0].toLowerCase()),n+r[0].length):-1}function l(e,t,n){var r=Pe.exec(t.slice(n));return r?(e.m=Ne.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,t,n){var r=Le.exec(t.slice(n));return r?(e.m=Ce.get(r[0].toLowerCase()),n+r[0].length):-1}function ne(e,t,n){return r(e,me,t,n)}function re(e,t,n){return r(e,ve,t,n)}function ie(e,t,n){return r(e,ye,t,n)}function ae(e,t,n){var r=Se.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}function se(e){return xe[e.getDay()]}function oe(e){return be[e.getDay()]}function ue(e){return ke[e.getMonth()]}function le(e){return we[e.getMonth()]}function ce(e){return _e[+(e.getHours()>=12)]}function de(e){return xe[e.getUTCDay()]}function fe(e){return be[e.getUTCDay()]}function he(e){return ke[e.getUTCMonth()]}function pe(e){return we[e.getUTCMonth()]}function ge(e){return _e[+(e.getUTCHours()>=12)]}var me=e.dateTime,ve=e.date,ye=e.time,_e=e.periods,be=e.days,xe=e.shortDays,we=e.months,ke=e.shortMonths,Se=d(_e),Me=c(be),Te=d(be),Ae=c(xe),Ee=d(xe),Le=c(we),Ce=d(we),Pe=c(ke),Ne=d(ke),Ie={a:se,A:oe,b:ue,B:le,c:null,d:T,e:T,H:A,I:E,j:L,L:C,m:D,M:P,p:ce,S:N,U:I,w:O,W:j,x:null,X:null,y:U,Y:z,Z:F,"%":ee},Oe={a:de,A:fe,b:he,B:pe,c:null,d:R,e:R,H:q,I:G,j:B,L:$,m:Y,M:H,p:ge,S:V,U:W,w:X,W:J,x:null,X:null,y:K,Y:Z,Z:Q,"%":ee},je={a:o,A:u,b:l,B:te,c:ne,d:_,e:_,H:x,I:x,j:b,L:S,m:y,M:w,p:ae,S:k,U:h,w:f,W:p,x:re,X:ie,y:m,Y:g,Z:v,"%":M};return Ie.x=t(ve,Ie),Ie.X=t(ye,Ie),Ie.c=t(me,Ie),Oe.x=t(ve,Oe),Oe.X=t(ye,Oe),Oe.c=t(me,Oe),{format:function(e){var r=t(e+="",Ie);return r.parse=n(e,i),r.toString=function(){return e},r},utcFormat:function(e){var r=t(e+="",Oe);return r.parse=n(e,a),r.toString=function(){return e},r}}}function u(e,t,n){var r=0>e?"-":"",i=(r?-e:e)+"",a=i.length;return r+(n>a?new Array(n-a+1).join(t)+i:i)}function l(e){return e.replace(Ie,"\\$&")}function c(e){return new RegExp("^(?:"+e.map(l).join("|")+")","i")}function d(e){for(var t=new Map,n=-1,r=e.length;++n68?1900:2e3),n+r[0].length):-1}function v(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function y(e,t,n){var r=Pe.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function _(e,t,n){var r=Pe.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function b(e,t,n){var r=Pe.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function x(e,t,n){var r=Pe.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function w(e,t,n){var r=Pe.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function k(e,t,n){var r=Pe.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function S(e,t,n){var r=Pe.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function M(e,t,n){var r=Ne.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function T(e,t){return u(e.getDate(),t,2)}function A(e,t){return u(e.getHours(),t,2)}function E(e,t){return u(e.getHours()%12||12,t,2)}function L(e,t){return u(1+ke.count(Te(e),e),t,3)}function C(e,t){return u(e.getMilliseconds(),t,3)}function D(e,t){return u(e.getMonth()+1,t,2)}function P(e,t){return u(e.getMinutes(),t,2)}function N(e,t){return u(e.getSeconds(),t,2)}function I(e,t){return u(Se.count(Te(e),e),t,2)}function O(e){return e.getDay()}function j(e,t){return u(Me.count(Te(e),e),t,2)}function U(e,t){return u(e.getFullYear()%100,t,2)}function z(e,t){return u(e.getFullYear()%1e4,t,4)}function F(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+u(t/60|0,"0",2)+u(t%60,"0",2)}function R(e,t){return u(e.getUTCDate(),t,2)}function q(e,t){return u(e.getUTCHours(),t,2)}function G(e,t){return u(e.getUTCHours()%12||12,t,2)}function B(e,t){return u(1+Ae.count(Ce(e),e),t,3)}function $(e,t){return u(e.getUTCMilliseconds(),t,3)}function Y(e,t){return u(e.getUTCMonth()+1,t,2)}function H(e,t){return u(e.getUTCMinutes(),t,2)}function V(e,t){return u(e.getUTCSeconds(),t,2)}function W(e,t){return u(Ee.count(Ce(e),e),t,2)}function X(e){return e.getUTCDay()}function J(e,t){return u(Le.count(Ce(e),e),t,2)}function K(e,t){return u(e.getUTCFullYear()%100,t,2)}function Z(e,t){return u(e.getUTCFullYear()%1e4,t,4)}function Q(){return"+0000"}function ee(){return"%"}function te(e){return e.toISOString()}function ne(e){return"string"!=typeof e||(e=ze.get(e))?o(e):null}var re={dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},ie={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]},ae={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"]},se={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."]},oe={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"]},ue={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]},le={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月"]},ce={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"]},de={dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]},fe={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."]},he={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"]},pe={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"]},ge={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"]},me={dateTime:"%a %b %e %X %Y",date:"%m/%d/%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"]},ve={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"]},ye={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"]},_e={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"]},be={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."]},xe=new Date,we=new Date,ke=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),Se=n(0),Me=n(1),Te=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()}),Ae=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5}),Ee=r(0),Le=r(1),Ce=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),De={"-":"",_:" ",0:"0"},Pe=/^\s*\d+/,Ne=/^%/,Ie=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Oe="%Y-%m-%dT%H:%M:%S.%LZ";te.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},te.toString=function(){return Oe};var je=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?te:me.utcFormat(Oe),Ue=je,ze=(new Map).set("ca-ES",be).set("de-DE",_e).set("en-CA",ye).set("en-GB",ve).set("en-US",me).set("es-ES",ge).set("fi-FI",pe).set("fr-CA",he).set("fr-FR",fe).set("he-IL",de).set("it-IT",ce).set("ja-JP",le).set("mk-MK",ue).set("nl-NL",oe).set("pl-PL",se).set("pt-BR",ae).set("ru-RU",ie).set("zh-CN",re),Fe=o(me);e.format=Fe.format,e.utcFormat=Fe.utcFormat,e.localeFormat=ne,e.isoFormat=Ue})},{}],6:[function(t,n,r){!function(t,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof e&&e.amd?e(["exports"],i):i(t.time={})}(this,function(e){"use strict";function t(e,n,r){function s(t){return e(t=new Date(+t)),t}return s.floor=s,s.round=function(t){var r=new Date(+t),i=new Date(t-1);return e(r),e(i),n(i,1),i-t>t-r?r:i},s.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},s.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},s.range=function(t,r,i){var a=[];if(t=new Date(t-1),r=new Date(+r),i=null==i?1:Math.floor(i),!(r>t&&i>0))return a;for(n(t,1),e(t),r>t&&a.push(new Date(+t));n(t,i),e(t),r>t;)a.push(new Date(+t));return a},s.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(s.count=function(t,n){return a.setTime(+t),i.setTime(+n),e(a),e(i),Math.floor(r(a,i))}),s}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}var i=new Date,a=new Date,s=t(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3});e.seconds=s.range;var o=t(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4});e.minutes=o.range;var u=t(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5});e.hours=u.range;var l=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5});e.days=l.range,e.sunday=n(0),e.sundays=e.sunday.range,e.monday=n(1),e.mondays=e.monday.range,e.tuesday=n(2),e.tuesdays=e.tuesday.range,e.wednesday=n(3),e.wednesdays=e.wednesday.range,e.thursday=n(4),e.thursdays=e.thursday.range,e.friday=n(5),e.fridays=e.friday.range,e.saturday=n(6),e.saturdays=e.saturday.range;var c=e.sunday;e.weeks=c.range;var d=t(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())});e.months=d.range;var f=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()});e.years=f.range;var h=t(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3});e.utcSeconds=h.range;var p=t(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4});e.utcMinutes=p.range;var g=t(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5});e.utcHours=g.range;var m=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5});e.utcDays=m.range,e.utcSunday=r(0),e.utcSundays=e.utcSunday.range,e.utcMonday=r(1),e.utcMondays=e.utcMonday.range,e.utcTuesday=r(2),e.utcTuesdays=e.utcTuesday.range,e.utcWednesday=r(3),e.utcWednesdays=e.utcWednesday.range,e.utcThursday=r(4),e.utcThursdays=e.utcThursday.range,e.utcFriday=r(5),e.utcFridays=e.utcFriday.range,e.utcSaturday=r(6),e.utcSaturdays=e.utcSaturday.range;var v=e.utcSunday;e.utcWeeks=v.range;var y=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())});e.utcMonths=y.range;var _=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()});e.utcYears=_.range,e.interval=t,e.second=s,e.minute=o,e.hour=u,e.day=l,e.week=c,e.month=d,e.year=f,e.utcSecond=h,e.utcMinute=p,e.utcHour=g,e.utcDay=m,e.utcWeek=v,e.utcMonth=y,e.utcYear=_})},{}],7:[function(e,t,n){function r(){this._cells={},this._aggr=[],this._stream=!1}function i(e){if(a.isArray(e))return e;if(null==e)return[];var t,n,r=[];for(t in e)n=a.array(e[t]),r.push({name:t,ops:n});return r}var a=e("../util"),s=e("./measures"),o=e("./collector"),u=r.Flags={ADD_CELL:1,MOD_CELL:2},l=r.prototype;l.stream=function(e){return null==e?this._stream:(this._stream=!!e,this._aggr=[],this)},l.key=function(e){return null==e?this._key:(this._key=a.$(e),this)},l.groupby=function(e){return this._dims=a.array(e).map(function(e,t){if(e=a.isString(e)?{name:e,get:a.$(e)}:a.isFunction(e)?{name:a.name(e)||e.name||"_"+t,get:e}:e.name&&a.isFunction(e.get)?e:null,null==e)throw"Invalid groupby argument: "+e;return e}),this.clear()},l.summarize=function(e){e=i(e),this._count=!0;var t,n,r,o,u,l,c,d=this._aggr=[];for(r=0;rt;++t)i+="|"+n[t].get(e);return i},l._cell=function(e){var t=this._dims.length?this._cellkey(e):"";return this._cells[t]||(this._cells[t]=this._newcell(e,t))},l._newcell=function(e,t){var n,r={num:0,tuple:this._newtuple(e,t),flag:u.ADD_CELL,aggs:{}},i=this._aggr;for(n=0;nt;++t)i[r[t].name]=r[t].get(e);return this._ingest(i)},l._ingest=a.identity,l._add=function(e){ -var t,n=this._cell(e),r=this._aggr;if(n.num+=1,!this._count)for(n.collect&&n.data.add(e),t=0;t0){for(e.collect&&e.data.values(),t=0;te;++e)r.hasOwnProperty(l(o[e]))||(c[t++]=o[e]);else{for(e=0,n=u.length;n>e;++e)u[e][s]=1;for(e=0,t=0,n=o.length;n>e;++e)o[e][s]||(c[t++]=o[e]);for(e=0,n=u.length;n>e;++e)delete u[e][s]}else for(r=a.count.map(u),e=0,t=0,n=o.length;n>e;++e)r[o[e]]>0?r[o[e]]-=1:c[t++]=o[e];return this._rem=[],this._add=c},o.extent=function(e){if(this._get!==e||!this._ext){var t=this.values(),n=a.extent.index(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},o.argmin=function(e){return this.extent(e)[0]},o.argmax=function(e){return this.extent(e)[1]},o.min=function(e){var t=this.extent(e)[0];return t?e(t):+(1/0)},o.max=function(e){var t=this.extent(e)[1];return t?e(t):-(1/0)},o.quartile=function(e){return this._get===e&&this._q||(this._q=a.quartile(this.values(),e),this._get=e),this._q},o.q1=function(e){return this.quartile(e)[0]},o.q2=function(e){return this.quartile(e)[1]},o.q3=function(e){return this.quartile(e)[2]},t.exports=r},{"../stats":26,"../util":29}],9:[function(e,t,n){var r=e("../util"),i=e("./aggregator");t.exports=function(){var e=[].reduce.call(arguments,function(e,t){return e.concat(r.array(t))},[]);return(new i).groupby(e).summarize({"*":"values"})}},{"../util":29,"./aggregator":7}],10:[function(e,t,n){function r(e){return function(t){var n=s.extend({init:"",add:"",rem:"",idx:0},e);return n.out=t||e.name,n}}function i(e,t){function n(e,r){function i(t){e[t]||n(e,e[t]=o[t]())}return r.req&&r.req.forEach(i),t&&r.str&&r.str.forEach(i),e}var r=e.reduce(n,e.reduce(function(e,t){return e[t.name]=t,e},{}));return s.vals(r).sort(function(e,t){return e.idx-t.idx})}function a(t,n,r,a){var o=i(t,n),u="this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;",l="if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;",c="if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;",d="var t = this.tuple; var cell = this.cell;";return o.forEach(function(e){e.idx<0?(u=e.init+u,l=e.add+l,c=e.rem+c):(u+=e.init,l+=e.add,c+=e.rem)}),t.slice().sort(function(e,t){return e.idx-t.idx}).forEach(function(e){d+="this.assign(t,'"+e.out+"',"+e.set+");"}),d+="return t;",u=Function("cell","t",u),u.prototype.assign=a,u.prototype.add=Function("t","var v = this.get(t);"+l),u.prototype.rem=Function("t","var v = this.get(t);"+c),u.prototype.set=Function(d),u.prototype.get=r,u.prototype.distinct=e("../stats").count.distinct,u.prototype.isValid=s.isValid,u.fields=t.map(s.$("out")),u}var s=e("../util"),o={values:r({name:"values",init:"cell.collect = true;",set:"cell.data.values()",idx:-1}),count:r({name:"count",set:"cell.num"}),missing:r({name:"missing",set:"this.missing"}),valid:r({name:"valid",set:"this.valid"}),sum:r({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:r({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:r({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:r({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:r({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:r({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:r({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),median:r({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:r({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:r({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),distinct:r({name:"distinct",set:"this.distinct(cell.data.values(), this.get)",req:["values"],idx:3}),argmin:r({name:"argmin",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin = this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:r({name:"argmax",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax = this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:r({name:"min",init:"this.min = +Infinity;",add:"if (v < this.min) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:r({name:"max",init:"this.max = -Infinity;",add:"if (v > this.max) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4}),modeskew:r({name:"modeskew",set:"this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))",req:["mean","stdev","median"],idx:5})};o.create=a,t.exports=o},{"../stats":26,"../util":29}],11:[function(e,t,n){function r(e){if(!e)throw Error("Missing binning options.");var t,n,r,o,u,l,c,d=e.maxbins||15,f=e.base||10,h=Math.log(f),p=e.div||[5,2],g=e.min,m=e.max,v=m-g;if(e.step)t=e.step;else if(e.steps)t=e.steps[Math.min(e.steps.length-1,i(e.steps,v/d,0,e.steps.length))];else{n=Math.ceil(Math.log(d)/h),r=e.minstep||0,t=Math.max(r,Math.pow(f,Math.round(Math.log(v)/h)-n));do t*=f;while(Math.ceil(v/t)>d);for(l=0;l=r&&d>=v/u&&(t=u)}return u=Math.log(t),o=u>=0?0:~~(-u/h)+1,c=Math.pow(f,-o-1),g=Math.min(g,Math.floor(g/t+c)*t),m=Math.ceil(m/t)*t,{start:g,stop:m,step:t,unit:{precision:o},value:a,index:s}}function i(e,t,n,r){for(;r>n;){var i=n+r>>>1;l.cmp(e[i],t)<0?n=i+1:r=i}return n}function a(e){return this.step*Math.floor(e/this.step+d)}function s(e){return Math.floor((e-this.start)/this.step+d)}function o(e){return this.unit.date(a.call(this,e))}function u(e){return s.call(this,this.unit.unit(e))}var l=e("../util"),c=e("../time"),d=1e-15;r.date=function(e){if(!e)throw Error("Missing date binning options.");var t=e.utc?c.utc:c,n=e.min,i=e.max,a=e.maxbins||20,s=e.minbins||4,l=+i-+n,d=e.unit?t[e.unit]:t.find(l,s,a),f=r({min:null!=d.min?d.min:d.unit(n),max:null!=d.max?d.max:d.unit(i),maxbins:a,minstep:d.minstep,steps:d.step});return f.unit=d,f.index=u,e.raw||(f.value=o),f},t.exports=r},{"../time":28,"../util":29}],12:[function(e,t,n){function r(e,t,n){n=s(e,t,n);var r=a(n);return r?f.$func("bin",r.unit.unit?function(e){return r.value(r.unit.unit(e))}:function(e){return r.value(e)})(n.accessor):n.accessor||f.identity}function i(e,t,n){n=s(e,t,n);var r=a(n);return r?o(e,n.accessor,r):u(e,n.accessor,n&&n.sort)}function a(e){var t=e.type,n=null;return(null==t||p[t])&&("integer"===t&&null==e.minstep&&(e.minstep=1),n="date"===t?l.date(e):l(e)),n}function s(){var e=arguments,t=0,n=f.isArray(e[t])?e[t++]:null,r=f.isFunction(e[t])||f.isString(e[t])?f.$(e[t++]):null,i=f.extend({},e[t]);if(n&&(i.type=i.type||d(n,r),p[i.type])){var a=h.extent(n,r);i=f.extend({min:a[0],max:a[1]},i)}return r&&(i.accessor=r),i}function o(e,t,n){for(var r,i,a=c.range(n.start,n.stop+n.step/2,n.step).map(function(e){return{value:n.value(e),count:0}}),s=0;si||i>=a.length||!isFinite(i))continue;a[i].count+=1}return a.bins=n,a}function u(e,t,n){var r=h.unique(e,t),i=h.count.map(e,t);return r.map(function(e){return{value:e,count:i[e]}}).sort(f.comparator(n?"-count":"+value"))}var l=e("./bins"),c=e("../generate"),d=e("../import/type"),f=e("../util"),h=e("../stats"),p={integer:1,number:1,date:1};t.exports={$bin:r,histogram:i}},{"../generate":14,"../import/type":23,"../stats":26,"../util":29,"./bins":11}],13:[function(e,t,n){function r(e){var t=d.localeFormat(e);if(null==t)throw Error("Unrecognized locale: "+e);f=t}function i(e){var t=c.localeFormat(e);if(null==t)throw Error("Unrecognized locale: "+e);h=t}function a(e,t){e.length||(e=[0]),null==t&&(t=10);var n=e[0],r=e[e.length-1];n>r&&(s=r,r=n,n=s);var i=r-n||(t=1,n||r||1),a=Math.pow(10,Math.floor(Math.log(i/t)/Math.LN10)),s=i/t/a;return s>=p?a*=10:s>=g?a*=5:s>=m&&(a*=2),[Math.ceil(n/a)*a,Math.floor(r/a)*a+a/2,a]}function s(e,t,n){var r=a(e,t);if(null==n)n=",."+d.precisionFixed(r[2])+"f";else switch(n=d.formatSpecifier(n),n.type){case"s":var i=Math.max(Math.abs(r[0]),Math.abs(r[1]));return null==n.precision&&(n.precision=d.precisionPrefix(r[2],i)),f.formatPrefix(n,i);case"":case"e":case"g":case"p":case"r":null==n.precision&&(n.precision=d.precisionRound(r[2],Math.max(Math.abs(r[0]),Math.abs(r[1])))-("e"===n.type));break;case"f":case"%":null==n.precision&&(n.precision=d.precisionFixed(r[2])-2*("%"===n.type))}return f.format(n)}function o(){var e=h.format,t=e(".%L"),n=e(":%S"),r=e("%I:%M"),i=e("%I %p"),a=e("%a %d"),s=e("%b %d"),o=e("%B"),u=e("%Y");return function(e){var c=+e;return(l.second(e)n;++n)r[n]=e;return r},r.zeros=function(e){return r.repeat(0,e)},r.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("Infinite range");var r,i=[],a=-1;if(0>n)for(;(r=e+n*++a)>t;)i.push(r);else for(;(r=e+n*++a)1);return i=Math.sqrt(-2*Math.log(r)/r),n=e+s*i*t,e+a*i*t};return i.samples=function(e){return r.zeros(e).map(i)},i}},{}],15:[function(e,t,n){function r(e,t){if(e){var n=t.header;e=(n?n.join(t.delimiter)+"\n":"")+e}return a.dsv(t.delimiter).parse(e)}var i=e("../../util"),a=e("d3-dsv");r.delimiter=function(e){var t={delimiter:e};return function(e,n){return r(e,n?i.extend(n,t):t)}},t.exports=r},{"../../util":29,"d3-dsv":3}],16:[function(e,t,n){var r=e("./dsv");t.exports={json:e("./json"),topojson:e("./topojson"),treejson:e("./treejson"),dsv:r,csv:r.delimiter(","),tsv:r.delimiter(" ")}},{"./dsv":15,"./json":17,"./topojson":18,"./treejson":19}],17:[function(e,t,n){var r=e("../../util");t.exports=function(e,t){var n=r.isObject(e)&&!r.isBuffer(e)?e:JSON.parse(e);return t&&t.property&&(n=r.accessor(t.property)(n)),n}},{"../../util":29}],18:[function(e,t,n){(function(n){var r=e("./json"),i=function(e,t){var n=i.topojson;if(null==n)throw Error("TopoJSON library not loaded.");var a,s=r(e,t);if(t&&t.feature){if(a=s.objects[t.feature])return n.feature(s,a).features;throw Error("Invalid TopoJSON object: "+t.feature)}if(t&&t.mesh){if(a=s.objects[t.mesh])return[n.mesh(s,s.objects[t.mesh])];throw Error("Invalid TopoJSON object: "+t.mesh)}throw Error("Missing TopoJSON feature or mesh parameter.")};i.topojson="undefined"!=typeof window?window.topojson:"undefined"!=typeof n?n.topojson:null,t.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./json":17}],19:[function(e,t,n){function r(e,t){function n(e){r.push(e);var i=e[t];if(i)for(var a=0;a1&&"."===r[t-1]&&r.lastIndexOf(e)===t});if(!u)throw"URL is not whitelisted: "+n}}return n}function i(e,t){var n,r=t||function(e){throw e};try{n=i.sanitizeUrl(e)}catch(a){return void r(a)}return n?i.useXHR?s(n,t):l(n,d)?o(n.slice(d.length),t):n.indexOf("://")<0?o(n,t):u(n,t):void r("Invalid URL: "+e.url)}function a(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function s(e,t){function n(){var e=i.status;!e&&a(i)||e>=200&&300>e||304===e?t(null,i.responseText):t(i,null)}var r=!!t,i=new XMLHttpRequest;return!this.XDomainRequest||"withCredentials"in i||!/^(http(s)?:)?\/\//.test(e)||(i=new XDomainRequest),r&&("onload"in i?i.onload=i.onerror=n:i.onreadystatechange=function(){i.readyState>3&&n()}),i.open("GET",e,r),i.send(),!r&&a(i)?i.responseText:void 0}function o(t,n){var r=e("fs");return n?void r.readFile(t,n):r.readFileSync(t,"utf8")}function u(t,n){if(!n)return e("sync-request")("GET",t).getBody();var r={url:t,encoding:null,gzip:!0};e("request")(r,function(e,t,r){e||200!==t.statusCode?(e=e||"Load failed with response code "+t.statusCode+".",n(e,null)):n(null,r)})}function l(e,t){return null==e?!1:0===e.lastIndexOf(t,0)}var c=/^([A-Za-z]+:)?\/\//,d="file://";i.sanitizeUrl=r,i.useXHR="undefined"!=typeof XMLHttpRequest,t.exports=i},{fs:2,request:2,"sync-request":2,url:2}],21:[function(e,t,n){function r(e,t){var n=t&&t.type||"json";return e=o[n](e,t),t&&t.parse&&i(e,t.parse),e}function i(e,t){var n,r,i,o,u,l,c=e.length;for(t="auto"===t?s.inferAll(e):a.duplicate(t),n=a.keys(t),r=n.map(function(e){return s.parsers[t[e]]}),o=0,l=n.length;c>o;++o)for(i=e[o],u=0;l>u;++u)i[n[u]]=r[u](i[n[u]]);s.annotation(e,t)}var a=e("../util"),s=e("./type"),o=e("./formats");r.formats=o,t.exports=r},{"../util":29,"./formats":16,"./type":23}],22:[function(e,t,n){var r=e("../util"),i=e("./load"),a=e("./read");t.exports=r.keys(a.formats).reduce(function(e,t){return e[t]=function(e,n,s){r.isString(e)&&(e={url:e}),2===arguments.length&&r.isFunction(n)&&(s=n,n=void 0),n=r.extend({parse:"auto"},n),n.type=t;var o=i(e,s?function(e,t){if(e)return void s(e,null);try{t=a(t,n),s(null,t)}catch(r){s(r,null)}}:void 0);return s?void 0:a(o,n)},e},{})},{"../util":29,"./load":20,"./read":21}],23:[function(e,t,n){function r(e,t){return t?void(e[l]=t):e&&e[l]||null}function i(e,t){t=u.$(t);var n,r,i;if(e[l]&&(n=t(e[l]),u.isString(n)))return n;for(r=0,i=e.length;!u.isValid(n)&&i>r;++r)n=t?t(e[r]):e[r];return u.isDate(n)?"date":u.isNumber(n)?"number":u.isBoolean(n)?"boolean":u.isString(n)?"string":null}function a(e,t){return e.length?(t=t||u.keys(e[0]),t.reduce(function(t,n){return t[n]=i(e,n),t},{})):void 0}function s(e,t){t=u.$(t);var n,r,i,a=["boolean","integer","number","date"];for(n=0;n0?Math.min(s,t.maxwidth):s}),h=n.map(function(e,t){return a.truncate(a.pad(e,f[t],"center"),f[t])}).join(t.separator),p=u(n.map(function(e,t){return"{{"+e+(l[r[e]]||"")+("|pad:"+f[t]+","+(c[r[e]]||"right"))+("|truncate:"+f[t])+"}}"}).join(t.separator));return h+"\n"+e.map(p).join("\n")},t.exports.summary=function(e){e=e?e.__summary__?e:o.summary(e):this;var t,n,a=[];for(t=0,n=e.length;n>t;++t)a.push("-- "+e[t].field+" --"),"string"===e[t].type||e[t].distinct<10?a.push(i(e[t])):a.push(r(e[t])),a.push("");return a.join("\n")}},{"./import/type":23,"./stats":26,"./template":27,"./util":29}],26:[function(e,t,n){var r=e("./util"),i=e("./import/type"),a=e("./generate"),s={};s.unique=function(e,t,n){t=r.$(t),n=n||[];var i,a,s,o={};for(a=0,s=e.length;s>a;++a)i=t?t(e[a]):e[a],i in o||(o[i]=1,n.push(i));return n},s.count=function(e){return e&&e.length||0},s.count.valid=function(e,t){t=r.$(t);var n,i,a,s=0;for(i=0,a=e.length;a>i;++i)n=t?t(e[i]):e[i],r.isValid(n)&&(s+=1);return s},s.count.missing=function(e,t){t=r.$(t);var n,i,a,s=0;for(i=0,a=e.length;a>i;++i)n=t?t(e[i]):e[i],null==n&&(s+=1);return s},s.count.distinct=function(e,t){t=r.$(t);var n,i,a,s={},o=0;for(i=0,a=e.length;a>i;++i)n=t?t(e[i]):e[i],n in s||(s[n]=1,o+=1);return o},s.count.map=function(e,t){t=r.$(t);var n,i,a,s={};for(i=0,a=e.length;a>i;++i)n=t?t(e[i]):e[i],s[n]=n in s?s[n]+1:1;return s},s.median=function(e,t){return t&&(e=e.map(r.$(t))),e=e.filter(r.isValid).sort(r.cmp),s.quantile(e,.5)},s.quartile=function(e,t){t&&(e=e.map(r.$(t))),e=e.filter(r.isValid).sort(r.cmp);var n=s.quantile;return[n(e,.25),n(e,.5),n(e,.75)]},s.quantile=function(e,t,n){void 0===n&&(n=t,t=r.identity),t=r.$(t);var i=(e.length-1)*n+1,a=Math.floor(i),s=+t(e[a-1]),o=i-a;return o?s+o*(t(e[a])-s):s},s.sum=function(e,t){t=r.$(t);for(var n,i=0,a=0,s=e.length;s>a;++a)n=t?t(e[a]):e[a],r.isValid(n)&&(i+=n);return i},s.mean=function(e,t){t=r.$(t);var n,i,a,s,o,u=0;for(i=0,s=0,a=e.length;a>i;++i)o=t?t(e[i]):e[i],r.isValid(o)&&(n=o-u,u+=n/++s);return u},s.variance=function(e,t){if(t=r.$(t),!r.isArray(e)||e.length<2)return 0;var n,i,a,s,o=0,u=0;for(i=0,a=0;is;++s)if(a=t?t(e[s]):e[s],r.isValid(a)){n=i=a;break}for(;o>s;++s)a=t?t(e[s]):e[s],r.isValid(a)&&(n>a&&(n=a),a>i&&(i=a));return[n,i]},s.extent.index=function(e,t){t=r.$(t);var n,i,a,s,o=-1,u=-1,l=e.length;for(s=0;l>s;++s)if(a=t?t(e[s]):e[s],r.isValid(a)){n=i=a,o=u=s;break}for(;l>s;++s)a=t?t(e[s]):e[s],r.isValid(a)&&(n>a&&(n=a,o=s),a>i&&(i=a,u=s));return[o,u]},s.dot=function(e,t,n){var i,a,s=0;if(n)for(t=r.$(t),n=r.$(n),i=0;in;++n){if(i=s[n].val,0>l&&c===i)l=n-1;else if(l>-1&&c!==i){for(a=1+(n-1+l)/2;n>l;++l)u[s[l].idx]=a;l=-1}u[s[n].idx]=n+1,c=i}if(l>-1)for(a=1+(o-1+l)/2;o>l;++l)u[s[l].idx]=a;return u},s.cor=function(e,t,n){var i=n;n=i?e.map(r.$(n)):t,t=i?e.map(r.$(t)):e;var a=s.dot(t,n),o=s.mean(t),u=s.mean(n),l=s.stdev(t),c=s.stdev(n),d=e.length;return(a-d*o*u)/((d-1)*l*c)},s.cor.rank=function(e,t,n){var i,a,o,u=n?s.rank(e,r.$(t)):s.rank(e),l=n?s.rank(e,r.$(n)):s.rank(t),c=e.length;for(i=0,a=0;c>i;++i)o=u[i]-l[i],a+=o*o;return 1-6*a/(c*(c*c-1))},s.cor.dist=function(e,t,n){var i,a,o,u,l=n?e.map(r.$(t)):e,c=n?e.map(r.$(n)):t,d=s.dist.mat(l),f=s.dist.mat(c),h=d.length;for(i=0,a=0,o=0,u=0;h>i;++i)a+=d[i]*d[i],o+=f[i]*f[i],u+=d[i]*f[i];return Math.sqrt(u/Math.sqrt(a*o))},s.dist=function(e,t,n,i){var a,s,o=r.isFunction(n)||r.isString(n),u=e,l=o?e:t,c=o?i:n,d=2===c||null==c,f=e.length,h=0;for(o&&(t=r.$(t),n=r.$(n)),s=0;f>s;++s)a=o?t(u[s])-n(l[s]):u[s]-l[s],h+=d?a*a:Math.pow(Math.abs(a),c);return d?Math.sqrt(h):Math.pow(h,1/c)},s.dist.mat=function(e){var t,n,r,i=e.length,s=i*i,o=Array(s),u=a.zeros(i),l=0;for(n=0;i>n;++n)for(o[n*i+n]=0,r=n+1;i>r;++r)o[n*i+r]=t=Math.abs(e[n]-e[r]),o[r*i+n]=t,u[n]+=t,u[r]+=t;for(n=0;i>n;++n)l+=u[n],u[n]/=i;for(l/=s,n=0;i>n;++n)for(r=n;i>r;++r)o[n*i+r]+=l-u[n]-u[r],o[r*i+n]=o[n*i+r];return o},s.entropy=function(e,t){t=r.$(t);var n,i,a=0,s=0,o=e.length;for(n=0;o>n;++n)a+=t?t(e[n]):e[n];if(0===a)return 0;for(n=0;o>n;++n)i=(t?t(e[n]):e[n])/a,i&&(s+=i*Math.log(i));return-s/Math.LN2},s.mutual=function(e,t,n,i){var a,s,o,u=i?e.map(r.$(t)):e,l=i?e.map(r.$(n)):t,c=i?e.map(r.$(i)):n,d={},f={},h=c.length,p=0,g=0,m=0;for(o=0;h>o;++o)d[u[o]]=0,f[l[o]]=0;for(o=0;h>o;++o)d[u[o]]+=c[o],f[l[o]]+=c[o],p+=c[o];for(s=1/(p*Math.LN2),o=0;h>o;++o)0!==c[o]&&(a=p*c[o]/(d[u[o]]*f[l[o]]),g+=c[o]*s*Math.log(a),m+=c[o]*s*Math.log(c[o]/p));return[g,1+g/m]},s.mutual.info=function(e,t,n,r){return s.mutual(e,t,n,r)[0]},s.mutual.dist=function(e,t,n,r){return s.mutual(e,t,n,r)[1]},s.profile=function(e,t){var n,a,o,u,l,c=0,d=0,f=0,h=0,p=null,g=null,m=0,v=[],y={};for(o=0;ol)&&(p=l),(null===g||l>g)&&(g=l),n=l-c,c+=n/++d,m+=n*(l-c),v.push(l));return m/=d-1,a=Math.sqrt(m),v.sort(r.cmp),{type:i(e,t),unique:y,count:e.length,valid:d,missing:f,distinct:h,min:p,max:g,mean:c,stdev:a,median:u=s.quantile(v,.5),q1:s.quantile(v,.25),q3:s.quantile(v,.75),modeskew:0===a?0:(c-u)/a}},s.summary=function(e,t){t=t||r.keys(e[0]);var n=t.map(function(t){var n=s.profile(e,r.$(t));return n.field=t,n});return n.__summary__=!0,n},t.exports=s},{"./generate":14,"./import/type":23,"./util":29}],27:[function(e,t,n){function r(e){var t=i(e,"d");return t="var __t; return "+t+";",new Function("d",t).bind(c)}function i(e,t,n){t=t||"obj";var r=0,i="'",o=d;return e.replace(o,function(o,u,l){return i+=e.slice(r,l).replace(g,s),r=l+o.length,u&&(i+="'\n+((__t=("+a(u,t,n)+"))==null?'':__t)+\n'"),o}),i+"'"}function a(e,t,n){function i(e){return e=e||"",g?(g=!1,m="String("+m+")"+e):m+=e,m}function a(){return"(typeof "+m+'==="number"?new Date('+m+"):"+m+")"}function s(e,t){_=o(w[0],t,e),g=!1,m="this.formats["+_+"]("+m+")"}function c(e,t){_=o(w[0],t,e),g=!1,m="this.formats["+_+"]("+a()+")"}var d=e.match(f),p=d.shift().trim(),g=!0;n&&(n[p]=1);for(var m=r.property(t,p),v=0;v0&&(x=x.slice(0,y),w=d[v].slice(y+1).match(h).map(function(e){return e.trim()})),x=x.trim()){case"length":i(".length");break;case"lower":i(".toLowerCase()");break;case"upper":i(".toUpperCase()");break;case"lower-locale":i(".toLocaleLowerCase()");break;case"upper-locale":i(".toLocaleUpperCase()");break;case"trim":i(".trim()");break;case"left":_=u.number(w[0]),i(".slice(0,"+_+")");break;case"right":_=u.number(w[0]),i(".slice(-"+_+")");break;case"mid":_=u.number(w[0]),b=_+u.number(w[1]),i(".slice(+"+_+","+b+")");break;case"slice":_=u.number(w[0]),i(".slice("+_+(w.length>1?","+u.number(w[1]):"")+")");break;case"truncate":_=u.number(w[0]),b=w[1],b="left"!==b&&"middle"!==b&&"center"!==b?"right":b,m="this.truncate("+i()+","+_+",'"+b+"')";break;case"pad":_=u.number(w[0]),b=w[1],b="left"!==b&&"middle"!==b&&"center"!==b?"right":b,m="this.pad("+i()+","+_+",'"+b+"')";break;case"number":s(l.number,"number");break;case"time":c(l.time,"time");break;case"time-utc":c(l.utc,"time-utc");break;default:throw Error("Unrecognized template filter: "+x)}}return m}function s(e){return"\\"+p[e]}function o(e,t,n){if(!("'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]))throw Error("Format pattern must be quoted: "+e);if(e=e.slice(1,-1),t=t+":"+e,!c.format_map[t]){var r=n(e),i=c.formats.length;c.formats.push(r),c.format_map[t]=i}return c.format_map[t]}var u=e("./util"),l=e("./format"),c={formats:[],format_map:{},truncate:u.truncate,pad:u.pad};r.source=i,r.context=c,t.exports=r,r.clearFormatCache=function(){c.formats=[],c.format_map={}},r.property=function(e,t){var n=u.field(t).map(u.str).join("][");return e+"["+n+"]"};var d=/\{\{(.+?)\}\}|$/g,f=/(?:"[^"]*"|\'[^\']*\'|[^\|"]+|[^\|\']+)+/g,h=/(?:"[^"]*"|\'[^\']*\'|[^,"]+|[^,\']+)+/g,p={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},g=/\\|'|\r|\n|\u2028|\u2029/g},{"./format":13,"./util":29}],28:[function(e,t,n){function r(e){return l.setTime(+e),l}function i(e,t,n,r,i,a){var s={type:e,date:t,unit:n};return r?s.step=r:s.minstep=1,null!=i&&(s.min=i),null!=a&&(s.max=a),s}function a(e,t,n,r,a,s){return i(e,function(e){return t.offset(n,e)},function(e){return t.count(n,e)},r,a,s)}function s(e,t,n,r){var i,a,s,o=p[0];for(i=1,a=p.length;a>i;++i)if(o=p[i],t>o[0]){if(s=t/o[0],s>r)return e[p[i-1][1]];if(s>=n)return e[o[1]]}return e[p[a-1][1]]}function o(e){var t,n,r={};for(t=0,n=e.length;n>t;++t)r[e[t].type]=e[t];return r.find=function(t,n,r){return s(e,t,n,r)},r}var u=e("d3-time"),l=new Date,c=new Date(0,0,1).setFullYear(0),d=new Date(Date.UTC(0,0,1)).setUTCFullYear(0),f=[a("second",u.second,c),a("minute",u.minute,c),a("hour",u.hour,c),a("day",u.day,c,[1,7]),a("month",u.month,c,[1,3,6]),a("year",u.year,c),i("seconds",function(e){return new Date(1970,0,1,0,0,e)},function(e){return r(e).getSeconds()},null,0,59),i("minutes",function(e){return new Date(1970,0,1,0,e)},function(e){return r(e).getMinutes()},null,0,59),i("hours",function(e){return new Date(1970,0,1,e)},function(e){return r(e).getHours()},null,0,23),i("weekdays",function(e){return new Date(1970,0,4+e)},function(e){return r(e).getDay()},[1],0,6),i("dates",function(e){return new Date(1970,0,e)},function(e){return r(e).getDate()},[1],1,31),i("months",function(e){return new Date(1970,e%12,1)},function(e){return r(e).getMonth()},[1],0,11)],h=[a("second",u.utcSecond,d),a("minute",u.utcMinute,d),a("hour",u.utcHour,d),a("day",u.utcDay,d,[1,7]),a("month",u.utcMonth,d,[1,3,6]),a("year",u.utcYear,d),i("seconds",function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return r(e).getUTCSeconds()},null,0,59),i("minutes",function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return r(e).getUTCMinutes()},null,0,59),i("hours",function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return r(e).getUTCHours()},null,0,23),i("weekdays",function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return r(e).getUTCDay()},[1],0,6),i("dates",function(e){return new Date(Date.UTC(1970,0,e))},function(e){return r(e).getUTCDate()},[1],1,31),i("months",function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return r(e).getUTCMonth()},[1],0,11)],p=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];t.exports=o(f),t.exports.utc=o(h)},{"d3-time":6}],29:[function(e,t,n){function r(e){return e.replace(f,"$1\\'")}function i(e,t){var n,r="";for(n=0;e>n;++n)r+=t;return r}function a(e,t,n){var r=0,i=e.split(p);return e=n?(i=i.reverse()).filter(function(e){return r+=e.length,t>=r}).reverse():i.filter(function(e){return r+=e.length,t>=r}),e.length?e.join("").trim():i[0].slice(0,t); -}var s=e("buffer"),o=e("./time"),u=o.utc,l=t.exports={},c="__name__";l.namedfunc=function(e,t){return t[c]=e,t},l.name=function(e){return null==e?null:e[c]},l.identity=function(e){return e},l["true"]=l.namedfunc("true",function(){return!0}),l["false"]=l.namedfunc("false",function(){return!1}),l.duplicate=function(e){return JSON.parse(JSON.stringify(e))},l.equal=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},l.extend=function(e){for(var t,n,r=1,i=arguments.length;i>r;++r){t=arguments[r];for(n in t)e[n]=t[n]}return e},l.length=function(e){return null!=e&&null!=e.length?e.length:null},l.keys=function(e){var t,n=[];for(t in e)n.push(t);return n},l.vals=function(e){var t,n=[];for(t in e)n.push(e[t]);return n},l.toMap=function(e,t){return(t=l.$(t))?e.reduce(function(e,n){return e[t(n)]=1,e},{}):e.reduce(function(e,t){return e[t]=1,e},{})},l.keystr=function(e){var t=e.length;if(!t)return"";for(var n=String(e[0]),r=1;t>r;++r)n+="|"+String(e[r]);return n};var d=Object.prototype.toString;l.isObject=function(e){return e===Object(e)},l.isFunction=function(e){return"[object Function]"===d.call(e)},l.isString=function(e){return"string"==typeof value||"[object String]"===d.call(e)},l.isArray=Array.isArray||function(e){return"[object Array]"===d.call(e)},l.isNumber=function(e){return"number"==typeof e||"[object Number]"===d.call(e)},l.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==d.call(e)},l.isDate=function(e){return"[object Date]"===d.call(e)},l.isValid=function(e){return null!=e&&e===e},l.isBuffer=s.Buffer&&s.Buffer.isBuffer||l["false"],l.number=function(e){return null==e||""===e?null:+e},l["boolean"]=function(e){return null==e||""===e?null:"false"===e?!1:!!e},l.date=function(e){return null==e||""===e?null:Date.parse(e)},l.array=function(e){return null!=e?l.isArray(e)?e:[e]:[]},l.str=function(e){return l.isArray(e)?"["+e.map(l.str)+"]":l.isObject(e)?JSON.stringify(e):l.isString(e)?"'"+r(e)+"'":e};var f=/(^|[^\\])'/g,h=/\[(.*?)\]|[^.\[]+/g;l.field=function(e){return String(e).match(h).map(function(e){return"["!==e[0]?e:"'"!==e[1]&&'"'!==e[1]?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,"$1")})},l.accessor=function(e){var t;return null==e||l.isFunction(e)?e:l.namedfunc(e,(t=l.field(e)).length>1?function(e){return t.reduce(function(e,t){return e[t]},e)}:function(t){return t[e]})},l.$=l.accessor,l.mutator=function(e){var t;return l.isString(e)&&(t=l.field(e)).length>1?function(e,n){for(var r=0;ri;++i){if(s=e[i],o=s(n),u=s(r),u>o)return-1*t[i];if(o>u)return t[i]}return 0}},l.cmp=function(e,t){return t>e?-1:e>t?1:e>=t?0:null===e?-1:null===t?1:NaN},l.numcmp=function(e,t){return e-t},l.stablesort=function(e,t,n){var r=e.reduce(function(e,t,r){return e[n(t)]=r,e},{});return e.sort(function(e,i){var a=t(e),s=t(i);return s>a?-1:a>s?1:r[n(e)]-r[n(i)]}),e},l.pad=function(e,t,n,r){r=r||" ";var a=t-e.length;if(0>=a)return e;switch(n){case"left":return i(a,r)+e;case"middle":case"center":return i(Math.floor(a/2),r)+e+i(Math.ceil(a/2),r);default:return e+i(a,r)}},l.truncate=function(e,t,n,r,i){var s=e.length;if(t>=s)return e;i=void 0!==i?String(i):"…";var o=Math.max(0,t-i.length);switch(n){case"left":return i+(r?a(e,o,1):e.slice(s-o));case"middle":case"center":var u=Math.ceil(o/2),l=Math.floor(o/2);return(r?a(e,u):e.slice(0,u))+i+(r?a(e,l,1):e.slice(s-l));default:return(r?a(e,o):e.slice(0,o))+i}};var p=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/},{"./time":28,buffer:2}],30:[function(e,t,n){function r(e,t){var n={};return i(e,n),n.add=[],n.mod=[],n.rem=[],n.reflow=t,n}function i(e,t){t.stamp=e?e.stamp:0,t.sort=e?e.sort:null,t.facet=e?e.facet:null,t.trans=e?e.trans:null,t.dirty=e?e.dirty:[],t.request=e?e.request:null;for(var n,r=0,i=a.length;i>r;++r)t[n=a[r]]=e?e[n]:{}}var a=e("./Dependencies").ALL;t.exports={create:r,copy:i}},{"./Dependencies":33}],31:[function(e,t,n){function r(e){s.init.call(this,e),this._data=[],this.router(!0).collector(!0)}var i=e("vega-logging"),a=e("./Tuple"),s=e("./Node").prototype,o=r.prototype=Object.create(s);o.constructor=r,o.data=function(){return this._data},o.evaluate=function(e){return i.debug(e,["collecting"]),e.rem.length&&(this._data=a.idFilter(this._data,e.rem)),e.add.length&&(this._data=this._data.length?this._data.concat(e.add):e.add),e.sort&&this._data.sort(e.sort),e.reflow&&(e.mod=e.mod.concat(a.idFilter(this._data,e.add,e.mod,e.rem)),e.reflow=!1),e},t.exports=r},{"./Node":36,"./Tuple":38,"vega-logging":45}],32:[function(e,t,n){function r(e,t,n){this._graph=e,this._name=t,this._data=[],this._source=null,this._facet=n,this._input=u.create(),this._output=null,this._inputNode=null,this._outputNode=null,this._pipeline=null,this._collector=null,this._mutates=!1}function i(e){var t=new d(e._graph).router(!0).collector(!0);return t.data=function(){return e._data},t.evaluate=function(t){o.debug(t,["input",e._name]);var n,r=e._input,i=u.create(t);for(n in r.fields)i.fields[n]=1;return r.rem.length&&(e._data=c.idFilter(e._data,r.rem)),r.add.length&&(e._data=e._data.concat(r.add)),t.reflow&&(r.mod=r.mod.concat(c.idFilter(e._data,r.add,r.mod,r.rem))),e._input=u.create(),i.add=r.add,i.mod=r.mod,i.rem=r.rem,i.facet=e._facet,i},t}function a(e){var t=new d(e._graph).router(!0).reflows(!0).collector(!0);return t.data=function(){return e._collector?e._collector.data():e._data},t.evaluate=function(t){o.debug(t,["output",e._name]);var n=u.create(t,!0);return e._facet&&(e._facet.values=e.values(),t.facet=null),e._output=t,n.data[e._name]=1,n},t}function s(e){var t=new d(e._graph).router(!0);return t.evaluate=function(t){if(e.mutates()){var n=e._srcMap||(e._srcMap={}),r=u.create(t);return r.add=t.add.map(function(e){return n[e._id]=c.derive(e)}),r.mod=t.mod.map(function(e){return c.rederive(e,n[e._id])}),r.rem=t.rem.map(function(e){var t=n[e._id];return n[e._id]=null,t}),e._input=r}return e._input=t},t}var o=e("vega-logging"),u=e("./ChangeSet"),l=e("./Collector"),c=e("./Tuple"),d=e("./Node"),f=r.prototype;f.name=function(e){return arguments.length?(this._name=e,this):this._name},f.source=function(e){return arguments.length?this._source=this._graph.data(e):this._source},f.insert=function(e){return this._input.add=this._input.add.concat(e.map(c.ingest)),this},f.remove=function(e){var t=this._data.filter(e);return this._input.rem=this._input.rem.concat(t),this},f.update=function(e,t,n){var r=this._input.mod,i=c.idMap(r);return this._input.fields[t]=1,this._data.filter(e).forEach(function(e){var a=e[t],s=n(e);a!==s&&(c.set(e,t,s),1!==i[e._id]&&(r.push(e),i[e._id]=1))}),this},f.values=function(e){return arguments.length?(this._input.rem=this._data.slice(),e&&this.insert(e),this):this._collector.data()},f.mutates=function(e){return arguments.length?(this._mutates=this._mutates||e,this):this._mutates},f.last=function(){return this._output},f.fire=function(e){return e&&(this._input=e),this._graph.propagate(this._input,this._pipeline[0]),this},f.pipeline=function(e){if(!arguments.length)return this._pipeline;var t,n=this._graph;return e.unshift(this._inputNode=i(this)),t=n.preprocess(e),t.router&&e.push(t.collector=new l(n)),e.push(this._outputNode=a(this)),this._collector=t.collector,this._mutates=!!t.mutates,n.connect(this._pipeline=e),this},f.synchronize=function(){return this._graph.synchronize(this._pipeline),this},f.listener=function(){return s(this).addListener(this._inputNode)},f.addListener=function(e){return e instanceof r?this._collector.addListener(e.listener()):this._outputNode.addListener(e),this},f.removeListener=function(e){this._outputNode.removeListener(e)},f.listeners=function(e){return(e?this._collector:this._outputNode).listeners()},t.exports=r},{"./ChangeSet":30,"./Collector":31,"./Node":36,"./Tuple":38,"vega-logging":45}],33:[function(e,t,n){var r=t.exports={ALL:["data","fields","scales","signals"]};r.ALL.forEach(function(e){r[e.toUpperCase()]=e})},{}],34:[function(e,t,n){function r(){}var i=e("datalib"),a=e("./Heap"),s=e("./ChangeSet"),o=e("./DataSource"),u=e("./Collector"),l=e("./Tuple"),c=e("./Signal"),d=e("./Dependencies"),f=r.prototype;f.init=function(){this._stamp=0,this._rank=0,this._data={},this._signals={},this.doNotPropagate={}},f.rank=function(){return++this._rank},f.values=function(e,t,n){var r,a,s=e===d.SIGNALS?this._signals:this._data,o=void 0!==t?t:i.keys(s);if(Array.isArray(o)){for(r=n||{},a=0;a1)for(var n=1,r=e.length;r>n;++n)t=t[e[n]];return t},f.propagate=function(e,t,n){var r,i,o,u,l,c,d,f={},h=new a(function(e,t){return e._qrank-t._qrank});if(e.stamp)throw Error("Pulse already has a non-zero stamp.");for(e.stamp=n||++this._stamp,f[t._id]=e,h.push(t.qrank(!0));h.size()>0;)if(t=h.peek(),e=f[t._id],t.rank()!==t.qrank())h.replace(t.qrank(!0));else if(h.pop(),f[t._id]=null,r=t._listeners,e=this.evaluate(e,t),e!==this.doNotPropagate)for(!e.reflow&&t.reflows()&&(e=s.create(e,!0)),c=0,d=r.length;d>c;++c)if(i=r[c],void 0!==(o=f[i._id])){if(null===o)throw Error("Already propagated to node.");if(o===e)continue;if(u=e.add.length||e.mod.length||e.rem.length,l=o.add.length||o.mod.length||o.rem.length,u&&l)throw Error("Multiple changeset pulses to same node");f[i._id]=u?e:o,f[i._id].reflow=e.reflow||o.reflow}else h.push(i.qrank(!0)),f[i._id]=e},f.preprocess=function(e){for(var t,n,r,i,a=this,s=0,o=0;oa;++a){for(n=e[a],n.collector()&&(t=n),r=n.dependency(d.DATA),o=0,u=r.length;u>o;++o)this.data(r[o]).addListener(t);for(i=n.dependency(d.SIGNALS),o=0,u=i.length;u>o;++o)this.signal(i[o]).addListener(t);a>0&&e[a-1].addListener(n)}return e},f.disconnect=function(e){var t,n,r,i,a,s,o,u;for(a=0,s=e.length;s>a;++a){for(n=e[a],n.collector()&&(t=n),r=n.dependency(d.DATA),o=0,u=r.length;u>o;++o)this.data(r[o]).removeListener(t);for(i=n.dependency(d.SIGNALS),o=0,u=i.length;u>o;++o)this.signal(i[o]).removeListener(t);n.disconnect()}return e},f.synchronize=function(e){var t,n,r,i,a,s,o,u,c={};for(r=0,i=e.length;i>r;++r)if(t=e[r],t.collector())for(a=0,n=t.data(),s=n.length;s>a;++a)u=(o=n[a])._id,c[u]||(l.prev_update(o),c[u]=1);return this},f.reevaluate=function(e,t){var n=e.reflow&&t.last()>=e.stamp,r=t.router()||e.add.length||e.rem.length;return r||!n||t.reevaluate(e)},f.evaluate=function(e,t){return this.reevaluate(e,t)?(e=t.evaluate(e),t.last(e.stamp),e):e},t.exports=r},{"./ChangeSet":30,"./Collector":31,"./DataSource":32,"./Dependencies":33,"./Heap":35,"./Signal":37,"./Tuple":38,datalib:24}],35:[function(e,t,n){function r(e){this.cmp=e,this.nodes=[]}function i(e,t,n,r){var i,a,s;for(i=e[n];n>t&&(s=n-1>>1,a=e[s],r(i,a)<0);)e[n]=a,n=s;return e[n]=i}function a(e,t,n){for(var r,a=t,s=e.length,o=e[t],u=2*t+1;s>u;)r=u+1,s>r&&n(e[u],e[r])>=0&&(u=r),e[t]=e[u],t=u,u=2*t+1;return e[t]=o,i(e,a,t,n)}var s=r.prototype;s.size=function(){return this.nodes.length},s.clear=function(){return this.nodes=[],this},s.peek=function(){return this.nodes[0]},s.push=function(e){var t=this.nodes;return t.push(e),i(t,0,t.length-1,this.cmp)},s.pop=function(){var e,t=this.nodes,n=t.pop();return t.length?(e=t[0],t[0]=n,a(t,0,this.cmp)):e=n,e},s.replace=function(e){var t=this.nodes,n=t[0];return t[0]=e,a(t,0,this.cmp),n},s.pushpop=function(e){var t=this.nodes,n=t[0];return t.length&&this.cmp(n,e)<0&&(t[0]=e,e=n,a(t,0,this.cmp)),e},t.exports=r},{}],36:[function(e,t,n){function r(e){e&&this.init(e)}var i=e("./Dependencies").ALL,a=0,s=r.Flags={Router:1,Collector:2,Produces:4,Mutates:8,Reflows:16,Batch:32},o=r.prototype;o.init=function(e){this._id=++a,this._graph=e,this._rank=e.rank(),this._qrank=null,this._stamp=0,this._listeners=[],this._listeners._ids={},this._deps={};for(var t=0,n=i.length;n>t;++t)this._deps[i[t]]=[];return this._flags=0,this},o.rank=function(){return this._rank},o.qrank=function(){return arguments.length?(this._qrank=this._rank,this):this._qrank},o.last=function(e){return arguments.length?(this._stamp=e,this):this._stamp},o._setf=function(e,t){return t?this._flags|=e:this._flags&=~e,this},o.router=function(e){return arguments.length?this._setf(s.Router,e):this._flags&s.Router},o.collector=function(e){return arguments.length?this._setf(s.Collector,e):this._flags&s.Collector},o.produces=function(e){return arguments.length?this._setf(s.Produces,e):this._flags&s.Produces},o.mutates=function(e){return arguments.length?this._setf(s.Mutates,e):this._flags&s.Mutates},o.reflows=function(e){return arguments.length?this._setf(s.Reflows,e):this._flags&s.Reflows},o.batch=function(e){return arguments.length?this._setf(s.Batch,e):this._flags&s.Batch},o.dependency=function(e,t){var n=this._deps[e],r=n._names||(n._names={});if(1===arguments.length)return n;if(null===t)n.splice(0,n.length),n._names={};else if(Array.isArray(t))for(var i,a=0,s=t.length;s>a;++a)i=t[a],r[i]||(n.push(i),r[i]=1);else{if(r[t])return this;n.push(t),r[t]=1}return this},o.listeners=function(){return this._listeners},o.addListener=function(e){if(!(e instanceof r))throw Error("Listener is not a Node");if(this._listeners._ids[e._id])return this;if(this._listeners.push(e),this._listeners._ids[e._id]=1,this._rank>e._rank)for(var t,n=[e],i=this._graph;n.length;)t=n.shift(),t._rank=i.rank(),n.unshift.apply(n,t.listeners());return this},o.removeListener=function(e){if(!this._listeners._ids[e._id])return!1;var t=this._listeners.indexOf(e),n=t>=0;return n&&(this._listeners.splice(t,1),this._listeners._ids[e._id]=null),n},o.disconnect=function(){this._listeners=[],this._listeners._ids={}},o.evaluate=function(e){return e},o.reevaluate=function(e){var t,n,r,a,s,o;for(r=0,a=i.length;a>r;++r)for(t=i[r],n=this._deps[t],s=0,o=n.length;o>s;++s)if(e[t][n[s]])return!0;return!1},r.reset=function(){a=0},t.exports=r},{"./Dependencies":33}],37:[function(e,t,n){function r(e,t,n){return s.init.call(this,e),this._name=t,this._value=n,this._verbose=!1,this._handlers=[],this}var i=e("./ChangeSet"),a=e("./Node"),s=a.prototype,o=r.prototype=Object.create(s);o.constructor=r,o.name=function(){return this._name},o.value=function(e){return arguments.length?(this._value=e,this):this._value},o.values=o.value,o.verbose=function(e){return arguments.length?(this._verbose=!!e,this):this._verbose},o.evaluate=function(e){return e.signals[this._name]?e:this._graph.doNotPropagate},o.fire=function(e){e||(e=i.create(null,!0)),e.signals[this._name]=1,this._graph.propagate(e,this)},o.on=function(e){var t=this,n=new a(this._graph);return n.evaluate=function(n){return e(t.name(),t.value()),n},this._handlers.push({handler:e,node:n}),this.addListener(n)},o.off=function(e){var t,n,r=this._handlers;for(t=r.length;--t>=0;)e&&r[t].handler!==e||(n=r.splice(t,1)[0],this.removeListener(n.node));return this},t.exports=r},{"./ChangeSet":30,"./Node":36}],38:[function(e,t,n){function r(e){return e=e===Object(e)?e:{data:e},e._id=++s,e._prev&&(e._prev=null),e}function i(e,t){t=t||{};for(var n=0,r=e.length;r>n;++n)t[e[n]._id]=1;return t}function a(e,t){t=t||{};for(var n in e)"_prev"!==n&&"_id"!==n&&(t[n]=e[n]);return t}var s=0;t.exports={ingest:r,idMap:i,derive:function(e){return r(a(e))},rederive:function(e,t){return a(e,t)},set:function(e,t,n){return e[t]===n?0:(e[t]=n,1)},prev:function(e){return e._prev||e},prev_init:function(e){e._prev||(e._prev={_id:e._id})},prev_update:function(e){var t,n,r=e._prev;if(r)for(t in e)"_prev"!==t&&"_id"!==t&&(r[t]=(n=e[t])instanceof Object&&n._prev?n._prev:n)},reset:function(){s=0},idFilter:function(e){for(var t={},n=arguments.length;--n>0;)i(arguments[n],t);return e.filter(function(e){return!t[e._id]})}}},{}],39:[function(e,t,n){t.exports={ChangeSet:e("./ChangeSet"),Collector:e("./Collector"),DataSource:e("./DataSource"),Dependencies:e("./Dependencies"),Graph:e("./Graph"),Node:e("./Node"),Signal:e("./Signal"),Tuple:e("./Tuple"),debug:e("vega-logging").debug}},{"./ChangeSet":30,"./Collector":31,"./DataSource":32,"./Dependencies":33,"./Graph":34,"./Node":36,"./Signal":37,"./Tuple":38,"vega-logging":45}],40:[function(e,t,n){function r(e){var t,n,r={};for(t=0,n=e.length;n>t;++t)r[e[t]]=1;return r}function i(e){var t,n=[];for(t in e)n.push(t);return n}t.exports=function(t){function n(e){var t={code:s(e),globals:i(p),fields:i(g)};return p={},g={},t}function a(e){return h+'["'+e+'"]'}function s(e){if("string"==typeof e)return e;var t=m[e.type];if(null==t)throw new Error("Unsupported type: "+e.type);return t(e)}t=t||{};var o=t.constants||e("./constants"),u=(t.functions||e("./functions"))(s),l=t.idWhiteList?r(t.idWhiteList):null,c=t.idBlackList?r(t.idBlackList):null,d=0,f=t.fieldVar||"datum",h=t.globalVar||"signals",p={},g={},m={Literal:function(e){return e.raw},Identifier:function(e){var t=e.name;if(d>0)return t;if(o.hasOwnProperty(t))return o[t];if(l)return l.hasOwnProperty(t)?t:(p[t]=1,a(t));if(c&&c.hasOwnProperty(t))throw new Error("Illegal identifier: "+t);return t},Program:function(e){return e.body.map(s).join("\n")},MemberExpression:function(e){var t=!e.computed,n=s(e.object);t&&(d+=1);var r=s(e.property);return n===f&&(g[r]=1),t&&(d-=1),n+(t?"."+r:"["+r+"]")},CallExpression:function(e){if("Identifier"!==e.callee.type)throw new Error("Illegal callee type: "+e.callee.type);var t=e.callee.name,n=e.arguments,r=u.hasOwnProperty(t)&&u[t];if(!r)throw new Error("Unrecognized function: "+t);return r instanceof Function?r(n):r+"("+n.map(s).join(",")+")"},ArrayExpression:function(e){return"["+e.elements.map(s).join(",")+"]"},BinaryExpression:function(e){return"("+s(e.left)+e.operator+s(e.right)+")"},UnaryExpression:function(e){return"("+e.operator+s(e.argument)+")"},ConditionalExpression:function(e){return"("+s(e.test)+"?"+s(e.consequent)+":"+s(e.alternate)+")"},LogicalExpression:function(e){return"("+s(e.left)+e.operator+s(e.right)+")"},ObjectExpression:function(e){return"{"+e.properties.map(s).join(",")+"}"},Property:function(e){d+=1;var t=s(e.key);return d-=1,t+":"+s(e.value)},ExpressionStatement:function(e){return s(e.expression)}};return n.functions=u,n.constants=o,n}},{"./constants":41,"./functions":42}],41:[function(e,t,n){t.exports={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"}},{}],42:[function(e,t,n){t.exports=function(e){function t(t,n,r,i){var a=e(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+t+(0>i?"":0===i?"()":"("+n.slice(1).map(e).join(",")+")")}function n(e,n,r){return function(i){return t(e,i,n,r)}}var r="new Date",i="String",a="RegExp";return{isNaN:"isNaN",isFinite:"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){if(t.length<3)throw new Error("Missing arguments to clamp function.");if(t.length>3)throw new Error("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",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",i,0),lower:n("toLowerCase",i,0),slice:n("slice",i),substring:n("substring",i),regexp:a,test:n("test",a),"if":function(t){if(t.length<3)throw new Error("Missing arguments to if function.");if(t.length>3)throw new Error("Too many arguments to if function.");var n=t.map(e);return n[0]+"?"+n[1]+":"+n[2]}}}},{}],43:[function(e,t,n){var r=e("./parser"),i=e("./codegen"),a=t.exports={parse:function(e,t){return r.parse("("+e+")",t)},code:function(e){return i(e)},compiler:function(e,t){e=e.slice();var n=i(t),r=e.length,s=function(t){var i=n(a.parse(t));return e[r]='"use strict"; return ('+i.code+");",i.fn=Function.apply(null,e),i};return s.codegen=n,s},functions:e("./functions"),constants:e("./constants")}},{"./codegen":40,"./constants":41,"./functions":42,"./parser":44}],44:[function(e,t,n){t.exports=function(){"use strict";function e(e,t){if(!e)throw new Error("ASSERT: "+t)}function t(e){return e>=48&&57>=e}function n(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function r(e){return"01234567".indexOf(e)>=0}function i(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 a(e){return 10===e||13===e||8232===e||8233===e}function s(e){return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||92===e||e>=128&&Se.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function o(e){return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&Se.NonAsciiIdentifierPart.test(String.fromCharCode(e))}function u(e){switch(e){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function l(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function c(e){if(Te&&l(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function d(){var e,t;for(t=0===Ae;Ce>Ae;)if(e=Me.charCodeAt(Ae),i(e))++Ae;else{if(!a(e))break;++Ae,13===e&&10===Me.charCodeAt(Ae)&&++Ae,++Ee,Le=Ae,t=!0}}function f(e){var t,r,i,a=0;for(r="u"===e?4:2,t=0;r>t;++t){if(!(Ce>Ae&&n(Me[Ae])))return"";i=Me[Ae++],a=16*a+"0123456789abcdef".indexOf(i.toLowerCase())}return String.fromCharCode(a)}function h(){var e,t,r,i;for(e=Me[Ae],t=0,"}"===e&&F({},ke.UnexpectedToken,"ILLEGAL");Ce>Ae&&(e=Me[Ae++],n(e));)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&F({},ke.UnexpectedToken,"ILLEGAL"),65535>=t?String.fromCharCode(t):(r=(t-65536>>10)+55296,i=(t-65536&1023)+56320,String.fromCharCode(r,i))}function p(){var e,t;for(e=Me.charCodeAt(Ae++),t=String.fromCharCode(e),92===e&&(117!==Me.charCodeAt(Ae)&&F({},ke.UnexpectedToken,"ILLEGAL"),++Ae,e=f("u"),e&&"\\"!==e&&s(e.charCodeAt(0))||F({},ke.UnexpectedToken,"ILLEGAL"),t=e);Ce>Ae&&(e=Me.charCodeAt(Ae),o(e));)++Ae,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==Me.charCodeAt(Ae)&&F({},ke.UnexpectedToken,"ILLEGAL"),++Ae,e=f("u"),e&&"\\"!==e&&o(e.charCodeAt(0))||F({},ke.UnexpectedToken,"ILLEGAL"),t+=e);return t}function g(){var e,t;for(e=Ae++;Ce>Ae;){if(t=Me.charCodeAt(Ae),92===t)return Ae=e,p();if(!o(t))break;++Ae}return Me.slice(e,Ae)}function m(){var e,t,n;return e=Ae,t=92===Me.charCodeAt(Ae)?p():g(),n=1===t.length?_e.Identifier:c(t)?_e.Keyword:"null"===t?_e.NullLiteral:"true"===t||"false"===t?_e.BooleanLiteral:_e.Identifier,{type:n,value:t,lineNumber:Ee,lineStart:Le,start:e,end:Ae}}function v(){var e,t,n,r,i=Ae,a=Me.charCodeAt(Ae),s=Me[Ae];switch(a){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Ae,Ne.tokenize&&(40===a?Ne.openParenToken=Ne.tokens.length:123===a&&(Ne.openCurlyToken=Ne.tokens.length)),{type:_e.Punctuator,value:String.fromCharCode(a),lineNumber:Ee,lineStart:Le,start:i,end:Ae};default:if(e=Me.charCodeAt(Ae+1),61===e)switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Ae+=2,{type:_e.Punctuator,value:String.fromCharCode(a)+String.fromCharCode(e),lineNumber:Ee,lineStart:Le,start:i,end:Ae};case 33:case 61:return Ae+=2,61===Me.charCodeAt(Ae)&&++Ae,{type:_e.Punctuator,value:Me.slice(i,Ae),lineNumber:Ee,lineStart:Le,start:i,end:Ae}}}return r=Me.substr(Ae,4),">>>="===r?(Ae+=4,{type:_e.Punctuator,value:r,lineNumber:Ee,lineStart:Le,start:i,end:Ae}):(n=r.substr(0,3),">>>"===n||"<<="===n||">>="===n?(Ae+=3,{type:_e.Punctuator,value:n,lineNumber:Ee,lineStart:Le,start:i,end:Ae}):(t=n.substr(0,2),s===t[1]&&"+-<>&|".indexOf(s)>=0||"=>"===t?(Ae+=2,{type:_e.Punctuator,value:t,lineNumber:Ee,lineStart:Le,start:i,end:Ae}):"<>=!+-*%&|^/".indexOf(s)>=0?(++Ae,{type:_e.Punctuator,value:s,lineNumber:Ee,lineStart:Le,start:i,end:Ae}):void F({},ke.UnexpectedToken,"ILLEGAL")))}function y(e){for(var t="";Ce>Ae&&n(Me[Ae]);)t+=Me[Ae++];return 0===t.length&&F({},ke.UnexpectedToken,"ILLEGAL"),s(Me.charCodeAt(Ae))&&F({},ke.UnexpectedToken,"ILLEGAL"),{type:_e.NumericLiteral,value:parseInt("0x"+t,16),lineNumber:Ee,lineStart:Le,start:e,end:Ae}}function _(e){for(var n="0"+Me[Ae++];Ce>Ae&&r(Me[Ae]);)n+=Me[Ae++];return(s(Me.charCodeAt(Ae))||t(Me.charCodeAt(Ae)))&&F({},ke.UnexpectedToken,"ILLEGAL"),{type:_e.NumericLiteral,value:parseInt(n,8),octal:!0,lineNumber:Ee,lineStart:Le,start:e,end:Ae}}function b(){var n,i,a;if(a=Me[Ae],e(t(a.charCodeAt(0))||"."===a,"Numeric literal must start with a decimal digit or a decimal point"),i=Ae,n="","."!==a){if(n=Me[Ae++],a=Me[Ae],"0"===n){if("x"===a||"X"===a)return++Ae,y(i);if(r(a))return _(i);a&&t(a.charCodeAt(0))&&F({},ke.UnexpectedToken,"ILLEGAL")}for(;t(Me.charCodeAt(Ae));)n+=Me[Ae++];a=Me[Ae]}if("."===a){for(n+=Me[Ae++];t(Me.charCodeAt(Ae));)n+=Me[Ae++];a=Me[Ae]}if("e"===a||"E"===a)if(n+=Me[Ae++],a=Me[Ae],("+"===a||"-"===a)&&(n+=Me[Ae++]),t(Me.charCodeAt(Ae)))for(;t(Me.charCodeAt(Ae));)n+=Me[Ae++];else F({},ke.UnexpectedToken,"ILLEGAL");return s(Me.charCodeAt(Ae))&&F({},ke.UnexpectedToken,"ILLEGAL"),{type:_e.NumericLiteral,value:parseFloat(n),lineNumber:Ee,lineStart:Le,start:i,end:Ae}}function x(){var t,n,i,s,o,u,l,c,d="",p=!1;for(l=Ee,c=Le,t=Me[Ae],e("'"===t||'"'===t,"String literal must starts with a quote"),n=Ae,++Ae;Ce>Ae;){if(i=Me[Ae++],i===t){t="";break}if("\\"===i)if(i=Me[Ae++],i&&a(i.charCodeAt(0)))++Ee,"\r"===i&&"\n"===Me[Ae]&&++Ae,Le=Ae;else switch(i){case"u":case"x":"{"===Me[Ae]?(++Ae,d+=h()):(u=Ae,o=f(i),o?d+=o:(Ae=u,d+=i));break;case"n":d+="\n";break;case"r":d+="\r";break;case"t":d+=" ";break;case"b":d+="\b";break;case"f":d+="\f";break;case"v":d+=" ";break;default:r(i)?(s="01234567".indexOf(i),0!==s&&(p=!0),Ce>Ae&&r(Me[Ae])&&(p=!0,s=8*s+"01234567".indexOf(Me[Ae++]),"0123".indexOf(i)>=0&&Ce>Ae&&r(Me[Ae])&&(s=8*s+"01234567".indexOf(Me[Ae++]))),d+=String.fromCharCode(s)):d+=i}else{if(a(i.charCodeAt(0)))break;d+=i}}return""!==t&&F({},ke.UnexpectedToken,"ILLEGAL"),{type:_e.StringLiteral,value:d,octal:p,startLineNumber:l,startLineStart:c,lineNumber:Ee,lineStart:Le,start:n,end:Ae}}function w(e,t){var n,r=e;t.indexOf("u")>=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t){return parseInt(t,16)<=1114111?"x":void F({},ke.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{n=new RegExp(r)}catch(i){F({},ke.InvalidRegExp)}try{return new RegExp(e,t)}catch(a){return null}}function k(){var t,n,r,i,s;for(t=Me[Ae],e("/"===t,"Regular expression literal must start with a slash"),n=Me[Ae++],r=!1,i=!1;Ce>Ae;)if(t=Me[Ae++],n+=t,"\\"===t)t=Me[Ae++],a(t.charCodeAt(0))&&F({},ke.UnterminatedRegExp),n+=t;else if(a(t.charCodeAt(0)))F({},ke.UnterminatedRegExp);else if(r)"]"===t&&(r=!1);else{if("/"===t){i=!0;break}"["===t&&(r=!0)}return i||F({},ke.UnterminatedRegExp),s=n.substr(1,n.length-2),{value:s,literal:n}}function S(){var e,t,n,r;for(t="",n="";Ce>Ae&&(e=Me[Ae],o(e.charCodeAt(0)));)if(++Ae,"\\"===e&&Ce>Ae)if(e=Me[Ae],"u"===e){if(++Ae,r=Ae,e=f("u"))for(n+=e,t+="\\u";Ae>r;++r)t+=Me[r];else Ae=r,n+="u",t+="\\u";R({},ke.UnexpectedToken,"ILLEGAL")}else t+="\\",R({},ke.UnexpectedToken,"ILLEGAL");else n+=e,t+=e;return{value:n,literal:t}}function M(){var e,t,n,r;return De=null,d(),e=Ae,t=k(),n=S(),r=w(t.value,n.value),Ne.tokenize?{type:_e.RegularExpression,value:r,regex:{pattern:t.value,flags:n.value},lineNumber:Ee,lineStart:Le,start:e,end:Ae}:{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Ae}}function T(){var e,t,n,r;return d(),e=Ae,t={start:{line:Ee,column:Ae-Le}},n=M(),t.end={line:Ee,column:Ae-Le},Ne.tokenize||(Ne.tokens.length>0&&(r=Ne.tokens[Ne.tokens.length-1],r.range[0]===e&&"Punctuator"===r.type&&("/"===r.value||"/="===r.value)&&Ne.tokens.pop()),Ne.tokens.push({type:"RegularExpression",value:n.literal,regex:n.regex,range:[e,Ae],loc:t})),n}function A(e){return e.type===_e.Identifier||e.type===_e.Keyword||e.type===_e.BooleanLiteral||e.type===_e.NullLiteral}function E(){var e,t;if(e=Ne.tokens[Ne.tokens.length-1],!e)return T();if("Punctuator"===e.type){if("]"===e.value)return v();if(")"===e.value)return t=Ne.tokens[Ne.openParenToken-1],!t||"Keyword"!==t.type||"if"!==t.value&&"while"!==t.value&&"for"!==t.value&&"with"!==t.value?v():T();if("}"===e.value){if(Ne.tokens[Ne.openCurlyToken-3]&&"Keyword"===Ne.tokens[Ne.openCurlyToken-3].type){if(t=Ne.tokens[Ne.openCurlyToken-4],!t)return v()}else{if(!Ne.tokens[Ne.openCurlyToken-4]||"Keyword"!==Ne.tokens[Ne.openCurlyToken-4].type)return v();if(t=Ne.tokens[Ne.openCurlyToken-5],!t)return T()}return v()}return T()}return"Keyword"===e.type&&"this"!==e.value?T():v()}function L(){var e;return d(),Ae>=Ce?{type:_e.EOF,lineNumber:Ee,lineStart:Le,start:Ae,end:Ae}:(e=Me.charCodeAt(Ae),s(e)?m():40===e||41===e||59===e?v():39===e||34===e?x():46===e?t(Me.charCodeAt(Ae+1))?b():v():t(e)?b():Ne.tokenize&&47===e?E():v()); -}function C(){var e,t,n,r;return d(),e={start:{line:Ee,column:Ae-Le}},t=L(),e.end={line:Ee,column:Ae-Le},t.type!==_e.EOF&&(n=Me.slice(t.start,t.end),r={type:be[t.type],value:n,range:[t.start,t.end],loc:e},t.regex&&(r.regex={pattern:t.regex.pattern,flags:t.regex.flags}),Ne.tokens.push(r)),t}function D(){var e;return e=De,Ae=e.end,Ee=e.lineNumber,Le=e.lineStart,De="undefined"!=typeof Ne.tokens?C():L(),Ae=e.end,Ee=e.lineNumber,Le=e.lineStart,e}function P(){var e,t,n;e=Ae,t=Ee,n=Le,De="undefined"!=typeof Ne.tokens?C():L(),Ae=e,Ee=t,Le=n}function N(){this.line=Ee,this.column=Ae-Le}function I(){this.start=new N,this.end=null}function O(e){e.type===_e.StringLiteral?this.start={line:e.startLineNumber,column:e.start-e.startLineStart}:this.start={line:e.lineNumber,column:e.start-e.lineStart},this.end=null}function j(){Ae=De.start,De.type===_e.StringLiteral?(Ee=De.startLineNumber,Le=De.startLineStart):(Ee=De.lineNumber,Le=De.lineStart),Ne.range&&(this.range=[Ae,0]),Ne.loc&&(this.loc=new I)}function U(e){Ne.range&&(this.range=[e.start,0]),Ne.loc&&(this.loc=new O(e))}function z(){var e,t,n,r;return e=Ae,t=Ee,n=Le,d(),r=Ee!==t,Ae=e,Ee=t,Le=n,r}function F(t,n){var r,i=Array.prototype.slice.call(arguments,2),a=n.replace(/%(\d)/g,function(t,n){return e(nAe&&(e.push(le()),!$(")"));)B(",");return G(")"),e}function ee(){var e,t=new j;return e=D(),A(e)||q(e),t.finishIdentifier(e.value)}function te(){return G("."),ee()}function ne(){var e;return G("["),e=ce(),G("]"),e}function re(){var e,t,n,r,i=Pe.allowIn;for(r=De,Pe.allowIn=!0,e=Z();;)if($("."))n=te(),e=new U(r).finishMemberExpression(".",e,n);else if($("("))t=Q(),e=new U(r).finishCallExpression(e,t);else{if(!$("["))break;n=ne(),e=new U(r).finishMemberExpression("[",e,n)}return Pe.allowIn=i,e}function ie(){var e=re();if(De.type===_e.Punctuator&&($("++")||$("--"))&&!z())throw new Error("Disabled.");return e}function ae(){var e,t,n;if(De.type!==_e.Punctuator&&De.type!==_e.Keyword)t=ie();else{if($("++")||$("--"))throw new Error("Disabled.");if($("+")||$("-")||$("~")||$("!"))n=De,e=D(),t=ae(),t=new U(n).finishUnaryExpression(e.value,t);else{if(Y("delete")||Y("void")||Y("typeof"))throw new Error("Disabled.");t=ie()}}return t}function se(e,t){var n=0;if(e.type!==_e.Punctuator&&e.type!==_e.Keyword)return 0;switch(e.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":n=7;break;case"in":n=t?7:0;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function oe(){var e,t,n,r,i,a,s,o,u,l;if(e=De,u=ae(),r=De,i=se(r,Pe.allowIn),0===i)return u;for(r.prec=i,D(),t=[e,De],s=ae(),a=[u,r,s];(i=se(De,Pe.allowIn))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)s=a.pop(),o=a.pop().value,u=a.pop(),t.pop(),n=new U(t[t.length-1]).finishBinaryExpression(o,u,s),a.push(n);r=D(),r.prec=i,a.push(r),t.push(De),n=ae(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)n=new U(t.pop()).finishBinaryExpression(a[l-1].value,a[l-2],n),l-=2;return n}function ue(){var e,t,n,r,i;return i=De,e=oe(),$("?")&&(D(),t=Pe.allowIn,Pe.allowIn=!0,n=le(),Pe.allowIn=t,G(":"),r=le(),e=new U(i).finishConditionalExpression(e,n,r)),e}function le(){var e,t,n,r;return e=Pe.parenthesisCount,r=De,t=De,n=ue()}function ce(){var e=le();if($(","))throw new Error("Disabled.");return e}function de(e){var t=ce();return H(),e.finishExpressionStatement(t)}function fe(){var e,t,n=De.type;if(n===_e.EOF&&q(De),n===_e.Punctuator&&"{"===De.value)throw new Error("Disabled.");if(t=new j,n===_e.Punctuator)switch(De.value){case";":throw new Error("Disabled.");case"(":return de(t)}else if(n===_e.Keyword)throw new Error("Disabled.");return e=ce(),H(),t.finishExpressionStatement(e)}function he(){if(De.type===_e.Keyword)switch(De.value){case"const":case"let":throw new Error("Disabled.");case"function":throw new Error("Disabled.");default:return fe()}return De.type!==_e.EOF?fe():void 0}function pe(){for(var e,t,n,r,i=[];Ce>Ae&&(t=De,t.type===_e.StringLiteral)&&(e=he(),i.push(e),e.expression.type===xe.Literal);)n=Me.slice(t.start+1,t.end-1),"use strict"===n?(Te=!0,r&&R(r,ke.StrictOctalLiteral)):!r&&t.octal&&(r=t);for(;Ce>Ae&&(e=he(),"undefined"!=typeof e);)i.push(e);return i}function ge(){var e,t;return d(),P(),t=new j,Te=!0,e=pe(),t.finishProgram(e)}function me(){var e,t,n,r=[];for(e=0;e0?1:0,Le=0,Ce=Me.length,De=null,Pe={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},Ne={},t=t||{},t.tokens=!0,Ne.tokens=[],Ne.tokenize=!0,Ne.openParenToken=-1,Ne.openCurlyToken=-1,Ne.range="boolean"==typeof t.range&&t.range,Ne.loc="boolean"==typeof t.loc&&t.loc,"boolean"==typeof t.tolerant&&t.tolerant&&(Ne.errors=[]);try{if(P(),De.type===_e.EOF)return Ne.tokens;for(D();De.type!==_e.EOF;)try{D()}catch(i){if(Ne.errors){Ne.errors.push(i);break}throw i}me(),r=Ne.tokens,"undefined"!=typeof Ne.errors&&(r.errors=Ne.errors)}catch(a){throw a}finally{Ne={}}return r}function ye(e,t){var n,r;r=String,"string"==typeof e||e instanceof String||(e=r(e)),Me=e,Ae=0,Ee=Me.length>0?1:0,Le=0,Ce=Me.length,De=null,Pe={allowIn:!0,labelSet:{},parenthesisCount:0,inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},Ne={},"undefined"!=typeof t&&(Ne.range="boolean"==typeof t.range&&t.range,Ne.loc="boolean"==typeof t.loc&&t.loc,Ne.loc&&null!==t.source&&void 0!==t.source&&(Ne.source=r(t.source)),"boolean"==typeof t.tokens&&t.tokens&&(Ne.tokens=[]),"boolean"==typeof t.tolerant&&t.tolerant&&(Ne.errors=[]));try{n=ge(),"undefined"!=typeof Ne.tokens&&(me(),n.tokens=Ne.tokens),"undefined"!=typeof Ne.errors&&(n.errors=Ne.errors)}catch(i){throw i}finally{Ne={}}return n}var _e,be,xe,we,ke,Se,Me,Te,Ae,Ee,Le,Ce,De,Pe,Ne;_e={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9},be={},be[_e.BooleanLiteral]="Boolean",be[_e.EOF]="",be[_e.Identifier]="Identifier",be[_e.Keyword]="Keyword",be[_e.NullLiteral]="Null",be[_e.NumericLiteral]="Numeric",be[_e.Punctuator]="Punctuator",be[_e.StringLiteral]="String",be[_e.RegularExpression]="RegularExpression",xe={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpression",ConditionalExpression:"ConditionalExpression",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",UnaryExpression:"UnaryExpression"},we={Data:1,Get:2,Set:4},ke={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},Se={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},U.prototype=j.prototype={finish:function(){Ne.range&&(this.range[1]=Ae),Ne.loc&&(this.loc.end=new N,Ne.source&&(this.loc.source=Ne.source))},finishArrayExpression:function(e){return this.type=xe.ArrayExpression,this.elements=e,this.finish(),this},finishAssignmentExpression:function(e,t,n){return this.type=xe.AssignmentExpression,this.operator=e,this.left=t,this.right=n,this.finish(),this},finishBinaryExpression:function(e,t,n){return this.type="||"===e||"&&"===e?xe.LogicalExpression:xe.BinaryExpression,this.operator=e,this.left=t,this.right=n,this.finish(),this},finishCallExpression:function(e,t){return this.type=xe.CallExpression,this.callee=e,this.arguments=t,this.finish(),this},finishConditionalExpression:function(e,t,n){return this.type=xe.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n,this.finish(),this},finishExpressionStatement:function(e){return this.type=xe.ExpressionStatement,this.expression=e,this.finish(),this},finishIdentifier:function(e){return this.type=xe.Identifier,this.name=e,this.finish(),this},finishLiteral:function(e){return this.type=xe.Literal,this.value=e.value,this.raw=Me.slice(e.start,e.end),e.regex&&("//"==this.raw&&(this.raw="/(?:)/"),this.regex=e.regex),this.finish(),this},finishMemberExpression:function(e,t,n){return this.type=xe.MemberExpression,this.computed="["===e,this.object=t,this.property=n,this.finish(),this},finishObjectExpression:function(e){return this.type=xe.ObjectExpression,this.properties=e,this.finish(),this},finishProgram:function(e){return this.type=xe.Program,this.body=e,this.finish(),this},finishProperty:function(e,t,n){return this.type=xe.Property,this.key=t,this.value=n,this.kind=e,this.finish(),this},finishUnaryExpression:function(e,t){return this.type=xe.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0,this.finish(),this}};var Ie={"if":1,"this":1};return{tokenize:ve,parse:ye}}()},{}],45:[function(e,t,n){function r(e){e="[Vega Log] "+e,console.log(e)}function i(e){e="[Vega Err] "+e,console.error(e)}function a(e,t){if(a.enable){var n=Function.prototype.bind.call(console.log,console),r={prevTime:Date.now()-s,stamp:e.stamp};e.add&&(r.add=e.add.length,r.mod=e.mod.length,r.rem=e.rem.length,r.reflow=!!e.reflow),n.apply(console,(t.push(JSON.stringify(r)),t)),s=Date.now()}}var s=Date.now();t.exports={log:r,error:i,debug:(a.enable=!1,a)}},{}],46:[function(e,t,n){t.exports={path:e("./path"),render:e("./render"),Item:e("./util/Item"),bound:e("./util/bound"),Bounds:e("./util/Bounds"),Gradient:e("./util/Gradient"),toJSON:e("./util/scene").toJSON,fromJSON:e("./util/scene").fromJSON}},{"./path":48,"./render":68,"./util/Bounds":74,"./util/Gradient":76,"./util/Item":78,"./util/bound":79,"./util/scene":82}],47:[function(e,t,n){function r(e,t,n,r,i,s,u,l,c){var d=o.call(arguments);if(a[d])return a[d];var f=u*(Math.PI/180),h=Math.sin(f),p=Math.cos(f);n=Math.abs(n),r=Math.abs(r);var g=p*(l-e)*.5+h*(c-t)*.5,m=p*(c-t)*.5-h*(l-e)*.5,v=g*g/(n*n)+m*m/(r*r);v>1&&(v=Math.sqrt(v),n*=v,r*=v);var y=p/n,_=h/n,b=-h/r,x=p/r,w=y*l+_*c,k=b*l+x*c,S=y*e+_*t,M=b*e+x*t,T=(S-w)*(S-w)+(M-k)*(M-k),A=1/T-.25;0>A&&(A=0);var E=Math.sqrt(A);s==i&&(E=-E);var L=.5*(w+S)-E*(M-k),C=.5*(k+M)+E*(S-w),D=Math.atan2(k-C,w-L),P=Math.atan2(M-C,S-L),N=P-D;0>N&&1===s?N+=2*Math.PI:N>0&&0===s&&(N-=2*Math.PI);for(var I=Math.ceil(Math.abs(N/(.5*Math.PI+.001))),O=[],j=0;I>j;++j){var U=D+j*N/I,z=D+(j+1)*N/I;O[j]=[L,C,U,z,n,r,h,p]}return a[d]=O}function i(e){var t=o.call(e);if(s[t])return s[t];var n=e[0],r=e[1],i=e[2],a=e[3],u=e[4],l=e[5],c=e[6],d=e[7],f=d*u,h=-c*l,p=c*u,g=d*l,m=Math.cos(i),v=Math.sin(i),y=Math.cos(a),_=Math.sin(a),b=.5*(a-i),x=Math.sin(.5*b),w=8/3*x*x/Math.sin(b),k=n+m-w*v,S=r+v+w*m,M=n+y,T=r+_,A=M+w*_,E=T-w*y;return s[t]=[f*k+h*S,p*k+g*S,f*A+h*E,p*A+g*E,f*M+h*T,p*M+g*T]}var a={},s={},o=[].join;t.exports={segments:r,bezier:i,cache:{segments:a,bezier:s}}},{}],48:[function(e,t,n){t.exports={parse:e("./parse"),render:e("./render")}},{"./parse":49,"./render":50}],49:[function(e,t,n){var r={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];t.exports=function(e){var t,n,a,s,o,u,l,c,d,f,h,p=[];for(t=e.slice().replace(i[0],"###$1").split(i[1]).slice(1),c=0,f=t.length;f>c;++c){for(n=t[c],a=n.slice(1).trim().replace(i[2],"$1###$2").split(i[3]),u=n.charAt(0),s=[u],d=0,h=a.length;h>d;++d)(o=+a[d])===o&&s.push(o);if(l=r[u.toLowerCase()],s.length-1>l)for(d=1,h=s.length;h>d;d+=l)p.push([u].concat(s.slice(d,d+l)));else p.push(s)}return p}},{}],50:[function(e,t,n){function r(e,t,n,r){for(var a=i.segments(r[5],r[6],r[0],r[1],r[3],r[4],r[2],t,n),s=0;sg;++g){switch(a=t[g],a[0]){case"l":d+=a[1],f+=a[2],e.lineTo(d+n,f+i);break;case"L":d=a[1],f=a[2],e.lineTo(d+n,f+i);break;case"h":d+=a[1],e.lineTo(d+n,f+i);break;case"H":d=a[1],e.lineTo(d+n,f+i);break;case"v":f+=a[1],e.lineTo(d+n,f+i);break;case"V":f=a[1],e.lineTo(d+n,f+i);break;case"m":d+=a[1],f+=a[2],e.moveTo(d+n,f+i);break;case"M":d=a[1],f=a[2],e.moveTo(d+n,f+i);break;case"c":s=d+a[5],o=f+a[6],h=d+a[3],p=f+a[4],e.bezierCurveTo(d+a[1]+n,f+a[2]+i,h+n,p+i,s+n,o+i),d=s,f=o;break;case"C":d=a[5],f=a[6],h=a[3],p=a[4],e.bezierCurveTo(a[1]+n,a[2]+i,h+n,p+i,d+n,f+i);break;case"s":s=d+a[3],o=f+a[4],h=2*d-h,p=2*f-p,e.bezierCurveTo(h+n,p+i,d+a[1]+n,f+a[2]+i,s+n,o+i),h=d+a[1],p=f+a[2],d=s,f=o;break;case"S":s=a[3],o=a[4],h=2*d-h,p=2*f-p,e.bezierCurveTo(h+n,p+i,a[1]+n,a[2]+i,s+n,o+i),d=s,f=o,h=a[1],p=a[2];break;case"q":s=d+a[3],o=f+a[4],h=d+a[1],p=f+a[2],e.quadraticCurveTo(h+n,p+i,s+n,o+i),d=s,f=o;break;case"Q":s=a[3],o=a[4],e.quadraticCurveTo(a[1]+n,a[2]+i,s+n,o+i),d=s,f=o,h=a[1],p=a[2];break;case"t":s=d+a[1],o=f+a[2],null===c[0].match(/[QqTt]/)?(h=d,p=f):"t"===c[0]?(h=2*d-u,p=2*f-l):"q"===c[0]&&(h=2*d-h,p=2*f-p),u=h,l=p,e.quadraticCurveTo(h+n,p+i,s+n,o+i),d=s,f=o,h=d+a[1],p=f+a[2];break;case"T":s=a[1],o=a[2],h=2*d-h,p=2*f-p,e.quadraticCurveTo(h+n,p+i,s+n,o+i),d=s,f=o;break;case"a":r(e,d+n,f+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+n,a[7]+f+i]),d+=a[6],f+=a[7];break;case"A":r(e,d+n,f+i,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+i]),d=a[6],f=a[7];break;case"z":case"Z":e.closePath()}c=a}}},{"./arc":47}],51:[function(e,t,n){function r(){this._active=null,this._handlers={}}var i=r.prototype;i.initialize=function(e,t,n){return this._el=e,this._obj=n||null,this.padding(t)},i.element=function(){return this._el},i.padding=function(e){return this._padding=e||{top:0,left:0,bottom:0,right:0},this},i.scene=function(e){return arguments.length?(this._scene=e,this):this._scene},i.on=function(){},i.off=function(){},i.handlers=function(){var e,t=this._handlers,n=[];for(e in t)n.push.apply(n,t[e]);return n},i.eventName=function(e){var t=e.indexOf(".");return 0>t?e:e.slice(0,t)},t.exports=r},{}],52:[function(e,t,n){function r(){this._el=null,this._bgcolor=null}var i=r.prototype;i.initialize=function(e,t,n,r){return this._el=e,this.resize(t,n,r)},i.element=function(){return this._el},i.scene=function(){return this._el&&this._el.firstChild},i.background=function(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)},i.resize=function(e,t,n){return this._width=e,this._height=t,this._padding=n||{top:0,left:0,bottom:0,right:0},this},i.render=function(){return this},t.exports=r},{}],53:[function(e,t,n){function r(){a.call(this),this._down=null,this._touch=null,this._first=!0}var i=e("../../util/dom"),a=e("../Handler"),s=e("./marks"),o=a.prototype,u=r.prototype=Object.create(o);u.constructor=r,u.initialize=function(e,t,n){var r=this._canvas=i.find(e,"canvas"),a=this;return this.events.forEach(function(e){r.addEventListener(e,function(t){u[e]?u[e].call(a,t):a.fire(e,t)})}),o.initialize.call(this,e,t,n)},u.canvas=function(){return this._canvas},u.context=function(){return this._canvas.getContext("2d")},u.events=["keydown","keypress","keyup","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],u.DOMMouseScroll=function(e){this.fire("mousewheel",e)},u.mousemove=function(e){var t=this._active,n=this.pickEvent(e);n===t?this.fire("mousemove",e):(this.fire("mouseout",e),this._active=n,this.fire("mouseover",e),this.fire("mousemove",e))},u.mouseout=function(e){this.fire("mouseout",e),this._active=null},u.mousedown=function(e){this._down=this._active,this.fire("mousedown",e)},u.click=function(e){this._down===this._active&&(this.fire("click",e),this._down=null)},u.touchstart=function(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",e,!0)},u.touchmove=function(e){this.fire("touchmove",e,!0)},u.touchend=function(e){this.fire("touchend",e,!0),this._touch=null},u.fire=function(e,t,n){var r,i,a=n?this._touch:this._active,s=this._handlers[e];if(s)for(t.vegaType=e,r=0,i=s.length;i>r;++r)s[r].handler.call(this._obj,t,a)},u.on=function(e,t){var n=this.eventName(e),r=this._handlers;return(r[n]||(r[n]=[])).push({type:e,handler:t}),this},u.off=function(e,t){var n,r=this.eventName(e),i=this._handlers[r];if(i){for(n=i.length;--n>=0;)i[n].type===e&&(t&&i[n].handler!==t||i.splice(n,1));return this}},u.pickEvent=function(e){var t,n,r=this._canvas.getBoundingClientRect(),i=this._padding;return this.pick(this._scene,t=e.clientX-r.left,n=e.clientY-r.top,t-i.left,n-i.top)},u.pick=function(e,t,n,r,i){var a=this.context(),o=s[e.marktype];return o.pick.call(this,a,e,t,n,r,i)},t.exports=r},{"../../util/dom":81,"../Handler":51,"./marks":60}],54:[function(e,t,n){function r(e){c.call(this),this._loader=new u(e)}function i(e,t){if(!t)return null;var n,r,i,s,u,l=new o;for(n=0,r=t.length;r>n;++n)i=t[n],s=i.mark,u=s.group,i=d[s.marktype].nested?s:i,l.union(a(i.bounds,u)),i["bounds:prev"]&&l.union(a(i["bounds:prev"],u));return l.round(),e.beginPath(),e.rect(l.x1,l.y1,l.width(),l.height()),e.clip(),l}function a(e,t){if(null==t)return e;for(var n=e.clone();null!=t;t=t.mark.group)n.translate(t.x||0,t.y||0);return n}var s=e("../../util/dom"),o=e("../../util/Bounds"),u=e("../../util/ImageLoader"),l=e("../../util/canvas"),c=e("../Renderer"),d=e("./marks");r.RETINA=!0;var f=c.prototype,h=r.prototype=Object.create(f);h.constructor=r,h.initialize=function(e,t,n,r){return this._canvas=l.instance(t,n),e&&(s.clear(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),f.initialize.call(this,e,t,n,r)},h.resize=function(e,t,n){return f.resize.call(this,e,t,n),l.resize(this._canvas,this._width,this._height,this._padding,r.RETINA),this},h.canvas=function(){return this._canvas},h.context=function(){return this._canvas?this._canvas.getContext("2d"):null},h.pendingImages=function(){return this._loader.pending()},h.render=function(e,t){var n,r=this.context(),a=this._padding,s=this._width+a.left+a.right,o=this._height+a.top+a.bottom;return this._scene=e,r.save(),n=i(r,t),this.clear(-a.left,-a.top,s,o),this.draw(r,e,n),r.restore(),this._scene=null,this},h.draw=function(e,t,n){var r=d[t.marktype];r.draw.call(this,e,t,n)},h.clear=function(e,t,n,r){var i=this.context();i.clearRect(e,t,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(e,t,n,r))},h.loadImage=function(e){var t=this,n=this._scene;return this._loader.loadImage(e,function(){t.renderAsync(n)})},h.renderAsync=function(e){var t=this;t._async_id&&clearTimeout(t._async_id),t._async_id=setTimeout(function(){t.render(e),delete t._async_id},10)},t.exports=r},{"../../util/Bounds":74,"../../util/ImageLoader":77,"../../util/canvas":80,"../../util/dom":81,"../Renderer":52,"./marks":60}],55:[function(e,t,n){t.exports={Handler:e("./CanvasHandler"),Renderer:e("./CanvasRenderer")}},{"./CanvasHandler":53,"./CanvasRenderer":54}],56:[function(e,t,n){function r(e,t){var n=t.x||0,r=t.y||0,i=t.innerRadius||0,s=t.outerRadius||0,o=(t.startAngle||0)-a,u=(t.endAngle||0)-a;e.beginPath(),0===i?e.moveTo(n,r):e.arc(n,r,i,o,u,0),e.arc(n,r,s,u,o,1),e.closePath()}var i=e("./util"),a=Math.PI/2;t.exports={draw:i.drawAll(r),pick:i.pickPath(r)}},{"./util":67}],57:[function(e,t,n){function r(e,t){var n=t[0],r=n.pathCache||(n.pathCache=s(u(t)));o(e,r)}function i(e,t,n,r,i,a){var s=t.items,o=t.bounds;return!s||!s.length||o&&!o.contains(i,a)?null:(null!=e.pixelratio&&1!==e.pixelratio&&(n*=e.pixelratio,r*=e.pixelratio),l(e,s,n,r)?s[0]:null)}var a=e("./util"),s=e("../../../path/parse"),o=e("../../../path/render"),u=e("../../../util/svg").path.area,l=a.testPath(r);t.exports={draw:a.drawOne(r),pick:i,nested:!0}},{"../../../path/parse":49,"../../../path/render":50,"../../../util/svg":83,"./util":67}],58:[function(e,t,n){function r(e,t,n){if(t.items&&t.items.length){var r,i,a,s,u,l,c,d,f,h,p=t.items,g=this;for(o.draw.call(g,e,t,n),c=0,d=p.length;d>c;++c){for(r=p[c],a=r.axisItems||[],i=r.items||[],s=r.legendItems||[],u=r.x||0,l=r.y||0,e.save(),e.translate(u,l),r.clip&&(e.beginPath(),e.rect(0,0,r.width||0,r.height||0),e.clip()),n&&n.translate(-u,-l),f=0,h=a.length;h>f;++f)"back"===a[f].layer&&g.draw(e,a[f],n);for(f=0,h=i.length;h>f;++f)g.draw(e,i[f],n);for(f=0,h=a.length;h>f;++f)"back"!==a[f].layer&&g.draw(e,a[f],n);for(f=0,h=s.length;h>f;++f)g.draw(e,s[f],n);n&&n.translate(u,l),e.restore()}}}function i(e,t){return t.fill||t.stroke}function a(e,t,n,r,i,a){if(t.bounds&&!t.bounds.contains(i,a))return null;var s,o,l,c,d,f,h,p=t.items||[];for(f=p.length;--f>=0;){for(o=p[f],c=o.x||0,d=o.y||0,e.save(),e.translate(c,d),h=o.items.length;--h>=0;)if(s=o.items[h],s.interactive!==!1&&(l=this.pick(s,n,r,i-c,a-d)))return e.restore(),l;e.restore()}return t.interactive!==!1?u(e,t,n,r,i,a):null}var s=e("./util"),o=e("./rect"),u=s.pick(i);t.exports={draw:r,pick:a}},{"./rect":63,"./util":67}],59:[function(e,t,n){function r(e,t,n){if(t.items&&t.items.length)for(var r,i=this,a=t.items,s=0,o=a.length;o>s;++s)if(r=a[s],!n||n.intersects(r.bounds)){r.image&&r.image.url===r.url||(r.image=i.loadImage(r.url),r.image.url=r.url);var u,l=r.x||0,c=r.y||0,d=r.width||r.image&&r.image.width||0,f=r.height||r.image&&r.image.height||0;l-="center"===r.align?d/2:"right"===r.align?d:0,c-="middle"===r.baseline?f/2:"bottom"===r.baseline?f:0,r.image.loaded&&(e.globalAlpha=null!=(u=r.opacity)?u:1,e.drawImage(r.image,l,c,d,f))}}var i=e("./util");t.exports={draw:r,pick:i.pick()}},{"./util":67}],60:[function(e,t,n){t.exports={arc:e("./arc"),area:e("./area"),group:e("./group"),image:e("./image"),line:e("./line"),path:e("./path"),rect:e("./rect"),rule:e("./rule"),symbol:e("./symbol"),text:e("./text")}},{"./arc":56,"./area":57,"./group":58,"./image":59,"./line":61,"./path":62,"./rect":63,"./rule":64,"./symbol":65,"./text":66}],61:[function(e,t,n){function r(e,t){var n=t[0],r=n.pathCache||(n.pathCache=s(u(t)));o(e,r)}function i(e,t,n,r,i,a){var s=t.items,o=t.bounds;return!s||!s.length||o&&!o.contains(i,a)?null:(null!=e.pixelratio&&1!==e.pixelratio&&(n*=e.pixelratio,r*=e.pixelratio),l(e,s,n,r)?s[0]:null)}var a=e("./util"),s=e("../../../path/parse"),o=e("../../../path/render"),u=e("../../../util/svg").path.line,l=a.testPath(r,!1);t.exports={draw:a.drawOne(r),pick:i,nested:!0}},{"../../../path/parse":49,"../../../path/render":50,"../../../util/svg":83,"./util":67}],62:[function(e,t,n){function r(e,t){if(null==t.path)return!0;var n=t.pathCache||(t.pathCache=a(t.path));s(e,n,t.x,t.y)}var i=e("./util"),a=e("../../../path/parse"),s=e("../../../path/render");t.exports={draw:i.drawAll(r),pick:i.pickPath(r)}},{"../../../path/parse":49,"../../../path/render":50,"./util":67}],63:[function(e,t,n){function r(e,t,n){if(t.items&&t.items.length)for(var r,a,s,o,u,l,c=t.items,d=0,f=c.length;f>d;++d)r=c[d],(!n||n.intersects(r.bounds))&&(a=null==r.opacity?1:r.opacity,0!==a&&(s=r.x||0,o=r.y||0,u=r.width||0,l=r.height||0,r.fill&&i.fill(e,r,a)&&e.fillRect(s,o,u,l),r.stroke&&i.stroke(e,r,a)&&e.strokeRect(s,o,u,l)))}var i=e("./util");t.exports={draw:r,pick:i.pick()}},{"./util":67}],64:[function(e,t,n){function r(e,t,n){if(t.items&&t.items.length)for(var r,i,a,o,u,l,c=t.items,d=0,f=c.length;f>d;++d)r=c[d],(!n||n.intersects(r.bounds))&&(i=null==r.opacity?1:r.opacity,0!==i&&(a=r.x||0,o=r.y||0,u=null!=r.x2?r.x2:a,l=null!=r.y2?r.y2:o,r.stroke&&s.stroke(e,r,i)&&(e.beginPath(),e.moveTo(a,o),e.lineTo(u,l),e.stroke())))}function i(e,t){var n=t.x||0,r=t.y||0,i=null!=t.x2?t.x2:n,a=null!=t.y2?t.y2:r,s=t.strokeWidth,o=t.strokeCap;e.lineWidth=null!=s?s:1,e.lineCap=null!=o?o:"butt",e.beginPath(),e.moveTo(n,r),e.lineTo(i,a)}function a(e,t,n,r){return e.isPointInStroke?(i(e,t),e.isPointInStroke(n,r)):!1}var s=e("./util");t.exports={draw:r,pick:s.pick(a)}},{"./util":67}],65:[function(e,t,n){function r(e,t){var n,r,i,o,u=null!=t.size?t.size:100,l=t.x,c=t.y;if(e.beginPath(),null==t.shape||"circle"===t.shape)return n=Math.sqrt(u/Math.PI),e.arc(l,c,n,0,2*Math.PI,0),void e.closePath();switch(t.shape){case"cross":n=Math.sqrt(u/5)/2,r=3*n,e.moveTo(l-r,c-n),e.lineTo(l-n,c-n),e.lineTo(l-n,c-r),e.lineTo(l+n,c-r),e.lineTo(l+n,c-n),e.lineTo(l+r,c-n),e.lineTo(l+r,c+n),e.lineTo(l+n,c+n),e.lineTo(l+n,c+r),e.lineTo(l-n,c+r),e.lineTo(l-n,c+n),e.lineTo(l-r,c+n);break;case"diamond":o=Math.sqrt(u/(2*s)),i=o*s,e.moveTo(l,c-o),e.lineTo(l+i,c),e.lineTo(l,c+o),e.lineTo(l-i,c);break;case"square":r=Math.sqrt(u),n=r/2,e.rect(l-n,c-n,r,r);break;case"triangle-down":i=Math.sqrt(u/a),o=i*a/2,e.moveTo(l,c+o),e.lineTo(l+i,c-o),e.lineTo(l-i,c-o);break;case"triangle-up":i=Math.sqrt(u/a),o=i*a/2,e.moveTo(l,c-o),e.lineTo(l+i,c+o),e.lineTo(l-i,c+o)}e.closePath()}var i=e("./util"),a=Math.sqrt(3),s=Math.tan(30*Math.PI/180);t.exports={draw:i.drawAll(r),pick:i.pickPath(r)}},{"./util":67}],66:[function(e,t,n){function r(e,t,n){if(t.items&&t.items.length)for(var r,i,a,s,l,c,d,f=t.items,h=0,p=f.length;p>h;++h)r=f[h],(!n||n.intersects(r.bounds))&&(d=o.value(r.text),d&&(i=null==r.opacity?1:r.opacity,0!==i&&(e.font=o.font(r),e.textAlign=r.align||"left", -a=r.x||0,s=r.y||0,(l=r.radius)&&(c=(r.theta||0)-Math.PI/2,a+=l*Math.cos(c),s+=l*Math.sin(c)),r.angle&&(e.save(),e.translate(a,s),e.rotate(r.angle*Math.PI/180),a=s=0),a+=r.dx||0,s+=(r.dy||0)+o.offset(r),r.fill&&u.fill(e,r,i)&&e.fillText(d,a,s),r.stroke&&u.stroke(e,r,i)&&e.strokeText(d,a,s),r.angle&&e.restore())))}function i(e,t,n,r,i,a){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var o=s(t,l,!0),u=-t.angle*Math.PI/180,c=Math.cos(u),d=Math.sin(u),f=t.x,h=t.y,p=c*i-d*a+(f-f*c+h*d),g=d*i+c*a+(h-f*d-h*c);return o.contains(p,g)}var a=e("../../../util/Bounds"),s=e("../../../util/bound").text,o=e("../../../util/text"),u=e("./util"),l=new a;t.exports={draw:r,pick:u.pick(i)}},{"../../../util/Bounds":74,"../../../util/bound":79,"../../../util/text":84,"./util":67}],67:[function(e,t,n){function r(e,t,n,r){if(!e(t,r)){var i=null==n.opacity?1:n.opacity;0!==i&&(n.fill&&c(t,n,i)&&t.fill(),n.stroke&&d(t,n,i)&&t.stroke())}}function i(e,t,n,i){var a,s,o;for(a=0,s=n.items.length;s>a;++a)o=n.items[a],(!i||i.intersects(o.bounds))&&r(e,t,o,o)}function a(e){return function(t,n,r){i(e,t,n,r)}}function s(e){return function(t,n,i){n.items.length&&(!i||i.intersects(n.bounds))&&r(e,t,n.items[0],n.items)}}function o(e){return e||(e=p),function(t,n,r,i,a,s){if(!n.items.length)return null;var o,u,l;for(null!=t.pixelratio&&1!==t.pixelratio&&(r*=t.pixelratio,i*=t.pixelratio),l=n.items.length;--l>=0;)if(o=n.items[l],u=o.bounds,(!u||u.contains(a,s))&&u&&e(t,o,r,i,a,s))return o;return null}}function u(e,t){return function(n,r,i,a){var s,o,u=Array.isArray(r)?r[0]:r,l=null==t?u.fill:t,c=u.stroke&&n.isPointInStroke;return c&&(s=u.strokeWidth,o=u.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=o?o:"butt"),e(n,r)?!1:l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a)}}function l(e){return o(u(e))}function c(e,t,n){return n*=null==t.fillOpacity?1:t.fillOpacity,n>0?(e.globalAlpha=n,e.fillStyle=f(e,t,t.fill),!0):!1}function d(e,t,n){var r,i=null!=(i=t.strokeWidth)?i:1;return 0>=i?!1:(n*=null==t.strokeOpacity?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=f(e,t,t.stroke),e.lineWidth=i,e.lineCap=null!=(r=t.strokeCap)?r:"butt",e.vgLineDash(t.strokeDash||null),e.vgLineDashOffset(t.strokeDashOffset||0),!0):!1)}function f(e,t,n){return n.id?h(e,n,t.bounds):n}function h(e,t,n){var r,i,a=n.width(),s=n.height(),o=n.x1+t.x1*a,u=n.y1+t.y1*s,l=n.x1+t.x2*a,c=n.y1+t.y2*s,d=e.createLinearGradient(o,u,l,c),f=t.stops;for(r=0,i=f.length;i>r;++r)d.addColorStop(f[r].offset,f[r].color);return d}var p=function(){return!0};t.exports={drawOne:s,drawAll:a,pick:o,pickPath:l,testPath:u,stroke:d,fill:c,color:f,gradient:h}},{}],68:[function(e,t,n){t.exports={canvas:e("./canvas"),svg:e("./svg")}},{"./canvas":55,"./svg":72}],69:[function(e,t,n){function r(){a.call(this)}var i=e("../../util/dom"),a=e("../Handler"),s=a.prototype,o=r.prototype=Object.create(s);o.constructor=r,o.initialize=function(e,t,n){return this._svg=i.find(e,"svg"),s.initialize.call(this,e,t,n)},o.svg=function(){return this._svg},o.listener=function(e){var t=this;return function(n){var r=n.target,i=r.__data__;n.vegaType=n.type,i=Array.isArray(i)?i[0]:i,e.call(t._obj,n,i)}},o.on=function(e,t){var n=this.eventName(e),r=this._svg,i=this._handlers,a={type:e,handler:t,listener:this.listener(t)};return(i[n]||(i[n]=[])).push(a),r.addEventListener(n,a.listener),this},o.off=function(e,t){var n,r=this.eventName(e),i=this._svg,a=this._handlers[r];if(a){for(n=a.length;--n>=0;)(a[n].type===e&&!t||a[n].handler===t)&&(i.removeEventListener(r,a[n].listener),a.splice(n,1));return this}},t.exports=r},{"../../util/dom":81,"../Handler":51}],70:[function(e,t,n){function r(e){c.call(this),this._loader=new l(e),this._dirtyID=0}function i(e,t,n){var r,i,a;for(e=f.child(e,n,"linearGradient",p),e.setAttribute("id",t.id),e.setAttribute("x1",t.x1),e.setAttribute("x2",t.x2),e.setAttribute("y1",t.y1),e.setAttribute("y2",t.y2),r=0,i=t.stops.length;i>r;++r)a=f.child(e,r,"stop",p),a.setAttribute("offset",t.stops[r].offset),a.setAttribute("stop-color",t.stops[r].color);f.clear(e,r)}function a(e,t,n){var r;e=f.child(e,n,"clipPath",p),e.setAttribute("id",t.id),r=f.child(e,0,"rect",p),r.setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",t.width),r.setAttribute("height",t.height)}function s(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function o(e,t,n,r,i){var a=f.child(e,r,t.tag,p,null,i);if(a.__data__=n,a.__values__={fill:"default"},"g"===t.tag){var s=f.child(a,0,"rect",p,"background");s.__data__=n}return n._svg=a}function u(e,t,n){t!==b[e]&&(null!=t?n?_.setAttributeNS(n,e,t):_.setAttribute(e,t):n?_.removeAttributeNS(n,e):_.removeAttribute(e),b[e]=t)}var l=e("../../util/ImageLoader"),c=e("../Renderer"),d=e("../../util/text"),f=e("../../util/dom"),h=e("../../util/svg"),p=h.metadata.xmlns,g=e("./marks"),m=c.prototype,v=r.prototype=Object.create(m);v.constructor=r,v.initialize=function(e,t,n,r){return e&&(this._svg=f.child(e,0,"svg",p,"marks"),f.clear(e,1),this._root=f.child(this._svg,0,"g",p),f.clear(this._svg,1)),this._defs={clip_id:1,gradient:{},clipping:{}},this.background(this._bgcolor),m.initialize.call(this,e,t,n,r)},v.background=function(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),m.background.apply(this,arguments)},v.resize=function(e,t,n){if(m.resize.call(this,e,t,n),this._svg){var r=this._width,i=this._height,a=this._padding;this._svg.setAttribute("width",r+a.left+a.right),this._svg.setAttribute("height",i+a.top+a.bottom),this._root.setAttribute("transform","translate("+a.left+","+a.top+")")}return this},v.svg=function(){if(!this._svg)return null;var e={"class":"marks",width:this._width+this._padding.left+this._padding.right,height:this._height+this._padding.top+this._padding.bottom};for(var t in h.metadata)e[t]=h.metadata[t];return f.openTag("svg",e)+this._svg.innerHTML+f.closeTag("svg")},v.imageURL=function(e){return this._loader.imageURL(e)},v.render=function(e,t){return this._dirtyCheck(t)&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,e,-1),f.clear(this._root,1)),this.updateDefs(),this},v.draw=function(e,t,n){this.drawMark(e,t,n,g[t.marktype])},v.updateDefs=function(){var e,t=this._svg,n=this._defs,r=n.el,s=0;for(e in n.gradient)r||(r=n.el=f.child(t,0,"defs",p)),i(r,n.gradient[e],s++);for(e in n.clipping)r||(r=n.el=f.child(t,0,"defs",p)),a(r,n.clipping[e],s++);r&&(0===s?(t.removeChild(r),n.el=null):f.clear(r,s))},v._resetDefs=function(){var e=this._defs;e.clip_id=1,e.gradient={},e.clipping={}},v.isDirty=function(e){return this._dirtyAll||e.dirty===this._dirtyID},v._dirtyCheck=function(e){if(this._dirtyAll=!0,!e)return!0;var t,n,r,i,a,o,u,l=++this._dirtyID;for(a=0,o=e.length;o>a;++a)t=e[a],n=t.mark,n.marktype!==r&&(r=n.marktype,i=g[r]),"exit"!==t.status?(t=i.nest?n.items[0]:t,t._update!==l&&(t._svg?this._update(i,t._svg,t):(this._dirtyAll=!1,s(t,l)),t._update=l)):t._svg&&(i.nest&&t.mark.items.length?(this._update(i,t._svg,t.mark.items[0]),u=t.mark.items[0],u._svg=t._svg,u._update=l):f.remove(t._svg),t._svg=null);return!this._dirtyAll},v.drawMark=function(e,t,n,r){if(this.isDirty(t)){var i,a,s,u,l,c,d=r.nest?t.items&&t.items.length?[t.items[0]]:[]:t.items||[],h=t.interactive===!1?"none":null,g="g"===r.tag,m=f.cssClass(t);for(i=f.child(e,n+1,"g",p,m),i.setAttribute("class",m),t._svg=i,!g&&h&&i.style.setProperty("pointer-events",h),a=0,s=d.length;s>a;++a)this.isDirty(l=d[a])&&(c=!(this._dirtyAll||l._svg),u=c?o(i,r,l,a,!0):i.childNodes[a]||o(i,r,l,a),this._update(r,u,l),g&&(c&&(this._dirtyAll=!0),this._recurse(u,l),c&&(this._dirtyAll=!1)));return f.clear(i,a),i}},v._recurse=function(e,t){var n,r,i=t.items||[],a=t.legendItems||[],s=t.axisItems||[],o=0;for(n=0,r=s.length;r>n;++n)"back"===s[n].layer&&this.drawMark(e,s[n],o++,g.group);for(n=0,r=i.length;r>n;++n)this.draw(e,i[n],o++);for(n=0,r=s.length;r>n;++n)"back"!==s[n].layer&&this.drawMark(e,s[n],o++,g.group);for(n=0,r=a.length;r>n;++n)this.drawMark(e,a[n],o++,g.group);f.clear(e,1+o)};var y="undefined"!=typeof window?window.location.href:"",_=null,b=null,x={group:function(e,t,n){_=t.childNodes[0],b=t.__values__,e.background(u,n,this);var r=n.mark.interactive===!1?"none":null;r!==b.events&&(_.style.setProperty("pointer-events",r),b.events=r)},text:function(e,t,n){var r=d.value(n.text);r!==b.text&&(t.textContent=r,b.text=r),r=d.font(n),r!==b.font&&(t.style.setProperty("font",r),b.font=r)}};v._update=function(e,t,n){_=t,b=t.__values__,e.attr(u,n,this);var r=x[e.type];r&&r(e,t,n),this.style(_,n)},v.style=function(e,t){if(null!=t){var n,r,i,a,s;for(n=0,r=h.styleProperties.length;r>n;++n)i=h.styleProperties[n],s=t[i],s!==b[i]&&(a=h.styles[i],null==s?"fill"===a?e.style.setProperty(a,"none"):e.style.removeProperty(a):(s.id&&(this._defs.gradient[s.id]=s,s="url("+y+"#"+s.id+")"),e.style.setProperty(a,s+"")),b[i]=s)}},t.exports=r},{"../../util/ImageLoader":77,"../../util/dom":81,"../../util/svg":83,"../../util/text":84,"../Renderer":52,"./marks":73}],71:[function(e,t,n){function r(e){o.call(this),this._loader=new u(e),this._text={head:"",root:"",foot:"",defs:"",body:""},this._defs={clip_id:1,gradient:{},clipping:{}}}function i(e,t,n,r){v[r||e]=t}function a(e,t,n,r){if(null==e)return"";var i,a,s,o,u,d="";for("bgrect"===n&&t.interactive===!1&&(d+="pointer-events: none;"),"text"===n&&(d+="font: "+c.font(e)+";"),i=0,a=l.styleProperties.length;a>i;++i)s=l.styleProperties[i],o=l.styles[s],u=e[s],null==u?"fill"===o&&(d+=(d.length?" ":"")+"fill: none;"):(u.id&&(r.gradient[u.id]=u,u="url(#"+u.id+")"),d+=(d.length?" ":"")+o+": "+u+";");return d?'style="'+d+'"':null}function s(e){return e.replace(/&/g,"&").replace(//g,">")}var o=e("../Renderer"),u=e("../../util/ImageLoader"),l=e("../../util/svg"),c=e("../../util/text"),d=e("../../util/dom"),f=d.openTag,h=d.closeTag,p=e("./marks"),g=o.prototype,m=r.prototype=Object.create(g);m.constructor=r,m.resize=function(e,t,n){g.resize.call(this,e,t,n);var r=this._padding,i=this._text,a={"class":"marks",width:this._width+r.left+r.right,height:this._height+r.top+r.bottom};for(var s in l.metadata)a[s]=l.metadata[s];return i.head=f("svg",a),i.root=f("g",{transform:"translate("+r.left+","+r.top+")"}),i.foot=h("g")+h("svg"),this},m.svg=function(){var e=this._text;return e.head+e.defs+e.root+e.body+e.foot},m.render=function(e){return this._text.body=this.mark(e),this._text.defs=this.buildDefs(),this},m.reset=function(){return this._defs.clip_id=0,this},m.buildDefs=function(){var e,t,n,r,i=this._defs,a="";for(t in i.gradient){for(n=i.gradient[t],r=n.stops,a+=f("linearGradient",{id:t,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),e=0;e0?f("defs")+a+h("defs"):""},m.imageURL=function(e){return this._loader.imageURL(e)};var v;m.attributes=function(e,t){return v={},e(i,t,this),v},m.mark=function(e){var t,n,r,i=p[e.marktype],o=i.tag,u=i.attr,l=i.nest||!1,g=l?e.items&&e.items.length?[e.items[0]]:[]:e.items||[],m=this._defs,v="";for("g"!==o&&e.interactive===!1&&(t='style="pointer-events: none;"'),v+=f("g",{"class":d.cssClass(e)},t),n=0;nt;++t)"back"===i[t].layer&&(r+=this.mark(i[t]));for(t=0,n=a.length;n>t;++t)r+=this.mark(a[t]);for(t=0,n=i.length;n>t;++t)"back"!==i[t].layer&&(r+=this.mark(i[t]));for(t=0,n=s.length;n>t;++t)r+=this.mark(s[t]);return r},t.exports=r},{"../../util/ImageLoader":77,"../../util/dom":81,"../../util/svg":83,"../../util/text":84,"../Renderer":52,"./marks":73}],72:[function(e,t,n){t.exports={Handler:e("./SVGHandler"),Renderer:e("./SVGRenderer"),string:{Renderer:e("./SVGStringRenderer")}}},{"./SVGHandler":69,"./SVGRenderer":70,"./SVGStringRenderer":71}],73:[function(e,t,n){function r(e){return i(e.x||0,e.y||0)}function i(e,t){return"translate("+e+","+t+")"}var a=e("../../util/text"),s=e("../../util/svg"),o=s.textAlign,u=s.path;t.exports={arc:{tag:"path",type:"arc",attr:function(e,t){e("transform",r(t)),e("d",u.arc(t))}},area:{tag:"path",type:"area",nest:!0,attr:function(e,t){var n=t.mark.items;n.length&&e("d",u.area(n))}},group:{tag:"g",type:"group",attr:function(e,t,n){var i,a,s=null;e("transform",r(t)),t.clip&&(i=n._defs,s=t.clip_id||(t.clip_id="clip"+i.clip_id++),a=i.clipping[s]||(i.clipping[s]={id:s}),a.width=t.width||0,a.height=t.height||0),e("clip-path",s?"url(#"+s+")":null)},background:function(e,t){e("class","background"),e("width",t.width||0),e("height",t.height||0)}},image:{tag:"image",type:"image",attr:function(e,t,n){var r=t.x||0,a=t.y||0,s=t.width||0,o=t.height||0,u=n.imageURL(t.url);r-="center"===t.align?s/2:"right"===t.align?s:0,a-="middle"===t.baseline?o/2:"bottom"===t.baseline?o:0,e("href",u,"http://www.w3.org/1999/xlink","xlink:href"),e("transform",i(r,a)),e("width",s),e("height",o)}},line:{tag:"path",type:"line",nest:!0,attr:function(e,t){var n=t.mark.items;n.length&&e("d",u.line(n))}},path:{tag:"path",type:"path",attr:function(e,t){e("transform",r(t)),e("d",t.path)}},rect:{tag:"rect",type:"rect",nest:!1,attr:function(e,t){e("transform",r(t)),e("width",t.width||0),e("height",t.height||0)}},rule:{tag:"line",type:"rule",attr:function(e,t){e("transform",r(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)}},symbol:{tag:"path",type:"symbol",attr:function(e,t){e("transform",r(t)),e("d",u.symbol(t))}},text:{tag:"text",type:"text",nest:!1,attr:function(e,t){var n,r=t.dx||0,s=(t.dy||0)+a.offset(t),u=t.x||0,l=t.y||0,c=t.angle||0,d=t.radius||0;d&&(n=(t.theta||0)-Math.PI/2,u+=d*Math.cos(n),l+=d*Math.sin(n)),e("text-anchor",o[t.align]||"start"),c?(n=i(u,l)+" rotate("+c+")",(r||s)&&(n+=" "+i(r,s))):n=i(u+r,l+s),e("transform",n)}}}},{"../../util/svg":83,"../../util/text":84}],74:[function(e,t,n){function r(e){this.clear(),e&&this.union(e)}var i=r.prototype;i.clone=function(){return new r(this)},i.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},i.set=function(e,t,n,r){return this.x1=e,this.y1=t,this.x2=n,this.y2=r,this},i.add=function(e,t){return ethis.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},i.expand=function(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},i.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},i.translate=function(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},i.rotate=function(e,t,n){var r=Math.cos(e),i=Math.sin(e),a=t-t*r+n*i,s=n-t*i-n*r,o=this.x1,u=this.x2,l=this.y1,c=this.y2;return this.clear().add(r*o-i*l+a,i*o+r*l+s).add(r*o-i*c+a,i*o+r*c+s).add(r*u-i*l+a,i*u+r*l+s).add(r*u-i*c+a,i*u+r*c+s)},i.union=function(e){return e.x1this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},i.encloses=function(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},i.intersects=function(e){return e&&!(this.x2e.x2||this.y2e.y2)},i.contains=function(e,t){return!(ethis.x2||tthis.y2)},i.width=function(){return this.x2-this.x1},i.height=function(){return this.y2-this.y1},t.exports=r},{}],75:[function(e,t,n){t.exports=function(e){function t(){}function n(t,n){e.add(t,n)}return{bounds:function(t){return arguments.length?(e=t,this):e},beginPath:t,closePath:t,moveTo:n,lineTo:n,quadraticCurveTo:function(t,n,r,i){e.add(t,n),e.add(r,i)},bezierCurveTo:function(t,n,r,i,a,s){e.add(t,n),e.add(r,i),e.add(a,s)}}}},{}],76:[function(e,t,n){function r(e){this.id="gradient_"+i++,this.type=e||"linear",this.stops=[],this.x1=0,this.x2=1,this.y1=0,this.y2=0}var i=0,a=r.prototype;a.stop=function(e,t){return this.stops.push({offset:e,color:t}),this},t.exports=r},{}],77:[function(e,t,n){(function(n){function r(e){this._pending=0,this._config=e||r.Config}function i(e,t){var n=s.sanitizeUrl(this.params(e));if(!n)return t&&t(e,null),null;var r=this,i=new Image;return r._pending+=1,i.onload=function(){r._pending-=1,i.loaded=!0,t&&t(null,i)},i.src=n,i}function a(e,t){var r=this,i=new("undefined"!=typeof window?window.canvas:"undefined"!=typeof n?n.canvas:null).Image;return r._pending+=1,s(this.params(e),function(e,n){return r._pending-=1,e?(t&&t(e,null),null):(i.src=n,i.loaded=!0,void(t&&t(null,i)))}),i}var s=e("datalib/src/import/load");r.Config=null;var o=r.prototype;o.pending=function(){return this._pending},o.params=function(e){var t,n={url:e};for(t in this._config)n[t]=this._config[t];return n},o.imageURL=function(e){return s.sanitizeUrl(this.params(e))},o.loadImage=function(e,t){return s.useXHR?i.call(this,e,t):a.call(this,e,t)},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"datalib/src/import/load":20}],78:[function(e,t,n){function r(e){this.mark=e}var i=r.prototype;i.hasPropertySet=function(e){var t=this.mark.def.properties;return t&&null!=t[e]},i.cousin=function(e,t){if(0===e)return this;e=e||-1;var n=this.mark,r=n.group,i=null==t?n.items.indexOf(this):t,a=r.items.indexOf(n)+e;return r.items[a].items[i]},i.sibling=function(e){if(0===e)return this;e=e||-1;var t=this.mark,n=t.items.indexOf(this)+e;return t.items[n]},i.remove=function(){var e=this,t=e.mark.items,n=t.indexOf(e);return n>=0&&(n===t.length-1?t.pop():t.splice(n,1)),e},i.touch=function(){this.pathCache&&(this.pathCache=null)},t.exports=r},{}],79:[function(e,t,n){function r(){return D||(D=b.instance(1,1).getContext("2d"))}function i(e,t){return e.stroke&&0!==e.opacity&&0!==e.stokeOpacity&&t.expand(null!=e.strokeWidth?e.strokeWidth:1),t}function a(e,t,n,r,a){return null==t?n.set(0,0,0,0):(M(P.bounds(n),t,r,a),i(e,n)),n}function s(e,t){var n=e.path?e.pathCache||(e.pathCache=S(e.path)):null;return a(e,n,t,e.x,e.y)}function o(e,t){if(0===e.items.length)return t;var n=e.items,r=n[0],i=r.pathCache||(r.pathCache=S(T(n)));return a(r,i,t)}function u(e,t){if(0===e.items.length)return t;var n=e.items,r=n[0],i=r.pathCache||(r.pathCache=S(A(n)));return a(r,i,t)}function l(e,t){var n,r;return i(e,t.set(n=e.x||0,r=e.y||0,n+e.width||0,r+e.height||0))}function c(e,t){var n=e.x||0,r=e.y||0,i=e.width||0,a=e.height||0;return n-="center"===e.align?i/2:"right"===e.align?i:0,r-="middle"===e.baseline?a/2:"bottom"===e.baseline?a:0,t.set(n,r,n+i,r+a)}function d(e,t){var n,r;return i(e,t.set(n=e.x||0,r=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:r))}function f(e,t){var n,r,a,s,o,u,l,c,d,f=e.x||0,h=e.y||0,p=e.innerRadius||0,g=e.outerRadius||0,m=(e.startAngle||0)-E,v=(e.endAngle||0)-E,y=1/0,_=-(1/0),b=1/0,x=-(1/0),w=[m,v],k=m-m%E;for(r=0;4>r&&v>k;++r,k+=E)w.push(k);for(r=0,a=w.length;a>r;++r)n=w[r],s=Math.cos(n),u=p*s,c=g*s,o=Math.sin(n),l=p*o,d=g*o,y=Math.min(y,u,c),_=Math.max(_,u,c),b=Math.min(b,l,d),x=Math.max(x,l,d);return i(e,t.set(f+y,h+b,f+_,h+x))}function h(e,t){var n,r,a,s,o=null!=e.size?e.size:100,u=e.x||0,l=e.y||0;switch(e.shape){case"cross":r=3*Math.sqrt(o/5)/2,t.set(u-r,l-r,u+r,l+r);break;case"diamond":s=Math.sqrt(o/(2*C)),a=s*C,t.set(u-a,l-s,u+a,l+s);break;case"square":r=Math.sqrt(o),n=r/2,t.set(u-n,l-n,u+n,l+n);break;case"triangle-down":a=Math.sqrt(o/L),s=a*L/2,t.set(u-a,l-s,u+a,l+s);break;case"triangle-up":a=Math.sqrt(o/L),s=a*L/2,t.set(u-a,l-s,u+a,l+s);break;default:n=Math.sqrt(o/Math.PI),t.set(u-n,l-n,u+n,l+n)}return i(e,t)}function p(e,t,n){var i,a,s=r(),o=w.size(e),u=e.align,l=e.radius||0,c=e.x||0,d=e.y||0,f=e.dx||0,h=(e.dy||0)+w.offset(e)-Math.round(.8*o);return l&&(a=(e.theta||0)-Math.PI/2,c+=l*Math.cos(a),d+=l*Math.sin(a)),s.font=w.font(e),i=s.measureText(w.value(e.text)).width,"center"===u?f-=i/2:"right"===u&&(f-=i),t.set(f+=c,h+=d,f+i,h+o),e.angle&&!n&&t.rotate(e.angle*Math.PI/180,c,d),t.expand(n?0:1)}function g(e,t,n){var r,a,s=e.axisItems||[],o=e.items||[],u=e.legendItems||[];for(r=0,a=s.length;a>r;++r)t.union(s[r].bounds);for(r=0,a=o.length;a>r;++r)t.union(o[r].bounds);if(n)for(r=0,a=u.length;a>r;++r)t.union(u[r].bounds);return(e.width||e.height)&&i(e,t.add(0,0).add(e.width||0,e.height||0)),t.translate(e.x||0,e.y||0)}function m(e,t,n){var r=e.mark.marktype;t=t||N[r],t.nest&&(e=e.mark);var i=e.bounds,a=e["bounds:prev"]||(e["bounds:prev"]=new _);return i?(a.clear().union(i),i.clear()):e.bounds=new _,t(e,e.bounds,n),i||a.clear().union(e.bounds),e.bounds}function v(e,t,n){var r,i,a,s,o=e.marktype,u=N[o],l=e.items,c=l&&l.length;if(u.nest)return a=c?l[0]:(I.mark=e,I),s=m(a,u,n),t=t&&t.union(s)||s;if(t=t||e.bounds&&e.bounds.clear()||new _,c)for(r=0,i=l.length;i>r;++r)t.union(m(l[r],u,n));return e.bounds=t}var y=e("./BoundsContext"),_=e("./Bounds"),b=e("./canvas"),x=e("./svg"),w=e("./text"),k=e("../path"),S=k.parse,M=k.render,T=x.path.area,A=x.path.line,E=Math.PI/2,L=Math.sqrt(3),C=Math.tan(30*Math.PI/180),D=null,P=y(),N={group:g,symbol:h,image:c,rect:l,rule:d,arc:f,text:p,path:s,area:o,line:u};N.area.nest=!0,N.line.nest=!0;var I={mark:null};t.exports={mark:v,item:m,text:p,group:g}},{"../path":48,"./Bounds":74,"./BoundsContext":75,"./canvas":80,"./svg":83,"./text":84}],80:[function(e,t,n){(function(e){function n(t,n){t=t||1,n=n||1;var r;if("undefined"!=typeof document&&document.createElement)r=document.createElement("canvas"),r.width=t,r.height=n;else{var i="undefined"!=typeof window?window.canvas:"undefined"!=typeof e?e.canvas:null;if(!i.prototype)return null;r=new i(t,n)}return a(r)}function r(e,t,n,r,a){var s=this._ctx=e.getContext("2d"),o=1;return e.width=t+r.left+r.right,e.height=n+r.top+r.bottom,a&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&(s.pixelratio=o=i(e)||1),s.setTransform(o,0,0,o,o*r.left,o*r.top),e}function i(e){var t=e.getContext("2d"),n=window&&window.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,i=n/r;if(n!==r){var a=e.width,s=e.height;e.width=a*i,e.height=s*i,e.style.width=a+"px",e.style.height=s+"px"}return i}function a(e){var t=e.getContext("2d");if(!t.vgLineDash){var n=function(){},r=[];return t.setLineDash?(t.vgLineDash=function(e){this.setLineDash(e||r)},t.vgLineDashOffset=function(e){this.lineDashOffset=e}):void 0!==t.webkitLineDash?(t.vgLineDash=function(e){this.webkitLineDash=e||r},t.vgLineDashOffset=function(e){this.webkitLineDashOffset=e}):void 0!==t.mozDash?(t.vgLineDash=function(e){this.mozDash=e},t.vgLineDashOffset=n):(t.vgLineDash=n,t.vgLineDashOffset=n),e}}t.exports={instance:n,resize:r,lineDash:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],81:[function(e,t,n){function r(e,t,n){return n?e.createElementNS(n,t):e.createElement(t)}function i(e){if(e){var t=e.parentNode;t&&(t.removeChild(e),t.childNodes&&t.childNodes.length||i(t))}}t.exports={find:function(e,t){t=t.toLowerCase();for(var n=0,r=e.childNodes.length;r>n;++n)if(e.childNodes[n].tagName.toLowerCase()===t)return e.childNodes[n]},child:function(e,t,n,i,a,s){var o,u;return o=u=e.childNodes[t],(!o||s||o.tagName.toLowerCase()!==n.toLowerCase()||a&&o.getAttribute("class")!=a)&&(o=r(e.ownerDocument,n,i),e.insertBefore(o,u),a&&o.setAttribute("class",a)),o},clear:function(e,t){for(var n=e.childNodes.length;n>t;)e.removeChild(e.childNodes[--n]);return e},remove:i,cssClass:function(e){return"mark-"+e.marktype+(e.name?" "+e.name:"")},openTag:function(e,t,n){var r,i,a="<"+e;if(t)for(r in t)i=t[r],null!=i&&(a+=" "+r+'="'+i+'"');return n&&(a+=" "+n),a+">"},closeTag:function(e){return""}}},{}],82:[function(e,t,n){function r(e,t){return JSON.stringify(e,u,t)}function i(e){var t="string"==typeof e?JSON.parse(e):e;return a(t)}function a(e){var t,n,r,i,u,l=e.marktype;for(r=0,i=o.length;i>r;++r)if(u=e[o[r]])for(t=0,n=u.length;n>t;++t)u[t][l?"mark":"group"]=e,l&&"group"!==l||a(u[t]);return l&&s.mark(e),e}var s=e("../util/bound"),o=["items","axisItems","legendItems"],u=["marktype","name","interactive","clip","items","axisItems","legendItems","layer","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","interpolate","tension","orient","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];t.exports={toJSON:r,fromJSON:i}},{"../util/bound":79}],83:[function(e,t,n){(function(e){function n(e){return e.x||0}function r(e){return e.y||0}function i(e){return(e.x||0)+(e.width||0)}function a(e){return(e.y||0)+(e.height||0)}function s(e){return null==e.size?100:e.size}function o(e){return e.shape||"circle"}var u=("undefined"!=typeof window?window.d3:"undefined"!=typeof e?e.d3:null).svg,l=u.area().x(n).y1(r).y0(a),c=u.area().y(r).x1(n).x0(i),d=u.line().x(n).y(r);t.exports={metadata:{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},path:{arc:u.arc(),symbol:u.symbol().type(o).size(s),area:function(e){var t=e[0];return("horizontal"===t.orient?c:l).interpolate(t.interpolate||"linear").tension(t.tension||.7)(e)},line:function(e){var t=e[0];return d.interpolate(t.interpolate||"linear").tension(t.tension||.7)(e)}},textAlign:{left:"start",center:"middle",right:"end"},textBaseline:{top:"before-edge",bottom:"after-edge",middle:"central"},styles:{fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeWidth:"stroke-width",strokeOpacity:"stroke-opacity",strokeCap:"stroke-linecap",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",opacity:"opacity"},styleProperties:["fill","fillOpacity","stroke","strokeWidth","strokeOpacity","strokeCap","strokeDash","strokeDashOffset","opacity"]}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],84:[function(e,t,n){function r(e){return null!=e.fontSize?e.fontSize:11}t.exports={size:r,value:function(e){return null!=e?String(e):""},font:function(e,t){var n=e.font;return t&&n&&(n=String(n).replace(/\"/g,"'")),""+(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+r(e)+"px "+(n||"sans-serif")},offset:function(e){var t=e.baseline,n=r(e);return Math.round("top"===t?.93*n:"middle"===t?.3*n:"bottom"===t?-.21*n:0)}}},{}],85:[function(e,t,n){function r(e,t,n){o.call(null,e,t,n),this._type="canvas",this._renderers={canvas:a,svg:s}}var i=e("vega-scenegraph").render,a=i.canvas,s=i.svg.string,o=e("./View"),u=r.prototype=new o;u.renderer=function(e){return e&&(this._type=e),o.prototype.renderer.apply(this,arguments)},u.canvas=function(){return"canvas"===this._type?this._renderer.canvas():null},u.canvasAsync=function(e){function t(){0===n.pendingImages()?(r.render(),e(r.canvas())):setTimeout(t,10)}var n=this._renderer,r=this;return"canvas"!==this._type?null:void(n.pendingImages()>0?t():e(this.canvas()))},u.svg=function(){return"svg"===this._type?this._renderer.svg():null},u.initialize=function(){var e=this._width,t=this._height,n=this._bgcolor,r=this._padding,i=this.model().config();return this._viewport&&(e=this._viewport[0]-(r?r.left+r.right:0),t=this._viewport[1]-(r?r.top+r.bottom:0)),this._renderer=(this._renderer||new this._io.Renderer(i.load)).initialize(null,e,t,r).background(n),this},t.exports=r},{"./View":87,"vega-scenegraph":46}],86:[function(e,t,n){function r(e){this._defs={},this._predicates={},this._scene=null,this._node=null,this._builder=null,this._reset={axes:!1,legends:!1},this.config(e),u.init.call(this)}function i(e){var t=this,n={};return a.isArray(e)?(e.forEach(function(e){n[e]=t._predicates[e]}),n):this._predicates[e]}var a=e("datalib"),s=e("vega-dataflow"),o=s.ChangeSet,u=s.Graph.prototype,l=s.Node,c=e("../scene/GroupBuilder"),d=e("../scene/visit"),f=e("./config"),h=r.prototype=Object.create(u);h.constructor=r,h.defs=function(e){return arguments.length?(this._defs=e,this):this._defs},h.config=function(e){if(!arguments.length)return this._config;this._config=Object.create(f);for(var t in e){var n=e[t],r=this._config[t];a.isObject(n)&&a.isObject(r)?a.extend(r,n):this._config[t]=n}return this},h.width=function(e){return this._defs&&(this._defs.width=e),this._defs&&this._defs.marks&&(this._defs.marks.width=e),this._scene&&(this._scene.items[0].width=e,this._scene.items[0]._dirty=!0),this._reset.axes=!0,this},h.height=function(e){return this._defs&&(this._defs.height=e),this._defs&&this._defs.marks&&(this._defs.marks.height=e),this._scene&&(this._scene.items[0].height=e,this._scene.items[0]._dirty=!0),this._reset.axes=!0,this},h.node=function(){return this._node||(this._node=new l(this))},h.data=function(){var e=u.data.apply(this,arguments);return arguments.length>1&&this.node().addListener(e.pipeline()[0]),e},h.predicate=function(e,t){return 1===arguments.length?i.call(this,e):this._predicates[e]=t},h.predicates=function(){return this._predicates},h.scene=function(e){if(!arguments.length)return this._scene;this._builder&&this.node().removeListener(this._builder.disconnect()),this._builder=new c(this,this._defs.marks,this._scene={}),this.node().addListener(this._builder.connect());var t=this._builder.pipeline();return t[t.length-1].addListener(e),this},h.reset=function(){return this._scene&&this._reset.axes&&(d(this._scene,function(e){e.axes&&e.axes.forEach(function(e){e.reset()})}),this._reset.axes=!1),this._scene&&this._reset.legends&&(d(this._scene,function(e){e.legends&&e.legends.forEach(function(e){e.reset()})}),this._reset.legends=!1),this},h.addListener=function(e){this.node().addListener(e)},h.removeListener=function(e){this.node().removeListener(e)},h.fire=function(e){e||(e=o.create()),this.propagate(e,this.node())},t.exports=r},{"../scene/GroupBuilder":110,"../scene/visit":115,"./config":88,datalib:24,"vega-dataflow":39}],87:[function(e,t,n){(function(n){function r(e,t,n){this._el=null,this._model=null,this._width=this.__width=t||500,this._height=this.__height=n||300,this._bgcolor=null,this._autopad=1,this._padding={top:0,left:0,bottom:0,right:0},this._viewport=null,this._renderer=null,this._handler=null,this._streamer=null,this._changeset=null,this._repaint=!0,this._renderers=l,this._io=null,this._api={}}function i(e){var t=this,n=this._model.data(e),r=n.name(),i=n.pipeline()[0],a=this._streamer,s={};return this._api[e]?this._api[e]:(s.insert=function(e){return n.insert(o.duplicate(e)),a.addListener(i),t._changeset.data[r]=1,s},s.update=function(){return a.addListener(i),t._changeset.data[r]=1,n.update.apply(n,arguments),s},s.remove=function(){return a.addListener(i),t._changeset.data[r]=1,n.remove.apply(n,arguments),s},s.values=function(){return n.values()},this._api[e]=s)}function a(){var e=this;return e._renderNode=new u.Node(e._model).router(!0),e._renderNode.evaluate=function(t){c.debug(t,["rendering"]);var n=e._model.scene(),r=e._handler;r&&r.scene&&r.scene(n),t.trans?t.trans.start(function(t){e._renderer.render(n,t)}):e._repaint?(e._renderer.render(n),e._repaint=!1):t.dirty.length&&e._renderer.render(n,t.dirty),t.dirty.length&&(t.dirty.forEach(function(e){e._dirty=!1}),n.items[0]._dirty=!1);for(var i in t.data)e._model.data(i).synchronize();return t},e._model.scene(e._renderNode),!0}var s="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,o=e("datalib"),u=e("vega-dataflow"),l=e("vega-scenegraph").render,c=e("vega-logging"),d=u.Dependencies,f=e("../parse/streams"),h=e("../scene/Encoder"),p=e("../scene/Transition"),g=r.prototype;g.model=function(e){return arguments.length?(this._model!==e&&(this._model=e,this._streamer=new u.Node(e), -this._streamer._rank=-1,this._changeset=u.ChangeSet.create(),this._handler&&this._handler.model(e)),this):this._model},g.data=function(e){var t=this;return arguments.length?o.isString(e)?i.call(t,e):(o.isObject(e)&&o.keys(e).forEach(function(n){var r=i.call(t,n);e[n](r)}),this):t._model.values()},g.signal=function(e,t){var n=this._model,r=this._changeset,i=this._streamer,a=e;return arguments.length?1==arguments.length&&o.isString(e)?n.values(d.SIGNALS,e):(2==arguments.length&&(a={},a[e]=t),o.keys(a).forEach(function(e){i.addListener(n.signal(e).value(a[e])),r.signals[e]=1,r.reflow=!0}),this):n.values(d.SIGNALS)},g.width=function(e){return arguments.length?(this.__width!==e&&(this._width=this.__width=e,this.model().width(e),this.initialize(),this._strict&&(this._autopad=1)),this):this.__width},g.height=function(e){return arguments.length?(this.__height!==e&&(this._height=this.__height=e,this.model().height(e),this.initialize(),this._strict&&(this._autopad=1)),this):this.__height},g.background=function(e){return arguments.length?(this._bgcolor!==e&&(this._bgcolor=e,this.initialize()),this):this._bgcolor},g.padding=function(e){return arguments.length?(this._padding!==e&&(o.isString(e)?(this._autopad=1,this._padding={top:0,left:0,bottom:0,right:0},this._strict="strict"===e):(this._autopad=0,this._padding=e,this._strict=!1),this._renderer&&this._renderer.resize(this._width,this._height,e),this._handler&&this._handler.padding(e)),this._repaint=!0,this):this._padding},g.autopad=function(e){if(this._autopad<1)return this;this._autopad=0;var t=this.model().scene().bounds,n=this._padding,r=this.model().config(),i=r.autopadInset,a=t.x1<0?Math.ceil(-t.x1)+i:0,s=t.y1<0?Math.ceil(-t.y1)+i:0,o=t.x2>this._width?Math.ceil(+t.x2-this._width)+i:0;return t=t.y2>this._height?Math.ceil(+t.y2-this._height)+i:0,n={left:a,top:s,right:o,bottom:t},this._strict?(this._autopad=0,this._padding=n,this._width=Math.max(0,this.__width-(a+o)),this._height=Math.max(0,this.__height-(s+t)),this._model.width(this._width).height(this._height).reset(),this.initialize().update({props:"enter"}).update({props:"update"})):this.padding(n).update(e),this},g.viewport=function(e){return arguments.length?(this._viewport!==e&&(this._viewport=e,this.initialize()),this):this._viewport},g.renderer=function(e){if(!arguments.length)return this._renderer;if(this._renderers[e])e=this._renderers[e];else{if(o.isString(e))throw new Error("Unknown renderer: "+e);if(!e)throw new Error("No renderer specified")}return this._io!==e&&(this._io=e,this._renderer=null,this.initialize(),this._build&&this.render()),this},g.initialize=function(e){var t,n=this,r=n._width,i=n._height,a=n._padding,o=n._bgcolor,u=this.model().config();return arguments.length&&null!==e||(e=this._el?this._el.parentNode:null)?(s.select(e).select("div.vega").remove(),this._el=e=s.select(e).append("div").attr("class","vega").style("position","relative").node(),n._viewport&&s.select(e).style("width",(n._viewport[0]||r)+"px").style("height",(n._viewport[1]||i)+"px").style("overflow","auto"),l.canvas.Renderer.RETINA=u.render.retina,n._renderer=(n._renderer||new this._io.Renderer(u.load)).initialize(e,r,i,a).background(o),t=n._handler,n._handler=(new this._io.Handler).initialize(e,a,n),t?t.handlers().forEach(function(e){n._handler.on(e.type,e.handler)}):n._detach=f(this),this._repaint=!0,this):this},g.destroy=function(){this._detach&&this._detach()},g.update=function(e){e=e||{};var t=this,n=e.duration?new p(e.duration,e.ease):null,r=t._changeset;if(n&&(r.trans=n),void 0!==e.props){if(o.keys(r.data).length>0)throw Error("New data values are not reflected in the visualization. Please call view.update() before updating a specified property set.");r.reflow=!0,r.request=e.props}var i=t._build;return t._build=t._build||a.call(this),e.items&&i?(h.update(this._model,e.trans,e.props,e.items,r.dirty),t._renderNode.evaluate(r)):t._streamer.listeners().length&&i?(t._model.propagate(r,t._streamer),t._streamer.disconnect()):t._model.fire(r),t._changeset=u.ChangeSet.create(),t.autopad(e)},g.toImageURL=function(e){var t,n=this;switch(e||"png"){case"canvas":case"png":t=l.canvas.Renderer;break;case"svg":t=l.svg.string.Renderer;break;default:throw Error("Unrecognized renderer type: "+e)}var r=l.canvas.Renderer.RETINA;l.canvas.Renderer.RETINA=!1;var i=new t(n._model.config.load).initialize(null,n._width,n._height,n._padding).render(n._model.scene());if(l.canvas.Renderer.RETINA=r,"svg"===e){var a=new Blob([i.svg()],{type:"image/svg+xml"});return window.URL.createObjectURL(a)}return i.canvas().toDataURL("image/png")},g.render=function(e){return this._renderer.render(this._model.scene(),e),this},g.on=function(){return this._handler.on.apply(this._handler,arguments),this},g.onSignal=function(e,t){return this._model.signal(e).on(t),this},g.off=function(){return this._handler.off.apply(this._handler,arguments),this},g.offSignal=function(e,t){return this._model.signal(e).off(t),this},r.factory=function(t){var n=e("./HeadlessView");return function(e){e=e||{};var i=t.defs(),a=(e.el?new r:new n).model(t).renderer(e.renderer||"canvas").width(i.width).height(i.height).background(i.background).padding(i.padding).viewport(i.viewport).initialize(e.el);return e.data&&a.data(e.data),e.hover!==!1&&e.el&&a.on("mouseover",function(e,t){t&&t.hasPropertySet("hover")&&this.update({props:"hover",items:t})}).on("mouseout",function(e,t){t&&t.hasPropertySet("hover")&&this.update({props:"update",items:t})}),a}},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../parse/streams":105,"../scene/Encoder":109,"../scene/Transition":112,"./HeadlessView":85,datalib:24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],88:[function(e,t,n){(function(e){var n="undefined"!=typeof window?window.d3:"undefined"!=typeof e?e.d3:null,r={};r.load={baseURL:"",domainWhiteList:!1},r.autopadInset=5,r.scale={time:n.time.scale,utc:n.time.scale.utc},r.render={retina:!0},r.axis={orient:"bottom",ticks:10,padding:3,axisColor:"#000",gridColor:"#000",gridOpacity:.15,tickColor:"#000",tickLabelColor:"#000",axisWidth:1,tickWidth:1,tickSize:6,tickLabelFontSize:11,tickLabelFont:"sans-serif",titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold",titleOffset:35},r.legend={orient:"right",offset:20,padding:3,gradientStrokeColor:"#888",gradientStrokeWidth:1,gradientHeight:16,gradientWidth:100,labelColor:"#000",labelFontSize:10,labelFont:"sans-serif",labelAlign:"left",labelBaseline:"middle",labelOffset:8,symbolShape:"circle",symbolSize:50,symbolColor:"#888",symbolStrokeWidth:1,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold"},r.color={rgb:[128,128,128],lab:[50,0,0],hcl:[0,0,50],hsl:[0,0,.5]},r.range={category10:n.scale.category10().range(),category20:n.scale.category20().range(),category20b:n.scale.category20b().range(),category20c:n.scale.category20c().range(),shapes:["circle","cross","diamond","square","triangle-down","triangle-up"]},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],89:[function(e,t,n){function r(e,t,n){var r=e.schema;r&&(r.refs&&i.extend(n.refs,r.refs),r.defs&&i.extend(n.defs,r.defs))}var i=e("datalib"),a=e("../parse"),s=e("../scene/Scale"),o=e("./config");t.exports=function(e){var t=null;return e=e||{},e.url?t=i.json(i.extend({url:e.url},o.load)):(t={$schema:"http://json-schema.org/draft-04/schema#",title:"Vega Visualization Specification Language",defs:{},refs:{},$ref:"#/defs/spec"},i.keys(a).forEach(function(n){r(a[n],e,t)}),r(s,e,t)),e.properties&&i.keys(e.properties).forEach(function(n){t.defs.propset.properties[n]={$ref:"#/refs/"+e.properties[n]+"Value"}}),e.propertySets&&i.keys(e.propertySets).forEach(function(e){t.defs.mark.properties.properties.properties[e]={$ref:"#/defs/propset"}}),t}},{"../parse":95,"../scene/Scale":111,"./config":88,datalib:24}],90:[function(e,t,n){function r(e,t,n,r){var a=e.config();(t||[]).forEach(function(t,o){n[o]=n[o]||s(e),i(a,t,o,n[o],r)})}function i(e,t,n,r,i){void 0!==t.scale&&r.scale(i.scale(t.scale)),r.orient(t.orient||o[t.type]),r.offset(t.offset||0),r.layer(t.layer||"front"),r.grid(t.grid||!1),r.title(t.title||null),r.titleOffset(null!=t.titleOffset?t.titleOffset:e.axis.titleOffset),r.tickValues(t.values||null),r.tickFormat(t.format||null),r.tickFormatType(t.formatType||null),r.tickSubdivide(t.subdivide||0),r.tickPadding(t.tickPadding||e.axis.padding);var s=[];if(void 0!==t.tickSize)for(var u=0;3>u;++u)s.push(t.tickSize);else{var l=e.axis.tickSize;s=[l,l,l]}null!=t.tickSizeMajor&&(s[0]=t.tickSizeMajor),null!=t.tickSizeMinor&&(s[1]=t.tickSizeMinor),null!=t.tickSizeEnd&&(s[2]=t.tickSizeEnd),s.length&&r.tickSize.apply(r,s),r.tickCount(t.ticks||e.axis.ticks);var c=t.properties;c&&c.ticks?(r.majorTickProperties(c.majorTicks?a.extend({},c.ticks,c.majorTicks):c.ticks),r.minorTickProperties(c.minorTicks?a.extend({},c.ticks,c.minorTicks):c.ticks)):(r.majorTickProperties(c&&c.majorTicks||{}),r.minorTickProperties(c&&c.minorTicks||{})),r.tickLabelProperties(c&&c.labels||{}),r.titleProperties(c&&c.title||{}),r.gridLineProperties(c&&c.grid||{}),r.domainProperties(c&&c.axis||{})}var a=e("datalib"),s=e("../scene/axis"),o={x:"bottom",y:"left",top:"top",bottom:"bottom",left:"left",right:"right"};t.exports=r},{"../scene/axis":113,datalib:24}],91:[function(e,t,n){(function(e){function n(e){return null==e?null:r.rgb(e)+""}var r="undefined"!=typeof window?window.d3:"undefined"!=typeof e?e.d3:null;t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],92:[function(e,t,n){function r(e,t,n){function s(t){return function(r,s){r?a.error("LOADING FAILED: "+t.url+" "+r):e.data(t.name).values(i.read(s,t.format)),0===--u&&n()}}var o=e.config(),u=0;return(t||[]).forEach(function(t){t.url&&(u+=1,i.load(i.extend({url:t.url},o.load),s(t))),r.datasource(e,t)}),0===u&&setTimeout(n,1),t}var i=e("datalib"),a=e("vega-logging"),s=e("./transforms"),o=e("./modify");r.datasource=function(e,t){var n=(t.transform||[]).map(function(t){return s(e,t)}),r=(t.modify||[]).map(function(n){return o(e,n,t)}),a=e.data(t.name,r.concat(n));return t.values?a.values(i.read(t.values,t.format)):t.source&&(a.source(t.source).addListener(a),e.removeListener(a.pipeline()[0])),a},t.exports=r},{"./modify":99,"./transforms":106,datalib:24,"vega-logging":45}],93:[function(e,t,n){t.exports=function(){function e(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}function t(e,t,n,r,i,a){this.message=e,this.expected=t,this.found=n,this.offset=r,this.line=i,this.column=a,this.name="SyntaxError"}function n(e){function n(t){function n(t,n,r){var i,a;for(i=n;r>i;i++)a=e.charAt(i),"\n"===a?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}return ut!==t&&(ut>t&&(ut=0,lt={line:1,column:1,seenCR:!1}),n(lt,ut,t),ut=t),lt}function r(e){ct>st||(st>ct&&(ct=st,dt=[]),dt.push(e))}function i(r,i,a){function s(e){var t=1;for(e.sort(function(e,t){return e.descriptiont.description?1:0});t1?s.slice(0,-1).join(", ")+" or "+s[e.length-1]:s[0],i=t?'"'+n(t)+'"':"end of input","Expected "+r+" but "+i+" found."}var u=n(a),l=a1?arguments[1]:{},_={},b={start:a},x=a,w=_,k=",",S={type:"literal",value:",",description:'","'},M=function(e,t){return[e].concat(t)},T=function(e){return[e]},A="[",E={type:"literal",value:"[",description:'"["'},L="]",C={type:"literal",value:"]",description:'"]"'},D=">",P={type:"literal",value:">",description:'">"'},N=function(e,t,n){return{start:e,end:t,middle:n}},I=function(e,t){return e.filters=t,e},O=function(e){return e},j="(",U={type:"literal",value:"(",description:'"("'},z=")",F={type:"literal",value:")",description:'")"'},R=function(e){return{stream:e}},q="@",G={type:"literal",value:"@",description:'"@"'},B=":",$={type:"literal",value:":",description:'":"'},Y=function(e,t){return{event:t,name:e}},H=function(e,t){return{event:t,mark:e}},V=function(e,t){return{event:t,target:e}},W=function(e){return{event:e}},X=function(e){return{signal:e}},J="rect",K={type:"literal",value:"rect",description:'"rect"'},Z="symbol",Q={type:"literal",value:"symbol",description:'"symbol"'},ee="path",te={type:"literal",value:"path",description:'"path"'},ne="arc",re={type:"literal",value:"arc",description:'"arc"'},ie="area",ae={type:"literal",value:"area",description:'"area"'},se="line",oe={type:"literal",value:"line",description:'"line"'},ue="rule",le={type:"literal",value:"rule",description:'"rule"'},ce="image",de={type:"literal",value:"image",description:'"image"'},fe="text",he={type:"literal",value:"text",description:'"text"'},pe="group",ge={type:"literal",value:"group",description:'"group"'},me="mousedown",ve={type:"literal",value:"mousedown",description:'"mousedown"'},ye="mouseup",_e={type:"literal",value:"mouseup",description:'"mouseup"'},be="click",xe={type:"literal",value:"click",description:'"click"'},we="dblclick",ke={type:"literal",value:"dblclick",description:'"dblclick"'},Se="wheel",Me={type:"literal",value:"wheel",description:'"wheel"'},Te="keydown",Ae={type:"literal",value:"keydown",description:'"keydown"'},Ee="keypress",Le={type:"literal",value:"keypress",description:'"keypress"'},Ce="keyup",De={type:"literal",value:"keyup",description:'"keyup"'},Pe="mousewheel",Ne={type:"literal",value:"mousewheel",description:'"mousewheel"'},Ie="mousemove",Oe={type:"literal",value:"mousemove",description:'"mousemove"'},je="mouseout",Ue={type:"literal",value:"mouseout",description:'"mouseout"'},ze="mouseover",Fe={type:"literal",value:"mouseover",description:'"mouseover"'},Re="mouseenter",qe={type:"literal",value:"mouseenter",description:'"mouseenter"'},Ge="touchstart",Be={type:"literal",value:"touchstart",description:'"touchstart"'},$e="touchmove",Ye={type:"literal",value:"touchmove",description:'"touchmove"'},He="touchend",Ve={type:"literal",value:"touchend",description:'"touchend"'},We=function(e){return e},Xe=/^[a-zA-Z0-9_\-]/,Je={type:"class",value:"[a-zA-Z0-9_\\-]",description:"[a-zA-Z0-9_\\-]"},Ke=function(e){return e.join("")},Ze=/^[a-zA-Z0-9\-_ #.>+~[\]=|\^$*]/,Qe={type:"class",value:"[a-zA-Z0-9\\-_ #.>+~[\\]=|\\^$*]",description:"[a-zA-Z0-9\\-_ #.>+~[\\]=|\\^$*]"},et=function(e){return e.join("")},tt=/^['"a-zA-Z0-9_().><=! \t-&|~]/,nt={type:"class",value:"['\"a-zA-Z0-9_().><=! \\t-&|~]",description:"['\"a-zA-Z0-9_().><=! \\t-&|~]"},rt=function(e){return e.join("")},it=/^[ \t\r\n]/,at={type:"class",value:"[ \\t\\r\\n]",description:"[ \\t\\r\\n]"},st=0,ot=0,ut=0,lt={line:1,column:1,seenCR:!1},ct=0,dt=[],ft=0;if("startRule"in y){if(!(y.startRule in b))throw new Error("Can't start parsing from rule \""+y.startRule+'".');x=b[y.startRule]}if(v=x(),v!==_&&st===e.length)return v;throw v!==_&&st=0;--i)n[i][e]==t&&r.push.apply(r,n.splice(i,1))};t.exports=r},{datalib:24,"vega-dataflow":39,"vega-logging":45}],100:[function(e,t,n){function r(e){if(null==e)return"auto";if(i.isString(e))return"strict"===e?"strict":"auto";if(i.isObject(e))return e;var t=i.isNumber(e)?e:20;return{top:t,left:t,right:t,bottom:t}}var i=e("datalib");t.exports=r},{datalib:24}],101:[function(e,t,n){function r(e,t){return(t||[]).forEach(function(t){var n=d[t.type](e,t),r=Function("args","db","signals","predicates",n.code);r.root=function(){return e.scene().items[0]},r.nullScale=f,r.isFunction=c.isFunction,r.signals=n.signals,r.data=n.data,e.predicate(t.name,r)}),t}function i(e,t){var n=c.field(e),r="signals["+n.map(c.str).join("][")+"]";return t[n[0]]=1,r}function a(e,t){function n(e){o[e]=1}function r(e){u[e]=1}var a=[],s=[],o={},u={};return c.array(t).forEach(function(t,u){var l="o"+u,d="";if(void 0!==t.value)d=c.str(t.value);else if(t.arg)d="args["+c.str(t.arg)+"]";else if(t.signal)d=i(t.signal,o);else if(t.predicate){var f=t.predicate,h=f&&(f.name||f),p=e.predicate(h),g="predicates["+c.str(h)+"]";p.signals.forEach(n),p.data.forEach(r),c.isObject(f)&&c.keys(f).forEach(function(e){if("name"!==e){var t=f[e];d+="args["+c.str(e)+"] = ",t.signal?d+=i(t.signal,o):t.arg&&(d+="args["+c.str(t.arg)+"]"),d+=", "}}),d+=g+".call("+g+", args, db, signals, predicates)"}a.push(l),s.push(l+"=("+d+")")}),{code:"var "+a.join(", ")+";\n"+s.join(";\n")+";\n",signals:c.keys(o),data:c.keys(u)}}function s(e,t){var n=a(e,t.operands);return"="===t.type&&(t.type="=="),n.code+="o0 = o0 instanceof Date ? o0.getTime() : o0;\no1 = o1 instanceof Date ? o1.getTime() : o1;\n",{code:n.code+"return "+["o0","o1"].join(t.type)+";",signals:n.signals,data:n.data}}function o(e,t){for(var n=a(e,t.operands),r=[],i=0,s=t.operands.length;r.push("o"+i++) 0;"}else t.range&&(t.scale&&(r+="if (scale.length == 2) {\n ordSet = scale(o1, o2);\n} else {\n o1 = scale(o1);\no2 = scale(o2);\n}"),r+="return ordSet !== null ? ordSet.indexOf(o0) !== -1 :\n o1 < o2 ? o1 <= o0 && o0 <= o2 : o2 <= o0 && o0 <= o1;");return{code:r,signals:i.signals,data:i.data.concat(t.data?[t.data]:[])}}function l(e,t){var n="var scale = ",r=t.length;return c.isString(e)?(t.push({value:e}),n+="this.root().scale(o"+r+")"):e.arg?(t.push(e),n+="o"+r):e.name&&(t.push(c.isString(e.name)?{value:e.name}:e.name),n+="(this.isFunction(o"+r+") ? o"+r+" : ",e.scope?(t.push(e.scope),n+="((o"+(r+1)+".scale || this.root().scale)(o"+r+") || this.nullScale)"):n+="this.root().scale(o"+r+")",n+=")"),e.invert===!0&&(n+=".invert"),n+";\n"}var c=e("datalib"),d={"=":s,"==":s,"!=":s,">":s,">=":s,"<":s,"<=":s,and:o,"&&":o,or:o,"||":o,"in":u},f=function(){return 0};f.invert=f,t.exports=r},{datalib:24}],102:[function(e,t,n){(function(n){function r(e,t,n){function r(e){if(null!=m[e]){var t,n,r=f.array(m[e]);for(t=0,n=r.length;n>t;++t)x[e][r[t]]=1}}function i(e){var t=(e.parent?"parent_":"group_")+e.level;x._nRefs[t]=e}var u,l,c,m,v=e.config(),y="",_=f.keys(n),b={},x={signals:{},scales:{},data:{},fields:{},nested:[],_nRefs:{},reflow:!1};for(y+="var o = trans ? {} : item, d=0, set=this.tpl.set, tmpl=signals||{}, t;\ntmpl.datum = item.datum;\ntmpl.group = group;\ntmpl.parent = group.datum;\n",u=0,l=_.length;l>u;++u)m=n[c=_[u]],y+=u>0?"\n ":" ",m.rule?(m=s(e,c,m.rule),y+="\n "+m.code):(m=o(v,c,m),y+="d += set(o, "+f.str(c)+", "+m.val+");"),b[c]=!0,g.forEach(r),x.reflow=x.reflow||m.reflow,m.nested.length&&m.nested.forEach(i);f.keys(x._nRefs).forEach(function(e){x.nested.push(x._nRefs[e])}),x.nested.sort(function(e,t){return e=e.level,t=t.level,t>e?-1:e>t?1:e>=t?0:NaN}),b.x2&&(b.x?(y+="\n if (o.x > o.x2) { \n t = o.x;\n d += set(o, 'x', o.x2);\n d += set(o, 'x2', t); \n };",y+="\n d += set(o, 'width', (o.x2 - o.x));"):y+=b.width?"\n d += set(o, 'x', (o.x2 - o.width));":"\n d += set(o, 'x', o.x2);"),b.xc&&(y+=b.width?"\n d += set(o, 'x', (o.xc - o.width/2));":"\n d += set(o, 'x', o.xc);"),b.y2&&(b.y?(y+="\n if (o.y > o.y2) { \n t = o.y;\n d += set(o, 'y', o.y2);\n d += set(o, 'y2', t);\n };",y+="\n d += set(o, 'height', (o.y2 - o.y));"):y+=b.height?"\n d += set(o, 'y', (o.y2 - o.height));":"\n d += set(o, 'y', o.y2);"),b.yc&&(y+=b.height?"\n d += set(o, 'y', (o.yc - o.height/2));":"\n d += set(o, 'y', o.yc);"),a(t,b)&&(y+="\n d += (item.touch(), 1);"),y+="\n if (trans) trans.interpolate(item, o);",y+="\n return d > 0;";try{var w=Function("item","group","trans","db","signals","predicates",y);return w.tpl=p,w.util=f,w.d3=d,f.extend(w,f.template.context),{encode:w,signals:f.keys(x.signals),scales:f.keys(x.scales),data:f.keys(x.data),fields:f.keys(x.fields),nested:x.nested,reflow:x.reflow}}catch(k){h.error(k),h.log(y)}}function i(e,t){return f.isObject(e)||(e={reflow:!1,nested:[]},g.forEach(function(t){e[t]=[]})),f.isObject(t)&&(e.reflow=e.reflow||t.reflow,e.nested.push.apply(e.nested,t.nested),g.forEach(function(n){e[n].push.apply(e[n],t[n])})),e}function a(e,t){return t.path||("area"===e||"line"===e)&&(t.x||t.x2||t.width||t.y||t.y2||t.height||t.tension||t.interpolate)}function s(e,t,n){var r=e.config(),a=i(),s=[],u="";return(n||[]).forEach(function(l,c){var d,h=l.predicate,p=h&&(h.name||h),g=e.predicate(p),m="predicates["+f.str(p)+"]",v=[],y=t+"_arg"+c;f.isObject(h)&&f.keys(h).forEach(function(e){if("name"!==e){var t=o(r,c,h[e]);v.push(f.str(e)+": "+t.val),i(a,t)}}),d=o(r,t,l),i(a,d),p?(a.signals.push.apply(a.signals,g.signals),a.data.push.apply(a.data,g.data),s.push(y+" = {\n "+v.join(",\n ")+"\n }"),u+="if ("+m+".call("+m+","+y+", db, signals, predicates)) {\n d += set(o, "+f.str(t)+", "+d.val+");",u+=n[c+1]?"\n } else ":" }"):u+="{\n d += set(o, "+f.str(t)+", "+d.val+");\n }\n"}),u="var "+s.join(",\n ")+";\n "+u,a.code=u,a}function o(e,t,n){if(null==n)return null;if("fill"===t||"stroke"===t){if(n.c)return u(e,"hcl",n.h,n.c,n.l);if(n.h||n.s)return u(e,"hsl",n.h,n.s,n.l);if(n.l||n.a)return u(e,"lab",n.l,n.a,n.b);if(n.r||n.g||n.b)return u(e,"rgb",n.r,n.g,n.b)}var r=null,a=null,s=i(),o=null,d=null,h=null,p={};return void 0!==n.template&&(r=f.template.source(n.template,"tmpl",p),f.keys(p).forEach(function(e){var t=f.field(e),n=t.shift();"parent"===n||"group"===n?s.nested.push({parent:"parent"===n,group:"group"===n,level:1}):"datum"===n?s.fields.push(t[0]):s.signals.push(n)})),void 0!==n.value&&(r=f.str(n.value)),void 0!==n.signal&&(o=f.field(n.signal),r="signals["+o.map(f.str).join("][")+"]",s.signals.push(o.shift())),void 0!==n.field&&(n.field=f.isString(n.field)?{datum:n.field}:n.field,d=l(n.field),r=d.val,i(s,d)),void 0!==n.scale&&(h=c(n.scale),a=h.val,i(s,h),s.scales.push(n.scale.name||n.scale),r=null!==r||n.band||n.mult||n.offset?a+(n.band?".rangeBand()":"("+(null!==r?r:"item.datum.data")+")"):a),r="("+(n.mult?f.number(n.mult)+" * ":"")+r+")"+(n.offset?" + "+f.number(n.offset):""),s.val=r,s}function u(e,t,n,r,a){var s=n?o(e,"",n):e.color[t][0],u=r?o(e,"",r):e.color[t][1],l=a?o(e,"",a):e.color[t][2],c=i();[s,u,l].forEach(function(e){f.isArray||i(c,e)});var d="(this.d3."+t+"("+[s.val,u.val,l.val].join(",")+') + "")';return c.val=d,c}function l(e){if(f.isString(e))return{val:f.field(e).map(f.str).join("][")};var t=e.level||1,n=(e.group||e.parent)&&t,r=n?Array(t).join("group.mark."):"",a=l(e.datum||e.group||e.parent||e.signal),s=a.val,o=i(null,a);return e.datum?(s="item.datum["+s+"]",o.fields.push(e.datum)):e.group?(s=r+"group["+s+"]", -o.nested.push({level:t,group:!0})):e.parent?(s=r+"group.datum["+s+"]",o.nested.push({level:t,parent:!0})):e.signal&&(s="signals["+s+"]",o.signals.push(f.field(e.signal)[0]),o.reflow=!0),o.val=s,o}function c(e){var t=null,n=null,r=i();return t=f.isString(e)?f.str(e):e.name?f.isString(e.name)?f.str(e.name):(n=l(e.name)).val:(n=l(e)).val,t="(item.mark._scaleRefs["+t+"] = 1, group.scale("+t+"))",e.invert&&(t+=".invert"),n&&n.nested.forEach(function(e){e.scale=!0}),n?(n.val=t,n):(r.val=t,r)}var d="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,f=e("datalib"),h=e("vega-logging"),p=e("vega-dataflow").Tuple,g=["signals","scales","data","fields"];t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{datalib:24,"vega-dataflow":39,"vega-logging":45}],103:[function(e,t,n){function r(e,t){return(t||[]).forEach(function(t){if(-1!==u.indexOf(t.name))throw Error('Signal name "'+t.name+'" is a reserved keyword ('+u.join(", ")+").");var n=e.signal(t.name,t.init).verbose(t.verbose);t.init&&t.init.expr&&(t.init.expr=o(t.init.expr),n.value(i(e,t.init))),t.expr&&(t.expr=o(t.expr),n.evaluate=function(r){var a=i(e,t);return a!==n.value()||n.verbose()?(n.value(a),r.signals[t.name]=1,r):e.doNotPropagate},n.dependency(s,t.expr.globals),t.expr.globals.forEach(function(t){e.signal(t).addListener(n)}))}),t}function i(e,t){var n=t.expr,i=n.fn(null,null,e.values(s,n.globals));return t.scale?r.scale(e,t,i):i}var a=e("datalib"),s=e("vega-dataflow").Dependencies.SIGNALS,o=e("./expr"),u=["datum","event","signals"].concat(a.keys(o.codegen.functions));r.scale=function(e,t,n,r,i){var u,l=t.scale,c=l.name||l.signal||l,d=l.scope;d&&(d.signal?d=e.signalRef(d.signal):a.isString(d)&&(u=l._expr=l._expr||o(d),d=u.fn(r,i,e.values(s,u.globals)))),d&&d.scale||(d=d&&d.mark?d.mark.group:e.scene().items[0]);var f=d.scale(c);return f?l.invert?f.invert(n):f(n):n},t.exports=r},{"./expr":94,datalib:24,"vega-dataflow":39}],104:[function(e,t,n){function r(t,n){function r(t){t=i.duplicate(t);var r=e("./"),a=t.width||500,s=t.height||500,o=t.viewport||null;d.defs({width:a,height:s,viewport:o,background:r.background(t.background),padding:r.padding(t.padding),signals:r.signals(d,t.signals),predicates:r.predicates(d,t.predicates),marks:r.marks(d,t,a,s),data:r.data(d,t.data,function(){n(l(d))})})}var u=arguments[arguments.length-1],l=arguments.length>2&&i.isFunction(u)?u:o.factory,c=arguments[2]!==l?arguments[2]:{},d=new s(c);if(i.isObject(t))r(t);else if(i.isString(t)){var f=i.extend({url:t},d.config().load);i.load(f,function(e,t){if(e)a.error("LOADING SPECIFICATION FAILED: "+e.statusText);else try{r(JSON.parse(t))}catch(n){a.error("INVALID SPECIFICATION: Must be a valid JSON object. "+n)}})}else a.error("INVALID SPECIFICATION: Must be a valid JSON object or URL.")}var i=e("datalib"),a=e("vega-logging"),s=e("../core/Model"),o=e("../core/View");t.exports=r},{"../core/Model":86,"../core/View":87,"./":95,datalib:24,"vega-logging":45}],105:[function(e,t,n){(function(n){function r(e){function t(t,n){var r,a,s,o=i.mouse((i.event=t,e.renderer().scene())),u=e.padding(),l={};if(n)for(r=n.mark,a="group"===r.marktype?n:r.group,s=n;null!=s;s=s.mark.group)s.mark.def.name&&(l[s.mark.def.name]=s);l.root=e.model().scene().items[0],t.vg=Object.create(f),t.vg.group=a,t.vg.item=n||{},t.vg.name=l,t.vg.x=o[0]-u.left,t.vg.y=o[1]-u.top}function n(e,t,n,r){function i(e){return!e.fn(n,r,m.values(o,e.globals))}var a,l,c,d,f=e.handlers[t],h=e.nodes[t],p=s.ChangeSet.create(null,!0),g=!1;for(l=0,c=f.length;c>l;++l)d=f[l],g=d.filters.some(i),g||(a=d.exp.fn(n,r,m.values(o,d.exp.globals)),d.spec.scale&&(a=u.scale(m,d.spec,a,n,r)),(a!==d.signal.value()||d.signal.verbose())&&(d.signal.value(a),p.signals[d.signal.name()]=1));m.propagate(p,h)}function r(e,t,n,i){t.forEach(function(t){t.event?h(e,t,n,i):t.signal?p(e,t,n,i):t.start?g(e,t,n,i):t.stream&&r(e,t.stream,n,i)})}function h(e,t,n,r){var i=t.event,o=t.name,u=t.mark,l=t.target,d=t.filters||[],f=l?b:_,h=l?l+":"+i:i,p=f.nodes[h]||(f.nodes[h]=new s.Node(m)),g=f.handlers[h]||(f.handlers[h]=[]);o?d.push('!!event.vg.name["'+o+'"]'):u&&d.push("event.vg.item.mark && event.vg.item.mark.marktype==="+a.str(u)),g.push({signal:e,exp:n,spec:r,filters:d.map(function(e){return c(e)})}),p.addListener(e)}function p(e,t,n,r){var i=new s.Node(m);i.evaluate=function(i){if(!i.signals[t.signal])return m.doNotPropagate;var a=n.fn(null,null,m.values(o,n.globals));return r.scale&&(a=u.scale(m,r,a)),(a!==e.value()||e.verbose())&&(e.value(a),i.signals[e.name()]=1,i.reflow=!0),i},i.dependency(s.Dependencies.SIGNALS,t.signal),i.addListener(e),m.signal(t.signal).addListener(i)}function g(e,t,n,i){var a=e.name(),s=a+d,o=c("true"),u=c("false"),l=t.middle,f=l.filters||(l.filters=[]),h=m.signal(s)||m.signal(s,!1);r(h,[t.start],o,{}),r(h,[t.end],u,{}),f.push(h.name()),r(e,[t.middle],n,i)}var m=e.model(),v=m.defs().signals,y={handlers:{},nodes:{}},_=a.duplicate(y),b=a.duplicate(y);return(v||[]).forEach(function(e){var t=m.signal(e.name);e.expr||(e.streams||[]).forEach(function(e){var n=l.parse(e.type),i=c(e.expr);r(t,n,i,e)})}),a.keys(_.handlers).forEach(function(r){e.on(r,function(e,i){e.preventDefault(),t(e,i),n(_,r,i&&i.datum||{},e)})}),a.keys(b.handlers).forEach(function(e){function r(r){t(r),n(b,e,i.select(this).datum(),r)}if("undefined"!=typeof window){for(var a=b.handlers[e],s=e.split(":"),o="window"===s[0]?[window]:window.document.querySelectorAll(s[0]),u=0;u0;if(e.add.length||e.rem.length||!p.length||e.mod.length===p.length||"area"===f||"line"===f?u.mark(this._mark,null,h&&!g):e.mod.forEach(function(e){u.item(e)}),h&&g){for(t=0,n=p.length;n>t;++t)for(c=p[t],c._legendPositions=null,r=0,s=c.legendItems.length;s>r;++r)d=c.legendItems[r],l.update(this._graph,e.trans,"vg_legendPosition",d.items,e.dirty),u.mark(d,null,!1);u.mark(this._mark,null,!0)}return a.ChangeSet.create(e,!0)},t.exports=r},{"./Encoder":109,datalib:24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],108:[function(e,t,n){function r(){return arguments.length?this.init.apply(this,arguments):this}function i(){var e,t,n,r,i,a,s=this._def.from,o=s.mark;o?(t=["vg",this._parent_id,o].join("_"),n={name:t,transform:s.transform,modify:s.modify}):(e=this._graph.data(this._from),t=["vg",this._from,this._def.type,e.listeners(!0).length].join("_"),n={name:t,source:this._from,transform:s.transform,modify:s.modify}),this._from=t,this._ds=_.datasource(this._graph,n);var u;o?(r=this.sibling(o),u=new f(this._graph).addListener(this._ds.listener()),u.evaluate=function(){return r._output},r._isSuper?r.addListener(u):r._bounder.addListener(u)):(i=this._ds.source().last(),a=g.create(i),a.add=i.add,a.mod=i.mod,a.rem=i.rem,a.stamp=null,this._graph.propagate(a,this._ds.listener(),i.stamp))}function a(){var e=p.ingest(new c(this._mark));return this._def.width&&p.set(e,"width",this._def.width),this._def.height&&p.set(e,"height",this._def.height),e}function s(e,t,n,r){var i,s,u,l,c,d,f,h=g.create(e),m=o(this._def.key||(n?"_id":null)),v=this._mark.items||[],y=n?e.rem:v,_=p.idMap(!n||r?t:e.mod),x=[];for(i=0,u=y.length;u>i;++i)l=y[i]===v[i]?v[i]:m?this._map[m(y[i])]:y[i],l.status=b.EXIT;for(i=0,u=t.length;u>i;++i)c=t[i],l=m?this._map[s=m(c)]:v[i],d=l?!1:(l=a.call(this),!0),l.status=d?b.ENTER:b.UPDATE,f=!d&&l.datum!==c,l.datum=c,m&&(p.set(l,"key",s),this._map[s]=l),d?h.add.push(l):(f||_[c._id])&&h.mod.push(l),x.push(l);for(i=0,u=y.length;u>i;++i)l=y[i]===v[i]?v[i]:m?this._map[s=m(y[i])]:y[i],l.status===b.EXIT&&(l._dirty=!0,e.dirty.push(l),x.push(l),h.rem.push(l),m&&(this._map[s]=null));return this._mark.items=x,h}function o(e){if(null==e)return null;var t=u.array(e).map(u.accessor);return function(e){for(var n="",r=0,i=t.length;i>r;++r)r>0&&(n+="|"),n+=String(t[r](e));return n}}var u=e("datalib"),l=e("vega-logging"),c=e("vega-scenegraph").Item,d=e("vega-dataflow"),f=d.Node,h=d.Dependencies,p=d.Tuple,g=d.ChangeSet,m={},v=e("./Encoder"),y=e("./Bounder"),_=e("../parse/data"),b=r.STATUS={ENTER:"enter",UPDATE:"update",EXIT:"exit"},x=1,w=2,k=r.prototype=new f;k.init=function(e,t,n,r,a,s){return f.prototype.init.call(this,e).router(!0).collector(!0),this._def=t,this._mark=n,this._from=(t.from?t.from.data:null)||s,this._ds=u.isString(this._from)?e.data(this._from):null,this._map={},this._status=null,n.def=t,n.marktype=t.type,n.interactive=t.interactive!==!1,n.items=[],u.isValid(t.name)&&(n.name=t.name),this._parent=r,this._parent_id=a,t.from&&(t.from.mark||t.from.transform||t.from.modify)&&i.call(this),this._isSuper="group"!==this._def.type,this._encoder=new v(this._graph,this._mark,this),this._bounder=new y(this._graph,this._mark),this._output=null,this._ds&&this._encoder.dependency(h.DATA,this._from),this.dependency(h.DATA,this._encoder.dependency(h.DATA)),this.dependency(h.SCALES,this._encoder.dependency(h.SCALES)),this.dependency(h.SIGNALS,this._encoder.dependency(h.SIGNALS)),this},k.ds=function(){return this._ds},k.parent=function(){return this._parent},k.encoder=function(){return this._encoder},k.pipeline=function(){return[this]},k.connect=function(){var e=this;return this._graph.connect(this.pipeline()),this._encoder._scales.forEach(function(t){(t=e._parent.scale(t))&&t.addListener(e)}),this._parent&&(this._isSuper?this.addListener(this._parent._collector):this._bounder.addListener(this._parent._collector)),this._status=x,this},k.disconnect=function(){function e(e){for(var n,r=0,i=e.length;i>r;++r)(n=t._parent.scale(e[r]))&&n.removeListener(t)}var t=this;return this._listeners.length?(f.prototype.disconnect.call(this),this._graph.disconnect(this.pipeline()),e(this._encoder._scales),e(u.keys(this._mark._scaleRefs)),this._status=w,this):this},k.sibling=function(e){return this._parent.child(e,this._parent_id)},k.evaluate=function(e){l.debug(e,["building",this._from||this._def.from,this._def.type]);var t,n,r,i,a,o=this,c=this._mark.def,d=c.properties||{},f=d.update||{};if(this._ds){if(t=g.create(e),i=t.data[a=this._ds.name()],delete t.data[a],n=this._encoder.reevaluate(t),t.data[a]=i,n&&(t.mod=this._mark.items.slice()),r=this._ds.last(),!r)throw Error("Builder evaluated before backing DataSource.");r.stamp>this._stamp&&(t=s.call(this,r,this._ds.values(),!0,n))}else i=u.isFunction(this._def.from)?this._def.from():[m],t=s.call(this,e,i);return this._output=t=this._graph.evaluate(t,this._encoder),f.nested&&f.nested.length&&this._status===x&&u.keys(this._mark._scaleRefs).forEach(function(e){var t=o._parent.scale(e);t&&(t.addListener(o),o.dependency(h.SCALES,e),o._encoder.dependency(h.SCALES,e))}),this._isSuper&&(t.mod=t.mod.filter(function(e){return e._dirty}),t=this._graph.evaluate(t,this._bounder)),t},t.exports=r},{"../parse/data":92,"./Bounder":107,"./Encoder":109,datalib:24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],109:[function(e,t,n){function r(e,t,n){var r=t.def.properties||{},i=r.enter,a=r.update,s=r.exit;c.prototype.init.call(this,e),this._mark=t,this._builder=n;var o=this._scales=[];return i&&o.push.apply(o,i.scales),a&&(this.dependency(d.DATA,a.data),this.dependency(d.SIGNALS,a.signals),this.dependency(d.FIELDS,a.fields),this.dependency(d.SCALES,a.scales),o.push.apply(o,a.scales)),s&&o.push.apply(o,s.scales),this.mutates(!0)}function i(e,t,n,r){var i,a,s,o=n.add.length;return(i=r.enter)&&(a=i[e]).length&&o&&(s=t.values(e,a,s=s||{})),(i=r.exit)&&(a=i[e]).length&&n.rem.length&&(s=t.values(e,a,s=s||{})),(i=r.update)&&(a=i[e]).length&&(o||n.mod.length)&&(s=t.values(e,a,s=s||{})),s||h}function a(e,t,n,r,i,a,s){var o=e.encode,u=t._dirty,l=o.call(o,t,t.mark.group||t,n,r,i,a);t._dirty=l||u,l&&!u&&s.push(t)}function s(){for(var e,t,n,r=this._mark.def.properties.update.nested,i=this._builder,a=0,s=0,o=r.length;o>s;++s)if(e=r[s],!e.scale){for(;athis._stamp)return!0}return!1}var o=e("datalib"),u=e("vega-logging"),l=e("vega-dataflow"),c=l.Node,d=l.Dependencies,f=e("vega-scenegraph").bound,h={},p=r.prototype=new c;p.evaluate=function(t){u.debug(t,["encoding",this._mark.def.type]);var n,r,s,o,l=this._graph,c=this._mark.def.properties||{},f=this._mark.items,p=c.enter,g=c.update,m=c.exit,v=t.dirty,y=l.predicates(),_=t.request,b=this._mark.group,x=b&&(b.mark.axis||b.mark.legend),w=h,k=h;if(_&&!x){if((o=c[_])&&t.mod.length)for(w=o.data?l.values(d.DATA,o.data):null,k=o.signals?l.values(d.SIGNALS,o.signals):null,n=0,r=t.mod.length;r>n;++n)s=t.mod[n],a.call(this,o,s,t.trans,w,k,y,v);return t}for(w=i(d.DATA,l,t,c),k=i(d.SIGNALS,l,t,c),n=0,r=t.rem.length;r>n;++n)s=t.rem[n],m&&a.call(this,m,s,t.trans,w,k,y,v),t.trans&&!m?t.trans.interpolate(s,h):t.trans||f.pop();var S=e("./Builder").STATUS.UPDATE;for(n=0,r=t.add.length;r>n;++n)s=t.add[n],p&&a.call(this,p,s,t.trans,w,k,y,v),g&&a.call(this,g,s,t.trans,w,k,y,v),s.status=S;if(g)for(n=0,r=t.mod.length;r>n;++n)s=t.mod[n],a.call(this,g,s,t.trans,w,k,y,v);return t},p.reevaluate=function(e){var t=this._mark.def,n=t.properties||{},r=o.isFunction(t.from)||t.orient||e.request||c.prototype.reevaluate.call(this,e);return r||(n.update?s.call(this):!1)},r.update=function(e,t,n,r,i){r=o.array(r);var s,u,l,c,h,p=e.predicates(),g=e.values(d.DATA),m=e.values(d.SIGNALS);for(s=0,u=r.length;u>s;++s)l=r[s],c=l.mark.def.properties,h=c&&c[n],h&&(a.call(null,h,l,t,g,m,p,i),f.item(l))},t.exports=r},{"./Builder":108,datalib:24,"vega-dataflow":39,"vega-logging":45,"vega-scenegraph":46}],110:[function(e,t,n){function r(){return this._children={},this._scaler=null,this._recursor=null,this._scales={},this.scale=a.bind(this),arguments.length?this.init.apply(this,arguments):this}function i(e){function t(e){e.type!=b.MARK||e.inline||void 0===m._graph.data(e.from)||m._recursor.removeListener(e.builder)}function n(t){var n=t.scale();e.scales[n.scaleName]&&t.reset().def()}function r(t){var n=t.size()||t.shape()||t.fill()||t.stroke();e.scales[n.scaleName]&&t.reset().def()}function i(e){m._recursor.removeListener(e.builder),e.builder.disconnect()}var a,s,d,f,h,p,g,m=this,v=c.array(this._def.marks).length>0,y=c.array(this._def.axes).length>0,_=c.array(this._def.legends).length>0,x=!1;for(a=0,f=e.add.length;f>a;++a)h=e.add[a],v&&o.call(this,e,h),y&&u.call(this,e,h),_&&l.call(this,e,h);for(a=e.add.length-1;a>=0;--a)for(h=e.add[a],s=this._children[h._id].length-1;s>=0;--s)d=this._children[h._id][s],d.builder.connect(),p=d.builder.pipeline(),g=d.builder._def,x=g.type!==b.GROUP,x=x&&void 0!==this._graph.data(d.from),x=x&&1===p[p.length-1].listeners().length,x=x&&g.from&&!g.from.mark,d.inline=x,x?this._graph.evaluate(e,d.builder):this._recursor.addListener(d.builder);for(a=0,f=e.mod.length;f>a;++a)h=e.mod[a],v&&m._children[h._id].forEach(t),y&&h.axes.forEach(n),_&&h.legends.forEach(r);for(a=0,f=e.rem.length;f>a;++a)h=e.rem[a],m._children[h._id].forEach(i),delete m._children[h._id];return e}function a(e,t){var n=this,r=null;if(2===arguments.length)return n._scales[e]=t,t;for(;null==r&&(r=n._scales[e],n=n.mark?n.mark.group:n._parent););return r}function s(e,t){g.debug(e,["building group",t._id]),t._scales=t._scales||{},t.scale=a.bind(t),t.items=t.items||[],this._children[t._id]=this._children[t._id]||[],t.axes=t.axes||[],t.axisItems=t.axisItems||[],t.legends=t.legends||[],t.legendItems=t.legendItems||[]}function o(e,t){g.debug(e,["building children marks #"+t._id]);var n,i,a,s,o,u,l=this._def.marks;for(s=0,o=l.length;o>s;++s)n=l[s],i=n.from||{},a=t.datum._facetID,t.items[s]={group:t,_scaleRefs:{}},u=n.type===b.GROUP?new r:new m,u.init(this._graph,n,t.items[s],this,t._id,a),this._children[t._id].push({builder:u,from:i.data||(i.mark?"vg_"+t._id+"_"+i.mark:a),type:b.MARK})}function u(e,t){var n=t.axes,i=t.axisItems,a=this;y(this._graph,this._def.axes,n,t),n.forEach(function(e,n){var s=a._def.axes[n].scale,o=e.def(),u=null;i[n]={group:t,axis:!0,layer:o.layer},u=o.type===b.GROUP?new r:new m,u.init(a._graph,o,i[n],a).dependency(h.SCALES,s),a._children[t._id].push({builder:u,type:b.AXIS,scale:s})})}function l(e,t){var n=t.legends,i=t.legendItems,a=this;_(this._graph,this._def.legends,n,t),n.forEach(function(e,n){var s=e.size()||e.shape()||e.fill()||e.stroke(),o=e.def(),u=null;i[n]={group:t,legend:!0},u=o.type===b.GROUP?new r:new m,u.init(a._graph,o,i[n],a).dependency(h.SCALES,s),a._children[t._id].push({builder:u,type:b.LEGEND,scale:s})})}var c=e("datalib"),d=e("vega-dataflow"),f=d.Node,h=d.Dependencies,p=d.Collector,g=e("vega-logging"),m=e("./Builder"),v=e("./Scale"),y=e("../parse/axes"),_=e("../parse/legends"),b=r.TYPES={GROUP:"group",MARK:"mark",AXIS:"axis",LEGEND:"legend"},x=r.prototype=new m;x.init=function(e,t){var n,r=this;this._scaler=new f(e),(t.scales||[]).forEach(function(t){t=r.scale(n=t.name,new v(e,t,r)),r.scale(n+":prev",t),r._scaler.addListener(t)}),this._recursor=new f(e),this._recursor.evaluate=i.bind(this);var a=(t.axes||[]).reduce(function(e,t){return e[t.scale]=1,e},{});return a=(t.legends||[]).reduce(function(e,t){return e[t.size||t.shape||t.fill||t.stroke],e},a),this._recursor.dependency(h.SCALES,c.keys(a)),this._collector=new p(e),m.prototype.init.apply(this,arguments)},x.evaluate=function(){var e=m.prototype.evaluate.apply(this,arguments),t=this;return e.add.forEach(function(n){s.call(t,e,n)}),e},x.pipeline=function(){return[this,this._scaler,this._recursor,this._collector,this._bounder]},x.disconnect=function(){var e=this;return c.keys(e._children).forEach(function(t){e._children[t].forEach(function(t){e._recursor.removeListener(t.builder),t.builder.disconnect()})}),e._children={},m.prototype.disconnect.call(this)},x.child=function(e,t){for(var n,r=this._children[t],i=0,a=r.length;a>i&&(n=r[i],n.type!=b.MARK||n.builder._def.name!=e);++i);return n.builder},t.exports=r},{"../parse/axes":90,"../parse/legends":96,"./Builder":108,"./Scale":111,datalib:24,"vega-dataflow":39,"vega-logging":45}],111:[function(e,t,n){(function(n){function r(e,t,n){return this._def=t,this._parent=n,this._updated=!1,w.prototype.init.call(this,e).reflows(!0)}function i(e){var t=this._def.name,n=t+":prev",r=a.call(this,e.scale(t)),i=r.type===T.ORDINAL?s:o,u=v.call(this,e);return i.call(this,r,u,e),e.scale(t,r),e.scale(n,e.scale(n)||r),r}function a(e){var t=this._graph.config(),n=this._def.type||T.LINEAR;if(!e||n!==e.type){var r=t.scale[n]||y.scale[n];if(!r)throw Error("Unrecognized scale type: "+n);(e=r()).type=e.type||n,e.scaleName=this._def.name,e._prev={}}return e}function s(e,t,n){var r,i,a=this._def,s=e._prev,o=!1,u=g.call(this,a.padding)||0,l=null==a.outerPadding?u:g.call(this,a.outerPadding),c=a.points&&g.call(this,a.points),d=g.call(this,a.round)||null==a.round;if(_.isObject(a.range)&&!_.isArray(a.range)&&(o=!0,t=p.call(this,A.RANGE,a.range,e,n)),r=p.call(this,A.DOMAIN,a.domain,e,n),r&&!_.equal(s.domain,r)&&(e.domain(r),s.domain=r,this._updated=!0),!_.equal(s.range,t)){if(a.bandWidth){var f,h=g.call(this,a.bandWidth),m=r.length,v=a.points?u*h:u*h*(m-1)+2*l;t[0]>t[1]?(f=t[1]||0,t=[f+(h*m+v),f]):(f=t[0]||0,t=[f,f+(h*m+v)])}i="string"==typeof t[0],i||t.length>2||1===t.length||o?e.range(t):c&&d?e.rangeRoundPoints(t,u):c?e.rangePoints(t,u):d?e.rangeRoundBands(t,u,l):e.rangeBands(t,u,l),e.invert||(e.invert=function(t,n){if(1===arguments.length)return e.domain()[y.bisect(e.range(),t)-1];if(2===arguments.length){if(!_.isNumber(t)||!_.isNumber(n))throw Error("Extents to ordinal invert are not numbers ("+t+", "+n+").");for(var r,i=[],a=e.range(),s=0,o=a.length;o>s;++s)r=a[s],(n>t?r>=t&&n>=r:r>=n&&t>=r)&&i.push(r);return i.map(function(t){return e.invert(t)})}}),s.range=t,this._updated=!0}}function o(e,t,n){var r,i,a=this._def,s=e._prev,o=g.call(this,a.round),u=g.call(this,a.exponent),l=g.call(this,a.clamp),c=g.call(this,a.nice);r=a.type===T.QUANTILE?p.call(this,A.DOMAIN,a.domain,e,n):m.call(this,e,n),r&&!_.equal(s.domain,r)&&(e.domain(r),s.domain=r,this._updated=!0),"height"===g.call(this,a.range)&&(t=t.reverse()),_.equal(s.range,t)||(e[o&&e.rangeRound?"rangeRound":"range"](t),s.range=t,this._updated=!0,this._stamp>0||(u&&a.type===T.POWER&&e.exponent(u),l&&e.clamp(!0),c&&(a.type===T.TIME?(i=y.time[c],i||x.error("Unrecognized interval: "+i),e.nice(i)):e.nice())))}function u(e){return e.type===T.ORDINAL||e.type===T.QUANTILE}function l(e){return e.fields||_.array(e)}function c(e){return e.some(function(e){return e.data?e.data&&_.array(e.field).some(function(e){return e.parent}):!0})}function d(e,t){return _.array(e.field).map(function(e){return e.parent?_.accessor(e.parent)(t.datum):e})}function f(e,t){var n=l(e);return 1==n.length&&1==_.array(n[0].field).length?S.TYPES.TUPLE:u(t)&&_.isObject(e.sort)?S.TYPES.MULTI:S.TYPES.VALUE}function h(e,t,n,r){var i=l(t),a=c(i),s=f(t,n),o=u(n),h=t.sort,p="_"+e,g=d(i[0],r);if(n[p]||this[p])return n[p]||this[p];var m,v,y=new S(this._graph).type(s);return a?n[p]=y:this[p]=y,o?s===S.TYPES.VALUE?(m=[{name:A.GROUPBY,get:_.identity}],v={"*":A.COUNT}):s===S.TYPES.TUPLE?(m=[{name:A.GROUPBY,get:_.$(g[0])}],v=_.isObject(h)?[{field:A.VALUE,get:_.$(h.field),ops:[h.op]}]:{"*":A.COUNT}):(m=A.GROUPBY,v=[{field:A.VALUE,ops:[h.op]}]):(m=[],v=[{field:A.VALUE,get:s==S.TYPES.TUPLE?_.$(g[0]):_.identity,ops:[A.MIN,A.MAX],as:[A.MIN,A.MAX]}]),y.param("groupby",m).param("summarize",v),y._lastUpdate=-1,y}function p(e,t,n,r){function i(e){T.dependency(k.SIGNALS,e)}if(null==t)return[];if(_.isArray(t))return t.map(g.bind(this));var a,s,o,p,m,v,y,b,x,w,M,T=this,E=this._graph,L=l(t),C=c(L),D=f(t,n),P=h.apply(this,arguments),N=t.sort,I=u(n);if(C||!C&&P._lastUpdatea;++a)if(m=L[a],x=m.data||r.datum._facetID,b=E.data(x).last(),!(b.stamp<=this._stamp)){for(v=d(m,r),o=0,p=v.length;p>o;++o)y=v[o],D===S.TYPES.VALUE?P.accessors(null,y):D===S.TYPES.MULTI&&P.accessors(y,m.sort||N.field),P.evaluate(b);this.dependency(k.DATA,x),P.dependency(k.SIGNALS).forEach(i)}P._lastUpdate=this._stamp,b=P.aggr().result(),I?(_.isObject(N)?(M=(w=N.order)&&w.signal?E.signalRef(w.signal):w,M=(M==A.DESC?"-":"+")+N.op+"_"+A.VALUE,M=_.comparator(M)):N===!0&&(M=_.comparator(A.GROUPBY)),M&&(b=b.sort(M)),P._values=b.map(function(e){return e[A.GROUPBY]})):(b=b[0],P._values=_.isValid(b)?[b[A.MIN],b[A.MAX]]:[])}return P._values}function g(e){if(!e||!e.signal)return e;var t,n=e.signal;return this.dependency(k.SIGNALS,(t=_.field(n))[0]),this._graph.signalRef(t)}function m(e,t){var n,r,i=this._def,a=[null,null];return void 0!==i.domain&&(a=_.isObject(i.domain)?p.call(this,A.DOMAIN,i.domain,e,t):a),r=a.length-1,void 0!==i.domainMin&&(_.isObject(i.domainMin)?i.domainMin.signal?a[0]=_.isValid(n=g.call(this,i.domainMin))?n:a[0]:a[0]=p.call(this,A.DOMAIN+A.MIN,i.domainMin,e,t)[0]:a[0]=i.domainMin),void 0!==i.domainMax&&(_.isObject(i.domainMax)?i.domainMax.signal?a[r]=_.isValid(n=g.call(this,i.domainMax))?n:a[r]:a[r]=p.call(this,A.DOMAIN+A.MAX,i.domainMax,e,t)[1]:a[r]=i.domainMax),i.type===T.LOG||i.type===T.TIME||!i.zero&&void 0!==i.zero||(a[0]=Math.min(0,a[0]),a[r]=Math.max(0,a[r])),a}function v(e){var t=this._def,n=this._graph.config(),r=g.call(this,t.range),i=[null,null];if(void 0!==r)if("string"==typeof r)if(M[r])i=[0,e[r]];else{if(!n.range[r])return x.error("Unrecogized range: "+r),i;i=n.range[r]}else if(_.isArray(r))i=_.duplicate(r).map(g.bind(this));else{if(_.isObject(r))return null;i=[0,r]}if(void 0!==t.rangeMin&&(i[0]=t.rangeMin.signal?g.call(this,t.rangeMin):t.rangeMin),void 0!==t.rangeMax&&(i[i.length-1]=t.rangeMax.signal?g.call(this,t.rangeMax):t.rangeMax),void 0!==t.reverse){var a=g.call(this,t.reverse);_.isObject(a)&&(a=_.accessor(a.field)(e.datum)),a&&(i=i.reverse())}return i}var y="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,_=e("datalib"),b=e("vega-dataflow"),x=e("vega-logging"),w=b.Node,k=b.Dependencies,S=e("../transforms/Aggregate"),M={width:1,height:1},T={LINEAR:"linear",ORDINAL:"ordinal",LOG:"log",POWER:"pow",SQRT:"sqrt",TIME:"time",TIME_UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold"},A={DOMAIN:"domain",RANGE:"range",COUNT:"count",GROUPBY:"groupby",MIN:"min",MAX:"max",VALUE:"value",ASC:"asc",DESC:"desc"},E=r.prototype=new w;E.evaluate=function(e){var t=this,n=function(e){i.call(t,e)};return this._updated=!1,e.add.forEach(n),e.mod.forEach(n),this._updated&&(e.scales[this._def.name]=1,x.debug(e,["scale",this._def.name])),b.ChangeSet.create(e,!0)},E.dependency=function(e,t){if(2==arguments.length){var n=e===k.DATA?"data":"signal";t=_.array(t);for(var r=0,i=t.length;i>r;++r)this._graph[n](t[r]).addListener(this._parent)}return w.prototype.dependency.call(this,e,t)},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../transforms/Aggregate":116,datalib:24,"vega-dataflow":39,"vega-logging":45}],112:[function(e,t,n){(function(n){function r(e,t){this.duration=e||500,this.ease=t&&a.ease(t)||a.ease("cubic-in-out"),this.updates={next:null}}function i(e){for(var t,n,r,i,a,o,l=this.updates,c=l,d=c.next,f=this.duration,h=!0;null!=d;c=d,d=c.next)if(t=d.item,n=t.delay||0,r=(e-n)/f,0>r)h=!1;else{for(r>1&&(r=1),i=d.ease(r),a=0,o=d.length;o>a;++a)t[d[a].property]=d[a](i);t.touch(),s.item(t),1===r?(d.remove&&(t.status=u.EXIT,t.remove()),c.next=d.next,d=c):h=!1}return this.callback(),h}var a="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,s=e("vega-scenegraph").bound,o=e("vega-dataflow").Tuple,u=e("./Builder").STATUS,l=r.prototype,c={text:1,url:1};l.interpolate=function(e,t){var n,r,i,s,l=null;for(n in t)r=e[n],i=t[n],r!==i&&(c[n]||void 0===r?o.set(e,n,i):"number"!=typeof r||isFinite(r)?(s=a.interpolate(r,i),s.property=n,(l||(l=[])).push(s)):o.set(e,n,i));return null===l&&e.status===u.EXIT&&(l=[]),null!=l&&(l.item=e,l.ease=e.mark.ease||this.ease,l.next=this.updates.next,this.updates.next=l),this},l.start=function(e){for(var t=this,n=t.updates,r=n.next;null!=r;n=r,r=n.next)r.item.status===u.EXIT&&(r.item.status=u.UPDATE,r.remove=!0);t.callback=e,a.timer(function(e){return i.call(t,e)})},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Builder":108,"vega-dataflow":39,"vega-scenegraph":46}],113:[function(e,t,n){function r(e){function t(){N.type=null}function n(e){return{data:e}}function r(){var e=B||a();return M(e,G)}function a(){switch(E.type){case _:return _;case b:return b;case w:return x;default:return k}}function v(e,t,n){function r(t){return(e[0]<0?-Math.log(t>0?0:-t):Math.log(0>t?0:t))/Math.log(s)}function i(t){return e[0]<0?-Math.pow(s,-t):Math.pow(s,t)}if(null==t)return n;var a,s=E.base(),o=Math.min(s,E.ticks().length/t),u=e[0]>0?(a=1e-12,Math.ceil):(a=-1e-12,Math.floor);return function(e){return i(u(r(e)+a))/e>=o?n(e):""}}function M(e,t){var n,r,i=m.format,a="log"===E.type;switch(e){case k:return n=E.domain(),r=i.auto.number(n,Y,t||(a?".1r":null)),a?v(n,Y,r):r;case _:return(t?i:i.auto).time(t);case b:return(t?i:i.auto).utc(t);default:return String}}function T(e){var t=q||(E.ticks?E.ticks(Y):E.domain()),r=i(E,t,$).map(n);return t=t.map(function(t){return t=n(t),t.label=e(t.data),t}),[t,r]}function A(t){var n,r,i;t.type===w?(n={scale:t.scaleName,offset:.5+t.rangeBand()/2},r=n):(n={scale:t.scaleName,offset:.5},r={scale:t.scaleName+":prev",offset:.5}),i=s(t),m.extend(Z.gridLines,f(L)),m.extend(Z.majorTicks,f(L)),m.extend(Z.minorTicks,f(L)),m.extend(Z.tickLabels,h(L)),m.extend(Z.domain,g(L)),m.extend(Z.title,p(L)),Z.gridLines.properties.enter.stroke={value:L.axis.gridColor},Z.gridLines.properties.enter.strokeOpacity={value:L.axis.gridOpacity},u(C,Z.gridLines,r,n,1/0),u(C,Z.majorTicks,r,n,U),u(C,Z.minorTicks,r,n,z),o(C,Z.tickLabels,r,n,U,R),c(C,Z.domain,i,F),l(C,Z.title,i,P),m.extend(Z.gridLines.properties.update,H),m.extend(Z.majorTicks.properties.update,W),m.extend(Z.minorTicks.properties.update,X),m.extend(Z.tickLabels.properties.update,V),m.extend(Z.domain.properties.update,K),m.extend(Z.title.properties.update,J);var a=[Z.gridLines,Z.majorTicks,Z.minorTicks,Z.tickLabels,Z.domain,Z.title];m.extend(N,{type:"group",interactive:!1,properties:{enter:{encode:d,scales:[t.scaleName],signals:[],data:[]},update:{encode:d,scales:[t.scaleName],signals:[],data:[]}}}),N.marks=a.map(function(t){return y(e,t)})}var E,L=e.config(),C=L.axis.orient,D=0,P=L.axis.titleOffset,N={},I="front",O=!1,j=null,U=L.axis.tickSize,z=L.axis.tickSize,F=L.axis.tickSize,R=L.axis.padding,q=null,G=null,B=null,$=0,Y=L.axis.ticks,H={},V={},W={},X={},J={},K={},Z={gridLines:{},majorTicks:{},minorTicks:{},tickLabels:{},domain:{},title:{}},Q={};return Q.def=function(){N.type||A(E);var e=T(r()),t=j?[j].map(n):[];return N.marks[0].from=function(){return O?e[0]:[]},N.marks[1].from=function(){return e[0]},N.marks[2].from=function(){return e[1]},N.marks[3].from=N.marks[1].from,N.marks[4].from=function(){return[1]},N.marks[5].from=function(){return t},N.offset=D,N.orient=C,N.layer=I,N},Q.scale=function(e){return arguments.length?(E!==e&&(E=e,t()),Q):E},Q.orient=function(e){return arguments.length?(C!==e&&(C=e in S?e+"":L.axis.orient,t()),Q):C},Q.title=function(e){return arguments.length?(j!==e&&(j=e,t()),Q):j},Q.tickCount=function(e){return arguments.length?(Y=e,Q):Y},Q.tickValues=function(e){return arguments.length?(q=e,Q):q},Q.tickFormat=function(e){return arguments.length?(G!==e&&(G=e,t()),Q):G},Q.tickFormatType=function(e){return arguments.length?(B!==e&&(B=e,t()),Q):B},Q.tickSize=function(e,n){if(!arguments.length)return U;var r=arguments.length-1,i=+e,a=r>1?+n:U,s=r>0?+arguments[r]:U;return(U!==i||z!==a||F!==s)&&t(),U=i,z=a,F=s,Q},Q.tickSubdivide=function(e){return arguments.length?($=+e,Q):$},Q.offset=function(e){return arguments.length?(D=m.isObject(e)?e:+e,Q):D},Q.tickPadding=function(e){return arguments.length?(R!==+e&&(R=+e,t()),Q):R},Q.titleOffset=function(e){return arguments.length?(P!==+e&&(P=+e,t()),Q):P},Q.layer=function(e){return arguments.length?(I!==e&&(I=e,t()),Q):I},Q.grid=function(e){return arguments.length?(O!==e&&(O=e,t()),Q):O},Q.gridLineProperties=function(e){return arguments.length?(H!==e&&(H=e),Q):H},Q.majorTickProperties=function(e){return arguments.length?(W!==e&&(W=e),Q):W},Q.minorTickProperties=function(e){return arguments.length?(X!==e&&(X=e),Q):X},Q.tickLabelProperties=function(e){return arguments.length?(V!==e&&(V=e),Q):V},Q.titleProperties=function(e){return arguments.length?(J!==e&&(J=e),Q):J},Q.domainProperties=function(e){return arguments.length?(K!==e&&(K=e),Q):K},Q.reset=function(){return t(),Q},Q}function i(e,t,n){var r=[]; -if(n&&t.length>1){for(var i,s,o=a(e.domain()),u=-1,l=t.length,c=(t[1]-t[0])/++n;++u0;)(s=+t[u]-i*c)>=o[0]&&r.push(s);for(--u,i=0;++it?[t,n]:[n,t]}function s(e){return e.rangeExtent?e.rangeExtent():a(e.range())}function o(e,t,n,r,i,a){i=Math.max(i,0)+a,("left"===e||"top"===e)&&(i*=-1),"top"===e||"bottom"===e?(m.extend(t.properties.enter,{x:n,y:{value:i}}),m.extend(t.properties.update,{x:r,y:{value:i},align:{value:"center"},baseline:{value:T[e]}})):(m.extend(t.properties.enter,{x:{value:i},y:n}),m.extend(t.properties.update,{x:{value:i},y:r,align:{value:M[e]},baseline:{value:"middle"}}))}function u(e,t,n,r,i){var a="left"===e||"top"===e?-1:1;i=i===1/0?"top"===e||"bottom"===e?{field:{group:"height",level:2},mult:-a}:{field:{group:"width",level:2},mult:-a}:{value:a*i},"top"===e||"bottom"===e?(m.extend(t.properties.enter,{x:n,y:{value:0},y2:i}),m.extend(t.properties.update,{x:r,y:{value:0},y2:i}),m.extend(t.properties.exit,{x:r})):(m.extend(t.properties.enter,{x:{value:0},x2:i,y:n}),m.extend(t.properties.update,{x:{value:0},x2:i,y:r}),m.extend(t.properties.exit,{y:r}))}function l(e,t,n,r){var i=~~((n[0]+n[1])/2),a="top"===e||"left"===e?-1:1;"bottom"===e||"top"===e?m.extend(t.properties.update,{x:{value:i},y:{value:a*r},angle:{value:0}}):m.extend(t.properties.update,{x:{value:a*r},y:{value:i},angle:{value:"left"===e?-90:90}})}function c(e,t,n,r){var i;("top"===e||"left"===e)&&(r=-1*r),i="bottom"===e||"top"===e?"M"+n[0]+","+r+"V0H"+n[1]+"V"+r:"M"+r+","+n[0]+"H0V"+n[1]+"H"+r,t.properties.update.path={value:i}}function d(e,t,n){var r=n?{}:e,i=e.mark.def.offset,a=e.mark.def.orient,s=t.width,o=t.height;if(m.isArray(i)){var u=i[0],l=i[1];switch(a){case"left":v.set(r,"x",-u),v.set(r,"y",l);break;case"right":v.set(r,"x",s+u),v.set(r,"y",l);break;case"bottom":v.set(r,"x",u),v.set(r,"y",o+l);break;case"top":v.set(r,"x",u),v.set(r,"y",-l);break;default:v.set(r,"x",u),v.set(r,"y",l)}}else switch(m.isObject(i)&&(i=-t.scale(i.scale)(i.value)),a){case"left":v.set(r,"x",-i),v.set(r,"y",0);break;case"right":v.set(r,"x",s+i),v.set(r,"y",0);break;case"bottom":v.set(r,"x",0),v.set(r,"y",o+i);break;case"top":v.set(r,"x",0),v.set(r,"y",-i);break;default:v.set(r,"x",0),v.set(r,"y",0)}return n&&n.interpolate(e,r),!0}function f(e){return{type:"rule",interactive:!1,key:"data",properties:{enter:{stroke:{value:e.axis.tickColor},strokeWidth:{value:e.axis.tickWidth},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1}}}}}function h(e){return{type:"text",interactive:!0,key:"data",properties:{enter:{fill:{value:e.axis.tickLabelColor},font:{value:e.axis.tickLabelFont},fontSize:{value:e.axis.tickLabelFontSize},opacity:{value:1e-6},text:{field:"label"}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1}}}}}function p(e){return{type:"text",interactive:!0,properties:{enter:{font:{value:e.axis.titleFont},fontSize:{value:e.axis.titleFontSize},fontWeight:{value:e.axis.titleFontWeight},fill:{value:e.axis.titleColor},align:{value:"center"},baseline:{value:"middle"},text:{field:"data"}},update:{}}}}function g(e){return{type:"path",interactive:!1,properties:{enter:{x:{value:.5},y:{value:.5},stroke:{value:e.axis.axisColor},strokeWidth:{value:e.axis.axisWidth}},update:{}}}}var m=e("datalib"),v=e("vega-dataflow").Tuple,y=e("../parse/mark"),_="time",b="utc",x="string",w="ordinal",k="number",S={top:1,right:1,bottom:1,left:1},M={bottom:"center",top:"center",left:"right",right:"left"},T={bottom:"top",top:"bottom",left:"middle",right:"middle"};t.exports=r},{"../parse/mark":97,datalib:24,"vega-dataflow":39}],114:[function(e,t,n){(function(n){function r(e){function t(){G.type=null}function n(e,t){return{data:e,index:t}}function r(e){return"ordinal"===e||"quantize"===e||"quantile"===e||"threshold"===e}function v(e){var t,r,i,a=y(w,k,S,M),s=(null==A?e.ticks?e.ticks.apply(e,I):e.domain():A).map(n),o=null==E?e.tickFormat?e.tickFormat.apply(e,I):String:E,u=5,l=d.range(s.length);w?(r=s.map(function(e){return Math.sqrt(w(e.data))}),i=d.max(r),r=r.reduce(function(e,t,n,r){return n>0&&(e[n]=e[n-1]+r[n-1]/2+u),e[n]+=t/2,e},[0]).map(Math.round)):(i=Math.round(Math.sqrt(C.legend.symbolSize)),r=T||(t=F.fontSize)&&t.value+u||C.legend.labelFontSize+u,r=l.map(function(e,t){return Math.round(i/2+t*r)}));var c,f=N;x&&(c=z.fontSize,f+=5+(c&&c.value||C.legend.titleFontSize));for(var h=0,p=r.length;p>h;++h)r[h]+=f;var g={name:"legend",type:"ordinal",points:!0,domain:l,range:r},m=(x?[x]:[]).map(n);return s.forEach(function(e){e.label=o(e.data),e.offset=i}),a.scales=[g],a.marks[0].from=function(){return m},a.marks[1].from=function(){return s},a.marks[2].from=a.marks[1].from,a}function y(t,n,r,l){var c=f.extend(R.titles,s(C)),d=f.extend(R.symbols,o(C)),h=f.extend(R.labels,u(C));return a(d,t,n,r,l),f.extend(c.properties.update,z),f.extend(d.properties.update,j),f.extend(h.properties.update,F),c.properties.enter.x.value+=N,c.properties.enter.y.value+=N,h.properties.enter.x.offset+=N+1,d.properties.enter.x.offset=N+1,h.properties.update.x.offset+=N+1,d.properties.update.x.offset=N+1,f.extend(G,{type:"group",interactive:!1,properties:{enter:p(e,"group",O),vg_legendPosition:{encode:i,signals:[],scales:[],data:[],fields:[]}}}),G.marks=[c,d,h].map(function(t){return g(e,t)}),G}function _(e){var t=b(e),r=e.domain(),i=(null==A?e.ticks?e.ticks.apply(e,I):e.domain():A).map(n),a=U.width&&U.width.value||C.legend.gradientWidth,s=null==E?e.tickFormat?e.tickFormat.apply(e,I):String:E,o={name:"legend",type:e.type,round:!0,zero:!1,domain:[r[0],r[r.length-1]],range:[N,a+N]};"pow"===e.type&&(o.exponent=e.exponent());var u=(x?[x]:[]).map(n);return i.forEach(function(e,t){e.label=s(e.data),e.align=t==i.length-1?"right":0===t?"left":"center"}),t.scales=[o],t.marks[0].from=function(){return u},t.marks[1].from=function(){return[1]},t.marks[2].from=function(){return i},t}function b(t){var n=f.extend(R.titles,s(C)),r=f.extend(R.gradient,l(C)),a=f.extend(R.labels,c(C)),o=new h,u=t.domain(),d=u[0],m=u[u.length-1],v=t.copy().domain([d,m]).range([0,1]),y="linear"!==t.type&&t.ticks?t.ticks.call(t,15):u;d!==y[0]&&y.unshift(d),m!==y[y.length-1]&&y.push(m);for(var _=0,b=y.length;b>_;++_)o.stop(v(y[_]),t(y[_]));r.properties.enter.fill={value:o},f.extend(n.properties.update,z),f.extend(r.properties.update,U),f.extend(a.properties.update,F);var w=r.properties,k=U.height,S=k&&k.value||w.enter.height.value;if(a.properties.enter.y.value=S,a.properties.update.y.value=S,x){var M=n.properties,T=z.fontSize,A=4+(T&&T.value||M.enter.fontSize.value);r.properties.enter.y.value+=A,a.properties.enter.y.value+=A,r.properties.update.y.value+=A,a.properties.update.y.value+=A}return n.properties.enter.x.value+=N,n.properties.enter.y.value+=N,r.properties.enter.x.value+=N,r.properties.enter.y.value+=N,a.properties.enter.y.value+=N,r.properties.update.x.value+=N,r.properties.update.y.value+=N,a.properties.update.y.value+=N,f.extend(G,{type:"group",interactive:!1,properties:{enter:p(e,"group",O),vg_legendPosition:{encode:i,signals:[],scales:[],data:[],fields:[]}}}),G.marks=[n,r,a].map(function(t){return g(e,t)}),G}var x,w=null,k=null,S=null,M=null,T=null,A=null,E=null,L=null,C=e.config(),D="right",P=C.legend.offset,N=C.legend.padding,I=[5],O={},j={},U={},z={},F={},R={titles:{},symbols:{},labels:{},gradient:{}},q={},G={};return q.def=function(){var e=w||k||S||M;return E=L?"time"===e.type?f.format.time(L):f.format.number(L):null,G.type||(G=e!==S&&e!==M||r(e.type)?v(e):_(e)),G.orient=D,G.offset=P,G.padding=N,G},q.size=function(e){return arguments.length?(w!==e&&(w=e,t()),q):w},q.shape=function(e){return arguments.length?(k!==e&&(k=e,t()),q):k},q.fill=function(e){return arguments.length?(S!==e&&(S=e,t()),q):S},q.stroke=function(e){return arguments.length?(M!==e&&(M=e,t()),q):M},q.title=function(e){return arguments.length?(x!==e&&(x=e,t()),q):x},q.format=function(e){return arguments.length?(L!==e&&(L=e,t()),q):L},q.spacing=function(e){return arguments.length?(T!==+e&&(T=+e,t()),q):T},q.orient=function(e){return arguments.length?(D=e in m?e+"":C.legend.orient,q):D},q.offset=function(e){return arguments.length?(P=+e,q):P},q.values=function(e){return arguments.length?(A=e,q):A},q.legendProperties=function(e){return arguments.length?(O=e,q):O},q.symbolProperties=function(e){return arguments.length?(j=e,q):j},q.gradientProperties=function(e){return arguments.length?(U=e,q):U},q.labelProperties=function(e){return arguments.length?(F=e,q):F},q.titleProperties=function(e){return arguments.length?(z=e,q):z},q.reset=function(){return t(),q},q}function i(e,t,n,r,i,a){var s,o=n?{}:e,u=e.mark.def.offset,l=e.mark.def.orient,c=2*e.mark.def.padding,d=~~e.bounds.width()+(e.width?0:c),f=~~e.bounds.height()+(e.height?0:c),h=t._legendPositions||(t._legendPositions={right:.5,left:.5});switch(o.x=.5,o.width=d,o.y=h[l],h[l]+=o.height=f,!n&&t.bounds&&(t.bounds.delta=t.bounds.x2-t.width),l){case"left":s=t.bounds?t.bounds.x1:0,o.x+=s-u-d;break;case"right":s=t.width+(t.bounds&&n?t.bounds.delta:0),o.x+=s+u}n&&n.interpolate(e,o);var p=e.mark.def.properties.enter.encode;return p.call(p,e,t,n,r,i,a),!0}function a(e,t,n,r,i){var a=e.properties.enter,s=e.properties.update;t&&(a.size=s.size={scale:t.scaleName,field:"data"}),n&&(a.shape=s.shape={scale:n.scaleName,field:"data"}),r&&(a.fill=s.fill={scale:r.scaleName,field:"data"}),i&&(a.stroke=s.stroke={scale:i.scaleName,field:"data"})}function s(e){var t=e.legend;return{type:"text",interactive:!1,key:"data",properties:{enter:{x:{value:0},y:{value:0},fill:{value:t.titleColor},font:{value:t.titleFont},fontSize:{value:t.titleFontSize},fontWeight:{value:t.titleFontWeight},baseline:{value:"top"},text:{field:"data"},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1}}}}}function o(e){var t=e.legend;return{type:"symbol",interactive:!1,key:"data",properties:{enter:{x:{field:"offset",mult:.5},y:{scale:"legend",field:"index"},shape:{value:t.symbolShape},size:{value:t.symbolSize},stroke:{value:t.symbolColor},strokeWidth:{value:t.symbolStrokeWidth},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{x:{field:"offset",mult:.5},y:{scale:"legend",field:"index"},opacity:{value:1}}}}}function u(e){var t=e.legend;return{type:"text",interactive:!1,key:"data",properties:{enter:{x:{field:"offset",offset:5},y:{scale:"legend",field:"index"},fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},align:{value:t.labelAlign},baseline:{value:t.labelBaseline},text:{field:"label"},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1},x:{field:"offset",offset:5},y:{scale:"legend",field:"index"}}}}}function l(e){var t=e.legend;return{type:"rect",interactive:!1,properties:{enter:{x:{value:0},y:{value:0},width:{value:t.gradientWidth},height:{value:t.gradientHeight},stroke:{value:t.gradientStrokeColor},strokeWidth:{value:t.gradientStrokeWidth},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{x:{value:0},y:{value:0},opacity:{value:1}}}}}function c(e){var t=e.legend;return{type:"text",interactive:!1,key:"data",properties:{enter:{x:{scale:"legend",field:"data"},y:{value:20},dy:{value:2},fill:{value:t.labelColor},font:{value:t.labelFont},fontSize:{value:t.labelFontSize},align:{field:"align"},baseline:{value:"top"},text:{field:"label"},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{x:{scale:"legend",field:"data"},y:{value:20},opacity:{value:1}}}}}var d="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,f=e("datalib"),h=e("vega-scenegraph").Gradient,p=e("../parse/properties"),g=e("../parse/mark"),m={right:1,left:1};t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../parse/mark":97,"../parse/properties":102,datalib:24,"vega-scenegraph":46}],115:[function(e,t,n){t.exports=function r(e,t){var n,i,a,s,o;if(t(e))return!0;var u=["items","axisItems","legendItems"];for(a=0,s=u.length;s>a;++a)if(o=e[u[a]])for(n=0,i=o.length;i>n;++n)if(r(o[n],t))return!0}},{}],116:[function(e,t,n){function r(e){return d.prototype.init.call(this,e),d.addParameters(this,{groupby:{type:"array"},summarize:{type:"custom",set:function(e){function t(e){e.signal&&(l[e.signal]=1)}var n,r,i,s,o,u,l={},d=this._transform;if(!a.isArray(s=e)){s=[];for(o in e)u=a.array(e[o]),s.push({field:o,ops:u})}for(n=0,r=s.length;r>n;++n)i=s[n],i.field.signal&&(l[i.field.signal]=1),a.array(i.ops).forEach(t),a.array(i.as).forEach(t);return d._fields=s,d._aggr=null,d.dependency(c.SIGNALS,a.keys(l)),d}}}),this._aggr=null,this._input=null,this._args=null,this._fields=[],this._out=[],this._type=p.TUPLE,this._acc={groupby:a["true"],value:a["true"]},this.router(!0).produces(!0)}function i(e){var t,n,r,i,a,s,o,u=[];for(a=e._dims,t=0,n=a.length;n>t;++t)u.push(a[t].name);for(s=e._aggr,t=0,n=s.length;n>t;++t)for(o=s[t].measures.fields,r=0,i=o.length;i>r;++r)u.push(o[r]);return u}var a=e("datalib"),s=e("vega-dataflow"),o=e("vega-logging"),u=s.ChangeSet,l=s.Tuple,c=s.Dependencies,d=e("./Transform"),f=e("./Facetor"),h=r.prototype=Object.create(d.prototype);h.constructor=r;var p=r.TYPES={VALUE:1,TUPLE:2,MULTI:3};r.VALID_OPS=["values","count","valid","missing","distinct","sum","mean","average","variance","variancep","stdev","stdevp","median","q1","q3","modeskew","min","max","argmin","argmax"],h.type=function(e){return this._type=e,this},h.accessors=function(e,t){var n=this._acc;n.groupby=a.$(e)||a["true"],n.value=a.$(t)||a["true"]},h.aggr=function(){if(this._aggr)return this._aggr;var e=this._graph,t=!1,n=[],r=this.param("groupby").field,s=function(t){return t.signal?e.signalRef(t.signal):t},o=this._fields.map(function(e){var r={name:s(e.field),as:a.array(e.as),ops:a.array(s(e.ops)).map(s),get:e.get};return t=t||null!=r.get,n.push(r.name),r});r.forEach(function(e){e.get&&(t=!0),n.push(e.name||e)}),this._args=t||!o.length?null:n,o.length||(o={"*":"values"});var u=this._aggr=(new f).groupby(r).stream(!0).summarize(o);return this._out=i(u),this._type!==p.VALUE&&u.key("_id"),u},h.transform=function(e,t){o.debug(e,["aggregate"]),this._input=e;var n,r,i,a,s=u.create(e),c=this.aggr(),d=this._out,f=this._args,h=!0,g=l.prev;if(t&&(s.rem.push.apply(s.rem,c.result()),c.clear(),this._aggr=null,c=this.aggr()),this._type===p.TUPLE)n=function(e){c._add(e),l.prev_init(e)},r=function(e){c._rem(g(e))},i=function(e){c._mod(e,g(e))};else{var m=this._acc.groupby,v=this._acc.value,y=this._type===p.VALUE?v:function(e){return{_id:e._id,groupby:m(e),value:v(e)}};n=function(e){c._add(y(e)),l.prev_init(e)},r=function(e){c._rem(y(g(e)))},i=function(e){c._mod(y(e),y(g(e)))}}if(e.add.forEach(n),t)e.mod.forEach(n);else{if(e.rem.forEach(r),f)for(a=0,h=!1;a","default":[5,2]}}),this._output={bin:"bin"},this.mutates(!0)}var i=e("datalib").bins,a=e("vega-dataflow").Tuple,s=e("vega-logging"),o=e("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u.transform=function(e){function t(e){var t=l(e);t=null==t?null:d.start+d.step*~~((t-d.start)/d.step),a.set(e,n,t)}s.debug(e,["binning"]);var n=this._output.bin,r=this.param("step"),o=this.param("steps"),u=this.param("minstep"),l=this.param("field").accessor,c={min:this.param("min"),max:this.param("max"),base:this.param("base"),maxbins:this.param("maxbins"),div:this.param("div")};r&&(c.step=r),o&&(c.steps=o),u&&(c.minstep=u);var d=i(c);return e.add.forEach(t),e.mod.forEach(t),e.rem.forEach(t),e.fields[n]=1,e},t.exports=r},{"./Transform":135,datalib:24,"vega-dataflow":39,"vega-logging":45}],119:[function(e,t,n){function r(e){return o.prototype.init.call(this,e),o.addParameters(this,{field:{type:"field","default":"data"},pattern:{type:"value","default":"[\\w']+"},"case":{type:"value","default":"lower"},stopwords:{type:"value","default":""}}),this._output={text:"text",count:"count"},this.router(!0).produces(!0)}var i=e("vega-dataflow"),a=i.Tuple,s=e("vega-logging"),o=e("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u.transform=function(e,t){function n(e){return a.prev_init(e),i(e)}function r(e){return i(a.prev(e))}s.debug(e,["countpattern"]);var i=this.param("field").accessor,o=this.param("pattern"),u=this.param("stopwords"),l=!1;return this._stop!==u&&(this._stop=u,this._stop_re=new RegExp("^"+u+"$","i"),t=!0),this._pattern!==o&&(this._pattern=o,this._match=new RegExp(this._pattern,"g"),t=!0),t&&(this._counts={}),this._add(e.add,n),t||this._rem(e.rem,r),(t||(l=e.fields[i.field]))&&(l&&this._rem(e.mod,r),this._add(e.mod,n)),this._changeset(e)},u._changeset=function(e){var t,n,r,s=this._counts,o=this._tuples||(this._tuples={}),u=i.ChangeSet.create(e),l=this._output;for(t in s)n=o[t],r=s[t]||0,!n&&r?(o[t]=n=a.ingest({}),n[l.text]=t,n[l.count]=r,u.add.push(n)):0===r?(n&&u.rem.push(n),delete s[t],delete o[t]):n[l.count]!==r&&(a.set(n,l.count,r),u.mod.push(n));return u},u._tokenize=function(e){switch(this.param("case")){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(this._match)},u._add=function(e,t){var n,r,i,a,s=this._counts,o=this._stop_re;for(i=0;il;++l)o=n[l],u=t?s._id+"_"+o._id:o._id+"_"+s._id,this._ids[u]||(s._id!=o._id||r)&&(f[this._output.left]=t?s:o,f[this._output.right]=t?o:s,(!a||a(f))&&(e.add.push(f=d.ingest(f)),i.call(this,s,f),i.call(this,o,f),this._ids[u]=1,f={}))}function s(e,t,n){var r=this,i=this._cache[n._id];this._lastRem>i.s&&(i.c=i.c.filter(function(e){var n=e[r._output[t?"right":"left"]];return null!==r._cache[n._id]}),i.s=this._lastRem),e.mod.push.apply(e.mod,i.c)}function o(e,t){e.rem.push.apply(e.rem,this._cache[t._id].c),this._cache[t._id]=null,this._lastRem=this._stamp}function u(e,t){(e.add.length||e.rem.length)&&(t.fields[this._output.left]=1,t.fields[this._output.right]=1)}var l=e("vega-dataflow"),c=l.ChangeSet,d=l.Tuple,f=l.Dependencies.SIGNALS,h=e("vega-logging"),p=e("./Transform"),g=e("./BatchTransform"),m=r.prototype=Object.create(g.prototype);m.constructor=r,m.batchTransform=function(e,t){h.debug(e,["crossing"]);var n=this.param("with"),r=this.param("filter"),i=this.param("diagonal"),l=this._graph,d=l.values(f,this.dependency(f)),p=r?function(e){return r(e,null,d)}:null,g=!n.name,m=g?e:n.source.last(),v=g?t:n.source.values(),y=c.create(e),_=o.bind(this,y);return e.rem.forEach(_),e.add.forEach(a.bind(this,y,!0,v,i,p)),!g&&m.stamp>this._lastWith&&(m.rem.forEach(_),m.add.forEach(a.bind(this,y,!1,t,i,p)),m.mod.forEach(s.bind(this,y,!1)),u.call(this,m,y),this._lastWith=m.stamp),e.mod.forEach(s.bind(this,y,!0)),u.call(this,e,y),y},t.exports=r},{"./BatchTransform":117,"./Transform":135,"vega-dataflow":39,"vega-logging":45}],121:[function(e,t,n){function r(t){return i.addParameters(this,{transform:{type:"custom",set:function(e){return this._transform._pipeline=e,this._transform},get:function(){var t=e("../parse/transforms"),n=this._transform;return n._pipeline.map(function(e){return t(n._graph,e)})}}}),this._pipeline=[],a.call(this,t)}var i=e("./Transform"),a=e("./Aggregate"),s=r.prototype=Object.create(a.prototype);s.constructor=r,s.aggr=function(){return a.prototype.aggr.call(this).facet(this)},t.exports=r},{"../parse/transforms":106,"./Aggregate":116,"./Transform":135}],122:[function(e,t,n){function r(){s.call(this),this._facet=null,this._facetID=++d}function i(e){c.debug({},["disconnecting cell",this.tuple._id]);var t=this.ds.pipeline();e.removeListener(t[0]),e._graph.removeListener(t[0]),e._graph.disconnect(t)}var a=e("datalib"),s=a.Aggregator,o=s.prototype,u=e("vega-dataflow"),l=u.Tuple,c=e("vega-logging"),d=0,f=r.prototype=Object.create(o);f.constructor=r,f.facet=function(e){return arguments.length?(this._facet=e,this):this._facet},f._ingest=function(e){return l.ingest(e,null)},f._assign=l.set,f._newcell=function(e,t){var n=o._newcell.call(this,e,t),r=this._facet;if(r){var a=r._graph,s=n.tuple,u=r.param("transform");n.ds=a.data(s._facetID,u,s),n.disconnect=i,r.addListener(u[0])}return n},f._newtuple=function(e,t){var n=o._newtuple.call(this,e);return this._facet&&(l.set(n,"key",t),l.set(n,"_facetID",this._facetID+"_"+t)),n},f.clear=function(){if(this._facet)for(var e in this._cells)this._cells[e].disconnect(this._facet);return o.clear.call(this)},f._on_add=function(e,t){this._facet&&t.ds._input.add.push(e)},f._on_rem=function(e,t){this._facet&&t.ds._input.rem.push(e)},f._on_mod=function(e,t,n,r){this._facet&&(n===r?n.ds._input.mod.push(e):(n.ds._input.rem.push(e),r.ds._input.add.push(e)))},f._on_drop=function(e){this._facet&&e.disconnect(this._facet)},f._on_keep=function(e){this._facet&&u.ChangeSet.copy(this._input,e.ds._input)},t.exports=r},{datalib:24,"vega-dataflow":39,"vega-logging":45}],123:[function(e,t,n){function r(e){return o.prototype.init.call(this,e),o.addParameters(this,{test:{type:"expr"}}),this._skip={},this.router(!0)}var i=e("vega-dataflow"),a=i.Dependencies.SIGNALS,s=e("vega-logging"),o=e("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u.transform=function(e){s.debug(e,["filtering"]);var t=i.ChangeSet.create(e),n=this._graph,r=this._skip,o=this.param("test"),u=n.values(a,this.dependency(a));return e.rem.forEach(function(e){1!==r[e._id]?t.rem.push(e):r[e._id]=0}),e.add.forEach(function(e){o(e,null,u)?t.add.push(e):r[e._id]=1}),e.mod.forEach(function(e){var n=o(e,null,u),i=1===r[e._id];n&&i?(r[e._id]=0,t.add.push(e)):n&&!i?t.mod.push(e):!n&&i||(t.rem.push(e),r[e._id]=1)}),t},t.exports=r},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],124:[function(e,t,n){function r(e){return o.prototype.init.call(this,e),o.addParameters(this,{fields:{type:"array"}}),this._output={key:"key",value:"value"},this._cache={},this.router(!0).produces(!0)}var i=e("vega-dataflow"),a=i.Tuple,s=e("vega-logging"),o=e("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u._reset=function(e,t){for(var n in this._cache)t.rem.push.apply(t.rem,this._cache[n]);this._cache={}},u._tuple=function(e,t,n){var r=this._cache[e._id]||(this._cache[e._id]=Array(n));return r[t]?a.rederive(e,r[t]):r[t]=a.derive(e)},u._fn=function(e,t,n){var r,i,s,o,u,l;for(r=0,s=e.length;s>r;++r)for(u=e[r],i=0,o=t.field.length;o>i;++i)l=this._tuple(u,i,o),a.set(l,this._output.key,t.field[i]),a.set(l,this._output.value,t.accessor[i](u)),n.push(l)},u.transform=function(e,t){s.debug(e,["folding"]);var n=this,r=this.param("fields"),a=i.ChangeSet.create(e);return t&&this._reset(e,a),this._fn(e.add,r,a.add),this._fn(e.mod,r,t?a.add:a.mod),e.rem.forEach(function(e){a.rem.push.apply(a.rem,n._cache[e._id]),n._cache[e._id]=null}),(e.add.length||e.rem.length||r.field.some(function(t){return!!e.fields[t]}))&&(a.fields[this._output.key]=1,a.fields[this._output.value]=1),a},t.exports=r},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],125:[function(e,t,n){(function(n){function r(e){return l.prototype.init.call(this,e),this._prev=null,this._interactive=!1,this._setup=!0,this._nodes=[],this._links=[],this._layout=i.layout.force(),l.addParameters(this,{size:{type:"array","default":[500,500]},bound:{type:"value","default":!0},links:{type:"data"},linkStrength:{type:"value","default":1},linkDistance:{type:"value","default":20},charge:{type:"value","default":-30},chargeDistance:{type:"value","default":1/0},friction:{type:"value","default":.9},theta:{type:"value","default":.8},gravity:{type:"value","default":.1},alpha:{type:"value","default":.1},iterations:{type:"value","default":500},interactive:{type:"value","default":this._interactive},active:{type:"value","default":this._prev},fixed:{type:"data"}}),this._output={x:"layout_x",y:"layout_y"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=e("vega-dataflow"),s=a.Tuple,o=a.ChangeSet,u=e("vega-logging"),l=e("./Transform"),c=r.prototype=Object.create(l.prototype);c.constructor=r,c.transform=function(e,t){u.debug(e,["force"]),t-=e.signals.active?1:0;var n=this.param("interactive"),r=this.param("links").source,i=r.last(),a=this.param("active"),o=this._output,l=this._layout,c=this._nodes,d=this._links;if(i.stamph;++h)l.tick();l.stop()}return this.update(a),(t||a!==this._prev&&a&&a.update)&&l.alpha(this.param("alpha")),a!==this._prev&&(this._prev=a),e.rem.length&&l.nodes(this._nodes=s.idFilter(c,e.rem)),i&&i.rem.length&&l.links(this._links=s.idFilter(d,i.rem)),e.fields[o.x]=1,e.fields[o.y]=1,e},c.configure=function(e,t,n,r){var i=this._layout,a=this._setup||e.add.length||t&&t.add.length||n!==this._interactive||this.param("charge")!==i.charge()||this.param("linkStrength")!==i.linkStrength()||this.param("linkDistance")!==i.linkDistance();if((a||r)&&i.size(this.param("size")).chargeDistance(this.param("chargeDistance")).theta(this.param("theta")).gravity(this.param("gravity")).friction(this.param("friction")),a){this._setup=!1,this._interactive=n;var s,u,l=this,c=this._graph,d=this._nodes,f=this._links;for(s=e.add,u=0;un;++n)h[c[n].id]=1;for(n=0;n"},translate:{type:"array"},rotate:{type:"array"},scale:{type:"value"},precision:{type:"value"},clipAngle:{type:"value"},clipExtent:{type:"value"}},r.d3Projection=function(){var e,t,n,s=this.param("projection"),o=r.Parameters;s!==this._mode&&(this._mode=s,this._projection=i.geo[s]()),e=this._projection;for(t in o)"projection"!==t&&e[t]&&(n=this.param(t),void 0===n||a.isArray(n)&&0===n.length||n!==e[t]()&&e[t](n));return e};var l=r.prototype=Object.create(u.prototype);l.constructor=r,l.transform=function(e){function t(e){var t=[i(e),a(e)],r=u(t)||[null,null];s.set(e,n.x,r[0]),s.set(e,n.y,r[1])}o.debug(e,["geo"]);var n=this._output,i=this.param("lon").accessor,a=this.param("lat").accessor,u=r.d3Projection.call(this);return e.add.forEach(t),this.reevaluate(e)&&(e.mod.forEach(t),e.rem.forEach(t)),e.fields[n.x]=1,e.fields[n.y]=1,e},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Transform":135,datalib:24,"vega-dataflow":39,"vega-logging":45}],128:[function(e,t,n){(function(n){function r(e){return l.prototype.init.call(this,e),l.addParameters(this,u.Parameters),l.addParameters(this,{field:{type:"field","default":null}}),this._output={path:"layout_path"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=e("datalib"),s=e("vega-dataflow").Tuple,o=e("vega-logging"),u=e("./Geo"),l=e("./Transform"),c=r.prototype=Object.create(l.prototype);c.constructor=r,c.transform=function(e){function t(e){s.set(e,n.path,c(r(e)))}o.debug(e,["geopath"]);var n=this._output,r=this.param("field").accessor||a.identity,l=u.d3Projection.call(this),c=i.geo.path().projection(l);return e.add.forEach(t),this.reevaluate(e)&&(e.mod.forEach(t),e.rem.forEach(t)),e.fields[n.path]=1,e},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Geo":127,"./Transform":135,datalib:24,"vega-dataflow":39,"vega-logging":45}],129:[function(e,t,n){function r(e){return c.prototype.init.call(this,e),c.addParameters(this,{sourceX:{type:"field","default":"_source.layout_x"},sourceY:{type:"field","default":"_source.layout_y"},targetX:{type:"field","default":"_target.layout_x"},targetY:{type:"field","default":"_target.layout_y"},tension:{type:"value","default":.2},shape:{type:"value","default":"line"}}),this._output={path:"layout_path"},this.mutates(!0)}function i(e,t,n,r){return"M"+e+","+t+"L"+n+","+r}function a(e,t,n,r,i){var a=n-e,s=r-t,o=i*(a+s),u=i*(s-a);return"M"+e+","+t+"C"+(e+o)+","+(t+u)+" "+(n+u)+","+(r-o)+" "+n+","+r}function s(e,t,n,r){var i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r}function o(e,t,n,r){var i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r}var u=e("vega-dataflow").Tuple,l=e("vega-logging"),c=e("./Transform"),d=r.prototype=Object.create(c.prototype);d.constructor=r;var f={line:i,curve:a,diagonal:s,diagonalX:s,diagonalY:o};d.transform=function(e){function t(e){var t=r(i(e),a(e),s(e),o(e),c);u.set(e,n.path,t)}l.debug(e,["linkpath"]);var n=this._output,r=f[this.param("shape")]||f.line,i=this.param("sourceX").accessor,a=this.param("sourceY").accessor,s=this.param("targetX").accessor,o=this.param("targetY").accessor,c=this.param("tension");return e.add.forEach(t), -this.reevaluate(e)&&(e.mod.forEach(t),e.rem.forEach(t)),e.fields[n.path]=1,e},t.exports=r},{"./Transform":135,"vega-dataflow":39,"vega-logging":45}],130:[function(e,t,n){function r(e){return s.prototype.init.call(this,e),s.addParameters(this,{on:{type:"data"},onKey:{type:"field","default":null},as:{type:"array"},keys:{type:"array","default":["data"]},"default":{type:"value"}}),this.mutates(!0)}var i=e("vega-dataflow").Tuple,a=e("vega-logging"),s=e("./Transform"),o=r.prototype=Object.create(s.prototype);o.constructor=r,o.transform=function(e,t){function n(e){for(var t=0;t"}}),this.router(!0)}var i=e("datalib"),a=e("vega-logging"),s=e("./Transform"),o=r.prototype=Object.create(s.prototype);o.constructor=r,o.transform=function(e){return a.debug(e,["sorting"]),(e.add.length||e.mod.length||e.rem.length)&&(e.sort=i.comparator(this.param("by").field)),e},t.exports=r},{"./Transform":135,datalib:24,"vega-logging":45}],134:[function(e,t,n){function r(e){return l.prototype.init.call(this,e),u.addParameters(this,{groupby:{type:"array"},sortby:{type:"array"},field:{type:"field"},offset:{type:"value","default":"zero"}}),this._output={start:"layout_start",end:"layout_end",mid:"layout_mid"},this.mutates(!0)}function i(e,t,n,r){var i,a,s,o,u,l,c,d=[],f=function(e){return e(s)};if(null==t)d.push(e.slice());else for(i={},a=0;ac&&(c=l),null!=n&&u.sort(n)}return d.max=c,d}var a=e("datalib"),s=e("vega-dataflow").Tuple,o=e("vega-logging"),u=e("./Transform"),l=e("./BatchTransform"),c=r.prototype=Object.create(l.prototype);c.constructor=r,c.batchTransform=function(e,t){o.debug(e,["stacking"]);for(var n=this.param("groupby").accessor,r=a.comparator(this.param("sortby").field),u=this.param("field").accessor,l=this.param("offset"),c=this._output,d=i(t,n,r,u),f=0,h=d.max;f","default":["-value"]},children:{type:"field","default":"children"},field:{type:"field","default":"value"},size:{type:"array","default":[500,500]},round:{type:"value","default":!0},sticky:{type:"value","default":!1},ratio:{type:"value","default":c},padding:{type:"value","default":null},mode:{type:"value","default":"squarify"}}),this._layout=i.layout.treemap(),this._output={x:"layout_x",y:"layout_y",width:"layout_width",height:"layout_height",depth:"layout_depth"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=e("datalib"),s=e("vega-dataflow").Tuple,o=e("vega-logging"),u=e("./Transform"),l=e("./BatchTransform"),c=.5*(1+Math.sqrt(5)),d=r.prototype=Object.create(l.prototype);d.constructor=r,d.batchTransform=function(e,t){o.debug(e,["treemap"]);var n=this._layout,r=this._output;return n.sort(a.comparator(this.param("sort").field)).children(this.param("children").accessor).value(this.param("field").accessor).size(this.param("size")).round(this.param("round")).sticky(this.param("sticky")).ratio(this.param("ratio")).padding(this.param("padding")).mode(this.param("mode")).nodes(t[0]),t.forEach(function(e){s.set(e,r.x,e.x),s.set(e,r.y,e.y),s.set(e,r.width,e.dx),s.set(e,r.height,e.dy),s.set(e,r.depth,e.depth)}),e.fields[r.x]=1,e.fields[r.y]=1,e.fields[r.width]=1,e.fields[r.height]=1,e},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./BatchTransform":117,"./Transform":135,datalib:24,"vega-dataflow":39,"vega-logging":45}],137:[function(e,t,n){(function(n){function r(e){return u.prototype.init.call(this,e),o.addParameters(this,{clipExtent:{type:"array","default":[[-1e5,-1e5],[1e5,1e5]]},x:{type:"field","default":"layout_x"},y:{type:"field","default":"layout_y"}}),this._layout=i.geom.voronoi(),this._output={path:"layout_path"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=e("vega-dataflow/src/Tuple"),s=e("vega-logging"),o=e("./Transform"),u=e("./BatchTransform"),l=r.prototype=Object.create(u.prototype);l.constructor=r,l.batchTransform=function(e,t){s.debug(e,["voronoi"]);for(var n=this._output.path,r=this._layout.clipExtent(this.param("clipExtent")).x(this.param("x").accessor).y(this.param("y").accessor)(t),i=0;i","default":[900,500]},text:{type:"field","default":"data"},rotate:{type:"field|value","default":0},font:{type:"field|value","default":{value:"sans-serif"}},fontSize:{type:"field|value","default":14},fontStyle:{type:"field|value","default":{value:"normal"}},fontWeight:{type:"field|value","default":{value:"normal"}},fontScale:{type:"array","default":[10,50]},padding:{type:"value","default":1},spiral:{type:"value","default":"archimedean"}}),this._layout=u(),this._output={x:"layout_x",y:"layout_y",font:"layout_font",fontSize:"layout_fontSize",fontStyle:"layout_fontStyle",fontWeight:"layout_fontWeight",rotate:"layout_rotate"},this.mutates(!0)}function i(e){return e&&e.accessor||e}function a(e){var t=Object.create(e);return t._tuple=e,t}var s=e("datalib"),o="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,u="undefined"!=typeof window?window.d3.layout.cloud:"undefined"!=typeof n?n.d3.layout.cloud:null,l=e("vega-dataflow/src/Tuple"),c=e("vega-logging"),d=e("./Transform"),f=e("./BatchTransform"),h=r.prototype=Object.create(f.prototype);h.constructor=r,h.batchTransform=function(e,t){c.debug(e,["wordcloud"]);var n,r,u=this._layout,d=this._output,f=this.param("fontSize"),h=f.accessor&&this.param("fontScale");f=f.accessor||o.functor(f),h.length&&(r=o.scale.sqrt().domain(s.extent(t,n=f)).range(h),f=function(e){return r(n(e))}),u.size(this.param("size")).text(i(this.param("text"))).padding(this.param("padding")).spiral(this.param("spiral")).rotate(i(this.param("rotate"))).font(i(this.param("font"))).fontStyle(i(this.param("fontStyle"))).fontWeight(i(this.param("fontWeight"))).fontSize(f).words(t.map(a)).on("end",function(e){var t,n,r,i,a=u.size(),s=a[0]>>1,o=a[1]>>1;for(r=0,i=e.length;i>r;++r)t=e[r],n=t._tuple,l.set(n,d.x,t.x+s),l.set(n,d.y,t.y+o),l.set(n,d.font,t.font),l.set(n,d.fontSize,t.size),l.set(n,d.fontStyle,t.style),l.set(n,d.fontWeight,t.weight),l.set(n,d.rotate,t.rotate)}).start();for(var p in d)e.fields[d[p]]=1;return e},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./BatchTransform":117,"./Transform":135,datalib:24,"vega-dataflow/src/Tuple":38,"vega-logging":45}],139:[function(e,t,n){t.exports={aggregate:e("./Aggregate"),bin:e("./Bin"),cross:e("./Cross"),countpattern:e("./CountPattern"),linkpath:e("./LinkPath"),facet:e("./Facet"),filter:e("./Filter"),fold:e("./Fold"),force:e("./Force"),formula:e("./Formula"),geo:e("./Geo"),geopath:e("./GeoPath"),lookup:e("./Lookup"),pie:e("./Pie"),sort:e("./Sort"),stack:e("./Stack"),treemap:e("./Treemap"),voronoi:e("./Voronoi"),wordcloud:e("./Wordcloud")}},{"./Aggregate":116,"./Bin":118,"./CountPattern":119,"./Cross":120,"./Facet":121,"./Filter":123,"./Fold":124,"./Force":125,"./Formula":126,"./Geo":127,"./GeoPath":128,"./LinkPath":129,"./Lookup":130,"./Pie":132,"./Sort":133,"./Stack":134,"./Treemap":136,"./Voronoi":137,"./Wordcloud":138}]},{},[1])(1)}); +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.vg=t()}}(function(){var t;return function e(t,n,r){function i(s,o){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};t[s][0].call(c.exports,function(e){var n=t[s][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s>5<<5,d=~~Math.max(Math.abs(g+m),Math.abs(g-m))}else c=c+31>>5<<5;if(d>u&&(u=d),s+c>=x<<5&&(s=0,o+=u,u=0),o+d>=b)break;i.translate((s+(c>>1))/a,(o+(d>>1))/a),e.rotate&&i.rotate(e.rotate*_),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=c,e.height=d,e.xoff=s,e.yoff=o,e.x1=c>>1,e.y1=d>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,s+=c}for(var y=i.getImageData(0,0,(x<<5)/a,b/a).data,w=[];--r>=0;)if(e=n[r],e.hasText){for(var c=e.width,k=c>>5,d=e.y1-e.y0,S=0;d*k>S;S++)w[S]=0;if(s=e.xoff,null==s)return;o=e.yoff;for(var M=0,T=-1,A=0;d>A;A++){for(var S=0;c>S;S++){var E=k*A+(S>>5),L=y[(o+A)*(x<<5)+(s+S)<<2]?1<<31-S%32:0;w[E]|=L,M|=L}M?T=A:(e.y0++,d--,A--,o++)}e.y1=e.y0+T,e.sprite=w.slice(0,(e.y1-e.y0)*k)}}}function c(t,e,n){n>>=5;for(var r,i=t.sprite,a=t.width>>5,s=t.x-(a<<4),o=127&s,u=32-o,l=t.y1-t.y0,c=(t.y+t.y0)*n+(s>>5),d=0;l>d;d++){r=0;for(var f=0;a>=f;f++)if((r<f?(r=i[d*a+f])>>>o:0))&e[c+f])return!0;c+=n}return!1}function d(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 f(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t?-1:1;switch(Math.sqrt(1+4*a*t)-a&3){case 0:r+=n;break;case 1:i+=e;break;case 2:r-=n;break;default:i-=e}return[r,i]}}function g(t){for(var e=[],n=-1;++n>2);t.width=(x<<5)/e,t.height=b/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}function e(t,e,r){for(var i,a,s,o=([{x:0,y:0},{x:n[0],y:n[1]}],e.x),u=e.y,l=Math.sqrt(n[0]*n[0]+n[1]*n[1]),d=E(n),h=I()<.5?1:-1,p=-h;(i=d(p+=h))&&(a=~~i[0],s=~~i[1],!(Math.min(Math.abs(a),Math.abs(s))>=l));)if(e.x=o+a,e.y=u+s,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1])&&(!r||!c(e,t,n[0]))&&(!r||f(e,r))){for(var g,m=e.sprite,v=e.width>>5,y=n[0]>>5,_=e.x-(v<<4),x=127&_,b=32-x,w=e.y1-e.y0,k=(e.y+e.y0)*y+(_>>5),S=0;w>S;S++){g=0;for(var M=0;v>=M;M++)t[k+M]|=g<M?(g=m[S*v+M])>>>x:0);k+=y}return delete e.sprite,!0}return!1}var n=[256,256],p=r,_=i,k=s,S=a,M=a,T=o,A=u,E=h,L=[],C=1/0,D=y("word","end"),P=null,I=Math.random,N={},O=m;return N.canvas=function(t){return arguments.length?(O=v(t),N):O},N.start=function(){function r(){for(var t=Date.now();Date.now()-t>1,r.y=n[1]*(I()+.5)>>1,l(i,r,f,u),r.hasText&&e(a,r,s)&&(c.push(r),D.word(r),s?d(s,r):s=[{x:r.x+r.x0,y:r.y+r.y0},{x:r.x+r.x1,y:r.y+r.y1}],r.x-=n[0]>>1,r.y-=n[1]>>1)}u>=o&&(N.stop(),D.end(c,s))}var i=t(O()),a=g((n[0]>>5)*n[1]),s=null,o=L.length,u=-1,c=[],f=L.map(function(t,e){return t.text=p.call(this,t,e),t.font=_.call(this,t,e),t.style=S.call(this,t,e),t.weight=M.call(this,t,e),t.rotate=T.call(this,t,e),t.size=~~k.call(this,t,e),t.padding=A.call(this,t,e),t}).sort(function(t,e){return e.size-t.size});return P&&clearInterval(P),P=setInterval(r,0),r(),N},N.stop=function(){return P&&(clearInterval(P),P=null),N},N.timeInterval=function(t){return arguments.length?(C=null==t?1/0:t,N):C},N.words=function(t){return arguments.length?(L=t,N):L},N.size=function(t){return arguments.length?(n=[+t[0],+t[1]],N):n},N.font=function(t){return arguments.length?(_=v(t),N):_},N.fontStyle=function(t){return arguments.length?(S=v(t),N):S},N.fontWeight=function(t){return arguments.length?(M=v(t),N):M},N.rotate=function(t){return arguments.length?(T=v(t),N):T},N.text=function(t){return arguments.length?(p=v(t),N):p},N.spiral=function(t){return arguments.length?(E=w[t]||t,N):E},N.fontSize=function(t){return arguments.length?(k=v(t),N):k},N.padding=function(t){return arguments.length?(A=v(t),N):A},N.random=function(t){return arguments.length?(I=t,N):I},N.on=function(){var t=D.on.apply(D,arguments);return t===D?N:t},N};var w={archimedean:h,rectangular:p}},{"d3-dispatch":4}],4:[function(e,n,r){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof t&&t.amd?t(["exports"],i):i(e.dispatch={})}(this,function(t){"use strict";function e(t){function e(t){var e=(t+="").indexOf("."),n=t;if(e>=0?t=t.slice(0,e):n+=".",t&&!s.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}function n(t){return function(){for(var e,n,r=s[t],i=-1,a=r.length;++i=l)return s;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var n=e;n++c;){var r=t.charCodeAt(c++),o=1;if(10===r)i=!0;else if(13===r)i=!0,10===t.charCodeAt(c)&&(++c,++o);else if(r!==u)continue;return t.slice(e,c-o)}return t.slice(e)}for(var r,i,a={},s={},o=[],l=t.length,c=0,d=0;(r=n())!==s;){for(var f=[];r!==a&&r!==s;)f.push(r),r=n();e&&null==(f=e(f,d++))||o.push(f)}return o}function r(e){if(Array.isArray(e[0]))return i(e);var n=Object.create(null),r=[];return e.forEach(function(t){for(var e in t)(e+="")in n||r.push(n[e]=e)}),[r.map(s).join(t)].concat(e.map(function(e){return r.map(function(t){return s(e[t])}).join(t)})).join("\n")}function i(t){return t.map(a).join("\n")}function a(e){return e.map(s).join(t)}function s(t){return o.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var o=new RegExp('["'+t+"\n]"),u=t.charCodeAt(0);return{parse:e,parseRows:n,format:r,formatRows:i}};t.csv=e(","),t.tsv=e(" "),t.dsv=e})},{}],6:[function(e,n,r){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof t&&t.amd?t(["exports"],i):i(e.format={})}(this,function(t){"use strict";function e(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 n(t){return t=e(Math.abs(t)),t?t[1]:NaN}function r(t,n){var r=e(t,n);if(!r)return t+"";var i=r[0],a=r[1],s=a-(g=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+e(t,n+s-1)[0]}function i(t,n){var r=e(t,n);if(!r)return t+"";var i=r[0],a=r[1];return 0>a?"0."+new Array(-a).join("0")+i:i.length>a+1?i.slice(0,a+1)+"."+i.slice(a+1):i+new Array(a-i.length+2).join("0")}function a(t,e){t=t.toPrecision(e);t:for(var n,r=t.length,i=1,a=-1;r>i;++i)switch(t[i]){case".":a=n=i;break;case"0":0===a&&(a=i),n=i;break;case"e":break t;default:a>0&&(a=0)}return a>0?t.slice(0,a)+t.slice(n+1):t}function s(t){return new o(t)}function o(t){if(!(e=O.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",r=e[2]||">",i=e[3]||"-",a=e[4]||"",s=!!e[5],o=e[6]&&+e[6],u=!!e[7],l=e[8]&&+e[8].slice(1),c=e[9]||"";"n"===c?(u=!0,c="g"):N[c]||(c=""),(s||"0"===n&&"="===r)&&(s=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=i,this.symbol=a,this.zero=s,this.width=o,this.comma=u,this.precision=l,this.type=c}function u(t,e){return function(n,r){for(var i=n.length,a=[],s=0,o=t[0],u=0;i>0&&o>0&&(u+o+1>r&&(o=Math.max(1,r-u)),a.push(n.substring(i-=o,i+o)),!((u+=o+1)>r));)o=t[s=(s+1)%t.length];return a.reverse().join(e)}}function l(t){return t}function c(t){function e(t){t=s(t);var e=t.fill,n=t.align,r=t.sign,u=t.symbol,l=t.zero,c=t.width,d=t.comma,f=t.precision,h=t.type,p="$"===u?a[0]:"#"===u&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",m="$"===u?a[1]:/[%p]/.test(h)?"%":"",v=N[h],y=!h||/[defgprs%]/.test(h);return f=null==f?h?6:12:/[gprs]/.test(h)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),function(t){var a=p,s=m;if("c"===h)s=v(t)+s,t="";else{t=+t;var u=(0>t||0>1/t)&&(t*=-1,!0);if(t=v(t,f),a=(u?"("===r?r:"-":"-"===r||"("===r?"":r)+a,s=s+("s"===h?z[8+g/3]:"")+(u&&"("===r?")":""),y)for(var _,x=-1,b=t.length;++x_||_>57){s=(46===_?o+t.slice(x+1):t.slice(x))+s,t=t.slice(0,x);break}}d&&!l&&(t=i(t,1/0));var w=a.length+t.length+s.length,k=c>w?new Array(c-w+1).join(e):"";switch(d&&l&&(t=i(k+t,k.length?c-s.length:1/0),k=""),n){case"<":return a+t+s+k;case"=":return a+k+t+s;case"^":return k.slice(0,w=k.length>>1)+a+t+s+k.slice(w)}return k+a+t+s}}function r(t,r){var i=e((t=s(t),t.type="f",t)),a=3*Math.max(-8,Math.min(8,Math.floor(n(r)/3))),o=Math.pow(10,-a),u=z[8+a/3];return function(t){return i(o*t)+u}}var i=t.grouping&&t.thousands?u(t.grouping,t.thousands):l,a=t.currency,o=t.decimal;return{format:e,formatPrefix:r}}function d(t,e){return Math.max(0,n(Math.abs(e))-n(Math.abs(t)))+1}function f(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(e)/3)))-n(Math.abs(t)))}function h(t){return Math.max(0,-n(Math.abs(t)))}function p(t){if("string"==typeof t){if(!U.hasOwnProperty(t))return null;t=U[t]}return c(t)}var g,m={decimal:".",thousands:",",grouping:[3],currency:["¥",""]},v={decimal:",",thousands:" ",grouping:[3],currency:[""," руб."]},y={decimal:",",thousands:".",grouping:[3],currency:["R$",""]},_={decimal:",",thousands:".",grouping:[3],currency:["","zł"]},x={decimal:",",thousands:".",grouping:[3],currency:["€ ",""]},b={decimal:",",thousands:".",grouping:[3],currency:[""," ден."]},w={decimal:".",thousands:",",grouping:[3],currency:["","円"]},k={decimal:",",thousands:".",grouping:[3],currency:["€",""]},S={decimal:".",thousands:",",grouping:[3],currency:["₪",""]},M={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},T={decimal:",",thousands:" ",grouping:[3],currency:["","$"]},A={decimal:",",thousands:" ",grouping:[3],currency:[""," €"]},E={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},L={decimal:".",thousands:",",grouping:[3],currency:["$",""]},C={decimal:".",thousands:",",grouping:[3],currency:["£",""]},D={decimal:".",thousands:",",grouping:[3],currency:["$",""]},P={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},I={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},N={"":a,"%":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 i(100*t,e)},r:i,s:r,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},O=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;o.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var z=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],U={"ca-ES":I,"de-DE":P,"en-CA":D,"en-GB":C,"en-US":L,"es-ES":E,"fi-FI":A,"fr-CA":T,"fr-FR":M,"he-IL":S,"it-IT":k,"ja-JP":w,"mk-MK":b,"nl-NL":x,"pl-PL":_,"pt-BR":y,"ru-RU":v,"zh-CN":m},j=c(L);t.format=j.format,t.formatPrefix=j.formatPrefix,t.localeFormat=p,t.formatSpecifier=s,t.precisionFixed=h,t.precisionPrefix=f,t.precisionRound=d})},{}],7:[function(e,n,r){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof t&&t.amd?t(["exports"],i):i(e.timeFormat={})}(this,function(t){"use strict";function e(t,n,r){function i(e){return t(e=new Date(+e)),e}return i.floor=i,i.round=function(e){var r=new Date(+e),i=new Date(e-1);return t(r),t(i),n(i,1),i-e>e-r?r:i},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,i){var a=[];if(e=new Date(e-1),r=new Date(+r),i=null==i?1:Math.floor(i),!(r>e&&i>0))return a;for(n(e,1),t(e),r>e&&a.push(new Date(+e));n(e,i),t(e),r>e;)a.push(new Date(+e));return a},i.filter=function(r){return e(function(e){for(;t(e),!r(e);)e.setTime(e-1)},function(t,e){for(;--e>=0;)for(;n(t,1),!r(t););})},r&&(i.count=function(e,n){return bt.setTime(+e),wt.setTime(+n),t(bt),t(wt),Math.floor(r(bt,wt))}),i}function n(t){return e(function(e){e.setHours(0,0,0,0),e.setDate(e.getDate()-(e.getDay()+7-t)%7)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}function r(t){return e(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/6048e5})}function i(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function a(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function s(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function o(t){function e(t,e){return function(n){for(var r,i,a,s=[],o=-1,u=0,l=t.length;++os;){if(r>=u)return-1;if(i=e.charCodeAt(s++),37===i){if(i=e.charAt(s++),a=zt[i in Dt?e.charAt(s++):i],!a||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function o(t,e,n){var r=At.exec(e.slice(n));return r?(t.w=Et[r[0].toLowerCase()],n+r[0].length):-1}function u(t,e,n){var r=Mt.exec(e.slice(n));return r?(t.w=Tt[r[0].toLowerCase()],n+r[0].length):-1}function l(t,e,n){var r=Pt.exec(e.slice(n));return r?(t.m=It[r[0].toLowerCase()],n+r[0].length):-1}function et(t,e,n){var r=Lt.exec(e.slice(n));return r?(t.m=Ct[r[0].toLowerCase()],n+r[0].length):-1}function nt(t,e,n){return r(t,mt,e,n)}function rt(t,e,n){return r(t,vt,e,n)}function it(t,e,n){return r(t,yt,e,n)}function at(t,e,n){var r=St[e.slice(n,n+=2).toLowerCase()];return null==r?-1:(t.p=r,n)}function st(t){return bt[t.getDay()]}function ot(t){return xt[t.getDay()]}function ut(t){return kt[t.getMonth()]}function lt(t){return wt[t.getMonth()]}function ct(t){return _t[+(t.getHours()>=12)]}function dt(t){return bt[t.getUTCDay()]}function ft(t){return xt[t.getUTCDay()]}function ht(t){return kt[t.getUTCMonth()]}function pt(t){return wt[t.getUTCMonth()]}function gt(t){return _t[+(t.getUTCHours()>=12)]}var mt=t.dateTime,vt=t.date,yt=t.time,_t=t.periods,xt=t.days,bt=t.shortDays,wt=t.months,kt=t.shortMonths,St=d(_t),Mt=c(xt),Tt=d(xt),At=c(bt),Et=d(bt),Lt=c(wt),Ct=d(wt),Pt=c(kt),It=d(kt),Nt={a:st,A:ot,b:ut,B:lt,c:null,d:T,e:T,H:A,I:E,j:L,L:C,m:D,M:P,p:ct,S:I,U:N,w:O,W:z,x:null,X:null,y:U,Y:j,Z:F,"%":tt},Ot={a:dt,A:ft,b:ht,B:pt,c:null,d:R,e:R,H:q,I:B,j:G,L:$,m:Y,M:H,p:gt,S:W,U:V,w:X,W:J,x:null,X:null,y:K,Y:Z,Z:Q,"%":tt},zt={a:o,A:u,b:l,B:et,c:nt,d:_,e:_,H:b,I:b,j:x,L:S,m:y,M:w,p:at,S:k,U:h,w:f,W:p,x:rt,X:it,y:m,Y:g,Z:v,"%":M};return Nt.x=e(vt,Nt),Nt.X=e(yt,Nt),Nt.c=e(mt,Nt),Ot.x=e(vt,Ot),Ot.X=e(yt,Ot),Ot.c=e(mt,Ot),{format:function(t){var r=e(t+="",Nt);return r.parse=n(t,i),r.toString=function(){return t},r},utcFormat:function(t){var r=e(t+="",Ot);return r.parse=n(t,a),r.toString=function(){return t},r}}}function u(t,e,n){var r=0>t?"-":"",i=(r?-t:t)+"",a=i.length;return r+(n>a?new Array(n-a+1).join(e)+i:i)}function l(t){return t.replace(Nt,"\\$&")}function c(t){return new RegExp("^(?:"+t.map(l).join("|")+")","i")}function d(t){for(var e={},n=-1,r=t.length;++n68?1900:2e3),n+r[0].length):-1}function v(t,e,n){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:r[3]?-(r[2]+r[3]):100*-r[2],n+r[0].length):-1}function y(t,e,n){var r=Pt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function _(t,e,n){var r=Pt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function x(t,e,n){var r=Pt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function b(t,e,n){var r=Pt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function w(t,e,n){var r=Pt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function k(t,e,n){var r=Pt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function S(t,e,n){var r=Pt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function M(t,e,n){var r=It.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function T(t,e){return u(t.getDate(),e,2)}function A(t,e){return u(t.getHours(),e,2)}function E(t,e){return u(t.getHours()%12||12,e,2)}function L(t,e){return u(1+kt.count(Tt(t),t),e,3)}function C(t,e){return u(t.getMilliseconds(),e,3)}function D(t,e){return u(t.getMonth()+1,e,2)}function P(t,e){return u(t.getMinutes(),e,2)}function I(t,e){return u(t.getSeconds(),e,2)}function N(t,e){return u(St.count(Tt(t),t),e,2)}function O(t){return t.getDay()}function z(t,e){return u(Mt.count(Tt(t),t),e,2)}function U(t,e){return u(t.getFullYear()%100,e,2)}function j(t,e){return u(t.getFullYear()%1e4,e,4)}function F(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+u(e/60|0,"0",2)+u(e%60,"0",2)}function R(t,e){return u(t.getUTCDate(),e,2)}function q(t,e){return u(t.getUTCHours(),e,2)}function B(t,e){return u(t.getUTCHours()%12||12,e,2)}function G(t,e){return u(1+At.count(Ct(t),t),e,3)}function $(t,e){return u(t.getUTCMilliseconds(),e,3)}function Y(t,e){return u(t.getUTCMonth()+1,e,2)}function H(t,e){return u(t.getUTCMinutes(),e,2)}function W(t,e){return u(t.getUTCSeconds(),e,2)}function V(t,e){return u(Et.count(Ct(t),t),e,2)}function X(t){return t.getUTCDay()}function J(t,e){return u(Lt.count(Ct(t),t),e,2)}function K(t,e){return u(t.getUTCFullYear()%100,e,2)}function Z(t,e){return u(t.getUTCFullYear()%1e4,e,4)}function Q(){return"+0000"}function tt(){return"%"}function et(t){return t.toISOString()}function nt(t){if("string"==typeof t){if(!jt.hasOwnProperty(t))return null;t=jt[t]}return o(t)}var rt={dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},it={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]},at={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"]},st={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."]},ot={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"]},ut={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]},lt={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月"]},ct={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"]},dt={dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]},ft={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."]},ht={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"]},pt={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"]},gt={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"]},mt={dateTime:"%a %b %e %X %Y",date:"%m/%d/%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"]},vt={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"]},yt={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"]},_t={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"]},xt={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."]},bt=new Date,wt=new Date,kt=e(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}),St=n(0),Mt=n(1),Tt=e(function(t){t.setHours(0,0,0,0),t.setMonth(0,1)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()}),At=e(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5}),Et=r(0),Lt=r(1),Ct=e(function(t){t.setUTCHours(0,0,0,0),t.setUTCMonth(0,1)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),Dt={"-":"",_:" ",0:"0"},Pt=/^\s*\d+/,It=/^%/,Nt=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ot="%Y-%m-%dT%H:%M:%S.%LZ";et.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},et.toString=function(){return Ot};var zt=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?et:mt.utcFormat(Ot),Ut=zt,jt={"ca-ES":xt,"de-DE":_t,"en-CA":yt,"en-GB":vt,"en-US":mt,"es-ES":gt,"fi-FI":pt,"fr-CA":ht,"fr-FR":ft,"he-IL":dt,"it-IT":ct,"ja-JP":lt,"mk-MK":ut,"nl-NL":ot,"pl-PL":st,"pt-BR":at,"ru-RU":it,"zh-CN":rt},Ft=o(mt);t.format=Ft.format,t.utcFormat=Ft.utcFormat,t.localeFormat=nt,t.isoFormat=Ut})},{}],8:[function(e,n,r){!function(e,i){"object"==typeof r&&"undefined"!=typeof n?i(r):"function"==typeof t&&t.amd?t(["exports"],i):i(e.time={})}(this,function(t){"use strict";function e(t,n,r){function s(e){return t(e=new Date(+e)),e}return s.floor=s,s.round=function(e){var r=new Date(+e),i=new Date(e-1);return t(r),t(i),n(i,1),i-e>e-r?r:i},s.ceil=function(e){return t(e=new Date(e-1)),n(e,1),e},s.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},s.range=function(e,r,i){var a=[];if(e=new Date(e-1),r=new Date(+r),i=null==i?1:Math.floor(i),!(r>e&&i>0))return a;for(n(e,1),t(e),r>e&&a.push(new Date(+e));n(e,i),t(e),r>e;)a.push(new Date(+e));return a},s.filter=function(r){return e(function(e){for(;t(e),!r(e);)e.setTime(e-1)},function(t,e){for(;--e>=0;)for(;n(t,1),!r(t););})},r&&(s.count=function(e,n){return a.setTime(+e),i.setTime(+n),t(a),t(i),Math.floor(r(a,i))}),s}function n(t){return e(function(e){ +e.setHours(0,0,0,0),e.setDate(e.getDate()-(e.getDay()+7-t)%7)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}function r(t){return e(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/6048e5})}var i=new Date,a=new Date,s=e(function(t){t.setMilliseconds(0)},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3});t.seconds=s.range;var o=e(function(t){t.setSeconds(0,0)},function(t,e){t.setTime(+t+6e4*e)},function(t,e){return(e-t)/6e4});t.minutes=o.range;var u=e(function(t){t.setMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5});t.hours=u.range;var l=e(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});t.days=l.range,t.sunday=n(0),t.sundays=t.sunday.range,t.monday=n(1),t.mondays=t.monday.range,t.tuesday=n(2),t.tuesdays=t.tuesday.range,t.wednesday=n(3),t.wednesdays=t.wednesday.range,t.thursday=n(4),t.thursdays=t.thursday.range,t.friday=n(5),t.fridays=t.friday.range,t.saturday=n(6),t.saturdays=t.saturday.range;var c=t.sunday;t.weeks=c.range;var d=e(function(t){t.setHours(0,0,0,0),t.setDate(1)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())});t.months=d.range;var f=e(function(t){t.setHours(0,0,0,0),t.setMonth(0,1)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()});t.years=f.range;var h=e(function(t){t.setUTCMilliseconds(0)},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3});t.utcSeconds=h.range;var p=e(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+6e4*e)},function(t,e){return(e-t)/6e4});t.utcMinutes=p.range;var g=e(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5});t.utcHours=g.range;var m=e(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5});t.utcDays=m.range,t.utcSunday=r(0),t.utcSundays=t.utcSunday.range,t.utcMonday=r(1),t.utcMondays=t.utcMonday.range,t.utcTuesday=r(2),t.utcTuesdays=t.utcTuesday.range,t.utcWednesday=r(3),t.utcWednesdays=t.utcWednesday.range,t.utcThursday=r(4),t.utcThursdays=t.utcThursday.range,t.utcFriday=r(5),t.utcFridays=t.utcFriday.range,t.utcSaturday=r(6),t.utcSaturdays=t.utcSaturday.range;var v=t.utcSunday;t.utcWeeks=v.range;var y=e(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(1)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())});t.utcMonths=y.range;var _=e(function(t){t.setUTCHours(0,0,0,0),t.setUTCMonth(0,1)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()});t.utcYears=_.range,t.interval=e,t.second=s,t.minute=o,t.hour=u,t.day=l,t.week=c,t.month=d,t.year=f,t.utcSecond=h,t.utcMinute=p,t.utcHour=g,t.utcDay=m,t.utcWeek=v,t.utcMonth=y,t.utcYear=_})},{}],9:[function(t,e,n){function r(){this._cells={},this._aggr=[],this._stream=!1}function i(t){if(a.isArray(t))return t;if(null==t)return[];var e,n,r=[];for(e in t)n=a.array(t[e]),r.push({name:e,ops:n});return r}var a=t("../util"),s=t("./measures"),o=t("./collector"),u=r.Flags={ADD_CELL:1,MOD_CELL:2},l=r.prototype;l.stream=function(t){return null==t?this._stream:(this._stream=!!t,this._aggr=[],this)},l.key=function(t){return null==t?this._key:(this._key=a.$(t),this)},l.groupby=function(t){return this._dims=a.array(t).map(function(t,e){if(t=a.isString(t)?{name:t,get:a.$(t)}:a.isFunction(t)?{name:a.name(t)||t.name||"_"+e,get:t}:t.name&&a.isFunction(t.get)?t:null,null==t)throw"Invalid groupby argument: "+t;return t}),this.clear()},l.summarize=function(t){t=i(t),this._count=!0;var e,n,r,o,u,l,c,d=this._aggr=[];for(r=0;re;++e)i+="|"+n[e].get(t);return i},l._cell=function(t){var e=this._dims.length?this._cellkey(t):"";return this._cells[e]||(this._cells[e]=this._newcell(t,e))},l._newcell=function(t,e){var n,r={num:0,tuple:this._newtuple(t,e),flag:u.ADD_CELL,aggs:{}},i=this._aggr;for(n=0;ne;++e)i[r[e].name]=r[e].get(t);return this._ingest(i)},l._ingest=a.identity,l._add=function(t){var e,n=this._cell(t),r=this._aggr;if(n.num+=1,!this._count)for(n.collect&&n.data.add(t),e=0;e0){for(t.collect&&t.data.values(),e=0;et;++t)r.hasOwnProperty(l(o[t]))||(c[e++]=o[t]);else{for(t=0,n=u.length;n>t;++t)u[t][s]=1;for(t=0,e=0,n=o.length;n>t;++t)o[t][s]||(c[e++]=o[t]);for(t=0,n=u.length;n>t;++t)delete u[t][s]}else for(r=a.count.map(u),t=0,e=0,n=o.length;n>t;++t)r[o[t]]>0?r[o[t]]-=1:c[e++]=o[t];return this._rem=[],this._add=c},o.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=a.extent.index(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},o.argmin=function(t){return this.extent(t)[0]},o.argmax=function(t){return this.extent(t)[1]},o.min=function(t){var e=this.extent(t)[0];return e?t(e):+(1/0)},o.max=function(t){var e=this.extent(t)[1];return e?t(e):-(1/0)},o.quartile=function(t){return this._get===t&&this._q||(this._q=a.quartile(this.values(),t),this._get=t),this._q},o.q1=function(t){return this.quartile(t)[0]},o.q2=function(t){return this.quartile(t)[1]},o.q3=function(t){return this.quartile(t)[2]},e.exports=r},{"../stats":28,"../util":31}],11:[function(t,e,n){var r=t("../util"),i=t("./aggregator");e.exports=function(){var t=[].reduce.call(arguments,function(t,e){return t.concat(r.array(e))},[]);return(new i).groupby(t).summarize({"*":"values"})}},{"../util":31,"./aggregator":9}],12:[function(t,e,n){function r(t){return function(e){var n=s.extend({init:"",add:"",rem:"",idx:0},t);return n.out=e||t.name,n}}function i(t,e){function n(t,r){function i(e){t[e]||n(t,t[e]=o[e]())}return r.req&&r.req.forEach(i),e&&r.str&&r.str.forEach(i),t}var r=t.reduce(n,t.reduce(function(t,e){return t[e.name]=e,t},{}));return s.vals(r).sort(function(t,e){return t.idx-e.idx})}function a(e,n,r,a){var o=i(e,n),u="this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;",l="if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;",c="if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;",d="var t = this.tuple; var cell = this.cell;";return o.forEach(function(t){t.idx<0?(u=t.init+u,l=t.add+l,c=t.rem+c):(u+=t.init,l+=t.add,c+=t.rem)}),e.slice().sort(function(t,e){return t.idx-e.idx}).forEach(function(t){d+="this.assign(t,'"+t.out+"',"+t.set+");"}),d+="return t;",u=Function("cell","t",u),u.prototype.assign=a,u.prototype.add=Function("t","var v = this.get(t);"+l),u.prototype.rem=Function("t","var v = this.get(t);"+c),u.prototype.set=Function(d),u.prototype.get=r,u.prototype.distinct=t("../stats").count.distinct,u.prototype.isValid=s.isValid,u.fields=e.map(s.$("out")),u}var s=t("../util"),o={values:r({name:"values",init:"cell.collect = true;",set:"cell.data.values()",idx:-1}),count:r({name:"count",set:"cell.num"}),missing:r({name:"missing",set:"this.missing"}),valid:r({name:"valid",set:"this.valid"}),sum:r({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:r({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:r({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:r({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:r({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:r({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:r({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),median:r({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:r({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:r({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),distinct:r({name:"distinct",set:"this.distinct(cell.data.values(), this.get)",req:["values"],idx:3}),argmin:r({name:"argmin",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin = this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:r({name:"argmax",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax = this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:r({name:"min",init:"this.min = +Infinity;",add:"if (v < this.min) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:r({name:"max",init:"this.max = -Infinity;",add:"if (v > this.max) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4}),modeskew:r({name:"modeskew",set:"this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))",req:["mean","stdev","median"],idx:5})};o.create=a,e.exports=o},{"../stats":28,"../util":31}],13:[function(t,e,n){function r(t){if(!t)throw Error("Missing binning options.");var e,n,r,o,u,l,c,d=t.maxbins||15,f=t.base||10,h=Math.log(f),p=t.div||[5,2],g=t.min,m=t.max,v=m-g;if(t.step)e=t.step;else if(t.steps)e=t.steps[Math.min(t.steps.length-1,i(t.steps,v/d,0,t.steps.length))];else{n=Math.ceil(Math.log(d)/h),r=t.minstep||0,e=Math.max(r,Math.pow(f,Math.round(Math.log(v)/h)-n));do e*=f;while(Math.ceil(v/e)>d);for(l=0;l=r&&d>=v/u&&(e=u)}return u=Math.log(e),o=u>=0?0:~~(-u/h)+1,c=Math.pow(f,-o-1),g=Math.min(g,Math.floor(g/e+c)*e),m=Math.ceil(m/e)*e,{start:g,stop:m,step:e,unit:{precision:o},value:a,index:s}}function i(t,e,n,r){for(;r>n;){var i=n+r>>>1;l.cmp(t[i],e)<0?n=i+1:r=i}return n}function a(t){return this.step*Math.floor(t/this.step+d)}function s(t){return Math.floor((t-this.start)/this.step+d)}function o(t){return this.unit.date(a.call(this,t))}function u(t){return s.call(this,this.unit.unit(t))}var l=t("../util"),c=t("../time"),d=1e-15;r.date=function(t){if(!t)throw Error("Missing date binning options.");var e=t.utc?c.utc:c,n=t.min,i=t.max,a=t.maxbins||20,s=t.minbins||4,l=+i-+n,d=t.unit?e[t.unit]:e.find(l,s,a),f=r({min:null!=d.min?d.min:d.unit(n),max:null!=d.max?d.max:d.unit(i),maxbins:a,minstep:d.minstep,steps:d.step});return f.unit=d,f.index=u,t.raw||(f.value=o),f},e.exports=r},{"../time":30,"../util":31}],14:[function(t,e,n){function r(t,e,n){n=s(t,e,n);var r=a(n);return r?f.$func("bin",r.unit.unit?function(t){return r.value(r.unit.unit(t))}:function(t){return r.value(t)})(n.accessor):n.accessor||f.identity}function i(t,e,n){n=s(t,e,n);var r=a(n);return r?o(t,n.accessor,r):u(t,n.accessor,n&&n.sort)}function a(t){var e=t.type,n=null;return(null==e||p[e])&&("integer"===e&&null==t.minstep&&(t.minstep=1),n="date"===e?l.date(t):l(t)),n}function s(){var t=arguments,e=0,n=f.isArray(t[e])?t[e++]:null,r=f.isFunction(t[e])||f.isString(t[e])?f.$(t[e++]):null,i=f.extend({},t[e]);if(n&&(i.type=i.type||d(n,r),p[i.type])){var a=h.extent(n,r);i=f.extend({min:a[0],max:a[1]},i)}return r&&(i.accessor=r),i}function o(t,e,n){for(var r,i,a=c.range(n.start,n.stop+n.step/2,n.step).map(function(t){return{value:n.value(t),count:0}}),s=0;si||i>=a.length||!isFinite(i))continue;a[i].count+=1}return a.bins=n,a}function u(t,e,n){var r=h.unique(t,e),i=h.count.map(t,e);return r.map(function(t){return{value:t,count:i[t]}}).sort(f.comparator(n?"-count":"+value"))}var l=t("./bins"),c=t("../generate"),d=t("../import/type"),f=t("../util"),h=t("../stats"),p={integer:1,number:1,date:1};e.exports={$bin:r,histogram:i}},{"../generate":16,"../import/type":25,"../stats":28,"../util":31,"./bins":13}],15:[function(t,e,n){function r(t){var e=d.localeFormat(t);if(null==e)throw Error("Unrecognized locale: "+t);f=e}function i(t){var e=c.localeFormat(t);if(null==e)throw Error("Unrecognized locale: "+t);h=e}function a(t,e){t.length||(t=[0]),null==e&&(e=10);var n=t[0],r=t[t.length-1];n>r&&(s=r,r=n,n=s);var i=r-n||(e=1,n||r||1),a=Math.pow(10,Math.floor(Math.log(i/e)/Math.LN10)),s=i/e/a;return s>=p?a*=10:s>=g?a*=5:s>=m&&(a*=2),[Math.ceil(n/a)*a,Math.floor(r/a)*a+a/2,a]}function s(t,e,n){var r=a(t,e);if(null==n)n=",."+d.precisionFixed(r[2])+"f";else switch(n=d.formatSpecifier(n),n.type){case"s":var i=Math.max(Math.abs(r[0]),Math.abs(r[1]));return null==n.precision&&(n.precision=d.precisionPrefix(r[2],i)),f.formatPrefix(n,i);case"":case"e":case"g":case"p":case"r":null==n.precision&&(n.precision=d.precisionRound(r[2],Math.max(Math.abs(r[0]),Math.abs(r[1])))-("e"===n.type));break;case"f":case"%":null==n.precision&&(n.precision=d.precisionFixed(r[2])-2*("%"===n.type))}return f.format(n)}function o(){var t=h.format,e=t(".%L"),n=t(":%S"),r=t("%I:%M"),i=t("%I %p"),a=t("%a %d"),s=t("%b %d"),o=t("%B"),u=t("%Y");return function(t){var c=+t;return(l.second(t)n;++n)r[n]=t;return r},r.zeros=function(t){return r.repeat(0,t)},r.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n==1/0)throw new Error("Infinite range");var r,i=[],a=-1;if(0>n)for(;(r=t+n*++a)>e;)i.push(r);else for(;(r=t+n*++a)1);return i=Math.sqrt(-2*Math.log(r)/r),n=t+s*i*e,t+a*i*e};return i.samples=function(t){return r.zeros(t).map(i)},i}},{}],17:[function(t,e,n){function r(t,e){if(t){var n=e.header;t=(n?n.join(e.delimiter)+"\n":"")+t}return a.dsv(e.delimiter).parse(t)}var i=t("../../util"),a=t("d3-dsv");r.delimiter=function(t){var e={delimiter:t};return function(t,n){return r(t,n?i.extend(n,e):e)}},e.exports=r},{"../../util":31,"d3-dsv":5}],18:[function(t,e,n){var r=t("./dsv");e.exports={json:t("./json"),topojson:t("./topojson"),treejson:t("./treejson"),dsv:r,csv:r.delimiter(","),tsv:r.delimiter(" ")}},{"./dsv":17,"./json":19,"./topojson":20,"./treejson":21}],19:[function(t,e,n){var r=t("../../util");e.exports=function(t,e){var n=r.isObject(t)&&!r.isBuffer(t)?t:JSON.parse(t);return e&&e.property&&(n=r.accessor(e.property)(n)),n}},{"../../util":31}],20:[function(t,e,n){(function(n){var r=t("./json"),i=function(t,e){var n=i.topojson;if(null==n)throw Error("TopoJSON library not loaded.");var a,s=r(t,e);if(e&&e.feature){if(a=s.objects[e.feature])return n.feature(s,a).features;throw Error("Invalid TopoJSON object: "+e.feature)}if(e&&e.mesh){if(a=s.objects[e.mesh])return[n.mesh(s,s.objects[e.mesh])];throw Error("Invalid TopoJSON object: "+e.mesh)}throw Error("Missing TopoJSON feature or mesh parameter.")};i.topojson="undefined"!=typeof window?window.topojson:"undefined"!=typeof n?n.topojson:null,e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./json":19}],21:[function(t,e,n){function r(t,e){function n(t){r.push(t);var i=t[e];if(i)for(var a=0;a1&&"."===r[e-1]&&r.lastIndexOf(t)===e});if(!u)throw"URL is not whitelisted: "+n}}return n}function i(t,e){var n,r=e||function(t){throw t};try{n=i.sanitizeUrl(t)}catch(a){return void r(a)}return n?i.useXHR?s(n,e):l(n,d)?o(n.slice(d.length),e):n.indexOf("://")<0?o(n,e):u(n,e):void r("Invalid URL: "+t.url)}function a(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function s(t,e){function n(){var t=i.status;!t&&a(i)||t>=200&&300>t||304===t?e(null,i.responseText):e(i,null)}var r=!!e,i=new XMLHttpRequest;return!this.XDomainRequest||"withCredentials"in i||!/^(http(s)?:)?\/\//.test(t)||(i=new XDomainRequest),r&&("onload"in i?i.onload=i.onerror=n:i.onreadystatechange=function(){i.readyState>3&&n()}),i.open("GET",t,r),i.send(),!r&&a(i)?i.responseText:void 0}function o(e,n){var r=t("fs");return n?void r.readFile(e,n):r.readFileSync(e,"utf8")}function u(e,n){if(!n)return t("sync-request")("GET",e).getBody();var r={url:e,encoding:null,gzip:!0};t("request")(r,function(t,e,r){t||200!==e.statusCode?(t=t||"Load failed with response code "+e.statusCode+".",n(t,null)):n(null,r)})}function l(t,e){return null==t?!1:0===t.lastIndexOf(e,0)}var c=/^([A-Za-z]+:)?\/\//,d="file://";i.sanitizeUrl=r,i.useXHR="undefined"!=typeof XMLHttpRequest,e.exports=i},{fs:2,request:2,"sync-request":2,url:2}],23:[function(t,e,n){function r(t,e){var n=e&&e.type||"json";return t=o[n](t,e),e&&e.parse&&i(t,e.parse),t}function i(t,e){var n,r,i,o,u,l,c=t.length;for(e="auto"===e?s.inferAll(t):a.duplicate(e),n=a.keys(e),r=n.map(function(t){return s.parsers[e[t]]}),o=0,l=n.length;c>o;++o)for(i=t[o],u=0;l>u;++u)i[n[u]]=r[u](i[n[u]]);s.annotation(t,e)}var a=t("../util"),s=t("./type"),o=t("./formats");r.formats=o,e.exports=r},{"../util":31,"./formats":18,"./type":25}],24:[function(t,e,n){var r=t("../util"),i=t("./load"),a=t("./read");e.exports=r.keys(a.formats).reduce(function(t,e){return t[e]=function(t,n,s){r.isString(t)&&(t={url:t}),2===arguments.length&&r.isFunction(n)&&(s=n,n=void 0),n=r.extend({parse:"auto"},n),n.type=e;var o=i(t,s?function(t,e){if(t)return void s(t,null);try{e=a(e,n),s(null,e)}catch(r){s(r,null)}}:void 0);return s?void 0:a(o,n)},t},{})},{"../util":31,"./load":22,"./read":23}],25:[function(t,e,n){function r(t,e){return e?void(t[l]=e):t&&t[l]||null}function i(t,e){e=u.$(e);var n,r,i;if(t[l]&&(n=e(t[l]),u.isString(n)))return n;for(r=0,i=t.length;!u.isValid(n)&&i>r;++r)n=e?e(t[r]):t[r];return u.isDate(n)?"date":u.isNumber(n)?"number":u.isBoolean(n)?"boolean":u.isString(n)?"string":null}function a(t,e){return t.length?(e=e||u.keys(t[0]),e.reduce(function(e,n){return e[n]=i(t,n),e},{})):void 0}function s(t,e){e=u.$(e);var n,r,i,a=["boolean","integer","number","date"];for(n=0;n0?Math.min(s,e.maxwidth):s}),h=n.map(function(t,e){return a.truncate(a.pad(t,f[e],"center"),f[e])}).join(e.separator),p=u(n.map(function(t,e){return"{{"+t+(l[r[t]]||"")+("|pad:"+f[e]+","+(c[r[t]]||"right"))+("|truncate:"+f[e])+"}}"}).join(e.separator));return h+"\n"+t.map(p).join("\n")},e.exports.summary=function(t){t=t?t.__summary__?t:o.summary(t):this;var e,n,a=[];for(e=0,n=t.length;n>e;++e)a.push("-- "+t[e].field+" --"),"string"===t[e].type||t[e].distinct<10?a.push(i(t[e])):a.push(r(t[e])),a.push("");return a.join("\n")}},{"./import/type":25,"./stats":28,"./template":29,"./util":31}],28:[function(t,e,n){var r=t("./util"),i=t("./import/type"),a=t("./generate"),s={};s.unique=function(t,e,n){e=r.$(e),n=n||[];var i,a,s,o={};for(a=0,s=t.length;s>a;++a)i=e?e(t[a]):t[a],i in o||(o[i]=1,n.push(i));return n},s.count=function(t){return t&&t.length||0},s.count.valid=function(t,e){e=r.$(e);var n,i,a,s=0;for(i=0,a=t.length;a>i;++i)n=e?e(t[i]):t[i],r.isValid(n)&&(s+=1);return s},s.count.missing=function(t,e){e=r.$(e);var n,i,a,s=0;for(i=0,a=t.length;a>i;++i)n=e?e(t[i]):t[i],null==n&&(s+=1);return s},s.count.distinct=function(t,e){e=r.$(e);var n,i,a,s={},o=0;for(i=0,a=t.length;a>i;++i)n=e?e(t[i]):t[i],n in s||(s[n]=1,o+=1);return o},s.count.map=function(t,e){e=r.$(e);var n,i,a,s={};for(i=0,a=t.length;a>i;++i)n=e?e(t[i]):t[i],s[n]=n in s?s[n]+1:1;return s},s.median=function(t,e){return e&&(t=t.map(r.$(e))),t=t.filter(r.isValid).sort(r.cmp),s.quantile(t,.5)},s.quartile=function(t,e){e&&(t=t.map(r.$(e))),t=t.filter(r.isValid).sort(r.cmp);var n=s.quantile;return[n(t,.25),n(t,.5),n(t,.75)]},s.quantile=function(t,e,n){void 0===n&&(n=e,e=r.identity),e=r.$(e);var i=(t.length-1)*n+1,a=Math.floor(i),s=+e(t[a-1]),o=i-a;return o?s+o*(e(t[a])-s):s},s.sum=function(t,e){e=r.$(e);for(var n,i=0,a=0,s=t.length;s>a;++a)n=e?e(t[a]):t[a],r.isValid(n)&&(i+=n);return i},s.mean=function(t,e){e=r.$(e);var n,i,a,s,o,u=0;for(i=0,s=0,a=t.length;a>i;++i)o=e?e(t[i]):t[i],r.isValid(o)&&(n=o-u,u+=n/++s);return u},s.variance=function(t,e){if(e=r.$(e),!r.isArray(t)||t.length<2)return 0;var n,i,a,s,o=0,u=0;for(i=0,a=0;is;++s)if(a=e?e(t[s]):t[s],r.isValid(a)){n=i=a;break}for(;o>s;++s)a=e?e(t[s]):t[s],r.isValid(a)&&(n>a&&(n=a),a>i&&(i=a));return[n,i]},s.extent.index=function(t,e){e=r.$(e);var n,i,a,s,o=-1,u=-1,l=t.length;for(s=0;l>s;++s)if(a=e?e(t[s]):t[s],r.isValid(a)){n=i=a,o=u=s;break}for(;l>s;++s)a=e?e(t[s]):t[s],r.isValid(a)&&(n>a&&(n=a,o=s),a>i&&(i=a,u=s));return[o,u]},s.dot=function(t,e,n){var i,a,s=0;if(n)for(e=r.$(e),n=r.$(n),i=0;in;++n){if(i=s[n].val,0>l&&c===i)l=n-1;else if(l>-1&&c!==i){for(a=1+(n-1+l)/2;n>l;++l)u[s[l].idx]=a;l=-1}u[s[n].idx]=n+1,c=i}if(l>-1)for(a=1+(o-1+l)/2;o>l;++l)u[s[l].idx]=a;return u},s.cor=function(t,e,n){var i=n;n=i?t.map(r.$(n)):e,e=i?t.map(r.$(e)):t;var a=s.dot(e,n),o=s.mean(e),u=s.mean(n),l=s.stdev(e),c=s.stdev(n),d=t.length;return(a-d*o*u)/((d-1)*l*c)},s.cor.rank=function(t,e,n){var i,a,o,u=n?s.rank(t,r.$(e)):s.rank(t),l=n?s.rank(t,r.$(n)):s.rank(e),c=t.length;for(i=0,a=0;c>i;++i)o=u[i]-l[i],a+=o*o;return 1-6*a/(c*(c*c-1))},s.cor.dist=function(t,e,n){var i,a,o,u,l=n?t.map(r.$(e)):t,c=n?t.map(r.$(n)):e,d=s.dist.mat(l),f=s.dist.mat(c),h=d.length;for(i=0,a=0,o=0,u=0;h>i;++i)a+=d[i]*d[i],o+=f[i]*f[i],u+=d[i]*f[i];return Math.sqrt(u/Math.sqrt(a*o))},s.dist=function(t,e,n,i){var a,s,o=r.isFunction(n)||r.isString(n),u=t,l=o?t:e,c=o?i:n,d=2===c||null==c,f=t.length,h=0;for(o&&(e=r.$(e),n=r.$(n)),s=0;f>s;++s)a=o?e(u[s])-n(l[s]):u[s]-l[s],h+=d?a*a:Math.pow(Math.abs(a),c);return d?Math.sqrt(h):Math.pow(h,1/c)},s.dist.mat=function(t){var e,n,r,i=t.length,s=i*i,o=Array(s),u=a.zeros(i),l=0;for(n=0;i>n;++n)for(o[n*i+n]=0,r=n+1;i>r;++r)o[n*i+r]=e=Math.abs(t[n]-t[r]),o[r*i+n]=e,u[n]+=e,u[r]+=e;for(n=0;i>n;++n)l+=u[n],u[n]/=i;for(l/=s,n=0;i>n;++n)for(r=n;i>r;++r)o[n*i+r]+=l-u[n]-u[r],o[r*i+n]=o[n*i+r];return o},s.entropy=function(t,e){e=r.$(e);var n,i,a=0,s=0,o=t.length;for(n=0;o>n;++n)a+=e?e(t[n]):t[n];if(0===a)return 0;for(n=0;o>n;++n)i=(e?e(t[n]):t[n])/a,i&&(s+=i*Math.log(i));return-s/Math.LN2},s.mutual=function(t,e,n,i){var a,s,o,u=i?t.map(r.$(e)):t,l=i?t.map(r.$(n)):e,c=i?t.map(r.$(i)):n,d={},f={},h=c.length,p=0,g=0,m=0;for(o=0;h>o;++o)d[u[o]]=0,f[l[o]]=0;for(o=0;h>o;++o)d[u[o]]+=c[o],f[l[o]]+=c[o],p+=c[o];for(s=1/(p*Math.LN2),o=0;h>o;++o)0!==c[o]&&(a=p*c[o]/(d[u[o]]*f[l[o]]),g+=c[o]*s*Math.log(a),m+=c[o]*s*Math.log(c[o]/p));return[g,1+g/m]},s.mutual.info=function(t,e,n,r){return s.mutual(t,e,n,r)[0]},s.mutual.dist=function(t,e,n,r){return s.mutual(t,e,n,r)[1]},s.profile=function(t,e){var n,a,o,u,l,c=0,d=0,f=0,h=0,p=null,g=null,m=0,v=[],y={};for(o=0;ol)&&(p=l),(null===g||l>g)&&(g=l),n=l-c,c+=n/++d,m+=n*(l-c),v.push(l));return m/=d-1,a=Math.sqrt(m),v.sort(r.cmp),{type:i(t,e),unique:y,count:t.length,valid:d,missing:f,distinct:h,min:p,max:g,mean:c,stdev:a,median:u=s.quantile(v,.5),q1:s.quantile(v,.25),q3:s.quantile(v,.75),modeskew:0===a?0:(c-u)/a}},s.summary=function(t,e){e=e||r.keys(t[0]);var n=e.map(function(e){var n=s.profile(t,r.$(e));return n.field=e,n});return n.__summary__=!0,n},e.exports=s},{"./generate":16,"./import/type":25,"./util":31}],29:[function(t,e,n){function r(t){var e=i(t,"d");return e="var __t; return "+e+";",new Function("d",e).bind(c)}function i(t,e,n){e=e||"obj";var r=0,i="'",o=d;return t.replace(o,function(o,u,l){return i+=t.slice(r,l).replace(g,s),r=l+o.length,u&&(i+="'\n+((__t=("+a(u,e,n)+"))==null?'':__t)+\n'"),o}),i+"'"}function a(t,e,n){function i(t){ +return t=t||"",g?(g=!1,m="String("+m+")"+t):m+=t,m}function a(){return"(typeof "+m+'==="number"?new Date('+m+"):"+m+")"}function s(t,e){_=o(w[0],e,t),g=!1,m="this.formats["+_+"]("+m+")"}function c(t,e){_=o(w[0],e,t),g=!1,m="this.formats["+_+"]("+a()+")"}var d=t.match(f),p=d.shift().trim(),g=!0;n&&(n[p]=1);for(var m=r.property(e,p),v=0;v0&&(b=b.slice(0,y),w=d[v].slice(y+1).match(h).map(function(t){return t.trim()})),b=b.trim()){case"length":i(".length");break;case"lower":i(".toLowerCase()");break;case"upper":i(".toUpperCase()");break;case"lower-locale":i(".toLocaleLowerCase()");break;case"upper-locale":i(".toLocaleUpperCase()");break;case"trim":i(".trim()");break;case"left":_=u.number(w[0]),i(".slice(0,"+_+")");break;case"right":_=u.number(w[0]),i(".slice(-"+_+")");break;case"mid":_=u.number(w[0]),x=_+u.number(w[1]),i(".slice(+"+_+","+x+")");break;case"slice":_=u.number(w[0]),i(".slice("+_+(w.length>1?","+u.number(w[1]):"")+")");break;case"truncate":_=u.number(w[0]),x=w[1],x="left"!==x&&"middle"!==x&&"center"!==x?"right":x,m="this.truncate("+i()+","+_+",'"+x+"')";break;case"pad":_=u.number(w[0]),x=w[1],x="left"!==x&&"middle"!==x&&"center"!==x?"right":x,m="this.pad("+i()+","+_+",'"+x+"')";break;case"number":s(l.number,"number");break;case"time":c(l.time,"time");break;case"time-utc":c(l.utc,"time-utc");break;default:throw Error("Unrecognized template filter: "+b)}}return m}function s(t){return"\\"+p[t]}function o(t,e,n){if(!("'"===t[0]&&"'"===t[t.length-1]||'"'===t[0]&&'"'===t[t.length-1]))throw Error("Format pattern must be quoted: "+t);if(t=t.slice(1,-1),e=e+":"+t,!c.format_map[e]){var r=n(t),i=c.formats.length;c.formats.push(r),c.format_map[e]=i}return c.format_map[e]}var u=t("./util"),l=t("./format"),c={formats:[],format_map:{},truncate:u.truncate,pad:u.pad};r.source=i,r.context=c,e.exports=r,r.clearFormatCache=function(){c.formats=[],c.format_map={}},r.property=function(t,e){var n=u.field(e).map(u.str).join("][");return t+"["+n+"]"};var d=/\{\{(.+?)\}\}|$/g,f=/(?:"[^"]*"|\'[^\']*\'|[^\|"]+|[^\|\']+)+/g,h=/(?:"[^"]*"|\'[^\']*\'|[^,"]+|[^,\']+)+/g,p={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},g=/\\|'|\r|\n|\u2028|\u2029/g},{"./format":15,"./util":31}],30:[function(t,e,n){function r(t){return l.setTime(+t),l}function i(t,e,n,r,i,a){var s={type:t,date:e,unit:n};return r?s.step=r:s.minstep=1,null!=i&&(s.min=i),null!=a&&(s.max=a),s}function a(t,e,n,r,a,s){return i(t,function(t){return e.offset(n,t)},function(t){return e.count(n,t)},r,a,s)}function s(t,e,n,r){var i,a,s,o=p[0];for(i=1,a=p.length;a>i;++i)if(o=p[i],e>o[0]){if(s=e/o[0],s>r)return t[p[i-1][1]];if(s>=n)return t[o[1]]}return t[p[a-1][1]]}function o(t){var e,n,r={};for(e=0,n=t.length;n>e;++e)r[t[e].type]=t[e];return r.find=function(e,n,r){return s(t,e,n,r)},r}var u=t("d3-time"),l=new Date,c=new Date(0,0,1).setFullYear(0),d=new Date(Date.UTC(0,0,1)).setUTCFullYear(0),f=[a("second",u.second,c),a("minute",u.minute,c),a("hour",u.hour,c),a("day",u.day,c,[1,7]),a("month",u.month,c,[1,3,6]),a("year",u.year,c),i("seconds",function(t){return new Date(1970,0,1,0,0,t)},function(t){return r(t).getSeconds()},null,0,59),i("minutes",function(t){return new Date(1970,0,1,0,t)},function(t){return r(t).getMinutes()},null,0,59),i("hours",function(t){return new Date(1970,0,1,t)},function(t){return r(t).getHours()},null,0,23),i("weekdays",function(t){return new Date(1970,0,4+t)},function(t){return r(t).getDay()},[1],0,6),i("dates",function(t){return new Date(1970,0,t)},function(t){return r(t).getDate()},[1],1,31),i("months",function(t){return new Date(1970,t%12,1)},function(t){return r(t).getMonth()},[1],0,11)],h=[a("second",u.utcSecond,d),a("minute",u.utcMinute,d),a("hour",u.utcHour,d),a("day",u.utcDay,d,[1,7]),a("month",u.utcMonth,d,[1,3,6]),a("year",u.utcYear,d),i("seconds",function(t){return new Date(Date.UTC(1970,0,1,0,0,t))},function(t){return r(t).getUTCSeconds()},null,0,59),i("minutes",function(t){return new Date(Date.UTC(1970,0,1,0,t))},function(t){return r(t).getUTCMinutes()},null,0,59),i("hours",function(t){return new Date(Date.UTC(1970,0,1,t))},function(t){return r(t).getUTCHours()},null,0,23),i("weekdays",function(t){return new Date(Date.UTC(1970,0,4+t))},function(t){return r(t).getUTCDay()},[1],0,6),i("dates",function(t){return new Date(Date.UTC(1970,0,t))},function(t){return r(t).getUTCDate()},[1],1,31),i("months",function(t){return new Date(Date.UTC(1970,t%12,1))},function(t){return r(t).getUTCMonth()},[1],0,11)],p=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];e.exports=o(f),e.exports.utc=o(h)},{"d3-time":8}],31:[function(t,e,n){function r(t){return t.replace(f,"$1\\'")}function i(t,e){var n,r="";for(n=0;t>n;++n)r+=e;return r}function a(t,e,n){var r=0,i=t.split(p);return t=n?(i=i.reverse()).filter(function(t){return r+=t.length,e>=r}).reverse():i.filter(function(t){return r+=t.length,e>=r}),t.length?t.join("").trim():i[0].slice(0,e)}var s=t("buffer"),o=t("./time"),u=o.utc,l=e.exports={},c="__name__";l.namedfunc=function(t,e){return e[c]=t,e},l.name=function(t){return null==t?null:t[c]},l.identity=function(t){return t},l["true"]=l.namedfunc("true",function(){return!0}),l["false"]=l.namedfunc("false",function(){return!1}),l.duplicate=function(t){return JSON.parse(JSON.stringify(t))},l.equal=function(t,e){return JSON.stringify(t)===JSON.stringify(e)},l.extend=function(t){for(var e,n,r=1,i=arguments.length;i>r;++r){e=arguments[r];for(n in e)t[n]=e[n]}return t},l.length=function(t){return null!=t&&null!=t.length?t.length:null},l.keys=function(t){var e,n=[];for(e in t)n.push(e);return n},l.vals=function(t){var e,n=[];for(e in t)n.push(t[e]);return n},l.toMap=function(t,e){return(e=l.$(e))?t.reduce(function(t,n){return t[e(n)]=1,t},{}):t.reduce(function(t,e){return t[e]=1,t},{})},l.keystr=function(t){var e=t.length;if(!e)return"";for(var n=String(t[0]),r=1;e>r;++r)n+="|"+String(t[r]);return n};var d=Object.prototype.toString;l.isObject=function(t){return t===Object(t)},l.isFunction=function(t){return"[object Function]"===d.call(t)},l.isString=function(t){return"string"==typeof value||"[object String]"===d.call(t)},l.isArray=Array.isArray||function(t){return"[object Array]"===d.call(t)},l.isNumber=function(t){return"number"==typeof t||"[object Number]"===d.call(t)},l.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==d.call(t)},l.isDate=function(t){return"[object Date]"===d.call(t)},l.isValid=function(t){return null!=t&&t===t},l.isBuffer=s.Buffer&&s.Buffer.isBuffer||l["false"],l.number=function(t){return null==t||""===t?null:+t},l["boolean"]=function(t){return null==t||""===t?null:"false"===t?!1:!!t},l.date=function(t){return null==t||""===t?null:Date.parse(t)},l.array=function(t){return null!=t?l.isArray(t)?t:[t]:[]},l.str=function(t){return l.isArray(t)?"["+t.map(l.str)+"]":l.isObject(t)?JSON.stringify(t):l.isString(t)?"'"+r(t)+"'":t};var f=/(^|[^\\])'/g,h=/\[(.*?)\]|[^.\[]+/g;l.field=function(t){return String(t).match(h).map(function(t){return"["!==t[0]?t:"'"!==t[1]&&'"'!==t[1]?t.slice(1,-1):t.slice(2,-2).replace(/\\(["'])/g,"$1")})},l.accessor=function(t){var e;return null==t||l.isFunction(t)?t:l.namedfunc(t,(e=l.field(t)).length>1?function(t){return e.reduce(function(t,e){return t[e]},t)}:function(e){return e[t]})},l.$=l.accessor,l.mutator=function(t){var e;return l.isString(t)&&(e=l.field(t)).length>1?function(t,n){for(var r=0;ri;++i){if(s=t[i],o=s(n),u=s(r),u>o)return-1*e[i];if(o>u)return e[i]}return 0}},l.cmp=function(t,e){return e>t?-1:t>e?1:t>=e?0:null===t?-1:null===e?1:NaN},l.numcmp=function(t,e){return t-e},l.stablesort=function(t,e,n){var r=t.reduce(function(t,e,r){return t[n(e)]=r,t},{});return t.sort(function(t,i){var a=e(t),s=e(i);return s>a?-1:a>s?1:r[n(t)]-r[n(i)]}),t},l.pad=function(t,e,n,r){r=r||" ";var a=e-t.length;if(0>=a)return t;switch(n){case"left":return i(a,r)+t;case"middle":case"center":return i(Math.floor(a/2),r)+t+i(Math.ceil(a/2),r);default:return t+i(a,r)}},l.truncate=function(t,e,n,r,i){var s=t.length;if(e>=s)return t;i=void 0!==i?String(i):"…";var o=Math.max(0,e-i.length);switch(n){case"left":return i+(r?a(t,o,1):t.slice(s-o));case"middle":case"center":var u=Math.ceil(o/2),l=Math.floor(o/2);return(r?a(t,u):t.slice(0,u))+i+(r?a(t,l,1):t.slice(s-l));default:return(r?a(t,o):t.slice(0,o))+i}};var p=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/},{"./time":30,buffer:2}],32:[function(t,e,n){function r(t,e){var n={};return i(t,n),n.add=[],n.mod=[],n.rem=[],n.reflow=e,n}function i(t,e){e.stamp=t?t.stamp:0,e.sort=t?t.sort:null,e.facet=t?t.facet:null,e.trans=t?t.trans:null,e.dirty=t?t.dirty:[],e.request=t?t.request:null;for(var n,r=0,i=a.length;i>r;++r)e[n=a[r]]=t?t[n]:{}}var a=t("./Dependencies").ALL;e.exports={create:r,copy:i}},{"./Dependencies":35}],33:[function(t,e,n){function r(t){s.init.call(this,t),this._data=[],this.router(!0).collector(!0)}var i=t("vega-logging"),a=t("./Tuple"),s=t("./Node").prototype,o=r.prototype=Object.create(s);o.constructor=r,o.data=function(){return this._data},o.evaluate=function(t){return i.debug(t,["collecting"]),t.rem.length&&(this._data=a.idFilter(this._data,t.rem)),t.add.length&&(this._data=this._data.length?this._data.concat(t.add):t.add),t.sort&&this._data.sort(t.sort),t.reflow&&(t.mod=t.mod.concat(a.idFilter(this._data,t.add,t.mod,t.rem)),t.reflow=!1),t},e.exports=r},{"./Node":38,"./Tuple":40,"vega-logging":47}],34:[function(t,e,n){function r(t,e,n){this._graph=t,this._name=e,this._data=[],this._source=null,this._facet=n,this._input=u.create(),this._output=null,this._inputNode=null,this._outputNode=null,this._pipeline=null,this._collector=null,this._mutates=!1}function i(t){var e=new d(t._graph).router(!0).collector(!0);return e.data=function(){return t._data},e.evaluate=function(e){o.debug(e,["input",t._name]);var n,r=t._input,i=u.create(e);for(n in r.fields)i.fields[n]=1;return r.rem.length&&(t._data=c.idFilter(t._data,r.rem)),r.add.length&&(t._data=t._data.concat(r.add)),r.sort&&t._data.sort(r.sort),e.reflow&&(r.mod=r.mod.concat(c.idFilter(t._data,r.add,r.mod,r.rem))),t._input=u.create(),i.add=r.add,i.mod=r.mod,i.rem=r.rem,i.facet=t._facet,i},e}function a(t){var e=new d(t._graph).router(!0).reflows(!0).collector(!0);return e.data=function(){return t._collector?t._collector.data():t._data},e.evaluate=function(e){o.debug(e,["output",t._name]);var n=u.create(e,!0);return t._facet&&(t._facet.values=t.values(),e.facet=null),t._output=e,n.data[t._name]=1,n},e}function s(t){var e=new d(t._graph).router(!0);return e.evaluate=function(e){if(t.mutates()){var n=t._srcMap||(t._srcMap={}),r=u.create(e);return r.add=e.add.map(function(t){return n[t._id]=c.derive(t)}),r.mod=e.mod.map(function(t){return c.rederive(t,n[t._id])}),r.rem=e.rem.map(function(t){var e=n[t._id];return n[t._id]=null,e}),t._input=r}return t._input=e},e}var o=t("vega-logging"),u=t("./ChangeSet"),l=t("./Collector"),c=t("./Tuple"),d=t("./Node"),f=r.prototype;f.name=function(t){return arguments.length?(this._name=t,this):this._name},f.source=function(t){return arguments.length?this._source=this._graph.data(t):this._source},f.insert=function(t){return this._input.add=this._input.add.concat(t.map(c.ingest)),this},f.remove=function(t){var e=this._data.filter(t);return this._input.rem=this._input.rem.concat(e),this},f.update=function(t,e,n){var r=this._input.mod,i=c.idMap(r);return this._input.fields[e]=1,this._data.filter(t).forEach(function(t){var a=t[e],s=n(t);a!==s&&(c.set(t,e,s),1!==i[t._id]&&(r.push(t),i[t._id]=1))}),this},f.values=function(t){return arguments.length?(this._input.rem=this._data.slice(),t&&this.insert(t),this):this._collector.data()},f.mutates=function(t){return arguments.length?(this._mutates=this._mutates||t,this):this._mutates},f.last=function(){return this._output},f.fire=function(t){return t&&(this._input=t),this._graph.propagate(this._input,this._pipeline[0]),this},f.pipeline=function(t){if(!arguments.length)return this._pipeline;var e,n=this._graph;return t.unshift(this._inputNode=i(this)),e=n.preprocess(t),e.router&&t.push(e.collector=new l(n)),t.push(this._outputNode=a(this)),this._collector=e.collector,this._mutates=!!e.mutates,n.connect(this._pipeline=t),this},f.synchronize=function(){return this._graph.synchronize(this._pipeline),this},f.listener=function(){return s(this).addListener(this._inputNode)},f.addListener=function(t){return t instanceof r?this._collector.addListener(t.listener()):this._outputNode.addListener(t),this},f.removeListener=function(t){this._outputNode.removeListener(t)},f.listeners=function(t){return(t?this._collector:this._outputNode).listeners()},e.exports=r},{"./ChangeSet":32,"./Collector":33,"./Node":38,"./Tuple":40,"vega-logging":47}],35:[function(t,e,n){var r=e.exports={ALL:["data","fields","scales","signals"]};r.ALL.forEach(function(t){r[t.toUpperCase()]=t})},{}],36:[function(t,e,n){function r(){}var i=t("datalib"),a=t("./Heap"),s=t("./ChangeSet"),o=t("./DataSource"),u=t("./Collector"),l=t("./Tuple"),c=t("./Signal"),d=t("./Dependencies"),f=r.prototype;f.init=function(){this._stamp=0,this._rank=0,this._data={},this._signals={},this.doNotPropagate={}},f.rank=function(){return++this._rank},f.values=function(t,e,n){var r,a,s=t===d.SIGNALS?this._signals:this._data,o=void 0!==e?e:i.keys(s);if(Array.isArray(o)){for(r=n||{},a=0;a1)for(var n=1,r=t.length;r>n;++n)e=e[t[n]];return e},f.propagate=function(t,e,n){var r,i,o,u,l,c,d,f={},h=new a(function(t,e){return t._qrank-e._qrank});if(t.stamp)throw Error("Pulse already has a non-zero stamp.");for(t.stamp=n||++this._stamp,f[e._id]=t,h.push(e.qrank(!0));h.size()>0;)if(e=h.peek(),t=f[e._id],e.rank()!==e.qrank())h.replace(e.qrank(!0));else if(h.pop(),f[e._id]=null,r=e._listeners,t=this.evaluate(t,e),t!==this.doNotPropagate)for(!t.reflow&&e.reflows()&&(t=s.create(t,!0)),c=0,d=r.length;d>c;++c)if(i=r[c],void 0!==(o=f[i._id])){if(null===o)throw Error("Already propagated to node.");if(o===t)continue;if(u=t.add.length||t.mod.length||t.rem.length,l=o.add.length||o.mod.length||o.rem.length,u&&l)throw Error("Multiple changeset pulses to same node");f[i._id]=u?t:o,f[i._id].reflow=t.reflow||o.reflow}else h.push(i.qrank(!0)),f[i._id]=t},f.preprocess=function(t){for(var e,n,r,i,a=this,s=0,o=0;os;++s){for(n=t[s],n.collector()&&(e=n),r=n.dependency(d.DATA),u=0,l=r.length;l>u;++u){if(!(c=this.data(f=r[u])))throw new Error("Unknown data source "+i.str(f));c.addListener(e)}for(a=n.dependency(d.SIGNALS),u=0,l=a.length;l>u;++u){if(!(c=this.signal(f=a[u])))throw new Error("Unknown signal "+i.str(f));c.addListener(e)}s>0&&t[s-1].addListener(n)}return t},f.disconnect=function(t){var e,n,r,i,a,s,o,u;for(a=0,s=t.length;s>a;++a){for(n=t[a],n.collector()&&(e=n),r=n.dependency(d.DATA),o=0,u=r.length;u>o;++o)this.data(r[o]).removeListener(e);for(i=n.dependency(d.SIGNALS),o=0,u=i.length;u>o;++o)this.signal(i[o]).removeListener(e);n.disconnect()}return t},f.synchronize=function(t){var e,n,r,i,a,s,o,u,c={};for(r=0,i=t.length;i>r;++r)if(e=t[r],e.collector())for(a=0,n=e.data(),s=n.length;s>a;++a)u=(o=n[a])._id,c[u]||(l.prev_update(o),c[u]=1);return this},f.reevaluate=function(t,e){var n=t.reflow&&e.last()>=t.stamp,r=e.router()||t.add.length||t.rem.length;return r||!n||e.reevaluate(t)},f.evaluate=function(t,e){return this.reevaluate(t,e)?(t=e.evaluate(t),e.last(t.stamp),t):t},e.exports=r},{"./ChangeSet":32,"./Collector":33,"./DataSource":34,"./Dependencies":35,"./Heap":37,"./Signal":39,"./Tuple":40,datalib:26}],37:[function(t,e,n){function r(t){this.cmp=t,this.nodes=[]}function i(t,e,n,r){var i,a,s;for(i=t[n];n>e&&(s=n-1>>1,a=t[s],r(i,a)<0);)t[n]=a,n=s;return t[n]=i}function a(t,e,n){for(var r,a=e,s=t.length,o=t[e],u=2*e+1;s>u;)r=u+1,s>r&&n(t[u],t[r])>=0&&(u=r),t[e]=t[u],e=u,u=2*e+1;return t[e]=o,i(t,a,e,n)}var s=r.prototype;s.size=function(){return this.nodes.length},s.clear=function(){return this.nodes=[],this},s.peek=function(){return this.nodes[0]},s.push=function(t){var e=this.nodes;return e.push(t),i(e,0,e.length-1,this.cmp)},s.pop=function(){var t,e=this.nodes,n=e.pop();return e.length?(t=e[0],e[0]=n,a(e,0,this.cmp)):t=n,t},s.replace=function(t){var e=this.nodes,n=e[0];return e[0]=t,a(e,0,this.cmp),n},s.pushpop=function(t){var e=this.nodes,n=e[0];return e.length&&this.cmp(n,t)<0&&(e[0]=t,t=n,a(e,0,this.cmp)),t},e.exports=r},{}],38:[function(t,e,n){function r(t){t&&this.init(t)}var i=t("./Dependencies").ALL,a=0,s=r.Flags={Router:1,Collector:2,Produces:4,Mutates:8,Reflows:16,Batch:32},o=r.prototype;o.init=function(t){this._id=++a,this._graph=t,this._rank=t.rank(),this._qrank=null,this._stamp=0,this._listeners=[],this._listeners._ids={},this._deps={};for(var e=0,n=i.length;n>e;++e)this._deps[i[e]]=[];return this._flags=0,this},o.rank=function(){return this._rank},o.qrank=function(){return arguments.length?(this._qrank=this._rank,this):this._qrank},o.last=function(t){return arguments.length?(this._stamp=t,this):this._stamp},o._setf=function(t,e){return e?this._flags|=t:this._flags&=~t,this},o.router=function(t){return arguments.length?this._setf(s.Router,t):this._flags&s.Router},o.collector=function(t){return arguments.length?this._setf(s.Collector,t):this._flags&s.Collector},o.produces=function(t){return arguments.length?this._setf(s.Produces,t):this._flags&s.Produces},o.mutates=function(t){return arguments.length?this._setf(s.Mutates,t):this._flags&s.Mutates},o.reflows=function(t){return arguments.length?this._setf(s.Reflows,t):this._flags&s.Reflows},o.batch=function(t){return arguments.length?this._setf(s.Batch,t):this._flags&s.Batch},o.dependency=function(t,e){var n=this._deps[t],r=n._names||(n._names={});if(1===arguments.length)return n;if(null===e)n.splice(0,n.length),n._names={};else if(Array.isArray(e))for(var i,a=0,s=e.length;s>a;++a)i=e[a],r[i]||(n.push(i),r[i]=1);else{if(r[e])return this;n.push(e),r[e]=1}return this},o.listeners=function(){return this._listeners},o.addListener=function(t){if(!(t instanceof r))throw Error("Listener is not a Node");if(this._listeners._ids[t._id])return this;if(this._listeners.push(t),this._listeners._ids[t._id]=1,this._rank>t._rank)for(var e,n=[t],i=this._graph;n.length;)e=n.shift(),e._rank=i.rank(),n.unshift.apply(n,e.listeners());return this},o.removeListener=function(t){if(!this._listeners._ids[t._id])return!1;var e=this._listeners.indexOf(t),n=e>=0;return n&&(this._listeners.splice(e,1),this._listeners._ids[t._id]=null),n},o.disconnect=function(){this._listeners=[],this._listeners._ids={}},o.evaluate=function(t){return t},o.reevaluate=function(t){var e,n,r,a,s,o;for(r=0,a=i.length;a>r;++r)for(e=i[r],n=this._deps[e],s=0,o=n.length;o>s;++s)if(t[e][n[s]])return!0;return!1},r.reset=function(){a=0},e.exports=r},{"./Dependencies":35}],39:[function(t,e,n){function r(t,e,n){return s.init.call(this,t),this._name=e,this._value=n,this._verbose=!1,this._handlers=[],this}var i=t("./ChangeSet"),a=t("./Node"),s=a.prototype,o=r.prototype=Object.create(s);o.constructor=r,o.name=function(){return this._name},o.value=function(t){return arguments.length?(this._value=t,this):this._value},o.values=o.value,o.verbose=function(t){return arguments.length?(this._verbose=!!t,this):this._verbose},o.evaluate=function(t){return t.signals[this._name]?t:this._graph.doNotPropagate},o.fire=function(t){t||(t=i.create(null,!0)),t.signals[this._name]=1,this._graph.propagate(t,this)},o.on=function(t){var e=this,n=new a(this._graph);return n.evaluate=function(n){return t(e.name(),e.value()),n},this._handlers.push({handler:t,node:n}),this.addListener(n)},o.off=function(t){var e,n,r=this._handlers;for(e=r.length;--e>=0;)t&&r[e].handler!==t||(n=r.splice(e,1)[0],this.removeListener(n.node));return this},e.exports=r},{"./ChangeSet":32,"./Node":38}],40:[function(t,e,n){function r(t){return t=t===Object(t)?t:{data:t},t._id=++s,t._prev&&(t._prev=null),t}function i(t,e){e=e||{};for(var n=0,r=t.length;r>n;++n)e[t[n]._id]=1;return e}function a(t,e){e=e||{};for(var n in t)"_prev"!==n&&"_id"!==n&&(e[n]=t[n]);return e}var s=0;e.exports={ingest:r,idMap:i,derive:function(t){return r(a(t))},rederive:function(t,e){return a(t,e)},set:function(t,e,n){return t[e]===n?0:(t[e]=n,1)},prev:function(t){return t._prev||t},prev_init:function(t){t._prev||(t._prev={_id:t._id})},prev_update:function(t){var e,n,r=t._prev;if(r)for(e in t)"_prev"!==e&&"_id"!==e&&(r[e]=(n=t[e])instanceof Object&&n._prev?n._prev:n)},reset:function(){s=0},idFilter:function(t){for(var e={},n=arguments.length;--n>0;)i(arguments[n],e);return t.filter(function(t){return!e[t._id]})}}},{}],41:[function(t,e,n){e.exports={ChangeSet:t("./ChangeSet"),Collector:t("./Collector"),DataSource:t("./DataSource"),Dependencies:t("./Dependencies"),Graph:t("./Graph"),Node:t("./Node"),Signal:t("./Signal"),Tuple:t("./Tuple"),debug:t("vega-logging").debug}},{"./ChangeSet":32,"./Collector":33,"./DataSource":34,"./Dependencies":35,"./Graph":36,"./Node":38,"./Signal":39,"./Tuple":40,"vega-logging":47}],42:[function(t,e,n){function r(t){var e,n,r={};for(e=0,n=t.length;n>e;++e)r[t[e]]=1;return r}function i(t){var e,n=[];for(e in t)n.push(e);return n}e.exports=function(e){function n(t){var e={code:s(t),globals:i(p),fields:i(g)};return p={},g={},e}function a(t){return h+'["'+t+'"]'}function s(t){if("string"==typeof t)return t;var e=m[t.type];if(null==e)throw new Error("Unsupported type: "+t.type);return e(t)}e=e||{};var o=e.constants||t("./constants"),u=(e.functions||t("./functions"))(s),l=e.idWhiteList?r(e.idWhiteList):null,c=e.idBlackList?r(e.idBlackList):null,d=0,f=e.fieldVar||"datum",h=e.globalVar||"signals",p={},g={},m={Literal:function(t){return t.raw},Identifier:function(t){var e=t.name;if(d>0)return e;if(o.hasOwnProperty(e))return o[e];if(l)return l.hasOwnProperty(e)?e:(p[e]=1,a(e));if(c&&c.hasOwnProperty(e))throw new Error("Illegal identifier: "+e);return e},Program:function(t){return t.body.map(s).join("\n")},MemberExpression:function(t){var e=!t.computed,n=s(t.object);e&&(d+=1);var r=s(t.property);return n===f&&(g[r]=1),e&&(d-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){if("Identifier"!==t.callee.type)throw new Error("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=u.hasOwnProperty(e)&&u[e];if(!r)throw new Error("Unrecognized function: "+e);return r instanceof Function?r(n):r+"("+n.map(s).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(s).join(",")+"]"},BinaryExpression:function(t){return"("+s(t.left)+t.operator+s(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+s(t.argument)+")"},ConditionalExpression:function(t){return"("+s(t.test)+"?"+s(t.consequent)+":"+s(t.alternate)+")"},LogicalExpression:function(t){return"("+s(t.left)+t.operator+s(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(s).join(",")+"}"},Property:function(t){d+=1;var e=s(t.key);return d-=1,e+":"+s(t.value)},ExpressionStatement:function(t){return s(t.expression)}};return n.functions=u,n.constants=o,n}},{"./constants":43,"./functions":44}],43:[function(t,e,n){e.exports={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"}},{}],44:[function(t,e,n){e.exports=function(t){function e(e,n,r,i){var a=t(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+e+(0>i?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}function n(t,n,r){return function(i){return e(t,i,n,r)}}var r="new Date",i="String",a="RegExp";return{isNaN:"isNaN",isFinite:"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){if(e.length<3)throw new Error("Missing arguments to clamp function.");if(e.length>3)throw new Error("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",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",i,0),lower:n("toLowerCase",i,0),slice:n("slice",i),substring:n("substring",i),regexp:a,test:n("test",a),"if":function(e){if(e.length<3)throw new Error("Missing arguments to if function.");if(e.length>3)throw new Error("Too many arguments to if function.");var n=e.map(t);return n[0]+"?"+n[1]+":"+n[2]}}}},{}],45:[function(t,e,n){var r=t("./parser"),i=t("./codegen"),a=e.exports={parse:function(t,e){return r.parse("("+t+")",e)},code:function(t){return i(t)},compiler:function(t,e){t=t.slice();var n=i(e),r=t.length,s=function(e){var i=n(a.parse(e));return t[r]='"use strict"; return ('+i.code+");",i.fn=Function.apply(null,t),i};return s.codegen=n,s},functions:t("./functions"),constants:t("./constants")}},{"./codegen":42,"./constants":43,"./functions":44,"./parser":46}],46:[function(t,e,n){e.exports=function(){"use strict";function t(t,e){if(!t)throw new Error("ASSERT: "+e)}function e(t){return t>=48&&57>=t}function n(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function r(t){return"01234567".indexOf(t)>=0}function i(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 a(t){return 10===t||13===t||8232===t||8233===t}function s(t){return 36===t||95===t||t>=65&&90>=t||t>=97&&122>=t||92===t||t>=128&&St.NonAsciiIdentifierStart.test(String.fromCharCode(t))}function o(t){return 36===t||95===t||t>=65&&90>=t||t>=97&&122>=t||t>=48&&57>=t||92===t||t>=128&&St.NonAsciiIdentifierPart.test(String.fromCharCode(t))}function u(t){switch(t){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function l(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function c(t){if(Tt&&l(t))return!0;switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t||"let"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}}function d(){var t,e;for(e=0===At;Ct>At;)if(t=Mt.charCodeAt(At),i(t))++At;else{if(!a(t))break;++At,13===t&&10===Mt.charCodeAt(At)&&++At,++Et,Lt=At,e=!0}}function f(t){var e,r,i,a=0;for(r="u"===t?4:2,e=0;r>e;++e){if(!(Ct>At&&n(Mt[At])))return"";i=Mt[At++],a=16*a+"0123456789abcdef".indexOf(i.toLowerCase())}return String.fromCharCode(a)}function h(){var t,e,r,i;for(t=Mt[At],e=0,"}"===t&&F({},kt.UnexpectedToken,"ILLEGAL");Ct>At&&(t=Mt[At++],n(t));)e=16*e+"0123456789abcdef".indexOf(t.toLowerCase());return(e>1114111||"}"!==t)&&F({},kt.UnexpectedToken,"ILLEGAL"),65535>=e?String.fromCharCode(e):(r=(e-65536>>10)+55296,i=(e-65536&1023)+56320,String.fromCharCode(r,i))}function p(){var t,e;for(t=Mt.charCodeAt(At++),e=String.fromCharCode(t),92===t&&(117!==Mt.charCodeAt(At)&&F({},kt.UnexpectedToken,"ILLEGAL"),++At,t=f("u"),t&&"\\"!==t&&s(t.charCodeAt(0))||F({},kt.UnexpectedToken,"ILLEGAL"),e=t);Ct>At&&(t=Mt.charCodeAt(At),o(t));)++At,e+=String.fromCharCode(t),92===t&&(e=e.substr(0,e.length-1),117!==Mt.charCodeAt(At)&&F({},kt.UnexpectedToken,"ILLEGAL"),++At,t=f("u"),t&&"\\"!==t&&o(t.charCodeAt(0))||F({},kt.UnexpectedToken,"ILLEGAL"),e+=t);return e}function g(){var t,e;for(t=At++;Ct>At;){if(e=Mt.charCodeAt(At),92===e)return At=t,p();if(!o(e))break;++At}return Mt.slice(t,At)}function m(){var t,e,n;return t=At,e=92===Mt.charCodeAt(At)?p():g(),n=1===e.length?_t.Identifier:c(e)?_t.Keyword:"null"===e?_t.NullLiteral:"true"===e||"false"===e?_t.BooleanLiteral:_t.Identifier,{type:n,value:e,lineNumber:Et,lineStart:Lt,start:t,end:At}}function v(){var t,e,n,r,i=At,a=Mt.charCodeAt(At),s=Mt[At];switch(a){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++At,It.tokenize&&(40===a?It.openParenToken=It.tokens.length:123===a&&(It.openCurlyToken=It.tokens.length)),{type:_t.Punctuator,value:String.fromCharCode(a),lineNumber:Et,lineStart:Lt,start:i,end:At};default:if(t=Mt.charCodeAt(At+1),61===t)switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return At+=2,{type:_t.Punctuator,value:String.fromCharCode(a)+String.fromCharCode(t),lineNumber:Et,lineStart:Lt,start:i,end:At};case 33:case 61:return At+=2,61===Mt.charCodeAt(At)&&++At,{type:_t.Punctuator,value:Mt.slice(i,At),lineNumber:Et,lineStart:Lt,start:i,end:At}}}return r=Mt.substr(At,4),">>>="===r?(At+=4,{type:_t.Punctuator,value:r,lineNumber:Et,lineStart:Lt,start:i,end:At}):(n=r.substr(0,3),">>>"===n||"<<="===n||">>="===n?(At+=3, +{type:_t.Punctuator,value:n,lineNumber:Et,lineStart:Lt,start:i,end:At}):(e=n.substr(0,2),s===e[1]&&"+-<>&|".indexOf(s)>=0||"=>"===e?(At+=2,{type:_t.Punctuator,value:e,lineNumber:Et,lineStart:Lt,start:i,end:At}):"<>=!+-*%&|^/".indexOf(s)>=0?(++At,{type:_t.Punctuator,value:s,lineNumber:Et,lineStart:Lt,start:i,end:At}):void F({},kt.UnexpectedToken,"ILLEGAL")))}function y(t){for(var e="";Ct>At&&n(Mt[At]);)e+=Mt[At++];return 0===e.length&&F({},kt.UnexpectedToken,"ILLEGAL"),s(Mt.charCodeAt(At))&&F({},kt.UnexpectedToken,"ILLEGAL"),{type:_t.NumericLiteral,value:parseInt("0x"+e,16),lineNumber:Et,lineStart:Lt,start:t,end:At}}function _(t){for(var n="0"+Mt[At++];Ct>At&&r(Mt[At]);)n+=Mt[At++];return(s(Mt.charCodeAt(At))||e(Mt.charCodeAt(At)))&&F({},kt.UnexpectedToken,"ILLEGAL"),{type:_t.NumericLiteral,value:parseInt(n,8),octal:!0,lineNumber:Et,lineStart:Lt,start:t,end:At}}function x(){var n,i,a;if(a=Mt[At],t(e(a.charCodeAt(0))||"."===a,"Numeric literal must start with a decimal digit or a decimal point"),i=At,n="","."!==a){if(n=Mt[At++],a=Mt[At],"0"===n){if("x"===a||"X"===a)return++At,y(i);if(r(a))return _(i);a&&e(a.charCodeAt(0))&&F({},kt.UnexpectedToken,"ILLEGAL")}for(;e(Mt.charCodeAt(At));)n+=Mt[At++];a=Mt[At]}if("."===a){for(n+=Mt[At++];e(Mt.charCodeAt(At));)n+=Mt[At++];a=Mt[At]}if("e"===a||"E"===a)if(n+=Mt[At++],a=Mt[At],("+"===a||"-"===a)&&(n+=Mt[At++]),e(Mt.charCodeAt(At)))for(;e(Mt.charCodeAt(At));)n+=Mt[At++];else F({},kt.UnexpectedToken,"ILLEGAL");return s(Mt.charCodeAt(At))&&F({},kt.UnexpectedToken,"ILLEGAL"),{type:_t.NumericLiteral,value:parseFloat(n),lineNumber:Et,lineStart:Lt,start:i,end:At}}function b(){var e,n,i,s,o,u,l,c,d="",p=!1;for(l=Et,c=Lt,e=Mt[At],t("'"===e||'"'===e,"String literal must starts with a quote"),n=At,++At;Ct>At;){if(i=Mt[At++],i===e){e="";break}if("\\"===i)if(i=Mt[At++],i&&a(i.charCodeAt(0)))++Et,"\r"===i&&"\n"===Mt[At]&&++At,Lt=At;else switch(i){case"u":case"x":"{"===Mt[At]?(++At,d+=h()):(u=At,o=f(i),o?d+=o:(At=u,d+=i));break;case"n":d+="\n";break;case"r":d+="\r";break;case"t":d+=" ";break;case"b":d+="\b";break;case"f":d+="\f";break;case"v":d+=" ";break;default:r(i)?(s="01234567".indexOf(i),0!==s&&(p=!0),Ct>At&&r(Mt[At])&&(p=!0,s=8*s+"01234567".indexOf(Mt[At++]),"0123".indexOf(i)>=0&&Ct>At&&r(Mt[At])&&(s=8*s+"01234567".indexOf(Mt[At++]))),d+=String.fromCharCode(s)):d+=i}else{if(a(i.charCodeAt(0)))break;d+=i}}return""!==e&&F({},kt.UnexpectedToken,"ILLEGAL"),{type:_t.StringLiteral,value:d,octal:p,startLineNumber:l,startLineStart:c,lineNumber:Et,lineStart:Lt,start:n,end:At}}function w(t,e){var n,r=t;e.indexOf("u")>=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,e){return parseInt(e,16)<=1114111?"x":void F({},kt.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{n=new RegExp(r)}catch(i){F({},kt.InvalidRegExp)}try{return new RegExp(t,e)}catch(a){return null}}function k(){var e,n,r,i,s;for(e=Mt[At],t("/"===e,"Regular expression literal must start with a slash"),n=Mt[At++],r=!1,i=!1;Ct>At;)if(e=Mt[At++],n+=e,"\\"===e)e=Mt[At++],a(e.charCodeAt(0))&&F({},kt.UnterminatedRegExp),n+=e;else if(a(e.charCodeAt(0)))F({},kt.UnterminatedRegExp);else if(r)"]"===e&&(r=!1);else{if("/"===e){i=!0;break}"["===e&&(r=!0)}return i||F({},kt.UnterminatedRegExp),s=n.substr(1,n.length-2),{value:s,literal:n}}function S(){var t,e,n,r;for(e="",n="";Ct>At&&(t=Mt[At],o(t.charCodeAt(0)));)if(++At,"\\"===t&&Ct>At)if(t=Mt[At],"u"===t){if(++At,r=At,t=f("u"))for(n+=t,e+="\\u";At>r;++r)e+=Mt[r];else At=r,n+="u",e+="\\u";R({},kt.UnexpectedToken,"ILLEGAL")}else e+="\\",R({},kt.UnexpectedToken,"ILLEGAL");else n+=t,e+=t;return{value:n,literal:e}}function M(){var t,e,n,r;return Dt=null,d(),t=At,e=k(),n=S(),r=w(e.value,n.value),It.tokenize?{type:_t.RegularExpression,value:r,regex:{pattern:e.value,flags:n.value},lineNumber:Et,lineStart:Lt,start:t,end:At}:{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:At}}function T(){var t,e,n,r;return d(),t=At,e={start:{line:Et,column:At-Lt}},n=M(),e.end={line:Et,column:At-Lt},It.tokenize||(It.tokens.length>0&&(r=It.tokens[It.tokens.length-1],r.range[0]===t&&"Punctuator"===r.type&&("/"===r.value||"/="===r.value)&&It.tokens.pop()),It.tokens.push({type:"RegularExpression",value:n.literal,regex:n.regex,range:[t,At],loc:e})),n}function A(t){return t.type===_t.Identifier||t.type===_t.Keyword||t.type===_t.BooleanLiteral||t.type===_t.NullLiteral}function E(){var t,e;if(t=It.tokens[It.tokens.length-1],!t)return T();if("Punctuator"===t.type){if("]"===t.value)return v();if(")"===t.value)return e=It.tokens[It.openParenToken-1],!e||"Keyword"!==e.type||"if"!==e.value&&"while"!==e.value&&"for"!==e.value&&"with"!==e.value?v():T();if("}"===t.value){if(It.tokens[It.openCurlyToken-3]&&"Keyword"===It.tokens[It.openCurlyToken-3].type){if(e=It.tokens[It.openCurlyToken-4],!e)return v()}else{if(!It.tokens[It.openCurlyToken-4]||"Keyword"!==It.tokens[It.openCurlyToken-4].type)return v();if(e=It.tokens[It.openCurlyToken-5],!e)return T()}return v()}return T()}return"Keyword"===t.type&&"this"!==t.value?T():v()}function L(){var t;return d(),At>=Ct?{type:_t.EOF,lineNumber:Et,lineStart:Lt,start:At,end:At}:(t=Mt.charCodeAt(At),s(t)?m():40===t||41===t||59===t?v():39===t||34===t?b():46===t?e(Mt.charCodeAt(At+1))?x():v():e(t)?x():It.tokenize&&47===t?E():v())}function C(){var t,e,n,r;return d(),t={start:{line:Et,column:At-Lt}},e=L(),t.end={line:Et,column:At-Lt},e.type!==_t.EOF&&(n=Mt.slice(e.start,e.end),r={type:xt[e.type],value:n,range:[e.start,e.end],loc:t},e.regex&&(r.regex={pattern:e.regex.pattern,flags:e.regex.flags}),It.tokens.push(r)),e}function D(){var t;return t=Dt,At=t.end,Et=t.lineNumber,Lt=t.lineStart,Dt="undefined"!=typeof It.tokens?C():L(),At=t.end,Et=t.lineNumber,Lt=t.lineStart,t}function P(){var t,e,n;t=At,e=Et,n=Lt,Dt="undefined"!=typeof It.tokens?C():L(),At=t,Et=e,Lt=n}function I(){this.line=Et,this.column=At-Lt}function N(){this.start=new I,this.end=null}function O(t){t.type===_t.StringLiteral?this.start={line:t.startLineNumber,column:t.start-t.startLineStart}:this.start={line:t.lineNumber,column:t.start-t.lineStart},this.end=null}function z(){At=Dt.start,Dt.type===_t.StringLiteral?(Et=Dt.startLineNumber,Lt=Dt.startLineStart):(Et=Dt.lineNumber,Lt=Dt.lineStart),It.range&&(this.range=[At,0]),It.loc&&(this.loc=new N)}function U(t){It.range&&(this.range=[t.start,0]),It.loc&&(this.loc=new O(t))}function j(){var t,e,n,r;return t=At,e=Et,n=Lt,d(),r=Et!==e,At=t,Et=e,Lt=n,r}function F(e,n){var r,i=Array.prototype.slice.call(arguments,2),a=n.replace(/%(\d)/g,function(e,n){return t(nAt&&(t.push(lt()),!$(")"));)G(",");return B(")"),t}function tt(){var t,e=new z;return t=D(),A(t)||q(t),e.finishIdentifier(t.value)}function et(){return B("."),tt()}function nt(){var t;return B("["),t=ct(),B("]"),t}function rt(){var t,e,n,r,i=Pt.allowIn;for(r=Dt,Pt.allowIn=!0,t=Z();;)if($("."))n=et(),t=new U(r).finishMemberExpression(".",t,n);else if($("("))e=Q(),t=new U(r).finishCallExpression(t,e);else{if(!$("["))break;n=nt(),t=new U(r).finishMemberExpression("[",t,n)}return Pt.allowIn=i,t}function it(){var t=rt();if(Dt.type===_t.Punctuator&&($("++")||$("--"))&&!j())throw new Error("Disabled.");return t}function at(){var t,e,n;if(Dt.type!==_t.Punctuator&&Dt.type!==_t.Keyword)e=it();else{if($("++")||$("--"))throw new Error("Disabled.");if($("+")||$("-")||$("~")||$("!"))n=Dt,t=D(),e=at(),e=new U(n).finishUnaryExpression(t.value,e);else{if(Y("delete")||Y("void")||Y("typeof"))throw new Error("Disabled.");e=it()}}return e}function st(t,e){var n=0;if(t.type!==_t.Punctuator&&t.type!==_t.Keyword)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":n=7;break;case"in":n=e?7:0;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function ot(){var t,e,n,r,i,a,s,o,u,l;if(t=Dt,u=at(),r=Dt,i=st(r,Pt.allowIn),0===i)return u;for(r.prec=i,D(),e=[t,Dt],s=at(),a=[u,r,s];(i=st(Dt,Pt.allowIn))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)s=a.pop(),o=a.pop().value,u=a.pop(),e.pop(),n=new U(e[e.length-1]).finishBinaryExpression(o,u,s),a.push(n);r=D(),r.prec=i,a.push(r),e.push(Dt),n=at(),a.push(n)}for(l=a.length-1,n=a[l],e.pop();l>1;)n=new U(e.pop()).finishBinaryExpression(a[l-1].value,a[l-2],n),l-=2;return n}function ut(){var t,e,n,r,i;return i=Dt,t=ot(),$("?")&&(D(),e=Pt.allowIn,Pt.allowIn=!0,n=lt(),Pt.allowIn=e,B(":"),r=lt(),t=new U(i).finishConditionalExpression(t,n,r)),t}function lt(){var t,e,n,r;return t=Pt.parenthesisCount,r=Dt,e=Dt,n=ut()}function ct(){var t=lt();if($(","))throw new Error("Disabled.");return t}function dt(t){var e=ct();return H(),t.finishExpressionStatement(e)}function ft(){var t,e,n=Dt.type;if(n===_t.EOF&&q(Dt),n===_t.Punctuator&&"{"===Dt.value)throw new Error("Disabled.");if(e=new z,n===_t.Punctuator)switch(Dt.value){case";":throw new Error("Disabled.");case"(":return dt(e)}else if(n===_t.Keyword)throw new Error("Disabled.");return t=ct(),H(),e.finishExpressionStatement(t)}function ht(){if(Dt.type===_t.Keyword)switch(Dt.value){case"const":case"let":throw new Error("Disabled.");case"function":throw new Error("Disabled.");default:return ft()}return Dt.type!==_t.EOF?ft():void 0}function pt(){for(var t,e,n,r,i=[];Ct>At&&(e=Dt,e.type===_t.StringLiteral)&&(t=ht(),i.push(t),t.expression.type===bt.Literal);)n=Mt.slice(e.start+1,e.end-1),"use strict"===n?(Tt=!0,r&&R(r,kt.StrictOctalLiteral)):!r&&e.octal&&(r=e);for(;Ct>At&&(t=ht(),"undefined"!=typeof t);)i.push(t);return i}function gt(){var t,e;return d(),P(),e=new z,Tt=!0,t=pt(),e.finishProgram(t)}function mt(){var t,e,n,r=[];for(t=0;t0?1:0,Lt=0,Ct=Mt.length,Dt=null,Pt={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},It={},e=e||{},e.tokens=!0,It.tokens=[],It.tokenize=!0,It.openParenToken=-1,It.openCurlyToken=-1,It.range="boolean"==typeof e.range&&e.range,It.loc="boolean"==typeof e.loc&&e.loc,"boolean"==typeof e.tolerant&&e.tolerant&&(It.errors=[]);try{if(P(),Dt.type===_t.EOF)return It.tokens;for(D();Dt.type!==_t.EOF;)try{D()}catch(i){if(It.errors){It.errors.push(i);break}throw i}mt(),r=It.tokens,"undefined"!=typeof It.errors&&(r.errors=It.errors)}catch(a){throw a}finally{It={}}return r}function yt(t,e){var n,r;r=String,"string"==typeof t||t instanceof String||(t=r(t)),Mt=t,At=0,Et=Mt.length>0?1:0,Lt=0,Ct=Mt.length,Dt=null,Pt={allowIn:!0,labelSet:{},parenthesisCount:0,inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},It={},"undefined"!=typeof e&&(It.range="boolean"==typeof e.range&&e.range,It.loc="boolean"==typeof e.loc&&e.loc,It.loc&&null!==e.source&&void 0!==e.source&&(It.source=r(e.source)),"boolean"==typeof e.tokens&&e.tokens&&(It.tokens=[]),"boolean"==typeof e.tolerant&&e.tolerant&&(It.errors=[]));try{n=gt(),"undefined"!=typeof It.tokens&&(mt(),n.tokens=It.tokens),"undefined"!=typeof It.errors&&(n.errors=It.errors)}catch(i){throw i}finally{It={}}return n}var _t,xt,bt,wt,kt,St,Mt,Tt,At,Et,Lt,Ct,Dt,Pt,It;_t={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9},xt={},xt[_t.BooleanLiteral]="Boolean",xt[_t.EOF]="",xt[_t.Identifier]="Identifier",xt[_t.Keyword]="Keyword",xt[_t.NullLiteral]="Null",xt[_t.NumericLiteral]="Numeric",xt[_t.Punctuator]="Punctuator",xt[_t.StringLiteral]="String",xt[_t.RegularExpression]="RegularExpression",bt={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpression",ConditionalExpression:"ConditionalExpression",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",UnaryExpression:"UnaryExpression"},wt={Data:1,Get:2,Set:4},kt={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},St={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},U.prototype=z.prototype={finish:function(){It.range&&(this.range[1]=At),It.loc&&(this.loc.end=new I,It.source&&(this.loc.source=It.source))},finishArrayExpression:function(t){return this.type=bt.ArrayExpression,this.elements=t,this.finish(),this},finishAssignmentExpression:function(t,e,n){return this.type=bt.AssignmentExpression,this.operator=t,this.left=e,this.right=n,this.finish(),this},finishBinaryExpression:function(t,e,n){return this.type="||"===t||"&&"===t?bt.LogicalExpression:bt.BinaryExpression,this.operator=t,this.left=e,this.right=n,this.finish(),this},finishCallExpression:function(t,e){return this.type=bt.CallExpression,this.callee=t,this.arguments=e,this.finish(),this},finishConditionalExpression:function(t,e,n){return this.type=bt.ConditionalExpression,this.test=t,this.consequent=e,this.alternate=n,this.finish(),this},finishExpressionStatement:function(t){return this.type=bt.ExpressionStatement,this.expression=t,this.finish(),this},finishIdentifier:function(t){return this.type=bt.Identifier,this.name=t,this.finish(),this},finishLiteral:function(t){return this.type=bt.Literal,this.value=t.value,this.raw=Mt.slice(t.start,t.end),t.regex&&("//"==this.raw&&(this.raw="/(?:)/"),this.regex=t.regex),this.finish(),this},finishMemberExpression:function(t,e,n){return this.type=bt.MemberExpression,this.computed="["===t,this.object=e,this.property=n,this.finish(),this},finishObjectExpression:function(t){return this.type=bt.ObjectExpression,this.properties=t,this.finish(),this},finishProgram:function(t){return this.type=bt.Program,this.body=t,this.finish(),this},finishProperty:function(t,e,n){return this.type=bt.Property,this.key=e,this.value=n,this.kind=t,this.finish(),this},finishUnaryExpression:function(t,e){return this.type=bt.UnaryExpression,this.operator=t,this.argument=e,this.prefix=!0,this.finish(),this}};var Nt={"if":1,"this":1};return{tokenize:vt,parse:yt}}()},{}],47:[function(t,e,n){function r(t){t="[Vega Log] "+t,console.log(t)}function i(t){t="[Vega Err] "+t,console.error(t)}function a(t,e){if(a.enable){var n=Function.prototype.bind.call(console.log,console),r={prevTime:Date.now()-s,stamp:t.stamp};t.add&&(r.add=t.add.length,r.mod=t.mod.length,r.rem=t.rem.length,r.reflow=!!t.reflow),n.apply(console,(e.push(JSON.stringify(r)),e)),s=Date.now()}}var s=Date.now();e.exports={log:r,error:i,debug:(a.enable=!1,a)}},{}],48:[function(t,e,n){e.exports={path:t("./path"),render:t("./render"),Item:t("./util/Item"),bound:t("./util/bound"),Bounds:t("./util/Bounds"),canvas:t("./util/canvas"),Gradient:t("./util/Gradient"),toJSON:t("./util/scene").toJSON,fromJSON:t("./util/scene").fromJSON}},{"./path":50,"./render":70,"./util/Bounds":76,"./util/Gradient":78,"./util/Item":80,"./util/bound":81,"./util/canvas":82,"./util/scene":84}],49:[function(t,e,n){function r(t,e,n,r,i,s,u,l,c){var d=o.call(arguments);if(a[d])return a[d];var f=u*(Math.PI/180),h=Math.sin(f),p=Math.cos(f);n=Math.abs(n),r=Math.abs(r);var g=p*(l-t)*.5+h*(c-e)*.5,m=p*(c-e)*.5-h*(l-t)*.5,v=g*g/(n*n)+m*m/(r*r);v>1&&(v=Math.sqrt(v),n*=v,r*=v);var y=p/n,_=h/n,x=-h/r,b=p/r,w=y*l+_*c,k=x*l+b*c,S=y*t+_*e,M=x*t+b*e,T=(S-w)*(S-w)+(M-k)*(M-k),A=1/T-.25;0>A&&(A=0);var E=Math.sqrt(A);s==i&&(E=-E);var L=.5*(w+S)-E*(M-k),C=.5*(k+M)+E*(S-w),D=Math.atan2(k-C,w-L),P=Math.atan2(M-C,S-L),I=P-D;0>I&&1===s?I+=2*Math.PI:I>0&&0===s&&(I-=2*Math.PI);for(var N=Math.ceil(Math.abs(I/(.5*Math.PI+.001))),O=[],z=0;N>z;++z){var U=D+z*I/N,j=D+(z+1)*I/N;O[z]=[L,C,U,j,n,r,h,p]}return a[d]=O}function i(t){var e=o.call(t);if(s[e])return s[e];var n=t[0],r=t[1],i=t[2],a=t[3],u=t[4],l=t[5],c=t[6],d=t[7],f=d*u,h=-c*l,p=c*u,g=d*l,m=Math.cos(i),v=Math.sin(i),y=Math.cos(a),_=Math.sin(a),x=.5*(a-i),b=Math.sin(.5*x),w=8/3*b*b/Math.sin(x),k=n+m-w*v,S=r+v+w*m,M=n+y,T=r+_,A=M+w*_,E=T-w*y;return s[e]=[f*k+h*S,p*k+g*S,f*A+h*E,p*A+g*E,f*M+h*T,p*M+g*T]}var a={},s={},o=[].join;e.exports={segments:r,bezier:i,cache:{segments:a,bezier:s}}},{}],50:[function(t,e,n){e.exports={parse:t("./parse"),render:t("./render")}},{"./parse":51,"./render":52}],51:[function(t,e,n){var r={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},i=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];e.exports=function(t){var e,n,a,s,o,u,l,c,d,f,h,p=[];for(e=t.slice().replace(i[0],"###$1").split(i[1]).slice(1),c=0,f=e.length;f>c;++c){for(n=e[c],a=n.slice(1).trim().replace(i[2],"$1###$2").split(i[3]),u=n.charAt(0),s=[u],d=0,h=a.length;h>d;++d)(o=+a[d])===o&&s.push(o);if(l=r[u.toLowerCase()],s.length-1>l)for(d=1,h=s.length;h>d;d+=l)p.push([u].concat(s.slice(d,d+l)));else p.push(s)}return p}},{}],52:[function(t,e,n){function r(t,e,n,r){for(var a=i.segments(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,n),s=0;sg;++g){switch(a=e[g],a[0]){case"l":d+=a[1],f+=a[2],t.lineTo(d+n,f+i);break;case"L":d=a[1],f=a[2],t.lineTo(d+n,f+i);break;case"h":d+=a[1],t.lineTo(d+n,f+i);break;case"H":d=a[1],t.lineTo(d+n,f+i);break;case"v":f+=a[1],t.lineTo(d+n,f+i);break;case"V":f=a[1],t.lineTo(d+n,f+i);break;case"m":d+=a[1],f+=a[2],t.moveTo(d+n,f+i);break;case"M":d=a[1],f=a[2],t.moveTo(d+n,f+i);break;case"c":s=d+a[5],o=f+a[6],h=d+a[3],p=f+a[4],t.bezierCurveTo(d+a[1]+n,f+a[2]+i,h+n,p+i,s+n,o+i),d=s,f=o;break;case"C":d=a[5],f=a[6],h=a[3],p=a[4],t.bezierCurveTo(a[1]+n,a[2]+i,h+n,p+i,d+n,f+i);break;case"s":s=d+a[3],o=f+a[4],h=2*d-h,p=2*f-p,t.bezierCurveTo(h+n,p+i,d+a[1]+n,f+a[2]+i,s+n,o+i),h=d+a[1],p=f+a[2],d=s,f=o;break;case"S":s=a[3],o=a[4],h=2*d-h,p=2*f-p,t.bezierCurveTo(h+n,p+i,a[1]+n,a[2]+i,s+n,o+i),d=s,f=o,h=a[1],p=a[2];break;case"q":s=d+a[3],o=f+a[4],h=d+a[1],p=f+a[2],t.quadraticCurveTo(h+n,p+i,s+n,o+i),d=s,f=o;break;case"Q":s=a[3],o=a[4],t.quadraticCurveTo(a[1]+n,a[2]+i,s+n,o+i),d=s,f=o,h=a[1],p=a[2];break;case"t":s=d+a[1],o=f+a[2],null===c[0].match(/[QqTt]/)?(h=d,p=f):"t"===c[0]?(h=2*d-u,p=2*f-l):"q"===c[0]&&(h=2*d-h,p=2*f-p),u=h,l=p,t.quadraticCurveTo(h+n,p+i,s+n,o+i),d=s,f=o,h=d+a[1],p=f+a[2];break;case"T":s=a[1],o=a[2],h=2*d-h,p=2*f-p,t.quadraticCurveTo(h+n,p+i,s+n,o+i),d=s,f=o;break;case"a":r(t,d+n,f+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+n,a[7]+f+i]),d+=a[6],f+=a[7];break;case"A":r(t,d+n,f+i,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+i]),d=a[6],f=a[7];break;case"z":case"Z":t.closePath()}c=a}}},{"./arc":49}],53:[function(t,e,n){function r(){this._active=null,this._handlers={}}var i=r.prototype;i.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.padding(e)},i.element=function(){return this._el},i.padding=function(t){return this._padding=t||{top:0,left:0,bottom:0,right:0},this},i.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},i.on=function(){},i.off=function(){},i.handlers=function(){var t,e=this._handlers,n=[];for(t in e)n.push.apply(n,e[t]);return n},i.eventName=function(t){var e=t.indexOf(".");return 0>e?t:t.slice(0,e)},e.exports=r},{}],54:[function(t,e,n){function r(){this._el=null,this._bgcolor=null}var i=r.prototype;i.initialize=function(t,e,n,r){return this._el=t,this.resize(e,n,r)},i.element=function(){return this._el},i.scene=function(){return this._el&&this._el.firstChild},i.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},i.resize=function(t,e,n){return this._width=t,this._height=e,this._padding=n||{top:0,left:0,bottom:0,right:0},this},i.render=function(){return this},e.exports=r},{}],55:[function(t,e,n){function r(){a.call(this),this._down=null,this._touch=null,this._first=!0}var i=t("../../util/dom"),a=t("../Handler"),s=t("./marks"),o=a.prototype,u=r.prototype=Object.create(o);u.constructor=r,u.initialize=function(t,e,n){var r=this._canvas=i.find(t,"canvas");if(r){var a=this;this.events.forEach(function(t){r.addEventListener(t,function(e){u[t]?u[t].call(a,e):a.fire(t,e)})})}return o.initialize.call(this,t,e,n)},u.canvas=function(){return this._canvas},u.context=function(){return this._canvas.getContext("2d")},u.events=["keydown","keypress","keyup","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],u.DOMMouseScroll=function(t){this.fire("mousewheel",t)},u.mousemove=function(t){var e=this._active,n=this.pickEvent(t);n===e?this.fire("mousemove",t):(this.fire("mouseout",t),this._active=n,this.fire("mouseover",t),this.fire("mousemove",t))},u.mouseout=function(t){this.fire("mouseout",t),this._active=null},u.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},u.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},u.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},u.touchmove=function(t){this.fire("touchmove",t,!0)},u.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},u.fire=function(t,e,n){var r,i,a=n?this._touch:this._active,s=this._handlers[t];if(s)for(e.vegaType=t,r=0,i=s.length;i>r;++r)s[r].handler.call(this._obj,e,a)},u.on=function(t,e){var n=this.eventName(t),r=this._handlers;return(r[n]||(r[n]=[])).push({type:t,handler:e}),this},u.off=function(t,e){var n,r=this.eventName(t),i=this._handlers[r];if(i){for(n=i.length;--n>=0;)i[n].type===t&&(e&&i[n].handler!==e||i.splice(n,1));return this}},u.pickEvent=function(t){var e,n,r=this._canvas.getBoundingClientRect(),i=this._padding;return this.pick(this._scene,e=t.clientX-r.left,n=t.clientY-r.top,e-i.left,n-i.top)},u.pick=function(t,e,n,r,i){var a=this.context(),o=s[t.marktype];return o.pick.call(this,a,t,e,n,r,i)},e.exports=r},{"../../util/dom":83,"../Handler":53,"./marks":62}],56:[function(t,e,n){function r(t){c.call(this),this._loader=new u(t)}function i(t,e){if(!e)return null;var n,r,i,s,u,l=new o;for(n=0,r=e.length;r>n;++n)i=e[n],s=i.mark,u=s.group,i=d[s.marktype].nested?s:i,l.union(a(i.bounds,u)),i["bounds:prev"]&&l.union(a(i["bounds:prev"],u));return l.round(),t.beginPath(),t.rect(l.x1,l.y1,l.width(),l.height()),t.clip(),l}function a(t,e){if(null==e)return t;for(var n=t.clone();null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}var s=t("../../util/dom"),o=t("../../util/Bounds"),u=t("../../util/ImageLoader"),l=t("../../util/canvas"),c=t("../Renderer"),d=t("./marks");r.RETINA=!0;var f=c.prototype,h=r.prototype=Object.create(f);h.constructor=r,h.initialize=function(t,e,n,r){return this._canvas=l.instance(e,n),t&&(s.clear(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),f.initialize.call(this,t,e,n,r)},h.resize=function(t,e,n){return f.resize.call(this,t,e,n),l.resize(this._canvas,this._width,this._height,this._padding,r.RETINA),this},h.canvas=function(){return this._canvas},h.context=function(){return this._canvas?this._canvas.getContext("2d"):null},h.pendingImages=function(){return this._loader.pending()},h.render=function(t,e){var n,r=this.context(),a=this._padding,s=this._width+a.left+a.right,o=this._height+a.top+a.bottom;return this._scene=t,r.save(),n=i(r,e),this.clear(-a.left,-a.top,s,o),this.draw(r,t,n),r.restore(),this._scene=null,this},h.draw=function(t,e,n){var r=d[e.marktype];r.draw.call(this,t,e,n)},h.clear=function(t,e,n,r){var i=this.context();i.clearRect(t,e,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,e,n,r))},h.loadImage=function(t){var e=this,n=this._scene;return this._loader.loadImage(t,function(){e.renderAsync(n)})},h.renderAsync=function(t){var e=this;e._async_id&&clearTimeout(e._async_id),e._async_id=setTimeout(function(){e.render(t),delete e._async_id},10)},e.exports=r},{"../../util/Bounds":76,"../../util/ImageLoader":79,"../../util/canvas":82,"../../util/dom":83,"../Renderer":54,"./marks":62}],57:[function(t,e,n){e.exports={Handler:t("./CanvasHandler"),Renderer:t("./CanvasRenderer")}},{"./CanvasHandler":55,"./CanvasRenderer":56}],58:[function(t,e,n){function r(t,e){var n=e.x||0,r=e.y||0,i=e.innerRadius||0,s=e.outerRadius||0,o=(e.startAngle||0)-a,u=(e.endAngle||0)-a;t.beginPath(),0===i?t.moveTo(n,r):t.arc(n,r,i,o,u,0),t.arc(n,r,s,u,o,1),t.closePath()}var i=t("./util"),a=Math.PI/2;e.exports={draw:i.drawAll(r),pick:i.pickPath(r)}},{"./util":69}],59:[function(t,e,n){function r(t,e){var n=e[0],r=n.pathCache||(n.pathCache=s(u(e)));o(t,r)}function i(t,e,n,r,i,a){var s=e.items,o=e.bounds;return!s||!s.length||o&&!o.contains(i,a)?null:(null!=t.pixelratio&&1!==t.pixelratio&&(n*=t.pixelratio,r*=t.pixelratio),l(t,s,n,r)?s[0]:null)}var a=t("./util"),s=t("../../../path/parse"),o=t("../../../path/render"),u=t("../../../util/svg").path.area,l=a.testPath(r); +e.exports={draw:a.drawOne(r),pick:i,nested:!0}},{"../../../path/parse":51,"../../../path/render":52,"../../../util/svg":85,"./util":69}],60:[function(t,e,n){function r(t,e,n){if(e.items&&e.items.length){var r,i,o,u,l,c,d,f,h,p,g,m,v,y=e.items,_=this;for(p=0,g=y.length;g>p;++p){for(r=y[p],o=r.axisItems||s,i=r.items||s,u=r.legendItems||s,l=r.x||0,c=r.y||0,d=r.width||0,f=r.height||0,(r.stroke||r.fill)&&(h=null==r.opacity?1:r.opacity,h>0&&(r.fill&&a.fill(t,r,h)&&t.fillRect(l,c,d,f),r.stroke&&a.stroke(t,r,h)&&t.strokeRect(l,c,d,f))),t.save(),t.translate(l,c),r.clip&&(t.beginPath(),t.rect(0,0,d,f),t.clip()),n&&n.translate(-l,-c),m=0,v=o.length;v>m;++m)"back"===o[m].layer&&_.draw(t,o[m],n);for(m=0,v=i.length;v>m;++m)_.draw(t,i[m],n);for(m=0,v=o.length;v>m;++m)"back"!==o[m].layer&&_.draw(t,o[m],n);for(m=0,v=u.length;v>m;++m)_.draw(t,u[m],n);n&&n.translate(l,c),t.restore()}}}function i(t,e,n,r,i,a){if(e.bounds&&!e.bounds.contains(i,a))return null;var o,u,l,c,d,f,h,p,g,m,v,y=e.items||s;for(g=y.length;--g>=0;)if(u=y[g],v=u.bounds,!v||v.contains(i,a)){for(l=u.axisItems||s,c=u.items||s,d=u.legendItems||s,h=u.x||0,p=u.y||0,t.save(),t.translate(h,p),h=i-h,p=a-p,m=d.length;--m>=0;)if(o=d[m],o.interactive!==!1&&(f=this.pick(o,n,r,h,p)))return t.restore(),f;for(m=l.length;--m>=0;)if(o=l[m],o.interactive!==!1&&"back"!==o.layer&&(f=this.pick(o,n,r,h,p)))return t.restore(),f;for(m=c.length;--m>=0;)if(o=c[m],o.interactive!==!1&&(f=this.pick(o,n,r,h,p)))return t.restore(),f;for(m=l.length;--m>=0;)if(o=l[m],o.interative!==!1&&"back"===o.layer&&(f=this.pick(o,n,r,h,p)))return t.restore(),f;if(t.restore(),e.interactive!==!1&&(u.fill||u.stroke)&&h>=0&&h<=u.width&&p>=0&&p<=u.height)return u}return null}var a=t("./util"),s=[];e.exports={draw:r,pick:i}},{"./util":69}],61:[function(t,e,n){function r(t,e,n){if(e.items&&e.items.length)for(var r,i=this,a=e.items,s=0,o=a.length;o>s;++s)if(r=a[s],!n||n.intersects(r.bounds)){r.image&&r.image.url===r.url||(r.image=i.loadImage(r.url),r.image.url=r.url);var u,l=r.x||0,c=r.y||0,d=r.width||r.image&&r.image.width||0,f=r.height||r.image&&r.image.height||0;l-="center"===r.align?d/2:"right"===r.align?d:0,c-="middle"===r.baseline?f/2:"bottom"===r.baseline?f:0,r.image.loaded&&(t.globalAlpha=null!=(u=r.opacity)?u:1,t.drawImage(r.image,l,c,d,f))}}var i=t("./util");e.exports={draw:r,pick:i.pick()}},{"./util":69}],62:[function(t,e,n){e.exports={arc:t("./arc"),area:t("./area"),group:t("./group"),image:t("./image"),line:t("./line"),path:t("./path"),rect:t("./rect"),rule:t("./rule"),symbol:t("./symbol"),text:t("./text")}},{"./arc":58,"./area":59,"./group":60,"./image":61,"./line":63,"./path":64,"./rect":65,"./rule":66,"./symbol":67,"./text":68}],63:[function(t,e,n){function r(t,e){var n=e[0],r=n.pathCache||(n.pathCache=s(u(e)));o(t,r)}function i(t,e,n,r,i,a){var s=e.items,o=e.bounds;return!s||!s.length||o&&!o.contains(i,a)?null:(null!=t.pixelratio&&1!==t.pixelratio&&(n*=t.pixelratio,r*=t.pixelratio),l(t,s,n,r)?s[0]:null)}var a=t("./util"),s=t("../../../path/parse"),o=t("../../../path/render"),u=t("../../../util/svg").path.line,l=a.testPath(r,!1);e.exports={draw:a.drawOne(r),pick:i,nested:!0}},{"../../../path/parse":51,"../../../path/render":52,"../../../util/svg":85,"./util":69}],64:[function(t,e,n){function r(t,e){if(null==e.path)return!0;var n=e.pathCache||(e.pathCache=a(e.path));s(t,n,e.x,e.y)}var i=t("./util"),a=t("../../../path/parse"),s=t("../../../path/render");e.exports={draw:i.drawAll(r),pick:i.pickPath(r)}},{"../../../path/parse":51,"../../../path/render":52,"./util":69}],65:[function(t,e,n){function r(t,e,n){if(e.items&&e.items.length)for(var r,a,s,o,u,l,c=e.items,d=0,f=c.length;f>d;++d)r=c[d],(!n||n.intersects(r.bounds))&&(a=null==r.opacity?1:r.opacity,0!==a&&(s=r.x||0,o=r.y||0,u=r.width||0,l=r.height||0,r.fill&&i.fill(t,r,a)&&t.fillRect(s,o,u,l),r.stroke&&i.stroke(t,r,a)&&t.strokeRect(s,o,u,l)))}var i=t("./util");e.exports={draw:r,pick:i.pick()}},{"./util":69}],66:[function(t,e,n){function r(t,e,n){if(e.items&&e.items.length)for(var r,i,a,o,u,l,c=e.items,d=0,f=c.length;f>d;++d)r=c[d],(!n||n.intersects(r.bounds))&&(i=null==r.opacity?1:r.opacity,0!==i&&(a=r.x||0,o=r.y||0,u=null!=r.x2?r.x2:a,l=null!=r.y2?r.y2:o,r.stroke&&s.stroke(t,r,i)&&(t.beginPath(),t.moveTo(a,o),t.lineTo(u,l),t.stroke())))}function i(t,e){var n=e.x||0,r=e.y||0,i=null!=e.x2?e.x2:n,a=null!=e.y2?e.y2:r,s=e.strokeWidth,o=e.strokeCap;t.lineWidth=null!=s?s:1,t.lineCap=null!=o?o:"butt",t.beginPath(),t.moveTo(n,r),t.lineTo(i,a)}function a(t,e,n,r){return t.isPointInStroke?(i(t,e),t.isPointInStroke(n,r)):!1}var s=t("./util");e.exports={draw:r,pick:s.pick(a)}},{"./util":69}],67:[function(t,e,n){function r(t,e){var n,r,i,o,u=null!=e.size?e.size:100,l=e.x,c=e.y;if(t.beginPath(),null==e.shape||"circle"===e.shape)return n=Math.sqrt(u/Math.PI),t.arc(l,c,n,0,2*Math.PI,0),void t.closePath();switch(e.shape){case"cross":n=Math.sqrt(u/5)/2,r=3*n,t.moveTo(l-r,c-n),t.lineTo(l-n,c-n),t.lineTo(l-n,c-r),t.lineTo(l+n,c-r),t.lineTo(l+n,c-n),t.lineTo(l+r,c-n),t.lineTo(l+r,c+n),t.lineTo(l+n,c+n),t.lineTo(l+n,c+r),t.lineTo(l-n,c+r),t.lineTo(l-n,c+n),t.lineTo(l-r,c+n);break;case"diamond":o=Math.sqrt(u/(2*s)),i=o*s,t.moveTo(l,c-o),t.lineTo(l+i,c),t.lineTo(l,c+o),t.lineTo(l-i,c);break;case"square":r=Math.sqrt(u),n=r/2,t.rect(l-n,c-n,r,r);break;case"triangle-down":i=Math.sqrt(u/a),o=i*a/2,t.moveTo(l,c+o),t.lineTo(l+i,c-o),t.lineTo(l-i,c-o);break;case"triangle-up":i=Math.sqrt(u/a),o=i*a/2,t.moveTo(l,c-o),t.lineTo(l+i,c+o),t.lineTo(l-i,c+o)}t.closePath()}var i=t("./util"),a=Math.sqrt(3),s=Math.tan(30*Math.PI/180);e.exports={draw:i.drawAll(r),pick:i.pickPath(r)}},{"./util":69}],68:[function(t,e,n){function r(t,e,n){if(e.items&&e.items.length)for(var r,i,a,s,l,c,d,f=e.items,h=0,p=f.length;p>h;++h)r=f[h],(!n||n.intersects(r.bounds))&&(d=o.value(r.text),d&&(i=null==r.opacity?1:r.opacity,0!==i&&(t.font=o.font(r),t.textAlign=r.align||"left",a=r.x||0,s=r.y||0,(l=r.radius)&&(c=(r.theta||0)-Math.PI/2,a+=l*Math.cos(c),s+=l*Math.sin(c)),r.angle&&(t.save(),t.translate(a,s),t.rotate(r.angle*Math.PI/180),a=s=0),a+=r.dx||0,s+=(r.dy||0)+o.offset(r),r.fill&&u.fill(t,r,i)&&t.fillText(d,a,s),r.stroke&&u.stroke(t,r,i)&&t.strokeText(d,a,s),r.angle&&t.restore())))}function i(t,e,n,r,i,a){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var o=s(e,l,!0),u=-e.angle*Math.PI/180,c=Math.cos(u),d=Math.sin(u),f=e.x,h=e.y,p=c*i-d*a+(f-f*c+h*d),g=d*i+c*a+(h-f*d-h*c);return o.contains(p,g)}var a=t("../../../util/Bounds"),s=t("../../../util/bound").text,o=t("../../../util/text"),u=t("./util"),l=new a;e.exports={draw:r,pick:u.pick(i)}},{"../../../util/Bounds":76,"../../../util/bound":81,"../../../util/text":86,"./util":69}],69:[function(t,e,n){function r(t,e,n,r){if(!t(e,r)){var i=null==n.opacity?1:n.opacity;0!==i&&(n.fill&&c(e,n,i)&&e.fill(),n.stroke&&d(e,n,i)&&e.stroke())}}function i(t,e,n,i){var a,s,o;for(a=0,s=n.items.length;s>a;++a)o=n.items[a],(!i||i.intersects(o.bounds))&&r(t,e,o,o)}function a(t){return function(e,n,r){i(t,e,n,r)}}function s(t){return function(e,n,i){n.items.length&&(!i||i.intersects(n.bounds))&&r(t,e,n.items[0],n.items)}}function o(t){return t||(t=p),function(e,n,r,i,a,s){if(!n.items.length)return null;var o,u,l;for(null!=e.pixelratio&&1!==e.pixelratio&&(r*=e.pixelratio,i*=e.pixelratio),l=n.items.length;--l>=0;)if(o=n.items[l],u=o.bounds,(!u||u.contains(a,s))&&u&&t(e,o,r,i,a,s))return o;return null}}function u(t,e){return function(n,r,i,a){var s,o,u=Array.isArray(r)?r[0]:r,l=null==e?u.fill:e,c=u.stroke&&n.isPointInStroke;return c&&(s=u.strokeWidth,o=u.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=o?o:"butt"),t(n,r)?!1:l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a)}}function l(t){return o(u(t))}function c(t,e,n){return n*=null==e.fillOpacity?1:e.fillOpacity,n>0?(t.globalAlpha=n,t.fillStyle=f(t,e,e.fill),!0):!1}function d(t,e,n){var r,i=null!=(i=e.strokeWidth)?i:1;return 0>=i?!1:(n*=null==e.strokeOpacity?1:e.strokeOpacity,n>0?(t.globalAlpha=n,t.strokeStyle=f(t,e,e.stroke),t.lineWidth=i,t.lineCap=null!=(r=e.strokeCap)?r:"butt",t.vgLineDash(e.strokeDash||null),t.vgLineDashOffset(e.strokeDashOffset||0),!0):!1)}function f(t,e,n){return n.id?h(t,n,e.bounds):n}function h(t,e,n){var r,i,a=n.width(),s=n.height(),o=n.x1+e.x1*a,u=n.y1+e.y1*s,l=n.x1+e.x2*a,c=n.y1+e.y2*s,d=t.createLinearGradient(o,u,l,c),f=e.stops;for(r=0,i=f.length;i>r;++r)d.addColorStop(f[r].offset,f[r].color);return d}var p=function(){return!0};e.exports={drawOne:s,drawAll:a,pick:o,pickPath:l,testPath:u,stroke:d,fill:c,color:f,gradient:h}},{}],70:[function(t,e,n){e.exports={canvas:t("./canvas"),svg:t("./svg")}},{"./canvas":57,"./svg":74}],71:[function(t,e,n){function r(){a.call(this)}var i=t("../../util/dom"),a=t("../Handler"),s=a.prototype,o=r.prototype=Object.create(s);o.constructor=r,o.initialize=function(t,e,n){return this._svg=i.find(t,"svg"),s.initialize.call(this,t,e,n)},o.svg=function(){return this._svg},o.listener=function(t){var e=this;return function(n){var r=n.target,i=r.__data__;n.vegaType=n.type,i=Array.isArray(i)?i[0]:i,t.call(e._obj,n,i)}},o.on=function(t,e){var n=this.eventName(t),r=this._svg,i=this._handlers,a={type:t,handler:e,listener:this.listener(e)};return(i[n]||(i[n]=[])).push(a),r.addEventListener(n,a.listener),this},o.off=function(t,e){var n,r=this.eventName(t),i=this._svg,a=this._handlers[r];if(a){for(n=a.length;--n>=0;)(a[n].type===t&&!e||a[n].handler===e)&&(i.removeEventListener(r,a[n].listener),a.splice(n,1));return this}},e.exports=r},{"../../util/dom":83,"../Handler":53}],72:[function(t,e,n){function r(t){c.call(this),this._loader=new l(t),this._dirtyID=0}function i(t,e,n){var r,i,a;for(t=f.child(t,n,"linearGradient",p),t.setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2),r=0,i=e.stops.length;i>r;++r)a=f.child(t,r,"stop",p),a.setAttribute("offset",e.stops[r].offset),a.setAttribute("stop-color",e.stops[r].color);f.clear(t,r)}function a(t,e,n){var r;t=f.child(t,n,"clipPath",p),t.setAttribute("id",e.id),r=f.child(t,0,"rect",p),r.setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",e.width),r.setAttribute("height",e.height)}function s(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function o(t,e,n,r,i){var a=f.child(t,r,e.tag,p,null,i);if(a.__data__=n,a.__values__={fill:"default"},"g"===e.tag){var s=f.child(a,0,"rect",p,"background");s.__data__=n}return n._svg=a}function u(t,e,n){e!==x[t]&&(null!=e?n?_.setAttributeNS(n,t,e):_.setAttribute(t,e):n?_.removeAttributeNS(n,t):_.removeAttribute(t),x[t]=e)}var l=t("../../util/ImageLoader"),c=t("../Renderer"),d=t("../../util/text"),f=t("../../util/dom"),h=t("../../util/svg"),p=h.metadata.xmlns,g=t("./marks"),m=c.prototype,v=r.prototype=Object.create(m);v.constructor=r,v.initialize=function(t,e,n,r){return t&&(this._svg=f.child(t,0,"svg",p,"marks"),f.clear(t,1),this._root=f.child(this._svg,0,"g",p),f.clear(this._svg,1)),this._defs={clip_id:1,gradient:{},clipping:{}},this.background(this._bgcolor),m.initialize.call(this,t,e,n,r)},v.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),m.background.apply(this,arguments)},v.resize=function(t,e,n){if(m.resize.call(this,t,e,n),this._svg){var r=this._width,i=this._height,a=this._padding;this._svg.setAttribute("width",r+a.left+a.right),this._svg.setAttribute("height",i+a.top+a.bottom),this._root.setAttribute("transform","translate("+a.left+","+a.top+")")}return this},v.svg=function(){if(!this._svg)return null;var t={"class":"marks",width:this._width+this._padding.left+this._padding.right,height:this._height+this._padding.top+this._padding.bottom};for(var e in h.metadata)t[e]=h.metadata[e];return f.openTag("svg",t)+this._svg.innerHTML+f.closeTag("svg")},v.imageURL=function(t){return this._loader.imageURL(t)},v.render=function(t,e){return this._dirtyCheck(e)&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t,-1),f.clear(this._root,1)),this.updateDefs(),this},v.draw=function(t,e,n){this.drawMark(t,e,n,g[e.marktype])},v.updateDefs=function(){var t,e=this._svg,n=this._defs,r=n.el,s=0;for(t in n.gradient)r||(r=n.el=f.child(e,0,"defs",p)),i(r,n.gradient[t],s++);for(t in n.clipping)r||(r=n.el=f.child(e,0,"defs",p)),a(r,n.clipping[t],s++);r&&(0===s?(e.removeChild(r),n.el=null):f.clear(r,s))},v._resetDefs=function(){var t=this._defs;t.clip_id=1,t.gradient={},t.clipping={}},v.isDirty=function(t){return this._dirtyAll||t.dirty===this._dirtyID},v._dirtyCheck=function(t){if(this._dirtyAll=!0,!t)return!0;var e,n,r,i,a,o,u,l=++this._dirtyID;for(a=0,o=t.length;o>a;++a)e=t[a],n=e.mark,n.marktype!==r&&(r=n.marktype,i=g[r]),"exit"!==e.status?(e=i.nest?n.items[0]:e,e._update!==l&&(e._svg?this._update(i,e._svg,e):(this._dirtyAll=!1,s(e,l)),e._update=l)):e._svg&&(i.nest&&e.mark.items.length?(this._update(i,e._svg,e.mark.items[0]),u=e.mark.items[0],u._svg=e._svg,u._update=l):f.remove(e._svg),e._svg=null);return!this._dirtyAll},v.drawMark=function(t,e,n,r){if(this.isDirty(e)){var i,a,s,u,l,c,d=r.nest?e.items&&e.items.length?[e.items[0]]:[]:e.items||[],h=e.interactive===!1?"none":null,g="g"===r.tag,m=f.cssClass(e);for(i=f.child(t,n+1,"g",p,m),i.setAttribute("class",m),e._svg=i,!g&&h&&i.style.setProperty("pointer-events",h),a=0,s=d.length;s>a;++a)this.isDirty(l=d[a])&&(c=!(this._dirtyAll||l._svg),u=o(i,r,l,a,c),this._update(r,u,l),g&&(c&&(this._dirtyAll=!0),this._recurse(u,l),c&&(this._dirtyAll=!1)));return f.clear(i,a),i}},v._recurse=function(t,e){var n,r,i=e.items||[],a=e.legendItems||[],s=e.axisItems||[],o=0;for(n=0,r=s.length;r>n;++n)"back"===s[n].layer&&this.drawMark(t,s[n],o++,g.group);for(n=0,r=i.length;r>n;++n)this.draw(t,i[n],o++);for(n=0,r=s.length;r>n;++n)"back"!==s[n].layer&&this.drawMark(t,s[n],o++,g.group);for(n=0,r=a.length;r>n;++n)this.drawMark(t,a[n],o++,g.group);f.clear(t,1+o)};var y="undefined"!=typeof window?window.location.href:"",_=null,x=null,b={group:function(t,e,n){_=e.childNodes[0],x=e.__values__,t.background(u,n,this);var r=n.mark.interactive===!1?"none":null;r!==x.events&&(_.style.setProperty("pointer-events",r),x.events=r)},text:function(t,e,n){var r=d.value(n.text);r!==x.text&&(e.textContent=r,x.text=r),r=d.font(n),r!==x.font&&(e.style.setProperty("font",r),x.font=r)}};v._update=function(t,e,n){_=e,x=e.__values__,t.attr(u,n,this);var r=b[t.type];r&&r(t,e,n),this.style(_,n)},v.style=function(t,e){if(null!=e){var n,r,i,a,s;for(n=0,r=h.styleProperties.length;r>n;++n)i=h.styleProperties[n],s=e[i],s!==x[i]&&(a=h.styles[i],null==s?"fill"===a?t.style.setProperty(a,"none"):t.style.removeProperty(a):(s.id&&(this._defs.gradient[s.id]=s,s="url("+y+"#"+s.id+")"),t.style.setProperty(a,s+"")),x[i]=s)}},e.exports=r},{"../../util/ImageLoader":79,"../../util/dom":83,"../../util/svg":85,"../../util/text":86,"../Renderer":54,"./marks":75}],73:[function(t,e,n){function r(t){o.call(this),this._loader=new u(t),this._text={head:"",root:"",foot:"",defs:"",body:""},this._defs={clip_id:1,gradient:{},clipping:{}}}function i(t,e,n,r){v[r||t]=e}function a(t,e,n,r){if(null==t)return"";var i,a,s,o,u,d="";for("bgrect"===n&&e.interactive===!1&&(d+="pointer-events: none;"),"text"===n&&(d+="font: "+c.font(t)+";"),i=0,a=l.styleProperties.length;a>i;++i)s=l.styleProperties[i],o=l.styles[s],u=t[s],null==u?"fill"===o&&(d+=(d.length?" ":"")+"fill: none;"):(u.id&&(r.gradient[u.id]=u,u="url(#"+u.id+")"),d+=(d.length?" ":"")+o+": "+u+";");return d?'style="'+d+'"':null}function s(t){return t.replace(/&/g,"&").replace(//g,">")}var o=t("../Renderer"),u=t("../../util/ImageLoader"),l=t("../../util/svg"),c=t("../../util/text"),d=t("../../util/dom"),f=d.openTag,h=d.closeTag,p=t("./marks"),g=o.prototype,m=r.prototype=Object.create(g);m.constructor=r,m.resize=function(t,e,n){g.resize.call(this,t,e,n);var r=this._padding,i=this._text,a={"class":"marks",width:this._width+r.left+r.right,height:this._height+r.top+r.bottom};for(var s in l.metadata)a[s]=l.metadata[s];return i.head=f("svg",a),i.root=f("g",{transform:"translate("+r.left+","+r.top+")"}),i.foot=h("g")+h("svg"),this},m.svg=function(){var t=this._text;return t.head+t.defs+t.root+t.body+t.foot},m.render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},m.reset=function(){return this._defs.clip_id=0,this},m.buildDefs=function(){var t,e,n,r,i=this._defs,a="";for(e in i.gradient){for(n=i.gradient[e],r=n.stops,a+=f("linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t0?f("defs")+a+h("defs"):""},m.imageURL=function(t){return this._loader.imageURL(t)};var v;m.attributes=function(t,e){return v={},t(i,e,this),v},m.mark=function(t){var e,n,r,i=p[t.marktype],o=i.tag,u=i.attr,l=i.nest||!1,g=l?t.items&&t.items.length?[t.items[0]]:[]:t.items||[],m=this._defs,v="";for("g"!==o&&t.interactive===!1&&(e='style="pointer-events: none;"'),v+=f("g",{"class":d.cssClass(t)},e),n=0;ne;++e)"back"===i[e].layer&&(r+=this.mark(i[e]));for(e=0,n=a.length;n>e;++e)r+=this.mark(a[e]);for(e=0,n=i.length;n>e;++e)"back"!==i[e].layer&&(r+=this.mark(i[e]));for(e=0,n=s.length;n>e;++e)r+=this.mark(s[e]);return r},e.exports=r},{"../../util/ImageLoader":79,"../../util/dom":83,"../../util/svg":85,"../../util/text":86,"../Renderer":54,"./marks":75}],74:[function(t,e,n){e.exports={Handler:t("./SVGHandler"),Renderer:t("./SVGRenderer"),string:{Renderer:t("./SVGStringRenderer")}}},{"./SVGHandler":71,"./SVGRenderer":72,"./SVGStringRenderer":73}],75:[function(t,e,n){function r(t){return i(t.x||0,t.y||0)}function i(t,e){return"translate("+t+","+e+")"}var a=t("../../util/text"),s=t("../../util/svg"),o=s.textAlign,u=s.path;e.exports={arc:{tag:"path",type:"arc",attr:function(t,e){t("transform",r(e)),t("d",u.arc(e))}},area:{tag:"path",type:"area",nest:!0,attr:function(t,e){var n=e.mark.items;n.length&&t("d",u.area(n))}},group:{tag:"g",type:"group",attr:function(t,e,n){var i,a,s=null;t("transform",r(e)),e.clip&&(i=n._defs,s=e.clip_id||(e.clip_id="clip"+i.clip_id++),a=i.clipping[s]||(i.clipping[s]={id:s}),a.width=e.width||0,a.height=e.height||0),t("clip-path",s?"url(#"+s+")":null)},background:function(t,e){t("class","background"),t("width",e.width||0),t("height",e.height||0)}},image:{tag:"image",type:"image",attr:function(t,e,n){var r=e.x||0,a=e.y||0,s=e.width||0,o=e.height||0,u=n.imageURL(e.url);r-="center"===e.align?s/2:"right"===e.align?s:0,a-="middle"===e.baseline?o/2:"bottom"===e.baseline?o:0,t("href",u,"http://www.w3.org/1999/xlink","xlink:href"),t("transform",i(r,a)),t("width",s),t("height",o)}},line:{tag:"path",type:"line",nest:!0,attr:function(t,e){var n=e.mark.items;n.length&&t("d",u.line(n))}},path:{tag:"path",type:"path",attr:function(t,e){t("transform",r(e)),t("d",e.path)}},rect:{tag:"rect",type:"rect",nest:!1,attr:function(t,e){t("transform",r(e)),t("width",e.width||0),t("height",e.height||0)}},rule:{tag:"line",type:"rule",attr:function(t,e){t("transform",r(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)}},symbol:{tag:"path",type:"symbol",attr:function(t,e){t("transform",r(e)),t("d",u.symbol(e))}},text:{tag:"text",type:"text",nest:!1,attr:function(t,e){var n,r=e.dx||0,s=(e.dy||0)+a.offset(e),u=e.x||0,l=e.y||0,c=e.angle||0,d=e.radius||0;d&&(n=(e.theta||0)-Math.PI/2,u+=d*Math.cos(n),l+=d*Math.sin(n)),t("text-anchor",o[e.align]||"start"),c?(n=i(u,l)+" rotate("+c+")",(r||s)&&(n+=" "+i(r,s))):n=i(u+r,l+s),t("transform",n)}}}},{"../../util/svg":85,"../../util/text":86}],76:[function(t,e,n){function r(t){this.clear(),t&&this.union(t)}var i=r.prototype;i.clone=function(){return new r(this)},i.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},i.set=function(t,e,n,r){return this.x1=t,this.y1=e,this.x2=n,this.y2=r,this},i.add=function(t,e){return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},i.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},i.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},i.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},i.rotate=function(t,e,n){var r=Math.cos(t),i=Math.sin(t),a=e-e*r+n*i,s=n-e*i-n*r,o=this.x1,u=this.x2,l=this.y1,c=this.y2;return this.clear().add(r*o-i*l+a,i*o+r*l+s).add(r*o-i*c+a,i*o+r*c+s).add(r*u-i*l+a,i*u+r*l+s).add(r*u-i*c+a,i*u+r*c+s)},i.union=function(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},i.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},i.intersects=function(t){return t&&!(this.x2t.x2||this.y2t.y2)},i.contains=function(t,e){return!(tthis.x2||ethis.y2)},i.width=function(){return this.x2-this.x1},i.height=function(){return this.y2-this.y1},e.exports=r},{}],77:[function(t,e,n){e.exports=function(t){function e(){}function n(e,n){t.add(e,n)}return{bounds:function(e){return arguments.length?(t=e,this):t},beginPath:e,closePath:e,moveTo:n,lineTo:n,quadraticCurveTo:function(e,n,r,i){t.add(e,n),t.add(r,i)},bezierCurveTo:function(e,n,r,i,a,s){t.add(e,n),t.add(r,i),t.add(a,s)}}}},{}],78:[function(t,e,n){function r(t){this.id="gradient_"+i++,this.type=t||"linear",this.stops=[],this.x1=0,this.x2=1,this.y1=0,this.y2=0}var i=0,a=r.prototype;a.stop=function(t,e){return this.stops.push({offset:t,color:e}),this},e.exports=r},{}],79:[function(t,e,n){(function(n){function r(t){this._pending=0,this._config=t||r.Config}function i(t,e){var n=s.sanitizeUrl(this.params(t));if(!n)return e&&e(t,null),null;var r=this,i=new Image;return r._pending+=1,i.onload=function(){r._pending-=1,i.loaded=!0,e&&e(null,i)},i.src=n,i}function a(t,e){var r=this,i=new("undefined"!=typeof window?window.canvas:"undefined"!=typeof n?n.canvas:null).Image;return r._pending+=1,s(this.params(t),function(t,n){return r._pending-=1,t?(e&&e(t,null),null):(i.src=n,i.loaded=!0,void(e&&e(null,i)))}),i}var s=t("datalib/src/import/load");r.Config=null;var o=r.prototype;o.pending=function(){return this._pending},o.params=function(t){var e,n={url:t};for(e in this._config)n[e]=this._config[e];return n},o.imageURL=function(t){return s.sanitizeUrl(this.params(t))},o.loadImage=function(t,e){return s.useXHR?i.call(this,t,e):a.call(this,t,e)},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"datalib/src/import/load":22}],80:[function(t,e,n){function r(t){this.mark=t}var i=r.prototype;i.hasPropertySet=function(t){var e=this.mark.def.properties;return e&&null!=e[t]},i.cousin=function(t,e){if(0===t)return this;t=t||-1;var n=this.mark,r=n.group,i=null==e?n.items.indexOf(this):e,a=r.items.indexOf(n)+t;return r.items[a].items[i]},i.sibling=function(t){if(0===t)return this;t=t||-1;var e=this.mark,n=e.items.indexOf(this)+t;return e.items[n]},i.remove=function(){var t=this,e=t.mark.items,n=e.indexOf(t);return n>=0&&(n===e.length-1?e.pop():e.splice(n,1)),t},i.touch=function(){this.pathCache&&(this.pathCache=null)},e.exports=r},{}],81:[function(t,e,n){function r(){return D||(D=x.instance(1,1).getContext("2d"))}function i(t,e){return t.stroke&&0!==t.opacity&&0!==t.stokeOpacity&&e.expand(null!=t.strokeWidth?t.strokeWidth:1),e}function a(t,e,n,r,a){return null==e?n.set(0,0,0,0):(M(P.bounds(n),e,r,a),i(t,n)),n}function s(t,e){var n=t.path?t.pathCache||(t.pathCache=S(t.path)):null;return a(t,n,e,t.x,t.y)}function o(t,e){if(0===t.items.length)return e;var n=t.items,r=n[0],i=r.pathCache||(r.pathCache=S(T(n)));return a(r,i,e)}function u(t,e){if(0===t.items.length)return e;var n=t.items,r=n[0],i=r.pathCache||(r.pathCache=S(A(n)));return a(r,i,e)}function l(t,e){var n,r;return i(t,e.set(n=t.x||0,r=t.y||0,n+t.width||0,r+t.height||0))}function c(t,e){var n=t.x||0,r=t.y||0,i=t.width||0,a=t.height||0;return n-="center"===t.align?i/2:"right"===t.align?i:0,r-="middle"===t.baseline?a/2:"bottom"===t.baseline?a:0,e.set(n,r,n+i,r+a)}function d(t,e){var n,r;return i(t,e.set(n=t.x||0,r=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:r))}function f(t,e){var n,r,a,s,o,u,l,c,d,f=t.x||0,h=t.y||0,p=t.innerRadius||0,g=t.outerRadius||0,m=(t.startAngle||0)-E,v=(t.endAngle||0)-E,y=1/0,_=-(1/0),x=1/0,b=-(1/0),w=[m,v],k=m-m%E;for(r=0;4>r&&v>k;++r,k+=E)w.push(k);for(r=0,a=w.length;a>r;++r)n=w[r],s=Math.cos(n),u=p*s,c=g*s,o=Math.sin(n),l=p*o,d=g*o,y=Math.min(y,u,c),_=Math.max(_,u,c),x=Math.min(x,l,d),b=Math.max(b,l,d);return i(t,e.set(f+y,h+x,f+_,h+b))}function h(t,e){var n,r,a,s,o=null!=t.size?t.size:100,u=t.x||0,l=t.y||0;switch(t.shape){case"cross":r=3*Math.sqrt(o/5)/2,e.set(u-r,l-r,u+r,l+r);break;case"diamond":s=Math.sqrt(o/(2*C)),a=s*C,e.set(u-a,l-s,u+a,l+s);break;case"square":r=Math.sqrt(o),n=r/2,e.set(u-n,l-n,u+n,l+n);break;case"triangle-down":a=Math.sqrt(o/L),s=a*L/2,e.set(u-a,l-s,u+a,l+s);break;case"triangle-up":a=Math.sqrt(o/L),s=a*L/2,e.set(u-a,l-s,u+a,l+s);break;default:n=Math.sqrt(o/Math.PI),e.set(u-n,l-n,u+n,l+n)}return i(t,e)}function p(t,e,n){var i,a,s=r(),o=w.size(t),u=t.align,l=t.radius||0,c=t.x||0,d=t.y||0,f=t.dx||0,h=(t.dy||0)+w.offset(t)-Math.round(.8*o);return l&&(a=(t.theta||0)-Math.PI/2,c+=l*Math.cos(a),d+=l*Math.sin(a)),s.font=w.font(t),i=s.measureText(w.value(t.text)).width,"center"===u?f-=i/2:"right"===u&&(f-=i),e.set(f+=c,h+=d,f+i,h+o),t.angle&&!n&&e.rotate(t.angle*Math.PI/180,c,d),e.expand(n?0:1)}function g(t,e,n){var r,a,s=t.axisItems||[],o=t.items||[],u=t.legendItems||[];if(!t.clip){for(r=0,a=s.length;a>r;++r)e.union(s[r].bounds);for(r=0,a=o.length;a>r;++r)e.union(o[r].bounds);if(n)for(r=0,a=u.length;a>r;++r)e.union(u[r].bounds)}return(t.clip||t.width||t.height)&&i(t,e.add(0,0).add(t.width||0,t.height||0)),e.translate(t.x||0,t.y||0)}function m(t,e,n){var r=t.mark.marktype;e=e||I[r],e.nest&&(t=t.mark);var i=t.bounds,a=t["bounds:prev"]||(t["bounds:prev"]=new _);return i?(a.clear().union(i),i.clear()):t.bounds=new _,e(t,t.bounds,n),i||a.clear().union(t.bounds),t.bounds}function v(t,e,n){var r,i,a,s,o=t.marktype,u=I[o],l=t.items,c=l&&l.length;if(u.nest)return a=c?l[0]:(N.mark=t,N),s=m(a,u,n),e=e&&e.union(s)||s;if(e=e||t.bounds&&t.bounds.clear()||new _,c)for(r=0,i=l.length;i>r;++r)e.union(m(l[r],u,n));return t.bounds=e}var y=t("./BoundsContext"),_=t("./Bounds"),x=t("./canvas"),b=t("./svg"),w=t("./text"),k=t("../path"),S=k.parse,M=k.render,T=b.path.area,A=b.path.line,E=Math.PI/2,L=Math.sqrt(3),C=Math.tan(30*Math.PI/180),D=null,P=y(),I={group:g,symbol:h,image:c,rect:l,rule:d,arc:f,text:p,path:s,area:o,line:u};I.area.nest=!0,I.line.nest=!0;var N={mark:null};e.exports={mark:v,item:m,text:p,group:g}},{"../path":50,"./Bounds":76,"./BoundsContext":77,"./canvas":82,"./svg":85,"./text":86}],82:[function(t,e,n){(function(t){function n(e,n){e=e||1,n=n||1;var r;if("undefined"!=typeof document&&document.createElement)r=document.createElement("canvas"),r.width=e,r.height=n;else{var i="undefined"!=typeof window?window.canvas:"undefined"!=typeof t?t.canvas:null;if(!i.prototype)return null;r=new i(e,n)}return a(r)}function r(t,e,n,r,a){var s=this._ctx=t.getContext("2d"),o=1;return t.width=e+r.left+r.right,t.height=n+r.top+r.bottom,a&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&(s.pixelratio=o=i(t)||1),s.setTransform(o,0,0,o,o*r.left,o*r.top),t}function i(t){var e=t.getContext("2d"),n=window&&window.devicePixelRatio||1,r=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1,i=n/r;if(n!==r){var a=t.width,s=t.height;t.width=a*i,t.height=s*i,t.style.width=a+"px",t.style.height=s+"px"}return i}function a(t){var e=t.getContext("2d");if(!e.vgLineDash){var n=function(){},r=[];return e.setLineDash?(e.vgLineDash=function(t){this.setLineDash(t||r)},e.vgLineDashOffset=function(t){this.lineDashOffset=t}):void 0!==e.webkitLineDash?(e.vgLineDash=function(t){this.webkitLineDash=t||r},e.vgLineDashOffset=function(t){this.webkitLineDashOffset=t}):void 0!==e.mozDash?(e.vgLineDash=function(t){this.mozDash=t},e.vgLineDashOffset=n):(e.vgLineDash=n,e.vgLineDashOffset=n),t}}e.exports={instance:n,resize:r,lineDash:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],83:[function(t,e,n){function r(t,e,n){return n?t.createElementNS(n,e):t.createElement(e)}function i(t){if(t){var e=t.parentNode;e&&(e.removeChild(t),e.childNodes&&e.childNodes.length||i(e))}}e.exports={find:function(t,e){e=e.toLowerCase();for(var n=0,r=t.childNodes.length;r>n;++n)if(t.childNodes[n].tagName.toLowerCase()===e)return t.childNodes[n]},child:function(t,e,n,i,a,s){var o,u;return o=u=t.childNodes[e],(!o||s||o.tagName.toLowerCase()!==n.toLowerCase()||a&&o.getAttribute("class")!=a)&&(o=r(t.ownerDocument,n,i),t.insertBefore(o,u),a&&o.setAttribute("class",a)),o},clear:function(t,e){for(var n=t.childNodes.length;n>e;)t.removeChild(t.childNodes[--n]);return t},remove:i,cssClass:function(t){return"mark-"+t.marktype+(t.name?" "+t.name:"")},openTag:function(t,e,n){var r,i,a="<"+t;if(e)for(r in e)i=e[r],null!=i&&(a+=" "+r+'="'+i+'"');return n&&(a+=" "+n),a+">"},closeTag:function(t){return""}}},{}],84:[function(t,e,n){function r(t,e){return JSON.stringify(t,u,e)}function i(t){var e="string"==typeof t?JSON.parse(t):t;return a(e)}function a(t){var e,n,r,i,u,l=t.marktype;for(r=0,i=o.length;i>r;++r)if(u=t[o[r]])for(e=0,n=u.length;n>e;++e)u[e][l?"mark":"group"]=t,l&&"group"!==l||a(u[e]);return l&&s.mark(t),t}var s=t("../util/bound"),o=["items","axisItems","legendItems"],u=["marktype","name","interactive","clip","items","axisItems","legendItems","layer","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","interpolate","tension","orient","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];e.exports={toJSON:r,fromJSON:i}},{"../util/bound":81}],85:[function(t,e,n){(function(t){function n(t){return t.x||0}function r(t){return t.y||0}function i(t){return(t.x||0)+(t.width||0)}function a(t){return(t.y||0)+(t.height||0)}function s(t){return null==t.size?100:t.size}function o(t){return t.shape||"circle"}var u=("undefined"!=typeof window?window.d3:"undefined"!=typeof t?t.d3:null).svg,l=u.area().x(n).y1(r).y0(a),c=u.area().y(r).x1(n).x0(i),d=u.line().x(n).y(r);e.exports={metadata:{version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},path:{arc:u.arc(),symbol:u.symbol().type(o).size(s),area:function(t){var e=t[0];return("horizontal"===e.orient?c:l).interpolate(e.interpolate||"linear").tension(e.tension||.7)(t)},line:function(t){var e=t[0];return d.interpolate(e.interpolate||"linear").tension(e.tension||.7)(t)}},textAlign:{left:"start",center:"middle",right:"end"},textBaseline:{top:"before-edge",bottom:"after-edge",middle:"central"},styles:{fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeWidth:"stroke-width",strokeOpacity:"stroke-opacity",strokeCap:"stroke-linecap",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",opacity:"opacity"},styleProperties:["fill","fillOpacity","stroke","strokeWidth","strokeOpacity","strokeCap","strokeDash","strokeDashOffset","opacity"] +}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],86:[function(t,e,n){function r(t){return null!=t.fontSize?t.fontSize:11}e.exports={size:r,value:function(t){return null!=t?String(t):""},font:function(t,e){var n=t.font;return e&&n&&(n=String(n).replace(/\"/g,"'")),""+(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+r(t)+"px "+(n||"sans-serif")},offset:function(t){var e=t.baseline,n=r(t);return Math.round("top"===e?.93*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}}},{}],87:[function(t,e,n){function r(t,e,n){o.call(null,t,e,n),this._type="canvas",this._renderers={canvas:a,svg:s}}var i=t("vega-scenegraph").render,a=i.canvas,s=i.svg.string,o=t("./View"),u=r.prototype=new o;u.renderer=function(t){return t&&(this._type=t),o.prototype.renderer.apply(this,arguments)},u.canvas=function(){return"canvas"===this._type?this._renderer.canvas():null},u.canvasAsync=function(t){function e(){0===n.pendingImages()?(r.render(),t(r.canvas())):setTimeout(e,10)}var n=this._renderer,r=this;return"canvas"!==this._type?null:void(n.pendingImages()>0?e():t(this.canvas()))},u.svg=function(){return"svg"===this._type?this._renderer.svg():null},u.initialize=function(){var t=this._width,e=this._height,n=this._bgcolor,r=this._padding,i=this.model().config();return this._viewport&&(t=this._viewport[0]-(r?r.left+r.right:0),e=this._viewport[1]-(r?r.top+r.bottom:0)),this._renderer=(this._renderer||new this._io.Renderer(i.load)).initialize(null,t,e,r).background(n),this},e.exports=r},{"./View":89,"vega-scenegraph":48}],88:[function(t,e,n){function r(t){this._defs={},this._predicates={},this._scene=null,this._node=null,this._builder=null,this._reset={axes:!1,legends:!1},this.config(t),u.init.call(this)}function i(t){var e=this,n={};return a.isArray(t)?(t.forEach(function(t){n[t]=e._predicates[t]}),n):this._predicates[t]}var a=t("datalib"),s=t("vega-dataflow"),o=s.ChangeSet,u=s.Graph.prototype,l=s.Node,c=t("../scene/GroupBuilder"),d=t("../scene/visit"),f=t("./config"),h=r.prototype=Object.create(u);h.constructor=r,h.defs=function(t){return arguments.length?(this._defs=t,this):this._defs},h.config=function(t){if(!arguments.length)return this._config;this._config=Object.create(f);for(var e in t){var n=t[e],r=this._config[e];a.isObject(n)&&a.isObject(r)?a.extend(r,n):this._config[e]=n}return this},h.width=function(t){return this._defs&&(this._defs.width=t),this._defs&&this._defs.marks&&(this._defs.marks.width=t),this._scene&&(this._scene.items[0].width=t,this._scene.items[0]._dirty=!0),this._reset.axes=!0,this},h.height=function(t){return this._defs&&(this._defs.height=t),this._defs&&this._defs.marks&&(this._defs.marks.height=t),this._scene&&(this._scene.items[0].height=t,this._scene.items[0]._dirty=!0),this._reset.axes=!0,this},h.node=function(){return this._node||(this._node=new l(this))},h.data=function(){var t=u.data.apply(this,arguments);return arguments.length>1&&this.node().addListener(t.pipeline()[0]),t},h.predicate=function(t,e){return 1===arguments.length?i.call(this,t):this._predicates[t]=e},h.predicates=function(){return this._predicates},h.scene=function(t){if(!arguments.length)return this._scene;this._builder&&this.node().removeListener(this._builder.disconnect()),this._builder=new c(this,this._defs.marks,this._scene={}),this.node().addListener(this._builder.connect());var e=this._builder.pipeline();return e[e.length-1].addListener(t),this},h.reset=function(){return this._scene&&this._reset.axes&&(d(this._scene,function(t){t.axes&&t.axes.forEach(function(t){t.reset()})}),this._reset.axes=!1),this._scene&&this._reset.legends&&(d(this._scene,function(t){t.legends&&t.legends.forEach(function(t){t.reset()})}),this._reset.legends=!1),this},h.addListener=function(t){this.node().addListener(t)},h.removeListener=function(t){this.node().removeListener(t)},h.fire=function(t){t||(t=o.create()),this.propagate(t,this.node())},e.exports=r},{"../scene/GroupBuilder":112,"../scene/visit":117,"./config":90,datalib:26,"vega-dataflow":41}],89:[function(t,e,n){(function(n){function r(t,e,n){this._el=null,this._model=null,this._width=this.__width=e||500,this._height=this.__height=n||300,this._bgcolor=null,this._autopad=1,this._padding={top:0,left:0,bottom:0,right:0},this._viewport=null,this._renderer=null,this._handler=null,this._streamer=null,this._changeset=null,this._repaint=!0,this._renderers=l,this._io=null,this._api={}}function i(t){var e=this,n=this._model.data(t),r=n.name(),i=n.pipeline()[0],a=this._streamer,s={};return this._api[t]?this._api[t]:(s.insert=function(t){return n.insert(o.duplicate(t)),a.addListener(i),e._changeset.data[r]=1,s},s.update=function(){return a.addListener(i),e._changeset.data[r]=1,n.update.apply(n,arguments),s},s.remove=function(){return a.addListener(i),e._changeset.data[r]=1,n.remove.apply(n,arguments),s},s.values=function(){return n.values()},this._api[t]=s)}function a(){var t=this;return t._renderNode=new u.Node(t._model).router(!0),t._renderNode.evaluate=function(e){c.debug(e,["rendering"]);var n=t._model.scene(),r=t._handler;r&&r.scene&&r.scene(n),e.trans?e.trans.start(function(e){t._renderer.render(n,e)}):t._repaint?(t._renderer.render(n),t._repaint=!1):e.dirty.length&&t._renderer.render(n,e.dirty),e.dirty.length&&(e.dirty.forEach(function(t){t._dirty=!1}),n.items[0]._dirty=!1);for(var i in e.data)t._model.data(i).synchronize();return e},t._model.scene(t._renderNode),!0}var s="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,o=t("datalib"),u=t("vega-dataflow"),l=t("vega-scenegraph").render,c=t("vega-logging"),d=u.Dependencies,f=t("../parse/streams"),h=t("../scene/Encoder"),p=t("../scene/Transition"),g=r.prototype;g.model=function(t){return arguments.length?(this._model!==t&&(this._model=t,this._streamer=new u.Node(t),this._streamer._rank=-1,this._changeset=u.ChangeSet.create(),this._handler&&this._handler.model(t)),this):this._model},g.data=function(t){var e=this;return arguments.length?o.isString(t)?i.call(e,t):(o.isObject(t)&&o.keys(t).forEach(function(n){var r=i.call(e,n);t[n](r)}),this):e._model.values()},g.signal=function(t,e,n){var r,i=this._model,a=this._changeset,s=this._streamer;return arguments.length?1===arguments.length&&o.isString(t)?i.values(d.SIGNALS,t):(o.isObject(t)?(r=t,n=e):(r={},r[t]=e),o.keys(r).forEach(function(t){s.addListener(i.signal(t).value(r[t])),n!==!1&&(a.signals[t]=1),a.reflow=!0}),this):i.values(d.SIGNALS)},g.width=function(t){return arguments.length?(this.__width!==t&&(this._width=this.__width=t,this.model().width(t),this.initialize(),this._strict&&(this._autopad=1)),this):this.__width},g.height=function(t){return arguments.length?(this.__height!==t&&(this._height=this.__height=t,this.model().height(t),this.initialize(),this._strict&&(this._autopad=1)),this):this.__height},g.background=function(t){return arguments.length?(this._bgcolor!==t&&(this._bgcolor=t,this.initialize()),this):this._bgcolor},g.padding=function(t){return arguments.length?(this._padding!==t&&(o.isString(t)?(this._autopad=1,this._padding={top:0,left:0,bottom:0,right:0},this._strict="strict"===t):(this._autopad=0,this._padding=t,this._strict=!1),this._renderer&&this._renderer.resize(this._width,this._height,t),this._handler&&this._handler.padding(t)),this._repaint=!0,this):this._padding},g.autopad=function(t){if(this._autopad<1)return this;this._autopad=0;var e=this.model().scene().bounds,n=this._padding,r=this.model().config(),i=r.autopadInset,a=e.x1<0?Math.ceil(-e.x1)+i:0,s=e.y1<0?Math.ceil(-e.y1)+i:0,o=e.x2>this._width?Math.ceil(+e.x2-this._width)+i:0;return e=e.y2>this._height?Math.ceil(+e.y2-this._height)+i:0,n={left:a,top:s,right:o,bottom:e},this._strict?(this._autopad=0,this._padding=n,this._width=Math.max(0,this.__width-(a+o)),this._height=Math.max(0,this.__height-(s+e)),this._model.width(this._width).height(this._height).reset(),this.initialize().update({props:"enter"}).update({props:"update"})):this.padding(n).update(t),this},g.viewport=function(t){return arguments.length?(this._viewport!==t&&(this._viewport=t,this.initialize()),this):this._viewport},g.renderer=function(t){if(!arguments.length)return this._renderer;if(this._renderers[t])t=this._renderers[t];else{if(o.isString(t))throw new Error("Unknown renderer: "+t);if(!t)throw new Error("No renderer specified")}return this._io!==t&&(this._io=t,this._renderer=null,this.initialize(),this._build&&this.render()),this},g.initialize=function(t){var e,n=this,r=n._width,i=n._height,a=n._padding,o=n._bgcolor,u=this.model().config();return arguments.length&&null!==t||(t=this._el?this._el.parentNode:null)?(s.select(t).select("div.vega").remove(),this._el=t=s.select(t).append("div").attr("class","vega").style("position","relative").node(),n._viewport&&s.select(t).style("width",(n._viewport[0]||r)+"px").style("height",(n._viewport[1]||i)+"px").style("overflow","auto"),l.canvas.Renderer.RETINA=u.render.retina,n._renderer=(n._renderer||new this._io.Renderer(u.load)).initialize(t,r,i,a).background(o),e=n._handler,n._handler=(new this._io.Handler).initialize(t,a,n),e?e.handlers().forEach(function(t){n._handler.on(t.type,t.handler)}):n._detach=f(this),this._repaint=!0,this):this},g.destroy=function(){this._detach&&this._detach()},g.update=function(t){t=t||{};var e=this,n=t.duration?new p(t.duration,t.ease):null,r=e._changeset;if(n&&(r.trans=n),void 0!==t.props){if(o.keys(r.data).length>0)throw Error("New data values are not reflected in the visualization. Please call view.update() before updating a specified property set.");r.reflow=!0,r.request=t.props}var i=e._build;return e._build=e._build||a.call(this),t.items&&i?(h.update(this._model,t.trans,t.props,t.items,r.dirty),e._renderNode.evaluate(r)):e._streamer.listeners().length&&i?(e._model.propagate(r,e._streamer),e._streamer.disconnect()):e._model.fire(r),e._changeset=u.ChangeSet.create(),e.autopad(t)},g.toImageURL=function(t){var e,n=this;switch(t||"png"){case"canvas":case"png":e=l.canvas.Renderer;break;case"svg":e=l.svg.string.Renderer;break;default:throw Error("Unrecognized renderer type: "+t)}var r=l.canvas.Renderer.RETINA;l.canvas.Renderer.RETINA=!1;var i=new e(n._model.config.load).initialize(null,n._width,n._height,n._padding).render(n._model.scene());if(l.canvas.Renderer.RETINA=r,"svg"===t){var a=new Blob([i.svg()],{type:"image/svg+xml"});return window.URL.createObjectURL(a)}return i.canvas().toDataURL("image/png")},g.render=function(t){return this._renderer.render(this._model.scene(),t),this},g.on=function(){return this._handler.on.apply(this._handler,arguments),this},g.onSignal=function(t,e){return this._model.signal(t).on(e),this},g.off=function(){return this._handler.off.apply(this._handler,arguments),this},g.offSignal=function(t,e){return this._model.signal(t).off(e),this},r.factory=function(e){var n=t("./HeadlessView");return function(t){t=t||{};var i=e.defs(),a=(t.el?new r:new n).model(e).renderer(t.renderer||"canvas").width(i.width).height(i.height).background(i.background).padding(i.padding).viewport(i.viewport).initialize(t.el);return t.data&&a.data(t.data),t.hover!==!1&&t.el&&a.on("mouseover",function(t,e){e&&e.hasPropertySet("hover")&&this.update({props:"hover",items:e})}).on("mouseout",function(t,e){e&&e.hasPropertySet("hover")&&this.update({props:"update",items:e})}),a}},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../parse/streams":107,"../scene/Encoder":111,"../scene/Transition":114,"./HeadlessView":87,datalib:26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],90:[function(t,e,n){(function(t){var n="undefined"!=typeof window?window.d3:"undefined"!=typeof t?t.d3:null,r={};r.load={baseURL:"",domainWhiteList:!1},r.autopadInset=5,r.scale={time:n.time.scale,utc:n.time.scale.utc},r.render={retina:!0},r.axis={orient:"bottom",ticks:10,padding:3,axisColor:"#000",gridColor:"#000",gridOpacity:.15,tickColor:"#000",tickLabelColor:"#000",axisWidth:1,tickWidth:1,tickSize:6,tickLabelFontSize:11,tickLabelFont:"sans-serif",titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold",titleOffset:35},r.legend={orient:"right",offset:20,padding:3,gradientStrokeColor:"#888",gradientStrokeWidth:1,gradientHeight:16,gradientWidth:100,labelColor:"#000",labelFontSize:10,labelFont:"sans-serif",labelAlign:"left",labelBaseline:"middle",labelOffset:8,symbolShape:"circle",symbolSize:50,symbolColor:"#888",symbolStrokeWidth:1,titleColor:"#000",titleFont:"sans-serif",titleFontSize:11,titleFontWeight:"bold"},r.color={rgb:[128,128,128],lab:[50,0,0],hcl:[0,0,50],hsl:[0,0,.5]},r.range={category10:n.scale.category10().range(),category20:n.scale.category20().range(),category20b:n.scale.category20b().range(),category20c:n.scale.category20c().range(),shapes:["circle","cross","diamond","square","triangle-down","triangle-up"]},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],91:[function(t,e,n){function r(t,e,n){var r=t.schema;r&&(r.refs&&i.extend(n.refs,r.refs),r.defs&&i.extend(n.defs,r.defs))}var i=t("datalib"),a=t("../parse"),s=t("../scene/Scale"),o=t("./config");e.exports=function(t){var e=null;return t=t||{},t.url?e=i.json(i.extend({url:t.url},o.load)):(e={$schema:"http://json-schema.org/draft-04/schema#",title:"Vega Visualization Specification Language",defs:{},refs:{},$ref:"#/defs/spec"},i.keys(a).forEach(function(n){r(a[n],t,e)}),r(s,t,e)),t.properties&&i.keys(t.properties).forEach(function(n){e.defs.propset.properties[n]={$ref:"#/refs/"+t.properties[n]+"Value"}}),t.propertySets&&i.keys(t.propertySets).forEach(function(t){e.defs.mark.properties.properties.properties[t]={$ref:"#/defs/propset"}}),e}},{"../parse":97,"../scene/Scale":113,"./config":90,datalib:26}],92:[function(t,e,n){function r(t,e,n,r){var a=t.config();(e||[]).forEach(function(e,o){n[o]=n[o]||s(t),i(a,e,o,n[o],r)})}function i(t,e,n,r,i){void 0!==e.scale&&r.scale(i.scale(e.scale)),r.orient(e.orient||o[e.type]),r.offset(e.offset||0),r.layer(e.layer||"front"),r.grid(e.grid||!1),r.title(e.title||null),r.titleOffset(null!=e.titleOffset?e.titleOffset:t.axis.titleOffset),r.tickValues(e.values||null),r.tickFormat(e.format||null),r.tickFormatType(e.formatType||null),r.tickSubdivide(e.subdivide||0),r.tickPadding(e.tickPadding||t.axis.padding);var s=[];if(void 0!==e.tickSize)for(var u=0;3>u;++u)s.push(e.tickSize);else{var l=t.axis.tickSize;s=[l,l,l]}null!=e.tickSizeMajor&&(s[0]=e.tickSizeMajor),null!=e.tickSizeMinor&&(s[1]=e.tickSizeMinor),null!=e.tickSizeEnd&&(s[2]=e.tickSizeEnd),s.length&&r.tickSize.apply(r,s),r.tickCount(e.ticks||t.axis.ticks);var c=e.properties;c&&c.ticks?(r.majorTickProperties(c.majorTicks?a.extend({},c.ticks,c.majorTicks):c.ticks),r.minorTickProperties(c.minorTicks?a.extend({},c.ticks,c.minorTicks):c.ticks)):(r.majorTickProperties(c&&c.majorTicks||{}),r.minorTickProperties(c&&c.minorTicks||{})),r.tickLabelProperties(c&&c.labels||{}),r.titleProperties(c&&c.title||{}),r.gridLineProperties(c&&c.grid||{}),r.domainProperties(c&&c.axis||{})}var a=t("datalib"),s=t("../scene/axis"),o={x:"bottom",y:"left",top:"top",bottom:"bottom",left:"left",right:"right"};e.exports=r},{"../scene/axis":115,datalib:26}],93:[function(t,e,n){(function(t){function n(t){return null==t?null:r.rgb(t)+""}var r="undefined"!=typeof window?window.d3:"undefined"!=typeof t?t.d3:null;e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],94:[function(t,e,n){function r(t,e,n){function s(e){return function(r,s){r?a.error("LOADING FAILED: "+e.url+" "+r):t.data(e.name).values(i.read(s,e.format)),0===--u&&n()}}var o=t.config(),u=0;return(e||[]).forEach(function(e){e.url&&(u+=1,i.load(i.extend({url:e.url},o.load),s(e))),r.datasource(t,e)}),0===u&&setTimeout(n,1),e}var i=t("datalib"),a=t("vega-logging"),s=t("./transforms"),o=t("./modify");r.datasource=function(t,e){var n=(e.transform||[]).map(function(e){return s(t,e)}),r=(e.modify||[]).map(function(n){return o(t,n,e)}),a=t.data(e.name,r.concat(n));return e.values?a.values(i.read(e.values,e.format)):e.source&&(a.source(e.source).addListener(a),t.removeListener(a.pipeline()[0])),a},e.exports=r},{"./modify":101,"./transforms":108,datalib:26,"vega-logging":47}],95:[function(t,e,n){e.exports=function(){function t(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function e(t,e,n,r,i,a){this.message=t,this.expected=e,this.found=n,this.offset=r,this.line=i,this.column=a,this.name="SyntaxError"}function n(t){function n(e){function n(e,n,r){var i,a;for(i=n;r>i;i++)a=t.charAt(i),"\n"===a?(e.seenCR||e.line++,e.column=1,e.seenCR=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(e.line++,e.column=1,e.seenCR=!0):(e.column++,e.seenCR=!1)}return ue!==e&&(ue>e&&(ue=0,le={line:1,column:1,seenCR:!1}),n(le,ue,e),ue=e),le}function r(t){ce>se||(se>ce&&(ce=se,de=[]),de.push(t))}function i(r,i,a){function s(t){var e=1;for(t.sort(function(t,e){return t.descriptione.description?1:0});e1?s.slice(0,-1).join(", ")+" or "+s[t.length-1]:s[0],i=e?'"'+n(e)+'"':"end of input","Expected "+r+" but "+i+" found."}var u=n(a),l=a1?arguments[1]:{},_={},x={start:a},b=a,w=_,k=",",S={type:"literal",value:",",description:'","'},M=function(t,e){return[t].concat(e)},T=function(t){return[t]},A="[",E={type:"literal",value:"[",description:'"["'},L="]",C={type:"literal",value:"]",description:'"]"'},D=">",P={type:"literal",value:">",description:'">"'},I=function(t,e,n){return{start:t,end:e,middle:n}},N=function(t,e){return t.filters=e,t},O=function(t){return t},z="(",U={type:"literal",value:"(",description:'"("'},j=")",F={type:"literal",value:")",description:'")"'},R=function(t){return{stream:t}},q="@",B={type:"literal",value:"@",description:'"@"'},G=":",$={type:"literal",value:":",description:'":"'},Y=function(t,e){return{event:e,name:t}},H=function(t,e){return{event:e,mark:t}},W=function(t,e){return{event:e,target:t}},V=function(t){return{event:t}},X=function(t){return{signal:t}},J="rect",K={type:"literal",value:"rect",description:'"rect"'},Z="symbol",Q={type:"literal",value:"symbol",description:'"symbol"'},tt="path",et={type:"literal",value:"path",description:'"path"'},nt="arc",rt={type:"literal",value:"arc",description:'"arc"'},it="area",at={type:"literal",value:"area",description:'"area"'},st="line",ot={type:"literal",value:"line",description:'"line"'},ut="rule",lt={type:"literal",value:"rule",description:'"rule"'},ct="image",dt={type:"literal",value:"image",description:'"image"'},ft="text",ht={type:"literal",value:"text",description:'"text"'},pt="group",gt={type:"literal",value:"group",description:'"group"'},mt="mousedown",vt={type:"literal",value:"mousedown",description:'"mousedown"'},yt="mouseup",_t={type:"literal",value:"mouseup",description:'"mouseup"'},xt="click",bt={type:"literal",value:"click",description:'"click"'},wt="dblclick",kt={type:"literal",value:"dblclick",description:'"dblclick"'},St="wheel",Mt={type:"literal",value:"wheel",description:'"wheel"'},Tt="keydown",At={type:"literal",value:"keydown",description:'"keydown"'},Et="keypress",Lt={type:"literal",value:"keypress",description:'"keypress"'},Ct="keyup",Dt={type:"literal",value:"keyup",description:'"keyup"'},Pt="mousewheel",It={type:"literal",value:"mousewheel",description:'"mousewheel"'},Nt="mousemove",Ot={type:"literal",value:"mousemove",description:'"mousemove"'},zt="mouseout",Ut={type:"literal",value:"mouseout",description:'"mouseout"'},jt="mouseover",Ft={type:"literal",value:"mouseover",description:'"mouseover"'},Rt="mouseenter",qt={type:"literal",value:"mouseenter",description:'"mouseenter"'},Bt="touchstart",Gt={type:"literal",value:"touchstart",description:'"touchstart"'},$t="touchmove",Yt={type:"literal",value:"touchmove",description:'"touchmove"'},Ht="touchend",Wt={type:"literal",value:"touchend",description:'"touchend"'},Vt=function(t){return t},Xt=/^[a-zA-Z0-9_\-]/,Jt={type:"class",value:"[a-zA-Z0-9_\\-]",description:"[a-zA-Z0-9_\\-]"},Kt=function(t){return t.join("")},Zt=/^[a-zA-Z0-9\-_ #.>+~[\]=|\^$*]/,Qt={type:"class",value:"[a-zA-Z0-9\\-_ #.>+~[\\]=|\\^$*]",description:"[a-zA-Z0-9\\-_ #.>+~[\\]=|\\^$*]"},te=function(t){return t.join("")},ee=/^['"a-zA-Z0-9_().><=! \t-&|~]/,ne={type:"class",value:"['\"a-zA-Z0-9_().><=! \\t-&|~]",description:"['\"a-zA-Z0-9_().><=! \\t-&|~]"},re=function(t){return t.join("")},ie=/^[ \t\r\n]/,ae={type:"class",value:"[ \\t\\r\\n]",description:"[ \\t\\r\\n]"},se=0,oe=0,ue=0,le={line:1,column:1,seenCR:!1},ce=0,de=[],fe=0;if("startRule"in y){if(!(y.startRule in x))throw new Error("Can't start parsing from rule \""+y.startRule+'".');b=x[y.startRule]}if(v=b(),v!==_&&se===t.length)return v;throw v!==_&&se=0;--i)n[i][t]==e&&r.push.apply(r,n.splice(i,1))};e.exports=r},{datalib:26,"vega-dataflow":41,"vega-logging":47}],102:[function(t,e,n){function r(t){if(null==t)return"auto";if(i.isString(t))return"strict"===t?"strict":"auto";if(i.isObject(t))return t;var e=i.isNumber(t)?t:20;return{top:e,left:e,right:e,bottom:e}}var i=t("datalib");e.exports=r},{datalib:26}],103:[function(t,e,n){function r(t,e){return(e||[]).forEach(function(e){var n=d[e.type](t,e),r=Function("args","db","signals","predicates",n.code);r.root=function(){return t.scene().items[0]},r.nullScale=f,r.isFunction=c.isFunction,r.signals=n.signals,r.data=n.data,t.predicate(e.name,r)}),e}function i(t,e){var n=c.field(t),r="signals["+n.map(c.str).join("][")+"]";return e[n[0]]=1,r}function a(t,e){function n(t){o[t]=1}function r(t){u[t]=1}var a=[],s=[],o={},u={};return c.array(e).forEach(function(e,u){var l="o"+u,d="";if(void 0!==e.value)d=c.str(e.value);else if(e.arg)d="args["+c.str(e.arg)+"]";else if(e.signal)d=i(e.signal,o);else if(e.predicate){var f=e.predicate,h=f&&(f.name||f),p=t.predicate(h),g="predicates["+c.str(h)+"]";p.signals.forEach(n),p.data.forEach(r),c.isObject(f)&&c.keys(f).forEach(function(t){if("name"!==t){var e=f[t];d+="args["+c.str(t)+"] = ",e.signal?d+=i(e.signal,o):e.arg&&(d+="args["+c.str(e.arg)+"]"),d+=", "}}),d+=g+".call("+g+", args, db, signals, predicates)"}a.push(l),s.push(l+"=("+d+")")}),{code:"var "+a.join(", ")+";\n"+s.join(";\n")+";\n",signals:c.keys(o),data:c.keys(u)}}function s(t,e){var n=a(t,e.operands);return"="===e.type&&(e.type="=="),n.code+="o0 = o0 instanceof Date ? o0.getTime() : o0;\no1 = o1 instanceof Date ? o1.getTime() : o1;\n",{code:n.code+"return "+["o0","o1"].join(e.type)+";",signals:n.signals,data:n.data}}function o(t,e){for(var n=a(t,e.operands),r=[],i=0,s=e.operands.length;r.push("o"+i++) 0;"}else e.range&&(e.scale&&(r+="if (scale.length == 2) {\n ordSet = scale(o1, o2);\n} else {\n o1 = scale(o1);\no2 = scale(o2);\n}"),r+="return ordSet !== null ? ordSet.indexOf(o0) !== -1 :\n o1 < o2 ? o1 <= o0 && o0 <= o2 : o2 <= o0 && o0 <= o1;");return{code:r,signals:i.signals,data:i.data.concat(e.data?[e.data]:[])}}function l(t,e){var n="var scale = ",r=e.length;return c.isString(t)?(e.push({value:t}),n+="this.root().scale(o"+r+")"):t.arg?(e.push(t),n+="o"+r):t.name&&(e.push(c.isString(t.name)?{value:t.name}:t.name),n+="(this.isFunction(o"+r+") ? o"+r+" : ",t.scope?(e.push(t.scope),n+="((o"+(r+1)+".scale || this.root().scale)(o"+r+") || this.nullScale)"):n+="this.root().scale(o"+r+")",n+=")"),t.invert===!0&&(n+=".invert"),n+";\n"}var c=t("datalib"),d={"=":s,"==":s,"!=":s,">":s,">=":s,"<":s,"<=":s,and:o,"&&":o,or:o,"||":o,"in":u},f=function(){return 0};f.invert=f,e.exports=r},{datalib:26}],104:[function(t,e,n){(function(n){function r(t,e,n){function r(t){if(null!=m[t]){var e,n,r=f.array(m[t]);for(e=0,n=r.length;n>e;++e)b[t][r[e]]=1}}function i(t){var e=(t.parent?"parent_":"group_")+t.level;b._nRefs[e]=t}var u,l,c,m,v=t.config(),y="",_=f.keys(n),x={},b={signals:{},scales:{},data:{},fields:{},nested:[],_nRefs:{},reflow:!1};for(y+="var o = trans ? {} : item, d=0, set=this.tpl.set, tmpl=signals||{}, t;\ntmpl.datum = item.datum;\ntmpl.group = group;\ntmpl.parent = group.datum;\n",u=0,l=_.length;l>u;++u)m=n[c=_[u]],y+=u>0?"\n ":" ",m.rule?(m=s(t,c,m.rule),y+="\n "+m.code):f.isArray(m)?(m=s(t,c,m),y+="\n "+m.code):(m=o(v,c,m),y+="d += set(o, "+f.str(c)+", "+m.val+");"),x[c]=!0,g.forEach(r),b.reflow=b.reflow||m.reflow,m.nested.length&&m.nested.forEach(i);f.keys(b._nRefs).forEach(function(t){b.nested.push(b._nRefs[t])}),b.nested.sort(function(t,e){return t=t.level,e=e.level,e>t?-1:t>e?1:t>=e?0:NaN}),x.x2&&(x.x?(y+="\n if (o.x > o.x2) { \n t = o.x;\n d += set(o, 'x', o.x2);\n d += set(o, 'x2', t); \n };",y+="\n d += set(o, 'width', (o.x2 - o.x));"):y+=x.width?"\n d += set(o, 'x', (o.x2 - o.width));":"\n d += set(o, 'x', o.x2);"),x.xc&&(y+=x.width?"\n d += set(o, 'x', (o.xc - o.width/2));":"\n d += set(o, 'x', o.xc);"),x.y2&&(x.y?(y+="\n if (o.y > o.y2) { \n t = o.y;\n d += set(o, 'y', o.y2);\n d += set(o, 'y2', t);\n };",y+="\n d += set(o, 'height', (o.y2 - o.y));"):y+=x.height?"\n d += set(o, 'y', (o.y2 - o.height));":"\n d += set(o, 'y', o.y2);"),x.yc&&(y+=x.height?"\n d += set(o, 'y', (o.yc - o.height/2));":"\n d += set(o, 'y', o.yc);"),a(e,x)&&(y+="\n d += (item.touch(), 1);"),y+="\n if (trans) trans.interpolate(item, o);",y+="\n return d > 0;";try{var w=Function("item","group","trans","db","signals","predicates",y);return w.tpl=p,w.util=f,w.d3=d,f.extend(w,f.template.context),{encode:w,signals:f.keys(b.signals),scales:f.keys(b.scales),data:f.keys(b.data),fields:f.keys(b.fields),nested:b.nested,reflow:b.reflow}}catch(k){h.error(k),h.log(y)}}function i(t,e){return f.isObject(t)||(t={reflow:!1,nested:[]},g.forEach(function(e){t[e]=[]})),f.isObject(e)&&(t.reflow=t.reflow||e.reflow,t.nested.push.apply(t.nested,e.nested),g.forEach(function(n){t[n].push.apply(t[n],e[n])})),t}function a(t,e){return e.path||("area"===t||"line"===t)&&(e.x||e.x2||e.width||e.y||e.y2||e.height||e.tension||e.interpolate)}function s(t,e,n){var r=t.config(),a=i(),s=[],u="";return(n||[]).forEach(function(l,c){var d,h=l.predicate,p=h&&(h.name||h),g=t.predicate(p),m="predicates["+f.str(p)+"]",v=[],y=e+"_arg"+c;f.isObject(h)&&f.keys(h).forEach(function(t){if("name"!==t){var e=o(r,c,h[t]);v.push(f.str(t)+": "+e.val),i(a,e)}}),d=o(r,e,l),i(a,d),p?(a.signals.push.apply(a.signals,g.signals),a.data.push.apply(a.data,g.data),s.push(y+" = {\n "+v.join(",\n ")+"\n }"),u+="if ("+m+".call("+m+","+y+", db, signals, predicates)) {\n d += set(o, "+f.str(e)+", "+d.val+");",u+=n[c+1]?"\n } else ":" }"):u+="{\n d += set(o, "+f.str(e)+", "+d.val+");\n }\n"}),u="var "+s.join(",\n ")+";\n "+u,a.code=u,a}function o(t,e,n){if(null==n)return null;if("fill"===e||"stroke"===e){if(n.c)return u(t,"hcl",n.h,n.c,n.l);if(n.h||n.s)return u(t,"hsl",n.h,n.s,n.l);if(n.l||n.a)return u(t,"lab",n.l,n.a,n.b);if(n.r||n.g||n.b)return u(t,"rgb",n.r,n.g,n.b)}var r=null,a=null,s=i(),o=null,d=null,h=null,p={};return void 0!==n.template&&(r=f.template.source(n.template,"tmpl",p),f.keys(p).forEach(function(t){var e=f.field(t),n=e.shift();"parent"===n||"group"===n?s.nested.push({parent:"parent"===n,group:"group"===n,level:1}):"datum"===n?s.fields.push(e[0]):s.signals.push(n)})),void 0!==n.value&&(r=f.str(n.value)),void 0!==n.signal&&(o=f.field(n.signal),r="signals["+o.map(f.str).join("][")+"]",s.signals.push(o.shift())),void 0!==n.field&&(n.field=f.isString(n.field)?{datum:n.field}:n.field,d=l(n.field),r=d.val,i(s,d)),void 0!==n.scale&&(h=c(n.scale),a=h.val,i(s,h),s.scales.push(n.scale.name||n.scale),r=null!==r||n.band||n.mult||n.offset?a+(n.band?".rangeBand()":"("+(null!==r?r:"item.datum.data")+")"):a),r="("+(n.mult?f.number(n.mult)+" * ":"")+r+")"+(n.offset?" + "+f.number(n.offset):""),s.val=r,s}function u(t,e,n,r,a){var s=n?o(t,"",n):t.color[e][0],u=r?o(t,"",r):t.color[e][1],l=a?o(t,"",a):t.color[e][2],c=i();[s,u,l].forEach(function(t){f.isArray||i(c,t)});var d="(this.d3."+e+"("+[s.val,u.val,l.val].join(",")+') + "")';return c.val=d,c}function l(t){if(f.isString(t))return{val:f.field(t).map(f.str).join("][")};var e=t.level||1,n=(t.group||t.parent)&&e,r=n?Array(e).join("group.mark."):"",a=l(t.datum||t.group||t.parent||t.signal),s=a.val,o=i(null,a);return t.datum?(s="item.datum["+s+"]",o.fields.push(t.datum)):t.group?(s=r+"group["+s+"]",o.nested.push({level:e,group:!0})):t.parent?(s=r+"group.datum["+s+"]",o.nested.push({level:e,parent:!0})):t.signal&&(s="signals["+s+"]",o.signals.push(f.field(t.signal)[0]),o.reflow=!0),o.val=s,o}function c(t){var e=null,n=null,r=i();return e=f.isString(t)?f.str(t):t.name?f.isString(t.name)?f.str(t.name):(n=l(t.name)).val:(n=l(t)).val,e="(item.mark._scaleRefs["+e+"] = 1, group.scale("+e+"))",t.invert&&(e+=".invert"),n&&n.nested.forEach(function(t){t.scale=!0}),n?(n.val=e,n):(r.val=e,r)}var d="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,f=t("datalib"),h=t("vega-logging"),p=t("vega-dataflow").Tuple,g=["signals","scales","data","fields"];e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{datalib:26,"vega-dataflow":41,"vega-logging":47}],105:[function(t,e,n){function r(t,e){return(e||[]).forEach(function(e){if(-1!==u.indexOf(e.name))throw Error('Signal name "'+e.name+'" is a reserved keyword ('+u.join(", ")+").");var n=t.signal(e.name,e.init).verbose(e.verbose);e.init&&e.init.expr&&(e.init.expr=o(e.init.expr),n.value(i(t,e.init))),e.expr&&(e.expr=o(e.expr),n.evaluate=function(r){var a=i(t,e),s=r.signals;return(a!==n.value()||n.verbose())&&(n.value(a),s[e.name]=1),s[e.name]?r:t.doNotPropagate},n.dependency(s,e.expr.globals),e.expr.globals.forEach(function(e){t.signal(e).addListener(n)}))}),e}function i(t,e){var n=e.expr,i=n.fn(null,null,t.values(s,n.globals));return e.scale?r.scale(t,e,i):i}var a=t("datalib"),s=t("vega-dataflow").Dependencies.SIGNALS,o=t("./expr"),u=["datum","event","signals"].concat(a.keys(o.codegen.functions));r.scale=function(t,e,n,r,i){var u,l=e.scale,c=l.name||l.signal||l,d=l.scope;d&&(d.signal?d=t.signalRef(d.signal):a.isString(d)&&(u=l._expr=l._expr||o(d),d=u.fn(r,i,t.values(s,u.globals)))),d&&d.scale||(d=d&&d.mark?d.mark.group:t.scene().items[0]);var f=d.scale(c);return f?l.invert?f.invert(n):f(n):n},e.exports=r},{"./expr":96,datalib:26,"vega-dataflow":41}],106:[function(t,e,n){function r(e,n){function r(e){e=i.duplicate(e);var r=t("./"),a=e.width||500,s=e.height||500,o=e.viewport||null;d.defs({width:a,height:s,viewport:o,background:r.background(e.background),padding:r.padding(e.padding),signals:r.signals(d,e.signals),predicates:r.predicates(d,e.predicates),marks:r.marks(d,e,a,s),data:r.data(d,e.data,function(){n(l(d))})})}var u=arguments[arguments.length-1],l=arguments.length>2&&i.isFunction(u)?u:o.factory,c=arguments[2]!==l?arguments[2]:{},d=new s(c);if(i.isObject(e))r(e);else if(i.isString(e)){var f=i.extend({url:e},d.config().load);i.load(f,function(t,e){if(t)a.error("LOADING SPECIFICATION FAILED: "+t.statusText);else try{r(JSON.parse(e))}catch(n){a.error("INVALID SPECIFICATION: Must be a valid JSON object. "+n)}})}else a.error("INVALID SPECIFICATION: Must be a valid JSON object or URL.")}var i=t("datalib"),a=t("vega-logging"),s=t("../core/Model"),o=t("../core/View");e.exports=r},{"../core/Model":88,"../core/View":89,"./":97,datalib:26,"vega-logging":47}],107:[function(t,e,n){(function(n){function r(t){function e(e,n){var r,a,s,o=i.mouse((i.event=e,t.renderer().scene())),u=t.padding(),l={};if(n)for(r=n.mark,a="group"===r.marktype?n:r.group,s=n;null!=s;s=s.mark.group)s.mark.def.name&&(l[s.mark.def.name]=s);l.root=t.model().scene().items[0],e.vg=Object.create(f),e.vg.group=a,e.vg.item=n||{},e.vg.name=l,e.vg.x=o[0]-u.left,e.vg.y=o[1]-u.top}function n(t,e,n,r){function i(t){return!t.fn(n,r,m.values(o,t.globals))}var a,l,c,d,f=t.handlers[e],h=t.nodes[e],p=s.ChangeSet.create(null,!0),g=!1;for(l=0,c=f.length;c>l;++l)d=f[l],g=d.filters.some(i),g||(a=d.exp.fn(n,r,m.values(o,d.exp.globals)),d.spec.scale&&(a=u.scale(m,d.spec,a,n,r)),(a!==d.signal.value()||d.signal.verbose())&&(d.signal.value(a),p.signals[d.signal.name()]=1));m.propagate(p,h)}function r(t,e,n,i){e.forEach(function(e){e.event?h(t,e,n,i):e.signal?p(t,e,n,i):e.start?g(t,e,n,i):e.stream&&r(t,e.stream,n,i)})}function h(t,e,n,r){var i=e.event,o=e.name,u=e.mark,l=e.target,d=e.filters||[],f=l?x:_,h=l?l+":"+i:i,p=f.nodes[h]||(f.nodes[h]=new s.Node(m)),g=f.handlers[h]||(f.handlers[h]=[]);o?d.push('!!event.vg.name["'+o+'"]'):u&&d.push("event.vg.item.mark && event.vg.item.mark.marktype==="+a.str(u)),g.push({signal:t,exp:n,spec:r,filters:d.map(function(t){return c(t)})}),p.addListener(t)}function p(t,e,n,r){var i=new s.Node(m);i.evaluate=function(i){if(!i.signals[e.signal])return m.doNotPropagate;var a=n.fn(null,null,m.values(o,n.globals));return r.scale&&(a=u.scale(m,r,a)),(a!==t.value()||t.verbose())&&(t.value(a),i.signals[t.name()]=1,i.reflow=!0),i},i.dependency(s.Dependencies.SIGNALS,e.signal),i.addListener(t),m.signal(e.signal).addListener(i)}function g(t,e,n,i){var a=t.name(),s=a+d,o=c("true"),u=c("false"),l=e.middle,f=l.filters||(l.filters=[]),h=m.signal(s)||m.signal(s,!1);r(h,[e.start],o,{}),r(h,[e.end],u,{}),f.push(h.name()),r(t,[e.middle],n,i)}var m=t.model(),v=m.defs().signals,y={handlers:{},nodes:{}},_=a.duplicate(y),x=a.duplicate(y);return(v||[]).forEach(function(t){var e=m.signal(t.name);t.expr||(t.streams||[]).forEach(function(t){var n=l.parse(t.type),i=c(t.expr);r(e,n,i,t)})}),a.keys(_.handlers).forEach(function(r){t.on(r,function(t,i){t.preventDefault(),e(t,i),n(_,r,i&&i.datum||{},t)})}),a.keys(x.handlers).forEach(function(t){function r(r){e(r),n(x,t,i.select(this).datum(),r)}if("undefined"!=typeof window){for(var a=x.handlers[t],s=t.split(":"),o="window"===s[0]?[window]:window.document.querySelectorAll(s[0]),u=0;u0;if(t.add.length||t.rem.length||!p.length||t.mod.length===p.length||"area"===f||"line"===f?u.mark(this._mark,null,h&&!g):t.mod.forEach(function(t){u.item(t)}),h&&g){for(e=0,n=p.length;n>e;++e)for(c=p[e],c._legendPositions=null,r=0,s=c.legendItems.length;s>r;++r)d=c.legendItems[r],l.update(this._graph,t.trans,"vg_legendPosition",d.items,t.dirty),u.mark(d,null,!1);u.mark(this._mark,null,!0)}return a.ChangeSet.create(t,!0)},e.exports=r},{"./Encoder":111,datalib:26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],110:[function(t,e,n){function r(){return arguments.length?this.init.apply(this,arguments):this}function i(){var t,e,n,r,i,a,s=this._def.from,o=s.mark;o?(e=["vg",this._parent_id,o].join("_"),n={name:e,transform:s.transform,modify:s.modify}):(t=this._graph.data(this._from),e=["vg",this._from,this._def.type,t.listeners(!0).length].join("_"),n={name:e,source:this._from,transform:s.transform,modify:s.modify}),this._from=e,this._ds=_.datasource(this._graph,n);var u;o?(r=this.sibling(o),u=new f(this._graph).addListener(this._ds.listener()),u.evaluate=function(){return r._output},r._isSuper?r.addListener(u):r._bounder.addListener(u)):(i=this._ds.source().last(),a=g.create(i),a.add=i.add,a.mod=i.mod,a.rem=i.rem,a.stamp=null,this._graph.propagate(a,this._ds.listener(),i.stamp))}function a(){var t=p.ingest(new c(this._mark));return this._def.width&&p.set(t,"width",this._def.width),this._def.height&&p.set(t,"height",this._def.height),t}function s(t,e,n,r,i){var s,u,l,c,d,f,h,g=o(this._def.key||(r?"_id":null)),m=this._mark.items||[],v=r?t.rem:m,y=p.idMap(!r||i?n:t.mod),_=[];for(s=0,l=v.length;l>s;++s)c=v[s]===m[s]?m[s]:g?this._map[g(v[s])]:v[s],c.status=x.EXIT;for(s=0,l=n.length;l>s;++s)d=n[s],c=g?this._map[u=g(d)]:m[s],f=c?!1:(c=a.call(this),!0),c.status=f?x.ENTER:x.UPDATE,h=!f&&c.datum!==d,c.datum=d,g&&(p.set(c,"key",u),this._map[u]=c),f?e.add.push(c):(h||y[d._id])&&e.mod.push(c),_.push(c);for(s=0,l=v.length;l>s;++s)c=v[s]===m[s]?m[s]:g?this._map[u=g(v[s])]:v[s],c.status===x.EXIT&&(c._dirty=!0,t.dirty.push(c),_.push(c),e.rem.push(c),g&&(this._map[u]=null));return this._mark.items=_,e}function o(t){if(null==t)return null;var e=u.array(t).map(u.accessor);return function(t){for(var n="",r=0,i=e.length;i>r;++r)r>0&&(n+="|"),n+=String(e[r](t));return n}}var u=t("datalib"),l=t("vega-logging"),c=t("vega-scenegraph").Item,d=t("vega-dataflow"),f=d.Node,h=d.Dependencies,p=d.Tuple,g=d.ChangeSet,m={},v=t("./Encoder"),y=t("./Bounder"),_=t("../parse/data"),x=r.STATUS={ENTER:"enter",UPDATE:"update",EXIT:"exit"},b=1,w=2,k=r.prototype=new f;k.init=function(t,e,n,r,a,s){return f.prototype.init.call(this,t).router(!0).collector(!0),this._def=e,this._mark=n,this._from=(e.from?e.from.data:null)||s,this._ds=u.isString(this._from)?t.data(this._from):null,this._map={},this._status=null,n.def=e,n.marktype=e.type,n.interactive=e.interactive!==!1,n.items=[],u.isValid(e.name)&&(n.name=e.name),this._parent=r,this._parent_id=a,e.from&&(e.from.mark||e.from.transform||e.from.modify)&&i.call(this),this._isSuper="group"!==this._def.type,this._encoder=new v(this._graph,this._mark,this),this._bounder=new y(this._graph,this._mark),this._output=null,this._ds&&this._encoder.dependency(h.DATA,this._from),this.dependency(h.DATA,this._encoder.dependency(h.DATA)),this.dependency(h.SCALES,this._encoder.dependency(h.SCALES)),this.dependency(h.SIGNALS,this._encoder.dependency(h.SIGNALS)),this},k.ds=function(){return this._ds},k.parent=function(){return this._parent},k.encoder=function(){return this._encoder},k.pipeline=function(){return[this]},k.connect=function(){var t=this;return this._graph.connect(this.pipeline()),this._encoder._scales.forEach(function(e){(e=t._parent.scale(e))&&e.addListener(t)}),this._parent&&(this._isSuper?this.addListener(this._parent._collector):this._bounder.addListener(this._parent._collector)),this._status=b,this},k.disconnect=function(){function t(t){for(var n,r=0,i=t.length;i>r;++r)(n=e._parent.scale(t[r]))&&n.removeListener(e)}var e=this;return this._listeners.length?(f.prototype.disconnect.call(this),this._graph.disconnect(this.pipeline()),t(this._encoder._scales),t(u.keys(this._mark._scaleRefs)),this._status=w,this):this},k.sibling=function(t){return this._parent.child(t,this._parent_id)},k.evaluate=function(t){l.debug(t,["building",this._from||this._def.from,this._def.type]);var e,n,r,i,a=this,o=this._mark.def,c=o.properties||{},d=c.update||{},f=g.create(t);if(this._ds){if(r=f.data[i=this._ds.name()],f.data[i]=null,e=this._encoder.reevaluate(f),f.data[i]=r,n=this._ds.last(),!n)throw Error("Builder evaluated before backing DataSource.");n.stamp>this._stamp?s.call(this,n,f,this._ds.values(),!0,e):e&&(f.mod=this._mark.items.slice())}else r=u.isFunction(this._def.from)?this._def.from():[m],s.call(this,t,f,r);return this._output=f=this._graph.evaluate(f,this._encoder),d.nested&&d.nested.length&&this._status===b&&u.keys(this._mark._scaleRefs).forEach(function(t){var e=a._parent.scale(t);e&&(e.addListener(a),a.dependency(h.SCALES,t),a._encoder.dependency(h.SCALES,t))}),this._isSuper&&(f.mod=f.mod.filter(function(t){return t._dirty}),f=this._graph.evaluate(f,this._bounder)),f},e.exports=r},{"../parse/data":94,"./Bounder":109,"./Encoder":111,datalib:26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],111:[function(t,e,n){function r(t,e,n){var r=e.def.properties||{},i=r.enter,a=r.update,s=r.exit;c.prototype.init.call(this,t),this._mark=e,this._builder=n;var o=this._scales=[];return i&&o.push.apply(o,i.scales),a&&(this.dependency(d.DATA,a.data),this.dependency(d.SIGNALS,a.signals),this.dependency(d.FIELDS,a.fields),this.dependency(d.SCALES,a.scales),o.push.apply(o,a.scales)),s&&o.push.apply(o,s.scales),this.mutates(!0)}function i(t,e,n,r){var i,a,s,o=n.add.length;return(i=r.enter)&&(a=i[t]).length&&o&&(s=e.values(t,a,s=s||{})),(i=r.exit)&&(a=i[t]).length&&n.rem.length&&(s=e.values(t,a,s=s||{})),(i=r.update)&&(a=i[t]).length&&(o||n.mod.length)&&(s=e.values(t,a,s=s||{})),s||h}function a(t,e,n,r,i,a,s){var o=t.encode,u=e._dirty,l=o.call(o,e,e.mark.group||e,n,r,i,a);e._dirty=l||u,l&&!u&&s.push(e)}function s(){for(var t,e,n,r=this._mark.def.properties.update.nested,i=this._builder,a=0,s=0,o=r.length;o>s;++s)if(t=r[s],!t.scale){for(;athis._stamp)return!0}return!1}var o=t("datalib"),u=t("vega-logging"),l=t("vega-dataflow"),c=l.Node,d=l.Dependencies,f=t("vega-scenegraph").bound,h={},p=r.prototype=new c;p.evaluate=function(e){u.debug(e,["encoding",this._mark.def.type]);var n,r,s,o,l=this._graph,c=this._mark.def.properties||{},f=this._mark.items,p=c.enter,g=c.update,m=c.exit,v=e.dirty,y=l.predicates(),_=e.request,x=this._mark.group,b=x&&(x.mark.axis||x.mark.legend),w=h,k=h;if(_&&!b){if((o=c[_])&&e.mod.length)for(w=o.data?l.values(d.DATA,o.data):null,k=o.signals?l.values(d.SIGNALS,o.signals):null,n=0,r=e.mod.length;r>n;++n)s=e.mod[n],a.call(this,o,s,e.trans,w,k,y,v);return e}for(w=i(d.DATA,l,e,c),k=i(d.SIGNALS,l,e,c),n=0,r=e.rem.length;r>n;++n)s=e.rem[n],m&&a.call(this,m,s,e.trans,w,k,y,v),e.trans&&!m?e.trans.interpolate(s,h):e.trans||f.pop();var S=t("./Builder").STATUS.UPDATE;for(n=0,r=e.add.length;r>n;++n)s=e.add[n],p&&a.call(this,p,s,e.trans,w,k,y,v),g&&a.call(this,g,s,e.trans,w,k,y,v),s.status=S;if(g)for(n=0,r=e.mod.length;r>n;++n)s=e.mod[n],a.call(this,g,s,e.trans,w,k,y,v);return e},p.reevaluate=function(t){var e=this._mark.def,n=e.properties||{},r=o.isFunction(e.from)||e.orient||t.request||c.prototype.reevaluate.call(this,t);return r||(n.update?s.call(this):!1)},r.update=function(t,e,n,r,i){r=o.array(r);var s,u,l,c,h,p=t.predicates(),g=t.values(d.DATA),m=t.values(d.SIGNALS);for(s=0,u=r.length;u>s;++s)l=r[s],c=l.mark.def.properties,h=c&&c[n],h&&(a.call(null,h,l,e,g,m,p,i),f.item(l))},e.exports=r},{"./Builder":110,datalib:26,"vega-dataflow":41,"vega-logging":47,"vega-scenegraph":48}],112:[function(t,e,n){function r(){return this._children={},this._scaler=null,this._recursor=null,this._scales={},this.scale=a.bind(this),arguments.length?this.init.apply(this,arguments):this}function i(t){function e(t){t.type!=x.MARK||t.inline||void 0===m._graph.data(t.from)||m._recursor.removeListener(t.builder)}function n(e){var n=e.scale();t.scales[n.scaleName]&&e.reset().def()}function r(e){var n=e.size()||e.shape()||e.fill()||e.stroke();t.scales[n.scaleName]&&e.reset().def()}function i(t){m._recursor.removeListener(t.builder),t.builder.disconnect()}var a,s,d,f,h,p,g,m=this,v=c.array(this._def.marks).length>0,y=c.array(this._def.axes).length>0,_=c.array(this._def.legends).length>0,b=!1;for(a=0,f=t.add.length;f>a;++a)h=t.add[a],v&&o.call(this,t,h),y&&u.call(this,t,h),_&&l.call(this,t,h);for(a=t.add.length-1;a>=0;--a)for(h=t.add[a],s=this._children[h._id].length-1;s>=0;--s)d=this._children[h._id][s],d.builder.connect(),p=d.builder.pipeline(),g=d.builder._def,b=g.type!==x.GROUP,b=b&&void 0!==this._graph.data(d.from),b=b&&1===p[p.length-1].listeners().length,b=b&&g.from&&!g.from.mark,d.inline=b,b?this._graph.evaluate(t,d.builder):this._recursor.addListener(d.builder);for(a=0,f=t.mod.length;f>a;++a)h=t.mod[a],v&&m._children[h._id].forEach(e),y&&h.axes.forEach(n),_&&h.legends.forEach(r);for(a=0,f=t.rem.length;f>a;++a)h=t.rem[a],m._children[h._id].forEach(i),delete m._children[h._id];return t}function a(t,e){var n=this,r=null;if(2===arguments.length)return n._scales[t]=e,e;for(;null==r&&(r=n._scales[t],n=n.mark?n.mark.group:n._parent););return r}function s(t,e){g.debug(t,["building group",e._id]),e._scales=e._scales||{},e.scale=a.bind(e),e.items=e.items||[],this._children[e._id]=this._children[e._id]||[],e.axes=e.axes||[],e.axisItems=e.axisItems||[],e.legends=e.legends||[],e.legendItems=e.legendItems||[]}function o(t,e){g.debug(t,["building children marks #"+e._id]);var n,i,a,s,o,u,l=this._def.marks;for(s=0,o=l.length;o>s;++s)n=l[s],i=n.from||{},a=e.datum._facetID,e.items[s]={group:e,_scaleRefs:{}},u=n.type===x.GROUP?new r:new m,u.init(this._graph,n,e.items[s],this,e._id,a),this._children[e._id].push({builder:u,from:i.data||(i.mark?"vg_"+e._id+"_"+i.mark:a),type:x.MARK})}function u(t,e){var n=e.axes,i=e.axisItems,a=this;y(this._graph,this._def.axes,n,e),n.forEach(function(t,n){var s=a._def.axes[n].scale,o=t.def(),u=null;i[n]={group:e,axis:!0,layer:o.layer},u=o.type===x.GROUP?new r:new m,u.init(a._graph,o,i[n],a).dependency(h.SCALES,s),a._children[e._id].push({builder:u,type:x.AXIS,scale:s})})}function l(t,e){var n=e.legends,i=e.legendItems,a=this;_(this._graph,this._def.legends,n,e),n.forEach(function(t,n){var s=t.size()||t.shape()||t.fill()||t.stroke(),o=t.def(),u=null;i[n]={group:e,legend:!0},u=o.type===x.GROUP?new r:new m,u.init(a._graph,o,i[n],a).dependency(h.SCALES,s),a._children[e._id].push({builder:u,type:x.LEGEND,scale:s})})}var c=t("datalib"),d=t("vega-dataflow"),f=d.Node,h=d.Dependencies,p=d.Collector,g=t("vega-logging"),m=t("./Builder"),v=t("./Scale"),y=t("../parse/axes"),_=t("../parse/legends"),x=r.TYPES={GROUP:"group",MARK:"mark",AXIS:"axis",LEGEND:"legend"},b=r.prototype=new m;b.init=function(t,e){var n,r=this;this._scaler=new f(t),(e.scales||[]).forEach(function(e){e=r.scale(n=e.name,new v(t,e,r)),r.scale(n+":prev",e),r._scaler.addListener(e)}),this._recursor=new f(t),this._recursor.evaluate=i.bind(this);var a=(e.axes||[]).reduce(function(t,e){return t[e.scale]=1,t},{});return a=(e.legends||[]).reduce(function(t,e){return t[e.size||e.shape||e.fill||e.stroke],t},a),this._recursor.dependency(h.SCALES,c.keys(a)),this._collector=new p(t),m.prototype.init.apply(this,arguments)},b.evaluate=function(){var t=m.prototype.evaluate.apply(this,arguments),e=this;return t.add.forEach(function(n){s.call(e,t,n)}),t},b.pipeline=function(){return[this,this._scaler,this._recursor,this._collector,this._bounder]},b.disconnect=function(){var t=this;return c.keys(t._children).forEach(function(e){t._children[e].forEach(function(e){t._recursor.removeListener(e.builder),e.builder.disconnect()})}),t._children={},m.prototype.disconnect.call(this)},b.child=function(t,e){for(var n,r=this._children[e],i=0,a=r.length;a>i&&(n=r[i],n.type!=x.MARK||n.builder._def.name!=t);++i);return n.builder},e.exports=r},{"../parse/axes":92,"../parse/legends":98,"./Builder":110,"./Scale":113,datalib:26,"vega-dataflow":41,"vega-logging":47}],113:[function(t,e,n){(function(n){function r(t,e,n){return this._def=e,this._parent=n,this._updated=!1,k.prototype.init.call(this,t).reflows(!0)}function i(t){var e=this._def.name,n=e+":prev",r=a.call(this,t.scale(e)),i=r.type===A.ORDINAL?s:u,o=y.call(this,t);return i.call(this,r,o,t),t.scale(e,r),t.scale(n,t.scale(n)||r),r}function a(t){var e=this._graph.config(),n=this._def.type||A.LINEAR;if(!t||n!==t.type){var r=e.scale[n]||_.scale[n];if(!r)throw Error("Unrecognized scale type: "+n);(t=r()).type=t.type||n,t.scaleName=this._def.name,t._prev={}}return t}function s(t,e,n){var r,i,a=this._def,s=t._prev,u=!1,l=m.call(this,a.padding)||0,c=null==a.outerPadding?l:m.call(this,a.outerPadding),d=a.points&&m.call(this,a.points),f=m.call(this,a.round)||null==a.round,h=!0;if(x.isObject(a.range)&&!x.isArray(a.range)&&(u=!0,e=g.call(this,E.RANGE,a.range,t,n)),r=g.call(this,E.DOMAIN,a.domain,t,n),r&&!x.equal(s.domain,r)&&(t.domain(r),s.domain=r,this._updated=!0),!x.equal(s.range,e)){if(a.bandWidth){var p,v=m.call(this,a.bandWidth),y=r.length,_=a.points?l*v:l*v*(y-1)+2*c;e[0]>e[1]?(p=e[1]||0,e=[p+(v*y+_),p]):(p=e[0]||0,e=[p,p+(v*y+_)])}i="string"==typeof e[0],i||e.length>2||1===e.length||u?(t.range(e),h=!1):d&&f?t.rangeRoundPoints(e,l):d?t.rangePoints(e,l):f?t.rangeRoundBands(e,l,c):t.rangeBands(e,l,c),s.range=e,this._updated=!0}!t.invert&&h&&o(t)}function o(t){t.invert=function(e,n){var r=t.range(),i=r[0]l&&(s=u,u=l,l=u),0>u&&(u=0),l>c&&(l=c),(i?x.range(u,l+1):x.range(l,u-1,-1)).map(function(t){return o[t]})}}}function u(t,e,n){var r,i,a=this._def,s=t._prev,o=m.call(this,a.round),u=m.call(this,a.exponent),l=m.call(this,a.clamp),c=m.call(this,a.nice);r=a.type===A.QUANTILE?g.call(this,E.DOMAIN,a.domain,t,n):v.call(this,t,n),r&&!x.equal(s.domain,r)&&(t.domain(r),s.domain=r,this._updated=!0),"height"===m.call(this,a.range)&&(e=e.reverse()),x.equal(s.range,e)||(t[o&&t.rangeRound?"rangeRound":"range"](e),s.range=e,this._updated=!0,this._stamp>0||(u&&a.type===A.POWER&&t.exponent(u),l&&t.clamp(!0),c&&(a.type===A.TIME?(i=_.time[c],i||w.error("Unrecognized interval: "+i),t.nice(i)):t.nice())))}function l(t){return t.type===A.ORDINAL||t.type===A.QUANTILE}function c(t){return t.fields||x.array(t)}function d(t){return t.some(function(t){return t.data?t.data&&x.array(t.field).some(function(t){return t.parent}):!0})}function f(t,e){return x.array(t.field).map(function(t){return t.parent?x.accessor(t.parent)(e.datum):t})}function h(t,e){var n=c(t);return 1==n.length&&1==x.array(n[0].field).length?M.TYPES.TUPLE:l(e)&&x.isObject(t.sort)?M.TYPES.MULTI:M.TYPES.VALUE}function p(t,e,n,r){var i=c(e),a=d(i),s=h(e,n),o=l(n),u=e.sort,p="_"+t,g=f(i[0],r);if(n[p]||this[p])return n[p]||this[p];var m,v,y=new M(this._graph).type(s);return a?n[p]=y:this[p]=y,o?s===M.TYPES.VALUE?(m=[{name:E.GROUPBY,get:x.identity}],v={"*":E.COUNT}):s===M.TYPES.TUPLE?(m=[{name:E.GROUPBY,get:x.$(g[0])}],v=x.isObject(u)?[{field:E.VALUE,get:x.$(u.field),ops:[u.op]}]:{"*":E.COUNT}):(m=E.GROUPBY,v=[{field:E.VALUE,ops:[u.op]}]):(m=[],v=[{field:E.VALUE,get:s==M.TYPES.TUPLE?x.$(g[0]):x.identity,ops:[E.MIN,E.MAX],as:[E.MIN,E.MAX]}]),y.param("groupby",m).param("summarize",v),y._lastUpdate=-1,y}function g(t,e,n,r){function i(t){T.dependency(S.SIGNALS,t)}if(null==e)return[];if(x.isArray(e))return e.map(m.bind(this));var a,s,o,u,g,v,y,_,b,w,k,T=this,A=this._graph,L=c(e),C=d(L),D=h(e,n),P=p.apply(this,arguments),I=e.sort,N=l(n);if(C||!C&&P._lastUpdatea;++a)if(g=L[a],b=g.data||r.datum._facetID,_=A.data(b).last(),!(_.stamp<=this._stamp)){for(v=f(g,r),o=0,u=v.length;u>o;++o)y=v[o],D===M.TYPES.VALUE?P.accessors(null,y):D===M.TYPES.MULTI&&P.accessors(y,g.sort||I.field),P.evaluate(_);this.dependency(S.DATA,b),P.dependency(S.SIGNALS).forEach(i)}P._lastUpdate=this._stamp,_=P.aggr().result(),N?(x.isObject(I)?(k=(w=I.order)&&w.signal?A.signalRef(w.signal):w,k=(k==E.DESC?"-":"+")+I.op+"_"+E.VALUE,k=x.comparator(k)):I===!0&&(k=x.comparator(E.GROUPBY)),k&&(_=_.sort(k)),P._values=_.map(function(t){return t[E.GROUPBY]})):(_=_[0],P._values=x.isValid(_)?[_[E.MIN],_[E.MAX]]:[])}return P._values}function m(t){if(!t||!t.signal)return t;var e,n=t.signal;return this.dependency(S.SIGNALS,(e=x.field(n))[0]),this._graph.signalRef(e)}function v(t,e){var n,r,i=this._def,a=[null,null];return void 0!==i.domain&&(a=x.isObject(i.domain)?g.call(this,E.DOMAIN,i.domain,t,e):a),r=a.length-1,void 0!==i.domainMin&&(x.isObject(i.domainMin)?i.domainMin.signal?a[0]=x.isValid(n=m.call(this,i.domainMin))?n:a[0]:a[0]=g.call(this,E.DOMAIN+E.MIN,i.domainMin,t,e)[0]:a[0]=i.domainMin),void 0!==i.domainMax&&(x.isObject(i.domainMax)?i.domainMax.signal?a[r]=x.isValid(n=m.call(this,i.domainMax))?n:a[r]:a[r]=g.call(this,E.DOMAIN+E.MAX,i.domainMax,t,e)[1]:a[r]=i.domainMax),i.type===A.LOG||i.type===A.TIME||!i.zero&&void 0!==i.zero||(a[0]=Math.min(0,a[0]),a[r]=Math.max(0,a[r])),a}function y(t){var e=this._def,n=this._graph.config(),r=m.call(this,e.range),i=[null,null];if(void 0!==r)if("string"==typeof r)if(T[r])i=[0,t[r]];else{if(!n.range[r])return w.error("Unrecogized range: "+r),i;i=n.range[r]}else if(x.isArray(r))i=x.duplicate(r).map(m.bind(this));else{if(x.isObject(r))return null;i=[0,r]}if(void 0!==e.rangeMin&&(i[0]=e.rangeMin.signal?m.call(this,e.rangeMin):e.rangeMin),void 0!==e.rangeMax&&(i[i.length-1]=e.rangeMax.signal?m.call(this,e.rangeMax):e.rangeMax),void 0!==e.reverse){var a=m.call(this,e.reverse);x.isObject(a)&&(a=x.accessor(a.field)(t.datum)),a&&(i=i.reverse())}return i}var _="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,x=t("datalib"),b=t("vega-dataflow"),w=t("vega-logging"),k=b.Node,S=b.Dependencies,M=t("../transforms/Aggregate"),T={width:1,height:1},A={LINEAR:"linear",ORDINAL:"ordinal",LOG:"log",POWER:"pow",SQRT:"sqrt",TIME:"time",TIME_UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold"},E={DOMAIN:"domain",RANGE:"range",COUNT:"count",GROUPBY:"groupby",MIN:"min",MAX:"max",VALUE:"value",ASC:"asc",DESC:"desc"},L=r.prototype=new k;L.evaluate=function(t){var e=this,n=function(t){i.call(e,t)};return this._updated=!1,t.add.forEach(n),t.mod.forEach(n),this._updated&&(t.scales[this._def.name]=1,w.debug(t,["scale",this._def.name])),b.ChangeSet.create(t,!0)},L.dependency=function(t,e){if(2==arguments.length){ +var n=t===S.DATA?"data":"signal";e=x.array(e);for(var r=0,i=e.length;i>r;++r)this._graph[n](e[r]).addListener(this._parent)}return k.prototype.dependency.call(this,t,e)};var C=_.bisector(x.numcmp).right,D=function(t,e){return C(t,e)-1},P=_.bisector(function(t,e){return-1*x.numcmp(t,e)}).left;e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../transforms/Aggregate":118,datalib:26,"vega-dataflow":41,"vega-logging":47}],114:[function(t,e,n){(function(n){function r(t,e){this.duration=t||500,this.ease=e&&a.ease(e)||a.ease("cubic-in-out"),this.updates={next:null}}function i(t){for(var e,n,r,i,a,o,l=this.updates,c=l,d=c.next,f=this.duration,h=!0;null!=d;c=d,d=c.next)if(e=d.item,n=e.delay||0,r=(t-n)/f,0>r)h=!1;else{for(r>1&&(r=1),i=d.ease(r),a=0,o=d.length;o>a;++a)e[d[a].property]=d[a](i);e.touch(),s.item(e),1===r?(d.remove&&(e.status=u.EXIT,e.remove()),c.next=d.next,d=c):h=!1}return this.callback(),h}var a="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,s=t("vega-scenegraph").bound,o=t("vega-dataflow").Tuple,u=t("./Builder").STATUS,l=r.prototype,c={text:1,url:1};l.interpolate=function(t,e){var n,r,i,s,l=null;for(n in e)r=t[n],i=e[n],r!==i&&(c[n]||void 0===r?o.set(t,n,i):"number"!=typeof r||isFinite(r)?(s=a.interpolate(r,i),s.property=n,(l||(l=[])).push(s)):o.set(t,n,i));return null===l&&t.status===u.EXIT&&(l=[]),null!=l&&(l.item=t,l.ease=t.mark.ease||this.ease,l.next=this.updates.next,this.updates.next=l),this},l.start=function(t){for(var e=this,n=e.updates,r=n.next;null!=r;n=r,r=n.next)r.item.status===u.EXIT&&(r.item.status=u.UPDATE,r.remove=!0);e.callback=t,a.timer(function(t){return i.call(e,t)})},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Builder":110,"vega-dataflow":41,"vega-scenegraph":48}],115:[function(t,e,n){function r(t){function e(){I.type=null}function n(t){return{data:t}}function r(){var t=G||a();return M(t,B)}function a(){switch(E.type){case _:return _;case x:return x;case w:return b;default:return k}}function v(t,e,n){function r(e){return(t[0]<0?-Math.log(e>0?0:-e):Math.log(0>e?0:e))/Math.log(s)}function i(e){return t[0]<0?-Math.pow(s,-e):Math.pow(s,e)}if(null==e)return n;var a,s=E.base(),o=Math.min(s,E.ticks().length/e),u=t[0]>0?(a=1e-12,Math.ceil):(a=-1e-12,Math.floor);return function(t){return i(u(r(t)+a))/t>=o?n(t):""}}function M(t,e){var n,r,i=m.format,a="log"===E.type;switch(t){case k:return n=E.domain(),r=i.auto.number(n,Y,e||(a?".1r":null)),a?v(n,Y,r):r;case _:return(e?i:i.auto).time(e);case x:return(e?i:i.auto).utc(e);default:return String}}function T(t){var e=q||(E.ticks?E.ticks(Y):E.domain()),r=i(E,e,$).map(n);return e=e.map(function(e){return e=n(e),e.label=t(e.data),e}),[e,r]}function A(e){var n,r,i;e.type===w?(n={scale:e.scaleName,offset:.5+e.rangeBand()/2},r=n):(n={scale:e.scaleName,offset:.5},r={scale:e.scaleName+":prev",offset:.5}),i=s(e),m.extend(Z.gridLines,f(L)),m.extend(Z.majorTicks,f(L)),m.extend(Z.minorTicks,f(L)),m.extend(Z.tickLabels,h(L)),m.extend(Z.domain,g(L)),m.extend(Z.title,p(L)),Z.gridLines.properties.enter.stroke={value:L.axis.gridColor},Z.gridLines.properties.enter.strokeOpacity={value:L.axis.gridOpacity},u(C,Z.gridLines,r,n,1/0),u(C,Z.majorTicks,r,n,U),u(C,Z.minorTicks,r,n,j),o(C,Z.tickLabels,r,n,U,R),c(C,Z.domain,i,F),l(C,Z.title,i,P),m.extend(Z.gridLines.properties.update,H),m.extend(Z.majorTicks.properties.update,V),m.extend(Z.minorTicks.properties.update,X),m.extend(Z.tickLabels.properties.update,W),m.extend(Z.domain.properties.update,K),m.extend(Z.title.properties.update,J);var a=[Z.gridLines,Z.majorTicks,Z.minorTicks,Z.tickLabels,Z.domain,Z.title];m.extend(I,{type:"group",interactive:!1,properties:{enter:{encode:d,scales:[e.scaleName],signals:[],data:[]},update:{encode:d,scales:[e.scaleName],signals:[],data:[]}}}),I.marks=a.map(function(e){return y(t,e)})}var E,L=t.config(),C=L.axis.orient,D=0,P=L.axis.titleOffset,I={},N="front",O=!1,z=null,U=L.axis.tickSize,j=L.axis.tickSize,F=L.axis.tickSize,R=L.axis.padding,q=null,B=null,G=null,$=0,Y=L.axis.ticks,H={},W={},V={},X={},J={},K={},Z={gridLines:{},majorTicks:{},minorTicks:{},tickLabels:{},domain:{},title:{}},Q={};return Q.def=function(){I.type||A(E);var t=T(r()),e=z?[z].map(n):[];return I.marks[0].from=function(){return O?t[0]:[]},I.marks[1].from=function(){return t[0]},I.marks[2].from=function(){return t[1]},I.marks[3].from=I.marks[1].from,I.marks[4].from=function(){return[1]},I.marks[5].from=function(){return e},I.offset=D,I.orient=C,I.layer=N,I},Q.scale=function(t){return arguments.length?(E!==t&&(E=t,e()),Q):E},Q.orient=function(t){return arguments.length?(C!==t&&(C=t in S?t+"":L.axis.orient,e()),Q):C},Q.title=function(t){return arguments.length?(z!==t&&(z=t,e()),Q):z},Q.tickCount=function(t){return arguments.length?(Y=t,Q):Y},Q.tickValues=function(t){return arguments.length?(q=t,Q):q},Q.tickFormat=function(t){return arguments.length?(B!==t&&(B=t,e()),Q):B},Q.tickFormatType=function(t){return arguments.length?(G!==t&&(G=t,e()),Q):G},Q.tickSize=function(t,n){if(!arguments.length)return U;var r=arguments.length-1,i=+t,a=r>1?+n:U,s=r>0?+arguments[r]:U;return(U!==i||j!==a||F!==s)&&e(),U=i,j=a,F=s,Q},Q.tickSubdivide=function(t){return arguments.length?($=+t,Q):$},Q.offset=function(t){return arguments.length?(D=m.isObject(t)?t:+t,Q):D},Q.tickPadding=function(t){return arguments.length?(R!==+t&&(R=+t,e()),Q):R},Q.titleOffset=function(t){return arguments.length?(P!==+t&&(P=+t,e()),Q):P},Q.layer=function(t){return arguments.length?(N!==t&&(N=t,e()),Q):N},Q.grid=function(t){return arguments.length?(O!==t&&(O=t,e()),Q):O},Q.gridLineProperties=function(t){return arguments.length?(H!==t&&(H=t),Q):H},Q.majorTickProperties=function(t){return arguments.length?(V!==t&&(V=t),Q):V},Q.minorTickProperties=function(t){return arguments.length?(X!==t&&(X=t),Q):X},Q.tickLabelProperties=function(t){return arguments.length?(W!==t&&(W=t),Q):W},Q.titleProperties=function(t){return arguments.length?(J!==t&&(J=t),Q):J},Q.domainProperties=function(t){return arguments.length?(K!==t&&(K=t),Q):K},Q.reset=function(){return e(),Q},Q}function i(t,e,n){var r=[];if(n&&e.length>1){for(var i,s,o=a(t.domain()),u=-1,l=e.length,c=(e[1]-e[0])/++n;++u0;)(s=+e[u]-i*c)>=o[0]&&r.push(s);for(--u,i=0;++ie?[e,n]:[n,e]}function s(t){return t.rangeExtent?t.rangeExtent():a(t.range())}function o(t,e,n,r,i,a){i=Math.max(i,0)+a,("left"===t||"top"===t)&&(i*=-1),"top"===t||"bottom"===t?(m.extend(e.properties.enter,{x:n,y:{value:i}}),m.extend(e.properties.update,{x:r,y:{value:i},align:{value:"center"},baseline:{value:T[t]}})):(m.extend(e.properties.enter,{x:{value:i},y:n}),m.extend(e.properties.update,{x:{value:i},y:r,align:{value:M[t]},baseline:{value:"middle"}}))}function u(t,e,n,r,i){var a="left"===t||"top"===t?-1:1;i=i===1/0?"top"===t||"bottom"===t?{field:{group:"height",level:2},mult:-a}:{field:{group:"width",level:2},mult:-a}:{value:a*i},"top"===t||"bottom"===t?(m.extend(e.properties.enter,{x:n,y:{value:0},y2:i}),m.extend(e.properties.update,{x:r,y:{value:0},y2:i}),m.extend(e.properties.exit,{x:r})):(m.extend(e.properties.enter,{x:{value:0},x2:i,y:n}),m.extend(e.properties.update,{x:{value:0},x2:i,y:r}),m.extend(e.properties.exit,{y:r}))}function l(t,e,n,r){var i=~~((n[0]+n[1])/2),a="top"===t||"left"===t?-1:1;"bottom"===t||"top"===t?m.extend(e.properties.update,{x:{value:i},y:{value:a*r},angle:{value:0}}):m.extend(e.properties.update,{x:{value:a*r},y:{value:i},angle:{value:"left"===t?-90:90}})}function c(t,e,n,r){var i;("top"===t||"left"===t)&&(r=-1*r),i="bottom"===t||"top"===t?"M"+n[0]+","+r+"V0H"+n[1]+"V"+r:"M"+r+","+n[0]+"H0V"+n[1]+"H"+r,e.properties.update.path={value:i}}function d(t,e,n){var r=n?{}:t,i=t.mark.def.offset,a=t.mark.def.orient,s=e.width,o=e.height;if(m.isArray(i)){var u=i[0],l=i[1];switch(a){case"left":v.set(r,"x",-u),v.set(r,"y",l);break;case"right":v.set(r,"x",s+u),v.set(r,"y",l);break;case"bottom":v.set(r,"x",u),v.set(r,"y",o+l);break;case"top":v.set(r,"x",u),v.set(r,"y",-l);break;default:v.set(r,"x",u),v.set(r,"y",l)}}else switch(m.isObject(i)&&(i=-e.scale(i.scale)(i.value)),a){case"left":v.set(r,"x",-i),v.set(r,"y",0);break;case"right":v.set(r,"x",s+i),v.set(r,"y",0);break;case"bottom":v.set(r,"x",0),v.set(r,"y",o+i);break;case"top":v.set(r,"x",0),v.set(r,"y",-i);break;default:v.set(r,"x",0),v.set(r,"y",0)}return n&&n.interpolate(t,r),!0}function f(t){return{type:"rule",interactive:!1,key:"data",properties:{enter:{stroke:{value:t.axis.tickColor},strokeWidth:{value:t.axis.tickWidth},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1}}}}}function h(t){return{type:"text",interactive:!0,key:"data",properties:{enter:{fill:{value:t.axis.tickLabelColor},font:{value:t.axis.tickLabelFont},fontSize:{value:t.axis.tickLabelFontSize},opacity:{value:1e-6},text:{field:"label"}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1}}}}}function p(t){return{type:"text",interactive:!0,properties:{enter:{font:{value:t.axis.titleFont},fontSize:{value:t.axis.titleFontSize},fontWeight:{value:t.axis.titleFontWeight},fill:{value:t.axis.titleColor},align:{value:"center"},baseline:{value:"middle"},text:{field:"data"}},update:{}}}}function g(t){return{type:"path",interactive:!1,properties:{enter:{x:{value:.5},y:{value:.5},stroke:{value:t.axis.axisColor},strokeWidth:{value:t.axis.axisWidth}},update:{}}}}var m=t("datalib"),v=t("vega-dataflow").Tuple,y=t("../parse/mark"),_="time",x="utc",b="string",w="ordinal",k="number",S={top:1,right:1,bottom:1,left:1},M={bottom:"center",top:"center",left:"right",right:"left"},T={bottom:"top",top:"bottom",left:"middle",right:"middle"};e.exports=r},{"../parse/mark":99,datalib:26,"vega-dataflow":41}],116:[function(t,e,n){(function(n){function r(t){function e(){B.type=null}function n(t,e){return{data:t,index:e}}function r(t){return"ordinal"===t||"quantize"===t||"quantile"===t||"threshold"===t}function v(t){var e,r,i,a=y(w,k,S,M),s=(null==A?t.ticks?t.ticks.apply(t,N):t.domain():A).map(n),o=null==E?t.tickFormat?t.tickFormat.apply(t,N):String:E,u=5,l=d.range(s.length);w?(r=s.map(function(t){return Math.sqrt(w(t.data))}),i=d.max(r),r=r.reduce(function(t,e,n,r){return n>0&&(t[n]=t[n-1]+r[n-1]/2+u),t[n]+=e/2,t},[0]).map(Math.round)):(i=Math.round(Math.sqrt(C.legend.symbolSize)),r=T||(e=F.fontSize)&&e.value+u||C.legend.labelFontSize+u,r=l.map(function(t,e){return Math.round(i/2+e*r)}));var c,f=I;b&&(c=j.fontSize,f+=5+(c&&c.value||C.legend.titleFontSize));for(var h=0,p=r.length;p>h;++h)r[h]+=f;var g={name:"legend",type:"ordinal",points:!0,domain:l,range:r},m=(b?[b]:[]).map(n);return s.forEach(function(t){t.label=o(t.data),t.offset=i}),a.scales=[g],a.marks[0].from=function(){return m},a.marks[1].from=function(){return s},a.marks[2].from=a.marks[1].from,a}function y(e,n,r,l){var c=f.extend(R.titles,s(C)),d=f.extend(R.symbols,o(C)),h=f.extend(R.labels,u(C));return a(d,e,n,r,l),f.extend(c.properties.update,j),f.extend(d.properties.update,z),f.extend(h.properties.update,F),c.properties.enter.x.value+=I,c.properties.enter.y.value+=I,h.properties.enter.x.offset+=I+1,d.properties.enter.x.offset=I+1,h.properties.update.x.offset+=I+1,d.properties.update.x.offset=I+1,f.extend(B,{type:"group",interactive:!1,properties:{enter:p(t,"group",O),vg_legendPosition:{encode:i,signals:[],scales:[],data:[],fields:[]}}}),B.marks=[c,d,h].map(function(e){return g(t,e)}),B}function _(t){var e=x(t),r=t.domain(),i=(null==A?t.ticks?t.ticks.apply(t,N):t.domain():A).map(n),a=U.width&&U.width.value||C.legend.gradientWidth,s=null==E?t.tickFormat?t.tickFormat.apply(t,N):String:E,o={name:"legend",type:t.type,round:!0,zero:!1,domain:[r[0],r[r.length-1]],range:[I,a+I]};"pow"===t.type&&(o.exponent=t.exponent());var u=(b?[b]:[]).map(n);return i.forEach(function(t,e){t.label=s(t.data),t.align=e==i.length-1?"right":0===e?"left":"center"}),e.scales=[o],e.marks[0].from=function(){return u},e.marks[1].from=function(){return[1]},e.marks[2].from=function(){return i},e}function x(e){var n=f.extend(R.titles,s(C)),r=f.extend(R.gradient,l(C)),a=f.extend(R.labels,c(C)),o=new h,u=e.domain(),d=u[0],m=u[u.length-1],v=e.copy().domain([d,m]).range([0,1]),y="linear"!==e.type&&e.ticks?e.ticks.call(e,15):u;d!==y[0]&&y.unshift(d),m!==y[y.length-1]&&y.push(m);for(var _=0,x=y.length;x>_;++_)o.stop(v(y[_]),e(y[_]));r.properties.enter.fill={value:o},f.extend(n.properties.update,j),f.extend(r.properties.update,U),f.extend(a.properties.update,F);var w=r.properties,k=U.height,S=k&&k.value||w.enter.height.value;if(a.properties.enter.y.value=S,a.properties.update.y.value=S,b){var M=n.properties,T=j.fontSize,A=4+(T&&T.value||M.enter.fontSize.value);r.properties.enter.y.value+=A,a.properties.enter.y.value+=A,r.properties.update.y.value+=A,a.properties.update.y.value+=A}return n.properties.enter.x.value+=I,n.properties.enter.y.value+=I,r.properties.enter.x.value+=I,r.properties.enter.y.value+=I,a.properties.enter.y.value+=I,r.properties.update.x.value+=I,r.properties.update.y.value+=I,a.properties.update.y.value+=I,f.extend(B,{type:"group",interactive:!1,properties:{enter:p(t,"group",O),vg_legendPosition:{encode:i,signals:[],scales:[],data:[],fields:[]}}}),B.marks=[n,r,a].map(function(e){return g(t,e)}),B}var b,w=null,k=null,S=null,M=null,T=null,A=null,E=null,L=null,C=t.config(),D="right",P=C.legend.offset,I=C.legend.padding,N=[5],O={},z={},U={},j={},F={},R={titles:{},symbols:{},labels:{},gradient:{}},q={},B={};return q.def=function(){var t=w||k||S||M;return E=L?"time"===t.type?f.format.time(L):f.format.number(L):null,B.type||(B=t!==S&&t!==M||r(t.type)?v(t):_(t)),B.orient=D,B.offset=P,B.padding=I,B},q.size=function(t){return arguments.length?(w!==t&&(w=t,e()),q):w},q.shape=function(t){return arguments.length?(k!==t&&(k=t,e()),q):k},q.fill=function(t){return arguments.length?(S!==t&&(S=t,e()),q):S},q.stroke=function(t){return arguments.length?(M!==t&&(M=t,e()),q):M},q.title=function(t){return arguments.length?(b!==t&&(b=t,e()),q):b},q.format=function(t){return arguments.length?(L!==t&&(L=t,e()),q):L},q.spacing=function(t){return arguments.length?(T!==+t&&(T=+t,e()),q):T},q.orient=function(t){return arguments.length?(D=t in m?t+"":C.legend.orient,q):D},q.offset=function(t){return arguments.length?(P=+t,q):P},q.values=function(t){return arguments.length?(A=t,q):A},q.legendProperties=function(t){return arguments.length?(O=t,q):O},q.symbolProperties=function(t){return arguments.length?(z=t,q):z},q.gradientProperties=function(t){return arguments.length?(U=t,q):U},q.labelProperties=function(t){return arguments.length?(F=t,q):F},q.titleProperties=function(t){return arguments.length?(j=t,q):j},q.reset=function(){return e(),q},q}function i(t,e,n,r,i,a){var s,o=n?{}:t,u=t.mark.def.offset,l=t.mark.def.orient,c=2*t.mark.def.padding,d=~~t.bounds.width()+(t.width?0:c),f=~~t.bounds.height()+(t.height?0:c),h=e._legendPositions||(e._legendPositions={right:.5,left:.5});switch(o.x=.5,o.width=d,o.y=h[l],h[l]+=o.height=f,!n&&e.bounds&&(e.bounds.delta=e.bounds.x2-e.width),l){case"left":s=e.bounds?e.bounds.x1:0,o.x+=s-u-d;break;case"right":s=e.width+(e.bounds&&n?e.bounds.delta:0),o.x+=s+u}n&&n.interpolate(t,o);var p=t.mark.def.properties.enter.encode;return p.call(p,t,e,n,r,i,a),!0}function a(t,e,n,r,i){var a=t.properties.enter,s=t.properties.update;e&&(a.size=s.size={scale:e.scaleName,field:"data"}),n&&(a.shape=s.shape={scale:n.scaleName,field:"data"}),r&&(a.fill=s.fill={scale:r.scaleName,field:"data"}),i&&(a.stroke=s.stroke={scale:i.scaleName,field:"data"})}function s(t){var e=t.legend;return{type:"text",interactive:!1,key:"data",properties:{enter:{x:{value:0},y:{value:0},fill:{value:e.titleColor},font:{value:e.titleFont},fontSize:{value:e.titleFontSize},fontWeight:{value:e.titleFontWeight},baseline:{value:"top"},text:{field:"data"},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1}}}}}function o(t){var e=t.legend;return{type:"symbol",interactive:!1,key:"data",properties:{enter:{x:{field:"offset",mult:.5},y:{scale:"legend",field:"index"},shape:{value:e.symbolShape},size:{value:e.symbolSize},stroke:{value:e.symbolColor},strokeWidth:{value:e.symbolStrokeWidth},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{x:{field:"offset",mult:.5},y:{scale:"legend",field:"index"},opacity:{value:1}}}}}function u(t){var e=t.legend;return{type:"text",interactive:!1,key:"data",properties:{enter:{x:{field:"offset",offset:5},y:{scale:"legend",field:"index"},fill:{value:e.labelColor},font:{value:e.labelFont},fontSize:{value:e.labelFontSize},align:{value:e.labelAlign},baseline:{value:e.labelBaseline},text:{field:"label"},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{opacity:{value:1},x:{field:"offset",offset:5},y:{scale:"legend",field:"index"}}}}}function l(t){var e=t.legend;return{type:"rect",interactive:!1,properties:{enter:{x:{value:0},y:{value:0},width:{value:e.gradientWidth},height:{value:e.gradientHeight},stroke:{value:e.gradientStrokeColor},strokeWidth:{value:e.gradientStrokeWidth},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{x:{value:0},y:{value:0},opacity:{value:1}}}}}function c(t){var e=t.legend;return{type:"text",interactive:!1,key:"data",properties:{enter:{x:{scale:"legend",field:"data"},y:{value:20},dy:{value:2},fill:{value:e.labelColor},font:{value:e.labelFont},fontSize:{value:e.labelFontSize},align:{field:"align"},baseline:{value:"top"},text:{field:"label"},opacity:{value:1e-6}},exit:{opacity:{value:1e-6}},update:{x:{scale:"legend",field:"data"},y:{value:20},opacity:{value:1}}}}}var d="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,f=t("datalib"),h=t("vega-scenegraph").Gradient,p=t("../parse/properties"),g=t("../parse/mark"),m={right:1,left:1};e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../parse/mark":99,"../parse/properties":104,datalib:26,"vega-scenegraph":48}],117:[function(t,e,n){e.exports=function r(t,e){var n,i,a,s,o;if(e(t))return!0;var u=["items","axisItems","legendItems"];for(a=0,s=u.length;s>a;++a)if(o=t[u[a]])for(n=0,i=o.length;i>n;++n)if(r(o[n],e))return!0}},{}],118:[function(t,e,n){function r(t){return d.prototype.init.call(this,t),d.addParameters(this,{groupby:{type:"array"},summarize:{type:"custom",set:function(t){function e(t){t.signal&&(l[t.signal]=1)}var n,r,i,s,o,u,l={},d=this._transform;if(!a.isArray(s=t)){s=[];for(o in t)u=a.array(t[o]),s.push({field:o,ops:u})}for(n=0,r=s.length;r>n;++n)i=s[n],i.field.signal&&(l[i.field.signal]=1),a.array(i.ops).forEach(e),a.array(i.as).forEach(e);return d._fields=s,d._aggr=null,d.dependency(c.SIGNALS,a.keys(l)),d}}}),this._aggr=null,this._input=null,this._args=null,this._fields=[],this._out=[],this._type=p.TUPLE,this._acc={groupby:a["true"],value:a["true"]},this.router(!0).produces(!0)}function i(t){var e,n,r,i,a,s,o,u=[];for(a=t._dims,e=0,n=a.length;n>e;++e)u.push(a[e].name);for(s=t._aggr,e=0,n=s.length;n>e;++e)for(o=s[e].measures.fields,r=0,i=o.length;i>r;++r)u.push(o[r]);return u}var a=t("datalib"),s=t("vega-dataflow"),o=t("vega-logging"),u=s.ChangeSet,l=s.Tuple,c=s.Dependencies,d=t("./Transform"),f=t("./Facetor"),h=r.prototype=Object.create(d.prototype);h.constructor=r;var p=r.TYPES={VALUE:1,TUPLE:2,MULTI:3};r.VALID_OPS=["values","count","valid","missing","distinct","sum","mean","average","variance","variancep","stdev","stdevp","median","q1","q3","modeskew","min","max","argmin","argmax"],h.type=function(t){return this._type=t,this},h.accessors=function(t,e){var n=this._acc;n.groupby=a.$(t)||a["true"],n.value=a.$(e)||a["true"]},h.aggr=function(){if(this._aggr)return this._aggr;var t=this._graph,e=!1,n=[],r=this.param("groupby").field,s=function(e){return e.signal?t.signalRef(e.signal):e},o=this._fields.map(function(t){var r={name:s(t.field),as:a.array(t.as),ops:a.array(s(t.ops)).map(s),get:t.get};return e=e||null!=r.get,n.push(r.name),r});r.forEach(function(t){t.get&&(e=!0),n.push(t.name||t)}),this._args=e||!o.length?null:n,o.length||(o={"*":"values"});var u=this._aggr=(new f).groupby(r).stream(!0).summarize(o);return this._out=i(u),this._type!==p.VALUE&&u.key("_id"),u},h.transform=function(t,e){o.debug(t,["aggregate"]);var n,r,i,a,s=u.create(t),c=this.aggr(),d=this._out,f=this._args,h=!0,g=l.prev;if(e&&(s.rem.push.apply(s.rem,c.result()),c.clear(),this._aggr=null,c=this.aggr()),this._type===p.TUPLE)n=function(t){c._add(t),l.prev_init(t)},r=function(t){c._rem(g(t))},i=function(t){c._mod(t,g(t))};else{var m=this._acc.groupby,v=this._acc.value,y=this._type===p.VALUE?v:function(t){return{_id:t._id,groupby:m(t),value:v(t)}};n=function(t){c._add(y(t)),l.prev_init(t)},r=function(t){c._rem(y(g(t)))},i=function(t){c._mod(y(t),y(g(t)))}}if(t.add.forEach(n),e)t.mod.forEach(n);else{if(t.rem.forEach(r),f)for(a=0,h=!1;a","default":[5,2]}}),this._output={start:"bin_start",end:"bin_end"},this.mutates(!0)}var i=t("datalib"),a=t("vega-dataflow").Tuple,s=t("vega-logging"),o=t("./Transform"),u=t("./BatchTransform"),l=r.prototype=Object.create(u.prototype);l.constructor=r,l.extent=function(t){var e,n=[this.param("min"),this.param("max")];return(null==n[0]||null==n[1])&&(e=i.extent(t,this.param("field").accessor),null==n[0]&&(n[0]=e[0]),null==n[1]&&(n[1]=e[1])),n},l.batchTransform=function(t,e){function n(t){var e=d(t);e=null==e?null:h.start+h.step*~~((e-h.start)/h.step),a.set(t,o.start,e),a.set(t,o.end,e+h.step)}s.debug(t,["binning"]);var r=this.extent(e),o=this._output,u=this.param("step"),l=this.param("steps"),c=this.param("minstep"),d=this.param("field").accessor,f={min:r[0],max:r[1],base:this.param("base"),maxbins:this.param("maxbins"),div:this.param("div")};u&&(f.step=u),l&&(f.steps=l),c&&(f.minstep=c);var h=i.bins(f);return t.add.forEach(n),t.mod.forEach(n),t.rem.forEach(n),t.fields[o.start]=1,t.fields[o.end]=1,t},e.exports=r},{"./BatchTransform":119,"./Transform":138,datalib:26,"vega-dataflow":41,"vega-logging":47}],121:[function(t,e,n){function r(t){return o.prototype.init.call(this,t),o.addParameters(this,{field:{type:"field","default":"data"},pattern:{type:"value","default":"[\\w']+"},"case":{type:"value","default":"lower"},stopwords:{type:"value","default":""}}),this._output={text:"text",count:"count"},this.router(!0).produces(!0)}var i=t("vega-dataflow"),a=i.Tuple,s=t("vega-logging"),o=t("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u.transform=function(t,e){function n(t){return a.prev_init(t),i(t)}function r(t){return i(a.prev(t))}s.debug(t,["countpattern"]);var i=this.param("field").accessor,o=this.param("pattern"),u=this.param("stopwords"),l=!1;return this._stop!==u&&(this._stop=u,this._stop_re=new RegExp("^"+u+"$","i"),e=!0),this._pattern!==o&&(this._pattern=o,this._match=new RegExp(this._pattern,"g"),e=!0),e&&(this._counts={}),this._add(t.add,n),e||this._rem(t.rem,r),(e||(l=t.fields[i.field]))&&(l&&this._rem(t.mod,r),this._add(t.mod,n)),this._changeset(t)},u._changeset=function(t){var e,n,r,s=this._counts,o=this._tuples||(this._tuples={}),u=i.ChangeSet.create(t),l=this._output;for(e in s)n=o[e],r=s[e]||0,!n&&r?(o[e]=n=a.ingest({}),n[l.text]=e,n[l.count]=r,u.add.push(n)):0===r?(n&&u.rem.push(n),delete s[e],delete o[e]):n[l.count]!==r&&(a.set(n,l.count,r),u.mod.push(n));return u},u._tokenize=function(t){switch(this.param("case")){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(this._match)},u._add=function(t,e){var n,r,i,a,s=this._counts,o=this._stop_re;for(i=0;il;++l)o=n[l],u=e?s._id+"_"+o._id:o._id+"_"+s._id,this._ids[u]||(s._id!=o._id||r)&&(f[this._output.left]=e?s:o,f[this._output.right]=e?o:s,(!a||a(f))&&(t.add.push(f=d.ingest(f)),i.call(this,s,f),i.call(this,o,f),this._ids[u]=1,f={}))}function s(t,e,n){var r=this,i=this._cache[n._id];this._lastRem>i.s&&(i.c=i.c.filter(function(t){var n=t[r._output[e?"right":"left"]];return null!==r._cache[n._id]}),i.s=this._lastRem),t.mod.push.apply(t.mod,i.c)}function o(t,e){t.rem.push.apply(t.rem,this._cache[e._id].c),this._cache[e._id]=null,this._lastRem=this._stamp}function u(t,e){(t.add.length||t.rem.length)&&(e.fields[this._output.left]=1,e.fields[this._output.right]=1)}var l=t("vega-dataflow"),c=l.ChangeSet,d=l.Tuple,f=l.Dependencies.SIGNALS,h=t("vega-logging"),p=t("./Transform"),g=t("./BatchTransform"),m=r.prototype=Object.create(g.prototype);m.constructor=r,m.batchTransform=function(t,e){h.debug(t,["crossing"]);var n=this.param("with"),r=this.param("filter"),i=this.param("diagonal"),l=this._graph,d=l.values(f,this.dependency(f)),p=r?function(t){return r(t,null,d)}:null,g=!n.name,m=g?t:n.source.last(),v=g?e:n.source.values(),y=c.create(t),_=o.bind(this,y);return t.rem.forEach(_),t.add.forEach(a.bind(this,y,!0,v,i,p)),!g&&m.stamp>this._lastWith&&(m.rem.forEach(_),m.add.forEach(a.bind(this,y,!1,e,i,p)),m.mod.forEach(s.bind(this,y,!1)),u.call(this,m,y),this._lastWith=m.stamp),t.mod.forEach(s.bind(this,y,!0)),u.call(this,t,y),y},e.exports=r},{"./BatchTransform":119,"./Transform":138,"vega-dataflow":41,"vega-logging":47}],123:[function(t,e,n){function r(e){return i.addParameters(this,{transform:{type:"custom",set:function(t){return this._transform._pipeline=t,this._transform},get:function(){var e=t("../parse/transforms"),n=this._transform;return n._pipeline.map(function(t){return e(n._graph,t)})}}}),this._pipeline=[],a.call(this,e)}var i=t("./Transform"),a=t("./Aggregate"),s=r.prototype=Object.create(a.prototype);s.constructor=r,s.aggr=function(){return a.prototype.aggr.call(this).facet(this)},e.exports=r},{"../parse/transforms":108,"./Aggregate":118,"./Transform":138}],124:[function(t,e,n){function r(){s.call(this),this._facet=null,this._facetID=++d}function i(t){c.debug({},["disconnecting cell",this.tuple._id]);var e=this.ds.pipeline();t.removeListener(e[0]),t._graph.removeListener(e[0]),t._graph.disconnect(e)}var a=t("datalib"),s=a.Aggregator,o=s.prototype,u=t("vega-dataflow"),l=u.Tuple,c=t("vega-logging"),d=0,f=r.prototype=Object.create(o);f.constructor=r,f.facet=function(t){return arguments.length?(this._facet=t,this):this._facet},f._ingest=function(t){return l.ingest(t,null)},f._assign=l.set,f._newcell=function(t,e){var n=o._newcell.call(this,t,e),r=this._facet;if(r){var a=r._graph,s=n.tuple,u=r.param("transform");n.ds=a.data(s._facetID,u,s),n.disconnect=i,r.addListener(u[0])}return n},f._newtuple=function(t,e){var n=o._newtuple.call(this,t);return this._facet&&(l.set(n,"key",e),l.set(n,"_facetID",this._facetID+"_"+e)),n},f.clear=function(){if(this._facet)for(var t in this._cells)this._cells[t].disconnect(this._facet);return o.clear.call(this)},f._on_add=function(t,e){this._facet&&e.ds._input.add.push(t)},f._on_rem=function(t,e){this._facet&&e.ds._input.rem.push(t)},f._on_mod=function(t,e,n,r){this._facet&&(n===r?n.ds._input.mod.push(t):(n.ds._input.rem.push(t),r.ds._input.add.push(t)))},f._on_drop=function(t){this._facet&&t.disconnect(this._facet)},f._on_keep=function(t){this._facet&&u.ChangeSet.copy(this._input,t.ds._input)},e.exports=r},{datalib:26,"vega-dataflow":41,"vega-logging":47}],125:[function(t,e,n){function r(t){return o.prototype.init.call(this,t),o.addParameters(this,{test:{type:"expr"}}),this._skip={},this.router(!0)}var i=t("vega-dataflow"),a=i.Dependencies.SIGNALS,s=t("vega-logging"),o=t("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u.transform=function(t){s.debug(t,["filtering"]);var e=i.ChangeSet.create(t),n=this._graph,r=this._skip,o=this.param("test"),u=n.values(a,this.dependency(a));return t.rem.forEach(function(t){1!==r[t._id]?e.rem.push(t):r[t._id]=0}),t.add.forEach(function(t){o(t,null,u)?e.add.push(t):r[t._id]=1}),t.mod.forEach(function(t){var n=o(t,null,u),i=1===r[t._id];n&&i?(r[t._id]=0,e.add.push(t)):n&&!i?e.mod.push(t):!n&&i||(e.rem.push(t),r[t._id]=1)}),e},e.exports=r},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],126:[function(t,e,n){function r(t){return o.prototype.init.call(this,t),o.addParameters(this,{fields:{type:"array"}}),this._output={key:"key",value:"value"},this._cache={},this.router(!0).produces(!0)}var i=t("vega-dataflow"),a=i.Tuple,s=t("vega-logging"),o=t("./Transform"),u=r.prototype=Object.create(o.prototype);u.constructor=r,u._reset=function(t,e){for(var n in this._cache)e.rem.push.apply(e.rem,this._cache[n]);this._cache={}},u._tuple=function(t,e,n){var r=this._cache[t._id]||(this._cache[t._id]=Array(n));return r[e]?a.rederive(t,r[e]):r[e]=a.derive(t)},u._fn=function(t,e,n){var r,i,s,o,u,l;for(r=0,s=t.length;s>r;++r)for(u=t[r],i=0,o=e.field.length;o>i;++i)l=this._tuple(u,i,o),a.set(l,this._output.key,e.field[i]),a.set(l,this._output.value,e.accessor[i](u)),n.push(l)},u.transform=function(t,e){s.debug(t,["folding"]);var n=this,r=this.param("fields"),a=i.ChangeSet.create(t);return e&&this._reset(t,a),this._fn(t.add,r,a.add),this._fn(t.mod,r,e?a.add:a.mod),t.rem.forEach(function(t){a.rem.push.apply(a.rem,n._cache[t._id]),n._cache[t._id]=null}),(t.add.length||t.rem.length||r.field.some(function(e){return!!t.fields[e]}))&&(a.fields[this._output.key]=1,a.fields[this._output.value]=1),a},e.exports=r},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],127:[function(t,e,n){(function(n){function r(t){return l.prototype.init.call(this,t),this._prev=null,this._interactive=!1,this._setup=!0,this._nodes=[],this._links=[],this._layout=i.layout.force(),l.addParameters(this,{size:{type:"array","default":[500,500]},bound:{type:"value","default":!0},links:{type:"data"},linkStrength:{type:"value","default":1},linkDistance:{type:"value","default":20},charge:{type:"value","default":-30},chargeDistance:{type:"value","default":1/0},friction:{type:"value","default":.9},theta:{type:"value","default":.8},gravity:{type:"value","default":.1},alpha:{type:"value","default":.1},iterations:{type:"value","default":500},interactive:{type:"value","default":this._interactive},active:{type:"value","default":this._prev},fixed:{type:"data"}}),this._output={x:"layout_x",y:"layout_y"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=t("vega-dataflow"),s=a.Tuple,o=a.ChangeSet,u=t("vega-logging"),l=t("./Transform"),c=r.prototype=Object.create(l.prototype);c.constructor=r,c.transform=function(t,e){u.debug(t,["force"]),e-=t.signals.active?1:0; +var n=this.param("interactive"),r=this.param("links").source,i=r.last(),a=this.param("active"),o=this._output,l=this._layout,c=this._nodes,d=this._links;if(i.stamph;++h)l.tick();l.stop()}return this.update(a),(e||a!==this._prev&&a&&a.update)&&l.alpha(this.param("alpha")),a!==this._prev&&(this._prev=a),t.rem.length&&l.nodes(this._nodes=s.idFilter(c,t.rem)),i&&i.rem.length&&l.links(this._links=s.idFilter(d,i.rem)),t.fields[o.x]=1,t.fields[o.y]=1,t},c.configure=function(t,e,n,r){var i=this._layout,a=this._setup||t.add.length||e&&e.add.length||n!==this._interactive||this.param("charge")!==i.charge()||this.param("linkStrength")!==i.linkStrength()||this.param("linkDistance")!==i.linkDistance();if((a||r)&&i.size(this.param("size")).chargeDistance(this.param("chargeDistance")).theta(this.param("theta")).gravity(this.param("gravity")).friction(this.param("friction")),a){this._setup=!1,this._interactive=n;var s,u,l=this,c=this._graph,d=this._nodes,f=this._links;for(s=t.add,u=0;un;++n)h[c[n].id]=1;for(n=0;n"},translate:{type:"array"},rotate:{type:"array"},scale:{type:"value"},precision:{type:"value"},clipAngle:{type:"value"},clipExtent:{type:"value"}},r.d3Projection=function(){var t,e,n,s=this.param("projection"),o=r.Parameters;s!==this._mode&&(this._mode=s,this._projection=i.geo[s]()),t=this._projection;for(e in o)"projection"!==e&&t[e]&&(n=this.param(e),void 0===n||a.isArray(n)&&0===n.length||n!==t[e]()&&t[e](n));return t};var l=r.prototype=Object.create(u.prototype);l.constructor=r,l.transform=function(t){function e(t){var e=[i(t),a(t)],r=u(e)||[null,null];s.set(t,n.x,r[0]),s.set(t,n.y,r[1])}o.debug(t,["geo"]);var n=this._output,i=this.param("lon").accessor,a=this.param("lat").accessor,u=r.d3Projection.call(this);return t.add.forEach(e),this.reevaluate(t)&&(t.mod.forEach(e),t.rem.forEach(e)),t.fields[n.x]=1,t.fields[n.y]=1,t},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Transform":138,datalib:26,"vega-dataflow":41,"vega-logging":47}],130:[function(t,e,n){(function(n){function r(t){return l.prototype.init.call(this,t),l.addParameters(this,u.Parameters),l.addParameters(this,{field:{type:"field","default":null}}),this._output={path:"layout_path"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=t("datalib"),s=t("vega-dataflow").Tuple,o=t("vega-logging"),u=t("./Geo"),l=t("./Transform"),c=r.prototype=Object.create(l.prototype);c.constructor=r,c.transform=function(t){function e(t){s.set(t,n.path,c(r(t)))}o.debug(t,["geopath"]);var n=this._output,r=this.param("field").accessor||a.identity,l=u.d3Projection.call(this),c=i.geo.path().projection(l);return t.add.forEach(e),this.reevaluate(t)&&(t.mod.forEach(e),t.rem.forEach(e)),t.fields[n.path]=1,t},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./Geo":129,"./Transform":138,datalib:26,"vega-dataflow":41,"vega-logging":47}],131:[function(t,e,n){function r(t){return c.prototype.init.call(this,t),l.addParameters(this,{groupby:{type:"array"},orderby:{type:"array"},field:{type:"field"},method:{type:"value","default":"value"},value:{type:"value","default":0}}),this.router(!0).produces(!0)}function i(t,e,n,r){var i,a={_imputed:!0};for(i=0;il;++l)for(r=w[l],"value"!==g&&(m=s[g](r,n)),u=0,c=r.length;c>u;++u)null==r[u]&&(f=i(h.field,r.values,p.field,k[u]),f[_]=m,b.push(f));for(u=0,c=b.length;c>u;++u)t.add.push(b[u]);for(u=0,c=x.length;c>u;++u)t.rem.push(x[u]);return this._imputed=b,o.debug(t,["imputing2"]),t},e.exports=r},{"./BatchTransform":119,"./Transform":138,datalib:26,"vega-dataflow":41,"vega-logging":47}],132:[function(t,e,n){function r(t){return c.prototype.init.call(this,t),c.addParameters(this,{sourceX:{type:"field","default":"_source.layout_x"},sourceY:{type:"field","default":"_source.layout_y"},targetX:{type:"field","default":"_target.layout_x"},targetY:{type:"field","default":"_target.layout_y"},tension:{type:"value","default":.2},shape:{type:"value","default":"line"}}),this._output={path:"layout_path"},this.mutates(!0)}function i(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function a(t,e,n,r,i){var a=n-t,s=r-e,o=i*(a+s),u=i*(s-a);return"M"+t+","+e+"C"+(t+o)+","+(e+u)+" "+(n+u)+","+(r-o)+" "+n+","+r}function s(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r}function o(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r}var u=t("vega-dataflow").Tuple,l=t("vega-logging"),c=t("./Transform"),d=r.prototype=Object.create(c.prototype);d.constructor=r;var f={line:i,curve:a,diagonal:s,diagonalX:s,diagonalY:o};d.transform=function(t){function e(t){var e=r(i(t),a(t),s(t),o(t),c);u.set(t,n.path,e)}l.debug(t,["linkpath"]);var n=this._output,r=f[this.param("shape")]||f.line,i=this.param("sourceX").accessor,a=this.param("sourceY").accessor,s=this.param("targetX").accessor,o=this.param("targetY").accessor,c=this.param("tension");return t.add.forEach(e),this.reevaluate(t)&&(t.mod.forEach(e),t.rem.forEach(e)),t.fields[n.path]=1,t},e.exports=r},{"./Transform":138,"vega-dataflow":41,"vega-logging":47}],133:[function(t,e,n){function r(t){return s.prototype.init.call(this,t),s.addParameters(this,{on:{type:"data"},onKey:{type:"field","default":null},as:{type:"array"},keys:{type:"array","default":["data"]},"default":{type:"value"}}),this.mutates(!0)}var i=t("vega-dataflow").Tuple,a=t("vega-logging"),s=t("./Transform"),o=r.prototype=Object.create(s.prototype);o.constructor=r,o.transform=function(t,e){function n(t){for(var e=0;e"}}),this.router(!0)}var i=t("datalib"),a=t("vega-logging"),s=t("./Transform"),o=r.prototype=Object.create(s.prototype);o.constructor=r,o.transform=function(t){return a.debug(t,["sorting"]),(t.add.length||t.mod.length||t.rem.length)&&(t.sort=i.comparator(this.param("by").field)),t},e.exports=r},{"./Transform":138,datalib:26,"vega-logging":47}],137:[function(t,e,n){function r(t){return l.prototype.init.call(this,t),u.addParameters(this,{groupby:{type:"array"},sortby:{type:"array"},field:{type:"field"},offset:{type:"value","default":"zero"}}),this._output={start:"layout_start",end:"layout_end",mid:"layout_mid"},this.mutates(!0)}function i(t,e,n,r){var i,a,s,o,u,l,c,d=[],f=function(t){return t(s)};if(null==e)d.push(t.slice());else for(i={},a=0;ac&&(c=l),null!=n&&u.sort(n)}return d.max=c,d}var a=t("datalib"),s=t("vega-dataflow").Tuple,o=t("vega-logging"),u=t("./Transform"),l=t("./BatchTransform"),c=r.prototype=Object.create(l.prototype);c.constructor=r,c.batchTransform=function(t,e){o.debug(t,["stacking"]);for(var n=this.param("groupby").accessor,r=a.comparator(this.param("sortby").field),u=this.param("field").accessor,l=this.param("offset"),c=this._output,d=i(e,n,r,u),f=0,h=d.max;f","default":["-value"]},children:{type:"field","default":"children"},field:{type:"field","default":"value"},size:{type:"array","default":[500,500]},round:{type:"value","default":!0},sticky:{type:"value","default":!1},ratio:{type:"value","default":c},padding:{type:"value","default":null},mode:{type:"value","default":"squarify"}}),this._layout=i.layout.treemap(),this._output={x:"layout_x",y:"layout_y",width:"layout_width",height:"layout_height",depth:"layout_depth"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=t("datalib"),s=t("vega-dataflow").Tuple,o=t("vega-logging"),u=t("./Transform"),l=t("./BatchTransform"),c=.5*(1+Math.sqrt(5)),d=r.prototype=Object.create(l.prototype);d.constructor=r,d.batchTransform=function(t,e){o.debug(t,["treemap"]);var n=this._layout,r=this._output;return n.sort(a.comparator(this.param("sort").field)).children(this.param("children").accessor).value(this.param("field").accessor).size(this.param("size")).round(this.param("round")).sticky(this.param("sticky")).ratio(this.param("ratio")).padding(this.param("padding")).mode(this.param("mode")).nodes(e[0]),e.forEach(function(t){s.set(t,r.x,t.x),s.set(t,r.y,t.y),s.set(t,r.width,t.dx),s.set(t,r.height,t.dy),s.set(t,r.depth,t.depth)}),t.fields[r.x]=1,t.fields[r.y]=1,t.fields[r.width]=1,t.fields[r.height]=1,t},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./BatchTransform":119,"./Transform":138,datalib:26,"vega-dataflow":41,"vega-logging":47}],140:[function(t,e,n){(function(n){function r(t){return u.prototype.init.call(this,t),o.addParameters(this,{clipExtent:{type:"array","default":[[-1e5,-1e5],[1e5,1e5]]},x:{type:"field","default":"layout_x"},y:{type:"field","default":"layout_y"}}),this._layout=i.geom.voronoi(),this._output={path:"layout_path"},this.mutates(!0)}var i="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,a=t("vega-dataflow/src/Tuple"),s=t("vega-logging"),o=t("./Transform"),u=t("./BatchTransform"),l=r.prototype=Object.create(u.prototype);l.constructor=r,l.batchTransform=function(t,e){s.debug(t,["voronoi"]);for(var n=this._output.path,r=this._layout.clipExtent(this.param("clipExtent")).x(this.param("x").accessor).y(this.param("y").accessor)(e),i=0;i","default":[900,500]},text:{type:"field","default":"data"},rotate:{type:"field|value","default":0},font:{type:"field|value","default":{value:"sans-serif"}},fontSize:{type:"field|value","default":14},fontStyle:{type:"field|value","default":{value:"normal"}},fontWeight:{type:"field|value","default":{value:"normal"}},fontScale:{type:"array","default":[10,50]},padding:{type:"value","default":1},spiral:{type:"value","default":"archimedean"}}),this._layout=u().canvas(l.instance),this._output={x:"layout_x",y:"layout_y",font:"layout_font",fontSize:"layout_fontSize",fontStyle:"layout_fontStyle",fontWeight:"layout_fontWeight",rotate:"layout_rotate"},this.mutates(!0)}function i(t){return t&&t.accessor||t}function a(t){var e=Object.create(t);return e._tuple=t,e}var s=t("datalib"),o="undefined"!=typeof window?window.d3:"undefined"!=typeof n?n.d3:null,u=t("d3-cloud"),l=t("vega-scenegraph").canvas,c=t("vega-dataflow/src/Tuple"),d=t("vega-logging"),f=t("./Transform"),h=t("./BatchTransform"),p=r.prototype=Object.create(h.prototype);p.constructor=r,p.batchTransform=function(t,e){d.debug(t,["wordcloud"]);var n,r,u=this._layout,l=this._output,f=this.param("fontSize"),h=f.accessor&&this.param("fontScale");f=f.accessor||o.functor(f),h.length&&(r=o.scale.sqrt().domain(s.extent(e,n=f)).range(h),f=function(t){return r(n(t))}),u.size(this.param("size")).text(i(this.param("text"))).padding(this.param("padding")).spiral(this.param("spiral")).rotate(i(this.param("rotate"))).font(i(this.param("font"))).fontStyle(i(this.param("fontStyle"))).fontWeight(i(this.param("fontWeight"))).fontSize(f).words(e.map(a)).on("end",function(t){var e,n,r,i,a=u.size(),s=a[0]>>1,o=a[1]>>1;for(r=0,i=t.length;i>r;++r)e=t[r],n=e._tuple,c.set(n,l.x,e.x+s),c.set(n,l.y,e.y+o),c.set(n,l.font,e.font),c.set(n,l.fontSize,e.size),c.set(n,l.fontStyle,e.style),c.set(n,l.fontWeight,e.weight),c.set(n,l.rotate,e.rotate)}).start();for(var p in l)t.fields[l[p]]=1;return t},e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./BatchTransform":119,"./Transform":138,"d3-cloud":3,datalib:26,"vega-dataflow/src/Tuple":40,"vega-logging":47,"vega-scenegraph":48}],142:[function(t,e,n){e.exports={aggregate:t("./Aggregate"),bin:t("./Bin"),cross:t("./Cross"),countpattern:t("./CountPattern"),linkpath:t("./LinkPath"),facet:t("./Facet"),filter:t("./Filter"),fold:t("./Fold"),force:t("./Force"),formula:t("./Formula"),geo:t("./Geo"),geopath:t("./GeoPath"),impute:t("./Impute"),lookup:t("./Lookup"),pie:t("./Pie"),sort:t("./Sort"),stack:t("./Stack"),treemap:t("./Treemap"),voronoi:t("./Voronoi"),wordcloud:t("./Wordcloud")}},{"./Aggregate":118,"./Bin":120,"./CountPattern":121,"./Cross":122,"./Facet":123,"./Filter":125,"./Fold":126,"./Force":127,"./Formula":128,"./Geo":129,"./GeoPath":130,"./Impute":131,"./LinkPath":132,"./Lookup":133,"./Pie":135,"./Sort":136,"./Stack":137,"./Treemap":139,"./Voronoi":140,"./Wordcloud":141}]},{},[1])(1)}); diff --git a/vega-lite-schema.json b/vega-lite-schema.json index 05f9aa3dba..67abfd611a 100644 --- a/vega-lite-schema.json +++ b/vega-lite-schema.json @@ -206,9 +206,10 @@ } }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -420,9 +421,10 @@ } }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -498,9 +500,10 @@ "aggregate": {"type": "string","enum": ["count"],"supportedTypes": {"N": 1,"O": 1}}, "padding": {"type": "number","minimum": 0,"maximum": 1,"default": 0.1}, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -629,9 +632,10 @@ "aggregate": {"type": "string","enum": ["count"],"supportedTypes": {"N": 1,"O": 1}}, "padding": {"type": "number","minimum": 0,"maximum": 1,"default": 0.1}, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -859,9 +863,10 @@ "description": "Size of marks." }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -1104,9 +1109,10 @@ } }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -1207,9 +1213,10 @@ "description": "Whether the shape's color should be used as fill color instead of stroke color." }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -1372,9 +1379,10 @@ "description": "The formatting pattern for text value. If not undefined, this will be determined by small/largeNumberFormat and the max value of the field." }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], @@ -1453,9 +1461,10 @@ } }, "sort": { + "default": "ascending", "supportedTypes": {"N": 1,"O": 1}, "oneOf": [ - {"type": "string","enum": ["ascending","descending"]}, + {"type": "string","enum": ["ascending","descending","unsorted"]}, { "type": "object", "required": ["field","op"], diff --git a/vega-lite.js b/vega-lite.js index a842ca14be..e013bec0a1 100644 --- a/vega-lite.js +++ b/vega-lite.js @@ -6765,6 +6765,10 @@ function DataSourceInput(ds) { ds._data = ds._data.concat(delta.add); } + if (delta.sort) { + ds._data.sort(delta.sort); + } + // if reflowing, add any other tuples not currently in changeset if (input.reflow) { delta.mod = delta.mod.concat( @@ -7057,7 +7061,7 @@ prototype.preprocess = function(branch) { }; prototype.connect = function(branch) { - var collector, node, data, signals, i, n, j, m; + var collector, node, data, signals, i, n, j, m, x, y; // connect the pipeline for (i=0, n=branch.length; i 0) branch[i-1].addListener(node); @@ -10367,7 +10379,6 @@ function getFields(aggr) { prototype.transform = function(input, reset) { log.debug(input, ['aggregate']); - this._input = input; // Used by Facetor._on_keep. var output = ChangeSet.create(input), aggr = this.aggr(), @@ -10420,7 +10431,7 @@ prototype.transform = function(input, reset) { for (i=0; i180||-180>n?n-360*Math.round(n/360):n}function n(){}function r(e){var t;return e=(e+"").trim().toLowerCase(),(t=D.exec(e))?(t=parseInt(t[1],16),i(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t)):(t=O.exec(e))?a(parseInt(t[1],16)):(t=A.exec(e))?i(t[1],t[2],t[3]):(t=E.exec(e))?i(2.55*t[1],2.55*t[2],2.55*t[3]):(t=N.exec(e))?u(t[1],.01*t[2],.01*t[3]):R.hasOwnProperty(e)?a(R[e]):null}function a(e){return i(e>>16&255,e>>8&255,255&e)}function i(e,t,a){return 1===arguments.length&&(e instanceof n||(e=r(e)),e?(e=e.rgb(),a=e.b,t=e.g,e=e.r):e=t=a=NaN),new o(e,t,a)}function o(e,t,n){this.r=+e,this.g=+t,this.b=+n}function s(e,t,n){return"#"+(isNaN(e)?"00":(e=Math.round(e))<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16))+(isNaN(t)?"00":(t=Math.round(t))<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16))+(isNaN(n)?"00":(n=Math.round(n))<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16))}function u(e,t,a){if(1===arguments.length)if(e instanceof c)a=e.l,t=e.s,e=e.h;else if(e instanceof n||(e=r(e)),e){if(e instanceof c)return e;e=e.rgb();var i=e.r/255,o=e.g/255,s=e.b/255,u=Math.min(i,o,s),f=Math.max(i,o,s),l=f-u;a=(f+u)/2,l?(t=.5>a?l/(f+u):l/(2-f-u),e=i===f?(o-s)/l+6*(s>o):o===f?(s-i)/l+2:(i-o)/l+4,e*=60):(e=NaN,t=a>0&&1>a?0:e)}else e=t=a=NaN;return new c(e,t,a)}function c(e,t,n){this.h=+e,this.s=+t,this.l=+n}function f(e,t,n){return 255*(60>e?t+(n-t)*e/60:180>e?n:240>e?t+(n-t)*(240-e)/60:t)}function l(e,t,n){if(1===arguments.length)if(e instanceof d)n=e.b,t=e.a,e=e.l;else if(e instanceof y){var r=e.h*G;n=Math.sin(r)*e.c,t=Math.cos(r)*e.c,e=e.l}else{e instanceof o||(e=i(e));var a=g(e.r),s=g(e.g),n=g(e.b),u=h((.4124564*a+.3575761*s+.1804375*n)/z),c=h((.2126729*a+.7151522*s+.072175*n)/I),f=h((.0193339*a+.119192*s+.9503041*n)/H);n=200*(c-f),t=500*(u-c),e=116*c-16}return new d(e,t,n)}function d(e,t,n){this.l=+e,this.a=+t,this.b=+n}function h(e){return e>B?Math.pow(e,1/3):e/W+X}function p(e){return e>q?e*e*e:W*(e-X)}function m(e){return 255*(.0031308>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function g(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function b(e,t,n){return 1===arguments.length&&(e instanceof y?(n=e.l,t=e.c,e=e.h):(e instanceof d||(e=l(e)),n=e.l,t=Math.sqrt(e.a*e.a+e.b*e.b),e=Math.atan2(e.b,e.a)*J,0>e&&(e+=360))),new y(e,t,n)}function y(e,t,n){this.h=+e,this.c=+t,this.l=+n}function v(e,t,n){if(1===arguments.length)if(e instanceof x)n=e.l,t=e.s,e=e.h;else{e instanceof o||(e=i(e));var r=e.r/255,a=e.g/255,s=e.b/255;n=(ae*s+ne*r-re*a)/(ae+ne-re);var u=s-n,c=(te*(a-n)-K*u)/ee;t=Math.sqrt(c*c+u*u)/(te*n*(1-n)),e=t?Math.atan2(c,u)*J-120:NaN,0>e&&(e+=360)}return new x(e,t,n)}function x(e,t,n){this.h=+e,this.s=+t,this.l=+n}function w(e){return function(n,r){n=v(n),r=v(r);var a=isNaN(n.h)?r.h:n.h,i=isNaN(n.s)?r.s:n.s,o=n.l,s=isNaN(r.h)?0:t(r.h,a),u=isNaN(r.s)?0:r.s-i,c=r.l-o;return function(t){return n.h=a+s*t,n.s=i+u*t,n.l=o+c*Math.pow(t,e),n+""}}}function _(e){return function(t,n){t=v(t),n=v(n);var r=isNaN(t.h)?n.h:t.h,a=isNaN(t.s)?n.s:t.s,i=t.l,o=isNaN(n.h)?0:n.h-r,s=isNaN(n.s)?0:n.s-a,u=n.l-i;return function(n){return t.h=r+o*n,t.s=a+s*n,t.l=i+u*Math.pow(n,e),t+""}}}function M(e,t){e=b(e),t=b(t);var n=isNaN(e.h)?t.h:e.h,r=isNaN(e.c)?t.c:e.c,a=e.l,i=isNaN(t.h)?0:t.h-n,o=isNaN(t.c)?0:t.c-r,s=t.l-a;return function(t){return e.h=n+i*t,e.c=r+o*t,e.l=a+s*t,e+""}}function S(e,n){e=b(e),n=b(n);var r=isNaN(e.h)?n.h:e.h,a=isNaN(e.c)?n.c:e.c,i=e.l,o=isNaN(n.h)?0:t(n.h,r),s=isNaN(n.c)?0:n.c-a,u=n.l-i;return function(t){return e.h=r+o*t,e.c=a+s*t,e.l=i+u*t,e+""}}function T(e,t){e=l(e),t=l(t);var n=e.l,r=e.a,a=e.b,i=t.l-n,o=t.a-r,s=t.b-a;return function(t){return e.l=n+i*t,e.a=r+o*t,e.b=a+s*t,e+""}}function k(e,t){e=u(e),t=u(t);var n=isNaN(e.h)?t.h:e.h,r=isNaN(e.s)?t.s:e.s,a=e.l,i=isNaN(t.h)?0:t.h-n,o=isNaN(t.s)?0:t.s-r,s=t.l-a;return function(t){return e.h=n+i*t,e.s=r+o*t,e.l=a+s*t,e+""}}function L(e,n){e=u(e),n=u(n);var r=isNaN(e.h)?n.h:e.h,a=isNaN(e.s)?n.s:e.s,i=e.l,o=isNaN(n.h)?0:t(n.h,r),s=isNaN(n.s)?0:n.s-a,c=n.l-i;return function(t){return e.h=r+o*t,e.s=a+s*t,e.l=i+c*t,e+""}}function C(e,t){e=i(e),t=i(t);var n=e.r,r=e.g,a=e.b,o=t.r-n,u=t.g-r,c=t.b-a;return function(e){return s(Math.round(n+o*e),Math.round(r+u*e),Math.round(a+c*e))}}var D=/^#([0-9a-f]{3})$/,O=/^#([0-9a-f]{6})$/,A=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,E=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,N=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;r.prototype=n.prototype={displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}};var R={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},U=.7,j=1/U,Y=i.prototype=o.prototype=new n;Y.brighter=function(e){return e=null==e?j:Math.pow(j,e),new o(this.r*e,this.g*e,this.b*e)},Y.darker=function(e){return e=null==e?U:Math.pow(U,e),new o(this.r*e,this.g*e,this.b*e)},Y.rgb=function(){return this},Y.displayable=function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255},Y.toString=function(){return s(this.r,this.g,this.b)};var F=u.prototype=c.prototype=new n;F.brighter=function(e){return e=null==e?j:Math.pow(j,e),new c(this.h,this.s,this.l*e)},F.darker=function(e){return e=null==e?U:Math.pow(U,e),new c(this.h,this.s,this.l*e)},F.rgb=function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(.5>n?n:1-n)*t,a=2*n-r;return new o(f(e>=240?e-240:e+120,a,r),f(e,a,r),f(120>e?e+240:e-120,a,r))},F.displayable=function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1};var P=18,z=.95047,I=1,H=1.08883,X=4/29,q=6/29,W=3*q*q,B=q*q*q,$=l.prototype=d.prototype=new n;$.brighter=function(e){return new d(this.l+P*(null==e?1:e),this.a,this.b)},$.darker=function(e){return new d(this.l-P*(null==e?1:e),this.a,this.b)},$.rgb=function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return e=I*p(e),t=z*p(t),n=H*p(n),new o(m(3.2404542*t-1.5371385*e-.4985314*n),m(-.969266*t+1.8760108*e+.041556*n),m(.0556434*t-.2040259*e+1.0572252*n))};var G=Math.PI/180,J=180/Math.PI,V=b.prototype=y.prototype=new n;V.brighter=function(e){return new y(this.h,this.c,this.l+P*(null==e?1:e))},V.darker=function(e){return new y(this.h,this.c,this.l-P*(null==e?1:e))},V.rgb=function(){return l(this).rgb()};var Z=-.14861,Q=1.78277,K=-.29227,ee=-.90649,te=1.97294,ne=te*ee,re=te*Q,ae=Q*K-ee*Z,ie=v.prototype=x.prototype=new n;ie.brighter=function(e){return e=null==e?j:Math.pow(j,e),new x(this.h,this.s,this.l*e)},ie.darker=function(e){return e=null==e?U:Math.pow(U,e),new x(this.h,this.s,this.l*e)},ie.rgb=function(){var e=isNaN(this.h)?0:(this.h+120)*G,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new o(255*(t+n*(Z*r+Q*a)),255*(t+n*(K*r+ee*a)),255*(t+n*(te*r)))};var oe=w(1),se=_(1);e.interpolateCubehelix=oe,e.interpolateCubehelixLong=se,e.color=r,e.rgb=i,e.hsl=u,e.lab=l,e.hcl=b,e.cubehelix=v,e.interpolateRgb=C,e.interpolateHsl=L,e.interpolateHslLong=k,e.interpolateLab=T,e.interpolateHcl=S,e.interpolateHclLong=M,e.interpolateCubehelixGamma=w,e.interpolateCubehelixGammaLong=_})},{}],5:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.format={})}(this,function(e){"use strict";function t(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function n(e){return e=t(Math.abs(e)),e?e[1]:NaN}function r(e,n){var r=t(e,n);if(!r)return e+"";var a=r[0],i=r[1],o=i-(m=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=a.length;return o===s?a:o>s?a+new Array(o-s+1).join("0"):o>0?a.slice(0,o)+"."+a.slice(o):"0."+new Array(1-o).join("0")+t(e,n+o-1)[0]}function a(e,n){var r=t(e,n);if(!r)return e+"";var a=r[0],i=r[1];return 0>i?"0."+new Array(-i).join("0")+a:a.length>i+1?a.slice(0,i+1)+"."+a.slice(i+1):a+new Array(i-a.length+2).join("0")}function i(e,t){e=e.toPrecision(t);e:for(var n,r=e.length,a=1,i=-1;r>a;++a)switch(e[a]){case".":i=n=a;break;case"0":0===i&&(i=a),n=a;break;case"e":break e;default:i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(n+1):e}function o(e){return new s(e)}function s(e){if(!(t=U.exec(e)))throw new Error("invalid format: "+e);var t,n=t[1]||" ",r=t[2]||">",a=t[3]||"-",i=t[4]||"",o=!!t[5],s=t[6]&&+t[6],u=!!t[7],c=t[8]&&+t[8].slice(1),f=t[9]||"";"n"===f?(u=!0,f="g"):R[f]||(f=""),(o||"0"===n&&"="===r)&&(o=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=a,this.symbol=i,this.zero=o,this.width=s,this.comma=u,this.precision=c,this.type=f}function u(e,t){return function(n,r){for(var a=n.length,i=[],o=0,s=e[0],u=0;a>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),i.push(n.substring(a-=s,a+s)),!((u+=s+1)>r));)s=e[o=(o+1)%e.length];return i.reverse().join(t)}}function c(e){return e}function f(e){function t(e){e=o(e);var t=e.fill,n=e.align,r=e.sign,u=e.symbol,c=e.zero,f=e.width,l=e.comma,d=e.precision,h=e.type,p="$"===u?i[0]:"#"===u&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",g="$"===u?i[1]:/[%p]/.test(h)?"%":"",b=R[h],y=!h||/[defgprs%]/.test(h);return d=null==d?h?6:12:/[gprs]/.test(h)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),function(e){var i=p,o=g;if("c"===h)o=b(e)+o,e="";else{e=+e;var u=(0>e||0>1/e)&&(e*=-1,!0);if(e=b(e,d),i=(u?"("===r?r:"-":"-"===r||"("===r?"":r)+i, -o=o+("s"===h?j[8+m/3]:"")+(u&&"("===r?")":""),y)for(var v,x=-1,w=e.length;++xv||v>57){o=(46===v?s+e.slice(x+1):e.slice(x))+o,e=e.slice(0,x);break}}l&&!c&&(e=a(e,1/0));var _=i.length+e.length+o.length,M=f>_?new Array(f-_+1).join(t):"";switch(l&&c&&(e=a(M+e,M.length?f-o.length:1/0),M=""),n){case"<":return i+e+o+M;case"=":return i+M+e+o;case"^":return M.slice(0,_=M.length>>1)+i+e+o+M.slice(_)}return M+i+e+o}}function r(e,r){var a=t((e=o(e),e.type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(n(r)/3))),s=Math.pow(10,-i),u=j[8+i/3];return function(e){return a(s*e)+u}}var a=e.grouping&&e.thousands?u(e.grouping,e.thousands):c,i=e.currency,s=e.decimal;return{format:t,formatPrefix:r}}function l(e,t){return Math.max(0,n(Math.abs(t))-n(Math.abs(e)))+1}function d(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(t)/3)))-n(Math.abs(e)))}function h(e){return Math.max(0,-n(Math.abs(e)))}function p(e){return"string"!=typeof e||(e=Y.get(e))?f(e):null}var m,g={decimal:".",thousands:",",grouping:[3],currency:["¥",""]},b={decimal:",",thousands:" ",grouping:[3],currency:[""," руб."]},y={decimal:",",thousands:".",grouping:[3],currency:["R$",""]},v={decimal:",",thousands:".",grouping:[3],currency:["","zł"]},x={decimal:",",thousands:".",grouping:[3],currency:["€ ",""]},w={decimal:",",thousands:".",grouping:[3],currency:[""," ден."]},_={decimal:".",thousands:",",grouping:[3],currency:["","円"]},M={decimal:",",thousands:".",grouping:[3],currency:["€",""]},S={decimal:".",thousands:",",grouping:[3],currency:["₪",""]},T={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},k={decimal:",",thousands:" ",grouping:[3],currency:["","$"]},L={decimal:",",thousands:" ",grouping:[3],currency:[""," €"]},C={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},D={decimal:".",thousands:",",grouping:[3],currency:["$",""]},O={decimal:".",thousands:",",grouping:[3],currency:["£",""]},A={decimal:".",thousands:",",grouping:[3],currency:["$",""]},E={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},N={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},R={"":i,"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return a(100*e,t)},r:a,s:r,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},U=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var j=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Y=(new Map).set("ca-ES",N).set("de-DE",E).set("en-CA",A).set("en-GB",O).set("en-US",D).set("es-ES",C).set("fi-FI",L).set("fr-CA",k).set("fr-FR",T).set("he-IL",S).set("it-IT",M).set("ja-JP",_).set("mk-MK",w).set("nl-NL",x).set("pl-PL",v).set("pt-BR",y).set("ru-RU",b).set("zh-CN",g),F=f(D);e.format=F.format,e.formatPrefix=F.formatPrefix,e.localeFormat=p,e.formatSpecifier=o,e.precisionFixed=h,e.precisionPrefix=d,e.precisionRound=l})},{}],6:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.timeFormat={})}(this,function(e){"use strict";function t(e,n,r){function a(t){return e(t=new Date(+t)),t}return a.floor=a,a.round=function(t){var r=new Date(+t),a=new Date(t-1);return e(r),e(a),n(a,1),a-t>t-r?r:a},a.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},a.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},a.range=function(t,r,a){var i=[];if(t=new Date(t-1),r=new Date(+r),a=null==a?1:Math.floor(a),!(r>t&&a>0))return i;for(n(t,1),e(t),r>t&&i.push(new Date(+t));n(t,a),e(t),r>t;)i.push(new Date(+t));return i},a.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(a.count=function(t,n){return xe.setTime(+t),we.setTime(+n),e(xe),e(we),Math.floor(r(xe,we))}),a}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}function a(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function i(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function o(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function s(e){function t(e,t){return function(n){for(var r,a,i,o=[],s=-1,u=0,c=e.length;++so;){if(r>=u)return-1;if(a=t.charCodeAt(o++),37===a){if(a=t.charAt(o++),i=je[a in Oe?t.charAt(o++):a],!i||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function s(e,t,n){var r=Le.exec(t.slice(n));return r?(e.w=Ce.get(r[0].toLowerCase()),n+r[0].length):-1}function u(e,t,n){var r=Te.exec(t.slice(n));return r?(e.w=ke.get(r[0].toLowerCase()),n+r[0].length):-1}function c(e,t,n){var r=Ee.exec(t.slice(n));return r?(e.m=Ne.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,t,n){var r=De.exec(t.slice(n));return r?(e.m=Ae.get(r[0].toLowerCase()),n+r[0].length):-1}function ne(e,t,n){return r(e,ge,t,n)}function re(e,t,n){return r(e,be,t,n)}function ae(e,t,n){return r(e,ye,t,n)}function ie(e,t,n){var r=Se.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}function oe(e){return we[e.getDay()]}function se(e){return xe[e.getDay()]}function ue(e){return Me[e.getMonth()]}function ce(e){return _e[e.getMonth()]}function fe(e){return ve[+(e.getHours()>=12)]}function le(e){return we[e.getUTCDay()]}function de(e){return xe[e.getUTCDay()]}function he(e){return Me[e.getUTCMonth()]}function pe(e){return _e[e.getUTCMonth()]}function me(e){return ve[+(e.getUTCHours()>=12)]}var ge=e.dateTime,be=e.date,ye=e.time,ve=e.periods,xe=e.days,we=e.shortDays,_e=e.months,Me=e.shortMonths,Se=l(ve),Te=f(xe),ke=l(xe),Le=f(we),Ce=l(we),De=f(_e),Ae=l(_e),Ee=f(Me),Ne=l(Me),Re={a:oe,A:se,b:ue,B:ce,c:null,d:k,e:k,H:L,I:C,j:D,L:O,m:A,M:E,p:fe,S:N,U:R,w:U,W:j,x:null,X:null,y:Y,Y:F,Z:P,"%":ee},Ue={a:le,A:de,b:he,B:pe,c:null,d:z,e:z,H:I,I:H,j:X,L:q,m:W,M:B,p:me,S:$,U:G,w:J,W:V,x:null,X:null,y:Z,Y:Q,Z:K,"%":ee},je={a:s,A:u,b:c,B:te,c:ne,d:v,e:v,H:w,I:w,j:x,L:S,m:y,M:_,p:ie,S:M,U:h,w:d,W:p,x:re,X:ae,y:g,Y:m,Z:b,"%":T};return Re.x=t(be,Re),Re.X=t(ye,Re),Re.c=t(ge,Re),Ue.x=t(be,Ue),Ue.X=t(ye,Ue),Ue.c=t(ge,Ue),{format:function(e){var r=t(e+="",Re);return r.parse=n(e,a),r.toString=function(){return e},r},utcFormat:function(e){var r=t(e+="",Ue);return r.parse=n(e,i),r.toString=function(){return e},r}}}function u(e,t,n){var r=0>e?"-":"",a=(r?-e:e)+"",i=a.length;return r+(n>i?new Array(n-i+1).join(t)+a:a)}function c(e){return e.replace(Ne,"\\$&")}function f(e){return new RegExp("^(?:"+e.map(c).join("|")+")","i")}function l(e){for(var t=new Map,n=-1,r=e.length;++n68?1900:2e3),n+r[0].length):-1}function b(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function y(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function v(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function x(e,t,n){var r=Ae.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function w(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function _(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function M(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function S(e,t,n){var r=Ae.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function T(e,t,n){var r=Ee.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function k(e,t){return u(e.getDate(),t,2)}function L(e,t){return u(e.getHours(),t,2)}function C(e,t){return u(e.getHours()%12||12,t,2)}function D(e,t){return u(1+_e.count(Te(e),e),t,3)}function O(e,t){return u(e.getMilliseconds(),t,3)}function A(e,t){return u(e.getMonth()+1,t,2)}function E(e,t){return u(e.getMinutes(),t,2)}function N(e,t){return u(e.getSeconds(),t,2)}function R(e,t){return u(Me.count(Te(e),e),t,2)}function U(e){return e.getDay()}function j(e,t){return u(Se.count(Te(e),e),t,2)}function Y(e,t){return u(e.getFullYear()%100,t,2)}function F(e,t){return u(e.getFullYear()%1e4,t,4)}function P(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+u(t/60|0,"0",2)+u(t%60,"0",2)}function z(e,t){return u(e.getUTCDate(),t,2)}function I(e,t){return u(e.getUTCHours(),t,2)}function H(e,t){return u(e.getUTCHours()%12||12,t,2)}function X(e,t){return u(1+ke.count(De(e),e),t,3)}function q(e,t){return u(e.getUTCMilliseconds(),t,3)}function W(e,t){return u(e.getUTCMonth()+1,t,2)}function B(e,t){return u(e.getUTCMinutes(),t,2)}function $(e,t){return u(e.getUTCSeconds(),t,2)}function G(e,t){return u(Le.count(De(e),e),t,2)}function J(e){return e.getUTCDay()}function V(e,t){return u(Ce.count(De(e),e),t,2)}function Z(e,t){return u(e.getUTCFullYear()%100,t,2)}function Q(e,t){return u(e.getUTCFullYear()%1e4,t,4)}function K(){return"+0000"}function ee(){return"%"}function te(e){return e.toISOString()}function ne(e){return"string"!=typeof e||(e=Ye.get(e))?s(e):null}var re={dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},ae={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]},ie={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"]},oe={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."]},se={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"]},ue={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]},ce={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"]},fe={dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]},le={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."]},de={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"]},he={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"]},pe={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"]},me={dateTime:"%a %b %e %X %Y",date:"%m/%d/%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"]},ge={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"]},be={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"]},ye={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"]},ve={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."]},xe=new Date,we=new Date,_e=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),Me=n(0),Se=n(1),Te=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()}),ke=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5}),Le=r(0),Ce=r(1),De=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),Oe={"-":"",_:" ",0:"0"},Ae=/^\s*\d+/,Ee=/^%/,Ne=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Re="%Y-%m-%dT%H:%M:%S.%LZ";te.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},te.toString=function(){return Re};var Ue=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?te:me.utcFormat(Re),je=Ue,Ye=(new Map).set("ca-ES",ve).set("de-DE",ye).set("en-CA",be).set("en-GB",ge).set("en-US",me).set("es-ES",pe).set("fi-FI",he).set("fr-CA",de).set("fr-FR",le).set("he-IL",fe).set("it-IT",ce).set("mk-MK",ue).set("nl-NL",se).set("pl-PL",oe).set("pt-BR",ie).set("ru-RU",ae).set("zh-CN",re),Fe=s(me);e.format=Fe.format,e.utcFormat=Fe.utcFormat,e.localeFormat=ne,e.isoFormat=je})},{}],7:[function(t,n,r){!function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.dsv={})}(this,function(e){"use strict";var t=function(e){function t(e,t){var r;return n(e,function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");r=t?function(e,n){return t(a(e),n)}:a})}function n(e,t){function n(){if(f>=c)return o;if(a)return a=!1,i;var t=f;if(34===e.charCodeAt(t)){for(var n=t;n++f;){var r=e.charCodeAt(f++),s=1;if(10===r)a=!0;else if(13===r)a=!0,10===e.charCodeAt(f)&&(++f,++s);else if(r!==u)continue;return e.slice(t,f-s)}return e.slice(t)}for(var r,a,i={},o={},s=[],c=e.length,f=0,l=0;(r=n())!==o;){for(var d=[];r!==i&&r!==o;)d.push(r),r=n();t&&null==(d=t(d,l++))||s.push(d)}return s}function r(t){if(Array.isArray(t[0]))return a(t);var n=Object.create(null),r=[];return t.forEach(function(e){for(var t in e)(t+="")in n||r.push(n[t]=t)}),[r.map(o).join(e)].concat(t.map(function(t){return r.map(function(e){return o(t[e])}).join(e)})).join("\n")}function a(e){return e.map(i).join("\n")}function i(t){return t.map(o).join(e)}function o(e){return s.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return{parse:t,parseRows:n,format:r,formatRows:a}};e.csv=t(","),e.tsv=t(" "),e.dsv=t})},{}],8:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.timeFormat={})}(this,function(e){"use strict";function t(e,n,r){function a(t){return e(t=new Date(+t)),t}return a.floor=a,a.round=function(t){var r=new Date(+t),a=new Date(t-1);return e(r),e(a),n(a,1),a-t>t-r?r:a},a.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},a.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},a.range=function(t,r,a){var i=[];if(t=new Date(t-1),r=new Date(+r),a=null==a?1:Math.floor(a),!(r>t&&a>0))return i;for(n(t,1),e(t),r>t&&i.push(new Date(+t));n(t,a),e(t),r>t;)i.push(new Date(+t));return i},a.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(a.count=function(t,n){return we.setTime(+t),_e.setTime(+n),e(we),e(_e),Math.floor(r(we,_e))}),a}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}function a(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function i(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function o(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function s(e){function t(e,t){return function(n){for(var r,a,i,o=[],s=-1,u=0,c=e.length;++so;){if(r>=u)return-1;if(a=t.charCodeAt(o++),37===a){if(a=t.charAt(o++),i=je[a in Ae?t.charAt(o++):a],!i||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function s(e,t,n){var r=Le.exec(t.slice(n));return r?(e.w=Ce.get(r[0].toLowerCase()),n+r[0].length):-1}function u(e,t,n){var r=Te.exec(t.slice(n));return r?(e.w=ke.get(r[0].toLowerCase()),n+r[0].length):-1}function c(e,t,n){var r=Ee.exec(t.slice(n));return r?(e.m=Ne.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,t,n){var r=De.exec(t.slice(n));return r?(e.m=Oe.get(r[0].toLowerCase()),n+r[0].length):-1}function ne(e,t,n){return r(e,ge,t,n)}function re(e,t,n){return r(e,be,t,n)}function ae(e,t,n){return r(e,ye,t,n)}function ie(e,t,n){var r=Se.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}function oe(e){return we[e.getDay()]}function se(e){return xe[e.getDay()]}function ue(e){return Me[e.getMonth()]}function ce(e){return _e[e.getMonth()]}function fe(e){return ve[+(e.getHours()>=12)]}function le(e){return we[e.getUTCDay()]}function de(e){return xe[e.getUTCDay()]}function he(e){return Me[e.getUTCMonth()]}function pe(e){return _e[e.getUTCMonth()]}function me(e){return ve[+(e.getUTCHours()>=12)]}var ge=e.dateTime,be=e.date,ye=e.time,ve=e.periods,xe=e.days,we=e.shortDays,_e=e.months,Me=e.shortMonths,Se=l(ve),Te=f(xe),ke=l(xe),Le=f(we),Ce=l(we),De=f(_e),Oe=l(_e),Ee=f(Me),Ne=l(Me),Re={a:oe,A:se,b:ue,B:ce,c:null,d:k,e:k,H:L,I:C,j:D,L:O,m:A,M:E,p:fe,S:N,U:R,w:U,W:j,x:null,X:null,y:Y,Y:F,Z:P,"%":ee},Ue={a:le,A:de,b:he,B:pe,c:null,d:z,e:z,H:I,I:H,j:X,L:q,m:W,M:B,p:me,S:$,U:G,w:J,W:V,x:null,X:null,y:Z,Y:Q,Z:K,"%":ee},je={a:s,A:u,b:c,B:te,c:ne,d:v,e:v,H:w,I:w,j:x,L:S,m:y,M:_,p:ie,S:M,U:h,w:d,W:p,x:re,X:ae,y:g,Y:m,Z:b,"%":T};return Re.x=t(be,Re),Re.X=t(ye,Re),Re.c=t(ge,Re),Ue.x=t(be,Ue),Ue.X=t(ye,Ue),Ue.c=t(ge,Ue),{format:function(e){var r=t(e+="",Re);return r.parse=n(e,a),r.toString=function(){return e},r},utcFormat:function(e){var r=t(e+="",Ue);return r.parse=n(e,i),r.toString=function(){return e},r}}}function u(e,t,n){var r=0>e?"-":"",a=(r?-e:e)+"",i=a.length;return r+(n>i?new Array(n-i+1).join(t)+a:a)}function c(e){return e.replace(Re,"\\$&")}function f(e){return new RegExp("^(?:"+e.map(c).join("|")+")","i")}function l(e){for(var t=new Map,n=-1,r=e.length;++n68?1900:2e3),n+r[0].length):-1}function b(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function y(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function v(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function x(e,t,n){var r=Ee.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function w(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function _(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function M(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function S(e,t,n){var r=Ee.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function T(e,t,n){var r=Ne.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function k(e,t){return u(e.getDate(),t,2)}function L(e,t){return u(e.getHours(),t,2)}function C(e,t){return u(e.getHours()%12||12,t,2)}function D(e,t){return u(1+Me.count(ke(e),e),t,3)}function O(e,t){return u(e.getMilliseconds(),t,3)}function A(e,t){return u(e.getMonth()+1,t,2)}function E(e,t){return u(e.getMinutes(),t,2)}function N(e,t){return u(e.getSeconds(),t,2)}function R(e,t){return u(Se.count(ke(e),e),t,2)}function U(e){return e.getDay()}function j(e,t){return u(Te.count(ke(e),e),t,2)}function Y(e,t){return u(e.getFullYear()%100,t,2)}function F(e,t){return u(e.getFullYear()%1e4,t,4)}function P(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+u(t/60|0,"0",2)+u(t%60,"0",2)}function z(e,t){return u(e.getUTCDate(),t,2)}function I(e,t){return u(e.getUTCHours(),t,2)}function H(e,t){return u(e.getUTCHours()%12||12,t,2)}function X(e,t){return u(1+Le.count(Oe(e),e),t,3)}function q(e,t){return u(e.getUTCMilliseconds(),t,3)}function W(e,t){return u(e.getUTCMonth()+1,t,2)}function B(e,t){return u(e.getUTCMinutes(),t,2)}function $(e,t){return u(e.getUTCSeconds(),t,2)}function G(e,t){return u(Ce.count(Oe(e),e),t,2)}function J(e){return e.getUTCDay()}function V(e,t){return u(De.count(Oe(e),e),t,2)}function Z(e,t){return u(e.getUTCFullYear()%100,t,2)}function Q(e,t){return u(e.getUTCFullYear()%1e4,t,4)}function K(){return"+0000"}function ee(){return"%"}function te(e){return e.toISOString()}function ne(e){return"string"!=typeof e||(e=Fe.get(e))?s(e):null}var re={dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},ae={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]},ie={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"]},oe={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."]},se={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"]},ue={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"] -},ce={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月"]},fe={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"]},le={dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]},de={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."]},he={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"]},pe={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"]},me={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"]},ge={dateTime:"%a %b %e %X %Y",date:"%m/%d/%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"]},be={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"]},ye={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"]},ve={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"]},xe={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."]},we=new Date,_e=new Date,Me=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),Se=n(0),Te=n(1),ke=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()}),Le=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5}),Ce=r(0),De=r(1),Oe=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),Ae={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,Ne=/^%/,Re=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ue="%Y-%m-%dT%H:%M:%S.%LZ";te.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},te.toString=function(){return Ue};var je=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?te:ge.utcFormat(Ue),Ye=je,Fe=(new Map).set("ca-ES",xe).set("de-DE",ve).set("en-CA",ye).set("en-GB",be).set("en-US",ge).set("es-ES",me).set("fi-FI",pe).set("fr-CA",he).set("fr-FR",de).set("he-IL",le).set("it-IT",fe).set("ja-JP",ce).set("mk-MK",ue).set("nl-NL",se).set("pl-PL",oe).set("pt-BR",ie).set("ru-RU",ae).set("zh-CN",re),Pe=s(ge);e.format=Pe.format,e.utcFormat=Pe.utcFormat,e.localeFormat=ne,e.isoFormat=Ye})},{}],9:[function(t,n,r){!function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.time={})}(this,function(e){"use strict";function t(e,n,r){function o(t){return e(t=new Date(+t)),t}return o.floor=o,o.round=function(t){var r=new Date(+t),a=new Date(t-1);return e(r),e(a),n(a,1),a-t>t-r?r:a},o.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},o.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},o.range=function(t,r,a){var i=[];if(t=new Date(t-1),r=new Date(+r),a=null==a?1:Math.floor(a),!(r>t&&a>0))return i;for(n(t,1),e(t),r>t&&i.push(new Date(+t));n(t,a),e(t),r>t;)i.push(new Date(+t));return i},o.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(o.count=function(t,n){return i.setTime(+t),a.setTime(+n),e(i),e(a),Math.floor(r(i,a))}),o}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}var a=new Date,i=new Date,o=t(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3});e.seconds=o.range;var s=t(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4});e.minutes=s.range;var u=t(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5});e.hours=u.range;var c=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5});e.days=c.range,e.sunday=n(0),e.sundays=e.sunday.range,e.monday=n(1),e.mondays=e.monday.range,e.tuesday=n(2),e.tuesdays=e.tuesday.range,e.wednesday=n(3),e.wednesdays=e.wednesday.range,e.thursday=n(4),e.thursdays=e.thursday.range,e.friday=n(5),e.fridays=e.friday.range,e.saturday=n(6),e.saturdays=e.saturday.range;var f=e.sunday;e.weeks=f.range;var l=t(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())});e.months=l.range;var d=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()});e.years=d.range;var h=t(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3});e.utcSeconds=h.range;var p=t(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4});e.utcMinutes=p.range;var m=t(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5});e.utcHours=m.range;var g=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5});e.utcDays=g.range,e.utcSunday=r(0),e.utcSundays=e.utcSunday.range,e.utcMonday=r(1),e.utcMondays=e.utcMonday.range,e.utcTuesday=r(2),e.utcTuesdays=e.utcTuesday.range,e.utcWednesday=r(3),e.utcWednesdays=e.utcWednesday.range,e.utcThursday=r(4),e.utcThursdays=e.utcThursday.range,e.utcFriday=r(5),e.utcFridays=e.utcFriday.range,e.utcSaturday=r(6),e.utcSaturdays=e.utcSaturday.range;var b=e.utcSunday;e.utcWeeks=b.range;var y=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())});e.utcMonths=y.range;var v=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()});e.utcYears=v.range,e.interval=t,e.second=o,e.minute=s,e.hour=u,e.day=c,e.week=f,e.month=l,e.year=d,e.utcSecond=h,e.utcMinute=p,e.utcHour=m,e.utcDay=g,e.utcWeek=b,e.utcMonth=y,e.utcYear=v})},{}],10:[function(e,t,n){function r(){this._cells={},this._aggr=[],this._stream=!1}function a(e){if(i.isArray(e))return e;if(null==e)return[];var t,n,r=[];for(t in e)n=i.array(e[t]),r.push({name:t,ops:n});return r}var i=e("../util"),o=e("./measures"),s=e("./collector"),u=r.Flags={ADD_CELL:1,MOD_CELL:2},c=r.prototype;c.stream=function(e){return null==e?this._stream:(this._stream=!!e,this._aggr=[],this)},c.key=function(e){return null==e?this._key:(this._key=i.$(e),this)},c.groupby=function(e){return this._dims=i.array(e).map(function(e,t){if(e=i.isString(e)?{name:e,get:i.$(e)}:i.isFunction(e)?{name:i.name(e)||e.name||"_"+t,get:e}:e.name&&i.isFunction(e.get)?e:null,null==e)throw"Invalid groupby argument: "+e;return e}),this.clear()},c.summarize=function(e){e=a(e),this._count=!0;var t,n,r,s,u,c,f,l=this._aggr=[];for(r=0;rt;++t)a+="|"+n[t].get(e);return a},c._cell=function(e){var t=this._dims.length?this._cellkey(e):"";return this._cells[t]||(this._cells[t]=this._newcell(e,t))},c._newcell=function(e,t){var n,r={num:0,tuple:this._newtuple(e,t),flag:u.ADD_CELL,aggs:{}},a=this._aggr;for(n=0;nt;++t)a[r[t].name]=r[t].get(e);return this._ingest(a)},c._ingest=i.identity,c._add=function(e){var t,n=this._cell(e),r=this._aggr;if(n.num+=1,!this._count)for(n.collect&&n.data.add(e),t=0;t0){for(e.collect&&e.data.values(),t=0;te;++e)r.hasOwnProperty(c(s[e]))||(f[t++]=s[e]);else{for(e=0,n=u.length;n>e;++e)u[e][o]=1;for(e=0,t=0,n=s.length;n>e;++e)s[e][o]||(f[t++]=s[e]);for(e=0,n=u.length;n>e;++e)delete u[e][o]}else for(r=i.count.map(u),e=0,t=0,n=s.length;n>e;++e)r[s[e]]>0?r[s[e]]-=1:f[t++]=s[e];return this._rem=[],this._add=f},s.extent=function(e){if(this._get!==e||!this._ext){var t=this.values(),n=i.extent.index(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},s.argmin=function(e){return this.extent(e)[0]},s.argmax=function(e){return this.extent(e)[1]},s.min=function(e){var t=this.extent(e)[0];return t?e(t):+(1/0)},s.max=function(e){var t=this.extent(e)[1];return t?e(t):-(1/0)},s.quartile=function(e){return this._get===e&&this._q||(this._q=i.quartile(this.values(),e),this._get=e),this._q},s.q1=function(e){return this.quartile(e)[0]},s.q2=function(e){return this.quartile(e)[1]},s.q3=function(e){return this.quartile(e)[2]},t.exports=r},{"../stats":29,"../util":32}],12:[function(e,t,n){var r=e("../util"),a=e("./aggregator");t.exports=function(){var e=[].reduce.call(arguments,function(e,t){return e.concat(r.array(t))},[]);return(new a).groupby(e).summarize({"*":"values"})}},{"../util":32,"./aggregator":10}],13:[function(e,t,n){function r(e){return function(t){var n=o.extend({init:"",add:"",rem:"",idx:0},e);return n.out=t||e.name,n}}function a(e,t){function n(e,r){function a(t){e[t]||n(e,e[t]=s[t]())}return r.req&&r.req.forEach(a),t&&r.str&&r.str.forEach(a),e}var r=e.reduce(n,e.reduce(function(e,t){return e[t.name]=t,e},{}));return o.vals(r).sort(function(e,t){return e.idx-t.idx})}function i(t,n,r,i){var s=a(t,n),u="this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;",c="if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;",f="if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;",l="var t = this.tuple; var cell = this.cell;";return s.forEach(function(e){e.idx<0?(u=e.init+u,c=e.add+c,f=e.rem+f):(u+=e.init,c+=e.add,f+=e.rem)}),t.slice().sort(function(e,t){return e.idx-t.idx}).forEach(function(e){l+="this.assign(t,'"+e.out+"',"+e.set+");"}),l+="return t;",u=Function("cell","t",u),u.prototype.assign=i,u.prototype.add=Function("t","var v = this.get(t);"+c),u.prototype.rem=Function("t","var v = this.get(t);"+f),u.prototype.set=Function(l),u.prototype.get=r,u.prototype.distinct=e("../stats").count.distinct,u.prototype.isValid=o.isValid,u.fields=t.map(o.$("out")),u}var o=e("../util"),s={values:r({name:"values",init:"cell.collect = true;",set:"cell.data.values()",idx:-1}),count:r({name:"count",set:"cell.num"}),missing:r({name:"missing",set:"this.missing"}),valid:r({name:"valid",set:"this.valid"}),sum:r({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:r({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:r({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:r({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:r({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:r({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:r({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),median:r({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:r({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:r({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),distinct:r({name:"distinct",set:"this.distinct(cell.data.values(), this.get)",req:["values"],idx:3}),argmin:r({name:"argmin",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin = this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:r({name:"argmax",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax = this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:r({name:"min",init:"this.min = +Infinity;",add:"if (v < this.min) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:r({name:"max",init:"this.max = -Infinity;",add:"if (v > this.max) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4}),modeskew:r({name:"modeskew",set:"this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))",req:["mean","stdev","median"],idx:5})};s.create=i,t.exports=s},{"../stats":29,"../util":32}],14:[function(e,t,n){function r(e){if(!e)throw Error("Missing binning options.");var t,n,r,s,u,c,f,l=e.maxbins||15,d=e.base||10,h=Math.log(d),p=e.div||[5,2],m=e.min,g=e.max,b=g-m;if(e.step)t=e.step;else if(e.steps)t=e.steps[Math.min(e.steps.length-1,a(e.steps,b/l,0,e.steps.length))];else{n=Math.ceil(Math.log(l)/h),r=e.minstep||0,t=Math.max(r,Math.pow(d,Math.round(Math.log(b)/h)-n));do t*=d;while(Math.ceil(b/t)>l);for(c=0;c=r&&l>=b/u&&(t=u)}return u=Math.log(t),s=u>=0?0:~~(-u/h)+1,f=Math.pow(d,-s-1),m=Math.min(m,Math.floor(m/t+f)*t),g=Math.ceil(g/t)*t,{start:m,stop:g,step:t,unit:{precision:s},value:i,index:o}}function a(e,t,n,r){for(;r>n;){var a=n+r>>>1;c.cmp(e[a],t)<0?n=a+1:r=a}return n}function i(e){return this.step*Math.floor(e/this.step+l)}function o(e){return Math.floor((e-this.start)/this.step+l)}function s(e){return this.unit.date(i.call(this,e))}function u(e){return o.call(this,this.unit.unit(e))}var c=e("../util"),f=e("../time"),l=1e-15;r.date=function(e){if(!e)throw Error("Missing date binning options.");var t=e.utc?f.utc:f,n=e.min,a=e.max,i=e.maxbins||20,o=e.minbins||4,c=+a-+n,l=e.unit?t[e.unit]:t.find(c,o,i),d=r({min:null!=l.min?l.min:l.unit(n),max:null!=l.max?l.max:l.unit(a),maxbins:i,minstep:l.minstep,steps:l.step});return d.unit=l,d.index=u,e.raw||(d.value=s),d},t.exports=r},{"../time":31,"../util":32}],15:[function(e,t,n){function r(e,t,n){n=o(e,t,n);var r=i(n);return r?d.$func("bin",r.unit.unit?function(e){return r.value(r.unit.unit(e))}:function(e){return r.value(e)})(n.accessor):n.accessor||d.identity}function a(e,t,n){n=o(e,t,n);var r=i(n);return r?s(e,n.accessor,r):u(e,n.accessor,n&&n.sort)}function i(e){var t=e.type,n=null;return(null==t||p[t])&&("integer"===t&&null==e.minstep&&(e.minstep=1),n="date"===t?c.date(e):c(e)),n}function o(){var e=arguments,t=0,n=d.isArray(e[t])?e[t++]:null,r=d.isFunction(e[t])||d.isString(e[t])?d.$(e[t++]):null,a=d.extend({},e[t]);if(n&&(a.type=a.type||l(n,r),p[a.type])){var i=h.extent(n,r);a=d.extend({min:i[0],max:i[1]},a)}return r&&(a.accessor=r),a}function s(e,t,n){for(var r,a,i=f.range(n.start,n.stop+n.step/2,n.step).map(function(e){return{value:n.value(e),count:0}}),o=0;oa||a>=i.length||!isFinite(a))continue;i[a].count+=1}return i.bins=n,i}function u(e,t,n){var r=h.unique(e,t),a=h.count.map(e,t);return r.map(function(e){return{value:e,count:a[e]}}).sort(d.comparator(n?"-count":"+value"))}var c=e("./bins"),f=e("../generate"),l=e("../import/type"),d=e("../util"),h=e("../stats"),p={integer:1,number:1,date:1};t.exports={$bin:r,histogram:a}},{"../generate":17,"../import/type":26,"../stats":29,"../util":32,"./bins":14}],16:[function(e,t,n){function r(e){var t=l.localeFormat(e);if(null==t)throw Error("Unrecognized locale: "+e);d=t}function a(e){var t=f.localeFormat(e);if(null==t)throw Error("Unrecognized locale: "+e);h=t}function i(e,t){e.length||(e=[0]),null==t&&(t=10);var n=e[0],r=e[e.length-1];n>r&&(o=r,r=n,n=o);var a=r-n||(t=1,n||r||1),i=Math.pow(10,Math.floor(Math.log(a/t)/Math.LN10)),o=a/t/i;return o>=p?i*=10:o>=m?i*=5:o>=g&&(i*=2),[Math.ceil(n/i)*i,Math.floor(r/i)*i+i/2,i]}function o(e,t,n){var r=i(e,t);if(null==n)n=",."+l.precisionFixed(r[2])+"f";else switch(n=l.formatSpecifier(n),n.type){case"s":var a=Math.max(Math.abs(r[0]),Math.abs(r[1]));return null==n.precision&&(n.precision=l.precisionPrefix(r[2],a)),d.formatPrefix(n,a);case"":case"e":case"g":case"p":case"r":null==n.precision&&(n.precision=l.precisionRound(r[2],Math.max(Math.abs(r[0]),Math.abs(r[1])))-("e"===n.type));break;case"f":case"%":null==n.precision&&(n.precision=l.precisionFixed(r[2])-2*("%"===n.type))}return d.format(n)}function s(){var e=h.format,t=e(".%L"),n=e(":%S"),r=e("%I:%M"),a=e("%I %p"),i=e("%a %d"),o=e("%b %d"),s=e("%B"),u=e("%Y");return function(e){var f=+e;return(c.second(e)n;++n)r[n]=e;return r},r.zeros=function(e){return r.repeat(0,e)},r.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("Infinite range");var r,a=[],i=-1;if(0>n)for(;(r=e+n*++i)>t;)a.push(r);else for(;(r=e+n*++i)1);return a=Math.sqrt(-2*Math.log(r)/r),n=e+o*a*t,e+i*a*t};return a.samples=function(e){return r.zeros(e).map(a)},a}},{}],18:[function(e,t,n){function r(e,t){if(e){var n=t.header;e=(n?n.join(t.delimiter)+"\n":"")+e}return i.dsv(t.delimiter).parse(e)}var a=e("../../util"),i=e("d3-dsv");r.delimiter=function(e){var t={delimiter:e};return function(e,n){return r(e,n?a.extend(n,t):t)}},t.exports=r},{"../../util":32,"d3-dsv":7}],19:[function(e,t,n){var r=e("./dsv");t.exports={json:e("./json"),topojson:e("./topojson"),treejson:e("./treejson"),dsv:r,csv:r.delimiter(","),tsv:r.delimiter(" ")}},{"./dsv":18,"./json":20,"./topojson":21,"./treejson":22}],20:[function(e,t,n){var r=e("../../util");t.exports=function(e,t){var n=r.isObject(e)&&!r.isBuffer(e)?e:JSON.parse(e);return t&&t.property&&(n=r.accessor(t.property)(n)),n}},{"../../util":32}],21:[function(e,t,n){(function(n){var r=e("./json"),a=function(e,t){var n=a.topojson;if(null==n)throw Error("TopoJSON library not loaded.");var i,o=r(e,t);if(t&&t.feature){if(i=o.objects[t.feature])return n.feature(o,i).features;throw Error("Invalid TopoJSON object: "+t.feature)}if(t&&t.mesh){if(i=o.objects[t.mesh])return[n.mesh(o,o.objects[t.mesh])];throw Error("Invalid TopoJSON object: "+t.mesh)}throw Error("Missing TopoJSON feature or mesh parameter.")};a.topojson="undefined"!=typeof window?window.topojson:"undefined"!=typeof n?n.topojson:null,t.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./json":20}],22:[function(e,t,n){function r(e,t){function n(e){r.push(e);var a=e[t];if(a)for(var i=0;i1&&"."===r[t-1]&&r.lastIndexOf(e)===t});if(!u)throw"URL is not whitelisted: "+n}}return n}function a(e,t){var n,r=t||function(e){throw e};try{n=a.sanitizeUrl(e)}catch(i){return void r(i)}return n?a.useXHR?o(n,t):c(n,l)?s(n.slice(l.length),t):n.indexOf("://")<0?s(n,t):u(n,t):void r("Invalid URL: "+e.url)}function i(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function o(e,t){function n(){var e=a.status;!e&&i(a)||e>=200&&300>e||304===e?t(null,a.responseText):t(a,null)}var r=!!t,a=new XMLHttpRequest;return!this.XDomainRequest||"withCredentials"in a||!/^(http(s)?:)?\/\//.test(e)||(a=new XDomainRequest),r&&("onload"in a?a.onload=a.onerror=n:a.onreadystatechange=function(){a.readyState>3&&n()}),a.open("GET",e,r),a.send(),!r&&i(a)?a.responseText:void 0}function s(t,n){var r=e("fs");return n?void r.readFile(t,n):r.readFileSync(t,"utf8")}function u(t,n){if(!n)return e("sync-request")("GET",t).getBody();var r={url:t,encoding:null,gzip:!0};e("request")(r,function(e,t,r){e||200!==t.statusCode?(e=e||"Load failed with response code "+t.statusCode+".",n(e,null)):n(null,r)})}function c(e,t){return null==e?!1:0===e.lastIndexOf(t,0)}var f=/^([A-Za-z]+:)?\/\//,l="file://";a.sanitizeUrl=r,a.useXHR="undefined"!=typeof XMLHttpRequest,t.exports=a},{fs:1,request:1,"sync-request":1,url:1}],24:[function(e,t,n){function r(e,t){var n=t&&t.type||"json";return e=s[n](e,t),t&&t.parse&&a(e,t.parse),e}function a(e,t){var n,r,a,s,u,c,f=e.length;for(t="auto"===t?o.inferAll(e):i.duplicate(t),n=i.keys(t),r=n.map(function(e){return o.parsers[t[e]]}),s=0,c=n.length;f>s;++s)for(a=e[s],u=0;c>u;++u)a[n[u]]=r[u](a[n[u]]);o.annotation(e,t)}var i=e("../util"),o=e("./type"),s=e("./formats");r.formats=s,t.exports=r},{"../util":32,"./formats":19,"./type":26}],25:[function(e,t,n){var r=e("../util"),a=e("./load"),i=e("./read");t.exports=r.keys(i.formats).reduce(function(e,t){return e[t]=function(e,n,o){r.isString(e)&&(e={url:e}),2===arguments.length&&r.isFunction(n)&&(o=n,n=void 0),n=r.extend({parse:"auto"},n),n.type=t;var s=a(e,o?function(e,t){if(e)return void o(e,null);try{t=i(t,n),o(null,t)}catch(r){o(r,null)}}:void 0);return o?void 0:i(s,n)},e},{})},{"../util":32,"./load":23,"./read":24}],26:[function(e,t,n){function r(e,t){return t?void(e[c]=t):e&&e[c]||null}function a(e,t){t=u.$(t);var n,r,a;if(e[c]&&(n=t(e[c]),u.isString(n)))return n;for(r=0,a=e.length;!u.isValid(n)&&a>r;++r)n=t?t(e[r]):e[r];return u.isDate(n)?"date":u.isNumber(n)?"number":u.isBoolean(n)?"boolean":u.isString(n)?"string":null}function i(e,t){return e.length?(t=t||u.keys(e[0]),t.reduce(function(t,n){return t[n]=a(e,n),t},{})):void 0}function o(e,t){t=u.$(t);var n,r,a,i=["boolean","integer","number","date"];for(n=0;n0?Math.min(o,t.maxwidth):o}),h=n.map(function(e,t){return i.truncate(i.pad(e,d[t],"center"),d[t])}).join(t.separator),p=u(n.map(function(e,t){return"{{"+e+(c[r[e]]||"")+("|pad:"+d[t]+","+(f[r[e]]||"right"))+("|truncate:"+d[t])+"}}"}).join(t.separator));return h+"\n"+e.map(p).join("\n")},t.exports.summary=function(e){e=e?e.__summary__?e:s.summary(e):this;var t,n,i=[];for(t=0,n=e.length;n>t;++t)i.push("-- "+e[t].field+" --"),"string"===e[t].type||e[t].distinct<10?i.push(a(e[t])):i.push(r(e[t])),i.push("");return i.join("\n")}},{"./import/type":26,"./stats":29,"./template":30,"./util":32}],29:[function(e,t,n){var r=e("./util"),a=e("./import/type"),i=e("./generate"),o={};o.unique=function(e,t,n){t=r.$(t),n=n||[];var a,i,o,s={};for(i=0,o=e.length;o>i;++i)a=t?t(e[i]):e[i],a in s||(s[a]=1,n.push(a));return n},o.count=function(e){return e&&e.length||0},o.count.valid=function(e,t){t=r.$(t);var n,a,i,o=0;for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],r.isValid(n)&&(o+=1);return o},o.count.missing=function(e,t){t=r.$(t);var n,a,i,o=0;for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],null==n&&(o+=1);return o},o.count.distinct=function(e,t){t=r.$(t);var n,a,i,o={},s=0;for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],n in o||(o[n]=1,s+=1);return s},o.count.map=function(e,t){t=r.$(t);var n,a,i,o={};for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],o[n]=n in o?o[n]+1:1;return o},o.median=function(e,t){return t&&(e=e.map(r.$(t))),e=e.filter(r.isValid).sort(r.cmp),o.quantile(e,.5)},o.quartile=function(e,t){t&&(e=e.map(r.$(t))),e=e.filter(r.isValid).sort(r.cmp);var n=o.quantile;return[n(e,.25),n(e,.5),n(e,.75)]},o.quantile=function(e,t,n){void 0===n&&(n=t,t=r.identity),t=r.$(t);var a=(e.length-1)*n+1,i=Math.floor(a),o=+t(e[i-1]),s=a-i;return s?o+s*(t(e[i])-o):o},o.sum=function(e,t){t=r.$(t);for(var n,a=0,i=0,o=e.length;o>i;++i)n=t?t(e[i]):e[i],r.isValid(n)&&(a+=n);return a},o.mean=function(e,t){t=r.$(t);var n,a,i,o,s,u=0;for(a=0,o=0,i=e.length;i>a;++a)s=t?t(e[a]):e[a],r.isValid(s)&&(n=s-u,u+=n/++o);return u},o.variance=function(e,t){if(t=r.$(t),!r.isArray(e)||e.length<2)return 0;var n,a,i,o,s=0,u=0;for(a=0,i=0;ao;++o)if(i=t?t(e[o]):e[o],r.isValid(i)){n=a=i;break}for(;s>o;++o)i=t?t(e[o]):e[o],r.isValid(i)&&(n>i&&(n=i),i>a&&(a=i));return[n,a]},o.extent.index=function(e,t){t=r.$(t);var n,a,i,o,s=-1,u=-1,c=e.length;for(o=0;c>o;++o)if(i=t?t(e[o]):e[o],r.isValid(i)){n=a=i,s=u=o;break}for(;c>o;++o)i=t?t(e[o]):e[o],r.isValid(i)&&(n>i&&(n=i,s=o),i>a&&(a=i,u=o));return[s,u]},o.dot=function(e,t,n){var a,i,o=0;if(n)for(t=r.$(t),n=r.$(n),a=0;an;++n){if(a=o[n].val,0>c&&f===a)c=n-1;else if(c>-1&&f!==a){for(i=1+(n-1+c)/2;n>c;++c)u[o[c].idx]=i;c=-1}u[o[n].idx]=n+1,f=a}if(c>-1)for(i=1+(s-1+c)/2;s>c;++c)u[o[c].idx]=i;return u},o.cor=function(e,t,n){var a=n;n=a?e.map(r.$(n)):t,t=a?e.map(r.$(t)):e;var i=o.dot(t,n),s=o.mean(t),u=o.mean(n),c=o.stdev(t),f=o.stdev(n),l=e.length;return(i-l*s*u)/((l-1)*c*f)},o.cor.rank=function(e,t,n){var a,i,s,u=n?o.rank(e,r.$(t)):o.rank(e),c=n?o.rank(e,r.$(n)):o.rank(t),f=e.length;for(a=0,i=0;f>a;++a)s=u[a]-c[a],i+=s*s;return 1-6*i/(f*(f*f-1))},o.cor.dist=function(e,t,n){var a,i,s,u,c=n?e.map(r.$(t)):e,f=n?e.map(r.$(n)):t,l=o.dist.mat(c),d=o.dist.mat(f),h=l.length;for(a=0,i=0,s=0,u=0;h>a;++a)i+=l[a]*l[a],s+=d[a]*d[a],u+=l[a]*d[a];return Math.sqrt(u/Math.sqrt(i*s))},o.dist=function(e,t,n,a){var i,o,s=r.isFunction(n)||r.isString(n),u=e,c=s?e:t,f=s?a:n,l=2===f||null==f,d=e.length,h=0;for(s&&(t=r.$(t),n=r.$(n)),o=0;d>o;++o)i=s?t(u[o])-n(c[o]):u[o]-c[o],h+=l?i*i:Math.pow(Math.abs(i),f);return l?Math.sqrt(h):Math.pow(h,1/f)},o.dist.mat=function(e){var t,n,r,a=e.length,o=a*a,s=Array(o),u=i.zeros(a),c=0;for(n=0;a>n;++n)for(s[n*a+n]=0,r=n+1;a>r;++r)s[n*a+r]=t=Math.abs(e[n]-e[r]),s[r*a+n]=t,u[n]+=t,u[r]+=t;for(n=0;a>n;++n)c+=u[n],u[n]/=a;for(c/=o,n=0;a>n;++n)for(r=n;a>r;++r)s[n*a+r]+=c-u[n]-u[r],s[r*a+n]=s[n*a+r];return s},o.entropy=function(e,t){t=r.$(t);var n,a,i=0,o=0,s=e.length;for(n=0;s>n;++n)i+=t?t(e[n]):e[n];if(0===i)return 0;for(n=0;s>n;++n)a=(t?t(e[n]):e[n])/i,a&&(o+=a*Math.log(a));return-o/Math.LN2},o.mutual=function(e,t,n,a){var i,o,s,u=a?e.map(r.$(t)):e,c=a?e.map(r.$(n)):t,f=a?e.map(r.$(a)):n,l={},d={},h=f.length,p=0,m=0,g=0;for(s=0;h>s;++s)l[u[s]]=0,d[c[s]]=0;for(s=0;h>s;++s)l[u[s]]+=f[s],d[c[s]]+=f[s],p+=f[s];for(o=1/(p*Math.LN2),s=0;h>s;++s)0!==f[s]&&(i=p*f[s]/(l[u[s]]*d[c[s]]),m+=f[s]*o*Math.log(i),g+=f[s]*o*Math.log(f[s]/p));return[m,1+m/g]},o.mutual.info=function(e,t,n,r){return o.mutual(e,t,n,r)[0]},o.mutual.dist=function(e,t,n,r){return o.mutual(e,t,n,r)[1]},o.profile=function(e,t){var n,i,s,u,c,f=0,l=0,d=0,h=0,p=null,m=null,g=0,b=[],y={};for(s=0;sc)&&(p=c),(null===m||c>m)&&(m=c),n=c-f,f+=n/++l,g+=n*(c-f),b.push(c));return g/=l-1,i=Math.sqrt(g),b.sort(r.cmp),{type:a(e,t),unique:y,count:e.length,valid:l,missing:d,distinct:h,min:p,max:m,mean:f,stdev:i,median:u=o.quantile(b,.5),q1:o.quantile(b,.25),q3:o.quantile(b,.75),modeskew:0===i?0:(f-u)/i}},o.summary=function(e,t){t=t||r.keys(e[0]);var n=t.map(function(t){var n=o.profile(e,r.$(t));return n.field=t,n});return n.__summary__=!0,n},t.exports=o},{"./generate":17,"./import/type":26,"./util":32}],30:[function(e,t,n){function r(e){var t=a(e,"d");return t="var __t; return "+t+";",new Function("d",t).bind(f)}function a(e,t,n){t=t||"obj";var r=0,a="'",s=l;return e.replace(s,function(s,u,c){return a+=e.slice(r,c).replace(m,o),r=c+s.length,u&&(a+="'\n+((__t=("+i(u,t,n)+"))==null?'':__t)+\n'"),s}),a+"'"}function i(e,t,n){function a(e){return e=e||"",m?(m=!1,g="String("+g+")"+e):g+=e,g}function i(){return"(typeof "+g+'==="number"?new Date('+g+"):"+g+")"}function o(e,t){v=s(_[0],t,e),m=!1,g="this.formats["+v+"]("+g+")"}function f(e,t){v=s(_[0],t,e),m=!1,g="this.formats["+v+"]("+i()+")"}var l=e.match(d),p=l.shift().trim(),m=!0;n&&(n[p]=1);for(var g=r.property(t,p),b=0;b0&&(w=w.slice(0,y),_=l[b].slice(y+1).match(h).map(function(e){return e.trim()})),w=w.trim()){case"length":a(".length");break;case"lower":a(".toLowerCase()");break;case"upper":a(".toUpperCase()");break;case"lower-locale":a(".toLocaleLowerCase()");break;case"upper-locale":a(".toLocaleUpperCase()");break;case"trim":a(".trim()");break;case"left":v=u.number(_[0]),a(".slice(0,"+v+")");break;case"right":v=u.number(_[0]),a(".slice(-"+v+")");break;case"mid":v=u.number(_[0]),x=v+u.number(_[1]),a(".slice(+"+v+","+x+")");break;case"slice":v=u.number(_[0]),a(".slice("+v+(_.length>1?","+u.number(_[1]):"")+")");break;case"truncate":v=u.number(_[0]),x=_[1],x="left"!==x&&"middle"!==x&&"center"!==x?"right":x,g="this.truncate("+a()+","+v+",'"+x+"')";break;case"pad":v=u.number(_[0]),x=_[1],x="left"!==x&&"middle"!==x&&"center"!==x?"right":x,g="this.pad("+a()+","+v+",'"+x+"')";break;case"number":o(c.number,"number");break;case"time":f(c.time,"time");break;case"time-utc":f(c.utc,"time-utc");break;default:throw Error("Unrecognized template filter: "+w)}}return g}function o(e){return"\\"+p[e]}function s(e,t,n){if(!("'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]))throw Error("Format pattern must be quoted: "+e);if(e=e.slice(1,-1),t=t+":"+e,!f.format_map[t]){var r=n(e),a=f.formats.length;f.formats.push(r),f.format_map[t]=a}return f.format_map[t]}var u=e("./util"),c=e("./format"),f={formats:[],format_map:{},truncate:u.truncate,pad:u.pad};r.source=a,r.context=f,t.exports=r,r.clearFormatCache=function(){f.formats=[],f.format_map={}},r.property=function(e,t){var n=u.field(t).map(u.str).join("][");return e+"["+n+"]"};var l=/\{\{(.+?)\}\}|$/g,d=/(?:"[^"]*"|\'[^\']*\'|[^\|"]+|[^\|\']+)+/g,h=/(?:"[^"]*"|\'[^\']*\'|[^,"]+|[^,\']+)+/g,p={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},m=/\\|'|\r|\n|\u2028|\u2029/g},{"./format":16,"./util":32}],31:[function(e,t,n){function r(e){return c.setTime(+e),c}function a(e,t,n,r,a,i){var o={type:e,date:t,unit:n};return r?o.step=r:o.minstep=1,null!=a&&(o.min=a),null!=i&&(o.max=i),o}function i(e,t,n,r,i,o){return a(e,function(e){return t.offset(n,e)},function(e){return t.count(n,e)},r,i,o)}function o(e,t,n,r){var a,i,o,s=p[0];for(a=1,i=p.length;i>a;++a)if(s=p[a],t>s[0]){if(o=t/s[0],o>r)return e[p[a-1][1]];if(o>=n)return e[s[1]]}return e[p[i-1][1]]}function s(e){var t,n,r={};for(t=0,n=e.length;n>t;++t)r[e[t].type]=e[t];return r.find=function(t,n,r){return o(e,t,n,r)},r}var u=e("d3-time"),c=new Date,f=new Date(0,0,1).setFullYear(0),l=new Date(Date.UTC(0,0,1)).setUTCFullYear(0),d=[i("second",u.second,f),i("minute",u.minute,f),i("hour",u.hour,f),i("day",u.day,f,[1,7]),i("month",u.month,f,[1,3,6]),i("year",u.year,f),a("seconds",function(e){return new Date(1970,0,1,0,0,e)},function(e){return r(e).getSeconds()},null,0,59),a("minutes",function(e){return new Date(1970,0,1,0,e)},function(e){return r(e).getMinutes()},null,0,59),a("hours",function(e){return new Date(1970,0,1,e)},function(e){return r(e).getHours()},null,0,23),a("weekdays",function(e){return new Date(1970,0,4+e)},function(e){return r(e).getDay()},[1],0,6),a("dates",function(e){return new Date(1970,0,e)},function(e){return r(e).getDate()},[1],1,31),a("months",function(e){return new Date(1970,e%12,1)},function(e){return r(e).getMonth()},[1],0,11)],h=[i("second",u.utcSecond,l),i("minute",u.utcMinute,l),i("hour",u.utcHour,l),i("day",u.utcDay,l,[1,7]),i("month",u.utcMonth,l,[1,3,6]),i("year",u.utcYear,l),a("seconds",function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return r(e).getUTCSeconds()},null,0,59),a("minutes",function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return r(e).getUTCMinutes()},null,0,59),a("hours",function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return r(e).getUTCHours()},null,0,23),a("weekdays",function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return r(e).getUTCDay()},[1],0,6),a("dates",function(e){return new Date(Date.UTC(1970,0,e))},function(e){return r(e).getUTCDate()},[1],1,31),a("months",function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return r(e).getUTCMonth()},[1],0,11)],p=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];t.exports=s(d),t.exports.utc=s(h)},{"d3-time":9}],32:[function(e,t,n){function r(e){return e.replace(d,"$1\\'")}function a(e,t){var n,r="";for(n=0;e>n;++n)r+=t;return r}function i(e,t,n){var r=0,a=e.split(p);return e=n?(a=a.reverse()).filter(function(e){return r+=e.length,t>=r}).reverse():a.filter(function(e){return r+=e.length,t>=r}),e.length?e.join("").trim():a[0].slice(0,t)}var o=e("buffer"),s=e("./time"),u=s.utc,c=t.exports={},f="__name__";c.namedfunc=function(e,t){return t[f]=e,t},c.name=function(e){return null==e?null:e[f]},c.identity=function(e){return e},c["true"]=c.namedfunc("true",function(){return!0}),c["false"]=c.namedfunc("false",function(){return!1}),c.duplicate=function(e){return JSON.parse(JSON.stringify(e))},c.equal=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},c.extend=function(e){for(var t,n,r=1,a=arguments.length;a>r;++r){t=arguments[r];for(n in t)e[n]=t[n]}return e},c.length=function(e){return null!=e&&null!=e.length?e.length:null},c.keys=function(e){var t,n=[];for(t in e)n.push(t);return n},c.vals=function(e){var t,n=[];for(t in e)n.push(e[t]);return n},c.toMap=function(e,t){return(t=c.$(t))?e.reduce(function(e,n){return e[t(n)]=1,e},{}):e.reduce(function(e,t){return e[t]=1,e},{})},c.keystr=function(e){var t=e.length;if(!t)return"";for(var n=String(e[0]),r=1;t>r;++r)n+="|"+String(e[r]);return n};var l=Object.prototype.toString;c.isObject=function(e){return e===Object(e)},c.isFunction=function(e){return"[object Function]"===l.call(e)},c.isString=function(e){return"string"==typeof value||"[object String]"===l.call(e)},c.isArray=Array.isArray||function(e){return"[object Array]"===l.call(e)},c.isNumber=function(e){return"number"==typeof e||"[object Number]"===l.call(e)},c.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==l.call(e)},c.isDate=function(e){return"[object Date]"===l.call(e)},c.isValid=function(e){return null!=e&&e===e},c.isBuffer=o.Buffer&&o.Buffer.isBuffer||c["false"],c.number=function(e){return null==e||""===e?null:+e},c["boolean"]=function(e){return null==e||""===e?null:"false"===e?!1:!!e},c.date=function(e){return null==e||""===e?null:Date.parse(e)},c.array=function(e){return null!=e?c.isArray(e)?e:[e]:[]},c.str=function(e){return c.isArray(e)?"["+e.map(c.str)+"]":c.isObject(e)?JSON.stringify(e):c.isString(e)?"'"+r(e)+"'":e};var d=/(^|[^\\])'/g,h=/\[(.*?)\]|[^.\[]+/g;c.field=function(e){return String(e).match(h).map(function(e){return"["!==e[0]?e:"'"!==e[1]&&'"'!==e[1]?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,"$1")})},c.accessor=function(e){var t;return null==e||c.isFunction(e)?e:c.namedfunc(e,(t=c.field(e)).length>1?function(e){return t.reduce(function(e,t){return e[t]},e)}:function(t){return t[e]})},c.$=c.accessor,c.mutator=function(e){var t;return c.isString(e)&&(t=c.field(e)).length>1?function(e,n){for(var r=0;ra;++a){if(o=e[a],s=o(n),u=o(r),u>s)return-1*t[a];if(s>u)return t[a]}return 0}},c.cmp=function(e,t){return t>e?-1:e>t?1:e>=t?0:null===e?-1:null===t?1:NaN},c.numcmp=function(e,t){return e-t},c.stablesort=function(e,t,n){var r=e.reduce(function(e,t,r){return e[n(t)]=r,e},{});return e.sort(function(e,a){var i=t(e),o=t(a);return o>i?-1:i>o?1:r[n(e)]-r[n(a)]}),e},c.pad=function(e,t,n,r){r=r||" ";var i=t-e.length;if(0>=i)return e;switch(n){case"left":return a(i,r)+e;case"middle":case"center":return a(Math.floor(i/2),r)+e+a(Math.ceil(i/2),r);default:return e+a(i,r)}},c.truncate=function(e,t,n,r,a){var o=e.length;if(t>=o)return e;a=void 0!==a?String(a):"…";var s=Math.max(0,t-a.length);switch(n){case"left":return a+(r?i(e,s,1):e.slice(o-s));case"middle":case"center":var u=Math.ceil(s/2),c=Math.floor(s/2);return(r?i(e,u):e.slice(0,u))+a+(r?i(e,c,1):e.slice(o-c));default:return(r?i(e,s):e.slice(0,s))+a}};var p=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/},{"./time":31,buffer:1}],33:[function(e,t,n){function r(e){e="[Vega Log] "+e,console.log(e)}function a(e){e="[Vega Err] "+e,console.error(e)}function i(e,t){if(i.enable){var n=Function.prototype.bind.call(console.log,console),r={prevTime:Date.now()-o,stamp:e.stamp};e.add&&(r.add=e.add.length,r.mod=e.mod.length,r.rem=e.rem.length,r.reflow=!!e.reflow),n.apply(console,(t.push(JSON.stringify(r)),t)),o=Date.now()}}var o=Date.now();t.exports={log:r,error:a,debug:(i.enable=!1,i)}},{}],34:[function(e,t,n){function r(e,t){var n={};return a(e,n),n.add=[],n.mod=[],n.rem=[],n.reflow=t,n}function a(e,t){t.stamp=e?e.stamp:0,t.sort=e?e.sort:null,t.facet=e?e.facet:null,t.trans=e?e.trans:null,t.dirty=e?e.dirty:[],t.request=e?e.request:null;for(var n,r=0,a=i.length;a>r;++r)t[n=i[r]]=e?e[n]:{}}var i=e("./Dependencies").ALL;t.exports={create:r,copy:a}},{"./Dependencies":37}],35:[function(e,t,n){function r(e){o.init.call(this,e),this._data=[],this.router(!0).collector(!0)}var a=e("vega-logging"),i=e("./Tuple"),o=e("./Node").prototype,s=r.prototype=Object.create(o);s.constructor=r,s.data=function(){return this._data},s.evaluate=function(e){return a.debug(e,["collecting"]),e.rem.length&&(this._data=i.idFilter(this._data,e.rem)),e.add.length&&(this._data=this._data.length?this._data.concat(e.add):e.add),e.sort&&this._data.sort(e.sort),e.reflow&&(e.mod=e.mod.concat(i.idFilter(this._data,e.add,e.mod,e.rem)),e.reflow=!1),e},t.exports=r},{"./Node":40,"./Tuple":42,"vega-logging":33}],36:[function(e,t,n){function r(e,t,n){this._graph=e,this._name=t,this._data=[],this._source=null,this._facet=n,this._input=u.create(),this._output=null,this._inputNode=null,this._outputNode=null,this._pipeline=null,this._collector=null,this._mutates=!1}function a(e){var t=new l(e._graph).router(!0).collector(!0);return t.data=function(){return e._data},t.evaluate=function(t){s.debug(t,["input",e._name]);var n,r=e._input,a=u.create(t);for(n in r.fields)a.fields[n]=1;return r.rem.length&&(e._data=f.idFilter(e._data,r.rem)),r.add.length&&(e._data=e._data.concat(r.add)),t.reflow&&(r.mod=r.mod.concat(f.idFilter(e._data,r.add,r.mod,r.rem))),e._input=u.create(),a.add=r.add,a.mod=r.mod,a.rem=r.rem,a.facet=e._facet,a},t}function i(e){var t=new l(e._graph).router(!0).reflows(!0).collector(!0);return t.data=function(){return e._collector?e._collector.data():e._data},t.evaluate=function(t){s.debug(t,["output",e._name]);var n=u.create(t,!0);return e._facet&&(e._facet.values=e.values(),t.facet=null),e._output=t,n.data[e._name]=1,n},t}function o(e){var t=new l(e._graph).router(!0);return t.evaluate=function(t){if(e.mutates()){var n=e._srcMap||(e._srcMap={}),r=u.create(t);return r.add=t.add.map(function(e){return n[e._id]=f.derive(e)}),r.mod=t.mod.map(function(e){return f.rederive(e,n[e._id])}),r.rem=t.rem.map(function(e){var t=n[e._id];return n[e._id]=null,t}),e._input=r}return e._input=t},t}var s=e("vega-logging"),u=e("./ChangeSet"),c=e("./Collector"),f=e("./Tuple"),l=e("./Node"),d=r.prototype;d.name=function(e){return arguments.length?(this._name=e,this):this._name},d.source=function(e){return arguments.length?this._source=this._graph.data(e):this._source},d.insert=function(e){return this._input.add=this._input.add.concat(e.map(f.ingest)),this},d.remove=function(e){var t=this._data.filter(e);return this._input.rem=this._input.rem.concat(t),this},d.update=function(e,t,n){var r=this._input.mod,a=f.idMap(r);return this._input.fields[t]=1,this._data.filter(e).forEach(function(e){var i=e[t],o=n(e);i!==o&&(f.set(e,t,o),1!==a[e._id]&&(r.push(e),a[e._id]=1))}),this},d.values=function(e){return arguments.length?(this._input.rem=this._data.slice(),e&&this.insert(e),this):this._collector.data()},d.mutates=function(e){return arguments.length?(this._mutates=this._mutates||e,this):this._mutates},d.last=function(){return this._output},d.fire=function(e){return e&&(this._input=e),this._graph.propagate(this._input,this._pipeline[0]),this},d.pipeline=function(e){if(!arguments.length)return this._pipeline;var t,n=this._graph;return e.unshift(this._inputNode=a(this)),t=n.preprocess(e),t.router&&e.push(t.collector=new c(n)),e.push(this._outputNode=i(this)),this._collector=t.collector,this._mutates=!!t.mutates,n.connect(this._pipeline=e),this},d.synchronize=function(){return this._graph.synchronize(this._pipeline),this},d.listener=function(){return o(this).addListener(this._inputNode)},d.addListener=function(e){return e instanceof r?this._collector.addListener(e.listener()):this._outputNode.addListener(e),this},d.removeListener=function(e){this._outputNode.removeListener(e)},d.listeners=function(e){return(e?this._collector:this._outputNode).listeners()},t.exports=r},{"./ChangeSet":34,"./Collector":35,"./Node":40,"./Tuple":42,"vega-logging":33}],37:[function(e,t,n){var r=t.exports={ALL:["data","fields","scales","signals"]};r.ALL.forEach(function(e){r[e.toUpperCase()]=e})},{}],38:[function(e,t,n){function r(){}var a=e("datalib"),i=e("./Heap"),o=e("./ChangeSet"),s=e("./DataSource"),u=e("./Collector"),c=e("./Tuple"),f=e("./Signal"),l=e("./Dependencies"),d=r.prototype;d.init=function(){this._stamp=0,this._rank=0,this._data={},this._signals={},this.doNotPropagate={}},d.rank=function(){return++this._rank},d.values=function(e,t,n){var r,i,o=e===l.SIGNALS?this._signals:this._data,s=void 0!==t?t:a.keys(o);if(Array.isArray(s)){for(r=n||{},i=0;i1)for(var n=1,r=e.length;r>n;++n)t=t[e[n]];return t},d.propagate=function(e,t,n){var r,a,s,u,c,f,l,d={},h=new i(function(e,t){return e._qrank-t._qrank});if(e.stamp)throw Error("Pulse already has a non-zero stamp.");for(e.stamp=n||++this._stamp,d[t._id]=e,h.push(t.qrank(!0));h.size()>0;)if(t=h.peek(),e=d[t._id],t.rank()!==t.qrank())h.replace(t.qrank(!0));else if(h.pop(),d[t._id]=null,r=t._listeners,e=this.evaluate(e,t),e!==this.doNotPropagate)for(!e.reflow&&t.reflows()&&(e=o.create(e,!0)),f=0,l=r.length;l>f;++f)if(a=r[f],void 0!==(s=d[a._id])){if(null===s)throw Error("Already propagated to node.");if(s===e)continue;if(u=e.add.length||e.mod.length||e.rem.length,c=s.add.length||s.mod.length||s.rem.length,u&&c)throw Error("Multiple changeset pulses to same node");d[a._id]=u?e:s,d[a._id].reflow=e.reflow||s.reflow}else h.push(a.qrank(!0)),d[a._id]=e},d.preprocess=function(e){for(var t,n,r,a,i=this,o=0,s=0;si;++i){for(n=e[i],n.collector()&&(t=n),r=n.dependency(l.DATA),s=0,u=r.length;u>s;++s)this.data(r[s]).addListener(t);for(a=n.dependency(l.SIGNALS),s=0,u=a.length;u>s;++s)this.signal(a[s]).addListener(t);i>0&&e[i-1].addListener(n)}return e},d.disconnect=function(e){var t,n,r,a,i,o,s,u;for(i=0,o=e.length;o>i;++i){for(n=e[i],n.collector()&&(t=n),r=n.dependency(l.DATA),s=0,u=r.length;u>s;++s)this.data(r[s]).removeListener(t);for(a=n.dependency(l.SIGNALS),s=0,u=a.length;u>s;++s)this.signal(a[s]).removeListener(t);n.disconnect()}return e},d.synchronize=function(e){var t,n,r,a,i,o,s,u,f={};for(r=0,a=e.length;a>r;++r)if(t=e[r],t.collector())for(i=0,n=t.data(),o=n.length;o>i;++i)u=(s=n[i])._id,f[u]||(c.prev_update(s),f[u]=1);return this},d.reevaluate=function(e,t){var n=e.reflow&&t.last()>=e.stamp,r=t.router()||e.add.length||e.rem.length;return r||!n||t.reevaluate(e)},d.evaluate=function(e,t){return this.reevaluate(e,t)?(e=t.evaluate(e),t.last(e.stamp),e):e},t.exports=r},{"./ChangeSet":34,"./Collector":35,"./DataSource":36,"./Dependencies":37,"./Heap":39,"./Signal":41,"./Tuple":42,datalib:27}],39:[function(e,t,n){function r(e){this.cmp=e,this.nodes=[]}function a(e,t,n,r){var a,i,o;for(a=e[n];n>t&&(o=n-1>>1,i=e[o],r(a,i)<0);)e[n]=i,n=o;return e[n]=a}function i(e,t,n){for(var r,i=t,o=e.length,s=e[t],u=2*t+1;o>u;)r=u+1,o>r&&n(e[u],e[r])>=0&&(u=r),e[t]=e[u],t=u,u=2*t+1;return e[t]=s,a(e,i,t,n)}var o=r.prototype;o.size=function(){return this.nodes.length},o.clear=function(){return this.nodes=[],this},o.peek=function(){return this.nodes[0]},o.push=function(e){var t=this.nodes;return t.push(e),a(t,0,t.length-1,this.cmp)},o.pop=function(){var e,t=this.nodes,n=t.pop();return t.length?(e=t[0],t[0]=n,i(t,0,this.cmp)):e=n,e},o.replace=function(e){var t=this.nodes,n=t[0];return t[0]=e,i(t,0,this.cmp),n},o.pushpop=function(e){var t=this.nodes,n=t[0];return t.length&&this.cmp(n,e)<0&&(t[0]=e,e=n,i(t,0,this.cmp)),e},t.exports=r},{}],40:[function(e,t,n){function r(e){e&&this.init(e)}var a=e("./Dependencies").ALL,i=0,o=r.Flags={Router:1,Collector:2,Produces:4,Mutates:8,Reflows:16,Batch:32},s=r.prototype;s.init=function(e){this._id=++i,this._graph=e,this._rank=e.rank(),this._qrank=null,this._stamp=0,this._listeners=[],this._listeners._ids={},this._deps={};for(var t=0,n=a.length;n>t;++t)this._deps[a[t]]=[];return this._flags=0,this},s.rank=function(){return this._rank},s.qrank=function(){return arguments.length?(this._qrank=this._rank,this):this._qrank},s.last=function(e){return arguments.length?(this._stamp=e,this):this._stamp},s._setf=function(e,t){return t?this._flags|=e:this._flags&=~e,this},s.router=function(e){return arguments.length?this._setf(o.Router,e):this._flags&o.Router},s.collector=function(e){return arguments.length?this._setf(o.Collector,e):this._flags&o.Collector},s.produces=function(e){return arguments.length?this._setf(o.Produces,e):this._flags&o.Produces},s.mutates=function(e){return arguments.length?this._setf(o.Mutates,e):this._flags&o.Mutates},s.reflows=function(e){return arguments.length?this._setf(o.Reflows,e):this._flags&o.Reflows},s.batch=function(e){return arguments.length?this._setf(o.Batch,e):this._flags&o.Batch},s.dependency=function(e,t){var n=this._deps[e],r=n._names||(n._names={});if(1===arguments.length)return n;if(null===t)n.splice(0,n.length),n._names={};else if(Array.isArray(t))for(var a,i=0,o=t.length;o>i;++i)a=t[i],r[a]||(n.push(a),r[a]=1);else{if(r[t])return this;n.push(t),r[t]=1}return this},s.listeners=function(){return this._listeners},s.addListener=function(e){if(!(e instanceof r))throw Error("Listener is not a Node");if(this._listeners._ids[e._id])return this;if(this._listeners.push(e),this._listeners._ids[e._id]=1,this._rank>e._rank)for(var t,n=[e],a=this._graph;n.length;)t=n.shift(),t._rank=a.rank(),n.unshift.apply(n,t.listeners());return this},s.removeListener=function(e){if(!this._listeners._ids[e._id])return!1;var t=this._listeners.indexOf(e),n=t>=0;return n&&(this._listeners.splice(t,1),this._listeners._ids[e._id]=null),n},s.disconnect=function(){this._listeners=[],this._listeners._ids={}},s.evaluate=function(e){return e},s.reevaluate=function(e){var t,n,r,i,o,s;for(r=0,i=a.length;i>r;++r)for(t=a[r],n=this._deps[t],o=0,s=n.length;s>o;++o)if(e[t][n[o]])return!0;return!1},r.reset=function(){i=0},t.exports=r},{"./Dependencies":37}],41:[function(e,t,n){function r(e,t,n){return o.init.call(this,e),this._name=t,this._value=n,this._verbose=!1,this._handlers=[],this}var a=e("./ChangeSet"),i=e("./Node"),o=i.prototype,s=r.prototype=Object.create(o);s.constructor=r,s.name=function(){return this._name},s.value=function(e){return arguments.length?(this._value=e,this):this._value},s.values=s.value,s.verbose=function(e){return arguments.length?(this._verbose=!!e,this):this._verbose},s.evaluate=function(e){return e.signals[this._name]?e:this._graph.doNotPropagate},s.fire=function(e){e||(e=a.create(null,!0)),e.signals[this._name]=1,this._graph.propagate(e,this)},s.on=function(e){var t=this,n=new i(this._graph);return n.evaluate=function(n){return e(t.name(),t.value()),n},this._handlers.push({handler:e,node:n}),this.addListener(n)},s.off=function(e){var t,n,r=this._handlers;for(t=r.length;--t>=0;)e&&r[t].handler!==e||(n=r.splice(t,1)[0],this.removeListener(n.node));return this},t.exports=r},{"./ChangeSet":34,"./Node":40}],42:[function(e,t,n){function r(e){return e=e===Object(e)?e:{data:e},e._id=++o,e._prev&&(e._prev=null),e}function a(e,t){t=t||{};for(var n=0,r=e.length;r>n;++n)t[e[n]._id]=1;return t}function i(e,t){t=t||{};for(var n in e)"_prev"!==n&&"_id"!==n&&(t[n]=e[n]);return t}var o=0;t.exports={ingest:r,idMap:a,derive:function(e){return r(i(e))},rederive:function(e,t){return i(e,t)},set:function(e,t,n){return e[t]===n?0:(e[t]=n,1)},prev:function(e){return e._prev||e},prev_init:function(e){e._prev||(e._prev={_id:e._id})},prev_update:function(e){var t,n,r=e._prev;if(r)for(t in e)"_prev"!==t&&"_id"!==t&&(r[t]=(n=e[t])instanceof Object&&n._prev?n._prev:n)},reset:function(){o=0},idFilter:function(e){for(var t={},n=arguments.length;--n>0;)a(arguments[n],t);return e.filter(function(e){return!t[e._id]})}}},{}],43:[function(e,t,n){t.exports={ChangeSet:e("./ChangeSet"),Collector:e("./Collector"),DataSource:e("./DataSource"),Dependencies:e("./Dependencies"),Graph:e("./Graph"),Node:e("./Node"),Signal:e("./Signal"),Tuple:e("./Tuple"),debug:e("vega-logging").debug}},{"./ChangeSet":34,"./Collector":35,"./DataSource":36,"./Dependencies":37,"./Graph":38,"./Node":40,"./Signal":41,"./Tuple":42,"vega-logging":33}],44:[function(e,t,n){function r(e){var t,n,r={};for(t=0,n=e.length;n>t;++t)r[e[t]]=1;return r}function a(e){var t,n=[];for(t in e)n.push(t);return n}t.exports=function(t){function n(e){var t={code:o(e),globals:a(p),fields:a(m)};return p={},m={},t}function i(e){return h+'["'+e+'"]'}function o(e){if("string"==typeof e)return e;var t=g[e.type];if(null==t)throw new Error("Unsupported type: "+e.type);return t(e)}t=t||{};var s=t.constants||e("./constants"),u=(t.functions||e("./functions"))(o),c=t.idWhiteList?r(t.idWhiteList):null,f=t.idBlackList?r(t.idBlackList):null,l=0,d=t.fieldVar||"datum",h=t.globalVar||"signals",p={},m={},g={Literal:function(e){return e.raw},Identifier:function(e){var t=e.name;if(l>0)return t;if(s.hasOwnProperty(t))return s[t];if(c)return c.hasOwnProperty(t)?t:(p[t]=1,i(t));if(f&&f.hasOwnProperty(t))throw new Error("Illegal identifier: "+t);return t},Program:function(e){return e.body.map(o).join("\n")},MemberExpression:function(e){var t=!e.computed,n=o(e.object);t&&(l+=1);var r=o(e.property);return n===d&&(m[r]=1),t&&(l-=1),n+(t?"."+r:"["+r+"]")},CallExpression:function(e){if("Identifier"!==e.callee.type)throw new Error("Illegal callee type: "+e.callee.type);var t=e.callee.name,n=e.arguments,r=u.hasOwnProperty(t)&&u[t];if(!r)throw new Error("Unrecognized function: "+t); -return r instanceof Function?r(n):r+"("+n.map(o).join(",")+")"},ArrayExpression:function(e){return"["+e.elements.map(o).join(",")+"]"},BinaryExpression:function(e){return"("+o(e.left)+e.operator+o(e.right)+")"},UnaryExpression:function(e){return"("+e.operator+o(e.argument)+")"},ConditionalExpression:function(e){return"("+o(e.test)+"?"+o(e.consequent)+":"+o(e.alternate)+")"},LogicalExpression:function(e){return"("+o(e.left)+e.operator+o(e.right)+")"},ObjectExpression:function(e){return"{"+e.properties.map(o).join(",")+"}"},Property:function(e){l+=1;var t=o(e.key);return l-=1,t+":"+o(e.value)},ExpressionStatement:function(e){return o(e.expression)}};return n.functions=u,n.constants=s,n}},{"./constants":45,"./functions":46}],45:[function(e,t,n){t.exports={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"}},{}],46:[function(e,t,n){t.exports=function(e){function t(t,n,r,a){var i=e(n[0]);return r&&(i=r+"("+i+")",0===r.lastIndexOf("new ",0)&&(i="("+i+")")),i+"."+t+(0>a?"":0===a?"()":"("+n.slice(1).map(e).join(",")+")")}function n(e,n,r){return function(a){return t(e,a,n,r)}}var r="new Date",a="String",i="RegExp";return{isNaN:"isNaN",isFinite:"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){if(t.length<3)throw new Error("Missing arguments to clamp function.");if(t.length>3)throw new Error("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",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",a,0),lower:n("toLowerCase",a,0),slice:n("slice",a),substring:n("substring",a),regexp:i,test:n("test",i),"if":function(t){if(t.length<3)throw new Error("Missing arguments to if function.");if(t.length>3)throw new Error("Too many arguments to if function.");var n=t.map(e);return n[0]+"?"+n[1]+":"+n[2]}}}},{}],47:[function(e,t,n){var r=e("./parser"),a=e("./codegen"),i=t.exports={parse:function(e,t){return r.parse("("+e+")",t)},code:function(e){return a(e)},compiler:function(e,t){e=e.slice();var n=a(t),r=e.length,o=function(t){var a=n(i.parse(t));return e[r]='"use strict"; return ('+a.code+");",a.fn=Function.apply(null,e),a};return o.codegen=n,o},functions:e("./functions"),constants:e("./constants")}},{"./codegen":44,"./constants":45,"./functions":46,"./parser":48}],48:[function(e,t,n){t.exports=function(){"use strict";function e(e,t){if(!e)throw new Error("ASSERT: "+t)}function t(e){return e>=48&&57>=e}function n(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function r(e){return"01234567".indexOf(e)>=0}function a(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 i(e){return 10===e||13===e||8232===e||8233===e}function o(e){return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||92===e||e>=128&&Se.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function s(e){return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&Se.NonAsciiIdentifierPart.test(String.fromCharCode(e))}function u(e){switch(e){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function c(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function f(e){if(ke&&c(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function l(){var e,t;for(t=0===Le;Oe>Le;)if(e=Te.charCodeAt(Le),a(e))++Le;else{if(!i(e))break;++Le,13===e&&10===Te.charCodeAt(Le)&&++Le,++Ce,De=Le,t=!0}}function d(e){var t,r,a,i=0;for(r="u"===e?4:2,t=0;r>t;++t){if(!(Oe>Le&&n(Te[Le])))return"";a=Te[Le++],i=16*i+"0123456789abcdef".indexOf(a.toLowerCase())}return String.fromCharCode(i)}function h(){var e,t,r,a;for(e=Te[Le],t=0,"}"===e&&P({},Me.UnexpectedToken,"ILLEGAL");Oe>Le&&(e=Te[Le++],n(e));)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&P({},Me.UnexpectedToken,"ILLEGAL"),65535>=t?String.fromCharCode(t):(r=(t-65536>>10)+55296,a=(t-65536&1023)+56320,String.fromCharCode(r,a))}function p(){var e,t;for(e=Te.charCodeAt(Le++),t=String.fromCharCode(e),92===e&&(117!==Te.charCodeAt(Le)&&P({},Me.UnexpectedToken,"ILLEGAL"),++Le,e=d("u"),e&&"\\"!==e&&o(e.charCodeAt(0))||P({},Me.UnexpectedToken,"ILLEGAL"),t=e);Oe>Le&&(e=Te.charCodeAt(Le),s(e));)++Le,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==Te.charCodeAt(Le)&&P({},Me.UnexpectedToken,"ILLEGAL"),++Le,e=d("u"),e&&"\\"!==e&&s(e.charCodeAt(0))||P({},Me.UnexpectedToken,"ILLEGAL"),t+=e);return t}function m(){var e,t;for(e=Le++;Oe>Le;){if(t=Te.charCodeAt(Le),92===t)return Le=e,p();if(!s(t))break;++Le}return Te.slice(e,Le)}function g(){var e,t,n;return e=Le,t=92===Te.charCodeAt(Le)?p():m(),n=1===t.length?ve.Identifier:f(t)?ve.Keyword:"null"===t?ve.NullLiteral:"true"===t||"false"===t?ve.BooleanLiteral:ve.Identifier,{type:n,value:t,lineNumber:Ce,lineStart:De,start:e,end:Le}}function b(){var e,t,n,r,a=Le,i=Te.charCodeAt(Le),o=Te[Le];switch(i){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Le,Ne.tokenize&&(40===i?Ne.openParenToken=Ne.tokens.length:123===i&&(Ne.openCurlyToken=Ne.tokens.length)),{type:ve.Punctuator,value:String.fromCharCode(i),lineNumber:Ce,lineStart:De,start:a,end:Le};default:if(e=Te.charCodeAt(Le+1),61===e)switch(i){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Le+=2,{type:ve.Punctuator,value:String.fromCharCode(i)+String.fromCharCode(e),lineNumber:Ce,lineStart:De,start:a,end:Le};case 33:case 61:return Le+=2,61===Te.charCodeAt(Le)&&++Le,{type:ve.Punctuator,value:Te.slice(a,Le),lineNumber:Ce,lineStart:De,start:a,end:Le}}}return r=Te.substr(Le,4),">>>="===r?(Le+=4,{type:ve.Punctuator,value:r,lineNumber:Ce,lineStart:De,start:a,end:Le}):(n=r.substr(0,3),">>>"===n||"<<="===n||">>="===n?(Le+=3,{type:ve.Punctuator,value:n,lineNumber:Ce,lineStart:De,start:a,end:Le}):(t=n.substr(0,2),o===t[1]&&"+-<>&|".indexOf(o)>=0||"=>"===t?(Le+=2,{type:ve.Punctuator,value:t,lineNumber:Ce,lineStart:De,start:a,end:Le}):"<>=!+-*%&|^/".indexOf(o)>=0?(++Le,{type:ve.Punctuator,value:o,lineNumber:Ce,lineStart:De,start:a,end:Le}):void P({},Me.UnexpectedToken,"ILLEGAL")))}function y(e){for(var t="";Oe>Le&&n(Te[Le]);)t+=Te[Le++];return 0===t.length&&P({},Me.UnexpectedToken,"ILLEGAL"),o(Te.charCodeAt(Le))&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.NumericLiteral,value:parseInt("0x"+t,16),lineNumber:Ce,lineStart:De,start:e,end:Le}}function v(e){for(var n="0"+Te[Le++];Oe>Le&&r(Te[Le]);)n+=Te[Le++];return(o(Te.charCodeAt(Le))||t(Te.charCodeAt(Le)))&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.NumericLiteral,value:parseInt(n,8),octal:!0,lineNumber:Ce,lineStart:De,start:e,end:Le}}function x(){var n,a,i;if(i=Te[Le],e(t(i.charCodeAt(0))||"."===i,"Numeric literal must start with a decimal digit or a decimal point"),a=Le,n="","."!==i){if(n=Te[Le++],i=Te[Le],"0"===n){if("x"===i||"X"===i)return++Le,y(a);if(r(i))return v(a);i&&t(i.charCodeAt(0))&&P({},Me.UnexpectedToken,"ILLEGAL")}for(;t(Te.charCodeAt(Le));)n+=Te[Le++];i=Te[Le]}if("."===i){for(n+=Te[Le++];t(Te.charCodeAt(Le));)n+=Te[Le++];i=Te[Le]}if("e"===i||"E"===i)if(n+=Te[Le++],i=Te[Le],("+"===i||"-"===i)&&(n+=Te[Le++]),t(Te.charCodeAt(Le)))for(;t(Te.charCodeAt(Le));)n+=Te[Le++];else P({},Me.UnexpectedToken,"ILLEGAL");return o(Te.charCodeAt(Le))&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.NumericLiteral,value:parseFloat(n),lineNumber:Ce,lineStart:De,start:a,end:Le}}function w(){var t,n,a,o,s,u,c,f,l="",p=!1;for(c=Ce,f=De,t=Te[Le],e("'"===t||'"'===t,"String literal must starts with a quote"),n=Le,++Le;Oe>Le;){if(a=Te[Le++],a===t){t="";break}if("\\"===a)if(a=Te[Le++],a&&i(a.charCodeAt(0)))++Ce,"\r"===a&&"\n"===Te[Le]&&++Le,De=Le;else switch(a){case"u":case"x":"{"===Te[Le]?(++Le,l+=h()):(u=Le,s=d(a),s?l+=s:(Le=u,l+=a));break;case"n":l+="\n";break;case"r":l+="\r";break;case"t":l+=" ";break;case"b":l+="\b";break;case"f":l+="\f";break;case"v":l+=" ";break;default:r(a)?(o="01234567".indexOf(a),0!==o&&(p=!0),Oe>Le&&r(Te[Le])&&(p=!0,o=8*o+"01234567".indexOf(Te[Le++]),"0123".indexOf(a)>=0&&Oe>Le&&r(Te[Le])&&(o=8*o+"01234567".indexOf(Te[Le++]))),l+=String.fromCharCode(o)):l+=a}else{if(i(a.charCodeAt(0)))break;l+=a}}return""!==t&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.StringLiteral,value:l,octal:p,startLineNumber:c,startLineStart:f,lineNumber:Ce,lineStart:De,start:n,end:Le}}function _(e,t){var n,r=e;t.indexOf("u")>=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t){return parseInt(t,16)<=1114111?"x":void P({},Me.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{n=new RegExp(r)}catch(a){P({},Me.InvalidRegExp)}try{return new RegExp(e,t)}catch(i){return null}}function M(){var t,n,r,a,o;for(t=Te[Le],e("/"===t,"Regular expression literal must start with a slash"),n=Te[Le++],r=!1,a=!1;Oe>Le;)if(t=Te[Le++],n+=t,"\\"===t)t=Te[Le++],i(t.charCodeAt(0))&&P({},Me.UnterminatedRegExp),n+=t;else if(i(t.charCodeAt(0)))P({},Me.UnterminatedRegExp);else if(r)"]"===t&&(r=!1);else{if("/"===t){a=!0;break}"["===t&&(r=!0)}return a||P({},Me.UnterminatedRegExp),o=n.substr(1,n.length-2),{value:o,literal:n}}function S(){var e,t,n,r;for(t="",n="";Oe>Le&&(e=Te[Le],s(e.charCodeAt(0)));)if(++Le,"\\"===e&&Oe>Le)if(e=Te[Le],"u"===e){if(++Le,r=Le,e=d("u"))for(n+=e,t+="\\u";Le>r;++r)t+=Te[r];else Le=r,n+="u",t+="\\u";z({},Me.UnexpectedToken,"ILLEGAL")}else t+="\\",z({},Me.UnexpectedToken,"ILLEGAL");else n+=e,t+=e;return{value:n,literal:t}}function T(){var e,t,n,r;return Ae=null,l(),e=Le,t=M(),n=S(),r=_(t.value,n.value),Ne.tokenize?{type:ve.RegularExpression,value:r,regex:{pattern:t.value,flags:n.value},lineNumber:Ce,lineStart:De,start:e,end:Le}:{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Le}}function k(){var e,t,n,r;return l(),e=Le,t={start:{line:Ce,column:Le-De}},n=T(),t.end={line:Ce,column:Le-De},Ne.tokenize||(Ne.tokens.length>0&&(r=Ne.tokens[Ne.tokens.length-1],r.range[0]===e&&"Punctuator"===r.type&&("/"===r.value||"/="===r.value)&&Ne.tokens.pop()),Ne.tokens.push({type:"RegularExpression",value:n.literal,regex:n.regex,range:[e,Le],loc:t})),n}function L(e){return e.type===ve.Identifier||e.type===ve.Keyword||e.type===ve.BooleanLiteral||e.type===ve.NullLiteral}function C(){var e,t;if(e=Ne.tokens[Ne.tokens.length-1],!e)return k();if("Punctuator"===e.type){if("]"===e.value)return b();if(")"===e.value)return t=Ne.tokens[Ne.openParenToken-1],!t||"Keyword"!==t.type||"if"!==t.value&&"while"!==t.value&&"for"!==t.value&&"with"!==t.value?b():k();if("}"===e.value){if(Ne.tokens[Ne.openCurlyToken-3]&&"Keyword"===Ne.tokens[Ne.openCurlyToken-3].type){if(t=Ne.tokens[Ne.openCurlyToken-4],!t)return b()}else{if(!Ne.tokens[Ne.openCurlyToken-4]||"Keyword"!==Ne.tokens[Ne.openCurlyToken-4].type)return b();if(t=Ne.tokens[Ne.openCurlyToken-5],!t)return k()}return b()}return k()}return"Keyword"===e.type&&"this"!==e.value?k():b()}function D(){var e;return l(),Le>=Oe?{type:ve.EOF,lineNumber:Ce,lineStart:De,start:Le,end:Le}:(e=Te.charCodeAt(Le),o(e)?g():40===e||41===e||59===e?b():39===e||34===e?w():46===e?t(Te.charCodeAt(Le+1))?x():b():t(e)?x():Ne.tokenize&&47===e?C():b())}function O(){var e,t,n,r;return l(),e={start:{line:Ce,column:Le-De}},t=D(),e.end={line:Ce,column:Le-De},t.type!==ve.EOF&&(n=Te.slice(t.start,t.end),r={type:xe[t.type],value:n,range:[t.start,t.end],loc:e},t.regex&&(r.regex={pattern:t.regex.pattern,flags:t.regex.flags}),Ne.tokens.push(r)),t}function A(){var e;return e=Ae,Le=e.end,Ce=e.lineNumber,De=e.lineStart,Ae="undefined"!=typeof Ne.tokens?O():D(),Le=e.end,Ce=e.lineNumber,De=e.lineStart,e}function E(){var e,t,n;e=Le,t=Ce,n=De,Ae="undefined"!=typeof Ne.tokens?O():D(),Le=e,Ce=t,De=n}function N(){this.line=Ce,this.column=Le-De}function R(){this.start=new N,this.end=null}function U(e){e.type===ve.StringLiteral?this.start={line:e.startLineNumber,column:e.start-e.startLineStart}:this.start={line:e.lineNumber,column:e.start-e.lineStart},this.end=null}function j(){Le=Ae.start,Ae.type===ve.StringLiteral?(Ce=Ae.startLineNumber,De=Ae.startLineStart):(Ce=Ae.lineNumber,De=Ae.lineStart),Ne.range&&(this.range=[Le,0]),Ne.loc&&(this.loc=new R)}function Y(e){Ne.range&&(this.range=[e.start,0]),Ne.loc&&(this.loc=new U(e))}function F(){var e,t,n,r;return e=Le,t=Ce,n=De,l(),r=Ce!==t,Le=e,Ce=t,De=n,r}function P(t,n){var r,a=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,function(t,n){return e(nLe&&(e.push(ce()),!q(")"));)X(",");return H(")"),e}function ee(){var e,t=new j;return e=A(),L(e)||I(e),t.finishIdentifier(e.value)}function te(){return H("."),ee()}function ne(){var e;return H("["),e=fe(),H("]"),e}function re(){var e,t,n,r,a=Ee.allowIn;for(r=Ae,Ee.allowIn=!0,e=Q();;)if(q("."))n=te(),e=new Y(r).finishMemberExpression(".",e,n);else if(q("("))t=K(),e=new Y(r).finishCallExpression(e,t);else{if(!q("["))break;n=ne(),e=new Y(r).finishMemberExpression("[",e,n)}return Ee.allowIn=a,e}function ae(){var e=re();if(Ae.type===ve.Punctuator&&(q("++")||q("--"))&&!F())throw new Error("Disabled.");return e}function ie(){var e,t,n;if(Ae.type!==ve.Punctuator&&Ae.type!==ve.Keyword)t=ae();else{if(q("++")||q("--"))throw new Error("Disabled.");if(q("+")||q("-")||q("~")||q("!"))n=Ae,e=A(),t=ie(),t=new Y(n).finishUnaryExpression(e.value,t);else{if(W("delete")||W("void")||W("typeof"))throw new Error("Disabled.");t=ae()}}return t}function oe(e,t){var n=0;if(e.type!==ve.Punctuator&&e.type!==ve.Keyword)return 0;switch(e.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":n=7;break;case"in":n=t?7:0;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function se(){var e,t,n,r,a,i,o,s,u,c;if(e=Ae,u=ie(),r=Ae,a=oe(r,Ee.allowIn),0===a)return u;for(r.prec=a,A(),t=[e,Ae],o=ie(),i=[u,r,o];(a=oe(Ae,Ee.allowIn))>0;){for(;i.length>2&&a<=i[i.length-2].prec;)o=i.pop(),s=i.pop().value,u=i.pop(),t.pop(),n=new Y(t[t.length-1]).finishBinaryExpression(s,u,o),i.push(n);r=A(),r.prec=a,i.push(r),t.push(Ae),n=ie(),i.push(n)}for(c=i.length-1,n=i[c],t.pop();c>1;)n=new Y(t.pop()).finishBinaryExpression(i[c-1].value,i[c-2],n),c-=2;return n}function ue(){var e,t,n,r,a;return a=Ae,e=se(),q("?")&&(A(),t=Ee.allowIn,Ee.allowIn=!0,n=ce(),Ee.allowIn=t,H(":"),r=ce(),e=new Y(a).finishConditionalExpression(e,n,r)),e}function ce(){var e,t,n,r;return e=Ee.parenthesisCount,r=Ae,t=Ae,n=ue()}function fe(){var e=ce();if(q(","))throw new Error("Disabled.");return e}function le(e){var t=fe();return B(),e.finishExpressionStatement(t)}function de(){var e,t,n=Ae.type;if(n===ve.EOF&&I(Ae),n===ve.Punctuator&&"{"===Ae.value)throw new Error("Disabled.");if(t=new j,n===ve.Punctuator)switch(Ae.value){case";":throw new Error("Disabled.");case"(":return le(t)}else if(n===ve.Keyword)throw new Error("Disabled.");return e=fe(),B(),t.finishExpressionStatement(e)}function he(){if(Ae.type===ve.Keyword)switch(Ae.value){case"const":case"let":throw new Error("Disabled.");case"function":throw new Error("Disabled.");default:return de()}return Ae.type!==ve.EOF?de():void 0}function pe(){for(var e,t,n,r,a=[];Oe>Le&&(t=Ae,t.type===ve.StringLiteral)&&(e=he(),a.push(e),e.expression.type===we.Literal);)n=Te.slice(t.start+1,t.end-1),"use strict"===n?(ke=!0,r&&z(r,Me.StrictOctalLiteral)):!r&&t.octal&&(r=t);for(;Oe>Le&&(e=he(),"undefined"!=typeof e);)a.push(e);return a}function me(){var e,t;return l(),E(),t=new j,ke=!0,e=pe(),t.finishProgram(e)}function ge(){var e,t,n,r=[];for(e=0;e0?1:0,De=0,Oe=Te.length,Ae=null,Ee={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},Ne={},t=t||{},t.tokens=!0,Ne.tokens=[],Ne.tokenize=!0,Ne.openParenToken=-1,Ne.openCurlyToken=-1,Ne.range="boolean"==typeof t.range&&t.range,Ne.loc="boolean"==typeof t.loc&&t.loc,"boolean"==typeof t.tolerant&&t.tolerant&&(Ne.errors=[]);try{if(E(),Ae.type===ve.EOF)return Ne.tokens;for(A();Ae.type!==ve.EOF;)try{A()}catch(a){if(Ne.errors){Ne.errors.push(a);break}throw a}ge(),r=Ne.tokens,"undefined"!=typeof Ne.errors&&(r.errors=Ne.errors)}catch(i){throw i}finally{Ne={}}return r}function ye(e,t){var n,r;r=String,"string"==typeof e||e instanceof String||(e=r(e)),Te=e,Le=0,Ce=Te.length>0?1:0,De=0,Oe=Te.length,Ae=null,Ee={allowIn:!0,labelSet:{},parenthesisCount:0,inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},Ne={},"undefined"!=typeof t&&(Ne.range="boolean"==typeof t.range&&t.range,Ne.loc="boolean"==typeof t.loc&&t.loc,Ne.loc&&null!==t.source&&void 0!==t.source&&(Ne.source=r(t.source)),"boolean"==typeof t.tokens&&t.tokens&&(Ne.tokens=[]),"boolean"==typeof t.tolerant&&t.tolerant&&(Ne.errors=[]));try{n=me(),"undefined"!=typeof Ne.tokens&&(ge(),n.tokens=Ne.tokens),"undefined"!=typeof Ne.errors&&(n.errors=Ne.errors)}catch(a){throw a}finally{Ne={}}return n}var ve,xe,we,_e,Me,Se,Te,ke,Le,Ce,De,Oe,Ae,Ee,Ne;ve={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9},xe={},xe[ve.BooleanLiteral]="Boolean",xe[ve.EOF]="",xe[ve.Identifier]="Identifier",xe[ve.Keyword]="Keyword",xe[ve.NullLiteral]="Null",xe[ve.NumericLiteral]="Numeric",xe[ve.Punctuator]="Punctuator",xe[ve.StringLiteral]="String",xe[ve.RegularExpression]="RegularExpression",we={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpression",ConditionalExpression:"ConditionalExpression",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",UnaryExpression:"UnaryExpression"},_e={Data:1,Get:2,Set:4},Me={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},Se={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},Y.prototype=j.prototype={finish:function(){Ne.range&&(this.range[1]=Le),Ne.loc&&(this.loc.end=new N,Ne.source&&(this.loc.source=Ne.source))},finishArrayExpression:function(e){return this.type=we.ArrayExpression,this.elements=e,this.finish(),this},finishAssignmentExpression:function(e,t,n){return this.type=we.AssignmentExpression,this.operator=e,this.left=t,this.right=n,this.finish(),this},finishBinaryExpression:function(e,t,n){return this.type="||"===e||"&&"===e?we.LogicalExpression:we.BinaryExpression,this.operator=e,this.left=t,this.right=n,this.finish(),this},finishCallExpression:function(e,t){return this.type=we.CallExpression,this.callee=e,this.arguments=t,this.finish(),this},finishConditionalExpression:function(e,t,n){return this.type=we.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n,this.finish(),this},finishExpressionStatement:function(e){return this.type=we.ExpressionStatement,this.expression=e,this.finish(),this},finishIdentifier:function(e){return this.type=we.Identifier,this.name=e,this.finish(),this},finishLiteral:function(e){return this.type=we.Literal,this.value=e.value,this.raw=Te.slice(e.start,e.end),e.regex&&("//"==this.raw&&(this.raw="/(?:)/"),this.regex=e.regex),this.finish(),this},finishMemberExpression:function(e,t,n){return this.type=we.MemberExpression,this.computed="["===e,this.object=t,this.property=n,this.finish(),this},finishObjectExpression:function(e){return this.type=we.ObjectExpression,this.properties=e,this.finish(),this},finishProgram:function(e){return this.type=we.Program,this.body=e,this.finish(),this},finishProperty:function(e,t,n){return this.type=we.Property,this.key=t,this.value=n,this.kind=e,this.finish(),this},finishUnaryExpression:function(e,t){return this.type=we.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0,this.finish(),this}};var Re={"if":1,"this":1};return{tokenize:be,parse:ye}}()},{}],49:[function(e,t,n){var r=e("vega-expression"),a=["datum","event","signals"];t.exports=r.compiler(a,{idWhiteList:a,fieldVar:a[0],globalVar:a[2],functions:function(e){var t=r.functions(e);return t.eventItem=function(){return"event.vg.item"},t.eventGroup="event.vg.getGroup",t.eventX="event.vg.getX",t.eventY="event.vg.getY",t.open="window.open",t}})},{"vega-expression":47}],50:[function(e,t,n){function r(e){return l.prototype.init.call(this,e),l.addParameters(this,{groupby:{type:"array"},summarize:{type:"custom",set:function(e){function t(e){e.signal&&(c[e.signal]=1)}var n,r,a,o,s,u,c={},l=this._transform;if(!i.isArray(o=e)){o=[];for(s in e)u=i.array(e[s]),o.push({field:s,ops:u})}for(n=0,r=o.length;r>n;++n)a=o[n],a.field.signal&&(c[a.field.signal]=1),i.array(a.ops).forEach(t),i.array(a.as).forEach(t);return l._fields=o,l._aggr=null,l.dependency(f.SIGNALS,i.keys(c)),l}}}),this._aggr=null,this._input=null,this._args=null,this._fields=[],this._out=[],this._type=p.TUPLE,this._acc={groupby:i["true"],value:i["true"]},this.router(!0).produces(!0)}function a(e){var t,n,r,a,i,o,s,u=[];for(i=e._dims,t=0,n=i.length;n>t;++t)u.push(i[t].name);for(o=e._aggr,t=0,n=o.length;n>t;++t)for(s=o[t].measures.fields,r=0,a=s.length;a>r;++r)u.push(s[r]);return u}var i=e("datalib"),o=e("vega-dataflow"),s=e("vega-logging"),u=o.ChangeSet,c=o.Tuple,f=o.Dependencies,l=e("./Transform"),d=e("./Facetor"),h=r.prototype=Object.create(l.prototype);h.constructor=r;var p=r.TYPES={VALUE:1,TUPLE:2,MULTI:3};r.VALID_OPS=["values","count","valid","missing","distinct","sum","mean","average","variance","variancep","stdev","stdevp","median","q1","q3","modeskew","min","max","argmin","argmax"],h.type=function(e){return this._type=e,this},h.accessors=function(e,t){var n=this._acc;n.groupby=i.$(e)||i["true"],n.value=i.$(t)||i["true"]},h.aggr=function(){if(this._aggr)return this._aggr;var e=this._graph,t=!1,n=[],r=this.param("groupby").field,o=function(t){return t.signal?e.signalRef(t.signal):t},s=this._fields.map(function(e){var r={name:o(e.field),as:i.array(e.as),ops:i.array(o(e.ops)).map(o),get:e.get};return t=t||null!=r.get,n.push(r.name),r});r.forEach(function(e){e.get&&(t=!0),n.push(e.name||e)}),this._args=t||!s.length?null:n,s.length||(s={"*":"values"});var u=this._aggr=(new d).groupby(r).stream(!0).summarize(s);return this._out=a(u),this._type!==p.VALUE&&u.key("_id"),u},h.transform=function(e,t){s.debug(e,["aggregate"]),this._input=e;var n,r,a,i,o=u.create(e),f=this.aggr(),l=this._out,d=this._args,h=!0,m=c.prev;if(t&&(o.rem.push.apply(o.rem,f.result()),f.clear(),this._aggr=null,f=this.aggr()),this._type===p.TUPLE)n=function(e){f._add(e),c.prev_init(e)},r=function(e){f._rem(m(e))},a=function(e){f._mod(e,m(e))};else{var g=this._acc.groupby,b=this._acc.value,y=this._type===p.VALUE?b:function(e){return{_id:e._id,groupby:g(e),value:b(e)}};n=function(e){f._add(y(e)),c.prev_init(e)},r=function(e){f._rem(y(m(e)))},a=function(e){f._mod(y(e),y(m(e)))}}if(e.add.forEach(n),t)e.mod.forEach(n);else{if(e.rem.forEach(r),d)for(i=0,h=!1;ithis.config("maxSmallNumber")?"largeNumberFormat":"smallNumberFormat";return this.config(t)},t.sort=function(t,n){var r=this._enc[t].sort,a=this._enc,o=i.isTypes;if((!r||0===r.length)&&e.toggleSort.support({encoding:this._enc},n,!0)&&this.config("toggleSort")===Q){var s=o(a.x,[N,O])?a.y:a.x;o(a[t],[N,O])&&(r=[{name:s.name,aggregate:s.aggregate,type:s.type,reverse:!0}])}return r},t.map=function(e){return o.map(this._enc,e)},t.reduce=function(e,t){return o.reduce(this._enc,e,t)},t.forEach=function(e){return o.forEach(this._enc,e)},t.type=function(e){return this.has(e)?this._enc[e].type:null},t.isType=function(e,t){var n=this.encDef(e);return n&&i.isType(n,t)},t.isTypes=function(e,t){var n=this.encDef(e);return n&&i.isTypes(n,t)},e.isOrdinalScale=function(e,t){return i.isOrdinalScale(e.encDef(t))},e.isDimension=function(e,t){return i.isDimension(e.encDef(t))},e.isMeasure=function(e,t){return i.isMeasure(e.encDef(t))},t.isOrdinalScale=function(t){return this.has(t)&&e.isOrdinalScale(this,t)},t.isDimension=function(t){return this.has(t)&&e.isDimension(this,t)},t.isMeasure=function(t){return this.has(t)&&e.isMeasure(this,t)},t.isAggregate=function(){return o.isAggregate(this._enc)},t.dataTable=function(){return this.isAggregate()?AGGREGATE:RAW},e.isAggregate=function(e){return o.isAggregate(e.encoding)},e.alwaysNoOcclusion=function(e){return o.isAggregate(e.encoding)},e.isStack=function(e){return("bar"===e.marktype||"area"===e.marktype)&&e.encoding.color},t.stack=function(){var e=this.has(COLOR)&&this.encDef(COLOR).stack?COLOR:this.has(DETAIL)&&this.encDef(DETAIL).stack?DETAIL:null,t=e&&this.encDef(e).stack!==!0?this.encDef(e).stack:{};if((this.is("bar")||this.is("area"))&&e&&this.isAggregate()){var n=this.isMeasure(X),r=this.isMeasure(Y);if(n&&!r)return{groupby:Y,value:X,stack:e,properties:t};if(r&&!n)return{groupby:X,value:Y,stack:e,properties:t}}return null},t.details=function(){var e=this;return this.reduce(function(t,n,r){return n.aggregate||r===X||r===Y||t.push(e.fieldRef(r)),t},[])},t.facets=function(){var e=this;return this.reduce(function(t,n,r){return n.aggregate||r!=ROW&&r!=COL||t.push(e.fieldRef(r)),t},[])},t.cardinality=function(e,t){return i.cardinality(this.encDef(e),t,this.config("filterNull"))},t.isRaw=function(){return!this.isAggregate()},t.data=function(){return this._data},t.hasValues=function(){var e=this.data().values;return e&&e.length},t.config=function(e){return this._config[e]},e.transpose=function(e){var t=e.encoding,n=a.duplicate(e.encoding);return n.x=t.y,n.y=t.x,n.row=t.col,n.col=t.row,e.encoding=n,e},e}()},{"./consts":67,"./enc":69,"./encdef":70,"./globals":71,"./schema/schema":73,"./util":75}],55:[function(e,t,n){"use strict";e("../globals");var r=e("../util"),a=r.setter,i=r.getter,o=e("./time"),s=t.exports={};s.def=function(e,t,n,r,a){var o=e==COL,u=e==ROW,c=o?"x":u?"y":e,f={type:c,scale:e,properties:{},layer:t.encDef(e).axis.layer},l=s.orient(t,e,r);return l&&(f.orient=l),f=s.labels.scale(f,t,e),f=s.labels.format(f,t,e,r),f=s.labels.angle(f,t,e),e==X&&(!t.isDimension(X)&&!t.isType(X,T)||"angle"in i(f,["properties","labels"])?f.ticks=t.encDef(e).axis.ticks:f=s.labels.rotate(f)),f.titleOffset=s.titleOffset(t,n,e),u&&(f.offset=s.titleOffset(t,n,Y)+20),f=s.grid(f,t,e,n),f=s.title(f,t,e,n,a),(u||o)&&(f=s.hideTicks(f)),f},s.orient=function(e,t,n){var r=e.encDef(t).axis.orient;return r?r:t===COL?"top":t===X&&e.has(Y)&&e.isOrdinalScale(Y)&&e.cardinality(Y,n)>30?"top":void 0},s.grid=function(e,t,n,r){var a=r.cellPadding,i=n==COL,o=n==ROW,s=t.axis(n).grid,u=void 0===s?n===ROW||n===COL||t.isTypes(n,[Q,T]):s;if(u)if(e.grid=!0,i){var c=t.config("cellGridOffset");e.properties.grid={x:{offset:r.cellWidth*(1+a/2),scale:"col",field:"data"},y:{value:-c},y2:{field:{group:"mark.group.height"},offset:c},stroke:{value:t.config("cellGridColor")},strokeOpacity:{value:t.config("cellGridOpacity")}}}else if(o){var f=t.config("cellGridOffset");e.properties.grid={y:{offset:-r.cellHeight*(a/2),scale:"row",field:"data"},x:{value:e.offset-f},x2:{field:{group:"mark.group.width"},offset:e.offset+f,mult:1},stroke:{value:t.config("cellGridColor")},strokeOpacity:{value:t.config("cellGridOpacity")}}}else e.properties.grid={stroke:{value:t.config("gridColor")},strokeOpacity:{value:t.config("gridOpacity")}};return e},s.hideTicks=function(e){return e.properties.ticks={opacity:{value:0}},e.properties.majorTicks={opacity:{value:0}},e.properties.axis={opacity:{value:0}},e},s.title=function(e,t,n,a){var i=t.encDef(n).axis;if(i.title)e.title=i.title;else{var o,s=t.fieldTitle(n);i.titleMaxLength?o=i.titleMaxLength:n===X?o=a.cellWidth/t.config("characterWidth"):n===Y&&(o=a.cellHeight/t.config("characterWidth")),e.title=o?r.truncate(s,o):s}return n===ROW&&(e.properties.title={angle:{value:0},align:{value:"right"},baseline:{value:"middle"},dy:{value:-a.height/2-20}}),e},s.labels={},s.labels.scale=function(e,t,n){var r=t.encDef(n).timeUnit;return t.isType(n,T)&&r&&o.hasScale(r)&&a(e,["properties","labels","text","scale"],"time-"+r),e},s.labels.format=function(e,t,n,r){var i=r[t.encDef(n).name];if(t.axis(n).format)e.format=t.axis(n).format;else if(t.isType(n,Q)||"number"===i.type)e.format=t.numberFormat(i);else if(t.isType(n,T)){var o=t.encDef(n).timeUnit;o?"year"===o&&(e.format="d"):e.format=t.config("timeFormat")}else t.isTypes(n,[N,O])&&t.axis(n).maxLabelLength&&a(e,["properties","labels","text","template"],"{{ datum.data | truncate:"+t.axis(n).maxLabelLength+"}}");return e},s.labels.angle=function(e,t,n){var r=t.axis(n).labelAngle;return"undefined"==typeof r?e:(a(e,["properties","labels","angle","value"],r),e)},s.labels.rotate=function(e){var t="top"===e.orient?"left":"right";return a(e,["properties","labels","angle","value"],270),a(e,["properties","labels","align","value"],t),a(e,["properties","labels","baseline","value"],"middle"),e},s.titleOffset=function(e,t,n){var r=e.axis(n).titleOffset;if(r)return r;switch(n){case ROW:return 0;case COL:return 35}return i(t,[n,"axisTitleOffset"])}},{"../globals":71,"../util":75,"./time":66}],56:[function(e,t,n){"use strict";var r=t.exports=e("datalib/src/stats").summary;e("../globals");var a=t.exports={},i=e("../Encoding"),o=a.axis=e("./axis"),s=a.legend=e("./legend"),u=a.marks=e("./marks"),c=a.scale=e("./scale");a.data=e("./data"),a.facet=e("./facet"),a.layout=e("./layout"),a.stack=e("./stack"),a.style=e("./style"),a.subfacet=e("./subfacet"),a.time=e("./time"),a.compile=function(e,t,n){return a.compileEncoding(i.fromSpec(e,n),t)},a.shorthand=function(e,t,n,r){return a.compileEncoding(i.fromShorthand(e,n,r),t)},a.compileEncoding=function(e,t){t||(e.hasValues()?t=r(e.data().values).reduce(function(e,t){return e[t.field]=t,e},{}):console.error("No stats provided and data is not embedded."));var n=a.layout(e,t),i={width:n.width,height:n.height,padding:"auto",data:a.data(e,t),scales:a.time.scales(e),marks:[{name:"cell",type:"group",properties:{enter:{width:n.cellWidth?{value:n.cellWidth}:{field:{group:"width"}},height:n.cellHeight?{value:n.cellHeight}:{field:{group:"height"}}}}}]},f=i.marks[0],l=a.style(e,t),d=f.marks=u.def(e,n,l,t),h=d[d.length-1],p=e.stack();p&&a.stack(e,h,p);var m=u[e.marktype()].line,g=e.details();if(g.length>0&&m&&a.subfacet(f,h,g,e),m&&e.config("autoSortLine")){var b=e.isMeasure(X)&&e.isDimension(Y)?Y:X;h.from||(h.from={}),h.from.transform=[{type:"sort",by:"-"+e.fieldRef(b)}]}var y=[].concat.apply([],d.map(function(e){return c.names(e.properties.update)}));return e.has(ROW)||e.has(COL)?(i=a.facet(f,e,n,i,y,t),i.legends=s.defs(e,l)):(f.scales=c.defs(y,e,n,t),f.axes=[],e.has(X)&&f.axes.push(o.def(X,e,n,t)),e.has(Y)&&f.axes.push(o.def(Y,e,n,t)),f.legends=s.defs(e,l)),i}},{"../Encoding":54,"../globals":71,"./axis":55,"./data":57,"./facet":58,"./layout":59,"./legend":60,"./marks":61,"./scale":62,"./stack":63,"./style":64,"./subfacet":65,"./time":66,"datalib/src/stats":29}],57:[function(e,t,n){"use strict";function r(e,t){var n=[r.raw(e,t)],a=r.aggregate(e);a&&n.push(r.aggregate(e)),r.filterNonPositive(n[n.length-1],e);var i=e.stack();return i&&n.push(r.stack(e,i)),n}e("../globals"),t.exports=r;var a=e("../encdef"),i=e("../util"),o=e("./time");r.raw=function(e,t){var n={name:RAW};e.hasValues()?(n.values=e.data().values,n.format={type:"json"}):(n.url=e.data().url,n.format={type:e.data().formatType});var a=r.raw.formatParse(e);return a&&(n.format.parse=a),n.transform=r.raw.transform(e,t),n},r.raw.formatParse=function(e){var t;return e.forEach(function(e){if(e.type==T)t=t||{},t[e.name]="date";else if(e.type==Q){if(a.isCount(e))return;t=t||{},t[e.name]="number"}}),t},r.raw.transform=function(e,t){return r.raw.transform.nullFilter(e).concat(r.raw.transform.formula(e),r.raw.transform.time(e),r.raw.transform.bin(e,t),r.raw.transform.filter(e))},r.raw.transform.time=function(e){return e.reduce(function(t,n,r){if(n.type===T&&n.timeUnit){var a=e.fieldRef(r,{nofn:!0,datum:!0});t.push({type:"formula",field:e.fieldRef(r),expr:o.formula(n.timeUnit,a)})}return t},[])},r.raw.transform.bin=function(e,t){return e.reduce(function(n,r,a){return e.bin(a)&&n.push({type:"bin",field:r.name,output:{bin:e.fieldRef(a)},maxbins:e.bin(a).maxbins,min:t[r.name].min,max:t[r.name].max}),n},[])},r.raw.transform.nullFilter=function(e){var t=i.reduce(e.fields(),function(t,n,r){return"*"===r?t:((e.config("filterNull").Q&&n.containsType[Q]||e.config("filterNull").T&&n.containsType[T]||e.config("filterNull").O&&n.containsType[O]||e.config("filterNull").N&&n.containsType[N])&&t.push(r),t)},[]);return t.length>0?[{type:"filter",test:t.map(function(e){return"datum."+e+"!==null"}).join(" && ")}]:[]},r.raw.transform.filter=function(e){var t=e.data().filter;return t?[{type:"filter",test:t}]:[]},r.raw.transform.formula=function(e){var t=e.data().formulas;return void 0===t?[]:t.reduce(function(e,t){return t.type="formula",e.push(t),e},[])},r.aggregate=function(e){var t={},n={},r=!1;e.forEach(function(a,i){a.aggregate?(r=!0,"count"===a.aggregate?(n["*"]=n["*"]||{},n["*"].count=!0):(n[a.name]=n[a.name]||{},n[a.name][a.aggregate]=!0)):t[a.name]=e.fieldRef(i)});var a=i.vals(t),o=i.reduce(n,function(e,t,n){return e[n]=i.keys(t),e},{});return r?{name:AGGREGATE,source:RAW,transform:[{type:"aggregate",groupby:a,summarize:o}]}:null},r.stack=function(e,t){var n=t.groupby,r=t.value,a=e.facets(),i={name:STACKED,source:e.dataTable(),transform:[{type:"aggregate",groupby:[e.fieldRef(n)].concat(a),summarize:[{ops:["sum"],field:e.fieldRef(r)}]}]};return a&&a.length>0&&i.transform.push({type:"aggregate",groupby:a,summarize:[{ops:["max"],field:e.fieldRef(r,{prefn:"sum_"})}]}),i},r.filterNonPositive=function(e,t){t.forEach(function(n,r){"log"===t.scale(r).type&&e.transform.push({type:"filter",test:t.fieldRef(r,{datum:1})+" > 0"})})}},{"../encdef":70,"../globals":71,"../util":75,"./time":66}],58:[function(e,t,n){"use strict";function r(e,t){t=t||{};var n={name:e||void 0,type:"group",properties:{enter:{width:t.width||{field:{group:"width"}},height:t.height||{field:{group:"height"}}}}};return t.from&&(n.from=t.from),t.x&&(n.properties.enter.x=t.x),t.y&&(n.properties.enter.y=t.y),t.axes&&(n.axes=t.axes),n}function a(e,t,n,a,u,c){var f,l,d=e.properties.enter,h=[],p=[],m=t.has(ROW),g=t.has(COL);d.fill={value:t.config("cellBackgroundColor")},e.from={data:e.marks[0].from.data};for(var b=0;b0&&(e.axes=p);var v=e.from.transform||(e.from.transform=[]);return v.unshift({type:"facet",groupby:h}),a}e("../globals");var i=e("../util"),o=e("./axis"),s=e("./scale");t.exports=a},{"../globals":71,"../util":75,"./axis":55,"./scale":62}],59:[function(e,t,n){"use strict";function r(e,t){var n=a(e,t);return n=s(e,t,n)}function a(e,t){var n,r,a=e.has(ROW),i=e.has(COL),o=e.has(X),s=e.has(Y),u=e.marktype(),c=o&&e.isDimension(X)?e.cardinality(X,t):1,f=s&&e.isDimension(Y)?e.cardinality(Y,t):1,l=c>e.config("largeBandMaxCardinality")||f>e.config("largeBandMaxCardinality"),d=e.config("cellPadding");n=o?e.isOrdinalScale(X)?(c+e.encDef(X).band.padding)*e.bandSize(X,l):i||a?e.encDef(COL).width:e.config("singleWidth"):u===TEXT?e.config("textCellWidth"):e.bandSize(X),r=s?e.isOrdinalScale(Y)?(f+e.encDef(Y).band.padding)*e.bandSize(Y,l):i||a?e.encDef(ROW).height:e.config("singleHeight"):e.bandSize(Y);var h=n,p=r;if(i){var m=e.cardinality(COL,t);h=n*((1+d)*(m-1)+1)}if(a){var g=e.cardinality(ROW,t);p=r*((1+d)*(g-1)+1)}return{cellWidth:n,cellHeight:r,cellPadding:d,width:h,height:p,x:{useSmallBand:l},y:{useSmallBand:l}}}function i(e,t,n){var r=e.numberFormat(t,n);return l.format(r)(n.max).length}function o(e,t,n){var r=e.encDef(n),a=t[r.name];return r.bin?i(e,n,a):e.isType(n,Q)?i(e,n,a):e.isType(n,T)?f.maxLength(e.encDef(n).timeUnit,e):e.isTypes(n,[N,O])?"number"===a.type?i(e,n,a):Math.min(a.max,e.axis(n).maxLabelLength||1/0):void 0}function s(e,t,n){return[X,Y].forEach(function(r){var a,i=r===X?20:22;e.isDimension(r)||e.isType(r,T)?a=o(e,t,r):(e.isType(r,Q)||"count"===e.encDef(r).aggregate)&&r===Y&&(a=o(e,t,r)),a?c(n,[r,"axisTitleOffset"],e.config("characterWidth")*a+i):c(n,[r,"axisTitleOffset"],3*e.config("characterWidth")+i)}),n}e("../globals");var u=e("../util"),c=u.setter,f=e("./time"),l=e("d3-format");t.exports=r},{"../globals":71,"../util":75,"./time":66,"d3-format":5}],60:[function(e,t,n){"use strict";e("../globals");var r=e("./time"),a=e("../util"),i=a.setter,o=a.getter,s=t.exports={};s.defs=function(e,t){var n=[];return e.has(COLOR)&&e.encDef(COLOR).legend&&n.push(s.def(COLOR,e,{fill:COLOR},t)),e.has(SIZE)&&e.encDef(SIZE).legend&&n.push(s.def(SIZE,e,{size:SIZE},t)),e.has(SHAPE)&&e.encDef(SHAPE).legend&&n.push(s.def(SHAPE,e,{shape:SHAPE},t)),n},s.def=function(e,t,n,a){var o=t.encDef(e).timeUnit;return n.title=s.title(e,t),n.orient=t.encDef(e).legend.orient,n=s.style(e,t,n,a),t.isType(e,T)&&o&&r.hasScale(o)&&i(n,["properties","labels","text","scale"],"time-"+o),n},s.style=function(e,t,n,r){var a=o(n,["properties","symbols"]),i=t.marktype();switch(i){case"bar":case"tick":case"text":a.stroke={value:"transparent"},a.shape={value:"square"};break;case"circle":case"square":a.shape={value:i};case"point":t.encDef(SHAPE).filled?(t.has(COLOR)&&e===COLOR?a.fill={scale:COLOR,field:"data"}:a.fill={value:t.value(COLOR)},a.stroke={value:"transparent"}):(t.has(COLOR)&&e===COLOR?a.stroke={scale:COLOR,field:"data"}:a.stroke={value:t.value(COLOR)},a.fill={value:"transparent"},a.strokeWidth={value:t.config("strokeWidth")});break;case"line":case"area":}var s=t.encDef(COLOR).opacity||r.opacity;return s&&(a.opacity={value:s}),n},s.title=function(e,t){var n=t.encDef(e).legend;return n.title?n.title:t.fieldTitle(e)}},{"../globals":71,"../util":75,"./time":66}],61:[function(e,t,n){"use strict";function r(e,t,n){var r={};e.isMeasure(X)?(r.x={scale:X,field:e.fieldRef(X)},(!e.has(Y)||e.isDimension(Y))&&(r.x2={value:0})):e.has(X)?r.xc={scale:X,field:e.fieldRef(X)}:r.x={value:0,offset:e.config("singleBarOffset")},r.x2||(!e.has(X)||e.isOrdinalScale(X)?e.has(SIZE)?r.width={scale:SIZE,field:e.fieldRef(SIZE)}:r.width={value:e.bandSize(X,t.x.useSmallBand),offset:-1}:r.width={value:2}),e.isMeasure(Y)?(r.y={scale:Y,field:e.fieldRef(Y)},r.y2={field:{group:"height"}}):(e.has(Y)?r.yc={scale:Y,field:e.fieldRef(Y)}:r.y2={field:{group:"height"},offset:-e.config("singleBarOffset")},e.has(SIZE)?r.height={scale:SIZE,field:e.fieldRef(SIZE)}:r.height={value:e.bandSize(Y,t.y.useSmallBand),offset:-1}),e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:r.fill={value:e.value(COLOR)};var a=e.encDef(COLOR).opacity;return a&&(r.opacity={value:a}),r}function a(e,t,n){var r={};e.has(X)?r.x={scale:X,field:e.fieldRef(X)}:e.has(X)||(r.x={value:e.bandSize(X,t.x.useSmallBand)/2}),e.has(Y)?r.y={scale:Y,field:e.fieldRef(Y)}:e.has(Y)||(r.y={value:e.bandSize(Y,t.y.useSmallBand)/2}),e.has(SIZE)?r.size={scale:SIZE,field:e.fieldRef(SIZE)}:e.has(SIZE)||(r.size={value:e.value(SIZE)}),e.has(SHAPE)?r.shape={scale:SHAPE,field:e.fieldRef(SHAPE)}:e.has(SHAPE)||(r.shape={value:e.value(SHAPE)}),e.encDef(SHAPE).filled?e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.fill={value:e.value(COLOR)}):(e.has(COLOR)?r.stroke={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.stroke={value:e.value(COLOR)}),r.strokeWidth={value:e.config("strokeWidth")});var a=e.encDef(COLOR).opacity||n.opacity;return a&&(r.opacity={value:a}),r}function i(e,t,n){var r={};e.has(X)?r.x={scale:X,field:e.fieldRef(X)}:e.has(X)||(r.x={value:0}),e.has(Y)?r.y={scale:Y,field:e.fieldRef(Y)}:e.has(Y)||(r.y={field:{group:"height"}}),e.has(COLOR)?r.stroke={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.stroke={value:e.value(COLOR)});var a=e.encDef(COLOR).opacity;return a&&(r.opacity={value:a}),r.strokeWidth={value:e.config("strokeWidth")},r}function o(e,t,n){var r={};e.isMeasure(X)?(r.x={scale:X,field:e.fieldRef(X)},e.isDimension(Y)&&(r.x2={scale:X,value:0},r.orient={value:"horizontal"})):e.has(X)?r.x={scale:X,field:e.fieldRef(X)}:r.x={value:0},e.isMeasure(Y)?(r.y={scale:Y,field:e.fieldRef(Y)},r.y2={scale:Y,value:0}):e.has(Y)?r.y={scale:Y,field:e.fieldRef(Y)}:r.y={field:{group:"height"}},e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.fill={value:e.value(COLOR)});var a=e.encDef(COLOR).opacity;return a&&(r.opacity={value:a}),r}function s(e,t,n){var r={};e.has(X)?(r.x={scale:X,field:e.fieldRef(X)},e.isDimension(X)&&(r.x.offset=-e.bandSize(X,t.x.useSmallBand)/3)):e.has(X)||(r.x={value:0}),e.has(Y)?(r.y={scale:Y,field:e.fieldRef(Y)},e.isDimension(Y)&&(r.y.offset=-e.bandSize(Y,t.y.useSmallBand)/3)):e.has(Y)||(r.y={value:0}),!e.has(X)||e.isDimension(X)?r.width={value:e.bandSize(X,t.y.useSmallBand)/1.5}:r.width={value:1},!e.has(Y)||e.isDimension(Y)?r.height={value:e.bandSize(Y,t.y.useSmallBand)/1.5}:r.height={value:1},e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:r.fill={value:e.value(COLOR)};var a=e.encDef(COLOR).opacity||n.opacity;return a&&(r.opacity={value:a}),r}function u(e){return function(t,n,r){var a={};t.has(X)?a.x={scale:X,field:t.fieldRef(X)}:t.has(X)||(a.x={value:t.bandSize(X,n.x.useSmallBand)/2}),t.has(Y)?a.y={scale:Y,field:t.fieldRef(Y)}:t.has(Y)||(a.y={value:t.bandSize(Y,n.y.useSmallBand)/2}),t.has(SIZE)?a.size={scale:SIZE,field:t.fieldRef(SIZE)}:t.has(X)||(a.size={value:t.value(SIZE)}),a.shape={value:e},t.has(COLOR)?a.fill={scale:COLOR,field:t.fieldRef(COLOR)}:t.has(COLOR)||(a.fill={value:t.value(COLOR)});var i=t.encDef(COLOR).opacity||r.opacity;return i&&(a.opacity={value:i}),a}}function c(e,t,n,r){var a={},i=e.encDef(TEXT);e.has(X)?a.x={scale:X,field:e.fieldRef(X)}:e.has(X)||(e.has(TEXT)&&e.isType(TEXT,Q)?a.x={value:t.cellWidth-5}:a.x={value:e.bandSize(X,t.x.useSmallBand)/2}),e.has(Y)?a.y={scale:Y,field:e.fieldRef(Y)}:e.has(Y)||(a.y={value:e.bandSize(Y,t.y.useSmallBand)/2}),e.has(SIZE)?a.fontSize={scale:SIZE,field:e.fieldRef(SIZE)}:e.has(SIZE)||(a.fontSize={value:i.font.size}),a.fill={value:i.color};var o=e.encDef(COLOR).opacity||n.opacity;if(o&&(a.opacity={value:o}),e.has(TEXT))if(e.isType(TEXT,Q)){var s=r[e.encDef(TEXT).name],u=i.format||e.numberFormat(s);a.text={template:"{{"+e.fieldRef(TEXT,{datum:!0})+" | number:'"+u+"'}}"},a.align={value:i.align}}else a.text={field:e.fieldRef(TEXT)};else a.text={value:i.placeholder};return a.font={value:i.font.family},a.fontWeight={value:i.font.weight},a.fontStyle={value:i.font.style},a.baseline={value:i.baseline},a}e("../globals");var f=t.exports={};f.def=function(e,t,n,r){var a=[],i=f[e.marktype()],o=e.dataTable();if(e.marktype()===TEXT&&e.has(COLOR)){var s={x:{value:0},y:{value:0},x2:{value:t.cellWidth},y2:{value:t.cellHeight},fill:{scale:COLOR,field:e.fieldRef(COLOR)}};a.push({type:"rect",from:{data:o},properties:{enter:s,update:s}})}var u=i.prop(e,t,n,r);return a.push({type:i.type,from:{data:o},properties:{enter:u,update:u}}),a},f.bar={type:"rect",prop:r,supportedEncoding:{row:1,col:1,x:1,y:1,size:1,color:1}},f.line={type:"line",line:!0,prop:i,requiredEncoding:["x","y"],supportedEncoding:{row:1,col:1,x:1,y:1,color:1,detail:1}},f.area={type:"area",line:!0,requiredEncoding:["x","y"],prop:o,supportedEncoding:{row:1,col:1,x:1,y:1,color:1}},f.tick={type:"rect",prop:s,supportedEncoding:{row:1,col:1,x:1,y:1,color:1,detail:1}},f.circle={type:"symbol",prop:u("circle"),supportedEncoding:{row:1,col:1,x:1,y:1,size:1,color:1,detail:1}},f.square={type:"symbol",prop:u("square"),supportedEncoding:f.circle.supportedEncoding},f.point={type:"symbol",prop:a,supportedEncoding:{row:1,col:1,x:1,y:1,size:1,color:1,shape:1,detail:1}},f.text={type:"text",prop:c,requiredEncoding:["text"],supportedEncoding:{row:1,col:1,size:1,color:1,text:1}}},{"../globals":71}],62:[function(e,t,n){"use strict";e("../globals");var r=e("../util"),a=e("./time"),i=e("colorbrewer"),o=e("d3-color").interpolateHsl,s=e("../schema/schema"),u=t.exports={};u.names=function(e){return r.keys(r.keys(e).reduce(function(t,n){return e[n]&&e[n].scale&&(t[e[n].scale]=1),t},{}))},u.defs=function(e,t,n,r,a){return e.reduce(function(e,i){var o={};o.name=i,o.type=u.type(i,t),o.domain=u.domain(t,i,o.type,r,a);var s=u.reverse(t,i);return s&&(o.reverse=s),o=u.range(o,t,n,r),e.push(o),e},[])},u.type=function(e,t){switch(t.type(e)){case N:case O:return"ordinal";case T:var n=t.encDef(e).timeUnit;return n?a.scale.type(n,e):"time";case Q:return t.bin(e)?e===COLOR?"linear":"ordinal":t.scale(e).type}},u.domain=function(e,t,n,i,o){var c=e.encDef(t);if(e.isType(t,T)){var f=a.scale.domain(c.timeUnit,t);if(f)return f}if(c.bin){var l=i[c.name],d=r.getbins(l,c.bin.maxbins||s.MAXBINS_DEFAULT),h=(d.stop-d.start)/d.step;return r.range(h).map(function(e){return d.start+d.step*e})}var p=e.stack();if(p&&t===p.value)return{data:STACKED,field:e.fieldRef(t,{prefn:(o?"max_":"")+"sum_"})};var m=u._useRawDomain(e,t),g=u.sort(e,t,n);return m?{data:RAW,field:e.fieldRef(t,{noAggregate:!0})}:g?{data:g.op?RAW:e.dataTable(),field:e.fieldRef(t),sort:g}:{data:e.dataTable(),field:e.fieldRef(t)}},u.sort=function(e,t,n){var a=e.encDef(t).sort;return"ascending"===a||"descending"===a?!0:"ordinal"===n&&r.isObject(a)?{op:a.op,field:a.field}:void 0},u.reverse=function(e,t){var n=e.encDef(t).sort;return n&&("descending"===n||"descending"===n.order)},u._useRawDomain=function(e,t){var n=e.encDef(t),r=e.scale(t).useRawDomain,i=void 0!==r?r:e.config("useRawDomain"),o=!n.aggregate||"count"!==n.aggregate&&"sum"!==n.aggregate;return i&&o&&(e.isType(t,Q)&&!n.bin||e.isType(t,T)&&(!n.timeUnit||!a.isOrdinalFn(n.timeUnit)))},u.range=function(e,t,n,r){var a=t.scale(e.name),i=t.encDef(e.name),o=i.timeUnit;switch(e.name){case X:e.range=n.cellWidth?[0,n.cellWidth]:"width","ordinal"===e.type?e.bandWidth=t.bandSize(X,n.x.useSmallBand):t.isType(e.name,T)&&"year"===o?e.zero=!1:e.zero=void 0===a.zero?!0:a.zero,e.round=!0,"time"===e.type?e.nice=o||t.config("timeScaleNice"):e.nice=!0;break;case Y:"ordinal"===e.type?(e.range=n.cellHeight?i.bin?[n.cellHeight,0]:[0,n.cellHeight]:"height",e.bandWidth=t.bandSize(Y,n.y.useSmallBand)):(e.range=n.cellHeight?[n.cellHeight,0]:"height",t.isType(e.name,T)&&"year"===o?e.zero=!1:e.zero=void 0===a.zero?!0:a.zero),e.round=!0,"time"===e.type?e.nice=o||t.config("timeScaleNice"):e.nice=!0;break;case ROW:e.bandWidth=n.cellHeight,e.round=!0,e.nice=!0;break;case COL:e.bandWidth=n.cellWidth,e.round=!0,e.nice=!0;break;case SIZE:if(t.is("bar"))e.range=[3,Math.max(t.bandSize(X),t.bandSize(Y))];else if(t.is(TEXT))e.range=[8,40];else{var s=Math.min(t.bandSize(X),t.bandSize(Y))-1;e.range=[10,.8*s*s]}e.round=!0,e.zero=!1;break;case SHAPE:e.range="shapes";break;case COLOR:e.range=u.color(e,t,r),"ordinal"!==e.type&&(e.zero=!1);break;default:throw new Error("Unknown encoding name: "+e.name)}switch(e.name){case ROW:case COL:e.padding=t.config("cellPadding"),e.outerPadding=0;break;case X:case Y:"ordinal"===e.type&&(e.points=!0,e.padding=t.encDef(e.name).band.padding)}return e},u.color=function(e,t,n){var r=t.scale(COLOR),a=r.range,i=t.cardinality(COLOR,n),o=t.type(COLOR);if(void 0===a){var s=r.ordinalPalette,c=r.quantitativeRange;return"ordinal"===e.type?o===N?(a=10>=i?r.c10palette:r.c20palette,u.color.palette(a,i,o)):s?u.color.palette(s,i,o):u.color.interpolate(c[0],c[1],i):[c[0],c[1]]}},u.color.palette=function(e,t,n){switch(e){case"category10k":return["#2ca02c","#e377c2","#7f7f7f","#17becf","#8c564b","#d62728","#bcbd22","#9467bd","#ff7f0e","#1f77b4"];case"category10":return["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];case"category20":return["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];case"category20b":return["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"]; -case"category20c":return["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"]}if(e in i){var a=i[e];if(t in a)return a[t];if(n===N)return a[Math.max.apply(null,r.keys(a))];var o=3>t?3:Math.max.apply(null,r.keys(a)),s=0,c=o-1;return u.color.interpolate(a[o][s],a[o][c],t)}return e},u.color.interpolate=function(e,t,n){var a=o(e,t);return r.range(n).map(function(e){return a(1*e/(n-1))})}},{"../globals":71,"../schema/schema":73,"../util":75,"./time":66,colorbrewer:3,"d3-color":4}],63:[function(e,t,n){"use strict";function r(e,t,n){var r=n.groupby,a=n.value,i=e.fieldRef(a),o=i+"_start",s=i+"_end",u={type:"stack",groupby:[e.fieldRef(r)],field:e.fieldRef(a),sortby:[(n.properties.reverse?"":"-")+e.fieldRef(n.stack)],output:{start:o,end:s}};return n.properties.offset&&(u.offset=n.properties.offset),t.from.transform=[u],t.properties.update[a]=t.properties.enter[a]={scale:a,field:o},t.properties.update[a+"2"]=t.properties.enter[a+"2"]={scale:a,field:s},a}e("../globals"),t.exports=r},{"../globals":71}],64:[function(e,t,n){"use strict";function r(e,t){if(!t)return 1;var n=0;if(e.isAggregate())n=1,e.forEach(function(r,i){i===ROW||i===COL||(i===X||i===Y)&&a.isOrdinalScale(r)||(n*=e.cardinality(i,t))});else{if(!t["*"])return 1;n=t["*"].max;var r=1;e.has(ROW)&&(r*=e.cardinality(ROW,t)),e.has(COL)&&(r*=e.cardinality(COL,t)),n/=r}var i=0;return i=25>=n?1:200>n?.8:1e3>n||e.is("tick")?.7:.3}e("../globals");var a=e("../encdef");t.exports=function(e,t){return{opacity:r(e,t)}}},{"../encdef":70,"../globals":71}],65:[function(e,t,n){"use strict";function r(e,t,n,r){var a=e.marks,i={name:"subfacet",type:"group",from:t.from,properties:{enter:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:a};e.marks=[i],delete t.from;var o=i.from.transform||(i.from.transform=[]);o.push({type:"facet",groupby:n});var s=r.stack();s&&r.has(COLOR)&&o.unshift({type:"sort",by:r.fieldRef(COLOR)})}e("../globals"),t.exports=r},{"../globals":71}],66:[function(e,t,n){"use strict";var r=e("../util"),a=e("d3-time-format"),i=t.exports={},o=new Date(Date.UTC(2014,8,17));i.cardinality=function(e,t,n,r){var a=e.timeUnit;switch(a){case"seconds":return 60;case"minutes":return 60;case"hours":return 24;case"day":return 7;case"date":return 31;case"month":return 12;case"year":var i=t[e.name],o=t["year_"+e.name];return o?o.distinct-(i.missing>0&&n[r]?1:0):null}return null},i.formula=function(e,t){var n="utc"+e;return n+"("+t+")"},i.maxLength=function(e,t){switch(e){case"seconds":case"minutes":case"hours":case"date":return 2;case"month":case"day":var n=i.range(e,t);return n?Math.max.apply(null,n.map(function(e){return e.length})):2;case"year":return 4}var r=t.config("timeFormat");return a.utcFormat(r)(o).length},i.range=function(e,t){var n,r=t.config("timeScaleLabelLength");switch(e){case"day":n=t.config("dayScaleLabel");break;case"month":n=t.config("monthScaleLabel")}return n?r?n.map(function(e){return e.substr(0,r)}):n:void 0},i.scales=function(e){var t=e.reduce(function(t,n){var r=n.timeUnit;if(n.type===T&&r&&!t[r]){var a=i.scale.def(n.timeUnit,e);a&&(t[r]=a)}return t},{});return r.vals(t)},i.scale={},i.scale.def=function(e,t){var n=i.range(e,t);return n?{name:"time-"+e,type:"ordinal",domain:i.scale.domain(e),range:n}:null},i.isOrdinalFn=function(e){switch(e){case"seconds":case"minutes":case"hours":case"day":case"date":case"month":return!0}return!1},i.scale.type=function(e,t){return t===COLOR?"linear":i.isOrdinalFn(e)||t===COL||t===ROW?"ordinal":"linear"},i.scale.domain=function(e,t){var n=t===COLOR;switch(e){case"seconds":case"minutes":return n?[0,59]:r.range(0,60);case"hours":return n?[0,23]:r.range(0,24);case"day":return n?[0,6]:r.range(0,7);case"date":return n?[1,31]:r.range(1,32);case"month":return n?[0,11]:r.range(0,12)}return null},i.hasScale=function(e){switch(e){case"day":case"month":return!0}return!1}},{"../util":75,"d3-time-format":6}],67:[function(e,t,n){"use strict";e("./globals");var r=t.exports={};r.encodingTypes=[X,Y,ROW,COL,SIZE,SHAPE,COLOR,TEXT,DETAIL],r.shorthand={delim:"|",assign:"=",type:",",func:"_"}},{"./globals":71}],68:[function(e,t,n){"use strict";e("./globals");var r=e("datalib/src/stats"),a=t.exports={};a.types={"boolean":N,number:Q,integer:Q,date:T,string:N},a.stats=function(e){var t=r.summary(e);return t.reduce(function(e,t){return e[t.field]=t,e},{"*":{max:e.length,min:0}})}},{"./globals":71,"datalib/src/stats":29}],69:[function(e,t,n){"use strict";var r=e("./consts"),a=r.shorthand,i=e("./encdef"),o=e("./util"),s=e("./schema/schema"),u=s.encTypes,c=t.exports={};c.countRetinal=function(e){var t=0;return e.color&&t++,e.size&&t++,e.shape&&t++,t},c.has=function(e,t){var n=e&&e[t];return n&&n.name},c.isAggregate=function(e){for(var t in e)if(c.has(e,t)&&e[t].aggregate)return!0;return!1},c.forEach=function(e,t){var n=0;u.forEach(function(r){c.has(e,r)&&t(e[r],r,n++)})},c.map=function(e,t){var n=[];return u.forEach(function(r){c.has(e,r)&&n.push(t(e[r],r,e))}),n},c.reduce=function(e,t,n){var r=n;return u.forEach(function(n){c.has(e,n)&&(r=t(r,e[n],n,e))}),r},c.fields=function(e){return c.reduce(e,function(e,t){var n=e[t.name]=e[t.name]||[],r=n.containsType=n.containsType||{};return-1===n.indexOf(t)&&(n.push(t),r[t.type]=!0),e},{})},c.shorthand=function(e){return c.map(e,function(e,t){return t+a.assign+i.shorthand(e)}).join(a.delim)},c.fromShorthand=function(e){var t=o.isArray(e)?e:e.split(a.delim);return t.reduce(function(e,t){var n=t.split(a.assign),r=n[0].trim(),o=n[1];return e[r]=i.fromShorthand(o),e},{})}},{"./consts":67,"./encdef":70,"./schema/schema":73,"./util":75}],70:[function(e,t,n){"use strict";function r(e){return l(e,[N,O])||!!e.bin||f(e,T)&&!!e.timeUnit}e("./globals");var a=e("./consts"),i=a.shorthand,o=e("./compiler/time"),s=e("./util"),u=e("./schema/schema"),c=t.exports={};c.fieldRef=function(e,t){t=t||{};var n=(t.datum?"datum.":"")+(t.prefn||""),r=e.name;return c.isCount(e)?n+"count":t.fn?n+t.fn+"_"+r:!t.nofn&&e.bin?n+"bin_"+r:t.nofn||t.noAggregate||!e.aggregate?!t.nofn&&e.timeUnit?n+e.timeUnit+"_"+r:n+r:n+e.aggregate+"_"+r},c.shorthand=function(e){var t=a.shorthand;return(e.aggregate?e.aggregate+t.func:"")+(e.timeUnit?e.timeUnit+t.func:"")+(e.bin?"bin"+t.func:"")+(e.name||"")+t.type+e.type},c.shorthands=function(e,t){return t=t||i.delim,e.map(c.shorthand).join(t)},c.fromShorthand=function(e){var t,n=e.split(i.type),r={name:n[0].trim(),type:n[1].trim()};for(t in u.aggregate["enum"]){var a=u.aggregate["enum"][t];if(0===r.name.indexOf(a+"_")){r.name=r.name.substr(a.length+1),"count"==a&&0===r.name.length&&(r.name="*"),r.aggregate=a;break}}for(t in u.timefns){var o=u.timefns[t];if(r.name&&0===r.name.indexOf(o+"_")){r.name=r.name.substr(r.length+1),r.timeUnit=o;break}}return r.name&&0===r.name.indexOf("bin_")&&(r.name=r.name.substr(4),r.bin=!0),r};var f=c.isType=function(e,t){return e.type===t},l=c.isTypes=function(e,t){for(var n=0;n0&&n[a]?1:0)}},{"./compiler/time":66,"./consts":67,"./globals":71,"./schema/schema":73,"./util":75}],71:[function(e,t,n){(function(e){"use strict";var t=e||window;t.AGGREGATE="aggregate",t.RAW="raw",t.STACKED="stacked",t.INDEX="index",t.X="x",t.Y="y",t.ROW="row",t.COL="col",t.SIZE="size",t.SHAPE="shape",t.COLOR="color",t.TEXT="text",t.DETAIL="detail",t.N="N",t.O="O",t.Q="Q",t.T="T"}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],72:[function(e,t,n){"use strict";t.exports=function(e){var t=["error","info","debug","warn","log"];return t.reduce(function(t,n){var r=console[n]?n:"log";return"undefined"===console[r].bind?t[n]=Function.prototype.bind.call(console[r],console,e):t[n]=console[r].bind(console,e),t},{})}},{}],73:[function(e,t,n){"use strict";e("../globals");var r=t.exports={},a=e("../util"),i=a.toMap,o=e("colorbrewer"),s=e("vega/src/transforms/Aggregate").VALID_OPS;r.util=e("./schemautil"),r.marktype={type:"string","enum":["point","tick","bar","line","area","circle","square","text"]},r.aggregate={type:"string","enum":s,supportedEnums:{Q:s,O:["median","min","max"],N:[],T:["mean","median","min","max"],"":["count"]},supportedTypes:i([Q,N,O,T,""])},r.getSupportedRole=function(e){return r.schema.properties.encoding.properties[e].supportedRole},r.timeUnits=["year","month","day","date","hours","minutes","seconds"],r.defaultTimeFn="month",r.timeUnit={type:"string","enum":r.timeUnits,supportedTypes:i([T])},r.scale_type={type:"string","enum":["linear","log","pow","sqrt","quantile"],"default":"linear",supportedTypes:i([Q])},r.field={type:"object",properties:{name:{type:"string"}}};var u=a.duplicate,c=r.util.merge;r.MAXBINS_DEFAULT=15;var f={type:["boolean","object"],"default":!1,properties:{maxbins:{type:"integer","default":r.MAXBINS_DEFAULT,minimum:2,description:"Maximum number of bins."}},supportedTypes:i([Q])},l=c(u(r.field),{type:"object",properties:{type:{type:"string","enum":[N,O,Q,T]},aggregate:r.aggregate,timeUnit:r.timeUnit,bin:f,scale:{type:"object",properties:{type:r.scale_type,nice:{type:"string","enum":["second","minute","hour","day","week","month","year"],supportedTypes:i([T])},zero:{type:"boolean",description:"Include zero","default":!0,supportedTypes:i([Q,T])},useRawDomain:{type:"boolean","default":void 0,description:"Use the raw data range as scale domain instead of aggregated data for aggregate axis. This option does not work with sum or count aggregateas they might have a substantially larger scale range.By default, use value from config.useRawDomain."}}}}}),d=c(u(r.field),{type:"object",supportedRole:{dimension:!0},properties:{type:{type:"string","enum":[N,O,Q,T]},timeUnit:r.timeUnit,bin:f,aggregate:{type:"string","enum":["count"],supportedTypes:i([N,O])}}}),h={type:"object",supportedMarktypes:{point:!0,tick:!0,bar:!0,line:!0,area:!0,circle:!0,square:!0},properties:{axis:{type:"object",properties:{format:{type:"string","default":void 0,description:"The formatting pattern for axis labels. If not undefined, this will be determined by small/largeNumberFormat and the max value of the field."},grid:{type:"boolean","default":void 0,description:"A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise."},layer:{type:"string","default":"back",description:'A string indicating if the axis (and any gridlines) should be placed above or below the data marks. One of "front" (default) or "back".'},orient:{type:"string","default":void 0,"enum":["top","right","left","bottom"],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 for the right edge of the chart)."},ticks:{type:"integer","default":5,minimum:0,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.'},title:{type:"string","default":void 0,description:"A title for the axis. (Shows field name and its function by default.)"},maxLabelLength:{type:"integer","default":25,minimum:0,description:"Truncate labels that are too long."},labelAngle:{type:"integer","default":void 0,minimum:0,maximum:360,description:"Angle by which to rotate labels. Set to 0 to force horizontal."},titleMaxLength:{type:"integer","default":void 0,minimum:0,description:"Max length for axis title if the title is automatically generated from the field's description"},titleOffset:{type:"integer","default":void 0,description:"A title offset value for the axis."}}}}},p={type:"object",properties:{sort:{"default":void 0,supportedTypes:i([N,O]),oneOf:[{type:"string","enum":["ascending","descending"]},{type:"object",required:["field","op"],properties:{field:{type:"string",description:"The field name to aggregate over."},op:{type:"string","enum":s,description:"The field name to aggregate over."},order:{type:"string","enum":["ascending","descending"]}}}]}}},m={type:"object",properties:{band:{type:"object",properties:{size:{type:"integer",minimum:0,"default":void 0},padding:{type:"integer",minimum:0,"default":1}}}}},g={type:"object",properties:{legend:{type:"object",description:"Properties of a legend.",properties:{title:{type:"string","default":void 0,description:"A title for the legend. (Shows field name and its function by default.)"},orient:{type:"string","default":"right",description:'The orientation of the legend. One of "left" or "right". This determines how the legend is positioned within the scene. The default is "right".'}}}}},b={type:"object",supportedMarktypes:{text:!0},properties:{align:{type:"string","default":"right"},baseline:{type:"string","default":"middle"},color:{type:"string",role:"color","default":"#000000"},margin:{type:"integer","default":4,minimum:0},placeholder:{type:"string","default":"Abc"},font:{type:"object",properties:{weight:{type:"string","enum":["normal","bold"],"default":"normal"},size:{type:"integer","default":10,minimum:0},family:{type:"string","default":"Helvetica Neue"},style:{type:"string","default":"normal","enum":["normal","italic"]}}},format:{type:"string","default":void 0,description:"The formatting pattern for text value. If not undefined, this will be determined by small/largeNumberFormat and the max value of the field."}}},y={type:"object",supportedMarktypes:{point:!0,bar:!0,circle:!0,square:!0,text:!0},properties:{value:{type:"integer","default":30,minimum:0,description:"Size of marks."}}},v={type:"object",supportedMarktypes:{point:!0,tick:!0,bar:!0,line:!0,area:!0,circle:!0,square:!0,text:!0},properties:{value:{type:"string",role:"color","default":"#4682b4",description:"Color to be used for marks."},opacity:{type:"number","default":void 0,minimum:0,maximum:1},scale:{type:"object",properties:{range:{type:["string","array"],"default":void 0,description:"Color palette, if undefined vega-lite will use data propertyto pick one from c10palette, c20palette, or ordinalPalette."},c10palette:{type:"string","default":"category10","enum":["category10","category10k","Pastel1","Pastel2","Set1","Set2","Set3"]},c20palette:{type:"string","default":"category20","enum":["category20","category20b","category20c"]},ordinalPalette:{type:"string","default":void 0,description:"Color palette to encode ordinal variables.","enum":a.keys(o)},quantitativeRange:{type:"array","default":["#AFC6A3","#09622A"],description:"Color range to encode quantitative variables.",minItems:2,maxItems:2,items:{type:"string",role:"color"}}}}}},x={type:"object",properties:{stack:{type:["boolean","object"],"default":!0,description:"Enable stacking (for bar and area marks only).",properties:{reverse:{type:"boolean","default":!1,description:"Whether to reverse the stack's sortby."},offset:{type:"string","default":void 0,"enum":["zero","center","normalize"]}}}}},w={type:"object",supportedMarktypes:{point:!0,circle:!0,square:!0},properties:{value:{type:"string","enum":["circle","square","cross","diamond","triangle-up","triangle-down"],"default":"circle",description:"Mark to be used."},filled:{type:"boolean","default":!1,description:"Whether the shape's color should be used as fill color instead of stroke color."}}},_={type:"object",supportedMarktypes:{point:!0,tick:!0,line:!0,circle:!0,square:!0}},M={properties:{height:{type:"number",minimum:0,"default":150}}},S={properties:{width:{type:"number",minimum:0,"default":150},axis:{properties:{maxLabelLength:{type:"integer","default":12,minimum:0,description:"Truncate labels that are too long."}}}}},k={type:"object",supportedMarktypes:{point:!0,tick:!0,bar:!0,line:!0,area:!0,circle:!0,square:!0,text:!0},properties:{padding:{type:"number",minimum:0,maximum:1,"default":.1}}},L={required:["name","type"]},C=c(u(l),{supportedRole:{measure:!0,dimension:!0}}),D=c(u(l),{supportedRole:{measure:!0,dimension:"ordinal-only"}}),A=c(u(l),{supportedRole:{measure:!0}}),E=c(u(C),h,m,L,p),R=u(E),U=c(u(d),L,k,p),j=c(u(U),h,M),Y=c(u(U),h,S),F=c(u(D),g,y,p),P=c(u(C),g,v,x,p),z=c(u(d),g,w,p),I=c(u(d),_,x,p),H=c(u(A),b,p),X={type:"object",properties:{formatType:{type:"string","enum":["json","csv"],"default":"json"},url:{type:"string","default":void 0},values:{type:"array","default":void 0,description:"Pass array of objects instead of a url to a file.",items:{type:"object",additionalProperties:!0}},filter:{type:"string","default":void 0,description:"A string containing the filter Vega expression. Use `datum` to refer to the current data object."},formulas:{type:"array","default":void 0,description:"Array of formula transforms. Formulas are applied before filter.",items:{type:"object",properties:{field:{type:"string",description:"The property name in which to store the computed formula value."},expr:{type:"string",description:"A string containing an expression for the formula. Use the variable `datum` to to refer to the current data object."}}}}}},q={type:"object",properties:{width:{type:"integer","default":void 0},height:{type:"integer","default":void 0},viewport:{type:"array",items:{type:"integer"},"default":void 0},gridColor:{type:"string",role:"color","default":"#000000"},gridOpacity:{type:"number",minimum:0,maximum:1,"default":.08},filterNull:{type:"object",properties:{N:{type:"boolean","default":!1},O:{type:"boolean","default":!1},Q:{type:"boolean","default":!0},T:{type:"boolean","default":!0}}},autoSortLine:{type:"boolean","default":!0},singleHeight:{type:"integer","default":200,minimum:0},singleWidth:{type:"integer","default":200,minimum:0},largeBandSize:{type:"integer","default":21,minimum:0},smallBandSize:{type:"integer","default":12,minimum:0},largeBandMaxCardinality:{type:"integer","default":10},cellPadding:{type:"number","default":.1},cellGridColor:{type:"string",role:"color","default":"#000000"},cellGridOpacity:{type:"number",minimum:0,maximum:1,"default":.25},cellGridOffset:{type:"number","default":6},cellBackgroundColor:{type:"string",role:"color","default":"rgba(0,0,0,0)"},textCellWidth:{type:"integer","default":90,minimum:0},strokeWidth:{type:"integer","default":2,minimum:0},singleBarOffset:{type:"integer","default":5,minimum:0},timeScaleLabelLength:{type:"integer","default":3,minimum:0,description:"Max length for values in dayScaleLabel and monthScaleLabel. Zero means using full names in dayScaleLabel/monthScaleLabel."},dayScaleLabel:{type:"array",items:{type:"string"},"default":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],description:"Axis labels for day of week, starting from Sunday.(Consistent with Javascript -- See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay."},monthScaleLabel:{type:"array",items:{type:"string"},"default":["January","February","March","April","May","June","July","August","September","October","November","December"],description:"Axis labels for month."},characterWidth:{type:"integer","default":6},maxSmallNumber:{type:"number","default":1e4,description:"maximum number that a field will be considered smallNumber.Used for axis labelling."},smallNumberFormat:{type:"string","default":"",description:"D3 Number format for axis labels and text tables for number <= maxSmallNumber. Used for axis labelling."},largeNumberFormat:{type:"string","default":".3s",description:"D3 Number format for axis labels and text tables for number > maxSmallNumber."},timeFormat:{type:"string","default":"%Y-%m-%d",description:"Date format for axis labels."},useRawDomain:{type:"boolean","default":!1,description:"Use the raw data range as scale domain instead of aggregated data for aggregate axis. This option does not work with sum or count aggregateas they might have a substantially larger scale range.By default, use value from config.useRawDomain."}}};r.schema={$schema:"http://json-schema.org/draft-04/schema#",description:"Schema for Vega-lite specification",type:"object",required:["marktype","encoding","data"],properties:{data:X,marktype:r.marktype,encoding:{type:"object",properties:{x:E,y:R,row:j,col:Y,size:F,color:P,shape:z,text:H,detail:I}},config:q}},r.encTypes=a.keys(r.schema.properties.encoding.properties),r.instantiate=function(){return r.util.instantiate(r.schema)}},{"../globals":71,"../util":75,"./schemautil":74,colorbrewer:3,"vega/src/transforms/Aggregate":50}],74:[function(e,t,n){"use strict";function r(e,t){if("object"!=typeof t||null===t)return e;for(var n in t)t.hasOwnProperty(n)&&void 0!==t[n]&&("object"!=typeof t[n]||null===t[n]?e[n]=t[n]:"object"!=typeof e[n]||null===e[n]?e[n]=r(t[n].constructor===Array?[]:{},t[n]):r(e[n],t[n]));return e}var a=t.exports={},i=e("../util"),o=function(e){return 0===Object.keys(e).length};a.extend=function(e,t){return a.merge(a.instantiate(t),e)},a.instantiate=function(e){var t;if(void 0===e)return void 0;if("default"in e)return t=e["default"],i.isObject(t)?i.duplicate(t):t;if("object"===e.type){var n={};for(var r in e.properties)t=a.instantiate(e.properties[r]),void 0!==t&&(n[r]=t);return n}return"array"===e.type?[]:void 0},a.subtract=function(e,t){var n={};for(var r in e){var s=t[r],u=e[r];if(!t||s!==u)if("object"==typeof u&&!i.isArray(u)&&s){var c=a.subtract(u,s);o(c)||(n[r]=c)}else(!i.isArray(u)||u.length>0)&&(n[r]=u)}return n},a.merge=function(){for(var e=arguments[0],t=1;t180||-180>n?n-360*Math.round(n/360):n}function n(){}function r(e){var t;return e=(e+"").trim().toLowerCase(),(t=D.exec(e))?(t=parseInt(t[1],16),i(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t)):(t=O.exec(e))?a(parseInt(t[1],16)):(t=A.exec(e))?i(t[1],t[2],t[3]):(t=E.exec(e))?i(2.55*t[1],2.55*t[2],2.55*t[3]):(t=N.exec(e))?u(t[1],.01*t[2],.01*t[3]):R.hasOwnProperty(e)?a(R[e]):null}function a(e){return i(e>>16&255,e>>8&255,255&e)}function i(e,t,a){return 1===arguments.length&&(e instanceof n||(e=r(e)),e?(e=e.rgb(),a=e.b,t=e.g,e=e.r):e=t=a=NaN),new o(e,t,a)}function o(e,t,n){this.r=+e,this.g=+t,this.b=+n}function s(e,t,n){return"#"+(isNaN(e)?"00":(e=Math.round(e))<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16))+(isNaN(t)?"00":(t=Math.round(t))<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16))+(isNaN(n)?"00":(n=Math.round(n))<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16))}function u(e,t,a){if(1===arguments.length)if(e instanceof c)a=e.l,t=e.s,e=e.h;else if(e instanceof n||(e=r(e)),e){if(e instanceof c)return e;e=e.rgb();var i=e.r/255,o=e.g/255,s=e.b/255,u=Math.min(i,o,s),f=Math.max(i,o,s),l=f-u;a=(f+u)/2,l?(t=.5>a?l/(f+u):l/(2-f-u),e=i===f?(o-s)/l+6*(s>o):o===f?(s-i)/l+2:(i-o)/l+4,e*=60):(e=NaN,t=a>0&&1>a?0:e)}else e=t=a=NaN;return new c(e,t,a)}function c(e,t,n){this.h=+e,this.s=+t,this.l=+n}function f(e,t,n){return 255*(60>e?t+(n-t)*e/60:180>e?n:240>e?t+(n-t)*(240-e)/60:t)}function l(e,t,n){if(1===arguments.length)if(e instanceof d)n=e.b,t=e.a,e=e.l;else if(e instanceof y){var r=e.h*G;n=Math.sin(r)*e.c,t=Math.cos(r)*e.c,e=e.l}else{e instanceof o||(e=i(e));var a=g(e.r),s=g(e.g),n=g(e.b),u=h((.4124564*a+.3575761*s+.1804375*n)/z),c=h((.2126729*a+.7151522*s+.072175*n)/I),f=h((.0193339*a+.119192*s+.9503041*n)/H);n=200*(c-f),t=500*(u-c),e=116*c-16}return new d(e,t,n)}function d(e,t,n){this.l=+e,this.a=+t,this.b=+n}function h(e){return e>B?Math.pow(e,1/3):e/W+X}function p(e){return e>q?e*e*e:W*(e-X)}function m(e){return 255*(.0031308>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function g(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function b(e,t,n){return 1===arguments.length&&(e instanceof y?(n=e.l,t=e.c,e=e.h):(e instanceof d||(e=l(e)),n=e.l,t=Math.sqrt(e.a*e.a+e.b*e.b),e=Math.atan2(e.b,e.a)*J,0>e&&(e+=360))),new y(e,t,n)}function y(e,t,n){this.h=+e,this.c=+t,this.l=+n}function v(e,t,n){if(1===arguments.length)if(e instanceof x)n=e.l,t=e.s,e=e.h;else{e instanceof o||(e=i(e));var r=e.r/255,a=e.g/255,s=e.b/255;n=(ae*s+ne*r-re*a)/(ae+ne-re);var u=s-n,c=(te*(a-n)-K*u)/ee;t=Math.sqrt(c*c+u*u)/(te*n*(1-n)),e=t?Math.atan2(c,u)*J-120:NaN,0>e&&(e+=360)}return new x(e,t,n)}function x(e,t,n){this.h=+e,this.s=+t,this.l=+n}function w(e){return function(n,r){n=v(n),r=v(r);var a=isNaN(n.h)?r.h:n.h,i=isNaN(n.s)?r.s:n.s,o=n.l,s=isNaN(r.h)?0:t(r.h,a),u=isNaN(r.s)?0:r.s-i,c=r.l-o;return function(t){return n.h=a+s*t,n.s=i+u*t,n.l=o+c*Math.pow(t,e),n+""}}}function _(e){return function(t,n){t=v(t),n=v(n);var r=isNaN(t.h)?n.h:t.h,a=isNaN(t.s)?n.s:t.s,i=t.l,o=isNaN(n.h)?0:n.h-r,s=isNaN(n.s)?0:n.s-a,u=n.l-i;return function(n){return t.h=r+o*n,t.s=a+s*n,t.l=i+u*Math.pow(n,e),t+""}}}function M(e,t){e=b(e),t=b(t);var n=isNaN(e.h)?t.h:e.h,r=isNaN(e.c)?t.c:e.c,a=e.l,i=isNaN(t.h)?0:t.h-n,o=isNaN(t.c)?0:t.c-r,s=t.l-a;return function(t){return e.h=n+i*t,e.c=r+o*t,e.l=a+s*t,e+""}}function S(e,n){e=b(e),n=b(n);var r=isNaN(e.h)?n.h:e.h,a=isNaN(e.c)?n.c:e.c,i=e.l,o=isNaN(n.h)?0:t(n.h,r),s=isNaN(n.c)?0:n.c-a,u=n.l-i;return function(t){return e.h=r+o*t,e.c=a+s*t,e.l=i+u*t,e+""}}function k(e,t){e=l(e),t=l(t);var n=e.l,r=e.a,a=e.b,i=t.l-n,o=t.a-r,s=t.b-a;return function(t){return e.l=n+i*t,e.a=r+o*t,e.b=a+s*t,e+""}}function T(e,t){e=u(e),t=u(t);var n=isNaN(e.h)?t.h:e.h,r=isNaN(e.s)?t.s:e.s,a=e.l,i=isNaN(t.h)?0:t.h-n,o=isNaN(t.s)?0:t.s-r,s=t.l-a;return function(t){return e.h=n+i*t,e.s=r+o*t,e.l=a+s*t,e+""}}function L(e,n){e=u(e),n=u(n);var r=isNaN(e.h)?n.h:e.h,a=isNaN(e.s)?n.s:e.s,i=e.l,o=isNaN(n.h)?0:t(n.h,r),s=isNaN(n.s)?0:n.s-a,c=n.l-i;return function(t){return e.h=r+o*t,e.s=a+s*t,e.l=i+c*t,e+""}}function C(e,t){e=i(e),t=i(t);var n=e.r,r=e.g,a=e.b,o=t.r-n,u=t.g-r,c=t.b-a;return function(e){return s(Math.round(n+o*e),Math.round(r+u*e),Math.round(a+c*e))}}var D=/^#([0-9a-f]{3})$/,O=/^#([0-9a-f]{6})$/,A=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,E=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,N=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;r.prototype=n.prototype={displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}};var R={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},U=.7,j=1/U,Y=i.prototype=o.prototype=new n;Y.brighter=function(e){return e=null==e?j:Math.pow(j,e),new o(this.r*e,this.g*e,this.b*e)},Y.darker=function(e){return e=null==e?U:Math.pow(U,e),new o(this.r*e,this.g*e,this.b*e)},Y.rgb=function(){return this},Y.displayable=function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255},Y.toString=function(){return s(this.r,this.g,this.b)};var F=u.prototype=c.prototype=new n;F.brighter=function(e){return e=null==e?j:Math.pow(j,e),new c(this.h,this.s,this.l*e)},F.darker=function(e){return e=null==e?U:Math.pow(U,e),new c(this.h,this.s,this.l*e)},F.rgb=function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(.5>n?n:1-n)*t,a=2*n-r;return new o(f(e>=240?e-240:e+120,a,r),f(e,a,r),f(120>e?e+240:e-120,a,r))},F.displayable=function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1};var P=18,z=.95047,I=1,H=1.08883,X=4/29,q=6/29,W=3*q*q,B=q*q*q,$=l.prototype=d.prototype=new n;$.brighter=function(e){return new d(this.l+P*(null==e?1:e),this.a,this.b)},$.darker=function(e){return new d(this.l-P*(null==e?1:e),this.a,this.b)},$.rgb=function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return e=I*p(e),t=z*p(t),n=H*p(n),new o(m(3.2404542*t-1.5371385*e-.4985314*n),m(-.969266*t+1.8760108*e+.041556*n),m(.0556434*t-.2040259*e+1.0572252*n))};var G=Math.PI/180,J=180/Math.PI,V=b.prototype=y.prototype=new n;V.brighter=function(e){return new y(this.h,this.c,this.l+P*(null==e?1:e))},V.darker=function(e){return new y(this.h,this.c,this.l-P*(null==e?1:e))},V.rgb=function(){return l(this).rgb()};var Z=-.14861,Q=1.78277,K=-.29227,ee=-.90649,te=1.97294,ne=te*ee,re=te*Q,ae=Q*K-ee*Z,ie=v.prototype=x.prototype=new n;ie.brighter=function(e){return e=null==e?j:Math.pow(j,e),new x(this.h,this.s,this.l*e)},ie.darker=function(e){return e=null==e?U:Math.pow(U,e),new x(this.h,this.s,this.l*e)},ie.rgb=function(){var e=isNaN(this.h)?0:(this.h+120)*G,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new o(255*(t+n*(Z*r+Q*a)),255*(t+n*(K*r+ee*a)),255*(t+n*(te*r)))};var oe=w(1),se=_(1);e.interpolateCubehelix=oe,e.interpolateCubehelixLong=se,e.color=r,e.rgb=i,e.hsl=u,e.lab=l,e.hcl=b,e.cubehelix=v,e.interpolateRgb=C,e.interpolateHsl=L,e.interpolateHslLong=T,e.interpolateLab=k,e.interpolateHcl=S,e.interpolateHclLong=M,e.interpolateCubehelixGamma=w,e.interpolateCubehelixGammaLong=_})},{}],5:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.format={})}(this,function(e){"use strict";function t(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function n(e){return e=t(Math.abs(e)),e?e[1]:NaN}function r(e,n){var r=t(e,n);if(!r)return e+"";var a=r[0],i=r[1],o=i-(m=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,s=a.length;return o===s?a:o>s?a+new Array(o-s+1).join("0"):o>0?a.slice(0,o)+"."+a.slice(o):"0."+new Array(1-o).join("0")+t(e,n+o-1)[0]}function a(e,n){var r=t(e,n);if(!r)return e+"";var a=r[0],i=r[1];return 0>i?"0."+new Array(-i).join("0")+a:a.length>i+1?a.slice(0,i+1)+"."+a.slice(i+1):a+new Array(i-a.length+2).join("0")}function i(e,t){e=e.toPrecision(t);e:for(var n,r=e.length,a=1,i=-1;r>a;++a)switch(e[a]){case".":i=n=a;break;case"0":0===i&&(i=a),n=a;break;case"e":break e;default:i>0&&(i=0)}return i>0?e.slice(0,i)+e.slice(n+1):e}function o(e){return new s(e)}function s(e){if(!(t=U.exec(e)))throw new Error("invalid format: "+e);var t,n=t[1]||" ",r=t[2]||">",a=t[3]||"-",i=t[4]||"",o=!!t[5],s=t[6]&&+t[6],u=!!t[7],c=t[8]&&+t[8].slice(1),f=t[9]||"";"n"===f?(u=!0,f="g"):R[f]||(f=""),(o||"0"===n&&"="===r)&&(o=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=a,this.symbol=i,this.zero=o,this.width=s,this.comma=u,this.precision=c,this.type=f}function u(e,t){return function(n,r){for(var a=n.length,i=[],o=0,s=e[0],u=0;a>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),i.push(n.substring(a-=s,a+s)),!((u+=s+1)>r));)s=e[o=(o+1)%e.length];return i.reverse().join(t)}}function c(e){return e}function f(e){function t(e){e=o(e);var t=e.fill,n=e.align,r=e.sign,u=e.symbol,c=e.zero,f=e.width,l=e.comma,d=e.precision,h=e.type,p="$"===u?i[0]:"#"===u&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",g="$"===u?i[1]:/[%p]/.test(h)?"%":"",b=R[h],y=!h||/[defgprs%]/.test(h);return d=null==d?h?6:12:/[gprs]/.test(h)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),function(e){var i=p,o=g;if("c"===h)o=b(e)+o,e="";else{e=+e;var u=(0>e||0>1/e)&&(e*=-1,!0);if(e=b(e,d),i=(u?"("===r?r:"-":"-"===r||"("===r?"":r)+i, +o=o+("s"===h?j[8+m/3]:"")+(u&&"("===r?")":""),y)for(var v,x=-1,w=e.length;++xv||v>57){o=(46===v?s+e.slice(x+1):e.slice(x))+o,e=e.slice(0,x);break}}l&&!c&&(e=a(e,1/0));var _=i.length+e.length+o.length,M=f>_?new Array(f-_+1).join(t):"";switch(l&&c&&(e=a(M+e,M.length?f-o.length:1/0),M=""),n){case"<":return i+e+o+M;case"=":return i+M+e+o;case"^":return M.slice(0,_=M.length>>1)+i+e+o+M.slice(_)}return M+i+e+o}}function r(e,r){var a=t((e=o(e),e.type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(n(r)/3))),s=Math.pow(10,-i),u=j[8+i/3];return function(e){return a(s*e)+u}}var a=e.grouping&&e.thousands?u(e.grouping,e.thousands):c,i=e.currency,s=e.decimal;return{format:t,formatPrefix:r}}function l(e,t){return Math.max(0,n(Math.abs(t))-n(Math.abs(e)))+1}function d(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(t)/3)))-n(Math.abs(e)))}function h(e){return Math.max(0,-n(Math.abs(e)))}function p(e){return"string"!=typeof e||(e=Y.get(e))?f(e):null}var m,g={decimal:".",thousands:",",grouping:[3],currency:["¥",""]},b={decimal:",",thousands:" ",grouping:[3],currency:[""," руб."]},y={decimal:",",thousands:".",grouping:[3],currency:["R$",""]},v={decimal:",",thousands:".",grouping:[3],currency:["","zł"]},x={decimal:",",thousands:".",grouping:[3],currency:["€ ",""]},w={decimal:",",thousands:".",grouping:[3],currency:[""," ден."]},_={decimal:".",thousands:",",grouping:[3],currency:["","円"]},M={decimal:",",thousands:".",grouping:[3],currency:["€",""]},S={decimal:".",thousands:",",grouping:[3],currency:["₪",""]},k={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},T={decimal:",",thousands:" ",grouping:[3],currency:["","$"]},L={decimal:",",thousands:" ",grouping:[3],currency:[""," €"]},C={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},D={decimal:".",thousands:",",grouping:[3],currency:["$",""]},O={decimal:".",thousands:",",grouping:[3],currency:["£",""]},A={decimal:".",thousands:",",grouping:[3],currency:["$",""]},E={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},N={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},R={"":i,"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return a(100*e,t)},r:a,s:r,X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},U=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;s.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var j=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Y=(new Map).set("ca-ES",N).set("de-DE",E).set("en-CA",A).set("en-GB",O).set("en-US",D).set("es-ES",C).set("fi-FI",L).set("fr-CA",T).set("fr-FR",k).set("he-IL",S).set("it-IT",M).set("ja-JP",_).set("mk-MK",w).set("nl-NL",x).set("pl-PL",v).set("pt-BR",y).set("ru-RU",b).set("zh-CN",g),F=f(D);e.format=F.format,e.formatPrefix=F.formatPrefix,e.localeFormat=p,e.formatSpecifier=o,e.precisionFixed=h,e.precisionPrefix=d,e.precisionRound=l})},{}],6:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.timeFormat={})}(this,function(e){"use strict";function t(e,n,r){function a(t){return e(t=new Date(+t)),t}return a.floor=a,a.round=function(t){var r=new Date(+t),a=new Date(t-1);return e(r),e(a),n(a,1),a-t>t-r?r:a},a.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},a.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},a.range=function(t,r,a){var i=[];if(t=new Date(t-1),r=new Date(+r),a=null==a?1:Math.floor(a),!(r>t&&a>0))return i;for(n(t,1),e(t),r>t&&i.push(new Date(+t));n(t,a),e(t),r>t;)i.push(new Date(+t));return i},a.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(a.count=function(t,n){return xe.setTime(+t),we.setTime(+n),e(xe),e(we),Math.floor(r(xe,we))}),a}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}function a(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function i(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function o(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function s(e){function t(e,t){return function(n){for(var r,a,i,o=[],s=-1,u=0,c=e.length;++so;){if(r>=u)return-1;if(a=t.charCodeAt(o++),37===a){if(a=t.charAt(o++),i=je[a in Oe?t.charAt(o++):a],!i||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function s(e,t,n){var r=Le.exec(t.slice(n));return r?(e.w=Ce.get(r[0].toLowerCase()),n+r[0].length):-1}function u(e,t,n){var r=ke.exec(t.slice(n));return r?(e.w=Te.get(r[0].toLowerCase()),n+r[0].length):-1}function c(e,t,n){var r=Ee.exec(t.slice(n));return r?(e.m=Ne.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,t,n){var r=De.exec(t.slice(n));return r?(e.m=Ae.get(r[0].toLowerCase()),n+r[0].length):-1}function ne(e,t,n){return r(e,ge,t,n)}function re(e,t,n){return r(e,be,t,n)}function ae(e,t,n){return r(e,ye,t,n)}function ie(e,t,n){var r=Se.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}function oe(e){return we[e.getDay()]}function se(e){return xe[e.getDay()]}function ue(e){return Me[e.getMonth()]}function ce(e){return _e[e.getMonth()]}function fe(e){return ve[+(e.getHours()>=12)]}function le(e){return we[e.getUTCDay()]}function de(e){return xe[e.getUTCDay()]}function he(e){return Me[e.getUTCMonth()]}function pe(e){return _e[e.getUTCMonth()]}function me(e){return ve[+(e.getUTCHours()>=12)]}var ge=e.dateTime,be=e.date,ye=e.time,ve=e.periods,xe=e.days,we=e.shortDays,_e=e.months,Me=e.shortMonths,Se=l(ve),ke=f(xe),Te=l(xe),Le=f(we),Ce=l(we),De=f(_e),Ae=l(_e),Ee=f(Me),Ne=l(Me),Re={a:oe,A:se,b:ue,B:ce,c:null,d:T,e:T,H:L,I:C,j:D,L:O,m:A,M:E,p:fe,S:N,U:R,w:U,W:j,x:null,X:null,y:Y,Y:F,Z:P,"%":ee},Ue={a:le,A:de,b:he,B:pe,c:null,d:z,e:z,H:I,I:H,j:X,L:q,m:W,M:B,p:me,S:$,U:G,w:J,W:V,x:null,X:null,y:Z,Y:Q,Z:K,"%":ee},je={a:s,A:u,b:c,B:te,c:ne,d:v,e:v,H:w,I:w,j:x,L:S,m:y,M:_,p:ie,S:M,U:h,w:d,W:p,x:re,X:ae,y:g,Y:m,Z:b,"%":k};return Re.x=t(be,Re),Re.X=t(ye,Re),Re.c=t(ge,Re),Ue.x=t(be,Ue),Ue.X=t(ye,Ue),Ue.c=t(ge,Ue),{format:function(e){var r=t(e+="",Re);return r.parse=n(e,a),r.toString=function(){return e},r},utcFormat:function(e){var r=t(e+="",Ue);return r.parse=n(e,i),r.toString=function(){return e},r}}}function u(e,t,n){var r=0>e?"-":"",a=(r?-e:e)+"",i=a.length;return r+(n>i?new Array(n-i+1).join(t)+a:a)}function c(e){return e.replace(Ne,"\\$&")}function f(e){return new RegExp("^(?:"+e.map(c).join("|")+")","i")}function l(e){for(var t=new Map,n=-1,r=e.length;++n68?1900:2e3),n+r[0].length):-1}function b(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function y(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function v(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function x(e,t,n){var r=Ae.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function w(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function _(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function M(e,t,n){var r=Ae.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function S(e,t,n){var r=Ae.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function k(e,t,n){var r=Ee.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function T(e,t){return u(e.getDate(),t,2)}function L(e,t){return u(e.getHours(),t,2)}function C(e,t){return u(e.getHours()%12||12,t,2)}function D(e,t){return u(1+_e.count(ke(e),e),t,3)}function O(e,t){return u(e.getMilliseconds(),t,3)}function A(e,t){return u(e.getMonth()+1,t,2)}function E(e,t){return u(e.getMinutes(),t,2)}function N(e,t){return u(e.getSeconds(),t,2)}function R(e,t){return u(Me.count(ke(e),e),t,2)}function U(e){return e.getDay()}function j(e,t){return u(Se.count(ke(e),e),t,2)}function Y(e,t){return u(e.getFullYear()%100,t,2)}function F(e,t){return u(e.getFullYear()%1e4,t,4)}function P(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+u(t/60|0,"0",2)+u(t%60,"0",2)}function z(e,t){return u(e.getUTCDate(),t,2)}function I(e,t){return u(e.getUTCHours(),t,2)}function H(e,t){return u(e.getUTCHours()%12||12,t,2)}function X(e,t){return u(1+Te.count(De(e),e),t,3)}function q(e,t){return u(e.getUTCMilliseconds(),t,3)}function W(e,t){return u(e.getUTCMonth()+1,t,2)}function B(e,t){return u(e.getUTCMinutes(),t,2)}function $(e,t){return u(e.getUTCSeconds(),t,2)}function G(e,t){return u(Le.count(De(e),e),t,2)}function J(e){return e.getUTCDay()}function V(e,t){return u(Ce.count(De(e),e),t,2)}function Z(e,t){return u(e.getUTCFullYear()%100,t,2)}function Q(e,t){return u(e.getUTCFullYear()%1e4,t,4)}function K(){return"+0000"}function ee(){return"%"}function te(e){return e.toISOString()}function ne(e){return"string"!=typeof e||(e=Ye.get(e))?s(e):null}var re={dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},ae={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]},ie={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"]},oe={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."]},se={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"]},ue={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]},ce={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"]},fe={dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]},le={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."]},de={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"]},he={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"]},pe={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"]},me={dateTime:"%a %b %e %X %Y",date:"%m/%d/%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"]},ge={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"]},be={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"]},ye={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"]},ve={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."]},xe=new Date,we=new Date,_e=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),Me=n(0),Se=n(1),ke=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()}),Te=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5}),Le=r(0),Ce=r(1),De=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),Oe={"-":"",_:" ",0:"0"},Ae=/^\s*\d+/,Ee=/^%/,Ne=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Re="%Y-%m-%dT%H:%M:%S.%LZ";te.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},te.toString=function(){return Re};var Ue=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?te:me.utcFormat(Re),je=Ue,Ye=(new Map).set("ca-ES",ve).set("de-DE",ye).set("en-CA",be).set("en-GB",ge).set("en-US",me).set("es-ES",pe).set("fi-FI",he).set("fr-CA",de).set("fr-FR",le).set("he-IL",fe).set("it-IT",ce).set("mk-MK",ue).set("nl-NL",se).set("pl-PL",oe).set("pt-BR",ie).set("ru-RU",ae).set("zh-CN",re),Fe=s(me);e.format=Fe.format,e.utcFormat=Fe.utcFormat,e.localeFormat=ne,e.isoFormat=je})},{}],7:[function(t,n,r){!function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.dsv={})}(this,function(e){"use strict";var t=function(e){function t(e,t){var r;return n(e,function(e,n){if(r)return r(e,n-1);var a=new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}");r=t?function(e,n){return t(a(e),n)}:a})}function n(e,t){function n(){if(f>=c)return o;if(a)return a=!1,i;var t=f;if(34===e.charCodeAt(t)){for(var n=t;n++f;){var r=e.charCodeAt(f++),s=1;if(10===r)a=!0;else if(13===r)a=!0,10===e.charCodeAt(f)&&(++f,++s);else if(r!==u)continue;return e.slice(t,f-s)}return e.slice(t)}for(var r,a,i={},o={},s=[],c=e.length,f=0,l=0;(r=n())!==o;){for(var d=[];r!==i&&r!==o;)d.push(r),r=n();t&&null==(d=t(d,l++))||s.push(d)}return s}function r(t){if(Array.isArray(t[0]))return a(t);var n=Object.create(null),r=[];return t.forEach(function(e){for(var t in e)(t+="")in n||r.push(n[t]=t)}),[r.map(o).join(e)].concat(t.map(function(t){return r.map(function(e){return o(t[e])}).join(e)})).join("\n")}function a(e){return e.map(i).join("\n")}function i(t){return t.map(o).join(e)}function o(e){return s.test(e)?'"'+e.replace(/\"/g,'""')+'"':e}var s=new RegExp('["'+e+"\n]"),u=e.charCodeAt(0);return{parse:t,parseRows:n,format:r,formatRows:a}};e.csv=t(","),e.tsv=t(" "),e.dsv=t})},{}],8:[function(t,n,r){"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(e,t){return this._[e]=t,this},get:function(e){return this._[e]},has:function(e){return e in this._},"delete":function(e){return e in this._&&delete this._[e]},clear:function(){this._=Object.create(null)},get size(){var e=0;for(var t in this._)++e;return e},forEach:function(e){for(var t in this._)e(this._[t],t,this)}}):function(){var e=new Map;e.set(0,0)!==e&&(e=e.set,Map.prototype.set=function(){return e.apply(this,arguments),this})}(),function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.timeFormat={})}(this,function(e){"use strict";function t(e,n,r){function a(t){return e(t=new Date(+t)),t}return a.floor=a,a.round=function(t){var r=new Date(+t),a=new Date(t-1);return e(r),e(a),n(a,1),a-t>t-r?r:a},a.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},a.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},a.range=function(t,r,a){var i=[];if(t=new Date(t-1),r=new Date(+r),a=null==a?1:Math.floor(a),!(r>t&&a>0))return i;for(n(t,1),e(t),r>t&&i.push(new Date(+t));n(t,a),e(t),r>t;)i.push(new Date(+t));return i},a.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(a.count=function(t,n){return we.setTime(+t),_e.setTime(+n),e(we),e(_e),Math.floor(r(we,_e))}),a}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}function a(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function i(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function o(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function s(e){function t(e,t){return function(n){for(var r,a,i,o=[],s=-1,u=0,c=e.length;++so;){if(r>=u)return-1;if(a=t.charCodeAt(o++),37===a){if(a=t.charAt(o++),i=je[a in Ae?t.charAt(o++):a],!i||(r=i(e,n,r))<0)return-1}else if(a!=n.charCodeAt(r++))return-1}return r}function s(e,t,n){var r=Le.exec(t.slice(n));return r?(e.w=Ce.get(r[0].toLowerCase()),n+r[0].length):-1}function u(e,t,n){var r=ke.exec(t.slice(n));return r?(e.w=Te.get(r[0].toLowerCase()),n+r[0].length):-1}function c(e,t,n){var r=Ee.exec(t.slice(n));return r?(e.m=Ne.get(r[0].toLowerCase()),n+r[0].length):-1}function te(e,t,n){var r=De.exec(t.slice(n));return r?(e.m=Oe.get(r[0].toLowerCase()),n+r[0].length):-1}function ne(e,t,n){return r(e,ge,t,n)}function re(e,t,n){return r(e,be,t,n)}function ae(e,t,n){return r(e,ye,t,n)}function ie(e,t,n){var r=Se.get(t.slice(n,n+=2).toLowerCase());return null==r?-1:(e.p=r,n)}function oe(e){return we[e.getDay()]}function se(e){return xe[e.getDay()]}function ue(e){return Me[e.getMonth()]}function ce(e){return _e[e.getMonth()]}function fe(e){return ve[+(e.getHours()>=12)]}function le(e){return we[e.getUTCDay()]}function de(e){return xe[e.getUTCDay()]}function he(e){return Me[e.getUTCMonth()]}function pe(e){return _e[e.getUTCMonth()]}function me(e){return ve[+(e.getUTCHours()>=12)]}var ge=e.dateTime,be=e.date,ye=e.time,ve=e.periods,xe=e.days,we=e.shortDays,_e=e.months,Me=e.shortMonths,Se=l(ve),ke=f(xe),Te=l(xe),Le=f(we),Ce=l(we),De=f(_e),Oe=l(_e),Ee=f(Me),Ne=l(Me),Re={a:oe,A:se,b:ue,B:ce,c:null,d:T,e:T,H:L,I:C,j:D,L:O,m:A,M:E,p:fe,S:N,U:R,w:U,W:j,x:null,X:null,y:Y,Y:F,Z:P,"%":ee},Ue={a:le,A:de,b:he,B:pe,c:null,d:z,e:z,H:I,I:H,j:X,L:q,m:W,M:B,p:me,S:$,U:G,w:J,W:V,x:null,X:null,y:Z,Y:Q,Z:K,"%":ee},je={a:s,A:u,b:c,B:te,c:ne,d:v,e:v,H:w,I:w,j:x,L:S,m:y,M:_,p:ie,S:M,U:h,w:d,W:p,x:re,X:ae,y:g,Y:m,Z:b,"%":k};return Re.x=t(be,Re),Re.X=t(ye,Re),Re.c=t(ge,Re),Ue.x=t(be,Ue),Ue.X=t(ye,Ue),Ue.c=t(ge,Ue),{format:function(e){var r=t(e+="",Re);return r.parse=n(e,a),r.toString=function(){return e},r},utcFormat:function(e){var r=t(e+="",Ue);return r.parse=n(e,i),r.toString=function(){return e},r}}}function u(e,t,n){var r=0>e?"-":"",a=(r?-e:e)+"",i=a.length;return r+(n>i?new Array(n-i+1).join(t)+a:a)}function c(e){return e.replace(Re,"\\$&")}function f(e){return new RegExp("^(?:"+e.map(c).join("|")+")","i")}function l(e){for(var t=new Map,n=-1,r=e.length;++n68?1900:2e3),n+r[0].length):-1}function b(e,t,n){return/^[+-]\d{4}$/.test(t=t.slice(n,n+5))?(e.Z=-t,n+5):-1}function y(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function v(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function x(e,t,n){var r=Ee.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function w(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function _(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function M(e,t,n){var r=Ee.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function S(e,t,n){var r=Ee.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function k(e,t,n){var r=Ne.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function T(e,t){return u(e.getDate(),t,2)}function L(e,t){return u(e.getHours(),t,2)}function C(e,t){return u(e.getHours()%12||12,t,2)}function D(e,t){return u(1+Me.count(Te(e),e),t,3)}function O(e,t){return u(e.getMilliseconds(),t,3)}function A(e,t){return u(e.getMonth()+1,t,2)}function E(e,t){return u(e.getMinutes(),t,2)}function N(e,t){return u(e.getSeconds(),t,2)}function R(e,t){return u(Se.count(Te(e),e),t,2)}function U(e){return e.getDay()}function j(e,t){return u(ke.count(Te(e),e),t,2)}function Y(e,t){return u(e.getFullYear()%100,t,2)}function F(e,t){return u(e.getFullYear()%1e4,t,4)}function P(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+u(t/60|0,"0",2)+u(t%60,"0",2)}function z(e,t){return u(e.getUTCDate(),t,2)}function I(e,t){return u(e.getUTCHours(),t,2)}function H(e,t){return u(e.getUTCHours()%12||12,t,2)}function X(e,t){return u(1+Le.count(Oe(e),e),t,3)}function q(e,t){return u(e.getUTCMilliseconds(),t,3)}function W(e,t){return u(e.getUTCMonth()+1,t,2)}function B(e,t){return u(e.getUTCMinutes(),t,2)}function $(e,t){return u(e.getUTCSeconds(),t,2)}function G(e,t){return u(Ce.count(Oe(e),e),t,2)}function J(e){return e.getUTCDay()}function V(e,t){return u(De.count(Oe(e),e),t,2)}function Z(e,t){return u(e.getUTCFullYear()%100,t,2)}function Q(e,t){return u(e.getUTCFullYear()%1e4,t,4)}function K(){return"+0000"}function ee(){return"%"}function te(e){return e.toISOString()}function ne(e){return"string"!=typeof e||(e=Fe.get(e))?s(e):null}var re={dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},ae={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]},ie={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"]},oe={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."]},se={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"]},ue={dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"] +},ce={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月"]},fe={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"]},le={dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]},de={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."]},he={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"]},pe={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"]},me={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"]},ge={dateTime:"%a %b %e %X %Y",date:"%m/%d/%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"]},be={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"]},ye={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"]},ve={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"]},xe={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."]},we=new Date,_e=new Date,Me=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5}),Se=n(0),ke=n(1),Te=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()}),Le=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5}),Ce=r(0),De=r(1),Oe=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),Ae={"-":"",_:" ",0:"0"},Ee=/^\s*\d+/,Ne=/^%/,Re=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Ue="%Y-%m-%dT%H:%M:%S.%LZ";te.parse=function(e){var t=new Date(e);return isNaN(t)?null:t},te.toString=function(){return Ue};var je=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?te:ge.utcFormat(Ue),Ye=je,Fe=(new Map).set("ca-ES",xe).set("de-DE",ve).set("en-CA",ye).set("en-GB",be).set("en-US",ge).set("es-ES",me).set("fi-FI",pe).set("fr-CA",he).set("fr-FR",de).set("he-IL",le).set("it-IT",fe).set("ja-JP",ce).set("mk-MK",ue).set("nl-NL",se).set("pl-PL",oe).set("pt-BR",ie).set("ru-RU",ae).set("zh-CN",re),Pe=s(ge);e.format=Pe.format,e.utcFormat=Pe.utcFormat,e.localeFormat=ne,e.isoFormat=Ye})},{}],9:[function(t,n,r){!function(t,a){"object"==typeof r&&"undefined"!=typeof n?a(r):"function"==typeof e&&e.amd?e(["exports"],a):a(t.time={})}(this,function(e){"use strict";function t(e,n,r){function o(t){return e(t=new Date(+t)),t}return o.floor=o,o.round=function(t){var r=new Date(+t),a=new Date(t-1);return e(r),e(a),n(a,1),a-t>t-r?r:a},o.ceil=function(t){return e(t=new Date(t-1)),n(t,1),t},o.offset=function(e,t){return n(e=new Date(+e),null==t?1:Math.floor(t)),e},o.range=function(t,r,a){var i=[];if(t=new Date(t-1),r=new Date(+r),a=null==a?1:Math.floor(a),!(r>t&&a>0))return i;for(n(t,1),e(t),r>t&&i.push(new Date(+t));n(t,a),e(t),r>t;)i.push(new Date(+t));return i},o.filter=function(r){return t(function(t){for(;e(t),!r(t);)t.setTime(t-1)},function(e,t){for(;--t>=0;)for(;n(e,1),!r(e););})},r&&(o.count=function(t,n){return i.setTime(+t),a.setTime(+n),e(i),e(a),Math.floor(r(i,a))}),o}function n(e){return t(function(t){t.setHours(0,0,0,0),t.setDate(t.getDate()-(t.getDay()+7-e)%7)},function(e,t){e.setDate(e.getDate()+7*t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/6048e5})}function r(e){return t(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7)},function(e,t){e.setUTCDate(e.getUTCDate()+7*t)},function(e,t){return(t-e)/6048e5})}var a=new Date,i=new Date,o=t(function(e){e.setMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3});e.seconds=o.range;var s=t(function(e){e.setSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4});e.minutes=s.range;var u=t(function(e){e.setMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5});e.hours=u.range;var c=t(function(e){e.setHours(0,0,0,0)},function(e,t){e.setDate(e.getDate()+t)},function(e,t){return(t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5});e.days=c.range,e.sunday=n(0),e.sundays=e.sunday.range,e.monday=n(1),e.mondays=e.monday.range,e.tuesday=n(2),e.tuesdays=e.tuesday.range,e.wednesday=n(3),e.wednesdays=e.wednesday.range,e.thursday=n(4),e.thursdays=e.thursday.range,e.friday=n(5),e.fridays=e.friday.range,e.saturday=n(6),e.saturdays=e.saturday.range;var f=e.sunday;e.weeks=f.range;var l=t(function(e){e.setHours(0,0,0,0),e.setDate(1)},function(e,t){e.setMonth(e.getMonth()+t)},function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())});e.months=l.range;var d=t(function(e){e.setHours(0,0,0,0),e.setMonth(0,1)},function(e,t){e.setFullYear(e.getFullYear()+t)},function(e,t){return t.getFullYear()-e.getFullYear()});e.years=d.range;var h=t(function(e){e.setUTCMilliseconds(0)},function(e,t){e.setTime(+e+1e3*t)},function(e,t){return(t-e)/1e3});e.utcSeconds=h.range;var p=t(function(e){e.setUTCSeconds(0,0)},function(e,t){e.setTime(+e+6e4*t)},function(e,t){return(t-e)/6e4});e.utcMinutes=p.range;var m=t(function(e){e.setUTCMinutes(0,0,0)},function(e,t){e.setTime(+e+36e5*t)},function(e,t){return(t-e)/36e5});e.utcHours=m.range;var g=t(function(e){e.setUTCHours(0,0,0,0)},function(e,t){e.setUTCDate(e.getUTCDate()+t)},function(e,t){return(t-e)/864e5});e.utcDays=g.range,e.utcSunday=r(0),e.utcSundays=e.utcSunday.range,e.utcMonday=r(1),e.utcMondays=e.utcMonday.range,e.utcTuesday=r(2),e.utcTuesdays=e.utcTuesday.range,e.utcWednesday=r(3),e.utcWednesdays=e.utcWednesday.range,e.utcThursday=r(4),e.utcThursdays=e.utcThursday.range,e.utcFriday=r(5),e.utcFridays=e.utcFriday.range,e.utcSaturday=r(6),e.utcSaturdays=e.utcSaturday.range;var b=e.utcSunday;e.utcWeeks=b.range;var y=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(1)},function(e,t){e.setUTCMonth(e.getUTCMonth()+t)},function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())});e.utcMonths=y.range;var v=t(function(e){e.setUTCHours(0,0,0,0),e.setUTCMonth(0,1)},function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)},function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()});e.utcYears=v.range,e.interval=t,e.second=o,e.minute=s,e.hour=u,e.day=c,e.week=f,e.month=l,e.year=d,e.utcSecond=h,e.utcMinute=p,e.utcHour=m,e.utcDay=g,e.utcWeek=b,e.utcMonth=y,e.utcYear=v})},{}],10:[function(e,t,n){function r(){this._cells={},this._aggr=[],this._stream=!1}function a(e){if(i.isArray(e))return e;if(null==e)return[];var t,n,r=[];for(t in e)n=i.array(e[t]),r.push({name:t,ops:n});return r}var i=e("../util"),o=e("./measures"),s=e("./collector"),u=r.Flags={ADD_CELL:1,MOD_CELL:2},c=r.prototype;c.stream=function(e){return null==e?this._stream:(this._stream=!!e,this._aggr=[],this)},c.key=function(e){return null==e?this._key:(this._key=i.$(e),this)},c.groupby=function(e){return this._dims=i.array(e).map(function(e,t){if(e=i.isString(e)?{name:e,get:i.$(e)}:i.isFunction(e)?{name:i.name(e)||e.name||"_"+t,get:e}:e.name&&i.isFunction(e.get)?e:null,null==e)throw"Invalid groupby argument: "+e;return e}),this.clear()},c.summarize=function(e){e=a(e),this._count=!0;var t,n,r,s,u,c,f,l=this._aggr=[];for(r=0;rt;++t)a+="|"+n[t].get(e);return a},c._cell=function(e){var t=this._dims.length?this._cellkey(e):"";return this._cells[t]||(this._cells[t]=this._newcell(e,t))},c._newcell=function(e,t){var n,r={num:0,tuple:this._newtuple(e,t),flag:u.ADD_CELL,aggs:{}},a=this._aggr;for(n=0;nt;++t)a[r[t].name]=r[t].get(e);return this._ingest(a)},c._ingest=i.identity,c._add=function(e){var t,n=this._cell(e),r=this._aggr;if(n.num+=1,!this._count)for(n.collect&&n.data.add(e),t=0;t0){for(e.collect&&e.data.values(),t=0;te;++e)r.hasOwnProperty(c(s[e]))||(f[t++]=s[e]);else{for(e=0,n=u.length;n>e;++e)u[e][o]=1;for(e=0,t=0,n=s.length;n>e;++e)s[e][o]||(f[t++]=s[e]);for(e=0,n=u.length;n>e;++e)delete u[e][o]}else for(r=i.count.map(u),e=0,t=0,n=s.length;n>e;++e)r[s[e]]>0?r[s[e]]-=1:f[t++]=s[e];return this._rem=[],this._add=f},s.extent=function(e){if(this._get!==e||!this._ext){var t=this.values(),n=i.extent.index(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},s.argmin=function(e){return this.extent(e)[0]},s.argmax=function(e){return this.extent(e)[1]},s.min=function(e){var t=this.extent(e)[0];return t?e(t):+(1/0)},s.max=function(e){var t=this.extent(e)[1];return t?e(t):-(1/0)},s.quartile=function(e){return this._get===e&&this._q||(this._q=i.quartile(this.values(),e),this._get=e),this._q},s.q1=function(e){return this.quartile(e)[0]},s.q2=function(e){return this.quartile(e)[1]},s.q3=function(e){return this.quartile(e)[2]},t.exports=r},{"../stats":29,"../util":32}],12:[function(e,t,n){var r=e("../util"),a=e("./aggregator");t.exports=function(){var e=[].reduce.call(arguments,function(e,t){return e.concat(r.array(t))},[]);return(new a).groupby(e).summarize({"*":"values"})}},{"../util":32,"./aggregator":10}],13:[function(e,t,n){function r(e){return function(t){var n=o.extend({init:"",add:"",rem:"",idx:0},e);return n.out=t||e.name,n}}function a(e,t){function n(e,r){function a(t){e[t]||n(e,e[t]=s[t]())}return r.req&&r.req.forEach(a),t&&r.str&&r.str.forEach(a),e}var r=e.reduce(n,e.reduce(function(e,t){return e[t.name]=t,e},{}));return o.vals(r).sort(function(e,t){return e.idx-t.idx})}function i(t,n,r,i){var s=a(t,n),u="this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;",c="if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;",f="if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;",l="var t = this.tuple; var cell = this.cell;";return s.forEach(function(e){e.idx<0?(u=e.init+u,c=e.add+c,f=e.rem+f):(u+=e.init,c+=e.add,f+=e.rem)}),t.slice().sort(function(e,t){return e.idx-t.idx}).forEach(function(e){l+="this.assign(t,'"+e.out+"',"+e.set+");"}),l+="return t;",u=Function("cell","t",u),u.prototype.assign=i,u.prototype.add=Function("t","var v = this.get(t);"+c),u.prototype.rem=Function("t","var v = this.get(t);"+f),u.prototype.set=Function(l),u.prototype.get=r,u.prototype.distinct=e("../stats").count.distinct,u.prototype.isValid=o.isValid,u.fields=t.map(o.$("out")),u}var o=e("../util"),s={values:r({name:"values",init:"cell.collect = true;",set:"cell.data.values()",idx:-1}),count:r({name:"count",set:"cell.num"}),missing:r({name:"missing",set:"this.missing"}),valid:r({name:"valid",set:"this.valid"}),sum:r({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:r({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:r({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:r({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:r({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:r({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:r({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),median:r({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:r({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:r({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),distinct:r({name:"distinct",set:"this.distinct(cell.data.values(), this.get)",req:["values"],idx:3}),argmin:r({name:"argmin",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin = this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:r({name:"argmax",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax = this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:r({name:"min",init:"this.min = +Infinity;",add:"if (v < this.min) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:r({name:"max",init:"this.max = -Infinity;",add:"if (v > this.max) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4}),modeskew:r({name:"modeskew",set:"this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))",req:["mean","stdev","median"],idx:5})};s.create=i,t.exports=s},{"../stats":29,"../util":32}],14:[function(e,t,n){function r(e){if(!e)throw Error("Missing binning options.");var t,n,r,s,u,c,f,l=e.maxbins||15,d=e.base||10,h=Math.log(d),p=e.div||[5,2],m=e.min,g=e.max,b=g-m;if(e.step)t=e.step;else if(e.steps)t=e.steps[Math.min(e.steps.length-1,a(e.steps,b/l,0,e.steps.length))];else{n=Math.ceil(Math.log(l)/h),r=e.minstep||0,t=Math.max(r,Math.pow(d,Math.round(Math.log(b)/h)-n));do t*=d;while(Math.ceil(b/t)>l);for(c=0;c=r&&l>=b/u&&(t=u)}return u=Math.log(t),s=u>=0?0:~~(-u/h)+1,f=Math.pow(d,-s-1),m=Math.min(m,Math.floor(m/t+f)*t),g=Math.ceil(g/t)*t,{start:m,stop:g,step:t,unit:{precision:s},value:i,index:o}}function a(e,t,n,r){for(;r>n;){var a=n+r>>>1;c.cmp(e[a],t)<0?n=a+1:r=a}return n}function i(e){return this.step*Math.floor(e/this.step+l)}function o(e){return Math.floor((e-this.start)/this.step+l)}function s(e){return this.unit.date(i.call(this,e))}function u(e){return o.call(this,this.unit.unit(e))}var c=e("../util"),f=e("../time"),l=1e-15;r.date=function(e){if(!e)throw Error("Missing date binning options.");var t=e.utc?f.utc:f,n=e.min,a=e.max,i=e.maxbins||20,o=e.minbins||4,c=+a-+n,l=e.unit?t[e.unit]:t.find(c,o,i),d=r({min:null!=l.min?l.min:l.unit(n),max:null!=l.max?l.max:l.unit(a),maxbins:i,minstep:l.minstep,steps:l.step});return d.unit=l,d.index=u,e.raw||(d.value=s),d},t.exports=r},{"../time":31,"../util":32}],15:[function(e,t,n){function r(e,t,n){n=o(e,t,n);var r=i(n);return r?d.$func("bin",r.unit.unit?function(e){return r.value(r.unit.unit(e))}:function(e){return r.value(e)})(n.accessor):n.accessor||d.identity}function a(e,t,n){n=o(e,t,n);var r=i(n);return r?s(e,n.accessor,r):u(e,n.accessor,n&&n.sort)}function i(e){var t=e.type,n=null;return(null==t||p[t])&&("integer"===t&&null==e.minstep&&(e.minstep=1),n="date"===t?c.date(e):c(e)),n}function o(){var e=arguments,t=0,n=d.isArray(e[t])?e[t++]:null,r=d.isFunction(e[t])||d.isString(e[t])?d.$(e[t++]):null,a=d.extend({},e[t]);if(n&&(a.type=a.type||l(n,r),p[a.type])){var i=h.extent(n,r);a=d.extend({min:i[0],max:i[1]},a)}return r&&(a.accessor=r),a}function s(e,t,n){for(var r,a,i=f.range(n.start,n.stop+n.step/2,n.step).map(function(e){return{value:n.value(e),count:0}}),o=0;oa||a>=i.length||!isFinite(a))continue;i[a].count+=1}return i.bins=n,i}function u(e,t,n){var r=h.unique(e,t),a=h.count.map(e,t);return r.map(function(e){return{value:e,count:a[e]}}).sort(d.comparator(n?"-count":"+value"))}var c=e("./bins"),f=e("../generate"),l=e("../import/type"),d=e("../util"),h=e("../stats"),p={integer:1,number:1,date:1};t.exports={$bin:r,histogram:a}},{"../generate":17,"../import/type":26,"../stats":29,"../util":32,"./bins":14}],16:[function(e,t,n){function r(e){var t=l.localeFormat(e);if(null==t)throw Error("Unrecognized locale: "+e);d=t}function a(e){var t=f.localeFormat(e);if(null==t)throw Error("Unrecognized locale: "+e);h=t}function i(e,t){e.length||(e=[0]),null==t&&(t=10);var n=e[0],r=e[e.length-1];n>r&&(o=r,r=n,n=o);var a=r-n||(t=1,n||r||1),i=Math.pow(10,Math.floor(Math.log(a/t)/Math.LN10)),o=a/t/i;return o>=p?i*=10:o>=m?i*=5:o>=g&&(i*=2),[Math.ceil(n/i)*i,Math.floor(r/i)*i+i/2,i]}function o(e,t,n){var r=i(e,t);if(null==n)n=",."+l.precisionFixed(r[2])+"f";else switch(n=l.formatSpecifier(n),n.type){case"s":var a=Math.max(Math.abs(r[0]),Math.abs(r[1]));return null==n.precision&&(n.precision=l.precisionPrefix(r[2],a)),d.formatPrefix(n,a);case"":case"e":case"g":case"p":case"r":null==n.precision&&(n.precision=l.precisionRound(r[2],Math.max(Math.abs(r[0]),Math.abs(r[1])))-("e"===n.type));break;case"f":case"%":null==n.precision&&(n.precision=l.precisionFixed(r[2])-2*("%"===n.type))}return d.format(n)}function s(){var e=h.format,t=e(".%L"),n=e(":%S"),r=e("%I:%M"),a=e("%I %p"),i=e("%a %d"),o=e("%b %d"),s=e("%B"),u=e("%Y");return function(e){var f=+e;return(c.second(e)n;++n)r[n]=e;return r},r.zeros=function(e){return r.repeat(0,e)},r.range=function(e,t,n){if(arguments.length<3&&(n=1,arguments.length<2&&(t=e,e=0)),(t-e)/n==1/0)throw new Error("Infinite range");var r,a=[],i=-1;if(0>n)for(;(r=e+n*++i)>t;)a.push(r);else for(;(r=e+n*++i)1);return a=Math.sqrt(-2*Math.log(r)/r),n=e+o*a*t,e+i*a*t};return a.samples=function(e){return r.zeros(e).map(a)},a}},{}],18:[function(e,t,n){function r(e,t){if(e){var n=t.header;e=(n?n.join(t.delimiter)+"\n":"")+e}return i.dsv(t.delimiter).parse(e)}var a=e("../../util"),i=e("d3-dsv");r.delimiter=function(e){var t={delimiter:e};return function(e,n){return r(e,n?a.extend(n,t):t)}},t.exports=r},{"../../util":32,"d3-dsv":7}],19:[function(e,t,n){var r=e("./dsv");t.exports={json:e("./json"),topojson:e("./topojson"),treejson:e("./treejson"),dsv:r,csv:r.delimiter(","),tsv:r.delimiter(" ")}},{"./dsv":18,"./json":20,"./topojson":21,"./treejson":22}],20:[function(e,t,n){var r=e("../../util");t.exports=function(e,t){var n=r.isObject(e)&&!r.isBuffer(e)?e:JSON.parse(e);return t&&t.property&&(n=r.accessor(t.property)(n)),n}},{"../../util":32}],21:[function(e,t,n){(function(n){var r=e("./json"),a=function(e,t){var n=a.topojson;if(null==n)throw Error("TopoJSON library not loaded.");var i,o=r(e,t);if(t&&t.feature){if(i=o.objects[t.feature])return n.feature(o,i).features;throw Error("Invalid TopoJSON object: "+t.feature)}if(t&&t.mesh){if(i=o.objects[t.mesh])return[n.mesh(o,o.objects[t.mesh])];throw Error("Invalid TopoJSON object: "+t.mesh)}throw Error("Missing TopoJSON feature or mesh parameter.")};a.topojson="undefined"!=typeof window?window.topojson:"undefined"!=typeof n?n.topojson:null,t.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./json":20}],22:[function(e,t,n){function r(e,t){function n(e){r.push(e);var a=e[t];if(a)for(var i=0;i1&&"."===r[t-1]&&r.lastIndexOf(e)===t});if(!u)throw"URL is not whitelisted: "+n}}return n}function a(e,t){var n,r=t||function(e){throw e};try{n=a.sanitizeUrl(e)}catch(i){return void r(i)}return n?a.useXHR?o(n,t):c(n,l)?s(n.slice(l.length),t):n.indexOf("://")<0?s(n,t):u(n,t):void r("Invalid URL: "+e.url)}function i(e){var t=e.responseType;return t&&"text"!==t?e.response:e.responseText}function o(e,t){function n(){var e=a.status;!e&&i(a)||e>=200&&300>e||304===e?t(null,a.responseText):t(a,null)}var r=!!t,a=new XMLHttpRequest;return!this.XDomainRequest||"withCredentials"in a||!/^(http(s)?:)?\/\//.test(e)||(a=new XDomainRequest),r&&("onload"in a?a.onload=a.onerror=n:a.onreadystatechange=function(){a.readyState>3&&n()}),a.open("GET",e,r),a.send(),!r&&i(a)?a.responseText:void 0}function s(t,n){var r=e("fs");return n?void r.readFile(t,n):r.readFileSync(t,"utf8")}function u(t,n){if(!n)return e("sync-request")("GET",t).getBody();var r={url:t,encoding:null,gzip:!0};e("request")(r,function(e,t,r){e||200!==t.statusCode?(e=e||"Load failed with response code "+t.statusCode+".",n(e,null)):n(null,r)})}function c(e,t){return null==e?!1:0===e.lastIndexOf(t,0)}var f=/^([A-Za-z]+:)?\/\//,l="file://";a.sanitizeUrl=r,a.useXHR="undefined"!=typeof XMLHttpRequest,t.exports=a},{fs:1,request:1,"sync-request":1,url:1}],24:[function(e,t,n){function r(e,t){var n=t&&t.type||"json";return e=s[n](e,t),t&&t.parse&&a(e,t.parse),e}function a(e,t){var n,r,a,s,u,c,f=e.length;for(t="auto"===t?o.inferAll(e):i.duplicate(t),n=i.keys(t),r=n.map(function(e){return o.parsers[t[e]]}),s=0,c=n.length;f>s;++s)for(a=e[s],u=0;c>u;++u)a[n[u]]=r[u](a[n[u]]);o.annotation(e,t)}var i=e("../util"),o=e("./type"),s=e("./formats");r.formats=s,t.exports=r},{"../util":32,"./formats":19,"./type":26}],25:[function(e,t,n){var r=e("../util"),a=e("./load"),i=e("./read");t.exports=r.keys(i.formats).reduce(function(e,t){return e[t]=function(e,n,o){r.isString(e)&&(e={url:e}),2===arguments.length&&r.isFunction(n)&&(o=n,n=void 0),n=r.extend({parse:"auto"},n),n.type=t;var s=a(e,o?function(e,t){if(e)return void o(e,null);try{t=i(t,n),o(null,t)}catch(r){o(r,null)}}:void 0);return o?void 0:i(s,n)},e},{})},{"../util":32,"./load":23,"./read":24}],26:[function(e,t,n){function r(e,t){return t?void(e[c]=t):e&&e[c]||null}function a(e,t){t=u.$(t);var n,r,a;if(e[c]&&(n=t(e[c]),u.isString(n)))return n;for(r=0,a=e.length;!u.isValid(n)&&a>r;++r)n=t?t(e[r]):e[r];return u.isDate(n)?"date":u.isNumber(n)?"number":u.isBoolean(n)?"boolean":u.isString(n)?"string":null}function i(e,t){return e.length?(t=t||u.keys(e[0]),t.reduce(function(t,n){return t[n]=a(e,n),t},{})):void 0}function o(e,t){t=u.$(t);var n,r,a,i=["boolean","integer","number","date"];for(n=0;n0?Math.min(o,t.maxwidth):o}),h=n.map(function(e,t){return i.truncate(i.pad(e,d[t],"center"),d[t])}).join(t.separator),p=u(n.map(function(e,t){return"{{"+e+(c[r[e]]||"")+("|pad:"+d[t]+","+(f[r[e]]||"right"))+("|truncate:"+d[t])+"}}"}).join(t.separator));return h+"\n"+e.map(p).join("\n")},t.exports.summary=function(e){e=e?e.__summary__?e:s.summary(e):this;var t,n,i=[];for(t=0,n=e.length;n>t;++t)i.push("-- "+e[t].field+" --"),"string"===e[t].type||e[t].distinct<10?i.push(a(e[t])):i.push(r(e[t])),i.push("");return i.join("\n")}},{"./import/type":26,"./stats":29,"./template":30,"./util":32}],29:[function(e,t,n){var r=e("./util"),a=e("./import/type"),i=e("./generate"),o={};o.unique=function(e,t,n){t=r.$(t),n=n||[];var a,i,o,s={};for(i=0,o=e.length;o>i;++i)a=t?t(e[i]):e[i],a in s||(s[a]=1,n.push(a));return n},o.count=function(e){return e&&e.length||0},o.count.valid=function(e,t){t=r.$(t);var n,a,i,o=0;for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],r.isValid(n)&&(o+=1);return o},o.count.missing=function(e,t){t=r.$(t);var n,a,i,o=0;for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],null==n&&(o+=1);return o},o.count.distinct=function(e,t){t=r.$(t);var n,a,i,o={},s=0;for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],n in o||(o[n]=1,s+=1);return s},o.count.map=function(e,t){t=r.$(t);var n,a,i,o={};for(a=0,i=e.length;i>a;++a)n=t?t(e[a]):e[a],o[n]=n in o?o[n]+1:1;return o},o.median=function(e,t){return t&&(e=e.map(r.$(t))),e=e.filter(r.isValid).sort(r.cmp),o.quantile(e,.5)},o.quartile=function(e,t){t&&(e=e.map(r.$(t))),e=e.filter(r.isValid).sort(r.cmp);var n=o.quantile;return[n(e,.25),n(e,.5),n(e,.75)]},o.quantile=function(e,t,n){void 0===n&&(n=t,t=r.identity),t=r.$(t);var a=(e.length-1)*n+1,i=Math.floor(a),o=+t(e[i-1]),s=a-i;return s?o+s*(t(e[i])-o):o},o.sum=function(e,t){t=r.$(t);for(var n,a=0,i=0,o=e.length;o>i;++i)n=t?t(e[i]):e[i],r.isValid(n)&&(a+=n);return a},o.mean=function(e,t){t=r.$(t);var n,a,i,o,s,u=0;for(a=0,o=0,i=e.length;i>a;++a)s=t?t(e[a]):e[a],r.isValid(s)&&(n=s-u,u+=n/++o);return u},o.variance=function(e,t){if(t=r.$(t),!r.isArray(e)||e.length<2)return 0;var n,a,i,o,s=0,u=0;for(a=0,i=0;ao;++o)if(i=t?t(e[o]):e[o],r.isValid(i)){n=a=i;break}for(;s>o;++o)i=t?t(e[o]):e[o],r.isValid(i)&&(n>i&&(n=i),i>a&&(a=i));return[n,a]},o.extent.index=function(e,t){t=r.$(t);var n,a,i,o,s=-1,u=-1,c=e.length;for(o=0;c>o;++o)if(i=t?t(e[o]):e[o],r.isValid(i)){n=a=i,s=u=o;break}for(;c>o;++o)i=t?t(e[o]):e[o],r.isValid(i)&&(n>i&&(n=i,s=o),i>a&&(a=i,u=o));return[s,u]},o.dot=function(e,t,n){var a,i,o=0;if(n)for(t=r.$(t),n=r.$(n),a=0;an;++n){if(a=o[n].val,0>c&&f===a)c=n-1;else if(c>-1&&f!==a){for(i=1+(n-1+c)/2;n>c;++c)u[o[c].idx]=i;c=-1}u[o[n].idx]=n+1,f=a}if(c>-1)for(i=1+(s-1+c)/2;s>c;++c)u[o[c].idx]=i;return u},o.cor=function(e,t,n){var a=n;n=a?e.map(r.$(n)):t,t=a?e.map(r.$(t)):e;var i=o.dot(t,n),s=o.mean(t),u=o.mean(n),c=o.stdev(t),f=o.stdev(n),l=e.length;return(i-l*s*u)/((l-1)*c*f)},o.cor.rank=function(e,t,n){var a,i,s,u=n?o.rank(e,r.$(t)):o.rank(e),c=n?o.rank(e,r.$(n)):o.rank(t),f=e.length;for(a=0,i=0;f>a;++a)s=u[a]-c[a],i+=s*s;return 1-6*i/(f*(f*f-1))},o.cor.dist=function(e,t,n){var a,i,s,u,c=n?e.map(r.$(t)):e,f=n?e.map(r.$(n)):t,l=o.dist.mat(c),d=o.dist.mat(f),h=l.length;for(a=0,i=0,s=0,u=0;h>a;++a)i+=l[a]*l[a],s+=d[a]*d[a],u+=l[a]*d[a];return Math.sqrt(u/Math.sqrt(i*s))},o.dist=function(e,t,n,a){var i,o,s=r.isFunction(n)||r.isString(n),u=e,c=s?e:t,f=s?a:n,l=2===f||null==f,d=e.length,h=0;for(s&&(t=r.$(t),n=r.$(n)),o=0;d>o;++o)i=s?t(u[o])-n(c[o]):u[o]-c[o],h+=l?i*i:Math.pow(Math.abs(i),f);return l?Math.sqrt(h):Math.pow(h,1/f)},o.dist.mat=function(e){var t,n,r,a=e.length,o=a*a,s=Array(o),u=i.zeros(a),c=0;for(n=0;a>n;++n)for(s[n*a+n]=0,r=n+1;a>r;++r)s[n*a+r]=t=Math.abs(e[n]-e[r]),s[r*a+n]=t,u[n]+=t,u[r]+=t;for(n=0;a>n;++n)c+=u[n],u[n]/=a;for(c/=o,n=0;a>n;++n)for(r=n;a>r;++r)s[n*a+r]+=c-u[n]-u[r],s[r*a+n]=s[n*a+r];return s},o.entropy=function(e,t){t=r.$(t);var n,a,i=0,o=0,s=e.length;for(n=0;s>n;++n)i+=t?t(e[n]):e[n];if(0===i)return 0;for(n=0;s>n;++n)a=(t?t(e[n]):e[n])/i,a&&(o+=a*Math.log(a));return-o/Math.LN2},o.mutual=function(e,t,n,a){var i,o,s,u=a?e.map(r.$(t)):e,c=a?e.map(r.$(n)):t,f=a?e.map(r.$(a)):n,l={},d={},h=f.length,p=0,m=0,g=0;for(s=0;h>s;++s)l[u[s]]=0,d[c[s]]=0;for(s=0;h>s;++s)l[u[s]]+=f[s],d[c[s]]+=f[s],p+=f[s];for(o=1/(p*Math.LN2),s=0;h>s;++s)0!==f[s]&&(i=p*f[s]/(l[u[s]]*d[c[s]]),m+=f[s]*o*Math.log(i),g+=f[s]*o*Math.log(f[s]/p));return[m,1+m/g]},o.mutual.info=function(e,t,n,r){return o.mutual(e,t,n,r)[0]},o.mutual.dist=function(e,t,n,r){return o.mutual(e,t,n,r)[1]},o.profile=function(e,t){var n,i,s,u,c,f=0,l=0,d=0,h=0,p=null,m=null,g=0,b=[],y={};for(s=0;sc)&&(p=c),(null===m||c>m)&&(m=c),n=c-f,f+=n/++l,g+=n*(c-f),b.push(c));return g/=l-1,i=Math.sqrt(g),b.sort(r.cmp),{type:a(e,t),unique:y,count:e.length,valid:l,missing:d,distinct:h,min:p,max:m,mean:f,stdev:i,median:u=o.quantile(b,.5),q1:o.quantile(b,.25),q3:o.quantile(b,.75),modeskew:0===i?0:(f-u)/i}},o.summary=function(e,t){t=t||r.keys(e[0]);var n=t.map(function(t){var n=o.profile(e,r.$(t));return n.field=t,n});return n.__summary__=!0,n},t.exports=o},{"./generate":17,"./import/type":26,"./util":32}],30:[function(e,t,n){function r(e){var t=a(e,"d");return t="var __t; return "+t+";",new Function("d",t).bind(f)}function a(e,t,n){t=t||"obj";var r=0,a="'",s=l;return e.replace(s,function(s,u,c){return a+=e.slice(r,c).replace(m,o),r=c+s.length,u&&(a+="'\n+((__t=("+i(u,t,n)+"))==null?'':__t)+\n'"),s}),a+"'"}function i(e,t,n){function a(e){return e=e||"",m?(m=!1,g="String("+g+")"+e):g+=e,g}function i(){return"(typeof "+g+'==="number"?new Date('+g+"):"+g+")"}function o(e,t){v=s(_[0],t,e),m=!1,g="this.formats["+v+"]("+g+")"}function f(e,t){v=s(_[0],t,e),m=!1,g="this.formats["+v+"]("+i()+")"}var l=e.match(d),p=l.shift().trim(),m=!0;n&&(n[p]=1);for(var g=r.property(t,p),b=0;b0&&(w=w.slice(0,y),_=l[b].slice(y+1).match(h).map(function(e){return e.trim()})),w=w.trim()){case"length":a(".length");break;case"lower":a(".toLowerCase()");break;case"upper":a(".toUpperCase()");break;case"lower-locale":a(".toLocaleLowerCase()");break;case"upper-locale":a(".toLocaleUpperCase()");break;case"trim":a(".trim()");break;case"left":v=u.number(_[0]),a(".slice(0,"+v+")");break;case"right":v=u.number(_[0]),a(".slice(-"+v+")");break;case"mid":v=u.number(_[0]),x=v+u.number(_[1]),a(".slice(+"+v+","+x+")");break;case"slice":v=u.number(_[0]),a(".slice("+v+(_.length>1?","+u.number(_[1]):"")+")");break;case"truncate":v=u.number(_[0]),x=_[1],x="left"!==x&&"middle"!==x&&"center"!==x?"right":x,g="this.truncate("+a()+","+v+",'"+x+"')";break;case"pad":v=u.number(_[0]),x=_[1],x="left"!==x&&"middle"!==x&&"center"!==x?"right":x,g="this.pad("+a()+","+v+",'"+x+"')";break;case"number":o(c.number,"number");break;case"time":f(c.time,"time");break;case"time-utc":f(c.utc,"time-utc");break;default:throw Error("Unrecognized template filter: "+w)}}return g}function o(e){return"\\"+p[e]}function s(e,t,n){if(!("'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]))throw Error("Format pattern must be quoted: "+e);if(e=e.slice(1,-1),t=t+":"+e,!f.format_map[t]){var r=n(e),a=f.formats.length;f.formats.push(r),f.format_map[t]=a}return f.format_map[t]}var u=e("./util"),c=e("./format"),f={formats:[],format_map:{},truncate:u.truncate,pad:u.pad};r.source=a,r.context=f,t.exports=r,r.clearFormatCache=function(){f.formats=[],f.format_map={}},r.property=function(e,t){var n=u.field(t).map(u.str).join("][");return e+"["+n+"]"};var l=/\{\{(.+?)\}\}|$/g,d=/(?:"[^"]*"|\'[^\']*\'|[^\|"]+|[^\|\']+)+/g,h=/(?:"[^"]*"|\'[^\']*\'|[^,"]+|[^,\']+)+/g,p={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},m=/\\|'|\r|\n|\u2028|\u2029/g},{"./format":16,"./util":32}],31:[function(e,t,n){function r(e){return c.setTime(+e),c}function a(e,t,n,r,a,i){var o={type:e,date:t,unit:n};return r?o.step=r:o.minstep=1,null!=a&&(o.min=a),null!=i&&(o.max=i),o}function i(e,t,n,r,i,o){return a(e,function(e){return t.offset(n,e)},function(e){return t.count(n,e)},r,i,o)}function o(e,t,n,r){var a,i,o,s=p[0];for(a=1,i=p.length;i>a;++a)if(s=p[a],t>s[0]){if(o=t/s[0],o>r)return e[p[a-1][1]];if(o>=n)return e[s[1]]}return e[p[i-1][1]]}function s(e){var t,n,r={};for(t=0,n=e.length;n>t;++t)r[e[t].type]=e[t];return r.find=function(t,n,r){return o(e,t,n,r)},r}var u=e("d3-time"),c=new Date,f=new Date(0,0,1).setFullYear(0),l=new Date(Date.UTC(0,0,1)).setUTCFullYear(0),d=[i("second",u.second,f),i("minute",u.minute,f),i("hour",u.hour,f),i("day",u.day,f,[1,7]),i("month",u.month,f,[1,3,6]),i("year",u.year,f),a("seconds",function(e){return new Date(1970,0,1,0,0,e)},function(e){return r(e).getSeconds()},null,0,59),a("minutes",function(e){return new Date(1970,0,1,0,e)},function(e){return r(e).getMinutes()},null,0,59),a("hours",function(e){return new Date(1970,0,1,e)},function(e){return r(e).getHours()},null,0,23),a("weekdays",function(e){return new Date(1970,0,4+e)},function(e){return r(e).getDay()},[1],0,6),a("dates",function(e){return new Date(1970,0,e)},function(e){return r(e).getDate()},[1],1,31),a("months",function(e){return new Date(1970,e%12,1)},function(e){return r(e).getMonth()},[1],0,11)],h=[i("second",u.utcSecond,l),i("minute",u.utcMinute,l),i("hour",u.utcHour,l),i("day",u.utcDay,l,[1,7]),i("month",u.utcMonth,l,[1,3,6]),i("year",u.utcYear,l),a("seconds",function(e){return new Date(Date.UTC(1970,0,1,0,0,e))},function(e){return r(e).getUTCSeconds()},null,0,59),a("minutes",function(e){return new Date(Date.UTC(1970,0,1,0,e))},function(e){return r(e).getUTCMinutes()},null,0,59),a("hours",function(e){return new Date(Date.UTC(1970,0,1,e))},function(e){return r(e).getUTCHours()},null,0,23),a("weekdays",function(e){return new Date(Date.UTC(1970,0,4+e))},function(e){return r(e).getUTCDay()},[1],0,6),a("dates",function(e){return new Date(Date.UTC(1970,0,e))},function(e){return r(e).getUTCDate()},[1],1,31),a("months",function(e){return new Date(Date.UTC(1970,e%12,1))},function(e){return r(e).getUTCMonth()},[1],0,11)],p=[[31536e6,5],[7776e6,4],[2592e6,4],[12096e5,3],[6048e5,3],[1728e5,3],[864e5,3],[432e5,2],[216e5,2],[108e5,2],[36e5,2],[18e5,1],[9e5,1],[3e5,1],[6e4,1],[3e4,0],[15e3,0],[5e3,0],[1e3,0]];t.exports=s(d),t.exports.utc=s(h)},{"d3-time":9}],32:[function(e,t,n){function r(e){return e.replace(d,"$1\\'")}function a(e,t){var n,r="";for(n=0;e>n;++n)r+=t;return r}function i(e,t,n){var r=0,a=e.split(p);return e=n?(a=a.reverse()).filter(function(e){return r+=e.length,t>=r}).reverse():a.filter(function(e){return r+=e.length,t>=r}),e.length?e.join("").trim():a[0].slice(0,t)}var o=e("buffer"),s=e("./time"),u=s.utc,c=t.exports={},f="__name__";c.namedfunc=function(e,t){return t[f]=e,t},c.name=function(e){return null==e?null:e[f]},c.identity=function(e){return e},c["true"]=c.namedfunc("true",function(){return!0}),c["false"]=c.namedfunc("false",function(){return!1}),c.duplicate=function(e){return JSON.parse(JSON.stringify(e))},c.equal=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},c.extend=function(e){for(var t,n,r=1,a=arguments.length;a>r;++r){t=arguments[r];for(n in t)e[n]=t[n]}return e},c.length=function(e){return null!=e&&null!=e.length?e.length:null},c.keys=function(e){var t,n=[];for(t in e)n.push(t);return n},c.vals=function(e){var t,n=[];for(t in e)n.push(e[t]);return n},c.toMap=function(e,t){return(t=c.$(t))?e.reduce(function(e,n){return e[t(n)]=1,e},{}):e.reduce(function(e,t){return e[t]=1,e},{})},c.keystr=function(e){var t=e.length;if(!t)return"";for(var n=String(e[0]),r=1;t>r;++r)n+="|"+String(e[r]);return n};var l=Object.prototype.toString;c.isObject=function(e){return e===Object(e)},c.isFunction=function(e){return"[object Function]"===l.call(e)},c.isString=function(e){return"string"==typeof value||"[object String]"===l.call(e)},c.isArray=Array.isArray||function(e){return"[object Array]"===l.call(e)},c.isNumber=function(e){return"number"==typeof e||"[object Number]"===l.call(e)},c.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==l.call(e)},c.isDate=function(e){return"[object Date]"===l.call(e)},c.isValid=function(e){return null!=e&&e===e},c.isBuffer=o.Buffer&&o.Buffer.isBuffer||c["false"],c.number=function(e){return null==e||""===e?null:+e},c["boolean"]=function(e){return null==e||""===e?null:"false"===e?!1:!!e},c.date=function(e){return null==e||""===e?null:Date.parse(e)},c.array=function(e){return null!=e?c.isArray(e)?e:[e]:[]},c.str=function(e){return c.isArray(e)?"["+e.map(c.str)+"]":c.isObject(e)?JSON.stringify(e):c.isString(e)?"'"+r(e)+"'":e};var d=/(^|[^\\])'/g,h=/\[(.*?)\]|[^.\[]+/g;c.field=function(e){return String(e).match(h).map(function(e){return"["!==e[0]?e:"'"!==e[1]&&'"'!==e[1]?e.slice(1,-1):e.slice(2,-2).replace(/\\(["'])/g,"$1")})},c.accessor=function(e){var t;return null==e||c.isFunction(e)?e:c.namedfunc(e,(t=c.field(e)).length>1?function(e){return t.reduce(function(e,t){return e[t]},e)}:function(t){return t[e]})},c.$=c.accessor,c.mutator=function(e){var t;return c.isString(e)&&(t=c.field(e)).length>1?function(e,n){for(var r=0;ra;++a){if(o=e[a],s=o(n),u=o(r),u>s)return-1*t[a];if(s>u)return t[a]}return 0}},c.cmp=function(e,t){return t>e?-1:e>t?1:e>=t?0:null===e?-1:null===t?1:NaN},c.numcmp=function(e,t){return e-t},c.stablesort=function(e,t,n){var r=e.reduce(function(e,t,r){return e[n(t)]=r,e},{});return e.sort(function(e,a){var i=t(e),o=t(a);return o>i?-1:i>o?1:r[n(e)]-r[n(a)]}),e},c.pad=function(e,t,n,r){r=r||" ";var i=t-e.length;if(0>=i)return e;switch(n){case"left":return a(i,r)+e;case"middle":case"center":return a(Math.floor(i/2),r)+e+a(Math.ceil(i/2),r);default:return e+a(i,r)}},c.truncate=function(e,t,n,r,a){var o=e.length;if(t>=o)return e;a=void 0!==a?String(a):"…";var s=Math.max(0,t-a.length);switch(n){case"left":return a+(r?i(e,s,1):e.slice(o-s));case"middle":case"center":var u=Math.ceil(s/2),c=Math.floor(s/2);return(r?i(e,u):e.slice(0,u))+a+(r?i(e,c,1):e.slice(o-c));default:return(r?i(e,s):e.slice(0,s))+a}};var p=/([\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u2028\u2029\u3000\uFEFF])/},{"./time":31,buffer:1}],33:[function(e,t,n){function r(e){e="[Vega Log] "+e,console.log(e)}function a(e){e="[Vega Err] "+e,console.error(e)}function i(e,t){if(i.enable){var n=Function.prototype.bind.call(console.log,console),r={prevTime:Date.now()-o,stamp:e.stamp};e.add&&(r.add=e.add.length,r.mod=e.mod.length,r.rem=e.rem.length,r.reflow=!!e.reflow),n.apply(console,(t.push(JSON.stringify(r)),t)),o=Date.now()}}var o=Date.now();t.exports={log:r,error:a,debug:(i.enable=!1,i)}},{}],34:[function(e,t,n){function r(e,t){var n={};return a(e,n),n.add=[],n.mod=[],n.rem=[],n.reflow=t,n}function a(e,t){t.stamp=e?e.stamp:0,t.sort=e?e.sort:null,t.facet=e?e.facet:null,t.trans=e?e.trans:null,t.dirty=e?e.dirty:[],t.request=e?e.request:null;for(var n,r=0,a=i.length;a>r;++r)t[n=i[r]]=e?e[n]:{}}var i=e("./Dependencies").ALL;t.exports={create:r,copy:a}},{"./Dependencies":37}],35:[function(e,t,n){function r(e){o.init.call(this,e),this._data=[],this.router(!0).collector(!0)}var a=e("vega-logging"),i=e("./Tuple"),o=e("./Node").prototype,s=r.prototype=Object.create(o);s.constructor=r,s.data=function(){return this._data},s.evaluate=function(e){return a.debug(e,["collecting"]),e.rem.length&&(this._data=i.idFilter(this._data,e.rem)),e.add.length&&(this._data=this._data.length?this._data.concat(e.add):e.add),e.sort&&this._data.sort(e.sort),e.reflow&&(e.mod=e.mod.concat(i.idFilter(this._data,e.add,e.mod,e.rem)),e.reflow=!1),e},t.exports=r},{"./Node":40,"./Tuple":42,"vega-logging":33}],36:[function(e,t,n){function r(e,t,n){this._graph=e,this._name=t,this._data=[],this._source=null,this._facet=n,this._input=u.create(),this._output=null,this._inputNode=null,this._outputNode=null,this._pipeline=null,this._collector=null,this._mutates=!1}function a(e){var t=new l(e._graph).router(!0).collector(!0);return t.data=function(){return e._data},t.evaluate=function(t){s.debug(t,["input",e._name]);var n,r=e._input,a=u.create(t);for(n in r.fields)a.fields[n]=1;return r.rem.length&&(e._data=f.idFilter(e._data,r.rem)),r.add.length&&(e._data=e._data.concat(r.add)),r.sort&&e._data.sort(r.sort),t.reflow&&(r.mod=r.mod.concat(f.idFilter(e._data,r.add,r.mod,r.rem))),e._input=u.create(),a.add=r.add,a.mod=r.mod,a.rem=r.rem,a.facet=e._facet,a},t}function i(e){var t=new l(e._graph).router(!0).reflows(!0).collector(!0);return t.data=function(){return e._collector?e._collector.data():e._data},t.evaluate=function(t){s.debug(t,["output",e._name]);var n=u.create(t,!0);return e._facet&&(e._facet.values=e.values(),t.facet=null),e._output=t,n.data[e._name]=1,n},t}function o(e){var t=new l(e._graph).router(!0);return t.evaluate=function(t){if(e.mutates()){var n=e._srcMap||(e._srcMap={}),r=u.create(t);return r.add=t.add.map(function(e){return n[e._id]=f.derive(e)}),r.mod=t.mod.map(function(e){return f.rederive(e,n[e._id])}),r.rem=t.rem.map(function(e){var t=n[e._id];return n[e._id]=null,t}),e._input=r}return e._input=t},t}var s=e("vega-logging"),u=e("./ChangeSet"),c=e("./Collector"),f=e("./Tuple"),l=e("./Node"),d=r.prototype;d.name=function(e){return arguments.length?(this._name=e,this):this._name},d.source=function(e){return arguments.length?this._source=this._graph.data(e):this._source},d.insert=function(e){return this._input.add=this._input.add.concat(e.map(f.ingest)),this},d.remove=function(e){var t=this._data.filter(e);return this._input.rem=this._input.rem.concat(t),this},d.update=function(e,t,n){var r=this._input.mod,a=f.idMap(r);return this._input.fields[t]=1,this._data.filter(e).forEach(function(e){var i=e[t],o=n(e);i!==o&&(f.set(e,t,o),1!==a[e._id]&&(r.push(e),a[e._id]=1))}),this},d.values=function(e){return arguments.length?(this._input.rem=this._data.slice(),e&&this.insert(e),this):this._collector.data()},d.mutates=function(e){return arguments.length?(this._mutates=this._mutates||e,this):this._mutates},d.last=function(){return this._output},d.fire=function(e){return e&&(this._input=e),this._graph.propagate(this._input,this._pipeline[0]),this},d.pipeline=function(e){if(!arguments.length)return this._pipeline;var t,n=this._graph;return e.unshift(this._inputNode=a(this)),t=n.preprocess(e),t.router&&e.push(t.collector=new c(n)),e.push(this._outputNode=i(this)),this._collector=t.collector,this._mutates=!!t.mutates,n.connect(this._pipeline=e),this},d.synchronize=function(){return this._graph.synchronize(this._pipeline),this},d.listener=function(){return o(this).addListener(this._inputNode)},d.addListener=function(e){return e instanceof r?this._collector.addListener(e.listener()):this._outputNode.addListener(e),this},d.removeListener=function(e){this._outputNode.removeListener(e)},d.listeners=function(e){return(e?this._collector:this._outputNode).listeners()},t.exports=r},{"./ChangeSet":34,"./Collector":35,"./Node":40,"./Tuple":42,"vega-logging":33}],37:[function(e,t,n){var r=t.exports={ALL:["data","fields","scales","signals"]};r.ALL.forEach(function(e){r[e.toUpperCase()]=e})},{}],38:[function(e,t,n){function r(){}var a=e("datalib"),i=e("./Heap"),o=e("./ChangeSet"),s=e("./DataSource"),u=e("./Collector"),c=e("./Tuple"),f=e("./Signal"),l=e("./Dependencies"),d=r.prototype;d.init=function(){this._stamp=0,this._rank=0,this._data={},this._signals={},this.doNotPropagate={}},d.rank=function(){return++this._rank},d.values=function(e,t,n){var r,i,o=e===l.SIGNALS?this._signals:this._data,s=void 0!==t?t:a.keys(o);if(Array.isArray(s)){for(r=n||{},i=0;i1)for(var n=1,r=e.length;r>n;++n)t=t[e[n]];return t},d.propagate=function(e,t,n){var r,a,s,u,c,f,l,d={},h=new i(function(e,t){return e._qrank-t._qrank});if(e.stamp)throw Error("Pulse already has a non-zero stamp.");for(e.stamp=n||++this._stamp,d[t._id]=e,h.push(t.qrank(!0));h.size()>0;)if(t=h.peek(),e=d[t._id],t.rank()!==t.qrank())h.replace(t.qrank(!0));else if(h.pop(),d[t._id]=null,r=t._listeners,e=this.evaluate(e,t),e!==this.doNotPropagate)for(!e.reflow&&t.reflows()&&(e=o.create(e,!0)),f=0,l=r.length;l>f;++f)if(a=r[f],void 0!==(s=d[a._id])){if(null===s)throw Error("Already propagated to node.");if(s===e)continue;if(u=e.add.length||e.mod.length||e.rem.length,c=s.add.length||s.mod.length||s.rem.length,u&&c)throw Error("Multiple changeset pulses to same node");d[a._id]=u?e:s,d[a._id].reflow=e.reflow||s.reflow}else h.push(a.qrank(!0)),d[a._id]=e},d.preprocess=function(e){for(var t,n,r,a,i=this,o=0,s=0;so;++o){for(n=e[o],n.collector()&&(t=n),r=n.dependency(l.DATA),u=0,c=r.length;c>u;++u){if(!(f=this.data(d=r[u])))throw new Error("Unknown data source "+a.str(d));f.addListener(t)}for(i=n.dependency(l.SIGNALS),u=0,c=i.length;c>u;++u){if(!(f=this.signal(d=i[u])))throw new Error("Unknown signal "+a.str(d));f.addListener(t)}o>0&&e[o-1].addListener(n)}return e},d.disconnect=function(e){var t,n,r,a,i,o,s,u;for(i=0,o=e.length;o>i;++i){for(n=e[i],n.collector()&&(t=n),r=n.dependency(l.DATA),s=0,u=r.length;u>s;++s)this.data(r[s]).removeListener(t);for(a=n.dependency(l.SIGNALS),s=0,u=a.length;u>s;++s)this.signal(a[s]).removeListener(t);n.disconnect()}return e},d.synchronize=function(e){var t,n,r,a,i,o,s,u,f={};for(r=0,a=e.length;a>r;++r)if(t=e[r],t.collector())for(i=0,n=t.data(),o=n.length;o>i;++i)u=(s=n[i])._id,f[u]||(c.prev_update(s),f[u]=1);return this},d.reevaluate=function(e,t){var n=e.reflow&&t.last()>=e.stamp,r=t.router()||e.add.length||e.rem.length;return r||!n||t.reevaluate(e)},d.evaluate=function(e,t){return this.reevaluate(e,t)?(e=t.evaluate(e),t.last(e.stamp),e):e},t.exports=r},{"./ChangeSet":34,"./Collector":35,"./DataSource":36,"./Dependencies":37,"./Heap":39,"./Signal":41,"./Tuple":42,datalib:27}],39:[function(e,t,n){function r(e){this.cmp=e,this.nodes=[]}function a(e,t,n,r){var a,i,o;for(a=e[n];n>t&&(o=n-1>>1,i=e[o],r(a,i)<0);)e[n]=i,n=o;return e[n]=a}function i(e,t,n){for(var r,i=t,o=e.length,s=e[t],u=2*t+1;o>u;)r=u+1,o>r&&n(e[u],e[r])>=0&&(u=r),e[t]=e[u],t=u,u=2*t+1;return e[t]=s,a(e,i,t,n)}var o=r.prototype;o.size=function(){return this.nodes.length},o.clear=function(){return this.nodes=[],this},o.peek=function(){return this.nodes[0]},o.push=function(e){var t=this.nodes;return t.push(e),a(t,0,t.length-1,this.cmp)},o.pop=function(){var e,t=this.nodes,n=t.pop();return t.length?(e=t[0],t[0]=n,i(t,0,this.cmp)):e=n,e},o.replace=function(e){var t=this.nodes,n=t[0];return t[0]=e,i(t,0,this.cmp),n},o.pushpop=function(e){var t=this.nodes,n=t[0];return t.length&&this.cmp(n,e)<0&&(t[0]=e,e=n,i(t,0,this.cmp)),e},t.exports=r},{}],40:[function(e,t,n){function r(e){e&&this.init(e)}var a=e("./Dependencies").ALL,i=0,o=r.Flags={Router:1,Collector:2,Produces:4,Mutates:8,Reflows:16,Batch:32},s=r.prototype;s.init=function(e){this._id=++i,this._graph=e,this._rank=e.rank(),this._qrank=null,this._stamp=0,this._listeners=[],this._listeners._ids={},this._deps={};for(var t=0,n=a.length;n>t;++t)this._deps[a[t]]=[];return this._flags=0,this},s.rank=function(){return this._rank},s.qrank=function(){return arguments.length?(this._qrank=this._rank,this):this._qrank},s.last=function(e){return arguments.length?(this._stamp=e,this):this._stamp},s._setf=function(e,t){return t?this._flags|=e:this._flags&=~e,this},s.router=function(e){return arguments.length?this._setf(o.Router,e):this._flags&o.Router},s.collector=function(e){return arguments.length?this._setf(o.Collector,e):this._flags&o.Collector},s.produces=function(e){return arguments.length?this._setf(o.Produces,e):this._flags&o.Produces},s.mutates=function(e){return arguments.length?this._setf(o.Mutates,e):this._flags&o.Mutates},s.reflows=function(e){return arguments.length?this._setf(o.Reflows,e):this._flags&o.Reflows},s.batch=function(e){return arguments.length?this._setf(o.Batch,e):this._flags&o.Batch},s.dependency=function(e,t){var n=this._deps[e],r=n._names||(n._names={});if(1===arguments.length)return n;if(null===t)n.splice(0,n.length),n._names={};else if(Array.isArray(t))for(var a,i=0,o=t.length;o>i;++i)a=t[i],r[a]||(n.push(a),r[a]=1);else{if(r[t])return this;n.push(t),r[t]=1}return this},s.listeners=function(){return this._listeners},s.addListener=function(e){if(!(e instanceof r))throw Error("Listener is not a Node");if(this._listeners._ids[e._id])return this;if(this._listeners.push(e),this._listeners._ids[e._id]=1,this._rank>e._rank)for(var t,n=[e],a=this._graph;n.length;)t=n.shift(),t._rank=a.rank(),n.unshift.apply(n,t.listeners());return this},s.removeListener=function(e){if(!this._listeners._ids[e._id])return!1;var t=this._listeners.indexOf(e),n=t>=0;return n&&(this._listeners.splice(t,1),this._listeners._ids[e._id]=null),n},s.disconnect=function(){this._listeners=[],this._listeners._ids={}},s.evaluate=function(e){return e},s.reevaluate=function(e){var t,n,r,i,o,s;for(r=0,i=a.length;i>r;++r)for(t=a[r],n=this._deps[t],o=0,s=n.length;s>o;++o)if(e[t][n[o]])return!0;return!1},r.reset=function(){i=0},t.exports=r},{"./Dependencies":37}],41:[function(e,t,n){function r(e,t,n){return o.init.call(this,e),this._name=t,this._value=n,this._verbose=!1,this._handlers=[],this}var a=e("./ChangeSet"),i=e("./Node"),o=i.prototype,s=r.prototype=Object.create(o);s.constructor=r,s.name=function(){return this._name},s.value=function(e){return arguments.length?(this._value=e,this):this._value},s.values=s.value,s.verbose=function(e){return arguments.length?(this._verbose=!!e,this):this._verbose},s.evaluate=function(e){return e.signals[this._name]?e:this._graph.doNotPropagate},s.fire=function(e){e||(e=a.create(null,!0)),e.signals[this._name]=1,this._graph.propagate(e,this)},s.on=function(e){var t=this,n=new i(this._graph);return n.evaluate=function(n){return e(t.name(),t.value()),n},this._handlers.push({handler:e,node:n}),this.addListener(n)},s.off=function(e){var t,n,r=this._handlers;for(t=r.length;--t>=0;)e&&r[t].handler!==e||(n=r.splice(t,1)[0],this.removeListener(n.node));return this},t.exports=r},{"./ChangeSet":34,"./Node":40}],42:[function(e,t,n){function r(e){return e=e===Object(e)?e:{data:e},e._id=++o,e._prev&&(e._prev=null),e}function a(e,t){t=t||{};for(var n=0,r=e.length;r>n;++n)t[e[n]._id]=1;return t}function i(e,t){t=t||{};for(var n in e)"_prev"!==n&&"_id"!==n&&(t[n]=e[n]);return t}var o=0;t.exports={ingest:r,idMap:a,derive:function(e){return r(i(e))},rederive:function(e,t){return i(e,t)},set:function(e,t,n){return e[t]===n?0:(e[t]=n,1)},prev:function(e){return e._prev||e},prev_init:function(e){e._prev||(e._prev={_id:e._id})},prev_update:function(e){var t,n,r=e._prev;if(r)for(t in e)"_prev"!==t&&"_id"!==t&&(r[t]=(n=e[t])instanceof Object&&n._prev?n._prev:n)},reset:function(){o=0},idFilter:function(e){for(var t={},n=arguments.length;--n>0;)a(arguments[n],t);return e.filter(function(e){return!t[e._id]})}}},{}],43:[function(e,t,n){t.exports={ChangeSet:e("./ChangeSet"),Collector:e("./Collector"),DataSource:e("./DataSource"),Dependencies:e("./Dependencies"),Graph:e("./Graph"),Node:e("./Node"),Signal:e("./Signal"),Tuple:e("./Tuple"),debug:e("vega-logging").debug}},{"./ChangeSet":34,"./Collector":35,"./DataSource":36,"./Dependencies":37,"./Graph":38,"./Node":40,"./Signal":41,"./Tuple":42,"vega-logging":33}],44:[function(e,t,n){function r(e){var t,n,r={};for(t=0,n=e.length;n>t;++t)r[e[t]]=1;return r}function a(e){var t,n=[];for(t in e)n.push(t);return n}t.exports=function(t){function n(e){var t={code:o(e),globals:a(p),fields:a(m)};return p={},m={},t}function i(e){return h+'["'+e+'"]'}function o(e){if("string"==typeof e)return e;var t=g[e.type];if(null==t)throw new Error("Unsupported type: "+e.type);return t(e)}t=t||{};var s=t.constants||e("./constants"),u=(t.functions||e("./functions"))(o),c=t.idWhiteList?r(t.idWhiteList):null,f=t.idBlackList?r(t.idBlackList):null,l=0,d=t.fieldVar||"datum",h=t.globalVar||"signals",p={},m={},g={Literal:function(e){return e.raw},Identifier:function(e){var t=e.name;if(l>0)return t;if(s.hasOwnProperty(t))return s[t];if(c)return c.hasOwnProperty(t)?t:(p[t]=1,i(t));if(f&&f.hasOwnProperty(t))throw new Error("Illegal identifier: "+t);return t},Program:function(e){return e.body.map(o).join("\n")},MemberExpression:function(e){var t=!e.computed,n=o(e.object);t&&(l+=1);var r=o(e.property);return n===d&&(m[r]=1),t&&(l-=1),n+(t?"."+r:"["+r+"]")},CallExpression:function(e){if("Identifier"!==e.callee.type)throw new Error("Illegal callee type: "+e.callee.type); +var t=e.callee.name,n=e.arguments,r=u.hasOwnProperty(t)&&u[t];if(!r)throw new Error("Unrecognized function: "+t);return r instanceof Function?r(n):r+"("+n.map(o).join(",")+")"},ArrayExpression:function(e){return"["+e.elements.map(o).join(",")+"]"},BinaryExpression:function(e){return"("+o(e.left)+e.operator+o(e.right)+")"},UnaryExpression:function(e){return"("+e.operator+o(e.argument)+")"},ConditionalExpression:function(e){return"("+o(e.test)+"?"+o(e.consequent)+":"+o(e.alternate)+")"},LogicalExpression:function(e){return"("+o(e.left)+e.operator+o(e.right)+")"},ObjectExpression:function(e){return"{"+e.properties.map(o).join(",")+"}"},Property:function(e){l+=1;var t=o(e.key);return l-=1,t+":"+o(e.value)},ExpressionStatement:function(e){return o(e.expression)}};return n.functions=u,n.constants=s,n}},{"./constants":45,"./functions":46}],45:[function(e,t,n){t.exports={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"}},{}],46:[function(e,t,n){t.exports=function(e){function t(t,n,r,a){var i=e(n[0]);return r&&(i=r+"("+i+")",0===r.lastIndexOf("new ",0)&&(i="("+i+")")),i+"."+t+(0>a?"":0===a?"()":"("+n.slice(1).map(e).join(",")+")")}function n(e,n,r){return function(a){return t(e,a,n,r)}}var r="new Date",a="String",i="RegExp";return{isNaN:"isNaN",isFinite:"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){if(t.length<3)throw new Error("Missing arguments to clamp function.");if(t.length>3)throw new Error("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",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",a,0),lower:n("toLowerCase",a,0),slice:n("slice",a),substring:n("substring",a),regexp:i,test:n("test",i),"if":function(t){if(t.length<3)throw new Error("Missing arguments to if function.");if(t.length>3)throw new Error("Too many arguments to if function.");var n=t.map(e);return n[0]+"?"+n[1]+":"+n[2]}}}},{}],47:[function(e,t,n){var r=e("./parser"),a=e("./codegen"),i=t.exports={parse:function(e,t){return r.parse("("+e+")",t)},code:function(e){return a(e)},compiler:function(e,t){e=e.slice();var n=a(t),r=e.length,o=function(t){var a=n(i.parse(t));return e[r]='"use strict"; return ('+a.code+");",a.fn=Function.apply(null,e),a};return o.codegen=n,o},functions:e("./functions"),constants:e("./constants")}},{"./codegen":44,"./constants":45,"./functions":46,"./parser":48}],48:[function(e,t,n){t.exports=function(){"use strict";function e(e,t){if(!e)throw new Error("ASSERT: "+t)}function t(e){return e>=48&&57>=e}function n(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function r(e){return"01234567".indexOf(e)>=0}function a(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 i(e){return 10===e||13===e||8232===e||8233===e}function o(e){return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||92===e||e>=128&&Se.NonAsciiIdentifierStart.test(String.fromCharCode(e))}function s(e){return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&Se.NonAsciiIdentifierPart.test(String.fromCharCode(e))}function u(e){switch(e){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function c(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function f(e){if(Te&&c(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e||"let"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function l(){var e,t;for(t=0===Le;Oe>Le;)if(e=ke.charCodeAt(Le),a(e))++Le;else{if(!i(e))break;++Le,13===e&&10===ke.charCodeAt(Le)&&++Le,++Ce,De=Le,t=!0}}function d(e){var t,r,a,i=0;for(r="u"===e?4:2,t=0;r>t;++t){if(!(Oe>Le&&n(ke[Le])))return"";a=ke[Le++],i=16*i+"0123456789abcdef".indexOf(a.toLowerCase())}return String.fromCharCode(i)}function h(){var e,t,r,a;for(e=ke[Le],t=0,"}"===e&&P({},Me.UnexpectedToken,"ILLEGAL");Oe>Le&&(e=ke[Le++],n(e));)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&P({},Me.UnexpectedToken,"ILLEGAL"),65535>=t?String.fromCharCode(t):(r=(t-65536>>10)+55296,a=(t-65536&1023)+56320,String.fromCharCode(r,a))}function p(){var e,t;for(e=ke.charCodeAt(Le++),t=String.fromCharCode(e),92===e&&(117!==ke.charCodeAt(Le)&&P({},Me.UnexpectedToken,"ILLEGAL"),++Le,e=d("u"),e&&"\\"!==e&&o(e.charCodeAt(0))||P({},Me.UnexpectedToken,"ILLEGAL"),t=e);Oe>Le&&(e=ke.charCodeAt(Le),s(e));)++Le,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==ke.charCodeAt(Le)&&P({},Me.UnexpectedToken,"ILLEGAL"),++Le,e=d("u"),e&&"\\"!==e&&s(e.charCodeAt(0))||P({},Me.UnexpectedToken,"ILLEGAL"),t+=e);return t}function m(){var e,t;for(e=Le++;Oe>Le;){if(t=ke.charCodeAt(Le),92===t)return Le=e,p();if(!s(t))break;++Le}return ke.slice(e,Le)}function g(){var e,t,n;return e=Le,t=92===ke.charCodeAt(Le)?p():m(),n=1===t.length?ve.Identifier:f(t)?ve.Keyword:"null"===t?ve.NullLiteral:"true"===t||"false"===t?ve.BooleanLiteral:ve.Identifier,{type:n,value:t,lineNumber:Ce,lineStart:De,start:e,end:Le}}function b(){var e,t,n,r,a=Le,i=ke.charCodeAt(Le),o=ke[Le];switch(i){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Le,Ne.tokenize&&(40===i?Ne.openParenToken=Ne.tokens.length:123===i&&(Ne.openCurlyToken=Ne.tokens.length)),{type:ve.Punctuator,value:String.fromCharCode(i),lineNumber:Ce,lineStart:De,start:a,end:Le};default:if(e=ke.charCodeAt(Le+1),61===e)switch(i){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Le+=2,{type:ve.Punctuator,value:String.fromCharCode(i)+String.fromCharCode(e),lineNumber:Ce,lineStart:De,start:a,end:Le};case 33:case 61:return Le+=2,61===ke.charCodeAt(Le)&&++Le,{type:ve.Punctuator,value:ke.slice(a,Le),lineNumber:Ce,lineStart:De,start:a,end:Le}}}return r=ke.substr(Le,4),">>>="===r?(Le+=4,{type:ve.Punctuator,value:r,lineNumber:Ce,lineStart:De,start:a,end:Le}):(n=r.substr(0,3),">>>"===n||"<<="===n||">>="===n?(Le+=3,{type:ve.Punctuator,value:n,lineNumber:Ce,lineStart:De,start:a,end:Le}):(t=n.substr(0,2),o===t[1]&&"+-<>&|".indexOf(o)>=0||"=>"===t?(Le+=2,{type:ve.Punctuator,value:t,lineNumber:Ce,lineStart:De,start:a,end:Le}):"<>=!+-*%&|^/".indexOf(o)>=0?(++Le,{type:ve.Punctuator,value:o,lineNumber:Ce,lineStart:De,start:a,end:Le}):void P({},Me.UnexpectedToken,"ILLEGAL")))}function y(e){for(var t="";Oe>Le&&n(ke[Le]);)t+=ke[Le++];return 0===t.length&&P({},Me.UnexpectedToken,"ILLEGAL"),o(ke.charCodeAt(Le))&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.NumericLiteral,value:parseInt("0x"+t,16),lineNumber:Ce,lineStart:De,start:e,end:Le}}function v(e){for(var n="0"+ke[Le++];Oe>Le&&r(ke[Le]);)n+=ke[Le++];return(o(ke.charCodeAt(Le))||t(ke.charCodeAt(Le)))&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.NumericLiteral,value:parseInt(n,8),octal:!0,lineNumber:Ce,lineStart:De,start:e,end:Le}}function x(){var n,a,i;if(i=ke[Le],e(t(i.charCodeAt(0))||"."===i,"Numeric literal must start with a decimal digit or a decimal point"),a=Le,n="","."!==i){if(n=ke[Le++],i=ke[Le],"0"===n){if("x"===i||"X"===i)return++Le,y(a);if(r(i))return v(a);i&&t(i.charCodeAt(0))&&P({},Me.UnexpectedToken,"ILLEGAL")}for(;t(ke.charCodeAt(Le));)n+=ke[Le++];i=ke[Le]}if("."===i){for(n+=ke[Le++];t(ke.charCodeAt(Le));)n+=ke[Le++];i=ke[Le]}if("e"===i||"E"===i)if(n+=ke[Le++],i=ke[Le],("+"===i||"-"===i)&&(n+=ke[Le++]),t(ke.charCodeAt(Le)))for(;t(ke.charCodeAt(Le));)n+=ke[Le++];else P({},Me.UnexpectedToken,"ILLEGAL");return o(ke.charCodeAt(Le))&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.NumericLiteral,value:parseFloat(n),lineNumber:Ce,lineStart:De,start:a,end:Le}}function w(){var t,n,a,o,s,u,c,f,l="",p=!1;for(c=Ce,f=De,t=ke[Le],e("'"===t||'"'===t,"String literal must starts with a quote"),n=Le,++Le;Oe>Le;){if(a=ke[Le++],a===t){t="";break}if("\\"===a)if(a=ke[Le++],a&&i(a.charCodeAt(0)))++Ce,"\r"===a&&"\n"===ke[Le]&&++Le,De=Le;else switch(a){case"u":case"x":"{"===ke[Le]?(++Le,l+=h()):(u=Le,s=d(a),s?l+=s:(Le=u,l+=a));break;case"n":l+="\n";break;case"r":l+="\r";break;case"t":l+=" ";break;case"b":l+="\b";break;case"f":l+="\f";break;case"v":l+=" ";break;default:r(a)?(o="01234567".indexOf(a),0!==o&&(p=!0),Oe>Le&&r(ke[Le])&&(p=!0,o=8*o+"01234567".indexOf(ke[Le++]),"0123".indexOf(a)>=0&&Oe>Le&&r(ke[Le])&&(o=8*o+"01234567".indexOf(ke[Le++]))),l+=String.fromCharCode(o)):l+=a}else{if(i(a.charCodeAt(0)))break;l+=a}}return""!==t&&P({},Me.UnexpectedToken,"ILLEGAL"),{type:ve.StringLiteral,value:l,octal:p,startLineNumber:c,startLineStart:f,lineNumber:Ce,lineStart:De,start:n,end:Le}}function _(e,t){var n,r=e;t.indexOf("u")>=0&&(r=r.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(e,t){return parseInt(t,16)<=1114111?"x":void P({},Me.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{n=new RegExp(r)}catch(a){P({},Me.InvalidRegExp)}try{return new RegExp(e,t)}catch(i){return null}}function M(){var t,n,r,a,o;for(t=ke[Le],e("/"===t,"Regular expression literal must start with a slash"),n=ke[Le++],r=!1,a=!1;Oe>Le;)if(t=ke[Le++],n+=t,"\\"===t)t=ke[Le++],i(t.charCodeAt(0))&&P({},Me.UnterminatedRegExp),n+=t;else if(i(t.charCodeAt(0)))P({},Me.UnterminatedRegExp);else if(r)"]"===t&&(r=!1);else{if("/"===t){a=!0;break}"["===t&&(r=!0)}return a||P({},Me.UnterminatedRegExp),o=n.substr(1,n.length-2),{value:o,literal:n}}function S(){var e,t,n,r;for(t="",n="";Oe>Le&&(e=ke[Le],s(e.charCodeAt(0)));)if(++Le,"\\"===e&&Oe>Le)if(e=ke[Le],"u"===e){if(++Le,r=Le,e=d("u"))for(n+=e,t+="\\u";Le>r;++r)t+=ke[r];else Le=r,n+="u",t+="\\u";z({},Me.UnexpectedToken,"ILLEGAL")}else t+="\\",z({},Me.UnexpectedToken,"ILLEGAL");else n+=e,t+=e;return{value:n,literal:t}}function k(){var e,t,n,r;return Ae=null,l(),e=Le,t=M(),n=S(),r=_(t.value,n.value),Ne.tokenize?{type:ve.RegularExpression,value:r,regex:{pattern:t.value,flags:n.value},lineNumber:Ce,lineStart:De,start:e,end:Le}:{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Le}}function T(){var e,t,n,r;return l(),e=Le,t={start:{line:Ce,column:Le-De}},n=k(),t.end={line:Ce,column:Le-De},Ne.tokenize||(Ne.tokens.length>0&&(r=Ne.tokens[Ne.tokens.length-1],r.range[0]===e&&"Punctuator"===r.type&&("/"===r.value||"/="===r.value)&&Ne.tokens.pop()),Ne.tokens.push({type:"RegularExpression",value:n.literal,regex:n.regex,range:[e,Le],loc:t})),n}function L(e){return e.type===ve.Identifier||e.type===ve.Keyword||e.type===ve.BooleanLiteral||e.type===ve.NullLiteral}function C(){var e,t;if(e=Ne.tokens[Ne.tokens.length-1],!e)return T();if("Punctuator"===e.type){if("]"===e.value)return b();if(")"===e.value)return t=Ne.tokens[Ne.openParenToken-1],!t||"Keyword"!==t.type||"if"!==t.value&&"while"!==t.value&&"for"!==t.value&&"with"!==t.value?b():T();if("}"===e.value){if(Ne.tokens[Ne.openCurlyToken-3]&&"Keyword"===Ne.tokens[Ne.openCurlyToken-3].type){if(t=Ne.tokens[Ne.openCurlyToken-4],!t)return b()}else{if(!Ne.tokens[Ne.openCurlyToken-4]||"Keyword"!==Ne.tokens[Ne.openCurlyToken-4].type)return b();if(t=Ne.tokens[Ne.openCurlyToken-5],!t)return T()}return b()}return T()}return"Keyword"===e.type&&"this"!==e.value?T():b()}function D(){var e;return l(),Le>=Oe?{type:ve.EOF,lineNumber:Ce,lineStart:De,start:Le,end:Le}:(e=ke.charCodeAt(Le),o(e)?g():40===e||41===e||59===e?b():39===e||34===e?w():46===e?t(ke.charCodeAt(Le+1))?x():b():t(e)?x():Ne.tokenize&&47===e?C():b())}function O(){var e,t,n,r;return l(),e={start:{line:Ce,column:Le-De}},t=D(),e.end={line:Ce,column:Le-De},t.type!==ve.EOF&&(n=ke.slice(t.start,t.end),r={type:xe[t.type],value:n,range:[t.start,t.end],loc:e},t.regex&&(r.regex={pattern:t.regex.pattern,flags:t.regex.flags}),Ne.tokens.push(r)),t}function A(){var e;return e=Ae,Le=e.end,Ce=e.lineNumber,De=e.lineStart,Ae="undefined"!=typeof Ne.tokens?O():D(),Le=e.end,Ce=e.lineNumber,De=e.lineStart,e}function E(){var e,t,n;e=Le,t=Ce,n=De,Ae="undefined"!=typeof Ne.tokens?O():D(),Le=e,Ce=t,De=n}function N(){this.line=Ce,this.column=Le-De}function R(){this.start=new N,this.end=null}function U(e){e.type===ve.StringLiteral?this.start={line:e.startLineNumber,column:e.start-e.startLineStart}:this.start={line:e.lineNumber,column:e.start-e.lineStart},this.end=null}function j(){Le=Ae.start,Ae.type===ve.StringLiteral?(Ce=Ae.startLineNumber,De=Ae.startLineStart):(Ce=Ae.lineNumber,De=Ae.lineStart),Ne.range&&(this.range=[Le,0]),Ne.loc&&(this.loc=new R)}function Y(e){Ne.range&&(this.range=[e.start,0]),Ne.loc&&(this.loc=new U(e))}function F(){var e,t,n,r;return e=Le,t=Ce,n=De,l(),r=Ce!==t,Le=e,Ce=t,De=n,r}function P(t,n){var r,a=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,function(t,n){return e(nLe&&(e.push(ce()),!q(")"));)X(",");return H(")"),e}function ee(){var e,t=new j;return e=A(),L(e)||I(e),t.finishIdentifier(e.value)}function te(){return H("."),ee()}function ne(){var e;return H("["),e=fe(),H("]"),e}function re(){var e,t,n,r,a=Ee.allowIn;for(r=Ae,Ee.allowIn=!0,e=Q();;)if(q("."))n=te(),e=new Y(r).finishMemberExpression(".",e,n);else if(q("("))t=K(),e=new Y(r).finishCallExpression(e,t);else{if(!q("["))break;n=ne(),e=new Y(r).finishMemberExpression("[",e,n)}return Ee.allowIn=a,e}function ae(){var e=re();if(Ae.type===ve.Punctuator&&(q("++")||q("--"))&&!F())throw new Error("Disabled.");return e}function ie(){var e,t,n;if(Ae.type!==ve.Punctuator&&Ae.type!==ve.Keyword)t=ae();else{if(q("++")||q("--"))throw new Error("Disabled.");if(q("+")||q("-")||q("~")||q("!"))n=Ae,e=A(),t=ie(),t=new Y(n).finishUnaryExpression(e.value,t);else{if(W("delete")||W("void")||W("typeof"))throw new Error("Disabled.");t=ae()}}return t}function oe(e,t){var n=0;if(e.type!==ve.Punctuator&&e.type!==ve.Keyword)return 0;switch(e.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":n=7;break;case"in":n=t?7:0;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function se(){var e,t,n,r,a,i,o,s,u,c;if(e=Ae,u=ie(),r=Ae,a=oe(r,Ee.allowIn),0===a)return u;for(r.prec=a,A(),t=[e,Ae],o=ie(),i=[u,r,o];(a=oe(Ae,Ee.allowIn))>0;){for(;i.length>2&&a<=i[i.length-2].prec;)o=i.pop(),s=i.pop().value,u=i.pop(),t.pop(),n=new Y(t[t.length-1]).finishBinaryExpression(s,u,o),i.push(n);r=A(),r.prec=a,i.push(r),t.push(Ae),n=ie(),i.push(n)}for(c=i.length-1,n=i[c],t.pop();c>1;)n=new Y(t.pop()).finishBinaryExpression(i[c-1].value,i[c-2],n),c-=2;return n}function ue(){var e,t,n,r,a;return a=Ae,e=se(),q("?")&&(A(),t=Ee.allowIn,Ee.allowIn=!0,n=ce(),Ee.allowIn=t,H(":"),r=ce(),e=new Y(a).finishConditionalExpression(e,n,r)),e}function ce(){var e,t,n,r;return e=Ee.parenthesisCount,r=Ae,t=Ae,n=ue()}function fe(){var e=ce();if(q(","))throw new Error("Disabled.");return e}function le(e){var t=fe();return B(),e.finishExpressionStatement(t)}function de(){var e,t,n=Ae.type;if(n===ve.EOF&&I(Ae),n===ve.Punctuator&&"{"===Ae.value)throw new Error("Disabled.");if(t=new j,n===ve.Punctuator)switch(Ae.value){case";":throw new Error("Disabled.");case"(":return le(t)}else if(n===ve.Keyword)throw new Error("Disabled.");return e=fe(),B(),t.finishExpressionStatement(e)}function he(){if(Ae.type===ve.Keyword)switch(Ae.value){case"const":case"let":throw new Error("Disabled.");case"function":throw new Error("Disabled.");default:return de()}return Ae.type!==ve.EOF?de():void 0}function pe(){for(var e,t,n,r,a=[];Oe>Le&&(t=Ae,t.type===ve.StringLiteral)&&(e=he(),a.push(e),e.expression.type===we.Literal);)n=ke.slice(t.start+1,t.end-1),"use strict"===n?(Te=!0,r&&z(r,Me.StrictOctalLiteral)):!r&&t.octal&&(r=t);for(;Oe>Le&&(e=he(),"undefined"!=typeof e);)a.push(e);return a}function me(){var e,t;return l(),E(),t=new j,Te=!0,e=pe(),t.finishProgram(e)}function ge(){var e,t,n,r=[];for(e=0;e0?1:0,De=0,Oe=ke.length,Ae=null,Ee={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},Ne={},t=t||{},t.tokens=!0,Ne.tokens=[],Ne.tokenize=!0,Ne.openParenToken=-1,Ne.openCurlyToken=-1,Ne.range="boolean"==typeof t.range&&t.range,Ne.loc="boolean"==typeof t.loc&&t.loc,"boolean"==typeof t.tolerant&&t.tolerant&&(Ne.errors=[]);try{if(E(),Ae.type===ve.EOF)return Ne.tokens;for(A();Ae.type!==ve.EOF;)try{A()}catch(a){if(Ne.errors){Ne.errors.push(a);break}throw a}ge(),r=Ne.tokens,"undefined"!=typeof Ne.errors&&(r.errors=Ne.errors)}catch(i){throw i}finally{Ne={}}return r}function ye(e,t){var n,r;r=String,"string"==typeof e||e instanceof String||(e=r(e)),ke=e,Le=0,Ce=ke.length>0?1:0,De=0,Oe=ke.length,Ae=null,Ee={allowIn:!0,labelSet:{},parenthesisCount:0,inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},Ne={},"undefined"!=typeof t&&(Ne.range="boolean"==typeof t.range&&t.range,Ne.loc="boolean"==typeof t.loc&&t.loc,Ne.loc&&null!==t.source&&void 0!==t.source&&(Ne.source=r(t.source)),"boolean"==typeof t.tokens&&t.tokens&&(Ne.tokens=[]),"boolean"==typeof t.tolerant&&t.tolerant&&(Ne.errors=[]));try{n=me(),"undefined"!=typeof Ne.tokens&&(ge(),n.tokens=Ne.tokens),"undefined"!=typeof Ne.errors&&(n.errors=Ne.errors)}catch(a){throw a}finally{Ne={}}return n}var ve,xe,we,_e,Me,Se,ke,Te,Le,Ce,De,Oe,Ae,Ee,Ne;ve={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9},xe={},xe[ve.BooleanLiteral]="Boolean",xe[ve.EOF]="",xe[ve.Identifier]="Identifier",xe[ve.Keyword]="Keyword",xe[ve.NullLiteral]="Null",xe[ve.NumericLiteral]="Numeric",xe[ve.Punctuator]="Punctuator",xe[ve.StringLiteral]="String",xe[ve.RegularExpression]="RegularExpression",we={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpression",ConditionalExpression:"ConditionalExpression",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",UnaryExpression:"UnaryExpression"},_e={Data:1,Get:2,Set:4},Me={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},Se={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},Y.prototype=j.prototype={finish:function(){Ne.range&&(this.range[1]=Le),Ne.loc&&(this.loc.end=new N,Ne.source&&(this.loc.source=Ne.source))},finishArrayExpression:function(e){return this.type=we.ArrayExpression,this.elements=e,this.finish(),this},finishAssignmentExpression:function(e,t,n){return this.type=we.AssignmentExpression,this.operator=e,this.left=t,this.right=n,this.finish(),this},finishBinaryExpression:function(e,t,n){return this.type="||"===e||"&&"===e?we.LogicalExpression:we.BinaryExpression,this.operator=e,this.left=t,this.right=n,this.finish(),this},finishCallExpression:function(e,t){return this.type=we.CallExpression,this.callee=e,this.arguments=t,this.finish(),this},finishConditionalExpression:function(e,t,n){return this.type=we.ConditionalExpression,this.test=e,this.consequent=t,this.alternate=n,this.finish(),this},finishExpressionStatement:function(e){return this.type=we.ExpressionStatement,this.expression=e,this.finish(),this},finishIdentifier:function(e){return this.type=we.Identifier,this.name=e,this.finish(),this},finishLiteral:function(e){return this.type=we.Literal,this.value=e.value,this.raw=ke.slice(e.start,e.end),e.regex&&("//"==this.raw&&(this.raw="/(?:)/"),this.regex=e.regex),this.finish(),this},finishMemberExpression:function(e,t,n){return this.type=we.MemberExpression,this.computed="["===e,this.object=t,this.property=n,this.finish(),this},finishObjectExpression:function(e){return this.type=we.ObjectExpression,this.properties=e,this.finish(),this},finishProgram:function(e){return this.type=we.Program,this.body=e,this.finish(),this},finishProperty:function(e,t,n){return this.type=we.Property,this.key=t,this.value=n,this.kind=e,this.finish(),this},finishUnaryExpression:function(e,t){return this.type=we.UnaryExpression,this.operator=e,this.argument=t,this.prefix=!0,this.finish(),this}};var Re={"if":1,"this":1};return{tokenize:be,parse:ye}}()},{}],49:[function(e,t,n){var r=e("vega-expression"),a=["datum","event","signals"];t.exports=r.compiler(a,{idWhiteList:a,fieldVar:a[0],globalVar:a[2],functions:function(e){var t=r.functions(e);return t.eventItem=function(){return"event.vg.item"},t.eventGroup="event.vg.getGroup",t.eventX="event.vg.getX",t.eventY="event.vg.getY",t.open="window.open",t}})},{"vega-expression":47}],50:[function(e,t,n){function r(e){return l.prototype.init.call(this,e),l.addParameters(this,{groupby:{type:"array"},summarize:{type:"custom",set:function(e){function t(e){e.signal&&(c[e.signal]=1)}var n,r,a,o,s,u,c={},l=this._transform;if(!i.isArray(o=e)){o=[];for(s in e)u=i.array(e[s]),o.push({field:s,ops:u})}for(n=0,r=o.length;r>n;++n)a=o[n],a.field.signal&&(c[a.field.signal]=1),i.array(a.ops).forEach(t),i.array(a.as).forEach(t);return l._fields=o,l._aggr=null,l.dependency(f.SIGNALS,i.keys(c)),l}}}),this._aggr=null,this._input=null,this._args=null,this._fields=[],this._out=[],this._type=p.TUPLE,this._acc={groupby:i["true"],value:i["true"]},this.router(!0).produces(!0)}function a(e){var t,n,r,a,i,o,s,u=[];for(i=e._dims,t=0,n=i.length;n>t;++t)u.push(i[t].name);for(o=e._aggr,t=0,n=o.length;n>t;++t)for(s=o[t].measures.fields,r=0,a=s.length;a>r;++r)u.push(s[r]);return u}var i=e("datalib"),o=e("vega-dataflow"),s=e("vega-logging"),u=o.ChangeSet,c=o.Tuple,f=o.Dependencies,l=e("./Transform"),d=e("./Facetor"),h=r.prototype=Object.create(l.prototype);h.constructor=r;var p=r.TYPES={VALUE:1,TUPLE:2,MULTI:3};r.VALID_OPS=["values","count","valid","missing","distinct","sum","mean","average","variance","variancep","stdev","stdevp","median","q1","q3","modeskew","min","max","argmin","argmax"],h.type=function(e){return this._type=e,this},h.accessors=function(e,t){var n=this._acc;n.groupby=i.$(e)||i["true"],n.value=i.$(t)||i["true"]},h.aggr=function(){if(this._aggr)return this._aggr;var e=this._graph,t=!1,n=[],r=this.param("groupby").field,o=function(t){return t.signal?e.signalRef(t.signal):t},s=this._fields.map(function(e){var r={name:o(e.field),as:i.array(e.as),ops:i.array(o(e.ops)).map(o),get:e.get};return t=t||null!=r.get,n.push(r.name),r});r.forEach(function(e){e.get&&(t=!0),n.push(e.name||e)}),this._args=t||!s.length?null:n,s.length||(s={"*":"values"});var u=this._aggr=(new d).groupby(r).stream(!0).summarize(s);return this._out=a(u),this._type!==p.VALUE&&u.key("_id"),u},h.transform=function(e,t){s.debug(e,["aggregate"]);var n,r,a,i,o=u.create(e),f=this.aggr(),l=this._out,d=this._args,h=!0,m=c.prev;if(t&&(o.rem.push.apply(o.rem,f.result()),f.clear(),this._aggr=null,f=this.aggr()),this._type===p.TUPLE)n=function(e){f._add(e),c.prev_init(e)},r=function(e){f._rem(m(e))},a=function(e){f._mod(e,m(e))};else{var g=this._acc.groupby,b=this._acc.value,y=this._type===p.VALUE?b:function(e){return{_id:e._id,groupby:g(e),value:b(e)}};n=function(e){f._add(y(e)),c.prev_init(e)},r=function(e){f._rem(y(m(e)))},a=function(e){f._mod(y(e),y(m(e)))}}if(e.add.forEach(n),t)e.mod.forEach(n);else{if(e.rem.forEach(r),d)for(i=0,h=!1;ithis.config("maxSmallNumber")?"largeNumberFormat":"smallNumberFormat";return this.config(t)},t.sort=function(t,n){var r=this._enc[t].sort,a=this._enc,o=i.isTypes;if((!r||0===r.length)&&e.toggleSort.support({encoding:this._enc},n,!0)&&this.config("toggleSort")===Q){var s=o(a.x,[N,O])?a.y:a.x;o(a[t],[N,O])&&(r=[{name:s.name,aggregate:s.aggregate,type:s.type,reverse:!0}])}return r},t.map=function(e){return o.map(this._enc,e)},t.reduce=function(e,t){return o.reduce(this._enc,e,t)},t.forEach=function(e){return o.forEach(this._enc,e)},t.type=function(e){return this.has(e)?this._enc[e].type:null},t.isType=function(e,t){var n=this.encDef(e);return n&&i.isType(n,t)},t.isTypes=function(e,t){var n=this.encDef(e);return n&&i.isTypes(n,t)},e.isOrdinalScale=function(e,t){return i.isOrdinalScale(e.encDef(t))},e.isDimension=function(e,t){return i.isDimension(e.encDef(t))},e.isMeasure=function(e,t){return i.isMeasure(e.encDef(t))},t.isOrdinalScale=function(t){return this.has(t)&&e.isOrdinalScale(this,t)},t.isDimension=function(t){return this.has(t)&&e.isDimension(this,t)},t.isMeasure=function(t){return this.has(t)&&e.isMeasure(this,t)},t.isAggregate=function(){return o.isAggregate(this._enc)},t.dataTable=function(){return this.isAggregate()?AGGREGATE:RAW},e.isAggregate=function(e){return o.isAggregate(e.encoding)},e.alwaysNoOcclusion=function(e){return o.isAggregate(e.encoding)},e.isStack=function(e){return("bar"===e.marktype||"area"===e.marktype)&&e.encoding.color},t.stack=function(){var e=this.has(COLOR)&&this.encDef(COLOR).stack?COLOR:this.has(DETAIL)&&this.encDef(DETAIL).stack?DETAIL:null,t=e&&this.encDef(e).stack!==!0?this.encDef(e).stack:{};if((this.is("bar")||this.is("area"))&&e&&this.isAggregate()){var n=this.isMeasure(X),r=this.isMeasure(Y);if(n&&!r)return{groupby:Y,value:X,stack:e,properties:t};if(r&&!n)return{groupby:X,value:Y,stack:e,properties:t}}return null},t.details=function(){var e=this;return this.reduce(function(t,n,r){return n.aggregate||r===X||r===Y||t.push(e.fieldRef(r)),t},[])},t.facets=function(){var e=this;return this.reduce(function(t,n,r){return n.aggregate||r!=ROW&&r!=COL||t.push(e.fieldRef(r)),t},[])},t.cardinality=function(e,t){return i.cardinality(this.encDef(e),t,this.config("filterNull"))},t.isRaw=function(){return!this.isAggregate()},t.data=function(){return this._data},t.hasValues=function(){var e=this.data().values;return e&&e.length},t.config=function(e){return this._config[e]},e.transpose=function(e){var t=e.encoding,n=a.duplicate(e.encoding);return n.x=t.y,n.y=t.x,n.row=t.col,n.col=t.row,e.encoding=n,e},e}()},{"./consts":67,"./enc":69,"./encdef":70,"./globals":71,"./schema/schema":73,"./util":75}],55:[function(e,t,n){"use strict";e("../globals");var r=e("../util"),a=r.setter,i=r.getter,o=e("./time"),s=t.exports={};s.def=function(e,t,n,r,a){var o=e==COL,u=e==ROW,c=o?"x":u?"y":e,f={type:c,scale:e,properties:{},layer:t.encDef(e).axis.layer},l=s.orient(t,e,r);return l&&(f.orient=l),f=s.labels.scale(f,t,e),f=s.labels.format(f,t,e,r),f=s.labels.angle(f,t,e),e==X&&(!t.isDimension(X)&&!t.isType(X,T)||"angle"in i(f,["properties","labels"])?f.ticks=t.encDef(e).axis.ticks:f=s.labels.rotate(f)),f.titleOffset=s.titleOffset(t,n,e),u&&(f.offset=s.titleOffset(t,n,Y)+20),f=s.grid(f,t,e,n),f=s.title(f,t,e,n,a),(u||o)&&(f=s.hideTicks(f)),f},s.orient=function(e,t,n){var r=e.encDef(t).axis.orient;return r?r:t===COL?"top":t===X&&e.has(Y)&&e.isOrdinalScale(Y)&&e.cardinality(Y,n)>30?"top":void 0},s.grid=function(e,t,n,r){var a=r.cellPadding,i=n==COL,o=n==ROW,s=t.axis(n).grid,u=void 0===s?n===ROW||n===COL||t.isTypes(n,[Q,T]):s;if(u)if(e.grid=!0,i){var c=t.config("cellGridOffset");e.properties.grid={x:{offset:r.cellWidth*(1+a/2),scale:"col",field:"data"},y:{value:-c},y2:{field:{group:"mark.group.height"},offset:c},stroke:{value:t.config("cellGridColor")},strokeOpacity:{value:t.config("cellGridOpacity")}}}else if(o){var f=t.config("cellGridOffset");e.properties.grid={y:{offset:-r.cellHeight*(a/2),scale:"row",field:"data"},x:{value:e.offset-f},x2:{field:{group:"mark.group.width"},offset:e.offset+f,mult:1},stroke:{value:t.config("cellGridColor")},strokeOpacity:{value:t.config("cellGridOpacity")}}}else e.properties.grid={stroke:{value:t.config("gridColor")},strokeOpacity:{value:t.config("gridOpacity")}};return e},s.hideTicks=function(e){return e.properties.ticks={opacity:{value:0}},e.properties.majorTicks={opacity:{value:0}},e.properties.axis={opacity:{value:0}},e},s.title=function(e,t,n,a){var i=t.encDef(n).axis;if(i.title)e.title=i.title;else{var o,s=t.fieldTitle(n);i.titleMaxLength?o=i.titleMaxLength:n===X?o=a.cellWidth/t.config("characterWidth"):n===Y&&(o=a.cellHeight/t.config("characterWidth")),e.title=o?r.truncate(s,o):s}return n===ROW&&(e.properties.title={angle:{value:0},align:{value:"right"},baseline:{value:"middle"},dy:{value:-a.height/2-20}}),e},s.labels={},s.labels.scale=function(e,t,n){var r=t.encDef(n).timeUnit;return t.isType(n,T)&&r&&o.hasScale(r)&&a(e,["properties","labels","text","scale"],"time-"+r),e},s.labels.format=function(e,t,n,r){var i=r[t.encDef(n).name];if(t.axis(n).format)e.format=t.axis(n).format;else if(t.isType(n,Q)||"number"===i.type)e.format=t.numberFormat(i);else if(t.isType(n,T)){var o=t.encDef(n).timeUnit;o?"year"===o&&(e.format="d"):e.format=t.config("timeFormat")}else t.isTypes(n,[N,O])&&t.axis(n).maxLabelLength&&a(e,["properties","labels","text","template"],"{{ datum.data | truncate:"+t.axis(n).maxLabelLength+"}}");return e},s.labels.angle=function(e,t,n){var r=t.axis(n).labelAngle;return"undefined"==typeof r?e:(a(e,["properties","labels","angle","value"],r),e)},s.labels.rotate=function(e){var t="top"===e.orient?"left":"right";return a(e,["properties","labels","angle","value"],270),a(e,["properties","labels","align","value"],t),a(e,["properties","labels","baseline","value"],"middle"),e},s.titleOffset=function(e,t,n){var r=e.axis(n).titleOffset;if(r)return r;switch(n){case ROW:return 0;case COL:return 35}return i(t,[n,"axisTitleOffset"])}},{"../globals":71,"../util":75,"./time":66}],56:[function(e,t,n){"use strict";var r=t.exports=e("datalib/src/stats").summary;e("../globals");var a=t.exports={},i=e("../Encoding"),o=a.axis=e("./axis"),s=a.legend=e("./legend"),u=a.marks=e("./marks"),c=a.scale=e("./scale");a.data=e("./data"),a.facet=e("./facet"),a.layout=e("./layout"),a.stack=e("./stack"),a.style=e("./style"),a.subfacet=e("./subfacet"),a.time=e("./time"),a.compile=function(e,t,n){return a.compileEncoding(i.fromSpec(e,n),t)},a.shorthand=function(e,t,n,r){return a.compileEncoding(i.fromShorthand(e,n,r),t)},a.compileEncoding=function(e,t){t||(e.hasValues()?t=r(e.data().values).reduce(function(e,t){return e[t.field]=t,e},{}):console.error("No stats provided and data is not embedded."));var n=a.layout(e,t),i={width:n.width,height:n.height,padding:"auto",data:a.data(e),scales:a.time.scales(e),marks:[{name:"cell",type:"group",properties:{enter:{width:n.cellWidth?{value:n.cellWidth}:{field:{group:"width"}},height:n.cellHeight?{value:n.cellHeight}:{field:{group:"height"}}}}}]},f=i.marks[0],l=a.style(e,t),d=f.marks=u.def(e,n,l,t),h=d[d.length-1],p=e.stack();p&&a.stack(e,h,p);var m=u[e.marktype()].line,g=e.details();if(g.length>0&&m&&a.subfacet(f,h,g,e),m&&e.config("autoSortLine")){var b=e.isMeasure(X)&&e.isDimension(Y)?Y:X;h.from||(h.from={}),h.from.transform=[{type:"sort",by:"-"+e.fieldRef(b)}]}var y=[].concat.apply([],d.map(function(e){return c.names(e.properties.update)}));return e.has(ROW)||e.has(COL)?(i=a.facet(f,e,n,i,y,t),i.legends=s.defs(e,l)):(f.scales=c.defs(y,e,n,t),f.axes=[],e.has(X)&&f.axes.push(o.def(X,e,n,t)),e.has(Y)&&f.axes.push(o.def(Y,e,n,t)),f.legends=s.defs(e,l)),i}},{"../Encoding":54,"../globals":71,"./axis":55,"./data":57,"./facet":58,"./layout":59,"./legend":60,"./marks":61,"./scale":62,"./stack":63,"./style":64,"./subfacet":65,"./time":66,"datalib/src/stats":29}],57:[function(e,t,n){"use strict";function r(e){var t=[r.raw(e)],n=r.aggregate(e);n&&t.push(r.aggregate(e)),r.filterNonPositive(t[t.length-1],e);var a=e.stack();return a&&t.push(r.stack(e,a)),t}e("../globals"),t.exports=r;var a=e("../encdef"),i=e("../util"),o=e("./time");r.raw=function(e){var t={name:RAW};e.hasValues()?(t.values=e.data().values,t.format={type:"json"}):(t.url=e.data().url,t.format={type:e.data().formatType});var n=r.raw.formatParse(e);return n&&(t.format.parse=n),t.transform=r.raw.transform(e),t},r.raw.formatParse=function(e){var t;return e.forEach(function(e){if(e.type==T)t=t||{},t[e.name]="date";else if(e.type==Q){if(a.isCount(e))return;t=t||{},t[e.name]="number"}}),t},r.raw.transform=function(e){return r.raw.transform.nullFilter(e).concat(r.raw.transform.formula(e),r.raw.transform.time(e),r.raw.transform.bin(e),r.raw.transform.filter(e))},r.raw.transform.time=function(e){return e.reduce(function(t,n,r){if(n.type===T&&n.timeUnit){var a=e.fieldRef(r,{nofn:!0,datum:!0});t.push({type:"formula",field:e.fieldRef(r),expr:o.formula(n.timeUnit,a)})}return t},[])},r.raw.transform.bin=function(e){return e.reduce(function(t,n,r){return e.bin(r)&&t.push({type:"bin",field:n.name,output:{start:e.fieldRef(r)},maxbins:e.bin(r).maxbins}),t},[])},r.raw.transform.nullFilter=function(e){var t=i.reduce(e.fields(),function(t,n,r){return"*"===r?t:((e.config("filterNull").Q&&n.containsType[Q]||e.config("filterNull").T&&n.containsType[T]||e.config("filterNull").O&&n.containsType[O]||e.config("filterNull").N&&n.containsType[N])&&t.push(r),t)},[]);return t.length>0?[{type:"filter",test:t.map(function(e){return"datum."+e+"!==null"}).join(" && ")}]:[]},r.raw.transform.filter=function(e){var t=e.data().filter;return t?[{type:"filter",test:t}]:[]},r.raw.transform.formula=function(e){var t=e.data().formulas;return void 0===t?[]:t.reduce(function(e,t){return t.type="formula",e.push(t),e},[])},r.aggregate=function(e){var t={},n={},r=!1;e.forEach(function(a,i){a.aggregate?(r=!0,"count"===a.aggregate?(n["*"]=n["*"]||{},n["*"].count=!0):(n[a.name]=n[a.name]||{},n[a.name][a.aggregate]=!0)):t[a.name]=e.fieldRef(i)});var a=i.vals(t),o=i.reduce(n,function(e,t,n){return e[n]=i.keys(t),e},{});return r?{name:AGGREGATE,source:RAW,transform:[{type:"aggregate",groupby:a,summarize:o}]}:null},r.stack=function(e,t){var n=t.groupby,r=t.value,a=e.facets(),i={name:STACKED,source:e.dataTable(),transform:[{type:"aggregate",groupby:[e.fieldRef(n)].concat(a),summarize:[{ops:["sum"],field:e.fieldRef(r)}]}]};return a&&a.length>0&&i.transform.push({type:"aggregate",groupby:a,summarize:[{ops:["max"],field:e.fieldRef(r,{prefn:"sum_"})}]}),i},r.filterNonPositive=function(e,t){t.forEach(function(n,r){"log"===t.scale(r).type&&e.transform.push({type:"filter",test:t.fieldRef(r,{datum:1})+" > 0"})})}},{"../encdef":70,"../globals":71,"../util":75,"./time":66}],58:[function(e,t,n){"use strict";function r(e,t){t=t||{};var n={name:e||void 0,type:"group",properties:{enter:{width:t.width||{field:{group:"width"}},height:t.height||{field:{group:"height"}}}}};return t.from&&(n.from=t.from),t.x&&(n.properties.enter.x=t.x),t.y&&(n.properties.enter.y=t.y),t.axes&&(n.axes=t.axes),n}function a(e,t,n,a,u,c){var f,l,d=e.properties.enter,h=[],p=[],m=t.has(ROW),g=t.has(COL);d.fill={value:t.config("cellBackgroundColor")},e.from={data:e.marks[0].from.data};for(var b=0;b0&&(e.axes=p);var v=e.from.transform||(e.from.transform=[]);return v.unshift({type:"facet",groupby:h}),a}e("../globals");var i=e("../util"),o=e("./axis"),s=e("./scale");t.exports=a},{"../globals":71,"../util":75,"./axis":55,"./scale":62}],59:[function(e,t,n){"use strict";function r(e,t){var n=a(e,t);return n=s(e,t,n)}function a(e,t){var n,r,a=e.has(ROW),i=e.has(COL),o=e.has(X),s=e.has(Y),u=e.marktype(),c=o&&e.isDimension(X)?e.cardinality(X,t):1,f=s&&e.isDimension(Y)?e.cardinality(Y,t):1,l=c>e.config("largeBandMaxCardinality")||f>e.config("largeBandMaxCardinality"),d=e.config("cellPadding");n=o?e.isOrdinalScale(X)?(c+e.encDef(X).band.padding)*e.bandSize(X,l):i||a?e.encDef(COL).width:e.config("singleWidth"):u===TEXT?e.config("textCellWidth"):e.bandSize(X),r=s?e.isOrdinalScale(Y)?(f+e.encDef(Y).band.padding)*e.bandSize(Y,l):i||a?e.encDef(ROW).height:e.config("singleHeight"):e.bandSize(Y);var h=n,p=r;if(i){var m=e.cardinality(COL,t);h=n*((1+d)*(m-1)+1)}if(a){var g=e.cardinality(ROW,t);p=r*((1+d)*(g-1)+1)}return{cellWidth:n,cellHeight:r,cellPadding:d,width:h,height:p,x:{useSmallBand:l},y:{useSmallBand:l}}}function i(e,t,n){var r=e.numberFormat(t,n);return l.format(r)(n.max).length}function o(e,t,n){var r=e.encDef(n),a=t[r.name];return r.bin?i(e,n,a):e.isType(n,Q)?i(e,n,a):e.isType(n,T)?f.maxLength(e.encDef(n).timeUnit,e):e.isTypes(n,[N,O])?"number"===a.type?i(e,n,a):Math.min(a.max,e.axis(n).maxLabelLength||1/0):void 0}function s(e,t,n){return[X,Y].forEach(function(r){var a,i=r===X?20:22;e.isDimension(r)||e.isType(r,T)?a=o(e,t,r):(e.isType(r,Q)||"count"===e.encDef(r).aggregate)&&r===Y&&(a=o(e,t,r)),a?c(n,[r,"axisTitleOffset"],e.config("characterWidth")*a+i):c(n,[r,"axisTitleOffset"],3*e.config("characterWidth")+i)}),n}e("../globals");var u=e("../util"),c=u.setter,f=e("./time"),l=e("d3-format");t.exports=r},{"../globals":71,"../util":75,"./time":66,"d3-format":5}],60:[function(e,t,n){"use strict";e("../globals");var r=e("./time"),a=e("../util"),i=a.setter,o=a.getter,s=t.exports={};s.defs=function(e,t){var n=[];return e.has(COLOR)&&e.encDef(COLOR).legend&&n.push(s.def(COLOR,e,{fill:COLOR},t)),e.has(SIZE)&&e.encDef(SIZE).legend&&n.push(s.def(SIZE,e,{size:SIZE},t)),e.has(SHAPE)&&e.encDef(SHAPE).legend&&n.push(s.def(SHAPE,e,{shape:SHAPE},t)),n},s.def=function(e,t,n,a){var o=t.encDef(e).timeUnit;return n.title=s.title(e,t),n.orient=t.encDef(e).legend.orient,n=s.style(e,t,n,a),t.isType(e,T)&&o&&r.hasScale(o)&&i(n,["properties","labels","text","scale"],"time-"+o),n},s.style=function(e,t,n,r){var a=o(n,["properties","symbols"]),i=t.marktype();switch(i){case"bar":case"tick":case"text":a.stroke={value:"transparent"},a.shape={value:"square"};break;case"circle":case"square":a.shape={value:i};case"point":t.encDef(SHAPE).filled?(t.has(COLOR)&&e===COLOR?a.fill={scale:COLOR,field:"data"}:a.fill={value:t.value(COLOR)},a.stroke={value:"transparent"}):(t.has(COLOR)&&e===COLOR?a.stroke={scale:COLOR,field:"data"}:a.stroke={value:t.value(COLOR)},a.fill={value:"transparent"},a.strokeWidth={value:t.config("strokeWidth")});break;case"line":case"area":}var s=t.encDef(COLOR).opacity||r.opacity;return s&&(a.opacity={value:s}),n},s.title=function(e,t){var n=t.encDef(e).legend;return n.title?n.title:t.fieldTitle(e)}},{"../globals":71,"../util":75,"./time":66}],61:[function(e,t,n){"use strict";function r(e,t,n){var r={};e.isMeasure(X)?(r.x={scale:X,field:e.fieldRef(X)},(!e.has(Y)||e.isDimension(Y))&&(r.x2={value:0})):e.has(X)?r.xc={scale:X,field:e.fieldRef(X)}:r.x={value:0,offset:e.config("singleBarOffset")},r.x2||(!e.has(X)||e.isOrdinalScale(X)?e.has(SIZE)?r.width={scale:SIZE,field:e.fieldRef(SIZE)}:r.width={value:e.bandSize(X,t.x.useSmallBand),offset:-1}:r.width={value:2}),e.isMeasure(Y)?(r.y={scale:Y,field:e.fieldRef(Y)},r.y2={field:{group:"height"}}):(e.has(Y)?r.yc={scale:Y,field:e.fieldRef(Y)}:r.y2={field:{group:"height"},offset:-e.config("singleBarOffset")},e.has(SIZE)?r.height={scale:SIZE,field:e.fieldRef(SIZE)}:r.height={value:e.bandSize(Y,t.y.useSmallBand),offset:-1}),e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:r.fill={value:e.value(COLOR)};var a=e.encDef(COLOR).opacity;return a&&(r.opacity={value:a}),r}function a(e,t,n){var r={};e.has(X)?r.x={scale:X,field:e.fieldRef(X)}:e.has(X)||(r.x={value:e.bandSize(X,t.x.useSmallBand)/2}),e.has(Y)?r.y={scale:Y,field:e.fieldRef(Y)}:e.has(Y)||(r.y={value:e.bandSize(Y,t.y.useSmallBand)/2}),e.has(SIZE)?r.size={scale:SIZE,field:e.fieldRef(SIZE)}:e.has(SIZE)||(r.size={value:e.value(SIZE)}),e.has(SHAPE)?r.shape={scale:SHAPE,field:e.fieldRef(SHAPE)}:e.has(SHAPE)||(r.shape={value:e.value(SHAPE)}),e.encDef(SHAPE).filled?e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.fill={value:e.value(COLOR)}):(e.has(COLOR)?r.stroke={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.stroke={value:e.value(COLOR)}),r.strokeWidth={value:e.config("strokeWidth")});var a=e.encDef(COLOR).opacity||n.opacity;return a&&(r.opacity={value:a}),r}function i(e,t,n){var r={};e.has(X)?r.x={scale:X,field:e.fieldRef(X)}:e.has(X)||(r.x={value:0}),e.has(Y)?r.y={scale:Y,field:e.fieldRef(Y)}:e.has(Y)||(r.y={field:{group:"height"}}),e.has(COLOR)?r.stroke={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.stroke={value:e.value(COLOR)});var a=e.encDef(COLOR).opacity;return a&&(r.opacity={value:a}),r.strokeWidth={value:e.config("strokeWidth")},r}function o(e,t,n){var r={};e.isMeasure(X)?(r.x={scale:X,field:e.fieldRef(X)},e.isDimension(Y)&&(r.x2={scale:X,value:0},r.orient={value:"horizontal"})):e.has(X)?r.x={scale:X,field:e.fieldRef(X)}:r.x={value:0},e.isMeasure(Y)?(r.y={scale:Y,field:e.fieldRef(Y)},r.y2={scale:Y,value:0}):e.has(Y)?r.y={scale:Y,field:e.fieldRef(Y)}:r.y={field:{group:"height"}},e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:e.has(COLOR)||(r.fill={value:e.value(COLOR)});var a=e.encDef(COLOR).opacity;return a&&(r.opacity={value:a}),r}function s(e,t,n){var r={};e.has(X)?(r.x={scale:X,field:e.fieldRef(X)},e.isDimension(X)&&(r.x.offset=-e.bandSize(X,t.x.useSmallBand)/3)):e.has(X)||(r.x={value:0}),e.has(Y)?(r.y={scale:Y,field:e.fieldRef(Y)},e.isDimension(Y)&&(r.y.offset=-e.bandSize(Y,t.y.useSmallBand)/3)):e.has(Y)||(r.y={value:0}),!e.has(X)||e.isDimension(X)?r.width={value:e.bandSize(X,t.y.useSmallBand)/1.5}:r.width={value:1},!e.has(Y)||e.isDimension(Y)?r.height={value:e.bandSize(Y,t.y.useSmallBand)/1.5}:r.height={value:1},e.has(COLOR)?r.fill={scale:COLOR,field:e.fieldRef(COLOR)}:r.fill={value:e.value(COLOR)};var a=e.encDef(COLOR).opacity||n.opacity;return a&&(r.opacity={value:a}),r}function u(e){return function(t,n,r){var a={};t.has(X)?a.x={scale:X,field:t.fieldRef(X)}:t.has(X)||(a.x={value:t.bandSize(X,n.x.useSmallBand)/2}),t.has(Y)?a.y={scale:Y,field:t.fieldRef(Y)}:t.has(Y)||(a.y={value:t.bandSize(Y,n.y.useSmallBand)/2}),t.has(SIZE)?a.size={scale:SIZE,field:t.fieldRef(SIZE)}:t.has(X)||(a.size={value:t.value(SIZE)}),a.shape={value:e},t.has(COLOR)?a.fill={scale:COLOR,field:t.fieldRef(COLOR)}:t.has(COLOR)||(a.fill={value:t.value(COLOR)});var i=t.encDef(COLOR).opacity||r.opacity;return i&&(a.opacity={value:i}),a}}function c(e,t,n,r){var a={},i=e.encDef(TEXT);e.has(X)?a.x={scale:X,field:e.fieldRef(X)}:e.has(X)||(e.has(TEXT)&&e.isType(TEXT,Q)?a.x={value:t.cellWidth-5}:a.x={value:e.bandSize(X,t.x.useSmallBand)/2}),e.has(Y)?a.y={scale:Y,field:e.fieldRef(Y)}:e.has(Y)||(a.y={value:e.bandSize(Y,t.y.useSmallBand)/2}),e.has(SIZE)?a.fontSize={scale:SIZE,field:e.fieldRef(SIZE)}:e.has(SIZE)||(a.fontSize={value:i.font.size}),a.fill={value:i.color};var o=e.encDef(COLOR).opacity||n.opacity;if(o&&(a.opacity={value:o}),e.has(TEXT))if(e.isType(TEXT,Q)){var s=r[e.encDef(TEXT).name],u=i.format||e.numberFormat(s);a.text={template:"{{"+e.fieldRef(TEXT,{datum:!0})+" | number:'"+u+"'}}"},a.align={value:i.align}}else a.text={field:e.fieldRef(TEXT)};else a.text={value:i.placeholder};return a.font={value:i.font.family},a.fontWeight={value:i.font.weight},a.fontStyle={value:i.font.style},a.baseline={value:i.baseline},a}e("../globals");var f=t.exports={};f.def=function(e,t,n,r){var a=[],i=f[e.marktype()],o=e.dataTable();if(e.marktype()===TEXT&&e.has(COLOR)){var s={x:{value:0},y:{value:0},x2:{value:t.cellWidth},y2:{value:t.cellHeight},fill:{scale:COLOR,field:e.fieldRef(COLOR)}};a.push({type:"rect",from:{data:o},properties:{enter:s,update:s}})}var u=i.prop(e,t,n,r);return a.push({type:i.type,from:{data:o},properties:{enter:u,update:u}}),a},f.bar={type:"rect",prop:r,supportedEncoding:{row:1,col:1,x:1,y:1,size:1,color:1}},f.line={type:"line",line:!0,prop:i,requiredEncoding:["x","y"],supportedEncoding:{row:1,col:1,x:1,y:1,color:1,detail:1}},f.area={type:"area",line:!0,requiredEncoding:["x","y"],prop:o,supportedEncoding:{row:1,col:1,x:1,y:1,color:1}},f.tick={type:"rect",prop:s,supportedEncoding:{row:1,col:1,x:1,y:1,color:1,detail:1}},f.circle={type:"symbol",prop:u("circle"),supportedEncoding:{row:1,col:1,x:1,y:1,size:1,color:1,detail:1}},f.square={type:"symbol",prop:u("square"),supportedEncoding:f.circle.supportedEncoding},f.point={type:"symbol",prop:a,supportedEncoding:{row:1,col:1,x:1,y:1,size:1,color:1,shape:1,detail:1}},f.text={type:"text",prop:c,requiredEncoding:["text"],supportedEncoding:{row:1,col:1,size:1,color:1,text:1}}},{"../globals":71}],62:[function(e,t,n){"use strict";e("../globals");var r=e("../util"),a=e("./time"),i=e("colorbrewer"),o=e("d3-color").interpolateHsl,s=e("../schema/schema"),u=t.exports={};u.names=function(e){return r.keys(r.keys(e).reduce(function(t,n){return e[n]&&e[n].scale&&(t[e[n].scale]=1),t},{}))},u.defs=function(e,t,n,r,a){return e.reduce(function(e,i){var o={};o.name=i,o.type=u.type(i,t),o.domain=u.domain(t,i,o.type,r,a);var s=u.reverse(t,i);return s&&(o.reverse=s),o=u.range(o,t,n,r),e.push(o),e},[])},u.type=function(e,t){switch(t.type(e)){case N:case O:return"ordinal";case T:var n=t.encDef(e).timeUnit;return n?a.scale.type(n,e):"time";case Q:return t.bin(e)?e===COLOR?"linear":"ordinal":t.scale(e).type}},u.domain=function(e,t,n,i,o){var c=e.encDef(t);if(e.isType(t,T)){var f=a.scale.domain(c.timeUnit,t);if(f)return f}if(c.bin){var l=i[c.name],d=r.getbins(l,c.bin.maxbins||s.MAXBINS_DEFAULT),h=(d.stop-d.start)/d.step;return r.range(h).map(function(e){return d.start+d.step*e})}var p=e.stack();if(p&&t===p.value)return{data:STACKED,field:e.fieldRef(t,{prefn:(o?"max_":"")+"sum_"})};var m=u._useRawDomain(e,t),g=u.sort(e,t,n);return m?{data:RAW,field:e.fieldRef(t,{noAggregate:!0})}:g?{data:g.op?RAW:e.dataTable(),field:e.fieldRef(t),sort:g}:{data:e.dataTable(),field:e.fieldRef(t)}},u.sort=function(e,t,n){var a=e.encDef(t).sort;return"ascending"===a||"descending"===a?!0:"ordinal"===n&&r.isObject(a)?{op:a.op,field:a.field}:void 0},u.reverse=function(e,t){var n=e.encDef(t).sort;return n&&("descending"===n||"descending"===n.order)},u._useRawDomain=function(e,t){var n=e.encDef(t),r=e.scale(t).useRawDomain,i=void 0!==r?r:e.config("useRawDomain"),o=!n.aggregate||"count"!==n.aggregate&&"sum"!==n.aggregate;return i&&o&&(e.isType(t,Q)&&!n.bin||e.isType(t,T)&&(!n.timeUnit||!a.isOrdinalFn(n.timeUnit)))},u.range=function(e,t,n,r){var a=t.scale(e.name),i=t.encDef(e.name),o=i.timeUnit;switch(e.name){case X:e.range=n.cellWidth?[0,n.cellWidth]:"width","ordinal"===e.type?e.bandWidth=t.bandSize(X,n.x.useSmallBand):t.isType(e.name,T)&&"year"===o?e.zero=!1:e.zero=void 0===a.zero?!0:a.zero,e.round=!0,"time"===e.type?e.nice=o||t.config("timeScaleNice"):e.nice=!0;break;case Y:"ordinal"===e.type?(e.range=n.cellHeight?i.bin?[n.cellHeight,0]:[0,n.cellHeight]:"height",e.bandWidth=t.bandSize(Y,n.y.useSmallBand)):(e.range=n.cellHeight?[n.cellHeight,0]:"height",t.isType(e.name,T)&&"year"===o?e.zero=!1:e.zero=void 0===a.zero?!0:a.zero),e.round=!0,"time"===e.type?e.nice=o||t.config("timeScaleNice"):e.nice=!0;break;case ROW:e.bandWidth=n.cellHeight,e.round=!0,e.nice=!0;break;case COL:e.bandWidth=n.cellWidth,e.round=!0,e.nice=!0;break;case SIZE:if(t.is("bar"))e.range=[3,Math.max(t.bandSize(X),t.bandSize(Y))];else if(t.is(TEXT))e.range=[8,40];else{var s=Math.min(t.bandSize(X),t.bandSize(Y))-1;e.range=[10,.8*s*s]}e.round=!0,e.zero=!1;break;case SHAPE:e.range="shapes";break;case COLOR:e.range=u.color(e,t,r),"ordinal"!==e.type&&(e.zero=!1);break;default:throw new Error("Unknown encoding name: "+e.name)}switch(e.name){case ROW:case COL:e.padding=t.config("cellPadding"),e.outerPadding=0;break;case X:case Y:"ordinal"===e.type&&(e.points=!0,e.padding=t.encDef(e.name).band.padding)}return e},u.color=function(e,t,n){var r=t.scale(COLOR),a=r.range,i=t.cardinality(COLOR,n),o=t.type(COLOR);if(void 0===a){var s=r.ordinalPalette,c=r.quantitativeRange;return"ordinal"===e.type?o===N?(a=10>=i?r.c10palette:r.c20palette,u.color.palette(a,i,o)):s?u.color.palette(s,i,o):u.color.interpolate(c[0],c[1],i):[c[0],c[1]]}},u.color.palette=function(e,t,n){switch(e){case"category10k":return["#2ca02c","#e377c2","#7f7f7f","#17becf","#8c564b","#d62728","#bcbd22","#9467bd","#ff7f0e","#1f77b4"];case"category10":return["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];case"category20":return["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];case"category20b":return["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"]; +case"category20c":return["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"]}if(e in i){var a=i[e];if(t in a)return a[t];if(n===N)return a[Math.max.apply(null,r.keys(a))];var o=3>t?3:Math.max.apply(null,r.keys(a)),s=0,c=o-1;return u.color.interpolate(a[o][s],a[o][c],t)}return e},u.color.interpolate=function(e,t,n){var a=o(e,t);return r.range(n).map(function(e){return a(1*e/(n-1))})}},{"../globals":71,"../schema/schema":73,"../util":75,"./time":66,colorbrewer:3,"d3-color":4}],63:[function(e,t,n){"use strict";function r(e,t,n){var r=n.groupby,a=n.value,i=e.fieldRef(a),o=i+"_start",s=i+"_end",u={type:"stack",groupby:[e.fieldRef(r)],field:e.fieldRef(a),sortby:[(n.properties.reverse?"-":"")+e.fieldRef(n.stack)],output:{start:o,end:s}};return n.properties.offset&&(u.offset=n.properties.offset),t.from.transform=[u],t.properties.update[a]=t.properties.enter[a]={scale:a,field:o},t.properties.update[a+"2"]=t.properties.enter[a+"2"]={scale:a,field:s},a}e("../globals"),t.exports=r},{"../globals":71}],64:[function(e,t,n){"use strict";function r(e,t){if(!t)return 1;var n=0;if(e.isAggregate())n=1,e.forEach(function(r,i){i===ROW||i===COL||(i===X||i===Y)&&a.isOrdinalScale(r)||(n*=e.cardinality(i,t))});else{if(!t["*"])return 1;n=t["*"].max;var r=1;e.has(ROW)&&(r*=e.cardinality(ROW,t)),e.has(COL)&&(r*=e.cardinality(COL,t)),n/=r}var i=0;return i=25>=n?1:200>n?.8:1e3>n||e.is("tick")?.7:.3}e("../globals");var a=e("../encdef");t.exports=function(e,t){return{opacity:r(e,t)}}},{"../encdef":70,"../globals":71}],65:[function(e,t,n){"use strict";function r(e,t,n,r){var a=e.marks,i={name:"subfacet",type:"group",from:t.from,properties:{enter:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:a};e.marks=[i],delete t.from;var o=i.from.transform||(i.from.transform=[]);o.push({type:"facet",groupby:n});var s=r.stack();s&&r.has(COLOR)&&o.unshift({type:"sort",by:r.fieldRef(COLOR)})}e("../globals"),t.exports=r},{"../globals":71}],66:[function(e,t,n){"use strict";var r=e("../util"),a=e("d3-time-format"),i=t.exports={},o=new Date(Date.UTC(2014,8,17));i.cardinality=function(e,t,n,r){var a=e.timeUnit;switch(a){case"seconds":return 60;case"minutes":return 60;case"hours":return 24;case"day":return 7;case"date":return 31;case"month":return 12;case"year":var i=t[e.name],o=t["year_"+e.name];return o?o.distinct-(i.missing>0&&n[r]?1:0):null}return null},i.formula=function(e,t){var n="utc"+e;return n+"("+t+")"},i.maxLength=function(e,t){switch(e){case"seconds":case"minutes":case"hours":case"date":return 2;case"month":case"day":var n=i.range(e,t);return n?Math.max.apply(null,n.map(function(e){return e.length})):2;case"year":return 4}var r=t.config("timeFormat");return a.utcFormat(r)(o).length},i.range=function(e,t){var n,r=t.config("timeScaleLabelLength");switch(e){case"day":n=t.config("dayScaleLabel");break;case"month":n=t.config("monthScaleLabel")}return n?r?n.map(function(e){return e.substr(0,r)}):n:void 0},i.scales=function(e){var t=e.reduce(function(t,n){var r=n.timeUnit;if(n.type===T&&r&&!t[r]){var a=i.scale.def(n.timeUnit,e);a&&(t[r]=a)}return t},{});return r.vals(t)},i.scale={},i.scale.def=function(e,t){var n=i.range(e,t);return n?{name:"time-"+e,type:"ordinal",domain:i.scale.domain(e),range:n}:null},i.isOrdinalFn=function(e){switch(e){case"seconds":case"minutes":case"hours":case"day":case"date":case"month":return!0}return!1},i.scale.type=function(e,t){return t===COLOR?"linear":i.isOrdinalFn(e)||t===COL||t===ROW?"ordinal":"linear"},i.scale.domain=function(e,t){var n=t===COLOR;switch(e){case"seconds":case"minutes":return n?[0,59]:r.range(0,60);case"hours":return n?[0,23]:r.range(0,24);case"day":return n?[0,6]:r.range(0,7);case"date":return n?[1,31]:r.range(1,32);case"month":return n?[0,11]:r.range(0,12)}return null},i.hasScale=function(e){switch(e){case"day":case"month":return!0}return!1}},{"../util":75,"d3-time-format":6}],67:[function(e,t,n){"use strict";e("./globals");var r=t.exports={};r.encodingTypes=[X,Y,ROW,COL,SIZE,SHAPE,COLOR,TEXT,DETAIL],r.shorthand={delim:"|",assign:"=",type:",",func:"_"}},{"./globals":71}],68:[function(e,t,n){"use strict";e("./globals");var r=e("datalib/src/stats"),a=t.exports={};a.types={"boolean":N,number:Q,integer:Q,date:T,string:N},a.stats=function(e){var t=r.summary(e);return t.reduce(function(e,t){return e[t.field]=t,e},{"*":{max:e.length,min:0}})}},{"./globals":71,"datalib/src/stats":29}],69:[function(e,t,n){"use strict";var r=e("./consts"),a=r.shorthand,i=e("./encdef"),o=e("./util"),s=e("./schema/schema"),u=s.encTypes,c=t.exports={};c.countRetinal=function(e){var t=0;return e.color&&t++,e.size&&t++,e.shape&&t++,t},c.has=function(e,t){var n=e&&e[t];return n&&n.name},c.isAggregate=function(e){for(var t in e)if(c.has(e,t)&&e[t].aggregate)return!0;return!1},c.forEach=function(e,t){var n=0;u.forEach(function(r){c.has(e,r)&&t(e[r],r,n++)})},c.map=function(e,t){var n=[];return u.forEach(function(r){c.has(e,r)&&n.push(t(e[r],r,e))}),n},c.reduce=function(e,t,n){var r=n;return u.forEach(function(n){c.has(e,n)&&(r=t(r,e[n],n,e))}),r},c.fields=function(e){return c.reduce(e,function(e,t){var n=e[t.name]=e[t.name]||[],r=n.containsType=n.containsType||{};return-1===n.indexOf(t)&&(n.push(t),r[t.type]=!0),e},{})},c.shorthand=function(e){return c.map(e,function(e,t){return t+a.assign+i.shorthand(e)}).join(a.delim)},c.fromShorthand=function(e){var t=o.isArray(e)?e:e.split(a.delim);return t.reduce(function(e,t){var n=t.split(a.assign),r=n[0].trim(),o=n[1];return e[r]=i.fromShorthand(o),e},{})}},{"./consts":67,"./encdef":70,"./schema/schema":73,"./util":75}],70:[function(e,t,n){"use strict";function r(e){return l(e,[N,O])||!!e.bin||f(e,T)&&!!e.timeUnit}e("./globals");var a=e("./consts"),i=a.shorthand,o=e("./compiler/time"),s=e("./util"),u=e("./schema/schema"),c=t.exports={};c.fieldRef=function(e,t){t=t||{};var n=(t.datum?"datum.":"")+(t.prefn||""),r=e.name;return c.isCount(e)?n+"count":t.fn?n+t.fn+"_"+r:!t.nofn&&e.bin?n+"bin_"+r:t.nofn||t.noAggregate||!e.aggregate?!t.nofn&&e.timeUnit?n+e.timeUnit+"_"+r:n+r:n+e.aggregate+"_"+r},c.shorthand=function(e){var t=a.shorthand;return(e.aggregate?e.aggregate+t.func:"")+(e.timeUnit?e.timeUnit+t.func:"")+(e.bin?"bin"+t.func:"")+(e.name||"")+t.type+e.type},c.shorthands=function(e,t){return t=t||i.delim,e.map(c.shorthand).join(t)},c.fromShorthand=function(e){var t,n=e.split(i.type),r={name:n[0].trim(),type:n[1].trim()};for(t in u.aggregate["enum"]){var a=u.aggregate["enum"][t];if(0===r.name.indexOf(a+"_")){r.name=r.name.substr(a.length+1),"count"==a&&0===r.name.length&&(r.name="*"),r.aggregate=a;break}}for(t in u.timefns){var o=u.timefns[t];if(r.name&&0===r.name.indexOf(o+"_")){r.name=r.name.substr(r.length+1),r.timeUnit=o;break}}return r.name&&0===r.name.indexOf("bin_")&&(r.name=r.name.substr(4),r.bin=!0),r};var f=c.isType=function(e,t){return e.type===t},l=c.isTypes=function(e,t){for(var n=0;n0&&n[a]?1:0)}},{"./compiler/time":66,"./consts":67,"./globals":71,"./schema/schema":73,"./util":75}],71:[function(e,t,n){(function(e){"use strict";var t=e||window;t.AGGREGATE="aggregate",t.RAW="raw",t.STACKED="stacked",t.INDEX="index",t.X="x",t.Y="y",t.ROW="row",t.COL="col",t.SIZE="size",t.SHAPE="shape",t.COLOR="color",t.TEXT="text",t.DETAIL="detail",t.N="N",t.O="O",t.Q="Q",t.T="T"}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],72:[function(e,t,n){"use strict";t.exports=function(e){var t=["error","info","debug","warn","log"];return t.reduce(function(t,n){var r=console[n]?n:"log";return"undefined"===console[r].bind?t[n]=Function.prototype.bind.call(console[r],console,e):t[n]=console[r].bind(console,e),t},{})}},{}],73:[function(e,t,n){"use strict";e("../globals");var r=t.exports={},a=e("../util"),i=a.toMap,o=e("colorbrewer"),s=e("vega/src/transforms/Aggregate").VALID_OPS;r.util=e("./schemautil"),r.marktype={type:"string","enum":["point","tick","bar","line","area","circle","square","text"]},r.aggregate={type:"string","enum":s,supportedEnums:{Q:s,O:["median","min","max"],N:[],T:["mean","median","min","max"],"":["count"]},supportedTypes:i([Q,N,O,T,""])},r.getSupportedRole=function(e){return r.schema.properties.encoding.properties[e].supportedRole},r.timeUnits=["year","month","day","date","hours","minutes","seconds"],r.defaultTimeFn="month",r.timeUnit={type:"string","enum":r.timeUnits,supportedTypes:i([T])},r.scale_type={type:"string","enum":["linear","log","pow","sqrt","quantile"],"default":"linear",supportedTypes:i([Q])},r.field={type:"object",properties:{name:{type:"string"}}};var u=a.duplicate,c=r.util.merge;r.MAXBINS_DEFAULT=15;var f={type:["boolean","object"],"default":!1,properties:{maxbins:{type:"integer","default":r.MAXBINS_DEFAULT,minimum:2,description:"Maximum number of bins."}},supportedTypes:i([Q])},l=c(u(r.field),{type:"object",properties:{type:{type:"string","enum":[N,O,Q,T]},aggregate:r.aggregate,timeUnit:r.timeUnit,bin:f,scale:{type:"object",properties:{type:r.scale_type,nice:{type:"string","enum":["second","minute","hour","day","week","month","year"],supportedTypes:i([T])},zero:{type:"boolean",description:"Include zero","default":!0,supportedTypes:i([Q,T])},useRawDomain:{type:"boolean","default":void 0,description:"Use the raw data range as scale domain instead of aggregated data for aggregate axis. This option does not work with sum or count aggregateas they might have a substantially larger scale range.By default, use value from config.useRawDomain."}}}}}),d=c(u(r.field),{type:"object",supportedRole:{dimension:!0},properties:{type:{type:"string","enum":[N,O,Q,T]},timeUnit:r.timeUnit,bin:f,aggregate:{type:"string","enum":["count"],supportedTypes:i([N,O])}}}),h={type:"object",supportedMarktypes:{point:!0,tick:!0,bar:!0,line:!0,area:!0,circle:!0,square:!0},properties:{axis:{type:"object",properties:{format:{type:"string","default":void 0,description:"The formatting pattern for axis labels. If not undefined, this will be determined by small/largeNumberFormat and the max value of the field."},grid:{type:"boolean","default":void 0,description:"A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise."},layer:{type:"string","default":"back",description:'A string indicating if the axis (and any gridlines) should be placed above or below the data marks. One of "front" (default) or "back".'},orient:{type:"string","default":void 0,"enum":["top","right","left","bottom"],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 for the right edge of the chart)."},ticks:{type:"integer","default":5,minimum:0,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.'},title:{type:"string","default":void 0,description:"A title for the axis. (Shows field name and its function by default.)"},maxLabelLength:{type:"integer","default":25,minimum:0,description:"Truncate labels that are too long."},labelAngle:{type:"integer","default":void 0,minimum:0,maximum:360,description:"Angle by which to rotate labels. Set to 0 to force horizontal."},titleMaxLength:{type:"integer","default":void 0,minimum:0,description:"Max length for axis title if the title is automatically generated from the field's description"},titleOffset:{type:"integer","default":void 0,description:"A title offset value for the axis."}}}}},p={type:"object",properties:{sort:{"default":"ascending",supportedTypes:i([N,O]),oneOf:[{type:"string","enum":["ascending","descending","unsorted"]},{type:"object",required:["field","op"],properties:{field:{type:"string",description:"The field name to aggregate over."},op:{type:"string","enum":s,description:"The field name to aggregate over."},order:{type:"string","enum":["ascending","descending"]}}}]}}},m={type:"object",properties:{band:{type:"object",properties:{size:{type:"integer",minimum:0,"default":void 0},padding:{type:"integer",minimum:0,"default":1}}}}},g={type:"object",properties:{legend:{type:"object",description:"Properties of a legend.",properties:{title:{type:"string","default":void 0,description:"A title for the legend. (Shows field name and its function by default.)"},orient:{type:"string","default":"right",description:'The orientation of the legend. One of "left" or "right". This determines how the legend is positioned within the scene. The default is "right".'}}}}},b={type:"object",supportedMarktypes:{text:!0},properties:{align:{type:"string","default":"right"},baseline:{type:"string","default":"middle"},color:{type:"string",role:"color","default":"#000000"},margin:{type:"integer","default":4,minimum:0},placeholder:{type:"string","default":"Abc"},font:{type:"object",properties:{weight:{type:"string","enum":["normal","bold"],"default":"normal"},size:{type:"integer","default":10,minimum:0},family:{type:"string","default":"Helvetica Neue"},style:{type:"string","default":"normal","enum":["normal","italic"]}}},format:{type:"string","default":void 0,description:"The formatting pattern for text value. If not undefined, this will be determined by small/largeNumberFormat and the max value of the field."}}},y={type:"object",supportedMarktypes:{point:!0,bar:!0,circle:!0,square:!0,text:!0},properties:{value:{type:"integer","default":30,minimum:0,description:"Size of marks."}}},v={type:"object",supportedMarktypes:{point:!0,tick:!0,bar:!0,line:!0,area:!0,circle:!0,square:!0,text:!0},properties:{value:{type:"string",role:"color","default":"#4682b4",description:"Color to be used for marks."},opacity:{type:"number","default":void 0,minimum:0,maximum:1},scale:{type:"object",properties:{range:{type:["string","array"],"default":void 0,description:"Color palette, if undefined vega-lite will use data propertyto pick one from c10palette, c20palette, or ordinalPalette."},c10palette:{type:"string","default":"category10","enum":["category10","category10k","Pastel1","Pastel2","Set1","Set2","Set3"]},c20palette:{type:"string","default":"category20","enum":["category20","category20b","category20c"]},ordinalPalette:{type:"string","default":void 0,description:"Color palette to encode ordinal variables.","enum":a.keys(o)},quantitativeRange:{type:"array","default":["#AFC6A3","#09622A"],description:"Color range to encode quantitative variables.",minItems:2,maxItems:2,items:{type:"string",role:"color"}}}}}},x={type:"object",properties:{stack:{type:["boolean","object"],"default":!0,description:"Enable stacking (for bar and area marks only).",properties:{reverse:{type:"boolean","default":!1,description:"Whether to reverse the stack's sortby."},offset:{type:"string","default":void 0,"enum":["zero","center","normalize"]}}}}},w={type:"object",supportedMarktypes:{point:!0,circle:!0,square:!0},properties:{value:{type:"string","enum":["circle","square","cross","diamond","triangle-up","triangle-down"],"default":"circle",description:"Mark to be used."},filled:{type:"boolean","default":!1,description:"Whether the shape's color should be used as fill color instead of stroke color."}}},_={type:"object",supportedMarktypes:{point:!0,tick:!0,line:!0,circle:!0,square:!0}},M={properties:{height:{type:"number",minimum:0,"default":150}}},S={properties:{width:{type:"number",minimum:0,"default":150},axis:{properties:{maxLabelLength:{type:"integer","default":12,minimum:0,description:"Truncate labels that are too long."}}}}},k={type:"object",supportedMarktypes:{point:!0,tick:!0,bar:!0,line:!0,area:!0,circle:!0,square:!0,text:!0},properties:{padding:{type:"number",minimum:0,maximum:1,"default":.1}}},L={required:["name","type"]},C=c(u(l),{supportedRole:{measure:!0,dimension:!0}}),D=c(u(l),{supportedRole:{measure:!0,dimension:"ordinal-only"}}),A=c(u(l),{supportedRole:{measure:!0}}),E=c(u(C),h,m,L,p),R=u(E),U=c(u(d),L,k,p),j=c(u(U),h,M),Y=c(u(U),h,S),F=c(u(D),g,y,p),P=c(u(C),g,v,x,p),z=c(u(d),g,w,p),I=c(u(d),_,x,p),H=c(u(A),b,p),X={type:"object",properties:{formatType:{type:"string","enum":["json","csv"],"default":"json"},url:{type:"string","default":void 0},values:{type:"array","default":void 0,description:"Pass array of objects instead of a url to a file.",items:{type:"object",additionalProperties:!0}},filter:{type:"string","default":void 0,description:"A string containing the filter Vega expression. Use `datum` to refer to the current data object."},formulas:{type:"array","default":void 0,description:"Array of formula transforms. Formulas are applied before filter.",items:{type:"object",properties:{field:{type:"string",description:"The property name in which to store the computed formula value."},expr:{type:"string",description:"A string containing an expression for the formula. Use the variable `datum` to to refer to the current data object."}}}}}},q={type:"object",properties:{width:{type:"integer","default":void 0},height:{type:"integer","default":void 0},viewport:{type:"array",items:{type:"integer"},"default":void 0},gridColor:{type:"string",role:"color","default":"#000000"},gridOpacity:{type:"number",minimum:0,maximum:1,"default":.08},filterNull:{type:"object",properties:{N:{type:"boolean","default":!1},O:{type:"boolean","default":!1},Q:{type:"boolean","default":!0},T:{type:"boolean","default":!0}}},autoSortLine:{type:"boolean","default":!0},singleHeight:{type:"integer","default":200,minimum:0},singleWidth:{type:"integer","default":200,minimum:0},largeBandSize:{type:"integer","default":21,minimum:0},smallBandSize:{type:"integer","default":12,minimum:0},largeBandMaxCardinality:{type:"integer","default":10},cellPadding:{type:"number","default":.1},cellGridColor:{type:"string",role:"color","default":"#000000"},cellGridOpacity:{type:"number",minimum:0,maximum:1,"default":.25},cellGridOffset:{type:"number","default":6},cellBackgroundColor:{type:"string",role:"color","default":"rgba(0,0,0,0)"},textCellWidth:{type:"integer","default":90,minimum:0},strokeWidth:{type:"integer","default":2,minimum:0},singleBarOffset:{type:"integer","default":5,minimum:0},timeScaleLabelLength:{type:"integer","default":3,minimum:0,description:"Max length for values in dayScaleLabel and monthScaleLabel. Zero means using full names in dayScaleLabel/monthScaleLabel."},dayScaleLabel:{type:"array",items:{type:"string"},"default":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],description:"Axis labels for day of week, starting from Sunday.(Consistent with Javascript -- See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay."},monthScaleLabel:{type:"array",items:{type:"string"},"default":["January","February","March","April","May","June","July","August","September","October","November","December"],description:"Axis labels for month."},characterWidth:{type:"integer","default":6},maxSmallNumber:{type:"number","default":1e4,description:"maximum number that a field will be considered smallNumber.Used for axis labelling."},smallNumberFormat:{type:"string","default":"",description:"D3 Number format for axis labels and text tables for number <= maxSmallNumber. Used for axis labelling."},largeNumberFormat:{type:"string","default":".3s",description:"D3 Number format for axis labels and text tables for number > maxSmallNumber."},timeFormat:{type:"string","default":"%Y-%m-%d",description:"Date format for axis labels."},useRawDomain:{type:"boolean","default":!1,description:"Use the raw data range as scale domain instead of aggregated data for aggregate axis. This option does not work with sum or count aggregateas they might have a substantially larger scale range.By default, use value from config.useRawDomain."}}};r.schema={$schema:"http://json-schema.org/draft-04/schema#",description:"Schema for Vega-lite specification",type:"object",required:["marktype","encoding","data"],properties:{data:X,marktype:r.marktype,encoding:{type:"object",properties:{x:E,y:R,row:j,col:Y,size:F,color:P,shape:z,text:H,detail:I}},config:q}},r.encTypes=a.keys(r.schema.properties.encoding.properties),r.instantiate=function(){return r.util.instantiate(r.schema)}},{"../globals":71,"../util":75,"./schemautil":74,colorbrewer:3,"vega/src/transforms/Aggregate":50}],74:[function(e,t,n){"use strict";function r(e,t){if("object"!=typeof t||null===t)return e;for(var n in t)t.hasOwnProperty(n)&&void 0!==t[n]&&("object"!=typeof t[n]||null===t[n]?e[n]=t[n]:"object"!=typeof e[n]||null===e[n]?e[n]=r(t[n].constructor===Array?[]:{},t[n]):r(e[n],t[n]));return e}var a=t.exports={},i=e("../util"),o=function(e){return 0===Object.keys(e).length};a.extend=function(e,t){return a.merge(a.instantiate(t),e)},a.instantiate=function(e){var t;if(void 0===e)return void 0;if("default"in e)return t=e["default"],i.isObject(t)?i.duplicate(t):t;if("object"===e.type){var n={};for(var r in e.properties)t=a.instantiate(e.properties[r]),void 0!==t&&(n[r]=t);return n}return"array"===e.type?[]:void 0},a.subtract=function(e,t){var n={};for(var r in e){var s=t[r],u=e[r];if(!t||s!==u)if("object"==typeof u&&!i.isArray(u)&&s){var c=a.subtract(u,s);o(c)||(n[r]=c)}else(!i.isArray(u)||u.length>0)&&(n[r]=u)}return n},a.merge=function(){for(var e=arguments[0],t=1;t 180 || delta < -180\n ? delta - 360 * Math.round(delta / 360)\n : delta;\n }\n\n function Color() {}var reHex3 = /^#([0-9a-f]{3})$/;\n var reHex6 = /^#([0-9a-f]{6})$/;\n var reRgbInteger = /^rgb\\(\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*\\)$/;\n var reRgbPercent = /^rgb\\(\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var reHslPercent = /^hsl\\(\\s*([-+]?\\d+(?:\\.\\d+)?)\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n color.prototype = Color.prototype = {\n displayable: function() {\n return this.rgb().displayable();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n };\n\n function color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf))) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\n : (m = reRgbInteger.exec(format)) ? rgb(m[1], m[2], m[3]) // rgb(255,0,0)\n : (m = reRgbPercent.exec(format)) ? rgb(m[1] * 2.55, m[2] * 2.55, m[3] * 2.55) // rgb(100%,0%,0%)\n : (m = reHslPercent.exec(format)) ? hsl(m[1], m[2] * .01, m[3] * .01) // hsl(120,50%,50%)\n : named.hasOwnProperty(format) ? rgbn(named[format])\n : null;\n }function rgbn(n) {\n return rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff);\n }\n\n var named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n };\n\n var darker = .7;\n var brighter = 1 / darker;\n\n function rgb(r, g, b) {\n if (arguments.length === 1) {\n if (!(r instanceof Color)) r = color(r);\n if (r) {\n r = r.rgb();\n b = r.b;\n g = r.g;\n r = r.r;\n } else {\n r = g = b = NaN;\n }\n }\n return new Rgb(r, g, b);\n }function Rgb(r, g, b) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n }var ____prototype = rgb.prototype = Rgb.prototype = new Color;\n\n ____prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.rgb = function() {\n return this;\n };\n\n ____prototype.displayable = function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255);\n };\n\n ____prototype.toString = function() {\n return _format(this.r, this.g, this.b);\n };\n\n function _format(r, g, b) {\n return \"#\"\n + (isNaN(r) ? \"00\" : (r = Math.round(r)) < 16 ? \"0\" + Math.max(0, r).toString(16) : Math.min(255, r).toString(16))\n + (isNaN(g) ? \"00\" : (g = Math.round(g)) < 16 ? \"0\" + Math.max(0, g).toString(16) : Math.min(255, g).toString(16))\n + (isNaN(b) ? \"00\" : (b = Math.round(b)) < 16 ? \"0\" + Math.max(0, b).toString(16) : Math.min(255, b).toString(16));\n }\n\n function hsl(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Hsl) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Color)) h = color(h);\n if (h) {\n if (h instanceof Hsl) return h;\n h = h.rgb();\n var r = h.r / 255,\n g = h.g / 255,\n b = h.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n range = max - min;\n l = (max + min) / 2;\n if (range) {\n s = l < .5 ? range / (max + min) : range / (2 - max - min);\n if (r === max) h = (g - b) / range + (g < b) * 6;\n else if (g === max) h = (b - r) / range + 2;\n else h = (r - g) / range + 4;\n h *= 60;\n } else {\n h = NaN;\n s = l > 0 && l < 1 ? 0 : h;\n }\n } else {\n h = s = l = NaN;\n }\n }\n }\n return new Hsl(h, s, l);\n }function Hsl(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var ___prototype = hsl.prototype = Hsl.prototype = new Color;\n\n ___prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.rgb = function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < .5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2)\n );\n };\n\n ___prototype.displayable = function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1);\n };\n\n /* From FvD 13.37, CSS Color Module Level 3 */\n function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n }\n\n var Kn = 18;\n\n var Xn = 0.950470;\n var Yn = 1;\n var Zn = 1.088830;\n var t0 = 4 / 29;\n var t1 = 6 / 29;\n var t2 = 3 * t1 * t1;\n var t3 = t1 * t1 * t1;\n function lab(l, a, b) {\n if (arguments.length === 1) {\n if (l instanceof Lab) {\n b = l.b;\n a = l.a;\n l = l.l;\n } else if (l instanceof Hcl) {\n var h = l.h * deg2rad;\n b = Math.sin(h) * l.c;\n a = Math.cos(h) * l.c;\n l = l.l;\n } else {\n if (!(l instanceof Rgb)) l = rgb(l);\n var r = rgb2xyz(l.r),\n g = rgb2xyz(l.g),\n b = rgb2xyz(l.b),\n x = xyz2lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / Xn),\n y = xyz2lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Yn),\n z = xyz2lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Zn);\n b = 200 * (y - z);\n a = 500 * (x - y);\n l = 116 * y - 16;\n }\n }\n return new Lab(l, a, b);\n }function Lab(l, a, b) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n }var __prototype = lab.prototype = Lab.prototype = new Color;\n\n __prototype.brighter = function(k) {\n return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.darker = function(k) {\n return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.rgb = function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Rgb(\n xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)\n );\n };\n\n function xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n }\n\n function lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n }\n\n function xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n }\n\n function rgb2xyz(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n }\n\n var deg2rad = Math.PI / 180;\n var rad2deg = 180 / Math.PI;\n\n function hcl(h, c, l) {\n if (arguments.length === 1) {\n if (h instanceof Hcl) {\n l = h.l;\n c = h.c;\n h = h.h;\n } else {\n if (!(h instanceof Lab)) h = lab(h);\n l = h.l;\n c = Math.sqrt(h.a * h.a + h.b * h.b);\n h = Math.atan2(h.b, h.a) * rad2deg;\n if (h < 0) h += 360;\n }\n }\n return new Hcl(h, c, l);\n }function Hcl(h, c, l) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n }var _prototype = hcl.prototype = Hcl.prototype = new Color;\n\n _prototype.brighter = function(k) {\n return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k));\n };\n\n _prototype.darker = function(k) {\n return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k));\n };\n\n _prototype.rgb = function() {\n return lab(this).rgb();\n };\n\n var A = -0.14861;\n var B = +1.78277;\n var C = -0.29227;\n var D = -0.90649;\n var E = +1.97294;\n var ED = E * D;\n var EB = E * B;\n var BC_DA = B * C - D * A;\n function cubehelix(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Cubehelix) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Rgb)) h = rgb(h);\n var r = h.r / 255, g = h.g / 255, b = h.b / 255;\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB);\n var bl = b - l, k = (E * (g - l) - C * bl) / D;\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)); // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n if (h < 0) h += 360;\n }\n }\n return new Cubehelix(h, s, l);\n }function Cubehelix(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var prototype = cubehelix.prototype = Cubehelix.prototype = new Color;\n\n prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.rgb = function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh))\n );\n };\n\n function interpolateCubehelixGamma(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateCubehelixGammaLong(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateHclLong(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHcl(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateLab(a, b) {\n a = lab(a);\n b = lab(b);\n var al = a.l,\n aa = a.a,\n ab = a.b,\n bl = b.l - al,\n ba = b.a - aa,\n bb = b.b - ab;\n return function(t) {\n a.l = al + bl * t;\n a.a = aa + ba * t;\n a.b = ab + bb * t;\n return a + \"\";\n };\n }\n\n function interpolateHslLong(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHsl(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateRgb(a, b) {\n a = rgb(a);\n b = rgb(b);\n var ar = a.r,\n ag = a.g,\n ab = a.b,\n br = b.r - ar,\n bg = b.g - ag,\n bb = b.b - ab;\n return function(t) {\n return _format(Math.round(ar + br * t), Math.round(ag + bg * t), Math.round(ab + bb * t));\n };\n }\n\n var interpolateCubehelix = interpolateCubehelixGamma(1);\n var interpolateCubehelixLong = interpolateCubehelixGammaLong(1);\n\n exports.interpolateCubehelix = interpolateCubehelix;\n exports.interpolateCubehelixLong = interpolateCubehelixLong;\n exports.color = color;\n exports.rgb = rgb;\n exports.hsl = hsl;\n exports.lab = lab;\n exports.hcl = hcl;\n exports.cubehelix = cubehelix;\n exports.interpolateRgb = interpolateRgb;\n exports.interpolateHsl = interpolateHsl;\n exports.interpolateHslLong = interpolateHslLong;\n exports.interpolateLab = interpolateLab;\n exports.interpolateHcl = interpolateHcl;\n exports.interpolateHclLong = interpolateHclLong;\n exports.interpolateCubehelixGamma = interpolateCubehelixGamma;\n exports.interpolateCubehelixGammaLong = interpolateCubehelixGammaLong;\n\n}));\n},{}],5:[function(require,module,exports){\nif (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.format = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"¥\", \"\"]\n };\n\n var ruRu = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0руб.\"]\n };\n\n var ptBr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"R$\", \"\"]\n };\n\n var plPl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"zł\"]\n };\n\n var nlNl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\\xa0\", \"\"]\n };\n\n var mkMk = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0ден.\"]\n };\n\n var jaJp = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"\", \"円\"]\n };\n\n var itIt = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\", \"\"]\n };\n\n var heIl = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"₪\", \"\"]\n };\n\n var frFr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var frCa = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"$\"]\n };\n\n var fiFi = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var esEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var enUs = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var enGb = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"£\", \"\"]\n };\n\n var enCa = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var deDe = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var caEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n\n // Computes the decimal coefficient and exponent of the specified number x with\n // significant digits p, where x is positive and p is in [1, 21] or undefined.\n // For example, formatDecimal(1.23) returns [\"123\", 0].\n function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n\n function exponent(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n }\n\n var prefixExponent;\n\n function formatPrefixAuto(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, p + i - 1)[0]; // less than 1y!\n }\n\n function formatRounded(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n }\n\n function formatDefault(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n }\n\n var formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n };\n\n\n // [[fill]align][sign][symbol][0][width][,][.precision][type]\n var re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\n function formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n }\n\n function FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n }\n\n FormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n };\n\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n }\n\n var prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\n function identity(x) {\n return x;\n }\n\n function locale(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal;\n\n function format(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? \"%\" : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n return function(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Convert negative to positive, and compute the prefix.\n // Note that -0 is not less than 0, but 1 / -0 is!\n var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);\n\n // Perform the initial formatting.\n value = formatType(value, precision);\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n var i = -1, n = value.length, c;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": return valuePrefix + value + valueSuffix + padding;\n case \"=\": return valuePrefix + padding + value + valueSuffix;\n case \"^\": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n }\n return padding + valuePrefix + value + valueSuffix;\n };\n }\n\n function formatPrefix(specifier, value) {\n var f = format((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: format,\n formatPrefix: formatPrefix\n };\n }\n\n function precisionRound(step, max) {\n return Math.max(0, exponent(Math.abs(max)) - exponent(Math.abs(step))) + 1;\n }\n\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.formatPrefix = defaultLocale.formatPrefix;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.formatSpecifier = formatSpecifier;\n exports.precisionFixed = precisionFixed;\n exports.precisionPrefix = precisionPrefix;\n exports.precisionRound = precisionRound;\n\n}));\n},{}],6:[function(require,module,exports){\nif (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));\n},{}],7:[function(require,module,exports){\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.dsv = {}));\n}(this, function (exports) { 'use strict';\n\n var dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n]\"),\n delimiterCode = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var o;\n return parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = new Function(\"d\", \"return {\" + row.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n o = f ? function(row, i) { return f(a(row), i); } : a;\n });\n }\n\n function parseRows(text, f) {\n var EOL = {}, // sentinel value for end-of-line\n EOF = {}, // sentinel value for end-of-file\n rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // the current line number\n t, // the current token\n eol; // is the current token followed by EOL?\n\n function token() {\n if (I >= N) return EOF; // special case: end of file\n if (eol) return eol = false, EOL; // special case: end of line\n\n // special case: quotes\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case: find next delimiter or newline\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true; // \\n\n else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \\r|\\r\\n\n else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n\n // special case: last token before EOF\n return text.slice(j);\n }\n\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n\n return rows;\n }\n\n function format(rows) {\n if (Array.isArray(rows[0])) return formatRows(rows); // deprecated; use formatRows\n var fieldSet = Object.create(null), fields = [];\n\n // Compute unique fields in order of discovery.\n rows.forEach(function(row) {\n for (var field in row) {\n if (!((field += \"\") in fieldSet)) {\n fields.push(fieldSet[field] = field);\n }\n }\n });\n\n return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return reFormat.test(text) ? \"\\\"\" + text.replace(/\\\"/g, \"\\\"\\\"\") + \"\\\"\" : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n }\n\n exports.csv = dsv(\",\");\n exports.tsv = dsv(\"\\t\");\n\n exports.dsv = dsv;\n\n}));\n},{}],8:[function(require,module,exports){\nif (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var jaJp = {\n dateTime: \"%Y %b %e %a %X\",\n date: \"%Y/%m/%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\n shortDays: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"],\n months: [\"睦月\", \"如月\", \"弥生\", \"卯月\", \"皐月\", \"水無月\", \"文月\", \"葉月\", \"長月\", \"神無月\", \"霜月\", \"師走\"],\n shortMonths: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));\n},{}],9:[function(require,module,exports){\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.time = {}));\n}(this, function (exports) { 'use strict';\n\n var t1 = new Date;\n\n var t0 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var second = newInterval(function(date) {\n date.setMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.seconds = second.range;\n\n var minute = newInterval(function(date) {\n date.setSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.minutes = minute.range;\n\n var hour = newInterval(function(date) {\n date.setMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.hours = hour.range;\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n exports.days = day.range;\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n exports.sunday = weekday(0);\n\n exports.sundays = exports.sunday.range;\n\n exports.monday = weekday(1);\n\n exports.mondays = exports.monday.range;\n\n exports.tuesday = weekday(2);\n\n exports.tuesdays = exports.tuesday.range;\n\n exports.wednesday = weekday(3);\n\n exports.wednesdays = exports.wednesday.range;\n\n exports.thursday = weekday(4);\n\n exports.thursdays = exports.thursday.range;\n\n exports.friday = weekday(5);\n\n exports.fridays = exports.friday.range;\n\n exports.saturday = weekday(6);\n\n exports.saturdays = exports.saturday.range;\n\n var week = exports.sunday;\n\n exports.weeks = week.range;\n\n var month = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n });\n\n exports.months = month.range;\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n exports.years = year.range;\n\n var utcSecond = newInterval(function(date) {\n date.setUTCMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.utcSeconds = utcSecond.range;\n\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.utcMinutes = utcMinute.range;\n\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.utcHours = utcHour.range;\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n exports.utcDays = utcDay.range;\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n exports.utcSunday = utcWeekday(0);\n\n exports.utcSundays = exports.utcSunday.range;\n\n exports.utcMonday = utcWeekday(1);\n\n exports.utcMondays = exports.utcMonday.range;\n\n exports.utcTuesday = utcWeekday(2);\n\n exports.utcTuesdays = exports.utcTuesday.range;\n\n exports.utcWednesday = utcWeekday(3);\n\n exports.utcWednesdays = exports.utcWednesday.range;\n\n exports.utcThursday = utcWeekday(4);\n\n exports.utcThursdays = exports.utcThursday.range;\n\n exports.utcFriday = utcWeekday(5);\n\n exports.utcFridays = exports.utcFriday.range;\n\n exports.utcSaturday = utcWeekday(6);\n\n exports.utcSaturdays = exports.utcSaturday.range;\n\n var utcWeek = exports.utcSunday;\n\n exports.utcWeeks = utcWeek.range;\n\n var utcMonth = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(1);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n });\n\n exports.utcMonths = utcMonth.range;\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n exports.utcYears = utcYear.range;\n\n exports.interval = newInterval;\n exports.second = second;\n exports.minute = minute;\n exports.hour = hour;\n exports.day = day;\n exports.week = week;\n exports.month = month;\n exports.year = year;\n exports.utcSecond = utcSecond;\n exports.utcMinute = utcMinute;\n exports.utcHour = utcHour;\n exports.utcDay = utcDay;\n exports.utcWeek = utcWeek;\n exports.utcMonth = utcMonth;\n exports.utcYear = utcYear;\n\n}));\n},{}],10:[function(require,module,exports){\nvar util = require('../util'),\n Measures = require('./measures'),\n Collector = require('./collector');\n\nfunction Aggregator() {\n this._cells = {};\n this._aggr = [];\n this._stream = false;\n}\n\nvar Flags = Aggregator.Flags = {\n ADD_CELL: 1,\n MOD_CELL: 2\n};\n\nvar proto = Aggregator.prototype;\n\n// Parameters\n\nproto.stream = function(v) {\n if (v == null) return this._stream;\n this._stream = !!v;\n this._aggr = [];\n return this;\n};\n\n// key accessor to use for streaming removes\nproto.key = function(key) {\n if (key == null) return this._key;\n this._key = util.$(key);\n return this;\n};\n\n// Input: array of objects of the form\n// {name: string, get: function}\nproto.groupby = function(dims) {\n this._dims = util.array(dims).map(function(d, i) {\n d = util.isString(d) ? {name: d, get: util.$(d)}\n : util.isFunction(d) ? {name: util.name(d) || d.name || ('_' + i), get: d}\n : (d.name && util.isFunction(d.get)) ? d : null;\n if (d == null) throw 'Invalid groupby argument: ' + d;\n return d;\n });\n return this.clear();\n};\n\n// Input: array of objects of the form\n// {name: string, ops: [string, ...]}\nproto.summarize = function(fields) {\n fields = summarize_args(fields);\n this._count = true;\n var aggr = (this._aggr = []),\n m, f, i, j, op, as, get;\n\n for (i=0; i 0) {\n // consolidate collector values\n if (cell.collect) {\n cell.data.values();\n }\n // update tuple properties\n for (i=0; i 0) {\n m[a[i]] -= 1;\n } else {\n x[j++] = a[i];\n }\n }\n } else if (k) {\n // has unique key field, so use that\n m = util.toMap(r, k);\n for (i=0, j=0, n=a.length; i 1 ? this.dev / (this.valid-1) : 0',\n req: ['mean'], idx: 1\n }),\n 'variancep': measure({\n name: 'variancep',\n set: 'this.valid > 1 ? this.dev / this.valid : 0',\n req: ['variance'], idx: 2\n }),\n 'stdev': measure({\n name: 'stdev',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0',\n req: ['variance'], idx: 2\n }),\n 'stdevp': measure({\n name: 'stdevp',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0',\n req: ['variance'], idx: 2\n }),\n 'median': measure({\n name: 'median',\n set: 'cell.data.q2(this.get)',\n req: ['values'], idx: 3\n }),\n 'q1': measure({\n name: 'q1',\n set: 'cell.data.q1(this.get)',\n req: ['values'], idx: 3\n }),\n 'q3': measure({\n name: 'q3',\n set: 'cell.data.q3(this.get)',\n req: ['values'], idx: 3\n }),\n 'distinct': measure({\n name: 'distinct',\n set: 'this.distinct(cell.data.values(), this.get)',\n req: ['values'], idx: 3\n }),\n 'argmin': measure({\n name: 'argmin',\n add: 'if (v < this.min) this.argmin = t;',\n rem: 'if (v <= this.min) this.argmin = null;',\n set: 'this.argmin = this.argmin || cell.data.argmin(this.get)',\n req: ['min'], str: ['values'], idx: 3\n }),\n 'argmax': measure({\n name: 'argmax',\n add: 'if (v > this.max) this.argmax = t;',\n rem: 'if (v >= this.max) this.argmax = null;',\n set: 'this.argmax = this.argmax || cell.data.argmax(this.get)',\n req: ['max'], str: ['values'], idx: 3\n }),\n 'min': measure({\n name: 'min',\n init: 'this.min = +Infinity;',\n add: 'if (v < this.min) this.min = v;',\n rem: 'if (v <= this.min) this.min = NaN;',\n set: 'this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)',\n str: ['values'], idx: 4\n }),\n 'max': measure({\n name: 'max',\n init: 'this.max = -Infinity;',\n add: 'if (v > this.max) this.max = v;',\n rem: 'if (v >= this.max) this.max = NaN;',\n set: 'this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)',\n str: ['values'], idx: 4\n }),\n 'modeskew': measure({\n name: 'modeskew',\n set: 'this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))',\n req: ['mean', 'stdev', 'median'], idx: 5\n })\n};\n\nfunction measure(base) {\n return function(out) {\n var m = util.extend({init:'', add:'', rem:'', idx:0}, base);\n m.out = out || base.name;\n return m;\n };\n}\n\nfunction resolve(agg, stream) {\n function collect(m, a) {\n function helper(r) { if (!m[r]) collect(m, m[r] = types[r]()); }\n if (a.req) a.req.forEach(helper);\n if (stream && a.str) a.str.forEach(helper);\n return m;\n }\n var map = agg.reduce(\n collect,\n agg.reduce(function(m, a) { return (m[a.name] = a, m); }, {})\n );\n return util.vals(map).sort(function(a, b) { return a.idx - b.idx; });\n}\n\nfunction create(agg, stream, accessor, mutator) {\n var all = resolve(agg, stream),\n ctr = 'this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;',\n add = 'if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;',\n rem = 'if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;',\n set = 'var t = this.tuple; var cell = this.cell;';\n\n all.forEach(function(a) {\n if (a.idx < 0) {\n ctr = a.init + ctr;\n add = a.add + add;\n rem = a.rem + rem;\n } else {\n ctr += a.init;\n add += a.add;\n rem += a.rem;\n }\n });\n agg.slice()\n .sort(function(a, b) { return a.idx - b.idx; })\n .forEach(function(a) {\n set += 'this.assign(t,\\''+a.out+'\\','+a.set+');';\n });\n set += 'return t;';\n\n /* jshint evil: true */\n ctr = Function('cell', 't', ctr);\n ctr.prototype.assign = mutator;\n ctr.prototype.add = Function('t', 'var v = this.get(t);' + add);\n ctr.prototype.rem = Function('t', 'var v = this.get(t);' + rem);\n ctr.prototype.set = Function(set);\n ctr.prototype.get = accessor;\n ctr.prototype.distinct = require('../stats').count.distinct;\n ctr.prototype.isValid = util.isValid;\n ctr.fields = agg.map(util.$('out'));\n return ctr;\n}\n\ntypes.create = create;\nmodule.exports = types;\n},{\"../stats\":29,\"../util\":32}],14:[function(require,module,exports){\nvar util = require('../util'),\n time = require('../time'),\n EPSILON = 1e-15;\n\nfunction bins(opt) {\n if (!opt) { throw Error(\"Missing binning options.\"); }\n\n // determine range\n var maxb = opt.maxbins || 15,\n base = opt.base || 10,\n logb = Math.log(base),\n div = opt.div || [5, 2], \n min = opt.min,\n max = opt.max,\n span = max - min,\n step, level, minstep, precision, v, i, eps;\n\n if (opt.step) {\n // if step size is explicitly given, use that\n step = opt.step;\n } else if (opt.steps) {\n // if provided, limit choice to acceptable step sizes\n step = opt.steps[Math.min(\n opt.steps.length - 1,\n bisect(opt.steps, span/maxb, 0, opt.steps.length)\n )];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = opt.minstep || 0;\n step = Math.max(\n minstep,\n Math.pow(base, Math.round(Math.log(span) / logb) - level)\n );\n \n // increase step size if too many bins\n do { step *= base; } while (Math.ceil(span/step) > maxb);\n\n // decrease step size if allowed\n for (i=0; i= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n precision = v >= 0 ? 0 : ~~(-v / logb) + 1;\n eps = Math.pow(base, -precision - 1);\n min = Math.min(min, Math.floor(min / step + eps) * step);\n max = Math.ceil(max / step) * step;\n\n return {\n start: min,\n stop: max,\n step: step,\n unit: {precision: precision},\n value: value,\n index: index\n };\n}\n\nfunction bisect(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (util.cmp(a[mid], x) < 0) { lo = mid + 1; }\n else { hi = mid; }\n }\n return lo;\n}\n\nfunction value(v) {\n return this.step * Math.floor(v / this.step + EPSILON);\n}\n\nfunction index(v) {\n return Math.floor((v - this.start) / this.step + EPSILON);\n}\n\nfunction date_value(v) {\n return this.unit.date(value.call(this, v));\n}\n\nfunction date_index(v) {\n return index.call(this, this.unit.unit(v));\n}\n\nbins.date = function(opt) {\n if (!opt) { throw Error(\"Missing date binning options.\"); }\n\n // find time step, then bin\n var units = opt.utc ? time.utc : time,\n dmin = opt.min,\n dmax = opt.max,\n maxb = opt.maxbins || 20,\n minb = opt.minbins || 4,\n span = (+dmax) - (+dmin),\n unit = opt.unit ? units[opt.unit] : units.find(span, minb, maxb),\n spec = bins({\n min: unit.min != null ? unit.min : unit.unit(dmin),\n max: unit.max != null ? unit.max : unit.unit(dmax),\n maxbins: maxb,\n minstep: unit.minstep,\n steps: unit.step\n });\n\n spec.unit = unit;\n spec.index = date_index;\n if (!opt.raw) spec.value = date_value;\n return spec;\n};\n\nmodule.exports = bins;\n\n},{\"../time\":31,\"../util\":32}],15:[function(require,module,exports){\nvar bins = require('./bins'),\n gen = require('../generate'),\n type = require('../import/type'),\n util = require('../util'),\n stats = require('../stats');\n\nvar qtype = {\n 'integer': 1,\n 'number': 1,\n 'date': 1\n};\n\nfunction $bin(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return !b ? (opt.accessor || util.identity) :\n util.$func('bin', b.unit.unit ?\n function(x) { return b.value(b.unit.unit(x)); } :\n function(x) { return b.value(x); }\n )(opt.accessor);\n}\n\nfunction histogram(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return b ?\n numerical(values, opt.accessor, b) :\n categorical(values, opt.accessor, opt && opt.sort);\n}\n\nfunction spec(opt) {\n var t = opt.type, b = null;\n if (t == null || qtype[t]) {\n if (t === 'integer' && opt.minstep == null) opt.minstep = 1;\n b = (t === 'date') ? bins.date(opt) : bins(opt);\n }\n return b;\n}\n\nfunction options() {\n var a = arguments,\n i = 0,\n values = util.isArray(a[i]) ? a[i++] : null,\n f = util.isFunction(a[i]) || util.isString(a[i]) ? util.$(a[i++]) : null,\n opt = util.extend({}, a[i]);\n \n if (values) {\n opt.type = opt.type || type(values, f);\n if (qtype[opt.type]) {\n var ext = stats.extent(values, f);\n opt = util.extend({min: ext[0], max: ext[1]}, opt);\n }\n }\n if (f) { opt.accessor = f; }\n return opt;\n}\n\nfunction numerical(values, f, b) {\n var h = gen.range(b.start, b.stop + b.step/2, b.step)\n .map(function(v) { return {value: b.value(v), count: 0}; });\n\n for (var i=0, v, j; i= h.length || !isFinite(j)) continue;\n h[j].count += 1;\n }\n }\n h.bins = b;\n return h;\n}\n\nfunction categorical(values, f, sort) {\n var u = stats.unique(values, f),\n c = stats.count.map(values, f);\n return u.map(function(k) { return {value: k, count: c[k]}; })\n .sort(util.comparator(sort ? '-count' : '+value'));\n}\n\nmodule.exports = {\n $bin: $bin,\n histogram: histogram\n};\n},{\"../generate\":17,\"../import/type\":26,\"../stats\":29,\"../util\":32,\"./bins\":14}],16:[function(require,module,exports){\nvar d3_time = require('d3-time'),\n d3_timeF = require('d3-time-format'),\n d3_numberF = require('d3-format'),\n numberF = d3_numberF, // defaults to EN-US\n timeF = d3_timeF; // defaults to EN-US\n\nfunction numberLocale(l) {\n var f = d3_numberF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n numberF = f;\n}\n\nfunction timeLocale(l) {\n var f = d3_timeF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n timeF = f;\n}\n\nmodule.exports = {\n // Update number formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-format\n numberLocale: numberLocale,\n number: function(f) { return numberF.format(f); },\n numberPrefix: function(f, v) { return numberF.formatPrefix(f, v); },\n\n // Update time formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-time-format\n timeLocale: timeLocale,\n time: function(f) { return timeF.format(f); }, \n utc: function(f) { return timeF.utcFormat(f); },\n\n // Set number and time locale simultaneously.\n locale: function(l) { numberLocale(l); timeLocale(l); },\n\n // automatic formatting functions\n auto: {\n number: numberAutoFormat,\n time: function() { return timeAutoFormat(); },\n utc: function() { return utcAutoFormat(); }\n }\n};\n\nvar e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction intervals(domain, count) {\n if (!domain.length) domain = [0];\n if (count == null) count = 10;\n\n var start = domain[0],\n stop = domain[domain.length - 1];\n\n if (stop < start) { error = stop; stop = start; start = error; }\n\n var span = (stop - start) || (count = 1, start || stop || 1),\n step = Math.pow(10, Math.floor(Math.log(span / count) / Math.LN10)),\n error = span / count / step;\n\n // Filter ticks to get closer to the desired count.\n if (error >= e10) step *= 10;\n else if (error >= e5) step *= 5;\n else if (error >= e2) step *= 2;\n\n // Round start and stop values to step interval.\n return [\n Math.ceil(start / step) * step,\n Math.floor(stop / step) * step + step / 2, // inclusive\n step\n ];\n}\n\nfunction numberAutoFormat(domain, count, f) {\n var range = intervals(domain, count);\n if (f == null) {\n f = ',.' + d3_numberF.precisionFixed(range[2]) + 'f';\n } else {\n switch (f = d3_numberF.formatSpecifier(f), f.type) {\n case 's': {\n var value = Math.max(Math.abs(range[0]), Math.abs(range[1]));\n if (f.precision == null) f.precision = d3_numberF.precisionPrefix(range[2], value);\n return numberF.formatPrefix(f, value);\n }\n case '':\n case 'e':\n case 'g':\n case 'p':\n case 'r': {\n if (f.precision == null) f.precision = d3_numberF.precisionRound(range[2], Math.max(Math.abs(range[0]), Math.abs(range[1]))) - (f.type === 'e');\n break;\n }\n case 'f':\n case '%': {\n if (f.precision == null) f.precision = d3_numberF.precisionFixed(range[2]) - (f.type === '%') * 2;\n break;\n }\n }\n }\n return numberF.format(f);\n}\n\nfunction timeAutoFormat() {\n var f = timeF.format,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.second(date) < d ? formatMillisecond\n : d3_time.minute(date) < d ? formatSecond\n : d3_time.hour(date) < d ? formatMinute\n : d3_time.day(date) < d ? formatHour\n : d3_time.month(date) < d ?\n (d3_time.week(date) < d ? formatDay : formatWeek)\n : d3_time.year(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n\nfunction utcAutoFormat() {\n var f = timeF.utcFormat,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.utcSecond(date) < d ? formatMillisecond\n : d3_time.utcMinute(date) < d ? formatSecond\n : d3_time.utcHour(date) < d ? formatMinute\n : d3_time.utcDay(date) < d ? formatHour\n : d3_time.utcMonth(date) < d ?\n (d3_time.utcWeek(date) < d ? formatDay : formatWeek)\n : d3_time.utcYear(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n\n},{\"d3-format\":5,\"d3-time\":9,\"d3-time-format\":8}],17:[function(require,module,exports){\nvar gen = module.exports = {};\n\ngen.repeat = function(val, n) {\n var a = Array(n), i;\n for (i=0; i stop) range.push(j);\n else while ((j = start + step * ++i) < stop) range.push(j);\n return range;\n};\n\ngen.random = {};\n\ngen.random.uniform = function(min, max) {\n if (max === undefined) {\n max = min === undefined ? 1 : min;\n min = 0;\n }\n var d = max - min;\n var f = function() {\n return min + d * Math.random();\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.integer = function(a, b) {\n if (b === undefined) {\n b = a;\n a = 0;\n }\n var d = b - a;\n var f = function() {\n return a + Math.floor(d * Math.random());\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.normal = function(mean, stdev) {\n mean = mean || 0;\n stdev = stdev || 1;\n var next;\n var f = function() {\n var x = 0, y = 0, rds, c;\n if (next !== undefined) {\n x = next;\n next = undefined;\n return x;\n }\n do {\n x = Math.random()*2-1;\n y = Math.random()*2-1;\n rds = x*x + y*y;\n } while (rds === 0 || rds > 1);\n c = Math.sqrt(-2*Math.log(rds)/rds); // Box-Muller transform\n next = mean + y*c*stdev;\n return mean + x*c*stdev;\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n},{}],18:[function(require,module,exports){\nvar util = require('../../util');\nvar d3_dsv = require('d3-dsv');\n\nfunction dsv(data, format) {\n if (data) {\n var h = format.header;\n data = (h ? h.join(format.delimiter) + '\\n' : '') + data;\n }\n return d3_dsv.dsv(format.delimiter).parse(data);\n}\n\ndsv.delimiter = function(delim) {\n var fmt = {delimiter: delim};\n return function(data, format) {\n return dsv(data, format ? util.extend(format, fmt) : fmt);\n };\n};\n\nmodule.exports = dsv;\n},{\"../../util\":32,\"d3-dsv\":7}],19:[function(require,module,exports){\nvar dsv = require('./dsv');\n\nmodule.exports = {\n json: require('./json'),\n topojson: require('./topojson'),\n treejson: require('./treejson'),\n dsv: dsv,\n csv: dsv.delimiter(','),\n tsv: dsv.delimiter('\\t')\n};\n},{\"./dsv\":18,\"./json\":20,\"./topojson\":21,\"./treejson\":22}],20:[function(require,module,exports){\nvar util = require('../../util');\n\nmodule.exports = function(data, format) {\n var d = util.isObject(data) && !util.isBuffer(data) ?\n data : JSON.parse(data);\n if (format && format.property) {\n d = util.accessor(format.property)(d);\n }\n return d;\n};\n\n},{\"../../util\":32}],21:[function(require,module,exports){\n(function (global){\nvar json = require('./json');\n\nvar reader = function(data, format) {\n var topojson = reader.topojson;\n if (topojson == null) { throw Error('TopoJSON library not loaded.'); }\n\n var t = json(data, format), obj;\n\n if (format && format.feature) {\n if ((obj = t.objects[format.feature])) {\n return topojson.feature(t, obj).features;\n } else {\n throw Error('Invalid TopoJSON object: ' + format.feature);\n }\n } else if (format && format.mesh) {\n if ((obj = t.objects[format.mesh])) {\n return [topojson.mesh(t, t.objects[format.mesh])];\n } else {\n throw Error('Invalid TopoJSON object: ' + format.mesh);\n }\n } else {\n throw Error('Missing TopoJSON feature or mesh parameter.');\n }\n};\n\nreader.topojson = (typeof window !== \"undefined\" ? window['topojson'] : typeof global !== \"undefined\" ? global['topojson'] : null);\nmodule.exports = reader;\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{\"./json\":20}],22:[function(require,module,exports){\nvar json = require('./json');\n\nmodule.exports = function(data, format) {\n data = json(data, format);\n return toTable(data, (format && format.children));\n};\n\nfunction toTable(root, childrenField) {\n childrenField = childrenField || 'children';\n var table = [];\n \n function visit(node) {\n table.push(node);\n var children = node[childrenField];\n if (children) {\n for (var i=0; i 1 && domain[idx-1] === '.' && domain.lastIndexOf(d) === idx);\n });\n if (!whiteListed) {\n throw 'URL is not whitelisted: ' + url;\n }\n }\n }\n return url;\n}\n\nfunction load(opt, callback) {\n var error = callback || function(e) { throw e; }, url;\n\n try {\n url = load.sanitizeUrl(opt); // enable override\n } catch (err) {\n error(err);\n return;\n }\n\n if (!url) {\n error('Invalid URL: ' + opt.url);\n } else if (load.useXHR) {\n // on client, use xhr\n return xhr(url, callback);\n } else if (startsWith(url, fileProtocol)) {\n // on server, if url starts with 'file://', strip it and load from file\n return file(url.slice(fileProtocol.length), callback);\n } else if (url.indexOf('://') < 0) { // TODO better protocol check?\n // on server, if no protocol assume file\n return file(url, callback);\n } else {\n // for regular URLs on server\n return http(url, callback);\n }\n}\n\nfunction xhrHasResponse(request) {\n var type = request.responseType;\n return type && type !== 'text' ?\n request.response : // null on error\n request.responseText; // '' on error\n}\n\nfunction xhr(url, callback) {\n var async = !!callback;\n var request = new XMLHttpRequest();\n // If IE does not support CORS, use XDomainRequest (copied from d3.xhr)\n if (this.XDomainRequest &&\n !('withCredentials' in request) &&\n /^(http(s)?:)?\\/\\//.test(url)) request = new XDomainRequest();\n\n function respond() {\n var status = request.status;\n if (!status && xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {\n callback(null, request.responseText);\n } else {\n callback(request, null);\n }\n }\n\n if (async) {\n if ('onload' in request) {\n request.onload = request.onerror = respond;\n } else {\n request.onreadystatechange = function() {\n if (request.readyState > 3) respond();\n };\n }\n }\n \n request.open('GET', url, async);\n request.send();\n \n if (!async && xhrHasResponse(request)) {\n return request.responseText;\n }\n}\n\nfunction file(filename, callback) {\n var fs = require('fs');\n if (!callback) {\n return fs.readFileSync(filename, 'utf8');\n }\n fs.readFile(filename, callback);\n}\n\nfunction http(url, callback) {\n if (!callback) {\n return require('sync-request')('GET', url).getBody();\n }\n \n var options = {url: url, encoding: null, gzip: true};\n require('request')(options, function(error, response, body) {\n if (!error && response.statusCode === 200) {\n callback(null, body);\n } else {\n error = error ||\n 'Load failed with response code ' + response.statusCode + '.';\n callback(error, null);\n }\n });\n}\n\nfunction startsWith(string, searchString) {\n return string == null ? false : string.lastIndexOf(searchString, 0) === 0;\n}\n\nload.sanitizeUrl = sanitizeUrl;\n\nload.useXHR = (typeof XMLHttpRequest !== 'undefined');\n\nmodule.exports = load;\n\n},{\"fs\":1,\"request\":1,\"sync-request\":1,\"url\":1}],24:[function(require,module,exports){\nvar util = require('../util');\nvar type = require('./type');\nvar formats = require('./formats');\n\nfunction read(data, format) {\n var type = (format && format.type) || 'json';\n data = formats[type](data, format);\n if (format && format.parse) parse(data, format.parse);\n return data;\n}\n\nfunction parse(data, types) {\n var cols, parsers, d, i, j, clen, len = data.length;\n\n types = (types==='auto') ? type.inferAll(data) : util.duplicate(types);\n cols = util.keys(types);\n parsers = cols.map(function(c) { return type.parsers[types[c]]; });\n\n for (i=0, clen=cols.length; i 0 ? Math.min(l, opt.maxwidth) : l;\n });\n\n // print header row\n var head = fields.map(function(name, i) {\n return util.truncate(util.pad(name, lens[i], 'center'), lens[i]);\n }).join(opt.separator);\n\n // build template function for each row\n var tmpl = template(fields.map(function(name, i) {\n return '{{' +\n name +\n (FMT[types[name]] || '') +\n ('|pad:' + lens[i] + ',' + (POS[types[name]] || 'right')) +\n ('|truncate:' + lens[i]) +\n '}}';\n }).join(opt.separator));\n\n // print table\n return head + \"\\n\" + data.map(tmpl).join('\\n');\n};\n\nmodule.exports.summary = function(s) {\n s = s ? s.__summary__ ? s : stats.summary(s) : this;\n var str = [], i, n;\n for (i=0, n=s.length; i b) b = v;\n }\n }\n return [a, b];\n};\n\n// Find the integer indices of the minimum and maximum values.\nstats.extent.index = function(values, f) {\n f = util.$(f);\n var x = -1, y = -1, a, b, v, i, n = values.length;\n for (i=0; i b) { b = v; y = i; }\n }\n }\n return [x, y];\n};\n\n// Compute the dot product of two arrays of numbers.\nstats.dot = function(values, a, b) {\n var sum = 0, i, v;\n if (!b) {\n if (values.length !== a.length) {\n throw Error('Array lengths must match.');\n }\n for (i=0; i -1 && p !== v) {\n mu = 1 + (i-1 + tie) / 2;\n for (; tie -1) {\n mu = 1 + (n-1 + tie) / 2;\n for (; tie max) max = x;\n delta = x - mean;\n mean = mean + delta / (++valid);\n M2 = M2 + delta * (x - mean);\n vals.push(x);\n }\n }\n M2 = M2 / (valid - 1);\n sd = Math.sqrt(M2);\n\n // sort values for median and iqr\n vals.sort(util.cmp);\n\n return {\n type: type(values, f),\n unique: u,\n count: values.length,\n valid: valid,\n missing: missing,\n distinct: distinct,\n min: min,\n max: max,\n mean: mean,\n stdev: sd,\n median: (v = stats.quantile(vals, 0.5)),\n q1: stats.quantile(vals, 0.25),\n q3: stats.quantile(vals, 0.75),\n modeskew: sd === 0 ? 0 : (mean - v) / sd\n };\n};\n\n// Compute profiles for all variables in a data set.\nstats.summary = function(data, fields) {\n fields = fields || util.keys(data[0]);\n var s = fields.map(function(f) {\n var p = stats.profile(data, util.$(f));\n return (p.field = f, p);\n });\n return (s.__summary__ = true, s);\n};\n\nmodule.exports = stats;\n},{\"./generate\":17,\"./import/type\":26,\"./util\":32}],30:[function(require,module,exports){\nvar util = require('./util'),\n format = require('./format');\n\nvar context = {\n formats: [],\n format_map: {},\n truncate: util.truncate,\n pad: util.pad\n};\n\nfunction template(text) {\n var src = source(text, 'd');\n src = 'var __t; return ' + src + ';';\n\n /* jshint evil: true */\n return (new Function('d', src)).bind(context);\n}\n\ntemplate.source = source;\ntemplate.context = context;\nmodule.exports = template;\n\n// Clear cache of format objects.\n// This can *break* prior template functions, so invoke with care!\ntemplate.clearFormatCache = function() {\n context.formats = [];\n context.format_map = {};\n};\n\n// Generate property access code for use within template source.\n// object: the name of the object (variable) containing template data\n// property: the property access string, verbatim from template tag\ntemplate.property = function(object, property) {\n var src = util.field(property).map(util.str).join('][');\n return object + '[' + src + ']';\n};\n\n// Generate source code for a template function.\n// text: the template text\n// variable: the name of the data object variable ('obj' by default)\n// properties: optional hash for collecting all accessed properties\nfunction source(text, variable, properties) {\n variable = variable || 'obj';\n var index = 0;\n var src = '\\'';\n var regex = template_re;\n\n // Compile the template source, escaping string literals appropriately.\n text.replace(regex, function(match, interpolate, offset) {\n src += text\n .slice(index, offset)\n .replace(template_escaper, template_escapeChar);\n index = offset + match.length;\n\n if (interpolate) {\n src += '\\'\\n+((__t=(' +\n template_var(interpolate, variable, properties) +\n '))==null?\\'\\':__t)+\\n\\'';\n }\n\n // Adobe VMs need the match returned to produce the correct offest.\n return match;\n });\n return src + '\\'';\n}\n\nfunction template_var(text, variable, properties) {\n var filters = text.match(filter_re);\n var prop = filters.shift().trim();\n var stringCast = true;\n\n function strcall(fn) {\n fn = fn || '';\n if (stringCast) {\n stringCast = false;\n src = 'String(' + src + ')' + fn;\n } else {\n src += fn;\n }\n return src;\n }\n\n function date() {\n return '(typeof ' + src + '===\"number\"?new Date('+src+'):'+src+')';\n }\n\n function number_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+src+')';\n }\n \n function time_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+date()+')';\n }\n\n if (properties) properties[prop] = 1;\n var src = template.property(variable, prop);\n\n for (var i=0; i 0) {\n f = f.slice(0, pidx);\n args = filters[i].slice(pidx+1)\n .match(args_re)\n .map(function(s) { return s.trim(); });\n }\n f = f.trim();\n\n switch (f) {\n case 'length':\n strcall('.length');\n break;\n case 'lower':\n strcall('.toLowerCase()');\n break;\n case 'upper':\n strcall('.toUpperCase()');\n break;\n case 'lower-locale':\n strcall('.toLocaleLowerCase()');\n break;\n case 'upper-locale':\n strcall('.toLocaleUpperCase()');\n break;\n case 'trim':\n strcall('.trim()');\n break;\n case 'left':\n a = util.number(args[0]);\n strcall('.slice(0,' + a + ')');\n break;\n case 'right':\n a = util.number(args[0]);\n strcall('.slice(-' + a +')');\n break;\n case 'mid':\n a = util.number(args[0]);\n b = a + util.number(args[1]);\n strcall('.slice(+'+a+','+b+')');\n break;\n case 'slice':\n a = util.number(args[0]);\n strcall('.slice('+ a +\n (args.length > 1 ? ',' + util.number(args[1]) : '') +\n ')');\n break;\n case 'truncate':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.truncate(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'pad':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.pad(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'number':\n number_format(format.number, 'number');\n break;\n case 'time':\n time_format(format.time, 'time');\n break;\n case 'time-utc':\n time_format(format.utc, 'time-utc');\n break;\n default:\n throw Error('Unrecognized template filter: ' + f);\n }\n }\n\n return src;\n}\n\nvar template_re = /\\{\\{(.+?)\\}\\}|$/g,\n filter_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^\\|\"]+|[^\\|\\']+)+/g,\n args_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^,\"]+|[^,\\']+)+/g;\n\n// Certain characters need to be escaped so that they can be put into a\n// string literal.\nvar template_escapes = {\n '\\'': '\\'',\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\nvar template_escaper = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\nfunction template_escapeChar(match) {\n return '\\\\' + template_escapes[match];\n}\n\nfunction template_format(pattern, key, fmt) {\n if ((pattern[0] === '\\'' && pattern[pattern.length-1] === '\\'') ||\n (pattern[0] === '\"' && pattern[pattern.length-1] === '\"')) {\n pattern = pattern.slice(1, -1);\n } else {\n throw Error('Format pattern must be quoted: ' + pattern);\n }\n key = key + ':' + pattern;\n if (!context.format_map[key]) {\n var f = fmt(pattern);\n var i = context.formats.length;\n context.formats.push(f);\n context.format_map[key] = i;\n }\n return context.format_map[key];\n}\n\n},{\"./format\":16,\"./util\":32}],31:[function(require,module,exports){\nvar d3_time = require('d3-time');\n\nvar tempDate = new Date(),\n baseDate = new Date(0, 0, 1).setFullYear(0), // Jan 1, 0 AD\n utcBaseDate = new Date(Date.UTC(0, 0, 1)).setUTCFullYear(0);\n\nfunction date(d) {\n return (tempDate.setTime(+d), tempDate);\n}\n\n// create a time unit entry\nfunction entry(type, date, unit, step, min, max) {\n var e = {\n type: type,\n date: date,\n unit: unit\n };\n if (step) {\n e.step = step;\n } else {\n e.minstep = 1;\n }\n if (min != null) e.min = min;\n if (max != null) e.max = max;\n return e;\n}\n\nfunction create(type, unit, base, step, min, max) {\n return entry(type,\n function(d) { return unit.offset(base, d); },\n function(d) { return unit.count(base, d); },\n step, min, max);\n}\n\nvar locale = [\n create('second', d3_time.second, baseDate),\n create('minute', d3_time.minute, baseDate),\n create('hour', d3_time.hour, baseDate),\n create('day', d3_time.day, baseDate, [1, 7]),\n create('month', d3_time.month, baseDate, [1, 3, 6]),\n create('year', d3_time.year, baseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(1970, 0, 1, 0, 0, d); },\n function(d) { return date(d).getSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(1970, 0, 1, 0, d); },\n function(d) { return date(d).getMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(1970, 0, 1, d); },\n function(d) { return date(d).getHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(1970, 0, 4+d); },\n function(d) { return date(d).getDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(1970, 0, d); },\n function(d) { return date(d).getDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(1970, d % 12, 1); },\n function(d) { return date(d).getMonth(); },\n [1], 0, 11\n )\n];\n\nvar utc = [\n create('second', d3_time.utcSecond, utcBaseDate),\n create('minute', d3_time.utcMinute, utcBaseDate),\n create('hour', d3_time.utcHour, utcBaseDate),\n create('day', d3_time.utcDay, utcBaseDate, [1, 7]),\n create('month', d3_time.utcMonth, utcBaseDate, [1, 3, 6]),\n create('year', d3_time.utcYear, utcBaseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, 0, d)); },\n function(d) { return date(d).getUTCSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, d)); },\n function(d) { return date(d).getUTCMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(Date.UTC(1970, 0, 1, d)); },\n function(d) { return date(d).getUTCHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(Date.UTC(1970, 0, 4+d)); },\n function(d) { return date(d).getUTCDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(Date.UTC(1970, 0, d)); },\n function(d) { return date(d).getUTCDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(Date.UTC(1970, d % 12, 1)); },\n function(d) { return date(d).getUTCMonth(); },\n [1], 0, 11\n )\n];\n\nvar STEPS = [\n [31536e6, 5], // 1-year\n [7776e6, 4], // 3-month\n [2592e6, 4], // 1-month\n [12096e5, 3], // 2-week\n [6048e5, 3], // 1-week\n [1728e5, 3], // 2-day\n [864e5, 3], // 1-day\n [432e5, 2], // 12-hour\n [216e5, 2], // 6-hour\n [108e5, 2], // 3-hour\n [36e5, 2], // 1-hour\n [18e5, 1], // 30-minute\n [9e5, 1], // 15-minute\n [3e5, 1], // 5-minute\n [6e4, 1], // 1-minute\n [3e4, 0], // 30-second\n [15e3, 0], // 15-second\n [5e3, 0], // 5-second\n [1e3, 0] // 1-second\n];\n\nfunction find(units, span, minb, maxb) {\n var step = STEPS[0], i, n, bins;\n\n for (i=1, n=STEPS.length; i step[0]) {\n bins = span / step[0];\n if (bins > maxb) {\n return units[STEPS[i-1][1]];\n }\n if (bins >= minb) {\n return units[step[1]];\n }\n }\n }\n return units[STEPS[n-1][1]];\n}\n\nfunction toUnitMap(units) {\n var map = {}, i, n;\n for (i=0, n=units.length; i 1 ?\n function(x) { return s.reduce(function(x,f) { return x[f]; }, x); } :\n function(x) { return x[f]; }\n );\n};\n\n// short-cut for accessor\nu.$ = u.accessor;\n\nu.mutator = function(f) {\n var s;\n return u.isString(f) && (s=u.field(f)).length > 1 ?\n function(x, v) {\n for (var i=0; i y) return sign[i];\n }\n return 0;\n };\n};\n\nu.cmp = function(a, b) {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else if (a >= b) {\n return 0;\n } else if (a === null) {\n return -1;\n } else if (b === null) {\n return 1;\n }\n return NaN;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i 1) {\n for (var i=1, n=ref.length; i 0) {\n node = pq.peek();\n pulse = pulses[node._id];\n\n if (node.rank() !== node.qrank()) {\n // A node's rank might change during a propagation. Re-queue if so.\n pq.replace(node.qrank(true));\n } else {\n // Evaluate node and propagate pulse.\n pq.pop();\n pulses[node._id] = null;\n listeners = node._listeners;\n pulse = this.evaluate(pulse, node);\n\n // Propagate the pulse. \n if (pulse !== this.doNotPropagate) {\n // Ensure reflow pulses always send reflow pulses even if skipped.\n if (!pulse.reflow && node.reflows()) {\n pulse = ChangeSet.create(pulse, true);\n }\n\n for (i=0, len=listeners.length; i 0) branch[i-1].addListener(node);\n }\n\n return branch;\n};\n\nprototype.disconnect = function(branch) {\n var collector, node, data, signals, i, n, j, m;\n\n for (i=0, n=branch.length; i= pulse.stamp,\n run = node.router() || pulse.add.length || pulse.rem.length;\n\n return run || !reflowed || node.reevaluate(pulse);\n};\n\nprototype.evaluate = function(pulse, node) {\n if (!this.reevaluate(pulse, node)) return pulse;\n pulse = node.evaluate(pulse);\n node.last(pulse.stamp);\n return pulse;\n};\n\nmodule.exports = Graph;\n\n},{\"./ChangeSet\":34,\"./Collector\":35,\"./DataSource\":36,\"./Dependencies\":37,\"./Heap\":39,\"./Signal\":41,\"./Tuple\":42,\"datalib\":27}],39:[function(require,module,exports){\nfunction Heap(comparator) {\n this.cmp = comparator;\n this.nodes = [];\n}\n\nvar prototype = Heap.prototype;\n\nprototype.size = function() {\n return this.nodes.length;\n};\n\nprototype.clear = function() {\n return (this.nodes = [], this);\n};\n\nprototype.peek = function() {\n return this.nodes[0];\n};\n\nprototype.push = function(x) {\n var array = this.nodes;\n array.push(x);\n return _siftdown(array, 0, array.length-1, this.cmp);\n};\n\nprototype.pop = function() {\n var array = this.nodes,\n last = array.pop(),\n item;\n\n if (array.length) {\n item = array[0];\n array[0] = last;\n _siftup(array, 0, this.cmp);\n } else {\n item = last;\n }\n return item;\n};\n\nprototype.replace = function(item) {\n var array = this.nodes,\n retval = array[0];\n array[0] = item;\n _siftup(array, 0, this.cmp);\n return retval;\n};\n\nprototype.pushpop = function(item) {\n var array = this.nodes, ref = array[0];\n if (array.length && this.cmp(ref, item) < 0) {\n array[0] = item;\n item = ref;\n _siftup(array, 0, this.cmp);\n }\n return item;\n};\n\nfunction _siftdown(array, start, idx, cmp) {\n var item, parent, pidx;\n\n item = array[idx];\n while (idx > start) {\n pidx = (idx - 1) >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return (array[idx] = item);\n}\n\nfunction _siftup(array, idx, cmp) {\n var start = idx,\n end = array.length,\n item = array[idx],\n cidx = 2 * idx + 1, ridx;\n\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = 2 * idx + 1;\n }\n array[idx] = item;\n return _siftdown(array, start, idx, cmp);\n}\n\nmodule.exports = Heap;\n\n},{}],40:[function(require,module,exports){\nvar DEPS = require('./Dependencies').ALL,\n nodeID = 0;\n\nfunction Node(graph) {\n if (graph) this.init(graph);\n}\n\nvar Flags = Node.Flags = {\n Router: 0x01, // Responsible for propagating tuples, cannot be skipped.\n Collector: 0x02, // Holds a materialized dataset, pulse node to reflow.\n Produces: 0x04, // Produces new tuples. \n Mutates: 0x08, // Sets properties of incoming tuples.\n Reflows: 0x10, // Forwards a reflow pulse.\n Batch: 0x20 // Performs batch data processing, needs collector.\n};\n\nvar prototype = Node.prototype;\n\nprototype.init = function(graph) {\n this._id = ++nodeID;\n this._graph = graph;\n this._rank = graph.rank(); // Topological sort by rank\n this._qrank = null; // Rank when enqueued for propagation\n this._stamp = 0; // Last stamp seen\n\n this._listeners = [];\n this._listeners._ids = {}; // To prevent duplicate listeners\n\n // Initialize dependencies.\n this._deps = {};\n for (var i=0, n=DEPS.length; i l._rank) {\n var q = [l],\n g = this._graph, cur;\n while (q.length) {\n cur = q.shift();\n cur._rank = g.rank();\n q.unshift.apply(q, cur.listeners());\n }\n }\n\n return this;\n};\n\nprototype.removeListener = function(l) {\n if (!this._listeners._ids[l._id]) return false;\n \n var idx = this._listeners.indexOf(l),\n b = idx >= 0;\n\n if (b) {\n this._listeners.splice(idx, 1);\n this._listeners._ids[l._id] = null;\n }\n return b;\n};\n\nprototype.disconnect = function() {\n this._listeners = [];\n this._listeners._ids = {};\n};\n\n// Evaluate this dataflow node for the current pulse.\n// Subclasses should override to perform custom processing.\nprototype.evaluate = function(pulse) {\n return pulse;\n};\n\n// Should this node be re-evaluated for the current pulse?\n// Searches pulse to see if any dependencies have updated.\nprototype.reevaluate = function(pulse) {\n var prop, dep, i, n, j, m;\n\n for (i=0, n=DEPS.length; i=0;) {\n if (!handler || h[i].handler === handler) {\n x = h.splice(i, 1)[0];\n this.removeListener(x.node);\n }\n }\n\n return this;\n};\n\nmodule.exports = Signal;\n\n},{\"./ChangeSet\":34,\"./Node\":40}],42:[function(require,module,exports){\nvar tupleID = 0;\n\nfunction ingest(datum) {\n datum = (datum === Object(datum)) ? datum : {data: datum};\n datum._id = ++tupleID;\n if (datum._prev) datum._prev = null;\n return datum;\n}\n\nfunction idMap(a, ids) {\n ids = ids || {};\n for (var i=0, n=a.length; i0;) {\n idMap(arguments[i], ids);\n }\n return data.filter(function(x) { return !ids[x._id]; });\n }\n};\n\n},{}],43:[function(require,module,exports){\nmodule.exports = {\n ChangeSet: require('./ChangeSet'),\n Collector: require('./Collector'),\n DataSource: require('./DataSource'),\n Dependencies: require('./Dependencies'),\n Graph: require('./Graph'),\n Node: require('./Node'),\n Signal: require('./Signal'),\n Tuple: require('./Tuple'),\n debug: require('vega-logging').debug\n};\n\n},{\"./ChangeSet\":34,\"./Collector\":35,\"./DataSource\":36,\"./Dependencies\":37,\"./Graph\":38,\"./Node\":40,\"./Signal\":41,\"./Tuple\":42,\"vega-logging\":33}],44:[function(require,module,exports){\nfunction toMap(list) {\n var map = {}, i, n;\n for (i=0, n=list.length; i 0) {\n return id;\n }\n if (constants.hasOwnProperty(id)) {\n return constants[id];\n }\n if (idWhiteList) {\n if (idWhiteList.hasOwnProperty(id)) {\n return id;\n } else {\n globals[id] = 1;\n return lookupGlobal(id);\n }\n }\n if (idBlackList && idBlackList.hasOwnProperty(id)) {\n throw new Error('Illegal identifier: ' + id);\n }\n return id;\n },\n 'Program': function(n) {\n return n.body.map(codegen).join('\\n');\n },\n 'MemberExpression': function(n) {\n var d = !n.computed;\n var o = codegen(n.object);\n if (d) memberDepth += 1;\n var p = codegen(n.property);\n if (o === FIELD_VAR) { fields[p] = 1; } // HACKish...\n if (d) memberDepth -= 1;\n return o + (d ? '.'+p : '['+p+']');\n },\n 'CallExpression': function(n) {\n if (n.callee.type !== 'Identifier') {\n throw new Error('Illegal callee type: ' + n.callee.type);\n }\n var callee = n.callee.name;\n var args = n.arguments;\n var fn = functions.hasOwnProperty(callee) && functions[callee];\n if (!fn) throw new Error('Unrecognized function: ' + callee);\n return fn instanceof Function ?\n fn(args) :\n fn + '(' + args.map(codegen).join(',') + ')';\n },\n 'ArrayExpression': function(n) {\n return '[' + n.elements.map(codegen).join(',') + ']';\n },\n 'BinaryExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'UnaryExpression': function(n) {\n return '(' + n.operator + codegen(n.argument) + ')';\n },\n 'ConditionalExpression': function(n) {\n return '(' + codegen(n.test) +\n '?' + codegen(n.consequent) +\n ':' + codegen(n.alternate) +\n ')';\n },\n 'LogicalExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'ObjectExpression': function(n) {\n return '{' + n.properties.map(codegen).join(',') + '}';\n },\n 'Property': function(n) {\n memberDepth += 1;\n var k = codegen(n.key);\n memberDepth -= 1;\n return k + ':' + codegen(n.value);\n },\n 'ExpressionStatement': function(n) {\n return codegen(n.expression);\n }\n };\n\n codegen_wrap.functions = functions;\n codegen_wrap.constants = constants;\n return codegen_wrap;\n};\n\n},{\"./constants\":45,\"./functions\":46}],45:[function(require,module,exports){\nmodule.exports = {\n 'NaN': 'NaN',\n 'E': 'Math.E',\n 'LN2': 'Math.LN2',\n 'LN10': 'Math.LN10',\n 'LOG2E': 'Math.LOG2E',\n 'LOG10E': 'Math.LOG10E',\n 'PI': 'Math.PI',\n 'SQRT1_2': 'Math.SQRT1_2',\n 'SQRT2': 'Math.SQRT2'\n};\n},{}],46:[function(require,module,exports){\nmodule.exports = function(codegen) {\n\n function fncall(name, args, cast, type) {\n var obj = codegen(args[0]);\n if (cast) {\n obj = cast + '(' + obj + ')';\n if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';\n }\n return obj + '.' + name + (type < 0 ? '' : type === 0 ?\n '()' :\n '(' + args.slice(1).map(codegen).join(',') + ')');\n }\n\n function fn(name, cast, type) {\n return function(args) {\n return fncall(name, args, cast, type);\n };\n }\n\n var DATE = 'new Date',\n STRING = 'String',\n REGEXP = 'RegExp';\n\n return {\n // MATH functions\n 'isNaN': 'isNaN',\n 'isFinite': 'isFinite',\n 'abs': 'Math.abs',\n 'acos': 'Math.acos',\n 'asin': 'Math.asin',\n 'atan': 'Math.atan',\n 'atan2': 'Math.atan2',\n 'ceil': 'Math.ceil',\n 'cos': 'Math.cos',\n 'exp': 'Math.exp',\n 'floor': 'Math.floor',\n 'log': 'Math.log',\n 'max': 'Math.max',\n 'min': 'Math.min',\n 'pow': 'Math.pow',\n 'random': 'Math.random',\n 'round': 'Math.round',\n 'sin': 'Math.sin',\n 'sqrt': 'Math.sqrt',\n 'tan': 'Math.tan',\n\n 'clamp': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to clamp function.');\n if (args.length > 3)\n throw new Error('Too many arguments to clamp function.');\n var a = args.map(codegen);\n return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))';\n },\n\n // DATE functions\n 'now': 'Date.now',\n 'datetime': DATE,\n 'date': fn('getDate', DATE, 0),\n 'day': fn('getDay', DATE, 0),\n 'year': fn('getFullYear', DATE, 0),\n 'month': fn('getMonth', DATE, 0),\n 'hours': fn('getHours', DATE, 0),\n 'minutes': fn('getMinutes', DATE, 0),\n 'seconds': fn('getSeconds', DATE, 0),\n 'milliseconds': fn('getMilliseconds', DATE, 0),\n 'time': fn('getTime', DATE, 0),\n 'timezoneoffset': fn('getTimezoneOffset', DATE, 0),\n 'utcdate': fn('getUTCDate', DATE, 0),\n 'utcday': fn('getUTCDay', DATE, 0),\n 'utcyear': fn('getUTCFullYear', DATE, 0),\n 'utcmonth': fn('getUTCMonth', DATE, 0),\n 'utchours': fn('getUTCHours', DATE, 0),\n 'utcminutes': fn('getUTCMinutes', DATE, 0),\n 'utcseconds': fn('getUTCSeconds', DATE, 0),\n 'utcmilliseconds': fn('getUTCMilliseconds', DATE, 0),\n\n // shared sequence functions\n 'length': fn('length', null, -1),\n 'indexof': fn('indexOf', null),\n 'lastindexof': fn('lastIndexOf', null),\n\n // STRING functions\n 'parseFloat': 'parseFloat',\n 'parseInt': 'parseInt',\n 'upper': fn('toUpperCase', STRING, 0),\n 'lower': fn('toLowerCase', STRING, 0),\n 'slice': fn('slice', STRING),\n 'substring': fn('substring', STRING),\n\n // REGEXP functions\n 'regexp': REGEXP,\n 'test': fn('test', REGEXP),\n\n // Control Flow functions\n 'if': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to if function.');\n if (args.length > 3)\n throw new Error('Too many arguments to if function.');\n var a = args.map(codegen);\n return a[0]+'?'+a[1]+':'+a[2];\n }\n };\n};\n},{}],47:[function(require,module,exports){\nvar parser = require('./parser'),\n codegen = require('./codegen');\n \nvar expr = module.exports = {\n parse: function(input, opt) {\n return parser.parse('('+input+')', opt);\n },\n code: function(opt) {\n return codegen(opt);\n },\n compiler: function(args, opt) {\n args = args.slice();\n var generator = codegen(opt),\n len = args.length,\n compile = function(str) {\n var value = generator(expr.parse(str));\n args[len] = '\"use strict\"; return (' + value.code + ');';\n value.fn = Function.apply(null, args);\n return value;\n };\n compile.codegen = generator;\n return compile;\n },\n functions: require('./functions'),\n constants: require('./constants')\n};\n\n},{\"./codegen\":44,\"./constants\":45,\"./functions\":46,\"./parser\":48}],48:[function(require,module,exports){\n/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \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*/\n/* istanbul ignore next */\nmodule.exports = (function() {\n 'use strict';\n\n var Token,\n TokenName,\n Syntax,\n PropertyKind,\n Messages,\n Regex,\n source,\n strict,\n index,\n lineNumber,\n lineStart,\n length,\n lookahead,\n state,\n extra;\n\n Token = {\n BooleanLiteral: 1,\n EOF: 2,\n Identifier: 3,\n Keyword: 4,\n NullLiteral: 5,\n NumericLiteral: 6,\n Punctuator: 7,\n StringLiteral: 8,\n RegularExpression: 9\n };\n\n TokenName = {};\n TokenName[Token.BooleanLiteral] = 'Boolean';\n TokenName[Token.EOF] = '';\n TokenName[Token.Identifier] = 'Identifier';\n TokenName[Token.Keyword] = 'Keyword';\n TokenName[Token.NullLiteral] = 'Null';\n TokenName[Token.NumericLiteral] = 'Numeric';\n TokenName[Token.Punctuator] = 'Punctuator';\n TokenName[Token.StringLiteral] = 'String';\n TokenName[Token.RegularExpression] = 'RegularExpression';\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n ArrayExpression: 'ArrayExpression',\n BinaryExpression: 'BinaryExpression',\n CallExpression: 'CallExpression',\n ConditionalExpression: 'ConditionalExpression',\n ExpressionStatement: 'ExpressionStatement',\n Identifier: 'Identifier',\n Literal: 'Literal',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n ObjectExpression: 'ObjectExpression',\n Program: 'Program',\n Property: 'Property',\n UnaryExpression: 'UnaryExpression'\n };\n\n PropertyKind = {\n Data: 1,\n Get: 2,\n Set: 4\n };\n\n // Error messages should be identical to V8.\n Messages = {\n UnexpectedToken: 'Unexpected token %0',\n UnexpectedNumber: 'Unexpected number',\n UnexpectedString: 'Unexpected string',\n UnexpectedIdentifier: 'Unexpected identifier',\n UnexpectedReserved: 'Unexpected reserved word',\n UnexpectedEOS: 'Unexpected end of input',\n NewlineAfterThrow: 'Illegal newline after throw',\n InvalidRegExp: 'Invalid regular expression',\n UnterminatedRegExp: 'Invalid regular expression: missing /',\n InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n NoCatchOrFinally: 'Missing catch or finally after try',\n UnknownLabel: 'Undefined label \\'%0\\'',\n Redeclaration: '%0 \\'%1\\' has already been declared',\n IllegalContinue: 'Illegal continue statement',\n IllegalBreak: 'Illegal break statement',\n IllegalReturn: 'Illegal return statement',\n StrictModeWith: 'Strict mode code may not include a with statement',\n StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',\n AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',\n AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',\n StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n StrictReservedWord: 'Use of future reserved word in strict mode'\n };\n\n // See also tools/generate-unicode-regex.py.\n Regex = {\n NonAsciiIdentifierStart: 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]'),\n NonAsciiIdentifierPart: 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-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\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]')\n };\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\n function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }\n\n function isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n }\n\n function isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n }\n\n function isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n }\n\n // 7.2 White Space\n\n function 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\n function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }\n\n // 7.6 Identifier Names and Identifiers\n\n function 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) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n }\n\n function 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) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n }\n\n // 7.6.1.2 Future Reserved Words\n\n function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }\n\n function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }\n\n // 7.6.1.1 Keywords\n\n function isKeyword(id) {\n if (strict && isStrictModeReservedWord(id)) {\n return true;\n }\n\n // 'const' is specialized as Keyword in V8.\n // 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.\n // Some others are from future reserved words.\n\n switch (id.length) {\n case 2:\n return (id === 'if') || (id === 'in') || (id === 'do');\n case 3:\n return (id === 'var') || (id === 'for') || (id === 'new') ||\n (id === 'try') || (id === 'let');\n case 4:\n return (id === 'this') || (id === 'else') || (id === 'case') ||\n (id === 'void') || (id === 'with') || (id === 'enum');\n case 5:\n return (id === 'while') || (id === 'break') || (id === 'catch') ||\n (id === 'throw') || (id === 'const') || (id === 'yield') ||\n (id === 'class') || (id === 'super');\n case 6:\n return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n (id === 'switch') || (id === 'export') || (id === 'import');\n case 7:\n return (id === 'default') || (id === 'finally') || (id === 'extends');\n case 8:\n return (id === 'function') || (id === 'continue') || (id === 'debugger');\n case 10:\n return (id === 'instanceof');\n default:\n return false;\n }\n }\n\n function skipComment() {\n var ch, start;\n\n start = (index === 0);\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch)) {\n ++index;\n } else if (isLineTerminator(ch)) {\n ++index;\n if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n start = true;\n } else {\n break;\n }\n }\n }\n\n function 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 return '';\n }\n }\n return String.fromCharCode(code);\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, '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\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n id += ch;\n }\n }\n\n return id;\n }\n\n function 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\n function 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 = Token.Identifier;\n } else if (isKeyword(id)) {\n type = Token.Keyword;\n } else if (id === 'null') {\n type = Token.NullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = Token.BooleanLiteral;\n } else {\n type = Token.Identifier;\n }\n\n return {\n type: type,\n value: id,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.7 Punctuators\n\n function 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 if (extra.tokenize) {\n if (code === 0x28) {\n extra.openParenToken = extra.tokens.length;\n } else if (code === 0x7B) {\n extra.openCurlyToken = extra.tokens.length;\n }\n }\n return {\n type: Token.Punctuator,\n value: String.fromCharCode(code),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: source.slice(start, index),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch4,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch3,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch2,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch1,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n // 7.8.3 Numeric Literals\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt('0x' + number, 16),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseFloat(number),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.8.4 String Literals\n\n function scanStringLiteral() {\n var str = '', quote, start, ch, code, unescaped, restore, octal = false, startLineNumber, startLineStart;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\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 restore = index;\n unescaped = scanHexEscape(ch);\n if (unescaped) {\n str += unescaped;\n } else {\n index = restore;\n str += ch;\n }\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 ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.StringLiteral,\n value: str,\n octal: octal,\n startLineNumber: startLineNumber,\n startLineStart: startLineStart,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function testRegExp(pattern, flags) {\n var tmp = pattern,\n value;\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({}, Messages.InvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n value = new RegExp(tmp);\n } catch (e) {\n throwError({}, Messages.InvalidRegExp);\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\n function 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({}, Messages.UnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, Messages.UnterminatedRegExp);\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({}, Messages.UnterminatedRegExp);\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\n function scanRegExpFlags() {\n var ch, str, flags, restore;\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 ch = source[index];\n if (ch === 'u') {\n ++index;\n restore = index;\n ch = scanHexEscape('u');\n if (ch) {\n flags += ch;\n for (str += '\\\\u'; restore < index; ++restore) {\n str += source[restore];\n }\n } else {\n index = restore;\n flags += 'u';\n str += '\\\\u';\n }\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n } else {\n str += '\\\\';\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n return {\n value: flags,\n literal: str\n };\n }\n\n function 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 if (extra.tokenize) {\n return {\n type: Token.RegularExpression,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\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\n function collectRegex() {\n var pos, loc, regex, token;\n\n skipComment();\n\n pos = index;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n regex = scanRegExp();\n\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (!extra.tokenize) {\n // Pop the previous token, which is likely '/' or '/='\n if (extra.tokens.length > 0) {\n token = extra.tokens[extra.tokens.length - 1];\n if (token.range[0] === pos && token.type === 'Punctuator') {\n if (token.value === '/' || token.value === '/=') {\n extra.tokens.pop();\n }\n }\n }\n\n extra.tokens.push({\n type: 'RegularExpression',\n value: regex.literal,\n regex: regex.regex,\n range: [pos, index],\n loc: loc\n });\n }\n\n return regex;\n }\n\n function isIdentifierName(token) {\n return token.type === Token.Identifier ||\n token.type === Token.Keyword ||\n token.type === Token.BooleanLiteral ||\n token.type === Token.NullLiteral;\n }\n\n function advanceSlash() {\n var prevToken,\n checkToken;\n // Using the following algorithm:\n // https://github.com/mozilla/sweet.js/wiki/design\n prevToken = extra.tokens[extra.tokens.length - 1];\n if (!prevToken) {\n // Nothing before that: it cannot be a division.\n return collectRegex();\n }\n if (prevToken.type === 'Punctuator') {\n if (prevToken.value === ']') {\n return scanPunctuator();\n }\n if (prevToken.value === ')') {\n checkToken = extra.tokens[extra.openParenToken - 1];\n if (checkToken &&\n checkToken.type === 'Keyword' &&\n (checkToken.value === 'if' ||\n checkToken.value === 'while' ||\n checkToken.value === 'for' ||\n checkToken.value === 'with')) {\n return collectRegex();\n }\n return scanPunctuator();\n }\n if (prevToken.value === '}') {\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n if (extra.tokens[extra.openCurlyToken - 3] &&\n extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {\n // Anonymous function.\n checkToken = extra.tokens[extra.openCurlyToken - 4];\n if (!checkToken) {\n return scanPunctuator();\n }\n } else if (extra.tokens[extra.openCurlyToken - 4] &&\n extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {\n // Named function.\n checkToken = extra.tokens[extra.openCurlyToken - 5];\n if (!checkToken) {\n return collectRegex();\n }\n } else {\n return scanPunctuator();\n }\n return scanPunctuator();\n }\n return collectRegex();\n }\n if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {\n return collectRegex();\n }\n return scanPunctuator();\n }\n\n function advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: Token.EOF,\n lineNumber: lineNumber,\n lineStart: lineStart,\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 // Slash (/) U+002F can also start a regex.\n if (extra.tokenize && ch === 0x2F) {\n return advanceSlash();\n }\n\n return scanPunctuator();\n }\n\n function collectToken() {\n var loc, token, value, entry;\n\n skipComment();\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n token = advance();\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (token.type !== Token.EOF) {\n value = source.slice(token.start, token.end);\n entry = {\n type: TokenName[token.type],\n value: value,\n range: [token.start, token.end],\n loc: loc\n };\n if (token.regex) {\n entry.regex = {\n pattern: token.regex.pattern,\n flags: token.regex.flags\n };\n }\n extra.tokens.push(entry);\n }\n\n return token;\n }\n\n function lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n return token;\n }\n\n function peek() {\n var pos, line, start;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n index = pos;\n lineNumber = line;\n lineStart = start;\n }\n\n function Position() {\n this.line = lineNumber;\n this.column = index - lineStart;\n }\n\n function SourceLocation() {\n this.start = new Position();\n this.end = null;\n }\n\n function WrappingSourceLocation(startToken) {\n if (startToken.type === Token.StringLiteral) {\n this.start = {\n line: startToken.startLineNumber,\n column: startToken.start - startToken.startLineStart\n };\n } else {\n this.start = {\n line: startToken.lineNumber,\n column: startToken.start - startToken.lineStart\n };\n }\n this.end = null;\n }\n\n function Node() {\n // Skip comment.\n index = lookahead.start;\n if (lookahead.type === Token.StringLiteral) {\n lineNumber = lookahead.startLineNumber;\n lineStart = lookahead.startLineStart;\n } else {\n lineNumber = lookahead.lineNumber;\n lineStart = lookahead.lineStart;\n }\n if (extra.range) {\n this.range = [index, 0];\n }\n if (extra.loc) {\n this.loc = new SourceLocation();\n }\n }\n\n function WrappingNode(startToken) {\n if (extra.range) {\n this.range = [startToken.start, 0];\n }\n if (extra.loc) {\n this.loc = new WrappingSourceLocation(startToken);\n }\n }\n\n WrappingNode.prototype = Node.prototype = {\n\n finish: function () {\n if (extra.range) {\n this.range[1] = index;\n }\n if (extra.loc) {\n this.loc.end = new Position();\n if (extra.source) {\n this.loc.source = extra.source;\n }\n }\n },\n\n finishArrayExpression: function (elements) {\n this.type = Syntax.ArrayExpression;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishAssignmentExpression: function (operator, left, right) {\n this.type = Syntax.AssignmentExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBinaryExpression: function (operator, left, right) {\n this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishCallExpression: function (callee, args) {\n this.type = Syntax.CallExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishConditionalExpression: function (test, consequent, alternate) {\n this.type = Syntax.ConditionalExpression;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishExpressionStatement: function (expression) {\n this.type = Syntax.ExpressionStatement;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishIdentifier: function (name) {\n this.type = Syntax.Identifier;\n this.name = name;\n this.finish();\n return this;\n },\n\n finishLiteral: function (token) {\n this.type = Syntax.Literal;\n this.value = token.value;\n this.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (this.raw == '//') {\n this.raw = '/(?:)/';\n }\n this.regex = token.regex;\n }\n this.finish();\n return this;\n },\n\n finishMemberExpression: function (accessor, object, property) {\n this.type = Syntax.MemberExpression;\n this.computed = accessor === '[';\n this.object = object;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishObjectExpression: function (properties) {\n this.type = Syntax.ObjectExpression;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishProgram: function (body) {\n this.type = Syntax.Program;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishProperty: function (kind, key, value) {\n this.type = Syntax.Property;\n this.key = key;\n this.value = value;\n this.kind = kind;\n this.finish();\n return this;\n },\n\n finishUnaryExpression: function (operator, argument) {\n this.type = Syntax.UnaryExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = true;\n this.finish();\n return this;\n }\n };\n\n // Return true if there is a line terminator before the next token.\n\n function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }\n\n // Throw an exception\n\n function 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 if (typeof token.lineNumber === 'number') {\n error = new Error('Line ' + token.lineNumber + ': ' + msg);\n error.index = token.start;\n error.lineNumber = token.lineNumber;\n error.column = token.start - lineStart + 1;\n } else {\n error = new Error('Line ' + lineNumber + ': ' + msg);\n error.index = index;\n error.lineNumber = lineNumber;\n error.column = index - lineStart + 1;\n }\n\n error.description = msg;\n throw error;\n }\n\n function throwErrorTolerant() {\n try {\n throwError.apply(null, arguments);\n } catch (e) {\n if (extra.errors) {\n extra.errors.push(e);\n } else {\n throw e;\n }\n }\n }\n\n\n // Throw an exception because of the token.\n\n function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // Expect the next token to match the specified punctuator.\n // If not, an exception will be thrown.\n\n function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }\n\n /**\n * @name expectTolerant\n * @description Quietly expect the given token value when in tolerant mode, otherwise delegates\n * to expect(value)\n * @param {String} value The value we are expecting the lookahead token to have\n * @since 2.0\n */\n function expectTolerant(value) {\n if (extra.errors) {\n var token = lookahead;\n if (token.type !== Token.Punctuator && token.value !== value) {\n throwErrorTolerant(token, Messages.UnexpectedToken, token.value);\n } else {\n lex();\n }\n } else {\n expect(value);\n }\n }\n\n // Return true if the next token matches the specified punctuator.\n\n function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }\n\n // Return true if the next token matches the specified keyword\n\n function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }\n\n function consumeSemicolon() {\n var line;\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(index) === 0x3B || match(';')) {\n lex();\n return;\n }\n\n line = lineNumber;\n skipComment();\n if (lineNumber !== line) {\n return;\n }\n\n if (lookahead.type !== Token.EOF && !match('}')) {\n throwUnexpected(lookahead);\n }\n }\n\n // 11.1.4 Array Initialiser\n\n function parseArrayInitialiser() {\n var elements = [], node = new Node();\n\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseAssignmentExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return node.finishArrayExpression(elements);\n }\n\n // 11.1.5 Object Initialiser\n\n function parseObjectPropertyKey() {\n var token, node = new Node();\n\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 === Token.StringLiteral || token.type === Token.NumericLiteral) {\n if (strict && token.octal) {\n throwErrorTolerant(token, Messages.StrictOctalLiteral);\n }\n return node.finishLiteral(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseObjectProperty() {\n var token, key, id, value, node = new Node();\n\n token = lookahead;\n\n if (token.type === Token.Identifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', id, value);\n }\n if (token.type === Token.EOF || token.type === Token.Punctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', key, value);\n }\n }\n\n function parseObjectInitialiser() {\n var properties = [], property, name, key, kind, map = {}, toString = String, node = new Node();\n\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === Syntax.Identifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n if (map[key] === PropertyKind.Data) {\n if (strict && kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.StrictDuplicateProperty);\n } else if (kind !== PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n }\n } else {\n if (kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n } else if (map[key] & kind) {\n throwErrorTolerant({}, Messages.AccessorGetSet);\n }\n }\n map[key] |= kind;\n } else {\n map[key] = kind;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expectTolerant(',');\n }\n }\n\n expect('}');\n\n return node.finishObjectExpression(properties);\n }\n\n // 11.1.6 The Grouping Operator\n\n function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }\n\n\n // 11.1 Primary Expressions\n\n var legalKeywords = {\"if\":1, \"this\":1};\n\n function parsePrimaryExpression() {\n var type, token, expr, node;\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 node = new Node();\n\n if (type === Token.Identifier || legalKeywords[lookahead.value]) {\n expr = node.finishIdentifier(lex().value);\n } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n if (strict && lookahead.octal) {\n throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n }\n expr = node.finishLiteral(lex());\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\");\n } else if (type === Token.BooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = node.finishLiteral(token);\n } else if (type === Token.NullLiteral) {\n token = lex();\n token.value = null;\n expr = node.finishLiteral(token);\n } else if (match('/') || match('/=')) {\n if (typeof extra.tokens !== 'undefined') {\n expr = node.finishLiteral(collectRegex());\n } else {\n expr = node.finishLiteral(scanRegExp());\n }\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n }\n\n // 11.2 Left-Hand-Side Expressions\n\n function parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseAssignmentExpression());\n if (match(')')) {\n break;\n }\n expectTolerant(',');\n }\n }\n\n expect(')');\n\n return args;\n }\n\n function parseNonComputedProperty() {\n var token, node = new Node();\n\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n }\n\n function parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n }\n\n function parseLeftHandSideExpressionAllowCall() {\n var expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }\n\n // 11.3 Postfix Expressions\n\n function parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === Token.Punctuator) {\n if ((match('++') || match('--')) && !peekLineTerminator()) {\n throw new Error(\"Disabled.\");\n }\n }\n\n return expr;\n }\n\n // 11.4 Unary Operators\n\n function parseUnaryExpression() {\n var token, expr, startToken;\n\n if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(\"Disabled.\");\n } else if (match('+') || match('-') || match('~') || match('!')) {\n startToken = lookahead;\n token = lex();\n expr = parseUnaryExpression();\n expr = new WrappingNode(startToken).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\n function binaryPrecedence(token, allowIn) {\n var prec = 0;\n\n if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\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 prec = 7;\n break;\n\n case 'in':\n prec = allowIn ? 7 : 0;\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\n function 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, state.allowIn);\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, state.allowIn)) > 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 = new WrappingNode(markers[markers.length - 1]).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 expr = new WrappingNode(markers.pop()).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\n function parseConditionalExpression() {\n var expr, previousAllowIn, consequent, alternate, startToken;\n\n startToken = lookahead;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n previousAllowIn = state.allowIn;\n state.allowIn = true;\n consequent = parseAssignmentExpression();\n state.allowIn = previousAllowIn;\n expect(':');\n alternate = parseAssignmentExpression();\n\n expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n }\n\n // 11.13 Assignment Operators\n\n function parseAssignmentExpression() {\n var oldParenthesisCount, token, expr, startToken;\n\n oldParenthesisCount = state.parenthesisCount;\n\n startToken = lookahead;\n token = lookahead;\n\n expr = parseConditionalExpression();\n\n return expr;\n }\n\n // 11.14 Comma Operator\n\n function parseExpression() {\n var expr = parseAssignmentExpression();\n\n if (match(',')) {\n throw new Error(\"Disabled.\"); // no sequence expressions\n }\n\n return expr;\n }\n\n // 12.4 Expression Statement\n\n function parseExpressionStatement(node) {\n var expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 12 Statements\n\n function parseStatement() {\n var type = lookahead.type,\n expr,\n node;\n\n if (type === Token.EOF) {\n throwUnexpected(lookahead);\n }\n\n if (type === Token.Punctuator && lookahead.value === '{') {\n throw new Error(\"Disabled.\"); // block statement\n }\n\n node = new Node();\n\n if (type === Token.Punctuator) {\n switch (lookahead.value) {\n case ';':\n throw new Error(\"Disabled.\"); // empty statement\n case '(':\n return parseExpressionStatement(node);\n default:\n break;\n }\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\"); // keyword\n }\n\n expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 14 Program\n\n function parseSourceElement() {\n if (lookahead.type === Token.Keyword) {\n switch (lookahead.value) {\n case 'const':\n case 'let':\n throw new Error(\"Disabled.\");\n case 'function':\n throw new Error(\"Disabled.\");\n default:\n return parseStatement();\n }\n }\n\n if (lookahead.type !== Token.EOF) {\n return parseStatement();\n }\n }\n\n function parseSourceElements() {\n var sourceElement, sourceElements = [], token, directive, firstRestricted;\n\n while (index < length) {\n token = lookahead;\n if (token.type !== Token.StringLiteral) {\n break;\n }\n\n sourceElement = parseSourceElement();\n sourceElements.push(sourceElement);\n if (sourceElement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n while (index < length) {\n sourceElement = parseSourceElement();\n if (typeof sourceElement === 'undefined') {\n break;\n }\n sourceElements.push(sourceElement);\n }\n return sourceElements;\n }\n\n function parseProgram() {\n var body, node;\n\n skipComment();\n peek();\n node = new Node();\n strict = true; // assume strict\n\n body = parseSourceElements();\n return node.finishProgram(body);\n }\n\n function filterTokenLocation() {\n var i, entry, token, tokens = [];\n\n for (i = 0; i < extra.tokens.length; ++i) {\n entry = extra.tokens[i];\n token = {\n type: entry.type,\n value: entry.value\n };\n if (entry.regex) {\n token.regex = {\n pattern: entry.regex.pattern,\n flags: entry.regex.flags\n };\n }\n if (extra.range) {\n token.range = entry.range;\n }\n if (extra.loc) {\n token.loc = entry.loc;\n }\n tokens.push(token);\n }\n\n extra.tokens = tokens;\n }\n\n function tokenize(code, options) {\n var toString,\n tokens;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n\n // Options matching.\n options = options || {};\n\n // Of course we collect tokens here.\n options.tokens = true;\n extra.tokens = [];\n extra.tokenize = true;\n // The following two fields are necessary to compute the Regex tokens.\n extra.openParenToken = -1;\n extra.openCurlyToken = -1;\n\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n\n try {\n peek();\n if (lookahead.type === Token.EOF) {\n return extra.tokens;\n }\n\n lex();\n while (lookahead.type !== Token.EOF) {\n try {\n lex();\n } catch (lexError) {\n if (extra.errors) {\n extra.errors.push(lexError);\n // We have to break on the first error\n // to avoid infinite loops.\n break;\n } else {\n throw lexError;\n }\n }\n }\n\n filterTokenLocation();\n tokens = extra.tokens;\n if (typeof extra.errors !== 'undefined') {\n tokens.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n return tokens;\n }\n\n function parse(code, options) {\n var program, toString;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n parenthesisCount: 0,\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n if (typeof options !== 'undefined') {\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (extra.loc && options.source !== null && options.source !== undefined) {\n extra.source = toString(options.source);\n }\n\n if (typeof options.tokens === 'boolean' && options.tokens) {\n extra.tokens = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n }\n\n try {\n program = parseProgram();\n if (typeof extra.tokens !== 'undefined') {\n filterTokenLocation();\n program.tokens = extra.tokens;\n }\n if (typeof extra.errors !== 'undefined') {\n program.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n\n return program;\n }\n\n return {\n tokenize: tokenize,\n parse: parse\n };\n\n})();\n},{}],49:[function(require,module,exports){\nvar expr = require('vega-expression'),\n args = ['datum', 'event', 'signals'];\n\nmodule.exports = expr.compiler(args, {\n idWhiteList: args,\n fieldVar: args[0],\n globalVar: args[2],\n functions: function(codegen) {\n var fn = expr.functions(codegen);\n fn.eventItem = function() { return 'event.vg.item'; };\n fn.eventGroup = 'event.vg.getGroup';\n fn.eventX = 'event.vg.getX';\n fn.eventY = 'event.vg.getY';\n fn.open = 'window.open';\n return fn;\n }\n});\n},{\"vega-expression\":47}],50:[function(require,module,exports){\nvar dl = require('datalib'),\n df = require('vega-dataflow'),\n log = require('vega-logging'),\n ChangeSet = df.ChangeSet,\n Tuple = df.Tuple,\n Deps = df.Dependencies,\n Transform = require('./Transform'),\n Facetor = require('./Facetor');\n\nfunction Aggregate(graph) {\n Transform.prototype.init.call(this, graph);\n\n Transform.addParameters(this, {\n groupby: {type: 'array'},\n summarize: {\n type: 'custom', \n set: function(summarize) {\n var signalDeps = {},\n tx = this._transform,\n i, len, f, fields, name, ops;\n\n if (!dl.isArray(fields = summarize)) { // Object syntax from dl\n fields = [];\n for (name in summarize) {\n ops = dl.array(summarize[name]);\n fields.push({field: name, ops: ops});\n }\n }\n\n function sg(x) { if (x.signal) signalDeps[x.signal] = 1; }\n\n for (i=0, len=fields.length; i this.config('maxSmallNumber') ?\n 'largeNumberFormat': 'smallNumberFormat';\n return this.config(formatConfig);\n };\n\n proto.sort = function(et, stats) {\n var sort = this._enc[et].sort,\n enc = this._enc,\n isTypes = vlEncDef.isTypes;\n\n if ((!sort || sort.length===0) &&\n // FIXME\n Encoding.toggleSort.support({encoding:this._enc}, stats, true) && //HACK\n this.config('toggleSort') === Q\n ) {\n var qField = isTypes(enc.x, [N, O]) ? enc.y : enc.x;\n\n if (isTypes(enc[et], [N, O])) {\n sort = [{\n name: qField.name,\n aggregate: qField.aggregate,\n type: qField.type,\n reverse: true\n }];\n }\n }\n\n return sort;\n };\n\n proto.map = function(f) {\n return vlenc.map(this._enc, f);\n };\n\n proto.reduce = function(f, init) {\n return vlenc.reduce(this._enc, f, init);\n };\n\n proto.forEach = function(f) {\n return vlenc.forEach(this._enc, f);\n };\n\n proto.type = function(et) {\n return this.has(et) ? this._enc[et].type : null;\n };\n\n proto.isType = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isType(encDef, type);\n };\n\n\n proto.isTypes = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isTypes(encDef, type);\n };\n\n Encoding.isOrdinalScale = function(encoding, encType) {\n return vlEncDef.isOrdinalScale(encoding.encDef(encType));\n };\n\n Encoding.isDimension = function(encoding, encType) {\n return vlEncDef.isDimension(encoding.encDef(encType));\n };\n\n Encoding.isMeasure = function(encoding, encType) {\n return vlEncDef.isMeasure(encoding.encDef(encType));\n };\n\n proto.isOrdinalScale = function(encType) {\n return this.has(encType) && Encoding.isOrdinalScale(this, encType);\n };\n\n proto.isDimension = function(encType) {\n return this.has(encType) && Encoding.isDimension(this, encType);\n };\n\n proto.isMeasure = function(encType) {\n return this.has(encType) && Encoding.isMeasure(this, encType);\n };\n\n proto.isAggregate = function() {\n return vlenc.isAggregate(this._enc);\n };\n\n proto.dataTable = function() {\n return this.isAggregate() ? AGGREGATE : RAW;\n };\n\n Encoding.isAggregate = function(spec) {\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.alwaysNoOcclusion = function(spec) {\n // FIXME raw OxQ with # of rows = # of O\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.isStack = function(spec) {\n // FIXME update this once we have control for stack ...\n return (spec.marktype === 'bar' || spec.marktype === 'area') &&\n spec.encoding.color;\n };\n\n /**\n * Check if the encoding should be stacked and return the stack dimenstion and value fields.\n * @return {Object} An object containing two properties:\n * - dimension - the dimension field\n * - value - the value field\n */\n proto.stack = function() {\n var stack = (this.has(COLOR) && this.encDef(COLOR).stack) ? COLOR :\n (this.has(DETAIL) && this.encDef(DETAIL).stack) ? DETAIL :\n null;\n\n var properties = stack && this.encDef(stack).stack !== true ?\n this.encDef(stack).stack :\n {};\n\n if ((this.is('bar') || this.is('area')) && stack && this.isAggregate()) {\n\n var isXMeasure = this.isMeasure(X);\n var isYMeasure = this.isMeasure(Y);\n\n if (isXMeasure && !isYMeasure) {\n return {\n groupby: Y,\n value: X,\n stack: stack,\n properties: properties\n };\n } else if (isYMeasure && !isXMeasure) {\n return {\n groupby: X,\n value: Y,\n stack: stack,\n properties: properties\n };\n }\n }\n return null; // no stack encoding\n };\n\n\n\n proto.details = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType !== X && encType !== Y)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.facets = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType == ROW || encType == COL)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.cardinality = function(encType, stats) {\n return vlEncDef.cardinality(this.encDef(encType), stats, this.config('filterNull'));\n };\n\n proto.isRaw = function() {\n return !this.isAggregate();\n };\n\n proto.data = function() {\n return this._data;\n };\n\n // returns whether the encoding has values embedded\n proto.hasValues = function() {\n var vals = this.data().values;\n return vals && vals.length;\n };\n\n proto.config = function(name) {\n return this._config[name];\n };\n\n Encoding.transpose = function(spec) {\n var oldenc = spec.encoding,\n enc = util.duplicate(spec.encoding);\n enc.x = oldenc.y;\n enc.y = oldenc.x;\n enc.row = oldenc.col;\n enc.col = oldenc.row;\n spec.encoding = enc;\n return spec;\n };\n\n return Encoding;\n})();\n\n},{\"./consts\":67,\"./enc\":69,\"./encdef\":70,\"./globals\":71,\"./schema/schema\":73,\"./util\":75}],55:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n getter = util.getter,\n time = require('./time');\n\nvar axis = module.exports = {};\n\naxis.def = function(name, encoding, layout, stats, opt) {\n var isCol = name == COL,\n isRow = name == ROW,\n type = isCol ? 'x' : isRow ? 'y' : name;\n\n // TODO: rename def to axisDef and avoid side effects where possible.\n\n var def = {\n type: type,\n scale: name,\n properties: {},\n layer: encoding.encDef(name).axis.layer\n };\n\n var orient = axis.orient(encoding, name, stats);\n if (orient) {\n def.orient = orient;\n }\n\n // Add axis label custom scale (for bin / time)\n def = axis.labels.scale(def, encoding, name);\n def = axis.labels.format(def, encoding, name, stats);\n def = axis.labels.angle(def, encoding, name);\n\n // for x-axis, set ticks for Q or rotate scale for ordinal scale\n if (name == X) {\n if ((encoding.isDimension(X) || encoding.isType(X, T)) &&\n !('angle' in getter(def, ['properties', 'labels']))) {\n // TODO(kanitw): Jul 19, 2015 - #506 add condition for rotation\n def = axis.labels.rotate(def);\n } else { // Q\n def.ticks = encoding.encDef(name).axis.ticks;\n }\n }\n\n // TitleOffset depends on labels rotation\n def.titleOffset = axis.titleOffset(encoding, layout, name);\n\n //def.offset is used in axis.grid\n if(isRow) def.offset = axis.titleOffset(encoding, layout, Y) + 20;\n // FIXME(kanitw): Jul 19, 2015 - offset for column when x is put on top\n\n def = axis.grid(def, encoding, name, layout);\n def = axis.title(def, encoding, name, layout, opt);\n\n if (isRow || isCol) {\n def = axis.hideTicks(def);\n }\n\n return def;\n};\n\naxis.orient = function(encoding, name, stats) {\n var orient = encoding.encDef(name).axis.orient;\n if (orient) {\n return orient;\n } else if (name === COL) {\n return 'top';\n } else if (name === X && encoding.has(Y) && encoding.isOrdinalScale(Y) && encoding.cardinality(Y, stats) > 30) {\n // x-axis for long y - put on top\n return 'top';\n }\n return undefined;\n};\n\naxis.grid = function(def, encoding, name, layout) {\n var cellPadding = layout.cellPadding,\n isCol = name == COL,\n isRow = name == ROW;\n\n var _grid = encoding.axis(name).grid;\n\n // If `grid` is unspecified, the default value is `true` for ROW and COL. For X\n // and Y, the default value is `true` for quantitative and time fields and `false` otherwise.\n var grid = _grid === undefined ?\n (name === ROW || name === COL || encoding.isTypes(name, [Q, T])) :\n _grid;\n\n if (grid) {\n def.grid = true;\n\n if (isCol) {\n // set grid property -- put the lines on the right the cell\n var yOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n def.properties.grid = {\n x: {\n offset: layout.cellWidth * (1+ cellPadding/2.0),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'col',\n field: 'data'\n },\n y: {\n value: -yOffset,\n },\n y2: {\n field: {group: 'mark.group.height'},\n offset: yOffset\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else if (isRow) {\n var xOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n // set grid property -- put the lines on the top\n def.properties.grid = {\n y: {\n offset: -layout.cellHeight * (cellPadding/2),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'row',\n field: 'data'\n },\n x: {\n value: def.offset - xOffset\n },\n x2: {\n field: {group: 'mark.group.width'},\n offset: def.offset + xOffset,\n // default value(s) -- vega doesn't do recursive merge\n mult: 1\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else {\n def.properties.grid = {\n stroke: { value: encoding.config('gridColor') },\n strokeOpacity: { value: encoding.config('gridOpacity') }\n };\n }\n }\n return def;\n};\n\naxis.hideTicks = function(def) {\n def.properties.ticks = {opacity: {value: 0}};\n def.properties.majorTicks = {opacity: {value: 0}};\n def.properties.axis = {opacity: {value: 0}};\n return def;\n};\n\naxis.title = function (def, encoding, name, layout) {\n var ax = encoding.encDef(name).axis;\n\n if (ax.title) {\n def.title = ax.title;\n } else {\n // if not defined, automatically determine axis title from field def\n var fieldTitle = encoding.fieldTitle(name),\n maxLength;\n\n if (ax.titleMaxLength) {\n maxLength = ax.titleMaxLength;\n } else if (name===X) {\n maxLength = layout.cellWidth / encoding.config('characterWidth');\n } else if (name === Y) {\n maxLength = layout.cellHeight / encoding.config('characterWidth');\n }\n\n def.title = maxLength ? util.truncate(fieldTitle, maxLength) : fieldTitle;\n }\n\n if (name === ROW) {\n def.properties.title = {\n angle: {value: 0},\n align: {value: 'right'},\n baseline: {value: 'middle'},\n dy: {value: (-layout.height/2) -20}\n };\n }\n\n return def;\n};\n\naxis.labels = {};\n\n/** add custom label for time type and bin */\naxis.labels.scale = function(def, encoding, name) {\n // time\n var timeUnit = encoding.encDef(name).timeUnit;\n if (encoding.isType(name, T) && timeUnit && (time.hasScale(timeUnit))) {\n setter(def, ['properties','labels','text','scale'], 'time-'+ timeUnit);\n }\n // FIXME bin\n return def;\n};\n\n/**\n * Determine number format or truncate if maxLabel length is presented.\n */\naxis.labels.format = function (def, encoding, name, stats) {\n var fieldStats = stats[encoding.encDef(name).name];\n\n if (encoding.axis(name).format) {\n def.format = encoding.axis(name).format;\n } else if (encoding.isType(name, Q) || fieldStats.type === 'number') {\n def.format = encoding.numberFormat(fieldStats);\n } else if (encoding.isType(name, T)) {\n var timeUnit = encoding.encDef(name).timeUnit;\n if (!timeUnit) {\n def.format = encoding.config('timeFormat');\n } else if (timeUnit === 'year') {\n def.format = 'd';\n }\n } else if (encoding.isTypes(name, [N, O]) && encoding.axis(name).maxLabelLength) {\n setter(def,\n ['properties','labels','text','template'],\n '{{ datum.data | truncate:' +\n encoding.axis(name).maxLabelLength + '}}'\n );\n }\n\n return def;\n};\n\naxis.labels.angle = function(def, encoding, name) {\n var angle = encoding.axis(name).labelAngle;\n if (typeof angle === 'undefined') return def;\n\n setter(def, ['properties', 'labels', 'angle', 'value'], angle);\n return def;\n};\n\naxis.labels.rotate = function(def) {\n var align = def.orient ==='top' ? 'left' : 'right';\n setter(def, ['properties','labels', 'angle', 'value'], 270);\n setter(def, ['properties','labels', 'align', 'value'], align);\n setter(def, ['properties','labels', 'baseline', 'value'], 'middle');\n return def;\n};\n\naxis.titleOffset = function (encoding, layout, name) {\n // return specified value if specified\n var value = encoding.axis(name).titleOffset;\n if (value) return value;\n\n switch (name) {\n //FIXME make this adjustable\n case ROW: return 0;\n case COL: return 35;\n }\n return getter(layout, [name, 'axisTitleOffset']);\n};\n\n},{\"../globals\":71,\"../util\":75,\"./time\":66}],56:[function(require,module,exports){\n'use strict';\n\nvar summary = module.exports = require('datalib/src/stats').summary;\n\nrequire('../globals');\n\n/**\n * Module for compiling Vega-lite spec into Vega spec.\n */\nvar compiler = module.exports = {};\n\nvar Encoding = require('../Encoding'),\n axis = compiler.axis = require('./axis'),\n legend = compiler.legend = require('./legend'),\n marks = compiler.marks = require('./marks'),\n scale = compiler.scale = require('./scale');\n\ncompiler.data = require('./data');\ncompiler.facet = require('./facet');\ncompiler.layout = require('./layout');\ncompiler.stack = require('./stack');\ncompiler.style = require('./style');\ncompiler.subfacet = require('./subfacet');\ncompiler.time = require('./time');\n\ncompiler.compile = function (spec, stats, theme) {\n return compiler.compileEncoding(Encoding.fromSpec(spec, theme), stats);\n};\n\ncompiler.shorthand = function (shorthand, stats, config, theme) {\n return compiler.compileEncoding(Encoding.fromShorthand(shorthand, config, theme), stats);\n};\n\n/**\n * Create a Vega specification from a Vega-lite Encoding object.\n */\ncompiler.compileEncoding = function (encoding, stats) {\n // no need to pass stats if you pass in the data\n if (!stats) {\n if (encoding.hasValues()) {\n stats = summary(encoding.data().values).reduce(function(s, p) {\n s[p.field] = p;\n return s;\n }, {});\n } else {\n console.error('No stats provided and data is not embedded.');\n }\n }\n\n var layout = compiler.layout(encoding, stats);\n\n var spec = {\n width: layout.width,\n height: layout.height,\n padding: 'auto',\n // FIXME(#514): eliminate stats\n data: compiler.data(encoding, stats),\n // global scales contains only time unit scales\n scales: compiler.time.scales(encoding),\n marks: [{\n name: 'cell',\n type: 'group',\n properties: {\n enter: {\n width: layout.cellWidth ?\n {value: layout.cellWidth} :\n {field: {group: 'width'}},\n height: layout.cellHeight ?\n {value: layout.cellHeight} :\n {field: {group: 'height'}}\n }\n }\n }]\n };\n\n var group = spec.marks[0];\n\n // marks\n var style = compiler.style(encoding, stats),\n mdefs = group.marks = marks.def(encoding, layout, style, stats),\n mdef = mdefs[mdefs.length - 1]; // TODO: remove this dirty hack by refactoring the whole flow\n\n var stack = encoding.stack();\n if (stack) {\n // modify mdef.{from,properties}\n compiler.stack(encoding, mdef, stack);\n }\n\n var lineType = marks[encoding.marktype()].line;\n\n // handle subfacets\n var details = encoding.details();\n\n if (details.length > 0 && lineType) {\n //subfacet to group stack / line together in one group\n compiler.subfacet(group, mdef, details, encoding);\n }\n\n // auto-sort line/area values\n if (lineType && encoding.config('autoSortLine')) {\n var f = (encoding.isMeasure(X) && encoding.isDimension(Y)) ? Y : X;\n if (!mdef.from) {\n mdef.from = {};\n }\n // TODO: why - ?\n mdef.from.transform = [{type: 'sort', by: '-' + encoding.fieldRef(f)}];\n }\n\n // get a flattened list of all scale names that are used in the vl spec\n var singleScaleNames = [].concat.apply([], mdefs.map(function(markProps) {\n return scale.names(markProps.properties.update);\n }));\n\n // Small Multiples\n if (encoding.has(ROW) || encoding.has(COL)) {\n spec = compiler.facet(group, encoding, layout, spec, singleScaleNames, stats);\n spec.legends = legend.defs(encoding, style);\n } else {\n group.scales = scale.defs(singleScaleNames, encoding, layout, stats);\n group.axes = [];\n if (encoding.has(X)) {\n group.axes.push(axis.def(X, encoding, layout, stats));\n }\n if (encoding.has(Y)) {\n group.axes.push(axis.def(Y, encoding, layout, stats));\n }\n\n group.legends = legend.defs(encoding, style);\n }\n\n return spec;\n};\n\n\n},{\"../Encoding\":54,\"../globals\":71,\"./axis\":55,\"./data\":57,\"./facet\":58,\"./layout\":59,\"./legend\":60,\"./marks\":61,\"./scale\":62,\"./stack\":63,\"./style\":64,\"./subfacet\":65,\"./time\":66,\"datalib/src/stats\":29}],57:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nmodule.exports = data;\n\nvar vlEncDef = require('../encdef'),\n util = require('../util'),\n time = require('./time');\n\n/**\n * Create Vega's data array from a given encoding.\n *\n * @param {Encoding} encoding\n * @return {Array} Array of Vega data.\n * This always includes a \"raw\" data table.\n * If the encoding contains aggregate value, this will also create\n * aggregate table as well.\n */\n// FIXME(#514): eliminate stats\nfunction data(encoding, stats) {\n var def = [data.raw(encoding, stats)];\n\n var aggregate = data.aggregate(encoding);\n if (aggregate) {\n def.push(data.aggregate(encoding));\n }\n\n // TODO add \"having\" filter here\n\n // append non-positive filter at the end for the data table\n data.filterNonPositive(def[def.length - 1], encoding);\n\n // Stack\n var stack = encoding.stack();\n if (stack) {\n def.push(data.stack(encoding, stack));\n }\n\n return def;\n}\n\n// FIXME(#514): eliminate stats\ndata.raw = function(encoding, stats) {\n var raw = {name: RAW};\n\n // Data source (url or inline)\n if (encoding.hasValues()) {\n raw.values = encoding.data().values;\n raw.format = {type: 'json'};\n } else {\n raw.url = encoding.data().url;\n raw.format = {type: encoding.data().formatType};\n }\n\n // Set data's format.parse if needed\n var parse = data.raw.formatParse(encoding);\n if (parse) {\n raw.format.parse = parse;\n }\n\n raw.transform = data.raw.transform(encoding, stats);\n return raw;\n};\n\ndata.raw.formatParse = function(encoding) {\n var parse;\n\n encoding.forEach(function(encDef) {\n if (encDef.type == T) {\n parse = parse || {};\n parse[encDef.name] = 'date';\n } else if (encDef.type == Q) {\n if (vlEncDef.isCount(encDef)) return;\n parse = parse || {};\n parse[encDef.name] = 'number';\n }\n });\n\n return parse;\n};\n\n/**\n * Generate Vega transforms for the raw data table. This can include\n * transforms for time unit, binning and filtering.\n */\n// FIXME(#514): eliminate stats\ndata.raw.transform = function(encoding, stats) {\n // null filter comes first so transforms are not performed on null values\n // time and bin should come before filter so we can filter by time and bin\n return data.raw.transform.nullFilter(encoding).concat(\n data.raw.transform.formula(encoding),\n data.raw.transform.time(encoding),\n data.raw.transform.bin(encoding, stats),\n data.raw.transform.filter(encoding)\n );\n};\n\ndata.raw.transform.time = function(encoding) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encDef.type === T && encDef.timeUnit) {\n var fieldRef = encoding.fieldRef(encType, {nofn: true, datum: true});\n\n transform.push({\n type: 'formula',\n field: encoding.fieldRef(encType),\n expr: time.formula(encDef.timeUnit, fieldRef)\n });\n }\n return transform;\n }, []);\n};\n\n// FIXME(#514): eliminate stats\ndata.raw.transform.bin = function(encoding, stats) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encoding.bin(encType)) {\n transform.push({\n type: 'bin',\n field: encDef.name,\n output: {bin: encoding.fieldRef(encType)},\n maxbins: encoding.bin(encType).maxbins,\n min: stats[encDef.name].min,\n max: stats[encDef.name].max\n });\n }\n return transform;\n }, []);\n};\n\n/**\n * @return {Array} An array that might contain a filter transform for filtering null value based on filterNul config\n */\ndata.raw.transform.nullFilter = function(encoding) {\n var filteredFields = util.reduce(encoding.fields(),\n function(filteredFields, fieldList, fieldName) {\n if (fieldName === '*') return filteredFields; //count\n\n // TODO(#597) revise how filterNull is structured.\n if ((encoding.config('filterNull').Q && fieldList.containsType[Q]) ||\n (encoding.config('filterNull').T && fieldList.containsType[T]) ||\n (encoding.config('filterNull').O && fieldList.containsType[O]) ||\n (encoding.config('filterNull').N && fieldList.containsType[N])) {\n filteredFields.push(fieldName);\n }\n return filteredFields;\n }, []);\n\n return filteredFields.length > 0 ?\n [{\n type: 'filter',\n test: filteredFields.map(function(fieldName) {\n return 'datum.' + fieldName + '!==null';\n }).join(' && ')\n }] : [];\n};\n\ndata.raw.transform.filter = function(encoding) {\n var filter = encoding.data().filter;\n return filter ? [{\n type: 'filter',\n test: filter\n }] : [];\n};\n\ndata.raw.transform.formula = function(encoding) {\n var formulas = encoding.data().formulas;\n if (formulas === undefined) {\n return [];\n }\n\n return formulas.reduce(function(transform, formula) {\n formula.type = 'formula';\n transform.push(formula);\n return transform;\n }, []);\n};\n\ndata.aggregate = function(encoding) {\n /* dict set for dimensions */\n var dims = {};\n\n /* dictionary mapping field name => dict set of aggregation functions */\n var meas = {};\n\n var hasAggregate = false;\n\n encoding.forEach(function(encDef, encType) {\n if (encDef.aggregate) {\n hasAggregate = true;\n if (encDef.aggregate === 'count') {\n meas['*'] = meas['*'] || {};\n meas['*'].count = true;\n } else {\n meas[encDef.name] = meas[encDef.name] || {};\n meas[encDef.name][encDef.aggregate] = true;\n }\n } else {\n dims[encDef.name] = encoding.fieldRef(encType);\n }\n });\n\n var groupby = util.vals(dims);\n\n // short-format summarize object for Vega's aggregate transform\n // https://github.com/vega/vega/wiki/Data-Transforms#-aggregate\n var summarize = util.reduce(meas, function(summarize, fnDictSet, field) {\n summarize[field] = util.keys(fnDictSet);\n return summarize;\n }, {});\n\n if (hasAggregate) {\n return {\n name: AGGREGATE,\n source: RAW,\n transform: [{\n type: 'aggregate',\n groupby: groupby,\n summarize: summarize\n }]\n };\n }\n\n return null;\n};\n\n/**\n * Add stacked data source, for feeding the shared scale.\n */\ndata.stack = function(encoding, stack) {\n var dim = stack.groupby;\n var val = stack.value;\n var facets = encoding.facets();\n\n var stacked = {\n name: STACKED,\n source: encoding.dataTable(),\n transform: [{\n type: 'aggregate',\n groupby: [encoding.fieldRef(dim)].concat(facets), // dim and other facets\n summarize: [{ops: ['sum'], field: encoding.fieldRef(val)}]\n }]\n };\n\n if (facets && facets.length > 0) {\n stacked.transform.push({ //calculate max for each facet\n type: 'aggregate',\n groupby: facets,\n summarize: [{\n ops: ['max'],\n // we want max of sum from above transform\n field: encoding.fieldRef(val, {prefn: 'sum_'})\n }]\n });\n }\n return stacked;\n};\n\ndata.filterNonPositive = function(dataTable, encoding) {\n encoding.forEach(function(encDef, encType) {\n if (encoding.scale(encType).type === 'log') {\n dataTable.transform.push({\n type: 'filter',\n test: encoding.fieldRef(encType, {datum: 1}) + ' > 0'\n });\n }\n });\n};\n\n},{\"../encdef\":70,\"../globals\":71,\"../util\":75,\"./time\":66}],58:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar util = require('../util');\n\nvar axis = require('./axis'),\n scale = require('./scale');\n\nmodule.exports = faceting;\n\nfunction groupdef(name, opt) {\n opt = opt || {};\n var group = {\n name: name || undefined,\n type: 'group',\n properties: {\n enter: {\n width: opt.width || {field: {group: 'width'}},\n height: opt.height || {field: {group: 'height'}}\n }\n }\n };\n\n if (opt.from) {\n group.from = opt.from;\n }\n if (opt.x) {\n group.properties.enter.x = opt.x;\n }\n if (opt.y) {\n group.properties.enter.y = opt.y;\n }\n if (opt.axes) {\n group.axes = opt.axes;\n }\n\n return group;\n}\n\nfunction faceting(group, encoding, layout, spec, singleScaleNames, stats) {\n var enter = group.properties.enter;\n var facetKeys = [], cellAxes = [], from, axesGrp;\n\n var hasRow = encoding.has(ROW), hasCol = encoding.has(COL);\n\n enter.fill = {value: encoding.config('cellBackgroundColor')};\n\n //move \"from\" to cell level and add facet transform\n group.from = {data: group.marks[0].from.data};\n\n // Hack, this needs to be refactored\n for (var i = 0; i < group.marks.length; i++) {\n var mark = group.marks[i];\n if (mark.from.transform) {\n delete mark.from.data; //need to keep transform for subfacetting case\n } else {\n delete mark.from;\n }\n }\n\n if (hasRow) {\n if (!encoding.isDimension(ROW)) {\n util.error('Row encoding should be ordinal.');\n }\n enter.y = {scale: ROW, field: encoding.fieldRef(ROW)};\n enter.height = {'value': layout.cellHeight}; // HACK\n\n facetKeys.push(encoding.fieldRef(ROW));\n\n if (hasCol) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(COL)]});\n }\n\n axesGrp = groupdef('x-axes', {\n axes: encoding.has(X) ? [axis.def(X, encoding, layout, stats)] : undefined,\n x: hasCol ? {scale: COL, field: encoding.fieldRef(COL)} : {value: 0},\n width: hasCol && {'value': layout.cellWidth}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(ROW, encoding, layout, stats));\n } else { // doesn't have row\n if (encoding.has(X)) {\n //keep x axis in the cell\n cellAxes.push(axis.def(X, encoding, layout, stats));\n }\n }\n\n if (hasCol) {\n if (!encoding.isDimension(COL)) {\n util.error('Col encoding should be ordinal.');\n }\n enter.x = {scale: COL, field: encoding.fieldRef(COL)};\n enter.width = {'value': layout.cellWidth}; // HACK\n\n facetKeys.push(encoding.fieldRef(COL));\n\n if (hasRow) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(ROW)]});\n }\n\n axesGrp = groupdef('y-axes', {\n axes: encoding.has(Y) ? [axis.def(Y, encoding, layout, stats)] : undefined,\n y: hasRow && {scale: ROW, field: encoding.fieldRef(ROW)},\n x: hasRow && {value: 0},\n height: hasRow && {'value': layout.cellHeight}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(COL, encoding, layout, stats));\n } else { // doesn't have col\n if (encoding.has(Y)) {\n cellAxes.push(axis.def(Y, encoding, layout, stats));\n }\n }\n\n // assuming equal cellWidth here\n // TODO: support heterogenous cellWidth (maybe by using multiple scales?)\n spec.scales = (spec.scales || []).concat(scale.defs(\n scale.names(enter).concat(singleScaleNames),\n encoding,\n layout,\n stats,\n true\n )); // row/col scales + cell scales\n\n if (cellAxes.length > 0) {\n group.axes = cellAxes;\n }\n\n // add facet transform\n var trans = (group.from.transform || (group.from.transform = []));\n trans.unshift({type: 'facet', groupby: facetKeys});\n\n return spec;\n}\n\n},{\"../globals\":71,\"../util\":75,\"./axis\":55,\"./scale\":62}],59:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n time = require('./time'),\n d3_format = require('d3-format');\n\nmodule.exports = vllayout;\n\nfunction vllayout(encoding, stats) {\n var layout = box(encoding, stats);\n layout = offset(encoding, stats, layout);\n return layout;\n}\n\n/*\n HACK to set chart size\n NOTE: this fails for plots driven by derived values (e.g., aggregates)\n One solution is to update Vega to support auto-sizing\n In the meantime, auto-padding (mostly) does the trick\n */\nfunction box(encoding, stats) {\n var hasRow = encoding.has(ROW),\n hasCol = encoding.has(COL),\n hasX = encoding.has(X),\n hasY = encoding.has(Y),\n marktype = encoding.marktype();\n\n // FIXME/HACK we need to take filter into account\n var xCardinality = hasX && encoding.isDimension(X) ? encoding.cardinality(X, stats) : 1,\n yCardinality = hasY && encoding.isDimension(Y) ? encoding.cardinality(Y, stats) : 1;\n\n var useSmallBand = xCardinality > encoding.config('largeBandMaxCardinality') ||\n yCardinality > encoding.config('largeBandMaxCardinality');\n\n var cellWidth, cellHeight, cellPadding = encoding.config('cellPadding');\n\n // set cellWidth\n if (hasX) {\n if (encoding.isOrdinalScale(X)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellWidth = (xCardinality + encoding.encDef(X).band.padding) * encoding.bandSize(X, useSmallBand);\n } else {\n cellWidth = hasCol || hasRow ? encoding.encDef(COL).width : encoding.config('singleWidth');\n }\n } else {\n if (marktype === TEXT) {\n cellWidth = encoding.config('textCellWidth');\n } else {\n cellWidth = encoding.bandSize(X);\n }\n }\n\n // set cellHeight\n if (hasY) {\n if (encoding.isOrdinalScale(Y)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellHeight = (yCardinality + encoding.encDef(Y).band.padding) * encoding.bandSize(Y, useSmallBand);\n } else {\n cellHeight = hasCol || hasRow ? encoding.encDef(ROW).height : encoding.config('singleHeight');\n }\n } else {\n cellHeight = encoding.bandSize(Y);\n }\n\n // Cell bands use rangeBands(). There are n-1 padding. Outerpadding = 0 for cells\n\n var width = cellWidth, height = cellHeight;\n if (hasCol) {\n var colCardinality = encoding.cardinality(COL, stats);\n width = cellWidth * ((1 + cellPadding) * (colCardinality - 1) + 1);\n }\n if (hasRow) {\n var rowCardinality = encoding.cardinality(ROW, stats);\n height = cellHeight * ((1 + cellPadding) * (rowCardinality - 1) + 1);\n }\n\n return {\n // width and height of the whole cell\n cellWidth: cellWidth,\n cellHeight: cellHeight,\n cellPadding: cellPadding,\n // width and height of the chart\n width: width,\n height: height,\n // information about x and y, such as band size\n x: {useSmallBand: useSmallBand},\n y: {useSmallBand: useSmallBand}\n };\n}\n\n\n// FIXME fieldStats.max isn't always the longest\nfunction getMaxNumberLength(encoding, et, fieldStats) {\n var format = encoding.numberFormat(et, fieldStats);\n\n return d3_format.format(format)(fieldStats.max).length;\n}\n\n// TODO(#600) revise this\nfunction getMaxLength(encoding, stats, et) {\n var encDef = encoding.encDef(et),\n fieldStats = stats[encDef.name];\n\n if (encDef.bin) {\n // TODO once bin support range, need to update this\n return getMaxNumberLength(encoding, et, fieldStats);\n } if (encoding.isType(et, Q)) {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else if (encoding.isType(et, T)) {\n return time.maxLength(encoding.encDef(et).timeUnit, encoding);\n } else if (encoding.isTypes(et, [N, O])) {\n if(fieldStats.type === 'number') {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else {\n return Math.min(fieldStats.max, encoding.axis(et).maxLabelLength || Infinity);\n }\n }\n}\n\nfunction offset(encoding, stats, layout) {\n [X, Y].forEach(function (et) {\n // TODO(kanitw): Jul 19, 2015 - create a set of visual test for extraOffset\n var extraOffset = et === X ? 20 : 22,\n maxLength;\n if (encoding.isDimension(et) || encoding.isType(et, T)) {\n maxLength = getMaxLength(encoding, stats, et);\n } else if (\n // TODO once we have #512 (allow using inferred type)\n // Need to adjust condition here.\n encoding.isType(et, Q) ||\n encoding.encDef(et).aggregate === 'count'\n ) {\n if (\n et===Y\n // || (et===X && false)\n // FIXME determine when X would rotate, but should move this to axis.js first #506\n ) {\n maxLength = getMaxLength(encoding, stats, et);\n }\n } else {\n // nothing\n }\n\n if (maxLength) {\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * maxLength + extraOffset);\n } else {\n // if no max length (no rotation case), use maxLength = 3\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * 3 + extraOffset);\n }\n\n });\n return layout;\n}\n\n},{\"../globals\":71,\"../util\":75,\"./time\":66,\"d3-format\":5}],60:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar time = require('./time'),\n util = require('../util'),\n setter = util.setter,\n getter = util.getter;\n\nvar legend = module.exports = {};\n\nlegend.defs = function(encoding, style) {\n var defs = [];\n\n if (encoding.has(COLOR) && encoding.encDef(COLOR).legend) {\n defs.push(legend.def(COLOR, encoding, {\n fill: COLOR\n }, style));\n }\n\n if (encoding.has(SIZE) && encoding.encDef(SIZE).legend) {\n defs.push(legend.def(SIZE, encoding, {\n size: SIZE\n }, style));\n }\n\n if (encoding.has(SHAPE) && encoding.encDef(SHAPE).legend) {\n defs.push(legend.def(SHAPE, encoding, {\n shape: SHAPE\n }, style));\n }\n return defs;\n};\n\nlegend.def = function(name, encoding, def, style) {\n var timeUnit = encoding.encDef(name).timeUnit;\n\n def.title = legend.title(name, encoding);\n def.orient = encoding.encDef(name).legend.orient;\n\n def = legend.style(name, encoding, def, style);\n\n if (encoding.isType(name, T) &&\n timeUnit &&\n time.hasScale(timeUnit)\n ) {\n setter(def, ['properties', 'labels', 'text', 'scale'], 'time-'+ timeUnit);\n }\n\n return def;\n};\n\nlegend.style = function(name, e, def, style) {\n var symbols = getter(def, ['properties', 'symbols']),\n marktype = e.marktype();\n\n switch (marktype) {\n case 'bar':\n case 'tick':\n case 'text':\n symbols.stroke = {value: 'transparent'};\n symbols.shape = {value: 'square'};\n break;\n\n case 'circle':\n case 'square':\n symbols.shape = {value: marktype};\n /* fall through */\n case 'point':\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR) && name === COLOR) {\n symbols.fill = {scale: COLOR, field: 'data'};\n } else {\n symbols.fill = {value: e.value(COLOR)};\n }\n symbols.stroke = {value: 'transparent'};\n } else {\n if (e.has(COLOR) && name === COLOR) {\n symbols.stroke = {scale: COLOR, field: 'data'};\n } else {\n symbols.stroke = {value: e.value(COLOR)};\n }\n symbols.fill = {value: 'transparent'};\n symbols.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n break;\n case 'line':\n case 'area':\n // TODO use shape here after implementing #508\n break;\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) {\n symbols.opacity = {value: opacity};\n }\n return def;\n};\n\nlegend.title = function(name, encoding) {\n var leg = encoding.encDef(name).legend;\n\n if (leg.title) return leg.title;\n\n return encoding.fieldTitle(name);\n};\n\n},{\"../globals\":71,\"../util\":75,\"./time\":66}],61:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar marks = module.exports = {};\n\nmarks.def = function(encoding, layout, style, stats) {\n\n var defs = [],\n mark = marks[encoding.marktype()],\n from = encoding.dataTable();\n\n // to add a background to text, we need to add it before the text\n if (encoding.marktype() === TEXT && encoding.has(COLOR)) {\n var bg = {\n x: {value: 0},\n y: {value: 0},\n x2: {value: layout.cellWidth},\n y2: {value: layout.cellHeight},\n fill: {scale: COLOR, field: encoding.fieldRef(COLOR)}\n };\n defs.push({\n type: 'rect',\n from: {data: from},\n properties: {enter: bg, update: bg}\n });\n }\n\n // add the mark def for the main thing\n var p = mark.prop(encoding, layout, style, stats);\n defs.push({\n type: mark.type,\n from: {data: from},\n properties: {enter: p, update: p}\n });\n\n return defs;\n};\n\nmarks.bar = {\n type: 'rect',\n prop: bar_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1}\n};\n\nmarks.line = {\n type: 'line',\n line: true,\n prop: line_props,\n requiredEncoding: ['x', 'y'],\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail:1}\n};\n\nmarks.area = {\n type: 'area',\n line: true,\n requiredEncoding: ['x', 'y'],\n prop: area_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1}\n};\n\nmarks.tick = {\n type: 'rect',\n prop: tick_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail: 1}\n};\n\nmarks.circle = {\n type: 'symbol',\n prop: filled_point_props('circle'),\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, detail: 1}\n};\n\nmarks.square = {\n type: 'symbol',\n prop: filled_point_props('square'),\n supportedEncoding: marks.circle.supportedEncoding\n};\n\nmarks.point = {\n type: 'symbol',\n prop: point_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, shape: 1, detail: 1}\n};\n\nmarks.text = {\n type: 'text',\n prop: text_props,\n requiredEncoding: ['text'],\n supportedEncoding: {row: 1, col: 1, size: 1, color: 1, text: 1}\n};\n\nfunction bar_props(e, layout, style) {\n // jshint unused:false\n\n var p = {};\n\n // x's and width\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (!e.has(Y) || e.isDimension(Y)) {\n p.x2 = {value: 0};\n }\n } else {\n if (e.has(X)) { // is ordinal\n p.xc = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0, offset: e.config('singleBarOffset')};\n }\n }\n\n // width\n if (!p.x2) {\n if (!e.has(X) || e.isOrdinalScale(X)) { // no X or X is ordinal\n if (e.has(SIZE)) {\n p.width = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.width = {\n value: e.bandSize(X, layout.x.useSmallBand),\n offset: -1\n };\n }\n } else { // X is Quant or Time Scale\n p.width = {value: 2};\n }\n }\n\n // y's & height\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {field: {group: 'height'}};\n } else {\n if (e.has(Y)) { // is ordinal\n p.yc = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y2 = {\n field: {group: 'height'},\n offset: -e.config('singleBarOffset')\n };\n }\n\n if (e.has(SIZE)) {\n p.height = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.height = {\n value: e.bandSize(Y, layout.y.useSmallBand),\n offset: -1\n };\n }\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction point_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n if (e.has(SHAPE)) {\n p.shape = {scale: SHAPE, field: e.fieldRef(SHAPE)};\n } else if (!e.has(SHAPE)) {\n p.shape = {value: e.value(SHAPE)};\n }\n\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n } else {\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n p.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction line_props(e,layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {field: {group: 'height'}};\n }\n\n // stroke\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n p.strokeWidth = {value: e.config('strokeWidth')};\n\n return p;\n}\n\nfunction area_props(e, layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(Y)) {\n p.x2 = {scale: X, value: 0};\n p.orient = {value: 'horizontal'};\n }\n } else if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0};\n }\n\n // y\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {scale: Y, value: 0};\n } else if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y = {field: {group: 'height'}};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction tick_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(X)) {\n p.x.offset = -e.bandSize(X, layout.x.useSmallBand) / 3;\n }\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n if (e.isDimension(Y)) {\n p.y.offset = -e.bandSize(Y, layout.y.useSmallBand) / 3;\n }\n } else if (!e.has(Y)) {\n p.y = {value: 0};\n }\n\n // width\n if (!e.has(X) || e.isDimension(X)) {\n p.width = {value: e.bandSize(X, layout.y.useSmallBand) / 1.5};\n } else {\n p.width = {value: 1};\n }\n\n // height\n if (!e.has(Y) || e.isDimension(Y)) {\n p.height = {value: e.bandSize(Y, layout.y.useSmallBand) / 1.5};\n } else {\n p.height = {value: 1};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction filled_point_props(shape) {\n return function(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(X)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n p.shape = {value: shape};\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n };\n}\n\nfunction text_props(e, layout, style, stats) {\n var p = {},\n encDef = e.encDef(TEXT);\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n if (e.has(TEXT) && e.isType(TEXT, Q)) {\n p.x = {value: layout.cellWidth-5};\n } else {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.fontSize = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.fontSize = {value: encDef.font.size};\n }\n\n // fill\n // color should be set to background\n p.fill = {value: encDef.color};\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n // text\n if (e.has(TEXT)) {\n if (e.isType(TEXT, Q)) {\n var fieldStats = stats[e.encDef(TEXT).name],\n numberFormat = encDef.format || e.numberFormat(fieldStats);\n\n p.text = {template: '{{' + e.fieldRef(TEXT, {datum: true}) + ' | number:\\'' +\n numberFormat +'\\'}}'};\n p.align = {value: encDef.align};\n } else {\n p.text = {field: e.fieldRef(TEXT)};\n }\n } else {\n p.text = {value: encDef.placeholder};\n }\n\n p.font = {value: encDef.font.family};\n p.fontWeight = {value: encDef.font.weight};\n p.fontStyle = {value: encDef.font.style};\n p.baseline = {value: encDef.baseline};\n\n return p;\n}\n\n},{\"../globals\":71}],62:[function(require,module,exports){\n'use strict';\nrequire('../globals');\nvar util = require('../util'),\n time = require('./time'),\n colorbrewer = require('colorbrewer'),\n interpolate = require('d3-color').interpolateHsl,\n schema = require('../schema/schema');\n\nvar scale = module.exports = {};\n\nscale.names = function(props) {\n return util.keys(util.keys(props).reduce(function(a, x) {\n if (props[x] && props[x].scale) a[props[x].scale] = 1;\n return a;\n }, {}));\n};\n\nscale.defs = function(names, encoding, layout, stats, facet) {\n return names.reduce(function(a, name) {\n var scaleDef = {};\n\n scaleDef.name = name;\n scaleDef.type = scale.type(name, encoding);\n scaleDef.domain = scale.domain(encoding, name, scaleDef.type, stats, facet);\n\n // add `reverse` if applicable\n var reverse = scale.reverse(encoding, name);\n if (reverse) {\n scaleDef.reverse = reverse;\n }\n\n scaleDef = scale.range(scaleDef, encoding, layout, stats);\n\n return (a.push(scaleDef), a);\n }, []);\n};\n\nscale.type = function(name, encoding) {\n switch (encoding.type(name)) {\n case N: //fall through\n case O: return 'ordinal';\n case T:\n var timeUnit = encoding.encDef(name).timeUnit;\n return timeUnit ? time.scale.type(timeUnit, name) : 'time';\n case Q:\n if (encoding.bin(name)) {\n // TODO: revise this\n return name === COLOR ? 'linear' : 'ordinal';\n }\n return encoding.scale(name).type;\n }\n};\n\nscale.domain = function (encoding, name, type, stats, facet) {\n var encDef = encoding.encDef(name);\n\n // special case for temporal scale\n if (encoding.isType(name, T)) {\n var range = time.scale.domain(encDef.timeUnit, name);\n if (range) return range;\n }\n\n // For binned, produce fixed stepped domain.\n // TODO(#614): this must be changed in vg2\n if (encDef.bin) {\n\n var fieldStat = stats[encDef.name],\n bins = util.getbins(fieldStat, encDef.bin.maxbins || schema.MAXBINS_DEFAULT),\n numbins = (bins.stop - bins.start) / bins.step;\n return util.range(numbins).map(function(i) {\n return bins.start + bins.step * i;\n });\n }\n\n // For stack, use STACKED data.\n var stack = encoding.stack();\n if (stack && name === stack.value) {\n return {\n data: STACKED,\n field: encoding.fieldRef(name, {\n // If faceted, scale is determined by the max of sum in each facet.\n prefn: (facet ? 'max_' : '') + 'sum_'\n })\n };\n }\n\n var useRawDomain = scale._useRawDomain(encoding, name);\n var sort = scale.sort(encoding, name, type);\n\n if (useRawDomain) {\n return {\n data: RAW,\n field: encoding.fieldRef(name, {noAggregate:true})\n };\n } else if (sort) { // have sort\n return {\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: sort.op ? RAW : encoding.dataTable(),\n field: encoding.fieldRef(name),\n sort: sort\n };\n } else {\n return {\n data: encoding.dataTable(),\n field: encoding.fieldRef(name)\n };\n }\n};\n\nscale.sort = function(encoding, name, type) {\n var sort = encoding.encDef(name).sort;\n if (sort === 'ascending' || sort === 'descending') {\n return true;\n }\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (type === 'ordinal' && util.isObject(sort)) {\n return {\n op: sort.op,\n field: sort.field\n };\n }\n return undefined;\n};\n\nscale.reverse = function(encoding, name) {\n var sort = encoding.encDef(name).sort;\n return sort && (sort === 'descending' || (sort.order === 'descending'));\n};\n\n/**\n * Determine if useRawDomain should be activated for this scale.\n * @return {Boolean} Returns true if all of the following conditons applies:\n * 1. `useRawDomain` is enabled either through scale or config\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nscale._useRawDomain = function (encoding, name) {\n var encDef = encoding.encDef(name);\n\n // scale value\n var scaleUseRawDomain = encoding.scale(name).useRawDomain;\n\n // Determine if useRawDomain is enabled. If scale value is specified, use scale value.\n // Otherwise, use config value.\n var useRawDomainEnabled = scaleUseRawDomain !== undefined ?\n scaleUseRawDomain : encoding.config('useRawDomain');\n\n var notCountOrSum = !encDef.aggregate ||\n (encDef.aggregate !=='count' && encDef.aggregate !== 'sum');\n\n return useRawDomainEnabled &&\n notCountOrSum && (\n // Q always uses quantitative scale except when it's binned and thus uses ordinal scale.\n (\n encoding.isType(name, Q) &&\n !encDef.bin // TODO(#614): this must be changed once bin is reimplemented\n ) ||\n // TODO: revise this\n // T uses non-ordinal scale when there's no unit or when the unit is not ordinal.\n (\n encoding.isType(name, T) &&\n (!encDef.timeUnit || !time.isOrdinalFn(encDef.timeUnit))\n )\n );\n};\n\n\nscale.range = function (scaleDef, encoding, layout, stats) {\n var spec = encoding.scale(scaleDef.name),\n encDef = encoding.encDef(scaleDef.name),\n timeUnit = encDef.timeUnit;\n\n switch (scaleDef.name) {\n case X:\n scaleDef.range = layout.cellWidth ? [0, layout.cellWidth] : 'width';\n if (scaleDef.type === 'ordinal') {\n scaleDef.bandWidth = encoding.bandSize(X, layout.x.useSmallBand);\n } else {\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n scaleDef.round = true;\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case Y:\n if (scaleDef.type === 'ordinal') {\n scaleDef.range = layout.cellHeight ?\n (encDef.bin ? [layout.cellHeight, 0] : [0, layout.cellHeight]) :\n 'height';\n scaleDef.bandWidth = encoding.bandSize(Y, layout.y.useSmallBand);\n } else {\n scaleDef.range = layout.cellHeight ? [layout.cellHeight, 0] : 'height';\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n\n scaleDef.round = true;\n\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case ROW: // support only ordinal\n scaleDef.bandWidth = layout.cellHeight;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case COL: // support only ordinal\n scaleDef.bandWidth = layout.cellWidth;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case SIZE:\n if (encoding.is('bar')) {\n // FIXME this is definitely incorrect\n // but let's fix it later since bar size is a bad encoding anyway\n scaleDef.range = [3, Math.max(encoding.bandSize(X), encoding.bandSize(Y))];\n } else if (encoding.is(TEXT)) {\n scaleDef.range = [8, 40];\n } else { //point\n var bandSize = Math.min(encoding.bandSize(X), encoding.bandSize(Y)) - 1;\n scaleDef.range = [10, 0.8 * bandSize*bandSize];\n }\n scaleDef.round = true;\n scaleDef.zero = false;\n break;\n case SHAPE:\n scaleDef.range = 'shapes';\n break;\n case COLOR:\n scaleDef.range = scale.color(scaleDef, encoding, stats);\n if (scaleDef.type !== 'ordinal') scaleDef.zero = false;\n break;\n default:\n throw new Error('Unknown encoding name: '+ scaleDef.name);\n }\n\n // FIXME(kanitw): Jul 29, 2015 - consolidate this with above\n switch (scaleDef.name) {\n case ROW:\n case COL:\n scaleDef.padding = encoding.config('cellPadding');\n scaleDef.outerPadding = 0;\n break;\n case X:\n case Y:\n if (scaleDef.type === 'ordinal') { //&& !s.bandWidth\n scaleDef.points = true;\n scaleDef.padding = encoding.encDef(scaleDef.name).band.padding;\n }\n }\n\n return scaleDef;\n};\n\nscale.color = function(s, encoding, stats) {\n var colorScale = encoding.scale(COLOR),\n range = colorScale.range,\n cardinality = encoding.cardinality(COLOR, stats),\n type = encoding.type(COLOR);\n\n if (range === undefined) {\n var ordinalPalette = colorScale.ordinalPalette,\n quantitativeRange = colorScale.quantitativeRange;\n\n if (s.type === 'ordinal') {\n if (type === N) {\n // use categorical color scale\n if (cardinality <= 10) {\n range = colorScale.c10palette;\n } else {\n range = colorScale.c20palette;\n }\n return scale.color.palette(range, cardinality, type);\n } else {\n if (ordinalPalette) {\n return scale.color.palette(ordinalPalette, cardinality, type);\n }\n return scale.color.interpolate(quantitativeRange[0], quantitativeRange[1], cardinality);\n }\n } else { //time or quantitative\n return [quantitativeRange[0], quantitativeRange[1]];\n }\n }\n};\n\nscale.color.palette = function(range, cardinality, type) {\n // FIXME(kanitw): Jul 29, 2015 - check range is string\n switch (range) {\n case 'category10k':\n // tableau's category 10, ordered by perceptual kernel study results\n // https://github.com/uwdata/perceptual-kernels\n return ['#2ca02c', '#e377c2', '#7f7f7f', '#17becf', '#8c564b', '#d62728', '#bcbd22', '#9467bd', '#ff7f0e', '#1f77b4'];\n\n // d3/tableau category10/20/20b/20c\n case 'category10':\n return ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'];\n\n case 'category20':\n return ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'];\n\n case 'category20b':\n return ['#393b79', '#5254a3', '#6b6ecf', '#9c9ede', '#637939', '#8ca252', '#b5cf6b', '#cedb9c', '#8c6d31', '#bd9e39', '#e7ba52', '#e7cb94', '#843c39', '#ad494a', '#d6616b', '#e7969c', '#7b4173', '#a55194', '#ce6dbd', '#de9ed6'];\n\n case 'category20c':\n return ['#3182bd', '#6baed6', '#9ecae1', '#c6dbef', '#e6550d', '#fd8d3c', '#fdae6b', '#fdd0a2', '#31a354', '#74c476', '#a1d99b', '#c7e9c0', '#756bb1', '#9e9ac8', '#bcbddc', '#dadaeb', '#636363', '#969696', '#bdbdbd', '#d9d9d9'];\n }\n\n // TODO add our own set of custom ordinal color palette\n\n if (range in colorbrewer) {\n var palette = colorbrewer[range];\n\n // if cardinality pre-defined, use it.\n if (cardinality in palette) return palette[cardinality];\n\n // if not, use the highest cardinality one for nominal\n if (type === N) {\n return palette[Math.max.apply(null, util.keys(palette))];\n }\n\n // otherwise, interpolate\n var ps = cardinality < 3 ? 3 : Math.max.apply(null, util.keys(palette)),\n from = 0 , to = ps - 1;\n // FIXME add config for from / to\n\n return scale.color.interpolate(palette[ps][from], palette[ps][to], cardinality);\n }\n\n return range;\n};\n\nscale.color.interpolate = function (start, end, cardinality) {\n\n var interpolator = interpolate(start, end);\n return util.range(cardinality).map(function(i) { return interpolator(i*1.0/(cardinality-1)); });\n};\n\n},{\"../globals\":71,\"../schema/schema\":73,\"../util\":75,\"./time\":66,\"colorbrewer\":3,\"d3-color\":4}],63:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nmodule.exports = stacking;\n\nfunction stacking(encoding, mdef, stack) {\n var groupby = stack.groupby;\n var field = stack.value;\n\n var valName = encoding.fieldRef(field);\n var startField = valName + '_start';\n var endField = valName + '_end';\n\n // add stack transform to mark\n var transform = {\n type: 'stack',\n groupby: [encoding.fieldRef(groupby)],\n field: encoding.fieldRef(field),\n sortby: [(stack.properties.reverse ? '' : '-') + encoding.fieldRef(stack.stack)],\n output: {start: startField, end: endField}\n };\n\n if (stack.properties.offset) {\n transform.offset = stack.properties.offset;\n }\n\n mdef.from.transform = [transform];\n\n // TODO(#276): This is super hack-ish -- consolidate into modular mark properties?\n mdef.properties.update[field] = mdef.properties.enter[field] = {\n scale: field,\n field: startField\n };\n mdef.properties.update[field + '2'] = mdef.properties.enter[field + '2'] = {\n scale: field,\n field: endField\n };\n\n return field; //return stack encoding\n}\n\n},{\"../globals\":71}],64:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar vlEncDef = require('../encdef');\n\nmodule.exports = function(encoding, stats) {\n return {\n opacity: estimateOpacity(encoding, stats),\n };\n};\n\nfunction estimateOpacity(encoding,stats) {\n if (!stats) {\n return 1;\n }\n\n var numPoints = 0;\n\n if (encoding.isAggregate()) { // aggregate plot\n numPoints = 1;\n\n // get number of points in each \"cell\"\n // by calculating product of cardinality\n // for each non faceting and non-ordinal X / Y fields\n // note that ordinal x,y are not include since we can\n // consider that ordinal x are subdividing the cell into subcells anyway\n encoding.forEach(function(encDef, encType) {\n\n if (encType !== ROW && encType !== COL &&\n !((encType === X || encType === Y) &&\n vlEncDef.isOrdinalScale(encDef))\n ) {\n numPoints *= encoding.cardinality(encType, stats);\n }\n });\n\n } else { // raw plot\n\n // TODO: error handling\n if (!stats['*'])\n return 1;\n\n numPoints = stats['*'].max; // count\n\n // small multiples divide number of points\n var numMultiples = 1;\n if (encoding.has(ROW)) {\n numMultiples *= encoding.cardinality(ROW, stats);\n }\n if (encoding.has(COL)) {\n numMultiples *= encoding.cardinality(COL, stats);\n }\n numPoints /= numMultiples;\n }\n\n var opacity = 0;\n if (numPoints <= 25) {\n opacity = 1;\n } else if (numPoints < 200) {\n opacity = 0.8;\n } else if (numPoints < 1000 || encoding.is('tick')) {\n opacity = 0.7;\n } else {\n opacity = 0.3;\n }\n\n return opacity;\n}\n\n\n},{\"../encdef\":70,\"../globals\":71}],65:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nmodule.exports = subfaceting;\n\nfunction subfaceting(group, mdef, details, encoding) {\n var m = group.marks;\n var g = {\n name: 'subfacet',\n type: 'group',\n from: mdef.from,\n properties: {\n enter: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n marks: m\n };\n\n group.marks = [g];\n delete mdef.from; // (move to the new g)\n\n //TODO test LOD -- we should support stack / line without color (LOD) field\n var trans = (g.from.transform || (g.from.transform = []));\n trans.push({type: 'facet', groupby: details});\n\n // TODO: understand why we need this sort transform and write comment\n var stack = encoding.stack();\n if (stack && encoding.has(COLOR)) {\n trans.unshift({type: 'sort', by: encoding.fieldRef(COLOR)});\n }\n}\n\n},{\"../globals\":71}],66:[function(require,module,exports){\n'use strict';\n\nvar util = require('../util'),\n d3_time_format = require('d3-time-format');\n\nvar time = module.exports = {};\n\n// 'Wednesday September 17 04:00:00 2014'\n// Wednesday is the longest date\n// September is the longest month (8 in javascript as it is zero-indexed).\nvar LONG_DATE = new Date(Date.UTC(2014, 8, 17));\n\ntime.cardinality = function(encDef, stats, filterNull, type) {\n var timeUnit = encDef.timeUnit;\n switch (timeUnit) {\n case 'seconds': return 60;\n case 'minutes': return 60;\n case 'hours': return 24;\n case 'day': return 7;\n case 'date': return 31;\n case 'month': return 12;\n case 'year':\n var stat = stats[encDef.name],\n yearstat = stats['year_' + encDef.name];\n\n if (!yearstat) { return null; }\n\n return yearstat.distinct -\n (stat.missing > 0 && filterNull[type] ? 1 : 0);\n }\n\n return null;\n};\n\ntime.formula = function(timeUnit, fieldRef) {\n // TODO(kanitw): add formula to other time format\n var fn = 'utc' + timeUnit;\n return fn + '(' + fieldRef + ')';\n};\n\ntime.maxLength = function(timeUnit, encoding) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'date':\n return 2;\n case 'month':\n case 'day':\n var range = time.range(timeUnit, encoding);\n if (range) {\n // return the longest name in the range\n return Math.max.apply(null, range.map(function(r) {return r.length;}));\n }\n return 2;\n case 'year':\n return 4; //'1998'\n }\n // TODO(#600) revise this\n // no time unit\n var timeFormat = encoding.config('timeFormat');\n return d3_time_format.utcFormat(timeFormat)(LONG_DATE).length;\n};\n\ntime.range = function(timeUnit, encoding) {\n var labelLength = encoding.config('timeScaleLabelLength'),\n scaleLabel;\n switch (timeUnit) {\n case 'day':\n scaleLabel = encoding.config('dayScaleLabel');\n break;\n case 'month':\n scaleLabel = encoding.config('monthScaleLabel');\n break;\n }\n if (scaleLabel) {\n return labelLength ? scaleLabel.map(\n function(s) { return s.substr(0, labelLength);}\n ) : scaleLabel;\n }\n return;\n};\n\n\n/**\n * @param {Object} encoding\n * @return {Array} scales for time unit names\n */\ntime.scales = function(encoding) {\n var scales = encoding.reduce(function(scales, encDef) {\n var timeUnit = encDef.timeUnit;\n if (encDef.type === T && timeUnit && !scales[timeUnit]) {\n var scale = time.scale.def(encDef.timeUnit, encoding);\n if (scale) scales[timeUnit] = scale;\n }\n return scales;\n }, {});\n\n return util.vals(scales);\n};\n\n\ntime.scale = {};\n\n/** append custom time scales for axis label */\ntime.scale.def = function(timeUnit, encoding) {\n var range = time.range(timeUnit, encoding);\n\n if (range) {\n return {\n name: 'time-'+timeUnit,\n type: 'ordinal',\n domain: time.scale.domain(timeUnit),\n range: range\n };\n }\n return null;\n};\n\ntime.isOrdinalFn = function(timeUnit) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'day':\n case 'date':\n case 'month':\n return true;\n }\n return false;\n};\n\ntime.scale.type = function(timeUnit, name) {\n if (name === COLOR) {\n return 'linear'; // time has order, so use interpolated ordinal color scale.\n }\n\n return time.isOrdinalFn(timeUnit) || name === COL || name === ROW ? 'ordinal' : 'linear';\n};\n\ntime.scale.domain = function(timeUnit, name) {\n var isColor = name === COLOR;\n switch (timeUnit) {\n case 'seconds':\n case 'minutes': return isColor ? [0,59] : util.range(0, 60);\n case 'hours': return isColor ? [0,23] : util.range(0, 24);\n case 'day': return isColor ? [0,6] : util.range(0, 7);\n case 'date': return isColor ? [1,31] : util.range(1, 32);\n case 'month': return isColor ? [0,11] : util.range(0, 12);\n }\n return null;\n};\n\n/** whether a particular time function has custom scale for labels implemented in time.scale */\ntime.hasScale = function(timeUnit) {\n switch (timeUnit) {\n case 'day':\n case 'month':\n return true;\n }\n return false;\n};\n\n},{\"../util\":75,\"d3-time-format\":6}],67:[function(require,module,exports){\n'use strict';\n\nrequire('./globals');\n\nvar consts = module.exports = {};\n\nconsts.encodingTypes = [X, Y, ROW, COL, SIZE, SHAPE, COLOR, TEXT, DETAIL];\n\nconsts.shorthand = {\n delim: '|',\n assign: '=',\n type: ',',\n func: '_'\n};\n\n},{\"./globals\":71}],68:[function(require,module,exports){\n'use strict';\n\nrequire('./globals');\n\nvar stats = require('datalib/src/stats');\n\nvar vldata = module.exports = {};\n\n/** Mapping from datalib's inferred type to Vega-lite's type */\nvldata.types = {\n 'boolean': N,\n 'number': Q,\n 'integer': Q,\n 'date': T,\n 'string': N\n};\n\nvldata.stats = function(data) {\n var summary = stats.summary(data);\n\n return summary.reduce(function(s, profile) {\n s[profile.field] = profile;\n return s;\n }, {\n '*': {\n max: data.length,\n min: 0\n }\n });\n};\n},{\"./globals\":71,\"datalib/src/stats\":29}],69:[function(require,module,exports){\n// utility for enc\n\n'use strict';\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n vlEncDef = require('./encdef'),\n util = require('./util'),\n schema = require('./schema/schema'),\n encTypes = schema.encTypes;\n\nvar vlenc = module.exports = {};\n\nvlenc.countRetinal = function(enc) {\n var count = 0;\n if (enc.color) count++;\n if (enc.size) count++;\n if (enc.shape) count++;\n return count;\n};\n\nvlenc.has = function(enc, encType) {\n var fieldDef = enc && enc[encType];\n return fieldDef && fieldDef.name;\n};\n\nvlenc.isAggregate = function(enc) {\n for (var k in enc) {\n if (vlenc.has(enc, k) && enc[k].aggregate) {\n return true;\n }\n }\n return false;\n};\n\nvlenc.forEach = function(enc, f) {\n var i = 0;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n f(enc[k], k, i++);\n }\n });\n};\n\nvlenc.map = function(enc, f) {\n var arr = [];\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n arr.push(f(enc[k], k, enc));\n }\n });\n return arr;\n};\n\nvlenc.reduce = function(enc, f, init) {\n var r = init;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n r = f(r, enc[k], k, enc);\n }\n });\n return r;\n};\n\n/*\n * return key-value pairs of field name and list of fields of that field name\n */\nvlenc.fields = function(enc) {\n return vlenc.reduce(enc, function (m, field) {\n var fieldList = m[field.name] = m[field.name] || [],\n containsType = fieldList.containsType = fieldList.containsType || {};\n\n if (fieldList.indexOf(field) === -1) {\n fieldList.push(field);\n // augment the array with containsType.Q / O / N / T\n containsType[field.type] = true;\n }\n return m;\n }, {});\n};\n\nvlenc.shorthand = function(enc) {\n return vlenc.map(enc, function(field, et) {\n return et + c.assign + vlEncDef.shorthand(field);\n }).join(c.delim);\n};\n\nvlenc.fromShorthand = function(shorthand) {\n var enc = util.isArray(shorthand) ? shorthand : shorthand.split(c.delim);\n return enc.reduce(function(m, e) {\n var split = e.split(c.assign),\n enctype = split[0].trim(),\n field = split[1];\n\n m[enctype] = vlEncDef.fromShorthand(field);\n return m;\n }, {});\n};\n\n},{\"./consts\":67,\"./encdef\":70,\"./schema/schema\":73,\"./util\":75}],70:[function(require,module,exports){\n'use strict';\n\n// utility for field\n\nrequire('./globals');\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n time = require('./compiler/time'),\n util = require('./util'),\n schema = require('./schema/schema');\n\nvar vlfield = module.exports = {};\n\n/**\n * @param field\n * @param opt\n * opt.nofn -- exclude bin, aggregate, timeUnit\n * opt.noAggregate -- exclude aggregation function\n * opt.datum - include 'datum.'\n * opt.fn - replace fn with custom function prefix\n * opt.prefn - prepend fn with custom function prefix\n\n * @return {[type]} [description]\n */\nvlfield.fieldRef = function(field, opt) {\n opt = opt || {};\n\n var f = (opt.datum ? 'datum.' : '') + (opt.prefn || ''),\n name = field.name;\n\n if (vlfield.isCount(field)) {\n return f + 'count';\n } else if (opt.fn) {\n return f + opt.fn + '_' + name;\n } else if (!opt.nofn && field.bin) {\n return f + 'bin_' + name;\n } else if (!opt.nofn && !opt.noAggregate && field.aggregate) {\n return f + field.aggregate + '_' + name;\n } else if (!opt.nofn && field.timeUnit) {\n return f + field.timeUnit + '_' + name;\n } else {\n return f + name;\n }\n};\n\nvlfield.shorthand = function(f) {\n var c = consts.shorthand;\n return (f.aggregate ? f.aggregate + c.func : '') +\n (f.timeUnit ? f.timeUnit + c.func : '') +\n (f.bin ? 'bin' + c.func : '') +\n (f.name || '') + c.type + f.type;\n};\n\nvlfield.shorthands = function(fields, delim) {\n delim = delim || c.delim;\n return fields.map(vlfield.shorthand).join(delim);\n};\n\nvlfield.fromShorthand = function(shorthand) {\n var split = shorthand.split(c.type), i;\n var o = {\n name: split[0].trim(),\n type: split[1].trim()\n };\n\n // check aggregate type\n for (i in schema.aggregate.enum) {\n var a = schema.aggregate.enum[i];\n if (o.name.indexOf(a + '_') === 0) {\n o.name = o.name.substr(a.length + 1);\n if (a == 'count' && o.name.length === 0) o.name = '*';\n o.aggregate = a;\n break;\n }\n }\n\n // check time timeUnit\n for (i in schema.timefns) {\n var tu = schema.timefns[i];\n if (o.name && o.name.indexOf(tu + '_') === 0) {\n o.name = o.name.substr(o.length + 1);\n o.timeUnit = tu;\n break;\n }\n }\n\n // check bin\n if (o.name && o.name.indexOf('bin_') === 0) {\n o.name = o.name.substr(4);\n o.bin = true;\n }\n\n return o;\n};\n\nvar isType = vlfield.isType = function (fieldDef, type) {\n return fieldDef.type === type;\n};\n\nvar isTypes = vlfield.isTypes = function (fieldDef, types) {\n for (var t=0; t 0 && filterNull[type] ? 1 : 0);\n};\n\n},{\"./compiler/time\":66,\"./consts\":67,\"./globals\":71,\"./schema/schema\":73,\"./util\":75}],71:[function(require,module,exports){\n(function (global){\n'use strict';\n\n// declare global constant\nvar g = global || window;\n\ng.AGGREGATE = 'aggregate';\ng.RAW = 'raw';\ng.STACKED = 'stacked';\ng.INDEX = 'index';\n\ng.X = 'x';\ng.Y = 'y';\ng.ROW = 'row';\ng.COL = 'col';\ng.SIZE = 'size';\ng.SHAPE = 'shape';\ng.COLOR = 'color';\ng.TEXT = 'text';\ng.DETAIL = 'detail';\n\ng.N = 'N';\ng.O = 'O';\ng.Q = 'Q';\ng.T = 'T';\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],72:[function(require,module,exports){\n'use strict';\n\n// TODO(kanitw): chat with Vega team and possibly move this to vega-logging\nmodule.exports = function(prefix) {\n // Borrowed some ideas from http://stackoverflow.com/a/15653260/866989\n // and https://github.com/patik/console.log-wrapper/blob/master/consolelog.js\n var METHODS = ['error', 'info', 'debug', 'warn', 'log'];\n\n return METHODS.reduce(function(logger, fn) {\n var cfn = console[fn] ? fn : 'log';\n if (console[cfn].bind === 'undefined') { // IE < 10\n logger[fn] = Function.prototype.bind.call(console[cfn], console, prefix);\n }\n else {\n logger[fn] = console[cfn].bind(console, prefix);\n }\n return logger;\n }, {});\n};\n},{}],73:[function(require,module,exports){\n// Package of defining Vega-lite Specification's json schema\n'use strict';\n\nrequire('../globals');\n\nvar schema = module.exports = {},\n util = require('../util'),\n toMap = util.toMap,\n colorbrewer = require('colorbrewer');\n\nvar VALID_AGG_OPS = require('vega/src/transforms/Aggregate').VALID_OPS;\n\n// TODO(#620) refer to vega schema\n// var vgStackSchema = require('vega/src/transforms/Stack').schema;\n\n\nschema.util = require('./schemautil');\n\nschema.marktype = {\n type: 'string',\n enum: ['point', 'tick', 'bar', 'line', 'area', 'circle', 'square', 'text']\n};\n\nschema.aggregate = {\n type: 'string',\n enum: VALID_AGG_OPS,\n supportedEnums: {\n Q: VALID_AGG_OPS,\n O: ['median','min','max'],\n N: [],\n T: ['mean', 'median', 'min', 'max'],\n '': ['count']\n },\n supportedTypes: toMap([Q, N, O, T, ''])\n};\n\nschema.getSupportedRole = function(encType) {\n return schema.schema.properties.encoding.properties[encType].supportedRole;\n};\n\nschema.timeUnits = ['year', 'month', 'day', 'date', 'hours', 'minutes', 'seconds'];\n\nschema.defaultTimeFn = 'month';\n\nschema.timeUnit = {\n type: 'string',\n enum: schema.timeUnits,\n supportedTypes: toMap([T])\n};\n\nschema.scale_type = {\n type: 'string',\n // TODO(kanitw) read vega's schema here, add description\n enum: ['linear', 'log', 'pow', 'sqrt', 'quantile'],\n default: 'linear',\n supportedTypes: toMap([Q])\n};\n\nschema.field = {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n }\n }\n};\n\nvar clone = util.duplicate;\nvar merge = schema.util.merge;\n\nschema.MAXBINS_DEFAULT = 15;\n\nvar bin = {\n type: ['boolean', 'object'],\n default: false,\n properties: {\n maxbins: {\n type: 'integer',\n default: schema.MAXBINS_DEFAULT,\n minimum: 2,\n description: 'Maximum number of bins.'\n }\n },\n supportedTypes: toMap([Q]) // TODO: add O after finishing #81\n};\n\nvar typicalField = merge(clone(schema.field), {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T]\n },\n aggregate: schema.aggregate,\n timeUnit: schema.timeUnit,\n bin: bin,\n scale: {\n type: 'object',\n properties: {\n /* Common Scale Properties */\n type: schema.scale_type,\n\n /* Quantitative Scale Properties */\n nice: {\n type: 'string',\n enum: ['second', 'minute', 'hour', 'day', 'week', 'month', 'year'],\n supportedTypes: toMap([T])\n },\n zero: {\n type: 'boolean',\n description: 'Include zero',\n default: true,\n supportedTypes: toMap([Q, T])\n },\n\n /* Vega-lite only Properties */\n useRawDomain: {\n type: 'boolean',\n default: undefined,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n }\n }\n});\n\nvar onlyOrdinalField = merge(clone(schema.field), {\n type: 'object',\n supportedRole: {\n dimension: true\n },\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T] // ordinal-only field supports Q when bin is applied and T when time unit is applied.\n },\n timeUnit: schema.timeUnit,\n bin: bin,\n aggregate: {\n type: 'string',\n enum: ['count'],\n supportedTypes: toMap([N, O]) // FIXME this looks weird to me\n }\n }\n});\n\nvar axisMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true},\n properties: {\n axis: {\n type: 'object',\n properties: {\n /* Vega Axis Properties */\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for axis labels. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n grid: {\n type: 'boolean',\n default: undefined,\n description: 'A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise.'\n },\n layer: {\n type: 'string',\n default: 'back',\n description: 'A string indicating if the axis (and any gridlines) should be placed above or below the data marks. One of \"front\" (default) or \"back\".'\n },\n orient: {\n type: 'string',\n default: undefined,\n enum: ['top', 'right', 'left', 'bottom'],\n 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 for the right edge of the chart).'\n },\n ticks: {\n type: 'integer',\n default: 5,\n minimum: 0,\n 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 },\n /* Vega Axis Properties that are automatically populated by Vega-lite */\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the axis. (Shows field name and its function by default.)'\n },\n /* Vega-lite only */\n maxLabelLength: {\n type: 'integer',\n default: 25,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n },\n labelAngle: {\n type: 'integer',\n default: undefined, // auto\n minimum: 0,\n maximum: 360,\n description: 'Angle by which to rotate labels. Set to 0 to force horizontal.'\n },\n titleMaxLength: {\n type: 'integer',\n default: undefined,\n minimum: 0,\n description: 'Max length for axis title if the title is automatically generated from the field\\'s description'\n },\n titleOffset: {\n type: 'integer',\n default: undefined, // auto\n description: 'A title offset value for the axis.'\n },\n }\n }\n }\n};\n\nvar sortMixin = {\n type: 'object',\n properties: {\n sort: {\n default: undefined,\n supportedTypes: toMap([N, O]),\n oneOf: [\n {\n type: 'string',\n enum: ['ascending', 'descending']\n },\n { // sort by aggregation of another field\n type: 'object',\n required: ['field', 'op'],\n properties: {\n field: {\n type: 'string',\n description: 'The field name to aggregate over.'\n },\n op: {\n type: 'string',\n enum: VALID_AGG_OPS,\n description: 'The field name to aggregate over.'\n },\n order: {\n type: 'string',\n enum: ['ascending', 'descending']\n }\n }\n }\n ]\n\n }\n }\n};\n\nvar bandMixin = {\n type: 'object',\n properties: {\n band: {\n type: 'object',\n properties: {\n size: {\n type: 'integer',\n minimum: 0,\n default: undefined\n },\n padding: {\n type: 'integer',\n minimum: 0,\n default: 1\n }\n }\n }\n }\n};\n\nvar legendMixin = {\n type: 'object',\n properties: {\n legend: {\n type: 'object',\n description: 'Properties of a legend.',\n properties: {\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the legend. (Shows field name and its function by default.)'\n },\n orient: {\n type: 'string',\n default: 'right',\n description: 'The orientation of the legend. One of \"left\" or \"right\". This determines how the legend is positioned within the scene. The default is \"right\".'\n }\n }\n }\n }\n};\n\nvar textMixin = {\n type: 'object',\n supportedMarktypes: {'text': true},\n properties: {\n align: {\n type: 'string',\n default: 'right'\n },\n baseline: {\n type: 'string',\n default: 'middle'\n },\n color: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n margin: {\n type: 'integer',\n default: 4,\n minimum: 0\n },\n placeholder: {\n type: 'string',\n default: 'Abc'\n },\n font: {\n type: 'object',\n properties: {\n weight: {\n type: 'string',\n enum: ['normal', 'bold'],\n default: 'normal'\n },\n size: {\n type: 'integer',\n default: 10,\n minimum: 0\n },\n family: {\n type: 'string',\n default: 'Helvetica Neue'\n },\n style: {\n type: 'string',\n default: 'normal',\n enum: ['normal', 'italic']\n }\n }\n },\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for text value. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n }\n};\n\nvar sizeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, bar: true, circle: true, square: true, text: true},\n properties: {\n value: {\n type: 'integer',\n default: 30,\n minimum: 0,\n description: 'Size of marks.'\n }\n }\n};\n\nvar colorMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, 'text': true},\n properties: {\n value: {\n type: 'string',\n role: 'color',\n default: '#4682b4',\n description: 'Color to be used for marks.'\n },\n opacity: {\n type: 'number',\n default: undefined, // auto\n minimum: 0,\n maximum: 1\n },\n scale: {\n type: 'object',\n properties: {\n range: {\n type: ['string', 'array'],\n default: undefined,\n description:\n 'Color palette, if undefined vega-lite will use data property' +\n 'to pick one from c10palette, c20palette, or ordinalPalette.'\n //FIXME\n },\n c10palette: {\n type: 'string',\n default: 'category10',\n enum: [\n // Tableau\n 'category10', 'category10k',\n // Color Brewer\n 'Pastel1', 'Pastel2', 'Set1', 'Set2', 'Set3'\n ]\n },\n c20palette: {\n type: 'string',\n default: 'category20',\n enum: ['category20', 'category20b', 'category20c']\n },\n ordinalPalette: {\n type: 'string',\n default: undefined,\n description: 'Color palette to encode ordinal variables.',\n enum: util.keys(colorbrewer)\n },\n quantitativeRange: {\n type: 'array',\n default: ['#AFC6A3', '#09622A'], // tableau greens\n // default: ['#ccece6', '#00441b'], // BuGn.9 [2-8]\n description: 'Color range to encode quantitative variables.',\n minItems: 2,\n maxItems: 2,\n items: {\n type: 'string',\n role: 'color'\n }\n }\n }\n }\n }\n};\n\nvar stackMixin = {\n type: 'object',\n properties: {\n stack: {\n type: ['boolean', 'object'],\n default: true,\n description: 'Enable stacking (for bar and area marks only).',\n properties: {\n reverse: {\n type: 'boolean',\n default: false,\n description: 'Whether to reverse the stack\\'s sortby.'\n },\n offset: {\n type: 'string',\n default: undefined,\n enum: ['zero', 'center', 'normalize']\n // TODO(#620) refer to Vega spec once it doesn't throw error\n // enum: vgStackSchema.properties.offset.oneOf[0].enum\n }\n }\n }\n }\n};\n\nvar shapeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, circle: true, square: true},\n properties: {\n value: {\n type: 'string',\n enum: ['circle', 'square', 'cross', 'diamond', 'triangle-up', 'triangle-down'],\n default: 'circle',\n description: 'Mark to be used.'\n },\n filled: {\n type: 'boolean',\n default: false,\n description: 'Whether the shape\\'s color should be used as fill color instead of stroke color.'\n }\n }\n};\n\nvar detailMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, line: true, circle: true, square: true}\n};\n\nvar rowMixin = {\n properties: {\n height: {\n type: 'number',\n minimum: 0,\n default: 150\n }\n }\n};\n\nvar colMixin = {\n properties: {\n width: {\n type: 'number',\n minimum: 0,\n default: 150\n },\n axis: {\n properties: {\n maxLabelLength: {\n type: 'integer',\n default: 12,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n }\n }\n }\n }\n};\n\nvar facetMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, text: true},\n properties: {\n padding: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.1\n }\n }\n};\n\nvar requiredNameType = {\n required: ['name', 'type']\n};\n\nvar multiRoleField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: true\n }\n});\n\nvar quantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: 'ordinal-only' // using size to encoding category lead to order interpretation\n }\n});\n\nvar onlyQuantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true\n }\n});\n\nvar x = merge(clone(multiRoleField), axisMixin, bandMixin, requiredNameType, sortMixin);\nvar y = clone(x);\n\nvar facet = merge(clone(onlyOrdinalField), requiredNameType, facetMixin, sortMixin);\nvar row = merge(clone(facet), axisMixin, rowMixin);\nvar col = merge(clone(facet), axisMixin, colMixin);\n\nvar size = merge(clone(quantitativeField), legendMixin, sizeMixin, sortMixin);\nvar color = merge(clone(multiRoleField), legendMixin, colorMixin, stackMixin, sortMixin);\n\nvar shape = merge(clone(onlyOrdinalField), legendMixin, shapeMixin, sortMixin);\nvar detail = merge(clone(onlyOrdinalField), detailMixin, stackMixin, sortMixin);\n\n// we only put aggregated measure in pivot table\nvar text = merge(clone(onlyQuantitativeField), textMixin, sortMixin);\n\n// TODO add label\n\nvar data = {\n type: 'object',\n properties: {\n // data source\n formatType: {\n type: 'string',\n enum: ['json', 'csv'],\n default: 'json'\n },\n url: {\n type: 'string',\n default: undefined\n },\n values: {\n type: 'array',\n default: undefined,\n description: 'Pass array of objects instead of a url to a file.',\n items: {\n type: 'object',\n additionalProperties: true\n }\n },\n // we generate a vega filter transform\n filter: {\n type: 'string',\n default: undefined,\n description: 'A string containing the filter Vega expression. Use `datum` to refer to the current data object.'\n },\n // we generate a vega formula transform\n formulas: {\n type: 'array',\n default: undefined,\n description: 'Array of formula transforms. Formulas are applied before filter.',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The property name in which to store the computed formula value.'\n },\n expr: {\n type: 'string',\n description: 'A string containing an expression for the formula. Use the variable `datum` to to refer to the current data object.'\n }\n }\n }\n }\n }\n};\n\nvar config = {\n type: 'object',\n properties: {\n // template\n width: {\n type: 'integer',\n default: undefined\n },\n height: {\n type: 'integer',\n default: undefined\n },\n viewport: {\n type: 'array',\n items: {\n type: 'integer'\n },\n default: undefined\n },\n gridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n gridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.08\n },\n\n // filter null\n // TODO(#597) revise this config\n filterNull: {\n type: 'object',\n properties: {\n N: {type:'boolean', default: false},\n O: {type:'boolean', default: false},\n Q: {type:'boolean', default: true},\n T: {type:'boolean', default: true}\n }\n },\n autoSortLine: {\n type: 'boolean',\n default: true\n },\n\n // single plot\n singleHeight: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n singleWidth: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n // band size\n largeBandSize: {\n type: 'integer',\n default: 21,\n minimum: 0\n },\n smallBandSize: {\n //small multiples or single plot with high cardinality\n type: 'integer',\n default: 12,\n minimum: 0\n },\n largeBandMaxCardinality: {\n type: 'integer',\n default: 10\n },\n // small multiples\n cellPadding: {\n type: 'number',\n default: 0.1\n },\n cellGridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n cellGridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.25\n },\n cellGridOffset: {\n type: 'number',\n default: 6 // equal to tickSize\n },\n cellBackgroundColor: {\n type: 'string',\n role: 'color',\n default: 'rgba(0,0,0,0)'\n },\n textCellWidth: {\n type: 'integer',\n default: 90,\n minimum: 0\n },\n\n // marks\n strokeWidth: {\n type: 'integer',\n default: 2,\n minimum: 0\n },\n singleBarOffset: {\n type: 'integer',\n default: 5,\n minimum: 0\n },\n // scales\n timeScaleLabelLength: {\n type: 'integer',\n default: 3,\n minimum: 0,\n description: 'Max length for values in dayScaleLabel and monthScaleLabel. Zero means using full names in dayScaleLabel/monthScaleLabel.'\n },\n dayScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n description: 'Axis labels for day of week, starting from Sunday.' +\n '(Consistent with Javascript -- See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay.'\n },\n monthScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n description: 'Axis labels for month.'\n },\n // other\n characterWidth: {\n type: 'integer',\n default: 6\n },\n maxSmallNumber: {\n type: 'number',\n default: 10000,\n description: 'maximum number that a field will be considered smallNumber.'+\n 'Used for axis labelling.'\n },\n smallNumberFormat: {\n type: 'string',\n default: '',\n description: 'D3 Number format for axis labels and text tables '+\n 'for number <= maxSmallNumber. Used for axis labelling.'\n },\n largeNumberFormat: {\n type: 'string',\n default: '.3s',\n description: 'D3 Number format for axis labels and text tables ' +\n 'for number > maxSmallNumber.'\n },\n timeFormat: {\n type: 'string',\n default: '%Y-%m-%d',\n description: 'Date format for axis labels.'\n },\n useRawDomain: {\n type: 'boolean',\n default: false,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n};\n\n/** @type Object Schema of a vega-lite specification */\nschema.schema = {\n $schema: 'http://json-schema.org/draft-04/schema#',\n description: 'Schema for Vega-lite specification',\n type: 'object',\n required: ['marktype', 'encoding', 'data'],\n properties: {\n data: data,\n marktype: schema.marktype,\n encoding: {\n type: 'object',\n properties: {\n x: x,\n y: y,\n row: row,\n col: col,\n size: size,\n color: color,\n shape: shape,\n text: text,\n detail: detail\n }\n },\n config: config\n }\n};\n\nschema.encTypes = util.keys(schema.schema.properties.encoding.properties);\n\n/** Instantiate a verbose vl spec from the schema */\nschema.instantiate = function() {\n return schema.util.instantiate(schema.schema);\n};\n\n},{\"../globals\":71,\"../util\":75,\"./schemautil\":74,\"colorbrewer\":3,\"vega/src/transforms/Aggregate\":50}],74:[function(require,module,exports){\n'use strict';\n\nvar schemautil = module.exports = {},\n util = require('../util');\n\nvar isEmpty = function(obj) {\n return Object.keys(obj).length === 0;\n};\n\nschemautil.extend = function(instance, schema) {\n return schemautil.merge(schemautil.instantiate(schema), instance);\n};\n\n// instantiate a schema\nschemautil.instantiate = function(schema) {\n var val;\n if (schema === undefined) {\n return undefined;\n } else if ('default' in schema) {\n val = schema.default;\n return util.isObject(val) ? util.duplicate(val) : val;\n } else if (schema.type === 'object') {\n var instance = {};\n for (var name in schema.properties) {\n val = schemautil.instantiate(schema.properties[name]);\n if (val !== undefined) {\n instance[name] = val;\n }\n }\n return instance;\n } else if (schema.type === 'array') {\n return [];\n }\n return undefined;\n};\n\n// remove all defaults from an instance\nschemautil.subtract = function(instance, defaults) {\n var changes = {};\n for (var prop in instance) {\n var def = defaults[prop];\n var ins = instance[prop];\n // Note: does not properly subtract arrays\n if (!defaults || def !== ins) {\n if (typeof ins === 'object' && !util.isArray(ins) && def) {\n var c = schemautil.subtract(ins, def);\n if (!isEmpty(c))\n changes[prop] = c;\n } else if (!util.isArray(ins) || ins.length > 0) {\n changes[prop] = ins;\n }\n }\n }\n return changes;\n};\n\nschemautil.merge = function(/*dest*, src0, src1, ...*/){\n var dest = arguments[0];\n for (var i=1 ; i 180 || delta < -180\n ? delta - 360 * Math.round(delta / 360)\n : delta;\n }\n\n function Color() {}var reHex3 = /^#([0-9a-f]{3})$/;\n var reHex6 = /^#([0-9a-f]{6})$/;\n var reRgbInteger = /^rgb\\(\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*\\)$/;\n var reRgbPercent = /^rgb\\(\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var reHslPercent = /^hsl\\(\\s*([-+]?\\d+(?:\\.\\d+)?)\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n color.prototype = Color.prototype = {\n displayable: function() {\n return this.rgb().displayable();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n };\n\n function color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf))) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\n : (m = reRgbInteger.exec(format)) ? rgb(m[1], m[2], m[3]) // rgb(255,0,0)\n : (m = reRgbPercent.exec(format)) ? rgb(m[1] * 2.55, m[2] * 2.55, m[3] * 2.55) // rgb(100%,0%,0%)\n : (m = reHslPercent.exec(format)) ? hsl(m[1], m[2] * .01, m[3] * .01) // hsl(120,50%,50%)\n : named.hasOwnProperty(format) ? rgbn(named[format])\n : null;\n }function rgbn(n) {\n return rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff);\n }\n\n var named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n };\n\n var darker = .7;\n var brighter = 1 / darker;\n\n function rgb(r, g, b) {\n if (arguments.length === 1) {\n if (!(r instanceof Color)) r = color(r);\n if (r) {\n r = r.rgb();\n b = r.b;\n g = r.g;\n r = r.r;\n } else {\n r = g = b = NaN;\n }\n }\n return new Rgb(r, g, b);\n }function Rgb(r, g, b) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n }var ____prototype = rgb.prototype = Rgb.prototype = new Color;\n\n ____prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.rgb = function() {\n return this;\n };\n\n ____prototype.displayable = function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255);\n };\n\n ____prototype.toString = function() {\n return _format(this.r, this.g, this.b);\n };\n\n function _format(r, g, b) {\n return \"#\"\n + (isNaN(r) ? \"00\" : (r = Math.round(r)) < 16 ? \"0\" + Math.max(0, r).toString(16) : Math.min(255, r).toString(16))\n + (isNaN(g) ? \"00\" : (g = Math.round(g)) < 16 ? \"0\" + Math.max(0, g).toString(16) : Math.min(255, g).toString(16))\n + (isNaN(b) ? \"00\" : (b = Math.round(b)) < 16 ? \"0\" + Math.max(0, b).toString(16) : Math.min(255, b).toString(16));\n }\n\n function hsl(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Hsl) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Color)) h = color(h);\n if (h) {\n if (h instanceof Hsl) return h;\n h = h.rgb();\n var r = h.r / 255,\n g = h.g / 255,\n b = h.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n range = max - min;\n l = (max + min) / 2;\n if (range) {\n s = l < .5 ? range / (max + min) : range / (2 - max - min);\n if (r === max) h = (g - b) / range + (g < b) * 6;\n else if (g === max) h = (b - r) / range + 2;\n else h = (r - g) / range + 4;\n h *= 60;\n } else {\n h = NaN;\n s = l > 0 && l < 1 ? 0 : h;\n }\n } else {\n h = s = l = NaN;\n }\n }\n }\n return new Hsl(h, s, l);\n }function Hsl(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var ___prototype = hsl.prototype = Hsl.prototype = new Color;\n\n ___prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.rgb = function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < .5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2)\n );\n };\n\n ___prototype.displayable = function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1);\n };\n\n /* From FvD 13.37, CSS Color Module Level 3 */\n function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n }\n\n var Kn = 18;\n\n var Xn = 0.950470;\n var Yn = 1;\n var Zn = 1.088830;\n var t0 = 4 / 29;\n var t1 = 6 / 29;\n var t2 = 3 * t1 * t1;\n var t3 = t1 * t1 * t1;\n function lab(l, a, b) {\n if (arguments.length === 1) {\n if (l instanceof Lab) {\n b = l.b;\n a = l.a;\n l = l.l;\n } else if (l instanceof Hcl) {\n var h = l.h * deg2rad;\n b = Math.sin(h) * l.c;\n a = Math.cos(h) * l.c;\n l = l.l;\n } else {\n if (!(l instanceof Rgb)) l = rgb(l);\n var r = rgb2xyz(l.r),\n g = rgb2xyz(l.g),\n b = rgb2xyz(l.b),\n x = xyz2lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / Xn),\n y = xyz2lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Yn),\n z = xyz2lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Zn);\n b = 200 * (y - z);\n a = 500 * (x - y);\n l = 116 * y - 16;\n }\n }\n return new Lab(l, a, b);\n }function Lab(l, a, b) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n }var __prototype = lab.prototype = Lab.prototype = new Color;\n\n __prototype.brighter = function(k) {\n return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.darker = function(k) {\n return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.rgb = function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Rgb(\n xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)\n );\n };\n\n function xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n }\n\n function lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n }\n\n function xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n }\n\n function rgb2xyz(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n }\n\n var deg2rad = Math.PI / 180;\n var rad2deg = 180 / Math.PI;\n\n function hcl(h, c, l) {\n if (arguments.length === 1) {\n if (h instanceof Hcl) {\n l = h.l;\n c = h.c;\n h = h.h;\n } else {\n if (!(h instanceof Lab)) h = lab(h);\n l = h.l;\n c = Math.sqrt(h.a * h.a + h.b * h.b);\n h = Math.atan2(h.b, h.a) * rad2deg;\n if (h < 0) h += 360;\n }\n }\n return new Hcl(h, c, l);\n }function Hcl(h, c, l) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n }var _prototype = hcl.prototype = Hcl.prototype = new Color;\n\n _prototype.brighter = function(k) {\n return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k));\n };\n\n _prototype.darker = function(k) {\n return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k));\n };\n\n _prototype.rgb = function() {\n return lab(this).rgb();\n };\n\n var A = -0.14861;\n var B = +1.78277;\n var C = -0.29227;\n var D = -0.90649;\n var E = +1.97294;\n var ED = E * D;\n var EB = E * B;\n var BC_DA = B * C - D * A;\n function cubehelix(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Cubehelix) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Rgb)) h = rgb(h);\n var r = h.r / 255, g = h.g / 255, b = h.b / 255;\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB);\n var bl = b - l, k = (E * (g - l) - C * bl) / D;\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)); // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n if (h < 0) h += 360;\n }\n }\n return new Cubehelix(h, s, l);\n }function Cubehelix(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var prototype = cubehelix.prototype = Cubehelix.prototype = new Color;\n\n prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.rgb = function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh))\n );\n };\n\n function interpolateCubehelixGamma(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateCubehelixGammaLong(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateHclLong(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHcl(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateLab(a, b) {\n a = lab(a);\n b = lab(b);\n var al = a.l,\n aa = a.a,\n ab = a.b,\n bl = b.l - al,\n ba = b.a - aa,\n bb = b.b - ab;\n return function(t) {\n a.l = al + bl * t;\n a.a = aa + ba * t;\n a.b = ab + bb * t;\n return a + \"\";\n };\n }\n\n function interpolateHslLong(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHsl(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateRgb(a, b) {\n a = rgb(a);\n b = rgb(b);\n var ar = a.r,\n ag = a.g,\n ab = a.b,\n br = b.r - ar,\n bg = b.g - ag,\n bb = b.b - ab;\n return function(t) {\n return _format(Math.round(ar + br * t), Math.round(ag + bg * t), Math.round(ab + bb * t));\n };\n }\n\n var interpolateCubehelix = interpolateCubehelixGamma(1);\n var interpolateCubehelixLong = interpolateCubehelixGammaLong(1);\n\n exports.interpolateCubehelix = interpolateCubehelix;\n exports.interpolateCubehelixLong = interpolateCubehelixLong;\n exports.color = color;\n exports.rgb = rgb;\n exports.hsl = hsl;\n exports.lab = lab;\n exports.hcl = hcl;\n exports.cubehelix = cubehelix;\n exports.interpolateRgb = interpolateRgb;\n exports.interpolateHsl = interpolateHsl;\n exports.interpolateHslLong = interpolateHslLong;\n exports.interpolateLab = interpolateLab;\n exports.interpolateHcl = interpolateHcl;\n exports.interpolateHclLong = interpolateHclLong;\n exports.interpolateCubehelixGamma = interpolateCubehelixGamma;\n exports.interpolateCubehelixGammaLong = interpolateCubehelixGammaLong;\n\n}));","if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.format = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"¥\", \"\"]\n };\n\n var ruRu = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0руб.\"]\n };\n\n var ptBr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"R$\", \"\"]\n };\n\n var plPl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"zł\"]\n };\n\n var nlNl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\\xa0\", \"\"]\n };\n\n var mkMk = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0ден.\"]\n };\n\n var jaJp = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"\", \"円\"]\n };\n\n var itIt = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\", \"\"]\n };\n\n var heIl = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"₪\", \"\"]\n };\n\n var frFr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var frCa = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"$\"]\n };\n\n var fiFi = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var esEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var enUs = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var enGb = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"£\", \"\"]\n };\n\n var enCa = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var deDe = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var caEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n\n // Computes the decimal coefficient and exponent of the specified number x with\n // significant digits p, where x is positive and p is in [1, 21] or undefined.\n // For example, formatDecimal(1.23) returns [\"123\", 0].\n function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n\n function exponent(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n }\n\n var prefixExponent;\n\n function formatPrefixAuto(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, p + i - 1)[0]; // less than 1y!\n }\n\n function formatRounded(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n }\n\n function formatDefault(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n }\n\n var formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n };\n\n\n // [[fill]align][sign][symbol][0][width][,][.precision][type]\n var re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\n function formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n }\n\n function FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n }\n\n FormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n };\n\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n }\n\n var prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\n function identity(x) {\n return x;\n }\n\n function locale(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal;\n\n function format(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? \"%\" : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n return function(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Convert negative to positive, and compute the prefix.\n // Note that -0 is not less than 0, but 1 / -0 is!\n var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);\n\n // Perform the initial formatting.\n value = formatType(value, precision);\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n var i = -1, n = value.length, c;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": return valuePrefix + value + valueSuffix + padding;\n case \"=\": return valuePrefix + padding + value + valueSuffix;\n case \"^\": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n }\n return padding + valuePrefix + value + valueSuffix;\n };\n }\n\n function formatPrefix(specifier, value) {\n var f = format((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: format,\n formatPrefix: formatPrefix\n };\n }\n\n function precisionRound(step, max) {\n return Math.max(0, exponent(Math.abs(max)) - exponent(Math.abs(step))) + 1;\n }\n\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.formatPrefix = defaultLocale.formatPrefix;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.formatSpecifier = formatSpecifier;\n exports.precisionFixed = precisionFixed;\n exports.precisionPrefix = precisionPrefix;\n exports.precisionRound = precisionRound;\n\n}));","if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.dsv = {}));\n}(this, function (exports) { 'use strict';\n\n var dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n]\"),\n delimiterCode = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var o;\n return parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = new Function(\"d\", \"return {\" + row.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n o = f ? function(row, i) { return f(a(row), i); } : a;\n });\n }\n\n function parseRows(text, f) {\n var EOL = {}, // sentinel value for end-of-line\n EOF = {}, // sentinel value for end-of-file\n rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // the current line number\n t, // the current token\n eol; // is the current token followed by EOL?\n\n function token() {\n if (I >= N) return EOF; // special case: end of file\n if (eol) return eol = false, EOL; // special case: end of line\n\n // special case: quotes\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case: find next delimiter or newline\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true; // \\n\n else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \\r|\\r\\n\n else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n\n // special case: last token before EOF\n return text.slice(j);\n }\n\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n\n return rows;\n }\n\n function format(rows) {\n if (Array.isArray(rows[0])) return formatRows(rows); // deprecated; use formatRows\n var fieldSet = Object.create(null), fields = [];\n\n // Compute unique fields in order of discovery.\n rows.forEach(function(row) {\n for (var field in row) {\n if (!((field += \"\") in fieldSet)) {\n fields.push(fieldSet[field] = field);\n }\n }\n });\n\n return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return reFormat.test(text) ? \"\\\"\" + text.replace(/\\\"/g, \"\\\"\\\"\") + \"\\\"\" : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n }\n\n exports.csv = dsv(\",\");\n exports.tsv = dsv(\"\\t\");\n\n exports.dsv = dsv;\n\n}));","if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var jaJp = {\n dateTime: \"%Y %b %e %a %X\",\n date: \"%Y/%m/%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\n shortDays: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"],\n months: [\"睦月\", \"如月\", \"弥生\", \"卯月\", \"皐月\", \"水無月\", \"文月\", \"葉月\", \"長月\", \"神無月\", \"霜月\", \"師走\"],\n shortMonths: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.time = {}));\n}(this, function (exports) { 'use strict';\n\n var t1 = new Date;\n\n var t0 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var second = newInterval(function(date) {\n date.setMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.seconds = second.range;\n\n var minute = newInterval(function(date) {\n date.setSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.minutes = minute.range;\n\n var hour = newInterval(function(date) {\n date.setMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.hours = hour.range;\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n exports.days = day.range;\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n exports.sunday = weekday(0);\n\n exports.sundays = exports.sunday.range;\n\n exports.monday = weekday(1);\n\n exports.mondays = exports.monday.range;\n\n exports.tuesday = weekday(2);\n\n exports.tuesdays = exports.tuesday.range;\n\n exports.wednesday = weekday(3);\n\n exports.wednesdays = exports.wednesday.range;\n\n exports.thursday = weekday(4);\n\n exports.thursdays = exports.thursday.range;\n\n exports.friday = weekday(5);\n\n exports.fridays = exports.friday.range;\n\n exports.saturday = weekday(6);\n\n exports.saturdays = exports.saturday.range;\n\n var week = exports.sunday;\n\n exports.weeks = week.range;\n\n var month = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n });\n\n exports.months = month.range;\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n exports.years = year.range;\n\n var utcSecond = newInterval(function(date) {\n date.setUTCMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.utcSeconds = utcSecond.range;\n\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.utcMinutes = utcMinute.range;\n\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.utcHours = utcHour.range;\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n exports.utcDays = utcDay.range;\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n exports.utcSunday = utcWeekday(0);\n\n exports.utcSundays = exports.utcSunday.range;\n\n exports.utcMonday = utcWeekday(1);\n\n exports.utcMondays = exports.utcMonday.range;\n\n exports.utcTuesday = utcWeekday(2);\n\n exports.utcTuesdays = exports.utcTuesday.range;\n\n exports.utcWednesday = utcWeekday(3);\n\n exports.utcWednesdays = exports.utcWednesday.range;\n\n exports.utcThursday = utcWeekday(4);\n\n exports.utcThursdays = exports.utcThursday.range;\n\n exports.utcFriday = utcWeekday(5);\n\n exports.utcFridays = exports.utcFriday.range;\n\n exports.utcSaturday = utcWeekday(6);\n\n exports.utcSaturdays = exports.utcSaturday.range;\n\n var utcWeek = exports.utcSunday;\n\n exports.utcWeeks = utcWeek.range;\n\n var utcMonth = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(1);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n });\n\n exports.utcMonths = utcMonth.range;\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n exports.utcYears = utcYear.range;\n\n exports.interval = newInterval;\n exports.second = second;\n exports.minute = minute;\n exports.hour = hour;\n exports.day = day;\n exports.week = week;\n exports.month = month;\n exports.year = year;\n exports.utcSecond = utcSecond;\n exports.utcMinute = utcMinute;\n exports.utcHour = utcHour;\n exports.utcDay = utcDay;\n exports.utcWeek = utcWeek;\n exports.utcMonth = utcMonth;\n exports.utcYear = utcYear;\n\n}));","var util = require('../util'),\n Measures = require('./measures'),\n Collector = require('./collector');\n\nfunction Aggregator() {\n this._cells = {};\n this._aggr = [];\n this._stream = false;\n}\n\nvar Flags = Aggregator.Flags = {\n ADD_CELL: 1,\n MOD_CELL: 2\n};\n\nvar proto = Aggregator.prototype;\n\n// Parameters\n\nproto.stream = function(v) {\n if (v == null) return this._stream;\n this._stream = !!v;\n this._aggr = [];\n return this;\n};\n\n// key accessor to use for streaming removes\nproto.key = function(key) {\n if (key == null) return this._key;\n this._key = util.$(key);\n return this;\n};\n\n// Input: array of objects of the form\n// {name: string, get: function}\nproto.groupby = function(dims) {\n this._dims = util.array(dims).map(function(d, i) {\n d = util.isString(d) ? {name: d, get: util.$(d)}\n : util.isFunction(d) ? {name: util.name(d) || d.name || ('_' + i), get: d}\n : (d.name && util.isFunction(d.get)) ? d : null;\n if (d == null) throw 'Invalid groupby argument: ' + d;\n return d;\n });\n return this.clear();\n};\n\n// Input: array of objects of the form\n// {name: string, ops: [string, ...]}\nproto.summarize = function(fields) {\n fields = summarize_args(fields);\n this._count = true;\n var aggr = (this._aggr = []),\n m, f, i, j, op, as, get;\n\n for (i=0; i 0) {\n // consolidate collector values\n if (cell.collect) {\n cell.data.values();\n }\n // update tuple properties\n for (i=0; i 0) {\n m[a[i]] -= 1;\n } else {\n x[j++] = a[i];\n }\n }\n } else if (k) {\n // has unique key field, so use that\n m = util.toMap(r, k);\n for (i=0, j=0, n=a.length; i 1 ? this.dev / (this.valid-1) : 0',\n req: ['mean'], idx: 1\n }),\n 'variancep': measure({\n name: 'variancep',\n set: 'this.valid > 1 ? this.dev / this.valid : 0',\n req: ['variance'], idx: 2\n }),\n 'stdev': measure({\n name: 'stdev',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0',\n req: ['variance'], idx: 2\n }),\n 'stdevp': measure({\n name: 'stdevp',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0',\n req: ['variance'], idx: 2\n }),\n 'median': measure({\n name: 'median',\n set: 'cell.data.q2(this.get)',\n req: ['values'], idx: 3\n }),\n 'q1': measure({\n name: 'q1',\n set: 'cell.data.q1(this.get)',\n req: ['values'], idx: 3\n }),\n 'q3': measure({\n name: 'q3',\n set: 'cell.data.q3(this.get)',\n req: ['values'], idx: 3\n }),\n 'distinct': measure({\n name: 'distinct',\n set: 'this.distinct(cell.data.values(), this.get)',\n req: ['values'], idx: 3\n }),\n 'argmin': measure({\n name: 'argmin',\n add: 'if (v < this.min) this.argmin = t;',\n rem: 'if (v <= this.min) this.argmin = null;',\n set: 'this.argmin = this.argmin || cell.data.argmin(this.get)',\n req: ['min'], str: ['values'], idx: 3\n }),\n 'argmax': measure({\n name: 'argmax',\n add: 'if (v > this.max) this.argmax = t;',\n rem: 'if (v >= this.max) this.argmax = null;',\n set: 'this.argmax = this.argmax || cell.data.argmax(this.get)',\n req: ['max'], str: ['values'], idx: 3\n }),\n 'min': measure({\n name: 'min',\n init: 'this.min = +Infinity;',\n add: 'if (v < this.min) this.min = v;',\n rem: 'if (v <= this.min) this.min = NaN;',\n set: 'this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)',\n str: ['values'], idx: 4\n }),\n 'max': measure({\n name: 'max',\n init: 'this.max = -Infinity;',\n add: 'if (v > this.max) this.max = v;',\n rem: 'if (v >= this.max) this.max = NaN;',\n set: 'this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)',\n str: ['values'], idx: 4\n }),\n 'modeskew': measure({\n name: 'modeskew',\n set: 'this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))',\n req: ['mean', 'stdev', 'median'], idx: 5\n })\n};\n\nfunction measure(base) {\n return function(out) {\n var m = util.extend({init:'', add:'', rem:'', idx:0}, base);\n m.out = out || base.name;\n return m;\n };\n}\n\nfunction resolve(agg, stream) {\n function collect(m, a) {\n function helper(r) { if (!m[r]) collect(m, m[r] = types[r]()); }\n if (a.req) a.req.forEach(helper);\n if (stream && a.str) a.str.forEach(helper);\n return m;\n }\n var map = agg.reduce(\n collect,\n agg.reduce(function(m, a) { return (m[a.name] = a, m); }, {})\n );\n return util.vals(map).sort(function(a, b) { return a.idx - b.idx; });\n}\n\nfunction create(agg, stream, accessor, mutator) {\n var all = resolve(agg, stream),\n ctr = 'this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;',\n add = 'if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;',\n rem = 'if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;',\n set = 'var t = this.tuple; var cell = this.cell;';\n\n all.forEach(function(a) {\n if (a.idx < 0) {\n ctr = a.init + ctr;\n add = a.add + add;\n rem = a.rem + rem;\n } else {\n ctr += a.init;\n add += a.add;\n rem += a.rem;\n }\n });\n agg.slice()\n .sort(function(a, b) { return a.idx - b.idx; })\n .forEach(function(a) {\n set += 'this.assign(t,\\''+a.out+'\\','+a.set+');';\n });\n set += 'return t;';\n\n /* jshint evil: true */\n ctr = Function('cell', 't', ctr);\n ctr.prototype.assign = mutator;\n ctr.prototype.add = Function('t', 'var v = this.get(t);' + add);\n ctr.prototype.rem = Function('t', 'var v = this.get(t);' + rem);\n ctr.prototype.set = Function(set);\n ctr.prototype.get = accessor;\n ctr.prototype.distinct = require('../stats').count.distinct;\n ctr.prototype.isValid = util.isValid;\n ctr.fields = agg.map(util.$('out'));\n return ctr;\n}\n\ntypes.create = create;\nmodule.exports = types;","var util = require('../util'),\n time = require('../time'),\n EPSILON = 1e-15;\n\nfunction bins(opt) {\n if (!opt) { throw Error(\"Missing binning options.\"); }\n\n // determine range\n var maxb = opt.maxbins || 15,\n base = opt.base || 10,\n logb = Math.log(base),\n div = opt.div || [5, 2], \n min = opt.min,\n max = opt.max,\n span = max - min,\n step, level, minstep, precision, v, i, eps;\n\n if (opt.step) {\n // if step size is explicitly given, use that\n step = opt.step;\n } else if (opt.steps) {\n // if provided, limit choice to acceptable step sizes\n step = opt.steps[Math.min(\n opt.steps.length - 1,\n bisect(opt.steps, span/maxb, 0, opt.steps.length)\n )];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = opt.minstep || 0;\n step = Math.max(\n minstep,\n Math.pow(base, Math.round(Math.log(span) / logb) - level)\n );\n \n // increase step size if too many bins\n do { step *= base; } while (Math.ceil(span/step) > maxb);\n\n // decrease step size if allowed\n for (i=0; i= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n precision = v >= 0 ? 0 : ~~(-v / logb) + 1;\n eps = Math.pow(base, -precision - 1);\n min = Math.min(min, Math.floor(min / step + eps) * step);\n max = Math.ceil(max / step) * step;\n\n return {\n start: min,\n stop: max,\n step: step,\n unit: {precision: precision},\n value: value,\n index: index\n };\n}\n\nfunction bisect(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (util.cmp(a[mid], x) < 0) { lo = mid + 1; }\n else { hi = mid; }\n }\n return lo;\n}\n\nfunction value(v) {\n return this.step * Math.floor(v / this.step + EPSILON);\n}\n\nfunction index(v) {\n return Math.floor((v - this.start) / this.step + EPSILON);\n}\n\nfunction date_value(v) {\n return this.unit.date(value.call(this, v));\n}\n\nfunction date_index(v) {\n return index.call(this, this.unit.unit(v));\n}\n\nbins.date = function(opt) {\n if (!opt) { throw Error(\"Missing date binning options.\"); }\n\n // find time step, then bin\n var units = opt.utc ? time.utc : time,\n dmin = opt.min,\n dmax = opt.max,\n maxb = opt.maxbins || 20,\n minb = opt.minbins || 4,\n span = (+dmax) - (+dmin),\n unit = opt.unit ? units[opt.unit] : units.find(span, minb, maxb),\n spec = bins({\n min: unit.min != null ? unit.min : unit.unit(dmin),\n max: unit.max != null ? unit.max : unit.unit(dmax),\n maxbins: maxb,\n minstep: unit.minstep,\n steps: unit.step\n });\n\n spec.unit = unit;\n spec.index = date_index;\n if (!opt.raw) spec.value = date_value;\n return spec;\n};\n\nmodule.exports = bins;\n","var bins = require('./bins'),\n gen = require('../generate'),\n type = require('../import/type'),\n util = require('../util'),\n stats = require('../stats');\n\nvar qtype = {\n 'integer': 1,\n 'number': 1,\n 'date': 1\n};\n\nfunction $bin(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return !b ? (opt.accessor || util.identity) :\n util.$func('bin', b.unit.unit ?\n function(x) { return b.value(b.unit.unit(x)); } :\n function(x) { return b.value(x); }\n )(opt.accessor);\n}\n\nfunction histogram(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return b ?\n numerical(values, opt.accessor, b) :\n categorical(values, opt.accessor, opt && opt.sort);\n}\n\nfunction spec(opt) {\n var t = opt.type, b = null;\n if (t == null || qtype[t]) {\n if (t === 'integer' && opt.minstep == null) opt.minstep = 1;\n b = (t === 'date') ? bins.date(opt) : bins(opt);\n }\n return b;\n}\n\nfunction options() {\n var a = arguments,\n i = 0,\n values = util.isArray(a[i]) ? a[i++] : null,\n f = util.isFunction(a[i]) || util.isString(a[i]) ? util.$(a[i++]) : null,\n opt = util.extend({}, a[i]);\n \n if (values) {\n opt.type = opt.type || type(values, f);\n if (qtype[opt.type]) {\n var ext = stats.extent(values, f);\n opt = util.extend({min: ext[0], max: ext[1]}, opt);\n }\n }\n if (f) { opt.accessor = f; }\n return opt;\n}\n\nfunction numerical(values, f, b) {\n var h = gen.range(b.start, b.stop + b.step/2, b.step)\n .map(function(v) { return {value: b.value(v), count: 0}; });\n\n for (var i=0, v, j; i= h.length || !isFinite(j)) continue;\n h[j].count += 1;\n }\n }\n h.bins = b;\n return h;\n}\n\nfunction categorical(values, f, sort) {\n var u = stats.unique(values, f),\n c = stats.count.map(values, f);\n return u.map(function(k) { return {value: k, count: c[k]}; })\n .sort(util.comparator(sort ? '-count' : '+value'));\n}\n\nmodule.exports = {\n $bin: $bin,\n histogram: histogram\n};","var d3_time = require('d3-time'),\n d3_timeF = require('d3-time-format'),\n d3_numberF = require('d3-format'),\n numberF = d3_numberF, // defaults to EN-US\n timeF = d3_timeF; // defaults to EN-US\n\nfunction numberLocale(l) {\n var f = d3_numberF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n numberF = f;\n}\n\nfunction timeLocale(l) {\n var f = d3_timeF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n timeF = f;\n}\n\nmodule.exports = {\n // Update number formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-format\n numberLocale: numberLocale,\n number: function(f) { return numberF.format(f); },\n numberPrefix: function(f, v) { return numberF.formatPrefix(f, v); },\n\n // Update time formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-time-format\n timeLocale: timeLocale,\n time: function(f) { return timeF.format(f); }, \n utc: function(f) { return timeF.utcFormat(f); },\n\n // Set number and time locale simultaneously.\n locale: function(l) { numberLocale(l); timeLocale(l); },\n\n // automatic formatting functions\n auto: {\n number: numberAutoFormat,\n time: function() { return timeAutoFormat(); },\n utc: function() { return utcAutoFormat(); }\n }\n};\n\nvar e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction intervals(domain, count) {\n if (!domain.length) domain = [0];\n if (count == null) count = 10;\n\n var start = domain[0],\n stop = domain[domain.length - 1];\n\n if (stop < start) { error = stop; stop = start; start = error; }\n\n var span = (stop - start) || (count = 1, start || stop || 1),\n step = Math.pow(10, Math.floor(Math.log(span / count) / Math.LN10)),\n error = span / count / step;\n\n // Filter ticks to get closer to the desired count.\n if (error >= e10) step *= 10;\n else if (error >= e5) step *= 5;\n else if (error >= e2) step *= 2;\n\n // Round start and stop values to step interval.\n return [\n Math.ceil(start / step) * step,\n Math.floor(stop / step) * step + step / 2, // inclusive\n step\n ];\n}\n\nfunction numberAutoFormat(domain, count, f) {\n var range = intervals(domain, count);\n if (f == null) {\n f = ',.' + d3_numberF.precisionFixed(range[2]) + 'f';\n } else {\n switch (f = d3_numberF.formatSpecifier(f), f.type) {\n case 's': {\n var value = Math.max(Math.abs(range[0]), Math.abs(range[1]));\n if (f.precision == null) f.precision = d3_numberF.precisionPrefix(range[2], value);\n return numberF.formatPrefix(f, value);\n }\n case '':\n case 'e':\n case 'g':\n case 'p':\n case 'r': {\n if (f.precision == null) f.precision = d3_numberF.precisionRound(range[2], Math.max(Math.abs(range[0]), Math.abs(range[1]))) - (f.type === 'e');\n break;\n }\n case 'f':\n case '%': {\n if (f.precision == null) f.precision = d3_numberF.precisionFixed(range[2]) - (f.type === '%') * 2;\n break;\n }\n }\n }\n return numberF.format(f);\n}\n\nfunction timeAutoFormat() {\n var f = timeF.format,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.second(date) < d ? formatMillisecond\n : d3_time.minute(date) < d ? formatSecond\n : d3_time.hour(date) < d ? formatMinute\n : d3_time.day(date) < d ? formatHour\n : d3_time.month(date) < d ?\n (d3_time.week(date) < d ? formatDay : formatWeek)\n : d3_time.year(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n\nfunction utcAutoFormat() {\n var f = timeF.utcFormat,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.utcSecond(date) < d ? formatMillisecond\n : d3_time.utcMinute(date) < d ? formatSecond\n : d3_time.utcHour(date) < d ? formatMinute\n : d3_time.utcDay(date) < d ? formatHour\n : d3_time.utcMonth(date) < d ?\n (d3_time.utcWeek(date) < d ? formatDay : formatWeek)\n : d3_time.utcYear(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n","var gen = module.exports = {};\n\ngen.repeat = function(val, n) {\n var a = Array(n), i;\n for (i=0; i stop) range.push(j);\n else while ((j = start + step * ++i) < stop) range.push(j);\n return range;\n};\n\ngen.random = {};\n\ngen.random.uniform = function(min, max) {\n if (max === undefined) {\n max = min === undefined ? 1 : min;\n min = 0;\n }\n var d = max - min;\n var f = function() {\n return min + d * Math.random();\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.integer = function(a, b) {\n if (b === undefined) {\n b = a;\n a = 0;\n }\n var d = b - a;\n var f = function() {\n return a + Math.floor(d * Math.random());\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.normal = function(mean, stdev) {\n mean = mean || 0;\n stdev = stdev || 1;\n var next;\n var f = function() {\n var x = 0, y = 0, rds, c;\n if (next !== undefined) {\n x = next;\n next = undefined;\n return x;\n }\n do {\n x = Math.random()*2-1;\n y = Math.random()*2-1;\n rds = x*x + y*y;\n } while (rds === 0 || rds > 1);\n c = Math.sqrt(-2*Math.log(rds)/rds); // Box-Muller transform\n next = mean + y*c*stdev;\n return mean + x*c*stdev;\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};","var util = require('../../util');\nvar d3_dsv = require('d3-dsv');\n\nfunction dsv(data, format) {\n if (data) {\n var h = format.header;\n data = (h ? h.join(format.delimiter) + '\\n' : '') + data;\n }\n return d3_dsv.dsv(format.delimiter).parse(data);\n}\n\ndsv.delimiter = function(delim) {\n var fmt = {delimiter: delim};\n return function(data, format) {\n return dsv(data, format ? util.extend(format, fmt) : fmt);\n };\n};\n\nmodule.exports = dsv;","var dsv = require('./dsv');\n\nmodule.exports = {\n json: require('./json'),\n topojson: require('./topojson'),\n treejson: require('./treejson'),\n dsv: dsv,\n csv: dsv.delimiter(','),\n tsv: dsv.delimiter('\\t')\n};","var util = require('../../util');\n\nmodule.exports = function(data, format) {\n var d = util.isObject(data) && !util.isBuffer(data) ?\n data : JSON.parse(data);\n if (format && format.property) {\n d = util.accessor(format.property)(d);\n }\n return d;\n};\n","var json = require('./json');\n\nvar reader = function(data, format) {\n var topojson = reader.topojson;\n if (topojson == null) { throw Error('TopoJSON library not loaded.'); }\n\n var t = json(data, format), obj;\n\n if (format && format.feature) {\n if ((obj = t.objects[format.feature])) {\n return topojson.feature(t, obj).features;\n } else {\n throw Error('Invalid TopoJSON object: ' + format.feature);\n }\n } else if (format && format.mesh) {\n if ((obj = t.objects[format.mesh])) {\n return [topojson.mesh(t, t.objects[format.mesh])];\n } else {\n throw Error('Invalid TopoJSON object: ' + format.mesh);\n }\n } else {\n throw Error('Missing TopoJSON feature or mesh parameter.');\n }\n};\n\nreader.topojson = (typeof window !== \"undefined\" ? window['topojson'] : typeof global !== \"undefined\" ? global['topojson'] : null);\nmodule.exports = reader;","var json = require('./json');\n\nmodule.exports = function(data, format) {\n data = json(data, format);\n return toTable(data, (format && format.children));\n};\n\nfunction toTable(root, childrenField) {\n childrenField = childrenField || 'children';\n var table = [];\n \n function visit(node) {\n table.push(node);\n var children = node[childrenField];\n if (children) {\n for (var i=0; i 1 && domain[idx-1] === '.' && domain.lastIndexOf(d) === idx);\n });\n if (!whiteListed) {\n throw 'URL is not whitelisted: ' + url;\n }\n }\n }\n return url;\n}\n\nfunction load(opt, callback) {\n var error = callback || function(e) { throw e; }, url;\n\n try {\n url = load.sanitizeUrl(opt); // enable override\n } catch (err) {\n error(err);\n return;\n }\n\n if (!url) {\n error('Invalid URL: ' + opt.url);\n } else if (load.useXHR) {\n // on client, use xhr\n return xhr(url, callback);\n } else if (startsWith(url, fileProtocol)) {\n // on server, if url starts with 'file://', strip it and load from file\n return file(url.slice(fileProtocol.length), callback);\n } else if (url.indexOf('://') < 0) { // TODO better protocol check?\n // on server, if no protocol assume file\n return file(url, callback);\n } else {\n // for regular URLs on server\n return http(url, callback);\n }\n}\n\nfunction xhrHasResponse(request) {\n var type = request.responseType;\n return type && type !== 'text' ?\n request.response : // null on error\n request.responseText; // '' on error\n}\n\nfunction xhr(url, callback) {\n var async = !!callback;\n var request = new XMLHttpRequest();\n // If IE does not support CORS, use XDomainRequest (copied from d3.xhr)\n if (this.XDomainRequest &&\n !('withCredentials' in request) &&\n /^(http(s)?:)?\\/\\//.test(url)) request = new XDomainRequest();\n\n function respond() {\n var status = request.status;\n if (!status && xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {\n callback(null, request.responseText);\n } else {\n callback(request, null);\n }\n }\n\n if (async) {\n if ('onload' in request) {\n request.onload = request.onerror = respond;\n } else {\n request.onreadystatechange = function() {\n if (request.readyState > 3) respond();\n };\n }\n }\n \n request.open('GET', url, async);\n request.send();\n \n if (!async && xhrHasResponse(request)) {\n return request.responseText;\n }\n}\n\nfunction file(filename, callback) {\n var fs = require('fs');\n if (!callback) {\n return fs.readFileSync(filename, 'utf8');\n }\n fs.readFile(filename, callback);\n}\n\nfunction http(url, callback) {\n if (!callback) {\n return require('sync-request')('GET', url).getBody();\n }\n \n var options = {url: url, encoding: null, gzip: true};\n require('request')(options, function(error, response, body) {\n if (!error && response.statusCode === 200) {\n callback(null, body);\n } else {\n error = error ||\n 'Load failed with response code ' + response.statusCode + '.';\n callback(error, null);\n }\n });\n}\n\nfunction startsWith(string, searchString) {\n return string == null ? false : string.lastIndexOf(searchString, 0) === 0;\n}\n\nload.sanitizeUrl = sanitizeUrl;\n\nload.useXHR = (typeof XMLHttpRequest !== 'undefined');\n\nmodule.exports = load;\n","var util = require('../util');\nvar type = require('./type');\nvar formats = require('./formats');\n\nfunction read(data, format) {\n var type = (format && format.type) || 'json';\n data = formats[type](data, format);\n if (format && format.parse) parse(data, format.parse);\n return data;\n}\n\nfunction parse(data, types) {\n var cols, parsers, d, i, j, clen, len = data.length;\n\n types = (types==='auto') ? type.inferAll(data) : util.duplicate(types);\n cols = util.keys(types);\n parsers = cols.map(function(c) { return type.parsers[types[c]]; });\n\n for (i=0, clen=cols.length; i 0 ? Math.min(l, opt.maxwidth) : l;\n });\n\n // print header row\n var head = fields.map(function(name, i) {\n return util.truncate(util.pad(name, lens[i], 'center'), lens[i]);\n }).join(opt.separator);\n\n // build template function for each row\n var tmpl = template(fields.map(function(name, i) {\n return '{{' +\n name +\n (FMT[types[name]] || '') +\n ('|pad:' + lens[i] + ',' + (POS[types[name]] || 'right')) +\n ('|truncate:' + lens[i]) +\n '}}';\n }).join(opt.separator));\n\n // print table\n return head + \"\\n\" + data.map(tmpl).join('\\n');\n};\n\nmodule.exports.summary = function(s) {\n s = s ? s.__summary__ ? s : stats.summary(s) : this;\n var str = [], i, n;\n for (i=0, n=s.length; i b) b = v;\n }\n }\n return [a, b];\n};\n\n// Find the integer indices of the minimum and maximum values.\nstats.extent.index = function(values, f) {\n f = util.$(f);\n var x = -1, y = -1, a, b, v, i, n = values.length;\n for (i=0; i b) { b = v; y = i; }\n }\n }\n return [x, y];\n};\n\n// Compute the dot product of two arrays of numbers.\nstats.dot = function(values, a, b) {\n var sum = 0, i, v;\n if (!b) {\n if (values.length !== a.length) {\n throw Error('Array lengths must match.');\n }\n for (i=0; i -1 && p !== v) {\n mu = 1 + (i-1 + tie) / 2;\n for (; tie -1) {\n mu = 1 + (n-1 + tie) / 2;\n for (; tie max) max = x;\n delta = x - mean;\n mean = mean + delta / (++valid);\n M2 = M2 + delta * (x - mean);\n vals.push(x);\n }\n }\n M2 = M2 / (valid - 1);\n sd = Math.sqrt(M2);\n\n // sort values for median and iqr\n vals.sort(util.cmp);\n\n return {\n type: type(values, f),\n unique: u,\n count: values.length,\n valid: valid,\n missing: missing,\n distinct: distinct,\n min: min,\n max: max,\n mean: mean,\n stdev: sd,\n median: (v = stats.quantile(vals, 0.5)),\n q1: stats.quantile(vals, 0.25),\n q3: stats.quantile(vals, 0.75),\n modeskew: sd === 0 ? 0 : (mean - v) / sd\n };\n};\n\n// Compute profiles for all variables in a data set.\nstats.summary = function(data, fields) {\n fields = fields || util.keys(data[0]);\n var s = fields.map(function(f) {\n var p = stats.profile(data, util.$(f));\n return (p.field = f, p);\n });\n return (s.__summary__ = true, s);\n};\n\nmodule.exports = stats;","var util = require('./util'),\n format = require('./format');\n\nvar context = {\n formats: [],\n format_map: {},\n truncate: util.truncate,\n pad: util.pad\n};\n\nfunction template(text) {\n var src = source(text, 'd');\n src = 'var __t; return ' + src + ';';\n\n /* jshint evil: true */\n return (new Function('d', src)).bind(context);\n}\n\ntemplate.source = source;\ntemplate.context = context;\nmodule.exports = template;\n\n// Clear cache of format objects.\n// This can *break* prior template functions, so invoke with care!\ntemplate.clearFormatCache = function() {\n context.formats = [];\n context.format_map = {};\n};\n\n// Generate property access code for use within template source.\n// object: the name of the object (variable) containing template data\n// property: the property access string, verbatim from template tag\ntemplate.property = function(object, property) {\n var src = util.field(property).map(util.str).join('][');\n return object + '[' + src + ']';\n};\n\n// Generate source code for a template function.\n// text: the template text\n// variable: the name of the data object variable ('obj' by default)\n// properties: optional hash for collecting all accessed properties\nfunction source(text, variable, properties) {\n variable = variable || 'obj';\n var index = 0;\n var src = '\\'';\n var regex = template_re;\n\n // Compile the template source, escaping string literals appropriately.\n text.replace(regex, function(match, interpolate, offset) {\n src += text\n .slice(index, offset)\n .replace(template_escaper, template_escapeChar);\n index = offset + match.length;\n\n if (interpolate) {\n src += '\\'\\n+((__t=(' +\n template_var(interpolate, variable, properties) +\n '))==null?\\'\\':__t)+\\n\\'';\n }\n\n // Adobe VMs need the match returned to produce the correct offest.\n return match;\n });\n return src + '\\'';\n}\n\nfunction template_var(text, variable, properties) {\n var filters = text.match(filter_re);\n var prop = filters.shift().trim();\n var stringCast = true;\n\n function strcall(fn) {\n fn = fn || '';\n if (stringCast) {\n stringCast = false;\n src = 'String(' + src + ')' + fn;\n } else {\n src += fn;\n }\n return src;\n }\n\n function date() {\n return '(typeof ' + src + '===\"number\"?new Date('+src+'):'+src+')';\n }\n\n function number_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+src+')';\n }\n \n function time_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+date()+')';\n }\n\n if (properties) properties[prop] = 1;\n var src = template.property(variable, prop);\n\n for (var i=0; i 0) {\n f = f.slice(0, pidx);\n args = filters[i].slice(pidx+1)\n .match(args_re)\n .map(function(s) { return s.trim(); });\n }\n f = f.trim();\n\n switch (f) {\n case 'length':\n strcall('.length');\n break;\n case 'lower':\n strcall('.toLowerCase()');\n break;\n case 'upper':\n strcall('.toUpperCase()');\n break;\n case 'lower-locale':\n strcall('.toLocaleLowerCase()');\n break;\n case 'upper-locale':\n strcall('.toLocaleUpperCase()');\n break;\n case 'trim':\n strcall('.trim()');\n break;\n case 'left':\n a = util.number(args[0]);\n strcall('.slice(0,' + a + ')');\n break;\n case 'right':\n a = util.number(args[0]);\n strcall('.slice(-' + a +')');\n break;\n case 'mid':\n a = util.number(args[0]);\n b = a + util.number(args[1]);\n strcall('.slice(+'+a+','+b+')');\n break;\n case 'slice':\n a = util.number(args[0]);\n strcall('.slice('+ a +\n (args.length > 1 ? ',' + util.number(args[1]) : '') +\n ')');\n break;\n case 'truncate':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.truncate(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'pad':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.pad(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'number':\n number_format(format.number, 'number');\n break;\n case 'time':\n time_format(format.time, 'time');\n break;\n case 'time-utc':\n time_format(format.utc, 'time-utc');\n break;\n default:\n throw Error('Unrecognized template filter: ' + f);\n }\n }\n\n return src;\n}\n\nvar template_re = /\\{\\{(.+?)\\}\\}|$/g,\n filter_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^\\|\"]+|[^\\|\\']+)+/g,\n args_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^,\"]+|[^,\\']+)+/g;\n\n// Certain characters need to be escaped so that they can be put into a\n// string literal.\nvar template_escapes = {\n '\\'': '\\'',\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\nvar template_escaper = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\nfunction template_escapeChar(match) {\n return '\\\\' + template_escapes[match];\n}\n\nfunction template_format(pattern, key, fmt) {\n if ((pattern[0] === '\\'' && pattern[pattern.length-1] === '\\'') ||\n (pattern[0] === '\"' && pattern[pattern.length-1] === '\"')) {\n pattern = pattern.slice(1, -1);\n } else {\n throw Error('Format pattern must be quoted: ' + pattern);\n }\n key = key + ':' + pattern;\n if (!context.format_map[key]) {\n var f = fmt(pattern);\n var i = context.formats.length;\n context.formats.push(f);\n context.format_map[key] = i;\n }\n return context.format_map[key];\n}\n","var d3_time = require('d3-time');\n\nvar tempDate = new Date(),\n baseDate = new Date(0, 0, 1).setFullYear(0), // Jan 1, 0 AD\n utcBaseDate = new Date(Date.UTC(0, 0, 1)).setUTCFullYear(0);\n\nfunction date(d) {\n return (tempDate.setTime(+d), tempDate);\n}\n\n// create a time unit entry\nfunction entry(type, date, unit, step, min, max) {\n var e = {\n type: type,\n date: date,\n unit: unit\n };\n if (step) {\n e.step = step;\n } else {\n e.minstep = 1;\n }\n if (min != null) e.min = min;\n if (max != null) e.max = max;\n return e;\n}\n\nfunction create(type, unit, base, step, min, max) {\n return entry(type,\n function(d) { return unit.offset(base, d); },\n function(d) { return unit.count(base, d); },\n step, min, max);\n}\n\nvar locale = [\n create('second', d3_time.second, baseDate),\n create('minute', d3_time.minute, baseDate),\n create('hour', d3_time.hour, baseDate),\n create('day', d3_time.day, baseDate, [1, 7]),\n create('month', d3_time.month, baseDate, [1, 3, 6]),\n create('year', d3_time.year, baseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(1970, 0, 1, 0, 0, d); },\n function(d) { return date(d).getSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(1970, 0, 1, 0, d); },\n function(d) { return date(d).getMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(1970, 0, 1, d); },\n function(d) { return date(d).getHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(1970, 0, 4+d); },\n function(d) { return date(d).getDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(1970, 0, d); },\n function(d) { return date(d).getDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(1970, d % 12, 1); },\n function(d) { return date(d).getMonth(); },\n [1], 0, 11\n )\n];\n\nvar utc = [\n create('second', d3_time.utcSecond, utcBaseDate),\n create('minute', d3_time.utcMinute, utcBaseDate),\n create('hour', d3_time.utcHour, utcBaseDate),\n create('day', d3_time.utcDay, utcBaseDate, [1, 7]),\n create('month', d3_time.utcMonth, utcBaseDate, [1, 3, 6]),\n create('year', d3_time.utcYear, utcBaseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, 0, d)); },\n function(d) { return date(d).getUTCSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, d)); },\n function(d) { return date(d).getUTCMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(Date.UTC(1970, 0, 1, d)); },\n function(d) { return date(d).getUTCHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(Date.UTC(1970, 0, 4+d)); },\n function(d) { return date(d).getUTCDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(Date.UTC(1970, 0, d)); },\n function(d) { return date(d).getUTCDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(Date.UTC(1970, d % 12, 1)); },\n function(d) { return date(d).getUTCMonth(); },\n [1], 0, 11\n )\n];\n\nvar STEPS = [\n [31536e6, 5], // 1-year\n [7776e6, 4], // 3-month\n [2592e6, 4], // 1-month\n [12096e5, 3], // 2-week\n [6048e5, 3], // 1-week\n [1728e5, 3], // 2-day\n [864e5, 3], // 1-day\n [432e5, 2], // 12-hour\n [216e5, 2], // 6-hour\n [108e5, 2], // 3-hour\n [36e5, 2], // 1-hour\n [18e5, 1], // 30-minute\n [9e5, 1], // 15-minute\n [3e5, 1], // 5-minute\n [6e4, 1], // 1-minute\n [3e4, 0], // 30-second\n [15e3, 0], // 15-second\n [5e3, 0], // 5-second\n [1e3, 0] // 1-second\n];\n\nfunction find(units, span, minb, maxb) {\n var step = STEPS[0], i, n, bins;\n\n for (i=1, n=STEPS.length; i step[0]) {\n bins = span / step[0];\n if (bins > maxb) {\n return units[STEPS[i-1][1]];\n }\n if (bins >= minb) {\n return units[step[1]];\n }\n }\n }\n return units[STEPS[n-1][1]];\n}\n\nfunction toUnitMap(units) {\n var map = {}, i, n;\n for (i=0, n=units.length; i 1 ?\n function(x) { return s.reduce(function(x,f) { return x[f]; }, x); } :\n function(x) { return x[f]; }\n );\n};\n\n// short-cut for accessor\nu.$ = u.accessor;\n\nu.mutator = function(f) {\n var s;\n return u.isString(f) && (s=u.field(f)).length > 1 ?\n function(x, v) {\n for (var i=0; i y) return sign[i];\n }\n return 0;\n };\n};\n\nu.cmp = function(a, b) {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else if (a >= b) {\n return 0;\n } else if (a === null) {\n return -1;\n } else if (b === null) {\n return 1;\n }\n return NaN;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i 1) {\n for (var i=1, n=ref.length; i 0) {\n node = pq.peek();\n pulse = pulses[node._id];\n\n if (node.rank() !== node.qrank()) {\n // A node's rank might change during a propagation. Re-queue if so.\n pq.replace(node.qrank(true));\n } else {\n // Evaluate node and propagate pulse.\n pq.pop();\n pulses[node._id] = null;\n listeners = node._listeners;\n pulse = this.evaluate(pulse, node);\n\n // Propagate the pulse. \n if (pulse !== this.doNotPropagate) {\n // Ensure reflow pulses always send reflow pulses even if skipped.\n if (!pulse.reflow && node.reflows()) {\n pulse = ChangeSet.create(pulse, true);\n }\n\n for (i=0, len=listeners.length; i 0) branch[i-1].addListener(node);\n }\n\n return branch;\n};\n\nprototype.disconnect = function(branch) {\n var collector, node, data, signals, i, n, j, m;\n\n for (i=0, n=branch.length; i= pulse.stamp,\n run = node.router() || pulse.add.length || pulse.rem.length;\n\n return run || !reflowed || node.reevaluate(pulse);\n};\n\nprototype.evaluate = function(pulse, node) {\n if (!this.reevaluate(pulse, node)) return pulse;\n pulse = node.evaluate(pulse);\n node.last(pulse.stamp);\n return pulse;\n};\n\nmodule.exports = Graph;\n","function Heap(comparator) {\n this.cmp = comparator;\n this.nodes = [];\n}\n\nvar prototype = Heap.prototype;\n\nprototype.size = function() {\n return this.nodes.length;\n};\n\nprototype.clear = function() {\n return (this.nodes = [], this);\n};\n\nprototype.peek = function() {\n return this.nodes[0];\n};\n\nprototype.push = function(x) {\n var array = this.nodes;\n array.push(x);\n return _siftdown(array, 0, array.length-1, this.cmp);\n};\n\nprototype.pop = function() {\n var array = this.nodes,\n last = array.pop(),\n item;\n\n if (array.length) {\n item = array[0];\n array[0] = last;\n _siftup(array, 0, this.cmp);\n } else {\n item = last;\n }\n return item;\n};\n\nprototype.replace = function(item) {\n var array = this.nodes,\n retval = array[0];\n array[0] = item;\n _siftup(array, 0, this.cmp);\n return retval;\n};\n\nprototype.pushpop = function(item) {\n var array = this.nodes, ref = array[0];\n if (array.length && this.cmp(ref, item) < 0) {\n array[0] = item;\n item = ref;\n _siftup(array, 0, this.cmp);\n }\n return item;\n};\n\nfunction _siftdown(array, start, idx, cmp) {\n var item, parent, pidx;\n\n item = array[idx];\n while (idx > start) {\n pidx = (idx - 1) >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return (array[idx] = item);\n}\n\nfunction _siftup(array, idx, cmp) {\n var start = idx,\n end = array.length,\n item = array[idx],\n cidx = 2 * idx + 1, ridx;\n\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = 2 * idx + 1;\n }\n array[idx] = item;\n return _siftdown(array, start, idx, cmp);\n}\n\nmodule.exports = Heap;\n","var DEPS = require('./Dependencies').ALL,\n nodeID = 0;\n\nfunction Node(graph) {\n if (graph) this.init(graph);\n}\n\nvar Flags = Node.Flags = {\n Router: 0x01, // Responsible for propagating tuples, cannot be skipped.\n Collector: 0x02, // Holds a materialized dataset, pulse node to reflow.\n Produces: 0x04, // Produces new tuples. \n Mutates: 0x08, // Sets properties of incoming tuples.\n Reflows: 0x10, // Forwards a reflow pulse.\n Batch: 0x20 // Performs batch data processing, needs collector.\n};\n\nvar prototype = Node.prototype;\n\nprototype.init = function(graph) {\n this._id = ++nodeID;\n this._graph = graph;\n this._rank = graph.rank(); // Topological sort by rank\n this._qrank = null; // Rank when enqueued for propagation\n this._stamp = 0; // Last stamp seen\n\n this._listeners = [];\n this._listeners._ids = {}; // To prevent duplicate listeners\n\n // Initialize dependencies.\n this._deps = {};\n for (var i=0, n=DEPS.length; i l._rank) {\n var q = [l],\n g = this._graph, cur;\n while (q.length) {\n cur = q.shift();\n cur._rank = g.rank();\n q.unshift.apply(q, cur.listeners());\n }\n }\n\n return this;\n};\n\nprototype.removeListener = function(l) {\n if (!this._listeners._ids[l._id]) return false;\n \n var idx = this._listeners.indexOf(l),\n b = idx >= 0;\n\n if (b) {\n this._listeners.splice(idx, 1);\n this._listeners._ids[l._id] = null;\n }\n return b;\n};\n\nprototype.disconnect = function() {\n this._listeners = [];\n this._listeners._ids = {};\n};\n\n// Evaluate this dataflow node for the current pulse.\n// Subclasses should override to perform custom processing.\nprototype.evaluate = function(pulse) {\n return pulse;\n};\n\n// Should this node be re-evaluated for the current pulse?\n// Searches pulse to see if any dependencies have updated.\nprototype.reevaluate = function(pulse) {\n var prop, dep, i, n, j, m;\n\n for (i=0, n=DEPS.length; i=0;) {\n if (!handler || h[i].handler === handler) {\n x = h.splice(i, 1)[0];\n this.removeListener(x.node);\n }\n }\n\n return this;\n};\n\nmodule.exports = Signal;\n","var tupleID = 0;\n\nfunction ingest(datum) {\n datum = (datum === Object(datum)) ? datum : {data: datum};\n datum._id = ++tupleID;\n if (datum._prev) datum._prev = null;\n return datum;\n}\n\nfunction idMap(a, ids) {\n ids = ids || {};\n for (var i=0, n=a.length; i0;) {\n idMap(arguments[i], ids);\n }\n return data.filter(function(x) { return !ids[x._id]; });\n }\n};\n","module.exports = {\n ChangeSet: require('./ChangeSet'),\n Collector: require('./Collector'),\n DataSource: require('./DataSource'),\n Dependencies: require('./Dependencies'),\n Graph: require('./Graph'),\n Node: require('./Node'),\n Signal: require('./Signal'),\n Tuple: require('./Tuple'),\n debug: require('vega-logging').debug\n};\n","function toMap(list) {\n var map = {}, i, n;\n for (i=0, n=list.length; i 0) {\n return id;\n }\n if (constants.hasOwnProperty(id)) {\n return constants[id];\n }\n if (idWhiteList) {\n if (idWhiteList.hasOwnProperty(id)) {\n return id;\n } else {\n globals[id] = 1;\n return lookupGlobal(id);\n }\n }\n if (idBlackList && idBlackList.hasOwnProperty(id)) {\n throw new Error('Illegal identifier: ' + id);\n }\n return id;\n },\n 'Program': function(n) {\n return n.body.map(codegen).join('\\n');\n },\n 'MemberExpression': function(n) {\n var d = !n.computed;\n var o = codegen(n.object);\n if (d) memberDepth += 1;\n var p = codegen(n.property);\n if (o === FIELD_VAR) { fields[p] = 1; } // HACKish...\n if (d) memberDepth -= 1;\n return o + (d ? '.'+p : '['+p+']');\n },\n 'CallExpression': function(n) {\n if (n.callee.type !== 'Identifier') {\n throw new Error('Illegal callee type: ' + n.callee.type);\n }\n var callee = n.callee.name;\n var args = n.arguments;\n var fn = functions.hasOwnProperty(callee) && functions[callee];\n if (!fn) throw new Error('Unrecognized function: ' + callee);\n return fn instanceof Function ?\n fn(args) :\n fn + '(' + args.map(codegen).join(',') + ')';\n },\n 'ArrayExpression': function(n) {\n return '[' + n.elements.map(codegen).join(',') + ']';\n },\n 'BinaryExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'UnaryExpression': function(n) {\n return '(' + n.operator + codegen(n.argument) + ')';\n },\n 'ConditionalExpression': function(n) {\n return '(' + codegen(n.test) +\n '?' + codegen(n.consequent) +\n ':' + codegen(n.alternate) +\n ')';\n },\n 'LogicalExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'ObjectExpression': function(n) {\n return '{' + n.properties.map(codegen).join(',') + '}';\n },\n 'Property': function(n) {\n memberDepth += 1;\n var k = codegen(n.key);\n memberDepth -= 1;\n return k + ':' + codegen(n.value);\n },\n 'ExpressionStatement': function(n) {\n return codegen(n.expression);\n }\n };\n\n codegen_wrap.functions = functions;\n codegen_wrap.constants = constants;\n return codegen_wrap;\n};\n","module.exports = {\n 'NaN': 'NaN',\n 'E': 'Math.E',\n 'LN2': 'Math.LN2',\n 'LN10': 'Math.LN10',\n 'LOG2E': 'Math.LOG2E',\n 'LOG10E': 'Math.LOG10E',\n 'PI': 'Math.PI',\n 'SQRT1_2': 'Math.SQRT1_2',\n 'SQRT2': 'Math.SQRT2'\n};","module.exports = function(codegen) {\n\n function fncall(name, args, cast, type) {\n var obj = codegen(args[0]);\n if (cast) {\n obj = cast + '(' + obj + ')';\n if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';\n }\n return obj + '.' + name + (type < 0 ? '' : type === 0 ?\n '()' :\n '(' + args.slice(1).map(codegen).join(',') + ')');\n }\n\n function fn(name, cast, type) {\n return function(args) {\n return fncall(name, args, cast, type);\n };\n }\n\n var DATE = 'new Date',\n STRING = 'String',\n REGEXP = 'RegExp';\n\n return {\n // MATH functions\n 'isNaN': 'isNaN',\n 'isFinite': 'isFinite',\n 'abs': 'Math.abs',\n 'acos': 'Math.acos',\n 'asin': 'Math.asin',\n 'atan': 'Math.atan',\n 'atan2': 'Math.atan2',\n 'ceil': 'Math.ceil',\n 'cos': 'Math.cos',\n 'exp': 'Math.exp',\n 'floor': 'Math.floor',\n 'log': 'Math.log',\n 'max': 'Math.max',\n 'min': 'Math.min',\n 'pow': 'Math.pow',\n 'random': 'Math.random',\n 'round': 'Math.round',\n 'sin': 'Math.sin',\n 'sqrt': 'Math.sqrt',\n 'tan': 'Math.tan',\n\n 'clamp': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to clamp function.');\n if (args.length > 3)\n throw new Error('Too many arguments to clamp function.');\n var a = args.map(codegen);\n return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))';\n },\n\n // DATE functions\n 'now': 'Date.now',\n 'datetime': DATE,\n 'date': fn('getDate', DATE, 0),\n 'day': fn('getDay', DATE, 0),\n 'year': fn('getFullYear', DATE, 0),\n 'month': fn('getMonth', DATE, 0),\n 'hours': fn('getHours', DATE, 0),\n 'minutes': fn('getMinutes', DATE, 0),\n 'seconds': fn('getSeconds', DATE, 0),\n 'milliseconds': fn('getMilliseconds', DATE, 0),\n 'time': fn('getTime', DATE, 0),\n 'timezoneoffset': fn('getTimezoneOffset', DATE, 0),\n 'utcdate': fn('getUTCDate', DATE, 0),\n 'utcday': fn('getUTCDay', DATE, 0),\n 'utcyear': fn('getUTCFullYear', DATE, 0),\n 'utcmonth': fn('getUTCMonth', DATE, 0),\n 'utchours': fn('getUTCHours', DATE, 0),\n 'utcminutes': fn('getUTCMinutes', DATE, 0),\n 'utcseconds': fn('getUTCSeconds', DATE, 0),\n 'utcmilliseconds': fn('getUTCMilliseconds', DATE, 0),\n\n // shared sequence functions\n 'length': fn('length', null, -1),\n 'indexof': fn('indexOf', null),\n 'lastindexof': fn('lastIndexOf', null),\n\n // STRING functions\n 'parseFloat': 'parseFloat',\n 'parseInt': 'parseInt',\n 'upper': fn('toUpperCase', STRING, 0),\n 'lower': fn('toLowerCase', STRING, 0),\n 'slice': fn('slice', STRING),\n 'substring': fn('substring', STRING),\n\n // REGEXP functions\n 'regexp': REGEXP,\n 'test': fn('test', REGEXP),\n\n // Control Flow functions\n 'if': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to if function.');\n if (args.length > 3)\n throw new Error('Too many arguments to if function.');\n var a = args.map(codegen);\n return a[0]+'?'+a[1]+':'+a[2];\n }\n };\n};","var parser = require('./parser'),\n codegen = require('./codegen');\n \nvar expr = module.exports = {\n parse: function(input, opt) {\n return parser.parse('('+input+')', opt);\n },\n code: function(opt) {\n return codegen(opt);\n },\n compiler: function(args, opt) {\n args = args.slice();\n var generator = codegen(opt),\n len = args.length,\n compile = function(str) {\n var value = generator(expr.parse(str));\n args[len] = '\"use strict\"; return (' + value.code + ');';\n value.fn = Function.apply(null, args);\n return value;\n };\n compile.codegen = generator;\n return compile;\n },\n functions: require('./functions'),\n constants: require('./constants')\n};\n","/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \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*/\n/* istanbul ignore next */\nmodule.exports = (function() {\n 'use strict';\n\n var Token,\n TokenName,\n Syntax,\n PropertyKind,\n Messages,\n Regex,\n source,\n strict,\n index,\n lineNumber,\n lineStart,\n length,\n lookahead,\n state,\n extra;\n\n Token = {\n BooleanLiteral: 1,\n EOF: 2,\n Identifier: 3,\n Keyword: 4,\n NullLiteral: 5,\n NumericLiteral: 6,\n Punctuator: 7,\n StringLiteral: 8,\n RegularExpression: 9\n };\n\n TokenName = {};\n TokenName[Token.BooleanLiteral] = 'Boolean';\n TokenName[Token.EOF] = '';\n TokenName[Token.Identifier] = 'Identifier';\n TokenName[Token.Keyword] = 'Keyword';\n TokenName[Token.NullLiteral] = 'Null';\n TokenName[Token.NumericLiteral] = 'Numeric';\n TokenName[Token.Punctuator] = 'Punctuator';\n TokenName[Token.StringLiteral] = 'String';\n TokenName[Token.RegularExpression] = 'RegularExpression';\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n ArrayExpression: 'ArrayExpression',\n BinaryExpression: 'BinaryExpression',\n CallExpression: 'CallExpression',\n ConditionalExpression: 'ConditionalExpression',\n ExpressionStatement: 'ExpressionStatement',\n Identifier: 'Identifier',\n Literal: 'Literal',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n ObjectExpression: 'ObjectExpression',\n Program: 'Program',\n Property: 'Property',\n UnaryExpression: 'UnaryExpression'\n };\n\n PropertyKind = {\n Data: 1,\n Get: 2,\n Set: 4\n };\n\n // Error messages should be identical to V8.\n Messages = {\n UnexpectedToken: 'Unexpected token %0',\n UnexpectedNumber: 'Unexpected number',\n UnexpectedString: 'Unexpected string',\n UnexpectedIdentifier: 'Unexpected identifier',\n UnexpectedReserved: 'Unexpected reserved word',\n UnexpectedEOS: 'Unexpected end of input',\n NewlineAfterThrow: 'Illegal newline after throw',\n InvalidRegExp: 'Invalid regular expression',\n UnterminatedRegExp: 'Invalid regular expression: missing /',\n InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n NoCatchOrFinally: 'Missing catch or finally after try',\n UnknownLabel: 'Undefined label \\'%0\\'',\n Redeclaration: '%0 \\'%1\\' has already been declared',\n IllegalContinue: 'Illegal continue statement',\n IllegalBreak: 'Illegal break statement',\n IllegalReturn: 'Illegal return statement',\n StrictModeWith: 'Strict mode code may not include a with statement',\n StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',\n AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',\n AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',\n StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n StrictReservedWord: 'Use of future reserved word in strict mode'\n };\n\n // See also tools/generate-unicode-regex.py.\n Regex = {\n NonAsciiIdentifierStart: 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]'),\n NonAsciiIdentifierPart: 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-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\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]')\n };\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\n function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }\n\n function isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n }\n\n function isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n }\n\n function isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n }\n\n // 7.2 White Space\n\n function 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\n function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }\n\n // 7.6 Identifier Names and Identifiers\n\n function 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) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n }\n\n function 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) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n }\n\n // 7.6.1.2 Future Reserved Words\n\n function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }\n\n function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }\n\n // 7.6.1.1 Keywords\n\n function isKeyword(id) {\n if (strict && isStrictModeReservedWord(id)) {\n return true;\n }\n\n // 'const' is specialized as Keyword in V8.\n // 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.\n // Some others are from future reserved words.\n\n switch (id.length) {\n case 2:\n return (id === 'if') || (id === 'in') || (id === 'do');\n case 3:\n return (id === 'var') || (id === 'for') || (id === 'new') ||\n (id === 'try') || (id === 'let');\n case 4:\n return (id === 'this') || (id === 'else') || (id === 'case') ||\n (id === 'void') || (id === 'with') || (id === 'enum');\n case 5:\n return (id === 'while') || (id === 'break') || (id === 'catch') ||\n (id === 'throw') || (id === 'const') || (id === 'yield') ||\n (id === 'class') || (id === 'super');\n case 6:\n return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n (id === 'switch') || (id === 'export') || (id === 'import');\n case 7:\n return (id === 'default') || (id === 'finally') || (id === 'extends');\n case 8:\n return (id === 'function') || (id === 'continue') || (id === 'debugger');\n case 10:\n return (id === 'instanceof');\n default:\n return false;\n }\n }\n\n function skipComment() {\n var ch, start;\n\n start = (index === 0);\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch)) {\n ++index;\n } else if (isLineTerminator(ch)) {\n ++index;\n if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n start = true;\n } else {\n break;\n }\n }\n }\n\n function 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 return '';\n }\n }\n return String.fromCharCode(code);\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, '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\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n id += ch;\n }\n }\n\n return id;\n }\n\n function 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\n function 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 = Token.Identifier;\n } else if (isKeyword(id)) {\n type = Token.Keyword;\n } else if (id === 'null') {\n type = Token.NullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = Token.BooleanLiteral;\n } else {\n type = Token.Identifier;\n }\n\n return {\n type: type,\n value: id,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.7 Punctuators\n\n function 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 if (extra.tokenize) {\n if (code === 0x28) {\n extra.openParenToken = extra.tokens.length;\n } else if (code === 0x7B) {\n extra.openCurlyToken = extra.tokens.length;\n }\n }\n return {\n type: Token.Punctuator,\n value: String.fromCharCode(code),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: source.slice(start, index),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch4,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch3,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch2,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch1,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n // 7.8.3 Numeric Literals\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt('0x' + number, 16),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseFloat(number),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.8.4 String Literals\n\n function scanStringLiteral() {\n var str = '', quote, start, ch, code, unescaped, restore, octal = false, startLineNumber, startLineStart;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\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 restore = index;\n unescaped = scanHexEscape(ch);\n if (unescaped) {\n str += unescaped;\n } else {\n index = restore;\n str += ch;\n }\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 ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.StringLiteral,\n value: str,\n octal: octal,\n startLineNumber: startLineNumber,\n startLineStart: startLineStart,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function testRegExp(pattern, flags) {\n var tmp = pattern,\n value;\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({}, Messages.InvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n value = new RegExp(tmp);\n } catch (e) {\n throwError({}, Messages.InvalidRegExp);\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\n function 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({}, Messages.UnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, Messages.UnterminatedRegExp);\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({}, Messages.UnterminatedRegExp);\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\n function scanRegExpFlags() {\n var ch, str, flags, restore;\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 ch = source[index];\n if (ch === 'u') {\n ++index;\n restore = index;\n ch = scanHexEscape('u');\n if (ch) {\n flags += ch;\n for (str += '\\\\u'; restore < index; ++restore) {\n str += source[restore];\n }\n } else {\n index = restore;\n flags += 'u';\n str += '\\\\u';\n }\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n } else {\n str += '\\\\';\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n return {\n value: flags,\n literal: str\n };\n }\n\n function 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 if (extra.tokenize) {\n return {\n type: Token.RegularExpression,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\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\n function collectRegex() {\n var pos, loc, regex, token;\n\n skipComment();\n\n pos = index;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n regex = scanRegExp();\n\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (!extra.tokenize) {\n // Pop the previous token, which is likely '/' or '/='\n if (extra.tokens.length > 0) {\n token = extra.tokens[extra.tokens.length - 1];\n if (token.range[0] === pos && token.type === 'Punctuator') {\n if (token.value === '/' || token.value === '/=') {\n extra.tokens.pop();\n }\n }\n }\n\n extra.tokens.push({\n type: 'RegularExpression',\n value: regex.literal,\n regex: regex.regex,\n range: [pos, index],\n loc: loc\n });\n }\n\n return regex;\n }\n\n function isIdentifierName(token) {\n return token.type === Token.Identifier ||\n token.type === Token.Keyword ||\n token.type === Token.BooleanLiteral ||\n token.type === Token.NullLiteral;\n }\n\n function advanceSlash() {\n var prevToken,\n checkToken;\n // Using the following algorithm:\n // https://github.com/mozilla/sweet.js/wiki/design\n prevToken = extra.tokens[extra.tokens.length - 1];\n if (!prevToken) {\n // Nothing before that: it cannot be a division.\n return collectRegex();\n }\n if (prevToken.type === 'Punctuator') {\n if (prevToken.value === ']') {\n return scanPunctuator();\n }\n if (prevToken.value === ')') {\n checkToken = extra.tokens[extra.openParenToken - 1];\n if (checkToken &&\n checkToken.type === 'Keyword' &&\n (checkToken.value === 'if' ||\n checkToken.value === 'while' ||\n checkToken.value === 'for' ||\n checkToken.value === 'with')) {\n return collectRegex();\n }\n return scanPunctuator();\n }\n if (prevToken.value === '}') {\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n if (extra.tokens[extra.openCurlyToken - 3] &&\n extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {\n // Anonymous function.\n checkToken = extra.tokens[extra.openCurlyToken - 4];\n if (!checkToken) {\n return scanPunctuator();\n }\n } else if (extra.tokens[extra.openCurlyToken - 4] &&\n extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {\n // Named function.\n checkToken = extra.tokens[extra.openCurlyToken - 5];\n if (!checkToken) {\n return collectRegex();\n }\n } else {\n return scanPunctuator();\n }\n return scanPunctuator();\n }\n return collectRegex();\n }\n if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {\n return collectRegex();\n }\n return scanPunctuator();\n }\n\n function advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: Token.EOF,\n lineNumber: lineNumber,\n lineStart: lineStart,\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 // Slash (/) U+002F can also start a regex.\n if (extra.tokenize && ch === 0x2F) {\n return advanceSlash();\n }\n\n return scanPunctuator();\n }\n\n function collectToken() {\n var loc, token, value, entry;\n\n skipComment();\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n token = advance();\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (token.type !== Token.EOF) {\n value = source.slice(token.start, token.end);\n entry = {\n type: TokenName[token.type],\n value: value,\n range: [token.start, token.end],\n loc: loc\n };\n if (token.regex) {\n entry.regex = {\n pattern: token.regex.pattern,\n flags: token.regex.flags\n };\n }\n extra.tokens.push(entry);\n }\n\n return token;\n }\n\n function lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n return token;\n }\n\n function peek() {\n var pos, line, start;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n index = pos;\n lineNumber = line;\n lineStart = start;\n }\n\n function Position() {\n this.line = lineNumber;\n this.column = index - lineStart;\n }\n\n function SourceLocation() {\n this.start = new Position();\n this.end = null;\n }\n\n function WrappingSourceLocation(startToken) {\n if (startToken.type === Token.StringLiteral) {\n this.start = {\n line: startToken.startLineNumber,\n column: startToken.start - startToken.startLineStart\n };\n } else {\n this.start = {\n line: startToken.lineNumber,\n column: startToken.start - startToken.lineStart\n };\n }\n this.end = null;\n }\n\n function Node() {\n // Skip comment.\n index = lookahead.start;\n if (lookahead.type === Token.StringLiteral) {\n lineNumber = lookahead.startLineNumber;\n lineStart = lookahead.startLineStart;\n } else {\n lineNumber = lookahead.lineNumber;\n lineStart = lookahead.lineStart;\n }\n if (extra.range) {\n this.range = [index, 0];\n }\n if (extra.loc) {\n this.loc = new SourceLocation();\n }\n }\n\n function WrappingNode(startToken) {\n if (extra.range) {\n this.range = [startToken.start, 0];\n }\n if (extra.loc) {\n this.loc = new WrappingSourceLocation(startToken);\n }\n }\n\n WrappingNode.prototype = Node.prototype = {\n\n finish: function () {\n if (extra.range) {\n this.range[1] = index;\n }\n if (extra.loc) {\n this.loc.end = new Position();\n if (extra.source) {\n this.loc.source = extra.source;\n }\n }\n },\n\n finishArrayExpression: function (elements) {\n this.type = Syntax.ArrayExpression;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishAssignmentExpression: function (operator, left, right) {\n this.type = Syntax.AssignmentExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBinaryExpression: function (operator, left, right) {\n this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishCallExpression: function (callee, args) {\n this.type = Syntax.CallExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishConditionalExpression: function (test, consequent, alternate) {\n this.type = Syntax.ConditionalExpression;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishExpressionStatement: function (expression) {\n this.type = Syntax.ExpressionStatement;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishIdentifier: function (name) {\n this.type = Syntax.Identifier;\n this.name = name;\n this.finish();\n return this;\n },\n\n finishLiteral: function (token) {\n this.type = Syntax.Literal;\n this.value = token.value;\n this.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (this.raw == '//') {\n this.raw = '/(?:)/';\n }\n this.regex = token.regex;\n }\n this.finish();\n return this;\n },\n\n finishMemberExpression: function (accessor, object, property) {\n this.type = Syntax.MemberExpression;\n this.computed = accessor === '[';\n this.object = object;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishObjectExpression: function (properties) {\n this.type = Syntax.ObjectExpression;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishProgram: function (body) {\n this.type = Syntax.Program;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishProperty: function (kind, key, value) {\n this.type = Syntax.Property;\n this.key = key;\n this.value = value;\n this.kind = kind;\n this.finish();\n return this;\n },\n\n finishUnaryExpression: function (operator, argument) {\n this.type = Syntax.UnaryExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = true;\n this.finish();\n return this;\n }\n };\n\n // Return true if there is a line terminator before the next token.\n\n function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }\n\n // Throw an exception\n\n function 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 if (typeof token.lineNumber === 'number') {\n error = new Error('Line ' + token.lineNumber + ': ' + msg);\n error.index = token.start;\n error.lineNumber = token.lineNumber;\n error.column = token.start - lineStart + 1;\n } else {\n error = new Error('Line ' + lineNumber + ': ' + msg);\n error.index = index;\n error.lineNumber = lineNumber;\n error.column = index - lineStart + 1;\n }\n\n error.description = msg;\n throw error;\n }\n\n function throwErrorTolerant() {\n try {\n throwError.apply(null, arguments);\n } catch (e) {\n if (extra.errors) {\n extra.errors.push(e);\n } else {\n throw e;\n }\n }\n }\n\n\n // Throw an exception because of the token.\n\n function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // Expect the next token to match the specified punctuator.\n // If not, an exception will be thrown.\n\n function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }\n\n /**\n * @name expectTolerant\n * @description Quietly expect the given token value when in tolerant mode, otherwise delegates\n * to expect(value)\n * @param {String} value The value we are expecting the lookahead token to have\n * @since 2.0\n */\n function expectTolerant(value) {\n if (extra.errors) {\n var token = lookahead;\n if (token.type !== Token.Punctuator && token.value !== value) {\n throwErrorTolerant(token, Messages.UnexpectedToken, token.value);\n } else {\n lex();\n }\n } else {\n expect(value);\n }\n }\n\n // Return true if the next token matches the specified punctuator.\n\n function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }\n\n // Return true if the next token matches the specified keyword\n\n function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }\n\n function consumeSemicolon() {\n var line;\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(index) === 0x3B || match(';')) {\n lex();\n return;\n }\n\n line = lineNumber;\n skipComment();\n if (lineNumber !== line) {\n return;\n }\n\n if (lookahead.type !== Token.EOF && !match('}')) {\n throwUnexpected(lookahead);\n }\n }\n\n // 11.1.4 Array Initialiser\n\n function parseArrayInitialiser() {\n var elements = [], node = new Node();\n\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseAssignmentExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return node.finishArrayExpression(elements);\n }\n\n // 11.1.5 Object Initialiser\n\n function parseObjectPropertyKey() {\n var token, node = new Node();\n\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 === Token.StringLiteral || token.type === Token.NumericLiteral) {\n if (strict && token.octal) {\n throwErrorTolerant(token, Messages.StrictOctalLiteral);\n }\n return node.finishLiteral(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseObjectProperty() {\n var token, key, id, value, node = new Node();\n\n token = lookahead;\n\n if (token.type === Token.Identifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', id, value);\n }\n if (token.type === Token.EOF || token.type === Token.Punctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', key, value);\n }\n }\n\n function parseObjectInitialiser() {\n var properties = [], property, name, key, kind, map = {}, toString = String, node = new Node();\n\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === Syntax.Identifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n if (map[key] === PropertyKind.Data) {\n if (strict && kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.StrictDuplicateProperty);\n } else if (kind !== PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n }\n } else {\n if (kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n } else if (map[key] & kind) {\n throwErrorTolerant({}, Messages.AccessorGetSet);\n }\n }\n map[key] |= kind;\n } else {\n map[key] = kind;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expectTolerant(',');\n }\n }\n\n expect('}');\n\n return node.finishObjectExpression(properties);\n }\n\n // 11.1.6 The Grouping Operator\n\n function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }\n\n\n // 11.1 Primary Expressions\n\n var legalKeywords = {\"if\":1, \"this\":1};\n\n function parsePrimaryExpression() {\n var type, token, expr, node;\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 node = new Node();\n\n if (type === Token.Identifier || legalKeywords[lookahead.value]) {\n expr = node.finishIdentifier(lex().value);\n } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n if (strict && lookahead.octal) {\n throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n }\n expr = node.finishLiteral(lex());\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\");\n } else if (type === Token.BooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = node.finishLiteral(token);\n } else if (type === Token.NullLiteral) {\n token = lex();\n token.value = null;\n expr = node.finishLiteral(token);\n } else if (match('/') || match('/=')) {\n if (typeof extra.tokens !== 'undefined') {\n expr = node.finishLiteral(collectRegex());\n } else {\n expr = node.finishLiteral(scanRegExp());\n }\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n }\n\n // 11.2 Left-Hand-Side Expressions\n\n function parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseAssignmentExpression());\n if (match(')')) {\n break;\n }\n expectTolerant(',');\n }\n }\n\n expect(')');\n\n return args;\n }\n\n function parseNonComputedProperty() {\n var token, node = new Node();\n\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n }\n\n function parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n }\n\n function parseLeftHandSideExpressionAllowCall() {\n var expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }\n\n // 11.3 Postfix Expressions\n\n function parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === Token.Punctuator) {\n if ((match('++') || match('--')) && !peekLineTerminator()) {\n throw new Error(\"Disabled.\");\n }\n }\n\n return expr;\n }\n\n // 11.4 Unary Operators\n\n function parseUnaryExpression() {\n var token, expr, startToken;\n\n if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(\"Disabled.\");\n } else if (match('+') || match('-') || match('~') || match('!')) {\n startToken = lookahead;\n token = lex();\n expr = parseUnaryExpression();\n expr = new WrappingNode(startToken).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\n function binaryPrecedence(token, allowIn) {\n var prec = 0;\n\n if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\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 prec = 7;\n break;\n\n case 'in':\n prec = allowIn ? 7 : 0;\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\n function 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, state.allowIn);\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, state.allowIn)) > 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 = new WrappingNode(markers[markers.length - 1]).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 expr = new WrappingNode(markers.pop()).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\n function parseConditionalExpression() {\n var expr, previousAllowIn, consequent, alternate, startToken;\n\n startToken = lookahead;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n previousAllowIn = state.allowIn;\n state.allowIn = true;\n consequent = parseAssignmentExpression();\n state.allowIn = previousAllowIn;\n expect(':');\n alternate = parseAssignmentExpression();\n\n expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n }\n\n // 11.13 Assignment Operators\n\n function parseAssignmentExpression() {\n var oldParenthesisCount, token, expr, startToken;\n\n oldParenthesisCount = state.parenthesisCount;\n\n startToken = lookahead;\n token = lookahead;\n\n expr = parseConditionalExpression();\n\n return expr;\n }\n\n // 11.14 Comma Operator\n\n function parseExpression() {\n var expr = parseAssignmentExpression();\n\n if (match(',')) {\n throw new Error(\"Disabled.\"); // no sequence expressions\n }\n\n return expr;\n }\n\n // 12.4 Expression Statement\n\n function parseExpressionStatement(node) {\n var expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 12 Statements\n\n function parseStatement() {\n var type = lookahead.type,\n expr,\n node;\n\n if (type === Token.EOF) {\n throwUnexpected(lookahead);\n }\n\n if (type === Token.Punctuator && lookahead.value === '{') {\n throw new Error(\"Disabled.\"); // block statement\n }\n\n node = new Node();\n\n if (type === Token.Punctuator) {\n switch (lookahead.value) {\n case ';':\n throw new Error(\"Disabled.\"); // empty statement\n case '(':\n return parseExpressionStatement(node);\n default:\n break;\n }\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\"); // keyword\n }\n\n expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 14 Program\n\n function parseSourceElement() {\n if (lookahead.type === Token.Keyword) {\n switch (lookahead.value) {\n case 'const':\n case 'let':\n throw new Error(\"Disabled.\");\n case 'function':\n throw new Error(\"Disabled.\");\n default:\n return parseStatement();\n }\n }\n\n if (lookahead.type !== Token.EOF) {\n return parseStatement();\n }\n }\n\n function parseSourceElements() {\n var sourceElement, sourceElements = [], token, directive, firstRestricted;\n\n while (index < length) {\n token = lookahead;\n if (token.type !== Token.StringLiteral) {\n break;\n }\n\n sourceElement = parseSourceElement();\n sourceElements.push(sourceElement);\n if (sourceElement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n while (index < length) {\n sourceElement = parseSourceElement();\n if (typeof sourceElement === 'undefined') {\n break;\n }\n sourceElements.push(sourceElement);\n }\n return sourceElements;\n }\n\n function parseProgram() {\n var body, node;\n\n skipComment();\n peek();\n node = new Node();\n strict = true; // assume strict\n\n body = parseSourceElements();\n return node.finishProgram(body);\n }\n\n function filterTokenLocation() {\n var i, entry, token, tokens = [];\n\n for (i = 0; i < extra.tokens.length; ++i) {\n entry = extra.tokens[i];\n token = {\n type: entry.type,\n value: entry.value\n };\n if (entry.regex) {\n token.regex = {\n pattern: entry.regex.pattern,\n flags: entry.regex.flags\n };\n }\n if (extra.range) {\n token.range = entry.range;\n }\n if (extra.loc) {\n token.loc = entry.loc;\n }\n tokens.push(token);\n }\n\n extra.tokens = tokens;\n }\n\n function tokenize(code, options) {\n var toString,\n tokens;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n\n // Options matching.\n options = options || {};\n\n // Of course we collect tokens here.\n options.tokens = true;\n extra.tokens = [];\n extra.tokenize = true;\n // The following two fields are necessary to compute the Regex tokens.\n extra.openParenToken = -1;\n extra.openCurlyToken = -1;\n\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n\n try {\n peek();\n if (lookahead.type === Token.EOF) {\n return extra.tokens;\n }\n\n lex();\n while (lookahead.type !== Token.EOF) {\n try {\n lex();\n } catch (lexError) {\n if (extra.errors) {\n extra.errors.push(lexError);\n // We have to break on the first error\n // to avoid infinite loops.\n break;\n } else {\n throw lexError;\n }\n }\n }\n\n filterTokenLocation();\n tokens = extra.tokens;\n if (typeof extra.errors !== 'undefined') {\n tokens.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n return tokens;\n }\n\n function parse(code, options) {\n var program, toString;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n parenthesisCount: 0,\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n if (typeof options !== 'undefined') {\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (extra.loc && options.source !== null && options.source !== undefined) {\n extra.source = toString(options.source);\n }\n\n if (typeof options.tokens === 'boolean' && options.tokens) {\n extra.tokens = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n }\n\n try {\n program = parseProgram();\n if (typeof extra.tokens !== 'undefined') {\n filterTokenLocation();\n program.tokens = extra.tokens;\n }\n if (typeof extra.errors !== 'undefined') {\n program.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n\n return program;\n }\n\n return {\n tokenize: tokenize,\n parse: parse\n };\n\n})();","var expr = require('vega-expression'),\n args = ['datum', 'event', 'signals'];\n\nmodule.exports = expr.compiler(args, {\n idWhiteList: args,\n fieldVar: args[0],\n globalVar: args[2],\n functions: function(codegen) {\n var fn = expr.functions(codegen);\n fn.eventItem = function() { return 'event.vg.item'; };\n fn.eventGroup = 'event.vg.getGroup';\n fn.eventX = 'event.vg.getX';\n fn.eventY = 'event.vg.getY';\n fn.open = 'window.open';\n return fn;\n }\n});","var dl = require('datalib'),\n df = require('vega-dataflow'),\n log = require('vega-logging'),\n ChangeSet = df.ChangeSet,\n Tuple = df.Tuple,\n Deps = df.Dependencies,\n Transform = require('./Transform'),\n Facetor = require('./Facetor');\n\nfunction Aggregate(graph) {\n Transform.prototype.init.call(this, graph);\n\n Transform.addParameters(this, {\n groupby: {type: 'array'},\n summarize: {\n type: 'custom', \n set: function(summarize) {\n var signalDeps = {},\n tx = this._transform,\n i, len, f, fields, name, ops;\n\n if (!dl.isArray(fields = summarize)) { // Object syntax from dl\n fields = [];\n for (name in summarize) {\n ops = dl.array(summarize[name]);\n fields.push({field: name, ops: ops});\n }\n }\n\n function sg(x) { if (x.signal) signalDeps[x.signal] = 1; }\n\n for (i=0, len=fields.length; i this.config('maxSmallNumber') ?\n 'largeNumberFormat': 'smallNumberFormat';\n return this.config(formatConfig);\n };\n\n proto.sort = function(et, stats) {\n var sort = this._enc[et].sort,\n enc = this._enc,\n isTypes = vlEncDef.isTypes;\n\n if ((!sort || sort.length===0) &&\n // FIXME\n Encoding.toggleSort.support({encoding:this._enc}, stats, true) && //HACK\n this.config('toggleSort') === Q\n ) {\n var qField = isTypes(enc.x, [N, O]) ? enc.y : enc.x;\n\n if (isTypes(enc[et], [N, O])) {\n sort = [{\n name: qField.name,\n aggregate: qField.aggregate,\n type: qField.type,\n reverse: true\n }];\n }\n }\n\n return sort;\n };\n\n proto.map = function(f) {\n return vlenc.map(this._enc, f);\n };\n\n proto.reduce = function(f, init) {\n return vlenc.reduce(this._enc, f, init);\n };\n\n proto.forEach = function(f) {\n return vlenc.forEach(this._enc, f);\n };\n\n proto.type = function(et) {\n return this.has(et) ? this._enc[et].type : null;\n };\n\n proto.isType = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isType(encDef, type);\n };\n\n\n proto.isTypes = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isTypes(encDef, type);\n };\n\n Encoding.isOrdinalScale = function(encoding, encType) {\n return vlEncDef.isOrdinalScale(encoding.encDef(encType));\n };\n\n Encoding.isDimension = function(encoding, encType) {\n return vlEncDef.isDimension(encoding.encDef(encType));\n };\n\n Encoding.isMeasure = function(encoding, encType) {\n return vlEncDef.isMeasure(encoding.encDef(encType));\n };\n\n proto.isOrdinalScale = function(encType) {\n return this.has(encType) && Encoding.isOrdinalScale(this, encType);\n };\n\n proto.isDimension = function(encType) {\n return this.has(encType) && Encoding.isDimension(this, encType);\n };\n\n proto.isMeasure = function(encType) {\n return this.has(encType) && Encoding.isMeasure(this, encType);\n };\n\n proto.isAggregate = function() {\n return vlenc.isAggregate(this._enc);\n };\n\n proto.dataTable = function() {\n return this.isAggregate() ? AGGREGATE : RAW;\n };\n\n Encoding.isAggregate = function(spec) {\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.alwaysNoOcclusion = function(spec) {\n // FIXME raw OxQ with # of rows = # of O\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.isStack = function(spec) {\n // FIXME update this once we have control for stack ...\n return (spec.marktype === 'bar' || spec.marktype === 'area') &&\n spec.encoding.color;\n };\n\n /**\n * Check if the encoding should be stacked and return the stack dimenstion and value fields.\n * @return {Object} An object containing two properties:\n * - dimension - the dimension field\n * - value - the value field\n */\n proto.stack = function() {\n var stack = (this.has(COLOR) && this.encDef(COLOR).stack) ? COLOR :\n (this.has(DETAIL) && this.encDef(DETAIL).stack) ? DETAIL :\n null;\n\n var properties = stack && this.encDef(stack).stack !== true ?\n this.encDef(stack).stack :\n {};\n\n if ((this.is('bar') || this.is('area')) && stack && this.isAggregate()) {\n\n var isXMeasure = this.isMeasure(X);\n var isYMeasure = this.isMeasure(Y);\n\n if (isXMeasure && !isYMeasure) {\n return {\n groupby: Y,\n value: X,\n stack: stack,\n properties: properties\n };\n } else if (isYMeasure && !isXMeasure) {\n return {\n groupby: X,\n value: Y,\n stack: stack,\n properties: properties\n };\n }\n }\n return null; // no stack encoding\n };\n\n\n\n proto.details = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType !== X && encType !== Y)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.facets = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType == ROW || encType == COL)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.cardinality = function(encType, stats) {\n return vlEncDef.cardinality(this.encDef(encType), stats, this.config('filterNull'));\n };\n\n proto.isRaw = function() {\n return !this.isAggregate();\n };\n\n proto.data = function() {\n return this._data;\n };\n\n // returns whether the encoding has values embedded\n proto.hasValues = function() {\n var vals = this.data().values;\n return vals && vals.length;\n };\n\n proto.config = function(name) {\n return this._config[name];\n };\n\n Encoding.transpose = function(spec) {\n var oldenc = spec.encoding,\n enc = util.duplicate(spec.encoding);\n enc.x = oldenc.y;\n enc.y = oldenc.x;\n enc.row = oldenc.col;\n enc.col = oldenc.row;\n spec.encoding = enc;\n return spec;\n };\n\n return Encoding;\n})();\n","'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n getter = util.getter,\n time = require('./time');\n\nvar axis = module.exports = {};\n\naxis.def = function(name, encoding, layout, stats, opt) {\n var isCol = name == COL,\n isRow = name == ROW,\n type = isCol ? 'x' : isRow ? 'y' : name;\n\n // TODO: rename def to axisDef and avoid side effects where possible.\n\n var def = {\n type: type,\n scale: name,\n properties: {},\n layer: encoding.encDef(name).axis.layer\n };\n\n var orient = axis.orient(encoding, name, stats);\n if (orient) {\n def.orient = orient;\n }\n\n // Add axis label custom scale (for bin / time)\n def = axis.labels.scale(def, encoding, name);\n def = axis.labels.format(def, encoding, name, stats);\n def = axis.labels.angle(def, encoding, name);\n\n // for x-axis, set ticks for Q or rotate scale for ordinal scale\n if (name == X) {\n if ((encoding.isDimension(X) || encoding.isType(X, T)) &&\n !('angle' in getter(def, ['properties', 'labels']))) {\n // TODO(kanitw): Jul 19, 2015 - #506 add condition for rotation\n def = axis.labels.rotate(def);\n } else { // Q\n def.ticks = encoding.encDef(name).axis.ticks;\n }\n }\n\n // TitleOffset depends on labels rotation\n def.titleOffset = axis.titleOffset(encoding, layout, name);\n\n //def.offset is used in axis.grid\n if(isRow) def.offset = axis.titleOffset(encoding, layout, Y) + 20;\n // FIXME(kanitw): Jul 19, 2015 - offset for column when x is put on top\n\n def = axis.grid(def, encoding, name, layout);\n def = axis.title(def, encoding, name, layout, opt);\n\n if (isRow || isCol) {\n def = axis.hideTicks(def);\n }\n\n return def;\n};\n\naxis.orient = function(encoding, name, stats) {\n var orient = encoding.encDef(name).axis.orient;\n if (orient) {\n return orient;\n } else if (name === COL) {\n return 'top';\n } else if (name === X && encoding.has(Y) && encoding.isOrdinalScale(Y) && encoding.cardinality(Y, stats) > 30) {\n // x-axis for long y - put on top\n return 'top';\n }\n return undefined;\n};\n\naxis.grid = function(def, encoding, name, layout) {\n var cellPadding = layout.cellPadding,\n isCol = name == COL,\n isRow = name == ROW;\n\n var _grid = encoding.axis(name).grid;\n\n // If `grid` is unspecified, the default value is `true` for ROW and COL. For X\n // and Y, the default value is `true` for quantitative and time fields and `false` otherwise.\n var grid = _grid === undefined ?\n (name === ROW || name === COL || encoding.isTypes(name, [Q, T])) :\n _grid;\n\n if (grid) {\n def.grid = true;\n\n if (isCol) {\n // set grid property -- put the lines on the right the cell\n var yOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n def.properties.grid = {\n x: {\n offset: layout.cellWidth * (1+ cellPadding/2.0),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'col',\n field: 'data'\n },\n y: {\n value: -yOffset,\n },\n y2: {\n field: {group: 'mark.group.height'},\n offset: yOffset\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else if (isRow) {\n var xOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n // set grid property -- put the lines on the top\n def.properties.grid = {\n y: {\n offset: -layout.cellHeight * (cellPadding/2),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'row',\n field: 'data'\n },\n x: {\n value: def.offset - xOffset\n },\n x2: {\n field: {group: 'mark.group.width'},\n offset: def.offset + xOffset,\n // default value(s) -- vega doesn't do recursive merge\n mult: 1\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else {\n def.properties.grid = {\n stroke: { value: encoding.config('gridColor') },\n strokeOpacity: { value: encoding.config('gridOpacity') }\n };\n }\n }\n return def;\n};\n\naxis.hideTicks = function(def) {\n def.properties.ticks = {opacity: {value: 0}};\n def.properties.majorTicks = {opacity: {value: 0}};\n def.properties.axis = {opacity: {value: 0}};\n return def;\n};\n\naxis.title = function (def, encoding, name, layout) {\n var ax = encoding.encDef(name).axis;\n\n if (ax.title) {\n def.title = ax.title;\n } else {\n // if not defined, automatically determine axis title from field def\n var fieldTitle = encoding.fieldTitle(name),\n maxLength;\n\n if (ax.titleMaxLength) {\n maxLength = ax.titleMaxLength;\n } else if (name===X) {\n maxLength = layout.cellWidth / encoding.config('characterWidth');\n } else if (name === Y) {\n maxLength = layout.cellHeight / encoding.config('characterWidth');\n }\n\n def.title = maxLength ? util.truncate(fieldTitle, maxLength) : fieldTitle;\n }\n\n if (name === ROW) {\n def.properties.title = {\n angle: {value: 0},\n align: {value: 'right'},\n baseline: {value: 'middle'},\n dy: {value: (-layout.height/2) -20}\n };\n }\n\n return def;\n};\n\naxis.labels = {};\n\n/** add custom label for time type and bin */\naxis.labels.scale = function(def, encoding, name) {\n // time\n var timeUnit = encoding.encDef(name).timeUnit;\n if (encoding.isType(name, T) && timeUnit && (time.hasScale(timeUnit))) {\n setter(def, ['properties','labels','text','scale'], 'time-'+ timeUnit);\n }\n // FIXME bin\n return def;\n};\n\n/**\n * Determine number format or truncate if maxLabel length is presented.\n */\naxis.labels.format = function (def, encoding, name, stats) {\n var fieldStats = stats[encoding.encDef(name).name];\n\n if (encoding.axis(name).format) {\n def.format = encoding.axis(name).format;\n } else if (encoding.isType(name, Q) || fieldStats.type === 'number') {\n def.format = encoding.numberFormat(fieldStats);\n } else if (encoding.isType(name, T)) {\n var timeUnit = encoding.encDef(name).timeUnit;\n if (!timeUnit) {\n def.format = encoding.config('timeFormat');\n } else if (timeUnit === 'year') {\n def.format = 'd';\n }\n } else if (encoding.isTypes(name, [N, O]) && encoding.axis(name).maxLabelLength) {\n setter(def,\n ['properties','labels','text','template'],\n '{{ datum.data | truncate:' +\n encoding.axis(name).maxLabelLength + '}}'\n );\n }\n\n return def;\n};\n\naxis.labels.angle = function(def, encoding, name) {\n var angle = encoding.axis(name).labelAngle;\n if (typeof angle === 'undefined') return def;\n\n setter(def, ['properties', 'labels', 'angle', 'value'], angle);\n return def;\n};\n\naxis.labels.rotate = function(def) {\n var align = def.orient ==='top' ? 'left' : 'right';\n setter(def, ['properties','labels', 'angle', 'value'], 270);\n setter(def, ['properties','labels', 'align', 'value'], align);\n setter(def, ['properties','labels', 'baseline', 'value'], 'middle');\n return def;\n};\n\naxis.titleOffset = function (encoding, layout, name) {\n // return specified value if specified\n var value = encoding.axis(name).titleOffset;\n if (value) return value;\n\n switch (name) {\n //FIXME make this adjustable\n case ROW: return 0;\n case COL: return 35;\n }\n return getter(layout, [name, 'axisTitleOffset']);\n};\n","'use strict';\n\nvar summary = module.exports = require('datalib/src/stats').summary;\n\nrequire('../globals');\n\n/**\n * Module for compiling Vega-lite spec into Vega spec.\n */\nvar compiler = module.exports = {};\n\nvar Encoding = require('../Encoding'),\n axis = compiler.axis = require('./axis'),\n legend = compiler.legend = require('./legend'),\n marks = compiler.marks = require('./marks'),\n scale = compiler.scale = require('./scale');\n\ncompiler.data = require('./data');\ncompiler.facet = require('./facet');\ncompiler.layout = require('./layout');\ncompiler.stack = require('./stack');\ncompiler.style = require('./style');\ncompiler.subfacet = require('./subfacet');\ncompiler.time = require('./time');\n\ncompiler.compile = function (spec, stats, theme) {\n return compiler.compileEncoding(Encoding.fromSpec(spec, theme), stats);\n};\n\ncompiler.shorthand = function (shorthand, stats, config, theme) {\n return compiler.compileEncoding(Encoding.fromShorthand(shorthand, config, theme), stats);\n};\n\n/**\n * Create a Vega specification from a Vega-lite Encoding object.\n */\ncompiler.compileEncoding = function (encoding, stats) {\n // no need to pass stats if you pass in the data\n if (!stats) {\n if (encoding.hasValues()) {\n stats = summary(encoding.data().values).reduce(function(s, p) {\n s[p.field] = p;\n return s;\n }, {});\n } else {\n console.error('No stats provided and data is not embedded.');\n }\n }\n\n var layout = compiler.layout(encoding, stats);\n\n var spec = {\n width: layout.width,\n height: layout.height,\n padding: 'auto',\n // FIXME(#514): eliminate stats\n data: compiler.data(encoding, stats),\n // global scales contains only time unit scales\n scales: compiler.time.scales(encoding),\n marks: [{\n name: 'cell',\n type: 'group',\n properties: {\n enter: {\n width: layout.cellWidth ?\n {value: layout.cellWidth} :\n {field: {group: 'width'}},\n height: layout.cellHeight ?\n {value: layout.cellHeight} :\n {field: {group: 'height'}}\n }\n }\n }]\n };\n\n var group = spec.marks[0];\n\n // marks\n var style = compiler.style(encoding, stats),\n mdefs = group.marks = marks.def(encoding, layout, style, stats),\n mdef = mdefs[mdefs.length - 1]; // TODO: remove this dirty hack by refactoring the whole flow\n\n var stack = encoding.stack();\n if (stack) {\n // modify mdef.{from,properties}\n compiler.stack(encoding, mdef, stack);\n }\n\n var lineType = marks[encoding.marktype()].line;\n\n // handle subfacets\n var details = encoding.details();\n\n if (details.length > 0 && lineType) {\n //subfacet to group stack / line together in one group\n compiler.subfacet(group, mdef, details, encoding);\n }\n\n // auto-sort line/area values\n if (lineType && encoding.config('autoSortLine')) {\n var f = (encoding.isMeasure(X) && encoding.isDimension(Y)) ? Y : X;\n if (!mdef.from) {\n mdef.from = {};\n }\n // TODO: why - ?\n mdef.from.transform = [{type: 'sort', by: '-' + encoding.fieldRef(f)}];\n }\n\n // get a flattened list of all scale names that are used in the vl spec\n var singleScaleNames = [].concat.apply([], mdefs.map(function(markProps) {\n return scale.names(markProps.properties.update);\n }));\n\n // Small Multiples\n if (encoding.has(ROW) || encoding.has(COL)) {\n spec = compiler.facet(group, encoding, layout, spec, singleScaleNames, stats);\n spec.legends = legend.defs(encoding, style);\n } else {\n group.scales = scale.defs(singleScaleNames, encoding, layout, stats);\n group.axes = [];\n if (encoding.has(X)) {\n group.axes.push(axis.def(X, encoding, layout, stats));\n }\n if (encoding.has(Y)) {\n group.axes.push(axis.def(Y, encoding, layout, stats));\n }\n\n group.legends = legend.defs(encoding, style);\n }\n\n return spec;\n};\n\n","'use strict';\n\nrequire('../globals');\n\nmodule.exports = data;\n\nvar vlEncDef = require('../encdef'),\n util = require('../util'),\n time = require('./time');\n\n/**\n * Create Vega's data array from a given encoding.\n *\n * @param {Encoding} encoding\n * @return {Array} Array of Vega data.\n * This always includes a \"raw\" data table.\n * If the encoding contains aggregate value, this will also create\n * aggregate table as well.\n */\n// FIXME(#514): eliminate stats\nfunction data(encoding, stats) {\n var def = [data.raw(encoding, stats)];\n\n var aggregate = data.aggregate(encoding);\n if (aggregate) {\n def.push(data.aggregate(encoding));\n }\n\n // TODO add \"having\" filter here\n\n // append non-positive filter at the end for the data table\n data.filterNonPositive(def[def.length - 1], encoding);\n\n // Stack\n var stack = encoding.stack();\n if (stack) {\n def.push(data.stack(encoding, stack));\n }\n\n return def;\n}\n\n// FIXME(#514): eliminate stats\ndata.raw = function(encoding, stats) {\n var raw = {name: RAW};\n\n // Data source (url or inline)\n if (encoding.hasValues()) {\n raw.values = encoding.data().values;\n raw.format = {type: 'json'};\n } else {\n raw.url = encoding.data().url;\n raw.format = {type: encoding.data().formatType};\n }\n\n // Set data's format.parse if needed\n var parse = data.raw.formatParse(encoding);\n if (parse) {\n raw.format.parse = parse;\n }\n\n raw.transform = data.raw.transform(encoding, stats);\n return raw;\n};\n\ndata.raw.formatParse = function(encoding) {\n var parse;\n\n encoding.forEach(function(encDef) {\n if (encDef.type == T) {\n parse = parse || {};\n parse[encDef.name] = 'date';\n } else if (encDef.type == Q) {\n if (vlEncDef.isCount(encDef)) return;\n parse = parse || {};\n parse[encDef.name] = 'number';\n }\n });\n\n return parse;\n};\n\n/**\n * Generate Vega transforms for the raw data table. This can include\n * transforms for time unit, binning and filtering.\n */\n// FIXME(#514): eliminate stats\ndata.raw.transform = function(encoding, stats) {\n // null filter comes first so transforms are not performed on null values\n // time and bin should come before filter so we can filter by time and bin\n return data.raw.transform.nullFilter(encoding).concat(\n data.raw.transform.formula(encoding),\n data.raw.transform.time(encoding),\n data.raw.transform.bin(encoding, stats),\n data.raw.transform.filter(encoding)\n );\n};\n\ndata.raw.transform.time = function(encoding) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encDef.type === T && encDef.timeUnit) {\n var fieldRef = encoding.fieldRef(encType, {nofn: true, datum: true});\n\n transform.push({\n type: 'formula',\n field: encoding.fieldRef(encType),\n expr: time.formula(encDef.timeUnit, fieldRef)\n });\n }\n return transform;\n }, []);\n};\n\n// FIXME(#514): eliminate stats\ndata.raw.transform.bin = function(encoding, stats) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encoding.bin(encType)) {\n transform.push({\n type: 'bin',\n field: encDef.name,\n output: {bin: encoding.fieldRef(encType)},\n maxbins: encoding.bin(encType).maxbins,\n min: stats[encDef.name].min,\n max: stats[encDef.name].max\n });\n }\n return transform;\n }, []);\n};\n\n/**\n * @return {Array} An array that might contain a filter transform for filtering null value based on filterNul config\n */\ndata.raw.transform.nullFilter = function(encoding) {\n var filteredFields = util.reduce(encoding.fields(),\n function(filteredFields, fieldList, fieldName) {\n if (fieldName === '*') return filteredFields; //count\n\n // TODO(#597) revise how filterNull is structured.\n if ((encoding.config('filterNull').Q && fieldList.containsType[Q]) ||\n (encoding.config('filterNull').T && fieldList.containsType[T]) ||\n (encoding.config('filterNull').O && fieldList.containsType[O]) ||\n (encoding.config('filterNull').N && fieldList.containsType[N])) {\n filteredFields.push(fieldName);\n }\n return filteredFields;\n }, []);\n\n return filteredFields.length > 0 ?\n [{\n type: 'filter',\n test: filteredFields.map(function(fieldName) {\n return 'datum.' + fieldName + '!==null';\n }).join(' && ')\n }] : [];\n};\n\ndata.raw.transform.filter = function(encoding) {\n var filter = encoding.data().filter;\n return filter ? [{\n type: 'filter',\n test: filter\n }] : [];\n};\n\ndata.raw.transform.formula = function(encoding) {\n var formulas = encoding.data().formulas;\n if (formulas === undefined) {\n return [];\n }\n\n return formulas.reduce(function(transform, formula) {\n formula.type = 'formula';\n transform.push(formula);\n return transform;\n }, []);\n};\n\ndata.aggregate = function(encoding) {\n /* dict set for dimensions */\n var dims = {};\n\n /* dictionary mapping field name => dict set of aggregation functions */\n var meas = {};\n\n var hasAggregate = false;\n\n encoding.forEach(function(encDef, encType) {\n if (encDef.aggregate) {\n hasAggregate = true;\n if (encDef.aggregate === 'count') {\n meas['*'] = meas['*'] || {};\n meas['*'].count = true;\n } else {\n meas[encDef.name] = meas[encDef.name] || {};\n meas[encDef.name][encDef.aggregate] = true;\n }\n } else {\n dims[encDef.name] = encoding.fieldRef(encType);\n }\n });\n\n var groupby = util.vals(dims);\n\n // short-format summarize object for Vega's aggregate transform\n // https://github.com/vega/vega/wiki/Data-Transforms#-aggregate\n var summarize = util.reduce(meas, function(summarize, fnDictSet, field) {\n summarize[field] = util.keys(fnDictSet);\n return summarize;\n }, {});\n\n if (hasAggregate) {\n return {\n name: AGGREGATE,\n source: RAW,\n transform: [{\n type: 'aggregate',\n groupby: groupby,\n summarize: summarize\n }]\n };\n }\n\n return null;\n};\n\n/**\n * Add stacked data source, for feeding the shared scale.\n */\ndata.stack = function(encoding, stack) {\n var dim = stack.groupby;\n var val = stack.value;\n var facets = encoding.facets();\n\n var stacked = {\n name: STACKED,\n source: encoding.dataTable(),\n transform: [{\n type: 'aggregate',\n groupby: [encoding.fieldRef(dim)].concat(facets), // dim and other facets\n summarize: [{ops: ['sum'], field: encoding.fieldRef(val)}]\n }]\n };\n\n if (facets && facets.length > 0) {\n stacked.transform.push({ //calculate max for each facet\n type: 'aggregate',\n groupby: facets,\n summarize: [{\n ops: ['max'],\n // we want max of sum from above transform\n field: encoding.fieldRef(val, {prefn: 'sum_'})\n }]\n });\n }\n return stacked;\n};\n\ndata.filterNonPositive = function(dataTable, encoding) {\n encoding.forEach(function(encDef, encType) {\n if (encoding.scale(encType).type === 'log') {\n dataTable.transform.push({\n type: 'filter',\n test: encoding.fieldRef(encType, {datum: 1}) + ' > 0'\n });\n }\n });\n};\n","'use strict';\n\nrequire('../globals');\n\nvar util = require('../util');\n\nvar axis = require('./axis'),\n scale = require('./scale');\n\nmodule.exports = faceting;\n\nfunction groupdef(name, opt) {\n opt = opt || {};\n var group = {\n name: name || undefined,\n type: 'group',\n properties: {\n enter: {\n width: opt.width || {field: {group: 'width'}},\n height: opt.height || {field: {group: 'height'}}\n }\n }\n };\n\n if (opt.from) {\n group.from = opt.from;\n }\n if (opt.x) {\n group.properties.enter.x = opt.x;\n }\n if (opt.y) {\n group.properties.enter.y = opt.y;\n }\n if (opt.axes) {\n group.axes = opt.axes;\n }\n\n return group;\n}\n\nfunction faceting(group, encoding, layout, spec, singleScaleNames, stats) {\n var enter = group.properties.enter;\n var facetKeys = [], cellAxes = [], from, axesGrp;\n\n var hasRow = encoding.has(ROW), hasCol = encoding.has(COL);\n\n enter.fill = {value: encoding.config('cellBackgroundColor')};\n\n //move \"from\" to cell level and add facet transform\n group.from = {data: group.marks[0].from.data};\n\n // Hack, this needs to be refactored\n for (var i = 0; i < group.marks.length; i++) {\n var mark = group.marks[i];\n if (mark.from.transform) {\n delete mark.from.data; //need to keep transform for subfacetting case\n } else {\n delete mark.from;\n }\n }\n\n if (hasRow) {\n if (!encoding.isDimension(ROW)) {\n util.error('Row encoding should be ordinal.');\n }\n enter.y = {scale: ROW, field: encoding.fieldRef(ROW)};\n enter.height = {'value': layout.cellHeight}; // HACK\n\n facetKeys.push(encoding.fieldRef(ROW));\n\n if (hasCol) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(COL)]});\n }\n\n axesGrp = groupdef('x-axes', {\n axes: encoding.has(X) ? [axis.def(X, encoding, layout, stats)] : undefined,\n x: hasCol ? {scale: COL, field: encoding.fieldRef(COL)} : {value: 0},\n width: hasCol && {'value': layout.cellWidth}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(ROW, encoding, layout, stats));\n } else { // doesn't have row\n if (encoding.has(X)) {\n //keep x axis in the cell\n cellAxes.push(axis.def(X, encoding, layout, stats));\n }\n }\n\n if (hasCol) {\n if (!encoding.isDimension(COL)) {\n util.error('Col encoding should be ordinal.');\n }\n enter.x = {scale: COL, field: encoding.fieldRef(COL)};\n enter.width = {'value': layout.cellWidth}; // HACK\n\n facetKeys.push(encoding.fieldRef(COL));\n\n if (hasRow) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(ROW)]});\n }\n\n axesGrp = groupdef('y-axes', {\n axes: encoding.has(Y) ? [axis.def(Y, encoding, layout, stats)] : undefined,\n y: hasRow && {scale: ROW, field: encoding.fieldRef(ROW)},\n x: hasRow && {value: 0},\n height: hasRow && {'value': layout.cellHeight}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(COL, encoding, layout, stats));\n } else { // doesn't have col\n if (encoding.has(Y)) {\n cellAxes.push(axis.def(Y, encoding, layout, stats));\n }\n }\n\n // assuming equal cellWidth here\n // TODO: support heterogenous cellWidth (maybe by using multiple scales?)\n spec.scales = (spec.scales || []).concat(scale.defs(\n scale.names(enter).concat(singleScaleNames),\n encoding,\n layout,\n stats,\n true\n )); // row/col scales + cell scales\n\n if (cellAxes.length > 0) {\n group.axes = cellAxes;\n }\n\n // add facet transform\n var trans = (group.from.transform || (group.from.transform = []));\n trans.unshift({type: 'facet', groupby: facetKeys});\n\n return spec;\n}\n","'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n time = require('./time'),\n d3_format = require('d3-format');\n\nmodule.exports = vllayout;\n\nfunction vllayout(encoding, stats) {\n var layout = box(encoding, stats);\n layout = offset(encoding, stats, layout);\n return layout;\n}\n\n/*\n HACK to set chart size\n NOTE: this fails for plots driven by derived values (e.g., aggregates)\n One solution is to update Vega to support auto-sizing\n In the meantime, auto-padding (mostly) does the trick\n */\nfunction box(encoding, stats) {\n var hasRow = encoding.has(ROW),\n hasCol = encoding.has(COL),\n hasX = encoding.has(X),\n hasY = encoding.has(Y),\n marktype = encoding.marktype();\n\n // FIXME/HACK we need to take filter into account\n var xCardinality = hasX && encoding.isDimension(X) ? encoding.cardinality(X, stats) : 1,\n yCardinality = hasY && encoding.isDimension(Y) ? encoding.cardinality(Y, stats) : 1;\n\n var useSmallBand = xCardinality > encoding.config('largeBandMaxCardinality') ||\n yCardinality > encoding.config('largeBandMaxCardinality');\n\n var cellWidth, cellHeight, cellPadding = encoding.config('cellPadding');\n\n // set cellWidth\n if (hasX) {\n if (encoding.isOrdinalScale(X)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellWidth = (xCardinality + encoding.encDef(X).band.padding) * encoding.bandSize(X, useSmallBand);\n } else {\n cellWidth = hasCol || hasRow ? encoding.encDef(COL).width : encoding.config('singleWidth');\n }\n } else {\n if (marktype === TEXT) {\n cellWidth = encoding.config('textCellWidth');\n } else {\n cellWidth = encoding.bandSize(X);\n }\n }\n\n // set cellHeight\n if (hasY) {\n if (encoding.isOrdinalScale(Y)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellHeight = (yCardinality + encoding.encDef(Y).band.padding) * encoding.bandSize(Y, useSmallBand);\n } else {\n cellHeight = hasCol || hasRow ? encoding.encDef(ROW).height : encoding.config('singleHeight');\n }\n } else {\n cellHeight = encoding.bandSize(Y);\n }\n\n // Cell bands use rangeBands(). There are n-1 padding. Outerpadding = 0 for cells\n\n var width = cellWidth, height = cellHeight;\n if (hasCol) {\n var colCardinality = encoding.cardinality(COL, stats);\n width = cellWidth * ((1 + cellPadding) * (colCardinality - 1) + 1);\n }\n if (hasRow) {\n var rowCardinality = encoding.cardinality(ROW, stats);\n height = cellHeight * ((1 + cellPadding) * (rowCardinality - 1) + 1);\n }\n\n return {\n // width and height of the whole cell\n cellWidth: cellWidth,\n cellHeight: cellHeight,\n cellPadding: cellPadding,\n // width and height of the chart\n width: width,\n height: height,\n // information about x and y, such as band size\n x: {useSmallBand: useSmallBand},\n y: {useSmallBand: useSmallBand}\n };\n}\n\n\n// FIXME fieldStats.max isn't always the longest\nfunction getMaxNumberLength(encoding, et, fieldStats) {\n var format = encoding.numberFormat(et, fieldStats);\n\n return d3_format.format(format)(fieldStats.max).length;\n}\n\n// TODO(#600) revise this\nfunction getMaxLength(encoding, stats, et) {\n var encDef = encoding.encDef(et),\n fieldStats = stats[encDef.name];\n\n if (encDef.bin) {\n // TODO once bin support range, need to update this\n return getMaxNumberLength(encoding, et, fieldStats);\n } if (encoding.isType(et, Q)) {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else if (encoding.isType(et, T)) {\n return time.maxLength(encoding.encDef(et).timeUnit, encoding);\n } else if (encoding.isTypes(et, [N, O])) {\n if(fieldStats.type === 'number') {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else {\n return Math.min(fieldStats.max, encoding.axis(et).maxLabelLength || Infinity);\n }\n }\n}\n\nfunction offset(encoding, stats, layout) {\n [X, Y].forEach(function (et) {\n // TODO(kanitw): Jul 19, 2015 - create a set of visual test for extraOffset\n var extraOffset = et === X ? 20 : 22,\n maxLength;\n if (encoding.isDimension(et) || encoding.isType(et, T)) {\n maxLength = getMaxLength(encoding, stats, et);\n } else if (\n // TODO once we have #512 (allow using inferred type)\n // Need to adjust condition here.\n encoding.isType(et, Q) ||\n encoding.encDef(et).aggregate === 'count'\n ) {\n if (\n et===Y\n // || (et===X && false)\n // FIXME determine when X would rotate, but should move this to axis.js first #506\n ) {\n maxLength = getMaxLength(encoding, stats, et);\n }\n } else {\n // nothing\n }\n\n if (maxLength) {\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * maxLength + extraOffset);\n } else {\n // if no max length (no rotation case), use maxLength = 3\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * 3 + extraOffset);\n }\n\n });\n return layout;\n}\n","'use strict';\n\nrequire('../globals');\n\nvar time = require('./time'),\n util = require('../util'),\n setter = util.setter,\n getter = util.getter;\n\nvar legend = module.exports = {};\n\nlegend.defs = function(encoding, style) {\n var defs = [];\n\n if (encoding.has(COLOR) && encoding.encDef(COLOR).legend) {\n defs.push(legend.def(COLOR, encoding, {\n fill: COLOR\n }, style));\n }\n\n if (encoding.has(SIZE) && encoding.encDef(SIZE).legend) {\n defs.push(legend.def(SIZE, encoding, {\n size: SIZE\n }, style));\n }\n\n if (encoding.has(SHAPE) && encoding.encDef(SHAPE).legend) {\n defs.push(legend.def(SHAPE, encoding, {\n shape: SHAPE\n }, style));\n }\n return defs;\n};\n\nlegend.def = function(name, encoding, def, style) {\n var timeUnit = encoding.encDef(name).timeUnit;\n\n def.title = legend.title(name, encoding);\n def.orient = encoding.encDef(name).legend.orient;\n\n def = legend.style(name, encoding, def, style);\n\n if (encoding.isType(name, T) &&\n timeUnit &&\n time.hasScale(timeUnit)\n ) {\n setter(def, ['properties', 'labels', 'text', 'scale'], 'time-'+ timeUnit);\n }\n\n return def;\n};\n\nlegend.style = function(name, e, def, style) {\n var symbols = getter(def, ['properties', 'symbols']),\n marktype = e.marktype();\n\n switch (marktype) {\n case 'bar':\n case 'tick':\n case 'text':\n symbols.stroke = {value: 'transparent'};\n symbols.shape = {value: 'square'};\n break;\n\n case 'circle':\n case 'square':\n symbols.shape = {value: marktype};\n /* fall through */\n case 'point':\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR) && name === COLOR) {\n symbols.fill = {scale: COLOR, field: 'data'};\n } else {\n symbols.fill = {value: e.value(COLOR)};\n }\n symbols.stroke = {value: 'transparent'};\n } else {\n if (e.has(COLOR) && name === COLOR) {\n symbols.stroke = {scale: COLOR, field: 'data'};\n } else {\n symbols.stroke = {value: e.value(COLOR)};\n }\n symbols.fill = {value: 'transparent'};\n symbols.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n break;\n case 'line':\n case 'area':\n // TODO use shape here after implementing #508\n break;\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) {\n symbols.opacity = {value: opacity};\n }\n return def;\n};\n\nlegend.title = function(name, encoding) {\n var leg = encoding.encDef(name).legend;\n\n if (leg.title) return leg.title;\n\n return encoding.fieldTitle(name);\n};\n","'use strict';\n\nrequire('../globals');\n\nvar marks = module.exports = {};\n\nmarks.def = function(encoding, layout, style, stats) {\n\n var defs = [],\n mark = marks[encoding.marktype()],\n from = encoding.dataTable();\n\n // to add a background to text, we need to add it before the text\n if (encoding.marktype() === TEXT && encoding.has(COLOR)) {\n var bg = {\n x: {value: 0},\n y: {value: 0},\n x2: {value: layout.cellWidth},\n y2: {value: layout.cellHeight},\n fill: {scale: COLOR, field: encoding.fieldRef(COLOR)}\n };\n defs.push({\n type: 'rect',\n from: {data: from},\n properties: {enter: bg, update: bg}\n });\n }\n\n // add the mark def for the main thing\n var p = mark.prop(encoding, layout, style, stats);\n defs.push({\n type: mark.type,\n from: {data: from},\n properties: {enter: p, update: p}\n });\n\n return defs;\n};\n\nmarks.bar = {\n type: 'rect',\n prop: bar_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1}\n};\n\nmarks.line = {\n type: 'line',\n line: true,\n prop: line_props,\n requiredEncoding: ['x', 'y'],\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail:1}\n};\n\nmarks.area = {\n type: 'area',\n line: true,\n requiredEncoding: ['x', 'y'],\n prop: area_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1}\n};\n\nmarks.tick = {\n type: 'rect',\n prop: tick_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail: 1}\n};\n\nmarks.circle = {\n type: 'symbol',\n prop: filled_point_props('circle'),\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, detail: 1}\n};\n\nmarks.square = {\n type: 'symbol',\n prop: filled_point_props('square'),\n supportedEncoding: marks.circle.supportedEncoding\n};\n\nmarks.point = {\n type: 'symbol',\n prop: point_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, shape: 1, detail: 1}\n};\n\nmarks.text = {\n type: 'text',\n prop: text_props,\n requiredEncoding: ['text'],\n supportedEncoding: {row: 1, col: 1, size: 1, color: 1, text: 1}\n};\n\nfunction bar_props(e, layout, style) {\n // jshint unused:false\n\n var p = {};\n\n // x's and width\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (!e.has(Y) || e.isDimension(Y)) {\n p.x2 = {value: 0};\n }\n } else {\n if (e.has(X)) { // is ordinal\n p.xc = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0, offset: e.config('singleBarOffset')};\n }\n }\n\n // width\n if (!p.x2) {\n if (!e.has(X) || e.isOrdinalScale(X)) { // no X or X is ordinal\n if (e.has(SIZE)) {\n p.width = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.width = {\n value: e.bandSize(X, layout.x.useSmallBand),\n offset: -1\n };\n }\n } else { // X is Quant or Time Scale\n p.width = {value: 2};\n }\n }\n\n // y's & height\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {field: {group: 'height'}};\n } else {\n if (e.has(Y)) { // is ordinal\n p.yc = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y2 = {\n field: {group: 'height'},\n offset: -e.config('singleBarOffset')\n };\n }\n\n if (e.has(SIZE)) {\n p.height = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.height = {\n value: e.bandSize(Y, layout.y.useSmallBand),\n offset: -1\n };\n }\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction point_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n if (e.has(SHAPE)) {\n p.shape = {scale: SHAPE, field: e.fieldRef(SHAPE)};\n } else if (!e.has(SHAPE)) {\n p.shape = {value: e.value(SHAPE)};\n }\n\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n } else {\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n p.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction line_props(e,layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {field: {group: 'height'}};\n }\n\n // stroke\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n p.strokeWidth = {value: e.config('strokeWidth')};\n\n return p;\n}\n\nfunction area_props(e, layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(Y)) {\n p.x2 = {scale: X, value: 0};\n p.orient = {value: 'horizontal'};\n }\n } else if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0};\n }\n\n // y\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {scale: Y, value: 0};\n } else if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y = {field: {group: 'height'}};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction tick_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(X)) {\n p.x.offset = -e.bandSize(X, layout.x.useSmallBand) / 3;\n }\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n if (e.isDimension(Y)) {\n p.y.offset = -e.bandSize(Y, layout.y.useSmallBand) / 3;\n }\n } else if (!e.has(Y)) {\n p.y = {value: 0};\n }\n\n // width\n if (!e.has(X) || e.isDimension(X)) {\n p.width = {value: e.bandSize(X, layout.y.useSmallBand) / 1.5};\n } else {\n p.width = {value: 1};\n }\n\n // height\n if (!e.has(Y) || e.isDimension(Y)) {\n p.height = {value: e.bandSize(Y, layout.y.useSmallBand) / 1.5};\n } else {\n p.height = {value: 1};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction filled_point_props(shape) {\n return function(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(X)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n p.shape = {value: shape};\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n };\n}\n\nfunction text_props(e, layout, style, stats) {\n var p = {},\n encDef = e.encDef(TEXT);\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n if (e.has(TEXT) && e.isType(TEXT, Q)) {\n p.x = {value: layout.cellWidth-5};\n } else {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.fontSize = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.fontSize = {value: encDef.font.size};\n }\n\n // fill\n // color should be set to background\n p.fill = {value: encDef.color};\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n // text\n if (e.has(TEXT)) {\n if (e.isType(TEXT, Q)) {\n var fieldStats = stats[e.encDef(TEXT).name],\n numberFormat = encDef.format || e.numberFormat(fieldStats);\n\n p.text = {template: '{{' + e.fieldRef(TEXT, {datum: true}) + ' | number:\\'' +\n numberFormat +'\\'}}'};\n p.align = {value: encDef.align};\n } else {\n p.text = {field: e.fieldRef(TEXT)};\n }\n } else {\n p.text = {value: encDef.placeholder};\n }\n\n p.font = {value: encDef.font.family};\n p.fontWeight = {value: encDef.font.weight};\n p.fontStyle = {value: encDef.font.style};\n p.baseline = {value: encDef.baseline};\n\n return p;\n}\n","'use strict';\nrequire('../globals');\nvar util = require('../util'),\n time = require('./time'),\n colorbrewer = require('colorbrewer'),\n interpolate = require('d3-color').interpolateHsl,\n schema = require('../schema/schema');\n\nvar scale = module.exports = {};\n\nscale.names = function(props) {\n return util.keys(util.keys(props).reduce(function(a, x) {\n if (props[x] && props[x].scale) a[props[x].scale] = 1;\n return a;\n }, {}));\n};\n\nscale.defs = function(names, encoding, layout, stats, facet) {\n return names.reduce(function(a, name) {\n var scaleDef = {};\n\n scaleDef.name = name;\n scaleDef.type = scale.type(name, encoding);\n scaleDef.domain = scale.domain(encoding, name, scaleDef.type, stats, facet);\n\n // add `reverse` if applicable\n var reverse = scale.reverse(encoding, name);\n if (reverse) {\n scaleDef.reverse = reverse;\n }\n\n scaleDef = scale.range(scaleDef, encoding, layout, stats);\n\n return (a.push(scaleDef), a);\n }, []);\n};\n\nscale.type = function(name, encoding) {\n switch (encoding.type(name)) {\n case N: //fall through\n case O: return 'ordinal';\n case T:\n var timeUnit = encoding.encDef(name).timeUnit;\n return timeUnit ? time.scale.type(timeUnit, name) : 'time';\n case Q:\n if (encoding.bin(name)) {\n // TODO: revise this\n return name === COLOR ? 'linear' : 'ordinal';\n }\n return encoding.scale(name).type;\n }\n};\n\nscale.domain = function (encoding, name, type, stats, facet) {\n var encDef = encoding.encDef(name);\n\n // special case for temporal scale\n if (encoding.isType(name, T)) {\n var range = time.scale.domain(encDef.timeUnit, name);\n if (range) return range;\n }\n\n // For binned, produce fixed stepped domain.\n // TODO(#614): this must be changed in vg2\n if (encDef.bin) {\n\n var fieldStat = stats[encDef.name],\n bins = util.getbins(fieldStat, encDef.bin.maxbins || schema.MAXBINS_DEFAULT),\n numbins = (bins.stop - bins.start) / bins.step;\n return util.range(numbins).map(function(i) {\n return bins.start + bins.step * i;\n });\n }\n\n // For stack, use STACKED data.\n var stack = encoding.stack();\n if (stack && name === stack.value) {\n return {\n data: STACKED,\n field: encoding.fieldRef(name, {\n // If faceted, scale is determined by the max of sum in each facet.\n prefn: (facet ? 'max_' : '') + 'sum_'\n })\n };\n }\n\n var useRawDomain = scale._useRawDomain(encoding, name);\n var sort = scale.sort(encoding, name, type);\n\n if (useRawDomain) {\n return {\n data: RAW,\n field: encoding.fieldRef(name, {noAggregate:true})\n };\n } else if (sort) { // have sort\n return {\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: sort.op ? RAW : encoding.dataTable(),\n field: encoding.fieldRef(name),\n sort: sort\n };\n } else {\n return {\n data: encoding.dataTable(),\n field: encoding.fieldRef(name)\n };\n }\n};\n\nscale.sort = function(encoding, name, type) {\n var sort = encoding.encDef(name).sort;\n if (sort === 'ascending' || sort === 'descending') {\n return true;\n }\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (type === 'ordinal' && util.isObject(sort)) {\n return {\n op: sort.op,\n field: sort.field\n };\n }\n return undefined;\n};\n\nscale.reverse = function(encoding, name) {\n var sort = encoding.encDef(name).sort;\n return sort && (sort === 'descending' || (sort.order === 'descending'));\n};\n\n/**\n * Determine if useRawDomain should be activated for this scale.\n * @return {Boolean} Returns true if all of the following conditons applies:\n * 1. `useRawDomain` is enabled either through scale or config\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nscale._useRawDomain = function (encoding, name) {\n var encDef = encoding.encDef(name);\n\n // scale value\n var scaleUseRawDomain = encoding.scale(name).useRawDomain;\n\n // Determine if useRawDomain is enabled. If scale value is specified, use scale value.\n // Otherwise, use config value.\n var useRawDomainEnabled = scaleUseRawDomain !== undefined ?\n scaleUseRawDomain : encoding.config('useRawDomain');\n\n var notCountOrSum = !encDef.aggregate ||\n (encDef.aggregate !=='count' && encDef.aggregate !== 'sum');\n\n return useRawDomainEnabled &&\n notCountOrSum && (\n // Q always uses quantitative scale except when it's binned and thus uses ordinal scale.\n (\n encoding.isType(name, Q) &&\n !encDef.bin // TODO(#614): this must be changed once bin is reimplemented\n ) ||\n // TODO: revise this\n // T uses non-ordinal scale when there's no unit or when the unit is not ordinal.\n (\n encoding.isType(name, T) &&\n (!encDef.timeUnit || !time.isOrdinalFn(encDef.timeUnit))\n )\n );\n};\n\n\nscale.range = function (scaleDef, encoding, layout, stats) {\n var spec = encoding.scale(scaleDef.name),\n encDef = encoding.encDef(scaleDef.name),\n timeUnit = encDef.timeUnit;\n\n switch (scaleDef.name) {\n case X:\n scaleDef.range = layout.cellWidth ? [0, layout.cellWidth] : 'width';\n if (scaleDef.type === 'ordinal') {\n scaleDef.bandWidth = encoding.bandSize(X, layout.x.useSmallBand);\n } else {\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n scaleDef.round = true;\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case Y:\n if (scaleDef.type === 'ordinal') {\n scaleDef.range = layout.cellHeight ?\n (encDef.bin ? [layout.cellHeight, 0] : [0, layout.cellHeight]) :\n 'height';\n scaleDef.bandWidth = encoding.bandSize(Y, layout.y.useSmallBand);\n } else {\n scaleDef.range = layout.cellHeight ? [layout.cellHeight, 0] : 'height';\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n\n scaleDef.round = true;\n\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case ROW: // support only ordinal\n scaleDef.bandWidth = layout.cellHeight;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case COL: // support only ordinal\n scaleDef.bandWidth = layout.cellWidth;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case SIZE:\n if (encoding.is('bar')) {\n // FIXME this is definitely incorrect\n // but let's fix it later since bar size is a bad encoding anyway\n scaleDef.range = [3, Math.max(encoding.bandSize(X), encoding.bandSize(Y))];\n } else if (encoding.is(TEXT)) {\n scaleDef.range = [8, 40];\n } else { //point\n var bandSize = Math.min(encoding.bandSize(X), encoding.bandSize(Y)) - 1;\n scaleDef.range = [10, 0.8 * bandSize*bandSize];\n }\n scaleDef.round = true;\n scaleDef.zero = false;\n break;\n case SHAPE:\n scaleDef.range = 'shapes';\n break;\n case COLOR:\n scaleDef.range = scale.color(scaleDef, encoding, stats);\n if (scaleDef.type !== 'ordinal') scaleDef.zero = false;\n break;\n default:\n throw new Error('Unknown encoding name: '+ scaleDef.name);\n }\n\n // FIXME(kanitw): Jul 29, 2015 - consolidate this with above\n switch (scaleDef.name) {\n case ROW:\n case COL:\n scaleDef.padding = encoding.config('cellPadding');\n scaleDef.outerPadding = 0;\n break;\n case X:\n case Y:\n if (scaleDef.type === 'ordinal') { //&& !s.bandWidth\n scaleDef.points = true;\n scaleDef.padding = encoding.encDef(scaleDef.name).band.padding;\n }\n }\n\n return scaleDef;\n};\n\nscale.color = function(s, encoding, stats) {\n var colorScale = encoding.scale(COLOR),\n range = colorScale.range,\n cardinality = encoding.cardinality(COLOR, stats),\n type = encoding.type(COLOR);\n\n if (range === undefined) {\n var ordinalPalette = colorScale.ordinalPalette,\n quantitativeRange = colorScale.quantitativeRange;\n\n if (s.type === 'ordinal') {\n if (type === N) {\n // use categorical color scale\n if (cardinality <= 10) {\n range = colorScale.c10palette;\n } else {\n range = colorScale.c20palette;\n }\n return scale.color.palette(range, cardinality, type);\n } else {\n if (ordinalPalette) {\n return scale.color.palette(ordinalPalette, cardinality, type);\n }\n return scale.color.interpolate(quantitativeRange[0], quantitativeRange[1], cardinality);\n }\n } else { //time or quantitative\n return [quantitativeRange[0], quantitativeRange[1]];\n }\n }\n};\n\nscale.color.palette = function(range, cardinality, type) {\n // FIXME(kanitw): Jul 29, 2015 - check range is string\n switch (range) {\n case 'category10k':\n // tableau's category 10, ordered by perceptual kernel study results\n // https://github.com/uwdata/perceptual-kernels\n return ['#2ca02c', '#e377c2', '#7f7f7f', '#17becf', '#8c564b', '#d62728', '#bcbd22', '#9467bd', '#ff7f0e', '#1f77b4'];\n\n // d3/tableau category10/20/20b/20c\n case 'category10':\n return ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'];\n\n case 'category20':\n return ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'];\n\n case 'category20b':\n return ['#393b79', '#5254a3', '#6b6ecf', '#9c9ede', '#637939', '#8ca252', '#b5cf6b', '#cedb9c', '#8c6d31', '#bd9e39', '#e7ba52', '#e7cb94', '#843c39', '#ad494a', '#d6616b', '#e7969c', '#7b4173', '#a55194', '#ce6dbd', '#de9ed6'];\n\n case 'category20c':\n return ['#3182bd', '#6baed6', '#9ecae1', '#c6dbef', '#e6550d', '#fd8d3c', '#fdae6b', '#fdd0a2', '#31a354', '#74c476', '#a1d99b', '#c7e9c0', '#756bb1', '#9e9ac8', '#bcbddc', '#dadaeb', '#636363', '#969696', '#bdbdbd', '#d9d9d9'];\n }\n\n // TODO add our own set of custom ordinal color palette\n\n if (range in colorbrewer) {\n var palette = colorbrewer[range];\n\n // if cardinality pre-defined, use it.\n if (cardinality in palette) return palette[cardinality];\n\n // if not, use the highest cardinality one for nominal\n if (type === N) {\n return palette[Math.max.apply(null, util.keys(palette))];\n }\n\n // otherwise, interpolate\n var ps = cardinality < 3 ? 3 : Math.max.apply(null, util.keys(palette)),\n from = 0 , to = ps - 1;\n // FIXME add config for from / to\n\n return scale.color.interpolate(palette[ps][from], palette[ps][to], cardinality);\n }\n\n return range;\n};\n\nscale.color.interpolate = function (start, end, cardinality) {\n\n var interpolator = interpolate(start, end);\n return util.range(cardinality).map(function(i) { return interpolator(i*1.0/(cardinality-1)); });\n};\n","'use strict';\n\nrequire('../globals');\n\nmodule.exports = stacking;\n\nfunction stacking(encoding, mdef, stack) {\n var groupby = stack.groupby;\n var field = stack.value;\n\n var valName = encoding.fieldRef(field);\n var startField = valName + '_start';\n var endField = valName + '_end';\n\n // add stack transform to mark\n var transform = {\n type: 'stack',\n groupby: [encoding.fieldRef(groupby)],\n field: encoding.fieldRef(field),\n sortby: [(stack.properties.reverse ? '' : '-') + encoding.fieldRef(stack.stack)],\n output: {start: startField, end: endField}\n };\n\n if (stack.properties.offset) {\n transform.offset = stack.properties.offset;\n }\n\n mdef.from.transform = [transform];\n\n // TODO(#276): This is super hack-ish -- consolidate into modular mark properties?\n mdef.properties.update[field] = mdef.properties.enter[field] = {\n scale: field,\n field: startField\n };\n mdef.properties.update[field + '2'] = mdef.properties.enter[field + '2'] = {\n scale: field,\n field: endField\n };\n\n return field; //return stack encoding\n}\n","'use strict';\n\nrequire('../globals');\n\nvar vlEncDef = require('../encdef');\n\nmodule.exports = function(encoding, stats) {\n return {\n opacity: estimateOpacity(encoding, stats),\n };\n};\n\nfunction estimateOpacity(encoding,stats) {\n if (!stats) {\n return 1;\n }\n\n var numPoints = 0;\n\n if (encoding.isAggregate()) { // aggregate plot\n numPoints = 1;\n\n // get number of points in each \"cell\"\n // by calculating product of cardinality\n // for each non faceting and non-ordinal X / Y fields\n // note that ordinal x,y are not include since we can\n // consider that ordinal x are subdividing the cell into subcells anyway\n encoding.forEach(function(encDef, encType) {\n\n if (encType !== ROW && encType !== COL &&\n !((encType === X || encType === Y) &&\n vlEncDef.isOrdinalScale(encDef))\n ) {\n numPoints *= encoding.cardinality(encType, stats);\n }\n });\n\n } else { // raw plot\n\n // TODO: error handling\n if (!stats['*'])\n return 1;\n\n numPoints = stats['*'].max; // count\n\n // small multiples divide number of points\n var numMultiples = 1;\n if (encoding.has(ROW)) {\n numMultiples *= encoding.cardinality(ROW, stats);\n }\n if (encoding.has(COL)) {\n numMultiples *= encoding.cardinality(COL, stats);\n }\n numPoints /= numMultiples;\n }\n\n var opacity = 0;\n if (numPoints <= 25) {\n opacity = 1;\n } else if (numPoints < 200) {\n opacity = 0.8;\n } else if (numPoints < 1000 || encoding.is('tick')) {\n opacity = 0.7;\n } else {\n opacity = 0.3;\n }\n\n return opacity;\n}\n\n","'use strict';\n\nrequire('../globals');\n\nmodule.exports = subfaceting;\n\nfunction subfaceting(group, mdef, details, encoding) {\n var m = group.marks;\n var g = {\n name: 'subfacet',\n type: 'group',\n from: mdef.from,\n properties: {\n enter: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n marks: m\n };\n\n group.marks = [g];\n delete mdef.from; // (move to the new g)\n\n //TODO test LOD -- we should support stack / line without color (LOD) field\n var trans = (g.from.transform || (g.from.transform = []));\n trans.push({type: 'facet', groupby: details});\n\n // TODO: understand why we need this sort transform and write comment\n var stack = encoding.stack();\n if (stack && encoding.has(COLOR)) {\n trans.unshift({type: 'sort', by: encoding.fieldRef(COLOR)});\n }\n}\n","'use strict';\n\nvar util = require('../util'),\n d3_time_format = require('d3-time-format');\n\nvar time = module.exports = {};\n\n// 'Wednesday September 17 04:00:00 2014'\n// Wednesday is the longest date\n// September is the longest month (8 in javascript as it is zero-indexed).\nvar LONG_DATE = new Date(Date.UTC(2014, 8, 17));\n\ntime.cardinality = function(encDef, stats, filterNull, type) {\n var timeUnit = encDef.timeUnit;\n switch (timeUnit) {\n case 'seconds': return 60;\n case 'minutes': return 60;\n case 'hours': return 24;\n case 'day': return 7;\n case 'date': return 31;\n case 'month': return 12;\n case 'year':\n var stat = stats[encDef.name],\n yearstat = stats['year_' + encDef.name];\n\n if (!yearstat) { return null; }\n\n return yearstat.distinct -\n (stat.missing > 0 && filterNull[type] ? 1 : 0);\n }\n\n return null;\n};\n\ntime.formula = function(timeUnit, fieldRef) {\n // TODO(kanitw): add formula to other time format\n var fn = 'utc' + timeUnit;\n return fn + '(' + fieldRef + ')';\n};\n\ntime.maxLength = function(timeUnit, encoding) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'date':\n return 2;\n case 'month':\n case 'day':\n var range = time.range(timeUnit, encoding);\n if (range) {\n // return the longest name in the range\n return Math.max.apply(null, range.map(function(r) {return r.length;}));\n }\n return 2;\n case 'year':\n return 4; //'1998'\n }\n // TODO(#600) revise this\n // no time unit\n var timeFormat = encoding.config('timeFormat');\n return d3_time_format.utcFormat(timeFormat)(LONG_DATE).length;\n};\n\ntime.range = function(timeUnit, encoding) {\n var labelLength = encoding.config('timeScaleLabelLength'),\n scaleLabel;\n switch (timeUnit) {\n case 'day':\n scaleLabel = encoding.config('dayScaleLabel');\n break;\n case 'month':\n scaleLabel = encoding.config('monthScaleLabel');\n break;\n }\n if (scaleLabel) {\n return labelLength ? scaleLabel.map(\n function(s) { return s.substr(0, labelLength);}\n ) : scaleLabel;\n }\n return;\n};\n\n\n/**\n * @param {Object} encoding\n * @return {Array} scales for time unit names\n */\ntime.scales = function(encoding) {\n var scales = encoding.reduce(function(scales, encDef) {\n var timeUnit = encDef.timeUnit;\n if (encDef.type === T && timeUnit && !scales[timeUnit]) {\n var scale = time.scale.def(encDef.timeUnit, encoding);\n if (scale) scales[timeUnit] = scale;\n }\n return scales;\n }, {});\n\n return util.vals(scales);\n};\n\n\ntime.scale = {};\n\n/** append custom time scales for axis label */\ntime.scale.def = function(timeUnit, encoding) {\n var range = time.range(timeUnit, encoding);\n\n if (range) {\n return {\n name: 'time-'+timeUnit,\n type: 'ordinal',\n domain: time.scale.domain(timeUnit),\n range: range\n };\n }\n return null;\n};\n\ntime.isOrdinalFn = function(timeUnit) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'day':\n case 'date':\n case 'month':\n return true;\n }\n return false;\n};\n\ntime.scale.type = function(timeUnit, name) {\n if (name === COLOR) {\n return 'linear'; // time has order, so use interpolated ordinal color scale.\n }\n\n return time.isOrdinalFn(timeUnit) || name === COL || name === ROW ? 'ordinal' : 'linear';\n};\n\ntime.scale.domain = function(timeUnit, name) {\n var isColor = name === COLOR;\n switch (timeUnit) {\n case 'seconds':\n case 'minutes': return isColor ? [0,59] : util.range(0, 60);\n case 'hours': return isColor ? [0,23] : util.range(0, 24);\n case 'day': return isColor ? [0,6] : util.range(0, 7);\n case 'date': return isColor ? [1,31] : util.range(1, 32);\n case 'month': return isColor ? [0,11] : util.range(0, 12);\n }\n return null;\n};\n\n/** whether a particular time function has custom scale for labels implemented in time.scale */\ntime.hasScale = function(timeUnit) {\n switch (timeUnit) {\n case 'day':\n case 'month':\n return true;\n }\n return false;\n};\n","'use strict';\n\nrequire('./globals');\n\nvar consts = module.exports = {};\n\nconsts.encodingTypes = [X, Y, ROW, COL, SIZE, SHAPE, COLOR, TEXT, DETAIL];\n\nconsts.shorthand = {\n delim: '|',\n assign: '=',\n type: ',',\n func: '_'\n};\n","'use strict';\n\nrequire('./globals');\n\nvar stats = require('datalib/src/stats');\n\nvar vldata = module.exports = {};\n\n/** Mapping from datalib's inferred type to Vega-lite's type */\nvldata.types = {\n 'boolean': N,\n 'number': Q,\n 'integer': Q,\n 'date': T,\n 'string': N\n};\n\nvldata.stats = function(data) {\n var summary = stats.summary(data);\n\n return summary.reduce(function(s, profile) {\n s[profile.field] = profile;\n return s;\n }, {\n '*': {\n max: data.length,\n min: 0\n }\n });\n};","// utility for enc\n\n'use strict';\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n vlEncDef = require('./encdef'),\n util = require('./util'),\n schema = require('./schema/schema'),\n encTypes = schema.encTypes;\n\nvar vlenc = module.exports = {};\n\nvlenc.countRetinal = function(enc) {\n var count = 0;\n if (enc.color) count++;\n if (enc.size) count++;\n if (enc.shape) count++;\n return count;\n};\n\nvlenc.has = function(enc, encType) {\n var fieldDef = enc && enc[encType];\n return fieldDef && fieldDef.name;\n};\n\nvlenc.isAggregate = function(enc) {\n for (var k in enc) {\n if (vlenc.has(enc, k) && enc[k].aggregate) {\n return true;\n }\n }\n return false;\n};\n\nvlenc.forEach = function(enc, f) {\n var i = 0;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n f(enc[k], k, i++);\n }\n });\n};\n\nvlenc.map = function(enc, f) {\n var arr = [];\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n arr.push(f(enc[k], k, enc));\n }\n });\n return arr;\n};\n\nvlenc.reduce = function(enc, f, init) {\n var r = init;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n r = f(r, enc[k], k, enc);\n }\n });\n return r;\n};\n\n/*\n * return key-value pairs of field name and list of fields of that field name\n */\nvlenc.fields = function(enc) {\n return vlenc.reduce(enc, function (m, field) {\n var fieldList = m[field.name] = m[field.name] || [],\n containsType = fieldList.containsType = fieldList.containsType || {};\n\n if (fieldList.indexOf(field) === -1) {\n fieldList.push(field);\n // augment the array with containsType.Q / O / N / T\n containsType[field.type] = true;\n }\n return m;\n }, {});\n};\n\nvlenc.shorthand = function(enc) {\n return vlenc.map(enc, function(field, et) {\n return et + c.assign + vlEncDef.shorthand(field);\n }).join(c.delim);\n};\n\nvlenc.fromShorthand = function(shorthand) {\n var enc = util.isArray(shorthand) ? shorthand : shorthand.split(c.delim);\n return enc.reduce(function(m, e) {\n var split = e.split(c.assign),\n enctype = split[0].trim(),\n field = split[1];\n\n m[enctype] = vlEncDef.fromShorthand(field);\n return m;\n }, {});\n};\n","'use strict';\n\n// utility for field\n\nrequire('./globals');\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n time = require('./compiler/time'),\n util = require('./util'),\n schema = require('./schema/schema');\n\nvar vlfield = module.exports = {};\n\n/**\n * @param field\n * @param opt\n * opt.nofn -- exclude bin, aggregate, timeUnit\n * opt.noAggregate -- exclude aggregation function\n * opt.datum - include 'datum.'\n * opt.fn - replace fn with custom function prefix\n * opt.prefn - prepend fn with custom function prefix\n\n * @return {[type]} [description]\n */\nvlfield.fieldRef = function(field, opt) {\n opt = opt || {};\n\n var f = (opt.datum ? 'datum.' : '') + (opt.prefn || ''),\n name = field.name;\n\n if (vlfield.isCount(field)) {\n return f + 'count';\n } else if (opt.fn) {\n return f + opt.fn + '_' + name;\n } else if (!opt.nofn && field.bin) {\n return f + 'bin_' + name;\n } else if (!opt.nofn && !opt.noAggregate && field.aggregate) {\n return f + field.aggregate + '_' + name;\n } else if (!opt.nofn && field.timeUnit) {\n return f + field.timeUnit + '_' + name;\n } else {\n return f + name;\n }\n};\n\nvlfield.shorthand = function(f) {\n var c = consts.shorthand;\n return (f.aggregate ? f.aggregate + c.func : '') +\n (f.timeUnit ? f.timeUnit + c.func : '') +\n (f.bin ? 'bin' + c.func : '') +\n (f.name || '') + c.type + f.type;\n};\n\nvlfield.shorthands = function(fields, delim) {\n delim = delim || c.delim;\n return fields.map(vlfield.shorthand).join(delim);\n};\n\nvlfield.fromShorthand = function(shorthand) {\n var split = shorthand.split(c.type), i;\n var o = {\n name: split[0].trim(),\n type: split[1].trim()\n };\n\n // check aggregate type\n for (i in schema.aggregate.enum) {\n var a = schema.aggregate.enum[i];\n if (o.name.indexOf(a + '_') === 0) {\n o.name = o.name.substr(a.length + 1);\n if (a == 'count' && o.name.length === 0) o.name = '*';\n o.aggregate = a;\n break;\n }\n }\n\n // check time timeUnit\n for (i in schema.timefns) {\n var tu = schema.timefns[i];\n if (o.name && o.name.indexOf(tu + '_') === 0) {\n o.name = o.name.substr(o.length + 1);\n o.timeUnit = tu;\n break;\n }\n }\n\n // check bin\n if (o.name && o.name.indexOf('bin_') === 0) {\n o.name = o.name.substr(4);\n o.bin = true;\n }\n\n return o;\n};\n\nvar isType = vlfield.isType = function (fieldDef, type) {\n return fieldDef.type === type;\n};\n\nvar isTypes = vlfield.isTypes = function (fieldDef, types) {\n for (var t=0; t 0 && filterNull[type] ? 1 : 0);\n};\n","'use strict';\n\n// declare global constant\nvar g = global || window;\n\ng.AGGREGATE = 'aggregate';\ng.RAW = 'raw';\ng.STACKED = 'stacked';\ng.INDEX = 'index';\n\ng.X = 'x';\ng.Y = 'y';\ng.ROW = 'row';\ng.COL = 'col';\ng.SIZE = 'size';\ng.SHAPE = 'shape';\ng.COLOR = 'color';\ng.TEXT = 'text';\ng.DETAIL = 'detail';\n\ng.N = 'N';\ng.O = 'O';\ng.Q = 'Q';\ng.T = 'T';\n","'use strict';\n\n// TODO(kanitw): chat with Vega team and possibly move this to vega-logging\nmodule.exports = function(prefix) {\n // Borrowed some ideas from http://stackoverflow.com/a/15653260/866989\n // and https://github.com/patik/console.log-wrapper/blob/master/consolelog.js\n var METHODS = ['error', 'info', 'debug', 'warn', 'log'];\n\n return METHODS.reduce(function(logger, fn) {\n var cfn = console[fn] ? fn : 'log';\n if (console[cfn].bind === 'undefined') { // IE < 10\n logger[fn] = Function.prototype.bind.call(console[cfn], console, prefix);\n }\n else {\n logger[fn] = console[cfn].bind(console, prefix);\n }\n return logger;\n }, {});\n};","// Package of defining Vega-lite Specification's json schema\n'use strict';\n\nrequire('../globals');\n\nvar schema = module.exports = {},\n util = require('../util'),\n toMap = util.toMap,\n colorbrewer = require('colorbrewer');\n\nvar VALID_AGG_OPS = require('vega/src/transforms/Aggregate').VALID_OPS;\n\n// TODO(#620) refer to vega schema\n// var vgStackSchema = require('vega/src/transforms/Stack').schema;\n\n\nschema.util = require('./schemautil');\n\nschema.marktype = {\n type: 'string',\n enum: ['point', 'tick', 'bar', 'line', 'area', 'circle', 'square', 'text']\n};\n\nschema.aggregate = {\n type: 'string',\n enum: VALID_AGG_OPS,\n supportedEnums: {\n Q: VALID_AGG_OPS,\n O: ['median','min','max'],\n N: [],\n T: ['mean', 'median', 'min', 'max'],\n '': ['count']\n },\n supportedTypes: toMap([Q, N, O, T, ''])\n};\n\nschema.getSupportedRole = function(encType) {\n return schema.schema.properties.encoding.properties[encType].supportedRole;\n};\n\nschema.timeUnits = ['year', 'month', 'day', 'date', 'hours', 'minutes', 'seconds'];\n\nschema.defaultTimeFn = 'month';\n\nschema.timeUnit = {\n type: 'string',\n enum: schema.timeUnits,\n supportedTypes: toMap([T])\n};\n\nschema.scale_type = {\n type: 'string',\n // TODO(kanitw) read vega's schema here, add description\n enum: ['linear', 'log', 'pow', 'sqrt', 'quantile'],\n default: 'linear',\n supportedTypes: toMap([Q])\n};\n\nschema.field = {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n }\n }\n};\n\nvar clone = util.duplicate;\nvar merge = schema.util.merge;\n\nschema.MAXBINS_DEFAULT = 15;\n\nvar bin = {\n type: ['boolean', 'object'],\n default: false,\n properties: {\n maxbins: {\n type: 'integer',\n default: schema.MAXBINS_DEFAULT,\n minimum: 2,\n description: 'Maximum number of bins.'\n }\n },\n supportedTypes: toMap([Q]) // TODO: add O after finishing #81\n};\n\nvar typicalField = merge(clone(schema.field), {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T]\n },\n aggregate: schema.aggregate,\n timeUnit: schema.timeUnit,\n bin: bin,\n scale: {\n type: 'object',\n properties: {\n /* Common Scale Properties */\n type: schema.scale_type,\n\n /* Quantitative Scale Properties */\n nice: {\n type: 'string',\n enum: ['second', 'minute', 'hour', 'day', 'week', 'month', 'year'],\n supportedTypes: toMap([T])\n },\n zero: {\n type: 'boolean',\n description: 'Include zero',\n default: true,\n supportedTypes: toMap([Q, T])\n },\n\n /* Vega-lite only Properties */\n useRawDomain: {\n type: 'boolean',\n default: undefined,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n }\n }\n});\n\nvar onlyOrdinalField = merge(clone(schema.field), {\n type: 'object',\n supportedRole: {\n dimension: true\n },\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T] // ordinal-only field supports Q when bin is applied and T when time unit is applied.\n },\n timeUnit: schema.timeUnit,\n bin: bin,\n aggregate: {\n type: 'string',\n enum: ['count'],\n supportedTypes: toMap([N, O]) // FIXME this looks weird to me\n }\n }\n});\n\nvar axisMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true},\n properties: {\n axis: {\n type: 'object',\n properties: {\n /* Vega Axis Properties */\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for axis labels. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n grid: {\n type: 'boolean',\n default: undefined,\n description: 'A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise.'\n },\n layer: {\n type: 'string',\n default: 'back',\n description: 'A string indicating if the axis (and any gridlines) should be placed above or below the data marks. One of \"front\" (default) or \"back\".'\n },\n orient: {\n type: 'string',\n default: undefined,\n enum: ['top', 'right', 'left', 'bottom'],\n 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 for the right edge of the chart).'\n },\n ticks: {\n type: 'integer',\n default: 5,\n minimum: 0,\n 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 },\n /* Vega Axis Properties that are automatically populated by Vega-lite */\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the axis. (Shows field name and its function by default.)'\n },\n /* Vega-lite only */\n maxLabelLength: {\n type: 'integer',\n default: 25,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n },\n labelAngle: {\n type: 'integer',\n default: undefined, // auto\n minimum: 0,\n maximum: 360,\n description: 'Angle by which to rotate labels. Set to 0 to force horizontal.'\n },\n titleMaxLength: {\n type: 'integer',\n default: undefined,\n minimum: 0,\n description: 'Max length for axis title if the title is automatically generated from the field\\'s description'\n },\n titleOffset: {\n type: 'integer',\n default: undefined, // auto\n description: 'A title offset value for the axis.'\n },\n }\n }\n }\n};\n\nvar sortMixin = {\n type: 'object',\n properties: {\n sort: {\n default: undefined,\n supportedTypes: toMap([N, O]),\n oneOf: [\n {\n type: 'string',\n enum: ['ascending', 'descending']\n },\n { // sort by aggregation of another field\n type: 'object',\n required: ['field', 'op'],\n properties: {\n field: {\n type: 'string',\n description: 'The field name to aggregate over.'\n },\n op: {\n type: 'string',\n enum: VALID_AGG_OPS,\n description: 'The field name to aggregate over.'\n },\n order: {\n type: 'string',\n enum: ['ascending', 'descending']\n }\n }\n }\n ]\n\n }\n }\n};\n\nvar bandMixin = {\n type: 'object',\n properties: {\n band: {\n type: 'object',\n properties: {\n size: {\n type: 'integer',\n minimum: 0,\n default: undefined\n },\n padding: {\n type: 'integer',\n minimum: 0,\n default: 1\n }\n }\n }\n }\n};\n\nvar legendMixin = {\n type: 'object',\n properties: {\n legend: {\n type: 'object',\n description: 'Properties of a legend.',\n properties: {\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the legend. (Shows field name and its function by default.)'\n },\n orient: {\n type: 'string',\n default: 'right',\n description: 'The orientation of the legend. One of \"left\" or \"right\". This determines how the legend is positioned within the scene. The default is \"right\".'\n }\n }\n }\n }\n};\n\nvar textMixin = {\n type: 'object',\n supportedMarktypes: {'text': true},\n properties: {\n align: {\n type: 'string',\n default: 'right'\n },\n baseline: {\n type: 'string',\n default: 'middle'\n },\n color: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n margin: {\n type: 'integer',\n default: 4,\n minimum: 0\n },\n placeholder: {\n type: 'string',\n default: 'Abc'\n },\n font: {\n type: 'object',\n properties: {\n weight: {\n type: 'string',\n enum: ['normal', 'bold'],\n default: 'normal'\n },\n size: {\n type: 'integer',\n default: 10,\n minimum: 0\n },\n family: {\n type: 'string',\n default: 'Helvetica Neue'\n },\n style: {\n type: 'string',\n default: 'normal',\n enum: ['normal', 'italic']\n }\n }\n },\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for text value. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n }\n};\n\nvar sizeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, bar: true, circle: true, square: true, text: true},\n properties: {\n value: {\n type: 'integer',\n default: 30,\n minimum: 0,\n description: 'Size of marks.'\n }\n }\n};\n\nvar colorMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, 'text': true},\n properties: {\n value: {\n type: 'string',\n role: 'color',\n default: '#4682b4',\n description: 'Color to be used for marks.'\n },\n opacity: {\n type: 'number',\n default: undefined, // auto\n minimum: 0,\n maximum: 1\n },\n scale: {\n type: 'object',\n properties: {\n range: {\n type: ['string', 'array'],\n default: undefined,\n description:\n 'Color palette, if undefined vega-lite will use data property' +\n 'to pick one from c10palette, c20palette, or ordinalPalette.'\n //FIXME\n },\n c10palette: {\n type: 'string',\n default: 'category10',\n enum: [\n // Tableau\n 'category10', 'category10k',\n // Color Brewer\n 'Pastel1', 'Pastel2', 'Set1', 'Set2', 'Set3'\n ]\n },\n c20palette: {\n type: 'string',\n default: 'category20',\n enum: ['category20', 'category20b', 'category20c']\n },\n ordinalPalette: {\n type: 'string',\n default: undefined,\n description: 'Color palette to encode ordinal variables.',\n enum: util.keys(colorbrewer)\n },\n quantitativeRange: {\n type: 'array',\n default: ['#AFC6A3', '#09622A'], // tableau greens\n // default: ['#ccece6', '#00441b'], // BuGn.9 [2-8]\n description: 'Color range to encode quantitative variables.',\n minItems: 2,\n maxItems: 2,\n items: {\n type: 'string',\n role: 'color'\n }\n }\n }\n }\n }\n};\n\nvar stackMixin = {\n type: 'object',\n properties: {\n stack: {\n type: ['boolean', 'object'],\n default: true,\n description: 'Enable stacking (for bar and area marks only).',\n properties: {\n reverse: {\n type: 'boolean',\n default: false,\n description: 'Whether to reverse the stack\\'s sortby.'\n },\n offset: {\n type: 'string',\n default: undefined,\n enum: ['zero', 'center', 'normalize']\n // TODO(#620) refer to Vega spec once it doesn't throw error\n // enum: vgStackSchema.properties.offset.oneOf[0].enum\n }\n }\n }\n }\n};\n\nvar shapeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, circle: true, square: true},\n properties: {\n value: {\n type: 'string',\n enum: ['circle', 'square', 'cross', 'diamond', 'triangle-up', 'triangle-down'],\n default: 'circle',\n description: 'Mark to be used.'\n },\n filled: {\n type: 'boolean',\n default: false,\n description: 'Whether the shape\\'s color should be used as fill color instead of stroke color.'\n }\n }\n};\n\nvar detailMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, line: true, circle: true, square: true}\n};\n\nvar rowMixin = {\n properties: {\n height: {\n type: 'number',\n minimum: 0,\n default: 150\n }\n }\n};\n\nvar colMixin = {\n properties: {\n width: {\n type: 'number',\n minimum: 0,\n default: 150\n },\n axis: {\n properties: {\n maxLabelLength: {\n type: 'integer',\n default: 12,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n }\n }\n }\n }\n};\n\nvar facetMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, text: true},\n properties: {\n padding: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.1\n }\n }\n};\n\nvar requiredNameType = {\n required: ['name', 'type']\n};\n\nvar multiRoleField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: true\n }\n});\n\nvar quantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: 'ordinal-only' // using size to encoding category lead to order interpretation\n }\n});\n\nvar onlyQuantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true\n }\n});\n\nvar x = merge(clone(multiRoleField), axisMixin, bandMixin, requiredNameType, sortMixin);\nvar y = clone(x);\n\nvar facet = merge(clone(onlyOrdinalField), requiredNameType, facetMixin, sortMixin);\nvar row = merge(clone(facet), axisMixin, rowMixin);\nvar col = merge(clone(facet), axisMixin, colMixin);\n\nvar size = merge(clone(quantitativeField), legendMixin, sizeMixin, sortMixin);\nvar color = merge(clone(multiRoleField), legendMixin, colorMixin, stackMixin, sortMixin);\n\nvar shape = merge(clone(onlyOrdinalField), legendMixin, shapeMixin, sortMixin);\nvar detail = merge(clone(onlyOrdinalField), detailMixin, stackMixin, sortMixin);\n\n// we only put aggregated measure in pivot table\nvar text = merge(clone(onlyQuantitativeField), textMixin, sortMixin);\n\n// TODO add label\n\nvar data = {\n type: 'object',\n properties: {\n // data source\n formatType: {\n type: 'string',\n enum: ['json', 'csv'],\n default: 'json'\n },\n url: {\n type: 'string',\n default: undefined\n },\n values: {\n type: 'array',\n default: undefined,\n description: 'Pass array of objects instead of a url to a file.',\n items: {\n type: 'object',\n additionalProperties: true\n }\n },\n // we generate a vega filter transform\n filter: {\n type: 'string',\n default: undefined,\n description: 'A string containing the filter Vega expression. Use `datum` to refer to the current data object.'\n },\n // we generate a vega formula transform\n formulas: {\n type: 'array',\n default: undefined,\n description: 'Array of formula transforms. Formulas are applied before filter.',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The property name in which to store the computed formula value.'\n },\n expr: {\n type: 'string',\n description: 'A string containing an expression for the formula. Use the variable `datum` to to refer to the current data object.'\n }\n }\n }\n }\n }\n};\n\nvar config = {\n type: 'object',\n properties: {\n // template\n width: {\n type: 'integer',\n default: undefined\n },\n height: {\n type: 'integer',\n default: undefined\n },\n viewport: {\n type: 'array',\n items: {\n type: 'integer'\n },\n default: undefined\n },\n gridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n gridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.08\n },\n\n // filter null\n // TODO(#597) revise this config\n filterNull: {\n type: 'object',\n properties: {\n N: {type:'boolean', default: false},\n O: {type:'boolean', default: false},\n Q: {type:'boolean', default: true},\n T: {type:'boolean', default: true}\n }\n },\n autoSortLine: {\n type: 'boolean',\n default: true\n },\n\n // single plot\n singleHeight: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n singleWidth: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n // band size\n largeBandSize: {\n type: 'integer',\n default: 21,\n minimum: 0\n },\n smallBandSize: {\n //small multiples or single plot with high cardinality\n type: 'integer',\n default: 12,\n minimum: 0\n },\n largeBandMaxCardinality: {\n type: 'integer',\n default: 10\n },\n // small multiples\n cellPadding: {\n type: 'number',\n default: 0.1\n },\n cellGridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n cellGridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.25\n },\n cellGridOffset: {\n type: 'number',\n default: 6 // equal to tickSize\n },\n cellBackgroundColor: {\n type: 'string',\n role: 'color',\n default: 'rgba(0,0,0,0)'\n },\n textCellWidth: {\n type: 'integer',\n default: 90,\n minimum: 0\n },\n\n // marks\n strokeWidth: {\n type: 'integer',\n default: 2,\n minimum: 0\n },\n singleBarOffset: {\n type: 'integer',\n default: 5,\n minimum: 0\n },\n // scales\n timeScaleLabelLength: {\n type: 'integer',\n default: 3,\n minimum: 0,\n description: 'Max length for values in dayScaleLabel and monthScaleLabel. Zero means using full names in dayScaleLabel/monthScaleLabel.'\n },\n dayScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n description: 'Axis labels for day of week, starting from Sunday.' +\n '(Consistent with Javascript -- See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay.'\n },\n monthScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n description: 'Axis labels for month.'\n },\n // other\n characterWidth: {\n type: 'integer',\n default: 6\n },\n maxSmallNumber: {\n type: 'number',\n default: 10000,\n description: 'maximum number that a field will be considered smallNumber.'+\n 'Used for axis labelling.'\n },\n smallNumberFormat: {\n type: 'string',\n default: '',\n description: 'D3 Number format for axis labels and text tables '+\n 'for number <= maxSmallNumber. Used for axis labelling.'\n },\n largeNumberFormat: {\n type: 'string',\n default: '.3s',\n description: 'D3 Number format for axis labels and text tables ' +\n 'for number > maxSmallNumber.'\n },\n timeFormat: {\n type: 'string',\n default: '%Y-%m-%d',\n description: 'Date format for axis labels.'\n },\n useRawDomain: {\n type: 'boolean',\n default: false,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n};\n\n/** @type Object Schema of a vega-lite specification */\nschema.schema = {\n $schema: 'http://json-schema.org/draft-04/schema#',\n description: 'Schema for Vega-lite specification',\n type: 'object',\n required: ['marktype', 'encoding', 'data'],\n properties: {\n data: data,\n marktype: schema.marktype,\n encoding: {\n type: 'object',\n properties: {\n x: x,\n y: y,\n row: row,\n col: col,\n size: size,\n color: color,\n shape: shape,\n text: text,\n detail: detail\n }\n },\n config: config\n }\n};\n\nschema.encTypes = util.keys(schema.schema.properties.encoding.properties);\n\n/** Instantiate a verbose vl spec from the schema */\nschema.instantiate = function() {\n return schema.util.instantiate(schema.schema);\n};\n","'use strict';\n\nvar schemautil = module.exports = {},\n util = require('../util');\n\nvar isEmpty = function(obj) {\n return Object.keys(obj).length === 0;\n};\n\nschemautil.extend = function(instance, schema) {\n return schemautil.merge(schemautil.instantiate(schema), instance);\n};\n\n// instantiate a schema\nschemautil.instantiate = function(schema) {\n var val;\n if (schema === undefined) {\n return undefined;\n } else if ('default' in schema) {\n val = schema.default;\n return util.isObject(val) ? util.duplicate(val) : val;\n } else if (schema.type === 'object') {\n var instance = {};\n for (var name in schema.properties) {\n val = schemautil.instantiate(schema.properties[name]);\n if (val !== undefined) {\n instance[name] = val;\n }\n }\n return instance;\n } else if (schema.type === 'array') {\n return [];\n }\n return undefined;\n};\n\n// remove all defaults from an instance\nschemautil.subtract = function(instance, defaults) {\n var changes = {};\n for (var prop in instance) {\n var def = defaults[prop];\n var ins = instance[prop];\n // Note: does not properly subtract arrays\n if (!defaults || def !== ins) {\n if (typeof ins === 'object' && !util.isArray(ins) && def) {\n var c = schemautil.subtract(ins, def);\n if (!isEmpty(c))\n changes[prop] = c;\n } else if (!util.isArray(ins) || ins.length > 0) {\n changes[prop] = ins;\n }\n }\n }\n return changes;\n};\n\nschemautil.merge = function(/*dest*, src0, src1, ...*/){\n var dest = arguments[0];\n for (var i=1 ; i 180 || delta < -180\n ? delta - 360 * Math.round(delta / 360)\n : delta;\n }\n\n function Color() {}var reHex3 = /^#([0-9a-f]{3})$/;\n var reHex6 = /^#([0-9a-f]{6})$/;\n var reRgbInteger = /^rgb\\(\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*\\)$/;\n var reRgbPercent = /^rgb\\(\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var reHslPercent = /^hsl\\(\\s*([-+]?\\d+(?:\\.\\d+)?)\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n color.prototype = Color.prototype = {\n displayable: function() {\n return this.rgb().displayable();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n };\n\n function color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf))) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\n : (m = reRgbInteger.exec(format)) ? rgb(m[1], m[2], m[3]) // rgb(255,0,0)\n : (m = reRgbPercent.exec(format)) ? rgb(m[1] * 2.55, m[2] * 2.55, m[3] * 2.55) // rgb(100%,0%,0%)\n : (m = reHslPercent.exec(format)) ? hsl(m[1], m[2] * .01, m[3] * .01) // hsl(120,50%,50%)\n : named.hasOwnProperty(format) ? rgbn(named[format])\n : null;\n }function rgbn(n) {\n return rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff);\n }\n\n var named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n };\n\n var darker = .7;\n var brighter = 1 / darker;\n\n function rgb(r, g, b) {\n if (arguments.length === 1) {\n if (!(r instanceof Color)) r = color(r);\n if (r) {\n r = r.rgb();\n b = r.b;\n g = r.g;\n r = r.r;\n } else {\n r = g = b = NaN;\n }\n }\n return new Rgb(r, g, b);\n }function Rgb(r, g, b) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n }var ____prototype = rgb.prototype = Rgb.prototype = new Color;\n\n ____prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.rgb = function() {\n return this;\n };\n\n ____prototype.displayable = function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255);\n };\n\n ____prototype.toString = function() {\n return _format(this.r, this.g, this.b);\n };\n\n function _format(r, g, b) {\n return \"#\"\n + (isNaN(r) ? \"00\" : (r = Math.round(r)) < 16 ? \"0\" + Math.max(0, r).toString(16) : Math.min(255, r).toString(16))\n + (isNaN(g) ? \"00\" : (g = Math.round(g)) < 16 ? \"0\" + Math.max(0, g).toString(16) : Math.min(255, g).toString(16))\n + (isNaN(b) ? \"00\" : (b = Math.round(b)) < 16 ? \"0\" + Math.max(0, b).toString(16) : Math.min(255, b).toString(16));\n }\n\n function hsl(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Hsl) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Color)) h = color(h);\n if (h) {\n if (h instanceof Hsl) return h;\n h = h.rgb();\n var r = h.r / 255,\n g = h.g / 255,\n b = h.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n range = max - min;\n l = (max + min) / 2;\n if (range) {\n s = l < .5 ? range / (max + min) : range / (2 - max - min);\n if (r === max) h = (g - b) / range + (g < b) * 6;\n else if (g === max) h = (b - r) / range + 2;\n else h = (r - g) / range + 4;\n h *= 60;\n } else {\n h = NaN;\n s = l > 0 && l < 1 ? 0 : h;\n }\n } else {\n h = s = l = NaN;\n }\n }\n }\n return new Hsl(h, s, l);\n }function Hsl(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var ___prototype = hsl.prototype = Hsl.prototype = new Color;\n\n ___prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.rgb = function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < .5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2)\n );\n };\n\n ___prototype.displayable = function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1);\n };\n\n /* From FvD 13.37, CSS Color Module Level 3 */\n function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n }\n\n var Kn = 18;\n\n var Xn = 0.950470;\n var Yn = 1;\n var Zn = 1.088830;\n var t0 = 4 / 29;\n var t1 = 6 / 29;\n var t2 = 3 * t1 * t1;\n var t3 = t1 * t1 * t1;\n function lab(l, a, b) {\n if (arguments.length === 1) {\n if (l instanceof Lab) {\n b = l.b;\n a = l.a;\n l = l.l;\n } else if (l instanceof Hcl) {\n var h = l.h * deg2rad;\n b = Math.sin(h) * l.c;\n a = Math.cos(h) * l.c;\n l = l.l;\n } else {\n if (!(l instanceof Rgb)) l = rgb(l);\n var r = rgb2xyz(l.r),\n g = rgb2xyz(l.g),\n b = rgb2xyz(l.b),\n x = xyz2lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / Xn),\n y = xyz2lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Yn),\n z = xyz2lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Zn);\n b = 200 * (y - z);\n a = 500 * (x - y);\n l = 116 * y - 16;\n }\n }\n return new Lab(l, a, b);\n }function Lab(l, a, b) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n }var __prototype = lab.prototype = Lab.prototype = new Color;\n\n __prototype.brighter = function(k) {\n return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.darker = function(k) {\n return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.rgb = function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Rgb(\n xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)\n );\n };\n\n function xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n }\n\n function lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n }\n\n function xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n }\n\n function rgb2xyz(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n }\n\n var deg2rad = Math.PI / 180;\n var rad2deg = 180 / Math.PI;\n\n function hcl(h, c, l) {\n if (arguments.length === 1) {\n if (h instanceof Hcl) {\n l = h.l;\n c = h.c;\n h = h.h;\n } else {\n if (!(h instanceof Lab)) h = lab(h);\n l = h.l;\n c = Math.sqrt(h.a * h.a + h.b * h.b);\n h = Math.atan2(h.b, h.a) * rad2deg;\n if (h < 0) h += 360;\n }\n }\n return new Hcl(h, c, l);\n }function Hcl(h, c, l) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n }var _prototype = hcl.prototype = Hcl.prototype = new Color;\n\n _prototype.brighter = function(k) {\n return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k));\n };\n\n _prototype.darker = function(k) {\n return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k));\n };\n\n _prototype.rgb = function() {\n return lab(this).rgb();\n };\n\n var A = -0.14861;\n var B = +1.78277;\n var C = -0.29227;\n var D = -0.90649;\n var E = +1.97294;\n var ED = E * D;\n var EB = E * B;\n var BC_DA = B * C - D * A;\n function cubehelix(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Cubehelix) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Rgb)) h = rgb(h);\n var r = h.r / 255, g = h.g / 255, b = h.b / 255;\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB);\n var bl = b - l, k = (E * (g - l) - C * bl) / D;\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)); // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n if (h < 0) h += 360;\n }\n }\n return new Cubehelix(h, s, l);\n }function Cubehelix(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var prototype = cubehelix.prototype = Cubehelix.prototype = new Color;\n\n prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.rgb = function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh))\n );\n };\n\n function interpolateCubehelixGamma(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateCubehelixGammaLong(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateHclLong(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHcl(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateLab(a, b) {\n a = lab(a);\n b = lab(b);\n var al = a.l,\n aa = a.a,\n ab = a.b,\n bl = b.l - al,\n ba = b.a - aa,\n bb = b.b - ab;\n return function(t) {\n a.l = al + bl * t;\n a.a = aa + ba * t;\n a.b = ab + bb * t;\n return a + \"\";\n };\n }\n\n function interpolateHslLong(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHsl(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateRgb(a, b) {\n a = rgb(a);\n b = rgb(b);\n var ar = a.r,\n ag = a.g,\n ab = a.b,\n br = b.r - ar,\n bg = b.g - ag,\n bb = b.b - ab;\n return function(t) {\n return _format(Math.round(ar + br * t), Math.round(ag + bg * t), Math.round(ab + bb * t));\n };\n }\n\n var interpolateCubehelix = interpolateCubehelixGamma(1);\n var interpolateCubehelixLong = interpolateCubehelixGammaLong(1);\n\n exports.interpolateCubehelix = interpolateCubehelix;\n exports.interpolateCubehelixLong = interpolateCubehelixLong;\n exports.color = color;\n exports.rgb = rgb;\n exports.hsl = hsl;\n exports.lab = lab;\n exports.hcl = hcl;\n exports.cubehelix = cubehelix;\n exports.interpolateRgb = interpolateRgb;\n exports.interpolateHsl = interpolateHsl;\n exports.interpolateHslLong = interpolateHslLong;\n exports.interpolateLab = interpolateLab;\n exports.interpolateHcl = interpolateHcl;\n exports.interpolateHclLong = interpolateHclLong;\n exports.interpolateCubehelixGamma = interpolateCubehelixGamma;\n exports.interpolateCubehelixGammaLong = interpolateCubehelixGammaLong;\n\n}));\n},{}],5:[function(require,module,exports){\nif (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.format = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"¥\", \"\"]\n };\n\n var ruRu = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0руб.\"]\n };\n\n var ptBr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"R$\", \"\"]\n };\n\n var plPl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"zł\"]\n };\n\n var nlNl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\\xa0\", \"\"]\n };\n\n var mkMk = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0ден.\"]\n };\n\n var jaJp = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"\", \"円\"]\n };\n\n var itIt = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\", \"\"]\n };\n\n var heIl = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"₪\", \"\"]\n };\n\n var frFr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var frCa = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"$\"]\n };\n\n var fiFi = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var esEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var enUs = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var enGb = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"£\", \"\"]\n };\n\n var enCa = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var deDe = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var caEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n\n // Computes the decimal coefficient and exponent of the specified number x with\n // significant digits p, where x is positive and p is in [1, 21] or undefined.\n // For example, formatDecimal(1.23) returns [\"123\", 0].\n function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n\n function exponent(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n }\n\n var prefixExponent;\n\n function formatPrefixAuto(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, p + i - 1)[0]; // less than 1y!\n }\n\n function formatRounded(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n }\n\n function formatDefault(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n }\n\n var formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n };\n\n\n // [[fill]align][sign][symbol][0][width][,][.precision][type]\n var re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\n function formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n }\n\n function FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n }\n\n FormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n };\n\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n }\n\n var prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\n function identity(x) {\n return x;\n }\n\n function locale(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal;\n\n function format(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? \"%\" : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n return function(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Convert negative to positive, and compute the prefix.\n // Note that -0 is not less than 0, but 1 / -0 is!\n var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);\n\n // Perform the initial formatting.\n value = formatType(value, precision);\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n var i = -1, n = value.length, c;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": return valuePrefix + value + valueSuffix + padding;\n case \"=\": return valuePrefix + padding + value + valueSuffix;\n case \"^\": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n }\n return padding + valuePrefix + value + valueSuffix;\n };\n }\n\n function formatPrefix(specifier, value) {\n var f = format((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: format,\n formatPrefix: formatPrefix\n };\n }\n\n function precisionRound(step, max) {\n return Math.max(0, exponent(Math.abs(max)) - exponent(Math.abs(step))) + 1;\n }\n\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.formatPrefix = defaultLocale.formatPrefix;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.formatSpecifier = formatSpecifier;\n exports.precisionFixed = precisionFixed;\n exports.precisionPrefix = precisionPrefix;\n exports.precisionRound = precisionRound;\n\n}));\n},{}],6:[function(require,module,exports){\nif (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));\n},{}],7:[function(require,module,exports){\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.dsv = {}));\n}(this, function (exports) { 'use strict';\n\n var dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n]\"),\n delimiterCode = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var o;\n return parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = new Function(\"d\", \"return {\" + row.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n o = f ? function(row, i) { return f(a(row), i); } : a;\n });\n }\n\n function parseRows(text, f) {\n var EOL = {}, // sentinel value for end-of-line\n EOF = {}, // sentinel value for end-of-file\n rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // the current line number\n t, // the current token\n eol; // is the current token followed by EOL?\n\n function token() {\n if (I >= N) return EOF; // special case: end of file\n if (eol) return eol = false, EOL; // special case: end of line\n\n // special case: quotes\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case: find next delimiter or newline\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true; // \\n\n else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \\r|\\r\\n\n else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n\n // special case: last token before EOF\n return text.slice(j);\n }\n\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n\n return rows;\n }\n\n function format(rows) {\n if (Array.isArray(rows[0])) return formatRows(rows); // deprecated; use formatRows\n var fieldSet = Object.create(null), fields = [];\n\n // Compute unique fields in order of discovery.\n rows.forEach(function(row) {\n for (var field in row) {\n if (!((field += \"\") in fieldSet)) {\n fields.push(fieldSet[field] = field);\n }\n }\n });\n\n return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return reFormat.test(text) ? \"\\\"\" + text.replace(/\\\"/g, \"\\\"\\\"\") + \"\\\"\" : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n }\n\n exports.csv = dsv(\",\");\n exports.tsv = dsv(\"\\t\");\n\n exports.dsv = dsv;\n\n}));\n},{}],8:[function(require,module,exports){\nif (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var jaJp = {\n dateTime: \"%Y %b %e %a %X\",\n date: \"%Y/%m/%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\n shortDays: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"],\n months: [\"睦月\", \"如月\", \"弥生\", \"卯月\", \"皐月\", \"水無月\", \"文月\", \"葉月\", \"長月\", \"神無月\", \"霜月\", \"師走\"],\n shortMonths: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));\n},{}],9:[function(require,module,exports){\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.time = {}));\n}(this, function (exports) { 'use strict';\n\n var t1 = new Date;\n\n var t0 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var second = newInterval(function(date) {\n date.setMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.seconds = second.range;\n\n var minute = newInterval(function(date) {\n date.setSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.minutes = minute.range;\n\n var hour = newInterval(function(date) {\n date.setMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.hours = hour.range;\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n exports.days = day.range;\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n exports.sunday = weekday(0);\n\n exports.sundays = exports.sunday.range;\n\n exports.monday = weekday(1);\n\n exports.mondays = exports.monday.range;\n\n exports.tuesday = weekday(2);\n\n exports.tuesdays = exports.tuesday.range;\n\n exports.wednesday = weekday(3);\n\n exports.wednesdays = exports.wednesday.range;\n\n exports.thursday = weekday(4);\n\n exports.thursdays = exports.thursday.range;\n\n exports.friday = weekday(5);\n\n exports.fridays = exports.friday.range;\n\n exports.saturday = weekday(6);\n\n exports.saturdays = exports.saturday.range;\n\n var week = exports.sunday;\n\n exports.weeks = week.range;\n\n var month = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n });\n\n exports.months = month.range;\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n exports.years = year.range;\n\n var utcSecond = newInterval(function(date) {\n date.setUTCMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.utcSeconds = utcSecond.range;\n\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.utcMinutes = utcMinute.range;\n\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.utcHours = utcHour.range;\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n exports.utcDays = utcDay.range;\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n exports.utcSunday = utcWeekday(0);\n\n exports.utcSundays = exports.utcSunday.range;\n\n exports.utcMonday = utcWeekday(1);\n\n exports.utcMondays = exports.utcMonday.range;\n\n exports.utcTuesday = utcWeekday(2);\n\n exports.utcTuesdays = exports.utcTuesday.range;\n\n exports.utcWednesday = utcWeekday(3);\n\n exports.utcWednesdays = exports.utcWednesday.range;\n\n exports.utcThursday = utcWeekday(4);\n\n exports.utcThursdays = exports.utcThursday.range;\n\n exports.utcFriday = utcWeekday(5);\n\n exports.utcFridays = exports.utcFriday.range;\n\n exports.utcSaturday = utcWeekday(6);\n\n exports.utcSaturdays = exports.utcSaturday.range;\n\n var utcWeek = exports.utcSunday;\n\n exports.utcWeeks = utcWeek.range;\n\n var utcMonth = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(1);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n });\n\n exports.utcMonths = utcMonth.range;\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n exports.utcYears = utcYear.range;\n\n exports.interval = newInterval;\n exports.second = second;\n exports.minute = minute;\n exports.hour = hour;\n exports.day = day;\n exports.week = week;\n exports.month = month;\n exports.year = year;\n exports.utcSecond = utcSecond;\n exports.utcMinute = utcMinute;\n exports.utcHour = utcHour;\n exports.utcDay = utcDay;\n exports.utcWeek = utcWeek;\n exports.utcMonth = utcMonth;\n exports.utcYear = utcYear;\n\n}));\n},{}],10:[function(require,module,exports){\nvar util = require('../util'),\n Measures = require('./measures'),\n Collector = require('./collector');\n\nfunction Aggregator() {\n this._cells = {};\n this._aggr = [];\n this._stream = false;\n}\n\nvar Flags = Aggregator.Flags = {\n ADD_CELL: 1,\n MOD_CELL: 2\n};\n\nvar proto = Aggregator.prototype;\n\n// Parameters\n\nproto.stream = function(v) {\n if (v == null) return this._stream;\n this._stream = !!v;\n this._aggr = [];\n return this;\n};\n\n// key accessor to use for streaming removes\nproto.key = function(key) {\n if (key == null) return this._key;\n this._key = util.$(key);\n return this;\n};\n\n// Input: array of objects of the form\n// {name: string, get: function}\nproto.groupby = function(dims) {\n this._dims = util.array(dims).map(function(d, i) {\n d = util.isString(d) ? {name: d, get: util.$(d)}\n : util.isFunction(d) ? {name: util.name(d) || d.name || ('_' + i), get: d}\n : (d.name && util.isFunction(d.get)) ? d : null;\n if (d == null) throw 'Invalid groupby argument: ' + d;\n return d;\n });\n return this.clear();\n};\n\n// Input: array of objects of the form\n// {name: string, ops: [string, ...]}\nproto.summarize = function(fields) {\n fields = summarize_args(fields);\n this._count = true;\n var aggr = (this._aggr = []),\n m, f, i, j, op, as, get;\n\n for (i=0; i 0) {\n // consolidate collector values\n if (cell.collect) {\n cell.data.values();\n }\n // update tuple properties\n for (i=0; i 0) {\n m[a[i]] -= 1;\n } else {\n x[j++] = a[i];\n }\n }\n } else if (k) {\n // has unique key field, so use that\n m = util.toMap(r, k);\n for (i=0, j=0, n=a.length; i 1 ? this.dev / (this.valid-1) : 0',\n req: ['mean'], idx: 1\n }),\n 'variancep': measure({\n name: 'variancep',\n set: 'this.valid > 1 ? this.dev / this.valid : 0',\n req: ['variance'], idx: 2\n }),\n 'stdev': measure({\n name: 'stdev',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0',\n req: ['variance'], idx: 2\n }),\n 'stdevp': measure({\n name: 'stdevp',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0',\n req: ['variance'], idx: 2\n }),\n 'median': measure({\n name: 'median',\n set: 'cell.data.q2(this.get)',\n req: ['values'], idx: 3\n }),\n 'q1': measure({\n name: 'q1',\n set: 'cell.data.q1(this.get)',\n req: ['values'], idx: 3\n }),\n 'q3': measure({\n name: 'q3',\n set: 'cell.data.q3(this.get)',\n req: ['values'], idx: 3\n }),\n 'distinct': measure({\n name: 'distinct',\n set: 'this.distinct(cell.data.values(), this.get)',\n req: ['values'], idx: 3\n }),\n 'argmin': measure({\n name: 'argmin',\n add: 'if (v < this.min) this.argmin = t;',\n rem: 'if (v <= this.min) this.argmin = null;',\n set: 'this.argmin = this.argmin || cell.data.argmin(this.get)',\n req: ['min'], str: ['values'], idx: 3\n }),\n 'argmax': measure({\n name: 'argmax',\n add: 'if (v > this.max) this.argmax = t;',\n rem: 'if (v >= this.max) this.argmax = null;',\n set: 'this.argmax = this.argmax || cell.data.argmax(this.get)',\n req: ['max'], str: ['values'], idx: 3\n }),\n 'min': measure({\n name: 'min',\n init: 'this.min = +Infinity;',\n add: 'if (v < this.min) this.min = v;',\n rem: 'if (v <= this.min) this.min = NaN;',\n set: 'this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)',\n str: ['values'], idx: 4\n }),\n 'max': measure({\n name: 'max',\n init: 'this.max = -Infinity;',\n add: 'if (v > this.max) this.max = v;',\n rem: 'if (v >= this.max) this.max = NaN;',\n set: 'this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)',\n str: ['values'], idx: 4\n }),\n 'modeskew': measure({\n name: 'modeskew',\n set: 'this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))',\n req: ['mean', 'stdev', 'median'], idx: 5\n })\n};\n\nfunction measure(base) {\n return function(out) {\n var m = util.extend({init:'', add:'', rem:'', idx:0}, base);\n m.out = out || base.name;\n return m;\n };\n}\n\nfunction resolve(agg, stream) {\n function collect(m, a) {\n function helper(r) { if (!m[r]) collect(m, m[r] = types[r]()); }\n if (a.req) a.req.forEach(helper);\n if (stream && a.str) a.str.forEach(helper);\n return m;\n }\n var map = agg.reduce(\n collect,\n agg.reduce(function(m, a) { return (m[a.name] = a, m); }, {})\n );\n return util.vals(map).sort(function(a, b) { return a.idx - b.idx; });\n}\n\nfunction create(agg, stream, accessor, mutator) {\n var all = resolve(agg, stream),\n ctr = 'this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;',\n add = 'if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;',\n rem = 'if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;',\n set = 'var t = this.tuple; var cell = this.cell;';\n\n all.forEach(function(a) {\n if (a.idx < 0) {\n ctr = a.init + ctr;\n add = a.add + add;\n rem = a.rem + rem;\n } else {\n ctr += a.init;\n add += a.add;\n rem += a.rem;\n }\n });\n agg.slice()\n .sort(function(a, b) { return a.idx - b.idx; })\n .forEach(function(a) {\n set += 'this.assign(t,\\''+a.out+'\\','+a.set+');';\n });\n set += 'return t;';\n\n /* jshint evil: true */\n ctr = Function('cell', 't', ctr);\n ctr.prototype.assign = mutator;\n ctr.prototype.add = Function('t', 'var v = this.get(t);' + add);\n ctr.prototype.rem = Function('t', 'var v = this.get(t);' + rem);\n ctr.prototype.set = Function(set);\n ctr.prototype.get = accessor;\n ctr.prototype.distinct = require('../stats').count.distinct;\n ctr.prototype.isValid = util.isValid;\n ctr.fields = agg.map(util.$('out'));\n return ctr;\n}\n\ntypes.create = create;\nmodule.exports = types;\n},{\"../stats\":29,\"../util\":32}],14:[function(require,module,exports){\nvar util = require('../util'),\n time = require('../time'),\n EPSILON = 1e-15;\n\nfunction bins(opt) {\n if (!opt) { throw Error(\"Missing binning options.\"); }\n\n // determine range\n var maxb = opt.maxbins || 15,\n base = opt.base || 10,\n logb = Math.log(base),\n div = opt.div || [5, 2], \n min = opt.min,\n max = opt.max,\n span = max - min,\n step, level, minstep, precision, v, i, eps;\n\n if (opt.step) {\n // if step size is explicitly given, use that\n step = opt.step;\n } else if (opt.steps) {\n // if provided, limit choice to acceptable step sizes\n step = opt.steps[Math.min(\n opt.steps.length - 1,\n bisect(opt.steps, span/maxb, 0, opt.steps.length)\n )];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = opt.minstep || 0;\n step = Math.max(\n minstep,\n Math.pow(base, Math.round(Math.log(span) / logb) - level)\n );\n \n // increase step size if too many bins\n do { step *= base; } while (Math.ceil(span/step) > maxb);\n\n // decrease step size if allowed\n for (i=0; i= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n precision = v >= 0 ? 0 : ~~(-v / logb) + 1;\n eps = Math.pow(base, -precision - 1);\n min = Math.min(min, Math.floor(min / step + eps) * step);\n max = Math.ceil(max / step) * step;\n\n return {\n start: min,\n stop: max,\n step: step,\n unit: {precision: precision},\n value: value,\n index: index\n };\n}\n\nfunction bisect(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (util.cmp(a[mid], x) < 0) { lo = mid + 1; }\n else { hi = mid; }\n }\n return lo;\n}\n\nfunction value(v) {\n return this.step * Math.floor(v / this.step + EPSILON);\n}\n\nfunction index(v) {\n return Math.floor((v - this.start) / this.step + EPSILON);\n}\n\nfunction date_value(v) {\n return this.unit.date(value.call(this, v));\n}\n\nfunction date_index(v) {\n return index.call(this, this.unit.unit(v));\n}\n\nbins.date = function(opt) {\n if (!opt) { throw Error(\"Missing date binning options.\"); }\n\n // find time step, then bin\n var units = opt.utc ? time.utc : time,\n dmin = opt.min,\n dmax = opt.max,\n maxb = opt.maxbins || 20,\n minb = opt.minbins || 4,\n span = (+dmax) - (+dmin),\n unit = opt.unit ? units[opt.unit] : units.find(span, minb, maxb),\n spec = bins({\n min: unit.min != null ? unit.min : unit.unit(dmin),\n max: unit.max != null ? unit.max : unit.unit(dmax),\n maxbins: maxb,\n minstep: unit.minstep,\n steps: unit.step\n });\n\n spec.unit = unit;\n spec.index = date_index;\n if (!opt.raw) spec.value = date_value;\n return spec;\n};\n\nmodule.exports = bins;\n\n},{\"../time\":31,\"../util\":32}],15:[function(require,module,exports){\nvar bins = require('./bins'),\n gen = require('../generate'),\n type = require('../import/type'),\n util = require('../util'),\n stats = require('../stats');\n\nvar qtype = {\n 'integer': 1,\n 'number': 1,\n 'date': 1\n};\n\nfunction $bin(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return !b ? (opt.accessor || util.identity) :\n util.$func('bin', b.unit.unit ?\n function(x) { return b.value(b.unit.unit(x)); } :\n function(x) { return b.value(x); }\n )(opt.accessor);\n}\n\nfunction histogram(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return b ?\n numerical(values, opt.accessor, b) :\n categorical(values, opt.accessor, opt && opt.sort);\n}\n\nfunction spec(opt) {\n var t = opt.type, b = null;\n if (t == null || qtype[t]) {\n if (t === 'integer' && opt.minstep == null) opt.minstep = 1;\n b = (t === 'date') ? bins.date(opt) : bins(opt);\n }\n return b;\n}\n\nfunction options() {\n var a = arguments,\n i = 0,\n values = util.isArray(a[i]) ? a[i++] : null,\n f = util.isFunction(a[i]) || util.isString(a[i]) ? util.$(a[i++]) : null,\n opt = util.extend({}, a[i]);\n \n if (values) {\n opt.type = opt.type || type(values, f);\n if (qtype[opt.type]) {\n var ext = stats.extent(values, f);\n opt = util.extend({min: ext[0], max: ext[1]}, opt);\n }\n }\n if (f) { opt.accessor = f; }\n return opt;\n}\n\nfunction numerical(values, f, b) {\n var h = gen.range(b.start, b.stop + b.step/2, b.step)\n .map(function(v) { return {value: b.value(v), count: 0}; });\n\n for (var i=0, v, j; i= h.length || !isFinite(j)) continue;\n h[j].count += 1;\n }\n }\n h.bins = b;\n return h;\n}\n\nfunction categorical(values, f, sort) {\n var u = stats.unique(values, f),\n c = stats.count.map(values, f);\n return u.map(function(k) { return {value: k, count: c[k]}; })\n .sort(util.comparator(sort ? '-count' : '+value'));\n}\n\nmodule.exports = {\n $bin: $bin,\n histogram: histogram\n};\n},{\"../generate\":17,\"../import/type\":26,\"../stats\":29,\"../util\":32,\"./bins\":14}],16:[function(require,module,exports){\nvar d3_time = require('d3-time'),\n d3_timeF = require('d3-time-format'),\n d3_numberF = require('d3-format'),\n numberF = d3_numberF, // defaults to EN-US\n timeF = d3_timeF; // defaults to EN-US\n\nfunction numberLocale(l) {\n var f = d3_numberF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n numberF = f;\n}\n\nfunction timeLocale(l) {\n var f = d3_timeF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n timeF = f;\n}\n\nmodule.exports = {\n // Update number formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-format\n numberLocale: numberLocale,\n number: function(f) { return numberF.format(f); },\n numberPrefix: function(f, v) { return numberF.formatPrefix(f, v); },\n\n // Update time formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-time-format\n timeLocale: timeLocale,\n time: function(f) { return timeF.format(f); }, \n utc: function(f) { return timeF.utcFormat(f); },\n\n // Set number and time locale simultaneously.\n locale: function(l) { numberLocale(l); timeLocale(l); },\n\n // automatic formatting functions\n auto: {\n number: numberAutoFormat,\n time: function() { return timeAutoFormat(); },\n utc: function() { return utcAutoFormat(); }\n }\n};\n\nvar e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction intervals(domain, count) {\n if (!domain.length) domain = [0];\n if (count == null) count = 10;\n\n var start = domain[0],\n stop = domain[domain.length - 1];\n\n if (stop < start) { error = stop; stop = start; start = error; }\n\n var span = (stop - start) || (count = 1, start || stop || 1),\n step = Math.pow(10, Math.floor(Math.log(span / count) / Math.LN10)),\n error = span / count / step;\n\n // Filter ticks to get closer to the desired count.\n if (error >= e10) step *= 10;\n else if (error >= e5) step *= 5;\n else if (error >= e2) step *= 2;\n\n // Round start and stop values to step interval.\n return [\n Math.ceil(start / step) * step,\n Math.floor(stop / step) * step + step / 2, // inclusive\n step\n ];\n}\n\nfunction numberAutoFormat(domain, count, f) {\n var range = intervals(domain, count);\n if (f == null) {\n f = ',.' + d3_numberF.precisionFixed(range[2]) + 'f';\n } else {\n switch (f = d3_numberF.formatSpecifier(f), f.type) {\n case 's': {\n var value = Math.max(Math.abs(range[0]), Math.abs(range[1]));\n if (f.precision == null) f.precision = d3_numberF.precisionPrefix(range[2], value);\n return numberF.formatPrefix(f, value);\n }\n case '':\n case 'e':\n case 'g':\n case 'p':\n case 'r': {\n if (f.precision == null) f.precision = d3_numberF.precisionRound(range[2], Math.max(Math.abs(range[0]), Math.abs(range[1]))) - (f.type === 'e');\n break;\n }\n case 'f':\n case '%': {\n if (f.precision == null) f.precision = d3_numberF.precisionFixed(range[2]) - (f.type === '%') * 2;\n break;\n }\n }\n }\n return numberF.format(f);\n}\n\nfunction timeAutoFormat() {\n var f = timeF.format,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.second(date) < d ? formatMillisecond\n : d3_time.minute(date) < d ? formatSecond\n : d3_time.hour(date) < d ? formatMinute\n : d3_time.day(date) < d ? formatHour\n : d3_time.month(date) < d ?\n (d3_time.week(date) < d ? formatDay : formatWeek)\n : d3_time.year(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n\nfunction utcAutoFormat() {\n var f = timeF.utcFormat,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.utcSecond(date) < d ? formatMillisecond\n : d3_time.utcMinute(date) < d ? formatSecond\n : d3_time.utcHour(date) < d ? formatMinute\n : d3_time.utcDay(date) < d ? formatHour\n : d3_time.utcMonth(date) < d ?\n (d3_time.utcWeek(date) < d ? formatDay : formatWeek)\n : d3_time.utcYear(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n\n},{\"d3-format\":5,\"d3-time\":9,\"d3-time-format\":8}],17:[function(require,module,exports){\nvar gen = module.exports = {};\n\ngen.repeat = function(val, n) {\n var a = Array(n), i;\n for (i=0; i stop) range.push(j);\n else while ((j = start + step * ++i) < stop) range.push(j);\n return range;\n};\n\ngen.random = {};\n\ngen.random.uniform = function(min, max) {\n if (max === undefined) {\n max = min === undefined ? 1 : min;\n min = 0;\n }\n var d = max - min;\n var f = function() {\n return min + d * Math.random();\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.integer = function(a, b) {\n if (b === undefined) {\n b = a;\n a = 0;\n }\n var d = b - a;\n var f = function() {\n return a + Math.floor(d * Math.random());\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.normal = function(mean, stdev) {\n mean = mean || 0;\n stdev = stdev || 1;\n var next;\n var f = function() {\n var x = 0, y = 0, rds, c;\n if (next !== undefined) {\n x = next;\n next = undefined;\n return x;\n }\n do {\n x = Math.random()*2-1;\n y = Math.random()*2-1;\n rds = x*x + y*y;\n } while (rds === 0 || rds > 1);\n c = Math.sqrt(-2*Math.log(rds)/rds); // Box-Muller transform\n next = mean + y*c*stdev;\n return mean + x*c*stdev;\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n},{}],18:[function(require,module,exports){\nvar util = require('../../util');\nvar d3_dsv = require('d3-dsv');\n\nfunction dsv(data, format) {\n if (data) {\n var h = format.header;\n data = (h ? h.join(format.delimiter) + '\\n' : '') + data;\n }\n return d3_dsv.dsv(format.delimiter).parse(data);\n}\n\ndsv.delimiter = function(delim) {\n var fmt = {delimiter: delim};\n return function(data, format) {\n return dsv(data, format ? util.extend(format, fmt) : fmt);\n };\n};\n\nmodule.exports = dsv;\n},{\"../../util\":32,\"d3-dsv\":7}],19:[function(require,module,exports){\nvar dsv = require('./dsv');\n\nmodule.exports = {\n json: require('./json'),\n topojson: require('./topojson'),\n treejson: require('./treejson'),\n dsv: dsv,\n csv: dsv.delimiter(','),\n tsv: dsv.delimiter('\\t')\n};\n},{\"./dsv\":18,\"./json\":20,\"./topojson\":21,\"./treejson\":22}],20:[function(require,module,exports){\nvar util = require('../../util');\n\nmodule.exports = function(data, format) {\n var d = util.isObject(data) && !util.isBuffer(data) ?\n data : JSON.parse(data);\n if (format && format.property) {\n d = util.accessor(format.property)(d);\n }\n return d;\n};\n\n},{\"../../util\":32}],21:[function(require,module,exports){\n(function (global){\nvar json = require('./json');\n\nvar reader = function(data, format) {\n var topojson = reader.topojson;\n if (topojson == null) { throw Error('TopoJSON library not loaded.'); }\n\n var t = json(data, format), obj;\n\n if (format && format.feature) {\n if ((obj = t.objects[format.feature])) {\n return topojson.feature(t, obj).features;\n } else {\n throw Error('Invalid TopoJSON object: ' + format.feature);\n }\n } else if (format && format.mesh) {\n if ((obj = t.objects[format.mesh])) {\n return [topojson.mesh(t, t.objects[format.mesh])];\n } else {\n throw Error('Invalid TopoJSON object: ' + format.mesh);\n }\n } else {\n throw Error('Missing TopoJSON feature or mesh parameter.');\n }\n};\n\nreader.topojson = (typeof window !== \"undefined\" ? window['topojson'] : typeof global !== \"undefined\" ? global['topojson'] : null);\nmodule.exports = reader;\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{\"./json\":20}],22:[function(require,module,exports){\nvar json = require('./json');\n\nmodule.exports = function(data, format) {\n data = json(data, format);\n return toTable(data, (format && format.children));\n};\n\nfunction toTable(root, childrenField) {\n childrenField = childrenField || 'children';\n var table = [];\n \n function visit(node) {\n table.push(node);\n var children = node[childrenField];\n if (children) {\n for (var i=0; i 1 && domain[idx-1] === '.' && domain.lastIndexOf(d) === idx);\n });\n if (!whiteListed) {\n throw 'URL is not whitelisted: ' + url;\n }\n }\n }\n return url;\n}\n\nfunction load(opt, callback) {\n var error = callback || function(e) { throw e; }, url;\n\n try {\n url = load.sanitizeUrl(opt); // enable override\n } catch (err) {\n error(err);\n return;\n }\n\n if (!url) {\n error('Invalid URL: ' + opt.url);\n } else if (load.useXHR) {\n // on client, use xhr\n return xhr(url, callback);\n } else if (startsWith(url, fileProtocol)) {\n // on server, if url starts with 'file://', strip it and load from file\n return file(url.slice(fileProtocol.length), callback);\n } else if (url.indexOf('://') < 0) { // TODO better protocol check?\n // on server, if no protocol assume file\n return file(url, callback);\n } else {\n // for regular URLs on server\n return http(url, callback);\n }\n}\n\nfunction xhrHasResponse(request) {\n var type = request.responseType;\n return type && type !== 'text' ?\n request.response : // null on error\n request.responseText; // '' on error\n}\n\nfunction xhr(url, callback) {\n var async = !!callback;\n var request = new XMLHttpRequest();\n // If IE does not support CORS, use XDomainRequest (copied from d3.xhr)\n if (this.XDomainRequest &&\n !('withCredentials' in request) &&\n /^(http(s)?:)?\\/\\//.test(url)) request = new XDomainRequest();\n\n function respond() {\n var status = request.status;\n if (!status && xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {\n callback(null, request.responseText);\n } else {\n callback(request, null);\n }\n }\n\n if (async) {\n if ('onload' in request) {\n request.onload = request.onerror = respond;\n } else {\n request.onreadystatechange = function() {\n if (request.readyState > 3) respond();\n };\n }\n }\n \n request.open('GET', url, async);\n request.send();\n \n if (!async && xhrHasResponse(request)) {\n return request.responseText;\n }\n}\n\nfunction file(filename, callback) {\n var fs = require('fs');\n if (!callback) {\n return fs.readFileSync(filename, 'utf8');\n }\n fs.readFile(filename, callback);\n}\n\nfunction http(url, callback) {\n if (!callback) {\n return require('sync-request')('GET', url).getBody();\n }\n \n var options = {url: url, encoding: null, gzip: true};\n require('request')(options, function(error, response, body) {\n if (!error && response.statusCode === 200) {\n callback(null, body);\n } else {\n error = error ||\n 'Load failed with response code ' + response.statusCode + '.';\n callback(error, null);\n }\n });\n}\n\nfunction startsWith(string, searchString) {\n return string == null ? false : string.lastIndexOf(searchString, 0) === 0;\n}\n\nload.sanitizeUrl = sanitizeUrl;\n\nload.useXHR = (typeof XMLHttpRequest !== 'undefined');\n\nmodule.exports = load;\n\n},{\"fs\":1,\"request\":1,\"sync-request\":1,\"url\":1}],24:[function(require,module,exports){\nvar util = require('../util');\nvar type = require('./type');\nvar formats = require('./formats');\n\nfunction read(data, format) {\n var type = (format && format.type) || 'json';\n data = formats[type](data, format);\n if (format && format.parse) parse(data, format.parse);\n return data;\n}\n\nfunction parse(data, types) {\n var cols, parsers, d, i, j, clen, len = data.length;\n\n types = (types==='auto') ? type.inferAll(data) : util.duplicate(types);\n cols = util.keys(types);\n parsers = cols.map(function(c) { return type.parsers[types[c]]; });\n\n for (i=0, clen=cols.length; i 0 ? Math.min(l, opt.maxwidth) : l;\n });\n\n // print header row\n var head = fields.map(function(name, i) {\n return util.truncate(util.pad(name, lens[i], 'center'), lens[i]);\n }).join(opt.separator);\n\n // build template function for each row\n var tmpl = template(fields.map(function(name, i) {\n return '{{' +\n name +\n (FMT[types[name]] || '') +\n ('|pad:' + lens[i] + ',' + (POS[types[name]] || 'right')) +\n ('|truncate:' + lens[i]) +\n '}}';\n }).join(opt.separator));\n\n // print table\n return head + \"\\n\" + data.map(tmpl).join('\\n');\n};\n\nmodule.exports.summary = function(s) {\n s = s ? s.__summary__ ? s : stats.summary(s) : this;\n var str = [], i, n;\n for (i=0, n=s.length; i b) b = v;\n }\n }\n return [a, b];\n};\n\n// Find the integer indices of the minimum and maximum values.\nstats.extent.index = function(values, f) {\n f = util.$(f);\n var x = -1, y = -1, a, b, v, i, n = values.length;\n for (i=0; i b) { b = v; y = i; }\n }\n }\n return [x, y];\n};\n\n// Compute the dot product of two arrays of numbers.\nstats.dot = function(values, a, b) {\n var sum = 0, i, v;\n if (!b) {\n if (values.length !== a.length) {\n throw Error('Array lengths must match.');\n }\n for (i=0; i -1 && p !== v) {\n mu = 1 + (i-1 + tie) / 2;\n for (; tie -1) {\n mu = 1 + (n-1 + tie) / 2;\n for (; tie max) max = x;\n delta = x - mean;\n mean = mean + delta / (++valid);\n M2 = M2 + delta * (x - mean);\n vals.push(x);\n }\n }\n M2 = M2 / (valid - 1);\n sd = Math.sqrt(M2);\n\n // sort values for median and iqr\n vals.sort(util.cmp);\n\n return {\n type: type(values, f),\n unique: u,\n count: values.length,\n valid: valid,\n missing: missing,\n distinct: distinct,\n min: min,\n max: max,\n mean: mean,\n stdev: sd,\n median: (v = stats.quantile(vals, 0.5)),\n q1: stats.quantile(vals, 0.25),\n q3: stats.quantile(vals, 0.75),\n modeskew: sd === 0 ? 0 : (mean - v) / sd\n };\n};\n\n// Compute profiles for all variables in a data set.\nstats.summary = function(data, fields) {\n fields = fields || util.keys(data[0]);\n var s = fields.map(function(f) {\n var p = stats.profile(data, util.$(f));\n return (p.field = f, p);\n });\n return (s.__summary__ = true, s);\n};\n\nmodule.exports = stats;\n},{\"./generate\":17,\"./import/type\":26,\"./util\":32}],30:[function(require,module,exports){\nvar util = require('./util'),\n format = require('./format');\n\nvar context = {\n formats: [],\n format_map: {},\n truncate: util.truncate,\n pad: util.pad\n};\n\nfunction template(text) {\n var src = source(text, 'd');\n src = 'var __t; return ' + src + ';';\n\n /* jshint evil: true */\n return (new Function('d', src)).bind(context);\n}\n\ntemplate.source = source;\ntemplate.context = context;\nmodule.exports = template;\n\n// Clear cache of format objects.\n// This can *break* prior template functions, so invoke with care!\ntemplate.clearFormatCache = function() {\n context.formats = [];\n context.format_map = {};\n};\n\n// Generate property access code for use within template source.\n// object: the name of the object (variable) containing template data\n// property: the property access string, verbatim from template tag\ntemplate.property = function(object, property) {\n var src = util.field(property).map(util.str).join('][');\n return object + '[' + src + ']';\n};\n\n// Generate source code for a template function.\n// text: the template text\n// variable: the name of the data object variable ('obj' by default)\n// properties: optional hash for collecting all accessed properties\nfunction source(text, variable, properties) {\n variable = variable || 'obj';\n var index = 0;\n var src = '\\'';\n var regex = template_re;\n\n // Compile the template source, escaping string literals appropriately.\n text.replace(regex, function(match, interpolate, offset) {\n src += text\n .slice(index, offset)\n .replace(template_escaper, template_escapeChar);\n index = offset + match.length;\n\n if (interpolate) {\n src += '\\'\\n+((__t=(' +\n template_var(interpolate, variable, properties) +\n '))==null?\\'\\':__t)+\\n\\'';\n }\n\n // Adobe VMs need the match returned to produce the correct offest.\n return match;\n });\n return src + '\\'';\n}\n\nfunction template_var(text, variable, properties) {\n var filters = text.match(filter_re);\n var prop = filters.shift().trim();\n var stringCast = true;\n\n function strcall(fn) {\n fn = fn || '';\n if (stringCast) {\n stringCast = false;\n src = 'String(' + src + ')' + fn;\n } else {\n src += fn;\n }\n return src;\n }\n\n function date() {\n return '(typeof ' + src + '===\"number\"?new Date('+src+'):'+src+')';\n }\n\n function number_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+src+')';\n }\n \n function time_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+date()+')';\n }\n\n if (properties) properties[prop] = 1;\n var src = template.property(variable, prop);\n\n for (var i=0; i 0) {\n f = f.slice(0, pidx);\n args = filters[i].slice(pidx+1)\n .match(args_re)\n .map(function(s) { return s.trim(); });\n }\n f = f.trim();\n\n switch (f) {\n case 'length':\n strcall('.length');\n break;\n case 'lower':\n strcall('.toLowerCase()');\n break;\n case 'upper':\n strcall('.toUpperCase()');\n break;\n case 'lower-locale':\n strcall('.toLocaleLowerCase()');\n break;\n case 'upper-locale':\n strcall('.toLocaleUpperCase()');\n break;\n case 'trim':\n strcall('.trim()');\n break;\n case 'left':\n a = util.number(args[0]);\n strcall('.slice(0,' + a + ')');\n break;\n case 'right':\n a = util.number(args[0]);\n strcall('.slice(-' + a +')');\n break;\n case 'mid':\n a = util.number(args[0]);\n b = a + util.number(args[1]);\n strcall('.slice(+'+a+','+b+')');\n break;\n case 'slice':\n a = util.number(args[0]);\n strcall('.slice('+ a +\n (args.length > 1 ? ',' + util.number(args[1]) : '') +\n ')');\n break;\n case 'truncate':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.truncate(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'pad':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.pad(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'number':\n number_format(format.number, 'number');\n break;\n case 'time':\n time_format(format.time, 'time');\n break;\n case 'time-utc':\n time_format(format.utc, 'time-utc');\n break;\n default:\n throw Error('Unrecognized template filter: ' + f);\n }\n }\n\n return src;\n}\n\nvar template_re = /\\{\\{(.+?)\\}\\}|$/g,\n filter_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^\\|\"]+|[^\\|\\']+)+/g,\n args_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^,\"]+|[^,\\']+)+/g;\n\n// Certain characters need to be escaped so that they can be put into a\n// string literal.\nvar template_escapes = {\n '\\'': '\\'',\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\nvar template_escaper = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\nfunction template_escapeChar(match) {\n return '\\\\' + template_escapes[match];\n}\n\nfunction template_format(pattern, key, fmt) {\n if ((pattern[0] === '\\'' && pattern[pattern.length-1] === '\\'') ||\n (pattern[0] === '\"' && pattern[pattern.length-1] === '\"')) {\n pattern = pattern.slice(1, -1);\n } else {\n throw Error('Format pattern must be quoted: ' + pattern);\n }\n key = key + ':' + pattern;\n if (!context.format_map[key]) {\n var f = fmt(pattern);\n var i = context.formats.length;\n context.formats.push(f);\n context.format_map[key] = i;\n }\n return context.format_map[key];\n}\n\n},{\"./format\":16,\"./util\":32}],31:[function(require,module,exports){\nvar d3_time = require('d3-time');\n\nvar tempDate = new Date(),\n baseDate = new Date(0, 0, 1).setFullYear(0), // Jan 1, 0 AD\n utcBaseDate = new Date(Date.UTC(0, 0, 1)).setUTCFullYear(0);\n\nfunction date(d) {\n return (tempDate.setTime(+d), tempDate);\n}\n\n// create a time unit entry\nfunction entry(type, date, unit, step, min, max) {\n var e = {\n type: type,\n date: date,\n unit: unit\n };\n if (step) {\n e.step = step;\n } else {\n e.minstep = 1;\n }\n if (min != null) e.min = min;\n if (max != null) e.max = max;\n return e;\n}\n\nfunction create(type, unit, base, step, min, max) {\n return entry(type,\n function(d) { return unit.offset(base, d); },\n function(d) { return unit.count(base, d); },\n step, min, max);\n}\n\nvar locale = [\n create('second', d3_time.second, baseDate),\n create('minute', d3_time.minute, baseDate),\n create('hour', d3_time.hour, baseDate),\n create('day', d3_time.day, baseDate, [1, 7]),\n create('month', d3_time.month, baseDate, [1, 3, 6]),\n create('year', d3_time.year, baseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(1970, 0, 1, 0, 0, d); },\n function(d) { return date(d).getSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(1970, 0, 1, 0, d); },\n function(d) { return date(d).getMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(1970, 0, 1, d); },\n function(d) { return date(d).getHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(1970, 0, 4+d); },\n function(d) { return date(d).getDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(1970, 0, d); },\n function(d) { return date(d).getDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(1970, d % 12, 1); },\n function(d) { return date(d).getMonth(); },\n [1], 0, 11\n )\n];\n\nvar utc = [\n create('second', d3_time.utcSecond, utcBaseDate),\n create('minute', d3_time.utcMinute, utcBaseDate),\n create('hour', d3_time.utcHour, utcBaseDate),\n create('day', d3_time.utcDay, utcBaseDate, [1, 7]),\n create('month', d3_time.utcMonth, utcBaseDate, [1, 3, 6]),\n create('year', d3_time.utcYear, utcBaseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, 0, d)); },\n function(d) { return date(d).getUTCSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, d)); },\n function(d) { return date(d).getUTCMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(Date.UTC(1970, 0, 1, d)); },\n function(d) { return date(d).getUTCHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(Date.UTC(1970, 0, 4+d)); },\n function(d) { return date(d).getUTCDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(Date.UTC(1970, 0, d)); },\n function(d) { return date(d).getUTCDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(Date.UTC(1970, d % 12, 1)); },\n function(d) { return date(d).getUTCMonth(); },\n [1], 0, 11\n )\n];\n\nvar STEPS = [\n [31536e6, 5], // 1-year\n [7776e6, 4], // 3-month\n [2592e6, 4], // 1-month\n [12096e5, 3], // 2-week\n [6048e5, 3], // 1-week\n [1728e5, 3], // 2-day\n [864e5, 3], // 1-day\n [432e5, 2], // 12-hour\n [216e5, 2], // 6-hour\n [108e5, 2], // 3-hour\n [36e5, 2], // 1-hour\n [18e5, 1], // 30-minute\n [9e5, 1], // 15-minute\n [3e5, 1], // 5-minute\n [6e4, 1], // 1-minute\n [3e4, 0], // 30-second\n [15e3, 0], // 15-second\n [5e3, 0], // 5-second\n [1e3, 0] // 1-second\n];\n\nfunction find(units, span, minb, maxb) {\n var step = STEPS[0], i, n, bins;\n\n for (i=1, n=STEPS.length; i step[0]) {\n bins = span / step[0];\n if (bins > maxb) {\n return units[STEPS[i-1][1]];\n }\n if (bins >= minb) {\n return units[step[1]];\n }\n }\n }\n return units[STEPS[n-1][1]];\n}\n\nfunction toUnitMap(units) {\n var map = {}, i, n;\n for (i=0, n=units.length; i 1 ?\n function(x) { return s.reduce(function(x,f) { return x[f]; }, x); } :\n function(x) { return x[f]; }\n );\n};\n\n// short-cut for accessor\nu.$ = u.accessor;\n\nu.mutator = function(f) {\n var s;\n return u.isString(f) && (s=u.field(f)).length > 1 ?\n function(x, v) {\n for (var i=0; i y) return sign[i];\n }\n return 0;\n };\n};\n\nu.cmp = function(a, b) {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else if (a >= b) {\n return 0;\n } else if (a === null) {\n return -1;\n } else if (b === null) {\n return 1;\n }\n return NaN;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i 1) {\n for (var i=1, n=ref.length; i 0) {\n node = pq.peek();\n pulse = pulses[node._id];\n\n if (node.rank() !== node.qrank()) {\n // A node's rank might change during a propagation. Re-queue if so.\n pq.replace(node.qrank(true));\n } else {\n // Evaluate node and propagate pulse.\n pq.pop();\n pulses[node._id] = null;\n listeners = node._listeners;\n pulse = this.evaluate(pulse, node);\n\n // Propagate the pulse. \n if (pulse !== this.doNotPropagate) {\n // Ensure reflow pulses always send reflow pulses even if skipped.\n if (!pulse.reflow && node.reflows()) {\n pulse = ChangeSet.create(pulse, true);\n }\n\n for (i=0, len=listeners.length; i 0) branch[i-1].addListener(node);\n }\n\n return branch;\n};\n\nprototype.disconnect = function(branch) {\n var collector, node, data, signals, i, n, j, m;\n\n for (i=0, n=branch.length; i= pulse.stamp,\n run = node.router() || pulse.add.length || pulse.rem.length;\n\n return run || !reflowed || node.reevaluate(pulse);\n};\n\nprototype.evaluate = function(pulse, node) {\n if (!this.reevaluate(pulse, node)) return pulse;\n pulse = node.evaluate(pulse);\n node.last(pulse.stamp);\n return pulse;\n};\n\nmodule.exports = Graph;\n\n},{\"./ChangeSet\":34,\"./Collector\":35,\"./DataSource\":36,\"./Dependencies\":37,\"./Heap\":39,\"./Signal\":41,\"./Tuple\":42,\"datalib\":27}],39:[function(require,module,exports){\nfunction Heap(comparator) {\n this.cmp = comparator;\n this.nodes = [];\n}\n\nvar prototype = Heap.prototype;\n\nprototype.size = function() {\n return this.nodes.length;\n};\n\nprototype.clear = function() {\n return (this.nodes = [], this);\n};\n\nprototype.peek = function() {\n return this.nodes[0];\n};\n\nprototype.push = function(x) {\n var array = this.nodes;\n array.push(x);\n return _siftdown(array, 0, array.length-1, this.cmp);\n};\n\nprototype.pop = function() {\n var array = this.nodes,\n last = array.pop(),\n item;\n\n if (array.length) {\n item = array[0];\n array[0] = last;\n _siftup(array, 0, this.cmp);\n } else {\n item = last;\n }\n return item;\n};\n\nprototype.replace = function(item) {\n var array = this.nodes,\n retval = array[0];\n array[0] = item;\n _siftup(array, 0, this.cmp);\n return retval;\n};\n\nprototype.pushpop = function(item) {\n var array = this.nodes, ref = array[0];\n if (array.length && this.cmp(ref, item) < 0) {\n array[0] = item;\n item = ref;\n _siftup(array, 0, this.cmp);\n }\n return item;\n};\n\nfunction _siftdown(array, start, idx, cmp) {\n var item, parent, pidx;\n\n item = array[idx];\n while (idx > start) {\n pidx = (idx - 1) >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return (array[idx] = item);\n}\n\nfunction _siftup(array, idx, cmp) {\n var start = idx,\n end = array.length,\n item = array[idx],\n cidx = 2 * idx + 1, ridx;\n\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = 2 * idx + 1;\n }\n array[idx] = item;\n return _siftdown(array, start, idx, cmp);\n}\n\nmodule.exports = Heap;\n\n},{}],40:[function(require,module,exports){\nvar DEPS = require('./Dependencies').ALL,\n nodeID = 0;\n\nfunction Node(graph) {\n if (graph) this.init(graph);\n}\n\nvar Flags = Node.Flags = {\n Router: 0x01, // Responsible for propagating tuples, cannot be skipped.\n Collector: 0x02, // Holds a materialized dataset, pulse node to reflow.\n Produces: 0x04, // Produces new tuples. \n Mutates: 0x08, // Sets properties of incoming tuples.\n Reflows: 0x10, // Forwards a reflow pulse.\n Batch: 0x20 // Performs batch data processing, needs collector.\n};\n\nvar prototype = Node.prototype;\n\nprototype.init = function(graph) {\n this._id = ++nodeID;\n this._graph = graph;\n this._rank = graph.rank(); // Topological sort by rank\n this._qrank = null; // Rank when enqueued for propagation\n this._stamp = 0; // Last stamp seen\n\n this._listeners = [];\n this._listeners._ids = {}; // To prevent duplicate listeners\n\n // Initialize dependencies.\n this._deps = {};\n for (var i=0, n=DEPS.length; i l._rank) {\n var q = [l],\n g = this._graph, cur;\n while (q.length) {\n cur = q.shift();\n cur._rank = g.rank();\n q.unshift.apply(q, cur.listeners());\n }\n }\n\n return this;\n};\n\nprototype.removeListener = function(l) {\n if (!this._listeners._ids[l._id]) return false;\n \n var idx = this._listeners.indexOf(l),\n b = idx >= 0;\n\n if (b) {\n this._listeners.splice(idx, 1);\n this._listeners._ids[l._id] = null;\n }\n return b;\n};\n\nprototype.disconnect = function() {\n this._listeners = [];\n this._listeners._ids = {};\n};\n\n// Evaluate this dataflow node for the current pulse.\n// Subclasses should override to perform custom processing.\nprototype.evaluate = function(pulse) {\n return pulse;\n};\n\n// Should this node be re-evaluated for the current pulse?\n// Searches pulse to see if any dependencies have updated.\nprototype.reevaluate = function(pulse) {\n var prop, dep, i, n, j, m;\n\n for (i=0, n=DEPS.length; i=0;) {\n if (!handler || h[i].handler === handler) {\n x = h.splice(i, 1)[0];\n this.removeListener(x.node);\n }\n }\n\n return this;\n};\n\nmodule.exports = Signal;\n\n},{\"./ChangeSet\":34,\"./Node\":40}],42:[function(require,module,exports){\nvar tupleID = 0;\n\nfunction ingest(datum) {\n datum = (datum === Object(datum)) ? datum : {data: datum};\n datum._id = ++tupleID;\n if (datum._prev) datum._prev = null;\n return datum;\n}\n\nfunction idMap(a, ids) {\n ids = ids || {};\n for (var i=0, n=a.length; i0;) {\n idMap(arguments[i], ids);\n }\n return data.filter(function(x) { return !ids[x._id]; });\n }\n};\n\n},{}],43:[function(require,module,exports){\nmodule.exports = {\n ChangeSet: require('./ChangeSet'),\n Collector: require('./Collector'),\n DataSource: require('./DataSource'),\n Dependencies: require('./Dependencies'),\n Graph: require('./Graph'),\n Node: require('./Node'),\n Signal: require('./Signal'),\n Tuple: require('./Tuple'),\n debug: require('vega-logging').debug\n};\n\n},{\"./ChangeSet\":34,\"./Collector\":35,\"./DataSource\":36,\"./Dependencies\":37,\"./Graph\":38,\"./Node\":40,\"./Signal\":41,\"./Tuple\":42,\"vega-logging\":33}],44:[function(require,module,exports){\nfunction toMap(list) {\n var map = {}, i, n;\n for (i=0, n=list.length; i 0) {\n return id;\n }\n if (constants.hasOwnProperty(id)) {\n return constants[id];\n }\n if (idWhiteList) {\n if (idWhiteList.hasOwnProperty(id)) {\n return id;\n } else {\n globals[id] = 1;\n return lookupGlobal(id);\n }\n }\n if (idBlackList && idBlackList.hasOwnProperty(id)) {\n throw new Error('Illegal identifier: ' + id);\n }\n return id;\n },\n 'Program': function(n) {\n return n.body.map(codegen).join('\\n');\n },\n 'MemberExpression': function(n) {\n var d = !n.computed;\n var o = codegen(n.object);\n if (d) memberDepth += 1;\n var p = codegen(n.property);\n if (o === FIELD_VAR) { fields[p] = 1; } // HACKish...\n if (d) memberDepth -= 1;\n return o + (d ? '.'+p : '['+p+']');\n },\n 'CallExpression': function(n) {\n if (n.callee.type !== 'Identifier') {\n throw new Error('Illegal callee type: ' + n.callee.type);\n }\n var callee = n.callee.name;\n var args = n.arguments;\n var fn = functions.hasOwnProperty(callee) && functions[callee];\n if (!fn) throw new Error('Unrecognized function: ' + callee);\n return fn instanceof Function ?\n fn(args) :\n fn + '(' + args.map(codegen).join(',') + ')';\n },\n 'ArrayExpression': function(n) {\n return '[' + n.elements.map(codegen).join(',') + ']';\n },\n 'BinaryExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'UnaryExpression': function(n) {\n return '(' + n.operator + codegen(n.argument) + ')';\n },\n 'ConditionalExpression': function(n) {\n return '(' + codegen(n.test) +\n '?' + codegen(n.consequent) +\n ':' + codegen(n.alternate) +\n ')';\n },\n 'LogicalExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'ObjectExpression': function(n) {\n return '{' + n.properties.map(codegen).join(',') + '}';\n },\n 'Property': function(n) {\n memberDepth += 1;\n var k = codegen(n.key);\n memberDepth -= 1;\n return k + ':' + codegen(n.value);\n },\n 'ExpressionStatement': function(n) {\n return codegen(n.expression);\n }\n };\n\n codegen_wrap.functions = functions;\n codegen_wrap.constants = constants;\n return codegen_wrap;\n};\n\n},{\"./constants\":45,\"./functions\":46}],45:[function(require,module,exports){\nmodule.exports = {\n 'NaN': 'NaN',\n 'E': 'Math.E',\n 'LN2': 'Math.LN2',\n 'LN10': 'Math.LN10',\n 'LOG2E': 'Math.LOG2E',\n 'LOG10E': 'Math.LOG10E',\n 'PI': 'Math.PI',\n 'SQRT1_2': 'Math.SQRT1_2',\n 'SQRT2': 'Math.SQRT2'\n};\n},{}],46:[function(require,module,exports){\nmodule.exports = function(codegen) {\n\n function fncall(name, args, cast, type) {\n var obj = codegen(args[0]);\n if (cast) {\n obj = cast + '(' + obj + ')';\n if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';\n }\n return obj + '.' + name + (type < 0 ? '' : type === 0 ?\n '()' :\n '(' + args.slice(1).map(codegen).join(',') + ')');\n }\n\n function fn(name, cast, type) {\n return function(args) {\n return fncall(name, args, cast, type);\n };\n }\n\n var DATE = 'new Date',\n STRING = 'String',\n REGEXP = 'RegExp';\n\n return {\n // MATH functions\n 'isNaN': 'isNaN',\n 'isFinite': 'isFinite',\n 'abs': 'Math.abs',\n 'acos': 'Math.acos',\n 'asin': 'Math.asin',\n 'atan': 'Math.atan',\n 'atan2': 'Math.atan2',\n 'ceil': 'Math.ceil',\n 'cos': 'Math.cos',\n 'exp': 'Math.exp',\n 'floor': 'Math.floor',\n 'log': 'Math.log',\n 'max': 'Math.max',\n 'min': 'Math.min',\n 'pow': 'Math.pow',\n 'random': 'Math.random',\n 'round': 'Math.round',\n 'sin': 'Math.sin',\n 'sqrt': 'Math.sqrt',\n 'tan': 'Math.tan',\n\n 'clamp': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to clamp function.');\n if (args.length > 3)\n throw new Error('Too many arguments to clamp function.');\n var a = args.map(codegen);\n return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))';\n },\n\n // DATE functions\n 'now': 'Date.now',\n 'datetime': DATE,\n 'date': fn('getDate', DATE, 0),\n 'day': fn('getDay', DATE, 0),\n 'year': fn('getFullYear', DATE, 0),\n 'month': fn('getMonth', DATE, 0),\n 'hours': fn('getHours', DATE, 0),\n 'minutes': fn('getMinutes', DATE, 0),\n 'seconds': fn('getSeconds', DATE, 0),\n 'milliseconds': fn('getMilliseconds', DATE, 0),\n 'time': fn('getTime', DATE, 0),\n 'timezoneoffset': fn('getTimezoneOffset', DATE, 0),\n 'utcdate': fn('getUTCDate', DATE, 0),\n 'utcday': fn('getUTCDay', DATE, 0),\n 'utcyear': fn('getUTCFullYear', DATE, 0),\n 'utcmonth': fn('getUTCMonth', DATE, 0),\n 'utchours': fn('getUTCHours', DATE, 0),\n 'utcminutes': fn('getUTCMinutes', DATE, 0),\n 'utcseconds': fn('getUTCSeconds', DATE, 0),\n 'utcmilliseconds': fn('getUTCMilliseconds', DATE, 0),\n\n // shared sequence functions\n 'length': fn('length', null, -1),\n 'indexof': fn('indexOf', null),\n 'lastindexof': fn('lastIndexOf', null),\n\n // STRING functions\n 'parseFloat': 'parseFloat',\n 'parseInt': 'parseInt',\n 'upper': fn('toUpperCase', STRING, 0),\n 'lower': fn('toLowerCase', STRING, 0),\n 'slice': fn('slice', STRING),\n 'substring': fn('substring', STRING),\n\n // REGEXP functions\n 'regexp': REGEXP,\n 'test': fn('test', REGEXP),\n\n // Control Flow functions\n 'if': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to if function.');\n if (args.length > 3)\n throw new Error('Too many arguments to if function.');\n var a = args.map(codegen);\n return a[0]+'?'+a[1]+':'+a[2];\n }\n };\n};\n},{}],47:[function(require,module,exports){\nvar parser = require('./parser'),\n codegen = require('./codegen');\n \nvar expr = module.exports = {\n parse: function(input, opt) {\n return parser.parse('('+input+')', opt);\n },\n code: function(opt) {\n return codegen(opt);\n },\n compiler: function(args, opt) {\n args = args.slice();\n var generator = codegen(opt),\n len = args.length,\n compile = function(str) {\n var value = generator(expr.parse(str));\n args[len] = '\"use strict\"; return (' + value.code + ');';\n value.fn = Function.apply(null, args);\n return value;\n };\n compile.codegen = generator;\n return compile;\n },\n functions: require('./functions'),\n constants: require('./constants')\n};\n\n},{\"./codegen\":44,\"./constants\":45,\"./functions\":46,\"./parser\":48}],48:[function(require,module,exports){\n/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \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*/\n/* istanbul ignore next */\nmodule.exports = (function() {\n 'use strict';\n\n var Token,\n TokenName,\n Syntax,\n PropertyKind,\n Messages,\n Regex,\n source,\n strict,\n index,\n lineNumber,\n lineStart,\n length,\n lookahead,\n state,\n extra;\n\n Token = {\n BooleanLiteral: 1,\n EOF: 2,\n Identifier: 3,\n Keyword: 4,\n NullLiteral: 5,\n NumericLiteral: 6,\n Punctuator: 7,\n StringLiteral: 8,\n RegularExpression: 9\n };\n\n TokenName = {};\n TokenName[Token.BooleanLiteral] = 'Boolean';\n TokenName[Token.EOF] = '';\n TokenName[Token.Identifier] = 'Identifier';\n TokenName[Token.Keyword] = 'Keyword';\n TokenName[Token.NullLiteral] = 'Null';\n TokenName[Token.NumericLiteral] = 'Numeric';\n TokenName[Token.Punctuator] = 'Punctuator';\n TokenName[Token.StringLiteral] = 'String';\n TokenName[Token.RegularExpression] = 'RegularExpression';\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n ArrayExpression: 'ArrayExpression',\n BinaryExpression: 'BinaryExpression',\n CallExpression: 'CallExpression',\n ConditionalExpression: 'ConditionalExpression',\n ExpressionStatement: 'ExpressionStatement',\n Identifier: 'Identifier',\n Literal: 'Literal',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n ObjectExpression: 'ObjectExpression',\n Program: 'Program',\n Property: 'Property',\n UnaryExpression: 'UnaryExpression'\n };\n\n PropertyKind = {\n Data: 1,\n Get: 2,\n Set: 4\n };\n\n // Error messages should be identical to V8.\n Messages = {\n UnexpectedToken: 'Unexpected token %0',\n UnexpectedNumber: 'Unexpected number',\n UnexpectedString: 'Unexpected string',\n UnexpectedIdentifier: 'Unexpected identifier',\n UnexpectedReserved: 'Unexpected reserved word',\n UnexpectedEOS: 'Unexpected end of input',\n NewlineAfterThrow: 'Illegal newline after throw',\n InvalidRegExp: 'Invalid regular expression',\n UnterminatedRegExp: 'Invalid regular expression: missing /',\n InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n NoCatchOrFinally: 'Missing catch or finally after try',\n UnknownLabel: 'Undefined label \\'%0\\'',\n Redeclaration: '%0 \\'%1\\' has already been declared',\n IllegalContinue: 'Illegal continue statement',\n IllegalBreak: 'Illegal break statement',\n IllegalReturn: 'Illegal return statement',\n StrictModeWith: 'Strict mode code may not include a with statement',\n StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',\n AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',\n AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',\n StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n StrictReservedWord: 'Use of future reserved word in strict mode'\n };\n\n // See also tools/generate-unicode-regex.py.\n Regex = {\n NonAsciiIdentifierStart: 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]'),\n NonAsciiIdentifierPart: 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-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\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]')\n };\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\n function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }\n\n function isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n }\n\n function isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n }\n\n function isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n }\n\n // 7.2 White Space\n\n function 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\n function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }\n\n // 7.6 Identifier Names and Identifiers\n\n function 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) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n }\n\n function 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) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n }\n\n // 7.6.1.2 Future Reserved Words\n\n function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }\n\n function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }\n\n // 7.6.1.1 Keywords\n\n function isKeyword(id) {\n if (strict && isStrictModeReservedWord(id)) {\n return true;\n }\n\n // 'const' is specialized as Keyword in V8.\n // 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.\n // Some others are from future reserved words.\n\n switch (id.length) {\n case 2:\n return (id === 'if') || (id === 'in') || (id === 'do');\n case 3:\n return (id === 'var') || (id === 'for') || (id === 'new') ||\n (id === 'try') || (id === 'let');\n case 4:\n return (id === 'this') || (id === 'else') || (id === 'case') ||\n (id === 'void') || (id === 'with') || (id === 'enum');\n case 5:\n return (id === 'while') || (id === 'break') || (id === 'catch') ||\n (id === 'throw') || (id === 'const') || (id === 'yield') ||\n (id === 'class') || (id === 'super');\n case 6:\n return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n (id === 'switch') || (id === 'export') || (id === 'import');\n case 7:\n return (id === 'default') || (id === 'finally') || (id === 'extends');\n case 8:\n return (id === 'function') || (id === 'continue') || (id === 'debugger');\n case 10:\n return (id === 'instanceof');\n default:\n return false;\n }\n }\n\n function skipComment() {\n var ch, start;\n\n start = (index === 0);\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch)) {\n ++index;\n } else if (isLineTerminator(ch)) {\n ++index;\n if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n start = true;\n } else {\n break;\n }\n }\n }\n\n function 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 return '';\n }\n }\n return String.fromCharCode(code);\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, '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\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n id += ch;\n }\n }\n\n return id;\n }\n\n function 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\n function 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 = Token.Identifier;\n } else if (isKeyword(id)) {\n type = Token.Keyword;\n } else if (id === 'null') {\n type = Token.NullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = Token.BooleanLiteral;\n } else {\n type = Token.Identifier;\n }\n\n return {\n type: type,\n value: id,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.7 Punctuators\n\n function 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 if (extra.tokenize) {\n if (code === 0x28) {\n extra.openParenToken = extra.tokens.length;\n } else if (code === 0x7B) {\n extra.openCurlyToken = extra.tokens.length;\n }\n }\n return {\n type: Token.Punctuator,\n value: String.fromCharCode(code),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: source.slice(start, index),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch4,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch3,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch2,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch1,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n // 7.8.3 Numeric Literals\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt('0x' + number, 16),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseFloat(number),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.8.4 String Literals\n\n function scanStringLiteral() {\n var str = '', quote, start, ch, code, unescaped, restore, octal = false, startLineNumber, startLineStart;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\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 restore = index;\n unescaped = scanHexEscape(ch);\n if (unescaped) {\n str += unescaped;\n } else {\n index = restore;\n str += ch;\n }\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 ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.StringLiteral,\n value: str,\n octal: octal,\n startLineNumber: startLineNumber,\n startLineStart: startLineStart,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function testRegExp(pattern, flags) {\n var tmp = pattern,\n value;\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({}, Messages.InvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n value = new RegExp(tmp);\n } catch (e) {\n throwError({}, Messages.InvalidRegExp);\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\n function 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({}, Messages.UnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, Messages.UnterminatedRegExp);\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({}, Messages.UnterminatedRegExp);\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\n function scanRegExpFlags() {\n var ch, str, flags, restore;\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 ch = source[index];\n if (ch === 'u') {\n ++index;\n restore = index;\n ch = scanHexEscape('u');\n if (ch) {\n flags += ch;\n for (str += '\\\\u'; restore < index; ++restore) {\n str += source[restore];\n }\n } else {\n index = restore;\n flags += 'u';\n str += '\\\\u';\n }\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n } else {\n str += '\\\\';\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n return {\n value: flags,\n literal: str\n };\n }\n\n function 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 if (extra.tokenize) {\n return {\n type: Token.RegularExpression,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\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\n function collectRegex() {\n var pos, loc, regex, token;\n\n skipComment();\n\n pos = index;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n regex = scanRegExp();\n\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (!extra.tokenize) {\n // Pop the previous token, which is likely '/' or '/='\n if (extra.tokens.length > 0) {\n token = extra.tokens[extra.tokens.length - 1];\n if (token.range[0] === pos && token.type === 'Punctuator') {\n if (token.value === '/' || token.value === '/=') {\n extra.tokens.pop();\n }\n }\n }\n\n extra.tokens.push({\n type: 'RegularExpression',\n value: regex.literal,\n regex: regex.regex,\n range: [pos, index],\n loc: loc\n });\n }\n\n return regex;\n }\n\n function isIdentifierName(token) {\n return token.type === Token.Identifier ||\n token.type === Token.Keyword ||\n token.type === Token.BooleanLiteral ||\n token.type === Token.NullLiteral;\n }\n\n function advanceSlash() {\n var prevToken,\n checkToken;\n // Using the following algorithm:\n // https://github.com/mozilla/sweet.js/wiki/design\n prevToken = extra.tokens[extra.tokens.length - 1];\n if (!prevToken) {\n // Nothing before that: it cannot be a division.\n return collectRegex();\n }\n if (prevToken.type === 'Punctuator') {\n if (prevToken.value === ']') {\n return scanPunctuator();\n }\n if (prevToken.value === ')') {\n checkToken = extra.tokens[extra.openParenToken - 1];\n if (checkToken &&\n checkToken.type === 'Keyword' &&\n (checkToken.value === 'if' ||\n checkToken.value === 'while' ||\n checkToken.value === 'for' ||\n checkToken.value === 'with')) {\n return collectRegex();\n }\n return scanPunctuator();\n }\n if (prevToken.value === '}') {\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n if (extra.tokens[extra.openCurlyToken - 3] &&\n extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {\n // Anonymous function.\n checkToken = extra.tokens[extra.openCurlyToken - 4];\n if (!checkToken) {\n return scanPunctuator();\n }\n } else if (extra.tokens[extra.openCurlyToken - 4] &&\n extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {\n // Named function.\n checkToken = extra.tokens[extra.openCurlyToken - 5];\n if (!checkToken) {\n return collectRegex();\n }\n } else {\n return scanPunctuator();\n }\n return scanPunctuator();\n }\n return collectRegex();\n }\n if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {\n return collectRegex();\n }\n return scanPunctuator();\n }\n\n function advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: Token.EOF,\n lineNumber: lineNumber,\n lineStart: lineStart,\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 // Slash (/) U+002F can also start a regex.\n if (extra.tokenize && ch === 0x2F) {\n return advanceSlash();\n }\n\n return scanPunctuator();\n }\n\n function collectToken() {\n var loc, token, value, entry;\n\n skipComment();\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n token = advance();\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (token.type !== Token.EOF) {\n value = source.slice(token.start, token.end);\n entry = {\n type: TokenName[token.type],\n value: value,\n range: [token.start, token.end],\n loc: loc\n };\n if (token.regex) {\n entry.regex = {\n pattern: token.regex.pattern,\n flags: token.regex.flags\n };\n }\n extra.tokens.push(entry);\n }\n\n return token;\n }\n\n function lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n return token;\n }\n\n function peek() {\n var pos, line, start;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n index = pos;\n lineNumber = line;\n lineStart = start;\n }\n\n function Position() {\n this.line = lineNumber;\n this.column = index - lineStart;\n }\n\n function SourceLocation() {\n this.start = new Position();\n this.end = null;\n }\n\n function WrappingSourceLocation(startToken) {\n if (startToken.type === Token.StringLiteral) {\n this.start = {\n line: startToken.startLineNumber,\n column: startToken.start - startToken.startLineStart\n };\n } else {\n this.start = {\n line: startToken.lineNumber,\n column: startToken.start - startToken.lineStart\n };\n }\n this.end = null;\n }\n\n function Node() {\n // Skip comment.\n index = lookahead.start;\n if (lookahead.type === Token.StringLiteral) {\n lineNumber = lookahead.startLineNumber;\n lineStart = lookahead.startLineStart;\n } else {\n lineNumber = lookahead.lineNumber;\n lineStart = lookahead.lineStart;\n }\n if (extra.range) {\n this.range = [index, 0];\n }\n if (extra.loc) {\n this.loc = new SourceLocation();\n }\n }\n\n function WrappingNode(startToken) {\n if (extra.range) {\n this.range = [startToken.start, 0];\n }\n if (extra.loc) {\n this.loc = new WrappingSourceLocation(startToken);\n }\n }\n\n WrappingNode.prototype = Node.prototype = {\n\n finish: function () {\n if (extra.range) {\n this.range[1] = index;\n }\n if (extra.loc) {\n this.loc.end = new Position();\n if (extra.source) {\n this.loc.source = extra.source;\n }\n }\n },\n\n finishArrayExpression: function (elements) {\n this.type = Syntax.ArrayExpression;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishAssignmentExpression: function (operator, left, right) {\n this.type = Syntax.AssignmentExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBinaryExpression: function (operator, left, right) {\n this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishCallExpression: function (callee, args) {\n this.type = Syntax.CallExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishConditionalExpression: function (test, consequent, alternate) {\n this.type = Syntax.ConditionalExpression;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishExpressionStatement: function (expression) {\n this.type = Syntax.ExpressionStatement;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishIdentifier: function (name) {\n this.type = Syntax.Identifier;\n this.name = name;\n this.finish();\n return this;\n },\n\n finishLiteral: function (token) {\n this.type = Syntax.Literal;\n this.value = token.value;\n this.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (this.raw == '//') {\n this.raw = '/(?:)/';\n }\n this.regex = token.regex;\n }\n this.finish();\n return this;\n },\n\n finishMemberExpression: function (accessor, object, property) {\n this.type = Syntax.MemberExpression;\n this.computed = accessor === '[';\n this.object = object;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishObjectExpression: function (properties) {\n this.type = Syntax.ObjectExpression;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishProgram: function (body) {\n this.type = Syntax.Program;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishProperty: function (kind, key, value) {\n this.type = Syntax.Property;\n this.key = key;\n this.value = value;\n this.kind = kind;\n this.finish();\n return this;\n },\n\n finishUnaryExpression: function (operator, argument) {\n this.type = Syntax.UnaryExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = true;\n this.finish();\n return this;\n }\n };\n\n // Return true if there is a line terminator before the next token.\n\n function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }\n\n // Throw an exception\n\n function 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 if (typeof token.lineNumber === 'number') {\n error = new Error('Line ' + token.lineNumber + ': ' + msg);\n error.index = token.start;\n error.lineNumber = token.lineNumber;\n error.column = token.start - lineStart + 1;\n } else {\n error = new Error('Line ' + lineNumber + ': ' + msg);\n error.index = index;\n error.lineNumber = lineNumber;\n error.column = index - lineStart + 1;\n }\n\n error.description = msg;\n throw error;\n }\n\n function throwErrorTolerant() {\n try {\n throwError.apply(null, arguments);\n } catch (e) {\n if (extra.errors) {\n extra.errors.push(e);\n } else {\n throw e;\n }\n }\n }\n\n\n // Throw an exception because of the token.\n\n function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // Expect the next token to match the specified punctuator.\n // If not, an exception will be thrown.\n\n function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }\n\n /**\n * @name expectTolerant\n * @description Quietly expect the given token value when in tolerant mode, otherwise delegates\n * to expect(value)\n * @param {String} value The value we are expecting the lookahead token to have\n * @since 2.0\n */\n function expectTolerant(value) {\n if (extra.errors) {\n var token = lookahead;\n if (token.type !== Token.Punctuator && token.value !== value) {\n throwErrorTolerant(token, Messages.UnexpectedToken, token.value);\n } else {\n lex();\n }\n } else {\n expect(value);\n }\n }\n\n // Return true if the next token matches the specified punctuator.\n\n function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }\n\n // Return true if the next token matches the specified keyword\n\n function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }\n\n function consumeSemicolon() {\n var line;\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(index) === 0x3B || match(';')) {\n lex();\n return;\n }\n\n line = lineNumber;\n skipComment();\n if (lineNumber !== line) {\n return;\n }\n\n if (lookahead.type !== Token.EOF && !match('}')) {\n throwUnexpected(lookahead);\n }\n }\n\n // 11.1.4 Array Initialiser\n\n function parseArrayInitialiser() {\n var elements = [], node = new Node();\n\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseAssignmentExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return node.finishArrayExpression(elements);\n }\n\n // 11.1.5 Object Initialiser\n\n function parseObjectPropertyKey() {\n var token, node = new Node();\n\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 === Token.StringLiteral || token.type === Token.NumericLiteral) {\n if (strict && token.octal) {\n throwErrorTolerant(token, Messages.StrictOctalLiteral);\n }\n return node.finishLiteral(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseObjectProperty() {\n var token, key, id, value, node = new Node();\n\n token = lookahead;\n\n if (token.type === Token.Identifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', id, value);\n }\n if (token.type === Token.EOF || token.type === Token.Punctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', key, value);\n }\n }\n\n function parseObjectInitialiser() {\n var properties = [], property, name, key, kind, map = {}, toString = String, node = new Node();\n\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === Syntax.Identifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n if (map[key] === PropertyKind.Data) {\n if (strict && kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.StrictDuplicateProperty);\n } else if (kind !== PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n }\n } else {\n if (kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n } else if (map[key] & kind) {\n throwErrorTolerant({}, Messages.AccessorGetSet);\n }\n }\n map[key] |= kind;\n } else {\n map[key] = kind;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expectTolerant(',');\n }\n }\n\n expect('}');\n\n return node.finishObjectExpression(properties);\n }\n\n // 11.1.6 The Grouping Operator\n\n function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }\n\n\n // 11.1 Primary Expressions\n\n var legalKeywords = {\"if\":1, \"this\":1};\n\n function parsePrimaryExpression() {\n var type, token, expr, node;\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 node = new Node();\n\n if (type === Token.Identifier || legalKeywords[lookahead.value]) {\n expr = node.finishIdentifier(lex().value);\n } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n if (strict && lookahead.octal) {\n throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n }\n expr = node.finishLiteral(lex());\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\");\n } else if (type === Token.BooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = node.finishLiteral(token);\n } else if (type === Token.NullLiteral) {\n token = lex();\n token.value = null;\n expr = node.finishLiteral(token);\n } else if (match('/') || match('/=')) {\n if (typeof extra.tokens !== 'undefined') {\n expr = node.finishLiteral(collectRegex());\n } else {\n expr = node.finishLiteral(scanRegExp());\n }\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n }\n\n // 11.2 Left-Hand-Side Expressions\n\n function parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseAssignmentExpression());\n if (match(')')) {\n break;\n }\n expectTolerant(',');\n }\n }\n\n expect(')');\n\n return args;\n }\n\n function parseNonComputedProperty() {\n var token, node = new Node();\n\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n }\n\n function parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n }\n\n function parseLeftHandSideExpressionAllowCall() {\n var expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }\n\n // 11.3 Postfix Expressions\n\n function parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === Token.Punctuator) {\n if ((match('++') || match('--')) && !peekLineTerminator()) {\n throw new Error(\"Disabled.\");\n }\n }\n\n return expr;\n }\n\n // 11.4 Unary Operators\n\n function parseUnaryExpression() {\n var token, expr, startToken;\n\n if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(\"Disabled.\");\n } else if (match('+') || match('-') || match('~') || match('!')) {\n startToken = lookahead;\n token = lex();\n expr = parseUnaryExpression();\n expr = new WrappingNode(startToken).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\n function binaryPrecedence(token, allowIn) {\n var prec = 0;\n\n if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\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 prec = 7;\n break;\n\n case 'in':\n prec = allowIn ? 7 : 0;\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\n function 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, state.allowIn);\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, state.allowIn)) > 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 = new WrappingNode(markers[markers.length - 1]).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 expr = new WrappingNode(markers.pop()).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\n function parseConditionalExpression() {\n var expr, previousAllowIn, consequent, alternate, startToken;\n\n startToken = lookahead;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n previousAllowIn = state.allowIn;\n state.allowIn = true;\n consequent = parseAssignmentExpression();\n state.allowIn = previousAllowIn;\n expect(':');\n alternate = parseAssignmentExpression();\n\n expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n }\n\n // 11.13 Assignment Operators\n\n function parseAssignmentExpression() {\n var oldParenthesisCount, token, expr, startToken;\n\n oldParenthesisCount = state.parenthesisCount;\n\n startToken = lookahead;\n token = lookahead;\n\n expr = parseConditionalExpression();\n\n return expr;\n }\n\n // 11.14 Comma Operator\n\n function parseExpression() {\n var expr = parseAssignmentExpression();\n\n if (match(',')) {\n throw new Error(\"Disabled.\"); // no sequence expressions\n }\n\n return expr;\n }\n\n // 12.4 Expression Statement\n\n function parseExpressionStatement(node) {\n var expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 12 Statements\n\n function parseStatement() {\n var type = lookahead.type,\n expr,\n node;\n\n if (type === Token.EOF) {\n throwUnexpected(lookahead);\n }\n\n if (type === Token.Punctuator && lookahead.value === '{') {\n throw new Error(\"Disabled.\"); // block statement\n }\n\n node = new Node();\n\n if (type === Token.Punctuator) {\n switch (lookahead.value) {\n case ';':\n throw new Error(\"Disabled.\"); // empty statement\n case '(':\n return parseExpressionStatement(node);\n default:\n break;\n }\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\"); // keyword\n }\n\n expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 14 Program\n\n function parseSourceElement() {\n if (lookahead.type === Token.Keyword) {\n switch (lookahead.value) {\n case 'const':\n case 'let':\n throw new Error(\"Disabled.\");\n case 'function':\n throw new Error(\"Disabled.\");\n default:\n return parseStatement();\n }\n }\n\n if (lookahead.type !== Token.EOF) {\n return parseStatement();\n }\n }\n\n function parseSourceElements() {\n var sourceElement, sourceElements = [], token, directive, firstRestricted;\n\n while (index < length) {\n token = lookahead;\n if (token.type !== Token.StringLiteral) {\n break;\n }\n\n sourceElement = parseSourceElement();\n sourceElements.push(sourceElement);\n if (sourceElement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n while (index < length) {\n sourceElement = parseSourceElement();\n if (typeof sourceElement === 'undefined') {\n break;\n }\n sourceElements.push(sourceElement);\n }\n return sourceElements;\n }\n\n function parseProgram() {\n var body, node;\n\n skipComment();\n peek();\n node = new Node();\n strict = true; // assume strict\n\n body = parseSourceElements();\n return node.finishProgram(body);\n }\n\n function filterTokenLocation() {\n var i, entry, token, tokens = [];\n\n for (i = 0; i < extra.tokens.length; ++i) {\n entry = extra.tokens[i];\n token = {\n type: entry.type,\n value: entry.value\n };\n if (entry.regex) {\n token.regex = {\n pattern: entry.regex.pattern,\n flags: entry.regex.flags\n };\n }\n if (extra.range) {\n token.range = entry.range;\n }\n if (extra.loc) {\n token.loc = entry.loc;\n }\n tokens.push(token);\n }\n\n extra.tokens = tokens;\n }\n\n function tokenize(code, options) {\n var toString,\n tokens;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n\n // Options matching.\n options = options || {};\n\n // Of course we collect tokens here.\n options.tokens = true;\n extra.tokens = [];\n extra.tokenize = true;\n // The following two fields are necessary to compute the Regex tokens.\n extra.openParenToken = -1;\n extra.openCurlyToken = -1;\n\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n\n try {\n peek();\n if (lookahead.type === Token.EOF) {\n return extra.tokens;\n }\n\n lex();\n while (lookahead.type !== Token.EOF) {\n try {\n lex();\n } catch (lexError) {\n if (extra.errors) {\n extra.errors.push(lexError);\n // We have to break on the first error\n // to avoid infinite loops.\n break;\n } else {\n throw lexError;\n }\n }\n }\n\n filterTokenLocation();\n tokens = extra.tokens;\n if (typeof extra.errors !== 'undefined') {\n tokens.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n return tokens;\n }\n\n function parse(code, options) {\n var program, toString;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n parenthesisCount: 0,\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n if (typeof options !== 'undefined') {\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (extra.loc && options.source !== null && options.source !== undefined) {\n extra.source = toString(options.source);\n }\n\n if (typeof options.tokens === 'boolean' && options.tokens) {\n extra.tokens = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n }\n\n try {\n program = parseProgram();\n if (typeof extra.tokens !== 'undefined') {\n filterTokenLocation();\n program.tokens = extra.tokens;\n }\n if (typeof extra.errors !== 'undefined') {\n program.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n\n return program;\n }\n\n return {\n tokenize: tokenize,\n parse: parse\n };\n\n})();\n},{}],49:[function(require,module,exports){\nvar expr = require('vega-expression'),\n args = ['datum', 'event', 'signals'];\n\nmodule.exports = expr.compiler(args, {\n idWhiteList: args,\n fieldVar: args[0],\n globalVar: args[2],\n functions: function(codegen) {\n var fn = expr.functions(codegen);\n fn.eventItem = function() { return 'event.vg.item'; };\n fn.eventGroup = 'event.vg.getGroup';\n fn.eventX = 'event.vg.getX';\n fn.eventY = 'event.vg.getY';\n fn.open = 'window.open';\n return fn;\n }\n});\n},{\"vega-expression\":47}],50:[function(require,module,exports){\nvar dl = require('datalib'),\n df = require('vega-dataflow'),\n log = require('vega-logging'),\n ChangeSet = df.ChangeSet,\n Tuple = df.Tuple,\n Deps = df.Dependencies,\n Transform = require('./Transform'),\n Facetor = require('./Facetor');\n\nfunction Aggregate(graph) {\n Transform.prototype.init.call(this, graph);\n\n Transform.addParameters(this, {\n groupby: {type: 'array'},\n summarize: {\n type: 'custom', \n set: function(summarize) {\n var signalDeps = {},\n tx = this._transform,\n i, len, f, fields, name, ops;\n\n if (!dl.isArray(fields = summarize)) { // Object syntax from dl\n fields = [];\n for (name in summarize) {\n ops = dl.array(summarize[name]);\n fields.push({field: name, ops: ops});\n }\n }\n\n function sg(x) { if (x.signal) signalDeps[x.signal] = 1; }\n\n for (i=0, len=fields.length; i this.config('maxSmallNumber') ?\n 'largeNumberFormat': 'smallNumberFormat';\n return this.config(formatConfig);\n };\n\n proto.sort = function(et, stats) {\n var sort = this._enc[et].sort,\n enc = this._enc,\n isTypes = vlEncDef.isTypes;\n\n if ((!sort || sort.length===0) &&\n // FIXME\n Encoding.toggleSort.support({encoding:this._enc}, stats, true) && //HACK\n this.config('toggleSort') === Q\n ) {\n var qField = isTypes(enc.x, [N, O]) ? enc.y : enc.x;\n\n if (isTypes(enc[et], [N, O])) {\n sort = [{\n name: qField.name,\n aggregate: qField.aggregate,\n type: qField.type,\n reverse: true\n }];\n }\n }\n\n return sort;\n };\n\n proto.map = function(f) {\n return vlenc.map(this._enc, f);\n };\n\n proto.reduce = function(f, init) {\n return vlenc.reduce(this._enc, f, init);\n };\n\n proto.forEach = function(f) {\n return vlenc.forEach(this._enc, f);\n };\n\n proto.type = function(et) {\n return this.has(et) ? this._enc[et].type : null;\n };\n\n proto.isType = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isType(encDef, type);\n };\n\n\n proto.isTypes = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isTypes(encDef, type);\n };\n\n Encoding.isOrdinalScale = function(encoding, encType) {\n return vlEncDef.isOrdinalScale(encoding.encDef(encType));\n };\n\n Encoding.isDimension = function(encoding, encType) {\n return vlEncDef.isDimension(encoding.encDef(encType));\n };\n\n Encoding.isMeasure = function(encoding, encType) {\n return vlEncDef.isMeasure(encoding.encDef(encType));\n };\n\n proto.isOrdinalScale = function(encType) {\n return this.has(encType) && Encoding.isOrdinalScale(this, encType);\n };\n\n proto.isDimension = function(encType) {\n return this.has(encType) && Encoding.isDimension(this, encType);\n };\n\n proto.isMeasure = function(encType) {\n return this.has(encType) && Encoding.isMeasure(this, encType);\n };\n\n proto.isAggregate = function() {\n return vlenc.isAggregate(this._enc);\n };\n\n proto.dataTable = function() {\n return this.isAggregate() ? AGGREGATE : RAW;\n };\n\n Encoding.isAggregate = function(spec) {\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.alwaysNoOcclusion = function(spec) {\n // FIXME raw OxQ with # of rows = # of O\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.isStack = function(spec) {\n // FIXME update this once we have control for stack ...\n return (spec.marktype === 'bar' || spec.marktype === 'area') &&\n spec.encoding.color;\n };\n\n /**\n * Check if the encoding should be stacked and return the stack dimenstion and value fields.\n * @return {Object} An object containing two properties:\n * - dimension - the dimension field\n * - value - the value field\n */\n proto.stack = function() {\n var stack = (this.has(COLOR) && this.encDef(COLOR).stack) ? COLOR :\n (this.has(DETAIL) && this.encDef(DETAIL).stack) ? DETAIL :\n null;\n\n var properties = stack && this.encDef(stack).stack !== true ?\n this.encDef(stack).stack :\n {};\n\n if ((this.is('bar') || this.is('area')) && stack && this.isAggregate()) {\n\n var isXMeasure = this.isMeasure(X);\n var isYMeasure = this.isMeasure(Y);\n\n if (isXMeasure && !isYMeasure) {\n return {\n groupby: Y,\n value: X,\n stack: stack,\n properties: properties\n };\n } else if (isYMeasure && !isXMeasure) {\n return {\n groupby: X,\n value: Y,\n stack: stack,\n properties: properties\n };\n }\n }\n return null; // no stack encoding\n };\n\n\n\n proto.details = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType !== X && encType !== Y)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.facets = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType == ROW || encType == COL)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.cardinality = function(encType, stats) {\n return vlEncDef.cardinality(this.encDef(encType), stats, this.config('filterNull'));\n };\n\n proto.isRaw = function() {\n return !this.isAggregate();\n };\n\n proto.data = function() {\n return this._data;\n };\n\n // returns whether the encoding has values embedded\n proto.hasValues = function() {\n var vals = this.data().values;\n return vals && vals.length;\n };\n\n proto.config = function(name) {\n return this._config[name];\n };\n\n Encoding.transpose = function(spec) {\n var oldenc = spec.encoding,\n enc = util.duplicate(spec.encoding);\n enc.x = oldenc.y;\n enc.y = oldenc.x;\n enc.row = oldenc.col;\n enc.col = oldenc.row;\n spec.encoding = enc;\n return spec;\n };\n\n return Encoding;\n})();\n\n},{\"./consts\":67,\"./enc\":69,\"./encdef\":70,\"./globals\":71,\"./schema/schema\":73,\"./util\":75}],55:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n getter = util.getter,\n time = require('./time');\n\nvar axis = module.exports = {};\n\naxis.def = function(name, encoding, layout, stats, opt) {\n var isCol = name == COL,\n isRow = name == ROW,\n type = isCol ? 'x' : isRow ? 'y' : name;\n\n // TODO: rename def to axisDef and avoid side effects where possible.\n\n var def = {\n type: type,\n scale: name,\n properties: {},\n layer: encoding.encDef(name).axis.layer\n };\n\n var orient = axis.orient(encoding, name, stats);\n if (orient) {\n def.orient = orient;\n }\n\n // Add axis label custom scale (for bin / time)\n def = axis.labels.scale(def, encoding, name);\n def = axis.labels.format(def, encoding, name, stats);\n def = axis.labels.angle(def, encoding, name);\n\n // for x-axis, set ticks for Q or rotate scale for ordinal scale\n if (name == X) {\n if ((encoding.isDimension(X) || encoding.isType(X, T)) &&\n !('angle' in getter(def, ['properties', 'labels']))) {\n // TODO(kanitw): Jul 19, 2015 - #506 add condition for rotation\n def = axis.labels.rotate(def);\n } else { // Q\n def.ticks = encoding.encDef(name).axis.ticks;\n }\n }\n\n // TitleOffset depends on labels rotation\n def.titleOffset = axis.titleOffset(encoding, layout, name);\n\n //def.offset is used in axis.grid\n if(isRow) def.offset = axis.titleOffset(encoding, layout, Y) + 20;\n // FIXME(kanitw): Jul 19, 2015 - offset for column when x is put on top\n\n def = axis.grid(def, encoding, name, layout);\n def = axis.title(def, encoding, name, layout, opt);\n\n if (isRow || isCol) {\n def = axis.hideTicks(def);\n }\n\n return def;\n};\n\naxis.orient = function(encoding, name, stats) {\n var orient = encoding.encDef(name).axis.orient;\n if (orient) {\n return orient;\n } else if (name === COL) {\n return 'top';\n } else if (name === X && encoding.has(Y) && encoding.isOrdinalScale(Y) && encoding.cardinality(Y, stats) > 30) {\n // x-axis for long y - put on top\n return 'top';\n }\n return undefined;\n};\n\naxis.grid = function(def, encoding, name, layout) {\n var cellPadding = layout.cellPadding,\n isCol = name == COL,\n isRow = name == ROW;\n\n var _grid = encoding.axis(name).grid;\n\n // If `grid` is unspecified, the default value is `true` for ROW and COL. For X\n // and Y, the default value is `true` for quantitative and time fields and `false` otherwise.\n var grid = _grid === undefined ?\n (name === ROW || name === COL || encoding.isTypes(name, [Q, T])) :\n _grid;\n\n if (grid) {\n def.grid = true;\n\n if (isCol) {\n // set grid property -- put the lines on the right the cell\n var yOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n def.properties.grid = {\n x: {\n offset: layout.cellWidth * (1+ cellPadding/2.0),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'col',\n field: 'data'\n },\n y: {\n value: -yOffset,\n },\n y2: {\n field: {group: 'mark.group.height'},\n offset: yOffset\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else if (isRow) {\n var xOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n // set grid property -- put the lines on the top\n def.properties.grid = {\n y: {\n offset: -layout.cellHeight * (cellPadding/2),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'row',\n field: 'data'\n },\n x: {\n value: def.offset - xOffset\n },\n x2: {\n field: {group: 'mark.group.width'},\n offset: def.offset + xOffset,\n // default value(s) -- vega doesn't do recursive merge\n mult: 1\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else {\n def.properties.grid = {\n stroke: { value: encoding.config('gridColor') },\n strokeOpacity: { value: encoding.config('gridOpacity') }\n };\n }\n }\n return def;\n};\n\naxis.hideTicks = function(def) {\n def.properties.ticks = {opacity: {value: 0}};\n def.properties.majorTicks = {opacity: {value: 0}};\n def.properties.axis = {opacity: {value: 0}};\n return def;\n};\n\naxis.title = function (def, encoding, name, layout) {\n var ax = encoding.encDef(name).axis;\n\n if (ax.title) {\n def.title = ax.title;\n } else {\n // if not defined, automatically determine axis title from field def\n var fieldTitle = encoding.fieldTitle(name),\n maxLength;\n\n if (ax.titleMaxLength) {\n maxLength = ax.titleMaxLength;\n } else if (name===X) {\n maxLength = layout.cellWidth / encoding.config('characterWidth');\n } else if (name === Y) {\n maxLength = layout.cellHeight / encoding.config('characterWidth');\n }\n\n def.title = maxLength ? util.truncate(fieldTitle, maxLength) : fieldTitle;\n }\n\n if (name === ROW) {\n def.properties.title = {\n angle: {value: 0},\n align: {value: 'right'},\n baseline: {value: 'middle'},\n dy: {value: (-layout.height/2) -20}\n };\n }\n\n return def;\n};\n\naxis.labels = {};\n\n/** add custom label for time type and bin */\naxis.labels.scale = function(def, encoding, name) {\n // time\n var timeUnit = encoding.encDef(name).timeUnit;\n if (encoding.isType(name, T) && timeUnit && (time.hasScale(timeUnit))) {\n setter(def, ['properties','labels','text','scale'], 'time-'+ timeUnit);\n }\n // FIXME bin\n return def;\n};\n\n/**\n * Determine number format or truncate if maxLabel length is presented.\n */\naxis.labels.format = function (def, encoding, name, stats) {\n var fieldStats = stats[encoding.encDef(name).name];\n\n if (encoding.axis(name).format) {\n def.format = encoding.axis(name).format;\n } else if (encoding.isType(name, Q) || fieldStats.type === 'number') {\n def.format = encoding.numberFormat(fieldStats);\n } else if (encoding.isType(name, T)) {\n var timeUnit = encoding.encDef(name).timeUnit;\n if (!timeUnit) {\n def.format = encoding.config('timeFormat');\n } else if (timeUnit === 'year') {\n def.format = 'd';\n }\n } else if (encoding.isTypes(name, [N, O]) && encoding.axis(name).maxLabelLength) {\n setter(def,\n ['properties','labels','text','template'],\n '{{ datum.data | truncate:' +\n encoding.axis(name).maxLabelLength + '}}'\n );\n }\n\n return def;\n};\n\naxis.labels.angle = function(def, encoding, name) {\n var angle = encoding.axis(name).labelAngle;\n if (typeof angle === 'undefined') return def;\n\n setter(def, ['properties', 'labels', 'angle', 'value'], angle);\n return def;\n};\n\naxis.labels.rotate = function(def) {\n var align = def.orient ==='top' ? 'left' : 'right';\n setter(def, ['properties','labels', 'angle', 'value'], 270);\n setter(def, ['properties','labels', 'align', 'value'], align);\n setter(def, ['properties','labels', 'baseline', 'value'], 'middle');\n return def;\n};\n\naxis.titleOffset = function (encoding, layout, name) {\n // return specified value if specified\n var value = encoding.axis(name).titleOffset;\n if (value) return value;\n\n switch (name) {\n //FIXME make this adjustable\n case ROW: return 0;\n case COL: return 35;\n }\n return getter(layout, [name, 'axisTitleOffset']);\n};\n\n},{\"../globals\":71,\"../util\":75,\"./time\":66}],56:[function(require,module,exports){\n'use strict';\n\nvar summary = module.exports = require('datalib/src/stats').summary;\n\nrequire('../globals');\n\n/**\n * Module for compiling Vega-lite spec into Vega spec.\n */\nvar compiler = module.exports = {};\n\nvar Encoding = require('../Encoding'),\n axis = compiler.axis = require('./axis'),\n legend = compiler.legend = require('./legend'),\n marks = compiler.marks = require('./marks'),\n scale = compiler.scale = require('./scale');\n\ncompiler.data = require('./data');\ncompiler.facet = require('./facet');\ncompiler.layout = require('./layout');\ncompiler.stack = require('./stack');\ncompiler.style = require('./style');\ncompiler.subfacet = require('./subfacet');\ncompiler.time = require('./time');\n\ncompiler.compile = function (spec, stats, theme) {\n return compiler.compileEncoding(Encoding.fromSpec(spec, theme), stats);\n};\n\ncompiler.shorthand = function (shorthand, stats, config, theme) {\n return compiler.compileEncoding(Encoding.fromShorthand(shorthand, config, theme), stats);\n};\n\n/**\n * Create a Vega specification from a Vega-lite Encoding object.\n */\ncompiler.compileEncoding = function (encoding, stats) {\n // no need to pass stats if you pass in the data\n if (!stats) {\n if (encoding.hasValues()) {\n stats = summary(encoding.data().values).reduce(function(s, p) {\n s[p.field] = p;\n return s;\n }, {});\n } else {\n console.error('No stats provided and data is not embedded.');\n }\n }\n\n var layout = compiler.layout(encoding, stats);\n\n var spec = {\n width: layout.width,\n height: layout.height,\n padding: 'auto',\n data: compiler.data(encoding),\n // global scales contains only time unit scales\n scales: compiler.time.scales(encoding),\n marks: [{\n name: 'cell',\n type: 'group',\n properties: {\n enter: {\n width: layout.cellWidth ?\n {value: layout.cellWidth} :\n {field: {group: 'width'}},\n height: layout.cellHeight ?\n {value: layout.cellHeight} :\n {field: {group: 'height'}}\n }\n }\n }]\n };\n\n var group = spec.marks[0];\n\n // marks\n var style = compiler.style(encoding, stats),\n mdefs = group.marks = marks.def(encoding, layout, style, stats),\n mdef = mdefs[mdefs.length - 1]; // TODO: remove this dirty hack by refactoring the whole flow\n\n var stack = encoding.stack();\n if (stack) {\n // modify mdef.{from,properties}\n compiler.stack(encoding, mdef, stack);\n }\n\n var lineType = marks[encoding.marktype()].line;\n\n // handle subfacets\n var details = encoding.details();\n\n if (details.length > 0 && lineType) {\n //subfacet to group stack / line together in one group\n compiler.subfacet(group, mdef, details, encoding);\n }\n\n // auto-sort line/area values\n if (lineType && encoding.config('autoSortLine')) {\n var f = (encoding.isMeasure(X) && encoding.isDimension(Y)) ? Y : X;\n if (!mdef.from) {\n mdef.from = {};\n }\n // TODO: why - ?\n mdef.from.transform = [{type: 'sort', by: '-' + encoding.fieldRef(f)}];\n }\n\n // get a flattened list of all scale names that are used in the vl spec\n var singleScaleNames = [].concat.apply([], mdefs.map(function(markProps) {\n return scale.names(markProps.properties.update);\n }));\n\n // Small Multiples\n if (encoding.has(ROW) || encoding.has(COL)) {\n spec = compiler.facet(group, encoding, layout, spec, singleScaleNames, stats);\n spec.legends = legend.defs(encoding, style);\n } else {\n group.scales = scale.defs(singleScaleNames, encoding, layout, stats);\n group.axes = [];\n if (encoding.has(X)) {\n group.axes.push(axis.def(X, encoding, layout, stats));\n }\n if (encoding.has(Y)) {\n group.axes.push(axis.def(Y, encoding, layout, stats));\n }\n\n group.legends = legend.defs(encoding, style);\n }\n\n return spec;\n};\n\n},{\"../Encoding\":54,\"../globals\":71,\"./axis\":55,\"./data\":57,\"./facet\":58,\"./layout\":59,\"./legend\":60,\"./marks\":61,\"./scale\":62,\"./stack\":63,\"./style\":64,\"./subfacet\":65,\"./time\":66,\"datalib/src/stats\":29}],57:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nmodule.exports = data;\n\nvar vlEncDef = require('../encdef'),\n util = require('../util'),\n time = require('./time');\n\n/**\n * Create Vega's data array from a given encoding.\n *\n * @param {Encoding} encoding\n * @return {Array} Array of Vega data.\n * This always includes a \"raw\" data table.\n * If the encoding contains aggregate value, this will also create\n * aggregate table as well.\n */\nfunction data(encoding) {\n var def = [data.raw(encoding)];\n\n var aggregate = data.aggregate(encoding);\n if (aggregate) {\n def.push(data.aggregate(encoding));\n }\n\n // TODO add \"having\" filter here\n\n // append non-positive filter at the end for the data table\n data.filterNonPositive(def[def.length - 1], encoding);\n\n // Stack\n var stack = encoding.stack();\n if (stack) {\n def.push(data.stack(encoding, stack));\n }\n\n return def;\n}\n\ndata.raw = function(encoding) {\n var raw = {name: RAW};\n\n // Data source (url or inline)\n if (encoding.hasValues()) {\n raw.values = encoding.data().values;\n raw.format = {type: 'json'};\n } else {\n raw.url = encoding.data().url;\n raw.format = {type: encoding.data().formatType};\n }\n\n // Set data's format.parse if needed\n var parse = data.raw.formatParse(encoding);\n if (parse) {\n raw.format.parse = parse;\n }\n\n raw.transform = data.raw.transform(encoding);\n return raw;\n};\n\ndata.raw.formatParse = function(encoding) {\n var parse;\n\n encoding.forEach(function(encDef) {\n if (encDef.type == T) {\n parse = parse || {};\n parse[encDef.name] = 'date';\n } else if (encDef.type == Q) {\n if (vlEncDef.isCount(encDef)) return;\n parse = parse || {};\n parse[encDef.name] = 'number';\n }\n });\n\n return parse;\n};\n\n/**\n * Generate Vega transforms for the raw data table. This can include\n * transforms for time unit, binning and filtering.\n */\ndata.raw.transform = function(encoding) {\n // null filter comes first so transforms are not performed on null values\n // time and bin should come before filter so we can filter by time and bin\n return data.raw.transform.nullFilter(encoding).concat(\n data.raw.transform.formula(encoding),\n data.raw.transform.time(encoding),\n data.raw.transform.bin(encoding),\n data.raw.transform.filter(encoding)\n );\n};\n\ndata.raw.transform.time = function(encoding) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encDef.type === T && encDef.timeUnit) {\n var fieldRef = encoding.fieldRef(encType, {nofn: true, datum: true});\n\n transform.push({\n type: 'formula',\n field: encoding.fieldRef(encType),\n expr: time.formula(encDef.timeUnit, fieldRef)\n });\n }\n return transform;\n }, []);\n};\n\ndata.raw.transform.bin = function(encoding) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encoding.bin(encType)) {\n transform.push({\n type: 'bin',\n field: encDef.name,\n output: {start: encoding.fieldRef(encType)},\n maxbins: encoding.bin(encType).maxbins\n });\n }\n return transform;\n }, []);\n};\n\n/**\n * @return {Array} An array that might contain a filter transform for filtering null value based on filterNul config\n */\ndata.raw.transform.nullFilter = function(encoding) {\n var filteredFields = util.reduce(encoding.fields(),\n function(filteredFields, fieldList, fieldName) {\n if (fieldName === '*') return filteredFields; //count\n\n // TODO(#597) revise how filterNull is structured.\n if ((encoding.config('filterNull').Q && fieldList.containsType[Q]) ||\n (encoding.config('filterNull').T && fieldList.containsType[T]) ||\n (encoding.config('filterNull').O && fieldList.containsType[O]) ||\n (encoding.config('filterNull').N && fieldList.containsType[N])) {\n filteredFields.push(fieldName);\n }\n return filteredFields;\n }, []);\n\n return filteredFields.length > 0 ?\n [{\n type: 'filter',\n test: filteredFields.map(function(fieldName) {\n return 'datum.' + fieldName + '!==null';\n }).join(' && ')\n }] : [];\n};\n\ndata.raw.transform.filter = function(encoding) {\n var filter = encoding.data().filter;\n return filter ? [{\n type: 'filter',\n test: filter\n }] : [];\n};\n\ndata.raw.transform.formula = function(encoding) {\n var formulas = encoding.data().formulas;\n if (formulas === undefined) {\n return [];\n }\n\n return formulas.reduce(function(transform, formula) {\n formula.type = 'formula';\n transform.push(formula);\n return transform;\n }, []);\n};\n\ndata.aggregate = function(encoding) {\n /* dict set for dimensions */\n var dims = {};\n\n /* dictionary mapping field name => dict set of aggregation functions */\n var meas = {};\n\n var hasAggregate = false;\n\n encoding.forEach(function(encDef, encType) {\n if (encDef.aggregate) {\n hasAggregate = true;\n if (encDef.aggregate === 'count') {\n meas['*'] = meas['*'] || {};\n meas['*'].count = true;\n } else {\n meas[encDef.name] = meas[encDef.name] || {};\n meas[encDef.name][encDef.aggregate] = true;\n }\n } else {\n dims[encDef.name] = encoding.fieldRef(encType);\n }\n });\n\n var groupby = util.vals(dims);\n\n // short-format summarize object for Vega's aggregate transform\n // https://github.com/vega/vega/wiki/Data-Transforms#-aggregate\n var summarize = util.reduce(meas, function(summarize, fnDictSet, field) {\n summarize[field] = util.keys(fnDictSet);\n return summarize;\n }, {});\n\n if (hasAggregate) {\n return {\n name: AGGREGATE,\n source: RAW,\n transform: [{\n type: 'aggregate',\n groupby: groupby,\n summarize: summarize\n }]\n };\n }\n\n return null;\n};\n\n/**\n * Add stacked data source, for feeding the shared scale.\n */\ndata.stack = function(encoding, stack) {\n var dim = stack.groupby;\n var val = stack.value;\n var facets = encoding.facets();\n\n var stacked = {\n name: STACKED,\n source: encoding.dataTable(),\n transform: [{\n type: 'aggregate',\n groupby: [encoding.fieldRef(dim)].concat(facets), // dim and other facets\n summarize: [{ops: ['sum'], field: encoding.fieldRef(val)}]\n }]\n };\n\n if (facets && facets.length > 0) {\n stacked.transform.push({ //calculate max for each facet\n type: 'aggregate',\n groupby: facets,\n summarize: [{\n ops: ['max'],\n // we want max of sum from above transform\n field: encoding.fieldRef(val, {prefn: 'sum_'})\n }]\n });\n }\n return stacked;\n};\n\ndata.filterNonPositive = function(dataTable, encoding) {\n encoding.forEach(function(encDef, encType) {\n if (encoding.scale(encType).type === 'log') {\n dataTable.transform.push({\n type: 'filter',\n test: encoding.fieldRef(encType, {datum: 1}) + ' > 0'\n });\n }\n });\n};\n\n},{\"../encdef\":70,\"../globals\":71,\"../util\":75,\"./time\":66}],58:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar util = require('../util');\n\nvar axis = require('./axis'),\n scale = require('./scale');\n\nmodule.exports = faceting;\n\nfunction groupdef(name, opt) {\n opt = opt || {};\n var group = {\n name: name || undefined,\n type: 'group',\n properties: {\n enter: {\n width: opt.width || {field: {group: 'width'}},\n height: opt.height || {field: {group: 'height'}}\n }\n }\n };\n\n if (opt.from) {\n group.from = opt.from;\n }\n if (opt.x) {\n group.properties.enter.x = opt.x;\n }\n if (opt.y) {\n group.properties.enter.y = opt.y;\n }\n if (opt.axes) {\n group.axes = opt.axes;\n }\n\n return group;\n}\n\nfunction faceting(group, encoding, layout, spec, singleScaleNames, stats) {\n var enter = group.properties.enter;\n var facetKeys = [], cellAxes = [], from, axesGrp;\n\n var hasRow = encoding.has(ROW), hasCol = encoding.has(COL);\n\n enter.fill = {value: encoding.config('cellBackgroundColor')};\n\n //move \"from\" to cell level and add facet transform\n group.from = {data: group.marks[0].from.data};\n\n // Hack, this needs to be refactored\n for (var i = 0; i < group.marks.length; i++) {\n var mark = group.marks[i];\n if (mark.from.transform) {\n delete mark.from.data; //need to keep transform for subfacetting case\n } else {\n delete mark.from;\n }\n }\n\n if (hasRow) {\n if (!encoding.isDimension(ROW)) {\n util.error('Row encoding should be ordinal.');\n }\n enter.y = {scale: ROW, field: encoding.fieldRef(ROW)};\n enter.height = {'value': layout.cellHeight}; // HACK\n\n facetKeys.push(encoding.fieldRef(ROW));\n\n if (hasCol) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(COL)]});\n }\n\n axesGrp = groupdef('x-axes', {\n axes: encoding.has(X) ? [axis.def(X, encoding, layout, stats)] : undefined,\n x: hasCol ? {scale: COL, field: encoding.fieldRef(COL)} : {value: 0},\n width: hasCol && {'value': layout.cellWidth}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(ROW, encoding, layout, stats));\n } else { // doesn't have row\n if (encoding.has(X)) {\n //keep x axis in the cell\n cellAxes.push(axis.def(X, encoding, layout, stats));\n }\n }\n\n if (hasCol) {\n if (!encoding.isDimension(COL)) {\n util.error('Col encoding should be ordinal.');\n }\n enter.x = {scale: COL, field: encoding.fieldRef(COL)};\n enter.width = {'value': layout.cellWidth}; // HACK\n\n facetKeys.push(encoding.fieldRef(COL));\n\n if (hasRow) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(ROW)]});\n }\n\n axesGrp = groupdef('y-axes', {\n axes: encoding.has(Y) ? [axis.def(Y, encoding, layout, stats)] : undefined,\n y: hasRow && {scale: ROW, field: encoding.fieldRef(ROW)},\n x: hasRow && {value: 0},\n height: hasRow && {'value': layout.cellHeight}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(COL, encoding, layout, stats));\n } else { // doesn't have col\n if (encoding.has(Y)) {\n cellAxes.push(axis.def(Y, encoding, layout, stats));\n }\n }\n\n // assuming equal cellWidth here\n // TODO: support heterogenous cellWidth (maybe by using multiple scales?)\n spec.scales = (spec.scales || []).concat(scale.defs(\n scale.names(enter).concat(singleScaleNames),\n encoding,\n layout,\n stats,\n true\n )); // row/col scales + cell scales\n\n if (cellAxes.length > 0) {\n group.axes = cellAxes;\n }\n\n // add facet transform\n var trans = (group.from.transform || (group.from.transform = []));\n trans.unshift({type: 'facet', groupby: facetKeys});\n\n return spec;\n}\n\n},{\"../globals\":71,\"../util\":75,\"./axis\":55,\"./scale\":62}],59:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n time = require('./time'),\n d3_format = require('d3-format');\n\nmodule.exports = vllayout;\n\nfunction vllayout(encoding, stats) {\n var layout = box(encoding, stats);\n layout = offset(encoding, stats, layout);\n return layout;\n}\n\n/*\n HACK to set chart size\n NOTE: this fails for plots driven by derived values (e.g., aggregates)\n One solution is to update Vega to support auto-sizing\n In the meantime, auto-padding (mostly) does the trick\n */\nfunction box(encoding, stats) {\n var hasRow = encoding.has(ROW),\n hasCol = encoding.has(COL),\n hasX = encoding.has(X),\n hasY = encoding.has(Y),\n marktype = encoding.marktype();\n\n // FIXME/HACK we need to take filter into account\n var xCardinality = hasX && encoding.isDimension(X) ? encoding.cardinality(X, stats) : 1,\n yCardinality = hasY && encoding.isDimension(Y) ? encoding.cardinality(Y, stats) : 1;\n\n var useSmallBand = xCardinality > encoding.config('largeBandMaxCardinality') ||\n yCardinality > encoding.config('largeBandMaxCardinality');\n\n var cellWidth, cellHeight, cellPadding = encoding.config('cellPadding');\n\n // set cellWidth\n if (hasX) {\n if (encoding.isOrdinalScale(X)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellWidth = (xCardinality + encoding.encDef(X).band.padding) * encoding.bandSize(X, useSmallBand);\n } else {\n cellWidth = hasCol || hasRow ? encoding.encDef(COL).width : encoding.config('singleWidth');\n }\n } else {\n if (marktype === TEXT) {\n cellWidth = encoding.config('textCellWidth');\n } else {\n cellWidth = encoding.bandSize(X);\n }\n }\n\n // set cellHeight\n if (hasY) {\n if (encoding.isOrdinalScale(Y)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellHeight = (yCardinality + encoding.encDef(Y).band.padding) * encoding.bandSize(Y, useSmallBand);\n } else {\n cellHeight = hasCol || hasRow ? encoding.encDef(ROW).height : encoding.config('singleHeight');\n }\n } else {\n cellHeight = encoding.bandSize(Y);\n }\n\n // Cell bands use rangeBands(). There are n-1 padding. Outerpadding = 0 for cells\n\n var width = cellWidth, height = cellHeight;\n if (hasCol) {\n var colCardinality = encoding.cardinality(COL, stats);\n width = cellWidth * ((1 + cellPadding) * (colCardinality - 1) + 1);\n }\n if (hasRow) {\n var rowCardinality = encoding.cardinality(ROW, stats);\n height = cellHeight * ((1 + cellPadding) * (rowCardinality - 1) + 1);\n }\n\n return {\n // width and height of the whole cell\n cellWidth: cellWidth,\n cellHeight: cellHeight,\n cellPadding: cellPadding,\n // width and height of the chart\n width: width,\n height: height,\n // information about x and y, such as band size\n x: {useSmallBand: useSmallBand},\n y: {useSmallBand: useSmallBand}\n };\n}\n\n\n// FIXME fieldStats.max isn't always the longest\nfunction getMaxNumberLength(encoding, et, fieldStats) {\n var format = encoding.numberFormat(et, fieldStats);\n\n return d3_format.format(format)(fieldStats.max).length;\n}\n\n// TODO(#600) revise this\nfunction getMaxLength(encoding, stats, et) {\n var encDef = encoding.encDef(et),\n fieldStats = stats[encDef.name];\n\n if (encDef.bin) {\n // TODO once bin support range, need to update this\n return getMaxNumberLength(encoding, et, fieldStats);\n } if (encoding.isType(et, Q)) {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else if (encoding.isType(et, T)) {\n return time.maxLength(encoding.encDef(et).timeUnit, encoding);\n } else if (encoding.isTypes(et, [N, O])) {\n if(fieldStats.type === 'number') {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else {\n return Math.min(fieldStats.max, encoding.axis(et).maxLabelLength || Infinity);\n }\n }\n}\n\nfunction offset(encoding, stats, layout) {\n [X, Y].forEach(function (et) {\n // TODO(kanitw): Jul 19, 2015 - create a set of visual test for extraOffset\n var extraOffset = et === X ? 20 : 22,\n maxLength;\n if (encoding.isDimension(et) || encoding.isType(et, T)) {\n maxLength = getMaxLength(encoding, stats, et);\n } else if (\n // TODO once we have #512 (allow using inferred type)\n // Need to adjust condition here.\n encoding.isType(et, Q) ||\n encoding.encDef(et).aggregate === 'count'\n ) {\n if (\n et===Y\n // || (et===X && false)\n // FIXME determine when X would rotate, but should move this to axis.js first #506\n ) {\n maxLength = getMaxLength(encoding, stats, et);\n }\n } else {\n // nothing\n }\n\n if (maxLength) {\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * maxLength + extraOffset);\n } else {\n // if no max length (no rotation case), use maxLength = 3\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * 3 + extraOffset);\n }\n\n });\n return layout;\n}\n\n},{\"../globals\":71,\"../util\":75,\"./time\":66,\"d3-format\":5}],60:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar time = require('./time'),\n util = require('../util'),\n setter = util.setter,\n getter = util.getter;\n\nvar legend = module.exports = {};\n\nlegend.defs = function(encoding, style) {\n var defs = [];\n\n if (encoding.has(COLOR) && encoding.encDef(COLOR).legend) {\n defs.push(legend.def(COLOR, encoding, {\n fill: COLOR\n }, style));\n }\n\n if (encoding.has(SIZE) && encoding.encDef(SIZE).legend) {\n defs.push(legend.def(SIZE, encoding, {\n size: SIZE\n }, style));\n }\n\n if (encoding.has(SHAPE) && encoding.encDef(SHAPE).legend) {\n defs.push(legend.def(SHAPE, encoding, {\n shape: SHAPE\n }, style));\n }\n return defs;\n};\n\nlegend.def = function(name, encoding, def, style) {\n var timeUnit = encoding.encDef(name).timeUnit;\n\n def.title = legend.title(name, encoding);\n def.orient = encoding.encDef(name).legend.orient;\n\n def = legend.style(name, encoding, def, style);\n\n if (encoding.isType(name, T) &&\n timeUnit &&\n time.hasScale(timeUnit)\n ) {\n setter(def, ['properties', 'labels', 'text', 'scale'], 'time-'+ timeUnit);\n }\n\n return def;\n};\n\nlegend.style = function(name, e, def, style) {\n var symbols = getter(def, ['properties', 'symbols']),\n marktype = e.marktype();\n\n switch (marktype) {\n case 'bar':\n case 'tick':\n case 'text':\n symbols.stroke = {value: 'transparent'};\n symbols.shape = {value: 'square'};\n break;\n\n case 'circle':\n case 'square':\n symbols.shape = {value: marktype};\n /* fall through */\n case 'point':\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR) && name === COLOR) {\n symbols.fill = {scale: COLOR, field: 'data'};\n } else {\n symbols.fill = {value: e.value(COLOR)};\n }\n symbols.stroke = {value: 'transparent'};\n } else {\n if (e.has(COLOR) && name === COLOR) {\n symbols.stroke = {scale: COLOR, field: 'data'};\n } else {\n symbols.stroke = {value: e.value(COLOR)};\n }\n symbols.fill = {value: 'transparent'};\n symbols.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n break;\n case 'line':\n case 'area':\n // TODO use shape here after implementing #508\n break;\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) {\n symbols.opacity = {value: opacity};\n }\n return def;\n};\n\nlegend.title = function(name, encoding) {\n var leg = encoding.encDef(name).legend;\n\n if (leg.title) return leg.title;\n\n return encoding.fieldTitle(name);\n};\n\n},{\"../globals\":71,\"../util\":75,\"./time\":66}],61:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar marks = module.exports = {};\n\nmarks.def = function(encoding, layout, style, stats) {\n\n var defs = [],\n mark = marks[encoding.marktype()],\n from = encoding.dataTable();\n\n // to add a background to text, we need to add it before the text\n if (encoding.marktype() === TEXT && encoding.has(COLOR)) {\n var bg = {\n x: {value: 0},\n y: {value: 0},\n x2: {value: layout.cellWidth},\n y2: {value: layout.cellHeight},\n fill: {scale: COLOR, field: encoding.fieldRef(COLOR)}\n };\n defs.push({\n type: 'rect',\n from: {data: from},\n properties: {enter: bg, update: bg}\n });\n }\n\n // add the mark def for the main thing\n var p = mark.prop(encoding, layout, style, stats);\n defs.push({\n type: mark.type,\n from: {data: from},\n properties: {enter: p, update: p}\n });\n\n return defs;\n};\n\nmarks.bar = {\n type: 'rect',\n prop: bar_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1}\n};\n\nmarks.line = {\n type: 'line',\n line: true,\n prop: line_props,\n requiredEncoding: ['x', 'y'],\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail:1}\n};\n\nmarks.area = {\n type: 'area',\n line: true,\n requiredEncoding: ['x', 'y'],\n prop: area_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1}\n};\n\nmarks.tick = {\n type: 'rect',\n prop: tick_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail: 1}\n};\n\nmarks.circle = {\n type: 'symbol',\n prop: filled_point_props('circle'),\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, detail: 1}\n};\n\nmarks.square = {\n type: 'symbol',\n prop: filled_point_props('square'),\n supportedEncoding: marks.circle.supportedEncoding\n};\n\nmarks.point = {\n type: 'symbol',\n prop: point_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, shape: 1, detail: 1}\n};\n\nmarks.text = {\n type: 'text',\n prop: text_props,\n requiredEncoding: ['text'],\n supportedEncoding: {row: 1, col: 1, size: 1, color: 1, text: 1}\n};\n\nfunction bar_props(e, layout, style) {\n // jshint unused:false\n\n var p = {};\n\n // x's and width\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (!e.has(Y) || e.isDimension(Y)) {\n p.x2 = {value: 0};\n }\n } else {\n if (e.has(X)) { // is ordinal\n p.xc = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0, offset: e.config('singleBarOffset')};\n }\n }\n\n // width\n if (!p.x2) {\n if (!e.has(X) || e.isOrdinalScale(X)) { // no X or X is ordinal\n if (e.has(SIZE)) {\n p.width = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.width = {\n value: e.bandSize(X, layout.x.useSmallBand),\n offset: -1\n };\n }\n } else { // X is Quant or Time Scale\n p.width = {value: 2};\n }\n }\n\n // y's & height\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {field: {group: 'height'}};\n } else {\n if (e.has(Y)) { // is ordinal\n p.yc = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y2 = {\n field: {group: 'height'},\n offset: -e.config('singleBarOffset')\n };\n }\n\n if (e.has(SIZE)) {\n p.height = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.height = {\n value: e.bandSize(Y, layout.y.useSmallBand),\n offset: -1\n };\n }\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction point_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n if (e.has(SHAPE)) {\n p.shape = {scale: SHAPE, field: e.fieldRef(SHAPE)};\n } else if (!e.has(SHAPE)) {\n p.shape = {value: e.value(SHAPE)};\n }\n\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n } else {\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n p.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction line_props(e,layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {field: {group: 'height'}};\n }\n\n // stroke\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n p.strokeWidth = {value: e.config('strokeWidth')};\n\n return p;\n}\n\nfunction area_props(e, layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(Y)) {\n p.x2 = {scale: X, value: 0};\n p.orient = {value: 'horizontal'};\n }\n } else if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0};\n }\n\n // y\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {scale: Y, value: 0};\n } else if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y = {field: {group: 'height'}};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction tick_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(X)) {\n p.x.offset = -e.bandSize(X, layout.x.useSmallBand) / 3;\n }\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n if (e.isDimension(Y)) {\n p.y.offset = -e.bandSize(Y, layout.y.useSmallBand) / 3;\n }\n } else if (!e.has(Y)) {\n p.y = {value: 0};\n }\n\n // width\n if (!e.has(X) || e.isDimension(X)) {\n p.width = {value: e.bandSize(X, layout.y.useSmallBand) / 1.5};\n } else {\n p.width = {value: 1};\n }\n\n // height\n if (!e.has(Y) || e.isDimension(Y)) {\n p.height = {value: e.bandSize(Y, layout.y.useSmallBand) / 1.5};\n } else {\n p.height = {value: 1};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction filled_point_props(shape) {\n return function(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(X)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n p.shape = {value: shape};\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n };\n}\n\nfunction text_props(e, layout, style, stats) {\n var p = {},\n encDef = e.encDef(TEXT);\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n if (e.has(TEXT) && e.isType(TEXT, Q)) {\n p.x = {value: layout.cellWidth-5};\n } else {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.fontSize = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.fontSize = {value: encDef.font.size};\n }\n\n // fill\n // color should be set to background\n p.fill = {value: encDef.color};\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n // text\n if (e.has(TEXT)) {\n if (e.isType(TEXT, Q)) {\n var fieldStats = stats[e.encDef(TEXT).name],\n numberFormat = encDef.format || e.numberFormat(fieldStats);\n\n p.text = {template: '{{' + e.fieldRef(TEXT, {datum: true}) + ' | number:\\'' +\n numberFormat +'\\'}}'};\n p.align = {value: encDef.align};\n } else {\n p.text = {field: e.fieldRef(TEXT)};\n }\n } else {\n p.text = {value: encDef.placeholder};\n }\n\n p.font = {value: encDef.font.family};\n p.fontWeight = {value: encDef.font.weight};\n p.fontStyle = {value: encDef.font.style};\n p.baseline = {value: encDef.baseline};\n\n return p;\n}\n\n},{\"../globals\":71}],62:[function(require,module,exports){\n'use strict';\nrequire('../globals');\nvar util = require('../util'),\n time = require('./time'),\n colorbrewer = require('colorbrewer'),\n interpolate = require('d3-color').interpolateHsl,\n schema = require('../schema/schema');\n\nvar scale = module.exports = {};\n\nscale.names = function(props) {\n return util.keys(util.keys(props).reduce(function(a, x) {\n if (props[x] && props[x].scale) a[props[x].scale] = 1;\n return a;\n }, {}));\n};\n\nscale.defs = function(names, encoding, layout, stats, facet) {\n return names.reduce(function(a, name) {\n var scaleDef = {};\n\n scaleDef.name = name;\n scaleDef.type = scale.type(name, encoding);\n scaleDef.domain = scale.domain(encoding, name, scaleDef.type, stats, facet);\n\n // add `reverse` if applicable\n var reverse = scale.reverse(encoding, name);\n if (reverse) {\n scaleDef.reverse = reverse;\n }\n\n scaleDef = scale.range(scaleDef, encoding, layout, stats);\n\n return (a.push(scaleDef), a);\n }, []);\n};\n\nscale.type = function(name, encoding) {\n switch (encoding.type(name)) {\n case N: //fall through\n case O: return 'ordinal';\n case T:\n var timeUnit = encoding.encDef(name).timeUnit;\n return timeUnit ? time.scale.type(timeUnit, name) : 'time';\n case Q:\n if (encoding.bin(name)) {\n // TODO: revise this\n return name === COLOR ? 'linear' : 'ordinal';\n }\n return encoding.scale(name).type;\n }\n};\n\nscale.domain = function (encoding, name, type, stats, facet) {\n var encDef = encoding.encDef(name);\n\n // special case for temporal scale\n if (encoding.isType(name, T)) {\n var range = time.scale.domain(encDef.timeUnit, name);\n if (range) return range;\n }\n\n // For binned, produce fixed stepped domain.\n // TODO(#614): this must be changed in vg2\n if (encDef.bin) {\n\n var fieldStat = stats[encDef.name],\n bins = util.getbins(fieldStat, encDef.bin.maxbins || schema.MAXBINS_DEFAULT),\n numbins = (bins.stop - bins.start) / bins.step;\n return util.range(numbins).map(function(i) {\n return bins.start + bins.step * i;\n });\n }\n\n // For stack, use STACKED data.\n var stack = encoding.stack();\n if (stack && name === stack.value) {\n return {\n data: STACKED,\n field: encoding.fieldRef(name, {\n // If faceted, scale is determined by the max of sum in each facet.\n prefn: (facet ? 'max_' : '') + 'sum_'\n })\n };\n }\n\n var useRawDomain = scale._useRawDomain(encoding, name);\n var sort = scale.sort(encoding, name, type);\n\n if (useRawDomain) {\n return {\n data: RAW,\n field: encoding.fieldRef(name, {noAggregate:true})\n };\n } else if (sort) { // have sort\n return {\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: sort.op ? RAW : encoding.dataTable(),\n field: encoding.fieldRef(name),\n sort: sort\n };\n } else {\n return {\n data: encoding.dataTable(),\n field: encoding.fieldRef(name)\n };\n }\n};\n\nscale.sort = function(encoding, name, type) {\n var sort = encoding.encDef(name).sort;\n if (sort === 'ascending' || sort === 'descending') {\n return true;\n }\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (type === 'ordinal' && util.isObject(sort)) {\n return {\n op: sort.op,\n field: sort.field\n };\n }\n return undefined;\n};\n\nscale.reverse = function(encoding, name) {\n var sort = encoding.encDef(name).sort;\n return sort && (sort === 'descending' || (sort.order === 'descending'));\n};\n\n/**\n * Determine if useRawDomain should be activated for this scale.\n * @return {Boolean} Returns true if all of the following conditons applies:\n * 1. `useRawDomain` is enabled either through scale or config\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nscale._useRawDomain = function (encoding, name) {\n var encDef = encoding.encDef(name);\n\n // scale value\n var scaleUseRawDomain = encoding.scale(name).useRawDomain;\n\n // Determine if useRawDomain is enabled. If scale value is specified, use scale value.\n // Otherwise, use config value.\n var useRawDomainEnabled = scaleUseRawDomain !== undefined ?\n scaleUseRawDomain : encoding.config('useRawDomain');\n\n var notCountOrSum = !encDef.aggregate ||\n (encDef.aggregate !=='count' && encDef.aggregate !== 'sum');\n\n return useRawDomainEnabled &&\n notCountOrSum && (\n // Q always uses quantitative scale except when it's binned and thus uses ordinal scale.\n (\n encoding.isType(name, Q) &&\n !encDef.bin // TODO(#614): this must be changed once bin is reimplemented\n ) ||\n // TODO: revise this\n // T uses non-ordinal scale when there's no unit or when the unit is not ordinal.\n (\n encoding.isType(name, T) &&\n (!encDef.timeUnit || !time.isOrdinalFn(encDef.timeUnit))\n )\n );\n};\n\n\nscale.range = function (scaleDef, encoding, layout, stats) {\n var spec = encoding.scale(scaleDef.name),\n encDef = encoding.encDef(scaleDef.name),\n timeUnit = encDef.timeUnit;\n\n switch (scaleDef.name) {\n case X:\n scaleDef.range = layout.cellWidth ? [0, layout.cellWidth] : 'width';\n if (scaleDef.type === 'ordinal') {\n scaleDef.bandWidth = encoding.bandSize(X, layout.x.useSmallBand);\n } else {\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n scaleDef.round = true;\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case Y:\n if (scaleDef.type === 'ordinal') {\n scaleDef.range = layout.cellHeight ?\n (encDef.bin ? [layout.cellHeight, 0] : [0, layout.cellHeight]) :\n 'height';\n scaleDef.bandWidth = encoding.bandSize(Y, layout.y.useSmallBand);\n } else {\n scaleDef.range = layout.cellHeight ? [layout.cellHeight, 0] : 'height';\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n\n scaleDef.round = true;\n\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case ROW: // support only ordinal\n scaleDef.bandWidth = layout.cellHeight;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case COL: // support only ordinal\n scaleDef.bandWidth = layout.cellWidth;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case SIZE:\n if (encoding.is('bar')) {\n // FIXME this is definitely incorrect\n // but let's fix it later since bar size is a bad encoding anyway\n scaleDef.range = [3, Math.max(encoding.bandSize(X), encoding.bandSize(Y))];\n } else if (encoding.is(TEXT)) {\n scaleDef.range = [8, 40];\n } else { //point\n var bandSize = Math.min(encoding.bandSize(X), encoding.bandSize(Y)) - 1;\n scaleDef.range = [10, 0.8 * bandSize*bandSize];\n }\n scaleDef.round = true;\n scaleDef.zero = false;\n break;\n case SHAPE:\n scaleDef.range = 'shapes';\n break;\n case COLOR:\n scaleDef.range = scale.color(scaleDef, encoding, stats);\n if (scaleDef.type !== 'ordinal') scaleDef.zero = false;\n break;\n default:\n throw new Error('Unknown encoding name: '+ scaleDef.name);\n }\n\n // FIXME(kanitw): Jul 29, 2015 - consolidate this with above\n switch (scaleDef.name) {\n case ROW:\n case COL:\n scaleDef.padding = encoding.config('cellPadding');\n scaleDef.outerPadding = 0;\n break;\n case X:\n case Y:\n if (scaleDef.type === 'ordinal') { //&& !s.bandWidth\n scaleDef.points = true;\n scaleDef.padding = encoding.encDef(scaleDef.name).band.padding;\n }\n }\n\n return scaleDef;\n};\n\nscale.color = function(s, encoding, stats) {\n var colorScale = encoding.scale(COLOR),\n range = colorScale.range,\n cardinality = encoding.cardinality(COLOR, stats),\n type = encoding.type(COLOR);\n\n if (range === undefined) {\n var ordinalPalette = colorScale.ordinalPalette,\n quantitativeRange = colorScale.quantitativeRange;\n\n if (s.type === 'ordinal') {\n if (type === N) {\n // use categorical color scale\n if (cardinality <= 10) {\n range = colorScale.c10palette;\n } else {\n range = colorScale.c20palette;\n }\n return scale.color.palette(range, cardinality, type);\n } else {\n if (ordinalPalette) {\n return scale.color.palette(ordinalPalette, cardinality, type);\n }\n return scale.color.interpolate(quantitativeRange[0], quantitativeRange[1], cardinality);\n }\n } else { //time or quantitative\n return [quantitativeRange[0], quantitativeRange[1]];\n }\n }\n};\n\nscale.color.palette = function(range, cardinality, type) {\n // FIXME(kanitw): Jul 29, 2015 - check range is string\n switch (range) {\n case 'category10k':\n // tableau's category 10, ordered by perceptual kernel study results\n // https://github.com/uwdata/perceptual-kernels\n return ['#2ca02c', '#e377c2', '#7f7f7f', '#17becf', '#8c564b', '#d62728', '#bcbd22', '#9467bd', '#ff7f0e', '#1f77b4'];\n\n // d3/tableau category10/20/20b/20c\n case 'category10':\n return ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'];\n\n case 'category20':\n return ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'];\n\n case 'category20b':\n return ['#393b79', '#5254a3', '#6b6ecf', '#9c9ede', '#637939', '#8ca252', '#b5cf6b', '#cedb9c', '#8c6d31', '#bd9e39', '#e7ba52', '#e7cb94', '#843c39', '#ad494a', '#d6616b', '#e7969c', '#7b4173', '#a55194', '#ce6dbd', '#de9ed6'];\n\n case 'category20c':\n return ['#3182bd', '#6baed6', '#9ecae1', '#c6dbef', '#e6550d', '#fd8d3c', '#fdae6b', '#fdd0a2', '#31a354', '#74c476', '#a1d99b', '#c7e9c0', '#756bb1', '#9e9ac8', '#bcbddc', '#dadaeb', '#636363', '#969696', '#bdbdbd', '#d9d9d9'];\n }\n\n // TODO add our own set of custom ordinal color palette\n\n if (range in colorbrewer) {\n var palette = colorbrewer[range];\n\n // if cardinality pre-defined, use it.\n if (cardinality in palette) return palette[cardinality];\n\n // if not, use the highest cardinality one for nominal\n if (type === N) {\n return palette[Math.max.apply(null, util.keys(palette))];\n }\n\n // otherwise, interpolate\n var ps = cardinality < 3 ? 3 : Math.max.apply(null, util.keys(palette)),\n from = 0 , to = ps - 1;\n // FIXME add config for from / to\n\n return scale.color.interpolate(palette[ps][from], palette[ps][to], cardinality);\n }\n\n return range;\n};\n\nscale.color.interpolate = function (start, end, cardinality) {\n\n var interpolator = interpolate(start, end);\n return util.range(cardinality).map(function(i) { return interpolator(i*1.0/(cardinality-1)); });\n};\n\n},{\"../globals\":71,\"../schema/schema\":73,\"../util\":75,\"./time\":66,\"colorbrewer\":3,\"d3-color\":4}],63:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nmodule.exports = stacking;\n\nfunction stacking(encoding, mdef, stack) {\n var groupby = stack.groupby;\n var field = stack.value;\n\n var valName = encoding.fieldRef(field);\n var startField = valName + '_start';\n var endField = valName + '_end';\n\n // add stack transform to mark\n var transform = {\n type: 'stack',\n groupby: [encoding.fieldRef(groupby)],\n field: encoding.fieldRef(field),\n sortby: [(stack.properties.reverse ? '-' : '') + encoding.fieldRef(stack.stack)],\n output: {start: startField, end: endField}\n };\n\n if (stack.properties.offset) {\n transform.offset = stack.properties.offset;\n }\n\n mdef.from.transform = [transform];\n\n // TODO(#276): This is super hack-ish -- consolidate into modular mark properties?\n mdef.properties.update[field] = mdef.properties.enter[field] = {\n scale: field,\n field: startField\n };\n mdef.properties.update[field + '2'] = mdef.properties.enter[field + '2'] = {\n scale: field,\n field: endField\n };\n\n return field; //return stack encoding\n}\n\n},{\"../globals\":71}],64:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nvar vlEncDef = require('../encdef');\n\nmodule.exports = function(encoding, stats) {\n return {\n opacity: estimateOpacity(encoding, stats),\n };\n};\n\nfunction estimateOpacity(encoding,stats) {\n if (!stats) {\n return 1;\n }\n\n var numPoints = 0;\n\n if (encoding.isAggregate()) { // aggregate plot\n numPoints = 1;\n\n // get number of points in each \"cell\"\n // by calculating product of cardinality\n // for each non faceting and non-ordinal X / Y fields\n // note that ordinal x,y are not include since we can\n // consider that ordinal x are subdividing the cell into subcells anyway\n encoding.forEach(function(encDef, encType) {\n\n if (encType !== ROW && encType !== COL &&\n !((encType === X || encType === Y) &&\n vlEncDef.isOrdinalScale(encDef))\n ) {\n numPoints *= encoding.cardinality(encType, stats);\n }\n });\n\n } else { // raw plot\n\n // TODO: error handling\n if (!stats['*'])\n return 1;\n\n numPoints = stats['*'].max; // count\n\n // small multiples divide number of points\n var numMultiples = 1;\n if (encoding.has(ROW)) {\n numMultiples *= encoding.cardinality(ROW, stats);\n }\n if (encoding.has(COL)) {\n numMultiples *= encoding.cardinality(COL, stats);\n }\n numPoints /= numMultiples;\n }\n\n var opacity = 0;\n if (numPoints <= 25) {\n opacity = 1;\n } else if (numPoints < 200) {\n opacity = 0.8;\n } else if (numPoints < 1000 || encoding.is('tick')) {\n opacity = 0.7;\n } else {\n opacity = 0.3;\n }\n\n return opacity;\n}\n\n\n},{\"../encdef\":70,\"../globals\":71}],65:[function(require,module,exports){\n'use strict';\n\nrequire('../globals');\n\nmodule.exports = subfaceting;\n\nfunction subfaceting(group, mdef, details, encoding) {\n var m = group.marks;\n var g = {\n name: 'subfacet',\n type: 'group',\n from: mdef.from,\n properties: {\n enter: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n marks: m\n };\n\n group.marks = [g];\n delete mdef.from; // (move to the new g)\n\n //TODO test LOD -- we should support stack / line without color (LOD) field\n var trans = (g.from.transform || (g.from.transform = []));\n trans.push({type: 'facet', groupby: details});\n\n // TODO: understand why we need this sort transform and write comment\n var stack = encoding.stack();\n if (stack && encoding.has(COLOR)) {\n trans.unshift({type: 'sort', by: encoding.fieldRef(COLOR)});\n }\n}\n\n},{\"../globals\":71}],66:[function(require,module,exports){\n'use strict';\n\nvar util = require('../util'),\n d3_time_format = require('d3-time-format');\n\nvar time = module.exports = {};\n\n// 'Wednesday September 17 04:00:00 2014'\n// Wednesday is the longest date\n// September is the longest month (8 in javascript as it is zero-indexed).\nvar LONG_DATE = new Date(Date.UTC(2014, 8, 17));\n\ntime.cardinality = function(encDef, stats, filterNull, type) {\n var timeUnit = encDef.timeUnit;\n switch (timeUnit) {\n case 'seconds': return 60;\n case 'minutes': return 60;\n case 'hours': return 24;\n case 'day': return 7;\n case 'date': return 31;\n case 'month': return 12;\n case 'year':\n var stat = stats[encDef.name],\n yearstat = stats['year_' + encDef.name];\n\n if (!yearstat) { return null; }\n\n return yearstat.distinct -\n (stat.missing > 0 && filterNull[type] ? 1 : 0);\n }\n\n return null;\n};\n\ntime.formula = function(timeUnit, fieldRef) {\n // TODO(kanitw): add formula to other time format\n var fn = 'utc' + timeUnit;\n return fn + '(' + fieldRef + ')';\n};\n\ntime.maxLength = function(timeUnit, encoding) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'date':\n return 2;\n case 'month':\n case 'day':\n var range = time.range(timeUnit, encoding);\n if (range) {\n // return the longest name in the range\n return Math.max.apply(null, range.map(function(r) {return r.length;}));\n }\n return 2;\n case 'year':\n return 4; //'1998'\n }\n // TODO(#600) revise this\n // no time unit\n var timeFormat = encoding.config('timeFormat');\n return d3_time_format.utcFormat(timeFormat)(LONG_DATE).length;\n};\n\ntime.range = function(timeUnit, encoding) {\n var labelLength = encoding.config('timeScaleLabelLength'),\n scaleLabel;\n switch (timeUnit) {\n case 'day':\n scaleLabel = encoding.config('dayScaleLabel');\n break;\n case 'month':\n scaleLabel = encoding.config('monthScaleLabel');\n break;\n }\n if (scaleLabel) {\n return labelLength ? scaleLabel.map(\n function(s) { return s.substr(0, labelLength);}\n ) : scaleLabel;\n }\n return;\n};\n\n\n/**\n * @param {Object} encoding\n * @return {Array} scales for time unit names\n */\ntime.scales = function(encoding) {\n var scales = encoding.reduce(function(scales, encDef) {\n var timeUnit = encDef.timeUnit;\n if (encDef.type === T && timeUnit && !scales[timeUnit]) {\n var scale = time.scale.def(encDef.timeUnit, encoding);\n if (scale) scales[timeUnit] = scale;\n }\n return scales;\n }, {});\n\n return util.vals(scales);\n};\n\n\ntime.scale = {};\n\n/** append custom time scales for axis label */\ntime.scale.def = function(timeUnit, encoding) {\n var range = time.range(timeUnit, encoding);\n\n if (range) {\n return {\n name: 'time-'+timeUnit,\n type: 'ordinal',\n domain: time.scale.domain(timeUnit),\n range: range\n };\n }\n return null;\n};\n\ntime.isOrdinalFn = function(timeUnit) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'day':\n case 'date':\n case 'month':\n return true;\n }\n return false;\n};\n\ntime.scale.type = function(timeUnit, name) {\n if (name === COLOR) {\n return 'linear'; // time has order, so use interpolated ordinal color scale.\n }\n\n return time.isOrdinalFn(timeUnit) || name === COL || name === ROW ? 'ordinal' : 'linear';\n};\n\ntime.scale.domain = function(timeUnit, name) {\n var isColor = name === COLOR;\n switch (timeUnit) {\n case 'seconds':\n case 'minutes': return isColor ? [0,59] : util.range(0, 60);\n case 'hours': return isColor ? [0,23] : util.range(0, 24);\n case 'day': return isColor ? [0,6] : util.range(0, 7);\n case 'date': return isColor ? [1,31] : util.range(1, 32);\n case 'month': return isColor ? [0,11] : util.range(0, 12);\n }\n return null;\n};\n\n/** whether a particular time function has custom scale for labels implemented in time.scale */\ntime.hasScale = function(timeUnit) {\n switch (timeUnit) {\n case 'day':\n case 'month':\n return true;\n }\n return false;\n};\n\n},{\"../util\":75,\"d3-time-format\":6}],67:[function(require,module,exports){\n'use strict';\n\nrequire('./globals');\n\nvar consts = module.exports = {};\n\nconsts.encodingTypes = [X, Y, ROW, COL, SIZE, SHAPE, COLOR, TEXT, DETAIL];\n\nconsts.shorthand = {\n delim: '|',\n assign: '=',\n type: ',',\n func: '_'\n};\n\n},{\"./globals\":71}],68:[function(require,module,exports){\n'use strict';\n\nrequire('./globals');\n\nvar stats = require('datalib/src/stats');\n\nvar vldata = module.exports = {};\n\n/** Mapping from datalib's inferred type to Vega-lite's type */\nvldata.types = {\n 'boolean': N,\n 'number': Q,\n 'integer': Q,\n 'date': T,\n 'string': N\n};\n\nvldata.stats = function(data) {\n var summary = stats.summary(data);\n\n return summary.reduce(function(s, profile) {\n s[profile.field] = profile;\n return s;\n }, {\n '*': {\n max: data.length,\n min: 0\n }\n });\n};\n},{\"./globals\":71,\"datalib/src/stats\":29}],69:[function(require,module,exports){\n// utility for enc\n\n'use strict';\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n vlEncDef = require('./encdef'),\n util = require('./util'),\n schema = require('./schema/schema'),\n encTypes = schema.encTypes;\n\nvar vlenc = module.exports = {};\n\nvlenc.countRetinal = function(enc) {\n var count = 0;\n if (enc.color) count++;\n if (enc.size) count++;\n if (enc.shape) count++;\n return count;\n};\n\nvlenc.has = function(enc, encType) {\n var fieldDef = enc && enc[encType];\n return fieldDef && fieldDef.name;\n};\n\nvlenc.isAggregate = function(enc) {\n for (var k in enc) {\n if (vlenc.has(enc, k) && enc[k].aggregate) {\n return true;\n }\n }\n return false;\n};\n\nvlenc.forEach = function(enc, f) {\n var i = 0;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n f(enc[k], k, i++);\n }\n });\n};\n\nvlenc.map = function(enc, f) {\n var arr = [];\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n arr.push(f(enc[k], k, enc));\n }\n });\n return arr;\n};\n\nvlenc.reduce = function(enc, f, init) {\n var r = init;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n r = f(r, enc[k], k, enc);\n }\n });\n return r;\n};\n\n/*\n * return key-value pairs of field name and list of fields of that field name\n */\nvlenc.fields = function(enc) {\n return vlenc.reduce(enc, function (m, field) {\n var fieldList = m[field.name] = m[field.name] || [],\n containsType = fieldList.containsType = fieldList.containsType || {};\n\n if (fieldList.indexOf(field) === -1) {\n fieldList.push(field);\n // augment the array with containsType.Q / O / N / T\n containsType[field.type] = true;\n }\n return m;\n }, {});\n};\n\nvlenc.shorthand = function(enc) {\n return vlenc.map(enc, function(field, et) {\n return et + c.assign + vlEncDef.shorthand(field);\n }).join(c.delim);\n};\n\nvlenc.fromShorthand = function(shorthand) {\n var enc = util.isArray(shorthand) ? shorthand : shorthand.split(c.delim);\n return enc.reduce(function(m, e) {\n var split = e.split(c.assign),\n enctype = split[0].trim(),\n field = split[1];\n\n m[enctype] = vlEncDef.fromShorthand(field);\n return m;\n }, {});\n};\n\n},{\"./consts\":67,\"./encdef\":70,\"./schema/schema\":73,\"./util\":75}],70:[function(require,module,exports){\n'use strict';\n\n// utility for field\n\nrequire('./globals');\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n time = require('./compiler/time'),\n util = require('./util'),\n schema = require('./schema/schema');\n\nvar vlfield = module.exports = {};\n\n/**\n * @param field\n * @param opt\n * opt.nofn -- exclude bin, aggregate, timeUnit\n * opt.noAggregate -- exclude aggregation function\n * opt.datum - include 'datum.'\n * opt.fn - replace fn with custom function prefix\n * opt.prefn - prepend fn with custom function prefix\n\n * @return {[type]} [description]\n */\nvlfield.fieldRef = function(field, opt) {\n opt = opt || {};\n\n var f = (opt.datum ? 'datum.' : '') + (opt.prefn || ''),\n name = field.name;\n\n if (vlfield.isCount(field)) {\n return f + 'count';\n } else if (opt.fn) {\n return f + opt.fn + '_' + name;\n } else if (!opt.nofn && field.bin) {\n return f + 'bin_' + name;\n } else if (!opt.nofn && !opt.noAggregate && field.aggregate) {\n return f + field.aggregate + '_' + name;\n } else if (!opt.nofn && field.timeUnit) {\n return f + field.timeUnit + '_' + name;\n } else {\n return f + name;\n }\n};\n\nvlfield.shorthand = function(f) {\n var c = consts.shorthand;\n return (f.aggregate ? f.aggregate + c.func : '') +\n (f.timeUnit ? f.timeUnit + c.func : '') +\n (f.bin ? 'bin' + c.func : '') +\n (f.name || '') + c.type + f.type;\n};\n\nvlfield.shorthands = function(fields, delim) {\n delim = delim || c.delim;\n return fields.map(vlfield.shorthand).join(delim);\n};\n\nvlfield.fromShorthand = function(shorthand) {\n var split = shorthand.split(c.type), i;\n var o = {\n name: split[0].trim(),\n type: split[1].trim()\n };\n\n // check aggregate type\n for (i in schema.aggregate.enum) {\n var a = schema.aggregate.enum[i];\n if (o.name.indexOf(a + '_') === 0) {\n o.name = o.name.substr(a.length + 1);\n if (a == 'count' && o.name.length === 0) o.name = '*';\n o.aggregate = a;\n break;\n }\n }\n\n // check time timeUnit\n for (i in schema.timefns) {\n var tu = schema.timefns[i];\n if (o.name && o.name.indexOf(tu + '_') === 0) {\n o.name = o.name.substr(o.length + 1);\n o.timeUnit = tu;\n break;\n }\n }\n\n // check bin\n if (o.name && o.name.indexOf('bin_') === 0) {\n o.name = o.name.substr(4);\n o.bin = true;\n }\n\n return o;\n};\n\nvar isType = vlfield.isType = function (fieldDef, type) {\n return fieldDef.type === type;\n};\n\nvar isTypes = vlfield.isTypes = function (fieldDef, types) {\n for (var t=0; t 0 && filterNull[type] ? 1 : 0);\n};\n\n},{\"./compiler/time\":66,\"./consts\":67,\"./globals\":71,\"./schema/schema\":73,\"./util\":75}],71:[function(require,module,exports){\n(function (global){\n'use strict';\n\n// declare global constant\nvar g = global || window;\n\ng.AGGREGATE = 'aggregate';\ng.RAW = 'raw';\ng.STACKED = 'stacked';\ng.INDEX = 'index';\n\ng.X = 'x';\ng.Y = 'y';\ng.ROW = 'row';\ng.COL = 'col';\ng.SIZE = 'size';\ng.SHAPE = 'shape';\ng.COLOR = 'color';\ng.TEXT = 'text';\ng.DETAIL = 'detail';\n\ng.N = 'N';\ng.O = 'O';\ng.Q = 'Q';\ng.T = 'T';\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],72:[function(require,module,exports){\n'use strict';\n\n// TODO(kanitw): chat with Vega team and possibly move this to vega-logging\nmodule.exports = function(prefix) {\n // Borrowed some ideas from http://stackoverflow.com/a/15653260/866989\n // and https://github.com/patik/console.log-wrapper/blob/master/consolelog.js\n var METHODS = ['error', 'info', 'debug', 'warn', 'log'];\n\n return METHODS.reduce(function(logger, fn) {\n var cfn = console[fn] ? fn : 'log';\n if (console[cfn].bind === 'undefined') { // IE < 10\n logger[fn] = Function.prototype.bind.call(console[cfn], console, prefix);\n }\n else {\n logger[fn] = console[cfn].bind(console, prefix);\n }\n return logger;\n }, {});\n};\n},{}],73:[function(require,module,exports){\n// Package of defining Vega-lite Specification's json schema\n'use strict';\n\nrequire('../globals');\n\nvar schema = module.exports = {},\n util = require('../util'),\n toMap = util.toMap,\n colorbrewer = require('colorbrewer');\n\nvar VALID_AGG_OPS = require('vega/src/transforms/Aggregate').VALID_OPS;\n\n// TODO(#620) refer to vega schema\n// var vgStackSchema = require('vega/src/transforms/Stack').schema;\n\n\nschema.util = require('./schemautil');\n\nschema.marktype = {\n type: 'string',\n enum: ['point', 'tick', 'bar', 'line', 'area', 'circle', 'square', 'text']\n};\n\nschema.aggregate = {\n type: 'string',\n enum: VALID_AGG_OPS,\n supportedEnums: {\n Q: VALID_AGG_OPS,\n O: ['median','min','max'],\n N: [],\n T: ['mean', 'median', 'min', 'max'],\n '': ['count']\n },\n supportedTypes: toMap([Q, N, O, T, ''])\n};\n\nschema.getSupportedRole = function(encType) {\n return schema.schema.properties.encoding.properties[encType].supportedRole;\n};\n\nschema.timeUnits = ['year', 'month', 'day', 'date', 'hours', 'minutes', 'seconds'];\n\nschema.defaultTimeFn = 'month';\n\nschema.timeUnit = {\n type: 'string',\n enum: schema.timeUnits,\n supportedTypes: toMap([T])\n};\n\nschema.scale_type = {\n type: 'string',\n // TODO(kanitw) read vega's schema here, add description\n enum: ['linear', 'log', 'pow', 'sqrt', 'quantile'],\n default: 'linear',\n supportedTypes: toMap([Q])\n};\n\nschema.field = {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n }\n }\n};\n\nvar clone = util.duplicate;\nvar merge = schema.util.merge;\n\nschema.MAXBINS_DEFAULT = 15;\n\nvar bin = {\n type: ['boolean', 'object'],\n default: false,\n properties: {\n maxbins: {\n type: 'integer',\n default: schema.MAXBINS_DEFAULT,\n minimum: 2,\n description: 'Maximum number of bins.'\n }\n },\n supportedTypes: toMap([Q]) // TODO: add O after finishing #81\n};\n\nvar typicalField = merge(clone(schema.field), {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T]\n },\n aggregate: schema.aggregate,\n timeUnit: schema.timeUnit,\n bin: bin,\n scale: {\n type: 'object',\n properties: {\n /* Common Scale Properties */\n type: schema.scale_type,\n\n /* Quantitative Scale Properties */\n nice: {\n type: 'string',\n enum: ['second', 'minute', 'hour', 'day', 'week', 'month', 'year'],\n supportedTypes: toMap([T])\n },\n zero: {\n type: 'boolean',\n description: 'Include zero',\n default: true,\n supportedTypes: toMap([Q, T])\n },\n\n /* Vega-lite only Properties */\n useRawDomain: {\n type: 'boolean',\n default: undefined,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n }\n }\n});\n\nvar onlyOrdinalField = merge(clone(schema.field), {\n type: 'object',\n supportedRole: {\n dimension: true\n },\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T] // ordinal-only field supports Q when bin is applied and T when time unit is applied.\n },\n timeUnit: schema.timeUnit,\n bin: bin,\n aggregate: {\n type: 'string',\n enum: ['count'],\n supportedTypes: toMap([N, O]) // FIXME this looks weird to me\n }\n }\n});\n\nvar axisMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true},\n properties: {\n axis: {\n type: 'object',\n properties: {\n /* Vega Axis Properties */\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for axis labels. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n grid: {\n type: 'boolean',\n default: undefined,\n description: 'A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise.'\n },\n layer: {\n type: 'string',\n default: 'back',\n description: 'A string indicating if the axis (and any gridlines) should be placed above or below the data marks. One of \"front\" (default) or \"back\".'\n },\n orient: {\n type: 'string',\n default: undefined,\n enum: ['top', 'right', 'left', 'bottom'],\n 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 for the right edge of the chart).'\n },\n ticks: {\n type: 'integer',\n default: 5,\n minimum: 0,\n 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 },\n /* Vega Axis Properties that are automatically populated by Vega-lite */\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the axis. (Shows field name and its function by default.)'\n },\n /* Vega-lite only */\n maxLabelLength: {\n type: 'integer',\n default: 25,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n },\n labelAngle: {\n type: 'integer',\n default: undefined, // auto\n minimum: 0,\n maximum: 360,\n description: 'Angle by which to rotate labels. Set to 0 to force horizontal.'\n },\n titleMaxLength: {\n type: 'integer',\n default: undefined,\n minimum: 0,\n description: 'Max length for axis title if the title is automatically generated from the field\\'s description'\n },\n titleOffset: {\n type: 'integer',\n default: undefined, // auto\n description: 'A title offset value for the axis.'\n },\n }\n }\n }\n};\n\nvar sortMixin = {\n type: 'object',\n properties: {\n sort: {\n default: 'ascending',\n supportedTypes: toMap([N, O]),\n oneOf: [\n {\n type: 'string',\n enum: ['ascending', 'descending', 'unsorted']\n },\n { // sort by aggregation of another field\n type: 'object',\n required: ['field', 'op'],\n properties: {\n field: {\n type: 'string',\n description: 'The field name to aggregate over.'\n },\n op: {\n type: 'string',\n enum: VALID_AGG_OPS,\n description: 'The field name to aggregate over.'\n },\n order: {\n type: 'string',\n enum: ['ascending', 'descending']\n }\n }\n }\n ]\n\n }\n }\n};\n\nvar bandMixin = {\n type: 'object',\n properties: {\n band: {\n type: 'object',\n properties: {\n size: {\n type: 'integer',\n minimum: 0,\n default: undefined\n },\n padding: {\n type: 'integer',\n minimum: 0,\n default: 1\n }\n }\n }\n }\n};\n\nvar legendMixin = {\n type: 'object',\n properties: {\n legend: {\n type: 'object',\n description: 'Properties of a legend.',\n properties: {\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the legend. (Shows field name and its function by default.)'\n },\n orient: {\n type: 'string',\n default: 'right',\n description: 'The orientation of the legend. One of \"left\" or \"right\". This determines how the legend is positioned within the scene. The default is \"right\".'\n }\n }\n }\n }\n};\n\nvar textMixin = {\n type: 'object',\n supportedMarktypes: {'text': true},\n properties: {\n align: {\n type: 'string',\n default: 'right'\n },\n baseline: {\n type: 'string',\n default: 'middle'\n },\n color: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n margin: {\n type: 'integer',\n default: 4,\n minimum: 0\n },\n placeholder: {\n type: 'string',\n default: 'Abc'\n },\n font: {\n type: 'object',\n properties: {\n weight: {\n type: 'string',\n enum: ['normal', 'bold'],\n default: 'normal'\n },\n size: {\n type: 'integer',\n default: 10,\n minimum: 0\n },\n family: {\n type: 'string',\n default: 'Helvetica Neue'\n },\n style: {\n type: 'string',\n default: 'normal',\n enum: ['normal', 'italic']\n }\n }\n },\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for text value. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n }\n};\n\nvar sizeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, bar: true, circle: true, square: true, text: true},\n properties: {\n value: {\n type: 'integer',\n default: 30,\n minimum: 0,\n description: 'Size of marks.'\n }\n }\n};\n\nvar colorMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, 'text': true},\n properties: {\n value: {\n type: 'string',\n role: 'color',\n default: '#4682b4',\n description: 'Color to be used for marks.'\n },\n opacity: {\n type: 'number',\n default: undefined, // auto\n minimum: 0,\n maximum: 1\n },\n scale: {\n type: 'object',\n properties: {\n range: {\n type: ['string', 'array'],\n default: undefined,\n description:\n 'Color palette, if undefined vega-lite will use data property' +\n 'to pick one from c10palette, c20palette, or ordinalPalette.'\n //FIXME\n },\n c10palette: {\n type: 'string',\n default: 'category10',\n enum: [\n // Tableau\n 'category10', 'category10k',\n // Color Brewer\n 'Pastel1', 'Pastel2', 'Set1', 'Set2', 'Set3'\n ]\n },\n c20palette: {\n type: 'string',\n default: 'category20',\n enum: ['category20', 'category20b', 'category20c']\n },\n ordinalPalette: {\n type: 'string',\n default: undefined,\n description: 'Color palette to encode ordinal variables.',\n enum: util.keys(colorbrewer)\n },\n quantitativeRange: {\n type: 'array',\n default: ['#AFC6A3', '#09622A'], // tableau greens\n // default: ['#ccece6', '#00441b'], // BuGn.9 [2-8]\n description: 'Color range to encode quantitative variables.',\n minItems: 2,\n maxItems: 2,\n items: {\n type: 'string',\n role: 'color'\n }\n }\n }\n }\n }\n};\n\nvar stackMixin = {\n type: 'object',\n properties: {\n stack: {\n type: ['boolean', 'object'],\n default: true,\n description: 'Enable stacking (for bar and area marks only).',\n properties: {\n reverse: {\n type: 'boolean',\n default: false,\n description: 'Whether to reverse the stack\\'s sortby.'\n },\n offset: {\n type: 'string',\n default: undefined,\n enum: ['zero', 'center', 'normalize']\n // TODO(#620) refer to Vega spec once it doesn't throw error\n // enum: vgStackSchema.properties.offset.oneOf[0].enum\n }\n }\n }\n }\n};\n\nvar shapeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, circle: true, square: true},\n properties: {\n value: {\n type: 'string',\n enum: ['circle', 'square', 'cross', 'diamond', 'triangle-up', 'triangle-down'],\n default: 'circle',\n description: 'Mark to be used.'\n },\n filled: {\n type: 'boolean',\n default: false,\n description: 'Whether the shape\\'s color should be used as fill color instead of stroke color.'\n }\n }\n};\n\nvar detailMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, line: true, circle: true, square: true}\n};\n\nvar rowMixin = {\n properties: {\n height: {\n type: 'number',\n minimum: 0,\n default: 150\n }\n }\n};\n\nvar colMixin = {\n properties: {\n width: {\n type: 'number',\n minimum: 0,\n default: 150\n },\n axis: {\n properties: {\n maxLabelLength: {\n type: 'integer',\n default: 12,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n }\n }\n }\n }\n};\n\nvar facetMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, text: true},\n properties: {\n padding: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.1\n }\n }\n};\n\nvar requiredNameType = {\n required: ['name', 'type']\n};\n\nvar multiRoleField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: true\n }\n});\n\nvar quantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: 'ordinal-only' // using size to encoding category lead to order interpretation\n }\n});\n\nvar onlyQuantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true\n }\n});\n\nvar x = merge(clone(multiRoleField), axisMixin, bandMixin, requiredNameType, sortMixin);\nvar y = clone(x);\n\nvar facet = merge(clone(onlyOrdinalField), requiredNameType, facetMixin, sortMixin);\nvar row = merge(clone(facet), axisMixin, rowMixin);\nvar col = merge(clone(facet), axisMixin, colMixin);\n\nvar size = merge(clone(quantitativeField), legendMixin, sizeMixin, sortMixin);\nvar color = merge(clone(multiRoleField), legendMixin, colorMixin, stackMixin, sortMixin);\n\nvar shape = merge(clone(onlyOrdinalField), legendMixin, shapeMixin, sortMixin);\nvar detail = merge(clone(onlyOrdinalField), detailMixin, stackMixin, sortMixin);\n\n// we only put aggregated measure in pivot table\nvar text = merge(clone(onlyQuantitativeField), textMixin, sortMixin);\n\n// TODO add label\n\nvar data = {\n type: 'object',\n properties: {\n // data source\n formatType: {\n type: 'string',\n enum: ['json', 'csv'],\n default: 'json'\n },\n url: {\n type: 'string',\n default: undefined\n },\n values: {\n type: 'array',\n default: undefined,\n description: 'Pass array of objects instead of a url to a file.',\n items: {\n type: 'object',\n additionalProperties: true\n }\n },\n // we generate a vega filter transform\n filter: {\n type: 'string',\n default: undefined,\n description: 'A string containing the filter Vega expression. Use `datum` to refer to the current data object.'\n },\n // we generate a vega formula transform\n formulas: {\n type: 'array',\n default: undefined,\n description: 'Array of formula transforms. Formulas are applied before filter.',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The property name in which to store the computed formula value.'\n },\n expr: {\n type: 'string',\n description: 'A string containing an expression for the formula. Use the variable `datum` to to refer to the current data object.'\n }\n }\n }\n }\n }\n};\n\nvar config = {\n type: 'object',\n properties: {\n // template\n width: {\n type: 'integer',\n default: undefined\n },\n height: {\n type: 'integer',\n default: undefined\n },\n viewport: {\n type: 'array',\n items: {\n type: 'integer'\n },\n default: undefined\n },\n gridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n gridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.08\n },\n\n // filter null\n // TODO(#597) revise this config\n filterNull: {\n type: 'object',\n properties: {\n N: {type:'boolean', default: false},\n O: {type:'boolean', default: false},\n Q: {type:'boolean', default: true},\n T: {type:'boolean', default: true}\n }\n },\n autoSortLine: {\n type: 'boolean',\n default: true\n },\n\n // single plot\n singleHeight: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n singleWidth: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n // band size\n largeBandSize: {\n type: 'integer',\n default: 21,\n minimum: 0\n },\n smallBandSize: {\n //small multiples or single plot with high cardinality\n type: 'integer',\n default: 12,\n minimum: 0\n },\n largeBandMaxCardinality: {\n type: 'integer',\n default: 10\n },\n // small multiples\n cellPadding: {\n type: 'number',\n default: 0.1\n },\n cellGridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n cellGridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.25\n },\n cellGridOffset: {\n type: 'number',\n default: 6 // equal to tickSize\n },\n cellBackgroundColor: {\n type: 'string',\n role: 'color',\n default: 'rgba(0,0,0,0)'\n },\n textCellWidth: {\n type: 'integer',\n default: 90,\n minimum: 0\n },\n\n // marks\n strokeWidth: {\n type: 'integer',\n default: 2,\n minimum: 0\n },\n singleBarOffset: {\n type: 'integer',\n default: 5,\n minimum: 0\n },\n // scales\n timeScaleLabelLength: {\n type: 'integer',\n default: 3,\n minimum: 0,\n description: 'Max length for values in dayScaleLabel and monthScaleLabel. Zero means using full names in dayScaleLabel/monthScaleLabel.'\n },\n dayScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n description: 'Axis labels for day of week, starting from Sunday.' +\n '(Consistent with Javascript -- See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay.'\n },\n monthScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n description: 'Axis labels for month.'\n },\n // other\n characterWidth: {\n type: 'integer',\n default: 6\n },\n maxSmallNumber: {\n type: 'number',\n default: 10000,\n description: 'maximum number that a field will be considered smallNumber.'+\n 'Used for axis labelling.'\n },\n smallNumberFormat: {\n type: 'string',\n default: '',\n description: 'D3 Number format for axis labels and text tables '+\n 'for number <= maxSmallNumber. Used for axis labelling.'\n },\n largeNumberFormat: {\n type: 'string',\n default: '.3s',\n description: 'D3 Number format for axis labels and text tables ' +\n 'for number > maxSmallNumber.'\n },\n timeFormat: {\n type: 'string',\n default: '%Y-%m-%d',\n description: 'Date format for axis labels.'\n },\n useRawDomain: {\n type: 'boolean',\n default: false,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n};\n\n/** @type Object Schema of a vega-lite specification */\nschema.schema = {\n $schema: 'http://json-schema.org/draft-04/schema#',\n description: 'Schema for Vega-lite specification',\n type: 'object',\n required: ['marktype', 'encoding', 'data'],\n properties: {\n data: data,\n marktype: schema.marktype,\n encoding: {\n type: 'object',\n properties: {\n x: x,\n y: y,\n row: row,\n col: col,\n size: size,\n color: color,\n shape: shape,\n text: text,\n detail: detail\n }\n },\n config: config\n }\n};\n\nschema.encTypes = util.keys(schema.schema.properties.encoding.properties);\n\n/** Instantiate a verbose vl spec from the schema */\nschema.instantiate = function() {\n return schema.util.instantiate(schema.schema);\n};\n\n},{\"../globals\":71,\"../util\":75,\"./schemautil\":74,\"colorbrewer\":3,\"vega/src/transforms/Aggregate\":50}],74:[function(require,module,exports){\n'use strict';\n\nvar schemautil = module.exports = {},\n util = require('../util');\n\nvar isEmpty = function(obj) {\n return Object.keys(obj).length === 0;\n};\n\nschemautil.extend = function(instance, schema) {\n return schemautil.merge(schemautil.instantiate(schema), instance);\n};\n\n// instantiate a schema\nschemautil.instantiate = function(schema) {\n var val;\n if (schema === undefined) {\n return undefined;\n } else if ('default' in schema) {\n val = schema.default;\n return util.isObject(val) ? util.duplicate(val) : val;\n } else if (schema.type === 'object') {\n var instance = {};\n for (var name in schema.properties) {\n val = schemautil.instantiate(schema.properties[name]);\n if (val !== undefined) {\n instance[name] = val;\n }\n }\n return instance;\n } else if (schema.type === 'array') {\n return [];\n }\n return undefined;\n};\n\n// remove all defaults from an instance\nschemautil.subtract = function(instance, defaults) {\n var changes = {};\n for (var prop in instance) {\n var def = defaults[prop];\n var ins = instance[prop];\n // Note: does not properly subtract arrays\n if (!defaults || def !== ins) {\n if (typeof ins === 'object' && !util.isArray(ins) && def) {\n var c = schemautil.subtract(ins, def);\n if (!isEmpty(c))\n changes[prop] = c;\n } else if (!util.isArray(ins) || ins.length > 0) {\n changes[prop] = ins;\n }\n }\n }\n return changes;\n};\n\nschemautil.merge = function(/*dest*, src0, src1, ...*/){\n var dest = arguments[0];\n for (var i=1 ; i 180 || delta < -180\n ? delta - 360 * Math.round(delta / 360)\n : delta;\n }\n\n function Color() {}var reHex3 = /^#([0-9a-f]{3})$/;\n var reHex6 = /^#([0-9a-f]{6})$/;\n var reRgbInteger = /^rgb\\(\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*,\\s*([-+]?\\d+)\\s*\\)$/;\n var reRgbPercent = /^rgb\\(\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n var reHslPercent = /^hsl\\(\\s*([-+]?\\d+(?:\\.\\d+)?)\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*,\\s*([-+]?\\d+(?:\\.\\d+)?)%\\s*\\)$/;\n color.prototype = Color.prototype = {\n displayable: function() {\n return this.rgb().displayable();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n };\n\n function color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf))) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\n : (m = reRgbInteger.exec(format)) ? rgb(m[1], m[2], m[3]) // rgb(255,0,0)\n : (m = reRgbPercent.exec(format)) ? rgb(m[1] * 2.55, m[2] * 2.55, m[3] * 2.55) // rgb(100%,0%,0%)\n : (m = reHslPercent.exec(format)) ? hsl(m[1], m[2] * .01, m[3] * .01) // hsl(120,50%,50%)\n : named.hasOwnProperty(format) ? rgbn(named[format])\n : null;\n }function rgbn(n) {\n return rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff);\n }\n\n var named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n };\n\n var darker = .7;\n var brighter = 1 / darker;\n\n function rgb(r, g, b) {\n if (arguments.length === 1) {\n if (!(r instanceof Color)) r = color(r);\n if (r) {\n r = r.rgb();\n b = r.b;\n g = r.g;\n r = r.r;\n } else {\n r = g = b = NaN;\n }\n }\n return new Rgb(r, g, b);\n }function Rgb(r, g, b) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n }var ____prototype = rgb.prototype = Rgb.prototype = new Color;\n\n ____prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k);\n };\n\n ____prototype.rgb = function() {\n return this;\n };\n\n ____prototype.displayable = function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255);\n };\n\n ____prototype.toString = function() {\n return _format(this.r, this.g, this.b);\n };\n\n function _format(r, g, b) {\n return \"#\"\n + (isNaN(r) ? \"00\" : (r = Math.round(r)) < 16 ? \"0\" + Math.max(0, r).toString(16) : Math.min(255, r).toString(16))\n + (isNaN(g) ? \"00\" : (g = Math.round(g)) < 16 ? \"0\" + Math.max(0, g).toString(16) : Math.min(255, g).toString(16))\n + (isNaN(b) ? \"00\" : (b = Math.round(b)) < 16 ? \"0\" + Math.max(0, b).toString(16) : Math.min(255, b).toString(16));\n }\n\n function hsl(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Hsl) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Color)) h = color(h);\n if (h) {\n if (h instanceof Hsl) return h;\n h = h.rgb();\n var r = h.r / 255,\n g = h.g / 255,\n b = h.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n range = max - min;\n l = (max + min) / 2;\n if (range) {\n s = l < .5 ? range / (max + min) : range / (2 - max - min);\n if (r === max) h = (g - b) / range + (g < b) * 6;\n else if (g === max) h = (b - r) / range + 2;\n else h = (r - g) / range + 4;\n h *= 60;\n } else {\n h = NaN;\n s = l > 0 && l < 1 ? 0 : h;\n }\n } else {\n h = s = l = NaN;\n }\n }\n }\n return new Hsl(h, s, l);\n }function Hsl(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var ___prototype = hsl.prototype = Hsl.prototype = new Color;\n\n ___prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k);\n };\n\n ___prototype.rgb = function() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < .5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2)\n );\n };\n\n ___prototype.displayable = function() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1);\n };\n\n /* From FvD 13.37, CSS Color Module Level 3 */\n function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n }\n\n var Kn = 18;\n\n var Xn = 0.950470;\n var Yn = 1;\n var Zn = 1.088830;\n var t0 = 4 / 29;\n var t1 = 6 / 29;\n var t2 = 3 * t1 * t1;\n var t3 = t1 * t1 * t1;\n function lab(l, a, b) {\n if (arguments.length === 1) {\n if (l instanceof Lab) {\n b = l.b;\n a = l.a;\n l = l.l;\n } else if (l instanceof Hcl) {\n var h = l.h * deg2rad;\n b = Math.sin(h) * l.c;\n a = Math.cos(h) * l.c;\n l = l.l;\n } else {\n if (!(l instanceof Rgb)) l = rgb(l);\n var r = rgb2xyz(l.r),\n g = rgb2xyz(l.g),\n b = rgb2xyz(l.b),\n x = xyz2lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / Xn),\n y = xyz2lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Yn),\n z = xyz2lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Zn);\n b = 200 * (y - z);\n a = 500 * (x - y);\n l = 116 * y - 16;\n }\n }\n return new Lab(l, a, b);\n }function Lab(l, a, b) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n }var __prototype = lab.prototype = Lab.prototype = new Color;\n\n __prototype.brighter = function(k) {\n return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.darker = function(k) {\n return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b);\n };\n\n __prototype.rgb = function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Rgb(\n xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),\n xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)\n );\n };\n\n function xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n }\n\n function lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n }\n\n function xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n }\n\n function rgb2xyz(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n }\n\n var deg2rad = Math.PI / 180;\n var rad2deg = 180 / Math.PI;\n\n function hcl(h, c, l) {\n if (arguments.length === 1) {\n if (h instanceof Hcl) {\n l = h.l;\n c = h.c;\n h = h.h;\n } else {\n if (!(h instanceof Lab)) h = lab(h);\n l = h.l;\n c = Math.sqrt(h.a * h.a + h.b * h.b);\n h = Math.atan2(h.b, h.a) * rad2deg;\n if (h < 0) h += 360;\n }\n }\n return new Hcl(h, c, l);\n }function Hcl(h, c, l) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n }var _prototype = hcl.prototype = Hcl.prototype = new Color;\n\n _prototype.brighter = function(k) {\n return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k));\n };\n\n _prototype.darker = function(k) {\n return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k));\n };\n\n _prototype.rgb = function() {\n return lab(this).rgb();\n };\n\n var A = -0.14861;\n var B = +1.78277;\n var C = -0.29227;\n var D = -0.90649;\n var E = +1.97294;\n var ED = E * D;\n var EB = E * B;\n var BC_DA = B * C - D * A;\n function cubehelix(h, s, l) {\n if (arguments.length === 1) {\n if (h instanceof Cubehelix) {\n l = h.l;\n s = h.s;\n h = h.h;\n } else {\n if (!(h instanceof Rgb)) h = rgb(h);\n var r = h.r / 255, g = h.g / 255, b = h.b / 255;\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB);\n var bl = b - l, k = (E * (g - l) - C * bl) / D;\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)); // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n if (h < 0) h += 360;\n }\n }\n return new Cubehelix(h, s, l);\n }function Cubehelix(h, s, l) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n }var prototype = cubehelix.prototype = Cubehelix.prototype = new Color;\n\n prototype.brighter = function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.darker = function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k);\n };\n\n prototype.rgb = function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh))\n );\n };\n\n function interpolateCubehelixGamma(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateCubehelixGammaLong(gamma) {\n return function(a, b) {\n a = cubehelix(a);\n b = cubehelix(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * Math.pow(t, gamma);\n return a + \"\";\n };\n };\n }\n\n function interpolateHclLong(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHcl(a, b) {\n a = hcl(a);\n b = hcl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n ac = isNaN(a.c) ? b.c : a.c,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bc = isNaN(b.c) ? 0 : b.c - ac,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.c = ac + bc * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateLab(a, b) {\n a = lab(a);\n b = lab(b);\n var al = a.l,\n aa = a.a,\n ab = a.b,\n bl = b.l - al,\n ba = b.a - aa,\n bb = b.b - ab;\n return function(t) {\n a.l = al + bl * t;\n a.a = aa + ba * t;\n a.b = ab + bb * t;\n return a + \"\";\n };\n }\n\n function interpolateHslLong(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : b.h - ah,\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateHsl(a, b) {\n a = hsl(a);\n b = hsl(b);\n var ah = isNaN(a.h) ? b.h : a.h,\n as = isNaN(a.s) ? b.s : a.s,\n al = a.l,\n bh = isNaN(b.h) ? 0 : deltaHue(b.h, ah),\n bs = isNaN(b.s) ? 0 : b.s - as,\n bl = b.l - al;\n return function(t) {\n a.h = ah + bh * t;\n a.s = as + bs * t;\n a.l = al + bl * t;\n return a + \"\";\n };\n }\n\n function interpolateRgb(a, b) {\n a = rgb(a);\n b = rgb(b);\n var ar = a.r,\n ag = a.g,\n ab = a.b,\n br = b.r - ar,\n bg = b.g - ag,\n bb = b.b - ab;\n return function(t) {\n return _format(Math.round(ar + br * t), Math.round(ag + bg * t), Math.round(ab + bb * t));\n };\n }\n\n var interpolateCubehelix = interpolateCubehelixGamma(1);\n var interpolateCubehelixLong = interpolateCubehelixGammaLong(1);\n\n exports.interpolateCubehelix = interpolateCubehelix;\n exports.interpolateCubehelixLong = interpolateCubehelixLong;\n exports.color = color;\n exports.rgb = rgb;\n exports.hsl = hsl;\n exports.lab = lab;\n exports.hcl = hcl;\n exports.cubehelix = cubehelix;\n exports.interpolateRgb = interpolateRgb;\n exports.interpolateHsl = interpolateHsl;\n exports.interpolateHslLong = interpolateHslLong;\n exports.interpolateLab = interpolateLab;\n exports.interpolateHcl = interpolateHcl;\n exports.interpolateHclLong = interpolateHclLong;\n exports.interpolateCubehelixGamma = interpolateCubehelixGamma;\n exports.interpolateCubehelixGammaLong = interpolateCubehelixGammaLong;\n\n}));","if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.format = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"¥\", \"\"]\n };\n\n var ruRu = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0руб.\"]\n };\n\n var ptBr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"R$\", \"\"]\n };\n\n var plPl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"zł\"]\n };\n\n var nlNl = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\\xa0\", \"\"]\n };\n\n var mkMk = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0ден.\"]\n };\n\n var jaJp = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"\", \"円\"]\n };\n\n var itIt = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"€\", \"\"]\n };\n\n var heIl = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"₪\", \"\"]\n };\n\n var frFr = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var frCa = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"$\"]\n };\n\n var fiFi = {\n decimal: \",\",\n thousands: \"\\xa0\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var esEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var enUs = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var enGb = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"£\", \"\"]\n };\n\n var enCa = {\n decimal: \".\",\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n };\n\n var deDe = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n var caEs = {\n decimal: \",\",\n thousands: \".\",\n grouping: [3],\n currency: [\"\", \"\\xa0€\"]\n };\n\n\n // Computes the decimal coefficient and exponent of the specified number x with\n // significant digits p, where x is positive and p is in [1, 21] or undefined.\n // For example, formatDecimal(1.23) returns [\"123\", 0].\n function formatDecimal(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n }\n\n function exponent(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\n }\n\n var prefixExponent;\n\n function formatPrefixAuto(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimal(x, p + i - 1)[0]; // less than 1y!\n }\n\n function formatRounded(x, p) {\n var d = formatDecimal(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n }\n\n function formatDefault(x, p) {\n x = x.toPrecision(p);\n\n out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (x[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n case \"e\": break out;\n default: if (i0 > 0) i0 = 0; break;\n }\n }\n\n return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;\n }\n\n var formatTypes = {\n \"\": formatDefault,\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n };\n\n\n // [[fill]align][sign][symbol][0][width][,][.precision][type]\n var re = /^(?:(.)?([<>=^]))?([+\\-\\( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?([a-z%])?$/i;\n\n function formatSpecifier(specifier) {\n return new FormatSpecifier(specifier);\n }\n\n function FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n\n var match,\n fill = match[1] || \" \",\n align = match[2] || \">\",\n sign = match[3] || \"-\",\n symbol = match[4] || \"\",\n zero = !!match[5],\n width = match[6] && +match[6],\n comma = !!match[7],\n precision = match[8] && +match[8].slice(1),\n type = match[9] || \"\";\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // Map invalid types to the default format.\n else if (!formatTypes[type]) type = \"\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n this.fill = fill;\n this.align = align;\n this.sign = sign;\n this.symbol = symbol;\n this.zero = zero;\n this.width = width;\n this.comma = comma;\n this.precision = precision;\n this.type = type;\n }\n\n FormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + this.type;\n };\n\n function formatGroup(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n }\n\n var prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\n function identity(x) {\n return x;\n }\n\n function locale(locale) {\n var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal;\n\n function format(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n type = specifier.type;\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%p]/.test(type) ? \"%\" : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = !type || /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision == null ? (type ? 6 : 12)\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n return function(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Convert negative to positive, and compute the prefix.\n // Note that -0 is not less than 0, but 1 / -0 is!\n var valueNegative = (value < 0 || 1 / value < 0) && (value *= -1, true);\n\n // Perform the initial formatting.\n value = formatType(value, precision);\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = valueSuffix + (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n var i = -1, n = value.length, c;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": return valuePrefix + value + valueSuffix + padding;\n case \"=\": return valuePrefix + padding + value + valueSuffix;\n case \"^\": return padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);\n }\n return padding + valuePrefix + value + valueSuffix;\n };\n }\n\n function formatPrefix(specifier, value) {\n var f = format((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: format,\n formatPrefix: formatPrefix\n };\n }\n\n function precisionRound(step, max) {\n return Math.max(0, exponent(Math.abs(max)) - exponent(Math.abs(step))) + 1;\n }\n\n function precisionPrefix(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n }\n\n function precisionFixed(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n }\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.formatPrefix = defaultLocale.formatPrefix;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.formatSpecifier = formatSpecifier;\n exports.precisionFixed = precisionFixed;\n exports.precisionPrefix = precisionPrefix;\n exports.precisionRound = precisionRound;\n\n}));","if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.dsv = {}));\n}(this, function (exports) { 'use strict';\n\n var dsv = function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n]\"),\n delimiterCode = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var o;\n return parseRows(text, function(row, i) {\n if (o) return o(row, i - 1);\n var a = new Function(\"d\", \"return {\" + row.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n o = f ? function(row, i) { return f(a(row), i); } : a;\n });\n }\n\n function parseRows(text, f) {\n var EOL = {}, // sentinel value for end-of-line\n EOF = {}, // sentinel value for end-of-file\n rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // the current line number\n t, // the current token\n eol; // is the current token followed by EOL?\n\n function token() {\n if (I >= N) return EOF; // special case: end of file\n if (eol) return eol = false, EOL; // special case: end of line\n\n // special case: quotes\n var j = I;\n if (text.charCodeAt(j) === 34) {\n var i = j;\n while (i++ < N) {\n if (text.charCodeAt(i) === 34) {\n if (text.charCodeAt(i + 1) !== 34) break;\n ++i;\n }\n }\n I = i + 2;\n var c = text.charCodeAt(i + 1);\n if (c === 13) {\n eol = true;\n if (text.charCodeAt(i + 2) === 10) ++I;\n } else if (c === 10) {\n eol = true;\n }\n return text.slice(j + 1, i).replace(/\"\"/g, \"\\\"\");\n }\n\n // common case: find next delimiter or newline\n while (I < N) {\n var c = text.charCodeAt(I++), k = 1;\n if (c === 10) eol = true; // \\n\n else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \\r|\\r\\n\n else if (c !== delimiterCode) continue;\n return text.slice(j, I - k);\n }\n\n // special case: last token before EOF\n return text.slice(j);\n }\n\n while ((t = token()) !== EOF) {\n var a = [];\n while (t !== EOL && t !== EOF) {\n a.push(t);\n t = token();\n }\n if (f && (a = f(a, n++)) == null) continue;\n rows.push(a);\n }\n\n return rows;\n }\n\n function format(rows) {\n if (Array.isArray(rows[0])) return formatRows(rows); // deprecated; use formatRows\n var fieldSet = Object.create(null), fields = [];\n\n // Compute unique fields in order of discovery.\n rows.forEach(function(row) {\n for (var field in row) {\n if (!((field += \"\") in fieldSet)) {\n fields.push(fieldSet[field] = field);\n }\n }\n });\n\n return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return fields.map(function(field) {\n return formatValue(row[field]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return reFormat.test(text) ? \"\\\"\" + text.replace(/\\\"/g, \"\\\"\\\"\") + \"\\\"\" : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n }\n\n exports.csv = dsv(\",\");\n exports.tsv = dsv(\"\\t\");\n\n exports.dsv = dsv;\n\n}));","if (typeof Map === \"undefined\") {\n Map = function() { this.clear(); };\n Map.prototype = {\n set: function(k, v) { this._[k] = v; return this; },\n get: function(k) { return this._[k]; },\n has: function(k) { return k in this._; },\n delete: function(k) { return k in this._ && delete this._[k]; },\n clear: function() { this._ = Object.create(null); },\n get size() { var n = 0; for (var k in this._) ++n; return n; },\n forEach: function(c) { for (var k in this._) c(this._[k], k, this); }\n };\n} else (function() {\n var m = new Map;\n if (m.set(0, 0) !== m) {\n m = m.set;\n Map.prototype.set = function() { m.apply(this, arguments); return this; };\n }\n})();\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.timeFormat = {}));\n}(this, function (exports) { 'use strict';\n\n var zhCn = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y/%-m/%-d\",\n time: \"%H:%M:%S\",\n periods: [\"上午\", \"下午\"],\n days: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n shortDays: [\"星期日\", \"星期一\", \"星期二\", \"星期三\", \"星期四\", \"星期五\", \"星期六\"],\n months: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"],\n shortMonths: [\"一月\", \"二月\", \"三月\", \"四月\", \"五月\", \"六月\", \"七月\", \"八月\", \"九月\", \"十月\", \"十一月\", \"十二月\"]\n };\n\n var ruRu = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"воскресенье\", \"понедельник\", \"вторник\", \"среда\", \"четверг\", \"пятница\", \"суббота\"],\n shortDays: [\"вс\", \"пн\", \"вт\", \"ср\", \"чт\", \"пт\", \"сб\"],\n months: [\"января\", \"февраля\", \"марта\", \"апреля\", \"мая\", \"июня\", \"июля\", \"августа\", \"сентября\", \"октября\", \"ноября\", \"декабря\"],\n shortMonths: [\"янв\", \"фев\", \"мар\", \"апр\", \"май\", \"июн\", \"июл\", \"авг\", \"сен\", \"окт\", \"ноя\", \"дек\"]\n };\n\n var ptBr = {\n dateTime: \"%A, %e de %B de %Y. %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Domingo\", \"Segunda\", \"Terça\", \"Quarta\", \"Quinta\", \"Sexta\", \"Sábado\"],\n shortDays: [\"Dom\", \"Seg\", \"Ter\", \"Qua\", \"Qui\", \"Sex\", \"Sáb\"],\n months: [\"Janeiro\", \"Fevereiro\", \"Março\", \"Abril\", \"Maio\", \"Junho\", \"Julho\", \"Agosto\", \"Setembro\", \"Outubro\", \"Novembro\", \"Dezembro\"],\n shortMonths: [\"Jan\", \"Fev\", \"Mar\", \"Abr\", \"Mai\", \"Jun\", \"Jul\", \"Ago\", \"Set\", \"Out\", \"Nov\", \"Dez\"]\n };\n\n var plPl = {\n dateTime: \"%A, %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Niedziela\", \"Poniedziałek\", \"Wtorek\", \"Środa\", \"Czwartek\", \"Piątek\", \"Sobota\"],\n shortDays: [\"Niedz.\", \"Pon.\", \"Wt.\", \"Śr.\", \"Czw.\", \"Pt.\", \"Sob.\"],\n months: [\"Styczeń\", \"Luty\", \"Marzec\", \"Kwiecień\", \"Maj\", \"Czerwiec\", \"Lipiec\", \"Sierpień\", \"Wrzesień\", \"Październik\", \"Listopad\", \"Grudzień\"],\n shortMonths: [\"Stycz.\", \"Luty\", \"Marz.\", \"Kwie.\", \"Maj\", \"Czerw.\", \"Lipc.\", \"Sierp.\", \"Wrz.\", \"Paźdz.\", \"Listop.\", \"Grudz.\"]/* In Polish language abbraviated months are not commonly used so there is a dispute about the proper abbraviations. */\n };\n\n var nlNl = {\n dateTime: \"%a %e %B %Y %T\",\n date: \"%d-%m-%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"zondag\", \"maandag\", \"dinsdag\", \"woensdag\", \"donderdag\", \"vrijdag\", \"zaterdag\"],\n shortDays: [\"zo\", \"ma\", \"di\", \"wo\", \"do\", \"vr\", \"za\"],\n months: [\"januari\", \"februari\", \"maart\", \"april\", \"mei\", \"juni\", \"juli\", \"augustus\", \"september\", \"oktober\", \"november\", \"december\"],\n shortMonths: [\"jan\", \"feb\", \"mrt\", \"apr\", \"mei\", \"jun\", \"jul\", \"aug\", \"sep\", \"okt\", \"nov\", \"dec\"]\n };\n\n var mkMk = {\n dateTime: \"%A, %e %B %Y г. %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"недела\", \"понеделник\", \"вторник\", \"среда\", \"четврток\", \"петок\", \"сабота\"],\n shortDays: [\"нед\", \"пон\", \"вто\", \"сре\", \"чет\", \"пет\", \"саб\"],\n months: [\"јануари\", \"февруари\", \"март\", \"април\", \"мај\", \"јуни\", \"јули\", \"август\", \"септември\", \"октомври\", \"ноември\", \"декември\"],\n shortMonths: [\"јан\", \"фев\", \"мар\", \"апр\", \"мај\", \"јун\", \"јул\", \"авг\", \"сеп\", \"окт\", \"ное\", \"дек\"]\n };\n\n var jaJp = {\n dateTime: \"%Y %b %e %a %X\",\n date: \"%Y/%m/%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"日曜日\", \"月曜日\", \"火曜日\", \"水曜日\", \"木曜日\", \"金曜日\", \"土曜日\"],\n shortDays: [\"日\", \"月\", \"火\", \"水\", \"木\", \"金\", \"土\"],\n months: [\"睦月\", \"如月\", \"弥生\", \"卯月\", \"皐月\", \"水無月\", \"文月\", \"葉月\", \"長月\", \"神無月\", \"霜月\", \"師走\"],\n shortMonths: [\"1月\", \"2月\", \"3月\", \"4月\", \"5月\", \"6月\", \"7月\", \"8月\", \"9月\", \"10月\", \"11月\", \"12月\"]\n };\n\n var itIt = {\n dateTime: \"%A %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Domenica\", \"Lunedì\", \"Martedì\", \"Mercoledì\", \"Giovedì\", \"Venerdì\", \"Sabato\"],\n shortDays: [\"Dom\", \"Lun\", \"Mar\", \"Mer\", \"Gio\", \"Ven\", \"Sab\"],\n months: [\"Gennaio\", \"Febbraio\", \"Marzo\", \"Aprile\", \"Maggio\", \"Giugno\", \"Luglio\", \"Agosto\", \"Settembre\", \"Ottobre\", \"Novembre\", \"Dicembre\"],\n shortMonths: [\"Gen\", \"Feb\", \"Mar\", \"Apr\", \"Mag\", \"Giu\", \"Lug\", \"Ago\", \"Set\", \"Ott\", \"Nov\", \"Dic\"]\n };\n\n var heIl = {\n dateTime: \"%A, %e ב%B %Y %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"ראשון\", \"שני\", \"שלישי\", \"רביעי\", \"חמישי\", \"שישי\", \"שבת\"],\n shortDays: [\"א׳\", \"ב׳\", \"ג׳\", \"ד׳\", \"ה׳\", \"ו׳\", \"ש׳\"],\n months: [\"ינואר\", \"פברואר\", \"מרץ\", \"אפריל\", \"מאי\", \"יוני\", \"יולי\", \"אוגוסט\", \"ספטמבר\", \"אוקטובר\", \"נובמבר\", \"דצמבר\"],\n shortMonths: [\"ינו׳\", \"פבר׳\", \"מרץ\", \"אפר׳\", \"מאי\", \"יוני\", \"יולי\", \"אוג׳\", \"ספט׳\", \"אוק׳\", \"נוב׳\", \"דצמ׳\"]\n };\n\n var frFr = {\n dateTime: \"%A, le %e %B %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim.\", \"lun.\", \"mar.\", \"mer.\", \"jeu.\", \"ven.\", \"sam.\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"janv.\", \"févr.\", \"mars\", \"avr.\", \"mai\", \"juin\", \"juil.\", \"août\", \"sept.\", \"oct.\", \"nov.\", \"déc.\"]\n };\n\n var frCa = {\n dateTime: \"%a %e %b %Y %X\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"\", \"\"],\n days: [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"],\n shortDays: [\"dim\", \"lun\", \"mar\", \"mer\", \"jeu\", \"ven\", \"sam\"],\n months: [\"janvier\", \"février\", \"mars\", \"avril\", \"mai\", \"juin\", \"juillet\", \"août\", \"septembre\", \"octobre\", \"novembre\", \"décembre\"],\n shortMonths: [\"jan\", \"fév\", \"mar\", \"avr\", \"mai\", \"jui\", \"jul\", \"aoû\", \"sep\", \"oct\", \"nov\", \"déc\"]\n };\n\n var fiFi = {\n dateTime: \"%A, %-d. %Bta %Y klo %X\",\n date: \"%-d.%-m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"a.m.\", \"p.m.\"],\n days: [\"sunnuntai\", \"maanantai\", \"tiistai\", \"keskiviikko\", \"torstai\", \"perjantai\", \"lauantai\"],\n shortDays: [\"Su\", \"Ma\", \"Ti\", \"Ke\", \"To\", \"Pe\", \"La\"],\n months: [\"tammikuu\", \"helmikuu\", \"maaliskuu\", \"huhtikuu\", \"toukokuu\", \"kesäkuu\", \"heinäkuu\", \"elokuu\", \"syyskuu\", \"lokakuu\", \"marraskuu\", \"joulukuu\"],\n shortMonths: [\"Tammi\", \"Helmi\", \"Maalis\", \"Huhti\", \"Touko\", \"Kesä\", \"Heinä\", \"Elo\", \"Syys\", \"Loka\", \"Marras\", \"Joulu\"]\n };\n\n var esEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"domingo\", \"lunes\", \"martes\", \"miércoles\", \"jueves\", \"viernes\", \"sábado\"],\n shortDays: [\"dom\", \"lun\", \"mar\", \"mié\", \"jue\", \"vie\", \"sáb\"],\n months: [\"enero\", \"febrero\", \"marzo\", \"abril\", \"mayo\", \"junio\", \"julio\", \"agosto\", \"septiembre\", \"octubre\", \"noviembre\", \"diciembre\"],\n shortMonths: [\"ene\", \"feb\", \"mar\", \"abr\", \"may\", \"jun\", \"jul\", \"ago\", \"sep\", \"oct\", \"nov\", \"dic\"]\n };\n\n var enUs = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%m/%d/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enGb = {\n dateTime: \"%a %e %b %X %Y\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var enCa = {\n dateTime: \"%a %b %e %X %Y\",\n date: \"%Y-%m-%d\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n };\n\n var deDe = {\n dateTime: \"%A, der %e. %B %Y, %X\",\n date: \"%d.%m.%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"], // unused\n days: [\"Sonntag\", \"Montag\", \"Dienstag\", \"Mittwoch\", \"Donnerstag\", \"Freitag\", \"Samstag\"],\n shortDays: [\"So\", \"Mo\", \"Di\", \"Mi\", \"Do\", \"Fr\", \"Sa\"],\n months: [\"Januar\", \"Februar\", \"März\", \"April\", \"Mai\", \"Juni\", \"Juli\", \"August\", \"September\", \"Oktober\", \"November\", \"Dezember\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mrz\", \"Apr\", \"Mai\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Okt\", \"Nov\", \"Dez\"]\n };\n\n var caEs = {\n dateTime: \"%A, %e de %B de %Y, %X\",\n date: \"%d/%m/%Y\",\n time: \"%H:%M:%S\",\n periods: [\"AM\", \"PM\"],\n days: [\"diumenge\", \"dilluns\", \"dimarts\", \"dimecres\", \"dijous\", \"divendres\", \"dissabte\"],\n shortDays: [\"dg.\", \"dl.\", \"dt.\", \"dc.\", \"dj.\", \"dv.\", \"ds.\"],\n months: [\"gener\", \"febrer\", \"març\", \"abril\", \"maig\", \"juny\", \"juliol\", \"agost\", \"setembre\", \"octubre\", \"novembre\", \"desembre\"],\n shortMonths: [\"gen.\", \"febr.\", \"març\", \"abr.\", \"maig\", \"juny\", \"jul.\", \"ag.\", \"set.\", \"oct.\", \"nov.\", \"des.\"]\n };\n\n var t0 = new Date;\n var t1 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n var sunday = weekday(0);\n var monday = weekday(1);\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n var utcSunday = utcWeekday(0);\n var utcMonday = utcWeekday(1);\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n function localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n }\n\n function utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n }\n\n function newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n }\n\n function locale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"S\": formatSeconds,\n \"U\": formatWeekNumberSunday,\n \"w\": formatWeekdayNumber,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"S\": formatUTCSeconds,\n \"U\": formatUTCWeekNumberSunday,\n \"w\": formatUTCWeekdayNumber,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"S\": parseSeconds,\n \"U\": parseWeekNumberSunday,\n \"w\": parseWeekdayNumber,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n if (format = formats[c]) c = format(date, pad == null ? (c === \"e\" ? \" \" : \"0\") : pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string, 0);\n if (i != string.length) return null;\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = utcDate(newYear(d.y)).getUTCDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n if (\"w\" in d && (\"W\" in d || \"U\" in d)) {\n var day = newDate(newYear(d.y)).getDay();\n if (\"W\" in d) d.U = d.W, d.w = (d.w + 6) % 7, --day;\n d.m = 0;\n d.d = d.w + d.U * 7 - (day + 6) % 7;\n }\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function parsePeriod(d, string, i) {\n var n = periodLookup.get(string.slice(i, i += 2).toLowerCase());\n return n == null ? -1 : (d.p = n, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.parse = newParse(specifier, localDate);\n f.toString = function() { return specifier; };\n return f;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.parse = newParse(specifier, utcDate);\n f.toString = function() { return specifier; };\n return f;\n }\n };\n }\n\n var pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"};\n var numberRe = /^\\s*\\d+/;\n var percentRe = /^%/;\n var requoteRe = /[\\\\\\^\\$\\*\\+\\?\\|\\[\\]\\(\\)\\.\\{\\}]/g;\n\n function pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n }\n\n function requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n }\n\n function formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n }\n\n function formatLookup(names) {\n var map = new Map, i = -1, n = names.length;\n while (++i < n) map.set(names[i].toLowerCase(), i);\n return map;\n }\n\n function parseWeekdayNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n }\n\n function parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n }\n\n function parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n }\n\n function parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n }\n\n function parseZone(d, string, i) {\n return /^[+-]\\d{4}$/.test(string = string.slice(i, i + 5))\n ? (d.Z = -string, i + 5) // sign differs from getTimezoneOffset!\n : -1;\n }\n\n function parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n }\n\n function parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n }\n\n function parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n }\n\n function parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n }\n\n function parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n }\n\n function parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n }\n\n function parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n }\n\n function formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n }\n\n function formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n }\n\n function formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n }\n\n function formatDayOfYear(d, p) {\n return pad(1 + day.count(year(d), d), p, 3);\n }\n\n function formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n }\n\n function formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n }\n\n function formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n }\n\n function formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n }\n\n function formatWeekNumberSunday(d, p) {\n return pad(sunday.count(year(d), d), p, 2);\n }\n\n function formatWeekdayNumber(d) {\n return d.getDay();\n }\n\n function formatWeekNumberMonday(d, p) {\n return pad(monday.count(year(d), d), p, 2);\n }\n\n function formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n }\n\n function formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n }\n\n function formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n }\n\n function formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n }\n\n function formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n }\n\n function formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n }\n\n function formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n }\n\n function formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n }\n\n function formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n }\n\n function formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n }\n\n function formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n }\n\n function formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCWeekdayNumber(d) {\n return d.getUTCDay();\n }\n\n function formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n }\n\n function formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n }\n\n function formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n }\n\n function formatUTCZone() {\n return \"+0000\";\n }\n\n function formatLiteralPercent() {\n return \"%\";\n }\n\n var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\n function formatIsoNative(date) {\n return date.toISOString();\n }\n\n formatIsoNative.parse = function(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n };\n\n formatIsoNative.toString = function() {\n return isoSpecifier;\n };\n\n var formatIso = Date.prototype.toISOString && +new Date(\"2000-01-01T00:00:00.000Z\")\n ? formatIsoNative\n : enUs.utcFormat(isoSpecifier);\n\n var isoFormat = formatIso;\n\n var localeDefinitions = (new Map)\n .set(\"ca-ES\", caEs)\n .set(\"de-DE\", deDe)\n .set(\"en-CA\", enCa)\n .set(\"en-GB\", enGb)\n .set(\"en-US\", enUs)\n .set(\"es-ES\", esEs)\n .set(\"fi-FI\", fiFi)\n .set(\"fr-CA\", frCa)\n .set(\"fr-FR\", frFr)\n .set(\"he-IL\", heIl)\n .set(\"it-IT\", itIt)\n .set(\"ja-JP\", jaJp)\n .set(\"mk-MK\", mkMk)\n .set(\"nl-NL\", nlNl)\n .set(\"pl-PL\", plPl)\n .set(\"pt-BR\", ptBr)\n .set(\"ru-RU\", ruRu)\n .set(\"zh-CN\", zhCn);\n\n var defaultLocale = locale(enUs);\n exports.format = defaultLocale.format;\n exports.utcFormat = defaultLocale.utcFormat;\n\n function localeFormat(definition) {\n if (typeof definition === \"string\") {\n definition = localeDefinitions.get(definition);\n if (!definition) return null;\n }\n return locale(definition);\n }\n ;\n\n exports.localeFormat = localeFormat;\n exports.isoFormat = isoFormat;\n\n}));","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n factory((global.time = {}));\n}(this, function (exports) { 'use strict';\n\n var t1 = new Date;\n\n var t0 = new Date;\n\n function newInterval(floori, offseti, count) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.round = function(date) {\n var d0 = new Date(+date),\n d1 = new Date(date - 1);\n floori(d0), floori(d1), offseti(d1, 1);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), date;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [];\n start = new Date(start - 1);\n stop = new Date(+stop);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n offseti(start, 1), floori(start);\n if (start < stop) range.push(new Date(+start));\n while (offseti(start, step), floori(start), start < stop) range.push(new Date(+start));\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n while (--step >= 0) while (offseti(date, 1), !test(date));\n });\n };\n\n if (count) interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n return interval;\n }\n\n var second = newInterval(function(date) {\n date.setMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.seconds = second.range;\n\n var minute = newInterval(function(date) {\n date.setSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.minutes = minute.range;\n\n var hour = newInterval(function(date) {\n date.setMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.hours = hour.range;\n\n var day = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 864e5;\n });\n\n exports.days = day.range;\n\n function weekday(i) {\n return newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * 6e4) / 6048e5;\n });\n }\n\n exports.sunday = weekday(0);\n\n exports.sundays = exports.sunday.range;\n\n exports.monday = weekday(1);\n\n exports.mondays = exports.monday.range;\n\n exports.tuesday = weekday(2);\n\n exports.tuesdays = exports.tuesday.range;\n\n exports.wednesday = weekday(3);\n\n exports.wednesdays = exports.wednesday.range;\n\n exports.thursday = weekday(4);\n\n exports.thursdays = exports.thursday.range;\n\n exports.friday = weekday(5);\n\n exports.fridays = exports.friday.range;\n\n exports.saturday = weekday(6);\n\n exports.saturdays = exports.saturday.range;\n\n var week = exports.sunday;\n\n exports.weeks = week.range;\n\n var month = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setDate(1);\n }, function(date, step) {\n date.setMonth(date.getMonth() + step);\n }, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n });\n\n exports.months = month.range;\n\n var year = newInterval(function(date) {\n date.setHours(0, 0, 0, 0);\n date.setMonth(0, 1);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n }, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n });\n\n exports.years = year.range;\n\n var utcSecond = newInterval(function(date) {\n date.setUTCMilliseconds(0);\n }, function(date, step) {\n date.setTime(+date + step * 1e3);\n }, function(start, end) {\n return (end - start) / 1e3;\n });\n\n exports.utcSeconds = utcSecond.range;\n\n var utcMinute = newInterval(function(date) {\n date.setUTCSeconds(0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 6e4);\n }, function(start, end) {\n return (end - start) / 6e4;\n });\n\n exports.utcMinutes = utcMinute.range;\n\n var utcHour = newInterval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n }, function(date, step) {\n date.setTime(+date + step * 36e5);\n }, function(start, end) {\n return (end - start) / 36e5;\n });\n\n exports.utcHours = utcHour.range;\n\n var utcDay = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n }, function(start, end) {\n return (end - start) / 864e5;\n });\n\n exports.utcDays = utcDay.range;\n\n function utcWeekday(i) {\n return newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / 6048e5;\n });\n }\n\n exports.utcSunday = utcWeekday(0);\n\n exports.utcSundays = exports.utcSunday.range;\n\n exports.utcMonday = utcWeekday(1);\n\n exports.utcMondays = exports.utcMonday.range;\n\n exports.utcTuesday = utcWeekday(2);\n\n exports.utcTuesdays = exports.utcTuesday.range;\n\n exports.utcWednesday = utcWeekday(3);\n\n exports.utcWednesdays = exports.utcWednesday.range;\n\n exports.utcThursday = utcWeekday(4);\n\n exports.utcThursdays = exports.utcThursday.range;\n\n exports.utcFriday = utcWeekday(5);\n\n exports.utcFridays = exports.utcFriday.range;\n\n exports.utcSaturday = utcWeekday(6);\n\n exports.utcSaturdays = exports.utcSaturday.range;\n\n var utcWeek = exports.utcSunday;\n\n exports.utcWeeks = utcWeek.range;\n\n var utcMonth = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCDate(1);\n }, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n }, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n });\n\n exports.utcMonths = utcMonth.range;\n\n var utcYear = newInterval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCMonth(0, 1);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n }, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n });\n\n exports.utcYears = utcYear.range;\n\n exports.interval = newInterval;\n exports.second = second;\n exports.minute = minute;\n exports.hour = hour;\n exports.day = day;\n exports.week = week;\n exports.month = month;\n exports.year = year;\n exports.utcSecond = utcSecond;\n exports.utcMinute = utcMinute;\n exports.utcHour = utcHour;\n exports.utcDay = utcDay;\n exports.utcWeek = utcWeek;\n exports.utcMonth = utcMonth;\n exports.utcYear = utcYear;\n\n}));","var util = require('../util'),\n Measures = require('./measures'),\n Collector = require('./collector');\n\nfunction Aggregator() {\n this._cells = {};\n this._aggr = [];\n this._stream = false;\n}\n\nvar Flags = Aggregator.Flags = {\n ADD_CELL: 1,\n MOD_CELL: 2\n};\n\nvar proto = Aggregator.prototype;\n\n// Parameters\n\nproto.stream = function(v) {\n if (v == null) return this._stream;\n this._stream = !!v;\n this._aggr = [];\n return this;\n};\n\n// key accessor to use for streaming removes\nproto.key = function(key) {\n if (key == null) return this._key;\n this._key = util.$(key);\n return this;\n};\n\n// Input: array of objects of the form\n// {name: string, get: function}\nproto.groupby = function(dims) {\n this._dims = util.array(dims).map(function(d, i) {\n d = util.isString(d) ? {name: d, get: util.$(d)}\n : util.isFunction(d) ? {name: util.name(d) || d.name || ('_' + i), get: d}\n : (d.name && util.isFunction(d.get)) ? d : null;\n if (d == null) throw 'Invalid groupby argument: ' + d;\n return d;\n });\n return this.clear();\n};\n\n// Input: array of objects of the form\n// {name: string, ops: [string, ...]}\nproto.summarize = function(fields) {\n fields = summarize_args(fields);\n this._count = true;\n var aggr = (this._aggr = []),\n m, f, i, j, op, as, get;\n\n for (i=0; i 0) {\n // consolidate collector values\n if (cell.collect) {\n cell.data.values();\n }\n // update tuple properties\n for (i=0; i 0) {\n m[a[i]] -= 1;\n } else {\n x[j++] = a[i];\n }\n }\n } else if (k) {\n // has unique key field, so use that\n m = util.toMap(r, k);\n for (i=0, j=0, n=a.length; i 1 ? this.dev / (this.valid-1) : 0',\n req: ['mean'], idx: 1\n }),\n 'variancep': measure({\n name: 'variancep',\n set: 'this.valid > 1 ? this.dev / this.valid : 0',\n req: ['variance'], idx: 2\n }),\n 'stdev': measure({\n name: 'stdev',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0',\n req: ['variance'], idx: 2\n }),\n 'stdevp': measure({\n name: 'stdevp',\n set: 'this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0',\n req: ['variance'], idx: 2\n }),\n 'median': measure({\n name: 'median',\n set: 'cell.data.q2(this.get)',\n req: ['values'], idx: 3\n }),\n 'q1': measure({\n name: 'q1',\n set: 'cell.data.q1(this.get)',\n req: ['values'], idx: 3\n }),\n 'q3': measure({\n name: 'q3',\n set: 'cell.data.q3(this.get)',\n req: ['values'], idx: 3\n }),\n 'distinct': measure({\n name: 'distinct',\n set: 'this.distinct(cell.data.values(), this.get)',\n req: ['values'], idx: 3\n }),\n 'argmin': measure({\n name: 'argmin',\n add: 'if (v < this.min) this.argmin = t;',\n rem: 'if (v <= this.min) this.argmin = null;',\n set: 'this.argmin = this.argmin || cell.data.argmin(this.get)',\n req: ['min'], str: ['values'], idx: 3\n }),\n 'argmax': measure({\n name: 'argmax',\n add: 'if (v > this.max) this.argmax = t;',\n rem: 'if (v >= this.max) this.argmax = null;',\n set: 'this.argmax = this.argmax || cell.data.argmax(this.get)',\n req: ['max'], str: ['values'], idx: 3\n }),\n 'min': measure({\n name: 'min',\n init: 'this.min = +Infinity;',\n add: 'if (v < this.min) this.min = v;',\n rem: 'if (v <= this.min) this.min = NaN;',\n set: 'this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)',\n str: ['values'], idx: 4\n }),\n 'max': measure({\n name: 'max',\n init: 'this.max = -Infinity;',\n add: 'if (v > this.max) this.max = v;',\n rem: 'if (v >= this.max) this.max = NaN;',\n set: 'this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)',\n str: ['values'], idx: 4\n }),\n 'modeskew': measure({\n name: 'modeskew',\n set: 'this.dev===0 ? 0 : (this.mean - cell.data.q2(this.get)) / Math.sqrt(this.dev/(this.valid-1))',\n req: ['mean', 'stdev', 'median'], idx: 5\n })\n};\n\nfunction measure(base) {\n return function(out) {\n var m = util.extend({init:'', add:'', rem:'', idx:0}, base);\n m.out = out || base.name;\n return m;\n };\n}\n\nfunction resolve(agg, stream) {\n function collect(m, a) {\n function helper(r) { if (!m[r]) collect(m, m[r] = types[r]()); }\n if (a.req) a.req.forEach(helper);\n if (stream && a.str) a.str.forEach(helper);\n return m;\n }\n var map = agg.reduce(\n collect,\n agg.reduce(function(m, a) { return (m[a.name] = a, m); }, {})\n );\n return util.vals(map).sort(function(a, b) { return a.idx - b.idx; });\n}\n\nfunction create(agg, stream, accessor, mutator) {\n var all = resolve(agg, stream),\n ctr = 'this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;',\n add = 'if (v==null) this.missing++; if (!this.isValid(v)) return; ++this.valid;',\n rem = 'if (v==null) this.missing--; if (!this.isValid(v)) return; --this.valid;',\n set = 'var t = this.tuple; var cell = this.cell;';\n\n all.forEach(function(a) {\n if (a.idx < 0) {\n ctr = a.init + ctr;\n add = a.add + add;\n rem = a.rem + rem;\n } else {\n ctr += a.init;\n add += a.add;\n rem += a.rem;\n }\n });\n agg.slice()\n .sort(function(a, b) { return a.idx - b.idx; })\n .forEach(function(a) {\n set += 'this.assign(t,\\''+a.out+'\\','+a.set+');';\n });\n set += 'return t;';\n\n /* jshint evil: true */\n ctr = Function('cell', 't', ctr);\n ctr.prototype.assign = mutator;\n ctr.prototype.add = Function('t', 'var v = this.get(t);' + add);\n ctr.prototype.rem = Function('t', 'var v = this.get(t);' + rem);\n ctr.prototype.set = Function(set);\n ctr.prototype.get = accessor;\n ctr.prototype.distinct = require('../stats').count.distinct;\n ctr.prototype.isValid = util.isValid;\n ctr.fields = agg.map(util.$('out'));\n return ctr;\n}\n\ntypes.create = create;\nmodule.exports = types;","var util = require('../util'),\n time = require('../time'),\n EPSILON = 1e-15;\n\nfunction bins(opt) {\n if (!opt) { throw Error(\"Missing binning options.\"); }\n\n // determine range\n var maxb = opt.maxbins || 15,\n base = opt.base || 10,\n logb = Math.log(base),\n div = opt.div || [5, 2], \n min = opt.min,\n max = opt.max,\n span = max - min,\n step, level, minstep, precision, v, i, eps;\n\n if (opt.step) {\n // if step size is explicitly given, use that\n step = opt.step;\n } else if (opt.steps) {\n // if provided, limit choice to acceptable step sizes\n step = opt.steps[Math.min(\n opt.steps.length - 1,\n bisect(opt.steps, span/maxb, 0, opt.steps.length)\n )];\n } else {\n // else use span to determine step size\n level = Math.ceil(Math.log(maxb) / logb);\n minstep = opt.minstep || 0;\n step = Math.max(\n minstep,\n Math.pow(base, Math.round(Math.log(span) / logb) - level)\n );\n \n // increase step size if too many bins\n do { step *= base; } while (Math.ceil(span/step) > maxb);\n\n // decrease step size if allowed\n for (i=0; i= minstep && span / v <= maxb) step = v;\n }\n }\n\n // update precision, min and max\n v = Math.log(step);\n precision = v >= 0 ? 0 : ~~(-v / logb) + 1;\n eps = Math.pow(base, -precision - 1);\n min = Math.min(min, Math.floor(min / step + eps) * step);\n max = Math.ceil(max / step) * step;\n\n return {\n start: min,\n stop: max,\n step: step,\n unit: {precision: precision},\n value: value,\n index: index\n };\n}\n\nfunction bisect(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (util.cmp(a[mid], x) < 0) { lo = mid + 1; }\n else { hi = mid; }\n }\n return lo;\n}\n\nfunction value(v) {\n return this.step * Math.floor(v / this.step + EPSILON);\n}\n\nfunction index(v) {\n return Math.floor((v - this.start) / this.step + EPSILON);\n}\n\nfunction date_value(v) {\n return this.unit.date(value.call(this, v));\n}\n\nfunction date_index(v) {\n return index.call(this, this.unit.unit(v));\n}\n\nbins.date = function(opt) {\n if (!opt) { throw Error(\"Missing date binning options.\"); }\n\n // find time step, then bin\n var units = opt.utc ? time.utc : time,\n dmin = opt.min,\n dmax = opt.max,\n maxb = opt.maxbins || 20,\n minb = opt.minbins || 4,\n span = (+dmax) - (+dmin),\n unit = opt.unit ? units[opt.unit] : units.find(span, minb, maxb),\n spec = bins({\n min: unit.min != null ? unit.min : unit.unit(dmin),\n max: unit.max != null ? unit.max : unit.unit(dmax),\n maxbins: maxb,\n minstep: unit.minstep,\n steps: unit.step\n });\n\n spec.unit = unit;\n spec.index = date_index;\n if (!opt.raw) spec.value = date_value;\n return spec;\n};\n\nmodule.exports = bins;\n","var bins = require('./bins'),\n gen = require('../generate'),\n type = require('../import/type'),\n util = require('../util'),\n stats = require('../stats');\n\nvar qtype = {\n 'integer': 1,\n 'number': 1,\n 'date': 1\n};\n\nfunction $bin(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return !b ? (opt.accessor || util.identity) :\n util.$func('bin', b.unit.unit ?\n function(x) { return b.value(b.unit.unit(x)); } :\n function(x) { return b.value(x); }\n )(opt.accessor);\n}\n\nfunction histogram(values, f, opt) {\n opt = options(values, f, opt);\n var b = spec(opt);\n return b ?\n numerical(values, opt.accessor, b) :\n categorical(values, opt.accessor, opt && opt.sort);\n}\n\nfunction spec(opt) {\n var t = opt.type, b = null;\n if (t == null || qtype[t]) {\n if (t === 'integer' && opt.minstep == null) opt.minstep = 1;\n b = (t === 'date') ? bins.date(opt) : bins(opt);\n }\n return b;\n}\n\nfunction options() {\n var a = arguments,\n i = 0,\n values = util.isArray(a[i]) ? a[i++] : null,\n f = util.isFunction(a[i]) || util.isString(a[i]) ? util.$(a[i++]) : null,\n opt = util.extend({}, a[i]);\n \n if (values) {\n opt.type = opt.type || type(values, f);\n if (qtype[opt.type]) {\n var ext = stats.extent(values, f);\n opt = util.extend({min: ext[0], max: ext[1]}, opt);\n }\n }\n if (f) { opt.accessor = f; }\n return opt;\n}\n\nfunction numerical(values, f, b) {\n var h = gen.range(b.start, b.stop + b.step/2, b.step)\n .map(function(v) { return {value: b.value(v), count: 0}; });\n\n for (var i=0, v, j; i= h.length || !isFinite(j)) continue;\n h[j].count += 1;\n }\n }\n h.bins = b;\n return h;\n}\n\nfunction categorical(values, f, sort) {\n var u = stats.unique(values, f),\n c = stats.count.map(values, f);\n return u.map(function(k) { return {value: k, count: c[k]}; })\n .sort(util.comparator(sort ? '-count' : '+value'));\n}\n\nmodule.exports = {\n $bin: $bin,\n histogram: histogram\n};","var d3_time = require('d3-time'),\n d3_timeF = require('d3-time-format'),\n d3_numberF = require('d3-format'),\n numberF = d3_numberF, // defaults to EN-US\n timeF = d3_timeF; // defaults to EN-US\n\nfunction numberLocale(l) {\n var f = d3_numberF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n numberF = f;\n}\n\nfunction timeLocale(l) {\n var f = d3_timeF.localeFormat(l);\n if (f == null) throw Error('Unrecognized locale: ' + l);\n timeF = f;\n}\n\nmodule.exports = {\n // Update number formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-format\n numberLocale: numberLocale,\n number: function(f) { return numberF.format(f); },\n numberPrefix: function(f, v) { return numberF.formatPrefix(f, v); },\n\n // Update time formatter to use provided locale configuration.\n // For more see https://github.com/d3/d3-time-format\n timeLocale: timeLocale,\n time: function(f) { return timeF.format(f); }, \n utc: function(f) { return timeF.utcFormat(f); },\n\n // Set number and time locale simultaneously.\n locale: function(l) { numberLocale(l); timeLocale(l); },\n\n // automatic formatting functions\n auto: {\n number: numberAutoFormat,\n time: function() { return timeAutoFormat(); },\n utc: function() { return utcAutoFormat(); }\n }\n};\n\nvar e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nfunction intervals(domain, count) {\n if (!domain.length) domain = [0];\n if (count == null) count = 10;\n\n var start = domain[0],\n stop = domain[domain.length - 1];\n\n if (stop < start) { error = stop; stop = start; start = error; }\n\n var span = (stop - start) || (count = 1, start || stop || 1),\n step = Math.pow(10, Math.floor(Math.log(span / count) / Math.LN10)),\n error = span / count / step;\n\n // Filter ticks to get closer to the desired count.\n if (error >= e10) step *= 10;\n else if (error >= e5) step *= 5;\n else if (error >= e2) step *= 2;\n\n // Round start and stop values to step interval.\n return [\n Math.ceil(start / step) * step,\n Math.floor(stop / step) * step + step / 2, // inclusive\n step\n ];\n}\n\nfunction numberAutoFormat(domain, count, f) {\n var range = intervals(domain, count);\n if (f == null) {\n f = ',.' + d3_numberF.precisionFixed(range[2]) + 'f';\n } else {\n switch (f = d3_numberF.formatSpecifier(f), f.type) {\n case 's': {\n var value = Math.max(Math.abs(range[0]), Math.abs(range[1]));\n if (f.precision == null) f.precision = d3_numberF.precisionPrefix(range[2], value);\n return numberF.formatPrefix(f, value);\n }\n case '':\n case 'e':\n case 'g':\n case 'p':\n case 'r': {\n if (f.precision == null) f.precision = d3_numberF.precisionRound(range[2], Math.max(Math.abs(range[0]), Math.abs(range[1]))) - (f.type === 'e');\n break;\n }\n case 'f':\n case '%': {\n if (f.precision == null) f.precision = d3_numberF.precisionFixed(range[2]) - (f.type === '%') * 2;\n break;\n }\n }\n }\n return numberF.format(f);\n}\n\nfunction timeAutoFormat() {\n var f = timeF.format,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.second(date) < d ? formatMillisecond\n : d3_time.minute(date) < d ? formatSecond\n : d3_time.hour(date) < d ? formatMinute\n : d3_time.day(date) < d ? formatHour\n : d3_time.month(date) < d ?\n (d3_time.week(date) < d ? formatDay : formatWeek)\n : d3_time.year(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n\nfunction utcAutoFormat() {\n var f = timeF.utcFormat,\n formatMillisecond = f('.%L'),\n formatSecond = f(':%S'),\n formatMinute = f('%I:%M'),\n formatHour = f('%I %p'),\n formatDay = f('%a %d'),\n formatWeek = f('%b %d'),\n formatMonth = f('%B'),\n formatYear = f('%Y');\n\n return function(date) {\n var d = +date;\n return (d3_time.utcSecond(date) < d ? formatMillisecond\n : d3_time.utcMinute(date) < d ? formatSecond\n : d3_time.utcHour(date) < d ? formatMinute\n : d3_time.utcDay(date) < d ? formatHour\n : d3_time.utcMonth(date) < d ?\n (d3_time.utcWeek(date) < d ? formatDay : formatWeek)\n : d3_time.utcYear(date) < d ? formatMonth\n : formatYear)(date);\n };\n}\n","var gen = module.exports = {};\n\ngen.repeat = function(val, n) {\n var a = Array(n), i;\n for (i=0; i stop) range.push(j);\n else while ((j = start + step * ++i) < stop) range.push(j);\n return range;\n};\n\ngen.random = {};\n\ngen.random.uniform = function(min, max) {\n if (max === undefined) {\n max = min === undefined ? 1 : min;\n min = 0;\n }\n var d = max - min;\n var f = function() {\n return min + d * Math.random();\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.integer = function(a, b) {\n if (b === undefined) {\n b = a;\n a = 0;\n }\n var d = b - a;\n var f = function() {\n return a + Math.floor(d * Math.random());\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};\n\ngen.random.normal = function(mean, stdev) {\n mean = mean || 0;\n stdev = stdev || 1;\n var next;\n var f = function() {\n var x = 0, y = 0, rds, c;\n if (next !== undefined) {\n x = next;\n next = undefined;\n return x;\n }\n do {\n x = Math.random()*2-1;\n y = Math.random()*2-1;\n rds = x*x + y*y;\n } while (rds === 0 || rds > 1);\n c = Math.sqrt(-2*Math.log(rds)/rds); // Box-Muller transform\n next = mean + y*c*stdev;\n return mean + x*c*stdev;\n };\n f.samples = function(n) { return gen.zeros(n).map(f); };\n return f;\n};","var util = require('../../util');\nvar d3_dsv = require('d3-dsv');\n\nfunction dsv(data, format) {\n if (data) {\n var h = format.header;\n data = (h ? h.join(format.delimiter) + '\\n' : '') + data;\n }\n return d3_dsv.dsv(format.delimiter).parse(data);\n}\n\ndsv.delimiter = function(delim) {\n var fmt = {delimiter: delim};\n return function(data, format) {\n return dsv(data, format ? util.extend(format, fmt) : fmt);\n };\n};\n\nmodule.exports = dsv;","var dsv = require('./dsv');\n\nmodule.exports = {\n json: require('./json'),\n topojson: require('./topojson'),\n treejson: require('./treejson'),\n dsv: dsv,\n csv: dsv.delimiter(','),\n tsv: dsv.delimiter('\\t')\n};","var util = require('../../util');\n\nmodule.exports = function(data, format) {\n var d = util.isObject(data) && !util.isBuffer(data) ?\n data : JSON.parse(data);\n if (format && format.property) {\n d = util.accessor(format.property)(d);\n }\n return d;\n};\n","var json = require('./json');\n\nvar reader = function(data, format) {\n var topojson = reader.topojson;\n if (topojson == null) { throw Error('TopoJSON library not loaded.'); }\n\n var t = json(data, format), obj;\n\n if (format && format.feature) {\n if ((obj = t.objects[format.feature])) {\n return topojson.feature(t, obj).features;\n } else {\n throw Error('Invalid TopoJSON object: ' + format.feature);\n }\n } else if (format && format.mesh) {\n if ((obj = t.objects[format.mesh])) {\n return [topojson.mesh(t, t.objects[format.mesh])];\n } else {\n throw Error('Invalid TopoJSON object: ' + format.mesh);\n }\n } else {\n throw Error('Missing TopoJSON feature or mesh parameter.');\n }\n};\n\nreader.topojson = (typeof window !== \"undefined\" ? window['topojson'] : typeof global !== \"undefined\" ? global['topojson'] : null);\nmodule.exports = reader;","var json = require('./json');\n\nmodule.exports = function(data, format) {\n data = json(data, format);\n return toTable(data, (format && format.children));\n};\n\nfunction toTable(root, childrenField) {\n childrenField = childrenField || 'children';\n var table = [];\n \n function visit(node) {\n table.push(node);\n var children = node[childrenField];\n if (children) {\n for (var i=0; i 1 && domain[idx-1] === '.' && domain.lastIndexOf(d) === idx);\n });\n if (!whiteListed) {\n throw 'URL is not whitelisted: ' + url;\n }\n }\n }\n return url;\n}\n\nfunction load(opt, callback) {\n var error = callback || function(e) { throw e; }, url;\n\n try {\n url = load.sanitizeUrl(opt); // enable override\n } catch (err) {\n error(err);\n return;\n }\n\n if (!url) {\n error('Invalid URL: ' + opt.url);\n } else if (load.useXHR) {\n // on client, use xhr\n return xhr(url, callback);\n } else if (startsWith(url, fileProtocol)) {\n // on server, if url starts with 'file://', strip it and load from file\n return file(url.slice(fileProtocol.length), callback);\n } else if (url.indexOf('://') < 0) { // TODO better protocol check?\n // on server, if no protocol assume file\n return file(url, callback);\n } else {\n // for regular URLs on server\n return http(url, callback);\n }\n}\n\nfunction xhrHasResponse(request) {\n var type = request.responseType;\n return type && type !== 'text' ?\n request.response : // null on error\n request.responseText; // '' on error\n}\n\nfunction xhr(url, callback) {\n var async = !!callback;\n var request = new XMLHttpRequest();\n // If IE does not support CORS, use XDomainRequest (copied from d3.xhr)\n if (this.XDomainRequest &&\n !('withCredentials' in request) &&\n /^(http(s)?:)?\\/\\//.test(url)) request = new XDomainRequest();\n\n function respond() {\n var status = request.status;\n if (!status && xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {\n callback(null, request.responseText);\n } else {\n callback(request, null);\n }\n }\n\n if (async) {\n if ('onload' in request) {\n request.onload = request.onerror = respond;\n } else {\n request.onreadystatechange = function() {\n if (request.readyState > 3) respond();\n };\n }\n }\n \n request.open('GET', url, async);\n request.send();\n \n if (!async && xhrHasResponse(request)) {\n return request.responseText;\n }\n}\n\nfunction file(filename, callback) {\n var fs = require('fs');\n if (!callback) {\n return fs.readFileSync(filename, 'utf8');\n }\n fs.readFile(filename, callback);\n}\n\nfunction http(url, callback) {\n if (!callback) {\n return require('sync-request')('GET', url).getBody();\n }\n \n var options = {url: url, encoding: null, gzip: true};\n require('request')(options, function(error, response, body) {\n if (!error && response.statusCode === 200) {\n callback(null, body);\n } else {\n error = error ||\n 'Load failed with response code ' + response.statusCode + '.';\n callback(error, null);\n }\n });\n}\n\nfunction startsWith(string, searchString) {\n return string == null ? false : string.lastIndexOf(searchString, 0) === 0;\n}\n\nload.sanitizeUrl = sanitizeUrl;\n\nload.useXHR = (typeof XMLHttpRequest !== 'undefined');\n\nmodule.exports = load;\n","var util = require('../util');\nvar type = require('./type');\nvar formats = require('./formats');\n\nfunction read(data, format) {\n var type = (format && format.type) || 'json';\n data = formats[type](data, format);\n if (format && format.parse) parse(data, format.parse);\n return data;\n}\n\nfunction parse(data, types) {\n var cols, parsers, d, i, j, clen, len = data.length;\n\n types = (types==='auto') ? type.inferAll(data) : util.duplicate(types);\n cols = util.keys(types);\n parsers = cols.map(function(c) { return type.parsers[types[c]]; });\n\n for (i=0, clen=cols.length; i 0 ? Math.min(l, opt.maxwidth) : l;\n });\n\n // print header row\n var head = fields.map(function(name, i) {\n return util.truncate(util.pad(name, lens[i], 'center'), lens[i]);\n }).join(opt.separator);\n\n // build template function for each row\n var tmpl = template(fields.map(function(name, i) {\n return '{{' +\n name +\n (FMT[types[name]] || '') +\n ('|pad:' + lens[i] + ',' + (POS[types[name]] || 'right')) +\n ('|truncate:' + lens[i]) +\n '}}';\n }).join(opt.separator));\n\n // print table\n return head + \"\\n\" + data.map(tmpl).join('\\n');\n};\n\nmodule.exports.summary = function(s) {\n s = s ? s.__summary__ ? s : stats.summary(s) : this;\n var str = [], i, n;\n for (i=0, n=s.length; i b) b = v;\n }\n }\n return [a, b];\n};\n\n// Find the integer indices of the minimum and maximum values.\nstats.extent.index = function(values, f) {\n f = util.$(f);\n var x = -1, y = -1, a, b, v, i, n = values.length;\n for (i=0; i b) { b = v; y = i; }\n }\n }\n return [x, y];\n};\n\n// Compute the dot product of two arrays of numbers.\nstats.dot = function(values, a, b) {\n var sum = 0, i, v;\n if (!b) {\n if (values.length !== a.length) {\n throw Error('Array lengths must match.');\n }\n for (i=0; i -1 && p !== v) {\n mu = 1 + (i-1 + tie) / 2;\n for (; tie -1) {\n mu = 1 + (n-1 + tie) / 2;\n for (; tie max) max = x;\n delta = x - mean;\n mean = mean + delta / (++valid);\n M2 = M2 + delta * (x - mean);\n vals.push(x);\n }\n }\n M2 = M2 / (valid - 1);\n sd = Math.sqrt(M2);\n\n // sort values for median and iqr\n vals.sort(util.cmp);\n\n return {\n type: type(values, f),\n unique: u,\n count: values.length,\n valid: valid,\n missing: missing,\n distinct: distinct,\n min: min,\n max: max,\n mean: mean,\n stdev: sd,\n median: (v = stats.quantile(vals, 0.5)),\n q1: stats.quantile(vals, 0.25),\n q3: stats.quantile(vals, 0.75),\n modeskew: sd === 0 ? 0 : (mean - v) / sd\n };\n};\n\n// Compute profiles for all variables in a data set.\nstats.summary = function(data, fields) {\n fields = fields || util.keys(data[0]);\n var s = fields.map(function(f) {\n var p = stats.profile(data, util.$(f));\n return (p.field = f, p);\n });\n return (s.__summary__ = true, s);\n};\n\nmodule.exports = stats;","var util = require('./util'),\n format = require('./format');\n\nvar context = {\n formats: [],\n format_map: {},\n truncate: util.truncate,\n pad: util.pad\n};\n\nfunction template(text) {\n var src = source(text, 'd');\n src = 'var __t; return ' + src + ';';\n\n /* jshint evil: true */\n return (new Function('d', src)).bind(context);\n}\n\ntemplate.source = source;\ntemplate.context = context;\nmodule.exports = template;\n\n// Clear cache of format objects.\n// This can *break* prior template functions, so invoke with care!\ntemplate.clearFormatCache = function() {\n context.formats = [];\n context.format_map = {};\n};\n\n// Generate property access code for use within template source.\n// object: the name of the object (variable) containing template data\n// property: the property access string, verbatim from template tag\ntemplate.property = function(object, property) {\n var src = util.field(property).map(util.str).join('][');\n return object + '[' + src + ']';\n};\n\n// Generate source code for a template function.\n// text: the template text\n// variable: the name of the data object variable ('obj' by default)\n// properties: optional hash for collecting all accessed properties\nfunction source(text, variable, properties) {\n variable = variable || 'obj';\n var index = 0;\n var src = '\\'';\n var regex = template_re;\n\n // Compile the template source, escaping string literals appropriately.\n text.replace(regex, function(match, interpolate, offset) {\n src += text\n .slice(index, offset)\n .replace(template_escaper, template_escapeChar);\n index = offset + match.length;\n\n if (interpolate) {\n src += '\\'\\n+((__t=(' +\n template_var(interpolate, variable, properties) +\n '))==null?\\'\\':__t)+\\n\\'';\n }\n\n // Adobe VMs need the match returned to produce the correct offest.\n return match;\n });\n return src + '\\'';\n}\n\nfunction template_var(text, variable, properties) {\n var filters = text.match(filter_re);\n var prop = filters.shift().trim();\n var stringCast = true;\n\n function strcall(fn) {\n fn = fn || '';\n if (stringCast) {\n stringCast = false;\n src = 'String(' + src + ')' + fn;\n } else {\n src += fn;\n }\n return src;\n }\n\n function date() {\n return '(typeof ' + src + '===\"number\"?new Date('+src+'):'+src+')';\n }\n\n function number_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+src+')';\n }\n \n function time_format(fmt, key) {\n a = template_format(args[0], key, fmt);\n stringCast = false;\n src = 'this.formats['+a+']('+date()+')';\n }\n\n if (properties) properties[prop] = 1;\n var src = template.property(variable, prop);\n\n for (var i=0; i 0) {\n f = f.slice(0, pidx);\n args = filters[i].slice(pidx+1)\n .match(args_re)\n .map(function(s) { return s.trim(); });\n }\n f = f.trim();\n\n switch (f) {\n case 'length':\n strcall('.length');\n break;\n case 'lower':\n strcall('.toLowerCase()');\n break;\n case 'upper':\n strcall('.toUpperCase()');\n break;\n case 'lower-locale':\n strcall('.toLocaleLowerCase()');\n break;\n case 'upper-locale':\n strcall('.toLocaleUpperCase()');\n break;\n case 'trim':\n strcall('.trim()');\n break;\n case 'left':\n a = util.number(args[0]);\n strcall('.slice(0,' + a + ')');\n break;\n case 'right':\n a = util.number(args[0]);\n strcall('.slice(-' + a +')');\n break;\n case 'mid':\n a = util.number(args[0]);\n b = a + util.number(args[1]);\n strcall('.slice(+'+a+','+b+')');\n break;\n case 'slice':\n a = util.number(args[0]);\n strcall('.slice('+ a +\n (args.length > 1 ? ',' + util.number(args[1]) : '') +\n ')');\n break;\n case 'truncate':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.truncate(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'pad':\n a = util.number(args[0]);\n b = args[1];\n b = (b!=='left' && b!=='middle' && b!=='center') ? 'right' : b;\n src = 'this.pad(' + strcall() + ',' + a + ',\\'' + b + '\\')';\n break;\n case 'number':\n number_format(format.number, 'number');\n break;\n case 'time':\n time_format(format.time, 'time');\n break;\n case 'time-utc':\n time_format(format.utc, 'time-utc');\n break;\n default:\n throw Error('Unrecognized template filter: ' + f);\n }\n }\n\n return src;\n}\n\nvar template_re = /\\{\\{(.+?)\\}\\}|$/g,\n filter_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^\\|\"]+|[^\\|\\']+)+/g,\n args_re = /(?:\"[^\"]*\"|\\'[^\\']*\\'|[^,\"]+|[^,\\']+)+/g;\n\n// Certain characters need to be escaped so that they can be put into a\n// string literal.\nvar template_escapes = {\n '\\'': '\\'',\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\nvar template_escaper = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\nfunction template_escapeChar(match) {\n return '\\\\' + template_escapes[match];\n}\n\nfunction template_format(pattern, key, fmt) {\n if ((pattern[0] === '\\'' && pattern[pattern.length-1] === '\\'') ||\n (pattern[0] === '\"' && pattern[pattern.length-1] === '\"')) {\n pattern = pattern.slice(1, -1);\n } else {\n throw Error('Format pattern must be quoted: ' + pattern);\n }\n key = key + ':' + pattern;\n if (!context.format_map[key]) {\n var f = fmt(pattern);\n var i = context.formats.length;\n context.formats.push(f);\n context.format_map[key] = i;\n }\n return context.format_map[key];\n}\n","var d3_time = require('d3-time');\n\nvar tempDate = new Date(),\n baseDate = new Date(0, 0, 1).setFullYear(0), // Jan 1, 0 AD\n utcBaseDate = new Date(Date.UTC(0, 0, 1)).setUTCFullYear(0);\n\nfunction date(d) {\n return (tempDate.setTime(+d), tempDate);\n}\n\n// create a time unit entry\nfunction entry(type, date, unit, step, min, max) {\n var e = {\n type: type,\n date: date,\n unit: unit\n };\n if (step) {\n e.step = step;\n } else {\n e.minstep = 1;\n }\n if (min != null) e.min = min;\n if (max != null) e.max = max;\n return e;\n}\n\nfunction create(type, unit, base, step, min, max) {\n return entry(type,\n function(d) { return unit.offset(base, d); },\n function(d) { return unit.count(base, d); },\n step, min, max);\n}\n\nvar locale = [\n create('second', d3_time.second, baseDate),\n create('minute', d3_time.minute, baseDate),\n create('hour', d3_time.hour, baseDate),\n create('day', d3_time.day, baseDate, [1, 7]),\n create('month', d3_time.month, baseDate, [1, 3, 6]),\n create('year', d3_time.year, baseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(1970, 0, 1, 0, 0, d); },\n function(d) { return date(d).getSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(1970, 0, 1, 0, d); },\n function(d) { return date(d).getMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(1970, 0, 1, d); },\n function(d) { return date(d).getHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(1970, 0, 4+d); },\n function(d) { return date(d).getDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(1970, 0, d); },\n function(d) { return date(d).getDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(1970, d % 12, 1); },\n function(d) { return date(d).getMonth(); },\n [1], 0, 11\n )\n];\n\nvar utc = [\n create('second', d3_time.utcSecond, utcBaseDate),\n create('minute', d3_time.utcMinute, utcBaseDate),\n create('hour', d3_time.utcHour, utcBaseDate),\n create('day', d3_time.utcDay, utcBaseDate, [1, 7]),\n create('month', d3_time.utcMonth, utcBaseDate, [1, 3, 6]),\n create('year', d3_time.utcYear, utcBaseDate),\n\n // periodic units\n entry('seconds',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, 0, d)); },\n function(d) { return date(d).getUTCSeconds(); },\n null, 0, 59\n ),\n entry('minutes',\n function(d) { return new Date(Date.UTC(1970, 0, 1, 0, d)); },\n function(d) { return date(d).getUTCMinutes(); },\n null, 0, 59\n ),\n entry('hours',\n function(d) { return new Date(Date.UTC(1970, 0, 1, d)); },\n function(d) { return date(d).getUTCHours(); },\n null, 0, 23\n ),\n entry('weekdays',\n function(d) { return new Date(Date.UTC(1970, 0, 4+d)); },\n function(d) { return date(d).getUTCDay(); },\n [1], 0, 6\n ),\n entry('dates',\n function(d) { return new Date(Date.UTC(1970, 0, d)); },\n function(d) { return date(d).getUTCDate(); },\n [1], 1, 31\n ),\n entry('months',\n function(d) { return new Date(Date.UTC(1970, d % 12, 1)); },\n function(d) { return date(d).getUTCMonth(); },\n [1], 0, 11\n )\n];\n\nvar STEPS = [\n [31536e6, 5], // 1-year\n [7776e6, 4], // 3-month\n [2592e6, 4], // 1-month\n [12096e5, 3], // 2-week\n [6048e5, 3], // 1-week\n [1728e5, 3], // 2-day\n [864e5, 3], // 1-day\n [432e5, 2], // 12-hour\n [216e5, 2], // 6-hour\n [108e5, 2], // 3-hour\n [36e5, 2], // 1-hour\n [18e5, 1], // 30-minute\n [9e5, 1], // 15-minute\n [3e5, 1], // 5-minute\n [6e4, 1], // 1-minute\n [3e4, 0], // 30-second\n [15e3, 0], // 15-second\n [5e3, 0], // 5-second\n [1e3, 0] // 1-second\n];\n\nfunction find(units, span, minb, maxb) {\n var step = STEPS[0], i, n, bins;\n\n for (i=1, n=STEPS.length; i step[0]) {\n bins = span / step[0];\n if (bins > maxb) {\n return units[STEPS[i-1][1]];\n }\n if (bins >= minb) {\n return units[step[1]];\n }\n }\n }\n return units[STEPS[n-1][1]];\n}\n\nfunction toUnitMap(units) {\n var map = {}, i, n;\n for (i=0, n=units.length; i 1 ?\n function(x) { return s.reduce(function(x,f) { return x[f]; }, x); } :\n function(x) { return x[f]; }\n );\n};\n\n// short-cut for accessor\nu.$ = u.accessor;\n\nu.mutator = function(f) {\n var s;\n return u.isString(f) && (s=u.field(f)).length > 1 ?\n function(x, v) {\n for (var i=0; i y) return sign[i];\n }\n return 0;\n };\n};\n\nu.cmp = function(a, b) {\n if (a < b) {\n return -1;\n } else if (a > b) {\n return 1;\n } else if (a >= b) {\n return 0;\n } else if (a === null) {\n return -1;\n } else if (b === null) {\n return 1;\n }\n return NaN;\n};\n\nu.numcmp = function(a, b) { return a - b; };\n\nu.stablesort = function(array, sortBy, keyFn) {\n var indices = array.reduce(function(idx, v, i) {\n return (idx[keyFn(v)] = i, idx);\n }, {});\n\n array.sort(function(a, b) {\n var sa = sortBy(a),\n sb = sortBy(b);\n return sa < sb ? -1 : sa > sb ? 1\n : (indices[keyFn(a)] - indices[keyFn(b)]);\n });\n\n return array;\n};\n\n\n// string functions\n\nu.pad = function(s, length, pos, padchar) {\n padchar = padchar || \" \";\n var d = length - s.length;\n if (d <= 0) return s;\n switch (pos) {\n case 'left':\n return strrep(d, padchar) + s;\n case 'middle':\n case 'center':\n return strrep(Math.floor(d/2), padchar) +\n s + strrep(Math.ceil(d/2), padchar);\n default:\n return s + strrep(d, padchar);\n }\n};\n\nfunction strrep(n, str) {\n var s = \"\", i;\n for (i=0; i 1) {\n for (var i=1, n=ref.length; i 0) {\n node = pq.peek();\n pulse = pulses[node._id];\n\n if (node.rank() !== node.qrank()) {\n // A node's rank might change during a propagation. Re-queue if so.\n pq.replace(node.qrank(true));\n } else {\n // Evaluate node and propagate pulse.\n pq.pop();\n pulses[node._id] = null;\n listeners = node._listeners;\n pulse = this.evaluate(pulse, node);\n\n // Propagate the pulse. \n if (pulse !== this.doNotPropagate) {\n // Ensure reflow pulses always send reflow pulses even if skipped.\n if (!pulse.reflow && node.reflows()) {\n pulse = ChangeSet.create(pulse, true);\n }\n\n for (i=0, len=listeners.length; i 0) branch[i-1].addListener(node);\n }\n\n return branch;\n};\n\nprototype.disconnect = function(branch) {\n var collector, node, data, signals, i, n, j, m;\n\n for (i=0, n=branch.length; i= pulse.stamp,\n run = node.router() || pulse.add.length || pulse.rem.length;\n\n return run || !reflowed || node.reevaluate(pulse);\n};\n\nprototype.evaluate = function(pulse, node) {\n if (!this.reevaluate(pulse, node)) return pulse;\n pulse = node.evaluate(pulse);\n node.last(pulse.stamp);\n return pulse;\n};\n\nmodule.exports = Graph;\n","function Heap(comparator) {\n this.cmp = comparator;\n this.nodes = [];\n}\n\nvar prototype = Heap.prototype;\n\nprototype.size = function() {\n return this.nodes.length;\n};\n\nprototype.clear = function() {\n return (this.nodes = [], this);\n};\n\nprototype.peek = function() {\n return this.nodes[0];\n};\n\nprototype.push = function(x) {\n var array = this.nodes;\n array.push(x);\n return _siftdown(array, 0, array.length-1, this.cmp);\n};\n\nprototype.pop = function() {\n var array = this.nodes,\n last = array.pop(),\n item;\n\n if (array.length) {\n item = array[0];\n array[0] = last;\n _siftup(array, 0, this.cmp);\n } else {\n item = last;\n }\n return item;\n};\n\nprototype.replace = function(item) {\n var array = this.nodes,\n retval = array[0];\n array[0] = item;\n _siftup(array, 0, this.cmp);\n return retval;\n};\n\nprototype.pushpop = function(item) {\n var array = this.nodes, ref = array[0];\n if (array.length && this.cmp(ref, item) < 0) {\n array[0] = item;\n item = ref;\n _siftup(array, 0, this.cmp);\n }\n return item;\n};\n\nfunction _siftdown(array, start, idx, cmp) {\n var item, parent, pidx;\n\n item = array[idx];\n while (idx > start) {\n pidx = (idx - 1) >> 1;\n parent = array[pidx];\n if (cmp(item, parent) < 0) {\n array[idx] = parent;\n idx = pidx;\n continue;\n }\n break;\n }\n return (array[idx] = item);\n}\n\nfunction _siftup(array, idx, cmp) {\n var start = idx,\n end = array.length,\n item = array[idx],\n cidx = 2 * idx + 1, ridx;\n\n while (cidx < end) {\n ridx = cidx + 1;\n if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) {\n cidx = ridx;\n }\n array[idx] = array[cidx];\n idx = cidx;\n cidx = 2 * idx + 1;\n }\n array[idx] = item;\n return _siftdown(array, start, idx, cmp);\n}\n\nmodule.exports = Heap;\n","var DEPS = require('./Dependencies').ALL,\n nodeID = 0;\n\nfunction Node(graph) {\n if (graph) this.init(graph);\n}\n\nvar Flags = Node.Flags = {\n Router: 0x01, // Responsible for propagating tuples, cannot be skipped.\n Collector: 0x02, // Holds a materialized dataset, pulse node to reflow.\n Produces: 0x04, // Produces new tuples. \n Mutates: 0x08, // Sets properties of incoming tuples.\n Reflows: 0x10, // Forwards a reflow pulse.\n Batch: 0x20 // Performs batch data processing, needs collector.\n};\n\nvar prototype = Node.prototype;\n\nprototype.init = function(graph) {\n this._id = ++nodeID;\n this._graph = graph;\n this._rank = graph.rank(); // Topological sort by rank\n this._qrank = null; // Rank when enqueued for propagation\n this._stamp = 0; // Last stamp seen\n\n this._listeners = [];\n this._listeners._ids = {}; // To prevent duplicate listeners\n\n // Initialize dependencies.\n this._deps = {};\n for (var i=0, n=DEPS.length; i l._rank) {\n var q = [l],\n g = this._graph, cur;\n while (q.length) {\n cur = q.shift();\n cur._rank = g.rank();\n q.unshift.apply(q, cur.listeners());\n }\n }\n\n return this;\n};\n\nprototype.removeListener = function(l) {\n if (!this._listeners._ids[l._id]) return false;\n \n var idx = this._listeners.indexOf(l),\n b = idx >= 0;\n\n if (b) {\n this._listeners.splice(idx, 1);\n this._listeners._ids[l._id] = null;\n }\n return b;\n};\n\nprototype.disconnect = function() {\n this._listeners = [];\n this._listeners._ids = {};\n};\n\n// Evaluate this dataflow node for the current pulse.\n// Subclasses should override to perform custom processing.\nprototype.evaluate = function(pulse) {\n return pulse;\n};\n\n// Should this node be re-evaluated for the current pulse?\n// Searches pulse to see if any dependencies have updated.\nprototype.reevaluate = function(pulse) {\n var prop, dep, i, n, j, m;\n\n for (i=0, n=DEPS.length; i=0;) {\n if (!handler || h[i].handler === handler) {\n x = h.splice(i, 1)[0];\n this.removeListener(x.node);\n }\n }\n\n return this;\n};\n\nmodule.exports = Signal;\n","var tupleID = 0;\n\nfunction ingest(datum) {\n datum = (datum === Object(datum)) ? datum : {data: datum};\n datum._id = ++tupleID;\n if (datum._prev) datum._prev = null;\n return datum;\n}\n\nfunction idMap(a, ids) {\n ids = ids || {};\n for (var i=0, n=a.length; i0;) {\n idMap(arguments[i], ids);\n }\n return data.filter(function(x) { return !ids[x._id]; });\n }\n};\n","module.exports = {\n ChangeSet: require('./ChangeSet'),\n Collector: require('./Collector'),\n DataSource: require('./DataSource'),\n Dependencies: require('./Dependencies'),\n Graph: require('./Graph'),\n Node: require('./Node'),\n Signal: require('./Signal'),\n Tuple: require('./Tuple'),\n debug: require('vega-logging').debug\n};\n","function toMap(list) {\n var map = {}, i, n;\n for (i=0, n=list.length; i 0) {\n return id;\n }\n if (constants.hasOwnProperty(id)) {\n return constants[id];\n }\n if (idWhiteList) {\n if (idWhiteList.hasOwnProperty(id)) {\n return id;\n } else {\n globals[id] = 1;\n return lookupGlobal(id);\n }\n }\n if (idBlackList && idBlackList.hasOwnProperty(id)) {\n throw new Error('Illegal identifier: ' + id);\n }\n return id;\n },\n 'Program': function(n) {\n return n.body.map(codegen).join('\\n');\n },\n 'MemberExpression': function(n) {\n var d = !n.computed;\n var o = codegen(n.object);\n if (d) memberDepth += 1;\n var p = codegen(n.property);\n if (o === FIELD_VAR) { fields[p] = 1; } // HACKish...\n if (d) memberDepth -= 1;\n return o + (d ? '.'+p : '['+p+']');\n },\n 'CallExpression': function(n) {\n if (n.callee.type !== 'Identifier') {\n throw new Error('Illegal callee type: ' + n.callee.type);\n }\n var callee = n.callee.name;\n var args = n.arguments;\n var fn = functions.hasOwnProperty(callee) && functions[callee];\n if (!fn) throw new Error('Unrecognized function: ' + callee);\n return fn instanceof Function ?\n fn(args) :\n fn + '(' + args.map(codegen).join(',') + ')';\n },\n 'ArrayExpression': function(n) {\n return '[' + n.elements.map(codegen).join(',') + ']';\n },\n 'BinaryExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'UnaryExpression': function(n) {\n return '(' + n.operator + codegen(n.argument) + ')';\n },\n 'ConditionalExpression': function(n) {\n return '(' + codegen(n.test) +\n '?' + codegen(n.consequent) +\n ':' + codegen(n.alternate) +\n ')';\n },\n 'LogicalExpression': function(n) {\n return '(' + codegen(n.left) + n.operator + codegen(n.right) + ')';\n },\n 'ObjectExpression': function(n) {\n return '{' + n.properties.map(codegen).join(',') + '}';\n },\n 'Property': function(n) {\n memberDepth += 1;\n var k = codegen(n.key);\n memberDepth -= 1;\n return k + ':' + codegen(n.value);\n },\n 'ExpressionStatement': function(n) {\n return codegen(n.expression);\n }\n };\n\n codegen_wrap.functions = functions;\n codegen_wrap.constants = constants;\n return codegen_wrap;\n};\n","module.exports = {\n 'NaN': 'NaN',\n 'E': 'Math.E',\n 'LN2': 'Math.LN2',\n 'LN10': 'Math.LN10',\n 'LOG2E': 'Math.LOG2E',\n 'LOG10E': 'Math.LOG10E',\n 'PI': 'Math.PI',\n 'SQRT1_2': 'Math.SQRT1_2',\n 'SQRT2': 'Math.SQRT2'\n};","module.exports = function(codegen) {\n\n function fncall(name, args, cast, type) {\n var obj = codegen(args[0]);\n if (cast) {\n obj = cast + '(' + obj + ')';\n if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')';\n }\n return obj + '.' + name + (type < 0 ? '' : type === 0 ?\n '()' :\n '(' + args.slice(1).map(codegen).join(',') + ')');\n }\n\n function fn(name, cast, type) {\n return function(args) {\n return fncall(name, args, cast, type);\n };\n }\n\n var DATE = 'new Date',\n STRING = 'String',\n REGEXP = 'RegExp';\n\n return {\n // MATH functions\n 'isNaN': 'isNaN',\n 'isFinite': 'isFinite',\n 'abs': 'Math.abs',\n 'acos': 'Math.acos',\n 'asin': 'Math.asin',\n 'atan': 'Math.atan',\n 'atan2': 'Math.atan2',\n 'ceil': 'Math.ceil',\n 'cos': 'Math.cos',\n 'exp': 'Math.exp',\n 'floor': 'Math.floor',\n 'log': 'Math.log',\n 'max': 'Math.max',\n 'min': 'Math.min',\n 'pow': 'Math.pow',\n 'random': 'Math.random',\n 'round': 'Math.round',\n 'sin': 'Math.sin',\n 'sqrt': 'Math.sqrt',\n 'tan': 'Math.tan',\n\n 'clamp': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to clamp function.');\n if (args.length > 3)\n throw new Error('Too many arguments to clamp function.');\n var a = args.map(codegen);\n return 'Math.max('+a[1]+', Math.min('+a[2]+','+a[0]+'))';\n },\n\n // DATE functions\n 'now': 'Date.now',\n 'datetime': DATE,\n 'date': fn('getDate', DATE, 0),\n 'day': fn('getDay', DATE, 0),\n 'year': fn('getFullYear', DATE, 0),\n 'month': fn('getMonth', DATE, 0),\n 'hours': fn('getHours', DATE, 0),\n 'minutes': fn('getMinutes', DATE, 0),\n 'seconds': fn('getSeconds', DATE, 0),\n 'milliseconds': fn('getMilliseconds', DATE, 0),\n 'time': fn('getTime', DATE, 0),\n 'timezoneoffset': fn('getTimezoneOffset', DATE, 0),\n 'utcdate': fn('getUTCDate', DATE, 0),\n 'utcday': fn('getUTCDay', DATE, 0),\n 'utcyear': fn('getUTCFullYear', DATE, 0),\n 'utcmonth': fn('getUTCMonth', DATE, 0),\n 'utchours': fn('getUTCHours', DATE, 0),\n 'utcminutes': fn('getUTCMinutes', DATE, 0),\n 'utcseconds': fn('getUTCSeconds', DATE, 0),\n 'utcmilliseconds': fn('getUTCMilliseconds', DATE, 0),\n\n // shared sequence functions\n 'length': fn('length', null, -1),\n 'indexof': fn('indexOf', null),\n 'lastindexof': fn('lastIndexOf', null),\n\n // STRING functions\n 'parseFloat': 'parseFloat',\n 'parseInt': 'parseInt',\n 'upper': fn('toUpperCase', STRING, 0),\n 'lower': fn('toLowerCase', STRING, 0),\n 'slice': fn('slice', STRING),\n 'substring': fn('substring', STRING),\n\n // REGEXP functions\n 'regexp': REGEXP,\n 'test': fn('test', REGEXP),\n\n // Control Flow functions\n 'if': function(args) {\n if (args.length < 3)\n throw new Error('Missing arguments to if function.');\n if (args.length > 3)\n throw new Error('Too many arguments to if function.');\n var a = args.map(codegen);\n return a[0]+'?'+a[1]+':'+a[2];\n }\n };\n};","var parser = require('./parser'),\n codegen = require('./codegen');\n \nvar expr = module.exports = {\n parse: function(input, opt) {\n return parser.parse('('+input+')', opt);\n },\n code: function(opt) {\n return codegen(opt);\n },\n compiler: function(args, opt) {\n args = args.slice();\n var generator = codegen(opt),\n len = args.length,\n compile = function(str) {\n var value = generator(expr.parse(str));\n args[len] = '\"use strict\"; return (' + value.code + ');';\n value.fn = Function.apply(null, args);\n return value;\n };\n compile.codegen = generator;\n return compile;\n },\n functions: require('./functions'),\n constants: require('./constants')\n};\n","/*\n The following expression parser is based on Esprima (http://esprima.org/).\n Original header comment and license for Esprima is included here:\n\n Copyright (C) 2013 Ariya Hidayat \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*/\n/* istanbul ignore next */\nmodule.exports = (function() {\n 'use strict';\n\n var Token,\n TokenName,\n Syntax,\n PropertyKind,\n Messages,\n Regex,\n source,\n strict,\n index,\n lineNumber,\n lineStart,\n length,\n lookahead,\n state,\n extra;\n\n Token = {\n BooleanLiteral: 1,\n EOF: 2,\n Identifier: 3,\n Keyword: 4,\n NullLiteral: 5,\n NumericLiteral: 6,\n Punctuator: 7,\n StringLiteral: 8,\n RegularExpression: 9\n };\n\n TokenName = {};\n TokenName[Token.BooleanLiteral] = 'Boolean';\n TokenName[Token.EOF] = '';\n TokenName[Token.Identifier] = 'Identifier';\n TokenName[Token.Keyword] = 'Keyword';\n TokenName[Token.NullLiteral] = 'Null';\n TokenName[Token.NumericLiteral] = 'Numeric';\n TokenName[Token.Punctuator] = 'Punctuator';\n TokenName[Token.StringLiteral] = 'String';\n TokenName[Token.RegularExpression] = 'RegularExpression';\n\n Syntax = {\n AssignmentExpression: 'AssignmentExpression',\n ArrayExpression: 'ArrayExpression',\n BinaryExpression: 'BinaryExpression',\n CallExpression: 'CallExpression',\n ConditionalExpression: 'ConditionalExpression',\n ExpressionStatement: 'ExpressionStatement',\n Identifier: 'Identifier',\n Literal: 'Literal',\n LogicalExpression: 'LogicalExpression',\n MemberExpression: 'MemberExpression',\n ObjectExpression: 'ObjectExpression',\n Program: 'Program',\n Property: 'Property',\n UnaryExpression: 'UnaryExpression'\n };\n\n PropertyKind = {\n Data: 1,\n Get: 2,\n Set: 4\n };\n\n // Error messages should be identical to V8.\n Messages = {\n UnexpectedToken: 'Unexpected token %0',\n UnexpectedNumber: 'Unexpected number',\n UnexpectedString: 'Unexpected string',\n UnexpectedIdentifier: 'Unexpected identifier',\n UnexpectedReserved: 'Unexpected reserved word',\n UnexpectedEOS: 'Unexpected end of input',\n NewlineAfterThrow: 'Illegal newline after throw',\n InvalidRegExp: 'Invalid regular expression',\n UnterminatedRegExp: 'Invalid regular expression: missing /',\n InvalidLHSInAssignment: 'Invalid left-hand side in assignment',\n InvalidLHSInForIn: 'Invalid left-hand side in for-in',\n MultipleDefaultsInSwitch: 'More than one default clause in switch statement',\n NoCatchOrFinally: 'Missing catch or finally after try',\n UnknownLabel: 'Undefined label \\'%0\\'',\n Redeclaration: '%0 \\'%1\\' has already been declared',\n IllegalContinue: 'Illegal continue statement',\n IllegalBreak: 'Illegal break statement',\n IllegalReturn: 'Illegal return statement',\n StrictModeWith: 'Strict mode code may not include a with statement',\n StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',\n StrictVarName: 'Variable name may not be eval or arguments in strict mode',\n StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',\n StrictParamDupe: 'Strict mode function may not have duplicate parameter names',\n StrictFunctionName: 'Function name may not be eval or arguments in strict mode',\n StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',\n StrictDelete: 'Delete of an unqualified identifier in strict mode.',\n StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',\n AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',\n AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',\n StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',\n StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',\n StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',\n StrictReservedWord: 'Use of future reserved word in strict mode'\n };\n\n // See also tools/generate-unicode-regex.py.\n Regex = {\n NonAsciiIdentifierStart: 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]'),\n NonAsciiIdentifierPart: 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-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\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]')\n };\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\n function assert(condition, message) {\n if (!condition) {\n throw new Error('ASSERT: ' + message);\n }\n }\n\n function isDecimalDigit(ch) {\n return (ch >= 0x30 && ch <= 0x39); // 0..9\n }\n\n function isHexDigit(ch) {\n return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;\n }\n\n function isOctalDigit(ch) {\n return '01234567'.indexOf(ch) >= 0;\n }\n\n // 7.2 White Space\n\n function 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\n function isLineTerminator(ch) {\n return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029);\n }\n\n // 7.6 Identifier Names and Identifiers\n\n function 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) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));\n }\n\n function 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) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));\n }\n\n // 7.6.1.2 Future Reserved Words\n\n function isFutureReservedWord(id) {\n switch (id) {\n case 'class':\n case 'enum':\n case 'export':\n case 'extends':\n case 'import':\n case 'super':\n return true;\n default:\n return false;\n }\n }\n\n function isStrictModeReservedWord(id) {\n switch (id) {\n case 'implements':\n case 'interface':\n case 'package':\n case 'private':\n case 'protected':\n case 'public':\n case 'static':\n case 'yield':\n case 'let':\n return true;\n default:\n return false;\n }\n }\n\n // 7.6.1.1 Keywords\n\n function isKeyword(id) {\n if (strict && isStrictModeReservedWord(id)) {\n return true;\n }\n\n // 'const' is specialized as Keyword in V8.\n // 'yield' and 'let' are for compatiblity with SpiderMonkey and ES.next.\n // Some others are from future reserved words.\n\n switch (id.length) {\n case 2:\n return (id === 'if') || (id === 'in') || (id === 'do');\n case 3:\n return (id === 'var') || (id === 'for') || (id === 'new') ||\n (id === 'try') || (id === 'let');\n case 4:\n return (id === 'this') || (id === 'else') || (id === 'case') ||\n (id === 'void') || (id === 'with') || (id === 'enum');\n case 5:\n return (id === 'while') || (id === 'break') || (id === 'catch') ||\n (id === 'throw') || (id === 'const') || (id === 'yield') ||\n (id === 'class') || (id === 'super');\n case 6:\n return (id === 'return') || (id === 'typeof') || (id === 'delete') ||\n (id === 'switch') || (id === 'export') || (id === 'import');\n case 7:\n return (id === 'default') || (id === 'finally') || (id === 'extends');\n case 8:\n return (id === 'function') || (id === 'continue') || (id === 'debugger');\n case 10:\n return (id === 'instanceof');\n default:\n return false;\n }\n }\n\n function skipComment() {\n var ch, start;\n\n start = (index === 0);\n while (index < length) {\n ch = source.charCodeAt(index);\n\n if (isWhiteSpace(ch)) {\n ++index;\n } else if (isLineTerminator(ch)) {\n ++index;\n if (ch === 0x0D && source.charCodeAt(index) === 0x0A) {\n ++index;\n }\n ++lineNumber;\n lineStart = index;\n start = true;\n } else {\n break;\n }\n }\n }\n\n function 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 return '';\n }\n }\n return String.fromCharCode(code);\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, '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\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierStart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n ++index;\n ch = scanHexEscape('u');\n if (!ch || ch === '\\\\' || !isIdentifierPart(ch.charCodeAt(0))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n id += ch;\n }\n }\n\n return id;\n }\n\n function 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\n function 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 = Token.Identifier;\n } else if (isKeyword(id)) {\n type = Token.Keyword;\n } else if (id === 'null') {\n type = Token.NullLiteral;\n } else if (id === 'true' || id === 'false') {\n type = Token.BooleanLiteral;\n } else {\n type = Token.Identifier;\n }\n\n return {\n type: type,\n value: id,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.7 Punctuators\n\n function 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 if (extra.tokenize) {\n if (code === 0x28) {\n extra.openParenToken = extra.tokens.length;\n } else if (code === 0x7B) {\n extra.openCurlyToken = extra.tokens.length;\n }\n }\n return {\n type: Token.Punctuator,\n value: String.fromCharCode(code),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: String.fromCharCode(code) + String.fromCharCode(code2),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: source.slice(start, index),\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch4,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch3,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch2,\n lineNumber: lineNumber,\n lineStart: lineStart,\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: Token.Punctuator,\n value: ch1,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n // 7.8.3 Numeric Literals\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt('0x' + number, 16),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseInt(number, 8),\n octal: true,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function 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({}, Messages.UnexpectedToken, '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({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n }\n\n if (isIdentifierStart(source.charCodeAt(index))) {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.NumericLiteral,\n value: parseFloat(number),\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n // 7.8.4 String Literals\n\n function scanStringLiteral() {\n var str = '', quote, start, ch, code, unescaped, restore, octal = false, startLineNumber, startLineStart;\n startLineNumber = lineNumber;\n startLineStart = lineStart;\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 restore = index;\n unescaped = scanHexEscape(ch);\n if (unescaped) {\n str += unescaped;\n } else {\n index = restore;\n str += ch;\n }\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 ++lineNumber;\n if (ch === '\\r' && source[index] === '\\n') {\n ++index;\n }\n lineStart = index;\n }\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n break;\n } else {\n str += ch;\n }\n }\n\n if (quote !== '') {\n throwError({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n\n return {\n type: Token.StringLiteral,\n value: str,\n octal: octal,\n startLineNumber: startLineNumber,\n startLineStart: startLineStart,\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\n\n function testRegExp(pattern, flags) {\n var tmp = pattern,\n value;\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({}, Messages.InvalidRegExp);\n })\n .replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g, 'x');\n }\n\n // First, detect invalid regular expressions.\n try {\n value = new RegExp(tmp);\n } catch (e) {\n throwError({}, Messages.InvalidRegExp);\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\n function 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({}, Messages.UnterminatedRegExp);\n }\n str += ch;\n } else if (isLineTerminator(ch.charCodeAt(0))) {\n throwError({}, Messages.UnterminatedRegExp);\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({}, Messages.UnterminatedRegExp);\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\n function scanRegExpFlags() {\n var ch, str, flags, restore;\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 ch = source[index];\n if (ch === 'u') {\n ++index;\n restore = index;\n ch = scanHexEscape('u');\n if (ch) {\n flags += ch;\n for (str += '\\\\u'; restore < index; ++restore) {\n str += source[restore];\n }\n } else {\n index = restore;\n flags += 'u';\n str += '\\\\u';\n }\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n } else {\n str += '\\\\';\n throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');\n }\n } else {\n flags += ch;\n str += ch;\n }\n }\n\n return {\n value: flags,\n literal: str\n };\n }\n\n function 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 if (extra.tokenize) {\n return {\n type: Token.RegularExpression,\n value: value,\n regex: {\n pattern: body.value,\n flags: flags.value\n },\n lineNumber: lineNumber,\n lineStart: lineStart,\n start: start,\n end: index\n };\n }\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\n function collectRegex() {\n var pos, loc, regex, token;\n\n skipComment();\n\n pos = index;\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n regex = scanRegExp();\n\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (!extra.tokenize) {\n // Pop the previous token, which is likely '/' or '/='\n if (extra.tokens.length > 0) {\n token = extra.tokens[extra.tokens.length - 1];\n if (token.range[0] === pos && token.type === 'Punctuator') {\n if (token.value === '/' || token.value === '/=') {\n extra.tokens.pop();\n }\n }\n }\n\n extra.tokens.push({\n type: 'RegularExpression',\n value: regex.literal,\n regex: regex.regex,\n range: [pos, index],\n loc: loc\n });\n }\n\n return regex;\n }\n\n function isIdentifierName(token) {\n return token.type === Token.Identifier ||\n token.type === Token.Keyword ||\n token.type === Token.BooleanLiteral ||\n token.type === Token.NullLiteral;\n }\n\n function advanceSlash() {\n var prevToken,\n checkToken;\n // Using the following algorithm:\n // https://github.com/mozilla/sweet.js/wiki/design\n prevToken = extra.tokens[extra.tokens.length - 1];\n if (!prevToken) {\n // Nothing before that: it cannot be a division.\n return collectRegex();\n }\n if (prevToken.type === 'Punctuator') {\n if (prevToken.value === ']') {\n return scanPunctuator();\n }\n if (prevToken.value === ')') {\n checkToken = extra.tokens[extra.openParenToken - 1];\n if (checkToken &&\n checkToken.type === 'Keyword' &&\n (checkToken.value === 'if' ||\n checkToken.value === 'while' ||\n checkToken.value === 'for' ||\n checkToken.value === 'with')) {\n return collectRegex();\n }\n return scanPunctuator();\n }\n if (prevToken.value === '}') {\n // Dividing a function by anything makes little sense,\n // but we have to check for that.\n if (extra.tokens[extra.openCurlyToken - 3] &&\n extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {\n // Anonymous function.\n checkToken = extra.tokens[extra.openCurlyToken - 4];\n if (!checkToken) {\n return scanPunctuator();\n }\n } else if (extra.tokens[extra.openCurlyToken - 4] &&\n extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {\n // Named function.\n checkToken = extra.tokens[extra.openCurlyToken - 5];\n if (!checkToken) {\n return collectRegex();\n }\n } else {\n return scanPunctuator();\n }\n return scanPunctuator();\n }\n return collectRegex();\n }\n if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {\n return collectRegex();\n }\n return scanPunctuator();\n }\n\n function advance() {\n var ch;\n\n skipComment();\n\n if (index >= length) {\n return {\n type: Token.EOF,\n lineNumber: lineNumber,\n lineStart: lineStart,\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 // Slash (/) U+002F can also start a regex.\n if (extra.tokenize && ch === 0x2F) {\n return advanceSlash();\n }\n\n return scanPunctuator();\n }\n\n function collectToken() {\n var loc, token, value, entry;\n\n skipComment();\n loc = {\n start: {\n line: lineNumber,\n column: index - lineStart\n }\n };\n\n token = advance();\n loc.end = {\n line: lineNumber,\n column: index - lineStart\n };\n\n if (token.type !== Token.EOF) {\n value = source.slice(token.start, token.end);\n entry = {\n type: TokenName[token.type],\n value: value,\n range: [token.start, token.end],\n loc: loc\n };\n if (token.regex) {\n entry.regex = {\n pattern: token.regex.pattern,\n flags: token.regex.flags\n };\n }\n extra.tokens.push(entry);\n }\n\n return token;\n }\n\n function lex() {\n var token;\n\n token = lookahead;\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n\n index = token.end;\n lineNumber = token.lineNumber;\n lineStart = token.lineStart;\n\n return token;\n }\n\n function peek() {\n var pos, line, start;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n lookahead = (typeof extra.tokens !== 'undefined') ? collectToken() : advance();\n index = pos;\n lineNumber = line;\n lineStart = start;\n }\n\n function Position() {\n this.line = lineNumber;\n this.column = index - lineStart;\n }\n\n function SourceLocation() {\n this.start = new Position();\n this.end = null;\n }\n\n function WrappingSourceLocation(startToken) {\n if (startToken.type === Token.StringLiteral) {\n this.start = {\n line: startToken.startLineNumber,\n column: startToken.start - startToken.startLineStart\n };\n } else {\n this.start = {\n line: startToken.lineNumber,\n column: startToken.start - startToken.lineStart\n };\n }\n this.end = null;\n }\n\n function Node() {\n // Skip comment.\n index = lookahead.start;\n if (lookahead.type === Token.StringLiteral) {\n lineNumber = lookahead.startLineNumber;\n lineStart = lookahead.startLineStart;\n } else {\n lineNumber = lookahead.lineNumber;\n lineStart = lookahead.lineStart;\n }\n if (extra.range) {\n this.range = [index, 0];\n }\n if (extra.loc) {\n this.loc = new SourceLocation();\n }\n }\n\n function WrappingNode(startToken) {\n if (extra.range) {\n this.range = [startToken.start, 0];\n }\n if (extra.loc) {\n this.loc = new WrappingSourceLocation(startToken);\n }\n }\n\n WrappingNode.prototype = Node.prototype = {\n\n finish: function () {\n if (extra.range) {\n this.range[1] = index;\n }\n if (extra.loc) {\n this.loc.end = new Position();\n if (extra.source) {\n this.loc.source = extra.source;\n }\n }\n },\n\n finishArrayExpression: function (elements) {\n this.type = Syntax.ArrayExpression;\n this.elements = elements;\n this.finish();\n return this;\n },\n\n finishAssignmentExpression: function (operator, left, right) {\n this.type = Syntax.AssignmentExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishBinaryExpression: function (operator, left, right) {\n this.type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression : Syntax.BinaryExpression;\n this.operator = operator;\n this.left = left;\n this.right = right;\n this.finish();\n return this;\n },\n\n finishCallExpression: function (callee, args) {\n this.type = Syntax.CallExpression;\n this.callee = callee;\n this.arguments = args;\n this.finish();\n return this;\n },\n\n finishConditionalExpression: function (test, consequent, alternate) {\n this.type = Syntax.ConditionalExpression;\n this.test = test;\n this.consequent = consequent;\n this.alternate = alternate;\n this.finish();\n return this;\n },\n\n finishExpressionStatement: function (expression) {\n this.type = Syntax.ExpressionStatement;\n this.expression = expression;\n this.finish();\n return this;\n },\n\n finishIdentifier: function (name) {\n this.type = Syntax.Identifier;\n this.name = name;\n this.finish();\n return this;\n },\n\n finishLiteral: function (token) {\n this.type = Syntax.Literal;\n this.value = token.value;\n this.raw = source.slice(token.start, token.end);\n if (token.regex) {\n if (this.raw == '//') {\n this.raw = '/(?:)/';\n }\n this.regex = token.regex;\n }\n this.finish();\n return this;\n },\n\n finishMemberExpression: function (accessor, object, property) {\n this.type = Syntax.MemberExpression;\n this.computed = accessor === '[';\n this.object = object;\n this.property = property;\n this.finish();\n return this;\n },\n\n finishObjectExpression: function (properties) {\n this.type = Syntax.ObjectExpression;\n this.properties = properties;\n this.finish();\n return this;\n },\n\n finishProgram: function (body) {\n this.type = Syntax.Program;\n this.body = body;\n this.finish();\n return this;\n },\n\n finishProperty: function (kind, key, value) {\n this.type = Syntax.Property;\n this.key = key;\n this.value = value;\n this.kind = kind;\n this.finish();\n return this;\n },\n\n finishUnaryExpression: function (operator, argument) {\n this.type = Syntax.UnaryExpression;\n this.operator = operator;\n this.argument = argument;\n this.prefix = true;\n this.finish();\n return this;\n }\n };\n\n // Return true if there is a line terminator before the next token.\n\n function peekLineTerminator() {\n var pos, line, start, found;\n\n pos = index;\n line = lineNumber;\n start = lineStart;\n skipComment();\n found = lineNumber !== line;\n index = pos;\n lineNumber = line;\n lineStart = start;\n\n return found;\n }\n\n // Throw an exception\n\n function 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 if (typeof token.lineNumber === 'number') {\n error = new Error('Line ' + token.lineNumber + ': ' + msg);\n error.index = token.start;\n error.lineNumber = token.lineNumber;\n error.column = token.start - lineStart + 1;\n } else {\n error = new Error('Line ' + lineNumber + ': ' + msg);\n error.index = index;\n error.lineNumber = lineNumber;\n error.column = index - lineStart + 1;\n }\n\n error.description = msg;\n throw error;\n }\n\n function throwErrorTolerant() {\n try {\n throwError.apply(null, arguments);\n } catch (e) {\n if (extra.errors) {\n extra.errors.push(e);\n } else {\n throw e;\n }\n }\n }\n\n\n // Throw an exception because of the token.\n\n function throwUnexpected(token) {\n if (token.type === Token.EOF) {\n throwError(token, Messages.UnexpectedEOS);\n }\n\n if (token.type === Token.NumericLiteral) {\n throwError(token, Messages.UnexpectedNumber);\n }\n\n if (token.type === Token.StringLiteral) {\n throwError(token, Messages.UnexpectedString);\n }\n\n if (token.type === Token.Identifier) {\n throwError(token, Messages.UnexpectedIdentifier);\n }\n\n if (token.type === Token.Keyword) {\n if (isFutureReservedWord(token.value)) {\n throwError(token, Messages.UnexpectedReserved);\n } else if (strict && isStrictModeReservedWord(token.value)) {\n throwErrorTolerant(token, Messages.StrictReservedWord);\n return;\n }\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // BooleanLiteral, NullLiteral, or Punctuator.\n throwError(token, Messages.UnexpectedToken, token.value);\n }\n\n // Expect the next token to match the specified punctuator.\n // If not, an exception will be thrown.\n\n function expect(value) {\n var token = lex();\n if (token.type !== Token.Punctuator || token.value !== value) {\n throwUnexpected(token);\n }\n }\n\n /**\n * @name expectTolerant\n * @description Quietly expect the given token value when in tolerant mode, otherwise delegates\n * to expect(value)\n * @param {String} value The value we are expecting the lookahead token to have\n * @since 2.0\n */\n function expectTolerant(value) {\n if (extra.errors) {\n var token = lookahead;\n if (token.type !== Token.Punctuator && token.value !== value) {\n throwErrorTolerant(token, Messages.UnexpectedToken, token.value);\n } else {\n lex();\n }\n } else {\n expect(value);\n }\n }\n\n // Return true if the next token matches the specified punctuator.\n\n function match(value) {\n return lookahead.type === Token.Punctuator && lookahead.value === value;\n }\n\n // Return true if the next token matches the specified keyword\n\n function matchKeyword(keyword) {\n return lookahead.type === Token.Keyword && lookahead.value === keyword;\n }\n\n function consumeSemicolon() {\n var line;\n\n // Catch the very common case first: immediately a semicolon (U+003B).\n if (source.charCodeAt(index) === 0x3B || match(';')) {\n lex();\n return;\n }\n\n line = lineNumber;\n skipComment();\n if (lineNumber !== line) {\n return;\n }\n\n if (lookahead.type !== Token.EOF && !match('}')) {\n throwUnexpected(lookahead);\n }\n }\n\n // 11.1.4 Array Initialiser\n\n function parseArrayInitialiser() {\n var elements = [], node = new Node();\n\n expect('[');\n\n while (!match(']')) {\n if (match(',')) {\n lex();\n elements.push(null);\n } else {\n elements.push(parseAssignmentExpression());\n\n if (!match(']')) {\n expect(',');\n }\n }\n }\n\n lex();\n\n return node.finishArrayExpression(elements);\n }\n\n // 11.1.5 Object Initialiser\n\n function parseObjectPropertyKey() {\n var token, node = new Node();\n\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 === Token.StringLiteral || token.type === Token.NumericLiteral) {\n if (strict && token.octal) {\n throwErrorTolerant(token, Messages.StrictOctalLiteral);\n }\n return node.finishLiteral(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseObjectProperty() {\n var token, key, id, value, node = new Node();\n\n token = lookahead;\n\n if (token.type === Token.Identifier) {\n id = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', id, value);\n }\n if (token.type === Token.EOF || token.type === Token.Punctuator) {\n throwUnexpected(token);\n } else {\n key = parseObjectPropertyKey();\n expect(':');\n value = parseAssignmentExpression();\n return node.finishProperty('init', key, value);\n }\n }\n\n function parseObjectInitialiser() {\n var properties = [], property, name, key, kind, map = {}, toString = String, node = new Node();\n\n expect('{');\n\n while (!match('}')) {\n property = parseObjectProperty();\n\n if (property.key.type === Syntax.Identifier) {\n name = property.key.name;\n } else {\n name = toString(property.key.value);\n }\n kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;\n\n key = '$' + name;\n if (Object.prototype.hasOwnProperty.call(map, key)) {\n if (map[key] === PropertyKind.Data) {\n if (strict && kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.StrictDuplicateProperty);\n } else if (kind !== PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n }\n } else {\n if (kind === PropertyKind.Data) {\n throwErrorTolerant({}, Messages.AccessorDataProperty);\n } else if (map[key] & kind) {\n throwErrorTolerant({}, Messages.AccessorGetSet);\n }\n }\n map[key] |= kind;\n } else {\n map[key] = kind;\n }\n\n properties.push(property);\n\n if (!match('}')) {\n expectTolerant(',');\n }\n }\n\n expect('}');\n\n return node.finishObjectExpression(properties);\n }\n\n // 11.1.6 The Grouping Operator\n\n function parseGroupExpression() {\n var expr;\n\n expect('(');\n\n ++state.parenthesisCount;\n\n expr = parseExpression();\n\n expect(')');\n\n return expr;\n }\n\n\n // 11.1 Primary Expressions\n\n var legalKeywords = {\"if\":1, \"this\":1};\n\n function parsePrimaryExpression() {\n var type, token, expr, node;\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 node = new Node();\n\n if (type === Token.Identifier || legalKeywords[lookahead.value]) {\n expr = node.finishIdentifier(lex().value);\n } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {\n if (strict && lookahead.octal) {\n throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);\n }\n expr = node.finishLiteral(lex());\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\");\n } else if (type === Token.BooleanLiteral) {\n token = lex();\n token.value = (token.value === 'true');\n expr = node.finishLiteral(token);\n } else if (type === Token.NullLiteral) {\n token = lex();\n token.value = null;\n expr = node.finishLiteral(token);\n } else if (match('/') || match('/=')) {\n if (typeof extra.tokens !== 'undefined') {\n expr = node.finishLiteral(collectRegex());\n } else {\n expr = node.finishLiteral(scanRegExp());\n }\n peek();\n } else {\n throwUnexpected(lex());\n }\n\n return expr;\n }\n\n // 11.2 Left-Hand-Side Expressions\n\n function parseArguments() {\n var args = [];\n\n expect('(');\n\n if (!match(')')) {\n while (index < length) {\n args.push(parseAssignmentExpression());\n if (match(')')) {\n break;\n }\n expectTolerant(',');\n }\n }\n\n expect(')');\n\n return args;\n }\n\n function parseNonComputedProperty() {\n var token, node = new Node();\n\n token = lex();\n\n if (!isIdentifierName(token)) {\n throwUnexpected(token);\n }\n\n return node.finishIdentifier(token.value);\n }\n\n function parseNonComputedMember() {\n expect('.');\n\n return parseNonComputedProperty();\n }\n\n function parseComputedMember() {\n var expr;\n\n expect('[');\n\n expr = parseExpression();\n\n expect(']');\n\n return expr;\n }\n\n function parseLeftHandSideExpressionAllowCall() {\n var expr, args, property, startToken, previousAllowIn = state.allowIn;\n\n startToken = lookahead;\n state.allowIn = true;\n expr = parsePrimaryExpression();\n\n for (;;) {\n if (match('.')) {\n property = parseNonComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('.', expr, property);\n } else if (match('(')) {\n args = parseArguments();\n expr = new WrappingNode(startToken).finishCallExpression(expr, args);\n } else if (match('[')) {\n property = parseComputedMember();\n expr = new WrappingNode(startToken).finishMemberExpression('[', expr, property);\n } else {\n break;\n }\n }\n state.allowIn = previousAllowIn;\n\n return expr;\n }\n\n // 11.3 Postfix Expressions\n\n function parsePostfixExpression() {\n var expr = parseLeftHandSideExpressionAllowCall();\n\n if (lookahead.type === Token.Punctuator) {\n if ((match('++') || match('--')) && !peekLineTerminator()) {\n throw new Error(\"Disabled.\");\n }\n }\n\n return expr;\n }\n\n // 11.4 Unary Operators\n\n function parseUnaryExpression() {\n var token, expr, startToken;\n\n if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {\n expr = parsePostfixExpression();\n } else if (match('++') || match('--')) {\n throw new Error(\"Disabled.\");\n } else if (match('+') || match('-') || match('~') || match('!')) {\n startToken = lookahead;\n token = lex();\n expr = parseUnaryExpression();\n expr = new WrappingNode(startToken).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\n function binaryPrecedence(token, allowIn) {\n var prec = 0;\n\n if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {\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 prec = 7;\n break;\n\n case 'in':\n prec = allowIn ? 7 : 0;\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\n function 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, state.allowIn);\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, state.allowIn)) > 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 = new WrappingNode(markers[markers.length - 1]).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 expr = new WrappingNode(markers.pop()).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\n function parseConditionalExpression() {\n var expr, previousAllowIn, consequent, alternate, startToken;\n\n startToken = lookahead;\n\n expr = parseBinaryExpression();\n\n if (match('?')) {\n lex();\n previousAllowIn = state.allowIn;\n state.allowIn = true;\n consequent = parseAssignmentExpression();\n state.allowIn = previousAllowIn;\n expect(':');\n alternate = parseAssignmentExpression();\n\n expr = new WrappingNode(startToken).finishConditionalExpression(expr, consequent, alternate);\n }\n\n return expr;\n }\n\n // 11.13 Assignment Operators\n\n function parseAssignmentExpression() {\n var oldParenthesisCount, token, expr, startToken;\n\n oldParenthesisCount = state.parenthesisCount;\n\n startToken = lookahead;\n token = lookahead;\n\n expr = parseConditionalExpression();\n\n return expr;\n }\n\n // 11.14 Comma Operator\n\n function parseExpression() {\n var expr = parseAssignmentExpression();\n\n if (match(',')) {\n throw new Error(\"Disabled.\"); // no sequence expressions\n }\n\n return expr;\n }\n\n // 12.4 Expression Statement\n\n function parseExpressionStatement(node) {\n var expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 12 Statements\n\n function parseStatement() {\n var type = lookahead.type,\n expr,\n node;\n\n if (type === Token.EOF) {\n throwUnexpected(lookahead);\n }\n\n if (type === Token.Punctuator && lookahead.value === '{') {\n throw new Error(\"Disabled.\"); // block statement\n }\n\n node = new Node();\n\n if (type === Token.Punctuator) {\n switch (lookahead.value) {\n case ';':\n throw new Error(\"Disabled.\"); // empty statement\n case '(':\n return parseExpressionStatement(node);\n default:\n break;\n }\n } else if (type === Token.Keyword) {\n throw new Error(\"Disabled.\"); // keyword\n }\n\n expr = parseExpression();\n consumeSemicolon();\n return node.finishExpressionStatement(expr);\n }\n\n // 14 Program\n\n function parseSourceElement() {\n if (lookahead.type === Token.Keyword) {\n switch (lookahead.value) {\n case 'const':\n case 'let':\n throw new Error(\"Disabled.\");\n case 'function':\n throw new Error(\"Disabled.\");\n default:\n return parseStatement();\n }\n }\n\n if (lookahead.type !== Token.EOF) {\n return parseStatement();\n }\n }\n\n function parseSourceElements() {\n var sourceElement, sourceElements = [], token, directive, firstRestricted;\n\n while (index < length) {\n token = lookahead;\n if (token.type !== Token.StringLiteral) {\n break;\n }\n\n sourceElement = parseSourceElement();\n sourceElements.push(sourceElement);\n if (sourceElement.expression.type !== Syntax.Literal) {\n // this is not directive\n break;\n }\n directive = source.slice(token.start + 1, token.end - 1);\n if (directive === 'use strict') {\n strict = true;\n if (firstRestricted) {\n throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);\n }\n } else {\n if (!firstRestricted && token.octal) {\n firstRestricted = token;\n }\n }\n }\n\n while (index < length) {\n sourceElement = parseSourceElement();\n if (typeof sourceElement === 'undefined') {\n break;\n }\n sourceElements.push(sourceElement);\n }\n return sourceElements;\n }\n\n function parseProgram() {\n var body, node;\n\n skipComment();\n peek();\n node = new Node();\n strict = true; // assume strict\n\n body = parseSourceElements();\n return node.finishProgram(body);\n }\n\n function filterTokenLocation() {\n var i, entry, token, tokens = [];\n\n for (i = 0; i < extra.tokens.length; ++i) {\n entry = extra.tokens[i];\n token = {\n type: entry.type,\n value: entry.value\n };\n if (entry.regex) {\n token.regex = {\n pattern: entry.regex.pattern,\n flags: entry.regex.flags\n };\n }\n if (extra.range) {\n token.range = entry.range;\n }\n if (extra.loc) {\n token.loc = entry.loc;\n }\n tokens.push(token);\n }\n\n extra.tokens = tokens;\n }\n\n function tokenize(code, options) {\n var toString,\n tokens;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n\n // Options matching.\n options = options || {};\n\n // Of course we collect tokens here.\n options.tokens = true;\n extra.tokens = [];\n extra.tokenize = true;\n // The following two fields are necessary to compute the Regex tokens.\n extra.openParenToken = -1;\n extra.openCurlyToken = -1;\n\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n\n try {\n peek();\n if (lookahead.type === Token.EOF) {\n return extra.tokens;\n }\n\n lex();\n while (lookahead.type !== Token.EOF) {\n try {\n lex();\n } catch (lexError) {\n if (extra.errors) {\n extra.errors.push(lexError);\n // We have to break on the first error\n // to avoid infinite loops.\n break;\n } else {\n throw lexError;\n }\n }\n }\n\n filterTokenLocation();\n tokens = extra.tokens;\n if (typeof extra.errors !== 'undefined') {\n tokens.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n return tokens;\n }\n\n function parse(code, options) {\n var program, toString;\n\n toString = String;\n if (typeof code !== 'string' && !(code instanceof String)) {\n code = toString(code);\n }\n\n source = code;\n index = 0;\n lineNumber = (source.length > 0) ? 1 : 0;\n lineStart = 0;\n length = source.length;\n lookahead = null;\n state = {\n allowIn: true,\n labelSet: {},\n parenthesisCount: 0,\n inFunctionBody: false,\n inIteration: false,\n inSwitch: false,\n lastCommentStart: -1\n };\n\n extra = {};\n if (typeof options !== 'undefined') {\n extra.range = (typeof options.range === 'boolean') && options.range;\n extra.loc = (typeof options.loc === 'boolean') && options.loc;\n\n if (extra.loc && options.source !== null && options.source !== undefined) {\n extra.source = toString(options.source);\n }\n\n if (typeof options.tokens === 'boolean' && options.tokens) {\n extra.tokens = [];\n }\n if (typeof options.tolerant === 'boolean' && options.tolerant) {\n extra.errors = [];\n }\n }\n\n try {\n program = parseProgram();\n if (typeof extra.tokens !== 'undefined') {\n filterTokenLocation();\n program.tokens = extra.tokens;\n }\n if (typeof extra.errors !== 'undefined') {\n program.errors = extra.errors;\n }\n } catch (e) {\n throw e;\n } finally {\n extra = {};\n }\n\n return program;\n }\n\n return {\n tokenize: tokenize,\n parse: parse\n };\n\n})();","var expr = require('vega-expression'),\n args = ['datum', 'event', 'signals'];\n\nmodule.exports = expr.compiler(args, {\n idWhiteList: args,\n fieldVar: args[0],\n globalVar: args[2],\n functions: function(codegen) {\n var fn = expr.functions(codegen);\n fn.eventItem = function() { return 'event.vg.item'; };\n fn.eventGroup = 'event.vg.getGroup';\n fn.eventX = 'event.vg.getX';\n fn.eventY = 'event.vg.getY';\n fn.open = 'window.open';\n return fn;\n }\n});","var dl = require('datalib'),\n df = require('vega-dataflow'),\n log = require('vega-logging'),\n ChangeSet = df.ChangeSet,\n Tuple = df.Tuple,\n Deps = df.Dependencies,\n Transform = require('./Transform'),\n Facetor = require('./Facetor');\n\nfunction Aggregate(graph) {\n Transform.prototype.init.call(this, graph);\n\n Transform.addParameters(this, {\n groupby: {type: 'array'},\n summarize: {\n type: 'custom', \n set: function(summarize) {\n var signalDeps = {},\n tx = this._transform,\n i, len, f, fields, name, ops;\n\n if (!dl.isArray(fields = summarize)) { // Object syntax from dl\n fields = [];\n for (name in summarize) {\n ops = dl.array(summarize[name]);\n fields.push({field: name, ops: ops});\n }\n }\n\n function sg(x) { if (x.signal) signalDeps[x.signal] = 1; }\n\n for (i=0, len=fields.length; i this.config('maxSmallNumber') ?\n 'largeNumberFormat': 'smallNumberFormat';\n return this.config(formatConfig);\n };\n\n proto.sort = function(et, stats) {\n var sort = this._enc[et].sort,\n enc = this._enc,\n isTypes = vlEncDef.isTypes;\n\n if ((!sort || sort.length===0) &&\n // FIXME\n Encoding.toggleSort.support({encoding:this._enc}, stats, true) && //HACK\n this.config('toggleSort') === Q\n ) {\n var qField = isTypes(enc.x, [N, O]) ? enc.y : enc.x;\n\n if (isTypes(enc[et], [N, O])) {\n sort = [{\n name: qField.name,\n aggregate: qField.aggregate,\n type: qField.type,\n reverse: true\n }];\n }\n }\n\n return sort;\n };\n\n proto.map = function(f) {\n return vlenc.map(this._enc, f);\n };\n\n proto.reduce = function(f, init) {\n return vlenc.reduce(this._enc, f, init);\n };\n\n proto.forEach = function(f) {\n return vlenc.forEach(this._enc, f);\n };\n\n proto.type = function(et) {\n return this.has(et) ? this._enc[et].type : null;\n };\n\n proto.isType = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isType(encDef, type);\n };\n\n\n proto.isTypes = function(et, type) {\n var encDef = this.encDef(et);\n return encDef && vlEncDef.isTypes(encDef, type);\n };\n\n Encoding.isOrdinalScale = function(encoding, encType) {\n return vlEncDef.isOrdinalScale(encoding.encDef(encType));\n };\n\n Encoding.isDimension = function(encoding, encType) {\n return vlEncDef.isDimension(encoding.encDef(encType));\n };\n\n Encoding.isMeasure = function(encoding, encType) {\n return vlEncDef.isMeasure(encoding.encDef(encType));\n };\n\n proto.isOrdinalScale = function(encType) {\n return this.has(encType) && Encoding.isOrdinalScale(this, encType);\n };\n\n proto.isDimension = function(encType) {\n return this.has(encType) && Encoding.isDimension(this, encType);\n };\n\n proto.isMeasure = function(encType) {\n return this.has(encType) && Encoding.isMeasure(this, encType);\n };\n\n proto.isAggregate = function() {\n return vlenc.isAggregate(this._enc);\n };\n\n proto.dataTable = function() {\n return this.isAggregate() ? AGGREGATE : RAW;\n };\n\n Encoding.isAggregate = function(spec) {\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.alwaysNoOcclusion = function(spec) {\n // FIXME raw OxQ with # of rows = # of O\n return vlenc.isAggregate(spec.encoding);\n };\n\n Encoding.isStack = function(spec) {\n // FIXME update this once we have control for stack ...\n return (spec.marktype === 'bar' || spec.marktype === 'area') &&\n spec.encoding.color;\n };\n\n /**\n * Check if the encoding should be stacked and return the stack dimenstion and value fields.\n * @return {Object} An object containing two properties:\n * - dimension - the dimension field\n * - value - the value field\n */\n proto.stack = function() {\n var stack = (this.has(COLOR) && this.encDef(COLOR).stack) ? COLOR :\n (this.has(DETAIL) && this.encDef(DETAIL).stack) ? DETAIL :\n null;\n\n var properties = stack && this.encDef(stack).stack !== true ?\n this.encDef(stack).stack :\n {};\n\n if ((this.is('bar') || this.is('area')) && stack && this.isAggregate()) {\n\n var isXMeasure = this.isMeasure(X);\n var isYMeasure = this.isMeasure(Y);\n\n if (isXMeasure && !isYMeasure) {\n return {\n groupby: Y,\n value: X,\n stack: stack,\n properties: properties\n };\n } else if (isYMeasure && !isXMeasure) {\n return {\n groupby: X,\n value: Y,\n stack: stack,\n properties: properties\n };\n }\n }\n return null; // no stack encoding\n };\n\n\n\n proto.details = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType !== X && encType !== Y)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.facets = function() {\n var encoding = this;\n return this.reduce(function(refs, field, encType) {\n if (!field.aggregate && (encType == ROW || encType == COL)) {\n refs.push(encoding.fieldRef(encType));\n }\n return refs;\n }, []);\n };\n\n proto.cardinality = function(encType, stats) {\n return vlEncDef.cardinality(this.encDef(encType), stats, this.config('filterNull'));\n };\n\n proto.isRaw = function() {\n return !this.isAggregate();\n };\n\n proto.data = function() {\n return this._data;\n };\n\n // returns whether the encoding has values embedded\n proto.hasValues = function() {\n var vals = this.data().values;\n return vals && vals.length;\n };\n\n proto.config = function(name) {\n return this._config[name];\n };\n\n Encoding.transpose = function(spec) {\n var oldenc = spec.encoding,\n enc = util.duplicate(spec.encoding);\n enc.x = oldenc.y;\n enc.y = oldenc.x;\n enc.row = oldenc.col;\n enc.col = oldenc.row;\n spec.encoding = enc;\n return spec;\n };\n\n return Encoding;\n})();\n","'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n getter = util.getter,\n time = require('./time');\n\nvar axis = module.exports = {};\n\naxis.def = function(name, encoding, layout, stats, opt) {\n var isCol = name == COL,\n isRow = name == ROW,\n type = isCol ? 'x' : isRow ? 'y' : name;\n\n // TODO: rename def to axisDef and avoid side effects where possible.\n\n var def = {\n type: type,\n scale: name,\n properties: {},\n layer: encoding.encDef(name).axis.layer\n };\n\n var orient = axis.orient(encoding, name, stats);\n if (orient) {\n def.orient = orient;\n }\n\n // Add axis label custom scale (for bin / time)\n def = axis.labels.scale(def, encoding, name);\n def = axis.labels.format(def, encoding, name, stats);\n def = axis.labels.angle(def, encoding, name);\n\n // for x-axis, set ticks for Q or rotate scale for ordinal scale\n if (name == X) {\n if ((encoding.isDimension(X) || encoding.isType(X, T)) &&\n !('angle' in getter(def, ['properties', 'labels']))) {\n // TODO(kanitw): Jul 19, 2015 - #506 add condition for rotation\n def = axis.labels.rotate(def);\n } else { // Q\n def.ticks = encoding.encDef(name).axis.ticks;\n }\n }\n\n // TitleOffset depends on labels rotation\n def.titleOffset = axis.titleOffset(encoding, layout, name);\n\n //def.offset is used in axis.grid\n if(isRow) def.offset = axis.titleOffset(encoding, layout, Y) + 20;\n // FIXME(kanitw): Jul 19, 2015 - offset for column when x is put on top\n\n def = axis.grid(def, encoding, name, layout);\n def = axis.title(def, encoding, name, layout, opt);\n\n if (isRow || isCol) {\n def = axis.hideTicks(def);\n }\n\n return def;\n};\n\naxis.orient = function(encoding, name, stats) {\n var orient = encoding.encDef(name).axis.orient;\n if (orient) {\n return orient;\n } else if (name === COL) {\n return 'top';\n } else if (name === X && encoding.has(Y) && encoding.isOrdinalScale(Y) && encoding.cardinality(Y, stats) > 30) {\n // x-axis for long y - put on top\n return 'top';\n }\n return undefined;\n};\n\naxis.grid = function(def, encoding, name, layout) {\n var cellPadding = layout.cellPadding,\n isCol = name == COL,\n isRow = name == ROW;\n\n var _grid = encoding.axis(name).grid;\n\n // If `grid` is unspecified, the default value is `true` for ROW and COL. For X\n // and Y, the default value is `true` for quantitative and time fields and `false` otherwise.\n var grid = _grid === undefined ?\n (name === ROW || name === COL || encoding.isTypes(name, [Q, T])) :\n _grid;\n\n if (grid) {\n def.grid = true;\n\n if (isCol) {\n // set grid property -- put the lines on the right the cell\n var yOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n def.properties.grid = {\n x: {\n offset: layout.cellWidth * (1+ cellPadding/2.0),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'col',\n field: 'data'\n },\n y: {\n value: -yOffset,\n },\n y2: {\n field: {group: 'mark.group.height'},\n offset: yOffset\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else if (isRow) {\n var xOffset = encoding.config('cellGridOffset');\n\n // TODO(#677): this should depend on orient\n // set grid property -- put the lines on the top\n def.properties.grid = {\n y: {\n offset: -layout.cellHeight * (cellPadding/2),\n // default value(s) -- vega doesn't do recursive merge\n scale: 'row',\n field: 'data'\n },\n x: {\n value: def.offset - xOffset\n },\n x2: {\n field: {group: 'mark.group.width'},\n offset: def.offset + xOffset,\n // default value(s) -- vega doesn't do recursive merge\n mult: 1\n },\n stroke: { value: encoding.config('cellGridColor') },\n strokeOpacity: { value: encoding.config('cellGridOpacity') }\n };\n } else {\n def.properties.grid = {\n stroke: { value: encoding.config('gridColor') },\n strokeOpacity: { value: encoding.config('gridOpacity') }\n };\n }\n }\n return def;\n};\n\naxis.hideTicks = function(def) {\n def.properties.ticks = {opacity: {value: 0}};\n def.properties.majorTicks = {opacity: {value: 0}};\n def.properties.axis = {opacity: {value: 0}};\n return def;\n};\n\naxis.title = function (def, encoding, name, layout) {\n var ax = encoding.encDef(name).axis;\n\n if (ax.title) {\n def.title = ax.title;\n } else {\n // if not defined, automatically determine axis title from field def\n var fieldTitle = encoding.fieldTitle(name),\n maxLength;\n\n if (ax.titleMaxLength) {\n maxLength = ax.titleMaxLength;\n } else if (name===X) {\n maxLength = layout.cellWidth / encoding.config('characterWidth');\n } else if (name === Y) {\n maxLength = layout.cellHeight / encoding.config('characterWidth');\n }\n\n def.title = maxLength ? util.truncate(fieldTitle, maxLength) : fieldTitle;\n }\n\n if (name === ROW) {\n def.properties.title = {\n angle: {value: 0},\n align: {value: 'right'},\n baseline: {value: 'middle'},\n dy: {value: (-layout.height/2) -20}\n };\n }\n\n return def;\n};\n\naxis.labels = {};\n\n/** add custom label for time type and bin */\naxis.labels.scale = function(def, encoding, name) {\n // time\n var timeUnit = encoding.encDef(name).timeUnit;\n if (encoding.isType(name, T) && timeUnit && (time.hasScale(timeUnit))) {\n setter(def, ['properties','labels','text','scale'], 'time-'+ timeUnit);\n }\n // FIXME bin\n return def;\n};\n\n/**\n * Determine number format or truncate if maxLabel length is presented.\n */\naxis.labels.format = function (def, encoding, name, stats) {\n var fieldStats = stats[encoding.encDef(name).name];\n\n if (encoding.axis(name).format) {\n def.format = encoding.axis(name).format;\n } else if (encoding.isType(name, Q) || fieldStats.type === 'number') {\n def.format = encoding.numberFormat(fieldStats);\n } else if (encoding.isType(name, T)) {\n var timeUnit = encoding.encDef(name).timeUnit;\n if (!timeUnit) {\n def.format = encoding.config('timeFormat');\n } else if (timeUnit === 'year') {\n def.format = 'd';\n }\n } else if (encoding.isTypes(name, [N, O]) && encoding.axis(name).maxLabelLength) {\n setter(def,\n ['properties','labels','text','template'],\n '{{ datum.data | truncate:' +\n encoding.axis(name).maxLabelLength + '}}'\n );\n }\n\n return def;\n};\n\naxis.labels.angle = function(def, encoding, name) {\n var angle = encoding.axis(name).labelAngle;\n if (typeof angle === 'undefined') return def;\n\n setter(def, ['properties', 'labels', 'angle', 'value'], angle);\n return def;\n};\n\naxis.labels.rotate = function(def) {\n var align = def.orient ==='top' ? 'left' : 'right';\n setter(def, ['properties','labels', 'angle', 'value'], 270);\n setter(def, ['properties','labels', 'align', 'value'], align);\n setter(def, ['properties','labels', 'baseline', 'value'], 'middle');\n return def;\n};\n\naxis.titleOffset = function (encoding, layout, name) {\n // return specified value if specified\n var value = encoding.axis(name).titleOffset;\n if (value) return value;\n\n switch (name) {\n //FIXME make this adjustable\n case ROW: return 0;\n case COL: return 35;\n }\n return getter(layout, [name, 'axisTitleOffset']);\n};\n","'use strict';\n\nvar summary = module.exports = require('datalib/src/stats').summary;\n\nrequire('../globals');\n\n/**\n * Module for compiling Vega-lite spec into Vega spec.\n */\nvar compiler = module.exports = {};\n\nvar Encoding = require('../Encoding'),\n axis = compiler.axis = require('./axis'),\n legend = compiler.legend = require('./legend'),\n marks = compiler.marks = require('./marks'),\n scale = compiler.scale = require('./scale');\n\ncompiler.data = require('./data');\ncompiler.facet = require('./facet');\ncompiler.layout = require('./layout');\ncompiler.stack = require('./stack');\ncompiler.style = require('./style');\ncompiler.subfacet = require('./subfacet');\ncompiler.time = require('./time');\n\ncompiler.compile = function (spec, stats, theme) {\n return compiler.compileEncoding(Encoding.fromSpec(spec, theme), stats);\n};\n\ncompiler.shorthand = function (shorthand, stats, config, theme) {\n return compiler.compileEncoding(Encoding.fromShorthand(shorthand, config, theme), stats);\n};\n\n/**\n * Create a Vega specification from a Vega-lite Encoding object.\n */\ncompiler.compileEncoding = function (encoding, stats) {\n // no need to pass stats if you pass in the data\n if (!stats) {\n if (encoding.hasValues()) {\n stats = summary(encoding.data().values).reduce(function(s, p) {\n s[p.field] = p;\n return s;\n }, {});\n } else {\n console.error('No stats provided and data is not embedded.');\n }\n }\n\n var layout = compiler.layout(encoding, stats);\n\n var spec = {\n width: layout.width,\n height: layout.height,\n padding: 'auto',\n data: compiler.data(encoding),\n // global scales contains only time unit scales\n scales: compiler.time.scales(encoding),\n marks: [{\n name: 'cell',\n type: 'group',\n properties: {\n enter: {\n width: layout.cellWidth ?\n {value: layout.cellWidth} :\n {field: {group: 'width'}},\n height: layout.cellHeight ?\n {value: layout.cellHeight} :\n {field: {group: 'height'}}\n }\n }\n }]\n };\n\n var group = spec.marks[0];\n\n // marks\n var style = compiler.style(encoding, stats),\n mdefs = group.marks = marks.def(encoding, layout, style, stats),\n mdef = mdefs[mdefs.length - 1]; // TODO: remove this dirty hack by refactoring the whole flow\n\n var stack = encoding.stack();\n if (stack) {\n // modify mdef.{from,properties}\n compiler.stack(encoding, mdef, stack);\n }\n\n var lineType = marks[encoding.marktype()].line;\n\n // handle subfacets\n var details = encoding.details();\n\n if (details.length > 0 && lineType) {\n //subfacet to group stack / line together in one group\n compiler.subfacet(group, mdef, details, encoding);\n }\n\n // auto-sort line/area values\n if (lineType && encoding.config('autoSortLine')) {\n var f = (encoding.isMeasure(X) && encoding.isDimension(Y)) ? Y : X;\n if (!mdef.from) {\n mdef.from = {};\n }\n // TODO: why - ?\n mdef.from.transform = [{type: 'sort', by: '-' + encoding.fieldRef(f)}];\n }\n\n // get a flattened list of all scale names that are used in the vl spec\n var singleScaleNames = [].concat.apply([], mdefs.map(function(markProps) {\n return scale.names(markProps.properties.update);\n }));\n\n // Small Multiples\n if (encoding.has(ROW) || encoding.has(COL)) {\n spec = compiler.facet(group, encoding, layout, spec, singleScaleNames, stats);\n spec.legends = legend.defs(encoding, style);\n } else {\n group.scales = scale.defs(singleScaleNames, encoding, layout, stats);\n group.axes = [];\n if (encoding.has(X)) {\n group.axes.push(axis.def(X, encoding, layout, stats));\n }\n if (encoding.has(Y)) {\n group.axes.push(axis.def(Y, encoding, layout, stats));\n }\n\n group.legends = legend.defs(encoding, style);\n }\n\n return spec;\n};\n","'use strict';\n\nrequire('../globals');\n\nmodule.exports = data;\n\nvar vlEncDef = require('../encdef'),\n util = require('../util'),\n time = require('./time');\n\n/**\n * Create Vega's data array from a given encoding.\n *\n * @param {Encoding} encoding\n * @return {Array} Array of Vega data.\n * This always includes a \"raw\" data table.\n * If the encoding contains aggregate value, this will also create\n * aggregate table as well.\n */\nfunction data(encoding) {\n var def = [data.raw(encoding)];\n\n var aggregate = data.aggregate(encoding);\n if (aggregate) {\n def.push(data.aggregate(encoding));\n }\n\n // TODO add \"having\" filter here\n\n // append non-positive filter at the end for the data table\n data.filterNonPositive(def[def.length - 1], encoding);\n\n // Stack\n var stack = encoding.stack();\n if (stack) {\n def.push(data.stack(encoding, stack));\n }\n\n return def;\n}\n\ndata.raw = function(encoding) {\n var raw = {name: RAW};\n\n // Data source (url or inline)\n if (encoding.hasValues()) {\n raw.values = encoding.data().values;\n raw.format = {type: 'json'};\n } else {\n raw.url = encoding.data().url;\n raw.format = {type: encoding.data().formatType};\n }\n\n // Set data's format.parse if needed\n var parse = data.raw.formatParse(encoding);\n if (parse) {\n raw.format.parse = parse;\n }\n\n raw.transform = data.raw.transform(encoding);\n return raw;\n};\n\ndata.raw.formatParse = function(encoding) {\n var parse;\n\n encoding.forEach(function(encDef) {\n if (encDef.type == T) {\n parse = parse || {};\n parse[encDef.name] = 'date';\n } else if (encDef.type == Q) {\n if (vlEncDef.isCount(encDef)) return;\n parse = parse || {};\n parse[encDef.name] = 'number';\n }\n });\n\n return parse;\n};\n\n/**\n * Generate Vega transforms for the raw data table. This can include\n * transforms for time unit, binning and filtering.\n */\ndata.raw.transform = function(encoding) {\n // null filter comes first so transforms are not performed on null values\n // time and bin should come before filter so we can filter by time and bin\n return data.raw.transform.nullFilter(encoding).concat(\n data.raw.transform.formula(encoding),\n data.raw.transform.time(encoding),\n data.raw.transform.bin(encoding),\n data.raw.transform.filter(encoding)\n );\n};\n\ndata.raw.transform.time = function(encoding) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encDef.type === T && encDef.timeUnit) {\n var fieldRef = encoding.fieldRef(encType, {nofn: true, datum: true});\n\n transform.push({\n type: 'formula',\n field: encoding.fieldRef(encType),\n expr: time.formula(encDef.timeUnit, fieldRef)\n });\n }\n return transform;\n }, []);\n};\n\ndata.raw.transform.bin = function(encoding) {\n return encoding.reduce(function(transform, encDef, encType) {\n if (encoding.bin(encType)) {\n transform.push({\n type: 'bin',\n field: encDef.name,\n output: {start: encoding.fieldRef(encType)},\n maxbins: encoding.bin(encType).maxbins\n });\n }\n return transform;\n }, []);\n};\n\n/**\n * @return {Array} An array that might contain a filter transform for filtering null value based on filterNul config\n */\ndata.raw.transform.nullFilter = function(encoding) {\n var filteredFields = util.reduce(encoding.fields(),\n function(filteredFields, fieldList, fieldName) {\n if (fieldName === '*') return filteredFields; //count\n\n // TODO(#597) revise how filterNull is structured.\n if ((encoding.config('filterNull').Q && fieldList.containsType[Q]) ||\n (encoding.config('filterNull').T && fieldList.containsType[T]) ||\n (encoding.config('filterNull').O && fieldList.containsType[O]) ||\n (encoding.config('filterNull').N && fieldList.containsType[N])) {\n filteredFields.push(fieldName);\n }\n return filteredFields;\n }, []);\n\n return filteredFields.length > 0 ?\n [{\n type: 'filter',\n test: filteredFields.map(function(fieldName) {\n return 'datum.' + fieldName + '!==null';\n }).join(' && ')\n }] : [];\n};\n\ndata.raw.transform.filter = function(encoding) {\n var filter = encoding.data().filter;\n return filter ? [{\n type: 'filter',\n test: filter\n }] : [];\n};\n\ndata.raw.transform.formula = function(encoding) {\n var formulas = encoding.data().formulas;\n if (formulas === undefined) {\n return [];\n }\n\n return formulas.reduce(function(transform, formula) {\n formula.type = 'formula';\n transform.push(formula);\n return transform;\n }, []);\n};\n\ndata.aggregate = function(encoding) {\n /* dict set for dimensions */\n var dims = {};\n\n /* dictionary mapping field name => dict set of aggregation functions */\n var meas = {};\n\n var hasAggregate = false;\n\n encoding.forEach(function(encDef, encType) {\n if (encDef.aggregate) {\n hasAggregate = true;\n if (encDef.aggregate === 'count') {\n meas['*'] = meas['*'] || {};\n meas['*'].count = true;\n } else {\n meas[encDef.name] = meas[encDef.name] || {};\n meas[encDef.name][encDef.aggregate] = true;\n }\n } else {\n dims[encDef.name] = encoding.fieldRef(encType);\n }\n });\n\n var groupby = util.vals(dims);\n\n // short-format summarize object for Vega's aggregate transform\n // https://github.com/vega/vega/wiki/Data-Transforms#-aggregate\n var summarize = util.reduce(meas, function(summarize, fnDictSet, field) {\n summarize[field] = util.keys(fnDictSet);\n return summarize;\n }, {});\n\n if (hasAggregate) {\n return {\n name: AGGREGATE,\n source: RAW,\n transform: [{\n type: 'aggregate',\n groupby: groupby,\n summarize: summarize\n }]\n };\n }\n\n return null;\n};\n\n/**\n * Add stacked data source, for feeding the shared scale.\n */\ndata.stack = function(encoding, stack) {\n var dim = stack.groupby;\n var val = stack.value;\n var facets = encoding.facets();\n\n var stacked = {\n name: STACKED,\n source: encoding.dataTable(),\n transform: [{\n type: 'aggregate',\n groupby: [encoding.fieldRef(dim)].concat(facets), // dim and other facets\n summarize: [{ops: ['sum'], field: encoding.fieldRef(val)}]\n }]\n };\n\n if (facets && facets.length > 0) {\n stacked.transform.push({ //calculate max for each facet\n type: 'aggregate',\n groupby: facets,\n summarize: [{\n ops: ['max'],\n // we want max of sum from above transform\n field: encoding.fieldRef(val, {prefn: 'sum_'})\n }]\n });\n }\n return stacked;\n};\n\ndata.filterNonPositive = function(dataTable, encoding) {\n encoding.forEach(function(encDef, encType) {\n if (encoding.scale(encType).type === 'log') {\n dataTable.transform.push({\n type: 'filter',\n test: encoding.fieldRef(encType, {datum: 1}) + ' > 0'\n });\n }\n });\n};\n","'use strict';\n\nrequire('../globals');\n\nvar util = require('../util');\n\nvar axis = require('./axis'),\n scale = require('./scale');\n\nmodule.exports = faceting;\n\nfunction groupdef(name, opt) {\n opt = opt || {};\n var group = {\n name: name || undefined,\n type: 'group',\n properties: {\n enter: {\n width: opt.width || {field: {group: 'width'}},\n height: opt.height || {field: {group: 'height'}}\n }\n }\n };\n\n if (opt.from) {\n group.from = opt.from;\n }\n if (opt.x) {\n group.properties.enter.x = opt.x;\n }\n if (opt.y) {\n group.properties.enter.y = opt.y;\n }\n if (opt.axes) {\n group.axes = opt.axes;\n }\n\n return group;\n}\n\nfunction faceting(group, encoding, layout, spec, singleScaleNames, stats) {\n var enter = group.properties.enter;\n var facetKeys = [], cellAxes = [], from, axesGrp;\n\n var hasRow = encoding.has(ROW), hasCol = encoding.has(COL);\n\n enter.fill = {value: encoding.config('cellBackgroundColor')};\n\n //move \"from\" to cell level and add facet transform\n group.from = {data: group.marks[0].from.data};\n\n // Hack, this needs to be refactored\n for (var i = 0; i < group.marks.length; i++) {\n var mark = group.marks[i];\n if (mark.from.transform) {\n delete mark.from.data; //need to keep transform for subfacetting case\n } else {\n delete mark.from;\n }\n }\n\n if (hasRow) {\n if (!encoding.isDimension(ROW)) {\n util.error('Row encoding should be ordinal.');\n }\n enter.y = {scale: ROW, field: encoding.fieldRef(ROW)};\n enter.height = {'value': layout.cellHeight}; // HACK\n\n facetKeys.push(encoding.fieldRef(ROW));\n\n if (hasCol) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(COL)]});\n }\n\n axesGrp = groupdef('x-axes', {\n axes: encoding.has(X) ? [axis.def(X, encoding, layout, stats)] : undefined,\n x: hasCol ? {scale: COL, field: encoding.fieldRef(COL)} : {value: 0},\n width: hasCol && {'value': layout.cellWidth}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(ROW, encoding, layout, stats));\n } else { // doesn't have row\n if (encoding.has(X)) {\n //keep x axis in the cell\n cellAxes.push(axis.def(X, encoding, layout, stats));\n }\n }\n\n if (hasCol) {\n if (!encoding.isDimension(COL)) {\n util.error('Col encoding should be ordinal.');\n }\n enter.x = {scale: COL, field: encoding.fieldRef(COL)};\n enter.width = {'value': layout.cellWidth}; // HACK\n\n facetKeys.push(encoding.fieldRef(COL));\n\n if (hasRow) {\n from = util.duplicate(group.from);\n from.transform = from.transform || [];\n from.transform.unshift({type: 'facet', groupby: [encoding.fieldRef(ROW)]});\n }\n\n axesGrp = groupdef('y-axes', {\n axes: encoding.has(Y) ? [axis.def(Y, encoding, layout, stats)] : undefined,\n y: hasRow && {scale: ROW, field: encoding.fieldRef(ROW)},\n x: hasRow && {value: 0},\n height: hasRow && {'value': layout.cellHeight}, //HACK?\n from: from\n });\n\n spec.marks.unshift(axesGrp); // need to prepend so it appears under the plots\n (spec.axes = spec.axes || []);\n spec.axes.push(axis.def(COL, encoding, layout, stats));\n } else { // doesn't have col\n if (encoding.has(Y)) {\n cellAxes.push(axis.def(Y, encoding, layout, stats));\n }\n }\n\n // assuming equal cellWidth here\n // TODO: support heterogenous cellWidth (maybe by using multiple scales?)\n spec.scales = (spec.scales || []).concat(scale.defs(\n scale.names(enter).concat(singleScaleNames),\n encoding,\n layout,\n stats,\n true\n )); // row/col scales + cell scales\n\n if (cellAxes.length > 0) {\n group.axes = cellAxes;\n }\n\n // add facet transform\n var trans = (group.from.transform || (group.from.transform = []));\n trans.unshift({type: 'facet', groupby: facetKeys});\n\n return spec;\n}\n","'use strict';\n\nrequire('../globals');\n\nvar util = require('../util'),\n setter = util.setter,\n time = require('./time'),\n d3_format = require('d3-format');\n\nmodule.exports = vllayout;\n\nfunction vllayout(encoding, stats) {\n var layout = box(encoding, stats);\n layout = offset(encoding, stats, layout);\n return layout;\n}\n\n/*\n HACK to set chart size\n NOTE: this fails for plots driven by derived values (e.g., aggregates)\n One solution is to update Vega to support auto-sizing\n In the meantime, auto-padding (mostly) does the trick\n */\nfunction box(encoding, stats) {\n var hasRow = encoding.has(ROW),\n hasCol = encoding.has(COL),\n hasX = encoding.has(X),\n hasY = encoding.has(Y),\n marktype = encoding.marktype();\n\n // FIXME/HACK we need to take filter into account\n var xCardinality = hasX && encoding.isDimension(X) ? encoding.cardinality(X, stats) : 1,\n yCardinality = hasY && encoding.isDimension(Y) ? encoding.cardinality(Y, stats) : 1;\n\n var useSmallBand = xCardinality > encoding.config('largeBandMaxCardinality') ||\n yCardinality > encoding.config('largeBandMaxCardinality');\n\n var cellWidth, cellHeight, cellPadding = encoding.config('cellPadding');\n\n // set cellWidth\n if (hasX) {\n if (encoding.isOrdinalScale(X)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellWidth = (xCardinality + encoding.encDef(X).band.padding) * encoding.bandSize(X, useSmallBand);\n } else {\n cellWidth = hasCol || hasRow ? encoding.encDef(COL).width : encoding.config('singleWidth');\n }\n } else {\n if (marktype === TEXT) {\n cellWidth = encoding.config('textCellWidth');\n } else {\n cellWidth = encoding.bandSize(X);\n }\n }\n\n // set cellHeight\n if (hasY) {\n if (encoding.isOrdinalScale(Y)) {\n // for ordinal, hasCol or not doesn't matter -- we scale based on cardinality\n cellHeight = (yCardinality + encoding.encDef(Y).band.padding) * encoding.bandSize(Y, useSmallBand);\n } else {\n cellHeight = hasCol || hasRow ? encoding.encDef(ROW).height : encoding.config('singleHeight');\n }\n } else {\n cellHeight = encoding.bandSize(Y);\n }\n\n // Cell bands use rangeBands(). There are n-1 padding. Outerpadding = 0 for cells\n\n var width = cellWidth, height = cellHeight;\n if (hasCol) {\n var colCardinality = encoding.cardinality(COL, stats);\n width = cellWidth * ((1 + cellPadding) * (colCardinality - 1) + 1);\n }\n if (hasRow) {\n var rowCardinality = encoding.cardinality(ROW, stats);\n height = cellHeight * ((1 + cellPadding) * (rowCardinality - 1) + 1);\n }\n\n return {\n // width and height of the whole cell\n cellWidth: cellWidth,\n cellHeight: cellHeight,\n cellPadding: cellPadding,\n // width and height of the chart\n width: width,\n height: height,\n // information about x and y, such as band size\n x: {useSmallBand: useSmallBand},\n y: {useSmallBand: useSmallBand}\n };\n}\n\n\n// FIXME fieldStats.max isn't always the longest\nfunction getMaxNumberLength(encoding, et, fieldStats) {\n var format = encoding.numberFormat(et, fieldStats);\n\n return d3_format.format(format)(fieldStats.max).length;\n}\n\n// TODO(#600) revise this\nfunction getMaxLength(encoding, stats, et) {\n var encDef = encoding.encDef(et),\n fieldStats = stats[encDef.name];\n\n if (encDef.bin) {\n // TODO once bin support range, need to update this\n return getMaxNumberLength(encoding, et, fieldStats);\n } if (encoding.isType(et, Q)) {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else if (encoding.isType(et, T)) {\n return time.maxLength(encoding.encDef(et).timeUnit, encoding);\n } else if (encoding.isTypes(et, [N, O])) {\n if(fieldStats.type === 'number') {\n return getMaxNumberLength(encoding, et, fieldStats);\n } else {\n return Math.min(fieldStats.max, encoding.axis(et).maxLabelLength || Infinity);\n }\n }\n}\n\nfunction offset(encoding, stats, layout) {\n [X, Y].forEach(function (et) {\n // TODO(kanitw): Jul 19, 2015 - create a set of visual test for extraOffset\n var extraOffset = et === X ? 20 : 22,\n maxLength;\n if (encoding.isDimension(et) || encoding.isType(et, T)) {\n maxLength = getMaxLength(encoding, stats, et);\n } else if (\n // TODO once we have #512 (allow using inferred type)\n // Need to adjust condition here.\n encoding.isType(et, Q) ||\n encoding.encDef(et).aggregate === 'count'\n ) {\n if (\n et===Y\n // || (et===X && false)\n // FIXME determine when X would rotate, but should move this to axis.js first #506\n ) {\n maxLength = getMaxLength(encoding, stats, et);\n }\n } else {\n // nothing\n }\n\n if (maxLength) {\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * maxLength + extraOffset);\n } else {\n // if no max length (no rotation case), use maxLength = 3\n setter(layout,[et, 'axisTitleOffset'], encoding.config('characterWidth') * 3 + extraOffset);\n }\n\n });\n return layout;\n}\n","'use strict';\n\nrequire('../globals');\n\nvar time = require('./time'),\n util = require('../util'),\n setter = util.setter,\n getter = util.getter;\n\nvar legend = module.exports = {};\n\nlegend.defs = function(encoding, style) {\n var defs = [];\n\n if (encoding.has(COLOR) && encoding.encDef(COLOR).legend) {\n defs.push(legend.def(COLOR, encoding, {\n fill: COLOR\n }, style));\n }\n\n if (encoding.has(SIZE) && encoding.encDef(SIZE).legend) {\n defs.push(legend.def(SIZE, encoding, {\n size: SIZE\n }, style));\n }\n\n if (encoding.has(SHAPE) && encoding.encDef(SHAPE).legend) {\n defs.push(legend.def(SHAPE, encoding, {\n shape: SHAPE\n }, style));\n }\n return defs;\n};\n\nlegend.def = function(name, encoding, def, style) {\n var timeUnit = encoding.encDef(name).timeUnit;\n\n def.title = legend.title(name, encoding);\n def.orient = encoding.encDef(name).legend.orient;\n\n def = legend.style(name, encoding, def, style);\n\n if (encoding.isType(name, T) &&\n timeUnit &&\n time.hasScale(timeUnit)\n ) {\n setter(def, ['properties', 'labels', 'text', 'scale'], 'time-'+ timeUnit);\n }\n\n return def;\n};\n\nlegend.style = function(name, e, def, style) {\n var symbols = getter(def, ['properties', 'symbols']),\n marktype = e.marktype();\n\n switch (marktype) {\n case 'bar':\n case 'tick':\n case 'text':\n symbols.stroke = {value: 'transparent'};\n symbols.shape = {value: 'square'};\n break;\n\n case 'circle':\n case 'square':\n symbols.shape = {value: marktype};\n /* fall through */\n case 'point':\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR) && name === COLOR) {\n symbols.fill = {scale: COLOR, field: 'data'};\n } else {\n symbols.fill = {value: e.value(COLOR)};\n }\n symbols.stroke = {value: 'transparent'};\n } else {\n if (e.has(COLOR) && name === COLOR) {\n symbols.stroke = {scale: COLOR, field: 'data'};\n } else {\n symbols.stroke = {value: e.value(COLOR)};\n }\n symbols.fill = {value: 'transparent'};\n symbols.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n break;\n case 'line':\n case 'area':\n // TODO use shape here after implementing #508\n break;\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) {\n symbols.opacity = {value: opacity};\n }\n return def;\n};\n\nlegend.title = function(name, encoding) {\n var leg = encoding.encDef(name).legend;\n\n if (leg.title) return leg.title;\n\n return encoding.fieldTitle(name);\n};\n","'use strict';\n\nrequire('../globals');\n\nvar marks = module.exports = {};\n\nmarks.def = function(encoding, layout, style, stats) {\n\n var defs = [],\n mark = marks[encoding.marktype()],\n from = encoding.dataTable();\n\n // to add a background to text, we need to add it before the text\n if (encoding.marktype() === TEXT && encoding.has(COLOR)) {\n var bg = {\n x: {value: 0},\n y: {value: 0},\n x2: {value: layout.cellWidth},\n y2: {value: layout.cellHeight},\n fill: {scale: COLOR, field: encoding.fieldRef(COLOR)}\n };\n defs.push({\n type: 'rect',\n from: {data: from},\n properties: {enter: bg, update: bg}\n });\n }\n\n // add the mark def for the main thing\n var p = mark.prop(encoding, layout, style, stats);\n defs.push({\n type: mark.type,\n from: {data: from},\n properties: {enter: p, update: p}\n });\n\n return defs;\n};\n\nmarks.bar = {\n type: 'rect',\n prop: bar_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1}\n};\n\nmarks.line = {\n type: 'line',\n line: true,\n prop: line_props,\n requiredEncoding: ['x', 'y'],\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail:1}\n};\n\nmarks.area = {\n type: 'area',\n line: true,\n requiredEncoding: ['x', 'y'],\n prop: area_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1}\n};\n\nmarks.tick = {\n type: 'rect',\n prop: tick_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, color: 1, detail: 1}\n};\n\nmarks.circle = {\n type: 'symbol',\n prop: filled_point_props('circle'),\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, detail: 1}\n};\n\nmarks.square = {\n type: 'symbol',\n prop: filled_point_props('square'),\n supportedEncoding: marks.circle.supportedEncoding\n};\n\nmarks.point = {\n type: 'symbol',\n prop: point_props,\n supportedEncoding: {row: 1, col: 1, x: 1, y: 1, size: 1, color: 1, shape: 1, detail: 1}\n};\n\nmarks.text = {\n type: 'text',\n prop: text_props,\n requiredEncoding: ['text'],\n supportedEncoding: {row: 1, col: 1, size: 1, color: 1, text: 1}\n};\n\nfunction bar_props(e, layout, style) {\n // jshint unused:false\n\n var p = {};\n\n // x's and width\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (!e.has(Y) || e.isDimension(Y)) {\n p.x2 = {value: 0};\n }\n } else {\n if (e.has(X)) { // is ordinal\n p.xc = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0, offset: e.config('singleBarOffset')};\n }\n }\n\n // width\n if (!p.x2) {\n if (!e.has(X) || e.isOrdinalScale(X)) { // no X or X is ordinal\n if (e.has(SIZE)) {\n p.width = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.width = {\n value: e.bandSize(X, layout.x.useSmallBand),\n offset: -1\n };\n }\n } else { // X is Quant or Time Scale\n p.width = {value: 2};\n }\n }\n\n // y's & height\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {field: {group: 'height'}};\n } else {\n if (e.has(Y)) { // is ordinal\n p.yc = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y2 = {\n field: {group: 'height'},\n offset: -e.config('singleBarOffset')\n };\n }\n\n if (e.has(SIZE)) {\n p.height = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else {\n p.height = {\n value: e.bandSize(Y, layout.y.useSmallBand),\n offset: -1\n };\n }\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction point_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n if (e.has(SHAPE)) {\n p.shape = {scale: SHAPE, field: e.fieldRef(SHAPE)};\n } else if (!e.has(SHAPE)) {\n p.shape = {value: e.value(SHAPE)};\n }\n\n // fill or stroke\n if (e.encDef(SHAPE).filled) {\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n } else {\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n p.strokeWidth = {value: e.config('strokeWidth')};\n }\n\n // opacity\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction line_props(e,layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {field: {group: 'height'}};\n }\n\n // stroke\n if (e.has(COLOR)) {\n p.stroke = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.stroke = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n p.strokeWidth = {value: e.config('strokeWidth')};\n\n return p;\n}\n\nfunction area_props(e, layout, style) {\n // jshint unused:false\n var p = {};\n\n // x\n if (e.isMeasure(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(Y)) {\n p.x2 = {scale: X, value: 0};\n p.orient = {value: 'horizontal'};\n }\n } else if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else {\n p.x = {value: 0};\n }\n\n // y\n if (e.isMeasure(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n p.y2 = {scale: Y, value: 0};\n } else if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else {\n p.y = {field: {group: 'height'}};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity;\n if (opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction tick_props(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n if (e.isDimension(X)) {\n p.x.offset = -e.bandSize(X, layout.x.useSmallBand) / 3;\n }\n } else if (!e.has(X)) {\n p.x = {value: 0};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n if (e.isDimension(Y)) {\n p.y.offset = -e.bandSize(Y, layout.y.useSmallBand) / 3;\n }\n } else if (!e.has(Y)) {\n p.y = {value: 0};\n }\n\n // width\n if (!e.has(X) || e.isDimension(X)) {\n p.width = {value: e.bandSize(X, layout.y.useSmallBand) / 1.5};\n } else {\n p.width = {value: 1};\n }\n\n // height\n if (!e.has(Y) || e.isDimension(Y)) {\n p.height = {value: e.bandSize(Y, layout.y.useSmallBand) / 1.5};\n } else {\n p.height = {value: 1};\n }\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n}\n\nfunction filled_point_props(shape) {\n return function(e, layout, style) {\n var p = {};\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.size = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(X)) {\n p.size = {value: e.value(SIZE)};\n }\n\n // shape\n p.shape = {value: shape};\n\n // fill\n if (e.has(COLOR)) {\n p.fill = {scale: COLOR, field: e.fieldRef(COLOR)};\n } else if (!e.has(COLOR)) {\n p.fill = {value: e.value(COLOR)};\n }\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n return p;\n };\n}\n\nfunction text_props(e, layout, style, stats) {\n var p = {},\n encDef = e.encDef(TEXT);\n\n // x\n if (e.has(X)) {\n p.x = {scale: X, field: e.fieldRef(X)};\n } else if (!e.has(X)) {\n if (e.has(TEXT) && e.isType(TEXT, Q)) {\n p.x = {value: layout.cellWidth-5};\n } else {\n p.x = {value: e.bandSize(X, layout.x.useSmallBand) / 2};\n }\n }\n\n // y\n if (e.has(Y)) {\n p.y = {scale: Y, field: e.fieldRef(Y)};\n } else if (!e.has(Y)) {\n p.y = {value: e.bandSize(Y, layout.y.useSmallBand) / 2};\n }\n\n // size\n if (e.has(SIZE)) {\n p.fontSize = {scale: SIZE, field: e.fieldRef(SIZE)};\n } else if (!e.has(SIZE)) {\n p.fontSize = {value: encDef.font.size};\n }\n\n // fill\n // color should be set to background\n p.fill = {value: encDef.color};\n\n var opacity = e.encDef(COLOR).opacity || style.opacity;\n if(opacity) p.opacity = {value: opacity};\n\n // text\n if (e.has(TEXT)) {\n if (e.isType(TEXT, Q)) {\n var fieldStats = stats[e.encDef(TEXT).name],\n numberFormat = encDef.format || e.numberFormat(fieldStats);\n\n p.text = {template: '{{' + e.fieldRef(TEXT, {datum: true}) + ' | number:\\'' +\n numberFormat +'\\'}}'};\n p.align = {value: encDef.align};\n } else {\n p.text = {field: e.fieldRef(TEXT)};\n }\n } else {\n p.text = {value: encDef.placeholder};\n }\n\n p.font = {value: encDef.font.family};\n p.fontWeight = {value: encDef.font.weight};\n p.fontStyle = {value: encDef.font.style};\n p.baseline = {value: encDef.baseline};\n\n return p;\n}\n","'use strict';\nrequire('../globals');\nvar util = require('../util'),\n time = require('./time'),\n colorbrewer = require('colorbrewer'),\n interpolate = require('d3-color').interpolateHsl,\n schema = require('../schema/schema');\n\nvar scale = module.exports = {};\n\nscale.names = function(props) {\n return util.keys(util.keys(props).reduce(function(a, x) {\n if (props[x] && props[x].scale) a[props[x].scale] = 1;\n return a;\n }, {}));\n};\n\nscale.defs = function(names, encoding, layout, stats, facet) {\n return names.reduce(function(a, name) {\n var scaleDef = {};\n\n scaleDef.name = name;\n scaleDef.type = scale.type(name, encoding);\n scaleDef.domain = scale.domain(encoding, name, scaleDef.type, stats, facet);\n\n // add `reverse` if applicable\n var reverse = scale.reverse(encoding, name);\n if (reverse) {\n scaleDef.reverse = reverse;\n }\n\n scaleDef = scale.range(scaleDef, encoding, layout, stats);\n\n return (a.push(scaleDef), a);\n }, []);\n};\n\nscale.type = function(name, encoding) {\n switch (encoding.type(name)) {\n case N: //fall through\n case O: return 'ordinal';\n case T:\n var timeUnit = encoding.encDef(name).timeUnit;\n return timeUnit ? time.scale.type(timeUnit, name) : 'time';\n case Q:\n if (encoding.bin(name)) {\n // TODO: revise this\n return name === COLOR ? 'linear' : 'ordinal';\n }\n return encoding.scale(name).type;\n }\n};\n\nscale.domain = function (encoding, name, type, stats, facet) {\n var encDef = encoding.encDef(name);\n\n // special case for temporal scale\n if (encoding.isType(name, T)) {\n var range = time.scale.domain(encDef.timeUnit, name);\n if (range) return range;\n }\n\n // For binned, produce fixed stepped domain.\n // TODO(#614): this must be changed in vg2\n if (encDef.bin) {\n\n var fieldStat = stats[encDef.name],\n bins = util.getbins(fieldStat, encDef.bin.maxbins || schema.MAXBINS_DEFAULT),\n numbins = (bins.stop - bins.start) / bins.step;\n return util.range(numbins).map(function(i) {\n return bins.start + bins.step * i;\n });\n }\n\n // For stack, use STACKED data.\n var stack = encoding.stack();\n if (stack && name === stack.value) {\n return {\n data: STACKED,\n field: encoding.fieldRef(name, {\n // If faceted, scale is determined by the max of sum in each facet.\n prefn: (facet ? 'max_' : '') + 'sum_'\n })\n };\n }\n\n var useRawDomain = scale._useRawDomain(encoding, name);\n var sort = scale.sort(encoding, name, type);\n\n if (useRawDomain) {\n return {\n data: RAW,\n field: encoding.fieldRef(name, {noAggregate:true})\n };\n } else if (sort) { // have sort\n return {\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: sort.op ? RAW : encoding.dataTable(),\n field: encoding.fieldRef(name),\n sort: sort\n };\n } else {\n return {\n data: encoding.dataTable(),\n field: encoding.fieldRef(name)\n };\n }\n};\n\nscale.sort = function(encoding, name, type) {\n var sort = encoding.encDef(name).sort;\n if (sort === 'ascending' || sort === 'descending') {\n return true;\n }\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (type === 'ordinal' && util.isObject(sort)) {\n return {\n op: sort.op,\n field: sort.field\n };\n }\n return undefined;\n};\n\nscale.reverse = function(encoding, name) {\n var sort = encoding.encDef(name).sort;\n return sort && (sort === 'descending' || (sort.order === 'descending'));\n};\n\n/**\n * Determine if useRawDomain should be activated for this scale.\n * @return {Boolean} Returns true if all of the following conditons applies:\n * 1. `useRawDomain` is enabled either through scale or config\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nscale._useRawDomain = function (encoding, name) {\n var encDef = encoding.encDef(name);\n\n // scale value\n var scaleUseRawDomain = encoding.scale(name).useRawDomain;\n\n // Determine if useRawDomain is enabled. If scale value is specified, use scale value.\n // Otherwise, use config value.\n var useRawDomainEnabled = scaleUseRawDomain !== undefined ?\n scaleUseRawDomain : encoding.config('useRawDomain');\n\n var notCountOrSum = !encDef.aggregate ||\n (encDef.aggregate !=='count' && encDef.aggregate !== 'sum');\n\n return useRawDomainEnabled &&\n notCountOrSum && (\n // Q always uses quantitative scale except when it's binned and thus uses ordinal scale.\n (\n encoding.isType(name, Q) &&\n !encDef.bin // TODO(#614): this must be changed once bin is reimplemented\n ) ||\n // TODO: revise this\n // T uses non-ordinal scale when there's no unit or when the unit is not ordinal.\n (\n encoding.isType(name, T) &&\n (!encDef.timeUnit || !time.isOrdinalFn(encDef.timeUnit))\n )\n );\n};\n\n\nscale.range = function (scaleDef, encoding, layout, stats) {\n var spec = encoding.scale(scaleDef.name),\n encDef = encoding.encDef(scaleDef.name),\n timeUnit = encDef.timeUnit;\n\n switch (scaleDef.name) {\n case X:\n scaleDef.range = layout.cellWidth ? [0, layout.cellWidth] : 'width';\n if (scaleDef.type === 'ordinal') {\n scaleDef.bandWidth = encoding.bandSize(X, layout.x.useSmallBand);\n } else {\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n scaleDef.round = true;\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case Y:\n if (scaleDef.type === 'ordinal') {\n scaleDef.range = layout.cellHeight ?\n (encDef.bin ? [layout.cellHeight, 0] : [0, layout.cellHeight]) :\n 'height';\n scaleDef.bandWidth = encoding.bandSize(Y, layout.y.useSmallBand);\n } else {\n scaleDef.range = layout.cellHeight ? [layout.cellHeight, 0] : 'height';\n if (encoding.isType(scaleDef.name,T) && timeUnit === 'year') {\n scaleDef.zero = false;\n } else {\n scaleDef.zero = spec.zero === undefined ? true : spec.zero;\n }\n }\n\n scaleDef.round = true;\n\n if (scaleDef.type === 'time') {\n scaleDef.nice = timeUnit || encoding.config('timeScaleNice');\n }else {\n scaleDef.nice = true;\n }\n break;\n case ROW: // support only ordinal\n scaleDef.bandWidth = layout.cellHeight;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case COL: // support only ordinal\n scaleDef.bandWidth = layout.cellWidth;\n scaleDef.round = true;\n scaleDef.nice = true;\n break;\n case SIZE:\n if (encoding.is('bar')) {\n // FIXME this is definitely incorrect\n // but let's fix it later since bar size is a bad encoding anyway\n scaleDef.range = [3, Math.max(encoding.bandSize(X), encoding.bandSize(Y))];\n } else if (encoding.is(TEXT)) {\n scaleDef.range = [8, 40];\n } else { //point\n var bandSize = Math.min(encoding.bandSize(X), encoding.bandSize(Y)) - 1;\n scaleDef.range = [10, 0.8 * bandSize*bandSize];\n }\n scaleDef.round = true;\n scaleDef.zero = false;\n break;\n case SHAPE:\n scaleDef.range = 'shapes';\n break;\n case COLOR:\n scaleDef.range = scale.color(scaleDef, encoding, stats);\n if (scaleDef.type !== 'ordinal') scaleDef.zero = false;\n break;\n default:\n throw new Error('Unknown encoding name: '+ scaleDef.name);\n }\n\n // FIXME(kanitw): Jul 29, 2015 - consolidate this with above\n switch (scaleDef.name) {\n case ROW:\n case COL:\n scaleDef.padding = encoding.config('cellPadding');\n scaleDef.outerPadding = 0;\n break;\n case X:\n case Y:\n if (scaleDef.type === 'ordinal') { //&& !s.bandWidth\n scaleDef.points = true;\n scaleDef.padding = encoding.encDef(scaleDef.name).band.padding;\n }\n }\n\n return scaleDef;\n};\n\nscale.color = function(s, encoding, stats) {\n var colorScale = encoding.scale(COLOR),\n range = colorScale.range,\n cardinality = encoding.cardinality(COLOR, stats),\n type = encoding.type(COLOR);\n\n if (range === undefined) {\n var ordinalPalette = colorScale.ordinalPalette,\n quantitativeRange = colorScale.quantitativeRange;\n\n if (s.type === 'ordinal') {\n if (type === N) {\n // use categorical color scale\n if (cardinality <= 10) {\n range = colorScale.c10palette;\n } else {\n range = colorScale.c20palette;\n }\n return scale.color.palette(range, cardinality, type);\n } else {\n if (ordinalPalette) {\n return scale.color.palette(ordinalPalette, cardinality, type);\n }\n return scale.color.interpolate(quantitativeRange[0], quantitativeRange[1], cardinality);\n }\n } else { //time or quantitative\n return [quantitativeRange[0], quantitativeRange[1]];\n }\n }\n};\n\nscale.color.palette = function(range, cardinality, type) {\n // FIXME(kanitw): Jul 29, 2015 - check range is string\n switch (range) {\n case 'category10k':\n // tableau's category 10, ordered by perceptual kernel study results\n // https://github.com/uwdata/perceptual-kernels\n return ['#2ca02c', '#e377c2', '#7f7f7f', '#17becf', '#8c564b', '#d62728', '#bcbd22', '#9467bd', '#ff7f0e', '#1f77b4'];\n\n // d3/tableau category10/20/20b/20c\n case 'category10':\n return ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'];\n\n case 'category20':\n return ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'];\n\n case 'category20b':\n return ['#393b79', '#5254a3', '#6b6ecf', '#9c9ede', '#637939', '#8ca252', '#b5cf6b', '#cedb9c', '#8c6d31', '#bd9e39', '#e7ba52', '#e7cb94', '#843c39', '#ad494a', '#d6616b', '#e7969c', '#7b4173', '#a55194', '#ce6dbd', '#de9ed6'];\n\n case 'category20c':\n return ['#3182bd', '#6baed6', '#9ecae1', '#c6dbef', '#e6550d', '#fd8d3c', '#fdae6b', '#fdd0a2', '#31a354', '#74c476', '#a1d99b', '#c7e9c0', '#756bb1', '#9e9ac8', '#bcbddc', '#dadaeb', '#636363', '#969696', '#bdbdbd', '#d9d9d9'];\n }\n\n // TODO add our own set of custom ordinal color palette\n\n if (range in colorbrewer) {\n var palette = colorbrewer[range];\n\n // if cardinality pre-defined, use it.\n if (cardinality in palette) return palette[cardinality];\n\n // if not, use the highest cardinality one for nominal\n if (type === N) {\n return palette[Math.max.apply(null, util.keys(palette))];\n }\n\n // otherwise, interpolate\n var ps = cardinality < 3 ? 3 : Math.max.apply(null, util.keys(palette)),\n from = 0 , to = ps - 1;\n // FIXME add config for from / to\n\n return scale.color.interpolate(palette[ps][from], palette[ps][to], cardinality);\n }\n\n return range;\n};\n\nscale.color.interpolate = function (start, end, cardinality) {\n\n var interpolator = interpolate(start, end);\n return util.range(cardinality).map(function(i) { return interpolator(i*1.0/(cardinality-1)); });\n};\n","'use strict';\n\nrequire('../globals');\n\nmodule.exports = stacking;\n\nfunction stacking(encoding, mdef, stack) {\n var groupby = stack.groupby;\n var field = stack.value;\n\n var valName = encoding.fieldRef(field);\n var startField = valName + '_start';\n var endField = valName + '_end';\n\n // add stack transform to mark\n var transform = {\n type: 'stack',\n groupby: [encoding.fieldRef(groupby)],\n field: encoding.fieldRef(field),\n sortby: [(stack.properties.reverse ? '-' : '') + encoding.fieldRef(stack.stack)],\n output: {start: startField, end: endField}\n };\n\n if (stack.properties.offset) {\n transform.offset = stack.properties.offset;\n }\n\n mdef.from.transform = [transform];\n\n // TODO(#276): This is super hack-ish -- consolidate into modular mark properties?\n mdef.properties.update[field] = mdef.properties.enter[field] = {\n scale: field,\n field: startField\n };\n mdef.properties.update[field + '2'] = mdef.properties.enter[field + '2'] = {\n scale: field,\n field: endField\n };\n\n return field; //return stack encoding\n}\n","'use strict';\n\nrequire('../globals');\n\nvar vlEncDef = require('../encdef');\n\nmodule.exports = function(encoding, stats) {\n return {\n opacity: estimateOpacity(encoding, stats),\n };\n};\n\nfunction estimateOpacity(encoding,stats) {\n if (!stats) {\n return 1;\n }\n\n var numPoints = 0;\n\n if (encoding.isAggregate()) { // aggregate plot\n numPoints = 1;\n\n // get number of points in each \"cell\"\n // by calculating product of cardinality\n // for each non faceting and non-ordinal X / Y fields\n // note that ordinal x,y are not include since we can\n // consider that ordinal x are subdividing the cell into subcells anyway\n encoding.forEach(function(encDef, encType) {\n\n if (encType !== ROW && encType !== COL &&\n !((encType === X || encType === Y) &&\n vlEncDef.isOrdinalScale(encDef))\n ) {\n numPoints *= encoding.cardinality(encType, stats);\n }\n });\n\n } else { // raw plot\n\n // TODO: error handling\n if (!stats['*'])\n return 1;\n\n numPoints = stats['*'].max; // count\n\n // small multiples divide number of points\n var numMultiples = 1;\n if (encoding.has(ROW)) {\n numMultiples *= encoding.cardinality(ROW, stats);\n }\n if (encoding.has(COL)) {\n numMultiples *= encoding.cardinality(COL, stats);\n }\n numPoints /= numMultiples;\n }\n\n var opacity = 0;\n if (numPoints <= 25) {\n opacity = 1;\n } else if (numPoints < 200) {\n opacity = 0.8;\n } else if (numPoints < 1000 || encoding.is('tick')) {\n opacity = 0.7;\n } else {\n opacity = 0.3;\n }\n\n return opacity;\n}\n\n","'use strict';\n\nrequire('../globals');\n\nmodule.exports = subfaceting;\n\nfunction subfaceting(group, mdef, details, encoding) {\n var m = group.marks;\n var g = {\n name: 'subfacet',\n type: 'group',\n from: mdef.from,\n properties: {\n enter: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n marks: m\n };\n\n group.marks = [g];\n delete mdef.from; // (move to the new g)\n\n //TODO test LOD -- we should support stack / line without color (LOD) field\n var trans = (g.from.transform || (g.from.transform = []));\n trans.push({type: 'facet', groupby: details});\n\n // TODO: understand why we need this sort transform and write comment\n var stack = encoding.stack();\n if (stack && encoding.has(COLOR)) {\n trans.unshift({type: 'sort', by: encoding.fieldRef(COLOR)});\n }\n}\n","'use strict';\n\nvar util = require('../util'),\n d3_time_format = require('d3-time-format');\n\nvar time = module.exports = {};\n\n// 'Wednesday September 17 04:00:00 2014'\n// Wednesday is the longest date\n// September is the longest month (8 in javascript as it is zero-indexed).\nvar LONG_DATE = new Date(Date.UTC(2014, 8, 17));\n\ntime.cardinality = function(encDef, stats, filterNull, type) {\n var timeUnit = encDef.timeUnit;\n switch (timeUnit) {\n case 'seconds': return 60;\n case 'minutes': return 60;\n case 'hours': return 24;\n case 'day': return 7;\n case 'date': return 31;\n case 'month': return 12;\n case 'year':\n var stat = stats[encDef.name],\n yearstat = stats['year_' + encDef.name];\n\n if (!yearstat) { return null; }\n\n return yearstat.distinct -\n (stat.missing > 0 && filterNull[type] ? 1 : 0);\n }\n\n return null;\n};\n\ntime.formula = function(timeUnit, fieldRef) {\n // TODO(kanitw): add formula to other time format\n var fn = 'utc' + timeUnit;\n return fn + '(' + fieldRef + ')';\n};\n\ntime.maxLength = function(timeUnit, encoding) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'date':\n return 2;\n case 'month':\n case 'day':\n var range = time.range(timeUnit, encoding);\n if (range) {\n // return the longest name in the range\n return Math.max.apply(null, range.map(function(r) {return r.length;}));\n }\n return 2;\n case 'year':\n return 4; //'1998'\n }\n // TODO(#600) revise this\n // no time unit\n var timeFormat = encoding.config('timeFormat');\n return d3_time_format.utcFormat(timeFormat)(LONG_DATE).length;\n};\n\ntime.range = function(timeUnit, encoding) {\n var labelLength = encoding.config('timeScaleLabelLength'),\n scaleLabel;\n switch (timeUnit) {\n case 'day':\n scaleLabel = encoding.config('dayScaleLabel');\n break;\n case 'month':\n scaleLabel = encoding.config('monthScaleLabel');\n break;\n }\n if (scaleLabel) {\n return labelLength ? scaleLabel.map(\n function(s) { return s.substr(0, labelLength);}\n ) : scaleLabel;\n }\n return;\n};\n\n\n/**\n * @param {Object} encoding\n * @return {Array} scales for time unit names\n */\ntime.scales = function(encoding) {\n var scales = encoding.reduce(function(scales, encDef) {\n var timeUnit = encDef.timeUnit;\n if (encDef.type === T && timeUnit && !scales[timeUnit]) {\n var scale = time.scale.def(encDef.timeUnit, encoding);\n if (scale) scales[timeUnit] = scale;\n }\n return scales;\n }, {});\n\n return util.vals(scales);\n};\n\n\ntime.scale = {};\n\n/** append custom time scales for axis label */\ntime.scale.def = function(timeUnit, encoding) {\n var range = time.range(timeUnit, encoding);\n\n if (range) {\n return {\n name: 'time-'+timeUnit,\n type: 'ordinal',\n domain: time.scale.domain(timeUnit),\n range: range\n };\n }\n return null;\n};\n\ntime.isOrdinalFn = function(timeUnit) {\n switch (timeUnit) {\n case 'seconds':\n case 'minutes':\n case 'hours':\n case 'day':\n case 'date':\n case 'month':\n return true;\n }\n return false;\n};\n\ntime.scale.type = function(timeUnit, name) {\n if (name === COLOR) {\n return 'linear'; // time has order, so use interpolated ordinal color scale.\n }\n\n return time.isOrdinalFn(timeUnit) || name === COL || name === ROW ? 'ordinal' : 'linear';\n};\n\ntime.scale.domain = function(timeUnit, name) {\n var isColor = name === COLOR;\n switch (timeUnit) {\n case 'seconds':\n case 'minutes': return isColor ? [0,59] : util.range(0, 60);\n case 'hours': return isColor ? [0,23] : util.range(0, 24);\n case 'day': return isColor ? [0,6] : util.range(0, 7);\n case 'date': return isColor ? [1,31] : util.range(1, 32);\n case 'month': return isColor ? [0,11] : util.range(0, 12);\n }\n return null;\n};\n\n/** whether a particular time function has custom scale for labels implemented in time.scale */\ntime.hasScale = function(timeUnit) {\n switch (timeUnit) {\n case 'day':\n case 'month':\n return true;\n }\n return false;\n};\n","'use strict';\n\nrequire('./globals');\n\nvar consts = module.exports = {};\n\nconsts.encodingTypes = [X, Y, ROW, COL, SIZE, SHAPE, COLOR, TEXT, DETAIL];\n\nconsts.shorthand = {\n delim: '|',\n assign: '=',\n type: ',',\n func: '_'\n};\n","'use strict';\n\nrequire('./globals');\n\nvar stats = require('datalib/src/stats');\n\nvar vldata = module.exports = {};\n\n/** Mapping from datalib's inferred type to Vega-lite's type */\nvldata.types = {\n 'boolean': N,\n 'number': Q,\n 'integer': Q,\n 'date': T,\n 'string': N\n};\n\nvldata.stats = function(data) {\n var summary = stats.summary(data);\n\n return summary.reduce(function(s, profile) {\n s[profile.field] = profile;\n return s;\n }, {\n '*': {\n max: data.length,\n min: 0\n }\n });\n};","// utility for enc\n\n'use strict';\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n vlEncDef = require('./encdef'),\n util = require('./util'),\n schema = require('./schema/schema'),\n encTypes = schema.encTypes;\n\nvar vlenc = module.exports = {};\n\nvlenc.countRetinal = function(enc) {\n var count = 0;\n if (enc.color) count++;\n if (enc.size) count++;\n if (enc.shape) count++;\n return count;\n};\n\nvlenc.has = function(enc, encType) {\n var fieldDef = enc && enc[encType];\n return fieldDef && fieldDef.name;\n};\n\nvlenc.isAggregate = function(enc) {\n for (var k in enc) {\n if (vlenc.has(enc, k) && enc[k].aggregate) {\n return true;\n }\n }\n return false;\n};\n\nvlenc.forEach = function(enc, f) {\n var i = 0;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n f(enc[k], k, i++);\n }\n });\n};\n\nvlenc.map = function(enc, f) {\n var arr = [];\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n arr.push(f(enc[k], k, enc));\n }\n });\n return arr;\n};\n\nvlenc.reduce = function(enc, f, init) {\n var r = init;\n encTypes.forEach(function(k) {\n if (vlenc.has(enc, k)) {\n r = f(r, enc[k], k, enc);\n }\n });\n return r;\n};\n\n/*\n * return key-value pairs of field name and list of fields of that field name\n */\nvlenc.fields = function(enc) {\n return vlenc.reduce(enc, function (m, field) {\n var fieldList = m[field.name] = m[field.name] || [],\n containsType = fieldList.containsType = fieldList.containsType || {};\n\n if (fieldList.indexOf(field) === -1) {\n fieldList.push(field);\n // augment the array with containsType.Q / O / N / T\n containsType[field.type] = true;\n }\n return m;\n }, {});\n};\n\nvlenc.shorthand = function(enc) {\n return vlenc.map(enc, function(field, et) {\n return et + c.assign + vlEncDef.shorthand(field);\n }).join(c.delim);\n};\n\nvlenc.fromShorthand = function(shorthand) {\n var enc = util.isArray(shorthand) ? shorthand : shorthand.split(c.delim);\n return enc.reduce(function(m, e) {\n var split = e.split(c.assign),\n enctype = split[0].trim(),\n field = split[1];\n\n m[enctype] = vlEncDef.fromShorthand(field);\n return m;\n }, {});\n};\n","'use strict';\n\n// utility for field\n\nrequire('./globals');\n\nvar consts = require('./consts'),\n c = consts.shorthand,\n time = require('./compiler/time'),\n util = require('./util'),\n schema = require('./schema/schema');\n\nvar vlfield = module.exports = {};\n\n/**\n * @param field\n * @param opt\n * opt.nofn -- exclude bin, aggregate, timeUnit\n * opt.noAggregate -- exclude aggregation function\n * opt.datum - include 'datum.'\n * opt.fn - replace fn with custom function prefix\n * opt.prefn - prepend fn with custom function prefix\n\n * @return {[type]} [description]\n */\nvlfield.fieldRef = function(field, opt) {\n opt = opt || {};\n\n var f = (opt.datum ? 'datum.' : '') + (opt.prefn || ''),\n name = field.name;\n\n if (vlfield.isCount(field)) {\n return f + 'count';\n } else if (opt.fn) {\n return f + opt.fn + '_' + name;\n } else if (!opt.nofn && field.bin) {\n return f + 'bin_' + name;\n } else if (!opt.nofn && !opt.noAggregate && field.aggregate) {\n return f + field.aggregate + '_' + name;\n } else if (!opt.nofn && field.timeUnit) {\n return f + field.timeUnit + '_' + name;\n } else {\n return f + name;\n }\n};\n\nvlfield.shorthand = function(f) {\n var c = consts.shorthand;\n return (f.aggregate ? f.aggregate + c.func : '') +\n (f.timeUnit ? f.timeUnit + c.func : '') +\n (f.bin ? 'bin' + c.func : '') +\n (f.name || '') + c.type + f.type;\n};\n\nvlfield.shorthands = function(fields, delim) {\n delim = delim || c.delim;\n return fields.map(vlfield.shorthand).join(delim);\n};\n\nvlfield.fromShorthand = function(shorthand) {\n var split = shorthand.split(c.type), i;\n var o = {\n name: split[0].trim(),\n type: split[1].trim()\n };\n\n // check aggregate type\n for (i in schema.aggregate.enum) {\n var a = schema.aggregate.enum[i];\n if (o.name.indexOf(a + '_') === 0) {\n o.name = o.name.substr(a.length + 1);\n if (a == 'count' && o.name.length === 0) o.name = '*';\n o.aggregate = a;\n break;\n }\n }\n\n // check time timeUnit\n for (i in schema.timefns) {\n var tu = schema.timefns[i];\n if (o.name && o.name.indexOf(tu + '_') === 0) {\n o.name = o.name.substr(o.length + 1);\n o.timeUnit = tu;\n break;\n }\n }\n\n // check bin\n if (o.name && o.name.indexOf('bin_') === 0) {\n o.name = o.name.substr(4);\n o.bin = true;\n }\n\n return o;\n};\n\nvar isType = vlfield.isType = function (fieldDef, type) {\n return fieldDef.type === type;\n};\n\nvar isTypes = vlfield.isTypes = function (fieldDef, types) {\n for (var t=0; t 0 && filterNull[type] ? 1 : 0);\n};\n","'use strict';\n\n// declare global constant\nvar g = global || window;\n\ng.AGGREGATE = 'aggregate';\ng.RAW = 'raw';\ng.STACKED = 'stacked';\ng.INDEX = 'index';\n\ng.X = 'x';\ng.Y = 'y';\ng.ROW = 'row';\ng.COL = 'col';\ng.SIZE = 'size';\ng.SHAPE = 'shape';\ng.COLOR = 'color';\ng.TEXT = 'text';\ng.DETAIL = 'detail';\n\ng.N = 'N';\ng.O = 'O';\ng.Q = 'Q';\ng.T = 'T';\n","'use strict';\n\n// TODO(kanitw): chat with Vega team and possibly move this to vega-logging\nmodule.exports = function(prefix) {\n // Borrowed some ideas from http://stackoverflow.com/a/15653260/866989\n // and https://github.com/patik/console.log-wrapper/blob/master/consolelog.js\n var METHODS = ['error', 'info', 'debug', 'warn', 'log'];\n\n return METHODS.reduce(function(logger, fn) {\n var cfn = console[fn] ? fn : 'log';\n if (console[cfn].bind === 'undefined') { // IE < 10\n logger[fn] = Function.prototype.bind.call(console[cfn], console, prefix);\n }\n else {\n logger[fn] = console[cfn].bind(console, prefix);\n }\n return logger;\n }, {});\n};","// Package of defining Vega-lite Specification's json schema\n'use strict';\n\nrequire('../globals');\n\nvar schema = module.exports = {},\n util = require('../util'),\n toMap = util.toMap,\n colorbrewer = require('colorbrewer');\n\nvar VALID_AGG_OPS = require('vega/src/transforms/Aggregate').VALID_OPS;\n\n// TODO(#620) refer to vega schema\n// var vgStackSchema = require('vega/src/transforms/Stack').schema;\n\n\nschema.util = require('./schemautil');\n\nschema.marktype = {\n type: 'string',\n enum: ['point', 'tick', 'bar', 'line', 'area', 'circle', 'square', 'text']\n};\n\nschema.aggregate = {\n type: 'string',\n enum: VALID_AGG_OPS,\n supportedEnums: {\n Q: VALID_AGG_OPS,\n O: ['median','min','max'],\n N: [],\n T: ['mean', 'median', 'min', 'max'],\n '': ['count']\n },\n supportedTypes: toMap([Q, N, O, T, ''])\n};\n\nschema.getSupportedRole = function(encType) {\n return schema.schema.properties.encoding.properties[encType].supportedRole;\n};\n\nschema.timeUnits = ['year', 'month', 'day', 'date', 'hours', 'minutes', 'seconds'];\n\nschema.defaultTimeFn = 'month';\n\nschema.timeUnit = {\n type: 'string',\n enum: schema.timeUnits,\n supportedTypes: toMap([T])\n};\n\nschema.scale_type = {\n type: 'string',\n // TODO(kanitw) read vega's schema here, add description\n enum: ['linear', 'log', 'pow', 'sqrt', 'quantile'],\n default: 'linear',\n supportedTypes: toMap([Q])\n};\n\nschema.field = {\n type: 'object',\n properties: {\n name: {\n type: 'string'\n }\n }\n};\n\nvar clone = util.duplicate;\nvar merge = schema.util.merge;\n\nschema.MAXBINS_DEFAULT = 15;\n\nvar bin = {\n type: ['boolean', 'object'],\n default: false,\n properties: {\n maxbins: {\n type: 'integer',\n default: schema.MAXBINS_DEFAULT,\n minimum: 2,\n description: 'Maximum number of bins.'\n }\n },\n supportedTypes: toMap([Q]) // TODO: add O after finishing #81\n};\n\nvar typicalField = merge(clone(schema.field), {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T]\n },\n aggregate: schema.aggregate,\n timeUnit: schema.timeUnit,\n bin: bin,\n scale: {\n type: 'object',\n properties: {\n /* Common Scale Properties */\n type: schema.scale_type,\n\n /* Quantitative Scale Properties */\n nice: {\n type: 'string',\n enum: ['second', 'minute', 'hour', 'day', 'week', 'month', 'year'],\n supportedTypes: toMap([T])\n },\n zero: {\n type: 'boolean',\n description: 'Include zero',\n default: true,\n supportedTypes: toMap([Q, T])\n },\n\n /* Vega-lite only Properties */\n useRawDomain: {\n type: 'boolean',\n default: undefined,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n }\n }\n});\n\nvar onlyOrdinalField = merge(clone(schema.field), {\n type: 'object',\n supportedRole: {\n dimension: true\n },\n properties: {\n type: {\n type: 'string',\n enum: [N, O, Q, T] // ordinal-only field supports Q when bin is applied and T when time unit is applied.\n },\n timeUnit: schema.timeUnit,\n bin: bin,\n aggregate: {\n type: 'string',\n enum: ['count'],\n supportedTypes: toMap([N, O]) // FIXME this looks weird to me\n }\n }\n});\n\nvar axisMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true},\n properties: {\n axis: {\n type: 'object',\n properties: {\n /* Vega Axis Properties */\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for axis labels. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n grid: {\n type: 'boolean',\n default: undefined,\n description: 'A flag indicate if gridlines should be created in addition to ticks. If `grid` is unspecified, the default value is `true` for ROW and COL. For X and Y, the default value is `true` for quantitative and time fields and `false` otherwise.'\n },\n layer: {\n type: 'string',\n default: 'back',\n description: 'A string indicating if the axis (and any gridlines) should be placed above or below the data marks. One of \"front\" (default) or \"back\".'\n },\n orient: {\n type: 'string',\n default: undefined,\n enum: ['top', 'right', 'left', 'bottom'],\n 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 for the right edge of the chart).'\n },\n ticks: {\n type: 'integer',\n default: 5,\n minimum: 0,\n 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 },\n /* Vega Axis Properties that are automatically populated by Vega-lite */\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the axis. (Shows field name and its function by default.)'\n },\n /* Vega-lite only */\n maxLabelLength: {\n type: 'integer',\n default: 25,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n },\n labelAngle: {\n type: 'integer',\n default: undefined, // auto\n minimum: 0,\n maximum: 360,\n description: 'Angle by which to rotate labels. Set to 0 to force horizontal.'\n },\n titleMaxLength: {\n type: 'integer',\n default: undefined,\n minimum: 0,\n description: 'Max length for axis title if the title is automatically generated from the field\\'s description'\n },\n titleOffset: {\n type: 'integer',\n default: undefined, // auto\n description: 'A title offset value for the axis.'\n },\n }\n }\n }\n};\n\nvar sortMixin = {\n type: 'object',\n properties: {\n sort: {\n default: 'ascending',\n supportedTypes: toMap([N, O]),\n oneOf: [\n {\n type: 'string',\n enum: ['ascending', 'descending', 'unsorted']\n },\n { // sort by aggregation of another field\n type: 'object',\n required: ['field', 'op'],\n properties: {\n field: {\n type: 'string',\n description: 'The field name to aggregate over.'\n },\n op: {\n type: 'string',\n enum: VALID_AGG_OPS,\n description: 'The field name to aggregate over.'\n },\n order: {\n type: 'string',\n enum: ['ascending', 'descending']\n }\n }\n }\n ]\n\n }\n }\n};\n\nvar bandMixin = {\n type: 'object',\n properties: {\n band: {\n type: 'object',\n properties: {\n size: {\n type: 'integer',\n minimum: 0,\n default: undefined\n },\n padding: {\n type: 'integer',\n minimum: 0,\n default: 1\n }\n }\n }\n }\n};\n\nvar legendMixin = {\n type: 'object',\n properties: {\n legend: {\n type: 'object',\n description: 'Properties of a legend.',\n properties: {\n title: {\n type: 'string',\n default: undefined,\n description: 'A title for the legend. (Shows field name and its function by default.)'\n },\n orient: {\n type: 'string',\n default: 'right',\n description: 'The orientation of the legend. One of \"left\" or \"right\". This determines how the legend is positioned within the scene. The default is \"right\".'\n }\n }\n }\n }\n};\n\nvar textMixin = {\n type: 'object',\n supportedMarktypes: {'text': true},\n properties: {\n align: {\n type: 'string',\n default: 'right'\n },\n baseline: {\n type: 'string',\n default: 'middle'\n },\n color: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n margin: {\n type: 'integer',\n default: 4,\n minimum: 0\n },\n placeholder: {\n type: 'string',\n default: 'Abc'\n },\n font: {\n type: 'object',\n properties: {\n weight: {\n type: 'string',\n enum: ['normal', 'bold'],\n default: 'normal'\n },\n size: {\n type: 'integer',\n default: 10,\n minimum: 0\n },\n family: {\n type: 'string',\n default: 'Helvetica Neue'\n },\n style: {\n type: 'string',\n default: 'normal',\n enum: ['normal', 'italic']\n }\n }\n },\n format: {\n type: 'string',\n default: undefined, // auto\n description: 'The formatting pattern for text value. '+\n 'If not undefined, this will be determined by ' +\n 'small/largeNumberFormat and the max value ' +\n 'of the field.'\n },\n }\n};\n\nvar sizeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, bar: true, circle: true, square: true, text: true},\n properties: {\n value: {\n type: 'integer',\n default: 30,\n minimum: 0,\n description: 'Size of marks.'\n }\n }\n};\n\nvar colorMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, 'text': true},\n properties: {\n value: {\n type: 'string',\n role: 'color',\n default: '#4682b4',\n description: 'Color to be used for marks.'\n },\n opacity: {\n type: 'number',\n default: undefined, // auto\n minimum: 0,\n maximum: 1\n },\n scale: {\n type: 'object',\n properties: {\n range: {\n type: ['string', 'array'],\n default: undefined,\n description:\n 'Color palette, if undefined vega-lite will use data property' +\n 'to pick one from c10palette, c20palette, or ordinalPalette.'\n //FIXME\n },\n c10palette: {\n type: 'string',\n default: 'category10',\n enum: [\n // Tableau\n 'category10', 'category10k',\n // Color Brewer\n 'Pastel1', 'Pastel2', 'Set1', 'Set2', 'Set3'\n ]\n },\n c20palette: {\n type: 'string',\n default: 'category20',\n enum: ['category20', 'category20b', 'category20c']\n },\n ordinalPalette: {\n type: 'string',\n default: undefined,\n description: 'Color palette to encode ordinal variables.',\n enum: util.keys(colorbrewer)\n },\n quantitativeRange: {\n type: 'array',\n default: ['#AFC6A3', '#09622A'], // tableau greens\n // default: ['#ccece6', '#00441b'], // BuGn.9 [2-8]\n description: 'Color range to encode quantitative variables.',\n minItems: 2,\n maxItems: 2,\n items: {\n type: 'string',\n role: 'color'\n }\n }\n }\n }\n }\n};\n\nvar stackMixin = {\n type: 'object',\n properties: {\n stack: {\n type: ['boolean', 'object'],\n default: true,\n description: 'Enable stacking (for bar and area marks only).',\n properties: {\n reverse: {\n type: 'boolean',\n default: false,\n description: 'Whether to reverse the stack\\'s sortby.'\n },\n offset: {\n type: 'string',\n default: undefined,\n enum: ['zero', 'center', 'normalize']\n // TODO(#620) refer to Vega spec once it doesn't throw error\n // enum: vgStackSchema.properties.offset.oneOf[0].enum\n }\n }\n }\n }\n};\n\nvar shapeMixin = {\n type: 'object',\n supportedMarktypes: {point: true, circle: true, square: true},\n properties: {\n value: {\n type: 'string',\n enum: ['circle', 'square', 'cross', 'diamond', 'triangle-up', 'triangle-down'],\n default: 'circle',\n description: 'Mark to be used.'\n },\n filled: {\n type: 'boolean',\n default: false,\n description: 'Whether the shape\\'s color should be used as fill color instead of stroke color.'\n }\n }\n};\n\nvar detailMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, line: true, circle: true, square: true}\n};\n\nvar rowMixin = {\n properties: {\n height: {\n type: 'number',\n minimum: 0,\n default: 150\n }\n }\n};\n\nvar colMixin = {\n properties: {\n width: {\n type: 'number',\n minimum: 0,\n default: 150\n },\n axis: {\n properties: {\n maxLabelLength: {\n type: 'integer',\n default: 12,\n minimum: 0,\n description: 'Truncate labels that are too long.'\n }\n }\n }\n }\n};\n\nvar facetMixin = {\n type: 'object',\n supportedMarktypes: {point: true, tick: true, bar: true, line: true, area: true, circle: true, square: true, text: true},\n properties: {\n padding: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.1\n }\n }\n};\n\nvar requiredNameType = {\n required: ['name', 'type']\n};\n\nvar multiRoleField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: true\n }\n});\n\nvar quantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true,\n dimension: 'ordinal-only' // using size to encoding category lead to order interpretation\n }\n});\n\nvar onlyQuantitativeField = merge(clone(typicalField), {\n supportedRole: {\n measure: true\n }\n});\n\nvar x = merge(clone(multiRoleField), axisMixin, bandMixin, requiredNameType, sortMixin);\nvar y = clone(x);\n\nvar facet = merge(clone(onlyOrdinalField), requiredNameType, facetMixin, sortMixin);\nvar row = merge(clone(facet), axisMixin, rowMixin);\nvar col = merge(clone(facet), axisMixin, colMixin);\n\nvar size = merge(clone(quantitativeField), legendMixin, sizeMixin, sortMixin);\nvar color = merge(clone(multiRoleField), legendMixin, colorMixin, stackMixin, sortMixin);\n\nvar shape = merge(clone(onlyOrdinalField), legendMixin, shapeMixin, sortMixin);\nvar detail = merge(clone(onlyOrdinalField), detailMixin, stackMixin, sortMixin);\n\n// we only put aggregated measure in pivot table\nvar text = merge(clone(onlyQuantitativeField), textMixin, sortMixin);\n\n// TODO add label\n\nvar data = {\n type: 'object',\n properties: {\n // data source\n formatType: {\n type: 'string',\n enum: ['json', 'csv'],\n default: 'json'\n },\n url: {\n type: 'string',\n default: undefined\n },\n values: {\n type: 'array',\n default: undefined,\n description: 'Pass array of objects instead of a url to a file.',\n items: {\n type: 'object',\n additionalProperties: true\n }\n },\n // we generate a vega filter transform\n filter: {\n type: 'string',\n default: undefined,\n description: 'A string containing the filter Vega expression. Use `datum` to refer to the current data object.'\n },\n // we generate a vega formula transform\n formulas: {\n type: 'array',\n default: undefined,\n description: 'Array of formula transforms. Formulas are applied before filter.',\n items: {\n type: 'object',\n properties: {\n field: {\n type: 'string',\n description: 'The property name in which to store the computed formula value.'\n },\n expr: {\n type: 'string',\n description: 'A string containing an expression for the formula. Use the variable `datum` to to refer to the current data object.'\n }\n }\n }\n }\n }\n};\n\nvar config = {\n type: 'object',\n properties: {\n // template\n width: {\n type: 'integer',\n default: undefined\n },\n height: {\n type: 'integer',\n default: undefined\n },\n viewport: {\n type: 'array',\n items: {\n type: 'integer'\n },\n default: undefined\n },\n gridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n gridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.08\n },\n\n // filter null\n // TODO(#597) revise this config\n filterNull: {\n type: 'object',\n properties: {\n N: {type:'boolean', default: false},\n O: {type:'boolean', default: false},\n Q: {type:'boolean', default: true},\n T: {type:'boolean', default: true}\n }\n },\n autoSortLine: {\n type: 'boolean',\n default: true\n },\n\n // single plot\n singleHeight: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n singleWidth: {\n // will be overwritten by bandWidth * (cardinality + padding)\n type: 'integer',\n default: 200,\n minimum: 0\n },\n // band size\n largeBandSize: {\n type: 'integer',\n default: 21,\n minimum: 0\n },\n smallBandSize: {\n //small multiples or single plot with high cardinality\n type: 'integer',\n default: 12,\n minimum: 0\n },\n largeBandMaxCardinality: {\n type: 'integer',\n default: 10\n },\n // small multiples\n cellPadding: {\n type: 'number',\n default: 0.1\n },\n cellGridColor: {\n type: 'string',\n role: 'color',\n default: '#000000'\n },\n cellGridOpacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n default: 0.25\n },\n cellGridOffset: {\n type: 'number',\n default: 6 // equal to tickSize\n },\n cellBackgroundColor: {\n type: 'string',\n role: 'color',\n default: 'rgba(0,0,0,0)'\n },\n textCellWidth: {\n type: 'integer',\n default: 90,\n minimum: 0\n },\n\n // marks\n strokeWidth: {\n type: 'integer',\n default: 2,\n minimum: 0\n },\n singleBarOffset: {\n type: 'integer',\n default: 5,\n minimum: 0\n },\n // scales\n timeScaleLabelLength: {\n type: 'integer',\n default: 3,\n minimum: 0,\n description: 'Max length for values in dayScaleLabel and monthScaleLabel. Zero means using full names in dayScaleLabel/monthScaleLabel.'\n },\n dayScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n description: 'Axis labels for day of week, starting from Sunday.' +\n '(Consistent with Javascript -- See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay.'\n },\n monthScaleLabel: {\n type: 'array',\n items: {\n type: 'string'\n },\n default: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n description: 'Axis labels for month.'\n },\n // other\n characterWidth: {\n type: 'integer',\n default: 6\n },\n maxSmallNumber: {\n type: 'number',\n default: 10000,\n description: 'maximum number that a field will be considered smallNumber.'+\n 'Used for axis labelling.'\n },\n smallNumberFormat: {\n type: 'string',\n default: '',\n description: 'D3 Number format for axis labels and text tables '+\n 'for number <= maxSmallNumber. Used for axis labelling.'\n },\n largeNumberFormat: {\n type: 'string',\n default: '.3s',\n description: 'D3 Number format for axis labels and text tables ' +\n 'for number > maxSmallNumber.'\n },\n timeFormat: {\n type: 'string',\n default: '%Y-%m-%d',\n description: 'Date format for axis labels.'\n },\n useRawDomain: {\n type: 'boolean',\n default: false,\n description: 'Use the raw data range as scale domain instead of ' +\n 'aggregated data for aggregate axis. ' +\n 'This option does not work with sum or count aggregate' +\n 'as they might have a substantially larger scale range.' +\n 'By default, use value from config.useRawDomain.'\n }\n }\n};\n\n/** @type Object Schema of a vega-lite specification */\nschema.schema = {\n $schema: 'http://json-schema.org/draft-04/schema#',\n description: 'Schema for Vega-lite specification',\n type: 'object',\n required: ['marktype', 'encoding', 'data'],\n properties: {\n data: data,\n marktype: schema.marktype,\n encoding: {\n type: 'object',\n properties: {\n x: x,\n y: y,\n row: row,\n col: col,\n size: size,\n color: color,\n shape: shape,\n text: text,\n detail: detail\n }\n },\n config: config\n }\n};\n\nschema.encTypes = util.keys(schema.schema.properties.encoding.properties);\n\n/** Instantiate a verbose vl spec from the schema */\nschema.instantiate = function() {\n return schema.util.instantiate(schema.schema);\n};\n","'use strict';\n\nvar schemautil = module.exports = {},\n util = require('../util');\n\nvar isEmpty = function(obj) {\n return Object.keys(obj).length === 0;\n};\n\nschemautil.extend = function(instance, schema) {\n return schemautil.merge(schemautil.instantiate(schema), instance);\n};\n\n// instantiate a schema\nschemautil.instantiate = function(schema) {\n var val;\n if (schema === undefined) {\n return undefined;\n } else if ('default' in schema) {\n val = schema.default;\n return util.isObject(val) ? util.duplicate(val) : val;\n } else if (schema.type === 'object') {\n var instance = {};\n for (var name in schema.properties) {\n val = schemautil.instantiate(schema.properties[name]);\n if (val !== undefined) {\n instance[name] = val;\n }\n }\n return instance;\n } else if (schema.type === 'array') {\n return [];\n }\n return undefined;\n};\n\n// remove all defaults from an instance\nschemautil.subtract = function(instance, defaults) {\n var changes = {};\n for (var prop in instance) {\n var def = defaults[prop];\n var ins = instance[prop];\n // Note: does not properly subtract arrays\n if (!defaults || def !== ins) {\n if (typeof ins === 'object' && !util.isArray(ins) && def) {\n var c = schemautil.subtract(ins, def);\n if (!isEmpty(c))\n changes[prop] = c;\n } else if (!util.isArray(ins) || ins.length > 0) {\n changes[prop] = ins;\n }\n }\n }\n return changes;\n};\n\nschemautil.merge = function(/*dest*, src0, src1, ...*/){\n var dest = arguments[0];\n for (var i=1 ; i