UNPKG

storybook

Version:

Storybook: Develop, document, and test UI components in isolation

1,244 lines (1,216 loc) • 1.19 MB
import CJS_COMPAT_NODE_URL_3za304dh1il from 'node:url'; import CJS_COMPAT_NODE_PATH_3za304dh1il from 'node:path'; import CJS_COMPAT_NODE_MODULE_3za304dh1il from "node:module"; var __filename = CJS_COMPAT_NODE_URL_3za304dh1il.fileURLToPath(import.meta.url); var __dirname = CJS_COMPAT_NODE_PATH_3za304dh1il.dirname(__filename); var require = CJS_COMPAT_NODE_MODULE_3za304dh1il.createRequire(import.meta.url); // ------------------------------------------------------------ // end of CJS compatibility banner, injected by Storybook's esbuild configuration // ------------------------------------------------------------ import { require_picomatch, toPath, traversePathUp } from "./chunk-3FG4ZIOY.js"; import { versions_default } from "./chunk-6HPNADJF.js"; import { logger } from "./chunk-LMAJUNK2.js"; import { BUN_LOCKFILE, BUN_LOCKFILE_BINARY, NPM_LOCKFILE, PNPM_LOCKFILE, YARN_LOCKFILE, findFilesUp, getProjectRoot, normalizeStoryPath } from "./chunk-7H2QWASA.js"; import { any, detectIndent, from, invariant, up, up2 } from "./chunk-IYHL7P35.js"; import { importModule, resolveModulePath, resolvePackageDir, safeResolveModule } from "./chunk-2XRAUFH3.js"; import { jsModuleExtensions, storybookConfigExtensions } from "./chunk-EV2CT3GE.js"; import { require_dist } from "./chunk-YOJEDPR4.js"; import { require_picocolors } from "./chunk-UM2ZG4W6.js"; import { join, parse, resolve } from "./chunk-BSSMDXLU.js"; import { slash } from "./chunk-KHGPJOK6.js"; import { glob, globSync } from "./chunk-BFTJL2HZ.js"; import { __commonJS, __esm, __export, __require, __toCommonJS, __toESM } from "./chunk-57SVN5FU.js"; // ../../node_modules/isexe/windows.js var require_windows = __commonJS({ "../../node_modules/isexe/windows.js"(exports, module) { module.exports = isexe; isexe.sync = sync; var fs = __require("fs"); function checkPathExt(path5, options) { var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT; if (!pathext || (pathext = pathext.split(";"), pathext.indexOf("") !== -1)) return !0; for (var i2 = 0; i2 < pathext.length; i2++) { var p = pathext[i2].toLowerCase(); if (p && path5.substr(-p.length).toLowerCase() === p) return !0; } return !1; } function checkStat(stat, path5, options) { return !stat.isSymbolicLink() && !stat.isFile() ? !1 : checkPathExt(path5, options); } function isexe(path5, options, cb) { fs.stat(path5, function(er, stat) { cb(er, er ? !1 : checkStat(stat, path5, options)); }); } function sync(path5, options) { return checkStat(fs.statSync(path5), path5, options); } } }); // ../../node_modules/isexe/mode.js var require_mode = __commonJS({ "../../node_modules/isexe/mode.js"(exports, module) { module.exports = isexe; isexe.sync = sync; var fs = __require("fs"); function isexe(path5, options, cb) { fs.stat(path5, function(er, stat) { cb(er, er ? !1 : checkStat(stat, options)); }); } function sync(path5, options) { return checkStat(fs.statSync(path5), options); } function checkStat(stat, options) { return stat.isFile() && checkMode(stat, options); } function checkMode(stat, options) { var mod = stat.mode, uid = stat.uid, gid = stat.gid, myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid(), myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid(), u2 = parseInt("100", 8), g = parseInt("010", 8), o2 = parseInt("001", 8), ug = u2 | g, ret = mod & o2 || mod & g && gid === myGid || mod & u2 && uid === myUid || mod & ug && myUid === 0; return ret; } } }); // ../../node_modules/isexe/index.js var require_isexe = __commonJS({ "../../node_modules/isexe/index.js"(exports, module) { var fs = __require("fs"), core; process.platform === "win32" || global.TESTING_WINDOWS ? core = require_windows() : core = require_mode(); module.exports = isexe; isexe.sync = sync; function isexe(path5, options, cb) { if (typeof options == "function" && (cb = options, options = {}), !cb) { if (typeof Promise != "function") throw new TypeError("callback not provided"); return new Promise(function(resolve8, reject) { isexe(path5, options || {}, function(er, is) { er ? reject(er) : resolve8(is); }); }); } core(path5, options || {}, function(er, is) { er && (er.code === "EACCES" || options && options.ignoreErrors) && (er = null, is = !1), cb(er, is); }); } function sync(path5, options) { try { return core.sync(path5, options || {}); } catch (er) { if (options && options.ignoreErrors || er.code === "EACCES") return !1; throw er; } } } }); // ../../node_modules/which/which.js var require_which = __commonJS({ "../../node_modules/which/which.js"(exports, module) { var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", path5 = __require("path"), COLON = isWindows ? ";" : ":", isexe = require_isexe(), getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" }), getPathInfo = (cmd, opt) => { let colon = opt.colon || COLON, pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [ // windows always checks the cwd first ...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */ "").split(colon) ], pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", pathExt = isWindows ? pathExtExe.split(colon) : [""]; return isWindows && cmd.indexOf(".") !== -1 && pathExt[0] !== "" && pathExt.unshift(""), { pathEnv, pathExt, pathExtExe }; }, which = (cmd, opt, cb) => { typeof opt == "function" && (cb = opt, opt = {}), opt || (opt = {}); let { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt), found = [], step = (i2) => new Promise((resolve8, reject) => { if (i2 === pathEnv.length) return opt.all && found.length ? resolve8(found) : reject(getNotFoundError(cmd)); let ppRaw = pathEnv[i2], pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw, pCmd = path5.join(pathPart, cmd), p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; resolve8(subStep(p, i2, 0)); }), subStep = (p, i2, ii) => new Promise((resolve8, reject) => { if (ii === pathExt.length) return resolve8(step(i2 + 1)); let ext = pathExt[ii]; isexe(p + ext, { pathExt: pathExtExe }, (er, is) => { if (!er && is) if (opt.all) found.push(p + ext); else return resolve8(p + ext); return resolve8(subStep(p, i2, ii + 1)); }); }); return cb ? step(0).then((res) => cb(null, res), cb) : step(0); }, whichSync = (cmd, opt) => { opt = opt || {}; let { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt), found = []; for (let i2 = 0; i2 < pathEnv.length; i2++) { let ppRaw = pathEnv[i2], pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw, pCmd = path5.join(pathPart, cmd), p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd; for (let j = 0; j < pathExt.length; j++) { let cur = p + pathExt[j]; try { if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur); else return cur; } catch { } } } if (opt.all && found.length) return found; if (opt.nothrow) return null; throw getNotFoundError(cmd); }; module.exports = which; which.sync = whichSync; } }); // ../../node_modules/path-key/index.js var require_path_key = __commonJS({ "../../node_modules/path-key/index.js"(exports, module) { "use strict"; var pathKey2 = (options = {}) => { let environment = options.env || process.env; return (options.platform || process.platform) !== "win32" ? "PATH" : Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path"; }; module.exports = pathKey2; module.exports.default = pathKey2; } }); // ../../node_modules/cross-spawn/lib/util/resolveCommand.js var require_resolveCommand = __commonJS({ "../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) { "use strict"; var path5 = __require("path"), which = require_which(), getPathKey = require_path_key(); function resolveCommandAttempt(parsed, withoutPathExt) { let env2 = parsed.options.env || process.env, cwd = process.cwd(), hasCustomCwd = parsed.options.cwd != null, shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled; if (shouldSwitchCwd) try { process.chdir(parsed.options.cwd); } catch { } let resolved; try { resolved = which.sync(parsed.command, { path: env2[getPathKey({ env: env2 })], pathExt: withoutPathExt ? path5.delimiter : void 0 }); } catch { } finally { shouldSwitchCwd && process.chdir(cwd); } return resolved && (resolved = path5.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved)), resolved; } function resolveCommand2(parsed) { return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, !0); } module.exports = resolveCommand2; } }); // ../../node_modules/cross-spawn/lib/util/escape.js var require_escape = __commonJS({ "../../node_modules/cross-spawn/lib/util/escape.js"(exports, module) { "use strict"; var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; function escapeCommand(arg) { return arg = arg.replace(metaCharsRegExp, "^$1"), arg; } function escapeArgument(arg, doubleEscapeMetaChars) { return arg = `${arg}`, arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"'), arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1"), arg = `"${arg}"`, arg = arg.replace(metaCharsRegExp, "^$1"), doubleEscapeMetaChars && (arg = arg.replace(metaCharsRegExp, "^$1")), arg; } module.exports.command = escapeCommand; module.exports.argument = escapeArgument; } }); // ../../node_modules/shebang-regex/index.js var require_shebang_regex = __commonJS({ "../../node_modules/shebang-regex/index.js"(exports, module) { "use strict"; module.exports = /^#!(.*)/; } }); // ../../node_modules/shebang-command/index.js var require_shebang_command = __commonJS({ "../../node_modules/shebang-command/index.js"(exports, module) { "use strict"; var shebangRegex = require_shebang_regex(); module.exports = (string = "") => { let match = string.match(shebangRegex); if (!match) return null; let [path5, argument] = match[0].replace(/#! ?/, "").split(" "), binary = path5.split("/").pop(); return binary === "env" ? argument : argument ? `${binary} ${argument}` : binary; }; } }); // ../../node_modules/cross-spawn/lib/util/readShebang.js var require_readShebang = __commonJS({ "../../node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) { "use strict"; var fs = __require("fs"), shebangCommand = require_shebang_command(); function readShebang(command) { let buffer = Buffer.alloc(150), fd; try { fd = fs.openSync(command, "r"), fs.readSync(fd, buffer, 0, 150, 0), fs.closeSync(fd); } catch { } return shebangCommand(buffer.toString()); } module.exports = readShebang; } }); // ../../node_modules/cross-spawn/lib/parse.js var require_parse = __commonJS({ "../../node_modules/cross-spawn/lib/parse.js"(exports, module) { "use strict"; var path5 = __require("path"), resolveCommand2 = require_resolveCommand(), escape = require_escape(), readShebang = require_readShebang(), isWin = process.platform === "win32", isExecutableRegExp = /\.(?:com|exe)$/i, isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; function detectShebang(parsed) { parsed.file = resolveCommand2(parsed); let shebang = parsed.file && readShebang(parsed.file); return shebang ? (parsed.args.unshift(parsed.file), parsed.command = shebang, resolveCommand2(parsed)) : parsed.file; } function parseNonShell(parsed) { if (!isWin) return parsed; let commandFile = detectShebang(parsed), needsShell = !isExecutableRegExp.test(commandFile); if (parsed.options.forceShell || needsShell) { let needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); parsed.command = path5.normalize(parsed.command), parsed.command = escape.command(parsed.command), parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); let shellCommand = [parsed.command].concat(parsed.args).join(" "); parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`], parsed.command = process.env.comspec || "cmd.exe", parsed.options.windowsVerbatimArguments = !0; } return parsed; } function parse4(command, args, options) { args && !Array.isArray(args) && (options = args, args = null), args = args ? args.slice(0) : [], options = Object.assign({}, options); let parsed = { command, args, options, file: void 0, original: { command, args } }; return options.shell ? parsed : parseNonShell(parsed); } module.exports = parse4; } }); // ../../node_modules/cross-spawn/lib/enoent.js var require_enoent = __commonJS({ "../../node_modules/cross-spawn/lib/enoent.js"(exports, module) { "use strict"; var isWin = process.platform === "win32"; function notFoundError(original, syscall) { return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { code: "ENOENT", errno: "ENOENT", syscall: `${syscall} ${original.command}`, path: original.command, spawnargs: original.args }); } function hookChildProcess(cp, parsed) { if (!isWin) return; let originalEmit = cp.emit; cp.emit = function(name, arg1) { if (name === "exit") { let err = verifyENOENT(arg1, parsed); if (err) return originalEmit.call(cp, "error", err); } return originalEmit.apply(cp, arguments); }; } function verifyENOENT(status, parsed) { return isWin && status === 1 && !parsed.file ? notFoundError(parsed.original, "spawn") : null; } function verifyENOENTSync(status, parsed) { return isWin && status === 1 && !parsed.file ? notFoundError(parsed.original, "spawnSync") : null; } module.exports = { hookChildProcess, verifyENOENT, verifyENOENTSync, notFoundError }; } }); // ../../node_modules/cross-spawn/index.js var require_cross_spawn = __commonJS({ "../../node_modules/cross-spawn/index.js"(exports, module) { "use strict"; var cp = __require("child_process"), parse4 = require_parse(), enoent = require_enoent(); function spawn2(command, args, options) { let parsed = parse4(command, args, options), spawned = cp.spawn(parsed.command, parsed.args, parsed.options); return enoent.hookChildProcess(spawned, parsed), spawned; } function spawnSync2(command, args, options) { let parsed = parse4(command, args, options), result = cp.spawnSync(parsed.command, parsed.args, parsed.options); return result.error = result.error || enoent.verifyENOENTSync(result.status, parsed), result; } module.exports = spawn2; module.exports.spawn = spawn2; module.exports.sync = spawnSync2; module.exports._parse = parse4; module.exports._enoent = enoent; } }); // ../../node_modules/yaml/dist/nodes/identity.js var require_identity = __commonJS({ "../../node_modules/yaml/dist/nodes/identity.js"(exports) { "use strict"; var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias"), DOC = /* @__PURE__ */ Symbol.for("yaml.document"), MAP = /* @__PURE__ */ Symbol.for("yaml.map"), PAIR = /* @__PURE__ */ Symbol.for("yaml.pair"), SCALAR = /* @__PURE__ */ Symbol.for("yaml.scalar"), SEQ = /* @__PURE__ */ Symbol.for("yaml.seq"), NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type"), isAlias = (node) => !!node && typeof node == "object" && node[NODE_TYPE] === ALIAS, isDocument = (node) => !!node && typeof node == "object" && node[NODE_TYPE] === DOC, isMap = (node) => !!node && typeof node == "object" && node[NODE_TYPE] === MAP, isPair = (node) => !!node && typeof node == "object" && node[NODE_TYPE] === PAIR, isScalar = (node) => !!node && typeof node == "object" && node[NODE_TYPE] === SCALAR, 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 !0; } return !1; } function isNode(node) { if (node && typeof node == "object") switch (node[NODE_TYPE]) { case ALIAS: case MAP: case SCALAR: case SEQ: return !0; } return !1; } var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor; exports.ALIAS = ALIAS; exports.DOC = DOC; exports.MAP = MAP; exports.NODE_TYPE = NODE_TYPE; exports.PAIR = PAIR; exports.SCALAR = SCALAR; exports.SEQ = SEQ; exports.hasAnchor = hasAnchor; exports.isAlias = isAlias; exports.isCollection = isCollection; exports.isDocument = isDocument; exports.isMap = isMap; exports.isNode = isNode; exports.isPair = isPair; exports.isScalar = isScalar; exports.isSeq = isSeq; } }); // ../../node_modules/yaml/dist/visit.js var require_visit = __commonJS({ "../../node_modules/yaml/dist/visit.js"(exports) { "use strict"; var identity3 = require_identity(), BREAK = /* @__PURE__ */ Symbol("break visit"), SKIP = /* @__PURE__ */ Symbol("skip children"), REMOVE = /* @__PURE__ */ Symbol("remove node"); function visit(node, visitor) { let visitor_ = initVisitor(visitor); identity3.isDocument(node) ? visit_(null, node.contents, visitor_, Object.freeze([node])) === REMOVE && (node.contents = null) : visit_(null, node, visitor_, Object.freeze([])); } visit.BREAK = BREAK; visit.SKIP = SKIP; visit.REMOVE = REMOVE; function visit_(key, node, visitor, path5) { let ctrl = callVisitor(key, node, visitor, path5); if (identity3.isNode(ctrl) || identity3.isPair(ctrl)) return replaceNode(key, path5, ctrl), visit_(key, ctrl, visitor, path5); if (typeof ctrl != "symbol") { if (identity3.isCollection(node)) { path5 = Object.freeze(path5.concat(node)); for (let i2 = 0; i2 < node.items.length; ++i2) { let ci = visit_(i2, node.items[i2], visitor, path5); if (typeof ci == "number") i2 = ci - 1; else { if (ci === BREAK) return BREAK; ci === REMOVE && (node.items.splice(i2, 1), i2 -= 1); } } } else if (identity3.isPair(node)) { path5 = Object.freeze(path5.concat(node)); let ck = visit_("key", node.key, visitor, path5); if (ck === BREAK) return BREAK; ck === REMOVE && (node.key = null); let cv = visit_("value", node.value, visitor, path5); if (cv === BREAK) return BREAK; cv === REMOVE && (node.value = null); } } return ctrl; } async function visitAsync(node, visitor) { let visitor_ = initVisitor(visitor); identity3.isDocument(node) ? await visitAsync_(null, node.contents, visitor_, Object.freeze([node])) === REMOVE && (node.contents = null) : await visitAsync_(null, node, visitor_, Object.freeze([])); } visitAsync.BREAK = BREAK; visitAsync.SKIP = SKIP; visitAsync.REMOVE = REMOVE; async function visitAsync_(key, node, visitor, path5) { let ctrl = await callVisitor(key, node, visitor, path5); if (identity3.isNode(ctrl) || identity3.isPair(ctrl)) return replaceNode(key, path5, ctrl), visitAsync_(key, ctrl, visitor, path5); if (typeof ctrl != "symbol") { if (identity3.isCollection(node)) { path5 = Object.freeze(path5.concat(node)); for (let i2 = 0; i2 < node.items.length; ++i2) { let ci = await visitAsync_(i2, node.items[i2], visitor, path5); if (typeof ci == "number") i2 = ci - 1; else { if (ci === BREAK) return BREAK; ci === REMOVE && (node.items.splice(i2, 1), i2 -= 1); } } } else if (identity3.isPair(node)) { path5 = Object.freeze(path5.concat(node)); let ck = await visitAsync_("key", node.key, visitor, path5); if (ck === BREAK) return BREAK; ck === REMOVE && (node.key = null); let cv = await visitAsync_("value", node.value, visitor, path5); if (cv === BREAK) return BREAK; cv === REMOVE && (node.value = null); } } return ctrl; } function initVisitor(visitor) { return typeof visitor == "object" && (visitor.Collection || visitor.Node || visitor.Value) ? 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) : visitor; } function callVisitor(key, node, visitor, path5) { if (typeof visitor == "function") return visitor(key, node, path5); if (identity3.isMap(node)) return visitor.Map?.(key, node, path5); if (identity3.isSeq(node)) return visitor.Seq?.(key, node, path5); if (identity3.isPair(node)) return visitor.Pair?.(key, node, path5); if (identity3.isScalar(node)) return visitor.Scalar?.(key, node, path5); if (identity3.isAlias(node)) return visitor.Alias?.(key, node, path5); } function replaceNode(key, path5, node) { let parent = path5[path5.length - 1]; if (identity3.isCollection(parent)) parent.items[key] = node; else if (identity3.isPair(parent)) key === "key" ? parent.key = node : parent.value = node; else if (identity3.isDocument(parent)) parent.contents = node; else { let pt = identity3.isAlias(parent) ? "alias" : "scalar"; throw new Error(`Cannot replace node with ${pt} parent`); } } exports.visit = visit; exports.visitAsync = visitAsync; } }); // ../../node_modules/yaml/dist/doc/directives.js var require_directives = __commonJS({ "../../node_modules/yaml/dist/doc/directives.js"(exports) { "use strict"; var identity3 = require_identity(), visit = require_visit(), escapeChars = { "!": "%21", ",": "%2C", "[": "%5B", "]": "%5D", "{": "%7B", "}": "%7D" }, escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]), Directives = class _Directives { constructor(yaml, tags) { this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, _Directives.defaultYaml, yaml), this.tags = Object.assign({}, _Directives.defaultTags, tags); } clone() { let copy = new _Directives(this.yaml, this.tags); return copy.docStart = this.docStart, copy; } /** * During parsing, get a Directives instance for the current document and * update the stream state according to the current version's spec. */ atDocument() { let res = new _Directives(this.yaml, this.tags); switch (this.yaml.version) { case "1.1": this.atNextDocument = !0; break; case "1.2": this.atNextDocument = !1, this.yaml = { explicit: _Directives.defaultYaml.explicit, version: "1.2" }, this.tags = Object.assign({}, _Directives.defaultTags); break; } return res; } /** * @param onError - May be called even if the action was successful * @returns `true` on success */ add(line, onError) { this.atNextDocument && (this.yaml = { explicit: _Directives.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, _Directives.defaultTags), this.atNextDocument = !1); let parts = line.trim().split(/[ \t]+/), name = parts.shift(); switch (name) { case "%TAG": { if (parts.length !== 2 && (onError(0, "%TAG directive should contain exactly two parts"), parts.length < 2)) return !1; let [handle, prefix] = parts; return this.tags[handle] = prefix, !0; } case "%YAML": { if (this.yaml.explicit = !0, parts.length !== 1) return onError(0, "%YAML directive should contain exactly one part"), !1; let [version] = parts; if (version === "1.1" || version === "1.2") return this.yaml.version = version, !0; { let isValid = /^\d+\.\d+$/.test(version); return onError(6, `Unsupported YAML version ${version}`, isValid), !1; } } default: return onError(0, `Unknown directive ${name}`, !0), !1; } } /** * Resolves a tag, matching handles to those defined in %TAG directives. * * @returns Resolved tag, which may also be the non-specific tag `'!'` or a * `'!local'` tag, or `null` if unresolvable. */ tagName(source, onError) { if (source === "!") return "!"; if (source[0] !== "!") return onError(`Not a valid tag: ${source}`), null; if (source[1] === "<") { let verbatim = source.slice(2, -1); return verbatim === "!" || verbatim === "!!" ? (onError(`Verbatim tags aren't resolved, so ${source} is invalid.`), null) : (source[source.length - 1] !== ">" && onError("Verbatim tags must end with a >"), verbatim); } let [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s); suffix || onError(`The ${source} tag has no suffix`); let prefix = this.tags[handle]; if (prefix) try { return prefix + decodeURIComponent(suffix); } catch (error) { return onError(String(error)), null; } return handle === "!" ? source : (onError(`Could not resolve tag: ${source}`), null); } /** * Given a fully resolved tag, returns its printable string form, * taking into account current tag prefixes and defaults. */ tagString(tag) { for (let [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) { let lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], tagEntries = Object.entries(this.tags), tagNames; if (doc && tagEntries.length > 0 && identity3.isNode(doc.contents)) { let tags = {}; visit.visit(doc.contents, (_key, node) => { identity3.isNode(node) && node.tag && (tags[node.tag] = !0); }), tagNames = Object.keys(tags); } else tagNames = []; for (let [handle, prefix] of tagEntries) handle === "!!" && prefix === "tag:yaml.org,2002:" || (!doc || tagNames.some((tn) => tn.startsWith(prefix))) && lines.push(`%TAG ${handle} ${prefix}`); return lines.join(` `); } }; Directives.defaultYaml = { explicit: !1, version: "1.2" }; Directives.defaultTags = { "!!": "tag:yaml.org,2002:" }; exports.Directives = Directives; } }); // ../../node_modules/yaml/dist/doc/anchors.js var require_anchors = __commonJS({ "../../node_modules/yaml/dist/doc/anchors.js"(exports) { "use strict"; var identity3 = require_identity(), visit = require_visit(); function anchorIsValid(anchor) { if (/[\x00-\x19\s,[\]{}]/.test(anchor)) { let msg = `Anchor must not contain whitespace or control characters: ${JSON.stringify(anchor)}`; throw new Error(msg); } return !0; } function anchorNames(root) { let anchors = /* @__PURE__ */ new Set(); return visit.visit(root, { Value(_key, node) { node.anchor && anchors.add(node.anchor); } }), anchors; } function findNewAnchor(prefix, exclude) { for (let i2 = 1; ; ++i2) { let name = `${prefix}${i2}`; if (!exclude.has(name)) return name; } } function createNodeAnchors(doc, prefix) { let aliasObjects = [], sourceObjects = /* @__PURE__ */ new Map(), prevAnchors = null; return { onAnchor: (source) => { aliasObjects.push(source), prevAnchors ?? (prevAnchors = anchorNames(doc)); let anchor = findNewAnchor(prefix, prevAnchors); return prevAnchors.add(anchor), anchor; }, /** * With circular references, the source node is only resolved after all * of its child nodes are. This is why anchors are set only after all of * the nodes have been created. */ setAnchors: () => { for (let source of aliasObjects) { let ref = sourceObjects.get(source); if (typeof ref == "object" && ref.anchor && (identity3.isScalar(ref.node) || identity3.isCollection(ref.node))) ref.node.anchor = ref.anchor; else { let error = new Error("Failed to resolve repeated object (this should not happen)"); throw error.source = source, error; } } }, sourceObjects }; } exports.anchorIsValid = anchorIsValid; exports.anchorNames = anchorNames; exports.createNodeAnchors = createNodeAnchors; exports.findNewAnchor = findNewAnchor; } }); // ../../node_modules/yaml/dist/doc/applyReviver.js var require_applyReviver = __commonJS({ "../../node_modules/yaml/dist/doc/applyReviver.js"(exports) { "use strict"; function applyReviver(reviver, obj, key, val) { if (val && typeof val == "object") if (Array.isArray(val)) for (let i2 = 0, len = val.length; i2 < len; ++i2) { let v0 = val[i2], v1 = applyReviver(reviver, val, String(i2), v0); v1 === void 0 ? delete val[i2] : v1 !== v0 && (val[i2] = v1); } else if (val instanceof Map) for (let k of Array.from(val.keys())) { let v0 = val.get(k), v1 = applyReviver(reviver, val, k, v0); v1 === void 0 ? val.delete(k) : v1 !== v0 && val.set(k, v1); } else if (val instanceof Set) for (let v0 of Array.from(val)) { let v1 = applyReviver(reviver, val, v0, v0); v1 === void 0 ? val.delete(v0) : v1 !== v0 && (val.delete(v0), val.add(v1)); } else for (let [k, v0] of Object.entries(val)) { let v1 = applyReviver(reviver, val, k, v0); v1 === void 0 ? delete val[k] : v1 !== v0 && (val[k] = v1); } return reviver.call(obj, key, val); } exports.applyReviver = applyReviver; } }); // ../../node_modules/yaml/dist/nodes/toJS.js var require_toJS = __commonJS({ "../../node_modules/yaml/dist/nodes/toJS.js"(exports) { "use strict"; var identity3 = require_identity(); function toJS(value, arg, ctx) { if (Array.isArray(value)) return value.map((v, i2) => toJS(v, String(i2), ctx)); if (value && typeof value.toJSON == "function") { if (!ctx || !identity3.hasAnchor(value)) return value.toJSON(arg, ctx); let data = { aliasCount: 0, count: 1, res: void 0 }; ctx.anchors.set(value, data), ctx.onCreate = (res2) => { data.res = res2, delete ctx.onCreate; }; let res = value.toJSON(arg, ctx); return ctx.onCreate && ctx.onCreate(res), res; } return typeof value == "bigint" && !ctx?.keep ? Number(value) : value; } exports.toJS = toJS; } }); // ../../node_modules/yaml/dist/nodes/Node.js var require_Node = __commonJS({ "../../node_modules/yaml/dist/nodes/Node.js"(exports) { "use strict"; var applyReviver = require_applyReviver(), identity3 = require_identity(), toJS = require_toJS(), NodeBase = class { constructor(type) { Object.defineProperty(this, identity3.NODE_TYPE, { value: type }); } /** Create a copy of this node. */ clone() { let copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this)); return this.range && (copy.range = this.range.slice()), copy; } /** A plain JavaScript representation of this node. */ toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) { if (!identity3.isDocument(doc)) throw new TypeError("A document argument is required"); let ctx = { anchors: /* @__PURE__ */ new Map(), doc, keep: !0, mapAsMap: mapAsMap === !0, mapKeyWarned: !1, maxAliasCount: typeof maxAliasCount == "number" ? maxAliasCount : 100 }, res = toJS.toJS(this, "", ctx); if (typeof onAnchor == "function") for (let { count: count2, res: res2 } of ctx.anchors.values()) onAnchor(res2, count2); return typeof reviver == "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res; } }; exports.NodeBase = NodeBase; } }); // ../../node_modules/yaml/dist/nodes/Alias.js var require_Alias = __commonJS({ "../../node_modules/yaml/dist/nodes/Alias.js"(exports) { "use strict"; var anchors = require_anchors(), visit = require_visit(), identity3 = require_identity(), Node = require_Node(), toJS = require_toJS(), Alias = class extends Node.NodeBase { constructor(source) { super(identity3.ALIAS), this.source = source, Object.defineProperty(this, "tag", { set() { throw new Error("Alias nodes cannot have tags"); } }); } /** * Resolve the value of this alias within `doc`, finding the last * instance of the `source` anchor before this node. */ resolve(doc, ctx) { let nodes; ctx?.aliasResolveCache ? nodes = ctx.aliasResolveCache : (nodes = [], visit.visit(doc, { Node: (_key, node) => { (identity3.isAlias(node) || identity3.hasAnchor(node)) && nodes.push(node); } }), ctx && (ctx.aliasResolveCache = nodes)); let found; for (let node of nodes) { if (node === this) break; node.anchor === this.source && (found = node); } return found; } toJSON(_arg, ctx) { if (!ctx) return { source: this.source }; let { anchors: anchors2, doc, maxAliasCount } = ctx, source = this.resolve(doc, ctx); if (!source) { let msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`; throw new ReferenceError(msg); } let data = anchors2.get(source); if (data || (toJS.toJS(source, null, ctx), data = anchors2.get(source)), data?.res === void 0) { let msg = "This should not happen: Alias anchor was not resolved?"; throw new ReferenceError(msg); } if (maxAliasCount >= 0 && (data.count += 1, data.aliasCount === 0 && (data.aliasCount = getAliasCount(doc, source, anchors2)), data.count * data.aliasCount > maxAliasCount)) { let msg = "Excessive alias count indicates a resource exhaustion attack"; throw new ReferenceError(msg); } return data.res; } toString(ctx, _onComment, _onChompKeep) { let src = `*${this.source}`; if (ctx) { if (anchors.anchorIsValid(this.source), ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) { let 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, anchors2) { if (identity3.isAlias(node)) { let source = node.resolve(doc), anchor = anchors2 && source && anchors2.get(source); return anchor ? anchor.count * anchor.aliasCount : 0; } else if (identity3.isCollection(node)) { let count2 = 0; for (let item of node.items) { let c3 = getAliasCount(doc, item, anchors2); c3 > count2 && (count2 = c3); } return count2; } else if (identity3.isPair(node)) { let kc = getAliasCount(doc, node.key, anchors2), vc = getAliasCount(doc, node.value, anchors2); return Math.max(kc, vc); } return 1; } exports.Alias = Alias; } }); // ../../node_modules/yaml/dist/nodes/Scalar.js var require_Scalar = __commonJS({ "../../node_modules/yaml/dist/nodes/Scalar.js"(exports) { "use strict"; var identity3 = require_identity(), Node = require_Node(), toJS = require_toJS(), isScalarValue = (value) => !value || typeof value != "function" && typeof value != "object", Scalar = class extends Node.NodeBase { constructor(value) { super(identity3.SCALAR), this.value = value; } toJSON(arg, ctx) { return ctx?.keep ? this.value : toJS.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"; exports.Scalar = Scalar; exports.isScalarValue = isScalarValue; } }); // ../../node_modules/yaml/dist/doc/createNode.js var require_createNode = __commonJS({ "../../node_modules/yaml/dist/doc/createNode.js"(exports) { "use strict"; var Alias = require_Alias(), identity3 = require_identity(), Scalar = require_Scalar(), defaultTagPrefix = "tag:yaml.org,2002:"; function findTagObject(value, tagName, tags) { if (tagName) { let match = tags.filter((t3) => t3.tag === tagName), tagObj = match.find((t3) => !t3.format) ?? match[0]; if (!tagObj) throw new Error(`Tag ${tagName} not found`); return tagObj; } return tags.find((t3) => t3.identify?.(value) && !t3.format); } function createNode(value, tagName, ctx) { if (identity3.isDocument(value) && (value = value.contents), identity3.isNode(value)) return value; if (identity3.isPair(value)) { let map2 = ctx.schema[identity3.MAP].createNode?.(ctx.schema, null, ctx); return map2.items.push(value), map2; } (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt < "u" && value instanceof BigInt) && (value = value.valueOf()); let { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx, ref; if (aliasDuplicateObjects && value && typeof value == "object") { if (ref = sourceObjects.get(value), ref) return ref.anchor ?? (ref.anchor = onAnchor(value)), new Alias.Alias(ref.anchor); ref = { anchor: null, node: null }, sourceObjects.set(value, ref); } tagName?.startsWith("!!") && (tagName = defaultTagPrefix + tagName.slice(2)); let tagObj = findTagObject(value, tagName, schema.tags); if (!tagObj) { if (value && typeof value.toJSON == "function" && (value = value.toJSON()), !value || typeof value != "object") { let node2 = new Scalar.Scalar(value); return ref && (ref.node = node2), node2; } tagObj = value instanceof Map ? schema[identity3.MAP] : Symbol.iterator in Object(value) ? schema[identity3.SEQ] : schema[identity3.MAP]; } onTagObj && (onTagObj(tagObj), delete ctx.onTagObj); let node = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from == "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar.Scalar(value); return tagName ? node.tag = tagName : tagObj.default || (node.tag = tagObj.tag), ref && (ref.node = node), node; } exports.createNode = createNode; } }); // ../../node_modules/yaml/dist/nodes/Collection.js var require_Collection = __commonJS({ "../../node_modules/yaml/dist/nodes/Collection.js"(exports) { "use strict"; var createNode = require_createNode(), identity3 = require_identity(), Node = require_Node(); function collectionFromPath(schema, path5, value) { let v = value; for (let i2 = path5.length - 1; i2 >= 0; --i2) { let k = path5[i2]; if (typeof k == "number" && Number.isInteger(k) && k >= 0) { let a2 = []; a2[k] = v, v = a2; } else v = /* @__PURE__ */ new Map([[k, v]]); } return createNode.createNode(v, void 0, { aliasDuplicateObjects: !1, keepUndefined: !1, onAnchor: () => { throw new Error("This should not happen, please report a bug."); }, schema, sourceObjects: /* @__PURE__ */ new Map() }); } var isEmptyPath = (path5) => path5 == null || typeof path5 == "object" && !!path5[Symbol.iterator]().next().done, Collection = class extends Node.NodeBase { constructor(type, schema) { super(type), Object.defineProperty(this, "schema", { value: schema, configurable: !0, enumerable: !1, writable: !0 }); } /** * Create a copy of this collection. * * @param schema - If defined, overwrites the original's schema */ clone(schema) { let copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this)); return schema && (copy.schema = schema), copy.items = copy.items.map((it) => identity3.isNode(it) || identity3.isPair(it) ? it.clone(schema) : it), this.range && (copy.range = this.range.slice()), copy; } /** * Adds a value to the collection. For `!!map` and `!!omap` the value must * be a Pair instance or a `{ key, value }` object, which may not have a key * that already exists in the map. */ addIn(path5, value) { if (isEmptyPath(path5)) this.add(value); else { let [key, ...rest] = path5, node = this.get(key, !0); if (identity3.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}`); } } /** * Removes a value from the collection. * @returns `true` if the item was found and removed. */ deleteIn(path5) { let [key, ...rest] = path5; if (rest.length === 0) return this.delete(key); let node = this.get(key, !0); if (identity3.isCollection(node)) return node.deleteIn(rest); throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); } /** * Returns item at `key`, or `undefined` if not found. By default unwraps * scalar values from their surrounding node; to disable set `keepScalar` to * `true` (collections are always returned intact). */ getIn(path5, keepScalar) { let [key, ...rest] = path5, node = this.get(key, !0); return rest.length === 0 ? !keepScalar && identity3.isScalar(node) ? node.value : node : identity3.isCollection(node) ? node.getIn(rest, keepScalar) : void 0; } hasAllNullValues(allowScalar) { return this.items.every((node) => { if (!identity3.isPair(node)) return !1; let n2 = node.value; return n2 == null || allowScalar && identity3.isScalar(n2) && n2.value == null && !n2.commentBefore && !n2.comment && !n2.tag; }); } /** * Checks if the collection includes a value with the key `key`. */ hasIn(path5) { let [key, ...rest] = path5; if (rest.length === 0) return this.has(key); let node = this.get(key, !0); return identity3.isCollection(node) ? node.hasIn(rest) : !1; } /** * Sets a value in this collection. For `!!set`, `value` needs to be a * boolean to add/remove the item from the set. */ setIn(path5, value) { let [key, ...rest] = path5; if (rest.length === 0) this.set(key, value); else { let node = this.get(key, !0); if (identity3.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}`); } } }; exports.Collection = Collection; exports.collectionFromPath = collectionFromPath; exports.isEmptyPath = isEmptyPath; } }); // ../../node_modules/yaml/dist/stringify/stringifyComment.js var require_stringifyComment = __commonJS({ "../../node_modules/yaml/dist/stringify/stringifyComment.js"(exports) { "use strict"; var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#"); function indentComment(comment, indent) { return /^\n+$/.test(comment) ? comment.substring(1) : indent ? comment.replace(/^(?! *$)/gm, indent) : comment; } var lineComment = (str, indent, comment) => str.endsWith(` `) ? indentComment(comment, indent) : comment.includes(` `) ? ` ` + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment; exports.indentComment = indentComment; exports.lineComment = lineComment; exports.stringifyComment = stringifyComment; } }); // ../../node_modules/yaml/dist/stringify/foldFlowLines.js var require_foldFlowLines = __commonJS({ "../../node_modules/yaml/dist/stringify/foldFlowLines.js"(exports) { "use strict"; var FOLD_FLOW = "flow", FOLD_BLOCK = "block", FOLD_QUOTED = "quoted"; function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) { if (!lineWidth || lineWidth < 0) return text; lineWidth < minContentWidth && (minContentWidth = 0); let endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length); if (text.length <= endStep) return text; let folds = [], escapedFolds = {}, end = lineWidth - indent.length; typeof indentAtStart == "number" && (indentAtStart > lineWidth - Math.max(2, minContentWidth) ? folds.push(0) : end = lineWidth - indentAtStart); let split, prev, overflow = !1, i2 = -1, escStart = -1, escEnd = -1; mode === FOLD_BLOCK && (i2 = consumeMoreIndentedLines(text, i2, indent.length), i2 !== -1 && (end = i2 + endStep)); for (let ch; ch = text[i2 += 1]; ) { if (mode === FOLD_QUOTED && ch === "\\") { switch (escStart = i2, text[i2 + 1]) { case "x": i2 += 3; break; case "u": i2 += 5; break; case "U": i2 += 9; break; default: i2 += 1; } escEnd = i2; } if (ch === ` `) mode === FOLD_BLOCK && (i2 = consumeMoreIndentedLines(text, i2, indent.length)), end = i2 + indent.length + endStep, split = void 0; else { if (ch === " " && prev && prev !== " " && prev !== ` ` && prev !== " ") { let next = text[i2 + 1]; next && next !== " " && next !== ` ` && next !== " " && (split = i2); } if (i2 >= end) if (split) folds.push(split), end = split + endStep, split = void 0; else if (mode === FOLD_QUOTED) { for (; prev === " " || prev === " "; ) prev = ch, ch = text[i2 += 1], overflow = !0; let j = i2 > escEnd + 1 ? i2 - 2 : escStart - 1; if (escapedFolds[j]) return text; folds.push(j), escapedFolds[j] = !0, end = j + endStep, split = void 0; } else overflow = !0; } prev = ch; } if (overflow && onOverflow && onOverflow(), folds.length === 0) return text; onFold && onFold(); let res = text.slice(0, folds[0]); for (let i3 = 0; i3 < folds.length; ++i3) { let fold = folds[i3], end2 = folds[i3 + 1] || text.length; fold === 0 ? res