storybook 10.0.0-beta.1 → 10.0.0-beta.10

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.
Files changed (124) hide show
  1. package/assets/server/openBrowser.applescript +94 -0
  2. package/dist/_browser-chunks/Color-KPLIACXP.js +1569 -0
  3. package/dist/_browser-chunks/{WithTooltip-ERFLZL6W.js → WithTooltip-SK46ZJ2J.js} +1 -1
  4. package/dist/_browser-chunks/{chunk-YY5GICNT.js → chunk-6E2SHJSL.js} +175 -32
  5. package/dist/_browser-chunks/{chunk-EOILZP2R.js → chunk-BOOOPFZF.js} +7 -2
  6. package/dist/_browser-chunks/{chunk-YWDKX534.js → chunk-FA42P6MO.js} +49 -4
  7. package/dist/_browser-chunks/chunk-G33S6YM3.js +521 -0
  8. package/dist/_browser-chunks/{chunk-MZNYTCNT.js → chunk-HMIIJ6UD.js} +6 -6
  9. package/dist/_browser-chunks/{chunk-4QPX7WIQ.js → chunk-JJZMHC3A.js} +57 -166
  10. package/dist/_browser-chunks/{chunk-MD2FTHCZ.js → chunk-JVSKG4YS.js} +3 -16
  11. package/dist/_browser-chunks/{chunk-E7VLET3C.js → chunk-KSCAWCCE.js} +3947 -4291
  12. package/dist/_browser-chunks/{chunk-PYK5ZTFK.js → chunk-PS3AOQI4.js} +48 -25
  13. package/dist/_browser-chunks/chunk-QK3L5AXO.js +372 -0
  14. package/dist/_browser-chunks/chunk-SHR3NNR3.js +5810 -0
  15. package/dist/_browser-chunks/{chunk-O5R5CGFA.js → chunk-TMDZCWME.js} +1 -2
  16. package/dist/_browser-chunks/chunk-VUAFL5XK.js +20 -0
  17. package/dist/_browser-chunks/{chunk-T7RCAJIX.js → chunk-Y3M7TW6K.js} +43 -47
  18. package/dist/_browser-chunks/{syntaxhighlighter-YYAA4CS4.js → syntaxhighlighter-R46XOLMC.js} +1 -1
  19. package/dist/_node-chunks/{builder-manager-EXW4ETLN.js → builder-manager-SJGIDEN6.js} +45 -155
  20. package/dist/_node-chunks/camelcase-VZHWABQV.js +18 -0
  21. package/dist/_node-chunks/{chunk-F5J33SXQ.js → chunk-6CZW7AGN.js} +7 -7
  22. package/dist/_node-chunks/{chunk-2G5THETV.js → chunk-6XT5OLNL.js} +12 -12
  23. package/dist/_node-chunks/{chunk-U45F2NP6.js → chunk-AHRH5RPR.js} +7 -7
  24. package/dist/_node-chunks/{chunk-ICPKUV5G.js → chunk-AOH6ABSV.js} +7 -7
  25. package/dist/_node-chunks/chunk-C5V22GP7.js +79 -0
  26. package/dist/_node-chunks/{chunk-5V6QH7WC.js → chunk-FIROF4DV.js} +7 -7
  27. package/dist/_node-chunks/{chunk-WDKWVNL2.js → chunk-GUJVZUYI.js} +7 -7
  28. package/dist/_node-chunks/chunk-IHPLRRAR.js +4741 -0
  29. package/dist/_node-chunks/{chunk-PMEEE3UE.js → chunk-JMXKCRWR.js} +30 -21
  30. package/dist/_node-chunks/{chunk-5ZX5SJOP.js → chunk-JUMUXWEV.js} +162 -103
  31. package/dist/_node-chunks/{chunk-CM3UGTR5.js → chunk-KGX33KXX.js} +7 -7
  32. package/dist/_node-chunks/{chunk-6CCUFDHU.js → chunk-KLVABNEU.js} +7 -7
  33. package/dist/_node-chunks/{chunk-EO4S3VXL.js → chunk-OL6DY6BT.js} +653 -775
  34. package/dist/_node-chunks/{chunk-GVCXNIAA.js → chunk-ONJV3K2L.js} +399 -116
  35. package/dist/_node-chunks/{chunk-3ZKQWDCG.js → chunk-PTHTD4RO.js} +223 -243
  36. package/dist/_node-chunks/{chunk-VNLBDN2Z.js → chunk-QQ3Z5KGJ.js} +6 -6
  37. package/dist/_node-chunks/{chunk-2QZOLZDJ.js → chunk-QRTDDTZJ.js} +9 -9
  38. package/dist/_node-chunks/chunk-R54K4KSM.js +1540 -0
  39. package/dist/_node-chunks/{chunk-24TGL6EX.js → chunk-S2LZC6JK.js} +8 -8
  40. package/dist/_node-chunks/chunk-SFJFSPRT.js +62 -0
  41. package/dist/_node-chunks/{chunk-SUMFFLGF.js → chunk-SSN5PKIY.js} +6 -6
  42. package/dist/_node-chunks/{chunk-QC5FE2D7.js → chunk-SXR2DITB.js} +7 -7
  43. package/dist/_node-chunks/{chunk-FZP2YGG3.js → chunk-TH5QVQRL.js} +7 -7
  44. package/dist/_node-chunks/chunk-U34NWAU2.js +18 -0
  45. package/dist/_node-chunks/{chunk-XTSBFCVE.js → chunk-UV3CZ3KS.js} +7 -7
  46. package/dist/_node-chunks/{chunk-PL2PKDRO.js → chunk-UVUGJDAI.js} +60 -102
  47. package/dist/_node-chunks/{chunk-EDBXIJN5.js → chunk-VOUNSD2E.js} +7 -7
  48. package/dist/_node-chunks/{chunk-WP7DV5JT.js → chunk-WFCPBKQJ.js} +583 -180
  49. package/dist/_node-chunks/{chunk-4WNZYNQY.js → chunk-XHF3WWNP.js} +623 -750
  50. package/dist/_node-chunks/{chunk-3SGKBLOL.js → chunk-XU45KXNQ.js} +8 -8
  51. package/dist/_node-chunks/{camelcase-VZZFWA2L.js → chunk-YHO6XR7U.js} +9 -8
  52. package/dist/_node-chunks/{dist-VZL6D6Y3.js → dist-IIC5PBL7.js} +9 -9
  53. package/dist/_node-chunks/{globby-GZXJJ4W6.js → globby-CJACC3HJ.js} +17 -13
  54. package/dist/_node-chunks/{lib-PHT5GCV2.js → lib-ZY4TKSOR.js} +40 -16
  55. package/dist/_node-chunks/{mdx-N42X6CFJ-EPDIV4A2.js → mdx-N42X6CFJ-3XNW3DFO.js} +8 -8
  56. package/dist/_node-chunks/{p-limit-AJIFSZTI.js → p-limit-R2OFT5HE.js} +76 -10
  57. package/dist/_node-chunks/{plugin-3VI56CEF.js → plugin-5XD5R2KD.js} +10 -10
  58. package/dist/_node-chunks/{plugin-AV4OEKYM.js → plugin-WAWVQMVR.js} +10 -10
  59. package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-E7J5FKLA.js → webpack-inject-mocker-runtime-plugin-SCRGJLIS.js} +1307 -847
  60. package/dist/_node-chunks/{webpack-mock-plugin-VTYGW7HO.js → webpack-mock-plugin-3VAXEGG2.js} +9 -9
  61. package/dist/babel/index.d.ts +1 -1
  62. package/dist/babel/index.js +11 -11
  63. package/dist/bin/core.js +638 -187
  64. package/dist/bin/dispatcher.js +11 -11
  65. package/dist/bin/loader.js +8 -8
  66. package/dist/cli/index.d.ts +62 -75
  67. package/dist/cli/index.js +66 -55
  68. package/dist/common/index.d.ts +3 -1
  69. package/dist/common/index.js +22 -22
  70. package/dist/components/index.d.ts +228 -1
  71. package/dist/components/index.js +74 -5738
  72. package/dist/core-events/index.d.ts +18 -2
  73. package/dist/core-events/index.js +7 -1
  74. package/dist/core-server/index.d.ts +515 -14
  75. package/dist/core-server/index.js +4647 -4182
  76. package/dist/core-server/presets/common-manager.js +1570 -1272
  77. package/dist/core-server/presets/common-override-preset.js +9 -9
  78. package/dist/core-server/presets/common-preset.js +691 -38
  79. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
  80. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
  81. package/dist/csf/index.d.ts +9 -4
  82. package/dist/csf/index.js +50 -15
  83. package/dist/csf-tools/index.d.ts +47 -6
  84. package/dist/csf-tools/index.js +9 -9
  85. package/dist/docs-tools/index.js +4 -4
  86. package/dist/instrumenter/index.js +1 -1
  87. package/dist/manager/globals-runtime.js +9230 -18109
  88. package/dist/manager/globals.d.ts +0 -4
  89. package/dist/manager/globals.js +1 -6
  90. package/dist/manager/runtime.js +13398 -11573
  91. package/dist/manager-api/index.d.ts +513 -5
  92. package/dist/manager-api/index.js +364 -90
  93. package/dist/manager-errors.d.ts +501 -0
  94. package/dist/node-logger/index.d.ts +1 -1
  95. package/dist/node-logger/index.js +1136 -662
  96. package/dist/preview/globals.js +1 -1
  97. package/dist/preview/runtime.js +12103 -21579
  98. package/dist/preview-api/index.d.ts +3 -3
  99. package/dist/preview-api/index.js +10 -10
  100. package/dist/preview-errors.d.ts +501 -0
  101. package/dist/router/index.d.ts +668 -10
  102. package/dist/router/index.js +2 -2
  103. package/dist/server-errors.d.ts +501 -0
  104. package/dist/server-errors.js +10 -10
  105. package/dist/telemetry/index.d.ts +1 -1
  106. package/dist/telemetry/index.js +23 -25
  107. package/dist/test/index.js +1874 -4024
  108. package/dist/theming/index.d.ts +2 -2
  109. package/dist/theming/index.js +6 -6
  110. package/dist/types/index.d.ts +553 -16
  111. package/dist/viewport/index.d.ts +36 -4
  112. package/dist/viewport/index.js +1 -1
  113. package/package.json +9 -46
  114. package/dist/_browser-chunks/Color-SFYJJKWL.js +0 -605
  115. package/dist/_browser-chunks/chunk-DHO2SA6L.js +0 -12
  116. package/dist/_browser-chunks/chunk-WPHPDNUA.js +0 -974
  117. package/dist/_node-chunks/chunk-32JYCD74.js +0 -80
  118. package/dist/_node-chunks/chunk-GE6I3YYG.js +0 -62
  119. package/dist/_node-chunks/chunk-KXCNXWXI.js +0 -18
  120. package/dist/_node-chunks/chunk-LAUOYAOX.js +0 -87
  121. package/dist/_node-chunks/chunk-QJTT4OC2.js +0 -266
  122. package/dist/_node-chunks/chunk-V2ZF4DUD.js +0 -2377
  123. package/dist/_node-chunks/chunk-ZMV3WY6R.js +0 -9845
  124. package/dist/_node-chunks/default-browser-id-JNATP42X.js +0 -1719
