"use strict";
var Te = Object.create;
var A = Object.defineProperty;
var xe = Object.getOwnPropertyDescriptor;
var _e = Object.getOwnPropertyNames;
var Me = Object.getPrototypeOf, Ie = Object.prototype.hasOwnProperty;
var n = (o, e) => A(o, "name", { value: e, configurable: !0 });
var Se = (o, e) => () => (e || o((e = { exports: {} }).exports, e), e.exports), we = (o, e) => {
  for (var t in e)
    A(o, t, { get: e[t], enumerable: !0 });
}, le = (o, e, t, r) => {
  if (e && typeof e == "object" || typeof e == "function")
    for (let a of _e(e))
      !Ie.call(o, a) && a !== t && A(o, a, { get: () => e[a], enumerable: !(r = xe(e, a)) || r.enumerable });
  return o;
};
var x = (o, e, t) => (t = o != null ? Te(Me(o)) : {}, le(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  e || !o || !o.__esModule ? A(t, "default", { value: o, enumerable: !0 }) : t,
  o
)), ve = (o) => le(A({}, "__esModule", { value: !0 }), o);

// ../node_modules/ts-dedent/dist/index.js
var Oe = Se((T) => {
  "use strict";
  Object.defineProperty(T, "__esModule", { value: !0 });
  T.dedent = void 0;
  function Re(o) {
    for (var e = [], t = 1; t < arguments.length; t++)
      e[t - 1] = arguments[t];
    var r = Array.from(typeof o == "string" ? [o] : o);
    r[r.length - 1] = r[r.length - 1].replace(/\r?\n([\t ]*)$/, "");
    var a = r.reduce(function(y, S) {
      var O = S.match(/\n([\t ]+|(?!\s).)/g);
      return O ? y.concat(O.map(function(w) {
        var b, g;
        return (g = (b = w.match(/[\t ]/g)) === null || b === void 0 ? void 0 : b.length) !== null && g !== void 0 ? g : 0;
      })) : y;
    }, []);
    if (a.length) {
      var u = new RegExp(`
[	 ]{` + Math.min.apply(Math, a) + "}", "g");
      r = r.map(function(y) {
        return y.replace(u, `
`);
      });
    }
    r[0] = r[0].replace(/^\r?\n/, "");
    var p = r[0];
    return e.forEach(function(y, S) {
      var O = p.match(/(?:^|\n)( *)$/), w = O ? O[1] : "", b = y;
      typeof y == "string" && y.includes(`
`) && (b = String(y).split(`
`).map(function(g, Ce) {
        return Ce === 0 ? g : "" + w + g;
      }).join(`
`)), p += b + r[S + 1];
    }), p;
  }
  n(Re, "dedent");
  T.dedent = Re;
  T.default = Re;
});

// src/server-errors.ts
var He = {};
we(He, {
  AngularLegacyBuildOptionsError: () => Y,
  Category: () => ke,
  ConflictingStaticDirConfigError: () => j,
  CouldNotEvaluateFrameworkError: () => P,
  CriticalPresetLoadError: () => H,
  FindPackageVersionsError: () => ie,
  GenerateNewProjectOnInitError: () => oe,
  GoogleFontsDownloadError: () => z,
  GoogleFontsLoadingError: () => J,
  InvalidFrameworkNameError: () => F,
  InvalidStoriesEntryError: () => V,
  MainFileESMOnlyImportError: () => Q,
  MainFileEvaluationError: () => ee,
  MainFileMissingError: () => Z,
  MissingAngularJsonError: () => U,
  MissingBuilderError: () => X,
  MissingFrameworkFieldError: () => K,
  NoMatchingExportError: () => q,
  NoStatsForViteDevError: () => se,
  NxProjectDetectedError: () => W,
  UpgradeStorybookInWrongWorkingDirectory: () => ae,
  UpgradeStorybookToLowerVersionError: () => te,
  UpgradeStorybookToSameVersionError: () => re,
  UpgradeStorybookUnknownCurrentVersionError: () => ne,
  WebpackCompilationError: () => G,
  WebpackInvocationError: () => D,
  WebpackMissingStatsError: () => $
});
module.exports = ve(He);

