var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// ../../node_modules/lodash/lodash.js
var require_lodash = __commonJS({
"../../node_modules/lodash/lodash.js"(exports, module) {
(function() {
var undefined2;
var VERSION = "4.17.21";
var LARGE_ARRAY_SIZE = 200;
var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var MAX_MEMOIZE_SIZE = 500;
var PLACEHOLDER = "__lodash_placeholder__";
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
var HOT_COUNT = 800, HOT_SPAN = 16;
var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
var INFINITY = 1 / 0, MAX_SAFE_INTEGER2 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
var wrapFlags = [
["ary", WRAP_ARY_FLAG],
["bind", WRAP_BIND_FLAG],
["bindKey", WRAP_BIND_KEY_FLAG],
["curry", WRAP_CURRY_FLAG],
["curryRight", WRAP_CURRY_RIGHT_FLAG],
["flip", WRAP_FLIP_FLAG],
["partial", WRAP_PARTIAL_FLAG],
["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
["rearg", WRAP_REARG_FLAG]
];
var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
var reTrimStart = /^\s+/;
var reWhitespace = /\s/;
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
var reEscapeChar = /\\(\\)?/g;
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
var reFlags = /\w*$/;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var reIsOctal = /^0o[0-7]+$/i;
var reIsUint = /^(?:0|[1-9]\d*)$/;
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var reNoMatch = /($^)/;
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
var reApos = RegExp(rsApos, "g");
var reComboMark = RegExp(rsCombo, "g");
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
var reUnicodeWord = RegExp([
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
rsUpper + "+" + rsOptContrUpper,
rsOrdUpper,
rsOrdLower,
rsDigits,
rsEmoji
].join("|"), "g");
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
var contextProps = [
"Array",
"Buffer",
"DataView",
"Date",
"Error",
"Float32Array",
"Float64Array",
"Function",
"Int8Array",
"Int16Array",
"Int32Array",
"Map",
"Math",
"Object",
"Promise",
"RegExp",
"Set",
"String",
"Symbol",
"TypeError",
"Uint8Array",
"Uint8ClampedArray",
"Uint16Array",
"Uint32Array",
"WeakMap",
"_",
"clearTimeout",
"isFinite",
"parseInt",
"setTimeout"
];
var templateCounter = -1;
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
var deburredLetters = {
// Latin-1 Supplement block.
"\xC0": "A",
"\xC1": "A",
"\xC2": "A",
"\xC3": "A",
"\xC4": "A",
"\xC5": "A",
"\xE0": "a",
"\xE1": "a",
"\xE2": "a",
"\xE3": "a",
"\xE4": "a",
"\xE5": "a",
"\xC7": "C",
"\xE7": "c",
"\xD0": "D",
"\xF0": "d",
"\xC8": "E",
"\xC9": "E",
"\xCA": "E",
"\xCB": "E",
"\xE8": "e",
"\xE9": "e",
"\xEA": "e",
"\xEB": "e",
"\xCC": "I",
"\xCD": "I",
"\xCE": "I",
"\xCF": "I",
"\xEC": "i",
"\xED": "i",
"\xEE": "i",
"\xEF": "i",
"\xD1": "N",
"\xF1": "n",
"\xD2": "O",
"\xD3": "O",
"\xD4": "O",
"\xD5": "O",
"\xD6": "O",
"\xD8": "O",
"\xF2": "o",
"\xF3": "o",
"\xF4": "o",
"\xF5": "o",
"\xF6": "o",
"\xF8": "o",
"\xD9": "U",
"\xDA": "U",
"\xDB": "U",
"\xDC": "U",
"\xF9": "u",
"\xFA": "u",
"\xFB": "u",
"\xFC": "u",
"\xDD": "Y",
"\xFD": "y",
"\xFF": "y",
"\xC6": "Ae",
"\xE6": "ae",
"\xDE": "Th",
"\xFE": "th",
"\xDF": "ss",
// Latin Extended-A block.
"\u0100": "A",
"\u0102": "A",
"\u0104": "A",
"\u0101": "a",
"\u0103": "a",
"\u0105": "a",
"\u0106": "C",
"\u0108": "C",
"\u010A": "C",
"\u010C": "C",
"\u0107": "c",
"\u0109": "c",
"\u010B": "c",
"\u010D": "c",
"\u010E": "D",
"\u0110": "D",
"\u010F": "d",
"\u0111": "d",
"\u0112": "E",
"\u0114": "E",
"\u0116": "E",
"\u0118": "E",
"\u011A": "E",
"\u0113": "e",
"\u0115": "e",
"\u0117": "e",
"\u0119": "e",
"\u011B": "e",
"\u011C": "G",
"\u011E": "G",
"\u0120": "G",
"\u0122": "G",
"\u011D": "g",
"\u011F": "g",
"\u0121": "g",
"\u0123": "g",
"\u0124": "H",
"\u0126": "H",
"\u0125": "h",
"\u0127": "h",
"\u0128": "I",
"\u012A": "I",
"\u012C": "I",
"\u012E": "I",
"\u0130": "I",
"\u0129": "i",
"\u012B": "i",
"\u012D": "i",
"\u012F": "i",
"\u0131": "i",
"\u0134": "J",
"\u0135": "j",
"\u0136": "K",
"\u0137": "k",
"\u0138": "k",
"\u0139": "L",
"\u013B": "L",
"\u013D": "L",
"\u013F": "L",
"\u0141": "L",
"\u013A": "l",
"\u013C": "l",
"\u013E": "l",
"\u0140": "l",
"\u0142": "l",
"\u0143": "N",
"\u0145": "N",
"\u0147": "N",
"\u014A": "N",
"\u0144": "n",
"\u0146": "n",
"\u0148": "n",
"\u014B": "n",
"\u014C": "O",
"\u014E": "O",
"\u0150": "O",
"\u014D": "o",
"\u014F": "o",
"\u0151": "o",
"\u0154": "R",
"\u0156": "R",
"\u0158": "R",
"\u0155": "r",
"\u0157": "r",
"\u0159": "r",
"\u015A": "S",
"\u015C": "S",
"\u015E": "S",
"\u0160": "S",
"\u015B": "s",
"\u015D": "s",
"\u015F": "s",
"\u0161": "s",
"\u0162": "T",
"\u0164": "T",
"\u0166": "T",
"\u0163": "t",
"\u0165": "t",
"\u0167": "t",
"\u0168": "U",
"\u016A": "U",
"\u016C": "U",
"\u016E": "U",
"\u0170": "U",
"\u0172": "U",
"\u0169": "u",
"\u016B": "u",
"\u016D": "u",
"\u016F": "u",
"\u0171": "u",
"\u0173": "u",
"\u0174": "W",
"\u0175": "w",
"\u0176": "Y",
"\u0177": "y",
"\u0178": "Y",
"\u0179": "Z",
"\u017B": "Z",
"\u017D": "Z",
"\u017A": "z",
"\u017C": "z",
"\u017E": "z",
"\u0132": "IJ",
"\u0133": "ij",
"\u0152": "Oe",
"\u0153": "oe",
"\u0149": "'n",
"\u017F": "s"
};
var htmlEscapes = {
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'"
};
var htmlUnescapes = {
"&": "&",
"<": "<",
">": ">",
""": '"',
"'": "'"
};
var stringEscapes = {
"\\": "\\",
"'": "'",
"\n": "n",
"\r": "r",
"\u2028": "u2028",
"\u2029": "u2029"
};
var freeParseFloat = parseFloat, freeParseInt = parseInt;
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal || freeSelf || Function("return this")();
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal.process;
var nodeUtil = function() {
try {
var types = freeModule && freeModule.require && freeModule.require("util").types;
if (types) {
return types;
}
return freeProcess && freeProcess.binding && freeProcess.binding("util");
} catch (e) {
}
}();
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
function apply(func, thisArg, args) {
switch (args.length) {
case 0:
return func.call(thisArg);
case 1:
return func.call(thisArg, args[0]);
case 2:
return func.call(thisArg, args[0], args[1]);
case 3:
return func.call(thisArg, args[0], args[1], args[2]);
}
return func.apply(thisArg, args);
}
function arrayAggregator(array, setter, iteratee, accumulator) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
var value = array[index];
setter(accumulator, value, iteratee(value), array);
}
return accumulator;
}
function arrayEach(array, iteratee) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
function arrayEachRight(array, iteratee) {
var length = array == null ? 0 : array.length;
while (length--) {
if (iteratee(array[length], length, array) === false) {
break;
}
}
return array;
}
function arrayEvery(array, predicate) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (!predicate(array[index], index, array)) {
return false;
}
}
return true;
}
function arrayFilter(array, predicate) {
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
function arrayIncludesWith(array, value, comparator) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
function arrayMap(array, iteratee) {
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
function arrayPush(array, values) {
var index = -1, length = values.length, offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
function arrayReduce(array, iteratee, accumulator, initAccum) {
var index = -1, length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[++index];
}
while (++index < length) {
accumulator = iteratee(accumulator, array[index], index, array);
}
return accumulator;
}
function arrayReduceRight(array, iteratee, accumulator, initAccum) {
var length = array == null ? 0 : array.length;
if (initAccum && length) {
accumulator = array[--length];
}
while (length--) {
accumulator = iteratee(accumulator, array[length], length, array);
}
return accumulator;
}
function arraySome(array, predicate) {
var index = -1, length = array == null ? 0 : array.length;
while (++index < length) {
if (predicate(array[index], index, array)) {
return true;
}
}
return false;
}
var asciiSize = baseProperty("length");
function asciiToArray(string) {
return string.split("");
}
function asciiWords(string) {
return string.match(reAsciiWord) || [];
}
function baseFindKey(collection, predicate, eachFunc) {
var result;
eachFunc(collection, function(value, key, collection2) {
if (predicate(value, key, collection2)) {
result = key;
return false;
}
});
return result;
}
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
while (fromRight ? index-- : ++index < length) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
function baseIndexOf(array, value, fromIndex) {
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
}
function baseIndexOfWith(array, value, fromIndex, comparator) {
var index = fromIndex - 1, length = array.length;
while (++index < length) {
if (comparator(array[index], value)) {
return index;
}
}
return -1;
}
function baseIsNaN(value) {
return value !== value;
}
function baseMean(array, iteratee) {
var length = array == null ? 0 : array.length;
return length ? baseSum(array, iteratee) / length : NAN;
}
function baseProperty(key) {
return function(object) {
return object == null ? undefined2 : object[key];
};
}
function basePropertyOf(object) {
return function(key) {
return object == null ? undefined2 : object[key];
};
}
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
eachFunc(collection, function(value, index, collection2) {
accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
});
return accumulator;
}
function baseSortBy(array, comparer) {
var length = array.length;
array.sort(comparer);
while (length--) {
array[length] = array[length].value;
}
return array;
}
function baseSum(array, iteratee) {
var result, index = -1, length = array.length;
while (++index < length) {
var current = iteratee(array[index]);
if (current !== undefined2) {
result = result === undefined2 ? current : result + current;
}
}
return result;
}
function baseTimes(n, iteratee) {
var index = -1, result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
return [key, object[key]];
});
}
function baseTrim(string) {
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
}
function baseUnary(func) {
return function(value) {
return func(value);
};
}
function baseValues(object, props) {
return arrayMap(props, function(key) {
return object[key];
});
}
function cacheHas(cache, key) {
return cache.has(key);
}
function charsStartIndex(strSymbols, chrSymbols) {
var index = -1, length = strSymbols.length;
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
}
return index;
}
function charsEndIndex(strSymbols, chrSymbols) {
var index = strSymbols.length;
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
}
return index;
}
function countHolders(array, placeholder) {
var length = array.length, result = 0;
while (length--) {
if (array[length] === placeholder) {
++result;
}
}
return result;
}
var deburrLetter = basePropertyOf(deburredLetters);
var escapeHtmlChar = basePropertyOf(htmlEscapes);
function escapeStringChar(chr) {
return "\\" + stringEscapes[chr];
}
function getValue(object, key) {
return object == null ? undefined2 : object[key];
}
function hasUnicode(string) {
return reHasUnicode.test(string);
}
function hasUnicodeWord(string) {
return reHasUnicodeWord.test(string);
}
function iteratorToArray(iterator) {
var data, result = [];
while (!(data = iterator.next()).done) {
result.push(data.value);
}
return result;
}
function mapToArray(map) {
var index = -1, result = Array(map.size);
map.forEach(function(value, key) {
result[++index] = [key, value];
});
return result;
}
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
function replaceHolders(array, placeholder) {
var index = -1, length = array.length, resIndex = 0, result = [];
while (++index < length) {
var value = array[index];
if (value === placeholder || value === PLACEHOLDER) {
array[index] = PLACEHOLDER;
result[resIndex++] = index;
}
}
return result;
}
function setToArray(set) {
var index = -1, result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
function setToPairs(set) {
var index = -1, result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
}
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1, length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
function strictLastIndexOf(array, value, fromIndex) {
var index = fromIndex + 1;
while (index--) {
if (array[index] === value) {
return index;
}
}
return index;
}
function stringSize(string) {
return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
}
function stringToArray(string) {
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
}
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {
}
return index;
}
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
function unicodeSize(string) {
var result = reUnicode.lastIndex = 0;
while (reUnicode.test(string)) {
++result;
}
return result;
}
function unicodeToArray(string) {
return string.match(reUnicode) || [];
}
function unicodeWords(string) {
return string.match(reUnicodeWord) || [];
}
var runInContext = function runInContext2(context) {
context = context == null ? root : _2.defaults(root.Object(), context, _2.pick(root, contextProps));
var Array3 = context.Array, Date2 = context.Date, Error3 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String3 = context.String, TypeError3 = context.TypeError;
var arrayProto = Array3.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
var coreJsData = context["__core-js_shared__"];
var funcToString = funcProto.toString;
var hasOwnProperty = objectProto.hasOwnProperty;
var idCounter = 0;
var maskSrcKey = function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
return uid ? "Symbol(src)_1." + uid : "";
}();
var nativeObjectToString = objectProto.toString;
var objectCtorString = funcToString.call(Object2);
var oldDash = root._;
var reIsNative = RegExp2(
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
var defineProperty = function() {
try {
var func = getNative(Object2, "defineProperty");
func({}, "", {});
return func;
} catch (e) {
}
}();
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
var metaMap = WeakMap && new WeakMap();
var realNames = {};
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
function lodash(value) {
if (isObjectLike(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
if (value instanceof LodashWrapper) {
return value;
}
if (hasOwnProperty.call(value, "__wrapped__")) {
return wrapperClone(value);
}
}
return new LodashWrapper(value);
}
var baseCreate = function() {
function object() {
}
return function(proto) {
if (!isObject4(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result2 = new object();
object.prototype = undefined2;
return result2;
};
}();
function baseLodash() {
}
function LodashWrapper(value, chainAll) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__chain__ = !!chainAll;
this.__index__ = 0;
this.__values__ = undefined2;
}
lodash.templateSettings = {
/**
* Used to detect `data` property values to be HTML-escaped.
*
* @memberOf _.templateSettings
* @type {RegExp}
*/
"escape": reEscape,
/**
* Used to detect code to be evaluated.
*
* @memberOf _.templateSettings
* @type {RegExp}
*/
"evaluate": reEvaluate,
/**
* Used to detect `data` property values to inject.
*
* @memberOf _.templateSettings
* @type {RegExp}
*/
"interpolate": reInterpolate,
/**
* Used to reference the data object in the template text.
*
* @memberOf _.templateSettings
* @type {string}
*/
"variable": "",
/**
* Used to import variables into the compiled template.
*
* @memberOf _.templateSettings
* @type {Object}
*/
"imports": {
/**
* A reference to the `lodash` function.
*
* @memberOf _.templateSettings.imports
* @type {Function}
*/
"_": lodash
}
};
lodash.prototype = baseLodash.prototype;
lodash.prototype.constructor = lodash;
LodashWrapper.prototype = baseCreate(baseLodash.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
function LazyWrapper(value) {
this.__wrapped__ = value;
this.__actions__ = [];
this.__dir__ = 1;
this.__filtered__ = false;
this.__iteratees__ = [];
this.__takeCount__ = MAX_ARRAY_LENGTH;
this.__views__ = [];
}
function lazyClone() {
var result2 = new LazyWrapper(this.__wrapped__);
result2.__actions__ = copyArray(this.__actions__);
result2.__dir__ = this.__dir__;
result2.__filtered__ = this.__filtered__;
result2.__iteratees__ = copyArray(this.__iteratees__);
result2.__takeCount__ = this.__takeCount__;
result2.__views__ = copyArray(this.__views__);
return result2;
}
function lazyReverse() {
if (this.__filtered__) {
var result2 = new LazyWrapper(this);
result2.__dir__ = -1;
result2.__filtered__ = true;
} else {
result2 = this.clone();
result2.__dir__ *= -1;
}
return result2;
}
function lazyValue() {
var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || !isRight && arrLength == length && takeCount == length) {
return baseWrapperValue(array, this.__actions__);
}
var result2 = [];
outer:
while (length-- && resIndex < takeCount) {
index += dir;
var iterIndex = -1, value = array[index];
while (++iterIndex < iterLength) {
var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed = iteratee2(value);
if (type == LAZY_MAP_FLAG) {
value = computed;
} else if (!computed) {
if (type == LAZY_FILTER_FLAG) {
continue outer;
} else {
break outer;
}
}
}
result2[resIndex++] = value;
}
return result2;
}
LazyWrapper.prototype = baseCreate(baseLodash.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
function Hash(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
function hashDelete(key) {
var result2 = this.has(key) && delete this.__data__[key];
this.size -= result2 ? 1 : 0;
return result2;
}
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result2 = data[key];
return result2 === HASH_UNDEFINED ? undefined2 : result2;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined2;
}
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined2 : hasOwnProperty.call(data, key);
}
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = nativeCreate && value === undefined2 ? HASH_UNDEFINED : value;
return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
function listCacheDelete(key) {
var data = this.__data__, index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
function listCacheGet(key) {
var data = this.__data__, index = assocIndexOf(data, key);
return index < 0 ? undefined2 : data[index][1];
}
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value) {
var data = this.__data__, index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
var index = -1, length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
function mapCacheClear() {
this.size = 0;
this.__data__ = {
"hash": new Hash(),
"map": new (Map2 || ListCache)(),
"string": new Hash()
};
}
function mapCacheDelete(key) {
var result2 = getMapData(this, key)["delete"](key);
this.size -= result2 ? 1 : 0;
return result2;
}
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
function mapCacheSet(key, value) {
var data = getMapData(this, key), size2 = data.size;
data.set(key, value);
this.size += data.size == size2 ? 0 : 1;
return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function SetCache(values2) {
var index = -1, length = values2 == null ? 0 : values2.length;
this.__data__ = new MapCache();
while (++index < length) {
this.add(values2[index]);
}
}
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
function setCacheHas(value) {
return this.__data__.has(value);
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
function stackDelete(key) {
var data = this.__data__, result2 = data["delete"](key);
this.size = data.size;
return result2;
}
function stackGet(key) {
return this.__data__.get(key);
}
function stackHas(key) {
return this.__data__.has(key);
}
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
function arrayLikeKeys(value, inherited) {
var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String3) : [], length = result2.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
isIndex(key, length)))) {
result2.push(key);
}
}
return result2;
}
function arraySample(array) {
var length = array.length;
return length ? array[baseRandom(0, length - 1)] : undefined2;
}
function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
}
function arrayShuffle(array) {
return shuffleSelf(copyArray(array));
}
function assignMergeValue(object, key, value) {
if (value !== undefined2 && !eq(object[key], value) || value === undefined2 && !(key in object)) {
baseAssignValue(object, key, value);
}
}
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined2 && !(key in object)) {
baseAssignValue(object, key, value);
}
}
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
function baseAggregator(collection, setter, iteratee2, accumulator) {
baseEach(collection, function(value, key, collection2) {
setter(accumulator, value, iteratee2(value), collection2);
});
return accumulator;
}
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
function baseAssignValue(object, key, value) {
if (key == "__proto__" && defineProperty) {
defineProperty(object, key, {
"configurable": true,
"enumerable": true,
"value": value,
"writable": true
});
} else {
object[key] = value;
}
}
function baseAt(object, paths) {
var index = -1, length = paths.length, result2 = Array3(length), skip = object == null;
while (++index < length) {
result2[index] = skip ? undefined2 : get(object, paths[index]);
}
return result2;
}
function baseClamp(number, lower, upper) {
if (number === number) {
if (upper !== undefined2) {
number = number <= upper ? number : upper;
}
if (lower !== undefined2) {
number = number >= lower ? number : lower;
}
}
return number;
}
function baseClone(value, bitmask, customizer, key, object, stack) {
var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result2 = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result2 !== undefined2) {
return result2;
}
if (!isObject4(value)) {
return value;
}
var isArr = isArray2(value);
if (isArr) {
result2 = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result2);
}
} else {
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || isFunc && !object) {
result2 = isFlat || isFunc ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result2 = initCloneByTag(value, tag, isDeep);
}
}
stack || (stack = new Stack());
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result2);
if (isSet(value)) {
value.forEach(function(subValue) {
result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap(value)) {
value.forEach(function(subValue, key2) {
result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
});
}
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
var props = isArr ? undefined2 : keysFunc(value);
arrayEach(props || value, function(subValue, key2) {
if (props) {
key2 = subValue;
subValue = value[key2];
}
assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
});
return result2;
}
function baseConforms(source) {
var props = keys(source);
return function(object) {
return baseConformsTo(object, source, props);
};
}
function baseConformsTo(object, source, props) {
var length = props.length;
if (object == null) {
return !length;
}
object = Object2(object);
while (length--) {
var key = props[length], predicate = source[key], value = object[key];
if (value === undefined2 && !(key in object) || !predicate(value)) {
return false;
}
}
return true;
}
function baseDelay(func, wait, args) {
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
return setTimeout2(function() {
func.apply(undefined2, args);
}, wait);
}
function baseDifference(array, values2, iteratee2, comparator) {
var index = -1, includes2 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length;
if (!length) {
return result2;
}
if (iteratee2) {
values2 = arrayMap(values2, baseUnary(iteratee2));
}
if (comparator) {
includes2 = arrayIncludesWith;
isCommon = false;
} else if (values2.length >= LARGE_ARRAY_SIZE) {
includes2 = cacheHas;
isCommon = false;
values2 = new SetCache(values2);
}
outer:
while (++index < length) {
var value = array[index], computed = iteratee2 == null ? value : iteratee2(value);
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var valuesIndex = valuesLength;
while (valuesIndex--) {
if (values2[valuesIndex] === computed) {
continue outer;
}
}
result2.push(value);
} else if (!includes2(values2, computed, comparator)) {
result2.push(value);
}
}
return result2;
}
var baseEach = createBaseEach(baseForOwn);
var baseEachRight = createBaseEach(baseForOwnRight, true);
function baseEvery(collection, predicate) {
var result2 = true;
baseEach(collection, function(value, index, collection2) {
result2 = !!predicate(value, index, collection2);
return result2;
});
return result2;
}
function baseExtremum(array, iteratee2, comparator) {
var index = -1, length = array.length;
while (++index < length) {
var value = array[index], current = iteratee2(value);
if (current != null && (computed === undefined2 ? current === current && !isSymbol(current) : comparator(current, computed))) {
var computed = current, result2 = value;
}
}
return result2;
}
function baseFill(array, value, start, end) {
var length = array.length;
start = toInteger(start);
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end === undefined2 || end > length ? length : toInteger(end);
if (end < 0) {
end += length;
}
end = start > end ? 0 : toLength(end);
while (start < end) {
array[start++] = value;
}
return array;
}
function baseFilter(collection, predicate) {
var result2 = [];
baseEach(collection, function(value, index, collection2) {
if (predicate(value, index, collection2)) {
result2.push(value);
}
});
return result2;
}
function baseFlatten(array, depth, predicate, isStrict, result2) {
var index = -1, length = array.length;
predicate || (predicate = isFlattenable);
result2 || (result2 = []);
while (++index < length) {
var value = array[index];
if (depth > 0 && predicate(value)) {
if (depth > 1) {
baseFlatten(value, depth - 1, predicate, isStrict, result2);
} else {
arrayPush(result2, value);
}
} else if (!isStrict) {
result2[result2.length] = value;
}
}
return result2;
}
var baseFor = createBaseFor();
var baseForRight = createBaseFor(true);
function baseForOwn(object, iteratee2) {
return object && baseFor(object, iteratee2, keys);
}
function baseForOwnRight(object, iteratee2) {
return object && baseForRight(object, iteratee2, keys);
}
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
return isFunction(object[key]);
});
}
function baseGet(object, path) {
path = castPath(path, object);
var index = 0, length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return index && index == length ? object : undefined2;
}
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result2 = keysFunc(object);
return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object));
}
function baseGetTag(value) {
if (value == null) {
return value === undefined2 ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString(value);
}
function baseGt(value, other) {
return value > other;
}
function baseHas(object, key) {
return object != null && hasOwnProperty.call(object, key);
}
function baseHasIn(object, key) {
return object != null && key in Object2(object);
}
function baseInRange(number, start, end) {
return number >= nativeMin(start, end) && number < nativeMax(start, end);
}
function baseIntersection(arrays, iteratee2, comparator) {
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array3(othLength), maxLength = Infinity, result2 = [];
while (othIndex--) {
var array = arrays[othIndex];
if (othIndex && iteratee2) {
array = arrayMap(array, baseUnary(iteratee2));
}
maxLength = nativeMin(array.length, maxLength);
caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined2;
}
array = arrays[0];
var index = -1, seen = caches[0];
outer:
while (++index < length && result2.length < maxLength) {
var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
value = comparator || value !== 0 ? value : 0;
if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) {
othIndex = othLength;
while (--othIndex) {
var cache = caches[othIndex];
if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
continue outer;
}
}
if (seen) {
seen.push(computed);
}
result2.push(value);
}
}
return result2;
}
function baseInverter(object, setter, iteratee2, accumulator) {
baseForOwn(object, function(value, key, object2) {
setter(accumulator, iteratee2(value), key, object2);
});
return accumulator;
}
function baseInvoke(object, path, args) {
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined2 : apply(func, object, args);
}
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
function baseIsArrayBuffer(value) {
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
}
function baseIsDate(value) {
return isObjectLike(value) && baseGetTag(value) == dateTag;
}
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
if (isSameTag && isBuffer(object)) {
if (!isBuffer(other)) {
return false;
}
objIsArr = true;
objIsObj = false;
}
if (isSameTag && !objIsObj) {
stack || (stack = new Stack());
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
}
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
if (objIsWrapped || othIsWrapped) {
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
stack || (stack = new Stack());
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
}
}
if (!isSameTag) {
return false;
}
stack || (stack = new Stack());
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
}
function baseIsMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
function baseIsMatch(object, source, matchData, customizer) {
var index = matchData.length, length = index, noCustomizer = !customizer;
if (object == null) {
return !length;
}
object = Object2(object);
while (index--) {
var data = matchData[index];
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
return false;
}
}
while (++index < length) {
data = matchData[index];
var key = data[0], objValue = object[key], srcValue = data[1];
if (noCustomizer && data[2]) {
if (objValue === undefined2 && !(key in object)) {
return false;
}
} else {
var stack = new Stack();
if (customizer) {
var result2 = customizer(objValue, srcValue, key, object, source, stack);
}
if (!(result2 === undefined2 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) {
return false;
}
}
}
return true;
}
function baseIsNative(value) {
if (!isObject4(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
function baseIsRegExp(value) {
return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
function baseIsSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
function baseIsTypedArray(value) {
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
function baseIteratee(value) {
if (typeof value == "function") {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == "object") {
return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
}
return property(value);
}
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result2 = [];
for (var key in Object2(object)) {
if (hasOwnProperty.call(object, key) && key != "constructor") {
result2.push(key);
}
}
return result2;
}
function baseKeysIn(object) {
if (!isObject4(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object), result2 = [];
for (var key in object) {
if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
result2.push(key);
}
}
return result2;
}
function baseLt(value, other) {
return value < other;
}
function baseMap(collection, iteratee2) {
var index = -1, result2 = isArrayLike(collection) ? Array3(collection.length) : [];
baseEach(collection, function(value, key, collection2) {
result2[++index] = iteratee2(value, key, collection2);
});
return result2;
}
function baseMatches(source) {
var matchData = getMatchData(source);
if (matchData.length == 1 && matchData[0][2]) {
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
}
return function(object) {
return object === source || baseIsMatch(object, source, matchData);
};
}
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
return matchesStrictComparable(toKey(path), srcValue);
}
return function(object) {
var objValue = get(object, path);
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
};
}
function baseMerge(object, source, srcIndex, customizer, stack) {
if (object === source) {
return;
}
baseFor(source, function(srcValue, key) {
stack || (stack = new Stack());
if (isObject4(srcValue)) {
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
} else {
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
if (newValue === undefined2) {
newValue = srcValue;
}
assignMergeValue(object, key, newValue);
}
}, keysIn);
}
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
if (stacked) {
assignMergeValue(object, key, stacked);
return;
}
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
var isCommon = newValue === undefined2;
if (isCommon) {
var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
newValue = srcValue;
if (isArr || isBuff || isTyped) {
if (isArray2(objValue)) {
newValue = objValue;
} else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
} else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
} else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
} else {
newValue = [];
}
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
newValue = objValue;
if (isArguments(objValue)) {
newValue = toPlainObject(objValue);
} else if (!isObject4(objValue) || isFunction(objValue)) {
newValue = initCloneObject(srcValue);
}
} else {
isCommon = false;
}
}
if (isCommon) {
stack.set(srcValue, newValue);
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
stack["delete"](srcValue);
}
assignMergeValue(object, key, newValue);
}
function baseNth(array, n) {
var length = array.length;
if (!length) {
return;
}
n += n < 0 ? length : 0;
return isIndex(n, length) ? array[n] : undefined2;
}
function baseOrderBy(collection, iteratees, orders) {
if (iteratees.length) {
iteratees = arrayMap(iteratees, function(iteratee2) {
if (isArray2(iteratee2)) {
return function(value) {
return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
};
}
return iteratee2;
});
} else {
iteratees = [identity];
}
var index = -1;
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
var result2 = baseMap(collection, function(value, key, collection2) {
var criteria = arrayMap(iteratees, function(iteratee2) {
return iteratee2(value);
});
return { "criteria": criteria, "index": ++index, "value": value };
});
return baseSortBy(result2, function(object, other) {
return compareMultiple(object, other, orders);
});
}
function basePick(object, paths) {
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}
function basePickBy(object, paths, predicate) {
var index = -1, length = paths.length, result2 = {};
while (++index < length) {
var path = paths[index], value = baseGet(object, path);
if (predicate(value, path)) {
baseSet(result2, castPath(path, object), value);
}
}
return result2;
}
function basePropertyDeep(path) {
return function(object) {
return baseGet(object, path);
};
}
function basePullAll(array, values2, iteratee2, comparator) {
var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array;
if (array === values2) {
values2 = copyArray(values2);
}
if (iteratee2) {
seen = arrayMap(array, baseUnary(iteratee2));
}
while (++index < length) {
var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
if (seen !== array) {
splice.call(seen, fromIndex, 1);
}
splice.call(array, fromIndex, 1);
}
}
return array;
}
function basePullAt(array, indexes) {
var length = array ? indexes.length : 0, lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splice.call(array, index, 1);
} else {
baseUnset(array, index);
}
}
}
return array;
}
function baseRandom(lower, upper) {
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
}
function baseRange(start, end, step, fromRight) {
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array3(length);
while (length--) {
result2[fromRight ? length : ++index] = start;
start += step;
}
return result2;
}
function baseRepeat(string, n) {
var result2 = "";
if (!string || n < 1 || n > MAX_SAFE_INTEGER2) {
return result2;
}
do {
if (n % 2) {
result2 += string;
}
n = nativeFloor(n / 2);
if (n) {
string += string;
}
} while (n);
return result2;
}
function baseRest(func, start) {
return setToString(overRest(func, start, identity), func + "");
}
function baseSample(collection) {
return arraySample(values(collection));
}
function baseSampleSize(collection, n) {
var array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
}
function baseSet(object, path, value, customizer) {
if (!isObject4(object)) {
return object;
}
path = castPath(path, object);
var index = -1, length = path.length, lastIndex = length - 1, nested = object;
while (nested != null && ++index < length) {
var key = toKey(path[index]), newValue = value;
if (key === "__proto__" || key === "constructor" || key === "prototype") {
return object;
}
if (index != lastIndex) {
var objValue = nested[key];
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
if (newValue === undefined2) {
newValue = isObject4(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
}
}
assignValue(nested, key, newValue);
nested = nested[key];
}
return object;
}
var baseSetData = !metaMap ? identity : function(func, data) {
metaMap.set(func, data);
return func;
};
var baseSetToString = !defineProperty ? identity : function(func, string) {
return defineProperty(func, "toString", {
"configurable": true,
"enumerable": false,
"value": constant(string),
"writable": true
});
};
function baseShuffle(collection) {
return shuffleSelf(values(collection));
}
function baseSlice(array, start, end) {
var index = -1, length = array.length;
if (start < 0) {
start = -start > length ? 0 : length + start;
}
end = end > length ? length : end;
if (end < 0) {
end += length;
}
length = start > end ? 0 : end - start >>> 0;
start >>>= 0;
var result2 = Array3(length);
while (++index < length) {
result2[index] = array[index + start];
}
return result2;
}
function baseSome(collection, predicate) {
var result2;
baseEach(collection, function(value, index, collection2) {
result2 = predicate(value, index, collection2);
return !result2;
});
return !!result2;
}
function baseSortedIndex(array, value, retHighest) {
var low = 0, high = array == null ? low : array.length;
if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = low + high >>> 1, computed = array[mid];
if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
low = mid + 1;
} else {
high = mid;
}
}
return high;
}
return baseSortedIndexBy(array, value, identity, retHighest);
}
function baseSortedIndexBy(array, value, iteratee2, retHighest) {
var low = 0, high = array == null ? 0 : array.length;
if (high === 0) {
return 0;
}
value = iteratee2(value);
var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined2;
while (low < high) {
var mid = nativeFloor((low + high) / 2), computed = iteratee2(array[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
if (valIsNaN) {
var setLow = retHighest || othIsReflexive;
} else if (valIsUndefined) {
setLow = othIsReflexive && (retHighest || othIsDefined);
} else if (valIsNull) {
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
} else if (valIsSymbol) {
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
} else if (othIsNull || othIsSymbol) {
setLow = false;
} else {
setLow = retHighest ? computed <= value : computed < value;
}
if (setLow) {
low = mid + 1;
} else {
high = mid;
}
}
return nativeMin(high, MAX_ARRAY_INDEX);
}
function baseSortedUniq(array, iteratee2) {
var index = -1, length = array.length, resIndex = 0, result2 = [];
while (++index < length) {
var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
if (!index || !eq(computed, seen)) {
var seen = computed;
result2[resIndex++] = value === 0 ? 0 : value;
}
}
return result2;
}
function baseToNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
return +value;
}
function baseToString(value) {
if (typeof value == "string") {
return value;
}
if (isArray2(value)) {
return arrayMap(value, baseToString) + "";
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : "";
}
var result2 = value + "";
return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
}
function baseUniq(array, iteratee2, comparator) {
var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2;
if (comparator) {
isCommon = false;
includes2 = arrayIncludesWith;
} else if (length >= LARGE_ARRAY_SIZE) {
var set2 = iteratee2 ? null : createSet(array);
if (set2) {
return setToArray(set2);
}
isCommon = false;
includes2 = cacheHas;
seen = new SetCache();
} else {
seen = iteratee2 ? [] : result2;
}
outer:
while (++index < length) {
var value = array[index], computed = iteratee2 ? iteratee2(value) : value;
value = comparator || value !== 0 ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee2) {
seen.push(computed);
}
result2.push(value);
} else if (!includes2(seen, computed, comparator)) {
if (seen !== result2) {
seen.push(computed);
}
result2.push(value);
}
}
return result2;
}
function baseUnset(object, path) {
path = castPath(path, object);
object = parent(object, path);
return object == null || delete object[toKey(last(path))];
}
function baseUpdate(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
}
function baseWhile(array, predicate, isDrop, fromRight) {
var length = array.length, index = fromRight ? length : -1;
while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
}
return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
}
function baseWrapperValue(value, actions) {
var result2 = value;
if (result2 instanceof LazyWrapper) {
result2 = result2.value();
}
return arrayReduce(actions, function(result3, action) {
return action.func.apply(action.thisArg, arrayPush([result3], action.args));
}, result2);
}
function baseXor(arrays, iteratee2, comparator) {
var length = arrays.length;
if (length < 2) {
return length ? baseUniq(arrays[0]) : [];
}
var index = -1, result2 = Array3(length);
while (++index < length) {
var array = arrays[index], othIndex = -1;
while (++othIndex < length) {
if (othIndex != index) {
result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator);
}
}
}
return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
}
function baseZipObject(props, values2, assignFunc) {
var index = -1, length = props.length, valsLength = values2.length, result2 = {};
while (++index < length) {
var value = index < valsLength ? values2[index] : undefined2;
assignFunc(result2, props[index], value);
}
return result2;
}
function castArrayLikeObject(value) {
return isArrayLikeObject(value) ? value : [];
}
function castFunction(value) {
return typeof value == "function" ? value : identity;
}
function castPath(value, object) {
if (isArray2(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
}
var castRest = baseRest;
function castSlice(array, start, end) {
var length = array.length;
end = end === undefined2 ? length : end;
return !start && end >= length ? array : baseSlice(array, start, end);
}
var clearTimeout2 = ctxClearTimeout || function(id) {
return root.clearTimeout(id);
};
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result2);
return result2;
}
function cloneArrayBuffer(arrayBuffer) {
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
return result2;
}
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
function cloneRegExp(regexp) {
var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result2.lastIndex = regexp.lastIndex;
return result2;
}
function cloneSymbol(symbol) {
return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {};
}
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
function compareAscending(value, other) {
if (value !== other) {
var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
return 1;
}
if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
return -1;
}
}
return 0;
}
function compareMultiple(object, other, orders) {
var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
while (++index < length) {
var result2 = compareAscending(objCriteria[index], othCriteria[index]);
if (result2) {
if (index >= ordersLength) {
return result2;
}
var order = orders[index];
return result2 * (order == "desc" ? -1 : 1);
}
}
return object.index - other.index;
}
function composeArgs(args, partials, holders, isCurried) {
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array3(leftLength + rangeLength), isUncurried = !isCurried;
while (++leftIndex < leftLength) {
result2[leftIndex] = partials[leftIndex];
}
while (++argsIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result2[holders[argsIndex]] = args[argsIndex];
}
}
while (rangeLength--) {
result2[leftIndex++] = args[argsIndex++];
}
return result2;
}
function composeArgsRight(args, partials, holders, isCurried) {
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array3(rangeLength + rightLength), isUncurried = !isCurried;
while (++argsIndex < rangeLength) {
result2[argsIndex] = args[argsIndex];
}
var offset = argsIndex;
while (++rightIndex < rightLength) {
result2[offset + rightIndex] = partials[rightIndex];
}
while (++holdersIndex < holdersLength) {
if (isUncurried || argsIndex < argsLength) {
result2[offset + holders[holdersIndex]] = args[argsIndex++];
}
}
return result2;
}
function copyArray(source, array) {
var index = -1, length = source.length;
array || (array = Array3(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1, length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
if (newValue === undefined2) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn(source), object);
}
function createAggregator(setter, initializer) {
return function(collection, iteratee2) {
var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
};
}
function createAssigner(assigner) {
return baseRest(function(object, sources) {
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
customizer = length < 3 ? undefined2 : customizer;
length = 1;
}
object = Object2(object);
while (++index < length) {
var source = sources[index];
if (source) {
assigner(object, source, index, customizer);
}
}
return object;
});
}
function createBaseEach(eachFunc, fromRight) {
return function(collection, iteratee2) {
if (collection == null) {
return collection;
}
if (!isArrayLike(collection)) {
return eachFunc(collection, iteratee2);
}
var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
while (fromRight ? index-- : ++index < length) {
if (iteratee2(iterable[index], index, iterable) === false) {
break;
}
}
return collection;
};
}
function createBaseFor(fromRight) {
return function(object, iteratee2, keysFunc) {
var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
while (length--) {
var key = props[fromRight ? length : ++index];
if (iteratee2(iterable[key], key, iterable) === false) {
break;
}
}
return object;
};
}
function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return wrapper;
}
function createCaseFirst(methodName) {
return function(string) {
string = toString(string);
var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
var chr = strSymbols ? strSymbols[0] : string.charAt(0);
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
return chr[methodName]() + trailing;
};
}
function createCompounder(callback) {
return function(string) {
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
};
}
function createCtor(Ctor) {
return function() {
var args = arguments;
switch (args.length) {
case 0:
return new Ctor();
case 1:
return new Ctor(args[0]);
case 2:
return new Ctor(args[0], args[1]);
case 3:
return new Ctor(args[0], args[1], args[2]);
case 4:
return new Ctor(args[0], args[1], args[2], args[3]);
case 5:
return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7:
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
return isObject4(result2) ? result2 : thisBinding;
};
}
function createCurry(func, bitmask, arity) {
var Ctor = createCtor(func);
function wrapper() {
var length = arguments.length, args = Array3(length), index = length, placeholder = getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
}
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
length -= holders.length;
if (length < arity) {
return createRecurry(
func,
bitmask,
createHybrid,
wrapper.placeholder,
undefined2,
args,
holders,
undefined2,
undefined2,
arity - length
);
}
var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
return apply(fn, this, args);
}
return wrapper;
}
function createFind(findIndexFunc) {
return function(collection, predicate, fromIndex) {
var iterable = Object2(collection);
if (!isArrayLike(collection)) {
var iteratee2 = getIteratee(predicate, 3);
collection = keys(collection);
predicate = function(key) {
return iteratee2(iterable[key], key, iterable);
};
}
var index = findIndexFunc(collection, predicate, fromIndex);
return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
};
}
function createFlow(fromRight) {
return flatRest(function(funcs) {
var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
if (fromRight) {
funcs.reverse();
}
while (index--) {
var func = funcs[index];
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
if (prereq && !wrapper && getFuncName(func) == "wrapper") {
var wrapper = new LodashWrapper([], true);
}
}
index = wrapper ? index : length;
while (++index < length) {
func = funcs[index];
var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
} else {
wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
}
}
return function() {
var args = arguments, value = args[0];
if (wrapper && args.length == 1 && isArray2(value)) {
return wrapper.plant(value).value();
}
var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
while (++index2 < length) {
result2 = funcs[index2].call(this, result2);
}
return result2;
};
});
}
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
function wrapper() {
var length = arguments.length, args = Array3(length), index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(
func,
bitmask,
createHybrid,
wrapper.placeholder,
thisArg,
args,
newHolders,
argPos,
ary2,
arity - length
);
}
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary2 < length) {
args.length = ary2;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
function createInverter(setter, toIteratee) {
return function(object, iteratee2) {
return baseInverter(object, setter, toIteratee(iteratee2), {});
};
}
function createMathOperation(operator, defaultValue) {
return function(value, other) {
var result2;
if (value === undefined2 && other === undefined2) {
return defaultValue;
}
if (value !== undefined2) {
result2 = value;
}
if (other !== undefined2) {
if (result2 === undefined2) {
return other;
}
if (typeof value == "string" || typeof other == "string") {
value = baseToString(value);
other = baseToString(other);
} else {
value = baseToNumber(value);
other = baseToNumber(other);
}
result2 = operator(value, other);
}
return result2;
};
}
function createOver(arrayFunc) {
return flatRest(function(iteratees) {
iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
return baseRest(function(args) {
var thisArg = this;
return arrayFunc(iteratees, function(iteratee2) {
return apply(iteratee2, thisArg, args);
});
});
});
}
function createPadding(length, chars) {
chars = chars === undefined2 ? " " : baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
}
function createPartial(func, bitmask, thisArg, partials) {
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
function wrapper() {
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array3(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
while (++leftIndex < leftLength) {
args[leftIndex] = partials[leftIndex];
}
while (argsLength--) {
args[leftIndex++] = arguments[++argsIndex];
}
return apply(fn, isBind ? thisArg : this, args);
}
return wrapper;
}
function createRange(fromRight) {
return function(start, end, step) {
if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
end = step = undefined2;
}
start = toFinite(start);
if (end === undefined2) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
step = step === undefined2 ? start < end ? 1 : -1 : toFinite(step);
return baseRange(start, end, step, fromRight);
};
}
function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == "string" && typeof other == "string")) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
}
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
}
var newData = [
func,
bitmask,
thisArg,
newPartials,
newHolders,
newPartialsRight,
newHoldersRight,
argPos,
ary2,
arity
];
var result2 = wrapFunc.apply(undefined2, newData);
if (isLaziable(func)) {
setData(result2, newData);
}
result2.placeholder = placeholder;
return setWrapToString(result2, func, bitmask);
}
function createRound(methodName) {
var func = Math2[methodName];
return function(number, precision) {
number = toNumber(number);
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision && nativeIsFinite(number)) {
var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
pair = (toString(value) + "e").split("e");
return +(pair[0] + "e" + (+pair[1] - precision));
}
return func(number);
};
}
var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop2 : function(values2) {
return new Set2(values2);
};
function createToPairs(keysFunc) {
return function(object) {
var tag = getTag(object);
if (tag == mapTag) {
return mapToArray(object);
}
if (tag == setTag) {
return setToPairs(object);
}
return baseToPairs(object, keysFunc(object));
};
}
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
if (!isBindKey && typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
var length = partials ? partials.length : 0;
if (!length) {
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
partials = holders = undefined2;
}
ary2 = ary2 === undefined2 ? ary2 : nativeMax(toInteger(ary2), 0);
arity = arity === undefined2 ? arity : toInteger(arity);
length -= holders ? holders.length : 0;
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
var partialsRight = partials, holdersRight = holders;
partials = holders = undefined2;
}
var data = isBindKey ? undefined2 : getData(func);
var newData = [
func,
bitmask,
thisArg,
partials,
holders,
partialsRight,
holdersRight,
argPos,
ary2,
arity
];
if (data) {
mergeData(newData, data);
}
func = newData[0];
bitmask = newData[1];
thisArg = newData[2];
partials = newData[3];
holders = newData[4];
arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0);
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
}
if (!bitmask || bitmask == WRAP_BIND_FLAG) {
var result2 = createBind(func, bitmask, thisArg);
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
result2 = createCurry(func, bitmask, arity);
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
result2 = createPartial(func, bitmask, thisArg, partials);
} else {
result2 = createHybrid.apply(undefined2, newData);
}
var setter = data ? baseSetData : setData;
return setWrapToString(setter(result2, newData), func, bitmask);
}
function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined2 || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key)) {
return srcValue;
}
return objValue;
}
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject4(objValue) && isObject4(srcValue)) {
stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
stack["delete"](srcValue);
}
return objValue;
}
function customOmitClone(value) {
return isPlainObject(value) ? undefined2 : value;
}
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
var arrStacked = stack.get(array);
var othStacked = stack.get(other);
if (arrStacked && othStacked) {
return arrStacked == other && othStacked == array;
}
var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined2;
stack.set(array, other);
stack.set(other, array);
while (++index < arrLength) {
var arrValue = array[index], othValue = other[index];
if (customizer) {
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined2) {
if (compared) {
continue;
}
result2 = false;
break;
}
if (seen) {
if (!arraySome(other, function(othValue2, othIndex) {
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result2 = false;
break;
}
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
result2 = false;
break;
}
}
stack["delete"](array);
stack["delete"](other);
return result2;
}
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
switch (tag) {
case dataViewTag:
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
return false;
}
object = object.buffer;
other = other.buffer;
case arrayBufferTag:
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
return false;
}
return true;
case boolTag:
case dateTag:
case numberTag:
return eq(+object, +other);
case errorTag:
return object.name == other.name && object.message == other.message;
case regexpTag:
case stringTag:
return object == other + "";
case mapTag:
var convert2 = mapToArray;
case setTag:
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
convert2 || (convert2 = setToArray);
if (object.size != other.size && !isPartial) {
return false;
}
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
bitmask |= COMPARE_UNORDERED_FLAG;
stack.set(object, other);
var result2 = equalArrays(convert2(object), convert2(other), bitmask, customizer, equalFunc, stack);
stack["delete"](object);
return result2;
case symbolTag:
if (symbolValueOf) {
return symbolValueOf.call(object) == symbolValueOf.call(other);
}
}
return false;
}
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
var objStacked = stack.get(object);
var othStacked = stack.get(other);
if (objStacked && othStacked) {
return objStacked == other && othStacked == object;
}
var result2 = true;
stack.set(object, other);
stack.set(other, object);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key], othValue = other[key];
if (customizer) {
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
}
if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
result2 = false;
break;
}
skipCtor || (skipCtor = key == "constructor");
}
if (result2 && !skipCtor) {
var objCtor = object.constructor, othCtor = other.constructor;
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
result2 = false;
}
}
stack["delete"](object);
stack["delete"](other);
return result2;
}
function flatRest(func) {
return setToString(overRest(func, undefined2, flatten), func + "");
}
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
var getData = !metaMap ? noop2 : function(func) {
return metaMap.get(func);
};
function getFuncName(func) {
var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty.call(realNames, result2) ? array.length : 0;
while (length--) {
var data = array[length], otherFunc = data.func;
if (otherFunc == null || otherFunc == func) {
return data.name;
}
}
return result2;
}
function getHolder(func) {
var object = hasOwnProperty.call(lodash, "placeholder") ? lodash : func;
return object.placeholder;
}
function getIteratee() {
var result2 = lodash.iteratee || iteratee;
result2 = result2 === iteratee ? baseIteratee : result2;
return arguments.length ? result2(arguments[0], arguments[1]) : result2;
}
function getMapData(map2, key) {
var data = map2.__data__;
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function getMatchData(object) {
var result2 = keys(object), length = result2.length;
while (length--) {
var key = result2[length], value = object[key];
result2[length] = [key, value, isStrictComparable(value)];
}
return result2;
}
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined2;
}
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
try {
value[symToStringTag] = undefined2;
var unmasked = true;
} catch (e) {
}
var result2 = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result2;
}
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object2(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result2 = [];
while (object) {
arrayPush(result2, getSymbols(object));
object = getPrototype(object);
}
return result2;
};
var getTag = baseGetTag;
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
getTag = function(value) {
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
if (ctorString) {
switch (ctorString) {
case dataViewCtorString:
return dataViewTag;
case mapCtorString:
return mapTag;
case promiseCtorString:
return promiseTag;
case setCtorString:
return setTag;
case weakMapCtorString:
return weakMapTag;
}
}
return result2;
};
}
function getView(start, end, transforms) {
var index = -1, length = transforms.length;
while (++index < length) {
var data = transforms[index], size2 = data.size;
switch (data.type) {
case "drop":
start += size2;
break;
case "dropRight":
end -= size2;
break;
case "take":
end = nativeMin(end, start + size2);
break;
case "takeRight":
start = nativeMax(start, end - size2);
break;
}
}
return { "start": start, "end": end };
}
function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
}
function hasPath(object, path, hasFunc) {
path = castPath(path, object);
var index = -1, length = path.length, result2 = false;
while (++index < length) {
var key = toKey(path[index]);
if (!(result2 = object != null && hasFunc(object, key))) {
break;
}
object = object[key];
}
if (result2 || ++index != length) {
return result2;
}
length = object == null ? 0 : object.length;
return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object));
}
function initCloneArray(array) {
var length = array.length, result2 = new array.constructor(length);
if (length && typeof array[0] == "string" && hasOwnProperty.call(array, "index")) {
result2.index = array.index;
result2.input = array.input;
}
return result2;
}
function initCloneObject(object) {
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
}
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag:
case float64Tag:
case int8Tag:
case int16Tag:
case int32Tag:
case uint8Tag:
case uint8ClampedTag:
case uint16Tag:
case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return new Ctor();
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return new Ctor();
case symbolTag:
return cloneSymbol(object);
}
}
function insertWrapDetails(source, details) {
var length = details.length;
if (!length) {
return source;
}
var lastIndex = length - 1;
details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
details = details.join(length > 2 ? ", " : " ");
return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
}
function isFlattenable(value) {
return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER2 : length;
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
function isIterateeCall(value, index, object) {
if (!isObject4(object)) {
return false;
}
var type = typeof index;
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
return eq(object[index], value);
}
return false;
}
function isKey(value, object) {
if (isArray2(value)) {
return false;
}
var type = typeof value;
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
}
function isKeyable(value) {
var type = typeof value;
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
function isLaziable(func) {
var funcName = getFuncName(func), other = lodash[funcName];
if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
return false;
}
if (func === other) {
return true;
}
var data = getData(other);
return !!data && func === data[0];
}
function isMasked(func) {
return !!maskSrcKey && maskSrcKey in func;
}
var isMaskable = coreJsData ? isFunction : stubFalse;
function isPrototype(value) {
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
return value === proto;
}
function isStrictComparable(value) {
return value === value && !isObject4(value);
}
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
};
}
function memoizeCapped(func) {
var result2 = memoize(func, function(key) {
if (cache.size === MAX_MEMOIZE_SIZE) {
cache.clear();
}
return key;
});
var cache = result2.cache;
return result2;
}
function mergeData(data, source) {
var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
if (!(isCommon || isCombo)) {
return data;
}
if (srcBitmask & WRAP_BIND_FLAG) {
data[2] = source[2];
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
}
var value = source[3];
if (value) {
var partials = data[3];
data[3] = partials ? composeArgs(partials, value, source[4]) : value;
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
}
value = source[5];
if (value) {
partials = data[5];
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
}
value = source[7];
if (value) {
data[7] = value;
}
if (srcBitmask & WRAP_ARY_FLAG) {
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
}
if (data[9] == null) {
data[9] = source[9];
}
data[0] = source[0];
data[1] = newBitmask;
return data;
}
function nativeKeysIn(object) {
var result2 = [];
if (object != null) {
for (var key in Object2(object)) {
result2.push(key);
}
}
return result2;
}
function objectToString(value) {
return nativeObjectToString.call(value);
}
function overRest(func, start, transform2) {
start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
return function() {
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array3(length);
while (++index < length) {
array[index] = args[start + index];
}
index = -1;
var otherArgs = Array3(start + 1);
while (++index < start) {
otherArgs[index] = args[index];
}
otherArgs[start] = transform2(array);
return apply(func, this, otherArgs);
};
}
function parent(object, path) {
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
function reorder(array, indexes) {
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
while (length--) {
var index = indexes[length];
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined2;
}
return array;
}
function safeGet(object, key) {
if (key === "constructor" && typeof object[key] === "function") {
return;
}
if (key == "__proto__") {
return;
}
return object[key];
}
var setData = shortOut(baseSetData);
var setTimeout2 = ctxSetTimeout || function(func, wait) {
return root.setTimeout(func, wait);
};
var setToString = shortOut(baseSetToString);
function setWrapToString(wrapper, reference, bitmask) {
var source = reference + "";
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
}
function shortOut(func) {
var count = 0, lastCalled = 0;
return function() {
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
lastCalled = stamp;
if (remaining > 0) {
if (++count >= HOT_COUNT) {
return arguments[0];
}
} else {
count = 0;
}
return func.apply(undefined2, arguments);
};
}
function shuffleSelf(array, size2) {
var index = -1, length = array.length, lastIndex = length - 1;
size2 = size2 === undefined2 ? length : size2;
while (++index < size2) {
var rand = baseRandom(index, lastIndex), value = array[rand];
array[rand] = array[index];
array[index] = value;
}
array.length = size2;
return array;
}
var stringToPath = memoizeCapped(function(string) {
var result2 = [];
if (string.charCodeAt(0) === 46) {
result2.push("");
}
string.replace(rePropName, function(match, number, quote, subString) {
result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
});
return result2;
});
function toKey(value) {
if (typeof value == "string" || isSymbol(value)) {
return value;
}
var result2 = value + "";
return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
}
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {
}
try {
return func + "";
} catch (e) {
}
}
return "";
}
function updateWrapDetails(details, bitmask) {
arrayEach(wrapFlags, function(pair) {
var value = "_." + pair[0];
if (bitmask & pair[1] && !arrayIncludes(details, value)) {
details.push(value);
}
});
return details.sort();
}
function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result2.__actions__ = copyArray(wrapper.__actions__);
result2.__index__ = wrapper.__index__;
result2.__values__ = wrapper.__values__;
return result2;
}
function chunk(array, size2, guard) {
if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
size2 = 1;
} else {
size2 = nativeMax(toInteger(size2), 0);
}
var length = array == null ? 0 : array.length;
if (!length || size2 < 1) {
return [];
}
var index = 0, resIndex = 0, result2 = Array3(nativeCeil(length / size2));
while (index < length) {
result2[resIndex++] = baseSlice(array, index, index += size2);
}
return result2;
}
function compact(array) {
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = [];
while (++index < length) {
var value = array[index];
if (value) {
result2[resIndex++] = value;
}
}
return result2;
}
function concat() {
var length = arguments.length;
if (!length) {
return [];
}
var args = Array3(length - 1), array = arguments[0], index = length;
while (index--) {
args[index - 1] = arguments[index];
}
return arrayPush(isArray2(array) ? copyArray(array) : [array], baseFlatten(args, 1));
}
var difference = baseRest(function(array, values2) {
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
});
var differenceBy = baseRest(function(array, values2) {
var iteratee2 = last(values2);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
});
var differenceWith = baseRest(function(array, values2) {
var comparator = last(values2);
if (isArrayLikeObject(comparator)) {
comparator = undefined2;
}
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
});
function drop(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
return baseSlice(array, n < 0 ? 0 : n, length);
}
function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
}
function dropRightWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : [];
}
function dropWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : [];
}
function fill(array, value, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
start = 0;
end = length;
}
return baseFill(array, value, start, end);
}
function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(array, getIteratee(predicate, 3), index);
}
function findLastIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length - 1;
if (fromIndex !== undefined2) {
index = toInteger(fromIndex);
index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
}
return baseFindIndex(array, getIteratee(predicate, 3), index, true);
}
function flatten(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, 1) : [];
}
function flattenDeep(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
}
function flattenDepth(array, depth) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
depth = depth === undefined2 ? 1 : toInteger(depth);
return baseFlatten(array, depth);
}
function fromPairs(pairs) {
var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {};
while (++index < length) {
var pair = pairs[index];
result2[pair[0]] = pair[1];
}
return result2;
}
function head(array) {
return array && array.length ? array[0] : undefined2;
}
function indexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseIndexOf(array, value, index);
}
function initial(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
}
var intersection = baseRest(function(arrays) {
var mapped = arrayMap(arrays, castArrayLikeObject);
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
});
var intersectionBy = baseRest(function(arrays) {
var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
if (iteratee2 === last(mapped)) {
iteratee2 = undefined2;
} else {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
});
var intersectionWith = baseRest(function(arrays) {
var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
comparator = typeof comparator == "function" ? comparator : undefined2;
if (comparator) {
mapped.pop();
}
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
});
function join(array, separator) {
return array == null ? "" : nativeJoin.call(array, separator);
}
function last(array) {
var length = array == null ? 0 : array.length;
return length ? array[length - 1] : undefined2;
}
function lastIndexOf(array, value, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = length;
if (fromIndex !== undefined2) {
index = toInteger(fromIndex);
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
}
return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
}
function nth(array, n) {
return array && array.length ? baseNth(array, toInteger(n)) : undefined2;
}
var pull = baseRest(pullAll);
function pullAll(array, values2) {
return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array;
}
function pullAllBy(array, values2, iteratee2) {
return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array;
}
function pullAllWith(array, values2, comparator) {
return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined2, comparator) : array;
}
var pullAt = flatRest(function(array, indexes) {
var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes);
basePullAt(array, arrayMap(indexes, function(index) {
return isIndex(index, length) ? +index : index;
}).sort(compareAscending));
return result2;
});
function remove(array, predicate) {
var result2 = [];
if (!(array && array.length)) {
return result2;
}
var index = -1, indexes = [], length = array.length;
predicate = getIteratee(predicate, 3);
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result2.push(value);
indexes.push(index);
}
}
basePullAt(array, indexes);
return result2;
}
function reverse(array) {
return array == null ? array : nativeReverse.call(array);
}
function slice(array, start, end) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
start = 0;
end = length;
} else {
start = start == null ? 0 : toInteger(start);
end = end === undefined2 ? length : toInteger(end);
}
return baseSlice(array, start, end);
}
function sortedIndex(array, value) {
return baseSortedIndex(array, value);
}
function sortedIndexBy(array, value, iteratee2) {
return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2));
}
function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}
}
return -1;
}
function sortedLastIndex(array, value) {
return baseSortedIndex(array, value, true);
}
function sortedLastIndexBy(array, value, iteratee2) {
return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true);
}
function sortedLastIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value, true) - 1;
if (eq(array[index], value)) {
return index;
}
}
return -1;
}
function sortedUniq(array) {
return array && array.length ? baseSortedUniq(array) : [];
}
function sortedUniqBy(array, iteratee2) {
return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : [];
}
function tail(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 1, length) : [];
}
function take(array, n, guard) {
if (!(array && array.length)) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
return baseSlice(array, 0, n < 0 ? 0 : n);
}
function takeRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = guard || n === undefined2 ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, n < 0 ? 0 : n, length);
}
function takeRightWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : [];
}
function takeWhile(array, predicate) {
return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
}
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
var unionBy = baseRest(function(arrays) {
var iteratee2 = last(arrays);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
});
var unionWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator = typeof comparator == "function" ? comparator : undefined2;
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
});
function uniq(array) {
return array && array.length ? baseUniq(array) : [];
}
function uniqBy(array, iteratee2) {
return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : [];
}
function uniqWith(array, comparator) {
comparator = typeof comparator == "function" ? comparator : undefined2;
return array && array.length ? baseUniq(array, undefined2, comparator) : [];
}
function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(length, function(index) {
return arrayMap(array, baseProperty(index));
});
}
function unzipWith(array, iteratee2) {
if (!(array && array.length)) {
return [];
}
var result2 = unzip(array);
if (iteratee2 == null) {
return result2;
}
return arrayMap(result2, function(group) {
return apply(iteratee2, undefined2, group);
});
}
var without = baseRest(function(array, values2) {
return isArrayLikeObject(array) ? baseDifference(array, values2) : [];
});
var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
var xorBy = baseRest(function(arrays) {
var iteratee2 = last(arrays);
if (isArrayLikeObject(iteratee2)) {
iteratee2 = undefined2;
}
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
});
var xorWith = baseRest(function(arrays) {
var comparator = last(arrays);
comparator = typeof comparator == "function" ? comparator : undefined2;
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined2, comparator);
});
var zip = baseRest(unzip);
function zipObject(props, values2) {
return baseZipObject(props || [], values2 || [], assignValue);
}
function zipObjectDeep(props, values2) {
return baseZipObject(props || [], values2 || [], baseSet);
}
var zipWith = baseRest(function(arrays) {
var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
return unzipWith(arrays, iteratee2);
});
function chain(value) {
var result2 = lodash(value);
result2.__chain__ = true;
return result2;
}
function tap(value, interceptor) {
interceptor(value);
return value;
}
function thru(value, interceptor) {
return interceptor(value);
}
var wrapperAt = flatRest(function(paths) {
var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
return baseAt(object, paths);
};
if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
return this.thru(interceptor);
}
value = value.slice(start, +start + (length ? 1 : 0));
value.__actions__.push({
"func": thru,
"args": [interceptor],
"thisArg": undefined2
});
return new LodashWrapper(value, this.__chain__).thru(function(array) {
if (length && !array.length) {
array.push(undefined2);
}
return array;
});
});
function wrapperChain() {
return chain(this);
}
function wrapperCommit() {
return new LodashWrapper(this.value(), this.__chain__);
}
function wrapperNext() {
if (this.__values__ === undefined2) {
this.__values__ = toArray(this.value());
}
var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
return { "done": done, "value": value };
}
function wrapperToIterator() {
return this;
}
function wrapperPlant(value) {
var result2, parent2 = this;
while (parent2 instanceof baseLodash) {
var clone2 = wrapperClone(parent2);
clone2.__index__ = 0;
clone2.__values__ = undefined2;
if (result2) {
previous.__wrapped__ = clone2;
} else {
result2 = clone2;
}
var previous = clone2;
parent2 = parent2.__wrapped__;
}
previous.__wrapped__ = value;
return result2;
}
function wrapperReverse() {
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
var wrapped = value;
if (this.__actions__.length) {
wrapped = new LazyWrapper(this);
}
wrapped = wrapped.reverse();
wrapped.__actions__.push({
"func": thru,
"args": [reverse],
"thisArg": undefined2
});
return new LodashWrapper(wrapped, this.__chain__);
}
return this.thru(reverse);
}
function wrapperValue() {
return baseWrapperValue(this.__wrapped__, this.__actions__);
}
var countBy = createAggregator(function(result2, value, key) {
if (hasOwnProperty.call(result2, key)) {
++result2[key];
} else {
baseAssignValue(result2, key, 1);
}
});
function every(collection, predicate, guard) {
var func = isArray2(collection) ? arrayEvery : baseEvery;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined2;
}
return func(collection, getIteratee(predicate, 3));
}
function filter(collection, predicate) {
var func = isArray2(collection) ? arrayFilter : baseFilter;
return func(collection, getIteratee(predicate, 3));
}
var find = createFind(findIndex);
var findLast = createFind(findLastIndex);
function flatMap(collection, iteratee2) {
return baseFlatten(map(collection, iteratee2), 1);
}
function flatMapDeep(collection, iteratee2) {
return baseFlatten(map(collection, iteratee2), INFINITY);
}
function flatMapDepth(collection, iteratee2, depth) {
depth = depth === undefined2 ? 1 : toInteger(depth);
return baseFlatten(map(collection, iteratee2), depth);
}
function forEach(collection, iteratee2) {
var func = isArray2(collection) ? arrayEach : baseEach;
return func(collection, getIteratee(iteratee2, 3));
}
function forEachRight(collection, iteratee2) {
var func = isArray2(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee2, 3));
}
var groupBy = createAggregator(function(result2, value, key) {
if (hasOwnProperty.call(result2, key)) {
result2[key].push(value);
} else {
baseAssignValue(result2, key, [value]);
}
});
function includes(collection, value, fromIndex, guard) {
collection = isArrayLike(collection) ? collection : values(collection);
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
var length = collection.length;
if (fromIndex < 0) {
fromIndex = nativeMax(length + fromIndex, 0);
}
return isString3(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
}
var invokeMap = baseRest(function(collection, path, args) {
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array3(collection.length) : [];
baseEach(collection, function(value) {
result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
});
return result2;
});
var keyBy = createAggregator(function(result2, value, key) {
baseAssignValue(result2, key, value);
});
function map(collection, iteratee2) {
var func = isArray2(collection) ? arrayMap : baseMap;
return func(collection, getIteratee(iteratee2, 3));
}
function orderBy(collection, iteratees, orders, guard) {
if (collection == null) {
return [];
}
if (!isArray2(iteratees)) {
iteratees = iteratees == null ? [] : [iteratees];
}
orders = guard ? undefined2 : orders;
if (!isArray2(orders)) {
orders = orders == null ? [] : [orders];
}
return baseOrderBy(collection, iteratees, orders);
}
var partition = createAggregator(function(result2, value, key) {
result2[key ? 0 : 1].push(value);
}, function() {
return [[], []];
});
function reduce(collection, iteratee2, accumulator) {
var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
}
function reduceRight(collection, iteratee2, accumulator) {
var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
}
function reject(collection, predicate) {
var func = isArray2(collection) ? arrayFilter : baseFilter;
return func(collection, negate(getIteratee(predicate, 3)));
}
function sample(collection) {
var func = isArray2(collection) ? arraySample : baseSample;
return func(collection);
}
function sampleSize(collection, n, guard) {
if (guard ? isIterateeCall(collection, n, guard) : n === undefined2) {
n = 1;
} else {
n = toInteger(n);
}
var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
return func(collection, n);
}
function shuffle(collection) {
var func = isArray2(collection) ? arrayShuffle : baseShuffle;
return func(collection);
}
function size(collection) {
if (collection == null) {
return 0;
}
if (isArrayLike(collection)) {
return isString3(collection) ? stringSize(collection) : collection.length;
}
var tag = getTag(collection);
if (tag == mapTag || tag == setTag) {
return collection.size;
}
return baseKeys(collection).length;
}
function some(collection, predicate, guard) {
var func = isArray2(collection) ? arraySome : baseSome;
if (guard && isIterateeCall(collection, predicate, guard)) {
predicate = undefined2;
}
return func(collection, getIteratee(predicate, 3));
}
var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {
return [];
}
var length = iteratees.length;
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
iteratees = [];
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
var now = ctxNow || function() {
return root.Date.now();
};
function after(n, func) {
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n < 1) {
return func.apply(this, arguments);
}
};
}
function ary(func, n, guard) {
n = guard ? undefined2 : n;
n = func && n == null ? func.length : n;
return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n);
}
function before(n, func) {
var result2;
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
n = toInteger(n);
return function() {
if (--n > 0) {
result2 = func.apply(this, arguments);
}
if (n <= 1) {
func = undefined2;
}
return result2;
};
}
var bind = baseRest(function(func, thisArg, partials) {
var bitmask = WRAP_BIND_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bind));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(func, bitmask, thisArg, partials, holders);
});
var bindKey = baseRest(function(object, key, partials) {
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
if (partials.length) {
var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= WRAP_PARTIAL_FLAG;
}
return createWrap(key, bitmask, object, partials, holders);
});
function curry(func, arity, guard) {
arity = guard ? undefined2 : arity;
var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
result2.placeholder = curry.placeholder;
return result2;
}
function curryRight(func, arity, guard) {
arity = guard ? undefined2 : arity;
var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
result2.placeholder = curryRight.placeholder;
return result2;
}
function debounce(func, wait, options) {
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject4(options)) {
leading = !!options.leading;
maxing = "maxWait" in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs, thisArg = lastThis;
lastArgs = lastThis = undefined2;
lastInvokeTime = time;
result2 = func.apply(thisArg, args);
return result2;
}
function leadingEdge(time) {
lastInvokeTime = time;
timerId = setTimeout2(timerExpired, wait);
return leading ? invokeFunc(time) : result2;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
timerId = setTimeout2(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined2;
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined2;
return result2;
}
function cancel() {
if (timerId !== undefined2) {
clearTimeout2(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined2;
}
function flush() {
return timerId === undefined2 ? result2 : trailingEdge(now());
}
function debounced() {
var time = now(), isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined2) {
return leadingEdge(lastCallTime);
}
if (maxing) {
clearTimeout2(timerId);
timerId = setTimeout2(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined2) {
timerId = setTimeout2(timerExpired, wait);
}
return result2;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
var defer = baseRest(function(func, args) {
return baseDelay(func, 1, args);
});
var delay = baseRest(function(func, wait, args) {
return baseDelay(func, toNumber(wait) || 0, args);
});
function flip(func) {
return createWrap(func, WRAP_FLIP_FLAG);
}
function memoize(func, resolver) {
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result2 = func.apply(this, args);
memoized.cache = cache.set(key, result2) || cache;
return result2;
};
memoized.cache = new (memoize.Cache || MapCache)();
return memoized;
}
memoize.Cache = MapCache;
function negate(predicate) {
if (typeof predicate != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0:
return !predicate.call(this);
case 1:
return !predicate.call(this, args[0]);
case 2:
return !predicate.call(this, args[0], args[1]);
case 3:
return !predicate.call(this, args[0], args[1], args[2]);
}
return !predicate.apply(this, args);
};
}
function once(func) {
return before(2, func);
}
var overArgs = castRest(function(func, transforms) {
transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
return baseRest(function(args) {
var index = -1, length = nativeMin(args.length, funcsLength);
while (++index < length) {
args[index] = transforms[index].call(this, args[index]);
}
return apply(func, this, args);
});
});
var partial = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partial));
return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
});
var partialRight = baseRest(function(func, partials) {
var holders = replaceHolders(partials, getHolder(partialRight));
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
});
var rearg = flatRest(function(func, indexes) {
return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
});
function rest(func, start) {
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
start = start === undefined2 ? start : toInteger(start);
return baseRest(func, start);
}
function spread(func, start) {
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) {
var array = args[start], otherArgs = castSlice(args, 0, start);
if (array) {
arrayPush(otherArgs, array);
}
return apply(func, this, otherArgs);
});
}
function throttle(func, wait, options) {
var leading = true, trailing = true;
if (typeof func != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
if (isObject4(options)) {
leading = "leading" in options ? !!options.leading : leading;
trailing = "trailing" in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
"leading": leading,
"maxWait": wait,
"trailing": trailing
});
}
function unary(func) {
return ary(func, 1);
}
function wrap(value, wrapper) {
return partial(castFunction(wrapper), value);
}
function castArray() {
if (!arguments.length) {
return [];
}
var value = arguments[0];
return isArray2(value) ? value : [value];
}
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
function cloneWith(value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
}
function cloneDeep(value) {
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
function cloneDeepWith(value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
}
function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys(source));
}
function eq(value, other) {
return value === other || value !== value && other !== other;
}
var gt = createRelationalOperation(baseGt);
var gte = createRelationalOperation(function(value, other) {
return value >= other;
});
var isArguments = baseIsArguments(function() {
return arguments;
}()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
};
var isArray2 = Array3.isArray;
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
function isBoolean(value) {
return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
}
var isBuffer = nativeIsBuffer || stubFalse;
var isDate2 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
function isElement(value) {
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
}
function isEmpty2(value) {
if (value == null) {
return true;
}
if (isArrayLike(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
return !value.length;
}
var tag = getTag(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
}
function isEqual(value, other) {
return baseIsEqual(value, other);
}
function isEqualWith(value, other, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
var result2 = customizer ? customizer(value, other) : undefined2;
return result2 === undefined2 ? baseIsEqual(value, other, undefined2, customizer) : !!result2;
}
function isError(value) {
if (!isObjectLike(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
}
function isFinite(value) {
return typeof value == "number" && nativeIsFinite(value);
}
function isFunction(value) {
if (!isObject4(value)) {
return false;
}
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
function isInteger2(value) {
return typeof value == "number" && value == toInteger(value);
}
function isLength(value) {
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
}
function isObject4(value) {
var type = typeof value;
return value != null && (type == "object" || type == "function");
}
function isObjectLike(value) {
return value != null && typeof value == "object";
}
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
function isMatch(object, source) {
return object === source || baseIsMatch(object, source, getMatchData(source));
}
function isMatchWith(object, source, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return baseIsMatch(object, source, getMatchData(source), customizer);
}
function isNaN2(value) {
return isNumber3(value) && value != +value;
}
function isNative(value) {
if (isMaskable(value)) {
throw new Error3(CORE_ERROR_TEXT);
}
return baseIsNative(value);
}
function isNull8(value) {
return value === null;
}
function isNil(value) {
return value == null;
}
function isNumber3(value) {
return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
}
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
function isSafeInteger(value) {
return isInteger2(value) && value >= -MAX_SAFE_INTEGER2 && value <= MAX_SAFE_INTEGER2;
}
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
function isString3(value) {
return typeof value == "string" || !isArray2(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
}
function isSymbol(value) {
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
}
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
function isUndefined2(value) {
return value === undefined2;
}
function isWeakMap(value) {
return isObjectLike(value) && getTag(value) == weakMapTag;
}
function isWeakSet(value) {
return isObjectLike(value) && baseGetTag(value) == weakSetTag;
}
var lt = createRelationalOperation(baseLt);
var lte = createRelationalOperation(function(value, other) {
return value <= other;
});
function toArray(value) {
if (!value) {
return [];
}
if (isArrayLike(value)) {
return isString3(value) ? stringToArray(value) : copyArray(value);
}
if (symIterator && value[symIterator]) {
return iteratorToArray(value[symIterator]());
}
var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
return func(value);
}
function toFinite(value) {
if (!value) {
return value === 0 ? value : 0;
}
value = toNumber(value);
if (value === INFINITY || value === -INFINITY) {
var sign = value < 0 ? -1 : 1;
return sign * MAX_INTEGER;
}
return value === value ? value : 0;
}
function toInteger(value) {
var result2 = toFinite(value), remainder = result2 % 1;
return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
}
function toLength(value) {
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
}
function toNumber(value) {
if (typeof value == "number") {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject4(value)) {
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
value = isObject4(other) ? other + "" : other;
}
if (typeof value != "string") {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
function toSafeInteger(value) {
return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value === 0 ? value : 0;
}
function toString(value) {
return value == null ? "" : baseToString(value);
}
var assign = createAssigner(function(object, source) {
if (isPrototype(source) || isArrayLike(source)) {
copyObject(source, keys(source), object);
return;
}
for (var key in source) {
if (hasOwnProperty.call(source, key)) {
assignValue(object, key, source[key]);
}
}
});
var assignIn = createAssigner(function(object, source) {
copyObject(source, keysIn(source), object);
});
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keysIn(source), object, customizer);
});
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
copyObject(source, keys(source), object, customizer);
});
var at = flatRest(baseAt);
function create(prototype, properties) {
var result2 = baseCreate(prototype);
return properties == null ? result2 : baseAssign(result2, properties);
}
var defaults2 = baseRest(function(object, sources) {
object = Object2(object);
var index = -1;
var length = sources.length;
var guard = length > 2 ? sources[2] : undefined2;
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
length = 1;
}
while (++index < length) {
var source = sources[index];
var props = keysIn(source);
var propsIndex = -1;
var propsLength = props.length;
while (++propsIndex < propsLength) {
var key = props[propsIndex];
var value = object[key];
if (value === undefined2 || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) {
object[key] = source[key];
}
}
}
return object;
});
var defaultsDeep = baseRest(function(args) {
args.push(undefined2, customDefaultsMerge);
return apply(mergeWith, undefined2, args);
});
function findKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
}
function findLastKey(object, predicate) {
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
}
function forIn(object, iteratee2) {
return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
}
function forInRight(object, iteratee2) {
return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
}
function forOwn(object, iteratee2) {
return object && baseForOwn(object, getIteratee(iteratee2, 3));
}
function forOwnRight(object, iteratee2) {
return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
}
function functions(object) {
return object == null ? [] : baseFunctions(object, keys(object));
}
function functionsIn(object) {
return object == null ? [] : baseFunctions(object, keysIn(object));
}
function get(object, path, defaultValue) {
var result2 = object == null ? undefined2 : baseGet(object, path);
return result2 === undefined2 ? defaultValue : result2;
}
function has(object, path) {
return object != null && hasPath(object, path, baseHas);
}
function hasIn(object, path) {
return object != null && hasPath(object, path, baseHasIn);
}
var invert = createInverter(function(result2, value, key) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
result2[value] = key;
}, constant(identity));
var invertBy = createInverter(function(result2, value, key) {
if (value != null && typeof value.toString != "function") {
value = nativeObjectToString.call(value);
}
if (hasOwnProperty.call(result2, value)) {
result2[value].push(key);
} else {
result2[value] = [key];
}
}, getIteratee);
var invoke = baseRest(baseInvoke);
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
function mapKeys(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
baseForOwn(object, function(value, key, object2) {
baseAssignValue(result2, iteratee2(value, key, object2), value);
});
return result2;
}
function mapValues(object, iteratee2) {
var result2 = {};
iteratee2 = getIteratee(iteratee2, 3);
baseForOwn(object, function(value, key, object2) {
baseAssignValue(result2, key, iteratee2(value, key, object2));
});
return result2;
}
var merge = createAssigner(function(object, source, srcIndex) {
baseMerge(object, source, srcIndex);
});
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
baseMerge(object, source, srcIndex, customizer);
});
var omit = flatRest(function(object, paths) {
var result2 = {};
if (object == null) {
return result2;
}
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result2);
if (isDeep) {
result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result2, paths[length]);
}
return result2;
});
function omitBy(object, predicate) {
return pickBy(object, negate(getIteratee(predicate)));
}
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, paths);
});
function pickBy(object, predicate) {
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = getIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
function result(object, path, defaultValue) {
path = castPath(path, object);
var index = -1, length = path.length;
if (!length) {
length = 1;
object = undefined2;
}
while (++index < length) {
var value = object == null ? undefined2 : object[toKey(path[index])];
if (value === undefined2) {
index = length;
value = defaultValue;
}
object = isFunction(value) ? value.call(object) : value;
}
return object;
}
function set(object, path, value) {
return object == null ? object : baseSet(object, path, value);
}
function setWith(object, path, value, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return object == null ? object : baseSet(object, path, value, customizer);
}
var toPairs = createToPairs(keys);
var toPairsIn = createToPairs(keysIn);
function transform(object, iteratee2, accumulator) {
var isArr = isArray2(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
iteratee2 = getIteratee(iteratee2, 4);
if (accumulator == null) {
var Ctor = object && object.constructor;
if (isArrLike) {
accumulator = isArr ? new Ctor() : [];
} else if (isObject4(object)) {
accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
} else {
accumulator = {};
}
}
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
return iteratee2(accumulator, value, index, object2);
});
return accumulator;
}
function unset(object, path) {
return object == null ? true : baseUnset(object, path);
}
function update(object, path, updater) {
return object == null ? object : baseUpdate(object, path, castFunction(updater));
}
function updateWith(object, path, updater, customizer) {
customizer = typeof customizer == "function" ? customizer : undefined2;
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
}
function values(object) {
return object == null ? [] : baseValues(object, keys(object));
}
function valuesIn(object) {
return object == null ? [] : baseValues(object, keysIn(object));
}
function clamp(number, lower, upper) {
if (upper === undefined2) {
upper = lower;
lower = undefined2;
}
if (upper !== undefined2) {
upper = toNumber(upper);
upper = upper === upper ? upper : 0;
}
if (lower !== undefined2) {
lower = toNumber(lower);
lower = lower === lower ? lower : 0;
}
return baseClamp(toNumber(number), lower, upper);
}
function inRange(number, start, end) {
start = toFinite(start);
if (end === undefined2) {
end = start;
start = 0;
} else {
end = toFinite(end);
}
number = toNumber(number);
return baseInRange(number, start, end);
}
function random(lower, upper, floating) {
if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
upper = floating = undefined2;
}
if (floating === undefined2) {
if (typeof upper == "boolean") {
floating = upper;
upper = undefined2;
} else if (typeof lower == "boolean") {
floating = lower;
lower = undefined2;
}
}
if (lower === undefined2 && upper === undefined2) {
lower = 0;
upper = 1;
} else {
lower = toFinite(lower);
if (upper === undefined2) {
upper = lower;
lower = 0;
} else {
upper = toFinite(upper);
}
}
if (lower > upper) {
var temp = lower;
lower = upper;
upper = temp;
}
if (floating || lower % 1 || upper % 1) {
var rand = nativeRandom();
return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
}
return baseRandom(lower, upper);
}
var camelCase = createCompounder(function(result2, word, index) {
word = word.toLowerCase();
return result2 + (index ? capitalize(word) : word);
});
function capitalize(string) {
return upperFirst(toString(string).toLowerCase());
}
function deburr(string) {
string = toString(string);
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
}
function endsWith(string, target, position) {
string = toString(string);
target = baseToString(target);
var length = string.length;
position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
var end = position;
position -= target.length;
return position >= 0 && string.slice(position, end) == target;
}
function escape(string) {
string = toString(string);
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
}
function escapeRegExp(string) {
string = toString(string);
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
}
var kebabCase = createCompounder(function(result2, word, index) {
return result2 + (index ? "-" : "") + word.toLowerCase();
});
var lowerCase = createCompounder(function(result2, word, index) {
return result2 + (index ? " " : "") + word.toLowerCase();
});
var lowerFirst = createCaseFirst("toLowerCase");
function pad(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
if (!length || strLength >= length) {
return string;
}
var mid = (length - strLength) / 2;
return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
}
function padEnd(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
}
function padStart(string, length, chars) {
string = toString(string);
length = toInteger(length);
var strLength = length ? stringSize(string) : 0;
return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
}
function parseInt2(string, radix, guard) {
if (guard || radix == null) {
radix = 0;
} else if (radix) {
radix = +radix;
}
return nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0);
}
function repeat(string, n, guard) {
if (guard ? isIterateeCall(string, n, guard) : n === undefined2) {
n = 1;
} else {
n = toInteger(n);
}
return baseRepeat(toString(string), n);
}
function replace() {
var args = arguments, string = toString(args[0]);
return args.length < 3 ? string : string.replace(args[1], args[2]);
}
var snakeCase = createCompounder(function(result2, word, index) {
return result2 + (index ? "_" : "") + word.toLowerCase();
});
function split(string, separator, limit) {
if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
separator = limit = undefined2;
}
limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
if (!limit) {
return [];
}
string = toString(string);
if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
separator = baseToString(separator);
if (!separator && hasUnicode(string)) {
return castSlice(stringToArray(string), 0, limit);
}
}
return string.split(separator, limit);
}
var startCase = createCompounder(function(result2, word, index) {
return result2 + (index ? " " : "") + upperFirst(word);
});
function startsWith(string, target, position) {
string = toString(string);
position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
target = baseToString(target);
return string.slice(position, position + target.length) == target;
}
function template(string, options, guard) {
var settings = lodash.templateSettings;
if (guard && isIterateeCall(string, options, guard)) {
options = undefined2;
}
string = toString(string);
options = assignInWith({}, options, settings, customDefaultsAssignIn);
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
var reDelimiters = RegExp2(
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
"g"
);
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
interpolateValue || (interpolateValue = esTemplateValue);
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
if (escapeValue) {
isEscaping = true;
source += "' +\n__e(" + escapeValue + ") +\n'";
}
if (evaluateValue) {
isEvaluating = true;
source += "';\n" + evaluateValue + ";\n__p += '";
}
if (interpolateValue) {
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
}
index = offset + match.length;
return match;
});
source += "';\n";
var variable = hasOwnProperty.call(options, "variable") && options.variable;
if (!variable) {
source = "with (obj) {\n" + source + "\n}\n";
} else if (reForbiddenIdentifierChars.test(variable)) {
throw new Error3(INVALID_TEMPL_VAR_ERROR_TEXT);
}
source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
var result2 = attempt(function() {
return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
});
result2.source = source;
if (isError(result2)) {
throw result2;
}
return result2;
}
function toLower(value) {
return toString(value).toLowerCase();
}
function toUpper(value) {
return toString(value).toUpperCase();
}
function trim(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined2)) {
return baseTrim(string);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
return castSlice(strSymbols, start, end).join("");
}
function trimEnd(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined2)) {
return string.slice(0, trimmedEndIndex(string) + 1);
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
return castSlice(strSymbols, 0, end).join("");
}
function trimStart(string, chars, guard) {
string = toString(string);
if (string && (guard || chars === undefined2)) {
return string.replace(reTrimStart, "");
}
if (!string || !(chars = baseToString(chars))) {
return string;
}
var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
return castSlice(strSymbols, start).join("");
}
function truncate(string, options) {
var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
if (isObject4(options)) {
var separator = "separator" in options ? options.separator : separator;
length = "length" in options ? toInteger(options.length) : length;
omission = "omission" in options ? baseToString(options.omission) : omission;
}
string = toString(string);
var strLength = string.length;
if (hasUnicode(string)) {
var strSymbols = stringToArray(string);
strLength = strSymbols.length;
}
if (length >= strLength) {
return string;
}
var end = length - stringSize(omission);
if (end < 1) {
return omission;
}
var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
if (separator === undefined2) {
return result2 + omission;
}
if (strSymbols) {
end += result2.length - end;
}
if (isRegExp(separator)) {
if (string.slice(end).search(separator)) {
var match, substring = result2;
if (!separator.global) {
separator = RegExp2(separator.source, toString(reFlags.exec(separator)) + "g");
}
separator.lastIndex = 0;
while (match = separator.exec(substring)) {
var newEnd = match.index;
}
result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
}
} else if (string.indexOf(baseToString(separator), end) != end) {
var index = result2.lastIndexOf(separator);
if (index > -1) {
result2 = result2.slice(0, index);
}
}
return result2 + omission;
}
function unescape(string) {
string = toString(string);
return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
}
var upperCase = createCompounder(function(result2, word, index) {
return result2 + (index ? " " : "") + word.toUpperCase();
});
var upperFirst = createCaseFirst("toUpperCase");
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined2 : pattern;
if (pattern === undefined2) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}
var attempt = baseRest(function(func, args) {
try {
return apply(func, undefined2, args);
} catch (e) {
return isError(e) ? e : new Error3(e);
}
});
var bindAll = flatRest(function(object, methodNames) {
arrayEach(methodNames, function(key) {
key = toKey(key);
baseAssignValue(object, key, bind(object[key], object));
});
return object;
});
function cond(pairs) {
var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != "function") {
throw new TypeError3(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair[1]];
});
return baseRest(function(args) {
var index = -1;
while (++index < length) {
var pair = pairs[index];
if (apply(pair[0], this, args)) {
return apply(pair[1], this, args);
}
}
});
}
function conforms(source) {
return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
}
function constant(value) {
return function() {
return value;
};
}
function defaultTo(value, defaultValue) {
return value == null || value !== value ? defaultValue : value;
}
var flow = createFlow();
var flowRight = createFlow(true);
function identity(value) {
return value;
}
function iteratee(func) {
return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
}
function matches(source) {
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
}
function matchesProperty(path, srcValue) {
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
}
var method = baseRest(function(path, args) {
return function(object) {
return baseInvoke(object, path, args);
};
});
var methodOf = baseRest(function(object, args) {
return function(path) {
return baseInvoke(object, path, args);
};
});
function mixin(object, source, options) {
var props = keys(source), methodNames = baseFunctions(source, props);
if (options == null && !(isObject4(source) && (methodNames.length || !props.length))) {
options = source;
source = object;
object = this;
methodNames = baseFunctions(source, keys(source));
}
var chain2 = !(isObject4(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
arrayEach(methodNames, function(methodName) {
var func = source[methodName];
object[methodName] = func;
if (isFunc) {
object.prototype[methodName] = function() {
var chainAll = this.__chain__;
if (chain2 || chainAll) {
var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
actions.push({ "func": func, "args": arguments, "thisArg": object });
result2.__chain__ = chainAll;
return result2;
}
return func.apply(object, arrayPush([this.value()], arguments));
};
}
});
return object;
}
function noConflict() {
if (root._ === this) {
root._ = oldDash;
}
return this;
}
function noop2() {
}
function nthArg(n) {
n = toInteger(n);
return baseRest(function(args) {
return baseNth(args, n);
});
}
var over = createOver(arrayMap);
var overEvery = createOver(arrayEvery);
var overSome = createOver(arraySome);
function property(path) {
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
}
function propertyOf(object) {
return function(path) {
return object == null ? undefined2 : baseGet(object, path);
};
}
var range = createRange();
var rangeRight = createRange(true);
function stubArray() {
return [];
}
function stubFalse() {
return false;
}
function stubObject() {
return {};
}
function stubString() {
return "";
}
function stubTrue() {
return true;
}
function times(n, iteratee2) {
n = toInteger(n);
if (n < 1 || n > MAX_SAFE_INTEGER2) {
return [];
}
var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH);
iteratee2 = getIteratee(iteratee2);
n -= MAX_ARRAY_LENGTH;
var result2 = baseTimes(length, iteratee2);
while (++index < n) {
iteratee2(index);
}
return result2;
}
function toPath(value) {
if (isArray2(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
}
function uniqueId(prefix) {
var id = ++idCounter;
return toString(prefix) + id;
}
var add = createMathOperation(function(augend, addend) {
return augend + addend;
}, 0);
var ceil = createRound("ceil");
var divide = createMathOperation(function(dividend, divisor) {
return dividend / divisor;
}, 1);
var floor = createRound("floor");
function max(array) {
return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2;
}
function maxBy(array, iteratee2) {
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined2;
}
function mean(array) {
return baseMean(array, identity);
}
function meanBy(array, iteratee2) {
return baseMean(array, getIteratee(iteratee2, 2));
}
function min(array) {
return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2;
}
function minBy(array, iteratee2) {
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
}
var multiply = createMathOperation(function(multiplier, multiplicand) {
return multiplier * multiplicand;
}, 1);
var round = createRound("round");
var subtract = createMathOperation(function(minuend, subtrahend) {
return minuend - subtrahend;
}, 0);
function sum(array) {
return array && array.length ? baseSum(array, identity) : 0;
}
function sumBy(array, iteratee2) {
return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0;
}
lodash.after = after;
lodash.ary = ary;
lodash.assign = assign;
lodash.assignIn = assignIn;
lodash.assignInWith = assignInWith;
lodash.assignWith = assignWith;
lodash.at = at;
lodash.before = before;
lodash.bind = bind;
lodash.bindAll = bindAll;
lodash.bindKey = bindKey;
lodash.castArray = castArray;
lodash.chain = chain;
lodash.chunk = chunk;
lodash.compact = compact;
lodash.concat = concat;
lodash.cond = cond;
lodash.conforms = conforms;
lodash.constant = constant;
lodash.countBy = countBy;
lodash.create = create;
lodash.curry = curry;
lodash.curryRight = curryRight;
lodash.debounce = debounce;
lodash.defaults = defaults2;
lodash.defaultsDeep = defaultsDeep;
lodash.defer = defer;
lodash.delay = delay;
lodash.difference = difference;
lodash.differenceBy = differenceBy;
lodash.differenceWith = differenceWith;
lodash.drop = drop;
lodash.dropRight = dropRight;
lodash.dropRightWhile = dropRightWhile;
lodash.dropWhile = dropWhile;
lodash.fill = fill;
lodash.filter = filter;
lodash.flatMap = flatMap;
lodash.flatMapDeep = flatMapDeep;
lodash.flatMapDepth = flatMapDepth;
lodash.flatten = flatten;
lodash.flattenDeep = flattenDeep;
lodash.flattenDepth = flattenDepth;
lodash.flip = flip;
lodash.flow = flow;
lodash.flowRight = flowRight;
lodash.fromPairs = fromPairs;
lodash.functions = functions;
lodash.functionsIn = functionsIn;
lodash.groupBy = groupBy;
lodash.initial = initial;
lodash.intersection = intersection;
lodash.intersectionBy = intersectionBy;
lodash.intersectionWith = intersectionWith;
lodash.invert = invert;
lodash.invertBy = invertBy;
lodash.invokeMap = invokeMap;
lodash.iteratee = iteratee;
lodash.keyBy = keyBy;
lodash.keys = keys;
lodash.keysIn = keysIn;
lodash.map = map;
lodash.mapKeys = mapKeys;
lodash.mapValues = mapValues;
lodash.matches = matches;
lodash.matchesProperty = matchesProperty;
lodash.memoize = memoize;
lodash.merge = merge;
lodash.mergeWith = mergeWith;
lodash.method = method;
lodash.methodOf = methodOf;
lodash.mixin = mixin;
lodash.negate = negate;
lodash.nthArg = nthArg;
lodash.omit = omit;
lodash.omitBy = omitBy;
lodash.once = once;
lodash.orderBy = orderBy;
lodash.over = over;
lodash.overArgs = overArgs;
lodash.overEvery = overEvery;
lodash.overSome = overSome;
lodash.partial = partial;
lodash.partialRight = partialRight;
lodash.partition = partition;
lodash.pick = pick;
lodash.pickBy = pickBy;
lodash.property = property;
lodash.propertyOf = propertyOf;
lodash.pull = pull;
lodash.pullAll = pullAll;
lodash.pullAllBy = pullAllBy;
lodash.pullAllWith = pullAllWith;
lodash.pullAt = pullAt;
lodash.range = range;
lodash.rangeRight = rangeRight;
lodash.rearg = rearg;
lodash.reject = reject;
lodash.remove = remove;
lodash.rest = rest;
lodash.reverse = reverse;
lodash.sampleSize = sampleSize;
lodash.set = set;
lodash.setWith = setWith;
lodash.shuffle = shuffle;
lodash.slice = slice;
lodash.sortBy = sortBy;
lodash.sortedUniq = sortedUniq;
lodash.sortedUniqBy = sortedUniqBy;
lodash.split = split;
lodash.spread = spread;
lodash.tail = tail;
lodash.take = take;
lodash.takeRight = takeRight;
lodash.takeRightWhile = takeRightWhile;
lodash.takeWhile = takeWhile;
lodash.tap = tap;
lodash.throttle = throttle;
lodash.thru = thru;
lodash.toArray = toArray;
lodash.toPairs = toPairs;
lodash.toPairsIn = toPairsIn;
lodash.toPath = toPath;
lodash.toPlainObject = toPlainObject;
lodash.transform = transform;
lodash.unary = unary;
lodash.union = union;
lodash.unionBy = unionBy;
lodash.unionWith = unionWith;
lodash.uniq = uniq;
lodash.uniqBy = uniqBy;
lodash.uniqWith = uniqWith;
lodash.unset = unset;
lodash.unzip = unzip;
lodash.unzipWith = unzipWith;
lodash.update = update;
lodash.updateWith = updateWith;
lodash.values = values;
lodash.valuesIn = valuesIn;
lodash.without = without;
lodash.words = words;
lodash.wrap = wrap;
lodash.xor = xor;
lodash.xorBy = xorBy;
lodash.xorWith = xorWith;
lodash.zip = zip;
lodash.zipObject = zipObject;
lodash.zipObjectDeep = zipObjectDeep;
lodash.zipWith = zipWith;
lodash.entries = toPairs;
lodash.entriesIn = toPairsIn;
lodash.extend = assignIn;
lodash.extendWith = assignInWith;
mixin(lodash, lodash);
lodash.add = add;
lodash.attempt = attempt;
lodash.camelCase = camelCase;
lodash.capitalize = capitalize;
lodash.ceil = ceil;
lodash.clamp = clamp;
lodash.clone = clone;
lodash.cloneDeep = cloneDeep;
lodash.cloneDeepWith = cloneDeepWith;
lodash.cloneWith = cloneWith;
lodash.conformsTo = conformsTo;
lodash.deburr = deburr;
lodash.defaultTo = defaultTo;
lodash.divide = divide;
lodash.endsWith = endsWith;
lodash.eq = eq;
lodash.escape = escape;
lodash.escapeRegExp = escapeRegExp;
lodash.every = every;
lodash.find = find;
lodash.findIndex = findIndex;
lodash.findKey = findKey;
lodash.findLast = findLast;
lodash.findLastIndex = findLastIndex;
lodash.findLastKey = findLastKey;
lodash.floor = floor;
lodash.forEach = forEach;
lodash.forEachRight = forEachRight;
lodash.forIn = forIn;
lodash.forInRight = forInRight;
lodash.forOwn = forOwn;
lodash.forOwnRight = forOwnRight;
lodash.get = get;
lodash.gt = gt;
lodash.gte = gte;
lodash.has = has;
lodash.hasIn = hasIn;
lodash.head = head;
lodash.identity = identity;
lodash.includes = includes;
lodash.indexOf = indexOf;
lodash.inRange = inRange;
lodash.invoke = invoke;
lodash.isArguments = isArguments;
lodash.isArray = isArray2;
lodash.isArrayBuffer = isArrayBuffer;
lodash.isArrayLike = isArrayLike;
lodash.isArrayLikeObject = isArrayLikeObject;
lodash.isBoolean = isBoolean;
lodash.isBuffer = isBuffer;
lodash.isDate = isDate2;
lodash.isElement = isElement;
lodash.isEmpty = isEmpty2;
lodash.isEqual = isEqual;
lodash.isEqualWith = isEqualWith;
lodash.isError = isError;
lodash.isFinite = isFinite;
lodash.isFunction = isFunction;
lodash.isInteger = isInteger2;
lodash.isLength = isLength;
lodash.isMap = isMap;
lodash.isMatch = isMatch;
lodash.isMatchWith = isMatchWith;
lodash.isNaN = isNaN2;
lodash.isNative = isNative;
lodash.isNil = isNil;
lodash.isNull = isNull8;
lodash.isNumber = isNumber3;
lodash.isObject = isObject4;
lodash.isObjectLike = isObjectLike;
lodash.isPlainObject = isPlainObject;
lodash.isRegExp = isRegExp;
lodash.isSafeInteger = isSafeInteger;
lodash.isSet = isSet;
lodash.isString = isString3;
lodash.isSymbol = isSymbol;
lodash.isTypedArray = isTypedArray;
lodash.isUndefined = isUndefined2;
lodash.isWeakMap = isWeakMap;
lodash.isWeakSet = isWeakSet;
lodash.join = join;
lodash.kebabCase = kebabCase;
lodash.last = last;
lodash.lastIndexOf = lastIndexOf;
lodash.lowerCase = lowerCase;
lodash.lowerFirst = lowerFirst;
lodash.lt = lt;
lodash.lte = lte;
lodash.max = max;
lodash.maxBy = maxBy;
lodash.mean = mean;
lodash.meanBy = meanBy;
lodash.min = min;
lodash.minBy = minBy;
lodash.stubArray = stubArray;
lodash.stubFalse = stubFalse;
lodash.stubObject = stubObject;
lodash.stubString = stubString;
lodash.stubTrue = stubTrue;
lodash.multiply = multiply;
lodash.nth = nth;
lodash.noConflict = noConflict;
lodash.noop = noop2;
lodash.now = now;
lodash.pad = pad;
lodash.padEnd = padEnd;
lodash.padStart = padStart;
lodash.parseInt = parseInt2;
lodash.random = random;
lodash.reduce = reduce;
lodash.reduceRight = reduceRight;
lodash.repeat = repeat;
lodash.replace = replace;
lodash.result = result;
lodash.round = round;
lodash.runInContext = runInContext2;
lodash.sample = sample;
lodash.size = size;
lodash.snakeCase = snakeCase;
lodash.some = some;
lodash.sortedIndex = sortedIndex;
lodash.sortedIndexBy = sortedIndexBy;
lodash.sortedIndexOf = sortedIndexOf;
lodash.sortedLastIndex = sortedLastIndex;
lodash.sortedLastIndexBy = sortedLastIndexBy;
lodash.sortedLastIndexOf = sortedLastIndexOf;
lodash.startCase = startCase;
lodash.startsWith = startsWith;
lodash.subtract = subtract;
lodash.sum = sum;
lodash.sumBy = sumBy;
lodash.template = template;
lodash.times = times;
lodash.toFinite = toFinite;
lodash.toInteger = toInteger;
lodash.toLength = toLength;
lodash.toLower = toLower;
lodash.toNumber = toNumber;
lodash.toSafeInteger = toSafeInteger;
lodash.toString = toString;
lodash.toUpper = toUpper;
lodash.trim = trim;
lodash.trimEnd = trimEnd;
lodash.trimStart = trimStart;
lodash.truncate = truncate;
lodash.unescape = unescape;
lodash.uniqueId = uniqueId;
lodash.upperCase = upperCase;
lodash.upperFirst = upperFirst;
lodash.each = forEach;
lodash.eachRight = forEachRight;
lodash.first = head;
mixin(lodash, function() {
var source = {};
baseForOwn(lodash, function(func, methodName) {
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
source[methodName] = func;
}
});
return source;
}(), { "chain": false });
lodash.VERSION = VERSION;
arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
lodash[methodName].placeholder = lodash;
});
arrayEach(["drop", "take"], function(methodName, index) {
LazyWrapper.prototype[methodName] = function(n) {
n = n === undefined2 ? 1 : nativeMax(toInteger(n), 0);
var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
if (result2.__filtered__) {
result2.__takeCount__ = nativeMin(n, result2.__takeCount__);
} else {
result2.__views__.push({
"size": nativeMin(n, MAX_ARRAY_LENGTH),
"type": methodName + (result2.__dir__ < 0 ? "Right" : "")
});
}
return result2;
};
LazyWrapper.prototype[methodName + "Right"] = function(n) {
return this.reverse()[methodName](n).reverse();
};
});
arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
LazyWrapper.prototype[methodName] = function(iteratee2) {
var result2 = this.clone();
result2.__iteratees__.push({
"iteratee": getIteratee(iteratee2, 3),
"type": type
});
result2.__filtered__ = result2.__filtered__ || isFilter;
return result2;
};
});
arrayEach(["head", "last"], function(methodName, index) {
var takeName = "take" + (index ? "Right" : "");
LazyWrapper.prototype[methodName] = function() {
return this[takeName](1).value()[0];
};
});
arrayEach(["initial", "tail"], function(methodName, index) {
var dropName = "drop" + (index ? "" : "Right");
LazyWrapper.prototype[methodName] = function() {
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
};
});
LazyWrapper.prototype.compact = function() {
return this.filter(identity);
};
LazyWrapper.prototype.find = function(predicate) {
return this.filter(predicate).head();
};
LazyWrapper.prototype.findLast = function(predicate) {
return this.reverse().find(predicate);
};
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
if (typeof path == "function") {
return new LazyWrapper(this);
}
return this.map(function(value) {
return baseInvoke(value, path, args);
});
});
LazyWrapper.prototype.reject = function(predicate) {
return this.filter(negate(getIteratee(predicate)));
};
LazyWrapper.prototype.slice = function(start, end) {
start = toInteger(start);
var result2 = this;
if (result2.__filtered__ && (start > 0 || end < 0)) {
return new LazyWrapper(result2);
}
if (start < 0) {
result2 = result2.takeRight(-start);
} else if (start) {
result2 = result2.drop(start);
}
if (end !== undefined2) {
end = toInteger(end);
result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
}
return result2;
};
LazyWrapper.prototype.takeRightWhile = function(predicate) {
return this.reverse().takeWhile(predicate).reverse();
};
LazyWrapper.prototype.toArray = function() {
return this.take(MAX_ARRAY_LENGTH);
};
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
if (!lodashFunc) {
return;
}
lodash.prototype[methodName] = function() {
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
var interceptor = function(value2) {
var result3 = lodashFunc.apply(lodash, arrayPush([value2], args));
return isTaker && chainAll ? result3[0] : result3;
};
if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
isLazy = useLazy = false;
}
var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
if (!retUnwrapped && useLazy) {
value = onlyLazy ? value : new LazyWrapper(this);
var result2 = func.apply(value, args);
result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
return new LodashWrapper(result2, chainAll);
}
if (isUnwrapped && onlyLazy) {
return func.apply(this, args);
}
result2 = this.thru(interceptor);
return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
};
});
arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
lodash.prototype[methodName] = function() {
var args = arguments;
if (retUnwrapped && !this.__chain__) {
var value = this.value();
return func.apply(isArray2(value) ? value : [], args);
}
return this[chainName](function(value2) {
return func.apply(isArray2(value2) ? value2 : [], args);
});
};
});
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
var lodashFunc = lodash[methodName];
if (lodashFunc) {
var key = lodashFunc.name + "";
if (!hasOwnProperty.call(realNames, key)) {
realNames[key] = [];
}
realNames[key].push({ "name": methodName, "func": lodashFunc });
}
});
realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
"name": "wrapper",
"func": undefined2
}];
LazyWrapper.prototype.clone = lazyClone;
LazyWrapper.prototype.reverse = lazyReverse;
LazyWrapper.prototype.value = lazyValue;
lodash.prototype.at = wrapperAt;
lodash.prototype.chain = wrapperChain;
lodash.prototype.commit = wrapperCommit;
lodash.prototype.next = wrapperNext;
lodash.prototype.plant = wrapperPlant;
lodash.prototype.reverse = wrapperReverse;
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
lodash.prototype.first = lodash.prototype.head;
if (symIterator) {
lodash.prototype[symIterator] = wrapperToIterator;
}
return lodash;
};
var _2 = runInContext();
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
root._ = _2;
define(function() {
return _2;
});
} else if (freeModule) {
(freeModule.exports = _2)._ = _2;
freeExports._ = _2;
} else {
root._ = _2;
}
}).call(exports);
}
});
// ../../node_modules/zed/pkg/reglob/reglob.js
var require_reglob = __commonJS({
"../../node_modules/zed/pkg/reglob/reglob.js"(exports, module) {
function Reglob(glob, opts) {
if (typeof glob !== "string") {
throw new TypeError("Expected a string");
}
var str = String(glob);
var reStr = "";
var extended = opts ? !!opts.extended : false;
var globstar = opts ? !!opts.globstar : false;
var inGroup = false;
var flags = opts && typeof opts.flags === "string" ? opts.flags : "";
var c;
for (var i = 0, len = str.length; i < len; i++) {
c = str[i];
switch (c) {
case "/":
case "$":
case "^":
case "+":
case ".":
case "(":
case ")":
case "=":
case "!":
case "|":
reStr += "\\" + c;
break;
case "?":
if (extended) {
reStr += ".";
break;
}
case "[":
case "]":
if (extended) {
reStr += c;
break;
}
case "{":
if (extended) {
inGroup = true;
reStr += "(";
break;
}
case "}":
if (extended) {
inGroup = false;
reStr += ")";
break;
}
case ",":
if (inGroup) {
reStr += "|";
break;
}
reStr += "\\" + c;
break;
case "\\":
if (str[i + 1] == "*") {
i++;
reStr += "\\*";
} else {
reStr += c;
}
break;
case "*":
var prevChar = str[i - 1];
var starCount = 1;
while (str[i + 1] === "*") {
starCount++;
i++;
}
var nextChar = str[i + 1];
if (!globstar) {
reStr += ".*";
} else {
var isGlobstar = starCount > 1 && (prevChar === "/" || prevChar === void 0) && (nextChar === "/" || nextChar === void 0);
if (isGlobstar) {
reStr += "((?:[^/]*(?:/|$))*)";
i++;
} else {
reStr += "([^/]*)";
}
}
break;
default:
reStr += c;
}
}
if (!flags || !~flags.indexOf("g")) {
reStr = "^" + reStr + "$";
}
return reStr;
}
module.exports = {
Reglob
};
}
});
// ../../node_modules/zed/compiler/parser/parser.js
var require_parser = __commonJS({
"../../node_modules/zed/compiler/parser/parser.js"(exports, module) {
"use strict";
function peg$subclass(child, parent) {
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return '"' + literalEscape(expectation.text) + '"';
},
"class": function(expectation) {
var escapedParts = "", i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function(expectation) {
return "any character";
},
end: function(expectation) {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
return "\\x0" + hex(ch);
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
return "\\x" + hex(ch);
});
}
function classEscape(s) {
return s.replace(/\\/g, "\\\\").replace(/\]/g, "\\]").replace(/\^/g, "\\^").replace(/-/g, "\\-").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, function(ch) {
return "\\x0" + hex(ch);
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) {
return "\\x" + hex(ch);
});
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected2) {
var descriptions = new Array(expected2.length), i, j;
for (i = 0; i < expected2.length; i++) {
descriptions[i] = describeExpectation(expected2[i]);
}
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1];
}
}
function describeFound(found2) {
return found2 ? '"' + literalEscape(found2) + '"' : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== void 0 ? options : {};
var peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart, Expr: peg$parseExpr }, peg$startRuleFunction = peg$parsestart, peg$c0 = function(ast) {
return ast;
}, peg$c1 = function(decls, first, rest) {
return { "kind": "Sequential", "ops": [first, ...rest], "decls": decls };
}, peg$c2 = function(p) {
return p;
}, peg$c3 = function() {
return [];
}, peg$c4 = function(v) {
return v;
}, peg$c5 = "const", peg$c6 = peg$literalExpectation("const", false), peg$c7 = "=", peg$c8 = peg$literalExpectation("=", false), peg$c9 = function(id, expr) {
return { "kind": "ConstDecl", "name": id, "expr": expr };
}, peg$c10 = "type", peg$c11 = peg$literalExpectation("type", false), peg$c12 = function(id, typ) {
return {
"kind": "ConstDecl",
"name": id,
"expr": { "kind": "TypeValue", "value": { "kind": "TypeDef", "name": id, "type": typ } }
};
}, peg$c13 = "func", peg$c14 = peg$literalExpectation("func", false), peg$c15 = "(", peg$c16 = peg$literalExpectation("(", false), peg$c17 = ")", peg$c18 = peg$literalExpectation(")", false), peg$c19 = ":", peg$c20 = peg$literalExpectation(":", false), peg$c21 = function(id, params, expr) {
return {
"kind": "FuncDecl",
"name": id,
"params": params,
"expr": expr
};
}, peg$c22 = "fork", peg$c23 = peg$literalExpectation("fork", false), peg$c24 = function(ops) {
return { "kind": "Parallel", "ops": ops };
}, peg$c25 = "switch", peg$c26 = peg$literalExpectation("switch", false), peg$c27 = function(expr, cases) {
return { "kind": "Switch", "expr": expr, "cases": cases };
}, peg$c28 = function(cases) {
return { "kind": "Switch", "expr": null, "cases": cases };
}, peg$c29 = "from", peg$c30 = peg$literalExpectation("from", false), peg$c31 = function(trunks) {
return { "kind": "From", "trunks": trunks };
}, peg$c32 = function(a) {
return a;
}, peg$c33 = "search", peg$c34 = peg$literalExpectation("search", false), peg$c35 = function(expr) {
return { "kind": "Search", "expr": expr };
}, peg$c36 = function(expr) {
return { "kind": "OpExpr", "expr": expr };
}, peg$c37 = function(expr) {
return { "kind": "OpExpr", "expr": expr };
}, peg$c38 = "=>", peg$c39 = peg$literalExpectation("=>", false), peg$c40 = "|", peg$c41 = peg$literalExpectation("|", false), peg$c42 = "{", peg$c43 = peg$literalExpectation("{", false), peg$c44 = "[", peg$c45 = peg$literalExpectation("[", false), peg$c46 = function(s) {
return s;
}, peg$c47 = function(expr, op) {
return { "expr": expr, "op": op };
}, peg$c48 = "case", peg$c49 = peg$literalExpectation("case", false), peg$c50 = function(expr) {
return expr;
}, peg$c51 = "default", peg$c52 = peg$literalExpectation("default", false), peg$c53 = function() {
return null;
}, peg$c54 = function(source, opt) {
let m = { "kind": "Trunk", "source": source, "seq": null };
if (opt) {
m["seq"] = opt[3];
}
return m;
}, peg$c55 = "~", peg$c56 = peg$literalExpectation("~", false), peg$c57 = "==", peg$c58 = peg$literalExpectation("==", false), peg$c59 = "!=", peg$c60 = peg$literalExpectation("!=", false), peg$c61 = "in", peg$c62 = peg$literalExpectation("in", false), peg$c63 = "<=", peg$c64 = peg$literalExpectation("<=", false), peg$c65 = "<", peg$c66 = peg$literalExpectation("<", false), peg$c67 = ">=", peg$c68 = peg$literalExpectation(">=", false), peg$c69 = ">", peg$c70 = peg$literalExpectation(">", false), peg$c71 = function() {
return text();
}, peg$c72 = function(first, rest) {
return makeBinaryExprChain(first, rest);
}, peg$c73 = function(t) {
return ["or", t];
}, peg$c74 = function(first, expr) {
return ["and", expr];
}, peg$c75 = function(first, rest) {
return makeBinaryExprChain(first, rest);
}, peg$c76 = "!", peg$c77 = peg$literalExpectation("!", false), peg$c78 = function(e) {
return { "kind": "UnaryExpr", "op": "!", "operand": e };
}, peg$c79 = function(v) {
return { "kind": "Term", "text": text(), "value": v };
}, peg$c80 = "*", peg$c81 = peg$literalExpectation("*", false), peg$c82 = function() {
return { "kind": "Primitive", "type": "bool", "text": "true" };
}, peg$c83 = function(lhs, op, rhs) {
return { "kind": "BinaryExpr", "op": op, "lhs": lhs, "rhs": rhs };
}, peg$c84 = function(first, rest) {
return makeBinaryExprChain(first, rest);
}, peg$c85 = function(v) {
return { "kind": "Primitive", "type": "string", "text": v };
}, peg$c86 = function(pattern) {
return { "kind": "Glob", "pattern": pattern };
}, peg$c87 = function(pattern) {
return { "kind": "Regexp", "pattern": pattern };
}, peg$c88 = function(keys, limit) {
return { "kind": "Summarize", "keys": keys, "aggs": null, "limit": limit };
}, peg$c89 = function(aggs, keys, limit) {
let p = { "kind": "Summarize", "keys": null, "aggs": aggs, "limit": limit };
if (keys) {
p["keys"] = keys[1];
}
return p;
}, peg$c90 = "summarize", peg$c91 = peg$literalExpectation("summarize", false), peg$c92 = function(columns) {
return columns;
}, peg$c93 = "with", peg$c94 = peg$literalExpectation("with", false), peg$c95 = "-limit", peg$c96 = peg$literalExpectation("-limit", false), peg$c97 = function(limit) {
return limit;
}, peg$c98 = "", peg$c99 = function() {
return 0;
}, peg$c100 = function(expr) {
return { "kind": "Assignment", "lhs": null, "rhs": expr };
}, peg$c101 = ",", peg$c102 = peg$literalExpectation(",", false), peg$c103 = function(first, expr) {
return expr;
}, peg$c104 = function(first, rest) {
return [first, ...rest];
}, peg$c105 = ":=", peg$c106 = peg$literalExpectation(":=", false), peg$c107 = function(lval, agg) {
return { "kind": "Assignment", "lhs": lval, "rhs": agg };
}, peg$c108 = function(agg) {
return { "kind": "Assignment", "lhs": null, "rhs": agg };
}, peg$c109 = ".", peg$c110 = peg$literalExpectation(".", false), peg$c111 = function(op, expr, where) {
let r = { "kind": "Agg", "name": op, "expr": null, "where": where };
if (expr) {
r["expr"] = expr;
}
return r;
}, peg$c112 = "where", peg$c113 = peg$literalExpectation("where", false), peg$c114 = function(first, rest) {
let result = [first];
for (let r of rest) {
result.push(r[3]);
}
return result;
}, peg$c115 = "assert", peg$c116 = peg$literalExpectation("assert", false), peg$c117 = function(e) {
return [e, text()];
}, peg$c118 = function(expr) {
return { "kind": "Yield", "exprs": [{
"kind": "Conditional",
"cond": expr[0],
"then": { "kind": "ID", "name": "this" },
"else": {
"kind": "Call",
"name": "error",
"args": [{ "kind": "RecordExpr", "elems": [
{ "kind": "Field", "name": "message", "value": {
"kind": "Primitive",
"text": "assertion failed",
"type": "string"
} },
{ "kind": "Field", "name": "expr", "value": {
"kind": "Primitive",
"text": expr[1],
"type": "string"
} },
{ "kind": "Field", "name": "on", "value": {
"kind": "ID",
"name": "this"
} }
] }],
"where": null
}
}] };
}, peg$c119 = "sort", peg$c120 = peg$literalExpectation("sort", false), peg$c121 = function(args, l) {
return l;
}, peg$c122 = function(args, list) {
let argm = args;
let op = { "kind": "Sort", "args": list, "order": "asc", "nullsfirst": false };
if ("r" in argm) {
op["order"] = "desc";
}
if ("nulls" in argm) {
if (argm["nulls"] == "first") {
op["nullsfirst"] = true;
}
}
return op;
}, peg$c123 = function(args) {
return makeArgMap(args);
}, peg$c124 = "-r", peg$c125 = peg$literalExpectation("-r", false), peg$c126 = function() {
return { "name": "r", "value": null };
}, peg$c127 = "-nulls", peg$c128 = peg$literalExpectation("-nulls", false), peg$c129 = "first", peg$c130 = peg$literalExpectation("first", false), peg$c131 = "last", peg$c132 = peg$literalExpectation("last", false), peg$c133 = function(where) {
return { "name": "nulls", "value": where };
}, peg$c134 = "top", peg$c135 = peg$literalExpectation("top", false), peg$c136 = function(n) {
return n;
}, peg$c137 = "-flush", peg$c138 = peg$literalExpectation("-flush", false), peg$c139 = function(limit, flush, f) {
return f;
}, peg$c140 = function(limit, flush, fields) {
let op = { "kind": "Top", "limit": 0, "args": null, "flush": false };
if (limit) {
op["limit"] = limit;
}
if (fields) {
op["args"] = fields;
}
if (flush) {
op["flush"] = true;
}
return op;
}, peg$c141 = "cut", peg$c142 = peg$literalExpectation("cut", false), peg$c143 = function(args) {
return { "kind": "Cut", "args": args };
}, peg$c144 = "drop", peg$c145 = peg$literalExpectation("drop", false), peg$c146 = function(args) {
return { "kind": "Drop", "args": args };
}, peg$c147 = "head", peg$c148 = peg$literalExpectation("head", false), peg$c149 = function(count) {
return { "kind": "Head", "count": count };
}, peg$c150 = function() {
return { "kind": "Head", "count": 1 };
}, peg$c151 = "tail", peg$c152 = peg$literalExpectation("tail", false), peg$c153 = function(count) {
return { "kind": "Tail", "count": count };
}, peg$c154 = function() {
return { "kind": "Tail", "count": 1 };
}, peg$c155 = function(expr) {
return { "kind": "Where", "expr": expr };
}, peg$c156 = "uniq", peg$c157 = peg$literalExpectation("uniq", false), peg$c158 = "-c", peg$c159 = peg$literalExpectation("-c", false), peg$c160 = function() {
return { "kind": "Uniq", "cflag": true };
}, peg$c161 = function() {
return { "kind": "Uniq", "cflag": false };
}, peg$c162 = "put", peg$c163 = peg$literalExpectation("put", false), peg$c164 = function(args) {
return { "kind": "Put", "args": args };
}, peg$c165 = "rename", peg$c166 = peg$literalExpectation("rename", false), peg$c167 = function(first, cl) {
return cl;
}, peg$c168 = function(first, rest) {
return { "kind": "Rename", "args": [first, ...rest] };
}, peg$c169 = "fuse", peg$c170 = peg$literalExpectation("fuse", false), peg$c171 = function() {
return { "kind": "Fuse" };
}, peg$c172 = "shape", peg$c173 = peg$literalExpectation("shape", false), peg$c174 = function() {
return { "kind": "Shape" };
}, peg$c175 = "join", peg$c176 = peg$literalExpectation("join", false), peg$c177 = function(style, key, optKey, optArgs) {
let m = { "kind": "Join", "style": style, "left_key": key, "right_key": key, "args": null };
if (optKey) {
m["right_key"] = optKey[3];
}
if (optArgs) {
m["args"] = optArgs[1];
}
return m;
}, peg$c178 = "anti", peg$c179 = peg$literalExpectation("anti", false), peg$c180 = function() {
return "anti";
}, peg$c181 = "inner", peg$c182 = peg$literalExpectation("inner", false), peg$c183 = function() {
return "inner";
}, peg$c184 = "left", peg$c185 = peg$literalExpectation("left", false), peg$c186 = function() {
return "left";
}, peg$c187 = "right", peg$c188 = peg$literalExpectation("right", false), peg$c189 = function() {
return "right";
}, peg$c190 = "sample", peg$c191 = peg$literalExpectation("sample", false), peg$c192 = function(e) {
return { "kind": "Sequential", "decls": [], "ops": [
{
"kind": "Summarize",
"keys": [{
"kind": "Assignment",
"lhs": { "kind": "ID", "name": "shape" },
"rhs": {
"kind": "Call",
"name": "typeof",
"args": [e],
"where": null
}
}],
"aggs": [{
"kind": "Assignment",
"lhs": { "kind": "ID", "name": "sample" },
"rhs": {
"kind": "Agg",
"name": "any",
"expr": e,
"where": null
}
}],
"limit": 0
},
{
"kind": "Yield",
"exprs": [
{ "kind": "ID", "name": "sample" }
]
}
] };
}, peg$c193 = function(a) {
return { "kind": "OpAssignment", "assignments": a };
}, peg$c194 = function(lval) {
return lval;
}, peg$c195 = function() {
return { "kind": "ID", "name": "this" };
}, peg$c196 = function(source) {
return { "kind": "From", "trunks": [{ "kind": "Trunk", "source": source }] };
}, peg$c197 = "file", peg$c198 = peg$literalExpectation("file", false), peg$c199 = function(path, format, layout) {
return { "kind": "File", "path": path, "format": format, "layout": layout };
}, peg$c200 = function(body) {
return body;
}, peg$c201 = "pool", peg$c202 = peg$literalExpectation("pool", false), peg$c203 = function(spec, at) {
return { "kind": "Pool", "spec": spec, "at": at };
}, peg$c204 = "get", peg$c205 = peg$literalExpectation("get", false), peg$c206 = function(url, format, layout) {
return { "kind": "HTTP", "url": url, "format": format, "layout": layout };
}, peg$c207 = "http:", peg$c208 = peg$literalExpectation("http:", false), peg$c209 = "https:", peg$c210 = peg$literalExpectation("https:", false), peg$c211 = /^[0-9a-zA-Z!@$%\^&*()_=<>,.\/?:[\]{}~|+\-]/, peg$c212 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], "!", "@", "$", "%", "^", "&", "*", "(", ")", "_", "=", "<", ">", ",", ".", "/", "?", ":", "[", "]", "{", "}", "~", "|", "+", "-"], false, false), peg$c213 = "at", peg$c214 = peg$literalExpectation("at", false), peg$c215 = function(id) {
return id;
}, peg$c216 = /^[0-9a-zA-Z]/, peg$c217 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"]], false, false), peg$c218 = function(pool, commit, meta, tap) {
return { "pool": pool, "commit": commit, "meta": meta, "tap": tap };
}, peg$c219 = function(meta) {
return { "pool": null, "commit": null, "meta": meta };
}, peg$c220 = "@", peg$c221 = peg$literalExpectation("@", false), peg$c222 = function(commit) {
return commit;
}, peg$c223 = function(meta) {
return meta;
}, peg$c224 = function() {
return { "kind": "Glob", "pattern": "*" };
}, peg$c225 = function(name2) {
return { "kind": "String", "text": name2 };
}, peg$c226 = function() {
return text();
}, peg$c227 = "order", peg$c228 = peg$literalExpectation("order", false), peg$c229 = function(keys, order) {
return { "kind": "Layout", "keys": keys, "order": order };
}, peg$c230 = "tap", peg$c231 = peg$literalExpectation("tap", false), peg$c232 = function() {
return true;
}, peg$c233 = function() {
return false;
}, peg$c234 = "format", peg$c235 = peg$literalExpectation("format", false), peg$c236 = function(val) {
return val;
}, peg$c237 = ":asc", peg$c238 = peg$literalExpectation(":asc", false), peg$c239 = function() {
return "asc";
}, peg$c240 = ":desc", peg$c241 = peg$literalExpectation(":desc", false), peg$c242 = function() {
return "desc";
}, peg$c243 = "pass", peg$c244 = peg$literalExpectation("pass", false), peg$c245 = function() {
return { "kind": "Pass" };
}, peg$c246 = "explode", peg$c247 = peg$literalExpectation("explode", false), peg$c248 = function(args, typ, as) {
return { "kind": "Explode", "args": args, "as": as, "type": typ };
}, peg$c249 = "merge", peg$c250 = peg$literalExpectation("merge", false), peg$c251 = function(expr) {
return { "kind": "Merge", "expr": expr };
}, peg$c252 = "over", peg$c253 = peg$literalExpectation("over", false), peg$c254 = function(exprs, locals, scope) {
let over = { "kind": "Over", "exprs": exprs, "scope": scope };
if (locals) {
return { "kind": "Let", "locals": locals, "over": over };
}
return over;
}, peg$c255 = function(seq) {
return seq;
}, peg$c256 = function(first, a) {
return a;
}, peg$c257 = function(name2, opt) {
let m = { "name": name2, "expr": { "kind": "ID", "name": name2 } };
if (opt) {
m["expr"] = opt[3];
}
return m;
}, peg$c258 = "yield", peg$c259 = peg$literalExpectation("yield", false), peg$c260 = function(exprs) {
return { "kind": "Yield", "exprs": exprs };
}, peg$c261 = function(typ) {
return typ;
}, peg$c262 = function(lhs) {
return lhs;
}, peg$c263 = function(first, lval) {
return lval;
}, peg$c264 = function(first, rest) {
let result = [first];
for (let r of rest) {
result.push(r[3]);
}
return result;
}, peg$c265 = function(first, rest) {
return [first, ...rest];
}, peg$c266 = function(lhs, rhs) {
return { "kind": "Assignment", "lhs": lhs, "rhs": rhs };
}, peg$c267 = "?", peg$c268 = peg$literalExpectation("?", false), peg$c269 = function(cond, opt) {
if (opt) {
let Then = opt[3];
let Else = opt[7];
return { "kind": "Conditional", "cond": cond, "then": Then, "else": Else };
}
return cond;
}, peg$c270 = function(first, op, expr) {
return [op, expr];
}, peg$c271 = function(first, rest) {
return makeBinaryExprChain(first, rest);
}, peg$c272 = function(lhs) {
return text();
}, peg$c273 = function(lhs, opAndRHS) {
if (!opAndRHS) {
return lhs;
}
let op = opAndRHS[1];
let rhs = opAndRHS[3];
return { "kind": "BinaryExpr", "op": op, "lhs": lhs, "rhs": rhs };
}, peg$c274 = "+", peg$c275 = peg$literalExpectation("+", false), peg$c276 = "-", peg$c277 = peg$literalExpectation("-", false), peg$c278 = "/", peg$c279 = peg$literalExpectation("/", false), peg$c280 = "%", peg$c281 = peg$literalExpectation("%", false), peg$c282 = function(e) {
return { "kind": "UnaryExpr", "op": "!", "operand": e };
}, peg$c283 = function(e) {
return { "kind": "UnaryExpr", "op": "-", "operand": e };
}, peg$c284 = "not", peg$c285 = peg$literalExpectation("not", false), peg$c286 = "select", peg$c287 = peg$literalExpectation("select", false), peg$c288 = function(typ, expr) {
return { "kind": "Cast", "expr": expr, "type": typ };
}, peg$c289 = "regexp", peg$c290 = peg$literalExpectation("regexp", false), peg$c291 = function(arg0Text, arg1, where) {
let arg0 = { "kind": "Primitive", "type": "string", "text": arg0Text };
return { "kind": "Call", "name": "regexp", "args": [arg0, arg1], "where": where };
}, peg$c292 = function(fn, args, where) {
return { "kind": "Call", "name": fn, "args": args, "where": where };
}, peg$c293 = function(o) {
return [o];
}, peg$c294 = "grep", peg$c295 = peg$literalExpectation("grep", false), peg$c296 = function(pattern, opt) {
let m = { "kind": "Grep", "pattern": pattern, "expr": { "kind": "ID", "name": "this" } };
if (opt) {
m["expr"] = opt[2];
}
return m;
}, peg$c297 = function(s) {
return { "kind": "String", "text": s };
}, peg$c298 = function(first, e) {
return e;
}, peg$c299 = "]", peg$c300 = peg$literalExpectation("]", false), peg$c301 = function(from, to) {
return ["[", {
"kind": "BinaryExpr",
"op": ":",
"lhs": from,
"rhs": to
}];
}, peg$c302 = function(to) {
return ["[", {
"kind": "BinaryExpr",
"op": ":",
"lhs": null,
"rhs": to
}];
}, peg$c303 = function(expr) {
return ["[", expr];
}, peg$c304 = function(id) {
return [".", id];
}, peg$c305 = function(exprs, locals, scope) {
return { "kind": "OverExpr", "locals": locals, "exprs": exprs, "scope": scope };
}, peg$c306 = "}", peg$c307 = peg$literalExpectation("}", false), peg$c308 = function(elems) {
return { "kind": "RecordExpr", "elems": elems };
}, peg$c309 = function(elem) {
return elem;
}, peg$c310 = "...", peg$c311 = peg$literalExpectation("...", false), peg$c312 = function(expr) {
return { "kind": "Spread", "expr": expr };
}, peg$c313 = function(name2, value) {
return { "kind": "Field", "name": name2, "value": value };
}, peg$c314 = function(elems) {
return { "kind": "ArrayExpr", "elems": elems };
}, peg$c315 = "|[", peg$c316 = peg$literalExpectation("|[", false), peg$c317 = "]|", peg$c318 = peg$literalExpectation("]|", false), peg$c319 = function(elems) {
return { "kind": "SetExpr", "elems": elems };
}, peg$c320 = function(e) {
return { "kind": "VectorValue", "expr": e };
}, peg$c321 = "|{", peg$c322 = peg$literalExpectation("|{", false), peg$c323 = "}|", peg$c324 = peg$literalExpectation("}|", false), peg$c325 = function(exprs) {
return { "kind": "MapExpr", "entries": exprs };
}, peg$c326 = function(e) {
return e;
}, peg$c327 = function(key, value) {
return { "key": key, "value": value };
}, peg$c328 = function(selection, from, joins, where, groupby, having, orderby, limit) {
return {
"kind": "SQLExpr",
"select": selection,
"from": from,
"joins": joins,
"where": where,
"group_by": groupby,
"having": having,
"order_by": orderby,
"limit": limit
};
}, peg$c329 = function(assignments) {
return assignments;
}, peg$c330 = function(rhs, opt) {
let m = { "kind": "Assignment", "lhs": null, "rhs": rhs };
if (opt) {
m["lhs"] = opt[3];
}
return m;
}, peg$c331 = function(table, alias) {
return { "table": table, "alias": alias };
}, peg$c332 = function(first, join) {
return join;
}, peg$c333 = function(style, table, alias, leftKey, rightKey) {
return {
"table": table,
"style": style,
"left_key": leftKey,
"right_key": rightKey,
"alias": alias
};
}, peg$c334 = function(style) {
return style;
}, peg$c335 = function(keys, order) {
return { "kind": "SQLOrderBy", "keys": keys, "order": order };
}, peg$c336 = function(dir) {
return dir;
}, peg$c337 = function(count) {
return count;
}, peg$c338 = peg$literalExpectation("select", true), peg$c339 = function() {
return "select";
}, peg$c340 = "as", peg$c341 = peg$literalExpectation("as", true), peg$c342 = function() {
return "as";
}, peg$c343 = peg$literalExpectation("from", true), peg$c344 = function() {
return "from";
}, peg$c345 = peg$literalExpectation("join", true), peg$c346 = function() {
return "join";
}, peg$c347 = peg$literalExpectation("where", true), peg$c348 = function() {
return "where";
}, peg$c349 = "group", peg$c350 = peg$literalExpectation("group", true), peg$c351 = function() {
return "group";
}, peg$c352 = "by", peg$c353 = peg$literalExpectation("by", true), peg$c354 = function() {
return "by";
}, peg$c355 = "having", peg$c356 = peg$literalExpectation("having", true), peg$c357 = function() {
return "having";
}, peg$c358 = peg$literalExpectation("order", true), peg$c359 = function() {
return "order";
}, peg$c360 = "on", peg$c361 = peg$literalExpectation("on", true), peg$c362 = function() {
return "on";
}, peg$c363 = "limit", peg$c364 = peg$literalExpectation("limit", true), peg$c365 = function() {
return "limit";
}, peg$c366 = "asc", peg$c367 = peg$literalExpectation("asc", true), peg$c368 = "desc", peg$c369 = peg$literalExpectation("desc", true), peg$c370 = peg$literalExpectation("anti", true), peg$c371 = peg$literalExpectation("left", true), peg$c372 = peg$literalExpectation("right", true), peg$c373 = peg$literalExpectation("inner", true), peg$c374 = function(v) {
return { "kind": "Primitive", "type": "net", "text": v };
}, peg$c375 = function(v) {
return { "kind": "Primitive", "type": "ip", "text": v };
}, peg$c376 = function(v) {
return { "kind": "Primitive", "type": "float64", "text": v };
}, peg$c377 = function(v) {
return { "kind": "Primitive", "type": "int64", "text": v };
}, peg$c378 = "true", peg$c379 = peg$literalExpectation("true", false), peg$c380 = function() {
return { "kind": "Primitive", "type": "bool", "text": "true" };
}, peg$c381 = "false", peg$c382 = peg$literalExpectation("false", false), peg$c383 = function() {
return { "kind": "Primitive", "type": "bool", "text": "false" };
}, peg$c384 = "null", peg$c385 = peg$literalExpectation("null", false), peg$c386 = function() {
return { "kind": "Primitive", "type": "null", "text": "" };
}, peg$c387 = "0x", peg$c388 = peg$literalExpectation("0x", false), peg$c389 = function() {
return { "kind": "Primitive", "type": "bytes", "text": text() };
}, peg$c390 = function(typ) {
return { "kind": "TypeValue", "value": typ };
}, peg$c391 = function(name2) {
return name2;
}, peg$c392 = function(name2, opt) {
if (opt) {
return { "kind": "TypeDef", "name": name2, "type": opt[3] };
}
return { "kind": "TypeName", "name": name2 };
}, peg$c393 = function(name2) {
return { "kind": "TypeName", "name": name2 };
}, peg$c394 = function(u) {
return u;
}, peg$c395 = function(types) {
return { "kind": "TypeUnion", "types": types };
}, peg$c396 = function(typ) {
return typ;
}, peg$c397 = function(fields) {
return { "kind": "TypeRecord", "fields": fields };
}, peg$c398 = function(typ) {
return { "kind": "TypeArray", "type": typ };
}, peg$c399 = function(typ) {
return { "kind": "TypeSet", "type": typ };
}, peg$c400 = function(keyType, valType) {
return { "kind": "TypeMap", "key_type": keyType, "val_type": valType };
}, peg$c401 = function(v) {
if (v.length == 0) {
return { "kind": "Primitive", "type": "string", "text": "" };
}
return makeTemplateExprChain(v);
}, peg$c402 = '"', peg$c403 = peg$literalExpectation('"', false), peg$c404 = "'", peg$c405 = peg$literalExpectation("'", false), peg$c406 = function(v) {
return { "kind": "Primitive", "type": "string", "text": joinChars(v) };
}, peg$c407 = "\\", peg$c408 = peg$literalExpectation("\\", false), peg$c409 = "${", peg$c410 = peg$literalExpectation("${", false), peg$c411 = function(e) {
return {
"kind": "Cast",
"expr": e,
"type": {
"kind": "TypeValue",
"value": { "kind": "TypePrimitive", "name": "string" }
}
};
}, peg$c412 = "uint8", peg$c413 = peg$literalExpectation("uint8", false), peg$c414 = "uint16", peg$c415 = peg$literalExpectation("uint16", false), peg$c416 = "uint32", peg$c417 = peg$literalExpectation("uint32", false), peg$c418 = "uint64", peg$c419 = peg$literalExpectation("uint64", false), peg$c420 = "int8", peg$c421 = peg$literalExpectation("int8", false), peg$c422 = "int16", peg$c423 = peg$literalExpectation("int16", false), peg$c424 = "int32", peg$c425 = peg$literalExpectation("int32", false), peg$c426 = "int64", peg$c427 = peg$literalExpectation("int64", false), peg$c428 = "float16", peg$c429 = peg$literalExpectation("float16", false), peg$c430 = "float32", peg$c431 = peg$literalExpectation("float32", false), peg$c432 = "float64", peg$c433 = peg$literalExpectation("float64", false), peg$c434 = "bool", peg$c435 = peg$literalExpectation("bool", false), peg$c436 = "string", peg$c437 = peg$literalExpectation("string", false), peg$c438 = "duration", peg$c439 = peg$literalExpectation("duration", false), peg$c440 = "time", peg$c441 = peg$literalExpectation("time", false), peg$c442 = "bytes", peg$c443 = peg$literalExpectation("bytes", false), peg$c444 = "ip", peg$c445 = peg$literalExpectation("ip", false), peg$c446 = "net", peg$c447 = peg$literalExpectation("net", false), peg$c448 = function() {
return { "kind": "TypePrimitive", "name": text() };
}, peg$c449 = function(name2, typ) {
return { "name": name2, "type": typ };
}, peg$c450 = "and", peg$c451 = peg$literalExpectation("and", false), peg$c452 = "AND", peg$c453 = peg$literalExpectation("AND", false), peg$c454 = function() {
return "and";
}, peg$c455 = "or", peg$c456 = peg$literalExpectation("or", false), peg$c457 = "OR", peg$c458 = peg$literalExpectation("OR", false), peg$c459 = function() {
return "or";
}, peg$c460 = function() {
return "in";
}, peg$c461 = "NOT", peg$c462 = peg$literalExpectation("NOT", false), peg$c463 = function() {
return "not";
}, peg$c464 = peg$literalExpectation("by", false), peg$c465 = /^[A-Za-z_$]/, peg$c466 = peg$classExpectation([["A", "Z"], ["a", "z"], "_", "$"], false, false), peg$c467 = /^[0-9]/, peg$c468 = peg$classExpectation([["0", "9"]], false, false), peg$c469 = function(id) {
return { "kind": "ID", "name": id };
}, peg$c470 = "$", peg$c471 = peg$literalExpectation("$", false), peg$c472 = function(first, id) {
return id;
}, peg$c473 = "T", peg$c474 = peg$literalExpectation("T", false), peg$c475 = function() {
return { "kind": "Primitive", "type": "time", "text": text() };
}, peg$c476 = "Z", peg$c477 = peg$literalExpectation("Z", false), peg$c478 = function() {
return { "kind": "Primitive", "type": "duration", "text": text() };
}, peg$c479 = "ns", peg$c480 = peg$literalExpectation("ns", false), peg$c481 = "us", peg$c482 = peg$literalExpectation("us", false), peg$c483 = "ms", peg$c484 = peg$literalExpectation("ms", false), peg$c485 = "s", peg$c486 = peg$literalExpectation("s", false), peg$c487 = "m", peg$c488 = peg$literalExpectation("m", false), peg$c489 = "h", peg$c490 = peg$literalExpectation("h", false), peg$c491 = "d", peg$c492 = peg$literalExpectation("d", false), peg$c493 = "w", peg$c494 = peg$literalExpectation("w", false), peg$c495 = "y", peg$c496 = peg$literalExpectation("y", false), peg$c497 = function(a, b) {
return joinChars(a) + b;
}, peg$c498 = "::", peg$c499 = peg$literalExpectation("::", false), peg$c500 = function(a, b, d, e) {
return a + joinChars(b) + "::" + joinChars(d) + e;
}, peg$c501 = function(a, b) {
return "::" + joinChars(a) + b;
}, peg$c502 = function(a, b) {
return a + joinChars(b) + "::";
}, peg$c503 = function() {
return "::";
}, peg$c504 = function(v) {
return ":" + v;
}, peg$c505 = function(v) {
return v + ":";
}, peg$c506 = function(a, m) {
return a + "/" + m.toString();
}, peg$c507 = function(a, m) {
return a + "/" + m;
}, peg$c508 = function(s) {
return parseInt(s);
}, peg$c509 = function() {
return text();
}, peg$c510 = "e", peg$c511 = peg$literalExpectation("e", true), peg$c512 = /^[+\-]/, peg$c513 = peg$classExpectation(["+", "-"], false, false), peg$c514 = "NaN", peg$c515 = peg$literalExpectation("NaN", false), peg$c516 = "Inf", peg$c517 = peg$literalExpectation("Inf", false), peg$c518 = /^[0-9a-fA-F]/, peg$c519 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), peg$c520 = function(v) {
return joinChars(v);
}, peg$c521 = peg$anyExpectation(), peg$c522 = function(head, tail) {
return head + joinChars(tail);
}, peg$c523 = /^[a-zA-Z_.:\/%#@~]/, peg$c524 = peg$classExpectation([["a", "z"], ["A", "Z"], "_", ".", ":", "/", "%", "#", "@", "~"], false, false), peg$c525 = function(head, tail) {
return head + joinChars(tail);
}, peg$c526 = function() {
return "*";
}, peg$c527 = function() {
return "=";
}, peg$c528 = function() {
return "\\*";
}, peg$c529 = "b", peg$c530 = peg$literalExpectation("b", false), peg$c531 = function() {
return "\b";
}, peg$c532 = "f", peg$c533 = peg$literalExpectation("f", false), peg$c534 = function() {
return "\f";
}, peg$c535 = "n", peg$c536 = peg$literalExpectation("n", false), peg$c537 = function() {
return "\n";
}, peg$c538 = "r", peg$c539 = peg$literalExpectation("r", false), peg$c540 = function() {
return "\r";
}, peg$c541 = "t", peg$c542 = peg$literalExpectation("t", false), peg$c543 = function() {
return " ";
}, peg$c544 = "v", peg$c545 = peg$literalExpectation("v", false), peg$c546 = function() {
return "\v";
}, peg$c547 = function() {
return "*";
}, peg$c548 = "u", peg$c549 = peg$literalExpectation("u", false), peg$c550 = function(chars) {
return makeUnicodeChar(chars);
}, peg$c551 = /^[^\/\\]/, peg$c552 = peg$classExpectation(["/", "\\"], true, false), peg$c553 = /^[\0-\x1F\\]/, peg$c554 = peg$classExpectation([["\0", ""], "\\"], false, false), peg$c555 = peg$otherExpectation("whitespace"), peg$c556 = " ", peg$c557 = peg$literalExpectation(" ", false), peg$c558 = "\v", peg$c559 = peg$literalExpectation("\v", false), peg$c560 = "\f", peg$c561 = peg$literalExpectation("\f", false), peg$c562 = " ", peg$c563 = peg$literalExpectation(" ", false), peg$c564 = "\xA0", peg$c565 = peg$literalExpectation("\xA0", false), peg$c566 = "\uFEFF", peg$c567 = peg$literalExpectation("\uFEFF", false), peg$c568 = /^[\n\r\u2028\u2029]/, peg$c569 = peg$classExpectation(["\n", "\r", "\u2028", "\u2029"], false, false), peg$c570 = peg$otherExpectation("comment"), peg$c571 = "/*", peg$c572 = peg$literalExpectation("/*", false), peg$c573 = "*/", peg$c574 = peg$literalExpectation("*/", false), peg$c575 = "//", peg$c576 = peg$literalExpectation("//", false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) {
throw new Error(`Can't start parsing from rule "` + options.startRule + '".');
}
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location2) {
location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
location2
);
}
function error(message, location2) {
location2 = location2 !== void 0 ? location2 : peg$computeLocation(peg$savedPos, peg$currPos);
throw peg$buildSimpleError(message, location2);
}
function peg$literalExpectation(text2, ignoreCase) {
return { type: "literal", text: text2, ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return { type: "class", parts, inverted, ignoreCase };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description };
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos], p;
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {
details.column++;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
}
function peg$fail(expected2) {
if (peg$currPos < peg$maxFailPos) {
return;
}
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected2);
}
function peg$buildSimpleError(message, location2) {
return new peg$SyntaxError(message, null, null, location2);
}
function peg$buildStructuredError(expected2, found, location2) {
return new peg$SyntaxError(
peg$SyntaxError.buildMessage(expected2, found),
expected2,
found,
location2
);
}
function peg$parsestart() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parseSequential();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseEOF();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c0(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSequential() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseDecls();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseOperation();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseSequentialTail();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseSequentialTail();
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c1(s1, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSequentialTail() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parsePipe();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseOperation();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c2(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseDecls() {
var s0, s1;
s0 = [];
s1 = peg$parseDecl();
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parseDecl();
}
} else {
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3();
}
s0 = s1;
}
return s0;
}
function peg$parseDecl() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parseConstDecl();
if (s2 === peg$FAILED) {
s2 = peg$parseFuncDecl();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseConstDecl() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c5) {
s1 = peg$c5;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c6);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseIdentifierName();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s5 = peg$c7;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseConditionalExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c9(s3, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c10) {
s1 = peg$c10;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c11);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseIdentifierName();
if (s3 === peg$FAILED) {
s3 = peg$parseQuotedString();
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s5 = peg$c7;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseType();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c12(s3, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseFuncDecl() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c13) {
s1 = peg$c13;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c14);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseIdentifierName();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s5 = peg$c15;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseIdentifierNames();
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s9 = peg$c17;
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s9 !== peg$FAILED) {
s10 = peg$parse__();
if (s10 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s11 = peg$c19;
peg$currPos++;
} else {
s11 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s11 !== peg$FAILED) {
s12 = peg$parse__();
if (s12 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s13 = peg$c15;
peg$currPos++;
} else {
s13 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s13 !== peg$FAILED) {
s14 = peg$parse__();
if (s14 !== peg$FAILED) {
s15 = peg$parseConditionalExpr();
if (s15 !== peg$FAILED) {
s16 = peg$parse__();
if (s16 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s17 = peg$c17;
peg$currPos++;
} else {
s17 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s17 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c21(s3, s7, s15);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseOperation() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c22) {
s1 = peg$c22;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c23);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseLeg();
if (s5 !== peg$FAILED) {
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseLeg();
}
} else {
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s6 = peg$c17;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c24(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c25) {
s1 = peg$c25;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c26);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s5 = peg$c15;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parseSwitchLeg();
if (s7 !== peg$FAILED) {
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parseSwitchLeg();
}
} else {
s6 = peg$FAILED;
}
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s8 = peg$c17;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c27(s3, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c25) {
s1 = peg$c25;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c26);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseSwitchLeg();
if (s5 !== peg$FAILED) {
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseSwitchLeg();
}
} else {
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s6 = peg$c17;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c28(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c29) {
s1 = peg$c29;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c30);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseFromLeg();
if (s5 !== peg$FAILED) {
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseFromLeg();
}
} else {
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s6 = peg$c17;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c31(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseOperator();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseOpAssignment();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseEndOfOp();
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c32(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$currPos;
s3 = peg$parseFunction();
if (s3 !== peg$FAILED) {
s4 = peg$parseEndOfOp();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseAggregation();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parseEndOfOp();
peg$silentFails--;
if (s4 !== peg$FAILED) {
peg$currPos = s3;
s3 = void 0;
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c32(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c33) {
s1 = peg$c33;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c34);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseSearchBoolean();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c35(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseSearchBoolean();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseCast();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c37(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseConditionalExpr();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1);
}
s0 = s1;
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseEndOfOp() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parsePipe();
if (s2 === peg$FAILED) {
s2 = peg$parseSearchKeywordGuard();
if (s2 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c38) {
s2 = peg$c38;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s2 = peg$c17;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s2 === peg$FAILED) {
s2 = peg$parseEOF();
}
}
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePipe() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 124) {
s1 = peg$c40;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c41);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 123) {
s3 = peg$c42;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c43);
}
}
if (s3 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 91) {
s3 = peg$c44;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
}
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLeg() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c38) {
s2 = peg$c38;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseSequential();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c46(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSwitchLeg() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parseCase();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c38) {
s4 = peg$c38;
peg$currPos += 2;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseSequential();
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c47(s2, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseCase() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c48) {
s1 = peg$c48;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c49);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c51) {
s1 = peg$c51;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c52);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c53();
}
s0 = s1;
}
return s0;
}
function peg$parseFromLeg() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$parseFromSource();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c38) {
s5 = peg$c38;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseSequential();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c54(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFromSource() {
var s0;
s0 = peg$parseFile();
if (s0 === peg$FAILED) {
s0 = peg$parseGet();
if (s0 === peg$FAILED) {
s0 = peg$parsePool();
if (s0 === peg$FAILED) {
s0 = peg$parsePassOp();
}
}
}
return s0;
}
function peg$parseExprGuard() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c38) {
s4 = peg$c38;
peg$currPos += 2;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = void 0;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseComparator();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = peg$parseAdditiveOperator();
if (s2 === peg$FAILED) {
s2 = peg$parseMultiplicativeOperator();
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c19;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s2 = peg$c15;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 91) {
s2 = peg$c44;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
if (s2 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 126) {
s2 = peg$c55;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
}
}
}
}
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseComparator() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c57) {
s1 = peg$c57;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c58);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c59) {
s1 = peg$c59;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c60);
}
}
if (s1 === peg$FAILED) {
s1 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c61) {
s2 = peg$c61;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c62);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parseIdentifierRest();
peg$silentFails--;
if (s4 === peg$FAILED) {
s3 = void 0;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c63) {
s1 = peg$c63;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c64);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 60) {
s1 = peg$c65;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c66);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c67) {
s1 = peg$c67;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c68);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s1 = peg$c69;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c70);
}
}
}
}
}
}
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseSearchBoolean() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseSearchAnd();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseSearchOrTerm();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseSearchOrTerm();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c72(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSearchOrTerm() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseOrToken();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseSearchAnd();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c73(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSearchAnd() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseSearchFactor();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseAndToken();
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
peg$silentFails++;
s7 = peg$parseOrToken();
if (s7 === peg$FAILED) {
s7 = peg$parseSearchKeywordGuard();
}
peg$silentFails--;
if (s7 === peg$FAILED) {
s6 = void 0;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
if (s6 !== peg$FAILED) {
s7 = peg$parseSearchFactor();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c74(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseAndToken();
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
peg$silentFails++;
s7 = peg$parseOrToken();
if (s7 === peg$FAILED) {
s7 = peg$parseSearchKeywordGuard();
}
peg$silentFails--;
if (s7 === peg$FAILED) {
s6 = void 0;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
if (s6 !== peg$FAILED) {
s7 = peg$parseSearchFactor();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c74(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c75(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSearchKeywordGuard() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseFromSource();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c38) {
s3 = peg$c38;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseCase();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSearchFactor() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$currPos;
s2 = peg$parseNotToken();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 === peg$FAILED) {
s1 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 33) {
s2 = peg$c76;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c77);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s2 = [s2, s3];
s1 = s2;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseSearchFactor();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c78(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c15;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseSearchBoolean();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s5 = peg$c17;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseSearchExpr();
}
}
return s0;
}
function peg$parseSearchExpr() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$parseGlob();
if (s0 === peg$FAILED) {
s0 = peg$parseRegexp();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseSearchValue();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseExprGuard();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$currPos;
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseGlob();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c79(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c80;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseExprGuard();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c82();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseSearchPredicate();
}
}
}
}
return s0;
}
function peg$parseSearchPredicate() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseAdditiveExpr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseComparator();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAdditiveExpr();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c83(s1, s3, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseFunction();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseDeref();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseDeref();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c84(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSearchValue() {
var s0, s1, s2;
s0 = peg$parseLiteral();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseRegexpPattern();
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseKeyWord();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c85(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseGlob() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseGlobPattern();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c86(s1);
}
s0 = s1;
return s0;
}
function peg$parseRegexp() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseRegexpPattern();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c87(s1);
}
s0 = s1;
return s0;
}
function peg$parseAggregation() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseSummarize();
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseGroupByKeys();
if (s2 !== peg$FAILED) {
s3 = peg$parseLimitArg();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c88(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseSummarize();
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseAggAssignments();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseGroupByKeys();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseLimitArg();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c89(s2, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSummarize() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.substr(peg$currPos, 9) === peg$c90) {
s1 = peg$c90;
peg$currPos += 9;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c91);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseGroupByKeys() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseByToken();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseFlexAssignments();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c92(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLimitArg() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c93) {
s2 = peg$c93;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c94);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c95) {
s4 = peg$c95;
peg$currPos += 6;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c96);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseUInt();
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c97(s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c99();
}
s0 = s1;
}
return s0;
}
function peg$parseFlexAssignment() {
var s0, s1;
s0 = peg$parseAssignment();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseConditionalExpr();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c100(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseFlexAssignments() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseFlexAssignment();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseFlexAssignment();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c103(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseFlexAssignment();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c103(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAggAssignment() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseDerefExpr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c105) {
s3 = peg$c105;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c106);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAgg();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c107(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseAgg();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c108(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseAgg() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseFuncGuard();
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseAggName();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s4 = peg$c15;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseOverExpr();
if (s6 === peg$FAILED) {
s6 = peg$parseConditionalExpr();
}
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s8 = peg$c17;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$currPos;
peg$silentFails++;
s10 = peg$currPos;
s11 = peg$parse__();
if (s11 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s12 = peg$c109;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s12 !== peg$FAILED) {
s11 = [s11, s12];
s10 = s11;
} else {
peg$currPos = s10;
s10 = peg$FAILED;
}
} else {
peg$currPos = s10;
s10 = peg$FAILED;
}
peg$silentFails--;
if (s10 === peg$FAILED) {
s9 = void 0;
} else {
peg$currPos = s9;
s9 = peg$FAILED;
}
if (s9 !== peg$FAILED) {
s10 = peg$parseWhereClause();
if (s10 === peg$FAILED) {
s10 = null;
}
if (s10 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c111(s2, s6, s10);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAggName() {
var s0;
s0 = peg$parseIdentifierName();
if (s0 === peg$FAILED) {
s0 = peg$parseAndToken();
if (s0 === peg$FAILED) {
s0 = peg$parseOrToken();
}
}
return s0;
}
function peg$parseWhereClause() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c112) {
s2 = peg$c112;
peg$currPos += 5;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c113);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseLogicalOrExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAggAssignments() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseAggAssignment();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseAggAssignment();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseAggAssignment();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c114(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseOperator() {
var s0;
s0 = peg$parseAssertOp();
if (s0 === peg$FAILED) {
s0 = peg$parseSortOp();
if (s0 === peg$FAILED) {
s0 = peg$parseTopOp();
if (s0 === peg$FAILED) {
s0 = peg$parseCutOp();
if (s0 === peg$FAILED) {
s0 = peg$parseDropOp();
if (s0 === peg$FAILED) {
s0 = peg$parseHeadOp();
if (s0 === peg$FAILED) {
s0 = peg$parseTailOp();
if (s0 === peg$FAILED) {
s0 = peg$parseWhereOp();
if (s0 === peg$FAILED) {
s0 = peg$parseUniqOp();
if (s0 === peg$FAILED) {
s0 = peg$parsePutOp();
if (s0 === peg$FAILED) {
s0 = peg$parseRenameOp();
if (s0 === peg$FAILED) {
s0 = peg$parseFuseOp();
if (s0 === peg$FAILED) {
s0 = peg$parseShapeOp();
if (s0 === peg$FAILED) {
s0 = peg$parseJoinOp();
if (s0 === peg$FAILED) {
s0 = peg$parseSampleOp();
if (s0 === peg$FAILED) {
s0 = peg$parseSQLOp();
if (s0 === peg$FAILED) {
s0 = peg$parseFromOp();
if (s0 === peg$FAILED) {
s0 = peg$parsePassOp();
if (s0 === peg$FAILED) {
s0 = peg$parseExplodeOp();
if (s0 === peg$FAILED) {
s0 = peg$parseMergeOp();
if (s0 === peg$FAILED) {
s0 = peg$parseOverOp();
if (s0 === peg$FAILED) {
s0 = peg$parseYieldOp();
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseAssertOp() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c115) {
s1 = peg$c115;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c116);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parseConditionalExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c117(s4);
}
s3 = s4;
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c118(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSortOp() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c119) {
s1 = peg$c119;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c120);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseEOKW();
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseSortArgs();
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseExprs();
if (s6 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c121(s3, s6);
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c122(s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSortArgs() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = [];
s2 = peg$currPos;
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseSortArg();
if (s4 !== peg$FAILED) {
peg$savedPos = s2;
s3 = peg$c32(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$currPos;
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseSortArg();
if (s4 !== peg$FAILED) {
peg$savedPos = s2;
s3 = peg$c32(s4);
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c123(s1);
}
s0 = s1;
return s0;
}
function peg$parseSortArg() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c124) {
s1 = peg$c124;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c125);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c126();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c127) {
s1 = peg$c127;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c128);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c129) {
s4 = peg$c129;
peg$currPos += 5;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c130);
}
}
if (s4 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c131) {
s4 = peg$c131;
peg$currPos += 4;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c132);
}
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c71();
}
s3 = s4;
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c133(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseTopOp() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c134) {
s1 = peg$c134;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c135);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseEOKW();
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseUInt();
if (s5 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c136(s5);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c137) {
s6 = peg$c137;
peg$currPos += 6;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c138);
}
}
if (s6 !== peg$FAILED) {
s5 = [s5, s6];
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$currPos;
s6 = peg$parse_();
if (s6 !== peg$FAILED) {
s7 = peg$parseFieldExprs();
if (s7 !== peg$FAILED) {
peg$savedPos = s5;
s6 = peg$c139(s3, s4, s7);
s5 = s6;
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c140(s3, s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseCutOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c141) {
s1 = peg$c141;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c142);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseFlexAssignments();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c143(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseDropOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c144) {
s1 = peg$c144;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c145);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseFieldExprs();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c146(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseHeadOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c147) {
s1 = peg$c147;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c148);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseUInt();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c149(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c147) {
s1 = peg$c147;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c148);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c150();
}
s0 = s1;
}
return s0;
}
function peg$parseTailOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c151) {
s1 = peg$c151;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c152);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseUInt();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c153(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c151) {
s1 = peg$c151;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c152);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c154();
}
s0 = s1;
}
return s0;
}
function peg$parseWhereOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c112) {
s1 = peg$c112;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c113);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c155(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseUniqOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c156) {
s1 = peg$c156;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c157);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c158) {
s3 = peg$c158;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c159);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c160();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c156) {
s1 = peg$c156;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c157);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c161();
}
s0 = s1;
}
return s0;
}
function peg$parsePutOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c162) {
s1 = peg$c162;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c163);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseAssignments();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c164(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseRenameOp() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c165) {
s1 = peg$c165;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c166);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseAssignment();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$currPos;
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s7 = peg$c101;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
s9 = peg$parseAssignment();
if (s9 !== peg$FAILED) {
peg$savedPos = s5;
s6 = peg$c167(s3, s9);
s5 = s6;
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$currPos;
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s7 = peg$c101;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
s9 = peg$parseAssignment();
if (s9 !== peg$FAILED) {
peg$savedPos = s5;
s6 = peg$c167(s3, s9);
s5 = s6;
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c168(s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFuseOp() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c169) {
s1 = peg$c169;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c170);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s5 = peg$c15;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parseEOKW();
peg$silentFails--;
if (s4 !== peg$FAILED) {
peg$currPos = s3;
s3 = void 0;
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c171();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseShapeOp() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c172) {
s1 = peg$c172;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c173);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s5 = peg$c15;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
peg$silentFails++;
s4 = peg$parseEOKW();
peg$silentFails--;
if (s4 !== peg$FAILED) {
peg$currPos = s3;
s3 = void 0;
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c174();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseJoinOp() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
s0 = peg$currPos;
s1 = peg$parseJoinStyle();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c175) {
s2 = peg$c175;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c176);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseON();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseJoinKey();
if (s6 !== peg$FAILED) {
s7 = peg$currPos;
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s9 = peg$c7;
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s9 !== peg$FAILED) {
s10 = peg$parse__();
if (s10 !== peg$FAILED) {
s11 = peg$parseJoinKey();
if (s11 !== peg$FAILED) {
s8 = [s8, s9, s10, s11];
s7 = s8;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
s8 = peg$currPos;
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
s10 = peg$parseFlexAssignments();
if (s10 !== peg$FAILED) {
s9 = [s9, s10];
s8 = s9;
} else {
peg$currPos = s8;
s8 = peg$FAILED;
}
} else {
peg$currPos = s8;
s8 = peg$FAILED;
}
if (s8 === peg$FAILED) {
s8 = null;
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c177(s1, s6, s7, s8);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseJoinStyle() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c178) {
s1 = peg$c178;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c179);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c180();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c181) {
s1 = peg$c181;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c182);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c183();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c184) {
s1 = peg$c184;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c185);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c186();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c187) {
s1 = peg$c187;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c188);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c189();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c183();
}
s0 = s1;
}
}
}
}
return s0;
}
function peg$parseJoinKey() {
var s0, s1, s2, s3;
s0 = peg$parseDerefExpr();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c15;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseConditionalExpr();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s3 = peg$c17;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSampleOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c190) {
s1 = peg$c190;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c191);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseEOKW();
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseSampleExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c192(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseOpAssignment() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseAssignments();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c193(s1);
}
s0 = s1;
return s0;
}
function peg$parseSampleExpr() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseDerefExpr();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c194(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c195();
}
s0 = s1;
}
return s0;
}
function peg$parseFromOp() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseFromAny();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c196(s1);
}
s0 = s1;
return s0;
}
function peg$parseFromAny() {
var s0;
s0 = peg$parseFile();
if (s0 === peg$FAILED) {
s0 = peg$parseGet();
if (s0 === peg$FAILED) {
s0 = peg$parseFrom();
}
}
return s0;
}
function peg$parseFile() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c197) {
s1 = peg$c197;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c198);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsePath();
if (s3 !== peg$FAILED) {
s4 = peg$parseFormatArg();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseLayoutArg();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c199(s3, s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFrom() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c29) {
s1 = peg$c29;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c30);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsePoolBody();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c200(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePool() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c201) {
s1 = peg$c201;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c202);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parsePoolBody();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c200(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePoolBody() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsePoolSpec();
if (s1 !== peg$FAILED) {
s2 = peg$parsePoolAt();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c203(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseGet() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c204) {
s1 = peg$c204;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c205);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseURL();
if (s3 !== peg$FAILED) {
s4 = peg$parseFormatArg();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseLayoutArg();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c206(s3, s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseURL() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c207) {
s1 = peg$c207;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c208);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c209) {
s1 = peg$c209;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c210);
}
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parsePath();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePath() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseQuotedString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
if (peg$c211.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c212);
}
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c211.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c212);
}
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
}
return s0;
}
function peg$parsePoolAt() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c213) {
s2 = peg$c213;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c214);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseKSUID();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c215(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKSUID() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c216.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c217);
}
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c216.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c217);
}
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parsePoolSpec() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parsePoolName();
if (s1 !== peg$FAILED) {
s2 = peg$parsePoolCommit();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parsePoolMeta();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseTapArg();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c218(s1, s2, s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsePoolMeta();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c219(s1);
}
s0 = s1;
}
return s0;
}
function peg$parsePoolCommit() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 64) {
s1 = peg$c220;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c221);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parsePoolNameString();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c222(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePoolMeta() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s1 = peg$c19;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parsePoolIdentifier();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c223(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePoolName() {
var s0, s1, s2, s3;
s0 = peg$parseGlob();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c80;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseExprGuard();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c224();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseRegexp();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsePoolNameString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c225(s1);
}
s0 = s1;
}
}
}
return s0;
}
function peg$parsePoolNameString() {
var s0;
s0 = peg$parsePoolIdentifier();
if (s0 === peg$FAILED) {
s0 = peg$parseKSUID();
if (s0 === peg$FAILED) {
s0 = peg$parseQuotedString();
}
}
return s0;
}
function peg$parsePoolIdentifier() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseIdentifierStart();
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c109;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseIdentifierRest();
if (s3 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c109;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseIdentifierRest();
if (s3 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c109;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c226();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLayoutArg() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c227) {
s2 = peg$c227;
peg$currPos += 5;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c228);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseFieldExprs();
if (s4 !== peg$FAILED) {
s5 = peg$parseOrderSuffix();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c229(s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTapArg() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c230) {
s2 = peg$c230;
peg$currPos += 3;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c231);
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c232();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c233();
}
s0 = s1;
}
return s0;
}
function peg$parseFormatArg() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c234) {
s2 = peg$c234;
peg$currPos += 6;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c235);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseIdentifierName();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c236(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseOrderSuffix() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c237) {
s1 = peg$c237;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c238);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c239();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c240) {
s1 = peg$c240;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c241);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c242();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c239();
}
s0 = s1;
}
}
return s0;
}
function peg$parsePassOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c243) {
s1 = peg$c243;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c244);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseEOKW();
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c245();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseExplodeOp() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 7) === peg$c246) {
s1 = peg$c246;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c247);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseExprs();
if (s3 !== peg$FAILED) {
s4 = peg$parseTypeArg();
if (s4 !== peg$FAILED) {
s5 = peg$parseAsArg();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c248(s3, s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseMergeOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c249) {
s1 = peg$c249;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c250);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c251(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseOverOp() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c252) {
s1 = peg$c252;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c253);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseExprs();
if (s3 !== peg$FAILED) {
s4 = peg$parseLocals();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseScope();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c254(s3, s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseScope() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c38) {
s2 = peg$c38;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c39);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s4 = peg$c15;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseSequential();
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s8 = peg$c17;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c255(s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLocals() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c93) {
s2 = peg$c93;
peg$currPos += 4;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c94);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseLocalsAssignment();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$currPos;
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s8 = peg$c101;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parse__();
if (s9 !== peg$FAILED) {
s10 = peg$parseLocalsAssignment();
if (s10 !== peg$FAILED) {
peg$savedPos = s6;
s7 = peg$c256(s4, s10);
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$currPos;
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s8 = peg$c101;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parse__();
if (s9 !== peg$FAILED) {
s10 = peg$parseLocalsAssignment();
if (s10 !== peg$FAILED) {
peg$savedPos = s6;
s7 = peg$c256(s4, s10);
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLocalsAssignment() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseIdentifierName();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s4 = peg$c7;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseConditionalExpr();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c257(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseYieldOp() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c258) {
s1 = peg$c258;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c259);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseExprs();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c260(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTypeArg() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseBY();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseType();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c261(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAsArg() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseAS();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseDerefExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c262(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLvals() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseDerefExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseDerefExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c263(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseDerefExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c263(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFieldExprs() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseDerefExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseDerefExpr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseDerefExpr();
if (s7 !== peg$FAILED) {
s4 = [s4, s5, s6, s7];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c264(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAssignments() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseAssignment();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseAssignment();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c256(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseAssignment();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c256(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c265(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAssignment() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseDerefExpr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c105) {
s3 = peg$c105;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c106);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseConditionalExpr();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c266(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseExpr() {
var s0;
s0 = peg$parseConditionalExpr();
return s0;
}
function peg$parseConditionalExpr() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
s0 = peg$currPos;
s1 = peg$parseLogicalOrExpr();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 63) {
s4 = peg$c267;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c268);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseConditionalExpr();
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s8 = peg$c19;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parse__();
if (s9 !== peg$FAILED) {
s10 = peg$parseConditionalExpr();
if (s10 !== peg$FAILED) {
s3 = [s3, s4, s5, s6, s7, s8, s9, s10];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c269(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLogicalOrExpr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseLogicalAndExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseOrToken();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseLogicalAndExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseOrToken();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseLogicalAndExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c271(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseLogicalAndExpr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseComparisonExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAndToken();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseComparisonExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAndToken();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseComparisonExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c271(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseComparisonExpr() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseAdditiveExpr();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseComparator();
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseAdditiveExpr();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 126) {
s5 = peg$c55;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c56);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c272(s1);
}
s4 = s5;
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseRegexp();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c273(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAdditiveExpr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseMultiplicativeExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAdditiveOperator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseMultiplicativeExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAdditiveOperator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseMultiplicativeExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c271(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseAdditiveOperator() {
var s0, s1;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 43) {
s1 = peg$c274;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c275);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseMultiplicativeExpr() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseNotExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseMultiplicativeOperator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseNotExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseMultiplicativeOperator();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseNotExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c270(s1, s5, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c271(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseMultiplicativeOperator() {
var s0, s1;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c80;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s1 = peg$c278;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c279);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 37) {
s1 = peg$c280;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c281);
}
}
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseNotExpr() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 33) {
s1 = peg$c76;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c77);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseNotExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c282(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseNegationExpr();
}
return s0;
}
function peg$parseNegationExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseLiteral();
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 45) {
s2 = peg$c276;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseFuncExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c283(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseFuncExpr();
}
return s0;
}
function peg$parseFuncExpr() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseCast();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseDeref();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseDeref();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c72(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseFunction();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseDeref();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseDeref();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c72(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$parseDerefExpr();
if (s0 === peg$FAILED) {
s0 = peg$parsePrimary();
}
}
}
return s0;
}
function peg$parseFuncGuard() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseNotFuncs();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseNotFuncs() {
var s0;
if (input.substr(peg$currPos, 3) === peg$c284) {
s0 = peg$c284;
peg$currPos += 3;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c285);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c286) {
s0 = peg$c286;
peg$currPos += 6;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c287);
}
}
}
return s0;
}
function peg$parseCast() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseCastType();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseOverExpr();
if (s5 === peg$FAILED) {
s5 = peg$parseConditionalExpr();
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s7 = peg$c17;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c288(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFunction() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
s0 = peg$parseGrep();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c289) {
s1 = peg$c289;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c290);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseRegexpPattern();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s7 = peg$c101;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
s9 = peg$parseConditionalExpr();
if (s9 !== peg$FAILED) {
s10 = peg$parse__();
if (s10 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s11 = peg$c17;
peg$currPos++;
} else {
s11 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s11 !== peg$FAILED) {
s12 = peg$parseWhereClause();
if (s12 === peg$FAILED) {
s12 = null;
}
if (s12 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c291(s5, s9, s12);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseFuncGuard();
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIdentifierName();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s4 = peg$c15;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseFunctionArgs();
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s8 = peg$c17;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parseWhereClause();
if (s9 === peg$FAILED) {
s9 = null;
}
if (s9 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c292(s2, s6, s9);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
return s0;
}
function peg$parseFunctionArgs() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseOverExpr();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c293(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$parseOptionalExprs();
}
return s0;
}
function peg$parseGrep() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c294) {
s1 = peg$c294;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c295);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s3 = peg$c15;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parsePattern();
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 44) {
s8 = peg$c101;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s8 !== peg$FAILED) {
s9 = peg$parse__();
if (s9 !== peg$FAILED) {
s10 = peg$parseOverExpr();
if (s10 === peg$FAILED) {
s10 = peg$parseConditionalExpr();
}
if (s10 !== peg$FAILED) {
s11 = peg$parse__();
if (s11 !== peg$FAILED) {
s8 = [s8, s9, s10, s11];
s7 = s8;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s8 = peg$c17;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c296(s5, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePattern() {
var s0, s1;
s0 = peg$parseRegexp();
if (s0 === peg$FAILED) {
s0 = peg$parseGlob();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseQuotedString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c297(s1);
}
s0 = s1;
}
}
return s0;
}
function peg$parseOptionalExprs() {
var s0, s1;
s0 = peg$parseExprs();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3();
}
s0 = s1;
}
return s0;
}
function peg$parseExprs() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseConditionalExpr();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseConditionalExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c298(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseConditionalExpr();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c298(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseDerefExpr() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseIP6();
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIdentifier();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parseDeref();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parseDeref();
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c72(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseDeref() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c44;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseAdditiveExpr();
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c19;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseAdditiveExpr();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s7 = peg$c299;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c300);
}
}
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c301(s2, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c44;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s3 = peg$c19;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseAdditiveExpr();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s6 = peg$c299;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c300);
}
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c302(s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c44;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseConditionalExpr();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s3 = peg$c299;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c300);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c303(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s1 = peg$c109;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIdentifier();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c304(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
return s0;
}
function peg$parsePrimary() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$parseRecord();
if (s0 === peg$FAILED) {
s0 = peg$parseArray();
if (s0 === peg$FAILED) {
s0 = peg$parseSet();
if (s0 === peg$FAILED) {
s0 = peg$parseMap();
if (s0 === peg$FAILED) {
s0 = peg$parseLiteral();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c15;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseOverExpr();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s5 = peg$c17;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c15;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s5 = peg$c17;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
}
}
}
return s0;
}
function peg$parseOverExpr() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c252) {
s1 = peg$c252;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c253);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseExprs();
if (s3 !== peg$FAILED) {
s4 = peg$parseLocals();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 124) {
s6 = peg$c40;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c41);
}
}
if (s6 !== peg$FAILED) {
s7 = peg$parse__();
if (s7 !== peg$FAILED) {
s8 = peg$parseSequential();
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c305(s3, s4, s8);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseRecord() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c42;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c43);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseRecordElems();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 125) {
s5 = peg$c306;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c307);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c308(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseRecordElems() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseRecordElem();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseRecordElemTail();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseRecordElemTail();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c265(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3();
}
s0 = s1;
}
return s0;
}
function peg$parseRecordElemTail() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c101;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseRecordElem();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c309(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseRecordElem() {
var s0;
s0 = peg$parseSpread();
if (s0 === peg$FAILED) {
s0 = peg$parseField();
if (s0 === peg$FAILED) {
s0 = peg$parseIdentifier();
}
}
return s0;
}
function peg$parseSpread() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c310) {
s1 = peg$c310;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c311);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c312(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseField() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseFieldName();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s3 = peg$c19;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseConditionalExpr();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c313(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseArray() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c44;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseVectorElems();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s5 = peg$c299;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c300);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c314(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSet() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c315) {
s1 = peg$c315;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c316);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseVectorElems();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c317) {
s5 = peg$c317;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c318);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c319(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseVectorElems() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseVectorElem();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseVectorElem();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c298(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseVectorElem();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c298(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3();
}
s0 = s1;
}
return s0;
}
function peg$parseVectorElem() {
var s0, s1;
s0 = peg$parseSpread();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseConditionalExpr();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c320(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseMap() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c321) {
s1 = peg$c321;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c322);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseEntries();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c323) {
s5 = peg$c323;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c324);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c325(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseEntries() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseEntry();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseEntryTail();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseEntryTail();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c265(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3();
}
s0 = s1;
}
return s0;
}
function peg$parseEntryTail() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c101;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseEntry();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c326(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseEntry() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseConditionalExpr();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s3 = peg$c19;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseConditionalExpr();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c327(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLOp() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
s0 = peg$currPos;
s1 = peg$parseSQLSelect();
if (s1 !== peg$FAILED) {
s2 = peg$parseSQLFrom();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseSQLJoins();
if (s3 === peg$FAILED) {
s3 = null;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseSQLWhere();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseSQLGroupBy();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseSQLHaving();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
s7 = peg$parseSQLOrderBy();
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
s8 = peg$parseSQLLimit();
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c328(s1, s2, s3, s4, s5, s6, s7, s8);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLSelect() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseSELECT();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 42) {
s3 = peg$c80;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c53();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseSELECT();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseSQLAssignments();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c329(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSQLAssignment() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseConditionalExpr();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseAS();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseDerefExpr();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c330(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLAssignments() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseSQLAssignment();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseSQLAssignment();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c103(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseSQLAssignment();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c103(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLFrom() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseFROM();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseConditionalExpr();
if (s4 !== peg$FAILED) {
s5 = peg$parseSQLAlias();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c331(s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseFROM();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 42) {
s4 = peg$c80;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c53();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSQLAlias() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseAS();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseDerefExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c215(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$currPos;
s4 = peg$parseSQLTokenSentinels();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseDerefExpr();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c215(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseSQLJoins() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseSQLJoin();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parseSQLJoin();
if (s4 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c332(s1, s4);
}
s3 = s4;
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parseSQLJoin();
if (s4 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c332(s1, s4);
}
s3 = s4;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c104(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLJoin() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
s0 = peg$currPos;
s1 = peg$parseSQLJoinStyle();
if (s1 !== peg$FAILED) {
s2 = peg$parse_();
if (s2 !== peg$FAILED) {
s3 = peg$parseJOIN();
if (s3 !== peg$FAILED) {
s4 = peg$parse_();
if (s4 !== peg$FAILED) {
s5 = peg$parseConditionalExpr();
if (s5 !== peg$FAILED) {
s6 = peg$parseSQLAlias();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
s7 = peg$parse_();
if (s7 !== peg$FAILED) {
s8 = peg$parseON();
if (s8 !== peg$FAILED) {
s9 = peg$parse_();
if (s9 !== peg$FAILED) {
s10 = peg$parseJoinKey();
if (s10 !== peg$FAILED) {
s11 = peg$parse__();
if (s11 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s12 = peg$c7;
peg$currPos++;
} else {
s12 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s12 !== peg$FAILED) {
s13 = peg$parse__();
if (s13 !== peg$FAILED) {
s14 = peg$parseJoinKey();
if (s14 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c333(s1, s5, s6, s10, s14);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLJoinStyle() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseANTI();
if (s2 === peg$FAILED) {
s2 = peg$parseINNER();
if (s2 === peg$FAILED) {
s2 = peg$parseLEFT();
if (s2 === peg$FAILED) {
s2 = peg$parseRIGHT();
}
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c334(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c183();
}
s0 = s1;
}
return s0;
}
function peg$parseSQLWhere() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseWHERE();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseLogicalOrExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLGroupBy() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseGROUP();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseBY();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseFieldExprs();
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c92(s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLHaving() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseHAVING();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseLogicalOrExpr();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLOrderBy() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseORDER();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseBY();
if (s4 !== peg$FAILED) {
s5 = peg$parse_();
if (s5 !== peg$FAILED) {
s6 = peg$parseExprs();
if (s6 !== peg$FAILED) {
s7 = peg$parseSQLOrder();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c335(s6, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSQLOrder() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseASC();
if (s2 === peg$FAILED) {
s2 = peg$parseDESC();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c336(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c239();
}
s0 = s1;
}
return s0;
}
function peg$parseSQLLimit() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse_();
if (s1 !== peg$FAILED) {
s2 = peg$parseLIMIT();
if (s2 !== peg$FAILED) {
s3 = peg$parse_();
if (s3 !== peg$FAILED) {
s4 = peg$parseUInt();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c337(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c99();
}
s0 = s1;
}
return s0;
}
function peg$parseSELECT() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c286) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c338);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c339();
}
s0 = s1;
return s0;
}
function peg$parseAS() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c340) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c341);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c342();
}
s0 = s1;
return s0;
}
function peg$parseFROM() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c29) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c343);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c344();
}
s0 = s1;
return s0;
}
function peg$parseJOIN() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c175) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c345);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c346();
}
s0 = s1;
return s0;
}
function peg$parseWHERE() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c112) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c347);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c348();
}
s0 = s1;
return s0;
}
function peg$parseGROUP() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c349) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c350);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c351();
}
s0 = s1;
return s0;
}
function peg$parseBY() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c352) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c353);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c354();
}
s0 = s1;
return s0;
}
function peg$parseHAVING() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6).toLowerCase() === peg$c355) {
s1 = input.substr(peg$currPos, 6);
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c356);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c357();
}
s0 = s1;
return s0;
}
function peg$parseORDER() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c227) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c358);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c359();
}
s0 = s1;
return s0;
}
function peg$parseON() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2).toLowerCase() === peg$c360) {
s1 = input.substr(peg$currPos, 2);
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c361);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c362();
}
s0 = s1;
return s0;
}
function peg$parseLIMIT() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c363) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c364);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c365();
}
s0 = s1;
return s0;
}
function peg$parseASC() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3).toLowerCase() === peg$c366) {
s1 = input.substr(peg$currPos, 3);
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c367);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c239();
}
s0 = s1;
return s0;
}
function peg$parseDESC() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c368) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c369);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c242();
}
s0 = s1;
return s0;
}
function peg$parseANTI() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c178) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c370);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c180();
}
s0 = s1;
return s0;
}
function peg$parseLEFT() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4).toLowerCase() === peg$c184) {
s1 = input.substr(peg$currPos, 4);
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c371);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c186();
}
s0 = s1;
return s0;
}
function peg$parseRIGHT() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c187) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c372);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c189();
}
s0 = s1;
return s0;
}
function peg$parseINNER() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c181) {
s1 = input.substr(peg$currPos, 5);
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c373);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c183();
}
s0 = s1;
return s0;
}
function peg$parseSQLTokenSentinels() {
var s0;
s0 = peg$parseSELECT();
if (s0 === peg$FAILED) {
s0 = peg$parseAS();
if (s0 === peg$FAILED) {
s0 = peg$parseFROM();
if (s0 === peg$FAILED) {
s0 = peg$parseJOIN();
if (s0 === peg$FAILED) {
s0 = peg$parseWHERE();
if (s0 === peg$FAILED) {
s0 = peg$parseGROUP();
if (s0 === peg$FAILED) {
s0 = peg$parseHAVING();
if (s0 === peg$FAILED) {
s0 = peg$parseORDER();
if (s0 === peg$FAILED) {
s0 = peg$parseLIMIT();
if (s0 === peg$FAILED) {
s0 = peg$parseON();
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseLiteral() {
var s0;
s0 = peg$parseTypeLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseTemplateLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseSubnetLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseAddressLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseBytesLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseDuration();
if (s0 === peg$FAILED) {
s0 = peg$parseTime();
if (s0 === peg$FAILED) {
s0 = peg$parseFloatLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseIntegerLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseBooleanLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseNullLiteral();
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseSubnetLiteral() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseIP6Net();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c374(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseIP4Net();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c374(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseAddressLiteral() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseIP6();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c375(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseIP();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c375(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseFloatLiteral() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseFloatString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c376(s1);
}
s0 = s1;
return s0;
}
function peg$parseIntegerLiteral() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseIntString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c377(s1);
}
s0 = s1;
return s0;
}
function peg$parseBooleanLiteral() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c378) {
s1 = peg$c378;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c379);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c380();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c381) {
s1 = peg$c381;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c382);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c383();
}
s0 = s1;
}
return s0;
}
function peg$parseNullLiteral() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c384) {
s1 = peg$c384;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c385);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c386();
}
s0 = s1;
return s0;
}
function peg$parseBytesLiteral() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c387) {
s1 = peg$c387;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c388);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseHexDigit();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseHexDigit();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c389();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTypeLiteral() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 60) {
s1 = peg$c65;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c66);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseType();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 62) {
s3 = peg$c69;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c70);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c390(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseCastType() {
var s0, s1;
s0 = peg$parseTypeLiteral();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsePrimitiveType();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c390(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseType() {
var s0;
s0 = peg$parseTypeLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseAmbiguousType();
if (s0 === peg$FAILED) {
s0 = peg$parseComplexType();
}
}
return s0;
}
function peg$parseAmbiguousType() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parsePrimitiveType();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c391(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseIdentifierName();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 61) {
s4 = peg$c7;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parse__();
if (s5 !== peg$FAILED) {
s6 = peg$parseType();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c392(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseQuotedString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c393(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c15;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseTypeUnion();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 41) {
s4 = peg$c17;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c18);
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c394(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
return s0;
}
function peg$parseTypeUnion() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseTypeList();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c395(s1);
}
s0 = s1;
return s0;
}
function peg$parseTypeList() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseType();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseTypeListTail();
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseTypeListTail();
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c265(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTypeListTail() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c101;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseType();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c396(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseComplexType() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 123) {
s1 = peg$c42;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c43);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseTypeFieldList();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 125) {
s5 = peg$c306;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c307);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c397(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 91) {
s1 = peg$c44;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c45);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseType();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s5 = peg$c299;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c300);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c398(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c315) {
s1 = peg$c315;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c316);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseType();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c317) {
s5 = peg$c317;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c318);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c399(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c321) {
s1 = peg$c321;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c322);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseType();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s5 = peg$c19;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseType();
if (s7 !== peg$FAILED) {
s8 = peg$parse__();
if (s8 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c323) {
s9 = peg$c323;
peg$currPos += 2;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c324);
}
}
if (s9 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c400(s3, s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
return s0;
}
function peg$parseTemplateLiteral() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseTemplateLiteralParts();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c401(s1);
}
s0 = s1;
return s0;
}
function peg$parseTemplateLiteralParts() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c402;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c403);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseTemplateDoubleQuotedPart();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseTemplateDoubleQuotedPart();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c402;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c403);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c404;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c405);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseTemplateSingleQuotedPart();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseTemplateSingleQuotedPart();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c404;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c405);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseTemplateDoubleQuotedPart() {
var s0, s1, s2;
s0 = peg$parseTemplateExpr();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parseTemplateDoubleQuotedChar();
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseTemplateDoubleQuotedChar();
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c406(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseTemplateDoubleQuotedChar() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c409) {
s2 = peg$c409;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c410);
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c409) {
s2 = peg$c409;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c410);
}
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseDoubleQuotedChar();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseTemplateSingleQuotedPart() {
var s0, s1, s2;
s0 = peg$parseTemplateExpr();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parseTemplateSingleQuotedChar();
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseTemplateSingleQuotedChar();
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c406(s1);
}
s0 = s1;
}
return s0;
}
function peg$parseTemplateSingleQuotedChar() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c409) {
s2 = peg$c409;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c410);
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c409) {
s2 = peg$c409;
peg$currPos += 2;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c410);
}
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseSingleQuotedChar();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseTemplateExpr() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c409) {
s1 = peg$c409;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c410);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
s3 = peg$parseConditionalExpr();
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 125) {
s5 = peg$c306;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c307);
}
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c411(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePrimitiveType() {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c412) {
s1 = peg$c412;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c413);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c414) {
s1 = peg$c414;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c415);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c416) {
s1 = peg$c416;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c417);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c418) {
s1 = peg$c418;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c419);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c420) {
s1 = peg$c420;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c421);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c422) {
s1 = peg$c422;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c423);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c424) {
s1 = peg$c424;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c425);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c426) {
s1 = peg$c426;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c427);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c428) {
s1 = peg$c428;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c429);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c430) {
s1 = peg$c430;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c431);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c432) {
s1 = peg$c432;
peg$currPos += 7;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c433);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c434) {
s1 = peg$c434;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c435);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 6) === peg$c436) {
s1 = peg$c436;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c437);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 8) === peg$c438) {
s1 = peg$c438;
peg$currPos += 8;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c439);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c440) {
s1 = peg$c440;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c441);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c442) {
s1 = peg$c442;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c443);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c444) {
s1 = peg$c444;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c445);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c446) {
s1 = peg$c446;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c447);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c10) {
s1 = peg$c10;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c11);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 4) === peg$c384) {
s1 = peg$c384;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c385);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c448();
}
s0 = s1;
return s0;
}
function peg$parseTypeFieldList() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseTypeField();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseTypeFieldListTail();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseTypeFieldListTail();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c265(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$c98;
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c53();
}
s0 = s1;
}
return s0;
}
function peg$parseTypeFieldListTail() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parse__();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s2 = peg$c101;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parse__();
if (s3 !== peg$FAILED) {
s4 = peg$parseTypeField();
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c396(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTypeField() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseFieldName();
if (s1 !== peg$FAILED) {
s2 = peg$parse__();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s3 = peg$c19;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
s5 = peg$parseType();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c449(s1, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFieldName() {
var s0;
s0 = peg$parseIdentifierName();
if (s0 === peg$FAILED) {
s0 = peg$parseQuotedString();
}
return s0;
}
function peg$parseAndToken() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c450) {
s1 = peg$c450;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c451);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c452) {
s1 = peg$c452;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c453);
}
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c454();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseOrToken() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c455) {
s1 = peg$c455;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c456);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c457) {
s1 = peg$c457;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c458);
}
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c459();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseInToken() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c61) {
s1 = peg$c61;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c62);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c460();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseNotToken() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c284) {
s1 = peg$c284;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c285);
}
}
if (s1 === peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c461) {
s1 = peg$c461;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c462);
}
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c463();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseByToken() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c352) {
s1 = peg$c352;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c464);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseIdentifierRest();
peg$silentFails--;
if (s3 === peg$FAILED) {
s2 = void 0;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c354();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIdentifierStart() {
var s0;
if (peg$c465.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c466);
}
}
return s0;
}
function peg$parseIdentifierRest() {
var s0;
s0 = peg$parseIdentifierStart();
if (s0 === peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
return s0;
}
function peg$parseIdentifier() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseIdentifierName();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c469(s1);
}
s0 = s1;
return s0;
}
function peg$parseIdentifierName() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$currPos;
s3 = peg$parseIDGuard();
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
peg$silentFails++;
s5 = peg$parseIdentifierRest();
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = void 0;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIdentifierStart();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parseIdentifierRest();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parseIdentifierRest();
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c226();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 36) {
s1 = peg$c470;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c471);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIDGuard();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c215(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c10) {
s1 = peg$c10;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c11);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseSQLTokenSentinels();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 40) {
s5 = peg$c15;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c16);
}
}
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c215(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
}
}
}
return s0;
}
function peg$parseIdentifierNames() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseIdentifierName();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseIdentifierName();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c472(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parse__();
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c101;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c102);
}
}
if (s5 !== peg$FAILED) {
s6 = peg$parse__();
if (s6 !== peg$FAILED) {
s7 = peg$parseIdentifierName();
if (s7 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c472(s1, s7);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c265(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIDGuard() {
var s0;
s0 = peg$parseBooleanLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseNullLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseNaN();
if (s0 === peg$FAILED) {
s0 = peg$parseInfinity();
}
}
}
return s0;
}
function peg$parseTime() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseFullDate();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 84) {
s2 = peg$c473;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c474);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseFullTime();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c475();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFullDate() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$parseD4();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 45) {
s2 = peg$c276;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseD2();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 45) {
s4 = peg$c276;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parseD2();
if (s5 !== peg$FAILED) {
s1 = [s1, s2, s3, s4, s5];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseD4() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
if (peg$c467.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s1 !== peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s2 !== peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s3 !== peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s4 !== peg$FAILED) {
s1 = [s1, s2, s3, s4];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseD2() {
var s0, s1, s2;
s0 = peg$currPos;
if (peg$c467.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s1 !== peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFullTime() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsePartialTime();
if (s1 !== peg$FAILED) {
s2 = peg$parseTimeOffset();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsePartialTime() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
s1 = peg$parseD2();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c19;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseD2();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c19;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parseD2();
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s7 = peg$c109;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s7 !== peg$FAILED) {
s8 = [];
if (peg$c467.test(input.charAt(peg$currPos))) {
s9 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s9 !== peg$FAILED) {
while (s9 !== peg$FAILED) {
s8.push(s9);
if (peg$c467.test(input.charAt(peg$currPos))) {
s9 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s9 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
} else {
s8 = peg$FAILED;
}
if (s8 !== peg$FAILED) {
s7 = [s7, s8];
s6 = s7;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
s1 = [s1, s2, s3, s4, s5, s6];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTimeOffset() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
if (input.charCodeAt(peg$currPos) === 90) {
s0 = peg$c476;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c477);
}
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 43) {
s1 = peg$c274;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c275);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseD2();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s3 = peg$c19;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parseD2();
if (s4 !== peg$FAILED) {
s5 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s6 = peg$c109;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s6 !== peg$FAILED) {
s7 = [];
if (peg$c467.test(input.charAt(peg$currPos))) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s8 !== peg$FAILED) {
while (s8 !== peg$FAILED) {
s7.push(s8);
if (peg$c467.test(input.charAt(peg$currPos))) {
s8 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
} else {
s7 = peg$FAILED;
}
if (s7 !== peg$FAILED) {
s6 = [s6, s7];
s5 = s6;
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
} else {
peg$currPos = s5;
s5 = peg$FAILED;
}
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
s1 = [s1, s2, s3, s4, s5];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseDuration() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$parseDecimal();
if (s4 !== peg$FAILED) {
s5 = peg$parseTimeUnit();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$parseDecimal();
if (s4 !== peg$FAILED) {
s5 = peg$parseTimeUnit();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c478();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseDecimal() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = peg$parseUInt();
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c109;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$parseUInt();
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseTimeUnit() {
var s0;
if (input.substr(peg$currPos, 2) === peg$c479) {
s0 = peg$c479;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c480);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c481) {
s0 = peg$c481;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c482);
}
}
if (s0 === peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c483) {
s0 = peg$c483;
peg$currPos += 2;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c484);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 115) {
s0 = peg$c485;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c486);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 109) {
s0 = peg$c487;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c488);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 104) {
s0 = peg$c489;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c490);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 100) {
s0 = peg$c491;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c492);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 119) {
s0 = peg$c493;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c494);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 121) {
s0 = peg$c495;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c496);
}
}
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseIP() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$parseUInt();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s2 = peg$c109;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseUInt();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s4 = peg$c109;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parseUInt();
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s6 = peg$c109;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s6 !== peg$FAILED) {
s7 = peg$parseUInt();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIP6() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$currPos;
s3 = peg$parseHex();
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s4 = peg$c19;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parseHex();
if (s5 !== peg$FAILED) {
s6 = peg$currPos;
peg$silentFails++;
s7 = peg$parseHexDigit();
if (s7 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s7 = peg$c19;
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
}
peg$silentFails--;
if (s7 === peg$FAILED) {
s6 = void 0;
} else {
peg$currPos = s6;
s6 = peg$FAILED;
}
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIP6Variations();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c4(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIP6Variations() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseHexColon();
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseHexColon();
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseIP6Tail();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c497(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseHex();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseColonHex();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseColonHex();
}
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c498) {
s3 = peg$c498;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c499);
}
}
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseHexColon();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseHexColon();
}
if (s4 !== peg$FAILED) {
s5 = peg$parseIP6Tail();
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c500(s1, s2, s4, s5);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c498) {
s1 = peg$c498;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c499);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseHexColon();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseHexColon();
}
if (s2 !== peg$FAILED) {
s3 = peg$parseIP6Tail();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c501(s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseHex();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseColonHex();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseColonHex();
}
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c498) {
s3 = peg$c498;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c499);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c502(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c498) {
s1 = peg$c498;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c499);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c503();
}
s0 = s1;
}
}
}
}
return s0;
}
function peg$parseIP6Tail() {
var s0;
s0 = peg$parseIP();
if (s0 === peg$FAILED) {
s0 = peg$parseHex();
}
return s0;
}
function peg$parseColonHex() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 58) {
s1 = peg$c19;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseHex();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c504(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseHexColon() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parseHex();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s2 = peg$c19;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c20);
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c505(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIP4Net() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseIP();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s2 = peg$c278;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c279);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseUInt();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c506(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIP6Net() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseIP6();
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s2 = peg$c278;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c279);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$parseUInt();
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c507(s1, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseUInt() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parseUIntString();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c508(s1);
}
s0 = s1;
return s0;
}
function peg$parseIntString() {
var s0;
s0 = peg$parseUIntString();
if (s0 === peg$FAILED) {
s0 = peg$parseMinusIntString();
}
return s0;
}
function peg$parseUIntString() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
if (peg$c467.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c467.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseMinusIntString() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseUIntString();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseFloatString() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c467.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s3 !== peg$FAILED) {
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c467.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c109;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s3 !== peg$FAILED) {
s4 = [];
if (peg$c467.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
while (s5 !== peg$FAILED) {
s4.push(s5);
if (peg$c467.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
if (s4 !== peg$FAILED) {
s5 = peg$parseExponentPart();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c509();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s2 = peg$c109;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c110);
}
}
if (s2 !== peg$FAILED) {
s3 = [];
if (peg$c467.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
if (s4 !== peg$FAILED) {
while (s4 !== peg$FAILED) {
s3.push(s4);
if (peg$c467.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
} else {
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
s4 = peg$parseExponentPart();
if (s4 === peg$FAILED) {
s4 = null;
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c509();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseNaN();
if (s1 === peg$FAILED) {
s1 = peg$parseInfinity();
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
}
}
return s0;
}
function peg$parseExponentPart() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 1).toLowerCase() === peg$c510) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c511);
}
}
if (s1 !== peg$FAILED) {
if (peg$c512.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c513);
}
}
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseUIntString();
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseNaN() {
var s0;
if (input.substr(peg$currPos, 3) === peg$c514) {
s0 = peg$c514;
peg$currPos += 3;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c515);
}
}
return s0;
}
function peg$parseInfinity() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 45) {
s1 = peg$c276;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c277);
}
}
if (s1 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 43) {
s1 = peg$c274;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c275);
}
}
}
if (s1 === peg$FAILED) {
s1 = null;
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 3) === peg$c516) {
s2 = peg$c516;
peg$currPos += 3;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c517);
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseHex() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseHexDigit();
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseHexDigit();
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseHexDigit() {
var s0;
if (peg$c518.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c519);
}
}
return s0;
}
function peg$parseQuotedString() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c402;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c403);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseDoubleQuotedChar();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseDoubleQuotedChar();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 34) {
s3 = peg$c402;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c403);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c520(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 39) {
s1 = peg$c404;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c405);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseSingleQuotedChar();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseSingleQuotedChar();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 39) {
s3 = peg$c404;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c405);
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c520(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseDoubleQuotedChar() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 34) {
s2 = peg$c402;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c403);
}
}
if (s2 === peg$FAILED) {
s2 = peg$parseEscapedChar();
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
if (input.length > peg$currPos) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c521);
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseEscapeSequence();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c46(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseKeyWord() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = peg$parseKeyWordStart();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseKeyWordRest();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseKeyWordRest();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c522(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseKeyWordStart() {
var s0;
s0 = peg$parseKeyWordChars();
if (s0 === peg$FAILED) {
s0 = peg$parseKeyWordEsc();
}
return s0;
}
function peg$parseKeyWordChars() {
var s0, s1;
s0 = peg$currPos;
if (peg$c523.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c524);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseKeyWordRest() {
var s0;
s0 = peg$parseKeyWordStart();
if (s0 === peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
return s0;
}
function peg$parseKeyWordEsc() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseKeywordEscape();
if (s2 === peg$FAILED) {
s2 = peg$parseEscapeSequence();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c46(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseGlobPattern() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
s2 = peg$parseGlobProperStart();
peg$silentFails--;
if (s2 !== peg$FAILED) {
peg$currPos = s1;
s1 = void 0;
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
peg$silentFails++;
s3 = peg$parseGlobHasStar();
peg$silentFails--;
if (s3 !== peg$FAILED) {
peg$currPos = s2;
s2 = void 0;
} else {
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
s3 = peg$parseGlobStart();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseGlobRest();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseGlobRest();
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c525(s3, s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseGlobProperStart() {
var s0, s1, s2;
s0 = peg$parseKeyWordStart();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
if (input.charCodeAt(peg$currPos) === 42) {
s2 = peg$c80;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (input.charCodeAt(peg$currPos) === 42) {
s2 = peg$c80;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
s2 = peg$parseKeyWordRest();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseGlobHasStar() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseKeyWordRest();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseKeyWordRest();
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 42) {
s2 = peg$c80;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseGlobStart() {
var s0, s1;
s0 = peg$parseKeyWordChars();
if (s0 === peg$FAILED) {
s0 = peg$parseGlobEsc();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c80;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c526();
}
s0 = s1;
}
}
return s0;
}
function peg$parseGlobRest() {
var s0;
s0 = peg$parseGlobStart();
if (s0 === peg$FAILED) {
if (peg$c467.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c468);
}
}
}
return s0;
}
function peg$parseGlobEsc() {
var s0, s1, s2;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseGlobEscape();
if (s2 === peg$FAILED) {
s2 = peg$parseEscapeSequence();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c46(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseGlobEscape() {
var s0, s1;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 61) {
s1 = peg$c7;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c527();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c80;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c528();
}
s0 = s1;
if (s0 === peg$FAILED) {
if (peg$c512.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c513);
}
}
}
}
return s0;
}
function peg$parseSingleQuotedChar() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$currPos;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 39) {
s2 = peg$c404;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c405);
}
}
if (s2 === peg$FAILED) {
s2 = peg$parseEscapedChar();
}
peg$silentFails--;
if (s2 === peg$FAILED) {
s1 = void 0;
} else {
peg$currPos = s1;
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
if (input.length > peg$currPos) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c521);
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s1 = peg$c407;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseEscapeSequence();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c46(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseEscapeSequence() {
var s0;
s0 = peg$parseSingleCharEscape();
if (s0 === peg$FAILED) {
s0 = peg$parseUnicodeEscape();
}
return s0;
}
function peg$parseSingleCharEscape() {
var s0, s1;
if (input.charCodeAt(peg$currPos) === 39) {
s0 = peg$c404;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c405);
}
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 34) {
s1 = peg$c402;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c403);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 92) {
s0 = peg$c407;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 98) {
s1 = peg$c529;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c530);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c531();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 102) {
s1 = peg$c532;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c533);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c534();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 110) {
s1 = peg$c535;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c536);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c537();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 114) {
s1 = peg$c538;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c539);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c540();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 116) {
s1 = peg$c541;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c542);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c543();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 118) {
s1 = peg$c544;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c545);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c546();
}
s0 = s1;
}
}
}
}
}
}
}
}
return s0;
}
function peg$parseKeywordEscape() {
var s0, s1;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 61) {
s1 = peg$c7;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c8);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c527();
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c80;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c81);
}
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c547();
}
s0 = s1;
if (s0 === peg$FAILED) {
if (peg$c512.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c513);
}
}
}
}
return s0;
}
function peg$parseUnicodeEscape() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 117) {
s1 = peg$c548;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c549);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$currPos;
s3 = peg$parseHexDigit();
if (s3 !== peg$FAILED) {
s4 = peg$parseHexDigit();
if (s4 !== peg$FAILED) {
s5 = peg$parseHexDigit();
if (s5 !== peg$FAILED) {
s6 = peg$parseHexDigit();
if (s6 !== peg$FAILED) {
s3 = [s3, s4, s5, s6];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c550(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 117) {
s1 = peg$c548;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c549);
}
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 123) {
s2 = peg$c42;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c43);
}
}
if (s2 !== peg$FAILED) {
s3 = peg$currPos;
s4 = peg$parseHexDigit();
if (s4 !== peg$FAILED) {
s5 = peg$parseHexDigit();
if (s5 === peg$FAILED) {
s5 = null;
}
if (s5 !== peg$FAILED) {
s6 = peg$parseHexDigit();
if (s6 === peg$FAILED) {
s6 = null;
}
if (s6 !== peg$FAILED) {
s7 = peg$parseHexDigit();
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
s8 = peg$parseHexDigit();
if (s8 === peg$FAILED) {
s8 = null;
}
if (s8 !== peg$FAILED) {
s9 = peg$parseHexDigit();
if (s9 === peg$FAILED) {
s9 = null;
}
if (s9 !== peg$FAILED) {
s4 = [s4, s5, s6, s7, s8, s9];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
if (s3 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 125) {
s4 = peg$c306;
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c307);
}
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c550(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseRegexpPattern() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 47) {
s1 = peg$c278;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c279);
}
}
if (s1 !== peg$FAILED) {
s2 = peg$parseRegexpBody();
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 47) {
s3 = peg$c278;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c279);
}
}
if (s3 !== peg$FAILED) {
s4 = peg$currPos;
peg$silentFails++;
s5 = peg$parseKeyWordStart();
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = void 0;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c200(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseRegexpBody() {
var s0, s1, s2, s3, s4;
s0 = peg$currPos;
s1 = [];
if (peg$c551.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c552);
}
}
if (s2 === peg$FAILED) {
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s3 = peg$c407;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s3 !== peg$FAILED) {
if (input.length > peg$currPos) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c521);
}
}
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
while (s2 !== peg$FAILED) {
s1.push(s2);
if (peg$c551.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c552);
}
}
if (s2 === peg$FAILED) {
s2 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 92) {
s3 = peg$c407;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c408);
}
}
if (s3 !== peg$FAILED) {
if (input.length > peg$currPos) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c521);
}
}
if (s4 !== peg$FAILED) {
s3 = [s3, s4];
s2 = s3;
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
} else {
peg$currPos = s2;
s2 = peg$FAILED;
}
}
}
} else {
s1 = peg$FAILED;
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c71();
}
s0 = s1;
return s0;
}
function peg$parseEscapedChar() {
var s0;
if (peg$c553.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c554);
}
}
return s0;
}
function peg$parse_() {
var s0, s1;
s0 = [];
s1 = peg$parseAnySpace();
if (s1 !== peg$FAILED) {
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parseAnySpace();
}
} else {
s0 = peg$FAILED;
}
return s0;
}
function peg$parse__() {
var s0, s1;
s0 = [];
s1 = peg$parseAnySpace();
while (s1 !== peg$FAILED) {
s0.push(s1);
s1 = peg$parseAnySpace();
}
return s0;
}
function peg$parseAnySpace() {
var s0;
s0 = peg$parseWhiteSpace();
if (s0 === peg$FAILED) {
s0 = peg$parseLineTerminator();
if (s0 === peg$FAILED) {
s0 = peg$parseComment();
}
}
return s0;
}
function peg$parseSourceCharacter() {
var s0;
if (input.length > peg$currPos) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c521);
}
}
return s0;
}
function peg$parseWhiteSpace() {
var s0, s1;
peg$silentFails++;
if (input.charCodeAt(peg$currPos) === 9) {
s0 = peg$c556;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c557);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 11) {
s0 = peg$c558;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c559);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 12) {
s0 = peg$c560;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c561);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 32) {
s0 = peg$c562;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c563);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 160) {
s0 = peg$c564;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c565);
}
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 65279) {
s0 = peg$c566;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c567);
}
}
}
}
}
}
}
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c555);
}
}
return s0;
}
function peg$parseLineTerminator() {
var s0;
if (peg$c568.test(input.charAt(peg$currPos))) {
s0 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c569);
}
}
return s0;
}
function peg$parseComment() {
var s0, s1;
peg$silentFails++;
s0 = peg$parseSingleLineComment();
peg$silentFails--;
if (s0 === peg$FAILED) {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c570);
}
}
return s0;
}
function peg$parseMultiLineComment() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c571) {
s1 = peg$c571;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c572);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c573) {
s5 = peg$c573;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c574);
}
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = void 0;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseSourceCharacter();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
if (input.substr(peg$currPos, 2) === peg$c573) {
s5 = peg$c573;
peg$currPos += 2;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c574);
}
}
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = void 0;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseSourceCharacter();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
if (input.substr(peg$currPos, 2) === peg$c573) {
s3 = peg$c573;
peg$currPos += 2;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c574);
}
}
if (s3 !== peg$FAILED) {
s1 = [s1, s2, s3];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseSingleLineComment() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c575) {
s1 = peg$c575;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c576);
}
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
s5 = peg$parseLineTerminator();
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = void 0;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseSourceCharacter();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = peg$currPos;
peg$silentFails++;
s5 = peg$parseLineTerminator();
peg$silentFails--;
if (s5 === peg$FAILED) {
s4 = void 0;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
if (s4 !== peg$FAILED) {
s5 = peg$parseSourceCharacter();
if (s5 !== peg$FAILED) {
s4 = [s4, s5];
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseEOL() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseWhiteSpace();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseWhiteSpace();
}
if (s1 !== peg$FAILED) {
s2 = peg$parseLineTerminator();
if (s2 !== peg$FAILED) {
s1 = [s1, s2];
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseEOT() {
var s0;
s0 = peg$parse_();
if (s0 === peg$FAILED) {
s0 = peg$parseEOF();
}
return s0;
}
function peg$parseEOF() {
var s0, s1;
s0 = peg$currPos;
peg$silentFails++;
if (input.length > peg$currPos) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) {
peg$fail(peg$c521);
}
}
peg$silentFails--;
if (s1 === peg$FAILED) {
s0 = void 0;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseEOKW() {
var s0, s1;
s0 = peg$currPos;
peg$silentFails++;
s1 = peg$parseKeyWordChars();
peg$silentFails--;
if (s1 === peg$FAILED) {
s0 = void 0;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
let reglob = require_reglob();
function makeArgMap(args) {
let m = {};
for (let arg of args) {
if (arg.name in m) {
throw new Error(`Duplicate argument -${arg.name}`);
}
m[arg.name] = arg.value;
}
return m;
}
function makeBinaryExprChain(first, rest) {
let ret = first;
for (let part of rest) {
ret = { kind: "BinaryExpr", op: part[0], lhs: ret, rhs: part[1] };
}
return ret;
}
function makeTemplateExprChain(args) {
let ret = args[0];
for (let part of args.slice(1)) {
ret = { kind: "BinaryExpr", op: "+", lhs: ret, rhs: part };
}
return ret;
}
function joinChars(chars) {
return chars.join("");
}
function OR(a, b) {
return a || b;
}
function makeUnicodeChar(chars) {
let n = parseInt(chars.join(""), 16);
if (n < 65536) {
return String.fromCharCode(n);
}
n -= 65536;
let surrogate1 = 55296 + (n >> 10 & 2047);
let surrogate2 = 56320 + (n & 1023);
return String.fromCharCode(surrogate1) + String.fromCharCode(surrogate2);
}
peg$result = peg$startRuleFunction();
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
return peg$result;
} else {
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
peg$fail(peg$endExpectation());
}
throw peg$buildStructuredError(
peg$maxFailExpected,
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
}
}
module.exports = {
SyntaxError: peg$SyntaxError,
parse: peg$parse
};
}
});
// ../../node_modules/events/events.js
var require_events = __commonJS({
"../../node_modules/events/events.js"(exports, module) {
"use strict";
var R = typeof Reflect === "object" ? Reflect : null;
var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) {
return Function.prototype.apply.call(target, receiver, args);
};
var ReflectOwnKeys;
if (R && typeof R.ownKeys === "function") {
ReflectOwnKeys = R.ownKeys;
} else if (Object.getOwnPropertySymbols) {
ReflectOwnKeys = function ReflectOwnKeys2(target) {
return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
};
} else {
ReflectOwnKeys = function ReflectOwnKeys2(target) {
return Object.getOwnPropertyNames(target);
};
}
function ProcessEmitWarning(warning) {
if (console && console.warn)
console.warn(warning);
}
var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {
return value !== value;
};
function EventEmitter2() {
EventEmitter2.init.call(this);
}
module.exports = EventEmitter2;
module.exports.once = once;
EventEmitter2.EventEmitter = EventEmitter2;
EventEmitter2.prototype._events = void 0;
EventEmitter2.prototype._eventsCount = 0;
EventEmitter2.prototype._maxListeners = void 0;
var defaultMaxListeners = 10;
function checkListener(listener) {
if (typeof listener !== "function") {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
}
Object.defineProperty(EventEmitter2, "defaultMaxListeners", {
enumerable: true,
get: function() {
return defaultMaxListeners;
},
set: function(arg) {
if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
}
defaultMaxListeners = arg;
}
});
EventEmitter2.init = function() {
if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
this._events = /* @__PURE__ */ Object.create(null);
this._eventsCount = 0;
}
this._maxListeners = this._maxListeners || void 0;
};
EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
}
this._maxListeners = n;
return this;
};
function _getMaxListeners(that) {
if (that._maxListeners === void 0)
return EventEmitter2.defaultMaxListeners;
return that._maxListeners;
}
EventEmitter2.prototype.getMaxListeners = function getMaxListeners() {
return _getMaxListeners(this);
};
EventEmitter2.prototype.emit = function emit(type) {
var args = [];
for (var i = 1; i < arguments.length; i++)
args.push(arguments[i]);
var doError = type === "error";
var events = this._events;
if (events !== void 0)
doError = doError && events.error === void 0;
else if (!doError)
return false;
if (doError) {
var er;
if (args.length > 0)
er = args[0];
if (er instanceof Error) {
throw er;
}
var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
err.context = er;
throw err;
}
var handler = events[type];
if (handler === void 0)
return false;
if (typeof handler === "function") {
ReflectApply(handler, this, args);
} else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
ReflectApply(listeners[i], this, args);
}
return true;
};
function _addListener(target, type, listener, prepend) {
var m;
var events;
var existing;
checkListener(listener);
events = target._events;
if (events === void 0) {
events = target._events = /* @__PURE__ */ Object.create(null);
target._eventsCount = 0;
} else {
if (events.newListener !== void 0) {
target.emit(
"newListener",
type,
listener.listener ? listener.listener : listener
);
events = target._events;
}
existing = events[type];
}
if (existing === void 0) {
existing = events[type] = listener;
++target._eventsCount;
} else {
if (typeof existing === "function") {
existing = events[type] = prepend ? [listener, existing] : [existing, listener];
} else if (prepend) {
existing.unshift(listener);
} else {
existing.push(listener);
}
m = _getMaxListeners(target);
if (m > 0 && existing.length > m && !existing.warned) {
existing.warned = true;
var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit");
w.name = "MaxListenersExceededWarning";
w.emitter = target;
w.type = type;
w.count = existing.length;
ProcessEmitWarning(w);
}
}
return target;
}
EventEmitter2.prototype.addListener = function addListener(type, listener) {
return _addListener(this, type, listener, false);
};
EventEmitter2.prototype.on = EventEmitter2.prototype.addListener;
EventEmitter2.prototype.prependListener = function prependListener(type, listener) {
return _addListener(this, type, listener, true);
};
function onceWrapper() {
if (!this.fired) {
this.target.removeListener(this.type, this.wrapFn);
this.fired = true;
if (arguments.length === 0)
return this.listener.call(this.target);
return this.listener.apply(this.target, arguments);
}
}
function _onceWrap(target, type, listener) {
var state = { fired: false, wrapFn: void 0, target, type, listener };
var wrapped = onceWrapper.bind(state);
wrapped.listener = listener;
state.wrapFn = wrapped;
return wrapped;
}
EventEmitter2.prototype.once = function once2(type, listener) {
checkListener(listener);
this.on(type, _onceWrap(this, type, listener));
return this;
};
EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type, listener) {
checkListener(listener);
this.prependListener(type, _onceWrap(this, type, listener));
return this;
};
EventEmitter2.prototype.removeListener = function removeListener(type, listener) {
var list, events, position, i, originalListener;
checkListener(listener);
events = this._events;
if (events === void 0)
return this;
list = events[type];
if (list === void 0)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = /* @__PURE__ */ Object.create(null);
else {
delete events[type];
if (events.removeListener)
this.emit("removeListener", type, list.listener || listener);
}
} else if (typeof list !== "function") {
position = -1;
for (i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
originalListener = list[i].listener;
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== void 0)
this.emit("removeListener", type, originalListener || listener);
}
return this;
};
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type) {
var listeners, events, i;
events = this._events;
if (events === void 0)
return this;
if (events.removeListener === void 0) {
if (arguments.length === 0) {
this._events = /* @__PURE__ */ Object.create(null);
this._eventsCount = 0;
} else if (events[type] !== void 0) {
if (--this._eventsCount === 0)
this._events = /* @__PURE__ */ Object.create(null);
else
delete events[type];
}
return this;
}
if (arguments.length === 0) {
var keys = Object.keys(events);
var key;
for (i = 0; i < keys.length; ++i) {
key = keys[i];
if (key === "removeListener")
continue;
this.removeAllListeners(key);
}
this.removeAllListeners("removeListener");
this._events = /* @__PURE__ */ Object.create(null);
this._eventsCount = 0;
return this;
}
listeners = events[type];
if (typeof listeners === "function") {
this.removeListener(type, listeners);
} else if (listeners !== void 0) {
for (i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type, listeners[i]);
}
}
return this;
};
function _listeners(target, type, unwrap) {
var events = target._events;
if (events === void 0)
return [];
var evlistener = events[type];
if (evlistener === void 0)
return [];
if (typeof evlistener === "function")
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
}
EventEmitter2.prototype.listeners = function listeners(type) {
return _listeners(this, type, true);
};
EventEmitter2.prototype.rawListeners = function rawListeners(type) {
return _listeners(this, type, false);
};
EventEmitter2.listenerCount = function(emitter, type) {
if (typeof emitter.listenerCount === "function") {
return emitter.listenerCount(type);
} else {
return listenerCount.call(emitter, type);
}
};
EventEmitter2.prototype.listenerCount = listenerCount;
function listenerCount(type) {
var events = this._events;
if (events !== void 0) {
var evlistener = events[type];
if (typeof evlistener === "function") {
return 1;
} else if (evlistener !== void 0) {
return evlistener.length;
}
}
return 0;
}
EventEmitter2.prototype.eventNames = function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
};
function arrayClone(arr, n) {
var copy = new Array(n);
for (var i = 0; i < n; ++i)
copy[i] = arr[i];
return copy;
}
function spliceOne(list, index) {
for (; index + 1 < list.length; index++)
list[index] = list[index + 1];
list.pop();
}
function unwrapListeners(arr) {
var ret = new Array(arr.length);
for (var i = 0; i < ret.length; ++i) {
ret[i] = arr[i].listener || arr[i];
}
return ret;
}
function once(emitter, name2) {
return new Promise(function(resolve, reject) {
function errorListener(err) {
emitter.removeListener(name2, resolver);
reject(err);
}
function resolver() {
if (typeof emitter.removeListener === "function") {
emitter.removeListener("error", errorListener);
}
resolve([].slice.call(arguments));
}
;
eventTargetAgnosticAddListener(emitter, name2, resolver, { once: true });
if (name2 !== "error") {
addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
}
});
}
function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
if (typeof emitter.on === "function") {
eventTargetAgnosticAddListener(emitter, "error", handler, flags);
}
}
function eventTargetAgnosticAddListener(emitter, name2, listener, flags) {
if (typeof emitter.on === "function") {
if (flags.once) {
emitter.once(name2, listener);
} else {
emitter.on(name2, listener);
}
} else if (typeof emitter.addEventListener === "function") {
emitter.addEventListener(name2, function wrapListener(arg) {
if (flags.once) {
emitter.removeEventListener(name2, wrapListener);
}
listener(arg);
});
} else {
throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
}
}
}
});
// ../../node_modules/event-source-polyfill/src/eventsource.js
var require_eventsource = __commonJS({
"../../node_modules/event-source-polyfill/src/eventsource.js"(exports, module) {
(function(global2) {
"use strict";
var setTimeout2 = global2.setTimeout;
var clearTimeout2 = global2.clearTimeout;
var XMLHttpRequest = global2.XMLHttpRequest;
var XDomainRequest = global2.XDomainRequest;
var ActiveXObject = global2.ActiveXObject;
var NativeEventSource = global2.EventSource;
var document = global2.document;
var Promise2 = global2.Promise;
var fetch = global2.fetch;
var Response = global2.Response;
var TextDecoder2 = global2.TextDecoder;
var TextEncoder = global2.TextEncoder;
var AbortController2 = global2.AbortController;
if (typeof window !== "undefined" && typeof document !== "undefined" && !("readyState" in document) && document.body == null) {
document.readyState = "loading";
window.addEventListener("load", function(event) {
document.readyState = "complete";
}, false);
}
if (XMLHttpRequest == null && ActiveXObject != null) {
XMLHttpRequest = function() {
return new ActiveXObject("Microsoft.XMLHTTP");
};
}
if (Object.create == void 0) {
Object.create = function(C) {
function F() {
}
F.prototype = C;
return new F();
};
}
if (!Date.now) {
Date.now = function now() {
return (/* @__PURE__ */ new Date()).getTime();
};
}
if (AbortController2 == void 0) {
var originalFetch2 = fetch;
fetch = function(url, options) {
var signal = options.signal;
return originalFetch2(url, { headers: options.headers, credentials: options.credentials, cache: options.cache }).then(function(response) {
var reader = response.body.getReader();
signal._reader = reader;
if (signal._aborted) {
signal._reader.cancel();
}
return {
status: response.status,
statusText: response.statusText,
headers: response.headers,
body: {
getReader: function() {
return reader;
}
}
};
});
};
AbortController2 = function() {
this.signal = {
_reader: null,
_aborted: false
};
this.abort = function() {
if (this.signal._reader != null) {
this.signal._reader.cancel();
}
this.signal._aborted = true;
};
};
}
function TextDecoderPolyfill() {
this.bitsNeeded = 0;
this.codePoint = 0;
}
TextDecoderPolyfill.prototype.decode = function(octets) {
function valid(codePoint2, shift, octetsCount2) {
if (octetsCount2 === 1) {
return codePoint2 >= 128 >> shift && codePoint2 << shift <= 2047;
}
if (octetsCount2 === 2) {
return codePoint2 >= 2048 >> shift && codePoint2 << shift <= 55295 || codePoint2 >= 57344 >> shift && codePoint2 << shift <= 65535;
}
if (octetsCount2 === 3) {
return codePoint2 >= 65536 >> shift && codePoint2 << shift <= 1114111;
}
throw new Error();
}
function octetsCount(bitsNeeded2, codePoint2) {
if (bitsNeeded2 === 6 * 1) {
return codePoint2 >> 6 > 15 ? 3 : codePoint2 > 31 ? 2 : 1;
}
if (bitsNeeded2 === 6 * 2) {
return codePoint2 > 15 ? 3 : 2;
}
if (bitsNeeded2 === 6 * 3) {
return 3;
}
throw new Error();
}
var REPLACER = 65533;
var string = "";
var bitsNeeded = this.bitsNeeded;
var codePoint = this.codePoint;
for (var i = 0; i < octets.length; i += 1) {
var octet = octets[i];
if (bitsNeeded !== 0) {
if (octet < 128 || octet > 191 || !valid(codePoint << 6 | octet & 63, bitsNeeded - 6, octetsCount(bitsNeeded, codePoint))) {
bitsNeeded = 0;
codePoint = REPLACER;
string += String.fromCharCode(codePoint);
}
}
if (bitsNeeded === 0) {
if (octet >= 0 && octet <= 127) {
bitsNeeded = 0;
codePoint = octet;
} else if (octet >= 192 && octet <= 223) {
bitsNeeded = 6 * 1;
codePoint = octet & 31;
} else if (octet >= 224 && octet <= 239) {
bitsNeeded = 6 * 2;
codePoint = octet & 15;
} else if (octet >= 240 && octet <= 247) {
bitsNeeded = 6 * 3;
codePoint = octet & 7;
} else {
bitsNeeded = 0;
codePoint = REPLACER;
}
if (bitsNeeded !== 0 && !valid(codePoint, bitsNeeded, octetsCount(bitsNeeded, codePoint))) {
bitsNeeded = 0;
codePoint = REPLACER;
}
} else {
bitsNeeded -= 6;
codePoint = codePoint << 6 | octet & 63;
}
if (bitsNeeded === 0) {
if (codePoint <= 65535) {
string += String.fromCharCode(codePoint);
} else {
string += String.fromCharCode(55296 + (codePoint - 65535 - 1 >> 10));
string += String.fromCharCode(56320 + (codePoint - 65535 - 1 & 1023));
}
}
}
this.bitsNeeded = bitsNeeded;
this.codePoint = codePoint;
return string;
};
var supportsStreamOption = function() {
try {
return new TextDecoder2().decode(new TextEncoder().encode("test"), { stream: true }) === "test";
} catch (error) {
console.debug("TextDecoder does not support streaming option. Using polyfill instead: " + error);
}
return false;
};
if (TextDecoder2 == void 0 || TextEncoder == void 0 || !supportsStreamOption()) {
TextDecoder2 = TextDecoderPolyfill;
}
var k = function() {
};
function XHRWrapper(xhr) {
this.withCredentials = false;
this.readyState = 0;
this.status = 0;
this.statusText = "";
this.responseText = "";
this.onprogress = k;
this.onload = k;
this.onerror = k;
this.onreadystatechange = k;
this._contentType = "";
this._xhr = xhr;
this._sendTimeout = 0;
this._abort = k;
}
XHRWrapper.prototype.open = function(method, url) {
this._abort(true);
var that = this;
var xhr = this._xhr;
var state = 1;
var timeout = 0;
this._abort = function(silent) {
if (that._sendTimeout !== 0) {
clearTimeout2(that._sendTimeout);
that._sendTimeout = 0;
}
if (state === 1 || state === 2 || state === 3) {
state = 4;
xhr.onload = k;
xhr.onerror = k;
xhr.onabort = k;
xhr.onprogress = k;
xhr.onreadystatechange = k;
xhr.abort();
if (timeout !== 0) {
clearTimeout2(timeout);
timeout = 0;
}
if (!silent) {
that.readyState = 4;
that.onabort(null);
that.onreadystatechange();
}
}
state = 0;
};
var onStart = function() {
if (state === 1) {
var status = 0;
var statusText = "";
var contentType = void 0;
if (!("contentType" in xhr)) {
try {
status = xhr.status;
statusText = xhr.statusText;
contentType = xhr.getResponseHeader("Content-Type");
} catch (error) {
status = 0;
statusText = "";
contentType = void 0;
}
} else {
status = 200;
statusText = "OK";
contentType = xhr.contentType;
}
if (status !== 0) {
state = 2;
that.readyState = 2;
that.status = status;
that.statusText = statusText;
that._contentType = contentType;
that.onreadystatechange();
}
}
};
var onProgress = function() {
onStart();
if (state === 2 || state === 3) {
state = 3;
var responseText = "";
try {
responseText = xhr.responseText;
} catch (error) {
}
that.readyState = 3;
that.responseText = responseText;
that.onprogress();
}
};
var onFinish = function(type, event) {
if (event == null || event.preventDefault == null) {
event = {
preventDefault: k
};
}
onProgress();
if (state === 1 || state === 2 || state === 3) {
state = 4;
if (timeout !== 0) {
clearTimeout2(timeout);
timeout = 0;
}
that.readyState = 4;
if (type === "load") {
that.onload(event);
} else if (type === "error") {
that.onerror(event);
} else if (type === "abort") {
that.onabort(event);
} else {
throw new TypeError();
}
that.onreadystatechange();
}
};
var onReadyStateChange = function(event) {
if (xhr != void 0) {
if (xhr.readyState === 4) {
if (!("onload" in xhr) || !("onerror" in xhr) || !("onabort" in xhr)) {
onFinish(xhr.responseText === "" ? "error" : "load", event);
}
} else if (xhr.readyState === 3) {
if (!("onprogress" in xhr)) {
onProgress();
}
} else if (xhr.readyState === 2) {
onStart();
}
}
};
var onTimeout = function() {
timeout = setTimeout2(function() {
onTimeout();
}, 500);
if (xhr.readyState === 3) {
onProgress();
}
};
if ("onload" in xhr) {
xhr.onload = function(event) {
onFinish("load", event);
};
}
if ("onerror" in xhr) {
xhr.onerror = function(event) {
onFinish("error", event);
};
}
if ("onabort" in xhr) {
xhr.onabort = function(event) {
onFinish("abort", event);
};
}
if ("onprogress" in xhr) {
xhr.onprogress = onProgress;
}
if ("onreadystatechange" in xhr) {
xhr.onreadystatechange = function(event) {
onReadyStateChange(event);
};
}
if ("contentType" in xhr || !("ontimeout" in XMLHttpRequest.prototype)) {
url += (url.indexOf("?") === -1 ? "?" : "&") + "padding=true";
}
xhr.open(method, url, true);
if ("readyState" in xhr) {
timeout = setTimeout2(function() {
onTimeout();
}, 0);
}
};
XHRWrapper.prototype.abort = function() {
this._abort(false);
};
XHRWrapper.prototype.getResponseHeader = function(name2) {
return this._contentType;
};
XHRWrapper.prototype.setRequestHeader = function(name2, value) {
var xhr = this._xhr;
if ("setRequestHeader" in xhr) {
xhr.setRequestHeader(name2, value);
}
};
XHRWrapper.prototype.getAllResponseHeaders = function() {
return this._xhr.getAllResponseHeaders != void 0 ? this._xhr.getAllResponseHeaders() || "" : "";
};
XHRWrapper.prototype.send = function() {
if ((!("ontimeout" in XMLHttpRequest.prototype) || !("sendAsBinary" in XMLHttpRequest.prototype) && !("mozAnon" in XMLHttpRequest.prototype)) && document != void 0 && document.readyState != void 0 && document.readyState !== "complete") {
var that = this;
that._sendTimeout = setTimeout2(function() {
that._sendTimeout = 0;
that.send();
}, 4);
return;
}
var xhr = this._xhr;
if ("withCredentials" in xhr) {
xhr.withCredentials = this.withCredentials;
}
try {
xhr.send(void 0);
} catch (error1) {
throw error1;
}
};
function toLowerCase(name2) {
return name2.replace(/[A-Z]/g, function(c) {
return String.fromCharCode(c.charCodeAt(0) + 32);
});
}
function HeadersPolyfill(all) {
var map = /* @__PURE__ */ Object.create(null);
var array = all.split("\r\n");
for (var i = 0; i < array.length; i += 1) {
var line = array[i];
var parts = line.split(": ");
var name2 = parts.shift();
var value = parts.join(": ");
map[toLowerCase(name2)] = value;
}
this._map = map;
}
HeadersPolyfill.prototype.get = function(name2) {
return this._map[toLowerCase(name2)];
};
if (XMLHttpRequest != null && XMLHttpRequest.HEADERS_RECEIVED == null) {
XMLHttpRequest.HEADERS_RECEIVED = 2;
}
function XHRTransport() {
}
XHRTransport.prototype.open = function(xhr, onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
xhr.open("GET", url);
var offset = 0;
xhr.onprogress = function() {
var responseText = xhr.responseText;
var chunk = responseText.slice(offset);
offset += chunk.length;
onProgressCallback(chunk);
};
xhr.onerror = function(event) {
event.preventDefault();
onFinishCallback(new Error("NetworkError"));
};
xhr.onload = function() {
onFinishCallback(null);
};
xhr.onabort = function() {
onFinishCallback(null);
};
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
var status = xhr.status;
var statusText = xhr.statusText;
var contentType = xhr.getResponseHeader("Content-Type");
var headers2 = xhr.getAllResponseHeaders();
onStartCallback(status, statusText, contentType, new HeadersPolyfill(headers2));
}
};
xhr.withCredentials = withCredentials;
for (var name2 in headers) {
if (Object.prototype.hasOwnProperty.call(headers, name2)) {
xhr.setRequestHeader(name2, headers[name2]);
}
}
xhr.send();
return xhr;
};
function HeadersWrapper(headers) {
this._headers = headers;
}
HeadersWrapper.prototype.get = function(name2) {
return this._headers.get(name2);
};
function FetchTransport() {
}
FetchTransport.prototype.open = function(xhr, onStartCallback, onProgressCallback, onFinishCallback, url, withCredentials, headers) {
var reader = null;
var controller = new AbortController2();
var signal = controller.signal;
var textDecoder = new TextDecoder2();
fetch(url, {
headers,
credentials: withCredentials ? "include" : "same-origin",
signal,
cache: "no-store"
}).then(function(response) {
reader = response.body.getReader();
onStartCallback(response.status, response.statusText, response.headers.get("Content-Type"), new HeadersWrapper(response.headers));
return new Promise2(function(resolve, reject) {
var readNextChunk = function() {
reader.read().then(function(result) {
if (result.done) {
resolve(void 0);
} else {
var chunk = textDecoder.decode(result.value, { stream: true });
onProgressCallback(chunk);
readNextChunk();
}
})["catch"](function(error) {
reject(error);
});
};
readNextChunk();
});
})["catch"](function(error) {
if (error.name === "AbortError") {
return void 0;
} else {
return error;
}
}).then(function(error) {
onFinishCallback(error);
});
return {
abort: function() {
if (reader != null) {
reader.cancel();
}
controller.abort();
}
};
};
function EventTarget() {
this._listeners = /* @__PURE__ */ Object.create(null);
}
function throwError(e) {
setTimeout2(function() {
throw e;
}, 0);
}
EventTarget.prototype.dispatchEvent = function(event) {
event.target = this;
var typeListeners = this._listeners[event.type];
if (typeListeners != void 0) {
var length = typeListeners.length;
for (var i = 0; i < length; i += 1) {
var listener = typeListeners[i];
try {
if (typeof listener.handleEvent === "function") {
listener.handleEvent(event);
} else {
listener.call(this, event);
}
} catch (e) {
throwError(e);
}
}
}
};
EventTarget.prototype.addEventListener = function(type, listener) {
type = String(type);
var listeners = this._listeners;
var typeListeners = listeners[type];
if (typeListeners == void 0) {
typeListeners = [];
listeners[type] = typeListeners;
}
var found = false;
for (var i = 0; i < typeListeners.length; i += 1) {
if (typeListeners[i] === listener) {
found = true;
}
}
if (!found) {
typeListeners.push(listener);
}
};
EventTarget.prototype.removeEventListener = function(type, listener) {
type = String(type);
var listeners = this._listeners;
var typeListeners = listeners[type];
if (typeListeners != void 0) {
var filtered = [];
for (var i = 0; i < typeListeners.length; i += 1) {
if (typeListeners[i] !== listener) {
filtered.push(typeListeners[i]);
}
}
if (filtered.length === 0) {
delete listeners[type];
} else {
listeners[type] = filtered;
}
}
};
function Event(type) {
this.type = type;
this.target = void 0;
}
function MessageEvent(type, options) {
Event.call(this, type);
this.data = options.data;
this.lastEventId = options.lastEventId;
}
MessageEvent.prototype = Object.create(Event.prototype);
function ConnectionEvent(type, options) {
Event.call(this, type);
this.status = options.status;
this.statusText = options.statusText;
this.headers = options.headers;
}
ConnectionEvent.prototype = Object.create(Event.prototype);
function ErrorEvent(type, options) {
Event.call(this, type);
this.error = options.error;
}
ErrorEvent.prototype = Object.create(Event.prototype);
var WAITING = -1;
var CONNECTING = 0;
var OPEN = 1;
var CLOSED = 2;
var AFTER_CR = -1;
var FIELD_START = 0;
var FIELD = 1;
var VALUE_START = 2;
var VALUE = 3;
var contentTypeRegExp = /^text\/event\-stream(;.*)?$/i;
var MINIMUM_DURATION = 1e3;
var MAXIMUM_DURATION = 18e6;
var parseDuration = function(value, def) {
var n = value == null ? def : parseInt(value, 10);
if (n !== n) {
n = def;
}
return clampDuration(n);
};
var clampDuration = function(n) {
return Math.min(Math.max(n, MINIMUM_DURATION), MAXIMUM_DURATION);
};
var fire = function(that, f, event) {
try {
if (typeof f === "function") {
f.call(that, event);
}
} catch (e) {
throwError(e);
}
};
function EventSourcePolyfill2(url, options) {
EventTarget.call(this);
options = options || {};
this.onopen = void 0;
this.onmessage = void 0;
this.onerror = void 0;
this.url = void 0;
this.readyState = void 0;
this.withCredentials = void 0;
this.headers = void 0;
this._close = void 0;
start(this, url, options);
}
function getBestXHRTransport() {
return XMLHttpRequest != void 0 && "withCredentials" in XMLHttpRequest.prototype || XDomainRequest == void 0 ? new XMLHttpRequest() : new XDomainRequest();
}
var isFetchSupported = fetch != void 0 && Response != void 0 && "body" in Response.prototype;
function start(es, url, options) {
url = String(url);
var withCredentials = Boolean(options.withCredentials);
var lastEventIdQueryParameterName = options.lastEventIdQueryParameterName || "lastEventId";
var initialRetry = clampDuration(1e3);
var heartbeatTimeout = parseDuration(options.heartbeatTimeout, 45e3);
var lastEventId = "";
var retry = initialRetry;
var wasActivity = false;
var textLength = 0;
var headers = options.headers || {};
var TransportOption = options.Transport;
var xhr = isFetchSupported && TransportOption == void 0 ? void 0 : new XHRWrapper(TransportOption != void 0 ? new TransportOption() : getBestXHRTransport());
var transport = TransportOption != null && typeof TransportOption !== "string" ? new TransportOption() : xhr == void 0 ? new FetchTransport() : new XHRTransport();
var abortController = void 0;
var timeout = 0;
var currentState = WAITING;
var dataBuffer = "";
var lastEventIdBuffer = "";
var eventTypeBuffer = "";
var textBuffer = "";
var state = FIELD_START;
var fieldStart = 0;
var valueStart = 0;
var onStart = function(status, statusText, contentType, headers2) {
if (currentState === CONNECTING) {
if (status === 200 && contentType != void 0 && contentTypeRegExp.test(contentType)) {
currentState = OPEN;
wasActivity = Date.now();
retry = initialRetry;
es.readyState = OPEN;
var event = new ConnectionEvent("open", {
status,
statusText,
headers: headers2
});
es.dispatchEvent(event);
fire(es, es.onopen, event);
} else {
var message = "";
if (status !== 200) {
if (statusText) {
statusText = statusText.replace(/\s+/g, " ");
}
message = "EventSource's response has a status " + status + " " + statusText + " that is not 200. Aborting the connection.";
} else {
message = "EventSource's response has a Content-Type specifying an unsupported type: " + (contentType == void 0 ? "-" : contentType.replace(/\s+/g, " ")) + ". Aborting the connection.";
}
close();
var event = new ConnectionEvent("error", {
status,
statusText,
headers: headers2
});
es.dispatchEvent(event);
fire(es, es.onerror, event);
console.error(message);
}
}
};
var onProgress = function(textChunk) {
if (currentState === OPEN) {
var n = -1;
for (var i = 0; i < textChunk.length; i += 1) {
var c = textChunk.charCodeAt(i);
if (c === "\n".charCodeAt(0) || c === "\r".charCodeAt(0)) {
n = i;
}
}
var chunk = (n !== -1 ? textBuffer : "") + textChunk.slice(0, n + 1);
textBuffer = (n === -1 ? textBuffer : "") + textChunk.slice(n + 1);
if (textChunk !== "") {
wasActivity = Date.now();
textLength += textChunk.length;
}
for (var position = 0; position < chunk.length; position += 1) {
var c = chunk.charCodeAt(position);
if (state === AFTER_CR && c === "\n".charCodeAt(0)) {
state = FIELD_START;
} else {
if (state === AFTER_CR) {
state = FIELD_START;
}
if (c === "\r".charCodeAt(0) || c === "\n".charCodeAt(0)) {
if (state !== FIELD_START) {
if (state === FIELD) {
valueStart = position + 1;
}
var field = chunk.slice(fieldStart, valueStart - 1);
var value = chunk.slice(valueStart + (valueStart < position && chunk.charCodeAt(valueStart) === " ".charCodeAt(0) ? 1 : 0), position);
if (field === "data") {
dataBuffer += "\n";
dataBuffer += value;
} else if (field === "id") {
lastEventIdBuffer = value;
} else if (field === "event") {
eventTypeBuffer = value;
} else if (field === "retry") {
initialRetry = parseDuration(value, initialRetry);
retry = initialRetry;
} else if (field === "heartbeatTimeout") {
heartbeatTimeout = parseDuration(value, heartbeatTimeout);
if (timeout !== 0) {
clearTimeout2(timeout);
timeout = setTimeout2(function() {
onTimeout();
}, heartbeatTimeout);
}
}
}
if (state === FIELD_START) {
if (dataBuffer !== "") {
lastEventId = lastEventIdBuffer;
if (eventTypeBuffer === "") {
eventTypeBuffer = "message";
}
var event = new MessageEvent(eventTypeBuffer, {
data: dataBuffer.slice(1),
lastEventId: lastEventIdBuffer
});
es.dispatchEvent(event);
if (eventTypeBuffer === "open") {
fire(es, es.onopen, event);
} else if (eventTypeBuffer === "message") {
fire(es, es.onmessage, event);
} else if (eventTypeBuffer === "error") {
fire(es, es.onerror, event);
}
if (currentState === CLOSED) {
return;
}
}
dataBuffer = "";
eventTypeBuffer = "";
}
state = c === "\r".charCodeAt(0) ? AFTER_CR : FIELD_START;
} else {
if (state === FIELD_START) {
fieldStart = position;
state = FIELD;
}
if (state === FIELD) {
if (c === ":".charCodeAt(0)) {
valueStart = position + 1;
state = VALUE_START;
}
} else if (state === VALUE_START) {
state = VALUE;
}
}
}
}
}
};
var onFinish = function(error) {
if (currentState === OPEN || currentState === CONNECTING) {
currentState = WAITING;
if (timeout !== 0) {
clearTimeout2(timeout);
timeout = 0;
}
timeout = setTimeout2(function() {
onTimeout();
}, retry);
retry = clampDuration(Math.min(initialRetry * 16, retry * 2));
es.readyState = CONNECTING;
var event = new ErrorEvent("error", { error });
es.dispatchEvent(event);
fire(es, es.onerror, event);
if (error != void 0) {
console.error(error);
}
}
};
var close = function() {
currentState = CLOSED;
if (abortController != void 0) {
abortController.abort();
abortController = void 0;
}
if (timeout !== 0) {
clearTimeout2(timeout);
timeout = 0;
}
es.readyState = CLOSED;
};
var onTimeout = function() {
timeout = 0;
if (currentState !== WAITING) {
if (!wasActivity && abortController != void 0) {
onFinish(new Error("No activity within " + heartbeatTimeout + " milliseconds. " + (currentState === CONNECTING ? "No response received." : textLength + " chars received.") + " Reconnecting."));
if (abortController != void 0) {
abortController.abort();
abortController = void 0;
}
} else {
var nextHeartbeat = Math.max((wasActivity || Date.now()) + heartbeatTimeout - Date.now(), 1);
wasActivity = false;
timeout = setTimeout2(function() {
onTimeout();
}, nextHeartbeat);
}
return;
}
wasActivity = false;
textLength = 0;
timeout = setTimeout2(function() {
onTimeout();
}, heartbeatTimeout);
currentState = CONNECTING;
dataBuffer = "";
eventTypeBuffer = "";
lastEventIdBuffer = lastEventId;
textBuffer = "";
fieldStart = 0;
valueStart = 0;
state = FIELD_START;
var requestURL = url;
if (url.slice(0, 5) !== "data:" && url.slice(0, 5) !== "blob:") {
if (lastEventId !== "") {
var i = url.indexOf("?");
requestURL = i === -1 ? url : url.slice(0, i + 1) + url.slice(i + 1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g, function(p, paramName) {
return paramName === lastEventIdQueryParameterName ? "" : p;
});
requestURL += (url.indexOf("?") === -1 ? "?" : "&") + lastEventIdQueryParameterName + "=" + encodeURIComponent(lastEventId);
}
}
var withCredentials2 = es.withCredentials;
var requestHeaders = {};
requestHeaders["Accept"] = "text/event-stream";
var headers2 = es.headers;
if (headers2 != void 0) {
for (var name2 in headers2) {
if (Object.prototype.hasOwnProperty.call(headers2, name2)) {
requestHeaders[name2] = headers2[name2];
}
}
}
try {
abortController = transport.open(xhr, onStart, onProgress, onFinish, requestURL, withCredentials2, requestHeaders);
} catch (error) {
close();
throw error;
}
};
es.url = url;
es.readyState = CONNECTING;
es.withCredentials = withCredentials;
es.headers = headers;
es._close = close;
onTimeout();
}
EventSourcePolyfill2.prototype = Object.create(EventTarget.prototype);
EventSourcePolyfill2.prototype.CONNECTING = CONNECTING;
EventSourcePolyfill2.prototype.OPEN = OPEN;
EventSourcePolyfill2.prototype.CLOSED = CLOSED;
EventSourcePolyfill2.prototype.close = function() {
this._close();
};
EventSourcePolyfill2.CONNECTING = CONNECTING;
EventSourcePolyfill2.OPEN = OPEN;
EventSourcePolyfill2.CLOSED = CLOSED;
EventSourcePolyfill2.prototype.withCredentials = void 0;
var R = NativeEventSource;
if (XMLHttpRequest != void 0 && (NativeEventSource == void 0 || !("withCredentials" in NativeEventSource.prototype))) {
R = EventSourcePolyfill2;
}
(function(factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(exports);
if (v !== void 0)
module.exports = v;
} else if (typeof define === "function" && define.amd) {
define(["exports"], factory);
} else {
factory(global2);
}
})(function(exports2) {
exports2.EventSourcePolyfill = EventSourcePolyfill2;
exports2.NativeEventSource = NativeEventSource;
exports2.EventSource = R;
});
})(typeof globalThis === "undefined" ? typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : exports : globalThis);
}
});
// src/zed/decode-stream.ts
var import_lodash2 = __toESM(require_lodash());
// src/zed/types/type-field.ts
var TypeField = class {
constructor(name2, type) {
this.name = name2;
this.type = type;
}
};
// src/zed/values/bool.ts
var import_lodash = __toESM(require_lodash());
// src/zed/utils/is-null.ts
function isNull(value) {
return value === null;
}
// src/zed/values/primitive.ts
var Primitive = class {
constructor(value = null) {
this.value = value;
}
isUnset() {
return isNull(this.value);
}
isSet() {
return !this.isUnset();
}
toString() {
if (isNull(this.value))
return "null";
return this.value.toString();
}
serialize() {
if (isNull(this.value))
return null;
return this.value.toString();
}
};
// src/zed/values/bool.ts
var Bool = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeBool;
}
toJS() {
if ((0, import_lodash.isNull)(this.value))
return null;
if (this.value === "true")
return true;
return false;
}
};
// src/zed/types/base-primitive.ts
var BasePrimitive = class {
constructor() {
this.kind = "primitive";
}
serialize() {
return { kind: "primitive", name: this.name };
}
toString() {
return this.name;
}
};
// src/zed/types/type-bool.ts
var TypeOfBool = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "bool";
}
create(value) {
return new Bool(value);
}
};
var TypeBool = new TypeOfBool();
// src/zed/values/bstring.ts
var BString = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeBString;
}
toJS() {
return this.toString();
}
};
// src/zed/types/type-bstring.ts
var TypeOfBString = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "bstring";
}
create(value) {
return new BString(value);
}
};
var TypeBString = new TypeOfBString();
// src/zed/values/bytes.ts
var Bytes = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeBytes;
}
toJS() {
return this.toString();
}
};
// src/zed/types/type-bytes.ts
var TypeOfBytes = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "bytes";
}
create(value) {
return new Bytes(value);
}
};
var TypeBytes = new TypeOfBytes();
// src/zed/values/duration.ts
var Duration = class extends Primitive {
constructor(value) {
super(value);
this.type = TypeDuration;
if (isNull(value)) {
this._nanos = null;
} else {
this._nanos = parseNanos(value);
}
}
asSeconds() {
if (isNull(this._nanos))
return null;
const millis = Number(this._nanos / BigInt(1e6));
return millis / 1e3;
}
asMs() {
if (isNull(this._nanos))
return null;
return Number(this._nanos / BigInt(1e6));
}
asNanos() {
return this._nanos;
}
toJS() {
return this.asMs();
}
};
var parseRE = /([.0-9]+)(ns|us|ms|s|m|h|d|w|y)/g;
var Nanosecond = BigInt(1);
var Microsecond = BigInt(1e3) * Nanosecond;
var Millisecond = BigInt(1e3) * Microsecond;
var Second = BigInt(1e3) * Millisecond;
var Minute = BigInt(60) * Second;
var Hour = BigInt(60) * Minute;
var Day = BigInt(24) * Hour;
var Week = BigInt(7) * Day;
var Year = BigInt(365) * Day;
var scale = {
ns: Nanosecond,
us: Microsecond,
ms: Millisecond,
s: Second,
m: Minute,
h: Hour,
d: Day,
w: Week,
y: Year
};
function parseNanos(s) {
if (s.length === 0)
return BigInt(0);
let negative = false;
if (s[0] === "-") {
negative = true;
s = s.slice(1);
}
let matches = s.matchAll(parseRE);
let d = BigInt(0);
for (const match of matches) {
if (match.length !== 3)
throw new Error("Invalid Duration");
const [_all, num, unitName] = match;
let unit = scale[unitName];
if (num.includes(".")) {
const parts = num.split(".");
if (parts.length !== 2)
throw new Error("Invalid Duration");
let whole = parts[0];
d += BigInt(whole) * unit;
let frac = parts[1];
let extra = BigInt(0);
for (let char of frac) {
extra += BigInt(char) * unit;
unit /= BigInt(10);
}
d += (extra + BigInt(5)) / BigInt(10);
} else {
d += BigInt(num) * unit;
}
}
if (negative) {
d *= BigInt(-1);
}
return d;
}
// src/zed/types/type-duration.ts
var TypeOfDuration = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "duration";
}
create(value) {
return new Duration(value);
}
};
var TypeDuration = new TypeOfDuration();
// src/zed/values/float16.ts
var Float16 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeFloat16;
}
toFloat() {
if (isNull(this.value))
return null;
return parseFloat(this.value);
}
toJS() {
return this.toFloat();
}
};
// src/zed/types/type-float16.ts
var TypeOfFloat16 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "float16";
}
create(value) {
return new Float16(value);
}
};
var TypeFloat16 = new TypeOfFloat16();
// src/zed/values/float32.ts
var Float32 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeFloat32;
}
toFloat() {
if (isNull(this.value))
return null;
return parseFloat(this.value);
}
toJS() {
return this.toFloat();
}
};
// src/zed/types/type-float32.ts
var TypeOfFloat32 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "float32";
}
create(value) {
return new Float32(value);
}
};
var TypeFloat32 = new TypeOfFloat32();
// src/zed/values/float64.ts
var Float64 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeFloat64;
}
toFloat() {
if (isNull(this.value))
return null;
return parseFloat(this.value);
}
toJS() {
return this.toFloat();
}
};
// src/zed/types/type-float64.ts
var TypeOfFloat64 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "float64";
}
create(value) {
return new Float64(value);
}
};
var TypeFloat64 = new TypeOfFloat64();
// src/zed/values/int16.ts
var Int16 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeInt16;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toJS() {
return this.toInt();
}
};
// src/zed/types/type-int16.ts
var TypeOfInt16 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "int16";
}
create(value) {
return new Int16(value);
}
};
var TypeInt16 = new TypeOfInt16();
// src/zed/values/int32.ts
var Int32 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeInt32;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toJS() {
return this.toInt();
}
};
// src/zed/types/type-int32.ts
var TypeOfInt32 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "int32";
}
create(value) {
return new Int32(value);
}
};
var TypeInt32 = new TypeOfInt32();
// src/zed/values/int64.ts
var Int64 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeInt64;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toBigInt() {
if (isNull(this.value))
return null;
return BigInt(this.value);
}
toJS(opts = {}) {
if (opts.bigint) {
return this.toBigInt();
} else {
return this.toInt();
}
}
};
// src/zed/types/type-int64.ts
var TypeOfInt64 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "int64";
}
create(value) {
return new Int64(value);
}
};
var TypeInt64 = new TypeOfInt64();
// src/zed/values/int8.ts
var Int8 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeInt8;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toJS() {
return this.toInt();
}
};
// src/zed/types/type-int8.ts
var TypeOfInt8 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "int8";
}
create(value) {
return new Int8(value);
}
};
var TypeInt8 = new TypeOfInt8();
// src/zed/values/ip.ts
var Ip = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeIp;
}
toJS() {
return this.toString();
}
};
// src/zed/types/type-ip.ts
var TypeOfIp = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "ip";
}
create(value) {
return new Ip(value);
}
};
var TypeIp = new TypeOfIp();
// src/zed/values/net.ts
var Net = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeNet;
}
toJS() {
return this.toString();
}
};
// src/zed/types/type-net.ts
var TypeOfNet = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "net";
}
create(value) {
return new Net(value);
}
};
var TypeNet = new TypeOfNet();
// src/zed/values/null.ts
var Null = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeNull;
this.value = null;
}
toJS() {
return null;
}
};
// src/zed/types/type-null.ts
var TypeOfNull = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "null";
}
create(_value) {
return new Null();
}
};
var TypeNull = new TypeOfNull();
// src/zed/values/string.ts
var String2 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeString;
}
toJS() {
return this.toString();
}
};
// src/zed/types/type-string.ts
var TypeOfString = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "string";
}
create(value) {
return new String2(value);
}
};
var TypeString = new TypeOfString();
// node_modules/@js-joda/core/dist/js-joda.esm.js
function createErrorType(name2, init2) {
var superErrorClass = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Error;
function JsJodaException(message) {
if (!Error.captureStackTrace) {
this.stack = new Error().stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
this.message = message;
init2 && init2.apply(this, arguments);
this.toString = function() {
return "".concat(this.name, ": ").concat(this.message);
};
}
JsJodaException.prototype = Object.create(superErrorClass.prototype);
JsJodaException.prototype.name = name2;
JsJodaException.prototype.constructor = JsJodaException;
return JsJodaException;
}
var DateTimeException = createErrorType("DateTimeException", messageWithCause);
var DateTimeParseException = createErrorType("DateTimeParseException", messageForDateTimeParseException);
var UnsupportedTemporalTypeException = createErrorType("UnsupportedTemporalTypeException", null, DateTimeException);
var ArithmeticException = createErrorType("ArithmeticException");
var IllegalArgumentException = createErrorType("IllegalArgumentException");
var IllegalStateException = createErrorType("IllegalStateException");
var NullPointerException = createErrorType("NullPointerException");
function messageWithCause(message) {
var cause = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
var msg = message || this.name;
if (cause !== null && cause instanceof Error) {
msg += "\n-------\nCaused by: ".concat(cause.stack, "\n-------\n");
}
this.message = msg;
}
function messageForDateTimeParseException(message) {
var text = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
var cause = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
var msg = message || this.name;
msg += ": ".concat(text, ", at index: ").concat(index);
if (cause !== null && cause instanceof Error) {
msg += "\n-------\nCaused by: ".concat(cause.stack, "\n-------\n");
}
this.message = msg;
this.parsedString = function() {
return text;
};
this.errorIndex = function() {
return index;
};
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function(obj2) {
return typeof obj2;
};
} else {
_typeof = function(obj2) {
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass)
_setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct)
return false;
if (Reflect.construct.sham)
return false;
if (typeof Proxy === "function")
return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self2) {
if (self2 === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self2;
}
function _possibleConstructorReturn(self2, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self2);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived), result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object);
if (object === null)
break;
}
return object;
}
function _get(target, property, receiver) {
if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get;
} else {
_get = function _get2(target2, property2, receiver2) {
var base = _superPropBase(target2, property2);
if (!base)
return;
var desc = Object.getOwnPropertyDescriptor(base, property2);
if (desc.get) {
return desc.get.call(receiver2);
}
return desc.value;
};
}
return _get(target, property, receiver || target);
}
function assert(assertion, msg, error) {
if (!assertion) {
if (error) {
throw new error(msg);
} else {
throw new Error(msg);
}
}
}
function requireNonNull(value, parameterName) {
if (value == null) {
throw new NullPointerException("".concat(parameterName, " must not be null"));
}
return value;
}
function requireInstance(value, _class, parameterName) {
if (!(value instanceof _class)) {
throw new IllegalArgumentException("".concat(parameterName, " must be an instance of ").concat(_class.name ? _class.name : _class).concat(value && value.constructor && value.constructor.name ? ", but is ".concat(value.constructor.name) : ""));
}
return value;
}
function abstractMethodFail(methodName) {
throw new TypeError('abstract method "'.concat(methodName, '" is not implemented'));
}
var assert$1 = /* @__PURE__ */ Object.freeze({
__proto__: null,
assert,
requireNonNull,
requireInstance,
abstractMethodFail
});
var MAX_SAFE_INTEGER = 9007199254740991;
var MIN_SAFE_INTEGER = -9007199254740991;
var MathUtil = function() {
function MathUtil2() {
_classCallCheck(this, MathUtil2);
}
_createClass(MathUtil2, null, [{
key: "intDiv",
value: function intDiv(x, y) {
var r = x / y;
r = MathUtil2.roundDown(r);
return MathUtil2.safeZero(r);
}
}, {
key: "intMod",
value: function intMod(x, y) {
var r = x - MathUtil2.intDiv(x, y) * y;
r = MathUtil2.roundDown(r);
return MathUtil2.safeZero(r);
}
}, {
key: "roundDown",
value: function roundDown(r) {
if (r < 0) {
return Math.ceil(r);
} else {
return Math.floor(r);
}
}
}, {
key: "floorDiv",
value: function floorDiv(x, y) {
var r = Math.floor(x / y);
return MathUtil2.safeZero(r);
}
}, {
key: "floorMod",
value: function floorMod(x, y) {
var r = x - MathUtil2.floorDiv(x, y) * y;
return MathUtil2.safeZero(r);
}
}, {
key: "safeAdd",
value: function safeAdd(x, y) {
MathUtil2.verifyInt(x);
MathUtil2.verifyInt(y);
if (x === 0) {
return MathUtil2.safeZero(y);
}
if (y === 0) {
return MathUtil2.safeZero(x);
}
var r = MathUtil2.safeToInt(x + y);
if (r === x || r === y) {
throw new ArithmeticException("Invalid addition beyond MAX_SAFE_INTEGER!");
}
return r;
}
}, {
key: "safeSubtract",
value: function safeSubtract(x, y) {
MathUtil2.verifyInt(x);
MathUtil2.verifyInt(y);
if (x === 0 && y === 0) {
return 0;
} else if (x === 0) {
return MathUtil2.safeZero(-1 * y);
} else if (y === 0) {
return MathUtil2.safeZero(x);
}
return MathUtil2.safeToInt(x - y);
}
}, {
key: "safeMultiply",
value: function safeMultiply(x, y) {
MathUtil2.verifyInt(x);
MathUtil2.verifyInt(y);
if (x === 1) {
return MathUtil2.safeZero(y);
}
if (y === 1) {
return MathUtil2.safeZero(x);
}
if (x === 0 || y === 0) {
return 0;
}
var r = MathUtil2.safeToInt(x * y);
if (r / y !== x || x === MIN_SAFE_INTEGER && y === -1 || y === MIN_SAFE_INTEGER && x === -1) {
throw new ArithmeticException("Multiplication overflows: ".concat(x, " * ").concat(y));
}
return r;
}
}, {
key: "parseInt",
value: function(_parseInt) {
function parseInt2(_x) {
return _parseInt.apply(this, arguments);
}
parseInt2.toString = function() {
return _parseInt.toString();
};
return parseInt2;
}(function(value) {
var r = parseInt(value);
return MathUtil2.safeToInt(r);
})
}, {
key: "safeToInt",
value: function safeToInt(value) {
MathUtil2.verifyInt(value);
return MathUtil2.safeZero(value);
}
}, {
key: "verifyInt",
value: function verifyInt(value) {
if (value == null) {
throw new ArithmeticException("Invalid value: '".concat(value, "', using null or undefined as argument"));
}
if (isNaN(value)) {
throw new ArithmeticException("Invalid int value, using NaN as argument");
}
if (value % 1 !== 0) {
throw new ArithmeticException("Invalid value: '".concat(value, "' is a float"));
}
if (value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER) {
throw new ArithmeticException("Calculation overflows an int: ".concat(value));
}
}
}, {
key: "safeZero",
value: function safeZero(value) {
return value === 0 ? 0 : +value;
}
}, {
key: "compareNumbers",
value: function compareNumbers(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
}, {
key: "smi",
value: function smi(int) {
return int >>> 1 & 1073741824 | int & 3221225471;
}
}, {
key: "hash",
value: function hash(number) {
if (number !== number || number === Infinity) {
return 0;
}
var result = number;
while (number > 4294967295) {
number /= 4294967295;
result ^= number;
}
return MathUtil2.smi(result);
}
}, {
key: "hashCode",
value: function hashCode() {
var result = 17;
for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
numbers[_key] = arguments[_key];
}
for (var _i = 0, _numbers = numbers; _i < _numbers.length; _i++) {
var n = _numbers[_i];
result = (result << 5) - result + MathUtil2.hash(n);
}
return MathUtil2.hash(result);
}
}]);
return MathUtil2;
}();
MathUtil.MAX_SAFE_INTEGER = MAX_SAFE_INTEGER;
MathUtil.MIN_SAFE_INTEGER = MIN_SAFE_INTEGER;
var Enum = function() {
function Enum2(name2) {
_classCallCheck(this, Enum2);
this._name = name2;
}
_createClass(Enum2, [{
key: "equals",
value: function equals(other) {
return this === other;
}
}, {
key: "toString",
value: function toString() {
return this._name;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}]);
return Enum2;
}();
var TemporalAmount = function() {
function TemporalAmount2() {
_classCallCheck(this, TemporalAmount2);
}
_createClass(TemporalAmount2, [{
key: "get",
value: function get(unit) {
abstractMethodFail("get");
}
}, {
key: "units",
value: function units() {
abstractMethodFail("units");
}
}, {
key: "addTo",
value: function addTo(temporal) {
abstractMethodFail("addTo");
}
}, {
key: "subtractFrom",
value: function subtractFrom(temporal) {
abstractMethodFail("subtractFrom");
}
}]);
return TemporalAmount2;
}();
var TemporalUnit = function() {
function TemporalUnit2() {
_classCallCheck(this, TemporalUnit2);
}
_createClass(TemporalUnit2, [{
key: "duration",
value: function duration() {
abstractMethodFail("duration");
}
}, {
key: "isDurationEstimated",
value: function isDurationEstimated() {
abstractMethodFail("isDurationEstimated");
}
}, {
key: "isDateBased",
value: function isDateBased() {
abstractMethodFail("isDateBased");
}
}, {
key: "isTimeBased",
value: function isTimeBased() {
abstractMethodFail("isTimeBased");
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
abstractMethodFail("isSupportedBy");
}
}, {
key: "addTo",
value: function addTo(dateTime, periodToAdd) {
abstractMethodFail("addTo");
}
}, {
key: "between",
value: function between(temporal1, temporal2) {
abstractMethodFail("between");
}
}]);
return TemporalUnit2;
}();
var Duration2 = function(_TemporalAmount) {
_inherits(Duration3, _TemporalAmount);
var _super = _createSuper(Duration3);
function Duration3(seconds, nanos) {
var _this;
_classCallCheck(this, Duration3);
_this = _super.call(this);
_this._seconds = MathUtil.safeToInt(seconds);
_this._nanos = MathUtil.safeToInt(nanos);
return _this;
}
_createClass(Duration3, [{
key: "get",
value: function get(unit) {
if (unit === ChronoUnit.SECONDS) {
return this._seconds;
} else if (unit === ChronoUnit.NANOS) {
return this._nanos;
} else {
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
}
}, {
key: "units",
value: function units() {
return [ChronoUnit.SECONDS, ChronoUnit.NANOS];
}
}, {
key: "isZero",
value: function isZero() {
return this._seconds === 0 && this._nanos === 0;
}
}, {
key: "isNegative",
value: function isNegative() {
return this._seconds < 0;
}
}, {
key: "seconds",
value: function seconds() {
return this._seconds;
}
}, {
key: "nano",
value: function nano() {
return this._nanos;
}
}, {
key: "withSeconds",
value: function withSeconds(seconds) {
return Duration3._create(seconds, this._nanos);
}
}, {
key: "withNanos",
value: function withNanos(nanoOfSecond) {
ChronoField.NANO_OF_SECOND.checkValidIntValue(nanoOfSecond);
return Duration3._create(this._seconds, nanoOfSecond);
}
}, {
key: "plusDuration",
value: function plusDuration(duration) {
requireNonNull(duration, "duration");
return this.plus(duration.seconds(), duration.nano());
}
}, {
key: "plus",
value: function plus(durationOrNumber, unitOrNumber) {
if (arguments.length === 1) {
return this.plusDuration(durationOrNumber);
} else if (arguments.length === 2 && unitOrNumber instanceof TemporalUnit) {
return this.plusAmountUnit(durationOrNumber, unitOrNumber);
} else {
return this.plusSecondsNanos(durationOrNumber, unitOrNumber);
}
}
}, {
key: "plusAmountUnit",
value: function plusAmountUnit(amountToAdd, unit) {
requireNonNull(amountToAdd, "amountToAdd");
requireNonNull(unit, "unit");
if (unit === ChronoUnit.DAYS) {
return this.plusSecondsNanos(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_DAY), 0);
}
if (unit.isDurationEstimated()) {
throw new UnsupportedTemporalTypeException("Unit must not have an estimated duration");
}
if (amountToAdd === 0) {
return this;
}
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.NANOS:
return this.plusNanos(amountToAdd);
case ChronoUnit.MICROS:
return this.plusSecondsNanos(MathUtil.intDiv(amountToAdd, 1e6 * 1e3) * 1e3, MathUtil.intMod(amountToAdd, 1e6 * 1e3) * 1e3);
case ChronoUnit.MILLIS:
return this.plusMillis(amountToAdd);
case ChronoUnit.SECONDS:
return this.plusSeconds(amountToAdd);
}
return this.plusSecondsNanos(MathUtil.safeMultiply(unit.duration().seconds(), amountToAdd), 0);
}
var duration = unit.duration().multipliedBy(amountToAdd);
return this.plusSecondsNanos(duration.seconds(), duration.nano());
}
}, {
key: "plusDays",
value: function plusDays(daysToAdd) {
return this.plusSecondsNanos(MathUtil.safeMultiply(daysToAdd, LocalTime.SECONDS_PER_DAY), 0);
}
}, {
key: "plusHours",
value: function plusHours(hoursToAdd) {
return this.plusSecondsNanos(MathUtil.safeMultiply(hoursToAdd, LocalTime.SECONDS_PER_HOUR), 0);
}
}, {
key: "plusMinutes",
value: function plusMinutes(minutesToAdd) {
return this.plusSecondsNanos(MathUtil.safeMultiply(minutesToAdd, LocalTime.SECONDS_PER_MINUTE), 0);
}
}, {
key: "plusSeconds",
value: function plusSeconds(secondsToAdd) {
return this.plusSecondsNanos(secondsToAdd, 0);
}
}, {
key: "plusMillis",
value: function plusMillis(millisToAdd) {
return this.plusSecondsNanos(MathUtil.intDiv(millisToAdd, 1e3), MathUtil.intMod(millisToAdd, 1e3) * 1e6);
}
}, {
key: "plusNanos",
value: function plusNanos(nanosToAdd) {
return this.plusSecondsNanos(0, nanosToAdd);
}
}, {
key: "plusSecondsNanos",
value: function plusSecondsNanos(secondsToAdd, nanosToAdd) {
requireNonNull(secondsToAdd, "secondsToAdd");
requireNonNull(nanosToAdd, "nanosToAdd");
if (secondsToAdd === 0 && nanosToAdd === 0) {
return this;
}
var epochSec = MathUtil.safeAdd(this._seconds, secondsToAdd);
epochSec = MathUtil.safeAdd(epochSec, MathUtil.intDiv(nanosToAdd, LocalTime.NANOS_PER_SECOND));
nanosToAdd = MathUtil.intMod(nanosToAdd, LocalTime.NANOS_PER_SECOND);
var nanoAdjustment = MathUtil.safeAdd(this._nanos, nanosToAdd);
return Duration3.ofSeconds(epochSec, nanoAdjustment);
}
}, {
key: "minus",
value: function minus(durationOrNumber, unit) {
if (arguments.length === 1) {
return this.minusDuration(durationOrNumber);
} else {
return this.minusAmountUnit(durationOrNumber, unit);
}
}
}, {
key: "minusDuration",
value: function minusDuration(duration) {
requireNonNull(duration, "duration");
var secsToSubtract = duration.seconds();
var nanosToSubtract = duration.nano();
if (secsToSubtract === MIN_SAFE_INTEGER) {
return this.plus(MAX_SAFE_INTEGER, -nanosToSubtract);
}
return this.plus(-secsToSubtract, -nanosToSubtract);
}
}, {
key: "minusAmountUnit",
value: function minusAmountUnit(amountToSubtract, unit) {
requireNonNull(amountToSubtract, "amountToSubtract");
requireNonNull(unit, "unit");
return amountToSubtract === MIN_SAFE_INTEGER ? this.plusAmountUnit(MAX_SAFE_INTEGER, unit) : this.plusAmountUnit(-amountToSubtract, unit);
}
}, {
key: "minusDays",
value: function minusDays(daysToSubtract) {
return daysToSubtract === MIN_SAFE_INTEGER ? this.plusDays(MAX_SAFE_INTEGER) : this.plusDays(-daysToSubtract);
}
}, {
key: "minusHours",
value: function minusHours(hoursToSubtract) {
return hoursToSubtract === MIN_SAFE_INTEGER ? this.plusHours(MAX_SAFE_INTEGER) : this.plusHours(-hoursToSubtract);
}
}, {
key: "minusMinutes",
value: function minusMinutes(minutesToSubtract) {
return minutesToSubtract === MIN_SAFE_INTEGER ? this.plusMinutes(MAX_SAFE_INTEGER) : this.plusMinutes(-minutesToSubtract);
}
}, {
key: "minusSeconds",
value: function minusSeconds(secondsToSubtract) {
return secondsToSubtract === MIN_SAFE_INTEGER ? this.plusSeconds(MAX_SAFE_INTEGER) : this.plusSeconds(-secondsToSubtract);
}
}, {
key: "minusMillis",
value: function minusMillis(millisToSubtract) {
return millisToSubtract === MIN_SAFE_INTEGER ? this.plusMillis(MAX_SAFE_INTEGER) : this.plusMillis(-millisToSubtract);
}
}, {
key: "minusNanos",
value: function minusNanos(nanosToSubtract) {
return nanosToSubtract === MIN_SAFE_INTEGER ? this.plusNanos(MAX_SAFE_INTEGER) : this.plusNanos(-nanosToSubtract);
}
}, {
key: "multipliedBy",
value: function multipliedBy(multiplicand) {
if (multiplicand === 0) {
return Duration3.ZERO;
}
if (multiplicand === 1) {
return this;
}
var secs = MathUtil.safeMultiply(this._seconds, multiplicand);
var nos = MathUtil.safeMultiply(this._nanos, multiplicand);
secs = secs + MathUtil.intDiv(nos, LocalTime.NANOS_PER_SECOND);
nos = MathUtil.intMod(nos, LocalTime.NANOS_PER_SECOND);
return Duration3.ofSeconds(secs, nos);
}
}, {
key: "dividedBy",
value: function dividedBy(divisor) {
if (divisor === 0) {
throw new ArithmeticException("Cannot divide by zero");
}
if (divisor === 1) {
return this;
}
var secs = MathUtil.intDiv(this._seconds, divisor);
var secsMod = MathUtil.roundDown((this._seconds / divisor - secs) * LocalTime.NANOS_PER_SECOND);
var nos = MathUtil.intDiv(this._nanos, divisor);
nos = secsMod + nos;
return Duration3.ofSeconds(secs, nos);
}
}, {
key: "negated",
value: function negated() {
return this.multipliedBy(-1);
}
}, {
key: "abs",
value: function abs() {
return this.isNegative() ? this.negated() : this;
}
}, {
key: "addTo",
value: function addTo(temporal) {
requireNonNull(temporal, "temporal");
if (this._seconds !== 0) {
temporal = temporal.plus(this._seconds, ChronoUnit.SECONDS);
}
if (this._nanos !== 0) {
temporal = temporal.plus(this._nanos, ChronoUnit.NANOS);
}
return temporal;
}
}, {
key: "subtractFrom",
value: function subtractFrom(temporal) {
requireNonNull(temporal, "temporal");
if (this._seconds !== 0) {
temporal = temporal.minus(this._seconds, ChronoUnit.SECONDS);
}
if (this._nanos !== 0) {
temporal = temporal.minus(this._nanos, ChronoUnit.NANOS);
}
return temporal;
}
}, {
key: "toDays",
value: function toDays() {
return MathUtil.intDiv(this._seconds, LocalTime.SECONDS_PER_DAY);
}
}, {
key: "toHours",
value: function toHours() {
return MathUtil.intDiv(this._seconds, LocalTime.SECONDS_PER_HOUR);
}
}, {
key: "toMinutes",
value: function toMinutes() {
return MathUtil.intDiv(this._seconds, LocalTime.SECONDS_PER_MINUTE);
}
}, {
key: "toMillis",
value: function toMillis() {
var millis = Math.round(MathUtil.safeMultiply(this._seconds, 1e3));
millis = MathUtil.safeAdd(millis, MathUtil.intDiv(this._nanos, 1e6));
return millis;
}
}, {
key: "toNanos",
value: function toNanos() {
var totalNanos = MathUtil.safeMultiply(this._seconds, LocalTime.NANOS_PER_SECOND);
totalNanos = MathUtil.safeAdd(totalNanos, this._nanos);
return totalNanos;
}
}, {
key: "compareTo",
value: function compareTo(otherDuration) {
requireNonNull(otherDuration, "otherDuration");
requireInstance(otherDuration, Duration3, "otherDuration");
var cmp = MathUtil.compareNumbers(this._seconds, otherDuration.seconds());
if (cmp !== 0) {
return cmp;
}
return this._nanos - otherDuration.nano();
}
}, {
key: "equals",
value: function equals(otherDuration) {
if (this === otherDuration) {
return true;
}
if (otherDuration instanceof Duration3) {
return this.seconds() === otherDuration.seconds() && this.nano() === otherDuration.nano();
}
return false;
}
}, {
key: "toString",
value: function toString() {
if (this === Duration3.ZERO) {
return "PT0S";
}
var hours = MathUtil.intDiv(this._seconds, LocalTime.SECONDS_PER_HOUR);
var minutes = MathUtil.intDiv(MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_HOUR), LocalTime.SECONDS_PER_MINUTE);
var secs = MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_MINUTE);
var rval = "PT";
if (hours !== 0) {
rval += "".concat(hours, "H");
}
if (minutes !== 0) {
rval += "".concat(minutes, "M");
}
if (secs === 0 && this._nanos === 0 && rval.length > 2) {
return rval;
}
if (secs < 0 && this._nanos > 0) {
if (secs === -1) {
rval += "-0";
} else {
rval += secs + 1;
}
} else {
rval += secs;
}
if (this._nanos > 0) {
rval += ".";
var nanoString;
if (secs < 0) {
nanoString = "".concat(2 * LocalTime.NANOS_PER_SECOND - this._nanos);
} else {
nanoString = "".concat(LocalTime.NANOS_PER_SECOND + this._nanos);
}
nanoString = nanoString.slice(1, nanoString.length);
rval += nanoString;
while (rval.charAt(rval.length - 1) === "0") {
rval = rval.slice(0, rval.length - 1);
}
}
rval += "S";
return rval;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "ofDays",
value: function ofDays(days) {
return Duration3._create(MathUtil.safeMultiply(days, LocalTime.SECONDS_PER_DAY), 0);
}
}, {
key: "ofHours",
value: function ofHours(hours) {
return Duration3._create(MathUtil.safeMultiply(hours, LocalTime.SECONDS_PER_HOUR), 0);
}
}, {
key: "ofMinutes",
value: function ofMinutes(minutes) {
return Duration3._create(MathUtil.safeMultiply(minutes, LocalTime.SECONDS_PER_MINUTE), 0);
}
}, {
key: "ofSeconds",
value: function ofSeconds(seconds) {
var nanoAdjustment = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var secs = MathUtil.safeAdd(seconds, MathUtil.floorDiv(nanoAdjustment, LocalTime.NANOS_PER_SECOND));
var nos = MathUtil.floorMod(nanoAdjustment, LocalTime.NANOS_PER_SECOND);
return Duration3._create(secs, nos);
}
}, {
key: "ofMillis",
value: function ofMillis(millis) {
var secs = MathUtil.intDiv(millis, 1e3);
var mos = MathUtil.intMod(millis, 1e3);
if (mos < 0) {
mos += 1e3;
secs--;
}
return Duration3._create(secs, mos * 1e6);
}
}, {
key: "ofNanos",
value: function ofNanos(nanos) {
var secs = MathUtil.intDiv(nanos, LocalTime.NANOS_PER_SECOND);
var nos = MathUtil.intMod(nanos, LocalTime.NANOS_PER_SECOND);
if (nos < 0) {
nos += LocalTime.NANOS_PER_SECOND;
secs--;
}
return this._create(secs, nos);
}
}, {
key: "of",
value: function of(amount, unit) {
return Duration3.ZERO.plus(amount, unit);
}
}, {
key: "from",
value: function from(amount) {
requireNonNull(amount, "amount");
requireInstance(amount, TemporalAmount);
var duration = Duration3.ZERO;
amount.units().forEach(function(unit) {
duration = duration.plus(amount.get(unit), unit);
});
return duration;
}
}, {
key: "between",
value: function between(startInclusive, endExclusive) {
requireNonNull(startInclusive, "startInclusive");
requireNonNull(endExclusive, "endExclusive");
var secs = startInclusive.until(endExclusive, ChronoUnit.SECONDS);
var nanos = 0;
if (startInclusive.isSupported(ChronoField.NANO_OF_SECOND) && endExclusive.isSupported(ChronoField.NANO_OF_SECOND)) {
try {
var startNos = startInclusive.getLong(ChronoField.NANO_OF_SECOND);
nanos = endExclusive.getLong(ChronoField.NANO_OF_SECOND) - startNos;
if (secs > 0 && nanos < 0) {
nanos += LocalTime.NANOS_PER_SECOND;
} else if (secs < 0 && nanos > 0) {
nanos -= LocalTime.NANOS_PER_SECOND;
} else if (secs === 0 && nanos !== 0) {
var adjustedEnd = endExclusive.with(ChronoField.NANO_OF_SECOND, startNos);
secs = startInclusive.until(adjustedEnd, ChronoUnit.SECONDS);
}
} catch (e) {
}
}
return this.ofSeconds(secs, nanos);
}
}, {
key: "parse",
value: function parse2(text) {
requireNonNull(text, "text");
var PATTERN2 = new RegExp("([-+]?)P(?:([-+]?[0-9]+)D)?(T(?:([-+]?[0-9]+)H)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?", "i");
var matches = PATTERN2.exec(text);
if (matches !== null) {
if ("T" === matches[3] === false) {
var negate = "-" === matches[1];
var dayMatch = matches[2];
var hourMatch = matches[4];
var minuteMatch = matches[5];
var secondMatch = matches[6];
var fractionMatch = matches[7];
if (dayMatch != null || hourMatch != null || minuteMatch != null || secondMatch != null) {
var daysAsSecs = Duration3._parseNumber(text, dayMatch, LocalTime.SECONDS_PER_DAY, "days");
var hoursAsSecs = Duration3._parseNumber(text, hourMatch, LocalTime.SECONDS_PER_HOUR, "hours");
var minsAsSecs = Duration3._parseNumber(text, minuteMatch, LocalTime.SECONDS_PER_MINUTE, "minutes");
var seconds = Duration3._parseNumber(text, secondMatch, 1, "seconds");
var negativeSecs = secondMatch != null && secondMatch.charAt(0) === "-";
var nanos = Duration3._parseFraction(text, fractionMatch, negativeSecs ? -1 : 1);
try {
return Duration3._create(negate, daysAsSecs, hoursAsSecs, minsAsSecs, seconds, nanos);
} catch (ex) {
throw new DateTimeParseException("Text cannot be parsed to a Duration: overflow", text, 0, ex);
}
}
}
}
throw new DateTimeParseException("Text cannot be parsed to a Duration", text, 0);
}
}, {
key: "_parseNumber",
value: function _parseNumber(text, parsed, multiplier, errorText) {
if (parsed == null) {
return 0;
}
try {
if (parsed[0] === "+") {
parsed = parsed.substring(1);
}
return MathUtil.safeMultiply(parseFloat(parsed), multiplier);
} catch (ex) {
throw new DateTimeParseException("Text cannot be parsed to a Duration: ".concat(errorText), text, 0, ex);
}
}
}, {
key: "_parseFraction",
value: function _parseFraction(text, parsed, negate) {
if (parsed == null || parsed.length === 0) {
return 0;
}
parsed = "".concat(parsed, "000000000").substring(0, 9);
return parseFloat(parsed) * negate;
}
}, {
key: "_create",
value: function _create() {
if (arguments.length <= 2) {
return Duration3._createSecondsNanos(arguments[0], arguments[1]);
} else {
return Duration3._createNegateDaysHoursMinutesSecondsNanos(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
}
}
}, {
key: "_createNegateDaysHoursMinutesSecondsNanos",
value: function _createNegateDaysHoursMinutesSecondsNanos(negate, daysAsSecs, hoursAsSecs, minsAsSecs, secs, nanos) {
var seconds = MathUtil.safeAdd(daysAsSecs, MathUtil.safeAdd(hoursAsSecs, MathUtil.safeAdd(minsAsSecs, secs)));
if (negate) {
return Duration3.ofSeconds(seconds, nanos).negated();
}
return Duration3.ofSeconds(seconds, nanos);
}
}, {
key: "_createSecondsNanos",
value: function _createSecondsNanos() {
var seconds = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
var nanoAdjustment = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
if (seconds === 0 && nanoAdjustment === 0) {
return Duration3.ZERO;
}
return new Duration3(seconds, nanoAdjustment);
}
}]);
return Duration3;
}(TemporalAmount);
function _init() {
Duration2.ZERO = new Duration2(0, 0);
}
var YearConstants = function YearConstants2() {
_classCallCheck(this, YearConstants2);
};
function _init$1() {
YearConstants.MIN_VALUE = -999999;
YearConstants.MAX_VALUE = 999999;
}
var ChronoUnit = function(_TemporalUnit) {
_inherits(ChronoUnit2, _TemporalUnit);
var _super = _createSuper(ChronoUnit2);
function ChronoUnit2(name2, estimatedDuration) {
var _this;
_classCallCheck(this, ChronoUnit2);
_this = _super.call(this);
_this._name = name2;
_this._duration = estimatedDuration;
return _this;
}
_createClass(ChronoUnit2, [{
key: "duration",
value: function duration() {
return this._duration;
}
}, {
key: "isDurationEstimated",
value: function isDurationEstimated() {
return this.isDateBased() || this === ChronoUnit2.FOREVER;
}
}, {
key: "isDateBased",
value: function isDateBased() {
return this.compareTo(ChronoUnit2.DAYS) >= 0 && this !== ChronoUnit2.FOREVER;
}
}, {
key: "isTimeBased",
value: function isTimeBased() {
return this.compareTo(ChronoUnit2.DAYS) < 0;
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
if (this === ChronoUnit2.FOREVER) {
return false;
}
try {
temporal.plus(1, this);
return true;
} catch (e) {
try {
temporal.plus(-1, this);
return true;
} catch (e2) {
return false;
}
}
}
}, {
key: "addTo",
value: function addTo(temporal, amount) {
return temporal.plus(amount, this);
}
}, {
key: "between",
value: function between(temporal1, temporal2) {
return temporal1.until(temporal2, this);
}
}, {
key: "toString",
value: function toString() {
return this._name;
}
}, {
key: "compareTo",
value: function compareTo(other) {
return this.duration().compareTo(other.duration());
}
}]);
return ChronoUnit2;
}(TemporalUnit);
function _init$2() {
ChronoUnit.NANOS = new ChronoUnit("Nanos", Duration2.ofNanos(1));
ChronoUnit.MICROS = new ChronoUnit("Micros", Duration2.ofNanos(1e3));
ChronoUnit.MILLIS = new ChronoUnit("Millis", Duration2.ofNanos(1e6));
ChronoUnit.SECONDS = new ChronoUnit("Seconds", Duration2.ofSeconds(1));
ChronoUnit.MINUTES = new ChronoUnit("Minutes", Duration2.ofSeconds(60));
ChronoUnit.HOURS = new ChronoUnit("Hours", Duration2.ofSeconds(3600));
ChronoUnit.HALF_DAYS = new ChronoUnit("HalfDays", Duration2.ofSeconds(43200));
ChronoUnit.DAYS = new ChronoUnit("Days", Duration2.ofSeconds(86400));
ChronoUnit.WEEKS = new ChronoUnit("Weeks", Duration2.ofSeconds(7 * 86400));
ChronoUnit.MONTHS = new ChronoUnit("Months", Duration2.ofSeconds(31556952 / 12));
ChronoUnit.YEARS = new ChronoUnit("Years", Duration2.ofSeconds(31556952));
ChronoUnit.DECADES = new ChronoUnit("Decades", Duration2.ofSeconds(31556952 * 10));
ChronoUnit.CENTURIES = new ChronoUnit("Centuries", Duration2.ofSeconds(31556952 * 100));
ChronoUnit.MILLENNIA = new ChronoUnit("Millennia", Duration2.ofSeconds(31556952 * 1e3));
ChronoUnit.ERAS = new ChronoUnit("Eras", Duration2.ofSeconds(31556952 * (YearConstants.MAX_VALUE + 1)));
ChronoUnit.FOREVER = new ChronoUnit("Forever", Duration2.ofSeconds(MathUtil.MAX_SAFE_INTEGER, 999999999));
}
var TemporalField = function() {
function TemporalField2() {
_classCallCheck(this, TemporalField2);
}
_createClass(TemporalField2, [{
key: "isDateBased",
value: function isDateBased() {
abstractMethodFail("isDateBased");
}
}, {
key: "isTimeBased",
value: function isTimeBased() {
abstractMethodFail("isTimeBased");
}
}, {
key: "baseUnit",
value: function baseUnit() {
abstractMethodFail("baseUnit");
}
}, {
key: "rangeUnit",
value: function rangeUnit() {
abstractMethodFail("rangeUnit");
}
}, {
key: "range",
value: function range() {
abstractMethodFail("range");
}
}, {
key: "rangeRefinedBy",
value: function rangeRefinedBy(temporal) {
abstractMethodFail("rangeRefinedBy");
}
}, {
key: "getFrom",
value: function getFrom(temporal) {
abstractMethodFail("getFrom");
}
}, {
key: "adjustInto",
value: function adjustInto(temporal, newValue) {
abstractMethodFail("adjustInto");
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
abstractMethodFail("isSupportedBy");
}
}, {
key: "displayName",
value: function displayName() {
abstractMethodFail("displayName");
}
}, {
key: "equals",
value: function equals(other) {
abstractMethodFail("equals");
}
}, {
key: "name",
value: function name2() {
abstractMethodFail("name");
}
}]);
return TemporalField2;
}();
var ValueRange = function() {
function ValueRange2(minSmallest, minLargest, maxSmallest, maxLargest) {
_classCallCheck(this, ValueRange2);
assert(!(minSmallest > minLargest), "Smallest minimum value '".concat(minSmallest, "' must be less than largest minimum value '").concat(minLargest, "'"), IllegalArgumentException);
assert(!(maxSmallest > maxLargest), "Smallest maximum value '".concat(maxSmallest, "' must be less than largest maximum value '").concat(maxLargest, "'"), IllegalArgumentException);
assert(!(minLargest > maxLargest), "Minimum value '".concat(minLargest, "' must be less than maximum value '").concat(maxLargest, "'"), IllegalArgumentException);
this._minSmallest = minSmallest;
this._minLargest = minLargest;
this._maxLargest = maxLargest;
this._maxSmallest = maxSmallest;
}
_createClass(ValueRange2, [{
key: "isFixed",
value: function isFixed() {
return this._minSmallest === this._minLargest && this._maxSmallest === this._maxLargest;
}
}, {
key: "minimum",
value: function minimum() {
return this._minSmallest;
}
}, {
key: "largestMinimum",
value: function largestMinimum() {
return this._minLargest;
}
}, {
key: "maximum",
value: function maximum() {
return this._maxLargest;
}
}, {
key: "smallestMaximum",
value: function smallestMaximum() {
return this._maxSmallest;
}
}, {
key: "isValidValue",
value: function isValidValue(value) {
return this.minimum() <= value && value <= this.maximum();
}
}, {
key: "checkValidValue",
value: function checkValidValue(value, field) {
var msg;
if (!this.isValidValue(value)) {
if (field != null) {
msg = "Invalid value for ".concat(field, " (valid values ").concat(this.toString(), "): ").concat(value);
} else {
msg = "Invalid value (valid values ".concat(this.toString(), "): ").concat(value);
}
return assert(false, msg, DateTimeException);
}
return value;
}
}, {
key: "checkValidIntValue",
value: function checkValidIntValue(value, field) {
if (this.isValidIntValue(value) === false) {
throw new DateTimeException("Invalid int value for ".concat(field, ": ").concat(value));
}
return value;
}
}, {
key: "isValidIntValue",
value: function isValidIntValue(value) {
return this.isIntValue() && this.isValidValue(value);
}
}, {
key: "isIntValue",
value: function isIntValue() {
return this.minimum() >= MathUtil.MIN_SAFE_INTEGER && this.maximum() <= MathUtil.MAX_SAFE_INTEGER;
}
}, {
key: "equals",
value: function equals(other) {
if (other === this) {
return true;
}
if (other instanceof ValueRange2) {
return this._minSmallest === other._minSmallest && this._minLargest === other._minLargest && this._maxSmallest === other._maxSmallest && this._maxLargest === other._maxLargest;
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return MathUtil.hashCode(this._minSmallest, this._minLargest, this._maxSmallest, this._maxLargest);
}
}, {
key: "toString",
value: function toString() {
var str = this.minimum() + (this.minimum() !== this.largestMinimum() ? "/".concat(this.largestMinimum()) : "");
str += " - ";
str += this.smallestMaximum() + (this.smallestMaximum() !== this.maximum() ? "/".concat(this.maximum()) : "");
return str;
}
}], [{
key: "of",
value: function of() {
if (arguments.length === 2) {
return new ValueRange2(arguments[0], arguments[0], arguments[1], arguments[1]);
} else if (arguments.length === 3) {
return new ValueRange2(arguments[0], arguments[0], arguments[1], arguments[2]);
} else if (arguments.length === 4) {
return new ValueRange2(arguments[0], arguments[1], arguments[2], arguments[3]);
} else {
return assert(false, "Invalid number of arguments ".concat(arguments.length), IllegalArgumentException);
}
}
}]);
return ValueRange2;
}();
var ChronoField = function(_TemporalField) {
_inherits(ChronoField2, _TemporalField);
var _super = _createSuper(ChronoField2);
function ChronoField2(name2, baseUnit, rangeUnit, range) {
var _this;
_classCallCheck(this, ChronoField2);
_this = _super.call(this);
_this._name = name2;
_this._baseUnit = baseUnit;
_this._rangeUnit = rangeUnit;
_this._range = range;
return _this;
}
_createClass(ChronoField2, [{
key: "name",
value: function name2() {
return this._name;
}
}, {
key: "baseUnit",
value: function baseUnit() {
return this._baseUnit;
}
}, {
key: "rangeUnit",
value: function rangeUnit() {
return this._rangeUnit;
}
}, {
key: "range",
value: function range() {
return this._range;
}
}, {
key: "displayName",
value: function displayName() {
return this.toString();
}
}, {
key: "checkValidValue",
value: function checkValidValue(value) {
return this.range().checkValidValue(value, this);
}
}, {
key: "checkValidIntValue",
value: function checkValidIntValue(value) {
return this.range().checkValidIntValue(value, this);
}
}, {
key: "isDateBased",
value: function isDateBased() {
var dateBased = this === ChronoField2.DAY_OF_WEEK || this === ChronoField2.ALIGNED_DAY_OF_WEEK_IN_MONTH || this === ChronoField2.ALIGNED_DAY_OF_WEEK_IN_YEAR || this === ChronoField2.DAY_OF_MONTH || this === ChronoField2.DAY_OF_YEAR || this === ChronoField2.EPOCH_DAY || this === ChronoField2.ALIGNED_WEEK_OF_MONTH || this === ChronoField2.ALIGNED_WEEK_OF_YEAR || this === ChronoField2.MONTH_OF_YEAR || this === ChronoField2.YEAR_OF_ERA || this === ChronoField2.YEAR || this === ChronoField2.ERA;
return dateBased;
}
}, {
key: "isTimeBased",
value: function isTimeBased() {
var timeBased = this === ChronoField2.NANO_OF_SECOND || this === ChronoField2.NANO_OF_DAY || this === ChronoField2.MICRO_OF_SECOND || this === ChronoField2.MICRO_OF_DAY || this === ChronoField2.MILLI_OF_SECOND || this === ChronoField2.MILLI_OF_DAY || this === ChronoField2.SECOND_OF_MINUTE || this === ChronoField2.SECOND_OF_DAY || this === ChronoField2.MINUTE_OF_HOUR || this === ChronoField2.MINUTE_OF_DAY || this === ChronoField2.HOUR_OF_AMPM || this === ChronoField2.CLOCK_HOUR_OF_AMPM || this === ChronoField2.HOUR_OF_DAY || this === ChronoField2.CLOCK_HOUR_OF_DAY || this === ChronoField2.AMPM_OF_DAY;
return timeBased;
}
}, {
key: "rangeRefinedBy",
value: function rangeRefinedBy(temporal) {
return temporal.range(this);
}
}, {
key: "getFrom",
value: function getFrom(temporal) {
return temporal.getLong(this);
}
}, {
key: "toString",
value: function toString() {
return this.name();
}
}, {
key: "equals",
value: function equals(other) {
return this === other;
}
}, {
key: "adjustInto",
value: function adjustInto(temporal, newValue) {
return temporal.with(this, newValue);
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
return temporal.isSupported(this);
}
}], [{
key: "byName",
value: function byName(fieldName) {
for (var prop in ChronoField2) {
if (ChronoField2[prop]) {
if (ChronoField2[prop] instanceof ChronoField2 && ChronoField2[prop].name() === fieldName) {
return ChronoField2[prop];
}
}
}
}
}]);
return ChronoField2;
}(TemporalField);
function _init$3() {
ChronoField.NANO_OF_SECOND = new ChronoField("NanoOfSecond", ChronoUnit.NANOS, ChronoUnit.SECONDS, ValueRange.of(0, 999999999));
ChronoField.NANO_OF_DAY = new ChronoField("NanoOfDay", ChronoUnit.NANOS, ChronoUnit.DAYS, ValueRange.of(0, 86400 * 1e9 - 1));
ChronoField.MICRO_OF_SECOND = new ChronoField("MicroOfSecond", ChronoUnit.MICROS, ChronoUnit.SECONDS, ValueRange.of(0, 999999));
ChronoField.MICRO_OF_DAY = new ChronoField("MicroOfDay", ChronoUnit.MICROS, ChronoUnit.DAYS, ValueRange.of(0, 86400 * 1e6 - 1));
ChronoField.MILLI_OF_SECOND = new ChronoField("MilliOfSecond", ChronoUnit.MILLIS, ChronoUnit.SECONDS, ValueRange.of(0, 999));
ChronoField.MILLI_OF_DAY = new ChronoField("MilliOfDay", ChronoUnit.MILLIS, ChronoUnit.DAYS, ValueRange.of(0, 86400 * 1e3 - 1));
ChronoField.SECOND_OF_MINUTE = new ChronoField("SecondOfMinute", ChronoUnit.SECONDS, ChronoUnit.MINUTES, ValueRange.of(0, 59));
ChronoField.SECOND_OF_DAY = new ChronoField("SecondOfDay", ChronoUnit.SECONDS, ChronoUnit.DAYS, ValueRange.of(0, 86400 - 1));
ChronoField.MINUTE_OF_HOUR = new ChronoField("MinuteOfHour", ChronoUnit.MINUTES, ChronoUnit.HOURS, ValueRange.of(0, 59));
ChronoField.MINUTE_OF_DAY = new ChronoField("MinuteOfDay", ChronoUnit.MINUTES, ChronoUnit.DAYS, ValueRange.of(0, 24 * 60 - 1));
ChronoField.HOUR_OF_AMPM = new ChronoField("HourOfAmPm", ChronoUnit.HOURS, ChronoUnit.HALF_DAYS, ValueRange.of(0, 11));
ChronoField.CLOCK_HOUR_OF_AMPM = new ChronoField("ClockHourOfAmPm", ChronoUnit.HOURS, ChronoUnit.HALF_DAYS, ValueRange.of(1, 12));
ChronoField.HOUR_OF_DAY = new ChronoField("HourOfDay", ChronoUnit.HOURS, ChronoUnit.DAYS, ValueRange.of(0, 23));
ChronoField.CLOCK_HOUR_OF_DAY = new ChronoField("ClockHourOfDay", ChronoUnit.HOURS, ChronoUnit.DAYS, ValueRange.of(1, 24));
ChronoField.AMPM_OF_DAY = new ChronoField("AmPmOfDay", ChronoUnit.HALF_DAYS, ChronoUnit.DAYS, ValueRange.of(0, 1));
ChronoField.DAY_OF_WEEK = new ChronoField("DayOfWeek", ChronoUnit.DAYS, ChronoUnit.WEEKS, ValueRange.of(1, 7));
ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH = new ChronoField("AlignedDayOfWeekInMonth", ChronoUnit.DAYS, ChronoUnit.WEEKS, ValueRange.of(1, 7));
ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR = new ChronoField("AlignedDayOfWeekInYear", ChronoUnit.DAYS, ChronoUnit.WEEKS, ValueRange.of(1, 7));
ChronoField.DAY_OF_MONTH = new ChronoField("DayOfMonth", ChronoUnit.DAYS, ChronoUnit.MONTHS, ValueRange.of(1, 28, 31), "day");
ChronoField.DAY_OF_YEAR = new ChronoField("DayOfYear", ChronoUnit.DAYS, ChronoUnit.YEARS, ValueRange.of(1, 365, 366));
ChronoField.EPOCH_DAY = new ChronoField("EpochDay", ChronoUnit.DAYS, ChronoUnit.FOREVER, ValueRange.of(Math.floor(YearConstants.MIN_VALUE * 365.25), Math.floor(YearConstants.MAX_VALUE * 365.25)));
ChronoField.ALIGNED_WEEK_OF_MONTH = new ChronoField("AlignedWeekOfMonth", ChronoUnit.WEEKS, ChronoUnit.MONTHS, ValueRange.of(1, 4, 5));
ChronoField.ALIGNED_WEEK_OF_YEAR = new ChronoField("AlignedWeekOfYear", ChronoUnit.WEEKS, ChronoUnit.YEARS, ValueRange.of(1, 53));
ChronoField.MONTH_OF_YEAR = new ChronoField("MonthOfYear", ChronoUnit.MONTHS, ChronoUnit.YEARS, ValueRange.of(1, 12), "month");
ChronoField.PROLEPTIC_MONTH = new ChronoField("ProlepticMonth", ChronoUnit.MONTHS, ChronoUnit.FOREVER, ValueRange.of(YearConstants.MIN_VALUE * 12, YearConstants.MAX_VALUE * 12 + 11));
ChronoField.YEAR_OF_ERA = new ChronoField("YearOfEra", ChronoUnit.YEARS, ChronoUnit.FOREVER, ValueRange.of(1, YearConstants.MAX_VALUE, YearConstants.MAX_VALUE + 1));
ChronoField.YEAR = new ChronoField("Year", ChronoUnit.YEARS, ChronoUnit.FOREVER, ValueRange.of(YearConstants.MIN_VALUE, YearConstants.MAX_VALUE), "year");
ChronoField.ERA = new ChronoField("Era", ChronoUnit.ERAS, ChronoUnit.FOREVER, ValueRange.of(0, 1));
ChronoField.INSTANT_SECONDS = new ChronoField("InstantSeconds", ChronoUnit.SECONDS, ChronoUnit.FOREVER, ValueRange.of(MIN_SAFE_INTEGER, MAX_SAFE_INTEGER));
ChronoField.OFFSET_SECONDS = new ChronoField("OffsetSeconds", ChronoUnit.SECONDS, ChronoUnit.FOREVER, ValueRange.of(-18 * 3600, 18 * 3600));
}
var TemporalQueries = function() {
function TemporalQueries2() {
_classCallCheck(this, TemporalQueries2);
}
_createClass(TemporalQueries2, null, [{
key: "zoneId",
value: function zoneId() {
return TemporalQueries2.ZONE_ID;
}
}, {
key: "chronology",
value: function chronology() {
return TemporalQueries2.CHRONO;
}
}, {
key: "precision",
value: function precision() {
return TemporalQueries2.PRECISION;
}
}, {
key: "zone",
value: function zone() {
return TemporalQueries2.ZONE;
}
}, {
key: "offset",
value: function offset() {
return TemporalQueries2.OFFSET;
}
}, {
key: "localDate",
value: function localDate() {
return TemporalQueries2.LOCAL_DATE;
}
}, {
key: "localTime",
value: function localTime() {
return TemporalQueries2.LOCAL_TIME;
}
}]);
return TemporalQueries2;
}();
var TemporalAccessor = function() {
function TemporalAccessor2() {
_classCallCheck(this, TemporalAccessor2);
}
_createClass(TemporalAccessor2, [{
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.chronology() || _query === TemporalQueries.precision()) {
return null;
}
return _query.queryFrom(this);
}
}, {
key: "get",
value: function get(field) {
return this.range(field).checkValidIntValue(this.getLong(field), field);
}
}, {
key: "getLong",
value: function getLong(field) {
abstractMethodFail("getLong");
}
}, {
key: "range",
value: function range(field) {
if (field instanceof ChronoField) {
if (this.isSupported(field)) {
return field.range();
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.rangeRefinedBy(this);
}
}, {
key: "isSupported",
value: function isSupported(field) {
abstractMethodFail("isSupported");
}
}]);
return TemporalAccessor2;
}();
var TemporalQuery = function(_Enum) {
_inherits(TemporalQuery2, _Enum);
var _super = _createSuper(TemporalQuery2);
function TemporalQuery2() {
_classCallCheck(this, TemporalQuery2);
return _super.apply(this, arguments);
}
_createClass(TemporalQuery2, [{
key: "queryFrom",
value: function queryFrom(temporal) {
abstractMethodFail("queryFrom");
}
}]);
return TemporalQuery2;
}(Enum);
function createTemporalQuery(name2, queryFromFunction) {
var ExtendedTemporalQuery = function(_TemporalQuery) {
_inherits(ExtendedTemporalQuery2, _TemporalQuery);
var _super2 = _createSuper(ExtendedTemporalQuery2);
function ExtendedTemporalQuery2() {
_classCallCheck(this, ExtendedTemporalQuery2);
return _super2.apply(this, arguments);
}
return ExtendedTemporalQuery2;
}(TemporalQuery);
ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
return new ExtendedTemporalQuery(name2);
}
var DayOfWeek = function(_TemporalAccessor) {
_inherits(DayOfWeek2, _TemporalAccessor);
var _super = _createSuper(DayOfWeek2);
function DayOfWeek2(ordinal, name2) {
var _this;
_classCallCheck(this, DayOfWeek2);
_this = _super.call(this);
_this._ordinal = ordinal;
_this._name = name2;
return _this;
}
_createClass(DayOfWeek2, [{
key: "ordinal",
value: function ordinal() {
return this._ordinal;
}
}, {
key: "name",
value: function name2() {
return this._name;
}
}, {
key: "value",
value: function value() {
return this._ordinal + 1;
}
}, {
key: "displayName",
value: function displayName(style, locale) {
throw new IllegalArgumentException("Pattern using (localized) text not implemented yet!");
}
}, {
key: "isSupported",
value: function isSupported(field) {
if (field instanceof ChronoField) {
return field === ChronoField.DAY_OF_WEEK;
}
return field != null && field.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (field === ChronoField.DAY_OF_WEEK) {
return field.range();
} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.rangeRefinedBy(this);
}
}, {
key: "get",
value: function get(field) {
if (field === ChronoField.DAY_OF_WEEK) {
return this.value();
}
return this.range(field).checkValidIntValue(this.getLong(field), field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field === ChronoField.DAY_OF_WEEK) {
return this.value();
} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "plus",
value: function plus(days) {
var amount = MathUtil.floorMod(days, 7);
return ENUMS[MathUtil.floorMod(this._ordinal + (amount + 7), 7)];
}
}, {
key: "minus",
value: function minus(days) {
return this.plus(-1 * MathUtil.floorMod(days, 7));
}
}, {
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.precision()) {
return ChronoUnit.DAYS;
} else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zone() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.offset()) {
return null;
}
assert(_query != null, "query", NullPointerException);
return _query.queryFrom(this);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
requireNonNull(temporal, "temporal");
return temporal.with(ChronoField.DAY_OF_WEEK, this.value());
}
}, {
key: "equals",
value: function equals(other) {
return this === other;
}
}, {
key: "toString",
value: function toString() {
return this._name;
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, DayOfWeek2, "other");
return this._ordinal - other._ordinal;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "values",
value: function values() {
return ENUMS.slice();
}
}, {
key: "valueOf",
value: function valueOf(name2) {
var ordinal = 0;
for (ordinal; ordinal < ENUMS.length; ordinal++) {
if (ENUMS[ordinal].name() === name2) {
break;
}
}
return DayOfWeek2.of(ordinal + 1);
}
}, {
key: "of",
value: function of(dayOfWeek) {
if (dayOfWeek < 1 || dayOfWeek > 7) {
throw new DateTimeException("Invalid value for DayOfWeek: ".concat(dayOfWeek));
}
return ENUMS[dayOfWeek - 1];
}
}, {
key: "from",
value: function from(temporal) {
assert(temporal != null, "temporal", NullPointerException);
if (temporal instanceof DayOfWeek2) {
return temporal;
}
try {
return DayOfWeek2.of(temporal.get(ChronoField.DAY_OF_WEEK));
} catch (ex) {
if (ex instanceof DateTimeException) {
throw new DateTimeException("Unable to obtain DayOfWeek from TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""), ex);
} else {
throw ex;
}
}
}
}]);
return DayOfWeek2;
}(TemporalAccessor);
var ENUMS;
function _init$4() {
DayOfWeek.MONDAY = new DayOfWeek(0, "MONDAY");
DayOfWeek.TUESDAY = new DayOfWeek(1, "TUESDAY");
DayOfWeek.WEDNESDAY = new DayOfWeek(2, "WEDNESDAY");
DayOfWeek.THURSDAY = new DayOfWeek(3, "THURSDAY");
DayOfWeek.FRIDAY = new DayOfWeek(4, "FRIDAY");
DayOfWeek.SATURDAY = new DayOfWeek(5, "SATURDAY");
DayOfWeek.SUNDAY = new DayOfWeek(6, "SUNDAY");
DayOfWeek.FROM = createTemporalQuery("DayOfWeek.FROM", function(temporal) {
return DayOfWeek.from(temporal);
});
ENUMS = [DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY];
}
var Month = function(_TemporalAccessor) {
_inherits(Month2, _TemporalAccessor);
var _super = _createSuper(Month2);
function Month2(value, name2) {
var _this;
_classCallCheck(this, Month2);
_this = _super.call(this);
_this._value = MathUtil.safeToInt(value);
_this._name = name2;
return _this;
}
_createClass(Month2, [{
key: "value",
value: function value() {
return this._value;
}
}, {
key: "ordinal",
value: function ordinal() {
return this._value - 1;
}
}, {
key: "name",
value: function name2() {
return this._name;
}
}, {
key: "displayName",
value: function displayName(style, locale) {
throw new IllegalArgumentException("Pattern using (localized) text not implemented yet!");
}
}, {
key: "isSupported",
value: function isSupported(field) {
if (null === field) {
return false;
}
if (field instanceof ChronoField) {
return field === ChronoField.MONTH_OF_YEAR;
}
return field != null && field.isSupportedBy(this);
}
}, {
key: "get",
value: function get(field) {
if (field === ChronoField.MONTH_OF_YEAR) {
return this.value();
}
return this.range(field).checkValidIntValue(this.getLong(field), field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field === ChronoField.MONTH_OF_YEAR) {
return this.value();
} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "plus",
value: function plus(months) {
var amount = MathUtil.intMod(months, 12) + 12;
var newMonthVal = MathUtil.intMod(this.value() + amount, 12);
newMonthVal = newMonthVal === 0 ? 12 : newMonthVal;
return Month2.of(newMonthVal);
}
}, {
key: "minus",
value: function minus(months) {
return this.plus(-1 * MathUtil.intMod(months, 12));
}
}, {
key: "length",
value: function length(leapYear) {
switch (this) {
case Month2.FEBRUARY:
return leapYear ? 29 : 28;
case Month2.APRIL:
case Month2.JUNE:
case Month2.SEPTEMBER:
case Month2.NOVEMBER:
return 30;
default:
return 31;
}
}
}, {
key: "minLength",
value: function minLength() {
switch (this) {
case Month2.FEBRUARY:
return 28;
case Month2.APRIL:
case Month2.JUNE:
case Month2.SEPTEMBER:
case Month2.NOVEMBER:
return 30;
default:
return 31;
}
}
}, {
key: "maxLength",
value: function maxLength() {
switch (this) {
case Month2.FEBRUARY:
return 29;
case Month2.APRIL:
case Month2.JUNE:
case Month2.SEPTEMBER:
case Month2.NOVEMBER:
return 30;
default:
return 31;
}
}
}, {
key: "firstDayOfYear",
value: function firstDayOfYear(leapYear) {
var leap = leapYear ? 1 : 0;
switch (this) {
case Month2.JANUARY:
return 1;
case Month2.FEBRUARY:
return 32;
case Month2.MARCH:
return 60 + leap;
case Month2.APRIL:
return 91 + leap;
case Month2.MAY:
return 121 + leap;
case Month2.JUNE:
return 152 + leap;
case Month2.JULY:
return 182 + leap;
case Month2.AUGUST:
return 213 + leap;
case Month2.SEPTEMBER:
return 244 + leap;
case Month2.OCTOBER:
return 274 + leap;
case Month2.NOVEMBER:
return 305 + leap;
case Month2.DECEMBER:
default:
return 335 + leap;
}
}
}, {
key: "firstMonthOfQuarter",
value: function firstMonthOfQuarter() {
switch (this) {
case Month2.JANUARY:
case Month2.FEBRUARY:
case Month2.MARCH:
return Month2.JANUARY;
case Month2.APRIL:
case Month2.MAY:
case Month2.JUNE:
return Month2.APRIL;
case Month2.JULY:
case Month2.AUGUST:
case Month2.SEPTEMBER:
return Month2.JULY;
case Month2.OCTOBER:
case Month2.NOVEMBER:
case Month2.DECEMBER:
default:
return Month2.OCTOBER;
}
}
}, {
key: "query",
value: function query(_query) {
assert(_query != null, "query() parameter must not be null", DateTimeException);
if (_query === TemporalQueries.chronology()) {
return IsoChronology.INSTANCE;
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.MONTHS;
}
return _get(_getPrototypeOf(Month2.prototype), "query", this).call(this, _query);
}
}, {
key: "toString",
value: function toString() {
switch (this) {
case Month2.JANUARY:
return "JANUARY";
case Month2.FEBRUARY:
return "FEBRUARY";
case Month2.MARCH:
return "MARCH";
case Month2.APRIL:
return "APRIL";
case Month2.MAY:
return "MAY";
case Month2.JUNE:
return "JUNE";
case Month2.JULY:
return "JULY";
case Month2.AUGUST:
return "AUGUST";
case Month2.SEPTEMBER:
return "SEPTEMBER";
case Month2.OCTOBER:
return "OCTOBER";
case Month2.NOVEMBER:
return "NOVEMBER";
case Month2.DECEMBER:
return "DECEMBER";
default:
return "unknown Month, value: ".concat(this.value());
}
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(ChronoField.MONTH_OF_YEAR, this.value());
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, Month2, "other");
return this._value - other._value;
}
}, {
key: "equals",
value: function equals(other) {
return this === other;
}
}], [{
key: "valueOf",
value: function valueOf(name2) {
var ordinal = 0;
for (ordinal; ordinal < MONTHS.length; ordinal++) {
if (MONTHS[ordinal].name() === name2) {
break;
}
}
return Month2.of(ordinal + 1);
}
}, {
key: "values",
value: function values() {
return MONTHS.slice();
}
}, {
key: "of",
value: function of(month) {
if (month < 1 || month > 12) {
assert(false, "Invalid value for MonthOfYear: ".concat(month), DateTimeException);
}
return MONTHS[month - 1];
}
}, {
key: "from",
value: function from(temporal) {
if (temporal instanceof Month2) {
return temporal;
}
try {
return Month2.of(temporal.get(ChronoField.MONTH_OF_YEAR));
} catch (ex) {
throw new DateTimeException("Unable to obtain Month from TemporalAccessor: ".concat(temporal, " of type ").concat(temporal && temporal.constructor != null ? temporal.constructor.name : ""), ex);
}
}
}]);
return Month2;
}(TemporalAccessor);
var MONTHS;
function _init$5() {
Month.JANUARY = new Month(1, "JANUARY");
Month.FEBRUARY = new Month(2, "FEBRUARY");
Month.MARCH = new Month(3, "MARCH");
Month.APRIL = new Month(4, "APRIL");
Month.MAY = new Month(5, "MAY");
Month.JUNE = new Month(6, "JUNE");
Month.JULY = new Month(7, "JULY");
Month.AUGUST = new Month(8, "AUGUST");
Month.SEPTEMBER = new Month(9, "SEPTEMBER");
Month.OCTOBER = new Month(10, "OCTOBER");
Month.NOVEMBER = new Month(11, "NOVEMBER");
Month.DECEMBER = new Month(12, "DECEMBER");
MONTHS = [Month.JANUARY, Month.FEBRUARY, Month.MARCH, Month.APRIL, Month.MAY, Month.JUNE, Month.JULY, Month.AUGUST, Month.SEPTEMBER, Month.OCTOBER, Month.NOVEMBER, Month.DECEMBER];
}
var PATTERN = /([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?/;
var Period = function(_TemporalAmount) {
_inherits(Period2, _TemporalAmount);
var _super = _createSuper(Period2);
function Period2(years, months, days) {
var _this;
_classCallCheck(this, Period2);
_this = _super.call(this);
var _years = MathUtil.safeToInt(years);
var _months = MathUtil.safeToInt(months);
var _days = MathUtil.safeToInt(days);
if (_years === 0 && _months === 0 && _days === 0) {
if (!Period2.ZERO) {
_this._years = _years;
_this._months = _months;
_this._days = _days;
Period2.ZERO = _assertThisInitialized(_this);
}
return _possibleConstructorReturn(_this, Period2.ZERO);
}
_this._years = _years;
_this._months = _months;
_this._days = _days;
return _this;
}
_createClass(Period2, [{
key: "units",
value: function units() {
return [ChronoUnit.YEARS, ChronoUnit.MONTHS, ChronoUnit.DAYS];
}
}, {
key: "chronology",
value: function chronology() {
return IsoChronology.INSTANCE;
}
}, {
key: "get",
value: function get(unit) {
if (unit === ChronoUnit.YEARS) {
return this._years;
}
if (unit === ChronoUnit.MONTHS) {
return this._months;
}
if (unit === ChronoUnit.DAYS) {
return this._days;
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
}, {
key: "isZero",
value: function isZero() {
return this === Period2.ZERO;
}
}, {
key: "isNegative",
value: function isNegative() {
return this._years < 0 || this._months < 0 || this._days < 0;
}
}, {
key: "years",
value: function years() {
return this._years;
}
}, {
key: "months",
value: function months() {
return this._months;
}
}, {
key: "days",
value: function days() {
return this._days;
}
}, {
key: "withYears",
value: function withYears(years) {
if (years === this._years) {
return this;
}
return Period2.create(years, this._months, this._days);
}
}, {
key: "withMonths",
value: function withMonths(months) {
if (months === this._months) {
return this;
}
return Period2.create(this._years, months, this._days);
}
}, {
key: "withDays",
value: function withDays(days) {
if (days === this._days) {
return this;
}
return Period2.create(this._years, this._months, days);
}
}, {
key: "plus",
value: function plus(amountToAdd) {
var amount = Period2.from(amountToAdd);
return Period2.create(MathUtil.safeAdd(this._years, amount._years), MathUtil.safeAdd(this._months, amount._months), MathUtil.safeAdd(this._days, amount._days));
}
}, {
key: "plusYears",
value: function plusYears(yearsToAdd) {
if (yearsToAdd === 0) {
return this;
}
return Period2.create(MathUtil.safeToInt(MathUtil.safeAdd(this._years, yearsToAdd)), this._months, this._days);
}
}, {
key: "plusMonths",
value: function plusMonths(monthsToAdd) {
if (monthsToAdd === 0) {
return this;
}
return Period2.create(this._years, MathUtil.safeToInt(MathUtil.safeAdd(this._months, monthsToAdd)), this._days);
}
}, {
key: "plusDays",
value: function plusDays(daysToAdd) {
if (daysToAdd === 0) {
return this;
}
return Period2.create(this._years, this._months, MathUtil.safeToInt(MathUtil.safeAdd(this._days, daysToAdd)));
}
}, {
key: "minus",
value: function minus(amountToSubtract) {
var amount = Period2.from(amountToSubtract);
return Period2.create(MathUtil.safeSubtract(this._years, amount._years), MathUtil.safeSubtract(this._months, amount._months), MathUtil.safeSubtract(this._days, amount._days));
}
}, {
key: "minusYears",
value: function minusYears(yearsToSubtract) {
return this.plusYears(-1 * yearsToSubtract);
}
}, {
key: "minusMonths",
value: function minusMonths(monthsToSubtract) {
return this.plusMonths(-1 * monthsToSubtract);
}
}, {
key: "minusDays",
value: function minusDays(daysToSubtract) {
return this.plusDays(-1 * daysToSubtract);
}
}, {
key: "multipliedBy",
value: function multipliedBy(scalar) {
if (this === Period2.ZERO || scalar === 1) {
return this;
}
return Period2.create(MathUtil.safeMultiply(this._years, scalar), MathUtil.safeMultiply(this._months, scalar), MathUtil.safeMultiply(this._days, scalar));
}
}, {
key: "negated",
value: function negated() {
return this.multipliedBy(-1);
}
}, {
key: "normalized",
value: function normalized() {
var totalMonths = this.toTotalMonths();
var splitYears = MathUtil.intDiv(totalMonths, 12);
var splitMonths = MathUtil.intMod(totalMonths, 12);
if (splitYears === this._years && splitMonths === this._months) {
return this;
}
return Period2.create(MathUtil.safeToInt(splitYears), splitMonths, this._days);
}
}, {
key: "toTotalMonths",
value: function toTotalMonths() {
return this._years * 12 + this._months;
}
}, {
key: "addTo",
value: function addTo(temporal) {
requireNonNull(temporal, "temporal");
if (this._years !== 0) {
if (this._months !== 0) {
temporal = temporal.plus(this.toTotalMonths(), ChronoUnit.MONTHS);
} else {
temporal = temporal.plus(this._years, ChronoUnit.YEARS);
}
} else if (this._months !== 0) {
temporal = temporal.plus(this._months, ChronoUnit.MONTHS);
}
if (this._days !== 0) {
temporal = temporal.plus(this._days, ChronoUnit.DAYS);
}
return temporal;
}
}, {
key: "subtractFrom",
value: function subtractFrom(temporal) {
requireNonNull(temporal, "temporal");
if (this._years !== 0) {
if (this._months !== 0) {
temporal = temporal.minus(this.toTotalMonths(), ChronoUnit.MONTHS);
} else {
temporal = temporal.minus(this._years, ChronoUnit.YEARS);
}
} else if (this._months !== 0) {
temporal = temporal.minus(this._months, ChronoUnit.MONTHS);
}
if (this._days !== 0) {
temporal = temporal.minus(this._days, ChronoUnit.DAYS);
}
return temporal;
}
}, {
key: "equals",
value: function equals(obj) {
if (this === obj) {
return true;
}
if (obj instanceof Period2) {
var other = obj;
return this._years === other._years && this._months === other._months && this._days === other._days;
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return MathUtil.hashCode(this._years, this._months, this._days);
}
}, {
key: "toString",
value: function toString() {
if (this === Period2.ZERO) {
return "P0D";
} else {
var buf = "P";
if (this._years !== 0) {
buf += "".concat(this._years, "Y");
}
if (this._months !== 0) {
buf += "".concat(this._months, "M");
}
if (this._days !== 0) {
buf += "".concat(this._days, "D");
}
return buf;
}
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "ofYears",
value: function ofYears(years) {
return Period2.create(years, 0, 0);
}
}, {
key: "ofMonths",
value: function ofMonths(months) {
return Period2.create(0, months, 0);
}
}, {
key: "ofWeeks",
value: function ofWeeks(weeks) {
return Period2.create(0, 0, MathUtil.safeMultiply(weeks, 7));
}
}, {
key: "ofDays",
value: function ofDays(days) {
return Period2.create(0, 0, days);
}
}, {
key: "of",
value: function of(years, months, days) {
return Period2.create(years, months, days);
}
}, {
key: "from",
value: function from(amount) {
if (amount instanceof Period2) {
return amount;
}
requireNonNull(amount, "amount");
var years = 0;
var months = 0;
var days = 0;
var units = amount.units();
for (var i = 0; i < units.length; i++) {
var unit = units[i];
var unitAmount = amount.get(unit);
if (unit === ChronoUnit.YEARS) {
years = MathUtil.safeToInt(unitAmount);
} else if (unit === ChronoUnit.MONTHS) {
months = MathUtil.safeToInt(unitAmount);
} else if (unit === ChronoUnit.DAYS) {
days = MathUtil.safeToInt(unitAmount);
} else {
throw new DateTimeException("Unit must be Years, Months or Days, but was ".concat(unit));
}
}
return Period2.create(years, months, days);
}
}, {
key: "between",
value: function between(startDate, endDate) {
requireNonNull(startDate, "startDate");
requireNonNull(endDate, "endDate");
requireInstance(startDate, LocalDate, "startDate");
requireInstance(endDate, LocalDate, "endDate");
return startDate.until(endDate);
}
}, {
key: "parse",
value: function parse2(text) {
requireNonNull(text, "text");
try {
return Period2._parse(text);
} catch (ex) {
if (ex instanceof ArithmeticException) {
throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex);
} else {
throw ex;
}
}
}
}, {
key: "_parse",
value: function _parse(text) {
var matches = PATTERN.exec(text);
if (matches != null) {
var negate = "-" === matches[1] ? -1 : 1;
var yearMatch = matches[2];
var monthMatch = matches[3];
var weekMatch = matches[4];
var dayMatch = matches[5];
if (yearMatch != null || monthMatch != null || weekMatch != null || dayMatch != null) {
var years = Period2._parseNumber(text, yearMatch, negate);
var months = Period2._parseNumber(text, monthMatch, negate);
var weeks = Period2._parseNumber(text, weekMatch, negate);
var days = Period2._parseNumber(text, dayMatch, negate);
days = MathUtil.safeAdd(days, MathUtil.safeMultiply(weeks, 7));
return Period2.create(years, months, days);
}
}
throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0);
}
}, {
key: "_parseNumber",
value: function _parseNumber(text, str, negate) {
if (str == null) {
return 0;
}
var val = MathUtil.parseInt(str);
return MathUtil.safeMultiply(val, negate);
}
}, {
key: "create",
value: function create(years, months, days) {
return new Period2(years, months, days);
}
}]);
return Period2;
}(TemporalAmount);
function _init$6() {
Period.ofDays(0);
}
var ParsePosition = function() {
function ParsePosition2(index) {
_classCallCheck(this, ParsePosition2);
this._index = index;
this._errorIndex = -1;
}
_createClass(ParsePosition2, [{
key: "getIndex",
value: function getIndex() {
return this._index;
}
}, {
key: "setIndex",
value: function setIndex(index) {
this._index = index;
}
}, {
key: "getErrorIndex",
value: function getErrorIndex() {
return this._errorIndex;
}
}, {
key: "setErrorIndex",
value: function setErrorIndex(errorIndex) {
this._errorIndex = errorIndex;
}
}]);
return ParsePosition2;
}();
var EnumMap = function() {
function EnumMap2() {
_classCallCheck(this, EnumMap2);
this._map = {};
}
_createClass(EnumMap2, [{
key: "putAll",
value: function putAll(otherMap) {
for (var key in otherMap._map) {
this._map[key] = otherMap._map[key];
}
return this;
}
}, {
key: "containsKey",
value: function containsKey(key) {
return this._map.hasOwnProperty(key.name()) && this.get(key) !== void 0;
}
}, {
key: "get",
value: function get(key) {
return this._map[key.name()];
}
}, {
key: "put",
value: function put(key, val) {
return this.set(key, val);
}
}, {
key: "set",
value: function set(key, val) {
this._map[key.name()] = val;
return this;
}
}, {
key: "retainAll",
value: function retainAll(keyList) {
var map = {};
for (var i = 0; i < keyList.length; i++) {
var key = keyList[i].name();
map[key] = this._map[key];
}
this._map = map;
return this;
}
}, {
key: "remove",
value: function remove(key) {
var keyName = key.name();
var val = this._map[keyName];
this._map[keyName] = void 0;
return val;
}
}, {
key: "keySet",
value: function keySet() {
return this._map;
}
}, {
key: "clear",
value: function clear() {
this._map = {};
}
}]);
return EnumMap2;
}();
var ResolverStyle = function(_Enum) {
_inherits(ResolverStyle2, _Enum);
var _super = _createSuper(ResolverStyle2);
function ResolverStyle2() {
_classCallCheck(this, ResolverStyle2);
return _super.apply(this, arguments);
}
return ResolverStyle2;
}(Enum);
ResolverStyle.STRICT = new ResolverStyle("STRICT");
ResolverStyle.SMART = new ResolverStyle("SMART");
ResolverStyle.LENIENT = new ResolverStyle("LENIENT");
var Temporal = function(_TemporalAccessor) {
_inherits(Temporal2, _TemporalAccessor);
var _super = _createSuper(Temporal2);
function Temporal2() {
_classCallCheck(this, Temporal2);
return _super.apply(this, arguments);
}
_createClass(Temporal2, [{
key: "isSupported",
value: function isSupported(fieldOrUnit) {
abstractMethodFail("isSupported");
}
}, {
key: "minus",
value: function minus(amount, unit) {
if (arguments.length < 2) {
return this._minusAmount(amount);
} else {
return this._minusUnit(amount, unit);
}
}
}, {
key: "_minusAmount",
value: function _minusAmount(amount) {
requireNonNull(amount, "amount");
requireInstance(amount, TemporalAmount, "amount");
return amount.subtractFrom(this);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
requireNonNull(amountToSubtract, "amountToSubtract");
requireNonNull(unit, "unit");
requireInstance(unit, TemporalUnit, "unit");
return this._plusUnit(-amountToSubtract, unit);
}
}, {
key: "plus",
value: function plus(amount, unit) {
if (arguments.length < 2) {
return this._plusAmount(amount);
} else {
return this._plusUnit(amount, unit);
}
}
}, {
key: "_plusAmount",
value: function _plusAmount(amount) {
requireNonNull(amount, "amount");
requireInstance(amount, TemporalAmount, "amount");
return amount.addTo(this);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
abstractMethodFail("_plusUnit");
}
}, {
key: "until",
value: function until(endTemporal, unit) {
abstractMethodFail("until");
}
}, {
key: "with",
value: function _with(adjusterOrField, newValue) {
if (arguments.length < 2) {
return this._withAdjuster(adjusterOrField);
} else {
return this._withField(adjusterOrField, newValue);
}
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
requireNonNull(adjuster, "adjuster");
assert(typeof adjuster.adjustInto === "function", "adjuster must be a TemporalAdjuster", IllegalArgumentException);
return adjuster.adjustInto(this);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
abstractMethodFail("_withField");
}
}]);
return Temporal2;
}(TemporalAccessor);
var ChronoLocalDate = function(_Temporal) {
_inherits(ChronoLocalDate2, _Temporal);
var _super = _createSuper(ChronoLocalDate2);
function ChronoLocalDate2() {
_classCallCheck(this, ChronoLocalDate2);
return _super.apply(this, arguments);
}
_createClass(ChronoLocalDate2, [{
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return fieldOrUnit.isDateBased();
} else if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isDateBased();
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.chronology()) {
return this.chronology();
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.DAYS;
} else if (_query === TemporalQueries.localDate()) {
return LocalDate.ofEpochDay(this.toEpochDay());
} else if (_query === TemporalQueries.localTime() || _query === TemporalQueries.zone() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.offset()) {
return null;
}
return _get(_getPrototypeOf(ChronoLocalDate2.prototype), "query", this).call(this, _query);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(ChronoField.EPOCH_DAY, this.toEpochDay());
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
requireInstance(formatter, DateTimeFormatter, "formatter");
return formatter.format(this);
}
}]);
return ChronoLocalDate2;
}(Temporal);
var StringUtil = function() {
function StringUtil2() {
_classCallCheck(this, StringUtil2);
}
_createClass(StringUtil2, null, [{
key: "startsWith",
value: function startsWith(text, pattern) {
return text.indexOf(pattern) === 0;
}
}, {
key: "hashCode",
value: function hashCode(text) {
var len = text.length;
if (len === 0) {
return 0;
}
var hash = 0;
for (var i = 0; i < len; i++) {
var chr = text.charCodeAt(i);
hash = (hash << 5) - hash + chr;
hash |= 0;
}
return MathUtil.smi(hash);
}
}]);
return StringUtil2;
}();
var ZoneId = function() {
function ZoneId2() {
_classCallCheck(this, ZoneId2);
}
_createClass(ZoneId2, [{
key: "id",
value: function id() {
abstractMethodFail("ZoneId.id");
}
}, {
key: "rules",
value: function rules() {
abstractMethodFail("ZoneId.rules");
}
}, {
key: "normalized",
value: function normalized() {
var rules = this.rules();
if (rules.isFixedOffset()) {
return rules.offset(Instant.EPOCH);
}
return this;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof ZoneId2) {
return this.id() === other.id();
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return StringUtil.hashCode(this.id());
}
}, {
key: "toString",
value: function toString() {
return this.id();
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "systemDefault",
value: function systemDefault() {
throw new DateTimeException("not supported operation");
}
}, {
key: "getAvailableZoneIds",
value: function getAvailableZoneIds() {
throw new DateTimeException("not supported operation");
}
}, {
key: "of",
value: function of(zoneId) {
throw new DateTimeException("not supported operation".concat(zoneId));
}
}, {
key: "ofOffset",
value: function ofOffset(prefix, offset) {
throw new DateTimeException("not supported operation".concat(prefix).concat(offset));
}
}, {
key: "from",
value: function from(temporal) {
throw new DateTimeException("not supported operation".concat(temporal));
}
}]);
return ZoneId2;
}();
var ZoneRules = function() {
function ZoneRules2() {
_classCallCheck(this, ZoneRules2);
}
_createClass(ZoneRules2, [{
key: "isFixedOffset",
value: function isFixedOffset() {
abstractMethodFail("ZoneRules.isFixedOffset");
}
}, {
key: "offset",
value: function offset(instantOrLocalDateTime) {
if (instantOrLocalDateTime instanceof Instant) {
return this.offsetOfInstant(instantOrLocalDateTime);
} else {
return this.offsetOfLocalDateTime(instantOrLocalDateTime);
}
}
}, {
key: "offsetOfInstant",
value: function offsetOfInstant(instant) {
abstractMethodFail("ZoneRules.offsetInstant");
}
}, {
key: "offsetOfEpochMilli",
value: function offsetOfEpochMilli(epochMilli) {
abstractMethodFail("ZoneRules.offsetOfEpochMilli");
}
}, {
key: "offsetOfLocalDateTime",
value: function offsetOfLocalDateTime(localDateTime) {
abstractMethodFail("ZoneRules.offsetLocalDateTime");
}
}, {
key: "validOffsets",
value: function validOffsets(localDateTime) {
abstractMethodFail("ZoneRules.validOffsets");
}
}, {
key: "transition",
value: function transition(localDateTime) {
abstractMethodFail("ZoneRules.transition");
}
}, {
key: "standardOffset",
value: function standardOffset(instant) {
abstractMethodFail("ZoneRules.standardOffset");
}
}, {
key: "daylightSavings",
value: function daylightSavings(instant) {
abstractMethodFail("ZoneRules.daylightSavings");
}
}, {
key: "isDaylightSavings",
value: function isDaylightSavings(instant) {
abstractMethodFail("ZoneRules.isDaylightSavings");
}
}, {
key: "isValidOffset",
value: function isValidOffset(localDateTime, offset) {
abstractMethodFail("ZoneRules.isValidOffset");
}
}, {
key: "nextTransition",
value: function nextTransition(instant) {
abstractMethodFail("ZoneRules.nextTransition");
}
}, {
key: "previousTransition",
value: function previousTransition(instant) {
abstractMethodFail("ZoneRules.previousTransition");
}
}, {
key: "transitions",
value: function transitions() {
abstractMethodFail("ZoneRules.transitions");
}
}, {
key: "transitionRules",
value: function transitionRules() {
abstractMethodFail("ZoneRules.transitionRules");
}
}, {
key: "toString",
value: function toString() {
abstractMethodFail("ZoneRules.toString");
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "of",
value: function of(offset) {
requireNonNull(offset, "offset");
return new Fixed(offset);
}
}]);
return ZoneRules2;
}();
var Fixed = function(_ZoneRules) {
_inherits(Fixed2, _ZoneRules);
var _super = _createSuper(Fixed2);
function Fixed2(offset) {
var _this;
_classCallCheck(this, Fixed2);
_this = _super.call(this);
_this._offset = offset;
return _this;
}
_createClass(Fixed2, [{
key: "isFixedOffset",
value: function isFixedOffset() {
return true;
}
}, {
key: "offsetOfInstant",
value: function offsetOfInstant() {
return this._offset;
}
}, {
key: "offsetOfEpochMilli",
value: function offsetOfEpochMilli() {
return this._offset;
}
}, {
key: "offsetOfLocalDateTime",
value: function offsetOfLocalDateTime() {
return this._offset;
}
}, {
key: "validOffsets",
value: function validOffsets() {
return [this._offset];
}
}, {
key: "transition",
value: function transition() {
return null;
}
}, {
key: "standardOffset",
value: function standardOffset() {
return this._offset;
}
}, {
key: "daylightSavings",
value: function daylightSavings() {
return Duration2.ZERO;
}
}, {
key: "isDaylightSavings",
value: function isDaylightSavings() {
return false;
}
}, {
key: "isValidOffset",
value: function isValidOffset(localDateTime, offset) {
return this._offset.equals(offset);
}
}, {
key: "nextTransition",
value: function nextTransition() {
return null;
}
}, {
key: "previousTransition",
value: function previousTransition() {
return null;
}
}, {
key: "transitions",
value: function transitions() {
return [];
}
}, {
key: "transitionRules",
value: function transitionRules() {
return [];
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof Fixed2) {
return this._offset.equals(other._offset);
}
return false;
}
}, {
key: "toString",
value: function toString() {
return "FixedRules:".concat(this._offset.toString());
}
}]);
return Fixed2;
}(ZoneRules);
var SECONDS_CACHE = {};
var ID_CACHE = {};
var ZoneOffset = function(_ZoneId) {
_inherits(ZoneOffset2, _ZoneId);
var _super = _createSuper(ZoneOffset2);
function ZoneOffset2(totalSeconds) {
var _this;
_classCallCheck(this, ZoneOffset2);
_this = _super.call(this);
ZoneOffset2._validateTotalSeconds(totalSeconds);
_this._totalSeconds = MathUtil.safeToInt(totalSeconds);
_this._rules = ZoneRules.of(_assertThisInitialized(_this));
_this._id = ZoneOffset2._buildId(totalSeconds);
return _this;
}
_createClass(ZoneOffset2, [{
key: "totalSeconds",
value: function totalSeconds() {
return this._totalSeconds;
}
}, {
key: "id",
value: function id() {
return this._id;
}
}, {
key: "rules",
value: function rules() {
return this._rules;
}
}, {
key: "get",
value: function get(field) {
return this.getLong(field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field === ChronoField.OFFSET_SECONDS) {
return this._totalSeconds;
} else if (field instanceof ChronoField) {
throw new DateTimeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
return this;
} else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.precision() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId()) {
return null;
}
return _query.queryFrom(this);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(ChronoField.OFFSET_SECONDS, this._totalSeconds);
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
return other._totalSeconds - this._totalSeconds;
}
}, {
key: "equals",
value: function equals(obj) {
if (this === obj) {
return true;
}
if (obj instanceof ZoneOffset2) {
return this._totalSeconds === obj._totalSeconds;
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._totalSeconds;
}
}, {
key: "toString",
value: function toString() {
return this._id;
}
}], [{
key: "_buildId",
value: function _buildId(totalSeconds) {
if (totalSeconds === 0) {
return "Z";
} else {
var absTotalSeconds = Math.abs(totalSeconds);
var absHours = MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_HOUR);
var absMinutes = MathUtil.intMod(MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE), LocalTime.MINUTES_PER_HOUR);
var buf = "".concat(totalSeconds < 0 ? "-" : "+").concat(absHours < 10 ? "0" : "").concat(absHours).concat(absMinutes < 10 ? ":0" : ":").concat(absMinutes);
var absSeconds = MathUtil.intMod(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE);
if (absSeconds !== 0) {
buf += (absSeconds < 10 ? ":0" : ":") + absSeconds;
}
return buf;
}
}
}, {
key: "_validateTotalSeconds",
value: function _validateTotalSeconds(totalSeconds) {
if (Math.abs(totalSeconds) > ZoneOffset2.MAX_SECONDS) {
throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
}
}
}, {
key: "_validate",
value: function _validate(hours, minutes, seconds) {
if (hours < -18 || hours > 18) {
throw new DateTimeException("Zone offset hours not in valid range: value ".concat(hours, " is not in the range -18 to 18"));
}
if (hours > 0) {
if (minutes < 0 || seconds < 0) {
throw new DateTimeException("Zone offset minutes and seconds must be positive because hours is positive");
}
} else if (hours < 0) {
if (minutes > 0 || seconds > 0) {
throw new DateTimeException("Zone offset minutes and seconds must be negative because hours is negative");
}
} else if (minutes > 0 && seconds < 0 || minutes < 0 && seconds > 0) {
throw new DateTimeException("Zone offset minutes and seconds must have the same sign");
}
if (Math.abs(minutes) > 59) {
throw new DateTimeException("Zone offset minutes not in valid range: abs(value) ".concat(Math.abs(minutes), " is not in the range 0 to 59"));
}
if (Math.abs(seconds) > 59) {
throw new DateTimeException("Zone offset seconds not in valid range: abs(value) ".concat(Math.abs(seconds), " is not in the range 0 to 59"));
}
if (Math.abs(hours) === 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
}
}
}, {
key: "of",
value: function of(offsetId) {
requireNonNull(offsetId, "offsetId");
var offset = ID_CACHE[offsetId];
if (offset != null) {
return offset;
}
var hours, minutes, seconds;
switch (offsetId.length) {
case 2:
offsetId = "".concat(offsetId[0], "0").concat(offsetId[1]);
case 3:
hours = ZoneOffset2._parseNumber(offsetId, 1, false);
minutes = 0;
seconds = 0;
break;
case 5:
hours = ZoneOffset2._parseNumber(offsetId, 1, false);
minutes = ZoneOffset2._parseNumber(offsetId, 3, false);
seconds = 0;
break;
case 6:
hours = ZoneOffset2._parseNumber(offsetId, 1, false);
minutes = ZoneOffset2._parseNumber(offsetId, 4, true);
seconds = 0;
break;
case 7:
hours = ZoneOffset2._parseNumber(offsetId, 1, false);
minutes = ZoneOffset2._parseNumber(offsetId, 3, false);
seconds = ZoneOffset2._parseNumber(offsetId, 5, false);
break;
case 9:
hours = ZoneOffset2._parseNumber(offsetId, 1, false);
minutes = ZoneOffset2._parseNumber(offsetId, 4, true);
seconds = ZoneOffset2._parseNumber(offsetId, 7, true);
break;
default:
throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: ".concat(offsetId));
}
var first = offsetId[0];
if (first !== "+" && first !== "-") {
throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: ".concat(offsetId));
}
if (first === "-") {
return ZoneOffset2.ofHoursMinutesSeconds(-hours, -minutes, -seconds);
} else {
return ZoneOffset2.ofHoursMinutesSeconds(hours, minutes, seconds);
}
}
}, {
key: "_parseNumber",
value: function _parseNumber(offsetId, pos, precededByColon) {
if (precededByColon && offsetId[pos - 1] !== ":") {
throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: ".concat(offsetId));
}
var ch1 = offsetId[pos];
var ch2 = offsetId[pos + 1];
if (ch1 < "0" || ch1 > "9" || ch2 < "0" || ch2 > "9") {
throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: ".concat(offsetId));
}
return (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
}
}, {
key: "ofHours",
value: function ofHours(hours) {
return ZoneOffset2.ofHoursMinutesSeconds(hours, 0, 0);
}
}, {
key: "ofHoursMinutes",
value: function ofHoursMinutes(hours, minutes) {
return ZoneOffset2.ofHoursMinutesSeconds(hours, minutes, 0);
}
}, {
key: "ofHoursMinutesSeconds",
value: function ofHoursMinutesSeconds(hours, minutes, seconds) {
ZoneOffset2._validate(hours, minutes, seconds);
var totalSeconds = hours * LocalTime.SECONDS_PER_HOUR + minutes * LocalTime.SECONDS_PER_MINUTE + seconds;
return ZoneOffset2.ofTotalSeconds(totalSeconds);
}
}, {
key: "ofTotalMinutes",
value: function ofTotalMinutes(totalMinutes) {
var totalSeconds = totalMinutes * LocalTime.SECONDS_PER_MINUTE;
return ZoneOffset2.ofTotalSeconds(totalSeconds);
}
}, {
key: "ofTotalSeconds",
value: function ofTotalSeconds(totalSeconds) {
if (totalSeconds % (15 * LocalTime.SECONDS_PER_MINUTE) === 0) {
var totalSecs = totalSeconds;
var result = SECONDS_CACHE[totalSecs];
if (result == null) {
result = new ZoneOffset2(totalSeconds);
SECONDS_CACHE[totalSecs] = result;
ID_CACHE[result.id()] = result;
}
return result;
} else {
return new ZoneOffset2(totalSeconds);
}
}
}]);
return ZoneOffset2;
}(ZoneId);
function _init$7() {
ZoneOffset.MAX_SECONDS = 18 * LocalTime.SECONDS_PER_HOUR;
ZoneOffset.UTC = ZoneOffset.ofTotalSeconds(0);
ZoneOffset.MIN = ZoneOffset.ofTotalSeconds(-ZoneOffset.MAX_SECONDS);
ZoneOffset.MAX = ZoneOffset.ofTotalSeconds(ZoneOffset.MAX_SECONDS);
}
var DateTimeBuilder = function(_TemporalAccessor) {
_inherits(DateTimeBuilder2, _TemporalAccessor);
var _super = _createSuper(DateTimeBuilder2);
function DateTimeBuilder2() {
var _this;
_classCallCheck(this, DateTimeBuilder2);
_this = _super.call(this);
_this.fieldValues = new EnumMap();
_this.chrono = null;
_this.zone = null;
_this.date = null;
_this.time = null;
_this.leapSecond = false;
_this.excessDays = null;
return _this;
}
_createClass(DateTimeBuilder2, [{
key: "getFieldValue0",
value: function getFieldValue0(field) {
return this.fieldValues.get(field);
}
}, {
key: "_addFieldValue",
value: function _addFieldValue(field, value) {
requireNonNull(field, "field");
var old = this.getFieldValue0(field);
if (old != null && old !== value) {
throw new DateTimeException("Conflict found: ".concat(field, " ").concat(old, " differs from ").concat(field, " ").concat(value, ": ").concat(this));
}
return this._putFieldValue0(field, value);
}
}, {
key: "_putFieldValue0",
value: function _putFieldValue0(field, value) {
this.fieldValues.put(field, value);
return this;
}
}, {
key: "resolve",
value: function resolve(resolverStyle, resolverFields) {
if (resolverFields != null) {
this.fieldValues.retainAll(resolverFields);
}
this._mergeDate(resolverStyle);
this._mergeTime(resolverStyle);
this._resolveTimeInferZeroes(resolverStyle);
if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
this.date = this.date.plus(this.excessDays);
this.excessDays = Period.ZERO;
}
this._resolveInstant();
return this;
}
}, {
key: "_mergeDate",
value: function _mergeDate(resolverStyle) {
this._checkDate(IsoChronology.INSTANCE.resolveDate(this.fieldValues, resolverStyle));
}
}, {
key: "_checkDate",
value: function _checkDate(date) {
if (date != null) {
this._addObject(date);
for (var fieldName in this.fieldValues.keySet()) {
var field = ChronoField.byName(fieldName);
if (field) {
if (this.fieldValues.get(field) !== void 0) {
if (field.isDateBased()) {
var val1 = void 0;
try {
val1 = date.getLong(field);
} catch (ex) {
if (ex instanceof DateTimeException) {
continue;
} else {
throw ex;
}
}
var val2 = this.fieldValues.get(field);
if (val1 !== val2) {
throw new DateTimeException("Conflict found: Field ".concat(field, " ").concat(val1, " differs from ").concat(field, " ").concat(val2, " derived from ").concat(date));
}
}
}
}
}
}
}
}, {
key: "_mergeTime",
value: function _mergeTime(resolverStyle) {
if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {
var ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_DAY);
if (resolverStyle !== ResolverStyle.LENIENT) {
if (resolverStyle === ResolverStyle.SMART && ch === 0)
;
else {
ChronoField.CLOCK_HOUR_OF_DAY.checkValidValue(ch);
}
}
this._addFieldValue(ChronoField.HOUR_OF_DAY, ch === 24 ? 0 : ch);
}
if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_AMPM)) {
var _ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_AMPM);
if (resolverStyle !== ResolverStyle.LENIENT) {
if (resolverStyle === ResolverStyle.SMART && _ch === 0)
;
else {
ChronoField.CLOCK_HOUR_OF_AMPM.checkValidValue(_ch);
}
}
this._addFieldValue(ChronoField.HOUR_OF_AMPM, _ch === 12 ? 0 : _ch);
}
if (resolverStyle !== ResolverStyle.LENIENT) {
if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY)) {
ChronoField.AMPM_OF_DAY.checkValidValue(this.fieldValues.get(ChronoField.AMPM_OF_DAY));
}
if (this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
ChronoField.HOUR_OF_AMPM.checkValidValue(this.fieldValues.get(ChronoField.HOUR_OF_AMPM));
}
}
if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY) && this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
var ap = this.fieldValues.remove(ChronoField.AMPM_OF_DAY);
var hap = this.fieldValues.remove(ChronoField.HOUR_OF_AMPM);
this._addFieldValue(ChronoField.HOUR_OF_DAY, ap * 12 + hap);
}
if (this.fieldValues.containsKey(ChronoField.NANO_OF_DAY)) {
var nod = this.fieldValues.remove(ChronoField.NANO_OF_DAY);
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.NANO_OF_DAY.checkValidValue(nod);
}
this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(nod, 1e9));
this._addFieldValue(ChronoField.NANO_OF_SECOND, MathUtil.intMod(nod, 1e9));
}
if (this.fieldValues.containsKey(ChronoField.MICRO_OF_DAY)) {
var cod = this.fieldValues.remove(ChronoField.MICRO_OF_DAY);
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.MICRO_OF_DAY.checkValidValue(cod);
}
this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(cod, 1e6));
this._addFieldValue(ChronoField.MICRO_OF_SECOND, MathUtil.intMod(cod, 1e6));
}
if (this.fieldValues.containsKey(ChronoField.MILLI_OF_DAY)) {
var lod = this.fieldValues.remove(ChronoField.MILLI_OF_DAY);
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.MILLI_OF_DAY.checkValidValue(lod);
}
this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(lod, 1e3));
this._addFieldValue(ChronoField.MILLI_OF_SECOND, MathUtil.intMod(lod, 1e3));
}
if (this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY)) {
var sod = this.fieldValues.remove(ChronoField.SECOND_OF_DAY);
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.SECOND_OF_DAY.checkValidValue(sod);
}
this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
this._addFieldValue(ChronoField.SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
}
if (this.fieldValues.containsKey(ChronoField.MINUTE_OF_DAY)) {
var mod = this.fieldValues.remove(ChronoField.MINUTE_OF_DAY);
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.MINUTE_OF_DAY.checkValidValue(mod);
}
this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(mod, 60));
this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(mod, 60));
}
if (resolverStyle !== ResolverStyle.LENIENT) {
if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
ChronoField.MILLI_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MILLI_OF_SECOND));
}
if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
ChronoField.MICRO_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MICRO_OF_SECOND));
}
}
if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
var los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
var cos = this.fieldValues.get(ChronoField.MICRO_OF_SECOND);
this._putFieldValue0(ChronoField.MICRO_OF_SECOND, los * 1e3 + MathUtil.intMod(cos, 1e3));
}
if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
this._putFieldValue0(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1e3));
this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
}
if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
var _nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
this._putFieldValue0(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(_nos, 1e6));
this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
}
if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
var _cos = this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
this._putFieldValue0(ChronoField.NANO_OF_SECOND, _cos * 1e3);
} else if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
var _los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
this._putFieldValue0(ChronoField.NANO_OF_SECOND, _los * 1e6);
}
}
}, {
key: "_resolveTimeInferZeroes",
value: function _resolveTimeInferZeroes(resolverStyle) {
var hod = this.fieldValues.get(ChronoField.HOUR_OF_DAY);
var moh = this.fieldValues.get(ChronoField.MINUTE_OF_HOUR);
var som = this.fieldValues.get(ChronoField.SECOND_OF_MINUTE);
var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
if (hod == null) {
return;
}
if (moh == null && (som != null || nos != null)) {
return;
}
if (moh != null && som == null && nos != null) {
return;
}
if (resolverStyle !== ResolverStyle.LENIENT) {
if (hod != null) {
if (resolverStyle === ResolverStyle.SMART && hod === 24 && (moh == null || moh === 0) && (som == null || som === 0) && (nos == null || nos === 0)) {
hod = 0;
this.excessDays = Period.ofDays(1);
}
var hodVal = ChronoField.HOUR_OF_DAY.checkValidIntValue(hod);
if (moh != null) {
var mohVal = ChronoField.MINUTE_OF_HOUR.checkValidIntValue(moh);
if (som != null) {
var somVal = ChronoField.SECOND_OF_MINUTE.checkValidIntValue(som);
if (nos != null) {
var nosVal = ChronoField.NANO_OF_SECOND.checkValidIntValue(nos);
this._addObject(LocalTime.of(hodVal, mohVal, somVal, nosVal));
} else {
this._addObject(LocalTime.of(hodVal, mohVal, somVal));
}
} else {
if (nos == null) {
this._addObject(LocalTime.of(hodVal, mohVal));
}
}
} else {
if (som == null && nos == null) {
this._addObject(LocalTime.of(hodVal, 0));
}
}
}
} else {
if (hod != null) {
var _hodVal = hod;
if (moh != null) {
if (som != null) {
if (nos == null) {
nos = 0;
}
var totalNanos = MathUtil.safeMultiply(_hodVal, 36e11);
totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(moh, 6e10));
totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(som, 1e9));
totalNanos = MathUtil.safeAdd(totalNanos, nos);
var excessDays = MathUtil.floorDiv(totalNanos, 864e11);
var nod = MathUtil.floorMod(totalNanos, 864e11);
this._addObject(LocalTime.ofNanoOfDay(nod));
this.excessDays = Period.ofDays(excessDays);
} else {
var totalSecs = MathUtil.safeMultiply(_hodVal, 3600);
totalSecs = MathUtil.safeAdd(totalSecs, MathUtil.safeMultiply(moh, 60));
var _excessDays = MathUtil.floorDiv(totalSecs, 86400);
var sod = MathUtil.floorMod(totalSecs, 86400);
this._addObject(LocalTime.ofSecondOfDay(sod));
this.excessDays = Period.ofDays(_excessDays);
}
} else {
var _excessDays2 = MathUtil.safeToInt(MathUtil.floorDiv(_hodVal, 24));
_hodVal = MathUtil.floorMod(_hodVal, 24);
this._addObject(LocalTime.of(_hodVal, 0));
this.excessDays = Period.ofDays(_excessDays2);
}
}
}
this.fieldValues.remove(ChronoField.HOUR_OF_DAY);
this.fieldValues.remove(ChronoField.MINUTE_OF_HOUR);
this.fieldValues.remove(ChronoField.SECOND_OF_MINUTE);
this.fieldValues.remove(ChronoField.NANO_OF_SECOND);
}
}, {
key: "_addObject",
value: function _addObject(dateOrTime) {
if (dateOrTime instanceof ChronoLocalDate) {
this.date = dateOrTime;
} else if (dateOrTime instanceof LocalTime) {
this.time = dateOrTime;
}
}
}, {
key: "_resolveInstant",
value: function _resolveInstant() {
if (this.date != null && this.time != null) {
var offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
if (offsetSecs != null) {
var offset = ZoneOffset.ofTotalSeconds(offsetSecs);
var instant = this.date.atTime(this.time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
} else if (this.zone != null) {
var _instant = this.date.atTime(this.time).atZone(this.zone).getLong(ChronoField.INSTANT_SECONDS);
this.fieldValues.put(ChronoField.INSTANT_SECONDS, _instant);
}
}
}
}, {
key: "build",
value: function build(type) {
return type.queryFrom(this);
}
}, {
key: "isSupported",
value: function isSupported(field) {
if (field == null) {
return false;
}
return this.fieldValues.containsKey(field) && this.fieldValues.get(field) !== void 0 || this.date != null && this.date.isSupported(field) || this.time != null && this.time.isSupported(field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
var value = this.getFieldValue0(field);
if (value == null) {
if (this.date != null && this.date.isSupported(field)) {
return this.date.getLong(field);
}
if (this.time != null && this.time.isSupported(field)) {
return this.time.getLong(field);
}
throw new DateTimeException("Field not found: ".concat(field));
}
return value;
}
}, {
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.zoneId()) {
return this.zone;
} else if (_query === TemporalQueries.chronology()) {
return this.chrono;
} else if (_query === TemporalQueries.localDate()) {
return this.date != null ? LocalDate.from(this.date) : null;
} else if (_query === TemporalQueries.localTime()) {
return this.time;
} else if (_query === TemporalQueries.zone() || _query === TemporalQueries.offset()) {
return _query.queryFrom(this);
} else if (_query === TemporalQueries.precision()) {
return null;
}
return _query.queryFrom(this);
}
}], [{
key: "create",
value: function create(field, value) {
var dtb = new DateTimeBuilder2();
dtb._addFieldValue(field, value);
return dtb;
}
}]);
return DateTimeBuilder2;
}(TemporalAccessor);
var DateTimeParseContext = function() {
function DateTimeParseContext2() {
_classCallCheck(this, DateTimeParseContext2);
if (arguments.length === 1) {
if (arguments[0] instanceof DateTimeParseContext2) {
this._constructorSelf.apply(this, arguments);
return;
} else {
this._constructorFormatter.apply(this, arguments);
}
} else {
this._constructorParam.apply(this, arguments);
}
this._caseSensitive = true;
this._strict = true;
this._parsed = [new Parsed(this)];
}
_createClass(DateTimeParseContext2, [{
key: "_constructorParam",
value: function _constructorParam(locale, symbols, chronology) {
this._locale = locale;
this._symbols = symbols;
this._overrideChronology = chronology;
}
}, {
key: "_constructorFormatter",
value: function _constructorFormatter(formatter) {
this._locale = formatter.locale();
this._symbols = formatter.decimalStyle();
this._overrideChronology = formatter.chronology();
}
}, {
key: "_constructorSelf",
value: function _constructorSelf(other) {
this._locale = other._locale;
this._symbols = other._symbols;
this._overrideChronology = other._overrideChronology;
this._overrideZone = other._overrideZone;
this._caseSensitive = other._caseSensitive;
this._strict = other._strict;
this._parsed = [new Parsed(this)];
}
}, {
key: "copy",
value: function copy() {
return new DateTimeParseContext2(this);
}
}, {
key: "symbols",
value: function symbols() {
return this._symbols;
}
}, {
key: "isStrict",
value: function isStrict() {
return this._strict;
}
}, {
key: "setStrict",
value: function setStrict(strict) {
this._strict = strict;
}
}, {
key: "locale",
value: function locale() {
return this._locale;
}
}, {
key: "setLocale",
value: function setLocale(locale) {
this._locale = locale;
}
}, {
key: "startOptional",
value: function startOptional() {
this._parsed.push(this.currentParsed().copy());
}
}, {
key: "endOptional",
value: function endOptional(successful) {
if (successful) {
this._parsed.splice(this._parsed.length - 2, 1);
} else {
this._parsed.splice(this._parsed.length - 1, 1);
}
}
}, {
key: "isCaseSensitive",
value: function isCaseSensitive() {
return this._caseSensitive;
}
}, {
key: "setCaseSensitive",
value: function setCaseSensitive(caseSensitive) {
this._caseSensitive = caseSensitive;
}
}, {
key: "subSequenceEquals",
value: function subSequenceEquals(cs1, offset1, cs2, offset2, length) {
if (offset1 + length > cs1.length || offset2 + length > cs2.length) {
return false;
}
if (!this.isCaseSensitive()) {
cs1 = cs1.toLowerCase();
cs2 = cs2.toLowerCase();
}
for (var i = 0; i < length; i++) {
var ch1 = cs1[offset1 + i];
var ch2 = cs2[offset2 + i];
if (ch1 !== ch2) {
return false;
}
}
return true;
}
}, {
key: "charEquals",
value: function charEquals(ch1, ch2) {
if (this.isCaseSensitive()) {
return ch1 === ch2;
}
return this.charEqualsIgnoreCase(ch1, ch2);
}
}, {
key: "charEqualsIgnoreCase",
value: function charEqualsIgnoreCase(c1, c2) {
return c1 === c2 || c1.toLowerCase() === c2.toLowerCase();
}
}, {
key: "setParsedField",
value: function setParsedField(field, value, errorPos, successPos) {
var currentParsedFieldValues = this.currentParsed().fieldValues;
var old = currentParsedFieldValues.get(field);
currentParsedFieldValues.set(field, value);
return old != null && old !== value ? ~errorPos : successPos;
}
}, {
key: "setParsedZone",
value: function setParsedZone(zone) {
requireNonNull(zone, "zone");
this.currentParsed().zone = zone;
}
}, {
key: "getParsed",
value: function getParsed(field) {
return this.currentParsed().fieldValues.get(field);
}
}, {
key: "toParsed",
value: function toParsed() {
return this.currentParsed();
}
}, {
key: "currentParsed",
value: function currentParsed() {
return this._parsed[this._parsed.length - 1];
}
}, {
key: "setParsedLeapSecond",
value: function setParsedLeapSecond() {
this.currentParsed().leapSecond = true;
}
}, {
key: "getEffectiveChronology",
value: function getEffectiveChronology() {
var chrono = this.currentParsed().chrono;
if (chrono == null) {
chrono = this._overrideChronology;
if (chrono == null) {
chrono = IsoChronology.INSTANCE;
}
}
return chrono;
}
}]);
return DateTimeParseContext2;
}();
var Parsed = function(_Temporal) {
_inherits(Parsed2, _Temporal);
var _super = _createSuper(Parsed2);
function Parsed2(dateTimeParseContext) {
var _this;
_classCallCheck(this, Parsed2);
_this = _super.call(this);
_this.chrono = null;
_this.zone = null;
_this.fieldValues = new EnumMap();
_this.leapSecond = false;
_this.dateTimeParseContext = dateTimeParseContext;
return _this;
}
_createClass(Parsed2, [{
key: "copy",
value: function copy() {
var cloned = new Parsed2();
cloned.chrono = this.chrono;
cloned.zone = this.zone;
cloned.fieldValues.putAll(this.fieldValues);
cloned.leapSecond = this.leapSecond;
cloned.dateTimeParseContext = this.dateTimeParseContext;
return cloned;
}
}, {
key: "toString",
value: function toString() {
return "".concat(this.fieldValues, ", ").concat(this.chrono, ", ").concat(this.zone);
}
}, {
key: "isSupported",
value: function isSupported(field) {
return this.fieldValues.containsKey(field);
}
}, {
key: "get",
value: function get(field) {
var val = this.fieldValues.get(field);
assert(val != null);
return val;
}
}, {
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.chronology()) {
return this.chrono;
}
if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.zone()) {
return this.zone;
}
return _get(_getPrototypeOf(Parsed2.prototype), "query", this).call(this, _query);
}
}, {
key: "toBuilder",
value: function toBuilder() {
var builder = new DateTimeBuilder();
builder.fieldValues.putAll(this.fieldValues);
builder.chrono = this.dateTimeParseContext.getEffectiveChronology();
if (this.zone != null) {
builder.zone = this.zone;
} else {
builder.zone = this.overrideZone;
}
builder.leapSecond = this.leapSecond;
builder.excessDays = this.excessDays;
return builder;
}
}]);
return Parsed2;
}(Temporal);
var DateTimePrintContext = function() {
function DateTimePrintContext2(temporal, localeOrFormatter, symbols) {
_classCallCheck(this, DateTimePrintContext2);
if (arguments.length === 2 && arguments[1] instanceof DateTimeFormatter) {
this._temporal = DateTimePrintContext2.adjust(temporal, localeOrFormatter);
this._locale = localeOrFormatter.locale();
this._symbols = localeOrFormatter.decimalStyle();
} else {
this._temporal = temporal;
this._locale = localeOrFormatter;
this._symbols = symbols;
}
this._optional = 0;
}
_createClass(DateTimePrintContext2, [{
key: "symbols",
value: function symbols() {
return this._symbols;
}
}, {
key: "startOptional",
value: function startOptional() {
this._optional++;
}
}, {
key: "endOptional",
value: function endOptional() {
this._optional--;
}
}, {
key: "getValueQuery",
value: function getValueQuery(query) {
var result = this._temporal.query(query);
if (result == null && this._optional === 0) {
throw new DateTimeException("Unable to extract value: ".concat(this._temporal));
}
return result;
}
}, {
key: "getValue",
value: function getValue(field) {
try {
return this._temporal.getLong(field);
} catch (ex) {
if (ex instanceof DateTimeException && this._optional > 0) {
return null;
}
throw ex;
}
}
}, {
key: "temporal",
value: function temporal() {
return this._temporal;
}
}, {
key: "locale",
value: function locale() {
return this._locale;
}
}, {
key: "setDateTime",
value: function setDateTime(temporal) {
this._temporal = temporal;
}
}, {
key: "setLocale",
value: function setLocale(locale) {
this._locale = locale;
}
}], [{
key: "adjust",
value: function adjust(temporal, formatter) {
return temporal;
}
}]);
return DateTimePrintContext2;
}();
var IsoFields = {};
var QUARTER_DAYS = [0, 90, 181, 273, 0, 91, 182, 274];
var Field = function(_TemporalField) {
_inherits(Field3, _TemporalField);
var _super = _createSuper(Field3);
function Field3() {
_classCallCheck(this, Field3);
return _super.apply(this, arguments);
}
_createClass(Field3, [{
key: "isDateBased",
value: function isDateBased() {
return true;
}
}, {
key: "isTimeBased",
value: function isTimeBased() {
return false;
}
}, {
key: "_isIso",
value: function _isIso() {
return true;
}
}, {
key: "displayName",
value: function displayName() {
return this.toString();
}
}, {
key: "resolve",
value: function resolve() {
return null;
}
}, {
key: "name",
value: function name2() {
return this.toString();
}
}], [{
key: "_getWeekRangeByLocalDate",
value: function _getWeekRangeByLocalDate(date) {
var wby = Field3._getWeekBasedYear(date);
return ValueRange.of(1, Field3._getWeekRangeByYear(wby));
}
}, {
key: "_getWeekRangeByYear",
value: function _getWeekRangeByYear(wby) {
var date = LocalDate.of(wby, 1, 1);
if (date.dayOfWeek() === DayOfWeek.THURSDAY || date.dayOfWeek() === DayOfWeek.WEDNESDAY && date.isLeapYear()) {
return 53;
}
return 52;
}
}, {
key: "_getWeek",
value: function _getWeek(date) {
var dow0 = date.dayOfWeek().ordinal();
var doy0 = date.dayOfYear() - 1;
var doyThu0 = doy0 + (3 - dow0);
var alignedWeek = MathUtil.intDiv(doyThu0, 7);
var firstThuDoy0 = doyThu0 - alignedWeek * 7;
var firstMonDoy0 = firstThuDoy0 - 3;
if (firstMonDoy0 < -3) {
firstMonDoy0 += 7;
}
if (doy0 < firstMonDoy0) {
return Field3._getWeekRangeByLocalDate(date.withDayOfYear(180).minusYears(1)).maximum();
}
var week = MathUtil.intDiv(doy0 - firstMonDoy0, 7) + 1;
if (week === 53) {
if ((firstMonDoy0 === -3 || firstMonDoy0 === -2 && date.isLeapYear()) === false) {
week = 1;
}
}
return week;
}
}, {
key: "_getWeekBasedYear",
value: function _getWeekBasedYear(date) {
var year = date.year();
var doy = date.dayOfYear();
if (doy <= 3) {
var dow = date.dayOfWeek().ordinal();
if (doy - dow < -2) {
year--;
}
} else if (doy >= 363) {
var _dow = date.dayOfWeek().ordinal();
doy = doy - 363 - (date.isLeapYear() ? 1 : 0);
if (doy - _dow >= 0) {
year++;
}
}
return year;
}
}]);
return Field3;
}(TemporalField);
var DAY_OF_QUARTER_FIELD = function(_Field) {
_inherits(DAY_OF_QUARTER_FIELD2, _Field);
var _super2 = _createSuper(DAY_OF_QUARTER_FIELD2);
function DAY_OF_QUARTER_FIELD2() {
_classCallCheck(this, DAY_OF_QUARTER_FIELD2);
return _super2.apply(this, arguments);
}
_createClass(DAY_OF_QUARTER_FIELD2, [{
key: "toString",
value: function toString() {
return "DayOfQuarter";
}
}, {
key: "baseUnit",
value: function baseUnit() {
return ChronoUnit.DAYS;
}
}, {
key: "rangeUnit",
value: function rangeUnit() {
return QUARTER_YEARS;
}
}, {
key: "range",
value: function range() {
return ValueRange.of(1, 90, 92);
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
return temporal.isSupported(ChronoField.DAY_OF_YEAR) && temporal.isSupported(ChronoField.MONTH_OF_YEAR) && temporal.isSupported(ChronoField.YEAR) && this._isIso(temporal);
}
}, {
key: "rangeRefinedBy",
value: function rangeRefinedBy(temporal) {
if (temporal.isSupported(this) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: DayOfQuarter");
}
var qoy = temporal.getLong(QUARTER_OF_YEAR);
if (qoy === 1) {
var year = temporal.getLong(ChronoField.YEAR);
return IsoChronology.isLeapYear(year) ? ValueRange.of(1, 91) : ValueRange.of(1, 90);
} else if (qoy === 2) {
return ValueRange.of(1, 91);
} else if (qoy === 3 || qoy === 4) {
return ValueRange.of(1, 92);
}
return this.range();
}
}, {
key: "getFrom",
value: function getFrom(temporal) {
if (temporal.isSupported(this) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: DayOfQuarter");
}
var doy = temporal.get(ChronoField.DAY_OF_YEAR);
var moy = temporal.get(ChronoField.MONTH_OF_YEAR);
var year = temporal.getLong(ChronoField.YEAR);
return doy - QUARTER_DAYS[MathUtil.intDiv(moy - 1, 3) + (IsoChronology.isLeapYear(year) ? 4 : 0)];
}
}, {
key: "adjustInto",
value: function adjustInto(temporal, newValue) {
var curValue = this.getFrom(temporal);
this.range().checkValidValue(newValue, this);
return temporal.with(ChronoField.DAY_OF_YEAR, temporal.getLong(ChronoField.DAY_OF_YEAR) + (newValue - curValue));
}
}, {
key: "resolve",
value: function resolve(fieldValues, partialTemporal, resolverStyle) {
var yearLong = fieldValues.get(ChronoField.YEAR);
var qoyLong = fieldValues.get(QUARTER_OF_YEAR);
if (yearLong == null || qoyLong == null) {
return null;
}
var y = ChronoField.YEAR.checkValidIntValue(yearLong);
var doq = fieldValues.get(DAY_OF_QUARTER);
var date;
if (resolverStyle === ResolverStyle.LENIENT) {
var qoy = qoyLong;
date = LocalDate.of(y, 1, 1);
date = date.plusMonths(MathUtil.safeMultiply(MathUtil.safeSubtract(qoy, 1), 3));
date = date.plusDays(MathUtil.safeSubtract(doq, 1));
} else {
var _qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR);
if (resolverStyle === ResolverStyle.STRICT) {
var max = 92;
if (_qoy === 1) {
max = IsoChronology.isLeapYear(y) ? 91 : 90;
} else if (_qoy === 2) {
max = 91;
}
ValueRange.of(1, max).checkValidValue(doq, this);
} else {
this.range().checkValidValue(doq, this);
}
date = LocalDate.of(y, (_qoy - 1) * 3 + 1, 1).plusDays(doq - 1);
}
fieldValues.remove(this);
fieldValues.remove(ChronoField.YEAR);
fieldValues.remove(QUARTER_OF_YEAR);
return date;
}
}]);
return DAY_OF_QUARTER_FIELD2;
}(Field);
var QUARTER_OF_YEAR_FIELD = function(_Field2) {
_inherits(QUARTER_OF_YEAR_FIELD2, _Field2);
var _super3 = _createSuper(QUARTER_OF_YEAR_FIELD2);
function QUARTER_OF_YEAR_FIELD2() {
_classCallCheck(this, QUARTER_OF_YEAR_FIELD2);
return _super3.apply(this, arguments);
}
_createClass(QUARTER_OF_YEAR_FIELD2, [{
key: "toString",
value: function toString() {
return "QuarterOfYear";
}
}, {
key: "baseUnit",
value: function baseUnit() {
return QUARTER_YEARS;
}
}, {
key: "rangeUnit",
value: function rangeUnit() {
return ChronoUnit.YEARS;
}
}, {
key: "range",
value: function range() {
return ValueRange.of(1, 4);
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
return temporal.isSupported(ChronoField.MONTH_OF_YEAR) && this._isIso(temporal);
}
}, {
key: "rangeRefinedBy",
value: function rangeRefinedBy(temporal) {
return this.range();
}
}, {
key: "getFrom",
value: function getFrom(temporal) {
if (temporal.isSupported(this) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: QuarterOfYear");
}
var moy = temporal.getLong(ChronoField.MONTH_OF_YEAR);
return MathUtil.intDiv(moy + 2, 3);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal, newValue) {
var curValue = this.getFrom(temporal);
this.range().checkValidValue(newValue, this);
return temporal.with(ChronoField.MONTH_OF_YEAR, temporal.getLong(ChronoField.MONTH_OF_YEAR) + (newValue - curValue) * 3);
}
}]);
return QUARTER_OF_YEAR_FIELD2;
}(Field);
var WEEK_OF_WEEK_BASED_YEAR_FIELD = function(_Field3) {
_inherits(WEEK_OF_WEEK_BASED_YEAR_FIELD2, _Field3);
var _super4 = _createSuper(WEEK_OF_WEEK_BASED_YEAR_FIELD2);
function WEEK_OF_WEEK_BASED_YEAR_FIELD2() {
_classCallCheck(this, WEEK_OF_WEEK_BASED_YEAR_FIELD2);
return _super4.apply(this, arguments);
}
_createClass(WEEK_OF_WEEK_BASED_YEAR_FIELD2, [{
key: "toString",
value: function toString() {
return "WeekOfWeekBasedYear";
}
}, {
key: "baseUnit",
value: function baseUnit() {
return ChronoUnit.WEEKS;
}
}, {
key: "rangeUnit",
value: function rangeUnit() {
return WEEK_BASED_YEARS;
}
}, {
key: "range",
value: function range() {
return ValueRange.of(1, 52, 53);
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
}
}, {
key: "rangeRefinedBy",
value: function rangeRefinedBy(temporal) {
if (temporal.isSupported(this) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: WeekOfWeekBasedYear");
}
return Field._getWeekRangeByLocalDate(LocalDate.from(temporal));
}
}, {
key: "getFrom",
value: function getFrom(temporal) {
if (temporal.isSupported(this) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: WeekOfWeekBasedYear");
}
return Field._getWeek(LocalDate.from(temporal));
}
}, {
key: "adjustInto",
value: function adjustInto(temporal, newValue) {
this.range().checkValidValue(newValue, this);
return temporal.plus(MathUtil.safeSubtract(newValue, this.getFrom(temporal)), ChronoUnit.WEEKS);
}
}, {
key: "resolve",
value: function resolve(fieldValues, partialTemporal, resolverStyle) {
var wbyLong = fieldValues.get(WEEK_BASED_YEAR);
var dowLong = fieldValues.get(ChronoField.DAY_OF_WEEK);
if (wbyLong == null || dowLong == null) {
return null;
}
var wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR);
var wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR);
var date;
if (resolverStyle === ResolverStyle.LENIENT) {
var dow = dowLong;
var weeks = 0;
if (dow > 7) {
weeks = MathUtil.intDiv(dow - 1, 7);
dow = MathUtil.intMod(dow - 1, 7) + 1;
} else if (dow < 1) {
weeks = MathUtil.intDiv(dow, 7) - 1;
dow = MathUtil.intMod(dow, 7) + 7;
}
date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).plusWeeks(weeks).with(ChronoField.DAY_OF_WEEK, dow);
} else {
var _dow2 = ChronoField.DAY_OF_WEEK.checkValidIntValue(dowLong);
if (resolverStyle === ResolverStyle.STRICT) {
var temp = LocalDate.of(wby, 1, 4);
var range = Field._getWeekRangeByLocalDate(temp);
range.checkValidValue(wowby, this);
} else {
this.range().checkValidValue(wowby, this);
}
date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).with(ChronoField.DAY_OF_WEEK, _dow2);
}
fieldValues.remove(this);
fieldValues.remove(WEEK_BASED_YEAR);
fieldValues.remove(ChronoField.DAY_OF_WEEK);
return date;
}
}, {
key: "displayName",
value: function displayName() {
return "Week";
}
}]);
return WEEK_OF_WEEK_BASED_YEAR_FIELD2;
}(Field);
var WEEK_BASED_YEAR_FIELD = function(_Field4) {
_inherits(WEEK_BASED_YEAR_FIELD2, _Field4);
var _super5 = _createSuper(WEEK_BASED_YEAR_FIELD2);
function WEEK_BASED_YEAR_FIELD2() {
_classCallCheck(this, WEEK_BASED_YEAR_FIELD2);
return _super5.apply(this, arguments);
}
_createClass(WEEK_BASED_YEAR_FIELD2, [{
key: "toString",
value: function toString() {
return "WeekBasedYear";
}
}, {
key: "baseUnit",
value: function baseUnit() {
return WEEK_BASED_YEARS;
}
}, {
key: "rangeUnit",
value: function rangeUnit() {
return ChronoUnit.FOREVER;
}
}, {
key: "range",
value: function range() {
return ChronoField.YEAR.range();
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
}
}, {
key: "rangeRefinedBy",
value: function rangeRefinedBy(temporal) {
return ChronoField.YEAR.range();
}
}, {
key: "getFrom",
value: function getFrom(temporal) {
if (temporal.isSupported(this) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: WeekBasedYear");
}
return Field._getWeekBasedYear(LocalDate.from(temporal));
}
}, {
key: "adjustInto",
value: function adjustInto(temporal, newValue) {
if (this.isSupportedBy(temporal) === false) {
throw new UnsupportedTemporalTypeException("Unsupported field: WeekBasedYear");
}
var newWby = this.range().checkValidIntValue(newValue, WEEK_BASED_YEAR);
var date = LocalDate.from(temporal);
var dow = date.get(ChronoField.DAY_OF_WEEK);
var week = Field._getWeek(date);
if (week === 53 && Field._getWeekRangeByYear(newWby) === 52) {
week = 52;
}
var resolved = LocalDate.of(newWby, 1, 4);
var days = dow - resolved.get(ChronoField.DAY_OF_WEEK) + (week - 1) * 7;
resolved = resolved.plusDays(days);
return temporal.with(resolved);
}
}]);
return WEEK_BASED_YEAR_FIELD2;
}(Field);
var Unit = function(_TemporalUnit) {
_inherits(Unit2, _TemporalUnit);
var _super6 = _createSuper(Unit2);
function Unit2(name2, estimatedDuration) {
var _this;
_classCallCheck(this, Unit2);
_this = _super6.call(this);
_this._name = name2;
_this._duration = estimatedDuration;
return _this;
}
_createClass(Unit2, [{
key: "duration",
value: function duration() {
return this._duration;
}
}, {
key: "isDurationEstimated",
value: function isDurationEstimated() {
return true;
}
}, {
key: "isDateBased",
value: function isDateBased() {
return true;
}
}, {
key: "isTimeBased",
value: function isTimeBased() {
return false;
}
}, {
key: "isSupportedBy",
value: function isSupportedBy(temporal) {
return temporal.isSupported(ChronoField.EPOCH_DAY);
}
}, {
key: "addTo",
value: function addTo(temporal, periodToAdd) {
switch (this) {
case WEEK_BASED_YEARS: {
var added = MathUtil.safeAdd(temporal.get(WEEK_BASED_YEAR), periodToAdd);
return temporal.with(WEEK_BASED_YEAR, added);
}
case QUARTER_YEARS:
return temporal.plus(MathUtil.intDiv(periodToAdd, 256), ChronoUnit.YEARS).plus(MathUtil.intMod(periodToAdd, 256) * 3, ChronoUnit.MONTHS);
default:
throw new IllegalStateException("Unreachable");
}
}
}, {
key: "between",
value: function between(temporal1, temporal2) {
switch (this) {
case WEEK_BASED_YEARS:
return MathUtil.safeSubtract(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR));
case QUARTER_YEARS:
return MathUtil.intDiv(temporal1.until(temporal2, ChronoUnit.MONTHS), 3);
default:
throw new IllegalStateException("Unreachable");
}
}
}, {
key: "toString",
value: function toString() {
return name;
}
}]);
return Unit2;
}(TemporalUnit);
var DAY_OF_QUARTER = null;
var QUARTER_OF_YEAR = null;
var WEEK_OF_WEEK_BASED_YEAR = null;
var WEEK_BASED_YEAR = null;
var WEEK_BASED_YEARS = null;
var QUARTER_YEARS = null;
function _init$8() {
DAY_OF_QUARTER = new DAY_OF_QUARTER_FIELD();
QUARTER_OF_YEAR = new QUARTER_OF_YEAR_FIELD();
WEEK_OF_WEEK_BASED_YEAR = new WEEK_OF_WEEK_BASED_YEAR_FIELD();
WEEK_BASED_YEAR = new WEEK_BASED_YEAR_FIELD();
WEEK_BASED_YEARS = new Unit("WeekBasedYears", Duration2.ofSeconds(31556952));
QUARTER_YEARS = new Unit("QuarterYears", Duration2.ofSeconds(31556952 / 4));
IsoFields.DAY_OF_QUARTER = DAY_OF_QUARTER;
IsoFields.QUARTER_OF_YEAR = QUARTER_OF_YEAR;
IsoFields.WEEK_OF_WEEK_BASED_YEAR = WEEK_OF_WEEK_BASED_YEAR;
IsoFields.WEEK_BASED_YEAR = WEEK_BASED_YEAR;
IsoFields.WEEK_BASED_YEARS = WEEK_BASED_YEARS;
IsoFields.QUARTER_YEARS = QUARTER_YEARS;
LocalDate.prototype.isoWeekOfWeekyear = function() {
return this.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
};
LocalDate.prototype.isoWeekyear = function() {
return this.get(IsoFields.WEEK_BASED_YEAR);
};
}
var DecimalStyle = function() {
function DecimalStyle2(zeroChar, positiveSignChar, negativeSignChar, decimalPointChar) {
_classCallCheck(this, DecimalStyle2);
this._zeroDigit = zeroChar;
this._zeroDigitCharCode = zeroChar.charCodeAt(0);
this._positiveSign = positiveSignChar;
this._negativeSign = negativeSignChar;
this._decimalSeparator = decimalPointChar;
}
_createClass(DecimalStyle2, [{
key: "positiveSign",
value: function positiveSign() {
return this._positiveSign;
}
}, {
key: "withPositiveSign",
value: function withPositiveSign(positiveSign) {
if (positiveSign === this._positiveSign) {
return this;
}
return new DecimalStyle2(this._zeroDigit, positiveSign, this._negativeSign, this._decimalSeparator);
}
}, {
key: "negativeSign",
value: function negativeSign() {
return this._negativeSign;
}
}, {
key: "withNegativeSign",
value: function withNegativeSign(negativeSign) {
if (negativeSign === this._negativeSign) {
return this;
}
return new DecimalStyle2(this._zeroDigit, this._positiveSign, negativeSign, this._decimalSeparator);
}
}, {
key: "zeroDigit",
value: function zeroDigit() {
return this._zeroDigit;
}
}, {
key: "withZeroDigit",
value: function withZeroDigit(zeroDigit) {
if (zeroDigit === this._zeroDigit) {
return this;
}
return new DecimalStyle2(zeroDigit, this._positiveSign, this._negativeSign, this._decimalSeparator);
}
}, {
key: "decimalSeparator",
value: function decimalSeparator() {
return this._decimalSeparator;
}
}, {
key: "withDecimalSeparator",
value: function withDecimalSeparator(decimalSeparator) {
if (decimalSeparator === this._decimalSeparator) {
return this;
}
return new DecimalStyle2(this._zeroDigit, this._positiveSign, this._negativeSign, decimalSeparator);
}
}, {
key: "convertToDigit",
value: function convertToDigit(char) {
var val = char.charCodeAt(0) - this._zeroDigitCharCode;
return val >= 0 && val <= 9 ? val : -1;
}
}, {
key: "convertNumberToI18N",
value: function convertNumberToI18N(numericText) {
if (this._zeroDigit === "0") {
return numericText;
}
var diff = this._zeroDigitCharCode - "0".charCodeAt(0);
var convertedText = "";
for (var i = 0; i < numericText.length; i++) {
convertedText += String.fromCharCode(numericText.charCodeAt(i) + diff);
}
return convertedText;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof DecimalStyle2) {
return this._zeroDigit === other._zeroDigit && this._positiveSign === other._positiveSign && this._negativeSign === other._negativeSign && this._decimalSeparator === other._decimalSeparator;
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._zeroDigit + this._positiveSign + this._negativeSign + this._decimalSeparator;
}
}, {
key: "toString",
value: function toString() {
return "DecimalStyle[".concat(this._zeroDigit).concat(this._positiveSign).concat(this._negativeSign).concat(this._decimalSeparator, "]");
}
}], [{
key: "of",
value: function of() {
throw new Error("not yet supported");
}
}, {
key: "availableLocales",
value: function availableLocales() {
throw new Error("not yet supported");
}
}]);
return DecimalStyle2;
}();
DecimalStyle.STANDARD = new DecimalStyle("0", "+", "-", ".");
var SignStyle = function(_Enum) {
_inherits(SignStyle2, _Enum);
var _super = _createSuper(SignStyle2);
function SignStyle2() {
_classCallCheck(this, SignStyle2);
return _super.apply(this, arguments);
}
_createClass(SignStyle2, [{
key: "parse",
value: function parse2(positive, strict, fixedWidth) {
switch (this) {
case SignStyle2.NORMAL:
return !positive || !strict;
case SignStyle2.ALWAYS:
case SignStyle2.EXCEEDS_PAD:
return true;
default:
return !strict && !fixedWidth;
}
}
}]);
return SignStyle2;
}(Enum);
SignStyle.NORMAL = new SignStyle("NORMAL");
SignStyle.NEVER = new SignStyle("NEVER");
SignStyle.ALWAYS = new SignStyle("ALWAYS");
SignStyle.EXCEEDS_PAD = new SignStyle("EXCEEDS_PAD");
SignStyle.NOT_NEGATIVE = new SignStyle("NOT_NEGATIVE");
var TextStyle = function(_Enum) {
_inherits(TextStyle2, _Enum);
var _super = _createSuper(TextStyle2);
function TextStyle2() {
_classCallCheck(this, TextStyle2);
return _super.apply(this, arguments);
}
_createClass(TextStyle2, [{
key: "isStandalone",
value: function isStandalone() {
switch (this) {
case TextStyle2.FULL_STANDALONE:
case TextStyle2.SHORT_STANDALONE:
case TextStyle2.NARROW_STANDALONE:
return true;
default:
return false;
}
}
}, {
key: "asStandalone",
value: function asStandalone() {
switch (this) {
case TextStyle2.FULL:
return TextStyle2.FULL_STANDALONE;
case TextStyle2.SHORT:
return TextStyle2.SHORT_STANDALONE;
case TextStyle2.NARROW:
return TextStyle2.NARROW_STANDALONE;
default:
return this;
}
}
}, {
key: "asNormal",
value: function asNormal() {
switch (this) {
case TextStyle2.FULL_STANDALONE:
return TextStyle2.FULL;
case TextStyle2.SHORT_STANDALONE:
return TextStyle2.SHORT;
case TextStyle2.NARROW_STANDALONE:
return TextStyle2.NARROW;
default:
return this;
}
}
}]);
return TextStyle2;
}(Enum);
TextStyle.FULL = new TextStyle("FULL");
TextStyle.FULL_STANDALONE = new TextStyle("FULL_STANDALONE");
TextStyle.SHORT = new TextStyle("SHORT");
TextStyle.SHORT_STANDALONE = new TextStyle("SHORT_STANDALONE");
TextStyle.NARROW = new TextStyle("NARROW");
TextStyle.NARROW_STANDALONE = new TextStyle("NARROW_STANDALONE");
var CharLiteralPrinterParser = function() {
function CharLiteralPrinterParser2(literal) {
_classCallCheck(this, CharLiteralPrinterParser2);
if (literal.length > 1) {
throw new IllegalArgumentException('invalid literal, too long: "'.concat(literal, '"'));
}
this._literal = literal;
}
_createClass(CharLiteralPrinterParser2, [{
key: "print",
value: function print(context, buf) {
buf.append(this._literal);
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var length = text.length;
if (position === length) {
return ~position;
}
var ch = text.charAt(position);
if (context.charEquals(this._literal, ch) === false) {
return ~position;
}
return position + this._literal.length;
}
}, {
key: "toString",
value: function toString() {
if (this._literal === "'") {
return "''";
}
return "'".concat(this._literal, "'");
}
}]);
return CharLiteralPrinterParser2;
}();
var CompositePrinterParser = function() {
function CompositePrinterParser2(printerParsers, optional) {
_classCallCheck(this, CompositePrinterParser2);
this._printerParsers = printerParsers;
this._optional = optional;
}
_createClass(CompositePrinterParser2, [{
key: "withOptional",
value: function withOptional(optional) {
if (optional === this._optional) {
return this;
}
return new CompositePrinterParser2(this._printerParsers, optional);
}
}, {
key: "print",
value: function print(context, buf) {
var length = buf.length();
if (this._optional) {
context.startOptional();
}
try {
for (var i = 0; i < this._printerParsers.length; i++) {
var pp = this._printerParsers[i];
if (pp.print(context, buf) === false) {
buf.setLength(length);
return true;
}
}
} finally {
if (this._optional) {
context.endOptional();
}
}
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
if (this._optional) {
context.startOptional();
var pos = position;
for (var i = 0; i < this._printerParsers.length; i++) {
var pp = this._printerParsers[i];
pos = pp.parse(context, text, pos);
if (pos < 0) {
context.endOptional(false);
return position;
}
}
context.endOptional(true);
return pos;
} else {
for (var _i = 0; _i < this._printerParsers.length; _i++) {
var _pp = this._printerParsers[_i];
position = _pp.parse(context, text, position);
if (position < 0) {
break;
}
}
return position;
}
}
}, {
key: "toString",
value: function toString() {
var buf = "";
if (this._printerParsers != null) {
buf += this._optional ? "[" : "(";
for (var i = 0; i < this._printerParsers.length; i++) {
var pp = this._printerParsers[i];
buf += pp.toString();
}
buf += this._optional ? "]" : ")";
}
return buf;
}
}]);
return CompositePrinterParser2;
}();
var FractionPrinterParser = function() {
function FractionPrinterParser2(field, minWidth, maxWidth, decimalPoint) {
_classCallCheck(this, FractionPrinterParser2);
requireNonNull(field, "field");
if (field.range().isFixed() === false) {
throw new IllegalArgumentException("Field must have a fixed set of values: ".concat(field));
}
if (minWidth < 0 || minWidth > 9) {
throw new IllegalArgumentException("Minimum width must be from 0 to 9 inclusive but was ".concat(minWidth));
}
if (maxWidth < 1 || maxWidth > 9) {
throw new IllegalArgumentException("Maximum width must be from 1 to 9 inclusive but was ".concat(maxWidth));
}
if (maxWidth < minWidth) {
throw new IllegalArgumentException("Maximum width must exceed or equal the minimum width but ".concat(maxWidth, " < ").concat(minWidth));
}
this.field = field;
this.minWidth = minWidth;
this.maxWidth = maxWidth;
this.decimalPoint = decimalPoint;
}
_createClass(FractionPrinterParser2, [{
key: "print",
value: function print(context, buf) {
var value = context.getValue(this.field);
if (value === null) {
return false;
}
var symbols = context.symbols();
if (value === 0) {
if (this.minWidth > 0) {
if (this.decimalPoint) {
buf.append(symbols.decimalSeparator());
}
for (var i = 0; i < this.minWidth; i++) {
buf.append(symbols.zeroDigit());
}
}
} else {
var fraction = this.convertToFraction(value, symbols.zeroDigit());
var outputScale = Math.min(Math.max(fraction.length, this.minWidth), this.maxWidth);
fraction = fraction.substr(0, outputScale);
if (fraction * 1 > 0) {
while (fraction.length > this.minWidth && fraction[fraction.length - 1] === "0") {
fraction = fraction.substr(0, fraction.length - 1);
}
}
var str = fraction;
str = symbols.convertNumberToI18N(str);
if (this.decimalPoint) {
buf.append(symbols.decimalSeparator());
}
buf.append(str);
}
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var effectiveMin = context.isStrict() ? this.minWidth : 0;
var effectiveMax = context.isStrict() ? this.maxWidth : 9;
var length = text.length;
if (position === length) {
return effectiveMin > 0 ? ~position : position;
}
if (this.decimalPoint) {
if (text[position] !== context.symbols().decimalSeparator()) {
return effectiveMin > 0 ? ~position : position;
}
position++;
}
var minEndPos = position + effectiveMin;
if (minEndPos > length) {
return ~position;
}
var maxEndPos = Math.min(position + effectiveMax, length);
var total = 0;
var pos = position;
while (pos < maxEndPos) {
var ch = text.charAt(pos++);
var digit = context.symbols().convertToDigit(ch);
if (digit < 0) {
if (pos < minEndPos) {
return ~position;
}
pos--;
break;
}
total = total * 10 + digit;
}
var moveLeft = pos - position;
var scale2 = Math.pow(10, moveLeft);
var value = this.convertFromFraction(total, scale2);
return context.setParsedField(this.field, value, position, pos);
}
}, {
key: "convertToFraction",
value: function convertToFraction(value, zeroDigit) {
var range = this.field.range();
range.checkValidValue(value, this.field);
var _min = range.minimum();
var _range = range.maximum() - _min + 1;
var _value = value - _min;
var _scaled = MathUtil.intDiv(_value * 1e9, _range);
var fraction = "".concat(_scaled);
while (fraction.length < 9) {
fraction = zeroDigit + fraction;
}
return fraction;
}
}, {
key: "convertFromFraction",
value: function convertFromFraction(total, scale2) {
var range = this.field.range();
var _min = range.minimum();
var _range = range.maximum() - _min + 1;
var _value = MathUtil.intDiv(total * _range, scale2);
return _value;
}
}, {
key: "toString",
value: function toString() {
var decimal = this.decimalPoint ? ",DecimalPoint" : "";
return "Fraction(".concat(this.field, ",").concat(this.minWidth, ",").concat(this.maxWidth).concat(decimal, ")");
}
}]);
return FractionPrinterParser2;
}();
var MAX_WIDTH = 15;
var EXCEED_POINTS = [0, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9];
var NumberPrinterParser = function() {
function NumberPrinterParser2(field, minWidth, maxWidth, signStyle) {
var subsequentWidth = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
_classCallCheck(this, NumberPrinterParser2);
this._field = field;
this._minWidth = minWidth;
this._maxWidth = maxWidth;
this._signStyle = signStyle;
this._subsequentWidth = subsequentWidth;
}
_createClass(NumberPrinterParser2, [{
key: "field",
value: function field() {
return this._field;
}
}, {
key: "minWidth",
value: function minWidth() {
return this._minWidth;
}
}, {
key: "maxWidth",
value: function maxWidth() {
return this._maxWidth;
}
}, {
key: "signStyle",
value: function signStyle() {
return this._signStyle;
}
}, {
key: "withFixedWidth",
value: function withFixedWidth() {
if (this._subsequentWidth === -1) {
return this;
}
return new NumberPrinterParser2(this._field, this._minWidth, this._maxWidth, this._signStyle, -1);
}
}, {
key: "withSubsequentWidth",
value: function withSubsequentWidth(subsequentWidth) {
return new NumberPrinterParser2(this._field, this._minWidth, this._maxWidth, this._signStyle, this._subsequentWidth + subsequentWidth);
}
}, {
key: "_isFixedWidth",
value: function _isFixedWidth() {
return this._subsequentWidth === -1 || this._subsequentWidth > 0 && this._minWidth === this._maxWidth && this._signStyle === SignStyle.NOT_NEGATIVE;
}
}, {
key: "print",
value: function print(context, buf) {
var contextValue = context.getValue(this._field);
if (contextValue == null) {
return false;
}
var value = this._getValue(context, contextValue);
var symbols = context.symbols();
var str = "".concat(Math.abs(value));
if (str.length > this._maxWidth) {
throw new DateTimeException("Field ".concat(this._field, " cannot be printed as the value ").concat(value, " exceeds the maximum print width of ").concat(this._maxWidth));
}
str = symbols.convertNumberToI18N(str);
if (value >= 0) {
switch (this._signStyle) {
case SignStyle.EXCEEDS_PAD:
if (this._minWidth < MAX_WIDTH && value >= EXCEED_POINTS[this._minWidth]) {
buf.append(symbols.positiveSign());
}
break;
case SignStyle.ALWAYS:
buf.append(symbols.positiveSign());
break;
}
} else {
switch (this._signStyle) {
case SignStyle.NORMAL:
case SignStyle.EXCEEDS_PAD:
case SignStyle.ALWAYS:
buf.append(symbols.negativeSign());
break;
case SignStyle.NOT_NEGATIVE:
throw new DateTimeException("Field ".concat(this._field, " cannot be printed as the value ").concat(value, " cannot be negative according to the SignStyle"));
}
}
for (var i = 0; i < this._minWidth - str.length; i++) {
buf.append(symbols.zeroDigit());
}
buf.append(str);
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var length = text.length;
if (position === length) {
return ~position;
}
assert(position >= 0 && position < length);
var sign = text.charAt(position);
var negative = false;
var positive = false;
if (sign === context.symbols().positiveSign()) {
if (this._signStyle.parse(true, context.isStrict(), this._minWidth === this._maxWidth) === false) {
return ~position;
}
positive = true;
position++;
} else if (sign === context.symbols().negativeSign()) {
if (this._signStyle.parse(false, context.isStrict(), this._minWidth === this._maxWidth) === false) {
return ~position;
}
negative = true;
position++;
} else {
if (this._signStyle === SignStyle.ALWAYS && context.isStrict()) {
return ~position;
}
}
var effMinWidth = context.isStrict() || this._isFixedWidth() ? this._minWidth : 1;
var minEndPos = position + effMinWidth;
if (minEndPos > length) {
return ~position;
}
var effMaxWidth = (context.isStrict() || this._isFixedWidth() ? this._maxWidth : 9) + Math.max(this._subsequentWidth, 0);
var total = 0;
var pos = position;
for (var pass = 0; pass < 2; pass++) {
var maxEndPos = Math.min(pos + effMaxWidth, length);
while (pos < maxEndPos) {
var ch = text.charAt(pos++);
var digit = context.symbols().convertToDigit(ch);
if (digit < 0) {
pos--;
if (pos < minEndPos) {
return ~position;
}
break;
}
if (pos - position > MAX_WIDTH) {
throw new ArithmeticException("number text exceeds length");
} else {
total = total * 10 + digit;
}
}
if (this._subsequentWidth > 0 && pass === 0) {
var parseLen = pos - position;
effMaxWidth = Math.max(effMinWidth, parseLen - this._subsequentWidth);
pos = position;
total = 0;
} else {
break;
}
}
if (negative) {
if (total === 0 && context.isStrict()) {
return ~(position - 1);
}
if (total !== 0) {
total = -total;
}
} else if (this._signStyle === SignStyle.EXCEEDS_PAD && context.isStrict()) {
var _parseLen = pos - position;
if (positive) {
if (_parseLen <= this._minWidth) {
return ~(position - 1);
}
} else {
if (_parseLen > this._minWidth) {
return ~position;
}
}
}
return this._setValue(context, total, position, pos);
}
}, {
key: "_getValue",
value: function _getValue(context, value) {
return value;
}
}, {
key: "_setValue",
value: function _setValue(context, value, errorPos, successPos) {
return context.setParsedField(this._field, value, errorPos, successPos);
}
}, {
key: "toString",
value: function toString() {
if (this._minWidth === 1 && this._maxWidth === MAX_WIDTH && this._signStyle === SignStyle.NORMAL) {
return "Value(".concat(this._field, ")");
}
if (this._minWidth === this._maxWidth && this._signStyle === SignStyle.NOT_NEGATIVE) {
return "Value(".concat(this._field, ",").concat(this._minWidth, ")");
}
return "Value(".concat(this._field, ",").concat(this._minWidth, ",").concat(this._maxWidth, ",").concat(this._signStyle, ")");
}
}]);
return NumberPrinterParser2;
}();
var ReducedPrinterParser = function(_NumberPrinterParser) {
_inherits(ReducedPrinterParser2, _NumberPrinterParser);
var _super = _createSuper(ReducedPrinterParser2);
function ReducedPrinterParser2(field, width, maxWidth, baseValue2, baseDate) {
var _this;
_classCallCheck(this, ReducedPrinterParser2);
_this = _super.call(this, field, width, maxWidth, SignStyle.NOT_NEGATIVE);
if (width < 1 || width > 10) {
throw new IllegalArgumentException("The width must be from 1 to 10 inclusive but was ".concat(width));
}
if (maxWidth < 1 || maxWidth > 10) {
throw new IllegalArgumentException("The maxWidth must be from 1 to 10 inclusive but was ".concat(maxWidth));
}
if (maxWidth < width) {
throw new IllegalArgumentException("The maxWidth must be greater than the width");
}
if (baseDate === null) {
if (field.range().isValidValue(baseValue2) === false) {
throw new IllegalArgumentException("The base value must be within the range of the field");
}
if (baseValue2 + EXCEED_POINTS[width] > MathUtil.MAX_SAFE_INTEGER) {
throw new DateTimeException("Unable to add printer-parser as the range exceeds the capacity of an int");
}
}
_this._baseValue = baseValue2;
_this._baseDate = baseDate;
return _this;
}
_createClass(ReducedPrinterParser2, [{
key: "_getValue",
value: function _getValue(context, value) {
var absValue = Math.abs(value);
var baseValue2 = this._baseValue;
if (this._baseDate !== null) {
context.temporal();
var chrono = IsoChronology.INSTANCE;
baseValue2 = chrono.date(this._baseDate).get(this._field);
}
if (value >= baseValue2 && value < baseValue2 + EXCEED_POINTS[this._minWidth]) {
return absValue % EXCEED_POINTS[this._minWidth];
}
return absValue % EXCEED_POINTS[this._maxWidth];
}
}, {
key: "_setValue",
value: function _setValue(context, value, errorPos, successPos) {
var baseValue2 = this._baseValue;
if (this._baseDate != null) {
var chrono = context.getEffectiveChronology();
baseValue2 = chrono.date(this._baseDate).get(this._field);
}
var parseLen = successPos - errorPos;
if (parseLen === this._minWidth && value >= 0) {
var range = EXCEED_POINTS[this._minWidth];
var lastPart = baseValue2 % range;
var basePart = baseValue2 - lastPart;
if (baseValue2 > 0) {
value = basePart + value;
} else {
value = basePart - value;
}
if (value < baseValue2) {
value += range;
}
}
return context.setParsedField(this._field, value, errorPos, successPos);
}
}, {
key: "withFixedWidth",
value: function withFixedWidth() {
if (this._subsequentWidth === -1) {
return this;
}
return new ReducedPrinterParser2(this._field, this._minWidth, this._maxWidth, this._baseValue, this._baseDate, -1);
}
}, {
key: "withSubsequentWidth",
value: function withSubsequentWidth(subsequentWidth) {
return new ReducedPrinterParser2(this._field, this._minWidth, this._maxWidth, this._baseValue, this._baseDate, this._subsequentWidth + subsequentWidth);
}
}, {
key: "isFixedWidth",
value: function isFixedWidth(context) {
if (context.isStrict() === false) {
return false;
}
return _get(_getPrototypeOf(ReducedPrinterParser2.prototype), "isFixedWidth", this).call(this, context);
}
}, {
key: "toString",
value: function toString() {
return "ReducedValue(".concat(this._field, ",").concat(this._minWidth, ",").concat(this._maxWidth, ",").concat(this._baseDate != null ? this._baseDate : this._baseValue, ")");
}
}]);
return ReducedPrinterParser2;
}(NumberPrinterParser);
var PATTERNS = ["+HH", "+HHmm", "+HH:mm", "+HHMM", "+HH:MM", "+HHMMss", "+HH:MM:ss", "+HHMMSS", "+HH:MM:SS"];
var OffsetIdPrinterParser = function() {
function OffsetIdPrinterParser2(noOffsetText, pattern) {
_classCallCheck(this, OffsetIdPrinterParser2);
requireNonNull(noOffsetText, "noOffsetText");
requireNonNull(pattern, "pattern");
this.noOffsetText = noOffsetText;
this.type = this._checkPattern(pattern);
}
_createClass(OffsetIdPrinterParser2, [{
key: "_checkPattern",
value: function _checkPattern(pattern) {
for (var i = 0; i < PATTERNS.length; i++) {
if (PATTERNS[i] === pattern) {
return i;
}
}
throw new IllegalArgumentException("Invalid zone offset pattern: ".concat(pattern));
}
}, {
key: "print",
value: function print(context, buf) {
var offsetSecs = context.getValue(ChronoField.OFFSET_SECONDS);
if (offsetSecs == null) {
return false;
}
var totalSecs = MathUtil.safeToInt(offsetSecs);
if (totalSecs === 0) {
buf.append(this.noOffsetText);
} else {
var absHours = Math.abs(MathUtil.intMod(MathUtil.intDiv(totalSecs, 3600), 100));
var absMinutes = Math.abs(MathUtil.intMod(MathUtil.intDiv(totalSecs, 60), 60));
var absSeconds = Math.abs(MathUtil.intMod(totalSecs, 60));
var bufPos = buf.length();
var output = absHours;
buf.append(totalSecs < 0 ? "-" : "+").appendChar("".concat(MathUtil.intDiv(absHours, 10), "0")).appendChar("".concat(MathUtil.intMod(absHours, 10), "0"));
if (this.type >= 3 || this.type >= 1 && absMinutes > 0) {
buf.append(this.type % 2 === 0 ? ":" : "").appendChar("".concat(MathUtil.intDiv(absMinutes, 10), "0")).appendChar("".concat(absMinutes % 10, "0"));
output += absMinutes;
if (this.type >= 7 || this.type >= 5 && absSeconds > 0) {
buf.append(this.type % 2 === 0 ? ":" : "").appendChar("".concat(MathUtil.intDiv(absSeconds, 10), "0")).appendChar("".concat(absSeconds % 10, "0"));
output += absSeconds;
}
}
if (output === 0) {
buf.setLength(bufPos);
buf.append(this.noOffsetText);
}
}
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var length = text.length;
var noOffsetLen = this.noOffsetText.length;
if (noOffsetLen === 0) {
if (position === length) {
return context.setParsedField(ChronoField.OFFSET_SECONDS, 0, position, position);
}
} else {
if (position === length) {
return ~position;
}
if (context.subSequenceEquals(text, position, this.noOffsetText, 0, noOffsetLen)) {
return context.setParsedField(ChronoField.OFFSET_SECONDS, 0, position, position + noOffsetLen);
}
}
var sign = text[position];
if (sign === "+" || sign === "-") {
var negative = sign === "-" ? -1 : 1;
var array = [0, 0, 0, 0];
array[0] = position + 1;
if ((this._parseNumber(array, 1, text, true) || this._parseNumber(array, 2, text, this.type >= 3) || this._parseNumber(array, 3, text, false)) === false) {
var offsetSecs = MathUtil.safeZero(negative * (array[1] * 3600 + array[2] * 60 + array[3]));
return context.setParsedField(ChronoField.OFFSET_SECONDS, offsetSecs, position, array[0]);
}
}
if (noOffsetLen === 0) {
return context.setParsedField(ChronoField.OFFSET_SECONDS, 0, position, position + noOffsetLen);
}
return ~position;
}
}, {
key: "_parseNumber",
value: function _parseNumber(array, arrayIndex, parseText, required) {
if ((this.type + 3) / 2 < arrayIndex) {
return false;
}
var pos = array[0];
if (this.type % 2 === 0 && arrayIndex > 1) {
if (pos + 1 > parseText.length || parseText[pos] !== ":") {
return required;
}
pos++;
}
if (pos + 2 > parseText.length) {
return required;
}
var ch1 = parseText[pos++];
var ch2 = parseText[pos++];
if (ch1 < "0" || ch1 > "9" || ch2 < "0" || ch2 > "9") {
return required;
}
var value = (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
if (value < 0 || value > 59) {
return required;
}
array[arrayIndex] = value;
array[0] = pos;
return false;
}
}, {
key: "toString",
value: function toString() {
var converted = this.noOffsetText.replace("'", "''");
return "Offset(".concat(PATTERNS[this.type], ",'").concat(converted, "')");
}
}]);
return OffsetIdPrinterParser2;
}();
OffsetIdPrinterParser.INSTANCE_ID = new OffsetIdPrinterParser("Z", "+HH:MM:ss");
OffsetIdPrinterParser.PATTERNS = PATTERNS;
var PadPrinterParserDecorator = function() {
function PadPrinterParserDecorator2(printerParser, padWidth, padChar) {
_classCallCheck(this, PadPrinterParserDecorator2);
this._printerParser = printerParser;
this._padWidth = padWidth;
this._padChar = padChar;
}
_createClass(PadPrinterParserDecorator2, [{
key: "print",
value: function print(context, buf) {
var preLen = buf.length();
if (this._printerParser.print(context, buf) === false) {
return false;
}
var len = buf.length() - preLen;
if (len > this._padWidth) {
throw new DateTimeException("Cannot print as output of ".concat(len, " characters exceeds pad width of ").concat(this._padWidth));
}
for (var i = 0; i < this._padWidth - len; i++) {
buf.insert(preLen, this._padChar);
}
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var strict = context.isStrict();
var caseSensitive = context.isCaseSensitive();
assert(!(position > text.length));
assert(position >= 0);
if (position === text.length) {
return ~position;
}
var endPos = position + this._padWidth;
if (endPos > text.length) {
if (strict) {
return ~position;
}
endPos = text.length;
}
var pos = position;
while (pos < endPos && (caseSensitive ? text[pos] === this._padChar : context.charEquals(text[pos], this._padChar))) {
pos++;
}
text = text.substring(0, endPos);
var resultPos = this._printerParser.parse(context, text, pos);
if (resultPos !== endPos && strict) {
return ~(position + pos);
}
return resultPos;
}
}, {
key: "toString",
value: function toString() {
return "Pad(".concat(this._printerParser, ",").concat(this._padWidth).concat(this._padChar === " " ? ")" : ",'".concat(this._padChar, "')"));
}
}]);
return PadPrinterParserDecorator2;
}();
var SettingsParser = function(_Enum) {
_inherits(SettingsParser2, _Enum);
var _super = _createSuper(SettingsParser2);
function SettingsParser2() {
_classCallCheck(this, SettingsParser2);
return _super.apply(this, arguments);
}
_createClass(SettingsParser2, [{
key: "print",
value: function print() {
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
switch (this) {
case SettingsParser2.SENSITIVE:
context.setCaseSensitive(true);
break;
case SettingsParser2.INSENSITIVE:
context.setCaseSensitive(false);
break;
case SettingsParser2.STRICT:
context.setStrict(true);
break;
case SettingsParser2.LENIENT:
context.setStrict(false);
break;
}
return position;
}
}, {
key: "toString",
value: function toString() {
switch (this) {
case SettingsParser2.SENSITIVE:
return "ParseCaseSensitive(true)";
case SettingsParser2.INSENSITIVE:
return "ParseCaseSensitive(false)";
case SettingsParser2.STRICT:
return "ParseStrict(true)";
case SettingsParser2.LENIENT:
return "ParseStrict(false)";
}
}
}]);
return SettingsParser2;
}(Enum);
SettingsParser.SENSITIVE = new SettingsParser("SENSITIVE");
SettingsParser.INSENSITIVE = new SettingsParser("INSENSITIVE");
SettingsParser.STRICT = new SettingsParser("STRICT");
SettingsParser.LENIENT = new SettingsParser("LENIENT");
var StringLiteralPrinterParser = function() {
function StringLiteralPrinterParser2(literal) {
_classCallCheck(this, StringLiteralPrinterParser2);
this._literal = literal;
}
_createClass(StringLiteralPrinterParser2, [{
key: "print",
value: function print(context, buf) {
buf.append(this._literal);
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var length = text.length;
assert(!(position > length || position < 0));
if (context.subSequenceEquals(text, position, this._literal, 0, this._literal.length) === false) {
return ~position;
}
return position + this._literal.length;
}
}, {
key: "toString",
value: function toString() {
var converted = this._literal.replace("'", "''");
return "'".concat(converted, "'");
}
}]);
return StringLiteralPrinterParser2;
}();
var ZoneRulesProvider = function() {
function ZoneRulesProvider2() {
_classCallCheck(this, ZoneRulesProvider2);
}
_createClass(ZoneRulesProvider2, null, [{
key: "getRules",
value: function getRules(zoneId) {
throw new DateTimeException("unsupported ZoneId:".concat(zoneId));
}
}, {
key: "getAvailableZoneIds",
value: function getAvailableZoneIds() {
return [];
}
}]);
return ZoneRulesProvider2;
}();
var ZoneRegion = function(_ZoneId) {
_inherits(ZoneRegion2, _ZoneId);
var _super = _createSuper(ZoneRegion2);
function ZoneRegion2(id, rules) {
var _this;
_classCallCheck(this, ZoneRegion2);
_this = _super.call(this);
_this._id = id;
_this._rules = rules;
return _this;
}
_createClass(ZoneRegion2, [{
key: "id",
value: function id() {
return this._id;
}
}, {
key: "rules",
value: function rules() {
return this._rules;
}
}], [{
key: "ofId",
value: function ofId(zoneId) {
var rules = ZoneRulesProvider.getRules(zoneId);
return new ZoneRegion2(zoneId, rules);
}
}]);
return ZoneRegion2;
}(ZoneId);
var ZoneIdPrinterParser = function() {
function ZoneIdPrinterParser2(query, description) {
_classCallCheck(this, ZoneIdPrinterParser2);
this.query = query;
this.description = description;
}
_createClass(ZoneIdPrinterParser2, [{
key: "print",
value: function print(context, buf) {
var zone = context.getValueQuery(this.query);
if (zone == null) {
return false;
}
buf.append(zone.id());
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var length = text.length;
if (position > length) {
return ~position;
}
if (position === length) {
return ~position;
}
var nextChar = text.charAt(position);
if (nextChar === "+" || nextChar === "-") {
var newContext = context.copy();
var endPos = OffsetIdPrinterParser.INSTANCE_ID.parse(newContext, text, position);
if (endPos < 0) {
return endPos;
}
var offset = newContext.getParsed(ChronoField.OFFSET_SECONDS);
var zone = ZoneOffset.ofTotalSeconds(offset);
context.setParsedZone(zone);
return endPos;
} else if (length >= position + 2) {
var nextNextChar = text.charAt(position + 1);
if (context.charEquals(nextChar, "U") && context.charEquals(nextNextChar, "T")) {
if (length >= position + 3 && context.charEquals(text.charAt(position + 2), "C")) {
return this._parsePrefixedOffset(context, text, position, position + 3);
}
return this._parsePrefixedOffset(context, text, position, position + 2);
} else if (context.charEquals(nextChar, "G") && length >= position + 3 && context.charEquals(nextNextChar, "M") && context.charEquals(text.charAt(position + 2), "T")) {
return this._parsePrefixedOffset(context, text, position, position + 3);
}
}
if (text.substr(position, 6) === "SYSTEM") {
context.setParsedZone(ZoneId.systemDefault());
return position + 6;
}
if (context.charEquals(nextChar, "Z")) {
context.setParsedZone(ZoneOffset.UTC);
return position + 1;
}
var availableZoneIds = ZoneRulesProvider.getAvailableZoneIds();
if (zoneIdTree.size !== availableZoneIds.length) {
zoneIdTree = ZoneIdTree.createTreeMap(availableZoneIds);
}
var maxParseLength = length - position;
var treeMap = zoneIdTree.treeMap;
var parsedZoneId = null;
var parseLength = 0;
while (treeMap != null) {
var parsedSubZoneId = text.substr(position, Math.min(treeMap.length, maxParseLength));
treeMap = treeMap.get(parsedSubZoneId);
if (treeMap != null && treeMap.isLeaf) {
parsedZoneId = parsedSubZoneId;
parseLength = treeMap.length;
}
}
if (parsedZoneId != null) {
context.setParsedZone(ZoneRegion.ofId(parsedZoneId));
return position + parseLength;
}
return ~position;
}
}, {
key: "_parsePrefixedOffset",
value: function _parsePrefixedOffset(context, text, prefixPos, position) {
var prefix = text.substring(prefixPos, position).toUpperCase();
var newContext = context.copy();
if (position < text.length && context.charEquals(text.charAt(position), "Z")) {
context.setParsedZone(ZoneId.ofOffset(prefix, ZoneOffset.UTC));
return position;
}
var endPos = OffsetIdPrinterParser.INSTANCE_ID.parse(newContext, text, position);
if (endPos < 0) {
context.setParsedZone(ZoneId.ofOffset(prefix, ZoneOffset.UTC));
return position;
}
var offsetSecs = newContext.getParsed(ChronoField.OFFSET_SECONDS);
var offset = ZoneOffset.ofTotalSeconds(offsetSecs);
context.setParsedZone(ZoneId.ofOffset(prefix, offset));
return endPos;
}
}, {
key: "toString",
value: function toString() {
return this.description;
}
}]);
return ZoneIdPrinterParser2;
}();
var ZoneIdTree = function() {
function ZoneIdTree2(size, treeMap) {
_classCallCheck(this, ZoneIdTree2);
this.size = size;
this.treeMap = treeMap;
}
_createClass(ZoneIdTree2, null, [{
key: "createTreeMap",
value: function createTreeMap(availableZoneIds) {
var sortedZoneIds = availableZoneIds.sort(function(a, b) {
return a.length - b.length;
});
var treeMap = new ZoneIdTreeMap(sortedZoneIds[0].length, false);
for (var i = 0; i < sortedZoneIds.length; i++) {
treeMap.add(sortedZoneIds[i]);
}
return new ZoneIdTree2(sortedZoneIds.length, treeMap);
}
}]);
return ZoneIdTree2;
}();
var ZoneIdTreeMap = function() {
function ZoneIdTreeMap2() {
var length = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
var isLeaf = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
_classCallCheck(this, ZoneIdTreeMap2);
this.length = length;
this.isLeaf = isLeaf;
this._treeMap = {};
}
_createClass(ZoneIdTreeMap2, [{
key: "add",
value: function add(zoneId) {
var idLength = zoneId.length;
if (idLength === this.length) {
this._treeMap[zoneId] = new ZoneIdTreeMap2(idLength, true);
} else if (idLength > this.length) {
var subZoneId = zoneId.substr(0, this.length);
var subTreeMap = this._treeMap[subZoneId];
if (subTreeMap == null) {
subTreeMap = new ZoneIdTreeMap2(idLength, false);
this._treeMap[subZoneId] = subTreeMap;
}
subTreeMap.add(zoneId);
}
}
}, {
key: "get",
value: function get(zoneId) {
return this._treeMap[zoneId];
}
}]);
return ZoneIdTreeMap2;
}();
var zoneIdTree = new ZoneIdTree([]);
var MAX_WIDTH$1 = 15;
var DateTimeFormatterBuilder = function() {
function DateTimeFormatterBuilder2() {
_classCallCheck(this, DateTimeFormatterBuilder2);
this._active = this;
this._parent = null;
this._printerParsers = [];
this._optional = false;
this._padNextWidth = 0;
this._padNextChar = null;
this._valueParserIndex = -1;
}
_createClass(DateTimeFormatterBuilder2, [{
key: "parseCaseSensitive",
value: function parseCaseSensitive() {
this._appendInternalPrinterParser(SettingsParser.SENSITIVE);
return this;
}
}, {
key: "parseCaseInsensitive",
value: function parseCaseInsensitive() {
this._appendInternalPrinterParser(SettingsParser.INSENSITIVE);
return this;
}
}, {
key: "parseStrict",
value: function parseStrict() {
this._appendInternalPrinterParser(SettingsParser.STRICT);
return this;
}
}, {
key: "parseLenient",
value: function parseLenient() {
this._appendInternalPrinterParser(SettingsParser.LENIENT);
return this;
}
}, {
key: "appendValue",
value: function appendValue() {
if (arguments.length === 1) {
return this._appendValue1.apply(this, arguments);
} else if (arguments.length === 2) {
return this._appendValue2.apply(this, arguments);
} else {
return this._appendValue4.apply(this, arguments);
}
}
}, {
key: "_appendValue1",
value: function _appendValue1(field) {
requireNonNull(field);
this._appendValuePrinterParser(new NumberPrinterParser(field, 1, MAX_WIDTH$1, SignStyle.NORMAL));
return this;
}
}, {
key: "_appendValue2",
value: function _appendValue2(field, width) {
requireNonNull(field);
if (width < 1 || width > MAX_WIDTH$1) {
throw new IllegalArgumentException("The width must be from 1 to ".concat(MAX_WIDTH$1, " inclusive but was ").concat(width));
}
var pp = new NumberPrinterParser(field, width, width, SignStyle.NOT_NEGATIVE);
this._appendValuePrinterParser(pp);
return this;
}
}, {
key: "_appendValue4",
value: function _appendValue4(field, minWidth, maxWidth, signStyle) {
requireNonNull(field);
requireNonNull(signStyle);
if (minWidth === maxWidth && signStyle === SignStyle.NOT_NEGATIVE) {
return this._appendValue2(field, maxWidth);
}
if (minWidth < 1 || minWidth > MAX_WIDTH$1) {
throw new IllegalArgumentException("The minimum width must be from 1 to ".concat(MAX_WIDTH$1, " inclusive but was ").concat(minWidth));
}
if (maxWidth < 1 || maxWidth > MAX_WIDTH$1) {
throw new IllegalArgumentException("The minimum width must be from 1 to ".concat(MAX_WIDTH$1, " inclusive but was ").concat(maxWidth));
}
if (maxWidth < minWidth) {
throw new IllegalArgumentException("The maximum width must exceed or equal the minimum width but ".concat(maxWidth, " < ").concat(minWidth));
}
var pp = new NumberPrinterParser(field, minWidth, maxWidth, signStyle);
this._appendValuePrinterParser(pp);
return this;
}
}, {
key: "appendValueReduced",
value: function appendValueReduced() {
if (arguments.length === 4 && arguments[3] instanceof ChronoLocalDate) {
return this._appendValueReducedFieldWidthMaxWidthBaseDate.apply(this, arguments);
} else {
return this._appendValueReducedFieldWidthMaxWidthBaseValue.apply(this, arguments);
}
}
}, {
key: "_appendValueReducedFieldWidthMaxWidthBaseValue",
value: function _appendValueReducedFieldWidthMaxWidthBaseValue(field, width, maxWidth, baseValue2) {
requireNonNull(field, "field");
var pp = new ReducedPrinterParser(field, width, maxWidth, baseValue2, null);
this._appendValuePrinterParser(pp);
return this;
}
}, {
key: "_appendValueReducedFieldWidthMaxWidthBaseDate",
value: function _appendValueReducedFieldWidthMaxWidthBaseDate(field, width, maxWidth, baseDate) {
requireNonNull(field, "field");
requireNonNull(baseDate, "baseDate");
requireInstance(baseDate, ChronoLocalDate, "baseDate");
var pp = new ReducedPrinterParser(field, width, maxWidth, 0, baseDate);
this._appendValuePrinterParser(pp);
return this;
}
}, {
key: "_appendValuePrinterParser",
value: function _appendValuePrinterParser(pp) {
assert(pp != null);
if (this._active._valueParserIndex >= 0 && this._active._printerParsers[this._active._valueParserIndex] instanceof NumberPrinterParser) {
var activeValueParser = this._active._valueParserIndex;
var basePP = this._active._printerParsers[activeValueParser];
if (pp.minWidth() === pp.maxWidth() && pp.signStyle() === SignStyle.NOT_NEGATIVE) {
basePP = basePP.withSubsequentWidth(pp.maxWidth());
this._appendInternal(pp.withFixedWidth());
this._active._valueParserIndex = activeValueParser;
} else {
basePP = basePP.withFixedWidth();
this._active._valueParserIndex = this._appendInternal(pp);
}
this._active._printerParsers[activeValueParser] = basePP;
} else {
this._active._valueParserIndex = this._appendInternal(pp);
}
return this;
}
}, {
key: "appendFraction",
value: function appendFraction(field, minWidth, maxWidth, decimalPoint) {
this._appendInternal(new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint));
return this;
}
}, {
key: "appendInstant",
value: function appendInstant() {
var fractionalDigits = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -2;
if (fractionalDigits < -2 || fractionalDigits > 9) {
throw new IllegalArgumentException("Invalid fractional digits: ".concat(fractionalDigits));
}
this._appendInternal(new InstantPrinterParser(fractionalDigits));
return this;
}
}, {
key: "appendOffsetId",
value: function appendOffsetId() {
this._appendInternal(OffsetIdPrinterParser.INSTANCE_ID);
return this;
}
}, {
key: "appendOffset",
value: function appendOffset(pattern, noOffsetText) {
this._appendInternalPrinterParser(new OffsetIdPrinterParser(noOffsetText, pattern));
return this;
}
}, {
key: "appendZoneId",
value: function appendZoneId() {
this._appendInternal(new ZoneIdPrinterParser(TemporalQueries.zoneId(), "ZoneId()"));
return this;
}
}, {
key: "appendPattern",
value: function appendPattern(pattern) {
requireNonNull(pattern, "pattern");
this._parsePattern(pattern);
return this;
}
}, {
key: "appendZoneText",
value: function appendZoneText() {
throw new IllegalArgumentException("Pattern using (localized) text not implemented, use @js-joda/locale plugin!");
}
}, {
key: "appendText",
value: function appendText() {
throw new IllegalArgumentException("Pattern using (localized) text not implemented, use @js-joda/locale plugin!");
}
}, {
key: "appendLocalizedOffset",
value: function appendLocalizedOffset() {
throw new IllegalArgumentException("Pattern using (localized) text not implemented, use @js-joda/locale plugin!");
}
}, {
key: "appendWeekField",
value: function appendWeekField() {
throw new IllegalArgumentException("Pattern using (localized) text not implemented, use @js-joda/locale plugin!");
}
}, {
key: "_parsePattern",
value: function _parsePattern(pattern) {
var FIELD_MAP = {
"G": ChronoField.ERA,
"y": ChronoField.YEAR_OF_ERA,
"u": ChronoField.YEAR,
"Q": IsoFields.QUARTER_OF_YEAR,
"q": IsoFields.QUARTER_OF_YEAR,
"M": ChronoField.MONTH_OF_YEAR,
"L": ChronoField.MONTH_OF_YEAR,
"D": ChronoField.DAY_OF_YEAR,
"d": ChronoField.DAY_OF_MONTH,
"F": ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH,
"E": ChronoField.DAY_OF_WEEK,
"c": ChronoField.DAY_OF_WEEK,
"e": ChronoField.DAY_OF_WEEK,
"a": ChronoField.AMPM_OF_DAY,
"H": ChronoField.HOUR_OF_DAY,
"k": ChronoField.CLOCK_HOUR_OF_DAY,
"K": ChronoField.HOUR_OF_AMPM,
"h": ChronoField.CLOCK_HOUR_OF_AMPM,
"m": ChronoField.MINUTE_OF_HOUR,
"s": ChronoField.SECOND_OF_MINUTE,
"S": ChronoField.NANO_OF_SECOND,
"A": ChronoField.MILLI_OF_DAY,
"n": ChronoField.NANO_OF_SECOND,
"N": ChronoField.NANO_OF_DAY
};
for (var pos = 0; pos < pattern.length; pos++) {
var cur = pattern.charAt(pos);
if (cur >= "A" && cur <= "Z" || cur >= "a" && cur <= "z") {
var start = pos++;
for (; pos < pattern.length && pattern.charAt(pos) === cur; pos++) {
}
var count = pos - start;
if (cur === "p") {
var pad = 0;
if (pos < pattern.length) {
cur = pattern.charAt(pos);
if (cur >= "A" && cur <= "Z" || cur >= "a" && cur <= "z") {
pad = count;
start = pos++;
for (; pos < pattern.length && pattern.charAt(pos) === cur; pos++) {
}
count = pos - start;
}
}
if (pad === 0) {
throw new IllegalArgumentException("Pad letter 'p' must be followed by valid pad pattern: ".concat(pattern));
}
this.padNext(pad);
}
var field = FIELD_MAP[cur];
if (field != null) {
this._parseField(cur, count, field);
} else if (cur === "z") {
if (count > 4) {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
} else if (count === 4) {
this.appendZoneText(TextStyle.FULL);
} else {
this.appendZoneText(TextStyle.SHORT);
}
} else if (cur === "V") {
if (count !== 2) {
throw new IllegalArgumentException("Pattern letter count must be 2: ".concat(cur));
}
this.appendZoneId();
} else if (cur === "Z") {
if (count < 4) {
this.appendOffset("+HHMM", "+0000");
} else if (count === 4) {
this.appendLocalizedOffset(TextStyle.FULL);
} else if (count === 5) {
this.appendOffset("+HH:MM:ss", "Z");
} else {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
} else if (cur === "O") {
if (count === 1) {
this.appendLocalizedOffset(TextStyle.SHORT);
} else if (count === 4) {
this.appendLocalizedOffset(TextStyle.FULL);
} else {
throw new IllegalArgumentException("Pattern letter count must be 1 or 4: ".concat(cur));
}
} else if (cur === "X") {
if (count > 5) {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
this.appendOffset(OffsetIdPrinterParser.PATTERNS[count + (count === 1 ? 0 : 1)], "Z");
} else if (cur === "x") {
if (count > 5) {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
var zero = count === 1 ? "+00" : count % 2 === 0 ? "+0000" : "+00:00";
this.appendOffset(OffsetIdPrinterParser.PATTERNS[count + (count === 1 ? 0 : 1)], zero);
} else if (cur === "W") {
if (count > 1) {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
this.appendWeekField("W", count);
} else if (cur === "w") {
if (count > 2) {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
this.appendWeekField("w", count);
} else if (cur === "Y") {
this.appendWeekField("Y", count);
} else {
throw new IllegalArgumentException("Unknown pattern letter: ".concat(cur));
}
pos--;
} else if (cur === "'") {
var _start = pos++;
for (; pos < pattern.length; pos++) {
if (pattern.charAt(pos) === "'") {
if (pos + 1 < pattern.length && pattern.charAt(pos + 1) === "'") {
pos++;
} else {
break;
}
}
}
if (pos >= pattern.length) {
throw new IllegalArgumentException("Pattern ends with an incomplete string literal: ".concat(pattern));
}
var str = pattern.substring(_start + 1, pos);
if (str.length === 0) {
this.appendLiteral("'");
} else {
this.appendLiteral(str.replace("''", "'"));
}
} else if (cur === "[") {
this.optionalStart();
} else if (cur === "]") {
if (this._active._parent === null) {
throw new IllegalArgumentException("Pattern invalid as it contains ] without previous [");
}
this.optionalEnd();
} else if (cur === "{" || cur === "}" || cur === "#") {
throw new IllegalArgumentException("Pattern includes reserved character: '".concat(cur, "'"));
} else {
this.appendLiteral(cur);
}
}
}
}, {
key: "_parseField",
value: function _parseField(cur, count, field) {
switch (cur) {
case "u":
case "y":
if (count === 2) {
this.appendValueReduced(field, 2, 2, ReducedPrinterParser.BASE_DATE);
} else if (count < 4) {
this.appendValue(field, count, MAX_WIDTH$1, SignStyle.NORMAL);
} else {
this.appendValue(field, count, MAX_WIDTH$1, SignStyle.EXCEEDS_PAD);
}
break;
case "M":
case "Q":
switch (count) {
case 1:
this.appendValue(field);
break;
case 2:
this.appendValue(field, 2);
break;
case 3:
this.appendText(field, TextStyle.SHORT);
break;
case 4:
this.appendText(field, TextStyle.FULL);
break;
case 5:
this.appendText(field, TextStyle.NARROW);
break;
default:
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "L":
case "q":
switch (count) {
case 1:
this.appendValue(field);
break;
case 2:
this.appendValue(field, 2);
break;
case 3:
this.appendText(field, TextStyle.SHORT_STANDALONE);
break;
case 4:
this.appendText(field, TextStyle.FULL_STANDALONE);
break;
case 5:
this.appendText(field, TextStyle.NARROW_STANDALONE);
break;
default:
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "e":
switch (count) {
case 1:
case 2:
this.appendWeekField("e", count);
break;
case 3:
this.appendText(field, TextStyle.SHORT);
break;
case 4:
this.appendText(field, TextStyle.FULL);
break;
case 5:
this.appendText(field, TextStyle.NARROW);
break;
default:
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "c":
switch (count) {
case 1:
this.appendWeekField("c", count);
break;
case 2:
throw new IllegalArgumentException("Invalid number of pattern letters: ".concat(cur));
case 3:
this.appendText(field, TextStyle.SHORT_STANDALONE);
break;
case 4:
this.appendText(field, TextStyle.FULL_STANDALONE);
break;
case 5:
this.appendText(field, TextStyle.NARROW_STANDALONE);
break;
default:
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "a":
if (count === 1) {
this.appendText(field, TextStyle.SHORT);
} else {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "E":
case "G":
switch (count) {
case 1:
case 2:
case 3:
this.appendText(field, TextStyle.SHORT);
break;
case 4:
this.appendText(field, TextStyle.FULL);
break;
case 5:
this.appendText(field, TextStyle.NARROW);
break;
default:
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "S":
this.appendFraction(ChronoField.NANO_OF_SECOND, count, count, false);
break;
case "F":
if (count === 1) {
this.appendValue(field);
} else {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "d":
case "h":
case "H":
case "k":
case "K":
case "m":
case "s":
if (count === 1) {
this.appendValue(field);
} else if (count === 2) {
this.appendValue(field, count);
} else {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
case "D":
if (count === 1) {
this.appendValue(field);
} else if (count <= 3) {
this.appendValue(field, count);
} else {
throw new IllegalArgumentException("Too many pattern letters: ".concat(cur));
}
break;
default:
if (count === 1) {
this.appendValue(field);
} else {
this.appendValue(field, count);
}
break;
}
}
}, {
key: "padNext",
value: function padNext() {
if (arguments.length === 1) {
return this._padNext1.apply(this, arguments);
} else {
return this._padNext2.apply(this, arguments);
}
}
}, {
key: "_padNext1",
value: function _padNext1(padWidth) {
return this._padNext2(padWidth, " ");
}
}, {
key: "_padNext2",
value: function _padNext2(padWidth, padChar) {
if (padWidth < 1) {
throw new IllegalArgumentException("The pad width must be at least one but was ".concat(padWidth));
}
this._active._padNextWidth = padWidth;
this._active._padNextChar = padChar;
this._active._valueParserIndex = -1;
return this;
}
}, {
key: "optionalStart",
value: function optionalStart() {
this._active._valueParserIndex = -1;
this._active = DateTimeFormatterBuilder2._of(this._active, true);
return this;
}
}, {
key: "optionalEnd",
value: function optionalEnd() {
if (this._active._parent == null) {
throw new IllegalStateException("Cannot call optionalEnd() as there was no previous call to optionalStart()");
}
if (this._active._printerParsers.length > 0) {
var cpp = new CompositePrinterParser(this._active._printerParsers, this._active._optional);
this._active = this._active._parent;
this._appendInternal(cpp);
} else {
this._active = this._active._parent;
}
return this;
}
}, {
key: "_appendInternal",
value: function _appendInternal(pp) {
assert(pp != null);
if (this._active._padNextWidth > 0) {
if (pp != null) {
pp = new PadPrinterParserDecorator(pp, this._active._padNextWidth, this._active._padNextChar);
}
this._active._padNextWidth = 0;
this._active._padNextChar = 0;
}
this._active._printerParsers.push(pp);
this._active._valueParserIndex = -1;
return this._active._printerParsers.length - 1;
}
}, {
key: "appendLiteral",
value: function appendLiteral(literal) {
assert(literal != null);
if (literal.length > 0) {
if (literal.length === 1) {
this._appendInternalPrinterParser(new CharLiteralPrinterParser(literal.charAt(0)));
} else {
this._appendInternalPrinterParser(new StringLiteralPrinterParser(literal));
}
}
return this;
}
}, {
key: "_appendInternalPrinterParser",
value: function _appendInternalPrinterParser(pp) {
assert(pp != null);
if (this._active._padNextWidth > 0) {
if (pp != null) {
pp = new PadPrinterParserDecorator(pp, this._active._padNextWidth, this._active._padNextChar);
}
this._active._padNextWidth = 0;
this._active._padNextChar = 0;
}
this._active._printerParsers.push(pp);
this._active._valueParserIndex = -1;
return this._active._printerParsers.length - 1;
}
}, {
key: "append",
value: function append(formatter) {
requireNonNull(formatter, "formatter");
this._appendInternal(formatter._toPrinterParser(false));
return this;
}
}, {
key: "toFormatter",
value: function toFormatter() {
var resolverStyle = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ResolverStyle.SMART;
while (this._active._parent != null) {
this.optionalEnd();
}
var pp = new CompositePrinterParser(this._printerParsers, false);
return new DateTimeFormatter(pp, null, DecimalStyle.STANDARD, resolverStyle, null, null, null);
}
}], [{
key: "_of",
value: function _of(parent, optional) {
requireNonNull(parent, "parent");
requireNonNull(optional, "optional");
var dtFormatterBuilder = new DateTimeFormatterBuilder2();
dtFormatterBuilder._parent = parent;
dtFormatterBuilder._optional = optional;
return dtFormatterBuilder;
}
}]);
return DateTimeFormatterBuilder2;
}();
var SECONDS_PER_10000_YEARS = 146097 * 25 * 86400;
var SECONDS_0000_TO_1970 = (146097 * 5 - (30 * 365 + 7)) * 86400;
var InstantPrinterParser = function() {
function InstantPrinterParser2(fractionalDigits) {
_classCallCheck(this, InstantPrinterParser2);
this.fractionalDigits = fractionalDigits;
}
_createClass(InstantPrinterParser2, [{
key: "print",
value: function print(context, buf) {
var inSecs = context.getValue(ChronoField.INSTANT_SECONDS);
var inNanos = 0;
if (context.temporal().isSupported(ChronoField.NANO_OF_SECOND)) {
inNanos = context.temporal().getLong(ChronoField.NANO_OF_SECOND);
}
if (inSecs == null) {
return false;
}
var inSec = inSecs;
var inNano = ChronoField.NANO_OF_SECOND.checkValidIntValue(inNanos);
if (inSec >= -SECONDS_0000_TO_1970) {
var zeroSecs = inSec - SECONDS_PER_10000_YEARS + SECONDS_0000_TO_1970;
var hi = MathUtil.floorDiv(zeroSecs, SECONDS_PER_10000_YEARS) + 1;
var lo = MathUtil.floorMod(zeroSecs, SECONDS_PER_10000_YEARS);
var ldt = LocalDateTime.ofEpochSecond(lo - SECONDS_0000_TO_1970, 0, ZoneOffset.UTC);
if (hi > 0) {
buf.append("+").append(hi);
}
buf.append(ldt);
if (ldt.second() === 0) {
buf.append(":00");
}
} else {
var _zeroSecs = inSec + SECONDS_0000_TO_1970;
var _hi = MathUtil.intDiv(_zeroSecs, SECONDS_PER_10000_YEARS);
var _lo = MathUtil.intMod(_zeroSecs, SECONDS_PER_10000_YEARS);
var _ldt = LocalDateTime.ofEpochSecond(_lo - SECONDS_0000_TO_1970, 0, ZoneOffset.UTC);
var pos = buf.length();
buf.append(_ldt);
if (_ldt.second() === 0) {
buf.append(":00");
}
if (_hi < 0) {
if (_ldt.year() === -1e4) {
buf.replace(pos, pos + 2, "".concat(_hi - 1));
} else if (_lo === 0) {
buf.insert(pos, _hi);
} else {
buf.insert(pos + 1, Math.abs(_hi));
}
}
}
if (this.fractionalDigits === -2) {
if (inNano !== 0) {
buf.append(".");
if (MathUtil.intMod(inNano, 1e6) === 0) {
buf.append("".concat(MathUtil.intDiv(inNano, 1e6) + 1e3).substring(1));
} else if (MathUtil.intMod(inNano, 1e3) === 0) {
buf.append("".concat(MathUtil.intDiv(inNano, 1e3) + 1e6).substring(1));
} else {
buf.append("".concat(inNano + 1e9).substring(1));
}
}
} else if (this.fractionalDigits > 0 || this.fractionalDigits === -1 && inNano > 0) {
buf.append(".");
var div = 1e8;
for (var i = 0; this.fractionalDigits === -1 && inNano > 0 || i < this.fractionalDigits; i++) {
var digit = MathUtil.intDiv(inNano, div);
buf.append(digit);
inNano = inNano - digit * div;
div = MathUtil.intDiv(div, 10);
}
}
buf.append("Z");
return true;
}
}, {
key: "parse",
value: function parse2(context, text, position) {
var newContext = context.copy();
var minDigits = this.fractionalDigits < 0 ? 0 : this.fractionalDigits;
var maxDigits = this.fractionalDigits < 0 ? 9 : this.fractionalDigits;
var parser2 = new DateTimeFormatterBuilder().append(DateTimeFormatter.ISO_LOCAL_DATE).appendLiteral("T").appendValue(ChronoField.HOUR_OF_DAY, 2).appendLiteral(":").appendValue(ChronoField.MINUTE_OF_HOUR, 2).appendLiteral(":").appendValue(ChronoField.SECOND_OF_MINUTE, 2).appendFraction(ChronoField.NANO_OF_SECOND, minDigits, maxDigits, true).appendLiteral("Z").toFormatter()._toPrinterParser(false);
var pos = parser2.parse(newContext, text, position);
if (pos < 0) {
return pos;
}
var yearParsed = newContext.getParsed(ChronoField.YEAR);
var month = newContext.getParsed(ChronoField.MONTH_OF_YEAR);
var day = newContext.getParsed(ChronoField.DAY_OF_MONTH);
var hour = newContext.getParsed(ChronoField.HOUR_OF_DAY);
var min = newContext.getParsed(ChronoField.MINUTE_OF_HOUR);
var secVal = newContext.getParsed(ChronoField.SECOND_OF_MINUTE);
var nanoVal = newContext.getParsed(ChronoField.NANO_OF_SECOND);
var sec = secVal != null ? secVal : 0;
var nano = nanoVal != null ? nanoVal : 0;
var year = MathUtil.intMod(yearParsed, 1e4);
var days = 0;
if (hour === 24 && min === 0 && sec === 0 && nano === 0) {
hour = 0;
days = 1;
} else if (hour === 23 && min === 59 && sec === 60) {
context.setParsedLeapSecond();
sec = 59;
}
var instantSecs;
try {
var ldt = LocalDateTime.of(year, month, day, hour, min, sec, 0).plusDays(days);
instantSecs = ldt.toEpochSecond(ZoneOffset.UTC);
instantSecs += MathUtil.safeMultiply(MathUtil.intDiv(yearParsed, 1e4), SECONDS_PER_10000_YEARS);
} catch (ex) {
return ~position;
}
var successPos = pos;
successPos = context.setParsedField(ChronoField.INSTANT_SECONDS, instantSecs, position, successPos);
return context.setParsedField(ChronoField.NANO_OF_SECOND, nano, position, successPos);
}
}, {
key: "toString",
value: function toString() {
return "Instant()";
}
}]);
return InstantPrinterParser2;
}();
function _init$9() {
ReducedPrinterParser.BASE_DATE = LocalDate.of(2e3, 1, 1);
DateTimeFormatterBuilder.CompositePrinterParser = CompositePrinterParser;
DateTimeFormatterBuilder.PadPrinterParserDecorator = PadPrinterParserDecorator;
DateTimeFormatterBuilder.SettingsParser = SettingsParser;
DateTimeFormatterBuilder.CharLiteralPrinterParser = StringLiteralPrinterParser;
DateTimeFormatterBuilder.StringLiteralPrinterParser = StringLiteralPrinterParser;
DateTimeFormatterBuilder.CharLiteralPrinterParser = CharLiteralPrinterParser;
DateTimeFormatterBuilder.NumberPrinterParser = NumberPrinterParser;
DateTimeFormatterBuilder.ReducedPrinterParser = ReducedPrinterParser;
DateTimeFormatterBuilder.FractionPrinterParser = FractionPrinterParser;
DateTimeFormatterBuilder.OffsetIdPrinterParser = OffsetIdPrinterParser;
DateTimeFormatterBuilder.ZoneIdPrinterParser = ZoneIdPrinterParser;
}
var StringBuilder = function() {
function StringBuilder2() {
_classCallCheck(this, StringBuilder2);
this._str = "";
}
_createClass(StringBuilder2, [{
key: "append",
value: function append(str) {
this._str += str;
return this;
}
}, {
key: "appendChar",
value: function appendChar(str) {
this._str += str[0];
return this;
}
}, {
key: "insert",
value: function insert(offset, str) {
this._str = this._str.slice(0, offset) + str + this._str.slice(offset);
return this;
}
}, {
key: "replace",
value: function replace(start, end, str) {
this._str = this._str.slice(0, start) + str + this._str.slice(end);
return this;
}
}, {
key: "length",
value: function length() {
return this._str.length;
}
}, {
key: "setLength",
value: function setLength(length) {
this._str = this._str.slice(0, length);
return this;
}
}, {
key: "toString",
value: function toString() {
return this._str;
}
}]);
return StringBuilder2;
}();
var DateTimeFormatter = function() {
function DateTimeFormatter2(printerParser, locale, decimalStyle, resolverStyle, resolverFields) {
var chrono = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : IsoChronology.INSTANCE;
var zone = arguments.length > 6 ? arguments[6] : void 0;
_classCallCheck(this, DateTimeFormatter2);
assert(printerParser != null);
assert(decimalStyle != null);
assert(resolverStyle != null);
this._printerParser = printerParser;
this._locale = locale;
this._decimalStyle = decimalStyle;
this._resolverStyle = resolverStyle;
this._resolverFields = resolverFields;
this._chrono = chrono;
this._zone = zone;
}
_createClass(DateTimeFormatter2, [{
key: "locale",
value: function locale() {
return this._locale;
}
}, {
key: "decimalStyle",
value: function decimalStyle() {
return this._decimalStyle;
}
}, {
key: "chronology",
value: function chronology() {
return this._chrono;
}
}, {
key: "withChronology",
value: function withChronology(chrono) {
if (this._chrono != null && this._chrono.equals(chrono)) {
return this;
}
return new DateTimeFormatter2(this._printerParser, this._locale, this._decimalStyle, this._resolverStyle, this._resolverFields, chrono, this._zone);
}
}, {
key: "withLocale",
value: function withLocale() {
return this;
}
}, {
key: "withResolverStyle",
value: function withResolverStyle(resolverStyle) {
requireNonNull(resolverStyle, "resolverStyle");
if (resolverStyle.equals(this._resolverStyle)) {
return this;
}
return new DateTimeFormatter2(this._printerParser, this._locale, this._decimalStyle, resolverStyle, this._resolverFields, this._chrono, this._zone);
}
}, {
key: "format",
value: function format(temporal) {
var buf = new StringBuilder(32);
this._formatTo(temporal, buf);
return buf.toString();
}
}, {
key: "_formatTo",
value: function _formatTo(temporal, appendable) {
requireNonNull(temporal, "temporal");
requireNonNull(appendable, "appendable");
var context = new DateTimePrintContext(temporal, this);
this._printerParser.print(context, appendable);
}
}, {
key: "parse",
value: function parse2(text, type) {
if (arguments.length === 1) {
return this.parse1(text);
} else {
return this.parse2(text, type);
}
}
}, {
key: "parse1",
value: function parse1(text) {
requireNonNull(text, "text");
try {
return this._parseToBuilder(text, null).resolve(this._resolverStyle, this._resolverFields);
} catch (ex) {
if (ex instanceof DateTimeParseException) {
throw ex;
} else {
throw this._createError(text, ex);
}
}
}
}, {
key: "parse2",
value: function parse2(text, type) {
requireNonNull(text, "text");
requireNonNull(type, "type");
try {
var builder = this._parseToBuilder(text, null).resolve(this._resolverStyle, this._resolverFields);
return builder.build(type);
} catch (ex) {
if (ex instanceof DateTimeParseException) {
throw ex;
} else {
throw this._createError(text, ex);
}
}
}
}, {
key: "_createError",
value: function _createError(text, ex) {
var abbr = "";
if (text.length > 64) {
abbr = "".concat(text.substring(0, 64), "...");
} else {
abbr = text;
}
return new DateTimeParseException("Text '".concat(abbr, "' could not be parsed: ").concat(ex.message), text, 0, ex);
}
}, {
key: "_parseToBuilder",
value: function _parseToBuilder(text, position) {
var pos = position != null ? position : new ParsePosition(0);
var result = this._parseUnresolved0(text, pos);
if (result == null || pos.getErrorIndex() >= 0 || position == null && pos.getIndex() < text.length) {
var abbr = "";
if (text.length > 64) {
abbr = "".concat(text.substr(0, 64).toString(), "...");
} else {
abbr = text;
}
if (pos.getErrorIndex() >= 0) {
throw new DateTimeParseException("Text '".concat(abbr, "' could not be parsed at index ").concat(pos.getErrorIndex()), text, pos.getErrorIndex());
} else {
throw new DateTimeParseException("Text '".concat(abbr, "' could not be parsed, unparsed text found at index ").concat(pos.getIndex()), text, pos.getIndex());
}
}
return result.toBuilder();
}
}, {
key: "parseUnresolved",
value: function parseUnresolved(text, position) {
return this._parseUnresolved0(text, position);
}
}, {
key: "_parseUnresolved0",
value: function _parseUnresolved0(text, position) {
assert(text != null, "text", NullPointerException);
assert(position != null, "position", NullPointerException);
var context = new DateTimeParseContext(this);
var pos = position.getIndex();
pos = this._printerParser.parse(context, text, pos);
if (pos < 0) {
position.setErrorIndex(~pos);
return null;
}
position.setIndex(pos);
return context.toParsed();
}
}, {
key: "_toPrinterParser",
value: function _toPrinterParser(optional) {
return this._printerParser.withOptional(optional);
}
}, {
key: "toString",
value: function toString() {
var pattern = this._printerParser.toString();
return pattern.indexOf("[") === 0 ? pattern : pattern.substring(1, pattern.length - 1);
}
}], [{
key: "parsedExcessDays",
value: function parsedExcessDays() {
return DateTimeFormatter2.PARSED_EXCESS_DAYS;
}
}, {
key: "parsedLeapSecond",
value: function parsedLeapSecond() {
return DateTimeFormatter2.PARSED_LEAP_SECOND;
}
}, {
key: "ofPattern",
value: function ofPattern(pattern) {
return new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter();
}
}]);
return DateTimeFormatter2;
}();
function _init$a() {
DateTimeFormatter.ISO_LOCAL_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral("-").appendValue(ChronoField.MONTH_OF_YEAR, 2).appendLiteral("-").appendValue(ChronoField.DAY_OF_MONTH, 2).toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_LOCAL_TIME = new DateTimeFormatterBuilder().appendValue(ChronoField.HOUR_OF_DAY, 2).appendLiteral(":").appendValue(ChronoField.MINUTE_OF_HOUR, 2).optionalStart().appendLiteral(":").appendValue(ChronoField.SECOND_OF_MINUTE, 2).optionalStart().appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true).toFormatter(ResolverStyle.STRICT);
DateTimeFormatter.ISO_LOCAL_DATE_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).appendLiteral("T").append(DateTimeFormatter.ISO_LOCAL_TIME).toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_INSTANT = new DateTimeFormatterBuilder().parseCaseInsensitive().appendInstant().toFormatter(ResolverStyle.STRICT);
DateTimeFormatter.ISO_OFFSET_DATE_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_ZONED_DATE_TIME = new DateTimeFormatterBuilder().append(DateTimeFormatter.ISO_OFFSET_DATE_TIME).optionalStart().appendLiteral("[").parseCaseSensitive().appendZoneId().appendLiteral("]").toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.BASIC_ISO_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendValue(ChronoField.MONTH_OF_YEAR, 2).appendValue(ChronoField.DAY_OF_MONTH, 2).toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_OFFSET_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_OFFSET_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_TIME).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_ORDINAL_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral("-").appendValue(ChronoField.DAY_OF_YEAR).toFormatter(ResolverStyle.STRICT);
DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral("-W").appendValue(ChronoField.ALIGNED_WEEK_OF_YEAR).appendLiteral("-").appendValue(ChronoField.DAY_OF_WEEK).toFormatter(ResolverStyle.STRICT);
DateTimeFormatter.ISO_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.ISO_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_TIME).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT);
DateTimeFormatter.ISO_DATE_TIME = new DateTimeFormatterBuilder().append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
DateTimeFormatter.PARSED_EXCESS_DAYS = createTemporalQuery("PARSED_EXCESS_DAYS", function(temporal) {
if (temporal instanceof DateTimeBuilder) {
return temporal.excessDays;
} else {
return Period.ZERO;
}
});
DateTimeFormatter.PARSED_LEAP_SECOND = createTemporalQuery("PARSED_LEAP_SECOND", function(temporal) {
if (temporal instanceof DateTimeBuilder) {
return temporal.leapSecond;
} else {
return false;
}
});
}
var MonthDay = function(_TemporalAccessor) {
_inherits(MonthDay2, _TemporalAccessor);
var _super = _createSuper(MonthDay2);
function MonthDay2(month, dayOfMonth) {
var _this;
_classCallCheck(this, MonthDay2);
_this = _super.call(this);
_this._month = MathUtil.safeToInt(month);
_this._day = MathUtil.safeToInt(dayOfMonth);
return _this;
}
_createClass(MonthDay2, [{
key: "monthValue",
value: function monthValue() {
return this._month;
}
}, {
key: "month",
value: function month() {
return Month.of(this._month);
}
}, {
key: "dayOfMonth",
value: function dayOfMonth() {
return this._day;
}
}, {
key: "isSupported",
value: function isSupported(field) {
if (field instanceof ChronoField) {
return field === ChronoField.MONTH_OF_YEAR || field === ChronoField.DAY_OF_MONTH;
}
return field != null && field.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (field === ChronoField.MONTH_OF_YEAR) {
return field.range();
} else if (field === ChronoField.DAY_OF_MONTH) {
return ValueRange.of(1, this.month().minLength(), this.month().maxLength());
}
return _get(_getPrototypeOf(MonthDay2.prototype), "range", this).call(this, field);
}
}, {
key: "get",
value: function get(field) {
return this.range(field).checkValidIntValue(this.getLong(field), field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.DAY_OF_MONTH:
return this._day;
case ChronoField.MONTH_OF_YEAR:
return this._month;
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "isValidYear",
value: function isValidYear(year) {
return (this._day === 29 && this._month === 2 && Year2.isLeap(year) === false) === false;
}
}, {
key: "withMonth",
value: function withMonth(month) {
return this.with(Month.of(month));
}
}, {
key: "with",
value: function _with(month) {
requireNonNull(month, "month");
if (month.value() === this._month) {
return this;
}
var day = Math.min(this._day, month.maxLength());
return new MonthDay2(month.value(), day);
}
}, {
key: "withDayOfMonth",
value: function withDayOfMonth(dayOfMonth) {
if (dayOfMonth === this._day) {
return this;
}
return MonthDay2.of(this._month, dayOfMonth);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
requireInstance(_query, TemporalQuery, "query");
if (_query === TemporalQueries.chronology()) {
return IsoChronology.INSTANCE;
}
return _get(_getPrototypeOf(MonthDay2.prototype), "query", this).call(this, _query);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
requireNonNull(temporal, "temporal");
temporal = temporal.with(ChronoField.MONTH_OF_YEAR, this._month);
return temporal.with(ChronoField.DAY_OF_MONTH, Math.min(temporal.range(ChronoField.DAY_OF_MONTH).maximum(), this._day));
}
}, {
key: "atYear",
value: function atYear(year) {
return LocalDate.of(year, this._month, this.isValidYear(year) ? this._day : 28);
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, MonthDay2, "other");
var cmp = this._month - other.monthValue();
if (cmp === 0) {
cmp = this._day - other.dayOfMonth();
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
requireNonNull(other, "other");
requireInstance(other, MonthDay2, "other");
return this.compareTo(other) > 0;
}
}, {
key: "isBefore",
value: function isBefore(other) {
requireNonNull(other, "other");
requireInstance(other, MonthDay2, "other");
return this.compareTo(other) < 0;
}
}, {
key: "equals",
value: function equals(obj) {
if (this === obj) {
return true;
}
if (obj instanceof MonthDay2) {
var other = obj;
return this.monthValue() === other.monthValue() && this.dayOfMonth() === other.dayOfMonth();
}
return false;
}
}, {
key: "toString",
value: function toString() {
return "--".concat(this._month < 10 ? "0" : "").concat(this._month).concat(this._day < 10 ? "-0" : "-").concat(this._day);
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
requireInstance(formatter, DateTimeFormatter, "formatter");
return formatter.format(this);
}
}], [{
key: "now",
value: function now(zoneIdOrClock) {
if (arguments.length === 0) {
return MonthDay2.now0();
} else if (arguments.length === 1 && zoneIdOrClock instanceof ZoneId) {
return MonthDay2.nowZoneId(zoneIdOrClock);
} else {
return MonthDay2.nowClock(zoneIdOrClock);
}
}
}, {
key: "now0",
value: function now0() {
return this.nowClock(Clock.systemDefaultZone());
}
}, {
key: "nowZoneId",
value: function nowZoneId(zone) {
requireNonNull(zone, "zone");
return this.nowClock(Clock.system(zone));
}
}, {
key: "nowClock",
value: function nowClock(clock) {
requireNonNull(clock, "clock");
var now = LocalDate.now(clock);
return MonthDay2.of(now.month(), now.dayOfMonth());
}
}, {
key: "of",
value: function of(monthOrNumber, number) {
if (arguments.length === 2 && monthOrNumber instanceof Month) {
return MonthDay2.ofMonthNumber(monthOrNumber, number);
} else {
return MonthDay2.ofNumberNumber(monthOrNumber, number);
}
}
}, {
key: "ofMonthNumber",
value: function ofMonthNumber(month, dayOfMonth) {
requireNonNull(month, "month");
ChronoField.DAY_OF_MONTH.checkValidValue(dayOfMonth);
if (dayOfMonth > month.maxLength()) {
throw new DateTimeException("Illegal value for DayOfMonth field, value ".concat(dayOfMonth, " is not valid for month ").concat(month.toString()));
}
return new MonthDay2(month.value(), dayOfMonth);
}
}, {
key: "ofNumberNumber",
value: function ofNumberNumber(month, dayOfMonth) {
requireNonNull(month, "month");
requireNonNull(dayOfMonth, "dayOfMonth");
return MonthDay2.of(Month.of(month), dayOfMonth);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
requireInstance(temporal, TemporalAccessor, "temporal");
if (temporal instanceof MonthDay2) {
return temporal;
}
try {
return MonthDay2.of(temporal.get(ChronoField.MONTH_OF_YEAR), temporal.get(ChronoField.DAY_OF_MONTH));
} catch (ex) {
throw new DateTimeException("Unable to obtain MonthDay from TemporalAccessor: ".concat(temporal, ", type ").concat(temporal && temporal.constructor != null ? temporal.constructor.name : ""));
}
}
}, {
key: "parse",
value: function parse2(text, formatter) {
if (arguments.length === 1) {
return MonthDay2.parseString(text);
} else {
return MonthDay2.parseStringFormatter(text, formatter);
}
}
}, {
key: "parseString",
value: function parseString(text) {
return MonthDay2.parseStringFormatter(text, PARSER);
}
}, {
key: "parseStringFormatter",
value: function parseStringFormatter(text, formatter) {
requireNonNull(text, "text");
requireNonNull(formatter, "formatter");
requireInstance(formatter, DateTimeFormatter, "formatter");
return formatter.parse(text, MonthDay2.FROM);
}
}]);
return MonthDay2;
}(TemporalAccessor);
var PARSER;
function _init$b() {
PARSER = new DateTimeFormatterBuilder().appendLiteral("--").appendValue(ChronoField.MONTH_OF_YEAR, 2).appendLiteral("-").appendValue(ChronoField.DAY_OF_MONTH, 2).toFormatter();
MonthDay.FROM = createTemporalQuery("MonthDay.FROM", function(temporal) {
return MonthDay.from(temporal);
});
}
var YearMonth = function(_Temporal) {
_inherits(YearMonth2, _Temporal);
var _super = _createSuper(YearMonth2);
function YearMonth2(year, month) {
var _this;
_classCallCheck(this, YearMonth2);
_this = _super.call(this);
_this._year = MathUtil.safeToInt(year);
_this._month = MathUtil.safeToInt(month);
return _this;
}
_createClass(YearMonth2, [{
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (arguments.length === 1 && fieldOrUnit instanceof TemporalField) {
return this.isSupportedField(fieldOrUnit);
} else {
return this.isSupportedUnit(fieldOrUnit);
}
}
}, {
key: "isSupportedField",
value: function isSupportedField(field) {
if (field instanceof ChronoField) {
return field === ChronoField.YEAR || field === ChronoField.MONTH_OF_YEAR || field === ChronoField.PROLEPTIC_MONTH || field === ChronoField.YEAR_OF_ERA || field === ChronoField.ERA;
}
return field != null && field.isSupportedBy(this);
}
}, {
key: "isSupportedUnit",
value: function isSupportedUnit(unit) {
if (unit instanceof ChronoUnit) {
return unit === ChronoUnit.MONTHS || unit === ChronoUnit.YEARS || unit === ChronoUnit.DECADES || unit === ChronoUnit.CENTURIES || unit === ChronoUnit.MILLENNIA || unit === ChronoUnit.ERAS;
}
return unit != null && unit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (field === ChronoField.YEAR_OF_ERA) {
return this.year() <= 0 ? ValueRange.of(1, Year2.MAX_VALUE + 1) : ValueRange.of(1, Year2.MAX_VALUE);
}
return _get(_getPrototypeOf(YearMonth2.prototype), "range", this).call(this, field);
}
}, {
key: "get",
value: function get(field) {
requireNonNull(field, "field");
requireInstance(field, TemporalField, "field");
return this.range(field).checkValidIntValue(this.getLong(field), field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
requireInstance(field, TemporalField, "field");
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.MONTH_OF_YEAR:
return this._month;
case ChronoField.PROLEPTIC_MONTH:
return this._getProlepticMonth();
case ChronoField.YEAR_OF_ERA:
return this._year < 1 ? 1 - this._year : this._year;
case ChronoField.YEAR:
return this._year;
case ChronoField.ERA:
return this._year < 1 ? 0 : 1;
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "_getProlepticMonth",
value: function _getProlepticMonth() {
return MathUtil.safeAdd(MathUtil.safeMultiply(this._year, 12), this._month - 1);
}
}, {
key: "year",
value: function year() {
return this._year;
}
}, {
key: "monthValue",
value: function monthValue() {
return this._month;
}
}, {
key: "month",
value: function month() {
return Month.of(this._month);
}
}, {
key: "isLeapYear",
value: function isLeapYear() {
return IsoChronology.isLeapYear(this._year);
}
}, {
key: "isValidDay",
value: function isValidDay(dayOfMonth) {
return dayOfMonth >= 1 && dayOfMonth <= this.lengthOfMonth();
}
}, {
key: "lengthOfMonth",
value: function lengthOfMonth() {
return this.month().length(this.isLeapYear());
}
}, {
key: "lengthOfYear",
value: function lengthOfYear() {
return this.isLeapYear() ? 366 : 365;
}
}, {
key: "with",
value: function _with(adjusterOrField, value) {
if (arguments.length === 1) {
return this._withAdjuster(adjusterOrField);
} else {
return this._withField(adjusterOrField, value);
}
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field, "field");
requireInstance(field, TemporalField, "field");
if (field instanceof ChronoField) {
var f = field;
f.checkValidValue(newValue);
switch (f) {
case ChronoField.MONTH_OF_YEAR:
return this.withMonth(newValue);
case ChronoField.PROLEPTIC_MONTH:
return this.plusMonths(newValue - this.getLong(ChronoField.PROLEPTIC_MONTH));
case ChronoField.YEAR_OF_ERA:
return this.withYear(this._year < 1 ? 1 - newValue : newValue);
case ChronoField.YEAR:
return this.withYear(newValue);
case ChronoField.ERA:
return this.getLong(ChronoField.ERA) === newValue ? this : this.withYear(1 - this._year);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.adjustInto(this, newValue);
}
}, {
key: "withYear",
value: function withYear(year) {
ChronoField.YEAR.checkValidValue(year);
return new YearMonth2(year, this._month);
}
}, {
key: "withMonth",
value: function withMonth(month) {
ChronoField.MONTH_OF_YEAR.checkValidValue(month);
return new YearMonth2(this._year, month);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
requireNonNull(unit, "unit");
requireInstance(unit, TemporalUnit, "unit");
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.MONTHS:
return this.plusMonths(amountToAdd);
case ChronoUnit.YEARS:
return this.plusYears(amountToAdd);
case ChronoUnit.DECADES:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 10));
case ChronoUnit.CENTURIES:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 100));
case ChronoUnit.MILLENNIA:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 1e3));
case ChronoUnit.ERAS:
return this.with(ChronoField.ERA, MathUtil.safeAdd(this.getLong(ChronoField.ERA), amountToAdd));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusYears",
value: function plusYears(yearsToAdd) {
if (yearsToAdd === 0) {
return this;
}
var newYear = ChronoField.YEAR.checkValidIntValue(this._year + yearsToAdd);
return this.withYear(newYear);
}
}, {
key: "plusMonths",
value: function plusMonths(monthsToAdd) {
if (monthsToAdd === 0) {
return this;
}
var monthCount = this._year * 12 + (this._month - 1);
var calcMonths = monthCount + monthsToAdd;
var newYear = ChronoField.YEAR.checkValidIntValue(MathUtil.floorDiv(calcMonths, 12));
var newMonth = MathUtil.floorMod(calcMonths, 12) + 1;
return new YearMonth2(newYear, newMonth);
}
}, {
key: "minusYears",
value: function minusYears(yearsToSubtract) {
return yearsToSubtract === MathUtil.MIN_SAFE_INTEGER ? this.plusYears(MathUtil.MIN_SAFE_INTEGER).plusYears(1) : this.plusYears(-yearsToSubtract);
}
}, {
key: "minusMonths",
value: function minusMonths(monthsToSubtract) {
return monthsToSubtract === MathUtil.MIN_SAFE_INTEGER ? this.plusMonths(Math.MAX_SAFE_INTEGER).plusMonths(1) : this.plusMonths(-monthsToSubtract);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
requireInstance(_query, TemporalQuery, "query");
if (_query === TemporalQueries.chronology()) {
return IsoChronology.INSTANCE;
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.MONTHS;
} else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.zone() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.offset()) {
return null;
}
return _get(_getPrototypeOf(YearMonth2.prototype), "query", this).call(this, _query);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
requireNonNull(temporal, "temporal");
requireInstance(temporal, Temporal, "temporal");
return temporal.with(ChronoField.PROLEPTIC_MONTH, this._getProlepticMonth());
}
}, {
key: "until",
value: function until(endExclusive, unit) {
requireNonNull(endExclusive, "endExclusive");
requireNonNull(unit, "unit");
requireInstance(endExclusive, Temporal, "endExclusive");
requireInstance(unit, TemporalUnit, "unit");
var end = YearMonth2.from(endExclusive);
if (unit instanceof ChronoUnit) {
var monthsUntil = end._getProlepticMonth() - this._getProlepticMonth();
switch (unit) {
case ChronoUnit.MONTHS:
return monthsUntil;
case ChronoUnit.YEARS:
return monthsUntil / 12;
case ChronoUnit.DECADES:
return monthsUntil / 120;
case ChronoUnit.CENTURIES:
return monthsUntil / 1200;
case ChronoUnit.MILLENNIA:
return monthsUntil / 12e3;
case ChronoUnit.ERAS:
return end.getLong(ChronoField.ERA) - this.getLong(ChronoField.ERA);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.between(this, end);
}
}, {
key: "atDay",
value: function atDay(dayOfMonth) {
return LocalDate.of(this._year, this._month, dayOfMonth);
}
}, {
key: "atEndOfMonth",
value: function atEndOfMonth() {
return LocalDate.of(this._year, this._month, this.lengthOfMonth());
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, YearMonth2, "other");
var cmp = this._year - other.year();
if (cmp === 0) {
cmp = this._month - other.monthValue();
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
return this.compareTo(other) > 0;
}
}, {
key: "isBefore",
value: function isBefore(other) {
return this.compareTo(other) < 0;
}
}, {
key: "equals",
value: function equals(obj) {
if (this === obj) {
return true;
}
if (obj instanceof YearMonth2) {
var other = obj;
return this.year() === other.year() && this.monthValue() === other.monthValue();
}
return false;
}
}, {
key: "toString",
value: function toString() {
return PARSER$1.format(this);
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
return formatter.format(this);
}
}], [{
key: "now",
value: function now(zoneIdOrClock) {
if (arguments.length === 0) {
return YearMonth2.now0();
} else if (arguments.length === 1 && zoneIdOrClock instanceof ZoneId) {
return YearMonth2.nowZoneId(zoneIdOrClock);
} else {
return YearMonth2.nowClock(zoneIdOrClock);
}
}
}, {
key: "now0",
value: function now0() {
return YearMonth2.nowClock(Clock.systemDefaultZone());
}
}, {
key: "nowZoneId",
value: function nowZoneId(zone) {
return YearMonth2.nowClock(Clock.system(zone));
}
}, {
key: "nowClock",
value: function nowClock(clock) {
var now = LocalDate.now(clock);
return YearMonth2.of(now.year(), now.month());
}
}, {
key: "of",
value: function of(year, monthOrNumber) {
if (arguments.length === 2 && monthOrNumber instanceof Month) {
return YearMonth2.ofNumberMonth(year, monthOrNumber);
} else {
return YearMonth2.ofNumberNumber(year, monthOrNumber);
}
}
}, {
key: "ofNumberMonth",
value: function ofNumberMonth(year, month) {
requireNonNull(month, "month");
requireInstance(month, Month, "month");
return YearMonth2.ofNumberNumber(year, month.value());
}
}, {
key: "ofNumberNumber",
value: function ofNumberNumber(year, month) {
requireNonNull(year, "year");
requireNonNull(month, "month");
ChronoField.YEAR.checkValidValue(year);
ChronoField.MONTH_OF_YEAR.checkValidValue(month);
return new YearMonth2(year, month);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
if (temporal instanceof YearMonth2) {
return temporal;
}
try {
return YearMonth2.of(temporal.get(ChronoField.YEAR), temporal.get(ChronoField.MONTH_OF_YEAR));
} catch (ex) {
throw new DateTimeException("Unable to obtain YearMonth from TemporalAccessor: ".concat(temporal, ", type ").concat(temporal && temporal.constructor != null ? temporal.constructor.name : ""));
}
}
}, {
key: "parse",
value: function parse2(text, formatter) {
if (arguments.length === 1) {
return YearMonth2.parseString(text);
} else {
return YearMonth2.parseStringFormatter(text, formatter);
}
}
}, {
key: "parseString",
value: function parseString(text) {
return YearMonth2.parseStringFormatter(text, PARSER$1);
}
}, {
key: "parseStringFormatter",
value: function parseStringFormatter(text, formatter) {
requireNonNull(formatter, "formatter");
return formatter.parse(text, YearMonth2.FROM);
}
}]);
return YearMonth2;
}(Temporal);
var PARSER$1;
function _init$c() {
PARSER$1 = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral("-").appendValue(ChronoField.MONTH_OF_YEAR, 2).toFormatter();
YearMonth.FROM = createTemporalQuery("YearMonth.FROM", function(temporal) {
return YearMonth.from(temporal);
});
}
var Year2 = function(_Temporal) {
_inherits(Year3, _Temporal);
var _super = _createSuper(Year3);
function Year3(value) {
var _this;
_classCallCheck(this, Year3);
_this = _super.call(this);
_this._year = MathUtil.safeToInt(value);
return _this;
}
_createClass(Year3, [{
key: "value",
value: function value() {
return this._year;
}
}, {
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (arguments.length === 1 && fieldOrUnit instanceof TemporalField) {
return this.isSupportedField(fieldOrUnit);
} else {
return this.isSupportedUnit(fieldOrUnit);
}
}
}, {
key: "isSupportedField",
value: function isSupportedField(field) {
if (field instanceof ChronoField) {
return field === ChronoField.YEAR || field === ChronoField.YEAR_OF_ERA || field === ChronoField.ERA;
}
return field != null && field.isSupportedBy(this);
}
}, {
key: "isSupportedUnit",
value: function isSupportedUnit(unit) {
if (unit instanceof ChronoUnit) {
return unit === ChronoUnit.YEARS || unit === ChronoUnit.DECADES || unit === ChronoUnit.CENTURIES || unit === ChronoUnit.MILLENNIA || unit === ChronoUnit.ERAS;
}
return unit != null && unit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (this.isSupported(field)) {
return field.range();
} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return _get(_getPrototypeOf(Year3.prototype), "range", this).call(this, field);
}
}, {
key: "get",
value: function get(field) {
return this.range(field).checkValidIntValue(this.getLong(field), field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.YEAR_OF_ERA:
return this._year < 1 ? 1 - this._year : this._year;
case ChronoField.YEAR:
return this._year;
case ChronoField.ERA:
return this._year < 1 ? 0 : 1;
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "isLeap",
value: function isLeap() {
return Year3.isLeap(this._year);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field, "field");
requireInstance(field, TemporalField, "field");
if (field instanceof ChronoField) {
field.checkValidValue(newValue);
switch (field) {
case ChronoField.YEAR_OF_ERA:
return Year3.of(this._year < 1 ? 1 - newValue : newValue);
case ChronoField.YEAR:
return Year3.of(newValue);
case ChronoField.ERA:
return this.getLong(ChronoField.ERA) === newValue ? this : Year3.of(1 - this._year);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.adjustInto(this, newValue);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
requireNonNull(amountToAdd, "amountToAdd");
requireNonNull(unit, "unit");
requireInstance(unit, TemporalUnit, "unit");
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.YEARS:
return this.plusYears(amountToAdd);
case ChronoUnit.DECADES:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 10));
case ChronoUnit.CENTURIES:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 100));
case ChronoUnit.MILLENNIA:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 1e3));
case ChronoUnit.ERAS:
return this.with(ChronoField.ERA, MathUtil.safeAdd(this.getLong(ChronoField.ERA), amountToAdd));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusYears",
value: function plusYears(yearsToAdd) {
if (yearsToAdd === 0) {
return this;
}
return Year3.of(ChronoField.YEAR.checkValidIntValue(MathUtil.safeAdd(this._year, yearsToAdd)));
}
}, {
key: "minusYears",
value: function minusYears(yearsToSubtract) {
return yearsToSubtract === MathUtil.MIN_SAFE_INTEGER ? this.plusYears(MathUtil.MAX_SAFE_INTEGER).plusYears(1) : this.plusYears(-yearsToSubtract);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
requireNonNull(temporal, "temporal");
return temporal.with(ChronoField.YEAR, this._year);
}
}, {
key: "isValidMonthDay",
value: function isValidMonthDay(monthDay) {
return monthDay != null && monthDay.isValidYear(this._year);
}
}, {
key: "length",
value: function length() {
return this.isLeap() ? 366 : 365;
}
}, {
key: "atDay",
value: function atDay(dayOfYear) {
return LocalDate.ofYearDay(this._year, dayOfYear);
}
}, {
key: "atMonth",
value: function atMonth(monthOrNumber) {
if (arguments.length === 1 && monthOrNumber instanceof Month) {
return this.atMonthMonth(monthOrNumber);
} else {
return this.atMonthNumber(monthOrNumber);
}
}
}, {
key: "atMonthMonth",
value: function atMonthMonth(month) {
requireNonNull(month, "month");
requireInstance(month, Month, "month");
return YearMonth.of(this._year, month);
}
}, {
key: "atMonthNumber",
value: function atMonthNumber(month) {
requireNonNull(month, "month");
return YearMonth.of(this._year, month);
}
}, {
key: "atMonthDay",
value: function atMonthDay(monthDay) {
requireNonNull(monthDay, "monthDay");
requireInstance(monthDay, MonthDay, "monthDay");
return monthDay.atYear(this._year);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query()");
requireInstance(_query, TemporalQuery, "query()");
if (_query === TemporalQueries.chronology()) {
return IsoChronology.INSTANCE;
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.YEARS;
} else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.zone() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.offset()) {
return null;
}
return _get(_getPrototypeOf(Year3.prototype), "query", this).call(this, _query);
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, Year3, "other");
return this._year - other._year;
}
}, {
key: "isAfter",
value: function isAfter(other) {
requireNonNull(other, "other");
requireInstance(other, Year3, "other");
return this._year > other._year;
}
}, {
key: "isBefore",
value: function isBefore(other) {
requireNonNull(other, "other");
requireInstance(other, Year3, "other");
return this._year < other._year;
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
requireInstance(formatter, DateTimeFormatter, "formatter");
return formatter.format(this);
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof Year3) {
return this.value() === other.value();
}
return false;
}
}, {
key: "toString",
value: function toString() {
return "".concat(this._year);
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "until",
value: function until(endExclusive, unit) {
var end = Year3.from(endExclusive);
if (unit instanceof ChronoUnit) {
var yearsUntil = end.value() - this.value();
switch (unit) {
case ChronoUnit.YEARS:
return yearsUntil;
case ChronoUnit.DECADES:
return MathUtil.intDiv(yearsUntil, 10);
case ChronoUnit.CENTURIES:
return MathUtil.intDiv(yearsUntil, 100);
case ChronoUnit.MILLENNIA:
return MathUtil.intDiv(yearsUntil, 1e3);
case ChronoUnit.ERAS:
return end.getLong(ChronoField.ERA) - this.getLong(ChronoField.ERA);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.between(this, end);
}
}], [{
key: "now",
value: function now() {
var zoneIdOrClock = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
if (zoneIdOrClock === void 0) {
return Year3.now0();
} else if (zoneIdOrClock instanceof ZoneId) {
return Year3.nowZoneId(zoneIdOrClock);
} else {
return Year3.nowClock(zoneIdOrClock);
}
}
}, {
key: "now0",
value: function now0() {
return Year3.nowClock(Clock.systemDefaultZone());
}
}, {
key: "nowZoneId",
value: function nowZoneId(zone) {
requireNonNull(zone, "zone");
requireInstance(zone, ZoneId, "zone");
return Year3.nowClock(Clock.system(zone));
}
}, {
key: "nowClock",
value: function nowClock(clock) {
requireNonNull(clock, "clock");
requireInstance(clock, Clock, "clock");
var now = LocalDate.now(clock);
return Year3.of(now.year());
}
}, {
key: "of",
value: function of(isoYear) {
requireNonNull(isoYear, "isoYear");
ChronoField.YEAR.checkValidValue(isoYear);
return new Year3(isoYear);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
requireInstance(temporal, TemporalAccessor, "temporal");
if (temporal instanceof Year3) {
return temporal;
}
try {
return Year3.of(temporal.get(ChronoField.YEAR));
} catch (ex) {
throw new DateTimeException("Unable to obtain Year from TemporalAccessor: ".concat(temporal, ", type ").concat(temporal && temporal.constructor != null ? temporal.constructor.name : ""));
}
}
}, {
key: "parse",
value: function parse2(text, formatter) {
if (arguments.length <= 1) {
return Year3.parseText(text);
} else {
return Year3.parseTextFormatter(text, formatter);
}
}
}, {
key: "parseText",
value: function parseText(text) {
requireNonNull(text, "text");
return Year3.parse(text, PARSER$2);
}
}, {
key: "parseTextFormatter",
value: function parseTextFormatter(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : PARSER$2;
requireNonNull(text, "text");
requireNonNull(formatter, "formatter");
requireInstance(formatter, DateTimeFormatter, "formatter");
return formatter.parse(text, Year3.FROM);
}
}, {
key: "isLeap",
value: function isLeap(year) {
return MathUtil.intMod(year, 4) === 0 && (MathUtil.intMod(year, 100) !== 0 || MathUtil.intMod(year, 400) === 0);
}
}]);
return Year3;
}(Temporal);
var PARSER$2;
function _init$d() {
Year2.MIN_VALUE = YearConstants.MIN_VALUE;
Year2.MAX_VALUE = YearConstants.MAX_VALUE;
PARSER$2 = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).toFormatter();
Year2.FROM = createTemporalQuery("Year.FROM", function(temporal) {
return Year2.from(temporal);
});
}
var TemporalAdjuster = function() {
function TemporalAdjuster2() {
_classCallCheck(this, TemporalAdjuster2);
}
_createClass(TemporalAdjuster2, [{
key: "adjustInto",
value: function adjustInto(temporal) {
abstractMethodFail("adjustInto");
}
}]);
return TemporalAdjuster2;
}();
var TemporalAdjusters = function() {
function TemporalAdjusters2() {
_classCallCheck(this, TemporalAdjusters2);
}
_createClass(TemporalAdjusters2, null, [{
key: "firstDayOfMonth",
value: function firstDayOfMonth() {
return Impl.FIRST_DAY_OF_MONTH;
}
}, {
key: "lastDayOfMonth",
value: function lastDayOfMonth() {
return Impl.LAST_DAY_OF_MONTH;
}
}, {
key: "firstDayOfNextMonth",
value: function firstDayOfNextMonth() {
return Impl.FIRST_DAY_OF_NEXT_MONTH;
}
}, {
key: "firstDayOfYear",
value: function firstDayOfYear() {
return Impl.FIRST_DAY_OF_YEAR;
}
}, {
key: "lastDayOfYear",
value: function lastDayOfYear() {
return Impl.LAST_DAY_OF_YEAR;
}
}, {
key: "firstDayOfNextYear",
value: function firstDayOfNextYear() {
return Impl.FIRST_DAY_OF_NEXT_YEAR;
}
}, {
key: "firstInMonth",
value: function firstInMonth(dayOfWeek) {
requireNonNull(dayOfWeek, "dayOfWeek");
return new DayOfWeekInMonth(1, dayOfWeek);
}
}, {
key: "lastInMonth",
value: function lastInMonth(dayOfWeek) {
requireNonNull(dayOfWeek, "dayOfWeek");
return new DayOfWeekInMonth(-1, dayOfWeek);
}
}, {
key: "dayOfWeekInMonth",
value: function dayOfWeekInMonth(ordinal, dayOfWeek) {
requireNonNull(dayOfWeek, "dayOfWeek");
return new DayOfWeekInMonth(ordinal, dayOfWeek);
}
}, {
key: "next",
value: function next(dayOfWeek) {
return new RelativeDayOfWeek(2, dayOfWeek);
}
}, {
key: "nextOrSame",
value: function nextOrSame(dayOfWeek) {
return new RelativeDayOfWeek(0, dayOfWeek);
}
}, {
key: "previous",
value: function previous(dayOfWeek) {
return new RelativeDayOfWeek(3, dayOfWeek);
}
}, {
key: "previousOrSame",
value: function previousOrSame(dayOfWeek) {
return new RelativeDayOfWeek(1, dayOfWeek);
}
}]);
return TemporalAdjusters2;
}();
var Impl = function(_TemporalAdjuster) {
_inherits(Impl2, _TemporalAdjuster);
var _super = _createSuper(Impl2);
function Impl2(ordinal) {
var _this;
_classCallCheck(this, Impl2);
_this = _super.call(this);
_this._ordinal = ordinal;
return _this;
}
_createClass(Impl2, [{
key: "adjustInto",
value: function adjustInto(temporal) {
switch (this._ordinal) {
case 0:
return temporal.with(ChronoField.DAY_OF_MONTH, 1);
case 1:
return temporal.with(ChronoField.DAY_OF_MONTH, temporal.range(ChronoField.DAY_OF_MONTH).maximum());
case 2:
return temporal.with(ChronoField.DAY_OF_MONTH, 1).plus(1, ChronoUnit.MONTHS);
case 3:
return temporal.with(ChronoField.DAY_OF_YEAR, 1);
case 4:
return temporal.with(ChronoField.DAY_OF_YEAR, temporal.range(ChronoField.DAY_OF_YEAR).maximum());
case 5:
return temporal.with(ChronoField.DAY_OF_YEAR, 1).plus(1, ChronoUnit.YEARS);
}
throw new IllegalStateException("Unreachable");
}
}]);
return Impl2;
}(TemporalAdjuster);
Impl.FIRST_DAY_OF_MONTH = new Impl(0);
Impl.LAST_DAY_OF_MONTH = new Impl(1);
Impl.FIRST_DAY_OF_NEXT_MONTH = new Impl(2);
Impl.FIRST_DAY_OF_YEAR = new Impl(3);
Impl.LAST_DAY_OF_YEAR = new Impl(4);
Impl.FIRST_DAY_OF_NEXT_YEAR = new Impl(5);
var DayOfWeekInMonth = function(_TemporalAdjuster2) {
_inherits(DayOfWeekInMonth2, _TemporalAdjuster2);
var _super2 = _createSuper(DayOfWeekInMonth2);
function DayOfWeekInMonth2(ordinal, dow) {
var _this2;
_classCallCheck(this, DayOfWeekInMonth2);
_this2 = _super2.call(this);
_this2._ordinal = ordinal;
_this2._dowValue = dow.value();
return _this2;
}
_createClass(DayOfWeekInMonth2, [{
key: "adjustInto",
value: function adjustInto(temporal) {
if (this._ordinal >= 0) {
var temp = temporal.with(ChronoField.DAY_OF_MONTH, 1);
var curDow = temp.get(ChronoField.DAY_OF_WEEK);
var dowDiff = MathUtil.intMod(this._dowValue - curDow + 7, 7);
dowDiff += (this._ordinal - 1) * 7;
return temp.plus(dowDiff, ChronoUnit.DAYS);
} else {
var _temp = temporal.with(ChronoField.DAY_OF_MONTH, temporal.range(ChronoField.DAY_OF_MONTH).maximum());
var _curDow = _temp.get(ChronoField.DAY_OF_WEEK);
var daysDiff = this._dowValue - _curDow;
daysDiff = daysDiff === 0 ? 0 : daysDiff > 0 ? daysDiff - 7 : daysDiff;
daysDiff -= (-this._ordinal - 1) * 7;
return _temp.plus(daysDiff, ChronoUnit.DAYS);
}
}
}]);
return DayOfWeekInMonth2;
}(TemporalAdjuster);
var RelativeDayOfWeek = function(_TemporalAdjuster3) {
_inherits(RelativeDayOfWeek2, _TemporalAdjuster3);
var _super3 = _createSuper(RelativeDayOfWeek2);
function RelativeDayOfWeek2(relative, dayOfWeek) {
var _this3;
_classCallCheck(this, RelativeDayOfWeek2);
_this3 = _super3.call(this);
requireNonNull(dayOfWeek, "dayOfWeek");
_this3._relative = relative;
_this3._dowValue = dayOfWeek.value();
return _this3;
}
_createClass(RelativeDayOfWeek2, [{
key: "adjustInto",
value: function adjustInto(temporal) {
var calDow = temporal.get(ChronoField.DAY_OF_WEEK);
if (this._relative < 2 && calDow === this._dowValue) {
return temporal;
}
if ((this._relative & 1) === 0) {
var daysDiff = calDow - this._dowValue;
return temporal.plus(daysDiff >= 0 ? 7 - daysDiff : -daysDiff, ChronoUnit.DAYS);
} else {
var _daysDiff = this._dowValue - calDow;
return temporal.minus(_daysDiff >= 0 ? 7 - _daysDiff : -_daysDiff, ChronoUnit.DAYS);
}
}
}]);
return RelativeDayOfWeek2;
}(TemporalAdjuster);
var IsoChronology = function(_Enum) {
_inherits(IsoChronology2, _Enum);
var _super = _createSuper(IsoChronology2);
function IsoChronology2() {
_classCallCheck(this, IsoChronology2);
return _super.apply(this, arguments);
}
_createClass(IsoChronology2, [{
key: "_updateResolveMap",
value: function _updateResolveMap(fieldValues, field, value) {
requireNonNull(fieldValues, "fieldValues");
requireNonNull(field, "field");
var current = fieldValues.get(field);
if (current != null && current !== value) {
throw new DateTimeException("Invalid state, field: ".concat(field, " ").concat(current, " conflicts with ").concat(field, " ").concat(value));
}
fieldValues.put(field, value);
}
}, {
key: "resolveDate",
value: function resolveDate(fieldValues, resolverStyle) {
if (fieldValues.containsKey(ChronoField.EPOCH_DAY)) {
return LocalDate.ofEpochDay(fieldValues.remove(ChronoField.EPOCH_DAY));
}
var prolepticMonth = fieldValues.remove(ChronoField.PROLEPTIC_MONTH);
if (prolepticMonth != null) {
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.PROLEPTIC_MONTH.checkValidValue(prolepticMonth);
}
this._updateResolveMap(fieldValues, ChronoField.MONTH_OF_YEAR, MathUtil.floorMod(prolepticMonth, 12) + 1);
this._updateResolveMap(fieldValues, ChronoField.YEAR, MathUtil.floorDiv(prolepticMonth, 12));
}
var yoeLong = fieldValues.remove(ChronoField.YEAR_OF_ERA);
if (yoeLong != null) {
if (resolverStyle !== ResolverStyle.LENIENT) {
ChronoField.YEAR_OF_ERA.checkValidValue(yoeLong);
}
var era = fieldValues.remove(ChronoField.ERA);
if (era == null) {
var year = fieldValues.get(ChronoField.YEAR);
if (resolverStyle === ResolverStyle.STRICT) {
if (year != null) {
this._updateResolveMap(fieldValues, ChronoField.YEAR, year > 0 ? yoeLong : MathUtil.safeSubtract(1, yoeLong));
} else {
fieldValues.put(ChronoField.YEAR_OF_ERA, yoeLong);
}
} else {
this._updateResolveMap(fieldValues, ChronoField.YEAR, year == null || year > 0 ? yoeLong : MathUtil.safeSubtract(1, yoeLong));
}
} else if (era === 1) {
this._updateResolveMap(fieldValues, ChronoField.YEAR, yoeLong);
} else if (era === 0) {
this._updateResolveMap(fieldValues, ChronoField.YEAR, MathUtil.safeSubtract(1, yoeLong));
} else {
throw new DateTimeException("Invalid value for era: ".concat(era));
}
} else if (fieldValues.containsKey(ChronoField.ERA)) {
ChronoField.ERA.checkValidValue(fieldValues.get(ChronoField.ERA));
}
if (fieldValues.containsKey(ChronoField.YEAR)) {
if (fieldValues.containsKey(ChronoField.MONTH_OF_YEAR)) {
if (fieldValues.containsKey(ChronoField.DAY_OF_MONTH)) {
var y = ChronoField.YEAR.checkValidIntValue(fieldValues.remove(ChronoField.YEAR));
var moy = fieldValues.remove(ChronoField.MONTH_OF_YEAR);
var dom = fieldValues.remove(ChronoField.DAY_OF_MONTH);
if (resolverStyle === ResolverStyle.LENIENT) {
var months = moy - 1;
var days = dom - 1;
return LocalDate.of(y, 1, 1).plusMonths(months).plusDays(days);
} else if (resolverStyle === ResolverStyle.SMART) {
ChronoField.DAY_OF_MONTH.checkValidValue(dom);
if (moy === 4 || moy === 6 || moy === 9 || moy === 11) {
dom = Math.min(dom, 30);
} else if (moy === 2) {
dom = Math.min(dom, Month.FEBRUARY.length(Year2.isLeap(y)));
}
return LocalDate.of(y, moy, dom);
} else {
return LocalDate.of(y, moy, dom);
}
}
}
if (fieldValues.containsKey(ChronoField.DAY_OF_YEAR)) {
var _y = ChronoField.YEAR.checkValidIntValue(fieldValues.remove(ChronoField.YEAR));
if (resolverStyle === ResolverStyle.LENIENT) {
var _days = MathUtil.safeSubtract(fieldValues.remove(ChronoField.DAY_OF_YEAR), 1);
return LocalDate.ofYearDay(_y, 1).plusDays(_days);
}
var doy = ChronoField.DAY_OF_YEAR.checkValidIntValue(fieldValues.remove(ChronoField.DAY_OF_YEAR));
return LocalDate.ofYearDay(_y, doy);
}
if (fieldValues.containsKey(ChronoField.ALIGNED_WEEK_OF_YEAR)) {
if (fieldValues.containsKey(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR)) {
var _y2 = ChronoField.YEAR.checkValidIntValue(fieldValues.remove(ChronoField.YEAR));
if (resolverStyle === ResolverStyle.LENIENT) {
var weeks = MathUtil.safeSubtract(fieldValues.remove(ChronoField.ALIGNED_WEEK_OF_YEAR), 1);
var _days2 = MathUtil.safeSubtract(fieldValues.remove(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), 1);
return LocalDate.of(_y2, 1, 1).plusWeeks(weeks).plusDays(_days2);
}
var aw = ChronoField.ALIGNED_WEEK_OF_YEAR.checkValidIntValue(fieldValues.remove(ChronoField.ALIGNED_WEEK_OF_YEAR));
var ad = ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR.checkValidIntValue(fieldValues.remove(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR));
var date = LocalDate.of(_y2, 1, 1).plusDays((aw - 1) * 7 + (ad - 1));
if (resolverStyle === ResolverStyle.STRICT && date.get(ChronoField.YEAR) !== _y2) {
throw new DateTimeException("Strict mode rejected date parsed to a different year");
}
return date;
}
if (fieldValues.containsKey(ChronoField.DAY_OF_WEEK)) {
var _y3 = ChronoField.YEAR.checkValidIntValue(fieldValues.remove(ChronoField.YEAR));
if (resolverStyle === ResolverStyle.LENIENT) {
var _weeks = MathUtil.safeSubtract(fieldValues.remove(ChronoField.ALIGNED_WEEK_OF_YEAR), 1);
var _days3 = MathUtil.safeSubtract(fieldValues.remove(ChronoField.DAY_OF_WEEK), 1);
return LocalDate.of(_y3, 1, 1).plusWeeks(_weeks).plusDays(_days3);
}
var _aw = ChronoField.ALIGNED_WEEK_OF_YEAR.checkValidIntValue(fieldValues.remove(ChronoField.ALIGNED_WEEK_OF_YEAR));
var dow = ChronoField.DAY_OF_WEEK.checkValidIntValue(fieldValues.remove(ChronoField.DAY_OF_WEEK));
var _date = LocalDate.of(_y3, 1, 1).plusWeeks(_aw - 1).with(TemporalAdjusters.nextOrSame(DayOfWeek.of(dow)));
if (resolverStyle === ResolverStyle.STRICT && _date.get(ChronoField.YEAR) !== _y3) {
throw new DateTimeException("Strict mode rejected date parsed to a different month");
}
return _date;
}
}
}
return null;
}
}, {
key: "date",
value: function date(temporal) {
return LocalDate.from(temporal);
}
}], [{
key: "isLeapYear",
value: function isLeapYear(prolepticYear) {
return (prolepticYear & 3) === 0 && (prolepticYear % 100 !== 0 || prolepticYear % 400 === 0);
}
}]);
return IsoChronology2;
}(Enum);
function _init$e() {
IsoChronology.INSTANCE = new IsoChronology("IsoChronology");
}
var OffsetTime = function(_Temporal) {
_inherits(OffsetTime2, _Temporal);
var _super = _createSuper(OffsetTime2);
function OffsetTime2(time, offset) {
var _this;
_classCallCheck(this, OffsetTime2);
_this = _super.call(this);
requireNonNull(time, "time");
requireInstance(time, LocalTime, "time");
requireNonNull(offset, "offset");
requireInstance(offset, ZoneOffset, "offset");
_this._time = time;
_this._offset = offset;
return _this;
}
_createClass(OffsetTime2, [{
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(ChronoField.NANO_OF_DAY, this._time.toNanoOfDay()).with(ChronoField.OFFSET_SECONDS, this.offset().totalSeconds());
}
}, {
key: "atDate",
value: function atDate(date) {
return OffsetDateTime.of(date, this._time, this._offset);
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
return formatter.format(this, OffsetTime2.FROM);
}
}, {
key: "get",
value: function get(field) {
return _get(_getPrototypeOf(OffsetTime2.prototype), "get", this).call(this, field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field instanceof ChronoField) {
if (field === ChronoField.OFFSET_SECONDS) {
return this._offset.totalSeconds();
}
return this._time.getLong(field);
}
return field.getFrom(this);
}
}, {
key: "hour",
value: function hour() {
return this._time.hour();
}
}, {
key: "minute",
value: function minute() {
return this._time.minute();
}
}, {
key: "second",
value: function second() {
return this._time.second();
}
}, {
key: "nano",
value: function nano() {
return this._time.nano();
}
}, {
key: "offset",
value: function offset() {
return this._offset;
}
}, {
key: "isAfter",
value: function isAfter(other) {
requireNonNull(other, "other");
return this._toEpochNano() > other._toEpochNano();
}
}, {
key: "isBefore",
value: function isBefore(other) {
requireNonNull(other, "other");
return this._toEpochNano() < other._toEpochNano();
}
}, {
key: "isEqual",
value: function isEqual(other) {
requireNonNull(other, "other");
return this._toEpochNano() === other._toEpochNano();
}
}, {
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return fieldOrUnit.isTimeBased() || fieldOrUnit === ChronoField.OFFSET_SECONDS;
} else if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isTimeBased();
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "minusHours",
value: function minusHours(hours) {
return this._withLocalTimeOffset(this._time.minusHours(hours), this._offset);
}
}, {
key: "minusMinutes",
value: function minusMinutes(minutes) {
return this._withLocalTimeOffset(this._time.minusMinutes(minutes), this._offset);
}
}, {
key: "minusSeconds",
value: function minusSeconds(seconds) {
return this._withLocalTimeOffset(this._time.minusSeconds(seconds), this._offset);
}
}, {
key: "minusNanos",
value: function minusNanos(nanos) {
return this._withLocalTimeOffset(this._time.minusNanos(nanos), this._offset);
}
}, {
key: "_minusAmount",
value: function _minusAmount(amount) {
requireNonNull(amount);
return amount.subtractFrom(this);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
return this.plus(-1 * amountToSubtract, unit);
}
}, {
key: "_plusAmount",
value: function _plusAmount(amount) {
requireNonNull(amount);
return amount.addTo(this);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
if (unit instanceof ChronoUnit) {
return this._withLocalTimeOffset(this._time.plus(amountToAdd, unit), this._offset);
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusHours",
value: function plusHours(hours) {
return this._withLocalTimeOffset(this._time.plusHours(hours), this._offset);
}
}, {
key: "plusMinutes",
value: function plusMinutes(minutes) {
return this._withLocalTimeOffset(this._time.plusMinutes(minutes), this._offset);
}
}, {
key: "plusSeconds",
value: function plusSeconds(seconds) {
return this._withLocalTimeOffset(this._time.plusSeconds(seconds), this._offset);
}
}, {
key: "plusNanos",
value: function plusNanos(nanos) {
return this._withLocalTimeOffset(this._time.plusNanos(nanos), this._offset);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.precision()) {
return ChronoUnit.NANOS;
} else if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
return this.offset();
} else if (_query === TemporalQueries.localTime()) {
return this._time;
} else if (_query === TemporalQueries.chronology() || _query === TemporalQueries.localDate() || _query === TemporalQueries.zoneId()) {
return null;
}
return _get(_getPrototypeOf(OffsetTime2.prototype), "query", this).call(this, _query);
}
}, {
key: "range",
value: function range(field) {
if (field instanceof ChronoField) {
if (field === ChronoField.OFFSET_SECONDS) {
return field.range();
}
return this._time.range(field);
}
return field.rangeRefinedBy(this);
}
}, {
key: "toLocalTime",
value: function toLocalTime() {
return this._time;
}
}, {
key: "truncatedTo",
value: function truncatedTo(unit) {
return this._withLocalTimeOffset(this._time.truncatedTo(unit), this._offset);
}
}, {
key: "until",
value: function until(endExclusive, unit) {
requireNonNull(endExclusive, "endExclusive");
requireNonNull(unit, "unit");
var end = OffsetTime2.from(endExclusive);
if (unit instanceof ChronoUnit) {
var nanosUntil = end._toEpochNano() - this._toEpochNano();
switch (unit) {
case ChronoUnit.NANOS:
return nanosUntil;
case ChronoUnit.MICROS:
return Math.floor(nanosUntil / 1e3);
case ChronoUnit.MILLIS:
return Math.floor(nanosUntil / 1e6);
case ChronoUnit.SECONDS:
return Math.floor(nanosUntil / LocalTime.NANOS_PER_SECOND);
case ChronoUnit.MINUTES:
return Math.floor(nanosUntil / LocalTime.NANOS_PER_MINUTE);
case ChronoUnit.HOURS:
return Math.floor(nanosUntil / LocalTime.NANOS_PER_HOUR);
case ChronoUnit.HALF_DAYS:
return Math.floor(nanosUntil / (12 * LocalTime.NANOS_PER_HOUR));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.between(this, end);
}
}, {
key: "withHour",
value: function withHour(hour) {
return this._withLocalTimeOffset(this._time.withHour(hour), this._offset);
}
}, {
key: "withMinute",
value: function withMinute(minute) {
return this._withLocalTimeOffset(this._time.withMinute(minute), this._offset);
}
}, {
key: "withSecond",
value: function withSecond(second) {
return this._withLocalTimeOffset(this._time.withSecond(second), this._offset);
}
}, {
key: "withNano",
value: function withNano(nano) {
return this._withLocalTimeOffset(this._time.withNano(nano), this._offset);
}
}, {
key: "withOffsetSameInstant",
value: function withOffsetSameInstant(offset) {
requireNonNull(offset, "offset");
if (offset.equals(this._offset)) {
return this;
}
var difference = offset.totalSeconds() - this._offset.totalSeconds();
var adjusted = this._time.plusSeconds(difference);
return new OffsetTime2(adjusted, offset);
}
}, {
key: "withOffsetSameLocal",
value: function withOffsetSameLocal(offset) {
return offset != null && offset.equals(this._offset) ? this : new OffsetTime2(this._time, offset);
}
}, {
key: "_toEpochNano",
value: function _toEpochNano() {
var nod = this._time.toNanoOfDay();
var offsetNanos = this._offset.totalSeconds() * LocalTime.NANOS_PER_SECOND;
return nod - offsetNanos;
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
requireNonNull(adjuster, "adjuster");
if (adjuster instanceof LocalTime) {
return this._withLocalTimeOffset(adjuster, this._offset);
} else if (adjuster instanceof ZoneOffset) {
return this._withLocalTimeOffset(this._time, adjuster);
} else if (adjuster instanceof OffsetTime2) {
return adjuster;
}
return adjuster.adjustInto(this);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
if (field === ChronoField.OFFSET_SECONDS) {
return this._withLocalTimeOffset(this._time, ZoneOffset.ofTotalSeconds(field.checkValidIntValue(newValue)));
}
return this._withLocalTimeOffset(this._time.with(field, newValue), this._offset);
}
return field.adjustInto(this, newValue);
}
}, {
key: "_withLocalTimeOffset",
value: function _withLocalTimeOffset(time, offset) {
if (this._time === time && this._offset.equals(offset)) {
return this;
}
return new OffsetTime2(time, offset);
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, OffsetTime2, "other");
if (this._offset.equals(other._offset)) {
return this._time.compareTo(other._time);
}
var compare = MathUtil.compareNumbers(this._toEpochNano(), other._toEpochNano());
if (compare === 0) {
return this._time.compareTo(other._time);
}
return compare;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof OffsetTime2) {
return this._time.equals(other._time) && this._offset.equals(other._offset);
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._time.hashCode() ^ this._offset.hashCode();
}
}, {
key: "toString",
value: function toString() {
return this._time.toString() + this._offset.toString();
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
if (temporal instanceof OffsetTime2) {
return temporal;
} else if (temporal instanceof OffsetDateTime) {
return temporal.toOffsetTime();
}
try {
var time = LocalTime.from(temporal);
var offset = ZoneOffset.from(temporal);
return new OffsetTime2(time, offset);
} catch (ex) {
throw new DateTimeException("Unable to obtain OffsetTime TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""));
}
}
}, {
key: "now",
value: function now(clockOrZone) {
if (arguments.length === 0) {
return OffsetTime2._now(Clock.systemDefaultZone());
} else if (clockOrZone instanceof Clock) {
return OffsetTime2._now(clockOrZone);
} else {
return OffsetTime2._now(Clock.system(clockOrZone));
}
}
}, {
key: "_now",
value: function _now(clock) {
requireNonNull(clock, "clock");
var now = clock.instant();
return OffsetTime2.ofInstant(now, clock.zone().rules().offset(now));
}
}, {
key: "of",
value: function of() {
if (arguments.length <= 2) {
return OffsetTime2.ofTimeAndOffset.apply(this, arguments);
} else {
return OffsetTime2.ofNumbers.apply(this, arguments);
}
}
}, {
key: "ofNumbers",
value: function ofNumbers(hour, minute, second, nanoOfSecond, offset) {
var time = LocalTime.of(hour, minute, second, nanoOfSecond);
return new OffsetTime2(time, offset);
}
}, {
key: "ofTimeAndOffset",
value: function ofTimeAndOffset(time, offset) {
return new OffsetTime2(time, offset);
}
}, {
key: "ofInstant",
value: function ofInstant(instant, zone) {
requireNonNull(instant, "instant");
requireInstance(instant, Instant, "instant");
requireNonNull(zone, "zone");
requireInstance(zone, ZoneId, "zone");
var rules = zone.rules();
var offset = rules.offset(instant);
var secsOfDay = instant.epochSecond() % LocalTime.SECONDS_PER_DAY;
secsOfDay = (secsOfDay + offset.totalSeconds()) % LocalTime.SECONDS_PER_DAY;
if (secsOfDay < 0) {
secsOfDay += LocalTime.SECONDS_PER_DAY;
}
var time = LocalTime.ofSecondOfDay(secsOfDay, instant.nano());
return new OffsetTime2(time, offset);
}
}, {
key: "parse",
value: function parse2(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DateTimeFormatter.ISO_OFFSET_TIME;
requireNonNull(formatter, "formatter");
return formatter.parse(text, OffsetTime2.FROM);
}
}]);
return OffsetTime2;
}(Temporal);
function _init$f() {
OffsetTime.MIN = OffsetTime.ofNumbers(0, 0, 0, 0, ZoneOffset.MAX);
OffsetTime.MAX = OffsetTime.ofNumbers(23, 59, 59, 999999999, ZoneOffset.MIN);
OffsetTime.FROM = createTemporalQuery("OffsetTime.FROM", function(temporal) {
return OffsetTime.from(temporal);
});
}
var ChronoZonedDateTime = function(_Temporal) {
_inherits(ChronoZonedDateTime2, _Temporal);
var _super = _createSuper(ChronoZonedDateTime2);
function ChronoZonedDateTime2() {
_classCallCheck(this, ChronoZonedDateTime2);
return _super.apply(this, arguments);
}
_createClass(ChronoZonedDateTime2, [{
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.zone()) {
return this.zone();
} else if (_query === TemporalQueries.chronology()) {
return this.toLocalDate().chronology();
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.NANOS;
} else if (_query === TemporalQueries.offset()) {
return this.offset();
} else if (_query === TemporalQueries.localDate()) {
return LocalDate.ofEpochDay(this.toLocalDate().toEpochDay());
} else if (_query === TemporalQueries.localTime()) {
return this.toLocalTime();
}
return _get(_getPrototypeOf(ChronoZonedDateTime2.prototype), "query", this).call(this, _query);
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
return formatter.format(this);
}
}, {
key: "toInstant",
value: function toInstant() {
return Instant.ofEpochSecond(this.toEpochSecond(), this.toLocalTime().nano());
}
}, {
key: "toEpochSecond",
value: function toEpochSecond() {
var epochDay = this.toLocalDate().toEpochDay();
var secs = epochDay * 86400 + this.toLocalTime().toSecondOfDay();
secs -= this.offset().totalSeconds();
return secs;
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
var cmp = MathUtil.compareNumbers(this.toEpochSecond(), other.toEpochSecond());
if (cmp === 0) {
cmp = this.toLocalTime().nano() - other.toLocalTime().nano();
if (cmp === 0) {
cmp = this.toLocalDateTime().compareTo(other.toLocalDateTime());
if (cmp === 0) {
cmp = strcmp(this.zone().id(), other.zone().id());
}
}
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
requireNonNull(other, "other");
var thisEpochSec = this.toEpochSecond();
var otherEpochSec = other.toEpochSecond();
return thisEpochSec > otherEpochSec || thisEpochSec === otherEpochSec && this.toLocalTime().nano() > other.toLocalTime().nano();
}
}, {
key: "isBefore",
value: function isBefore(other) {
requireNonNull(other, "other");
var thisEpochSec = this.toEpochSecond();
var otherEpochSec = other.toEpochSecond();
return thisEpochSec < otherEpochSec || thisEpochSec === otherEpochSec && this.toLocalTime().nano() < other.toLocalTime().nano();
}
}, {
key: "isEqual",
value: function isEqual(other) {
requireNonNull(other, "other");
return this.toEpochSecond() === other.toEpochSecond() && this.toLocalTime().nano() === other.toLocalTime().nano();
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof ChronoZonedDateTime2) {
return this.compareTo(other) === 0;
}
return false;
}
}]);
return ChronoZonedDateTime2;
}(Temporal);
function strcmp(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
var ZonedDateTime = function(_ChronoZonedDateTime) {
_inherits(ZonedDateTime2, _ChronoZonedDateTime);
var _super = _createSuper(ZonedDateTime2);
function ZonedDateTime2(dateTime, offset, zone) {
var _this;
_classCallCheck(this, ZonedDateTime2);
requireNonNull(dateTime, "dateTime");
requireNonNull(offset, "offset");
requireNonNull(zone, "zone");
_this = _super.call(this);
_this._dateTime = dateTime;
_this._offset = offset;
_this._zone = zone;
return _this;
}
_createClass(ZonedDateTime2, [{
key: "_resolveLocal",
value: function _resolveLocal(newDateTime) {
requireNonNull(newDateTime, "newDateTime");
return ZonedDateTime2.ofLocal(newDateTime, this._zone, this._offset);
}
}, {
key: "_resolveInstant",
value: function _resolveInstant(newDateTime) {
return ZonedDateTime2.ofInstant3(newDateTime, this._offset, this._zone);
}
}, {
key: "_resolveOffset",
value: function _resolveOffset(offset) {
if (offset.equals(this._offset) === false && this._zone.rules().isValidOffset(this._dateTime, offset)) {
return new ZonedDateTime2(this._dateTime, offset, this._zone);
}
return this;
}
}, {
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return true;
} else if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isDateBased() || fieldOrUnit.isTimeBased();
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (field instanceof ChronoField) {
if (field === ChronoField.INSTANT_SECONDS || field === ChronoField.OFFSET_SECONDS) {
return field.range();
}
return this._dateTime.range(field);
}
return field.rangeRefinedBy(this);
}
}, {
key: "get",
value: function get(field) {
return this.getLong(field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.INSTANT_SECONDS:
return this.toEpochSecond();
case ChronoField.OFFSET_SECONDS:
return this._offset.totalSeconds();
}
return this._dateTime.getLong(field);
}
requireNonNull(field, "field");
return field.getFrom(this);
}
}, {
key: "offset",
value: function offset() {
return this._offset;
}
}, {
key: "withEarlierOffsetAtOverlap",
value: function withEarlierOffsetAtOverlap() {
var trans = this._zone.rules().transition(this._dateTime);
if (trans != null && trans.isOverlap()) {
var earlierOffset = trans.offsetBefore();
if (earlierOffset.equals(this._offset) === false) {
return new ZonedDateTime2(this._dateTime, earlierOffset, this._zone);
}
}
return this;
}
}, {
key: "withLaterOffsetAtOverlap",
value: function withLaterOffsetAtOverlap() {
var trans = this._zone.rules().transition(this.toLocalDateTime());
if (trans != null) {
var laterOffset = trans.offsetAfter();
if (laterOffset.equals(this._offset) === false) {
return new ZonedDateTime2(this._dateTime, laterOffset, this._zone);
}
}
return this;
}
}, {
key: "zone",
value: function zone() {
return this._zone;
}
}, {
key: "withZoneSameLocal",
value: function withZoneSameLocal(zone) {
requireNonNull(zone, "zone");
return this._zone.equals(zone) ? this : ZonedDateTime2.ofLocal(this._dateTime, zone, this._offset);
}
}, {
key: "withZoneSameInstant",
value: function withZoneSameInstant(zone) {
requireNonNull(zone, "zone");
return this._zone.equals(zone) ? this : ZonedDateTime2._create(this._dateTime.toEpochSecond(this._offset), this._dateTime.nano(), zone);
}
}, {
key: "withFixedOffsetZone",
value: function withFixedOffsetZone() {
return this._zone.equals(this._offset) ? this : new ZonedDateTime2(this._dateTime, this._offset, this._offset);
}
}, {
key: "year",
value: function year() {
return this._dateTime.year();
}
}, {
key: "monthValue",
value: function monthValue() {
return this._dateTime.monthValue();
}
}, {
key: "month",
value: function month() {
return this._dateTime.month();
}
}, {
key: "dayOfMonth",
value: function dayOfMonth() {
return this._dateTime.dayOfMonth();
}
}, {
key: "dayOfYear",
value: function dayOfYear() {
return this._dateTime.dayOfYear();
}
}, {
key: "dayOfWeek",
value: function dayOfWeek() {
return this._dateTime.dayOfWeek();
}
}, {
key: "hour",
value: function hour() {
return this._dateTime.hour();
}
}, {
key: "minute",
value: function minute() {
return this._dateTime.minute();
}
}, {
key: "second",
value: function second() {
return this._dateTime.second();
}
}, {
key: "nano",
value: function nano() {
return this._dateTime.nano();
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
if (adjuster instanceof LocalDate) {
return this._resolveLocal(LocalDateTime.of(adjuster, this._dateTime.toLocalTime()));
} else if (adjuster instanceof LocalTime) {
return this._resolveLocal(LocalDateTime.of(this._dateTime.toLocalDate(), adjuster));
} else if (adjuster instanceof LocalDateTime) {
return this._resolveLocal(adjuster);
} else if (adjuster instanceof Instant) {
var instant = adjuster;
return ZonedDateTime2._create(instant.epochSecond(), instant.nano(), this._zone);
} else if (adjuster instanceof ZoneOffset) {
return this._resolveOffset(adjuster);
}
return _get(_getPrototypeOf(ZonedDateTime2.prototype), "_withAdjuster", this).call(this, adjuster);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.INSTANT_SECONDS:
return ZonedDateTime2._create(newValue, this.nano(), this._zone);
case ChronoField.OFFSET_SECONDS: {
var offset = ZoneOffset.ofTotalSeconds(field.checkValidIntValue(newValue));
return this._resolveOffset(offset);
}
}
return this._resolveLocal(this._dateTime.with(field, newValue));
}
return field.adjustInto(this, newValue);
}
}, {
key: "withYear",
value: function withYear(year) {
return this._resolveLocal(this._dateTime.withYear(year));
}
}, {
key: "withMonth",
value: function withMonth(month) {
return this._resolveLocal(this._dateTime.withMonth(month));
}
}, {
key: "withDayOfMonth",
value: function withDayOfMonth(dayOfMonth) {
return this._resolveLocal(this._dateTime.withDayOfMonth(dayOfMonth));
}
}, {
key: "withDayOfYear",
value: function withDayOfYear(dayOfYear) {
return this._resolveLocal(this._dateTime.withDayOfYear(dayOfYear));
}
}, {
key: "withHour",
value: function withHour(hour) {
return this._resolveLocal(this._dateTime.withHour(hour));
}
}, {
key: "withMinute",
value: function withMinute(minute) {
return this._resolveLocal(this._dateTime.withMinute(minute));
}
}, {
key: "withSecond",
value: function withSecond(second) {
return this._resolveLocal(this._dateTime.withSecond(second));
}
}, {
key: "withNano",
value: function withNano(nanoOfSecond) {
return this._resolveLocal(this._dateTime.withNano(nanoOfSecond));
}
}, {
key: "truncatedTo",
value: function truncatedTo(unit) {
return this._resolveLocal(this._dateTime.truncatedTo(unit));
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
if (unit instanceof ChronoUnit) {
if (unit.isDateBased()) {
return this._resolveLocal(this._dateTime.plus(amountToAdd, unit));
} else {
return this._resolveInstant(this._dateTime.plus(amountToAdd, unit));
}
}
requireNonNull(unit, "unit");
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusYears",
value: function plusYears(years) {
return this._resolveLocal(this._dateTime.plusYears(years));
}
}, {
key: "plusMonths",
value: function plusMonths(months) {
return this._resolveLocal(this._dateTime.plusMonths(months));
}
}, {
key: "plusWeeks",
value: function plusWeeks(weeks) {
return this._resolveLocal(this._dateTime.plusWeeks(weeks));
}
}, {
key: "plusDays",
value: function plusDays(days) {
return this._resolveLocal(this._dateTime.plusDays(days));
}
}, {
key: "plusHours",
value: function plusHours(hours) {
return this._resolveInstant(this._dateTime.plusHours(hours));
}
}, {
key: "plusMinutes",
value: function plusMinutes(minutes) {
return this._resolveInstant(this._dateTime.plusMinutes(minutes));
}
}, {
key: "plusSeconds",
value: function plusSeconds(seconds) {
return this._resolveInstant(this._dateTime.plusSeconds(seconds));
}
}, {
key: "plusNanos",
value: function plusNanos(nanos) {
return this._resolveInstant(this._dateTime.plusNanos(nanos));
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
return this._plusUnit(-1 * amountToSubtract, unit);
}
}, {
key: "minusYears",
value: function minusYears(years) {
return this.plusYears(-1 * years);
}
}, {
key: "minusMonths",
value: function minusMonths(months) {
return this.plusMonths(-1 * months);
}
}, {
key: "minusWeeks",
value: function minusWeeks(weeks) {
return this.plusWeeks(-1 * weeks);
}
}, {
key: "minusDays",
value: function minusDays(days) {
return this.plusDays(-1 * days);
}
}, {
key: "minusHours",
value: function minusHours(hours) {
return this.plusHours(-1 * hours);
}
}, {
key: "minusMinutes",
value: function minusMinutes(minutes) {
return this.plusMinutes(-1 * minutes);
}
}, {
key: "minusSeconds",
value: function minusSeconds(seconds) {
return this.plusSeconds(-1 * seconds);
}
}, {
key: "minusNanos",
value: function minusNanos(nanos) {
return this.plusNanos(-1 * nanos);
}
}, {
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.localDate()) {
return this.toLocalDate();
}
requireNonNull(_query, "query");
return _get(_getPrototypeOf(ZonedDateTime2.prototype), "query", this).call(this, _query);
}
}, {
key: "until",
value: function until(endExclusive, unit) {
var end = ZonedDateTime2.from(endExclusive);
if (unit instanceof ChronoUnit) {
end = end.withZoneSameInstant(this._zone);
if (unit.isDateBased()) {
return this._dateTime.until(end._dateTime, unit);
} else {
var difference = this._offset.totalSeconds() - end._offset.totalSeconds();
var adjustedEnd = end._dateTime.plusSeconds(difference);
return this._dateTime.until(adjustedEnd, unit);
}
}
return unit.between(this, end);
}
}, {
key: "toLocalDateTime",
value: function toLocalDateTime() {
return this._dateTime;
}
}, {
key: "toLocalDate",
value: function toLocalDate() {
return this._dateTime.toLocalDate();
}
}, {
key: "toLocalTime",
value: function toLocalTime() {
return this._dateTime.toLocalTime();
}
}, {
key: "toOffsetDateTime",
value: function toOffsetDateTime() {
return OffsetDateTime.of(this._dateTime, this._offset);
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof ZonedDateTime2) {
return this._dateTime.equals(other._dateTime) && this._offset.equals(other._offset) && this._zone.equals(other._zone);
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return MathUtil.hashCode(this._dateTime.hashCode(), this._offset.hashCode(), this._zone.hashCode());
}
}, {
key: "toString",
value: function toString() {
var str = this._dateTime.toString() + this._offset.toString();
if (this._offset !== this._zone) {
str += "[".concat(this._zone.toString(), "]");
}
return str;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
return _get(_getPrototypeOf(ZonedDateTime2.prototype), "format", this).call(this, formatter);
}
}], [{
key: "now",
value: function now(clockOrZone) {
var clock;
if (clockOrZone instanceof ZoneId) {
clock = Clock.system(clockOrZone);
} else {
clock = clockOrZone == null ? Clock.systemDefaultZone() : clockOrZone;
}
return ZonedDateTime2.ofInstant(clock.instant(), clock.zone());
}
}, {
key: "of",
value: function of() {
if (arguments.length <= 2) {
return ZonedDateTime2.of2.apply(this, arguments);
} else if (arguments.length === 3 && arguments[0] instanceof LocalDate) {
return ZonedDateTime2.of3.apply(this, arguments);
} else {
return ZonedDateTime2.of8.apply(this, arguments);
}
}
}, {
key: "of3",
value: function of3(date, time, zone) {
return ZonedDateTime2.of2(LocalDateTime.of(date, time), zone);
}
}, {
key: "of2",
value: function of2(localDateTime, zone) {
return ZonedDateTime2.ofLocal(localDateTime, zone, null);
}
}, {
key: "of8",
value: function of8(year, month, dayOfMonth, hour, minute, second, nanoOfSecond, zone) {
var dt = LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond);
return ZonedDateTime2.ofLocal(dt, zone, null);
}
}, {
key: "ofLocal",
value: function ofLocal(localDateTime, zone, preferredOffset) {
requireNonNull(localDateTime, "localDateTime");
requireNonNull(zone, "zone");
if (zone instanceof ZoneOffset) {
return new ZonedDateTime2(localDateTime, zone, zone);
}
var offset = null;
var rules = zone.rules();
var validOffsets = rules.validOffsets(localDateTime);
if (validOffsets.length === 1) {
offset = validOffsets[0];
} else if (validOffsets.length === 0) {
var trans = rules.transition(localDateTime);
localDateTime = localDateTime.plusSeconds(trans.duration().seconds());
offset = trans.offsetAfter();
} else {
if (preferredOffset != null && validOffsets.some(function(validOffset) {
return validOffset.equals(preferredOffset);
})) {
offset = preferredOffset;
} else {
offset = requireNonNull(validOffsets[0], "offset");
}
}
return new ZonedDateTime2(localDateTime, offset, zone);
}
}, {
key: "ofInstant",
value: function ofInstant() {
if (arguments.length === 2) {
return ZonedDateTime2.ofInstant2.apply(this, arguments);
} else {
return ZonedDateTime2.ofInstant3.apply(this, arguments);
}
}
}, {
key: "ofInstant2",
value: function ofInstant2(instant, zone) {
requireNonNull(instant, "instant");
requireNonNull(zone, "zone");
return ZonedDateTime2._create(instant.epochSecond(), instant.nano(), zone);
}
}, {
key: "ofInstant3",
value: function ofInstant3(localDateTime, offset, zone) {
requireNonNull(localDateTime, "localDateTime");
requireNonNull(offset, "offset");
requireNonNull(zone, "zone");
return ZonedDateTime2._create(localDateTime.toEpochSecond(offset), localDateTime.nano(), zone);
}
}, {
key: "_create",
value: function _create(epochSecond, nanoOfSecond, zone) {
var rules = zone.rules();
var instant = Instant.ofEpochSecond(epochSecond, nanoOfSecond);
var offset = rules.offset(instant);
var ldt = LocalDateTime.ofEpochSecond(epochSecond, nanoOfSecond, offset);
return new ZonedDateTime2(ldt, offset, zone);
}
}, {
key: "ofStrict",
value: function ofStrict(localDateTime, offset, zone) {
requireNonNull(localDateTime, "localDateTime");
requireNonNull(offset, "offset");
requireNonNull(zone, "zone");
var rules = zone.rules();
if (rules.isValidOffset(localDateTime, offset) === false) {
var trans = rules.transition(localDateTime);
if (trans != null && trans.isGap()) {
throw new DateTimeException("LocalDateTime ".concat(localDateTime, " does not exist in zone ").concat(zone, " due to a gap in the local time-line, typically caused by daylight savings"));
}
throw new DateTimeException('ZoneOffset "'.concat(offset, '" is not valid for LocalDateTime "').concat(localDateTime, '" in zone "').concat(zone, '"'));
}
return new ZonedDateTime2(localDateTime, offset, zone);
}
}, {
key: "ofLenient",
value: function ofLenient(localDateTime, offset, zone) {
requireNonNull(localDateTime, "localDateTime");
requireNonNull(offset, "offset");
requireNonNull(zone, "zone");
if (zone instanceof ZoneOffset && offset.equals(zone) === false) {
throw new IllegalArgumentException("ZoneId must match ZoneOffset");
}
return new ZonedDateTime2(localDateTime, offset, zone);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
if (temporal instanceof ZonedDateTime2) {
return temporal;
}
var zone = ZoneId.from(temporal);
if (temporal.isSupported(ChronoField.INSTANT_SECONDS)) {
var zdt = ZonedDateTime2._from(temporal, zone);
if (zdt != null)
return zdt;
}
var ldt = LocalDateTime.from(temporal);
return ZonedDateTime2.of2(ldt, zone);
}
}, {
key: "_from",
value: function _from(temporal, zone) {
try {
return ZonedDateTime2.__from(temporal, zone);
} catch (ex) {
if (!(ex instanceof DateTimeException))
throw ex;
}
}
}, {
key: "__from",
value: function __from(temporal, zone) {
var epochSecond = temporal.getLong(ChronoField.INSTANT_SECONDS);
var nanoOfSecond = temporal.get(ChronoField.NANO_OF_SECOND);
return ZonedDateTime2._create(epochSecond, nanoOfSecond, zone);
}
}, {
key: "parse",
value: function parse2(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DateTimeFormatter.ISO_ZONED_DATE_TIME;
requireNonNull(formatter, "formatter");
return formatter.parse(text, ZonedDateTime2.FROM);
}
}]);
return ZonedDateTime2;
}(ChronoZonedDateTime);
function _init$g() {
ZonedDateTime.FROM = createTemporalQuery("ZonedDateTime.FROM", function(temporal) {
return ZonedDateTime.from(temporal);
});
}
var OffsetDateTime = function(_Temporal) {
_inherits(OffsetDateTime2, _Temporal);
var _super = _createSuper(OffsetDateTime2);
function OffsetDateTime2(dateTime, offset) {
var _this;
_classCallCheck(this, OffsetDateTime2);
_this = _super.call(this);
requireNonNull(dateTime, "dateTime");
requireInstance(dateTime, LocalDateTime, "dateTime");
requireNonNull(offset, "offset");
requireInstance(offset, ZoneOffset, "offset");
_this._dateTime = dateTime;
_this._offset = offset;
return _this;
}
_createClass(OffsetDateTime2, [{
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(ChronoField.EPOCH_DAY, this.toLocalDate().toEpochDay()).with(ChronoField.NANO_OF_DAY, this.toLocalTime().toNanoOfDay()).with(ChronoField.OFFSET_SECONDS, this.offset().totalSeconds());
}
}, {
key: "until",
value: function until(endExclusive, unit) {
var end = OffsetDateTime2.from(endExclusive);
if (unit instanceof ChronoUnit) {
end = end.withOffsetSameInstant(this._offset);
return this._dateTime.until(end._dateTime, unit);
}
return unit.between(this, end);
}
}, {
key: "atZoneSameInstant",
value: function atZoneSameInstant(zone) {
return ZonedDateTime.ofInstant(this._dateTime, this._offset, zone);
}
}, {
key: "atZoneSimilarLocal",
value: function atZoneSimilarLocal(zone) {
return ZonedDateTime.ofLocal(this._dateTime, zone, this._offset);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.chronology()) {
return IsoChronology.INSTANCE;
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.NANOS;
} else if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
return this.offset();
} else if (_query === TemporalQueries.localDate()) {
return this.toLocalDate();
} else if (_query === TemporalQueries.localTime()) {
return this.toLocalTime();
} else if (_query === TemporalQueries.zoneId()) {
return null;
}
return _get(_getPrototypeOf(OffsetDateTime2.prototype), "query", this).call(this, _query);
}
}, {
key: "get",
value: function get(field) {
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.INSTANT_SECONDS:
throw new DateTimeException("Field too large for an int: ".concat(field));
case ChronoField.OFFSET_SECONDS:
return this.offset().totalSeconds();
}
return this._dateTime.get(field);
}
return _get(_getPrototypeOf(OffsetDateTime2.prototype), "get", this).call(this, field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.INSTANT_SECONDS:
return this.toEpochSecond();
case ChronoField.OFFSET_SECONDS:
return this.offset().totalSeconds();
}
return this._dateTime.getLong(field);
}
return field.getFrom(this);
}
}, {
key: "offset",
value: function offset() {
return this._offset;
}
}, {
key: "year",
value: function year() {
return this._dateTime.year();
}
}, {
key: "monthValue",
value: function monthValue() {
return this._dateTime.monthValue();
}
}, {
key: "month",
value: function month() {
return this._dateTime.month();
}
}, {
key: "dayOfMonth",
value: function dayOfMonth() {
return this._dateTime.dayOfMonth();
}
}, {
key: "dayOfYear",
value: function dayOfYear() {
return this._dateTime.dayOfYear();
}
}, {
key: "dayOfWeek",
value: function dayOfWeek() {
return this._dateTime.dayOfWeek();
}
}, {
key: "hour",
value: function hour() {
return this._dateTime.hour();
}
}, {
key: "minute",
value: function minute() {
return this._dateTime.minute();
}
}, {
key: "second",
value: function second() {
return this._dateTime.second();
}
}, {
key: "nano",
value: function nano() {
return this._dateTime.nano();
}
}, {
key: "toLocalDateTime",
value: function toLocalDateTime() {
return this._dateTime;
}
}, {
key: "toLocalDate",
value: function toLocalDate() {
return this._dateTime.toLocalDate();
}
}, {
key: "toLocalTime",
value: function toLocalTime() {
return this._dateTime.toLocalTime();
}
}, {
key: "toOffsetTime",
value: function toOffsetTime() {
return OffsetTime.of(this._dateTime.toLocalTime(), this._offset);
}
}, {
key: "toZonedDateTime",
value: function toZonedDateTime() {
return ZonedDateTime.of(this._dateTime, this._offset);
}
}, {
key: "toInstant",
value: function toInstant() {
return this._dateTime.toInstant(this._offset);
}
}, {
key: "toEpochSecond",
value: function toEpochSecond() {
return this._dateTime.toEpochSecond(this._offset);
}
}, {
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return fieldOrUnit.isDateBased() || fieldOrUnit.isTimeBased();
}
if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isDateBased() || fieldOrUnit.isTimeBased();
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (field instanceof ChronoField) {
if (field === ChronoField.INSTANT_SECONDS || field === ChronoField.OFFSET_SECONDS) {
return field.range();
}
return this._dateTime.range(field);
}
return field.rangeRefinedBy(this);
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
requireNonNull(adjuster);
if (adjuster instanceof LocalDate || adjuster instanceof LocalTime || adjuster instanceof LocalDateTime) {
return this._withDateTimeOffset(this._dateTime.with(adjuster), this._offset);
} else if (adjuster instanceof Instant) {
return OffsetDateTime2.ofInstant(adjuster, this._offset);
} else if (adjuster instanceof ZoneOffset) {
return this._withDateTimeOffset(this._dateTime, adjuster);
} else if (adjuster instanceof OffsetDateTime2) {
return adjuster;
}
return adjuster.adjustInto(this);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field);
if (field instanceof ChronoField) {
var f = field;
switch (f) {
case ChronoField.INSTANT_SECONDS:
return OffsetDateTime2.ofInstant(Instant.ofEpochSecond(newValue, this.nano()), this._offset);
case ChronoField.OFFSET_SECONDS: {
return this._withDateTimeOffset(this._dateTime, ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));
}
}
return this._withDateTimeOffset(this._dateTime.with(field, newValue), this._offset);
}
return field.adjustInto(this, newValue);
}
}, {
key: "_withDateTimeOffset",
value: function _withDateTimeOffset(dateTime, offset) {
if (this._dateTime === dateTime && this._offset.equals(offset)) {
return this;
}
return new OffsetDateTime2(dateTime, offset);
}
}, {
key: "withYear",
value: function withYear(year) {
return this._withDateTimeOffset(this._dateTime.withYear(year), this._offset);
}
}, {
key: "withMonth",
value: function withMonth(month) {
return this._withDateTimeOffset(this._dateTime.withMonth(month), this._offset);
}
}, {
key: "withDayOfMonth",
value: function withDayOfMonth(dayOfMonth) {
return this._withDateTimeOffset(this._dateTime.withDayOfMonth(dayOfMonth), this._offset);
}
}, {
key: "withDayOfYear",
value: function withDayOfYear(dayOfYear) {
return this._withDateTimeOffset(this._dateTime.withDayOfYear(dayOfYear), this._offset);
}
}, {
key: "withHour",
value: function withHour(hour) {
return this._withDateTimeOffset(this._dateTime.withHour(hour), this._offset);
}
}, {
key: "withMinute",
value: function withMinute(minute) {
return this._withDateTimeOffset(this._dateTime.withMinute(minute), this._offset);
}
}, {
key: "withSecond",
value: function withSecond(second) {
return this._withDateTimeOffset(this._dateTime.withSecond(second), this._offset);
}
}, {
key: "withNano",
value: function withNano(nanoOfSecond) {
return this._withDateTimeOffset(this._dateTime.withNano(nanoOfSecond), this._offset);
}
}, {
key: "withOffsetSameLocal",
value: function withOffsetSameLocal(offset) {
requireNonNull(offset, "offset");
return this._withDateTimeOffset(this._dateTime, offset);
}
}, {
key: "withOffsetSameInstant",
value: function withOffsetSameInstant(offset) {
requireNonNull(offset, "offset");
if (offset.equals(this._offset)) {
return this;
}
var difference = offset.totalSeconds() - this._offset.totalSeconds();
var adjusted = this._dateTime.plusSeconds(difference);
return new OffsetDateTime2(adjusted, offset);
}
}, {
key: "truncatedTo",
value: function truncatedTo(unit) {
return this._withDateTimeOffset(this._dateTime.truncatedTo(unit), this._offset);
}
}, {
key: "_plusAmount",
value: function _plusAmount(amount) {
requireNonNull(amount, "amount");
return amount.addTo(this);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
if (unit instanceof ChronoUnit) {
return this._withDateTimeOffset(this._dateTime.plus(amountToAdd, unit), this._offset);
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusYears",
value: function plusYears(years) {
return this._withDateTimeOffset(this._dateTime.plusYears(years), this._offset);
}
}, {
key: "plusMonths",
value: function plusMonths(months) {
return this._withDateTimeOffset(this._dateTime.plusMonths(months), this._offset);
}
}, {
key: "plusWeeks",
value: function plusWeeks(weeks) {
return this._withDateTimeOffset(this._dateTime.plusWeeks(weeks), this._offset);
}
}, {
key: "plusDays",
value: function plusDays(days) {
return this._withDateTimeOffset(this._dateTime.plusDays(days), this._offset);
}
}, {
key: "plusHours",
value: function plusHours(hours) {
return this._withDateTimeOffset(this._dateTime.plusHours(hours), this._offset);
}
}, {
key: "plusMinutes",
value: function plusMinutes(minutes) {
return this._withDateTimeOffset(this._dateTime.plusMinutes(minutes), this._offset);
}
}, {
key: "plusSeconds",
value: function plusSeconds(seconds) {
return this._withDateTimeOffset(this._dateTime.plusSeconds(seconds), this._offset);
}
}, {
key: "plusNanos",
value: function plusNanos(nanos) {
return this._withDateTimeOffset(this._dateTime.plusNanos(nanos), this._offset);
}
}, {
key: "_minusAmount",
value: function _minusAmount(amount) {
requireNonNull(amount);
return amount.subtractFrom(this);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
return this.plus(-1 * amountToSubtract, unit);
}
}, {
key: "minusYears",
value: function minusYears(years) {
return this._withDateTimeOffset(this._dateTime.minusYears(years), this._offset);
}
}, {
key: "minusMonths",
value: function minusMonths(months) {
return this._withDateTimeOffset(this._dateTime.minusMonths(months), this._offset);
}
}, {
key: "minusWeeks",
value: function minusWeeks(weeks) {
return this._withDateTimeOffset(this._dateTime.minusWeeks(weeks), this._offset);
}
}, {
key: "minusDays",
value: function minusDays(days) {
return this._withDateTimeOffset(this._dateTime.minusDays(days), this._offset);
}
}, {
key: "minusHours",
value: function minusHours(hours) {
return this._withDateTimeOffset(this._dateTime.minusHours(hours), this._offset);
}
}, {
key: "minusMinutes",
value: function minusMinutes(minutes) {
return this._withDateTimeOffset(this._dateTime.minusMinutes(minutes), this._offset);
}
}, {
key: "minusSeconds",
value: function minusSeconds(seconds) {
return this._withDateTimeOffset(this._dateTime.minusSeconds(seconds), this._offset);
}
}, {
key: "minusNanos",
value: function minusNanos(nanos) {
return this._withDateTimeOffset(this._dateTime.minusNanos(nanos), this._offset);
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, OffsetDateTime2, "other");
if (this.offset().equals(other.offset())) {
return this.toLocalDateTime().compareTo(other.toLocalDateTime());
}
var cmp = MathUtil.compareNumbers(this.toEpochSecond(), other.toEpochSecond());
if (cmp === 0) {
cmp = this.toLocalTime().nano() - other.toLocalTime().nano();
if (cmp === 0) {
cmp = this.toLocalDateTime().compareTo(other.toLocalDateTime());
}
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
requireNonNull(other, "other");
var thisEpochSec = this.toEpochSecond();
var otherEpochSec = other.toEpochSecond();
return thisEpochSec > otherEpochSec || thisEpochSec === otherEpochSec && this.toLocalTime().nano() > other.toLocalTime().nano();
}
}, {
key: "isBefore",
value: function isBefore(other) {
requireNonNull(other, "other");
var thisEpochSec = this.toEpochSecond();
var otherEpochSec = other.toEpochSecond();
return thisEpochSec < otherEpochSec || thisEpochSec === otherEpochSec && this.toLocalTime().nano() < other.toLocalTime().nano();
}
}, {
key: "isEqual",
value: function isEqual(other) {
requireNonNull(other, "other");
return this.toEpochSecond() === other.toEpochSecond() && this.toLocalTime().nano() === other.toLocalTime().nano();
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof OffsetDateTime2) {
return this._dateTime.equals(other._dateTime) && this._offset.equals(other._offset);
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._dateTime.hashCode() ^ this._offset.hashCode();
}
}, {
key: "toString",
value: function toString() {
return this._dateTime.toString() + this._offset.toString();
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
return formatter.format(this);
}
}], [{
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
if (temporal instanceof OffsetDateTime2) {
return temporal;
}
try {
var offset = ZoneOffset.from(temporal);
try {
var ldt = LocalDateTime.from(temporal);
return OffsetDateTime2.of(ldt, offset);
} catch (_2) {
var instant = Instant.from(temporal);
return OffsetDateTime2.ofInstant(instant, offset);
}
} catch (ex) {
throw new DateTimeException("Unable to obtain OffsetDateTime TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""));
}
}
}, {
key: "now",
value: function now(clockOrZone) {
if (arguments.length === 0) {
return OffsetDateTime2.now(Clock.systemDefaultZone());
} else {
requireNonNull(clockOrZone, "clockOrZone");
if (clockOrZone instanceof ZoneId) {
return OffsetDateTime2.now(Clock.system(clockOrZone));
} else if (clockOrZone instanceof Clock) {
var now2 = clockOrZone.instant();
return OffsetDateTime2.ofInstant(now2, clockOrZone.zone().rules().offset(now2));
} else {
throw new IllegalArgumentException("clockOrZone must be an instance of ZoneId or Clock");
}
}
}
}, {
key: "of",
value: function of() {
if (arguments.length <= 2) {
return OffsetDateTime2.ofDateTime.apply(this, arguments);
} else if (arguments.length === 3) {
return OffsetDateTime2.ofDateAndTime.apply(this, arguments);
} else {
return OffsetDateTime2.ofNumbers.apply(this, arguments);
}
}
}, {
key: "ofDateTime",
value: function ofDateTime(dateTime, offset) {
return new OffsetDateTime2(dateTime, offset);
}
}, {
key: "ofDateAndTime",
value: function ofDateAndTime(date, time, offset) {
var dt = LocalDateTime.of(date, time);
return new OffsetDateTime2(dt, offset);
}
}, {
key: "ofNumbers",
value: function ofNumbers(year, month, dayOfMonth) {
var hour = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
var minute = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
var second = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0;
var nanoOfSecond = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0;
var offset = arguments.length > 7 ? arguments[7] : void 0;
var dt = LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond);
return new OffsetDateTime2(dt, offset);
}
}, {
key: "ofInstant",
value: function ofInstant(instant, zone) {
requireNonNull(instant, "instant");
requireNonNull(zone, "zone");
var rules = zone.rules();
var offset = rules.offset(instant);
var ldt = LocalDateTime.ofEpochSecond(instant.epochSecond(), instant.nano(), offset);
return new OffsetDateTime2(ldt, offset);
}
}, {
key: "parse",
value: function parse2(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DateTimeFormatter.ISO_OFFSET_DATE_TIME;
requireNonNull(formatter, "formatter");
return formatter.parse(text, OffsetDateTime2.FROM);
}
}]);
return OffsetDateTime2;
}(Temporal);
function _init$h() {
OffsetDateTime.MIN = LocalDateTime.MIN.atOffset(ZoneOffset.MAX);
OffsetDateTime.MAX = LocalDateTime.MAX.atOffset(ZoneOffset.MIN);
OffsetDateTime.FROM = createTemporalQuery("OffsetDateTime.FROM", function(temporal) {
return OffsetDateTime.from(temporal);
});
}
var DAYS_PER_CYCLE = 146097;
var DAYS_0000_TO_1970 = DAYS_PER_CYCLE * 5 - (30 * 365 + 7);
var LocalDate = function(_ChronoLocalDate) {
_inherits(LocalDate2, _ChronoLocalDate);
var _super = _createSuper(LocalDate2);
function LocalDate2(year, month, dayOfMonth) {
var _this;
_classCallCheck(this, LocalDate2);
_this = _super.call(this);
requireNonNull(year, "year");
requireNonNull(month, "month");
requireNonNull(dayOfMonth, "dayOfMonth");
if (month instanceof Month) {
month = month.value();
}
_this._year = MathUtil.safeToInt(year);
_this._month = MathUtil.safeToInt(month);
_this._day = MathUtil.safeToInt(dayOfMonth);
LocalDate2._validate(_this._year, _this._month, _this._day);
return _this;
}
_createClass(LocalDate2, [{
key: "isSupported",
value: function isSupported(field) {
return _get(_getPrototypeOf(LocalDate2.prototype), "isSupported", this).call(this, field);
}
}, {
key: "range",
value: function range(field) {
if (field instanceof ChronoField) {
if (field.isDateBased()) {
switch (field) {
case ChronoField.DAY_OF_MONTH:
return ValueRange.of(1, this.lengthOfMonth());
case ChronoField.DAY_OF_YEAR:
return ValueRange.of(1, this.lengthOfYear());
case ChronoField.ALIGNED_WEEK_OF_MONTH:
return ValueRange.of(1, this.month() === Month.FEBRUARY && this.isLeapYear() === false ? 4 : 5);
case ChronoField.YEAR_OF_ERA:
return this._year <= 0 ? ValueRange.of(1, Year2.MAX_VALUE + 1) : ValueRange.of(1, Year2.MAX_VALUE);
}
return field.range();
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.rangeRefinedBy(this);
}
}, {
key: "get",
value: function get(field) {
return this.getLong(field);
}
}, {
key: "getLong",
value: function getLong(field) {
assert(field != null, "", NullPointerException);
if (field instanceof ChronoField) {
return this._get0(field);
}
return field.getFrom(this);
}
}, {
key: "_get0",
value: function _get0(field) {
switch (field) {
case ChronoField.DAY_OF_WEEK:
return this.dayOfWeek().value();
case ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH:
return MathUtil.intMod(this._day - 1, 7) + 1;
case ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR:
return MathUtil.intMod(this.dayOfYear() - 1, 7) + 1;
case ChronoField.DAY_OF_MONTH:
return this._day;
case ChronoField.DAY_OF_YEAR:
return this.dayOfYear();
case ChronoField.EPOCH_DAY:
return this.toEpochDay();
case ChronoField.ALIGNED_WEEK_OF_MONTH:
return MathUtil.intDiv(this._day - 1, 7) + 1;
case ChronoField.ALIGNED_WEEK_OF_YEAR:
return MathUtil.intDiv(this.dayOfYear() - 1, 7) + 1;
case ChronoField.MONTH_OF_YEAR:
return this._month;
case ChronoField.PROLEPTIC_MONTH:
return this._prolepticMonth();
case ChronoField.YEAR_OF_ERA:
return this._year >= 1 ? this._year : 1 - this._year;
case ChronoField.YEAR:
return this._year;
case ChronoField.ERA:
return this._year >= 1 ? 1 : 0;
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
}, {
key: "_prolepticMonth",
value: function _prolepticMonth() {
return this._year * 12 + (this._month - 1);
}
}, {
key: "chronology",
value: function chronology() {
return IsoChronology.INSTANCE;
}
}, {
key: "year",
value: function year() {
return this._year;
}
}, {
key: "monthValue",
value: function monthValue() {
return this._month;
}
}, {
key: "month",
value: function month() {
return Month.of(this._month);
}
}, {
key: "dayOfMonth",
value: function dayOfMonth() {
return this._day;
}
}, {
key: "dayOfYear",
value: function dayOfYear() {
return this.month().firstDayOfYear(this.isLeapYear()) + this._day - 1;
}
}, {
key: "dayOfWeek",
value: function dayOfWeek() {
var dow0 = MathUtil.floorMod(this.toEpochDay() + 3, 7);
return DayOfWeek.of(dow0 + 1);
}
}, {
key: "isLeapYear",
value: function isLeapYear() {
return IsoChronology.isLeapYear(this._year);
}
}, {
key: "lengthOfMonth",
value: function lengthOfMonth() {
switch (this._month) {
case 2:
return this.isLeapYear() ? 29 : 28;
case 4:
case 6:
case 9:
case 11:
return 30;
default:
return 31;
}
}
}, {
key: "lengthOfYear",
value: function lengthOfYear() {
return this.isLeapYear() ? 366 : 365;
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
requireNonNull(adjuster, "adjuster");
if (adjuster instanceof LocalDate2) {
return adjuster;
}
return _get(_getPrototypeOf(LocalDate2.prototype), "_withAdjuster", this).call(this, adjuster);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
assert(field != null, "field", NullPointerException);
if (field instanceof ChronoField) {
var f = field;
f.checkValidValue(newValue);
switch (f) {
case ChronoField.DAY_OF_WEEK:
return this.plusDays(newValue - this.dayOfWeek().value());
case ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH:
return this.plusDays(newValue - this.getLong(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH));
case ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR:
return this.plusDays(newValue - this.getLong(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR));
case ChronoField.DAY_OF_MONTH:
return this.withDayOfMonth(newValue);
case ChronoField.DAY_OF_YEAR:
return this.withDayOfYear(newValue);
case ChronoField.EPOCH_DAY:
return LocalDate2.ofEpochDay(newValue);
case ChronoField.ALIGNED_WEEK_OF_MONTH:
return this.plusWeeks(newValue - this.getLong(ChronoField.ALIGNED_WEEK_OF_MONTH));
case ChronoField.ALIGNED_WEEK_OF_YEAR:
return this.plusWeeks(newValue - this.getLong(ChronoField.ALIGNED_WEEK_OF_YEAR));
case ChronoField.MONTH_OF_YEAR:
return this.withMonth(newValue);
case ChronoField.PROLEPTIC_MONTH:
return this.plusMonths(newValue - this.getLong(ChronoField.PROLEPTIC_MONTH));
case ChronoField.YEAR_OF_ERA:
return this.withYear(this._year >= 1 ? newValue : 1 - newValue);
case ChronoField.YEAR:
return this.withYear(newValue);
case ChronoField.ERA:
return this.getLong(ChronoField.ERA) === newValue ? this : this.withYear(1 - this._year);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.adjustInto(this, newValue);
}
}, {
key: "withYear",
value: function withYear(year) {
if (this._year === year) {
return this;
}
ChronoField.YEAR.checkValidValue(year);
return LocalDate2._resolvePreviousValid(year, this._month, this._day);
}
}, {
key: "withMonth",
value: function withMonth(month) {
var m = month instanceof Month ? month.value() : month;
if (this._month === m) {
return this;
}
ChronoField.MONTH_OF_YEAR.checkValidValue(m);
return LocalDate2._resolvePreviousValid(this._year, m, this._day);
}
}, {
key: "withDayOfMonth",
value: function withDayOfMonth(dayOfMonth) {
if (this._day === dayOfMonth) {
return this;
}
return LocalDate2.of(this._year, this._month, dayOfMonth);
}
}, {
key: "withDayOfYear",
value: function withDayOfYear(dayOfYear) {
if (this.dayOfYear() === dayOfYear) {
return this;
}
return LocalDate2.ofYearDay(this._year, dayOfYear);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
requireNonNull(amountToAdd, "amountToAdd");
requireNonNull(unit, "unit");
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.DAYS:
return this.plusDays(amountToAdd);
case ChronoUnit.WEEKS:
return this.plusWeeks(amountToAdd);
case ChronoUnit.MONTHS:
return this.plusMonths(amountToAdd);
case ChronoUnit.YEARS:
return this.plusYears(amountToAdd);
case ChronoUnit.DECADES:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 10));
case ChronoUnit.CENTURIES:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 100));
case ChronoUnit.MILLENNIA:
return this.plusYears(MathUtil.safeMultiply(amountToAdd, 1e3));
case ChronoUnit.ERAS:
return this.with(ChronoField.ERA, MathUtil.safeAdd(this.getLong(ChronoField.ERA), amountToAdd));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusYears",
value: function plusYears(yearsToAdd) {
if (yearsToAdd === 0) {
return this;
}
var newYear = ChronoField.YEAR.checkValidIntValue(this._year + yearsToAdd);
return LocalDate2._resolvePreviousValid(newYear, this._month, this._day);
}
}, {
key: "plusMonths",
value: function plusMonths(monthsToAdd) {
if (monthsToAdd === 0) {
return this;
}
var monthCount = this._year * 12 + (this._month - 1);
var calcMonths = monthCount + monthsToAdd;
var newYear = ChronoField.YEAR.checkValidIntValue(MathUtil.floorDiv(calcMonths, 12));
var newMonth = MathUtil.floorMod(calcMonths, 12) + 1;
return LocalDate2._resolvePreviousValid(newYear, newMonth, this._day);
}
}, {
key: "plusWeeks",
value: function plusWeeks(weeksToAdd) {
return this.plusDays(MathUtil.safeMultiply(weeksToAdd, 7));
}
}, {
key: "plusDays",
value: function plusDays(daysToAdd) {
if (daysToAdd === 0) {
return this;
}
var mjDay = MathUtil.safeAdd(this.toEpochDay(), daysToAdd);
return LocalDate2.ofEpochDay(mjDay);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
requireNonNull(amountToSubtract, "amountToSubtract");
requireNonNull(unit, "unit");
return this._plusUnit(-1 * amountToSubtract, unit);
}
}, {
key: "minusYears",
value: function minusYears(yearsToSubtract) {
return this.plusYears(yearsToSubtract * -1);
}
}, {
key: "minusMonths",
value: function minusMonths(monthsToSubtract) {
return this.plusMonths(monthsToSubtract * -1);
}
}, {
key: "minusWeeks",
value: function minusWeeks(weeksToSubtract) {
return this.plusWeeks(weeksToSubtract * -1);
}
}, {
key: "minusDays",
value: function minusDays(daysToSubtract) {
return this.plusDays(daysToSubtract * -1);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.localDate()) {
return this;
}
return _get(_getPrototypeOf(LocalDate2.prototype), "query", this).call(this, _query);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return _get(_getPrototypeOf(LocalDate2.prototype), "adjustInto", this).call(this, temporal);
}
}, {
key: "until",
value: function until(p1, p2) {
if (arguments.length < 2) {
return this.until1(p1);
} else {
return this.until2(p1, p2);
}
}
}, {
key: "until2",
value: function until2(endExclusive, unit) {
var end = LocalDate2.from(endExclusive);
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.DAYS:
return this.daysUntil(end);
case ChronoUnit.WEEKS:
return MathUtil.intDiv(this.daysUntil(end), 7);
case ChronoUnit.MONTHS:
return this._monthsUntil(end);
case ChronoUnit.YEARS:
return MathUtil.intDiv(this._monthsUntil(end), 12);
case ChronoUnit.DECADES:
return MathUtil.intDiv(this._monthsUntil(end), 120);
case ChronoUnit.CENTURIES:
return MathUtil.intDiv(this._monthsUntil(end), 1200);
case ChronoUnit.MILLENNIA:
return MathUtil.intDiv(this._monthsUntil(end), 12e3);
case ChronoUnit.ERAS:
return end.getLong(ChronoField.ERA) - this.getLong(ChronoField.ERA);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.between(this, end);
}
}, {
key: "daysUntil",
value: function daysUntil(end) {
return end.toEpochDay() - this.toEpochDay();
}
}, {
key: "_monthsUntil",
value: function _monthsUntil(end) {
var packed1 = this._prolepticMonth() * 32 + this.dayOfMonth();
var packed2 = end._prolepticMonth() * 32 + end.dayOfMonth();
return MathUtil.intDiv(packed2 - packed1, 32);
}
}, {
key: "until1",
value: function until1(endDate) {
var end = LocalDate2.from(endDate);
var totalMonths = end._prolepticMonth() - this._prolepticMonth();
var days = end._day - this._day;
if (totalMonths > 0 && days < 0) {
totalMonths--;
var calcDate = this.plusMonths(totalMonths);
days = end.toEpochDay() - calcDate.toEpochDay();
} else if (totalMonths < 0 && days > 0) {
totalMonths++;
days -= end.lengthOfMonth();
}
var years = MathUtil.intDiv(totalMonths, 12);
var months = MathUtil.intMod(totalMonths, 12);
return Period.of(years, months, days);
}
}, {
key: "atTime",
value: function atTime() {
if (arguments.length === 1) {
return this.atTime1.apply(this, arguments);
} else {
return this.atTime4.apply(this, arguments);
}
}
}, {
key: "atTime1",
value: function atTime1(time) {
requireNonNull(time, "time");
if (time instanceof LocalTime) {
return LocalDateTime.of(this, time);
} else if (time instanceof OffsetTime) {
return this._atTimeOffsetTime(time);
} else {
throw new IllegalArgumentException("time must be an instance of LocalTime or OffsetTime".concat(time && time.constructor && time.constructor.name ? ", but is ".concat(time.constructor.name) : ""));
}
}
}, {
key: "atTime4",
value: function atTime4(hour, minute) {
var second = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
var nanoOfSecond = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
return this.atTime1(LocalTime.of(hour, minute, second, nanoOfSecond));
}
}, {
key: "_atTimeOffsetTime",
value: function _atTimeOffsetTime(time) {
return OffsetDateTime.of(LocalDateTime.of(this, time.toLocalTime()), time.offset());
}
}, {
key: "atStartOfDay",
value: function atStartOfDay(zone) {
if (zone != null) {
return this._atStartOfDayWithZone(zone);
} else {
return LocalDateTime.of(this, LocalTime.MIDNIGHT);
}
}
}, {
key: "_atStartOfDayWithZone",
value: function _atStartOfDayWithZone(zone) {
requireNonNull(zone, "zone");
var ldt = this.atTime(LocalTime.MIDNIGHT);
if (zone instanceof ZoneOffset === false) {
var trans = zone.rules().transition(ldt);
if (trans != null && trans.isGap()) {
ldt = trans.dateTimeAfter();
}
}
return ZonedDateTime.of(ldt, zone);
}
}, {
key: "toEpochDay",
value: function toEpochDay() {
var y = this._year;
var m = this._month;
var total = 0;
total += 365 * y;
if (y >= 0) {
total += MathUtil.intDiv(y + 3, 4) - MathUtil.intDiv(y + 99, 100) + MathUtil.intDiv(y + 399, 400);
} else {
total -= MathUtil.intDiv(y, -4) - MathUtil.intDiv(y, -100) + MathUtil.intDiv(y, -400);
}
total += MathUtil.intDiv(367 * m - 362, 12);
total += this.dayOfMonth() - 1;
if (m > 2) {
total--;
if (!IsoChronology.isLeapYear(y)) {
total--;
}
}
return total - DAYS_0000_TO_1970;
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, LocalDate2, "other");
return this._compareTo0(other);
}
}, {
key: "_compareTo0",
value: function _compareTo0(otherDate) {
var cmp = this._year - otherDate._year;
if (cmp === 0) {
cmp = this._month - otherDate._month;
if (cmp === 0) {
cmp = this._day - otherDate._day;
}
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
return this.compareTo(other) > 0;
}
}, {
key: "isBefore",
value: function isBefore(other) {
return this.compareTo(other) < 0;
}
}, {
key: "isEqual",
value: function isEqual(other) {
return this.compareTo(other) === 0;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof LocalDate2) {
return this._compareTo0(other) === 0;
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
var yearValue = this._year;
var monthValue = this._month;
var dayValue = this._day;
return MathUtil.hash(yearValue & 4294965248 ^ (yearValue << 11) + (monthValue << 6) + dayValue);
}
}, {
key: "toString",
value: function toString() {
var dayString, monthString, yearString;
var yearValue = this._year;
var monthValue = this._month;
var dayValue = this._day;
var absYear = Math.abs(yearValue);
if (absYear < 1e3) {
if (yearValue < 0) {
yearString = "-".concat("".concat(yearValue - 1e4).slice(-4));
} else {
yearString = "".concat(yearValue + 1e4).slice(-4);
}
} else {
if (yearValue > 9999) {
yearString = "+".concat(yearValue);
} else {
yearString = "".concat(yearValue);
}
}
if (monthValue < 10) {
monthString = "-0".concat(monthValue);
} else {
monthString = "-".concat(monthValue);
}
if (dayValue < 10) {
dayString = "-0".concat(dayValue);
} else {
dayString = "-".concat(dayValue);
}
return yearString + monthString + dayString;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
requireInstance(formatter, DateTimeFormatter, "formatter");
return _get(_getPrototypeOf(LocalDate2.prototype), "format", this).call(this, formatter);
}
}], [{
key: "now",
value: function now(clockOrZone) {
var clock;
if (clockOrZone == null) {
clock = Clock.systemDefaultZone();
} else if (clockOrZone instanceof ZoneId) {
clock = Clock.system(clockOrZone);
} else {
clock = clockOrZone;
}
return LocalDate2.ofInstant(clock.instant(), clock.zone());
}
}, {
key: "ofInstant",
value: function ofInstant(instant) {
var zone = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZoneId.systemDefault();
requireNonNull(instant, "instant");
var offset = zone.rules().offset(instant);
var epochSec = instant.epochSecond() + offset.totalSeconds();
var epochDay = MathUtil.floorDiv(epochSec, LocalTime.SECONDS_PER_DAY);
return LocalDate2.ofEpochDay(epochDay);
}
}, {
key: "of",
value: function of(year, month, dayOfMonth) {
return new LocalDate2(year, month, dayOfMonth);
}
}, {
key: "ofYearDay",
value: function ofYearDay(year, dayOfYear) {
ChronoField.YEAR.checkValidValue(year);
var leap = IsoChronology.isLeapYear(year);
if (dayOfYear === 366 && leap === false) {
assert(false, "Invalid date 'DayOfYear 366' as '".concat(year, "' is not a leap year"), DateTimeException);
}
var moy = Month.of(Math.floor((dayOfYear - 1) / 31 + 1));
var monthEnd = moy.firstDayOfYear(leap) + moy.length(leap) - 1;
if (dayOfYear > monthEnd) {
moy = moy.plus(1);
}
var dom = dayOfYear - moy.firstDayOfYear(leap) + 1;
return new LocalDate2(year, moy.value(), dom);
}
}, {
key: "ofEpochDay",
value: function ofEpochDay() {
var epochDay = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
var adjust, adjustCycles, doyEst, yearEst, zeroDay;
zeroDay = epochDay + DAYS_0000_TO_1970;
zeroDay -= 60;
adjust = 0;
if (zeroDay < 0) {
adjustCycles = MathUtil.intDiv(zeroDay + 1, DAYS_PER_CYCLE) - 1;
adjust = adjustCycles * 400;
zeroDay += -adjustCycles * DAYS_PER_CYCLE;
}
yearEst = MathUtil.intDiv(400 * zeroDay + 591, DAYS_PER_CYCLE);
doyEst = zeroDay - (365 * yearEst + MathUtil.intDiv(yearEst, 4) - MathUtil.intDiv(yearEst, 100) + MathUtil.intDiv(yearEst, 400));
if (doyEst < 0) {
yearEst--;
doyEst = zeroDay - (365 * yearEst + MathUtil.intDiv(yearEst, 4) - MathUtil.intDiv(yearEst, 100) + MathUtil.intDiv(yearEst, 400));
}
yearEst += adjust;
var marchDoy0 = doyEst;
var marchMonth0 = MathUtil.intDiv(marchDoy0 * 5 + 2, 153);
var month = (marchMonth0 + 2) % 12 + 1;
var dom = marchDoy0 - MathUtil.intDiv(marchMonth0 * 306 + 5, 10) + 1;
yearEst += MathUtil.intDiv(marchMonth0, 10);
var year = yearEst;
return new LocalDate2(year, month, dom);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
var date = temporal.query(TemporalQueries.localDate());
if (date == null) {
throw new DateTimeException("Unable to obtain LocalDate from TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""));
}
return date;
}
}, {
key: "parse",
value: function parse2(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DateTimeFormatter.ISO_LOCAL_DATE;
assert(formatter != null, "formatter", NullPointerException);
return formatter.parse(text, LocalDate2.FROM);
}
}, {
key: "_resolvePreviousValid",
value: function _resolvePreviousValid(year, month, day) {
switch (month) {
case 2:
day = Math.min(day, IsoChronology.isLeapYear(year) ? 29 : 28);
break;
case 4:
case 6:
case 9:
case 11:
day = Math.min(day, 30);
break;
}
return LocalDate2.of(year, month, day);
}
}, {
key: "_validate",
value: function _validate(year, month, dayOfMonth) {
var dom;
ChronoField.YEAR.checkValidValue(year);
ChronoField.MONTH_OF_YEAR.checkValidValue(month);
ChronoField.DAY_OF_MONTH.checkValidValue(dayOfMonth);
if (dayOfMonth > 28) {
dom = 31;
switch (month) {
case 2:
dom = IsoChronology.isLeapYear(year) ? 29 : 28;
break;
case 4:
case 6:
case 9:
case 11:
dom = 30;
}
if (dayOfMonth > dom) {
if (dayOfMonth === 29) {
assert(false, "Invalid date 'February 29' as '".concat(year, "' is not a leap year"), DateTimeException);
} else {
assert(false, "Invalid date '".concat(year, "' '").concat(month, "' '").concat(dayOfMonth, "'"), DateTimeException);
}
}
}
}
}]);
return LocalDate2;
}(ChronoLocalDate);
function _init$i() {
LocalDate.MIN = LocalDate.of(YearConstants.MIN_VALUE, 1, 1);
LocalDate.MAX = LocalDate.of(YearConstants.MAX_VALUE, 12, 31);
LocalDate.EPOCH_0 = LocalDate.ofEpochDay(0);
LocalDate.FROM = createTemporalQuery("LocalDate.FROM", function(temporal) {
return LocalDate.from(temporal);
});
}
var ChronoLocalDateTime = function(_Temporal) {
_inherits(ChronoLocalDateTime2, _Temporal);
var _super = _createSuper(ChronoLocalDateTime2);
function ChronoLocalDateTime2() {
_classCallCheck(this, ChronoLocalDateTime2);
return _super.apply(this, arguments);
}
_createClass(ChronoLocalDateTime2, [{
key: "chronology",
value: function chronology() {
return this.toLocalDate().chronology();
}
}, {
key: "query",
value: function query(_query) {
if (_query === TemporalQueries.chronology()) {
return this.chronology();
} else if (_query === TemporalQueries.precision()) {
return ChronoUnit.NANOS;
} else if (_query === TemporalQueries.localDate()) {
return LocalDate.ofEpochDay(this.toLocalDate().toEpochDay());
} else if (_query === TemporalQueries.localTime()) {
return this.toLocalTime();
} else if (_query === TemporalQueries.zone() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.offset()) {
return null;
}
return _get(_getPrototypeOf(ChronoLocalDateTime2.prototype), "query", this).call(this, _query);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(ChronoField.EPOCH_DAY, this.toLocalDate().toEpochDay()).with(ChronoField.NANO_OF_DAY, this.toLocalTime().toNanoOfDay());
}
}, {
key: "toInstant",
value: function toInstant(offset) {
requireInstance(offset, ZoneOffset, "zoneId");
return Instant.ofEpochSecond(this.toEpochSecond(offset), this.toLocalTime().nano());
}
}, {
key: "toEpochSecond",
value: function toEpochSecond(offset) {
requireNonNull(offset, "offset");
var epochDay = this.toLocalDate().toEpochDay();
var secs = epochDay * 86400 + this.toLocalTime().toSecondOfDay();
secs -= offset.totalSeconds();
return MathUtil.safeToInt(secs);
}
}]);
return ChronoLocalDateTime2;
}(Temporal);
var LocalDateTime = function(_ChronoLocalDateTime) {
_inherits(LocalDateTime2, _ChronoLocalDateTime);
var _super = _createSuper(LocalDateTime2);
function LocalDateTime2(date, time) {
var _this;
_classCallCheck(this, LocalDateTime2);
_this = _super.call(this);
requireInstance(date, LocalDate, "date");
requireInstance(time, LocalTime, "time");
_this._date = date;
_this._time = time;
return _this;
}
_createClass(LocalDateTime2, [{
key: "_withDateTime",
value: function _withDateTime(newDate, newTime) {
if (this._date.equals(newDate) && this._time.equals(newTime)) {
return this;
}
return new LocalDateTime2(newDate, newTime);
}
}, {
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return fieldOrUnit.isDateBased() || fieldOrUnit.isTimeBased();
} else if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isDateBased() || fieldOrUnit.isTimeBased();
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
if (field instanceof ChronoField) {
return field.isTimeBased() ? this._time.range(field) : this._date.range(field);
}
return field.rangeRefinedBy(this);
}
}, {
key: "get",
value: function get(field) {
if (field instanceof ChronoField) {
return field.isTimeBased() ? this._time.get(field) : this._date.get(field);
}
return _get(_getPrototypeOf(LocalDateTime2.prototype), "get", this).call(this, field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
return field.isTimeBased() ? this._time.getLong(field) : this._date.getLong(field);
}
return field.getFrom(this);
}
}, {
key: "year",
value: function year() {
return this._date.year();
}
}, {
key: "monthValue",
value: function monthValue() {
return this._date.monthValue();
}
}, {
key: "month",
value: function month() {
return this._date.month();
}
}, {
key: "dayOfMonth",
value: function dayOfMonth() {
return this._date.dayOfMonth();
}
}, {
key: "dayOfYear",
value: function dayOfYear() {
return this._date.dayOfYear();
}
}, {
key: "dayOfWeek",
value: function dayOfWeek() {
return this._date.dayOfWeek();
}
}, {
key: "hour",
value: function hour() {
return this._time.hour();
}
}, {
key: "minute",
value: function minute() {
return this._time.minute();
}
}, {
key: "second",
value: function second() {
return this._time.second();
}
}, {
key: "nano",
value: function nano() {
return this._time.nano();
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
requireNonNull(adjuster, "adjuster");
if (adjuster instanceof LocalDate) {
return this._withDateTime(adjuster, this._time);
} else if (adjuster instanceof LocalTime) {
return this._withDateTime(this._date, adjuster);
} else if (adjuster instanceof LocalDateTime2) {
return adjuster;
}
return _get(_getPrototypeOf(LocalDateTime2.prototype), "_withAdjuster", this).call(this, adjuster);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
if (field.isTimeBased()) {
return this._withDateTime(this._date, this._time.with(field, newValue));
} else {
return this._withDateTime(this._date.with(field, newValue), this._time);
}
}
return field.adjustInto(this, newValue);
}
}, {
key: "withYear",
value: function withYear(year) {
return this._withDateTime(this._date.withYear(year), this._time);
}
}, {
key: "withMonth",
value: function withMonth(month) {
return this._withDateTime(this._date.withMonth(month), this._time);
}
}, {
key: "withDayOfMonth",
value: function withDayOfMonth(dayOfMonth) {
return this._withDateTime(this._date.withDayOfMonth(dayOfMonth), this._time);
}
}, {
key: "withDayOfYear",
value: function withDayOfYear(dayOfYear) {
return this._withDateTime(this._date.withDayOfYear(dayOfYear), this._time);
}
}, {
key: "withHour",
value: function withHour(hour) {
var newTime = this._time.withHour(hour);
return this._withDateTime(this._date, newTime);
}
}, {
key: "withMinute",
value: function withMinute(minute) {
var newTime = this._time.withMinute(minute);
return this._withDateTime(this._date, newTime);
}
}, {
key: "withSecond",
value: function withSecond(second) {
var newTime = this._time.withSecond(second);
return this._withDateTime(this._date, newTime);
}
}, {
key: "withNano",
value: function withNano(nanoOfSecond) {
var newTime = this._time.withNano(nanoOfSecond);
return this._withDateTime(this._date, newTime);
}
}, {
key: "truncatedTo",
value: function truncatedTo(unit) {
return this._withDateTime(this._date, this._time.truncatedTo(unit));
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
requireNonNull(unit, "unit");
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.NANOS:
return this.plusNanos(amountToAdd);
case ChronoUnit.MICROS:
return this.plusDays(MathUtil.intDiv(amountToAdd, LocalTime.MICROS_PER_DAY)).plusNanos(MathUtil.intMod(amountToAdd, LocalTime.MICROS_PER_DAY) * 1e3);
case ChronoUnit.MILLIS:
return this.plusDays(MathUtil.intDiv(amountToAdd, LocalTime.MILLIS_PER_DAY)).plusNanos(MathUtil.intMod(amountToAdd, LocalTime.MILLIS_PER_DAY) * 1e6);
case ChronoUnit.SECONDS:
return this.plusSeconds(amountToAdd);
case ChronoUnit.MINUTES:
return this.plusMinutes(amountToAdd);
case ChronoUnit.HOURS:
return this.plusHours(amountToAdd);
case ChronoUnit.HALF_DAYS:
return this.plusDays(MathUtil.intDiv(amountToAdd, 256)).plusHours(MathUtil.intMod(amountToAdd, 256) * 12);
}
return this._withDateTime(this._date.plus(amountToAdd, unit), this._time);
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusYears",
value: function plusYears(years) {
var newDate = this._date.plusYears(years);
return this._withDateTime(newDate, this._time);
}
}, {
key: "plusMonths",
value: function plusMonths(months) {
var newDate = this._date.plusMonths(months);
return this._withDateTime(newDate, this._time);
}
}, {
key: "plusWeeks",
value: function plusWeeks(weeks) {
var newDate = this._date.plusWeeks(weeks);
return this._withDateTime(newDate, this._time);
}
}, {
key: "plusDays",
value: function plusDays(days) {
var newDate = this._date.plusDays(days);
return this._withDateTime(newDate, this._time);
}
}, {
key: "plusHours",
value: function plusHours(hours) {
return this._plusWithOverflow(this._date, hours, 0, 0, 0, 1);
}
}, {
key: "plusMinutes",
value: function plusMinutes(minutes) {
return this._plusWithOverflow(this._date, 0, minutes, 0, 0, 1);
}
}, {
key: "plusSeconds",
value: function plusSeconds(seconds) {
return this._plusWithOverflow(this._date, 0, 0, seconds, 0, 1);
}
}, {
key: "plusNanos",
value: function plusNanos(nanos) {
return this._plusWithOverflow(this._date, 0, 0, 0, nanos, 1);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
requireNonNull(unit, "unit");
return this._plusUnit(-1 * amountToSubtract, unit);
}
}, {
key: "minusYears",
value: function minusYears(years) {
return this.plusYears(-1 * years);
}
}, {
key: "minusMonths",
value: function minusMonths(months) {
return this.plusMonths(-1 * months);
}
}, {
key: "minusWeeks",
value: function minusWeeks(weeks) {
return this.plusWeeks(-1 * weeks);
}
}, {
key: "minusDays",
value: function minusDays(days) {
return this.plusDays(-1 * days);
}
}, {
key: "minusHours",
value: function minusHours(hours) {
return this._plusWithOverflow(this._date, hours, 0, 0, 0, -1);
}
}, {
key: "minusMinutes",
value: function minusMinutes(minutes) {
return this._plusWithOverflow(this._date, 0, minutes, 0, 0, -1);
}
}, {
key: "minusSeconds",
value: function minusSeconds(seconds) {
return this._plusWithOverflow(this._date, 0, 0, seconds, 0, -1);
}
}, {
key: "minusNanos",
value: function minusNanos(nanos) {
return this._plusWithOverflow(this._date, 0, 0, 0, nanos, -1);
}
}, {
key: "_plusWithOverflow",
value: function _plusWithOverflow(newDate, hours, minutes, seconds, nanos, sign) {
if (hours === 0 && minutes === 0 && seconds === 0 && nanos === 0) {
return this._withDateTime(newDate, this._time);
}
var totDays = MathUtil.intDiv(nanos, LocalTime.NANOS_PER_DAY) + MathUtil.intDiv(seconds, LocalTime.SECONDS_PER_DAY) + MathUtil.intDiv(minutes, LocalTime.MINUTES_PER_DAY) + MathUtil.intDiv(hours, LocalTime.HOURS_PER_DAY);
totDays *= sign;
var totNanos = MathUtil.intMod(nanos, LocalTime.NANOS_PER_DAY) + MathUtil.intMod(seconds, LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + MathUtil.intMod(minutes, LocalTime.MINUTES_PER_DAY) * LocalTime.NANOS_PER_MINUTE + MathUtil.intMod(hours, LocalTime.HOURS_PER_DAY) * LocalTime.NANOS_PER_HOUR;
var curNoD = this._time.toNanoOfDay();
totNanos = totNanos * sign + curNoD;
totDays += MathUtil.floorDiv(totNanos, LocalTime.NANOS_PER_DAY);
var newNoD = MathUtil.floorMod(totNanos, LocalTime.NANOS_PER_DAY);
var newTime = newNoD === curNoD ? this._time : LocalTime.ofNanoOfDay(newNoD);
return this._withDateTime(newDate.plusDays(totDays), newTime);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.localDate()) {
return this.toLocalDate();
}
return _get(_getPrototypeOf(LocalDateTime2.prototype), "query", this).call(this, _query);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return _get(_getPrototypeOf(LocalDateTime2.prototype), "adjustInto", this).call(this, temporal);
}
}, {
key: "until",
value: function until(endExclusive, unit) {
requireNonNull(endExclusive, "endExclusive");
requireNonNull(unit, "unit");
var end = LocalDateTime2.from(endExclusive);
if (unit instanceof ChronoUnit) {
if (unit.isTimeBased()) {
var daysUntil = this._date.daysUntil(end._date);
var timeUntil = end._time.toNanoOfDay() - this._time.toNanoOfDay();
if (daysUntil > 0 && timeUntil < 0) {
daysUntil--;
timeUntil += LocalTime.NANOS_PER_DAY;
} else if (daysUntil < 0 && timeUntil > 0) {
daysUntil++;
timeUntil -= LocalTime.NANOS_PER_DAY;
}
var amount = daysUntil;
switch (unit) {
case ChronoUnit.NANOS:
amount = MathUtil.safeMultiply(amount, LocalTime.NANOS_PER_DAY);
return MathUtil.safeAdd(amount, timeUntil);
case ChronoUnit.MICROS:
amount = MathUtil.safeMultiply(amount, LocalTime.MICROS_PER_DAY);
return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, 1e3));
case ChronoUnit.MILLIS:
amount = MathUtil.safeMultiply(amount, LocalTime.MILLIS_PER_DAY);
return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, 1e6));
case ChronoUnit.SECONDS:
amount = MathUtil.safeMultiply(amount, LocalTime.SECONDS_PER_DAY);
return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, LocalTime.NANOS_PER_SECOND));
case ChronoUnit.MINUTES:
amount = MathUtil.safeMultiply(amount, LocalTime.MINUTES_PER_DAY);
return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, LocalTime.NANOS_PER_MINUTE));
case ChronoUnit.HOURS:
amount = MathUtil.safeMultiply(amount, LocalTime.HOURS_PER_DAY);
return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, LocalTime.NANOS_PER_HOUR));
case ChronoUnit.HALF_DAYS:
amount = MathUtil.safeMultiply(amount, 2);
return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, LocalTime.NANOS_PER_HOUR * 12));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
var endDate = end._date;
var endTime = end._time;
if (endDate.isAfter(this._date) && endTime.isBefore(this._time)) {
endDate = endDate.minusDays(1);
} else if (endDate.isBefore(this._date) && endTime.isAfter(this._time)) {
endDate = endDate.plusDays(1);
}
return this._date.until(endDate, unit);
}
return unit.between(this, end);
}
}, {
key: "atOffset",
value: function atOffset(offset) {
return OffsetDateTime.of(this, offset);
}
}, {
key: "atZone",
value: function atZone(zone) {
return ZonedDateTime.of(this, zone);
}
}, {
key: "toLocalDate",
value: function toLocalDate() {
return this._date;
}
}, {
key: "toLocalTime",
value: function toLocalTime() {
return this._time;
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, LocalDateTime2, "other");
return this._compareTo0(other);
}
}, {
key: "_compareTo0",
value: function _compareTo0(other) {
var cmp = this._date.compareTo(other.toLocalDate());
if (cmp === 0) {
cmp = this._time.compareTo(other.toLocalTime());
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
return this.compareTo(other) > 0;
}
}, {
key: "isBefore",
value: function isBefore(other) {
return this.compareTo(other) < 0;
}
}, {
key: "isEqual",
value: function isEqual(other) {
return this.compareTo(other) === 0;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof LocalDateTime2) {
return this._date.equals(other._date) && this._time.equals(other._time);
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._date.hashCode() ^ this._time.hashCode();
}
}, {
key: "toString",
value: function toString() {
return "".concat(this._date.toString(), "T").concat(this._time.toString());
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
return formatter.format(this);
}
}], [{
key: "now",
value: function now(clockOrZone) {
if (clockOrZone == null) {
return LocalDateTime2._now(Clock.systemDefaultZone());
} else if (clockOrZone instanceof Clock) {
return LocalDateTime2._now(clockOrZone);
} else {
return LocalDateTime2._now(Clock.system(clockOrZone));
}
}
}, {
key: "_now",
value: function _now(clock) {
requireNonNull(clock, "clock");
return LocalDateTime2.ofInstant(clock.instant(), clock.zone());
}
}, {
key: "_ofEpochMillis",
value: function _ofEpochMillis(epochMilli, offset) {
var localSecond = MathUtil.floorDiv(epochMilli, 1e3) + offset.totalSeconds();
var localEpochDay = MathUtil.floorDiv(localSecond, LocalTime.SECONDS_PER_DAY);
var secsOfDay = MathUtil.floorMod(localSecond, LocalTime.SECONDS_PER_DAY);
var nanoOfSecond = MathUtil.floorMod(epochMilli, 1e3) * 1e6;
var date = LocalDate.ofEpochDay(localEpochDay);
var time = LocalTime.ofSecondOfDay(secsOfDay, nanoOfSecond);
return new LocalDateTime2(date, time);
}
}, {
key: "of",
value: function of() {
if (arguments.length <= 2) {
return LocalDateTime2.ofDateAndTime.apply(this, arguments);
} else {
return LocalDateTime2.ofNumbers.apply(this, arguments);
}
}
}, {
key: "ofNumbers",
value: function ofNumbers(year, month, dayOfMonth) {
var hour = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
var minute = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0;
var second = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 0;
var nanoOfSecond = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 0;
var date = LocalDate.of(year, month, dayOfMonth);
var time = LocalTime.of(hour, minute, second, nanoOfSecond);
return new LocalDateTime2(date, time);
}
}, {
key: "ofDateAndTime",
value: function ofDateAndTime(date, time) {
requireNonNull(date, "date");
requireNonNull(time, "time");
return new LocalDateTime2(date, time);
}
}, {
key: "ofInstant",
value: function ofInstant(instant) {
var zone = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZoneId.systemDefault();
requireNonNull(instant, "instant");
requireInstance(instant, Instant, "instant");
requireNonNull(zone, "zone");
var offset = zone.rules().offset(instant);
return LocalDateTime2.ofEpochSecond(instant.epochSecond(), instant.nano(), offset);
}
}, {
key: "ofEpochSecond",
value: function ofEpochSecond() {
var epochSecond = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
var nanoOfSecond = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var offset = arguments.length > 2 ? arguments[2] : void 0;
if (arguments.length === 2 && nanoOfSecond instanceof ZoneOffset) {
offset = nanoOfSecond;
nanoOfSecond = 0;
}
requireNonNull(offset, "offset");
var localSecond = epochSecond + offset.totalSeconds();
var localEpochDay = MathUtil.floorDiv(localSecond, LocalTime.SECONDS_PER_DAY);
var secsOfDay = MathUtil.floorMod(localSecond, LocalTime.SECONDS_PER_DAY);
var date = LocalDate.ofEpochDay(localEpochDay);
var time = LocalTime.ofSecondOfDay(secsOfDay, nanoOfSecond);
return new LocalDateTime2(date, time);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
if (temporal instanceof LocalDateTime2) {
return temporal;
} else if (temporal instanceof ZonedDateTime) {
return temporal.toLocalDateTime();
}
try {
var date = LocalDate.from(temporal);
var time = LocalTime.from(temporal);
return new LocalDateTime2(date, time);
} catch (ex) {
throw new DateTimeException("Unable to obtain LocalDateTime TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""));
}
}
}, {
key: "parse",
value: function parse2(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DateTimeFormatter.ISO_LOCAL_DATE_TIME;
requireNonNull(formatter, "formatter");
return formatter.parse(text, LocalDateTime2.FROM);
}
}]);
return LocalDateTime2;
}(ChronoLocalDateTime);
function _init$j() {
LocalDateTime.MIN = LocalDateTime.of(LocalDate.MIN, LocalTime.MIN);
LocalDateTime.MAX = LocalDateTime.of(LocalDate.MAX, LocalTime.MAX);
LocalDateTime.FROM = createTemporalQuery("LocalDateTime.FROM", function(temporal) {
return LocalDateTime.from(temporal);
});
}
var LocalTime = function(_Temporal) {
_inherits(LocalTime2, _Temporal);
var _super = _createSuper(LocalTime2);
function LocalTime2() {
var _this;
var hour = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
var minute = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var second = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
var nanoOfSecond = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
_classCallCheck(this, LocalTime2);
_this = _super.call(this);
var _hour = MathUtil.safeToInt(hour);
var _minute = MathUtil.safeToInt(minute);
var _second = MathUtil.safeToInt(second);
var _nanoOfSecond = MathUtil.safeToInt(nanoOfSecond);
LocalTime2._validate(_hour, _minute, _second, _nanoOfSecond);
if (_minute === 0 && _second === 0 && _nanoOfSecond === 0) {
if (!LocalTime2.HOURS[_hour]) {
_this._hour = _hour;
_this._minute = _minute;
_this._second = _second;
_this._nano = _nanoOfSecond;
LocalTime2.HOURS[_hour] = _assertThisInitialized(_this);
}
return _possibleConstructorReturn(_this, LocalTime2.HOURS[_hour]);
}
_this._hour = _hour;
_this._minute = _minute;
_this._second = _second;
_this._nano = _nanoOfSecond;
return _this;
}
_createClass(LocalTime2, [{
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return fieldOrUnit.isTimeBased();
} else if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isTimeBased();
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
requireNonNull(field);
return _get(_getPrototypeOf(LocalTime2.prototype), "range", this).call(this, field);
}
}, {
key: "get",
value: function get(field) {
return this.getLong(field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
return this._get0(field);
}
return field.getFrom(this);
}
}, {
key: "_get0",
value: function _get0(field) {
switch (field) {
case ChronoField.NANO_OF_SECOND:
return this._nano;
case ChronoField.NANO_OF_DAY:
return this.toNanoOfDay();
case ChronoField.MICRO_OF_SECOND:
return MathUtil.intDiv(this._nano, 1e3);
case ChronoField.MICRO_OF_DAY:
return MathUtil.intDiv(this.toNanoOfDay(), 1e3);
case ChronoField.MILLI_OF_SECOND:
return MathUtil.intDiv(this._nano, 1e6);
case ChronoField.MILLI_OF_DAY:
return MathUtil.intDiv(this.toNanoOfDay(), 1e6);
case ChronoField.SECOND_OF_MINUTE:
return this._second;
case ChronoField.SECOND_OF_DAY:
return this.toSecondOfDay();
case ChronoField.MINUTE_OF_HOUR:
return this._minute;
case ChronoField.MINUTE_OF_DAY:
return this._hour * 60 + this._minute;
case ChronoField.HOUR_OF_AMPM:
return MathUtil.intMod(this._hour, 12);
case ChronoField.CLOCK_HOUR_OF_AMPM: {
var ham = MathUtil.intMod(this._hour, 12);
return ham % 12 === 0 ? 12 : ham;
}
case ChronoField.HOUR_OF_DAY:
return this._hour;
case ChronoField.CLOCK_HOUR_OF_DAY:
return this._hour === 0 ? 24 : this._hour;
case ChronoField.AMPM_OF_DAY:
return MathUtil.intDiv(this._hour, 12);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
}, {
key: "hour",
value: function hour() {
return this._hour;
}
}, {
key: "minute",
value: function minute() {
return this._minute;
}
}, {
key: "second",
value: function second() {
return this._second;
}
}, {
key: "nano",
value: function nano() {
return this._nano;
}
}, {
key: "_withAdjuster",
value: function _withAdjuster(adjuster) {
requireNonNull(adjuster, "adjuster");
if (adjuster instanceof LocalTime2) {
return adjuster;
}
return _get(_getPrototypeOf(LocalTime2.prototype), "_withAdjuster", this).call(this, adjuster);
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field, "field");
requireInstance(field, TemporalField, "field");
if (field instanceof ChronoField) {
field.checkValidValue(newValue);
switch (field) {
case ChronoField.NANO_OF_SECOND:
return this.withNano(newValue);
case ChronoField.NANO_OF_DAY:
return LocalTime2.ofNanoOfDay(newValue);
case ChronoField.MICRO_OF_SECOND:
return this.withNano(newValue * 1e3);
case ChronoField.MICRO_OF_DAY:
return LocalTime2.ofNanoOfDay(newValue * 1e3);
case ChronoField.MILLI_OF_SECOND:
return this.withNano(newValue * 1e6);
case ChronoField.MILLI_OF_DAY:
return LocalTime2.ofNanoOfDay(newValue * 1e6);
case ChronoField.SECOND_OF_MINUTE:
return this.withSecond(newValue);
case ChronoField.SECOND_OF_DAY:
return this.plusSeconds(newValue - this.toSecondOfDay());
case ChronoField.MINUTE_OF_HOUR:
return this.withMinute(newValue);
case ChronoField.MINUTE_OF_DAY:
return this.plusMinutes(newValue - (this._hour * 60 + this._minute));
case ChronoField.HOUR_OF_AMPM:
return this.plusHours(newValue - MathUtil.intMod(this._hour, 12));
case ChronoField.CLOCK_HOUR_OF_AMPM:
return this.plusHours((newValue === 12 ? 0 : newValue) - MathUtil.intMod(this._hour, 12));
case ChronoField.HOUR_OF_DAY:
return this.withHour(newValue);
case ChronoField.CLOCK_HOUR_OF_DAY:
return this.withHour(newValue === 24 ? 0 : newValue);
case ChronoField.AMPM_OF_DAY:
return this.plusHours((newValue - MathUtil.intDiv(this._hour, 12)) * 12);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.adjustInto(this, newValue);
}
}, {
key: "withHour",
value: function withHour() {
var hour = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
if (this._hour === hour) {
return this;
}
return new LocalTime2(hour, this._minute, this._second, this._nano);
}
}, {
key: "withMinute",
value: function withMinute() {
var minute = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
if (this._minute === minute) {
return this;
}
return new LocalTime2(this._hour, minute, this._second, this._nano);
}
}, {
key: "withSecond",
value: function withSecond() {
var second = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
if (this._second === second) {
return this;
}
return new LocalTime2(this._hour, this._minute, second, this._nano);
}
}, {
key: "withNano",
value: function withNano() {
var nanoOfSecond = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
if (this._nano === nanoOfSecond) {
return this;
}
return new LocalTime2(this._hour, this._minute, this._second, nanoOfSecond);
}
}, {
key: "truncatedTo",
value: function truncatedTo(unit) {
requireNonNull(unit, "unit");
if (unit === ChronoUnit.NANOS) {
return this;
}
var unitDur = unit.duration();
if (unitDur.seconds() > LocalTime2.SECONDS_PER_DAY) {
throw new DateTimeException("Unit is too large to be used for truncation");
}
var dur = unitDur.toNanos();
if (MathUtil.intMod(LocalTime2.NANOS_PER_DAY, dur) !== 0) {
throw new DateTimeException("Unit must divide into a standard day without remainder");
}
var nod = this.toNanoOfDay();
return LocalTime2.ofNanoOfDay(MathUtil.intDiv(nod, dur) * dur);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
requireNonNull(unit, "unit");
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.NANOS:
return this.plusNanos(amountToAdd);
case ChronoUnit.MICROS:
return this.plusNanos(MathUtil.intMod(amountToAdd, LocalTime2.MICROS_PER_DAY) * 1e3);
case ChronoUnit.MILLIS:
return this.plusNanos(MathUtil.intMod(amountToAdd, LocalTime2.MILLIS_PER_DAY) * 1e6);
case ChronoUnit.SECONDS:
return this.plusSeconds(amountToAdd);
case ChronoUnit.MINUTES:
return this.plusMinutes(amountToAdd);
case ChronoUnit.HOURS:
return this.plusHours(amountToAdd);
case ChronoUnit.HALF_DAYS:
return this.plusHours(MathUtil.intMod(amountToAdd, 2) * 12);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusHours",
value: function plusHours(hoursToAdd) {
if (hoursToAdd === 0) {
return this;
}
var newHour = MathUtil.intMod(MathUtil.intMod(hoursToAdd, LocalTime2.HOURS_PER_DAY) + this._hour + LocalTime2.HOURS_PER_DAY, LocalTime2.HOURS_PER_DAY);
return new LocalTime2(newHour, this._minute, this._second, this._nano);
}
}, {
key: "plusMinutes",
value: function plusMinutes(minutesToAdd) {
if (minutesToAdd === 0) {
return this;
}
var mofd = this._hour * LocalTime2.MINUTES_PER_HOUR + this._minute;
var newMofd = MathUtil.intMod(MathUtil.intMod(minutesToAdd, LocalTime2.MINUTES_PER_DAY) + mofd + LocalTime2.MINUTES_PER_DAY, LocalTime2.MINUTES_PER_DAY);
if (mofd === newMofd) {
return this;
}
var newHour = MathUtil.intDiv(newMofd, LocalTime2.MINUTES_PER_HOUR);
var newMinute = MathUtil.intMod(newMofd, LocalTime2.MINUTES_PER_HOUR);
return new LocalTime2(newHour, newMinute, this._second, this._nano);
}
}, {
key: "plusSeconds",
value: function plusSeconds(secondsToAdd) {
if (secondsToAdd === 0) {
return this;
}
var sofd = this._hour * LocalTime2.SECONDS_PER_HOUR + this._minute * LocalTime2.SECONDS_PER_MINUTE + this._second;
var newSofd = MathUtil.intMod(MathUtil.intMod(secondsToAdd, LocalTime2.SECONDS_PER_DAY) + sofd + LocalTime2.SECONDS_PER_DAY, LocalTime2.SECONDS_PER_DAY);
if (sofd === newSofd) {
return this;
}
var newHour = MathUtil.intDiv(newSofd, LocalTime2.SECONDS_PER_HOUR);
var newMinute = MathUtil.intMod(MathUtil.intDiv(newSofd, LocalTime2.SECONDS_PER_MINUTE), LocalTime2.MINUTES_PER_HOUR);
var newSecond = MathUtil.intMod(newSofd, LocalTime2.SECONDS_PER_MINUTE);
return new LocalTime2(newHour, newMinute, newSecond, this._nano);
}
}, {
key: "plusNanos",
value: function plusNanos(nanosToAdd) {
if (nanosToAdd === 0) {
return this;
}
var nofd = this.toNanoOfDay();
var newNofd = MathUtil.intMod(MathUtil.intMod(nanosToAdd, LocalTime2.NANOS_PER_DAY) + nofd + LocalTime2.NANOS_PER_DAY, LocalTime2.NANOS_PER_DAY);
if (nofd === newNofd) {
return this;
}
var newHour = MathUtil.intDiv(newNofd, LocalTime2.NANOS_PER_HOUR);
var newMinute = MathUtil.intMod(MathUtil.intDiv(newNofd, LocalTime2.NANOS_PER_MINUTE), LocalTime2.MINUTES_PER_HOUR);
var newSecond = MathUtil.intMod(MathUtil.intDiv(newNofd, LocalTime2.NANOS_PER_SECOND), LocalTime2.SECONDS_PER_MINUTE);
var newNano = MathUtil.intMod(newNofd, LocalTime2.NANOS_PER_SECOND);
return new LocalTime2(newHour, newMinute, newSecond, newNano);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
requireNonNull(unit, "unit");
return this._plusUnit(-1 * amountToSubtract, unit);
}
}, {
key: "minusHours",
value: function minusHours(hoursToSubtract) {
return this.plusHours(-1 * MathUtil.intMod(hoursToSubtract, LocalTime2.HOURS_PER_DAY));
}
}, {
key: "minusMinutes",
value: function minusMinutes(minutesToSubtract) {
return this.plusMinutes(-1 * MathUtil.intMod(minutesToSubtract, LocalTime2.MINUTES_PER_DAY));
}
}, {
key: "minusSeconds",
value: function minusSeconds(secondsToSubtract) {
return this.plusSeconds(-1 * MathUtil.intMod(secondsToSubtract, LocalTime2.SECONDS_PER_DAY));
}
}, {
key: "minusNanos",
value: function minusNanos(nanosToSubtract) {
return this.plusNanos(-1 * MathUtil.intMod(nanosToSubtract, LocalTime2.NANOS_PER_DAY));
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.precision()) {
return ChronoUnit.NANOS;
} else if (_query === TemporalQueries.localTime()) {
return this;
}
if (_query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.zone() || _query === TemporalQueries.offset() || _query === TemporalQueries.localDate()) {
return null;
}
return _query.queryFrom(this);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
return temporal.with(LocalTime2.NANO_OF_DAY, this.toNanoOfDay());
}
}, {
key: "until",
value: function until(endExclusive, unit) {
requireNonNull(endExclusive, "endExclusive");
requireNonNull(unit, "unit");
var end = LocalTime2.from(endExclusive);
if (unit instanceof ChronoUnit) {
var nanosUntil = end.toNanoOfDay() - this.toNanoOfDay();
switch (unit) {
case ChronoUnit.NANOS:
return nanosUntil;
case ChronoUnit.MICROS:
return MathUtil.intDiv(nanosUntil, 1e3);
case ChronoUnit.MILLIS:
return MathUtil.intDiv(nanosUntil, 1e6);
case ChronoUnit.SECONDS:
return MathUtil.intDiv(nanosUntil, LocalTime2.NANOS_PER_SECOND);
case ChronoUnit.MINUTES:
return MathUtil.intDiv(nanosUntil, LocalTime2.NANOS_PER_MINUTE);
case ChronoUnit.HOURS:
return MathUtil.intDiv(nanosUntil, LocalTime2.NANOS_PER_HOUR);
case ChronoUnit.HALF_DAYS:
return MathUtil.intDiv(nanosUntil, 12 * LocalTime2.NANOS_PER_HOUR);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.between(this, end);
}
}, {
key: "atDate",
value: function atDate(date) {
return LocalDateTime.of(date, this);
}
}, {
key: "atOffset",
value: function atOffset(offset) {
return OffsetTime.of(this, offset);
}
}, {
key: "toSecondOfDay",
value: function toSecondOfDay() {
var total = this._hour * LocalTime2.SECONDS_PER_HOUR;
total += this._minute * LocalTime2.SECONDS_PER_MINUTE;
total += this._second;
return total;
}
}, {
key: "toNanoOfDay",
value: function toNanoOfDay() {
var total = this._hour * LocalTime2.NANOS_PER_HOUR;
total += this._minute * LocalTime2.NANOS_PER_MINUTE;
total += this._second * LocalTime2.NANOS_PER_SECOND;
total += this._nano;
return total;
}
}, {
key: "compareTo",
value: function compareTo(other) {
requireNonNull(other, "other");
requireInstance(other, LocalTime2, "other");
var cmp = MathUtil.compareNumbers(this._hour, other._hour);
if (cmp === 0) {
cmp = MathUtil.compareNumbers(this._minute, other._minute);
if (cmp === 0) {
cmp = MathUtil.compareNumbers(this._second, other._second);
if (cmp === 0) {
cmp = MathUtil.compareNumbers(this._nano, other._nano);
}
}
}
return cmp;
}
}, {
key: "isAfter",
value: function isAfter(other) {
return this.compareTo(other) > 0;
}
}, {
key: "isBefore",
value: function isBefore(other) {
return this.compareTo(other) < 0;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof LocalTime2) {
return this._hour === other._hour && this._minute === other._minute && this._second === other._second && this._nano === other._nano;
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
var nod = this.toNanoOfDay();
return MathUtil.hash(nod);
}
}, {
key: "toString",
value: function toString() {
var buf = "";
var hourValue = this._hour;
var minuteValue = this._minute;
var secondValue = this._second;
var nanoValue = this._nano;
buf += hourValue < 10 ? "0" : "";
buf += hourValue;
buf += minuteValue < 10 ? ":0" : ":";
buf += minuteValue;
if (secondValue > 0 || nanoValue > 0) {
buf += secondValue < 10 ? ":0" : ":";
buf += secondValue;
if (nanoValue > 0) {
buf += ".";
if (MathUtil.intMod(nanoValue, 1e6) === 0) {
buf += "".concat(MathUtil.intDiv(nanoValue, 1e6) + 1e3).substring(1);
} else if (MathUtil.intMod(nanoValue, 1e3) === 0) {
buf += "".concat(MathUtil.intDiv(nanoValue, 1e3) + 1e6).substring(1);
} else {
buf += "".concat(nanoValue + 1e9).substring(1);
}
}
}
return buf;
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}, {
key: "format",
value: function format(formatter) {
requireNonNull(formatter, "formatter");
return formatter.format(this);
}
}], [{
key: "now",
value: function now(clockOrZone) {
if (clockOrZone == null) {
return LocalTime2._now(Clock.systemDefaultZone());
} else if (clockOrZone instanceof Clock) {
return LocalTime2._now(clockOrZone);
} else {
return LocalTime2._now(Clock.system(clockOrZone));
}
}
}, {
key: "_now",
value: function _now() {
var clock = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Clock.systemDefaultZone();
requireNonNull(clock, "clock");
return LocalTime2.ofInstant(clock.instant(), clock.zone());
}
}, {
key: "ofInstant",
value: function ofInstant(instant) {
var zone = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZoneId.systemDefault();
var offset = zone.rules().offset(instant);
var secsOfDay = MathUtil.intMod(instant.epochSecond(), LocalTime2.SECONDS_PER_DAY);
secsOfDay = MathUtil.intMod(secsOfDay + offset.totalSeconds(), LocalTime2.SECONDS_PER_DAY);
if (secsOfDay < 0) {
secsOfDay += LocalTime2.SECONDS_PER_DAY;
}
return LocalTime2.ofSecondOfDay(secsOfDay, instant.nano());
}
}, {
key: "of",
value: function of(hour, minute, second, nanoOfSecond) {
return new LocalTime2(hour, minute, second, nanoOfSecond);
}
}, {
key: "ofSecondOfDay",
value: function ofSecondOfDay() {
var secondOfDay = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
var nanoOfSecond = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
ChronoField.SECOND_OF_DAY.checkValidValue(secondOfDay);
ChronoField.NANO_OF_SECOND.checkValidValue(nanoOfSecond);
var hours = MathUtil.intDiv(secondOfDay, LocalTime2.SECONDS_PER_HOUR);
secondOfDay -= hours * LocalTime2.SECONDS_PER_HOUR;
var minutes = MathUtil.intDiv(secondOfDay, LocalTime2.SECONDS_PER_MINUTE);
secondOfDay -= minutes * LocalTime2.SECONDS_PER_MINUTE;
return new LocalTime2(hours, minutes, secondOfDay, nanoOfSecond);
}
}, {
key: "ofNanoOfDay",
value: function ofNanoOfDay() {
var nanoOfDay = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
ChronoField.NANO_OF_DAY.checkValidValue(nanoOfDay);
var hours = MathUtil.intDiv(nanoOfDay, LocalTime2.NANOS_PER_HOUR);
nanoOfDay -= hours * LocalTime2.NANOS_PER_HOUR;
var minutes = MathUtil.intDiv(nanoOfDay, LocalTime2.NANOS_PER_MINUTE);
nanoOfDay -= minutes * LocalTime2.NANOS_PER_MINUTE;
var seconds = MathUtil.intDiv(nanoOfDay, LocalTime2.NANOS_PER_SECOND);
nanoOfDay -= seconds * LocalTime2.NANOS_PER_SECOND;
return new LocalTime2(hours, minutes, seconds, nanoOfDay);
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
var time = temporal.query(TemporalQueries.localTime());
if (time == null) {
throw new DateTimeException("Unable to obtain LocalTime TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""));
}
return time;
}
}, {
key: "parse",
value: function parse2(text) {
var formatter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : DateTimeFormatter.ISO_LOCAL_TIME;
requireNonNull(formatter, "formatter");
return formatter.parse(text, LocalTime2.FROM);
}
}, {
key: "_validate",
value: function _validate(hour, minute, second, nanoOfSecond) {
ChronoField.HOUR_OF_DAY.checkValidValue(hour);
ChronoField.MINUTE_OF_HOUR.checkValidValue(minute);
ChronoField.SECOND_OF_MINUTE.checkValidValue(second);
ChronoField.NANO_OF_SECOND.checkValidValue(nanoOfSecond);
}
}]);
return LocalTime2;
}(Temporal);
function _init$k() {
LocalTime.HOURS = [];
for (var hour = 0; hour < 24; hour++) {
LocalTime.of(hour, 0, 0, 0);
}
LocalTime.MIN = LocalTime.HOURS[0];
LocalTime.MAX = new LocalTime(23, 59, 59, 999999999);
LocalTime.MIDNIGHT = LocalTime.HOURS[0];
LocalTime.NOON = LocalTime.HOURS[12];
LocalTime.FROM = createTemporalQuery("LocalTime.FROM", function(temporal) {
return LocalTime.from(temporal);
});
}
LocalTime.HOURS_PER_DAY = 24;
LocalTime.MINUTES_PER_HOUR = 60;
LocalTime.MINUTES_PER_DAY = LocalTime.MINUTES_PER_HOUR * LocalTime.HOURS_PER_DAY;
LocalTime.SECONDS_PER_MINUTE = 60;
LocalTime.SECONDS_PER_HOUR = LocalTime.SECONDS_PER_MINUTE * LocalTime.MINUTES_PER_HOUR;
LocalTime.SECONDS_PER_DAY = LocalTime.SECONDS_PER_HOUR * LocalTime.HOURS_PER_DAY;
LocalTime.MILLIS_PER_DAY = LocalTime.SECONDS_PER_DAY * 1e3;
LocalTime.MICROS_PER_DAY = LocalTime.SECONDS_PER_DAY * 1e6;
LocalTime.NANOS_PER_SECOND = 1e9;
LocalTime.NANOS_PER_MINUTE = LocalTime.NANOS_PER_SECOND * LocalTime.SECONDS_PER_MINUTE;
LocalTime.NANOS_PER_HOUR = LocalTime.NANOS_PER_MINUTE * LocalTime.MINUTES_PER_HOUR;
LocalTime.NANOS_PER_DAY = LocalTime.NANOS_PER_HOUR * LocalTime.HOURS_PER_DAY;
var NANOS_PER_MILLI = 1e6;
var Instant = function(_Temporal) {
_inherits(Instant2, _Temporal);
var _super = _createSuper(Instant2);
function Instant2(seconds, nanoOfSecond) {
var _this;
_classCallCheck(this, Instant2);
_this = _super.call(this);
Instant2._validate(seconds, nanoOfSecond);
_this._seconds = MathUtil.safeToInt(seconds);
_this._nanos = MathUtil.safeToInt(nanoOfSecond);
return _this;
}
_createClass(Instant2, [{
key: "isSupported",
value: function isSupported(fieldOrUnit) {
if (fieldOrUnit instanceof ChronoField) {
return fieldOrUnit === ChronoField.INSTANT_SECONDS || fieldOrUnit === ChronoField.NANO_OF_SECOND || fieldOrUnit === ChronoField.MICRO_OF_SECOND || fieldOrUnit === ChronoField.MILLI_OF_SECOND;
}
if (fieldOrUnit instanceof ChronoUnit) {
return fieldOrUnit.isTimeBased() || fieldOrUnit === ChronoUnit.DAYS;
}
return fieldOrUnit != null && fieldOrUnit.isSupportedBy(this);
}
}, {
key: "range",
value: function range(field) {
return _get(_getPrototypeOf(Instant2.prototype), "range", this).call(this, field);
}
}, {
key: "get",
value: function get(field) {
return this.getLong(field);
}
}, {
key: "getLong",
value: function getLong(field) {
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.NANO_OF_SECOND:
return this._nanos;
case ChronoField.MICRO_OF_SECOND:
return MathUtil.intDiv(this._nanos, 1e3);
case ChronoField.MILLI_OF_SECOND:
return MathUtil.intDiv(this._nanos, NANOS_PER_MILLI);
case ChronoField.INSTANT_SECONDS:
return this._seconds;
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "epochSecond",
value: function epochSecond() {
return this._seconds;
}
}, {
key: "nano",
value: function nano() {
return this._nanos;
}
}, {
key: "_withField",
value: function _withField(field, newValue) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
field.checkValidValue(newValue);
switch (field) {
case ChronoField.MILLI_OF_SECOND: {
var nval = newValue * NANOS_PER_MILLI;
return nval !== this._nanos ? Instant2._create(this._seconds, nval) : this;
}
case ChronoField.MICRO_OF_SECOND: {
var _nval = newValue * 1e3;
return _nval !== this._nanos ? Instant2._create(this._seconds, _nval) : this;
}
case ChronoField.NANO_OF_SECOND:
return newValue !== this._nanos ? Instant2._create(this._seconds, newValue) : this;
case ChronoField.INSTANT_SECONDS:
return newValue !== this._seconds ? Instant2._create(newValue, this._nanos) : this;
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.adjustInto(this, newValue);
}
}, {
key: "truncatedTo",
value: function truncatedTo(unit) {
requireNonNull(unit, "unit");
if (unit === ChronoUnit.NANOS) {
return this;
}
var unitDur = unit.duration();
if (unitDur.seconds() > LocalTime.SECONDS_PER_DAY) {
throw new DateTimeException("Unit is too large to be used for truncation");
}
var dur = unitDur.toNanos();
if (MathUtil.intMod(LocalTime.NANOS_PER_DAY, dur) !== 0) {
throw new DateTimeException("Unit must divide into a standard day without remainder");
}
var nod = MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_DAY) * LocalTime.NANOS_PER_SECOND + this._nanos;
var result = MathUtil.intDiv(nod, dur) * dur;
return this.plusNanos(result - nod);
}
}, {
key: "_plusUnit",
value: function _plusUnit(amountToAdd, unit) {
requireNonNull(amountToAdd, "amountToAdd");
requireNonNull(unit, "unit");
requireInstance(unit, TemporalUnit);
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.NANOS:
return this.plusNanos(amountToAdd);
case ChronoUnit.MICROS:
return this._plus(MathUtil.intDiv(amountToAdd, 1e6), MathUtil.intMod(amountToAdd, 1e6) * 1e3);
case ChronoUnit.MILLIS:
return this.plusMillis(amountToAdd);
case ChronoUnit.SECONDS:
return this.plusSeconds(amountToAdd);
case ChronoUnit.MINUTES:
return this.plusSeconds(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_MINUTE));
case ChronoUnit.HOURS:
return this.plusSeconds(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_HOUR));
case ChronoUnit.HALF_DAYS:
return this.plusSeconds(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_DAY / 2));
case ChronoUnit.DAYS:
return this.plusSeconds(MathUtil.safeMultiply(amountToAdd, LocalTime.SECONDS_PER_DAY));
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.addTo(this, amountToAdd);
}
}, {
key: "plusSeconds",
value: function plusSeconds(secondsToAdd) {
return this._plus(secondsToAdd, 0);
}
}, {
key: "plusMillis",
value: function plusMillis(millisToAdd) {
return this._plus(MathUtil.intDiv(millisToAdd, 1e3), MathUtil.intMod(millisToAdd, 1e3) * NANOS_PER_MILLI);
}
}, {
key: "plusNanos",
value: function plusNanos(nanosToAdd) {
return this._plus(0, nanosToAdd);
}
}, {
key: "_plus",
value: function _plus(secondsToAdd, nanosToAdd) {
if (secondsToAdd === 0 && nanosToAdd === 0) {
return this;
}
var epochSec = this._seconds + secondsToAdd;
epochSec = epochSec + MathUtil.intDiv(nanosToAdd, LocalTime.NANOS_PER_SECOND);
var nanoAdjustment = this._nanos + nanosToAdd % LocalTime.NANOS_PER_SECOND;
return Instant2.ofEpochSecond(epochSec, nanoAdjustment);
}
}, {
key: "_minusUnit",
value: function _minusUnit(amountToSubtract, unit) {
return this._plusUnit(-1 * amountToSubtract, unit);
}
}, {
key: "minusSeconds",
value: function minusSeconds(secondsToSubtract) {
return this.plusSeconds(secondsToSubtract * -1);
}
}, {
key: "minusMillis",
value: function minusMillis(millisToSubtract) {
return this.plusMillis(-1 * millisToSubtract);
}
}, {
key: "minusNanos",
value: function minusNanos(nanosToSubtract) {
return this.plusNanos(-1 * nanosToSubtract);
}
}, {
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.precision()) {
return ChronoUnit.NANOS;
}
if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId() || _query === TemporalQueries.zone() || _query === TemporalQueries.offset()) {
return null;
}
return _query.queryFrom(this);
}
}, {
key: "adjustInto",
value: function adjustInto(temporal) {
requireNonNull(temporal, "temporal");
return temporal.with(ChronoField.INSTANT_SECONDS, this._seconds).with(ChronoField.NANO_OF_SECOND, this._nanos);
}
}, {
key: "until",
value: function until(endExclusive, unit) {
requireNonNull(endExclusive, "endExclusive");
requireNonNull(unit, "unit");
var end = Instant2.from(endExclusive);
if (unit instanceof ChronoUnit) {
switch (unit) {
case ChronoUnit.NANOS:
return this._nanosUntil(end);
case ChronoUnit.MICROS:
return this._microsUntil(end);
case ChronoUnit.MILLIS:
return MathUtil.safeSubtract(end.toEpochMilli(), this.toEpochMilli());
case ChronoUnit.SECONDS:
return this._secondsUntil(end);
case ChronoUnit.MINUTES:
return MathUtil.intDiv(this._secondsUntil(end), LocalTime.SECONDS_PER_MINUTE);
case ChronoUnit.HOURS:
return MathUtil.intDiv(this._secondsUntil(end), LocalTime.SECONDS_PER_HOUR);
case ChronoUnit.HALF_DAYS:
return MathUtil.intDiv(this._secondsUntil(end), 12 * LocalTime.SECONDS_PER_HOUR);
case ChronoUnit.DAYS:
return MathUtil.intDiv(this._secondsUntil(end), LocalTime.SECONDS_PER_DAY);
}
throw new UnsupportedTemporalTypeException("Unsupported unit: ".concat(unit));
}
return unit.between(this, end);
}
}, {
key: "_microsUntil",
value: function _microsUntil(end) {
var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
var totalMicros = MathUtil.safeMultiply(secsDiff, 1e6);
return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(end.nano() - this.nano(), 1e3));
}
}, {
key: "_nanosUntil",
value: function _nanosUntil(end) {
var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
var totalNanos = MathUtil.safeMultiply(secsDiff, LocalTime.NANOS_PER_SECOND);
return MathUtil.safeAdd(totalNanos, end.nano() - this.nano());
}
}, {
key: "_secondsUntil",
value: function _secondsUntil(end) {
var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
var nanosDiff = end.nano() - this.nano();
if (secsDiff > 0 && nanosDiff < 0) {
secsDiff--;
} else if (secsDiff < 0 && nanosDiff > 0) {
secsDiff++;
}
return secsDiff;
}
}, {
key: "atOffset",
value: function atOffset(offset) {
return OffsetDateTime.ofInstant(this, offset);
}
}, {
key: "atZone",
value: function atZone(zone) {
return ZonedDateTime.ofInstant(this, zone);
}
}, {
key: "toEpochMilli",
value: function toEpochMilli() {
var millis = MathUtil.safeMultiply(this._seconds, 1e3);
return millis + MathUtil.intDiv(this._nanos, NANOS_PER_MILLI);
}
}, {
key: "compareTo",
value: function compareTo(otherInstant) {
requireNonNull(otherInstant, "otherInstant");
requireInstance(otherInstant, Instant2, "otherInstant");
var cmp = MathUtil.compareNumbers(this._seconds, otherInstant._seconds);
if (cmp !== 0) {
return cmp;
}
return this._nanos - otherInstant._nanos;
}
}, {
key: "isAfter",
value: function isAfter(otherInstant) {
return this.compareTo(otherInstant) > 0;
}
}, {
key: "isBefore",
value: function isBefore(otherInstant) {
return this.compareTo(otherInstant) < 0;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
if (other instanceof Instant2) {
return this.epochSecond() === other.epochSecond() && this.nano() === other.nano();
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return MathUtil.hashCode(this._seconds, this._nanos);
}
}, {
key: "toString",
value: function toString() {
return DateTimeFormatter.ISO_INSTANT.format(this);
}
}, {
key: "toJSON",
value: function toJSON() {
return this.toString();
}
}], [{
key: "now",
value: function now() {
var clock = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Clock.systemUTC();
return clock.instant();
}
}, {
key: "ofEpochSecond",
value: function ofEpochSecond(epochSecond) {
var nanoAdjustment = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
var secs = epochSecond + MathUtil.floorDiv(nanoAdjustment, LocalTime.NANOS_PER_SECOND);
var nos = MathUtil.floorMod(nanoAdjustment, LocalTime.NANOS_PER_SECOND);
return Instant2._create(secs, nos);
}
}, {
key: "ofEpochMilli",
value: function ofEpochMilli(epochMilli) {
var secs = MathUtil.floorDiv(epochMilli, 1e3);
var mos = MathUtil.floorMod(epochMilli, 1e3);
return Instant2._create(secs, mos * 1e6);
}
}, {
key: "from",
value: function from(temporal) {
try {
var instantSecs = temporal.getLong(ChronoField.INSTANT_SECONDS);
var nanoOfSecond = temporal.get(ChronoField.NANO_OF_SECOND);
return Instant2.ofEpochSecond(instantSecs, nanoOfSecond);
} catch (ex) {
throw new DateTimeException("Unable to obtain Instant from TemporalAccessor: ".concat(temporal, ", type ").concat(_typeof(temporal)), ex);
}
}
}, {
key: "parse",
value: function parse2(text) {
return DateTimeFormatter.ISO_INSTANT.parse(text, Instant2.FROM);
}
}, {
key: "_create",
value: function _create(seconds, nanoOfSecond) {
if (seconds === 0 && nanoOfSecond === 0) {
return Instant2.EPOCH;
}
return new Instant2(seconds, nanoOfSecond);
}
}, {
key: "_validate",
value: function _validate(seconds, nanoOfSecond) {
if (seconds < Instant2.MIN_SECONDS || seconds > Instant2.MAX_SECONDS) {
throw new DateTimeException("Instant exceeds minimum or maximum instant");
}
if (nanoOfSecond < 0 || nanoOfSecond > LocalTime.NANOS_PER_SECOND) {
throw new DateTimeException("Instant exceeds minimum or maximum instant");
}
}
}]);
return Instant2;
}(Temporal);
function _init$l() {
Instant.MIN_SECONDS = -31619119219200;
Instant.MAX_SECONDS = 31494816403199;
Instant.EPOCH = new Instant(0, 0);
Instant.MIN = Instant.ofEpochSecond(Instant.MIN_SECONDS, 0);
Instant.MAX = Instant.ofEpochSecond(Instant.MAX_SECONDS, 999999999);
Instant.FROM = createTemporalQuery("Instant.FROM", function(temporal) {
return Instant.from(temporal);
});
}
var Clock = function() {
function Clock2() {
_classCallCheck(this, Clock2);
}
_createClass(Clock2, [{
key: "millis",
value: function millis() {
abstractMethodFail("Clock.millis");
}
}, {
key: "instant",
value: function instant() {
abstractMethodFail("Clock.instant");
}
}, {
key: "zone",
value: function zone() {
abstractMethodFail("Clock.zone");
}
}, {
key: "withZone",
value: function withZone() {
abstractMethodFail("Clock.withZone");
}
}], [{
key: "systemUTC",
value: function systemUTC() {
return new SystemClock(ZoneOffset.UTC);
}
}, {
key: "systemDefaultZone",
value: function systemDefaultZone() {
return new SystemClock(ZoneId.systemDefault());
}
}, {
key: "system",
value: function system(zone) {
return new SystemClock(zone);
}
}, {
key: "fixed",
value: function fixed(fixedInstant, zoneId) {
return new FixedClock(fixedInstant, zoneId);
}
}, {
key: "offset",
value: function offset(baseClock, duration) {
return new OffsetClock(baseClock, duration);
}
}]);
return Clock2;
}();
var SystemClock = function(_Clock) {
_inherits(SystemClock2, _Clock);
var _super = _createSuper(SystemClock2);
function SystemClock2(zone) {
var _this;
_classCallCheck(this, SystemClock2);
requireNonNull(zone, "zone");
_this = _super.call(this);
_this._zone = zone;
return _this;
}
_createClass(SystemClock2, [{
key: "zone",
value: function zone() {
return this._zone;
}
}, {
key: "millis",
value: function millis() {
return (/* @__PURE__ */ new Date()).getTime();
}
}, {
key: "instant",
value: function instant() {
return Instant.ofEpochMilli(this.millis());
}
}, {
key: "equals",
value: function equals(obj) {
if (obj instanceof SystemClock2) {
return this._zone.equals(obj._zone);
}
return false;
}
}, {
key: "withZone",
value: function withZone(zone) {
if (zone.equals(this._zone)) {
return this;
}
return new SystemClock2(zone);
}
}, {
key: "toString",
value: function toString() {
return "SystemClock[".concat(this._zone.toString(), "]");
}
}]);
return SystemClock2;
}(Clock);
var FixedClock = function(_Clock2) {
_inherits(FixedClock2, _Clock2);
var _super2 = _createSuper(FixedClock2);
function FixedClock2(fixedInstant, zoneId) {
var _this2;
_classCallCheck(this, FixedClock2);
_this2 = _super2.call(this);
_this2._instant = fixedInstant;
_this2._zoneId = zoneId;
return _this2;
}
_createClass(FixedClock2, [{
key: "instant",
value: function instant() {
return this._instant;
}
}, {
key: "millis",
value: function millis() {
return this._instant.toEpochMilli();
}
}, {
key: "zone",
value: function zone() {
return this._zoneId;
}
}, {
key: "toString",
value: function toString() {
return "FixedClock[]";
}
}, {
key: "equals",
value: function equals(obj) {
if (obj instanceof FixedClock2) {
return this._instant.equals(obj._instant) && this._zoneId.equals(obj._zoneId);
}
return false;
}
}, {
key: "withZone",
value: function withZone(zone) {
if (zone.equals(this._zoneId)) {
return this;
}
return new FixedClock2(this._instant, zone);
}
}]);
return FixedClock2;
}(Clock);
var OffsetClock = function(_Clock3) {
_inherits(OffsetClock2, _Clock3);
var _super3 = _createSuper(OffsetClock2);
function OffsetClock2(baseClock, offset) {
var _this3;
_classCallCheck(this, OffsetClock2);
_this3 = _super3.call(this);
_this3._baseClock = baseClock;
_this3._offset = offset;
return _this3;
}
_createClass(OffsetClock2, [{
key: "zone",
value: function zone() {
return this._baseClock.zone();
}
}, {
key: "withZone",
value: function withZone(zone) {
if (zone.equals(this._baseClock.zone())) {
return this;
}
return new OffsetClock2(this._baseClock.withZone(zone), this._offset);
}
}, {
key: "millis",
value: function millis() {
return this._baseClock.millis() + this._offset.toMillis();
}
}, {
key: "instant",
value: function instant() {
return this._baseClock.instant().plus(this._offset);
}
}, {
key: "equals",
value: function equals(obj) {
if (obj instanceof OffsetClock2) {
return this._baseClock.equals(obj._baseClock) && this._offset.equals(obj._offset);
}
return false;
}
}, {
key: "toString",
value: function toString() {
return "OffsetClock[".concat(this._baseClock, ",").concat(this._offset, "]");
}
}]);
return OffsetClock2;
}(Clock);
var ZoneOffsetTransition = function() {
function ZoneOffsetTransition2(transition, offsetBefore, offsetAfter) {
_classCallCheck(this, ZoneOffsetTransition2);
requireNonNull(transition, "transition");
requireNonNull(offsetBefore, "offsetBefore");
requireNonNull(offsetAfter, "offsetAfter");
if (offsetBefore.equals(offsetAfter)) {
throw new IllegalArgumentException("Offsets must not be equal");
}
if (transition.nano() !== 0) {
throw new IllegalArgumentException("Nano-of-second must be zero");
}
if (transition instanceof LocalDateTime) {
this._transition = transition;
} else {
this._transition = LocalDateTime.ofEpochSecond(transition, 0, offsetBefore);
}
this._offsetBefore = offsetBefore;
this._offsetAfter = offsetAfter;
}
_createClass(ZoneOffsetTransition2, [{
key: "instant",
value: function instant() {
return this._transition.toInstant(this._offsetBefore);
}
}, {
key: "toEpochSecond",
value: function toEpochSecond() {
return this._transition.toEpochSecond(this._offsetBefore);
}
}, {
key: "dateTimeBefore",
value: function dateTimeBefore() {
return this._transition;
}
}, {
key: "dateTimeAfter",
value: function dateTimeAfter() {
return this._transition.plusSeconds(this.durationSeconds());
}
}, {
key: "offsetBefore",
value: function offsetBefore() {
return this._offsetBefore;
}
}, {
key: "offsetAfter",
value: function offsetAfter() {
return this._offsetAfter;
}
}, {
key: "duration",
value: function duration() {
return Duration2.ofSeconds(this.durationSeconds());
}
}, {
key: "durationSeconds",
value: function durationSeconds() {
return this._offsetAfter.totalSeconds() - this._offsetBefore.totalSeconds();
}
}, {
key: "isGap",
value: function isGap() {
return this._offsetAfter.totalSeconds() > this._offsetBefore.totalSeconds();
}
}, {
key: "isOverlap",
value: function isOverlap() {
return this._offsetAfter.totalSeconds() < this._offsetBefore.totalSeconds();
}
}, {
key: "isValidOffset",
value: function isValidOffset(offset) {
return this.isGap() ? false : this._offsetBefore.equals(offset) || this._offsetAfter.equals(offset);
}
}, {
key: "validOffsets",
value: function validOffsets() {
if (this.isGap()) {
return [];
} else {
return [this._offsetBefore, this._offsetAfter];
}
}
}, {
key: "compareTo",
value: function compareTo(transition) {
return this.instant().compareTo(transition.instant());
}
}, {
key: "equals",
value: function equals(other) {
if (other === this) {
return true;
}
if (other instanceof ZoneOffsetTransition2) {
var d = other;
return this._transition.equals(d._transition) && this._offsetBefore.equals(d.offsetBefore()) && this._offsetAfter.equals(d.offsetAfter());
}
return false;
}
}, {
key: "hashCode",
value: function hashCode() {
return this._transition.hashCode() ^ this._offsetBefore.hashCode() ^ this._offsetAfter.hashCode() >>> 16;
}
}, {
key: "toString",
value: function toString() {
return "Transition[".concat(this.isGap() ? "Gap" : "Overlap", " at ").concat(this._transition.toString()).concat(this._offsetBefore.toString(), " to ").concat(this._offsetAfter, "]");
}
}], [{
key: "of",
value: function of(transition, offsetBefore, offsetAfter) {
return new ZoneOffsetTransition2(transition, offsetBefore, offsetAfter);
}
}]);
return ZoneOffsetTransition2;
}();
function _init$m() {
TemporalQueries.ZONE_ID = createTemporalQuery("ZONE_ID", function(temporal) {
return temporal.query(TemporalQueries.ZONE_ID);
});
TemporalQueries.CHRONO = createTemporalQuery("CHRONO", function(temporal) {
return temporal.query(TemporalQueries.CHRONO);
});
TemporalQueries.PRECISION = createTemporalQuery("PRECISION", function(temporal) {
return temporal.query(TemporalQueries.PRECISION);
});
TemporalQueries.OFFSET = createTemporalQuery("OFFSET", function(temporal) {
if (temporal.isSupported(ChronoField.OFFSET_SECONDS)) {
return ZoneOffset.ofTotalSeconds(temporal.get(ChronoField.OFFSET_SECONDS));
}
return null;
});
TemporalQueries.ZONE = createTemporalQuery("ZONE", function(temporal) {
var zone = temporal.query(TemporalQueries.ZONE_ID);
return zone != null ? zone : temporal.query(TemporalQueries.OFFSET);
});
TemporalQueries.LOCAL_DATE = createTemporalQuery("LOCAL_DATE", function(temporal) {
if (temporal.isSupported(ChronoField.EPOCH_DAY)) {
return LocalDate.ofEpochDay(temporal.getLong(ChronoField.EPOCH_DAY));
}
return null;
});
TemporalQueries.LOCAL_TIME = createTemporalQuery("LOCAL_TIME", function(temporal) {
if (temporal.isSupported(ChronoField.NANO_OF_DAY)) {
return LocalTime.ofNanoOfDay(temporal.getLong(ChronoField.NANO_OF_DAY));
}
return null;
});
}
var SystemDefaultZoneRules = function(_ZoneRules) {
_inherits(SystemDefaultZoneRules2, _ZoneRules);
var _super = _createSuper(SystemDefaultZoneRules2);
function SystemDefaultZoneRules2() {
_classCallCheck(this, SystemDefaultZoneRules2);
return _super.apply(this, arguments);
}
_createClass(SystemDefaultZoneRules2, [{
key: "isFixedOffset",
value: function isFixedOffset() {
return false;
}
}, {
key: "offsetOfInstant",
value: function offsetOfInstant(instant) {
var offsetInMinutes = new Date(instant.toEpochMilli()).getTimezoneOffset();
return ZoneOffset.ofTotalMinutes(offsetInMinutes * -1);
}
}, {
key: "offsetOfEpochMilli",
value: function offsetOfEpochMilli(epochMilli) {
var offsetInMinutes = new Date(epochMilli).getTimezoneOffset();
return ZoneOffset.ofTotalMinutes(offsetInMinutes * -1);
}
}, {
key: "offsetOfLocalDateTime",
value: function offsetOfLocalDateTime(localDateTime) {
var epochMilli = localDateTime.toEpochSecond(ZoneOffset.UTC) * 1e3;
var offsetInMinutesBeforePossibleTransition = new Date(epochMilli).getTimezoneOffset();
var epochMilliSystemZone = epochMilli + offsetInMinutesBeforePossibleTransition * 6e4;
var offsetInMinutesAfterPossibleTransition = new Date(epochMilliSystemZone).getTimezoneOffset();
return ZoneOffset.ofTotalMinutes(offsetInMinutesAfterPossibleTransition * -1);
}
}, {
key: "validOffsets",
value: function validOffsets(localDateTime) {
return [this.offsetOfLocalDateTime(localDateTime)];
}
}, {
key: "transition",
value: function transition() {
return null;
}
}, {
key: "standardOffset",
value: function standardOffset(instant) {
return this.offsetOfInstant(instant);
}
}, {
key: "daylightSavings",
value: function daylightSavings() {
this._throwNotSupported();
}
}, {
key: "isDaylightSavings",
value: function isDaylightSavings() {
this._throwNotSupported();
}
}, {
key: "isValidOffset",
value: function isValidOffset(dateTime, offset) {
return this.offsetOfLocalDateTime(dateTime).equals(offset);
}
}, {
key: "nextTransition",
value: function nextTransition() {
this._throwNotSupported();
}
}, {
key: "previousTransition",
value: function previousTransition() {
this._throwNotSupported();
}
}, {
key: "transitions",
value: function transitions() {
this._throwNotSupported();
}
}, {
key: "transitionRules",
value: function transitionRules() {
this._throwNotSupported();
}
}, {
key: "_throwNotSupported",
value: function _throwNotSupported() {
throw new DateTimeException("not supported operation");
}
}, {
key: "equals",
value: function equals(other) {
if (this === other || other instanceof SystemDefaultZoneRules2) {
return true;
} else {
return false;
}
}
}, {
key: "toString",
value: function toString() {
return "SYSTEM";
}
}]);
return SystemDefaultZoneRules2;
}(ZoneRules);
var SystemDefaultZoneId = function(_ZoneId) {
_inherits(SystemDefaultZoneId2, _ZoneId);
var _super = _createSuper(SystemDefaultZoneId2);
function SystemDefaultZoneId2() {
var _this;
_classCallCheck(this, SystemDefaultZoneId2);
_this = _super.call(this);
_this._rules = new SystemDefaultZoneRules();
return _this;
}
_createClass(SystemDefaultZoneId2, [{
key: "rules",
value: function rules() {
return this._rules;
}
}, {
key: "equals",
value: function equals(other) {
if (this === other) {
return true;
}
return false;
}
}, {
key: "id",
value: function id() {
return "SYSTEM";
}
}]);
return SystemDefaultZoneId2;
}(ZoneId);
var ZoneIdFactory = function() {
function ZoneIdFactory2() {
_classCallCheck(this, ZoneIdFactory2);
}
_createClass(ZoneIdFactory2, null, [{
key: "systemDefault",
value: function systemDefault() {
return SYSTEM_DEFAULT_ZONE_ID_INSTANCE;
}
}, {
key: "getAvailableZoneIds",
value: function getAvailableZoneIds() {
return ZoneRulesProvider.getAvailableZoneIds();
}
}, {
key: "of",
value: function of(zoneId) {
requireNonNull(zoneId, "zoneId");
if (zoneId === "Z") {
return ZoneOffset.UTC;
}
if (zoneId.length === 1) {
throw new DateTimeException("Invalid zone: ".concat(zoneId));
}
if (StringUtil.startsWith(zoneId, "+") || StringUtil.startsWith(zoneId, "-")) {
return ZoneOffset.of(zoneId);
}
if (zoneId === "UTC" || zoneId === "GMT" || zoneId === "GMT0" || zoneId === "UT") {
return new ZoneRegion(zoneId, ZoneOffset.UTC.rules());
}
if (StringUtil.startsWith(zoneId, "UTC+") || StringUtil.startsWith(zoneId, "GMT+") || StringUtil.startsWith(zoneId, "UTC-") || StringUtil.startsWith(zoneId, "GMT-")) {
var offset = ZoneOffset.of(zoneId.substring(3));
if (offset.totalSeconds() === 0) {
return new ZoneRegion(zoneId.substring(0, 3), offset.rules());
}
return new ZoneRegion(zoneId.substring(0, 3) + offset.id(), offset.rules());
}
if (StringUtil.startsWith(zoneId, "UT+") || StringUtil.startsWith(zoneId, "UT-")) {
var _offset = ZoneOffset.of(zoneId.substring(2));
if (_offset.totalSeconds() === 0) {
return new ZoneRegion("UT", _offset.rules());
}
return new ZoneRegion("UT".concat(_offset.id()), _offset.rules());
}
if (zoneId === "SYSTEM") {
return ZoneId.systemDefault();
}
return ZoneRegion.ofId(zoneId);
}
}, {
key: "ofOffset",
value: function ofOffset(prefix, offset) {
requireNonNull(prefix, "prefix");
requireNonNull(offset, "offset");
if (prefix.length === 0) {
return offset;
}
if (prefix === "GMT" || prefix === "UTC" || prefix === "UT") {
if (offset.totalSeconds() === 0) {
return new ZoneRegion(prefix, offset.rules());
}
return new ZoneRegion(prefix + offset.id(), offset.rules());
}
throw new IllegalArgumentException("Invalid prefix, must be GMT, UTC or UT: ".concat(prefix));
}
}, {
key: "from",
value: function from(temporal) {
requireNonNull(temporal, "temporal");
var obj = temporal.query(TemporalQueries.zone());
if (obj == null) {
throw new DateTimeException("Unable to obtain ZoneId from TemporalAccessor: ".concat(temporal, ", type ").concat(temporal.constructor != null ? temporal.constructor.name : ""));
}
return obj;
}
}]);
return ZoneIdFactory2;
}();
var SYSTEM_DEFAULT_ZONE_ID_INSTANCE = null;
function _init$n() {
SYSTEM_DEFAULT_ZONE_ID_INSTANCE = new SystemDefaultZoneId();
ZoneId.systemDefault = ZoneIdFactory.systemDefault;
ZoneId.getAvailableZoneIds = ZoneIdFactory.getAvailableZoneIds;
ZoneId.of = ZoneIdFactory.of;
ZoneId.ofOffset = ZoneIdFactory.ofOffset;
ZoneId.from = ZoneIdFactory.from;
ZoneOffset.from = ZoneIdFactory.from;
ZoneId.SYSTEM = SYSTEM_DEFAULT_ZONE_ID_INSTANCE;
ZoneId.UTC = ZoneOffset.ofTotalSeconds(0);
}
var isInit = false;
function init() {
if (isInit) {
return;
}
isInit = true;
_init$1();
_init();
_init$2();
_init$3();
_init$k();
_init$8();
_init$m();
_init$4();
_init$l();
_init$i();
_init$j();
_init$d();
_init$5();
_init$c();
_init$b();
_init$6();
_init$7();
_init$g();
_init$n();
_init$e();
_init$a();
_init$9();
_init$h();
_init$f();
}
init();
var ToNativeJsConverter = function() {
function ToNativeJsConverter2(temporal, zone) {
_classCallCheck(this, ToNativeJsConverter2);
var zonedDateTime;
if (temporal instanceof Instant) {
this.instant = temporal;
return;
} else if (temporal instanceof LocalDate) {
zone = zone == null ? ZoneId.systemDefault() : zone;
zonedDateTime = temporal.atStartOfDay(zone);
} else if (temporal instanceof LocalDateTime) {
zone = zone == null ? ZoneId.systemDefault() : zone;
zonedDateTime = temporal.atZone(zone);
} else if (temporal instanceof ZonedDateTime) {
if (zone == null) {
zonedDateTime = temporal;
} else {
zonedDateTime = temporal.withZoneSameInstant(zone);
}
} else {
throw new IllegalArgumentException("unsupported instance for convert operation:".concat(temporal));
}
this.instant = zonedDateTime.toInstant();
}
_createClass(ToNativeJsConverter2, [{
key: "toDate",
value: function toDate() {
return new Date(this.instant.toEpochMilli());
}
}, {
key: "toEpochMilli",
value: function toEpochMilli() {
return this.instant.toEpochMilli();
}
}]);
return ToNativeJsConverter2;
}();
function convert(temporal, zone) {
return new ToNativeJsConverter(temporal, zone);
}
var NativeJsTemporal = function(_TemporalAccessor) {
_inherits(NativeJsTemporal2, _TemporalAccessor);
var _super = _createSuper(NativeJsTemporal2);
function NativeJsTemporal2(date) {
var _this;
var zone = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ZoneId.systemDefault();
_classCallCheck(this, NativeJsTemporal2);
_this = _super.call(this);
_this._zone = zone;
if (date instanceof Date) {
_this._epochMilli = date.getTime();
return _possibleConstructorReturn(_this);
} else if (typeof date.toDate === "function" && date.toDate() instanceof Date) {
_this._epochMilli = date.toDate().getTime();
return _possibleConstructorReturn(_this);
}
assert(false, "date must be either a javascript date or a moment");
return _this;
}
_createClass(NativeJsTemporal2, [{
key: "query",
value: function query(_query) {
requireNonNull(_query, "query");
if (_query === TemporalQueries.localDate()) {
return LocalDate.ofInstant(Instant.ofEpochMilli(this._epochMilli), this._zone);
} else if (_query === TemporalQueries.localTime()) {
return LocalTime.ofInstant(Instant.ofEpochMilli(this._epochMilli), this._zone);
} else if (_query === TemporalQueries.zone()) {
return this._zone;
}
return _get(_getPrototypeOf(NativeJsTemporal2.prototype), "query", this).call(this, _query);
}
}, {
key: "get",
value: function get(field) {
return this.getLong(field);
}
}, {
key: "getLong",
value: function getLong(field) {
requireNonNull(field, "field");
if (field instanceof ChronoField) {
switch (field) {
case ChronoField.NANO_OF_SECOND:
return MathUtil.floorMod(this._epochMilli, 1e3) * 1e6;
case ChronoField.INSTANT_SECONDS:
return MathUtil.floorDiv(this._epochMilli, 1e3);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(field));
}
return field.getFrom(this);
}
}, {
key: "isSupported",
value: function isSupported(field) {
return field === ChronoField.INSTANT_SECONDS || field === ChronoField.NANO_OF_SECOND;
}
}]);
return NativeJsTemporal2;
}(TemporalAccessor);
function nativeJs(date, zone) {
return new NativeJsTemporal(date, zone);
}
function bindUse(jsJoda) {
var used = [];
return function use2(fn) {
if (!~used.indexOf(fn)) {
fn(jsJoda);
used.push(fn);
}
return jsJoda;
};
}
var _ = {
assert: assert$1,
DateTimeBuilder,
DateTimeParseContext,
DateTimePrintContext,
MathUtil,
StringUtil,
StringBuilder
};
var jsJodaExports = {
_,
convert,
nativeJs,
ArithmeticException,
DateTimeException,
DateTimeParseException,
IllegalArgumentException,
IllegalStateException,
UnsupportedTemporalTypeException,
NullPointerException,
Clock,
DayOfWeek,
Duration: Duration2,
Instant,
LocalDate,
LocalTime,
LocalDateTime,
OffsetTime,
OffsetDateTime,
Month,
MonthDay,
Period,
Year: Year2,
YearConstants,
YearMonth,
ZonedDateTime,
ZoneOffset,
ZoneId,
ZoneRegion,
ZoneOffsetTransition,
ZoneRules,
ZoneRulesProvider,
ChronoLocalDate,
ChronoLocalDateTime,
ChronoZonedDateTime,
IsoChronology,
ChronoField,
ChronoUnit,
IsoFields,
Temporal,
TemporalAccessor,
TemporalAdjuster,
TemporalAdjusters,
TemporalAmount,
TemporalField,
TemporalQueries,
TemporalQuery,
TemporalUnit,
ValueRange,
DateTimeFormatter,
DateTimeFormatterBuilder,
DecimalStyle,
ResolverStyle,
SignStyle,
TextStyle
};
var use = bindUse(jsJodaExports);
jsJodaExports.use = use;
// src/zed/values/time.ts
var Time = class extends Primitive {
constructor(value) {
super(value);
this.type = TypeTime;
this._time = isNull(value) ? null : Time.parse(value);
}
static parse(value) {
let time;
for (const parse2 of PARSERS) {
try {
time = parse2(value);
break;
} catch (e) {
continue;
}
}
if (!time)
throw new Error("zed.Time couldn't parse: " + value);
return time;
}
toDate() {
if (isNull(this._time))
return null;
return convert(this._time).toDate();
}
toBigInt() {
if (isNull(this._time))
return BigInt(0);
let secs = this._time.toEpochSecond(ZoneOffset.UTC);
return BigInt(secs) * BigInt(1e9) + BigInt(this._time.nano());
}
toJS() {
return this.toDate();
}
};
var parseEpochSec = (v) => {
const d = new Date(+v * 1e3);
if (isNaN(d))
throw new Error("Not Epoch Seconds: " + v);
return ZonedDateTime.from(nativeJs(d));
};
var NanoFormat = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd'T'HH:mm:ss").appendFraction(ChronoField.NANO_OF_SECOND, 0, 9, true).appendLiteral("Z").toFormatter();
var parseNano = (v) => ZonedDateTime.of(LocalDateTime.parse(v, NanoFormat), ZoneId.of("UTC"));
var PARSERS = [parseNano, parseEpochSec];
// src/zed/types/type-time.ts
var TypeOfTime = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "time";
}
create(value) {
return new Time(value);
}
};
var TypeTime = new TypeOfTime();
// src/zed/values/type-value.ts
var TypeValue = class {
constructor(value = null) {
this.value = value;
this.type = TypeType;
}
isUnset() {
return isNull(this.value);
}
toString() {
if (isNull(this.value))
return "null";
return this.value.toString();
}
serialize(stream) {
if (isNull(this.value)) {
return null;
} else {
return this.value.serialize(stream);
}
}
toJS() {
if (isNull(this.value))
return null;
return this.toString();
}
};
// src/zed/types/type-type.ts
var TypeOfType = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "type";
}
create(value, stream) {
return new TypeValue(value === null ? null : stream.decodeType(value));
}
};
var TypeType = new TypeOfType();
// src/zed/values/typename.ts
var Typename = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeTypename;
}
toJS() {
return this.toString();
}
};
// src/zed/types/type-typename.ts
var TypeOfTypename = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "typename";
}
create(value) {
return new Typename(value);
}
};
var TypeTypename = new TypeOfTypename();
// src/zed/values/uint16.ts
var Uint16 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeUint16;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toJS() {
return this.toInt();
}
};
// src/zed/types/type-uint16.ts
var TypeOfUint16 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "uint16";
}
create(value) {
return new Uint16(value);
}
};
var TypeUint16 = new TypeOfUint16();
// src/zed/values/uint32.ts
var Uint32 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeUint32;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toJS() {
return this.toInt();
}
};
// src/zed/types/type-uint32.ts
var TypeOfUint32 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "uint32";
}
create(value) {
return new Uint32(value);
}
};
var TypeUint32 = new TypeOfUint32();
// src/zed/values/uint64.ts
var Uint64 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeUint64;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toBigInt() {
if (isNull(this.value))
return null;
return BigInt(this.value);
}
toJS(opts = {}) {
if (opts.bigint) {
return this.toBigInt();
} else {
return this.toInt();
}
}
};
// src/zed/types/type-uint64.ts
var TypeOfUint64 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "uint64";
}
create(value) {
return new Uint64(value);
}
};
var TypeUint64 = new TypeOfUint64();
// src/zed/values/uint8.ts
var Uint8 = class extends Primitive {
constructor() {
super(...arguments);
this.type = TypeUint8;
}
toInt() {
if (isNull(this.value))
return null;
return parseInt(this.value);
}
toJS() {
return this.toInt();
}
};
// src/zed/types/type-uint8.ts
var TypeOfUint8 = class extends BasePrimitive {
constructor() {
super(...arguments);
this.name = "uint8";
}
create(value) {
return new Uint8(value);
}
};
var TypeUint8 = new TypeOfUint8();
// src/zed/types/type-primitives.ts
var getPrimitives = () => {
return {
string: TypeString,
bstring: TypeBString,
time: TypeTime,
ip: TypeIp,
uint16: TypeUint16,
uint8: TypeUint8,
duration: TypeDuration,
uint64: TypeUint64,
uint32: TypeUint32,
int64: TypeInt64,
int8: TypeInt8,
int16: TypeInt16,
null: TypeNull,
typename: TypeTypename,
net: TypeNet,
float64: TypeFloat64,
float32: TypeFloat32,
float16: TypeFloat16,
int32: TypeInt32,
bool: TypeBool,
bytes: TypeBytes,
type: TypeType
};
};
function isPrimitiveType(value) {
return value === TypeString || value === TypeBString || value === TypeTime || value === TypeIp || value === TypeUint16 || value === TypeUint8 || value === TypeDuration || value === TypeUint64 || value === TypeUint32 || value === TypeInt64 || value === TypeInt8 || value === TypeInt16 || value === TypeNull || value === TypeTypename || value === TypeNet || value === TypeFloat64 || value === TypeFloat32 || value === TypeFloat16 || value === TypeInt32 || value === TypeBool || value === TypeBytes || value === TypeType;
}
// src/zed/utils/get-primitive-type.ts
function getPrimitiveType(name2) {
const obj = getPrimitives();
if (name2 in obj)
return obj[name2];
else
throw new Error("Unknown primitive:" + name2);
}
// src/zed/decode-stream.ts
var DecodeStream = class {
constructor(context) {
this.context = context;
this.typedefs = {};
}
decode(object) {
const type = this.decodeType(object.type);
return type.create(object.value, this);
}
decodeType(obj) {
const type = this.buildType(obj);
if ("id" in obj && obj.kind !== "ref") {
this.typedefs[obj.id] = type;
}
return type;
}
buildType(obj) {
switch (obj.kind) {
case "primitive":
return getPrimitiveType(obj.name);
case "ref":
return this.typedefs[obj.id];
case "named":
return this.context.lookupTypeAlias(obj.name, this.decodeType(obj.type));
case "array":
return this.context.lookupTypeArray(this.decodeType(obj.type));
case "set":
return this.context.lookupTypeSet(this.decodeType(obj.type));
case "error":
return this.context.lookupErrorType(this.decodeType(obj.type));
case "union":
return this.context.lookupTypeUnion(
obj.types.map((t) => this.decodeType(t))
);
case "map":
return this.context.lookupTypeMap(
this.decodeType(obj.key_type),
this.decodeType(obj.val_type)
);
case "record":
return this.context.lookupTypeRecord(
(0, import_lodash2.isNull)(obj.fields) ? null : obj.fields.map(({ name: name2, type }) => {
return new TypeField(name2, this.decodeType(type));
})
);
default:
throw `Implement decoding: ${obj.kind}`;
}
}
};
// src/zed/utils/is-type-alias.ts
function isTypeAlias(type) {
return type instanceof TypeAlias;
}
// src/zed/utils/true-type.ts
function trueType(start) {
let t = start;
while (isTypeAlias(t)) {
t = t.type;
}
return t;
}
// src/zed/values/union.ts
var Union = class {
constructor(type, innerType, index, value) {
this.type = type;
this.innerType = innerType;
this.index = index;
this.value = value;
}
toString() {
if (isNull(this.value))
return "null";
return this.value.toString();
}
serialize(stream) {
if (isNull(this.index) || isNull(this.value))
return null;
return [
this.index.toString(),
stream.encodeValue(this.value)
];
}
isUnset() {
return isNull(this.index) || isNull(this.value);
}
toJS() {
if (this.isUnset())
return null;
return this.value?.toJS();
}
};
// src/zed/utils/base-value.ts
function baseValue(value) {
if (value instanceof Union) {
return baseValue(value.value);
}
return value;
}
// src/zed/values/record.ts
var import_lodash4 = __toESM(require_lodash());
// src/zed/utils/flat-columns.ts
var import_lodash3 = __toESM(require_lodash());
function flatColumns(type, columns = [], path = void 0) {
const record = trueType(type);
if (!(record instanceof TypeRecord))
return columns;
if ((0, import_lodash3.isNull)(record.fields))
return [];
for (let f of record.fields) {
const type2 = trueType(f.type);
if (type2 instanceof TypeRecord) {
flatColumns(type2, columns, !path ? [f.name] : [...path, f.name]);
} else {
columns.push(path ? [...path, f.name] : f.name);
}
}
return columns;
}
// src/zed/values/record.ts
var Record = class {
constructor(type, fields) {
this.type = type;
this.fields = fields;
}
get null() {
return this.fields === null;
}
get flatColumns() {
return flatColumns(this.trueType);
}
get columns() {
if ((0, import_lodash4.isNull)(this.fields))
return [];
return this.fields.map((f) => f.name);
}
get trueType() {
return trueType(this.type);
}
toString() {
if ((0, import_lodash4.isNull)(this.fields))
return "null";
let s = "{";
let sep = "";
this.fields.forEach((f) => {
s += sep + f.name + ":" + f.value.toString();
sep = ",";
});
s += "}";
return s;
}
serialize(stream) {
if ((0, import_lodash4.isNull)(this.fields))
return null;
return this.fields.map((f) => stream.encodeValue(f.value));
}
at(index) {
return this.fieldAt(index)?.value ?? null;
}
fieldAt(index) {
if ((0, import_lodash4.isNull)(this.fields))
return null;
if ((0, import_lodash4.isNumber)(index))
return this.fields[index];
if ((0, import_lodash4.isArray)(index)) {
if (index.length === 1)
return this.fieldAt(index[0]);
const [head, ...tail] = index;
const value = this.fieldAt(head)?.value;
if (!value)
return null;
if (!(value instanceof Record)) {
throw new Error("Not a record");
}
return value.fieldAt(tail);
} else {
throw new Error("Argument must be number | number[]");
}
}
has(name2, ...types) {
try {
let type = this.get(name2).type;
return types.length === 0 ? true : types.some((t) => type === t);
} catch (e) {
return false;
}
}
get(name2) {
return this.getField(name2)?.value ?? null;
}
getField(name2) {
if ((0, import_lodash4.isString)(name2))
return this._getField(name2);
if ((0, import_lodash4.isEmpty)(name2))
throw new Error("No fields specified");
if (name2.length === 1)
return this._getField(name2[0]);
const [next, ...rest] = name2;
const field = this.getField(next);
if (!field)
throw new Error("No field named " + next);
const value = field.baseValue;
if (value == null || value instanceof Null) {
return null;
} else if (value instanceof Record) {
return value.getField(rest);
} else {
throw new Error(`${next} is not a record`);
}
}
try(name2) {
try {
return this.get(name2);
} catch {
return null;
}
}
tryField(name2) {
try {
return this.getField(name2);
} catch {
return null;
}
}
_getField(name2, parent) {
if (!this.trueType.has(name2)) {
throw new UnknownColumnError(name2, this.columns);
}
if ((0, import_lodash4.isNull)(this.fields)) {
return new Field2(name2, new Null(), parent || this);
} else {
return this.fields.find((f) => f.name == name2);
}
}
isUnset() {
return (0, import_lodash4.isNull)(this.fields);
}
toJS(opts = {}) {
if ((0, import_lodash4.isNull)(this.fields))
return null;
return this.fields.reduce((obj, field) => {
obj[field.name] = field.value.toJS(opts);
return obj;
}, {});
}
};
var UnknownColumnError = class extends Error {
constructor(unknown, names) {
const available = names.map((n) => `"${n}"`).join(", ");
super(`"${unknown}" not present in [${available}]`);
}
};
// src/zed/values/field.ts
var Field2 = class {
constructor(name2, value, parent) {
this.name = name2;
this.value = value;
this.parent = parent;
}
/**
* Alias for value
*/
get data() {
return this.value;
}
get path() {
let path = [this.name];
let parent = this.parent;
while (parent && parent instanceof Field2) {
path.unshift(parent.name);
parent = parent.parent;
}
return path;
}
get rootRecord() {
let parent = this.parent;
while (parent && parent instanceof Field2) {
parent = parent.parent;
}
if (parent instanceof Record)
return parent;
else
return null;
}
get baseValue() {
return baseValue(this.value);
}
};
// src/zed/types/type-record.ts
var TypeRecord = class {
constructor(fields) {
this.fields = fields;
this.kind = "record";
}
has(name2) {
return !!this.fields?.find((f) => f.name === name2);
}
static stringify(fields) {
if (isNull(fields))
return "null";
let s = "{";
let sep = "";
fields.forEach((f) => {
s += sep + f.name + ":" + f.type.toString();
sep = ",";
});
s += "}";
return s;
}
toString() {
if (isNull(this.fields))
return "null";
let s = "{";
let sep = "";
this.fields.forEach((f) => {
s += sep + f.name + ":" + f.type.toString();
sep = ",";
});
s += "}";
return s;
}
create(values, stream, parent) {
if (values === null || isNull(this.fields))
return new Record(this, null);
const record = new Record(
this,
null
/* temp */
);
const progenitor = parent || record;
record.fields = this.fields.map((f, i) => {
if (trueType(f.type) instanceof TypeRecord) {
const field = new Field2(f.name, new Null(), progenitor);
field.value = f.type.create(values[i], stream, field);
return field;
} else {
return new Field2(f.name, f.type.create(values[i], stream), progenitor);
}
});
return record;
}
serialize(stream) {
return {
kind: "record",
fields: isNull(this.fields) ? null : this.fields.map((f) => {
return {
name: f.name,
type: stream.encodeType(f.type)
};
})
};
}
};
// src/zed/types/type-alias.ts
var TypeAlias = class {
constructor(name2, type) {
this.name = name2;
this.type = type;
this.kind = "alias";
}
static stringify(name2, type) {
return name2 + "=(" + type.toString() + ")";
}
create(value, stream, parent) {
let v;
if (this.type instanceof TypeRecord || this.type instanceof TypeAlias) {
v = this.type.create(value, stream, parent);
} else {
v = this.type.create(value, stream);
}
v.type = this;
return v;
}
serialize(stream) {
return { kind: "named", name: this.name, type: stream.encodeType(this.type) };
}
toString() {
return this.name + "=(" + this.type.toString() + ")";
}
};
// src/zed/values/array.ts
var Array2 = class {
constructor(type, items) {
this.type = type;
this.items = items;
}
indexOf(value) {
if (isNull(this.items))
return -1;
return this.items.indexOf(value);
}
at(index) {
if (isNull(this.items))
return void 0;
return this.items[index];
}
toString() {
if (isNull(this.items))
return "null";
const contents = this.items.map((i) => i.toString()).join(",");
return `[${contents}]`;
}
serialize(stream) {
if (isNull(this.items))
return null;
return this.items.map((i) => stream.encodeValue(i));
}
isUnset() {
return isNull(this.items);
}
toJS(opts = {}) {
if (isNull(this.items))
return null;
return this.items.map((i) => i.toJS(opts));
}
};
// src/zed/types/type-array.ts
var TypeArray = class {
constructor(type) {
this.kind = "array";
this.type = type;
}
static stringify(type) {
return `[${type.toString()}]`;
}
create(values, stream) {
return new Array2(
this,
isNull(values) ? null : values.map((value) => this.type.create(value, stream))
);
}
serialize(stream) {
return {
kind: "array",
type: stream.encodeType(this.type)
};
}
toString() {
return "[" + this.type.toString() + "]";
}
};
// src/zed/values/error.ts
var import_lodash5 = __toESM(require_lodash());
var Error2 = class {
constructor(type, value) {
this.type = type;
this.value = value;
}
toJS() {
return new global.Error(this.toString());
}
toString() {
if ((0, import_lodash5.isNull)(this.value))
return "null";
return `Error(${this.value.toString()})`;
}
serialize(stream) {
if ((0, import_lodash5.isNull)(this.value)) {
return null;
} else {
return stream.encodeValue(this.value);
}
}
isUnset() {
return (0, import_lodash5.isNull)(this.value);
}
};
// src/zed/types/type-error.ts
var TypeError2 = class {
constructor(type) {
this.type = type;
this.kind = "error";
}
static stringify(type) {
return `error<${type.toString()}>`;
}
create(value, stream) {
if (value === null) {
return new Error2(this, null);
} else {
return new Error2(this, this.type.create(value, stream));
}
}
serialize(stream) {
return {
kind: "error",
type: stream.encodeType(this.type)
};
}
toString() {
return TypeError2.stringify(this.type);
}
};
// src/zed/values/map.ts
var ZedMap = class {
constructor(type, value) {
this.type = type;
this.value = value;
}
toString() {
if (isNull(this.value))
return "null";
const contents = Array.from(this.value.entries()).map(([key, value]) => {
const sep = isIPv6(key) ? " :" : ":";
return key.toString() + sep + value.toString();
}).join(",");
return `|{${contents}}|`;
}
serialize(stream) {
if (isNull(this.value))
return null;
return Array.from(this.value.entries()).map(([k, v]) => {
return [stream.encodeValue(k), stream.encodeValue(v)];
});
}
isUnset() {
return isNull(this.value);
}
toJS(opts = {}) {
if (isNull(this.value))
return null;
return new Map(
Array.from(this.value.entries()).map(([k, v]) => [
k.toJS(opts),
v.toJS(opts)
])
);
}
};
function isIPv6(v) {
return v.type === TypeIp && v.toString().includes(":");
}
// src/zed/types/type-map.ts
var TypeMap = class {
constructor(keyType, valType) {
this.keyType = keyType;
this.valType = valType;
this.kind = "union";
}
static stringify(keyType, valType) {
return `|{` + keyType.toString() + ":" + valType.toString() + "}|";
}
create(value, stream) {
return new ZedMap(
this,
isNull(value) ? null : new Map(
value.map((entry) => [
this.keyType.create(entry[0], stream),
this.valType.create(entry[1], stream)
])
)
);
}
serialize(stream) {
return {
kind: "map",
key_type: stream.encodeType(this.keyType),
val_type: stream.encodeType(this.valType)
};
}
toString() {
return "|{" + this.keyType.toString() + ":" + this.valType.toString() + "}|";
}
};
// src/zed/values/set.ts
var Set = class {
constructor(type, items) {
this.type = type;
this.items = items;
}
indexOf(value) {
if (isNull(this.items))
return -1;
return this.items.indexOf(value);
}
at(index) {
if (isNull(this.items))
return void 0;
return this.items[index];
}
toString() {
if (isNull(this.items))
return "null";
const contents = this.items.map((i) => i.toString()).join(",");
return `|[${contents}]|`;
}
serialize(stream) {
if (isNull(this.items))
return null;
return this.items.map((i) => stream.encodeValue(i));
}
isUnset() {
return isNull(this.items);
}
toJS(opts = {}) {
if (isNull(this.items))
return null;
return this.items.map((i) => i.toJS(opts));
}
};
// src/zed/types/type-set.ts
var TypeSet = class {
constructor(type) {
this.type = type;
this.kind = "set";
}
static stringify(type) {
return `|[${type.toString()}]|`;
}
create(values, stream) {
return new Set(
this,
isNull(values) ? null : values.map((v) => this.type.create(v, stream))
);
}
serialize(stream) {
return {
kind: "set",
type: stream.encodeType(this.type)
};
}
toString() {
return `|[` + this.type.toString() + `]|`;
}
};
// src/zed/types/type-union.ts
var TypeUnion = class {
constructor(types) {
this.types = types;
this.kind = "union";
}
static stringify(types) {
return `(${types.map((t) => t.toString()).join(",")})`;
}
create(value, stream) {
if (value === null) {
return new Union(this, TypeNull, null, null);
} else {
const index = parseInt(value[0]);
const innerType = this.types[index];
const innerValue = innerType.create(value[1], stream);
return new Union(this, innerType, index, innerValue);
}
}
serialize(stream) {
return {
kind: "union",
types: this.types.map((t) => stream.encodeType(t))
};
}
toString() {
return `(${this.types.map((t) => t.toString()).join(",")})`;
}
};
// src/zed/utils/is-primitive.ts
function isPrimitive(value) {
return value instanceof Primitive;
}
// src/zed/utils/is-container.ts
var containers = [Record, Array2, Set, Union, ZedMap, Error2, TypeValue];
function isContainer(value) {
for (let name2 of containers) {
if (value instanceof name2)
return true;
}
return false;
}
// src/zed/utils/is-value.ts
function isValue(value) {
return isPrimitive(value) || isContainer(value);
}
// src/zed/encode-stream.ts
var import_lodash6 = __toESM(require_lodash());
var EncodeStream = class {
constructor() {
this.id = 30;
this.map = /* @__PURE__ */ new Map();
}
encode(value) {
return {
type: this.encodeType(value.type),
value: this.encodeValue(value)
};
}
encodeType(type) {
if (isPrimitiveType(type)) {
return type.serialize();
} else if (this.hasSeen(type)) {
return { kind: "ref", id: this.getId(type) };
} else {
const zjson = type.serialize(this);
const id = this.id++;
this.map.set(type, id);
return { id, ...zjson };
}
}
encodeValue(value) {
if (!value)
return null;
if (value instanceof TypeValue) {
if ((0, import_lodash6.isNull)(value.value))
return null;
return this.encodeType(value.value);
} else {
return value.serialize(this);
}
}
hasSeen(type) {
return this.map.has(type);
}
getId(type) {
return this.map.get(type);
}
};
// src/zed/context.ts
var ZedContext = class {
constructor() {
this.typeByShape = {};
}
decode(objects, stream = new DecodeStream(this)) {
return objects.map((o) => this.decodeOne(o, stream));
}
decodeOne(object, stream = new DecodeStream(this)) {
return stream.decode(object);
}
encode(values) {
const stream = new EncodeStream();
return values.map((v) => this.encodeOne(v, stream));
}
encodeOne(value, stream = new EncodeStream()) {
return stream.encode(value);
}
decodeField(obj) {
const transport = this.decodeOne(obj.record);
return transport.getField(obj.path);
}
encodeField(field) {
const root = field.rootRecord;
if (!root)
throw new Error("Unable to encode field, no root record");
return {
record: this.encodeOne(root),
path: field.path
};
}
lookupErrorType(type) {
const key = TypeError2.stringify(type);
if (key in this.typeByShape) {
return this.typeByShape[key];
} else {
return this.alloc(key, new TypeError2(type));
}
}
lookupTypeRecord(fields) {
const key = TypeRecord.stringify(fields);
if (key in this.typeByShape) {
const record = this.typeByShape[key];
record.fields = fields;
return record;
} else {
return this.alloc(key, new TypeRecord(fields));
}
}
lookupTypeArray(type) {
const key = TypeArray.stringify(type);
if (key in this.typeByShape) {
return this.typeByShape[key];
} else {
return this.alloc(key, new TypeArray(type));
}
}
lookupTypeSet(type) {
const key = TypeSet.stringify(type);
if (key in this.typeByShape) {
return this.typeByShape[key];
} else {
return this.alloc(key, new TypeSet(type));
}
}
lookupTypeUnion(types) {
const key = TypeUnion.stringify(types);
if (key in this.typeByShape) {
return this.typeByShape[key];
} else {
return this.alloc(key, new TypeUnion(types));
}
}
lookupTypeMap(keyType, valType) {
const key = TypeMap.stringify(keyType, valType);
if (key in this.typeByShape) {
return this.typeByShape[key];
} else {
return this.alloc(key, new TypeMap(keyType, valType));
}
}
lookupTypeAlias(name2, type) {
const key = TypeAlias.stringify(name2, type);
if (key in this.typeByShape) {
return this.typeByShape[key];
} else {
return this.alloc(key, new TypeAlias(name2, type));
}
}
alloc(key, type) {
this.typeByShape[key] = type;
return type;
}
};
var DefaultContext = new ZedContext();
// src/encoder.ts
function decode(data, opts = {}) {
const defaults2 = { context: DefaultContext };
const options = { ...defaults2, ...opts };
const { context } = options;
if (Array.isArray(data)) {
return context.decode(data, options.stream);
} else if ("path" in data) {
return context.decodeField(data);
} else {
return context.decodeOne(data, options.stream);
}
}
function encode(data, opts = {}) {
const defaults2 = { context: DefaultContext };
const options = { ...defaults2, ...opts };
const { context } = options;
if (Array.isArray(data)) {
return context.encode(data);
} else if (data instanceof Field2) {
return context.encodeField(data);
} else {
return context.encodeOne(data);
}
}
// src/parser.ts
var import_parser = __toESM(require_parser());
var parseAst = import_parser.default.parse;
// src/query/result-stream.ts
var import_lodash7 = __toESM(require_lodash());
// src/ndjson/parse.ts
var UnexpectedServerResponse = class extends Error {
constructor(msg) {
super(msg);
this.name = "UnexpectedServerResponse";
}
};
function parse(string) {
try {
return JSON.parse(string);
} catch (e) {
throw new UnexpectedServerResponse(
`Expected ndjson but received "${string}"`
);
}
}
// src/ndjson/pipe_json.ts
var NEW_LINE = "\n";
async function* pipeJson(iterator) {
let leftover = "";
for await (let value of iterator) {
let start = 0;
let end = 0;
let chunk = leftover += value;
while ((end = chunk.indexOf(NEW_LINE, start)) !== -1) {
let line = chunk.substring(start, end);
yield parse(line);
start = end + NEW_LINE.length;
}
leftover = chunk.substring(start);
}
if (leftover)
yield parse(leftover);
}
// src/ndjson/pipe_text.ts
function pipeText(stream) {
if (!stream)
return noop();
if (stream.getReader) {
return browserPipeText(stream);
} else {
return nodePipeText(stream);
}
}
async function* noop() {
}
async function* browserPipeText(stream) {
let reader = stream.getReader();
let text = new TextDecoder();
try {
while (true) {
let { done, value } = await reader.read();
if (!done && value) {
yield text.decode(value);
} else {
return;
}
}
} finally {
reader.releaseLock();
}
}
function nodePipeText(stream) {
let resolves = [];
let pending = [];
stream.on("data", (data) => {
let value = { done: false, value: data.toString() };
if (resolves.length) {
resolves.shift()(value);
} else {
pending.push(value);
}
});
stream.on("end", () => {
const value = { done: true, value: null };
if (resolves.length) {
resolves.shift()(value);
} else {
pending.push(value);
}
});
return {
return() {
return Promise.resolve({ done: true, value: null });
},
throw(e) {
return Promise.reject(e);
},
next() {
const result = pending.shift();
if (result) {
return Promise.resolve(result);
} else {
return new Promise((res) => {
resolves.push(res);
});
}
},
[Symbol.asyncIterator]: function() {
return this;
}
};
}
// src/ndjson/lines.ts
async function* eachLine(readable) {
for await (let json2 of pipeJson(pipeText(readable))) {
yield json2;
}
}
// src/query/channel.ts
var import_events = __toESM(require_events());
var Channel = class extends import_events.default {
constructor() {
super(...arguments);
this.rows = [];
this.shapesMap = {};
this.stream = new DecodeStream(DefaultContext);
}
get shapes() {
return Object.values(this.shapesMap);
}
addRow(row) {
this.rows.push(row);
this.emit("row", row);
}
addShape(id, type) {
this.shapesMap[id] = type;
this.emit("shape", type);
}
hasShape(id) {
return id in this.shapesMap;
}
done() {
this.emit("end");
}
consume(json2) {
const value = this.stream.decode(json2);
if ("id" in json2.type && !this.hasShape(json2.type.id)) {
this.addShape(json2.type.id, value.type);
} else if (json2.type.kind === "primitive") {
this.addShape(json2.type.name, value.type);
}
this.addRow(value);
}
collect(collector) {
let first = true;
let count = 0;
let countThresh = 2e3;
let timeThresh = 2e3;
let timeId = 0;
const flush = () => {
collector({ rows: this.rows, shapesMap: this.shapesMap });
first = false;
count = 0;
clearTimeout(timeId);
};
const startTimer = () => {
timeId = setTimeout(() => {
if (count > 0)
flush();
startTimer();
}, timeThresh);
};
this.on("row", () => {
count += 1;
if (first && count >= countThresh)
flush();
});
this.on("end", () => flush());
startTimer();
}
};
// src/query/result-stream.ts
var ResultStream = class {
constructor(resp, ctl) {
this.resp = resp;
this.ctl = ctl;
this.status = "idle";
this.channelsMap = /* @__PURE__ */ new Map();
}
get body() {
return this.resp.body;
}
get promise() {
return this.consume();
}
get channels() {
return Array.from(this.channelsMap.values());
}
get shapes() {
return this.channel(0).shapes;
}
get rows() {
return this.channel(0).rows;
}
channel(id = this.currentChannelId) {
if (id === void 0)
throw new Error("Current channel not set");
let channel = this.channelsMap.get(id);
if (!channel) {
channel = new Channel();
this.channelsMap.set(id, channel);
}
return channel;
}
async js(opts = {}) {
this.consume();
const channel = this.channel(0);
await this.promise;
return channel.rows.map((r) => r.toJS(opts));
}
async zed() {
this.consume();
const channel = this.channel(0);
await this.promise;
return channel.rows;
}
collect(collector) {
this.consume();
this.channel(0).collect(collector);
return this.promise;
}
abort() {
this.ctl.abort();
}
consume() {
if (this._promise)
return this._promise;
this.status = "pending";
this._promise = new Promise(async (resolve, reject) => {
try {
for await (let json2 of eachLine(this.resp.body)) {
this.consumeLine(json2);
}
this.status = "success";
resolve();
} catch (e) {
if (e instanceof DOMException && e.message.match(/user aborted/) || e instanceof Error && e.message.match(/context canceled/)) {
this.status = "aborted";
reject(e);
} else {
this.status = "error";
reject(e);
}
}
});
}
consumeLine(json2) {
switch (json2.type) {
case "QueryChannelSet":
this.currentChannelId = json2.value.channel_id;
break;
case "QueryChannelEnd":
this.currentChannelId = json2.value.channel_id;
var channel = this.channel();
channel.done();
break;
case "QueryStats":
break;
case "QueryError":
throw new Error(json2.value.error);
default:
if ((0, import_lodash7.isObject)(json2.type)) {
this.channel().consume(json2);
break;
}
console.error("Unknown zjson object", json2);
}
}
};
// src/zjson.ts
var zjson_exports = {};
// src/test/factory.ts
var import_lodash8 = __toESM(require_lodash());
function createRecord(object) {
let fields = [];
for (let name2 in object) {
fields.push(createField(name2, object[name2]));
}
const typeFields = fields.map((f) => new TypeField(f.name, f.value.type));
const type = DefaultContext.lookupTypeRecord(typeFields);
const r = new Record(type, fields);
return decode(encode(r));
}
function createField(name2, value) {
return new Field2(name2, createData(value), null);
}
function createData(value) {
if (isValue(value)) {
return value;
}
if (value === null) {
return new Null();
}
if ((0, import_lodash8.isDate)(value)) {
return new Time((value.getTime() / 1e3).toString());
}
if ((0, import_lodash8.isInteger)(value)) {
return new Uint64(value.toString());
}
if ((0, import_lodash8.isNumber)(value)) {
return new Float64(value.toString());
}
if ((0, import_lodash8.isString)(value) && isIp(value)) {
return new Ip(value);
}
if ((0, import_lodash8.isString)(value)) {
return new String2(value);
}
if ((0, import_lodash8.isObject)(value) && value?.constructor === Object) {
return createRecord(value);
}
throw new Error(`Implement this: ${JSON.stringify(value)}`);
}
function isIp(string) {
const blocks = string.split(".");
if (blocks.length !== 4)
return false;
return blocks.every((block) => {
return Number(block) >= 0 && Number(block) <= 255;
});
}
// src/client/client.ts
var import_event_source_polyfill = __toESM(require_eventsource());
var import_lodash9 = __toESM(require_lodash());
// src/util/utils.ts
function isObject3(thing) {
return typeof thing === "object" && thing !== null;
}
// src/util/error.ts
function createError(input) {
if (input instanceof Error)
return input;
if (isObject3(input)) {
const e = Object.assign(new Error(), input);
if (input.error) {
e.message = input.error;
}
if (input.kind) {
e.name = input.kind;
}
return e;
}
return new Error(input);
}
// src/client/utils.ts
function parseContent(resp) {
if (resp.status === 204)
return Promise.resolve(null);
const type = resp.headers.get("Content-Type");
switch (type) {
case "application/json":
case "application/x-zjson":
try {
return resp.json();
} catch {
console.error("Unable to parse json content, parsing as text instead");
return resp.text();
}
case "text/html; charset=UTF-8":
case "text/plain; charset=utf-8":
return resp.text();
case "application/vnd.tcpdump.pcap":
return resp;
default:
console.error(`unknown Content-Type: '${type}', parsing as text`);
return resp.text();
}
}
function accept(format) {
const formats = {
arrows: "application/vnd.apache.arrow.stream",
csv: "text/csv",
json: "application/json",
ndjson: "application/x-ndjson",
vng: "application/x-vng",
zeek: "application/x-zeek",
zjson: "application/x-zjson",
zng: "application/x-zng",
zson: "application/x-zson"
};
const value = formats[format];
if (!value) {
throw Error(`Unknown Format: ${format}`);
} else {
return value;
}
}
function defaults(opts, defs) {
return { ...defs, ...opts };
}
var getEnv = () => {
return "fetch" in globalThis && !globalThis.fetch.polyfill ? "web" : "node";
};
async function toJS(res) {
const j = await res.json();
return decode(j).toJS();
}
function json(obj) {
return JSON.stringify(obj);
}
function wrapAbort(signal) {
const ctl = new AbortController();
signal?.addEventListener("abort", () => ctl.abort());
return ctl;
}
function getLoadContentType(format) {
if (!format)
return null;
if (format === "auto")
return "*/*";
if (format === "arrows")
return "application/vnd.apache.arrow.stream";
if (format === "csv")
return "text/csv";
if (format === "json")
return "application/json";
if (format === "line")
return "application/x-line";
if (format === "parquet")
return "application/x-parquet";
if (format === "vng")
return "application/x-vng";
if (format === "zeek")
return "application/x-zeek";
if (format === "zjson")
return "application/x-zjson";
if (format === "zng")
return "application/x-zng";
if (format === "zson")
return "application/x-zson";
throw new Error("Unknown load format: " + format);
}
// src/client/client.ts
var Client = class {
constructor(baseURL, opts = {}) {
this.baseURL = baseURL;
this.timeout = 6e4;
const defaults2 = { env: getEnv(), auth: null };
const options = { ...defaults2, ...opts };
this.auth = options.auth || null;
}
async version() {
const r = await this.send({
method: "GET",
path: "/version"
});
return await r.json();
}
async authMethod() {
const r = await this.send({
method: "GET",
path: "/auth/method"
});
return toJS(r);
}
async load(data, opts = {}) {
const { pool } = opts;
if (!pool)
throw new Error("Missing required option 'pool'");
const poolId = typeof pool === "string" ? pool : pool.id;
const branch = opts.branch || "main";
let headers = {};
if (opts.message)
headers["Zed-Commit"] = json(opts.message);
const res = await this.send({
path: `/pool/${poolId}/branch/${encodeURIComponent(branch)}`,
method: "POST",
body: data,
headers,
contentType: getLoadContentType(opts.format) ?? "",
signal: opts.signal,
timeout: Infinity
});
return toJS(res);
}
async query(query, opts = {}) {
const options = defaults(opts, {
format: "zjson",
controlMessages: true
});
const abortCtl = wrapAbort(options.signal);
const result = await this.send({
method: "POST",
path: `/query?ctrl=${options.controlMessages}`,
body: json({ query }),
contentType: "application/json",
format: options.format,
signal: abortCtl.signal,
timeout: options.timeout
});
return new ResultStream(result, abortCtl);
}
async createPool(name2, opts = {}) {
const options = defaults(opts, {
order: "desc",
key: "ts"
});
const keys = [[].concat(options.key)];
const layout = { order: options.order, keys };
return this.send({
method: "POST",
path: "/pool",
body: json({ name: name2, layout }),
contentType: "application/json"
}).then(toJS);
}
async deletePool(poolId) {
await this.send({
method: "DELETE",
path: `/pool/${poolId}`
});
return true;
}
async getPools() {
const resp = await this.query("from :pools");
return resp.js();
}
async getPool(nameOrId) {
const res = await this.query(
`from :pools | id == ${nameOrId} or name == "${nameOrId}"`
);
const values = await res.js();
if (!values || values.length == 0)
throw new Error(`Pool Not Found: ${nameOrId}`);
return values[0];
}
async getPoolStats(poolId) {
const res = await this.send({
method: "GET",
path: `/pool/${poolId}/stats`
});
return toJS(res);
}
async updatePool(poolId, args) {
await this.send({
method: "PUT",
path: `/pool/${poolId}`,
body: json(args),
contentType: "application/json"
});
return true;
}
subscribe() {
return new import_event_source_polyfill.EventSourcePolyfill(this.baseURL + "/events", {
headers: { Accept: "application/json" }
});
}
curl(query, opts = {}) {
const options = defaults(opts, {
format: "zjson",
controlMessages: true
});
return `curl -X POST -d '${JSON.stringify({ query })}' \\
-H "Accept: ${accept(options.format)}" \\
-H "Content-Type: application/json" \\
${this.baseURL}/query`;
}
async send(opts) {
const abortCtl = wrapAbort(opts.signal);
const clearTimer = this.setTimeout(() => {
console.error("request timed out:", opts);
abortCtl.abort();
}, opts.timeout);
const headers = { ...opts.headers };
headers["Accept"] = accept(opts.format || "zjson");
if (opts.contentType !== void 0) {
headers["Content-Type"] = opts.contentType;
}
if (this.auth) {
headers["Authorization"] = `Bearer ${this.auth}`;
}
const resp = await Client.fetch(this.baseURL + opts.path, {
method: opts.method,
signal: abortCtl.signal,
headers,
// @ts-ignore
body: opts.body
});
clearTimer();
if (resp.ok) {
return resp;
} else {
return Promise.reject(createError(await parseContent(resp)));
}
}
setTimeout(fn, ms) {
if (ms === Infinity)
return () => {
};
if ((0, import_lodash9.isUndefined)(ms))
ms = this.timeout;
const id = setTimeout(fn, ms);
return () => clearTimeout(id);
}
};
// src/esm/index.ts
Client.fetch = window.fetch.bind(window);
var Client2 = Client;
export {
Client2 as Client,
DefaultContext,
ResultStream,
createData,
createField,
createRecord,
decode,
encode,
parseAst,
zjson_exports as zjson
};
/*! Bundled license information:
lodash/lodash.js:
(**
* @license
* Lodash
* Copyright OpenJS Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*)
event-source-polyfill/src/eventsource.js:
(** @license
* eventsource.js
* Available under MIT License (MIT)
* https://github.com/Yaffle/EventSource/
*)
@js-joda/core/dist/js-joda.esm.js:
(*! @version @js-joda/core - 4.3.1 *)
(*! @copyright (c) 2015-present, Philipp Thürwächter, Pattrick Hüper & js-joda contributors *)
(*! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos *)
(*! @license BSD-3-Clause (see LICENSE in the root directory of this source tree) *)
(**
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
*)
(*
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
*)
(**
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
*)
(*
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
* @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
*)
(*
* @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
*)
*/