@storybook/nextjs-vite 10.0.0-beta.7 → 10.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/preset.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_jwqmkl86q4g from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_jwqmkl86q4g from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_jwqmkl86q4g from "node:module";
1
+ import CJS_COMPAT_NODE_URL_o0r80imq63 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_o0r80imq63 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_o0r80imq63 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_jwqmkl86q4g.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_jwqmkl86q4g.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_jwqmkl86q4g.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_o0r80imq63.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_o0r80imq63.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_o0r80imq63.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -14,12 +14,12 @@ import {
14
14
  __name,
15
15
  __require,
16
16
  __toESM
17
- } from "./_node-chunks/chunk-HR43PPVR.js";
17
+ } from "./_node-chunks/chunk-BLUKXR72.js";
18
18
 
19
19
  // ../../node_modules/postcss-load-config/node_modules/lilconfig/src/index.js
20
20
  var require_src = __commonJS({
21
21
  "../../node_modules/postcss-load-config/node_modules/lilconfig/src/index.js"(exports, module) {
22
- var path = __require("path");
22
+ var path2 = __require("path");
23
23
  var fs = __require("fs");
24
24
  var os = __require("os");
25
25
  var url = __require("url");
@@ -43,7 +43,7 @@ var require_src = __commonJS({
43
43
  }
44
44
  __name(getDefaultSearchPlaces, "getDefaultSearchPlaces");
45
45
  function parentDir(p) {
46
- return path.dirname(p) || path.sep;
46
+ return path2.dirname(p) || path2.sep;
47
47
  }
48
48
  __name(parentDir, "parentDir");
49
49
  var jsonLoader = /* @__PURE__ */ __name((_, content) => JSON.parse(content), "jsonLoader");
@@ -97,7 +97,7 @@ var require_src = __commonJS({
97
97
  }
98
98
  };
99
99
  conf.searchPlaces.forEach((place) => {
100
- const key = path.extname(place) || "noExt";
100
+ const key = path2.extname(place) || "noExt";
101
101
  const loader = conf.loaders[key];
102
102
  if (!loader) {
103
103
  throw new Error(`Missing loader for extension "${place}"`);
@@ -163,14 +163,14 @@ var require_src = __commonJS({
163
163
  visited.add(dir);
164
164
  }
165
165
  for (const searchPlace of searchPlaces) {
166
- const filepath = path.join(dir, searchPlace);
166
+ const filepath = path2.join(dir, searchPlace);
167
167
  try {
168
168
  await fs.promises.access(filepath);
169
169
  } catch {
170
170
  continue;
171
171
  }
172
172
  const content = String(await fsReadFileAsync(filepath));
173
- const loaderKey = path.extname(searchPlace) || "noExt";
173
+ const loaderKey = path2.extname(searchPlace) || "noExt";
174
174
  const loader = loaders[loaderKey];
175
175
  if (searchPlace === "package.json") {
176
176
  const pkg = await loader(filepath, content);
@@ -208,11 +208,11 @@ var require_src = __commonJS({
208
208
  },
209
209
  async load(filepath) {
210
210
  validateFilePath(filepath);
211
- const absPath = path.resolve(process.cwd(), filepath);
211
+ const absPath = path2.resolve(process.cwd(), filepath);
212
212
  if (cache && loadCache.has(absPath)) {
213
213
  return loadCache.get(absPath);
214
214
  }
215
- const { base, ext } = path.parse(absPath);
215
+ const { base, ext } = path2.parse(absPath);
216
216
  const loaderKey = ext || "noExt";
217
217
  const loader = loaders[loaderKey];
218
218
  validateLoader(loader, loaderKey);
@@ -295,13 +295,13 @@ var require_src = __commonJS({
295
295
  visited.add(dir);
296
296
  }
297
297
  for (const searchPlace of searchPlaces) {
298
- const filepath = path.join(dir, searchPlace);
298
+ const filepath = path2.join(dir, searchPlace);
299
299
  try {
300
300
  fs.accessSync(filepath);
301
301
  } catch {
302
302
  continue;
303
303
  }
304
- const loaderKey = path.extname(searchPlace) || "noExt";
304
+ const loaderKey = path2.extname(searchPlace) || "noExt";
305
305
  const loader = loaders[loaderKey];
306
306
  const content = String(fs.readFileSync(filepath));
307
307
  if (searchPlace === "package.json") {
@@ -340,11 +340,11 @@ var require_src = __commonJS({
340
340
  },
341
341
  load(filepath) {
342
342
  validateFilePath(filepath);
343
- const absPath = path.resolve(process.cwd(), filepath);
343
+ const absPath = path2.resolve(process.cwd(), filepath);
344
344
  if (cache && loadCache.has(absPath)) {
345
345
  return loadCache.get(absPath);
346
346
  }
347
- const { base, ext } = path.parse(absPath);
347
+ const { base, ext } = path2.parse(absPath);
348
348
  const loaderKey = ext || "noExt";
349
349
  const loader = loaders[loaderKey];
350
350
  validateLoader(loader, loaderKey);
@@ -399,7 +399,7 @@ var require_src = __commonJS({
399
399
  var require_req = __commonJS({
400
400
  "../../node_modules/postcss-load-config/src/req.js"(exports, module) {
401
401
  var { createRequire: createRequire2 } = __require("node:module");
402
- var { pathToFileURL } = __require("node:url");
402
+ var { pathToFileURL: pathToFileURL2 } = __require("node:url");
403
403
  var TS_EXT_RE = /\.[mc]?ts$/;
404
404
  var tsx;
405
405
  var jiti;
@@ -407,7 +407,7 @@ var require_req = __commonJS({
407
407
  async function req(name, rootFile = __filename) {
408
408
  let url = createRequire2(rootFile).resolve(name);
409
409
  try {
410
- return (await import(`${pathToFileURL(url)}?t=${Date.now()}`)).default;
410
+ return (await import(`${pathToFileURL2(url)}?t=${Date.now()}`)).default;
411
411
  } catch (err) {
412
412
  if (!TS_EXT_RE.test(url)) {
413
413
  throw err;
@@ -426,7 +426,7 @@ var require_req = __commonJS({
426
426
  }
427
427
  if (jiti === void 0) {
428
428
  try {
429
- jiti = (await import("./_node-chunks/jiti-ILLFXEPL.js")).default;
429
+ jiti = (await import("./_node-chunks/jiti-ZAZL5OWE.js")).default;
430
430
  } catch (error) {
431
431
  importError.push(error);
432
432
  }
@@ -550,7 +550,7 @@ var require_plugins = __commonJS({
550
550
  // ../../node_modules/postcss-load-config/src/index.js
551
551
  var require_src2 = __commonJS({
552
552
  "../../node_modules/postcss-load-config/src/index.js"(exports, module) {
553
- var { resolve } = __require("node:path");
553
+ var { resolve: resolve2 } = __require("node:path");
554
554
  var config = require_src();
555
555
  var loadOptions = require_options();
556
556
  var loadPlugins = require_plugins();
@@ -598,7 +598,7 @@ var require_src2 = __commonJS({
598
598
  async function yamlLoader(_, content) {
599
599
  if (!yaml) {
600
600
  try {
601
- yaml = await import("./_node-chunks/dist-3BEM2YKL.js");
601
+ yaml = await import("./_node-chunks/dist-6XTC5ARL.js");
602
602
  } catch (e) {
603
603
  throw new Error(
604
604
  `'yaml' is required for the YAML configuration files. Make sure it is installed
@@ -646,12 +646,12 @@ Error: ${e.message}`
646
646
  ]
647
647
  };
648
648
  }, "withLoaders");
649
- function rc(ctx, path, options) {
649
+ function rc(ctx, path2, options) {
650
650
  ctx = createContext(ctx);
651
- path = path ? resolve(path) : process.cwd();
652
- return config.lilconfig("postcss", withLoaders(options)).search(path).then((result) => {
651
+ path2 = path2 ? resolve2(path2) : process.cwd();
652
+ return config.lilconfig("postcss", withLoaders(options)).search(path2).then((result) => {
653
653
  if (!result) {
654
- throw new Error(`No PostCSS Config found in: ${path}`);
654
+ throw new Error(`No PostCSS Config found in: ${path2}`);
655
655
  }
656
656
  return processResult(ctx, result);
657
657
  });
@@ -661,14 +661,2401 @@ Error: ${e.message}`
661
661
  }
662
662
  });
663
663
 
664
+ // ../../node_modules/semver/internal/constants.js
665
+ var require_constants = __commonJS({
666
+ "../../node_modules/semver/internal/constants.js"(exports, module) {
667
+ "use strict";
668
+ var SEMVER_SPEC_VERSION = "2.0.0";
669
+ var MAX_LENGTH = 256;
670
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
671
+ 9007199254740991;
672
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
673
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
674
+ var RELEASE_TYPES = [
675
+ "major",
676
+ "premajor",
677
+ "minor",
678
+ "preminor",
679
+ "patch",
680
+ "prepatch",
681
+ "prerelease"
682
+ ];
683
+ module.exports = {
684
+ MAX_LENGTH,
685
+ MAX_SAFE_COMPONENT_LENGTH,
686
+ MAX_SAFE_BUILD_LENGTH,
687
+ MAX_SAFE_INTEGER,
688
+ RELEASE_TYPES,
689
+ SEMVER_SPEC_VERSION,
690
+ FLAG_INCLUDE_PRERELEASE: 1,
691
+ FLAG_LOOSE: 2
692
+ };
693
+ }
694
+ });
695
+
696
+ // ../../node_modules/semver/internal/debug.js
697
+ var require_debug = __commonJS({
698
+ "../../node_modules/semver/internal/debug.js"(exports, module) {
699
+ "use strict";
700
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
701
+ };
702
+ module.exports = debug;
703
+ }
704
+ });
705
+
706
+ // ../../node_modules/semver/internal/re.js
707
+ var require_re = __commonJS({
708
+ "../../node_modules/semver/internal/re.js"(exports, module) {
709
+ "use strict";
710
+ var {
711
+ MAX_SAFE_COMPONENT_LENGTH,
712
+ MAX_SAFE_BUILD_LENGTH,
713
+ MAX_LENGTH
714
+ } = require_constants();
715
+ var debug = require_debug();
716
+ exports = module.exports = {};
717
+ var re = exports.re = [];
718
+ var safeRe = exports.safeRe = [];
719
+ var src = exports.src = [];
720
+ var safeSrc = exports.safeSrc = [];
721
+ var t = exports.t = {};
722
+ var R = 0;
723
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
724
+ var safeRegexReplacements = [
725
+ ["\\s", 1],
726
+ ["\\d", MAX_LENGTH],
727
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
728
+ ];
729
+ var makeSafeRegex = /* @__PURE__ */ __name((value) => {
730
+ for (const [token, max] of safeRegexReplacements) {
731
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
732
+ }
733
+ return value;
734
+ }, "makeSafeRegex");
735
+ var createToken = /* @__PURE__ */ __name((name, value, isGlobal) => {
736
+ const safe = makeSafeRegex(value);
737
+ const index = R++;
738
+ debug(name, index, value);
739
+ t[name] = index;
740
+ src[index] = value;
741
+ safeSrc[index] = safe;
742
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
743
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
744
+ }, "createToken");
745
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
746
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
747
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
748
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
749
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
750
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
751
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
752
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
753
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
754
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
755
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
756
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
757
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
758
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
759
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
760
+ createToken("GTLT", "((?:<|>)?=?)");
761
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
762
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
763
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
764
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
765
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
766
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
767
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
768
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
769
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
770
+ createToken("COERCERTL", src[t.COERCE], true);
771
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
772
+ createToken("LONETILDE", "(?:~>?)");
773
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
774
+ exports.tildeTrimReplace = "$1~";
775
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
776
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
777
+ createToken("LONECARET", "(?:\\^)");
778
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
779
+ exports.caretTrimReplace = "$1^";
780
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
781
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
782
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
783
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
784
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
785
+ exports.comparatorTrimReplace = "$1$2$3";
786
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
787
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
788
+ createToken("STAR", "(<|>)?=?\\s*\\*");
789
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
790
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
791
+ }
792
+ });
793
+
794
+ // ../../node_modules/semver/internal/parse-options.js
795
+ var require_parse_options = __commonJS({
796
+ "../../node_modules/semver/internal/parse-options.js"(exports, module) {
797
+ "use strict";
798
+ var looseOption = Object.freeze({ loose: true });
799
+ var emptyOpts = Object.freeze({});
800
+ var parseOptions = /* @__PURE__ */ __name((options) => {
801
+ if (!options) {
802
+ return emptyOpts;
803
+ }
804
+ if (typeof options !== "object") {
805
+ return looseOption;
806
+ }
807
+ return options;
808
+ }, "parseOptions");
809
+ module.exports = parseOptions;
810
+ }
811
+ });
812
+
813
+ // ../../node_modules/semver/internal/identifiers.js
814
+ var require_identifiers = __commonJS({
815
+ "../../node_modules/semver/internal/identifiers.js"(exports, module) {
816
+ "use strict";
817
+ var numeric = /^[0-9]+$/;
818
+ var compareIdentifiers = /* @__PURE__ */ __name((a, b) => {
819
+ const anum = numeric.test(a);
820
+ const bnum = numeric.test(b);
821
+ if (anum && bnum) {
822
+ a = +a;
823
+ b = +b;
824
+ }
825
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
826
+ }, "compareIdentifiers");
827
+ var rcompareIdentifiers = /* @__PURE__ */ __name((a, b) => compareIdentifiers(b, a), "rcompareIdentifiers");
828
+ module.exports = {
829
+ compareIdentifiers,
830
+ rcompareIdentifiers
831
+ };
832
+ }
833
+ });
834
+
835
+ // ../../node_modules/semver/classes/semver.js
836
+ var require_semver = __commonJS({
837
+ "../../node_modules/semver/classes/semver.js"(exports, module) {
838
+ "use strict";
839
+ var debug = require_debug();
840
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
841
+ var { safeRe: re, t } = require_re();
842
+ var parseOptions = require_parse_options();
843
+ var { compareIdentifiers } = require_identifiers();
844
+ var SemVer = class _SemVer {
845
+ static {
846
+ __name(this, "SemVer");
847
+ }
848
+ constructor(version, options) {
849
+ options = parseOptions(options);
850
+ if (version instanceof _SemVer) {
851
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
852
+ return version;
853
+ } else {
854
+ version = version.version;
855
+ }
856
+ } else if (typeof version !== "string") {
857
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
858
+ }
859
+ if (version.length > MAX_LENGTH) {
860
+ throw new TypeError(
861
+ `version is longer than ${MAX_LENGTH} characters`
862
+ );
863
+ }
864
+ debug("SemVer", version, options);
865
+ this.options = options;
866
+ this.loose = !!options.loose;
867
+ this.includePrerelease = !!options.includePrerelease;
868
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
869
+ if (!m) {
870
+ throw new TypeError(`Invalid Version: ${version}`);
871
+ }
872
+ this.raw = version;
873
+ this.major = +m[1];
874
+ this.minor = +m[2];
875
+ this.patch = +m[3];
876
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
877
+ throw new TypeError("Invalid major version");
878
+ }
879
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
880
+ throw new TypeError("Invalid minor version");
881
+ }
882
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
883
+ throw new TypeError("Invalid patch version");
884
+ }
885
+ if (!m[4]) {
886
+ this.prerelease = [];
887
+ } else {
888
+ this.prerelease = m[4].split(".").map((id) => {
889
+ if (/^[0-9]+$/.test(id)) {
890
+ const num = +id;
891
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
892
+ return num;
893
+ }
894
+ }
895
+ return id;
896
+ });
897
+ }
898
+ this.build = m[5] ? m[5].split(".") : [];
899
+ this.format();
900
+ }
901
+ format() {
902
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
903
+ if (this.prerelease.length) {
904
+ this.version += `-${this.prerelease.join(".")}`;
905
+ }
906
+ return this.version;
907
+ }
908
+ toString() {
909
+ return this.version;
910
+ }
911
+ compare(other) {
912
+ debug("SemVer.compare", this.version, this.options, other);
913
+ if (!(other instanceof _SemVer)) {
914
+ if (typeof other === "string" && other === this.version) {
915
+ return 0;
916
+ }
917
+ other = new _SemVer(other, this.options);
918
+ }
919
+ if (other.version === this.version) {
920
+ return 0;
921
+ }
922
+ return this.compareMain(other) || this.comparePre(other);
923
+ }
924
+ compareMain(other) {
925
+ if (!(other instanceof _SemVer)) {
926
+ other = new _SemVer(other, this.options);
927
+ }
928
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
929
+ }
930
+ comparePre(other) {
931
+ if (!(other instanceof _SemVer)) {
932
+ other = new _SemVer(other, this.options);
933
+ }
934
+ if (this.prerelease.length && !other.prerelease.length) {
935
+ return -1;
936
+ } else if (!this.prerelease.length && other.prerelease.length) {
937
+ return 1;
938
+ } else if (!this.prerelease.length && !other.prerelease.length) {
939
+ return 0;
940
+ }
941
+ let i = 0;
942
+ do {
943
+ const a = this.prerelease[i];
944
+ const b = other.prerelease[i];
945
+ debug("prerelease compare", i, a, b);
946
+ if (a === void 0 && b === void 0) {
947
+ return 0;
948
+ } else if (b === void 0) {
949
+ return 1;
950
+ } else if (a === void 0) {
951
+ return -1;
952
+ } else if (a === b) {
953
+ continue;
954
+ } else {
955
+ return compareIdentifiers(a, b);
956
+ }
957
+ } while (++i);
958
+ }
959
+ compareBuild(other) {
960
+ if (!(other instanceof _SemVer)) {
961
+ other = new _SemVer(other, this.options);
962
+ }
963
+ let i = 0;
964
+ do {
965
+ const a = this.build[i];
966
+ const b = other.build[i];
967
+ debug("build compare", i, a, b);
968
+ if (a === void 0 && b === void 0) {
969
+ return 0;
970
+ } else if (b === void 0) {
971
+ return 1;
972
+ } else if (a === void 0) {
973
+ return -1;
974
+ } else if (a === b) {
975
+ continue;
976
+ } else {
977
+ return compareIdentifiers(a, b);
978
+ }
979
+ } while (++i);
980
+ }
981
+ // preminor will bump the version up to the next minor release, and immediately
982
+ // down to pre-release. premajor and prepatch work the same way.
983
+ inc(release, identifier, identifierBase) {
984
+ if (release.startsWith("pre")) {
985
+ if (!identifier && identifierBase === false) {
986
+ throw new Error("invalid increment argument: identifier is empty");
987
+ }
988
+ if (identifier) {
989
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
990
+ if (!match || match[1] !== identifier) {
991
+ throw new Error(`invalid identifier: ${identifier}`);
992
+ }
993
+ }
994
+ }
995
+ switch (release) {
996
+ case "premajor":
997
+ this.prerelease.length = 0;
998
+ this.patch = 0;
999
+ this.minor = 0;
1000
+ this.major++;
1001
+ this.inc("pre", identifier, identifierBase);
1002
+ break;
1003
+ case "preminor":
1004
+ this.prerelease.length = 0;
1005
+ this.patch = 0;
1006
+ this.minor++;
1007
+ this.inc("pre", identifier, identifierBase);
1008
+ break;
1009
+ case "prepatch":
1010
+ this.prerelease.length = 0;
1011
+ this.inc("patch", identifier, identifierBase);
1012
+ this.inc("pre", identifier, identifierBase);
1013
+ break;
1014
+ // If the input is a non-prerelease version, this acts the same as
1015
+ // prepatch.
1016
+ case "prerelease":
1017
+ if (this.prerelease.length === 0) {
1018
+ this.inc("patch", identifier, identifierBase);
1019
+ }
1020
+ this.inc("pre", identifier, identifierBase);
1021
+ break;
1022
+ case "release":
1023
+ if (this.prerelease.length === 0) {
1024
+ throw new Error(`version ${this.raw} is not a prerelease`);
1025
+ }
1026
+ this.prerelease.length = 0;
1027
+ break;
1028
+ case "major":
1029
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
1030
+ this.major++;
1031
+ }
1032
+ this.minor = 0;
1033
+ this.patch = 0;
1034
+ this.prerelease = [];
1035
+ break;
1036
+ case "minor":
1037
+ if (this.patch !== 0 || this.prerelease.length === 0) {
1038
+ this.minor++;
1039
+ }
1040
+ this.patch = 0;
1041
+ this.prerelease = [];
1042
+ break;
1043
+ case "patch":
1044
+ if (this.prerelease.length === 0) {
1045
+ this.patch++;
1046
+ }
1047
+ this.prerelease = [];
1048
+ break;
1049
+ // This probably shouldn't be used publicly.
1050
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
1051
+ case "pre": {
1052
+ const base = Number(identifierBase) ? 1 : 0;
1053
+ if (this.prerelease.length === 0) {
1054
+ this.prerelease = [base];
1055
+ } else {
1056
+ let i = this.prerelease.length;
1057
+ while (--i >= 0) {
1058
+ if (typeof this.prerelease[i] === "number") {
1059
+ this.prerelease[i]++;
1060
+ i = -2;
1061
+ }
1062
+ }
1063
+ if (i === -1) {
1064
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
1065
+ throw new Error("invalid increment argument: identifier already exists");
1066
+ }
1067
+ this.prerelease.push(base);
1068
+ }
1069
+ }
1070
+ if (identifier) {
1071
+ let prerelease = [identifier, base];
1072
+ if (identifierBase === false) {
1073
+ prerelease = [identifier];
1074
+ }
1075
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
1076
+ if (isNaN(this.prerelease[1])) {
1077
+ this.prerelease = prerelease;
1078
+ }
1079
+ } else {
1080
+ this.prerelease = prerelease;
1081
+ }
1082
+ }
1083
+ break;
1084
+ }
1085
+ default:
1086
+ throw new Error(`invalid increment argument: ${release}`);
1087
+ }
1088
+ this.raw = this.format();
1089
+ if (this.build.length) {
1090
+ this.raw += `+${this.build.join(".")}`;
1091
+ }
1092
+ return this;
1093
+ }
1094
+ };
1095
+ module.exports = SemVer;
1096
+ }
1097
+ });
1098
+
1099
+ // ../../node_modules/semver/functions/parse.js
1100
+ var require_parse = __commonJS({
1101
+ "../../node_modules/semver/functions/parse.js"(exports, module) {
1102
+ "use strict";
1103
+ var SemVer = require_semver();
1104
+ var parse2 = /* @__PURE__ */ __name((version, options, throwErrors = false) => {
1105
+ if (version instanceof SemVer) {
1106
+ return version;
1107
+ }
1108
+ try {
1109
+ return new SemVer(version, options);
1110
+ } catch (er) {
1111
+ if (!throwErrors) {
1112
+ return null;
1113
+ }
1114
+ throw er;
1115
+ }
1116
+ }, "parse");
1117
+ module.exports = parse2;
1118
+ }
1119
+ });
1120
+
1121
+ // ../../node_modules/semver/functions/valid.js
1122
+ var require_valid = __commonJS({
1123
+ "../../node_modules/semver/functions/valid.js"(exports, module) {
1124
+ "use strict";
1125
+ var parse2 = require_parse();
1126
+ var valid = /* @__PURE__ */ __name((version, options) => {
1127
+ const v = parse2(version, options);
1128
+ return v ? v.version : null;
1129
+ }, "valid");
1130
+ module.exports = valid;
1131
+ }
1132
+ });
1133
+
1134
+ // ../../node_modules/semver/functions/clean.js
1135
+ var require_clean = __commonJS({
1136
+ "../../node_modules/semver/functions/clean.js"(exports, module) {
1137
+ "use strict";
1138
+ var parse2 = require_parse();
1139
+ var clean = /* @__PURE__ */ __name((version, options) => {
1140
+ const s = parse2(version.trim().replace(/^[=v]+/, ""), options);
1141
+ return s ? s.version : null;
1142
+ }, "clean");
1143
+ module.exports = clean;
1144
+ }
1145
+ });
1146
+
1147
+ // ../../node_modules/semver/functions/inc.js
1148
+ var require_inc = __commonJS({
1149
+ "../../node_modules/semver/functions/inc.js"(exports, module) {
1150
+ "use strict";
1151
+ var SemVer = require_semver();
1152
+ var inc = /* @__PURE__ */ __name((version, release, options, identifier, identifierBase) => {
1153
+ if (typeof options === "string") {
1154
+ identifierBase = identifier;
1155
+ identifier = options;
1156
+ options = void 0;
1157
+ }
1158
+ try {
1159
+ return new SemVer(
1160
+ version instanceof SemVer ? version.version : version,
1161
+ options
1162
+ ).inc(release, identifier, identifierBase).version;
1163
+ } catch (er) {
1164
+ return null;
1165
+ }
1166
+ }, "inc");
1167
+ module.exports = inc;
1168
+ }
1169
+ });
1170
+
1171
+ // ../../node_modules/semver/functions/diff.js
1172
+ var require_diff = __commonJS({
1173
+ "../../node_modules/semver/functions/diff.js"(exports, module) {
1174
+ "use strict";
1175
+ var parse2 = require_parse();
1176
+ var diff = /* @__PURE__ */ __name((version1, version2) => {
1177
+ const v1 = parse2(version1, null, true);
1178
+ const v2 = parse2(version2, null, true);
1179
+ const comparison = v1.compare(v2);
1180
+ if (comparison === 0) {
1181
+ return null;
1182
+ }
1183
+ const v1Higher = comparison > 0;
1184
+ const highVersion = v1Higher ? v1 : v2;
1185
+ const lowVersion = v1Higher ? v2 : v1;
1186
+ const highHasPre = !!highVersion.prerelease.length;
1187
+ const lowHasPre = !!lowVersion.prerelease.length;
1188
+ if (lowHasPre && !highHasPre) {
1189
+ if (!lowVersion.patch && !lowVersion.minor) {
1190
+ return "major";
1191
+ }
1192
+ if (lowVersion.compareMain(highVersion) === 0) {
1193
+ if (lowVersion.minor && !lowVersion.patch) {
1194
+ return "minor";
1195
+ }
1196
+ return "patch";
1197
+ }
1198
+ }
1199
+ const prefix = highHasPre ? "pre" : "";
1200
+ if (v1.major !== v2.major) {
1201
+ return prefix + "major";
1202
+ }
1203
+ if (v1.minor !== v2.minor) {
1204
+ return prefix + "minor";
1205
+ }
1206
+ if (v1.patch !== v2.patch) {
1207
+ return prefix + "patch";
1208
+ }
1209
+ return "prerelease";
1210
+ }, "diff");
1211
+ module.exports = diff;
1212
+ }
1213
+ });
1214
+
1215
+ // ../../node_modules/semver/functions/major.js
1216
+ var require_major = __commonJS({
1217
+ "../../node_modules/semver/functions/major.js"(exports, module) {
1218
+ "use strict";
1219
+ var SemVer = require_semver();
1220
+ var major = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).major, "major");
1221
+ module.exports = major;
1222
+ }
1223
+ });
1224
+
1225
+ // ../../node_modules/semver/functions/minor.js
1226
+ var require_minor = __commonJS({
1227
+ "../../node_modules/semver/functions/minor.js"(exports, module) {
1228
+ "use strict";
1229
+ var SemVer = require_semver();
1230
+ var minor = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).minor, "minor");
1231
+ module.exports = minor;
1232
+ }
1233
+ });
1234
+
1235
+ // ../../node_modules/semver/functions/patch.js
1236
+ var require_patch = __commonJS({
1237
+ "../../node_modules/semver/functions/patch.js"(exports, module) {
1238
+ "use strict";
1239
+ var SemVer = require_semver();
1240
+ var patch = /* @__PURE__ */ __name((a, loose) => new SemVer(a, loose).patch, "patch");
1241
+ module.exports = patch;
1242
+ }
1243
+ });
1244
+
1245
+ // ../../node_modules/semver/functions/prerelease.js
1246
+ var require_prerelease = __commonJS({
1247
+ "../../node_modules/semver/functions/prerelease.js"(exports, module) {
1248
+ "use strict";
1249
+ var parse2 = require_parse();
1250
+ var prerelease = /* @__PURE__ */ __name((version, options) => {
1251
+ const parsed = parse2(version, options);
1252
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
1253
+ }, "prerelease");
1254
+ module.exports = prerelease;
1255
+ }
1256
+ });
1257
+
1258
+ // ../../node_modules/semver/functions/compare.js
1259
+ var require_compare = __commonJS({
1260
+ "../../node_modules/semver/functions/compare.js"(exports, module) {
1261
+ "use strict";
1262
+ var SemVer = require_semver();
1263
+ var compare = /* @__PURE__ */ __name((a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose)), "compare");
1264
+ module.exports = compare;
1265
+ }
1266
+ });
1267
+
1268
+ // ../../node_modules/semver/functions/rcompare.js
1269
+ var require_rcompare = __commonJS({
1270
+ "../../node_modules/semver/functions/rcompare.js"(exports, module) {
1271
+ "use strict";
1272
+ var compare = require_compare();
1273
+ var rcompare = /* @__PURE__ */ __name((a, b, loose) => compare(b, a, loose), "rcompare");
1274
+ module.exports = rcompare;
1275
+ }
1276
+ });
1277
+
1278
+ // ../../node_modules/semver/functions/compare-loose.js
1279
+ var require_compare_loose = __commonJS({
1280
+ "../../node_modules/semver/functions/compare-loose.js"(exports, module) {
1281
+ "use strict";
1282
+ var compare = require_compare();
1283
+ var compareLoose = /* @__PURE__ */ __name((a, b) => compare(a, b, true), "compareLoose");
1284
+ module.exports = compareLoose;
1285
+ }
1286
+ });
1287
+
1288
+ // ../../node_modules/semver/functions/compare-build.js
1289
+ var require_compare_build = __commonJS({
1290
+ "../../node_modules/semver/functions/compare-build.js"(exports, module) {
1291
+ "use strict";
1292
+ var SemVer = require_semver();
1293
+ var compareBuild = /* @__PURE__ */ __name((a, b, loose) => {
1294
+ const versionA = new SemVer(a, loose);
1295
+ const versionB = new SemVer(b, loose);
1296
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
1297
+ }, "compareBuild");
1298
+ module.exports = compareBuild;
1299
+ }
1300
+ });
1301
+
1302
+ // ../../node_modules/semver/functions/sort.js
1303
+ var require_sort = __commonJS({
1304
+ "../../node_modules/semver/functions/sort.js"(exports, module) {
1305
+ "use strict";
1306
+ var compareBuild = require_compare_build();
1307
+ var sort = /* @__PURE__ */ __name((list, loose) => list.sort((a, b) => compareBuild(a, b, loose)), "sort");
1308
+ module.exports = sort;
1309
+ }
1310
+ });
1311
+
1312
+ // ../../node_modules/semver/functions/rsort.js
1313
+ var require_rsort = __commonJS({
1314
+ "../../node_modules/semver/functions/rsort.js"(exports, module) {
1315
+ "use strict";
1316
+ var compareBuild = require_compare_build();
1317
+ var rsort = /* @__PURE__ */ __name((list, loose) => list.sort((a, b) => compareBuild(b, a, loose)), "rsort");
1318
+ module.exports = rsort;
1319
+ }
1320
+ });
1321
+
1322
+ // ../../node_modules/semver/functions/gt.js
1323
+ var require_gt = __commonJS({
1324
+ "../../node_modules/semver/functions/gt.js"(exports, module) {
1325
+ "use strict";
1326
+ var compare = require_compare();
1327
+ var gt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) > 0, "gt");
1328
+ module.exports = gt;
1329
+ }
1330
+ });
1331
+
1332
+ // ../../node_modules/semver/functions/lt.js
1333
+ var require_lt = __commonJS({
1334
+ "../../node_modules/semver/functions/lt.js"(exports, module) {
1335
+ "use strict";
1336
+ var compare = require_compare();
1337
+ var lt = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) < 0, "lt");
1338
+ module.exports = lt;
1339
+ }
1340
+ });
1341
+
1342
+ // ../../node_modules/semver/functions/eq.js
1343
+ var require_eq = __commonJS({
1344
+ "../../node_modules/semver/functions/eq.js"(exports, module) {
1345
+ "use strict";
1346
+ var compare = require_compare();
1347
+ var eq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) === 0, "eq");
1348
+ module.exports = eq;
1349
+ }
1350
+ });
1351
+
1352
+ // ../../node_modules/semver/functions/neq.js
1353
+ var require_neq = __commonJS({
1354
+ "../../node_modules/semver/functions/neq.js"(exports, module) {
1355
+ "use strict";
1356
+ var compare = require_compare();
1357
+ var neq = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) !== 0, "neq");
1358
+ module.exports = neq;
1359
+ }
1360
+ });
1361
+
1362
+ // ../../node_modules/semver/functions/gte.js
1363
+ var require_gte = __commonJS({
1364
+ "../../node_modules/semver/functions/gte.js"(exports, module) {
1365
+ "use strict";
1366
+ var compare = require_compare();
1367
+ var gte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) >= 0, "gte");
1368
+ module.exports = gte;
1369
+ }
1370
+ });
1371
+
1372
+ // ../../node_modules/semver/functions/lte.js
1373
+ var require_lte = __commonJS({
1374
+ "../../node_modules/semver/functions/lte.js"(exports, module) {
1375
+ "use strict";
1376
+ var compare = require_compare();
1377
+ var lte = /* @__PURE__ */ __name((a, b, loose) => compare(a, b, loose) <= 0, "lte");
1378
+ module.exports = lte;
1379
+ }
1380
+ });
1381
+
1382
+ // ../../node_modules/semver/functions/cmp.js
1383
+ var require_cmp = __commonJS({
1384
+ "../../node_modules/semver/functions/cmp.js"(exports, module) {
1385
+ "use strict";
1386
+ var eq = require_eq();
1387
+ var neq = require_neq();
1388
+ var gt = require_gt();
1389
+ var gte = require_gte();
1390
+ var lt = require_lt();
1391
+ var lte = require_lte();
1392
+ var cmp = /* @__PURE__ */ __name((a, op, b, loose) => {
1393
+ switch (op) {
1394
+ case "===":
1395
+ if (typeof a === "object") {
1396
+ a = a.version;
1397
+ }
1398
+ if (typeof b === "object") {
1399
+ b = b.version;
1400
+ }
1401
+ return a === b;
1402
+ case "!==":
1403
+ if (typeof a === "object") {
1404
+ a = a.version;
1405
+ }
1406
+ if (typeof b === "object") {
1407
+ b = b.version;
1408
+ }
1409
+ return a !== b;
1410
+ case "":
1411
+ case "=":
1412
+ case "==":
1413
+ return eq(a, b, loose);
1414
+ case "!=":
1415
+ return neq(a, b, loose);
1416
+ case ">":
1417
+ return gt(a, b, loose);
1418
+ case ">=":
1419
+ return gte(a, b, loose);
1420
+ case "<":
1421
+ return lt(a, b, loose);
1422
+ case "<=":
1423
+ return lte(a, b, loose);
1424
+ default:
1425
+ throw new TypeError(`Invalid operator: ${op}`);
1426
+ }
1427
+ }, "cmp");
1428
+ module.exports = cmp;
1429
+ }
1430
+ });
1431
+
1432
+ // ../../node_modules/semver/functions/coerce.js
1433
+ var require_coerce = __commonJS({
1434
+ "../../node_modules/semver/functions/coerce.js"(exports, module) {
1435
+ "use strict";
1436
+ var SemVer = require_semver();
1437
+ var parse2 = require_parse();
1438
+ var { safeRe: re, t } = require_re();
1439
+ var coerce = /* @__PURE__ */ __name((version, options) => {
1440
+ if (version instanceof SemVer) {
1441
+ return version;
1442
+ }
1443
+ if (typeof version === "number") {
1444
+ version = String(version);
1445
+ }
1446
+ if (typeof version !== "string") {
1447
+ return null;
1448
+ }
1449
+ options = options || {};
1450
+ let match = null;
1451
+ if (!options.rtl) {
1452
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
1453
+ } else {
1454
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
1455
+ let next;
1456
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
1457
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
1458
+ match = next;
1459
+ }
1460
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
1461
+ }
1462
+ coerceRtlRegex.lastIndex = -1;
1463
+ }
1464
+ if (match === null) {
1465
+ return null;
1466
+ }
1467
+ const major = match[2];
1468
+ const minor = match[3] || "0";
1469
+ const patch = match[4] || "0";
1470
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
1471
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
1472
+ return parse2(`${major}.${minor}.${patch}${prerelease}${build}`, options);
1473
+ }, "coerce");
1474
+ module.exports = coerce;
1475
+ }
1476
+ });
1477
+
1478
+ // ../../node_modules/semver/internal/lrucache.js
1479
+ var require_lrucache = __commonJS({
1480
+ "../../node_modules/semver/internal/lrucache.js"(exports, module) {
1481
+ "use strict";
1482
+ var LRUCache = class {
1483
+ static {
1484
+ __name(this, "LRUCache");
1485
+ }
1486
+ constructor() {
1487
+ this.max = 1e3;
1488
+ this.map = /* @__PURE__ */ new Map();
1489
+ }
1490
+ get(key) {
1491
+ const value = this.map.get(key);
1492
+ if (value === void 0) {
1493
+ return void 0;
1494
+ } else {
1495
+ this.map.delete(key);
1496
+ this.map.set(key, value);
1497
+ return value;
1498
+ }
1499
+ }
1500
+ delete(key) {
1501
+ return this.map.delete(key);
1502
+ }
1503
+ set(key, value) {
1504
+ const deleted = this.delete(key);
1505
+ if (!deleted && value !== void 0) {
1506
+ if (this.map.size >= this.max) {
1507
+ const firstKey = this.map.keys().next().value;
1508
+ this.delete(firstKey);
1509
+ }
1510
+ this.map.set(key, value);
1511
+ }
1512
+ return this;
1513
+ }
1514
+ };
1515
+ module.exports = LRUCache;
1516
+ }
1517
+ });
1518
+
1519
+ // ../../node_modules/semver/classes/range.js
1520
+ var require_range = __commonJS({
1521
+ "../../node_modules/semver/classes/range.js"(exports, module) {
1522
+ "use strict";
1523
+ var SPACE_CHARACTERS = /\s+/g;
1524
+ var Range = class _Range {
1525
+ static {
1526
+ __name(this, "Range");
1527
+ }
1528
+ constructor(range, options) {
1529
+ options = parseOptions(options);
1530
+ if (range instanceof _Range) {
1531
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1532
+ return range;
1533
+ } else {
1534
+ return new _Range(range.raw, options);
1535
+ }
1536
+ }
1537
+ if (range instanceof Comparator) {
1538
+ this.raw = range.value;
1539
+ this.set = [[range]];
1540
+ this.formatted = void 0;
1541
+ return this;
1542
+ }
1543
+ this.options = options;
1544
+ this.loose = !!options.loose;
1545
+ this.includePrerelease = !!options.includePrerelease;
1546
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
1547
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
1548
+ if (!this.set.length) {
1549
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1550
+ }
1551
+ if (this.set.length > 1) {
1552
+ const first = this.set[0];
1553
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
1554
+ if (this.set.length === 0) {
1555
+ this.set = [first];
1556
+ } else if (this.set.length > 1) {
1557
+ for (const c of this.set) {
1558
+ if (c.length === 1 && isAny(c[0])) {
1559
+ this.set = [c];
1560
+ break;
1561
+ }
1562
+ }
1563
+ }
1564
+ }
1565
+ this.formatted = void 0;
1566
+ }
1567
+ get range() {
1568
+ if (this.formatted === void 0) {
1569
+ this.formatted = "";
1570
+ for (let i = 0; i < this.set.length; i++) {
1571
+ if (i > 0) {
1572
+ this.formatted += "||";
1573
+ }
1574
+ const comps = this.set[i];
1575
+ for (let k = 0; k < comps.length; k++) {
1576
+ if (k > 0) {
1577
+ this.formatted += " ";
1578
+ }
1579
+ this.formatted += comps[k].toString().trim();
1580
+ }
1581
+ }
1582
+ }
1583
+ return this.formatted;
1584
+ }
1585
+ format() {
1586
+ return this.range;
1587
+ }
1588
+ toString() {
1589
+ return this.range;
1590
+ }
1591
+ parseRange(range) {
1592
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
1593
+ const memoKey = memoOpts + ":" + range;
1594
+ const cached = cache.get(memoKey);
1595
+ if (cached) {
1596
+ return cached;
1597
+ }
1598
+ const loose = this.options.loose;
1599
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1600
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1601
+ debug("hyphen replace", range);
1602
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1603
+ debug("comparator trim", range);
1604
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1605
+ debug("tilde trim", range);
1606
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1607
+ debug("caret trim", range);
1608
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1609
+ if (loose) {
1610
+ rangeList = rangeList.filter((comp) => {
1611
+ debug("loose invalid filter", comp, this.options);
1612
+ return !!comp.match(re[t.COMPARATORLOOSE]);
1613
+ });
1614
+ }
1615
+ debug("range list", rangeList);
1616
+ const rangeMap = /* @__PURE__ */ new Map();
1617
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
1618
+ for (const comp of comparators) {
1619
+ if (isNullSet(comp)) {
1620
+ return [comp];
1621
+ }
1622
+ rangeMap.set(comp.value, comp);
1623
+ }
1624
+ if (rangeMap.size > 1 && rangeMap.has("")) {
1625
+ rangeMap.delete("");
1626
+ }
1627
+ const result = [...rangeMap.values()];
1628
+ cache.set(memoKey, result);
1629
+ return result;
1630
+ }
1631
+ intersects(range, options) {
1632
+ if (!(range instanceof _Range)) {
1633
+ throw new TypeError("a Range is required");
1634
+ }
1635
+ return this.set.some((thisComparators) => {
1636
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1637
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1638
+ return rangeComparators.every((rangeComparator) => {
1639
+ return thisComparator.intersects(rangeComparator, options);
1640
+ });
1641
+ });
1642
+ });
1643
+ });
1644
+ }
1645
+ // if ANY of the sets match ALL of its comparators, then pass
1646
+ test(version) {
1647
+ if (!version) {
1648
+ return false;
1649
+ }
1650
+ if (typeof version === "string") {
1651
+ try {
1652
+ version = new SemVer(version, this.options);
1653
+ } catch (er) {
1654
+ return false;
1655
+ }
1656
+ }
1657
+ for (let i = 0; i < this.set.length; i++) {
1658
+ if (testSet(this.set[i], version, this.options)) {
1659
+ return true;
1660
+ }
1661
+ }
1662
+ return false;
1663
+ }
1664
+ };
1665
+ module.exports = Range;
1666
+ var LRU = require_lrucache();
1667
+ var cache = new LRU();
1668
+ var parseOptions = require_parse_options();
1669
+ var Comparator = require_comparator();
1670
+ var debug = require_debug();
1671
+ var SemVer = require_semver();
1672
+ var {
1673
+ safeRe: re,
1674
+ t,
1675
+ comparatorTrimReplace,
1676
+ tildeTrimReplace,
1677
+ caretTrimReplace
1678
+ } = require_re();
1679
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1680
+ var isNullSet = /* @__PURE__ */ __name((c) => c.value === "<0.0.0-0", "isNullSet");
1681
+ var isAny = /* @__PURE__ */ __name((c) => c.value === "", "isAny");
1682
+ var isSatisfiable = /* @__PURE__ */ __name((comparators, options) => {
1683
+ let result = true;
1684
+ const remainingComparators = comparators.slice();
1685
+ let testComparator = remainingComparators.pop();
1686
+ while (result && remainingComparators.length) {
1687
+ result = remainingComparators.every((otherComparator) => {
1688
+ return testComparator.intersects(otherComparator, options);
1689
+ });
1690
+ testComparator = remainingComparators.pop();
1691
+ }
1692
+ return result;
1693
+ }, "isSatisfiable");
1694
+ var parseComparator = /* @__PURE__ */ __name((comp, options) => {
1695
+ debug("comp", comp, options);
1696
+ comp = replaceCarets(comp, options);
1697
+ debug("caret", comp);
1698
+ comp = replaceTildes(comp, options);
1699
+ debug("tildes", comp);
1700
+ comp = replaceXRanges(comp, options);
1701
+ debug("xrange", comp);
1702
+ comp = replaceStars(comp, options);
1703
+ debug("stars", comp);
1704
+ return comp;
1705
+ }, "parseComparator");
1706
+ var isX = /* @__PURE__ */ __name((id) => !id || id.toLowerCase() === "x" || id === "*", "isX");
1707
+ var replaceTildes = /* @__PURE__ */ __name((comp, options) => {
1708
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1709
+ }, "replaceTildes");
1710
+ var replaceTilde = /* @__PURE__ */ __name((comp, options) => {
1711
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1712
+ return comp.replace(r, (_, M, m, p, pr) => {
1713
+ debug("tilde", comp, _, M, m, p, pr);
1714
+ let ret;
1715
+ if (isX(M)) {
1716
+ ret = "";
1717
+ } else if (isX(m)) {
1718
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1719
+ } else if (isX(p)) {
1720
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1721
+ } else if (pr) {
1722
+ debug("replaceTilde pr", pr);
1723
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1724
+ } else {
1725
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1726
+ }
1727
+ debug("tilde return", ret);
1728
+ return ret;
1729
+ });
1730
+ }, "replaceTilde");
1731
+ var replaceCarets = /* @__PURE__ */ __name((comp, options) => {
1732
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1733
+ }, "replaceCarets");
1734
+ var replaceCaret = /* @__PURE__ */ __name((comp, options) => {
1735
+ debug("caret", comp, options);
1736
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1737
+ const z = options.includePrerelease ? "-0" : "";
1738
+ return comp.replace(r, (_, M, m, p, pr) => {
1739
+ debug("caret", comp, _, M, m, p, pr);
1740
+ let ret;
1741
+ if (isX(M)) {
1742
+ ret = "";
1743
+ } else if (isX(m)) {
1744
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1745
+ } else if (isX(p)) {
1746
+ if (M === "0") {
1747
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1748
+ } else {
1749
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1750
+ }
1751
+ } else if (pr) {
1752
+ debug("replaceCaret pr", pr);
1753
+ if (M === "0") {
1754
+ if (m === "0") {
1755
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1756
+ } else {
1757
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1758
+ }
1759
+ } else {
1760
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1761
+ }
1762
+ } else {
1763
+ debug("no pr");
1764
+ if (M === "0") {
1765
+ if (m === "0") {
1766
+ ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1767
+ } else {
1768
+ ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1769
+ }
1770
+ } else {
1771
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1772
+ }
1773
+ }
1774
+ debug("caret return", ret);
1775
+ return ret;
1776
+ });
1777
+ }, "replaceCaret");
1778
+ var replaceXRanges = /* @__PURE__ */ __name((comp, options) => {
1779
+ debug("replaceXRanges", comp, options);
1780
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1781
+ }, "replaceXRanges");
1782
+ var replaceXRange = /* @__PURE__ */ __name((comp, options) => {
1783
+ comp = comp.trim();
1784
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1785
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1786
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
1787
+ const xM = isX(M);
1788
+ const xm = xM || isX(m);
1789
+ const xp = xm || isX(p);
1790
+ const anyX = xp;
1791
+ if (gtlt === "=" && anyX) {
1792
+ gtlt = "";
1793
+ }
1794
+ pr = options.includePrerelease ? "-0" : "";
1795
+ if (xM) {
1796
+ if (gtlt === ">" || gtlt === "<") {
1797
+ ret = "<0.0.0-0";
1798
+ } else {
1799
+ ret = "*";
1800
+ }
1801
+ } else if (gtlt && anyX) {
1802
+ if (xm) {
1803
+ m = 0;
1804
+ }
1805
+ p = 0;
1806
+ if (gtlt === ">") {
1807
+ gtlt = ">=";
1808
+ if (xm) {
1809
+ M = +M + 1;
1810
+ m = 0;
1811
+ p = 0;
1812
+ } else {
1813
+ m = +m + 1;
1814
+ p = 0;
1815
+ }
1816
+ } else if (gtlt === "<=") {
1817
+ gtlt = "<";
1818
+ if (xm) {
1819
+ M = +M + 1;
1820
+ } else {
1821
+ m = +m + 1;
1822
+ }
1823
+ }
1824
+ if (gtlt === "<") {
1825
+ pr = "-0";
1826
+ }
1827
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1828
+ } else if (xm) {
1829
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1830
+ } else if (xp) {
1831
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1832
+ }
1833
+ debug("xRange return", ret);
1834
+ return ret;
1835
+ });
1836
+ }, "replaceXRange");
1837
+ var replaceStars = /* @__PURE__ */ __name((comp, options) => {
1838
+ debug("replaceStars", comp, options);
1839
+ return comp.trim().replace(re[t.STAR], "");
1840
+ }, "replaceStars");
1841
+ var replaceGTE0 = /* @__PURE__ */ __name((comp, options) => {
1842
+ debug("replaceGTE0", comp, options);
1843
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1844
+ }, "replaceGTE0");
1845
+ var hyphenReplace = /* @__PURE__ */ __name((incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1846
+ if (isX(fM)) {
1847
+ from = "";
1848
+ } else if (isX(fm)) {
1849
+ from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1850
+ } else if (isX(fp)) {
1851
+ from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1852
+ } else if (fpr) {
1853
+ from = `>=${from}`;
1854
+ } else {
1855
+ from = `>=${from}${incPr ? "-0" : ""}`;
1856
+ }
1857
+ if (isX(tM)) {
1858
+ to = "";
1859
+ } else if (isX(tm)) {
1860
+ to = `<${+tM + 1}.0.0-0`;
1861
+ } else if (isX(tp)) {
1862
+ to = `<${tM}.${+tm + 1}.0-0`;
1863
+ } else if (tpr) {
1864
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
1865
+ } else if (incPr) {
1866
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
1867
+ } else {
1868
+ to = `<=${to}`;
1869
+ }
1870
+ return `${from} ${to}`.trim();
1871
+ }, "hyphenReplace");
1872
+ var testSet = /* @__PURE__ */ __name((set, version, options) => {
1873
+ for (let i = 0; i < set.length; i++) {
1874
+ if (!set[i].test(version)) {
1875
+ return false;
1876
+ }
1877
+ }
1878
+ if (version.prerelease.length && !options.includePrerelease) {
1879
+ for (let i = 0; i < set.length; i++) {
1880
+ debug(set[i].semver);
1881
+ if (set[i].semver === Comparator.ANY) {
1882
+ continue;
1883
+ }
1884
+ if (set[i].semver.prerelease.length > 0) {
1885
+ const allowed = set[i].semver;
1886
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
1887
+ return true;
1888
+ }
1889
+ }
1890
+ }
1891
+ return false;
1892
+ }
1893
+ return true;
1894
+ }, "testSet");
1895
+ }
1896
+ });
1897
+
1898
+ // ../../node_modules/semver/classes/comparator.js
1899
+ var require_comparator = __commonJS({
1900
+ "../../node_modules/semver/classes/comparator.js"(exports, module) {
1901
+ "use strict";
1902
+ var ANY = Symbol("SemVer ANY");
1903
+ var Comparator = class _Comparator {
1904
+ static {
1905
+ __name(this, "Comparator");
1906
+ }
1907
+ static get ANY() {
1908
+ return ANY;
1909
+ }
1910
+ constructor(comp, options) {
1911
+ options = parseOptions(options);
1912
+ if (comp instanceof _Comparator) {
1913
+ if (comp.loose === !!options.loose) {
1914
+ return comp;
1915
+ } else {
1916
+ comp = comp.value;
1917
+ }
1918
+ }
1919
+ comp = comp.trim().split(/\s+/).join(" ");
1920
+ debug("comparator", comp, options);
1921
+ this.options = options;
1922
+ this.loose = !!options.loose;
1923
+ this.parse(comp);
1924
+ if (this.semver === ANY) {
1925
+ this.value = "";
1926
+ } else {
1927
+ this.value = this.operator + this.semver.version;
1928
+ }
1929
+ debug("comp", this);
1930
+ }
1931
+ parse(comp) {
1932
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1933
+ const m = comp.match(r);
1934
+ if (!m) {
1935
+ throw new TypeError(`Invalid comparator: ${comp}`);
1936
+ }
1937
+ this.operator = m[1] !== void 0 ? m[1] : "";
1938
+ if (this.operator === "=") {
1939
+ this.operator = "";
1940
+ }
1941
+ if (!m[2]) {
1942
+ this.semver = ANY;
1943
+ } else {
1944
+ this.semver = new SemVer(m[2], this.options.loose);
1945
+ }
1946
+ }
1947
+ toString() {
1948
+ return this.value;
1949
+ }
1950
+ test(version) {
1951
+ debug("Comparator.test", version, this.options.loose);
1952
+ if (this.semver === ANY || version === ANY) {
1953
+ return true;
1954
+ }
1955
+ if (typeof version === "string") {
1956
+ try {
1957
+ version = new SemVer(version, this.options);
1958
+ } catch (er) {
1959
+ return false;
1960
+ }
1961
+ }
1962
+ return cmp(version, this.operator, this.semver, this.options);
1963
+ }
1964
+ intersects(comp, options) {
1965
+ if (!(comp instanceof _Comparator)) {
1966
+ throw new TypeError("a Comparator is required");
1967
+ }
1968
+ if (this.operator === "") {
1969
+ if (this.value === "") {
1970
+ return true;
1971
+ }
1972
+ return new Range(comp.value, options).test(this.value);
1973
+ } else if (comp.operator === "") {
1974
+ if (comp.value === "") {
1975
+ return true;
1976
+ }
1977
+ return new Range(this.value, options).test(comp.semver);
1978
+ }
1979
+ options = parseOptions(options);
1980
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1981
+ return false;
1982
+ }
1983
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1984
+ return false;
1985
+ }
1986
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
1987
+ return true;
1988
+ }
1989
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
1990
+ return true;
1991
+ }
1992
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
1993
+ return true;
1994
+ }
1995
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1996
+ return true;
1997
+ }
1998
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1999
+ return true;
2000
+ }
2001
+ return false;
2002
+ }
2003
+ };
2004
+ module.exports = Comparator;
2005
+ var parseOptions = require_parse_options();
2006
+ var { safeRe: re, t } = require_re();
2007
+ var cmp = require_cmp();
2008
+ var debug = require_debug();
2009
+ var SemVer = require_semver();
2010
+ var Range = require_range();
2011
+ }
2012
+ });
2013
+
2014
+ // ../../node_modules/semver/functions/satisfies.js
2015
+ var require_satisfies = __commonJS({
2016
+ "../../node_modules/semver/functions/satisfies.js"(exports, module) {
2017
+ "use strict";
2018
+ var Range = require_range();
2019
+ var satisfies = /* @__PURE__ */ __name((version, range, options) => {
2020
+ try {
2021
+ range = new Range(range, options);
2022
+ } catch (er) {
2023
+ return false;
2024
+ }
2025
+ return range.test(version);
2026
+ }, "satisfies");
2027
+ module.exports = satisfies;
2028
+ }
2029
+ });
2030
+
2031
+ // ../../node_modules/semver/ranges/to-comparators.js
2032
+ var require_to_comparators = __commonJS({
2033
+ "../../node_modules/semver/ranges/to-comparators.js"(exports, module) {
2034
+ "use strict";
2035
+ var Range = require_range();
2036
+ var toComparators = /* @__PURE__ */ __name((range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" ")), "toComparators");
2037
+ module.exports = toComparators;
2038
+ }
2039
+ });
2040
+
2041
+ // ../../node_modules/semver/ranges/max-satisfying.js
2042
+ var require_max_satisfying = __commonJS({
2043
+ "../../node_modules/semver/ranges/max-satisfying.js"(exports, module) {
2044
+ "use strict";
2045
+ var SemVer = require_semver();
2046
+ var Range = require_range();
2047
+ var maxSatisfying = /* @__PURE__ */ __name((versions, range, options) => {
2048
+ let max = null;
2049
+ let maxSV = null;
2050
+ let rangeObj = null;
2051
+ try {
2052
+ rangeObj = new Range(range, options);
2053
+ } catch (er) {
2054
+ return null;
2055
+ }
2056
+ versions.forEach((v) => {
2057
+ if (rangeObj.test(v)) {
2058
+ if (!max || maxSV.compare(v) === -1) {
2059
+ max = v;
2060
+ maxSV = new SemVer(max, options);
2061
+ }
2062
+ }
2063
+ });
2064
+ return max;
2065
+ }, "maxSatisfying");
2066
+ module.exports = maxSatisfying;
2067
+ }
2068
+ });
2069
+
2070
+ // ../../node_modules/semver/ranges/min-satisfying.js
2071
+ var require_min_satisfying = __commonJS({
2072
+ "../../node_modules/semver/ranges/min-satisfying.js"(exports, module) {
2073
+ "use strict";
2074
+ var SemVer = require_semver();
2075
+ var Range = require_range();
2076
+ var minSatisfying = /* @__PURE__ */ __name((versions, range, options) => {
2077
+ let min = null;
2078
+ let minSV = null;
2079
+ let rangeObj = null;
2080
+ try {
2081
+ rangeObj = new Range(range, options);
2082
+ } catch (er) {
2083
+ return null;
2084
+ }
2085
+ versions.forEach((v) => {
2086
+ if (rangeObj.test(v)) {
2087
+ if (!min || minSV.compare(v) === 1) {
2088
+ min = v;
2089
+ minSV = new SemVer(min, options);
2090
+ }
2091
+ }
2092
+ });
2093
+ return min;
2094
+ }, "minSatisfying");
2095
+ module.exports = minSatisfying;
2096
+ }
2097
+ });
2098
+
2099
+ // ../../node_modules/semver/ranges/min-version.js
2100
+ var require_min_version = __commonJS({
2101
+ "../../node_modules/semver/ranges/min-version.js"(exports, module) {
2102
+ "use strict";
2103
+ var SemVer = require_semver();
2104
+ var Range = require_range();
2105
+ var gt = require_gt();
2106
+ var minVersion = /* @__PURE__ */ __name((range, loose) => {
2107
+ range = new Range(range, loose);
2108
+ let minver = new SemVer("0.0.0");
2109
+ if (range.test(minver)) {
2110
+ return minver;
2111
+ }
2112
+ minver = new SemVer("0.0.0-0");
2113
+ if (range.test(minver)) {
2114
+ return minver;
2115
+ }
2116
+ minver = null;
2117
+ for (let i = 0; i < range.set.length; ++i) {
2118
+ const comparators = range.set[i];
2119
+ let setMin = null;
2120
+ comparators.forEach((comparator) => {
2121
+ const compver = new SemVer(comparator.semver.version);
2122
+ switch (comparator.operator) {
2123
+ case ">":
2124
+ if (compver.prerelease.length === 0) {
2125
+ compver.patch++;
2126
+ } else {
2127
+ compver.prerelease.push(0);
2128
+ }
2129
+ compver.raw = compver.format();
2130
+ /* fallthrough */
2131
+ case "":
2132
+ case ">=":
2133
+ if (!setMin || gt(compver, setMin)) {
2134
+ setMin = compver;
2135
+ }
2136
+ break;
2137
+ case "<":
2138
+ case "<=":
2139
+ break;
2140
+ /* istanbul ignore next */
2141
+ default:
2142
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
2143
+ }
2144
+ });
2145
+ if (setMin && (!minver || gt(minver, setMin))) {
2146
+ minver = setMin;
2147
+ }
2148
+ }
2149
+ if (minver && range.test(minver)) {
2150
+ return minver;
2151
+ }
2152
+ return null;
2153
+ }, "minVersion");
2154
+ module.exports = minVersion;
2155
+ }
2156
+ });
2157
+
2158
+ // ../../node_modules/semver/ranges/valid.js
2159
+ var require_valid2 = __commonJS({
2160
+ "../../node_modules/semver/ranges/valid.js"(exports, module) {
2161
+ "use strict";
2162
+ var Range = require_range();
2163
+ var validRange = /* @__PURE__ */ __name((range, options) => {
2164
+ try {
2165
+ return new Range(range, options).range || "*";
2166
+ } catch (er) {
2167
+ return null;
2168
+ }
2169
+ }, "validRange");
2170
+ module.exports = validRange;
2171
+ }
2172
+ });
2173
+
2174
+ // ../../node_modules/semver/ranges/outside.js
2175
+ var require_outside = __commonJS({
2176
+ "../../node_modules/semver/ranges/outside.js"(exports, module) {
2177
+ "use strict";
2178
+ var SemVer = require_semver();
2179
+ var Comparator = require_comparator();
2180
+ var { ANY } = Comparator;
2181
+ var Range = require_range();
2182
+ var satisfies = require_satisfies();
2183
+ var gt = require_gt();
2184
+ var lt = require_lt();
2185
+ var lte = require_lte();
2186
+ var gte = require_gte();
2187
+ var outside = /* @__PURE__ */ __name((version, range, hilo, options) => {
2188
+ version = new SemVer(version, options);
2189
+ range = new Range(range, options);
2190
+ let gtfn, ltefn, ltfn, comp, ecomp;
2191
+ switch (hilo) {
2192
+ case ">":
2193
+ gtfn = gt;
2194
+ ltefn = lte;
2195
+ ltfn = lt;
2196
+ comp = ">";
2197
+ ecomp = ">=";
2198
+ break;
2199
+ case "<":
2200
+ gtfn = lt;
2201
+ ltefn = gte;
2202
+ ltfn = gt;
2203
+ comp = "<";
2204
+ ecomp = "<=";
2205
+ break;
2206
+ default:
2207
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
2208
+ }
2209
+ if (satisfies(version, range, options)) {
2210
+ return false;
2211
+ }
2212
+ for (let i = 0; i < range.set.length; ++i) {
2213
+ const comparators = range.set[i];
2214
+ let high = null;
2215
+ let low = null;
2216
+ comparators.forEach((comparator) => {
2217
+ if (comparator.semver === ANY) {
2218
+ comparator = new Comparator(">=0.0.0");
2219
+ }
2220
+ high = high || comparator;
2221
+ low = low || comparator;
2222
+ if (gtfn(comparator.semver, high.semver, options)) {
2223
+ high = comparator;
2224
+ } else if (ltfn(comparator.semver, low.semver, options)) {
2225
+ low = comparator;
2226
+ }
2227
+ });
2228
+ if (high.operator === comp || high.operator === ecomp) {
2229
+ return false;
2230
+ }
2231
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
2232
+ return false;
2233
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
2234
+ return false;
2235
+ }
2236
+ }
2237
+ return true;
2238
+ }, "outside");
2239
+ module.exports = outside;
2240
+ }
2241
+ });
2242
+
2243
+ // ../../node_modules/semver/ranges/gtr.js
2244
+ var require_gtr = __commonJS({
2245
+ "../../node_modules/semver/ranges/gtr.js"(exports, module) {
2246
+ "use strict";
2247
+ var outside = require_outside();
2248
+ var gtr = /* @__PURE__ */ __name((version, range, options) => outside(version, range, ">", options), "gtr");
2249
+ module.exports = gtr;
2250
+ }
2251
+ });
2252
+
2253
+ // ../../node_modules/semver/ranges/ltr.js
2254
+ var require_ltr = __commonJS({
2255
+ "../../node_modules/semver/ranges/ltr.js"(exports, module) {
2256
+ "use strict";
2257
+ var outside = require_outside();
2258
+ var ltr = /* @__PURE__ */ __name((version, range, options) => outside(version, range, "<", options), "ltr");
2259
+ module.exports = ltr;
2260
+ }
2261
+ });
2262
+
2263
+ // ../../node_modules/semver/ranges/intersects.js
2264
+ var require_intersects = __commonJS({
2265
+ "../../node_modules/semver/ranges/intersects.js"(exports, module) {
2266
+ "use strict";
2267
+ var Range = require_range();
2268
+ var intersects = /* @__PURE__ */ __name((r1, r2, options) => {
2269
+ r1 = new Range(r1, options);
2270
+ r2 = new Range(r2, options);
2271
+ return r1.intersects(r2, options);
2272
+ }, "intersects");
2273
+ module.exports = intersects;
2274
+ }
2275
+ });
2276
+
2277
+ // ../../node_modules/semver/ranges/simplify.js
2278
+ var require_simplify = __commonJS({
2279
+ "../../node_modules/semver/ranges/simplify.js"(exports, module) {
2280
+ "use strict";
2281
+ var satisfies = require_satisfies();
2282
+ var compare = require_compare();
2283
+ module.exports = (versions, range, options) => {
2284
+ const set = [];
2285
+ let first = null;
2286
+ let prev = null;
2287
+ const v = versions.sort((a, b) => compare(a, b, options));
2288
+ for (const version of v) {
2289
+ const included = satisfies(version, range, options);
2290
+ if (included) {
2291
+ prev = version;
2292
+ if (!first) {
2293
+ first = version;
2294
+ }
2295
+ } else {
2296
+ if (prev) {
2297
+ set.push([first, prev]);
2298
+ }
2299
+ prev = null;
2300
+ first = null;
2301
+ }
2302
+ }
2303
+ if (first) {
2304
+ set.push([first, null]);
2305
+ }
2306
+ const ranges = [];
2307
+ for (const [min, max] of set) {
2308
+ if (min === max) {
2309
+ ranges.push(min);
2310
+ } else if (!max && min === v[0]) {
2311
+ ranges.push("*");
2312
+ } else if (!max) {
2313
+ ranges.push(`>=${min}`);
2314
+ } else if (min === v[0]) {
2315
+ ranges.push(`<=${max}`);
2316
+ } else {
2317
+ ranges.push(`${min} - ${max}`);
2318
+ }
2319
+ }
2320
+ const simplified = ranges.join(" || ");
2321
+ const original = typeof range.raw === "string" ? range.raw : String(range);
2322
+ return simplified.length < original.length ? simplified : range;
2323
+ };
2324
+ }
2325
+ });
2326
+
2327
+ // ../../node_modules/semver/ranges/subset.js
2328
+ var require_subset = __commonJS({
2329
+ "../../node_modules/semver/ranges/subset.js"(exports, module) {
2330
+ "use strict";
2331
+ var Range = require_range();
2332
+ var Comparator = require_comparator();
2333
+ var { ANY } = Comparator;
2334
+ var satisfies = require_satisfies();
2335
+ var compare = require_compare();
2336
+ var subset = /* @__PURE__ */ __name((sub, dom, options = {}) => {
2337
+ if (sub === dom) {
2338
+ return true;
2339
+ }
2340
+ sub = new Range(sub, options);
2341
+ dom = new Range(dom, options);
2342
+ let sawNonNull = false;
2343
+ OUTER: for (const simpleSub of sub.set) {
2344
+ for (const simpleDom of dom.set) {
2345
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
2346
+ sawNonNull = sawNonNull || isSub !== null;
2347
+ if (isSub) {
2348
+ continue OUTER;
2349
+ }
2350
+ }
2351
+ if (sawNonNull) {
2352
+ return false;
2353
+ }
2354
+ }
2355
+ return true;
2356
+ }, "subset");
2357
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
2358
+ var minimumVersion = [new Comparator(">=0.0.0")];
2359
+ var simpleSubset = /* @__PURE__ */ __name((sub, dom, options) => {
2360
+ if (sub === dom) {
2361
+ return true;
2362
+ }
2363
+ if (sub.length === 1 && sub[0].semver === ANY) {
2364
+ if (dom.length === 1 && dom[0].semver === ANY) {
2365
+ return true;
2366
+ } else if (options.includePrerelease) {
2367
+ sub = minimumVersionWithPreRelease;
2368
+ } else {
2369
+ sub = minimumVersion;
2370
+ }
2371
+ }
2372
+ if (dom.length === 1 && dom[0].semver === ANY) {
2373
+ if (options.includePrerelease) {
2374
+ return true;
2375
+ } else {
2376
+ dom = minimumVersion;
2377
+ }
2378
+ }
2379
+ const eqSet = /* @__PURE__ */ new Set();
2380
+ let gt, lt;
2381
+ for (const c of sub) {
2382
+ if (c.operator === ">" || c.operator === ">=") {
2383
+ gt = higherGT(gt, c, options);
2384
+ } else if (c.operator === "<" || c.operator === "<=") {
2385
+ lt = lowerLT(lt, c, options);
2386
+ } else {
2387
+ eqSet.add(c.semver);
2388
+ }
2389
+ }
2390
+ if (eqSet.size > 1) {
2391
+ return null;
2392
+ }
2393
+ let gtltComp;
2394
+ if (gt && lt) {
2395
+ gtltComp = compare(gt.semver, lt.semver, options);
2396
+ if (gtltComp > 0) {
2397
+ return null;
2398
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2399
+ return null;
2400
+ }
2401
+ }
2402
+ for (const eq of eqSet) {
2403
+ if (gt && !satisfies(eq, String(gt), options)) {
2404
+ return null;
2405
+ }
2406
+ if (lt && !satisfies(eq, String(lt), options)) {
2407
+ return null;
2408
+ }
2409
+ for (const c of dom) {
2410
+ if (!satisfies(eq, String(c), options)) {
2411
+ return false;
2412
+ }
2413
+ }
2414
+ return true;
2415
+ }
2416
+ let higher, lower;
2417
+ let hasDomLT, hasDomGT;
2418
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2419
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2420
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2421
+ needDomLTPre = false;
2422
+ }
2423
+ for (const c of dom) {
2424
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
2425
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
2426
+ if (gt) {
2427
+ if (needDomGTPre) {
2428
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
2429
+ needDomGTPre = false;
2430
+ }
2431
+ }
2432
+ if (c.operator === ">" || c.operator === ">=") {
2433
+ higher = higherGT(gt, c, options);
2434
+ if (higher === c && higher !== gt) {
2435
+ return false;
2436
+ }
2437
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
2438
+ return false;
2439
+ }
2440
+ }
2441
+ if (lt) {
2442
+ if (needDomLTPre) {
2443
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
2444
+ needDomLTPre = false;
2445
+ }
2446
+ }
2447
+ if (c.operator === "<" || c.operator === "<=") {
2448
+ lower = lowerLT(lt, c, options);
2449
+ if (lower === c && lower !== lt) {
2450
+ return false;
2451
+ }
2452
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
2453
+ return false;
2454
+ }
2455
+ }
2456
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
2457
+ return false;
2458
+ }
2459
+ }
2460
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
2461
+ return false;
2462
+ }
2463
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
2464
+ return false;
2465
+ }
2466
+ if (needDomGTPre || needDomLTPre) {
2467
+ return false;
2468
+ }
2469
+ return true;
2470
+ }, "simpleSubset");
2471
+ var higherGT = /* @__PURE__ */ __name((a, b, options) => {
2472
+ if (!a) {
2473
+ return b;
2474
+ }
2475
+ const comp = compare(a.semver, b.semver, options);
2476
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2477
+ }, "higherGT");
2478
+ var lowerLT = /* @__PURE__ */ __name((a, b, options) => {
2479
+ if (!a) {
2480
+ return b;
2481
+ }
2482
+ const comp = compare(a.semver, b.semver, options);
2483
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2484
+ }, "lowerLT");
2485
+ module.exports = subset;
2486
+ }
2487
+ });
2488
+
2489
+ // ../../node_modules/semver/index.js
2490
+ var require_semver2 = __commonJS({
2491
+ "../../node_modules/semver/index.js"(exports, module) {
2492
+ "use strict";
2493
+ var internalRe = require_re();
2494
+ var constants = require_constants();
2495
+ var SemVer = require_semver();
2496
+ var identifiers = require_identifiers();
2497
+ var parse2 = require_parse();
2498
+ var valid = require_valid();
2499
+ var clean = require_clean();
2500
+ var inc = require_inc();
2501
+ var diff = require_diff();
2502
+ var major = require_major();
2503
+ var minor = require_minor();
2504
+ var patch = require_patch();
2505
+ var prerelease = require_prerelease();
2506
+ var compare = require_compare();
2507
+ var rcompare = require_rcompare();
2508
+ var compareLoose = require_compare_loose();
2509
+ var compareBuild = require_compare_build();
2510
+ var sort = require_sort();
2511
+ var rsort = require_rsort();
2512
+ var gt = require_gt();
2513
+ var lt = require_lt();
2514
+ var eq = require_eq();
2515
+ var neq = require_neq();
2516
+ var gte = require_gte();
2517
+ var lte = require_lte();
2518
+ var cmp = require_cmp();
2519
+ var coerce = require_coerce();
2520
+ var Comparator = require_comparator();
2521
+ var Range = require_range();
2522
+ var satisfies = require_satisfies();
2523
+ var toComparators = require_to_comparators();
2524
+ var maxSatisfying = require_max_satisfying();
2525
+ var minSatisfying = require_min_satisfying();
2526
+ var minVersion = require_min_version();
2527
+ var validRange = require_valid2();
2528
+ var outside = require_outside();
2529
+ var gtr = require_gtr();
2530
+ var ltr = require_ltr();
2531
+ var intersects = require_intersects();
2532
+ var simplifyRange = require_simplify();
2533
+ var subset = require_subset();
2534
+ module.exports = {
2535
+ parse: parse2,
2536
+ valid,
2537
+ clean,
2538
+ inc,
2539
+ diff,
2540
+ major,
2541
+ minor,
2542
+ patch,
2543
+ prerelease,
2544
+ compare,
2545
+ rcompare,
2546
+ compareLoose,
2547
+ compareBuild,
2548
+ sort,
2549
+ rsort,
2550
+ gt,
2551
+ lt,
2552
+ eq,
2553
+ neq,
2554
+ gte,
2555
+ lte,
2556
+ cmp,
2557
+ coerce,
2558
+ Comparator,
2559
+ Range,
2560
+ satisfies,
2561
+ toComparators,
2562
+ maxSatisfying,
2563
+ minSatisfying,
2564
+ minVersion,
2565
+ validRange,
2566
+ outside,
2567
+ gtr,
2568
+ ltr,
2569
+ intersects,
2570
+ simplifyRange,
2571
+ subset,
2572
+ SemVer,
2573
+ re: internalRe.re,
2574
+ src: internalRe.src,
2575
+ tokens: internalRe.t,
2576
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
2577
+ RELEASE_TYPES: constants.RELEASE_TYPES,
2578
+ compareIdentifiers: identifiers.compareIdentifiers,
2579
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
2580
+ };
2581
+ }
2582
+ });
2583
+
664
2584
  // src/preset.ts
665
2585
  var import_postcss_load_config = __toESM(require_src2(), 1);
2586
+ var import_semver = __toESM(require_semver2(), 1);
666
2587
  import { createRequire } from "node:module";
667
- import { dirname } from "node:path";
668
- import { fileURLToPath } from "node:url";
2588
+ import { dirname as dirname2 } from "node:path";
2589
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
669
2590
  import { getProjectRoot } from "storybook/internal/common";
670
2591
  import { IncompatiblePostCssConfigError } from "storybook/internal/server-errors";
671
2592
  import { viteFinal as reactViteFinal } from "@storybook/react-vite/preset";
2593
+
2594
+ // src/utils.ts
2595
+ import { readFileSync } from "node:fs";
2596
+ import { join as join2 } from "node:path";
2597
+
2598
+ // ../../core/src/shared/utils/module.ts
2599
+ import { fileURLToPath, pathToFileURL } from "node:url";
2600
+
2601
+ // ../../node_modules/exsolve/dist/index.mjs
2602
+ import assert from "node:assert";
2603
+ import v8 from "node:v8";
2604
+ import { format, inspect } from "node:util";
2605
+ var own$1 = {}.hasOwnProperty;
2606
+ var classRegExp = /^([A-Z][a-z\d]*)+$/;
2607
+ var kTypes = /* @__PURE__ */ new Set([
2608
+ "string",
2609
+ "function",
2610
+ "number",
2611
+ "object",
2612
+ // Accept 'Function' and 'Object' as alternative to the lower cased version.
2613
+ "Function",
2614
+ "Object",
2615
+ "boolean",
2616
+ "bigint",
2617
+ "symbol"
2618
+ ]);
2619
+ var messages = /* @__PURE__ */ new Map();
2620
+ var nodeInternalPrefix = "__node_internal_";
2621
+ var userStackTraceLimit;
2622
+ function formatList(array, type = "and") {
2623
+ return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
2624
+ }
2625
+ __name(formatList, "formatList");
2626
+ function createError(sym, value, constructor) {
2627
+ messages.set(sym, value);
2628
+ return makeNodeErrorWithCode(constructor, sym);
2629
+ }
2630
+ __name(createError, "createError");
2631
+ function makeNodeErrorWithCode(Base, key) {
2632
+ return /* @__PURE__ */ __name(function NodeError(...parameters) {
2633
+ const limit = Error.stackTraceLimit;
2634
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
2635
+ const error = new Base();
2636
+ if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
2637
+ const message = getMessage(key, parameters, error);
2638
+ Object.defineProperties(error, {
2639
+ // Note: no need to implement `kIsNodeError` symbol, would be hard,
2640
+ // probably.
2641
+ message: {
2642
+ value: message,
2643
+ enumerable: false,
2644
+ writable: true,
2645
+ configurable: true
2646
+ },
2647
+ toString: {
2648
+ /** @this {Error} */
2649
+ value() {
2650
+ return `${this.name} [${key}]: ${this.message}`;
2651
+ },
2652
+ enumerable: false,
2653
+ writable: true,
2654
+ configurable: true
2655
+ }
2656
+ });
2657
+ captureLargerStackTrace(error);
2658
+ error.code = key;
2659
+ return error;
2660
+ }, "NodeError");
2661
+ }
2662
+ __name(makeNodeErrorWithCode, "makeNodeErrorWithCode");
2663
+ function isErrorStackTraceLimitWritable() {
2664
+ try {
2665
+ if (v8.startupSnapshot.isBuildingSnapshot()) {
2666
+ return false;
2667
+ }
2668
+ } catch {
2669
+ }
2670
+ const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
2671
+ if (desc === void 0) {
2672
+ return Object.isExtensible(Error);
2673
+ }
2674
+ return own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
2675
+ }
2676
+ __name(isErrorStackTraceLimitWritable, "isErrorStackTraceLimitWritable");
2677
+ function hideStackFrames(wrappedFunction) {
2678
+ const hidden = nodeInternalPrefix + wrappedFunction.name;
2679
+ Object.defineProperty(wrappedFunction, "name", { value: hidden });
2680
+ return wrappedFunction;
2681
+ }
2682
+ __name(hideStackFrames, "hideStackFrames");
2683
+ var captureLargerStackTrace = hideStackFrames(function(error) {
2684
+ const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
2685
+ if (stackTraceLimitIsWritable) {
2686
+ userStackTraceLimit = Error.stackTraceLimit;
2687
+ Error.stackTraceLimit = Number.POSITIVE_INFINITY;
2688
+ }
2689
+ Error.captureStackTrace(error);
2690
+ if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
2691
+ return error;
2692
+ });
2693
+ function getMessage(key, parameters, self) {
2694
+ const message = messages.get(key);
2695
+ assert(message !== void 0, "expected `message` to be found");
2696
+ if (typeof message === "function") {
2697
+ assert(
2698
+ message.length <= parameters.length,
2699
+ // Default options do not count.
2700
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
2701
+ );
2702
+ return Reflect.apply(message, self, parameters);
2703
+ }
2704
+ const regex = /%[dfijoOs]/g;
2705
+ let expectedLength = 0;
2706
+ while (regex.exec(message) !== null) expectedLength++;
2707
+ assert(
2708
+ expectedLength === parameters.length,
2709
+ `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
2710
+ );
2711
+ if (parameters.length === 0) return message;
2712
+ parameters.unshift(message);
2713
+ return Reflect.apply(format, null, parameters);
2714
+ }
2715
+ __name(getMessage, "getMessage");
2716
+ function determineSpecificType(value) {
2717
+ if (value === null || value === void 0) {
2718
+ return String(value);
2719
+ }
2720
+ if (typeof value === "function" && value.name) {
2721
+ return `function ${value.name}`;
2722
+ }
2723
+ if (typeof value === "object") {
2724
+ if (value.constructor && value.constructor.name) {
2725
+ return `an instance of ${value.constructor.name}`;
2726
+ }
2727
+ return `${inspect(value, { depth: -1 })}`;
2728
+ }
2729
+ let inspected = inspect(value, { colors: false });
2730
+ if (inspected.length > 28) {
2731
+ inspected = `${inspected.slice(0, 25)}...`;
2732
+ }
2733
+ return `type ${typeof value} (${inspected})`;
2734
+ }
2735
+ __name(determineSpecificType, "determineSpecificType");
2736
+ createError(
2737
+ "ERR_INVALID_ARG_TYPE",
2738
+ (name, expected, actual) => {
2739
+ assert(typeof name === "string", "'name' must be a string");
2740
+ if (!Array.isArray(expected)) {
2741
+ expected = [expected];
2742
+ }
2743
+ let message = "The ";
2744
+ if (name.endsWith(" argument")) {
2745
+ message += `${name} `;
2746
+ } else {
2747
+ const type = name.includes(".") ? "property" : "argument";
2748
+ message += `"${name}" ${type} `;
2749
+ }
2750
+ message += "must be ";
2751
+ const types = [];
2752
+ const instances = [];
2753
+ const other = [];
2754
+ for (const value of expected) {
2755
+ assert(
2756
+ typeof value === "string",
2757
+ "All expected entries have to be of type string"
2758
+ );
2759
+ if (kTypes.has(value)) {
2760
+ types.push(value.toLowerCase());
2761
+ } else if (classRegExp.exec(value) === null) {
2762
+ assert(
2763
+ value !== "object",
2764
+ 'The value "object" should be written as "Object"'
2765
+ );
2766
+ other.push(value);
2767
+ } else {
2768
+ instances.push(value);
2769
+ }
2770
+ }
2771
+ if (instances.length > 0) {
2772
+ const pos = types.indexOf("object");
2773
+ if (pos !== -1) {
2774
+ types.slice(pos, 1);
2775
+ instances.push("Object");
2776
+ }
2777
+ }
2778
+ if (types.length > 0) {
2779
+ message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
2780
+ types,
2781
+ "or"
2782
+ )}`;
2783
+ if (instances.length > 0 || other.length > 0) message += " or ";
2784
+ }
2785
+ if (instances.length > 0) {
2786
+ message += `an instance of ${formatList(instances, "or")}`;
2787
+ if (other.length > 0) message += " or ";
2788
+ }
2789
+ if (other.length > 0) {
2790
+ if (other.length > 1) {
2791
+ message += `one of ${formatList(other, "or")}`;
2792
+ } else {
2793
+ if (other[0]?.toLowerCase() !== other[0]) message += "an ";
2794
+ message += `${other[0]}`;
2795
+ }
2796
+ }
2797
+ message += `. Received ${determineSpecificType(actual)}`;
2798
+ return message;
2799
+ },
2800
+ TypeError
2801
+ );
2802
+ var ERR_INVALID_MODULE_SPECIFIER = createError(
2803
+ "ERR_INVALID_MODULE_SPECIFIER",
2804
+ /**
2805
+ * @param {string} request
2806
+ * @param {string} reason
2807
+ * @param {string} [base]
2808
+ */
2809
+ (request, reason, base) => {
2810
+ return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
2811
+ },
2812
+ TypeError
2813
+ );
2814
+ var ERR_INVALID_PACKAGE_CONFIG = createError(
2815
+ "ERR_INVALID_PACKAGE_CONFIG",
2816
+ (path2, base, message) => {
2817
+ return `Invalid package config ${path2}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
2818
+ },
2819
+ Error
2820
+ );
2821
+ var ERR_INVALID_PACKAGE_TARGET = createError(
2822
+ "ERR_INVALID_PACKAGE_TARGET",
2823
+ (packagePath, key, target, isImport = false, base) => {
2824
+ const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
2825
+ if (key === ".") {
2826
+ assert(isImport === false);
2827
+ return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
2828
+ }
2829
+ return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
2830
+ target
2831
+ )} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
2832
+ },
2833
+ Error
2834
+ );
2835
+ var ERR_MODULE_NOT_FOUND = createError(
2836
+ "ERR_MODULE_NOT_FOUND",
2837
+ (path2, base, exactUrl = false) => {
2838
+ return `Cannot find ${exactUrl ? "module" : "package"} '${path2}' imported from ${base}`;
2839
+ },
2840
+ Error
2841
+ );
2842
+ createError(
2843
+ "ERR_NETWORK_IMPORT_DISALLOWED",
2844
+ "import of '%s' by %s is not supported: %s",
2845
+ Error
2846
+ );
2847
+ var ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
2848
+ "ERR_PACKAGE_IMPORT_NOT_DEFINED",
2849
+ (specifier, packagePath, base) => {
2850
+ return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
2851
+ },
2852
+ TypeError
2853
+ );
2854
+ var ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
2855
+ "ERR_PACKAGE_PATH_NOT_EXPORTED",
2856
+ /**
2857
+ * @param {string} packagePath
2858
+ * @param {string} subpath
2859
+ * @param {string} [base]
2860
+ */
2861
+ (packagePath, subpath, base) => {
2862
+ if (subpath === ".")
2863
+ return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
2864
+ return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
2865
+ },
2866
+ Error
2867
+ );
2868
+ var ERR_UNSUPPORTED_DIR_IMPORT = createError(
2869
+ "ERR_UNSUPPORTED_DIR_IMPORT",
2870
+ "Directory import '%s' is not supported resolving ES modules imported from %s",
2871
+ Error
2872
+ );
2873
+ var ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
2874
+ "ERR_UNSUPPORTED_RESOLVE_REQUEST",
2875
+ 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
2876
+ TypeError
2877
+ );
2878
+ var ERR_UNKNOWN_FILE_EXTENSION = createError(
2879
+ "ERR_UNKNOWN_FILE_EXTENSION",
2880
+ (extension, path2) => {
2881
+ return `Unknown file extension "${extension}" for ${path2}`;
2882
+ },
2883
+ TypeError
2884
+ );
2885
+ createError(
2886
+ "ERR_INVALID_ARG_VALUE",
2887
+ (name, value, reason = "is invalid") => {
2888
+ let inspected = inspect(value);
2889
+ if (inspected.length > 128) {
2890
+ inspected = `${inspected.slice(0, 128)}...`;
2891
+ }
2892
+ const type = name.includes(".") ? "property" : "argument";
2893
+ return `The ${type} '${name}' ${reason}. Received ${inspected}`;
2894
+ },
2895
+ TypeError
2896
+ // Note: extra classes have been shaken out.
2897
+ // , RangeError
2898
+ );
2899
+ var hasOwnProperty$1 = {}.hasOwnProperty;
2900
+ var hasOwnProperty = {}.hasOwnProperty;
2901
+ var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
2902
+ var own = {}.hasOwnProperty;
2903
+ var isWindows = (() => process.platform === "win32")();
2904
+ var globalCache = (() => (
2905
+ // eslint-disable-next-line unicorn/no-unreadable-iife
2906
+ globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map()
2907
+ ))();
2908
+
2909
+ // ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
2910
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
2911
+ function normalizeWindowsPath(input = "") {
2912
+ if (!input) {
2913
+ return input;
2914
+ }
2915
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
2916
+ }
2917
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
2918
+ var _UNC_REGEX = /^[/\\]{2}/;
2919
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
2920
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
2921
+ var normalize = /* @__PURE__ */ __name(function(path2) {
2922
+ if (path2.length === 0) {
2923
+ return ".";
2924
+ }
2925
+ path2 = normalizeWindowsPath(path2);
2926
+ const isUNCPath = path2.match(_UNC_REGEX);
2927
+ const isPathAbsolute = isAbsolute(path2);
2928
+ const trailingSeparator = path2[path2.length - 1] === "/";
2929
+ path2 = normalizeString(path2, !isPathAbsolute);
2930
+ if (path2.length === 0) {
2931
+ if (isPathAbsolute) {
2932
+ return "/";
2933
+ }
2934
+ return trailingSeparator ? "./" : ".";
2935
+ }
2936
+ if (trailingSeparator) {
2937
+ path2 += "/";
2938
+ }
2939
+ if (_DRIVE_LETTER_RE.test(path2)) {
2940
+ path2 += "/";
2941
+ }
2942
+ if (isUNCPath) {
2943
+ if (!isPathAbsolute) {
2944
+ return `//./${path2}`;
2945
+ }
2946
+ return `//${path2}`;
2947
+ }
2948
+ return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
2949
+ }, "normalize");
2950
+ var join = /* @__PURE__ */ __name(function(...arguments_) {
2951
+ if (arguments_.length === 0) {
2952
+ return ".";
2953
+ }
2954
+ let joined;
2955
+ for (const argument of arguments_) {
2956
+ if (argument && argument.length > 0) {
2957
+ if (joined === void 0) {
2958
+ joined = argument;
2959
+ } else {
2960
+ joined += `/${argument}`;
2961
+ }
2962
+ }
2963
+ }
2964
+ if (joined === void 0) {
2965
+ return ".";
2966
+ }
2967
+ return normalize(joined.replace(/\/\/+/g, "/"));
2968
+ }, "join");
2969
+ function normalizeString(path2, allowAboveRoot) {
2970
+ let res = "";
2971
+ let lastSegmentLength = 0;
2972
+ let lastSlash = -1;
2973
+ let dots = 0;
2974
+ let char = null;
2975
+ for (let index = 0; index <= path2.length; ++index) {
2976
+ if (index < path2.length) {
2977
+ char = path2[index];
2978
+ } else if (char === "/") {
2979
+ break;
2980
+ } else {
2981
+ char = "/";
2982
+ }
2983
+ if (char === "/") {
2984
+ if (lastSlash === index - 1 || dots === 1) ;
2985
+ else if (dots === 2) {
2986
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2987
+ if (res.length > 2) {
2988
+ const lastSlashIndex = res.lastIndexOf("/");
2989
+ if (lastSlashIndex === -1) {
2990
+ res = "";
2991
+ lastSegmentLength = 0;
2992
+ } else {
2993
+ res = res.slice(0, lastSlashIndex);
2994
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2995
+ }
2996
+ lastSlash = index;
2997
+ dots = 0;
2998
+ continue;
2999
+ } else if (res.length > 0) {
3000
+ res = "";
3001
+ lastSegmentLength = 0;
3002
+ lastSlash = index;
3003
+ dots = 0;
3004
+ continue;
3005
+ }
3006
+ }
3007
+ if (allowAboveRoot) {
3008
+ res += res.length > 0 ? "/.." : "..";
3009
+ lastSegmentLength = 2;
3010
+ }
3011
+ } else {
3012
+ if (res.length > 0) {
3013
+ res += `/${path2.slice(lastSlash + 1, index)}`;
3014
+ } else {
3015
+ res = path2.slice(lastSlash + 1, index);
3016
+ }
3017
+ lastSegmentLength = index - lastSlash - 1;
3018
+ }
3019
+ lastSlash = index;
3020
+ dots = 0;
3021
+ } else if (char === "." && dots !== -1) {
3022
+ ++dots;
3023
+ } else {
3024
+ dots = -1;
3025
+ }
3026
+ }
3027
+ return res;
3028
+ }
3029
+ __name(normalizeString, "normalizeString");
3030
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
3031
+ return _IS_ABSOLUTE_RE.test(p);
3032
+ }, "isAbsolute");
3033
+ var dirname = /* @__PURE__ */ __name(function(p) {
3034
+ const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
3035
+ if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
3036
+ segments[0] += "/";
3037
+ }
3038
+ return segments.join("/") || (isAbsolute(p) ? "/" : ".");
3039
+ }, "dirname");
3040
+
3041
+ // ../../core/src/shared/utils/module.ts
3042
+ var importMetaResolve = /* @__PURE__ */ __name((...args) => {
3043
+ if (typeof import.meta.resolve !== "function" && process.env.VITEST === "true") {
3044
+ console.warn(
3045
+ "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"
3046
+ );
3047
+ return pathToFileURL(args[0]).href;
3048
+ }
3049
+ return import.meta.resolve(...args);
3050
+ }, "importMetaResolve");
3051
+ var resolvePackageDir = /* @__PURE__ */ __name((pkg, parent) => {
3052
+ return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
3053
+ }, "resolvePackageDir");
3054
+
3055
+ // src/utils.ts
3056
+ var getNextjsVersion = /* @__PURE__ */ __name(() => JSON.parse(readFileSync(join2(resolvePackageDir("next"), "package.json"), "utf8")).version, "getNextjsVersion");
3057
+
3058
+ // src/preset.ts
672
3059
  var require2 = createRequire(import.meta.url);
673
3060
  var vitePluginStorybookNextjs = require2("vite-plugin-storybook-nextjs");
674
3061
  var core = /* @__PURE__ */ __name(async (config, options) => {
@@ -676,17 +3063,25 @@ var core = /* @__PURE__ */ __name(async (config, options) => {
676
3063
  return {
677
3064
  ...config,
678
3065
  builder: {
679
- name: fileURLToPath(import.meta.resolve("@storybook/builder-vite")),
3066
+ name: fileURLToPath2(import.meta.resolve("@storybook/builder-vite")),
680
3067
  options: {
681
3068
  ...typeof framework === "string" ? {} : framework.options.builder || {}
682
3069
  }
683
3070
  },
684
- renderer: fileURLToPath(import.meta.resolve("@storybook/react/preset"))
3071
+ renderer: fileURLToPath2(import.meta.resolve("@storybook/react/preset"))
685
3072
  };
686
3073
  }, "core");
687
3074
  var previewAnnotations = /* @__PURE__ */ __name((entry = []) => {
688
- const result = [...entry, fileURLToPath(import.meta.resolve("@storybook/nextjs-vite/preview"))];
689
- return result;
3075
+ const annotations = [
3076
+ ...entry,
3077
+ fileURLToPath2(import.meta.resolve("@storybook/nextjs-vite/preview"))
3078
+ ];
3079
+ const nextjsVersion = getNextjsVersion();
3080
+ const isNext16orNewer = import_semver.default.gte(nextjsVersion, "16.0.0");
3081
+ if (!isNext16orNewer) {
3082
+ annotations.push(fileURLToPath2(import.meta.resolve("@storybook/nextjs-vite/config/preview")));
3083
+ }
3084
+ return annotations;
690
3085
  }, "previewAnnotations");
691
3086
  var optimizeViteDeps = [
692
3087
  "@storybook/nextjs-vite/navigation.mock",
@@ -708,16 +3103,16 @@ var viteFinal = /* @__PURE__ */ __name(async (config, options) => {
708
3103
  }
709
3104
  }
710
3105
  const { nextConfigPath } = await options.presets.apply("frameworkOptions");
711
- const nextDir = nextConfigPath ? dirname(nextConfigPath) : void 0;
3106
+ const nextDir = nextConfigPath ? dirname2(nextConfigPath) : void 0;
712
3107
  return {
713
3108
  ...reactConfig,
714
3109
  resolve: {
715
3110
  ...reactConfig?.resolve ?? {},
716
3111
  alias: {
717
3112
  ...reactConfig?.resolve?.alias ?? {},
718
- "styled-jsx": dirname(fileURLToPath(import.meta.resolve("styled-jsx/package.json"))),
719
- "styled-jsx/style": fileURLToPath(import.meta.resolve("styled-jsx/style")),
720
- "styled-jsx/style.js": fileURLToPath(import.meta.resolve("styled-jsx/style"))
3113
+ "styled-jsx": dirname2(fileURLToPath2(import.meta.resolve("styled-jsx/package.json"))),
3114
+ "styled-jsx/style": fileURLToPath2(import.meta.resolve("styled-jsx/style")),
3115
+ "styled-jsx/style.js": fileURLToPath2(import.meta.resolve("styled-jsx/style"))
721
3116
  }
722
3117
  },
723
3118
  plugins: [...reactConfig?.plugins ?? [], vitePluginStorybookNextjs({ dir: nextDir })]