@storybook/react 10.5.6 → 10.5.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.
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_ltww5gagp4p from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_ltww5gagp4p from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_ltww5gagp4p from "node:module";
1
+ import CJS_COMPAT_NODE_URL_ov3f8v3gowp from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ov3f8v3gowp from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ov3f8v3gowp from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_ltww5gagp4p.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_ltww5gagp4p.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_ltww5gagp4p.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_ov3f8v3gowp.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ov3f8v3gowp.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ov3f8v3gowp.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -4187,7 +4187,7 @@ var require_util = __commonJS({
4187
4187
  return path4 = parts.join("/"), path4 === "" && (path4 = isAbsolute4 ? "/" : "."), url ? (url.path = path4, urlGenerate(url)) : path4;
4188
4188
  }
4189
4189
  exports.normalize = normalize2;
4190
- function join6(aRoot, aPath) {
4190
+ function join7(aRoot, aPath) {
4191
4191
  aRoot === "" && (aRoot = "."), aPath === "" && (aPath = ".");
4192
4192
  var aPathUrl = urlParse(aPath), aRootUrl = urlParse(aRoot);
4193
4193
  if (aRootUrl && (aRoot = aRootUrl.path || "/"), aPathUrl && !aPathUrl.scheme)
@@ -4199,7 +4199,7 @@ var require_util = __commonJS({
4199
4199
  var joined = aPath.charAt(0) === "/" ? aPath : normalize2(aRoot.replace(/\/+$/, "") + "/" + aPath);
4200
4200
  return aRootUrl ? (aRootUrl.path = joined, urlGenerate(aRootUrl)) : joined;
4201
4201
  }
4202
- exports.join = join6;
4202
+ exports.join = join7;
4203
4203
  exports.isAbsolute = function(aPath) {
4204
4204
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
4205
4205
  };
@@ -4271,7 +4271,7 @@ var require_util = __commonJS({
4271
4271
  var index = parsed.path.lastIndexOf("/");
4272
4272
  index >= 0 && (parsed.path = parsed.path.substring(0, index + 1));
4273
4273
  }
4274
- sourceURL = join6(urlGenerate(parsed), sourceURL);
4274
+ sourceURL = join7(urlGenerate(parsed), sourceURL);
4275
4275
  }
4276
4276
  return normalize2(sourceURL);
4277
4277
  }
@@ -5415,7 +5415,7 @@ var require_escodegen = __commonJS({
5415
5415
  function noEmptySpace() {
5416
5416
  return space || " ";
5417
5417
  }
5418
- function join6(left, right) {
5418
+ function join7(left, right) {
5419
5419
  var leftSource, rightSource, leftCharCode, rightCharCode;
5420
5420
  return leftSource = toSourceNodeWhenNeeded(left).toString(), leftSource.length === 0 ? [right] : (rightSource = toSourceNodeWhenNeeded(right).toString(), rightSource.length === 0 ? [left] : (leftCharCode = leftSource.charCodeAt(leftSource.length - 1), rightCharCode = rightSource.charCodeAt(0), (leftCharCode === 43 || leftCharCode === 45) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode) || leftCharCode === 47 && rightCharCode === 105 ? [left, noEmptySpace(), right] : esutils.code.isWhiteSpace(leftCharCode) || esutils.code.isLineTerminator(leftCharCode) || esutils.code.isWhiteSpace(rightCharCode) || esutils.code.isLineTerminator(rightCharCode) ? [left, right] : [left, space, right]));
5421
5421
  }
@@ -5551,7 +5551,7 @@ var require_escodegen = __commonJS({
5551
5551
  return withIndent(function() {
5552
5552
  stmt.left.type === Syntax.VariableDeclaration ? withIndent(function() {
5553
5553
  result.push(stmt.left.kind + noEmptySpace()), result.push(that.generateStatement(stmt.left.declarations[0], S_FFFF));
5554
- }) : result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)), result = join6(result, operator), result = [join6(
5554
+ }) : result.push(that.generateExpression(stmt.left, Precedence.Call, E_TTT)), result = join7(result, operator), result = [join7(
5555
5555
  result,
5556
5556
  that.generateExpression(stmt.right, Precedence.Assignment, E_TTT)
5557
5557
  ), ")"];
@@ -5599,14 +5599,14 @@ var require_escodegen = __commonJS({
5599
5599
  },
5600
5600
  ClassDeclaration: function(stmt, flags) {
5601
5601
  var result, fragment;
5602
- return result = ["class"], stmt.id && (result = join6(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT))), stmt.superClass && (fragment = join6("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT)), result = join6(result, fragment)), result.push(space), result.push(this.generateStatement(stmt.body, S_TFFT)), result;
5602
+ return result = ["class"], stmt.id && (result = join7(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT))), stmt.superClass && (fragment = join7("extends", this.generateExpression(stmt.superClass, Precedence.Unary, E_TTT)), result = join7(result, fragment)), result.push(space), result.push(this.generateStatement(stmt.body, S_TFFT)), result;
5603
5603
  },
5604
5604
  DirectiveStatement: function(stmt, flags) {
5605
5605
  return extra.raw && stmt.raw ? stmt.raw + this.semicolon(flags) : escapeDirective(stmt.directive) + this.semicolon(flags);
5606
5606
  },
5607
5607
  DoWhileStatement: function(stmt, flags) {
5608
- var result = join6("do", this.maybeBlock(stmt.body, S_TFFF));
5609
- return result = this.maybeBlockSuffix(stmt.body, result), join6(result, [
5608
+ var result = join7("do", this.maybeBlock(stmt.body, S_TFFF));
5609
+ return result = this.maybeBlockSuffix(stmt.body, result), join7(result, [
5610
5610
  "while" + space + "(",
5611
5611
  this.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
5612
5612
  ")" + this.semicolon(flags)
@@ -5631,15 +5631,15 @@ var require_escodegen = __commonJS({
5631
5631
  },
5632
5632
  ExportDefaultDeclaration: function(stmt, flags) {
5633
5633
  var result = ["export"], bodyFlags;
5634
- return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, result = join6(result, "default"), isStatement(stmt.declaration) ? result = join6(result, this.generateStatement(stmt.declaration, bodyFlags)) : result = join6(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags)), result;
5634
+ return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, result = join7(result, "default"), isStatement(stmt.declaration) ? result = join7(result, this.generateStatement(stmt.declaration, bodyFlags)) : result = join7(result, this.generateExpression(stmt.declaration, Precedence.Assignment, E_TTT) + this.semicolon(flags)), result;
5635
5635
  },
5636
5636
  ExportNamedDeclaration: function(stmt, flags) {
5637
5637
  var result = ["export"], bodyFlags, that = this;
5638
- return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, stmt.declaration ? join6(result, this.generateStatement(stmt.declaration, bodyFlags)) : (stmt.specifiers && (stmt.specifiers.length === 0 ? result = join6(result, "{" + space + "}") : stmt.specifiers[0].type === Syntax.ExportBatchSpecifier ? result = join6(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT)) : (result = join6(result, "{"), withIndent(function(indent3) {
5638
+ return bodyFlags = flags & F_SEMICOLON_OPT ? S_TFFT : S_TFFF, stmt.declaration ? join7(result, this.generateStatement(stmt.declaration, bodyFlags)) : (stmt.specifiers && (stmt.specifiers.length === 0 ? result = join7(result, "{" + space + "}") : stmt.specifiers[0].type === Syntax.ExportBatchSpecifier ? result = join7(result, this.generateExpression(stmt.specifiers[0], Precedence.Sequence, E_TTT)) : (result = join7(result, "{"), withIndent(function(indent3) {
5639
5639
  var i2, iz;
5640
5640
  for (result.push(newline), i2 = 0, iz = stmt.specifiers.length; i2 < iz; ++i2)
5641
5641
  result.push(indent3), result.push(that.generateExpression(stmt.specifiers[i2], Precedence.Sequence, E_TTT)), i2 + 1 < iz && result.push("," + newline);
5642
- }), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}")), stmt.source ? result = join6(result, [
5642
+ }), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}")), stmt.source ? result = join7(result, [
5643
5643
  "from" + space,
5644
5644
  // ModuleSpecifier
5645
5645
  this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
@@ -5687,16 +5687,16 @@ var require_escodegen = __commonJS({
5687
5687
  this.semicolon(flags)
5688
5688
  ] : (result = [
5689
5689
  "import"
5690
- ], cursor = 0, stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier && (result = join6(result, [
5690
+ ], cursor = 0, stmt.specifiers[cursor].type === Syntax.ImportDefaultSpecifier && (result = join7(result, [
5691
5691
  this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
5692
- ]), ++cursor), stmt.specifiers[cursor] && (cursor !== 0 && result.push(","), stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier ? result = join6(result, [
5692
+ ]), ++cursor), stmt.specifiers[cursor] && (cursor !== 0 && result.push(","), stmt.specifiers[cursor].type === Syntax.ImportNamespaceSpecifier ? result = join7(result, [
5693
5693
  space,
5694
5694
  this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)
5695
5695
  ]) : (result.push(space + "{"), stmt.specifiers.length - cursor === 1 ? (result.push(space), result.push(this.generateExpression(stmt.specifiers[cursor], Precedence.Sequence, E_TTT)), result.push(space + "}" + space)) : (withIndent(function(indent3) {
5696
5696
  var i2, iz;
5697
5697
  for (result.push(newline), i2 = cursor, iz = stmt.specifiers.length; i2 < iz; ++i2)
5698
5698
  result.push(indent3), result.push(that.generateExpression(stmt.specifiers[i2], Precedence.Sequence, E_TTT)), i2 + 1 < iz && result.push("," + newline);
5699
- }), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}" + space)))), result = join6(result, [
5699
+ }), endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) || result.push(newline), result.push(base2 + "}" + space)))), result = join7(result, [
5700
5700
  "from" + space,
5701
5701
  // ModuleSpecifier
5702
5702
  this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
@@ -5724,7 +5724,7 @@ var require_escodegen = __commonJS({
5724
5724
  return stmt.declarations.length > 1 ? withIndent(block) : block(), result.push(this.semicolon(flags)), result;
5725
5725
  },
5726
5726
  ThrowStatement: function(stmt, flags) {
5727
- return [join6(
5727
+ return [join7(
5728
5728
  "throw",
5729
5729
  this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
5730
5730
  ), this.semicolon(flags)];
@@ -5733,18 +5733,18 @@ var require_escodegen = __commonJS({
5733
5733
  var result, i2, iz, guardedHandlers;
5734
5734
  if (result = ["try", this.maybeBlock(stmt.block, S_TFFF)], result = this.maybeBlockSuffix(stmt.block, result), stmt.handlers)
5735
5735
  for (i2 = 0, iz = stmt.handlers.length; i2 < iz; ++i2)
5736
- result = join6(result, this.generateStatement(stmt.handlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handlers[i2].body, result));
5736
+ result = join7(result, this.generateStatement(stmt.handlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handlers[i2].body, result));
5737
5737
  else {
5738
5738
  for (guardedHandlers = stmt.guardedHandlers || [], i2 = 0, iz = guardedHandlers.length; i2 < iz; ++i2)
5739
- result = join6(result, this.generateStatement(guardedHandlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(guardedHandlers[i2].body, result));
5739
+ result = join7(result, this.generateStatement(guardedHandlers[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(guardedHandlers[i2].body, result));
5740
5740
  if (stmt.handler)
5741
5741
  if (Array.isArray(stmt.handler))
5742
5742
  for (i2 = 0, iz = stmt.handler.length; i2 < iz; ++i2)
5743
- result = join6(result, this.generateStatement(stmt.handler[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handler[i2].body, result));
5743
+ result = join7(result, this.generateStatement(stmt.handler[i2], S_TFFF)), (stmt.finalizer || i2 + 1 !== iz) && (result = this.maybeBlockSuffix(stmt.handler[i2].body, result));
5744
5744
  else
5745
- result = join6(result, this.generateStatement(stmt.handler, S_TFFF)), stmt.finalizer && (result = this.maybeBlockSuffix(stmt.handler.body, result));
5745
+ result = join7(result, this.generateStatement(stmt.handler, S_TFFF)), stmt.finalizer && (result = this.maybeBlockSuffix(stmt.handler.body, result));
5746
5746
  }
5747
- return stmt.finalizer && (result = join6(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)])), result;
5747
+ return stmt.finalizer && (result = join7(result, ["finally", this.maybeBlock(stmt.finalizer, S_TFFF)])), result;
5748
5748
  },
5749
5749
  SwitchStatement: function(stmt, flags) {
5750
5750
  var result, fragment, i2, iz, bodyFlags, that = this;
@@ -5763,7 +5763,7 @@ var require_escodegen = __commonJS({
5763
5763
  var result, fragment, i2, iz, bodyFlags, that = this;
5764
5764
  return withIndent(function() {
5765
5765
  for (stmt.test ? result = [
5766
- join6("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
5766
+ join7("case", that.generateExpression(stmt.test, Precedence.Sequence, E_TTT)),
5767
5767
  ":"
5768
5768
  ] : result = ["default:"], i2 = 0, iz = stmt.consequent.length, iz && stmt.consequent[0].type === Syntax.BlockStatement && (fragment = that.maybeBlock(stmt.consequent[0], S_TFFF), result.push(fragment), i2 = 1), i2 !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString()) && result.push(newline), bodyFlags = S_TFFF; i2 < iz; ++i2)
5769
5769
  i2 === iz - 1 && flags & F_SEMICOLON_OPT && (bodyFlags |= F_SEMICOLON_OPT), fragment = addIndent(that.generateStatement(stmt.consequent[i2], bodyFlags)), result.push(fragment), i2 + 1 !== iz && !endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString()) && result.push(newline);
@@ -5777,7 +5777,7 @@ var require_escodegen = __commonJS({
5777
5777
  that.generateExpression(stmt.test, Precedence.Sequence, E_TTT),
5778
5778
  ")"
5779
5779
  ];
5780
- }), semicolonOptional = flags & F_SEMICOLON_OPT, bodyFlags = S_TFFF, semicolonOptional && (bodyFlags |= F_SEMICOLON_OPT), stmt.alternate ? (result.push(this.maybeBlock(stmt.consequent, S_TFFF)), result = this.maybeBlockSuffix(stmt.consequent, result), stmt.alternate.type === Syntax.IfStatement ? result = join6(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]) : result = join6(result, join6("else", this.maybeBlock(stmt.alternate, bodyFlags)))) : result.push(this.maybeBlock(stmt.consequent, bodyFlags)), result;
5780
+ }), semicolonOptional = flags & F_SEMICOLON_OPT, bodyFlags = S_TFFF, semicolonOptional && (bodyFlags |= F_SEMICOLON_OPT), stmt.alternate ? (result.push(this.maybeBlock(stmt.consequent, S_TFFF)), result = this.maybeBlockSuffix(stmt.consequent, result), stmt.alternate.type === Syntax.IfStatement ? result = join7(result, ["else ", this.generateStatement(stmt.alternate, bodyFlags)]) : result = join7(result, join7("else", this.maybeBlock(stmt.alternate, bodyFlags)))) : result.push(this.maybeBlock(stmt.consequent, bodyFlags)), result;
5781
5781
  },
5782
5782
  ForStatement: function(stmt, flags) {
5783
5783
  var result, that = this;
@@ -5811,7 +5811,7 @@ var require_escodegen = __commonJS({
5811
5811
  ];
5812
5812
  },
5813
5813
  ReturnStatement: function(stmt, flags) {
5814
- return stmt.argument ? [join6(
5814
+ return stmt.argument ? [join7(
5815
5815
  "return",
5816
5816
  this.generateExpression(stmt.argument, Precedence.Sequence, E_TTT)
5817
5817
  ), this.semicolon(flags)] : ["return" + this.semicolon(flags)];
@@ -5867,7 +5867,7 @@ var require_escodegen = __commonJS({
5867
5867
  },
5868
5868
  BinaryExpression: function(expr, precedence, flags) {
5869
5869
  var result, leftPrecedence, rightPrecedence, currentPrecedence, fragment, leftSource;
5870
- return currentPrecedence = BinaryPrecedence[expr.operator], leftPrecedence = expr.operator === "**" ? Precedence.Postfix : currentPrecedence, rightPrecedence = expr.operator === "**" ? currentPrecedence : currentPrecedence + 1, currentPrecedence < precedence && (flags |= F_ALLOW_IN), fragment = this.generateExpression(expr.left, leftPrecedence, flags), leftSource = fragment.toString(), leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0)) ? result = [fragment, noEmptySpace(), expr.operator] : result = join6(fragment, expr.operator), fragment = this.generateExpression(expr.right, rightPrecedence, flags), expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--" ? (result.push(noEmptySpace()), result.push(fragment)) : result = join6(result, fragment), expr.operator === "in" && !(flags & F_ALLOW_IN) ? ["(", result, ")"] : (expr.operator === "||" || expr.operator === "&&") && flags & F_FOUND_COALESCE ? ["(", result, ")"] : parenthesize(result, currentPrecedence, precedence);
5870
+ return currentPrecedence = BinaryPrecedence[expr.operator], leftPrecedence = expr.operator === "**" ? Precedence.Postfix : currentPrecedence, rightPrecedence = expr.operator === "**" ? currentPrecedence : currentPrecedence + 1, currentPrecedence < precedence && (flags |= F_ALLOW_IN), fragment = this.generateExpression(expr.left, leftPrecedence, flags), leftSource = fragment.toString(), leftSource.charCodeAt(leftSource.length - 1) === 47 && esutils.code.isIdentifierPartES5(expr.operator.charCodeAt(0)) ? result = [fragment, noEmptySpace(), expr.operator] : result = join7(fragment, expr.operator), fragment = this.generateExpression(expr.right, rightPrecedence, flags), expr.operator === "/" && fragment.toString().charAt(0) === "/" || expr.operator.slice(-1) === "<" && fragment.toString().slice(0, 3) === "!--" ? (result.push(noEmptySpace()), result.push(fragment)) : result = join7(result, fragment), expr.operator === "in" && !(flags & F_ALLOW_IN) ? ["(", result, ")"] : (expr.operator === "||" || expr.operator === "&&") && flags & F_FOUND_COALESCE ? ["(", result, ")"] : parenthesize(result, currentPrecedence, precedence);
5871
5871
  },
5872
5872
  CallExpression: function(expr, precedence, flags) {
5873
5873
  var result, i2, iz;
@@ -5882,7 +5882,7 @@ var require_escodegen = __commonJS({
5882
5882
  },
5883
5883
  NewExpression: function(expr, precedence, flags) {
5884
5884
  var result, length, i2, iz, itemFlags;
5885
- if (length = expr.arguments.length, itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF, result = join6(
5885
+ if (length = expr.arguments.length, itemFlags = flags & F_ALLOW_UNPARATH_NEW && !parentheses && length === 0 ? E_TFT : E_TFF, result = join7(
5886
5886
  "new",
5887
5887
  this.generateExpression(expr.callee, Precedence.New, itemFlags)
5888
5888
  ), !(flags & F_ALLOW_UNPARATH_NEW) || parentheses || length > 0) {
@@ -5902,17 +5902,17 @@ var require_escodegen = __commonJS({
5902
5902
  },
5903
5903
  UnaryExpression: function(expr, precedence, flags) {
5904
5904
  var result, fragment, rightCharCode, leftSource, leftCharCode;
5905
- return fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT), space === "" ? result = join6(expr.operator, fragment) : (result = [expr.operator], expr.operator.length > 2 ? result = join6(result, fragment) : (leftSource = toSourceNodeWhenNeeded(result).toString(), leftCharCode = leftSource.charCodeAt(leftSource.length - 1), rightCharCode = fragment.toString().charCodeAt(0), ((leftCharCode === 43 || leftCharCode === 45) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode)) && result.push(noEmptySpace()), result.push(fragment))), parenthesize(result, Precedence.Unary, precedence);
5905
+ return fragment = this.generateExpression(expr.argument, Precedence.Unary, E_TTT), space === "" ? result = join7(expr.operator, fragment) : (result = [expr.operator], expr.operator.length > 2 ? result = join7(result, fragment) : (leftSource = toSourceNodeWhenNeeded(result).toString(), leftCharCode = leftSource.charCodeAt(leftSource.length - 1), rightCharCode = fragment.toString().charCodeAt(0), ((leftCharCode === 43 || leftCharCode === 45) && leftCharCode === rightCharCode || esutils.code.isIdentifierPartES5(leftCharCode) && esutils.code.isIdentifierPartES5(rightCharCode)) && result.push(noEmptySpace()), result.push(fragment))), parenthesize(result, Precedence.Unary, precedence);
5906
5906
  },
5907
5907
  YieldExpression: function(expr, precedence, flags) {
5908
5908
  var result;
5909
- return expr.delegate ? result = "yield*" : result = "yield", expr.argument && (result = join6(
5909
+ return expr.delegate ? result = "yield*" : result = "yield", expr.argument && (result = join7(
5910
5910
  result,
5911
5911
  this.generateExpression(expr.argument, Precedence.Yield, E_TTT)
5912
5912
  )), parenthesize(result, Precedence.Yield, precedence);
5913
5913
  },
5914
5914
  AwaitExpression: function(expr, precedence, flags) {
5915
- var result = join6(
5915
+ var result = join7(
5916
5916
  expr.all ? "await*" : "await",
5917
5917
  this.generateExpression(expr.argument, Precedence.Await, E_TTT)
5918
5918
  );
@@ -5958,18 +5958,18 @@ var require_escodegen = __commonJS({
5958
5958
  },
5959
5959
  ClassExpression: function(expr, precedence, flags) {
5960
5960
  var result, fragment;
5961
- return result = ["class"], expr.id && (result = join6(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT))), expr.superClass && (fragment = join6("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT)), result = join6(result, fragment)), result.push(space), result.push(this.generateStatement(expr.body, S_TFFT)), result;
5961
+ return result = ["class"], expr.id && (result = join7(result, this.generateExpression(expr.id, Precedence.Sequence, E_TTT))), expr.superClass && (fragment = join7("extends", this.generateExpression(expr.superClass, Precedence.Unary, E_TTT)), result = join7(result, fragment)), result.push(space), result.push(this.generateStatement(expr.body, S_TFFT)), result;
5962
5962
  },
5963
5963
  MethodDefinition: function(expr, precedence, flags) {
5964
5964
  var result, fragment;
5965
5965
  return expr.static ? result = ["static" + space] : result = [], expr.kind === "get" || expr.kind === "set" ? fragment = [
5966
- join6(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
5966
+ join7(expr.kind, this.generatePropertyKey(expr.key, expr.computed)),
5967
5967
  this.generateFunctionBody(expr.value)
5968
5968
  ] : fragment = [
5969
5969
  generateMethodPrefix(expr),
5970
5970
  this.generatePropertyKey(expr.key, expr.computed),
5971
5971
  this.generateFunctionBody(expr.value)
5972
- ], join6(result, fragment);
5972
+ ], join7(result, fragment);
5973
5973
  },
5974
5974
  Property: function(expr, precedence, flags) {
5975
5975
  return expr.kind === "get" || expr.kind === "set" ? [
@@ -6060,8 +6060,8 @@ var require_escodegen = __commonJS({
6060
6060
  var result, i2, iz, fragment, that = this;
6061
6061
  return result = expr.type === Syntax.GeneratorExpression ? ["("] : ["["], extra.moz.comprehensionExpressionStartsWithAssignment && (fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT), result.push(fragment)), expr.blocks && withIndent(function() {
6062
6062
  for (i2 = 0, iz = expr.blocks.length; i2 < iz; ++i2)
6063
- fragment = that.generateExpression(expr.blocks[i2], Precedence.Sequence, E_TTT), i2 > 0 || extra.moz.comprehensionExpressionStartsWithAssignment ? result = join6(result, fragment) : result.push(fragment);
6064
- }), expr.filter && (result = join6(result, "if" + space), fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT), result = join6(result, ["(", fragment, ")"])), extra.moz.comprehensionExpressionStartsWithAssignment || (fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT), result = join6(result, fragment)), result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]"), result;
6063
+ fragment = that.generateExpression(expr.blocks[i2], Precedence.Sequence, E_TTT), i2 > 0 || extra.moz.comprehensionExpressionStartsWithAssignment ? result = join7(result, fragment) : result.push(fragment);
6064
+ }), expr.filter && (result = join7(result, "if" + space), fragment = this.generateExpression(expr.filter, Precedence.Sequence, E_TTT), result = join7(result, ["(", fragment, ")"])), extra.moz.comprehensionExpressionStartsWithAssignment || (fragment = this.generateExpression(expr.body, Precedence.Assignment, E_TTT), result = join7(result, fragment)), result.push(expr.type === Syntax.GeneratorExpression ? ")" : "]"), result;
6065
6065
  },
6066
6066
  ComprehensionBlock: function(expr, precedence, flags) {
6067
6067
  var fragment;
@@ -6069,7 +6069,7 @@ var require_escodegen = __commonJS({
6069
6069
  expr.left.kind,
6070
6070
  noEmptySpace(),
6071
6071
  this.generateStatement(expr.left.declarations[0], S_FFFF)
6072
- ] : fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT), fragment = join6(fragment, expr.of ? "of" : "in"), fragment = join6(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT)), ["for" + space + "(", fragment, ")"];
6072
+ ] : fragment = this.generateExpression(expr.left, Precedence.Call, E_TTT), fragment = join7(fragment, expr.of ? "of" : "in"), fragment = join7(fragment, this.generateExpression(expr.right, Precedence.Sequence, E_TTT)), ["for" + space + "(", fragment, ")"];
6073
6073
  },
6074
6074
  SpreadElement: function(expr, precedence, flags) {
6075
6075
  return [
@@ -6629,8 +6629,8 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
6629
6629
  return new this(options, input).parse();
6630
6630
  };
6631
6631
  Parser.parseExpressionAt = function(input, pos, options) {
6632
- var parser2 = new this(options, input, pos);
6633
- return parser2.nextToken(), parser2.parseExpression();
6632
+ var parser = new this(options, input, pos);
6633
+ return parser.nextToken(), parser.parseExpression();
6634
6634
  };
6635
6635
  Parser.tokenizer = function(input, options) {
6636
6636
  return new this(options, input);
@@ -7958,8 +7958,8 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
7958
7958
  return scope;
7959
7959
  }
7960
7960
  };
7961
- Node = function(parser2, pos, loc) {
7962
- this.type = "", this.start = pos, this.end = 0, parser2.options.locations && (this.loc = new SourceLocation(parser2, loc)), parser2.options.directSourceFile && (this.sourceFile = parser2.options.directSourceFile), parser2.options.ranges && (this.range = [pos, 0]);
7961
+ Node = function(parser, pos, loc) {
7962
+ this.type = "", this.start = pos, this.end = 0, parser.options.locations && (this.loc = new SourceLocation(parser, loc)), parser.options.directSourceFile && (this.sourceFile = parser.options.directSourceFile), parser.options.ranges && (this.range = [pos, 0]);
7963
7963
  }, pp$2 = Parser.prototype;
7964
7964
  pp$2.startNode = function() {
7965
7965
  return new Node(this, this.start, this.startLoc);
@@ -8016,8 +8016,8 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
8016
8016
  BranchID.prototype.sibling = function() {
8017
8017
  return new BranchID(this.parent, this.base);
8018
8018
  };
8019
- RegExpValidationState = function(parser2) {
8020
- this.parser = parser2, this.validFlags = "gim" + (parser2.options.ecmaVersion >= 6 ? "uy" : "") + (parser2.options.ecmaVersion >= 9 ? "s" : "") + (parser2.options.ecmaVersion >= 13 ? "d" : "") + (parser2.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = data[parser2.options.ecmaVersion >= 14 ? 14 : parser2.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = /* @__PURE__ */ Object.create(null), this.backReferenceNames = [], this.branchID = null;
8019
+ RegExpValidationState = function(parser) {
8020
+ this.parser = parser, this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = /* @__PURE__ */ Object.create(null), this.backReferenceNames = [], this.branchID = null;
8021
8021
  };
8022
8022
  RegExpValidationState.prototype.reset = function(start, pattern, flags) {
8023
8023
  var unicodeSets = flags.indexOf("v") !== -1, unicode = flags.indexOf("u") !== -1;
@@ -13060,7 +13060,10 @@ import * as v8 from "v8";
13060
13060
 
13061
13061
  // src/componentManifest/utils.ts
13062
13062
  import { readFileSync, statSync as statSync2 } from "node:fs";
13063
- import { getProjectRoot, resolveImport } from "storybook/internal/common";
13063
+ import {
13064
+ findTsconfigPath as findTsconfigPathCommon,
13065
+ resolveImport
13066
+ } from "storybook/internal/common";
13064
13067
  import { logger } from "storybook/internal/node-logger";
13065
13068
 
13066
13069
  // ../../../node_modules/empathic/find.mjs
@@ -13160,16 +13163,11 @@ var memoStore = /* @__PURE__ */ new WeakMap(), asyncMemoStore = /* @__PURE__ */
13160
13163
  return mtimeMs !== void 0 && textFileCache.set(filePath, { mtimeMs, content }), content;
13161
13164
  }, cachedFindUp = cached(up2, { name: "findUp" }), cachedResolveImport = cached(resolveImport, {
13162
13165
  name: "resolveImport"
13163
- }), TSCONFIG_CANDIDATES = ["tsconfig.json", "tsconfig.base.json", "tsconfig.app.json"], findTsconfigPath = cached(
13164
- (cwd2) => {
13165
- let projectRoot = getProjectRoot();
13166
- for (let candidate of TSCONFIG_CANDIDATES) {
13167
- let found = up2(candidate, { cwd: cwd2, last: projectRoot });
13168
- if (found)
13169
- return found;
13170
- }
13171
- },
13172
- { name: "findTsconfigPath" }
13166
+ }), findTsconfigPath = cached(
13167
+ (cwd2) => findTsconfigPathCommon(cwd2),
13168
+ {
13169
+ name: "findTsconfigPath"
13170
+ }
13173
13171
  );
13174
13172
 
13175
13173
  // src/componentManifest/componentMeta/ComponentMetaProject.ts
@@ -15801,7 +15799,7 @@ var import_ts_dedent3 = __toESM(require_dist(), 1), TsconfigPaths = __toESM(requ
15801
15799
  import { existsSync as existsSync3 } from "node:fs";
15802
15800
  import { dirname as dirname5, sep as sep2 } from "node:path";
15803
15801
  import { babelParse, types as t } from "storybook/internal/babel";
15804
- import { supportedExtensions as supportedExtensions2 } from "storybook/internal/common";
15802
+ import { findTsconfigPathForPath, supportedExtensions as supportedExtensions2 } from "storybook/internal/common";
15805
15803
  import { logger as logger3 } from "storybook/internal/node-logger";
15806
15804
  import {
15807
15805
  builtinHandlers as docgenHandlers,
@@ -15900,7 +15898,7 @@ function tagTokenizer() {
15900
15898
 
15901
15899
  // ../../../node_modules/comment-parser/es6/parser/tokenizers/type.js
15902
15900
  function typeTokenizer(spacing = "compact") {
15903
- let join6 = getJoiner(spacing);
15901
+ let join7 = getJoiner(spacing);
15904
15902
  return (spec) => {
15905
15903
  let curlies = 0, lines = [];
15906
15904
  for (let [i2, { tokens }] of spec.source.entries()) {
@@ -15923,7 +15921,7 @@ function typeTokenizer(spacing = "compact") {
15923
15921
  let parts = [], offset2 = lines[0][0].postDelimiter.length;
15924
15922
  for (let [i2, [tokens, type]] of lines.entries())
15925
15923
  tokens.type = type, i2 > 0 && (tokens.type = tokens.postDelimiter.slice(offset2) + type, tokens.postDelimiter = tokens.postDelimiter.slice(0, offset2)), [tokens.postType, tokens.description] = splitSpace(tokens.description.slice(type.length)), parts.push(tokens.type);
15926
- return parts[0] = parts[0].slice(1), parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1), spec.type = join6(parts), spec;
15924
+ return parts[0] = parts[0].slice(1), parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1), spec.type = join7(parts), spec;
15927
15925
  };
15928
15926
  }
15929
15927
  var trim = (x) => x.trim();
@@ -15985,8 +15983,8 @@ function nameTokenizer() {
15985
15983
 
15986
15984
  // ../../../node_modules/comment-parser/es6/parser/tokenizers/description.js
15987
15985
  function descriptionTokenizer(spacing = "compact", markers = Markers) {
15988
- let join6 = getJoiner2(spacing);
15989
- return (spec) => (spec.description = join6(spec.source, markers), spec);
15986
+ let join7 = getJoiner2(spacing);
15987
+ return (spec) => (spec.description = join7(spec.source, markers), spec);
15990
15988
  }
15991
15989
  function getJoiner2(spacing) {
15992
15990
  return spacing === "compact" ? compactJoiner : spacing === "preserve" ? preserveJoiner : spacing;
@@ -16238,9 +16236,9 @@ function getMatchingDocgen(docgens, component) {
16238
16236
  )
16239
16237
  ) ?? docgens[0];
16240
16238
  }
16241
- function matchPath(id, basedir) {
16242
- basedir ??= process.cwd();
16243
- let tsconfig = getTsConfig(basedir);
16239
+ function matchPath(id, importerPath) {
16240
+ importerPath ??= process.cwd();
16241
+ let tsconfig = getTsConfig(importerPath);
16244
16242
  return tsconfig.resultType === "success" ? TsconfigPaths.createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths, [
16245
16243
  "browser",
16246
16244
  "module",
@@ -16248,9 +16246,9 @@ function matchPath(id, basedir) {
16248
16246
  ])(id, void 0, void 0, supportedExtensions2) ?? id : id;
16249
16247
  }
16250
16248
  var getTsConfig = cached(
16251
- (cwd2) => {
16252
- let tsconfigPath = findTsconfigPath(cwd2);
16253
- return TsconfigPaths.loadConfig(tsconfigPath);
16249
+ (path4) => {
16250
+ let tsconfigPath = findTsconfigPathForPath(path4);
16251
+ return tsconfigPath ? TsconfigPaths.loadConfig(tsconfigPath) : { resultType: "failed", message: "Couldn't find tsconfig.json" };
16254
16252
  },
16255
16253
  { name: "getTsConfig" }
16256
16254
  ), parseWithReactDocgen = cached(
@@ -16272,7 +16270,7 @@ var getTsConfig = cached(
16272
16270
  let basedir = dirname5(filePath);
16273
16271
  return ast.program.body.flatMap(
16274
16272
  (statement) => t.isExportAllDeclaration(statement) ? [statement.source.value] : t.isExportNamedDeclaration(statement) && statement.source && !statement.declaration ? [statement.source.value] : []
16275
- ).map((id) => matchPath(id, basedir)).flatMap((id) => {
16273
+ ).map((id) => matchPath(id, filePath)).flatMap((id) => {
16276
16274
  try {
16277
16275
  return [cachedResolveImport(id, { basedir })];
16278
16276
  } catch (e) {
@@ -16416,7 +16414,7 @@ function getImportTag(docgen) {
16416
16414
  }
16417
16415
 
16418
16416
  // src/componentManifest/reactDocgenTypescript.ts
16419
- import { dirname as dirname6 } from "node:path";
16417
+ import { dirname as dirname6, join as join6, resolve as resolve5 } from "node:path";
16420
16418
  import { logger as logger4 } from "storybook/internal/node-logger";
16421
16419
  var typeScriptPromise, reactDocgenTypescriptPromise, loadTypeScript = () => typeScriptPromise ??= import("typescript"), loadReactDocgenTypescript = () => reactDocgenTypescriptPromise ??= import("react-docgen-typescript"), LARGE_NON_USER_SOURCE_THRESHOLD = 30, getPropSource = (prop) => prop.parent?.fileName ?? prop.declarations?.[0]?.fileName, getLargeNonUserPropSources = (props) => {
16422
16420
  let countBySource = /* @__PURE__ */ new Map();
@@ -16462,48 +16460,54 @@ function getExportNameMap(typescript, checker, sourceFile) {
16462
16460
  }
16463
16461
  return result;
16464
16462
  }
16465
- var cachedCompilerOptions, cachedFileNames, previousProgram, parser, cachedParserOptionsKey;
16463
+ var previousProgramsByConfigKey = /* @__PURE__ */ new Map(), parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map();
16466
16464
  function invalidateParser() {
16467
- parser = void 0, cachedCompilerOptions = void 0, cachedFileNames = void 0, cachedParserOptionsKey = void 0;
16465
+ parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map(), previousProgramsByConfigKey.clear();
16468
16466
  }
16469
- async function getParser5(userOptions) {
16467
+ async function getParser5(filePath, userOptions) {
16470
16468
  let [typescript, reactDocgenTypescript] = await Promise.all([
16471
16469
  loadTypeScript(),
16472
16470
  loadReactDocgenTypescript()
16473
- ]), optionsKey = JSON.stringify(userOptions ?? {});
16474
- if (parser && cachedParserOptionsKey !== optionsKey && (parser = void 0), !parser) {
16475
- let configPath = findTsconfigPath(process.cwd());
16476
- if (cachedCompilerOptions = { noErrorTruncation: !0, strict: !0 }, configPath) {
16477
- let { config } = typescript.readConfigFile(configPath, typescript.sys.readFile), parsed = typescript.parseJsonConfigFileContent(
16478
- config,
16479
- typescript.sys,
16480
- dirname6(configPath)
16481
- );
16482
- cachedCompilerOptions = { ...parsed.options, noErrorTruncation: !0 }, cachedFileNames = parsed.fileNames;
16471
+ ]), optionsKey = JSON.stringify(userOptions ?? {}), configPath = findOwningTsconfigPath(typescript, process.cwd(), filePath) ?? findTsconfigPath(process.cwd()), configKey = configPath ?? "<no-tsconfig>", parserKey = `${configKey}::${optionsKey}`, cachedParser = parserCache.get(parserKey);
16472
+ if (cachedParser)
16473
+ return { ...cachedParser, typescript };
16474
+ let pendingParser = parserBuilds.get(parserKey);
16475
+ if (pendingParser)
16476
+ return { ...await pendingParser, typescript };
16477
+ let buildParser = (async () => {
16478
+ let compilerOptions = { noErrorTruncation: !0, strict: !0 }, fileNames = [];
16479
+ if (configPath) {
16480
+ let parsed = parseTsconfig(typescript, configPath);
16481
+ compilerOptions = { ...parsed.options, noErrorTruncation: !0 }, fileNames = parsed.fileNames;
16483
16482
  } else
16484
16483
  logger4.warn(
16485
16484
  "No tsconfig.json (or tsconfig.base.json / tsconfig.app.json) found. TypeScript component props will not be documented by react-docgen-typescript. Create a tsconfig.json in your project root to enable automatic controls."
16486
16485
  );
16487
16486
  let program = typescript.createProgram(
16488
- cachedFileNames ?? [],
16489
- cachedCompilerOptions,
16487
+ fileNames,
16488
+ compilerOptions,
16490
16489
  void 0,
16491
- previousProgram
16490
+ previousProgramsByConfigKey.get(configKey)
16492
16491
  );
16493
- previousProgram = program;
16492
+ previousProgramsByConfigKey.set(configKey, program);
16494
16493
  let parserOptions = {
16495
16494
  shouldExtractLiteralValuesFromEnum: !0,
16496
16495
  shouldRemoveUndefinedFromOptional: !0,
16497
16496
  ...userOptions,
16498
16497
  // Always force savePropValueAsString so default values are in a consistent format
16499
16498
  savePropValueAsString: !0
16500
- };
16501
- parser = {
16499
+ }, state = {
16502
16500
  program,
16503
- fileParser: reactDocgenTypescript.withCompilerOptions(cachedCompilerOptions, parserOptions)
16504
- }, cachedParserOptionsKey = optionsKey;
16501
+ fileParser: reactDocgenTypescript.withCompilerOptions(compilerOptions, parserOptions)
16502
+ };
16503
+ return parserCache.set(parserKey, state), state;
16504
+ })();
16505
+ parserBuilds.set(parserKey, buildParser);
16506
+ try {
16507
+ return { ...await buildParser, typescript };
16508
+ } finally {
16509
+ parserBuilds.delete(parserKey);
16505
16510
  }
16506
- return { ...parser, typescript };
16507
16511
  }
16508
16512
  function matchComponentDoc(docs, {
16509
16513
  importName,
@@ -16539,7 +16543,7 @@ function getReactDocgenTypescriptError(path4, {
16539
16543
  }
16540
16544
  var parseWithReactDocgenTypescript = asyncCache(
16541
16545
  async (filePath, userOptions) => {
16542
- let { program, fileParser, typescript } = await getParser5(userOptions), checker = program.getTypeChecker(), sourceFile = program.getSourceFile(filePath), docs = fileParser.parseWithProgramProvider(filePath, () => program), exportNameMap = sourceFile ? getExportNameMap(typescript, checker, sourceFile) : /* @__PURE__ */ new Map();
16546
+ let { program, fileParser, typescript } = await getParser5(filePath, userOptions), checker = program.getTypeChecker(), sourceFile = program.getSourceFile(filePath), docs = fileParser.parseWithProgramProvider(filePath, () => program), exportNameMap = sourceFile ? getExportNameMap(typescript, checker, sourceFile) : /* @__PURE__ */ new Map();
16543
16547
  return docs.map((doc) => {
16544
16548
  let largeNonUserSources = getLargeNonUserPropSources(doc.props);
16545
16549
  return {
@@ -16558,7 +16562,61 @@ var parseWithReactDocgenTypescript = asyncCache(
16558
16562
  });
16559
16563
  },
16560
16564
  { name: "parseWithReactDocgenTypescript" }
16565
+ ), findOwningTsconfigPath = cached(
16566
+ (typescript, cwd2, filePath) => {
16567
+ let configPath = findTsconfigPath(cwd2);
16568
+ if (configPath)
16569
+ return findTsconfigPathIncludingFile(typescript, configPath, filePath, /* @__PURE__ */ new Set()) ?? configPath;
16570
+ },
16571
+ {
16572
+ key: (typescript, cwd2, filePath) => `${normalizeFileName(typescript, resolve5(cwd2))}::${normalizeFileName(
16573
+ typescript,
16574
+ resolve5(filePath)
16575
+ )}`,
16576
+ name: "findOwningTsconfigPath"
16577
+ }
16561
16578
  );
16579
+ function findTsconfigPathIncludingFile(typescript, configPath, filePath, seenConfigPaths) {
16580
+ let normalizedConfigPath = normalizeFileName(typescript, configPath);
16581
+ if (seenConfigPaths.has(normalizedConfigPath))
16582
+ return;
16583
+ seenConfigPaths.add(normalizedConfigPath);
16584
+ let { config, parsed } = readTsconfig(typescript, configPath);
16585
+ if (parsed.fileNames.some((name) => isSameFileName(typescript, name, filePath)))
16586
+ return configPath;
16587
+ for (let referencedConfigPath of getReferencedTsconfigPaths(typescript, configPath, config)) {
16588
+ let matchingConfigPath = findTsconfigPathIncludingFile(
16589
+ typescript,
16590
+ referencedConfigPath,
16591
+ filePath,
16592
+ seenConfigPaths
16593
+ );
16594
+ if (matchingConfigPath)
16595
+ return matchingConfigPath;
16596
+ }
16597
+ }
16598
+ function getReferencedTsconfigPaths(typescript, configPath, config) {
16599
+ return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve5(dirname6(configPath), referencePath)).map(
16600
+ (referencePath) => referencePath.endsWith(".json") ? referencePath : join6(referencePath, "tsconfig.json")
16601
+ ).filter((referencePath) => typescript.sys.fileExists(referencePath));
16602
+ }
16603
+ function parseTsconfig(typescript, configPath) {
16604
+ return readTsconfig(typescript, configPath).parsed;
16605
+ }
16606
+ function readTsconfig(typescript, configPath) {
16607
+ let { config } = typescript.readConfigFile(configPath, typescript.sys.readFile);
16608
+ return {
16609
+ config,
16610
+ parsed: typescript.parseJsonConfigFileContent(config, typescript.sys, dirname6(configPath))
16611
+ };
16612
+ }
16613
+ function isSameFileName(typescript, left, right) {
16614
+ return normalizeFileName(typescript, left) === normalizeFileName(typescript, right);
16615
+ }
16616
+ function normalizeFileName(typescript, fileName) {
16617
+ let normalized = resolve5(fileName).replace(/\\/g, "/");
16618
+ return typescript.sys.useCaseSensitiveFileNames ? normalized : normalized.toLowerCase();
16619
+ }
16562
16620
 
16563
16621
  // src/componentManifest/generateCodeSnippet.ts
16564
16622
  import { types as t2 } from "storybook/internal/babel";