15632 lines
510 KiB
JavaScript
Executable File
15632 lines
510 KiB
JavaScript
Executable File
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
var __commonJS = (cb, mod) => function __require() {
|
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
__markAsModule(target);
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __reExport = (target, module2, desc) => {
|
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
for (let key of __getOwnPropNames(module2))
|
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
}
|
|
return target;
|
|
};
|
|
var __toModule = (module2) => {
|
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
// node_modules/bail/index.js
|
|
var require_bail = __commonJS({
|
|
"node_modules/bail/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = bail;
|
|
function bail(err) {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/is-buffer/index.js
|
|
var require_is_buffer = __commonJS({
|
|
"node_modules/is-buffer/index.js"(exports, module2) {
|
|
module2.exports = function isBuffer(obj) {
|
|
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/extend/index.js
|
|
var require_extend = __commonJS({
|
|
"node_modules/extend/index.js"(exports, module2) {
|
|
"use strict";
|
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
var toStr = Object.prototype.toString;
|
|
var defineProperty = Object.defineProperty;
|
|
var gOPD = Object.getOwnPropertyDescriptor;
|
|
var isArray = function isArray2(arr) {
|
|
if (typeof Array.isArray === "function") {
|
|
return Array.isArray(arr);
|
|
}
|
|
return toStr.call(arr) === "[object Array]";
|
|
};
|
|
var isPlainObject = function isPlainObject2(obj) {
|
|
if (!obj || toStr.call(obj) !== "[object Object]") {
|
|
return false;
|
|
}
|
|
var hasOwnConstructor = hasOwn.call(obj, "constructor");
|
|
var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
|
|
if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
|
|
return false;
|
|
}
|
|
var key;
|
|
for (key in obj) {
|
|
}
|
|
return typeof key === "undefined" || hasOwn.call(obj, key);
|
|
};
|
|
var setProperty = function setProperty2(target, options) {
|
|
if (defineProperty && options.name === "__proto__") {
|
|
defineProperty(target, options.name, {
|
|
enumerable: true,
|
|
configurable: true,
|
|
value: options.newValue,
|
|
writable: true
|
|
});
|
|
} else {
|
|
target[options.name] = options.newValue;
|
|
}
|
|
};
|
|
var getProperty = function getProperty2(obj, name) {
|
|
if (name === "__proto__") {
|
|
if (!hasOwn.call(obj, name)) {
|
|
return void 0;
|
|
} else if (gOPD) {
|
|
return gOPD(obj, name).value;
|
|
}
|
|
}
|
|
return obj[name];
|
|
};
|
|
module2.exports = function extend() {
|
|
var options, name, src, copy, copyIsArray, clone;
|
|
var target = arguments[0];
|
|
var i = 1;
|
|
var length = arguments.length;
|
|
var deep = false;
|
|
if (typeof target === "boolean") {
|
|
deep = target;
|
|
target = arguments[1] || {};
|
|
i = 2;
|
|
}
|
|
if (target == null || typeof target !== "object" && typeof target !== "function") {
|
|
target = {};
|
|
}
|
|
for (; i < length; ++i) {
|
|
options = arguments[i];
|
|
if (options != null) {
|
|
for (name in options) {
|
|
src = getProperty(target, name);
|
|
copy = getProperty(options, name);
|
|
if (target !== copy) {
|
|
if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
|
|
if (copyIsArray) {
|
|
copyIsArray = false;
|
|
clone = src && isArray(src) ? src : [];
|
|
} else {
|
|
clone = src && isPlainObject(src) ? src : {};
|
|
}
|
|
setProperty(target, { name, newValue: extend(deep, clone, copy) });
|
|
} else if (typeof copy !== "undefined") {
|
|
setProperty(target, { name, newValue: copy });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return target;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/is-plain-obj/index.js
|
|
var require_is_plain_obj = __commonJS({
|
|
"node_modules/is-plain-obj/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = (value) => {
|
|
if (Object.prototype.toString.call(value) !== "[object Object]") {
|
|
return false;
|
|
}
|
|
const prototype = Object.getPrototypeOf(value);
|
|
return prototype === null || prototype === Object.prototype;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/trough/wrap.js
|
|
var require_wrap = __commonJS({
|
|
"node_modules/trough/wrap.js"(exports, module2) {
|
|
"use strict";
|
|
var slice = [].slice;
|
|
module2.exports = wrap;
|
|
function wrap(fn, callback) {
|
|
var invoked;
|
|
return wrapped;
|
|
function wrapped() {
|
|
var params = slice.call(arguments, 0);
|
|
var callback2 = fn.length > params.length;
|
|
var result;
|
|
if (callback2) {
|
|
params.push(done);
|
|
}
|
|
try {
|
|
result = fn.apply(null, params);
|
|
} catch (error) {
|
|
if (callback2 && invoked) {
|
|
throw error;
|
|
}
|
|
return done(error);
|
|
}
|
|
if (!callback2) {
|
|
if (result && typeof result.then === "function") {
|
|
result.then(then, done);
|
|
} else if (result instanceof Error) {
|
|
done(result);
|
|
} else {
|
|
then(result);
|
|
}
|
|
}
|
|
}
|
|
function done() {
|
|
if (!invoked) {
|
|
invoked = true;
|
|
callback.apply(null, arguments);
|
|
}
|
|
}
|
|
function then(value) {
|
|
done(null, value);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/trough/index.js
|
|
var require_trough = __commonJS({
|
|
"node_modules/trough/index.js"(exports, module2) {
|
|
"use strict";
|
|
var wrap = require_wrap();
|
|
module2.exports = trough;
|
|
trough.wrap = wrap;
|
|
var slice = [].slice;
|
|
function trough() {
|
|
var fns = [];
|
|
var middleware = {};
|
|
middleware.run = run;
|
|
middleware.use = use;
|
|
return middleware;
|
|
function run() {
|
|
var index = -1;
|
|
var input = slice.call(arguments, 0, -1);
|
|
var done = arguments[arguments.length - 1];
|
|
if (typeof done !== "function") {
|
|
throw new Error("Expected function as last argument, not " + done);
|
|
}
|
|
next.apply(null, [null].concat(input));
|
|
function next(err) {
|
|
var fn = fns[++index];
|
|
var params = slice.call(arguments, 0);
|
|
var values = params.slice(1);
|
|
var length = input.length;
|
|
var pos = -1;
|
|
if (err) {
|
|
done(err);
|
|
return;
|
|
}
|
|
while (++pos < length) {
|
|
if (values[pos] === null || values[pos] === void 0) {
|
|
values[pos] = input[pos];
|
|
}
|
|
}
|
|
input = values;
|
|
if (fn) {
|
|
wrap(fn, next).apply(null, input);
|
|
} else {
|
|
done.apply(null, [null].concat(input));
|
|
}
|
|
}
|
|
}
|
|
function use(fn) {
|
|
if (typeof fn !== "function") {
|
|
throw new Error("Expected `fn` to be a function, not " + fn);
|
|
}
|
|
fns.push(fn);
|
|
return middleware;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/unist-util-stringify-position/index.js
|
|
var require_unist_util_stringify_position = __commonJS({
|
|
"node_modules/unist-util-stringify-position/index.js"(exports, module2) {
|
|
"use strict";
|
|
var own = {}.hasOwnProperty;
|
|
module2.exports = stringify4;
|
|
function stringify4(value) {
|
|
if (!value || typeof value !== "object") {
|
|
return "";
|
|
}
|
|
if (own.call(value, "position") || own.call(value, "type")) {
|
|
return position(value.position);
|
|
}
|
|
if (own.call(value, "start") || own.call(value, "end")) {
|
|
return position(value);
|
|
}
|
|
if (own.call(value, "line") || own.call(value, "column")) {
|
|
return point(value);
|
|
}
|
|
return "";
|
|
}
|
|
function point(point2) {
|
|
if (!point2 || typeof point2 !== "object") {
|
|
point2 = {};
|
|
}
|
|
return index(point2.line) + ":" + index(point2.column);
|
|
}
|
|
function position(pos) {
|
|
if (!pos || typeof pos !== "object") {
|
|
pos = {};
|
|
}
|
|
return point(pos.start) + "-" + point(pos.end);
|
|
}
|
|
function index(value) {
|
|
return value && typeof value === "number" ? value : 1;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/vfile-message/index.js
|
|
var require_vfile_message = __commonJS({
|
|
"node_modules/vfile-message/index.js"(exports, module2) {
|
|
"use strict";
|
|
var stringify4 = require_unist_util_stringify_position();
|
|
module2.exports = VMessage;
|
|
function VMessagePrototype() {
|
|
}
|
|
VMessagePrototype.prototype = Error.prototype;
|
|
VMessage.prototype = new VMessagePrototype();
|
|
var proto = VMessage.prototype;
|
|
proto.file = "";
|
|
proto.name = "";
|
|
proto.reason = "";
|
|
proto.message = "";
|
|
proto.stack = "";
|
|
proto.fatal = null;
|
|
proto.column = null;
|
|
proto.line = null;
|
|
function VMessage(reason, position, origin) {
|
|
var parts;
|
|
var range;
|
|
var location;
|
|
if (typeof position === "string") {
|
|
origin = position;
|
|
position = null;
|
|
}
|
|
parts = parseOrigin(origin);
|
|
range = stringify4(position) || "1:1";
|
|
location = {
|
|
start: { line: null, column: null },
|
|
end: { line: null, column: null }
|
|
};
|
|
if (position && position.position) {
|
|
position = position.position;
|
|
}
|
|
if (position) {
|
|
if (position.start) {
|
|
location = position;
|
|
position = position.start;
|
|
} else {
|
|
location.start = position;
|
|
}
|
|
}
|
|
if (reason.stack) {
|
|
this.stack = reason.stack;
|
|
reason = reason.message;
|
|
}
|
|
this.message = reason;
|
|
this.name = range;
|
|
this.reason = reason;
|
|
this.line = position ? position.line : null;
|
|
this.column = position ? position.column : null;
|
|
this.location = location;
|
|
this.source = parts[0];
|
|
this.ruleId = parts[1];
|
|
}
|
|
function parseOrigin(origin) {
|
|
var result = [null, null];
|
|
var index;
|
|
if (typeof origin === "string") {
|
|
index = origin.indexOf(":");
|
|
if (index === -1) {
|
|
result[1] = origin;
|
|
} else {
|
|
result[0] = origin.slice(0, index);
|
|
result[1] = origin.slice(index + 1);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/vfile/lib/minpath.browser.js
|
|
var require_minpath_browser = __commonJS({
|
|
"node_modules/vfile/lib/minpath.browser.js"(exports) {
|
|
"use strict";
|
|
exports.basename = basename;
|
|
exports.dirname = dirname;
|
|
exports.extname = extname;
|
|
exports.join = join;
|
|
exports.sep = "/";
|
|
function basename(path, ext) {
|
|
var start = 0;
|
|
var end = -1;
|
|
var index;
|
|
var firstNonSlashEnd;
|
|
var seenNonSlash;
|
|
var extIndex;
|
|
if (ext !== void 0 && typeof ext !== "string") {
|
|
throw new TypeError('"ext" argument must be a string');
|
|
}
|
|
assertPath(path);
|
|
index = path.length;
|
|
if (ext === void 0 || !ext.length || ext.length > path.length) {
|
|
while (index--) {
|
|
if (path.charCodeAt(index) === 47) {
|
|
if (seenNonSlash) {
|
|
start = index + 1;
|
|
break;
|
|
}
|
|
} else if (end < 0) {
|
|
seenNonSlash = true;
|
|
end = index + 1;
|
|
}
|
|
}
|
|
return end < 0 ? "" : path.slice(start, end);
|
|
}
|
|
if (ext === path) {
|
|
return "";
|
|
}
|
|
firstNonSlashEnd = -1;
|
|
extIndex = ext.length - 1;
|
|
while (index--) {
|
|
if (path.charCodeAt(index) === 47) {
|
|
if (seenNonSlash) {
|
|
start = index + 1;
|
|
break;
|
|
}
|
|
} else {
|
|
if (firstNonSlashEnd < 0) {
|
|
seenNonSlash = true;
|
|
firstNonSlashEnd = index + 1;
|
|
}
|
|
if (extIndex > -1) {
|
|
if (path.charCodeAt(index) === ext.charCodeAt(extIndex--)) {
|
|
if (extIndex < 0) {
|
|
end = index;
|
|
}
|
|
} else {
|
|
extIndex = -1;
|
|
end = firstNonSlashEnd;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (start === end) {
|
|
end = firstNonSlashEnd;
|
|
} else if (end < 0) {
|
|
end = path.length;
|
|
}
|
|
return path.slice(start, end);
|
|
}
|
|
function dirname(path) {
|
|
var end;
|
|
var unmatchedSlash;
|
|
var index;
|
|
assertPath(path);
|
|
if (!path.length) {
|
|
return ".";
|
|
}
|
|
end = -1;
|
|
index = path.length;
|
|
while (--index) {
|
|
if (path.charCodeAt(index) === 47) {
|
|
if (unmatchedSlash) {
|
|
end = index;
|
|
break;
|
|
}
|
|
} else if (!unmatchedSlash) {
|
|
unmatchedSlash = true;
|
|
}
|
|
}
|
|
return end < 0 ? path.charCodeAt(0) === 47 ? "/" : "." : end === 1 && path.charCodeAt(0) === 47 ? "//" : path.slice(0, end);
|
|
}
|
|
function extname(path) {
|
|
var startDot = -1;
|
|
var startPart = 0;
|
|
var end = -1;
|
|
var preDotState = 0;
|
|
var unmatchedSlash;
|
|
var code;
|
|
var index;
|
|
assertPath(path);
|
|
index = path.length;
|
|
while (index--) {
|
|
code = path.charCodeAt(index);
|
|
if (code === 47) {
|
|
if (unmatchedSlash) {
|
|
startPart = index + 1;
|
|
break;
|
|
}
|
|
continue;
|
|
}
|
|
if (end < 0) {
|
|
unmatchedSlash = true;
|
|
end = index + 1;
|
|
}
|
|
if (code === 46) {
|
|
if (startDot < 0) {
|
|
startDot = index;
|
|
} else if (preDotState !== 1) {
|
|
preDotState = 1;
|
|
}
|
|
} else if (startDot > -1) {
|
|
preDotState = -1;
|
|
}
|
|
}
|
|
if (startDot < 0 || end < 0 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
return "";
|
|
}
|
|
return path.slice(startDot, end);
|
|
}
|
|
function join() {
|
|
var index = -1;
|
|
var joined;
|
|
while (++index < arguments.length) {
|
|
assertPath(arguments[index]);
|
|
if (arguments[index]) {
|
|
joined = joined === void 0 ? arguments[index] : joined + "/" + arguments[index];
|
|
}
|
|
}
|
|
return joined === void 0 ? "." : normalize(joined);
|
|
}
|
|
function normalize(path) {
|
|
var absolute;
|
|
var value;
|
|
assertPath(path);
|
|
absolute = path.charCodeAt(0) === 47;
|
|
value = normalizeString(path, !absolute);
|
|
if (!value.length && !absolute) {
|
|
value = ".";
|
|
}
|
|
if (value.length && path.charCodeAt(path.length - 1) === 47) {
|
|
value += "/";
|
|
}
|
|
return absolute ? "/" + value : value;
|
|
}
|
|
function normalizeString(path, allowAboveRoot) {
|
|
var result = "";
|
|
var lastSegmentLength = 0;
|
|
var lastSlash = -1;
|
|
var dots = 0;
|
|
var index = -1;
|
|
var code;
|
|
var lastSlashIndex;
|
|
while (++index <= path.length) {
|
|
if (index < path.length) {
|
|
code = path.charCodeAt(index);
|
|
} else if (code === 47) {
|
|
break;
|
|
} else {
|
|
code = 47;
|
|
}
|
|
if (code === 47) {
|
|
if (lastSlash === index - 1 || dots === 1) {
|
|
} else if (lastSlash !== index - 1 && dots === 2) {
|
|
if (result.length < 2 || lastSegmentLength !== 2 || result.charCodeAt(result.length - 1) !== 46 || result.charCodeAt(result.length - 2) !== 46) {
|
|
if (result.length > 2) {
|
|
lastSlashIndex = result.lastIndexOf("/");
|
|
if (lastSlashIndex !== result.length - 1) {
|
|
if (lastSlashIndex < 0) {
|
|
result = "";
|
|
lastSegmentLength = 0;
|
|
} else {
|
|
result = result.slice(0, lastSlashIndex);
|
|
lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
|
|
}
|
|
lastSlash = index;
|
|
dots = 0;
|
|
continue;
|
|
}
|
|
} else if (result.length) {
|
|
result = "";
|
|
lastSegmentLength = 0;
|
|
lastSlash = index;
|
|
dots = 0;
|
|
continue;
|
|
}
|
|
}
|
|
if (allowAboveRoot) {
|
|
result = result.length ? result + "/.." : "..";
|
|
lastSegmentLength = 2;
|
|
}
|
|
} else {
|
|
if (result.length) {
|
|
result += "/" + path.slice(lastSlash + 1, index);
|
|
} else {
|
|
result = path.slice(lastSlash + 1, index);
|
|
}
|
|
lastSegmentLength = index - lastSlash - 1;
|
|
}
|
|
lastSlash = index;
|
|
dots = 0;
|
|
} else if (code === 46 && dots > -1) {
|
|
dots++;
|
|
} else {
|
|
dots = -1;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function assertPath(path) {
|
|
if (typeof path !== "string") {
|
|
throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/vfile/lib/minproc.browser.js
|
|
var require_minproc_browser = __commonJS({
|
|
"node_modules/vfile/lib/minproc.browser.js"(exports) {
|
|
"use strict";
|
|
exports.cwd = cwd;
|
|
function cwd() {
|
|
return "/";
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/vfile/lib/core.js
|
|
var require_core = __commonJS({
|
|
"node_modules/vfile/lib/core.js"(exports, module2) {
|
|
"use strict";
|
|
var p = require_minpath_browser();
|
|
var proc = require_minproc_browser();
|
|
var buffer = require_is_buffer();
|
|
module2.exports = VFile;
|
|
var own = {}.hasOwnProperty;
|
|
var order = ["history", "path", "basename", "stem", "extname", "dirname"];
|
|
VFile.prototype.toString = toString;
|
|
Object.defineProperty(VFile.prototype, "path", { get: getPath, set: setPath });
|
|
Object.defineProperty(VFile.prototype, "dirname", {
|
|
get: getDirname,
|
|
set: setDirname
|
|
});
|
|
Object.defineProperty(VFile.prototype, "basename", {
|
|
get: getBasename,
|
|
set: setBasename
|
|
});
|
|
Object.defineProperty(VFile.prototype, "extname", {
|
|
get: getExtname,
|
|
set: setExtname
|
|
});
|
|
Object.defineProperty(VFile.prototype, "stem", { get: getStem, set: setStem });
|
|
function VFile(options) {
|
|
var prop;
|
|
var index;
|
|
if (!options) {
|
|
options = {};
|
|
} else if (typeof options === "string" || buffer(options)) {
|
|
options = { contents: options };
|
|
} else if ("message" in options && "messages" in options) {
|
|
return options;
|
|
}
|
|
if (!(this instanceof VFile)) {
|
|
return new VFile(options);
|
|
}
|
|
this.data = {};
|
|
this.messages = [];
|
|
this.history = [];
|
|
this.cwd = proc.cwd();
|
|
index = -1;
|
|
while (++index < order.length) {
|
|
prop = order[index];
|
|
if (own.call(options, prop)) {
|
|
this[prop] = options[prop];
|
|
}
|
|
}
|
|
for (prop in options) {
|
|
if (order.indexOf(prop) < 0) {
|
|
this[prop] = options[prop];
|
|
}
|
|
}
|
|
}
|
|
function getPath() {
|
|
return this.history[this.history.length - 1];
|
|
}
|
|
function setPath(path) {
|
|
assertNonEmpty(path, "path");
|
|
if (this.path !== path) {
|
|
this.history.push(path);
|
|
}
|
|
}
|
|
function getDirname() {
|
|
return typeof this.path === "string" ? p.dirname(this.path) : void 0;
|
|
}
|
|
function setDirname(dirname) {
|
|
assertPath(this.path, "dirname");
|
|
this.path = p.join(dirname || "", this.basename);
|
|
}
|
|
function getBasename() {
|
|
return typeof this.path === "string" ? p.basename(this.path) : void 0;
|
|
}
|
|
function setBasename(basename) {
|
|
assertNonEmpty(basename, "basename");
|
|
assertPart(basename, "basename");
|
|
this.path = p.join(this.dirname || "", basename);
|
|
}
|
|
function getExtname() {
|
|
return typeof this.path === "string" ? p.extname(this.path) : void 0;
|
|
}
|
|
function setExtname(extname) {
|
|
assertPart(extname, "extname");
|
|
assertPath(this.path, "extname");
|
|
if (extname) {
|
|
if (extname.charCodeAt(0) !== 46) {
|
|
throw new Error("`extname` must start with `.`");
|
|
}
|
|
if (extname.indexOf(".", 1) > -1) {
|
|
throw new Error("`extname` cannot contain multiple dots");
|
|
}
|
|
}
|
|
this.path = p.join(this.dirname, this.stem + (extname || ""));
|
|
}
|
|
function getStem() {
|
|
return typeof this.path === "string" ? p.basename(this.path, this.extname) : void 0;
|
|
}
|
|
function setStem(stem) {
|
|
assertNonEmpty(stem, "stem");
|
|
assertPart(stem, "stem");
|
|
this.path = p.join(this.dirname || "", stem + (this.extname || ""));
|
|
}
|
|
function toString(encoding) {
|
|
return (this.contents || "").toString(encoding);
|
|
}
|
|
function assertPart(part, name) {
|
|
if (part && part.indexOf(p.sep) > -1) {
|
|
throw new Error("`" + name + "` cannot be a path: did not expect `" + p.sep + "`");
|
|
}
|
|
}
|
|
function assertNonEmpty(part, name) {
|
|
if (!part) {
|
|
throw new Error("`" + name + "` cannot be empty");
|
|
}
|
|
}
|
|
function assertPath(path, name) {
|
|
if (!path) {
|
|
throw new Error("Setting `" + name + "` requires `path` to be set too");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/vfile/lib/index.js
|
|
var require_lib = __commonJS({
|
|
"node_modules/vfile/lib/index.js"(exports, module2) {
|
|
"use strict";
|
|
var VMessage = require_vfile_message();
|
|
var VFile = require_core();
|
|
module2.exports = VFile;
|
|
VFile.prototype.message = message;
|
|
VFile.prototype.info = info;
|
|
VFile.prototype.fail = fail;
|
|
function message(reason, position, origin) {
|
|
var message2 = new VMessage(reason, position, origin);
|
|
if (this.path) {
|
|
message2.name = this.path + ":" + message2.name;
|
|
message2.file = this.path;
|
|
}
|
|
message2.fatal = false;
|
|
this.messages.push(message2);
|
|
return message2;
|
|
}
|
|
function fail() {
|
|
var message2 = this.message.apply(this, arguments);
|
|
message2.fatal = true;
|
|
throw message2;
|
|
}
|
|
function info() {
|
|
var message2 = this.message.apply(this, arguments);
|
|
message2.fatal = null;
|
|
return message2;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/vfile/index.js
|
|
var require_vfile = __commonJS({
|
|
"node_modules/vfile/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = require_lib();
|
|
}
|
|
});
|
|
|
|
// node_modules/unified/index.js
|
|
var require_unified = __commonJS({
|
|
"node_modules/unified/index.js"(exports, module2) {
|
|
"use strict";
|
|
var bail = require_bail();
|
|
var buffer = require_is_buffer();
|
|
var extend = require_extend();
|
|
var plain = require_is_plain_obj();
|
|
var trough = require_trough();
|
|
var vfile = require_vfile();
|
|
module2.exports = unified().freeze();
|
|
var slice = [].slice;
|
|
var own = {}.hasOwnProperty;
|
|
var pipeline = trough().use(pipelineParse).use(pipelineRun).use(pipelineStringify);
|
|
function pipelineParse(p, ctx) {
|
|
ctx.tree = p.parse(ctx.file);
|
|
}
|
|
function pipelineRun(p, ctx, next) {
|
|
p.run(ctx.tree, ctx.file, done);
|
|
function done(error, tree, file) {
|
|
if (error) {
|
|
next(error);
|
|
} else {
|
|
ctx.tree = tree;
|
|
ctx.file = file;
|
|
next();
|
|
}
|
|
}
|
|
}
|
|
function pipelineStringify(p, ctx) {
|
|
var result = p.stringify(ctx.tree, ctx.file);
|
|
if (result === void 0 || result === null) {
|
|
} else if (typeof result === "string" || buffer(result)) {
|
|
if ("value" in ctx.file) {
|
|
ctx.file.value = result;
|
|
}
|
|
ctx.file.contents = result;
|
|
} else {
|
|
ctx.file.result = result;
|
|
}
|
|
}
|
|
function unified() {
|
|
var attachers = [];
|
|
var transformers = trough();
|
|
var namespace = {};
|
|
var freezeIndex = -1;
|
|
var frozen;
|
|
processor.data = data;
|
|
processor.freeze = freeze;
|
|
processor.attachers = attachers;
|
|
processor.use = use;
|
|
processor.parse = parse3;
|
|
processor.stringify = stringify4;
|
|
processor.run = run;
|
|
processor.runSync = runSync;
|
|
processor.process = process2;
|
|
processor.processSync = processSync;
|
|
return processor;
|
|
function processor() {
|
|
var destination = unified();
|
|
var index = -1;
|
|
while (++index < attachers.length) {
|
|
destination.use.apply(null, attachers[index]);
|
|
}
|
|
destination.data(extend(true, {}, namespace));
|
|
return destination;
|
|
}
|
|
function freeze() {
|
|
var values;
|
|
var transformer;
|
|
if (frozen) {
|
|
return processor;
|
|
}
|
|
while (++freezeIndex < attachers.length) {
|
|
values = attachers[freezeIndex];
|
|
if (values[1] === false) {
|
|
continue;
|
|
}
|
|
if (values[1] === true) {
|
|
values[1] = void 0;
|
|
}
|
|
transformer = values[0].apply(processor, values.slice(1));
|
|
if (typeof transformer === "function") {
|
|
transformers.use(transformer);
|
|
}
|
|
}
|
|
frozen = true;
|
|
freezeIndex = Infinity;
|
|
return processor;
|
|
}
|
|
function data(key, value) {
|
|
if (typeof key === "string") {
|
|
if (arguments.length === 2) {
|
|
assertUnfrozen("data", frozen);
|
|
namespace[key] = value;
|
|
return processor;
|
|
}
|
|
return own.call(namespace, key) && namespace[key] || null;
|
|
}
|
|
if (key) {
|
|
assertUnfrozen("data", frozen);
|
|
namespace = key;
|
|
return processor;
|
|
}
|
|
return namespace;
|
|
}
|
|
function use(value) {
|
|
var settings;
|
|
assertUnfrozen("use", frozen);
|
|
if (value === null || value === void 0) {
|
|
} else if (typeof value === "function") {
|
|
addPlugin.apply(null, arguments);
|
|
} else if (typeof value === "object") {
|
|
if ("length" in value) {
|
|
addList(value);
|
|
} else {
|
|
addPreset(value);
|
|
}
|
|
} else {
|
|
throw new Error("Expected usable value, not `" + value + "`");
|
|
}
|
|
if (settings) {
|
|
namespace.settings = extend(namespace.settings || {}, settings);
|
|
}
|
|
return processor;
|
|
function addPreset(result) {
|
|
addList(result.plugins);
|
|
if (result.settings) {
|
|
settings = extend(settings || {}, result.settings);
|
|
}
|
|
}
|
|
function add(value2) {
|
|
if (typeof value2 === "function") {
|
|
addPlugin(value2);
|
|
} else if (typeof value2 === "object") {
|
|
if ("length" in value2) {
|
|
addPlugin.apply(null, value2);
|
|
} else {
|
|
addPreset(value2);
|
|
}
|
|
} else {
|
|
throw new Error("Expected usable value, not `" + value2 + "`");
|
|
}
|
|
}
|
|
function addList(plugins) {
|
|
var index = -1;
|
|
if (plugins === null || plugins === void 0) {
|
|
} else if (typeof plugins === "object" && "length" in plugins) {
|
|
while (++index < plugins.length) {
|
|
add(plugins[index]);
|
|
}
|
|
} else {
|
|
throw new Error("Expected a list of plugins, not `" + plugins + "`");
|
|
}
|
|
}
|
|
function addPlugin(plugin, value2) {
|
|
var entry = find(plugin);
|
|
if (entry) {
|
|
if (plain(entry[1]) && plain(value2)) {
|
|
value2 = extend(true, entry[1], value2);
|
|
}
|
|
entry[1] = value2;
|
|
} else {
|
|
attachers.push(slice.call(arguments));
|
|
}
|
|
}
|
|
}
|
|
function find(plugin) {
|
|
var index = -1;
|
|
while (++index < attachers.length) {
|
|
if (attachers[index][0] === plugin) {
|
|
return attachers[index];
|
|
}
|
|
}
|
|
}
|
|
function parse3(doc) {
|
|
var file = vfile(doc);
|
|
var Parser2;
|
|
freeze();
|
|
Parser2 = processor.Parser;
|
|
assertParser("parse", Parser2);
|
|
if (newable(Parser2, "parse")) {
|
|
return new Parser2(String(file), file).parse();
|
|
}
|
|
return Parser2(String(file), file);
|
|
}
|
|
function run(node, file, cb) {
|
|
assertNode(node);
|
|
freeze();
|
|
if (!cb && typeof file === "function") {
|
|
cb = file;
|
|
file = null;
|
|
}
|
|
if (!cb) {
|
|
return new Promise(executor);
|
|
}
|
|
executor(null, cb);
|
|
function executor(resolve, reject) {
|
|
transformers.run(node, vfile(file), done);
|
|
function done(error, tree, file2) {
|
|
tree = tree || node;
|
|
if (error) {
|
|
reject(error);
|
|
} else if (resolve) {
|
|
resolve(tree);
|
|
} else {
|
|
cb(null, tree, file2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function runSync(node, file) {
|
|
var result;
|
|
var complete;
|
|
run(node, file, done);
|
|
assertDone("runSync", "run", complete);
|
|
return result;
|
|
function done(error, tree) {
|
|
complete = true;
|
|
result = tree;
|
|
bail(error);
|
|
}
|
|
}
|
|
function stringify4(node, doc) {
|
|
var file = vfile(doc);
|
|
var Compiler;
|
|
freeze();
|
|
Compiler = processor.Compiler;
|
|
assertCompiler("stringify", Compiler);
|
|
assertNode(node);
|
|
if (newable(Compiler, "compile")) {
|
|
return new Compiler(node, file).compile();
|
|
}
|
|
return Compiler(node, file);
|
|
}
|
|
function process2(doc, cb) {
|
|
freeze();
|
|
assertParser("process", processor.Parser);
|
|
assertCompiler("process", processor.Compiler);
|
|
if (!cb) {
|
|
return new Promise(executor);
|
|
}
|
|
executor(null, cb);
|
|
function executor(resolve, reject) {
|
|
var file = vfile(doc);
|
|
pipeline.run(processor, { file }, done);
|
|
function done(error) {
|
|
if (error) {
|
|
reject(error);
|
|
} else if (resolve) {
|
|
resolve(file);
|
|
} else {
|
|
cb(null, file);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function processSync(doc) {
|
|
var file;
|
|
var complete;
|
|
freeze();
|
|
assertParser("processSync", processor.Parser);
|
|
assertCompiler("processSync", processor.Compiler);
|
|
file = vfile(doc);
|
|
process2(file, done);
|
|
assertDone("processSync", "process", complete);
|
|
return file;
|
|
function done(error) {
|
|
complete = true;
|
|
bail(error);
|
|
}
|
|
}
|
|
}
|
|
function newable(value, name) {
|
|
return typeof value === "function" && value.prototype && (keys(value.prototype) || name in value.prototype);
|
|
}
|
|
function keys(value) {
|
|
var key;
|
|
for (key in value) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function assertParser(name, Parser2) {
|
|
if (typeof Parser2 !== "function") {
|
|
throw new Error("Cannot `" + name + "` without `Parser`");
|
|
}
|
|
}
|
|
function assertCompiler(name, Compiler) {
|
|
if (typeof Compiler !== "function") {
|
|
throw new Error("Cannot `" + name + "` without `Compiler`");
|
|
}
|
|
}
|
|
function assertUnfrozen(name, frozen) {
|
|
if (frozen) {
|
|
throw new Error("Cannot invoke `" + name + "` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.");
|
|
}
|
|
}
|
|
function assertNode(node) {
|
|
if (!node || typeof node.type !== "string") {
|
|
throw new Error("Expected node, got `" + node + "`");
|
|
}
|
|
}
|
|
function assertDone(name, asyncName, complete) {
|
|
if (!complete) {
|
|
throw new Error("`" + name + "` finished async. Use `" + asyncName + "` instead");
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-string/index.js
|
|
var require_mdast_util_to_string = __commonJS({
|
|
"node_modules/mdast-util-to-string/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = toString;
|
|
function toString(node) {
|
|
return node && (node.value || node.alt || node.title || "children" in node && all(node.children) || "length" in node && all(node)) || "";
|
|
}
|
|
function all(values) {
|
|
var result = [];
|
|
var index = -1;
|
|
while (++index < values.length) {
|
|
result[index] = toString(values[index]);
|
|
}
|
|
return result.join("");
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/assign.js
|
|
var require_assign = __commonJS({
|
|
"node_modules/micromark/dist/constant/assign.js"(exports, module2) {
|
|
"use strict";
|
|
var assign = Object.assign;
|
|
module2.exports = assign;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/has-own-property.js
|
|
var require_has_own_property = __commonJS({
|
|
"node_modules/micromark/dist/constant/has-own-property.js"(exports, module2) {
|
|
"use strict";
|
|
var own = {}.hasOwnProperty;
|
|
module2.exports = own;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/normalize-identifier.js
|
|
var require_normalize_identifier = __commonJS({
|
|
"node_modules/micromark/dist/util/normalize-identifier.js"(exports, module2) {
|
|
"use strict";
|
|
function normalizeIdentifier(value) {
|
|
return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
|
|
}
|
|
module2.exports = normalizeIdentifier;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/from-char-code.js
|
|
var require_from_char_code = __commonJS({
|
|
"node_modules/micromark/dist/constant/from-char-code.js"(exports, module2) {
|
|
"use strict";
|
|
var fromCharCode = String.fromCharCode;
|
|
module2.exports = fromCharCode;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/safe-from-int.js
|
|
var require_safe_from_int = __commonJS({
|
|
"node_modules/micromark/dist/util/safe-from-int.js"(exports, module2) {
|
|
"use strict";
|
|
var fromCharCode = require_from_char_code();
|
|
function safeFromInt(value, base) {
|
|
var code = parseInt(value, base);
|
|
if (code < 9 || code === 11 || code > 13 && code < 32 || code > 126 && code < 160 || code > 55295 && code < 57344 || code > 64975 && code < 65008 || (code & 65535) === 65535 || (code & 65535) === 65534 || code > 1114111) {
|
|
return "\uFFFD";
|
|
}
|
|
return fromCharCode(code);
|
|
}
|
|
module2.exports = safeFromInt;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/markdown-line-ending.js
|
|
var require_markdown_line_ending = __commonJS({
|
|
"node_modules/micromark/dist/character/markdown-line-ending.js"(exports, module2) {
|
|
"use strict";
|
|
function markdownLineEnding(code) {
|
|
return code < -2;
|
|
}
|
|
module2.exports = markdownLineEnding;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/markdown-space.js
|
|
var require_markdown_space = __commonJS({
|
|
"node_modules/micromark/dist/character/markdown-space.js"(exports, module2) {
|
|
"use strict";
|
|
function markdownSpace(code) {
|
|
return code === -2 || code === -1 || code === 32;
|
|
}
|
|
module2.exports = markdownSpace;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/factory-space.js
|
|
var require_factory_space = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/factory-space.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownSpace = require_markdown_space();
|
|
function spaceFactory(effects, ok, type, max) {
|
|
var limit = max ? max - 1 : Infinity;
|
|
var size = 0;
|
|
return start;
|
|
function start(code) {
|
|
if (markdownSpace(code)) {
|
|
effects.enter(type);
|
|
return prefix(code);
|
|
}
|
|
return ok(code);
|
|
}
|
|
function prefix(code) {
|
|
if (markdownSpace(code) && size++ < limit) {
|
|
effects.consume(code);
|
|
return prefix;
|
|
}
|
|
effects.exit(type);
|
|
return ok(code);
|
|
}
|
|
}
|
|
module2.exports = spaceFactory;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/initialize/content.js
|
|
var require_content = __commonJS({
|
|
"node_modules/micromark/dist/initialize/content.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var factorySpace = require_factory_space();
|
|
var tokenize = initializeContent;
|
|
function initializeContent(effects) {
|
|
var contentStart = effects.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
|
|
var previous;
|
|
return contentStart;
|
|
function afterContentStartConstruct(code) {
|
|
if (code === null) {
|
|
effects.consume(code);
|
|
return;
|
|
}
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return factorySpace(effects, contentStart, "linePrefix");
|
|
}
|
|
function paragraphInitial(code) {
|
|
effects.enter("paragraph");
|
|
return lineStart(code);
|
|
}
|
|
function lineStart(code) {
|
|
var token = effects.enter("chunkText", {
|
|
contentType: "text",
|
|
previous
|
|
});
|
|
if (previous) {
|
|
previous.next = token;
|
|
}
|
|
previous = token;
|
|
return data(code);
|
|
}
|
|
function data(code) {
|
|
if (code === null) {
|
|
effects.exit("chunkText");
|
|
effects.exit("paragraph");
|
|
effects.consume(code);
|
|
return;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.consume(code);
|
|
effects.exit("chunkText");
|
|
return lineStart;
|
|
}
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
}
|
|
exports.tokenize = tokenize;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/partial-blank-line.js
|
|
var require_partial_blank_line = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/partial-blank-line.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var factorySpace = require_factory_space();
|
|
var partialBlankLine = {
|
|
tokenize: tokenizePartialBlankLine,
|
|
partial: true
|
|
};
|
|
function tokenizePartialBlankLine(effects, ok, nok) {
|
|
return factorySpace(effects, afterWhitespace, "linePrefix");
|
|
function afterWhitespace(code) {
|
|
return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
|
|
}
|
|
}
|
|
module2.exports = partialBlankLine;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/initialize/document.js
|
|
var require_document = __commonJS({
|
|
"node_modules/micromark/dist/initialize/document.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var factorySpace = require_factory_space();
|
|
var partialBlankLine = require_partial_blank_line();
|
|
var tokenize = initializeDocument;
|
|
var containerConstruct = {
|
|
tokenize: tokenizeContainer
|
|
};
|
|
var lazyFlowConstruct = {
|
|
tokenize: tokenizeLazyFlow
|
|
};
|
|
function initializeDocument(effects) {
|
|
var self = this;
|
|
var stack = [];
|
|
var continued = 0;
|
|
var inspectConstruct = {
|
|
tokenize: tokenizeInspect,
|
|
partial: true
|
|
};
|
|
var inspectResult;
|
|
var childFlow;
|
|
var childToken;
|
|
return start;
|
|
function start(code) {
|
|
if (continued < stack.length) {
|
|
self.containerState = stack[continued][1];
|
|
return effects.attempt(stack[continued][0].continuation, documentContinue, documentContinued)(code);
|
|
}
|
|
return documentContinued(code);
|
|
}
|
|
function documentContinue(code) {
|
|
continued++;
|
|
return start(code);
|
|
}
|
|
function documentContinued(code) {
|
|
if (inspectResult && inspectResult.flowContinue) {
|
|
return flowStart(code);
|
|
}
|
|
self.interrupt = childFlow && childFlow.currentConstruct && childFlow.currentConstruct.interruptible;
|
|
self.containerState = {};
|
|
return effects.attempt(containerConstruct, containerContinue, flowStart)(code);
|
|
}
|
|
function containerContinue(code) {
|
|
stack.push([self.currentConstruct, self.containerState]);
|
|
self.containerState = void 0;
|
|
return documentContinued(code);
|
|
}
|
|
function flowStart(code) {
|
|
if (code === null) {
|
|
exitContainers(0, true);
|
|
effects.consume(code);
|
|
return;
|
|
}
|
|
childFlow = childFlow || self.parser.flow(self.now());
|
|
effects.enter("chunkFlow", {
|
|
contentType: "flow",
|
|
previous: childToken,
|
|
_tokenizer: childFlow
|
|
});
|
|
return flowContinue(code);
|
|
}
|
|
function flowContinue(code) {
|
|
if (code === null) {
|
|
continueFlow(effects.exit("chunkFlow"));
|
|
return flowStart(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.consume(code);
|
|
continueFlow(effects.exit("chunkFlow"));
|
|
return effects.check(inspectConstruct, documentAfterPeek);
|
|
}
|
|
effects.consume(code);
|
|
return flowContinue;
|
|
}
|
|
function documentAfterPeek(code) {
|
|
exitContainers(inspectResult.continued, inspectResult && inspectResult.flowEnd);
|
|
continued = 0;
|
|
return start(code);
|
|
}
|
|
function continueFlow(token) {
|
|
if (childToken)
|
|
childToken.next = token;
|
|
childToken = token;
|
|
childFlow.lazy = inspectResult && inspectResult.lazy;
|
|
childFlow.defineSkip(token.start);
|
|
childFlow.write(self.sliceStream(token));
|
|
}
|
|
function exitContainers(size, end) {
|
|
var index = stack.length;
|
|
if (childFlow && end) {
|
|
childFlow.write([null]);
|
|
childToken = childFlow = void 0;
|
|
}
|
|
while (index-- > size) {
|
|
self.containerState = stack[index][1];
|
|
stack[index][0].exit.call(self, effects);
|
|
}
|
|
stack.length = size;
|
|
}
|
|
function tokenizeInspect(effects2, ok) {
|
|
var subcontinued = 0;
|
|
inspectResult = {};
|
|
return inspectStart;
|
|
function inspectStart(code) {
|
|
if (subcontinued < stack.length) {
|
|
self.containerState = stack[subcontinued][1];
|
|
return effects2.attempt(stack[subcontinued][0].continuation, inspectContinue, inspectLess)(code);
|
|
}
|
|
if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
|
|
inspectResult.flowContinue = true;
|
|
return inspectDone(code);
|
|
}
|
|
self.interrupt = childFlow.currentConstruct && childFlow.currentConstruct.interruptible;
|
|
self.containerState = {};
|
|
return effects2.attempt(containerConstruct, inspectFlowEnd, inspectDone)(code);
|
|
}
|
|
function inspectContinue(code) {
|
|
subcontinued++;
|
|
return self.containerState._closeFlow ? inspectFlowEnd(code) : inspectStart(code);
|
|
}
|
|
function inspectLess(code) {
|
|
if (childFlow.currentConstruct && childFlow.currentConstruct.lazy) {
|
|
self.containerState = {};
|
|
return effects2.attempt(containerConstruct, inspectFlowEnd, effects2.attempt(lazyFlowConstruct, inspectFlowEnd, effects2.check(partialBlankLine, inspectFlowEnd, inspectLazy)))(code);
|
|
}
|
|
return inspectFlowEnd(code);
|
|
}
|
|
function inspectLazy(code) {
|
|
subcontinued = stack.length;
|
|
inspectResult.lazy = true;
|
|
inspectResult.flowContinue = true;
|
|
return inspectDone(code);
|
|
}
|
|
function inspectFlowEnd(code) {
|
|
inspectResult.flowEnd = true;
|
|
return inspectDone(code);
|
|
}
|
|
function inspectDone(code) {
|
|
inspectResult.continued = subcontinued;
|
|
self.interrupt = self.containerState = void 0;
|
|
return ok(code);
|
|
}
|
|
}
|
|
}
|
|
function tokenizeContainer(effects, ok, nok) {
|
|
return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok, nok), "linePrefix", this.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4);
|
|
}
|
|
function tokenizeLazyFlow(effects, ok, nok) {
|
|
return factorySpace(effects, effects.lazy(this.parser.constructs.flow, ok, nok), "linePrefix", this.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4);
|
|
}
|
|
exports.tokenize = tokenize;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/size-chunks.js
|
|
var require_size_chunks = __commonJS({
|
|
"node_modules/micromark/dist/util/size-chunks.js"(exports, module2) {
|
|
"use strict";
|
|
function sizeChunks(chunks) {
|
|
var index = -1;
|
|
var size = 0;
|
|
while (++index < chunks.length) {
|
|
size += typeof chunks[index] === "string" ? chunks[index].length : 1;
|
|
}
|
|
return size;
|
|
}
|
|
module2.exports = sizeChunks;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/prefix-size.js
|
|
var require_prefix_size = __commonJS({
|
|
"node_modules/micromark/dist/util/prefix-size.js"(exports, module2) {
|
|
"use strict";
|
|
var sizeChunks = require_size_chunks();
|
|
function prefixSize(events, type) {
|
|
var tail = events[events.length - 1];
|
|
if (!tail || tail[1].type !== type)
|
|
return 0;
|
|
return sizeChunks(tail[2].sliceStream(tail[1]));
|
|
}
|
|
module2.exports = prefixSize;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/splice.js
|
|
var require_splice = __commonJS({
|
|
"node_modules/micromark/dist/constant/splice.js"(exports, module2) {
|
|
"use strict";
|
|
var splice = [].splice;
|
|
module2.exports = splice;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/chunked-splice.js
|
|
var require_chunked_splice = __commonJS({
|
|
"node_modules/micromark/dist/util/chunked-splice.js"(exports, module2) {
|
|
"use strict";
|
|
var splice = require_splice();
|
|
function chunkedSplice(list, start, remove, items) {
|
|
var end = list.length;
|
|
var chunkStart = 0;
|
|
var parameters;
|
|
if (start < 0) {
|
|
start = -start > end ? 0 : end + start;
|
|
} else {
|
|
start = start > end ? end : start;
|
|
}
|
|
remove = remove > 0 ? remove : 0;
|
|
if (items.length < 1e4) {
|
|
parameters = Array.from(items);
|
|
parameters.unshift(start, remove);
|
|
splice.apply(list, parameters);
|
|
} else {
|
|
if (remove)
|
|
splice.apply(list, [start, remove]);
|
|
while (chunkStart < items.length) {
|
|
parameters = items.slice(chunkStart, chunkStart + 1e4);
|
|
parameters.unshift(start, 0);
|
|
splice.apply(list, parameters);
|
|
chunkStart += 1e4;
|
|
start += 1e4;
|
|
}
|
|
}
|
|
}
|
|
module2.exports = chunkedSplice;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/shallow.js
|
|
var require_shallow = __commonJS({
|
|
"node_modules/micromark/dist/util/shallow.js"(exports, module2) {
|
|
"use strict";
|
|
var assign = require_assign();
|
|
function shallow(object) {
|
|
return assign({}, object);
|
|
}
|
|
module2.exports = shallow;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/subtokenize.js
|
|
var require_subtokenize = __commonJS({
|
|
"node_modules/micromark/dist/util/subtokenize.js"(exports, module2) {
|
|
"use strict";
|
|
var assign = require_assign();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var shallow = require_shallow();
|
|
function subtokenize(events) {
|
|
var jumps = {};
|
|
var index = -1;
|
|
var event;
|
|
var lineIndex;
|
|
var otherIndex;
|
|
var otherEvent;
|
|
var parameters;
|
|
var subevents;
|
|
var more;
|
|
while (++index < events.length) {
|
|
while (index in jumps) {
|
|
index = jumps[index];
|
|
}
|
|
event = events[index];
|
|
if (index && event[1].type === "chunkFlow" && events[index - 1][1].type === "listItemPrefix") {
|
|
subevents = event[1]._tokenizer.events;
|
|
otherIndex = 0;
|
|
if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
|
|
otherIndex += 2;
|
|
}
|
|
if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
|
|
while (++otherIndex < subevents.length) {
|
|
if (subevents[otherIndex][1].type === "content") {
|
|
break;
|
|
}
|
|
if (subevents[otherIndex][1].type === "chunkText") {
|
|
subevents[otherIndex][1].isInFirstContentOfListItem = true;
|
|
otherIndex++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (event[0] === "enter") {
|
|
if (event[1].contentType) {
|
|
assign(jumps, subcontent(events, index));
|
|
index = jumps[index];
|
|
more = true;
|
|
}
|
|
} else if (event[1]._container || event[1]._movePreviousLineEndings) {
|
|
otherIndex = index;
|
|
lineIndex = void 0;
|
|
while (otherIndex--) {
|
|
otherEvent = events[otherIndex];
|
|
if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
|
|
if (otherEvent[0] === "enter") {
|
|
if (lineIndex) {
|
|
events[lineIndex][1].type = "lineEndingBlank";
|
|
}
|
|
otherEvent[1].type = "lineEnding";
|
|
lineIndex = otherIndex;
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
if (lineIndex) {
|
|
event[1].end = shallow(events[lineIndex][1].start);
|
|
parameters = events.slice(lineIndex, index);
|
|
parameters.unshift(event);
|
|
chunkedSplice(events, lineIndex, index - lineIndex + 1, parameters);
|
|
}
|
|
}
|
|
}
|
|
return !more;
|
|
}
|
|
function subcontent(events, eventIndex) {
|
|
var token = events[eventIndex][1];
|
|
var context = events[eventIndex][2];
|
|
var startPosition = eventIndex - 1;
|
|
var startPositions = [];
|
|
var tokenizer = token._tokenizer || context.parser[token.contentType](token.start);
|
|
var childEvents = tokenizer.events;
|
|
var jumps = [];
|
|
var gaps = {};
|
|
var stream;
|
|
var previous;
|
|
var index;
|
|
var entered;
|
|
var end;
|
|
var adjust;
|
|
while (token) {
|
|
while (events[++startPosition][1] !== token) {
|
|
}
|
|
startPositions.push(startPosition);
|
|
if (!token._tokenizer) {
|
|
stream = context.sliceStream(token);
|
|
if (!token.next) {
|
|
stream.push(null);
|
|
}
|
|
if (previous) {
|
|
tokenizer.defineSkip(token.start);
|
|
}
|
|
if (token.isInFirstContentOfListItem) {
|
|
tokenizer._gfmTasklistFirstContentOfListItem = true;
|
|
}
|
|
tokenizer.write(stream);
|
|
if (token.isInFirstContentOfListItem) {
|
|
tokenizer._gfmTasklistFirstContentOfListItem = void 0;
|
|
}
|
|
}
|
|
previous = token;
|
|
token = token.next;
|
|
}
|
|
token = previous;
|
|
index = childEvents.length;
|
|
while (index--) {
|
|
if (childEvents[index][0] === "enter") {
|
|
entered = true;
|
|
} else if (entered && childEvents[index][1].type === childEvents[index - 1][1].type && childEvents[index][1].start.line !== childEvents[index][1].end.line) {
|
|
add(childEvents.slice(index + 1, end));
|
|
token._tokenizer = token.next = void 0;
|
|
token = token.previous;
|
|
end = index + 1;
|
|
}
|
|
}
|
|
tokenizer.events = token._tokenizer = token.next = void 0;
|
|
add(childEvents.slice(0, end));
|
|
index = -1;
|
|
adjust = 0;
|
|
while (++index < jumps.length) {
|
|
gaps[adjust + jumps[index][0]] = adjust + jumps[index][1];
|
|
adjust += jumps[index][1] - jumps[index][0] - 1;
|
|
}
|
|
return gaps;
|
|
function add(slice) {
|
|
var start = startPositions.pop();
|
|
jumps.unshift([start, start + slice.length - 1]);
|
|
chunkedSplice(events, start, 2, slice);
|
|
}
|
|
}
|
|
module2.exports = subtokenize;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/content.js
|
|
var require_content2 = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/content.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var prefixSize = require_prefix_size();
|
|
var subtokenize = require_subtokenize();
|
|
var factorySpace = require_factory_space();
|
|
var content = {
|
|
tokenize: tokenizeContent,
|
|
resolve: resolveContent,
|
|
interruptible: true,
|
|
lazy: true
|
|
};
|
|
var continuationConstruct = {
|
|
tokenize: tokenizeContinuation,
|
|
partial: true
|
|
};
|
|
function resolveContent(events) {
|
|
subtokenize(events);
|
|
return events;
|
|
}
|
|
function tokenizeContent(effects, ok) {
|
|
var previous;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("content");
|
|
previous = effects.enter("chunkContent", {
|
|
contentType: "content"
|
|
});
|
|
return data(code);
|
|
}
|
|
function data(code) {
|
|
if (code === null) {
|
|
return contentEnd(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
return effects.check(continuationConstruct, contentContinue, contentEnd)(code);
|
|
}
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
function contentEnd(code) {
|
|
effects.exit("chunkContent");
|
|
effects.exit("content");
|
|
return ok(code);
|
|
}
|
|
function contentContinue(code) {
|
|
effects.consume(code);
|
|
effects.exit("chunkContent");
|
|
previous = previous.next = effects.enter("chunkContent", {
|
|
contentType: "content",
|
|
previous
|
|
});
|
|
return data;
|
|
}
|
|
}
|
|
function tokenizeContinuation(effects, ok, nok) {
|
|
var self = this;
|
|
return startLookahead;
|
|
function startLookahead(code) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return factorySpace(effects, prefixed, "linePrefix");
|
|
}
|
|
function prefixed(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
return nok(code);
|
|
}
|
|
if (self.parser.constructs.disable.null.indexOf("codeIndented") > -1 || prefixSize(self.events, "linePrefix") < 4) {
|
|
return effects.interrupt(self.parser.constructs.flow, nok, ok)(code);
|
|
}
|
|
return ok(code);
|
|
}
|
|
}
|
|
module2.exports = content;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/initialize/flow.js
|
|
var require_flow = __commonJS({
|
|
"node_modules/micromark/dist/initialize/flow.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var content = require_content2();
|
|
var factorySpace = require_factory_space();
|
|
var partialBlankLine = require_partial_blank_line();
|
|
var tokenize = initializeFlow;
|
|
function initializeFlow(effects) {
|
|
var self = this;
|
|
var initial = effects.attempt(partialBlankLine, atBlankEnding, effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), "linePrefix")));
|
|
return initial;
|
|
function atBlankEnding(code) {
|
|
if (code === null) {
|
|
effects.consume(code);
|
|
return;
|
|
}
|
|
effects.enter("lineEndingBlank");
|
|
effects.consume(code);
|
|
effects.exit("lineEndingBlank");
|
|
self.currentConstruct = void 0;
|
|
return initial;
|
|
}
|
|
function afterConstruct(code) {
|
|
if (code === null) {
|
|
effects.consume(code);
|
|
return;
|
|
}
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
self.currentConstruct = void 0;
|
|
return initial;
|
|
}
|
|
}
|
|
exports.tokenize = tokenize;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/initialize/text.js
|
|
var require_text = __commonJS({
|
|
"node_modules/micromark/dist/initialize/text.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var assign = require_assign();
|
|
var shallow = require_shallow();
|
|
var text = initializeFactory("text");
|
|
var string2 = initializeFactory("string");
|
|
var resolver = {
|
|
resolveAll: createResolver()
|
|
};
|
|
function initializeFactory(field) {
|
|
return {
|
|
tokenize: initializeText,
|
|
resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0)
|
|
};
|
|
function initializeText(effects) {
|
|
var self = this;
|
|
var constructs = this.parser.constructs[field];
|
|
var text2 = effects.attempt(constructs, start, notText);
|
|
return start;
|
|
function start(code) {
|
|
return atBreak(code) ? text2(code) : notText(code);
|
|
}
|
|
function notText(code) {
|
|
if (code === null) {
|
|
effects.consume(code);
|
|
return;
|
|
}
|
|
effects.enter("data");
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
function data(code) {
|
|
if (atBreak(code)) {
|
|
effects.exit("data");
|
|
return text2(code);
|
|
}
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
function atBreak(code) {
|
|
var list = constructs[code];
|
|
var index = -1;
|
|
if (code === null) {
|
|
return true;
|
|
}
|
|
if (list) {
|
|
while (++index < list.length) {
|
|
if (!list[index].previous || list[index].previous.call(self, self.previous)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function createResolver(extraResolver) {
|
|
return resolveAllText;
|
|
function resolveAllText(events, context) {
|
|
var index = -1;
|
|
var enter;
|
|
while (++index <= events.length) {
|
|
if (enter === void 0) {
|
|
if (events[index] && events[index][1].type === "data") {
|
|
enter = index;
|
|
index++;
|
|
}
|
|
} else if (!events[index] || events[index][1].type !== "data") {
|
|
if (index !== enter + 2) {
|
|
events[enter][1].end = events[index - 1][1].end;
|
|
events.splice(enter + 2, index - enter - 2);
|
|
index = enter + 2;
|
|
}
|
|
enter = void 0;
|
|
}
|
|
}
|
|
return extraResolver ? extraResolver(events, context) : events;
|
|
}
|
|
}
|
|
function resolveAllLineSuffixes(events, context) {
|
|
var eventIndex = -1;
|
|
var chunks;
|
|
var data;
|
|
var chunk;
|
|
var index;
|
|
var bufferIndex;
|
|
var size;
|
|
var tabs;
|
|
var token;
|
|
while (++eventIndex <= events.length) {
|
|
if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") {
|
|
data = events[eventIndex - 1][1];
|
|
chunks = context.sliceStream(data);
|
|
index = chunks.length;
|
|
bufferIndex = -1;
|
|
size = 0;
|
|
tabs = void 0;
|
|
while (index--) {
|
|
chunk = chunks[index];
|
|
if (typeof chunk === "string") {
|
|
bufferIndex = chunk.length;
|
|
while (chunk.charCodeAt(bufferIndex - 1) === 32) {
|
|
size++;
|
|
bufferIndex--;
|
|
}
|
|
if (bufferIndex)
|
|
break;
|
|
bufferIndex = -1;
|
|
} else if (chunk === -2) {
|
|
tabs = true;
|
|
size++;
|
|
} else if (chunk === -1)
|
|
;
|
|
else {
|
|
index++;
|
|
break;
|
|
}
|
|
}
|
|
if (size) {
|
|
token = {
|
|
type: eventIndex === events.length || tabs || size < 2 ? "lineSuffix" : "hardBreakTrailing",
|
|
start: {
|
|
line: data.end.line,
|
|
column: data.end.column - size,
|
|
offset: data.end.offset - size,
|
|
_index: data.start._index + index,
|
|
_bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex
|
|
},
|
|
end: shallow(data.end)
|
|
};
|
|
data.end = shallow(token.start);
|
|
if (data.start.offset === data.end.offset) {
|
|
assign(data, token);
|
|
} else {
|
|
events.splice(eventIndex, 0, ["enter", token, context], ["exit", token, context]);
|
|
eventIndex += 2;
|
|
}
|
|
}
|
|
eventIndex++;
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
exports.resolver = resolver;
|
|
exports.string = string2;
|
|
exports.text = text;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/miniflat.js
|
|
var require_miniflat = __commonJS({
|
|
"node_modules/micromark/dist/util/miniflat.js"(exports, module2) {
|
|
"use strict";
|
|
function miniflat(value) {
|
|
return value === null || value === void 0 ? [] : "length" in value ? value : [value];
|
|
}
|
|
module2.exports = miniflat;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/combine-extensions.js
|
|
var require_combine_extensions = __commonJS({
|
|
"node_modules/micromark/dist/util/combine-extensions.js"(exports, module2) {
|
|
"use strict";
|
|
var hasOwnProperty = require_has_own_property();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var miniflat = require_miniflat();
|
|
function combineExtensions(extensions) {
|
|
var all = {};
|
|
var index = -1;
|
|
while (++index < extensions.length) {
|
|
extension(all, extensions[index]);
|
|
}
|
|
return all;
|
|
}
|
|
function extension(all, extension2) {
|
|
var hook;
|
|
var left;
|
|
var right;
|
|
var code;
|
|
for (hook in extension2) {
|
|
left = hasOwnProperty.call(all, hook) ? all[hook] : all[hook] = {};
|
|
right = extension2[hook];
|
|
for (code in right) {
|
|
left[code] = constructs(miniflat(right[code]), hasOwnProperty.call(left, code) ? left[code] : []);
|
|
}
|
|
}
|
|
}
|
|
function constructs(list, existing) {
|
|
var index = -1;
|
|
var before = [];
|
|
while (++index < list.length) {
|
|
;
|
|
(list[index].add === "after" ? existing : before).push(list[index]);
|
|
}
|
|
chunkedSplice(existing, 0, 0, before);
|
|
return existing;
|
|
}
|
|
module2.exports = combineExtensions;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/chunked-push.js
|
|
var require_chunked_push = __commonJS({
|
|
"node_modules/micromark/dist/util/chunked-push.js"(exports, module2) {
|
|
"use strict";
|
|
var chunkedSplice = require_chunked_splice();
|
|
function chunkedPush(list, items) {
|
|
if (list.length) {
|
|
chunkedSplice(list, list.length, 0, items);
|
|
return list;
|
|
}
|
|
return items;
|
|
}
|
|
module2.exports = chunkedPush;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/resolve-all.js
|
|
var require_resolve_all = __commonJS({
|
|
"node_modules/micromark/dist/util/resolve-all.js"(exports, module2) {
|
|
"use strict";
|
|
function resolveAll(constructs, events, context) {
|
|
var called = [];
|
|
var index = -1;
|
|
var resolve;
|
|
while (++index < constructs.length) {
|
|
resolve = constructs[index].resolveAll;
|
|
if (resolve && called.indexOf(resolve) < 0) {
|
|
events = resolve(events, context);
|
|
called.push(resolve);
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
module2.exports = resolveAll;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/serialize-chunks.js
|
|
var require_serialize_chunks = __commonJS({
|
|
"node_modules/micromark/dist/util/serialize-chunks.js"(exports, module2) {
|
|
"use strict";
|
|
var fromCharCode = require_from_char_code();
|
|
function serializeChunks(chunks) {
|
|
var index = -1;
|
|
var result = [];
|
|
var chunk;
|
|
var value;
|
|
var atTab;
|
|
while (++index < chunks.length) {
|
|
chunk = chunks[index];
|
|
if (typeof chunk === "string") {
|
|
value = chunk;
|
|
} else if (chunk === -5) {
|
|
value = "\r";
|
|
} else if (chunk === -4) {
|
|
value = "\n";
|
|
} else if (chunk === -3) {
|
|
value = "\r\n";
|
|
} else if (chunk === -2) {
|
|
value = " ";
|
|
} else if (chunk === -1) {
|
|
if (atTab)
|
|
continue;
|
|
value = " ";
|
|
} else {
|
|
value = fromCharCode(chunk);
|
|
}
|
|
atTab = chunk === -2;
|
|
result.push(value);
|
|
}
|
|
return result.join("");
|
|
}
|
|
module2.exports = serializeChunks;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/slice-chunks.js
|
|
var require_slice_chunks = __commonJS({
|
|
"node_modules/micromark/dist/util/slice-chunks.js"(exports, module2) {
|
|
"use strict";
|
|
function sliceChunks(chunks, token) {
|
|
var startIndex = token.start._index;
|
|
var startBufferIndex = token.start._bufferIndex;
|
|
var endIndex = token.end._index;
|
|
var endBufferIndex = token.end._bufferIndex;
|
|
var view;
|
|
if (startIndex === endIndex) {
|
|
view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
|
|
} else {
|
|
view = chunks.slice(startIndex, endIndex);
|
|
if (startBufferIndex > -1) {
|
|
view[0] = view[0].slice(startBufferIndex);
|
|
}
|
|
if (endBufferIndex > 0) {
|
|
view.push(chunks[endIndex].slice(0, endBufferIndex));
|
|
}
|
|
}
|
|
return view;
|
|
}
|
|
module2.exports = sliceChunks;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/create-tokenizer.js
|
|
var require_create_tokenizer = __commonJS({
|
|
"node_modules/micromark/dist/util/create-tokenizer.js"(exports, module2) {
|
|
"use strict";
|
|
var assign = require_assign();
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var chunkedPush = require_chunked_push();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var miniflat = require_miniflat();
|
|
var resolveAll = require_resolve_all();
|
|
var serializeChunks = require_serialize_chunks();
|
|
var shallow = require_shallow();
|
|
var sliceChunks = require_slice_chunks();
|
|
function createTokenizer(parser, initialize, from) {
|
|
var point = from ? shallow(from) : {
|
|
line: 1,
|
|
column: 1,
|
|
offset: 0
|
|
};
|
|
var columnStart = {};
|
|
var resolveAllConstructs = [];
|
|
var chunks = [];
|
|
var stack = [];
|
|
var effects = {
|
|
consume,
|
|
enter,
|
|
exit,
|
|
attempt: constructFactory(onsuccessfulconstruct),
|
|
check: constructFactory(onsuccessfulcheck),
|
|
interrupt: constructFactory(onsuccessfulcheck, {
|
|
interrupt: true
|
|
}),
|
|
lazy: constructFactory(onsuccessfulcheck, {
|
|
lazy: true
|
|
})
|
|
};
|
|
var context = {
|
|
previous: null,
|
|
events: [],
|
|
parser,
|
|
sliceStream,
|
|
sliceSerialize,
|
|
now,
|
|
defineSkip: skip,
|
|
write
|
|
};
|
|
var state = initialize.tokenize.call(context, effects);
|
|
if (initialize.resolveAll) {
|
|
resolveAllConstructs.push(initialize);
|
|
}
|
|
point._index = 0;
|
|
point._bufferIndex = -1;
|
|
return context;
|
|
function write(slice) {
|
|
chunks = chunkedPush(chunks, slice);
|
|
main();
|
|
if (chunks[chunks.length - 1] !== null) {
|
|
return [];
|
|
}
|
|
addResult(initialize, 0);
|
|
context.events = resolveAll(resolveAllConstructs, context.events, context);
|
|
return context.events;
|
|
}
|
|
function sliceSerialize(token) {
|
|
return serializeChunks(sliceStream(token));
|
|
}
|
|
function sliceStream(token) {
|
|
return sliceChunks(chunks, token);
|
|
}
|
|
function now() {
|
|
return shallow(point);
|
|
}
|
|
function skip(value) {
|
|
columnStart[value.line] = value.column;
|
|
accountForPotentialSkip();
|
|
}
|
|
function main() {
|
|
var chunkIndex;
|
|
var chunk;
|
|
while (point._index < chunks.length) {
|
|
chunk = chunks[point._index];
|
|
if (typeof chunk === "string") {
|
|
chunkIndex = point._index;
|
|
if (point._bufferIndex < 0) {
|
|
point._bufferIndex = 0;
|
|
}
|
|
while (point._index === chunkIndex && point._bufferIndex < chunk.length) {
|
|
go(chunk.charCodeAt(point._bufferIndex));
|
|
}
|
|
} else {
|
|
go(chunk);
|
|
}
|
|
}
|
|
}
|
|
function go(code) {
|
|
state = state(code);
|
|
}
|
|
function consume(code) {
|
|
if (markdownLineEnding(code)) {
|
|
point.line++;
|
|
point.column = 1;
|
|
point.offset += code === -3 ? 2 : 1;
|
|
accountForPotentialSkip();
|
|
} else if (code !== -1) {
|
|
point.column++;
|
|
point.offset++;
|
|
}
|
|
if (point._bufferIndex < 0) {
|
|
point._index++;
|
|
} else {
|
|
point._bufferIndex++;
|
|
if (point._bufferIndex === chunks[point._index].length) {
|
|
point._bufferIndex = -1;
|
|
point._index++;
|
|
}
|
|
}
|
|
context.previous = code;
|
|
}
|
|
function enter(type, fields) {
|
|
var token = fields || {};
|
|
token.type = type;
|
|
token.start = now();
|
|
context.events.push(["enter", token, context]);
|
|
stack.push(token);
|
|
return token;
|
|
}
|
|
function exit(type) {
|
|
var token = stack.pop();
|
|
token.end = now();
|
|
context.events.push(["exit", token, context]);
|
|
return token;
|
|
}
|
|
function onsuccessfulconstruct(construct, info) {
|
|
addResult(construct, info.from);
|
|
}
|
|
function onsuccessfulcheck(construct, info) {
|
|
info.restore();
|
|
}
|
|
function constructFactory(onreturn, fields) {
|
|
return hook;
|
|
function hook(constructs, returnState, bogusState) {
|
|
var listOfConstructs;
|
|
var constructIndex;
|
|
var currentConstruct;
|
|
var info;
|
|
return constructs.tokenize || "length" in constructs ? handleListOfConstructs(miniflat(constructs)) : handleMapOfConstructs;
|
|
function handleMapOfConstructs(code) {
|
|
if (code in constructs || null in constructs) {
|
|
return handleListOfConstructs(constructs.null ? miniflat(constructs[code]).concat(miniflat(constructs.null)) : constructs[code])(code);
|
|
}
|
|
return bogusState(code);
|
|
}
|
|
function handleListOfConstructs(list) {
|
|
listOfConstructs = list;
|
|
constructIndex = 0;
|
|
return handleConstruct(list[constructIndex]);
|
|
}
|
|
function handleConstruct(construct) {
|
|
return start;
|
|
function start(code) {
|
|
info = store();
|
|
currentConstruct = construct;
|
|
if (!construct.partial) {
|
|
context.currentConstruct = construct;
|
|
}
|
|
if (construct.name && context.parser.constructs.disable.null.indexOf(construct.name) > -1) {
|
|
return nok();
|
|
}
|
|
return construct.tokenize.call(fields ? assign({}, context, fields) : context, effects, ok, nok)(code);
|
|
}
|
|
}
|
|
function ok(code) {
|
|
onreturn(currentConstruct, info);
|
|
return returnState;
|
|
}
|
|
function nok(code) {
|
|
info.restore();
|
|
if (++constructIndex < listOfConstructs.length) {
|
|
return handleConstruct(listOfConstructs[constructIndex]);
|
|
}
|
|
return bogusState;
|
|
}
|
|
}
|
|
}
|
|
function addResult(construct, from2) {
|
|
if (construct.resolveAll && resolveAllConstructs.indexOf(construct) < 0) {
|
|
resolveAllConstructs.push(construct);
|
|
}
|
|
if (construct.resolve) {
|
|
chunkedSplice(context.events, from2, context.events.length - from2, construct.resolve(context.events.slice(from2), context));
|
|
}
|
|
if (construct.resolveTo) {
|
|
context.events = construct.resolveTo(context.events, context);
|
|
}
|
|
}
|
|
function store() {
|
|
var startPoint = now();
|
|
var startPrevious = context.previous;
|
|
var startCurrentConstruct = context.currentConstruct;
|
|
var startEventsIndex = context.events.length;
|
|
var startStack = Array.from(stack);
|
|
return {
|
|
restore,
|
|
from: startEventsIndex
|
|
};
|
|
function restore() {
|
|
point = startPoint;
|
|
context.previous = startPrevious;
|
|
context.currentConstruct = startCurrentConstruct;
|
|
context.events.length = startEventsIndex;
|
|
stack = startStack;
|
|
accountForPotentialSkip();
|
|
}
|
|
}
|
|
function accountForPotentialSkip() {
|
|
if (point.line in columnStart && point.column < 2) {
|
|
point.column = columnStart[point.line];
|
|
point.offset += columnStart[point.line] - 1;
|
|
}
|
|
}
|
|
}
|
|
module2.exports = createTokenizer;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/markdown-line-ending-or-space.js
|
|
var require_markdown_line_ending_or_space = __commonJS({
|
|
"node_modules/micromark/dist/character/markdown-line-ending-or-space.js"(exports, module2) {
|
|
"use strict";
|
|
function markdownLineEndingOrSpace(code) {
|
|
return code < 0 || code === 32;
|
|
}
|
|
module2.exports = markdownLineEndingOrSpace;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/unicode-punctuation-regex.js
|
|
var require_unicode_punctuation_regex = __commonJS({
|
|
"node_modules/micromark/dist/constant/unicode-punctuation-regex.js"(exports, module2) {
|
|
"use strict";
|
|
var unicodePunctuation = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/;
|
|
module2.exports = unicodePunctuation;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/regex-check.js
|
|
var require_regex_check = __commonJS({
|
|
"node_modules/micromark/dist/util/regex-check.js"(exports, module2) {
|
|
"use strict";
|
|
var fromCharCode = require_from_char_code();
|
|
function regexCheck(regex) {
|
|
return check;
|
|
function check(code) {
|
|
return regex.test(fromCharCode(code));
|
|
}
|
|
}
|
|
module2.exports = regexCheck;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/unicode-punctuation.js
|
|
var require_unicode_punctuation = __commonJS({
|
|
"node_modules/micromark/dist/character/unicode-punctuation.js"(exports, module2) {
|
|
"use strict";
|
|
var unicodePunctuationRegex = require_unicode_punctuation_regex();
|
|
var regexCheck = require_regex_check();
|
|
var unicodePunctuation = regexCheck(unicodePunctuationRegex);
|
|
module2.exports = unicodePunctuation;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/unicode-whitespace.js
|
|
var require_unicode_whitespace = __commonJS({
|
|
"node_modules/micromark/dist/character/unicode-whitespace.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var unicodeWhitespace = regexCheck(/\s/);
|
|
module2.exports = unicodeWhitespace;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/classify-character.js
|
|
var require_classify_character = __commonJS({
|
|
"node_modules/micromark/dist/util/classify-character.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var unicodePunctuation = require_unicode_punctuation();
|
|
var unicodeWhitespace = require_unicode_whitespace();
|
|
function classifyCharacter(code) {
|
|
if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {
|
|
return 1;
|
|
}
|
|
if (unicodePunctuation(code)) {
|
|
return 2;
|
|
}
|
|
}
|
|
module2.exports = classifyCharacter;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/util/move-point.js
|
|
var require_move_point = __commonJS({
|
|
"node_modules/micromark/dist/util/move-point.js"(exports, module2) {
|
|
"use strict";
|
|
function movePoint(point, offset) {
|
|
point.column += offset;
|
|
point.offset += offset;
|
|
point._bufferIndex += offset;
|
|
return point;
|
|
}
|
|
module2.exports = movePoint;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/attention.js
|
|
var require_attention = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/attention.js"(exports, module2) {
|
|
"use strict";
|
|
var chunkedPush = require_chunked_push();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var classifyCharacter = require_classify_character();
|
|
var movePoint = require_move_point();
|
|
var resolveAll = require_resolve_all();
|
|
var shallow = require_shallow();
|
|
var attention = {
|
|
name: "attention",
|
|
tokenize: tokenizeAttention,
|
|
resolveAll: resolveAllAttention
|
|
};
|
|
function resolveAllAttention(events, context) {
|
|
var index = -1;
|
|
var open;
|
|
var group;
|
|
var text;
|
|
var openingSequence;
|
|
var closingSequence;
|
|
var use;
|
|
var nextEvents;
|
|
var offset;
|
|
while (++index < events.length) {
|
|
if (events[index][0] === "enter" && events[index][1].type === "attentionSequence" && events[index][1]._close) {
|
|
open = index;
|
|
while (open--) {
|
|
if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && context.sliceSerialize(events[open][1]).charCodeAt(0) === context.sliceSerialize(events[index][1]).charCodeAt(0)) {
|
|
if ((events[open][1]._close || events[index][1]._open) && (events[index][1].end.offset - events[index][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index][1].end.offset - events[index][1].start.offset) % 3)) {
|
|
continue;
|
|
}
|
|
use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
|
|
openingSequence = {
|
|
type: use > 1 ? "strongSequence" : "emphasisSequence",
|
|
start: movePoint(shallow(events[open][1].end), -use),
|
|
end: shallow(events[open][1].end)
|
|
};
|
|
closingSequence = {
|
|
type: use > 1 ? "strongSequence" : "emphasisSequence",
|
|
start: shallow(events[index][1].start),
|
|
end: movePoint(shallow(events[index][1].start), use)
|
|
};
|
|
text = {
|
|
type: use > 1 ? "strongText" : "emphasisText",
|
|
start: shallow(events[open][1].end),
|
|
end: shallow(events[index][1].start)
|
|
};
|
|
group = {
|
|
type: use > 1 ? "strong" : "emphasis",
|
|
start: shallow(openingSequence.start),
|
|
end: shallow(closingSequence.end)
|
|
};
|
|
events[open][1].end = shallow(openingSequence.start);
|
|
events[index][1].start = shallow(closingSequence.end);
|
|
nextEvents = [];
|
|
if (events[open][1].end.offset - events[open][1].start.offset) {
|
|
nextEvents = chunkedPush(nextEvents, [
|
|
["enter", events[open][1], context],
|
|
["exit", events[open][1], context]
|
|
]);
|
|
}
|
|
nextEvents = chunkedPush(nextEvents, [
|
|
["enter", group, context],
|
|
["enter", openingSequence, context],
|
|
["exit", openingSequence, context],
|
|
["enter", text, context]
|
|
]);
|
|
nextEvents = chunkedPush(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));
|
|
nextEvents = chunkedPush(nextEvents, [
|
|
["exit", text, context],
|
|
["enter", closingSequence, context],
|
|
["exit", closingSequence, context],
|
|
["exit", group, context]
|
|
]);
|
|
if (events[index][1].end.offset - events[index][1].start.offset) {
|
|
offset = 2;
|
|
nextEvents = chunkedPush(nextEvents, [
|
|
["enter", events[index][1], context],
|
|
["exit", events[index][1], context]
|
|
]);
|
|
} else {
|
|
offset = 0;
|
|
}
|
|
chunkedSplice(events, open - 1, index - open + 3, nextEvents);
|
|
index = open + nextEvents.length - offset - 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
index = -1;
|
|
while (++index < events.length) {
|
|
if (events[index][1].type === "attentionSequence") {
|
|
events[index][1].type = "data";
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
function tokenizeAttention(effects, ok) {
|
|
var before = classifyCharacter(this.previous);
|
|
var marker;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("attentionSequence");
|
|
marker = code;
|
|
return sequence(code);
|
|
}
|
|
function sequence(code) {
|
|
var token;
|
|
var after;
|
|
var open;
|
|
var close;
|
|
if (code === marker) {
|
|
effects.consume(code);
|
|
return sequence;
|
|
}
|
|
token = effects.exit("attentionSequence");
|
|
after = classifyCharacter(code);
|
|
open = !after || after === 2 && before;
|
|
close = !before || before === 2 && after;
|
|
token._open = marker === 42 ? open : open && (before || !close);
|
|
token._close = marker === 42 ? close : close && (after || !open);
|
|
return ok(code);
|
|
}
|
|
}
|
|
module2.exports = attention;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-alpha.js
|
|
var require_ascii_alpha = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-alpha.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var asciiAlpha = regexCheck(/[A-Za-z]/);
|
|
module2.exports = asciiAlpha;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-alphanumeric.js
|
|
var require_ascii_alphanumeric = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-alphanumeric.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
|
|
module2.exports = asciiAlphanumeric;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-atext.js
|
|
var require_ascii_atext = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-atext.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
|
|
module2.exports = asciiAtext;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-control.js
|
|
var require_ascii_control = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-control.js"(exports, module2) {
|
|
"use strict";
|
|
function asciiControl(code) {
|
|
return code < 32 || code === 127;
|
|
}
|
|
module2.exports = asciiControl;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/autolink.js
|
|
var require_autolink = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/autolink.js"(exports, module2) {
|
|
"use strict";
|
|
var asciiAlpha = require_ascii_alpha();
|
|
var asciiAlphanumeric = require_ascii_alphanumeric();
|
|
var asciiAtext = require_ascii_atext();
|
|
var asciiControl = require_ascii_control();
|
|
var autolink = {
|
|
name: "autolink",
|
|
tokenize: tokenizeAutolink
|
|
};
|
|
function tokenizeAutolink(effects, ok, nok) {
|
|
var size = 1;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("autolink");
|
|
effects.enter("autolinkMarker");
|
|
effects.consume(code);
|
|
effects.exit("autolinkMarker");
|
|
effects.enter("autolinkProtocol");
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
return schemeOrEmailAtext;
|
|
}
|
|
return asciiAtext(code) ? emailAtext(code) : nok(code);
|
|
}
|
|
function schemeOrEmailAtext(code) {
|
|
return code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code) ? schemeInsideOrEmailAtext(code) : emailAtext(code);
|
|
}
|
|
function schemeInsideOrEmailAtext(code) {
|
|
if (code === 58) {
|
|
effects.consume(code);
|
|
return urlInside;
|
|
}
|
|
if ((code === 43 || code === 45 || code === 46 || asciiAlphanumeric(code)) && size++ < 32) {
|
|
effects.consume(code);
|
|
return schemeInsideOrEmailAtext;
|
|
}
|
|
return emailAtext(code);
|
|
}
|
|
function urlInside(code) {
|
|
if (code === 62) {
|
|
effects.exit("autolinkProtocol");
|
|
return end(code);
|
|
}
|
|
if (code === 32 || code === 60 || asciiControl(code)) {
|
|
return nok(code);
|
|
}
|
|
effects.consume(code);
|
|
return urlInside;
|
|
}
|
|
function emailAtext(code) {
|
|
if (code === 64) {
|
|
effects.consume(code);
|
|
size = 0;
|
|
return emailAtSignOrDot;
|
|
}
|
|
if (asciiAtext(code)) {
|
|
effects.consume(code);
|
|
return emailAtext;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function emailAtSignOrDot(code) {
|
|
return asciiAlphanumeric(code) ? emailLabel(code) : nok(code);
|
|
}
|
|
function emailLabel(code) {
|
|
if (code === 46) {
|
|
effects.consume(code);
|
|
size = 0;
|
|
return emailAtSignOrDot;
|
|
}
|
|
if (code === 62) {
|
|
effects.exit("autolinkProtocol").type = "autolinkEmail";
|
|
return end(code);
|
|
}
|
|
return emailValue(code);
|
|
}
|
|
function emailValue(code) {
|
|
if ((code === 45 || asciiAlphanumeric(code)) && size++ < 63) {
|
|
effects.consume(code);
|
|
return code === 45 ? emailValue : emailLabel;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function end(code) {
|
|
effects.enter("autolinkMarker");
|
|
effects.consume(code);
|
|
effects.exit("autolinkMarker");
|
|
effects.exit("autolink");
|
|
return ok;
|
|
}
|
|
}
|
|
module2.exports = autolink;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/block-quote.js
|
|
var require_block_quote = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/block-quote.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownSpace = require_markdown_space();
|
|
var factorySpace = require_factory_space();
|
|
var blockQuote = {
|
|
name: "blockQuote",
|
|
tokenize: tokenizeBlockQuoteStart,
|
|
continuation: {
|
|
tokenize: tokenizeBlockQuoteContinuation
|
|
},
|
|
exit
|
|
};
|
|
function tokenizeBlockQuoteStart(effects, ok, nok) {
|
|
var self = this;
|
|
return start;
|
|
function start(code) {
|
|
if (code === 62) {
|
|
if (!self.containerState.open) {
|
|
effects.enter("blockQuote", {
|
|
_container: true
|
|
});
|
|
self.containerState.open = true;
|
|
}
|
|
effects.enter("blockQuotePrefix");
|
|
effects.enter("blockQuoteMarker");
|
|
effects.consume(code);
|
|
effects.exit("blockQuoteMarker");
|
|
return after;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function after(code) {
|
|
if (markdownSpace(code)) {
|
|
effects.enter("blockQuotePrefixWhitespace");
|
|
effects.consume(code);
|
|
effects.exit("blockQuotePrefixWhitespace");
|
|
effects.exit("blockQuotePrefix");
|
|
return ok;
|
|
}
|
|
effects.exit("blockQuotePrefix");
|
|
return ok(code);
|
|
}
|
|
}
|
|
function tokenizeBlockQuoteContinuation(effects, ok, nok) {
|
|
return factorySpace(effects, effects.attempt(blockQuote, ok, nok), "linePrefix", this.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4);
|
|
}
|
|
function exit(effects) {
|
|
effects.exit("blockQuote");
|
|
}
|
|
module2.exports = blockQuote;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-punctuation.js
|
|
var require_ascii_punctuation = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-punctuation.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
|
|
module2.exports = asciiPunctuation;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/character-escape.js
|
|
var require_character_escape = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/character-escape.js"(exports, module2) {
|
|
"use strict";
|
|
var asciiPunctuation = require_ascii_punctuation();
|
|
var characterEscape = {
|
|
name: "characterEscape",
|
|
tokenize: tokenizeCharacterEscape
|
|
};
|
|
function tokenizeCharacterEscape(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("characterEscape");
|
|
effects.enter("escapeMarker");
|
|
effects.consume(code);
|
|
effects.exit("escapeMarker");
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (asciiPunctuation(code)) {
|
|
effects.enter("characterEscapeValue");
|
|
effects.consume(code);
|
|
effects.exit("characterEscapeValue");
|
|
effects.exit("characterEscape");
|
|
return ok;
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
module2.exports = characterEscape;
|
|
}
|
|
});
|
|
|
|
// node_modules/parse-entities/decode-entity.browser.js
|
|
var require_decode_entity_browser = __commonJS({
|
|
"node_modules/parse-entities/decode-entity.browser.js"(exports, module2) {
|
|
"use strict";
|
|
var el;
|
|
var semicolon = 59;
|
|
module2.exports = decodeEntity;
|
|
function decodeEntity(characters) {
|
|
var entity = "&" + characters + ";";
|
|
var char;
|
|
el = el || document.createElement("i");
|
|
el.innerHTML = entity;
|
|
char = el.textContent;
|
|
if (char.charCodeAt(char.length - 1) === semicolon && characters !== "semi") {
|
|
return false;
|
|
}
|
|
return char === entity ? false : char;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-digit.js
|
|
var require_ascii_digit = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-digit.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var asciiDigit = regexCheck(/\d/);
|
|
module2.exports = asciiDigit;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/character/ascii-hex-digit.js
|
|
var require_ascii_hex_digit = __commonJS({
|
|
"node_modules/micromark/dist/character/ascii-hex-digit.js"(exports, module2) {
|
|
"use strict";
|
|
var regexCheck = require_regex_check();
|
|
var asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
|
|
module2.exports = asciiHexDigit;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/character-reference.js
|
|
var require_character_reference = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/character-reference.js"(exports, module2) {
|
|
"use strict";
|
|
var decodeEntity = require_decode_entity_browser();
|
|
var asciiAlphanumeric = require_ascii_alphanumeric();
|
|
var asciiDigit = require_ascii_digit();
|
|
var asciiHexDigit = require_ascii_hex_digit();
|
|
function _interopDefaultLegacy(e) {
|
|
return e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
}
|
|
var decodeEntity__default = /* @__PURE__ */ _interopDefaultLegacy(decodeEntity);
|
|
var characterReference = {
|
|
name: "characterReference",
|
|
tokenize: tokenizeCharacterReference
|
|
};
|
|
function tokenizeCharacterReference(effects, ok, nok) {
|
|
var self = this;
|
|
var size = 0;
|
|
var max;
|
|
var test;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("characterReference");
|
|
effects.enter("characterReferenceMarker");
|
|
effects.consume(code);
|
|
effects.exit("characterReferenceMarker");
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (code === 35) {
|
|
effects.enter("characterReferenceMarkerNumeric");
|
|
effects.consume(code);
|
|
effects.exit("characterReferenceMarkerNumeric");
|
|
return numeric;
|
|
}
|
|
effects.enter("characterReferenceValue");
|
|
max = 31;
|
|
test = asciiAlphanumeric;
|
|
return value(code);
|
|
}
|
|
function numeric(code) {
|
|
if (code === 88 || code === 120) {
|
|
effects.enter("characterReferenceMarkerHexadecimal");
|
|
effects.consume(code);
|
|
effects.exit("characterReferenceMarkerHexadecimal");
|
|
effects.enter("characterReferenceValue");
|
|
max = 6;
|
|
test = asciiHexDigit;
|
|
return value;
|
|
}
|
|
effects.enter("characterReferenceValue");
|
|
max = 7;
|
|
test = asciiDigit;
|
|
return value(code);
|
|
}
|
|
function value(code) {
|
|
var token;
|
|
if (code === 59 && size) {
|
|
token = effects.exit("characterReferenceValue");
|
|
if (test === asciiAlphanumeric && !decodeEntity__default["default"](self.sliceSerialize(token))) {
|
|
return nok(code);
|
|
}
|
|
effects.enter("characterReferenceMarker");
|
|
effects.consume(code);
|
|
effects.exit("characterReferenceMarker");
|
|
effects.exit("characterReference");
|
|
return ok;
|
|
}
|
|
if (test(code) && size++ < max) {
|
|
effects.consume(code);
|
|
return value;
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
module2.exports = characterReference;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/code-fenced.js
|
|
var require_code_fenced = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/code-fenced.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var prefixSize = require_prefix_size();
|
|
var factorySpace = require_factory_space();
|
|
var codeFenced = {
|
|
name: "codeFenced",
|
|
tokenize: tokenizeCodeFenced,
|
|
concrete: true
|
|
};
|
|
function tokenizeCodeFenced(effects, ok, nok) {
|
|
var self = this;
|
|
var closingFenceConstruct = {
|
|
tokenize: tokenizeClosingFence,
|
|
partial: true
|
|
};
|
|
var initialPrefix = prefixSize(this.events, "linePrefix");
|
|
var sizeOpen = 0;
|
|
var marker;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("codeFenced");
|
|
effects.enter("codeFencedFence");
|
|
effects.enter("codeFencedFenceSequence");
|
|
marker = code;
|
|
return sequenceOpen(code);
|
|
}
|
|
function sequenceOpen(code) {
|
|
if (code === marker) {
|
|
effects.consume(code);
|
|
sizeOpen++;
|
|
return sequenceOpen;
|
|
}
|
|
effects.exit("codeFencedFenceSequence");
|
|
return sizeOpen < 3 ? nok(code) : factorySpace(effects, infoOpen, "whitespace")(code);
|
|
}
|
|
function infoOpen(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
return openAfter(code);
|
|
}
|
|
effects.enter("codeFencedFenceInfo");
|
|
effects.enter("chunkString", {
|
|
contentType: "string"
|
|
});
|
|
return info(code);
|
|
}
|
|
function info(code) {
|
|
if (code === null || markdownLineEndingOrSpace(code)) {
|
|
effects.exit("chunkString");
|
|
effects.exit("codeFencedFenceInfo");
|
|
return factorySpace(effects, infoAfter, "whitespace")(code);
|
|
}
|
|
if (code === 96 && code === marker)
|
|
return nok(code);
|
|
effects.consume(code);
|
|
return info;
|
|
}
|
|
function infoAfter(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
return openAfter(code);
|
|
}
|
|
effects.enter("codeFencedFenceMeta");
|
|
effects.enter("chunkString", {
|
|
contentType: "string"
|
|
});
|
|
return meta(code);
|
|
}
|
|
function meta(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("chunkString");
|
|
effects.exit("codeFencedFenceMeta");
|
|
return openAfter(code);
|
|
}
|
|
if (code === 96 && code === marker)
|
|
return nok(code);
|
|
effects.consume(code);
|
|
return meta;
|
|
}
|
|
function openAfter(code) {
|
|
effects.exit("codeFencedFence");
|
|
return self.interrupt ? ok(code) : content(code);
|
|
}
|
|
function content(code) {
|
|
if (code === null) {
|
|
return after(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return effects.attempt(closingFenceConstruct, after, initialPrefix ? factorySpace(effects, content, "linePrefix", initialPrefix + 1) : content);
|
|
}
|
|
effects.enter("codeFlowValue");
|
|
return contentContinue(code);
|
|
}
|
|
function contentContinue(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("codeFlowValue");
|
|
return content(code);
|
|
}
|
|
effects.consume(code);
|
|
return contentContinue;
|
|
}
|
|
function after(code) {
|
|
effects.exit("codeFenced");
|
|
return ok(code);
|
|
}
|
|
function tokenizeClosingFence(effects2, ok2, nok2) {
|
|
var size = 0;
|
|
return factorySpace(effects2, closingSequenceStart, "linePrefix", this.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4);
|
|
function closingSequenceStart(code) {
|
|
effects2.enter("codeFencedFence");
|
|
effects2.enter("codeFencedFenceSequence");
|
|
return closingSequence(code);
|
|
}
|
|
function closingSequence(code) {
|
|
if (code === marker) {
|
|
effects2.consume(code);
|
|
size++;
|
|
return closingSequence;
|
|
}
|
|
if (size < sizeOpen)
|
|
return nok2(code);
|
|
effects2.exit("codeFencedFenceSequence");
|
|
return factorySpace(effects2, closingSequenceEnd, "whitespace")(code);
|
|
}
|
|
function closingSequenceEnd(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects2.exit("codeFencedFence");
|
|
return ok2(code);
|
|
}
|
|
return nok2(code);
|
|
}
|
|
}
|
|
}
|
|
module2.exports = codeFenced;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/code-indented.js
|
|
var require_code_indented = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/code-indented.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var prefixSize = require_prefix_size();
|
|
var factorySpace = require_factory_space();
|
|
var codeIndented = {
|
|
name: "codeIndented",
|
|
tokenize: tokenizeCodeIndented,
|
|
resolve: resolveCodeIndented
|
|
};
|
|
var indentedContentConstruct = {
|
|
tokenize: tokenizeIndentedContent,
|
|
partial: true
|
|
};
|
|
function resolveCodeIndented(events, context) {
|
|
var code = {
|
|
type: "codeIndented",
|
|
start: events[0][1].start,
|
|
end: events[events.length - 1][1].end
|
|
};
|
|
chunkedSplice(events, 0, 0, [["enter", code, context]]);
|
|
chunkedSplice(events, events.length, 0, [["exit", code, context]]);
|
|
return events;
|
|
}
|
|
function tokenizeCodeIndented(effects, ok, nok) {
|
|
return effects.attempt(indentedContentConstruct, afterPrefix, nok);
|
|
function afterPrefix(code) {
|
|
if (code === null) {
|
|
return ok(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
return effects.attempt(indentedContentConstruct, afterPrefix, ok)(code);
|
|
}
|
|
effects.enter("codeFlowValue");
|
|
return content(code);
|
|
}
|
|
function content(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("codeFlowValue");
|
|
return afterPrefix(code);
|
|
}
|
|
effects.consume(code);
|
|
return content;
|
|
}
|
|
}
|
|
function tokenizeIndentedContent(effects, ok, nok) {
|
|
var self = this;
|
|
return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1);
|
|
function afterPrefix(code) {
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1);
|
|
}
|
|
return prefixSize(self.events, "linePrefix") < 4 ? nok(code) : ok(code);
|
|
}
|
|
}
|
|
module2.exports = codeIndented;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/code-text.js
|
|
var require_code_text = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/code-text.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var codeText = {
|
|
name: "codeText",
|
|
tokenize: tokenizeCodeText,
|
|
resolve: resolveCodeText,
|
|
previous
|
|
};
|
|
function resolveCodeText(events) {
|
|
var tailExitIndex = events.length - 4;
|
|
var headEnterIndex = 3;
|
|
var index;
|
|
var enter;
|
|
if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) {
|
|
index = headEnterIndex;
|
|
while (++index < tailExitIndex) {
|
|
if (events[index][1].type === "codeTextData") {
|
|
events[tailExitIndex][1].type = events[headEnterIndex][1].type = "codeTextPadding";
|
|
headEnterIndex += 2;
|
|
tailExitIndex -= 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
index = headEnterIndex - 1;
|
|
tailExitIndex++;
|
|
while (++index <= tailExitIndex) {
|
|
if (enter === void 0) {
|
|
if (index !== tailExitIndex && events[index][1].type !== "lineEnding") {
|
|
enter = index;
|
|
}
|
|
} else if (index === tailExitIndex || events[index][1].type === "lineEnding") {
|
|
events[enter][1].type = "codeTextData";
|
|
if (index !== enter + 2) {
|
|
events[enter][1].end = events[index - 1][1].end;
|
|
events.splice(enter + 2, index - enter - 2);
|
|
tailExitIndex -= index - enter - 2;
|
|
index = enter + 2;
|
|
}
|
|
enter = void 0;
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
function previous(code) {
|
|
return code !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
|
|
}
|
|
function tokenizeCodeText(effects, ok, nok) {
|
|
var sizeOpen = 0;
|
|
var size;
|
|
var token;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("codeText");
|
|
effects.enter("codeTextSequence");
|
|
return openingSequence(code);
|
|
}
|
|
function openingSequence(code) {
|
|
if (code === 96) {
|
|
effects.consume(code);
|
|
sizeOpen++;
|
|
return openingSequence;
|
|
}
|
|
effects.exit("codeTextSequence");
|
|
return gap(code);
|
|
}
|
|
function gap(code) {
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (code === 96) {
|
|
token = effects.enter("codeTextSequence");
|
|
size = 0;
|
|
return closingSequence(code);
|
|
}
|
|
if (code === 32) {
|
|
effects.enter("space");
|
|
effects.consume(code);
|
|
effects.exit("space");
|
|
return gap;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return gap;
|
|
}
|
|
effects.enter("codeTextData");
|
|
return data(code);
|
|
}
|
|
function data(code) {
|
|
if (code === null || code === 32 || code === 96 || markdownLineEnding(code)) {
|
|
effects.exit("codeTextData");
|
|
return gap(code);
|
|
}
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
function closingSequence(code) {
|
|
if (code === 96) {
|
|
effects.consume(code);
|
|
size++;
|
|
return closingSequence;
|
|
}
|
|
if (size === sizeOpen) {
|
|
effects.exit("codeTextSequence");
|
|
effects.exit("codeText");
|
|
return ok(code);
|
|
}
|
|
token.type = "codeTextData";
|
|
return data(code);
|
|
}
|
|
}
|
|
module2.exports = codeText;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/factory-destination.js
|
|
var require_factory_destination = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/factory-destination.js"(exports, module2) {
|
|
"use strict";
|
|
var asciiControl = require_ascii_control();
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
function destinationFactory(effects, ok, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
|
|
var limit = max || Infinity;
|
|
var balance = 0;
|
|
return start;
|
|
function start(code) {
|
|
if (code === 60) {
|
|
effects.enter(type);
|
|
effects.enter(literalType);
|
|
effects.enter(literalMarkerType);
|
|
effects.consume(code);
|
|
effects.exit(literalMarkerType);
|
|
return destinationEnclosedBefore;
|
|
}
|
|
if (asciiControl(code) || code === 41) {
|
|
return nok(code);
|
|
}
|
|
effects.enter(type);
|
|
effects.enter(rawType);
|
|
effects.enter(stringType);
|
|
effects.enter("chunkString", {
|
|
contentType: "string"
|
|
});
|
|
return destinationRaw(code);
|
|
}
|
|
function destinationEnclosedBefore(code) {
|
|
if (code === 62) {
|
|
effects.enter(literalMarkerType);
|
|
effects.consume(code);
|
|
effects.exit(literalMarkerType);
|
|
effects.exit(literalType);
|
|
effects.exit(type);
|
|
return ok;
|
|
}
|
|
effects.enter(stringType);
|
|
effects.enter("chunkString", {
|
|
contentType: "string"
|
|
});
|
|
return destinationEnclosed(code);
|
|
}
|
|
function destinationEnclosed(code) {
|
|
if (code === 62) {
|
|
effects.exit("chunkString");
|
|
effects.exit(stringType);
|
|
return destinationEnclosedBefore(code);
|
|
}
|
|
if (code === null || code === 60 || markdownLineEnding(code)) {
|
|
return nok(code);
|
|
}
|
|
effects.consume(code);
|
|
return code === 92 ? destinationEnclosedEscape : destinationEnclosed;
|
|
}
|
|
function destinationEnclosedEscape(code) {
|
|
if (code === 60 || code === 62 || code === 92) {
|
|
effects.consume(code);
|
|
return destinationEnclosed;
|
|
}
|
|
return destinationEnclosed(code);
|
|
}
|
|
function destinationRaw(code) {
|
|
if (code === 40) {
|
|
if (++balance > limit)
|
|
return nok(code);
|
|
effects.consume(code);
|
|
return destinationRaw;
|
|
}
|
|
if (code === 41) {
|
|
if (!balance--) {
|
|
effects.exit("chunkString");
|
|
effects.exit(stringType);
|
|
effects.exit(rawType);
|
|
effects.exit(type);
|
|
return ok(code);
|
|
}
|
|
effects.consume(code);
|
|
return destinationRaw;
|
|
}
|
|
if (code === null || markdownLineEndingOrSpace(code)) {
|
|
if (balance)
|
|
return nok(code);
|
|
effects.exit("chunkString");
|
|
effects.exit(stringType);
|
|
effects.exit(rawType);
|
|
effects.exit(type);
|
|
return ok(code);
|
|
}
|
|
if (asciiControl(code))
|
|
return nok(code);
|
|
effects.consume(code);
|
|
return code === 92 ? destinationRawEscape : destinationRaw;
|
|
}
|
|
function destinationRawEscape(code) {
|
|
if (code === 40 || code === 41 || code === 92) {
|
|
effects.consume(code);
|
|
return destinationRaw;
|
|
}
|
|
return destinationRaw(code);
|
|
}
|
|
}
|
|
module2.exports = destinationFactory;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/factory-label.js
|
|
var require_factory_label = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/factory-label.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownSpace = require_markdown_space();
|
|
function labelFactory(effects, ok, nok, type, markerType, stringType) {
|
|
var self = this;
|
|
var size = 0;
|
|
var data;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter(type);
|
|
effects.enter(markerType);
|
|
effects.consume(code);
|
|
effects.exit(markerType);
|
|
effects.enter(stringType);
|
|
return atBreak;
|
|
}
|
|
function atBreak(code) {
|
|
if (code === null || code === 91 || code === 93 && !data || code === 94 && !size && "_hiddenFootnoteSupport" in self.parser.constructs || size > 999) {
|
|
return nok(code);
|
|
}
|
|
if (code === 93) {
|
|
effects.exit(stringType);
|
|
effects.enter(markerType);
|
|
effects.consume(code);
|
|
effects.exit(markerType);
|
|
effects.exit(type);
|
|
return ok;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return atBreak;
|
|
}
|
|
effects.enter("chunkString", {
|
|
contentType: "string"
|
|
});
|
|
return label(code);
|
|
}
|
|
function label(code) {
|
|
if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) {
|
|
effects.exit("chunkString");
|
|
return atBreak(code);
|
|
}
|
|
effects.consume(code);
|
|
data = data || !markdownSpace(code);
|
|
return code === 92 ? labelEscape : label;
|
|
}
|
|
function labelEscape(code) {
|
|
if (code === 91 || code === 92 || code === 93) {
|
|
effects.consume(code);
|
|
size++;
|
|
return label;
|
|
}
|
|
return label(code);
|
|
}
|
|
}
|
|
module2.exports = labelFactory;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/factory-whitespace.js
|
|
var require_factory_whitespace = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/factory-whitespace.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownSpace = require_markdown_space();
|
|
var factorySpace = require_factory_space();
|
|
function whitespaceFactory(effects, ok) {
|
|
var seen;
|
|
return start;
|
|
function start(code) {
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
seen = true;
|
|
return start;
|
|
}
|
|
if (markdownSpace(code)) {
|
|
return factorySpace(effects, start, seen ? "linePrefix" : "lineSuffix")(code);
|
|
}
|
|
return ok(code);
|
|
}
|
|
}
|
|
module2.exports = whitespaceFactory;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/factory-title.js
|
|
var require_factory_title = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/factory-title.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var factorySpace = require_factory_space();
|
|
function titleFactory(effects, ok, nok, type, markerType, stringType) {
|
|
var marker;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter(type);
|
|
effects.enter(markerType);
|
|
effects.consume(code);
|
|
effects.exit(markerType);
|
|
marker = code === 40 ? 41 : code;
|
|
return atFirstTitleBreak;
|
|
}
|
|
function atFirstTitleBreak(code) {
|
|
if (code === marker) {
|
|
effects.enter(markerType);
|
|
effects.consume(code);
|
|
effects.exit(markerType);
|
|
effects.exit(type);
|
|
return ok;
|
|
}
|
|
effects.enter(stringType);
|
|
return atTitleBreak(code);
|
|
}
|
|
function atTitleBreak(code) {
|
|
if (code === marker) {
|
|
effects.exit(stringType);
|
|
return atFirstTitleBreak(marker);
|
|
}
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return factorySpace(effects, atTitleBreak, "linePrefix");
|
|
}
|
|
effects.enter("chunkString", {
|
|
contentType: "string"
|
|
});
|
|
return title(code);
|
|
}
|
|
function title(code) {
|
|
if (code === marker || code === null || markdownLineEnding(code)) {
|
|
effects.exit("chunkString");
|
|
return atTitleBreak(code);
|
|
}
|
|
effects.consume(code);
|
|
return code === 92 ? titleEscape : title;
|
|
}
|
|
function titleEscape(code) {
|
|
if (code === marker || code === 92) {
|
|
effects.consume(code);
|
|
return title;
|
|
}
|
|
return title(code);
|
|
}
|
|
}
|
|
module2.exports = titleFactory;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/definition.js
|
|
var require_definition = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/definition.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var normalizeIdentifier = require_normalize_identifier();
|
|
var factoryDestination = require_factory_destination();
|
|
var factoryLabel = require_factory_label();
|
|
var factorySpace = require_factory_space();
|
|
var factoryWhitespace = require_factory_whitespace();
|
|
var factoryTitle = require_factory_title();
|
|
var definition = {
|
|
name: "definition",
|
|
tokenize: tokenizeDefinition
|
|
};
|
|
var titleConstruct = {
|
|
tokenize: tokenizeTitle,
|
|
partial: true
|
|
};
|
|
function tokenizeDefinition(effects, ok, nok) {
|
|
var self = this;
|
|
var identifier;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("definition");
|
|
return factoryLabel.call(self, effects, labelAfter, nok, "definitionLabel", "definitionLabelMarker", "definitionLabelString")(code);
|
|
}
|
|
function labelAfter(code) {
|
|
identifier = normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1));
|
|
if (code === 58) {
|
|
effects.enter("definitionMarker");
|
|
effects.consume(code);
|
|
effects.exit("definitionMarker");
|
|
return factoryWhitespace(effects, factoryDestination(effects, effects.attempt(titleConstruct, factorySpace(effects, after, "whitespace"), factorySpace(effects, after, "whitespace")), nok, "definitionDestination", "definitionDestinationLiteral", "definitionDestinationLiteralMarker", "definitionDestinationRaw", "definitionDestinationString"));
|
|
}
|
|
return nok(code);
|
|
}
|
|
function after(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("definition");
|
|
if (self.parser.defined.indexOf(identifier) < 0) {
|
|
self.parser.defined.push(identifier);
|
|
}
|
|
return ok(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
function tokenizeTitle(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, before)(code) : nok(code);
|
|
}
|
|
function before(code) {
|
|
if (code === 34 || code === 39 || code === 40) {
|
|
return factoryTitle(effects, factorySpace(effects, after, "whitespace"), nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function after(code) {
|
|
return code === null || markdownLineEnding(code) ? ok(code) : nok(code);
|
|
}
|
|
}
|
|
module2.exports = definition;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/hard-break-escape.js
|
|
var require_hard_break_escape = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/hard-break-escape.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var hardBreakEscape = {
|
|
name: "hardBreakEscape",
|
|
tokenize: tokenizeHardBreakEscape
|
|
};
|
|
function tokenizeHardBreakEscape(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("hardBreakEscape");
|
|
effects.enter("escapeMarker");
|
|
effects.consume(code);
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (markdownLineEnding(code)) {
|
|
effects.exit("escapeMarker");
|
|
effects.exit("hardBreakEscape");
|
|
return ok(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
module2.exports = hardBreakEscape;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/heading-atx.js
|
|
var require_heading_atx = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/heading-atx.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var markdownSpace = require_markdown_space();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var factorySpace = require_factory_space();
|
|
var headingAtx = {
|
|
name: "headingAtx",
|
|
tokenize: tokenizeHeadingAtx,
|
|
resolve: resolveHeadingAtx
|
|
};
|
|
function resolveHeadingAtx(events, context) {
|
|
var contentEnd = events.length - 2;
|
|
var contentStart = 3;
|
|
var content;
|
|
var text;
|
|
if (events[contentStart][1].type === "whitespace") {
|
|
contentStart += 2;
|
|
}
|
|
if (contentEnd - 2 > contentStart && events[contentEnd][1].type === "whitespace") {
|
|
contentEnd -= 2;
|
|
}
|
|
if (events[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events[contentEnd - 2][1].type === "whitespace")) {
|
|
contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
|
|
}
|
|
if (contentEnd > contentStart) {
|
|
content = {
|
|
type: "atxHeadingText",
|
|
start: events[contentStart][1].start,
|
|
end: events[contentEnd][1].end
|
|
};
|
|
text = {
|
|
type: "chunkText",
|
|
start: events[contentStart][1].start,
|
|
end: events[contentEnd][1].end,
|
|
contentType: "text"
|
|
};
|
|
chunkedSplice(events, contentStart, contentEnd - contentStart + 1, [
|
|
["enter", content, context],
|
|
["enter", text, context],
|
|
["exit", text, context],
|
|
["exit", content, context]
|
|
]);
|
|
}
|
|
return events;
|
|
}
|
|
function tokenizeHeadingAtx(effects, ok, nok) {
|
|
var self = this;
|
|
var size = 0;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("atxHeading");
|
|
effects.enter("atxHeadingSequence");
|
|
return fenceOpenInside(code);
|
|
}
|
|
function fenceOpenInside(code) {
|
|
if (code === 35 && size++ < 6) {
|
|
effects.consume(code);
|
|
return fenceOpenInside;
|
|
}
|
|
if (code === null || markdownLineEndingOrSpace(code)) {
|
|
effects.exit("atxHeadingSequence");
|
|
return self.interrupt ? ok(code) : headingBreak(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function headingBreak(code) {
|
|
if (code === 35) {
|
|
effects.enter("atxHeadingSequence");
|
|
return sequence(code);
|
|
}
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("atxHeading");
|
|
return ok(code);
|
|
}
|
|
if (markdownSpace(code)) {
|
|
return factorySpace(effects, headingBreak, "whitespace")(code);
|
|
}
|
|
effects.enter("atxHeadingText");
|
|
return data(code);
|
|
}
|
|
function sequence(code) {
|
|
if (code === 35) {
|
|
effects.consume(code);
|
|
return sequence;
|
|
}
|
|
effects.exit("atxHeadingSequence");
|
|
return headingBreak(code);
|
|
}
|
|
function data(code) {
|
|
if (code === null || code === 35 || markdownLineEndingOrSpace(code)) {
|
|
effects.exit("atxHeadingText");
|
|
return headingBreak(code);
|
|
}
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
}
|
|
module2.exports = headingAtx;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/html-block-names.js
|
|
var require_html_block_names = __commonJS({
|
|
"node_modules/micromark/dist/constant/html-block-names.js"(exports, module2) {
|
|
"use strict";
|
|
var basics = [
|
|
"address",
|
|
"article",
|
|
"aside",
|
|
"base",
|
|
"basefont",
|
|
"blockquote",
|
|
"body",
|
|
"caption",
|
|
"center",
|
|
"col",
|
|
"colgroup",
|
|
"dd",
|
|
"details",
|
|
"dialog",
|
|
"dir",
|
|
"div",
|
|
"dl",
|
|
"dt",
|
|
"fieldset",
|
|
"figcaption",
|
|
"figure",
|
|
"footer",
|
|
"form",
|
|
"frame",
|
|
"frameset",
|
|
"h1",
|
|
"h2",
|
|
"h3",
|
|
"h4",
|
|
"h5",
|
|
"h6",
|
|
"head",
|
|
"header",
|
|
"hr",
|
|
"html",
|
|
"iframe",
|
|
"legend",
|
|
"li",
|
|
"link",
|
|
"main",
|
|
"menu",
|
|
"menuitem",
|
|
"nav",
|
|
"noframes",
|
|
"ol",
|
|
"optgroup",
|
|
"option",
|
|
"p",
|
|
"param",
|
|
"section",
|
|
"source",
|
|
"summary",
|
|
"table",
|
|
"tbody",
|
|
"td",
|
|
"tfoot",
|
|
"th",
|
|
"thead",
|
|
"title",
|
|
"tr",
|
|
"track",
|
|
"ul"
|
|
];
|
|
module2.exports = basics;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constant/html-raw-names.js
|
|
var require_html_raw_names = __commonJS({
|
|
"node_modules/micromark/dist/constant/html-raw-names.js"(exports, module2) {
|
|
"use strict";
|
|
var raws = ["pre", "script", "style", "textarea"];
|
|
module2.exports = raws;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/html-flow.js
|
|
var require_html_flow = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/html-flow.js"(exports, module2) {
|
|
"use strict";
|
|
var asciiAlpha = require_ascii_alpha();
|
|
var asciiAlphanumeric = require_ascii_alphanumeric();
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var markdownSpace = require_markdown_space();
|
|
var fromCharCode = require_from_char_code();
|
|
var htmlBlockNames = require_html_block_names();
|
|
var htmlRawNames = require_html_raw_names();
|
|
var partialBlankLine = require_partial_blank_line();
|
|
var htmlFlow = {
|
|
name: "htmlFlow",
|
|
tokenize: tokenizeHtmlFlow,
|
|
resolveTo: resolveToHtmlFlow,
|
|
concrete: true
|
|
};
|
|
var nextBlankConstruct = {
|
|
tokenize: tokenizeNextBlank,
|
|
partial: true
|
|
};
|
|
function resolveToHtmlFlow(events) {
|
|
var index = events.length;
|
|
while (index--) {
|
|
if (events[index][0] === "enter" && events[index][1].type === "htmlFlow") {
|
|
break;
|
|
}
|
|
}
|
|
if (index > 1 && events[index - 2][1].type === "linePrefix") {
|
|
events[index][1].start = events[index - 2][1].start;
|
|
events[index + 1][1].start = events[index - 2][1].start;
|
|
events.splice(index - 2, 2);
|
|
}
|
|
return events;
|
|
}
|
|
function tokenizeHtmlFlow(effects, ok, nok) {
|
|
var self = this;
|
|
var kind;
|
|
var startTag;
|
|
var buffer;
|
|
var index;
|
|
var marker;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("htmlFlow");
|
|
effects.enter("htmlFlowData");
|
|
effects.consume(code);
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (code === 33) {
|
|
effects.consume(code);
|
|
return declarationStart;
|
|
}
|
|
if (code === 47) {
|
|
effects.consume(code);
|
|
return tagCloseStart;
|
|
}
|
|
if (code === 63) {
|
|
effects.consume(code);
|
|
kind = 3;
|
|
return self.interrupt ? ok : continuationDeclarationInside;
|
|
}
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
buffer = fromCharCode(code);
|
|
startTag = true;
|
|
return tagName;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function declarationStart(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
kind = 2;
|
|
return commentOpenInside;
|
|
}
|
|
if (code === 91) {
|
|
effects.consume(code);
|
|
kind = 5;
|
|
buffer = "CDATA[";
|
|
index = 0;
|
|
return cdataOpenInside;
|
|
}
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
kind = 4;
|
|
return self.interrupt ? ok : continuationDeclarationInside;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function commentOpenInside(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return self.interrupt ? ok : continuationDeclarationInside;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function cdataOpenInside(code) {
|
|
if (code === buffer.charCodeAt(index++)) {
|
|
effects.consume(code);
|
|
return index === buffer.length ? self.interrupt ? ok : continuation : cdataOpenInside;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function tagCloseStart(code) {
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
buffer = fromCharCode(code);
|
|
return tagName;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function tagName(code) {
|
|
if (code === null || code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
|
|
if (code !== 47 && startTag && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) {
|
|
kind = 1;
|
|
return self.interrupt ? ok(code) : continuation(code);
|
|
}
|
|
if (htmlBlockNames.indexOf(buffer.toLowerCase()) > -1) {
|
|
kind = 6;
|
|
if (code === 47) {
|
|
effects.consume(code);
|
|
return basicSelfClosing;
|
|
}
|
|
return self.interrupt ? ok(code) : continuation(code);
|
|
}
|
|
kind = 7;
|
|
return self.interrupt ? nok(code) : startTag ? completeAttributeNameBefore(code) : completeClosingTagAfter(code);
|
|
}
|
|
if (code === 45 || asciiAlphanumeric(code)) {
|
|
effects.consume(code);
|
|
buffer += fromCharCode(code);
|
|
return tagName;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function basicSelfClosing(code) {
|
|
if (code === 62) {
|
|
effects.consume(code);
|
|
return self.interrupt ? ok : continuation;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function completeClosingTagAfter(code) {
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return completeClosingTagAfter;
|
|
}
|
|
return completeEnd(code);
|
|
}
|
|
function completeAttributeNameBefore(code) {
|
|
if (code === 47) {
|
|
effects.consume(code);
|
|
return completeEnd;
|
|
}
|
|
if (code === 58 || code === 95 || asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
return completeAttributeName;
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return completeAttributeNameBefore;
|
|
}
|
|
return completeEnd(code);
|
|
}
|
|
function completeAttributeName(code) {
|
|
if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
|
|
effects.consume(code);
|
|
return completeAttributeName;
|
|
}
|
|
return completeAttributeNameAfter(code);
|
|
}
|
|
function completeAttributeNameAfter(code) {
|
|
if (code === 61) {
|
|
effects.consume(code);
|
|
return completeAttributeValueBefore;
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return completeAttributeNameAfter;
|
|
}
|
|
return completeAttributeNameBefore(code);
|
|
}
|
|
function completeAttributeValueBefore(code) {
|
|
if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {
|
|
return nok(code);
|
|
}
|
|
if (code === 34 || code === 39) {
|
|
effects.consume(code);
|
|
marker = code;
|
|
return completeAttributeValueQuoted;
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return completeAttributeValueBefore;
|
|
}
|
|
marker = void 0;
|
|
return completeAttributeValueUnquoted(code);
|
|
}
|
|
function completeAttributeValueQuoted(code) {
|
|
if (code === marker) {
|
|
effects.consume(code);
|
|
return completeAttributeValueQuotedAfter;
|
|
}
|
|
if (code === null || markdownLineEnding(code)) {
|
|
return nok(code);
|
|
}
|
|
effects.consume(code);
|
|
return completeAttributeValueQuoted;
|
|
}
|
|
function completeAttributeValueUnquoted(code) {
|
|
if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 62 || code === 96 || markdownLineEndingOrSpace(code)) {
|
|
return completeAttributeNameAfter(code);
|
|
}
|
|
effects.consume(code);
|
|
return completeAttributeValueUnquoted;
|
|
}
|
|
function completeAttributeValueQuotedAfter(code) {
|
|
if (code === 47 || code === 62 || markdownSpace(code)) {
|
|
return completeAttributeNameBefore(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function completeEnd(code) {
|
|
if (code === 62) {
|
|
effects.consume(code);
|
|
return completeAfter;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function completeAfter(code) {
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return completeAfter;
|
|
}
|
|
return code === null || markdownLineEnding(code) ? continuation(code) : nok(code);
|
|
}
|
|
function continuation(code) {
|
|
if (code === 45 && kind === 2) {
|
|
effects.consume(code);
|
|
return continuationCommentInside;
|
|
}
|
|
if (code === 60 && kind === 1) {
|
|
effects.consume(code);
|
|
return continuationRawTagOpen;
|
|
}
|
|
if (code === 62 && kind === 4) {
|
|
effects.consume(code);
|
|
return continuationClose;
|
|
}
|
|
if (code === 63 && kind === 3) {
|
|
effects.consume(code);
|
|
return continuationDeclarationInside;
|
|
}
|
|
if (code === 93 && kind === 5) {
|
|
effects.consume(code);
|
|
return continuationCharacterDataInside;
|
|
}
|
|
if (markdownLineEnding(code) && (kind === 6 || kind === 7)) {
|
|
return effects.check(nextBlankConstruct, continuationClose, continuationAtLineEnding)(code);
|
|
}
|
|
if (code === null || markdownLineEnding(code)) {
|
|
return continuationAtLineEnding(code);
|
|
}
|
|
effects.consume(code);
|
|
return continuation;
|
|
}
|
|
function continuationAtLineEnding(code) {
|
|
effects.exit("htmlFlowData");
|
|
return htmlContinueStart(code);
|
|
}
|
|
function htmlContinueStart(code) {
|
|
if (code === null) {
|
|
return done(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return htmlContinueStart;
|
|
}
|
|
effects.enter("htmlFlowData");
|
|
return continuation(code);
|
|
}
|
|
function continuationCommentInside(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return continuationDeclarationInside;
|
|
}
|
|
return continuation(code);
|
|
}
|
|
function continuationRawTagOpen(code) {
|
|
if (code === 47) {
|
|
effects.consume(code);
|
|
buffer = "";
|
|
return continuationRawEndTag;
|
|
}
|
|
return continuation(code);
|
|
}
|
|
function continuationRawEndTag(code) {
|
|
if (code === 62 && htmlRawNames.indexOf(buffer.toLowerCase()) > -1) {
|
|
effects.consume(code);
|
|
return continuationClose;
|
|
}
|
|
if (asciiAlpha(code) && buffer.length < 8) {
|
|
effects.consume(code);
|
|
buffer += fromCharCode(code);
|
|
return continuationRawEndTag;
|
|
}
|
|
return continuation(code);
|
|
}
|
|
function continuationCharacterDataInside(code) {
|
|
if (code === 93) {
|
|
effects.consume(code);
|
|
return continuationDeclarationInside;
|
|
}
|
|
return continuation(code);
|
|
}
|
|
function continuationDeclarationInside(code) {
|
|
if (code === 62) {
|
|
effects.consume(code);
|
|
return continuationClose;
|
|
}
|
|
return continuation(code);
|
|
}
|
|
function continuationClose(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("htmlFlowData");
|
|
return done(code);
|
|
}
|
|
effects.consume(code);
|
|
return continuationClose;
|
|
}
|
|
function done(code) {
|
|
effects.exit("htmlFlow");
|
|
return ok(code);
|
|
}
|
|
}
|
|
function tokenizeNextBlank(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
effects.exit("htmlFlowData");
|
|
effects.enter("lineEndingBlank");
|
|
effects.consume(code);
|
|
effects.exit("lineEndingBlank");
|
|
return effects.attempt(partialBlankLine, ok, nok);
|
|
}
|
|
}
|
|
module2.exports = htmlFlow;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/html-text.js
|
|
var require_html_text = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/html-text.js"(exports, module2) {
|
|
"use strict";
|
|
var asciiAlpha = require_ascii_alpha();
|
|
var asciiAlphanumeric = require_ascii_alphanumeric();
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var markdownSpace = require_markdown_space();
|
|
var factorySpace = require_factory_space();
|
|
var htmlText = {
|
|
name: "htmlText",
|
|
tokenize: tokenizeHtmlText
|
|
};
|
|
function tokenizeHtmlText(effects, ok, nok) {
|
|
var self = this;
|
|
var marker;
|
|
var buffer;
|
|
var index;
|
|
var returnState;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("htmlText");
|
|
effects.enter("htmlTextData");
|
|
effects.consume(code);
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (code === 33) {
|
|
effects.consume(code);
|
|
return declarationOpen;
|
|
}
|
|
if (code === 47) {
|
|
effects.consume(code);
|
|
return tagCloseStart;
|
|
}
|
|
if (code === 63) {
|
|
effects.consume(code);
|
|
return instruction;
|
|
}
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
return tagOpen;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function declarationOpen(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return commentOpen;
|
|
}
|
|
if (code === 91) {
|
|
effects.consume(code);
|
|
buffer = "CDATA[";
|
|
index = 0;
|
|
return cdataOpen;
|
|
}
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
return declaration;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function commentOpen(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return commentStart;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function commentStart(code) {
|
|
if (code === null || code === 62) {
|
|
return nok(code);
|
|
}
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return commentStartDash;
|
|
}
|
|
return comment(code);
|
|
}
|
|
function commentStartDash(code) {
|
|
if (code === null || code === 62) {
|
|
return nok(code);
|
|
}
|
|
return comment(code);
|
|
}
|
|
function comment(code) {
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return commentClose;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = comment;
|
|
return atLineEnding(code);
|
|
}
|
|
effects.consume(code);
|
|
return comment;
|
|
}
|
|
function commentClose(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return end;
|
|
}
|
|
return comment(code);
|
|
}
|
|
function cdataOpen(code) {
|
|
if (code === buffer.charCodeAt(index++)) {
|
|
effects.consume(code);
|
|
return index === buffer.length ? cdata : cdataOpen;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function cdata(code) {
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (code === 93) {
|
|
effects.consume(code);
|
|
return cdataClose;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = cdata;
|
|
return atLineEnding(code);
|
|
}
|
|
effects.consume(code);
|
|
return cdata;
|
|
}
|
|
function cdataClose(code) {
|
|
if (code === 93) {
|
|
effects.consume(code);
|
|
return cdataEnd;
|
|
}
|
|
return cdata(code);
|
|
}
|
|
function cdataEnd(code) {
|
|
if (code === 62) {
|
|
return end(code);
|
|
}
|
|
if (code === 93) {
|
|
effects.consume(code);
|
|
return cdataEnd;
|
|
}
|
|
return cdata(code);
|
|
}
|
|
function declaration(code) {
|
|
if (code === null || code === 62) {
|
|
return end(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = declaration;
|
|
return atLineEnding(code);
|
|
}
|
|
effects.consume(code);
|
|
return declaration;
|
|
}
|
|
function instruction(code) {
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (code === 63) {
|
|
effects.consume(code);
|
|
return instructionClose;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = instruction;
|
|
return atLineEnding(code);
|
|
}
|
|
effects.consume(code);
|
|
return instruction;
|
|
}
|
|
function instructionClose(code) {
|
|
return code === 62 ? end(code) : instruction(code);
|
|
}
|
|
function tagCloseStart(code) {
|
|
if (asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
return tagClose;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function tagClose(code) {
|
|
if (code === 45 || asciiAlphanumeric(code)) {
|
|
effects.consume(code);
|
|
return tagClose;
|
|
}
|
|
return tagCloseBetween(code);
|
|
}
|
|
function tagCloseBetween(code) {
|
|
if (markdownLineEnding(code)) {
|
|
returnState = tagCloseBetween;
|
|
return atLineEnding(code);
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return tagCloseBetween;
|
|
}
|
|
return end(code);
|
|
}
|
|
function tagOpen(code) {
|
|
if (code === 45 || asciiAlphanumeric(code)) {
|
|
effects.consume(code);
|
|
return tagOpen;
|
|
}
|
|
if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {
|
|
return tagOpenBetween(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function tagOpenBetween(code) {
|
|
if (code === 47) {
|
|
effects.consume(code);
|
|
return end;
|
|
}
|
|
if (code === 58 || code === 95 || asciiAlpha(code)) {
|
|
effects.consume(code);
|
|
return tagOpenAttributeName;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = tagOpenBetween;
|
|
return atLineEnding(code);
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return tagOpenBetween;
|
|
}
|
|
return end(code);
|
|
}
|
|
function tagOpenAttributeName(code) {
|
|
if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {
|
|
effects.consume(code);
|
|
return tagOpenAttributeName;
|
|
}
|
|
return tagOpenAttributeNameAfter(code);
|
|
}
|
|
function tagOpenAttributeNameAfter(code) {
|
|
if (code === 61) {
|
|
effects.consume(code);
|
|
return tagOpenAttributeValueBefore;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = tagOpenAttributeNameAfter;
|
|
return atLineEnding(code);
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return tagOpenAttributeNameAfter;
|
|
}
|
|
return tagOpenBetween(code);
|
|
}
|
|
function tagOpenAttributeValueBefore(code) {
|
|
if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {
|
|
return nok(code);
|
|
}
|
|
if (code === 34 || code === 39) {
|
|
effects.consume(code);
|
|
marker = code;
|
|
return tagOpenAttributeValueQuoted;
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = tagOpenAttributeValueBefore;
|
|
return atLineEnding(code);
|
|
}
|
|
if (markdownSpace(code)) {
|
|
effects.consume(code);
|
|
return tagOpenAttributeValueBefore;
|
|
}
|
|
effects.consume(code);
|
|
marker = void 0;
|
|
return tagOpenAttributeValueUnquoted;
|
|
}
|
|
function tagOpenAttributeValueQuoted(code) {
|
|
if (code === marker) {
|
|
effects.consume(code);
|
|
return tagOpenAttributeValueQuotedAfter;
|
|
}
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (markdownLineEnding(code)) {
|
|
returnState = tagOpenAttributeValueQuoted;
|
|
return atLineEnding(code);
|
|
}
|
|
effects.consume(code);
|
|
return tagOpenAttributeValueQuoted;
|
|
}
|
|
function tagOpenAttributeValueQuotedAfter(code) {
|
|
if (code === 62 || code === 47 || markdownLineEndingOrSpace(code)) {
|
|
return tagOpenBetween(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function tagOpenAttributeValueUnquoted(code) {
|
|
if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {
|
|
return nok(code);
|
|
}
|
|
if (code === 62 || markdownLineEndingOrSpace(code)) {
|
|
return tagOpenBetween(code);
|
|
}
|
|
effects.consume(code);
|
|
return tagOpenAttributeValueUnquoted;
|
|
}
|
|
function atLineEnding(code) {
|
|
effects.exit("htmlTextData");
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return factorySpace(effects, afterPrefix, "linePrefix", self.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4);
|
|
}
|
|
function afterPrefix(code) {
|
|
effects.enter("htmlTextData");
|
|
return returnState(code);
|
|
}
|
|
function end(code) {
|
|
if (code === 62) {
|
|
effects.consume(code);
|
|
effects.exit("htmlTextData");
|
|
effects.exit("htmlText");
|
|
return ok;
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
module2.exports = htmlText;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/label-end.js
|
|
var require_label_end = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/label-end.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var chunkedPush = require_chunked_push();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var normalizeIdentifier = require_normalize_identifier();
|
|
var resolveAll = require_resolve_all();
|
|
var shallow = require_shallow();
|
|
var factoryDestination = require_factory_destination();
|
|
var factoryLabel = require_factory_label();
|
|
var factoryTitle = require_factory_title();
|
|
var factoryWhitespace = require_factory_whitespace();
|
|
var labelEnd = {
|
|
name: "labelEnd",
|
|
tokenize: tokenizeLabelEnd,
|
|
resolveTo: resolveToLabelEnd,
|
|
resolveAll: resolveAllLabelEnd
|
|
};
|
|
var resourceConstruct = {
|
|
tokenize: tokenizeResource
|
|
};
|
|
var fullReferenceConstruct = {
|
|
tokenize: tokenizeFullReference
|
|
};
|
|
var collapsedReferenceConstruct = {
|
|
tokenize: tokenizeCollapsedReference
|
|
};
|
|
function resolveAllLabelEnd(events) {
|
|
var index = -1;
|
|
var token;
|
|
while (++index < events.length) {
|
|
token = events[index][1];
|
|
if (!token._used && (token.type === "labelImage" || token.type === "labelLink" || token.type === "labelEnd")) {
|
|
events.splice(index + 1, token.type === "labelImage" ? 4 : 2);
|
|
token.type = "data";
|
|
index++;
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
function resolveToLabelEnd(events, context) {
|
|
var index = events.length;
|
|
var offset = 0;
|
|
var group;
|
|
var label;
|
|
var text;
|
|
var token;
|
|
var open;
|
|
var close;
|
|
var media;
|
|
while (index--) {
|
|
token = events[index][1];
|
|
if (open) {
|
|
if (token.type === "link" || token.type === "labelLink" && token._inactive) {
|
|
break;
|
|
}
|
|
if (events[index][0] === "enter" && token.type === "labelLink") {
|
|
token._inactive = true;
|
|
}
|
|
} else if (close) {
|
|
if (events[index][0] === "enter" && (token.type === "labelImage" || token.type === "labelLink") && !token._balanced) {
|
|
open = index;
|
|
if (token.type !== "labelLink") {
|
|
offset = 2;
|
|
break;
|
|
}
|
|
}
|
|
} else if (token.type === "labelEnd") {
|
|
close = index;
|
|
}
|
|
}
|
|
group = {
|
|
type: events[open][1].type === "labelLink" ? "link" : "image",
|
|
start: shallow(events[open][1].start),
|
|
end: shallow(events[events.length - 1][1].end)
|
|
};
|
|
label = {
|
|
type: "label",
|
|
start: shallow(events[open][1].start),
|
|
end: shallow(events[close][1].end)
|
|
};
|
|
text = {
|
|
type: "labelText",
|
|
start: shallow(events[open + offset + 2][1].end),
|
|
end: shallow(events[close - 2][1].start)
|
|
};
|
|
media = [
|
|
["enter", group, context],
|
|
["enter", label, context]
|
|
];
|
|
media = chunkedPush(media, events.slice(open + 1, open + offset + 3));
|
|
media = chunkedPush(media, [["enter", text, context]]);
|
|
media = chunkedPush(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));
|
|
media = chunkedPush(media, [
|
|
["exit", text, context],
|
|
events[close - 2],
|
|
events[close - 1],
|
|
["exit", label, context]
|
|
]);
|
|
media = chunkedPush(media, events.slice(close + 1));
|
|
media = chunkedPush(media, [["exit", group, context]]);
|
|
chunkedSplice(events, open, events.length, media);
|
|
return events;
|
|
}
|
|
function tokenizeLabelEnd(effects, ok, nok) {
|
|
var self = this;
|
|
var index = self.events.length;
|
|
var labelStart;
|
|
var defined;
|
|
while (index--) {
|
|
if ((self.events[index][1].type === "labelImage" || self.events[index][1].type === "labelLink") && !self.events[index][1]._balanced) {
|
|
labelStart = self.events[index][1];
|
|
break;
|
|
}
|
|
}
|
|
return start;
|
|
function start(code) {
|
|
if (!labelStart) {
|
|
return nok(code);
|
|
}
|
|
if (labelStart._inactive)
|
|
return balanced(code);
|
|
defined = self.parser.defined.indexOf(normalizeIdentifier(self.sliceSerialize({
|
|
start: labelStart.end,
|
|
end: self.now()
|
|
}))) > -1;
|
|
effects.enter("labelEnd");
|
|
effects.enter("labelMarker");
|
|
effects.consume(code);
|
|
effects.exit("labelMarker");
|
|
effects.exit("labelEnd");
|
|
return afterLabelEnd;
|
|
}
|
|
function afterLabelEnd(code) {
|
|
if (code === 40) {
|
|
return effects.attempt(resourceConstruct, ok, defined ? ok : balanced)(code);
|
|
}
|
|
if (code === 91) {
|
|
return effects.attempt(fullReferenceConstruct, ok, defined ? effects.attempt(collapsedReferenceConstruct, ok, balanced) : balanced)(code);
|
|
}
|
|
return defined ? ok(code) : balanced(code);
|
|
}
|
|
function balanced(code) {
|
|
labelStart._balanced = true;
|
|
return nok(code);
|
|
}
|
|
}
|
|
function tokenizeResource(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("resource");
|
|
effects.enter("resourceMarker");
|
|
effects.consume(code);
|
|
effects.exit("resourceMarker");
|
|
return factoryWhitespace(effects, open);
|
|
}
|
|
function open(code) {
|
|
if (code === 41) {
|
|
return end(code);
|
|
}
|
|
return factoryDestination(effects, destinationAfter, nok, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 3)(code);
|
|
}
|
|
function destinationAfter(code) {
|
|
return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, between)(code) : end(code);
|
|
}
|
|
function between(code) {
|
|
if (code === 34 || code === 39 || code === 40) {
|
|
return factoryTitle(effects, factoryWhitespace(effects, end), nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code);
|
|
}
|
|
return end(code);
|
|
}
|
|
function end(code) {
|
|
if (code === 41) {
|
|
effects.enter("resourceMarker");
|
|
effects.consume(code);
|
|
effects.exit("resourceMarker");
|
|
effects.exit("resource");
|
|
return ok;
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
function tokenizeFullReference(effects, ok, nok) {
|
|
var self = this;
|
|
return start;
|
|
function start(code) {
|
|
return factoryLabel.call(self, effects, afterLabel, nok, "reference", "referenceMarker", "referenceString")(code);
|
|
}
|
|
function afterLabel(code) {
|
|
return self.parser.defined.indexOf(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) < 0 ? nok(code) : ok(code);
|
|
}
|
|
}
|
|
function tokenizeCollapsedReference(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("reference");
|
|
effects.enter("referenceMarker");
|
|
effects.consume(code);
|
|
effects.exit("referenceMarker");
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (code === 93) {
|
|
effects.enter("referenceMarker");
|
|
effects.consume(code);
|
|
effects.exit("referenceMarker");
|
|
effects.exit("reference");
|
|
return ok;
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
module2.exports = labelEnd;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/label-start-image.js
|
|
var require_label_start_image = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/label-start-image.js"(exports, module2) {
|
|
"use strict";
|
|
var labelEnd = require_label_end();
|
|
var labelStartImage = {
|
|
name: "labelStartImage",
|
|
tokenize: tokenizeLabelStartImage,
|
|
resolveAll: labelEnd.resolveAll
|
|
};
|
|
function tokenizeLabelStartImage(effects, ok, nok) {
|
|
var self = this;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("labelImage");
|
|
effects.enter("labelImageMarker");
|
|
effects.consume(code);
|
|
effects.exit("labelImageMarker");
|
|
return open;
|
|
}
|
|
function open(code) {
|
|
if (code === 91) {
|
|
effects.enter("labelMarker");
|
|
effects.consume(code);
|
|
effects.exit("labelMarker");
|
|
effects.exit("labelImage");
|
|
return after;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function after(code) {
|
|
return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
|
|
}
|
|
}
|
|
module2.exports = labelStartImage;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/label-start-link.js
|
|
var require_label_start_link = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/label-start-link.js"(exports, module2) {
|
|
"use strict";
|
|
var labelEnd = require_label_end();
|
|
var labelStartLink = {
|
|
name: "labelStartLink",
|
|
tokenize: tokenizeLabelStartLink,
|
|
resolveAll: labelEnd.resolveAll
|
|
};
|
|
function tokenizeLabelStartLink(effects, ok, nok) {
|
|
var self = this;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("labelLink");
|
|
effects.enter("labelMarker");
|
|
effects.consume(code);
|
|
effects.exit("labelMarker");
|
|
effects.exit("labelLink");
|
|
return after;
|
|
}
|
|
function after(code) {
|
|
return code === 94 && "_hiddenFootnoteSupport" in self.parser.constructs ? nok(code) : ok(code);
|
|
}
|
|
}
|
|
module2.exports = labelStartLink;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/line-ending.js
|
|
var require_line_ending = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/line-ending.js"(exports, module2) {
|
|
"use strict";
|
|
var factorySpace = require_factory_space();
|
|
var lineEnding = {
|
|
name: "lineEnding",
|
|
tokenize: tokenizeLineEnding
|
|
};
|
|
function tokenizeLineEnding(effects, ok) {
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return factorySpace(effects, ok, "linePrefix");
|
|
}
|
|
}
|
|
module2.exports = lineEnding;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/thematic-break.js
|
|
var require_thematic_break = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/thematic-break.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var markdownSpace = require_markdown_space();
|
|
var factorySpace = require_factory_space();
|
|
var thematicBreak = {
|
|
name: "thematicBreak",
|
|
tokenize: tokenizeThematicBreak
|
|
};
|
|
function tokenizeThematicBreak(effects, ok, nok) {
|
|
var size = 0;
|
|
var marker;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("thematicBreak");
|
|
marker = code;
|
|
return atBreak(code);
|
|
}
|
|
function atBreak(code) {
|
|
if (code === marker) {
|
|
effects.enter("thematicBreakSequence");
|
|
return sequence(code);
|
|
}
|
|
if (markdownSpace(code)) {
|
|
return factorySpace(effects, atBreak, "whitespace")(code);
|
|
}
|
|
if (size < 3 || code !== null && !markdownLineEnding(code)) {
|
|
return nok(code);
|
|
}
|
|
effects.exit("thematicBreak");
|
|
return ok(code);
|
|
}
|
|
function sequence(code) {
|
|
if (code === marker) {
|
|
effects.consume(code);
|
|
size++;
|
|
return sequence;
|
|
}
|
|
effects.exit("thematicBreakSequence");
|
|
return atBreak(code);
|
|
}
|
|
}
|
|
module2.exports = thematicBreak;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/list.js
|
|
var require_list = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/list.js"(exports, module2) {
|
|
"use strict";
|
|
var asciiDigit = require_ascii_digit();
|
|
var markdownSpace = require_markdown_space();
|
|
var prefixSize = require_prefix_size();
|
|
var sizeChunks = require_size_chunks();
|
|
var factorySpace = require_factory_space();
|
|
var partialBlankLine = require_partial_blank_line();
|
|
var thematicBreak = require_thematic_break();
|
|
var list = {
|
|
name: "list",
|
|
tokenize: tokenizeListStart,
|
|
continuation: {
|
|
tokenize: tokenizeListContinuation
|
|
},
|
|
exit: tokenizeListEnd
|
|
};
|
|
var listItemPrefixWhitespaceConstruct = {
|
|
tokenize: tokenizeListItemPrefixWhitespace,
|
|
partial: true
|
|
};
|
|
var indentConstruct = {
|
|
tokenize: tokenizeIndent,
|
|
partial: true
|
|
};
|
|
function tokenizeListStart(effects, ok, nok) {
|
|
var self = this;
|
|
var initialSize = prefixSize(self.events, "linePrefix");
|
|
var size = 0;
|
|
return start;
|
|
function start(code) {
|
|
var kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? "listUnordered" : "listOrdered");
|
|
if (kind === "listUnordered" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {
|
|
if (!self.containerState.type) {
|
|
self.containerState.type = kind;
|
|
effects.enter(kind, {
|
|
_container: true
|
|
});
|
|
}
|
|
if (kind === "listUnordered") {
|
|
effects.enter("listItemPrefix");
|
|
return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);
|
|
}
|
|
if (!self.interrupt || code === 49) {
|
|
effects.enter("listItemPrefix");
|
|
effects.enter("listItemValue");
|
|
return inside(code);
|
|
}
|
|
}
|
|
return nok(code);
|
|
}
|
|
function inside(code) {
|
|
if (asciiDigit(code) && ++size < 10) {
|
|
effects.consume(code);
|
|
return inside;
|
|
}
|
|
if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {
|
|
effects.exit("listItemValue");
|
|
return atMarker(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function atMarker(code) {
|
|
effects.enter("listItemMarker");
|
|
effects.consume(code);
|
|
effects.exit("listItemMarker");
|
|
self.containerState.marker = self.containerState.marker || code;
|
|
return effects.check(partialBlankLine, self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));
|
|
}
|
|
function onBlank(code) {
|
|
self.containerState.initialBlankLine = true;
|
|
initialSize++;
|
|
return endOfPrefix(code);
|
|
}
|
|
function otherPrefix(code) {
|
|
if (markdownSpace(code)) {
|
|
effects.enter("listItemPrefixWhitespace");
|
|
effects.consume(code);
|
|
effects.exit("listItemPrefixWhitespace");
|
|
return endOfPrefix;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function endOfPrefix(code) {
|
|
self.containerState.size = initialSize + sizeChunks(self.sliceStream(effects.exit("listItemPrefix")));
|
|
return ok(code);
|
|
}
|
|
}
|
|
function tokenizeListContinuation(effects, ok, nok) {
|
|
var self = this;
|
|
self.containerState._closeFlow = void 0;
|
|
return effects.check(partialBlankLine, onBlank, notBlank);
|
|
function onBlank(code) {
|
|
self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;
|
|
return factorySpace(effects, ok, "listItemIndent", self.containerState.size + 1)(code);
|
|
}
|
|
function notBlank(code) {
|
|
if (self.containerState.furtherBlankLines || !markdownSpace(code)) {
|
|
self.containerState.furtherBlankLines = self.containerState.initialBlankLine = void 0;
|
|
return notInCurrentItem(code);
|
|
}
|
|
self.containerState.furtherBlankLines = self.containerState.initialBlankLine = void 0;
|
|
return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);
|
|
}
|
|
function notInCurrentItem(code) {
|
|
self.containerState._closeFlow = true;
|
|
self.interrupt = void 0;
|
|
return factorySpace(effects, effects.attempt(list, ok, nok), "linePrefix", self.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4)(code);
|
|
}
|
|
}
|
|
function tokenizeIndent(effects, ok, nok) {
|
|
var self = this;
|
|
return factorySpace(effects, afterPrefix, "listItemIndent", self.containerState.size + 1);
|
|
function afterPrefix(code) {
|
|
return prefixSize(self.events, "listItemIndent") === self.containerState.size ? ok(code) : nok(code);
|
|
}
|
|
}
|
|
function tokenizeListEnd(effects) {
|
|
effects.exit(this.containerState.type);
|
|
}
|
|
function tokenizeListItemPrefixWhitespace(effects, ok, nok) {
|
|
var self = this;
|
|
return factorySpace(effects, afterPrefix, "listItemPrefixWhitespace", self.parser.constructs.disable.null.indexOf("codeIndented") > -1 ? void 0 : 4 + 1);
|
|
function afterPrefix(code) {
|
|
return markdownSpace(code) || !prefixSize(self.events, "listItemPrefixWhitespace") ? nok(code) : ok(code);
|
|
}
|
|
}
|
|
module2.exports = list;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/tokenize/setext-underline.js
|
|
var require_setext_underline = __commonJS({
|
|
"node_modules/micromark/dist/tokenize/setext-underline.js"(exports, module2) {
|
|
"use strict";
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var shallow = require_shallow();
|
|
var factorySpace = require_factory_space();
|
|
var setextUnderline = {
|
|
name: "setextUnderline",
|
|
tokenize: tokenizeSetextUnderline,
|
|
resolveTo: resolveToSetextUnderline
|
|
};
|
|
function resolveToSetextUnderline(events, context) {
|
|
var index = events.length;
|
|
var content;
|
|
var text;
|
|
var definition;
|
|
var heading;
|
|
while (index--) {
|
|
if (events[index][0] === "enter") {
|
|
if (events[index][1].type === "content") {
|
|
content = index;
|
|
break;
|
|
}
|
|
if (events[index][1].type === "paragraph") {
|
|
text = index;
|
|
}
|
|
} else {
|
|
if (events[index][1].type === "content") {
|
|
events.splice(index, 1);
|
|
}
|
|
if (!definition && events[index][1].type === "definition") {
|
|
definition = index;
|
|
}
|
|
}
|
|
}
|
|
heading = {
|
|
type: "setextHeading",
|
|
start: shallow(events[text][1].start),
|
|
end: shallow(events[events.length - 1][1].end)
|
|
};
|
|
events[text][1].type = "setextHeadingText";
|
|
if (definition) {
|
|
events.splice(text, 0, ["enter", heading, context]);
|
|
events.splice(definition + 1, 0, ["exit", events[content][1], context]);
|
|
events[content][1].end = shallow(events[definition][1].end);
|
|
} else {
|
|
events[content][1] = heading;
|
|
}
|
|
events.push(["exit", heading, context]);
|
|
return events;
|
|
}
|
|
function tokenizeSetextUnderline(effects, ok, nok) {
|
|
var self = this;
|
|
var index = self.events.length;
|
|
var marker;
|
|
var paragraph;
|
|
while (index--) {
|
|
if (self.events[index][1].type !== "lineEnding" && self.events[index][1].type !== "linePrefix" && self.events[index][1].type !== "content") {
|
|
paragraph = self.events[index][1].type === "paragraph";
|
|
break;
|
|
}
|
|
}
|
|
return start;
|
|
function start(code) {
|
|
if (!self.lazy && (self.interrupt || paragraph)) {
|
|
effects.enter("setextHeadingLine");
|
|
effects.enter("setextHeadingLineSequence");
|
|
marker = code;
|
|
return closingSequence(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
function closingSequence(code) {
|
|
if (code === marker) {
|
|
effects.consume(code);
|
|
return closingSequence;
|
|
}
|
|
effects.exit("setextHeadingLineSequence");
|
|
return factorySpace(effects, closingSequenceEnd, "lineSuffix")(code);
|
|
}
|
|
function closingSequenceEnd(code) {
|
|
if (code === null || markdownLineEnding(code)) {
|
|
effects.exit("setextHeadingLine");
|
|
return ok(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
module2.exports = setextUnderline;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/constructs.js
|
|
var require_constructs = __commonJS({
|
|
"node_modules/micromark/dist/constructs.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var text$1 = require_text();
|
|
var attention = require_attention();
|
|
var autolink = require_autolink();
|
|
var blockQuote = require_block_quote();
|
|
var characterEscape = require_character_escape();
|
|
var characterReference = require_character_reference();
|
|
var codeFenced = require_code_fenced();
|
|
var codeIndented = require_code_indented();
|
|
var codeText = require_code_text();
|
|
var definition = require_definition();
|
|
var hardBreakEscape = require_hard_break_escape();
|
|
var headingAtx = require_heading_atx();
|
|
var htmlFlow = require_html_flow();
|
|
var htmlText = require_html_text();
|
|
var labelEnd = require_label_end();
|
|
var labelStartImage = require_label_start_image();
|
|
var labelStartLink = require_label_start_link();
|
|
var lineEnding = require_line_ending();
|
|
var list = require_list();
|
|
var setextUnderline = require_setext_underline();
|
|
var thematicBreak = require_thematic_break();
|
|
var document2 = {
|
|
42: list,
|
|
43: list,
|
|
45: list,
|
|
48: list,
|
|
49: list,
|
|
50: list,
|
|
51: list,
|
|
52: list,
|
|
53: list,
|
|
54: list,
|
|
55: list,
|
|
56: list,
|
|
57: list,
|
|
62: blockQuote
|
|
};
|
|
var contentInitial = {
|
|
91: definition
|
|
};
|
|
var flowInitial = {
|
|
"-2": codeIndented,
|
|
"-1": codeIndented,
|
|
32: codeIndented
|
|
};
|
|
var flow = {
|
|
35: headingAtx,
|
|
42: thematicBreak,
|
|
45: [setextUnderline, thematicBreak],
|
|
60: htmlFlow,
|
|
61: setextUnderline,
|
|
95: thematicBreak,
|
|
96: codeFenced,
|
|
126: codeFenced
|
|
};
|
|
var string2 = {
|
|
38: characterReference,
|
|
92: characterEscape
|
|
};
|
|
var text = {
|
|
"-5": lineEnding,
|
|
"-4": lineEnding,
|
|
"-3": lineEnding,
|
|
33: labelStartImage,
|
|
38: characterReference,
|
|
42: attention,
|
|
60: [autolink, htmlText],
|
|
91: labelStartLink,
|
|
92: [hardBreakEscape, characterEscape],
|
|
93: labelEnd,
|
|
95: attention,
|
|
96: codeText
|
|
};
|
|
var insideSpan = {
|
|
null: [attention, text$1.resolver]
|
|
};
|
|
var disable = {
|
|
null: []
|
|
};
|
|
exports.contentInitial = contentInitial;
|
|
exports.disable = disable;
|
|
exports.document = document2;
|
|
exports.flow = flow;
|
|
exports.flowInitial = flowInitial;
|
|
exports.insideSpan = insideSpan;
|
|
exports.string = string2;
|
|
exports.text = text;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/parse.js
|
|
var require_parse = __commonJS({
|
|
"node_modules/micromark/dist/parse.js"(exports, module2) {
|
|
"use strict";
|
|
var content = require_content();
|
|
var document2 = require_document();
|
|
var flow = require_flow();
|
|
var text = require_text();
|
|
var combineExtensions = require_combine_extensions();
|
|
var createTokenizer = require_create_tokenizer();
|
|
var miniflat = require_miniflat();
|
|
var constructs = require_constructs();
|
|
function parse3(options) {
|
|
var settings = options || {};
|
|
var parser = {
|
|
defined: [],
|
|
constructs: combineExtensions([constructs].concat(miniflat(settings.extensions))),
|
|
content: create(content),
|
|
document: create(document2),
|
|
flow: create(flow),
|
|
string: create(text.string),
|
|
text: create(text.text)
|
|
};
|
|
return parser;
|
|
function create(initializer) {
|
|
return creator;
|
|
function creator(from) {
|
|
return createTokenizer(parser, initializer, from);
|
|
}
|
|
}
|
|
}
|
|
module2.exports = parse3;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/preprocess.js
|
|
var require_preprocess = __commonJS({
|
|
"node_modules/micromark/dist/preprocess.js"(exports, module2) {
|
|
"use strict";
|
|
var search = /[\0\t\n\r]/g;
|
|
function preprocess() {
|
|
var start = true;
|
|
var column = 1;
|
|
var buffer = "";
|
|
var atCarriageReturn;
|
|
return preprocessor;
|
|
function preprocessor(value, encoding, end) {
|
|
var chunks = [];
|
|
var match;
|
|
var next;
|
|
var startPosition;
|
|
var endPosition;
|
|
var code;
|
|
value = buffer + value.toString(encoding);
|
|
startPosition = 0;
|
|
buffer = "";
|
|
if (start) {
|
|
if (value.charCodeAt(0) === 65279) {
|
|
startPosition++;
|
|
}
|
|
start = void 0;
|
|
}
|
|
while (startPosition < value.length) {
|
|
search.lastIndex = startPosition;
|
|
match = search.exec(value);
|
|
endPosition = match ? match.index : value.length;
|
|
code = value.charCodeAt(endPosition);
|
|
if (!match) {
|
|
buffer = value.slice(startPosition);
|
|
break;
|
|
}
|
|
if (code === 10 && startPosition === endPosition && atCarriageReturn) {
|
|
chunks.push(-3);
|
|
atCarriageReturn = void 0;
|
|
} else {
|
|
if (atCarriageReturn) {
|
|
chunks.push(-5);
|
|
atCarriageReturn = void 0;
|
|
}
|
|
if (startPosition < endPosition) {
|
|
chunks.push(value.slice(startPosition, endPosition));
|
|
column += endPosition - startPosition;
|
|
}
|
|
if (code === 0) {
|
|
chunks.push(65533);
|
|
column++;
|
|
} else if (code === 9) {
|
|
next = Math.ceil(column / 4) * 4;
|
|
chunks.push(-2);
|
|
while (column++ < next)
|
|
chunks.push(-1);
|
|
} else if (code === 10) {
|
|
chunks.push(-4);
|
|
column = 1;
|
|
} else {
|
|
atCarriageReturn = true;
|
|
column = 1;
|
|
}
|
|
}
|
|
startPosition = endPosition + 1;
|
|
}
|
|
if (end) {
|
|
if (atCarriageReturn)
|
|
chunks.push(-5);
|
|
if (buffer)
|
|
chunks.push(buffer);
|
|
chunks.push(null);
|
|
}
|
|
return chunks;
|
|
}
|
|
}
|
|
module2.exports = preprocess;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark/dist/postprocess.js
|
|
var require_postprocess = __commonJS({
|
|
"node_modules/micromark/dist/postprocess.js"(exports, module2) {
|
|
"use strict";
|
|
var subtokenize = require_subtokenize();
|
|
function postprocess(events) {
|
|
while (!subtokenize(events)) {
|
|
}
|
|
return events;
|
|
}
|
|
module2.exports = postprocess;
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-from-markdown/dist/index.js
|
|
var require_dist = __commonJS({
|
|
"node_modules/mdast-util-from-markdown/dist/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = fromMarkdown;
|
|
var toString = require_mdast_util_to_string();
|
|
var assign = require_assign();
|
|
var own = require_has_own_property();
|
|
var normalizeIdentifier = require_normalize_identifier();
|
|
var safeFromInt = require_safe_from_int();
|
|
var parser = require_parse();
|
|
var preprocessor = require_preprocess();
|
|
var postprocess = require_postprocess();
|
|
var decode = require_decode_entity_browser();
|
|
var stringifyPosition = require_unist_util_stringify_position();
|
|
function fromMarkdown(value, encoding, options) {
|
|
if (typeof encoding !== "string") {
|
|
options = encoding;
|
|
encoding = void 0;
|
|
}
|
|
return compiler(options)(postprocess(parser(options).document().write(preprocessor()(value, encoding, true))));
|
|
}
|
|
function compiler(options) {
|
|
var settings = options || {};
|
|
var config = configure({
|
|
transforms: [],
|
|
canContainEols: [
|
|
"emphasis",
|
|
"fragment",
|
|
"heading",
|
|
"paragraph",
|
|
"strong"
|
|
],
|
|
enter: {
|
|
autolink: opener(link),
|
|
autolinkProtocol: onenterdata,
|
|
autolinkEmail: onenterdata,
|
|
atxHeading: opener(heading),
|
|
blockQuote: opener(blockQuote),
|
|
characterEscape: onenterdata,
|
|
characterReference: onenterdata,
|
|
codeFenced: opener(codeFlow),
|
|
codeFencedFenceInfo: buffer,
|
|
codeFencedFenceMeta: buffer,
|
|
codeIndented: opener(codeFlow, buffer),
|
|
codeText: opener(codeText, buffer),
|
|
codeTextData: onenterdata,
|
|
data: onenterdata,
|
|
codeFlowValue: onenterdata,
|
|
definition: opener(definition),
|
|
definitionDestinationString: buffer,
|
|
definitionLabelString: buffer,
|
|
definitionTitleString: buffer,
|
|
emphasis: opener(emphasis),
|
|
hardBreakEscape: opener(hardBreak),
|
|
hardBreakTrailing: opener(hardBreak),
|
|
htmlFlow: opener(html, buffer),
|
|
htmlFlowData: onenterdata,
|
|
htmlText: opener(html, buffer),
|
|
htmlTextData: onenterdata,
|
|
image: opener(image),
|
|
label: buffer,
|
|
link: opener(link),
|
|
listItem: opener(listItem),
|
|
listItemValue: onenterlistitemvalue,
|
|
listOrdered: opener(list, onenterlistordered),
|
|
listUnordered: opener(list),
|
|
paragraph: opener(paragraph),
|
|
reference: onenterreference,
|
|
referenceString: buffer,
|
|
resourceDestinationString: buffer,
|
|
resourceTitleString: buffer,
|
|
setextHeading: opener(heading),
|
|
strong: opener(strong),
|
|
thematicBreak: opener(thematicBreak)
|
|
},
|
|
exit: {
|
|
atxHeading: closer(),
|
|
atxHeadingSequence: onexitatxheadingsequence,
|
|
autolink: closer(),
|
|
autolinkEmail: onexitautolinkemail,
|
|
autolinkProtocol: onexitautolinkprotocol,
|
|
blockQuote: closer(),
|
|
characterEscapeValue: onexitdata,
|
|
characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
|
|
characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
|
|
characterReferenceValue: onexitcharacterreferencevalue,
|
|
codeFenced: closer(onexitcodefenced),
|
|
codeFencedFence: onexitcodefencedfence,
|
|
codeFencedFenceInfo: onexitcodefencedfenceinfo,
|
|
codeFencedFenceMeta: onexitcodefencedfencemeta,
|
|
codeFlowValue: onexitdata,
|
|
codeIndented: closer(onexitcodeindented),
|
|
codeText: closer(onexitcodetext),
|
|
codeTextData: onexitdata,
|
|
data: onexitdata,
|
|
definition: closer(),
|
|
definitionDestinationString: onexitdefinitiondestinationstring,
|
|
definitionLabelString: onexitdefinitionlabelstring,
|
|
definitionTitleString: onexitdefinitiontitlestring,
|
|
emphasis: closer(),
|
|
hardBreakEscape: closer(onexithardbreak),
|
|
hardBreakTrailing: closer(onexithardbreak),
|
|
htmlFlow: closer(onexithtmlflow),
|
|
htmlFlowData: onexitdata,
|
|
htmlText: closer(onexithtmltext),
|
|
htmlTextData: onexitdata,
|
|
image: closer(onexitimage),
|
|
label: onexitlabel,
|
|
labelText: onexitlabeltext,
|
|
lineEnding: onexitlineending,
|
|
link: closer(onexitlink),
|
|
listItem: closer(),
|
|
listOrdered: closer(),
|
|
listUnordered: closer(),
|
|
paragraph: closer(),
|
|
referenceString: onexitreferencestring,
|
|
resourceDestinationString: onexitresourcedestinationstring,
|
|
resourceTitleString: onexitresourcetitlestring,
|
|
resource: onexitresource,
|
|
setextHeading: closer(onexitsetextheading),
|
|
setextHeadingLineSequence: onexitsetextheadinglinesequence,
|
|
setextHeadingText: onexitsetextheadingtext,
|
|
strong: closer(),
|
|
thematicBreak: closer()
|
|
}
|
|
}, settings.mdastExtensions || []);
|
|
var data = {};
|
|
return compile;
|
|
function compile(events) {
|
|
var tree = { type: "root", children: [] };
|
|
var stack = [tree];
|
|
var tokenStack = [];
|
|
var listStack = [];
|
|
var index = -1;
|
|
var handler;
|
|
var listStart;
|
|
var context = {
|
|
stack,
|
|
tokenStack,
|
|
config,
|
|
enter,
|
|
exit,
|
|
buffer,
|
|
resume,
|
|
setData,
|
|
getData
|
|
};
|
|
while (++index < events.length) {
|
|
if (events[index][1].type === "listOrdered" || events[index][1].type === "listUnordered") {
|
|
if (events[index][0] === "enter") {
|
|
listStack.push(index);
|
|
} else {
|
|
listStart = listStack.pop(index);
|
|
index = prepareList(events, listStart, index);
|
|
}
|
|
}
|
|
}
|
|
index = -1;
|
|
while (++index < events.length) {
|
|
handler = config[events[index][0]];
|
|
if (own.call(handler, events[index][1].type)) {
|
|
handler[events[index][1].type].call(assign({ sliceSerialize: events[index][2].sliceSerialize }, context), events[index][1]);
|
|
}
|
|
}
|
|
if (tokenStack.length) {
|
|
throw new Error("Cannot close document, a token (`" + tokenStack[tokenStack.length - 1].type + "`, " + stringifyPosition({
|
|
start: tokenStack[tokenStack.length - 1].start,
|
|
end: tokenStack[tokenStack.length - 1].end
|
|
}) + ") is still open");
|
|
}
|
|
tree.position = {
|
|
start: point(events.length ? events[0][1].start : { line: 1, column: 1, offset: 0 }),
|
|
end: point(events.length ? events[events.length - 2][1].end : { line: 1, column: 1, offset: 0 })
|
|
};
|
|
index = -1;
|
|
while (++index < config.transforms.length) {
|
|
tree = config.transforms[index](tree) || tree;
|
|
}
|
|
return tree;
|
|
}
|
|
function prepareList(events, start, length) {
|
|
var index = start - 1;
|
|
var containerBalance = -1;
|
|
var listSpread = false;
|
|
var listItem2;
|
|
var tailIndex;
|
|
var lineIndex;
|
|
var tailEvent;
|
|
var event;
|
|
var firstBlankLineIndex;
|
|
var atMarker;
|
|
while (++index <= length) {
|
|
event = events[index];
|
|
if (event[1].type === "listUnordered" || event[1].type === "listOrdered" || event[1].type === "blockQuote") {
|
|
if (event[0] === "enter") {
|
|
containerBalance++;
|
|
} else {
|
|
containerBalance--;
|
|
}
|
|
atMarker = void 0;
|
|
} else if (event[1].type === "lineEndingBlank") {
|
|
if (event[0] === "enter") {
|
|
if (listItem2 && !atMarker && !containerBalance && !firstBlankLineIndex) {
|
|
firstBlankLineIndex = index;
|
|
}
|
|
atMarker = void 0;
|
|
}
|
|
} else if (event[1].type === "linePrefix" || event[1].type === "listItemValue" || event[1].type === "listItemMarker" || event[1].type === "listItemPrefix" || event[1].type === "listItemPrefixWhitespace") {
|
|
} else {
|
|
atMarker = void 0;
|
|
}
|
|
if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
|
|
if (listItem2) {
|
|
tailIndex = index;
|
|
lineIndex = void 0;
|
|
while (tailIndex--) {
|
|
tailEvent = events[tailIndex];
|
|
if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
|
|
if (tailEvent[0] === "exit")
|
|
continue;
|
|
if (lineIndex) {
|
|
events[lineIndex][1].type = "lineEndingBlank";
|
|
listSpread = true;
|
|
}
|
|
tailEvent[1].type = "lineEnding";
|
|
lineIndex = tailIndex;
|
|
} else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent") {
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
|
|
listItem2._spread = true;
|
|
}
|
|
listItem2.end = point(lineIndex ? events[lineIndex][1].start : event[1].end);
|
|
events.splice(lineIndex || index, 0, ["exit", listItem2, event[2]]);
|
|
index++;
|
|
length++;
|
|
}
|
|
if (event[1].type === "listItemPrefix") {
|
|
listItem2 = {
|
|
type: "listItem",
|
|
_spread: false,
|
|
start: point(event[1].start)
|
|
};
|
|
events.splice(index, 0, ["enter", listItem2, event[2]]);
|
|
index++;
|
|
length++;
|
|
firstBlankLineIndex = void 0;
|
|
atMarker = true;
|
|
}
|
|
}
|
|
}
|
|
events[start][1]._spread = listSpread;
|
|
return length;
|
|
}
|
|
function setData(key, value) {
|
|
data[key] = value;
|
|
}
|
|
function getData(key) {
|
|
return data[key];
|
|
}
|
|
function point(d) {
|
|
return { line: d.line, column: d.column, offset: d.offset };
|
|
}
|
|
function opener(create, and) {
|
|
return open;
|
|
function open(token) {
|
|
enter.call(this, create(token), token);
|
|
if (and)
|
|
and.call(this, token);
|
|
}
|
|
}
|
|
function buffer() {
|
|
this.stack.push({ type: "fragment", children: [] });
|
|
}
|
|
function enter(node, token) {
|
|
this.stack[this.stack.length - 1].children.push(node);
|
|
this.stack.push(node);
|
|
this.tokenStack.push(token);
|
|
node.position = { start: point(token.start) };
|
|
return node;
|
|
}
|
|
function closer(and) {
|
|
return close;
|
|
function close(token) {
|
|
if (and)
|
|
and.call(this, token);
|
|
exit.call(this, token);
|
|
}
|
|
}
|
|
function exit(token) {
|
|
var node = this.stack.pop();
|
|
var open = this.tokenStack.pop();
|
|
if (!open) {
|
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): it\u2019s not open");
|
|
} else if (open.type !== token.type) {
|
|
throw new Error("Cannot close `" + token.type + "` (" + stringifyPosition({ start: token.start, end: token.end }) + "): a different token (`" + open.type + "`, " + stringifyPosition({ start: open.start, end: open.end }) + ") is open");
|
|
}
|
|
node.position.end = point(token.end);
|
|
return node;
|
|
}
|
|
function resume() {
|
|
return toString(this.stack.pop());
|
|
}
|
|
function onenterlistordered() {
|
|
setData("expectingFirstListItemValue", true);
|
|
}
|
|
function onenterlistitemvalue(token) {
|
|
if (getData("expectingFirstListItemValue")) {
|
|
this.stack[this.stack.length - 2].start = parseInt(this.sliceSerialize(token), 10);
|
|
setData("expectingFirstListItemValue");
|
|
}
|
|
}
|
|
function onexitcodefencedfenceinfo() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].lang = data2;
|
|
}
|
|
function onexitcodefencedfencemeta() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].meta = data2;
|
|
}
|
|
function onexitcodefencedfence() {
|
|
if (getData("flowCodeInside"))
|
|
return;
|
|
this.buffer();
|
|
setData("flowCodeInside", true);
|
|
}
|
|
function onexitcodefenced() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
|
|
setData("flowCodeInside");
|
|
}
|
|
function onexitcodeindented() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].value = data2;
|
|
}
|
|
function onexitdefinitionlabelstring(token) {
|
|
var label = this.resume();
|
|
this.stack[this.stack.length - 1].label = label;
|
|
this.stack[this.stack.length - 1].identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
}
|
|
function onexitdefinitiontitlestring() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].title = data2;
|
|
}
|
|
function onexitdefinitiondestinationstring() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].url = data2;
|
|
}
|
|
function onexitatxheadingsequence(token) {
|
|
if (!this.stack[this.stack.length - 1].depth) {
|
|
this.stack[this.stack.length - 1].depth = this.sliceSerialize(token).length;
|
|
}
|
|
}
|
|
function onexitsetextheadingtext() {
|
|
setData("setextHeadingSlurpLineEnding", true);
|
|
}
|
|
function onexitsetextheadinglinesequence(token) {
|
|
this.stack[this.stack.length - 1].depth = this.sliceSerialize(token).charCodeAt(0) === 61 ? 1 : 2;
|
|
}
|
|
function onexitsetextheading() {
|
|
setData("setextHeadingSlurpLineEnding");
|
|
}
|
|
function onenterdata(token) {
|
|
var siblings = this.stack[this.stack.length - 1].children;
|
|
var tail = siblings[siblings.length - 1];
|
|
if (!tail || tail.type !== "text") {
|
|
tail = text();
|
|
tail.position = { start: point(token.start) };
|
|
this.stack[this.stack.length - 1].children.push(tail);
|
|
}
|
|
this.stack.push(tail);
|
|
}
|
|
function onexitdata(token) {
|
|
var tail = this.stack.pop();
|
|
tail.value += this.sliceSerialize(token);
|
|
tail.position.end = point(token.end);
|
|
}
|
|
function onexitlineending(token) {
|
|
var context = this.stack[this.stack.length - 1];
|
|
if (getData("atHardBreak")) {
|
|
context.children[context.children.length - 1].position.end = point(token.end);
|
|
setData("atHardBreak");
|
|
return;
|
|
}
|
|
if (!getData("setextHeadingSlurpLineEnding") && config.canContainEols.indexOf(context.type) > -1) {
|
|
onenterdata.call(this, token);
|
|
onexitdata.call(this, token);
|
|
}
|
|
}
|
|
function onexithardbreak() {
|
|
setData("atHardBreak", true);
|
|
}
|
|
function onexithtmlflow() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].value = data2;
|
|
}
|
|
function onexithtmltext() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].value = data2;
|
|
}
|
|
function onexitcodetext() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].value = data2;
|
|
}
|
|
function onexitlink() {
|
|
var context = this.stack[this.stack.length - 1];
|
|
if (getData("inReference")) {
|
|
context.type += "Reference";
|
|
context.referenceType = getData("referenceType") || "shortcut";
|
|
delete context.url;
|
|
delete context.title;
|
|
} else {
|
|
delete context.identifier;
|
|
delete context.label;
|
|
delete context.referenceType;
|
|
}
|
|
setData("referenceType");
|
|
}
|
|
function onexitimage() {
|
|
var context = this.stack[this.stack.length - 1];
|
|
if (getData("inReference")) {
|
|
context.type += "Reference";
|
|
context.referenceType = getData("referenceType") || "shortcut";
|
|
delete context.url;
|
|
delete context.title;
|
|
} else {
|
|
delete context.identifier;
|
|
delete context.label;
|
|
delete context.referenceType;
|
|
}
|
|
setData("referenceType");
|
|
}
|
|
function onexitlabeltext(token) {
|
|
this.stack[this.stack.length - 2].identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
}
|
|
function onexitlabel() {
|
|
var fragment = this.stack[this.stack.length - 1];
|
|
var value = this.resume();
|
|
this.stack[this.stack.length - 1].label = value;
|
|
setData("inReference", true);
|
|
if (this.stack[this.stack.length - 1].type === "link") {
|
|
this.stack[this.stack.length - 1].children = fragment.children;
|
|
} else {
|
|
this.stack[this.stack.length - 1].alt = value;
|
|
}
|
|
}
|
|
function onexitresourcedestinationstring() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].url = data2;
|
|
}
|
|
function onexitresourcetitlestring() {
|
|
var data2 = this.resume();
|
|
this.stack[this.stack.length - 1].title = data2;
|
|
}
|
|
function onexitresource() {
|
|
setData("inReference");
|
|
}
|
|
function onenterreference() {
|
|
setData("referenceType", "collapsed");
|
|
}
|
|
function onexitreferencestring(token) {
|
|
var label = this.resume();
|
|
this.stack[this.stack.length - 1].label = label;
|
|
this.stack[this.stack.length - 1].identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();
|
|
setData("referenceType", "full");
|
|
}
|
|
function onexitcharacterreferencemarker(token) {
|
|
setData("characterReferenceType", token.type);
|
|
}
|
|
function onexitcharacterreferencevalue(token) {
|
|
var data2 = this.sliceSerialize(token);
|
|
var type = getData("characterReferenceType");
|
|
var value;
|
|
var tail;
|
|
if (type) {
|
|
value = safeFromInt(data2, type === "characterReferenceMarkerNumeric" ? 10 : 16);
|
|
setData("characterReferenceType");
|
|
} else {
|
|
value = decode(data2);
|
|
}
|
|
tail = this.stack.pop();
|
|
tail.value += value;
|
|
tail.position.end = point(token.end);
|
|
}
|
|
function onexitautolinkprotocol(token) {
|
|
onexitdata.call(this, token);
|
|
this.stack[this.stack.length - 1].url = this.sliceSerialize(token);
|
|
}
|
|
function onexitautolinkemail(token) {
|
|
onexitdata.call(this, token);
|
|
this.stack[this.stack.length - 1].url = "mailto:" + this.sliceSerialize(token);
|
|
}
|
|
function blockQuote() {
|
|
return { type: "blockquote", children: [] };
|
|
}
|
|
function codeFlow() {
|
|
return { type: "code", lang: null, meta: null, value: "" };
|
|
}
|
|
function codeText() {
|
|
return { type: "inlineCode", value: "" };
|
|
}
|
|
function definition() {
|
|
return {
|
|
type: "definition",
|
|
identifier: "",
|
|
label: null,
|
|
title: null,
|
|
url: ""
|
|
};
|
|
}
|
|
function emphasis() {
|
|
return { type: "emphasis", children: [] };
|
|
}
|
|
function heading() {
|
|
return { type: "heading", depth: void 0, children: [] };
|
|
}
|
|
function hardBreak() {
|
|
return { type: "break" };
|
|
}
|
|
function html() {
|
|
return { type: "html", value: "" };
|
|
}
|
|
function image() {
|
|
return { type: "image", title: null, url: "", alt: null };
|
|
}
|
|
function link() {
|
|
return { type: "link", title: null, url: "", children: [] };
|
|
}
|
|
function list(token) {
|
|
return {
|
|
type: "list",
|
|
ordered: token.type === "listOrdered",
|
|
start: null,
|
|
spread: token._spread,
|
|
children: []
|
|
};
|
|
}
|
|
function listItem(token) {
|
|
return {
|
|
type: "listItem",
|
|
spread: token._spread,
|
|
checked: null,
|
|
children: []
|
|
};
|
|
}
|
|
function paragraph() {
|
|
return { type: "paragraph", children: [] };
|
|
}
|
|
function strong() {
|
|
return { type: "strong", children: [] };
|
|
}
|
|
function text() {
|
|
return { type: "text", value: "" };
|
|
}
|
|
function thematicBreak() {
|
|
return { type: "thematicBreak" };
|
|
}
|
|
}
|
|
function configure(config, extensions) {
|
|
var index = -1;
|
|
while (++index < extensions.length) {
|
|
extension(config, extensions[index]);
|
|
}
|
|
return config;
|
|
}
|
|
function extension(config, extension2) {
|
|
var key;
|
|
var left;
|
|
for (key in extension2) {
|
|
left = own.call(config, key) ? config[key] : config[key] = {};
|
|
if (key === "canContainEols" || key === "transforms") {
|
|
config[key] = [].concat(left, extension2[key]);
|
|
} else {
|
|
Object.assign(left, extension2[key]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-from-markdown/index.js
|
|
var require_mdast_util_from_markdown = __commonJS({
|
|
"node_modules/mdast-util-from-markdown/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = require_dist();
|
|
}
|
|
});
|
|
|
|
// node_modules/remark-parse/index.js
|
|
var require_remark_parse = __commonJS({
|
|
"node_modules/remark-parse/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = parse3;
|
|
var fromMarkdown = require_mdast_util_from_markdown();
|
|
function parse3(options) {
|
|
var self = this;
|
|
this.Parser = parse4;
|
|
function parse4(doc) {
|
|
return fromMarkdown(doc, Object.assign({}, self.data("settings"), options, {
|
|
extensions: self.data("micromarkExtensions") || [],
|
|
mdastExtensions: self.data("fromMarkdownExtensions") || []
|
|
}));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/@tryfabric/martian/build/src/notion/languageMap.json
|
|
var require_languageMap = __commonJS({
|
|
"node_modules/@tryfabric/martian/build/src/notion/languageMap.json"(exports, module2) {
|
|
module2.exports = {
|
|
abap: "abap",
|
|
sh: "shell",
|
|
"shell-script": "shell",
|
|
bash: "shell",
|
|
zsh: "shell",
|
|
text: "vb.net",
|
|
c_cpp: "c++",
|
|
clojure: "clojure",
|
|
coffee: "coffeescript",
|
|
"coffee-script": "coffeescript",
|
|
cpp: "c++",
|
|
csharp: "c#",
|
|
cake: "c#",
|
|
cakescript: "c#",
|
|
css: "css",
|
|
dart: "dart",
|
|
diff: "diff",
|
|
udiff: "diff",
|
|
dockerfile: "docker",
|
|
elixir: "elixir",
|
|
elm: "elm",
|
|
erlang: "erlang",
|
|
fsharp: "f#",
|
|
cucumber: "gherkin",
|
|
glsl: "glsl",
|
|
golang: "go",
|
|
groovy: "groovy",
|
|
haskell: "haskell",
|
|
html: "html",
|
|
xhtml: "html",
|
|
java: "java/c/c++/c#",
|
|
javascript: "javascript",
|
|
js: "javascript",
|
|
node: "javascript",
|
|
json: "json",
|
|
julia: "julia",
|
|
tex: "latex",
|
|
latex: "latex",
|
|
less: "less",
|
|
lisp: "webassembly",
|
|
livescript: "livescript",
|
|
"live-script": "livescript",
|
|
ls: "livescript",
|
|
lua: "lua",
|
|
makefile: "makefile",
|
|
bsdmake: "makefile",
|
|
make: "makefile",
|
|
mf: "makefile",
|
|
markdown: "markdown",
|
|
pandoc: "markdown",
|
|
matlab: "matlab",
|
|
octave: "matlab",
|
|
nix: "nix",
|
|
nixos: "nix",
|
|
objectivec: "objective-c",
|
|
"obj-c": "objective-c",
|
|
objc: "objective-c",
|
|
ocaml: "ocaml",
|
|
pascal: "pascal",
|
|
delphi: "pascal",
|
|
objectpascal: "pascal",
|
|
perl: "perl",
|
|
cperl: "perl",
|
|
php: "php",
|
|
inc: "php",
|
|
powershell: "powershell",
|
|
posh: "powershell",
|
|
pwsh: "powershell",
|
|
prolog: "prolog",
|
|
protobuf: "protobuf",
|
|
"Protocol Buffers": "protobuf",
|
|
python: "python",
|
|
python3: "python",
|
|
rusthon: "python",
|
|
r: "r",
|
|
R: "r",
|
|
Rscript: "r",
|
|
splus: "r",
|
|
rust: "rust",
|
|
ruby: "ruby",
|
|
jruby: "ruby",
|
|
macruby: "ruby",
|
|
rake: "ruby",
|
|
rb: "ruby",
|
|
rbx: "ruby",
|
|
rs: "rust",
|
|
sass: "sass",
|
|
scala: "scala",
|
|
scheme: "scheme",
|
|
scss: "scss",
|
|
sql: "sql",
|
|
typescript: "typescript",
|
|
ts: "typescript",
|
|
"visual basic": "vb.net",
|
|
vbnet: "vb.net",
|
|
"vb .net": "vb.net",
|
|
"vb.net": "vb.net",
|
|
verilog: "verilog",
|
|
vhdl: "vhdl",
|
|
wast: "webassembly",
|
|
wasm: "webassembly",
|
|
xml: "xml",
|
|
rss: "xml",
|
|
xsd: "xml",
|
|
wsdl: "xml",
|
|
yaml: "yaml",
|
|
yml: "yaml"
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/@tryfabric/martian/build/src/notion/common.js
|
|
var require_common = __commonJS({
|
|
"node_modules/@tryfabric/martian/build/src/notion/common.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.isSupportedCodeLang = exports.SUPPORTED_CODE_BLOCK_LANGUAGES = exports.richText = exports.LIMITS = void 0;
|
|
exports.LIMITS = {
|
|
PAYLOAD_BLOCKS: 1e3,
|
|
RICH_TEXT_ARRAYS: 100,
|
|
RICH_TEXT: {
|
|
TEXT_CONTENT: 2e3,
|
|
LINK_URL: 1e3,
|
|
EQUATION_EXPRESSION: 1e3
|
|
}
|
|
};
|
|
function richText(content, options = {}) {
|
|
const annotations = __spreadValues({
|
|
bold: false,
|
|
strikethrough: false,
|
|
underline: false,
|
|
italic: false,
|
|
code: false,
|
|
color: "default"
|
|
}, options.annotations || {});
|
|
if (options.type === "equation")
|
|
return {
|
|
type: "equation",
|
|
annotations,
|
|
equation: {
|
|
expression: content
|
|
}
|
|
};
|
|
else
|
|
return {
|
|
type: "text",
|
|
annotations,
|
|
text: {
|
|
content,
|
|
link: options.url ? {
|
|
type: "url",
|
|
url: options.url
|
|
} : void 0
|
|
}
|
|
};
|
|
}
|
|
exports.richText = richText;
|
|
exports.SUPPORTED_CODE_BLOCK_LANGUAGES = [
|
|
"abap",
|
|
"arduino",
|
|
"bash",
|
|
"basic",
|
|
"c",
|
|
"clojure",
|
|
"coffeescript",
|
|
"c++",
|
|
"c#",
|
|
"css",
|
|
"dart",
|
|
"diff",
|
|
"docker",
|
|
"elixir",
|
|
"elm",
|
|
"erlang",
|
|
"flow",
|
|
"fortran",
|
|
"f#",
|
|
"gherkin",
|
|
"glsl",
|
|
"go",
|
|
"graphql",
|
|
"groovy",
|
|
"haskell",
|
|
"html",
|
|
"java",
|
|
"javascript",
|
|
"json",
|
|
"julia",
|
|
"kotlin",
|
|
"latex",
|
|
"less",
|
|
"lisp",
|
|
"livescript",
|
|
"lua",
|
|
"makefile",
|
|
"markdown",
|
|
"markup",
|
|
"matlab",
|
|
"mermaid",
|
|
"nix",
|
|
"objective-c",
|
|
"ocaml",
|
|
"pascal",
|
|
"perl",
|
|
"php",
|
|
"plain text",
|
|
"powershell",
|
|
"prolog",
|
|
"protobuf",
|
|
"python",
|
|
"r",
|
|
"reason",
|
|
"ruby",
|
|
"rust",
|
|
"sass",
|
|
"scala",
|
|
"scheme",
|
|
"scss",
|
|
"shell",
|
|
"sql",
|
|
"swift",
|
|
"typescript",
|
|
"vb.net",
|
|
"verilog",
|
|
"vhdl",
|
|
"visual basic",
|
|
"webassembly",
|
|
"xml",
|
|
"yaml",
|
|
"java/c/c++/c#"
|
|
];
|
|
function isSupportedCodeLang(lang) {
|
|
return exports.SUPPORTED_CODE_BLOCK_LANGUAGES.includes(lang);
|
|
}
|
|
exports.isSupportedCodeLang = isSupportedCodeLang;
|
|
}
|
|
});
|
|
|
|
// node_modules/@tryfabric/martian/build/src/notion/blocks.js
|
|
var require_blocks = __commonJS({
|
|
"node_modules/@tryfabric/martian/build/src/notion/blocks.js"(exports) {
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.equation = exports.tableRow = exports.table = exports.toDo = exports.numberedListItem = exports.bulletedListItem = exports.headingThree = exports.headingTwo = exports.headingOne = exports.table_of_contents = exports.image = exports.blockquote = exports.code = exports.paragraph = void 0;
|
|
var common_1 = require_common();
|
|
function paragraph(text) {
|
|
return {
|
|
object: "block",
|
|
type: "paragraph",
|
|
paragraph: {
|
|
rich_text: text
|
|
}
|
|
};
|
|
}
|
|
exports.paragraph = paragraph;
|
|
function code(text, lang = "plain text") {
|
|
return {
|
|
object: "block",
|
|
type: "code",
|
|
code: {
|
|
rich_text: text,
|
|
language: lang
|
|
}
|
|
};
|
|
}
|
|
exports.code = code;
|
|
function blockquote(text = [], children = []) {
|
|
return {
|
|
object: "block",
|
|
type: "quote",
|
|
quote: {
|
|
rich_text: text.length ? text : [(0, common_1.richText)("")],
|
|
children
|
|
}
|
|
};
|
|
}
|
|
exports.blockquote = blockquote;
|
|
function image(url) {
|
|
return {
|
|
object: "block",
|
|
type: "image",
|
|
image: {
|
|
type: "external",
|
|
external: {
|
|
url
|
|
}
|
|
}
|
|
};
|
|
}
|
|
exports.image = image;
|
|
function table_of_contents() {
|
|
return {
|
|
object: "block",
|
|
type: "table_of_contents",
|
|
table_of_contents: {}
|
|
};
|
|
}
|
|
exports.table_of_contents = table_of_contents;
|
|
function headingOne(text) {
|
|
return {
|
|
object: "block",
|
|
type: "heading_1",
|
|
heading_1: {
|
|
rich_text: text
|
|
}
|
|
};
|
|
}
|
|
exports.headingOne = headingOne;
|
|
function headingTwo(text) {
|
|
return {
|
|
object: "block",
|
|
type: "heading_2",
|
|
heading_2: {
|
|
rich_text: text
|
|
}
|
|
};
|
|
}
|
|
exports.headingTwo = headingTwo;
|
|
function headingThree(text) {
|
|
return {
|
|
object: "block",
|
|
type: "heading_3",
|
|
heading_3: {
|
|
rich_text: text
|
|
}
|
|
};
|
|
}
|
|
exports.headingThree = headingThree;
|
|
function bulletedListItem(text, children = []) {
|
|
return {
|
|
object: "block",
|
|
type: "bulleted_list_item",
|
|
bulleted_list_item: {
|
|
rich_text: text,
|
|
children: children.length ? children : void 0
|
|
}
|
|
};
|
|
}
|
|
exports.bulletedListItem = bulletedListItem;
|
|
function numberedListItem(text, children = []) {
|
|
return {
|
|
object: "block",
|
|
type: "numbered_list_item",
|
|
numbered_list_item: {
|
|
rich_text: text,
|
|
children: children.length ? children : void 0
|
|
}
|
|
};
|
|
}
|
|
exports.numberedListItem = numberedListItem;
|
|
function toDo(checked, text, children = []) {
|
|
return {
|
|
object: "block",
|
|
type: "to_do",
|
|
to_do: {
|
|
rich_text: text,
|
|
checked,
|
|
children: children.length ? children : void 0
|
|
}
|
|
};
|
|
}
|
|
exports.toDo = toDo;
|
|
function table(children, tableWidth) {
|
|
return {
|
|
object: "block",
|
|
type: "table",
|
|
table: {
|
|
table_width: tableWidth,
|
|
has_column_header: true,
|
|
children: (children === null || children === void 0 ? void 0 : children.length) ? children : []
|
|
}
|
|
};
|
|
}
|
|
exports.table = table;
|
|
function tableRow(cells = []) {
|
|
return {
|
|
object: "block",
|
|
type: "table_row",
|
|
table_row: {
|
|
cells: cells.length ? cells : []
|
|
}
|
|
};
|
|
}
|
|
exports.tableRow = tableRow;
|
|
function equation(value) {
|
|
return {
|
|
type: "equation",
|
|
equation: {
|
|
expression: value
|
|
}
|
|
};
|
|
}
|
|
exports.equation = equation;
|
|
}
|
|
});
|
|
|
|
// node_modules/@tryfabric/martian/build/src/notion/index.js
|
|
var require_notion = __commonJS({
|
|
"node_modules/@tryfabric/martian/build/src/notion/index.js"(exports) {
|
|
"use strict";
|
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
if (k2 === void 0)
|
|
k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
return m[k];
|
|
} });
|
|
} : function(o, m, k, k2) {
|
|
if (k2 === void 0)
|
|
k2 = k;
|
|
o[k2] = m[k];
|
|
});
|
|
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
for (var p in m)
|
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
__createBinding(exports2, m, p);
|
|
};
|
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.parseCodeLanguage = void 0;
|
|
var languageMap_json_1 = __importDefault(require_languageMap());
|
|
__exportStar(require_blocks(), exports);
|
|
__exportStar(require_common(), exports);
|
|
function parseCodeLanguage(lang) {
|
|
return lang ? languageMap_json_1.default[lang.toLowerCase()] : void 0;
|
|
}
|
|
exports.parseCodeLanguage = parseCodeLanguage;
|
|
}
|
|
});
|
|
|
|
// node_modules/@tryfabric/martian/build/src/parser/internal.js
|
|
var require_internal = __commonJS({
|
|
"node_modules/@tryfabric/martian/build/src/parser/internal.js"(exports) {
|
|
"use strict";
|
|
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
if (k2 === void 0)
|
|
k2 = k;
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() {
|
|
return m[k];
|
|
} });
|
|
} : function(o, m, k, k2) {
|
|
if (k2 === void 0)
|
|
k2 = k;
|
|
o[k2] = m[k];
|
|
});
|
|
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
} : function(o, v) {
|
|
o["default"] = v;
|
|
});
|
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
if (mod && mod.__esModule)
|
|
return mod;
|
|
var result = {};
|
|
if (mod != null) {
|
|
for (var k in mod)
|
|
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
__createBinding(result, mod, k);
|
|
}
|
|
__setModuleDefault(result, mod);
|
|
return result;
|
|
};
|
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.parseRichText = exports.parseBlocks = void 0;
|
|
var notion = __importStar(require_notion());
|
|
var path_1 = __importDefault(require("path"));
|
|
var url_1 = require("url");
|
|
var notion_1 = require_notion();
|
|
function ensureLength(text, copy) {
|
|
const chunks = text.match(/[^]{1,2000}/g) || [];
|
|
return chunks.flatMap((item) => notion.richText(item, copy));
|
|
}
|
|
function ensureCodeBlockLanguage(lang) {
|
|
if (lang) {
|
|
lang = lang.toLowerCase();
|
|
return (0, notion_1.isSupportedCodeLang)(lang) ? lang : notion.parseCodeLanguage(lang);
|
|
}
|
|
return void 0;
|
|
}
|
|
function parseInline(element, options) {
|
|
var _a;
|
|
const copy = {
|
|
annotations: __spreadValues({}, (_a = options === null || options === void 0 ? void 0 : options.annotations) !== null && _a !== void 0 ? _a : {}),
|
|
url: options === null || options === void 0 ? void 0 : options.url
|
|
};
|
|
switch (element.type) {
|
|
case "text":
|
|
return ensureLength(element.value, copy);
|
|
case "delete":
|
|
copy.annotations.strikethrough = true;
|
|
return element.children.flatMap((child) => parseInline(child, copy));
|
|
case "emphasis":
|
|
copy.annotations.italic = true;
|
|
return element.children.flatMap((child) => parseInline(child, copy));
|
|
case "strong":
|
|
copy.annotations.bold = true;
|
|
return element.children.flatMap((child) => parseInline(child, copy));
|
|
case "link":
|
|
copy.url = element.url;
|
|
return element.children.flatMap((child) => parseInline(child, copy));
|
|
case "inlineCode":
|
|
copy.annotations.code = true;
|
|
return [notion.richText(element.value, copy)];
|
|
case "inlineMath":
|
|
return [notion.richText(element.value, __spreadProps(__spreadValues({}, copy), { type: "equation" }))];
|
|
default:
|
|
return [];
|
|
}
|
|
}
|
|
function parseImage(image, options) {
|
|
var _a;
|
|
const allowedTypes = [
|
|
".png",
|
|
".jpg",
|
|
".jpeg",
|
|
".gif",
|
|
".tif",
|
|
".tiff",
|
|
".bmp",
|
|
".svg",
|
|
".heic"
|
|
];
|
|
function dealWithError() {
|
|
return notion.paragraph([notion.richText(image.url)]);
|
|
}
|
|
try {
|
|
if ((_a = options.strictImageUrls) !== null && _a !== void 0 ? _a : true) {
|
|
const parsedUrl = new url_1.URL(image.url);
|
|
const fileType = path_1.default.extname(parsedUrl.pathname);
|
|
if (allowedTypes.includes(fileType)) {
|
|
return notion.image(image.url);
|
|
} else {
|
|
return dealWithError();
|
|
}
|
|
} else {
|
|
return notion.image(image.url);
|
|
}
|
|
} catch (error) {
|
|
return dealWithError();
|
|
}
|
|
}
|
|
function parseParagraph(element, options) {
|
|
const mightBeToc = element.children.length > 2 && element.children[0].type === "text" && element.children[0].value === "[[" && element.children[1].type === "emphasis";
|
|
if (mightBeToc) {
|
|
const emphasisItem = element.children[1];
|
|
const emphasisTextItem = emphasisItem.children[0];
|
|
if (emphasisTextItem.value === "TOC") {
|
|
return [notion.table_of_contents()];
|
|
}
|
|
}
|
|
const images = [];
|
|
const paragraphs = [];
|
|
element.children.forEach((item) => {
|
|
if (item.type === "image") {
|
|
images.push(parseImage(item, options));
|
|
} else {
|
|
const richText = parseInline(item);
|
|
if (richText.length) {
|
|
paragraphs.push(richText);
|
|
}
|
|
}
|
|
});
|
|
if (paragraphs.length) {
|
|
return [notion.paragraph(paragraphs.flat()), ...images];
|
|
} else {
|
|
return images;
|
|
}
|
|
}
|
|
function parseBlockquote(element, options) {
|
|
const children = element.children.flatMap((child) => parseNode(child, options));
|
|
return notion.blockquote([], children);
|
|
}
|
|
function parseHeading(element) {
|
|
const text = element.children.flatMap((child) => parseInline(child));
|
|
switch (element.depth) {
|
|
case 1:
|
|
return notion.headingOne(text);
|
|
case 2:
|
|
return notion.headingTwo(text);
|
|
default:
|
|
return notion.headingThree(text);
|
|
}
|
|
}
|
|
function parseCode(element) {
|
|
const text = ensureLength(element.value);
|
|
const lang = ensureCodeBlockLanguage(element.lang);
|
|
return notion.code(text, lang);
|
|
}
|
|
function parseList(element, options) {
|
|
return element.children.flatMap((item) => {
|
|
const paragraph = item.children.shift();
|
|
if (paragraph === void 0 || paragraph.type !== "paragraph") {
|
|
return [];
|
|
}
|
|
const text = paragraph.children.flatMap((child) => parseInline(child));
|
|
const parsedChildren = item.children.flatMap((child) => parseNode(child, options));
|
|
if (element.start !== null && element.start !== void 0) {
|
|
return [notion.numberedListItem(text, parsedChildren)];
|
|
} else if (item.checked !== null && item.checked !== void 0) {
|
|
return [notion.toDo(item.checked, text, parsedChildren)];
|
|
} else {
|
|
return [notion.bulletedListItem(text, parsedChildren)];
|
|
}
|
|
});
|
|
}
|
|
function parseTableCell(node) {
|
|
return [node.children.flatMap((child) => parseInline(child))];
|
|
}
|
|
function parseTableRow(node) {
|
|
const tableCells = node.children.flatMap((child) => parseTableCell(child));
|
|
return [notion.tableRow(tableCells)];
|
|
}
|
|
function parseTable(node) {
|
|
var _a;
|
|
const tableWidth = ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) ? node.children[0].children.length : 0;
|
|
const tableRows = node.children.flatMap((child) => parseTableRow(child));
|
|
return [notion.table(tableRows, tableWidth)];
|
|
}
|
|
function parseMath(node) {
|
|
const textWithKatexNewlines = node.value.split("\n").join("\\\\\n");
|
|
return notion.equation(textWithKatexNewlines);
|
|
}
|
|
function parseNode(node, options) {
|
|
switch (node.type) {
|
|
case "heading":
|
|
return [parseHeading(node)];
|
|
case "paragraph":
|
|
return parseParagraph(node, options);
|
|
case "code":
|
|
return [parseCode(node)];
|
|
case "blockquote":
|
|
return [parseBlockquote(node, options)];
|
|
case "list":
|
|
return parseList(node, options);
|
|
case "table":
|
|
return parseTable(node);
|
|
case "math":
|
|
return [parseMath(node)];
|
|
default:
|
|
return [];
|
|
}
|
|
}
|
|
function parseBlocks(root, options) {
|
|
var _a, _b, _c, _d;
|
|
const parsed = root.children.flatMap((item) => parseNode(item, options || {}));
|
|
const truncate = !!((_b = (_a = options === null || options === void 0 ? void 0 : options.notionLimits) === null || _a === void 0 ? void 0 : _a.truncate) !== null && _b !== void 0 ? _b : true), limitCallback = (_d = (_c = options === null || options === void 0 ? void 0 : options.notionLimits) === null || _c === void 0 ? void 0 : _c.onError) !== null && _d !== void 0 ? _d : () => {
|
|
};
|
|
if (parsed.length > notion_1.LIMITS.PAYLOAD_BLOCKS)
|
|
limitCallback(new Error(`Resulting blocks array exceeds Notion limit (${notion_1.LIMITS.PAYLOAD_BLOCKS})`));
|
|
return truncate ? parsed.slice(0, notion_1.LIMITS.PAYLOAD_BLOCKS) : parsed;
|
|
}
|
|
exports.parseBlocks = parseBlocks;
|
|
function parseRichText(root, options) {
|
|
var _a, _b, _c, _d;
|
|
const richTexts = [];
|
|
root.children.forEach((child) => {
|
|
if (child.type === "paragraph")
|
|
child.children.forEach((child2) => richTexts.push(...parseInline(child2)));
|
|
else if ((options === null || options === void 0 ? void 0 : options.nonInline) === "throw")
|
|
throw new Error(`Unsupported markdown element: ${JSON.stringify(child)}`);
|
|
});
|
|
const truncate = !!((_b = (_a = options === null || options === void 0 ? void 0 : options.notionLimits) === null || _a === void 0 ? void 0 : _a.truncate) !== null && _b !== void 0 ? _b : true), limitCallback = (_d = (_c = options === null || options === void 0 ? void 0 : options.notionLimits) === null || _c === void 0 ? void 0 : _c.onError) !== null && _d !== void 0 ? _d : () => {
|
|
};
|
|
if (richTexts.length > notion_1.LIMITS.RICH_TEXT_ARRAYS)
|
|
limitCallback(new Error(`Resulting richTexts array exceeds Notion limit (${notion_1.LIMITS.RICH_TEXT_ARRAYS})`));
|
|
return (truncate ? richTexts.slice(0, notion_1.LIMITS.RICH_TEXT_ARRAYS) : richTexts).map((rt) => {
|
|
var _a2;
|
|
if (rt.type !== "text")
|
|
return rt;
|
|
if (rt.text.content.length > notion_1.LIMITS.RICH_TEXT.TEXT_CONTENT) {
|
|
limitCallback(new Error(`Resulting text content exceeds Notion limit (${notion_1.LIMITS.RICH_TEXT.TEXT_CONTENT})`));
|
|
if (truncate)
|
|
rt.text.content = rt.text.content.slice(0, notion_1.LIMITS.RICH_TEXT.TEXT_CONTENT - 3) + "...";
|
|
}
|
|
if (((_a2 = rt.text.link) === null || _a2 === void 0 ? void 0 : _a2.url) && rt.text.link.url.length > notion_1.LIMITS.RICH_TEXT.LINK_URL)
|
|
limitCallback(new Error(`Resulting text URL exceeds Notion limit (${notion_1.LIMITS.RICH_TEXT.LINK_URL})`));
|
|
return rt;
|
|
});
|
|
}
|
|
exports.parseRichText = parseRichText;
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-autolink-literal/syntax.js
|
|
var require_syntax = __commonJS({
|
|
"node_modules/micromark-extension-gfm-autolink-literal/syntax.js"(exports) {
|
|
var asciiAlpha = require_ascii_alpha();
|
|
var asciiAlphanumeric = require_ascii_alphanumeric();
|
|
var asciiControl = require_ascii_control();
|
|
var markdownLineEnding = require_markdown_line_ending();
|
|
var unicodePunctuation = require_unicode_punctuation();
|
|
var unicodeWhitespace = require_unicode_whitespace();
|
|
var www = { tokenize: tokenizeWww, partial: true };
|
|
var domain = { tokenize: tokenizeDomain, partial: true };
|
|
var path = { tokenize: tokenizePath, partial: true };
|
|
var punctuation = { tokenize: tokenizePunctuation, partial: true };
|
|
var namedCharacterReference = {
|
|
tokenize: tokenizeNamedCharacterReference,
|
|
partial: true
|
|
};
|
|
var wwwAutolink = { tokenize: tokenizeWwwAutolink, previous: previousWww };
|
|
var httpAutolink = { tokenize: tokenizeHttpAutolink, previous: previousHttp };
|
|
var emailAutolink = { tokenize: tokenizeEmailAutolink, previous: previousEmail };
|
|
var text = {};
|
|
exports.text = text;
|
|
var code = 48;
|
|
while (code < 123) {
|
|
text[code] = emailAutolink;
|
|
code++;
|
|
if (code === 58)
|
|
code = 65;
|
|
else if (code === 91)
|
|
code = 97;
|
|
}
|
|
text[43] = emailAutolink;
|
|
text[45] = emailAutolink;
|
|
text[46] = emailAutolink;
|
|
text[95] = emailAutolink;
|
|
text[72] = [emailAutolink, httpAutolink];
|
|
text[104] = [emailAutolink, httpAutolink];
|
|
text[87] = [emailAutolink, wwwAutolink];
|
|
text[119] = [emailAutolink, wwwAutolink];
|
|
function tokenizeEmailAutolink(effects, ok, nok) {
|
|
var self = this;
|
|
var hasDot;
|
|
return start;
|
|
function start(code2) {
|
|
if (!gfmAtext(code2) || !previousEmail(self.previous) || previous(self.events)) {
|
|
return nok(code2);
|
|
}
|
|
effects.enter("literalAutolink");
|
|
effects.enter("literalAutolinkEmail");
|
|
return atext(code2);
|
|
}
|
|
function atext(code2) {
|
|
if (gfmAtext(code2)) {
|
|
effects.consume(code2);
|
|
return atext;
|
|
}
|
|
if (code2 === 64) {
|
|
effects.consume(code2);
|
|
return label;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function label(code2) {
|
|
if (code2 === 46) {
|
|
return effects.check(punctuation, done, dotContinuation)(code2);
|
|
}
|
|
if (code2 === 45 || code2 === 95) {
|
|
return effects.check(punctuation, nok, dashOrUnderscoreContinuation)(code2);
|
|
}
|
|
if (asciiAlphanumeric(code2)) {
|
|
effects.consume(code2);
|
|
return label;
|
|
}
|
|
return done(code2);
|
|
}
|
|
function dotContinuation(code2) {
|
|
effects.consume(code2);
|
|
hasDot = true;
|
|
return label;
|
|
}
|
|
function dashOrUnderscoreContinuation(code2) {
|
|
effects.consume(code2);
|
|
return afterDashOrUnderscore;
|
|
}
|
|
function afterDashOrUnderscore(code2) {
|
|
if (code2 === 46) {
|
|
return effects.check(punctuation, nok, dotContinuation)(code2);
|
|
}
|
|
return label(code2);
|
|
}
|
|
function done(code2) {
|
|
if (hasDot) {
|
|
effects.exit("literalAutolinkEmail");
|
|
effects.exit("literalAutolink");
|
|
return ok(code2);
|
|
}
|
|
return nok(code2);
|
|
}
|
|
}
|
|
function tokenizeWwwAutolink(effects, ok, nok) {
|
|
var self = this;
|
|
return start;
|
|
function start(code2) {
|
|
if (code2 !== 87 && code2 - 32 !== 87 || !previousWww(self.previous) || previous(self.events)) {
|
|
return nok(code2);
|
|
}
|
|
effects.enter("literalAutolink");
|
|
effects.enter("literalAutolinkWww");
|
|
return effects.check(www, effects.attempt(domain, effects.attempt(path, done), nok), nok)(code2);
|
|
}
|
|
function done(code2) {
|
|
effects.exit("literalAutolinkWww");
|
|
effects.exit("literalAutolink");
|
|
return ok(code2);
|
|
}
|
|
}
|
|
function tokenizeHttpAutolink(effects, ok, nok) {
|
|
var self = this;
|
|
return start;
|
|
function start(code2) {
|
|
if (code2 !== 72 && code2 - 32 !== 72 || !previousHttp(self.previous) || previous(self.events)) {
|
|
return nok(code2);
|
|
}
|
|
effects.enter("literalAutolink");
|
|
effects.enter("literalAutolinkHttp");
|
|
effects.consume(code2);
|
|
return t1;
|
|
}
|
|
function t1(code2) {
|
|
if (code2 === 84 || code2 - 32 === 84) {
|
|
effects.consume(code2);
|
|
return t2;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function t2(code2) {
|
|
if (code2 === 84 || code2 - 32 === 84) {
|
|
effects.consume(code2);
|
|
return p;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function p(code2) {
|
|
if (code2 === 80 || code2 - 32 === 80) {
|
|
effects.consume(code2);
|
|
return s;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function s(code2) {
|
|
if (code2 === 83 || code2 - 32 === 83) {
|
|
effects.consume(code2);
|
|
return colon;
|
|
}
|
|
return colon(code2);
|
|
}
|
|
function colon(code2) {
|
|
if (code2 === 58) {
|
|
effects.consume(code2);
|
|
return slash1;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function slash1(code2) {
|
|
if (code2 === 47) {
|
|
effects.consume(code2);
|
|
return slash2;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function slash2(code2) {
|
|
if (code2 === 47) {
|
|
effects.consume(code2);
|
|
return after;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function after(code2) {
|
|
return asciiControl(code2) || unicodeWhitespace(code2) || unicodePunctuation(code2) ? nok(code2) : effects.attempt(domain, effects.attempt(path, done), nok)(code2);
|
|
}
|
|
function done(code2) {
|
|
effects.exit("literalAutolinkHttp");
|
|
effects.exit("literalAutolink");
|
|
return ok(code2);
|
|
}
|
|
}
|
|
function tokenizeWww(effects, ok, nok) {
|
|
return start;
|
|
function start(code2) {
|
|
effects.consume(code2);
|
|
return w2;
|
|
}
|
|
function w2(code2) {
|
|
if (code2 === 87 || code2 - 32 === 87) {
|
|
effects.consume(code2);
|
|
return w3;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function w3(code2) {
|
|
if (code2 === 87 || code2 - 32 === 87) {
|
|
effects.consume(code2);
|
|
return dot;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function dot(code2) {
|
|
if (code2 === 46) {
|
|
effects.consume(code2);
|
|
return after;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function after(code2) {
|
|
return code2 === null || markdownLineEnding(code2) ? nok(code2) : ok(code2);
|
|
}
|
|
}
|
|
function tokenizeDomain(effects, ok, nok) {
|
|
var hasUnderscoreInLastSegment;
|
|
var hasUnderscoreInLastLastSegment;
|
|
return domain2;
|
|
function domain2(code2) {
|
|
if (code2 === 38) {
|
|
return effects.check(namedCharacterReference, done, punctuationContinuation)(code2);
|
|
}
|
|
if (code2 === 46 || code2 === 95) {
|
|
return effects.check(punctuation, done, punctuationContinuation)(code2);
|
|
}
|
|
if (asciiControl(code2) || unicodeWhitespace(code2) || code2 !== 45 && unicodePunctuation(code2)) {
|
|
return done(code2);
|
|
}
|
|
effects.consume(code2);
|
|
return domain2;
|
|
}
|
|
function punctuationContinuation(code2) {
|
|
if (code2 === 46) {
|
|
hasUnderscoreInLastLastSegment = hasUnderscoreInLastSegment;
|
|
hasUnderscoreInLastSegment = void 0;
|
|
effects.consume(code2);
|
|
return domain2;
|
|
}
|
|
if (code2 === 95)
|
|
hasUnderscoreInLastSegment = true;
|
|
effects.consume(code2);
|
|
return domain2;
|
|
}
|
|
function done(code2) {
|
|
if (!hasUnderscoreInLastLastSegment && !hasUnderscoreInLastSegment) {
|
|
return ok(code2);
|
|
}
|
|
return nok(code2);
|
|
}
|
|
}
|
|
function tokenizePath(effects, ok) {
|
|
var balance = 0;
|
|
return inPath;
|
|
function inPath(code2) {
|
|
if (code2 === 38) {
|
|
return effects.check(namedCharacterReference, ok, continuedPunctuation)(code2);
|
|
}
|
|
if (code2 === 40) {
|
|
balance++;
|
|
}
|
|
if (code2 === 41) {
|
|
return effects.check(punctuation, parenAtPathEnd, continuedPunctuation)(code2);
|
|
}
|
|
if (pathEnd(code2)) {
|
|
return ok(code2);
|
|
}
|
|
if (trailingPunctuation(code2)) {
|
|
return effects.check(punctuation, ok, continuedPunctuation)(code2);
|
|
}
|
|
effects.consume(code2);
|
|
return inPath;
|
|
}
|
|
function continuedPunctuation(code2) {
|
|
effects.consume(code2);
|
|
return inPath;
|
|
}
|
|
function parenAtPathEnd(code2) {
|
|
balance--;
|
|
return balance < 0 ? ok(code2) : continuedPunctuation(code2);
|
|
}
|
|
}
|
|
function tokenizeNamedCharacterReference(effects, ok, nok) {
|
|
return start;
|
|
function start(code2) {
|
|
effects.consume(code2);
|
|
return inside;
|
|
}
|
|
function inside(code2) {
|
|
if (asciiAlpha(code2)) {
|
|
effects.consume(code2);
|
|
return inside;
|
|
}
|
|
if (code2 === 59) {
|
|
effects.consume(code2);
|
|
return after;
|
|
}
|
|
return nok(code2);
|
|
}
|
|
function after(code2) {
|
|
return pathEnd(code2) ? ok(code2) : nok(code2);
|
|
}
|
|
}
|
|
function tokenizePunctuation(effects, ok, nok) {
|
|
return start;
|
|
function start(code2) {
|
|
effects.consume(code2);
|
|
return after;
|
|
}
|
|
function after(code2) {
|
|
if (trailingPunctuation(code2)) {
|
|
effects.consume(code2);
|
|
return after;
|
|
}
|
|
return pathEnd(code2) ? ok(code2) : nok(code2);
|
|
}
|
|
}
|
|
function trailingPunctuation(code2) {
|
|
return code2 === 33 || code2 === 34 || code2 === 39 || code2 === 41 || code2 === 42 || code2 === 44 || code2 === 46 || code2 === 58 || code2 === 59 || code2 === 60 || code2 === 63 || code2 === 95 || code2 === 126;
|
|
}
|
|
function pathEnd(code2) {
|
|
return code2 === null || code2 < 0 || code2 === 32 || code2 === 60;
|
|
}
|
|
function gfmAtext(code2) {
|
|
return code2 === 43 || code2 === 45 || code2 === 46 || code2 === 95 || asciiAlphanumeric(code2);
|
|
}
|
|
function previousWww(code2) {
|
|
return code2 === null || code2 < 0 || code2 === 32 || code2 === 40 || code2 === 42 || code2 === 95 || code2 === 126;
|
|
}
|
|
function previousHttp(code2) {
|
|
return code2 === null || !asciiAlpha(code2);
|
|
}
|
|
function previousEmail(code2) {
|
|
return code2 !== 47 && previousHttp(code2);
|
|
}
|
|
function previous(events) {
|
|
var index = events.length;
|
|
while (index--) {
|
|
if ((events[index][1].type === "labelLink" || events[index][1].type === "labelImage") && !events[index][1]._balanced) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-autolink-literal/index.js
|
|
var require_micromark_extension_gfm_autolink_literal = __commonJS({
|
|
"node_modules/micromark-extension-gfm-autolink-literal/index.js"(exports, module2) {
|
|
module2.exports = require_syntax();
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-strikethrough/index.js
|
|
var require_micromark_extension_gfm_strikethrough = __commonJS({
|
|
"node_modules/micromark-extension-gfm-strikethrough/index.js"(exports, module2) {
|
|
module2.exports = create;
|
|
var classifyCharacter = require_classify_character();
|
|
var chunkedSplice = require_chunked_splice();
|
|
var resolveAll = require_resolve_all();
|
|
var shallow = require_shallow();
|
|
function create(options) {
|
|
var settings = options || {};
|
|
var single = settings.singleTilde;
|
|
var tokenizer = {
|
|
tokenize: tokenizeStrikethrough,
|
|
resolveAll: resolveAllStrikethrough
|
|
};
|
|
if (single === null || single === void 0) {
|
|
single = true;
|
|
}
|
|
return { text: { 126: tokenizer }, insideSpan: { null: tokenizer } };
|
|
function resolveAllStrikethrough(events, context) {
|
|
var index = -1;
|
|
var strikethrough;
|
|
var text;
|
|
var open;
|
|
var nextEvents;
|
|
while (++index < events.length) {
|
|
if (events[index][0] === "enter" && events[index][1].type === "strikethroughSequenceTemporary" && events[index][1]._close) {
|
|
open = index;
|
|
while (open--) {
|
|
if (events[open][0] === "exit" && events[open][1].type === "strikethroughSequenceTemporary" && events[open][1]._open && events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {
|
|
events[index][1].type = "strikethroughSequence";
|
|
events[open][1].type = "strikethroughSequence";
|
|
strikethrough = {
|
|
type: "strikethrough",
|
|
start: shallow(events[open][1].start),
|
|
end: shallow(events[index][1].end)
|
|
};
|
|
text = {
|
|
type: "strikethroughText",
|
|
start: shallow(events[open][1].end),
|
|
end: shallow(events[index][1].start)
|
|
};
|
|
nextEvents = [
|
|
["enter", strikethrough, context],
|
|
["enter", events[open][1], context],
|
|
["exit", events[open][1], context],
|
|
["enter", text, context]
|
|
];
|
|
chunkedSplice(nextEvents, nextEvents.length, 0, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + 1, index), context));
|
|
chunkedSplice(nextEvents, nextEvents.length, 0, [
|
|
["exit", text, context],
|
|
["enter", events[index][1], context],
|
|
["exit", events[index][1], context],
|
|
["exit", strikethrough, context]
|
|
]);
|
|
chunkedSplice(events, open - 1, index - open + 3, nextEvents);
|
|
index = open + nextEvents.length - 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return removeRemainingSequences(events);
|
|
}
|
|
function removeRemainingSequences(events) {
|
|
var index = -1;
|
|
var length = events.length;
|
|
while (++index < length) {
|
|
if (events[index][1].type === "strikethroughSequenceTemporary") {
|
|
events[index][1].type = "data";
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
function tokenizeStrikethrough(effects, ok, nok) {
|
|
var previous = this.previous;
|
|
var events = this.events;
|
|
var size = 0;
|
|
return start;
|
|
function start(code) {
|
|
if (code !== 126 || previous === 126 && events[events.length - 1][1].type !== "characterEscape") {
|
|
return nok(code);
|
|
}
|
|
effects.enter("strikethroughSequenceTemporary");
|
|
return more(code);
|
|
}
|
|
function more(code) {
|
|
var before = classifyCharacter(previous);
|
|
var token;
|
|
var after;
|
|
if (code === 126) {
|
|
if (size > 1)
|
|
return nok(code);
|
|
effects.consume(code);
|
|
size++;
|
|
return more;
|
|
}
|
|
if (size < 2 && !single)
|
|
return nok(code);
|
|
token = effects.exit("strikethroughSequenceTemporary");
|
|
after = classifyCharacter(code);
|
|
token._open = !after || after === 2 && before;
|
|
token._close = !before || before === 2 && after;
|
|
return ok(code);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-table/syntax.js
|
|
var require_syntax2 = __commonJS({
|
|
"node_modules/micromark-extension-gfm-table/syntax.js"(exports) {
|
|
exports.flow = {
|
|
null: { tokenize: tokenizeTable, resolve: resolveTable, interruptible: true }
|
|
};
|
|
var createSpace = require_factory_space();
|
|
var setextUnderlineMini = { tokenize: tokenizeSetextUnderlineMini, partial: true };
|
|
var nextPrefixedOrBlank = { tokenize: tokenizeNextPrefixedOrBlank, partial: true };
|
|
function resolveTable(events, context) {
|
|
var length = events.length;
|
|
var index = -1;
|
|
var token;
|
|
var inHead;
|
|
var inDelimiterRow;
|
|
var inRow;
|
|
var cell;
|
|
var content;
|
|
var text;
|
|
var contentStart;
|
|
var contentEnd;
|
|
var cellStart;
|
|
while (++index < length) {
|
|
token = events[index][1];
|
|
if (inRow) {
|
|
if (token.type === "temporaryTableCellContent") {
|
|
contentStart = contentStart || index;
|
|
contentEnd = index;
|
|
}
|
|
if ((token.type === "tableCellDivider" || token.type === "tableRow") && contentEnd) {
|
|
content = {
|
|
type: "tableContent",
|
|
start: events[contentStart][1].start,
|
|
end: events[contentEnd][1].end
|
|
};
|
|
text = {
|
|
type: "chunkText",
|
|
start: content.start,
|
|
end: content.end,
|
|
contentType: "text"
|
|
};
|
|
events.splice(contentStart, contentEnd - contentStart + 1, ["enter", content, context], ["enter", text, context], ["exit", text, context], ["exit", content, context]);
|
|
index -= contentEnd - contentStart - 3;
|
|
length = events.length;
|
|
contentStart = void 0;
|
|
contentEnd = void 0;
|
|
}
|
|
}
|
|
if (events[index][0] === "exit" && cellStart && cellStart + 1 < index && (token.type === "tableCellDivider" || token.type === "tableRow" && (cellStart + 3 < index || events[cellStart][1].type !== "whitespace"))) {
|
|
cell = {
|
|
type: inDelimiterRow ? "tableDelimiter" : inHead ? "tableHeader" : "tableData",
|
|
start: events[cellStart][1].start,
|
|
end: events[index][1].end
|
|
};
|
|
events.splice(index + (token.type === "tableCellDivider" ? 1 : 0), 0, [
|
|
"exit",
|
|
cell,
|
|
context
|
|
]);
|
|
events.splice(cellStart, 0, ["enter", cell, context]);
|
|
index += 2;
|
|
length = events.length;
|
|
cellStart = index + 1;
|
|
}
|
|
if (token.type === "tableRow") {
|
|
inRow = events[index][0] === "enter";
|
|
if (inRow) {
|
|
cellStart = index + 1;
|
|
}
|
|
}
|
|
if (token.type === "tableDelimiterRow") {
|
|
inDelimiterRow = events[index][0] === "enter";
|
|
if (inDelimiterRow) {
|
|
cellStart = index + 1;
|
|
}
|
|
}
|
|
if (token.type === "tableHead") {
|
|
inHead = events[index][0] === "enter";
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
function tokenizeTable(effects, ok, nok) {
|
|
var align = [];
|
|
var tableHeaderCount = 0;
|
|
var seenDelimiter;
|
|
var hasDash;
|
|
return start;
|
|
function start(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return nok(code);
|
|
}
|
|
effects.enter("table")._align = align;
|
|
effects.enter("tableHead");
|
|
effects.enter("tableRow");
|
|
if (code === 124) {
|
|
return cellDividerHead(code);
|
|
}
|
|
tableHeaderCount++;
|
|
effects.enter("temporaryTableCellContent");
|
|
return inCellContentHead(code);
|
|
}
|
|
function cellDividerHead(code) {
|
|
effects.enter("tableCellDivider");
|
|
effects.consume(code);
|
|
effects.exit("tableCellDivider");
|
|
seenDelimiter = true;
|
|
return cellBreakHead;
|
|
}
|
|
function cellBreakHead(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return atRowEndHead(code);
|
|
}
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.enter("whitespace");
|
|
effects.consume(code);
|
|
return inWhitespaceHead;
|
|
}
|
|
if (seenDelimiter) {
|
|
seenDelimiter = void 0;
|
|
tableHeaderCount++;
|
|
}
|
|
if (code === 124) {
|
|
return cellDividerHead(code);
|
|
}
|
|
effects.enter("temporaryTableCellContent");
|
|
return inCellContentHead(code);
|
|
}
|
|
function inWhitespaceHead(code) {
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.consume(code);
|
|
return inWhitespaceHead;
|
|
}
|
|
effects.exit("whitespace");
|
|
return cellBreakHead(code);
|
|
}
|
|
function inCellContentHead(code) {
|
|
if (code === null || code < 0 || code === 32 || code === 124) {
|
|
effects.exit("temporaryTableCellContent");
|
|
return cellBreakHead(code);
|
|
}
|
|
effects.consume(code);
|
|
return code === 92 ? inCellContentEscapeHead : inCellContentHead;
|
|
}
|
|
function inCellContentEscapeHead(code) {
|
|
if (code === 92 || code === 124) {
|
|
effects.consume(code);
|
|
return inCellContentHead;
|
|
}
|
|
return inCellContentHead(code);
|
|
}
|
|
function atRowEndHead(code) {
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
effects.exit("tableRow");
|
|
effects.exit("tableHead");
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return effects.check(setextUnderlineMini, nok, createSpace(effects, rowStartDelimiter, "linePrefix", 4));
|
|
}
|
|
function rowStartDelimiter(code) {
|
|
if (code === null || code < 0 || code === 32) {
|
|
return nok(code);
|
|
}
|
|
effects.enter("tableDelimiterRow");
|
|
return atDelimiterRowBreak(code);
|
|
}
|
|
function atDelimiterRowBreak(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return rowEndDelimiter(code);
|
|
}
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.enter("whitespace");
|
|
effects.consume(code);
|
|
return inWhitespaceDelimiter;
|
|
}
|
|
if (code === 45) {
|
|
effects.enter("tableDelimiterFiller");
|
|
effects.consume(code);
|
|
hasDash = true;
|
|
align.push(null);
|
|
return inFillerDelimiter;
|
|
}
|
|
if (code === 58) {
|
|
effects.enter("tableDelimiterAlignment");
|
|
effects.consume(code);
|
|
effects.exit("tableDelimiterAlignment");
|
|
align.push("left");
|
|
return afterLeftAlignment;
|
|
}
|
|
if (code === 124) {
|
|
effects.enter("tableCellDivider");
|
|
effects.consume(code);
|
|
effects.exit("tableCellDivider");
|
|
return atDelimiterRowBreak;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function inWhitespaceDelimiter(code) {
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.consume(code);
|
|
return inWhitespaceDelimiter;
|
|
}
|
|
effects.exit("whitespace");
|
|
return atDelimiterRowBreak(code);
|
|
}
|
|
function inFillerDelimiter(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return inFillerDelimiter;
|
|
}
|
|
effects.exit("tableDelimiterFiller");
|
|
if (code === 58) {
|
|
effects.enter("tableDelimiterAlignment");
|
|
effects.consume(code);
|
|
effects.exit("tableDelimiterAlignment");
|
|
align[align.length - 1] = align[align.length - 1] === "left" ? "center" : "right";
|
|
return afterRightAlignment;
|
|
}
|
|
return atDelimiterRowBreak(code);
|
|
}
|
|
function afterLeftAlignment(code) {
|
|
if (code === 45) {
|
|
effects.enter("tableDelimiterFiller");
|
|
effects.consume(code);
|
|
hasDash = true;
|
|
return inFillerDelimiter;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function afterRightAlignment(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return rowEndDelimiter(code);
|
|
}
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.enter("whitespace");
|
|
effects.consume(code);
|
|
return inWhitespaceDelimiter;
|
|
}
|
|
if (code === 124) {
|
|
effects.enter("tableCellDivider");
|
|
effects.consume(code);
|
|
effects.exit("tableCellDivider");
|
|
return atDelimiterRowBreak;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function rowEndDelimiter(code) {
|
|
effects.exit("tableDelimiterRow");
|
|
if (!hasDash || tableHeaderCount !== align.length) {
|
|
return nok(code);
|
|
}
|
|
if (code === null) {
|
|
return tableClose(code);
|
|
}
|
|
return effects.check(nextPrefixedOrBlank, tableClose, tableContinue)(code);
|
|
}
|
|
function tableClose(code) {
|
|
effects.exit("table");
|
|
return ok(code);
|
|
}
|
|
function tableContinue(code) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return createSpace(effects, bodyStart, "linePrefix", 4);
|
|
}
|
|
function bodyStart(code) {
|
|
effects.enter("tableBody");
|
|
return rowStartBody(code);
|
|
}
|
|
function rowStartBody(code) {
|
|
effects.enter("tableRow");
|
|
if (code === 124) {
|
|
return cellDividerBody(code);
|
|
}
|
|
effects.enter("temporaryTableCellContent");
|
|
return inCellContentBody(code);
|
|
}
|
|
function cellDividerBody(code) {
|
|
effects.enter("tableCellDivider");
|
|
effects.consume(code);
|
|
effects.exit("tableCellDivider");
|
|
return cellBreakBody;
|
|
}
|
|
function cellBreakBody(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return atRowEndBody(code);
|
|
}
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.enter("whitespace");
|
|
effects.consume(code);
|
|
return inWhitespaceBody;
|
|
}
|
|
if (code === 124) {
|
|
return cellDividerBody(code);
|
|
}
|
|
effects.enter("temporaryTableCellContent");
|
|
return inCellContentBody(code);
|
|
}
|
|
function inWhitespaceBody(code) {
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.consume(code);
|
|
return inWhitespaceBody;
|
|
}
|
|
effects.exit("whitespace");
|
|
return cellBreakBody(code);
|
|
}
|
|
function inCellContentBody(code) {
|
|
if (code === null || code < 0 || code === 32 || code === 124) {
|
|
effects.exit("temporaryTableCellContent");
|
|
return cellBreakBody(code);
|
|
}
|
|
effects.consume(code);
|
|
return code === 92 ? inCellContentEscapeBody : inCellContentBody;
|
|
}
|
|
function inCellContentEscapeBody(code) {
|
|
if (code === 92 || code === 124) {
|
|
effects.consume(code);
|
|
return inCellContentBody;
|
|
}
|
|
return inCellContentBody(code);
|
|
}
|
|
function atRowEndBody(code) {
|
|
effects.exit("tableRow");
|
|
if (code === null) {
|
|
return tableBodyClose(code);
|
|
}
|
|
return effects.check(nextPrefixedOrBlank, tableBodyClose, tableBodyContinue)(code);
|
|
}
|
|
function tableBodyClose(code) {
|
|
effects.exit("tableBody");
|
|
return tableClose(code);
|
|
}
|
|
function tableBodyContinue(code) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return createSpace(effects, rowStartBody, "linePrefix", 4);
|
|
}
|
|
}
|
|
function tokenizeSetextUnderlineMini(effects, ok, nok) {
|
|
return start;
|
|
function start(code) {
|
|
if (code !== 45) {
|
|
return nok(code);
|
|
}
|
|
effects.enter("setextUnderline");
|
|
return sequence(code);
|
|
}
|
|
function sequence(code) {
|
|
if (code === 45) {
|
|
effects.consume(code);
|
|
return sequence;
|
|
}
|
|
return whitespace(code);
|
|
}
|
|
function whitespace(code) {
|
|
if (code === -2 || code === -1 || code === 32) {
|
|
effects.consume(code);
|
|
return whitespace;
|
|
}
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return ok(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
function tokenizeNextPrefixedOrBlank(effects, ok, nok) {
|
|
var size = 0;
|
|
return start;
|
|
function start(code) {
|
|
effects.enter("check");
|
|
effects.consume(code);
|
|
return whitespace;
|
|
}
|
|
function whitespace(code) {
|
|
if (code === -1 || code === 32) {
|
|
effects.consume(code);
|
|
size++;
|
|
return size === 4 ? ok : whitespace;
|
|
}
|
|
if (code === null || code < 0) {
|
|
return ok(code);
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-table/index.js
|
|
var require_micromark_extension_gfm_table = __commonJS({
|
|
"node_modules/micromark-extension-gfm-table/index.js"(exports, module2) {
|
|
module2.exports = require_syntax2();
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-task-list-item/syntax.js
|
|
var require_syntax3 = __commonJS({
|
|
"node_modules/micromark-extension-gfm-task-list-item/syntax.js"(exports) {
|
|
var markdownLineEndingOrSpace = require_markdown_line_ending_or_space();
|
|
var spaceFactory = require_factory_space();
|
|
var prefixSize = require_prefix_size();
|
|
var tasklistCheck = { tokenize: tokenizeTasklistCheck };
|
|
exports.text = { 91: tasklistCheck };
|
|
function tokenizeTasklistCheck(effects, ok, nok) {
|
|
var self = this;
|
|
return open;
|
|
function open(code) {
|
|
if (code !== 91 || self.previous !== null || !self._gfmTasklistFirstContentOfListItem) {
|
|
return nok(code);
|
|
}
|
|
effects.enter("taskListCheck");
|
|
effects.enter("taskListCheckMarker");
|
|
effects.consume(code);
|
|
effects.exit("taskListCheckMarker");
|
|
return inside;
|
|
}
|
|
function inside(code) {
|
|
if (code === -2 || code === 32) {
|
|
effects.enter("taskListCheckValueUnchecked");
|
|
effects.consume(code);
|
|
effects.exit("taskListCheckValueUnchecked");
|
|
return close;
|
|
}
|
|
if (code === 88 || code === 120) {
|
|
effects.enter("taskListCheckValueChecked");
|
|
effects.consume(code);
|
|
effects.exit("taskListCheckValueChecked");
|
|
return close;
|
|
}
|
|
return nok(code);
|
|
}
|
|
function close(code) {
|
|
if (code === 93) {
|
|
effects.enter("taskListCheckMarker");
|
|
effects.consume(code);
|
|
effects.exit("taskListCheckMarker");
|
|
effects.exit("taskListCheck");
|
|
return effects.check({ tokenize: spaceThenNonSpace }, ok, nok);
|
|
}
|
|
return nok(code);
|
|
}
|
|
}
|
|
function spaceThenNonSpace(effects, ok, nok) {
|
|
var self = this;
|
|
return spaceFactory(effects, after, "whitespace");
|
|
function after(code) {
|
|
return prefixSize(self.events, "whitespace") && code !== null && !markdownLineEndingOrSpace(code) ? ok(code) : nok(code);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm-task-list-item/index.js
|
|
var require_micromark_extension_gfm_task_list_item = __commonJS({
|
|
"node_modules/micromark-extension-gfm-task-list-item/index.js"(exports, module2) {
|
|
module2.exports = require_syntax3();
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm/syntax.js
|
|
var require_syntax4 = __commonJS({
|
|
"node_modules/micromark-extension-gfm/syntax.js"(exports, module2) {
|
|
var combine = require_combine_extensions();
|
|
var autolink = require_micromark_extension_gfm_autolink_literal();
|
|
var strikethrough = require_micromark_extension_gfm_strikethrough();
|
|
var table = require_micromark_extension_gfm_table();
|
|
var tasklist = require_micromark_extension_gfm_task_list_item();
|
|
module2.exports = create;
|
|
function create(options) {
|
|
return combine([autolink, strikethrough(options), table, tasklist]);
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-gfm/index.js
|
|
var require_micromark_extension_gfm = __commonJS({
|
|
"node_modules/micromark-extension-gfm/index.js"(exports, module2) {
|
|
module2.exports = require_syntax4();
|
|
}
|
|
});
|
|
|
|
// node_modules/ccount/index.js
|
|
var require_ccount = __commonJS({
|
|
"node_modules/ccount/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = ccount;
|
|
function ccount(source, character) {
|
|
var value = String(source);
|
|
var count = 0;
|
|
var index;
|
|
if (typeof character !== "string") {
|
|
throw new Error("Expected character");
|
|
}
|
|
index = value.indexOf(character);
|
|
while (index !== -1) {
|
|
count++;
|
|
index = value.indexOf(character, index + character.length);
|
|
}
|
|
return count;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/unist-util-is/convert.js
|
|
var require_convert = __commonJS({
|
|
"node_modules/unist-util-is/convert.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = convert;
|
|
function convert(test) {
|
|
if (test == null) {
|
|
return ok;
|
|
}
|
|
if (typeof test === "string") {
|
|
return typeFactory(test);
|
|
}
|
|
if (typeof test === "object") {
|
|
return "length" in test ? anyFactory(test) : allFactory(test);
|
|
}
|
|
if (typeof test === "function") {
|
|
return test;
|
|
}
|
|
throw new Error("Expected function, string, or object as test");
|
|
}
|
|
function allFactory(test) {
|
|
return all;
|
|
function all(node) {
|
|
var key;
|
|
for (key in test) {
|
|
if (node[key] !== test[key])
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
function anyFactory(tests) {
|
|
var checks = [];
|
|
var index = -1;
|
|
while (++index < tests.length) {
|
|
checks[index] = convert(tests[index]);
|
|
}
|
|
return any;
|
|
function any() {
|
|
var index2 = -1;
|
|
while (++index2 < checks.length) {
|
|
if (checks[index2].apply(this, arguments)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
function typeFactory(test) {
|
|
return type;
|
|
function type(node) {
|
|
return Boolean(node && node.type === test);
|
|
}
|
|
}
|
|
function ok() {
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/unist-util-visit-parents/color.browser.js
|
|
var require_color_browser = __commonJS({
|
|
"node_modules/unist-util-visit-parents/color.browser.js"(exports, module2) {
|
|
module2.exports = identity;
|
|
function identity(d) {
|
|
return d;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/unist-util-visit-parents/index.js
|
|
var require_unist_util_visit_parents = __commonJS({
|
|
"node_modules/unist-util-visit-parents/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = visitParents;
|
|
var convert = require_convert();
|
|
var color = require_color_browser();
|
|
var CONTINUE = true;
|
|
var SKIP3 = "skip";
|
|
var EXIT = false;
|
|
visitParents.CONTINUE = CONTINUE;
|
|
visitParents.SKIP = SKIP3;
|
|
visitParents.EXIT = EXIT;
|
|
function visitParents(tree, test, visitor, reverse) {
|
|
var step;
|
|
var is;
|
|
if (typeof test === "function" && typeof visitor !== "function") {
|
|
reverse = visitor;
|
|
visitor = test;
|
|
test = null;
|
|
}
|
|
is = convert(test);
|
|
step = reverse ? -1 : 1;
|
|
factory(tree, null, [])();
|
|
function factory(node, index, parents) {
|
|
var value = typeof node === "object" && node !== null ? node : {};
|
|
var name;
|
|
if (typeof value.type === "string") {
|
|
name = typeof value.tagName === "string" ? value.tagName : typeof value.name === "string" ? value.name : void 0;
|
|
visit3.displayName = "node (" + color(value.type + (name ? "<" + name + ">" : "")) + ")";
|
|
}
|
|
return visit3;
|
|
function visit3() {
|
|
var grandparents = parents.concat(node);
|
|
var result = [];
|
|
var subresult;
|
|
var offset;
|
|
if (!test || is(node, index, parents[parents.length - 1] || null)) {
|
|
result = toResult(visitor(node, parents));
|
|
if (result[0] === EXIT) {
|
|
return result;
|
|
}
|
|
}
|
|
if (node.children && result[0] !== SKIP3) {
|
|
offset = (reverse ? node.children.length : -1) + step;
|
|
while (offset > -1 && offset < node.children.length) {
|
|
subresult = factory(node.children[offset], offset, grandparents)();
|
|
if (subresult[0] === EXIT) {
|
|
return subresult;
|
|
}
|
|
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
function toResult(value) {
|
|
if (value !== null && typeof value === "object" && "length" in value) {
|
|
return value;
|
|
}
|
|
if (typeof value === "number") {
|
|
return [CONTINUE, value];
|
|
}
|
|
return [value];
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/escape-string-regexp/index.js
|
|
var require_escape_string_regexp = __commonJS({
|
|
"node_modules/escape-string-regexp/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = (string2) => {
|
|
if (typeof string2 !== "string") {
|
|
throw new TypeError("Expected a string");
|
|
}
|
|
return string2.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-find-and-replace/index.js
|
|
var require_mdast_util_find_and_replace = __commonJS({
|
|
"node_modules/mdast-util-find-and-replace/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = findAndReplace;
|
|
var visit3 = require_unist_util_visit_parents();
|
|
var convert = require_convert();
|
|
var escape = require_escape_string_regexp();
|
|
var splice = [].splice;
|
|
function findAndReplace(tree, find, replace, options) {
|
|
var settings;
|
|
var schema4;
|
|
if (typeof find === "string" || find && typeof find.exec === "function") {
|
|
schema4 = [[find, replace]];
|
|
} else {
|
|
schema4 = find;
|
|
options = replace;
|
|
}
|
|
settings = options || {};
|
|
search(tree, settings, handlerFactory(toPairs(schema4)));
|
|
return tree;
|
|
function handlerFactory(pairs2) {
|
|
var pair = pairs2[0];
|
|
return handler;
|
|
function handler(node, parent) {
|
|
var find2 = pair[0];
|
|
var replace2 = pair[1];
|
|
var nodes = [];
|
|
var start = 0;
|
|
var index = parent.children.indexOf(node);
|
|
var position;
|
|
var match;
|
|
var subhandler;
|
|
var value;
|
|
find2.lastIndex = 0;
|
|
match = find2.exec(node.value);
|
|
while (match) {
|
|
position = match.index;
|
|
value = replace2.apply(null, [].concat(match, { index: match.index, input: match.input }));
|
|
if (value !== false) {
|
|
if (start !== position) {
|
|
nodes.push({ type: "text", value: node.value.slice(start, position) });
|
|
}
|
|
if (typeof value === "string" && value.length > 0) {
|
|
value = { type: "text", value };
|
|
}
|
|
if (value) {
|
|
nodes = [].concat(nodes, value);
|
|
}
|
|
start = position + match[0].length;
|
|
}
|
|
if (!find2.global) {
|
|
break;
|
|
}
|
|
match = find2.exec(node.value);
|
|
}
|
|
if (position === void 0) {
|
|
nodes = [node];
|
|
index--;
|
|
} else {
|
|
if (start < node.value.length) {
|
|
nodes.push({ type: "text", value: node.value.slice(start) });
|
|
}
|
|
nodes.unshift(index, 1);
|
|
splice.apply(parent.children, nodes);
|
|
}
|
|
if (pairs2.length > 1) {
|
|
subhandler = handlerFactory(pairs2.slice(1));
|
|
position = -1;
|
|
while (++position < nodes.length) {
|
|
node = nodes[position];
|
|
if (node.type === "text") {
|
|
subhandler(node, parent);
|
|
} else {
|
|
search(node, settings, subhandler);
|
|
}
|
|
}
|
|
}
|
|
return index + nodes.length + 1;
|
|
}
|
|
}
|
|
}
|
|
function search(tree, settings, handler) {
|
|
var ignored = convert(settings.ignore || []);
|
|
var result = [];
|
|
visit3(tree, "text", visitor);
|
|
return result;
|
|
function visitor(node, parents) {
|
|
var index = -1;
|
|
var parent;
|
|
var grandparent;
|
|
while (++index < parents.length) {
|
|
parent = parents[index];
|
|
if (ignored(parent, grandparent ? grandparent.children.indexOf(parent) : void 0, grandparent)) {
|
|
return;
|
|
}
|
|
grandparent = parent;
|
|
}
|
|
return handler(node, grandparent);
|
|
}
|
|
}
|
|
function toPairs(schema4) {
|
|
var result = [];
|
|
var key;
|
|
var index;
|
|
if (typeof schema4 !== "object") {
|
|
throw new Error("Expected array or object as schema");
|
|
}
|
|
if ("length" in schema4) {
|
|
index = -1;
|
|
while (++index < schema4.length) {
|
|
result.push([
|
|
toExpression(schema4[index][0]),
|
|
toFunction(schema4[index][1])
|
|
]);
|
|
}
|
|
} else {
|
|
for (key in schema4) {
|
|
result.push([toExpression(key), toFunction(schema4[key])]);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
function toExpression(find) {
|
|
return typeof find === "string" ? new RegExp(escape(find), "g") : find;
|
|
}
|
|
function toFunction(replace) {
|
|
return typeof replace === "function" ? replace : returner;
|
|
function returner() {
|
|
return replace;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-autolink-literal/from-markdown.js
|
|
var require_from_markdown = __commonJS({
|
|
"node_modules/mdast-util-gfm-autolink-literal/from-markdown.js"(exports) {
|
|
var ccount = require_ccount();
|
|
var findAndReplace = require_mdast_util_find_and_replace();
|
|
var unicodePunctuation = require_unicode_punctuation();
|
|
var unicodeWhitespace = require_unicode_whitespace();
|
|
exports.transforms = [transformGfmAutolinkLiterals];
|
|
exports.enter = {
|
|
literalAutolink: enterLiteralAutolink,
|
|
literalAutolinkEmail: enterLiteralAutolinkValue,
|
|
literalAutolinkHttp: enterLiteralAutolinkValue,
|
|
literalAutolinkWww: enterLiteralAutolinkValue
|
|
};
|
|
exports.exit = {
|
|
literalAutolink: exitLiteralAutolink,
|
|
literalAutolinkEmail: exitLiteralAutolinkEmail,
|
|
literalAutolinkHttp: exitLiteralAutolinkHttp,
|
|
literalAutolinkWww: exitLiteralAutolinkWww
|
|
};
|
|
function enterLiteralAutolink(token) {
|
|
this.enter({ type: "link", title: null, url: "", children: [] }, token);
|
|
}
|
|
function enterLiteralAutolinkValue(token) {
|
|
this.config.enter.autolinkProtocol.call(this, token);
|
|
}
|
|
function exitLiteralAutolinkHttp(token) {
|
|
this.config.exit.autolinkProtocol.call(this, token);
|
|
}
|
|
function exitLiteralAutolinkWww(token) {
|
|
this.config.exit.data.call(this, token);
|
|
this.stack[this.stack.length - 1].url = "http://" + this.sliceSerialize(token);
|
|
}
|
|
function exitLiteralAutolinkEmail(token) {
|
|
this.config.exit.autolinkEmail.call(this, token);
|
|
}
|
|
function exitLiteralAutolink(token) {
|
|
this.exit(token);
|
|
}
|
|
function transformGfmAutolinkLiterals(tree) {
|
|
findAndReplace(tree, [
|
|
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/i, findUrl],
|
|
[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/, findEmail]
|
|
], { ignore: ["link", "linkReference"] });
|
|
}
|
|
function findUrl($0, protocol, domain, path, match) {
|
|
var prefix = "";
|
|
var parts;
|
|
var result;
|
|
if (!previous(match)) {
|
|
return false;
|
|
}
|
|
if (/^w/i.test(protocol)) {
|
|
domain = protocol + domain;
|
|
protocol = "";
|
|
prefix = "http://";
|
|
}
|
|
if (!isCorrectDomain(domain)) {
|
|
return false;
|
|
}
|
|
parts = splitUrl(domain + path);
|
|
if (!parts[0])
|
|
return false;
|
|
result = {
|
|
type: "link",
|
|
title: null,
|
|
url: prefix + protocol + parts[0],
|
|
children: [{ type: "text", value: protocol + parts[0] }]
|
|
};
|
|
if (parts[1]) {
|
|
result = [result, { type: "text", value: parts[1] }];
|
|
}
|
|
return result;
|
|
}
|
|
function findEmail($0, atext, label, match) {
|
|
if (!previous(match, true) || /[_-]$/.test(label)) {
|
|
return false;
|
|
}
|
|
return {
|
|
type: "link",
|
|
title: null,
|
|
url: "mailto:" + atext + "@" + label,
|
|
children: [{ type: "text", value: atext + "@" + label }]
|
|
};
|
|
}
|
|
function isCorrectDomain(domain) {
|
|
var parts = domain.split(".");
|
|
if (parts.length < 2 || parts[parts.length - 1] && (/_/.test(parts[parts.length - 1]) || !/[a-zA-Z\d]/.test(parts[parts.length - 1])) || parts[parts.length - 2] && (/_/.test(parts[parts.length - 2]) || !/[a-zA-Z\d]/.test(parts[parts.length - 2]))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function splitUrl(url) {
|
|
var trail = /[!"&'),.:;<>?\]}]+$/.exec(url);
|
|
var closingParenIndex;
|
|
var openingParens;
|
|
var closingParens;
|
|
if (trail) {
|
|
url = url.slice(0, trail.index);
|
|
trail = trail[0];
|
|
closingParenIndex = trail.indexOf(")");
|
|
openingParens = ccount(url, "(");
|
|
closingParens = ccount(url, ")");
|
|
while (closingParenIndex !== -1 && openingParens > closingParens) {
|
|
url += trail.slice(0, closingParenIndex + 1);
|
|
trail = trail.slice(closingParenIndex + 1);
|
|
closingParenIndex = trail.indexOf(")");
|
|
closingParens++;
|
|
}
|
|
}
|
|
return [url, trail];
|
|
}
|
|
function previous(match, email) {
|
|
var code = match.input.charCodeAt(match.index - 1);
|
|
return (code !== code || unicodeWhitespace(code) || unicodePunctuation(code)) && (!email || code !== 47);
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-strikethrough/from-markdown.js
|
|
var require_from_markdown2 = __commonJS({
|
|
"node_modules/mdast-util-gfm-strikethrough/from-markdown.js"(exports) {
|
|
exports.canContainEols = ["delete"];
|
|
exports.enter = { strikethrough: enterStrikethrough };
|
|
exports.exit = { strikethrough: exitStrikethrough };
|
|
function enterStrikethrough(token) {
|
|
this.enter({ type: "delete", children: [] }, token);
|
|
}
|
|
function exitStrikethrough(token) {
|
|
this.exit(token);
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-table/from-markdown.js
|
|
var require_from_markdown3 = __commonJS({
|
|
"node_modules/mdast-util-gfm-table/from-markdown.js"(exports) {
|
|
exports.enter = {
|
|
table: enterTable,
|
|
tableData: enterCell,
|
|
tableHeader: enterCell,
|
|
tableRow: enterRow
|
|
};
|
|
exports.exit = {
|
|
codeText: exitCodeText,
|
|
table: exitTable,
|
|
tableData: exit,
|
|
tableHeader: exit,
|
|
tableRow: exit
|
|
};
|
|
function enterTable(token) {
|
|
this.enter({ type: "table", align: token._align, children: [] }, token);
|
|
this.setData("inTable", true);
|
|
}
|
|
function exitTable(token) {
|
|
this.exit(token);
|
|
this.setData("inTable");
|
|
}
|
|
function enterRow(token) {
|
|
this.enter({ type: "tableRow", children: [] }, token);
|
|
}
|
|
function exit(token) {
|
|
this.exit(token);
|
|
}
|
|
function enterCell(token) {
|
|
this.enter({ type: "tableCell", children: [] }, token);
|
|
}
|
|
function exitCodeText(token) {
|
|
var value = this.resume();
|
|
if (this.getData("inTable")) {
|
|
value = value.replace(/\\([\\|])/g, replace);
|
|
}
|
|
this.stack[this.stack.length - 1].value = value;
|
|
this.exit(token);
|
|
}
|
|
function replace($0, $1) {
|
|
return $1 === "|" ? $1 : $0;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-task-list-item/from-markdown.js
|
|
var require_from_markdown4 = __commonJS({
|
|
"node_modules/mdast-util-gfm-task-list-item/from-markdown.js"(exports) {
|
|
exports.exit = {
|
|
taskListCheckValueChecked: exitCheck,
|
|
taskListCheckValueUnchecked: exitCheck,
|
|
paragraph: exitParagraphWithTaskListItem
|
|
};
|
|
function exitCheck(token) {
|
|
this.stack[this.stack.length - 2].checked = token.type === "taskListCheckValueChecked";
|
|
}
|
|
function exitParagraphWithTaskListItem(token) {
|
|
var parent = this.stack[this.stack.length - 2];
|
|
var node = this.stack[this.stack.length - 1];
|
|
var siblings = parent.children;
|
|
var head = node.children[0];
|
|
var index = -1;
|
|
var firstParaghraph;
|
|
if (parent && parent.type === "listItem" && typeof parent.checked === "boolean" && head && head.type === "text") {
|
|
while (++index < siblings.length) {
|
|
if (siblings[index].type === "paragraph") {
|
|
firstParaghraph = siblings[index];
|
|
break;
|
|
}
|
|
}
|
|
if (firstParaghraph === node) {
|
|
head.value = head.value.slice(1);
|
|
if (head.value.length === 0) {
|
|
node.children.shift();
|
|
} else {
|
|
head.position.start.column++;
|
|
head.position.start.offset++;
|
|
node.position.start = Object.assign({}, head.position.start);
|
|
}
|
|
}
|
|
}
|
|
this.exit(token);
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm/from-markdown.js
|
|
var require_from_markdown5 = __commonJS({
|
|
"node_modules/mdast-util-gfm/from-markdown.js"(exports, module2) {
|
|
var autolinkLiteral = require_from_markdown();
|
|
var strikethrough = require_from_markdown2();
|
|
var table = require_from_markdown3();
|
|
var taskListItem = require_from_markdown4();
|
|
var own = {}.hasOwnProperty;
|
|
module2.exports = configure([
|
|
autolinkLiteral,
|
|
strikethrough,
|
|
table,
|
|
taskListItem
|
|
]);
|
|
function configure(extensions) {
|
|
var config = { transforms: [], canContainEols: [] };
|
|
var length = extensions.length;
|
|
var index = -1;
|
|
while (++index < length) {
|
|
extension(config, extensions[index]);
|
|
}
|
|
return config;
|
|
}
|
|
function extension(config, extension2) {
|
|
var key;
|
|
var left;
|
|
var right;
|
|
for (key in extension2) {
|
|
left = own.call(config, key) ? config[key] : config[key] = {};
|
|
right = extension2[key];
|
|
if (key === "canContainEols" || key === "transforms") {
|
|
config[key] = [].concat(left, right);
|
|
} else {
|
|
Object.assign(left, right);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-autolink-literal/to-markdown.js
|
|
var require_to_markdown = __commonJS({
|
|
"node_modules/mdast-util-gfm-autolink-literal/to-markdown.js"(exports) {
|
|
var inConstruct = "phrasing";
|
|
var notInConstruct = ["autolink", "link", "image", "label"];
|
|
exports.unsafe = [
|
|
{
|
|
character: "@",
|
|
before: "[+\\-.\\w]",
|
|
after: "[\\-.\\w]",
|
|
inConstruct,
|
|
notInConstruct
|
|
},
|
|
{
|
|
character: ".",
|
|
before: "[Ww]",
|
|
after: "[\\-.\\w]",
|
|
inConstruct,
|
|
notInConstruct
|
|
},
|
|
{
|
|
character: ":",
|
|
before: "[ps]",
|
|
after: "\\/",
|
|
inConstruct,
|
|
notInConstruct
|
|
}
|
|
];
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
|
|
var require_container_phrasing = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js"(exports, module2) {
|
|
module2.exports = phrasing;
|
|
function phrasing(parent, context, safeOptions) {
|
|
var children = parent.children || [];
|
|
var results = [];
|
|
var index = -1;
|
|
var before = safeOptions.before;
|
|
var after;
|
|
var handle;
|
|
var child;
|
|
while (++index < children.length) {
|
|
child = children[index];
|
|
if (index + 1 < children.length) {
|
|
handle = context.handle.handlers[children[index + 1].type];
|
|
if (handle && handle.peek)
|
|
handle = handle.peek;
|
|
after = handle ? handle(children[index + 1], parent, context, {
|
|
before: "",
|
|
after: ""
|
|
}).charAt(0) : "";
|
|
} else {
|
|
after = safeOptions.after;
|
|
}
|
|
if (results.length > 0 && (before === "\r" || before === "\n") && child.type === "html") {
|
|
results[results.length - 1] = results[results.length - 1].replace(/(\r?\n|\r)$/, " ");
|
|
before = " ";
|
|
}
|
|
results.push(context.handle(child, parent, context, {
|
|
before,
|
|
after
|
|
}));
|
|
before = results[results.length - 1].slice(-1);
|
|
}
|
|
return results.join("");
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-strikethrough/to-markdown.js
|
|
var require_to_markdown2 = __commonJS({
|
|
"node_modules/mdast-util-gfm-strikethrough/to-markdown.js"(exports) {
|
|
var phrasing = require_container_phrasing();
|
|
exports.unsafe = [{ character: "~", inConstruct: "phrasing" }];
|
|
exports.handlers = { delete: handleDelete };
|
|
handleDelete.peek = peekDelete;
|
|
function handleDelete(node, _, context) {
|
|
var exit = context.enter("emphasis");
|
|
var value = phrasing(node, context, { before: "~", after: "~" });
|
|
exit();
|
|
return "~~" + value + "~~";
|
|
}
|
|
function peekDelete() {
|
|
return "~";
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
|
|
var require_pattern_compile = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js"(exports, module2) {
|
|
module2.exports = patternCompile;
|
|
function patternCompile(pattern) {
|
|
var before;
|
|
var after;
|
|
if (!pattern._compiled) {
|
|
before = pattern.before ? "(?:" + pattern.before + ")" : "";
|
|
after = pattern.after ? "(?:" + pattern.after + ")" : "";
|
|
if (pattern.atBreak) {
|
|
before = "[\\r\\n][\\t ]*" + before;
|
|
}
|
|
pattern._compiled = new RegExp((before ? "(" + before + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? "\\" : "") + pattern.character + (after || ""), "g");
|
|
}
|
|
return pattern._compiled;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
|
|
var require_inline_code = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/handle/inline-code.js"(exports, module2) {
|
|
module2.exports = inlineCode;
|
|
inlineCode.peek = inlineCodePeek;
|
|
var patternCompile = require_pattern_compile();
|
|
function inlineCode(node, parent, context) {
|
|
var value = node.value || "";
|
|
var sequence = "`";
|
|
var index = -1;
|
|
var pattern;
|
|
var expression;
|
|
var match;
|
|
var position;
|
|
while (new RegExp("(^|[^`])" + sequence + "([^`]|$)").test(value)) {
|
|
sequence += "`";
|
|
}
|
|
if (/[^ \r\n]/.test(value) && (/[ \r\n`]/.test(value.charAt(0)) || /[ \r\n`]/.test(value.charAt(value.length - 1)))) {
|
|
value = " " + value + " ";
|
|
}
|
|
while (++index < context.unsafe.length) {
|
|
pattern = context.unsafe[index];
|
|
if (!pattern.atBreak)
|
|
continue;
|
|
expression = patternCompile(pattern);
|
|
while (match = expression.exec(value)) {
|
|
position = match.index;
|
|
if (value.charCodeAt(position) === 10 && value.charCodeAt(position - 1) === 13) {
|
|
position--;
|
|
}
|
|
value = value.slice(0, position) + " " + value.slice(match.index + 1);
|
|
}
|
|
}
|
|
return sequence + value + sequence;
|
|
}
|
|
function inlineCodePeek() {
|
|
return "`";
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/repeat-string/index.js
|
|
var require_repeat_string = __commonJS({
|
|
"node_modules/repeat-string/index.js"(exports, module2) {
|
|
"use strict";
|
|
var res = "";
|
|
var cache;
|
|
module2.exports = repeat;
|
|
function repeat(str, num) {
|
|
if (typeof str !== "string") {
|
|
throw new TypeError("expected a string");
|
|
}
|
|
if (num === 1)
|
|
return str;
|
|
if (num === 2)
|
|
return str + str;
|
|
var max = str.length * num;
|
|
if (cache !== str || typeof cache === "undefined") {
|
|
cache = str;
|
|
res = "";
|
|
} else if (res.length >= max) {
|
|
return res.substr(0, max);
|
|
}
|
|
while (max > res.length && num > 1) {
|
|
if (num & 1) {
|
|
res += str;
|
|
}
|
|
num >>= 1;
|
|
str += str;
|
|
}
|
|
res += str;
|
|
res = res.substr(0, max);
|
|
return res;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/markdown-table/index.js
|
|
var require_markdown_table = __commonJS({
|
|
"node_modules/markdown-table/index.js"(exports, module2) {
|
|
"use strict";
|
|
var repeat = require_repeat_string();
|
|
module2.exports = markdownTable;
|
|
var trailingWhitespace = / +$/;
|
|
var space = " ";
|
|
var lineFeed = "\n";
|
|
var dash = "-";
|
|
var colon = ":";
|
|
var verticalBar = "|";
|
|
var x = 0;
|
|
var C = 67;
|
|
var L = 76;
|
|
var R = 82;
|
|
var c = 99;
|
|
var l = 108;
|
|
var r = 114;
|
|
function markdownTable(table, options) {
|
|
var settings = options || {};
|
|
var padding = settings.padding !== false;
|
|
var start = settings.delimiterStart !== false;
|
|
var end = settings.delimiterEnd !== false;
|
|
var align = (settings.align || []).concat();
|
|
var alignDelimiters = settings.alignDelimiters !== false;
|
|
var alignments = [];
|
|
var stringLength = settings.stringLength || defaultStringLength;
|
|
var rowIndex = -1;
|
|
var rowLength = table.length;
|
|
var cellMatrix = [];
|
|
var sizeMatrix = [];
|
|
var row = [];
|
|
var sizes = [];
|
|
var longestCellByColumn = [];
|
|
var mostCellsPerRow = 0;
|
|
var cells;
|
|
var columnIndex;
|
|
var columnLength;
|
|
var largest;
|
|
var size;
|
|
var cell;
|
|
var lines;
|
|
var line;
|
|
var before;
|
|
var after;
|
|
var code;
|
|
while (++rowIndex < rowLength) {
|
|
cells = table[rowIndex];
|
|
columnIndex = -1;
|
|
columnLength = cells.length;
|
|
row = [];
|
|
sizes = [];
|
|
if (columnLength > mostCellsPerRow) {
|
|
mostCellsPerRow = columnLength;
|
|
}
|
|
while (++columnIndex < columnLength) {
|
|
cell = serialize(cells[columnIndex]);
|
|
if (alignDelimiters === true) {
|
|
size = stringLength(cell);
|
|
sizes[columnIndex] = size;
|
|
largest = longestCellByColumn[columnIndex];
|
|
if (largest === void 0 || size > largest) {
|
|
longestCellByColumn[columnIndex] = size;
|
|
}
|
|
}
|
|
row.push(cell);
|
|
}
|
|
cellMatrix[rowIndex] = row;
|
|
sizeMatrix[rowIndex] = sizes;
|
|
}
|
|
columnIndex = -1;
|
|
columnLength = mostCellsPerRow;
|
|
if (typeof align === "object" && "length" in align) {
|
|
while (++columnIndex < columnLength) {
|
|
alignments[columnIndex] = toAlignment(align[columnIndex]);
|
|
}
|
|
} else {
|
|
code = toAlignment(align);
|
|
while (++columnIndex < columnLength) {
|
|
alignments[columnIndex] = code;
|
|
}
|
|
}
|
|
columnIndex = -1;
|
|
columnLength = mostCellsPerRow;
|
|
row = [];
|
|
sizes = [];
|
|
while (++columnIndex < columnLength) {
|
|
code = alignments[columnIndex];
|
|
before = "";
|
|
after = "";
|
|
if (code === l) {
|
|
before = colon;
|
|
} else if (code === r) {
|
|
after = colon;
|
|
} else if (code === c) {
|
|
before = colon;
|
|
after = colon;
|
|
}
|
|
size = alignDelimiters ? Math.max(1, longestCellByColumn[columnIndex] - before.length - after.length) : 1;
|
|
cell = before + repeat(dash, size) + after;
|
|
if (alignDelimiters === true) {
|
|
size = before.length + size + after.length;
|
|
if (size > longestCellByColumn[columnIndex]) {
|
|
longestCellByColumn[columnIndex] = size;
|
|
}
|
|
sizes[columnIndex] = size;
|
|
}
|
|
row[columnIndex] = cell;
|
|
}
|
|
cellMatrix.splice(1, 0, row);
|
|
sizeMatrix.splice(1, 0, sizes);
|
|
rowIndex = -1;
|
|
rowLength = cellMatrix.length;
|
|
lines = [];
|
|
while (++rowIndex < rowLength) {
|
|
row = cellMatrix[rowIndex];
|
|
sizes = sizeMatrix[rowIndex];
|
|
columnIndex = -1;
|
|
columnLength = mostCellsPerRow;
|
|
line = [];
|
|
while (++columnIndex < columnLength) {
|
|
cell = row[columnIndex] || "";
|
|
before = "";
|
|
after = "";
|
|
if (alignDelimiters === true) {
|
|
size = longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0);
|
|
code = alignments[columnIndex];
|
|
if (code === r) {
|
|
before = repeat(space, size);
|
|
} else if (code === c) {
|
|
if (size % 2 === 0) {
|
|
before = repeat(space, size / 2);
|
|
after = before;
|
|
} else {
|
|
before = repeat(space, size / 2 + 0.5);
|
|
after = repeat(space, size / 2 - 0.5);
|
|
}
|
|
} else {
|
|
after = repeat(space, size);
|
|
}
|
|
}
|
|
if (start === true && columnIndex === 0) {
|
|
line.push(verticalBar);
|
|
}
|
|
if (padding === true && !(alignDelimiters === false && cell === "") && (start === true || columnIndex !== 0)) {
|
|
line.push(space);
|
|
}
|
|
if (alignDelimiters === true) {
|
|
line.push(before);
|
|
}
|
|
line.push(cell);
|
|
if (alignDelimiters === true) {
|
|
line.push(after);
|
|
}
|
|
if (padding === true) {
|
|
line.push(space);
|
|
}
|
|
if (end === true || columnIndex !== columnLength - 1) {
|
|
line.push(verticalBar);
|
|
}
|
|
}
|
|
line = line.join("");
|
|
if (end === false) {
|
|
line = line.replace(trailingWhitespace, "");
|
|
}
|
|
lines.push(line);
|
|
}
|
|
return lines.join(lineFeed);
|
|
}
|
|
function serialize(value) {
|
|
return value === null || value === void 0 ? "" : String(value);
|
|
}
|
|
function defaultStringLength(value) {
|
|
return value.length;
|
|
}
|
|
function toAlignment(value) {
|
|
var code = typeof value === "string" ? value.charCodeAt(0) : x;
|
|
return code === L || code === l ? l : code === R || code === r ? r : code === C || code === c ? c : x;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-table/to-markdown.js
|
|
var require_to_markdown3 = __commonJS({
|
|
"node_modules/mdast-util-gfm-table/to-markdown.js"(exports, module2) {
|
|
var phrasing = require_container_phrasing();
|
|
var defaultInlineCode = require_inline_code();
|
|
var markdownTable = require_markdown_table();
|
|
module2.exports = toMarkdown;
|
|
function toMarkdown(options) {
|
|
var settings = options || {};
|
|
var padding = settings.tableCellPadding;
|
|
var alignDelimiters = settings.tablePipeAlign;
|
|
var stringLength = settings.stringLength;
|
|
var around = padding ? " " : "|";
|
|
return {
|
|
unsafe: [
|
|
{ character: "\r", inConstruct: "tableCell" },
|
|
{ character: "\n", inConstruct: "tableCell" },
|
|
{ atBreak: true, character: "|", after: "[ :-]" },
|
|
{ character: "|", inConstruct: "tableCell" },
|
|
{ atBreak: true, character: ":", after: "-" },
|
|
{ atBreak: true, character: "-", after: "[:|-]" }
|
|
],
|
|
handlers: {
|
|
table: handleTable,
|
|
tableRow: handleTableRow,
|
|
tableCell: handleTableCell,
|
|
inlineCode: inlineCodeWithTable
|
|
}
|
|
};
|
|
function handleTable(node, _, context) {
|
|
return serializeData(handleTableAsData(node, context), node.align);
|
|
}
|
|
function handleTableRow(node, _, context) {
|
|
var row = handleTableRowAsData(node, context);
|
|
var value = serializeData([row]);
|
|
return value.slice(0, value.indexOf("\n"));
|
|
}
|
|
function handleTableCell(node, _, context) {
|
|
var exit = context.enter("tableCell");
|
|
var value = phrasing(node, context, { before: around, after: around });
|
|
exit();
|
|
return value;
|
|
}
|
|
function serializeData(matrix, align) {
|
|
return markdownTable(matrix, {
|
|
align,
|
|
alignDelimiters,
|
|
padding,
|
|
stringLength
|
|
});
|
|
}
|
|
function handleTableAsData(node, context) {
|
|
var children = node.children;
|
|
var index = -1;
|
|
var length = children.length;
|
|
var result = [];
|
|
var subexit = context.enter("table");
|
|
while (++index < length) {
|
|
result[index] = handleTableRowAsData(children[index], context);
|
|
}
|
|
subexit();
|
|
return result;
|
|
}
|
|
function handleTableRowAsData(node, context) {
|
|
var children = node.children;
|
|
var index = -1;
|
|
var length = children.length;
|
|
var result = [];
|
|
var subexit = context.enter("tableRow");
|
|
while (++index < length) {
|
|
result[index] = handleTableCell(children[index], node, context);
|
|
}
|
|
subexit();
|
|
return result;
|
|
}
|
|
function inlineCodeWithTable(node, parent, context) {
|
|
var value = defaultInlineCode(node, parent, context);
|
|
if (context.stack.indexOf("tableCell") !== -1) {
|
|
value = value.replace(/\|/g, "\\$&");
|
|
}
|
|
return value;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
|
var require_check_bullet = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/check-bullet.js"(exports, module2) {
|
|
module2.exports = checkBullet;
|
|
function checkBullet(context) {
|
|
var marker = context.options.bullet || "*";
|
|
if (marker !== "*" && marker !== "+" && marker !== "-") {
|
|
throw new Error("Cannot serialize items with `" + marker + "` for `options.bullet`, expected `*`, `+`, or `-`");
|
|
}
|
|
return marker;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
|
var require_check_list_item_indent = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js"(exports, module2) {
|
|
module2.exports = checkListItemIndent;
|
|
function checkListItemIndent(context) {
|
|
var style = context.options.listItemIndent || "tab";
|
|
if (style === 1 || style === "1") {
|
|
return "one";
|
|
}
|
|
if (style !== "tab" && style !== "one" && style !== "mixed") {
|
|
throw new Error("Cannot serialize items with `" + style + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");
|
|
}
|
|
return style;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/container-flow.js
|
|
var require_container_flow = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/container-flow.js"(exports, module2) {
|
|
module2.exports = flow;
|
|
var repeat = require_repeat_string();
|
|
function flow(parent, context) {
|
|
var children = parent.children || [];
|
|
var results = [];
|
|
var index = -1;
|
|
var child;
|
|
while (++index < children.length) {
|
|
child = children[index];
|
|
results.push(context.handle(child, parent, context, { before: "\n", after: "\n" }));
|
|
if (index + 1 < children.length) {
|
|
results.push(between(child, children[index + 1]));
|
|
}
|
|
}
|
|
return results.join("");
|
|
function between(left, right) {
|
|
var index2 = -1;
|
|
var result;
|
|
while (++index2 < context.join.length) {
|
|
result = context.join[index2](left, right, parent, context);
|
|
if (result === true || result === 1) {
|
|
break;
|
|
}
|
|
if (typeof result === "number") {
|
|
return repeat("\n", 1 + Number(result));
|
|
}
|
|
if (result === false) {
|
|
return "\n\n<!---->\n\n";
|
|
}
|
|
}
|
|
return "\n\n";
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
|
|
var require_indent_lines = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/indent-lines.js"(exports, module2) {
|
|
module2.exports = indentLines;
|
|
var eol = /\r?\n|\r/g;
|
|
function indentLines(value, map2) {
|
|
var result = [];
|
|
var start = 0;
|
|
var line = 0;
|
|
var match;
|
|
while (match = eol.exec(value)) {
|
|
one(value.slice(start, match.index));
|
|
result.push(match[0]);
|
|
start = match.index + match[0].length;
|
|
line++;
|
|
}
|
|
one(value.slice(start));
|
|
return result.join("");
|
|
function one(value2) {
|
|
result.push(map2(value2, line, !value2));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/handle/list-item.js
|
|
var require_list_item = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/handle/list-item.js"(exports, module2) {
|
|
module2.exports = listItem;
|
|
var repeat = require_repeat_string();
|
|
var checkBullet = require_check_bullet();
|
|
var checkListItemIndent = require_check_list_item_indent();
|
|
var flow = require_container_flow();
|
|
var indentLines = require_indent_lines();
|
|
function listItem(node, parent, context) {
|
|
var bullet = checkBullet(context);
|
|
var listItemIndent = checkListItemIndent(context);
|
|
var size;
|
|
var value;
|
|
var exit;
|
|
if (parent && parent.ordered) {
|
|
bullet = (parent.start > -1 ? parent.start : 1) + (context.options.incrementListMarker === false ? 0 : parent.children.indexOf(node)) + ".";
|
|
}
|
|
size = bullet.length + 1;
|
|
if (listItemIndent === "tab" || listItemIndent === "mixed" && (parent && parent.spread || node.spread)) {
|
|
size = Math.ceil(size / 4) * 4;
|
|
}
|
|
exit = context.enter("listItem");
|
|
value = indentLines(flow(node, context), map2);
|
|
exit();
|
|
return value;
|
|
function map2(line, index, blank) {
|
|
if (index) {
|
|
return (blank ? "" : repeat(" ", size)) + line;
|
|
}
|
|
return (blank ? bullet : bullet + repeat(" ", size - bullet.length)) + line;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm-task-list-item/to-markdown.js
|
|
var require_to_markdown4 = __commonJS({
|
|
"node_modules/mdast-util-gfm-task-list-item/to-markdown.js"(exports) {
|
|
var defaultListItem = require_list_item();
|
|
exports.unsafe = [{ atBreak: true, character: "-", after: "[:|-]" }];
|
|
exports.handlers = {
|
|
listItem: listItemWithTaskListItem
|
|
};
|
|
function listItemWithTaskListItem(node, parent, context) {
|
|
var value = defaultListItem(node, parent, context);
|
|
var head = node.children[0];
|
|
if (typeof node.checked === "boolean" && head && head.type === "paragraph") {
|
|
value = value.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, check);
|
|
}
|
|
return value;
|
|
function check($0) {
|
|
return $0 + "[" + (node.checked ? "x" : " ") + "] ";
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/configure.js
|
|
var require_configure = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/configure.js"(exports, module2) {
|
|
module2.exports = configure;
|
|
function configure(base, extension) {
|
|
var index = -1;
|
|
var key;
|
|
if (extension.extensions) {
|
|
while (++index < extension.extensions.length) {
|
|
configure(base, extension.extensions[index]);
|
|
}
|
|
}
|
|
for (key in extension) {
|
|
if (key === "extensions") {
|
|
} else if (key === "unsafe" || key === "join") {
|
|
base[key] = base[key].concat(extension[key] || []);
|
|
} else if (key === "handlers") {
|
|
base[key] = Object.assign(base[key], extension[key] || {});
|
|
} else {
|
|
base.options[key] = extension[key];
|
|
}
|
|
}
|
|
return base;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-gfm/to-markdown.js
|
|
var require_to_markdown5 = __commonJS({
|
|
"node_modules/mdast-util-gfm/to-markdown.js"(exports, module2) {
|
|
var autolinkLiteral = require_to_markdown();
|
|
var strikethrough = require_to_markdown2();
|
|
var table = require_to_markdown3();
|
|
var taskListItem = require_to_markdown4();
|
|
var configure = require_configure();
|
|
module2.exports = toMarkdown;
|
|
function toMarkdown(options) {
|
|
var config = configure({ handlers: {}, join: [], unsafe: [], options: {} }, {
|
|
extensions: [autolinkLiteral, strikethrough, table(options), taskListItem]
|
|
});
|
|
return Object.assign(config.options, {
|
|
handlers: config.handlers,
|
|
join: config.join,
|
|
unsafe: config.unsafe
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/remark-gfm/index.js
|
|
var require_remark_gfm = __commonJS({
|
|
"node_modules/remark-gfm/index.js"(exports, module2) {
|
|
"use strict";
|
|
var syntax = require_micromark_extension_gfm();
|
|
var fromMarkdown = require_from_markdown5();
|
|
var toMarkdown = require_to_markdown5();
|
|
var warningIssued;
|
|
module2.exports = gfm;
|
|
function gfm(options) {
|
|
var data = this.data();
|
|
if (!warningIssued && (this.Parser && this.Parser.prototype && this.Parser.prototype.blockTokenizers || this.Compiler && this.Compiler.prototype && this.Compiler.prototype.visitors)) {
|
|
warningIssued = true;
|
|
console.warn("[remark-gfm] Warning: please upgrade to remark 13 to use this plugin");
|
|
}
|
|
add("micromarkExtensions", syntax(options));
|
|
add("fromMarkdownExtensions", fromMarkdown);
|
|
add("toMarkdownExtensions", toMarkdown(options));
|
|
function add(field, value) {
|
|
if (data[field])
|
|
data[field].push(value);
|
|
else
|
|
data[field] = [value];
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-math/lib/tokenize-math-flow.js
|
|
var require_tokenize_math_flow = __commonJS({
|
|
"node_modules/micromark-extension-math/lib/tokenize-math-flow.js"(exports) {
|
|
"use strict";
|
|
exports.tokenize = tokenizeMathFenced;
|
|
exports.concrete = true;
|
|
var prefixSize = require_prefix_size();
|
|
var createSpace = require_factory_space();
|
|
function tokenizeMathFenced(effects, ok, nok) {
|
|
var self = this;
|
|
var initialPrefix = prefixSize(this.events, "linePrefix");
|
|
var sizeOpen = 0;
|
|
return start;
|
|
function start(code) {
|
|
if (code !== 36)
|
|
throw new Error("expected `$`");
|
|
effects.enter("mathFlow");
|
|
effects.enter("mathFlowFence");
|
|
effects.enter("mathFlowFenceSequence");
|
|
return sequenceOpen(code);
|
|
}
|
|
function sequenceOpen(code) {
|
|
if (code === 36) {
|
|
effects.consume(code);
|
|
sizeOpen++;
|
|
return sequenceOpen;
|
|
}
|
|
effects.exit("mathFlowFenceSequence");
|
|
return sizeOpen < 2 ? nok(code) : createSpace(effects, metaOpen, "whitespace")(code);
|
|
}
|
|
function metaOpen(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
return openAfter(code);
|
|
}
|
|
effects.enter("mathFlowFenceMeta");
|
|
effects.enter("chunkString", { contentType: "string" });
|
|
return meta(code);
|
|
}
|
|
function meta(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
effects.exit("chunkString");
|
|
effects.exit("mathFlowFenceMeta");
|
|
return openAfter(code);
|
|
}
|
|
if (code === 36)
|
|
return nok(code);
|
|
effects.consume(code);
|
|
return meta;
|
|
}
|
|
function openAfter(code) {
|
|
effects.exit("mathFlowFence");
|
|
return self.interrupt ? ok(code) : content(code);
|
|
}
|
|
function content(code) {
|
|
if (code === null) {
|
|
return after(code);
|
|
}
|
|
if (code === -5 || code === -4 || code === -3) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return effects.attempt({ tokenize: tokenizeClosingFence, partial: true }, after, initialPrefix ? createSpace(effects, content, "linePrefix", initialPrefix + 1) : content);
|
|
}
|
|
effects.enter("mathFlowValue");
|
|
return contentContinue(code);
|
|
}
|
|
function contentContinue(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
effects.exit("mathFlowValue");
|
|
return content(code);
|
|
}
|
|
effects.consume(code);
|
|
return contentContinue;
|
|
}
|
|
function after(code) {
|
|
effects.exit("mathFlow");
|
|
return ok(code);
|
|
}
|
|
function tokenizeClosingFence(effects2, ok2, nok2) {
|
|
var size = 0;
|
|
return createSpace(effects2, closingPrefixAfter, "linePrefix", 4);
|
|
function closingPrefixAfter(code) {
|
|
effects2.enter("mathFlowFence");
|
|
effects2.enter("mathFlowFenceSequence");
|
|
return closingSequence(code);
|
|
}
|
|
function closingSequence(code) {
|
|
if (code === 36) {
|
|
effects2.consume(code);
|
|
size++;
|
|
return closingSequence;
|
|
}
|
|
if (size < sizeOpen)
|
|
return nok2(code);
|
|
effects2.exit("mathFlowFenceSequence");
|
|
return createSpace(effects2, closingSequenceEnd, "whitespace")(code);
|
|
}
|
|
function closingSequenceEnd(code) {
|
|
if (code === null || code === -5 || code === -4 || code === -3) {
|
|
effects2.exit("mathFlowFence");
|
|
return ok2(code);
|
|
}
|
|
return nok2(code);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-math/lib/tokenize-math-text.js
|
|
var require_tokenize_math_text = __commonJS({
|
|
"node_modules/micromark-extension-math/lib/tokenize-math-text.js"(exports) {
|
|
"use strict";
|
|
exports.tokenize = tokenizeMathText;
|
|
exports.resolve = resolveMathText;
|
|
exports.previous = previous;
|
|
function resolveMathText(events) {
|
|
var tailExitIndex = events.length - 4;
|
|
var headEnterIndex = 3;
|
|
var index;
|
|
var enter;
|
|
if ((events[headEnterIndex][1].type === "lineEnding" || events[headEnterIndex][1].type === "space") && (events[tailExitIndex][1].type === "lineEnding" || events[tailExitIndex][1].type === "space")) {
|
|
index = headEnterIndex;
|
|
while (++index < tailExitIndex) {
|
|
if (events[index][1].type === "mathTextData") {
|
|
events[tailExitIndex][1].type = "mathTextPadding";
|
|
events[headEnterIndex][1].type = "mathTextPadding";
|
|
headEnterIndex += 2;
|
|
tailExitIndex -= 2;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
index = headEnterIndex - 1;
|
|
tailExitIndex++;
|
|
while (++index <= tailExitIndex) {
|
|
if (enter === void 0) {
|
|
if (index !== tailExitIndex && events[index][1].type !== "lineEnding") {
|
|
enter = index;
|
|
}
|
|
} else if (index === tailExitIndex || events[index][1].type === "lineEnding") {
|
|
events[enter][1].type = "mathTextData";
|
|
if (index !== enter + 2) {
|
|
events[enter][1].end = events[index - 1][1].end;
|
|
events.splice(enter + 2, index - enter - 2);
|
|
tailExitIndex -= index - enter - 2;
|
|
index = enter + 2;
|
|
}
|
|
enter = void 0;
|
|
}
|
|
}
|
|
return events;
|
|
}
|
|
function previous(code) {
|
|
return code !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
|
|
}
|
|
function tokenizeMathText(effects, ok, nok) {
|
|
var self = this;
|
|
var sizeOpen = 0;
|
|
var size;
|
|
var token;
|
|
return start;
|
|
function start(code) {
|
|
if (code !== 36)
|
|
throw new Error("expected `$`");
|
|
if (!previous.call(self, self.previous)) {
|
|
throw new Error("expected correct previous");
|
|
}
|
|
effects.enter("mathText");
|
|
effects.enter("mathTextSequence");
|
|
return openingSequence(code);
|
|
}
|
|
function openingSequence(code) {
|
|
if (code === 36) {
|
|
effects.consume(code);
|
|
sizeOpen++;
|
|
return openingSequence;
|
|
}
|
|
effects.exit("mathTextSequence");
|
|
return gap(code);
|
|
}
|
|
function gap(code) {
|
|
if (code === null) {
|
|
return nok(code);
|
|
}
|
|
if (code === 36) {
|
|
token = effects.enter("mathTextSequence");
|
|
size = 0;
|
|
return closingSequence(code);
|
|
}
|
|
if (code === 32) {
|
|
effects.enter("space");
|
|
effects.consume(code);
|
|
effects.exit("space");
|
|
return gap;
|
|
}
|
|
if (code === -5 || code === -4 || code === -3) {
|
|
effects.enter("lineEnding");
|
|
effects.consume(code);
|
|
effects.exit("lineEnding");
|
|
return gap;
|
|
}
|
|
effects.enter("mathTextData");
|
|
return data(code);
|
|
}
|
|
function data(code) {
|
|
if (code === null || code === 32 || code === 36 || code === -5 || code === -4 || code === -3) {
|
|
effects.exit("mathTextData");
|
|
return gap(code);
|
|
}
|
|
effects.consume(code);
|
|
return data;
|
|
}
|
|
function closingSequence(code) {
|
|
if (code === 36) {
|
|
effects.consume(code);
|
|
size++;
|
|
return closingSequence;
|
|
}
|
|
if (size === sizeOpen) {
|
|
effects.exit("mathTextSequence");
|
|
effects.exit("mathText");
|
|
return ok(code);
|
|
}
|
|
token.type = "mathTextData";
|
|
return data(code);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-math/lib/syntax.js
|
|
var require_syntax5 = __commonJS({
|
|
"node_modules/micromark-extension-math/lib/syntax.js"(exports) {
|
|
"use strict";
|
|
exports.flow = { 36: require_tokenize_math_flow() };
|
|
exports.text = { 36: require_tokenize_math_text() };
|
|
}
|
|
});
|
|
|
|
// node_modules/micromark-extension-math/index.js
|
|
var require_micromark_extension_math = __commonJS({
|
|
"node_modules/micromark-extension-math/index.js"(exports, module2) {
|
|
module2.exports = require_syntax5();
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-math/from-markdown.js
|
|
var require_from_markdown6 = __commonJS({
|
|
"node_modules/mdast-util-math/from-markdown.js"(exports) {
|
|
"use strict";
|
|
exports.enter = {
|
|
mathFlow: enterMathFlow,
|
|
mathFlowFenceMeta: enterMathFlowMeta,
|
|
mathText: enterMathText
|
|
};
|
|
exports.exit = {
|
|
mathFlow: exitMathFlow,
|
|
mathFlowFence: exitMathFlowFence,
|
|
mathFlowFenceMeta: exitMathFlowMeta,
|
|
mathFlowValue: exitMathData,
|
|
mathText: exitMathText,
|
|
mathTextData: exitMathData
|
|
};
|
|
function enterMathFlow(token) {
|
|
this.enter({
|
|
type: "math",
|
|
meta: null,
|
|
value: "",
|
|
data: {
|
|
hName: "div",
|
|
hProperties: { className: ["math", "math-display"] },
|
|
hChildren: [{ type: "text", value: "" }]
|
|
}
|
|
}, token);
|
|
}
|
|
function enterMathFlowMeta() {
|
|
this.buffer();
|
|
}
|
|
function exitMathFlowMeta() {
|
|
var data = this.resume();
|
|
this.stack[this.stack.length - 1].meta = data;
|
|
}
|
|
function exitMathFlowFence() {
|
|
if (this.getData("mathFlowInside"))
|
|
return;
|
|
this.buffer();
|
|
this.setData("mathFlowInside", true);
|
|
}
|
|
function exitMathFlow(token) {
|
|
var data = this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
|
|
var node = this.exit(token);
|
|
node.value = data;
|
|
node.data.hChildren[0].value = data;
|
|
this.setData("mathFlowInside");
|
|
}
|
|
function enterMathText(token) {
|
|
this.enter({
|
|
type: "inlineMath",
|
|
value: "",
|
|
data: {
|
|
hName: "span",
|
|
hProperties: { className: ["math", "math-inline"] },
|
|
hChildren: [{ type: "text", value: "" }]
|
|
}
|
|
}, token);
|
|
this.buffer();
|
|
}
|
|
function exitMathText(token) {
|
|
var data = this.resume();
|
|
var node = this.exit(token);
|
|
node.value = data;
|
|
node.data.hChildren[0].value = data;
|
|
}
|
|
function exitMathData(token) {
|
|
this.config.enter.data.call(this, token);
|
|
this.config.exit.data.call(this, token);
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/longest-streak/index.js
|
|
var require_longest_streak = __commonJS({
|
|
"node_modules/longest-streak/index.js"(exports, module2) {
|
|
"use strict";
|
|
module2.exports = longestStreak;
|
|
function longestStreak(value, character) {
|
|
var count = 0;
|
|
var maximum = 0;
|
|
var expected;
|
|
var index;
|
|
if (typeof character !== "string" || character.length !== 1) {
|
|
throw new Error("Expected character");
|
|
}
|
|
value = String(value);
|
|
index = value.indexOf(character);
|
|
expected = index;
|
|
while (index !== -1) {
|
|
count++;
|
|
if (index === expected) {
|
|
if (count > maximum) {
|
|
maximum = count;
|
|
}
|
|
} else {
|
|
count = 1;
|
|
}
|
|
expected = index + 1;
|
|
index = value.indexOf(character, expected);
|
|
}
|
|
return maximum;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
|
var require_pattern_in_scope = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js"(exports, module2) {
|
|
module2.exports = patternInScope;
|
|
function patternInScope(stack, pattern) {
|
|
return listInScope(stack, pattern.inConstruct, true) && !listInScope(stack, pattern.notInConstruct);
|
|
}
|
|
function listInScope(stack, list, none) {
|
|
var index;
|
|
if (!list) {
|
|
return none;
|
|
}
|
|
if (typeof list === "string") {
|
|
list = [list];
|
|
}
|
|
index = -1;
|
|
while (++index < list.length) {
|
|
if (stack.indexOf(list[index]) !== -1) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-to-markdown/lib/util/safe.js
|
|
var require_safe = __commonJS({
|
|
"node_modules/mdast-util-to-markdown/lib/util/safe.js"(exports, module2) {
|
|
module2.exports = safe;
|
|
var patternCompile = require_pattern_compile();
|
|
var patternInScope = require_pattern_in_scope();
|
|
function safe(context, input, config) {
|
|
var value = (config.before || "") + (input || "") + (config.after || "");
|
|
var positions = [];
|
|
var result = [];
|
|
var infos = {};
|
|
var index = -1;
|
|
var before;
|
|
var after;
|
|
var position;
|
|
var pattern;
|
|
var expression;
|
|
var match;
|
|
var start;
|
|
var end;
|
|
while (++index < context.unsafe.length) {
|
|
pattern = context.unsafe[index];
|
|
if (!patternInScope(context.stack, pattern)) {
|
|
continue;
|
|
}
|
|
expression = patternCompile(pattern);
|
|
while (match = expression.exec(value)) {
|
|
before = "before" in pattern || pattern.atBreak;
|
|
after = "after" in pattern;
|
|
position = match.index + (before ? match[1].length : 0);
|
|
if (positions.indexOf(position) === -1) {
|
|
positions.push(position);
|
|
infos[position] = { before, after };
|
|
} else {
|
|
if (infos[position].before && !before) {
|
|
infos[position].before = false;
|
|
}
|
|
if (infos[position].after && !after) {
|
|
infos[position].after = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
positions.sort(numerical);
|
|
start = config.before ? config.before.length : 0;
|
|
end = value.length - (config.after ? config.after.length : 0);
|
|
index = -1;
|
|
while (++index < positions.length) {
|
|
position = positions[index];
|
|
if (position < start || position >= end) {
|
|
continue;
|
|
}
|
|
if (position + 1 < end && positions[index + 1] === position + 1 && infos[position].after && !infos[position + 1].before && !infos[position + 1].after) {
|
|
continue;
|
|
}
|
|
if (start !== position) {
|
|
result.push(escapeBackslashes(value.slice(start, position), "\\"));
|
|
}
|
|
start = position;
|
|
if (/[!-/:-@[-`{-~]/.test(value.charAt(position)) && (!config.encode || config.encode.indexOf(value.charAt(position)) === -1)) {
|
|
result.push("\\");
|
|
} else {
|
|
result.push("&#x" + value.charCodeAt(position).toString(16).toUpperCase() + ";");
|
|
start++;
|
|
}
|
|
}
|
|
result.push(escapeBackslashes(value.slice(start, end), config.after));
|
|
return result.join("");
|
|
}
|
|
function numerical(a, b) {
|
|
return a - b;
|
|
}
|
|
function escapeBackslashes(value, after) {
|
|
var expression = /\\(?=[!-/:-@[-`{-~])/g;
|
|
var positions = [];
|
|
var results = [];
|
|
var index = -1;
|
|
var start = 0;
|
|
var whole = value + after;
|
|
var match;
|
|
while (match = expression.exec(whole)) {
|
|
positions.push(match.index);
|
|
}
|
|
while (++index < positions.length) {
|
|
if (start !== positions[index]) {
|
|
results.push(value.slice(start, positions[index]));
|
|
}
|
|
results.push("\\");
|
|
start = positions[index];
|
|
}
|
|
results.push(value.slice(start));
|
|
return results.join("");
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/mdast-util-math/to-markdown.js
|
|
var require_to_markdown6 = __commonJS({
|
|
"node_modules/mdast-util-math/to-markdown.js"(exports) {
|
|
"use strict";
|
|
exports.unsafe = [
|
|
{ character: "\r", inConstruct: ["mathFlowMeta"] },
|
|
{ character: "\r", inConstruct: ["mathFlowMeta"] },
|
|
{ character: "$", inConstruct: ["mathFlowMeta", "phrasing"] },
|
|
{ atBreak: true, character: "$", after: "\\$" }
|
|
];
|
|
exports.handlers = { math, inlineMath };
|
|
inlineMath.peek = inlineMathPeek;
|
|
var repeat = require_repeat_string();
|
|
var streak = require_longest_streak();
|
|
var safe = require_safe();
|
|
function math(node, _, context) {
|
|
var raw = node.value || "";
|
|
var fence = repeat("$", Math.max(streak(raw, "$") + 1, 2));
|
|
var exit = context.enter("mathFlow");
|
|
var value = fence;
|
|
var subexit;
|
|
if (node.meta) {
|
|
subexit = context.enter("mathFlowMeta");
|
|
value += safe(context, node.meta, { before: "$", after: " ", encode: ["$"] });
|
|
subexit();
|
|
}
|
|
value += "\n";
|
|
if (raw) {
|
|
value += raw + "\n";
|
|
}
|
|
value += fence;
|
|
exit();
|
|
return value;
|
|
}
|
|
function inlineMath(node) {
|
|
var value = node.value || "";
|
|
var size = 1;
|
|
var pad = "";
|
|
var sequence;
|
|
while (new RegExp("(^|[^$])" + repeat("\\$", size) + "([^$]|$)").test(value)) {
|
|
size++;
|
|
}
|
|
if (/[^ \r\n]/.test(value) && (/[ \r\n$]/.test(value.charAt(0)) || /[ \r\n$]/.test(value.charAt(value.length - 1)))) {
|
|
pad = " ";
|
|
}
|
|
sequence = repeat("$", size);
|
|
return sequence + pad + value + pad + sequence;
|
|
}
|
|
function inlineMathPeek() {
|
|
return "$";
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/remark-math/index.js
|
|
var require_remark_math = __commonJS({
|
|
"node_modules/remark-math/index.js"(exports, module2) {
|
|
"use strict";
|
|
var syntax = require_micromark_extension_math();
|
|
var fromMarkdown = require_from_markdown6();
|
|
var toMarkdown = require_to_markdown6();
|
|
var warningIssued;
|
|
module2.exports = math;
|
|
function math() {
|
|
var data = this.data();
|
|
if (!warningIssued && (this.Parser && this.Parser.prototype && this.Parser.prototype.blockTokenizers || this.Compiler && this.Compiler.prototype && this.Compiler.prototype.visitors)) {
|
|
warningIssued = true;
|
|
console.warn("[remark-math] Warning: please upgrade to remark 13 to use this plugin");
|
|
}
|
|
add("micromarkExtensions", syntax);
|
|
add("fromMarkdownExtensions", fromMarkdown);
|
|
add("toMarkdownExtensions", toMarkdown);
|
|
function add(field, value) {
|
|
if (data[field])
|
|
data[field].push(value);
|
|
else
|
|
data[field] = [value];
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/@tryfabric/martian/build/src/index.js
|
|
var require_src = __commonJS({
|
|
"node_modules/@tryfabric/martian/build/src/index.js"(exports) {
|
|
"use strict";
|
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.markdownToRichText = exports.markdownToBlocks = void 0;
|
|
var unified_1 = __importDefault(require_unified());
|
|
var remark_parse_1 = __importDefault(require_remark_parse());
|
|
var internal_1 = require_internal();
|
|
var remark_gfm_1 = __importDefault(require_remark_gfm());
|
|
var remark_math_1 = __importDefault(require_remark_math());
|
|
function markdownToBlocks2(body, options) {
|
|
const root = (0, unified_1.default)().use(remark_parse_1.default).use(remark_gfm_1.default).use(remark_math_1.default).parse(body);
|
|
return (0, internal_1.parseBlocks)(root, options);
|
|
}
|
|
exports.markdownToBlocks = markdownToBlocks2;
|
|
function markdownToRichText(text, options) {
|
|
const root = (0, unified_1.default)().use(remark_parse_1.default).use(remark_gfm_1.default).parse(text);
|
|
return (0, internal_1.parseRichText)(root, options);
|
|
}
|
|
exports.markdownToRichText = markdownToRichText;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/common.js
|
|
var require_common2 = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/common.js"(exports, module2) {
|
|
"use strict";
|
|
function isNothing(subject) {
|
|
return typeof subject === "undefined" || subject === null;
|
|
}
|
|
function isObject(subject) {
|
|
return typeof subject === "object" && subject !== null;
|
|
}
|
|
function toArray(sequence) {
|
|
if (Array.isArray(sequence))
|
|
return sequence;
|
|
else if (isNothing(sequence))
|
|
return [];
|
|
return [sequence];
|
|
}
|
|
function extend(target, source) {
|
|
var index, length, key, sourceKeys;
|
|
if (source) {
|
|
sourceKeys = Object.keys(source);
|
|
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
key = sourceKeys[index];
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
return target;
|
|
}
|
|
function repeat(string2, count) {
|
|
var result = "", cycle;
|
|
for (cycle = 0; cycle < count; cycle += 1) {
|
|
result += string2;
|
|
}
|
|
return result;
|
|
}
|
|
function isNegativeZero(number) {
|
|
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
}
|
|
module2.exports.isNothing = isNothing;
|
|
module2.exports.isObject = isObject;
|
|
module2.exports.toArray = toArray;
|
|
module2.exports.repeat = repeat;
|
|
module2.exports.isNegativeZero = isNegativeZero;
|
|
module2.exports.extend = extend;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/exception.js
|
|
var require_exception = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/exception.js"(exports, module2) {
|
|
"use strict";
|
|
function YAMLException(reason, mark) {
|
|
Error.call(this);
|
|
this.name = "YAMLException";
|
|
this.reason = reason;
|
|
this.mark = mark;
|
|
this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : "");
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, this.constructor);
|
|
} else {
|
|
this.stack = new Error().stack || "";
|
|
}
|
|
}
|
|
YAMLException.prototype = Object.create(Error.prototype);
|
|
YAMLException.prototype.constructor = YAMLException;
|
|
YAMLException.prototype.toString = function toString(compact) {
|
|
var result = this.name + ": ";
|
|
result += this.reason || "(unknown reason)";
|
|
if (!compact && this.mark) {
|
|
result += " " + this.mark.toString();
|
|
}
|
|
return result;
|
|
};
|
|
module2.exports = YAMLException;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/mark.js
|
|
var require_mark = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/mark.js"(exports, module2) {
|
|
"use strict";
|
|
var common = require_common2();
|
|
function Mark(name, buffer, position, line, column) {
|
|
this.name = name;
|
|
this.buffer = buffer;
|
|
this.position = position;
|
|
this.line = line;
|
|
this.column = column;
|
|
}
|
|
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
var head, start, tail, end, snippet;
|
|
if (!this.buffer)
|
|
return null;
|
|
indent = indent || 4;
|
|
maxLength = maxLength || 75;
|
|
head = "";
|
|
start = this.position;
|
|
while (start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) {
|
|
start -= 1;
|
|
if (this.position - start > maxLength / 2 - 1) {
|
|
head = " ... ";
|
|
start += 5;
|
|
break;
|
|
}
|
|
}
|
|
tail = "";
|
|
end = this.position;
|
|
while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
|
|
end += 1;
|
|
if (end - this.position > maxLength / 2 - 1) {
|
|
tail = " ... ";
|
|
end -= 5;
|
|
break;
|
|
}
|
|
}
|
|
snippet = this.buffer.slice(start, end);
|
|
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start + head.length) + "^";
|
|
};
|
|
Mark.prototype.toString = function toString(compact) {
|
|
var snippet, where = "";
|
|
if (this.name) {
|
|
where += 'in "' + this.name + '" ';
|
|
}
|
|
where += "at line " + (this.line + 1) + ", column " + (this.column + 1);
|
|
if (!compact) {
|
|
snippet = this.getSnippet();
|
|
if (snippet) {
|
|
where += ":\n" + snippet;
|
|
}
|
|
}
|
|
return where;
|
|
};
|
|
module2.exports = Mark;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type.js
|
|
var require_type = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type.js"(exports, module2) {
|
|
"use strict";
|
|
var YAMLException = require_exception();
|
|
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
"kind",
|
|
"resolve",
|
|
"construct",
|
|
"instanceOf",
|
|
"predicate",
|
|
"represent",
|
|
"defaultStyle",
|
|
"styleAliases"
|
|
];
|
|
var YAML_NODE_KINDS = [
|
|
"scalar",
|
|
"sequence",
|
|
"mapping"
|
|
];
|
|
function compileStyleAliases(map2) {
|
|
var result = {};
|
|
if (map2 !== null) {
|
|
Object.keys(map2).forEach(function(style) {
|
|
map2[style].forEach(function(alias) {
|
|
result[String(alias)] = style;
|
|
});
|
|
});
|
|
}
|
|
return result;
|
|
}
|
|
function Type(tag, options) {
|
|
options = options || {};
|
|
Object.keys(options).forEach(function(name) {
|
|
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
}
|
|
});
|
|
this.tag = tag;
|
|
this.kind = options["kind"] || null;
|
|
this.resolve = options["resolve"] || function() {
|
|
return true;
|
|
};
|
|
this.construct = options["construct"] || function(data) {
|
|
return data;
|
|
};
|
|
this.instanceOf = options["instanceOf"] || null;
|
|
this.predicate = options["predicate"] || null;
|
|
this.represent = options["represent"] || null;
|
|
this.defaultStyle = options["defaultStyle"] || null;
|
|
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
}
|
|
}
|
|
module2.exports = Type;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/schema.js
|
|
var require_schema = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/schema.js"(exports, module2) {
|
|
"use strict";
|
|
var common = require_common2();
|
|
var YAMLException = require_exception();
|
|
var Type = require_type();
|
|
function compileList(schema4, name, result) {
|
|
var exclude = [];
|
|
schema4.include.forEach(function(includedSchema) {
|
|
result = compileList(includedSchema, name, result);
|
|
});
|
|
schema4[name].forEach(function(currentType) {
|
|
result.forEach(function(previousType, previousIndex) {
|
|
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
|
|
exclude.push(previousIndex);
|
|
}
|
|
});
|
|
result.push(currentType);
|
|
});
|
|
return result.filter(function(type, index) {
|
|
return exclude.indexOf(index) === -1;
|
|
});
|
|
}
|
|
function compileMap() {
|
|
var result = {
|
|
scalar: {},
|
|
sequence: {},
|
|
mapping: {},
|
|
fallback: {}
|
|
}, index, length;
|
|
function collectType(type) {
|
|
result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
}
|
|
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
arguments[index].forEach(collectType);
|
|
}
|
|
return result;
|
|
}
|
|
function Schema2(definition) {
|
|
this.include = definition.include || [];
|
|
this.implicit = definition.implicit || [];
|
|
this.explicit = definition.explicit || [];
|
|
this.implicit.forEach(function(type) {
|
|
if (type.loadKind && type.loadKind !== "scalar") {
|
|
throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
}
|
|
});
|
|
this.compiledImplicit = compileList(this, "implicit", []);
|
|
this.compiledExplicit = compileList(this, "explicit", []);
|
|
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
}
|
|
Schema2.DEFAULT = null;
|
|
Schema2.create = function createSchema() {
|
|
var schemas2, types;
|
|
switch (arguments.length) {
|
|
case 1:
|
|
schemas2 = Schema2.DEFAULT;
|
|
types = arguments[0];
|
|
break;
|
|
case 2:
|
|
schemas2 = arguments[0];
|
|
types = arguments[1];
|
|
break;
|
|
default:
|
|
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
|
}
|
|
schemas2 = common.toArray(schemas2);
|
|
types = common.toArray(types);
|
|
if (!schemas2.every(function(schema4) {
|
|
return schema4 instanceof Schema2;
|
|
})) {
|
|
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
}
|
|
if (!types.every(function(type) {
|
|
return type instanceof Type;
|
|
})) {
|
|
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
}
|
|
return new Schema2({
|
|
include: schemas2,
|
|
explicit: types
|
|
});
|
|
};
|
|
module2.exports = Schema2;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/str.js
|
|
var require_str = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/str.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
module2.exports = new Type("tag:yaml.org,2002:str", {
|
|
kind: "scalar",
|
|
construct: function(data) {
|
|
return data !== null ? data : "";
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/seq.js
|
|
var require_seq = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
|
kind: "sequence",
|
|
construct: function(data) {
|
|
return data !== null ? data : [];
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/map.js
|
|
var require_map = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/map.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
module2.exports = new Type("tag:yaml.org,2002:map", {
|
|
kind: "mapping",
|
|
construct: function(data) {
|
|
return data !== null ? data : {};
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
|
|
var require_failsafe = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports, module2) {
|
|
"use strict";
|
|
var Schema2 = require_schema();
|
|
module2.exports = new Schema2({
|
|
explicit: [
|
|
require_str(),
|
|
require_seq(),
|
|
require_map()
|
|
]
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/null.js
|
|
var require_null = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/null.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
function resolveYamlNull(data) {
|
|
if (data === null)
|
|
return true;
|
|
var max = data.length;
|
|
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
|
}
|
|
function constructYamlNull() {
|
|
return null;
|
|
}
|
|
function isNull(object) {
|
|
return object === null;
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:null", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlNull,
|
|
construct: constructYamlNull,
|
|
predicate: isNull,
|
|
represent: {
|
|
canonical: function() {
|
|
return "~";
|
|
},
|
|
lowercase: function() {
|
|
return "null";
|
|
},
|
|
uppercase: function() {
|
|
return "NULL";
|
|
},
|
|
camelcase: function() {
|
|
return "Null";
|
|
}
|
|
},
|
|
defaultStyle: "lowercase"
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/bool.js
|
|
var require_bool = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
function resolveYamlBoolean(data) {
|
|
if (data === null)
|
|
return false;
|
|
var max = data.length;
|
|
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
|
}
|
|
function constructYamlBoolean(data) {
|
|
return data === "true" || data === "True" || data === "TRUE";
|
|
}
|
|
function isBoolean(object) {
|
|
return Object.prototype.toString.call(object) === "[object Boolean]";
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:bool", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlBoolean,
|
|
construct: constructYamlBoolean,
|
|
predicate: isBoolean,
|
|
represent: {
|
|
lowercase: function(object) {
|
|
return object ? "true" : "false";
|
|
},
|
|
uppercase: function(object) {
|
|
return object ? "TRUE" : "FALSE";
|
|
},
|
|
camelcase: function(object) {
|
|
return object ? "True" : "False";
|
|
}
|
|
},
|
|
defaultStyle: "lowercase"
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/int.js
|
|
var require_int = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/int.js"(exports, module2) {
|
|
"use strict";
|
|
var common = require_common2();
|
|
var Type = require_type();
|
|
function isHexCode(c) {
|
|
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
|
|
}
|
|
function isOctCode(c) {
|
|
return 48 <= c && c <= 55;
|
|
}
|
|
function isDecCode(c) {
|
|
return 48 <= c && c <= 57;
|
|
}
|
|
function resolveYamlInteger(data) {
|
|
if (data === null)
|
|
return false;
|
|
var max = data.length, index = 0, hasDigits = false, ch;
|
|
if (!max)
|
|
return false;
|
|
ch = data[index];
|
|
if (ch === "-" || ch === "+") {
|
|
ch = data[++index];
|
|
}
|
|
if (ch === "0") {
|
|
if (index + 1 === max)
|
|
return true;
|
|
ch = data[++index];
|
|
if (ch === "b") {
|
|
index++;
|
|
for (; index < max; index++) {
|
|
ch = data[index];
|
|
if (ch === "_")
|
|
continue;
|
|
if (ch !== "0" && ch !== "1")
|
|
return false;
|
|
hasDigits = true;
|
|
}
|
|
return hasDigits && ch !== "_";
|
|
}
|
|
if (ch === "x") {
|
|
index++;
|
|
for (; index < max; index++) {
|
|
ch = data[index];
|
|
if (ch === "_")
|
|
continue;
|
|
if (!isHexCode(data.charCodeAt(index)))
|
|
return false;
|
|
hasDigits = true;
|
|
}
|
|
return hasDigits && ch !== "_";
|
|
}
|
|
for (; index < max; index++) {
|
|
ch = data[index];
|
|
if (ch === "_")
|
|
continue;
|
|
if (!isOctCode(data.charCodeAt(index)))
|
|
return false;
|
|
hasDigits = true;
|
|
}
|
|
return hasDigits && ch !== "_";
|
|
}
|
|
if (ch === "_")
|
|
return false;
|
|
for (; index < max; index++) {
|
|
ch = data[index];
|
|
if (ch === "_")
|
|
continue;
|
|
if (ch === ":")
|
|
break;
|
|
if (!isDecCode(data.charCodeAt(index))) {
|
|
return false;
|
|
}
|
|
hasDigits = true;
|
|
}
|
|
if (!hasDigits || ch === "_")
|
|
return false;
|
|
if (ch !== ":")
|
|
return true;
|
|
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
}
|
|
function constructYamlInteger(data) {
|
|
var value = data, sign = 1, ch, base, digits = [];
|
|
if (value.indexOf("_") !== -1) {
|
|
value = value.replace(/_/g, "");
|
|
}
|
|
ch = value[0];
|
|
if (ch === "-" || ch === "+") {
|
|
if (ch === "-")
|
|
sign = -1;
|
|
value = value.slice(1);
|
|
ch = value[0];
|
|
}
|
|
if (value === "0")
|
|
return 0;
|
|
if (ch === "0") {
|
|
if (value[1] === "b")
|
|
return sign * parseInt(value.slice(2), 2);
|
|
if (value[1] === "x")
|
|
return sign * parseInt(value, 16);
|
|
return sign * parseInt(value, 8);
|
|
}
|
|
if (value.indexOf(":") !== -1) {
|
|
value.split(":").forEach(function(v) {
|
|
digits.unshift(parseInt(v, 10));
|
|
});
|
|
value = 0;
|
|
base = 1;
|
|
digits.forEach(function(d) {
|
|
value += d * base;
|
|
base *= 60;
|
|
});
|
|
return sign * value;
|
|
}
|
|
return sign * parseInt(value, 10);
|
|
}
|
|
function isInteger(object) {
|
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:int", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlInteger,
|
|
construct: constructYamlInteger,
|
|
predicate: isInteger,
|
|
represent: {
|
|
binary: function(obj) {
|
|
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
},
|
|
octal: function(obj) {
|
|
return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1);
|
|
},
|
|
decimal: function(obj) {
|
|
return obj.toString(10);
|
|
},
|
|
hexadecimal: function(obj) {
|
|
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
}
|
|
},
|
|
defaultStyle: "decimal",
|
|
styleAliases: {
|
|
binary: [2, "bin"],
|
|
octal: [8, "oct"],
|
|
decimal: [10, "dec"],
|
|
hexadecimal: [16, "hex"]
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/float.js
|
|
var require_float = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/float.js"(exports, module2) {
|
|
"use strict";
|
|
var common = require_common2();
|
|
var Type = require_type();
|
|
var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
function resolveYamlFloat(data) {
|
|
if (data === null)
|
|
return false;
|
|
if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function constructYamlFloat(data) {
|
|
var value, sign, base, digits;
|
|
value = data.replace(/_/g, "").toLowerCase();
|
|
sign = value[0] === "-" ? -1 : 1;
|
|
digits = [];
|
|
if ("+-".indexOf(value[0]) >= 0) {
|
|
value = value.slice(1);
|
|
}
|
|
if (value === ".inf") {
|
|
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
} else if (value === ".nan") {
|
|
return NaN;
|
|
} else if (value.indexOf(":") >= 0) {
|
|
value.split(":").forEach(function(v) {
|
|
digits.unshift(parseFloat(v, 10));
|
|
});
|
|
value = 0;
|
|
base = 1;
|
|
digits.forEach(function(d) {
|
|
value += d * base;
|
|
base *= 60;
|
|
});
|
|
return sign * value;
|
|
}
|
|
return sign * parseFloat(value, 10);
|
|
}
|
|
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
function representYamlFloat(object, style) {
|
|
var res;
|
|
if (isNaN(object)) {
|
|
switch (style) {
|
|
case "lowercase":
|
|
return ".nan";
|
|
case "uppercase":
|
|
return ".NAN";
|
|
case "camelcase":
|
|
return ".NaN";
|
|
}
|
|
} else if (Number.POSITIVE_INFINITY === object) {
|
|
switch (style) {
|
|
case "lowercase":
|
|
return ".inf";
|
|
case "uppercase":
|
|
return ".INF";
|
|
case "camelcase":
|
|
return ".Inf";
|
|
}
|
|
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
switch (style) {
|
|
case "lowercase":
|
|
return "-.inf";
|
|
case "uppercase":
|
|
return "-.INF";
|
|
case "camelcase":
|
|
return "-.Inf";
|
|
}
|
|
} else if (common.isNegativeZero(object)) {
|
|
return "-0.0";
|
|
}
|
|
res = object.toString(10);
|
|
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
}
|
|
function isFloat(object) {
|
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:float", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlFloat,
|
|
construct: constructYamlFloat,
|
|
predicate: isFloat,
|
|
represent: representYamlFloat,
|
|
defaultStyle: "lowercase"
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/schema/json.js
|
|
var require_json = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports, module2) {
|
|
"use strict";
|
|
var Schema2 = require_schema();
|
|
module2.exports = new Schema2({
|
|
include: [
|
|
require_failsafe()
|
|
],
|
|
implicit: [
|
|
require_null(),
|
|
require_bool(),
|
|
require_int(),
|
|
require_float()
|
|
]
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/schema/core.js
|
|
var require_core2 = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports, module2) {
|
|
"use strict";
|
|
var Schema2 = require_schema();
|
|
module2.exports = new Schema2({
|
|
include: [
|
|
require_json()
|
|
]
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/timestamp.js
|
|
var require_timestamp = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
function resolveYamlTimestamp(data) {
|
|
if (data === null)
|
|
return false;
|
|
if (YAML_DATE_REGEXP.exec(data) !== null)
|
|
return true;
|
|
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
|
|
return true;
|
|
return false;
|
|
}
|
|
function constructYamlTimestamp(data) {
|
|
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
match = YAML_DATE_REGEXP.exec(data);
|
|
if (match === null)
|
|
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
if (match === null)
|
|
throw new Error("Date resolve error");
|
|
year = +match[1];
|
|
month = +match[2] - 1;
|
|
day = +match[3];
|
|
if (!match[4]) {
|
|
return new Date(Date.UTC(year, month, day));
|
|
}
|
|
hour = +match[4];
|
|
minute = +match[5];
|
|
second = +match[6];
|
|
if (match[7]) {
|
|
fraction = match[7].slice(0, 3);
|
|
while (fraction.length < 3) {
|
|
fraction += "0";
|
|
}
|
|
fraction = +fraction;
|
|
}
|
|
if (match[9]) {
|
|
tz_hour = +match[10];
|
|
tz_minute = +(match[11] || 0);
|
|
delta = (tz_hour * 60 + tz_minute) * 6e4;
|
|
if (match[9] === "-")
|
|
delta = -delta;
|
|
}
|
|
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
if (delta)
|
|
date.setTime(date.getTime() - delta);
|
|
return date;
|
|
}
|
|
function representYamlTimestamp(object) {
|
|
return object.toISOString();
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:timestamp", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlTimestamp,
|
|
construct: constructYamlTimestamp,
|
|
instanceOf: Date,
|
|
represent: representYamlTimestamp
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/merge.js
|
|
var require_merge = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
function resolveYamlMerge(data) {
|
|
return data === "<<" || data === null;
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:merge", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlMerge
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/binary.js
|
|
var require_binary = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports, module2) {
|
|
"use strict";
|
|
var NodeBuffer;
|
|
try {
|
|
_require = require;
|
|
NodeBuffer = _require("buffer").Buffer;
|
|
} catch (__) {
|
|
}
|
|
var _require;
|
|
var Type = require_type();
|
|
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
|
function resolveYamlBinary(data) {
|
|
if (data === null)
|
|
return false;
|
|
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
|
for (idx = 0; idx < max; idx++) {
|
|
code = map2.indexOf(data.charAt(idx));
|
|
if (code > 64)
|
|
continue;
|
|
if (code < 0)
|
|
return false;
|
|
bitlen += 6;
|
|
}
|
|
return bitlen % 8 === 0;
|
|
}
|
|
function constructYamlBinary(data) {
|
|
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
|
for (idx = 0; idx < max; idx++) {
|
|
if (idx % 4 === 0 && idx) {
|
|
result.push(bits >> 16 & 255);
|
|
result.push(bits >> 8 & 255);
|
|
result.push(bits & 255);
|
|
}
|
|
bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
|
}
|
|
tailbits = max % 4 * 6;
|
|
if (tailbits === 0) {
|
|
result.push(bits >> 16 & 255);
|
|
result.push(bits >> 8 & 255);
|
|
result.push(bits & 255);
|
|
} else if (tailbits === 18) {
|
|
result.push(bits >> 10 & 255);
|
|
result.push(bits >> 2 & 255);
|
|
} else if (tailbits === 12) {
|
|
result.push(bits >> 4 & 255);
|
|
}
|
|
if (NodeBuffer) {
|
|
return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
|
|
}
|
|
return result;
|
|
}
|
|
function representYamlBinary(object) {
|
|
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
|
for (idx = 0; idx < max; idx++) {
|
|
if (idx % 3 === 0 && idx) {
|
|
result += map2[bits >> 18 & 63];
|
|
result += map2[bits >> 12 & 63];
|
|
result += map2[bits >> 6 & 63];
|
|
result += map2[bits & 63];
|
|
}
|
|
bits = (bits << 8) + object[idx];
|
|
}
|
|
tail = max % 3;
|
|
if (tail === 0) {
|
|
result += map2[bits >> 18 & 63];
|
|
result += map2[bits >> 12 & 63];
|
|
result += map2[bits >> 6 & 63];
|
|
result += map2[bits & 63];
|
|
} else if (tail === 2) {
|
|
result += map2[bits >> 10 & 63];
|
|
result += map2[bits >> 4 & 63];
|
|
result += map2[bits << 2 & 63];
|
|
result += map2[64];
|
|
} else if (tail === 1) {
|
|
result += map2[bits >> 2 & 63];
|
|
result += map2[bits << 4 & 63];
|
|
result += map2[64];
|
|
result += map2[64];
|
|
}
|
|
return result;
|
|
}
|
|
function isBinary(object) {
|
|
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:binary", {
|
|
kind: "scalar",
|
|
resolve: resolveYamlBinary,
|
|
construct: constructYamlBinary,
|
|
predicate: isBinary,
|
|
represent: representYamlBinary
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/omap.js
|
|
var require_omap = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
var _toString = Object.prototype.toString;
|
|
function resolveYamlOmap(data) {
|
|
if (data === null)
|
|
return true;
|
|
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
pair = object[index];
|
|
pairHasKey = false;
|
|
if (_toString.call(pair) !== "[object Object]")
|
|
return false;
|
|
for (pairKey in pair) {
|
|
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
if (!pairHasKey)
|
|
pairHasKey = true;
|
|
else
|
|
return false;
|
|
}
|
|
}
|
|
if (!pairHasKey)
|
|
return false;
|
|
if (objectKeys.indexOf(pairKey) === -1)
|
|
objectKeys.push(pairKey);
|
|
else
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function constructYamlOmap(data) {
|
|
return data !== null ? data : [];
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:omap", {
|
|
kind: "sequence",
|
|
resolve: resolveYamlOmap,
|
|
construct: constructYamlOmap
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/pairs.js
|
|
var require_pairs = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
var _toString = Object.prototype.toString;
|
|
function resolveYamlPairs(data) {
|
|
if (data === null)
|
|
return true;
|
|
var index, length, pair, keys, result, object = data;
|
|
result = new Array(object.length);
|
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
pair = object[index];
|
|
if (_toString.call(pair) !== "[object Object]")
|
|
return false;
|
|
keys = Object.keys(pair);
|
|
if (keys.length !== 1)
|
|
return false;
|
|
result[index] = [keys[0], pair[keys[0]]];
|
|
}
|
|
return true;
|
|
}
|
|
function constructYamlPairs(data) {
|
|
if (data === null)
|
|
return [];
|
|
var index, length, pair, keys, result, object = data;
|
|
result = new Array(object.length);
|
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
pair = object[index];
|
|
keys = Object.keys(pair);
|
|
result[index] = [keys[0], pair[keys[0]]];
|
|
}
|
|
return result;
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:pairs", {
|
|
kind: "sequence",
|
|
resolve: resolveYamlPairs,
|
|
construct: constructYamlPairs
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/set.js
|
|
var require_set = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/set.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
function resolveYamlSet(data) {
|
|
if (data === null)
|
|
return true;
|
|
var key, object = data;
|
|
for (key in object) {
|
|
if (_hasOwnProperty.call(object, key)) {
|
|
if (object[key] !== null)
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function constructYamlSet(data) {
|
|
return data !== null ? data : {};
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:set", {
|
|
kind: "mapping",
|
|
resolve: resolveYamlSet,
|
|
construct: constructYamlSet
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
|
|
var require_default_safe = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports, module2) {
|
|
"use strict";
|
|
var Schema2 = require_schema();
|
|
module2.exports = new Schema2({
|
|
include: [
|
|
require_core2()
|
|
],
|
|
implicit: [
|
|
require_timestamp(),
|
|
require_merge()
|
|
],
|
|
explicit: [
|
|
require_binary(),
|
|
require_omap(),
|
|
require_pairs(),
|
|
require_set()
|
|
]
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
|
|
var require_undefined = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
function resolveJavascriptUndefined() {
|
|
return true;
|
|
}
|
|
function constructJavascriptUndefined() {
|
|
return void 0;
|
|
}
|
|
function representJavascriptUndefined() {
|
|
return "";
|
|
}
|
|
function isUndefined(object) {
|
|
return typeof object === "undefined";
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:js/undefined", {
|
|
kind: "scalar",
|
|
resolve: resolveJavascriptUndefined,
|
|
construct: constructJavascriptUndefined,
|
|
predicate: isUndefined,
|
|
represent: representJavascriptUndefined
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
|
|
var require_regexp = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports, module2) {
|
|
"use strict";
|
|
var Type = require_type();
|
|
function resolveJavascriptRegExp(data) {
|
|
if (data === null)
|
|
return false;
|
|
if (data.length === 0)
|
|
return false;
|
|
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
if (regexp[0] === "/") {
|
|
if (tail)
|
|
modifiers = tail[1];
|
|
if (modifiers.length > 3)
|
|
return false;
|
|
if (regexp[regexp.length - modifiers.length - 1] !== "/")
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function constructJavascriptRegExp(data) {
|
|
var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = "";
|
|
if (regexp[0] === "/") {
|
|
if (tail)
|
|
modifiers = tail[1];
|
|
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
}
|
|
return new RegExp(regexp, modifiers);
|
|
}
|
|
function representJavascriptRegExp(object) {
|
|
var result = "/" + object.source + "/";
|
|
if (object.global)
|
|
result += "g";
|
|
if (object.multiline)
|
|
result += "m";
|
|
if (object.ignoreCase)
|
|
result += "i";
|
|
return result;
|
|
}
|
|
function isRegExp(object) {
|
|
return Object.prototype.toString.call(object) === "[object RegExp]";
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:js/regexp", {
|
|
kind: "scalar",
|
|
resolve: resolveJavascriptRegExp,
|
|
construct: constructJavascriptRegExp,
|
|
predicate: isRegExp,
|
|
represent: representJavascriptRegExp
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/type/js/function.js
|
|
var require_function = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports, module2) {
|
|
"use strict";
|
|
var esprima;
|
|
try {
|
|
_require = require;
|
|
esprima = _require("esprima");
|
|
} catch (_) {
|
|
if (typeof window !== "undefined")
|
|
esprima = window.esprima;
|
|
}
|
|
var _require;
|
|
var Type = require_type();
|
|
function resolveJavascriptFunction(data) {
|
|
if (data === null)
|
|
return false;
|
|
try {
|
|
var source = "(" + data + ")", ast = esprima.parse(source, { range: true });
|
|
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
|
|
return false;
|
|
}
|
|
return true;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}
|
|
function constructJavascriptFunction(data) {
|
|
var source = "(" + data + ")", ast = esprima.parse(source, { range: true }), params = [], body;
|
|
if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") {
|
|
throw new Error("Failed to resolve function");
|
|
}
|
|
ast.body[0].expression.params.forEach(function(param) {
|
|
params.push(param.name);
|
|
});
|
|
body = ast.body[0].expression.body.range;
|
|
if (ast.body[0].expression.body.type === "BlockStatement") {
|
|
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
|
}
|
|
return new Function(params, "return " + source.slice(body[0], body[1]));
|
|
}
|
|
function representJavascriptFunction(object) {
|
|
return object.toString();
|
|
}
|
|
function isFunction(object) {
|
|
return Object.prototype.toString.call(object) === "[object Function]";
|
|
}
|
|
module2.exports = new Type("tag:yaml.org,2002:js/function", {
|
|
kind: "scalar",
|
|
resolve: resolveJavascriptFunction,
|
|
construct: constructJavascriptFunction,
|
|
predicate: isFunction,
|
|
represent: representJavascriptFunction
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/schema/default_full.js
|
|
var require_default_full = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports, module2) {
|
|
"use strict";
|
|
var Schema2 = require_schema();
|
|
module2.exports = Schema2.DEFAULT = new Schema2({
|
|
include: [
|
|
require_default_safe()
|
|
],
|
|
explicit: [
|
|
require_undefined(),
|
|
require_regexp(),
|
|
require_function()
|
|
]
|
|
});
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/loader.js
|
|
var require_loader = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/loader.js"(exports, module2) {
|
|
"use strict";
|
|
var common = require_common2();
|
|
var YAMLException = require_exception();
|
|
var Mark = require_mark();
|
|
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
var CONTEXT_FLOW_IN = 1;
|
|
var CONTEXT_FLOW_OUT = 2;
|
|
var CONTEXT_BLOCK_IN = 3;
|
|
var CONTEXT_BLOCK_OUT = 4;
|
|
var CHOMPING_CLIP = 1;
|
|
var CHOMPING_STRIP = 2;
|
|
var CHOMPING_KEEP = 3;
|
|
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
function _class(obj) {
|
|
return Object.prototype.toString.call(obj);
|
|
}
|
|
function is_EOL(c) {
|
|
return c === 10 || c === 13;
|
|
}
|
|
function is_WHITE_SPACE(c) {
|
|
return c === 9 || c === 32;
|
|
}
|
|
function is_WS_OR_EOL(c) {
|
|
return c === 9 || c === 32 || c === 10 || c === 13;
|
|
}
|
|
function is_FLOW_INDICATOR(c) {
|
|
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
}
|
|
function fromHexCode(c) {
|
|
var lc;
|
|
if (48 <= c && c <= 57) {
|
|
return c - 48;
|
|
}
|
|
lc = c | 32;
|
|
if (97 <= lc && lc <= 102) {
|
|
return lc - 97 + 10;
|
|
}
|
|
return -1;
|
|
}
|
|
function escapedHexLen(c) {
|
|
if (c === 120) {
|
|
return 2;
|
|
}
|
|
if (c === 117) {
|
|
return 4;
|
|
}
|
|
if (c === 85) {
|
|
return 8;
|
|
}
|
|
return 0;
|
|
}
|
|
function fromDecimalCode(c) {
|
|
if (48 <= c && c <= 57) {
|
|
return c - 48;
|
|
}
|
|
return -1;
|
|
}
|
|
function simpleEscapeSequence(c) {
|
|
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
}
|
|
function charFromCodepoint(c) {
|
|
if (c <= 65535) {
|
|
return String.fromCharCode(c);
|
|
}
|
|
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
}
|
|
var simpleEscapeCheck = new Array(256);
|
|
var simpleEscapeMap = new Array(256);
|
|
for (i = 0; i < 256; i++) {
|
|
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
}
|
|
var i;
|
|
function State(input, options) {
|
|
this.input = input;
|
|
this.filename = options["filename"] || null;
|
|
this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
|
|
this.onWarning = options["onWarning"] || null;
|
|
this.legacy = options["legacy"] || false;
|
|
this.json = options["json"] || false;
|
|
this.listener = options["listener"] || null;
|
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
this.typeMap = this.schema.compiledTypeMap;
|
|
this.length = input.length;
|
|
this.position = 0;
|
|
this.line = 0;
|
|
this.lineStart = 0;
|
|
this.lineIndent = 0;
|
|
this.documents = [];
|
|
}
|
|
function generateError(state, message) {
|
|
return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart));
|
|
}
|
|
function throwError(state, message) {
|
|
throw generateError(state, message);
|
|
}
|
|
function throwWarning(state, message) {
|
|
if (state.onWarning) {
|
|
state.onWarning.call(null, generateError(state, message));
|
|
}
|
|
}
|
|
var directiveHandlers = {
|
|
YAML: function handleYamlDirective(state, name, args) {
|
|
var match, major, minor;
|
|
if (state.version !== null) {
|
|
throwError(state, "duplication of %YAML directive");
|
|
}
|
|
if (args.length !== 1) {
|
|
throwError(state, "YAML directive accepts exactly one argument");
|
|
}
|
|
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
if (match === null) {
|
|
throwError(state, "ill-formed argument of the YAML directive");
|
|
}
|
|
major = parseInt(match[1], 10);
|
|
minor = parseInt(match[2], 10);
|
|
if (major !== 1) {
|
|
throwError(state, "unacceptable YAML version of the document");
|
|
}
|
|
state.version = args[0];
|
|
state.checkLineBreaks = minor < 2;
|
|
if (minor !== 1 && minor !== 2) {
|
|
throwWarning(state, "unsupported YAML version of the document");
|
|
}
|
|
},
|
|
TAG: function handleTagDirective(state, name, args) {
|
|
var handle, prefix;
|
|
if (args.length !== 2) {
|
|
throwError(state, "TAG directive accepts exactly two arguments");
|
|
}
|
|
handle = args[0];
|
|
prefix = args[1];
|
|
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
}
|
|
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
}
|
|
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
}
|
|
state.tagMap[handle] = prefix;
|
|
}
|
|
};
|
|
function captureSegment(state, start, end, checkJson) {
|
|
var _position, _length, _character, _result;
|
|
if (start < end) {
|
|
_result = state.input.slice(start, end);
|
|
if (checkJson) {
|
|
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
_character = _result.charCodeAt(_position);
|
|
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
throwError(state, "expected valid JSON character");
|
|
}
|
|
}
|
|
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
throwError(state, "the stream contains non-printable characters");
|
|
}
|
|
state.result += _result;
|
|
}
|
|
}
|
|
function mergeMappings(state, destination, source, overridableKeys) {
|
|
var sourceKeys, key, index, quantity;
|
|
if (!common.isObject(source)) {
|
|
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
}
|
|
sourceKeys = Object.keys(source);
|
|
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
key = sourceKeys[index];
|
|
if (!_hasOwnProperty.call(destination, key)) {
|
|
destination[key] = source[key];
|
|
overridableKeys[key] = true;
|
|
}
|
|
}
|
|
}
|
|
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
|
|
var index, quantity;
|
|
if (Array.isArray(keyNode)) {
|
|
keyNode = Array.prototype.slice.call(keyNode);
|
|
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
if (Array.isArray(keyNode[index])) {
|
|
throwError(state, "nested arrays are not supported inside keys");
|
|
}
|
|
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
keyNode[index] = "[object Object]";
|
|
}
|
|
}
|
|
}
|
|
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
|
keyNode = "[object Object]";
|
|
}
|
|
keyNode = String(keyNode);
|
|
if (_result === null) {
|
|
_result = {};
|
|
}
|
|
if (keyTag === "tag:yaml.org,2002:merge") {
|
|
if (Array.isArray(valueNode)) {
|
|
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
}
|
|
} else {
|
|
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
}
|
|
} else {
|
|
if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
|
|
state.line = startLine || state.line;
|
|
state.position = startPos || state.position;
|
|
throwError(state, "duplicated mapping key");
|
|
}
|
|
_result[keyNode] = valueNode;
|
|
delete overridableKeys[keyNode];
|
|
}
|
|
return _result;
|
|
}
|
|
function readLineBreak(state) {
|
|
var ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch === 10) {
|
|
state.position++;
|
|
} else if (ch === 13) {
|
|
state.position++;
|
|
if (state.input.charCodeAt(state.position) === 10) {
|
|
state.position++;
|
|
}
|
|
} else {
|
|
throwError(state, "a line break is expected");
|
|
}
|
|
state.line += 1;
|
|
state.lineStart = state.position;
|
|
}
|
|
function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
|
while (ch !== 0) {
|
|
while (is_WHITE_SPACE(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
if (allowComments && ch === 35) {
|
|
do {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} while (ch !== 10 && ch !== 13 && ch !== 0);
|
|
}
|
|
if (is_EOL(ch)) {
|
|
readLineBreak(state);
|
|
ch = state.input.charCodeAt(state.position);
|
|
lineBreaks++;
|
|
state.lineIndent = 0;
|
|
while (ch === 32) {
|
|
state.lineIndent++;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
throwWarning(state, "deficient indentation");
|
|
}
|
|
return lineBreaks;
|
|
}
|
|
function testDocumentSeparator(state) {
|
|
var _position = state.position, ch;
|
|
ch = state.input.charCodeAt(_position);
|
|
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
|
_position += 3;
|
|
ch = state.input.charCodeAt(_position);
|
|
if (ch === 0 || is_WS_OR_EOL(ch)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function writeFoldedLines(state, count) {
|
|
if (count === 1) {
|
|
state.result += " ";
|
|
} else if (count > 1) {
|
|
state.result += common.repeat("\n", count - 1);
|
|
}
|
|
}
|
|
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
|
return false;
|
|
}
|
|
if (ch === 63 || ch === 45) {
|
|
following = state.input.charCodeAt(state.position + 1);
|
|
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
return false;
|
|
}
|
|
}
|
|
state.kind = "scalar";
|
|
state.result = "";
|
|
captureStart = captureEnd = state.position;
|
|
hasPendingContent = false;
|
|
while (ch !== 0) {
|
|
if (ch === 58) {
|
|
following = state.input.charCodeAt(state.position + 1);
|
|
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
break;
|
|
}
|
|
} else if (ch === 35) {
|
|
preceding = state.input.charCodeAt(state.position - 1);
|
|
if (is_WS_OR_EOL(preceding)) {
|
|
break;
|
|
}
|
|
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
|
break;
|
|
} else if (is_EOL(ch)) {
|
|
_line = state.line;
|
|
_lineStart = state.lineStart;
|
|
_lineIndent = state.lineIndent;
|
|
skipSeparationSpace(state, false, -1);
|
|
if (state.lineIndent >= nodeIndent) {
|
|
hasPendingContent = true;
|
|
ch = state.input.charCodeAt(state.position);
|
|
continue;
|
|
} else {
|
|
state.position = captureEnd;
|
|
state.line = _line;
|
|
state.lineStart = _lineStart;
|
|
state.lineIndent = _lineIndent;
|
|
break;
|
|
}
|
|
}
|
|
if (hasPendingContent) {
|
|
captureSegment(state, captureStart, captureEnd, false);
|
|
writeFoldedLines(state, state.line - _line);
|
|
captureStart = captureEnd = state.position;
|
|
hasPendingContent = false;
|
|
}
|
|
if (!is_WHITE_SPACE(ch)) {
|
|
captureEnd = state.position + 1;
|
|
}
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
captureSegment(state, captureStart, captureEnd, false);
|
|
if (state.result) {
|
|
return true;
|
|
}
|
|
state.kind = _kind;
|
|
state.result = _result;
|
|
return false;
|
|
}
|
|
function readSingleQuotedScalar(state, nodeIndent) {
|
|
var ch, captureStart, captureEnd;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch !== 39) {
|
|
return false;
|
|
}
|
|
state.kind = "scalar";
|
|
state.result = "";
|
|
state.position++;
|
|
captureStart = captureEnd = state.position;
|
|
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
if (ch === 39) {
|
|
captureSegment(state, captureStart, state.position, true);
|
|
ch = state.input.charCodeAt(++state.position);
|
|
if (ch === 39) {
|
|
captureStart = state.position;
|
|
state.position++;
|
|
captureEnd = state.position;
|
|
} else {
|
|
return true;
|
|
}
|
|
} else if (is_EOL(ch)) {
|
|
captureSegment(state, captureStart, captureEnd, true);
|
|
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
captureStart = captureEnd = state.position;
|
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
} else {
|
|
state.position++;
|
|
captureEnd = state.position;
|
|
}
|
|
}
|
|
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
}
|
|
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch !== 34) {
|
|
return false;
|
|
}
|
|
state.kind = "scalar";
|
|
state.result = "";
|
|
state.position++;
|
|
captureStart = captureEnd = state.position;
|
|
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
if (ch === 34) {
|
|
captureSegment(state, captureStart, state.position, true);
|
|
state.position++;
|
|
return true;
|
|
} else if (ch === 92) {
|
|
captureSegment(state, captureStart, state.position, true);
|
|
ch = state.input.charCodeAt(++state.position);
|
|
if (is_EOL(ch)) {
|
|
skipSeparationSpace(state, false, nodeIndent);
|
|
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
state.result += simpleEscapeMap[ch];
|
|
state.position++;
|
|
} else if ((tmp = escapedHexLen(ch)) > 0) {
|
|
hexLength = tmp;
|
|
hexResult = 0;
|
|
for (; hexLength > 0; hexLength--) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
hexResult = (hexResult << 4) + tmp;
|
|
} else {
|
|
throwError(state, "expected hexadecimal character");
|
|
}
|
|
}
|
|
state.result += charFromCodepoint(hexResult);
|
|
state.position++;
|
|
} else {
|
|
throwError(state, "unknown escape sequence");
|
|
}
|
|
captureStart = captureEnd = state.position;
|
|
} else if (is_EOL(ch)) {
|
|
captureSegment(state, captureStart, captureEnd, true);
|
|
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
captureStart = captureEnd = state.position;
|
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
} else {
|
|
state.position++;
|
|
captureEnd = state.position;
|
|
}
|
|
}
|
|
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
}
|
|
function readFlowCollection(state, nodeIndent) {
|
|
var readNext = true, _line, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair2, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch === 91) {
|
|
terminator = 93;
|
|
isMapping = false;
|
|
_result = [];
|
|
} else if (ch === 123) {
|
|
terminator = 125;
|
|
isMapping = true;
|
|
_result = {};
|
|
} else {
|
|
return false;
|
|
}
|
|
if (state.anchor !== null) {
|
|
state.anchorMap[state.anchor] = _result;
|
|
}
|
|
ch = state.input.charCodeAt(++state.position);
|
|
while (ch !== 0) {
|
|
skipSeparationSpace(state, true, nodeIndent);
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch === terminator) {
|
|
state.position++;
|
|
state.tag = _tag;
|
|
state.anchor = _anchor;
|
|
state.kind = isMapping ? "mapping" : "sequence";
|
|
state.result = _result;
|
|
return true;
|
|
} else if (!readNext) {
|
|
throwError(state, "missed comma between flow collection entries");
|
|
}
|
|
keyTag = keyNode = valueNode = null;
|
|
isPair2 = isExplicitPair = false;
|
|
if (ch === 63) {
|
|
following = state.input.charCodeAt(state.position + 1);
|
|
if (is_WS_OR_EOL(following)) {
|
|
isPair2 = isExplicitPair = true;
|
|
state.position++;
|
|
skipSeparationSpace(state, true, nodeIndent);
|
|
}
|
|
}
|
|
_line = state.line;
|
|
composeNode2(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
keyTag = state.tag;
|
|
keyNode = state.result;
|
|
skipSeparationSpace(state, true, nodeIndent);
|
|
ch = state.input.charCodeAt(state.position);
|
|
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
isPair2 = true;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
skipSeparationSpace(state, true, nodeIndent);
|
|
composeNode2(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
valueNode = state.result;
|
|
}
|
|
if (isMapping) {
|
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
|
} else if (isPair2) {
|
|
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
|
|
} else {
|
|
_result.push(keyNode);
|
|
}
|
|
skipSeparationSpace(state, true, nodeIndent);
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch === 44) {
|
|
readNext = true;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} else {
|
|
readNext = false;
|
|
}
|
|
}
|
|
throwError(state, "unexpected end of the stream within a flow collection");
|
|
}
|
|
function readBlockScalar(state, nodeIndent) {
|
|
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch === 124) {
|
|
folding = false;
|
|
} else if (ch === 62) {
|
|
folding = true;
|
|
} else {
|
|
return false;
|
|
}
|
|
state.kind = "scalar";
|
|
state.result = "";
|
|
while (ch !== 0) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
if (ch === 43 || ch === 45) {
|
|
if (CHOMPING_CLIP === chomping) {
|
|
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
} else {
|
|
throwError(state, "repeat of a chomping mode identifier");
|
|
}
|
|
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
if (tmp === 0) {
|
|
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
} else if (!detectedIndent) {
|
|
textIndent = nodeIndent + tmp - 1;
|
|
detectedIndent = true;
|
|
} else {
|
|
throwError(state, "repeat of an indentation width identifier");
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
if (is_WHITE_SPACE(ch)) {
|
|
do {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} while (is_WHITE_SPACE(ch));
|
|
if (ch === 35) {
|
|
do {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} while (!is_EOL(ch) && ch !== 0);
|
|
}
|
|
}
|
|
while (ch !== 0) {
|
|
readLineBreak(state);
|
|
state.lineIndent = 0;
|
|
ch = state.input.charCodeAt(state.position);
|
|
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
|
state.lineIndent++;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
if (!detectedIndent && state.lineIndent > textIndent) {
|
|
textIndent = state.lineIndent;
|
|
}
|
|
if (is_EOL(ch)) {
|
|
emptyLines++;
|
|
continue;
|
|
}
|
|
if (state.lineIndent < textIndent) {
|
|
if (chomping === CHOMPING_KEEP) {
|
|
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
} else if (chomping === CHOMPING_CLIP) {
|
|
if (didReadContent) {
|
|
state.result += "\n";
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
if (folding) {
|
|
if (is_WHITE_SPACE(ch)) {
|
|
atMoreIndented = true;
|
|
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
} else if (atMoreIndented) {
|
|
atMoreIndented = false;
|
|
state.result += common.repeat("\n", emptyLines + 1);
|
|
} else if (emptyLines === 0) {
|
|
if (didReadContent) {
|
|
state.result += " ";
|
|
}
|
|
} else {
|
|
state.result += common.repeat("\n", emptyLines);
|
|
}
|
|
} else {
|
|
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
}
|
|
didReadContent = true;
|
|
detectedIndent = true;
|
|
emptyLines = 0;
|
|
captureStart = state.position;
|
|
while (!is_EOL(ch) && ch !== 0) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
captureSegment(state, captureStart, state.position, false);
|
|
}
|
|
return true;
|
|
}
|
|
function readBlockSequence(state, nodeIndent) {
|
|
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
|
if (state.anchor !== null) {
|
|
state.anchorMap[state.anchor] = _result;
|
|
}
|
|
ch = state.input.charCodeAt(state.position);
|
|
while (ch !== 0) {
|
|
if (ch !== 45) {
|
|
break;
|
|
}
|
|
following = state.input.charCodeAt(state.position + 1);
|
|
if (!is_WS_OR_EOL(following)) {
|
|
break;
|
|
}
|
|
detected = true;
|
|
state.position++;
|
|
if (skipSeparationSpace(state, true, -1)) {
|
|
if (state.lineIndent <= nodeIndent) {
|
|
_result.push(null);
|
|
ch = state.input.charCodeAt(state.position);
|
|
continue;
|
|
}
|
|
}
|
|
_line = state.line;
|
|
composeNode2(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
_result.push(state.result);
|
|
skipSeparationSpace(state, true, -1);
|
|
ch = state.input.charCodeAt(state.position);
|
|
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
throwError(state, "bad indentation of a sequence entry");
|
|
} else if (state.lineIndent < nodeIndent) {
|
|
break;
|
|
}
|
|
}
|
|
if (detected) {
|
|
state.tag = _tag;
|
|
state.anchor = _anchor;
|
|
state.kind = "sequence";
|
|
state.result = _result;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
var following, allowCompact, _line, _pos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
|
if (state.anchor !== null) {
|
|
state.anchorMap[state.anchor] = _result;
|
|
}
|
|
ch = state.input.charCodeAt(state.position);
|
|
while (ch !== 0) {
|
|
following = state.input.charCodeAt(state.position + 1);
|
|
_line = state.line;
|
|
_pos = state.position;
|
|
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
|
if (ch === 63) {
|
|
if (atExplicitKey) {
|
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
keyTag = keyNode = valueNode = null;
|
|
}
|
|
detected = true;
|
|
atExplicitKey = true;
|
|
allowCompact = true;
|
|
} else if (atExplicitKey) {
|
|
atExplicitKey = false;
|
|
allowCompact = true;
|
|
} else {
|
|
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
}
|
|
state.position += 1;
|
|
ch = following;
|
|
} else if (composeNode2(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
|
if (state.line === _line) {
|
|
ch = state.input.charCodeAt(state.position);
|
|
while (is_WHITE_SPACE(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
if (ch === 58) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
if (!is_WS_OR_EOL(ch)) {
|
|
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
}
|
|
if (atExplicitKey) {
|
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
keyTag = keyNode = valueNode = null;
|
|
}
|
|
detected = true;
|
|
atExplicitKey = false;
|
|
allowCompact = false;
|
|
keyTag = state.tag;
|
|
keyNode = state.result;
|
|
} else if (detected) {
|
|
throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
} else {
|
|
state.tag = _tag;
|
|
state.anchor = _anchor;
|
|
return true;
|
|
}
|
|
} else if (detected) {
|
|
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
} else {
|
|
state.tag = _tag;
|
|
state.anchor = _anchor;
|
|
return true;
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
if (composeNode2(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
|
if (atExplicitKey) {
|
|
keyNode = state.result;
|
|
} else {
|
|
valueNode = state.result;
|
|
}
|
|
}
|
|
if (!atExplicitKey) {
|
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
|
|
keyTag = keyNode = valueNode = null;
|
|
}
|
|
skipSeparationSpace(state, true, -1);
|
|
ch = state.input.charCodeAt(state.position);
|
|
}
|
|
if (state.lineIndent > nodeIndent && ch !== 0) {
|
|
throwError(state, "bad indentation of a mapping entry");
|
|
} else if (state.lineIndent < nodeIndent) {
|
|
break;
|
|
}
|
|
}
|
|
if (atExplicitKey) {
|
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
}
|
|
if (detected) {
|
|
state.tag = _tag;
|
|
state.anchor = _anchor;
|
|
state.kind = "mapping";
|
|
state.result = _result;
|
|
}
|
|
return detected;
|
|
}
|
|
function readTagProperty(state) {
|
|
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch !== 33)
|
|
return false;
|
|
if (state.tag !== null) {
|
|
throwError(state, "duplication of a tag property");
|
|
}
|
|
ch = state.input.charCodeAt(++state.position);
|
|
if (ch === 60) {
|
|
isVerbatim = true;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} else if (ch === 33) {
|
|
isNamed = true;
|
|
tagHandle = "!!";
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} else {
|
|
tagHandle = "!";
|
|
}
|
|
_position = state.position;
|
|
if (isVerbatim) {
|
|
do {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} while (ch !== 0 && ch !== 62);
|
|
if (state.position < state.length) {
|
|
tagName = state.input.slice(_position, state.position);
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} else {
|
|
throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
}
|
|
} else {
|
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
if (ch === 33) {
|
|
if (!isNamed) {
|
|
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
throwError(state, "named tag handle cannot contain such characters");
|
|
}
|
|
isNamed = true;
|
|
_position = state.position + 1;
|
|
} else {
|
|
throwError(state, "tag suffix cannot contain exclamation marks");
|
|
}
|
|
}
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
tagName = state.input.slice(_position, state.position);
|
|
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
}
|
|
}
|
|
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
throwError(state, "tag name cannot contain such characters: " + tagName);
|
|
}
|
|
if (isVerbatim) {
|
|
state.tag = tagName;
|
|
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
state.tag = state.tagMap[tagHandle] + tagName;
|
|
} else if (tagHandle === "!") {
|
|
state.tag = "!" + tagName;
|
|
} else if (tagHandle === "!!") {
|
|
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
} else {
|
|
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
}
|
|
return true;
|
|
}
|
|
function readAnchorProperty(state) {
|
|
var _position, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch !== 38)
|
|
return false;
|
|
if (state.anchor !== null) {
|
|
throwError(state, "duplication of an anchor property");
|
|
}
|
|
ch = state.input.charCodeAt(++state.position);
|
|
_position = state.position;
|
|
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
if (state.position === _position) {
|
|
throwError(state, "name of an anchor node must contain at least one character");
|
|
}
|
|
state.anchor = state.input.slice(_position, state.position);
|
|
return true;
|
|
}
|
|
function readAlias(state) {
|
|
var _position, alias, ch;
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (ch !== 42)
|
|
return false;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
_position = state.position;
|
|
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
if (state.position === _position) {
|
|
throwError(state, "name of an alias node must contain at least one character");
|
|
}
|
|
alias = state.input.slice(_position, state.position);
|
|
if (!_hasOwnProperty.call(state.anchorMap, alias)) {
|
|
throwError(state, 'unidentified alias "' + alias + '"');
|
|
}
|
|
state.result = state.anchorMap[alias];
|
|
skipSeparationSpace(state, true, -1);
|
|
return true;
|
|
}
|
|
function composeNode2(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
|
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent;
|
|
if (state.listener !== null) {
|
|
state.listener("open", state);
|
|
}
|
|
state.tag = null;
|
|
state.anchor = null;
|
|
state.kind = null;
|
|
state.result = null;
|
|
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
|
if (allowToSeek) {
|
|
if (skipSeparationSpace(state, true, -1)) {
|
|
atNewLine = true;
|
|
if (state.lineIndent > parentIndent) {
|
|
indentStatus = 1;
|
|
} else if (state.lineIndent === parentIndent) {
|
|
indentStatus = 0;
|
|
} else if (state.lineIndent < parentIndent) {
|
|
indentStatus = -1;
|
|
}
|
|
}
|
|
}
|
|
if (indentStatus === 1) {
|
|
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
if (skipSeparationSpace(state, true, -1)) {
|
|
atNewLine = true;
|
|
allowBlockCollections = allowBlockStyles;
|
|
if (state.lineIndent > parentIndent) {
|
|
indentStatus = 1;
|
|
} else if (state.lineIndent === parentIndent) {
|
|
indentStatus = 0;
|
|
} else if (state.lineIndent < parentIndent) {
|
|
indentStatus = -1;
|
|
}
|
|
} else {
|
|
allowBlockCollections = false;
|
|
}
|
|
}
|
|
}
|
|
if (allowBlockCollections) {
|
|
allowBlockCollections = atNewLine || allowCompact;
|
|
}
|
|
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
flowIndent = parentIndent;
|
|
} else {
|
|
flowIndent = parentIndent + 1;
|
|
}
|
|
blockIndent = state.position - state.lineStart;
|
|
if (indentStatus === 1) {
|
|
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
|
hasContent = true;
|
|
} else {
|
|
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
|
hasContent = true;
|
|
} else if (readAlias(state)) {
|
|
hasContent = true;
|
|
if (state.tag !== null || state.anchor !== null) {
|
|
throwError(state, "alias node should not have any properties");
|
|
}
|
|
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
hasContent = true;
|
|
if (state.tag === null) {
|
|
state.tag = "?";
|
|
}
|
|
}
|
|
if (state.anchor !== null) {
|
|
state.anchorMap[state.anchor] = state.result;
|
|
}
|
|
}
|
|
} else if (indentStatus === 0) {
|
|
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
}
|
|
}
|
|
if (state.tag !== null && state.tag !== "!") {
|
|
if (state.tag === "?") {
|
|
if (state.result !== null && state.kind !== "scalar") {
|
|
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
}
|
|
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
type = state.implicitTypes[typeIndex];
|
|
if (type.resolve(state.result)) {
|
|
state.result = type.construct(state.result);
|
|
state.tag = type.tag;
|
|
if (state.anchor !== null) {
|
|
state.anchorMap[state.anchor] = state.result;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
} else if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
|
type = state.typeMap[state.kind || "fallback"][state.tag];
|
|
if (state.result !== null && type.kind !== state.kind) {
|
|
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
}
|
|
if (!type.resolve(state.result)) {
|
|
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
} else {
|
|
state.result = type.construct(state.result);
|
|
if (state.anchor !== null) {
|
|
state.anchorMap[state.anchor] = state.result;
|
|
}
|
|
}
|
|
} else {
|
|
throwError(state, "unknown tag !<" + state.tag + ">");
|
|
}
|
|
}
|
|
if (state.listener !== null) {
|
|
state.listener("close", state);
|
|
}
|
|
return state.tag !== null || state.anchor !== null || hasContent;
|
|
}
|
|
function readDocument(state) {
|
|
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
|
state.version = null;
|
|
state.checkLineBreaks = state.legacy;
|
|
state.tagMap = {};
|
|
state.anchorMap = {};
|
|
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
skipSeparationSpace(state, true, -1);
|
|
ch = state.input.charCodeAt(state.position);
|
|
if (state.lineIndent > 0 || ch !== 37) {
|
|
break;
|
|
}
|
|
hasDirectives = true;
|
|
ch = state.input.charCodeAt(++state.position);
|
|
_position = state.position;
|
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
directiveName = state.input.slice(_position, state.position);
|
|
directiveArgs = [];
|
|
if (directiveName.length < 1) {
|
|
throwError(state, "directive name must not be less than one character in length");
|
|
}
|
|
while (ch !== 0) {
|
|
while (is_WHITE_SPACE(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
if (ch === 35) {
|
|
do {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
} while (ch !== 0 && !is_EOL(ch));
|
|
break;
|
|
}
|
|
if (is_EOL(ch))
|
|
break;
|
|
_position = state.position;
|
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
ch = state.input.charCodeAt(++state.position);
|
|
}
|
|
directiveArgs.push(state.input.slice(_position, state.position));
|
|
}
|
|
if (ch !== 0)
|
|
readLineBreak(state);
|
|
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
} else {
|
|
throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
|
}
|
|
}
|
|
skipSeparationSpace(state, true, -1);
|
|
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
|
state.position += 3;
|
|
skipSeparationSpace(state, true, -1);
|
|
} else if (hasDirectives) {
|
|
throwError(state, "directives end mark is expected");
|
|
}
|
|
composeNode2(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
skipSeparationSpace(state, true, -1);
|
|
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
|
throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
}
|
|
state.documents.push(state.result);
|
|
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
if (state.input.charCodeAt(state.position) === 46) {
|
|
state.position += 3;
|
|
skipSeparationSpace(state, true, -1);
|
|
}
|
|
return;
|
|
}
|
|
if (state.position < state.length - 1) {
|
|
throwError(state, "end of the stream or a document separator is expected");
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
function loadDocuments(input, options) {
|
|
input = String(input);
|
|
options = options || {};
|
|
if (input.length !== 0) {
|
|
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
|
input += "\n";
|
|
}
|
|
if (input.charCodeAt(0) === 65279) {
|
|
input = input.slice(1);
|
|
}
|
|
}
|
|
var state = new State(input, options);
|
|
var nullpos = input.indexOf("\0");
|
|
if (nullpos !== -1) {
|
|
state.position = nullpos;
|
|
throwError(state, "null byte is not allowed in input");
|
|
}
|
|
state.input += "\0";
|
|
while (state.input.charCodeAt(state.position) === 32) {
|
|
state.lineIndent += 1;
|
|
state.position += 1;
|
|
}
|
|
while (state.position < state.length - 1) {
|
|
readDocument(state);
|
|
}
|
|
return state.documents;
|
|
}
|
|
function loadAll(input, iterator, options) {
|
|
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
options = iterator;
|
|
iterator = null;
|
|
}
|
|
var documents = loadDocuments(input, options);
|
|
if (typeof iterator !== "function") {
|
|
return documents;
|
|
}
|
|
for (var index = 0, length = documents.length; index < length; index += 1) {
|
|
iterator(documents[index]);
|
|
}
|
|
}
|
|
function load(input, options) {
|
|
var documents = loadDocuments(input, options);
|
|
if (documents.length === 0) {
|
|
return void 0;
|
|
} else if (documents.length === 1) {
|
|
return documents[0];
|
|
}
|
|
throw new YAMLException("expected a single document in the stream, but found more");
|
|
}
|
|
function safeLoadAll(input, iterator, options) {
|
|
if (typeof iterator === "object" && iterator !== null && typeof options === "undefined") {
|
|
options = iterator;
|
|
iterator = null;
|
|
}
|
|
return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
}
|
|
function safeLoad(input, options) {
|
|
return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
}
|
|
module2.exports.loadAll = loadAll;
|
|
module2.exports.load = load;
|
|
module2.exports.safeLoadAll = safeLoadAll;
|
|
module2.exports.safeLoad = safeLoad;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml/dumper.js
|
|
var require_dumper = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml/dumper.js"(exports, module2) {
|
|
"use strict";
|
|
var common = require_common2();
|
|
var YAMLException = require_exception();
|
|
var DEFAULT_FULL_SCHEMA = require_default_full();
|
|
var DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
var _toString = Object.prototype.toString;
|
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
var CHAR_TAB = 9;
|
|
var CHAR_LINE_FEED = 10;
|
|
var CHAR_CARRIAGE_RETURN = 13;
|
|
var CHAR_SPACE = 32;
|
|
var CHAR_EXCLAMATION = 33;
|
|
var CHAR_DOUBLE_QUOTE = 34;
|
|
var CHAR_SHARP = 35;
|
|
var CHAR_PERCENT = 37;
|
|
var CHAR_AMPERSAND = 38;
|
|
var CHAR_SINGLE_QUOTE = 39;
|
|
var CHAR_ASTERISK = 42;
|
|
var CHAR_COMMA = 44;
|
|
var CHAR_MINUS = 45;
|
|
var CHAR_COLON = 58;
|
|
var CHAR_EQUALS = 61;
|
|
var CHAR_GREATER_THAN = 62;
|
|
var CHAR_QUESTION = 63;
|
|
var CHAR_COMMERCIAL_AT = 64;
|
|
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
var CHAR_GRAVE_ACCENT = 96;
|
|
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
var CHAR_VERTICAL_LINE = 124;
|
|
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
var ESCAPE_SEQUENCES = {};
|
|
ESCAPE_SEQUENCES[0] = "\\0";
|
|
ESCAPE_SEQUENCES[7] = "\\a";
|
|
ESCAPE_SEQUENCES[8] = "\\b";
|
|
ESCAPE_SEQUENCES[9] = "\\t";
|
|
ESCAPE_SEQUENCES[10] = "\\n";
|
|
ESCAPE_SEQUENCES[11] = "\\v";
|
|
ESCAPE_SEQUENCES[12] = "\\f";
|
|
ESCAPE_SEQUENCES[13] = "\\r";
|
|
ESCAPE_SEQUENCES[27] = "\\e";
|
|
ESCAPE_SEQUENCES[34] = '\\"';
|
|
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
ESCAPE_SEQUENCES[133] = "\\N";
|
|
ESCAPE_SEQUENCES[160] = "\\_";
|
|
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
"y",
|
|
"Y",
|
|
"yes",
|
|
"Yes",
|
|
"YES",
|
|
"on",
|
|
"On",
|
|
"ON",
|
|
"n",
|
|
"N",
|
|
"no",
|
|
"No",
|
|
"NO",
|
|
"off",
|
|
"Off",
|
|
"OFF"
|
|
];
|
|
function compileStyleMap(schema4, map2) {
|
|
var result, keys, index, length, tag, style, type;
|
|
if (map2 === null)
|
|
return {};
|
|
result = {};
|
|
keys = Object.keys(map2);
|
|
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
tag = keys[index];
|
|
style = String(map2[tag]);
|
|
if (tag.slice(0, 2) === "!!") {
|
|
tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
}
|
|
type = schema4.compiledTypeMap["fallback"][tag];
|
|
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
style = type.styleAliases[style];
|
|
}
|
|
result[tag] = style;
|
|
}
|
|
return result;
|
|
}
|
|
function encodeHex(character) {
|
|
var string2, handle, length;
|
|
string2 = character.toString(16).toUpperCase();
|
|
if (character <= 255) {
|
|
handle = "x";
|
|
length = 2;
|
|
} else if (character <= 65535) {
|
|
handle = "u";
|
|
length = 4;
|
|
} else if (character <= 4294967295) {
|
|
handle = "U";
|
|
length = 8;
|
|
} else {
|
|
throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
}
|
|
return "\\" + handle + common.repeat("0", length - string2.length) + string2;
|
|
}
|
|
function State(options) {
|
|
this.schema = options["schema"] || DEFAULT_FULL_SCHEMA;
|
|
this.indent = Math.max(1, options["indent"] || 2);
|
|
this.noArrayIndent = options["noArrayIndent"] || false;
|
|
this.skipInvalid = options["skipInvalid"] || false;
|
|
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
|
|
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
|
|
this.sortKeys = options["sortKeys"] || false;
|
|
this.lineWidth = options["lineWidth"] || 80;
|
|
this.noRefs = options["noRefs"] || false;
|
|
this.noCompatMode = options["noCompatMode"] || false;
|
|
this.condenseFlow = options["condenseFlow"] || false;
|
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
this.explicitTypes = this.schema.compiledExplicit;
|
|
this.tag = null;
|
|
this.result = "";
|
|
this.duplicates = [];
|
|
this.usedDuplicates = null;
|
|
}
|
|
function indentString(string2, spaces) {
|
|
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string2.length;
|
|
while (position < length) {
|
|
next = string2.indexOf("\n", position);
|
|
if (next === -1) {
|
|
line = string2.slice(position);
|
|
position = length;
|
|
} else {
|
|
line = string2.slice(position, next + 1);
|
|
position = next + 1;
|
|
}
|
|
if (line.length && line !== "\n")
|
|
result += ind;
|
|
result += line;
|
|
}
|
|
return result;
|
|
}
|
|
function generateNextLine(state, level) {
|
|
return "\n" + common.repeat(" ", state.indent * level);
|
|
}
|
|
function testImplicitResolving(state, str) {
|
|
var index, length, type;
|
|
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
type = state.implicitTypes[index];
|
|
if (type.resolve(str)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function isWhitespace(c) {
|
|
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
}
|
|
function isPrintable(c) {
|
|
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111;
|
|
}
|
|
function isNsChar(c) {
|
|
return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
|
|
}
|
|
function isPlainSafe(c, prev) {
|
|
return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev));
|
|
}
|
|
function isPlainSafeFirst(c) {
|
|
return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
}
|
|
function needIndentIndicator(string2) {
|
|
var leadingSpaceRe = /^\n* /;
|
|
return leadingSpaceRe.test(string2);
|
|
}
|
|
var STYLE_PLAIN = 1;
|
|
var STYLE_SINGLE = 2;
|
|
var STYLE_LITERAL = 3;
|
|
var STYLE_FOLDED = 4;
|
|
var STYLE_DOUBLE = 5;
|
|
function chooseScalarStyle(string2, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
|
var i;
|
|
var char, prev_char;
|
|
var hasLineBreak = false;
|
|
var hasFoldableLine = false;
|
|
var shouldTrackWidth = lineWidth !== -1;
|
|
var previousLineBreak = -1;
|
|
var plain = isPlainSafeFirst(string2.charCodeAt(0)) && !isWhitespace(string2.charCodeAt(string2.length - 1));
|
|
if (singleLineOnly) {
|
|
for (i = 0; i < string2.length; i++) {
|
|
char = string2.charCodeAt(i);
|
|
if (!isPrintable(char)) {
|
|
return STYLE_DOUBLE;
|
|
}
|
|
prev_char = i > 0 ? string2.charCodeAt(i - 1) : null;
|
|
plain = plain && isPlainSafe(char, prev_char);
|
|
}
|
|
} else {
|
|
for (i = 0; i < string2.length; i++) {
|
|
char = string2.charCodeAt(i);
|
|
if (char === CHAR_LINE_FEED) {
|
|
hasLineBreak = true;
|
|
if (shouldTrackWidth) {
|
|
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ";
|
|
previousLineBreak = i;
|
|
}
|
|
} else if (!isPrintable(char)) {
|
|
return STYLE_DOUBLE;
|
|
}
|
|
prev_char = i > 0 ? string2.charCodeAt(i - 1) : null;
|
|
plain = plain && isPlainSafe(char, prev_char);
|
|
}
|
|
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ");
|
|
}
|
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
return plain && !testAmbiguousType(string2) ? STYLE_PLAIN : STYLE_SINGLE;
|
|
}
|
|
if (indentPerLevel > 9 && needIndentIndicator(string2)) {
|
|
return STYLE_DOUBLE;
|
|
}
|
|
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
}
|
|
function writeScalar(state, string2, level, iskey) {
|
|
state.dump = function() {
|
|
if (string2.length === 0) {
|
|
return "''";
|
|
}
|
|
if (!state.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string2) !== -1) {
|
|
return "'" + string2 + "'";
|
|
}
|
|
var indent = state.indent * Math.max(1, level);
|
|
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
function testAmbiguity(string3) {
|
|
return testImplicitResolving(state, string3);
|
|
}
|
|
switch (chooseScalarStyle(string2, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
case STYLE_PLAIN:
|
|
return string2;
|
|
case STYLE_SINGLE:
|
|
return "'" + string2.replace(/'/g, "''") + "'";
|
|
case STYLE_LITERAL:
|
|
return "|" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(string2, indent));
|
|
case STYLE_FOLDED:
|
|
return ">" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(foldString(string2, lineWidth), indent));
|
|
case STYLE_DOUBLE:
|
|
return '"' + escapeString(string2, lineWidth) + '"';
|
|
default:
|
|
throw new YAMLException("impossible error: invalid scalar style");
|
|
}
|
|
}();
|
|
}
|
|
function blockHeader(string2, indentPerLevel) {
|
|
var indentIndicator = needIndentIndicator(string2) ? String(indentPerLevel) : "";
|
|
var clip = string2[string2.length - 1] === "\n";
|
|
var keep = clip && (string2[string2.length - 2] === "\n" || string2 === "\n");
|
|
var chomp = keep ? "+" : clip ? "" : "-";
|
|
return indentIndicator + chomp + "\n";
|
|
}
|
|
function dropEndingNewline(string2) {
|
|
return string2[string2.length - 1] === "\n" ? string2.slice(0, -1) : string2;
|
|
}
|
|
function foldString(string2, width) {
|
|
var lineRe = /(\n+)([^\n]*)/g;
|
|
var result = function() {
|
|
var nextLF = string2.indexOf("\n");
|
|
nextLF = nextLF !== -1 ? nextLF : string2.length;
|
|
lineRe.lastIndex = nextLF;
|
|
return foldLine(string2.slice(0, nextLF), width);
|
|
}();
|
|
var prevMoreIndented = string2[0] === "\n" || string2[0] === " ";
|
|
var moreIndented;
|
|
var match;
|
|
while (match = lineRe.exec(string2)) {
|
|
var prefix = match[1], line = match[2];
|
|
moreIndented = line[0] === " ";
|
|
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
prevMoreIndented = moreIndented;
|
|
}
|
|
return result;
|
|
}
|
|
function foldLine(line, width) {
|
|
if (line === "" || line[0] === " ")
|
|
return line;
|
|
var breakRe = / [^ ]/g;
|
|
var match;
|
|
var start = 0, end, curr = 0, next = 0;
|
|
var result = "";
|
|
while (match = breakRe.exec(line)) {
|
|
next = match.index;
|
|
if (next - start > width) {
|
|
end = curr > start ? curr : next;
|
|
result += "\n" + line.slice(start, end);
|
|
start = end + 1;
|
|
}
|
|
curr = next;
|
|
}
|
|
result += "\n";
|
|
if (line.length - start > width && curr > start) {
|
|
result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
} else {
|
|
result += line.slice(start);
|
|
}
|
|
return result.slice(1);
|
|
}
|
|
function escapeString(string2) {
|
|
var result = "";
|
|
var char, nextChar;
|
|
var escapeSeq;
|
|
for (var i = 0; i < string2.length; i++) {
|
|
char = string2.charCodeAt(i);
|
|
if (char >= 55296 && char <= 56319) {
|
|
nextChar = string2.charCodeAt(i + 1);
|
|
if (nextChar >= 56320 && nextChar <= 57343) {
|
|
result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536);
|
|
i++;
|
|
continue;
|
|
}
|
|
}
|
|
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
result += !escapeSeq && isPrintable(char) ? string2[i] : escapeSeq || encodeHex(char);
|
|
}
|
|
return result;
|
|
}
|
|
function writeFlowSequence(state, level, object) {
|
|
var _result = "", _tag = state.tag, index, length;
|
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
if (writeNode(state, level, object[index], false, false)) {
|
|
if (index !== 0)
|
|
_result += "," + (!state.condenseFlow ? " " : "");
|
|
_result += state.dump;
|
|
}
|
|
}
|
|
state.tag = _tag;
|
|
state.dump = "[" + _result + "]";
|
|
}
|
|
function writeBlockSequence(state, level, object, compact) {
|
|
var _result = "", _tag = state.tag, index, length;
|
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
if (!compact || index !== 0) {
|
|
_result += generateNextLine(state, level);
|
|
}
|
|
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
_result += "-";
|
|
} else {
|
|
_result += "- ";
|
|
}
|
|
_result += state.dump;
|
|
}
|
|
}
|
|
state.tag = _tag;
|
|
state.dump = _result || "[]";
|
|
}
|
|
function writeFlowMapping(state, level, object) {
|
|
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
|
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
pairBuffer = "";
|
|
if (index !== 0)
|
|
pairBuffer += ", ";
|
|
if (state.condenseFlow)
|
|
pairBuffer += '"';
|
|
objectKey = objectKeyList[index];
|
|
objectValue = object[objectKey];
|
|
if (!writeNode(state, level, objectKey, false, false)) {
|
|
continue;
|
|
}
|
|
if (state.dump.length > 1024)
|
|
pairBuffer += "? ";
|
|
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
if (!writeNode(state, level, objectValue, false, false)) {
|
|
continue;
|
|
}
|
|
pairBuffer += state.dump;
|
|
_result += pairBuffer;
|
|
}
|
|
state.tag = _tag;
|
|
state.dump = "{" + _result + "}";
|
|
}
|
|
function writeBlockMapping(state, level, object, compact) {
|
|
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
|
|
if (state.sortKeys === true) {
|
|
objectKeyList.sort();
|
|
} else if (typeof state.sortKeys === "function") {
|
|
objectKeyList.sort(state.sortKeys);
|
|
} else if (state.sortKeys) {
|
|
throw new YAMLException("sortKeys must be a boolean or a function");
|
|
}
|
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
pairBuffer = "";
|
|
if (!compact || index !== 0) {
|
|
pairBuffer += generateNextLine(state, level);
|
|
}
|
|
objectKey = objectKeyList[index];
|
|
objectValue = object[objectKey];
|
|
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
continue;
|
|
}
|
|
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
|
|
if (explicitPair) {
|
|
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
pairBuffer += "?";
|
|
} else {
|
|
pairBuffer += "? ";
|
|
}
|
|
}
|
|
pairBuffer += state.dump;
|
|
if (explicitPair) {
|
|
pairBuffer += generateNextLine(state, level);
|
|
}
|
|
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
continue;
|
|
}
|
|
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
pairBuffer += ":";
|
|
} else {
|
|
pairBuffer += ": ";
|
|
}
|
|
pairBuffer += state.dump;
|
|
_result += pairBuffer;
|
|
}
|
|
state.tag = _tag;
|
|
state.dump = _result || "{}";
|
|
}
|
|
function detectType(state, object, explicit) {
|
|
var _result, typeList, index, length, type, style;
|
|
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
type = typeList[index];
|
|
if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
|
|
state.tag = explicit ? type.tag : "?";
|
|
if (type.represent) {
|
|
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
if (_toString.call(type.represent) === "[object Function]") {
|
|
_result = type.represent(object, style);
|
|
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
_result = type.represent[style](object, style);
|
|
} else {
|
|
throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
}
|
|
state.dump = _result;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function writeNode(state, level, object, block, compact, iskey) {
|
|
state.tag = null;
|
|
state.dump = object;
|
|
if (!detectType(state, object, false)) {
|
|
detectType(state, object, true);
|
|
}
|
|
var type = _toString.call(state.dump);
|
|
if (block) {
|
|
block = state.flowLevel < 0 || state.flowLevel > level;
|
|
}
|
|
var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
|
|
if (objectOrArray) {
|
|
duplicateIndex = state.duplicates.indexOf(object);
|
|
duplicate = duplicateIndex !== -1;
|
|
}
|
|
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
|
|
compact = false;
|
|
}
|
|
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
state.dump = "*ref_" + duplicateIndex;
|
|
} else {
|
|
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
state.usedDuplicates[duplicateIndex] = true;
|
|
}
|
|
if (type === "[object Object]") {
|
|
if (block && Object.keys(state.dump).length !== 0) {
|
|
writeBlockMapping(state, level, state.dump, compact);
|
|
if (duplicate) {
|
|
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
}
|
|
} else {
|
|
writeFlowMapping(state, level, state.dump);
|
|
if (duplicate) {
|
|
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
}
|
|
}
|
|
} else if (type === "[object Array]") {
|
|
var arrayLevel = state.noArrayIndent && level > 0 ? level - 1 : level;
|
|
if (block && state.dump.length !== 0) {
|
|
writeBlockSequence(state, arrayLevel, state.dump, compact);
|
|
if (duplicate) {
|
|
state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
}
|
|
} else {
|
|
writeFlowSequence(state, arrayLevel, state.dump);
|
|
if (duplicate) {
|
|
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
}
|
|
}
|
|
} else if (type === "[object String]") {
|
|
if (state.tag !== "?") {
|
|
writeScalar(state, state.dump, level, iskey);
|
|
}
|
|
} else {
|
|
if (state.skipInvalid)
|
|
return false;
|
|
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
}
|
|
if (state.tag !== null && state.tag !== "?") {
|
|
state.dump = "!<" + state.tag + "> " + state.dump;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function getDuplicateReferences(object, state) {
|
|
var objects = [], duplicatesIndexes = [], index, length;
|
|
inspectNode(object, objects, duplicatesIndexes);
|
|
for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
|
|
state.duplicates.push(objects[duplicatesIndexes[index]]);
|
|
}
|
|
state.usedDuplicates = new Array(length);
|
|
}
|
|
function inspectNode(object, objects, duplicatesIndexes) {
|
|
var objectKeyList, index, length;
|
|
if (object !== null && typeof object === "object") {
|
|
index = objects.indexOf(object);
|
|
if (index !== -1) {
|
|
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
duplicatesIndexes.push(index);
|
|
}
|
|
} else {
|
|
objects.push(object);
|
|
if (Array.isArray(object)) {
|
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
inspectNode(object[index], objects, duplicatesIndexes);
|
|
}
|
|
} else {
|
|
objectKeyList = Object.keys(object);
|
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function dump(input, options) {
|
|
options = options || {};
|
|
var state = new State(options);
|
|
if (!state.noRefs)
|
|
getDuplicateReferences(input, state);
|
|
if (writeNode(state, 0, input, true, true))
|
|
return state.dump + "\n";
|
|
return "";
|
|
}
|
|
function safeDump(input, options) {
|
|
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
}
|
|
module2.exports.dump = dump;
|
|
module2.exports.safeDump = safeDump;
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/lib/js-yaml.js
|
|
var require_js_yaml = __commonJS({
|
|
"node_modules/js-yaml/lib/js-yaml.js"(exports, module2) {
|
|
"use strict";
|
|
var loader = require_loader();
|
|
var dumper = require_dumper();
|
|
function deprecated(name) {
|
|
return function() {
|
|
throw new Error("Function " + name + " is deprecated and cannot be used.");
|
|
};
|
|
}
|
|
module2.exports.Type = require_type();
|
|
module2.exports.Schema = require_schema();
|
|
module2.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
module2.exports.JSON_SCHEMA = require_json();
|
|
module2.exports.CORE_SCHEMA = require_core2();
|
|
module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe();
|
|
module2.exports.DEFAULT_FULL_SCHEMA = require_default_full();
|
|
module2.exports.load = loader.load;
|
|
module2.exports.loadAll = loader.loadAll;
|
|
module2.exports.safeLoad = loader.safeLoad;
|
|
module2.exports.safeLoadAll = loader.safeLoadAll;
|
|
module2.exports.dump = dumper.dump;
|
|
module2.exports.safeDump = dumper.safeDump;
|
|
module2.exports.YAMLException = require_exception();
|
|
module2.exports.MINIMAL_SCHEMA = require_failsafe();
|
|
module2.exports.SAFE_SCHEMA = require_default_safe();
|
|
module2.exports.DEFAULT_SCHEMA = require_default_full();
|
|
module2.exports.scan = deprecated("scan");
|
|
module2.exports.parse = deprecated("parse");
|
|
module2.exports.compose = deprecated("compose");
|
|
module2.exports.addConstructor = deprecated("addConstructor");
|
|
}
|
|
});
|
|
|
|
// node_modules/js-yaml/index.js
|
|
var require_js_yaml2 = __commonJS({
|
|
"node_modules/js-yaml/index.js"(exports, module2) {
|
|
"use strict";
|
|
var yaml2 = require_js_yaml();
|
|
module2.exports = yaml2;
|
|
}
|
|
});
|
|
|
|
// main.ts
|
|
__export(exports, {
|
|
default: () => ObsidianSyncNotionPlugin
|
|
});
|
|
var import_obsidian3 = __toModule(require("obsidian"));
|
|
|
|
// icon.ts
|
|
var import_obsidian = __toModule(require("obsidian"));
|
|
var icons = {
|
|
"notion-logo": `
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100px" height="100px" viewBox="0 0 100 100" version="1.1">
|
|
<g id="surface1">
|
|
<path style=" stroke:none;fill-rule:evenodd;fill:currentColor;fill-opacity:1;" d="M 18.738281 17.796875 C 21.832031 20.308594 22.996094 20.117188 28.804688 19.730469 L 83.582031 16.441406 C 84.746094 16.441406 83.78125 15.28125 83.390625 15.089844 L 74.292969 8.511719 C 72.550781 7.160156 70.230469 5.609375 65.777344 5.996094 L 12.734375 9.867188 C 10.800781 10.058594 10.414062 11.023438 11.183594 11.800781 Z M 22.027344 30.5625 L 22.027344 88.199219 C 22.027344 91.296875 23.574219 92.457031 27.058594 92.265625 L 87.261719 88.78125 C 90.746094 88.589844 91.136719 86.457031 91.136719 83.941406 L 91.136719 26.691406 C 91.136719 24.179688 90.167969 22.824219 88.035156 23.019531 L 25.125 26.691406 C 22.800781 26.886719 22.027344 28.046875 22.027344 30.5625 Z M 81.460938 33.652344 C 81.84375 35.398438 81.460938 37.136719 79.714844 37.332031 L 76.8125 37.910156 L 76.8125 80.460938 C 74.292969 81.816406 71.972656 82.589844 70.035156 82.589844 C 66.9375 82.589844 66.164062 81.621094 63.839844 78.722656 L 44.867188 48.9375 L 44.867188 77.753906 L 50.871094 79.109375 C 50.871094 79.109375 50.871094 82.589844 46.027344 82.589844 L 32.675781 83.363281 C 32.285156 82.589844 32.675781 80.65625 34.027344 80.269531 L 37.511719 79.304688 L 37.511719 41.199219 L 32.675781 40.8125 C 32.285156 39.070312 33.253906 36.558594 35.964844 36.363281 L 50.292969 35.398438 L 70.035156 65.570312 L 70.035156 38.878906 L 65.003906 38.300781 C 64.617188 36.171875 66.164062 34.625 68.097656 34.433594 Z M 8.28125 4.644531 L 63.453125 0.582031 C 70.230469 0 71.972656 0.390625 76.230469 3.484375 L 93.84375 15.859375 C 96.75 17.988281 97.71875 18.570312 97.71875 20.890625 L 97.71875 88.78125 C 97.71875 93.035156 96.167969 95.550781 90.75 95.9375 L 26.675781 99.804688 C 22.609375 100 20.671875 99.421875 18.542969 96.710938 L 5.574219 79.882812 C 3.25 76.785156 2.28125 74.46875 2.28125 71.757812 L 2.28125 11.410156 C 2.28125 7.933594 3.832031 5.03125 8.28125 4.644531 Z M 8.28125 4.644531 "/>
|
|
</g>
|
|
</svg>
|
|
`
|
|
};
|
|
var addIcons = () => {
|
|
Object.keys(icons).forEach((key) => {
|
|
(0, import_obsidian.addIcon)(key, icons[key]);
|
|
});
|
|
};
|
|
|
|
// Upload2Notion.ts
|
|
var import_obsidian2 = __toModule(require("obsidian"));
|
|
var import_martian = __toModule(require_src());
|
|
|
|
// node_modules/yaml-front-matter/src/index.js
|
|
var jsYaml = require_js_yaml2();
|
|
function parse(text, options, loadSafe) {
|
|
let contentKeyName = options && typeof options === "string" ? options : options && options.contentKeyName ? options.contentKeyName : "__content";
|
|
let passThroughOptions = options && typeof options === "object" ? options : void 0;
|
|
let re = /^(-{3}(?:\n|\r)([\w\W]+?)(?:\n|\r)-{3})?([\w\W]*)*/, results = re.exec(text), conf = {}, yamlOrJson;
|
|
if (yamlOrJson = results[2]) {
|
|
if (yamlOrJson.charAt(0) === "{") {
|
|
conf = JSON.parse(yamlOrJson);
|
|
} else {
|
|
if (loadSafe) {
|
|
conf = jsYaml.safeLoad(yamlOrJson, passThroughOptions);
|
|
} else {
|
|
conf = jsYaml.load(yamlOrJson, passThroughOptions);
|
|
}
|
|
}
|
|
}
|
|
conf[contentKeyName] = results[3] || "";
|
|
return conf;
|
|
}
|
|
function loadFront(content, options) {
|
|
return parse(content, options, false);
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/Node.js
|
|
var ALIAS = Symbol.for("yaml.alias");
|
|
var DOC = Symbol.for("yaml.document");
|
|
var MAP = Symbol.for("yaml.map");
|
|
var PAIR = Symbol.for("yaml.pair");
|
|
var SCALAR = Symbol.for("yaml.scalar");
|
|
var SEQ = Symbol.for("yaml.seq");
|
|
var NODE_TYPE = Symbol.for("yaml.node.type");
|
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
|
|
var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
function isCollection(node) {
|
|
if (node && typeof node === "object")
|
|
switch (node[NODE_TYPE]) {
|
|
case MAP:
|
|
case SEQ:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function isNode(node) {
|
|
if (node && typeof node === "object")
|
|
switch (node[NODE_TYPE]) {
|
|
case ALIAS:
|
|
case MAP:
|
|
case SCALAR:
|
|
case SEQ:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
|
|
var NodeBase = class {
|
|
constructor(type) {
|
|
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
}
|
|
clone() {
|
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
if (this.range)
|
|
copy.range = this.range.slice();
|
|
return copy;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/visit.js
|
|
var BREAK = Symbol("break visit");
|
|
var SKIP = Symbol("skip children");
|
|
var REMOVE = Symbol("remove node");
|
|
function visit(node, visitor) {
|
|
const visitor_ = initVisitor(visitor);
|
|
if (isDocument(node)) {
|
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
if (cd === REMOVE)
|
|
node.contents = null;
|
|
} else
|
|
visit_(null, node, visitor_, Object.freeze([]));
|
|
}
|
|
visit.BREAK = BREAK;
|
|
visit.SKIP = SKIP;
|
|
visit.REMOVE = REMOVE;
|
|
function visit_(key, node, visitor, path) {
|
|
const ctrl = callVisitor(key, node, visitor, path);
|
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
replaceNode(key, path, ctrl);
|
|
return visit_(key, ctrl, visitor, path);
|
|
}
|
|
if (typeof ctrl !== "symbol") {
|
|
if (isCollection(node)) {
|
|
path = Object.freeze(path.concat(node));
|
|
for (let i = 0; i < node.items.length; ++i) {
|
|
const ci = visit_(i, node.items[i], visitor, path);
|
|
if (typeof ci === "number")
|
|
i = ci - 1;
|
|
else if (ci === BREAK)
|
|
return BREAK;
|
|
else if (ci === REMOVE) {
|
|
node.items.splice(i, 1);
|
|
i -= 1;
|
|
}
|
|
}
|
|
} else if (isPair(node)) {
|
|
path = Object.freeze(path.concat(node));
|
|
const ck = visit_("key", node.key, visitor, path);
|
|
if (ck === BREAK)
|
|
return BREAK;
|
|
else if (ck === REMOVE)
|
|
node.key = null;
|
|
const cv = visit_("value", node.value, visitor, path);
|
|
if (cv === BREAK)
|
|
return BREAK;
|
|
else if (cv === REMOVE)
|
|
node.value = null;
|
|
}
|
|
}
|
|
return ctrl;
|
|
}
|
|
function visitAsync(node, visitor) {
|
|
return __async(this, null, function* () {
|
|
const visitor_ = initVisitor(visitor);
|
|
if (isDocument(node)) {
|
|
const cd = yield visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
|
|
if (cd === REMOVE)
|
|
node.contents = null;
|
|
} else
|
|
yield visitAsync_(null, node, visitor_, Object.freeze([]));
|
|
});
|
|
}
|
|
visitAsync.BREAK = BREAK;
|
|
visitAsync.SKIP = SKIP;
|
|
visitAsync.REMOVE = REMOVE;
|
|
function visitAsync_(key, node, visitor, path) {
|
|
return __async(this, null, function* () {
|
|
const ctrl = yield callVisitor(key, node, visitor, path);
|
|
if (isNode(ctrl) || isPair(ctrl)) {
|
|
replaceNode(key, path, ctrl);
|
|
return visitAsync_(key, ctrl, visitor, path);
|
|
}
|
|
if (typeof ctrl !== "symbol") {
|
|
if (isCollection(node)) {
|
|
path = Object.freeze(path.concat(node));
|
|
for (let i = 0; i < node.items.length; ++i) {
|
|
const ci = yield visitAsync_(i, node.items[i], visitor, path);
|
|
if (typeof ci === "number")
|
|
i = ci - 1;
|
|
else if (ci === BREAK)
|
|
return BREAK;
|
|
else if (ci === REMOVE) {
|
|
node.items.splice(i, 1);
|
|
i -= 1;
|
|
}
|
|
}
|
|
} else if (isPair(node)) {
|
|
path = Object.freeze(path.concat(node));
|
|
const ck = yield visitAsync_("key", node.key, visitor, path);
|
|
if (ck === BREAK)
|
|
return BREAK;
|
|
else if (ck === REMOVE)
|
|
node.key = null;
|
|
const cv = yield visitAsync_("value", node.value, visitor, path);
|
|
if (cv === BREAK)
|
|
return BREAK;
|
|
else if (cv === REMOVE)
|
|
node.value = null;
|
|
}
|
|
}
|
|
return ctrl;
|
|
});
|
|
}
|
|
function initVisitor(visitor) {
|
|
if (typeof visitor === "object" && (visitor.Collection || visitor.Node || visitor.Value)) {
|
|
return Object.assign({
|
|
Alias: visitor.Node,
|
|
Map: visitor.Node,
|
|
Scalar: visitor.Node,
|
|
Seq: visitor.Node
|
|
}, visitor.Value && {
|
|
Map: visitor.Value,
|
|
Scalar: visitor.Value,
|
|
Seq: visitor.Value
|
|
}, visitor.Collection && {
|
|
Map: visitor.Collection,
|
|
Seq: visitor.Collection
|
|
}, visitor);
|
|
}
|
|
return visitor;
|
|
}
|
|
function callVisitor(key, node, visitor, path) {
|
|
var _a, _b, _c, _d, _e;
|
|
if (typeof visitor === "function")
|
|
return visitor(key, node, path);
|
|
if (isMap(node))
|
|
return (_a = visitor.Map) == null ? void 0 : _a.call(visitor, key, node, path);
|
|
if (isSeq(node))
|
|
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path);
|
|
if (isPair(node))
|
|
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path);
|
|
if (isScalar(node))
|
|
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path);
|
|
if (isAlias(node))
|
|
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path);
|
|
return void 0;
|
|
}
|
|
function replaceNode(key, path, node) {
|
|
const parent = path[path.length - 1];
|
|
if (isCollection(parent)) {
|
|
parent.items[key] = node;
|
|
} else if (isPair(parent)) {
|
|
if (key === "key")
|
|
parent.key = node;
|
|
else
|
|
parent.value = node;
|
|
} else if (isDocument(parent)) {
|
|
parent.contents = node;
|
|
} else {
|
|
const pt = isAlias(parent) ? "alias" : "scalar";
|
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
}
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/doc/directives.js
|
|
var escapeChars = {
|
|
"!": "%21",
|
|
",": "%2C",
|
|
"[": "%5B",
|
|
"]": "%5D",
|
|
"{": "%7B",
|
|
"}": "%7D"
|
|
};
|
|
var escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]);
|
|
var Directives = class {
|
|
constructor(yaml2, tags) {
|
|
this.docStart = null;
|
|
this.docEnd = false;
|
|
this.yaml = Object.assign({}, Directives.defaultYaml, yaml2);
|
|
this.tags = Object.assign({}, Directives.defaultTags, tags);
|
|
}
|
|
clone() {
|
|
const copy = new Directives(this.yaml, this.tags);
|
|
copy.docStart = this.docStart;
|
|
return copy;
|
|
}
|
|
atDocument() {
|
|
const res = new Directives(this.yaml, this.tags);
|
|
switch (this.yaml.version) {
|
|
case "1.1":
|
|
this.atNextDocument = true;
|
|
break;
|
|
case "1.2":
|
|
this.atNextDocument = false;
|
|
this.yaml = {
|
|
explicit: Directives.defaultYaml.explicit,
|
|
version: "1.2"
|
|
};
|
|
this.tags = Object.assign({}, Directives.defaultTags);
|
|
break;
|
|
}
|
|
return res;
|
|
}
|
|
add(line, onError) {
|
|
if (this.atNextDocument) {
|
|
this.yaml = { explicit: Directives.defaultYaml.explicit, version: "1.1" };
|
|
this.tags = Object.assign({}, Directives.defaultTags);
|
|
this.atNextDocument = false;
|
|
}
|
|
const parts = line.trim().split(/[ \t]+/);
|
|
const name = parts.shift();
|
|
switch (name) {
|
|
case "%TAG": {
|
|
if (parts.length !== 2) {
|
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
if (parts.length < 2)
|
|
return false;
|
|
}
|
|
const [handle, prefix] = parts;
|
|
this.tags[handle] = prefix;
|
|
return true;
|
|
}
|
|
case "%YAML": {
|
|
this.yaml.explicit = true;
|
|
if (parts.length !== 1) {
|
|
onError(0, "%YAML directive should contain exactly one part");
|
|
return false;
|
|
}
|
|
const [version] = parts;
|
|
if (version === "1.1" || version === "1.2") {
|
|
this.yaml.version = version;
|
|
return true;
|
|
} else {
|
|
const isValid = /^\d+\.\d+$/.test(version);
|
|
onError(6, `Unsupported YAML version ${version}`, isValid);
|
|
return false;
|
|
}
|
|
}
|
|
default:
|
|
onError(0, `Unknown directive ${name}`, true);
|
|
return false;
|
|
}
|
|
}
|
|
tagName(source, onError) {
|
|
if (source === "!")
|
|
return "!";
|
|
if (source[0] !== "!") {
|
|
onError(`Not a valid tag: ${source}`);
|
|
return null;
|
|
}
|
|
if (source[1] === "<") {
|
|
const verbatim = source.slice(2, -1);
|
|
if (verbatim === "!" || verbatim === "!!") {
|
|
onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
|
|
return null;
|
|
}
|
|
if (source[source.length - 1] !== ">")
|
|
onError("Verbatim tags must end with a >");
|
|
return verbatim;
|
|
}
|
|
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/);
|
|
if (!suffix)
|
|
onError(`The ${source} tag has no suffix`);
|
|
const prefix = this.tags[handle];
|
|
if (prefix)
|
|
return prefix + decodeURIComponent(suffix);
|
|
if (handle === "!")
|
|
return source;
|
|
onError(`Could not resolve tag: ${source}`);
|
|
return null;
|
|
}
|
|
tagString(tag) {
|
|
for (const [handle, prefix] of Object.entries(this.tags)) {
|
|
if (tag.startsWith(prefix))
|
|
return handle + escapeTagName(tag.substring(prefix.length));
|
|
}
|
|
return tag[0] === "!" ? tag : `!<${tag}>`;
|
|
}
|
|
toString(doc) {
|
|
const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
|
|
const tagEntries = Object.entries(this.tags);
|
|
let tagNames;
|
|
if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
|
|
const tags = {};
|
|
visit(doc.contents, (_key, node) => {
|
|
if (isNode(node) && node.tag)
|
|
tags[node.tag] = true;
|
|
});
|
|
tagNames = Object.keys(tags);
|
|
} else
|
|
tagNames = [];
|
|
for (const [handle, prefix] of tagEntries) {
|
|
if (handle === "!!" && prefix === "tag:yaml.org,2002:")
|
|
continue;
|
|
if (!doc || tagNames.some((tn) => tn.startsWith(prefix)))
|
|
lines.push(`%TAG ${handle} ${prefix}`);
|
|
}
|
|
return lines.join("\n");
|
|
}
|
|
};
|
|
Directives.defaultYaml = { explicit: false, version: "1.2" };
|
|
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
|
|
// node_modules/yaml/browser/dist/doc/anchors.js
|
|
function anchorIsValid(anchor) {
|
|
if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
|
|
const sa = JSON.stringify(anchor);
|
|
const msg = `Anchor must not contain whitespace or control characters: ${sa}`;
|
|
throw new Error(msg);
|
|
}
|
|
return true;
|
|
}
|
|
function anchorNames(root) {
|
|
const anchors = new Set();
|
|
visit(root, {
|
|
Value(_key, node) {
|
|
if (node.anchor)
|
|
anchors.add(node.anchor);
|
|
}
|
|
});
|
|
return anchors;
|
|
}
|
|
function findNewAnchor(prefix, exclude) {
|
|
for (let i = 1; true; ++i) {
|
|
const name = `${prefix}${i}`;
|
|
if (!exclude.has(name))
|
|
return name;
|
|
}
|
|
}
|
|
function createNodeAnchors(doc, prefix) {
|
|
const aliasObjects = [];
|
|
const sourceObjects = new Map();
|
|
let prevAnchors = null;
|
|
return {
|
|
onAnchor: (source) => {
|
|
aliasObjects.push(source);
|
|
if (!prevAnchors)
|
|
prevAnchors = anchorNames(doc);
|
|
const anchor = findNewAnchor(prefix, prevAnchors);
|
|
prevAnchors.add(anchor);
|
|
return anchor;
|
|
},
|
|
setAnchors: () => {
|
|
for (const source of aliasObjects) {
|
|
const ref = sourceObjects.get(source);
|
|
if (typeof ref === "object" && ref.anchor && (isScalar(ref.node) || isCollection(ref.node))) {
|
|
ref.node.anchor = ref.anchor;
|
|
} else {
|
|
const error = new Error("Failed to resolve repeated object (this should not happen)");
|
|
error.source = source;
|
|
throw error;
|
|
}
|
|
}
|
|
},
|
|
sourceObjects
|
|
};
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/Alias.js
|
|
var Alias = class extends NodeBase {
|
|
constructor(source) {
|
|
super(ALIAS);
|
|
this.source = source;
|
|
Object.defineProperty(this, "tag", {
|
|
set() {
|
|
throw new Error("Alias nodes cannot have tags");
|
|
}
|
|
});
|
|
}
|
|
resolve(doc) {
|
|
let found = void 0;
|
|
visit(doc, {
|
|
Node: (_key, node) => {
|
|
if (node === this)
|
|
return visit.BREAK;
|
|
if (node.anchor === this.source)
|
|
found = node;
|
|
}
|
|
});
|
|
return found;
|
|
}
|
|
toJSON(_arg, ctx) {
|
|
if (!ctx)
|
|
return { source: this.source };
|
|
const { anchors, doc, maxAliasCount } = ctx;
|
|
const source = this.resolve(doc);
|
|
if (!source) {
|
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
throw new ReferenceError(msg);
|
|
}
|
|
const data = anchors.get(source);
|
|
if (!data || data.res === void 0) {
|
|
const msg = "This should not happen: Alias anchor was not resolved?";
|
|
throw new ReferenceError(msg);
|
|
}
|
|
if (maxAliasCount >= 0) {
|
|
data.count += 1;
|
|
if (data.aliasCount === 0)
|
|
data.aliasCount = getAliasCount(doc, source, anchors);
|
|
if (data.count * data.aliasCount > maxAliasCount) {
|
|
const msg = "Excessive alias count indicates a resource exhaustion attack";
|
|
throw new ReferenceError(msg);
|
|
}
|
|
}
|
|
return data.res;
|
|
}
|
|
toString(ctx, _onComment, _onChompKeep) {
|
|
const src = `*${this.source}`;
|
|
if (ctx) {
|
|
anchorIsValid(this.source);
|
|
if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
|
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
throw new Error(msg);
|
|
}
|
|
if (ctx.implicitKey)
|
|
return `${src} `;
|
|
}
|
|
return src;
|
|
}
|
|
};
|
|
function getAliasCount(doc, node, anchors) {
|
|
if (isAlias(node)) {
|
|
const source = node.resolve(doc);
|
|
const anchor = anchors && source && anchors.get(source);
|
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
} else if (isCollection(node)) {
|
|
let count = 0;
|
|
for (const item of node.items) {
|
|
const c = getAliasCount(doc, item, anchors);
|
|
if (c > count)
|
|
count = c;
|
|
}
|
|
return count;
|
|
} else if (isPair(node)) {
|
|
const kc = getAliasCount(doc, node.key, anchors);
|
|
const vc = getAliasCount(doc, node.value, anchors);
|
|
return Math.max(kc, vc);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/toJS.js
|
|
function toJS(value, arg, ctx) {
|
|
if (Array.isArray(value))
|
|
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
if (value && typeof value.toJSON === "function") {
|
|
if (!ctx || !hasAnchor(value))
|
|
return value.toJSON(arg, ctx);
|
|
const data = { aliasCount: 0, count: 1, res: void 0 };
|
|
ctx.anchors.set(value, data);
|
|
ctx.onCreate = (res2) => {
|
|
data.res = res2;
|
|
delete ctx.onCreate;
|
|
};
|
|
const res = value.toJSON(arg, ctx);
|
|
if (ctx.onCreate)
|
|
ctx.onCreate(res);
|
|
return res;
|
|
}
|
|
if (typeof value === "bigint" && !(ctx == null ? void 0 : ctx.keep))
|
|
return Number(value);
|
|
return value;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/Scalar.js
|
|
var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
|
|
var Scalar = class extends NodeBase {
|
|
constructor(value) {
|
|
super(SCALAR);
|
|
this.value = value;
|
|
}
|
|
toJSON(arg, ctx) {
|
|
return (ctx == null ? void 0 : ctx.keep) ? this.value : toJS(this.value, arg, ctx);
|
|
}
|
|
toString() {
|
|
return String(this.value);
|
|
}
|
|
};
|
|
Scalar.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
Scalar.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
Scalar.PLAIN = "PLAIN";
|
|
Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
|
|
// node_modules/yaml/browser/dist/doc/createNode.js
|
|
var defaultTagPrefix = "tag:yaml.org,2002:";
|
|
function findTagObject(value, tagName, tags) {
|
|
var _a;
|
|
if (tagName) {
|
|
const match = tags.filter((t) => t.tag === tagName);
|
|
const tagObj = (_a = match.find((t) => !t.format)) != null ? _a : match[0];
|
|
if (!tagObj)
|
|
throw new Error(`Tag ${tagName} not found`);
|
|
return tagObj;
|
|
}
|
|
return tags.find((t) => {
|
|
var _a2;
|
|
return ((_a2 = t.identify) == null ? void 0 : _a2.call(t, value)) && !t.format;
|
|
});
|
|
}
|
|
function createNode(value, tagName, ctx) {
|
|
var _a, _b;
|
|
if (isDocument(value))
|
|
value = value.contents;
|
|
if (isNode(value))
|
|
return value;
|
|
if (isPair(value)) {
|
|
const map2 = (_b = (_a = ctx.schema[MAP]).createNode) == null ? void 0 : _b.call(_a, ctx.schema, null, ctx);
|
|
map2.items.push(value);
|
|
return map2;
|
|
}
|
|
if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
|
|
value = value.valueOf();
|
|
}
|
|
const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema4, sourceObjects } = ctx;
|
|
let ref = void 0;
|
|
if (aliasDuplicateObjects && value && typeof value === "object") {
|
|
ref = sourceObjects.get(value);
|
|
if (ref) {
|
|
if (!ref.anchor)
|
|
ref.anchor = onAnchor(value);
|
|
return new Alias(ref.anchor);
|
|
} else {
|
|
ref = { anchor: null, node: null };
|
|
sourceObjects.set(value, ref);
|
|
}
|
|
}
|
|
if (tagName == null ? void 0 : tagName.startsWith("!!"))
|
|
tagName = defaultTagPrefix + tagName.slice(2);
|
|
let tagObj = findTagObject(value, tagName, schema4.tags);
|
|
if (!tagObj) {
|
|
if (value && typeof value.toJSON === "function") {
|
|
value = value.toJSON();
|
|
}
|
|
if (!value || typeof value !== "object") {
|
|
const node2 = new Scalar(value);
|
|
if (ref)
|
|
ref.node = node2;
|
|
return node2;
|
|
}
|
|
tagObj = value instanceof Map ? schema4[MAP] : Symbol.iterator in Object(value) ? schema4[SEQ] : schema4[MAP];
|
|
}
|
|
if (onTagObj) {
|
|
onTagObj(tagObj);
|
|
delete ctx.onTagObj;
|
|
}
|
|
const node = (tagObj == null ? void 0 : tagObj.createNode) ? tagObj.createNode(ctx.schema, value, ctx) : new Scalar(value);
|
|
if (tagName)
|
|
node.tag = tagName;
|
|
if (ref)
|
|
ref.node = node;
|
|
return node;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/Collection.js
|
|
function collectionFromPath(schema4, path, value) {
|
|
let v = value;
|
|
for (let i = path.length - 1; i >= 0; --i) {
|
|
const k = path[i];
|
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
const a = [];
|
|
a[k] = v;
|
|
v = a;
|
|
} else {
|
|
v = new Map([[k, v]]);
|
|
}
|
|
}
|
|
return createNode(v, void 0, {
|
|
aliasDuplicateObjects: false,
|
|
keepUndefined: false,
|
|
onAnchor: () => {
|
|
throw new Error("This should not happen, please report a bug.");
|
|
},
|
|
schema: schema4,
|
|
sourceObjects: new Map()
|
|
});
|
|
}
|
|
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
var Collection = class extends NodeBase {
|
|
constructor(type, schema4) {
|
|
super(type);
|
|
Object.defineProperty(this, "schema", {
|
|
value: schema4,
|
|
configurable: true,
|
|
enumerable: false,
|
|
writable: true
|
|
});
|
|
}
|
|
clone(schema4) {
|
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
if (schema4)
|
|
copy.schema = schema4;
|
|
copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema4) : it);
|
|
if (this.range)
|
|
copy.range = this.range.slice();
|
|
return copy;
|
|
}
|
|
addIn(path, value) {
|
|
if (isEmptyPath(path))
|
|
this.add(value);
|
|
else {
|
|
const [key, ...rest] = path;
|
|
const node = this.get(key, true);
|
|
if (isCollection(node))
|
|
node.addIn(rest, value);
|
|
else if (node === void 0 && this.schema)
|
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
else
|
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
}
|
|
}
|
|
deleteIn(path) {
|
|
const [key, ...rest] = path;
|
|
if (rest.length === 0)
|
|
return this.delete(key);
|
|
const node = this.get(key, true);
|
|
if (isCollection(node))
|
|
return node.deleteIn(rest);
|
|
else
|
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
}
|
|
getIn(path, keepScalar) {
|
|
const [key, ...rest] = path;
|
|
const node = this.get(key, true);
|
|
if (rest.length === 0)
|
|
return !keepScalar && isScalar(node) ? node.value : node;
|
|
else
|
|
return isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
}
|
|
hasAllNullValues(allowScalar) {
|
|
return this.items.every((node) => {
|
|
if (!isPair(node))
|
|
return false;
|
|
const n = node.value;
|
|
return n == null || allowScalar && isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
});
|
|
}
|
|
hasIn(path) {
|
|
const [key, ...rest] = path;
|
|
if (rest.length === 0)
|
|
return this.has(key);
|
|
const node = this.get(key, true);
|
|
return isCollection(node) ? node.hasIn(rest) : false;
|
|
}
|
|
setIn(path, value) {
|
|
const [key, ...rest] = path;
|
|
if (rest.length === 0) {
|
|
this.set(key, value);
|
|
} else {
|
|
const node = this.get(key, true);
|
|
if (isCollection(node))
|
|
node.setIn(rest, value);
|
|
else if (node === void 0 && this.schema)
|
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
else
|
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
}
|
|
}
|
|
};
|
|
Collection.maxFlowStringSingleLineLength = 60;
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringifyComment.js
|
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
function indentComment(comment, indent) {
|
|
if (/^\n+$/.test(comment))
|
|
return comment.substring(1);
|
|
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
|
|
}
|
|
var lineComment = (str, indent, comment) => str.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment;
|
|
|
|
// node_modules/yaml/browser/dist/stringify/foldFlowLines.js
|
|
var FOLD_FLOW = "flow";
|
|
var FOLD_BLOCK = "block";
|
|
var FOLD_QUOTED = "quoted";
|
|
function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
if (!lineWidth || lineWidth < 0)
|
|
return text;
|
|
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
|
|
if (text.length <= endStep)
|
|
return text;
|
|
const folds = [];
|
|
const escapedFolds = {};
|
|
let end = lineWidth - indent.length;
|
|
if (typeof indentAtStart === "number") {
|
|
if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
|
|
folds.push(0);
|
|
else
|
|
end = lineWidth - indentAtStart;
|
|
}
|
|
let split = void 0;
|
|
let prev = void 0;
|
|
let overflow = false;
|
|
let i = -1;
|
|
let escStart = -1;
|
|
let escEnd = -1;
|
|
if (mode === FOLD_BLOCK) {
|
|
i = consumeMoreIndentedLines(text, i);
|
|
if (i !== -1)
|
|
end = i + endStep;
|
|
}
|
|
for (let ch; ch = text[i += 1]; ) {
|
|
if (mode === FOLD_QUOTED && ch === "\\") {
|
|
escStart = i;
|
|
switch (text[i + 1]) {
|
|
case "x":
|
|
i += 3;
|
|
break;
|
|
case "u":
|
|
i += 5;
|
|
break;
|
|
case "U":
|
|
i += 9;
|
|
break;
|
|
default:
|
|
i += 1;
|
|
}
|
|
escEnd = i;
|
|
}
|
|
if (ch === "\n") {
|
|
if (mode === FOLD_BLOCK)
|
|
i = consumeMoreIndentedLines(text, i);
|
|
end = i + endStep;
|
|
split = void 0;
|
|
} else {
|
|
if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
|
|
const next = text[i + 1];
|
|
if (next && next !== " " && next !== "\n" && next !== " ")
|
|
split = i;
|
|
}
|
|
if (i >= end) {
|
|
if (split) {
|
|
folds.push(split);
|
|
end = split + endStep;
|
|
split = void 0;
|
|
} else if (mode === FOLD_QUOTED) {
|
|
while (prev === " " || prev === " ") {
|
|
prev = ch;
|
|
ch = text[i += 1];
|
|
overflow = true;
|
|
}
|
|
const j = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
if (escapedFolds[j])
|
|
return text;
|
|
folds.push(j);
|
|
escapedFolds[j] = true;
|
|
end = j + endStep;
|
|
split = void 0;
|
|
} else {
|
|
overflow = true;
|
|
}
|
|
}
|
|
}
|
|
prev = ch;
|
|
}
|
|
if (overflow && onOverflow)
|
|
onOverflow();
|
|
if (folds.length === 0)
|
|
return text;
|
|
if (onFold)
|
|
onFold();
|
|
let res = text.slice(0, folds[0]);
|
|
for (let i2 = 0; i2 < folds.length; ++i2) {
|
|
const fold = folds[i2];
|
|
const end2 = folds[i2 + 1] || text.length;
|
|
if (fold === 0)
|
|
res = `
|
|
${indent}${text.slice(0, end2)}`;
|
|
else {
|
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
res += `${text[fold]}\\`;
|
|
res += `
|
|
${indent}${text.slice(fold + 1, end2)}`;
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
function consumeMoreIndentedLines(text, i) {
|
|
let ch = text[i + 1];
|
|
while (ch === " " || ch === " ") {
|
|
do {
|
|
ch = text[i += 1];
|
|
} while (ch && ch !== "\n");
|
|
ch = text[i + 1];
|
|
}
|
|
return i;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringifyString.js
|
|
var getFoldOptions = (ctx) => ({
|
|
indentAtStart: ctx.indentAtStart,
|
|
lineWidth: ctx.options.lineWidth,
|
|
minContentWidth: ctx.options.minContentWidth
|
|
});
|
|
var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
|
|
function lineLengthOverLimit(str, lineWidth, indentLength) {
|
|
if (!lineWidth || lineWidth < 0)
|
|
return false;
|
|
const limit = lineWidth - indentLength;
|
|
const strLen = str.length;
|
|
if (strLen <= limit)
|
|
return false;
|
|
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
if (str[i] === "\n") {
|
|
if (i - start > limit)
|
|
return true;
|
|
start = i + 1;
|
|
if (strLen - start <= limit)
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function doubleQuotedString(value, ctx) {
|
|
const json = JSON.stringify(value);
|
|
if (ctx.options.doubleQuotedAsJSON)
|
|
return json;
|
|
const { implicitKey } = ctx;
|
|
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
|
|
let str = "";
|
|
let start = 0;
|
|
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
|
|
str += json.slice(start, i) + "\\ ";
|
|
i += 1;
|
|
start = i;
|
|
ch = "\\";
|
|
}
|
|
if (ch === "\\")
|
|
switch (json[i + 1]) {
|
|
case "u":
|
|
{
|
|
str += json.slice(start, i);
|
|
const code = json.substr(i + 2, 4);
|
|
switch (code) {
|
|
case "0000":
|
|
str += "\\0";
|
|
break;
|
|
case "0007":
|
|
str += "\\a";
|
|
break;
|
|
case "000b":
|
|
str += "\\v";
|
|
break;
|
|
case "001b":
|
|
str += "\\e";
|
|
break;
|
|
case "0085":
|
|
str += "\\N";
|
|
break;
|
|
case "00a0":
|
|
str += "\\_";
|
|
break;
|
|
case "2028":
|
|
str += "\\L";
|
|
break;
|
|
case "2029":
|
|
str += "\\P";
|
|
break;
|
|
default:
|
|
if (code.substr(0, 2) === "00")
|
|
str += "\\x" + code.substr(2);
|
|
else
|
|
str += json.substr(i, 6);
|
|
}
|
|
i += 5;
|
|
start = i + 1;
|
|
}
|
|
break;
|
|
case "n":
|
|
if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
|
|
i += 1;
|
|
} else {
|
|
str += json.slice(start, i) + "\n\n";
|
|
while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
|
|
str += "\n";
|
|
i += 2;
|
|
}
|
|
str += indent;
|
|
if (json[i + 2] === " ")
|
|
str += "\\";
|
|
i += 1;
|
|
start = i + 1;
|
|
}
|
|
break;
|
|
default:
|
|
i += 1;
|
|
}
|
|
}
|
|
str = start ? str + json.slice(start) : json;
|
|
return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
|
|
}
|
|
function singleQuotedString(value, ctx) {
|
|
if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
|
|
return doubleQuotedString(value, ctx);
|
|
const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
|
|
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
${indent}`) + "'";
|
|
return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
}
|
|
function quotedString(value, ctx) {
|
|
const { singleQuote } = ctx.options;
|
|
let qs;
|
|
if (singleQuote === false)
|
|
qs = doubleQuotedString;
|
|
else {
|
|
const hasDouble = value.includes('"');
|
|
const hasSingle = value.includes("'");
|
|
if (hasDouble && !hasSingle)
|
|
qs = singleQuotedString;
|
|
else if (hasSingle && !hasDouble)
|
|
qs = doubleQuotedString;
|
|
else
|
|
qs = singleQuote ? singleQuotedString : doubleQuotedString;
|
|
}
|
|
return qs(value, ctx);
|
|
}
|
|
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
if (!blockQuote || /\n[\t ]+$/.test(value) || /^\s*$/.test(value)) {
|
|
return quotedString(value, ctx);
|
|
}
|
|
const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? " " : "");
|
|
const literal = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.BLOCK_FOLDED ? false : type === Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent.length);
|
|
if (!value)
|
|
return literal ? "|\n" : ">\n";
|
|
let chomp;
|
|
let endStart;
|
|
for (endStart = value.length; endStart > 0; --endStart) {
|
|
const ch = value[endStart - 1];
|
|
if (ch !== "\n" && ch !== " " && ch !== " ")
|
|
break;
|
|
}
|
|
let end = value.substring(endStart);
|
|
const endNlPos = end.indexOf("\n");
|
|
if (endNlPos === -1) {
|
|
chomp = "-";
|
|
} else if (value === end || endNlPos !== end.length - 1) {
|
|
chomp = "+";
|
|
if (onChompKeep)
|
|
onChompKeep();
|
|
} else {
|
|
chomp = "";
|
|
}
|
|
if (end) {
|
|
value = value.slice(0, -end.length);
|
|
if (end[end.length - 1] === "\n")
|
|
end = end.slice(0, -1);
|
|
end = end.replace(/\n+(?!\n|$)/g, `$&${indent}`);
|
|
}
|
|
let startWithSpace = false;
|
|
let startEnd;
|
|
let startNlPos = -1;
|
|
for (startEnd = 0; startEnd < value.length; ++startEnd) {
|
|
const ch = value[startEnd];
|
|
if (ch === " ")
|
|
startWithSpace = true;
|
|
else if (ch === "\n")
|
|
startNlPos = startEnd;
|
|
else
|
|
break;
|
|
}
|
|
let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
|
|
if (start) {
|
|
value = value.substring(start.length);
|
|
start = start.replace(/\n+/g, `$&${indent}`);
|
|
}
|
|
const indentSize = indent ? "2" : "1";
|
|
let header = (literal ? "|" : ">") + (startWithSpace ? indentSize : "") + chomp;
|
|
if (comment) {
|
|
header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " "));
|
|
if (onComment)
|
|
onComment();
|
|
}
|
|
if (literal) {
|
|
value = value.replace(/\n+/g, `$&${indent}`);
|
|
return `${header}
|
|
${indent}${start}${value}${end}`;
|
|
}
|
|
value = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
|
|
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx));
|
|
return `${header}
|
|
${indent}${body}`;
|
|
}
|
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
const { type, value } = item;
|
|
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) {
|
|
return quotedString(value, ctx);
|
|
}
|
|
if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
|
|
return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
|
|
}
|
|
if (!implicitKey && !inFlow && type !== Scalar.PLAIN && value.includes("\n")) {
|
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
}
|
|
if (containsDocumentMarker(value)) {
|
|
if (indent === "") {
|
|
ctx.forceBlockIndent = true;
|
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
} else if (implicitKey && indent === indentStep) {
|
|
return quotedString(value, ctx);
|
|
}
|
|
}
|
|
const str = value.replace(/\n+/g, `$&
|
|
${indent}`);
|
|
if (actualString) {
|
|
const test = (tag) => {
|
|
var _a;
|
|
return tag.default && tag.tag !== "tag:yaml.org,2002:str" && ((_a = tag.test) == null ? void 0 : _a.test(str));
|
|
};
|
|
const { compat, tags } = ctx.doc.schema;
|
|
if (tags.some(test) || (compat == null ? void 0 : compat.some(test)))
|
|
return quotedString(value, ctx);
|
|
}
|
|
return implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
}
|
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
const { implicitKey, inFlow } = ctx;
|
|
const ss = typeof item.value === "string" ? item : Object.assign({}, item, { value: String(item.value) });
|
|
let { type } = item;
|
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
|
|
type = Scalar.QUOTE_DOUBLE;
|
|
}
|
|
const _stringify = (_type) => {
|
|
switch (_type) {
|
|
case Scalar.BLOCK_FOLDED:
|
|
case Scalar.BLOCK_LITERAL:
|
|
return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
|
|
case Scalar.QUOTE_DOUBLE:
|
|
return doubleQuotedString(ss.value, ctx);
|
|
case Scalar.QUOTE_SINGLE:
|
|
return singleQuotedString(ss.value, ctx);
|
|
case Scalar.PLAIN:
|
|
return plainString(ss, ctx, onComment, onChompKeep);
|
|
default:
|
|
return null;
|
|
}
|
|
};
|
|
let res = _stringify(type);
|
|
if (res === null) {
|
|
const { defaultKeyType, defaultStringType } = ctx.options;
|
|
const t = implicitKey && defaultKeyType || defaultStringType;
|
|
res = _stringify(t);
|
|
if (res === null)
|
|
throw new Error(`Unsupported default string type ${t}`);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringify.js
|
|
function createStringifyContext(doc, options) {
|
|
const opt = Object.assign({
|
|
blockQuote: true,
|
|
commentString: stringifyComment,
|
|
defaultKeyType: null,
|
|
defaultStringType: "PLAIN",
|
|
directives: null,
|
|
doubleQuotedAsJSON: false,
|
|
doubleQuotedMinMultiLineLength: 40,
|
|
falseStr: "false",
|
|
flowCollectionPadding: true,
|
|
indentSeq: true,
|
|
lineWidth: 80,
|
|
minContentWidth: 20,
|
|
nullStr: "null",
|
|
simpleKeys: false,
|
|
singleQuote: null,
|
|
trueStr: "true",
|
|
verifyAliasOrder: true
|
|
}, doc.schema.toStringOptions, options);
|
|
let inFlow;
|
|
switch (opt.collectionStyle) {
|
|
case "block":
|
|
inFlow = false;
|
|
break;
|
|
case "flow":
|
|
inFlow = true;
|
|
break;
|
|
default:
|
|
inFlow = null;
|
|
}
|
|
return {
|
|
anchors: new Set(),
|
|
doc,
|
|
flowCollectionPadding: opt.flowCollectionPadding ? " " : "",
|
|
indent: "",
|
|
indentStep: typeof opt.indent === "number" ? " ".repeat(opt.indent) : " ",
|
|
inFlow,
|
|
options: opt
|
|
};
|
|
}
|
|
function getTagObject(tags, item) {
|
|
var _a, _b, _c, _d;
|
|
if (item.tag) {
|
|
const match = tags.filter((t) => t.tag === item.tag);
|
|
if (match.length > 0)
|
|
return (_a = match.find((t) => t.format === item.format)) != null ? _a : match[0];
|
|
}
|
|
let tagObj = void 0;
|
|
let obj;
|
|
if (isScalar(item)) {
|
|
obj = item.value;
|
|
const match = tags.filter((t) => {
|
|
var _a2;
|
|
return (_a2 = t.identify) == null ? void 0 : _a2.call(t, obj);
|
|
});
|
|
tagObj = (_b = match.find((t) => t.format === item.format)) != null ? _b : match.find((t) => !t.format);
|
|
} else {
|
|
obj = item;
|
|
tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
|
|
}
|
|
if (!tagObj) {
|
|
const name = (_d = (_c = obj == null ? void 0 : obj.constructor) == null ? void 0 : _c.name) != null ? _d : typeof obj;
|
|
throw new Error(`Tag not resolved for ${name} value`);
|
|
}
|
|
return tagObj;
|
|
}
|
|
function stringifyProps(node, tagObj, { anchors, doc }) {
|
|
if (!doc.directives)
|
|
return "";
|
|
const props = [];
|
|
const anchor = (isScalar(node) || isCollection(node)) && node.anchor;
|
|
if (anchor && anchorIsValid(anchor)) {
|
|
anchors.add(anchor);
|
|
props.push(`&${anchor}`);
|
|
}
|
|
const tag = node.tag ? node.tag : tagObj.default ? null : tagObj.tag;
|
|
if (tag)
|
|
props.push(doc.directives.tagString(tag));
|
|
return props.join(" ");
|
|
}
|
|
function stringify(item, ctx, onComment, onChompKeep) {
|
|
var _a, _b;
|
|
if (isPair(item))
|
|
return item.toString(ctx, onComment, onChompKeep);
|
|
if (isAlias(item)) {
|
|
if (ctx.doc.directives)
|
|
return item.toString(ctx);
|
|
if ((_a = ctx.resolvedAliases) == null ? void 0 : _a.has(item)) {
|
|
throw new TypeError(`Cannot stringify circular structure without alias nodes`);
|
|
} else {
|
|
if (ctx.resolvedAliases)
|
|
ctx.resolvedAliases.add(item);
|
|
else
|
|
ctx.resolvedAliases = new Set([item]);
|
|
item = item.resolve(ctx.doc);
|
|
}
|
|
}
|
|
let tagObj = void 0;
|
|
const node = isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
|
|
if (!tagObj)
|
|
tagObj = getTagObject(ctx.doc.schema.tags, node);
|
|
const props = stringifyProps(node, tagObj, ctx);
|
|
if (props.length > 0)
|
|
ctx.indentAtStart = ((_b = ctx.indentAtStart) != null ? _b : 0) + props.length + 1;
|
|
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : isScalar(node) ? stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
if (!props)
|
|
return str;
|
|
return isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
|
|
${ctx.indent}${str}`;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringifyPair.js
|
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
var _a, _b;
|
|
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
let keyComment = isNode(key) && key.comment || null;
|
|
if (simpleKeys) {
|
|
if (keyComment) {
|
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
}
|
|
if (isCollection(key)) {
|
|
const msg = "With simple keys, collection cannot be used as a key value";
|
|
throw new Error(msg);
|
|
}
|
|
}
|
|
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || isCollection(key) || (isScalar(key) ? key.type === Scalar.BLOCK_FOLDED || key.type === Scalar.BLOCK_LITERAL : typeof key === "object"));
|
|
ctx = Object.assign({}, ctx, {
|
|
allNullValues: false,
|
|
implicitKey: !explicitKey && (simpleKeys || !allNullValues),
|
|
indent: indent + indentStep
|
|
});
|
|
let keyCommentDone = false;
|
|
let chompKeep = false;
|
|
let str = stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
if (!explicitKey && !ctx.inFlow && str.length > 1024) {
|
|
if (simpleKeys)
|
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
explicitKey = true;
|
|
}
|
|
if (ctx.inFlow) {
|
|
if (allNullValues || value == null) {
|
|
if (keyCommentDone && onComment)
|
|
onComment();
|
|
return str === "" ? "?" : explicitKey ? `? ${str}` : str;
|
|
}
|
|
} else if (allNullValues && !simpleKeys || value == null && explicitKey) {
|
|
str = `? ${str}`;
|
|
if (keyComment && !keyCommentDone) {
|
|
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
} else if (chompKeep && onChompKeep)
|
|
onChompKeep();
|
|
return str;
|
|
}
|
|
if (keyCommentDone)
|
|
keyComment = null;
|
|
if (explicitKey) {
|
|
if (keyComment)
|
|
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
str = `? ${str}
|
|
${indent}:`;
|
|
} else {
|
|
str = `${str}:`;
|
|
if (keyComment)
|
|
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
}
|
|
let vsb, vcb, valueComment;
|
|
if (isNode(value)) {
|
|
vsb = !!value.spaceBefore;
|
|
vcb = value.commentBefore;
|
|
valueComment = value.comment;
|
|
} else {
|
|
vsb = false;
|
|
vcb = null;
|
|
valueComment = null;
|
|
if (value && typeof value === "object")
|
|
value = doc.createNode(value);
|
|
}
|
|
ctx.implicitKey = false;
|
|
if (!explicitKey && !keyComment && isScalar(value))
|
|
ctx.indentAtStart = str.length + 1;
|
|
chompKeep = false;
|
|
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && isSeq(value) && !value.flow && !value.tag && !value.anchor) {
|
|
ctx.indent = ctx.indent.substring(2);
|
|
}
|
|
let valueCommentDone = false;
|
|
const valueStr = stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
|
|
let ws = " ";
|
|
if (keyComment || vsb || vcb) {
|
|
ws = vsb ? "\n" : "";
|
|
if (vcb) {
|
|
const cs = commentString(vcb);
|
|
ws += `
|
|
${indentComment(cs, ctx.indent)}`;
|
|
}
|
|
if (valueStr === "" && !ctx.inFlow) {
|
|
if (ws === "\n")
|
|
ws = "\n\n";
|
|
} else {
|
|
ws += `
|
|
${ctx.indent}`;
|
|
}
|
|
} else if (!explicitKey && isCollection(value)) {
|
|
const vs0 = valueStr[0];
|
|
const nl0 = valueStr.indexOf("\n");
|
|
const hasNewline = nl0 !== -1;
|
|
const flow = (_b = (_a = ctx.inFlow) != null ? _a : value.flow) != null ? _b : value.items.length === 0;
|
|
if (hasNewline || !flow) {
|
|
let hasPropsLine = false;
|
|
if (hasNewline && (vs0 === "&" || vs0 === "!")) {
|
|
let sp0 = valueStr.indexOf(" ");
|
|
if (vs0 === "&" && sp0 !== -1 && sp0 < nl0 && valueStr[sp0 + 1] === "!") {
|
|
sp0 = valueStr.indexOf(" ", sp0 + 1);
|
|
}
|
|
if (sp0 === -1 || nl0 < sp0)
|
|
hasPropsLine = true;
|
|
}
|
|
if (!hasPropsLine)
|
|
ws = `
|
|
${ctx.indent}`;
|
|
}
|
|
} else if (valueStr === "" || valueStr[0] === "\n") {
|
|
ws = "";
|
|
}
|
|
str += ws + valueStr;
|
|
if (ctx.inFlow) {
|
|
if (valueCommentDone && onComment)
|
|
onComment();
|
|
} else if (valueComment && !valueCommentDone) {
|
|
str += lineComment(str, ctx.indent, commentString(valueComment));
|
|
} else if (chompKeep && onChompKeep) {
|
|
onChompKeep();
|
|
}
|
|
return str;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/log.js
|
|
function warn(logLevel, warning) {
|
|
if (logLevel === "debug" || logLevel === "warn") {
|
|
if (typeof process !== "undefined" && process.emitWarning)
|
|
process.emitWarning(warning);
|
|
else
|
|
console.warn(warning);
|
|
}
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
|
|
var MERGE_KEY = "<<";
|
|
function addPairToJSMap(ctx, map2, { key, value }) {
|
|
if ((ctx == null ? void 0 : ctx.doc.schema.merge) && isMergeKey(key)) {
|
|
value = isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
if (isSeq(value))
|
|
for (const it of value.items)
|
|
mergeToJSMap(ctx, map2, it);
|
|
else if (Array.isArray(value))
|
|
for (const it of value)
|
|
mergeToJSMap(ctx, map2, it);
|
|
else
|
|
mergeToJSMap(ctx, map2, value);
|
|
} else {
|
|
const jsKey = toJS(key, "", ctx);
|
|
if (map2 instanceof Map) {
|
|
map2.set(jsKey, toJS(value, jsKey, ctx));
|
|
} else if (map2 instanceof Set) {
|
|
map2.add(jsKey);
|
|
} else {
|
|
const stringKey = stringifyKey(key, jsKey, ctx);
|
|
const jsValue = toJS(value, stringKey, ctx);
|
|
if (stringKey in map2)
|
|
Object.defineProperty(map2, stringKey, {
|
|
value: jsValue,
|
|
writable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
else
|
|
map2[stringKey] = jsValue;
|
|
}
|
|
}
|
|
return map2;
|
|
}
|
|
var isMergeKey = (key) => key === MERGE_KEY || isScalar(key) && key.value === MERGE_KEY && (!key.type || key.type === Scalar.PLAIN);
|
|
function mergeToJSMap(ctx, map2, value) {
|
|
const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
|
|
if (!isMap(source))
|
|
throw new Error("Merge sources must be maps or map aliases");
|
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
for (const [key, value2] of srcMap) {
|
|
if (map2 instanceof Map) {
|
|
if (!map2.has(key))
|
|
map2.set(key, value2);
|
|
} else if (map2 instanceof Set) {
|
|
map2.add(key);
|
|
} else if (!Object.prototype.hasOwnProperty.call(map2, key)) {
|
|
Object.defineProperty(map2, key, {
|
|
value: value2,
|
|
writable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
return map2;
|
|
}
|
|
function stringifyKey(key, jsKey, ctx) {
|
|
if (jsKey === null)
|
|
return "";
|
|
if (typeof jsKey !== "object")
|
|
return String(jsKey);
|
|
if (isNode(key) && ctx && ctx.doc) {
|
|
const strCtx = createStringifyContext(ctx.doc, {});
|
|
strCtx.anchors = new Set();
|
|
for (const node of ctx.anchors.keys())
|
|
strCtx.anchors.add(node.anchor);
|
|
strCtx.inFlow = true;
|
|
strCtx.inStringifyKey = true;
|
|
const strKey = key.toString(strCtx);
|
|
if (!ctx.mapKeyWarned) {
|
|
let jsonStr = JSON.stringify(strKey);
|
|
if (jsonStr.length > 40)
|
|
jsonStr = jsonStr.substring(0, 36) + '..."';
|
|
warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
|
|
ctx.mapKeyWarned = true;
|
|
}
|
|
return strKey;
|
|
}
|
|
return JSON.stringify(jsKey);
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/Pair.js
|
|
function createPair(key, value, ctx) {
|
|
const k = createNode(key, void 0, ctx);
|
|
const v = createNode(value, void 0, ctx);
|
|
return new Pair(k, v);
|
|
}
|
|
var Pair = class {
|
|
constructor(key, value = null) {
|
|
Object.defineProperty(this, NODE_TYPE, { value: PAIR });
|
|
this.key = key;
|
|
this.value = value;
|
|
}
|
|
clone(schema4) {
|
|
let { key, value } = this;
|
|
if (isNode(key))
|
|
key = key.clone(schema4);
|
|
if (isNode(value))
|
|
value = value.clone(schema4);
|
|
return new Pair(key, value);
|
|
}
|
|
toJSON(_, ctx) {
|
|
const pair = (ctx == null ? void 0 : ctx.mapAsMap) ? new Map() : {};
|
|
return addPairToJSMap(ctx, pair, this);
|
|
}
|
|
toString(ctx, onComment, onChompKeep) {
|
|
return (ctx == null ? void 0 : ctx.doc) ? stringifyPair(this, ctx, onComment, onChompKeep) : JSON.stringify(this);
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringifyCollection.js
|
|
function stringifyCollection(collection, ctx, options) {
|
|
var _a;
|
|
const flow = (_a = ctx.inFlow) != null ? _a : collection.flow;
|
|
const stringify4 = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
return stringify4(collection, ctx, options);
|
|
}
|
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
const { indent, options: { commentString } } = ctx;
|
|
const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
|
|
let chompKeep = false;
|
|
const lines = [];
|
|
for (let i = 0; i < items.length; ++i) {
|
|
const item = items[i];
|
|
let comment2 = null;
|
|
if (isNode(item)) {
|
|
if (!chompKeep && item.spaceBefore)
|
|
lines.push("");
|
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
if (item.comment)
|
|
comment2 = item.comment;
|
|
} else if (isPair(item)) {
|
|
const ik = isNode(item.key) ? item.key : null;
|
|
if (ik) {
|
|
if (!chompKeep && ik.spaceBefore)
|
|
lines.push("");
|
|
addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);
|
|
}
|
|
}
|
|
chompKeep = false;
|
|
let str2 = stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
if (comment2)
|
|
str2 += lineComment(str2, itemIndent, commentString(comment2));
|
|
if (chompKeep && comment2)
|
|
chompKeep = false;
|
|
lines.push(blockItemPrefix + str2);
|
|
}
|
|
let str;
|
|
if (lines.length === 0) {
|
|
str = flowChars.start + flowChars.end;
|
|
} else {
|
|
str = lines[0];
|
|
for (let i = 1; i < lines.length; ++i) {
|
|
const line = lines[i];
|
|
str += line ? `
|
|
${indent}${line}` : "\n";
|
|
}
|
|
}
|
|
if (comment) {
|
|
str += "\n" + indentComment(commentString(comment), indent);
|
|
if (onComment)
|
|
onComment();
|
|
} else if (chompKeep && onChompKeep)
|
|
onChompKeep();
|
|
return str;
|
|
}
|
|
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
|
|
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
itemIndent += indentStep;
|
|
const itemCtx = Object.assign({}, ctx, {
|
|
indent: itemIndent,
|
|
inFlow: true,
|
|
type: null
|
|
});
|
|
let reqNewline = false;
|
|
let linesAtValue = 0;
|
|
const lines = [];
|
|
for (let i = 0; i < items.length; ++i) {
|
|
const item = items[i];
|
|
let comment2 = null;
|
|
if (isNode(item)) {
|
|
if (item.spaceBefore)
|
|
lines.push("");
|
|
addCommentBefore(ctx, lines, item.commentBefore, false);
|
|
if (item.comment)
|
|
comment2 = item.comment;
|
|
} else if (isPair(item)) {
|
|
const ik = isNode(item.key) ? item.key : null;
|
|
if (ik) {
|
|
if (ik.spaceBefore)
|
|
lines.push("");
|
|
addCommentBefore(ctx, lines, ik.commentBefore, false);
|
|
if (ik.comment)
|
|
reqNewline = true;
|
|
}
|
|
const iv = isNode(item.value) ? item.value : null;
|
|
if (iv) {
|
|
if (iv.comment)
|
|
comment2 = iv.comment;
|
|
if (iv.commentBefore)
|
|
reqNewline = true;
|
|
} else if (item.value == null && ik && ik.comment) {
|
|
comment2 = ik.comment;
|
|
}
|
|
}
|
|
if (comment2)
|
|
reqNewline = true;
|
|
let str2 = stringify(item, itemCtx, () => comment2 = null);
|
|
if (i < items.length - 1)
|
|
str2 += ",";
|
|
if (comment2)
|
|
str2 += lineComment(str2, itemIndent, commentString(comment2));
|
|
if (!reqNewline && (lines.length > linesAtValue || str2.includes("\n")))
|
|
reqNewline = true;
|
|
lines.push(str2);
|
|
linesAtValue = lines.length;
|
|
}
|
|
let str;
|
|
const { start, end } = flowChars;
|
|
if (lines.length === 0) {
|
|
str = start + end;
|
|
} else {
|
|
if (!reqNewline) {
|
|
const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
|
|
reqNewline = len > Collection.maxFlowStringSingleLineLength;
|
|
}
|
|
if (reqNewline) {
|
|
str = start;
|
|
for (const line of lines)
|
|
str += line ? `
|
|
${indentStep}${indent}${line}` : "\n";
|
|
str += `
|
|
${indent}${end}`;
|
|
} else {
|
|
str = `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
|
|
}
|
|
}
|
|
if (comment) {
|
|
str += lineComment(str, commentString(comment), indent);
|
|
if (onComment)
|
|
onComment();
|
|
}
|
|
return str;
|
|
}
|
|
function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
|
|
if (comment && chompKeep)
|
|
comment = comment.replace(/^\n+/, "");
|
|
if (comment) {
|
|
const ic = indentComment(commentString(comment), indent);
|
|
lines.push(ic.trimStart());
|
|
}
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/nodes/YAMLMap.js
|
|
function findPair(items, key) {
|
|
const k = isScalar(key) ? key.value : key;
|
|
for (const it of items) {
|
|
if (isPair(it)) {
|
|
if (it.key === key || it.key === k)
|
|
return it;
|
|
if (isScalar(it.key) && it.key.value === k)
|
|
return it;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
var YAMLMap = class extends Collection {
|
|
static get tagName() {
|
|
return "tag:yaml.org,2002:map";
|
|
}
|
|
constructor(schema4) {
|
|
super(MAP, schema4);
|
|
this.items = [];
|
|
}
|
|
add(pair, overwrite) {
|
|
var _a;
|
|
let _pair;
|
|
if (isPair(pair))
|
|
_pair = pair;
|
|
else if (!pair || typeof pair !== "object" || !("key" in pair)) {
|
|
_pair = new Pair(pair, pair == null ? void 0 : pair.value);
|
|
} else
|
|
_pair = new Pair(pair.key, pair.value);
|
|
const prev = findPair(this.items, _pair.key);
|
|
const sortEntries = (_a = this.schema) == null ? void 0 : _a.sortMapEntries;
|
|
if (prev) {
|
|
if (!overwrite)
|
|
throw new Error(`Key ${_pair.key} already set`);
|
|
if (isScalar(prev.value) && isScalarValue(_pair.value))
|
|
prev.value.value = _pair.value;
|
|
else
|
|
prev.value = _pair.value;
|
|
} else if (sortEntries) {
|
|
const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0);
|
|
if (i === -1)
|
|
this.items.push(_pair);
|
|
else
|
|
this.items.splice(i, 0, _pair);
|
|
} else {
|
|
this.items.push(_pair);
|
|
}
|
|
}
|
|
delete(key) {
|
|
const it = findPair(this.items, key);
|
|
if (!it)
|
|
return false;
|
|
const del = this.items.splice(this.items.indexOf(it), 1);
|
|
return del.length > 0;
|
|
}
|
|
get(key, keepScalar) {
|
|
var _a;
|
|
const it = findPair(this.items, key);
|
|
const node = it == null ? void 0 : it.value;
|
|
return (_a = !keepScalar && isScalar(node) ? node.value : node) != null ? _a : void 0;
|
|
}
|
|
has(key) {
|
|
return !!findPair(this.items, key);
|
|
}
|
|
set(key, value) {
|
|
this.add(new Pair(key, value), true);
|
|
}
|
|
toJSON(_, ctx, Type) {
|
|
const map2 = Type ? new Type() : (ctx == null ? void 0 : ctx.mapAsMap) ? new Map() : {};
|
|
if (ctx == null ? void 0 : ctx.onCreate)
|
|
ctx.onCreate(map2);
|
|
for (const item of this.items)
|
|
addPairToJSMap(ctx, map2, item);
|
|
return map2;
|
|
}
|
|
toString(ctx, onComment, onChompKeep) {
|
|
if (!ctx)
|
|
return JSON.stringify(this);
|
|
for (const item of this.items) {
|
|
if (!isPair(item))
|
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
|
|
}
|
|
if (!ctx.allNullValues && this.hasAllNullValues(false))
|
|
ctx = Object.assign({}, ctx, { allNullValues: true });
|
|
return stringifyCollection(this, ctx, {
|
|
blockItemPrefix: "",
|
|
flowChars: { start: "{", end: "}" },
|
|
itemIndent: ctx.indent || "",
|
|
onChompKeep,
|
|
onComment
|
|
});
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/common/map.js
|
|
function createMap(schema4, obj, ctx) {
|
|
const { keepUndefined, replacer } = ctx;
|
|
const map2 = new YAMLMap(schema4);
|
|
const add = (key, value) => {
|
|
if (typeof replacer === "function")
|
|
value = replacer.call(obj, key, value);
|
|
else if (Array.isArray(replacer) && !replacer.includes(key))
|
|
return;
|
|
if (value !== void 0 || keepUndefined)
|
|
map2.items.push(createPair(key, value, ctx));
|
|
};
|
|
if (obj instanceof Map) {
|
|
for (const [key, value] of obj)
|
|
add(key, value);
|
|
} else if (obj && typeof obj === "object") {
|
|
for (const key of Object.keys(obj))
|
|
add(key, obj[key]);
|
|
}
|
|
if (typeof schema4.sortMapEntries === "function") {
|
|
map2.items.sort(schema4.sortMapEntries);
|
|
}
|
|
return map2;
|
|
}
|
|
var map = {
|
|
collection: "map",
|
|
createNode: createMap,
|
|
default: true,
|
|
nodeClass: YAMLMap,
|
|
tag: "tag:yaml.org,2002:map",
|
|
resolve(map2, onError) {
|
|
if (!isMap(map2))
|
|
onError("Expected a mapping for this tag");
|
|
return map2;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/nodes/YAMLSeq.js
|
|
var YAMLSeq = class extends Collection {
|
|
static get tagName() {
|
|
return "tag:yaml.org,2002:seq";
|
|
}
|
|
constructor(schema4) {
|
|
super(SEQ, schema4);
|
|
this.items = [];
|
|
}
|
|
add(value) {
|
|
this.items.push(value);
|
|
}
|
|
delete(key) {
|
|
const idx = asItemIndex(key);
|
|
if (typeof idx !== "number")
|
|
return false;
|
|
const del = this.items.splice(idx, 1);
|
|
return del.length > 0;
|
|
}
|
|
get(key, keepScalar) {
|
|
const idx = asItemIndex(key);
|
|
if (typeof idx !== "number")
|
|
return void 0;
|
|
const it = this.items[idx];
|
|
return !keepScalar && isScalar(it) ? it.value : it;
|
|
}
|
|
has(key) {
|
|
const idx = asItemIndex(key);
|
|
return typeof idx === "number" && idx < this.items.length;
|
|
}
|
|
set(key, value) {
|
|
const idx = asItemIndex(key);
|
|
if (typeof idx !== "number")
|
|
throw new Error(`Expected a valid index, not ${key}.`);
|
|
const prev = this.items[idx];
|
|
if (isScalar(prev) && isScalarValue(value))
|
|
prev.value = value;
|
|
else
|
|
this.items[idx] = value;
|
|
}
|
|
toJSON(_, ctx) {
|
|
const seq2 = [];
|
|
if (ctx == null ? void 0 : ctx.onCreate)
|
|
ctx.onCreate(seq2);
|
|
let i = 0;
|
|
for (const item of this.items)
|
|
seq2.push(toJS(item, String(i++), ctx));
|
|
return seq2;
|
|
}
|
|
toString(ctx, onComment, onChompKeep) {
|
|
if (!ctx)
|
|
return JSON.stringify(this);
|
|
return stringifyCollection(this, ctx, {
|
|
blockItemPrefix: "- ",
|
|
flowChars: { start: "[", end: "]" },
|
|
itemIndent: (ctx.indent || "") + " ",
|
|
onChompKeep,
|
|
onComment
|
|
});
|
|
}
|
|
};
|
|
function asItemIndex(key) {
|
|
let idx = isScalar(key) ? key.value : key;
|
|
if (idx && typeof idx === "string")
|
|
idx = Number(idx);
|
|
return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/schema/common/seq.js
|
|
function createSeq(schema4, obj, ctx) {
|
|
const { replacer } = ctx;
|
|
const seq2 = new YAMLSeq(schema4);
|
|
if (obj && Symbol.iterator in Object(obj)) {
|
|
let i = 0;
|
|
for (let it of obj) {
|
|
if (typeof replacer === "function") {
|
|
const key = obj instanceof Set ? it : String(i++);
|
|
it = replacer.call(obj, key, it);
|
|
}
|
|
seq2.items.push(createNode(it, void 0, ctx));
|
|
}
|
|
}
|
|
return seq2;
|
|
}
|
|
var seq = {
|
|
collection: "seq",
|
|
createNode: createSeq,
|
|
default: true,
|
|
nodeClass: YAMLSeq,
|
|
tag: "tag:yaml.org,2002:seq",
|
|
resolve(seq2, onError) {
|
|
if (!isSeq(seq2))
|
|
onError("Expected a sequence for this tag");
|
|
return seq2;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/common/string.js
|
|
var string = {
|
|
identify: (value) => typeof value === "string",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:str",
|
|
resolve: (str) => str,
|
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
ctx = Object.assign({ actualString: true }, ctx);
|
|
return stringifyString(item, ctx, onComment, onChompKeep);
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/common/null.js
|
|
var nullTag = {
|
|
identify: (value) => value == null,
|
|
createNode: () => new Scalar(null),
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:null",
|
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
resolve: () => new Scalar(null),
|
|
stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/core/bool.js
|
|
var boolTag = {
|
|
identify: (value) => typeof value === "boolean",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:bool",
|
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
resolve: (str) => new Scalar(str[0] === "t" || str[0] === "T"),
|
|
stringify({ source, value }, ctx) {
|
|
if (source && boolTag.test.test(source)) {
|
|
const sv = source[0] === "t" || source[0] === "T";
|
|
if (value === sv)
|
|
return source;
|
|
}
|
|
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringifyNumber.js
|
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
if (typeof value === "bigint")
|
|
return String(value);
|
|
const num = typeof value === "number" ? value : Number(value);
|
|
if (!isFinite(num))
|
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
let n = JSON.stringify(value);
|
|
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
|
|
let i = n.indexOf(".");
|
|
if (i < 0) {
|
|
i = n.length;
|
|
n += ".";
|
|
}
|
|
let d = minFractionDigits - (n.length - i - 1);
|
|
while (d-- > 0)
|
|
n += "0";
|
|
}
|
|
return n;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/schema/core/float.js
|
|
var floatNaN = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
test: /^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,
|
|
resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
stringify: stringifyNumber
|
|
};
|
|
var floatExp = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
format: "EXP",
|
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
resolve: (str) => parseFloat(str),
|
|
stringify(node) {
|
|
const num = Number(node.value);
|
|
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
|
}
|
|
};
|
|
var float = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
resolve(str) {
|
|
const node = new Scalar(parseFloat(str));
|
|
const dot = str.indexOf(".");
|
|
if (dot !== -1 && str[str.length - 1] === "0")
|
|
node.minFractionDigits = str.length - dot - 1;
|
|
return node;
|
|
},
|
|
stringify: stringifyNumber
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/core/int.js
|
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
|
|
function intStringify(node, radix, prefix) {
|
|
const { value } = node;
|
|
if (intIdentify(value) && value >= 0)
|
|
return prefix + value.toString(radix);
|
|
return stringifyNumber(node);
|
|
}
|
|
var intOct = {
|
|
identify: (value) => intIdentify(value) && value >= 0,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
format: "OCT",
|
|
test: /^0o[0-7]+$/,
|
|
resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),
|
|
stringify: (node) => intStringify(node, 8, "0o")
|
|
};
|
|
var int = {
|
|
identify: intIdentify,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
test: /^[-+]?[0-9]+$/,
|
|
resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
|
|
stringify: stringifyNumber
|
|
};
|
|
var intHex = {
|
|
identify: (value) => intIdentify(value) && value >= 0,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
format: "HEX",
|
|
test: /^0x[0-9a-fA-F]+$/,
|
|
resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
|
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/core/schema.js
|
|
var schema = [
|
|
map,
|
|
seq,
|
|
string,
|
|
nullTag,
|
|
boolTag,
|
|
intOct,
|
|
int,
|
|
intHex,
|
|
floatNaN,
|
|
floatExp,
|
|
float
|
|
];
|
|
|
|
// node_modules/yaml/browser/dist/schema/json/schema.js
|
|
function intIdentify2(value) {
|
|
return typeof value === "bigint" || Number.isInteger(value);
|
|
}
|
|
var stringifyJSON = ({ value }) => JSON.stringify(value);
|
|
var jsonScalars = [
|
|
{
|
|
identify: (value) => typeof value === "string",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:str",
|
|
resolve: (str) => str,
|
|
stringify: stringifyJSON
|
|
},
|
|
{
|
|
identify: (value) => value == null,
|
|
createNode: () => new Scalar(null),
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:null",
|
|
test: /^null$/,
|
|
resolve: () => null,
|
|
stringify: stringifyJSON
|
|
},
|
|
{
|
|
identify: (value) => typeof value === "boolean",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:bool",
|
|
test: /^true|false$/,
|
|
resolve: (str) => str === "true",
|
|
stringify: stringifyJSON
|
|
},
|
|
{
|
|
identify: intIdentify2,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
|
|
stringify: ({ value }) => intIdentify2(value) ? value.toString() : JSON.stringify(value)
|
|
},
|
|
{
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
resolve: (str) => parseFloat(str),
|
|
stringify: stringifyJSON
|
|
}
|
|
];
|
|
var jsonError = {
|
|
default: true,
|
|
tag: "",
|
|
test: /^/,
|
|
resolve(str, onError) {
|
|
onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
|
|
return str;
|
|
}
|
|
};
|
|
var schema2 = [map, seq].concat(jsonScalars, jsonError);
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
|
|
var binary = {
|
|
identify: (value) => value instanceof Uint8Array,
|
|
default: false,
|
|
tag: "tag:yaml.org,2002:binary",
|
|
resolve(src, onError) {
|
|
if (typeof Buffer === "function") {
|
|
return Buffer.from(src, "base64");
|
|
} else if (typeof atob === "function") {
|
|
const str = atob(src.replace(/[\n\r]/g, ""));
|
|
const buffer = new Uint8Array(str.length);
|
|
for (let i = 0; i < str.length; ++i)
|
|
buffer[i] = str.charCodeAt(i);
|
|
return buffer;
|
|
} else {
|
|
onError("This environment does not support reading binary tags; either Buffer or atob is required");
|
|
return src;
|
|
}
|
|
},
|
|
stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
const buf = value;
|
|
let str;
|
|
if (typeof Buffer === "function") {
|
|
str = buf instanceof Buffer ? buf.toString("base64") : Buffer.from(buf.buffer).toString("base64");
|
|
} else if (typeof btoa === "function") {
|
|
let s = "";
|
|
for (let i = 0; i < buf.length; ++i)
|
|
s += String.fromCharCode(buf[i]);
|
|
str = btoa(s);
|
|
} else {
|
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
}
|
|
if (!type)
|
|
type = Scalar.BLOCK_LITERAL;
|
|
if (type !== Scalar.QUOTE_DOUBLE) {
|
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
const n = Math.ceil(str.length / lineWidth);
|
|
const lines = new Array(n);
|
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
lines[i] = str.substr(o, lineWidth);
|
|
}
|
|
str = lines.join(type === Scalar.BLOCK_LITERAL ? "\n" : " ");
|
|
}
|
|
return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
|
|
function resolvePairs(seq2, onError) {
|
|
var _a;
|
|
if (isSeq(seq2)) {
|
|
for (let i = 0; i < seq2.items.length; ++i) {
|
|
let item = seq2.items[i];
|
|
if (isPair(item))
|
|
continue;
|
|
else if (isMap(item)) {
|
|
if (item.items.length > 1)
|
|
onError("Each pair must have its own sequence indicator");
|
|
const pair = item.items[0] || new Pair(new Scalar(null));
|
|
if (item.commentBefore)
|
|
pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore}
|
|
${pair.key.commentBefore}` : item.commentBefore;
|
|
if (item.comment) {
|
|
const cn = (_a = pair.value) != null ? _a : pair.key;
|
|
cn.comment = cn.comment ? `${item.comment}
|
|
${cn.comment}` : item.comment;
|
|
}
|
|
item = pair;
|
|
}
|
|
seq2.items[i] = isPair(item) ? item : new Pair(item);
|
|
}
|
|
} else
|
|
onError("Expected a sequence for this tag");
|
|
return seq2;
|
|
}
|
|
function createPairs(schema4, iterable, ctx) {
|
|
const { replacer } = ctx;
|
|
const pairs2 = new YAMLSeq(schema4);
|
|
pairs2.tag = "tag:yaml.org,2002:pairs";
|
|
let i = 0;
|
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
for (let it of iterable) {
|
|
if (typeof replacer === "function")
|
|
it = replacer.call(iterable, String(i++), it);
|
|
let key, value;
|
|
if (Array.isArray(it)) {
|
|
if (it.length === 2) {
|
|
key = it[0];
|
|
value = it[1];
|
|
} else
|
|
throw new TypeError(`Expected [key, value] tuple: ${it}`);
|
|
} else if (it && it instanceof Object) {
|
|
const keys = Object.keys(it);
|
|
if (keys.length === 1) {
|
|
key = keys[0];
|
|
value = it[key];
|
|
} else
|
|
throw new TypeError(`Expected { key: value } tuple: ${it}`);
|
|
} else {
|
|
key = it;
|
|
}
|
|
pairs2.items.push(createPair(key, value, ctx));
|
|
}
|
|
return pairs2;
|
|
}
|
|
var pairs = {
|
|
collection: "seq",
|
|
default: false,
|
|
tag: "tag:yaml.org,2002:pairs",
|
|
resolve: resolvePairs,
|
|
createNode: createPairs
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
|
|
var YAMLOMap = class extends YAMLSeq {
|
|
constructor() {
|
|
super();
|
|
this.add = YAMLMap.prototype.add.bind(this);
|
|
this.delete = YAMLMap.prototype.delete.bind(this);
|
|
this.get = YAMLMap.prototype.get.bind(this);
|
|
this.has = YAMLMap.prototype.has.bind(this);
|
|
this.set = YAMLMap.prototype.set.bind(this);
|
|
this.tag = YAMLOMap.tag;
|
|
}
|
|
toJSON(_, ctx) {
|
|
if (!ctx)
|
|
return super.toJSON(_);
|
|
const map2 = new Map();
|
|
if (ctx == null ? void 0 : ctx.onCreate)
|
|
ctx.onCreate(map2);
|
|
for (const pair of this.items) {
|
|
let key, value;
|
|
if (isPair(pair)) {
|
|
key = toJS(pair.key, "", ctx);
|
|
value = toJS(pair.value, key, ctx);
|
|
} else {
|
|
key = toJS(pair, "", ctx);
|
|
}
|
|
if (map2.has(key))
|
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
map2.set(key, value);
|
|
}
|
|
return map2;
|
|
}
|
|
};
|
|
YAMLOMap.tag = "tag:yaml.org,2002:omap";
|
|
var omap = {
|
|
collection: "seq",
|
|
identify: (value) => value instanceof Map,
|
|
nodeClass: YAMLOMap,
|
|
default: false,
|
|
tag: "tag:yaml.org,2002:omap",
|
|
resolve(seq2, onError) {
|
|
const pairs2 = resolvePairs(seq2, onError);
|
|
const seenKeys = [];
|
|
for (const { key } of pairs2.items) {
|
|
if (isScalar(key)) {
|
|
if (seenKeys.includes(key.value)) {
|
|
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
|
} else {
|
|
seenKeys.push(key.value);
|
|
}
|
|
}
|
|
}
|
|
return Object.assign(new YAMLOMap(), pairs2);
|
|
},
|
|
createNode(schema4, iterable, ctx) {
|
|
const pairs2 = createPairs(schema4, iterable, ctx);
|
|
const omap2 = new YAMLOMap();
|
|
omap2.items = pairs2.items;
|
|
return omap2;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
|
|
function boolStringify({ value, source }, ctx) {
|
|
const boolObj = value ? trueTag : falseTag;
|
|
if (source && boolObj.test.test(source))
|
|
return source;
|
|
return value ? ctx.options.trueStr : ctx.options.falseStr;
|
|
}
|
|
var trueTag = {
|
|
identify: (value) => value === true,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:bool",
|
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
resolve: () => new Scalar(true),
|
|
stringify: boolStringify
|
|
};
|
|
var falseTag = {
|
|
identify: (value) => value === false,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:bool",
|
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
|
resolve: () => new Scalar(false),
|
|
stringify: boolStringify
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
|
|
var floatNaN2 = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
test: /^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,
|
|
resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
stringify: stringifyNumber
|
|
};
|
|
var floatExp2 = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
format: "EXP",
|
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
resolve: (str) => parseFloat(str.replace(/_/g, "")),
|
|
stringify(node) {
|
|
const num = Number(node.value);
|
|
return isFinite(num) ? num.toExponential() : stringifyNumber(node);
|
|
}
|
|
};
|
|
var float2 = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
resolve(str) {
|
|
const node = new Scalar(parseFloat(str.replace(/_/g, "")));
|
|
const dot = str.indexOf(".");
|
|
if (dot !== -1) {
|
|
const f = str.substring(dot + 1).replace(/_/g, "");
|
|
if (f[f.length - 1] === "0")
|
|
node.minFractionDigits = f.length;
|
|
}
|
|
return node;
|
|
},
|
|
stringify: stringifyNumber
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
|
|
var intIdentify3 = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
function intResolve2(str, offset, radix, { intAsBigInt }) {
|
|
const sign = str[0];
|
|
if (sign === "-" || sign === "+")
|
|
offset += 1;
|
|
str = str.substring(offset).replace(/_/g, "");
|
|
if (intAsBigInt) {
|
|
switch (radix) {
|
|
case 2:
|
|
str = `0b${str}`;
|
|
break;
|
|
case 8:
|
|
str = `0o${str}`;
|
|
break;
|
|
case 16:
|
|
str = `0x${str}`;
|
|
break;
|
|
}
|
|
const n2 = BigInt(str);
|
|
return sign === "-" ? BigInt(-1) * n2 : n2;
|
|
}
|
|
const n = parseInt(str, radix);
|
|
return sign === "-" ? -1 * n : n;
|
|
}
|
|
function intStringify2(node, radix, prefix) {
|
|
const { value } = node;
|
|
if (intIdentify3(value)) {
|
|
const str = value.toString(radix);
|
|
return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
|
|
}
|
|
return stringifyNumber(node);
|
|
}
|
|
var intBin = {
|
|
identify: intIdentify3,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
format: "BIN",
|
|
test: /^[-+]?0b[0-1_]+$/,
|
|
resolve: (str, _onError, opt) => intResolve2(str, 2, 2, opt),
|
|
stringify: (node) => intStringify2(node, 2, "0b")
|
|
};
|
|
var intOct2 = {
|
|
identify: intIdentify3,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
format: "OCT",
|
|
test: /^[-+]?0[0-7_]+$/,
|
|
resolve: (str, _onError, opt) => intResolve2(str, 1, 8, opt),
|
|
stringify: (node) => intStringify2(node, 8, "0")
|
|
};
|
|
var int2 = {
|
|
identify: intIdentify3,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
resolve: (str, _onError, opt) => intResolve2(str, 0, 10, opt),
|
|
stringify: stringifyNumber
|
|
};
|
|
var intHex2 = {
|
|
identify: intIdentify3,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
format: "HEX",
|
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
resolve: (str, _onError, opt) => intResolve2(str, 2, 16, opt),
|
|
stringify: (node) => intStringify2(node, 16, "0x")
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
|
|
var YAMLSet = class extends YAMLMap {
|
|
constructor(schema4) {
|
|
super(schema4);
|
|
this.tag = YAMLSet.tag;
|
|
}
|
|
add(key) {
|
|
let pair;
|
|
if (isPair(key))
|
|
pair = key;
|
|
else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
|
|
pair = new Pair(key.key, null);
|
|
else
|
|
pair = new Pair(key, null);
|
|
const prev = findPair(this.items, pair.key);
|
|
if (!prev)
|
|
this.items.push(pair);
|
|
}
|
|
get(key, keepPair) {
|
|
const pair = findPair(this.items, key);
|
|
return !keepPair && isPair(pair) ? isScalar(pair.key) ? pair.key.value : pair.key : pair;
|
|
}
|
|
set(key, value) {
|
|
if (typeof value !== "boolean")
|
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
|
const prev = findPair(this.items, key);
|
|
if (prev && !value) {
|
|
this.items.splice(this.items.indexOf(prev), 1);
|
|
} else if (!prev && value) {
|
|
this.items.push(new Pair(key));
|
|
}
|
|
}
|
|
toJSON(_, ctx) {
|
|
return super.toJSON(_, ctx, Set);
|
|
}
|
|
toString(ctx, onComment, onChompKeep) {
|
|
if (!ctx)
|
|
return JSON.stringify(this);
|
|
if (this.hasAllNullValues(true))
|
|
return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
|
|
else
|
|
throw new Error("Set items must all have null values");
|
|
}
|
|
};
|
|
YAMLSet.tag = "tag:yaml.org,2002:set";
|
|
var set = {
|
|
collection: "map",
|
|
identify: (value) => value instanceof Set,
|
|
nodeClass: YAMLSet,
|
|
default: false,
|
|
tag: "tag:yaml.org,2002:set",
|
|
resolve(map2, onError) {
|
|
if (isMap(map2)) {
|
|
if (map2.hasAllNullValues(true))
|
|
return Object.assign(new YAMLSet(), map2);
|
|
else
|
|
onError("Set items must all have null values");
|
|
} else
|
|
onError("Expected a mapping for this tag");
|
|
return map2;
|
|
},
|
|
createNode(schema4, iterable, ctx) {
|
|
const { replacer } = ctx;
|
|
const set2 = new YAMLSet(schema4);
|
|
if (iterable && Symbol.iterator in Object(iterable))
|
|
for (let value of iterable) {
|
|
if (typeof replacer === "function")
|
|
value = replacer.call(iterable, value, value);
|
|
set2.items.push(createPair(value, null, ctx));
|
|
}
|
|
return set2;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
|
|
function parseSexagesimal(str, asBigInt) {
|
|
const sign = str[0];
|
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
|
|
return sign === "-" ? num(-1) * res : res;
|
|
}
|
|
function stringifySexagesimal(node) {
|
|
let { value } = node;
|
|
let num = (n) => n;
|
|
if (typeof value === "bigint")
|
|
num = (n) => BigInt(n);
|
|
else if (isNaN(value) || !isFinite(value))
|
|
return stringifyNumber(node);
|
|
let sign = "";
|
|
if (value < 0) {
|
|
sign = "-";
|
|
value *= num(-1);
|
|
}
|
|
const _60 = num(60);
|
|
const parts = [value % _60];
|
|
if (value < 60) {
|
|
parts.unshift(0);
|
|
} else {
|
|
value = (value - parts[0]) / _60;
|
|
parts.unshift(value % _60);
|
|
if (value >= 60) {
|
|
value = (value - parts[0]) / _60;
|
|
parts.unshift(value);
|
|
}
|
|
}
|
|
return sign + parts.map((n) => n < 10 ? "0" + String(n) : String(n)).join(":").replace(/000000\d*$/, "");
|
|
}
|
|
var intTime = {
|
|
identify: (value) => typeof value === "bigint" || Number.isInteger(value),
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:int",
|
|
format: "TIME",
|
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
|
|
stringify: stringifySexagesimal
|
|
};
|
|
var floatTime = {
|
|
identify: (value) => typeof value === "number",
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:float",
|
|
format: "TIME",
|
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
resolve: (str) => parseSexagesimal(str, false),
|
|
stringify: stringifySexagesimal
|
|
};
|
|
var timestamp = {
|
|
identify: (value) => value instanceof Date,
|
|
default: true,
|
|
tag: "tag:yaml.org,2002:timestamp",
|
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
resolve(str) {
|
|
const match = str.match(timestamp.test);
|
|
if (!match)
|
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
|
|
let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
|
const tz = match[8];
|
|
if (tz && tz !== "Z") {
|
|
let d = parseSexagesimal(tz, false);
|
|
if (Math.abs(d) < 30)
|
|
d *= 60;
|
|
date -= 6e4 * d;
|
|
}
|
|
return new Date(date);
|
|
},
|
|
stringify: ({ value }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, "")
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
|
|
var schema3 = [
|
|
map,
|
|
seq,
|
|
string,
|
|
nullTag,
|
|
trueTag,
|
|
falseTag,
|
|
intBin,
|
|
intOct2,
|
|
int2,
|
|
intHex2,
|
|
floatNaN2,
|
|
floatExp2,
|
|
float2,
|
|
binary,
|
|
omap,
|
|
pairs,
|
|
set,
|
|
intTime,
|
|
floatTime,
|
|
timestamp
|
|
];
|
|
|
|
// node_modules/yaml/browser/dist/schema/tags.js
|
|
var schemas = new Map([
|
|
["core", schema],
|
|
["failsafe", [map, seq, string]],
|
|
["json", schema2],
|
|
["yaml11", schema3],
|
|
["yaml-1.1", schema3]
|
|
]);
|
|
var tagsByName = {
|
|
binary,
|
|
bool: boolTag,
|
|
float,
|
|
floatExp,
|
|
floatNaN,
|
|
floatTime,
|
|
int,
|
|
intHex,
|
|
intOct,
|
|
intTime,
|
|
map,
|
|
null: nullTag,
|
|
omap,
|
|
pairs,
|
|
seq,
|
|
set,
|
|
timestamp
|
|
};
|
|
var coreKnownTags = {
|
|
"tag:yaml.org,2002:binary": binary,
|
|
"tag:yaml.org,2002:omap": omap,
|
|
"tag:yaml.org,2002:pairs": pairs,
|
|
"tag:yaml.org,2002:set": set,
|
|
"tag:yaml.org,2002:timestamp": timestamp
|
|
};
|
|
function getTags(customTags, schemaName) {
|
|
let tags = schemas.get(schemaName);
|
|
if (!tags) {
|
|
if (Array.isArray(customTags))
|
|
tags = [];
|
|
else {
|
|
const keys = Array.from(schemas.keys()).filter((key) => key !== "yaml11").map((key) => JSON.stringify(key)).join(", ");
|
|
throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
|
|
}
|
|
}
|
|
if (Array.isArray(customTags)) {
|
|
for (const tag of customTags)
|
|
tags = tags.concat(tag);
|
|
} else if (typeof customTags === "function") {
|
|
tags = customTags(tags.slice());
|
|
}
|
|
return tags.map((tag) => {
|
|
if (typeof tag !== "string")
|
|
return tag;
|
|
const tagObj = tagsByName[tag];
|
|
if (tagObj)
|
|
return tagObj;
|
|
const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
|
|
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
|
|
});
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/schema/Schema.js
|
|
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
var Schema = class {
|
|
constructor({ compat, customTags, merge, resolveKnownTags, schema: schema4, sortMapEntries, toStringDefaults }) {
|
|
this.compat = Array.isArray(compat) ? getTags(compat, "compat") : compat ? getTags(null, compat) : null;
|
|
this.merge = !!merge;
|
|
this.name = typeof schema4 === "string" && schema4 || "core";
|
|
this.knownTags = resolveKnownTags ? coreKnownTags : {};
|
|
this.tags = getTags(customTags, this.name);
|
|
this.toStringOptions = toStringDefaults != null ? toStringDefaults : null;
|
|
Object.defineProperty(this, MAP, { value: map });
|
|
Object.defineProperty(this, SCALAR, { value: string });
|
|
Object.defineProperty(this, SEQ, { value: seq });
|
|
this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
|
|
}
|
|
clone() {
|
|
const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));
|
|
copy.tags = this.tags.slice();
|
|
return copy;
|
|
}
|
|
};
|
|
|
|
// node_modules/yaml/browser/dist/stringify/stringifyDocument.js
|
|
function stringifyDocument(doc, options) {
|
|
var _a;
|
|
const lines = [];
|
|
let hasDirectives = options.directives === true;
|
|
if (options.directives !== false && doc.directives) {
|
|
const dir = doc.directives.toString(doc);
|
|
if (dir) {
|
|
lines.push(dir);
|
|
hasDirectives = true;
|
|
} else if (doc.directives.docStart)
|
|
hasDirectives = true;
|
|
}
|
|
if (hasDirectives)
|
|
lines.push("---");
|
|
const ctx = createStringifyContext(doc, options);
|
|
const { commentString } = ctx.options;
|
|
if (doc.commentBefore) {
|
|
if (lines.length !== 1)
|
|
lines.unshift("");
|
|
const cs = commentString(doc.commentBefore);
|
|
lines.unshift(indentComment(cs, ""));
|
|
}
|
|
let chompKeep = false;
|
|
let contentComment = null;
|
|
if (doc.contents) {
|
|
if (isNode(doc.contents)) {
|
|
if (doc.contents.spaceBefore && hasDirectives)
|
|
lines.push("");
|
|
if (doc.contents.commentBefore) {
|
|
const cs = commentString(doc.contents.commentBefore);
|
|
lines.push(indentComment(cs, ""));
|
|
}
|
|
ctx.forceBlockIndent = !!doc.comment;
|
|
contentComment = doc.contents.comment;
|
|
}
|
|
const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
|
|
let body = stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
|
|
if (contentComment)
|
|
body += lineComment(body, "", commentString(contentComment));
|
|
if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
|
|
lines[lines.length - 1] = `--- ${body}`;
|
|
} else
|
|
lines.push(body);
|
|
} else {
|
|
lines.push(stringify(doc.contents, ctx));
|
|
}
|
|
if ((_a = doc.directives) == null ? void 0 : _a.docEnd) {
|
|
if (doc.comment) {
|
|
const cs = commentString(doc.comment);
|
|
if (cs.includes("\n")) {
|
|
lines.push("...");
|
|
lines.push(indentComment(cs, ""));
|
|
} else {
|
|
lines.push(`... ${cs}`);
|
|
}
|
|
} else {
|
|
lines.push("...");
|
|
}
|
|
} else {
|
|
let dc = doc.comment;
|
|
if (dc && chompKeep)
|
|
dc = dc.replace(/^\n+/, "");
|
|
if (dc) {
|
|
if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "")
|
|
lines.push("");
|
|
lines.push(indentComment(commentString(dc), ""));
|
|
}
|
|
}
|
|
return lines.join("\n") + "\n";
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/doc/applyReviver.js
|
|
function applyReviver(reviver, obj, key, val) {
|
|
if (val && typeof val === "object") {
|
|
if (Array.isArray(val)) {
|
|
for (let i = 0, len = val.length; i < len; ++i) {
|
|
const v0 = val[i];
|
|
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
if (v1 === void 0)
|
|
delete val[i];
|
|
else if (v1 !== v0)
|
|
val[i] = v1;
|
|
}
|
|
} else if (val instanceof Map) {
|
|
for (const k of Array.from(val.keys())) {
|
|
const v0 = val.get(k);
|
|
const v1 = applyReviver(reviver, val, k, v0);
|
|
if (v1 === void 0)
|
|
val.delete(k);
|
|
else if (v1 !== v0)
|
|
val.set(k, v1);
|
|
}
|
|
} else if (val instanceof Set) {
|
|
for (const v0 of Array.from(val)) {
|
|
const v1 = applyReviver(reviver, val, v0, v0);
|
|
if (v1 === void 0)
|
|
val.delete(v0);
|
|
else if (v1 !== v0) {
|
|
val.delete(v0);
|
|
val.add(v1);
|
|
}
|
|
}
|
|
} else {
|
|
for (const [k, v0] of Object.entries(val)) {
|
|
const v1 = applyReviver(reviver, val, k, v0);
|
|
if (v1 === void 0)
|
|
delete val[k];
|
|
else if (v1 !== v0)
|
|
val[k] = v1;
|
|
}
|
|
}
|
|
}
|
|
return reviver.call(obj, key, val);
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/doc/Document.js
|
|
var Document = class {
|
|
constructor(value, replacer, options) {
|
|
this.commentBefore = null;
|
|
this.comment = null;
|
|
this.errors = [];
|
|
this.warnings = [];
|
|
Object.defineProperty(this, NODE_TYPE, { value: DOC });
|
|
let _replacer = null;
|
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
_replacer = replacer;
|
|
} else if (options === void 0 && replacer) {
|
|
options = replacer;
|
|
replacer = void 0;
|
|
}
|
|
const opt = Object.assign({
|
|
intAsBigInt: false,
|
|
keepSourceTokens: false,
|
|
logLevel: "warn",
|
|
prettyErrors: true,
|
|
strict: true,
|
|
uniqueKeys: true,
|
|
version: "1.2"
|
|
}, options);
|
|
this.options = opt;
|
|
let { version } = opt;
|
|
if (options == null ? void 0 : options._directives) {
|
|
this.directives = options._directives.atDocument();
|
|
if (this.directives.yaml.explicit)
|
|
version = this.directives.yaml.version;
|
|
} else
|
|
this.directives = new Directives({ version });
|
|
this.setSchema(version, options);
|
|
if (value === void 0)
|
|
this.contents = null;
|
|
else {
|
|
this.contents = this.createNode(value, _replacer, options);
|
|
}
|
|
}
|
|
clone() {
|
|
const copy = Object.create(Document.prototype, {
|
|
[NODE_TYPE]: { value: DOC }
|
|
});
|
|
copy.commentBefore = this.commentBefore;
|
|
copy.comment = this.comment;
|
|
copy.errors = this.errors.slice();
|
|
copy.warnings = this.warnings.slice();
|
|
copy.options = Object.assign({}, this.options);
|
|
if (this.directives)
|
|
copy.directives = this.directives.clone();
|
|
copy.schema = this.schema.clone();
|
|
copy.contents = isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
|
|
if (this.range)
|
|
copy.range = this.range.slice();
|
|
return copy;
|
|
}
|
|
add(value) {
|
|
if (assertCollection(this.contents))
|
|
this.contents.add(value);
|
|
}
|
|
addIn(path, value) {
|
|
if (assertCollection(this.contents))
|
|
this.contents.addIn(path, value);
|
|
}
|
|
createAlias(node, name) {
|
|
if (!node.anchor) {
|
|
const prev = anchorNames(this);
|
|
node.anchor = !name || prev.has(name) ? findNewAnchor(name || "a", prev) : name;
|
|
}
|
|
return new Alias(node.anchor);
|
|
}
|
|
createNode(value, replacer, options) {
|
|
let _replacer = void 0;
|
|
if (typeof replacer === "function") {
|
|
value = replacer.call({ "": value }, "", value);
|
|
_replacer = replacer;
|
|
} else if (Array.isArray(replacer)) {
|
|
const keyToStr = (v) => typeof v === "number" || v instanceof String || v instanceof Number;
|
|
const asStr = replacer.filter(keyToStr).map(String);
|
|
if (asStr.length > 0)
|
|
replacer = replacer.concat(asStr);
|
|
_replacer = replacer;
|
|
} else if (options === void 0 && replacer) {
|
|
options = replacer;
|
|
replacer = void 0;
|
|
}
|
|
const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options != null ? options : {};
|
|
const { onAnchor, setAnchors, sourceObjects } = createNodeAnchors(this, anchorPrefix || "a");
|
|
const ctx = {
|
|
aliasDuplicateObjects: aliasDuplicateObjects != null ? aliasDuplicateObjects : true,
|
|
keepUndefined: keepUndefined != null ? keepUndefined : false,
|
|
onAnchor,
|
|
onTagObj,
|
|
replacer: _replacer,
|
|
schema: this.schema,
|
|
sourceObjects
|
|
};
|
|
const node = createNode(value, tag, ctx);
|
|
if (flow && isCollection(node))
|
|
node.flow = true;
|
|
setAnchors();
|
|
return node;
|
|
}
|
|
createPair(key, value, options = {}) {
|
|
const k = this.createNode(key, null, options);
|
|
const v = this.createNode(value, null, options);
|
|
return new Pair(k, v);
|
|
}
|
|
delete(key) {
|
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
}
|
|
deleteIn(path) {
|
|
if (isEmptyPath(path)) {
|
|
if (this.contents == null)
|
|
return false;
|
|
this.contents = null;
|
|
return true;
|
|
}
|
|
return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
|
|
}
|
|
get(key, keepScalar) {
|
|
return isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
|
|
}
|
|
getIn(path, keepScalar) {
|
|
if (isEmptyPath(path))
|
|
return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
|
|
return isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
|
|
}
|
|
has(key) {
|
|
return isCollection(this.contents) ? this.contents.has(key) : false;
|
|
}
|
|
hasIn(path) {
|
|
if (isEmptyPath(path))
|
|
return this.contents !== void 0;
|
|
return isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
}
|
|
set(key, value) {
|
|
if (this.contents == null) {
|
|
this.contents = collectionFromPath(this.schema, [key], value);
|
|
} else if (assertCollection(this.contents)) {
|
|
this.contents.set(key, value);
|
|
}
|
|
}
|
|
setIn(path, value) {
|
|
if (isEmptyPath(path))
|
|
this.contents = value;
|
|
else if (this.contents == null) {
|
|
this.contents = collectionFromPath(this.schema, Array.from(path), value);
|
|
} else if (assertCollection(this.contents)) {
|
|
this.contents.setIn(path, value);
|
|
}
|
|
}
|
|
setSchema(version, options = {}) {
|
|
if (typeof version === "number")
|
|
version = String(version);
|
|
let opt;
|
|
switch (version) {
|
|
case "1.1":
|
|
if (this.directives)
|
|
this.directives.yaml.version = "1.1";
|
|
else
|
|
this.directives = new Directives({ version: "1.1" });
|
|
opt = { merge: true, resolveKnownTags: false, schema: "yaml-1.1" };
|
|
break;
|
|
case "1.2":
|
|
case "next":
|
|
if (this.directives)
|
|
this.directives.yaml.version = version;
|
|
else
|
|
this.directives = new Directives({ version });
|
|
opt = { merge: false, resolveKnownTags: true, schema: "core" };
|
|
break;
|
|
case null:
|
|
if (this.directives)
|
|
delete this.directives;
|
|
opt = null;
|
|
break;
|
|
default: {
|
|
const sv = JSON.stringify(version);
|
|
throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
|
|
}
|
|
}
|
|
if (options.schema instanceof Object)
|
|
this.schema = options.schema;
|
|
else if (opt)
|
|
this.schema = new Schema(Object.assign(opt, options));
|
|
else
|
|
throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
|
|
}
|
|
toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
const ctx = {
|
|
anchors: new Map(),
|
|
doc: this,
|
|
keep: !json,
|
|
mapAsMap: mapAsMap === true,
|
|
mapKeyWarned: false,
|
|
maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100,
|
|
stringify
|
|
};
|
|
const res = toJS(this.contents, jsonArg != null ? jsonArg : "", ctx);
|
|
if (typeof onAnchor === "function")
|
|
for (const { count, res: res2 } of ctx.anchors.values())
|
|
onAnchor(res2, count);
|
|
return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
|
|
}
|
|
toJSON(jsonArg, onAnchor) {
|
|
return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
|
|
}
|
|
toString(options = {}) {
|
|
if (this.errors.length > 0)
|
|
throw new Error("Document with errors cannot be stringified");
|
|
if ("indent" in options && (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {
|
|
const s = JSON.stringify(options.indent);
|
|
throw new Error(`"indent" option must be a positive integer, not ${s}`);
|
|
}
|
|
return stringifyDocument(this, options);
|
|
}
|
|
};
|
|
function assertCollection(contents) {
|
|
if (isCollection(contents))
|
|
return true;
|
|
throw new Error("Expected a YAML collection as document contents");
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/parse/cst-visit.js
|
|
var BREAK2 = Symbol("break visit");
|
|
var SKIP2 = Symbol("skip children");
|
|
var REMOVE2 = Symbol("remove item");
|
|
function visit2(cst, visitor) {
|
|
if ("type" in cst && cst.type === "document")
|
|
cst = { start: cst.start, value: cst.value };
|
|
_visit(Object.freeze([]), cst, visitor);
|
|
}
|
|
visit2.BREAK = BREAK2;
|
|
visit2.SKIP = SKIP2;
|
|
visit2.REMOVE = REMOVE2;
|
|
visit2.itemAtPath = (cst, path) => {
|
|
let item = cst;
|
|
for (const [field, index] of path) {
|
|
const tok = item == null ? void 0 : item[field];
|
|
if (tok && "items" in tok) {
|
|
item = tok.items[index];
|
|
} else
|
|
return void 0;
|
|
}
|
|
return item;
|
|
};
|
|
visit2.parentCollection = (cst, path) => {
|
|
const parent = visit2.itemAtPath(cst, path.slice(0, -1));
|
|
const field = path[path.length - 1][0];
|
|
const coll = parent == null ? void 0 : parent[field];
|
|
if (coll && "items" in coll)
|
|
return coll;
|
|
throw new Error("Parent collection not found");
|
|
};
|
|
function _visit(path, item, visitor) {
|
|
let ctrl = visitor(item, path);
|
|
if (typeof ctrl === "symbol")
|
|
return ctrl;
|
|
for (const field of ["key", "value"]) {
|
|
const token = item[field];
|
|
if (token && "items" in token) {
|
|
for (let i = 0; i < token.items.length; ++i) {
|
|
const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
|
|
if (typeof ci === "number")
|
|
i = ci - 1;
|
|
else if (ci === BREAK2)
|
|
return BREAK2;
|
|
else if (ci === REMOVE2) {
|
|
token.items.splice(i, 1);
|
|
i -= 1;
|
|
}
|
|
}
|
|
if (typeof ctrl === "function" && field === "key")
|
|
ctrl = ctrl(item, path);
|
|
}
|
|
}
|
|
return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
|
|
}
|
|
|
|
// node_modules/yaml/browser/dist/parse/lexer.js
|
|
var hexDigits = "0123456789ABCDEFabcdef".split("");
|
|
var tagChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split("");
|
|
var invalidFlowScalarChars = ",[]{}".split("");
|
|
var invalidAnchorChars = " ,[]{}\n\r ".split("");
|
|
|
|
// node_modules/yaml/browser/dist/public-api.js
|
|
function stringify3(value, replacer, options) {
|
|
var _a;
|
|
let _replacer = null;
|
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
_replacer = replacer;
|
|
} else if (options === void 0 && replacer) {
|
|
options = replacer;
|
|
}
|
|
if (typeof options === "string")
|
|
options = options.length;
|
|
if (typeof options === "number") {
|
|
const indent = Math.round(options);
|
|
options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
|
|
}
|
|
if (value === void 0) {
|
|
const { keepUndefined } = (_a = options != null ? options : replacer) != null ? _a : {};
|
|
if (!keepUndefined)
|
|
return void 0;
|
|
}
|
|
return new Document(value, _replacer, options).toString(options);
|
|
}
|
|
|
|
// Upload2Notion.ts
|
|
var Upload2Notion = class {
|
|
constructor(app) {
|
|
this.app = app;
|
|
}
|
|
deletePage(notionID) {
|
|
return __async(this, null, function* () {
|
|
const response = yield (0, import_obsidian2.requestUrl)({
|
|
url: `https://api.notion.com/v1/blocks/${notionID}`,
|
|
method: "DELETE",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Authorization": "Bearer " + this.app.settings.notionAPI,
|
|
"Notion-Version": "2022-02-22"
|
|
},
|
|
body: ""
|
|
});
|
|
return response;
|
|
});
|
|
}
|
|
updatePage(notionID, title, allowTags, tags, childArr) {
|
|
return __async(this, null, function* () {
|
|
yield this.deletePage(notionID);
|
|
const res = yield this.createPage(title, allowTags, tags, childArr);
|
|
return res;
|
|
});
|
|
}
|
|
createPage(title, allowTags, tags, childArr) {
|
|
return __async(this, null, function* () {
|
|
const bodyString = {
|
|
parent: {
|
|
database_id: this.app.settings.databaseID
|
|
},
|
|
properties: {
|
|
Name: {
|
|
title: [
|
|
{
|
|
text: {
|
|
content: title
|
|
}
|
|
}
|
|
]
|
|
},
|
|
Tags: {
|
|
multi_select: allowTags && tags !== void 0 ? tags.map((tag) => {
|
|
return { "name": tag };
|
|
}) : []
|
|
}
|
|
},
|
|
children: childArr
|
|
};
|
|
if (this.app.settings.bannerUrl) {
|
|
bodyString.cover = {
|
|
type: "external",
|
|
external: {
|
|
url: this.app.settings.bannerUrl
|
|
}
|
|
};
|
|
}
|
|
try {
|
|
const response = yield (0, import_obsidian2.requestUrl)({
|
|
url: `https://api.notion.com/v1/pages`,
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
"Authorization": "Bearer " + this.app.settings.notionAPI,
|
|
"Notion-Version": "2021-08-16"
|
|
},
|
|
body: JSON.stringify(bodyString)
|
|
});
|
|
return response;
|
|
} catch (error) {
|
|
new import_obsidian2.Notice(`network error ${error}`);
|
|
}
|
|
});
|
|
}
|
|
syncMarkdownToNotion(title, allowTags, tags, markdown, nowFile, app, settings) {
|
|
return __async(this, null, function* () {
|
|
var _a;
|
|
let res;
|
|
const yamlObj = loadFront(markdown);
|
|
const __content = yamlObj.__content;
|
|
const file2Block = (0, import_martian.markdownToBlocks)(__content);
|
|
const frontmasster = yield (_a = app.metadataCache.getFileCache(nowFile)) == null ? void 0 : _a.frontmatter;
|
|
const notionID = frontmasster ? frontmasster.notionID : null;
|
|
if (notionID) {
|
|
res = yield this.updatePage(notionID, title, allowTags, tags, file2Block);
|
|
} else {
|
|
res = yield this.createPage(title, allowTags, tags, file2Block);
|
|
}
|
|
if (res.status === 200) {
|
|
yield this.updateYamlInfo(markdown, nowFile, res, app, settings);
|
|
} else {
|
|
new import_obsidian2.Notice(`${res.text}`);
|
|
}
|
|
return res;
|
|
});
|
|
}
|
|
updateYamlInfo(yamlContent, nowFile, res, app, settings) {
|
|
return __async(this, null, function* () {
|
|
const yamlObj = loadFront(yamlContent);
|
|
let { url, id } = res.json;
|
|
const { notionID } = settings;
|
|
if (notionID !== "") {
|
|
url = url.replace("www.notion.so", `${notionID}.notion.site`);
|
|
}
|
|
yamlObj.link = url;
|
|
try {
|
|
yield navigator.clipboard.writeText(url);
|
|
} catch (error) {
|
|
new import_obsidian2.Notice(`\u590D\u5236\u94FE\u63A5\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u590D\u5236${error}`);
|
|
}
|
|
yamlObj.notionID = id;
|
|
const __content = yamlObj.__content;
|
|
delete yamlObj.__content;
|
|
const yamlhead = stringify3(yamlObj);
|
|
const yamlhead_remove_n = yamlhead.replace(/\n$/, "");
|
|
const __content_remove_n = __content.replace(/^\n/, "");
|
|
const content = "---\n" + yamlhead_remove_n + "\n---\n" + __content_remove_n;
|
|
try {
|
|
yield nowFile.vault.modify(nowFile, content);
|
|
} catch (error) {
|
|
new import_obsidian2.Notice(`write file error ${error}`);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
// Message.ts
|
|
var NoticeMsg = {
|
|
"en": {
|
|
"notion-logo": "Share to notion",
|
|
"sync-success": "Sync to notion success: \n",
|
|
"sync-fail": "Sync to notion fail: \n",
|
|
"open-notion": "Please open the file that needs to be synchronized",
|
|
"config-secrets-notion-api": "Please set up the notion API in the settings tab.",
|
|
"config-secrets-database-id": "Please set up the database id in the settings tab.",
|
|
"set-tags-fail": "Set tags fail,please check the frontmatter of the file or close the tag switch in the settings tab."
|
|
},
|
|
"zh": {
|
|
"notion-logo": "\u5206\u4EAB\u5230Notion",
|
|
"sync-success": "\u540C\u6B65\u5230Notion\u6210\u529F:\n",
|
|
"sync-fail": "\u540C\u6B65\u5230Notion\u5931\u8D25: \n",
|
|
"open-file": "\u8BF7\u6253\u5F00\u9700\u8981\u540C\u6B65\u7684\u6587\u4EF6",
|
|
"set-tags-fail": "\u8BBE\u7F6E\u6807\u7B7E\u5931\u8D25,\u8BF7\u68C0\u67E5\u6587\u4EF6\u7684frontmatter,\u6216\u8005\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u5173\u95ED\u8BBE\u7F6Etags\u5F00\u5173"
|
|
}
|
|
};
|
|
var NoticeMConfig = (lang) => {
|
|
return NoticeMsg[lang];
|
|
};
|
|
|
|
// main.ts
|
|
var langConfig = NoticeMConfig(window.localStorage.getItem("language") || "en");
|
|
var DEFAULT_SETTINGS = {
|
|
notionAPI: "",
|
|
databaseID: "",
|
|
bannerUrl: "",
|
|
notionID: "",
|
|
proxy: "",
|
|
allowTags: false
|
|
};
|
|
var ObsidianSyncNotionPlugin = class extends import_obsidian3.Plugin {
|
|
onload() {
|
|
return __async(this, null, function* () {
|
|
yield this.loadSettings();
|
|
addIcons();
|
|
const ribbonIconEl = this.addRibbonIcon("notion-logo", "Share to notion", (evt) => __async(this, null, function* () {
|
|
this.upload();
|
|
}));
|
|
const statusBarItemEl = this.addStatusBarItem();
|
|
this.addCommand({
|
|
id: "share-to-notion",
|
|
name: "share to notion",
|
|
editorCallback: (editor, view) => __async(this, null, function* () {
|
|
this.upload();
|
|
})
|
|
});
|
|
this.addSettingTab(new SampleSettingTab(this.app, this));
|
|
});
|
|
}
|
|
onunload() {
|
|
}
|
|
upload() {
|
|
return __async(this, null, function* () {
|
|
const { notionAPI, databaseID, allowTags } = this.settings;
|
|
if (notionAPI === "" || databaseID === "") {
|
|
new import_obsidian3.Notice("Please set up the notion API and database ID in the settings tab.");
|
|
return;
|
|
}
|
|
const { markDownData, nowFile, tags } = yield this.getNowFileMarkdownContent(this.app);
|
|
if (markDownData) {
|
|
const { basename } = nowFile;
|
|
const upload = new Upload2Notion(this);
|
|
const res = yield upload.syncMarkdownToNotion(basename, allowTags, tags, markDownData, nowFile, this.app, this.settings);
|
|
if (res.status === 200) {
|
|
new import_obsidian3.Notice(`${langConfig["sync-success"]}${basename}`);
|
|
} else {
|
|
new import_obsidian3.Notice(`${langConfig["sync-fail"]}${basename}`, 5e3);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
getNowFileMarkdownContent(app) {
|
|
return __async(this, null, function* () {
|
|
const nowFile = app.workspace.getActiveFile();
|
|
const { allowTags } = this.settings;
|
|
let tags = [];
|
|
try {
|
|
if (allowTags) {
|
|
tags = app.metadataCache.getFileCache(nowFile).frontmatter.tags;
|
|
}
|
|
} catch (error) {
|
|
new import_obsidian3.Notice(langConfig["set-tags-fail"]);
|
|
}
|
|
if (nowFile) {
|
|
const markDownData = yield nowFile.vault.read(nowFile);
|
|
return {
|
|
markDownData,
|
|
nowFile,
|
|
tags
|
|
};
|
|
} else {
|
|
new import_obsidian3.Notice(langConfig["open-file"]);
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
loadSettings() {
|
|
return __async(this, null, function* () {
|
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
|
|
});
|
|
}
|
|
saveSettings() {
|
|
return __async(this, null, function* () {
|
|
yield this.saveData(this.settings);
|
|
});
|
|
}
|
|
};
|
|
var SampleSettingTab = class extends import_obsidian3.PluginSettingTab {
|
|
constructor(app, plugin) {
|
|
super(app, plugin);
|
|
this.plugin = plugin;
|
|
}
|
|
display() {
|
|
const { containerEl } = this;
|
|
containerEl.empty();
|
|
containerEl.createEl("h2", {
|
|
text: "Settings for obsidian to notion plugin."
|
|
});
|
|
new import_obsidian3.Setting(containerEl).setName("Notion API Token").setDesc("It's a secret").addText((text) => {
|
|
let t = text.setPlaceholder("Enter your Notion API Token").setValue(this.plugin.settings.notionAPI).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.notionAPI = value;
|
|
yield this.plugin.saveSettings();
|
|
}));
|
|
return t;
|
|
});
|
|
const notionDatabaseID = new import_obsidian3.Setting(containerEl).setName("Database ID").setDesc("It's a secret").addText((text) => {
|
|
let t = text.setPlaceholder("Enter your Database ID").setValue(this.plugin.settings.databaseID).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.databaseID = value;
|
|
yield this.plugin.saveSettings();
|
|
}));
|
|
return t;
|
|
});
|
|
new import_obsidian3.Setting(containerEl).setName("Banner url(optional)").setDesc("page banner url(optional), default is empty, if you want to show a banner, please enter the url(like:https://raw.githubusercontent.com/EasyChris/obsidian-to-notion/ae7a9ac6cf427f3ca338a409ce6967ced9506f12/doc/2.png)").addText((text) => text.setPlaceholder("Enter banner pic url: ").setValue(this.plugin.settings.bannerUrl).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.bannerUrl = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian3.Setting(containerEl).setName("Notion ID(optional)").setDesc("Your notion ID(optional),share link likes:https://username.notion.site/,your notion id is [username]").addText((text) => text.setPlaceholder("Enter notion ID(options) ").setValue(this.plugin.settings.notionID).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.notionID = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian3.Setting(containerEl).setName("Convert tags(optional)").setDesc("Transfer the Obsidian tags to the Notion table. It requires the column with the name 'Tags'").addToggle((toggle) => toggle.setValue(this.plugin.settings.allowTags).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.allowTags = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
}
|
|
};
|
|
/*!
|
|
* Determine if an object is a Buffer
|
|
*
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
* @license MIT
|
|
*/
|
|
/*!
|
|
* repeat-string <https://github.com/jonschlinkert/repeat-string>
|
|
*
|
|
* Copyright (c) 2014-2015, Jon Schlinkert.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
|
|
/* nosourcemap */ |