@storybook/nextjs-vite
Version:
Storybook for Next.js and Vite: Develop, document, and test UI components in isolation
1,991 lines • 90.8 kB
JavaScript
import CJS_COMPAT_NODE_URL_kce4cj6w9rd from 'node:url';
import CJS_COMPAT_NODE_PATH_kce4cj6w9rd from 'node:path';
import CJS_COMPAT_NODE_MODULE_kce4cj6w9rd from "node:module";
var __filename = CJS_COMPAT_NODE_URL_kce4cj6w9rd.fileURLToPath(import.meta.url);
var __dirname = CJS_COMPAT_NODE_PATH_kce4cj6w9rd.dirname(__filename);
var require = CJS_COMPAT_NODE_MODULE_kce4cj6w9rd.createRequire(import.meta.url);
// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------
import {
__commonJS,
__require,
__toESM
} from "./_node-chunks/chunk-5XLOLMQB.js";
// ../../node_modules/semver/internal/constants.js
var require_constants = __commonJS({
"../../node_modules/semver/internal/constants.js"(exports, module) {
"use strict";
var SEMVER_SPEC_VERSION = "2.0.0", MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
9007199254740991, MAX_SAFE_COMPONENT_LENGTH = 16, MAX_SAFE_BUILD_LENGTH = 250, RELEASE_TYPES = [
"major",
"premajor",
"minor",
"preminor",
"patch",
"prepatch",
"prerelease"
];
module.exports = {
MAX_LENGTH: 256,
MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_BUILD_LENGTH,
MAX_SAFE_INTEGER,
RELEASE_TYPES,
SEMVER_SPEC_VERSION,
FLAG_INCLUDE_PRERELEASE: 1,
FLAG_LOOSE: 2
};
}
});
// ../../node_modules/semver/internal/debug.js
var require_debug = __commonJS({
"../../node_modules/semver/internal/debug.js"(exports, module) {
"use strict";
var debug = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
};
module.exports = debug;
}
});
// ../../node_modules/semver/internal/re.js
var require_re = __commonJS({
"../../node_modules/semver/internal/re.js"(exports, module) {
"use strict";
var {
MAX_SAFE_COMPONENT_LENGTH,
MAX_SAFE_BUILD_LENGTH,
MAX_LENGTH
} = require_constants(), debug = require_debug();
exports = module.exports = {};
var re = exports.re = [], safeRe = exports.safeRe = [], src = exports.src = [], safeSrc = exports.safeSrc = [], t = exports.t = {}, R = 0, LETTERDASHNUMBER = "[a-zA-Z0-9-]", safeRegexReplacements = [
["\\s", 1],
["\\d", MAX_LENGTH],
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
], makeSafeRegex = (value) => {
for (let [token, max] of safeRegexReplacements)
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
return value;
}, createToken = (name, value, isGlobal) => {
let safe = makeSafeRegex(value), index = R++;
debug(name, index, value), t[name] = index, src[index] = value, safeSrc[index] = safe, re[index] = new RegExp(value, isGlobal ? "g" : void 0), safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
};
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
createToken("GTLT", "((?:<|>)?=?)");
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
createToken("COERCERTL", src[t.COERCE], !0);
createToken("COERCERTLFULL", src[t.COERCEFULL], !0);
createToken("LONETILDE", "(?:~>?)");
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, !0);
exports.tildeTrimReplace = "$1~";
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
createToken("LONECARET", "(?:\\^)");
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, !0);
exports.caretTrimReplace = "$1^";
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, !0);
exports.comparatorTrimReplace = "$1$2$3";
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
createToken("STAR", "(<|>)?=?\\s*\\*");
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
}
});
// ../../node_modules/semver/internal/parse-options.js
var require_parse_options = __commonJS({
"../../node_modules/semver/internal/parse-options.js"(exports, module) {
"use strict";
var looseOption = Object.freeze({ loose: !0 }), emptyOpts = Object.freeze({}), parseOptions = (options) => options ? typeof options != "object" ? looseOption : options : emptyOpts;
module.exports = parseOptions;
}
});
// ../../node_modules/semver/internal/identifiers.js
var require_identifiers = __commonJS({
"../../node_modules/semver/internal/identifiers.js"(exports, module) {
"use strict";
var numeric = /^[0-9]+$/, compareIdentifiers = (a, b) => {
if (typeof a == "number" && typeof b == "number")
return a === b ? 0 : a < b ? -1 : 1;
let anum = numeric.test(a), bnum = numeric.test(b);
return anum && bnum && (a = +a, b = +b), a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
}, rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
module.exports = {
compareIdentifiers,
rcompareIdentifiers
};
}
});
// ../../node_modules/semver/classes/semver.js
var require_semver = __commonJS({
"../../node_modules/semver/classes/semver.js"(exports, module) {
"use strict";
var debug = require_debug(), { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants(), { safeRe: re, t } = require_re(), parseOptions = require_parse_options(), { compareIdentifiers } = require_identifiers(), SemVer = class _SemVer {
constructor(version, options) {
if (options = parseOptions(options), version instanceof _SemVer) {
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease)
return version;
version = version.version;
} else if (typeof version != "string")
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
if (version.length > MAX_LENGTH)
throw new TypeError(
`version is longer than ${MAX_LENGTH} characters`
);
debug("SemVer", version, options), this.options = options, this.loose = !!options.loose, this.includePrerelease = !!options.includePrerelease;
let m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
if (!m)
throw new TypeError(`Invalid Version: ${version}`);
if (this.raw = version, this.major = +m[1], this.minor = +m[2], this.patch = +m[3], this.major > MAX_SAFE_INTEGER || this.major < 0)
throw new TypeError("Invalid major version");
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0)
throw new TypeError("Invalid minor version");
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0)
throw new TypeError("Invalid patch version");
m[4] ? this.prerelease = m[4].split(".").map((id) => {
if (/^[0-9]+$/.test(id)) {
let num = +id;
if (num >= 0 && num < MAX_SAFE_INTEGER)
return num;
}
return id;
}) : this.prerelease = [], this.build = m[5] ? m[5].split(".") : [], this.format();
}
format() {
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
}
toString() {
return this.version;
}
compare(other) {
if (debug("SemVer.compare", this.version, this.options, other), !(other instanceof _SemVer)) {
if (typeof other == "string" && other === this.version)
return 0;
other = new _SemVer(other, this.options);
}
return other.version === this.version ? 0 : this.compareMain(other) || this.comparePre(other);
}
compareMain(other) {
return other instanceof _SemVer || (other = new _SemVer(other, this.options)), this.major < other.major ? -1 : this.major > other.major ? 1 : this.minor < other.minor ? -1 : this.minor > other.minor ? 1 : this.patch < other.patch ? -1 : this.patch > other.patch ? 1 : 0;
}
comparePre(other) {
if (other instanceof _SemVer || (other = new _SemVer(other, this.options)), this.prerelease.length && !other.prerelease.length)
return -1;
if (!this.prerelease.length && other.prerelease.length)
return 1;
if (!this.prerelease.length && !other.prerelease.length)
return 0;
let i = 0;
do {
let a = this.prerelease[i], b = other.prerelease[i];
if (debug("prerelease compare", i, a, b), a === void 0 && b === void 0)
return 0;
if (b === void 0)
return 1;
if (a === void 0)
return -1;
if (a === b)
continue;
return compareIdentifiers(a, b);
} while (++i);
}
compareBuild(other) {
other instanceof _SemVer || (other = new _SemVer(other, this.options));
let i = 0;
do {
let a = this.build[i], b = other.build[i];
if (debug("build compare", i, a, b), a === void 0 && b === void 0)
return 0;
if (b === void 0)
return 1;
if (a === void 0)
return -1;
if (a === b)
continue;
return compareIdentifiers(a, b);
} while (++i);
}
// preminor will bump the version up to the next minor release, and immediately
// down to pre-release. premajor and prepatch work the same way.
inc(release, identifier, identifierBase) {
if (release.startsWith("pre")) {
if (!identifier && identifierBase === !1)
throw new Error("invalid increment argument: identifier is empty");
if (identifier) {
let match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
if (!match || match[1] !== identifier)
throw new Error(`invalid identifier: ${identifier}`);
}
}
switch (release) {
case "premajor":
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", identifier, identifierBase);
break;
case "preminor":
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", identifier, identifierBase);
break;
case "prepatch":
this.prerelease.length = 0, this.inc("patch", identifier, identifierBase), this.inc("pre", identifier, identifierBase);
break;
// If the input is a non-prerelease version, this acts the same as
// prepatch.
case "prerelease":
this.prerelease.length === 0 && this.inc("patch", identifier, identifierBase), this.inc("pre", identifier, identifierBase);
break;
case "release":
if (this.prerelease.length === 0)
throw new Error(`version ${this.raw} is not a prerelease`);
this.prerelease.length = 0;
break;
case "major":
(this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
break;
case "minor":
(this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
break;
case "patch":
this.prerelease.length === 0 && this.patch++, this.prerelease = [];
break;
// This probably shouldn't be used publicly.
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
case "pre": {
let base = Number(identifierBase) ? 1 : 0;
if (this.prerelease.length === 0)
this.prerelease = [base];
else {
let i = this.prerelease.length;
for (; --i >= 0; )
typeof this.prerelease[i] == "number" && (this.prerelease[i]++, i = -2);
if (i === -1) {
if (identifier === this.prerelease.join(".") && identifierBase === !1)
throw new Error("invalid increment argument: identifier already exists");
this.prerelease.push(base);
}
}
if (identifier) {
let prerelease = [identifier, base];
identifierBase === !1 && (prerelease = [identifier]), compareIdentifiers(this.prerelease[0], identifier) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = prerelease) : this.prerelease = prerelease;
}
break;
}
default:
throw new Error(`invalid increment argument: ${release}`);
}
return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
}
};
module.exports = SemVer;
}
});
// ../../node_modules/semver/functions/parse.js
var require_parse = __commonJS({
"../../node_modules/semver/functions/parse.js"(exports, module) {
"use strict";
var SemVer = require_semver(), parse2 = (version, options, throwErrors = !1) => {
if (version instanceof SemVer)
return version;
try {
return new SemVer(version, options);
} catch (er) {
if (!throwErrors)
return null;
throw er;
}
};
module.exports = parse2;
}
});
// ../../node_modules/semver/functions/valid.js
var require_valid = __commonJS({
"../../node_modules/semver/functions/valid.js"(exports, module) {
"use strict";
var parse2 = require_parse(), valid = (version, options) => {
let v = parse2(version, options);
return v ? v.version : null;
};
module.exports = valid;
}
});
// ../../node_modules/semver/functions/clean.js
var require_clean = __commonJS({
"../../node_modules/semver/functions/clean.js"(exports, module) {
"use strict";
var parse2 = require_parse(), clean = (version, options) => {
let s = parse2(version.trim().replace(/^[=v]+/, ""), options);
return s ? s.version : null;
};
module.exports = clean;
}
});
// ../../node_modules/semver/functions/inc.js
var require_inc = __commonJS({
"../../node_modules/semver/functions/inc.js"(exports, module) {
"use strict";
var SemVer = require_semver(), inc = (version, release, options, identifier, identifierBase) => {
typeof options == "string" && (identifierBase = identifier, identifier = options, options = void 0);
try {
return new SemVer(
version instanceof SemVer ? version.version : version,
options
).inc(release, identifier, identifierBase).version;
} catch {
return null;
}
};
module.exports = inc;
}
});
// ../../node_modules/semver/functions/diff.js
var require_diff = __commonJS({
"../../node_modules/semver/functions/diff.js"(exports, module) {
"use strict";
var parse2 = require_parse(), diff = (version1, version2) => {
let v1 = parse2(version1, null, !0), v2 = parse2(version2, null, !0), comparison = v1.compare(v2);
if (comparison === 0)
return null;
let v1Higher = comparison > 0, highVersion = v1Higher ? v1 : v2, lowVersion = v1Higher ? v2 : v1, highHasPre = !!highVersion.prerelease.length;
if (!!lowVersion.prerelease.length && !highHasPre) {
if (!lowVersion.patch && !lowVersion.minor)
return "major";
if (lowVersion.compareMain(highVersion) === 0)
return lowVersion.minor && !lowVersion.patch ? "minor" : "patch";
}
let prefix = highHasPre ? "pre" : "";
return v1.major !== v2.major ? prefix + "major" : v1.minor !== v2.minor ? prefix + "minor" : v1.patch !== v2.patch ? prefix + "patch" : "prerelease";
};
module.exports = diff;
}
});
// ../../node_modules/semver/functions/major.js
var require_major = __commonJS({
"../../node_modules/semver/functions/major.js"(exports, module) {
"use strict";
var SemVer = require_semver(), major = (a, loose) => new SemVer(a, loose).major;
module.exports = major;
}
});
// ../../node_modules/semver/functions/minor.js
var require_minor = __commonJS({
"../../node_modules/semver/functions/minor.js"(exports, module) {
"use strict";
var SemVer = require_semver(), minor = (a, loose) => new SemVer(a, loose).minor;
module.exports = minor;
}
});
// ../../node_modules/semver/functions/patch.js
var require_patch = __commonJS({
"../../node_modules/semver/functions/patch.js"(exports, module) {
"use strict";
var SemVer = require_semver(), patch = (a, loose) => new SemVer(a, loose).patch;
module.exports = patch;
}
});
// ../../node_modules/semver/functions/prerelease.js
var require_prerelease = __commonJS({
"../../node_modules/semver/functions/prerelease.js"(exports, module) {
"use strict";
var parse2 = require_parse(), prerelease = (version, options) => {
let parsed = parse2(version, options);
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
};
module.exports = prerelease;
}
});
// ../../node_modules/semver/functions/compare.js
var require_compare = __commonJS({
"../../node_modules/semver/functions/compare.js"(exports, module) {
"use strict";
var SemVer = require_semver(), compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
module.exports = compare;
}
});
// ../../node_modules/semver/functions/rcompare.js
var require_rcompare = __commonJS({
"../../node_modules/semver/functions/rcompare.js"(exports, module) {
"use strict";
var compare = require_compare(), rcompare = (a, b, loose) => compare(b, a, loose);
module.exports = rcompare;
}
});
// ../../node_modules/semver/functions/compare-loose.js
var require_compare_loose = __commonJS({
"../../node_modules/semver/functions/compare-loose.js"(exports, module) {
"use strict";
var compare = require_compare(), compareLoose = (a, b) => compare(a, b, !0);
module.exports = compareLoose;
}
});
// ../../node_modules/semver/functions/compare-build.js
var require_compare_build = __commonJS({
"../../node_modules/semver/functions/compare-build.js"(exports, module) {
"use strict";
var SemVer = require_semver(), compareBuild = (a, b, loose) => {
let versionA = new SemVer(a, loose), versionB = new SemVer(b, loose);
return versionA.compare(versionB) || versionA.compareBuild(versionB);
};
module.exports = compareBuild;
}
});
// ../../node_modules/semver/functions/sort.js
var require_sort = __commonJS({
"../../node_modules/semver/functions/sort.js"(exports, module) {
"use strict";
var compareBuild = require_compare_build(), sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
module.exports = sort;
}
});
// ../../node_modules/semver/functions/rsort.js
var require_rsort = __commonJS({
"../../node_modules/semver/functions/rsort.js"(exports, module) {
"use strict";
var compareBuild = require_compare_build(), rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
module.exports = rsort;
}
});
// ../../node_modules/semver/functions/gt.js
var require_gt = __commonJS({
"../../node_modules/semver/functions/gt.js"(exports, module) {
"use strict";
var compare = require_compare(), gt = (a, b, loose) => compare(a, b, loose) > 0;
module.exports = gt;
}
});
// ../../node_modules/semver/functions/lt.js
var require_lt = __commonJS({
"../../node_modules/semver/functions/lt.js"(exports, module) {
"use strict";
var compare = require_compare(), lt = (a, b, loose) => compare(a, b, loose) < 0;
module.exports = lt;
}
});
// ../../node_modules/semver/functions/eq.js
var require_eq = __commonJS({
"../../node_modules/semver/functions/eq.js"(exports, module) {
"use strict";
var compare = require_compare(), eq = (a, b, loose) => compare(a, b, loose) === 0;
module.exports = eq;
}
});
// ../../node_modules/semver/functions/neq.js
var require_neq = __commonJS({
"../../node_modules/semver/functions/neq.js"(exports, module) {
"use strict";
var compare = require_compare(), neq = (a, b, loose) => compare(a, b, loose) !== 0;
module.exports = neq;
}
});
// ../../node_modules/semver/functions/gte.js
var require_gte = __commonJS({
"../../node_modules/semver/functions/gte.js"(exports, module) {
"use strict";
var compare = require_compare(), gte = (a, b, loose) => compare(a, b, loose) >= 0;
module.exports = gte;
}
});
// ../../node_modules/semver/functions/lte.js
var require_lte = __commonJS({
"../../node_modules/semver/functions/lte.js"(exports, module) {
"use strict";
var compare = require_compare(), lte = (a, b, loose) => compare(a, b, loose) <= 0;
module.exports = lte;
}
});
// ../../node_modules/semver/functions/cmp.js
var require_cmp = __commonJS({
"../../node_modules/semver/functions/cmp.js"(exports, module) {
"use strict";
var eq = require_eq(), neq = require_neq(), gt = require_gt(), gte = require_gte(), lt = require_lt(), lte = require_lte(), cmp = (a, op, b, loose) => {
switch (op) {
case "===":
return typeof a == "object" && (a = a.version), typeof b == "object" && (b = b.version), a === b;
case "!==":
return typeof a == "object" && (a = a.version), typeof b == "object" && (b = b.version), a !== b;
case "":
case "=":
case "==":
return eq(a, b, loose);
case "!=":
return neq(a, b, loose);
case ">":
return gt(a, b, loose);
case ">=":
return gte(a, b, loose);
case "<":
return lt(a, b, loose);
case "<=":
return lte(a, b, loose);
default:
throw new TypeError(`Invalid operator: ${op}`);
}
};
module.exports = cmp;
}
});
// ../../node_modules/semver/functions/coerce.js
var require_coerce = __commonJS({
"../../node_modules/semver/functions/coerce.js"(exports, module) {
"use strict";
var SemVer = require_semver(), parse2 = require_parse(), { safeRe: re, t } = require_re(), coerce = (version, options) => {
if (version instanceof SemVer)
return version;
if (typeof version == "number" && (version = String(version)), typeof version != "string")
return null;
options = options || {};
let match = null;
if (!options.rtl)
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
else {
let coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL], next;
for (; (next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length); )
(!match || next.index + next[0].length !== match.index + match[0].length) && (match = next), coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
coerceRtlRegex.lastIndex = -1;
}
if (match === null)
return null;
let major = match[2], minor = match[3] || "0", patch = match[4] || "0", prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "", build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
};
module.exports = coerce;
}
});
// ../../node_modules/semver/internal/lrucache.js
var require_lrucache = __commonJS({
"../../node_modules/semver/internal/lrucache.js"(exports, module) {
"use strict";
var LRUCache = class {
constructor() {
this.max = 1e3, this.map = /* @__PURE__ */ new Map();
}
get(key) {
let value = this.map.get(key);
if (value !== void 0)
return this.map.delete(key), this.map.set(key, value), value;
}
delete(key) {
return this.map.delete(key);
}
set(key, value) {
if (!this.delete(key) && value !== void 0) {
if (this.map.size >= this.max) {
let firstKey = this.map.keys().next().value;
this.delete(firstKey);
}
this.map.set(key, value);
}
return this;
}
};
module.exports = LRUCache;
}
});
// ../../node_modules/semver/classes/range.js
var require_range = __commonJS({
"../../node_modules/semver/classes/range.js"(exports, module) {
"use strict";
var SPACE_CHARACTERS = /\s+/g, Range = class _Range {
constructor(range, options) {
if (options = parseOptions(options), range instanceof _Range)
return range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease ? range : new _Range(range.raw, options);
if (range instanceof Comparator)
return this.raw = range.value, this.set = [[range]], this.formatted = void 0, this;
if (this.options = options, this.loose = !!options.loose, this.includePrerelease = !!options.includePrerelease, this.raw = range.trim().replace(SPACE_CHARACTERS, " "), this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length), !this.set.length)
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
if (this.set.length > 1) {
let first = this.set[0];
if (this.set = this.set.filter((c) => !isNullSet(c[0])), this.set.length === 0)
this.set = [first];
else if (this.set.length > 1) {
for (let c of this.set)
if (c.length === 1 && isAny(c[0])) {
this.set = [c];
break;
}
}
}
this.formatted = void 0;
}
get range() {
if (this.formatted === void 0) {
this.formatted = "";
for (let i = 0; i < this.set.length; i++) {
i > 0 && (this.formatted += "||");
let comps = this.set[i];
for (let k = 0; k < comps.length; k++)
k > 0 && (this.formatted += " "), this.formatted += comps[k].toString().trim();
}
}
return this.formatted;
}
format() {
return this.range;
}
toString() {
return this.range;
}
parseRange(range) {
let memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range, cached = cache.get(memoKey);
if (cached)
return cached;
let loose = this.options.loose, hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
range = range.replace(hr, hyphenReplace(this.options.includePrerelease)), debug("hyphen replace", range), range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace), debug("comparator trim", range), range = range.replace(re[t.TILDETRIM], tildeTrimReplace), debug("tilde trim", range), range = range.replace(re[t.CARETTRIM], caretTrimReplace), debug("caret trim", range);
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
loose && (rangeList = rangeList.filter((comp) => (debug("loose invalid filter", comp, this.options), !!comp.match(re[t.COMPARATORLOOSE])))), debug("range list", rangeList);
let rangeMap = /* @__PURE__ */ new Map(), comparators = rangeList.map((comp) => new Comparator(comp, this.options));
for (let comp of comparators) {
if (isNullSet(comp))
return [comp];
rangeMap.set(comp.value, comp);
}
rangeMap.size > 1 && rangeMap.has("") && rangeMap.delete("");
let result = [...rangeMap.values()];
return cache.set(memoKey, result), result;
}
intersects(range, options) {
if (!(range instanceof _Range))
throw new TypeError("a Range is required");
return this.set.some((thisComparators) => isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => rangeComparators.every((rangeComparator) => thisComparator.intersects(rangeComparator, options)))));
}
// if ANY of the sets match ALL of its comparators, then pass
test(version) {
if (!version)
return !1;
if (typeof version == "string")
try {
version = new SemVer(version, this.options);
} catch {
return !1;
}
for (let i = 0; i < this.set.length; i++)
if (testSet(this.set[i], version, this.options))
return !0;
return !1;
}
};
module.exports = Range;
var LRU = require_lrucache(), cache = new LRU(), parseOptions = require_parse_options(), Comparator = require_comparator(), debug = require_debug(), SemVer = require_semver(), {
safeRe: re,
t,
comparatorTrimReplace,
tildeTrimReplace,
caretTrimReplace
} = require_re(), { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants(), isNullSet = (c) => c.value === "<0.0.0-0", isAny = (c) => c.value === "", isSatisfiable = (comparators, options) => {
let result = !0, remainingComparators = comparators.slice(), testComparator = remainingComparators.pop();
for (; result && remainingComparators.length; )
result = remainingComparators.every((otherComparator) => testComparator.intersects(otherComparator, options)), testComparator = remainingComparators.pop();
return result;
}, parseComparator = (comp, options) => (comp = comp.replace(re[t.BUILD], ""), debug("comp", comp, options), comp = replaceCarets(comp, options), debug("caret", comp), comp = replaceTildes(comp, options), debug("tildes", comp), comp = replaceXRanges(comp, options), debug("xrange", comp), comp = replaceStars(comp, options), debug("stars", comp), comp), isX = (id) => !id || id.toLowerCase() === "x" || id === "*", replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" "), replaceTilde = (comp, options) => {
let r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
return comp.replace(r, (_, M, m, p, pr) => {
debug("tilde", comp, _, M, m, p, pr);
let ret;
return isX(M) ? ret = "" : isX(m) ? ret = `>=${M}.0.0 <${+M + 1}.0.0-0` : isX(p) ? ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` : pr ? (debug("replaceTilde pr", pr), ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`) : ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`, debug("tilde return", ret), ret;
});
}, replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" "), replaceCaret = (comp, options) => {
debug("caret", comp, options);
let r = options.loose ? re[t.CARETLOOSE] : re[t.CARET], z = options.includePrerelease ? "-0" : "";
return comp.replace(r, (_, M, m, p, pr) => {
debug("caret", comp, _, M, m, p, pr);
let ret;
return isX(M) ? ret = "" : isX(m) ? ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` : isX(p) ? M === "0" ? ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` : pr ? (debug("replaceCaret pr", pr), M === "0" ? m === "0" ? ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0` : ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`) : (debug("no pr"), M === "0" ? m === "0" ? ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0` : ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0` : ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`), debug("caret return", ret), ret;
});
}, replaceXRanges = (comp, options) => (debug("replaceXRanges", comp, options), comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ")), replaceXRange = (comp, options) => {
comp = comp.trim();
let r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
debug("xRange", comp, ret, gtlt, M, m, p, pr);
let xM = isX(M), xm = xM || isX(m), xp = xm || isX(p), anyX = xp;
return gtlt === "=" && anyX && (gtlt = ""), pr = options.includePrerelease ? "-0" : "", xM ? gtlt === ">" || gtlt === "<" ? ret = "<0.0.0-0" : ret = "*" : gtlt && anyX ? (xm && (m = 0), p = 0, gtlt === ">" ? (gtlt = ">=", xm ? (M = +M + 1, m = 0, p = 0) : (m = +m + 1, p = 0)) : gtlt === "<=" && (gtlt = "<", xm ? M = +M + 1 : m = +m + 1), gtlt === "<" && (pr = "-0"), ret = `${gtlt + M}.${m}.${p}${pr}`) : xm ? ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` : xp && (ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`), debug("xRange return", ret), ret;
});
}, replaceStars = (comp, options) => (debug("replaceStars", comp, options), comp.trim().replace(re[t.STAR], "")), replaceGTE0 = (comp, options) => (debug("replaceGTE0", comp, options), comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "")), hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => (isX(fM) ? from = "" : isX(fm) ? from = `>=${fM}.0.0${incPr ? "-0" : ""}` : isX(fp) ? from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}` : fpr ? from = `>=${from}` : from = `>=${from}${incPr ? "-0" : ""}`, isX(tM) ? to = "" : isX(tm) ? to = `<${+tM + 1}.0.0-0` : isX(tp) ? to = `<${tM}.${+tm + 1}.0-0` : tpr ? to = `<=${tM}.${tm}.${tp}-${tpr}` : incPr ? to = `<${tM}.${tm}.${+tp + 1}-0` : to = `<=${to}`, `${from} ${to}`.trim()), testSet = (set, version, options) => {
for (let i = 0; i < set.length; i++)
if (!set[i].test(version))
return !1;
if (version.prerelease.length && !options.includePrerelease) {
for (let i = 0; i < set.length; i++)
if (debug(set[i].semver), set[i].semver !== Comparator.ANY && set[i].semver.prerelease.length > 0) {
let allowed = set[i].semver;
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch)
return !0;
}
return !1;
}
return !0;
};
}
});
// ../../node_modules/semver/classes/comparator.js
var require_comparator = __commonJS({
"../../node_modules/semver/classes/comparator.js"(exports, module) {
"use strict";
var ANY = Symbol("SemVer ANY"), Comparator = class _Comparator {
static get ANY() {
return ANY;
}
constructor(comp, options) {
if (options = parseOptions(options), comp instanceof _Comparator) {
if (comp.loose === !!options.loose)
return comp;
comp = comp.value;
}
comp = comp.trim().split(/\s+/).join(" "), debug("comparator", comp, options), this.options = options, this.loose = !!options.loose, this.parse(comp), this.semver === ANY ? this.value = "" : this.value = this.operator + this.semver.version, debug("comp", this);
}
parse(comp) {
let r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR], m = comp.match(r);
if (!m)
throw new TypeError(`Invalid comparator: ${comp}`);
this.operator = m[1] !== void 0 ? m[1] : "", this.operator === "=" && (this.operator = ""), m[2] ? this.semver = new SemVer(m[2], this.options.loose) : this.semver = ANY;
}
toString() {
return this.value;
}
test(version) {
if (debug("Comparator.test", version, this.options.loose), this.semver === ANY || version === ANY)
return !0;
if (typeof version == "string")
try {
version = new SemVer(version, this.options);
} catch {
return !1;
}
return cmp(version, this.operator, this.semver, this.options);
}
intersects(comp, options) {
if (!(comp instanceof _Comparator))
throw new TypeError("a Comparator is required");
return this.operator === "" ? this.value === "" ? !0 : new Range(comp.value, options).test(this.value) : comp.operator === "" ? comp.value === "" ? !0 : new Range(this.value, options).test(comp.semver) : (options = parseOptions(options), options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0") || !options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && comp.operator.startsWith(">") || this.operator.startsWith("<") && comp.operator.startsWith("<") || this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=") || cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<") || cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")));
}
};
module.exports = Comparator;
var parseOptions = require_parse_options(), { safeRe: re, t } = require_re(), cmp = require_cmp(), debug = require_debug(), SemVer = require_semver(), Range = require_range();
}
});
// ../../node_modules/semver/functions/satisfies.js
var require_satisfies = __commonJS({
"../../node_modules/semver/functions/satisfies.js"(exports, module) {
"use strict";
var Range = require_range(), satisfies = (version, range, options) => {
try {
range = new Range(range, options);
} catch {
return !1;
}
return range.test(version);
};
module.exports = satisfies;
}
});
// ../../node_modules/semver/ranges/to-comparators.js
var require_to_comparators = __commonJS({
"../../node_modules/semver/ranges/to-comparators.js"(exports, module) {
"use strict";
var Range = require_range(), toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
module.exports = toComparators;
}
});
// ../../node_modules/semver/ranges/max-satisfying.js
var require_max_satisfying = __commonJS({
"../../node_modules/semver/ranges/max-satisfying.js"(exports, module) {
"use strict";
var SemVer = require_semver(), Range = require_range(), maxSatisfying = (versions, range, options) => {
let max = null, maxSV = null, rangeObj = null;
try {
rangeObj = new Range(range, options);
} catch {
return null;
}
return versions.forEach((v) => {
rangeObj.test(v) && (!max || maxSV.compare(v) === -1) && (max = v, maxSV = new SemVer(max, options));
}), max;
};
module.exports = maxSatisfying;
}
});
// ../../node_modules/semver/ranges/min-satisfying.js
var require_min_satisfying = __commonJS({
"../../node_modules/semver/ranges/min-satisfying.js"(exports, module) {
"use strict";
var SemVer = require_semver(), Range = require_range(), minSatisfying = (versions, range, options) => {
let min = null, minSV = null, rangeObj = null;
try {
rangeObj = new Range(range, options);
} catch {
return null;
}
return versions.forEach((v) => {
rangeObj.test(v) && (!min || minSV.compare(v) === 1) && (min = v, minSV = new SemVer(min, options));
}), min;
};
module.exports = minSatisfying;
}
});
// ../../node_modules/semver/ranges/min-version.js
var require_min_version = __commonJS({
"../../node_modules/semver/ranges/min-version.js"(exports, module) {
"use strict";
var SemVer = require_semver(), Range = require_range(), gt = require_gt(), minVersion = (range, loose) => {
range = new Range(range, loose);
let minver = new SemVer("0.0.0");
if (range.test(minver) || (minver = new SemVer("0.0.0-0"), range.test(minver)))
return minver;
minver = null;
for (let i = 0; i < range.set.length; ++i) {
let comparators = range.set[i], setMin = null;
comparators.forEach((comparator) => {
let compver = new SemVer(comparator.semver.version);
switch (comparator.operator) {
case ">":
compver.prerelease.length === 0 ? compver.patch++ : compver.prerelease.push(0), compver.raw = compver.format();
/* fallthrough */
case "":
case ">=":
(!setMin || gt(compver, setMin)) && (setMin = compver);
break;
case "<":
case "<=":
break;
/* istanbul ignore next */
default:
throw new Error(`Unexpected operation: ${comparator.operator}`);
}
}), setMin && (!minver || gt(minver, setMin)) && (minver = setMin);
}
return minver && range.test(minver) ? minver : null;
};
module.exports = minVersion;
}
});
// ../../node_modules/semver/ranges/valid.js
var require_valid2 = __commonJS({
"../../node_modules/semver/ranges/valid.js"(exports, module) {
"use strict";
var Range = require_range(), validRange = (range, options) => {
try {
return new Range(range, options).range || "*";
} catch {
return null;
}
};
module.exports = validRange;
}
});
// ../../node_modules/semver/ranges/outside.js
var require_outside = __commonJS({
"../../node_modules/semver/ranges/outside.js"(exports, module) {
"use strict";
var SemVer = require_semver(), Comparator = require_comparator(), { ANY } = Comparator, Range = require_range(), satisfies = require_satisfies(), gt = require_gt(), lt = require_lt(), lte = require_lte(), gte = require_gte(), outside = (version, range, hilo, options) => {
version = new SemVer(version, options), range = new Range(range, options);
let gtfn, ltefn, ltfn, comp, ecomp;
switch (hilo) {
case ">":
gtfn = gt, ltefn = lte, ltfn = lt, comp = ">", ecomp = ">=";
break;
case "<":
gtfn = lt, ltefn = gte, ltfn = gt, comp = "<", ecomp = "<=";
break;
default:
throw new TypeError('Must provide a hilo val of "<" or ">"');
}
if (satisfies(version, range, options))
return !1;
for (let i = 0; i < range.set.length; ++i) {
let comparators = range.set[i], high = null, low = null;
if (comparators.forEach((comparator) => {
comparator.semver === ANY && (comparator = new Comparator(">=0.0.0")), high = high || comparator, low = low || comparator, gtfn(comparator.semver, high.semver, options) ? high = comparator : ltfn(comparator.semver, low.semver, options) && (low = comparator);
}), high.operator === comp || high.operator === ecomp || (!low.operator || low.operator === comp) && ltefn(version, low.semver))
return !1;
if (low.operator === ecomp && ltfn(version, low.semver))
return !1;
}
return !0;
};
module.exports = outside;
}
});
// ../../node_modules/semver/ranges/gtr.js
var require_gtr = __commonJS({
"../../node_modules/semver/ranges/gtr.js"(exports, module) {
"use strict";
var outside = require_outside(), gtr = (version, range, options) => outside(version, range, ">", options);
module.exports = gtr;
}
});
// ../../node_modules/semver/ranges/ltr.js
var require_ltr = __commonJS({
"../../node_modules/semver/ranges/ltr.js"(exports, module) {
"use strict";
var outside = require_outside(), ltr = (version, range, options) => outside(version, range, "<", options);
module.exports = ltr;
}
});
// ../../node_modules/semver/ranges/intersects.js
var require_intersects = __commonJS({
"../../node_modules/semver/ranges/intersects.js"(exports, module) {
"use strict";
var Range = require_range(), intersects = (r1, r2, options) => (r1 = new Range(r1, options), r2 = new Range(r2, options), r1.intersects(r2, options));
module.exports = intersects;
}
});
// ../../node_modules/semver/ranges/simplify.js
var require_simplify = __commonJS({
"../../node_modules/semver/ranges/simplify.js"(exports, module) {
"use strict";
var satisfies = require_satisfies(), compare = require_compare();
module.exports = (versions, range, options) => {
let set = [], first = null, prev = null, v = versions.sort((a, b) => compare(a, b, options));
for (let version of v)
satisfies(version, range, options) ? (prev = version, first || (first = version)) : (prev && set.push([first, prev]), prev = null, first = null);
first && set.push([first, null]);
let ranges = [];
for (let [min, max] of set)
min === max ? ranges.push(min) : !max && min === v[0] ? ranges.push("*") : max ? min === v[0] ? ranges.push(`<=${max}`) : ranges.push(`${min} - ${max}`) : ranges.push(`>=${min}`);
let simplified = ranges.join(" || "), original = typeof range.raw == "string" ? range.raw : String(range);
return simplified.length < original.length ? simplified : range;
};
}
});
// ../../node_modules/semver/ranges/subset.js
var require_subset = __commonJS({
"../../node_modules/semver/ranges/subset.js"(exports, module) {
"use strict";
var Range = require_range(), Comparator = require_comparator(), { ANY } = Comparator, satisfies = require_satisfies(), compare = require_compare(), subset = (sub, dom, options = {}) => {
if (sub === dom)
return !0;
sub = new Range(sub, options), dom = new Range(dom, options);
let sawNonNull = !1;
OUTER: for (let simpleSub of sub.set) {
for (let simpleDom of dom.set) {
let isSub = simpleSubset(simpleSub, simpleDom, options);
if (sawNonNull = sawNonNull || isSub !== null, isSub)
continue OUTER;
}
if (sawNonNull)
return !1;
}
return !0;
}, minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")], minimumVersion = [new Comparator(">=0.0.0")], simpleSubset = (sub, dom, options) => {
if (sub === dom)
return !0;
if (sub.length === 1 && sub[0].semver === ANY) {
if (dom.length === 1 && dom[0].semver === ANY)
return !0;
options.includePrerelease ? sub = minimumVersionWithPreRelease : sub = minimumVersion;
}
if (dom.length === 1 && dom[0].semver === ANY) {
if (options.includePrerelease)
return !0;
dom = minimumVersion;
}
let eqSet = /* @__PURE__ */ new Set(), gt, lt;
for (let c of sub)
c.operator === ">" || c.operator === ">=" ? gt = higherGT(gt, c, options) : c.operator === "<" || c.operator === "<=" ? lt = lowerLT(lt, c, options) : eqSet.add(c.semver);
if (eqSet.size > 1)
return null;
let gtltComp;
if (gt && lt) {
if (gtltComp = compare(gt.semver, lt.semver, options), gtltComp > 0)
return null;
if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
return null;
}
for (let eq of eqSet) {
if (gt && !satisfies(eq, String(gt), options) || lt && !satisfies(eq, String(lt), options))
return null;
for (let c of dom)
if (!satisfies(eq, String(c), options))
return !1;
return !0;
}
let higher, lower, hasDomLT, hasDomGT, needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : !1, needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : !1;
needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0 && (needDomLTPre = !1);
for (let c of dom) {
if (hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=", hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=", gt) {
if (needDomGTPre && c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch && (needDomGTPre = !1), c.operator === ">" || c.operator === ">=") {
if (higher = higherGT(gt, c, options), higher === c && higher !== gt)
return !1;
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options))
return !1;
}
if (lt) {
if (needDomLTPre && c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch && (needDomLTPre = !1), c.operator === "<" || c.operator === "<=") {
if (lower = lowerLT(lt, c, options), lower === c && lower !== lt)
return !1;
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options))
return !1;
}
if (!c.operator && (lt || gt) && gtltComp !== 0)
return !1;
}
return !(gt && hasDomLT && !lt && gtltComp !== 0 || lt && hasDomGT && !gt && gtltComp !== 0 || needDomGTPre || needDomLTPre);
}, higherGT = (a, b, options) => {
if (!a)
return b;
let comp = compare(a.semver, b.semver, options);
return comp > 0 ? a : comp < 0 || b.operator === ">" && a.operator === ">=" ? b : a;
}, lowerLT = (a, b, options) => {
if (!a)
return b;
let comp = compare(a.semver, b.semver, options);
return comp < 0 ? a : comp > 0 || b.operator === "<" && a.operator === "<=" ? b : a;
};
module.exports = subset;
}
});
// ../../node_modules/semver/index.js
var require_semver2 = __commonJS({
"../../node_modules/semver/index.js"(exports, module) {
"use strict";
var internalRe = require_re(), constants = require_constants(), SemVer = require_semver(), identifiers = require_identifiers(), parse2 = require_parse(), valid = require_valid(), clean = require_clean(), inc = require_inc(), diff = require_diff(), major = require_major(), minor = require_minor(), patch = require_patch(), prerelease = require_prerelease(), compare = require_compare(), rcompare = require_rcompare(), compareLoose = require_compare_loose(), compareBuild = require_compare_build(), sort = require_sort(), rsort = require_rsort(), gt = require_gt(), lt = require_lt(), eq = require_eq(), neq = require_neq(), gte = require_gte(), lte = require_lte(), cmp = require_cmp(), coerce = require_coerce(), Comparator = require_comparator(), Range = require_range(), satisfies = require_satisfies(), toComparators = require_to_comparators(), maxSatisfying = require_max_satisfying(), minSatisfying = require_min_satisfying(), minVersion = require_min_version(), validRange = require_valid2(), outside = require_outside(), gtr = require_gtr(), ltr = require_ltr(), intersects = require_intersects(), simplifyRange = require_simplify(), subset = require_subset();
module.exports = {
parse: parse2,
valid,
clean,
inc,
diff,
major,
minor,
patch,
prerelease,
compare,
rcompare,
compareLoose,
compareBuild,
sort,
rsort,
gt,
lt,
eq,
neq,
gte,
lte,
cmp,
coerce,
Comparator,
Range,
satisfies,
toComparators,
maxSatisfying,
minSatisfying,
minVersion,
validRange,
outside,
gtr,
ltr,
intersects,
simplifyRange,
subset,
SemVer,
re: internalRe.re,
src: internalRe.src,
tokens: internalRe.t,
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
RELEASE_TYPES: constants.RELEASE_TYPES,
compareIdentifiers: identifiers.compareIdentifiers,
rcompareIdentifiers: identifiers.rcompareIdentifiers
};
}
});
// ../../node_modules/lilconfig/src/index.js
var require_src = __commonJS({
"../../node_modules/lilconfig/src/index.js"(exports, module) {
var path2 = __require("path"), fs = __require("fs"), os = __require("os"), url = __require("url"), fsReadFileAsync = fs.promises.readFile;
function getDefaultSearchPlaces(name, sync) {
return [
"package.json",
`.${name}rc.json`,
`.${name}rc.js`,
`.${name}rc.cjs`,
...sync ? [] : [`.${name}rc.mjs`],
`.config/${name}rc`,
`.config/${name}rc.json`,
`.config/${name}rc.js`,
`.config/${name}rc.cjs`,
...sync ? [] : [`.config/${name}rc.mjs`],
`${name}.config.js`,
`${name}.config.cjs`,
...sync ? [] : [`${name}.config.mjs`]
];
}
function parentDir(p) {
return path2.dirname(p) || path2.sep;
}
var jsonLoader = (_, content) => JSON.parse(content), requireFunc = typeof __webpack_require__ == "function" ? __non_webpack_require__ : __require, defaultLoadersSync = Object.freeze({
".js": requireFunc,
".json": requireFunc,
".cjs": requireFunc,
noExt: jsonLoader
});
module.exports.defaultLoadersSync = defaultLoadersSync;
var dynamicImport = async (id) => {
try {
return (await import(url.pathToFileURL(id).href)).default;
} catch (e) {
try {
return requireFunc(id);
} catch (requireE) {
throw requireE.code === "ERR_REQUIRE_ESM" || requireE instanceof SyntaxError && requireE.toString().includes("Cannot use import statement outside a module") ? e : requireE;
}
}
}, defaultLoaders = Object.freeze({
".js": dynamicImport,
".mjs": dynamicImport,
".cjs": dynamicImport,
".json": jsonLoader,
noExt: jsonLoader
});
module.exports.defaultLoaders = defaultLoaders;
function getOptions(name, options, sync) {
let conf = {
stopDir: os.homedir(),
searchPlaces: getDefaultSearchPlaces(name, sync),
ignoreEmptySearchPlaces: !0,
cache: !0,
transform: (x) => x,
packageProp: [name],
...options,
loaders: {
...sync ? defaultLoadersSync : defaultLoaders,
...options.loaders
}
};
return conf.searchPlaces.forEach((place) => {
let key = path2.extname(place) || "noExt", loader2 = conf.loaders[key];
if (!loader2)
throw new Error(`Missing loader for extension "${place}"`);
if (typeof loader2 != "function")
throw new Error(
`Loader for extension "${place}" is not a function: Received ${typeof loader2}.`
);
}), conf;
}
function getPackageProp(props, obj) {
return typeof props == "string" && props in obj ? obj[props] : (Array.isArray(props) ? props : props.split(".")).reduce(
(acc, prop) => acc === void 0 ? acc : acc[prop],
obj
) || null;
}
function validateFilePath(filepath) {
if (!filepath) throw new Error("load must pass a non-empty string");
}
function validateLoader(loader2, ext) {
if (!loader2) throw new Error(`No loader specified for extension "${ext}"`);
if (typeof loader2 != "function") throw new Error("loader is not a function");
}
var makeEmplace = (enableCache) => (c, filepath, res) => (enableCache && c.set(filepath, res), res);
module.exports.lilconfig = function(name, options) {
let {
ignoreEmptySearchPlaces,
loaders,
packageProp,
searchPlaces,
stopDir,
transform,
cache
} = getOptions(name, options ?? {}, !1), searchCache = /* @__PURE__ */ new Map(), loadCache = /* @__PURE__ */ new Map(), emplace = makeEmplace(cache);
return {
async search(searchFrom = process.cwd()) {
let result = {
config: null,
filepath: ""
}, visited = /* @__PURE__ */ new Set(), dir = searchFrom;
dirLoop: for (; ; ) {
if (cache) {
let r = searchCache.get(dir);
if (r !== void 0) {
for (let p of visited) searchCache.set(p, r);
return r;
}
visited.add(dir);
}
for (let searchPlace of searchPlaces) {
let filepath = path2.join(dir, searchPlace);
try {
await fs.promises.access(filepath);
} catch {
continue;
}
let content = String(await fsReadFileAsync(filepath)), loaderKey = path2.extname(searchPlace) || "noExt", loader2 = loaders[loaderKey];
if (searchPlace === "package.json") {
let pkg = await loader2(filepath, content), maybeConfig = getPackageProp(packageProp, pkg);
if (maybeConfig != null) {
result.config = maybeConfig, result.filepath = filepath;
break dirLoop;
}
continue;
}
let isEmpty = content.trim() === "";
if (!(isEmpty && ignoreEmptySearchPlaces)) {
isEmpty ? (result.isEmpty = !0, result.config = void 0) : (validateLoader(loader2, loaderKey), result.config = await loader2(filepath, content)), result.filepath = filepath;
break dirLoop;
}
}
if (dir === stopDir || dir === parentDir(dir)) break dirLoop;
dir = parentDir(dir);
}
let transformed = (
// not found
result.filepath === "" && result.config === null ? transform(null) : transform(result)
);
if (cache)
for (let p of visited) searchCache.set(p, transformed);
return transformed;
},
async load(filepath) {
validateFilePath(filepath);
let absPath = path2.resolve(process.cwd(), filepath);
if (cache && loadCache.has(absPath))
return loadCache.get(absPath);
let { base, ext } = path2.parse(absPath), loaderKey = ext || "noExt", loader2 = loaders[loaderKey];
validateLoader(loader2, loaderKey);
let content = String(await fsReadFileAsync(absPath));
if (base === "package.json") {
let pkg = await loader2(absPath, content);
return emplace(
loadCache,
absPath,
transform({
config: getPackageProp(packageProp, pkg),
filepath: absPath
})
);
}
let result = {
config: null,
filepath: absPath
}, isEmpty = content.trim() === "";
return isEmpty && ignoreEmptySearchPlaces ? emplace(
loadCache,
absPath,
transform({
config: void 0,
filepath: absPath,
isEmpty: !0
})
) : (result.config = isEmpty ? void 0 : await loader2(absPath, content), emplace(
loadCache,
absPath,
transform(isEmpty ? { ...result, isEmpty, config: void 0 } : result)
));
},
clearLoadCache() {
cache && loadCache.clear();
},
clearSearchCache() {
cache && searchCache.clear();
},
clearCaches() {
cache && (loadCache.clear(), searchCache.clear());
}
};
};
module.exports.lilconfigSync = function(name, options) {
let {
ignoreEmptySearchPlaces,
loaders,
packageProp,
searchPlaces,
stopDir,
transform,
cache
} = getOptions(name, options ?? {}, !0), searchCache = /* @__PURE__ */ new Map(), loadCache = /* @__PURE__ */ new Map(), emplace = makeEmplace(cache);
return {
search(searchFrom = process.cwd()) {
let result = {
config: null,
filepath: ""
}, visited = /* @__PURE__ */ new Set(), dir = searchFrom;
dirLoop: for (; ; ) {
if (cache) {
let r = searchCache.get(dir);
if (r !== void 0) {
for (let p of visited) searchCache.set(p, r);
return r;
}
visited.add(dir);
}
for (let searchPlace of searchPlaces) {
let filepath = path2.join(dir, searchPlace);
try {
fs.accessSync(filepath);
} catch {
continue;
}
let loaderKey = path2.extname(searchPlace) || "noExt", loader2 = loaders[loaderKey], content = String(fs.readFileSync(filepath));
if (searchPlace === "package.json") {
let pkg = loader2(filepath, content), maybeConfig = getPackageProp(packageProp, pkg);
if (maybeConfig != null) {
result.config = maybeConfig, result.filepath = filepath;
break dirLoop;
}
continue;
}
let isEmpty = content.trim() === "";
if (!(isEmpty && ignoreEmptySearchPlaces)) {
isEmpty ? (result.isEmpty = !0, result.config = void 0) : (validateLoader(loader2, loaderKey), result.config = loader2(filepath, content)), result.filepath = filepath;
break dirLoop;
}
}
if (dir === stopDir || dir === parentDir(dir)) break dirLoop;
dir = parentDir(dir);
}
let transformed = (
// not found
result.filepath === "" && result.config === null ? transform(null) : transform(result)
);
if (cache)
for (let p of visited) searchCache.set(p, transformed);
return transformed;
},
load(filepath) {
validateFilePath(filepath);
let absPath = path2.resolve(process.cwd(), filepath);
if (cache && loadCache.has(absPath))
return loadCache.get(absPath);
let { base, ext } = path2.parse(absPath), loaderKey = ext || "noExt", loader2 = loaders[loaderKey];
validateLoader(loader2, loaderKey);
let content = String(fs.readFileSync(absPath));
if (base === "package.json") {
let pkg = loader2(absPath, content);
return transform({
config: getPackageProp(packageProp, pkg),
filepath: absPath
});
}
let result = {
config: null,
filepath: absPath
}, isEmpty = content.trim() === "";
return isEmpty && ignoreEmptySearchPlaces ? emplace(
loadCache,
absPath,
transform({
filepath: absPath,
config: void 0,
isEmpty: !0
})
) : (result.config = isEmpty ? void 0 : loader2(absPath, content), emplace(
loadCache,
absPath,
transform(isEmpty ? { ...result, isEmpty, config: void 0 } : result)
));
},
clearLoadCache() {
cache && loadCache.clear();
},
clearSearchCache() {
cache && searchCache.clear();
},
clearCaches() {
cache && (loadCache.clear(), searchCache.clear());
}
};
};
}
});
// ../../node_modules/postcss-load-config/src/req.js
var require_req = __commonJS({
"../../node_modules/postcss-load-config/src/req.js"(exports, module) {
var { createRequire: createRequire3 } = __require("node:module"), { pathToFileURL: pathToFileURL2 } = __require("node:url"), TS_EXT_RE = /\.[mc]?ts$/, tsx, jiti, importError = [];
async function req(name, rootFile = __filename) {
let url = createRequire3(rootFile).resolve(name);
try {
return (await import(`${pathToFileURL2(url)}?t=${Date.now()}`)).default;
} catch (err) {
if (!TS_EXT_RE.test(url))
throw err;
}
if (tsx === void 0)
try {
tsx = await import("tsx/cjs/api");
} catch (error) {
importError.push(error);
}
if (tsx) {
let loaded = tsx.require(name, rootFile);
return loaded && "__esModule" in loaded ? loaded.default : loaded;
}
if (jiti === void 0)
try {
jiti = (await import("./_node-chunks/jiti-BED7ALR5.js")).default;
} catch (error) {
importError.push(error);
}
if (jiti)
return jiti(rootFile, { interopDefault: !0 })(name);
throw new Error(
`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed
Error: ${importError.map((error) => error.message).join(`
`)}`
);
}
module.exports = req;
}
});
// ../../node_modules/postcss-load-config/src/options.js
var require_options = __commonJS({
"../../node_modules/postcss-load-config/src/options.js"(exports, module) {
var req = require_req();
async function options(config2, file) {
if (config2.parser && typeof config2.parser == "string")
try {
config2.parser = await req(config2.parser, file);
} catch (err) {
throw new Error(
`Loading PostCSS Parser failed: ${err.message}
(@${file})`
);
}
if (config2.syntax && typeof config2.syntax == "string")
try {
config2.syntax = await req(config2.syntax, file);
} catch (err) {
throw new Error(
`Loading PostCSS Syntax failed: ${err.message}
(@${file})`
);
}
if (config2.stringifier && typeof config2.stringifier == "string")
try {
config2.stringifier = await req(config2.stringifier, file);
} catch (err) {
throw new Error(
`Loading PostCSS Stringifier failed: ${err.message}
(@${file})`
);
}
return config2;
}
module.exports = options;
}
});
// ../../node_modules/postcss-load-config/src/plugins.js
var require_plugins = __commonJS({
"../../node_modules/postcss-load-config/src/plugins.js"(exports, module) {
var req = require_req();
async function load(plugin, options, file) {
try {
return options == null || Object.keys(options).length === 0 ? await req(plugin, file) : (await req(plugin, file))(options);
} catch (err) {
throw new Error(
`Loading PostCSS Plugin failed: ${err.message}
(@${file})`
);
}
}
async function plugins(config2, file) {
let list = [];
return Array.isArray(config2.plugins) ? list = config2.plugins.filter(Boolean) : (list = Object.entries(config2.plugins).filter(([, options]) => options !== !1).map(([plugin, options]) => load(plugin, options, file)), list = await Promise.all(list)), list.length && list.length > 0 && list.forEach((plugin, i) => {
if (plugin.default && (plugin = plugin.default), plugin.postcss === !0 ? plugin = plugin() : plugin.postcss && (plugin = plugin.postcss), !(typeof plugin == "object" && Array.isArray(plugin.plugins) || typeof plugin == "object" && plugin.postcssPlugin || typeof plugin == "function"))
throw new TypeError(
`Invalid PostCSS Plugin found at: plugins[${i}]
(@${file})`
);
}), list;
}
module.exports = plugins;
}
});
// ../../node_modules/postcss-load-config/src/index.js
var require_src2 = __commonJS({
"../../node_modules/postcss-load-config/src/index.js"(exports, module) {
var { resolve: resolve2 } = __require("node:path"), config2 = require_src(), loadOptions = require_options(), loadPlugins = require_plugins(), req = require_req(), interopRequireDefault = (obj) => obj && obj.__esModule ? obj : { default: obj };
async function processResult(ctx, result) {
let file = result.filepath || "", projectConfig = interopRequireDefault(result.config).default || {};
typeof projectConfig == "function" ? projectConfig = projectConfig(ctx) : projectConfig = Object.assign({}, projectConfig, ctx), projectConfig.plugins || (projectConfig.plugins = []);
let res = {
file,
options: await loadOptions(projectConfig, file),
plugins: await loadPlugins(projectConfig, file)
};
return delete projectConfig.plugins, res;
}
function createContext(ctx) {
return ctx = Object.assign(
{
cwd: process.cwd(),
env: process.env.NODE_ENV
},
ctx
), ctx.env || (process.env.NODE_ENV = "development"), ctx;
}
async function loader2(filepath) {
return req(filepath);
}
var yaml;
async function yamlLoader(_, content) {
if (!yaml)
try {
yaml = await import("./_node-chunks/dist-JWGJV3QZ.js");
} catch (e) {
throw new Error(
`'yaml' is required for the YAML configuration files. Make sure it is installed
Error: ${e.message}`
);
}
return yaml.parse(content);
}
var withLoaders2 = (options = {}) => {
let moduleName = "postcss";
return {
...options,
loaders: {
...options.loaders,
".cjs": loader2,
".cts": loader2,
".js": loader2,
".mjs": loader2,
".mts": loader2,
".ts": loader2,
".yaml": yamlLoader,
".yml": yamlLoader
},
searchPlaces: [
...options.searchPlaces || [],
"package.json",
`.${moduleName}rc`,
`.${moduleName}rc.json`,
`.${moduleName}rc.yaml`,
`.${moduleName}rc.yml`,
`.${moduleName}rc.ts`,
`.${moduleName}rc.cts`,
`.${moduleName}rc.mts`,
`.${moduleName}rc.js`,
`.${moduleName}rc.cjs`,
`.${moduleName}rc.mjs`,
`${moduleName}.config.ts`,
`${moduleName}.config.cts`,
`${moduleName}.config.mts`,
`${moduleName}.config.js`,
`${moduleName}.config.cjs`,
`${moduleName}.config.mjs`
]
};
};
function rc(ctx, path2, options) {
return ctx = createContext(ctx), path2 = path2 ? resolve2(path2) : process.cwd(), config2.lilconfig("postcss", withLoaders2(options)).search(path2).then((result) => {
if (!result)
throw new Error(`No PostCSS Config found in: ${path2}`);
return processResult(ctx, result);
});
}
module.exports = rc;
}
});
// src/preset.ts
var import_semver = __toESM(require_semver2(), 1);
import { createRequire as createRequire2 } from "node:module";
import { dirname as dirname2 } from "node:path";
import { fileURLToPath as fileURLToPath2 } from "node:url";
import { viteFinal as reactViteFinal } from "@storybook/react-vite/preset";
// src/find-postcss-config.ts
var import_lilconfig = __toESM(require_src(), 1), import_postcss_load_config = __toESM(require_src2(), 1);
import { readFile, writeFile } from "node:fs/promises";
import { createRequire } from "node:module";
import { getProjectRoot } from "storybook/internal/common";
import { IncompatiblePostCssConfigError } from "storybook/internal/server-errors";
var require2 = createRequire(import.meta.url);
async function loader(filepath) {
return require2(filepath);
}
var withLoaders = (options = {}) => {
let moduleName = "postcss";
return {
...options,
loaders: {
...options.loaders,
".cjs": loader,
".cts": loader,
".js": loader,
".mjs": loader,
".mts": loader,
".ts": loader
},
searchPlaces: [
...options.searchPlaces ?? [],
"package.json",
`.${moduleName}rc`,
`.${moduleName}rc.json`,
`.${moduleName}rc.ts`,
`.${moduleName}rc.cts`,
`.${moduleName}rc.mts`,
`.${moduleName}rc.js`,
`.${moduleName}rc.cjs`,
`.${moduleName}rc.mjs`,
`${moduleName}.config.ts`,
`${moduleName}.config.cts`,
`${moduleName}.config.mts`,
`${moduleName}.config.js`,
`${moduleName}.config.cjs`,
`${moduleName}.config.mjs`
]
};
};
async function postCssFindConfig(path2, options = {}) {
let result = await import_lilconfig.default.lilconfig("postcss", withLoaders(options)).search(path2);
return result ? result.filepath : null;
}
var normalizePostCssConfig = async (searchPath) => {
let configPath = await postCssFindConfig(searchPath);
if (!configPath)
return !0;
let error;
try {
return await (0, import_postcss_load_config.default)({}, searchPath, { stopDir: getProjectRoot() }), !0;
} catch (e) {
e instanceof Error && (error = e);
}
if (!error || error.message.includes("No PostCSS Config found"))
return !0;
if (error.message.includes("Invalid PostCSS Plugin found")) {
let originalContent = await readFile(configPath, "utf8");
try {
let modifiedContent = originalContent.replace(
'plugins: ["@tailwindcss/postcss"]',
'plugins: { "@tailwindcss/postcss": {} }'
);
return await writeFile(configPath, modifiedContent, "utf8"), await (0, import_postcss_load_config.default)({}, searchPath, { stopDir: getProjectRoot() }), !0;
} catch {
throw await writeFile(configPath, originalContent, "utf8"), new IncompatiblePostCssConfigError({ error });
}
}
return !1;
};
// src/utils.ts
import { readFileSync } from "node:fs";
import { join as join2 } from "node:path";
// ../../core/src/shared/utils/module.ts
import { fileURLToPath, pathToFileURL } from "node:url";
// ../../node_modules/exsolve/dist/index.mjs
import assert from "node:assert";
import v8 from "node:v8";
import { format, inspect } from "node:util";
var own$1 = {}.hasOwnProperty, classRegExp = /^([A-Z][a-z\d]*)+$/, kTypes = /* @__PURE__ */ new Set([
"string",
"function",
"number",
"object",
"Function",
"Object",
"boolean",
"bigint",
"symbol"
]), messages = /* @__PURE__ */ new Map(), nodeInternalPrefix = "__node_internal_", userStackTraceLimit;
function formatList(array, type = "and") {
return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
}
function createError(sym, value, constructor) {
return messages.set(sym, value), makeNodeErrorWithCode(constructor, sym);
}
function makeNodeErrorWithCode(Base, key) {
return function(...parameters) {
let limit = Error.stackTraceLimit;
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = 0);
let error = new Base();
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = limit);
let message = getMessage(key, parameters, error);
return Object.defineProperties(error, {
message: {
value: message,
enumerable: !1,
writable: !0,
configurable: !0
},
toString: {
value() {
return `${this.name} [${key}]: ${this.message}`;
},
enumerable: !1,
writable: !0,
configurable: !0
}
}), captureLargerStackTrace(error), error.code = key, error;
};
}
function isErrorStackTraceLimitWritable() {
try {
if (v8.startupSnapshot.isBuildingSnapshot()) return !1;
} catch {
}
let desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
return desc === void 0 ? Object.isExtensible(Error) : own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
}
function hideStackFrames(wrappedFunction) {
let hidden = nodeInternalPrefix + wrappedFunction.name;
return Object.defineProperty(wrappedFunction, "name", { value: hidden }), wrappedFunction;
}
var captureLargerStackTrace = hideStackFrames(function(error) {
let stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
return stackTraceLimitIsWritable && (userStackTraceLimit = Error.stackTraceLimit, Error.stackTraceLimit = Number.POSITIVE_INFINITY), Error.captureStackTrace(error), stackTraceLimitIsWritable && (Error.stackTraceLimit = userStackTraceLimit), error;
});
function getMessage(key, parameters, self) {
let message = messages.get(key);
if (assert.ok(message !== void 0, "expected `message` to be found"), typeof message == "function")
return assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`), Reflect.apply(message, self, parameters);
let regex = /%[dfijoOs]/g, expectedLength = 0;
for (; regex.exec(message) !== null; ) expectedLength++;
return assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`), parameters.length === 0 ? message : (parameters.unshift(message), Reflect.apply(format, null, parameters));
}
function determineSpecificType(value) {
if (value == null) return String(value);
if (typeof value == "function" && value.name) return `function ${value.name}`;
if (typeof value == "object")
return value.constructor && value.constructor.name ? `an instance of ${value.constructor.name}` : `${inspect(value, { depth: -1 })}`;
let inspected = inspect(value, { colors: !1 });
return inspected.length > 28 && (inspected = `${inspected.slice(0, 25)}...`), `type ${typeof value} (${inspected})`;
}
var ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
assert.ok(typeof name == "string", "'name' must be a string"), Array.isArray(expected) || (expected = [expected]);
let message = "The ";
if (name.endsWith(" argument")) message += `${name} `;
else {
let type = name.includes(".") ? "property" : "argument";
message += `"${name}" ${type} `;
}
message += "must be ";
let types = [], instances = [], other = [];
for (let value of expected)
assert.ok(typeof value == "string", "All expected entries have to be of type string"), kTypes.has(value) ? types.push(value.toLowerCase()) : classRegExp.exec(value) === null ? (assert.ok(value !== "object", 'The value "object" should be written as "Object"'), other.push(value)) : instances.push(value);
if (instances.length > 0) {
let pos = types.indexOf("object");
pos !== -1 && (types.slice(pos, 1), instances.push("Object"));
}
return types.length > 0 && (message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`, (instances.length > 0 || other.length > 0) && (message += " or ")), instances.length > 0 && (message += `an instance of ${formatList(instances, "or")}`, other.length > 0 && (message += " or ")), other.length > 0 && (other.length > 1 ? message += `one of ${formatList(other, "or")}` : (other[0]?.toLowerCase() !== other[0] && (message += "an "), message += `${other[0]}`)), message += `. Received ${determineSpecificType(actual)}`, message;
}, TypeError), ERR_INVALID_MODULE_SPECIFIER = createError(
"ERR_INVALID_MODULE_SPECIFIER",
/**
* @param {string} request
* @param {string} reason
* @param {string} [base]
*/
(request, reason, base) => `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`,
TypeError
), ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`, Error), ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = !1, base) => {
let relatedError = typeof target == "string" && !isImport && target.length > 0 && !target.startsWith("./");
return key === "." ? (assert.ok(isImport === !1), `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`) : `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
}, Error), ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path$1, base, exactUrl = !1) => `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`, Error), ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error), ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`, TypeError), ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
"ERR_PACKAGE_PATH_NOT_EXPORTED",
/**
* @param {string} packagePath
* @param {string} subpath
* @param {string} [base]
*/
(packagePath, subpath, base) => subpath === "." ? `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}` : `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`,
Error
), ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error), ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', TypeError), ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path$1) => `Unknown file extension "${extension}" for ${path$1}`, TypeError), ERR_INVALID_ARG_VALUE = createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
let inspected = inspect(value);
return inspected.length > 128 && (inspected = `${inspected.slice(0, 128)}...`), `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
}, TypeError), hasOwnProperty$1 = {}.hasOwnProperty;
var hasOwnProperty = {}.hasOwnProperty;
var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty;
var isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
function normalizeWindowsPath(input = "") {
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
}
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
var normalize = function(path2) {
if (path2.length === 0)
return ".";
path2 = normalizeWindowsPath(path2);
let isUNCPath = path2.match(_UNC_REGEX), isPathAbsolute = isAbsolute(path2), trailingSeparator = path2[path2.length - 1] === "/";
return path2 = normalizeString(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2);
}, join = function(...arguments_) {
if (arguments_.length === 0)
return ".";
let joined;
for (let argument of arguments_)
argument && argument.length > 0 && (joined === void 0 ? joined = argument : joined += `/${argument}`);
return joined === void 0 ? "." : normalize(joined.replace(/\/\/+/g, "/"));
};
function normalizeString(path2, allowAboveRoot) {
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
for (let index = 0; index <= path2.length; ++index) {
if (index < path2.length)
char = path2[index];
else {
if (char === "/")
break;
char = "/";
}
if (char === "/") {
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
if (res.length > 2) {
let lastSlashIndex = res.lastIndexOf("/");
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
continue;
} else if (res.length > 0) {
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
continue;
}
}
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
} else
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
lastSlash = index, dots = 0;
} else char === "." && dots !== -1 ? ++dots : dots = -1;
}
return res;
}
var isAbsolute = function(p) {
return _IS_ABSOLUTE_RE.test(p);
};
var dirname = function(p) {
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
};
// ../../core/src/shared/utils/module.ts
var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
"importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
), pathToFileURL(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => {
try {
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
} catch {
return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"))));
}
};
// src/utils.ts
var getNextjsVersion = () => JSON.parse(readFileSync(join2(resolvePackageDir("next"), "package.json"), "utf8")).version;
// src/preset.ts
var require3 = createRequire2(import.meta.url), vitePluginStorybookNextjs = require3("vite-plugin-storybook-nextjs"), core = async (config2, options) => {
let framework = await options.presets.apply("framework");
return {
...config2,
builder: {
name: fileURLToPath2(import.meta.resolve("@storybook/builder-vite")),
options: {
...typeof framework == "string" ? {} : framework.options.builder || {}
}
},
renderer: fileURLToPath2(import.meta.resolve("@storybook/react/preset"))
};
}, previewAnnotations = (entry = []) => {
let annotations = [
...entry,
fileURLToPath2(import.meta.resolve("@storybook/nextjs-vite/preview"))
], nextjsVersion = getNextjsVersion();
return import_semver.default.gte(nextjsVersion, "16.0.0") || annotations.push(fileURLToPath2(import.meta.resolve("@storybook/nextjs-vite/config/preview"))), annotations;
}, optimizeViteDeps = [
"@storybook/nextjs-vite/navigation.mock",
"@storybook/nextjs-vite/router.mock",
"@storybook/nextjs-vite > styled-jsx",
"@storybook/nextjs-vite > styled-jsx/style"
], viteFinal = async (config2, options) => {
let reactConfig = await reactViteFinal(config2, options), inlineOptions = config2.css?.postcss, searchPath = typeof inlineOptions == "string" ? inlineOptions : config2.root;
searchPath && await normalizePostCssConfig(searchPath);
let { nextConfigPath, image = {} } = await options.presets.apply("frameworkOptions"), nextDir = nextConfigPath ? dirname2(nextConfigPath) : void 0, vitePluginOptions = {
image,
dir: nextDir
};
return {
...reactConfig,
resolve: {
...reactConfig?.resolve ?? {},
alias: {
...reactConfig?.resolve?.alias ?? {},
"styled-jsx": dirname2(fileURLToPath2(import.meta.resolve("styled-jsx/package.json"))),
"styled-jsx/style": fileURLToPath2(import.meta.resolve("styled-jsx/style")),
"styled-jsx/style.js": fileURLToPath2(import.meta.resolve("styled-jsx/style"))
}
},
plugins: [...reactConfig?.plugins ?? [], vitePluginStorybookNextjs(vitePluginOptions)]
};
};
export {
core,
optimizeViteDeps,
previewAnnotations,
viteFinal
};