@@ -1,31 +1,31 @@
1
- import {
2
- isTestEnvironment,
3
- pauseAnimations,
4
- waitForAnimations
5
- } from "./chunk-LYCSRYYR.js";
6
1
  import {
7
2
  require_main
8
- } from "./chunk-T7RCAJIX.js";
3
+ } from "./chunk-Y3M7TW6K.js";
9
4
  import {
10
5
  SNIPPET_RENDERED,
11
6
  combineParameters
12
- } from "./chunk-YY5GICNT.js";
7
+ } from "./chunk-6E2SHJSL.js";
13
8
  import {
14
9
  pickBy
15
- } from "./chunk-YWDKX534.js";
10
+ } from "./chunk-FA42P6MO.js";
16
11
  import {
17
12
  invariant
18
13
  } from "./chunk-FUOHXXZT.js";
19
14
  import {
20
15
  require_ansi_to_html
21
16
  } from "./chunk-F4Q6SGTB.js";
17
+ import {
18
+ isTestEnvironment,
19
+ pauseAnimations,
20
+ waitForAnimations
21
+ } from "./chunk-LYCSRYYR.js";
22
22
  import {
23
23
  mapValues
24
- } from "./chunk-E7VLET3C.js";
24
+ } from "./chunk-QK3L5AXO.js";
25
25
  import {
26
26
  isEqual,
27
27
  isPlainObject
28
- } from "./chunk-4QPX7WIQ.js";
28
+ } from "./chunk-JJZMHC3A.js";
29
29
  import {
30
30
  require_memoizerific
31
31
  } from "./chunk-NVV6MIOE.js";
