@johpaz/hive-sdk 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/index.js +171573 -11091
- package/dist/channels/index.js +3702 -51
- package/dist/cron/index.js +806 -7
- package/dist/database/index.js +2636 -2
- package/dist/ethics/index.js +2636 -2
- package/dist/index.js +172848 -11349
- package/dist/mcp/index.js +25 -0
- package/dist/skills/index.js +2636 -2
- package/dist/tools/index.js +167497 -7015
- package/package.json +3 -2
package/dist/ethics/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
2
4
|
var __defProp = Object.defineProperty;
|
|
3
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,6 +8,28 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
6
8
|
function __accessProp(key) {
|
|
7
9
|
return this[key];
|
|
8
10
|
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
13
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
21
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
9
33
|
var __toCommonJS = (from) => {
|
|
10
34
|
var entry = (__moduleCache ??= new WeakMap).get(from), desc;
|
|
11
35
|
if (entry)
|
|
@@ -23,6 +47,7 @@ var __toCommonJS = (from) => {
|
|
|
23
47
|
return entry;
|
|
24
48
|
};
|
|
25
49
|
var __moduleCache;
|
|
50
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
26
51
|
var __returnValue = (v) => v;
|
|
27
52
|
function __exportSetter(name, newValue) {
|
|
28
53
|
this[name] = __returnValue.bind(null, newValue);
|
|
@@ -1746,6 +1771,2615 @@ function maskApiKey(apiKey) {
|
|
|
1746
1771
|
var _encryptionKey = null;
|
|
1747
1772
|
var init_crypto = () => {};
|
|
1748
1773
|
|
|
1774
|
+
// ../../node_modules/.bun/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
1775
|
+
function isNothing(subject) {
|
|
1776
|
+
return typeof subject === "undefined" || subject === null;
|
|
1777
|
+
}
|
|
1778
|
+
function isObject(subject) {
|
|
1779
|
+
return typeof subject === "object" && subject !== null;
|
|
1780
|
+
}
|
|
1781
|
+
function toArray(sequence) {
|
|
1782
|
+
if (Array.isArray(sequence))
|
|
1783
|
+
return sequence;
|
|
1784
|
+
else if (isNothing(sequence))
|
|
1785
|
+
return [];
|
|
1786
|
+
return [sequence];
|
|
1787
|
+
}
|
|
1788
|
+
function extend(target, source) {
|
|
1789
|
+
var index, length, key, sourceKeys;
|
|
1790
|
+
if (source) {
|
|
1791
|
+
sourceKeys = Object.keys(source);
|
|
1792
|
+
for (index = 0, length = sourceKeys.length;index < length; index += 1) {
|
|
1793
|
+
key = sourceKeys[index];
|
|
1794
|
+
target[key] = source[key];
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return target;
|
|
1798
|
+
}
|
|
1799
|
+
function repeat(string2, count) {
|
|
1800
|
+
var result = "", cycle;
|
|
1801
|
+
for (cycle = 0;cycle < count; cycle += 1) {
|
|
1802
|
+
result += string2;
|
|
1803
|
+
}
|
|
1804
|
+
return result;
|
|
1805
|
+
}
|
|
1806
|
+
function isNegativeZero(number2) {
|
|
1807
|
+
return number2 === 0 && Number.NEGATIVE_INFINITY === 1 / number2;
|
|
1808
|
+
}
|
|
1809
|
+
function formatError(exception, compact) {
|
|
1810
|
+
var where = "", message = exception.reason || "(unknown reason)";
|
|
1811
|
+
if (!exception.mark)
|
|
1812
|
+
return message;
|
|
1813
|
+
if (exception.mark.name) {
|
|
1814
|
+
where += 'in "' + exception.mark.name + '" ';
|
|
1815
|
+
}
|
|
1816
|
+
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
1817
|
+
if (!compact && exception.mark.snippet) {
|
|
1818
|
+
where += `
|
|
1819
|
+
|
|
1820
|
+
` + exception.mark.snippet;
|
|
1821
|
+
}
|
|
1822
|
+
return message + " " + where;
|
|
1823
|
+
}
|
|
1824
|
+
function YAMLException$1(reason, mark) {
|
|
1825
|
+
Error.call(this);
|
|
1826
|
+
this.name = "YAMLException";
|
|
1827
|
+
this.reason = reason;
|
|
1828
|
+
this.mark = mark;
|
|
1829
|
+
this.message = formatError(this, false);
|
|
1830
|
+
if (Error.captureStackTrace) {
|
|
1831
|
+
Error.captureStackTrace(this, this.constructor);
|
|
1832
|
+
} else {
|
|
1833
|
+
this.stack = new Error().stack || "";
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
1837
|
+
var head = "";
|
|
1838
|
+
var tail = "";
|
|
1839
|
+
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
1840
|
+
if (position - lineStart > maxHalfLength) {
|
|
1841
|
+
head = " ... ";
|
|
1842
|
+
lineStart = position - maxHalfLength + head.length;
|
|
1843
|
+
}
|
|
1844
|
+
if (lineEnd - position > maxHalfLength) {
|
|
1845
|
+
tail = " ...";
|
|
1846
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
1847
|
+
}
|
|
1848
|
+
return {
|
|
1849
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
1850
|
+
pos: position - lineStart + head.length
|
|
1851
|
+
};
|
|
1852
|
+
}
|
|
1853
|
+
function padStart(string2, max) {
|
|
1854
|
+
return common.repeat(" ", max - string2.length) + string2;
|
|
1855
|
+
}
|
|
1856
|
+
function makeSnippet(mark, options) {
|
|
1857
|
+
options = Object.create(options || null);
|
|
1858
|
+
if (!mark.buffer)
|
|
1859
|
+
return null;
|
|
1860
|
+
if (!options.maxLength)
|
|
1861
|
+
options.maxLength = 79;
|
|
1862
|
+
if (typeof options.indent !== "number")
|
|
1863
|
+
options.indent = 1;
|
|
1864
|
+
if (typeof options.linesBefore !== "number")
|
|
1865
|
+
options.linesBefore = 3;
|
|
1866
|
+
if (typeof options.linesAfter !== "number")
|
|
1867
|
+
options.linesAfter = 2;
|
|
1868
|
+
var re = /\r?\n|\r|\0/g;
|
|
1869
|
+
var lineStarts = [0];
|
|
1870
|
+
var lineEnds = [];
|
|
1871
|
+
var match;
|
|
1872
|
+
var foundLineNo = -1;
|
|
1873
|
+
while (match = re.exec(mark.buffer)) {
|
|
1874
|
+
lineEnds.push(match.index);
|
|
1875
|
+
lineStarts.push(match.index + match[0].length);
|
|
1876
|
+
if (mark.position <= match.index && foundLineNo < 0) {
|
|
1877
|
+
foundLineNo = lineStarts.length - 2;
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
if (foundLineNo < 0)
|
|
1881
|
+
foundLineNo = lineStarts.length - 1;
|
|
1882
|
+
var result = "", i, line;
|
|
1883
|
+
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
1884
|
+
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
1885
|
+
for (i = 1;i <= options.linesBefore; i++) {
|
|
1886
|
+
if (foundLineNo - i < 0)
|
|
1887
|
+
break;
|
|
1888
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
1889
|
+
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
1890
|
+
` + result;
|
|
1891
|
+
}
|
|
1892
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
1893
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
1894
|
+
`;
|
|
1895
|
+
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^" + `
|
|
1896
|
+
`;
|
|
1897
|
+
for (i = 1;i <= options.linesAfter; i++) {
|
|
1898
|
+
if (foundLineNo + i >= lineEnds.length)
|
|
1899
|
+
break;
|
|
1900
|
+
line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
1901
|
+
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + `
|
|
1902
|
+
`;
|
|
1903
|
+
}
|
|
1904
|
+
return result.replace(/\n$/, "");
|
|
1905
|
+
}
|
|
1906
|
+
function compileStyleAliases(map) {
|
|
1907
|
+
var result = {};
|
|
1908
|
+
if (map !== null) {
|
|
1909
|
+
Object.keys(map).forEach(function(style) {
|
|
1910
|
+
map[style].forEach(function(alias) {
|
|
1911
|
+
result[String(alias)] = style;
|
|
1912
|
+
});
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
return result;
|
|
1916
|
+
}
|
|
1917
|
+
function Type$1(tag, options) {
|
|
1918
|
+
options = options || {};
|
|
1919
|
+
Object.keys(options).forEach(function(name) {
|
|
1920
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
1921
|
+
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
1922
|
+
}
|
|
1923
|
+
});
|
|
1924
|
+
this.options = options;
|
|
1925
|
+
this.tag = tag;
|
|
1926
|
+
this.kind = options["kind"] || null;
|
|
1927
|
+
this.resolve = options["resolve"] || function() {
|
|
1928
|
+
return true;
|
|
1929
|
+
};
|
|
1930
|
+
this.construct = options["construct"] || function(data) {
|
|
1931
|
+
return data;
|
|
1932
|
+
};
|
|
1933
|
+
this.instanceOf = options["instanceOf"] || null;
|
|
1934
|
+
this.predicate = options["predicate"] || null;
|
|
1935
|
+
this.represent = options["represent"] || null;
|
|
1936
|
+
this.representName = options["representName"] || null;
|
|
1937
|
+
this.defaultStyle = options["defaultStyle"] || null;
|
|
1938
|
+
this.multi = options["multi"] || false;
|
|
1939
|
+
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
1940
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
1941
|
+
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
function compileList(schema, name) {
|
|
1945
|
+
var result = [];
|
|
1946
|
+
schema[name].forEach(function(currentType) {
|
|
1947
|
+
var newIndex = result.length;
|
|
1948
|
+
result.forEach(function(previousType, previousIndex) {
|
|
1949
|
+
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
|
1950
|
+
newIndex = previousIndex;
|
|
1951
|
+
}
|
|
1952
|
+
});
|
|
1953
|
+
result[newIndex] = currentType;
|
|
1954
|
+
});
|
|
1955
|
+
return result;
|
|
1956
|
+
}
|
|
1957
|
+
function compileMap() {
|
|
1958
|
+
var result = {
|
|
1959
|
+
scalar: {},
|
|
1960
|
+
sequence: {},
|
|
1961
|
+
mapping: {},
|
|
1962
|
+
fallback: {},
|
|
1963
|
+
multi: {
|
|
1964
|
+
scalar: [],
|
|
1965
|
+
sequence: [],
|
|
1966
|
+
mapping: [],
|
|
1967
|
+
fallback: []
|
|
1968
|
+
}
|
|
1969
|
+
}, index, length;
|
|
1970
|
+
function collectType(type2) {
|
|
1971
|
+
if (type2.multi) {
|
|
1972
|
+
result.multi[type2.kind].push(type2);
|
|
1973
|
+
result.multi["fallback"].push(type2);
|
|
1974
|
+
} else {
|
|
1975
|
+
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
for (index = 0, length = arguments.length;index < length; index += 1) {
|
|
1979
|
+
arguments[index].forEach(collectType);
|
|
1980
|
+
}
|
|
1981
|
+
return result;
|
|
1982
|
+
}
|
|
1983
|
+
function Schema$1(definition) {
|
|
1984
|
+
return this.extend(definition);
|
|
1985
|
+
}
|
|
1986
|
+
function resolveYamlNull(data) {
|
|
1987
|
+
if (data === null)
|
|
1988
|
+
return true;
|
|
1989
|
+
var max = data.length;
|
|
1990
|
+
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
1991
|
+
}
|
|
1992
|
+
function constructYamlNull() {
|
|
1993
|
+
return null;
|
|
1994
|
+
}
|
|
1995
|
+
function isNull(object2) {
|
|
1996
|
+
return object2 === null;
|
|
1997
|
+
}
|
|
1998
|
+
function resolveYamlBoolean(data) {
|
|
1999
|
+
if (data === null)
|
|
2000
|
+
return false;
|
|
2001
|
+
var max = data.length;
|
|
2002
|
+
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
2003
|
+
}
|
|
2004
|
+
function constructYamlBoolean(data) {
|
|
2005
|
+
return data === "true" || data === "True" || data === "TRUE";
|
|
2006
|
+
}
|
|
2007
|
+
function isBoolean(object2) {
|
|
2008
|
+
return Object.prototype.toString.call(object2) === "[object Boolean]";
|
|
2009
|
+
}
|
|
2010
|
+
function isHexCode(c) {
|
|
2011
|
+
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
2012
|
+
}
|
|
2013
|
+
function isOctCode(c) {
|
|
2014
|
+
return 48 <= c && c <= 55;
|
|
2015
|
+
}
|
|
2016
|
+
function isDecCode(c) {
|
|
2017
|
+
return 48 <= c && c <= 57;
|
|
2018
|
+
}
|
|
2019
|
+
function resolveYamlInteger(data) {
|
|
2020
|
+
if (data === null)
|
|
2021
|
+
return false;
|
|
2022
|
+
var max = data.length, index = 0, hasDigits = false, ch;
|
|
2023
|
+
if (!max)
|
|
2024
|
+
return false;
|
|
2025
|
+
ch = data[index];
|
|
2026
|
+
if (ch === "-" || ch === "+") {
|
|
2027
|
+
ch = data[++index];
|
|
2028
|
+
}
|
|
2029
|
+
if (ch === "0") {
|
|
2030
|
+
if (index + 1 === max)
|
|
2031
|
+
return true;
|
|
2032
|
+
ch = data[++index];
|
|
2033
|
+
if (ch === "b") {
|
|
2034
|
+
index++;
|
|
2035
|
+
for (;index < max; index++) {
|
|
2036
|
+
ch = data[index];
|
|
2037
|
+
if (ch === "_")
|
|
2038
|
+
continue;
|
|
2039
|
+
if (ch !== "0" && ch !== "1")
|
|
2040
|
+
return false;
|
|
2041
|
+
hasDigits = true;
|
|
2042
|
+
}
|
|
2043
|
+
return hasDigits && ch !== "_";
|
|
2044
|
+
}
|
|
2045
|
+
if (ch === "x") {
|
|
2046
|
+
index++;
|
|
2047
|
+
for (;index < max; index++) {
|
|
2048
|
+
ch = data[index];
|
|
2049
|
+
if (ch === "_")
|
|
2050
|
+
continue;
|
|
2051
|
+
if (!isHexCode(data.charCodeAt(index)))
|
|
2052
|
+
return false;
|
|
2053
|
+
hasDigits = true;
|
|
2054
|
+
}
|
|
2055
|
+
return hasDigits && ch !== "_";
|
|
2056
|
+
}
|
|
2057
|
+
if (ch === "o") {
|
|
2058
|
+
index++;
|
|
2059
|
+
for (;index < max; index++) {
|
|
2060
|
+
ch = data[index];
|
|
2061
|
+
if (ch === "_")
|
|
2062
|
+
continue;
|
|
2063
|
+
if (!isOctCode(data.charCodeAt(index)))
|
|
2064
|
+
return false;
|
|
2065
|
+
hasDigits = true;
|
|
2066
|
+
}
|
|
2067
|
+
return hasDigits && ch !== "_";
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
if (ch === "_")
|
|
2071
|
+
return false;
|
|
2072
|
+
for (;index < max; index++) {
|
|
2073
|
+
ch = data[index];
|
|
2074
|
+
if (ch === "_")
|
|
2075
|
+
continue;
|
|
2076
|
+
if (!isDecCode(data.charCodeAt(index))) {
|
|
2077
|
+
return false;
|
|
2078
|
+
}
|
|
2079
|
+
hasDigits = true;
|
|
2080
|
+
}
|
|
2081
|
+
if (!hasDigits || ch === "_")
|
|
2082
|
+
return false;
|
|
2083
|
+
return true;
|
|
2084
|
+
}
|
|
2085
|
+
function constructYamlInteger(data) {
|
|
2086
|
+
var value = data, sign = 1, ch;
|
|
2087
|
+
if (value.indexOf("_") !== -1) {
|
|
2088
|
+
value = value.replace(/_/g, "");
|
|
2089
|
+
}
|
|
2090
|
+
ch = value[0];
|
|
2091
|
+
if (ch === "-" || ch === "+") {
|
|
2092
|
+
if (ch === "-")
|
|
2093
|
+
sign = -1;
|
|
2094
|
+
value = value.slice(1);
|
|
2095
|
+
ch = value[0];
|
|
2096
|
+
}
|
|
2097
|
+
if (value === "0")
|
|
2098
|
+
return 0;
|
|
2099
|
+
if (ch === "0") {
|
|
2100
|
+
if (value[1] === "b")
|
|
2101
|
+
return sign * parseInt(value.slice(2), 2);
|
|
2102
|
+
if (value[1] === "x")
|
|
2103
|
+
return sign * parseInt(value.slice(2), 16);
|
|
2104
|
+
if (value[1] === "o")
|
|
2105
|
+
return sign * parseInt(value.slice(2), 8);
|
|
2106
|
+
}
|
|
2107
|
+
return sign * parseInt(value, 10);
|
|
2108
|
+
}
|
|
2109
|
+
function isInteger(object2) {
|
|
2110
|
+
return Object.prototype.toString.call(object2) === "[object Number]" && (object2 % 1 === 0 && !common.isNegativeZero(object2));
|
|
2111
|
+
}
|
|
2112
|
+
function resolveYamlFloat(data) {
|
|
2113
|
+
if (data === null)
|
|
2114
|
+
return false;
|
|
2115
|
+
if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
|
|
2116
|
+
return false;
|
|
2117
|
+
}
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
function constructYamlFloat(data) {
|
|
2121
|
+
var value, sign;
|
|
2122
|
+
value = data.replace(/_/g, "").toLowerCase();
|
|
2123
|
+
sign = value[0] === "-" ? -1 : 1;
|
|
2124
|
+
if ("+-".indexOf(value[0]) >= 0) {
|
|
2125
|
+
value = value.slice(1);
|
|
2126
|
+
}
|
|
2127
|
+
if (value === ".inf") {
|
|
2128
|
+
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
2129
|
+
} else if (value === ".nan") {
|
|
2130
|
+
return NaN;
|
|
2131
|
+
}
|
|
2132
|
+
return sign * parseFloat(value, 10);
|
|
2133
|
+
}
|
|
2134
|
+
function representYamlFloat(object2, style) {
|
|
2135
|
+
var res;
|
|
2136
|
+
if (isNaN(object2)) {
|
|
2137
|
+
switch (style) {
|
|
2138
|
+
case "lowercase":
|
|
2139
|
+
return ".nan";
|
|
2140
|
+
case "uppercase":
|
|
2141
|
+
return ".NAN";
|
|
2142
|
+
case "camelcase":
|
|
2143
|
+
return ".NaN";
|
|
2144
|
+
}
|
|
2145
|
+
} else if (Number.POSITIVE_INFINITY === object2) {
|
|
2146
|
+
switch (style) {
|
|
2147
|
+
case "lowercase":
|
|
2148
|
+
return ".inf";
|
|
2149
|
+
case "uppercase":
|
|
2150
|
+
return ".INF";
|
|
2151
|
+
case "camelcase":
|
|
2152
|
+
return ".Inf";
|
|
2153
|
+
}
|
|
2154
|
+
} else if (Number.NEGATIVE_INFINITY === object2) {
|
|
2155
|
+
switch (style) {
|
|
2156
|
+
case "lowercase":
|
|
2157
|
+
return "-.inf";
|
|
2158
|
+
case "uppercase":
|
|
2159
|
+
return "-.INF";
|
|
2160
|
+
case "camelcase":
|
|
2161
|
+
return "-.Inf";
|
|
2162
|
+
}
|
|
2163
|
+
} else if (common.isNegativeZero(object2)) {
|
|
2164
|
+
return "-0.0";
|
|
2165
|
+
}
|
|
2166
|
+
res = object2.toString(10);
|
|
2167
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
2168
|
+
}
|
|
2169
|
+
function isFloat(object2) {
|
|
2170
|
+
return Object.prototype.toString.call(object2) === "[object Number]" && (object2 % 1 !== 0 || common.isNegativeZero(object2));
|
|
2171
|
+
}
|
|
2172
|
+
function resolveYamlTimestamp(data) {
|
|
2173
|
+
if (data === null)
|
|
2174
|
+
return false;
|
|
2175
|
+
if (YAML_DATE_REGEXP.exec(data) !== null)
|
|
2176
|
+
return true;
|
|
2177
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
|
2178
|
+
return true;
|
|
2179
|
+
return false;
|
|
2180
|
+
}
|
|
2181
|
+
function constructYamlTimestamp(data) {
|
|
2182
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
2183
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
2184
|
+
if (match === null)
|
|
2185
|
+
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
2186
|
+
if (match === null)
|
|
2187
|
+
throw new Error("Date resolve error");
|
|
2188
|
+
year = +match[1];
|
|
2189
|
+
month = +match[2] - 1;
|
|
2190
|
+
day = +match[3];
|
|
2191
|
+
if (!match[4]) {
|
|
2192
|
+
return new Date(Date.UTC(year, month, day));
|
|
2193
|
+
}
|
|
2194
|
+
hour = +match[4];
|
|
2195
|
+
minute = +match[5];
|
|
2196
|
+
second = +match[6];
|
|
2197
|
+
if (match[7]) {
|
|
2198
|
+
fraction = match[7].slice(0, 3);
|
|
2199
|
+
while (fraction.length < 3) {
|
|
2200
|
+
fraction += "0";
|
|
2201
|
+
}
|
|
2202
|
+
fraction = +fraction;
|
|
2203
|
+
}
|
|
2204
|
+
if (match[9]) {
|
|
2205
|
+
tz_hour = +match[10];
|
|
2206
|
+
tz_minute = +(match[11] || 0);
|
|
2207
|
+
delta = (tz_hour * 60 + tz_minute) * 60000;
|
|
2208
|
+
if (match[9] === "-")
|
|
2209
|
+
delta = -delta;
|
|
2210
|
+
}
|
|
2211
|
+
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
2212
|
+
if (delta)
|
|
2213
|
+
date.setTime(date.getTime() - delta);
|
|
2214
|
+
return date;
|
|
2215
|
+
}
|
|
2216
|
+
function representYamlTimestamp(object2) {
|
|
2217
|
+
return object2.toISOString();
|
|
2218
|
+
}
|
|
2219
|
+
function resolveYamlMerge(data) {
|
|
2220
|
+
return data === "<<" || data === null;
|
|
2221
|
+
}
|
|
2222
|
+
function resolveYamlBinary(data) {
|
|
2223
|
+
if (data === null)
|
|
2224
|
+
return false;
|
|
2225
|
+
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
2226
|
+
for (idx = 0;idx < max; idx++) {
|
|
2227
|
+
code = map2.indexOf(data.charAt(idx));
|
|
2228
|
+
if (code > 64)
|
|
2229
|
+
continue;
|
|
2230
|
+
if (code < 0)
|
|
2231
|
+
return false;
|
|
2232
|
+
bitlen += 6;
|
|
2233
|
+
}
|
|
2234
|
+
return bitlen % 8 === 0;
|
|
2235
|
+
}
|
|
2236
|
+
function constructYamlBinary(data) {
|
|
2237
|
+
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
|
2238
|
+
for (idx = 0;idx < max; idx++) {
|
|
2239
|
+
if (idx % 4 === 0 && idx) {
|
|
2240
|
+
result.push(bits >> 16 & 255);
|
|
2241
|
+
result.push(bits >> 8 & 255);
|
|
2242
|
+
result.push(bits & 255);
|
|
2243
|
+
}
|
|
2244
|
+
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
2245
|
+
}
|
|
2246
|
+
tailbits = max % 4 * 6;
|
|
2247
|
+
if (tailbits === 0) {
|
|
2248
|
+
result.push(bits >> 16 & 255);
|
|
2249
|
+
result.push(bits >> 8 & 255);
|
|
2250
|
+
result.push(bits & 255);
|
|
2251
|
+
} else if (tailbits === 18) {
|
|
2252
|
+
result.push(bits >> 10 & 255);
|
|
2253
|
+
result.push(bits >> 2 & 255);
|
|
2254
|
+
} else if (tailbits === 12) {
|
|
2255
|
+
result.push(bits >> 4 & 255);
|
|
2256
|
+
}
|
|
2257
|
+
return new Uint8Array(result);
|
|
2258
|
+
}
|
|
2259
|
+
function representYamlBinary(object2) {
|
|
2260
|
+
var result = "", bits = 0, idx, tail, max = object2.length, map2 = BASE64_MAP;
|
|
2261
|
+
for (idx = 0;idx < max; idx++) {
|
|
2262
|
+
if (idx % 3 === 0 && idx) {
|
|
2263
|
+
result += map2[bits >> 18 & 63];
|
|
2264
|
+
result += map2[bits >> 12 & 63];
|
|
2265
|
+
result += map2[bits >> 6 & 63];
|
|
2266
|
+
result += map2[bits & 63];
|
|
2267
|
+
}
|
|
2268
|
+
bits = (bits << 8) + object2[idx];
|
|
2269
|
+
}
|
|
2270
|
+
tail = max % 3;
|
|
2271
|
+
if (tail === 0) {
|
|
2272
|
+
result += map2[bits >> 18 & 63];
|
|
2273
|
+
result += map2[bits >> 12 & 63];
|
|
2274
|
+
result += map2[bits >> 6 & 63];
|
|
2275
|
+
result += map2[bits & 63];
|
|
2276
|
+
} else if (tail === 2) {
|
|
2277
|
+
result += map2[bits >> 10 & 63];
|
|
2278
|
+
result += map2[bits >> 4 & 63];
|
|
2279
|
+
result += map2[bits << 2 & 63];
|
|
2280
|
+
result += map2[64];
|
|
2281
|
+
} else if (tail === 1) {
|
|
2282
|
+
result += map2[bits >> 2 & 63];
|
|
2283
|
+
result += map2[bits << 4 & 63];
|
|
2284
|
+
result += map2[64];
|
|
2285
|
+
result += map2[64];
|
|
2286
|
+
}
|
|
2287
|
+
return result;
|
|
2288
|
+
}
|
|
2289
|
+
function isBinary(obj) {
|
|
2290
|
+
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
|
2291
|
+
}
|
|
2292
|
+
function resolveYamlOmap(data) {
|
|
2293
|
+
if (data === null)
|
|
2294
|
+
return true;
|
|
2295
|
+
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object2 = data;
|
|
2296
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
2297
|
+
pair = object2[index];
|
|
2298
|
+
pairHasKey = false;
|
|
2299
|
+
if (_toString$2.call(pair) !== "[object Object]")
|
|
2300
|
+
return false;
|
|
2301
|
+
for (pairKey in pair) {
|
|
2302
|
+
if (_hasOwnProperty$3.call(pair, pairKey)) {
|
|
2303
|
+
if (!pairHasKey)
|
|
2304
|
+
pairHasKey = true;
|
|
2305
|
+
else
|
|
2306
|
+
return false;
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
if (!pairHasKey)
|
|
2310
|
+
return false;
|
|
2311
|
+
if (objectKeys.indexOf(pairKey) === -1)
|
|
2312
|
+
objectKeys.push(pairKey);
|
|
2313
|
+
else
|
|
2314
|
+
return false;
|
|
2315
|
+
}
|
|
2316
|
+
return true;
|
|
2317
|
+
}
|
|
2318
|
+
function constructYamlOmap(data) {
|
|
2319
|
+
return data !== null ? data : [];
|
|
2320
|
+
}
|
|
2321
|
+
function resolveYamlPairs(data) {
|
|
2322
|
+
if (data === null)
|
|
2323
|
+
return true;
|
|
2324
|
+
var index, length, pair, keys, result, object2 = data;
|
|
2325
|
+
result = new Array(object2.length);
|
|
2326
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
2327
|
+
pair = object2[index];
|
|
2328
|
+
if (_toString$1.call(pair) !== "[object Object]")
|
|
2329
|
+
return false;
|
|
2330
|
+
keys = Object.keys(pair);
|
|
2331
|
+
if (keys.length !== 1)
|
|
2332
|
+
return false;
|
|
2333
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
2334
|
+
}
|
|
2335
|
+
return true;
|
|
2336
|
+
}
|
|
2337
|
+
function constructYamlPairs(data) {
|
|
2338
|
+
if (data === null)
|
|
2339
|
+
return [];
|
|
2340
|
+
var index, length, pair, keys, result, object2 = data;
|
|
2341
|
+
result = new Array(object2.length);
|
|
2342
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
2343
|
+
pair = object2[index];
|
|
2344
|
+
keys = Object.keys(pair);
|
|
2345
|
+
result[index] = [keys[0], pair[keys[0]]];
|
|
2346
|
+
}
|
|
2347
|
+
return result;
|
|
2348
|
+
}
|
|
2349
|
+
function resolveYamlSet(data) {
|
|
2350
|
+
if (data === null)
|
|
2351
|
+
return true;
|
|
2352
|
+
var key, object2 = data;
|
|
2353
|
+
for (key in object2) {
|
|
2354
|
+
if (_hasOwnProperty$2.call(object2, key)) {
|
|
2355
|
+
if (object2[key] !== null)
|
|
2356
|
+
return false;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
return true;
|
|
2360
|
+
}
|
|
2361
|
+
function constructYamlSet(data) {
|
|
2362
|
+
return data !== null ? data : {};
|
|
2363
|
+
}
|
|
2364
|
+
function _class(obj) {
|
|
2365
|
+
return Object.prototype.toString.call(obj);
|
|
2366
|
+
}
|
|
2367
|
+
function is_EOL(c) {
|
|
2368
|
+
return c === 10 || c === 13;
|
|
2369
|
+
}
|
|
2370
|
+
function is_WHITE_SPACE(c) {
|
|
2371
|
+
return c === 9 || c === 32;
|
|
2372
|
+
}
|
|
2373
|
+
function is_WS_OR_EOL(c) {
|
|
2374
|
+
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
2375
|
+
}
|
|
2376
|
+
function is_FLOW_INDICATOR(c) {
|
|
2377
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
2378
|
+
}
|
|
2379
|
+
function fromHexCode(c) {
|
|
2380
|
+
var lc;
|
|
2381
|
+
if (48 <= c && c <= 57) {
|
|
2382
|
+
return c - 48;
|
|
2383
|
+
}
|
|
2384
|
+
lc = c | 32;
|
|
2385
|
+
if (97 <= lc && lc <= 102) {
|
|
2386
|
+
return lc - 97 + 10;
|
|
2387
|
+
}
|
|
2388
|
+
return -1;
|
|
2389
|
+
}
|
|
2390
|
+
function escapedHexLen(c) {
|
|
2391
|
+
if (c === 120) {
|
|
2392
|
+
return 2;
|
|
2393
|
+
}
|
|
2394
|
+
if (c === 117) {
|
|
2395
|
+
return 4;
|
|
2396
|
+
}
|
|
2397
|
+
if (c === 85) {
|
|
2398
|
+
return 8;
|
|
2399
|
+
}
|
|
2400
|
+
return 0;
|
|
2401
|
+
}
|
|
2402
|
+
function fromDecimalCode(c) {
|
|
2403
|
+
if (48 <= c && c <= 57) {
|
|
2404
|
+
return c - 48;
|
|
2405
|
+
}
|
|
2406
|
+
return -1;
|
|
2407
|
+
}
|
|
2408
|
+
function simpleEscapeSequence(c) {
|
|
2409
|
+
return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
|
|
2410
|
+
` : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
2411
|
+
}
|
|
2412
|
+
function charFromCodepoint(c) {
|
|
2413
|
+
if (c <= 65535) {
|
|
2414
|
+
return String.fromCharCode(c);
|
|
2415
|
+
}
|
|
2416
|
+
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
2417
|
+
}
|
|
2418
|
+
function setProperty(object2, key, value) {
|
|
2419
|
+
if (key === "__proto__") {
|
|
2420
|
+
Object.defineProperty(object2, key, {
|
|
2421
|
+
configurable: true,
|
|
2422
|
+
enumerable: true,
|
|
2423
|
+
writable: true,
|
|
2424
|
+
value
|
|
2425
|
+
});
|
|
2426
|
+
} else {
|
|
2427
|
+
object2[key] = value;
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
function State$1(input, options) {
|
|
2431
|
+
this.input = input;
|
|
2432
|
+
this.filename = options["filename"] || null;
|
|
2433
|
+
this.schema = options["schema"] || _default;
|
|
2434
|
+
this.onWarning = options["onWarning"] || null;
|
|
2435
|
+
this.legacy = options["legacy"] || false;
|
|
2436
|
+
this.json = options["json"] || false;
|
|
2437
|
+
this.listener = options["listener"] || null;
|
|
2438
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
2439
|
+
this.typeMap = this.schema.compiledTypeMap;
|
|
2440
|
+
this.length = input.length;
|
|
2441
|
+
this.position = 0;
|
|
2442
|
+
this.line = 0;
|
|
2443
|
+
this.lineStart = 0;
|
|
2444
|
+
this.lineIndent = 0;
|
|
2445
|
+
this.firstTabInLine = -1;
|
|
2446
|
+
this.documents = [];
|
|
2447
|
+
}
|
|
2448
|
+
function generateError(state, message) {
|
|
2449
|
+
var mark = {
|
|
2450
|
+
name: state.filename,
|
|
2451
|
+
buffer: state.input.slice(0, -1),
|
|
2452
|
+
position: state.position,
|
|
2453
|
+
line: state.line,
|
|
2454
|
+
column: state.position - state.lineStart
|
|
2455
|
+
};
|
|
2456
|
+
mark.snippet = snippet(mark);
|
|
2457
|
+
return new exception(message, mark);
|
|
2458
|
+
}
|
|
2459
|
+
function throwError(state, message) {
|
|
2460
|
+
throw generateError(state, message);
|
|
2461
|
+
}
|
|
2462
|
+
function throwWarning(state, message) {
|
|
2463
|
+
if (state.onWarning) {
|
|
2464
|
+
state.onWarning.call(null, generateError(state, message));
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
function captureSegment(state, start, end, checkJson) {
|
|
2468
|
+
var _position, _length, _character, _result;
|
|
2469
|
+
if (start < end) {
|
|
2470
|
+
_result = state.input.slice(start, end);
|
|
2471
|
+
if (checkJson) {
|
|
2472
|
+
for (_position = 0, _length = _result.length;_position < _length; _position += 1) {
|
|
2473
|
+
_character = _result.charCodeAt(_position);
|
|
2474
|
+
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
2475
|
+
throwError(state, "expected valid JSON character");
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
2479
|
+
throwError(state, "the stream contains non-printable characters");
|
|
2480
|
+
}
|
|
2481
|
+
state.result += _result;
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
2485
|
+
var sourceKeys, key, index, quantity;
|
|
2486
|
+
if (!common.isObject(source)) {
|
|
2487
|
+
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
2488
|
+
}
|
|
2489
|
+
sourceKeys = Object.keys(source);
|
|
2490
|
+
for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
|
|
2491
|
+
key = sourceKeys[index];
|
|
2492
|
+
if (!_hasOwnProperty$1.call(destination, key)) {
|
|
2493
|
+
setProperty(destination, key, source[key]);
|
|
2494
|
+
overridableKeys[key] = true;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
|
2499
|
+
var index, quantity;
|
|
2500
|
+
if (Array.isArray(keyNode)) {
|
|
2501
|
+
keyNode = Array.prototype.slice.call(keyNode);
|
|
2502
|
+
for (index = 0, quantity = keyNode.length;index < quantity; index += 1) {
|
|
2503
|
+
if (Array.isArray(keyNode[index])) {
|
|
2504
|
+
throwError(state, "nested arrays are not supported inside keys");
|
|
2505
|
+
}
|
|
2506
|
+
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
2507
|
+
keyNode[index] = "[object Object]";
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
2512
|
+
keyNode = "[object Object]";
|
|
2513
|
+
}
|
|
2514
|
+
keyNode = String(keyNode);
|
|
2515
|
+
if (_result === null) {
|
|
2516
|
+
_result = {};
|
|
2517
|
+
}
|
|
2518
|
+
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
2519
|
+
if (Array.isArray(valueNode)) {
|
|
2520
|
+
for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
|
|
2521
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
2522
|
+
}
|
|
2523
|
+
} else {
|
|
2524
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
2525
|
+
}
|
|
2526
|
+
} else {
|
|
2527
|
+
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
|
2528
|
+
state.line = startLine || state.line;
|
|
2529
|
+
state.lineStart = startLineStart || state.lineStart;
|
|
2530
|
+
state.position = startPos || state.position;
|
|
2531
|
+
throwError(state, "duplicated mapping key");
|
|
2532
|
+
}
|
|
2533
|
+
setProperty(_result, keyNode, valueNode);
|
|
2534
|
+
delete overridableKeys[keyNode];
|
|
2535
|
+
}
|
|
2536
|
+
return _result;
|
|
2537
|
+
}
|
|
2538
|
+
function readLineBreak(state) {
|
|
2539
|
+
var ch;
|
|
2540
|
+
ch = state.input.charCodeAt(state.position);
|
|
2541
|
+
if (ch === 10) {
|
|
2542
|
+
state.position++;
|
|
2543
|
+
} else if (ch === 13) {
|
|
2544
|
+
state.position++;
|
|
2545
|
+
if (state.input.charCodeAt(state.position) === 10) {
|
|
2546
|
+
state.position++;
|
|
2547
|
+
}
|
|
2548
|
+
} else {
|
|
2549
|
+
throwError(state, "a line break is expected");
|
|
2550
|
+
}
|
|
2551
|
+
state.line += 1;
|
|
2552
|
+
state.lineStart = state.position;
|
|
2553
|
+
state.firstTabInLine = -1;
|
|
2554
|
+
}
|
|
2555
|
+
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
2556
|
+
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
2557
|
+
while (ch !== 0) {
|
|
2558
|
+
while (is_WHITE_SPACE(ch)) {
|
|
2559
|
+
if (ch === 9 && state.firstTabInLine === -1) {
|
|
2560
|
+
state.firstTabInLine = state.position;
|
|
2561
|
+
}
|
|
2562
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2563
|
+
}
|
|
2564
|
+
if (allowComments && ch === 35) {
|
|
2565
|
+
do {
|
|
2566
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2567
|
+
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
2568
|
+
}
|
|
2569
|
+
if (is_EOL(ch)) {
|
|
2570
|
+
readLineBreak(state);
|
|
2571
|
+
ch = state.input.charCodeAt(state.position);
|
|
2572
|
+
lineBreaks++;
|
|
2573
|
+
state.lineIndent = 0;
|
|
2574
|
+
while (ch === 32) {
|
|
2575
|
+
state.lineIndent++;
|
|
2576
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2577
|
+
}
|
|
2578
|
+
} else {
|
|
2579
|
+
break;
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
2583
|
+
throwWarning(state, "deficient indentation");
|
|
2584
|
+
}
|
|
2585
|
+
return lineBreaks;
|
|
2586
|
+
}
|
|
2587
|
+
function testDocumentSeparator(state) {
|
|
2588
|
+
var _position = state.position, ch;
|
|
2589
|
+
ch = state.input.charCodeAt(_position);
|
|
2590
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
2591
|
+
_position += 3;
|
|
2592
|
+
ch = state.input.charCodeAt(_position);
|
|
2593
|
+
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
2594
|
+
return true;
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
return false;
|
|
2598
|
+
}
|
|
2599
|
+
function writeFoldedLines(state, count) {
|
|
2600
|
+
if (count === 1) {
|
|
2601
|
+
state.result += " ";
|
|
2602
|
+
} else if (count > 1) {
|
|
2603
|
+
state.result += common.repeat(`
|
|
2604
|
+
`, count - 1);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
2608
|
+
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
2609
|
+
ch = state.input.charCodeAt(state.position);
|
|
2610
|
+
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
2611
|
+
return false;
|
|
2612
|
+
}
|
|
2613
|
+
if (ch === 63 || ch === 45) {
|
|
2614
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2615
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
2616
|
+
return false;
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
state.kind = "scalar";
|
|
2620
|
+
state.result = "";
|
|
2621
|
+
captureStart = captureEnd = state.position;
|
|
2622
|
+
hasPendingContent = false;
|
|
2623
|
+
while (ch !== 0) {
|
|
2624
|
+
if (ch === 58) {
|
|
2625
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2626
|
+
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
2627
|
+
break;
|
|
2628
|
+
}
|
|
2629
|
+
} else if (ch === 35) {
|
|
2630
|
+
preceding = state.input.charCodeAt(state.position - 1);
|
|
2631
|
+
if (is_WS_OR_EOL(preceding)) {
|
|
2632
|
+
break;
|
|
2633
|
+
}
|
|
2634
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
2635
|
+
break;
|
|
2636
|
+
} else if (is_EOL(ch)) {
|
|
2637
|
+
_line = state.line;
|
|
2638
|
+
_lineStart = state.lineStart;
|
|
2639
|
+
_lineIndent = state.lineIndent;
|
|
2640
|
+
skipSeparationSpace(state, false, -1);
|
|
2641
|
+
if (state.lineIndent >= nodeIndent) {
|
|
2642
|
+
hasPendingContent = true;
|
|
2643
|
+
ch = state.input.charCodeAt(state.position);
|
|
2644
|
+
continue;
|
|
2645
|
+
} else {
|
|
2646
|
+
state.position = captureEnd;
|
|
2647
|
+
state.line = _line;
|
|
2648
|
+
state.lineStart = _lineStart;
|
|
2649
|
+
state.lineIndent = _lineIndent;
|
|
2650
|
+
break;
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
if (hasPendingContent) {
|
|
2654
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
2655
|
+
writeFoldedLines(state, state.line - _line);
|
|
2656
|
+
captureStart = captureEnd = state.position;
|
|
2657
|
+
hasPendingContent = false;
|
|
2658
|
+
}
|
|
2659
|
+
if (!is_WHITE_SPACE(ch)) {
|
|
2660
|
+
captureEnd = state.position + 1;
|
|
2661
|
+
}
|
|
2662
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2663
|
+
}
|
|
2664
|
+
captureSegment(state, captureStart, captureEnd, false);
|
|
2665
|
+
if (state.result) {
|
|
2666
|
+
return true;
|
|
2667
|
+
}
|
|
2668
|
+
state.kind = _kind;
|
|
2669
|
+
state.result = _result;
|
|
2670
|
+
return false;
|
|
2671
|
+
}
|
|
2672
|
+
function readSingleQuotedScalar(state, nodeIndent) {
|
|
2673
|
+
var ch, captureStart, captureEnd;
|
|
2674
|
+
ch = state.input.charCodeAt(state.position);
|
|
2675
|
+
if (ch !== 39) {
|
|
2676
|
+
return false;
|
|
2677
|
+
}
|
|
2678
|
+
state.kind = "scalar";
|
|
2679
|
+
state.result = "";
|
|
2680
|
+
state.position++;
|
|
2681
|
+
captureStart = captureEnd = state.position;
|
|
2682
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2683
|
+
if (ch === 39) {
|
|
2684
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2685
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2686
|
+
if (ch === 39) {
|
|
2687
|
+
captureStart = state.position;
|
|
2688
|
+
state.position++;
|
|
2689
|
+
captureEnd = state.position;
|
|
2690
|
+
} else {
|
|
2691
|
+
return true;
|
|
2692
|
+
}
|
|
2693
|
+
} else if (is_EOL(ch)) {
|
|
2694
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2695
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2696
|
+
captureStart = captureEnd = state.position;
|
|
2697
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2698
|
+
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
2699
|
+
} else {
|
|
2700
|
+
state.position++;
|
|
2701
|
+
captureEnd = state.position;
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
2705
|
+
}
|
|
2706
|
+
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
2707
|
+
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
2708
|
+
ch = state.input.charCodeAt(state.position);
|
|
2709
|
+
if (ch !== 34) {
|
|
2710
|
+
return false;
|
|
2711
|
+
}
|
|
2712
|
+
state.kind = "scalar";
|
|
2713
|
+
state.result = "";
|
|
2714
|
+
state.position++;
|
|
2715
|
+
captureStart = captureEnd = state.position;
|
|
2716
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2717
|
+
if (ch === 34) {
|
|
2718
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2719
|
+
state.position++;
|
|
2720
|
+
return true;
|
|
2721
|
+
} else if (ch === 92) {
|
|
2722
|
+
captureSegment(state, captureStart, state.position, true);
|
|
2723
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2724
|
+
if (is_EOL(ch)) {
|
|
2725
|
+
skipSeparationSpace(state, false, nodeIndent);
|
|
2726
|
+
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
2727
|
+
state.result += simpleEscapeMap[ch];
|
|
2728
|
+
state.position++;
|
|
2729
|
+
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
2730
|
+
hexLength = tmp;
|
|
2731
|
+
hexResult = 0;
|
|
2732
|
+
for (;hexLength > 0; hexLength--) {
|
|
2733
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2734
|
+
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
2735
|
+
hexResult = (hexResult << 4) + tmp;
|
|
2736
|
+
} else {
|
|
2737
|
+
throwError(state, "expected hexadecimal character");
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
state.result += charFromCodepoint(hexResult);
|
|
2741
|
+
state.position++;
|
|
2742
|
+
} else {
|
|
2743
|
+
throwError(state, "unknown escape sequence");
|
|
2744
|
+
}
|
|
2745
|
+
captureStart = captureEnd = state.position;
|
|
2746
|
+
} else if (is_EOL(ch)) {
|
|
2747
|
+
captureSegment(state, captureStart, captureEnd, true);
|
|
2748
|
+
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
2749
|
+
captureStart = captureEnd = state.position;
|
|
2750
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2751
|
+
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
2752
|
+
} else {
|
|
2753
|
+
state.position++;
|
|
2754
|
+
captureEnd = state.position;
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
2758
|
+
}
|
|
2759
|
+
function readFlowCollection(state, nodeIndent) {
|
|
2760
|
+
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
2761
|
+
ch = state.input.charCodeAt(state.position);
|
|
2762
|
+
if (ch === 91) {
|
|
2763
|
+
terminator = 93;
|
|
2764
|
+
isMapping = false;
|
|
2765
|
+
_result = [];
|
|
2766
|
+
} else if (ch === 123) {
|
|
2767
|
+
terminator = 125;
|
|
2768
|
+
isMapping = true;
|
|
2769
|
+
_result = {};
|
|
2770
|
+
} else {
|
|
2771
|
+
return false;
|
|
2772
|
+
}
|
|
2773
|
+
if (state.anchor !== null) {
|
|
2774
|
+
state.anchorMap[state.anchor] = _result;
|
|
2775
|
+
}
|
|
2776
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2777
|
+
while (ch !== 0) {
|
|
2778
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2779
|
+
ch = state.input.charCodeAt(state.position);
|
|
2780
|
+
if (ch === terminator) {
|
|
2781
|
+
state.position++;
|
|
2782
|
+
state.tag = _tag;
|
|
2783
|
+
state.anchor = _anchor;
|
|
2784
|
+
state.kind = isMapping ? "mapping" : "sequence";
|
|
2785
|
+
state.result = _result;
|
|
2786
|
+
return true;
|
|
2787
|
+
} else if (!readNext) {
|
|
2788
|
+
throwError(state, "missed comma between flow collection entries");
|
|
2789
|
+
} else if (ch === 44) {
|
|
2790
|
+
throwError(state, "expected the node content, but found ','");
|
|
2791
|
+
}
|
|
2792
|
+
keyTag = keyNode = valueNode = null;
|
|
2793
|
+
isPair = isExplicitPair = false;
|
|
2794
|
+
if (ch === 63) {
|
|
2795
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2796
|
+
if (is_WS_OR_EOL(following)) {
|
|
2797
|
+
isPair = isExplicitPair = true;
|
|
2798
|
+
state.position++;
|
|
2799
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
_line = state.line;
|
|
2803
|
+
_lineStart = state.lineStart;
|
|
2804
|
+
_pos = state.position;
|
|
2805
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2806
|
+
keyTag = state.tag;
|
|
2807
|
+
keyNode = state.result;
|
|
2808
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2809
|
+
ch = state.input.charCodeAt(state.position);
|
|
2810
|
+
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
2811
|
+
isPair = true;
|
|
2812
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2813
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2814
|
+
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2815
|
+
valueNode = state.result;
|
|
2816
|
+
}
|
|
2817
|
+
if (isMapping) {
|
|
2818
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
2819
|
+
} else if (isPair) {
|
|
2820
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
2821
|
+
} else {
|
|
2822
|
+
_result.push(keyNode);
|
|
2823
|
+
}
|
|
2824
|
+
skipSeparationSpace(state, true, nodeIndent);
|
|
2825
|
+
ch = state.input.charCodeAt(state.position);
|
|
2826
|
+
if (ch === 44) {
|
|
2827
|
+
readNext = true;
|
|
2828
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2829
|
+
} else {
|
|
2830
|
+
readNext = false;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
2834
|
+
}
|
|
2835
|
+
function readBlockScalar(state, nodeIndent) {
|
|
2836
|
+
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
2837
|
+
ch = state.input.charCodeAt(state.position);
|
|
2838
|
+
if (ch === 124) {
|
|
2839
|
+
folding = false;
|
|
2840
|
+
} else if (ch === 62) {
|
|
2841
|
+
folding = true;
|
|
2842
|
+
} else {
|
|
2843
|
+
return false;
|
|
2844
|
+
}
|
|
2845
|
+
state.kind = "scalar";
|
|
2846
|
+
state.result = "";
|
|
2847
|
+
while (ch !== 0) {
|
|
2848
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2849
|
+
if (ch === 43 || ch === 45) {
|
|
2850
|
+
if (CHOMPING_CLIP === chomping) {
|
|
2851
|
+
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
2852
|
+
} else {
|
|
2853
|
+
throwError(state, "repeat of a chomping mode identifier");
|
|
2854
|
+
}
|
|
2855
|
+
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
2856
|
+
if (tmp === 0) {
|
|
2857
|
+
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
2858
|
+
} else if (!detectedIndent) {
|
|
2859
|
+
textIndent = nodeIndent + tmp - 1;
|
|
2860
|
+
detectedIndent = true;
|
|
2861
|
+
} else {
|
|
2862
|
+
throwError(state, "repeat of an indentation width identifier");
|
|
2863
|
+
}
|
|
2864
|
+
} else {
|
|
2865
|
+
break;
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
if (is_WHITE_SPACE(ch)) {
|
|
2869
|
+
do {
|
|
2870
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2871
|
+
} while (is_WHITE_SPACE(ch));
|
|
2872
|
+
if (ch === 35) {
|
|
2873
|
+
do {
|
|
2874
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2875
|
+
} while (!is_EOL(ch) && ch !== 0);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
while (ch !== 0) {
|
|
2879
|
+
readLineBreak(state);
|
|
2880
|
+
state.lineIndent = 0;
|
|
2881
|
+
ch = state.input.charCodeAt(state.position);
|
|
2882
|
+
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
2883
|
+
state.lineIndent++;
|
|
2884
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2885
|
+
}
|
|
2886
|
+
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
2887
|
+
textIndent = state.lineIndent;
|
|
2888
|
+
}
|
|
2889
|
+
if (is_EOL(ch)) {
|
|
2890
|
+
emptyLines++;
|
|
2891
|
+
continue;
|
|
2892
|
+
}
|
|
2893
|
+
if (state.lineIndent < textIndent) {
|
|
2894
|
+
if (chomping === CHOMPING_KEEP) {
|
|
2895
|
+
state.result += common.repeat(`
|
|
2896
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
2897
|
+
} else if (chomping === CHOMPING_CLIP) {
|
|
2898
|
+
if (didReadContent) {
|
|
2899
|
+
state.result += `
|
|
2900
|
+
`;
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
break;
|
|
2904
|
+
}
|
|
2905
|
+
if (folding) {
|
|
2906
|
+
if (is_WHITE_SPACE(ch)) {
|
|
2907
|
+
atMoreIndented = true;
|
|
2908
|
+
state.result += common.repeat(`
|
|
2909
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
2910
|
+
} else if (atMoreIndented) {
|
|
2911
|
+
atMoreIndented = false;
|
|
2912
|
+
state.result += common.repeat(`
|
|
2913
|
+
`, emptyLines + 1);
|
|
2914
|
+
} else if (emptyLines === 0) {
|
|
2915
|
+
if (didReadContent) {
|
|
2916
|
+
state.result += " ";
|
|
2917
|
+
}
|
|
2918
|
+
} else {
|
|
2919
|
+
state.result += common.repeat(`
|
|
2920
|
+
`, emptyLines);
|
|
2921
|
+
}
|
|
2922
|
+
} else {
|
|
2923
|
+
state.result += common.repeat(`
|
|
2924
|
+
`, didReadContent ? 1 + emptyLines : emptyLines);
|
|
2925
|
+
}
|
|
2926
|
+
didReadContent = true;
|
|
2927
|
+
detectedIndent = true;
|
|
2928
|
+
emptyLines = 0;
|
|
2929
|
+
captureStart = state.position;
|
|
2930
|
+
while (!is_EOL(ch) && ch !== 0) {
|
|
2931
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2932
|
+
}
|
|
2933
|
+
captureSegment(state, captureStart, state.position, false);
|
|
2934
|
+
}
|
|
2935
|
+
return true;
|
|
2936
|
+
}
|
|
2937
|
+
function readBlockSequence(state, nodeIndent) {
|
|
2938
|
+
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
2939
|
+
if (state.firstTabInLine !== -1)
|
|
2940
|
+
return false;
|
|
2941
|
+
if (state.anchor !== null) {
|
|
2942
|
+
state.anchorMap[state.anchor] = _result;
|
|
2943
|
+
}
|
|
2944
|
+
ch = state.input.charCodeAt(state.position);
|
|
2945
|
+
while (ch !== 0) {
|
|
2946
|
+
if (state.firstTabInLine !== -1) {
|
|
2947
|
+
state.position = state.firstTabInLine;
|
|
2948
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2949
|
+
}
|
|
2950
|
+
if (ch !== 45) {
|
|
2951
|
+
break;
|
|
2952
|
+
}
|
|
2953
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
2954
|
+
if (!is_WS_OR_EOL(following)) {
|
|
2955
|
+
break;
|
|
2956
|
+
}
|
|
2957
|
+
detected = true;
|
|
2958
|
+
state.position++;
|
|
2959
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
2960
|
+
if (state.lineIndent <= nodeIndent) {
|
|
2961
|
+
_result.push(null);
|
|
2962
|
+
ch = state.input.charCodeAt(state.position);
|
|
2963
|
+
continue;
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
_line = state.line;
|
|
2967
|
+
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2968
|
+
_result.push(state.result);
|
|
2969
|
+
skipSeparationSpace(state, true, -1);
|
|
2970
|
+
ch = state.input.charCodeAt(state.position);
|
|
2971
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
2972
|
+
throwError(state, "bad indentation of a sequence entry");
|
|
2973
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
2974
|
+
break;
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
if (detected) {
|
|
2978
|
+
state.tag = _tag;
|
|
2979
|
+
state.anchor = _anchor;
|
|
2980
|
+
state.kind = "sequence";
|
|
2981
|
+
state.result = _result;
|
|
2982
|
+
return true;
|
|
2983
|
+
}
|
|
2984
|
+
return false;
|
|
2985
|
+
}
|
|
2986
|
+
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
2987
|
+
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
2988
|
+
if (state.firstTabInLine !== -1)
|
|
2989
|
+
return false;
|
|
2990
|
+
if (state.anchor !== null) {
|
|
2991
|
+
state.anchorMap[state.anchor] = _result;
|
|
2992
|
+
}
|
|
2993
|
+
ch = state.input.charCodeAt(state.position);
|
|
2994
|
+
while (ch !== 0) {
|
|
2995
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
2996
|
+
state.position = state.firstTabInLine;
|
|
2997
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2998
|
+
}
|
|
2999
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
3000
|
+
_line = state.line;
|
|
3001
|
+
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
3002
|
+
if (ch === 63) {
|
|
3003
|
+
if (atExplicitKey) {
|
|
3004
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3005
|
+
keyTag = keyNode = valueNode = null;
|
|
3006
|
+
}
|
|
3007
|
+
detected = true;
|
|
3008
|
+
atExplicitKey = true;
|
|
3009
|
+
allowCompact = true;
|
|
3010
|
+
} else if (atExplicitKey) {
|
|
3011
|
+
atExplicitKey = false;
|
|
3012
|
+
allowCompact = true;
|
|
3013
|
+
} else {
|
|
3014
|
+
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
3015
|
+
}
|
|
3016
|
+
state.position += 1;
|
|
3017
|
+
ch = following;
|
|
3018
|
+
} else {
|
|
3019
|
+
_keyLine = state.line;
|
|
3020
|
+
_keyLineStart = state.lineStart;
|
|
3021
|
+
_keyPos = state.position;
|
|
3022
|
+
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
3023
|
+
break;
|
|
3024
|
+
}
|
|
3025
|
+
if (state.line === _line) {
|
|
3026
|
+
ch = state.input.charCodeAt(state.position);
|
|
3027
|
+
while (is_WHITE_SPACE(ch)) {
|
|
3028
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3029
|
+
}
|
|
3030
|
+
if (ch === 58) {
|
|
3031
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3032
|
+
if (!is_WS_OR_EOL(ch)) {
|
|
3033
|
+
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
3034
|
+
}
|
|
3035
|
+
if (atExplicitKey) {
|
|
3036
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3037
|
+
keyTag = keyNode = valueNode = null;
|
|
3038
|
+
}
|
|
3039
|
+
detected = true;
|
|
3040
|
+
atExplicitKey = false;
|
|
3041
|
+
allowCompact = false;
|
|
3042
|
+
keyTag = state.tag;
|
|
3043
|
+
keyNode = state.result;
|
|
3044
|
+
} else if (detected) {
|
|
3045
|
+
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
3046
|
+
} else {
|
|
3047
|
+
state.tag = _tag;
|
|
3048
|
+
state.anchor = _anchor;
|
|
3049
|
+
return true;
|
|
3050
|
+
}
|
|
3051
|
+
} else if (detected) {
|
|
3052
|
+
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
3053
|
+
} else {
|
|
3054
|
+
state.tag = _tag;
|
|
3055
|
+
state.anchor = _anchor;
|
|
3056
|
+
return true;
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
3060
|
+
if (atExplicitKey) {
|
|
3061
|
+
_keyLine = state.line;
|
|
3062
|
+
_keyLineStart = state.lineStart;
|
|
3063
|
+
_keyPos = state.position;
|
|
3064
|
+
}
|
|
3065
|
+
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
3066
|
+
if (atExplicitKey) {
|
|
3067
|
+
keyNode = state.result;
|
|
3068
|
+
} else {
|
|
3069
|
+
valueNode = state.result;
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
if (!atExplicitKey) {
|
|
3073
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
3074
|
+
keyTag = keyNode = valueNode = null;
|
|
3075
|
+
}
|
|
3076
|
+
skipSeparationSpace(state, true, -1);
|
|
3077
|
+
ch = state.input.charCodeAt(state.position);
|
|
3078
|
+
}
|
|
3079
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
3080
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
3081
|
+
} else if (state.lineIndent < nodeIndent) {
|
|
3082
|
+
break;
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
if (atExplicitKey) {
|
|
3086
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
3087
|
+
}
|
|
3088
|
+
if (detected) {
|
|
3089
|
+
state.tag = _tag;
|
|
3090
|
+
state.anchor = _anchor;
|
|
3091
|
+
state.kind = "mapping";
|
|
3092
|
+
state.result = _result;
|
|
3093
|
+
}
|
|
3094
|
+
return detected;
|
|
3095
|
+
}
|
|
3096
|
+
function readTagProperty(state) {
|
|
3097
|
+
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
3098
|
+
ch = state.input.charCodeAt(state.position);
|
|
3099
|
+
if (ch !== 33)
|
|
3100
|
+
return false;
|
|
3101
|
+
if (state.tag !== null) {
|
|
3102
|
+
throwError(state, "duplication of a tag property");
|
|
3103
|
+
}
|
|
3104
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3105
|
+
if (ch === 60) {
|
|
3106
|
+
isVerbatim = true;
|
|
3107
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3108
|
+
} else if (ch === 33) {
|
|
3109
|
+
isNamed = true;
|
|
3110
|
+
tagHandle = "!!";
|
|
3111
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3112
|
+
} else {
|
|
3113
|
+
tagHandle = "!";
|
|
3114
|
+
}
|
|
3115
|
+
_position = state.position;
|
|
3116
|
+
if (isVerbatim) {
|
|
3117
|
+
do {
|
|
3118
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3119
|
+
} while (ch !== 0 && ch !== 62);
|
|
3120
|
+
if (state.position < state.length) {
|
|
3121
|
+
tagName = state.input.slice(_position, state.position);
|
|
3122
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3123
|
+
} else {
|
|
3124
|
+
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
3125
|
+
}
|
|
3126
|
+
} else {
|
|
3127
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
3128
|
+
if (ch === 33) {
|
|
3129
|
+
if (!isNamed) {
|
|
3130
|
+
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
3131
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
3132
|
+
throwError(state, "named tag handle cannot contain such characters");
|
|
3133
|
+
}
|
|
3134
|
+
isNamed = true;
|
|
3135
|
+
_position = state.position + 1;
|
|
3136
|
+
} else {
|
|
3137
|
+
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3141
|
+
}
|
|
3142
|
+
tagName = state.input.slice(_position, state.position);
|
|
3143
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
3144
|
+
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
3148
|
+
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
3149
|
+
}
|
|
3150
|
+
try {
|
|
3151
|
+
tagName = decodeURIComponent(tagName);
|
|
3152
|
+
} catch (err) {
|
|
3153
|
+
throwError(state, "tag name is malformed: " + tagName);
|
|
3154
|
+
}
|
|
3155
|
+
if (isVerbatim) {
|
|
3156
|
+
state.tag = tagName;
|
|
3157
|
+
} else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
|
|
3158
|
+
state.tag = state.tagMap[tagHandle] + tagName;
|
|
3159
|
+
} else if (tagHandle === "!") {
|
|
3160
|
+
state.tag = "!" + tagName;
|
|
3161
|
+
} else if (tagHandle === "!!") {
|
|
3162
|
+
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
3163
|
+
} else {
|
|
3164
|
+
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
3165
|
+
}
|
|
3166
|
+
return true;
|
|
3167
|
+
}
|
|
3168
|
+
function readAnchorProperty(state) {
|
|
3169
|
+
var _position, ch;
|
|
3170
|
+
ch = state.input.charCodeAt(state.position);
|
|
3171
|
+
if (ch !== 38)
|
|
3172
|
+
return false;
|
|
3173
|
+
if (state.anchor !== null) {
|
|
3174
|
+
throwError(state, "duplication of an anchor property");
|
|
3175
|
+
}
|
|
3176
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3177
|
+
_position = state.position;
|
|
3178
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
3179
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3180
|
+
}
|
|
3181
|
+
if (state.position === _position) {
|
|
3182
|
+
throwError(state, "name of an anchor node must contain at least one character");
|
|
3183
|
+
}
|
|
3184
|
+
state.anchor = state.input.slice(_position, state.position);
|
|
3185
|
+
return true;
|
|
3186
|
+
}
|
|
3187
|
+
function readAlias(state) {
|
|
3188
|
+
var _position, alias, ch;
|
|
3189
|
+
ch = state.input.charCodeAt(state.position);
|
|
3190
|
+
if (ch !== 42)
|
|
3191
|
+
return false;
|
|
3192
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3193
|
+
_position = state.position;
|
|
3194
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
3195
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3196
|
+
}
|
|
3197
|
+
if (state.position === _position) {
|
|
3198
|
+
throwError(state, "name of an alias node must contain at least one character");
|
|
3199
|
+
}
|
|
3200
|
+
alias = state.input.slice(_position, state.position);
|
|
3201
|
+
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
|
3202
|
+
throwError(state, 'unidentified alias "' + alias + '"');
|
|
3203
|
+
}
|
|
3204
|
+
state.result = state.anchorMap[alias];
|
|
3205
|
+
skipSeparationSpace(state, true, -1);
|
|
3206
|
+
return true;
|
|
3207
|
+
}
|
|
3208
|
+
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
3209
|
+
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
|
3210
|
+
if (state.listener !== null) {
|
|
3211
|
+
state.listener("open", state);
|
|
3212
|
+
}
|
|
3213
|
+
state.tag = null;
|
|
3214
|
+
state.anchor = null;
|
|
3215
|
+
state.kind = null;
|
|
3216
|
+
state.result = null;
|
|
3217
|
+
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
3218
|
+
if (allowToSeek) {
|
|
3219
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
3220
|
+
atNewLine = true;
|
|
3221
|
+
if (state.lineIndent > parentIndent) {
|
|
3222
|
+
indentStatus = 1;
|
|
3223
|
+
} else if (state.lineIndent === parentIndent) {
|
|
3224
|
+
indentStatus = 0;
|
|
3225
|
+
} else if (state.lineIndent < parentIndent) {
|
|
3226
|
+
indentStatus = -1;
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
if (indentStatus === 1) {
|
|
3231
|
+
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
3232
|
+
if (skipSeparationSpace(state, true, -1)) {
|
|
3233
|
+
atNewLine = true;
|
|
3234
|
+
allowBlockCollections = allowBlockStyles;
|
|
3235
|
+
if (state.lineIndent > parentIndent) {
|
|
3236
|
+
indentStatus = 1;
|
|
3237
|
+
} else if (state.lineIndent === parentIndent) {
|
|
3238
|
+
indentStatus = 0;
|
|
3239
|
+
} else if (state.lineIndent < parentIndent) {
|
|
3240
|
+
indentStatus = -1;
|
|
3241
|
+
}
|
|
3242
|
+
} else {
|
|
3243
|
+
allowBlockCollections = false;
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
if (allowBlockCollections) {
|
|
3248
|
+
allowBlockCollections = atNewLine || allowCompact;
|
|
3249
|
+
}
|
|
3250
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
3251
|
+
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
3252
|
+
flowIndent = parentIndent;
|
|
3253
|
+
} else {
|
|
3254
|
+
flowIndent = parentIndent + 1;
|
|
3255
|
+
}
|
|
3256
|
+
blockIndent = state.position - state.lineStart;
|
|
3257
|
+
if (indentStatus === 1) {
|
|
3258
|
+
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
3259
|
+
hasContent = true;
|
|
3260
|
+
} else {
|
|
3261
|
+
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
3262
|
+
hasContent = true;
|
|
3263
|
+
} else if (readAlias(state)) {
|
|
3264
|
+
hasContent = true;
|
|
3265
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
3266
|
+
throwError(state, "alias node should not have any properties");
|
|
3267
|
+
}
|
|
3268
|
+
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
3269
|
+
hasContent = true;
|
|
3270
|
+
if (state.tag === null) {
|
|
3271
|
+
state.tag = "?";
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
if (state.anchor !== null) {
|
|
3275
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
} else if (indentStatus === 0) {
|
|
3279
|
+
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
if (state.tag === null) {
|
|
3283
|
+
if (state.anchor !== null) {
|
|
3284
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3285
|
+
}
|
|
3286
|
+
} else if (state.tag === "?") {
|
|
3287
|
+
if (state.result !== null && state.kind !== "scalar") {
|
|
3288
|
+
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
3289
|
+
}
|
|
3290
|
+
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
3291
|
+
type2 = state.implicitTypes[typeIndex];
|
|
3292
|
+
if (type2.resolve(state.result)) {
|
|
3293
|
+
state.result = type2.construct(state.result);
|
|
3294
|
+
state.tag = type2.tag;
|
|
3295
|
+
if (state.anchor !== null) {
|
|
3296
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3297
|
+
}
|
|
3298
|
+
break;
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
} else if (state.tag !== "!") {
|
|
3302
|
+
if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
3303
|
+
type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
|
3304
|
+
} else {
|
|
3305
|
+
type2 = null;
|
|
3306
|
+
typeList = state.typeMap.multi[state.kind || "fallback"];
|
|
3307
|
+
for (typeIndex = 0, typeQuantity = typeList.length;typeIndex < typeQuantity; typeIndex += 1) {
|
|
3308
|
+
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
|
3309
|
+
type2 = typeList[typeIndex];
|
|
3310
|
+
break;
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
if (!type2) {
|
|
3315
|
+
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
3316
|
+
}
|
|
3317
|
+
if (state.result !== null && type2.kind !== state.kind) {
|
|
3318
|
+
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
3319
|
+
}
|
|
3320
|
+
if (!type2.resolve(state.result, state.tag)) {
|
|
3321
|
+
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
3322
|
+
} else {
|
|
3323
|
+
state.result = type2.construct(state.result, state.tag);
|
|
3324
|
+
if (state.anchor !== null) {
|
|
3325
|
+
state.anchorMap[state.anchor] = state.result;
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
if (state.listener !== null) {
|
|
3330
|
+
state.listener("close", state);
|
|
3331
|
+
}
|
|
3332
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
3333
|
+
}
|
|
3334
|
+
function readDocument(state) {
|
|
3335
|
+
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
3336
|
+
state.version = null;
|
|
3337
|
+
state.checkLineBreaks = state.legacy;
|
|
3338
|
+
state.tagMap = Object.create(null);
|
|
3339
|
+
state.anchorMap = Object.create(null);
|
|
3340
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
3341
|
+
skipSeparationSpace(state, true, -1);
|
|
3342
|
+
ch = state.input.charCodeAt(state.position);
|
|
3343
|
+
if (state.lineIndent > 0 || ch !== 37) {
|
|
3344
|
+
break;
|
|
3345
|
+
}
|
|
3346
|
+
hasDirectives = true;
|
|
3347
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3348
|
+
_position = state.position;
|
|
3349
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
3350
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3351
|
+
}
|
|
3352
|
+
directiveName = state.input.slice(_position, state.position);
|
|
3353
|
+
directiveArgs = [];
|
|
3354
|
+
if (directiveName.length < 1) {
|
|
3355
|
+
throwError(state, "directive name must not be less than one character in length");
|
|
3356
|
+
}
|
|
3357
|
+
while (ch !== 0) {
|
|
3358
|
+
while (is_WHITE_SPACE(ch)) {
|
|
3359
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3360
|
+
}
|
|
3361
|
+
if (ch === 35) {
|
|
3362
|
+
do {
|
|
3363
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3364
|
+
} while (ch !== 0 && !is_EOL(ch));
|
|
3365
|
+
break;
|
|
3366
|
+
}
|
|
3367
|
+
if (is_EOL(ch))
|
|
3368
|
+
break;
|
|
3369
|
+
_position = state.position;
|
|
3370
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
3371
|
+
ch = state.input.charCodeAt(++state.position);
|
|
3372
|
+
}
|
|
3373
|
+
directiveArgs.push(state.input.slice(_position, state.position));
|
|
3374
|
+
}
|
|
3375
|
+
if (ch !== 0)
|
|
3376
|
+
readLineBreak(state);
|
|
3377
|
+
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
|
3378
|
+
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
3379
|
+
} else {
|
|
3380
|
+
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
skipSeparationSpace(state, true, -1);
|
|
3384
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
3385
|
+
state.position += 3;
|
|
3386
|
+
skipSeparationSpace(state, true, -1);
|
|
3387
|
+
} else if (hasDirectives) {
|
|
3388
|
+
throwError(state, "directives end mark is expected");
|
|
3389
|
+
}
|
|
3390
|
+
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
3391
|
+
skipSeparationSpace(state, true, -1);
|
|
3392
|
+
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
3393
|
+
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
3394
|
+
}
|
|
3395
|
+
state.documents.push(state.result);
|
|
3396
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
3397
|
+
if (state.input.charCodeAt(state.position) === 46) {
|
|
3398
|
+
state.position += 3;
|
|
3399
|
+
skipSeparationSpace(state, true, -1);
|
|
3400
|
+
}
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
if (state.position < state.length - 1) {
|
|
3404
|
+
throwError(state, "end of the stream or a document separator is expected");
|
|
3405
|
+
} else {
|
|
3406
|
+
return;
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
function loadDocuments(input, options) {
|
|
3410
|
+
input = String(input);
|
|
3411
|
+
options = options || {};
|
|
3412
|
+
if (input.length !== 0) {
|
|
3413
|
+
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
3414
|
+
input += `
|
|
3415
|
+
`;
|
|
3416
|
+
}
|
|
3417
|
+
if (input.charCodeAt(0) === 65279) {
|
|
3418
|
+
input = input.slice(1);
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
var state = new State$1(input, options);
|
|
3422
|
+
var nullpos = input.indexOf("\x00");
|
|
3423
|
+
if (nullpos !== -1) {
|
|
3424
|
+
state.position = nullpos;
|
|
3425
|
+
throwError(state, "null byte is not allowed in input");
|
|
3426
|
+
}
|
|
3427
|
+
state.input += "\x00";
|
|
3428
|
+
while (state.input.charCodeAt(state.position) === 32) {
|
|
3429
|
+
state.lineIndent += 1;
|
|
3430
|
+
state.position += 1;
|
|
3431
|
+
}
|
|
3432
|
+
while (state.position < state.length - 1) {
|
|
3433
|
+
readDocument(state);
|
|
3434
|
+
}
|
|
3435
|
+
return state.documents;
|
|
3436
|
+
}
|
|
3437
|
+
function loadAll$1(input, iterator, options) {
|
|
3438
|
+
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
3439
|
+
options = iterator;
|
|
3440
|
+
iterator = null;
|
|
3441
|
+
}
|
|
3442
|
+
var documents = loadDocuments(input, options);
|
|
3443
|
+
if (typeof iterator !== "function") {
|
|
3444
|
+
return documents;
|
|
3445
|
+
}
|
|
3446
|
+
for (var index = 0, length = documents.length;index < length; index += 1) {
|
|
3447
|
+
iterator(documents[index]);
|
|
3448
|
+
}
|
|
3449
|
+
}
|
|
3450
|
+
function load$1(input, options) {
|
|
3451
|
+
var documents = loadDocuments(input, options);
|
|
3452
|
+
if (documents.length === 0) {
|
|
3453
|
+
return;
|
|
3454
|
+
} else if (documents.length === 1) {
|
|
3455
|
+
return documents[0];
|
|
3456
|
+
}
|
|
3457
|
+
throw new exception("expected a single document in the stream, but found more");
|
|
3458
|
+
}
|
|
3459
|
+
function compileStyleMap(schema2, map2) {
|
|
3460
|
+
var result, keys, index, length, tag, style, type2;
|
|
3461
|
+
if (map2 === null)
|
|
3462
|
+
return {};
|
|
3463
|
+
result = {};
|
|
3464
|
+
keys = Object.keys(map2);
|
|
3465
|
+
for (index = 0, length = keys.length;index < length; index += 1) {
|
|
3466
|
+
tag = keys[index];
|
|
3467
|
+
style = String(map2[tag]);
|
|
3468
|
+
if (tag.slice(0, 2) === "!!") {
|
|
3469
|
+
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
3470
|
+
}
|
|
3471
|
+
type2 = schema2.compiledTypeMap["fallback"][tag];
|
|
3472
|
+
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
|
|
3473
|
+
style = type2.styleAliases[style];
|
|
3474
|
+
}
|
|
3475
|
+
result[tag] = style;
|
|
3476
|
+
}
|
|
3477
|
+
return result;
|
|
3478
|
+
}
|
|
3479
|
+
function encodeHex(character) {
|
|
3480
|
+
var string2, handle, length;
|
|
3481
|
+
string2 = character.toString(16).toUpperCase();
|
|
3482
|
+
if (character <= 255) {
|
|
3483
|
+
handle = "x";
|
|
3484
|
+
length = 2;
|
|
3485
|
+
} else if (character <= 65535) {
|
|
3486
|
+
handle = "u";
|
|
3487
|
+
length = 4;
|
|
3488
|
+
} else if (character <= 4294967295) {
|
|
3489
|
+
handle = "U";
|
|
3490
|
+
length = 8;
|
|
3491
|
+
} else {
|
|
3492
|
+
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
|
|
3493
|
+
}
|
|
3494
|
+
return "\\" + handle + common.repeat("0", length - string2.length) + string2;
|
|
3495
|
+
}
|
|
3496
|
+
function State(options) {
|
|
3497
|
+
this.schema = options["schema"] || _default;
|
|
3498
|
+
this.indent = Math.max(1, options["indent"] || 2);
|
|
3499
|
+
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
3500
|
+
this.skipInvalid = options["skipInvalid"] || false;
|
|
3501
|
+
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
3502
|
+
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
3503
|
+
this.sortKeys = options["sortKeys"] || false;
|
|
3504
|
+
this.lineWidth = options["lineWidth"] || 80;
|
|
3505
|
+
this.noRefs = options["noRefs"] || false;
|
|
3506
|
+
this.noCompatMode = options["noCompatMode"] || false;
|
|
3507
|
+
this.condenseFlow = options["condenseFlow"] || false;
|
|
3508
|
+
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
|
|
3509
|
+
this.forceQuotes = options["forceQuotes"] || false;
|
|
3510
|
+
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
|
|
3511
|
+
this.implicitTypes = this.schema.compiledImplicit;
|
|
3512
|
+
this.explicitTypes = this.schema.compiledExplicit;
|
|
3513
|
+
this.tag = null;
|
|
3514
|
+
this.result = "";
|
|
3515
|
+
this.duplicates = [];
|
|
3516
|
+
this.usedDuplicates = null;
|
|
3517
|
+
}
|
|
3518
|
+
function indentString(string2, spaces) {
|
|
3519
|
+
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string2.length;
|
|
3520
|
+
while (position < length) {
|
|
3521
|
+
next = string2.indexOf(`
|
|
3522
|
+
`, position);
|
|
3523
|
+
if (next === -1) {
|
|
3524
|
+
line = string2.slice(position);
|
|
3525
|
+
position = length;
|
|
3526
|
+
} else {
|
|
3527
|
+
line = string2.slice(position, next + 1);
|
|
3528
|
+
position = next + 1;
|
|
3529
|
+
}
|
|
3530
|
+
if (line.length && line !== `
|
|
3531
|
+
`)
|
|
3532
|
+
result += ind;
|
|
3533
|
+
result += line;
|
|
3534
|
+
}
|
|
3535
|
+
return result;
|
|
3536
|
+
}
|
|
3537
|
+
function generateNextLine(state, level) {
|
|
3538
|
+
return `
|
|
3539
|
+
` + common.repeat(" ", state.indent * level);
|
|
3540
|
+
}
|
|
3541
|
+
function testImplicitResolving(state, str2) {
|
|
3542
|
+
var index, length, type2;
|
|
3543
|
+
for (index = 0, length = state.implicitTypes.length;index < length; index += 1) {
|
|
3544
|
+
type2 = state.implicitTypes[index];
|
|
3545
|
+
if (type2.resolve(str2)) {
|
|
3546
|
+
return true;
|
|
3547
|
+
}
|
|
3548
|
+
}
|
|
3549
|
+
return false;
|
|
3550
|
+
}
|
|
3551
|
+
function isWhitespace(c) {
|
|
3552
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
3553
|
+
}
|
|
3554
|
+
function isPrintable(c) {
|
|
3555
|
+
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
|
|
3556
|
+
}
|
|
3557
|
+
function isNsCharOrWhitespace(c) {
|
|
3558
|
+
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
3559
|
+
}
|
|
3560
|
+
function isPlainSafe(c, prev, inblock) {
|
|
3561
|
+
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
3562
|
+
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
3563
|
+
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
3564
|
+
}
|
|
3565
|
+
function isPlainSafeFirst(c) {
|
|
3566
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
3567
|
+
}
|
|
3568
|
+
function isPlainSafeLast(c) {
|
|
3569
|
+
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
3570
|
+
}
|
|
3571
|
+
function codePointAt(string2, pos) {
|
|
3572
|
+
var first = string2.charCodeAt(pos), second;
|
|
3573
|
+
if (first >= 55296 && first <= 56319 && pos + 1 < string2.length) {
|
|
3574
|
+
second = string2.charCodeAt(pos + 1);
|
|
3575
|
+
if (second >= 56320 && second <= 57343) {
|
|
3576
|
+
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
return first;
|
|
3580
|
+
}
|
|
3581
|
+
function needIndentIndicator(string2) {
|
|
3582
|
+
var leadingSpaceRe = /^\n* /;
|
|
3583
|
+
return leadingSpaceRe.test(string2);
|
|
3584
|
+
}
|
|
3585
|
+
function chooseScalarStyle(string2, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
3586
|
+
var i2;
|
|
3587
|
+
var char = 0;
|
|
3588
|
+
var prevChar = null;
|
|
3589
|
+
var hasLineBreak = false;
|
|
3590
|
+
var hasFoldableLine = false;
|
|
3591
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
3592
|
+
var previousLineBreak = -1;
|
|
3593
|
+
var plain = isPlainSafeFirst(codePointAt(string2, 0)) && isPlainSafeLast(codePointAt(string2, string2.length - 1));
|
|
3594
|
+
if (singleLineOnly || forceQuotes) {
|
|
3595
|
+
for (i2 = 0;i2 < string2.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3596
|
+
char = codePointAt(string2, i2);
|
|
3597
|
+
if (!isPrintable(char)) {
|
|
3598
|
+
return STYLE_DOUBLE;
|
|
3599
|
+
}
|
|
3600
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
3601
|
+
prevChar = char;
|
|
3602
|
+
}
|
|
3603
|
+
} else {
|
|
3604
|
+
for (i2 = 0;i2 < string2.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3605
|
+
char = codePointAt(string2, i2);
|
|
3606
|
+
if (char === CHAR_LINE_FEED) {
|
|
3607
|
+
hasLineBreak = true;
|
|
3608
|
+
if (shouldTrackWidth) {
|
|
3609
|
+
hasFoldableLine = hasFoldableLine || i2 - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ";
|
|
3610
|
+
previousLineBreak = i2;
|
|
3611
|
+
}
|
|
3612
|
+
} else if (!isPrintable(char)) {
|
|
3613
|
+
return STYLE_DOUBLE;
|
|
3614
|
+
}
|
|
3615
|
+
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
3616
|
+
prevChar = char;
|
|
3617
|
+
}
|
|
3618
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ");
|
|
3619
|
+
}
|
|
3620
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
3621
|
+
if (plain && !forceQuotes && !testAmbiguousType(string2)) {
|
|
3622
|
+
return STYLE_PLAIN;
|
|
3623
|
+
}
|
|
3624
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
3625
|
+
}
|
|
3626
|
+
if (indentPerLevel > 9 && needIndentIndicator(string2)) {
|
|
3627
|
+
return STYLE_DOUBLE;
|
|
3628
|
+
}
|
|
3629
|
+
if (!forceQuotes) {
|
|
3630
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
3631
|
+
}
|
|
3632
|
+
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
3633
|
+
}
|
|
3634
|
+
function writeScalar(state, string2, level, iskey, inblock) {
|
|
3635
|
+
state.dump = function() {
|
|
3636
|
+
if (string2.length === 0) {
|
|
3637
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
|
|
3638
|
+
}
|
|
3639
|
+
if (!state.noCompatMode) {
|
|
3640
|
+
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string2) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string2)) {
|
|
3641
|
+
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string2 + '"' : "'" + string2 + "'";
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
var indent = state.indent * Math.max(1, level);
|
|
3645
|
+
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
3646
|
+
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
3647
|
+
function testAmbiguity(string3) {
|
|
3648
|
+
return testImplicitResolving(state, string3);
|
|
3649
|
+
}
|
|
3650
|
+
switch (chooseScalarStyle(string2, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
3651
|
+
case STYLE_PLAIN:
|
|
3652
|
+
return string2;
|
|
3653
|
+
case STYLE_SINGLE:
|
|
3654
|
+
return "'" + string2.replace(/'/g, "''") + "'";
|
|
3655
|
+
case STYLE_LITERAL:
|
|
3656
|
+
return "|" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(string2, indent));
|
|
3657
|
+
case STYLE_FOLDED:
|
|
3658
|
+
return ">" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(foldString(string2, lineWidth), indent));
|
|
3659
|
+
case STYLE_DOUBLE:
|
|
3660
|
+
return '"' + escapeString(string2) + '"';
|
|
3661
|
+
default:
|
|
3662
|
+
throw new exception("impossible error: invalid scalar style");
|
|
3663
|
+
}
|
|
3664
|
+
}();
|
|
3665
|
+
}
|
|
3666
|
+
function blockHeader(string2, indentPerLevel) {
|
|
3667
|
+
var indentIndicator = needIndentIndicator(string2) ? String(indentPerLevel) : "";
|
|
3668
|
+
var clip = string2[string2.length - 1] === `
|
|
3669
|
+
`;
|
|
3670
|
+
var keep = clip && (string2[string2.length - 2] === `
|
|
3671
|
+
` || string2 === `
|
|
3672
|
+
`);
|
|
3673
|
+
var chomp = keep ? "+" : clip ? "" : "-";
|
|
3674
|
+
return indentIndicator + chomp + `
|
|
3675
|
+
`;
|
|
3676
|
+
}
|
|
3677
|
+
function dropEndingNewline(string2) {
|
|
3678
|
+
return string2[string2.length - 1] === `
|
|
3679
|
+
` ? string2.slice(0, -1) : string2;
|
|
3680
|
+
}
|
|
3681
|
+
function foldString(string2, width) {
|
|
3682
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
3683
|
+
var result = function() {
|
|
3684
|
+
var nextLF = string2.indexOf(`
|
|
3685
|
+
`);
|
|
3686
|
+
nextLF = nextLF !== -1 ? nextLF : string2.length;
|
|
3687
|
+
lineRe.lastIndex = nextLF;
|
|
3688
|
+
return foldLine(string2.slice(0, nextLF), width);
|
|
3689
|
+
}();
|
|
3690
|
+
var prevMoreIndented = string2[0] === `
|
|
3691
|
+
` || string2[0] === " ";
|
|
3692
|
+
var moreIndented;
|
|
3693
|
+
var match;
|
|
3694
|
+
while (match = lineRe.exec(string2)) {
|
|
3695
|
+
var prefix = match[1], line = match[2];
|
|
3696
|
+
moreIndented = line[0] === " ";
|
|
3697
|
+
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
|
|
3698
|
+
` : "") + foldLine(line, width);
|
|
3699
|
+
prevMoreIndented = moreIndented;
|
|
3700
|
+
}
|
|
3701
|
+
return result;
|
|
3702
|
+
}
|
|
3703
|
+
function foldLine(line, width) {
|
|
3704
|
+
if (line === "" || line[0] === " ")
|
|
3705
|
+
return line;
|
|
3706
|
+
var breakRe = / [^ ]/g;
|
|
3707
|
+
var match;
|
|
3708
|
+
var start = 0, end, curr = 0, next = 0;
|
|
3709
|
+
var result = "";
|
|
3710
|
+
while (match = breakRe.exec(line)) {
|
|
3711
|
+
next = match.index;
|
|
3712
|
+
if (next - start > width) {
|
|
3713
|
+
end = curr > start ? curr : next;
|
|
3714
|
+
result += `
|
|
3715
|
+
` + line.slice(start, end);
|
|
3716
|
+
start = end + 1;
|
|
3717
|
+
}
|
|
3718
|
+
curr = next;
|
|
3719
|
+
}
|
|
3720
|
+
result += `
|
|
3721
|
+
`;
|
|
3722
|
+
if (line.length - start > width && curr > start) {
|
|
3723
|
+
result += line.slice(start, curr) + `
|
|
3724
|
+
` + line.slice(curr + 1);
|
|
3725
|
+
} else {
|
|
3726
|
+
result += line.slice(start);
|
|
3727
|
+
}
|
|
3728
|
+
return result.slice(1);
|
|
3729
|
+
}
|
|
3730
|
+
function escapeString(string2) {
|
|
3731
|
+
var result = "";
|
|
3732
|
+
var char = 0;
|
|
3733
|
+
var escapeSeq;
|
|
3734
|
+
for (var i2 = 0;i2 < string2.length; char >= 65536 ? i2 += 2 : i2++) {
|
|
3735
|
+
char = codePointAt(string2, i2);
|
|
3736
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
3737
|
+
if (!escapeSeq && isPrintable(char)) {
|
|
3738
|
+
result += string2[i2];
|
|
3739
|
+
if (char >= 65536)
|
|
3740
|
+
result += string2[i2 + 1];
|
|
3741
|
+
} else {
|
|
3742
|
+
result += escapeSeq || encodeHex(char);
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
return result;
|
|
3746
|
+
}
|
|
3747
|
+
function writeFlowSequence(state, level, object2) {
|
|
3748
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
3749
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
3750
|
+
value = object2[index];
|
|
3751
|
+
if (state.replacer) {
|
|
3752
|
+
value = state.replacer.call(object2, String(index), value);
|
|
3753
|
+
}
|
|
3754
|
+
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
3755
|
+
if (_result !== "")
|
|
3756
|
+
_result += "," + (!state.condenseFlow ? " " : "");
|
|
3757
|
+
_result += state.dump;
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3760
|
+
state.tag = _tag;
|
|
3761
|
+
state.dump = "[" + _result + "]";
|
|
3762
|
+
}
|
|
3763
|
+
function writeBlockSequence(state, level, object2, compact) {
|
|
3764
|
+
var _result = "", _tag = state.tag, index, length, value;
|
|
3765
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
3766
|
+
value = object2[index];
|
|
3767
|
+
if (state.replacer) {
|
|
3768
|
+
value = state.replacer.call(object2, String(index), value);
|
|
3769
|
+
}
|
|
3770
|
+
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
|
|
3771
|
+
if (!compact || _result !== "") {
|
|
3772
|
+
_result += generateNextLine(state, level);
|
|
3773
|
+
}
|
|
3774
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3775
|
+
_result += "-";
|
|
3776
|
+
} else {
|
|
3777
|
+
_result += "- ";
|
|
3778
|
+
}
|
|
3779
|
+
_result += state.dump;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
state.tag = _tag;
|
|
3783
|
+
state.dump = _result || "[]";
|
|
3784
|
+
}
|
|
3785
|
+
function writeFlowMapping(state, level, object2) {
|
|
3786
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object2), index, length, objectKey, objectValue, pairBuffer;
|
|
3787
|
+
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
3788
|
+
pairBuffer = "";
|
|
3789
|
+
if (_result !== "")
|
|
3790
|
+
pairBuffer += ", ";
|
|
3791
|
+
if (state.condenseFlow)
|
|
3792
|
+
pairBuffer += '"';
|
|
3793
|
+
objectKey = objectKeyList[index];
|
|
3794
|
+
objectValue = object2[objectKey];
|
|
3795
|
+
if (state.replacer) {
|
|
3796
|
+
objectValue = state.replacer.call(object2, objectKey, objectValue);
|
|
3797
|
+
}
|
|
3798
|
+
if (!writeNode(state, level, objectKey, false, false)) {
|
|
3799
|
+
continue;
|
|
3800
|
+
}
|
|
3801
|
+
if (state.dump.length > 1024)
|
|
3802
|
+
pairBuffer += "? ";
|
|
3803
|
+
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
3804
|
+
if (!writeNode(state, level, objectValue, false, false)) {
|
|
3805
|
+
continue;
|
|
3806
|
+
}
|
|
3807
|
+
pairBuffer += state.dump;
|
|
3808
|
+
_result += pairBuffer;
|
|
3809
|
+
}
|
|
3810
|
+
state.tag = _tag;
|
|
3811
|
+
state.dump = "{" + _result + "}";
|
|
3812
|
+
}
|
|
3813
|
+
function writeBlockMapping(state, level, object2, compact) {
|
|
3814
|
+
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object2), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
3815
|
+
if (state.sortKeys === true) {
|
|
3816
|
+
objectKeyList.sort();
|
|
3817
|
+
} else if (typeof state.sortKeys === "function") {
|
|
3818
|
+
objectKeyList.sort(state.sortKeys);
|
|
3819
|
+
} else if (state.sortKeys) {
|
|
3820
|
+
throw new exception("sortKeys must be a boolean or a function");
|
|
3821
|
+
}
|
|
3822
|
+
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
3823
|
+
pairBuffer = "";
|
|
3824
|
+
if (!compact || _result !== "") {
|
|
3825
|
+
pairBuffer += generateNextLine(state, level);
|
|
3826
|
+
}
|
|
3827
|
+
objectKey = objectKeyList[index];
|
|
3828
|
+
objectValue = object2[objectKey];
|
|
3829
|
+
if (state.replacer) {
|
|
3830
|
+
objectValue = state.replacer.call(object2, objectKey, objectValue);
|
|
3831
|
+
}
|
|
3832
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
3833
|
+
continue;
|
|
3834
|
+
}
|
|
3835
|
+
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
3836
|
+
if (explicitPair) {
|
|
3837
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3838
|
+
pairBuffer += "?";
|
|
3839
|
+
} else {
|
|
3840
|
+
pairBuffer += "? ";
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
pairBuffer += state.dump;
|
|
3844
|
+
if (explicitPair) {
|
|
3845
|
+
pairBuffer += generateNextLine(state, level);
|
|
3846
|
+
}
|
|
3847
|
+
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
3848
|
+
continue;
|
|
3849
|
+
}
|
|
3850
|
+
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
3851
|
+
pairBuffer += ":";
|
|
3852
|
+
} else {
|
|
3853
|
+
pairBuffer += ": ";
|
|
3854
|
+
}
|
|
3855
|
+
pairBuffer += state.dump;
|
|
3856
|
+
_result += pairBuffer;
|
|
3857
|
+
}
|
|
3858
|
+
state.tag = _tag;
|
|
3859
|
+
state.dump = _result || "{}";
|
|
3860
|
+
}
|
|
3861
|
+
function detectType(state, object2, explicit) {
|
|
3862
|
+
var _result, typeList, index, length, type2, style;
|
|
3863
|
+
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
3864
|
+
for (index = 0, length = typeList.length;index < length; index += 1) {
|
|
3865
|
+
type2 = typeList[index];
|
|
3866
|
+
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object2 === "object" && object2 instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object2))) {
|
|
3867
|
+
if (explicit) {
|
|
3868
|
+
if (type2.multi && type2.representName) {
|
|
3869
|
+
state.tag = type2.representName(object2);
|
|
3870
|
+
} else {
|
|
3871
|
+
state.tag = type2.tag;
|
|
3872
|
+
}
|
|
3873
|
+
} else {
|
|
3874
|
+
state.tag = "?";
|
|
3875
|
+
}
|
|
3876
|
+
if (type2.represent) {
|
|
3877
|
+
style = state.styleMap[type2.tag] || type2.defaultStyle;
|
|
3878
|
+
if (_toString.call(type2.represent) === "[object Function]") {
|
|
3879
|
+
_result = type2.represent(object2, style);
|
|
3880
|
+
} else if (_hasOwnProperty.call(type2.represent, style)) {
|
|
3881
|
+
_result = type2.represent[style](object2, style);
|
|
3882
|
+
} else {
|
|
3883
|
+
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
|
|
3884
|
+
}
|
|
3885
|
+
state.dump = _result;
|
|
3886
|
+
}
|
|
3887
|
+
return true;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
return false;
|
|
3891
|
+
}
|
|
3892
|
+
function writeNode(state, level, object2, block, compact, iskey, isblockseq) {
|
|
3893
|
+
state.tag = null;
|
|
3894
|
+
state.dump = object2;
|
|
3895
|
+
if (!detectType(state, object2, false)) {
|
|
3896
|
+
detectType(state, object2, true);
|
|
3897
|
+
}
|
|
3898
|
+
var type2 = _toString.call(state.dump);
|
|
3899
|
+
var inblock = block;
|
|
3900
|
+
var tagStr;
|
|
3901
|
+
if (block) {
|
|
3902
|
+
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
3903
|
+
}
|
|
3904
|
+
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
|
|
3905
|
+
if (objectOrArray) {
|
|
3906
|
+
duplicateIndex = state.duplicates.indexOf(object2);
|
|
3907
|
+
duplicate = duplicateIndex !== -1;
|
|
3908
|
+
}
|
|
3909
|
+
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
3910
|
+
compact = false;
|
|
3911
|
+
}
|
|
3912
|
+
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
3913
|
+
state.dump = "*ref_" + duplicateIndex;
|
|
3914
|
+
} else {
|
|
3915
|
+
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
3916
|
+
state.usedDuplicates[duplicateIndex] = true;
|
|
3917
|
+
}
|
|
3918
|
+
if (type2 === "[object Object]") {
|
|
3919
|
+
if (block && Object.keys(state.dump).length !== 0) {
|
|
3920
|
+
writeBlockMapping(state, level, state.dump, compact);
|
|
3921
|
+
if (duplicate) {
|
|
3922
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3923
|
+
}
|
|
3924
|
+
} else {
|
|
3925
|
+
writeFlowMapping(state, level, state.dump);
|
|
3926
|
+
if (duplicate) {
|
|
3927
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3928
|
+
}
|
|
3929
|
+
}
|
|
3930
|
+
} else if (type2 === "[object Array]") {
|
|
3931
|
+
if (block && state.dump.length !== 0) {
|
|
3932
|
+
if (state.noArrayIndent && !isblockseq && level > 0) {
|
|
3933
|
+
writeBlockSequence(state, level - 1, state.dump, compact);
|
|
3934
|
+
} else {
|
|
3935
|
+
writeBlockSequence(state, level, state.dump, compact);
|
|
3936
|
+
}
|
|
3937
|
+
if (duplicate) {
|
|
3938
|
+
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
3939
|
+
}
|
|
3940
|
+
} else {
|
|
3941
|
+
writeFlowSequence(state, level, state.dump);
|
|
3942
|
+
if (duplicate) {
|
|
3943
|
+
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
3944
|
+
}
|
|
3945
|
+
}
|
|
3946
|
+
} else if (type2 === "[object String]") {
|
|
3947
|
+
if (state.tag !== "?") {
|
|
3948
|
+
writeScalar(state, state.dump, level, iskey, inblock);
|
|
3949
|
+
}
|
|
3950
|
+
} else if (type2 === "[object Undefined]") {
|
|
3951
|
+
return false;
|
|
3952
|
+
} else {
|
|
3953
|
+
if (state.skipInvalid)
|
|
3954
|
+
return false;
|
|
3955
|
+
throw new exception("unacceptable kind of an object to dump " + type2);
|
|
3956
|
+
}
|
|
3957
|
+
if (state.tag !== null && state.tag !== "?") {
|
|
3958
|
+
tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
3959
|
+
if (state.tag[0] === "!") {
|
|
3960
|
+
tagStr = "!" + tagStr;
|
|
3961
|
+
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
|
|
3962
|
+
tagStr = "!!" + tagStr.slice(18);
|
|
3963
|
+
} else {
|
|
3964
|
+
tagStr = "!<" + tagStr + ">";
|
|
3965
|
+
}
|
|
3966
|
+
state.dump = tagStr + " " + state.dump;
|
|
3967
|
+
}
|
|
3968
|
+
}
|
|
3969
|
+
return true;
|
|
3970
|
+
}
|
|
3971
|
+
function getDuplicateReferences(object2, state) {
|
|
3972
|
+
var objects = [], duplicatesIndexes = [], index, length;
|
|
3973
|
+
inspectNode(object2, objects, duplicatesIndexes);
|
|
3974
|
+
for (index = 0, length = duplicatesIndexes.length;index < length; index += 1) {
|
|
3975
|
+
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
3976
|
+
}
|
|
3977
|
+
state.usedDuplicates = new Array(length);
|
|
3978
|
+
}
|
|
3979
|
+
function inspectNode(object2, objects, duplicatesIndexes) {
|
|
3980
|
+
var objectKeyList, index, length;
|
|
3981
|
+
if (object2 !== null && typeof object2 === "object") {
|
|
3982
|
+
index = objects.indexOf(object2);
|
|
3983
|
+
if (index !== -1) {
|
|
3984
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
3985
|
+
duplicatesIndexes.push(index);
|
|
3986
|
+
}
|
|
3987
|
+
} else {
|
|
3988
|
+
objects.push(object2);
|
|
3989
|
+
if (Array.isArray(object2)) {
|
|
3990
|
+
for (index = 0, length = object2.length;index < length; index += 1) {
|
|
3991
|
+
inspectNode(object2[index], objects, duplicatesIndexes);
|
|
3992
|
+
}
|
|
3993
|
+
} else {
|
|
3994
|
+
objectKeyList = Object.keys(object2);
|
|
3995
|
+
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
|
|
3996
|
+
inspectNode(object2[objectKeyList[index]], objects, duplicatesIndexes);
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
function dump$1(input, options) {
|
|
4003
|
+
options = options || {};
|
|
4004
|
+
var state = new State(options);
|
|
4005
|
+
if (!state.noRefs)
|
|
4006
|
+
getDuplicateReferences(input, state);
|
|
4007
|
+
var value = input;
|
|
4008
|
+
if (state.replacer) {
|
|
4009
|
+
value = state.replacer.call({ "": value }, "", value);
|
|
4010
|
+
}
|
|
4011
|
+
if (writeNode(state, 0, value, true, true))
|
|
4012
|
+
return state.dump + `
|
|
4013
|
+
`;
|
|
4014
|
+
return "";
|
|
4015
|
+
}
|
|
4016
|
+
function renamed(from, to) {
|
|
4017
|
+
return function() {
|
|
4018
|
+
throw new Error("Function yaml." + from + " is removed in js-yaml 4. " + "Use yaml." + to + " instead, which is now safe by default.");
|
|
4019
|
+
};
|
|
4020
|
+
}
|
|
4021
|
+
var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
4022
|
+
\r`, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN = 1, CONTEXT_FLOW_OUT = 2, CONTEXT_BLOCK_IN = 3, CONTEXT_BLOCK_OUT = 4, CHOMPING_CLIP = 1, CHOMPING_STRIP = 2, CHOMPING_KEEP = 3, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM = 65279, CHAR_TAB = 9, CHAR_LINE_FEED = 10, CHAR_CARRIAGE_RETURN = 13, CHAR_SPACE = 32, CHAR_EXCLAMATION = 33, CHAR_DOUBLE_QUOTE = 34, CHAR_SHARP = 35, CHAR_PERCENT = 37, CHAR_AMPERSAND = 38, CHAR_SINGLE_QUOTE = 39, CHAR_ASTERISK = 42, CHAR_COMMA = 44, CHAR_MINUS = 45, CHAR_COLON = 58, CHAR_EQUALS = 61, CHAR_GREATER_THAN = 62, CHAR_QUESTION = 63, CHAR_COMMERCIAL_AT = 64, CHAR_LEFT_SQUARE_BRACKET = 91, CHAR_RIGHT_SQUARE_BRACKET = 93, CHAR_GRAVE_ACCENT = 96, CHAR_LEFT_CURLY_BRACKET = 123, CHAR_VERTICAL_LINE = 124, CHAR_RIGHT_CURLY_BRACKET = 125, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2, STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5, dump_1, dumper, load, loadAll, dump, safeLoad, safeLoadAll, safeDump;
|
|
4023
|
+
var init_js_yaml = __esm(() => {
|
|
4024
|
+
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
4025
|
+
isNothing_1 = isNothing;
|
|
4026
|
+
isObject_1 = isObject;
|
|
4027
|
+
toArray_1 = toArray;
|
|
4028
|
+
repeat_1 = repeat;
|
|
4029
|
+
isNegativeZero_1 = isNegativeZero;
|
|
4030
|
+
extend_1 = extend;
|
|
4031
|
+
common = {
|
|
4032
|
+
isNothing: isNothing_1,
|
|
4033
|
+
isObject: isObject_1,
|
|
4034
|
+
toArray: toArray_1,
|
|
4035
|
+
repeat: repeat_1,
|
|
4036
|
+
isNegativeZero: isNegativeZero_1,
|
|
4037
|
+
extend: extend_1
|
|
4038
|
+
};
|
|
4039
|
+
YAMLException$1.prototype = Object.create(Error.prototype);
|
|
4040
|
+
YAMLException$1.prototype.constructor = YAMLException$1;
|
|
4041
|
+
YAMLException$1.prototype.toString = function toString(compact) {
|
|
4042
|
+
return this.name + ": " + formatError(this, compact);
|
|
4043
|
+
};
|
|
4044
|
+
exception = YAMLException$1;
|
|
4045
|
+
snippet = makeSnippet;
|
|
4046
|
+
TYPE_CONSTRUCTOR_OPTIONS = [
|
|
4047
|
+
"kind",
|
|
4048
|
+
"multi",
|
|
4049
|
+
"resolve",
|
|
4050
|
+
"construct",
|
|
4051
|
+
"instanceOf",
|
|
4052
|
+
"predicate",
|
|
4053
|
+
"represent",
|
|
4054
|
+
"representName",
|
|
4055
|
+
"defaultStyle",
|
|
4056
|
+
"styleAliases"
|
|
4057
|
+
];
|
|
4058
|
+
YAML_NODE_KINDS = [
|
|
4059
|
+
"scalar",
|
|
4060
|
+
"sequence",
|
|
4061
|
+
"mapping"
|
|
4062
|
+
];
|
|
4063
|
+
type = Type$1;
|
|
4064
|
+
Schema$1.prototype.extend = function extend2(definition) {
|
|
4065
|
+
var implicit = [];
|
|
4066
|
+
var explicit = [];
|
|
4067
|
+
if (definition instanceof type) {
|
|
4068
|
+
explicit.push(definition);
|
|
4069
|
+
} else if (Array.isArray(definition)) {
|
|
4070
|
+
explicit = explicit.concat(definition);
|
|
4071
|
+
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
4072
|
+
if (definition.implicit)
|
|
4073
|
+
implicit = implicit.concat(definition.implicit);
|
|
4074
|
+
if (definition.explicit)
|
|
4075
|
+
explicit = explicit.concat(definition.explicit);
|
|
4076
|
+
} else {
|
|
4077
|
+
throw new exception("Schema.extend argument should be a Type, [ Type ], " + "or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
4078
|
+
}
|
|
4079
|
+
implicit.forEach(function(type$1) {
|
|
4080
|
+
if (!(type$1 instanceof type)) {
|
|
4081
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
4082
|
+
}
|
|
4083
|
+
if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
|
4084
|
+
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
4085
|
+
}
|
|
4086
|
+
if (type$1.multi) {
|
|
4087
|
+
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
4088
|
+
}
|
|
4089
|
+
});
|
|
4090
|
+
explicit.forEach(function(type$1) {
|
|
4091
|
+
if (!(type$1 instanceof type)) {
|
|
4092
|
+
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
4093
|
+
}
|
|
4094
|
+
});
|
|
4095
|
+
var result = Object.create(Schema$1.prototype);
|
|
4096
|
+
result.implicit = (this.implicit || []).concat(implicit);
|
|
4097
|
+
result.explicit = (this.explicit || []).concat(explicit);
|
|
4098
|
+
result.compiledImplicit = compileList(result, "implicit");
|
|
4099
|
+
result.compiledExplicit = compileList(result, "explicit");
|
|
4100
|
+
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
4101
|
+
return result;
|
|
4102
|
+
};
|
|
4103
|
+
schema = Schema$1;
|
|
4104
|
+
str = new type("tag:yaml.org,2002:str", {
|
|
4105
|
+
kind: "scalar",
|
|
4106
|
+
construct: function(data) {
|
|
4107
|
+
return data !== null ? data : "";
|
|
4108
|
+
}
|
|
4109
|
+
});
|
|
4110
|
+
seq = new type("tag:yaml.org,2002:seq", {
|
|
4111
|
+
kind: "sequence",
|
|
4112
|
+
construct: function(data) {
|
|
4113
|
+
return data !== null ? data : [];
|
|
4114
|
+
}
|
|
4115
|
+
});
|
|
4116
|
+
map = new type("tag:yaml.org,2002:map", {
|
|
4117
|
+
kind: "mapping",
|
|
4118
|
+
construct: function(data) {
|
|
4119
|
+
return data !== null ? data : {};
|
|
4120
|
+
}
|
|
4121
|
+
});
|
|
4122
|
+
failsafe = new schema({
|
|
4123
|
+
explicit: [
|
|
4124
|
+
str,
|
|
4125
|
+
seq,
|
|
4126
|
+
map
|
|
4127
|
+
]
|
|
4128
|
+
});
|
|
4129
|
+
_null = new type("tag:yaml.org,2002:null", {
|
|
4130
|
+
kind: "scalar",
|
|
4131
|
+
resolve: resolveYamlNull,
|
|
4132
|
+
construct: constructYamlNull,
|
|
4133
|
+
predicate: isNull,
|
|
4134
|
+
represent: {
|
|
4135
|
+
canonical: function() {
|
|
4136
|
+
return "~";
|
|
4137
|
+
},
|
|
4138
|
+
lowercase: function() {
|
|
4139
|
+
return "null";
|
|
4140
|
+
},
|
|
4141
|
+
uppercase: function() {
|
|
4142
|
+
return "NULL";
|
|
4143
|
+
},
|
|
4144
|
+
camelcase: function() {
|
|
4145
|
+
return "Null";
|
|
4146
|
+
},
|
|
4147
|
+
empty: function() {
|
|
4148
|
+
return "";
|
|
4149
|
+
}
|
|
4150
|
+
},
|
|
4151
|
+
defaultStyle: "lowercase"
|
|
4152
|
+
});
|
|
4153
|
+
bool = new type("tag:yaml.org,2002:bool", {
|
|
4154
|
+
kind: "scalar",
|
|
4155
|
+
resolve: resolveYamlBoolean,
|
|
4156
|
+
construct: constructYamlBoolean,
|
|
4157
|
+
predicate: isBoolean,
|
|
4158
|
+
represent: {
|
|
4159
|
+
lowercase: function(object2) {
|
|
4160
|
+
return object2 ? "true" : "false";
|
|
4161
|
+
},
|
|
4162
|
+
uppercase: function(object2) {
|
|
4163
|
+
return object2 ? "TRUE" : "FALSE";
|
|
4164
|
+
},
|
|
4165
|
+
camelcase: function(object2) {
|
|
4166
|
+
return object2 ? "True" : "False";
|
|
4167
|
+
}
|
|
4168
|
+
},
|
|
4169
|
+
defaultStyle: "lowercase"
|
|
4170
|
+
});
|
|
4171
|
+
int = new type("tag:yaml.org,2002:int", {
|
|
4172
|
+
kind: "scalar",
|
|
4173
|
+
resolve: resolveYamlInteger,
|
|
4174
|
+
construct: constructYamlInteger,
|
|
4175
|
+
predicate: isInteger,
|
|
4176
|
+
represent: {
|
|
4177
|
+
binary: function(obj) {
|
|
4178
|
+
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
4179
|
+
},
|
|
4180
|
+
octal: function(obj) {
|
|
4181
|
+
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
|
4182
|
+
},
|
|
4183
|
+
decimal: function(obj) {
|
|
4184
|
+
return obj.toString(10);
|
|
4185
|
+
},
|
|
4186
|
+
hexadecimal: function(obj) {
|
|
4187
|
+
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
4188
|
+
}
|
|
4189
|
+
},
|
|
4190
|
+
defaultStyle: "decimal",
|
|
4191
|
+
styleAliases: {
|
|
4192
|
+
binary: [2, "bin"],
|
|
4193
|
+
octal: [8, "oct"],
|
|
4194
|
+
decimal: [10, "dec"],
|
|
4195
|
+
hexadecimal: [16, "hex"]
|
|
4196
|
+
}
|
|
4197
|
+
});
|
|
4198
|
+
YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
|
|
4199
|
+
SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
4200
|
+
float = new type("tag:yaml.org,2002:float", {
|
|
4201
|
+
kind: "scalar",
|
|
4202
|
+
resolve: resolveYamlFloat,
|
|
4203
|
+
construct: constructYamlFloat,
|
|
4204
|
+
predicate: isFloat,
|
|
4205
|
+
represent: representYamlFloat,
|
|
4206
|
+
defaultStyle: "lowercase"
|
|
4207
|
+
});
|
|
4208
|
+
json = failsafe.extend({
|
|
4209
|
+
implicit: [
|
|
4210
|
+
_null,
|
|
4211
|
+
bool,
|
|
4212
|
+
int,
|
|
4213
|
+
float
|
|
4214
|
+
]
|
|
4215
|
+
});
|
|
4216
|
+
core = json;
|
|
4217
|
+
YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
|
|
4218
|
+
YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9]?)" + "-([0-9][0-9]?)" + "(?:[Tt]|[ \\t]+)" + "([0-9][0-9]?)" + ":([0-9][0-9])" + ":([0-9][0-9])" + "(?:\\.([0-9]*))?" + "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + "(?::([0-9][0-9]))?))?$");
|
|
4219
|
+
timestamp = new type("tag:yaml.org,2002:timestamp", {
|
|
4220
|
+
kind: "scalar",
|
|
4221
|
+
resolve: resolveYamlTimestamp,
|
|
4222
|
+
construct: constructYamlTimestamp,
|
|
4223
|
+
instanceOf: Date,
|
|
4224
|
+
represent: representYamlTimestamp
|
|
4225
|
+
});
|
|
4226
|
+
merge = new type("tag:yaml.org,2002:merge", {
|
|
4227
|
+
kind: "scalar",
|
|
4228
|
+
resolve: resolveYamlMerge
|
|
4229
|
+
});
|
|
4230
|
+
binary = new type("tag:yaml.org,2002:binary", {
|
|
4231
|
+
kind: "scalar",
|
|
4232
|
+
resolve: resolveYamlBinary,
|
|
4233
|
+
construct: constructYamlBinary,
|
|
4234
|
+
predicate: isBinary,
|
|
4235
|
+
represent: representYamlBinary
|
|
4236
|
+
});
|
|
4237
|
+
_hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
4238
|
+
_toString$2 = Object.prototype.toString;
|
|
4239
|
+
omap = new type("tag:yaml.org,2002:omap", {
|
|
4240
|
+
kind: "sequence",
|
|
4241
|
+
resolve: resolveYamlOmap,
|
|
4242
|
+
construct: constructYamlOmap
|
|
4243
|
+
});
|
|
4244
|
+
_toString$1 = Object.prototype.toString;
|
|
4245
|
+
pairs = new type("tag:yaml.org,2002:pairs", {
|
|
4246
|
+
kind: "sequence",
|
|
4247
|
+
resolve: resolveYamlPairs,
|
|
4248
|
+
construct: constructYamlPairs
|
|
4249
|
+
});
|
|
4250
|
+
_hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
4251
|
+
set = new type("tag:yaml.org,2002:set", {
|
|
4252
|
+
kind: "mapping",
|
|
4253
|
+
resolve: resolveYamlSet,
|
|
4254
|
+
construct: constructYamlSet
|
|
4255
|
+
});
|
|
4256
|
+
_default = core.extend({
|
|
4257
|
+
implicit: [
|
|
4258
|
+
timestamp,
|
|
4259
|
+
merge
|
|
4260
|
+
],
|
|
4261
|
+
explicit: [
|
|
4262
|
+
binary,
|
|
4263
|
+
omap,
|
|
4264
|
+
pairs,
|
|
4265
|
+
set
|
|
4266
|
+
]
|
|
4267
|
+
});
|
|
4268
|
+
_hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
4269
|
+
PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
4270
|
+
PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
4271
|
+
PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
4272
|
+
PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
4273
|
+
PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
4274
|
+
simpleEscapeCheck = new Array(256);
|
|
4275
|
+
simpleEscapeMap = new Array(256);
|
|
4276
|
+
for (i = 0;i < 256; i++) {
|
|
4277
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
4278
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
4279
|
+
}
|
|
4280
|
+
directiveHandlers = {
|
|
4281
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
4282
|
+
var match, major, minor;
|
|
4283
|
+
if (state.version !== null) {
|
|
4284
|
+
throwError(state, "duplication of %YAML directive");
|
|
4285
|
+
}
|
|
4286
|
+
if (args.length !== 1) {
|
|
4287
|
+
throwError(state, "YAML directive accepts exactly one argument");
|
|
4288
|
+
}
|
|
4289
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
4290
|
+
if (match === null) {
|
|
4291
|
+
throwError(state, "ill-formed argument of the YAML directive");
|
|
4292
|
+
}
|
|
4293
|
+
major = parseInt(match[1], 10);
|
|
4294
|
+
minor = parseInt(match[2], 10);
|
|
4295
|
+
if (major !== 1) {
|
|
4296
|
+
throwError(state, "unacceptable YAML version of the document");
|
|
4297
|
+
}
|
|
4298
|
+
state.version = args[0];
|
|
4299
|
+
state.checkLineBreaks = minor < 2;
|
|
4300
|
+
if (minor !== 1 && minor !== 2) {
|
|
4301
|
+
throwWarning(state, "unsupported YAML version of the document");
|
|
4302
|
+
}
|
|
4303
|
+
},
|
|
4304
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
4305
|
+
var handle, prefix;
|
|
4306
|
+
if (args.length !== 2) {
|
|
4307
|
+
throwError(state, "TAG directive accepts exactly two arguments");
|
|
4308
|
+
}
|
|
4309
|
+
handle = args[0];
|
|
4310
|
+
prefix = args[1];
|
|
4311
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
4312
|
+
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
4313
|
+
}
|
|
4314
|
+
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
4315
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
4316
|
+
}
|
|
4317
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
4318
|
+
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
4319
|
+
}
|
|
4320
|
+
try {
|
|
4321
|
+
prefix = decodeURIComponent(prefix);
|
|
4322
|
+
} catch (err) {
|
|
4323
|
+
throwError(state, "tag prefix is malformed: " + prefix);
|
|
4324
|
+
}
|
|
4325
|
+
state.tagMap[handle] = prefix;
|
|
4326
|
+
}
|
|
4327
|
+
};
|
|
4328
|
+
loadAll_1 = loadAll$1;
|
|
4329
|
+
load_1 = load$1;
|
|
4330
|
+
loader = {
|
|
4331
|
+
loadAll: loadAll_1,
|
|
4332
|
+
load: load_1
|
|
4333
|
+
};
|
|
4334
|
+
_toString = Object.prototype.toString;
|
|
4335
|
+
_hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
4336
|
+
ESCAPE_SEQUENCES = {};
|
|
4337
|
+
ESCAPE_SEQUENCES[0] = "\\0";
|
|
4338
|
+
ESCAPE_SEQUENCES[7] = "\\a";
|
|
4339
|
+
ESCAPE_SEQUENCES[8] = "\\b";
|
|
4340
|
+
ESCAPE_SEQUENCES[9] = "\\t";
|
|
4341
|
+
ESCAPE_SEQUENCES[10] = "\\n";
|
|
4342
|
+
ESCAPE_SEQUENCES[11] = "\\v";
|
|
4343
|
+
ESCAPE_SEQUENCES[12] = "\\f";
|
|
4344
|
+
ESCAPE_SEQUENCES[13] = "\\r";
|
|
4345
|
+
ESCAPE_SEQUENCES[27] = "\\e";
|
|
4346
|
+
ESCAPE_SEQUENCES[34] = "\\\"";
|
|
4347
|
+
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
4348
|
+
ESCAPE_SEQUENCES[133] = "\\N";
|
|
4349
|
+
ESCAPE_SEQUENCES[160] = "\\_";
|
|
4350
|
+
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
4351
|
+
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
4352
|
+
DEPRECATED_BOOLEANS_SYNTAX = [
|
|
4353
|
+
"y",
|
|
4354
|
+
"Y",
|
|
4355
|
+
"yes",
|
|
4356
|
+
"Yes",
|
|
4357
|
+
"YES",
|
|
4358
|
+
"on",
|
|
4359
|
+
"On",
|
|
4360
|
+
"ON",
|
|
4361
|
+
"n",
|
|
4362
|
+
"N",
|
|
4363
|
+
"no",
|
|
4364
|
+
"No",
|
|
4365
|
+
"NO",
|
|
4366
|
+
"off",
|
|
4367
|
+
"Off",
|
|
4368
|
+
"OFF"
|
|
4369
|
+
];
|
|
4370
|
+
DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
4371
|
+
dump_1 = dump$1;
|
|
4372
|
+
dumper = {
|
|
4373
|
+
dump: dump_1
|
|
4374
|
+
};
|
|
4375
|
+
load = loader.load;
|
|
4376
|
+
loadAll = loader.loadAll;
|
|
4377
|
+
dump = dumper.dump;
|
|
4378
|
+
safeLoad = renamed("safeLoad", "load");
|
|
4379
|
+
safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
4380
|
+
safeDump = renamed("safeDump", "dump");
|
|
4381
|
+
});
|
|
4382
|
+
|
|
1749
4383
|
// ../skills/src/bundled-data.generated.ts
|
|
1750
4384
|
var exports_bundled_data_generated = {};
|
|
1751
4385
|
__export(exports_bundled_data_generated, {
|
|
@@ -4711,7 +7345,6 @@ Esta skill se activa cuando el usuario necesita:
|
|
|
4711
7345
|
// ../skills/src/loader.ts
|
|
4712
7346
|
import * as fs from "fs";
|
|
4713
7347
|
import * as path5 from "path";
|
|
4714
|
-
import * as yaml from "js-yaml";
|
|
4715
7348
|
function createLogger() {
|
|
4716
7349
|
return {
|
|
4717
7350
|
debug: (msg, ...args) => console.debug(`[skills] ${msg}`, ...args),
|
|
@@ -4726,7 +7359,7 @@ function parseFrontmatter(content) {
|
|
|
4726
7359
|
return { frontmatter: {}, body: content };
|
|
4727
7360
|
}
|
|
4728
7361
|
try {
|
|
4729
|
-
const frontmatter =
|
|
7362
|
+
const frontmatter = load(match[1]);
|
|
4730
7363
|
const body = match[2];
|
|
4731
7364
|
return { frontmatter, body };
|
|
4732
7365
|
} catch {
|
|
@@ -4936,6 +7569,7 @@ function createSkillLoader(config) {
|
|
|
4936
7569
|
}
|
|
4937
7570
|
var __dirname = "/home/johnpaez/Documentos/Agents/Hive/hive/packages/skills/src", STATIC_BUNDLED_DATA;
|
|
4938
7571
|
var init_loader2 = __esm(() => {
|
|
7572
|
+
init_js_yaml();
|
|
4939
7573
|
STATIC_BUNDLED_DATA = [];
|
|
4940
7574
|
try {
|
|
4941
7575
|
STATIC_BUNDLED_DATA = (init_bundled_data_generated(), __toCommonJS(exports_bundled_data_generated)).BUNDLED_SKILLS_DATA ?? [];
|