// node_modules/chalk/source/vendor/ansi-styles/index.js
var ce = /* @__PURE__ */ n((o = 0) => (e) => `\x1B[${e + o}m`, "wrapAnsi16"), ue = /* @__PURE__ */ n((o = 0) => (e) => `\x1B[${38 + o};5;${e}\
m`, "wrapAnsi256"), de = /* @__PURE__ */ n((o = 0) => (e, t, r) => `\x1B[${38 + o};2;${e};${t};${r}m`, "wrapAnsi16m"), c = {
  modifier: {
    reset: [0, 0],
    // 21 isn't widely supported and 22 does the same thing
    bold: [1, 22],
    dim: [2, 22],
    italic: [3, 23],
    underline: [4, 24],
    overline: [53, 55],
    inverse: [7, 27],
    hidden: [8, 28],
    strikethrough: [9, 29]
  },
  color: {
    black: [30, 39],
    red: [31, 39],
    green: [32, 39],
    yellow: [33, 39],
    blue: [34, 39],
    magenta: [35, 39],
    cyan: [36, 39],
    white: [37, 39],
    // Bright color
    blackBright: [90, 39],
    gray: [90, 39],
    // Alias of `blackBright`
    grey: [90, 39],
    // Alias of `blackBright`
    redBright: [91, 39],
    greenBright: [92, 39],
    yellowBright: [93, 39],
    blueBright: [94, 39],
    magentaBright: [95, 39],
    cyanBright: [96, 39],
    whiteBright: [97, 39]
  },
  bgColor: {
    bgBlack: [40, 49],
    bgRed: [41, 49],
    bgGreen: [42, 49],
    bgYellow: [43, 49],
    bgBlue: [44, 49],
    bgMagenta: [45, 49],
    bgCyan: [46, 49],
    bgWhite: [47, 49],
    // Bright color
    bgBlackBright: [100, 49],
    bgGray: [100, 49],
    // Alias of `bgBlackBright`
    bgGrey: [100, 49],
    // Alias of `bgBlackBright`
    bgRedBright: [101, 49],
    bgGreenBright: [102, 49],
    bgYellowBright: [103, 49],
    bgBlueBright: [104, 49],
    bgMagentaBright: [105, 49],
    bgCyanBright: [106, 49],
    bgWhiteBright: [107, 49]
  }
}, ze = Object.keys(c.modifier), Ne = Object.keys(c.color), Le = Object.keys(c.bgColor), Je = [...Ne, ...Le];
function Be() {
  let o = /* @__PURE__ */ new Map();
  for (let [e, t] of Object.entries(c)) {
    for (let [r, a] of Object.entries(t))
      c[r] = {
        open: `\x1B[${a[0]}m`,
        close: `\x1B[${a[1]}m`
      }, t[r] = c[r], o.set(a[0], a[1]);
    Object.defineProperty(c, e, {
      value: t,
      enumerable: !1
    });
  }
  return Object.defineProperty(c, "codes", {
    value: o,
    enumerable: !1
  }), c.color.close = "\x1B[39m", c.bgColor.close = "\x1B[49m", c.color.ansi = ce(), c.color.ansi256 = ue(), c.color.ansi16m = de(), c.bgColor.
  ansi = ce(10), c.bgColor.ansi256 = ue(10), c.bgColor.ansi16m = de(10), Object.defineProperties(c, {
    rgbToAnsi256: {
      value(e, t, r) {
        return e === t && t === r ? e < 8 ? 16 : e > 248 ? 231 : Math.round((e - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(e / 255 * 5) + 6 *
        Math.round(t / 255 * 5) + Math.round(r / 255 * 5);
      },
      enumerable: !1
    },
    hexToRgb: {
      value(e) {
        let t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));
        if (!t)
          return [0, 0, 0];
        let [r] = t;
        r.length === 3 && (r = [...r].map((u) => u + u).join(""));
        let a = Number.parseInt(r, 16);
        return [
          /* eslint-disable no-bitwise */
          a >> 16 & 255,
          a >> 8 & 255,
          a & 255
          /* eslint-enable no-bitwise */
        ];
      },
      enumerable: !1
    },
    hexToAnsi256: {
      value: /* @__PURE__ */ n((e) => c.rgbToAnsi256(...c.hexToRgb(e)), "value"),
      enumerable: !1
    },
    ansi256ToAnsi: {
      value(e) {
        if (e < 8)
          return 30 + e;
        if (e < 16)
          return 90 + (e - 8);
        let t, r, a;
        if (e >= 232)
          t = ((e - 232) * 10 + 8) / 255, r = t, a = t;
        else {
          e -= 16;
          let y = e % 36;
          t = Math.floor(e / 36) / 5, r = Math.floor(y / 6) / 5, a = y % 6 / 5;
        }
        let u = Math.max(t, r, a) * 2;
        if (u === 0)
          return 30;
        let p = 30 + (Math.round(a) << 2 | Math.round(r) << 1 | Math.round(t));
        return u === 2 && (p += 60), p;
      },
      enumerable: !1
    },
    rgbToAnsi: {
      value: /* @__PURE__ */ n((e, t, r) => c.ansi256ToAnsi(c.rgbToAnsi256(e, t, r)), "value"),
      enumerable: !1
    },
    hexToAnsi: {
      value: /* @__PURE__ */ n((e) => c.ansi256ToAnsi(c.hexToAnsi256(e)), "value"),
      enumerable: !1
    }
  }), c;
}
n(Be, "assembleStyles");
var We = Be(), m = We;