@@ -511,6 +511,13 @@ var map = /* @__PURE__ */ __name((arg, argType) => {
511
511
  const mapped = map(val, { type: type.value[key] });
512
512
  return mapped === INCOMPATIBLE ? acc : Object.assign(acc, { [key]: mapped });
513
513
  }, {});
514
+ case "other": {
515
+ const isPrimitiveArg = typeof arg === "string" || typeof arg === "number" || typeof arg === "boolean";
516
+ if (type.value === "ReactNode" && isPrimitiveArg) {
517
+ return arg;
518
+ }
519
+ return INCOMPATIBLE;
520
+ }
514
521
  default:
515
522
  return INCOMPATIBLE;
516
523
  }
@@ -880,7 +887,7 @@ __name(normalizeStory, "normalizeStory");
880
887
 
881
888
  // src/preview-api/modules/store/csf/processCSFFile.ts
882
889
  import { logger as logger4 } from "storybook/internal/client-logger";
883
- import { isExportStory, isStory } from "storybook/internal/csf";
890
+ import { getStoryChildren, isExportStory, isStory, toTestId } from "storybook/internal/csf";
884
891
 
885
892
  // src/preview-api/modules/store/csf/normalizeComponentAnnotations.ts
886
893
  import { sanitize } from "storybook/internal/csf";
