UNPKG

@modern-js/utils

Version:

A Progressive React Framework for modern web development.

1,124 lines 95.5 kB
(()=>{ "use strict"; var e = { 309: (e, t, r)=>{ var i = r(802); var n = r(208); function renamed(e, t) { return function() { throw new Error("Function yaml." + e + " is removed in js-yaml 4. Use yaml." + t + " instead, which is now safe by default."); }; } e.exports.Type = r(313); e.exports.Schema = r(706); e.exports.FAILSAFE_SCHEMA = r(68); e.exports.JSON_SCHEMA = r(875); e.exports.CORE_SCHEMA = r(454); e.exports.DEFAULT_SCHEMA = r(260); e.exports.load = i.load; e.exports.loadAll = i.loadAll; e.exports.dump = n.dump; e.exports.YAMLException = r(716); e.exports.types = { binary: r(497), float: r(980), map: r(952), null: r(697), pairs: r(399), set: r(610), timestamp: r(98), bool: r(204), int: r(707), merge: r(546), omap: r(5), seq: r(941), str: r(501) }; e.exports.safeLoad = renamed("safeLoad", "load"); e.exports.safeLoadAll = renamed("safeLoadAll", "loadAll"); e.exports.safeDump = renamed("safeDump", "dump"); }, 20: (e)=>{ function isNothing(e) { return null == e; } function isObject(e) { return "object" == typeof e && null !== e; } function toArray(e) { if (Array.isArray(e)) return e; if (isNothing(e)) return []; return [ e ]; } function extend(e, t) { var r, i, n, a; if (t) { a = Object.keys(t); for(r = 0, i = a.length; r < i; r += 1){ n = a[r]; e[n] = t[n]; } } return e; } function repeat(e, t) { var r = "", i; for(i = 0; i < t; i += 1)r += e; return r; } function isNegativeZero(e) { return 0 === e && -1 / 0 === 1 / e; } e.exports.isNothing = isNothing; e.exports.isObject = isObject; e.exports.toArray = toArray; e.exports.repeat = repeat; e.exports.isNegativeZero = isNegativeZero; e.exports.extend = extend; }, 208: (e, t, r)=>{ var i = r(20); var n = r(716); var a = r(260); var o = Object.prototype.toString; var l = Object.prototype.hasOwnProperty; var s = 65279; var c = 9; var u = 10; var p = 13; var f = 32; var d = 33; var h = 34; var m = 35; var g = 37; var v = 38; var w = 39; var y = 42; var S = 44; var A = 45; var b = 58; var x = 61; var k = 62; var E = 63; var _ = 64; var O = 91; var C = 93; var I = 96; var L = 123; var N = 124; var T = 125; var F = {}; F[0] = "\\0"; F[7] = "\\a"; F[8] = "\\b"; F[9] = "\\t"; F[10] = "\\n"; F[11] = "\\v"; F[12] = "\\f"; F[13] = "\\r"; F[27] = "\\e"; F[34] = '\\"'; F[92] = "\\\\"; F[133] = "\\N"; F[160] = "\\_"; F[8232] = "\\L"; F[8233] = "\\P"; var M = [ "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", "n", "N", "no", "No", "NO", "off", "Off", "OFF" ]; var j = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/; function compileStyleMap(e, t) { var r, i, n, a, o, s, c; if (null === t) return {}; r = {}; i = Object.keys(t); for(n = 0, a = i.length; n < a; n += 1){ o = i[n]; s = String(t[o]); if ("!!" === o.slice(0, 2)) o = "tag:yaml.org,2002:" + o.slice(2); c = e.compiledTypeMap["fallback"][o]; if (c && l.call(c.styleAliases, s)) s = c.styleAliases[s]; r[o] = s; } return r; } function encodeHex(e) { var t, r, a; t = e.toString(16).toUpperCase(); if (e <= 255) { r = "x"; a = 2; } else if (e <= 65535) { r = "u"; a = 4; } else if (e <= 4294967295) { r = "U"; a = 8; } else throw new n("code point within a string may not be greater than 0xFFFFFFFF"); return "\\" + r + i.repeat("0", a - t.length) + t; } var Y = 1, P = 2; function State(e) { this.schema = e["schema"] || a; this.indent = Math.max(1, e["indent"] || 2); this.noArrayIndent = e["noArrayIndent"] || false; this.skipInvalid = e["skipInvalid"] || false; this.flowLevel = i.isNothing(e["flowLevel"]) ? -1 : e["flowLevel"]; this.styleMap = compileStyleMap(this.schema, e["styles"] || null); this.sortKeys = e["sortKeys"] || false; this.lineWidth = e["lineWidth"] || 80; this.noRefs = e["noRefs"] || false; this.noCompatMode = e["noCompatMode"] || false; this.condenseFlow = e["condenseFlow"] || false; this.quotingType = '"' === e["quotingType"] ? P : Y; this.forceQuotes = e["forceQuotes"] || false; this.replacer = "function" == typeof e["replacer"] ? e["replacer"] : null; this.implicitTypes = this.schema.compiledImplicit; this.explicitTypes = this.schema.compiledExplicit; this.tag = null; this.result = ""; this.duplicates = []; this.usedDuplicates = null; } function indentString(e, t) { var r = i.repeat(" ", t), n = 0, a = -1, o = "", l, s = e.length; while(n < s){ a = e.indexOf("\n", n); if (-1 === a) { l = e.slice(n); n = s; } else { l = e.slice(n, a + 1); n = a + 1; } if (l.length && "\n" !== l) o += r; o += l; } return o; } function generateNextLine(e, t) { return "\n" + i.repeat(" ", e.indent * t); } function testImplicitResolving(e, t) { var r, i, n; for(r = 0, i = e.implicitTypes.length; r < i; r += 1){ n = e.implicitTypes[r]; if (n.resolve(t)) return true; } return false; } function isWhitespace(e) { return e === f || e === c; } function isPrintable(e) { return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && 8232 !== e && 8233 !== e || 57344 <= e && e <= 65533 && e !== s || 65536 <= e && e <= 1114111; } function isNsCharOrWhitespace(e) { return isPrintable(e) && e !== s && e !== p && e !== u; } function isPlainSafe(e, t, r) { var i = isNsCharOrWhitespace(e); var n = i && !isWhitespace(e); return (r ? i : i && e !== S && e !== O && e !== C && e !== L && e !== T) && e !== m && !(t === b && !n) || isNsCharOrWhitespace(t) && !isWhitespace(t) && e === m || t === b && n; } function isPlainSafeFirst(e) { return isPrintable(e) && e !== s && !isWhitespace(e) && e !== A && e !== E && e !== b && e !== S && e !== O && e !== C && e !== L && e !== T && e !== m && e !== v && e !== y && e !== d && e !== N && e !== x && e !== k && e !== w && e !== h && e !== g && e !== _ && e !== I; } function isPlainSafeLast(e) { return !isWhitespace(e) && e !== b; } function codePointAt(e, t) { var r = e.charCodeAt(t), i; if (r >= 55296 && r <= 56319 && t + 1 < e.length) { i = e.charCodeAt(t + 1); if (i >= 56320 && i <= 57343) return (r - 55296) * 1024 + i - 56320 + 65536; } return r; } function needIndentIndicator(e) { var t = /^\n* /; return t.test(e); } var W = 1, D = 2, B = 3, R = 4, q = 5; function chooseScalarStyle(e, t, r, i, n, a, o, l) { var s; var c = 0; var p = null; var f = false; var d = false; var h = -1 !== i; var m = -1; var g = isPlainSafeFirst(codePointAt(e, 0)) && isPlainSafeLast(codePointAt(e, e.length - 1)); if (t || o) for(s = 0; s < e.length; c >= 65536 ? s += 2 : s++){ c = codePointAt(e, s); if (!isPrintable(c)) return q; g = g && isPlainSafe(c, p, l); p = c; } else { for(s = 0; s < e.length; c >= 65536 ? s += 2 : s++){ c = codePointAt(e, s); if (c === u) { f = true; if (h) { d = d || s - m - 1 > i && " " !== e[m + 1]; m = s; } } else if (!isPrintable(c)) return q; g = g && isPlainSafe(c, p, l); p = c; } d = d || h && s - m - 1 > i && " " !== e[m + 1]; } if (!f && !d) { if (g && !o && !n(e)) return W; return a === P ? q : D; } if (r > 9 && needIndentIndicator(e)) return q; if (!o) return d ? R : B; return a === P ? q : D; } function writeScalar(e, t, r, i, a) { e.dump = function() { if (0 === t.length) return e.quotingType === P ? '""' : "''"; if (!e.noCompatMode) { if (-1 !== M.indexOf(t) || j.test(t)) return e.quotingType === P ? '"' + t + '"' : "'" + t + "'"; } var o = e.indent * Math.max(1, r); var l = -1 === e.lineWidth ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - o); var s = i || e.flowLevel > -1 && r >= e.flowLevel; function testAmbiguity(t) { return testImplicitResolving(e, t); } switch(chooseScalarStyle(t, s, e.indent, l, testAmbiguity, e.quotingType, e.forceQuotes && !i, a)){ case W: return t; case D: return "'" + t.replace(/'/g, "''") + "'"; case B: return "|" + blockHeader(t, e.indent) + dropEndingNewline(indentString(t, o)); case R: return ">" + blockHeader(t, e.indent) + dropEndingNewline(indentString(foldString(t, l), o)); case q: return '"' + escapeString(t) + '"'; default: throw new n("impossible error: invalid scalar style"); } }(); } function blockHeader(e, t) { var r = needIndentIndicator(e) ? String(t) : ""; var i = "\n" === e[e.length - 1]; var n = i && ("\n" === e[e.length - 2] || "\n" === e); var a = n ? "+" : i ? "" : "-"; return r + a + "\n"; } function dropEndingNewline(e) { return "\n" === e[e.length - 1] ? e.slice(0, -1) : e; } function foldString(e, t) { var r = /(\n+)([^\n]*)/g; var i = function() { var i = e.indexOf("\n"); i = -1 !== i ? i : e.length; r.lastIndex = i; return foldLine(e.slice(0, i), t); }(); var n = "\n" === e[0] || " " === e[0]; var a; var o; while(o = r.exec(e)){ var l = o[1], s = o[2]; a = " " === s[0]; i += l + (n || a || "" === s ? "" : "\n") + foldLine(s, t); n = a; } return i; } function foldLine(e, t) { if ("" === e || " " === e[0]) return e; var r = / [^ ]/g; var i; var n = 0, a, o = 0, l = 0; var s = ""; while(i = r.exec(e)){ l = i.index; if (l - n > t) { a = o > n ? o : l; s += "\n" + e.slice(n, a); n = a + 1; } o = l; } s += "\n"; if (e.length - n > t && o > n) s += e.slice(n, o) + "\n" + e.slice(o + 1); else s += e.slice(n); return s.slice(1); } function escapeString(e) { var t = ""; var r = 0; var i; for(var n = 0; n < e.length; r >= 65536 ? n += 2 : n++){ r = codePointAt(e, n); i = F[r]; if (!i && isPrintable(r)) { t += e[n]; if (r >= 65536) t += e[n + 1]; } else t += i || encodeHex(r); } return t; } function writeFlowSequence(e, t, r) { var i = "", n = e.tag, a, o, l; for(a = 0, o = r.length; a < o; a += 1){ l = r[a]; if (e.replacer) l = e.replacer.call(r, String(a), l); if (writeNode(e, t, l, false, false) || void 0 === l && writeNode(e, t, null, false, false)) { if ("" !== i) i += "," + (e.condenseFlow ? "" : " "); i += e.dump; } } e.tag = n; e.dump = "[" + i + "]"; } function writeBlockSequence(e, t, r, i) { var n = "", a = e.tag, o, l, s; for(o = 0, l = r.length; o < l; o += 1){ s = r[o]; if (e.replacer) s = e.replacer.call(r, String(o), s); if (writeNode(e, t + 1, s, true, true, false, true) || void 0 === s && writeNode(e, t + 1, null, true, true, false, true)) { if (!i || "" !== n) n += generateNextLine(e, t); if (e.dump && u === e.dump.charCodeAt(0)) n += "-"; else n += "- "; n += e.dump; } } e.tag = a; e.dump = n || "[]"; } function writeFlowMapping(e, t, r) { var i = "", n = e.tag, a = Object.keys(r), o, l, s, c, u; for(o = 0, l = a.length; o < l; o += 1){ u = ""; if ("" !== i) u += ", "; if (e.condenseFlow) u += '"'; s = a[o]; c = r[s]; if (e.replacer) c = e.replacer.call(r, s, c); if (writeNode(e, t, s, false, false)) { if (e.dump.length > 1024) u += "? "; u += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "); if (writeNode(e, t, c, false, false)) { u += e.dump; i += u; } } } e.tag = n; e.dump = "{" + i + "}"; } function writeBlockMapping(e, t, r, i) { var a = "", o = e.tag, l = Object.keys(r), s, c, p, f, d, h; if (true === e.sortKeys) l.sort(); else if ("function" == typeof e.sortKeys) l.sort(e.sortKeys); else if (e.sortKeys) throw new n("sortKeys must be a boolean or a function"); for(s = 0, c = l.length; s < c; s += 1){ h = ""; if (!i || "" !== a) h += generateNextLine(e, t); p = l[s]; f = r[p]; if (e.replacer) f = e.replacer.call(r, p, f); if (writeNode(e, t + 1, p, true, true, true)) { d = null !== e.tag && "?" !== e.tag || e.dump && e.dump.length > 1024; if (d) if (e.dump && u === e.dump.charCodeAt(0)) h += "?"; else h += "? "; h += e.dump; if (d) h += generateNextLine(e, t); if (writeNode(e, t + 1, f, true, d)) { if (e.dump && u === e.dump.charCodeAt(0)) h += ":"; else h += ": "; h += e.dump; a += h; } } } e.tag = o; e.dump = a || "{}"; } function detectType(e, t, r) { var i, a, s, c, u, p; a = r ? e.explicitTypes : e.implicitTypes; for(s = 0, c = a.length; s < c; s += 1){ u = a[s]; if ((u.instanceOf || u.predicate) && (!u.instanceOf || "object" == typeof t && t instanceof u.instanceOf) && (!u.predicate || u.predicate(t))) { if (r) if (u.multi && u.representName) e.tag = u.representName(t); else e.tag = u.tag; else e.tag = "?"; if (u.represent) { p = e.styleMap[u.tag] || u.defaultStyle; if ("[object Function]" === o.call(u.represent)) i = u.represent(t, p); else if (l.call(u.represent, p)) i = u.represent[p](t, p); else throw new n("!<" + u.tag + '> tag resolver accepts not "' + p + '" style'); e.dump = i; } return true; } } return false; } function writeNode(e, t, r, i, a, l, s) { e.tag = null; e.dump = r; if (!detectType(e, r, false)) detectType(e, r, true); var c = o.call(e.dump); var u = i; var p; if (i) i = e.flowLevel < 0 || e.flowLevel > t; var f = "[object Object]" === c || "[object Array]" === c, d, h; if (f) { d = e.duplicates.indexOf(r); h = -1 !== d; } if (null !== e.tag && "?" !== e.tag || h || 2 !== e.indent && t > 0) a = false; if (h && e.usedDuplicates[d]) e.dump = "*ref_" + d; else { if (f && h && !e.usedDuplicates[d]) e.usedDuplicates[d] = true; if ("[object Object]" === c) if (i && 0 !== Object.keys(e.dump).length) { writeBlockMapping(e, t, e.dump, a); if (h) e.dump = "&ref_" + d + e.dump; } else { writeFlowMapping(e, t, e.dump); if (h) e.dump = "&ref_" + d + " " + e.dump; } else if ("[object Array]" === c) if (i && 0 !== e.dump.length) { e.noArrayIndent && !s && t > 0 ? writeBlockSequence(e, t - 1, e.dump, a) : writeBlockSequence(e, t, e.dump, a); if (h) e.dump = "&ref_" + d + e.dump; } else { writeFlowSequence(e, t, e.dump); if (h) e.dump = "&ref_" + d + " " + e.dump; } else if ("[object String]" === c) { if ("?" !== e.tag) writeScalar(e, e.dump, t, l, u); } else { if ("[object Undefined]" === c) return false; if (e.skipInvalid) return false; throw new n("unacceptable kind of an object to dump " + c); } if (null !== e.tag && "?" !== e.tag) { p = encodeURI("!" === e.tag[0] ? e.tag.slice(1) : e.tag).replace(/!/g, "%21"); p = "!" === e.tag[0] ? "!" + p : "tag:yaml.org,2002:" === p.slice(0, 18) ? "!!" + p.slice(18) : "!<" + p + ">"; e.dump = p + " " + e.dump; } } return true; } function getDuplicateReferences(e, t) { var r = [], i = [], n, a; inspectNode(e, r, i); for(n = 0, a = i.length; n < a; n += 1)t.duplicates.push(r[i[n]]); t.usedDuplicates = new Array(a); } function inspectNode(e, t, r) { var i, n, a; if (null !== e && "object" == typeof e) { n = t.indexOf(e); if (-1 !== n) { if (-1 === r.indexOf(n)) r.push(n); } else { t.push(e); if (Array.isArray(e)) for(n = 0, a = e.length; n < a; n += 1)inspectNode(e[n], t, r); else { i = Object.keys(e); for(n = 0, a = i.length; n < a; n += 1)inspectNode(e[i[n]], t, r); } } } } function dump(e, t) { t = t || {}; var r = new State(t); if (!r.noRefs) getDuplicateReferences(e, r); var i = e; if (r.replacer) i = r.replacer.call({ "": i }, "", i); if (writeNode(r, 0, i, true, true)) return r.dump + "\n"; return ""; } e.exports.dump = dump; }, 716: (e)=>{ function formatError(e, t) { var r = "", i = e.reason || "(unknown reason)"; if (!e.mark) return i; if (e.mark.name) r += 'in "' + e.mark.name + '" '; r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")"; if (!t && e.mark.snippet) r += "\n\n" + e.mark.snippet; return i + " " + r; } function YAMLException(e, t) { Error.call(this); this.name = "YAMLException"; this.reason = e; this.mark = t; this.message = formatError(this, false); if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor); else this.stack = (new Error).stack || ""; } YAMLException.prototype = Object.create(Error.prototype); YAMLException.prototype.constructor = YAMLException; YAMLException.prototype.toString = function(e) { return this.name + ": " + formatError(this, e); }; e.exports = YAMLException; }, 802: (e, t, r)=>{ var i = r(20); var n = r(716); var a = r(148); var o = r(260); var l = Object.prototype.hasOwnProperty; var s = 1; var c = 2; var u = 3; var p = 4; var f = 1; var d = 2; var h = 3; var m = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; var g = /[\x85\u2028\u2029]/; var v = /[,\[\]\{\}]/; var w = /^(?:!|!!|![a-z\-]+!)$/i; var y = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; function _class(e) { return Object.prototype.toString.call(e); } function is_EOL(e) { return 10 === e || 13 === e; } function is_WHITE_SPACE(e) { return 9 === e || 32 === e; } function is_WS_OR_EOL(e) { return 9 === e || 32 === e || 10 === e || 13 === e; } function is_FLOW_INDICATOR(e) { return 44 === e || 91 === e || 93 === e || 123 === e || 125 === e; } function fromHexCode(e) { var t; if (48 <= e && e <= 57) return e - 48; t = 32 | e; if (97 <= t && t <= 102) return t - 97 + 10; return -1; } function escapedHexLen(e) { if (120 === e) return 2; if (117 === e) return 4; if (85 === e) return 8; return 0; } function fromDecimalCode(e) { if (48 <= e && e <= 57) return e - 48; return -1; } function simpleEscapeSequence(e) { return 48 === e ? "\0" : 97 === e ? "" : 98 === e ? "\b" : 116 === e ? "\t" : 9 === e ? "\t" : 110 === e ? "\n" : 118 === e ? "\v" : 102 === e ? "\f" : 114 === e ? "\r" : 101 === e ? "" : 32 === e ? " " : 34 === e ? '"' : 47 === e ? "/" : 92 === e ? "\\" : 78 === e ? "…" : 95 === e ? " " : 76 === e ? "\u2028" : 80 === e ? "\u2029" : ""; } function charFromCodepoint(e) { if (e <= 65535) return String.fromCharCode(e); return String.fromCharCode((e - 65536 >> 10) + 55296, (e - 65536 & 1023) + 56320); } function setProperty(e, t, r) { if ("__proto__" === t) Object.defineProperty(e, t, { configurable: true, enumerable: true, writable: true, value: r }); else e[t] = r; } var S = new Array(256); var A = new Array(256); for(var b = 0; b < 256; b++){ S[b] = simpleEscapeSequence(b) ? 1 : 0; A[b] = simpleEscapeSequence(b); } function State(e, t) { this.input = e; this.filename = t["filename"] || null; this.schema = t["schema"] || o; this.onWarning = t["onWarning"] || null; this.legacy = t["legacy"] || false; this.json = t["json"] || false; this.listener = t["listener"] || null; this.implicitTypes = this.schema.compiledImplicit; this.typeMap = this.schema.compiledTypeMap; this.length = e.length; this.position = 0; this.line = 0; this.lineStart = 0; this.lineIndent = 0; this.firstTabInLine = -1; this.documents = []; } function generateError(e, t) { var r = { name: e.filename, buffer: e.input.slice(0, -1), position: e.position, line: e.line, column: e.position - e.lineStart }; r.snippet = a(r); return new n(t, r); } function throwError(e, t) { throw generateError(e, t); } function throwWarning(e, t) { if (e.onWarning) e.onWarning.call(null, generateError(e, t)); } var x = { YAML: function(e, t, r) { var i, n, a; if (null !== e.version) throwError(e, "duplication of %YAML directive"); if (1 !== r.length) throwError(e, "YAML directive accepts exactly one argument"); i = /^([0-9]+)\.([0-9]+)$/.exec(r[0]); if (null === i) throwError(e, "ill-formed argument of the YAML directive"); n = parseInt(i[1], 10); a = parseInt(i[2], 10); if (1 !== n) throwError(e, "unacceptable YAML version of the document"); e.version = r[0]; e.checkLineBreaks = a < 2; if (1 !== a && 2 !== a) throwWarning(e, "unsupported YAML version of the document"); }, TAG: function(e, t, r) { var i, n; if (2 !== r.length) throwError(e, "TAG directive accepts exactly two arguments"); i = r[0]; n = r[1]; if (!w.test(i)) throwError(e, "ill-formed tag handle (first argument) of the TAG directive"); if (l.call(e.tagMap, i)) throwError(e, 'there is a previously declared suffix for "' + i + '" tag handle'); if (!y.test(n)) throwError(e, "ill-formed tag prefix (second argument) of the TAG directive"); try { n = decodeURIComponent(n); } catch (t) { throwError(e, "tag prefix is malformed: " + n); } e.tagMap[i] = n; } }; function captureSegment(e, t, r, i) { var n, a, o, l; if (t < r) { l = e.input.slice(t, r); if (i) for(n = 0, a = l.length; n < a; n += 1){ o = l.charCodeAt(n); if (!(9 === o || 32 <= o && o <= 1114111)) throwError(e, "expected valid JSON character"); } else if (m.test(l)) throwError(e, "the stream contains non-printable characters"); e.result += l; } } function mergeMappings(e, t, r, n) { var a, o, s, c; if (!i.isObject(r)) throwError(e, "cannot merge mappings; the provided source object is unacceptable"); a = Object.keys(r); for(s = 0, c = a.length; s < c; s += 1){ o = a[s]; if (!l.call(t, o)) { setProperty(t, o, r[o]); n[o] = true; } } } function storeMappingPair(e, t, r, i, n, a, o, s, c) { var u, p; if (Array.isArray(n)) { n = Array.prototype.slice.call(n); for(u = 0, p = n.length; u < p; u += 1){ if (Array.isArray(n[u])) throwError(e, "nested arrays are not supported inside keys"); if ("object" == typeof n && "[object Object]" === _class(n[u])) n[u] = "[object Object]"; } } if ("object" == typeof n && "[object Object]" === _class(n)) n = "[object Object]"; n = String(n); if (null === t) t = {}; if ("tag:yaml.org,2002:merge" === i) if (Array.isArray(a)) for(u = 0, p = a.length; u < p; u += 1)mergeMappings(e, t, a[u], r); else mergeMappings(e, t, a, r); else { if (!e.json && !l.call(r, n) && l.call(t, n)) { e.line = o || e.line; e.lineStart = s || e.lineStart; e.position = c || e.position; throwError(e, "duplicated mapping key"); } setProperty(t, n, a); delete r[n]; } return t; } function readLineBreak(e) { var t; t = e.input.charCodeAt(e.position); if (10 === t) e.position++; else if (13 === t) { e.position++; if (10 === e.input.charCodeAt(e.position)) e.position++; } else throwError(e, "a line break is expected"); e.line += 1; e.lineStart = e.position; e.firstTabInLine = -1; } function skipSeparationSpace(e, t, r) { var i = 0, n = e.input.charCodeAt(e.position); while(0 !== n){ while(is_WHITE_SPACE(n)){ if (9 === n && -1 === e.firstTabInLine) e.firstTabInLine = e.position; n = e.input.charCodeAt(++e.position); } if (t && 35 === n) do n = e.input.charCodeAt(++e.position); while (10 !== n && 13 !== n && 0 !== n); if (is_EOL(n)) { readLineBreak(e); n = e.input.charCodeAt(e.position); i++; e.lineIndent = 0; while(32 === n){ e.lineIndent++; n = e.input.charCodeAt(++e.position); } } else break; } if (-1 !== r && 0 !== i && e.lineIndent < r) throwWarning(e, "deficient indentation"); return i; } function testDocumentSeparator(e) { var t = e.position, r; r = e.input.charCodeAt(t); if ((45 === r || 46 === r) && r === e.input.charCodeAt(t + 1) && r === e.input.charCodeAt(t + 2)) { t += 3; r = e.input.charCodeAt(t); if (0 === r || is_WS_OR_EOL(r)) return true; } return false; } function writeFoldedLines(e, t) { if (1 === t) e.result += " "; else if (t > 1) e.result += i.repeat("\n", t - 1); } function readPlainScalar(e, t, r) { var i, n, a, o, l, s, c, u, p = e.kind, f = e.result, d; d = e.input.charCodeAt(e.position); if (is_WS_OR_EOL(d) || is_FLOW_INDICATOR(d) || 35 === d || 38 === d || 42 === d || 33 === d || 124 === d || 62 === d || 39 === d || 34 === d || 37 === d || 64 === d || 96 === d) return false; if (63 === d || 45 === d) { n = e.input.charCodeAt(e.position + 1); if (is_WS_OR_EOL(n) || r && is_FLOW_INDICATOR(n)) return false; } e.kind = "scalar"; e.result = ""; a = o = e.position; l = false; while(0 !== d){ if (58 === d) { n = e.input.charCodeAt(e.position + 1); if (is_WS_OR_EOL(n) || r && is_FLOW_INDICATOR(n)) break; } else if (35 === d) { i = e.input.charCodeAt(e.position - 1); if (is_WS_OR_EOL(i)) break; } else if (e.position === e.lineStart && testDocumentSeparator(e) || r && is_FLOW_INDICATOR(d)) break; else if (is_EOL(d)) { s = e.line; c = e.lineStart; u = e.lineIndent; skipSeparationSpace(e, false, -1); if (e.lineIndent >= t) { l = true; d = e.input.charCodeAt(e.position); continue; } e.position = o; e.line = s; e.lineStart = c; e.lineIndent = u; break; } if (l) { captureSegment(e, a, o, false); writeFoldedLines(e, e.line - s); a = o = e.position; l = false; } if (!is_WHITE_SPACE(d)) o = e.position + 1; d = e.input.charCodeAt(++e.position); } captureSegment(e, a, o, false); if (e.result) return true; e.kind = p; e.result = f; return false; } function readSingleQuotedScalar(e, t) { var r, i, n; r = e.input.charCodeAt(e.position); if (39 !== r) return false; e.kind = "scalar"; e.result = ""; e.position++; i = n = e.position; while(0 !== (r = e.input.charCodeAt(e.position)))if (39 === r) { captureSegment(e, i, e.position, true); r = e.input.charCodeAt(++e.position); if (39 !== r) return true; i = e.position; e.position++; n = e.position; } else if (is_EOL(r)) { captureSegment(e, i, n, true); writeFoldedLines(e, skipSeparationSpace(e, false, t)); i = n = e.position; } else if (e.position === e.lineStart && testDocumentSeparator(e)) throwError(e, "unexpected end of the document within a single quoted scalar"); else { e.position++; n = e.position; } throwError(e, "unexpected end of the stream within a single quoted scalar"); } function readDoubleQuotedScalar(e, t) { var r, i, n, a, o, l; l = e.input.charCodeAt(e.position); if (34 !== l) return false; e.kind = "scalar"; e.result = ""; e.position++; r = i = e.position; while(0 !== (l = e.input.charCodeAt(e.position)))if (34 === l) { captureSegment(e, r, e.position, true); e.position++; return true; } else if (92 === l) { captureSegment(e, r, e.position, true); l = e.input.charCodeAt(++e.position); if (is_EOL(l)) skipSeparationSpace(e, false, t); else if (l < 256 && S[l]) { e.result += A[l]; e.position++; } else if ((o = escapedHexLen(l)) > 0) { n = o; a = 0; for(; n > 0; n--){ l = e.input.charCodeAt(++e.position); if ((o = fromHexCode(l)) >= 0) a = (a << 4) + o; else throwError(e, "expected hexadecimal character"); } e.result += charFromCodepoint(a); e.position++; } else throwError(e, "unknown escape sequence"); r = i = e.position; } else if (is_EOL(l)) { captureSegment(e, r, i, true); writeFoldedLines(e, skipSeparationSpace(e, false, t)); r = i = e.position; } else if (e.position === e.lineStart && testDocumentSeparator(e)) throwError(e, "unexpected end of the document within a double quoted scalar"); else { e.position++; i = e.position; } throwError(e, "unexpected end of the stream within a double quoted scalar"); } function readFlowCollection(e, t) { var r = true, i, n, a, o = e.tag, l, c = e.anchor, u, p, f, d, h, m = Object.create(null), g, v, w, y; y = e.input.charCodeAt(e.position); if (91 === y) { p = 93; h = false; l = []; } else { if (123 !== y) return false; p = 125; h = true; l = {}; } if (null !== e.anchor) e.anchorMap[e.anchor] = l; y = e.input.charCodeAt(++e.position); while(0 !== y){ skipSeparationSpace(e, true, t); y = e.input.charCodeAt(e.position); if (y === p) { e.position++; e.tag = o; e.anchor = c; e.kind = h ? "mapping" : "sequence"; e.result = l; return true; } if (r) { if (44 === y) throwError(e, "expected the node content, but found ','"); } else throwError(e, "missed comma between flow collection entries"); v = g = w = null; f = d = false; if (63 === y) { u = e.input.charCodeAt(e.position + 1); if (is_WS_OR_EOL(u)) { f = d = true; e.position++; skipSeparationSpace(e, true, t); } } i = e.line; n = e.lineStart; a = e.position; composeNode(e, t, s, false, true); v = e.tag; g = e.result; skipSeparationSpace(e, true, t); y = e.input.charCodeAt(e.position); if ((d || e.line === i) && 58 === y) { f = true; y = e.input.charCodeAt(++e.position); skipSeparationSpace(e, true, t); composeNode(e, t, s, false, true); w = e.result; } if (h) storeMappingPair(e, l, m, v, g, w, i, n, a); else if (f) l.push(storeMappingPair(e, null, m, v, g, w, i, n, a)); else l.push(g); skipSeparationSpace(e, true, t); y = e.input.charCodeAt(e.position); if (44 === y) { r = true; y = e.input.charCodeAt(++e.position); } else r = false; } throwError(e, "unexpected end of the stream within a flow collection"); } function readBlockScalar(e, t) { var r, n, a = f, o = false, l = false, s = t, c = 0, u = false, p, m; m = e.input.charCodeAt(e.position); if (124 === m) n = false; else { if (62 !== m) return false; n = true; } e.kind = "scalar"; e.result = ""; while(0 !== m){ m = e.input.charCodeAt(++e.position); if (43 === m || 45 === m) if (f === a) a = 43 === m ? h : d; else throwError(e, "repeat of a chomping mode identifier"); else if ((p = fromDecimalCode(m)) >= 0) if (0 === p) throwError(e, "bad explicit indentation width of a block scalar; it cannot be less than one"); else if (l) throwError(e, "repeat of an indentation width identifier"); else { s = t + p - 1; l = true; } else break; } if (is_WHITE_SPACE(m)) { do m = e.input.charCodeAt(++e.position); while (is_WHITE_SPACE(m)); if (35 === m) do m = e.input.charCodeAt(++e.position); while (!is_EOL(m) && 0 !== m); } while(0 !== m){ readLineBreak(e); e.lineIndent = 0; m = e.input.charCodeAt(e.position); while((!l || e.lineIndent < s) && 32 === m){ e.lineIndent++; m = e.input.charCodeAt(++e.position); } if (!l && e.lineIndent > s) s = e.lineIndent; if (is_EOL(m)) { c++; continue; } if (e.lineIndent < s) { if (a === h) e.result += i.repeat("\n", o ? 1 + c : c); else if (a === f) { if (o) e.result += "\n"; } break; } if (n) if (is_WHITE_SPACE(m)) { u = true; e.result += i.repeat("\n", o ? 1 + c : c); } else if (u) { u = false; e.result += i.repeat("\n", c + 1); } else if (0 === c) { if (o) e.result += " "; } else e.result += i.repeat("\n", c); else e.result += i.repeat("\n", o ? 1 + c : c); o = true; l = true; c = 0; r = e.position; while(!is_EOL(m) && 0 !== m)m = e.input.charCodeAt(++e.position); captureSegment(e, r, e.position, false); } return true; } function readBlockSequence(e, t) { var r, i = e.tag, n = e.anchor, a = [], o, l = false, s; if (-1 !== e.firstTabInLine) return false; if (null !== e.anchor) e.anchorMap[e.anchor] = a; s = e.input.charCodeAt(e.position); while(0 !== s){ if (-1 !== e.firstTabInLine) { e.position = e.firstTabInLine; throwError(e, "tab characters must not be used in indentation"); } if (45 !== s) break; o = e.input.charCodeAt(e.position + 1); if (!is_WS_OR_EOL(o)) break; l = true; e.position++; if (skipSeparationSpace(e, true, -1)) { if (e.lineIndent <= t) { a.push(null); s = e.input.charCodeAt(e.position); continue; } } r = e.line; composeNode(e, t, u, false, true); a.push(e.result); skipSeparationSpace(e, true, -1); s = e.input.charCodeAt(e.position); if ((e.line === r || e.lineIndent > t) && 0 !== s) throwError(e, "bad indentation of a sequence entry"); else if (e.lineIndent < t) break; } if (l) { e.tag = i; e.anchor = n; e.kind = "sequence"; e.result = a; return true; } return false; } function readBlockMapping(e, t, r) { var i, n, a, o, l, s, u = e.tag, f = e.anchor, d = {}, h = Object.create(null), m = null, g = null, v = null, w = false, y = false, S; if (-1 !== e.firstTabInLine) return false; if (null !== e.anchor) e.anchorMap[e.anchor] = d; S = e.input.c