// node_modules/chalk/source/vendor/supports-color/index.js
var M = x(require("node:process"), 1), ye = x(require("node:os"), 1), v = x(require("node:tty"), 1);
function h(o, e = globalThis.Deno ? globalThis.Deno.args : M.default.argv) {
  let t = o.startsWith("-") ? "" : o.length === 1 ? "-" : "--", r = e.indexOf(t + o), a = e.indexOf("--");
  return r !== -1 && (a === -1 || r < a);
}
n(h, "hasFlag");
var { env: d } = M.default, _;
h("no-color") || h("no-colors") || h("color=false") || h("color=never") ? _ = 0 : (h("color") || h("colors") || h("color=true") || h("color=\
always")) && (_ = 1);
function Ke() {
  if ("FORCE_COLOR" in d)
    return d.FORCE_COLOR === "true" ? 1 : d.FORCE_COLOR === "false" ? 0 : d.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(d.FORCE_COLOR,
    10), 3);
}
n(Ke, "envForceColor");
function Fe(o) {
  return o === 0 ? !1 : {
    level: o,
    hasBasic: !0,
    has256: o >= 2,
    has16m: o >= 3
  };
}
n(Fe, "translateLevel");
function Pe(o, { streamIsTTY: e, sniffFlags: t = !0 } = {}) {
  let r = Ke();
  r !== void 0 && (_ = r);
  let a = t ? _ : r;
  if (a === 0)
    return 0;
  if (t) {
    if (h("color=16m") || h("color=full") || h("color=truecolor"))
      return 3;
    if (h("color=256"))
      return 2;
  }
  if ("TF_BUILD" in d && "AGENT_NAME" in d)
    return 1;
  if (o && !e && a === void 0)
    return 0;
  let u = a || 0;
  if (d.TERM === "dumb")
    return u;
  if (M.default.platform === "win32") {
    let p = ye.default.release().split(".");
    return Number(p[0]) >= 10 && Number(p[2]) >= 10586 ? Number(p[2]) >= 14931 ? 3 : 2 : 1;
  }
  if ("CI" in d)
    return "GITHUB_ACTIONS" in d || "GITEA_ACTIONS" in d ? 3 : ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((p) => p in
    d) || d.CI_NAME === "codeship" ? 1 : u;
  if ("TEAMCITY_VERSION" in d)
    return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(d.TEAMCITY_VERSION) ? 1 : 0;
  if (d.COLORTERM === "truecolor" || d.TERM === "xterm-kitty")
    return 3;
  if ("TERM_PROGRAM" in d) {
    let p = Number.parseInt((d.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
    switch (d.TERM_PROGRAM) {
      case "iTerm.app":
        return p >= 3 ? 3 : 2;
      case "Apple_Terminal":
        return 2;
    }
  }
  return /-256(color)?$/i.test(d.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(d.TERM) || "COLORTERM" in d ?
  1 : u;
}
n(Pe, "_supportsColor");
function pe(o, e = {}) {
  let t = Pe(o, {
    streamIsTTY: o && o.isTTY,
    ...e
  });
  return Fe(t);
}
n(pe, "createSupportsColor");
var je = {
  stdout: pe({ isTTY: v.default.isatty(1) }),
  stderr: pe({ isTTY: v.default.isatty(2) })
}, he = je;

// node_modules/chalk/source/utilities.js
function fe(o, e, t) {
  let r = o.indexOf(e);
  if (r === -1)
    return o;
  let a = e.length, u = 0, p = "";
  do
    p += o.slice(u, r) + e + t, u = r + a, r = o.indexOf(e, u);
  while (r !== -1);
  return p += o.slice(u), p;
}
n(fe, "stringReplaceAll");
function me(o, e, t, r) {
  let a = 0, u = "";
  do {
    let p = o[r - 1] === "\r";
    u += o.slice(a, p ? r - 1 : r) + e + (p ? `\r
` : `
`) + t, a = r + 1, r = o.indexOf(`
`, a);
  } while (r !== -1);
  return u += o.slice(a), u;
}
n(me, "stringEncaseCRLFWithFirstIndex");

// node_modules/chalk/source/index.js
var { stdout: be, stderr: ge } = he, N = Symbol("GENERATOR"), E = Symbol("STYLER"), k = Symbol("IS_EMPTY"), Ee = [
  "ansi",
  "ansi",
  "ansi256",
  "ansi16m"
], R = /* @__PURE__ */ Object.create(null), Ve = /* @__PURE__ */ n((o, e = {}) => {
  if (e.level && !(Number.isInteger(e.level) && e.level >= 0 && e.level <= 3))
    throw new Error("The `level` option should be an integer from 0 to 3");
  let t = be ? be.level : 0;
  o.level = e.level === void 0 ? t : e.level;
}, "applyOptions");
var $e = /* @__PURE__ */ n((o) => {
  let e = /* @__PURE__ */ n((...t) => t.join(" "), "chalk");
  return Ve(e, o), Object.setPrototypeOf(e, C.prototype), e;
}, "chalkFactory");
function C(o) {
  return $e(o);
}
n(C, "createChalk");
Object.setPrototypeOf(C.prototype, Function.prototype);
for (let [o, e] of Object.entries(m))
  R[o] = {
    get() {
      let t = I(this, B(e.open, e.close, this[E]), this[k]);
      return Object.defineProperty(this, o, { value: t }), t;
    }
  };
R.visible = {
  get() {
    let o = I(this, this[E], !0);
    return Object.defineProperty(this, "visible", { value: o }), o;
  }
};
var L = /* @__PURE__ */ n((o, e, t, ...r) => o === "rgb" ? e === "ansi16m" ? m[t].ansi16m(...r) : e === "ansi256" ? m[t].ansi256(m.rgbToAnsi256(
...r)) : m[t].ansi(m.rgbToAnsi(...r)) : o === "hex" ? L("rgb", e, t, ...m.hexToRgb(...r)) : m[t][o](...r), "getModelAnsi"), De = ["rgb", "he\
x", "ansi256"];
for (let o of De) {
  R[o] = {
    get() {
      let { level: t } = this;
      return function(...r) {
        let a = B(L(o, Ee[t], "color", ...r), m.color.close, this[E]);
        return I(this, a, this[k]);
      };
    }
  };
  let e = "bg" + o[0].toUpperCase() + o.slice(1);
  R[e] = {
    get() {
      let { level: t } = this;
      return function(...r) {
        let a = B(L(o, Ee[t], "bgColor", ...r), m.bgColor.close, this[E]);
        return I(this, a, this[k]);
      };
    }
  };
}
var Ge = Object.defineProperties(() => {
}, {
  ...R,
  level: {
    enumerable: !0,
    get() {
      return this[N].level;
    },
    set(o) {
      this[N].level = o;
    }
  }
}), B = /* @__PURE__ */ n((o, e, t) => {
  let r, a;
  return t === void 0 ? (r = o, a = e) : (r = t.openAll + o, a = e + t.closeAll), {
    open: o,
    close: e,
    openAll: r,
    closeAll: a,
    parent: t
  };
}, "createStyler"), I = /* @__PURE__ */ n((o, e, t) => {
  let r = /* @__PURE__ */ n((...a) => Ue(r, a.length === 1 ? "" + a[0] : a.join(" ")), "builder");
  return Object.setPrototypeOf(r, Ge), r[N] = o, r[E] = e, r[k] = t, r;
}, "createBuilder"), Ue = /* @__PURE__ */ n((o, e) => {
  if (o.level <= 0 || !e)
    return o[k] ? "" : e;
  let t = o[E];
  if (t === void 0)
    return e;
  let { openAll: r, closeAll: a } = t;
  if (e.includes("\x1B"))
    for (; t !== void 0; )
      e = fe(e, t.close, t.open), t = t.parent;
  let u = e.indexOf(`
`);
  return u !== -1 && (e = me(e, a, r, u)), r + e + a;
}, "applyStyle");
Object.defineProperties(C.prototype, R);
var Ye = C(), so = C({ level: ge ? ge.level : 0 });
var f = Ye;

// src/server-errors.ts
var l = x(Oe(), 1);

// src/storybook-error.ts
var i = class extends Error {
  static {
    n(this, "StorybookError");
  }
  /**
   * Data associated with the error. Used to provide additional information in the error message or to be passed to telemetry.
   */
  data = {};
  /**
   * Specifies the documentation for the error.
   * - If `true`, links to a documentation page on the Storybook website (make sure it exists before enabling).
   * - If a string, uses the provided URL for documentation (external or FAQ links).
   * - If `false` (default), no documentation link is added.
   */
  documentation = !1;
  /**
   * Flag used to easily determine if the error originates from Storybook.
   */
  fromStorybook = !0;
  get fullErrorCode() {
    let e = String(this.code).padStart(4, "0");
    return `SB_${this.category}_${e}`;
  }
  /**
   * Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>.
   */
  get name() {
    let e = this.constructor.name;
    return `${this.fullErrorCode} (${e})`;
  }
  /**
   * Generates the error message along with additional documentation link (if applicable).
   */
  get message() {
    let e;
    return this.documentation === !0 ? e = `https://storybook.js.org/error/${this.fullErrorCode}` : typeof this.documentation == "string" ? e =
    this.documentation : Array.isArray(this.documentation) && (e = `
${this.documentation.map((t) => `	- ${t}`).join(`
`)}`), `${this.template()}${e != null ? `

More info: ${e}
` : ""}`;
  }
};

// src/server-errors.ts
var ke = /* @__PURE__ */ ((s) => (s.CLI = "CLI", s.CLI_INIT = "CLI_INIT", s.CLI_AUTOMIGRATE = "CLI_AUTOMIGRATE", s.CLI_UPGRADE = "CLI_UPGRAD\
E", s.CLI_ADD = "CLI_ADD", s.CODEMOD = "CODEMOD", s.CORE_SERVER = "CORE-SERVER", s.CSF_PLUGIN = "CSF-PLUGIN", s.CSF_TOOLS = "CSF-TOOLS", s.CORE_COMMON =
"CORE-COMMON", s.NODE_LOGGER = "NODE-LOGGER", s.TELEMETRY = "TELEMETRY", s.BUILDER_MANAGER = "BUILDER-MANAGER", s.BUILDER_VITE = "BUILDER-VI\
TE", s.BUILDER_WEBPACK5 = "BUILDER-WEBPACK5", s.SOURCE_LOADER = "SOURCE-LOADER", s.POSTINSTALL = "POSTINSTALL", s.DOCS_TOOLS = "DOCS-TOOLS",
s.CORE_WEBPACK = "CORE-WEBPACK", s.FRAMEWORK_ANGULAR = "FRAMEWORK_ANGULAR", s.FRAMEWORK_EMBER = "FRAMEWORK_EMBER", s.FRAMEWORK_HTML_VITE = "\
FRAMEWORK_HTML-VITE", s.FRAMEWORK_HTML_WEBPACK5 = "FRAMEWORK_HTML-WEBPACK5", s.FRAMEWORK_NEXTJS = "FRAMEWORK_NEXTJS", s.FRAMEWORK_PREACT_VITE =
"FRAMEWORK_PREACT-VITE", s.FRAMEWORK_PREACT_WEBPACK5 = "FRAMEWORK_PREACT-WEBPACK5", s.FRAMEWORK_REACT_VITE = "FRAMEWORK_REACT-VITE", s.FRAMEWORK_REACT_WEBPACK5 =
"FRAMEWORK_REACT-WEBPACK5", s.FRAMEWORK_SERVER_WEBPACK5 = "FRAMEWORK_SERVER-WEBPACK5", s.FRAMEWORK_SVELTE_VITE = "FRAMEWORK_SVELTE-VITE", s.
FRAMEWORK_SVELTE_WEBPACK5 = "FRAMEWORK_SVELTE-WEBPACK5", s.FRAMEWORK_SVELTEKIT = "FRAMEWORK_SVELTEKIT", s.FRAMEWORK_VUE_VITE = "FRAMEWORK_VU\
E-VITE", s.FRAMEWORK_VUE_WEBPACK5 = "FRAMEWORK_VUE-WEBPACK5", s.FRAMEWORK_VUE3_VITE = "FRAMEWORK_VUE3-VITE", s.FRAMEWORK_VUE3_WEBPACK5 = "FR\
AMEWORK_VUE3-WEBPACK5", s.FRAMEWORK_WEB_COMPONENTS_VITE = "FRAMEWORK_WEB-COMPONENTS-VITE", s.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_\
WEB-COMPONENTS-WEBPACK5", s))(ke || {}), W = class extends i {
  static {
    n(this, "NxProjectDetectedError");
  }
  category = "CLI_INIT";
  code = 1;
  documentation = "https://nx.dev/packages/storybook";
  template() {
    return l.dedent`
      We have detected Nx in your project. Nx has its own Storybook initializer, so please use it instead.
      Run "nx g @nx/storybook:configuration" to add Storybook to your project.
    `;
  }
}, K = class extends i {
  static {
    n(this, "MissingFrameworkFieldError");
  }
  category = "CORE-COMMON";
  code = 1;
  documentation = "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-framework-api";
  template() {
    return l.dedent`
      Could not find a 'framework' field in Storybook config.

      Please run 'npx storybook automigrate' to automatically fix your config.
    `;
  }
}, F = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "InvalidFrameworkNameError");
  }
  category = "CORE-COMMON";
  code = 2;
  documentation = "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#new-framework-api";
  template() {
    return l.dedent`
      Invalid value of '${this.data.frameworkName}' in the 'framework' field of Storybook config.

      Please run 'npx storybook automigrate' to automatically fix your config.
    `;
  }
}, P = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "CouldNotEvaluateFrameworkError");
  }
  category = "CORE-COMMON";
  code = 3;
  template() {
    return l.dedent`
      Could not evaluate the '${this.data.frameworkName}' package from the 'framework' field of Storybook config.

      Are you sure it's a valid package and is installed?
    `;
  }
}, j = class extends i {
  static {
    n(this, "ConflictingStaticDirConfigError");
  }
  category = "CORE-SERVER";
  code = 1;
  documentation = "https://storybook.js.org/docs/react/configure/images-and-assets#serving-static-files-via-storybook-configuration";
  template() {
    return l.dedent`
      Storybook encountered a conflict when trying to serve statics. You have configured both:
      * Storybook's option in the config file: 'staticDirs'
      * Storybook's (deprecated) CLI flag: '--staticDir' or '-s'
      
      Please remove the CLI flag from your storybook script and use only the 'staticDirs' option instead.
    `;
  }
}, V = class extends i {
  static {
    n(this, "InvalidStoriesEntryError");
  }
  category = "CORE-COMMON";
  code = 4;
  documentation = "https://storybook.js.org/docs/react/faq#can-i-have-a-storybook-with-no-local-stories";
  template() {
    return l.dedent`
      Storybook could not index your stories.
      Your main configuration somehow does not contain a 'stories' field, or it resolved to an empty array.

      Please check your main configuration file and make sure it exports a 'stories' field that is not an empty array.
    `;
  }
}, $ = class extends i {
  static {
    n(this, "WebpackMissingStatsError");
  }
  category = "BUILDER-WEBPACK5";
  code = 1;
  documentation = [
    "https://webpack.js.org/configuration/stats/",
    "https://storybook.js.org/docs/react/builders/webpack#configure"
  ];
  template() {
    return l.dedent`
      No Webpack stats found. Did you turn off stats reporting in your webpack config?
      Storybook needs Webpack stats (including errors) in order to build correctly.
    `;
  }
}, D = class extends i {
  constructor(t) {
    super();
    this.data = t;
    this.errorMessage = t.error.message;
  }
  static {
    n(this, "WebpackInvocationError");
  }
  category = "BUILDER-WEBPACK5";
  code = 2;
  errorMessage = "";
  template() {
    return this.errorMessage.trim();
  }
};
function Ae(o = "") {
  return o.replace(/\u001B\[[0-9;]*m/g, "");
}
n(Ae, "removeAnsiEscapeCodes");
var G = class extends i {
  constructor(t) {
    super();
    this.data = t;
    this.data.errors = t.errors.map((r) => ({
      ...r,
      message: Ae(r.message),
      stack: Ae(r.stack),
      name: r.name
    }));
  }
  static {
    n(this, "WebpackCompilationError");
  }
  category = "BUILDER-WEBPACK5";
  code = 3;
  template() {
    return l.dedent`
      There were problems when compiling your code with Webpack.
      Run Storybook with --debug-webpack for more information.
    `;
  }
}, U = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "MissingAngularJsonError");
  }
  category = "CLI_INIT";
  code = 2;
  documentation = "https://storybook.js.org/docs/angular/faq#error-no-angularjson-file-found";
  template() {
    return l.dedent`
      An angular.json file was not found in the current working directory: ${this.data.path}
      Storybook needs it to work properly, so please rerun the command at the root of your project, where the angular.json file is located.
    `;
  }
}, Y = class extends i {
  static {
    n(this, "AngularLegacyBuildOptionsError");
  }
  category = "FRAMEWORK_ANGULAR";
  code = 1;
  documentation = [
    "https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular-drop-support-for-calling-storybook-directly",
    "https://github.com/storybookjs/storybook/tree/next/code/frameworks/angular#how-do-i-migrate-to-an-angular-storybook-builder"
  ];
  template() {
    return l.dedent`
      Your Storybook startup script uses a solution that is not supported anymore.
      You must use Angular builder to have an explicit configuration on the project used in angular.json.

      Please run 'npx storybook automigrate' to automatically fix your config.
    `;
  }
}, H = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "CriticalPresetLoadError");
  }
  category = "CORE-SERVER";
  code = 2;
  template() {
    return l.dedent`
      Storybook failed to load the following preset: ${this.data.presetName}.

      Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.

      If you believe this is a bug, please open an issue on Github.

      ${this.data.error.stack || this.data.error.message}
    `;
  }
}, X = class extends i {
  static {
    n(this, "MissingBuilderError");
  }
  category = "CORE-SERVER";
  code = 3;
  documentation = "https://github.com/storybookjs/storybook/issues/24071";
  template() {
    return l.dedent`
      Storybook could not find a builder configuration for your project. 
      Builders normally come from a framework package e.g. '@storybook/react-vite', or from builder packages e.g. '@storybook/builder-vite'.
      
      - Does your main config file contain a 'framework' field configured correctly?
      - Is the Storybook framework package installed correctly?
      - If you don't use a framework, does your main config contain a 'core.builder' configured correctly?
      - Are you in a monorepo and perhaps the framework package is hoisted incorrectly?

      If you believe this is a bug, please describe your issue in detail on Github.
    `;
  }
}, z = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "GoogleFontsDownloadError");
  }
  category = "FRAMEWORK_NEXTJS";
  code = 1;
  documentation = "https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#nextjs-font-optimization";
  template() {
    return l.dedent`
      Failed to fetch \`${this.data.fontFamily}\` from Google Fonts with URL: \`${this.data.url}\`
    `;
  }
}, J = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "GoogleFontsLoadingError");
  }
  category = "FRAMEWORK_NEXTJS";
  code = 2;
  documentation = "https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#nextjs-font-optimization";
  template() {
    return l.dedent`
      An error occurred when trying to load Google Fonts with URL \`${this.data.url}\`.
      
      ${this.data.error instanceof Error ? this.data.error.message : ""}
    `;
  }
}, q = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "NoMatchingExportError");
  }
  category = "CORE-SERVER";
  code = 4;
  template() {
    return l.dedent`
      There was an exports mismatch error when trying to build Storybook.
      Please check whether the versions of your Storybook packages match whenever possible, as this might be the cause.
      
      Problematic example:
      { "@storybook/react": "7.5.3", "@storybook/react-vite": "7.4.5", "storybook": "7.3.0" }

      Correct example:
      { "@storybook/react": "7.5.3", "@storybook/react-vite": "7.5.3", "storybook": "7.5.3" }

      Please run \`npx storybook doctor\` for guidance on how to fix this issue.
    `;
  }
}, Q = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "MainFileESMOnlyImportError");
  }
  category = "CORE-SERVER";
  code = 5;
  documentation = "https://github.com/storybookjs/storybook/issues/23972#issuecomment-1948534058";
  template() {
    let t = [
      `Storybook failed to load ${this.data.location}`,
      "",
      "It looks like the file tried to load/import an ESM only module.",
      `Support for this is currently limited in ${this.data.location}`,
      "You can import ESM modules in your main file, but only as dynamic import.",
      ""
    ];
    return this.data.line && t.push(
      f.white(
        `In your ${f.yellow(this.data.location)} file, line ${f.bold.cyan(
          this.data.num
        )} threw an error:`
      ),
      f.grey(this.data.line)
    ), t.push(
      "",
      f.white(
        `Convert the static import to a dynamic import ${f.underline("where they are used")}.`
      ),
      f.white("Example:") + " " + f.gray("await import(<your ESM only module>);"),
      ""
    ), t.join(`
`);
  }
}, Z = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "MainFileMissingError");
  }
  category = "CORE-SERVER";
  code = 6;
  stack = "";
  documentation = "https://storybook.js.org/docs/configure";
  template() {
    return l.dedent`
      No configuration files have been found in your configDir: ${f.yellow(this.data.location)}.
      Storybook needs a "main.js" file, please add it.
      
      You can pass a --config-dir flag to tell Storybook, where your main.js file is located at).
    `;
  }
}, ee = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "MainFileEvaluationError");
  }
  category = "CORE-SERVER";
  code = 7;
  stack = "";
  template() {
    let t = f.white(
      (this.data.error.stack || this.data.error.message).replaceAll(process.cwd(), "")
    );
    return l.dedent`
      Storybook couldn't evaluate your ${f.yellow(this.data.location)} file.

      ${t}
    `;
  }
}, oe = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "GenerateNewProjectOnInitError");
  }
  category = "CLI_INIT";
  code = 3;
  template() {
    return l.dedent`
      There was an error while using ${this.data.packageManager} to create a new ${this.data.projectType} project.
      
      ${this.data.error instanceof Error ? this.data.error.message : ""}
      `;
  }
}, te = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "UpgradeStorybookToLowerVersionError");
  }
  category = "CLI_UPGRADE";
  code = 3;
  template() {
    return l.dedent`
      You are trying to upgrade Storybook to a lower version than the version currently installed. This is not supported.

      Storybook version ${this.data.beforeVersion} was detected in your project, but you are trying to "upgrade" to version ${this.data.currentVersion}.
      
      This usually happens when running the upgrade command without a version specifier, e.g. "npx storybook upgrade".
      This will cause npm to run the globally cached storybook binary, which might be an older version.

      Instead you should always run the Storybook CLI with a version specifier to force npm to download the latest version:
      
      "npx storybook@latest upgrade"
    `;
  }
}, re = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "UpgradeStorybookToSameVersionError");
  }
  category = "CLI_UPGRADE";
  code = 4;
  template() {
    return l.dedent`
      You are upgrading Storybook to the same version that is currently installed in the project, version ${this.data.beforeVersion}.
      
      This usually happens when running the upgrade command without a version specifier, e.g. "npx storybook upgrade".
      This will cause npm to run the globally cached storybook binary, which might be the same version that you already have.
      This also happens if you're running the Storybook CLI that is locally installed in your project.

      If you intended to upgrade to the latest version, you should always run the Storybook CLI with a version specifier to force npm to download the latest version:

      "npx storybook@latest upgrade"

      If you intended to re-run automigrations, you should run the "automigrate" command directly instead:

      "npx storybook automigrate"
    `;
  }
}, ne = class extends i {
  static {
    n(this, "UpgradeStorybookUnknownCurrentVersionError");
  }
  category = "CLI_UPGRADE";
  code = 5;
  template() {
    return l.dedent`
      We couldn't determine the current version of Storybook in your project.

      Are you running the Storybook CLI in a project without Storybook?
      It might help if you specify your Storybook config directory with the --config-dir flag.
    `;
  }
}, ae = class extends i {
  static {
    n(this, "UpgradeStorybookInWrongWorkingDirectory");
  }
  category = "CLI_UPGRADE";
  code = 6;
  template() {
    return l.dedent`
      You are running the upgrade command in a CWD that does not contain Storybook dependencies.

      Did you mean to run it in a different directory? Make sure the directory you run this command in contains a package.json with your Storybook dependencies.
    `;
  }
}, se = class extends i {
  static {
    n(this, "NoStatsForViteDevError");
  }
  category = "BUILDER-VITE";
  code = 1;
  template() {
    return l.dedent`
      Unable to write preview stats as the Vite builder does not support stats in dev mode.

      Please remove the \`--stats-json\` flag when running in dev mode.
    `;
  }
}, ie = class extends i {
  constructor(t) {
    super();
    this.data = t;
  }
  static {
    n(this, "FindPackageVersionsError");
  }
  category = "CLI";
  code = 1;
  template() {
    return l.dedent`
      Unable to find versions of "${this.data.packageName}" using ${this.data.packageManager}
      ${this.data.error && `Reason: ${this.data.error}`}
    `;
  }
};
