3 var require$$0$3 = require('os');
4 var require$$0$1 = require('path');
5 var require$$1$1 = require('module');
6 var require$$1 = require('fs');
7 var require$$0$2 = require('util');
9 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11 var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
12 var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
13 var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
14 var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
15 var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
21 var ExplorerBase$1 = {};
25 var resolveFrom$2 = {exports: {}};
27 const path$1 = require$$0__default["default"];
28 const Module = require$$1__default$1["default"];
29 const fs$1 = require$$1__default["default"];
31 const resolveFrom$1 = (fromDir, moduleId, silent) => {
32 if (typeof fromDir !== 'string') {
33 throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``);
36 if (typeof moduleId !== 'string') {
37 throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
41 fromDir = fs$1.realpathSync(fromDir);
43 if (err.code === 'ENOENT') {
44 fromDir = path$1.resolve(fromDir);
52 const fromFile = path$1.join(fromDir, 'noop.js');
54 const resolveFileName = () => Module._resolveFilename(moduleId, {
57 paths: Module._nodeModulePaths(fromDir)
62 return resolveFileName();
68 return resolveFileName();
71 resolveFrom$2.exports = (fromDir, moduleId) => resolveFrom$1(fromDir, moduleId);
73 resolveFrom$2.exports.silent = (fromDir, moduleId) => resolveFrom$1(fromDir, moduleId, true);
75 var callsites$1 = {exports: {}};
77 const callsites = () => {
78 const _prepareStackTrace = Error.prepareStackTrace;
80 Error.prepareStackTrace = (_, stack) => stack;
82 const stack = new Error().stack.slice(1);
83 Error.prepareStackTrace = _prepareStackTrace;
87 callsites$1.exports = callsites; // TODO: Remove this for the next major release
89 callsites$1.exports.default = callsites;
91 const path = require$$0__default["default"];
92 const resolveFrom = resolveFrom$2.exports;
94 var importFresh$1 = moduleId => {
95 if (typeof moduleId !== 'string') {
96 throw new TypeError('Expected a string');
99 const parentPath = __filename;
100 const cwd = parentPath ? path.dirname(parentPath) : __dirname;
101 const filePath = resolveFrom(cwd, moduleId);
102 const oldModule = require.cache[filePath]; // Delete itself from module parent
104 if (oldModule && oldModule.parent) {
105 let i = oldModule.parent.children.length;
108 if (oldModule.parent.children[i].id === filePath) {
109 oldModule.parent.children.splice(i, 1);
114 delete require.cache[filePath]; // Delete module from cache
116 const parent = require.cache[parentPath]; // If `filePath` and `parentPath` are the same, cache will already be deleted so we won't get a memory leak in next step
118 return parent === undefined ? require(filePath) : parent.require(filePath); // In case cache doesn't have parent, fall back to normal require
121 var isArrayish$1 = function isArrayish(obj) {
126 return obj instanceof Array || Array.isArray(obj) || obj.length >= 0 && obj.splice instanceof Function;
129 var util = require$$0__default$1["default"];
130 var isArrayish = isArrayish$1;
132 var errorEx$1 = function errorEx(name, properties) {
133 if (!name || name.constructor !== String) {
134 properties = name || {};
138 var errorExError = function ErrorEXError(message) {
140 return new ErrorEXError(message);
143 message = message instanceof Error ? message.message : message || this.message;
144 Error.call(this, message);
145 Error.captureStackTrace(this, errorExError);
147 Object.defineProperty(this, 'message', {
151 var newMessage = message.split(/\r?\n/g);
153 for (var key in properties) {
154 if (!properties.hasOwnProperty(key)) {
158 var modifier = properties[key];
160 if ('message' in modifier) {
161 newMessage = modifier.message(this[key], newMessage) || newMessage;
163 if (!isArrayish(newMessage)) {
164 newMessage = [newMessage];
169 return newMessage.join('\n');
175 var overwrittenStack = null;
176 var stackDescriptor = Object.getOwnPropertyDescriptor(this, 'stack');
177 var stackGetter = stackDescriptor.get;
178 var stackValue = stackDescriptor.value;
179 delete stackDescriptor.value;
180 delete stackDescriptor.writable;
182 stackDescriptor.set = function (newstack) {
183 overwrittenStack = newstack;
186 stackDescriptor.get = function () {
187 var stack = (overwrittenStack || (stackGetter ? stackGetter.call(this) : stackValue)).split(/\r?\n+/g); // starting in Node 7, the stack builder caches the message.
190 if (!overwrittenStack) {
191 stack[0] = this.name + ': ' + this.message;
196 for (var key in properties) {
197 if (!properties.hasOwnProperty(key)) {
201 var modifier = properties[key];
203 if ('line' in modifier) {
204 var line = modifier.line(this[key]);
207 stack.splice(lineCount++, 0, ' ' + line);
211 if ('stack' in modifier) {
212 modifier.stack(this[key], stack);
216 return stack.join('\n');
219 Object.defineProperty(this, 'stack', stackDescriptor);
222 if (Object.setPrototypeOf) {
223 Object.setPrototypeOf(errorExError.prototype, Error.prototype);
224 Object.setPrototypeOf(errorExError, Error);
226 util.inherits(errorExError, Error);
232 errorEx$1.append = function (str, def) {
234 message: function (v, message) {
238 message[0] += ' ' + str.replace('%s', v.toString());
246 errorEx$1.line = function (str, def) {
252 return str.replace('%s', v.toString());
260 var errorEx_1 = errorEx$1;
262 const hexify = char => {
263 const h = char.charCodeAt(0).toString(16).toUpperCase();
264 return '0x' + (h.length % 2 ? '0' : '') + h;
267 const parseError = (e, txt, context) => {
270 message: e.message + ' while parsing empty string',
275 const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);
276 const errIdx = badToken ? +badToken[2] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
277 const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
279 if (errIdx !== null && errIdx !== undefined) {
280 const start = errIdx <= context ? 0 : errIdx - context;
281 const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
282 const slice = (start === 0 ? '' : '...') + txt.slice(start, end) + (end === txt.length ? '' : '...');
283 const near = txt === slice ? '' : 'near ';
285 message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
290 message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
296 class JSONParseError extends SyntaxError {
297 constructor(er, txt, context, caller) {
298 context = context || 20;
299 const metadata = parseError(er, txt, context);
300 super(metadata.message);
301 Object.assign(this, metadata);
302 this.code = 'EJSONPARSE';
303 this.systemError = er;
304 Error.captureStackTrace(this, caller || this.constructor);
308 return this.constructor.name;
313 get [Symbol.toStringTag]() {
314 return this.constructor.name;
319 const kIndent = Symbol.for('indent');
320 const kNewline = Symbol.for('newline'); // only respect indentation if we got a line break, otherwise squash it
321 // things other than objects and arrays aren't indented, so ignore those
322 // Important: in both of these regexps, the $1 capture group is the newline
323 // or undefined, and the $2 capture group is the indent, or undefined.
325 const formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
326 const emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
328 const parseJson$2 = (txt, reviver, context) => {
329 const parseText = stripBOM(txt);
330 context = context || 20;
333 // get the indentation so that we can save it back nicely
334 // if the file starts with {" then we have an indent of '', ie, none
335 // otherwise, pick the indentation of the next line after the first \n
336 // If the pattern doesn't match, then it means no indentation.
337 // JSON.stringify ignores symbols, so this is reasonably safe.
338 // if the string is '{}' or '[]', then use the default 2-space indent.
339 const [, newline = '\n', indent = ' '] = parseText.match(emptyRE) || parseText.match(formatRE) || [, '', ''];
340 const result = JSON.parse(parseText, reviver);
342 if (result && typeof result === 'object') {
343 result[kNewline] = newline;
344 result[kIndent] = indent;
349 if (typeof txt !== 'string' && !Buffer.isBuffer(txt)) {
350 const isEmptyArray = Array.isArray(txt) && txt.length === 0;
351 throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? 'an empty array' : String(txt)}`), {
357 throw new JSONParseError(e, parseText, context, parseJson$2);
359 }; // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
360 // because the buffer-to-string conversion in `fs.readFileSync()`
361 // translates it to FEFF, the UTF-16 BOM.
364 const stripBOM = txt => String(txt).replace(/^\uFEFF/, '');
366 var jsonParseEvenBetterErrors = parseJson$2;
367 parseJson$2.JSONParseError = JSONParseError;
369 parseJson$2.noExceptions = (txt, reviver) => {
371 return JSON.parse(stripBOM(txt), reviver);
377 (function (exports) {
382 var LinesAndColumns = function () {
383 function LinesAndColumns(string) {
384 this.string = string;
387 for (var offset = 0; offset < string.length;) {
388 switch (string[offset]) {
391 offsets.push(offset);
397 if (string[offset] === LF) {
401 offsets.push(offset);
410 this.offsets = offsets;
413 LinesAndColumns.prototype.locationForIndex = function (index) {
414 if (index < 0 || index > this.string.length) {
419 var offsets = this.offsets;
421 while (offsets[line + 1] <= index) {
425 var column = index - offsets[line];
432 LinesAndColumns.prototype.indexForLocation = function (location) {
433 var line = location.line,
434 column = location.column;
436 if (line < 0 || line >= this.offsets.length) {
440 if (column < 0 || column > this.lengthOfLine(line)) {
444 return this.offsets[line] + column;
447 LinesAndColumns.prototype.lengthOfLine = function (line) {
448 var offset = this.offsets[line];
449 var nextOffset = line === this.offsets.length - 1 ? this.string.length : this.offsets[line + 1];
450 return nextOffset - offset;
453 return LinesAndColumns;
456 exports.__esModule = true;
457 exports["default"] = LinesAndColumns;
466 // License: MIT. (See LICENSE.)
468 Object.defineProperty(jsTokens, "__esModule", {
470 }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
471 // (run `npm run build`).
473 jsTokens.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
475 jsTokens.matchToToken = function (match) {
481 if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
489 Object.defineProperty(identifier, "__esModule", {
492 identifier.isIdentifierStart = isIdentifierStart;
493 identifier.isIdentifierChar = isIdentifierChar;
494 identifier.isIdentifierName = isIdentifierName;
495 let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
496 let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
497 const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
498 const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
499 nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
500 const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
501 const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
503 function isInAstralSet(code, set) {
506 for (let i = 0, length = set.length; i < length; i += 2) {
508 if (pos > code) return false;
510 if (pos >= code) return true;
516 function isIdentifierStart(code) {
517 if (code < 65) return code === 36;
518 if (code <= 90) return true;
519 if (code < 97) return code === 95;
520 if (code <= 122) return true;
522 if (code <= 0xffff) {
523 return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
526 return isInAstralSet(code, astralIdentifierStartCodes);
529 function isIdentifierChar(code) {
530 if (code < 48) return code === 36;
531 if (code < 58) return true;
532 if (code < 65) return false;
533 if (code <= 90) return true;
534 if (code < 97) return code === 95;
535 if (code <= 122) return true;
537 if (code <= 0xffff) {
538 return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
541 return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
544 function isIdentifierName(name) {
547 for (let i = 0; i < name.length; i++) {
548 let cp = name.charCodeAt(i);
550 if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
551 const trail = name.charCodeAt(++i);
553 if ((trail & 0xfc00) === 0xdc00) {
554 cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
561 if (!isIdentifierStart(cp)) {
564 } else if (!isIdentifierChar(cp)) {
574 Object.defineProperty(keyword, "__esModule", {
577 keyword.isReservedWord = isReservedWord;
578 keyword.isStrictReservedWord = isStrictReservedWord;
579 keyword.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
580 keyword.isStrictBindReservedWord = isStrictBindReservedWord;
581 keyword.isKeyword = isKeyword;
582 const reservedWords = {
583 keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
584 strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
585 strictBind: ["eval", "arguments"]
587 const keywords = new Set(reservedWords.keyword);
588 const reservedWordsStrictSet = new Set(reservedWords.strict);
589 const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
591 function isReservedWord(word, inModule) {
592 return inModule && word === "await" || word === "enum";
595 function isStrictReservedWord(word, inModule) {
596 return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
599 function isStrictBindOnlyReservedWord(word) {
600 return reservedWordsStrictBindSet.has(word);
603 function isStrictBindReservedWord(word, inModule) {
604 return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
607 function isKeyword(word) {
608 return keywords.has(word);
611 (function (exports) {
613 Object.defineProperty(exports, "__esModule", {
616 Object.defineProperty(exports, "isIdentifierName", {
619 return _identifier.isIdentifierName;
622 Object.defineProperty(exports, "isIdentifierChar", {
625 return _identifier.isIdentifierChar;
628 Object.defineProperty(exports, "isIdentifierStart", {
631 return _identifier.isIdentifierStart;
634 Object.defineProperty(exports, "isReservedWord", {
637 return _keyword.isReservedWord;
640 Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
643 return _keyword.isStrictBindOnlyReservedWord;
646 Object.defineProperty(exports, "isStrictBindReservedWord", {
649 return _keyword.isStrictBindReservedWord;
652 Object.defineProperty(exports, "isStrictReservedWord", {
655 return _keyword.isStrictReservedWord;
658 Object.defineProperty(exports, "isKeyword", {
661 return _keyword.isKeyword;
664 var _identifier = identifier;
665 var _keyword = keyword;
668 var chalk = {exports: {}};
670 var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
672 var escapeStringRegexp = function (str) {
673 if (typeof str !== 'string') {
674 throw new TypeError('Expected a string');
677 return str.replace(matchOperatorsRe, '\\$&');
680 var ansiStyles = {exports: {}};
682 var conversions$2 = {exports: {}};
685 "aliceblue": [240, 248, 255],
686 "antiquewhite": [250, 235, 215],
687 "aqua": [0, 255, 255],
688 "aquamarine": [127, 255, 212],
689 "azure": [240, 255, 255],
690 "beige": [245, 245, 220],
691 "bisque": [255, 228, 196],
693 "blanchedalmond": [255, 235, 205],
695 "blueviolet": [138, 43, 226],
696 "brown": [165, 42, 42],
697 "burlywood": [222, 184, 135],
698 "cadetblue": [95, 158, 160],
699 "chartreuse": [127, 255, 0],
700 "chocolate": [210, 105, 30],
701 "coral": [255, 127, 80],
702 "cornflowerblue": [100, 149, 237],
703 "cornsilk": [255, 248, 220],
704 "crimson": [220, 20, 60],
705 "cyan": [0, 255, 255],
706 "darkblue": [0, 0, 139],
707 "darkcyan": [0, 139, 139],
708 "darkgoldenrod": [184, 134, 11],
709 "darkgray": [169, 169, 169],
710 "darkgreen": [0, 100, 0],
711 "darkgrey": [169, 169, 169],
712 "darkkhaki": [189, 183, 107],
713 "darkmagenta": [139, 0, 139],
714 "darkolivegreen": [85, 107, 47],
715 "darkorange": [255, 140, 0],
716 "darkorchid": [153, 50, 204],
717 "darkred": [139, 0, 0],
718 "darksalmon": [233, 150, 122],
719 "darkseagreen": [143, 188, 143],
720 "darkslateblue": [72, 61, 139],
721 "darkslategray": [47, 79, 79],
722 "darkslategrey": [47, 79, 79],
723 "darkturquoise": [0, 206, 209],
724 "darkviolet": [148, 0, 211],
725 "deeppink": [255, 20, 147],
726 "deepskyblue": [0, 191, 255],
727 "dimgray": [105, 105, 105],
728 "dimgrey": [105, 105, 105],
729 "dodgerblue": [30, 144, 255],
730 "firebrick": [178, 34, 34],
731 "floralwhite": [255, 250, 240],
732 "forestgreen": [34, 139, 34],
733 "fuchsia": [255, 0, 255],
734 "gainsboro": [220, 220, 220],
735 "ghostwhite": [248, 248, 255],
736 "gold": [255, 215, 0],
737 "goldenrod": [218, 165, 32],
738 "gray": [128, 128, 128],
739 "green": [0, 128, 0],
740 "greenyellow": [173, 255, 47],
741 "grey": [128, 128, 128],
742 "honeydew": [240, 255, 240],
743 "hotpink": [255, 105, 180],
744 "indianred": [205, 92, 92],
745 "indigo": [75, 0, 130],
746 "ivory": [255, 255, 240],
747 "khaki": [240, 230, 140],
748 "lavender": [230, 230, 250],
749 "lavenderblush": [255, 240, 245],
750 "lawngreen": [124, 252, 0],
751 "lemonchiffon": [255, 250, 205],
752 "lightblue": [173, 216, 230],
753 "lightcoral": [240, 128, 128],
754 "lightcyan": [224, 255, 255],
755 "lightgoldenrodyellow": [250, 250, 210],
756 "lightgray": [211, 211, 211],
757 "lightgreen": [144, 238, 144],
758 "lightgrey": [211, 211, 211],
759 "lightpink": [255, 182, 193],
760 "lightsalmon": [255, 160, 122],
761 "lightseagreen": [32, 178, 170],
762 "lightskyblue": [135, 206, 250],
763 "lightslategray": [119, 136, 153],
764 "lightslategrey": [119, 136, 153],
765 "lightsteelblue": [176, 196, 222],
766 "lightyellow": [255, 255, 224],
768 "limegreen": [50, 205, 50],
769 "linen": [250, 240, 230],
770 "magenta": [255, 0, 255],
771 "maroon": [128, 0, 0],
772 "mediumaquamarine": [102, 205, 170],
773 "mediumblue": [0, 0, 205],
774 "mediumorchid": [186, 85, 211],
775 "mediumpurple": [147, 112, 219],
776 "mediumseagreen": [60, 179, 113],
777 "mediumslateblue": [123, 104, 238],
778 "mediumspringgreen": [0, 250, 154],
779 "mediumturquoise": [72, 209, 204],
780 "mediumvioletred": [199, 21, 133],
781 "midnightblue": [25, 25, 112],
782 "mintcream": [245, 255, 250],
783 "mistyrose": [255, 228, 225],
784 "moccasin": [255, 228, 181],
785 "navajowhite": [255, 222, 173],
787 "oldlace": [253, 245, 230],
788 "olive": [128, 128, 0],
789 "olivedrab": [107, 142, 35],
790 "orange": [255, 165, 0],
791 "orangered": [255, 69, 0],
792 "orchid": [218, 112, 214],
793 "palegoldenrod": [238, 232, 170],
794 "palegreen": [152, 251, 152],
795 "paleturquoise": [175, 238, 238],
796 "palevioletred": [219, 112, 147],
797 "papayawhip": [255, 239, 213],
798 "peachpuff": [255, 218, 185],
799 "peru": [205, 133, 63],
800 "pink": [255, 192, 203],
801 "plum": [221, 160, 221],
802 "powderblue": [176, 224, 230],
803 "purple": [128, 0, 128],
804 "rebeccapurple": [102, 51, 153],
806 "rosybrown": [188, 143, 143],
807 "royalblue": [65, 105, 225],
808 "saddlebrown": [139, 69, 19],
809 "salmon": [250, 128, 114],
810 "sandybrown": [244, 164, 96],
811 "seagreen": [46, 139, 87],
812 "seashell": [255, 245, 238],
813 "sienna": [160, 82, 45],
814 "silver": [192, 192, 192],
815 "skyblue": [135, 206, 235],
816 "slateblue": [106, 90, 205],
817 "slategray": [112, 128, 144],
818 "slategrey": [112, 128, 144],
819 "snow": [255, 250, 250],
820 "springgreen": [0, 255, 127],
821 "steelblue": [70, 130, 180],
822 "tan": [210, 180, 140],
823 "teal": [0, 128, 128],
824 "thistle": [216, 191, 216],
825 "tomato": [255, 99, 71],
826 "turquoise": [64, 224, 208],
827 "violet": [238, 130, 238],
828 "wheat": [245, 222, 179],
829 "white": [255, 255, 255],
830 "whitesmoke": [245, 245, 245],
831 "yellow": [255, 255, 0],
832 "yellowgreen": [154, 205, 50]
836 var cssKeywords = colorName; // NOTE: conversions should only return primitive values (i.e. arrays, or
837 // values that give correct `typeof` results).
838 // do not use box values types (i.e. Number(), String(), etc.)
840 var reverseKeywords = {};
842 for (var key in cssKeywords) {
843 if (cssKeywords.hasOwnProperty(key)) {
844 reverseKeywords[cssKeywords[key]] = key;
848 var convert$1 = conversions$2.exports = {
899 labels: ['h', 'c', 'g']
903 labels: ['r16', 'g16', 'b16']
909 }; // hide .channels and .labels properties
911 for (var model in convert$1) {
912 if (convert$1.hasOwnProperty(model)) {
913 if (!('channels' in convert$1[model])) {
914 throw new Error('missing channels property: ' + model);
917 if (!('labels' in convert$1[model])) {
918 throw new Error('missing channel labels property: ' + model);
921 if (convert$1[model].labels.length !== convert$1[model].channels) {
922 throw new Error('channel and label counts mismatch: ' + model);
925 var channels = convert$1[model].channels;
926 var labels = convert$1[model].labels;
927 delete convert$1[model].channels;
928 delete convert$1[model].labels;
929 Object.defineProperty(convert$1[model], 'channels', {
932 Object.defineProperty(convert$1[model], 'labels', {
938 convert$1.rgb.hsl = function (rgb) {
939 var r = rgb[0] / 255;
940 var g = rgb[1] / 255;
941 var b = rgb[2] / 255;
942 var min = Math.min(r, g, b);
943 var max = Math.max(r, g, b);
944 var delta = max - min;
951 } else if (r === max) {
953 } else if (g === max) {
954 h = 2 + (b - r) / delta;
955 } else if (b === max) {
956 h = 4 + (r - g) / delta;
959 h = Math.min(h * 60, 360);
969 } else if (l <= 0.5) {
970 s = delta / (max + min);
972 s = delta / (2 - max - min);
975 return [h, s * 100, l * 100];
978 convert$1.rgb.hsv = function (rgb) {
984 var r = rgb[0] / 255;
985 var g = rgb[1] / 255;
986 var b = rgb[2] / 255;
987 var v = Math.max(r, g, b);
988 var diff = v - Math.min(r, g, b);
990 var diffc = function (c) {
991 return (v - c) / 6 / diff + 1 / 2;
1004 } else if (g === v) {
1005 h = 1 / 3 + rdif - bdif;
1006 } else if (b === v) {
1007 h = 2 / 3 + gdif - rdif;
1017 return [h * 360, s * 100, v * 100];
1020 convert$1.rgb.hwb = function (rgb) {
1024 var h = convert$1.rgb.hsl(rgb)[0];
1025 var w = 1 / 255 * Math.min(r, Math.min(g, b));
1026 b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
1027 return [h, w * 100, b * 100];
1030 convert$1.rgb.cmyk = function (rgb) {
1031 var r = rgb[0] / 255;
1032 var g = rgb[1] / 255;
1033 var b = rgb[2] / 255;
1038 k = Math.min(1 - r, 1 - g, 1 - b);
1039 c = (1 - r - k) / (1 - k) || 0;
1040 m = (1 - g - k) / (1 - k) || 0;
1041 y = (1 - b - k) / (1 - k) || 0;
1042 return [c * 100, m * 100, y * 100, k * 100];
1045 * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
1049 function comparativeDistance(x, y) {
1050 return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
1053 convert$1.rgb.keyword = function (rgb) {
1054 var reversed = reverseKeywords[rgb];
1060 var currentClosestDistance = Infinity;
1061 var currentClosestKeyword;
1063 for (var keyword in cssKeywords) {
1064 if (cssKeywords.hasOwnProperty(keyword)) {
1065 var value = cssKeywords[keyword]; // Compute comparative distance
1067 var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
1069 if (distance < currentClosestDistance) {
1070 currentClosestDistance = distance;
1071 currentClosestKeyword = keyword;
1076 return currentClosestKeyword;
1079 convert$1.keyword.rgb = function (keyword) {
1080 return cssKeywords[keyword];
1083 convert$1.rgb.xyz = function (rgb) {
1084 var r = rgb[0] / 255;
1085 var g = rgb[1] / 255;
1086 var b = rgb[2] / 255; // assume sRGB
1088 r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
1089 g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
1090 b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
1091 var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
1092 var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
1093 var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
1094 return [x * 100, y * 100, z * 100];
1097 convert$1.rgb.lab = function (rgb) {
1098 var xyz = convert$1.rgb.xyz(rgb);
1108 x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
1109 y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
1110 z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
1117 convert$1.hsl.rgb = function (hsl) {
1118 var h = hsl[0] / 360;
1119 var s = hsl[1] / 100;
1120 var l = hsl[2] / 100;
1129 return [val, val, val];
1141 for (var i = 0; i < 3; i++) {
1142 t3 = h + 1 / 3 * -(i - 1);
1153 val = t1 + (t2 - t1) * 6 * t3;
1154 } else if (2 * t3 < 1) {
1156 } else if (3 * t3 < 2) {
1157 val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
1168 convert$1.hsl.hsv = function (hsl) {
1170 var s = hsl[1] / 100;
1171 var l = hsl[2] / 100;
1173 var lmin = Math.max(l, 0.01);
1177 s *= l <= 1 ? l : 2 - l;
1178 smin *= lmin <= 1 ? lmin : 2 - lmin;
1180 sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
1181 return [h, sv * 100, v * 100];
1184 convert$1.hsv.rgb = function (hsv) {
1185 var h = hsv[0] / 60;
1186 var s = hsv[1] / 100;
1187 var v = hsv[2] / 100;
1188 var hi = Math.floor(h) % 6;
1189 var f = h - Math.floor(h);
1190 var p = 255 * v * (1 - s);
1191 var q = 255 * v * (1 - s * f);
1192 var t = 255 * v * (1 - s * (1 - f));
1216 convert$1.hsv.hsl = function (hsv) {
1218 var s = hsv[1] / 100;
1219 var v = hsv[2] / 100;
1220 var vmin = Math.max(v, 0.01);
1225 lmin = (2 - s) * vmin;
1227 sl /= lmin <= 1 ? lmin : 2 - lmin;
1230 return [h, sl * 100, l * 100];
1231 }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
1234 convert$1.hwb.rgb = function (hwb) {
1235 var h = hwb[0] / 360;
1236 var wh = hwb[1] / 100;
1237 var bl = hwb[2] / 100;
1238 var ratio = wh + bl;
1242 var n; // wh + bl cant be > 1
1249 i = Math.floor(6 * h);
1253 if ((i & 0x01) !== 0) {
1257 n = wh + f * (v - wh); // linear interpolation
1303 return [r * 255, g * 255, b * 255];
1306 convert$1.cmyk.rgb = function (cmyk) {
1307 var c = cmyk[0] / 100;
1308 var m = cmyk[1] / 100;
1309 var y = cmyk[2] / 100;
1310 var k = cmyk[3] / 100;
1314 r = 1 - Math.min(1, c * (1 - k) + k);
1315 g = 1 - Math.min(1, m * (1 - k) + k);
1316 b = 1 - Math.min(1, y * (1 - k) + k);
1317 return [r * 255, g * 255, b * 255];
1320 convert$1.xyz.rgb = function (xyz) {
1321 var x = xyz[0] / 100;
1322 var y = xyz[1] / 100;
1323 var z = xyz[2] / 100;
1327 r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1328 g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1329 b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
1331 r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
1332 g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
1333 b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
1334 r = Math.min(Math.max(0, r), 1);
1335 g = Math.min(Math.max(0, g), 1);
1336 b = Math.min(Math.max(0, b), 1);
1337 return [r * 255, g * 255, b * 255];
1340 convert$1.xyz.lab = function (xyz) {
1350 x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
1351 y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
1352 z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
1359 convert$1.lab.xyz = function (lab) {
1369 var y2 = Math.pow(y, 3);
1370 var x2 = Math.pow(x, 3);
1371 var z2 = Math.pow(z, 3);
1372 y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
1373 x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
1374 z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
1381 convert$1.lab.lch = function (lab) {
1388 hr = Math.atan2(b, a);
1389 h = hr * 360 / 2 / Math.PI;
1395 c = Math.sqrt(a * a + b * b);
1399 convert$1.lch.lab = function (lch) {
1406 hr = h / 360 * 2 * Math.PI;
1407 a = c * Math.cos(hr);
1408 b = c * Math.sin(hr);
1412 convert$1.rgb.ansi16 = function (args) {
1416 var value = 1 in arguments ? arguments[1] : convert$1.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
1418 value = Math.round(value / 50);
1424 var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1433 convert$1.hsv.ansi16 = function (args) {
1434 // optimization here; we already know the value and don't need to get
1435 // it converted for us.
1436 return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
1439 convert$1.rgb.ansi256 = function (args) {
1442 var b = args[2]; // we use the extended greyscale palette here, with the exception of
1443 // black and white. normal palette only has 4 greyscale shades.
1445 if (r === g && g === b) {
1454 return Math.round((r - 8) / 247 * 24) + 232;
1457 var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
1461 convert$1.ansi16.rgb = function (args) {
1462 var color = args % 10; // handle greyscale
1464 if (color === 0 || color === 7) {
1469 color = color / 10.5 * 255;
1470 return [color, color, color];
1473 var mult = (~~(args > 50) + 1) * 0.5;
1474 var r = (color & 1) * mult * 255;
1475 var g = (color >> 1 & 1) * mult * 255;
1476 var b = (color >> 2 & 1) * mult * 255;
1480 convert$1.ansi256.rgb = function (args) {
1483 var c = (args - 232) * 10 + 8;
1489 var r = Math.floor(args / 36) / 5 * 255;
1490 var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
1491 var b = rem % 6 / 5 * 255;
1495 convert$1.rgb.hex = function (args) {
1496 var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
1497 var string = integer.toString(16).toUpperCase();
1498 return '000000'.substring(string.length) + string;
1501 convert$1.hex.rgb = function (args) {
1502 var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
1508 var colorString = match[0];
1510 if (match[0].length === 3) {
1511 colorString = colorString.split('').map(function (char) {
1516 var integer = parseInt(colorString, 16);
1517 var r = integer >> 16 & 0xFF;
1518 var g = integer >> 8 & 0xFF;
1519 var b = integer & 0xFF;
1523 convert$1.rgb.hcg = function (rgb) {
1524 var r = rgb[0] / 255;
1525 var g = rgb[1] / 255;
1526 var b = rgb[2] / 255;
1527 var max = Math.max(Math.max(r, g), b);
1528 var min = Math.min(Math.min(r, g), b);
1529 var chroma = max - min;
1534 grayscale = min / (1 - chroma);
1541 } else if (max === r) {
1542 hue = (g - b) / chroma % 6;
1543 } else if (max === g) {
1544 hue = 2 + (b - r) / chroma;
1546 hue = 4 + (r - g) / chroma + 4;
1551 return [hue * 360, chroma * 100, grayscale * 100];
1554 convert$1.hsl.hcg = function (hsl) {
1555 var s = hsl[1] / 100;
1556 var l = hsl[2] / 100;
1563 c = 2.0 * s * (1.0 - l);
1567 f = (l - 0.5 * c) / (1.0 - c);
1570 return [hsl[0], c * 100, f * 100];
1573 convert$1.hsv.hcg = function (hsv) {
1574 var s = hsv[1] / 100;
1575 var v = hsv[2] / 100;
1580 f = (v - c) / (1 - c);
1583 return [hsv[0], c * 100, f * 100];
1586 convert$1.hcg.rgb = function (hcg) {
1587 var h = hcg[0] / 360;
1588 var c = hcg[1] / 100;
1589 var g = hcg[2] / 100;
1592 return [g * 255, g * 255, g * 255];
1595 var pure = [0, 0, 0];
1601 switch (Math.floor(hi)) {
1639 return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
1642 convert$1.hcg.hsv = function (hcg) {
1643 var c = hcg[1] / 100;
1644 var g = hcg[2] / 100;
1645 var v = c + g * (1.0 - c);
1652 return [hcg[0], f * 100, v * 100];
1655 convert$1.hcg.hsl = function (hcg) {
1656 var c = hcg[1] / 100;
1657 var g = hcg[2] / 100;
1658 var l = g * (1.0 - c) + 0.5 * c;
1661 if (l > 0.0 && l < 0.5) {
1663 } else if (l >= 0.5 && l < 1.0) {
1664 s = c / (2 * (1 - l));
1667 return [hcg[0], s * 100, l * 100];
1670 convert$1.hcg.hwb = function (hcg) {
1671 var c = hcg[1] / 100;
1672 var g = hcg[2] / 100;
1673 var v = c + g * (1.0 - c);
1674 return [hcg[0], (v - c) * 100, (1 - v) * 100];
1677 convert$1.hwb.hcg = function (hwb) {
1678 var w = hwb[1] / 100;
1679 var b = hwb[2] / 100;
1685 g = (v - c) / (1 - c);
1688 return [hwb[0], c * 100, g * 100];
1691 convert$1.apple.rgb = function (apple) {
1692 return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
1695 convert$1.rgb.apple = function (rgb) {
1696 return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
1699 convert$1.gray.rgb = function (args) {
1700 return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
1703 convert$1.gray.hsl = convert$1.gray.hsv = function (args) {
1704 return [0, 0, args[0]];
1707 convert$1.gray.hwb = function (gray) {
1708 return [0, 100, gray[0]];
1711 convert$1.gray.cmyk = function (gray) {
1712 return [0, 0, 0, gray[0]];
1715 convert$1.gray.lab = function (gray) {
1716 return [gray[0], 0, 0];
1719 convert$1.gray.hex = function (gray) {
1720 var val = Math.round(gray[0] / 100 * 255) & 0xFF;
1721 var integer = (val << 16) + (val << 8) + val;
1722 var string = integer.toString(16).toUpperCase();
1723 return '000000'.substring(string.length) + string;
1726 convert$1.rgb.gray = function (rgb) {
1727 var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
1728 return [val / 255 * 100];
1731 var conversions$1 = conversions$2.exports;
1733 this function routes a model to all other models.
1735 all functions that are routed have a property `.conversion` attached
1736 to the returned synthetic function. This property is an array
1737 of strings, each with the steps in between the 'from' and 'to'
1738 color models (inclusive).
1740 conversions that are not possible simply are not included.
1743 function buildGraph() {
1744 var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
1746 var models = Object.keys(conversions$1);
1748 for (var len = models.length, i = 0; i < len; i++) {
1749 graph[models[i]] = {
1750 // http://jsperf.com/1-vs-infinity
1751 // micro-opt, but this is simple.
1758 } // https://en.wikipedia.org/wiki/Breadth-first_search
1761 function deriveBFS(fromModel) {
1762 var graph = buildGraph();
1763 var queue = [fromModel]; // unshift -> queue -> pop
1765 graph[fromModel].distance = 0;
1767 while (queue.length) {
1768 var current = queue.pop();
1769 var adjacents = Object.keys(conversions$1[current]);
1771 for (var len = adjacents.length, i = 0; i < len; i++) {
1772 var adjacent = adjacents[i];
1773 var node = graph[adjacent];
1775 if (node.distance === -1) {
1776 node.distance = graph[current].distance + 1;
1777 node.parent = current;
1778 queue.unshift(adjacent);
1786 function link(from, to) {
1787 return function (args) {
1788 return to(from(args));
1792 function wrapConversion(toModel, graph) {
1793 var path = [graph[toModel].parent, toModel];
1794 var fn = conversions$1[graph[toModel].parent][toModel];
1795 var cur = graph[toModel].parent;
1797 while (graph[cur].parent) {
1798 path.unshift(graph[cur].parent);
1799 fn = link(conversions$1[graph[cur].parent][cur], fn);
1800 cur = graph[cur].parent;
1803 fn.conversion = path;
1807 var route$1 = function (fromModel) {
1808 var graph = deriveBFS(fromModel);
1809 var conversion = {};
1810 var models = Object.keys(graph);
1812 for (var len = models.length, i = 0; i < len; i++) {
1813 var toModel = models[i];
1814 var node = graph[toModel];
1816 if (node.parent === null) {
1817 // no possible conversion, or this node is the source model.
1821 conversion[toModel] = wrapConversion(toModel, graph);
1827 var conversions = conversions$2.exports;
1828 var route = route$1;
1830 var models = Object.keys(conversions);
1832 function wrapRaw(fn) {
1833 var wrappedFn = function (args) {
1834 if (args === undefined || args === null) {
1838 if (arguments.length > 1) {
1839 args = Array.prototype.slice.call(arguments);
1843 }; // preserve .conversion property if there is one
1846 if ('conversion' in fn) {
1847 wrappedFn.conversion = fn.conversion;
1853 function wrapRounded(fn) {
1854 var wrappedFn = function (args) {
1855 if (args === undefined || args === null) {
1859 if (arguments.length > 1) {
1860 args = Array.prototype.slice.call(arguments);
1863 var result = fn(args); // we're assuming the result is an array here.
1864 // see notice in conversions.js; don't use box types
1865 // in conversion functions.
1867 if (typeof result === 'object') {
1868 for (var len = result.length, i = 0; i < len; i++) {
1869 result[i] = Math.round(result[i]);
1874 }; // preserve .conversion property if there is one
1877 if ('conversion' in fn) {
1878 wrappedFn.conversion = fn.conversion;
1884 models.forEach(function (fromModel) {
1885 convert[fromModel] = {};
1886 Object.defineProperty(convert[fromModel], 'channels', {
1887 value: conversions[fromModel].channels
1889 Object.defineProperty(convert[fromModel], 'labels', {
1890 value: conversions[fromModel].labels
1892 var routes = route(fromModel);
1893 var routeModels = Object.keys(routes);
1894 routeModels.forEach(function (toModel) {
1895 var fn = routes[toModel];
1896 convert[fromModel][toModel] = wrapRounded(fn);
1897 convert[fromModel][toModel].raw = wrapRaw(fn);
1900 var colorConvert = convert;
1902 (function (module) {
1904 const colorConvert$1 = colorConvert;
1906 const wrapAnsi16 = (fn, offset) => function () {
1907 const code = fn.apply(colorConvert$1, arguments);
1908 return `\u001B[${code + offset}m`;
1911 const wrapAnsi256 = (fn, offset) => function () {
1912 const code = fn.apply(colorConvert$1, arguments);
1913 return `\u001B[${38 + offset};5;${code}m`;
1916 const wrapAnsi16m = (fn, offset) => function () {
1917 const rgb = fn.apply(colorConvert$1, arguments);
1918 return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1921 function assembleStyles() {
1922 const codes = new Map();
1926 // 21 isn't widely supported and 22 does the same thing
1933 strikethrough: [9, 29]
1946 redBright: [91, 39],
1947 greenBright: [92, 39],
1948 yellowBright: [93, 39],
1949 blueBright: [94, 39],
1950 magentaBright: [95, 39],
1951 cyanBright: [96, 39],
1952 whiteBright: [97, 39]
1960 bgMagenta: [45, 49],
1964 bgBlackBright: [100, 49],
1965 bgRedBright: [101, 49],
1966 bgGreenBright: [102, 49],
1967 bgYellowBright: [103, 49],
1968 bgBlueBright: [104, 49],
1969 bgMagentaBright: [105, 49],
1970 bgCyanBright: [106, 49],
1971 bgWhiteBright: [107, 49]
1975 styles.color.grey = styles.color.gray;
1977 for (const groupName of Object.keys(styles)) {
1978 const group = styles[groupName];
1980 for (const styleName of Object.keys(group)) {
1981 const style = group[styleName];
1982 styles[styleName] = {
1983 open: `\u001B[${style[0]}m`,
1984 close: `\u001B[${style[1]}m`
1986 group[styleName] = styles[styleName];
1987 codes.set(style[0], style[1]);
1990 Object.defineProperty(styles, groupName, {
1994 Object.defineProperty(styles, 'codes', {
2000 const ansi2ansi = n => n;
2002 const rgb2rgb = (r, g, b) => [r, g, b];
2004 styles.color.close = '\u001B[39m';
2005 styles.bgColor.close = '\u001B[49m';
2006 styles.color.ansi = {
2007 ansi: wrapAnsi16(ansi2ansi, 0)
2009 styles.color.ansi256 = {
2010 ansi256: wrapAnsi256(ansi2ansi, 0)
2012 styles.color.ansi16m = {
2013 rgb: wrapAnsi16m(rgb2rgb, 0)
2015 styles.bgColor.ansi = {
2016 ansi: wrapAnsi16(ansi2ansi, 10)
2018 styles.bgColor.ansi256 = {
2019 ansi256: wrapAnsi256(ansi2ansi, 10)
2021 styles.bgColor.ansi16m = {
2022 rgb: wrapAnsi16m(rgb2rgb, 10)
2025 for (let key of Object.keys(colorConvert$1)) {
2026 if (typeof colorConvert$1[key] !== 'object') {
2030 const suite = colorConvert$1[key];
2032 if (key === 'ansi16') {
2036 if ('ansi16' in suite) {
2037 styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
2038 styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
2041 if ('ansi256' in suite) {
2042 styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
2043 styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
2046 if ('rgb' in suite) {
2047 styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
2048 styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
2053 } // Make the export immutable
2056 Object.defineProperty(module, 'exports', {
2062 var hasFlag$1 = (flag, argv) => {
2063 argv = argv || process.argv;
2064 const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2065 const pos = argv.indexOf(prefix + flag);
2066 const terminatorPos = argv.indexOf('--');
2067 return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
2070 const os = require$$0__default$2["default"];
2071 const hasFlag = hasFlag$1;
2072 const env = process.env;
2075 if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
2077 } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
2081 if ('FORCE_COLOR' in env) {
2082 forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
2085 function translateLevel(level) {
2098 function supportsColor(stream) {
2099 if (forceColor === false) {
2103 if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
2107 if (hasFlag('color=256')) {
2111 if (stream && !stream.isTTY && forceColor !== true) {
2115 const min = forceColor ? 1 : 0;
2117 if (process.platform === 'win32') {
2118 // Node.js 7.5.0 is the first version of Node.js to include a patch to
2119 // libuv that enables 256 color output on Windows. Anything earlier and it
2120 // won't work. However, here we target Node.js 8 at minimum as it is an LTS
2121 // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
2122 // release that supports 256 colors. Windows 10 build 14931 is the first release
2123 // that supports 16m/TrueColor.
2124 const osRelease = os.release().split('.');
2126 if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2127 return Number(osRelease[2]) >= 14931 ? 3 : 2;
2134 if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2141 if ('TEAMCITY_VERSION' in env) {
2142 return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2145 if (env.COLORTERM === 'truecolor') {
2149 if ('TERM_PROGRAM' in env) {
2150 const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2152 switch (env.TERM_PROGRAM) {
2154 return version >= 3 ? 3 : 2;
2156 case 'Apple_Terminal':
2162 if (/-256(color)?$/i.test(env.TERM)) {
2166 if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2170 if ('COLORTERM' in env) {
2174 if (env.TERM === 'dumb') {
2181 function getSupportLevel(stream) {
2182 const level = supportsColor(stream);
2183 return translateLevel(level);
2186 var supportsColor_1 = {
2187 supportsColor: getSupportLevel,
2188 stdout: getSupportLevel(process.stdout),
2189 stderr: getSupportLevel(process.stderr)
2192 const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
2193 const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
2194 const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
2195 const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
2196 const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
2198 function unescape(c) {
2199 if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
2200 return String.fromCharCode(parseInt(c.slice(1), 16));
2203 return ESCAPES.get(c) || c;
2206 function parseArguments(name, args) {
2208 const chunks = args.trim().split(/\s*,\s*/g);
2211 for (const chunk of chunks) {
2212 if (!isNaN(chunk)) {
2213 results.push(Number(chunk));
2214 } else if (matches = chunk.match(STRING_REGEX)) {
2215 results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
2217 throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
2224 function parseStyle(style) {
2225 STYLE_REGEX.lastIndex = 0;
2229 while ((matches = STYLE_REGEX.exec(style)) !== null) {
2230 const name = matches[1];
2233 const args = parseArguments(name, matches[2]);
2234 results.push([name].concat(args));
2236 results.push([name]);
2243 function buildStyle(chalk, styles) {
2246 for (const layer of styles) {
2247 for (const style of layer.styles) {
2248 enabled[style[0]] = layer.inverse ? null : style.slice(1);
2252 let current = chalk;
2254 for (const styleName of Object.keys(enabled)) {
2255 if (Array.isArray(enabled[styleName])) {
2256 if (!(styleName in current)) {
2257 throw new Error(`Unknown Chalk style: ${styleName}`);
2260 if (enabled[styleName].length > 0) {
2261 current = current[styleName].apply(current, enabled[styleName]);
2263 current = current[styleName];
2271 var templates = (chalk, tmp) => {
2274 let chunk = []; // eslint-disable-next-line max-params
2276 tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
2278 chunk.push(unescape(escapeChar));
2280 const str = chunk.join('');
2282 chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
2285 styles: parseStyle(style)
2288 if (styles.length === 0) {
2289 throw new Error('Found extraneous } in Chalk template literal');
2292 chunks.push(buildStyle(chalk, styles)(chunk.join('')));
2299 chunks.push(chunk.join(''));
2301 if (styles.length > 0) {
2302 const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
2303 throw new Error(errMsg);
2306 return chunks.join('');
2309 (function (module) {
2311 const escapeStringRegexp$1 = escapeStringRegexp;
2312 const ansiStyles$1 = ansiStyles.exports;
2313 const stdoutColor = supportsColor_1.stdout;
2314 const template = templates;
2315 const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
2317 const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
2319 const skipModels = new Set(['gray']);
2320 const styles = Object.create(null);
2322 function applyOptions(obj, options) {
2323 options = options || {}; // Detect level if not set manually
2325 const scLevel = stdoutColor ? stdoutColor.level : 0;
2326 obj.level = options.level === undefined ? scLevel : options.level;
2327 obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
2330 function Chalk(options) {
2331 // We check for this.template here since calling `chalk.constructor()`
2332 // by itself will have a `this` of a previously constructed chalk object
2333 if (!this || !(this instanceof Chalk) || this.template) {
2335 applyOptions(chalk, options);
2337 chalk.template = function () {
2338 const args = [].slice.call(arguments);
2339 return chalkTag.apply(null, [chalk.template].concat(args));
2342 Object.setPrototypeOf(chalk, Chalk.prototype);
2343 Object.setPrototypeOf(chalk.template, chalk);
2344 chalk.template.constructor = Chalk;
2345 return chalk.template;
2348 applyOptions(this, options);
2349 } // Use bright blue on Windows as the normal blue color is illegible
2352 if (isSimpleWindowsTerm) {
2353 ansiStyles$1.blue.open = '\u001B[94m';
2356 for (const key of Object.keys(ansiStyles$1)) {
2357 ansiStyles$1[key].closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$1[key].close), 'g');
2360 const codes = ansiStyles$1[key];
2361 return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
2369 return build.call(this, this._styles || [], true, 'visible');
2373 ansiStyles$1.color.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$1.color.close), 'g');
2375 for (const model of Object.keys(ansiStyles$1.color.ansi)) {
2376 if (skipModels.has(model)) {
2382 const level = this.level;
2383 return function () {
2384 const open = ansiStyles$1.color[levelMapping[level]][model].apply(null, arguments);
2387 close: ansiStyles$1.color.close,
2388 closeRe: ansiStyles$1.color.closeRe
2390 return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2397 ansiStyles$1.bgColor.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles$1.bgColor.close), 'g');
2399 for (const model of Object.keys(ansiStyles$1.bgColor.ansi)) {
2400 if (skipModels.has(model)) {
2404 const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
2407 const level = this.level;
2408 return function () {
2409 const open = ansiStyles$1.bgColor[levelMapping[level]][model].apply(null, arguments);
2412 close: ansiStyles$1.bgColor.close,
2413 closeRe: ansiStyles$1.bgColor.closeRe
2415 return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
2422 const proto = Object.defineProperties(() => {}, styles);
2424 function build(_styles, _empty, key) {
2425 const builder = function () {
2426 return applyStyle.apply(builder, arguments);
2429 builder._styles = _styles;
2430 builder._empty = _empty;
2432 Object.defineProperty(builder, 'level', {
2444 Object.defineProperty(builder, 'enabled', {
2448 return self.enabled;
2452 self.enabled = enabled;
2455 }); // See below for fix regarding invisible grey/dim combination on Windows
2457 builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
2458 // no way to create a function with a different prototype
2460 builder.__proto__ = proto; // eslint-disable-line no-proto
2465 function applyStyle() {
2466 // Support varags, but simply cast to string in case there's only one arg
2467 const args = arguments;
2468 const argsLen = args.length;
2469 let str = String(arguments[0]);
2471 if (argsLen === 0) {
2476 // Don't slice `arguments`, it prevents V8 optimizations
2477 for (let a = 1; a < argsLen; a++) {
2478 str += ' ' + args[a];
2482 if (!this.enabled || this.level <= 0 || !str) {
2483 return this._empty ? '' : str;
2484 } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
2485 // see https://github.com/chalk/chalk/issues/58
2486 // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
2489 const originalDim = ansiStyles$1.dim.open;
2491 if (isSimpleWindowsTerm && this.hasGrey) {
2492 ansiStyles$1.dim.open = '';
2495 for (const code of this._styles.slice().reverse()) {
2496 // Replace any instances already present with a re-opening code
2497 // otherwise only the part of the string until said closing code
2498 // will be colored, and the rest will simply be 'plain'.
2499 str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
2500 // after next line to fix a bleed issue on macOS
2501 // https://github.com/chalk/chalk/pull/92
2503 str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
2504 } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
2507 ansiStyles$1.dim.open = originalDim;
2511 function chalkTag(chalk, strings) {
2512 if (!Array.isArray(strings)) {
2513 // If chalk() was called by itself or with a string,
2514 // return the string itself as a string.
2515 return [].slice.call(arguments, 1).join(' ');
2518 const args = [].slice.call(arguments, 2);
2519 const parts = [strings.raw[0]];
2521 for (let i = 1; i < strings.length; i++) {
2522 parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
2523 parts.push(String(strings.raw[i]));
2526 return template(chalk, parts.join(''));
2529 Object.defineProperties(Chalk.prototype, styles);
2530 module.exports = Chalk(); // eslint-disable-line new-cap
2532 module.exports.supportsColor = stdoutColor;
2533 module.exports.default = module.exports; // For TypeScript
2536 Object.defineProperty(lib$1, "__esModule", {
2540 lib$1.default = highlight;
2542 lib$1.getChalk = getChalk;
2543 lib$1.shouldHighlight = shouldHighlight;
2544 var _jsTokens = jsTokens;
2545 var _helperValidatorIdentifier = lib;
2546 var _chalk = chalk.exports;
2547 const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
2549 function getDefs$1(chalk) {
2551 keyword: chalk.cyan,
2552 capitalized: chalk.yellow,
2553 jsxIdentifier: chalk.yellow,
2554 punctuator: chalk.yellow,
2555 number: chalk.magenta,
2556 string: chalk.green,
2557 regex: chalk.magenta,
2558 comment: chalk.grey,
2559 invalid: chalk.white.bgRed.bold
2563 const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
2564 const BRACKET = /^[()[\]{}]$/;
2567 const JSX_TAG = /^[a-z][\w-]*$/i;
2569 const getTokenType = function (token, offset, text) {
2570 if (token.type === "name") {
2571 if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
2575 if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
2576 return "jsxIdentifier";
2579 if (token.value[0] !== token.value[0].toLowerCase()) {
2580 return "capitalized";
2584 if (token.type === "punctuator" && BRACKET.test(token.value)) {
2588 if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
2589 return "punctuator";
2595 tokenize = function* (text) {
2598 while (match = _jsTokens.default.exec(text)) {
2599 const token = _jsTokens.matchToToken(match);
2602 type: getTokenType(token, match.index, text),
2609 function highlightTokens(defs, text) {
2610 let highlighted = "";
2615 } of tokenize(text)) {
2616 const colorize = defs[type];
2619 highlighted += value.split(NEWLINE$1).map(str => colorize(str)).join("\n");
2621 highlighted += value;
2628 function shouldHighlight(options) {
2629 return !!_chalk.supportsColor || options.forceColor;
2632 function getChalk(options) {
2633 return options.forceColor ? new _chalk.constructor({
2639 function highlight(code, options = {}) {
2640 if (shouldHighlight(options)) {
2641 const chalk = getChalk(options);
2642 const defs = getDefs$1(chalk);
2643 return highlightTokens(defs, code);
2649 Object.defineProperty(lib$2, "__esModule", {
2652 lib$2.codeFrameColumns = codeFrameColumns$1;
2653 lib$2.default = _default;
2654 var _highlight = lib$1;
2655 let deprecationWarningShown = false;
2657 function getDefs(chalk) {
2660 marker: chalk.red.bold,
2661 message: chalk.red.bold
2665 const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
2667 function getMarkerLines(loc, source, opts) {
2668 const startLoc = Object.assign({
2672 const endLoc = Object.assign({}, startLoc, loc.end);
2677 const startLine = startLoc.line;
2678 const startColumn = startLoc.column;
2679 const endLine = endLoc.line;
2680 const endColumn = endLoc.column;
2681 let start = Math.max(startLine - (linesAbove + 1), 0);
2682 let end = Math.min(source.length, endLine + linesBelow);
2684 if (startLine === -1) {
2688 if (endLine === -1) {
2689 end = source.length;
2692 const lineDiff = endLine - startLine;
2693 const markerLines = {};
2696 for (let i = 0; i <= lineDiff; i++) {
2697 const lineNumber = i + startLine;
2700 markerLines[lineNumber] = true;
2701 } else if (i === 0) {
2702 const sourceLength = source[lineNumber - 1].length;
2703 markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
2704 } else if (i === lineDiff) {
2705 markerLines[lineNumber] = [0, endColumn];
2707 const sourceLength = source[lineNumber - i].length;
2708 markerLines[lineNumber] = [0, sourceLength];
2712 if (startColumn === endColumn) {
2714 markerLines[startLine] = [startColumn, 0];
2716 markerLines[startLine] = true;
2719 markerLines[startLine] = [startColumn, endColumn - startColumn];
2730 function codeFrameColumns$1(rawLines, loc, opts = {}) {
2731 const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
2732 const chalk = (0, _highlight.getChalk)(opts);
2733 const defs = getDefs(chalk);
2735 const maybeHighlight = (chalkFn, string) => {
2736 return highlighted ? chalkFn(string) : string;
2739 const lines = rawLines.split(NEWLINE);
2744 } = getMarkerLines(loc, lines, opts);
2745 const hasColumns = loc.start && typeof loc.start.column === "number";
2746 const numberMaxWidth = String(end).length;
2747 const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
2748 let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
2749 const number = start + 1 + index;
2750 const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
2751 const gutter = ` ${paddedNumber} |`;
2752 const hasMarker = markerLines[number];
2753 const lastMarkerLine = !markerLines[number + 1];
2756 let markerLine = "";
2758 if (Array.isArray(hasMarker)) {
2759 const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
2760 const numberOfMarkers = hasMarker[1] || 1;
2761 markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
2763 if (lastMarkerLine && opts.message) {
2764 markerLine += " " + maybeHighlight(defs.message, opts.message);
2768 return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
2770 return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
2774 if (opts.message && !hasColumns) {
2775 frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
2779 return chalk.reset(frame);
2785 function _default(rawLines, lineNumber, colNumber, opts = {}) {
2786 if (!deprecationWarningShown) {
2787 deprecationWarningShown = true;
2788 const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
2790 if (process.emitWarning) {
2791 process.emitWarning(message, "DeprecationWarning");
2793 const deprecationError = new Error(message);
2794 deprecationError.name = "DeprecationWarning";
2795 console.warn(new Error(message));
2799 colNumber = Math.max(colNumber, 0);
2806 return codeFrameColumns$1(rawLines, location, opts);
2809 const errorEx = errorEx_1;
2810 const fallback = jsonParseEvenBetterErrors;
2812 default: LinesAndColumns
2817 const JSONError = errorEx('JSONError', {
2818 fileName: errorEx.append('in %s'),
2819 codeFrame: errorEx.append('\n\n%s\n')
2822 const parseJson$1 = (string, reviver, filename) => {
2823 if (typeof reviver === 'string') {
2830 return JSON.parse(string, reviver);
2832 fallback(string, reviver);
2836 error.message = error.message.replace(/\n/g, '');
2837 const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
2838 const jsonError = new JSONError(error);
2841 jsonError.fileName = filename;
2844 if (indexMatch && indexMatch.length > 0) {
2845 const lines = new LinesAndColumns(string);
2846 const index = Number(indexMatch[1]);
2847 const location = lines.locationForIndex(index);
2848 const codeFrame = codeFrameColumns(string, {
2850 line: location.line + 1,
2851 column: location.column + 1
2856 jsonError.codeFrame = codeFrame;
2863 parseJson$1.JSONError = JSONError;
2864 var parseJson_1 = parseJson$1;
2868 var parseCst$1 = {};
2870 var PlainValueEc8e588e = {};
2876 DIRECTIVES_END: '-',
2881 BLANK_LINE: 'BLANK_LINE',
2882 BLOCK_FOLDED: 'BLOCK_FOLDED',
2883 BLOCK_LITERAL: 'BLOCK_LITERAL',
2885 DIRECTIVE: 'DIRECTIVE',
2886 DOCUMENT: 'DOCUMENT',
2887 FLOW_MAP: 'FLOW_MAP',
2888 FLOW_SEQ: 'FLOW_SEQ',
2891 MAP_VALUE: 'MAP_VALUE',
2893 QUOTE_DOUBLE: 'QUOTE_DOUBLE',
2894 QUOTE_SINGLE: 'QUOTE_SINGLE',
2896 SEQ_ITEM: 'SEQ_ITEM'
2898 const defaultTagPrefix = 'tag:yaml.org,2002:';
2899 const defaultTags = {
2900 MAP: 'tag:yaml.org,2002:map',
2901 SEQ: 'tag:yaml.org,2002:seq',
2902 STR: 'tag:yaml.org,2002:str'
2905 function findLineStarts(src) {
2907 let offset = src.indexOf('\n');
2909 while (offset !== -1) {
2912 offset = src.indexOf('\n', offset);
2918 function getSrcInfo(cst) {
2919 let lineStarts, src;
2921 if (typeof cst === 'string') {
2922 lineStarts = findLineStarts(cst);
2925 if (Array.isArray(cst)) cst = cst[0];
2927 if (cst && cst.context) {
2928 if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src);
2929 lineStarts = cst.lineStarts;
2930 src = cst.context.src;
2940 * @typedef {Object} LinePos - One-indexed position in the source
2941 * @property {number} line
2942 * @property {number} col
2946 * Determine the line/col position matching a character offset.
2948 * Accepts a source string or a CST document as the second parameter. With
2949 * the latter, starting indices for lines are cached in the document as
2950 * `lineStarts: number[]`.
2952 * Returns a one-indexed `{ line, col }` location if found, or
2953 * `undefined` otherwise.
2955 * @param {number} offset
2956 * @param {string|Document|Document[]} cst
2957 * @returns {?LinePos}
2961 function getLinePos(offset, cst) {
2962 if (typeof offset !== 'number' || offset < 0) return null;
2966 } = getSrcInfo(cst);
2967 if (!lineStarts || !src || offset > src.length) return null;
2969 for (let i = 0; i < lineStarts.length; ++i) {
2970 const start = lineStarts[i];
2972 if (offset < start) {
2975 col: offset - lineStarts[i - 1] + 1
2979 if (offset === start) return {
2985 const line = lineStarts.length;
2988 col: offset - lineStarts[line - 1] + 1
2992 * Get a specified line from the source.
2994 * Accepts a source string or a CST document as the second parameter. With
2995 * the latter, starting indices for lines are cached in the document as
2996 * `lineStarts: number[]`.
2998 * Returns the line as a string if found, or `null` otherwise.
3000 * @param {number} line One-indexed line number
3001 * @param {string|Document|Document[]} cst
3002 * @returns {?string}
3006 function getLine(line, cst) {
3010 } = getSrcInfo(cst);
3011 if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null;
3012 const start = lineStarts[line - 1];
3013 let end = lineStarts[line]; // undefined for last line; that's ok for slice()
3015 while (end && end > start && src[end - 1] === '\n') --end;
3017 return src.slice(start, end);
3020 * Pretty-print the starting line from the source indicated by the range `pos`
3022 * Trims output to `maxWidth` chars while keeping the starting column visible,
3023 * using `…` at either end to indicate dropped characters.
3025 * Returns a two-line string (or `null`) with `\n` as separator; the second line
3026 * will hold appropriately indented `^` marks indicating the column range.
3028 * @param {Object} pos
3029 * @param {LinePos} pos.start
3030 * @param {LinePos} [pos.end]
3031 * @param {string|Document|Document[]*} cst
3032 * @param {number} [maxWidth=80]
3033 * @returns {?string}
3037 function getPrettyContext({
3040 }, cst, maxWidth = 80) {
3041 let src = getLine(start.line, cst);
3042 if (!src) return null;
3047 if (src.length > maxWidth) {
3048 if (col <= maxWidth - 10) {
3049 src = src.substr(0, maxWidth - 1) + '…';
3051 const halfWidth = Math.round(maxWidth / 2);
3052 if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + '…';
3053 col -= src.length - maxWidth;
3054 src = '…' + src.substr(1 - maxWidth);
3062 if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
3063 errLen = end.col - start.col;
3065 errLen = Math.min(src.length + 1, maxWidth) - col;
3070 const offset = col > 1 ? ' '.repeat(col - 1) : '';
3071 const err = '^'.repeat(errLen);
3072 return `${src}\n${offset}${err}${errEnd}`;
3077 return new Range(orig.start, orig.end);
3080 constructor(start, end) {
3082 this.end = end || start;
3086 return typeof this.start !== 'number' || !this.end || this.end <= this.start;
3089 * Set `origStart` and `origEnd` to point to the original source range for
3090 * this node, which may differ due to dropped CR characters.
3092 * @param {number[]} cr - Positions of dropped CR characters
3093 * @param {number} offset - Starting index of `cr` from the last call
3094 * @returns {number} - The next offset, matching the one found for `origStart`
3098 setOrigRange(cr, offset) {
3104 if (cr.length === 0 || end <= cr[0]) {
3105 this.origStart = start;
3112 while (i < cr.length) {
3113 if (cr[i] > start) break;else ++i;
3116 this.origStart = start + i;
3117 const nextOffset = i;
3119 while (i < cr.length) {
3120 // if end was at \n, it should now be at \r
3121 if (cr[i] >= end) break;else ++i;
3124 this.origEnd = end + i;
3129 /** Root class of all nodes */
3133 static addStringTerminator(src, offset, str) {
3134 if (str[str.length - 1] === '\n') return str;
3135 const next = Node$1.endOfWhiteSpace(src, offset);
3136 return next >= src.length || src[next] === '\n' ? str + '\n' : str;
3140 static atDocumentBoundary(src, offset, sep) {
3141 const ch0 = src[offset];
3142 if (!ch0) return true;
3143 const prev = src[offset - 1];
3144 if (prev && prev !== '\n') return false;
3147 if (ch0 !== sep) return false;
3149 if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END) return false;
3152 const ch1 = src[offset + 1];
3153 const ch2 = src[offset + 2];
3154 if (ch1 !== ch0 || ch2 !== ch0) return false;
3155 const ch3 = src[offset + 3];
3156 return !ch3 || ch3 === '\n' || ch3 === '\t' || ch3 === ' ';
3159 static endOfIdentifier(src, offset) {
3160 let ch = src[offset];
3161 const isVerbatim = ch === '<';
3162 const notOk = isVerbatim ? ['\n', '\t', ' ', '>'] : ['\n', '\t', ' ', '[', ']', '{', '}', ','];
3164 while (ch && notOk.indexOf(ch) === -1) ch = src[offset += 1];
3166 if (isVerbatim && ch === '>') offset += 1;
3170 static endOfIndent(src, offset) {
3171 let ch = src[offset];
3173 while (ch === ' ') ch = src[offset += 1];
3178 static endOfLine(src, offset) {
3179 let ch = src[offset];
3181 while (ch && ch !== '\n') ch = src[offset += 1];
3186 static endOfWhiteSpace(src, offset) {
3187 let ch = src[offset];
3189 while (ch === '\t' || ch === ' ') ch = src[offset += 1];
3194 static startOfLine(src, offset) {
3195 let ch = src[offset - 1];
3196 if (ch === '\n') return offset;
3198 while (ch && ch !== '\n') ch = src[offset -= 1];
3203 * End of indentation, or null if the line's indent level is not more
3206 * @param {string} src
3207 * @param {number} indent
3208 * @param {number} lineStart
3209 * @returns {?number}
3213 static endOfBlockIndent(src, indent, lineStart) {
3214 const inEnd = Node$1.endOfIndent(src, lineStart);
3216 if (inEnd > lineStart + indent) {
3219 const wsEnd = Node$1.endOfWhiteSpace(src, inEnd);
3220 const ch = src[wsEnd];
3221 if (!ch || ch === '\n') return wsEnd;
3227 static atBlank(src, offset, endAsBlank) {
3228 const ch = src[offset];
3229 return ch === '\n' || ch === '\t' || ch === ' ' || endAsBlank && !ch;
3232 static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
3233 if (!ch || indentDiff < 0) return false;
3234 if (indentDiff > 0) return true;
3235 return indicatorAsIndent && ch === '-';
3236 } // should be at line or string end, or at next non-whitespace char
3239 static normalizeOffset(src, offset) {
3240 const ch = src[offset];
3241 return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node$1.endOfWhiteSpace(src, offset);
3242 } // fold single newline into space, multiple newlines to N - 1 newlines
3243 // presumes src[offset] === '\n'
3246 static foldNewline(src, offset, indent) {
3250 let ch = src[offset + 1];
3252 while (ch === ' ' || ch === '\t' || ch === '\n') {
3261 if (inCount <= indent) error = true;
3262 offset = Node$1.endOfWhiteSpace(src, offset + 2) - 1;
3271 ch = src[offset + 1];
3274 if (!fold) fold = ' ';
3275 if (ch && inCount <= indent) error = true;
3283 constructor(type, props, context) {
3284 Object.defineProperty(this, 'context', {
3285 value: context || null,
3290 this.valueRange = null;
3291 this.props = props || [];
3296 getPropValue(idx, key, skipKey) {
3297 if (!this.context) return null;
3301 const prop = this.props[idx];
3302 return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
3306 for (let i = 0; i < this.props.length; ++i) {
3307 const anchor = this.getPropValue(i, Char.ANCHOR, true);
3308 if (anchor != null) return anchor;
3315 const comments = [];
3317 for (let i = 0; i < this.props.length; ++i) {
3318 const comment = this.getPropValue(i, Char.COMMENT, true);
3319 if (comment != null) comments.push(comment);
3322 return comments.length > 0 ? comments.join('\n') : null;
3325 commentHasRequiredWhitespace(start) {
3329 if (this.header && start === this.header.end) return false;
3330 if (!this.valueRange) return false;
3333 } = this.valueRange;
3334 return start !== end || Node$1.atBlank(src, end - 1);
3343 for (let i = 0; i < this.props.length; ++i) {
3344 if (src[this.props[i].start] === Char.COMMENT) return true;
3357 for (let i = 0; i < this.props.length; ++i) {
3358 if (src[this.props[i].start] !== Char.COMMENT) return true;
3365 get includesTrailingLines() {
3370 const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE];
3371 return jsonLikeTypes.indexOf(this.type) !== -1;
3374 get rangeAsLinePos() {
3375 if (!this.range || !this.context) return undefined;
3376 const start = getLinePos(this.range.start, this.context.root);
3377 if (!start) return undefined;
3378 const end = getLinePos(this.range.end, this.context.root);
3386 if (!this.valueRange || !this.context) return null;
3390 } = this.valueRange;
3391 return this.context.src.slice(start, end);
3395 for (let i = 0; i < this.props.length; ++i) {
3396 const tag = this.getPropValue(i, Char.TAG, false);
3399 if (tag[1] === '<') {
3401 verbatim: tag.slice(2, -1)
3404 // eslint-disable-next-line no-unused-vars
3405 const [_, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
3417 get valueRangeContainsNewline() {
3418 if (!this.valueRange || !this.context) return false;
3422 } = this.valueRange;
3427 for (let i = start; i < end; ++i) {
3428 if (src[i] === '\n') return true;
3434 parseComment(start) {
3439 if (src[start] === Char.COMMENT) {
3440 const end = Node$1.endOfLine(src, start + 1);
3441 const commentRange = new Range(start, end);
3442 this.props.push(commentRange);
3449 * Populates the `origStart` and `origEnd` values of all ranges for this
3450 * node. Extended by child classes to handle descendant nodes.
3452 * @param {number[]} cr - Positions of dropped CR characters
3453 * @param {number} offset - Starting index of `cr` from the last call
3454 * @returns {number} - The next offset, matching the one found for `origStart`
3458 setOrigRanges(cr, offset) {
3459 if (this.range) offset = this.range.setOrigRange(cr, offset);
3460 if (this.valueRange) this.valueRange.setOrigRange(cr, offset);
3461 this.props.forEach(prop => prop.setOrigRange(cr, offset));
3473 if (value != null) return value;
3474 const str = src.slice(range.start, range.end);
3475 return Node$1.addStringTerminator(src, range.end, str);
3480 class YAMLError extends Error {
3481 constructor(name, source, message) {
3482 if (!message || !(source instanceof Node$1)) throw new Error(`Invalid arguments for new ${name}`);
3485 this.message = message;
3486 this.source = source;
3490 if (!this.source) return;
3491 this.nodeType = this.source.type;
3492 const cst = this.source.context && this.source.context.root;
3494 if (typeof this.offset === 'number') {
3495 this.range = new Range(this.offset, this.offset + 1);
3496 const start = cst && getLinePos(this.offset, cst);
3511 this.range = this.source.range;
3512 this.linePos = this.source.rangeAsLinePos;
3519 } = this.linePos.start;
3520 this.message += ` at line ${line}, column ${col}`;
3521 const ctx = cst && getPrettyContext(this.linePos, cst);
3522 if (ctx) this.message += `:\n\n${ctx}\n`;
3530 class YAMLReferenceError extends YAMLError {
3531 constructor(source, message) {
3532 super('YAMLReferenceError', source, message);
3537 class YAMLSemanticError extends YAMLError {
3538 constructor(source, message) {
3539 super('YAMLSemanticError', source, message);
3544 class YAMLSyntaxError extends YAMLError {
3545 constructor(source, message) {
3546 super('YAMLSyntaxError', source, message);
3551 class YAMLWarning extends YAMLError {
3552 constructor(source, message) {
3553 super('YAMLWarning', source, message);
3558 function _defineProperty(obj, key, value) {
3560 Object.defineProperty(obj, key, {
3573 class PlainValue$6 extends Node$1 {
3574 static endOfLine(src, start, inFlow) {
3575 let ch = src[start];
3578 while (ch && ch !== '\n') {
3579 if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break;
3580 const next = src[offset + 1];
3581 if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break;
3582 if ((ch === ' ' || ch === '\t') && next === '#') break;
3591 if (!this.valueRange || !this.context) return null;
3595 } = this.valueRange;
3599 let ch = src[end - 1];
3601 while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) ch = src[--end - 1];
3605 for (let i = start; i < end; ++i) {
3612 } = Node$1.foldNewline(src, i, -1);
3615 } else if (ch === ' ' || ch === '\t') {
3616 // trim trailing whitespace
3618 let next = src[i + 1];
3620 while (i < end && (next === ' ' || next === '\t')) {
3625 if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
3631 const ch0 = src[start];
3636 const msg = 'Plain value cannot start with a tab character';
3637 const errors = [new YAMLSemanticError(this, msg)];
3647 const msg = `Plain value cannot start with reserved character ${ch0}`;
3648 const errors = [new YAMLSemanticError(this, msg)];
3660 parseBlockValue(start) {
3667 let valueEnd = start;
3669 for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
3670 if (Node$1.atDocumentBoundary(src, offset + 1)) break;
3671 const end = Node$1.endOfBlockIndent(src, indent, offset + 1);
3672 if (end === null || src[end] === '#') break;
3674 if (src[end] === '\n') {
3677 valueEnd = PlainValue$6.endOfLine(src, end, inFlow);
3682 if (this.valueRange.isEmpty()) this.valueRange.start = start;
3683 this.valueRange.end = valueEnd;
3687 * Parses a plain value from the source
3689 * Accepted forms are:
3695 * first line #comment
3705 * where block lines are empty or have an indent level greater than `indent`.
3707 * @param {ParseContext} context
3708 * @param {number} start - Index of first character
3709 * @returns {number} - Index of the character after this scalar, may be `\n`
3713 parse(context, start) {
3714 this.context = context;
3720 const ch = src[offset];
3722 if (ch && ch !== '#' && ch !== '\n') {
3723 offset = PlainValue$6.endOfLine(src, start, inFlow);
3726 this.valueRange = new Range(start, offset);
3727 offset = Node$1.endOfWhiteSpace(src, offset);
3728 offset = this.parseComment(offset);
3730 if (!this.hasComment || this.valueRange.isEmpty()) {
3731 offset = this.parseBlockValue(offset);
3739 PlainValueEc8e588e.Char = Char;
3740 PlainValueEc8e588e.Node = Node$1;
3741 PlainValueEc8e588e.PlainValue = PlainValue$6;
3742 PlainValueEc8e588e.Range = Range;
3743 PlainValueEc8e588e.Type = Type;
3744 PlainValueEc8e588e.YAMLError = YAMLError;
3745 PlainValueEc8e588e.YAMLReferenceError = YAMLReferenceError;
3746 PlainValueEc8e588e.YAMLSemanticError = YAMLSemanticError;
3747 PlainValueEc8e588e.YAMLSyntaxError = YAMLSyntaxError;
3748 PlainValueEc8e588e.YAMLWarning = YAMLWarning;
3750 PlainValueEc8e588e._defineProperty = _defineProperty;
3752 PlainValueEc8e588e.defaultTagPrefix = defaultTagPrefix;
3753 PlainValueEc8e588e.defaultTags = defaultTags;
3755 var PlainValue$5 = PlainValueEc8e588e;
3757 class BlankLine extends PlainValue$5.Node {
3759 super(PlainValue$5.Type.BLANK_LINE);
3761 /* istanbul ignore next */
3764 get includesTrailingLines() {
3765 // This is never called from anywhere, but if it were,
3766 // this is the value it should return.
3770 * Parses a blank line from the source
3772 * @param {ParseContext} context
3773 * @param {number} start - Index of first \n character
3774 * @returns {number} - Index of the character after this
3778 parse(context, start) {
3779 this.context = context;
3780 this.range = new PlainValue$5.Range(start, start + 1);
3786 class CollectionItem extends PlainValue$5.Node {
3787 constructor(type, props) {
3792 get includesTrailingLines() {
3793 return !!this.node && this.node.includesTrailingLines;
3796 * @param {ParseContext} context
3797 * @param {number} start - Index of first character
3798 * @returns {number} - Index of the character after this
3802 parse(context, start) {
3803 this.context = context;
3812 if (!atLineStart && this.type === PlainValue$5.Type.SEQ_ITEM) this.error = new PlainValue$5.YAMLSemanticError(this, 'Sequence items must not have preceding content on the same line');
3813 const indent = atLineStart ? start - lineStart : context.indent;
3814 let offset = PlainValue$5.Node.endOfWhiteSpace(src, start + 1);
3815 let ch = src[offset];
3816 const inlineComment = ch === '#';
3817 const comments = [];
3818 let blankLine = null;
3820 while (ch === '\n' || ch === '#') {
3822 const end = PlainValue$5.Node.endOfLine(src, offset + 1);
3823 comments.push(new PlainValue$5.Range(offset, end));
3827 lineStart = offset + 1;
3828 const wsEnd = PlainValue$5.Node.endOfWhiteSpace(src, lineStart);
3830 if (src[wsEnd] === '\n' && comments.length === 0) {
3831 blankLine = new BlankLine();
3832 lineStart = blankLine.parse({
3837 offset = PlainValue$5.Node.endOfIndent(src, lineStart);
3843 if (PlainValue$5.Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== PlainValue$5.Type.SEQ_ITEM)) {
3844 this.node = parseNode({
3846 inCollection: false,
3851 } else if (ch && lineStart > start + 1) {
3852 offset = lineStart - 1;
3857 // Only blank lines preceding non-empty nodes are captured. Note that
3858 // this means that collection item range start indices do not always
3859 // increase monotonically. -- eemeli/yaml#126
3860 const items = context.parent.items || context.parent.contents;
3861 if (items) items.push(blankLine);
3864 if (comments.length) Array.prototype.push.apply(this.props, comments);
3865 offset = this.node.range.end;
3867 if (inlineComment) {
3868 const c = comments[0];
3872 offset = PlainValue$5.Node.endOfLine(src, start + 1);
3876 const end = this.node ? this.node.valueRange.end : offset;
3877 this.valueRange = new PlainValue$5.Range(start, end);
3881 setOrigRanges(cr, offset) {
3882 offset = super.setOrigRanges(cr, offset);
3883 return this.node ? this.node.setOrigRanges(cr, offset) : offset;
3895 if (value != null) return value;
3896 const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end);
3897 return PlainValue$5.Node.addStringTerminator(src, range.end, str);
3902 class Comment extends PlainValue$5.Node {
3904 super(PlainValue$5.Type.COMMENT);
3907 * Parses a comment line from the source
3909 * @param {ParseContext} context
3910 * @param {number} start - Index of first character
3911 * @returns {number} - Index of the character after this scalar
3915 parse(context, start) {
3916 this.context = context;
3917 const offset = this.parseComment(start);
3918 this.range = new PlainValue$5.Range(start, offset);
3924 function grabCollectionEndComments(node) {
3927 while (cnode instanceof CollectionItem) cnode = cnode.node;
3929 if (!(cnode instanceof Collection$1)) return null;
3930 const len = cnode.items.length;
3933 for (let i = len - 1; i >= 0; --i) {
3934 const n = cnode.items[i];
3936 if (n.type === PlainValue$5.Type.COMMENT) {
3937 // Keep sufficiently indented comments with preceding node
3942 if (indent > 0 && n.range.start >= lineStart + indent) break;
3944 } else if (n.type === PlainValue$5.Type.BLANK_LINE) ci = i;else break;
3947 if (ci === -1) return null;
3948 const ca = cnode.items.splice(ci, len - ci);
3949 const prevEnd = ca[0].range.start;
3952 cnode.range.end = prevEnd;
3953 if (cnode.valueRange && cnode.valueRange.end > prevEnd) cnode.valueRange.end = prevEnd;
3954 if (cnode === node) break;
3955 cnode = cnode.context.parent;
3961 class Collection$1 extends PlainValue$5.Node {
3962 static nextContentHasIndent(src, offset, indent) {
3963 const lineStart = PlainValue$5.Node.endOfLine(src, offset) + 1;
3964 offset = PlainValue$5.Node.endOfWhiteSpace(src, lineStart);
3965 const ch = src[offset];
3966 if (!ch) return false;
3967 if (offset >= lineStart + indent) return true;
3968 if (ch !== '#' && ch !== '\n') return false;
3969 return Collection$1.nextContentHasIndent(src, offset, indent);
3972 constructor(firstItem) {
3973 super(firstItem.type === PlainValue$5.Type.SEQ_ITEM ? PlainValue$5.Type.SEQ : PlainValue$5.Type.MAP);
3975 for (let i = firstItem.props.length - 1; i >= 0; --i) {
3976 if (firstItem.props[i].start < firstItem.context.lineStart) {
3977 // props on previous line are assumed by the collection
3978 this.props = firstItem.props.slice(0, i + 1);
3979 firstItem.props = firstItem.props.slice(i + 1);
3980 const itemRange = firstItem.props[0] || firstItem.valueRange;
3981 firstItem.range.start = itemRange.start;
3986 this.items = [firstItem];
3987 const ec = grabCollectionEndComments(firstItem);
3988 if (ec) Array.prototype.push.apply(this.items, ec);
3991 get includesTrailingLines() {
3992 return this.items.length > 0;
3995 * @param {ParseContext} context
3996 * @param {number} start - Index of first character
3997 * @returns {number} - Index of the character after this
4001 parse(context, start) {
4002 this.context = context;
4006 } = context; // It's easier to recalculate lineStart here rather than tracking down the
4007 // last context from which to read it -- eemeli/yaml#2
4009 let lineStart = PlainValue$5.Node.startOfLine(src, start);
4010 const firstItem = this.items[0]; // First-item context needs to be correct for later comment handling
4011 // -- eemeli/yaml#17
4013 firstItem.context.parent = this;
4014 this.valueRange = PlainValue$5.Range.copy(firstItem.valueRange);
4015 const indent = firstItem.range.start - firstItem.context.lineStart;
4017 offset = PlainValue$5.Node.normalizeOffset(src, offset);
4018 let ch = src[offset];
4019 let atLineStart = PlainValue$5.Node.endOfWhiteSpace(src, lineStart) === offset;
4020 let prevIncludesTrailingLines = false;
4023 while (ch === '\n' || ch === '#') {
4024 if (atLineStart && ch === '\n' && !prevIncludesTrailingLines) {
4025 const blankLine = new BlankLine();
4026 offset = blankLine.parse({
4029 this.valueRange.end = offset;
4031 if (offset >= src.length) {
4036 this.items.push(blankLine);
4037 offset -= 1; // blankLine.parse() consumes terminal newline
4038 } else if (ch === '#') {
4039 if (offset < lineStart + indent && !Collection$1.nextContentHasIndent(src, offset, indent)) {
4043 const comment = new Comment();
4044 offset = comment.parse({
4049 this.items.push(comment);
4050 this.valueRange.end = offset;
4052 if (offset >= src.length) {
4058 lineStart = offset + 1;
4059 offset = PlainValue$5.Node.endOfIndent(src, lineStart);
4061 if (PlainValue$5.Node.atBlank(src, offset)) {
4062 const wsEnd = PlainValue$5.Node.endOfWhiteSpace(src, offset);
4063 const next = src[wsEnd];
4065 if (!next || next === '\n' || next === '#') {
4078 if (offset !== lineStart + indent && (atLineStart || ch !== ':')) {
4079 if (offset < lineStart + indent) {
4080 if (lineStart > start) offset = lineStart;
4082 } else if (!this.error) {
4083 const msg = 'All collection items must start at the same column';
4084 this.error = new PlainValue$5.YAMLSyntaxError(this, msg);
4088 if (firstItem.type === PlainValue$5.Type.SEQ_ITEM) {
4090 if (lineStart > start) offset = lineStart;
4093 } else if (ch === '-' && !this.error) {
4094 // map key may start with -, as long as it's followed by a non-whitespace char
4095 const next = src[offset + 1];
4097 if (!next || next === '\n' || next === '\t' || next === ' ') {
4098 const msg = 'A collection cannot be both a mapping and a sequence';
4099 this.error = new PlainValue$5.YAMLSyntaxError(this, msg);
4103 const node = parseNode({
4110 if (!node) return offset; // at next document start
4112 this.items.push(node);
4113 this.valueRange.end = node.valueRange.end;
4114 offset = PlainValue$5.Node.normalizeOffset(src, node.range.end);
4116 atLineStart = false;
4117 prevIncludesTrailingLines = node.includesTrailingLines; // Need to reset lineStart and atLineStart here if preceding node's range
4118 // has advanced to check the current line's indentation level
4119 // -- eemeli/yaml#10 & eemeli/yaml#38
4122 let ls = offset - 1;
4125 while (prev === ' ' || prev === '\t') prev = src[--ls];
4127 if (prev === '\n') {
4133 const ec = grabCollectionEndComments(node);
4134 if (ec) Array.prototype.push.apply(this.items, ec);
4140 setOrigRanges(cr, offset) {
4141 offset = super.setOrigRanges(cr, offset);
4142 this.items.forEach(node => {
4143 offset = node.setOrigRanges(cr, offset);
4157 if (value != null) return value;
4158 let str = src.slice(range.start, items[0].range.start) + String(items[0]);
4160 for (let i = 1; i < items.length; ++i) {
4161 const item = items[i];
4166 if (atLineStart) for (let i = 0; i < indent; ++i) str += ' ';
4167 str += String(item);
4170 return PlainValue$5.Node.addStringTerminator(src, range.end, str);
4175 class Directive extends PlainValue$5.Node {
4177 super(PlainValue$5.Type.DIRECTIVE);
4182 const raw = this.rawValue;
4183 return raw ? raw.trim().split(/[ \t]+/) : [];
4191 let ch = src[offset];
4193 while (ch && ch !== '\n' && ch !== '\t' && ch !== ' ') ch = src[offset += 1];
4195 this.name = src.slice(start, offset);
4199 parseParameters(start) {
4204 let ch = src[offset];
4206 while (ch && ch !== '\n' && ch !== '#') ch = src[offset += 1];
4208 this.valueRange = new PlainValue$5.Range(start, offset);
4212 parse(context, start) {
4213 this.context = context;
4214 let offset = this.parseName(start + 1);
4215 offset = this.parseParameters(offset);
4216 offset = this.parseComment(offset);
4217 this.range = new PlainValue$5.Range(start, offset);
4223 class Document$3 extends PlainValue$5.Node {
4224 static startCommentOrEndBlankLine(src, start) {
4225 const offset = PlainValue$5.Node.endOfWhiteSpace(src, start);
4226 const ch = src[offset];
4227 return ch === '#' || ch === '\n' ? offset : start;
4231 super(PlainValue$5.Type.DOCUMENT);
4232 this.directives = null;
4233 this.contents = null;
4234 this.directivesEndMarker = null;
4235 this.documentEndMarker = null;
4238 parseDirectives(start) {
4242 this.directives = [];
4243 let atLineStart = true;
4244 let hasDirectives = false;
4247 while (!PlainValue$5.Node.atDocumentBoundary(src, offset, PlainValue$5.Char.DIRECTIVES_END)) {
4248 offset = Document$3.startCommentOrEndBlankLine(src, offset);
4250 switch (src[offset]) {
4253 const blankLine = new BlankLine();
4254 offset = blankLine.parse({
4258 if (offset < src.length) {
4259 this.directives.push(blankLine);
4270 const comment = new Comment();
4271 offset = comment.parse({
4274 this.directives.push(comment);
4275 atLineStart = false;
4281 const directive = new Directive();
4282 offset = directive.parse({
4286 this.directives.push(directive);
4287 hasDirectives = true;
4288 atLineStart = false;
4293 if (hasDirectives) {
4294 this.error = new PlainValue$5.YAMLSemanticError(this, 'Missing directives-end indicator line');
4295 } else if (this.directives.length > 0) {
4296 this.contents = this.directives;
4297 this.directives = [];
4305 this.directivesEndMarker = new PlainValue$5.Range(offset, offset + 3);
4309 if (hasDirectives) {
4310 this.error = new PlainValue$5.YAMLSemanticError(this, 'Missing directives-end indicator line');
4311 } else if (this.directives.length > 0) {
4312 this.contents = this.directives;
4313 this.directives = [];
4319 parseContents(start) {
4324 if (!this.contents) this.contents = [];
4325 let lineStart = start;
4327 while (src[lineStart - 1] === '-') lineStart -= 1;
4329 let offset = PlainValue$5.Node.endOfWhiteSpace(src, start);
4330 let atLineStart = lineStart === start;
4331 this.valueRange = new PlainValue$5.Range(offset);
4333 while (!PlainValue$5.Node.atDocumentBoundary(src, offset, PlainValue$5.Char.DOCUMENT_END)) {
4334 switch (src[offset]) {
4337 const blankLine = new BlankLine();
4338 offset = blankLine.parse({
4342 if (offset < src.length) {
4343 this.contents.push(blankLine);
4355 const comment = new Comment();
4356 offset = comment.parse({
4359 this.contents.push(comment);
4360 atLineStart = false;
4366 const iEnd = PlainValue$5.Node.endOfIndent(src, offset);
4371 inCollection: false,
4375 const node = parseNode(context, iEnd);
4376 if (!node) return this.valueRange.end = iEnd; // at next document start
4378 this.contents.push(node);
4379 offset = node.range.end;
4380 atLineStart = false;
4381 const ec = grabCollectionEndComments(node);
4382 if (ec) Array.prototype.push.apply(this.contents, ec);
4386 offset = Document$3.startCommentOrEndBlankLine(src, offset);
4389 this.valueRange.end = offset;
4392 this.documentEndMarker = new PlainValue$5.Range(offset, offset + 3);
4396 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
4398 if (src[offset] === '#') {
4399 const comment = new Comment();
4400 offset = comment.parse({
4403 this.contents.push(comment);
4406 switch (src[offset]) {
4415 this.error = new PlainValue$5.YAMLSyntaxError(this, 'Document end marker line cannot have a non-comment suffix');
4423 * @param {ParseContext} context
4424 * @param {number} start - Index of first character
4425 * @returns {number} - Index of the character after this
4429 parse(context, start) {
4430 context.root = this;
4431 this.context = context;
4435 let offset = src.charCodeAt(start) === 0xfeff ? start + 1 : start; // skip BOM
4437 offset = this.parseDirectives(offset);
4438 offset = this.parseContents(offset);
4442 setOrigRanges(cr, offset) {
4443 offset = super.setOrigRanges(cr, offset);
4444 this.directives.forEach(node => {
4445 offset = node.setOrigRanges(cr, offset);
4447 if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset);
4448 this.contents.forEach(node => {
4449 offset = node.setOrigRanges(cr, offset);
4451 if (this.documentEndMarker) offset = this.documentEndMarker.setOrigRange(cr, offset);
4461 if (value != null) return value;
4462 let str = directives.join('');
4464 if (contents.length > 0) {
4465 if (directives.length > 0 || contents[0].type === PlainValue$5.Type.COMMENT) str += '---\n';
4466 str += contents.join('');
4469 if (str[str.length - 1] !== '\n') str += '\n';
4475 class Alias$1 extends PlainValue$5.Node {
4477 * Parses an *alias from the source
4479 * @param {ParseContext} context
4480 * @param {number} start - Index of first character
4481 * @returns {number} - Index of the character after this scalar
4483 parse(context, start) {
4484 this.context = context;
4488 let offset = PlainValue$5.Node.endOfIdentifier(src, start + 1);
4489 this.valueRange = new PlainValue$5.Range(start + 1, offset);
4490 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
4491 offset = this.parseComment(offset);
4503 class BlockValue extends PlainValue$5.Node {
4504 constructor(type, props) {
4506 this.blockIndent = null;
4507 this.chomping = Chomp.CLIP;
4511 get includesTrailingLines() {
4512 return this.chomping === Chomp.KEEP;
4516 if (!this.valueRange || !this.context) return null;
4520 } = this.valueRange;
4525 if (this.valueRange.isEmpty()) return '';
4526 let lastNewLine = null;
4527 let ch = src[end - 1];
4529 while (ch === '\n' || ch === '\t' || ch === ' ') {
4533 if (this.chomping === Chomp.KEEP) break;else return ''; // probably never happens
4536 if (ch === '\n') lastNewLine = end;
4540 let keepStart = end + 1;
4543 if (this.chomping === Chomp.KEEP) {
4544 keepStart = lastNewLine;
4545 end = this.valueRange.end;
4551 const bi = indent + this.blockIndent;
4552 const folded = this.type === PlainValue$5.Type.BLOCK_FOLDED;
4556 let prevMoreIndented = false;
4558 for (let i = start; i < end; ++i) {
4559 for (let j = 0; j < bi; ++j) {
4560 if (src[i] !== ' ') break;
4567 if (sep === '\n') str += '\n';else sep = '\n';
4569 const lineEnd = PlainValue$5.Node.endOfLine(src, i);
4570 const line = src.slice(i, lineEnd);
4573 if (folded && (ch === ' ' || ch === '\t') && i < keepStart) {
4574 if (sep === ' ') sep = '\n';else if (!prevMoreIndented && !atStart && sep === '\n') sep = '\n\n';
4575 str += sep + line; //+ ((lineEnd < end && src[lineEnd]) || '')
4577 sep = lineEnd < end && src[lineEnd] || '';
4578 prevMoreIndented = true;
4581 sep = folded && i < keepStart ? ' ' : '\n';
4582 prevMoreIndented = false;
4585 if (atStart && line !== '') atStart = false;
4589 return this.chomping === Chomp.STRIP ? str : str + '\n';
4592 parseBlockHeader(start) {
4596 let offset = start + 1;
4600 const ch = src[offset];
4604 this.chomping = Chomp.STRIP;
4608 this.chomping = Chomp.KEEP;
4625 this.blockIndent = Number(bi) || null;
4626 this.header = new PlainValue$5.Range(start, offset);
4634 parseBlockValue(start) {
4639 const explicit = !!this.blockIndent;
4641 let valueEnd = start;
4642 let minBlockIndent = 1;
4644 for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
4646 if (PlainValue$5.Node.atDocumentBoundary(src, offset)) break;
4647 const end = PlainValue$5.Node.endOfBlockIndent(src, indent, offset); // should not include tab?
4649 if (end === null) break;
4650 const ch = src[end];
4651 const lineIndent = end - (offset + indent);
4653 if (!this.blockIndent) {
4654 // no explicit block indent, none yet detected
4655 if (src[end] !== '\n') {
4656 // first line with non-whitespace content
4657 if (lineIndent < minBlockIndent) {
4658 const msg = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator';
4659 this.error = new PlainValue$5.YAMLSemanticError(this, msg);
4662 this.blockIndent = lineIndent;
4663 } else if (lineIndent > minBlockIndent) {
4664 // empty line with more whitespace
4665 minBlockIndent = lineIndent;
4667 } else if (ch && ch !== '\n' && lineIndent < this.blockIndent) {
4668 if (src[end] === '#') break;
4671 const src = explicit ? 'explicit indentation indicator' : 'first line';
4672 const msg = `Block scalars must not be less indented than their ${src}`;
4673 this.error = new PlainValue$5.YAMLSemanticError(this, msg);
4677 if (src[end] === '\n') {
4680 offset = valueEnd = PlainValue$5.Node.endOfLine(src, end);
4684 if (this.chomping !== Chomp.KEEP) {
4685 offset = src[valueEnd] ? valueEnd + 1 : valueEnd;
4688 this.valueRange = new PlainValue$5.Range(start + 1, offset);
4692 * Parses a block value from the source
4694 * Accepted forms are:
4704 * where the block style BS matches the regexp `[|>][-+1-9]*` and block lines
4705 * are empty or have an indent level greater than `indent`.
4707 * @param {ParseContext} context
4708 * @param {number} start - Index of first character
4709 * @returns {number} - Index of the character after this block
4713 parse(context, start) {
4714 this.context = context;
4718 let offset = this.parseBlockHeader(start);
4719 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
4720 offset = this.parseComment(offset);
4721 offset = this.parseBlockValue(offset);
4725 setOrigRanges(cr, offset) {
4726 offset = super.setOrigRanges(cr, offset);
4727 return this.header ? this.header.setOrigRange(cr, offset) : offset;
4732 class FlowCollection extends PlainValue$5.Node {
4733 constructor(type, props) {
4738 prevNodeIsJsonLike(idx = this.items.length) {
4739 const node = this.items[idx - 1];
4740 return !!node && (node.jsonLike || node.type === PlainValue$5.Type.COMMENT && this.prevNodeIsJsonLike(idx - 1));
4743 * @param {ParseContext} context
4744 * @param {number} start - Index of first character
4745 * @returns {number} - Index of the character after this
4749 parse(context, start) {
4750 this.context = context;
4759 let char = src[start]; // { or [
4765 let offset = PlainValue$5.Node.endOfWhiteSpace(src, start + 1);
4768 while (char && char !== ']' && char !== '}') {
4772 lineStart = offset + 1;
4773 const wsEnd = PlainValue$5.Node.endOfWhiteSpace(src, lineStart);
4775 if (src[wsEnd] === '\n') {
4776 const blankLine = new BlankLine();
4777 lineStart = blankLine.parse({
4780 this.items.push(blankLine);
4783 offset = PlainValue$5.Node.endOfIndent(src, lineStart);
4785 if (offset <= lineStart + indent) {
4788 if (offset < lineStart + indent || char !== ']' && char !== '}') {
4789 const msg = 'Insufficient indentation in flow collection';
4790 this.error = new PlainValue$5.YAMLSemanticError(this, msg);
4808 const comment = new Comment();
4809 offset = comment.parse({
4812 this.items.push(comment);
4819 const next = src[offset + 1];
4821 if (next === '\n' || next === '\t' || next === ' ' || next === ',' || // in-flow : after JSON-like key does not need to be followed by whitespace
4822 char === ':' && this.prevNodeIsJsonLike()) {
4835 const node = parseNode({
4837 inCollection: false,
4845 // at next document start
4846 this.valueRange = new PlainValue$5.Range(start, offset);
4850 this.items.push(node);
4851 offset = PlainValue$5.Node.normalizeOffset(src, node.range.end);
4855 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
4859 this.valueRange = new PlainValue$5.Range(start, offset + 1);
4866 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset + 1);
4867 offset = this.parseComment(offset);
4873 setOrigRanges(cr, offset) {
4874 offset = super.setOrigRanges(cr, offset);
4875 this.items.forEach(node => {
4876 if (node instanceof PlainValue$5.Node) {
4877 offset = node.setOrigRanges(cr, offset);
4878 } else if (cr.length === 0) {
4879 node.origOffset = node.offset;
4883 while (i < cr.length) {
4884 if (cr[i] > node.offset) break;else ++i;
4887 node.origOffset = node.offset + i;
4903 if (value != null) return value;
4904 const nodes = items.filter(item => item instanceof PlainValue$5.Node);
4906 let prevEnd = range.start;
4907 nodes.forEach(node => {
4908 const prefix = src.slice(prevEnd, node.range.start);
4909 prevEnd = node.range.end;
4910 str += prefix + String(node);
4912 if (str[str.length - 1] === '\n' && src[prevEnd - 1] !== '\n' && src[prevEnd] === '\n') {
4913 // Comment range does not include the terminal newline, but its
4914 // stringified value does. Without this fix, newlines at comment ends
4919 str += src.slice(prevEnd, range.end);
4920 return PlainValue$5.Node.addStringTerminator(src, range.end, str);
4925 class QuoteDouble extends PlainValue$5.Node {
4926 static endOfQuote(src, offset) {
4927 let ch = src[offset];
4929 while (ch && ch !== '"') {
4930 offset += ch === '\\' ? 2 : 1;
4937 * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
4942 if (!this.valueRange || !this.context) return null;
4947 } = this.valueRange;
4952 if (src[end - 1] !== '"') errors.push(new PlainValue$5.YAMLSyntaxError(this, 'Missing closing "quote')); // Using String#replace is too painful with escaped newlines preceded by
4953 // escaped backslashes; also, this should be faster.
4957 for (let i = start + 1; i < end - 1; ++i) {
4961 if (PlainValue$5.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue$5.YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values'));
4966 } = PlainValue$5.Node.foldNewline(src, i, indent);
4969 if (error) errors.push(new PlainValue$5.YAMLSemanticError(this, 'Multi-line double-quoted string needs to be sufficiently indented'));
4970 } else if (ch === '\\') {
5022 // Unicode next line
5027 // Unicode non-breaking space
5032 // Unicode line separator
5037 // Unicode paragraph separator
5060 str += this.parseCharCode(i + 1, 2, errors);
5065 str += this.parseCharCode(i + 1, 4, errors);
5070 str += this.parseCharCode(i + 1, 8, errors);
5075 // skip escaped newlines, but still trim the following line
5076 while (src[i + 1] === ' ' || src[i + 1] === '\t') i += 1;
5081 errors.push(new PlainValue$5.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`));
5082 str += '\\' + src[i];
5084 } else if (ch === ' ' || ch === '\t') {
5085 // trim trailing whitespace
5087 let next = src[i + 1];
5089 while (next === ' ' || next === '\t') {
5094 if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
5100 return errors.length > 0 ? {
5106 parseCharCode(offset, length, errors) {
5110 const cc = src.substr(offset, length);
5111 const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
5112 const code = ok ? parseInt(cc, 16) : NaN;
5115 errors.push(new PlainValue$5.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`));
5116 return src.substr(offset - 2, length + 2);
5119 return String.fromCodePoint(code);
5122 * Parses a "double quoted" value from the source
5124 * @param {ParseContext} context
5125 * @param {number} start - Index of first character
5126 * @returns {number} - Index of the character after this scalar
5130 parse(context, start) {
5131 this.context = context;
5135 let offset = QuoteDouble.endOfQuote(src, start + 1);
5136 this.valueRange = new PlainValue$5.Range(start, offset);
5137 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
5138 offset = this.parseComment(offset);
5144 class QuoteSingle extends PlainValue$5.Node {
5145 static endOfQuote(src, offset) {
5146 let ch = src[offset];
5150 if (src[offset + 1] !== "'") break;
5151 ch = src[offset += 2];
5153 ch = src[offset += 1];
5160 * @returns {string | { str: string, errors: YAMLSyntaxError[] }}
5165 if (!this.valueRange || !this.context) return null;
5170 } = this.valueRange;
5175 if (src[end - 1] !== "'") errors.push(new PlainValue$5.YAMLSyntaxError(this, "Missing closing 'quote"));
5178 for (let i = start + 1; i < end - 1; ++i) {
5182 if (PlainValue$5.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue$5.YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values'));
5187 } = PlainValue$5.Node.foldNewline(src, i, indent);
5190 if (error) errors.push(new PlainValue$5.YAMLSemanticError(this, 'Multi-line single-quoted string needs to be sufficiently indented'));
5191 } else if (ch === "'") {
5194 if (src[i] !== "'") errors.push(new PlainValue$5.YAMLSyntaxError(this, 'Unescaped single quote? This should not happen.'));
5195 } else if (ch === ' ' || ch === '\t') {
5196 // trim trailing whitespace
5198 let next = src[i + 1];
5200 while (next === ' ' || next === '\t') {
5205 if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
5211 return errors.length > 0 ? {
5217 * Parses a 'single quoted' value from the source
5219 * @param {ParseContext} context
5220 * @param {number} start - Index of first character
5221 * @returns {number} - Index of the character after this scalar
5225 parse(context, start) {
5226 this.context = context;
5230 let offset = QuoteSingle.endOfQuote(src, start + 1);
5231 this.valueRange = new PlainValue$5.Range(start, offset);
5232 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
5233 offset = this.parseComment(offset);
5239 function createNewNode(type, props) {
5241 case PlainValue$5.Type.ALIAS:
5242 return new Alias$1(type, props);
5244 case PlainValue$5.Type.BLOCK_FOLDED:
5245 case PlainValue$5.Type.BLOCK_LITERAL:
5246 return new BlockValue(type, props);
5248 case PlainValue$5.Type.FLOW_MAP:
5249 case PlainValue$5.Type.FLOW_SEQ:
5250 return new FlowCollection(type, props);
5252 case PlainValue$5.Type.MAP_KEY:
5253 case PlainValue$5.Type.MAP_VALUE:
5254 case PlainValue$5.Type.SEQ_ITEM:
5255 return new CollectionItem(type, props);
5257 case PlainValue$5.Type.COMMENT:
5258 case PlainValue$5.Type.PLAIN:
5259 return new PlainValue$5.PlainValue(type, props);
5261 case PlainValue$5.Type.QUOTE_DOUBLE:
5262 return new QuoteDouble(type, props);
5264 case PlainValue$5.Type.QUOTE_SINGLE:
5265 return new QuoteSingle(type, props);
5267 /* istanbul ignore next */
5271 // should never happen
5275 * @param {boolean} atLineStart - Node starts at beginning of line
5276 * @param {boolean} inFlow - true if currently in a flow context
5277 * @param {boolean} inCollection - true if currently in a collection context
5278 * @param {number} indent - Current level of indentation
5279 * @param {number} lineStart - Start of the current line
5280 * @param {Node} parent - The parent of the node
5281 * @param {string} src - Source of the YAML document
5285 class ParseContext {
5286 static parseType(src, offset, inFlow) {
5287 switch (src[offset]) {
5289 return PlainValue$5.Type.ALIAS;
5292 return PlainValue$5.Type.BLOCK_FOLDED;
5295 return PlainValue$5.Type.BLOCK_LITERAL;
5298 return PlainValue$5.Type.FLOW_MAP;
5301 return PlainValue$5.Type.FLOW_SEQ;
5304 return !inFlow && PlainValue$5.Node.atBlank(src, offset + 1, true) ? PlainValue$5.Type.MAP_KEY : PlainValue$5.Type.PLAIN;
5307 return !inFlow && PlainValue$5.Node.atBlank(src, offset + 1, true) ? PlainValue$5.Type.MAP_VALUE : PlainValue$5.Type.PLAIN;
5310 return !inFlow && PlainValue$5.Node.atBlank(src, offset + 1, true) ? PlainValue$5.Type.SEQ_ITEM : PlainValue$5.Type.PLAIN;
5313 return PlainValue$5.Type.QUOTE_DOUBLE;
5316 return PlainValue$5.Type.QUOTE_SINGLE;
5319 return PlainValue$5.Type.PLAIN;
5323 constructor(orig = {}, {
5331 PlainValue$5._defineProperty(this, "parseNode", (overlay, start) => {
5332 if (PlainValue$5.Node.atDocumentBoundary(this.src, start)) return null;
5333 const context = new ParseContext(this, overlay);
5338 } = context.parseProps(start);
5339 const node = createNewNode(type, props);
5340 let offset = node.parse(context, valueStart);
5341 node.range = new PlainValue$5.Range(start, offset);
5342 /* istanbul ignore if */
5344 if (offset <= start) {
5345 // This should never happen, but if it does, let's make sure to at least
5346 // step one character forward to avoid a busy loop.
5347 node.error = new Error(`Node#parse consumed no characters`);
5348 node.error.parseEnd = offset;
5349 node.error.source = node;
5350 node.range.end = start + 1;
5353 if (context.nodeStartsCollection(node)) {
5354 if (!node.error && !context.atLineStart && context.parent.type === PlainValue$5.Type.DOCUMENT) {
5355 node.error = new PlainValue$5.YAMLSyntaxError(node, 'Block collection must not have preceding content here (e.g. directives-end indicator)');
5358 const collection = new Collection$1(node);
5359 offset = collection.parse(new ParseContext(context), offset);
5360 collection.range = new PlainValue$5.Range(start, offset);
5367 this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false;
5368 this.inCollection = inCollection != null ? inCollection : orig.inCollection || false;
5369 this.inFlow = inFlow != null ? inFlow : orig.inFlow || false;
5370 this.indent = indent != null ? indent : orig.indent;
5371 this.lineStart = lineStart != null ? lineStart : orig.lineStart;
5372 this.parent = parent != null ? parent : orig.parent || {};
5373 this.root = orig.root;
5374 this.src = orig.src;
5377 nodeStartsCollection(node) {
5383 if (inCollection || inFlow) return false;
5384 if (node instanceof CollectionItem) return true; // check for implicit key
5386 let offset = node.range.end;
5387 if (src[offset] === '\n' || src[offset - 1] === '\n') return false;
5388 offset = PlainValue$5.Node.endOfWhiteSpace(src, offset);
5389 return src[offset] === ':';
5390 } // Anchor and tag are before type, which determines the node implementation
5391 // class; hence this intermediate step.
5394 parseProps(offset) {
5401 let lineHasProps = false;
5402 offset = this.atLineStart ? PlainValue$5.Node.endOfIndent(src, offset) : PlainValue$5.Node.endOfWhiteSpace(src, offset);
5403 let ch = src[offset];
5405 while (ch === PlainValue$5.Char.ANCHOR || ch === PlainValue$5.Char.COMMENT || ch === PlainValue$5.Char.TAG || ch === '\n') {
5411 lineStart = inEnd + 1;
5412 inEnd = PlainValue$5.Node.endOfIndent(src, lineStart);
5413 } while (src[inEnd] === '\n');
5415 const indentDiff = inEnd - (lineStart + this.indent);
5416 const noIndicatorAsIndent = parent.type === PlainValue$5.Type.SEQ_ITEM && parent.context.atLineStart;
5417 if (src[inEnd] !== '#' && !PlainValue$5.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break;
5418 this.atLineStart = true;
5419 this.lineStart = lineStart;
5420 lineHasProps = false;
5422 } else if (ch === PlainValue$5.Char.COMMENT) {
5423 const end = PlainValue$5.Node.endOfLine(src, offset + 1);
5424 props.push(new PlainValue$5.Range(offset, end));
5427 let end = PlainValue$5.Node.endOfIdentifier(src, offset + 1);
5429 if (ch === PlainValue$5.Char.TAG && src[end] === ',' && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, end + 13))) {
5430 // Let's presume we're dealing with a YAML 1.0 domain tag here, rather
5431 // than an empty but 'foo.bar' private-tagged node in a flow collection
5432 // followed without whitespace by a plain string starting with a year
5433 // or date divided by something.
5434 end = PlainValue$5.Node.endOfIdentifier(src, end + 5);
5437 props.push(new PlainValue$5.Range(offset, end));
5438 lineHasProps = true;
5439 offset = PlainValue$5.Node.endOfWhiteSpace(src, end);
5443 } // '- &a : b' has an anchor on an empty node
5446 if (lineHasProps && ch === ':' && PlainValue$5.Node.atBlank(src, offset + 1, true)) offset -= 1;
5447 const type = ParseContext.parseType(src, offset, inFlow);
5455 * Parses a node from the source
5456 * @param {ParseContext} overlay
5457 * @param {number} start - Index of first non-whitespace character for the node
5458 * @returns {?Node} - null if at a document boundary
5462 } // Published as 'yaml/parse-cst'
5465 function parse$1(src) {
5468 if (src.indexOf('\r') !== -1) {
5469 src = src.replace(/\r\n?/g, (match, offset) => {
5470 if (match.length > 1) cr.push(offset);
5475 const documents = [];
5479 const doc = new Document$3();
5480 const context = new ParseContext({
5483 offset = doc.parse(context, offset);
5484 documents.push(doc);
5485 } while (offset < src.length);
5487 documents.setOrigRanges = () => {
5488 if (cr.length === 0) return false;
5490 for (let i = 1; i < cr.length; ++i) cr[i] -= i;
5494 for (let i = 0; i < documents.length; ++i) {
5495 crOffset = documents[i].setOrigRanges(cr, crOffset);
5498 cr.splice(0, cr.length);
5502 documents.toString = () => documents.join('...\n');
5507 parseCst$1.parse = parse$1;
5509 var Document9b4560a1 = {};
5511 var resolveSeqD03cb037 = {};
5513 var PlainValue$4 = PlainValueEc8e588e;
5515 function addCommentBefore(str, indent, comment) {
5516 if (!comment) return str;
5517 const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`);
5518 return `#${cc}\n${indent}${str}`;
5521 function addComment(str, indent, comment) {
5522 return !comment ? str : comment.indexOf('\n') === -1 ? `${str} #${comment}` : `${str}\n` + comment.replace(/^/gm, `${indent || ''}#`);
5527 function toJSON(value, arg, ctx) {
5528 if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx));
5530 if (value && typeof value.toJSON === 'function') {
5531 const anchor = ctx && ctx.anchors && ctx.anchors.get(value);
5532 if (anchor) ctx.onCreate = res => {
5534 delete ctx.onCreate;
5536 const res = value.toJSON(arg, ctx);
5537 if (anchor && ctx.onCreate) ctx.onCreate(res);
5541 if ((!ctx || !ctx.keep) && typeof value === 'bigint') return Number(value);
5545 class Scalar extends Node {
5546 constructor(value) {
5552 return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx);
5556 return String(this.value);
5561 function collectionFromPath(schema, path, value) {
5564 for (let i = path.length - 1; i >= 0; --i) {
5567 if (Number.isInteger(k) && k >= 0) {
5573 Object.defineProperty(o, k, {
5583 return schema.createNode(v, false);
5584 } // null, undefined, or an empty non-string iterable (e.g. [])
5587 const isEmptyPath = path => path == null || typeof path === 'object' && path[Symbol.iterator]().next().done;
5589 class Collection extends Node {
5590 constructor(schema) {
5593 PlainValue$4._defineProperty(this, "items", []);
5595 this.schema = schema;
5598 addIn(path, value) {
5599 if (isEmptyPath(path)) this.add(value);else {
5600 const [key, ...rest] = path;
5601 const node = this.get(key, true);
5602 if (node instanceof Collection) node.addIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
5606 deleteIn([key, ...rest]) {
5607 if (rest.length === 0) return this.delete(key);
5608 const node = this.get(key, true);
5609 if (node instanceof Collection) return node.deleteIn(rest);else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
5612 getIn([key, ...rest], keepScalar) {
5613 const node = this.get(key, true);
5614 if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;else return node instanceof Collection ? node.getIn(rest, keepScalar) : undefined;
5617 hasAllNullValues() {
5618 return this.items.every(node => {
5619 if (!node || node.type !== 'PAIR') return false;
5620 const n = node.value;
5621 return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag;
5625 hasIn([key, ...rest]) {
5626 if (rest.length === 0) return this.has(key);
5627 const node = this.get(key, true);
5628 return node instanceof Collection ? node.hasIn(rest) : false;
5631 setIn([key, ...rest], value) {
5632 if (rest.length === 0) {
5633 this.set(key, value);
5635 const node = this.get(key, true);
5636 if (node instanceof Collection) node.setIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
5638 } // overridden in implementations
5640 /* istanbul ignore next */
5652 }, onComment, onChompKeep) {
5658 const inFlow = this.type === PlainValue$4.Type.FLOW_MAP || this.type === PlainValue$4.Type.FLOW_SEQ || ctx.inFlow;
5659 if (inFlow) itemIndent += indentStep;
5660 const allNullValues = isMap && this.hasAllNullValues();
5661 ctx = Object.assign({}, ctx, {
5667 let chompKeep = false;
5668 let hasItemWithNewLine = false;
5669 const nodes = this.items.reduce((nodes, item, i) => {
5673 if (!chompKeep && item.spaceBefore) nodes.push({
5677 if (item.commentBefore) item.commentBefore.match(/^.*$/gm).forEach(line => {
5683 if (item.comment) comment = item.comment;
5684 if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment))) hasItemWithNewLine = true;
5688 let str = stringify(item, ctx, () => comment = null, () => chompKeep = true);
5689 if (inFlow && !hasItemWithNewLine && str.includes('\n')) hasItemWithNewLine = true;
5690 if (inFlow && i < this.items.length - 1) str += ',';
5691 str = addComment(str, itemIndent, comment);
5692 if (chompKeep && (comment || inFlow)) chompKeep = false;
5701 if (nodes.length === 0) {
5702 str = flowChars.start + flowChars.end;
5703 } else if (inFlow) {
5708 const strings = nodes.map(n => n.str);
5710 if (hasItemWithNewLine || strings.reduce((sum, str) => sum + str.length + 2, 2) > Collection.maxFlowStringSingleLineLength) {
5713 for (const s of strings) {
5714 str += s ? `\n${indentStep}${indent}${s}` : '\n';
5717 str += `\n${indent}${end}`;
5719 str = `${start} ${strings.join(' ')} ${end}`;
5722 const strings = nodes.map(blockItem);
5723 str = strings.shift();
5725 for (const s of strings) str += s ? `\n${indent}${s}` : '\n';
5729 str += '\n' + this.comment.replace(/^/gm, `${indent}#`);
5730 if (onComment) onComment();
5731 } else if (chompKeep && onChompKeep) onChompKeep();
5738 PlainValue$4._defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
5740 function asItemIndex(key) {
5741 let idx = key instanceof Scalar ? key.value : key;
5742 if (idx && typeof idx === 'string') idx = Number(idx);
5743 return Number.isInteger(idx) && idx >= 0 ? idx : null;
5746 class YAMLSeq extends Collection {
5748 this.items.push(value);
5752 const idx = asItemIndex(key);
5753 if (typeof idx !== 'number') return false;
5754 const del = this.items.splice(idx, 1);
5755 return del.length > 0;
5758 get(key, keepScalar) {
5759 const idx = asItemIndex(key);
5760 if (typeof idx !== 'number') return undefined;
5761 const it = this.items[idx];
5762 return !keepScalar && it instanceof Scalar ? it.value : it;
5766 const idx = asItemIndex(key);
5767 return typeof idx === 'number' && idx < this.items.length;
5771 const idx = asItemIndex(key);
5772 if (typeof idx !== 'number') throw new Error(`Expected a valid index, not ${key}.`);
5773 this.items[idx] = value;
5778 if (ctx && ctx.onCreate) ctx.onCreate(seq);
5781 for (const item of this.items) seq.push(toJSON(item, String(i++), ctx));
5786 toString(ctx, onComment, onChompKeep) {
5787 if (!ctx) return JSON.stringify(this);
5788 return super.toString(ctx, {
5789 blockItem: n => n.type === 'comment' ? n.str : `- ${n.str}`,
5795 itemIndent: (ctx.indent || '') + ' '
5796 }, onComment, onChompKeep);
5801 const stringifyKey = (key, jsKey, ctx) => {
5802 if (jsKey === null) return '';
5803 if (typeof jsKey !== 'object') return String(jsKey);
5804 if (key instanceof Node && ctx && ctx.doc) return key.toString({
5805 anchors: Object.create(null),
5808 indentStep: ctx.indentStep,
5810 inStringifyKey: true,
5811 stringify: ctx.stringify
5813 return JSON.stringify(jsKey);
5816 class Pair extends Node {
5817 constructor(key, value = null) {
5821 this.type = Pair.Type.PAIR;
5824 get commentBefore() {
5825 return this.key instanceof Node ? this.key.commentBefore : undefined;
5828 set commentBefore(cb) {
5829 if (this.key == null) this.key = new Scalar(null);
5830 if (this.key instanceof Node) this.key.commentBefore = cb;else {
5831 const msg = 'Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.';
5832 throw new Error(msg);
5836 addToJSMap(ctx, map) {
5837 const key = toJSON(this.key, '', ctx);
5839 if (map instanceof Map) {
5840 const value = toJSON(this.value, key, ctx);
5841 map.set(key, value);
5842 } else if (map instanceof Set) {
5845 const stringKey = stringifyKey(this.key, key, ctx);
5846 const value = toJSON(this.value, stringKey, ctx);
5847 if (stringKey in map) Object.defineProperty(map, stringKey, {
5852 });else map[stringKey] = value;
5859 const pair = ctx && ctx.mapAsMap ? new Map() : {};
5860 return this.addToJSMap(ctx, pair);
5863 toString(ctx, onComment, onChompKeep) {
5864 if (!ctx || !ctx.doc) return JSON.stringify(this);
5869 } = ctx.doc.options;
5874 let keyComment = key instanceof Node && key.comment;
5878 throw new Error('With simple keys, key nodes cannot have comments');
5881 if (key instanceof Collection) {
5882 const msg = 'With simple keys, collection cannot be used as a key value';
5883 throw new Error(msg);
5887 let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValue$4.Type.BLOCK_FOLDED || key.type === PlainValue$4.Type.BLOCK_LITERAL : typeof key === 'object'));
5894 ctx = Object.assign({}, ctx, {
5895 implicitKey: !explicitKey,
5896 indent: indent + indentStep
5898 let chompKeep = false;
5899 let str = stringify(key, ctx, () => keyComment = null, () => chompKeep = true);
5900 str = addComment(str, ctx.indent, keyComment);
5902 if (!explicitKey && str.length > 1024) {
5903 if (simpleKeys) throw new Error('With simple keys, single line scalar must not span more than 1024 characters');
5907 if (ctx.allNullValues && !simpleKeys) {
5909 str = addComment(str, ctx.indent, this.comment);
5910 if (onComment) onComment();
5911 } else if (chompKeep && !keyComment && onChompKeep) onChompKeep();
5913 return ctx.inFlow && !explicitKey ? str : `? ${str}`;
5916 str = explicitKey ? `? ${str}\n${indent}:` : `${str}:`;
5919 // expected (but not strictly required) to be a single-line comment
5920 str = addComment(str, ctx.indent, this.comment);
5921 if (onComment) onComment();
5925 let valueComment = null;
5927 if (value instanceof Node) {
5928 if (value.spaceBefore) vcb = '\n';
5930 if (value.commentBefore) {
5931 const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`);
5935 valueComment = value.comment;
5936 } else if (value && typeof value === 'object') {
5937 value = doc.schema.createNode(value, true);
5940 ctx.implicitKey = false;
5941 if (!explicitKey && !this.comment && value instanceof Scalar) ctx.indentAtStart = str.length + 1;
5944 if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== PlainValue$4.Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) {
5945 // If indentSeq === false, consider '- ' as part of indentation where possible
5946 ctx.indent = ctx.indent.substr(2);
5949 const valueStr = stringify(value, ctx, () => valueComment = null, () => chompKeep = true);
5952 if (vcb || this.comment) {
5953 ws = `${vcb}\n${ctx.indent}`;
5954 } else if (!explicitKey && value instanceof Collection) {
5955 const flow = valueStr[0] === '[' || valueStr[0] === '{';
5956 if (!flow || valueStr.includes('\n')) ws = `\n${ctx.indent}`;
5957 } else if (valueStr[0] === '\n') ws = '';
5959 if (chompKeep && !valueComment && onChompKeep) onChompKeep();
5960 return addComment(str + ws + valueStr, ctx.indent, valueComment);
5965 PlainValue$4._defineProperty(Pair, "Type", {
5967 MERGE_PAIR: 'MERGE_PAIR'
5970 const getAliasCount = (node, anchors) => {
5971 if (node instanceof Alias) {
5972 const anchor = anchors.get(node.source);
5973 return anchor.count * anchor.aliasCount;
5974 } else if (node instanceof Collection) {
5977 for (const item of node.items) {
5978 const c = getAliasCount(item, anchors);
5979 if (c > count) count = c;
5983 } else if (node instanceof Pair) {
5984 const kc = getAliasCount(node.key, anchors);
5985 const vc = getAliasCount(node.value, anchors);
5986 return Math.max(kc, vc);
5992 class Alias extends Node {
6002 let anchor = Object.keys(anchors).find(a => anchors[a] === source);
6003 if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName();
6004 if (anchor) return `*${anchor}${implicitKey ? ' ' : ''}`;
6005 const msg = doc.anchors.getName(source) ? 'Alias node must be after source node' : 'Source node not found for alias node';
6006 throw new Error(`${msg} [${range}]`);
6009 constructor(source) {
6011 this.source = source;
6012 this.type = PlainValue$4.Type.ALIAS;
6016 throw new Error('Alias nodes cannot have tags');
6020 if (!ctx) return toJSON(this.source, arg, ctx);
6025 const anchor = anchors.get(this.source);
6026 /* istanbul ignore if */
6028 if (!anchor || anchor.res === undefined) {
6029 const msg = 'This should not happen: Alias anchor was not resolved?';
6030 if (this.cstNode) throw new PlainValue$4.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg);
6033 if (maxAliasCount >= 0) {
6035 if (anchor.aliasCount === 0) anchor.aliasCount = getAliasCount(this.source, anchors);
6037 if (anchor.count * anchor.aliasCount > maxAliasCount) {
6038 const msg = 'Excessive alias count indicates a resource exhaustion attack';
6039 if (this.cstNode) throw new PlainValue$4.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg);
6044 } // Only called when stringifying an alias mapping key while constructing
6049 return Alias.stringify(this, ctx);
6054 PlainValue$4._defineProperty(Alias, "default", true);
6056 function findPair(items, key) {
6057 const k = key instanceof Scalar ? key.value : key;
6059 for (const it of items) {
6060 if (it instanceof Pair) {
6061 if (it.key === key || it.key === k) return it;
6062 if (it.key && it.key.value === k) return it;
6069 class YAMLMap extends Collection {
6070 add(pair, overwrite) {
6071 if (!pair) pair = new Pair(pair);else if (!(pair instanceof Pair)) pair = new Pair(pair.key || pair, pair.value);
6072 const prev = findPair(this.items, pair.key);
6073 const sortEntries = this.schema && this.schema.sortMapEntries;
6076 if (overwrite) prev.value = pair.value;else throw new Error(`Key ${pair.key} already set`);
6077 } else if (sortEntries) {
6078 const i = this.items.findIndex(item => sortEntries(pair, item) < 0);
6079 if (i === -1) this.items.push(pair);else this.items.splice(i, 0, pair);
6081 this.items.push(pair);
6086 const it = findPair(this.items, key);
6087 if (!it) return false;
6088 const del = this.items.splice(this.items.indexOf(it), 1);
6089 return del.length > 0;
6092 get(key, keepScalar) {
6093 const it = findPair(this.items, key);
6094 const node = it && it.value;
6095 return !keepScalar && node instanceof Scalar ? node.value : node;
6099 return !!findPair(this.items, key);
6103 this.add(new Pair(key, value), true);
6106 * @param {*} arg ignored
6107 * @param {*} ctx Conversion context, originally set in Document#toJSON()
6108 * @param {Class} Type If set, forces the returned collection type
6109 * @returns {*} Instance of Type, Map, or Object
6113 toJSON(_, ctx, Type) {
6114 const map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {};
6115 if (ctx && ctx.onCreate) ctx.onCreate(map);
6117 for (const item of this.items) item.addToJSMap(ctx, map);
6122 toString(ctx, onComment, onChompKeep) {
6123 if (!ctx) return JSON.stringify(this);
6125 for (const item of this.items) {
6126 if (!(item instanceof Pair)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
6129 return super.toString(ctx, {
6130 blockItem: n => n.str,
6136 itemIndent: ctx.indent || ''
6137 }, onComment, onChompKeep);
6142 const MERGE_KEY = '<<';
6144 class Merge extends Pair {
6146 if (pair instanceof Pair) {
6147 let seq = pair.value;
6149 if (!(seq instanceof YAMLSeq)) {
6150 seq = new YAMLSeq();
6151 seq.items.push(pair.value);
6152 seq.range = pair.value.range;
6155 super(pair.key, seq);
6156 this.range = pair.range;
6158 super(new Scalar(MERGE_KEY), new YAMLSeq());
6161 this.type = Pair.Type.MERGE_PAIR;
6162 } // If the value associated with a merge key is a single mapping node, each of
6163 // its key/value pairs is inserted into the current mapping, unless the key
6164 // already exists in it. If the value associated with the merge key is a
6165 // sequence, then this sequence is expected to contain mapping nodes and each
6166 // of these nodes is merged in turn according to its order in the sequence.
6167 // Keys in mapping nodes earlier in the sequence override keys specified in
6168 // later mapping nodes. -- http://yaml.org/type/merge.html
6171 addToJSMap(ctx, map) {
6174 } of this.value.items) {
6175 if (!(source instanceof YAMLMap)) throw new Error('Merge sources must be maps');
6176 const srcMap = source.toJSON(null, ctx, Map);
6178 for (const [key, value] of srcMap) {
6179 if (map instanceof Map) {
6180 if (!map.has(key)) map.set(key, value);
6181 } else if (map instanceof Set) {
6183 } else if (!Object.prototype.hasOwnProperty.call(map, key)) {
6184 Object.defineProperty(map, key, {
6197 toString(ctx, onComment) {
6198 const seq = this.value;
6199 if (seq.items.length > 1) return super.toString(ctx, onComment);
6200 this.value = seq.items[0];
6201 const str = super.toString(ctx, onComment);
6208 const binaryOptions = {
6209 defaultType: PlainValue$4.Type.BLOCK_LITERAL,
6212 const boolOptions = {
6216 const intOptions = {
6219 const nullOptions = {
6222 const strOptions = {
6223 defaultType: PlainValue$4.Type.PLAIN,
6225 jsonEncoding: false,
6226 minMultiLineLength: 40
6234 function resolveScalar(str, tags, scalarFallback) {
6241 const match = str.match(test);
6244 let res = resolve.apply(null, match);
6245 if (!(res instanceof Scalar)) res = new Scalar(res);
6246 if (format) res.format = format;
6252 if (scalarFallback) str = scalarFallback(str);
6253 return new Scalar(str);
6256 const FOLD_FLOW = 'flow';
6257 const FOLD_BLOCK = 'block';
6258 const FOLD_QUOTED = 'quoted'; // presumes i+1 is at the start of a line
6259 // returns index of last newline in more-indented block
6261 const consumeMoreIndentedLines = (text, i) => {
6262 let ch = text[i + 1];
6264 while (ch === ' ' || ch === '\t') {
6267 } while (ch && ch !== '\n');
6275 * Tries to keep input at up to `lineWidth` characters, splitting only on spaces
6276 * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are
6277 * terminated with `\n` and started with `indent`.
6279 * @param {string} text
6280 * @param {string} indent
6281 * @param {string} [mode='flow'] `'block'` prevents more-indented lines
6282 * from being folded; `'quoted'` allows for `\` escapes, including escaped
6284 * @param {Object} options
6285 * @param {number} [options.indentAtStart] Accounts for leading contents on
6286 * the first line, defaulting to `indent.length`
6287 * @param {number} [options.lineWidth=80]
6288 * @param {number} [options.minContentWidth=20] Allow highly indented lines to
6289 * stretch the line width or indent content from the start
6290 * @param {function} options.onFold Called once if the text is folded
6291 * @param {function} options.onFold Called once if any line of text exceeds
6292 * lineWidth characters
6296 function foldFlowLines(text, indent, mode, {
6299 minContentWidth = 20,
6303 if (!lineWidth || lineWidth < 0) return text;
6304 const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
6305 if (text.length <= endStep) return text;
6307 const escapedFolds = {};
6308 let end = lineWidth - indent.length;
6310 if (typeof indentAtStart === 'number') {
6311 if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);else end = lineWidth - indentAtStart;
6314 let split = undefined;
6315 let prev = undefined;
6316 let overflow = false;
6321 if (mode === FOLD_BLOCK) {
6322 i = consumeMoreIndentedLines(text, i);
6323 if (i !== -1) end = i + endStep;
6326 for (let ch; ch = text[i += 1];) {
6327 if (mode === FOLD_QUOTED && ch === '\\') {
6330 switch (text[i + 1]) {
6351 if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text, i);
6355 if (ch === ' ' && prev && prev !== ' ' && prev !== '\n' && prev !== '\t') {
6356 // space surrounded by non-space can be replaced with newline + indent
6357 const next = text[i + 1];
6358 if (next && next !== ' ' && next !== '\n' && next !== '\t') split = i;
6364 end = split + endStep;
6366 } else if (mode === FOLD_QUOTED) {
6367 // white-space collected at end may stretch past lineWidth
6368 while (prev === ' ' || prev === '\t') {
6372 } // Account for newline escape, but don't break preceding escape
6375 const j = i > escEnd + 1 ? i - 2 : escStart - 1; // Bail out if lineWidth & minContentWidth are shorter than an escape string
6377 if (escapedFolds[j]) return text;
6379 escapedFolds[j] = true;
6391 if (overflow && onOverflow) onOverflow();
6392 if (folds.length === 0) return text;
6393 if (onFold) onFold();
6394 let res = text.slice(0, folds[0]);
6396 for (let i = 0; i < folds.length; ++i) {
6397 const fold = folds[i];
6398 const end = folds[i + 1] || text.length;
6399 if (fold === 0) res = `\n${indent}${text.slice(0, end)}`;else {
6400 if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text[fold]}\\`;
6401 res += `\n${indent}${text.slice(fold + 1, end)}`;
6408 const getFoldOptions = ({
6410 }) => indentAtStart ? Object.assign({
6412 }, strOptions.fold) : strOptions.fold; // Also checks for lines starting with %, as parsing the output as YAML 1.1 will
6413 // presume that's starting a new document.
6416 const containsDocumentMarker = str => /^(%|---|\.\.\.)/m.test(str);
6418 function lineLengthOverLimit(str, lineWidth, indentLength) {
6419 if (!lineWidth || lineWidth < 0) return false;
6420 const limit = lineWidth - indentLength;
6421 const strLen = str.length;
6422 if (strLen <= limit) return false;
6424 for (let i = 0, start = 0; i < strLen; ++i) {
6425 if (str[i] === '\n') {
6426 if (i - start > limit) return true;
6428 if (strLen - start <= limit) return false;
6435 function doubleQuotedString(value, ctx) {
6442 } = strOptions.doubleQuoted;
6443 const json = JSON.stringify(value);
6444 if (jsonEncoding) return json;
6445 const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
6449 for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
6450 if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') {
6451 // space before newline needs to be escaped to not be folded
6452 str += json.slice(start, i) + '\\ ';
6458 if (ch === '\\') switch (json[i + 1]) {
6461 str += json.slice(start, i);
6462 const code = json.substr(i + 2, 4);
6498 if (code.substr(0, 2) === '00') str += '\\x' + code.substr(2);else str += json.substr(i, 6);
6507 if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
6510 // folding will eat first newline
6511 str += json.slice(start, i) + '\n\n';
6513 while (json[i + 2] === '\\' && json[i + 3] === 'n' && json[i + 4] !== '"') {
6518 str += indent; // space after newline needs to be escaped to not be folded
6520 if (json[i + 2] === ' ') str += '\\';
6532 str = start ? str + json.slice(start) : json;
6533 return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
6536 function singleQuotedString(value, ctx) {
6537 if (ctx.implicitKey) {
6538 if (/\n/.test(value)) return doubleQuotedString(value, ctx);
6540 // single quoted string can't have leading or trailing whitespace around newline
6541 if (/[ \t]\n|\n[ \t]/.test(value)) return doubleQuotedString(value, ctx);
6544 const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');
6545 const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
6546 return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
6549 function blockString({
6553 }, ctx, onComment, onChompKeep) {
6554 // 1. Block can't end in whitespace unless the last line is non-empty.
6555 // 2. Strings consisting of only whitespace are best rendered explicitly.
6556 if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
6557 return doubleQuotedString(value, ctx);
6560 const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');
6561 const indentSize = indent ? '2' : '1'; // root is at -1
6563 const literal = type === PlainValue$4.Type.BLOCK_FOLDED ? false : type === PlainValue$4.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length);
6564 let header = literal ? '|' : '>';
6565 if (!value) return header + '\n';
6568 value = value.replace(/[\n\t ]*$/, ws => {
6569 const n = ws.indexOf('\n');
6572 header += '-'; // strip
6573 } else if (value === ws || n !== ws.length - 1) {
6574 header += '+'; // keep
6576 if (onChompKeep) onChompKeep();
6579 wsEnd = ws.replace(/\n$/, '');
6581 }).replace(/^[\n ]*/, ws => {
6582 if (ws.indexOf(' ') !== -1) header += indentSize;
6583 const m = ws.match(/ +$/);
6586 wsStart = ws.slice(0, -m[0].length);
6593 if (wsEnd) wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`);
6594 if (wsStart) wsStart = wsStart.replace(/\n+/g, `$&${indent}`);
6597 header += ' #' + comment.replace(/ ?[\r\n]+/g, ' ');
6598 if (onComment) onComment();
6601 if (!value) return `${header}${indentSize}\n${indent}${wsEnd}`;
6604 value = value.replace(/\n+/g, `$&${indent}`);
6605 return `${header}\n${indent}${wsStart}${value}${wsEnd}`;
6608 value = value.replace(/\n+/g, '\n$&').replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
6609 // ^ ind.line ^ empty ^ capture next empty lines only at end of indent
6610 .replace(/\n+/g, `$&${indent}`);
6611 const body = foldFlowLines(`${wsStart}${value}${wsEnd}`, indent, FOLD_BLOCK, strOptions.fold);
6612 return `${header}\n${indent}${body}`;
6615 function plainString(item, ctx, onComment, onChompKeep) {
6628 if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
6629 return doubleQuotedString(value, ctx);
6632 if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
6634 // - empty string, '-' or '?'
6635 // - start with an indicator character (except [?:-]) or /[?-] /
6636 // - '\n ', ': ' or ' \n' anywhere
6637 // - '#' not preceded by a non-space char
6638 // - end with ' ' or ':'
6639 return implicitKey || inFlow || value.indexOf('\n') === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
6642 if (!implicitKey && !inFlow && type !== PlainValue$4.Type.PLAIN && value.indexOf('\n') !== -1) {
6643 // Where allowed & type not set explicitly, prefer block style for multiline strings
6644 return blockString(item, ctx, onComment, onChompKeep);
6647 if (indent === '' && containsDocumentMarker(value)) {
6648 ctx.forceBlockIndent = true;
6649 return blockString(item, ctx, onComment, onChompKeep);
6652 const str = value.replace(/\n+/g, `$&\n${indent}`); // Verify that output will be parsed as a string, as e.g. plain numbers and
6653 // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
6654 // and others in v1.1.
6660 const resolved = resolveScalar(str, tags, tags.scalarFallback).value;
6661 if (typeof resolved !== 'string') return doubleQuotedString(value, ctx);
6664 const body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
6666 if (comment && !inFlow && (body.indexOf('\n') !== -1 || comment.indexOf('\n') !== -1)) {
6667 if (onComment) onComment();
6668 return addCommentBefore(body, indent, comment);
6674 function stringifyString(item, ctx, onComment, onChompKeep) {
6687 if (typeof value !== 'string') {
6688 value = String(value);
6689 item = Object.assign({}, item, {
6694 const _stringify = _type => {
6696 case PlainValue$4.Type.BLOCK_FOLDED:
6697 case PlainValue$4.Type.BLOCK_LITERAL:
6698 return blockString(item, ctx, onComment, onChompKeep);
6700 case PlainValue$4.Type.QUOTE_DOUBLE:
6701 return doubleQuotedString(value, ctx);
6703 case PlainValue$4.Type.QUOTE_SINGLE:
6704 return singleQuotedString(value, ctx);
6706 case PlainValue$4.Type.PLAIN:
6707 return plainString(item, ctx, onComment, onChompKeep);
6714 if (type !== PlainValue$4.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) {
6715 // force double quotes on control characters
6716 type = PlainValue$4.Type.QUOTE_DOUBLE;
6717 } else if ((implicitKey || inFlow) && (type === PlainValue$4.Type.BLOCK_FOLDED || type === PlainValue$4.Type.BLOCK_LITERAL)) {
6718 // should not happen; blocks are not valid inside flow containers
6719 type = PlainValue$4.Type.QUOTE_DOUBLE;
6722 let res = _stringify(type);
6725 res = _stringify(defaultType);
6726 if (res === null) throw new Error(`Unsupported default string type ${defaultType}`);
6732 function stringifyNumber({
6738 if (typeof value === 'bigint') return String(value);
6739 if (!isFinite(value)) return isNaN(value) ? '.nan' : value < 0 ? '-.inf' : '.inf';
6740 let n = JSON.stringify(value);
6742 if (!format && minFractionDigits && (!tag || tag === 'tag:yaml.org,2002:float') && /^\d/.test(n)) {
6743 let i = n.indexOf('.');
6750 let d = minFractionDigits - (n.length - i - 1);
6752 while (d-- > 0) n += '0';
6758 function checkFlowCollectionEnd(errors, cst) {
6762 case PlainValue$4.Type.FLOW_MAP:
6767 case PlainValue$4.Type.FLOW_SEQ:
6769 name = 'flow sequence';
6773 errors.push(new PlainValue$4.YAMLSemanticError(cst, 'Not a flow collection!?'));
6779 for (let i = cst.items.length - 1; i >= 0; --i) {
6780 const item = cst.items[i];
6782 if (!item || item.type !== PlainValue$4.Type.COMMENT) {
6788 if (lastItem && lastItem.char !== char) {
6789 const msg = `Expected ${name} to end with ${char}`;
6792 if (typeof lastItem.offset === 'number') {
6793 err = new PlainValue$4.YAMLSemanticError(cst, msg);
6794 err.offset = lastItem.offset + 1;
6796 err = new PlainValue$4.YAMLSemanticError(lastItem, msg);
6797 if (lastItem.range && lastItem.range.end) err.offset = lastItem.range.end - lastItem.range.start;
6804 function checkFlowCommentSpace(errors, comment) {
6805 const prev = comment.context.src[comment.range.start - 1];
6807 if (prev !== '\n' && prev !== '\t' && prev !== ' ') {
6808 const msg = 'Comments must be separated from other tokens by white space characters';
6809 errors.push(new PlainValue$4.YAMLSemanticError(comment, msg));
6813 function getLongKeyError(source, key) {
6814 const sk = String(key);
6815 const k = sk.substr(0, 8) + '...' + sk.substr(-8);
6816 return new PlainValue$4.YAMLSemanticError(source, `The "${k}" key is too long`);
6819 function resolveComments(collection, comments) {
6825 let item = collection.items[before];
6828 if (comment !== undefined) {
6829 if (collection.comment) collection.comment += '\n' + comment;else collection.comment = comment;
6832 if (afterKey && item.value) item = item.value;
6834 if (comment === undefined) {
6835 if (afterKey || !item.commentBefore) item.spaceBefore = true;
6837 if (item.commentBefore) item.commentBefore += '\n' + comment;else item.commentBefore = comment;
6841 } // on error, will return { str: string, errors: Error[] }
6844 function resolveString(doc, node) {
6845 const res = node.strValue;
6846 if (!res) return '';
6847 if (typeof res === 'string') return res;
6848 res.errors.forEach(error => {
6849 if (!error.source) error.source = node;
6850 doc.errors.push(error);
6855 function resolveTagHandle(doc, node) {
6860 let prefix = doc.tagPrefixes.find(p => p.handle === handle);
6863 const dtp = doc.getDefaults().tagPrefixes;
6864 if (dtp) prefix = dtp.find(p => p.handle === handle);
6865 if (!prefix) throw new PlainValue$4.YAMLSemanticError(node, `The ${handle} tag handle is non-default and was not declared.`);
6868 if (!suffix) throw new PlainValue$4.YAMLSemanticError(node, `The ${handle} tag has no suffix.`);
6870 if (handle === '!' && (doc.version || doc.options.version) === '1.0') {
6871 if (suffix[0] === '^') {
6872 doc.warnings.push(new PlainValue$4.YAMLWarning(node, 'YAML 1.0 ^ tag expansion is not supported'));
6876 if (/[:/]/.test(suffix)) {
6877 // word/foo -> tag:word.yaml.org,2002:foo
6878 const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i);
6879 return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`;
6883 return prefix.prefix + decodeURIComponent(suffix);
6886 function resolveTagName(doc, node) {
6891 let nonSpecific = false;
6901 if (verbatim !== '!' && verbatim !== '!!') return verbatim;
6902 const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`;
6903 doc.errors.push(new PlainValue$4.YAMLSemanticError(node, msg));
6904 } else if (handle === '!' && !suffix) {
6908 return resolveTagHandle(doc, node);
6910 doc.errors.push(error);
6916 case PlainValue$4.Type.BLOCK_FOLDED:
6917 case PlainValue$4.Type.BLOCK_LITERAL:
6918 case PlainValue$4.Type.QUOTE_DOUBLE:
6919 case PlainValue$4.Type.QUOTE_SINGLE:
6920 return PlainValue$4.defaultTags.STR;
6922 case PlainValue$4.Type.FLOW_MAP:
6923 case PlainValue$4.Type.MAP:
6924 return PlainValue$4.defaultTags.MAP;
6926 case PlainValue$4.Type.FLOW_SEQ:
6927 case PlainValue$4.Type.SEQ:
6928 return PlainValue$4.defaultTags.SEQ;
6930 case PlainValue$4.Type.PLAIN:
6931 return nonSpecific ? PlainValue$4.defaultTags.STR : null;
6938 function resolveByTagName(doc, node, tagName) {
6942 const matchWithTest = [];
6944 for (const tag of tags) {
6945 if (tag.tag === tagName) {
6946 if (tag.test) matchWithTest.push(tag);else {
6947 const res = tag.resolve(doc, node);
6948 return res instanceof Collection ? res : new Scalar(res);
6953 const str = resolveString(doc, node);
6954 if (typeof str === 'string' && matchWithTest.length > 0) return resolveScalar(str, matchWithTest, tags.scalarFallback);
6958 function getFallbackTagName({
6962 case PlainValue$4.Type.FLOW_MAP:
6963 case PlainValue$4.Type.MAP:
6964 return PlainValue$4.defaultTags.MAP;
6966 case PlainValue$4.Type.FLOW_SEQ:
6967 case PlainValue$4.Type.SEQ:
6968 return PlainValue$4.defaultTags.SEQ;
6971 return PlainValue$4.defaultTags.STR;
6975 function resolveTag(doc, node, tagName) {
6977 const res = resolveByTagName(doc, node, tagName);
6980 if (tagName && node.tag) res.tag = tagName;
6984 /* istanbul ignore if */
6985 if (!error.source) error.source = node;
6986 doc.errors.push(error);
6991 const fallback = getFallbackTagName(node);
6992 if (!fallback) throw new Error(`The tag ${tagName} is unavailable`);
6993 const msg = `The tag ${tagName} is unavailable, falling back to ${fallback}`;
6994 doc.warnings.push(new PlainValue$4.YAMLWarning(node, msg));
6995 const res = resolveByTagName(doc, node, fallback);
6999 const refError = new PlainValue$4.YAMLReferenceError(node, error.message);
7000 refError.stack = error.stack;
7001 doc.errors.push(refError);
7006 const isCollectionItem = node => {
7007 if (!node) return false;
7011 return type === PlainValue$4.Type.MAP_KEY || type === PlainValue$4.Type.MAP_VALUE || type === PlainValue$4.Type.SEQ_ITEM;
7014 function resolveNodeProps(errors, node) {
7019 let hasAnchor = false;
7021 const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props;
7027 switch (node.context.src[start]) {
7028 case PlainValue$4.Char.COMMENT:
7030 if (!node.commentHasRequiredWhitespace(start)) {
7031 const msg = 'Comments must be separated from other tokens by white space characters';
7032 errors.push(new PlainValue$4.YAMLSemanticError(node, msg));
7039 const cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before;
7040 cc.push(node.context.src.slice(start + 1, end));
7043 // Actual anchor & tag resolution is handled by schema, here we just complain
7045 case PlainValue$4.Char.ANCHOR:
7047 const msg = 'A node can have at most one anchor';
7048 errors.push(new PlainValue$4.YAMLSemanticError(node, msg));
7054 case PlainValue$4.Char.TAG:
7056 const msg = 'A node can have at most one tag';
7057 errors.push(new PlainValue$4.YAMLSemanticError(node, msg));
7072 function resolveNodeValue(doc, node) {
7079 if (node.type === PlainValue$4.Type.ALIAS) {
7080 const name = node.rawValue;
7081 const src = anchors.getNode(name);
7084 const msg = `Aliased anchor not found: ${name}`;
7085 errors.push(new PlainValue$4.YAMLReferenceError(node, msg));
7087 } // Lazy resolution for circular references
7090 const res = new Alias(src);
7092 anchors._cstAliases.push(res);
7097 const tagName = resolveTagName(doc, node);
7098 if (tagName) return resolveTag(doc, node, tagName);
7100 if (node.type !== PlainValue$4.Type.PLAIN) {
7101 const msg = `Failed to resolve ${node.type} node here`;
7102 errors.push(new PlainValue$4.YAMLSyntaxError(node, msg));
7107 const str = resolveString(doc, node);
7108 return resolveScalar(str, schema.tags, schema.tags.scalarFallback);
7110 if (!error.source) error.source = node;
7114 } // sets node.resolved on success
7117 function resolveNode(doc, node) {
7118 if (!node) return null;
7119 if (node.error) doc.errors.push(node.error);
7124 } = resolveNodeProps(doc.errors, node);
7130 const name = node.anchor;
7131 const prev = anchors.getNode(name); // At this point, aliases for any preceding node with the same anchor
7132 // name have already been resolved, so it may safely be renamed.
7134 if (prev) anchors.map[anchors.newName(name)] = prev; // During parsing, we need to store the CST node in anchors.map as
7135 // anchors need to be available during resolution to allow for
7136 // circular references.
7138 anchors.map[name] = node;
7141 if (node.type === PlainValue$4.Type.ALIAS && (hasAnchor || hasTag)) {
7142 const msg = 'An alias node must not specify any properties';
7143 doc.errors.push(new PlainValue$4.YAMLSemanticError(node, msg));
7146 const res = resolveNodeValue(doc, node);
7149 res.range = [node.range.start, node.range.end];
7150 if (doc.options.keepCstNodes) res.cstNode = node;
7151 if (doc.options.keepNodeTypes) res.type = node.type;
7152 const cb = comments.before.join('\n');
7155 res.commentBefore = res.commentBefore ? `${res.commentBefore}\n${cb}` : cb;
7158 const ca = comments.after.join('\n');
7159 if (ca) res.comment = res.comment ? `${res.comment}\n${ca}` : ca;
7162 return node.resolved = res;
7165 function resolveMap(doc, cst) {
7166 if (cst.type !== PlainValue$4.Type.MAP && cst.type !== PlainValue$4.Type.FLOW_MAP) {
7167 const msg = `A ${cst.type} node cannot be resolved as a mapping`;
7168 doc.errors.push(new PlainValue$4.YAMLSyntaxError(cst, msg));
7175 } = cst.type === PlainValue$4.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst);
7176 const map = new YAMLMap();
7178 resolveComments(map, comments);
7179 let hasCollectionKey = false;
7181 for (let i = 0; i < items.length; ++i) {
7185 if (iKey instanceof Collection) hasCollectionKey = true;
7187 if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) {
7188 items[i] = new Merge(items[i]);
7189 const sources = items[i].value.items;
7191 sources.some(node => {
7192 if (node instanceof Alias) {
7193 // During parsing, alias sources are CST nodes; to account for
7194 // circular references their resolved values can't be used here.
7198 if (type === PlainValue$4.Type.MAP || type === PlainValue$4.Type.FLOW_MAP) return false;
7199 return error = 'Merge nodes aliases can only point to maps';
7202 return error = 'Merge nodes can only have Alias nodes as values';
7204 if (error) doc.errors.push(new PlainValue$4.YAMLSemanticError(cst, error));
7206 for (let j = i + 1; j < items.length; ++j) {
7211 if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, 'value') && iKey.value === jKey.value) {
7212 const msg = `Map keys must be unique; "${iKey}" is repeated`;
7213 doc.errors.push(new PlainValue$4.YAMLSemanticError(cst, msg));
7220 if (hasCollectionKey && !doc.options.mapAsMap) {
7221 const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.';
7222 doc.warnings.push(new PlainValue$4.YAMLWarning(cst, warn));
7229 const valueHasPairComment = ({
7237 if (props.length === 0) return false;
7241 if (node && start > node.valueRange.start) return false;
7242 if (src[start] !== PlainValue$4.Char.COMMENT) return false;
7244 for (let i = lineStart; i < start; ++i) if (src[i] === '\n') return false;
7249 function resolvePairComment(item, pair) {
7250 if (!valueHasPairComment(item)) return;
7251 const comment = item.getPropValue(0, PlainValue$4.Char.COMMENT, true);
7253 const cb = pair.value.commentBefore;
7255 if (cb && cb.startsWith(comment)) {
7256 pair.value.commentBefore = cb.substr(comment.length + 1);
7259 const cc = pair.value.comment;
7261 if (!item.node && cc && cc.startsWith(comment)) {
7262 pair.value.comment = cc.substr(comment.length + 1);
7267 if (found) pair.comment = comment;
7270 function resolveBlockMapItems(doc, cst) {
7271 const comments = [];
7273 let key = undefined;
7274 let keyStart = null;
7276 for (let i = 0; i < cst.items.length; ++i) {
7277 const item = cst.items[i];
7279 switch (item.type) {
7280 case PlainValue$4.Type.BLANK_LINE:
7283 before: items.length
7287 case PlainValue$4.Type.COMMENT:
7290 before: items.length,
7291 comment: item.comment
7295 case PlainValue$4.Type.MAP_KEY:
7296 if (key !== undefined) items.push(new Pair(key));
7297 if (item.error) doc.errors.push(item.error);
7298 key = resolveNode(doc, item.node);
7302 case PlainValue$4.Type.MAP_VALUE:
7304 if (key === undefined) key = null;
7305 if (item.error) doc.errors.push(item.error);
7307 if (!item.context.atLineStart && item.node && item.node.type === PlainValue$4.Type.MAP && !item.node.context.atLineStart) {
7308 const msg = 'Nested mappings are not allowed in compact mappings';
7309 doc.errors.push(new PlainValue$4.YAMLSemanticError(item.node, msg));
7312 let valueNode = item.node;
7314 if (!valueNode && item.props.length > 0) {
7315 // Comments on an empty mapping value need to be preserved, so we
7316 // need to construct a minimal empty node here to use instead of the
7317 // missing `item.node`. -- eemeli/yaml#19
7318 valueNode = new PlainValue$4.PlainValue(PlainValue$4.Type.PLAIN, []);
7319 valueNode.context = {
7321 src: item.context.src
7323 const pos = item.range.start + 1;
7328 valueNode.valueRange = {
7333 if (typeof item.range.origStart === 'number') {
7334 const origPos = item.range.origStart + 1;
7335 valueNode.range.origStart = valueNode.range.origEnd = origPos;
7336 valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos;
7340 const pair = new Pair(key, resolveNode(doc, valueNode));
7341 resolvePairComment(item, pair);
7344 if (key && typeof keyStart === 'number') {
7345 if (item.range.start > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key));
7354 if (key !== undefined) items.push(new Pair(key));
7355 key = resolveNode(doc, item);
7356 keyStart = item.range.start;
7357 if (item.error) doc.errors.push(item.error);
7359 next: for (let j = i + 1;; ++j) {
7360 const nextItem = cst.items[j];
7362 switch (nextItem && nextItem.type) {
7363 case PlainValue$4.Type.BLANK_LINE:
7364 case PlainValue$4.Type.COMMENT:
7367 case PlainValue$4.Type.MAP_VALUE:
7372 const msg = 'Implicit map keys need to be followed by map values';
7373 doc.errors.push(new PlainValue$4.YAMLSemanticError(item, msg));
7379 if (item.valueRangeContainsNewline) {
7380 const msg = 'Implicit map keys need to be on a single line';
7381 doc.errors.push(new PlainValue$4.YAMLSemanticError(item, msg));
7387 if (key !== undefined) items.push(new Pair(key));
7394 function resolveFlowMapItems(doc, cst) {
7395 const comments = [];
7397 let key = undefined;
7398 let explicitKey = false;
7401 for (let i = 0; i < cst.items.length; ++i) {
7402 const item = cst.items[i];
7404 if (typeof item.char === 'string') {
7410 if (char === '?' && key === undefined && !explicitKey) {
7417 if (key === undefined) key = null;
7425 if (key === undefined && char !== ',') key = null;
7426 explicitKey = false;
7429 if (key !== undefined) {
7430 items.push(new Pair(key));
7441 if (i === cst.items.length - 1) continue;
7442 } else if (char === next) {
7447 const msg = `Flow map contains an unexpected ${char}`;
7448 const err = new PlainValue$4.YAMLSyntaxError(cst, msg);
7449 err.offset = offset;
7450 doc.errors.push(err);
7451 } else if (item.type === PlainValue$4.Type.BLANK_LINE) {
7454 before: items.length
7456 } else if (item.type === PlainValue$4.Type.COMMENT) {
7457 checkFlowCommentSpace(doc.errors, item);
7460 before: items.length,
7461 comment: item.comment
7463 } else if (key === undefined) {
7464 if (next === ',') doc.errors.push(new PlainValue$4.YAMLSemanticError(item, 'Separator , missing in flow map'));
7465 key = resolveNode(doc, item);
7467 if (next !== ',') doc.errors.push(new PlainValue$4.YAMLSemanticError(item, 'Indicator : missing in flow map entry'));
7468 items.push(new Pair(key, resolveNode(doc, item)));
7470 explicitKey = false;
7474 checkFlowCollectionEnd(doc.errors, cst);
7475 if (key !== undefined) items.push(new Pair(key));
7482 function resolveSeq$3(doc, cst) {
7483 if (cst.type !== PlainValue$4.Type.SEQ && cst.type !== PlainValue$4.Type.FLOW_SEQ) {
7484 const msg = `A ${cst.type} node cannot be resolved as a sequence`;
7485 doc.errors.push(new PlainValue$4.YAMLSyntaxError(cst, msg));
7492 } = cst.type === PlainValue$4.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst);
7493 const seq = new YAMLSeq();
7495 resolveComments(seq, comments);
7497 if (!doc.options.mapAsMap && items.some(it => it instanceof Pair && it.key instanceof Collection)) {
7498 const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.';
7499 doc.warnings.push(new PlainValue$4.YAMLWarning(cst, warn));
7506 function resolveBlockSeqItems(doc, cst) {
7507 const comments = [];
7510 for (let i = 0; i < cst.items.length; ++i) {
7511 const item = cst.items[i];
7513 switch (item.type) {
7514 case PlainValue$4.Type.BLANK_LINE:
7516 before: items.length
7520 case PlainValue$4.Type.COMMENT:
7522 comment: item.comment,
7523 before: items.length
7527 case PlainValue$4.Type.SEQ_ITEM:
7528 if (item.error) doc.errors.push(item.error);
7529 items.push(resolveNode(doc, item.node));
7531 if (item.hasProps) {
7532 const msg = 'Sequence items cannot have tags or anchors before the - indicator';
7533 doc.errors.push(new PlainValue$4.YAMLSemanticError(item, msg));
7539 if (item.error) doc.errors.push(item.error);
7540 doc.errors.push(new PlainValue$4.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`));
7550 function resolveFlowSeqItems(doc, cst) {
7551 const comments = [];
7553 let explicitKey = false;
7554 let key = undefined;
7555 let keyStart = null;
7557 let prevItem = null;
7559 for (let i = 0; i < cst.items.length; ++i) {
7560 const item = cst.items[i];
7562 if (typeof item.char === 'string') {
7568 if (char !== ':' && (explicitKey || key !== undefined)) {
7569 if (explicitKey && key === undefined) key = next ? items.pop() : null;
7570 items.push(new Pair(key));
7571 explicitKey = false;
7576 if (char === next) {
7578 } else if (!next && char === '?') {
7580 } else if (next !== '[' && char === ':' && key === undefined) {
7584 if (key instanceof Pair) {
7585 const msg = 'Chaining flow sequence pairs is invalid';
7586 const err = new PlainValue$4.YAMLSemanticError(cst, msg);
7587 err.offset = offset;
7588 doc.errors.push(err);
7591 if (!explicitKey && typeof keyStart === 'number') {
7592 const keyEnd = item.range ? item.range.start : item.offset;
7593 if (keyEnd > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key));
7596 } = prevItem.context;
7598 for (let i = keyStart; i < keyEnd; ++i) if (src[i] === '\n') {
7599 const msg = 'Implicit keys of flow sequence pairs need to be on a single line';
7600 doc.errors.push(new PlainValue$4.YAMLSemanticError(prevItem, msg));
7609 explicitKey = false;
7611 } else if (next === '[' || char !== ']' || i < cst.items.length - 1) {
7612 const msg = `Flow sequence contains an unexpected ${char}`;
7613 const err = new PlainValue$4.YAMLSyntaxError(cst, msg);
7614 err.offset = offset;
7615 doc.errors.push(err);
7617 } else if (item.type === PlainValue$4.Type.BLANK_LINE) {
7619 before: items.length
7621 } else if (item.type === PlainValue$4.Type.COMMENT) {
7622 checkFlowCommentSpace(doc.errors, item);
7624 comment: item.comment,
7625 before: items.length
7629 const msg = `Expected a ${next} in flow sequence`;
7630 doc.errors.push(new PlainValue$4.YAMLSemanticError(item, msg));
7633 const value = resolveNode(doc, item);
7635 if (key === undefined) {
7639 items.push(new Pair(key, value));
7643 keyStart = item.range.start;
7648 checkFlowCollectionEnd(doc.errors, cst);
7649 if (key !== undefined) items.push(new Pair(key));
7656 resolveSeqD03cb037.Alias = Alias;
7657 resolveSeqD03cb037.Collection = Collection;
7658 resolveSeqD03cb037.Merge = Merge;
7659 resolveSeqD03cb037.Node = Node;
7660 resolveSeqD03cb037.Pair = Pair;
7661 resolveSeqD03cb037.Scalar = Scalar;
7662 resolveSeqD03cb037.YAMLMap = YAMLMap;
7663 resolveSeqD03cb037.YAMLSeq = YAMLSeq;
7664 resolveSeqD03cb037.addComment = addComment;
7665 resolveSeqD03cb037.binaryOptions = binaryOptions;
7666 resolveSeqD03cb037.boolOptions = boolOptions;
7667 resolveSeqD03cb037.findPair = findPair;
7668 resolveSeqD03cb037.intOptions = intOptions;
7669 resolveSeqD03cb037.isEmptyPath = isEmptyPath;
7670 resolveSeqD03cb037.nullOptions = nullOptions;
7671 resolveSeqD03cb037.resolveMap = resolveMap;
7672 resolveSeqD03cb037.resolveNode = resolveNode;
7673 resolveSeqD03cb037.resolveSeq = resolveSeq$3;
7674 resolveSeqD03cb037.resolveString = resolveString;
7675 resolveSeqD03cb037.strOptions = strOptions;
7676 resolveSeqD03cb037.stringifyNumber = stringifyNumber;
7677 resolveSeqD03cb037.stringifyString = stringifyString;
7678 resolveSeqD03cb037.toJSON = toJSON;
7680 var check = function (it) {
7681 return it && it.Math == Math && it;
7684 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
7686 // eslint-disable-next-line es/no-global-this -- safe
7687 check(typeof globalThis == 'object' && globalThis) ||
7688 check(typeof window == 'object' && window) ||
7689 // eslint-disable-next-line no-restricted-globals -- safe
7690 check(typeof self == 'object' && self) ||
7691 check(typeof global$m == 'object' && global$m) ||
7692 // eslint-disable-next-line no-new-func -- fallback
7693 (function () { return this; })() || Function('return this')();
7695 var objectGetOwnPropertyDescriptor = {};
7697 var fails$7 = function (exec) {
7705 var fails$6 = fails$7;
7707 // Detect IE8's incomplete defineProperty implementation
7708 var descriptors = !fails$6(function () {
7709 // eslint-disable-next-line es/no-object-defineproperty -- required for testing
7710 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
7713 var call$4 = Function.prototype.call;
7715 var functionCall = call$4.bind ? call$4.bind(call$4) : function () {
7716 return call$4.apply(call$4, arguments);
7719 var objectPropertyIsEnumerable = {};
7721 var $propertyIsEnumerable = {}.propertyIsEnumerable;
7722 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
7723 var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
7725 // Nashorn ~ JDK8 bug
7726 var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
7728 // `Object.prototype.propertyIsEnumerable` method implementation
7729 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
7730 objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
7731 var descriptor = getOwnPropertyDescriptor$1(this, V);
7732 return !!descriptor && descriptor.enumerable;
7733 } : $propertyIsEnumerable;
7735 var createPropertyDescriptor$2 = function (bitmap, value) {
7737 enumerable: !(bitmap & 1),
7738 configurable: !(bitmap & 2),
7739 writable: !(bitmap & 4),
7744 var FunctionPrototype$1 = Function.prototype;
7745 var bind = FunctionPrototype$1.bind;
7746 var call$3 = FunctionPrototype$1.call;
7747 var callBind = bind && bind.bind(call$3);
7749 var functionUncurryThis = bind ? function (fn) {
7750 return fn && callBind(call$3, fn);
7752 return fn && function () {
7753 return call$3.apply(fn, arguments);
7757 var uncurryThis$a = functionUncurryThis;
7759 var toString$3 = uncurryThis$a({}.toString);
7760 var stringSlice = uncurryThis$a(''.slice);
7762 var classofRaw$1 = function (it) {
7763 return stringSlice(toString$3(it), 8, -1);
7766 var global$l = global$m;
7767 var uncurryThis$9 = functionUncurryThis;
7768 var fails$5 = fails$7;
7769 var classof$2 = classofRaw$1;
7771 var Object$4 = global$l.Object;
7772 var split = uncurryThis$9(''.split);
7774 // fallback for non-array-like ES3 and non-enumerable old V8 strings
7775 var indexedObject = fails$5(function () {
7776 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
7777 // eslint-disable-next-line no-prototype-builtins -- safe
7778 return !Object$4('z').propertyIsEnumerable(0);
7779 }) ? function (it) {
7780 return classof$2(it) == 'String' ? split(it, '') : Object$4(it);
7783 var global$k = global$m;
7785 var TypeError$7 = global$k.TypeError;
7787 // `RequireObjectCoercible` abstract operation
7788 // https://tc39.es/ecma262/#sec-requireobjectcoercible
7789 var requireObjectCoercible$2 = function (it) {
7790 if (it == undefined) throw TypeError$7("Can't call method on " + it);
7794 // toObject with fallback for non-array-like ES3 strings
7795 var IndexedObject = indexedObject;
7796 var requireObjectCoercible$1 = requireObjectCoercible$2;
7798 var toIndexedObject$3 = function (it) {
7799 return IndexedObject(requireObjectCoercible$1(it));
7802 // `IsCallable` abstract operation
7803 // https://tc39.es/ecma262/#sec-iscallable
7804 var isCallable$a = function (argument) {
7805 return typeof argument == 'function';
7808 var isCallable$9 = isCallable$a;
7810 var isObject$5 = function (it) {
7811 return typeof it == 'object' ? it !== null : isCallable$9(it);
7814 var global$j = global$m;
7815 var isCallable$8 = isCallable$a;
7817 var aFunction = function (argument) {
7818 return isCallable$8(argument) ? argument : undefined;
7821 var getBuiltIn$3 = function (namespace, method) {
7822 return arguments.length < 2 ? aFunction(global$j[namespace]) : global$j[namespace] && global$j[namespace][method];
7825 var uncurryThis$8 = functionUncurryThis;
7827 var objectIsPrototypeOf = uncurryThis$8({}.isPrototypeOf);
7829 var getBuiltIn$2 = getBuiltIn$3;
7831 var engineUserAgent = getBuiltIn$2('navigator', 'userAgent') || '';
7833 var global$i = global$m;
7834 var userAgent$2 = engineUserAgent;
7836 var process$1 = global$i.process;
7837 var Deno = global$i.Deno;
7838 var versions = process$1 && process$1.versions || Deno && Deno.version;
7839 var v8 = versions && versions.v8;
7843 match = v8.split('.');
7844 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
7845 // but their correct versions are not interesting for us
7846 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
7849 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
7850 // so check `userAgent` even if `.v8` exists, but 0
7851 if (!version && userAgent$2) {
7852 match = userAgent$2.match(/Edge\/(\d+)/);
7853 if (!match || match[1] >= 74) {
7854 match = userAgent$2.match(/Chrome\/(\d+)/);
7855 if (match) version = +match[1];
7859 var engineV8Version = version;
7861 /* eslint-disable es/no-symbol -- required for testing */
7863 var V8_VERSION = engineV8Version;
7864 var fails$4 = fails$7;
7866 // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
7867 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$4(function () {
7868 var symbol = Symbol();
7869 // Chrome 38 Symbol has incorrect toString conversion
7870 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
7871 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
7872 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
7873 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
7876 /* eslint-disable es/no-symbol -- required for testing */
7878 var NATIVE_SYMBOL$1 = nativeSymbol;
7880 var useSymbolAsUid = NATIVE_SYMBOL$1
7882 && typeof Symbol.iterator == 'symbol';
7884 var global$h = global$m;
7885 var getBuiltIn$1 = getBuiltIn$3;
7886 var isCallable$7 = isCallable$a;
7887 var isPrototypeOf = objectIsPrototypeOf;
7888 var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
7890 var Object$3 = global$h.Object;
7892 var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
7893 return typeof it == 'symbol';
7895 var $Symbol = getBuiltIn$1('Symbol');
7896 return isCallable$7($Symbol) && isPrototypeOf($Symbol.prototype, Object$3(it));
7899 var global$g = global$m;
7901 var String$3 = global$g.String;
7903 var tryToString$1 = function (argument) {
7905 return String$3(argument);
7911 var global$f = global$m;
7912 var isCallable$6 = isCallable$a;
7913 var tryToString = tryToString$1;
7915 var TypeError$6 = global$f.TypeError;
7917 // `Assert: IsCallable(argument) is true`
7918 var aCallable$2 = function (argument) {
7919 if (isCallable$6(argument)) return argument;
7920 throw TypeError$6(tryToString(argument) + ' is not a function');
7923 var aCallable$1 = aCallable$2;
7925 // `GetMethod` abstract operation
7926 // https://tc39.es/ecma262/#sec-getmethod
7927 var getMethod$1 = function (V, P) {
7929 return func == null ? undefined : aCallable$1(func);
7932 var global$e = global$m;
7933 var call$2 = functionCall;
7934 var isCallable$5 = isCallable$a;
7935 var isObject$4 = isObject$5;
7937 var TypeError$5 = global$e.TypeError;
7939 // `OrdinaryToPrimitive` abstract operation
7940 // https://tc39.es/ecma262/#sec-ordinarytoprimitive
7941 var ordinaryToPrimitive$1 = function (input, pref) {
7943 if (pref === 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
7944 if (isCallable$5(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
7945 if (pref !== 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
7946 throw TypeError$5("Can't convert object to primitive value");
7949 var shared$3 = {exports: {}};
7951 var global$d = global$m;
7953 // eslint-disable-next-line es/no-object-defineproperty -- safe
7954 var defineProperty = Object.defineProperty;
7956 var setGlobal$3 = function (key, value) {
7958 defineProperty(global$d, key, { value: value, configurable: true, writable: true });
7960 global$d[key] = value;
7964 var global$c = global$m;
7965 var setGlobal$2 = setGlobal$3;
7967 var SHARED = '__core-js_shared__';
7968 var store$3 = global$c[SHARED] || setGlobal$2(SHARED, {});
7970 var sharedStore = store$3;
7972 var store$2 = sharedStore;
7974 (shared$3.exports = function (key, value) {
7975 return store$2[key] || (store$2[key] = value !== undefined ? value : {});
7976 })('versions', []).push({
7979 copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
7982 var global$b = global$m;
7983 var requireObjectCoercible = requireObjectCoercible$2;
7985 var Object$2 = global$b.Object;
7987 // `ToObject` abstract operation
7988 // https://tc39.es/ecma262/#sec-toobject
7989 var toObject$2 = function (argument) {
7990 return Object$2(requireObjectCoercible(argument));
7993 var uncurryThis$7 = functionUncurryThis;
7994 var toObject$1 = toObject$2;
7996 var hasOwnProperty = uncurryThis$7({}.hasOwnProperty);
7998 // `HasOwnProperty` abstract operation
7999 // https://tc39.es/ecma262/#sec-hasownproperty
8000 var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
8001 return hasOwnProperty(toObject$1(it), key);
8004 var uncurryThis$6 = functionUncurryThis;
8007 var postfix = Math.random();
8008 var toString$2 = uncurryThis$6(1.0.toString);
8010 var uid$2 = function (key) {
8011 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$2(++id + postfix, 36);
8014 var global$a = global$m;
8015 var shared$2 = shared$3.exports;
8016 var hasOwn$6 = hasOwnProperty_1;
8018 var NATIVE_SYMBOL = nativeSymbol;
8019 var USE_SYMBOL_AS_UID = useSymbolAsUid;
8021 var WellKnownSymbolsStore = shared$2('wks');
8022 var Symbol$1 = global$a.Symbol;
8023 var symbolFor = Symbol$1 && Symbol$1['for'];
8024 var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
8026 var wellKnownSymbol$3 = function (name) {
8027 if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
8028 var description = 'Symbol.' + name;
8029 if (NATIVE_SYMBOL && hasOwn$6(Symbol$1, name)) {
8030 WellKnownSymbolsStore[name] = Symbol$1[name];
8031 } else if (USE_SYMBOL_AS_UID && symbolFor) {
8032 WellKnownSymbolsStore[name] = symbolFor(description);
8034 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
8036 } return WellKnownSymbolsStore[name];
8039 var global$9 = global$m;
8040 var call$1 = functionCall;
8041 var isObject$3 = isObject$5;
8042 var isSymbol$1 = isSymbol$2;
8043 var getMethod = getMethod$1;
8044 var ordinaryToPrimitive = ordinaryToPrimitive$1;
8045 var wellKnownSymbol$2 = wellKnownSymbol$3;
8047 var TypeError$4 = global$9.TypeError;
8048 var TO_PRIMITIVE = wellKnownSymbol$2('toPrimitive');
8050 // `ToPrimitive` abstract operation
8051 // https://tc39.es/ecma262/#sec-toprimitive
8052 var toPrimitive$1 = function (input, pref) {
8053 if (!isObject$3(input) || isSymbol$1(input)) return input;
8054 var exoticToPrim = getMethod(input, TO_PRIMITIVE);
8057 if (pref === undefined) pref = 'default';
8058 result = call$1(exoticToPrim, input, pref);
8059 if (!isObject$3(result) || isSymbol$1(result)) return result;
8060 throw TypeError$4("Can't convert object to primitive value");
8062 if (pref === undefined) pref = 'number';
8063 return ordinaryToPrimitive(input, pref);
8066 var toPrimitive = toPrimitive$1;
8067 var isSymbol = isSymbol$2;
8069 // `ToPropertyKey` abstract operation
8070 // https://tc39.es/ecma262/#sec-topropertykey
8071 var toPropertyKey$2 = function (argument) {
8072 var key = toPrimitive(argument, 'string');
8073 return isSymbol(key) ? key : key + '';
8076 var global$8 = global$m;
8077 var isObject$2 = isObject$5;
8079 var document = global$8.document;
8080 // typeof document.createElement is 'object' in old IE
8081 var EXISTS$1 = isObject$2(document) && isObject$2(document.createElement);
8083 var documentCreateElement = function (it) {
8084 return EXISTS$1 ? document.createElement(it) : {};
8087 var DESCRIPTORS$4 = descriptors;
8088 var fails$3 = fails$7;
8089 var createElement = documentCreateElement;
8091 // Thank's IE8 for his funny defineProperty
8092 var ie8DomDefine = !DESCRIPTORS$4 && !fails$3(function () {
8093 // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
8094 return Object.defineProperty(createElement('div'), 'a', {
8095 get: function () { return 7; }
8099 var DESCRIPTORS$3 = descriptors;
8100 var call = functionCall;
8101 var propertyIsEnumerableModule = objectPropertyIsEnumerable;
8102 var createPropertyDescriptor$1 = createPropertyDescriptor$2;
8103 var toIndexedObject$2 = toIndexedObject$3;
8104 var toPropertyKey$1 = toPropertyKey$2;
8105 var hasOwn$5 = hasOwnProperty_1;
8106 var IE8_DOM_DEFINE$1 = ie8DomDefine;
8108 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
8109 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
8111 // `Object.getOwnPropertyDescriptor` method
8112 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
8113 objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
8114 O = toIndexedObject$2(O);
8115 P = toPropertyKey$1(P);
8116 if (IE8_DOM_DEFINE$1) try {
8117 return $getOwnPropertyDescriptor(O, P);
8118 } catch (error) { /* empty */ }
8119 if (hasOwn$5(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
8122 var objectDefineProperty = {};
8124 var global$7 = global$m;
8125 var isObject$1 = isObject$5;
8127 var String$2 = global$7.String;
8128 var TypeError$3 = global$7.TypeError;
8130 // `Assert: Type(argument) is Object`
8131 var anObject$2 = function (argument) {
8132 if (isObject$1(argument)) return argument;
8133 throw TypeError$3(String$2(argument) + ' is not an object');
8136 var global$6 = global$m;
8137 var DESCRIPTORS$2 = descriptors;
8138 var IE8_DOM_DEFINE = ie8DomDefine;
8139 var anObject$1 = anObject$2;
8140 var toPropertyKey = toPropertyKey$2;
8142 var TypeError$2 = global$6.TypeError;
8143 // eslint-disable-next-line es/no-object-defineproperty -- safe
8144 var $defineProperty = Object.defineProperty;
8146 // `Object.defineProperty` method
8147 // https://tc39.es/ecma262/#sec-object.defineproperty
8148 objectDefineProperty.f = DESCRIPTORS$2 ? $defineProperty : function defineProperty(O, P, Attributes) {
8150 P = toPropertyKey(P);
8151 anObject$1(Attributes);
8152 if (IE8_DOM_DEFINE) try {
8153 return $defineProperty(O, P, Attributes);
8154 } catch (error) { /* empty */ }
8155 if ('get' in Attributes || 'set' in Attributes) throw TypeError$2('Accessors not supported');
8156 if ('value' in Attributes) O[P] = Attributes.value;
8160 var DESCRIPTORS$1 = descriptors;
8161 var definePropertyModule$1 = objectDefineProperty;
8162 var createPropertyDescriptor = createPropertyDescriptor$2;
8164 var createNonEnumerableProperty$3 = DESCRIPTORS$1 ? function (object, key, value) {
8165 return definePropertyModule$1.f(object, key, createPropertyDescriptor(1, value));
8166 } : function (object, key, value) {
8167 object[key] = value;
8171 var redefine$1 = {exports: {}};
8173 var uncurryThis$5 = functionUncurryThis;
8174 var isCallable$4 = isCallable$a;
8175 var store$1 = sharedStore;
8177 var functionToString = uncurryThis$5(Function.toString);
8179 // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
8180 if (!isCallable$4(store$1.inspectSource)) {
8181 store$1.inspectSource = function (it) {
8182 return functionToString(it);
8186 var inspectSource$2 = store$1.inspectSource;
8188 var global$5 = global$m;
8189 var isCallable$3 = isCallable$a;
8190 var inspectSource$1 = inspectSource$2;
8192 var WeakMap$1 = global$5.WeakMap;
8194 var nativeWeakMap = isCallable$3(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
8196 var shared$1 = shared$3.exports;
8199 var keys = shared$1('keys');
8201 var sharedKey$1 = function (key) {
8202 return keys[key] || (keys[key] = uid(key));
8205 var hiddenKeys$3 = {};
8207 var NATIVE_WEAK_MAP = nativeWeakMap;
8208 var global$4 = global$m;
8209 var uncurryThis$4 = functionUncurryThis;
8210 var isObject = isObject$5;
8211 var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
8212 var hasOwn$4 = hasOwnProperty_1;
8213 var shared = sharedStore;
8214 var sharedKey = sharedKey$1;
8215 var hiddenKeys$2 = hiddenKeys$3;
8217 var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
8218 var TypeError$1 = global$4.TypeError;
8219 var WeakMap = global$4.WeakMap;
8220 var set$1, get, has;
8222 var enforce = function (it) {
8223 return has(it) ? get(it) : set$1(it, {});
8226 var getterFor = function (TYPE) {
8227 return function (it) {
8229 if (!isObject(it) || (state = get(it)).type !== TYPE) {
8230 throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
8235 if (NATIVE_WEAK_MAP || shared.state) {
8236 var store = shared.state || (shared.state = new WeakMap());
8237 var wmget = uncurryThis$4(store.get);
8238 var wmhas = uncurryThis$4(store.has);
8239 var wmset = uncurryThis$4(store.set);
8240 set$1 = function (it, metadata) {
8241 if (wmhas(store, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
8242 metadata.facade = it;
8243 wmset(store, it, metadata);
8246 get = function (it) {
8247 return wmget(store, it) || {};
8249 has = function (it) {
8250 return wmhas(store, it);
8253 var STATE = sharedKey('state');
8254 hiddenKeys$2[STATE] = true;
8255 set$1 = function (it, metadata) {
8256 if (hasOwn$4(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
8257 metadata.facade = it;
8258 createNonEnumerableProperty$2(it, STATE, metadata);
8261 get = function (it) {
8262 return hasOwn$4(it, STATE) ? it[STATE] : {};
8264 has = function (it) {
8265 return hasOwn$4(it, STATE);
8269 var internalState = {
8274 getterFor: getterFor
8277 var DESCRIPTORS = descriptors;
8278 var hasOwn$3 = hasOwnProperty_1;
8280 var FunctionPrototype = Function.prototype;
8281 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
8282 var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
8284 var EXISTS = hasOwn$3(FunctionPrototype, 'name');
8285 // additional protection from minified / mangled / dropped function names
8286 var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
8287 var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
8289 var functionName = {
8292 CONFIGURABLE: CONFIGURABLE
8295 var global$3 = global$m;
8296 var isCallable$2 = isCallable$a;
8297 var hasOwn$2 = hasOwnProperty_1;
8298 var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
8299 var setGlobal$1 = setGlobal$3;
8300 var inspectSource = inspectSource$2;
8301 var InternalStateModule = internalState;
8302 var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
8304 var getInternalState = InternalStateModule.get;
8305 var enforceInternalState = InternalStateModule.enforce;
8306 var TEMPLATE = String(String).split('String');
8308 (redefine$1.exports = function (O, key, value, options) {
8309 var unsafe = options ? !!options.unsafe : false;
8310 var simple = options ? !!options.enumerable : false;
8311 var noTargetGet = options ? !!options.noTargetGet : false;
8312 var name = options && options.name !== undefined ? options.name : key;
8314 if (isCallable$2(value)) {
8315 if (String(name).slice(0, 7) === 'Symbol(') {
8316 name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
8318 if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
8319 createNonEnumerableProperty$1(value, 'name', name);
8321 state = enforceInternalState(value);
8322 if (!state.source) {
8323 state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
8326 if (O === global$3) {
8327 if (simple) O[key] = value;
8328 else setGlobal$1(key, value);
8330 } else if (!unsafe) {
8332 } else if (!noTargetGet && O[key]) {
8335 if (simple) O[key] = value;
8336 else createNonEnumerableProperty$1(O, key, value);
8337 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
8338 })(Function.prototype, 'toString', function toString() {
8339 return isCallable$2(this) && getInternalState(this).source || inspectSource(this);
8342 var objectGetOwnPropertyNames = {};
8344 var ceil = Math.ceil;
8345 var floor$1 = Math.floor;
8347 // `ToIntegerOrInfinity` abstract operation
8348 // https://tc39.es/ecma262/#sec-tointegerorinfinity
8349 var toIntegerOrInfinity$2 = function (argument) {
8350 var number = +argument;
8351 // eslint-disable-next-line no-self-compare -- safe
8352 return number !== number || number === 0 ? 0 : (number > 0 ? floor$1 : ceil)(number);
8355 var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
8358 var min$1 = Math.min;
8360 // Helper for a popular repeating case of the spec:
8361 // Let integer be ? ToInteger(index).
8362 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
8363 var toAbsoluteIndex$1 = function (index, length) {
8364 var integer = toIntegerOrInfinity$1(index);
8365 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
8368 var toIntegerOrInfinity = toIntegerOrInfinity$2;
8372 // `ToLength` abstract operation
8373 // https://tc39.es/ecma262/#sec-tolength
8374 var toLength$1 = function (argument) {
8375 return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
8378 var toLength = toLength$1;
8380 // `LengthOfArrayLike` abstract operation
8381 // https://tc39.es/ecma262/#sec-lengthofarraylike
8382 var lengthOfArrayLike$2 = function (obj) {
8383 return toLength(obj.length);
8386 var toIndexedObject$1 = toIndexedObject$3;
8387 var toAbsoluteIndex = toAbsoluteIndex$1;
8388 var lengthOfArrayLike$1 = lengthOfArrayLike$2;
8390 // `Array.prototype.{ indexOf, includes }` methods implementation
8391 var createMethod = function (IS_INCLUDES) {
8392 return function ($this, el, fromIndex) {
8393 var O = toIndexedObject$1($this);
8394 var length = lengthOfArrayLike$1(O);
8395 var index = toAbsoluteIndex(fromIndex, length);
8397 // Array#includes uses SameValueZero equality algorithm
8398 // eslint-disable-next-line no-self-compare -- NaN check
8399 if (IS_INCLUDES && el != el) while (length > index) {
8401 // eslint-disable-next-line no-self-compare -- NaN check
8402 if (value != value) return true;
8403 // Array#indexOf ignores holes, Array#includes - not
8404 } else for (;length > index; index++) {
8405 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
8406 } return !IS_INCLUDES && -1;
8410 var arrayIncludes = {
8411 // `Array.prototype.includes` method
8412 // https://tc39.es/ecma262/#sec-array.prototype.includes
8413 includes: createMethod(true),
8414 // `Array.prototype.indexOf` method
8415 // https://tc39.es/ecma262/#sec-array.prototype.indexof
8416 indexOf: createMethod(false)
8419 var uncurryThis$3 = functionUncurryThis;
8420 var hasOwn$1 = hasOwnProperty_1;
8421 var toIndexedObject = toIndexedObject$3;
8422 var indexOf = arrayIncludes.indexOf;
8423 var hiddenKeys$1 = hiddenKeys$3;
8425 var push$1 = uncurryThis$3([].push);
8427 var objectKeysInternal = function (object, names) {
8428 var O = toIndexedObject(object);
8432 for (key in O) !hasOwn$1(hiddenKeys$1, key) && hasOwn$1(O, key) && push$1(result, key);
8433 // Don't enum bug & hidden keys
8434 while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
8435 ~indexOf(result, key) || push$1(result, key);
8440 // IE8- don't enum bug keys
8441 var enumBugKeys$1 = [
8445 'propertyIsEnumerable',
8451 var internalObjectKeys = objectKeysInternal;
8452 var enumBugKeys = enumBugKeys$1;
8454 var hiddenKeys = enumBugKeys.concat('length', 'prototype');
8456 // `Object.getOwnPropertyNames` method
8457 // https://tc39.es/ecma262/#sec-object.getownpropertynames
8458 // eslint-disable-next-line es/no-object-getownpropertynames -- safe
8459 objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
8460 return internalObjectKeys(O, hiddenKeys);
8463 var objectGetOwnPropertySymbols = {};
8465 // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
8466 objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
8468 var getBuiltIn = getBuiltIn$3;
8469 var uncurryThis$2 = functionUncurryThis;
8470 var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
8471 var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
8472 var anObject = anObject$2;
8474 var concat = uncurryThis$2([].concat);
8476 // all object keys, includes non-enumerable and symbols
8477 var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
8478 var keys = getOwnPropertyNamesModule.f(anObject(it));
8479 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
8480 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
8483 var hasOwn = hasOwnProperty_1;
8484 var ownKeys = ownKeys$1;
8485 var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
8486 var definePropertyModule = objectDefineProperty;
8488 var copyConstructorProperties$1 = function (target, source) {
8489 var keys = ownKeys(source);
8490 var defineProperty = definePropertyModule.f;
8491 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
8492 for (var i = 0; i < keys.length; i++) {
8494 if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
8498 var fails$2 = fails$7;
8499 var isCallable$1 = isCallable$a;
8501 var replacement = /#|\.prototype\./;
8503 var isForced$1 = function (feature, detection) {
8504 var value = data[normalize(feature)];
8505 return value == POLYFILL ? true
8506 : value == NATIVE ? false
8507 : isCallable$1(detection) ? fails$2(detection)
8511 var normalize = isForced$1.normalize = function (string) {
8512 return String(string).replace(replacement, '.').toLowerCase();
8515 var data = isForced$1.data = {};
8516 var NATIVE = isForced$1.NATIVE = 'N';
8517 var POLYFILL = isForced$1.POLYFILL = 'P';
8519 var isForced_1 = isForced$1;
8521 var global$2 = global$m;
8522 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
8523 var createNonEnumerableProperty = createNonEnumerableProperty$3;
8524 var redefine = redefine$1.exports;
8525 var setGlobal = setGlobal$3;
8526 var copyConstructorProperties = copyConstructorProperties$1;
8527 var isForced = isForced_1;
8530 options.target - name of the target object
8531 options.global - target is the global object
8532 options.stat - export as static methods of target
8533 options.proto - export as prototype methods of target
8534 options.real - real prototype method for the `pure` version
8535 options.forced - export even if the native feature is available
8536 options.bind - bind methods to the target, required for the `pure` version
8537 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
8538 options.unsafe - use the simple assignment of property instead of delete + defineProperty
8539 options.sham - add a flag to not completely full polyfills
8540 options.enumerable - export as enumerable property
8541 options.noTargetGet - prevent calling a getter on target
8542 options.name - the .name of the function if it does not match the key
8544 var _export = function (options, source) {
8545 var TARGET = options.target;
8546 var GLOBAL = options.global;
8547 var STATIC = options.stat;
8548 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
8551 } else if (STATIC) {
8552 target = global$2[TARGET] || setGlobal(TARGET, {});
8554 target = (global$2[TARGET] || {}).prototype;
8556 if (target) for (key in source) {
8557 sourceProperty = source[key];
8558 if (options.noTargetGet) {
8559 descriptor = getOwnPropertyDescriptor(target, key);
8560 targetProperty = descriptor && descriptor.value;
8561 } else targetProperty = target[key];
8562 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
8563 // contained in target
8564 if (!FORCED && targetProperty !== undefined) {
8565 if (typeof sourceProperty == typeof targetProperty) continue;
8566 copyConstructorProperties(sourceProperty, targetProperty);
8568 // add a flag to not completely full polyfills
8569 if (options.sham || (targetProperty && targetProperty.sham)) {
8570 createNonEnumerableProperty(sourceProperty, 'sham', true);
8573 redefine(target, key, sourceProperty, options);
8577 var wellKnownSymbol$1 = wellKnownSymbol$3;
8579 var TO_STRING_TAG$1 = wellKnownSymbol$1('toStringTag');
8582 test$1[TO_STRING_TAG$1] = 'z';
8584 var toStringTagSupport = String(test$1) === '[object z]';
8586 var global$1 = global$m;
8587 var TO_STRING_TAG_SUPPORT = toStringTagSupport;
8588 var isCallable = isCallable$a;
8589 var classofRaw = classofRaw$1;
8590 var wellKnownSymbol = wellKnownSymbol$3;
8592 var TO_STRING_TAG = wellKnownSymbol('toStringTag');
8593 var Object$1 = global$1.Object;
8596 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
8598 // fallback for IE11 Script Access Denied error
8599 var tryGet = function (it, key) {
8602 } catch (error) { /* empty */ }
8605 // getting tag from ES6+ `Object.prototype.toString`
8606 var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
8608 return it === undefined ? 'Undefined' : it === null ? 'Null'
8609 // @@toStringTag case
8610 : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
8612 : CORRECT_ARGUMENTS ? classofRaw(O)
8613 // ES3 arguments fallback
8614 : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
8617 var global = global$m;
8618 var classof = classof$1;
8620 var String$1 = global.String;
8622 var toString$1 = function (argument) {
8623 if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
8624 return String$1(argument);
8627 var uncurryThis$1 = functionUncurryThis;
8629 var arraySlice$1 = uncurryThis$1([].slice);
8631 var arraySlice = arraySlice$1;
8633 var floor = Math.floor;
8635 var mergeSort = function (array, comparefn) {
8636 var length = array.length;
8637 var middle = floor(length / 2);
8638 return length < 8 ? insertionSort(array, comparefn) : merge(
8640 mergeSort(arraySlice(array, 0, middle), comparefn),
8641 mergeSort(arraySlice(array, middle), comparefn),
8646 var insertionSort = function (array, comparefn) {
8647 var length = array.length;
8651 while (i < length) {
8654 while (j && comparefn(array[j - 1], element) > 0) {
8655 array[j] = array[--j];
8657 if (j !== i++) array[j] = element;
8661 var merge = function (array, left, right, comparefn) {
8662 var llength = left.length;
8663 var rlength = right.length;
8667 while (lindex < llength || rindex < rlength) {
8668 array[lindex + rindex] = (lindex < llength && rindex < rlength)
8669 ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
8670 : lindex < llength ? left[lindex++] : right[rindex++];
8674 var arraySort = mergeSort;
8676 var fails$1 = fails$7;
8678 var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
8679 var method = [][METHOD_NAME];
8680 return !!method && fails$1(function () {
8681 // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
8682 method.call(null, argument || function () { throw 1; }, 1);
8686 var userAgent$1 = engineUserAgent;
8688 var firefox = userAgent$1.match(/firefox\/(\d+)/i);
8690 var engineFfVersion = !!firefox && +firefox[1];
8692 var UA = engineUserAgent;
8694 var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
8696 var userAgent = engineUserAgent;
8698 var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
8700 var engineWebkitVersion = !!webkit && +webkit[1];
8703 var uncurryThis = functionUncurryThis;
8704 var aCallable = aCallable$2;
8705 var toObject = toObject$2;
8706 var lengthOfArrayLike = lengthOfArrayLike$2;
8707 var toString = toString$1;
8708 var fails = fails$7;
8709 var internalSort = arraySort;
8710 var arrayMethodIsStrict = arrayMethodIsStrict$1;
8711 var FF = engineFfVersion;
8712 var IE_OR_EDGE = engineIsIeOrEdge;
8713 var V8 = engineV8Version;
8714 var WEBKIT = engineWebkitVersion;
8717 var un$Sort = uncurryThis(test.sort);
8718 var push = uncurryThis(test.push);
8721 var FAILS_ON_UNDEFINED = fails(function () {
8722 test.sort(undefined);
8725 var FAILS_ON_NULL = fails(function () {
8729 var STRICT_METHOD = arrayMethodIsStrict('sort');
8731 var STABLE_SORT = !fails(function () {
8732 // feature detection can be too slow, so check engines versions
8733 if (V8) return V8 < 70;
8734 if (FF && FF > 3) return;
8735 if (IE_OR_EDGE) return true;
8736 if (WEBKIT) return WEBKIT < 603;
8739 var code, chr, value, index;
8741 // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
8742 for (code = 65; code < 76; code++) {
8743 chr = String.fromCharCode(code);
8746 case 66: case 69: case 70: case 72: value = 3; break;
8747 case 68: case 71: value = 4; break;
8751 for (index = 0; index < 47; index++) {
8752 test.push({ k: chr + index, v: value });
8756 test.sort(function (a, b) { return b.v - a.v; });
8758 for (index = 0; index < test.length; index++) {
8759 chr = test[index].k.charAt(0);
8760 if (result.charAt(result.length - 1) !== chr) result += chr;
8763 return result !== 'DGBEFHACIJK';
8766 var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
8768 var getSortCompare = function (comparefn) {
8769 return function (x, y) {
8770 if (y === undefined) return -1;
8771 if (x === undefined) return 1;
8772 if (comparefn !== undefined) return +comparefn(x, y) || 0;
8773 return toString(x) > toString(y) ? 1 : -1;
8777 // `Array.prototype.sort` method
8778 // https://tc39.es/ecma262/#sec-array.prototype.sort
8779 $({ target: 'Array', proto: true, forced: FORCED }, {
8780 sort: function sort(comparefn) {
8781 if (comparefn !== undefined) aCallable(comparefn);
8783 var array = toObject(this);
8785 if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
8788 var arrayLength = lengthOfArrayLike(array);
8789 var itemsLength, index;
8791 for (index = 0; index < arrayLength; index++) {
8792 if (index in array) push(items, array[index]);
8795 internalSort(items, getSortCompare(comparefn));
8797 itemsLength = items.length;
8800 while (index < itemsLength) array[index] = items[index++];
8801 while (index < arrayLength) delete array[index++];
8807 var Schema88e323a7 = {};
8809 var warnings1000a372 = {};
8811 var PlainValue$3 = PlainValueEc8e588e;
8812 var resolveSeq$2 = resolveSeqD03cb037;
8813 /* global atob, btoa, Buffer */
8816 identify: value => value instanceof Uint8Array,
8817 // Buffer inherits from Uint8Array
8819 tag: 'tag:yaml.org,2002:binary',
8822 * Returns a Buffer in node and an Uint8Array in browsers
8824 * To use the resulting buffer as an image, you'll want to do something like:
8826 * const blob = new Blob([buffer], { type: 'image/jpeg' })
8827 * document.querySelector('#photo').src = URL.createObjectURL(blob)
8829 resolve: (doc, node) => {
8830 const src = resolveSeq$2.resolveString(doc, node);
8832 if (typeof Buffer === 'function') {
8833 return Buffer.from(src, 'base64');
8834 } else if (typeof atob === 'function') {
8835 // On IE 11, atob() can't handle newlines
8836 const str = atob(src.replace(/[\n\r]/g, ''));
8837 const buffer = new Uint8Array(str.length);
8839 for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
8843 const msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
8844 doc.errors.push(new PlainValue$3.YAMLReferenceError(node, msg));
8848 options: resolveSeq$2.binaryOptions,
8853 }, ctx, onComment, onChompKeep) => {
8856 if (typeof Buffer === 'function') {
8857 src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
8858 } else if (typeof btoa === 'function') {
8861 for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]);
8865 throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
8868 if (!type) type = resolveSeq$2.binaryOptions.defaultType;
8870 if (type === PlainValue$3.Type.QUOTE_DOUBLE) {
8875 } = resolveSeq$2.binaryOptions;
8876 const n = Math.ceil(src.length / lineWidth);
8877 const lines = new Array(n);
8879 for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
8880 lines[i] = src.substr(o, lineWidth);
8883 value = lines.join(type === PlainValue$3.Type.BLOCK_LITERAL ? '\n' : ' ');
8886 return resolveSeq$2.stringifyString({
8890 }, ctx, onComment, onChompKeep);
8894 function parsePairs(doc, cst) {
8895 const seq = resolveSeq$2.resolveSeq(doc, cst);
8897 for (let i = 0; i < seq.items.length; ++i) {
8898 let item = seq.items[i];
8899 if (item instanceof resolveSeq$2.Pair) continue;else if (item instanceof resolveSeq$2.YAMLMap) {
8900 if (item.items.length > 1) {
8901 const msg = 'Each pair must have its own sequence indicator';
8902 throw new PlainValue$3.YAMLSemanticError(cst, msg);
8905 const pair = item.items[0] || new resolveSeq$2.Pair();
8906 if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
8907 if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
8910 seq.items[i] = item instanceof resolveSeq$2.Pair ? item : new resolveSeq$2.Pair(item);
8916 function createPairs(schema, iterable, ctx) {
8917 const pairs = new resolveSeq$2.YAMLSeq(schema);
8918 pairs.tag = 'tag:yaml.org,2002:pairs';
8920 for (const it of iterable) {
8923 if (Array.isArray(it)) {
8924 if (it.length === 2) {
8927 } else throw new TypeError(`Expected [key, value] tuple: ${it}`);
8928 } else if (it && it instanceof Object) {
8929 const keys = Object.keys(it);
8931 if (keys.length === 1) {
8934 } else throw new TypeError(`Expected { key: value } tuple: ${it}`);
8939 const pair = schema.createPair(key, value, ctx);
8940 pairs.items.push(pair);
8948 tag: 'tag:yaml.org,2002:pairs',
8949 resolve: parsePairs,
8950 createNode: createPairs
8953 class YAMLOMap extends resolveSeq$2.YAMLSeq {
8957 PlainValue$3._defineProperty(this, "add", resolveSeq$2.YAMLMap.prototype.add.bind(this));
8959 PlainValue$3._defineProperty(this, "delete", resolveSeq$2.YAMLMap.prototype.delete.bind(this));
8961 PlainValue$3._defineProperty(this, "get", resolveSeq$2.YAMLMap.prototype.get.bind(this));
8963 PlainValue$3._defineProperty(this, "has", resolveSeq$2.YAMLMap.prototype.has.bind(this));
8965 PlainValue$3._defineProperty(this, "set", resolveSeq$2.YAMLMap.prototype.set.bind(this));
8967 this.tag = YAMLOMap.tag;
8971 const map = new Map();
8972 if (ctx && ctx.onCreate) ctx.onCreate(map);
8974 for (const pair of this.items) {
8977 if (pair instanceof resolveSeq$2.Pair) {
8978 key = resolveSeq$2.toJSON(pair.key, '', ctx);
8979 value = resolveSeq$2.toJSON(pair.value, key, ctx);
8981 key = resolveSeq$2.toJSON(pair, '', ctx);
8984 if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
8985 map.set(key, value);
8993 PlainValue$3._defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap');
8995 function parseOMap(doc, cst) {
8996 const pairs = parsePairs(doc, cst);
8997 const seenKeys = [];
9002 if (key instanceof resolveSeq$2.Scalar) {
9003 if (seenKeys.includes(key.value)) {
9004 const msg = 'Ordered maps must not include duplicate keys';
9005 throw new PlainValue$3.YAMLSemanticError(cst, msg);
9007 seenKeys.push(key.value);
9012 return Object.assign(new YAMLOMap(), pairs);
9015 function createOMap(schema, iterable, ctx) {
9016 const pairs = createPairs(schema, iterable, ctx);
9017 const omap = new YAMLOMap();
9018 omap.items = pairs.items;
9023 identify: value => value instanceof Map,
9024 nodeClass: YAMLOMap,
9026 tag: 'tag:yaml.org,2002:omap',
9028 createNode: createOMap
9031 class YAMLSet extends resolveSeq$2.YAMLMap {
9034 this.tag = YAMLSet.tag;
9038 const pair = key instanceof resolveSeq$2.Pair ? key : new resolveSeq$2.Pair(key);
9039 const prev = resolveSeq$2.findPair(this.items, pair.key);
9040 if (!prev) this.items.push(pair);
9043 get(key, keepPair) {
9044 const pair = resolveSeq$2.findPair(this.items, key);
9045 return !keepPair && pair instanceof resolveSeq$2.Pair ? pair.key instanceof resolveSeq$2.Scalar ? pair.key.value : pair.key : pair;
9049 if (typeof value !== 'boolean') throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
9050 const prev = resolveSeq$2.findPair(this.items, key);
9052 if (prev && !value) {
9053 this.items.splice(this.items.indexOf(prev), 1);
9054 } else if (!prev && value) {
9055 this.items.push(new resolveSeq$2.Pair(key));
9060 return super.toJSON(_, ctx, Set);
9063 toString(ctx, onComment, onChompKeep) {
9064 if (!ctx) return JSON.stringify(this);
9065 if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
9070 PlainValue$3._defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
9072 function parseSet(doc, cst) {
9073 const map = resolveSeq$2.resolveMap(doc, cst);
9074 if (!map.hasAllNullValues()) throw new PlainValue$3.YAMLSemanticError(cst, 'Set items must all have null values');
9075 return Object.assign(new YAMLSet(), map);
9078 function createSet(schema, iterable, ctx) {
9079 const set = new YAMLSet();
9081 for (const value of iterable) set.items.push(schema.createPair(value, null, ctx));
9087 identify: value => value instanceof Set,
9090 tag: 'tag:yaml.org,2002:set',
9092 createNode: createSet
9095 const parseSexagesimal = (sign, parts) => {
9096 const n = parts.split(':').reduce((n, p) => n * 60 + Number(p), 0);
9097 return sign === '-' ? -n : n;
9098 }; // hhhh:mm:ss.sss
9101 const stringifySexagesimal = ({
9104 if (isNaN(value) || !isFinite(value)) return resolveSeq$2.stringifyNumber(value);
9109 value = Math.abs(value);
9112 const parts = [value % 60]; // seconds, including ms
9115 parts.unshift(0); // at least one : is required
9117 value = Math.round((value - parts[0]) / 60);
9118 parts.unshift(value % 60); // minutes
9121 value = Math.round((value - parts[0]) / 60);
9122 parts.unshift(value); // hours
9126 return sign + parts.map(n => n < 10 ? '0' + String(n) : String(n)).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
9131 identify: value => typeof value === 'number',
9133 tag: 'tag:yaml.org,2002:int',
9135 test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
9136 resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')),
9137 stringify: stringifySexagesimal
9140 identify: value => typeof value === 'number',
9142 tag: 'tag:yaml.org,2002:float',
9144 test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
9145 resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')),
9146 stringify: stringifySexagesimal
9149 identify: value => value instanceof Date,
9151 tag: 'tag:yaml.org,2002:timestamp',
9152 // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
9153 // may be omitted altogether, resulting in a date format. In such a case, the time part is
9154 // assumed to be 00:00:00Z (start of day, UTC).
9155 test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
9156 '(?:(?:t|T|[ \\t]+)' + // t | T | whitespace
9157 '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
9158 '(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
9160 resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
9161 if (millisec) millisec = (millisec + '00').substr(1, 3);
9162 let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
9164 if (tz && tz !== 'Z') {
9165 let d = parseSexagesimal(tz[0], tz.slice(1));
9166 if (Math.abs(d) < 30) d *= 60;
9170 return new Date(date);
9174 }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
9176 /* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */
9178 function shouldWarn(deprecation) {
9179 const env = typeof process !== 'undefined' && process.env || {};
9182 if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS;
9183 return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
9186 if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS;
9187 return !env.YAML_SILENCE_WARNINGS;
9190 function warn(warning, type) {
9191 if (shouldWarn(false)) {
9192 const emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
9193 // https://github.com/facebook/jest/issues/2549
9195 if (emit) emit(warning, type);else {
9196 // eslint-disable-next-line no-console
9197 console.warn(type ? `${type}: ${warning}` : warning);
9202 function warnFileDeprecation(filename) {
9203 if (shouldWarn(true)) {
9204 const path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
9205 warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning');
9211 function warnOptionDeprecation(name, alternative) {
9212 if (!warned[name] && shouldWarn(true)) {
9213 warned[name] = true;
9214 let msg = `The option '${name}' will be removed in a future release`;
9215 msg += alternative ? `, use '${alternative}' instead.` : '.';
9216 warn(msg, 'DeprecationWarning');
9220 warnings1000a372.binary = binary;
9221 warnings1000a372.floatTime = floatTime;
9222 warnings1000a372.intTime = intTime;
9223 warnings1000a372.omap = omap;
9224 warnings1000a372.pairs = pairs;
9225 warnings1000a372.set = set;
9226 warnings1000a372.timestamp = timestamp;
9227 warnings1000a372.warn = warn;
9228 warnings1000a372.warnFileDeprecation = warnFileDeprecation;
9229 warnings1000a372.warnOptionDeprecation = warnOptionDeprecation;
9231 var PlainValue$2 = PlainValueEc8e588e;
9232 var resolveSeq$1 = resolveSeqD03cb037;
9233 var warnings$1 = warnings1000a372;
9235 function createMap(schema, obj, ctx) {
9236 const map = new resolveSeq$1.YAMLMap(schema);
9238 if (obj instanceof Map) {
9239 for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx));
9240 } else if (obj && typeof obj === 'object') {
9241 for (const key of Object.keys(obj)) map.items.push(schema.createPair(key, obj[key], ctx));
9244 if (typeof schema.sortMapEntries === 'function') {
9245 map.items.sort(schema.sortMapEntries);
9252 createNode: createMap,
9254 nodeClass: resolveSeq$1.YAMLMap,
9255 tag: 'tag:yaml.org,2002:map',
9256 resolve: resolveSeq$1.resolveMap
9259 function createSeq(schema, obj, ctx) {
9260 const seq = new resolveSeq$1.YAMLSeq(schema);
9262 if (obj && obj[Symbol.iterator]) {
9263 for (const it of obj) {
9264 const v = schema.createNode(it, ctx.wrapScalars, null, ctx);
9273 createNode: createSeq,
9275 nodeClass: resolveSeq$1.YAMLSeq,
9276 tag: 'tag:yaml.org,2002:seq',
9277 resolve: resolveSeq$1.resolveSeq
9280 identify: value => typeof value === 'string',
9282 tag: 'tag:yaml.org,2002:str',
9283 resolve: resolveSeq$1.resolveString,
9285 stringify(item, ctx, onComment, onChompKeep) {
9286 ctx = Object.assign({
9289 return resolveSeq$1.stringifyString(item, ctx, onComment, onChompKeep);
9292 options: resolveSeq$1.strOptions
9294 const failsafe = [map, seq, string];
9297 const intIdentify$2 = value => typeof value === 'bigint' || Number.isInteger(value);
9299 const intResolve$1 = (src, part, radix) => resolveSeq$1.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
9301 function intStringify$1(node, radix, prefix) {
9305 if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix);
9306 return resolveSeq$1.stringifyNumber(node);
9310 identify: value => value == null,
9311 createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq$1.Scalar(null) : null,
9313 tag: 'tag:yaml.org,2002:null',
9314 test: /^(?:~|[Nn]ull|NULL)?$/,
9315 resolve: () => null,
9316 options: resolveSeq$1.nullOptions,
9317 stringify: () => resolveSeq$1.nullOptions.nullStr
9320 identify: value => typeof value === 'boolean',
9322 tag: 'tag:yaml.org,2002:bool',
9323 test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
9324 resolve: str => str[0] === 't' || str[0] === 'T',
9325 options: resolveSeq$1.boolOptions,
9328 }) => value ? resolveSeq$1.boolOptions.trueStr : resolveSeq$1.boolOptions.falseStr
9331 identify: value => intIdentify$2(value) && value >= 0,
9333 tag: 'tag:yaml.org,2002:int',
9335 test: /^0o([0-7]+)$/,
9336 resolve: (str, oct) => intResolve$1(str, oct, 8),
9337 options: resolveSeq$1.intOptions,
9338 stringify: node => intStringify$1(node, 8, '0o')
9341 identify: intIdentify$2,
9343 tag: 'tag:yaml.org,2002:int',
9344 test: /^[-+]?[0-9]+$/,
9345 resolve: str => intResolve$1(str, str, 10),
9346 options: resolveSeq$1.intOptions,
9347 stringify: resolveSeq$1.stringifyNumber
9350 identify: value => intIdentify$2(value) && value >= 0,
9352 tag: 'tag:yaml.org,2002:int',
9354 test: /^0x([0-9a-fA-F]+)$/,
9355 resolve: (str, hex) => intResolve$1(str, hex, 16),
9356 options: resolveSeq$1.intOptions,
9357 stringify: node => intStringify$1(node, 16, '0x')
9360 identify: value => typeof value === 'number',
9362 tag: 'tag:yaml.org,2002:float',
9363 test: /^(?:[-+]?\.inf|(\.nan))$/i,
9364 resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
9365 stringify: resolveSeq$1.stringifyNumber
9368 identify: value => typeof value === 'number',
9370 tag: 'tag:yaml.org,2002:float',
9372 test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
9373 resolve: str => parseFloat(str),
9376 }) => Number(value).toExponential()
9379 identify: value => typeof value === 'number',
9381 tag: 'tag:yaml.org,2002:float',
9382 test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
9384 resolve(str, frac1, frac2) {
9385 const frac = frac1 || frac2;
9386 const node = new resolveSeq$1.Scalar(parseFloat(str));
9387 if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
9391 stringify: resolveSeq$1.stringifyNumber
9393 const core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
9396 const intIdentify$1 = value => typeof value === 'bigint' || Number.isInteger(value);
9398 const stringifyJSON = ({
9400 }) => JSON.stringify(value);
9402 const json = [map, seq, {
9403 identify: value => typeof value === 'string',
9405 tag: 'tag:yaml.org,2002:str',
9406 resolve: resolveSeq$1.resolveString,
9407 stringify: stringifyJSON
9409 identify: value => value == null,
9410 createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq$1.Scalar(null) : null,
9412 tag: 'tag:yaml.org,2002:null',
9414 resolve: () => null,
9415 stringify: stringifyJSON
9417 identify: value => typeof value === 'boolean',
9419 tag: 'tag:yaml.org,2002:bool',
9420 test: /^true|false$/,
9421 resolve: str => str === 'true',
9422 stringify: stringifyJSON
9424 identify: intIdentify$1,
9426 tag: 'tag:yaml.org,2002:int',
9427 test: /^-?(?:0|[1-9][0-9]*)$/,
9428 resolve: str => resolveSeq$1.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
9431 }) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
9433 identify: value => typeof value === 'number',
9435 tag: 'tag:yaml.org,2002:float',
9436 test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
9437 resolve: str => parseFloat(str),
9438 stringify: stringifyJSON
9441 json.scalarFallback = str => {
9442 throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
9447 const boolStringify = ({
9449 }) => value ? resolveSeq$1.boolOptions.trueStr : resolveSeq$1.boolOptions.falseStr;
9451 const intIdentify = value => typeof value === 'bigint' || Number.isInteger(value);
9453 function intResolve(sign, src, radix) {
9454 let str = src.replace(/_/g, '');
9456 if (resolveSeq$1.intOptions.asBigInt) {
9471 const n = BigInt(str);
9472 return sign === '-' ? BigInt(-1) * n : n;
9475 const n = parseInt(str, radix);
9476 return sign === '-' ? -1 * n : n;
9479 function intStringify(node, radix, prefix) {
9484 if (intIdentify(value)) {
9485 const str = value.toString(radix);
9486 return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
9489 return resolveSeq$1.stringifyNumber(node);
9492 const yaml11 = failsafe.concat([{
9493 identify: value => value == null,
9494 createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq$1.Scalar(null) : null,
9496 tag: 'tag:yaml.org,2002:null',
9497 test: /^(?:~|[Nn]ull|NULL)?$/,
9498 resolve: () => null,
9499 options: resolveSeq$1.nullOptions,
9500 stringify: () => resolveSeq$1.nullOptions.nullStr
9502 identify: value => typeof value === 'boolean',
9504 tag: 'tag:yaml.org,2002:bool',
9505 test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
9506 resolve: () => true,
9507 options: resolveSeq$1.boolOptions,
9508 stringify: boolStringify
9510 identify: value => typeof value === 'boolean',
9512 tag: 'tag:yaml.org,2002:bool',
9513 test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
9514 resolve: () => false,
9515 options: resolveSeq$1.boolOptions,
9516 stringify: boolStringify
9518 identify: intIdentify,
9520 tag: 'tag:yaml.org,2002:int',
9522 test: /^([-+]?)0b([0-1_]+)$/,
9523 resolve: (str, sign, bin) => intResolve(sign, bin, 2),
9524 stringify: node => intStringify(node, 2, '0b')
9526 identify: intIdentify,
9528 tag: 'tag:yaml.org,2002:int',
9530 test: /^([-+]?)0([0-7_]+)$/,
9531 resolve: (str, sign, oct) => intResolve(sign, oct, 8),
9532 stringify: node => intStringify(node, 8, '0')
9534 identify: intIdentify,
9536 tag: 'tag:yaml.org,2002:int',
9537 test: /^([-+]?)([0-9][0-9_]*)$/,
9538 resolve: (str, sign, abs) => intResolve(sign, abs, 10),
9539 stringify: resolveSeq$1.stringifyNumber
9541 identify: intIdentify,
9543 tag: 'tag:yaml.org,2002:int',
9545 test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
9546 resolve: (str, sign, hex) => intResolve(sign, hex, 16),
9547 stringify: node => intStringify(node, 16, '0x')
9549 identify: value => typeof value === 'number',
9551 tag: 'tag:yaml.org,2002:float',
9552 test: /^(?:[-+]?\.inf|(\.nan))$/i,
9553 resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
9554 stringify: resolveSeq$1.stringifyNumber
9556 identify: value => typeof value === 'number',
9558 tag: 'tag:yaml.org,2002:float',
9560 test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
9561 resolve: str => parseFloat(str.replace(/_/g, '')),
9564 }) => Number(value).toExponential()
9566 identify: value => typeof value === 'number',
9568 tag: 'tag:yaml.org,2002:float',
9569 test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
9571 resolve(str, frac) {
9572 const node = new resolveSeq$1.Scalar(parseFloat(str.replace(/_/g, '')));
9575 const f = frac.replace(/_/g, '');
9576 if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
9582 stringify: resolveSeq$1.stringifyNumber
9583 }], warnings$1.binary, warnings$1.omap, warnings$1.pairs, warnings$1.set, warnings$1.intTime, warnings$1.floatTime, warnings$1.timestamp);
9591 binary: warnings$1.binary,
9596 floatTime: warnings$1.floatTime,
9600 intTime: warnings$1.intTime,
9603 omap: warnings$1.omap,
9604 pairs: warnings$1.pairs,
9606 set: warnings$1.set,
9607 timestamp: warnings$1.timestamp
9610 function findTagObject(value, tagName, tags) {
9612 const match = tags.filter(t => t.tag === tagName);
9613 const tagObj = match.find(t => !t.format) || match[0];
9614 if (!tagObj) throw new Error(`Tag ${tagName} not found`);
9616 } // TODO: deprecate/remove class check
9619 return tags.find(t => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
9622 function createNode$1(value, tagName, ctx) {
9623 if (value instanceof resolveSeq$1.Node) return value;
9631 if (tagName && tagName.startsWith('!!')) tagName = defaultPrefix + tagName.slice(2);
9632 let tagObj = findTagObject(value, tagName, schema.tags);
9635 if (typeof value.toJSON === 'function') value = value.toJSON();
9636 if (!value || typeof value !== 'object') return wrapScalars ? new resolveSeq$1.Scalar(value) : value;
9637 tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
9642 delete ctx.onTagObj;
9643 } // Detect duplicate references to the same object & use Alias nodes for all
9644 // after first. The `obj` wrapper allows for circular references to resolve.
9652 if (value && typeof value === 'object' && prevObjects) {
9653 const prev = prevObjects.get(value);
9656 const alias = new resolveSeq$1.Alias(prev); // leaves source dirty; must be cleaned by caller
9658 ctx.aliasNodes.push(alias); // defined along with prevObjects
9664 prevObjects.set(value, obj);
9667 obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq$1.Scalar(value) : value;
9668 if (tagName && obj.node instanceof resolveSeq$1.Node) obj.node.tag = tagName;
9672 function getSchemaTags(schemas, knownTags, customTags, schemaId) {
9673 let tags = schemas[schemaId.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11'
9676 const keys = Object.keys(schemas).map(key => JSON.stringify(key)).join(', ');
9677 throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`);
9680 if (Array.isArray(customTags)) {
9681 for (const tag of customTags) tags = tags.concat(tag);
9682 } else if (typeof customTags === 'function') {
9683 tags = customTags(tags.slice());
9686 for (let i = 0; i < tags.length; ++i) {
9687 const tag = tags[i];
9689 if (typeof tag === 'string') {
9690 const tagObj = knownTags[tag];
9693 const keys = Object.keys(knownTags).map(key => JSON.stringify(key)).join(', ');
9694 throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
9704 const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
9707 // TODO: remove in v2
9708 // TODO: remove in v2
9714 tags: deprecatedCustomTags
9716 this.merge = !!merge;
9718 this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
9719 if (!customTags && deprecatedCustomTags) warnings$1.warnOptionDeprecation('tags', 'customTags');
9720 this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema);
9723 createNode(value, wrapScalars, tagName, ctx) {
9725 defaultPrefix: Schema$2.defaultPrefix,
9729 const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
9730 return createNode$1(value, tagName, createCtx);
9733 createPair(key, value, ctx) {
9737 const k = this.createNode(key, ctx.wrapScalars, null, ctx);
9738 const v = this.createNode(value, ctx.wrapScalars, null, ctx);
9739 return new resolveSeq$1.Pair(k, v);
9744 PlainValue$2._defineProperty(Schema$2, "defaultPrefix", PlainValue$2.defaultTagPrefix);
9746 PlainValue$2._defineProperty(Schema$2, "defaultTags", PlainValue$2.defaultTags);
9748 Schema88e323a7.Schema = Schema$2;
9750 var PlainValue$1 = PlainValueEc8e588e;
9751 var resolveSeq = resolveSeqD03cb037;
9752 var Schema$1 = Schema88e323a7;
9753 const defaultOptions = {
9758 keepCstNodes: false,
9759 keepNodeTypes: true,
9760 keepBlobsInJSON: true,
9763 prettyErrors: false,
9764 // TODO Set true in v2
9768 const scalarOptions = {
9770 return resolveSeq.binaryOptions;
9774 Object.assign(resolveSeq.binaryOptions, opt);
9778 return resolveSeq.boolOptions;
9782 Object.assign(resolveSeq.boolOptions, opt);
9786 return resolveSeq.intOptions;
9790 Object.assign(resolveSeq.intOptions, opt);
9794 return resolveSeq.nullOptions;
9798 Object.assign(resolveSeq.nullOptions, opt);
9802 return resolveSeq.strOptions;
9806 Object.assign(resolveSeq.strOptions, opt);
9810 const documentOptions = {
9816 prefix: PlainValue$1.defaultTagPrefix
9819 prefix: 'tag:private.yaml.org,2002:'
9830 prefix: PlainValue$1.defaultTagPrefix
9841 prefix: PlainValue$1.defaultTagPrefix
9846 function stringifyTag(doc, tag) {
9847 if ((doc.version || doc.options.version) === '1.0') {
9848 const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
9849 if (priv) return '!' + priv[1];
9850 const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
9851 return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, '')}`;
9854 let p = doc.tagPrefixes.find(p => tag.indexOf(p.prefix) === 0);
9857 const dtp = doc.getDefaults().tagPrefixes;
9858 p = dtp && dtp.find(p => tag.indexOf(p.prefix) === 0);
9861 if (!p) return tag[0] === '!' ? tag : `!<${tag}>`;
9862 const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, ch => ({
9870 return p.handle + suffix;
9873 function getTagObject(tags, item) {
9874 if (item instanceof resolveSeq.Alias) return resolveSeq.Alias;
9877 const match = tags.filter(t => t.tag === item.tag);
9878 if (match.length > 0) return match.find(t => t.format === item.format) || match[0];
9883 if (item instanceof resolveSeq.Scalar) {
9884 obj = item.value; // TODO: deprecate/remove class check
9886 const match = tags.filter(t => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
9887 tagObj = match.find(t => t.format === item.format) || match.find(t => !t.format);
9890 tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
9894 const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
9895 throw new Error(`Tag not resolved for ${name} value`);
9899 } // needs to be called before value stringifier to allow for circular anchor refs
9902 function stringifyProps(node, tagObj, {
9907 const anchor = doc.anchors.getName(node);
9910 anchors[anchor] = node;
9911 props.push(`&${anchor}`);
9915 props.push(stringifyTag(doc, node.tag));
9916 } else if (!tagObj.default) {
9917 props.push(stringifyTag(doc, tagObj.tag));
9920 return props.join(' ');
9923 function stringify$1(item, ctx, onComment, onChompKeep) {
9930 if (!(item instanceof resolveSeq.Node)) {
9933 onTagObj: o => tagObj = o,
9934 prevObjects: new Map()
9936 item = schema.createNode(item, true, null, createCtx);
9938 for (const alias of createCtx.aliasNodes) {
9939 alias.source = alias.source.node;
9940 let name = anchors.getName(alias.source);
9943 name = anchors.newName();
9944 anchors.map[name] = alias.source;
9949 if (item instanceof resolveSeq.Pair) return item.toString(ctx, onComment, onChompKeep);
9950 if (!tagObj) tagObj = getTagObject(schema.tags, item);
9951 const props = stringifyProps(item, tagObj, ctx);
9952 if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
9953 const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
9954 if (!props) return str;
9955 return item instanceof resolveSeq.Scalar || str[0] === '{' || str[0] === '[' ? `${props} ${str}` : `${props}\n${ctx.indent}${str}`;
9959 static validAnchorNode(node) {
9960 return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap;
9963 constructor(prefix) {
9964 PlainValue$1._defineProperty(this, "map", Object.create(null));
9966 this.prefix = prefix;
9969 createAlias(node, name) {
9970 this.setAnchor(node, name);
9971 return new resolveSeq.Alias(node);
9974 createMergePair(...sources) {
9975 const merge = new resolveSeq.Merge();
9976 merge.value.items = sources.map(s => {
9977 if (s instanceof resolveSeq.Alias) {
9978 if (s.source instanceof resolveSeq.YAMLMap) return s;
9979 } else if (s instanceof resolveSeq.YAMLMap) {
9980 return this.createAlias(s);
9983 throw new Error('Merge sources must be Map nodes or their Aliases');
9992 return Object.keys(map).find(a => map[a] === node);
9996 return Object.keys(this.map);
10000 return this.map[name];
10004 if (!prefix) prefix = this.prefix;
10005 const names = Object.keys(this.map);
10007 for (let i = 1; true; ++i) {
10008 const name = `${prefix}${i}`;
10009 if (!names.includes(name)) return name;
10011 } // During parsing, map & aliases contain CST nodes
10019 Object.keys(map).forEach(a => {
10020 map[a] = map[a].resolved;
10023 _cstAliases.forEach(a => {
10024 a.source = a.source.resolved;
10027 delete this._cstAliases;
10030 setAnchor(node, name) {
10031 if (node != null && !Anchors.validAnchorNode(node)) {
10032 throw new Error('Anchors may only be set for Scalar, Seq and Map nodes');
10035 if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
10036 throw new Error('Anchor names must not contain whitespace or control characters');
10042 const prev = node && Object.keys(map).find(a => map[a] === node);
10047 } else if (prev !== name) {
10053 if (!node) return null;
10054 name = this.newName();
10065 const visit = (node, tags) => {
10066 if (node && typeof node === 'object') {
10071 if (node instanceof resolveSeq.Collection) {
10072 if (tag) tags[tag] = true;
10073 node.items.forEach(n => visit(n, tags));
10074 } else if (node instanceof resolveSeq.Pair) {
10075 visit(node.key, tags);
10076 visit(node.value, tags);
10077 } else if (node instanceof resolveSeq.Scalar) {
10078 if (tag) tags[tag] = true;
10085 const listTagNames = node => Object.keys(visit(node, {}));
10087 function parseContents(doc, contents) {
10092 let body = undefined;
10093 let spaceBefore = false;
10095 for (const node of contents) {
10096 if (node.valueRange) {
10097 if (body !== undefined) {
10098 const msg = 'Document contains trailing content not separated by a ... or --- line';
10099 doc.errors.push(new PlainValue$1.YAMLSyntaxError(node, msg));
10103 const res = resolveSeq.resolveNode(doc, node);
10106 res.spaceBefore = true;
10107 spaceBefore = false;
10111 } else if (node.comment !== null) {
10112 const cc = body === undefined ? comments.before : comments.after;
10113 cc.push(node.comment);
10114 } else if (node.type === PlainValue$1.Type.BLANK_LINE) {
10115 spaceBefore = true;
10117 if (body === undefined && comments.before.length > 0 && !doc.commentBefore) {
10118 // space-separated comments at start are parsed as document comments
10119 doc.commentBefore = comments.before.join('\n');
10120 comments.before = [];
10125 doc.contents = body || null;
10128 doc.comment = comments.before.concat(comments.after).join('\n') || null;
10130 const cb = comments.before.join('\n');
10133 const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body;
10134 cbNode.commentBefore = cbNode.commentBefore ? `${cb}\n${cbNode.commentBefore}` : cb;
10137 doc.comment = comments.after.join('\n') || null;
10141 function resolveTagDirective({
10144 const [handle, prefix] = directive.parameters;
10146 if (!handle || !prefix) {
10147 const msg = 'Insufficient parameters given for %TAG directive';
10148 throw new PlainValue$1.YAMLSemanticError(directive, msg);
10151 if (tagPrefixes.some(p => p.handle === handle)) {
10152 const msg = 'The %TAG directive must only be given at most once per handle in the same document.';
10153 throw new PlainValue$1.YAMLSemanticError(directive, msg);
10162 function resolveYamlDirective(doc, directive) {
10163 let [version] = directive.parameters;
10164 if (directive.name === 'YAML:1.0') version = '1.0';
10167 const msg = 'Insufficient parameters given for %YAML directive';
10168 throw new PlainValue$1.YAMLSemanticError(directive, msg);
10171 if (!documentOptions[version]) {
10172 const v0 = doc.version || doc.options.version;
10173 const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`;
10174 doc.warnings.push(new PlainValue$1.YAMLWarning(directive, msg));
10180 function parseDirectives(doc, directives, prevDoc) {
10181 const directiveComments = [];
10182 let hasDirectives = false;
10184 for (const directive of directives) {
10193 doc.tagPrefixes.push(resolveTagDirective(doc, directive));
10195 doc.errors.push(error);
10198 hasDirectives = true;
10204 const msg = 'The %YAML directive must only be given at most once per document.';
10205 doc.errors.push(new PlainValue$1.YAMLSemanticError(directive, msg));
10209 doc.version = resolveYamlDirective(doc, directive);
10211 doc.errors.push(error);
10214 hasDirectives = true;
10219 const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
10220 doc.warnings.push(new PlainValue$1.YAMLWarning(directive, msg));
10225 if (comment) directiveComments.push(comment);
10228 if (prevDoc && !hasDirectives && '1.1' === (doc.version || prevDoc.version || doc.options.version)) {
10229 const copyTagPrefix = ({
10237 doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
10238 doc.version = prevDoc.version;
10241 doc.commentBefore = directiveComments.join('\n') || null;
10244 function assertCollection(contents) {
10245 if (contents instanceof resolveSeq.Collection) return true;
10246 throw new Error('Expected a YAML collection as document contents');
10250 constructor(options) {
10251 this.anchors = new Anchors(options.anchorPrefix);
10252 this.commentBefore = null;
10253 this.comment = null;
10254 this.contents = null;
10255 this.directivesEndMarker = null;
10257 this.options = options;
10258 this.schema = null;
10259 this.tagPrefixes = [];
10260 this.version = null;
10261 this.warnings = [];
10265 assertCollection(this.contents);
10266 return this.contents.add(value);
10269 addIn(path, value) {
10270 assertCollection(this.contents);
10271 this.contents.addIn(path, value);
10275 assertCollection(this.contents);
10276 return this.contents.delete(key);
10280 if (resolveSeq.isEmptyPath(path)) {
10281 if (this.contents == null) return false;
10282 this.contents = null;
10286 assertCollection(this.contents);
10287 return this.contents.deleteIn(path);
10291 return Document$2.defaults[this.version] || Document$2.defaults[this.options.version] || {};
10294 get(key, keepScalar) {
10295 return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : undefined;
10298 getIn(path, keepScalar) {
10299 if (resolveSeq.isEmptyPath(path)) return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents;
10300 return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : undefined;
10304 return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false;
10308 if (resolveSeq.isEmptyPath(path)) return this.contents !== undefined;
10309 return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false;
10313 assertCollection(this.contents);
10314 this.contents.set(key, value);
10317 setIn(path, value) {
10318 if (resolveSeq.isEmptyPath(path)) this.contents = value;else {
10319 assertCollection(this.contents);
10320 this.contents.setIn(path, value);
10324 setSchema(id, customTags) {
10325 if (!id && !customTags && this.schema) return;
10326 if (typeof id === 'number') id = id.toFixed(1);
10328 if (id === '1.0' || id === '1.1' || id === '1.2') {
10329 if (this.version) this.version = id;else this.options.version = id;
10330 delete this.options.schema;
10331 } else if (id && typeof id === 'string') {
10332 this.options.schema = id;
10335 if (Array.isArray(customTags)) this.options.customTags = customTags;
10336 const opt = Object.assign({}, this.getDefaults(), this.options);
10337 this.schema = new Schema$1.Schema(opt);
10340 parse(node, prevDoc) {
10341 if (this.options.keepCstNodes) this.cstNode = node;
10342 if (this.options.keepNodeTypes) this.type = 'DOCUMENT';
10346 directivesEndMarker,
10352 if (!error.source) error.source = this;
10353 this.errors.push(error);
10356 parseDirectives(this, directives, prevDoc);
10357 if (directivesEndMarker) this.directivesEndMarker = true;
10358 this.range = valueRange ? [valueRange.start, valueRange.end] : null;
10360 this.anchors._cstAliases = [];
10361 parseContents(this, contents);
10362 this.anchors.resolveNodes();
10364 if (this.options.prettyErrors) {
10365 for (const error of this.errors) if (error instanceof PlainValue$1.YAMLError) error.makePretty();
10367 for (const warn of this.warnings) if (warn instanceof PlainValue$1.YAMLError) warn.makePretty();
10373 listNonDefaultTags() {
10374 return listTagNames(this.contents).filter(t => t.indexOf(Schema$1.Schema.defaultPrefix) !== 0);
10377 setTagPrefix(handle, prefix) {
10378 if (handle[0] !== '!' || handle[handle.length - 1] !== '!') throw new Error('Handle must start and end with !');
10381 const prev = this.tagPrefixes.find(p => p.handle === handle);
10382 if (prev) prev.prefix = prefix;else this.tagPrefixes.push({
10387 this.tagPrefixes = this.tagPrefixes.filter(p => p.handle !== handle);
10391 toJSON(arg, onAnchor) {
10397 const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof resolveSeq.Scalar));
10402 mapAsMap: keep && !!mapAsMap,
10404 stringify: stringify$1 // Requiring directly in Pair would create circular dependencies
10407 const anchorNames = Object.keys(this.anchors.map);
10408 if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map(name => [this.anchors.map[name], {
10413 const res = resolveSeq.toJSON(this.contents, arg, ctx);
10414 if (typeof onAnchor === 'function' && ctx.anchors) for (const {
10417 } of ctx.anchors.values()) onAnchor(res, count);
10422 if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
10423 const indentSize = this.options.indent;
10425 if (!Number.isInteger(indentSize) || indentSize <= 0) {
10426 const s = JSON.stringify(indentSize);
10427 throw new Error(`"indent" option must be a positive integer, not ${s}`);
10432 let hasDirectives = false;
10434 if (this.version) {
10435 let vd = '%YAML 1.2';
10437 if (this.schema.name === 'yaml-1.1') {
10438 if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1';
10442 hasDirectives = true;
10445 const tagNames = this.listNonDefaultTags();
10446 this.tagPrefixes.forEach(({
10450 if (tagNames.some(t => t.indexOf(prefix) === 0)) {
10451 lines.push(`%TAG ${handle} ${prefix}`);
10452 hasDirectives = true;
10455 if (hasDirectives || this.directivesEndMarker) lines.push('---');
10457 if (this.commentBefore) {
10458 if (hasDirectives || !this.directivesEndMarker) lines.unshift('');
10459 lines.unshift(this.commentBefore.replace(/^/gm, '#'));
10463 anchors: Object.create(null),
10466 indentStep: ' '.repeat(indentSize),
10467 stringify: stringify$1 // Requiring directly in nodes would create circular dependencies
10470 let chompKeep = false;
10471 let contentComment = null;
10473 if (this.contents) {
10474 if (this.contents instanceof resolveSeq.Node) {
10475 if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push('');
10476 if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
10478 ctx.forceBlockIndent = !!this.comment;
10479 contentComment = this.contents.comment;
10482 const onChompKeep = contentComment ? null : () => chompKeep = true;
10483 const body = stringify$1(this.contents, ctx, () => contentComment = null, onChompKeep);
10484 lines.push(resolveSeq.addComment(body, '', contentComment));
10485 } else if (this.contents !== undefined) {
10486 lines.push(stringify$1(this.contents, ctx));
10489 if (this.comment) {
10490 if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '') lines.push('');
10491 lines.push(this.comment.replace(/^/gm, '#'));
10494 return lines.join('\n') + '\n';
10499 PlainValue$1._defineProperty(Document$2, "defaults", documentOptions);
10501 Document9b4560a1.Document = Document$2;
10502 Document9b4560a1.defaultOptions = defaultOptions;
10503 Document9b4560a1.scalarOptions = scalarOptions;
10505 var parseCst = parseCst$1;
10506 var Document$1 = Document9b4560a1;
10507 var Schema = Schema88e323a7;
10508 var PlainValue = PlainValueEc8e588e;
10509 var warnings = warnings1000a372;
10511 function createNode(value, wrapScalars = true, tag) {
10512 if (tag === undefined && typeof wrapScalars === 'string') {
10514 wrapScalars = true;
10517 const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions);
10518 const schema = new Schema.Schema(options);
10519 return schema.createNode(value, wrapScalars, tag);
10522 class Document extends Document$1.Document {
10523 constructor(options) {
10524 super(Object.assign({}, Document$1.defaultOptions, options));
10529 function parseAllDocuments(src, options) {
10533 for (const cstDoc of parseCst.parse(src)) {
10534 const doc = new Document(options);
10535 doc.parse(cstDoc, prev);
10543 function parseDocument(src, options) {
10544 const cst = parseCst.parse(src);
10545 const doc = new Document(options).parse(cst[0]);
10547 if (cst.length > 1) {
10548 const errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()';
10549 doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg));
10555 function parse(src, options) {
10556 const doc = parseDocument(src, options);
10557 doc.warnings.forEach(warning => warnings.warn(warning));
10558 if (doc.errors.length > 0) throw doc.errors[0];
10559 return doc.toJSON();
10562 function stringify(value, options) {
10563 const doc = new Document(options);
10564 doc.contents = value;
10565 return String(doc);
10570 defaultOptions: Document$1.defaultOptions,
10574 parseCST: parseCst.parse,
10576 scalarOptions: Document$1.scalarOptions,
10581 var yaml$1 = dist.YAML;
10583 Object.defineProperty(loaders$1, "__esModule", {
10586 loaders$1.loaders = void 0;
10587 /* eslint-disable @typescript-eslint/no-require-imports */
10591 const loadJs = function loadJs(filepath) {
10592 if (importFresh === undefined) {
10593 importFresh = importFresh$1;
10596 const result = importFresh(filepath);
10602 const loadJson = function loadJson(filepath, content) {
10603 if (parseJson === undefined) {
10604 parseJson = parseJson_1;
10608 const result = parseJson(content);
10611 error.message = `JSON Error in ${filepath}:\n${error.message}`;
10618 const loadYaml = function loadYaml(filepath, content) {
10619 if (yaml === undefined) {
10624 const result = yaml.parse(content, {
10629 error.message = `YAML Error in ${filepath}:\n${error.message}`;
10639 loaders$1.loaders = loaders;
10641 var getPropertyByPath$1 = {};
10643 Object.defineProperty(getPropertyByPath$1, "__esModule", {
10646 getPropertyByPath$1.getPropertyByPath = getPropertyByPath; // Resolves property names or property paths defined with period-delimited
10647 // strings or arrays of strings. Property names that are found on the source
10648 // object are used directly (even if they include a period).
10649 // Nested property names that include periods, within a path, are only
10650 // understood in array paths.
10652 function getPropertyByPath(source, path) {
10653 if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
10654 return source[path];
10657 const parsedPath = typeof path === 'string' ? path.split('.') : path; // eslint-disable-next-line @typescript-eslint/no-explicit-any
10659 return parsedPath.reduce((previous, key) => {
10660 if (previous === undefined) {
10664 return previous[key];
10668 Object.defineProperty(ExplorerBase$1, "__esModule", {
10671 ExplorerBase$1.getExtensionDescription = getExtensionDescription;
10672 ExplorerBase$1.ExplorerBase = void 0;
10674 var _path$3 = _interopRequireDefault$5(require$$0__default["default"]);
10676 var _loaders$1 = loaders$1;
10677 var _getPropertyByPath = getPropertyByPath$1;
10679 function _interopRequireDefault$5(obj) {
10680 return obj && obj.__esModule ? obj : {
10685 class ExplorerBase {
10686 constructor(options) {
10687 if (options.cache === true) {
10688 this.loadCache = new Map();
10689 this.searchCache = new Map();
10692 this.config = options;
10693 this.validateConfig();
10697 if (this.loadCache) {
10698 this.loadCache.clear();
10702 clearSearchCache() {
10703 if (this.searchCache) {
10704 this.searchCache.clear();
10709 this.clearLoadCache();
10710 this.clearSearchCache();
10714 const config = this.config;
10715 config.searchPlaces.forEach(place => {
10716 const loaderKey = _path$3.default.extname(place) || 'noExt';
10717 const loader = config.loaders[loaderKey];
10720 throw new Error(`No loader specified for ${getExtensionDescription(place)}, so searchPlaces item "${place}" is invalid`);
10723 if (typeof loader !== 'function') {
10724 throw new Error(`loader for ${getExtensionDescription(place)} is not a function (type provided: "${typeof loader}"), so searchPlaces item "${place}" is invalid`);
10729 shouldSearchStopWithResult(result) {
10730 if (result === null) return false;
10731 if (result.isEmpty && this.config.ignoreEmptySearchPlaces) return false;
10735 nextDirectoryToSearch(currentDir, currentResult) {
10736 if (this.shouldSearchStopWithResult(currentResult)) {
10740 const nextDir = nextDirUp(currentDir);
10742 if (nextDir === currentDir || currentDir === this.config.stopDir) {
10749 loadPackageProp(filepath, content) {
10750 const parsedContent = _loaders$1.loaders.loadJson(filepath, content);
10752 const packagePropValue = (0, _getPropertyByPath.getPropertyByPath)(parsedContent, this.config.packageProp);
10753 return packagePropValue || null;
10756 getLoaderEntryForFile(filepath) {
10757 if (_path$3.default.basename(filepath) === 'package.json') {
10758 const loader = this.loadPackageProp.bind(this);
10762 const loaderKey = _path$3.default.extname(filepath) || 'noExt';
10763 const loader = this.config.loaders[loaderKey];
10766 throw new Error(`No loader specified for ${getExtensionDescription(filepath)}`);
10772 loadedContentToCosmiconfigResult(filepath, loadedContent) {
10773 if (loadedContent === null) {
10777 if (loadedContent === undefined) {
10786 config: loadedContent,
10791 validateFilePath(filepath) {
10793 throw new Error('load must pass a non-empty string');
10799 ExplorerBase$1.ExplorerBase = ExplorerBase;
10801 function nextDirUp(dir) {
10802 return _path$3.default.dirname(dir);
10805 function getExtensionDescription(filepath) {
10806 const ext = _path$3.default.extname(filepath);
10808 return ext ? `extension "${ext}"` : 'files without extensions';
10811 var readFile$1 = {};
10813 Object.defineProperty(readFile$1, "__esModule", {
10816 readFile$1.readFile = readFile;
10817 readFile$1.readFileSync = readFileSync;
10819 var _fs = _interopRequireDefault$4(require$$1__default["default"]);
10821 function _interopRequireDefault$4(obj) {
10822 return obj && obj.__esModule ? obj : {
10827 async function fsReadFileAsync(pathname, encoding) {
10828 return new Promise((resolve, reject) => {
10829 _fs.default.readFile(pathname, encoding, (error, contents) => {
10840 async function readFile(filepath, options = {}) {
10841 const throwNotFound = options.throwNotFound === true;
10844 const content = await fsReadFileAsync(filepath, 'utf8');
10847 if (throwNotFound === false && (error.code === 'ENOENT' || error.code === 'EISDIR')) {
10855 function readFileSync(filepath, options = {}) {
10856 const throwNotFound = options.throwNotFound === true;
10859 const content = _fs.default.readFileSync(filepath, 'utf8');
10863 if (throwNotFound === false && (error.code === 'ENOENT' || error.code === 'EISDIR')) {
10871 var cacheWrapper$1 = {};
10873 Object.defineProperty(cacheWrapper$1, "__esModule", {
10876 cacheWrapper$1.cacheWrapper = cacheWrapper;
10877 cacheWrapper$1.cacheWrapperSync = cacheWrapperSync;
10879 async function cacheWrapper(cache, key, fn) {
10880 const cached = cache.get(key);
10882 if (cached !== undefined) {
10886 const result = await fn();
10887 cache.set(key, result);
10891 function cacheWrapperSync(cache, key, fn) {
10892 const cached = cache.get(key);
10894 if (cached !== undefined) {
10898 const result = fn();
10899 cache.set(key, result);
10903 var getDirectory$1 = {};
10909 } = require$$0__default$1["default"];
10910 const fs = require$$1__default["default"];
10912 async function isType(fsStatType, statsMethodName, filePath) {
10913 if (typeof filePath !== 'string') {
10914 throw new TypeError(`Expected a string, got ${typeof filePath}`);
10918 const stats = await promisify(fs[fsStatType])(filePath);
10919 return stats[statsMethodName]();
10921 if (error.code === 'ENOENT') {
10929 function isTypeSync(fsStatType, statsMethodName, filePath) {
10930 if (typeof filePath !== 'string') {
10931 throw new TypeError(`Expected a string, got ${typeof filePath}`);
10935 return fs[fsStatType](filePath)[statsMethodName]();
10937 if (error.code === 'ENOENT') {
10945 pathType.isFile = isType.bind(null, 'stat', 'isFile');
10946 pathType.isDirectory = isType.bind(null, 'stat', 'isDirectory');
10947 pathType.isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
10948 pathType.isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
10949 pathType.isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
10950 pathType.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
10952 Object.defineProperty(getDirectory$1, "__esModule", {
10955 getDirectory$1.getDirectory = getDirectory;
10956 getDirectory$1.getDirectorySync = getDirectorySync;
10958 var _path$2 = _interopRequireDefault$3(require$$0__default["default"]);
10960 var _pathType = pathType;
10962 function _interopRequireDefault$3(obj) {
10963 return obj && obj.__esModule ? obj : {
10968 async function getDirectory(filepath) {
10969 const filePathIsDirectory = await (0, _pathType.isDirectory)(filepath);
10971 if (filePathIsDirectory === true) {
10975 const directory = _path$2.default.dirname(filepath);
10980 function getDirectorySync(filepath) {
10981 const filePathIsDirectory = (0, _pathType.isDirectorySync)(filepath);
10983 if (filePathIsDirectory === true) {
10987 const directory = _path$2.default.dirname(filepath);
10992 Object.defineProperty(Explorer$1, "__esModule", {
10995 Explorer$1.Explorer = void 0;
10997 var _path$1 = _interopRequireDefault$2(require$$0__default["default"]);
10999 var _ExplorerBase$1 = ExplorerBase$1;
11000 var _readFile$1 = readFile$1;
11001 var _cacheWrapper$1 = cacheWrapper$1;
11002 var _getDirectory$1 = getDirectory$1;
11004 function _interopRequireDefault$2(obj) {
11005 return obj && obj.__esModule ? obj : {
11010 class Explorer extends _ExplorerBase$1.ExplorerBase {
11011 constructor(options) {
11015 async search(searchFrom = process.cwd()) {
11016 const startDirectory = await (0, _getDirectory$1.getDirectory)(searchFrom);
11017 const result = await this.searchFromDirectory(startDirectory);
11021 async searchFromDirectory(dir) {
11022 const absoluteDir = _path$1.default.resolve(process.cwd(), dir);
11024 const run = async () => {
11025 const result = await this.searchDirectory(absoluteDir);
11026 const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
11029 return this.searchFromDirectory(nextDir);
11032 const transformResult = await this.config.transform(result);
11033 return transformResult;
11036 if (this.searchCache) {
11037 return (0, _cacheWrapper$1.cacheWrapper)(this.searchCache, absoluteDir, run);
11043 async searchDirectory(dir) {
11044 for await (const place of this.config.searchPlaces) {
11045 const placeResult = await this.loadSearchPlace(dir, place);
11047 if (this.shouldSearchStopWithResult(placeResult) === true) {
11048 return placeResult;
11050 } // config not found
11056 async loadSearchPlace(dir, place) {
11057 const filepath = _path$1.default.join(dir, place);
11059 const fileContents = await (0, _readFile$1.readFile)(filepath);
11060 const result = await this.createCosmiconfigResult(filepath, fileContents);
11064 async loadFileContent(filepath, content) {
11065 if (content === null) {
11069 if (content.trim() === '') {
11073 const loader = this.getLoaderEntryForFile(filepath);
11074 const loaderResult = await loader(filepath, content);
11075 return loaderResult;
11078 async createCosmiconfigResult(filepath, content) {
11079 const fileContent = await this.loadFileContent(filepath, content);
11080 const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
11084 async load(filepath) {
11085 this.validateFilePath(filepath);
11087 const absoluteFilePath = _path$1.default.resolve(process.cwd(), filepath);
11089 const runLoad = async () => {
11090 const fileContents = await (0, _readFile$1.readFile)(absoluteFilePath, {
11091 throwNotFound: true
11093 const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
11094 const transformResult = await this.config.transform(result);
11095 return transformResult;
11098 if (this.loadCache) {
11099 return (0, _cacheWrapper$1.cacheWrapper)(this.loadCache, absoluteFilePath, runLoad);
11107 Explorer$1.Explorer = Explorer;
11109 var ExplorerSync$1 = {};
11111 Object.defineProperty(ExplorerSync$1, "__esModule", {
11114 ExplorerSync$1.ExplorerSync = void 0;
11116 var _path = _interopRequireDefault$1(require$$0__default["default"]);
11118 var _ExplorerBase = ExplorerBase$1;
11119 var _readFile = readFile$1;
11120 var _cacheWrapper = cacheWrapper$1;
11121 var _getDirectory = getDirectory$1;
11123 function _interopRequireDefault$1(obj) {
11124 return obj && obj.__esModule ? obj : {
11129 class ExplorerSync extends _ExplorerBase.ExplorerBase {
11130 constructor(options) {
11134 searchSync(searchFrom = process.cwd()) {
11135 const startDirectory = (0, _getDirectory.getDirectorySync)(searchFrom);
11136 const result = this.searchFromDirectorySync(startDirectory);
11140 searchFromDirectorySync(dir) {
11141 const absoluteDir = _path.default.resolve(process.cwd(), dir);
11143 const run = () => {
11144 const result = this.searchDirectorySync(absoluteDir);
11145 const nextDir = this.nextDirectoryToSearch(absoluteDir, result);
11148 return this.searchFromDirectorySync(nextDir);
11151 const transformResult = this.config.transform(result);
11152 return transformResult;
11155 if (this.searchCache) {
11156 return (0, _cacheWrapper.cacheWrapperSync)(this.searchCache, absoluteDir, run);
11162 searchDirectorySync(dir) {
11163 for (const place of this.config.searchPlaces) {
11164 const placeResult = this.loadSearchPlaceSync(dir, place);
11166 if (this.shouldSearchStopWithResult(placeResult) === true) {
11167 return placeResult;
11169 } // config not found
11175 loadSearchPlaceSync(dir, place) {
11176 const filepath = _path.default.join(dir, place);
11178 const content = (0, _readFile.readFileSync)(filepath);
11179 const result = this.createCosmiconfigResultSync(filepath, content);
11183 loadFileContentSync(filepath, content) {
11184 if (content === null) {
11188 if (content.trim() === '') {
11192 const loader = this.getLoaderEntryForFile(filepath);
11193 const loaderResult = loader(filepath, content);
11194 return loaderResult;
11197 createCosmiconfigResultSync(filepath, content) {
11198 const fileContent = this.loadFileContentSync(filepath, content);
11199 const result = this.loadedContentToCosmiconfigResult(filepath, fileContent);
11203 loadSync(filepath) {
11204 this.validateFilePath(filepath);
11206 const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
11208 const runLoadSync = () => {
11209 const content = (0, _readFile.readFileSync)(absoluteFilePath, {
11210 throwNotFound: true
11212 const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
11213 const transformResult = this.config.transform(cosmiconfigResult);
11214 return transformResult;
11217 if (this.loadCache) {
11218 return (0, _cacheWrapper.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
11221 return runLoadSync();
11226 ExplorerSync$1.ExplorerSync = ExplorerSync;
11230 Object.defineProperty(types, "__esModule", {
11234 Object.defineProperty(dist$2, "__esModule", {
11237 dist$2.cosmiconfig = cosmiconfig;
11238 dist$2.cosmiconfigSync = cosmiconfigSync;
11239 dist$2.defaultLoaders = void 0;
11241 var _os = _interopRequireDefault(require$$0__default$2["default"]);
11243 var _Explorer = Explorer$1;
11244 var _ExplorerSync = ExplorerSync$1;
11245 var _loaders = loaders$1;
11247 function _interopRequireDefault(obj) {
11248 return obj && obj.__esModule ? obj : {
11252 /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
11253 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11256 function cosmiconfig(moduleName, options = {}) {
11257 const normalizedOptions = normalizeOptions(moduleName, options);
11258 const explorer = new _Explorer.Explorer(normalizedOptions);
11260 search: explorer.search.bind(explorer),
11261 load: explorer.load.bind(explorer),
11262 clearLoadCache: explorer.clearLoadCache.bind(explorer),
11263 clearSearchCache: explorer.clearSearchCache.bind(explorer),
11264 clearCaches: explorer.clearCaches.bind(explorer)
11266 } // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
11269 function cosmiconfigSync(moduleName, options = {}) {
11270 const normalizedOptions = normalizeOptions(moduleName, options);
11271 const explorerSync = new _ExplorerSync.ExplorerSync(normalizedOptions);
11273 search: explorerSync.searchSync.bind(explorerSync),
11274 load: explorerSync.loadSync.bind(explorerSync),
11275 clearLoadCache: explorerSync.clearLoadCache.bind(explorerSync),
11276 clearSearchCache: explorerSync.clearSearchCache.bind(explorerSync),
11277 clearCaches: explorerSync.clearCaches.bind(explorerSync)
11279 } // do not allow mutation of default loaders. Make sure it is set inside options
11282 const defaultLoaders = Object.freeze({
11283 '.cjs': _loaders.loaders.loadJs,
11284 '.js': _loaders.loaders.loadJs,
11285 '.json': _loaders.loaders.loadJson,
11286 '.yaml': _loaders.loaders.loadYaml,
11287 '.yml': _loaders.loaders.loadYaml,
11288 noExt: _loaders.loaders.loadYaml
11290 dist$2.defaultLoaders = defaultLoaders;
11292 const identity = function identity(x) {
11296 function normalizeOptions(moduleName, options) {
11298 packageProp: moduleName,
11299 searchPlaces: ['package.json', `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `.${moduleName}rc.cjs`, `${moduleName}.config.js`, `${moduleName}.config.cjs`],
11300 ignoreEmptySearchPlaces: true,
11301 stopDir: _os.default.homedir(),
11303 transform: identity,
11304 loaders: defaultLoaders
11306 const normalizedOptions = Object.assign(Object.assign(Object.assign({}, defaults), options), {}, {
11307 loaders: Object.assign(Object.assign({}, defaults.loaders), options.loaders)
11309 return normalizedOptions;
11312 var findParentDir = {exports: {}};
11314 (function (module, exports) {
11316 var path = require$$0__default["default"],
11317 fs = require$$1__default["default"],
11318 exists = fs.exists || path.exists,
11319 existsSync = fs.existsSync || path.existsSync;
11321 function splitPath(path) {
11322 var parts = path.split(/(\/|\\)/);
11323 if (!parts.length) return parts; // when path starts with a slash, the first part is empty string
11325 return !parts[0].length ? parts.slice(1) : parts;
11328 exports = module.exports = function (currentFullPath, clue, cb) {
11329 function testDir(parts) {
11330 if (parts.length === 0) return cb(null, null);
11331 var p = parts.join('');
11332 exists(path.join(p, clue), function (itdoes) {
11333 if (itdoes) return cb(null, p);
11334 testDir(parts.slice(0, -1));
11338 testDir(splitPath(currentFullPath));
11341 exports.sync = function (currentFullPath, clue) {
11342 function testDir(parts) {
11343 if (parts.length === 0) return null;
11344 var p = parts.join('');
11345 var itdoes = existsSync(path.join(p, clue));
11346 return itdoes ? p : testDir(parts.slice(0, -1));
11349 return testDir(splitPath(currentFullPath));
11351 })(findParentDir, findParentDir.exports);
11353 var getStdin = {exports: {}};
11359 getStdin.exports = async () => {
11366 stdin.setEncoding('utf8');
11368 for await (const chunk of stdin) {
11375 getStdin.exports.buffer = async () => {
11380 return Buffer.concat([]);
11383 for await (const chunk of stdin) {
11384 result.push(chunk);
11385 length += chunk.length;
11388 return Buffer.concat(result, length);
11396 constant: "APPVEYOR",
11398 pr: "APPVEYOR_PULL_REQUEST_NUMBER"
11401 name: "Azure Pipelines",
11402 constant: "AZURE_PIPELINES",
11403 env: "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",
11404 pr: "SYSTEM_PULLREQUEST_PULLREQUESTID"
11408 constant: "APPCIRCLE",
11409 env: "AC_APPCIRCLE"
11413 constant: "BAMBOO",
11414 env: "bamboo_planKey"
11417 name: "Bitbucket Pipelines",
11418 constant: "BITBUCKET",
11419 env: "BITBUCKET_COMMIT",
11420 pr: "BITBUCKET_PR_ID"
11424 constant: "BITRISE",
11426 pr: "BITRISE_PULL_REQUEST"
11431 env: "BUDDY_WORKSPACE_ID",
11432 pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
11436 constant: "BUILDKITE",
11439 env: "BUILDKITE_PULL_REQUEST",
11445 constant: "CIRCLE",
11447 pr: "CIRCLE_PULL_REQUEST"
11451 constant: "CIRRUS",
11456 name: "AWS CodeBuild",
11457 constant: "CODEBUILD",
11458 env: "CODEBUILD_BUILD_ARN"
11462 constant: "CODEFRESH",
11463 env: "CF_BUILD_ID",
11466 "CF_PULL_REQUEST_NUMBER",
11467 "CF_PULL_REQUEST_ID"
11473 constant: "CODESHIP",
11475 CI_NAME: "codeship"
11483 DRONE_BUILD_EVENT: "pull_request"
11492 name: "GitHub Actions",
11493 constant: "GITHUB_ACTIONS",
11494 env: "GITHUB_ACTIONS",
11496 GITHUB_EVENT_NAME: "pull_request"
11501 constant: "GITLAB",
11503 pr: "CI_MERGE_REQUEST_ID"
11508 env: "GO_PIPELINE_LABEL"
11512 constant: "LAYERCI",
11514 pr: "LAYERCI_PULL_REQUEST"
11518 constant: "HUDSON",
11523 constant: "JENKINS",
11537 constant: "MAGNUM",
11541 name: "Netlify CI",
11542 constant: "NETLIFY",
11545 env: "PULL_REQUEST",
11551 constant: "NEVERCODE",
11554 env: "NEVERCODE_PULL_REQUEST",
11560 constant: "RENDER",
11563 IS_PULL_REQUEST: "true"
11570 pr: "SAIL_PULL_REQUEST_NUMBER"
11574 constant: "SEMAPHORE",
11576 pr: "PULL_REQUEST_NUMBER"
11579 name: "Screwdriver",
11580 constant: "SCREWDRIVER",
11581 env: "SCREWDRIVER",
11583 env: "SD_PULL_REQUEST",
11589 constant: "SHIPPABLE",
11592 IS_PULL_REQUEST: "true"
11597 constant: "SOLANO",
11602 name: "Strider CD",
11603 constant: "STRIDER",
11607 name: "TaskCluster",
11608 constant: "TASKCLUSTER",
11616 constant: "TEAMCITY",
11617 env: "TEAMCITY_VERSION"
11621 constant: "TRAVIS",
11624 env: "TRAVIS_PULL_REQUEST",
11630 constant: "VERCEL",
11634 name: "Visual Studio App Center",
11635 constant: "APPCENTER",
11636 env: "APPCENTER_BUILD_ID"
11640 (function (exports) {
11642 const vendors = require$$0;
11643 const env = process.env; // Used for testing only
11645 Object.defineProperty(exports, '_vendors', {
11646 value: vendors.map(function (v) {
11650 exports.name = null;
11651 exports.isPR = null;
11652 vendors.forEach(function (vendor) {
11653 const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
11654 const isCI = envs.every(function (obj) {
11655 return checkEnv(obj);
11657 exports[vendor.constant] = isCI;
11660 exports.name = vendor.name;
11662 switch (typeof vendor.pr) {
11664 // "pr": "CIRRUS_PR"
11665 exports.isPR = !!env[vendor.pr];
11669 if ('env' in vendor.pr) {
11670 // "pr": { "env": "BUILDKITE_PULL_REQUEST", "ne": "false" }
11671 exports.isPR = vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
11672 } else if ('any' in vendor.pr) {
11673 // "pr": { "any": ["ghprbPullId", "CHANGE_ID"] }
11674 exports.isPR = vendor.pr.any.some(function (key) {
11678 // "pr": { "DRONE_BUILD_EVENT": "pull_request" }
11679 exports.isPR = checkEnv(vendor.pr);
11685 // PR detection not supported for this vendor
11686 exports.isPR = null;
11690 exports.isCI = !!(env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
11691 env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
11692 env.BUILD_NUMBER || // Jenkins, TeamCity
11693 env.RUN_ID || // TaskCluster, dsari
11694 exports.name || false);
11696 function checkEnv(obj) {
11697 if (typeof obj === 'string') return !!env[obj];
11698 return Object.keys(obj).every(function (k) {
11699 return env[k] === obj[k];
11705 cosmiconfig: dist$2.cosmiconfig,
11706 cosmiconfigSync: dist$2.cosmiconfigSync,
11707 findParentDir: findParentDir.exports.sync,
11708 getStdin: getStdin.exports,
11709 isCI: () => ciInfo.isCI
11712 module.exports = thirdParty;