@@ -934,9 +941,17 @@ function processCSFFile(moduleExports, importPath, title) {
934
941
  const csfFile2 = { meta: meta2, stories: {}, moduleExports };
935
942
  Object.keys(namedExports).forEach((key) => {
936
943
  if (isExportStory(key, meta2)) {
937
- const storyMeta = normalizeStory(key, namedExports[key].input, meta2);
944
+ const story = namedExports[key];
945
+ const storyMeta = normalizeStory(key, story.input, meta2);
938
946
  checkDisallowedParameters(storyMeta.parameters);
939
947
  csfFile2.stories[storyMeta.id] = storyMeta;
948
+ getStoryChildren(story).forEach((child) => {
949
+ const name = child.input.name;
950
+ const childId = toTestId(storyMeta.id, name);
951
+ child.input.parameters ??= {};
952
+ child.input.parameters.__id = childId;
953
+ csfFile2.stories[childId] = normalizeStory(name, child.input, meta2);
954
+ });
940
955
  }
941
956
  });
942
957
  csfFile2.projectAnnotations = firstStory.meta.preview.composed;
@@ -1167,11 +1182,13 @@ __name(prepareMeta, "prepareMeta");
1167
1182
  function preparePartialAnnotations(storyAnnotations, componentAnnotations, projectAnnotations) {
1168
1183
  const defaultTags = ["dev", "test"];
1169
1184
  const extraTags = globalThis2.DOCS_OPTIONS?.autodocs === true ? ["autodocs"] : [];
1185
+ const overrideTags = storyAnnotations?.tags?.includes("test-fn") ? ["!autodocs"] : [];
1170
1186
  const tags = combineTags(
1171
1187
  ...defaultTags,
1172
1188
  ...extraTags,
1173
1189
  ...projectAnnotations.tags ?? [],
1174
1190
  ...componentAnnotations.tags ?? [],
1191
+ ...overrideTags,
1175
1192
  ...storyAnnotations?.tags ?? []
1176
1193
  );
1177
1194
  const parameters = combineParameters(
@@ -1542,13 +1559,13 @@ __name(_ReporterAPI, "ReporterAPI");
1542
1559
  var ReporterAPI = _ReporterAPI;
1543
1560
 
1544
1561
  // src/preview-api/modules/store/csf/csf-factory-utils.ts
1545
- import { isStory as isStory2 } from "storybook/internal/csf";
1562
+ import { isMeta, isStory as isStory2 } from "storybook/internal/csf";
1546
1563
  function getCsfFactoryAnnotations(story, meta, projectAnnotations) {
1547
1564
  return isStory2(story) ? {
1548
1565
  story: story.input,
1549
1566
  meta: story.meta.input,
1550
1567
  preview: story.meta.preview.composed
1551
- } : { story, meta, preview: projectAnnotations };
1568
+ } : { story, meta: isMeta(meta) ? meta.input : meta, preview: projectAnnotations };
1552
1569
  }
1553
1570
  __name(getCsfFactoryAnnotations, "getCsfFactoryAnnotations");
1554
1571
 
@@ -1947,7 +1964,7 @@ var _StoryStore = class _StoryStore {
1947
1964
  return { entryExports, csfFiles };
1948
1965
  }
1949
1966
  // A prepared story does not include args, globals or hooks. These are stored in the story store
1950
- // and updated separtely to the (immutable) story.
1967
+ // and updated separately to the (immutable) story.
1951
1968
  getStoryContext(story, { forceInitialArgs = false } = {}) {
1952
1969
  const userGlobals = this.userGlobals.get();
1953
1970
  const { initialGlobals } = this.userGlobals;
@@ -1981,21 +1998,25 @@ var _StoryStore = class _StoryStore {
1981
1998
  }
1982
1999
  extract(options = { includeDocsOnly: false }) {
1983
2000
  const { cachedCSFFiles } = this;
2001
+ console.log("extract: extracting stories", cachedCSFFiles);
1984
2002
  if (!cachedCSFFiles) {
1985
2003
  throw new CalledExtractOnStoreError();
1986
2004
  }
1987
- return Object.entries(this.storyIndex.entries).reduce(
1988
- (acc, [storyId, { type, importPath }]) => {
1989
- if (type === "docs") {
2005
+ const stories = Object.entries(this.storyIndex.entries).reduce(
2006
+ (acc, [storyId, entry]) => {
2007
+ if (entry.type === "docs") {
1990
2008
  return acc;
1991
2009
  }
1992
- const csfFile = cachedCSFFiles[importPath];
2010
+ const csfFile = cachedCSFFiles[entry.importPath];
1993
2011
  const story = this.storyFromCSFFile({ storyId, csfFile });
1994
2012
  if (!options.includeDocsOnly && story.parameters.docsOnly) {
1995
2013
  return acc;
1996
2014
  }
1997
2015
  acc[storyId] = Object.entries(story).reduce(
1998
2016
  (storyAcc, [key, value]) => {
2017
+ if (key === "story" && entry.subtype === "test") {
2018
+ return { ...storyAcc, story: entry.parentName };
2019
+ }
1999
2020
  if (key === "moduleExport") {
2000
2021
  return storyAcc;
2001
2022
  }
@@ -2008,19 +2029,21 @@ var _StoryStore = class _StoryStore {
2008
2029
  return Object.assign(storyAcc, { [key]: value });
2009
2030
  },
2010
2031
  {
2011
- //
2012
2032
  args: story.initialArgs,
2013
2033
  globals: {
2014
2034
  ...this.userGlobals.initialGlobals,
2015
2035
  ...this.userGlobals.globals,
2016
2036
  ...story.storyGlobals
2017
- }
2037
+ },
2038
+ storyId: entry.parent ? entry.parent : storyId
2018
2039
  }
2019
2040
  );
2020
2041
  return acc;
2021
2042
  },
2022
2043
  {}
2023
2044
  );
2045
+ console.log("extract: stories", stories);
2046
+ return stories;
2024
2047
  }
2025
2048
  };
2026
2049
  __name(_StoryStore, "StoryStore");
@@ -2181,7 +2204,7 @@ var sortStoriesV7 = /* @__PURE__ */ __name((stories, storySortParameter, fileNam
2181
2204
  Error sorting stories with sort parameter ${storySortParameter}:
2182
2205
 
2183
2206
  > ${err.message}
2184
-
2207
+
2185
2208
  Are you using a V6-style sort function in V7 mode?
2186
2209
 
2187
2210
  More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#v7-style-story-sort
@@ -2277,16 +2300,15 @@ var _StoryRender = class _StoryRender {
2277
2300
  }
2278
2301
  }
2279
2302
  checkIfAborted(signal) {
2280
- if (signal.aborted) {
2303
+ if (signal.aborted && !["finished", "aborted", "errored"].includes(this.phase)) {
2281
2304
  this.phase = "aborted";
2282
2305
  this.channel.emit(STORY_RENDER_PHASE_CHANGED, {
2283
2306
  newPhase: this.phase,
2284
2307
  renderId: this.renderId,
2285
2308
  storyId: this.id
2286
2309
  });
2287
- return true;
2288
2310
  }
2289
- return false;
2311
+ return signal.aborted;
2290
2312
  }
2291
2313
  async prepare() {
2292
2314
  await this.runPhase(this.abortController.signal, "preparing", async () => {
@@ -4123,6 +4145,7 @@ export {
4123
4145
  combineArgs,
4124
4146
  normalizeArrays,
4125
4147
  normalizeStory,
4148
+ mountDestructured,
4126
4149
  decorateStory,
4127
4150
  sanitizeStoryContextUpdate,
4128
4151
  defaultDecorateStory,
@@ -0,0 +1,372 @@
1
+ import {
2
+ argumentsTag,
3
+ arrayBufferTag,
4
+ arrayTag,
5
+ booleanTag,
6
+ dataViewTag,
7
+ dateTag,
8
+ float32ArrayTag,
9
+ float64ArrayTag,
10
+ getSymbols,
11
+ getTag,
12
+ int16ArrayTag,
13
+ int32ArrayTag,
14
+ int8ArrayTag,
15
+ isPrimitive,
16
+ isTypedArray,
17
+ mapTag,
18
+ numberTag,
19
+ objectTag,
20
+ regexpTag,
21
+ setTag,
22
+ stringTag,
23
+ symbolTag,
24
+ uint16ArrayTag,
25
+ uint32ArrayTag,
26
+ uint8ArrayTag,
27
+ uint8ClampedArrayTag
28
+ } from "./chunk-JJZMHC3A.js";
29
+ import {
30
+ __name
31
+ } from "./chunk-MM7DTO55.js";
32
+
33
+ // ../node_modules/es-toolkit/dist/object/mapValues.mjs
34
+ function mapValues(object, getNewValue) {
35
+ const result = {};
36
+ const keys = Object.keys(object);
37
+ for (let i = 0; i < keys.length; i++) {
38
+ const key = keys[i];
39
+ const value = object[key];
40
+ result[key] = getNewValue(value, key, object);
41
+ }
42
+ return result;
43
+ }
44
+ __name(mapValues, "mapValues");
45
+
46
+ // ../node_modules/es-toolkit/dist/compat/predicate/isObjectLike.mjs
47
+ function isObjectLike(value) {
48
+ return typeof value === "object" && value !== null;
49
+ }
50
+ __name(isObjectLike, "isObjectLike");
51
+
52
+ // ../node_modules/es-toolkit/dist/compat/predicate/isArray.mjs
53
+ function isArray(value) {
54
+ return Array.isArray(value);
55
+ }
56
+ __name(isArray, "isArray");
57
+
58
+ // ../node_modules/es-toolkit/dist/compat/predicate/isPlainObject.mjs
59
+ function isPlainObject(object) {
60
+ if (typeof object !== "object") {
61
+ return false;
62
+ }
63
+ if (object == null) {
64
+ return false;
65
+ }
66
+ if (Object.getPrototypeOf(object) === null) {
67
+ return true;
68
+ }
69
+ if (Object.prototype.toString.call(object) !== "[object Object]") {
70
+ const tag = object[Symbol.toStringTag];
71
+ if (tag == null) {
72
+ return false;
73
+ }
74
+ const isTagReadonly = !Object.getOwnPropertyDescriptor(object, Symbol.toStringTag)?.writable;
75
+ if (isTagReadonly) {
76
+ return false;
77
+ }
78
+ return object.toString() === `[object ${tag}]`;
79
+ }
80
+ let proto = object;
81
+ while (Object.getPrototypeOf(proto) !== null) {
82
+ proto = Object.getPrototypeOf(proto);
83
+ }
84
+ return Object.getPrototypeOf(object) === proto;
85
+ }
86
+ __name(isPlainObject, "isPlainObject");
87
+
88
+ // ../node_modules/es-toolkit/dist/object/clone.mjs
89
+ function clone(obj) {
90
+ if (isPrimitive(obj)) {
91
+ return obj;
92
+ }
93
+ if (Array.isArray(obj) || isTypedArray(obj) || obj instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && obj instanceof SharedArrayBuffer) {
94
+ return obj.slice(0);
95
+ }
96
+ const prototype = Object.getPrototypeOf(obj);
97
+ const Constructor = prototype.constructor;
98
+ if (obj instanceof Date || obj instanceof Map || obj instanceof Set) {
99
+ return new Constructor(obj);
100
+ }
101
+ if (obj instanceof RegExp) {
102
+ const newRegExp = new Constructor(obj);
103
+ newRegExp.lastIndex = obj.lastIndex;
104
+ return newRegExp;
105
+ }
106
+ if (obj instanceof DataView) {
107
+ return new Constructor(obj.buffer.slice(0));
108
+ }
109
+ if (obj instanceof Error) {
110
+ const newError = new Constructor(obj.message);
111
+ newError.stack = obj.stack;
112
+ newError.name = obj.name;
113
+ newError.cause = obj.cause;
114
+ return newError;
115
+ }
116
+ if (typeof File !== "undefined" && obj instanceof File) {
117
+ const newFile = new Constructor([obj], obj.name, { type: obj.type, lastModified: obj.lastModified });
118
+ return newFile;
119
+ }
120
+ if (typeof obj === "object") {
121
+ const newObject = Object.create(prototype);
122
+ return Object.assign(newObject, obj);
123
+ }
124
+ return obj;
125
+ }
126
+ __name(clone, "clone");
127
+
128
+ // ../node_modules/es-toolkit/dist/object/cloneDeepWith.mjs
129
+ function cloneDeepWith(obj, cloneValue) {
130
+ return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), cloneValue);
131
+ }
132
+ __name(cloneDeepWith, "cloneDeepWith");
133
+ function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = /* @__PURE__ */ new Map(), cloneValue = void 0) {
134
+ const cloned = cloneValue?.(valueToClone, keyToClone, objectToClone, stack);
135
+ if (cloned !== void 0) {
136
+ return cloned;
137
+ }
138
+ if (isPrimitive(valueToClone)) {
139
+ return valueToClone;
140
+ }
141
+ if (stack.has(valueToClone)) {
142
+ return stack.get(valueToClone);
143
+ }
144
+ if (Array.isArray(valueToClone)) {
145
+ const result = new Array(valueToClone.length);
146
+ stack.set(valueToClone, result);
147
+ for (let i = 0; i < valueToClone.length; i++) {
148
+ result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
149
+ }
150
+ if (Object.hasOwn(valueToClone, "index")) {
151
+ result.index = valueToClone.index;
152
+ }
153
+ if (Object.hasOwn(valueToClone, "input")) {
154
+ result.input = valueToClone.input;
155
+ }
156
+ return result;
157
+ }
158
+ if (valueToClone instanceof Date) {
159
+ return new Date(valueToClone.getTime());
160
+ }
161
+ if (valueToClone instanceof RegExp) {
162
+ const result = new RegExp(valueToClone.source, valueToClone.flags);
163
+ result.lastIndex = valueToClone.lastIndex;
164
+ return result;
165
+ }
166
+ if (valueToClone instanceof Map) {
167
+ const result = /* @__PURE__ */ new Map();
168
+ stack.set(valueToClone, result);
169
+ for (const [key, value] of valueToClone) {
170
+ result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
171
+ }
172
+ return result;
173
+ }
174
+ if (valueToClone instanceof Set) {
175
+ const result = /* @__PURE__ */ new Set();
176
+ stack.set(valueToClone, result);
177
+ for (const value of valueToClone) {
178
+ result.add(cloneDeepWithImpl(value, void 0, objectToClone, stack, cloneValue));
179
+ }
180
+ return result;
181
+ }
182
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) {
183
+ return valueToClone.subarray();
184
+ }
185
+ if (isTypedArray(valueToClone)) {
186
+ const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
187
+ stack.set(valueToClone, result);
188
+ for (let i = 0; i < valueToClone.length; i++) {
189
+ result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
190
+ }
191
+ return result;
192
+ }
193
+ if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) {
194
+ return valueToClone.slice(0);
195
+ }
196
+ if (valueToClone instanceof DataView) {
197
+ const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
198
+ stack.set(valueToClone, result);
199
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
200
+ return result;
201
+ }
202
+ if (typeof File !== "undefined" && valueToClone instanceof File) {
203
+ const result = new File([valueToClone], valueToClone.name, {
204
+ type: valueToClone.type
205
+ });
206
+ stack.set(valueToClone, result);
207
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
208
+ return result;
209
+ }
210
+ if (valueToClone instanceof Blob) {
211
+ const result = new Blob([valueToClone], { type: valueToClone.type });
212
+ stack.set(valueToClone, result);
213
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
214
+ return result;
215
+ }
216
+ if (valueToClone instanceof Error) {
217
+ const result = new valueToClone.constructor();
218
+ stack.set(valueToClone, result);
219
+ result.message = valueToClone.message;
220
+ result.name = valueToClone.name;
221
+ result.stack = valueToClone.stack;
222
+ result.cause = valueToClone.cause;
223
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
224
+ return result;
225
+ }
226
+ if (typeof valueToClone === "object" && isCloneableObject(valueToClone)) {
227
+ const result = Object.create(Object.getPrototypeOf(valueToClone));
228
+ stack.set(valueToClone, result);
229
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
230
+ return result;
231
+ }
232
+ return valueToClone;
233
+ }
234
+ __name(cloneDeepWithImpl, "cloneDeepWithImpl");
235
+ function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
236
+ const keys = [...Object.keys(source), ...getSymbols(source)];
237
+ for (let i = 0; i < keys.length; i++) {
238
+ const key = keys[i];
239
+ const descriptor = Object.getOwnPropertyDescriptor(target, key);
240
+ if (descriptor == null || descriptor.writable) {
241
+ target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
242
+ }
243
+ }
244
+ }
245
+ __name(copyProperties, "copyProperties");
246
+ function isCloneableObject(object) {
247
+ switch (getTag(object)) {
248
+ case argumentsTag:
249
+ case arrayTag:
250
+ case arrayBufferTag:
251
+ case dataViewTag:
252
+ case booleanTag:
253
+ case dateTag:
254
+ case float32ArrayTag:
255
+ case float64ArrayTag:
256
+ case int8ArrayTag:
257
+ case int16ArrayTag:
258
+ case int32ArrayTag:
259
+ case mapTag:
260
+ case numberTag:
261
+ case objectTag:
262
+ case regexpTag:
263
+ case setTag:
264
+ case stringTag:
265
+ case symbolTag:
266
+ case uint8ArrayTag:
267
+ case uint8ClampedArrayTag:
268
+ case uint16ArrayTag:
269
+ case uint32ArrayTag: {
270
+ return true;
271
+ }
272
+ default: {
273
+ return false;
274
+ }
275
+ }
276
+ }
277
+ __name(isCloneableObject, "isCloneableObject");
278
+
279
+ // ../node_modules/es-toolkit/dist/object/cloneDeep.mjs
280
+ function cloneDeep(obj) {
281
+ return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), void 0);
282
+ }
283
+ __name(cloneDeep, "cloneDeep");
284
+
285
+ // ../node_modules/es-toolkit/dist/object/findKey.mjs
286
+ function findKey(obj, predicate) {
287
+ const keys = Object.keys(obj);
288
+ return keys.find((key) => predicate(obj[key], key, obj));
289
+ }
290
+ __name(findKey, "findKey");
291
+
292
+ // ../node_modules/es-toolkit/dist/object/invert.mjs
293
+ function invert(obj) {
294
+ const result = {};
295
+ const keys = Object.keys(obj);
296
+ for (let i = 0; i < keys.length; i++) {
297
+ const key = keys[i];
298
+ const value = obj[key];
299
+ result[value] = key;
300
+ }
301
+ return result;
302
+ }
303
+ __name(invert, "invert");
304
+
305
+ // ../node_modules/es-toolkit/dist/object/mapKeys.mjs
306
+ function mapKeys(object, getNewKey) {
307
+ const result = {};
308
+ const keys = Object.keys(object);
309
+ for (let i = 0; i < keys.length; i++) {
310
+ const key = keys[i];
311
+ const value = object[key];
312
+ result[getNewKey(value, key, object)] = value;
313
+ }
314
+ return result;
315
+ }
316
+ __name(mapKeys, "mapKeys");
317
+
318
+ // ../node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
319
+ function isUnsafeProperty(key) {
320
+ return key === "__proto__";
321
+ }
322
+ __name(isUnsafeProperty, "isUnsafeProperty");
323
+
324
+ // ../node_modules/es-toolkit/dist/string/capitalize.mjs
325
+ function capitalize(str) {
326
+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
327
+ }
328
+ __name(capitalize, "capitalize");
329
+
330
+ // ../node_modules/es-toolkit/dist/string/words.mjs
331
+ var CASE_SPLIT_PATTERN = new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+", "gu");
332
+ function words(str) {
333
+ return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
334
+ }
335
+ __name(words, "words");
336
+
337
+ // ../node_modules/es-toolkit/dist/string/camelCase.mjs
338
+ function camelCase(str) {
339
+ const words$1 = words(str);
340
+ if (words$1.length === 0) {
341
+ return "";
342
+ }
343
+ const [first, ...rest] = words$1;
344
+ return `${first.toLowerCase()}${rest.map((word) => capitalize(word)).join("")}`;
345
+ }
346
+ __name(camelCase, "camelCase");
347
+
348
+ // ../node_modules/es-toolkit/dist/string/snakeCase.mjs
349
+ function snakeCase(str) {
350
+ const words$1 = words(str);
351
+ return words$1.map((word) => word.toLowerCase()).join("_");
352
+ }
353
+ __name(snakeCase, "snakeCase");
354
+
355
+ export {
356
+ clone,
357
+ cloneDeepWith,
358
+ copyProperties,
359
+ cloneDeep,
360
+ findKey,
361
+ invert,
362
+ mapKeys,
363
+ mapValues,
364
+ isUnsafeProperty,
365
+ isObjectLike,
366
+ isArray,
367
+ capitalize,
368
+ words,
369
+ camelCase,
370
+ isPlainObject,
371
+ snakeCase
372
+ };