vega-format
Advanced tools
Comparing version 1.0.4 to 1.1.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-format'), require('vega-time'), require('vega-util'), require('d3-time-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-format', 'vega-time', 'vega-util', 'd3-time-format'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.d3, global.d3, global.vega, global.vega, global.d3)); | ||
}(this, (function (exports, d3Array, d3Format, vegaTime, vegaUtil, d3TimeFormat) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-time'), require('vega-util')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-time', 'vega-util'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.vega)); | ||
})(this, (function (exports, vegaTime, vegaUtil) { 'use strict'; | ||
@@ -12,2 +12,321 @@ function memoize (method) { | ||
var e10 = Math.sqrt(50), | ||
e5 = Math.sqrt(10), | ||
e2 = Math.sqrt(2); | ||
function tickStep(start, stop, count) { | ||
var step0 = Math.abs(stop - start) / Math.max(0, count), | ||
step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), | ||
error = step0 / step1; | ||
if (error >= e10) step1 *= 10;else if (error >= e5) step1 *= 5;else if (error >= e2) step1 *= 2; | ||
return stop < start ? -step1 : step1; | ||
} | ||
function formatDecimal (x) { | ||
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); | ||
} // Computes the decimal coefficient and exponent of the specified number x with | ||
// significant digits p, where x is positive and p is in [1, 21] or undefined. | ||
// For example, formatDecimalParts(1.23) returns ["123", 0]. | ||
function formatDecimalParts(x, p) { | ||
if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity | ||
var i, | ||
coefficient = x.slice(0, i); // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ | ||
// (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). | ||
return [coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1)]; | ||
} | ||
function exponent (x) { | ||
return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN; | ||
} | ||
function formatGroup (grouping, thousands) { | ||
return function (value, width) { | ||
var i = value.length, | ||
t = [], | ||
j = 0, | ||
g = grouping[0], | ||
length = 0; | ||
while (i > 0 && g > 0) { | ||
if (length + g + 1 > width) g = Math.max(1, width - length); | ||
t.push(value.substring(i -= g, i + g)); | ||
if ((length += g + 1) > width) break; | ||
g = grouping[j = (j + 1) % grouping.length]; | ||
} | ||
return t.reverse().join(thousands); | ||
}; | ||
} | ||
function formatNumerals (numerals) { | ||
return function (value) { | ||
return value.replace(/[0-9]/g, function (i) { | ||
return numerals[+i]; | ||
}); | ||
}; | ||
} | ||
// [[fill]align][sign][symbol][0][width][,][.precision][~][type] | ||
var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; | ||
function formatSpecifier(specifier) { | ||
if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); | ||
var match; | ||
return new FormatSpecifier({ | ||
fill: match[1], | ||
align: match[2], | ||
sign: match[3], | ||
symbol: match[4], | ||
zero: match[5], | ||
width: match[6], | ||
comma: match[7], | ||
precision: match[8] && match[8].slice(1), | ||
trim: match[9], | ||
type: match[10] | ||
}); | ||
} | ||
formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof | ||
function FormatSpecifier(specifier) { | ||
this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; | ||
this.align = specifier.align === undefined ? ">" : specifier.align + ""; | ||
this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; | ||
this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; | ||
this.zero = !!specifier.zero; | ||
this.width = specifier.width === undefined ? undefined : +specifier.width; | ||
this.comma = !!specifier.comma; | ||
this.precision = specifier.precision === undefined ? undefined : +specifier.precision; | ||
this.trim = !!specifier.trim; | ||
this.type = specifier.type === undefined ? "" : specifier.type + ""; | ||
} | ||
FormatSpecifier.prototype.toString = function () { | ||
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; | ||
}; | ||
// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. | ||
function formatTrim (s) { | ||
out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { | ||
switch (s[i]) { | ||
case ".": | ||
i0 = i1 = i; | ||
break; | ||
case "0": | ||
if (i0 === 0) i0 = i; | ||
i1 = i; | ||
break; | ||
default: | ||
if (!+s[i]) break out; | ||
if (i0 > 0) i0 = 0; | ||
break; | ||
} | ||
} | ||
return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; | ||
} | ||
var prefixExponent; | ||
function formatPrefixAuto (x, p) { | ||
var d = formatDecimalParts(x, p); | ||
if (!d) return x + ""; | ||
var coefficient = d[0], | ||
exponent = d[1], | ||
i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, | ||
n = coefficient.length; | ||
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y! | ||
} | ||
function formatRounded (x, p) { | ||
var d = formatDecimalParts(x, p); | ||
if (!d) return x + ""; | ||
var coefficient = d[0], | ||
exponent = d[1]; | ||
return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); | ||
} | ||
var formatTypes = { | ||
"%": (x, p) => (x * 100).toFixed(p), | ||
"b": x => Math.round(x).toString(2), | ||
"c": x => x + "", | ||
"d": formatDecimal, | ||
"e": (x, p) => x.toExponential(p), | ||
"f": (x, p) => x.toFixed(p), | ||
"g": (x, p) => x.toPrecision(p), | ||
"o": x => Math.round(x).toString(8), | ||
"p": (x, p) => formatRounded(x * 100, p), | ||
"r": formatRounded, | ||
"s": formatPrefixAuto, | ||
"X": x => Math.round(x).toString(16).toUpperCase(), | ||
"x": x => Math.round(x).toString(16) | ||
}; | ||
function identity (x) { | ||
return x; | ||
} | ||
var map = Array.prototype.map, | ||
prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; | ||
function d3_formatLocale (locale) { | ||
var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), | ||
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", | ||
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", | ||
decimal = locale.decimal === undefined ? "." : locale.decimal + "", | ||
numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), | ||
percent = locale.percent === undefined ? "%" : locale.percent + "", | ||
minus = locale.minus === undefined ? "−" : locale.minus + "", | ||
nan = locale.nan === undefined ? "NaN" : locale.nan + ""; | ||
function newFormat(specifier) { | ||
specifier = formatSpecifier(specifier); | ||
var fill = specifier.fill, | ||
align = specifier.align, | ||
sign = specifier.sign, | ||
symbol = specifier.symbol, | ||
zero = specifier.zero, | ||
width = specifier.width, | ||
comma = specifier.comma, | ||
precision = specifier.precision, | ||
trim = specifier.trim, | ||
type = specifier.type; // The "n" type is an alias for ",g". | ||
if (type === "n") comma = true, type = "g"; // The "" type, and any invalid type, is an alias for ".12~g". | ||
else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; // If zero fill is specified, padding goes after sign and before digits. | ||
if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; // Compute the prefix and suffix. | ||
// For SI-prefix, the suffix is lazily computed. | ||
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", | ||
suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; // What format function should we use? | ||
// Is this an integer type? | ||
// Can this type generate exponential notation? | ||
var formatType = formatTypes[type], | ||
maybeSuffix = /[defgprs%]/.test(type); // Set the default precision if not specified, | ||
// or clamp the specified precision to the supported range. | ||
// For significant precision, it must be in [1, 21]. | ||
// For fixed precision, it must be in [0, 20]. | ||
precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); | ||
function format(value) { | ||
var valuePrefix = prefix, | ||
valueSuffix = suffix, | ||
i, | ||
n, | ||
c; | ||
if (type === "c") { | ||
valueSuffix = formatType(value) + valueSuffix; | ||
value = ""; | ||
} else { | ||
value = +value; // Determine the sign. -0 is not less than 0, but 1 / -0 is! | ||
var valueNegative = value < 0 || 1 / value < 0; // Perform the initial formatting. | ||
value = isNaN(value) ? nan : formatType(Math.abs(value), precision); // Trim insignificant zeros. | ||
if (trim) value = formatTrim(value); // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. | ||
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; // Compute the prefix and suffix. | ||
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; | ||
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); // Break the formatted value into the integer “value” part that can be | ||
// grouped, and fractional or exponential “suffix” part that is not. | ||
if (maybeSuffix) { | ||
i = -1, n = value.length; | ||
while (++i < n) { | ||
if (c = value.charCodeAt(i), 48 > c || c > 57) { | ||
valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; | ||
value = value.slice(0, i); | ||
break; | ||
} | ||
} | ||
} | ||
} // If the fill character is not "0", grouping is applied before padding. | ||
if (comma && !zero) value = group(value, Infinity); // Compute the padding. | ||
var length = valuePrefix.length + value.length + valueSuffix.length, | ||
padding = length < width ? new Array(width - length + 1).join(fill) : ""; // If the fill character is "0", grouping is applied after padding. | ||
if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; // Reconstruct the final output based on the desired alignment. | ||
switch (align) { | ||
case "<": | ||
value = valuePrefix + value + valueSuffix + padding; | ||
break; | ||
case "=": | ||
value = valuePrefix + padding + value + valueSuffix; | ||
break; | ||
case "^": | ||
value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); | ||
break; | ||
default: | ||
value = padding + valuePrefix + value + valueSuffix; | ||
break; | ||
} | ||
return numerals(value); | ||
} | ||
format.toString = function () { | ||
return specifier + ""; | ||
}; | ||
return format; | ||
} | ||
function formatPrefix(specifier, value) { | ||
var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), | ||
e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, | ||
k = Math.pow(10, -e), | ||
prefix = prefixes[8 + e / 3]; | ||
return function (value) { | ||
return f(k * value) + prefix; | ||
}; | ||
} | ||
return { | ||
format: newFormat, | ||
formatPrefix: formatPrefix | ||
}; | ||
} | ||
var locale$2; | ||
var format; | ||
var formatPrefix; | ||
defaultLocale$2({ | ||
thousands: ",", | ||
grouping: [3], | ||
currency: ["$", ""] | ||
}); | ||
function defaultLocale$2(definition) { | ||
locale$2 = d3_formatLocale(definition); | ||
format = locale$2.format; | ||
formatPrefix = locale$2.formatPrefix; | ||
return locale$2; | ||
} | ||
function precisionFixed (step) { | ||
return Math.max(0, -exponent(Math.abs(step))); | ||
} | ||
function precisionPrefix (step, value) { | ||
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); | ||
} | ||
function precisionRound (step, max) { | ||
step = Math.abs(step), max = Math.abs(max) - step; | ||
return Math.max(0, exponent(max) - exponent(step)) + 1; | ||
} | ||
function trimZeroes(numberFormat, decimalChar) { | ||
@@ -49,3 +368,3 @@ return x => { | ||
formatFloat(spec) { | ||
const s = d3Format.formatSpecifier(spec || ','); | ||
const s = formatSpecifier(spec || ','); | ||
@@ -74,4 +393,4 @@ if (s.precision == null) { | ||
formatSpan(start, stop, count, specifier) { | ||
specifier = d3Format.formatSpecifier(specifier == null ? ',f' : specifier); | ||
const step = d3Array.tickStep(start, stop, count), | ||
specifier = formatSpecifier(specifier == null ? ',f' : specifier); | ||
const step = tickStep(start, stop, count), | ||
value = Math.max(Math.abs(start), Math.abs(stop)); | ||
@@ -84,3 +403,3 @@ let precision; | ||
{ | ||
if (!isNaN(precision = d3Format.precisionPrefix(step, value))) { | ||
if (!isNaN(precision = precisionPrefix(step, value))) { | ||
specifier.precision = precision; | ||
@@ -98,3 +417,3 @@ } | ||
{ | ||
if (!isNaN(precision = d3Format.precisionRound(step, value))) { | ||
if (!isNaN(precision = precisionRound(step, value))) { | ||
specifier.precision = precision - (specifier.type === 'e'); | ||
@@ -109,3 +428,3 @@ } | ||
{ | ||
if (!isNaN(precision = d3Format.precisionFixed(step))) { | ||
if (!isNaN(precision = precisionFixed(step))) { | ||
specifier.precision = precision - (specifier.type === '%') * 2; | ||
@@ -129,8 +448,8 @@ } | ||
return defaultNumberLocale = numberLocale({ | ||
format: d3Format.format, | ||
formatPrefix: d3Format.formatPrefix | ||
format: format, | ||
formatPrefix: formatPrefix | ||
}); | ||
} | ||
function numberFormatLocale(definition) { | ||
return numberLocale(d3Format.formatLocale(definition)); | ||
return numberLocale(d3_formatLocale(definition)); | ||
} | ||
@@ -141,2 +460,907 @@ function numberFormatDefaultLocale(definition) { | ||
var t0 = new Date(), | ||
t1 = new Date(); | ||
function newInterval(floori, offseti, count, field) { | ||
function interval(date) { | ||
return floori(date = arguments.length === 0 ? new Date() : new Date(+date)), date; | ||
} | ||
interval.floor = function (date) { | ||
return floori(date = new Date(+date)), date; | ||
}; | ||
interval.ceil = function (date) { | ||
return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; | ||
}; | ||
interval.round = function (date) { | ||
var d0 = interval(date), | ||
d1 = interval.ceil(date); | ||
return date - d0 < d1 - date ? d0 : d1; | ||
}; | ||
interval.offset = function (date, step) { | ||
return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; | ||
}; | ||
interval.range = function (start, stop, step) { | ||
var range = [], | ||
previous; | ||
start = interval.ceil(start); | ||
step = step == null ? 1 : Math.floor(step); | ||
if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date | ||
do range.push(previous = new Date(+start)), offseti(start, step), floori(start); while (previous < start && start < stop); | ||
return range; | ||
}; | ||
interval.filter = function (test) { | ||
return newInterval(function (date) { | ||
if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); | ||
}, function (date, step) { | ||
if (date >= date) { | ||
if (step < 0) while (++step <= 0) { | ||
while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty | ||
} else while (--step >= 0) { | ||
while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty | ||
} | ||
} | ||
}); | ||
}; | ||
if (count) { | ||
interval.count = function (start, end) { | ||
t0.setTime(+start), t1.setTime(+end); | ||
floori(t0), floori(t1); | ||
return Math.floor(count(t0, t1)); | ||
}; | ||
interval.every = function (step) { | ||
step = Math.floor(step); | ||
return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function (d) { | ||
return field(d) % step === 0; | ||
} : function (d) { | ||
return interval.count(0, d) % step === 0; | ||
}); | ||
}; | ||
} | ||
return interval; | ||
} | ||
const durationSecond = 1000; | ||
const durationMinute = durationSecond * 60; | ||
const durationHour = durationMinute * 60; | ||
const durationDay = durationHour * 24; | ||
const durationWeek = durationDay * 7; | ||
var day = newInterval(date => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay, date => date.getDate() - 1); | ||
var timeDay = day; | ||
function weekday(i) { | ||
return newInterval(function (date) { | ||
date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); | ||
date.setHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setDate(date.getDate() + step * 7); | ||
}, function (start, end) { | ||
return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek; | ||
}); | ||
} | ||
var sunday = weekday(0); | ||
var monday = weekday(1); | ||
weekday(2); | ||
weekday(3); | ||
var thursday = weekday(4); | ||
weekday(5); | ||
weekday(6); | ||
var year = newInterval(function (date) { | ||
date.setMonth(0, 1); | ||
date.setHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setFullYear(date.getFullYear() + step); | ||
}, function (start, end) { | ||
return end.getFullYear() - start.getFullYear(); | ||
}, function (date) { | ||
return date.getFullYear(); | ||
}); // An optimized implementation for this simple case. | ||
year.every = function (k) { | ||
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (date) { | ||
date.setFullYear(Math.floor(date.getFullYear() / k) * k); | ||
date.setMonth(0, 1); | ||
date.setHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setFullYear(date.getFullYear() + step * k); | ||
}); | ||
}; | ||
var timeYear = year; | ||
var utcDay = newInterval(function (date) { | ||
date.setUTCHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setUTCDate(date.getUTCDate() + step); | ||
}, function (start, end) { | ||
return (end - start) / durationDay; | ||
}, function (date) { | ||
return date.getUTCDate() - 1; | ||
}); | ||
var utcDay$1 = utcDay; | ||
function utcWeekday(i) { | ||
return newInterval(function (date) { | ||
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); | ||
date.setUTCHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setUTCDate(date.getUTCDate() + step * 7); | ||
}, function (start, end) { | ||
return (end - start) / durationWeek; | ||
}); | ||
} | ||
var utcSunday = utcWeekday(0); | ||
var utcMonday = utcWeekday(1); | ||
utcWeekday(2); | ||
utcWeekday(3); | ||
var utcThursday = utcWeekday(4); | ||
utcWeekday(5); | ||
utcWeekday(6); | ||
var utcYear = newInterval(function (date) { | ||
date.setUTCMonth(0, 1); | ||
date.setUTCHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setUTCFullYear(date.getUTCFullYear() + step); | ||
}, function (start, end) { | ||
return end.getUTCFullYear() - start.getUTCFullYear(); | ||
}, function (date) { | ||
return date.getUTCFullYear(); | ||
}); // An optimized implementation for this simple case. | ||
utcYear.every = function (k) { | ||
return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function (date) { | ||
date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); | ||
date.setUTCMonth(0, 1); | ||
date.setUTCHours(0, 0, 0, 0); | ||
}, function (date, step) { | ||
date.setUTCFullYear(date.getUTCFullYear() + step * k); | ||
}); | ||
}; | ||
var utcYear$1 = utcYear; | ||
function localDate(d) { | ||
if (0 <= d.y && d.y < 100) { | ||
var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); | ||
date.setFullYear(d.y); | ||
return date; | ||
} | ||
return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); | ||
} | ||
function utcDate(d) { | ||
if (0 <= d.y && d.y < 100) { | ||
var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); | ||
date.setUTCFullYear(d.y); | ||
return date; | ||
} | ||
return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); | ||
} | ||
function newDate(y, m, d) { | ||
return { | ||
y: y, | ||
m: m, | ||
d: d, | ||
H: 0, | ||
M: 0, | ||
S: 0, | ||
L: 0 | ||
}; | ||
} | ||
function formatLocale(locale) { | ||
var locale_dateTime = locale.dateTime, | ||
locale_date = locale.date, | ||
locale_time = locale.time, | ||
locale_periods = locale.periods, | ||
locale_weekdays = locale.days, | ||
locale_shortWeekdays = locale.shortDays, | ||
locale_months = locale.months, | ||
locale_shortMonths = locale.shortMonths; | ||
var periodRe = formatRe(locale_periods), | ||
periodLookup = formatLookup(locale_periods), | ||
weekdayRe = formatRe(locale_weekdays), | ||
weekdayLookup = formatLookup(locale_weekdays), | ||
shortWeekdayRe = formatRe(locale_shortWeekdays), | ||
shortWeekdayLookup = formatLookup(locale_shortWeekdays), | ||
monthRe = formatRe(locale_months), | ||
monthLookup = formatLookup(locale_months), | ||
shortMonthRe = formatRe(locale_shortMonths), | ||
shortMonthLookup = formatLookup(locale_shortMonths); | ||
var formats = { | ||
"a": formatShortWeekday, | ||
"A": formatWeekday, | ||
"b": formatShortMonth, | ||
"B": formatMonth, | ||
"c": null, | ||
"d": formatDayOfMonth, | ||
"e": formatDayOfMonth, | ||
"f": formatMicroseconds, | ||
"g": formatYearISO, | ||
"G": formatFullYearISO, | ||
"H": formatHour24, | ||
"I": formatHour12, | ||
"j": formatDayOfYear, | ||
"L": formatMilliseconds, | ||
"m": formatMonthNumber, | ||
"M": formatMinutes, | ||
"p": formatPeriod, | ||
"q": formatQuarter, | ||
"Q": formatUnixTimestamp, | ||
"s": formatUnixTimestampSeconds, | ||
"S": formatSeconds, | ||
"u": formatWeekdayNumberMonday, | ||
"U": formatWeekNumberSunday, | ||
"V": formatWeekNumberISO, | ||
"w": formatWeekdayNumberSunday, | ||
"W": formatWeekNumberMonday, | ||
"x": null, | ||
"X": null, | ||
"y": formatYear, | ||
"Y": formatFullYear, | ||
"Z": formatZone, | ||
"%": formatLiteralPercent | ||
}; | ||
var utcFormats = { | ||
"a": formatUTCShortWeekday, | ||
"A": formatUTCWeekday, | ||
"b": formatUTCShortMonth, | ||
"B": formatUTCMonth, | ||
"c": null, | ||
"d": formatUTCDayOfMonth, | ||
"e": formatUTCDayOfMonth, | ||
"f": formatUTCMicroseconds, | ||
"g": formatUTCYearISO, | ||
"G": formatUTCFullYearISO, | ||
"H": formatUTCHour24, | ||
"I": formatUTCHour12, | ||
"j": formatUTCDayOfYear, | ||
"L": formatUTCMilliseconds, | ||
"m": formatUTCMonthNumber, | ||
"M": formatUTCMinutes, | ||
"p": formatUTCPeriod, | ||
"q": formatUTCQuarter, | ||
"Q": formatUnixTimestamp, | ||
"s": formatUnixTimestampSeconds, | ||
"S": formatUTCSeconds, | ||
"u": formatUTCWeekdayNumberMonday, | ||
"U": formatUTCWeekNumberSunday, | ||
"V": formatUTCWeekNumberISO, | ||
"w": formatUTCWeekdayNumberSunday, | ||
"W": formatUTCWeekNumberMonday, | ||
"x": null, | ||
"X": null, | ||
"y": formatUTCYear, | ||
"Y": formatUTCFullYear, | ||
"Z": formatUTCZone, | ||
"%": formatLiteralPercent | ||
}; | ||
var parses = { | ||
"a": parseShortWeekday, | ||
"A": parseWeekday, | ||
"b": parseShortMonth, | ||
"B": parseMonth, | ||
"c": parseLocaleDateTime, | ||
"d": parseDayOfMonth, | ||
"e": parseDayOfMonth, | ||
"f": parseMicroseconds, | ||
"g": parseYear, | ||
"G": parseFullYear, | ||
"H": parseHour24, | ||
"I": parseHour24, | ||
"j": parseDayOfYear, | ||
"L": parseMilliseconds, | ||
"m": parseMonthNumber, | ||
"M": parseMinutes, | ||
"p": parsePeriod, | ||
"q": parseQuarter, | ||
"Q": parseUnixTimestamp, | ||
"s": parseUnixTimestampSeconds, | ||
"S": parseSeconds, | ||
"u": parseWeekdayNumberMonday, | ||
"U": parseWeekNumberSunday, | ||
"V": parseWeekNumberISO, | ||
"w": parseWeekdayNumberSunday, | ||
"W": parseWeekNumberMonday, | ||
"x": parseLocaleDate, | ||
"X": parseLocaleTime, | ||
"y": parseYear, | ||
"Y": parseFullYear, | ||
"Z": parseZone, | ||
"%": parseLiteralPercent | ||
}; // These recursive directive definitions must be deferred. | ||
formats.x = newFormat(locale_date, formats); | ||
formats.X = newFormat(locale_time, formats); | ||
formats.c = newFormat(locale_dateTime, formats); | ||
utcFormats.x = newFormat(locale_date, utcFormats); | ||
utcFormats.X = newFormat(locale_time, utcFormats); | ||
utcFormats.c = newFormat(locale_dateTime, utcFormats); | ||
function newFormat(specifier, formats) { | ||
return function (date) { | ||
var string = [], | ||
i = -1, | ||
j = 0, | ||
n = specifier.length, | ||
c, | ||
pad, | ||
format; | ||
if (!(date instanceof Date)) date = new Date(+date); | ||
while (++i < n) { | ||
if (specifier.charCodeAt(i) === 37) { | ||
string.push(specifier.slice(j, i)); | ||
if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);else pad = c === "e" ? " " : "0"; | ||
if (format = formats[c]) c = format(date, pad); | ||
string.push(c); | ||
j = i + 1; | ||
} | ||
} | ||
string.push(specifier.slice(j, i)); | ||
return string.join(""); | ||
}; | ||
} | ||
function newParse(specifier, Z) { | ||
return function (string) { | ||
var d = newDate(1900, undefined, 1), | ||
i = parseSpecifier(d, specifier, string += "", 0), | ||
week, | ||
day; | ||
if (i != string.length) return null; // If a UNIX timestamp is specified, return it. | ||
if ("Q" in d) return new Date(d.Q); | ||
if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); // If this is utcParse, never use the local timezone. | ||
if (Z && !("Z" in d)) d.Z = 0; // The am-pm flag is 0 for AM, and 1 for PM. | ||
if ("p" in d) d.H = d.H % 12 + d.p * 12; // If the month was not specified, inherit from the quarter. | ||
if (d.m === undefined) d.m = "q" in d ? d.q : 0; // Convert day-of-week and week-of-year to day-of-year. | ||
if ("V" in d) { | ||
if (d.V < 1 || d.V > 53) return null; | ||
if (!("w" in d)) d.w = 1; | ||
if ("Z" in d) { | ||
week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); | ||
week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week); | ||
week = utcDay$1.offset(week, (d.V - 1) * 7); | ||
d.y = week.getUTCFullYear(); | ||
d.m = week.getUTCMonth(); | ||
d.d = week.getUTCDate() + (d.w + 6) % 7; | ||
} else { | ||
week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); | ||
week = day > 4 || day === 0 ? monday.ceil(week) : monday(week); | ||
week = timeDay.offset(week, (d.V - 1) * 7); | ||
d.y = week.getFullYear(); | ||
d.m = week.getMonth(); | ||
d.d = week.getDate() + (d.w + 6) % 7; | ||
} | ||
} else if ("W" in d || "U" in d) { | ||
if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; | ||
day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); | ||
d.m = 0; | ||
d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; | ||
} // If a time zone is specified, all fields are interpreted as UTC and then | ||
// offset according to the specified time zone. | ||
if ("Z" in d) { | ||
d.H += d.Z / 100 | 0; | ||
d.M += d.Z % 100; | ||
return utcDate(d); | ||
} // Otherwise, all fields are in local time. | ||
return localDate(d); | ||
}; | ||
} | ||
function parseSpecifier(d, specifier, string, j) { | ||
var i = 0, | ||
n = specifier.length, | ||
m = string.length, | ||
c, | ||
parse; | ||
while (i < n) { | ||
if (j >= m) return -1; | ||
c = specifier.charCodeAt(i++); | ||
if (c === 37) { | ||
c = specifier.charAt(i++); | ||
parse = parses[c in pads ? specifier.charAt(i++) : c]; | ||
if (!parse || (j = parse(d, string, j)) < 0) return -1; | ||
} else if (c != string.charCodeAt(j++)) { | ||
return -1; | ||
} | ||
} | ||
return j; | ||
} | ||
function parsePeriod(d, string, i) { | ||
var n = periodRe.exec(string.slice(i)); | ||
return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; | ||
} | ||
function parseShortWeekday(d, string, i) { | ||
var n = shortWeekdayRe.exec(string.slice(i)); | ||
return n ? (d.w = shortWeekdayLookup.get(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; | ||
} | ||
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; | ||
} | ||
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; | ||
} | ||
function parseLocaleDateTime(d, string, i) { | ||
return parseSpecifier(d, locale_dateTime, string, i); | ||
} | ||
function parseLocaleDate(d, string, i) { | ||
return parseSpecifier(d, locale_date, string, i); | ||
} | ||
function parseLocaleTime(d, string, i) { | ||
return parseSpecifier(d, locale_time, string, i); | ||
} | ||
function formatShortWeekday(d) { | ||
return locale_shortWeekdays[d.getDay()]; | ||
} | ||
function formatWeekday(d) { | ||
return locale_weekdays[d.getDay()]; | ||
} | ||
function formatShortMonth(d) { | ||
return locale_shortMonths[d.getMonth()]; | ||
} | ||
function formatMonth(d) { | ||
return locale_months[d.getMonth()]; | ||
} | ||
function formatPeriod(d) { | ||
return locale_periods[+(d.getHours() >= 12)]; | ||
} | ||
function formatQuarter(d) { | ||
return 1 + ~~(d.getMonth() / 3); | ||
} | ||
function formatUTCShortWeekday(d) { | ||
return locale_shortWeekdays[d.getUTCDay()]; | ||
} | ||
function formatUTCWeekday(d) { | ||
return locale_weekdays[d.getUTCDay()]; | ||
} | ||
function formatUTCShortMonth(d) { | ||
return locale_shortMonths[d.getUTCMonth()]; | ||
} | ||
function formatUTCMonth(d) { | ||
return locale_months[d.getUTCMonth()]; | ||
} | ||
function formatUTCPeriod(d) { | ||
return locale_periods[+(d.getUTCHours() >= 12)]; | ||
} | ||
function formatUTCQuarter(d) { | ||
return 1 + ~~(d.getUTCMonth() / 3); | ||
} | ||
return { | ||
format: function (specifier) { | ||
var f = newFormat(specifier += "", formats); | ||
f.toString = function () { | ||
return specifier; | ||
}; | ||
return f; | ||
}, | ||
parse: function (specifier) { | ||
var p = newParse(specifier += "", false); | ||
p.toString = function () { | ||
return specifier; | ||
}; | ||
return p; | ||
}, | ||
utcFormat: function (specifier) { | ||
var f = newFormat(specifier += "", utcFormats); | ||
f.toString = function () { | ||
return specifier; | ||
}; | ||
return f; | ||
}, | ||
utcParse: function (specifier) { | ||
var p = newParse(specifier += "", true); | ||
p.toString = function () { | ||
return specifier; | ||
}; | ||
return p; | ||
} | ||
}; | ||
} | ||
var pads = { | ||
"-": "", | ||
"_": " ", | ||
"0": "0" | ||
}, | ||
numberRe = /^\s*\d+/, | ||
// note: ignores next directive | ||
percentRe = /^%/, | ||
requoteRe = /[\\^$*+?|[\]().{}]/g; | ||
function pad(value, fill, width) { | ||
var sign = value < 0 ? "-" : "", | ||
string = (sign ? -value : value) + "", | ||
length = string.length; | ||
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); | ||
} | ||
function requote(s) { | ||
return s.replace(requoteRe, "\\$&"); | ||
} | ||
function formatRe(names) { | ||
return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); | ||
} | ||
function formatLookup(names) { | ||
return new Map(names.map((name, i) => [name.toLowerCase(), i])); | ||
} | ||
function parseWeekdayNumberSunday(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 1)); | ||
return n ? (d.w = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseWeekdayNumberMonday(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 1)); | ||
return n ? (d.u = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseWeekNumberSunday(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.U = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseWeekNumberISO(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.V = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseWeekNumberMonday(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.W = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseFullYear(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 4)); | ||
return n ? (d.y = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseYear(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; | ||
} | ||
function parseZone(d, string, i) { | ||
var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); | ||
return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; | ||
} | ||
function parseQuarter(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 1)); | ||
return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; | ||
} | ||
function parseMonthNumber(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.m = n[0] - 1, i + n[0].length) : -1; | ||
} | ||
function parseDayOfMonth(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.d = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseDayOfYear(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 3)); | ||
return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseHour24(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.H = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseMinutes(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.M = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseSeconds(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 2)); | ||
return n ? (d.S = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseMilliseconds(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 3)); | ||
return n ? (d.L = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseMicroseconds(d, string, i) { | ||
var n = numberRe.exec(string.slice(i, i + 6)); | ||
return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; | ||
} | ||
function parseLiteralPercent(d, string, i) { | ||
var n = percentRe.exec(string.slice(i, i + 1)); | ||
return n ? i + n[0].length : -1; | ||
} | ||
function parseUnixTimestamp(d, string, i) { | ||
var n = numberRe.exec(string.slice(i)); | ||
return n ? (d.Q = +n[0], i + n[0].length) : -1; | ||
} | ||
function parseUnixTimestampSeconds(d, string, i) { | ||
var n = numberRe.exec(string.slice(i)); | ||
return n ? (d.s = +n[0], i + n[0].length) : -1; | ||
} | ||
function formatDayOfMonth(d, p) { | ||
return pad(d.getDate(), p, 2); | ||
} | ||
function formatHour24(d, p) { | ||
return pad(d.getHours(), p, 2); | ||
} | ||
function formatHour12(d, p) { | ||
return pad(d.getHours() % 12 || 12, p, 2); | ||
} | ||
function formatDayOfYear(d, p) { | ||
return pad(1 + timeDay.count(timeYear(d), d), p, 3); | ||
} | ||
function formatMilliseconds(d, p) { | ||
return pad(d.getMilliseconds(), p, 3); | ||
} | ||
function formatMicroseconds(d, p) { | ||
return formatMilliseconds(d, p) + "000"; | ||
} | ||
function formatMonthNumber(d, p) { | ||
return pad(d.getMonth() + 1, p, 2); | ||
} | ||
function formatMinutes(d, p) { | ||
return pad(d.getMinutes(), p, 2); | ||
} | ||
function formatSeconds(d, p) { | ||
return pad(d.getSeconds(), p, 2); | ||
} | ||
function formatWeekdayNumberMonday(d) { | ||
var day = d.getDay(); | ||
return day === 0 ? 7 : day; | ||
} | ||
function formatWeekNumberSunday(d, p) { | ||
return pad(sunday.count(timeYear(d) - 1, d), p, 2); | ||
} | ||
function dISO(d) { | ||
var day = d.getDay(); | ||
return day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d); | ||
} | ||
function formatWeekNumberISO(d, p) { | ||
d = dISO(d); | ||
return pad(thursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); | ||
} | ||
function formatWeekdayNumberSunday(d) { | ||
return d.getDay(); | ||
} | ||
function formatWeekNumberMonday(d, p) { | ||
return pad(monday.count(timeYear(d) - 1, d), p, 2); | ||
} | ||
function formatYear(d, p) { | ||
return pad(d.getFullYear() % 100, p, 2); | ||
} | ||
function formatYearISO(d, p) { | ||
d = dISO(d); | ||
return pad(d.getFullYear() % 100, p, 2); | ||
} | ||
function formatFullYear(d, p) { | ||
return pad(d.getFullYear() % 10000, p, 4); | ||
} | ||
function formatFullYearISO(d, p) { | ||
var day = d.getDay(); | ||
d = day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d); | ||
return pad(d.getFullYear() % 10000, p, 4); | ||
} | ||
function formatZone(d) { | ||
var z = d.getTimezoneOffset(); | ||
return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); | ||
} | ||
function formatUTCDayOfMonth(d, p) { | ||
return pad(d.getUTCDate(), p, 2); | ||
} | ||
function formatUTCHour24(d, p) { | ||
return pad(d.getUTCHours(), p, 2); | ||
} | ||
function formatUTCHour12(d, p) { | ||
return pad(d.getUTCHours() % 12 || 12, p, 2); | ||
} | ||
function formatUTCDayOfYear(d, p) { | ||
return pad(1 + utcDay$1.count(utcYear$1(d), d), p, 3); | ||
} | ||
function formatUTCMilliseconds(d, p) { | ||
return pad(d.getUTCMilliseconds(), p, 3); | ||
} | ||
function formatUTCMicroseconds(d, p) { | ||
return formatUTCMilliseconds(d, p) + "000"; | ||
} | ||
function formatUTCMonthNumber(d, p) { | ||
return pad(d.getUTCMonth() + 1, p, 2); | ||
} | ||
function formatUTCMinutes(d, p) { | ||
return pad(d.getUTCMinutes(), p, 2); | ||
} | ||
function formatUTCSeconds(d, p) { | ||
return pad(d.getUTCSeconds(), p, 2); | ||
} | ||
function formatUTCWeekdayNumberMonday(d) { | ||
var dow = d.getUTCDay(); | ||
return dow === 0 ? 7 : dow; | ||
} | ||
function formatUTCWeekNumberSunday(d, p) { | ||
return pad(utcSunday.count(utcYear$1(d) - 1, d), p, 2); | ||
} | ||
function UTCdISO(d) { | ||
var day = d.getUTCDay(); | ||
return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); | ||
} | ||
function formatUTCWeekNumberISO(d, p) { | ||
d = UTCdISO(d); | ||
return pad(utcThursday.count(utcYear$1(d), d) + (utcYear$1(d).getUTCDay() === 4), p, 2); | ||
} | ||
function formatUTCWeekdayNumberSunday(d) { | ||
return d.getUTCDay(); | ||
} | ||
function formatUTCWeekNumberMonday(d, p) { | ||
return pad(utcMonday.count(utcYear$1(d) - 1, d), p, 2); | ||
} | ||
function formatUTCYear(d, p) { | ||
return pad(d.getUTCFullYear() % 100, p, 2); | ||
} | ||
function formatUTCYearISO(d, p) { | ||
d = UTCdISO(d); | ||
return pad(d.getUTCFullYear() % 100, p, 2); | ||
} | ||
function formatUTCFullYear(d, p) { | ||
return pad(d.getUTCFullYear() % 10000, p, 4); | ||
} | ||
function formatUTCFullYearISO(d, p) { | ||
var day = d.getUTCDay(); | ||
d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); | ||
return pad(d.getUTCFullYear() % 10000, p, 4); | ||
} | ||
function formatUTCZone() { | ||
return "+0000"; | ||
} | ||
function formatLiteralPercent() { | ||
return "%"; | ||
} | ||
function formatUnixTimestamp(d) { | ||
return +d; | ||
} | ||
function formatUnixTimestampSeconds(d) { | ||
return Math.floor(+d / 1000); | ||
} | ||
var locale$1; | ||
var timeFormat; | ||
var timeParse; | ||
var utcFormat; | ||
var utcParse; | ||
defaultLocale$1({ | ||
dateTime: "%x, %X", | ||
date: "%-m/%-d/%Y", | ||
time: "%-I:%M:%S %p", | ||
periods: ["AM", "PM"], | ||
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], | ||
shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], | ||
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], | ||
shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] | ||
}); | ||
function defaultLocale$1(definition) { | ||
locale$1 = formatLocale(definition); | ||
timeFormat = locale$1.format; | ||
timeParse = locale$1.parse; | ||
utcFormat = locale$1.utcFormat; | ||
utcParse = locale$1.utcParse; | ||
return locale$1; | ||
} | ||
function timeMultiFormat(format, interval, spec) { | ||
@@ -184,10 +1408,10 @@ spec = spec || {}; | ||
return defaultTimeLocale = timeLocale({ | ||
format: d3TimeFormat.timeFormat, | ||
parse: d3TimeFormat.timeParse, | ||
utcFormat: d3TimeFormat.utcFormat, | ||
utcParse: d3TimeFormat.utcParse | ||
format: timeFormat, | ||
parse: timeParse, | ||
utcFormat: utcFormat, | ||
utcParse: utcParse | ||
}); | ||
} | ||
function timeFormatLocale(definition) { | ||
return timeLocale(d3TimeFormat.timeFormatLocale(definition)); | ||
return timeLocale(formatLocale(definition)); | ||
} | ||
@@ -232,2 +1456,2 @@ function timeFormatDefaultLocale(definition) { | ||
}))); | ||
})); |
@@ -1,2 +0,2 @@ | ||
var vega=function(t,e,n){"use strict";function r(t){const e={};return n=>e[n]||(e[n]=t(n))}var u=Math.sqrt(50),i=Math.sqrt(10),o=Math.sqrt(2);function a(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 c(t){return(t=a(Math.abs(t)))?t[1]:NaN}var f,l=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function s(t){if(!(e=l.exec(t)))throw new Error("invalid format: "+t);var e;return new g({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function g(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function h(t,e){var n=a(t,e);if(!n)return t+"";var r=n[0],u=n[1];return u<0?"0."+new Array(-u).join("0")+r:r.length>u+1?r.slice(0,u+1)+"."+r.slice(u+1):r+new Array(u-r.length+2).join("0")}s.prototype=g.prototype,g.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var m={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>h(100*t,e),r:h,s:function(t,e){var n=a(t,e);if(!n)return t+"";var r=n[0],u=n[1],i=u-(f=3*Math.max(-8,Math.min(8,Math.floor(u/3))))+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+a(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function v(t){return t}var d,M,y,p=Array.prototype.map,T=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function D(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?v:(e=p.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var u=t.length,i=[],o=0,a=e[0],c=0;u>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(t.substring(u-=a,u+a)),!((c+=a+1)>r));)a=e[o=(o+1)%e.length];return i.reverse().join(n)}),u=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?v:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(p.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",g=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=s(t)).fill,n=t.align,c=t.sign,v=t.symbol,d=t.zero,M=t.width,y=t.comma,p=t.precision,D=t.trim,C=t.type;"n"===C?(y=!0,C="g"):m[C]||(void 0===p&&(p=12),D=!0,C="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var U="$"===v?u:"#"===v&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",x="$"===v?i:/[%p]/.test(C)?l:"",w=m[C],F=/[defgprs%]/.test(C);function S(t){var u,i,l,s=U,m=x;if("c"===C)m=w(t)+m,t="";else{var v=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:w(Math.abs(t),p),D&&(t=function(t){t:for(var e,n=t.length,r=1,u=-1;r<n;++r)switch(t[r]){case".":u=e=r;break;case"0":0===u&&(u=r),e=r;break;default:if(!+t[r])break t;u>0&&(u=0)}return u>0?t.slice(0,u)+t.slice(e+1):t}(t)),v&&0==+t&&"+"!==c&&(v=!1),s=(v?"("===c?c:g:"-"===c||"("===c?"":c)+s,m=("s"===C?T[8+f/3]:"")+m+(v&&"("===c?")":""),F)for(u=-1,i=t.length;++u<i;)if(48>(l=t.charCodeAt(u))||l>57){m=(46===l?o+t.slice(u+1):t.slice(u))+m,t=t.slice(0,u);break}}y&&!d&&(t=r(t,1/0));var S=s.length+t.length+m.length,b=S<M?new Array(M-S+1).join(e):"";switch(y&&d&&(t=r(b+t,b.length?M-m.length:1/0),b=""),n){case"<":t=s+t+m+b;break;case"=":t=s+b+t+m;break;case"^":t=b.slice(0,S=b.length>>1)+s+t+m+b.slice(S);break;default:t=b+s+t+m}return a(t)}return p=void 0===p?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),S.toString=function(){return t+""},S}return{format:d,formatPrefix:function(t,e){var n=d(((t=s(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(c(e)/3))),u=Math.pow(10,-r),i=T[8+r/3];return function(t){return n(u*t)+i}}}}function C(t){const e=r(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=s(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),u=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(u);if(n<0)return e;let i=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const o=i<e.length?e.slice(i):"";for(;--i>n;)if("0"!==e[i]){++i;break}return e.slice(0,i)+o}}return e(n);var r,u},formatSpan(t,r,a,f){f=s(null==f?",f":f);const l=function(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),a=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),c=r/a;return c>=u?a*=10:c>=i?a*=5:c>=o&&(a*=2),e<t?-a:a}(t,r,a),g=Math.max(Math.abs(t),Math.abs(r));let h;if(null==f.precision)switch(f.type){case"s":return isNaN(h=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(c(e)/3)))-c(Math.abs(t)))}(l,g))||(f.precision=h),n(f,g);case"":case"e":case"g":case"p":case"r":isNaN(h=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,c(e)-c(t))+1}(l,g))||(f.precision=h-("e"===f.type));break;case"f":case"%":isNaN(h=function(t){return Math.max(0,-c(Math.abs(t)))}(l))||(f.precision=h-2*("%"===f.type))}return e(f)}}}let U;function x(){return U=C({format:M,formatPrefix:y})}function w(t){return C(D(t))}function F(t){return arguments.length?U=w(t):U}d=D({thousands:",",grouping:[3],currency:["$",""]}),M=d.format,y=d.formatPrefix,x();var S=new Date,b=new Date;function Y(t,e,n,r){function u(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return u.floor=function(e){return t(e=new Date(+e)),e},u.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},u.round=function(t){var e=u(t),n=u.ceil(t);return t-e<n-t?e:n},u.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},u.range=function(n,r,i){var o,a=[];if(n=u.ceil(n),i=null==i?1:Math.floor(i),!(n<r&&i>0))return a;do{a.push(o=new Date(+n)),e(n,i),t(n)}while(o<n&&n<r);return a},u.filter=function(n){return Y((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(u.count=function(e,r){return S.setTime(+e),b.setTime(+r),t(S),t(b),Math.floor(n(S,b))},u.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?u.filter(r?function(e){return r(e)%t==0}:function(e){return u.count(0,e)%t==0}):u:null}),u}var L=864e5,A=6048e5,H=Y(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/L,t=>t.getDate()-1);function N(t){return Y((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/A}))}var E=N(0),O=N(1),I=(N(2),N(3),N(4)),P=(N(5),N(6),Y((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()})));P.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Y((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var j=Y((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/L}),(function(t){return t.getUTCDate()-1}));function z(t){return Y((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/A}))}var Z=z(0),W=z(1),k=(z(2),z(3),z(4)),q=(z(5),z(6),Y((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));function R(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 V(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 Q(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function X(t){var e=t.dateTime,n=t.date,r=t.time,u=t.periods,i=t.days,o=t.shortDays,a=t.months,c=t.shortMonths,f=it(u),l=ot(u),s=it(i),g=ot(i),h=it(o),m=ot(o),v=it(a),d=ot(a),M=it(c),y=ot(c),p={a:function(t){return o[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:St,e:St,f:Ht,g:qt,G:Vt,H:bt,I:Yt,j:Lt,L:At,m:Nt,M:Et,p:function(t){return u[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:me,s:ve,S:Ot,u:It,U:Pt,V:zt,w:Zt,W:Wt,x:null,X:null,y:kt,Y:Rt,Z:Qt,"%":he},T={a:function(t){return o[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:Xt,e:Xt,f:Kt,g:fe,G:se,H:$t,I:Jt,j:Bt,L:Gt,m:_t,M:te,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:me,s:ve,S:ee,u:ne,U:re,V:ie,w:oe,W:ae,x:null,X:null,y:ce,Y:le,Z:ge,"%":he},D={a:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=m.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=s.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=M.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=d.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return x(t,e,n,r)},d:Mt,e:Mt,f:Ut,g:ht,G:gt,H:pt,I:pt,j:yt,L:Ct,m:dt,M:Tt,p:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1},q:vt,Q:wt,s:Ft,S:Dt,u:ct,U:ft,V:lt,w:at,W:st,x:function(t,e,r){return x(t,n,e,r)},X:function(t,e,n){return x(t,r,e,n)},y:ht,Y:gt,Z:mt,"%":xt};function C(t,e){return function(n){var r,u,i,o=[],a=-1,c=0,f=t.length;for(n instanceof Date||(n=new Date(+n));++a<f;)37===t.charCodeAt(a)&&(o.push(t.slice(c,a)),null!=(u=_[r=t.charAt(++a)])?r=t.charAt(++a):u="e"===r?" ":"0",(i=e[r])&&(r=i(n,u)),o.push(r),c=a+1);return o.push(t.slice(c,a)),o.join("")}}function U(t,e){return function(n){var r,u,i=Q(1900,void 0,1);if(x(i,t,n+="",0)!=n.length)return null;if("Q"in i)return new Date(i.Q);if("s"in i)return new Date(1e3*i.s+("L"in i?i.L:0));if(e&&!("Z"in i)&&(i.Z=0),"p"in i&&(i.H=i.H%12+12*i.p),void 0===i.m&&(i.m="q"in i?i.q:0),"V"in i){if(i.V<1||i.V>53)return null;"w"in i||(i.w=1),"Z"in i?(u=(r=V(Q(i.y,0,1))).getUTCDay(),r=u>4||0===u?W.ceil(r):W(r),r=j.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(u=(r=R(Q(i.y,0,1))).getDay(),r=u>4||0===u?O.ceil(r):O(r),r=H.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),u="Z"in i?V(Q(i.y,0,1)).getUTCDay():R(Q(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(u+5)%7:i.w+7*i.U-(u+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,V(i)):R(i)}}function x(t,e,n,r){for(var u,i,o=0,a=e.length,c=n.length;o<a;){if(r>=c)return-1;if(37===(u=e.charCodeAt(o++))){if(u=e.charAt(o++),!(i=D[u in _?e.charAt(o++):u])||(r=i(t,n,r))<0)return-1}else if(u!=n.charCodeAt(r++))return-1}return r}return p.x=C(n,p),p.X=C(r,p),p.c=C(e,p),T.x=C(n,T),T.X=C(r,T),T.c=C(e,T),{format:function(t){var e=C(t+="",p);return e.toString=function(){return t},e},parse:function(t){var e=U(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=C(t+="",T);return e.toString=function(){return t},e},utcParse:function(t){var e=U(t+="",!0);return e.toString=function(){return t},e}}}q.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Y((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var $,J,B,G,K,_={"-":"",_:" ",0:"0"},tt=/^\s*\d+/,et=/^%/,nt=/[\\^$*+?|[\]().{}]/g;function rt(t,e,n){var r=t<0?"-":"",u=(r?-t:t)+"",i=u.length;return r+(i<n?new Array(n-i+1).join(e)+u:u)}function ut(t){return t.replace(nt,"\\$&")}function it(t){return new RegExp("^(?:"+t.map(ut).join("|")+")","i")}function ot(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function at(t,e,n){var r=tt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ct(t,e,n){var r=tt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ft(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function lt(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function st(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function gt(t,e,n){var r=tt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ht(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function mt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function vt(t,e,n){var r=tt.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function dt(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Mt(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function yt(t,e,n){var r=tt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function pt(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Tt(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Dt(t,e,n){var r=tt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Ct(t,e,n){var r=tt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ut(t,e,n){var r=tt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function xt(t,e,n){var r=et.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function wt(t,e,n){var r=tt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Ft(t,e,n){var r=tt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function St(t,e){return rt(t.getDate(),e,2)}function bt(t,e){return rt(t.getHours(),e,2)}function Yt(t,e){return rt(t.getHours()%12||12,e,2)}function Lt(t,e){return rt(1+H.count(P(t),t),e,3)}function At(t,e){return rt(t.getMilliseconds(),e,3)}function Ht(t,e){return At(t,e)+"000"}function Nt(t,e){return rt(t.getMonth()+1,e,2)}function Et(t,e){return rt(t.getMinutes(),e,2)}function Ot(t,e){return rt(t.getSeconds(),e,2)}function It(t){var e=t.getDay();return 0===e?7:e}function Pt(t,e){return rt(E.count(P(t)-1,t),e,2)}function jt(t){var e=t.getDay();return e>=4||0===e?I(t):I.ceil(t)}function zt(t,e){return t=jt(t),rt(I.count(P(t),t)+(4===P(t).getDay()),e,2)}function Zt(t){return t.getDay()}function Wt(t,e){return rt(O.count(P(t)-1,t),e,2)}function kt(t,e){return rt(t.getFullYear()%100,e,2)}function qt(t,e){return rt((t=jt(t)).getFullYear()%100,e,2)}function Rt(t,e){return rt(t.getFullYear()%1e4,e,4)}function Vt(t,e){var n=t.getDay();return rt((t=n>=4||0===n?I(t):I.ceil(t)).getFullYear()%1e4,e,4)}function Qt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+rt(e/60|0,"0",2)+rt(e%60,"0",2)}function Xt(t,e){return rt(t.getUTCDate(),e,2)}function $t(t,e){return rt(t.getUTCHours(),e,2)}function Jt(t,e){return rt(t.getUTCHours()%12||12,e,2)}function Bt(t,e){return rt(1+j.count(q(t),t),e,3)}function Gt(t,e){return rt(t.getUTCMilliseconds(),e,3)}function Kt(t,e){return Gt(t,e)+"000"}function _t(t,e){return rt(t.getUTCMonth()+1,e,2)}function te(t,e){return rt(t.getUTCMinutes(),e,2)}function ee(t,e){return rt(t.getUTCSeconds(),e,2)}function ne(t){var e=t.getUTCDay();return 0===e?7:e}function re(t,e){return rt(Z.count(q(t)-1,t),e,2)}function ue(t){var e=t.getUTCDay();return e>=4||0===e?k(t):k.ceil(t)}function ie(t,e){return t=ue(t),rt(k.count(q(t),t)+(4===q(t).getUTCDay()),e,2)}function oe(t){return t.getUTCDay()}function ae(t,e){return rt(W.count(q(t)-1,t),e,2)}function ce(t,e){return rt(t.getUTCFullYear()%100,e,2)}function fe(t,e){return rt((t=ue(t)).getUTCFullYear()%100,e,2)}function le(t,e){return rt(t.getUTCFullYear()%1e4,e,4)}function se(t,e){var n=t.getUTCDay();return rt((t=n>=4||0===n?k(t):k.ceil(t)).getUTCFullYear()%1e4,e,4)}function ge(){return"+0000"}function he(){return"%"}function me(t){return+t}function ve(t){return Math.floor(+t/1e3)}function de(t,r,u){u=u||{},n.isObject(u)||n.error("Invalid time multi-format specifier: ".concat(u));const i=r(e.SECONDS),o=r(e.MINUTES),a=r(e.HOURS),c=r(e.DATE),f=r(e.WEEK),l=r(e.MONTH),s=r(e.QUARTER),g=r(e.YEAR),h=t(u[e.MILLISECONDS]||".%L"),m=t(u[e.SECONDS]||":%S"),v=t(u[e.MINUTES]||"%I:%M"),d=t(u[e.HOURS]||"%I %p"),M=t(u[e.DATE]||u[e.DAY]||"%a %d"),y=t(u[e.WEEK]||"%b %d"),p=t(u[e.MONTH]||"%B"),T=t(u[e.QUARTER]||"%B"),D=t(u[e.YEAR]||"%Y");return t=>(i(t)<t?h:o(t)<t?m:a(t)<t?v:c(t)<t?d:l(t)<t?f(t)<t?M:y:g(t)<t?s(t)<t?p:T:D)(t)}function Me(t){const u=r(t.format),i=r(t.utcFormat);return{timeFormat:t=>n.isString(t)?u(t):de(u,e.timeInterval,t),utcFormat:t=>n.isString(t)?i(t):de(i,e.utcInterval,t),timeParse:r(t.parse),utcParse:r(t.utcParse)}}let ye;function pe(){return ye=Me({format:J,parse:B,utcFormat:G,utcParse:K})}function Te(t){return Me(X(t))}function De(t){return arguments.length?ye=Te(t):ye}!function(t){$=X(t),J=$.format,B=$.parse,G=$.utcFormat,K=$.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),pe();const Ce=(t,e)=>n.extend({},t,e);function Ue(t,e){const r=arguments.length;return r&&2!==r&&n.error("defaultLocale expects either zero or two arguments."),r?Ce(F(t),De(e)):Ce(F(),De())}return t.defaultLocale=Ue,t.locale=function(t,e){const n=t?w(t):F(),r=e?Te(e):De();return Ce(n,r)},t.numberFormatDefaultLocale=F,t.numberFormatLocale=w,t.resetDefaultLocale=function(){return x(),pe(),Ue()},t.resetNumberFormatDefaultLocale=x,t.resetTimeFormatDefaultLocale=pe,t.timeFormatDefaultLocale=De,t.timeFormatLocale=Te,t}({},vega,vega); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-time"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-time","vega-util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega,t.vega)}(this,(function(t,e,n){"use strict";function r(t){const e={};return n=>e[n]||(e[n]=t(n))}var u=Math.sqrt(50),i=Math.sqrt(10),o=Math.sqrt(2);function a(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 c(t){return(t=a(Math.abs(t)))?t[1]:NaN}var f,l=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function s(t){if(!(e=l.exec(t)))throw new Error("invalid format: "+t);var e;return new g({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function g(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function h(t,e){var n=a(t,e);if(!n)return t+"";var r=n[0],u=n[1];return u<0?"0."+new Array(-u).join("0")+r:r.length>u+1?r.slice(0,u+1)+"."+r.slice(u+1):r+new Array(u-r.length+2).join("0")}s.prototype=g.prototype,g.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var m={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>h(100*t,e),r:h,s:function(t,e){var n=a(t,e);if(!n)return t+"";var r=n[0],u=n[1],i=u-(f=3*Math.max(-8,Math.min(8,Math.floor(u/3))))+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+a(t,Math.max(0,e+i-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function v(t){return t}var d,M,y,p=Array.prototype.map,T=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function D(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?v:(e=p.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var u=t.length,i=[],o=0,a=e[0],c=0;u>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),i.push(t.substring(u-=a,u+a)),!((c+=a+1)>r));)a=e[o=(o+1)%e.length];return i.reverse().join(n)}),u=void 0===t.currency?"":t.currency[0]+"",i=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?v:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(p.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",g=void 0===t.minus?"−":t.minus+"",h=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=s(t)).fill,n=t.align,c=t.sign,v=t.symbol,d=t.zero,M=t.width,y=t.comma,p=t.precision,D=t.trim,C=t.type;"n"===C?(y=!0,C="g"):m[C]||(void 0===p&&(p=12),D=!0,C="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var x="$"===v?u:"#"===v&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",U="$"===v?i:/[%p]/.test(C)?l:"",w=m[C],F=/[defgprs%]/.test(C);function b(t){var u,i,l,s=x,m=U;if("c"===C)m=w(t)+m,t="";else{var v=(t=+t)<0||1/t<0;if(t=isNaN(t)?h:w(Math.abs(t),p),D&&(t=function(t){t:for(var e,n=t.length,r=1,u=-1;r<n;++r)switch(t[r]){case".":u=e=r;break;case"0":0===u&&(u=r),e=r;break;default:if(!+t[r])break t;u>0&&(u=0)}return u>0?t.slice(0,u)+t.slice(e+1):t}(t)),v&&0==+t&&"+"!==c&&(v=!1),s=(v?"("===c?c:g:"-"===c||"("===c?"":c)+s,m=("s"===C?T[8+f/3]:"")+m+(v&&"("===c?")":""),F)for(u=-1,i=t.length;++u<i;)if(48>(l=t.charCodeAt(u))||l>57){m=(46===l?o+t.slice(u+1):t.slice(u))+m,t=t.slice(0,u);break}}y&&!d&&(t=r(t,1/0));var b=s.length+t.length+m.length,S=b<M?new Array(M-b+1).join(e):"";switch(y&&d&&(t=r(S+t,S.length?M-m.length:1/0),S=""),n){case"<":t=s+t+m+S;break;case"=":t=s+S+t+m;break;case"^":t=S.slice(0,b=S.length>>1)+s+t+m+S.slice(b);break;default:t=S+s+t+m}return a(t)}return p=void 0===p?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),b.toString=function(){return t+""},b}return{format:d,formatPrefix:function(t,e){var n=d(((t=s(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(c(e)/3))),u=Math.pow(10,-r),i=T[8+r/3];return function(t){return n(u*t)+i}}}}function C(t){const e=r(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=s(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),u=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(u);if(n<0)return e;let i=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const o=i<e.length?e.slice(i):"";for(;--i>n;)if("0"!==e[i]){++i;break}return e.slice(0,i)+o}}return e(n);var r,u},formatSpan(t,r,a,f){f=s(null==f?",f":f);const l=function(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),a=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),c=r/a;return c>=u?a*=10:c>=i?a*=5:c>=o&&(a*=2),e<t?-a:a}(t,r,a),g=Math.max(Math.abs(t),Math.abs(r));let h;if(null==f.precision)switch(f.type){case"s":return isNaN(h=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(c(e)/3)))-c(Math.abs(t)))}(l,g))||(f.precision=h),n(f,g);case"":case"e":case"g":case"p":case"r":isNaN(h=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,c(e)-c(t))+1}(l,g))||(f.precision=h-("e"===f.type));break;case"f":case"%":isNaN(h=function(t){return Math.max(0,-c(Math.abs(t)))}(l))||(f.precision=h-2*("%"===f.type))}return e(f)}}}let x;function U(){return x=C({format:M,formatPrefix:y})}function w(t){return C(D(t))}function F(t){return arguments.length?x=w(t):x}d=D({thousands:",",grouping:[3],currency:["$",""]}),M=d.format,y=d.formatPrefix,U();var b=new Date,S=new Date;function Y(t,e,n,r){function u(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return u.floor=function(e){return t(e=new Date(+e)),e},u.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},u.round=function(t){var e=u(t),n=u.ceil(t);return t-e<n-t?e:n},u.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},u.range=function(n,r,i){var o,a=[];if(n=u.ceil(n),i=null==i?1:Math.floor(i),!(n<r&&i>0))return a;do{a.push(o=new Date(+n)),e(n,i),t(n)}while(o<n&&n<r);return a},u.filter=function(n){return Y((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(u.count=function(e,r){return b.setTime(+e),S.setTime(+r),t(b),t(S),Math.floor(n(b,S))},u.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?u.filter(r?function(e){return r(e)%t==0}:function(e){return u.count(0,e)%t==0}):u:null}),u}const L=6e4,A=864e5,H=6048e5;var N=Y((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*L)/A),(t=>t.getDate()-1));function E(t){return Y((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*L)/H}))}var O=E(0),j=E(1);E(2),E(3);var P=E(4);E(5),E(6);var I=Y((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));I.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Y((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var z=I,Z=Y((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/A}),(function(t){return t.getUTCDate()-1}));function W(t){return Y((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/H}))}var k=W(0),q=W(1);W(2),W(3);var R=W(4);W(5),W(6);var V=Y((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));V.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Y((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Q=V;function X(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 $(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 J(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function B(t){var e=t.dateTime,n=t.date,r=t.time,u=t.periods,i=t.days,o=t.shortDays,a=t.months,c=t.shortMonths,f=ct(u),l=ft(u),s=ct(i),g=ft(i),h=ct(o),m=ft(o),v=ct(a),d=ft(a),M=ct(c),y=ft(c),p={a:function(t){return o[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:Lt,e:Lt,f:Ot,g:Qt,G:$t,H:At,I:Ht,j:Nt,L:Et,m:jt,M:Pt,p:function(t){return u[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Me,s:ye,S:It,u:zt,U:Zt,V:kt,w:qt,W:Rt,x:null,X:null,y:Vt,Y:Xt,Z:Jt,"%":de},T={a:function(t){return o[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:Bt,e:Bt,f:ee,g:ge,G:me,H:Gt,I:_t,j:Kt,L:te,m:ne,M:re,p:function(t){return u[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Me,s:ye,S:ue,u:ie,U:oe,V:ce,w:fe,W:le,x:null,X:null,y:se,Y:he,Z:ve,"%":de},D={a:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=m.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=s.exec(e.slice(n));return r?(t.w=g.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=M.exec(e.slice(n));return r?(t.m=y.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=d.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return U(t,e,n,r)},d:Tt,e:Tt,f:Ft,g:dt,G:vt,H:Ct,I:Ct,j:Dt,L:wt,m:pt,M:xt,p:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.p=l.get(r[0].toLowerCase()),n+r[0].length):-1},q:yt,Q:St,s:Yt,S:Ut,u:st,U:gt,V:ht,w:lt,W:mt,x:function(t,e,r){return U(t,n,e,r)},X:function(t,e,n){return U(t,r,e,n)},y:dt,Y:vt,Z:Mt,"%":bt};function C(t,e){return function(n){var r,u,i,o=[],a=-1,c=0,f=t.length;for(n instanceof Date||(n=new Date(+n));++a<f;)37===t.charCodeAt(a)&&(o.push(t.slice(c,a)),null!=(u=nt[r=t.charAt(++a)])?r=t.charAt(++a):u="e"===r?" ":"0",(i=e[r])&&(r=i(n,u)),o.push(r),c=a+1);return o.push(t.slice(c,a)),o.join("")}}function x(t,e){return function(n){var r,u,i=J(1900,void 0,1);if(U(i,t,n+="",0)!=n.length)return null;if("Q"in i)return new Date(i.Q);if("s"in i)return new Date(1e3*i.s+("L"in i?i.L:0));if(e&&!("Z"in i)&&(i.Z=0),"p"in i&&(i.H=i.H%12+12*i.p),void 0===i.m&&(i.m="q"in i?i.q:0),"V"in i){if(i.V<1||i.V>53)return null;"w"in i||(i.w=1),"Z"in i?(u=(r=$(J(i.y,0,1))).getUTCDay(),r=u>4||0===u?q.ceil(r):q(r),r=Z.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(u=(r=X(J(i.y,0,1))).getDay(),r=u>4||0===u?j.ceil(r):j(r),r=N.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),u="Z"in i?$(J(i.y,0,1)).getUTCDay():X(J(i.y,0,1)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(u+5)%7:i.w+7*i.U-(u+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,$(i)):X(i)}}function U(t,e,n,r){for(var u,i,o=0,a=e.length,c=n.length;o<a;){if(r>=c)return-1;if(37===(u=e.charCodeAt(o++))){if(u=e.charAt(o++),!(i=D[u in nt?e.charAt(o++):u])||(r=i(t,n,r))<0)return-1}else if(u!=n.charCodeAt(r++))return-1}return r}return p.x=C(n,p),p.X=C(r,p),p.c=C(e,p),T.x=C(n,T),T.X=C(r,T),T.c=C(e,T),{format:function(t){var e=C(t+="",p);return e.toString=function(){return t},e},parse:function(t){var e=x(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=C(t+="",T);return e.toString=function(){return t},e},utcParse:function(t){var e=x(t+="",!0);return e.toString=function(){return t},e}}}var G,_,K,tt,et,nt={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,ut=/^%/,it=/[\\^$*+?|[\]().{}]/g;function ot(t,e,n){var r=t<0?"-":"",u=(r?-t:t)+"",i=u.length;return r+(i<n?new Array(n-i+1).join(e)+u:u)}function at(t){return t.replace(it,"\\$&")}function ct(t){return new RegExp("^(?:"+t.map(at).join("|")+")","i")}function ft(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function lt(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function st(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function gt(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ht(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function mt(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function vt(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function dt(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Mt(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function yt(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function pt(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Tt(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Dt(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ct(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function xt(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Ut(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function wt(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ft(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function bt(t,e,n){var r=ut.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function St(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Yt(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Lt(t,e){return ot(t.getDate(),e,2)}function At(t,e){return ot(t.getHours(),e,2)}function Ht(t,e){return ot(t.getHours()%12||12,e,2)}function Nt(t,e){return ot(1+N.count(z(t),t),e,3)}function Et(t,e){return ot(t.getMilliseconds(),e,3)}function Ot(t,e){return Et(t,e)+"000"}function jt(t,e){return ot(t.getMonth()+1,e,2)}function Pt(t,e){return ot(t.getMinutes(),e,2)}function It(t,e){return ot(t.getSeconds(),e,2)}function zt(t){var e=t.getDay();return 0===e?7:e}function Zt(t,e){return ot(O.count(z(t)-1,t),e,2)}function Wt(t){var e=t.getDay();return e>=4||0===e?P(t):P.ceil(t)}function kt(t,e){return t=Wt(t),ot(P.count(z(t),t)+(4===z(t).getDay()),e,2)}function qt(t){return t.getDay()}function Rt(t,e){return ot(j.count(z(t)-1,t),e,2)}function Vt(t,e){return ot(t.getFullYear()%100,e,2)}function Qt(t,e){return ot((t=Wt(t)).getFullYear()%100,e,2)}function Xt(t,e){return ot(t.getFullYear()%1e4,e,4)}function $t(t,e){var n=t.getDay();return ot((t=n>=4||0===n?P(t):P.ceil(t)).getFullYear()%1e4,e,4)}function Jt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ot(e/60|0,"0",2)+ot(e%60,"0",2)}function Bt(t,e){return ot(t.getUTCDate(),e,2)}function Gt(t,e){return ot(t.getUTCHours(),e,2)}function _t(t,e){return ot(t.getUTCHours()%12||12,e,2)}function Kt(t,e){return ot(1+Z.count(Q(t),t),e,3)}function te(t,e){return ot(t.getUTCMilliseconds(),e,3)}function ee(t,e){return te(t,e)+"000"}function ne(t,e){return ot(t.getUTCMonth()+1,e,2)}function re(t,e){return ot(t.getUTCMinutes(),e,2)}function ue(t,e){return ot(t.getUTCSeconds(),e,2)}function ie(t){var e=t.getUTCDay();return 0===e?7:e}function oe(t,e){return ot(k.count(Q(t)-1,t),e,2)}function ae(t){var e=t.getUTCDay();return e>=4||0===e?R(t):R.ceil(t)}function ce(t,e){return t=ae(t),ot(R.count(Q(t),t)+(4===Q(t).getUTCDay()),e,2)}function fe(t){return t.getUTCDay()}function le(t,e){return ot(q.count(Q(t)-1,t),e,2)}function se(t,e){return ot(t.getUTCFullYear()%100,e,2)}function ge(t,e){return ot((t=ae(t)).getUTCFullYear()%100,e,2)}function he(t,e){return ot(t.getUTCFullYear()%1e4,e,4)}function me(t,e){var n=t.getUTCDay();return ot((t=n>=4||0===n?R(t):R.ceil(t)).getUTCFullYear()%1e4,e,4)}function ve(){return"+0000"}function de(){return"%"}function Me(t){return+t}function ye(t){return Math.floor(+t/1e3)}function pe(t,r,u){u=u||{},n.isObject(u)||n.error("Invalid time multi-format specifier: ".concat(u));const i=r(e.SECONDS),o=r(e.MINUTES),a=r(e.HOURS),c=r(e.DATE),f=r(e.WEEK),l=r(e.MONTH),s=r(e.QUARTER),g=r(e.YEAR),h=t(u[e.MILLISECONDS]||".%L"),m=t(u[e.SECONDS]||":%S"),v=t(u[e.MINUTES]||"%I:%M"),d=t(u[e.HOURS]||"%I %p"),M=t(u[e.DATE]||u[e.DAY]||"%a %d"),y=t(u[e.WEEK]||"%b %d"),p=t(u[e.MONTH]||"%B"),T=t(u[e.QUARTER]||"%B"),D=t(u[e.YEAR]||"%Y");return t=>(i(t)<t?h:o(t)<t?m:a(t)<t?v:c(t)<t?d:l(t)<t?f(t)<t?M:y:g(t)<t?s(t)<t?p:T:D)(t)}function Te(t){const u=r(t.format),i=r(t.utcFormat);return{timeFormat:t=>n.isString(t)?u(t):pe(u,e.timeInterval,t),utcFormat:t=>n.isString(t)?i(t):pe(i,e.utcInterval,t),timeParse:r(t.parse),utcParse:r(t.utcParse)}}let De;function Ce(){return De=Te({format:_,parse:K,utcFormat:tt,utcParse:et})}function xe(t){return Te(B(t))}function Ue(t){return arguments.length?De=xe(t):De}!function(t){G=B(t),_=G.format,K=G.parse,tt=G.utcFormat,et=G.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Ce();const we=(t,e)=>n.extend({},t,e);function Fe(t,e){const r=arguments.length;return r&&2!==r&&n.error("defaultLocale expects either zero or two arguments."),r?we(F(t),Ue(e)):we(F(),Ue())}t.defaultLocale=Fe,t.locale=function(t,e){const n=t?w(t):F(),r=e?xe(e):Ue();return we(n,r)},t.numberFormatDefaultLocale=F,t.numberFormatLocale=w,t.resetDefaultLocale=function(){return U(),Ce(),Fe()},t.resetNumberFormatDefaultLocale=U,t.resetTimeFormatDefaultLocale=Ce,t.timeFormatDefaultLocale=Ue,t.timeFormatLocale=xe,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=vega-format.min.js.map |
import { tickStep } from 'd3-array'; | ||
import { formatSpecifier, precisionFixed, precisionRound, precisionPrefix, formatLocale, format, formatPrefix } from 'd3-format'; | ||
import { formatSpecifier, precisionFixed, precisionRound, precisionPrefix, format, formatPrefix, formatLocale } from 'd3-format'; | ||
import { SECONDS, MINUTES, HOURS, DATE, WEEK, MONTH, QUARTER, YEAR, MILLISECONDS, DAY, timeInterval, utcInterval } from 'vega-time'; | ||
@@ -4,0 +4,0 @@ import { isString, isObject, error, extend } from 'vega-util'; |
{ | ||
"name": "vega-format", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "JavaScript string formatting utilities for Vega.", | ||
@@ -26,9 +26,9 @@ "keywords": [ | ||
"dependencies": { | ||
"d3-array": "^2.7.1", | ||
"d3-format": "^2.0.0", | ||
"d3-time-format": "^3.0.0", | ||
"d3-array": "^3.1.1", | ||
"d3-format": "^3.1.0", | ||
"d3-time-format": "^4.1.0", | ||
"vega-time": "^2.0.3", | ||
"vega-util": "^1.15.2" | ||
}, | ||
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0" | ||
"gitHead": "9a3faca4395cade9ecdfde90af98f1c53e9916b2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
179133
1704
1
1
+ Addedd3-format@3.1.0(transitive)
+ Addedd3-time-format@4.1.0(transitive)
+ Addedinternmap@2.0.3(transitive)
- Removedd3-array@2.12.1(transitive)
- Removedd3-format@2.0.0(transitive)
- Removedd3-time@2.1.1(transitive)
- Removedd3-time-format@3.0.0(transitive)
- Removedinternmap@1.0.1(transitive)
Updatedd3-array@^3.1.1
Updatedd3-format@^3.1.0
Updatedd3-time-format@^4.1.0