storybook 9.0.0-alpha.1 → 9.0.0-alpha.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 (259) hide show
  1. package/README.md +31 -29
  2. package/assets/browser/favicon.svg +1 -0
  3. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  4. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  5. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  6. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  7. package/assets/docs/addon-controls-args-annotated.png +0 -0
  8. package/assets/docs/addon-controls-args-background-color.png +0 -0
  9. package/assets/docs/addon-controls-args-background-string.png +0 -0
  10. package/assets/docs/addon-controls-args-docs.png +0 -0
  11. package/assets/docs/addon-controls-args-logging.png +0 -0
  12. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  13. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  14. package/assets/docs/addon-controls-args-reflow.png +0 -0
  15. package/assets/docs/addon-controls-args-template.png +0 -0
  16. package/assets/docs/addon-controls-expanded.png +0 -0
  17. package/assets/docs/addon-controls-hero.gif +0 -0
  18. package/assets/docs/addon-controls-install.png +0 -0
  19. package/assets/docs/hero.gif +0 -0
  20. package/assets/docs/message-reference.png +0 -0
  21. package/assets/docs/viewport.png +0 -0
  22. package/assets/server/addon.tsconfig.json +6 -0
  23. package/assets/server/base-preview-body.html +119 -0
  24. package/assets/server/base-preview-head.html +451 -0
  25. package/assets/server/template.ejs +87 -0
  26. package/bin/index.cjs +1 -1
  27. package/dist/actions/decorator.d.ts +6 -0
  28. package/dist/actions/decorator.js +139 -0
  29. package/dist/actions/index.cjs +127 -0
  30. package/dist/actions/index.d.ts +105 -0
  31. package/dist/actions/index.js +112 -0
  32. package/dist/actions/manager.js +1196 -0
  33. package/dist/actions/preview.cjs +165 -0
  34. package/dist/actions/preview.d.ts +55 -0
  35. package/dist/actions/preview.js +156 -0
  36. package/dist/babel/index.cjs +54034 -0
  37. package/dist/babel/index.d.ts +7488 -0
  38. package/dist/babel/index.js +54044 -0
  39. package/dist/bin/index.cjs +119 -0
  40. package/dist/bin/index.js +113 -0
  41. package/dist/builder-manager/index.cjs +2140 -0
  42. package/dist/builder-manager/index.d.ts +19 -0
  43. package/dist/builder-manager/index.js +2162 -0
  44. package/dist/channels/index.cjs +1913 -0
  45. package/dist/channels/index.d.ts +108 -0
  46. package/dist/channels/index.js +1881 -0
  47. package/dist/cli/bin/index.cjs +2687 -0
  48. package/dist/cli/bin/index.d.ts +2 -0
  49. package/dist/cli/bin/index.js +2707 -0
  50. package/dist/cli/index.cjs +17327 -0
  51. package/dist/cli/index.d.ts +209 -0
  52. package/dist/cli/index.js +17349 -0
  53. package/dist/client-logger/index.cjs +80 -0
  54. package/dist/client-logger/index.d.ts +29 -0
  55. package/dist/client-logger/index.js +64 -0
  56. package/dist/common/index.cjs +20569 -0
  57. package/dist/common/index.d.ts +949 -0
  58. package/dist/common/index.js +20654 -0
  59. package/dist/components/index.cjs +27924 -0
  60. package/dist/components/index.d.ts +1423 -0
  61. package/dist/components/index.js +24673 -0
  62. package/dist/controls/decorator.d.ts +5 -0
  63. package/dist/controls/decorator.js +8 -0
  64. package/dist/controls/index.cjs +26 -0
  65. package/dist/controls/index.d.ts +39 -0
  66. package/dist/controls/index.js +6 -0
  67. package/dist/controls/manager.js +5545 -0
  68. package/dist/controls/preview.cjs +26 -0
  69. package/dist/controls/preview.d.ts +55 -0
  70. package/dist/controls/preview.js +9 -0
  71. package/dist/core-events/index.cjs +167 -0
  72. package/dist/core-events/index.d.ts +426 -0
  73. package/dist/core-events/index.js +149 -0
  74. package/dist/core-server/index.cjs +38183 -0
  75. package/dist/core-server/index.d.ts +720 -0
  76. package/dist/core-server/index.js +38272 -0
  77. package/dist/core-server/presets/common-manager.js +20 -0
  78. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  79. package/dist/core-server/presets/common-override-preset.js +4829 -0
  80. package/dist/core-server/presets/common-preset.cjs +10231 -0
  81. package/dist/core-server/presets/common-preset.js +10309 -0
  82. package/dist/csf/index.cjs +179 -0
  83. package/dist/csf/index.d.ts +750 -0
  84. package/dist/csf/index.js +172 -0
  85. package/dist/csf-tools/index.cjs +1422 -0
  86. package/dist/csf-tools/index.d.ts +250 -0
  87. package/dist/csf-tools/index.js +1439 -0
  88. package/dist/docs-tools/index.cjs +2891 -0
  89. package/dist/docs-tools/index.d.ts +162 -0
  90. package/dist/docs-tools/index.js +2876 -0
  91. package/dist/index.cjs +17 -1
  92. package/dist/index.d.ts +1 -1
  93. package/dist/index.js +2 -7
  94. package/dist/instrumenter/index.cjs +3485 -0
  95. package/dist/instrumenter/index.d.ts +104 -0
  96. package/dist/instrumenter/index.js +4965 -0
  97. package/dist/manager/globals-module-info.cjs +817 -0
  98. package/dist/manager/globals-module-info.d.ts +36 -0
  99. package/dist/manager/globals-module-info.js +804 -0
  100. package/dist/manager/globals-runtime.js +77536 -0
  101. package/dist/manager/globals.cjs +47 -0
  102. package/dist/manager/globals.d.ts +24 -0
  103. package/dist/manager/globals.js +34 -0
  104. package/dist/manager/runtime.js +12323 -0
  105. package/dist/manager-api/index.cjs +11074 -0
  106. package/dist/manager-api/index.d.ts +1512 -0
  107. package/dist/manager-api/index.js +4835 -0
  108. package/dist/manager-errors.d.ts +89 -0
  109. package/dist/manager-errors.js +99 -0
  110. package/dist/node-logger/index.cjs +1642 -0
  111. package/dist/node-logger/index.d.ts +117 -0
  112. package/dist/node-logger/index.js +1652 -0
  113. package/dist/preview/globals.cjs +38 -0
  114. package/dist/preview/globals.d.ts +15 -0
  115. package/dist/preview/globals.js +25 -0
  116. package/dist/preview/runtime.js +43629 -0
  117. package/dist/preview-api/index.cjs +5224 -0
  118. package/dist/preview-api/index.d.ts +1093 -0
  119. package/dist/preview-api/index.js +5292 -0
  120. package/dist/preview-errors.cjs +503 -0
  121. package/dist/preview-errors.d.ts +212 -0
  122. package/dist/preview-errors.js +449 -0
  123. package/dist/router/index.cjs +3296 -0
  124. package/dist/router/index.d.ts +385 -0
  125. package/dist/router/index.js +1843 -0
  126. package/dist/server-errors.cjs +727 -0
  127. package/dist/server-errors.d.ts +296 -0
  128. package/dist/server-errors.js +728 -0
  129. package/dist/telemetry/index.cjs +2756 -0
  130. package/dist/telemetry/index.d.ts +133 -0
  131. package/dist/telemetry/index.js +2797 -0
  132. package/dist/test/index.cjs +35685 -0
  133. package/dist/test/index.d.ts +186 -0
  134. package/dist/test/index.js +33751 -0
  135. package/dist/test/preview.cjs +15869 -0
  136. package/dist/test/preview.d.ts +54 -0
  137. package/dist/test/preview.js +14440 -0
  138. package/dist/test/spy.cjs +257 -0
  139. package/dist/test/spy.d.ts +66 -0
  140. package/dist/test/spy.js +239 -0
  141. package/dist/theming/create.cjs +232 -0
  142. package/dist/theming/create.d.ts +50 -0
  143. package/dist/theming/create.js +216 -0
  144. package/dist/theming/index.cjs +2665 -0
  145. package/dist/theming/index.d.ts +11939 -0
  146. package/dist/theming/index.js +2485 -0
  147. package/dist/types/index.cjs +27 -0
  148. package/dist/types/index.d.ts +2795 -0
  149. package/dist/types/index.js +7 -0
  150. package/dist/viewport/index.cjs +310 -0
  151. package/dist/viewport/index.d.ts +320 -0
  152. package/dist/viewport/index.js +290 -0
  153. package/dist/viewport/manager.js +400 -0
  154. package/dist/viewport/preview.cjs +35 -0
  155. package/dist/viewport/preview.d.ts +69 -0
  156. package/dist/viewport/preview.js +19 -0
  157. package/package.json +518 -209
  158. package/.eslintrc.cjs +0 -31
  159. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  160. package/core/babel/index.cjs +0 -1
  161. package/core/babel/index.d.ts +0 -2
  162. package/core/babel/index.js +0 -1
  163. package/core/builder-manager/index.cjs +0 -1
  164. package/core/builder-manager/index.d.ts +0 -2
  165. package/core/builder-manager/index.js +0 -1
  166. package/core/channels/index.cjs +0 -1
  167. package/core/channels/index.d.ts +0 -2
  168. package/core/channels/index.js +0 -1
  169. package/core/cli/bin/index.cjs +0 -1
  170. package/core/cli/bin/index.d.ts +0 -2
  171. package/core/cli/bin/index.js +0 -1
  172. package/core/cli/index.cjs +0 -1
  173. package/core/cli/index.d.ts +0 -2
  174. package/core/cli/index.js +0 -1
  175. package/core/client-logger/index.cjs +0 -1
  176. package/core/client-logger/index.d.ts +0 -2
  177. package/core/client-logger/index.js +0 -1
  178. package/core/common/index.cjs +0 -1
  179. package/core/common/index.d.ts +0 -2
  180. package/core/common/index.js +0 -1
  181. package/core/components/index.cjs +0 -1
  182. package/core/components/index.d.ts +0 -2
  183. package/core/components/index.js +0 -1
  184. package/core/core-events/index.cjs +0 -1
  185. package/core/core-events/index.d.ts +0 -2
  186. package/core/core-events/index.js +0 -1
  187. package/core/core-server/index.cjs +0 -1
  188. package/core/core-server/index.d.ts +0 -2
  189. package/core/core-server/index.js +0 -1
  190. package/core/core-server/presets/common-manager.js +0 -1
  191. package/core/core-server/presets/common-override-preset.cjs +0 -1
  192. package/core/core-server/presets/common-override-preset.js +0 -1
  193. package/core/core-server/presets/common-preset.cjs +0 -1
  194. package/core/core-server/presets/common-preset.js +0 -1
  195. package/core/csf/index.cjs +0 -1
  196. package/core/csf/index.d.ts +0 -2
  197. package/core/csf/index.js +0 -1
  198. package/core/csf-tools/index.cjs +0 -1
  199. package/core/csf-tools/index.d.ts +0 -2
  200. package/core/csf-tools/index.js +0 -1
  201. package/core/docs-tools/index.cjs +0 -1
  202. package/core/docs-tools/index.d.ts +0 -2
  203. package/core/docs-tools/index.js +0 -1
  204. package/core/index.cjs +0 -1
  205. package/core/index.d.ts +0 -2
  206. package/core/index.js +0 -1
  207. package/core/manager/globals-module-info.cjs +0 -1
  208. package/core/manager/globals-module-info.d.ts +0 -2
  209. package/core/manager/globals-module-info.js +0 -1
  210. package/core/manager/globals-runtime.js +0 -1
  211. package/core/manager/globals.cjs +0 -1
  212. package/core/manager/globals.d.ts +0 -2
  213. package/core/manager/globals.js +0 -1
  214. package/core/manager-api/index.cjs +0 -1
  215. package/core/manager-api/index.d.ts +0 -2
  216. package/core/manager-api/index.js +0 -1
  217. package/core/manager-errors.d.ts +0 -2
  218. package/core/manager-errors.js +0 -1
  219. package/core/node-logger/index.cjs +0 -1
  220. package/core/node-logger/index.d.ts +0 -2
  221. package/core/node-logger/index.js +0 -1
  222. package/core/preview/globals.cjs +0 -1
  223. package/core/preview/globals.d.ts +0 -2
  224. package/core/preview/globals.js +0 -1
  225. package/core/preview/runtime.js +0 -1
  226. package/core/preview-api/index.cjs +0 -1
  227. package/core/preview-api/index.d.ts +0 -2
  228. package/core/preview-api/index.js +0 -1
  229. package/core/preview-errors.cjs +0 -1
  230. package/core/preview-errors.d.ts +0 -2
  231. package/core/preview-errors.js +0 -1
  232. package/core/router/index.cjs +0 -1
  233. package/core/router/index.d.ts +0 -2
  234. package/core/router/index.js +0 -1
  235. package/core/server-errors.cjs +0 -1
  236. package/core/server-errors.d.ts +0 -2
  237. package/core/server-errors.js +0 -1
  238. package/core/telemetry/index.cjs +0 -1
  239. package/core/telemetry/index.d.ts +0 -2
  240. package/core/telemetry/index.js +0 -1
  241. package/core/theming/create.cjs +0 -1
  242. package/core/theming/create.d.ts +0 -2
  243. package/core/theming/create.js +0 -1
  244. package/core/theming/index.cjs +0 -1
  245. package/core/theming/index.d.ts +0 -2
  246. package/core/theming/index.js +0 -1
  247. package/core/types/index.cjs +0 -1
  248. package/core/types/index.d.ts +0 -2
  249. package/core/types/index.js +0 -1
  250. package/core.cjs +0 -0
  251. package/core.d.ts +0 -0
  252. package/core.js +0 -1
  253. package/dist/chunk-OWLSIX54.js +0 -8
  254. package/dist/core-path.cjs +0 -1
  255. package/dist/core-path.d.ts +0 -3
  256. package/dist/core-path.js +0 -9
  257. package/dist/proxy.cjs +0 -1
  258. package/dist/proxy.d.ts +0 -2
  259. package/dist/proxy.js +0 -9
@@ -0,0 +1,2756 @@
1
+ "use strict";
2
+ var Yo = Object.create;
3
+ var G = Object.defineProperty;
4
+ var Ko = Object.getOwnPropertyDescriptor;
5
+ var Xo = Object.getOwnPropertyNames;
6
+ var Qo = Object.getPrototypeOf, Zo = Object.prototype.hasOwnProperty;
7
+ var o = (e, t) => G(e, "name", { value: t, configurable: !0 });
8
+ var w = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), ei = (e, t) => {
9
+ for (var r in t)
10
+ G(e, r, { get: t[r], enumerable: !0 });
11
+ }, Gt = (e, t, r, n) => {
12
+ if (t && typeof t == "object" || typeof t == "function")
13
+ for (let i of Xo(t))
14
+ !Zo.call(e, i) && i !== r && G(e, i, { get: () => t[i], enumerable: !(n = Ko(t, i)) || n.enumerable });
15
+ return e;
16
+ };
17
+ var d = (e, t, r) => (r = e != null ? Yo(Qo(e)) : {}, Gt(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ t || !e || !e.__esModule ? G(r, "default", { value: e, enumerable: !0 }) : r,
23
+ e
24
+ )), ti = (e) => Gt(G({}, "__esModule", { value: !0 }), e);
25
+
26
+ // ../node_modules/picocolors/picocolors.js
27
+ var Wt = w((ka, De) => {
28
+ var ne = process || {}, Ut = ne.argv || [], re = ne.env || {}, ri = !(re.NO_COLOR || Ut.includes("--no-color")) && (!!re.FORCE_COLOR || Ut.
29
+ includes("--color") || ne.platform === "win32" || (ne.stdout || {}).isTTY && re.TERM !== "dumb" || !!re.CI), ni = /* @__PURE__ */ o((e, t, r = e) => (n) => {
30
+ let i = "" + n, s = i.indexOf(t, e.length);
31
+ return ~s ? e + oi(i, t, r, s) + t : e + i + t;
32
+ }, "formatter"), oi = /* @__PURE__ */ o((e, t, r, n) => {
33
+ let i = "", s = 0;
34
+ do
35
+ i += e.substring(s, n) + r, s = n + t.length, n = e.indexOf(t, s);
36
+ while (~n);
37
+ return i + e.substring(s);
38
+ }, "replaceClose"), $t = /* @__PURE__ */ o((e = ri) => {
39
+ let t = e ? ni : () => String;
40
+ return {
41
+ isColorSupported: e,
42
+ reset: t("\x1B[0m", "\x1B[0m"),
43
+ bold: t("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
44
+ dim: t("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
45
+ italic: t("\x1B[3m", "\x1B[23m"),
46
+ underline: t("\x1B[4m", "\x1B[24m"),
47
+ inverse: t("\x1B[7m", "\x1B[27m"),
48
+ hidden: t("\x1B[8m", "\x1B[28m"),
49
+ strikethrough: t("\x1B[9m", "\x1B[29m"),
50
+ black: t("\x1B[30m", "\x1B[39m"),
51
+ red: t("\x1B[31m", "\x1B[39m"),
52
+ green: t("\x1B[32m", "\x1B[39m"),
53
+ yellow: t("\x1B[33m", "\x1B[39m"),
54
+ blue: t("\x1B[34m", "\x1B[39m"),
55
+ magenta: t("\x1B[35m", "\x1B[39m"),
56
+ cyan: t("\x1B[36m", "\x1B[39m"),
57
+ white: t("\x1B[37m", "\x1B[39m"),
58
+ gray: t("\x1B[90m", "\x1B[39m"),
59
+ bgBlack: t("\x1B[40m", "\x1B[49m"),
60
+ bgRed: t("\x1B[41m", "\x1B[49m"),
61
+ bgGreen: t("\x1B[42m", "\x1B[49m"),
62
+ bgYellow: t("\x1B[43m", "\x1B[49m"),
63
+ bgBlue: t("\x1B[44m", "\x1B[49m"),
64
+ bgMagenta: t("\x1B[45m", "\x1B[49m"),
65
+ bgCyan: t("\x1B[46m", "\x1B[49m"),
66
+ bgWhite: t("\x1B[47m", "\x1B[49m"),
67
+ blackBright: t("\x1B[90m", "\x1B[39m"),
68
+ redBright: t("\x1B[91m", "\x1B[39m"),
69
+ greenBright: t("\x1B[92m", "\x1B[39m"),
70
+ yellowBright: t("\x1B[93m", "\x1B[39m"),
71
+ blueBright: t("\x1B[94m", "\x1B[39m"),
72
+ magentaBright: t("\x1B[95m", "\x1B[39m"),
73
+ cyanBright: t("\x1B[96m", "\x1B[39m"),
74
+ whiteBright: t("\x1B[97m", "\x1B[39m"),
75
+ bgBlackBright: t("\x1B[100m", "\x1B[49m"),
76
+ bgRedBright: t("\x1B[101m", "\x1B[49m"),
77
+ bgGreenBright: t("\x1B[102m", "\x1B[49m"),
78
+ bgYellowBright: t("\x1B[103m", "\x1B[49m"),
79
+ bgBlueBright: t("\x1B[104m", "\x1B[49m"),
80
+ bgMagentaBright: t("\x1B[105m", "\x1B[49m"),
81
+ bgCyanBright: t("\x1B[106m", "\x1B[49m"),
82
+ bgWhiteBright: t("\x1B[107m", "\x1B[49m")
83
+ };
84
+ }, "createColors");
85
+ De.exports = $t();
86
+ De.exports.createColors = $t;
87
+ });
88
+
89
+ // ../node_modules/walk-up-path/dist/cjs/index.js
90
+ var zt = w((ie) => {
91
+ "use strict";
92
+ Object.defineProperty(ie, "__esModule", { value: !0 });
93
+ ie.walkUp = void 0;
94
+ var qt = require("path"), ii = /* @__PURE__ */ o(function* (e) {
95
+ for (e = (0, qt.resolve)(e); e; ) {
96
+ yield e;
97
+ let t = (0, qt.dirname)(e);
98
+ if (t === e)
99
+ break;
100
+ e = t;
101
+ }
102
+ }, "walkUp");
103
+ ie.walkUp = ii;
104
+ });
105
+
106
+ // ../node_modules/isexe/windows.js
107
+ var sr = w(($a, ir) => {
108
+ ir.exports = or;
109
+ or.sync = pi;
110
+ var rr = require("fs");
111
+ function li(e, t) {
112
+ var r = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
113
+ if (!r || (r = r.split(";"), r.indexOf("") !== -1))
114
+ return !0;
115
+ for (var n = 0; n < r.length; n++) {
116
+ var i = r[n].toLowerCase();
117
+ if (i && e.substr(-i.length).toLowerCase() === i)
118
+ return !0;
119
+ }
120
+ return !1;
121
+ }
122
+ o(li, "checkPathExt");
123
+ function nr(e, t, r) {
124
+ return !e.isSymbolicLink() && !e.isFile() ? !1 : li(t, r);
125
+ }
126
+ o(nr, "checkStat");
127
+ function or(e, t, r) {
128
+ rr.stat(e, function(n, i) {
129
+ r(n, n ? !1 : nr(i, e, t));
130
+ });
131
+ }
132
+ o(or, "isexe");
133
+ function pi(e, t) {
134
+ return nr(rr.statSync(e), e, t);
135
+ }
136
+ o(pi, "sync");
137
+ });
138
+
139
+ // ../node_modules/isexe/mode.js
140
+ var lr = w((Ha, fr) => {
141
+ fr.exports = cr;
142
+ cr.sync = mi;
143
+ var ar = require("fs");
144
+ function cr(e, t, r) {
145
+ ar.stat(e, function(n, i) {
146
+ r(n, n ? !1 : ur(i, t));
147
+ });
148
+ }
149
+ o(cr, "isexe");
150
+ function mi(e, t) {
151
+ return ur(ar.statSync(e), t);
152
+ }
153
+ o(mi, "sync");
154
+ function ur(e, t) {
155
+ return e.isFile() && di(e, t);
156
+ }
157
+ o(ur, "checkStat");
158
+ function di(e, t) {
159
+ var r = e.mode, n = e.uid, i = e.gid, s = t.uid !== void 0 ? t.uid : process.getuid && process.getuid(), a = t.gid !== void 0 ? t.gid : process.
160
+ getgid && process.getgid(), c = parseInt("100", 8), u = parseInt("010", 8), f = parseInt("001", 8), l = c | u, y = r & f || r & u && i ===
161
+ a || r & c && n === s || r & l && s === 0;
162
+ return y;
163
+ }
164
+ o(di, "checkMode");
165
+ });
166
+
167
+ // ../node_modules/isexe/index.js
168
+ var mr = w((qa, pr) => {
169
+ var Va = require("fs"), ae;
170
+ process.platform === "win32" || global.TESTING_WINDOWS ? ae = sr() : ae = lr();
171
+ pr.exports = He;
172
+ He.sync = yi;
173
+ function He(e, t, r) {
174
+ if (typeof t == "function" && (r = t, t = {}), !r) {
175
+ if (typeof Promise != "function")
176
+ throw new TypeError("callback not provided");
177
+ return new Promise(function(n, i) {
178
+ He(e, t || {}, function(s, a) {
179
+ s ? i(s) : n(a);
180
+ });
181
+ });
182
+ }
183
+ ae(e, t || {}, function(n, i) {
184
+ n && (n.code === "EACCES" || t && t.ignoreErrors) && (n = null, i = !1), r(n, i);
185
+ });
186
+ }
187
+ o(He, "isexe");
188
+ function yi(e, t) {
189
+ try {
190
+ return ae.sync(e, t || {});
191
+ } catch (r) {
192
+ if (t && t.ignoreErrors || r.code === "EACCES")
193
+ return !1;
194
+ throw r;
195
+ }
196
+ }
197
+ o(yi, "sync");
198
+ });
199
+
200
+ // ../node_modules/cross-spawn/node_modules/which/which.js
201
+ var wr = w((Ya, xr) => {
202
+ var D = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", dr = require("path"), hi = D ? "\
203
+ ;" : ":", yr = mr(), hr = /* @__PURE__ */ o((e) => Object.assign(new Error(`not found: ${e}`), { code: "ENOENT" }), "getNotFoundError"), gr = /* @__PURE__ */ o(
204
+ (e, t) => {
205
+ let r = t.colon || hi, n = e.match(/\//) || D && e.match(/\\/) ? [""] : [
206
+ // windows always checks the cwd first
207
+ ...D ? [process.cwd()] : [],
208
+ ...(t.path || process.env.PATH || /* istanbul ignore next: very unusual */
209
+ "").split(r)
210
+ ], i = D ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", s = D ? i.split(r) : [""];
211
+ return D && e.indexOf(".") !== -1 && s[0] !== "" && s.unshift(""), {
212
+ pathEnv: n,
213
+ pathExt: s,
214
+ pathExtExe: i
215
+ };
216
+ }, "getPathInfo"), br = /* @__PURE__ */ o((e, t, r) => {
217
+ typeof t == "function" && (r = t, t = {}), t || (t = {});
218
+ let { pathEnv: n, pathExt: i, pathExtExe: s } = gr(e, t), a = [], c = /* @__PURE__ */ o((f) => new Promise((l, y) => {
219
+ if (f === n.length)
220
+ return t.all && a.length ? l(a) : y(hr(e));
221
+ let g = n[f], h = /^".*"$/.test(g) ? g.slice(1, -1) : g, b = dr.join(h, e), m = !h && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + b : b;
222
+ l(u(m, f, 0));
223
+ }), "step"), u = /* @__PURE__ */ o((f, l, y) => new Promise((g, h) => {
224
+ if (y === i.length)
225
+ return g(c(l + 1));
226
+ let b = i[y];
227
+ yr(f + b, { pathExt: s }, (m, x) => {
228
+ if (!m && x)
229
+ if (t.all)
230
+ a.push(f + b);
231
+ else
232
+ return g(f + b);
233
+ return g(u(f, l, y + 1));
234
+ });
235
+ }), "subStep");
236
+ return r ? c(0).then((f) => r(null, f), r) : c(0);
237
+ }, "which"), gi = /* @__PURE__ */ o((e, t) => {
238
+ t = t || {};
239
+ let { pathEnv: r, pathExt: n, pathExtExe: i } = gr(e, t), s = [];
240
+ for (let a = 0; a < r.length; a++) {
241
+ let c = r[a], u = /^".*"$/.test(c) ? c.slice(1, -1) : c, f = dr.join(u, e), l = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + f : f;
242
+ for (let y = 0; y < n.length; y++) {
243
+ let g = l + n[y];
244
+ try {
245
+ if (yr.sync(g, { pathExt: i }))
246
+ if (t.all)
247
+ s.push(g);
248
+ else
249
+ return g;
250
+ } catch {
251
+ }
252
+ }
253
+ }
254
+ if (t.all && s.length)
255
+ return s;
256
+ if (t.nothrow)
257
+ return null;
258
+ throw hr(e);
259
+ }, "whichSync");
260
+ xr.exports = br;
261
+ br.sync = gi;
262
+ });
263
+
264
+ // ../node_modules/path-key/index.js
265
+ var kr = w((Xa, Je) => {
266
+ "use strict";
267
+ var Sr = /* @__PURE__ */ o((e = {}) => {
268
+ let t = e.env || process.env;
269
+ return (e.platform || process.platform) !== "win32" ? "PATH" : Object.keys(t).reverse().find((n) => n.toUpperCase() === "PATH") || "Path";
270
+ }, "pathKey");
271
+ Je.exports = Sr;
272
+ Je.exports.default = Sr;
273
+ });
274
+
275
+ // ../node_modules/cross-spawn/lib/util/resolveCommand.js
276
+ var Tr = w((Za, vr) => {
277
+ "use strict";
278
+ var Er = require("path"), bi = wr(), xi = kr();
279
+ function Pr(e, t) {
280
+ let r = e.options.env || process.env, n = process.cwd(), i = e.options.cwd != null, s = i && process.chdir !== void 0 && !process.chdir.
281
+ disabled;
282
+ if (s)
283
+ try {
284
+ process.chdir(e.options.cwd);
285
+ } catch {
286
+ }
287
+ let a;
288
+ try {
289
+ a = bi.sync(e.command, {
290
+ path: r[xi({ env: r })],
291
+ pathExt: t ? Er.delimiter : void 0
292
+ });
293
+ } catch {
294
+ } finally {
295
+ s && process.chdir(n);
296
+ }
297
+ return a && (a = Er.resolve(i ? e.options.cwd : "", a)), a;
298
+ }
299
+ o(Pr, "resolveCommandAttempt");
300
+ function wi(e) {
301
+ return Pr(e) || Pr(e, !0);
302
+ }
303
+ o(wi, "resolveCommand");
304
+ vr.exports = wi;
305
+ });
306
+
307
+ // ../node_modules/cross-spawn/lib/util/escape.js
308
+ var Cr = w((tc, qe) => {
309
+ "use strict";
310
+ var Ve = /([()\][%!^"`<>&|;, *?])/g;
311
+ function Si(e) {
312
+ return e = e.replace(Ve, "^$1"), e;
313
+ }
314
+ o(Si, "escapeCommand");
315
+ function ki(e, t) {
316
+ return e = `${e}`, e = e.replace(/(\\*)"/g, '$1$1\\"'), e = e.replace(/(\\*)$/, "$1$1"), e = `"${e}"`, e = e.replace(Ve, "^$1"), t && (e =
317
+ e.replace(Ve, "^$1")), e;
318
+ }
319
+ o(ki, "escapeArgument");
320
+ qe.exports.command = Si;
321
+ qe.exports.argument = ki;
322
+ });
323
+
324
+ // ../node_modules/shebang-regex/index.js
325
+ var Ar = w((nc, Ir) => {
326
+ "use strict";
327
+ Ir.exports = /^#!(.*)/;
328
+ });
329
+
330
+ // ../node_modules/shebang-command/index.js
331
+ var jr = w((oc, Or) => {
332
+ "use strict";
333
+ var Ei = Ar();
334
+ Or.exports = (e = "") => {
335
+ let t = e.match(Ei);
336
+ if (!t)
337
+ return null;
338
+ let [r, n] = t[0].replace(/#! ?/, "").split(" "), i = r.split("/").pop();
339
+ return i === "env" ? n : n ? `${i} ${n}` : i;
340
+ };
341
+ });
342
+
343
+ // ../node_modules/cross-spawn/lib/util/readShebang.js
344
+ var Nr = w((ic, Rr) => {
345
+ "use strict";
346
+ var ze = require("fs"), Pi = jr();
347
+ function vi(e) {
348
+ let r = Buffer.alloc(150), n;
349
+ try {
350
+ n = ze.openSync(e, "r"), ze.readSync(n, r, 0, 150, 0), ze.closeSync(n);
351
+ } catch {
352
+ }
353
+ return Pi(r.toString());
354
+ }
355
+ o(vi, "readShebang");
356
+ Rr.exports = vi;
357
+ });
358
+
359
+ // ../node_modules/cross-spawn/lib/parse.js
360
+ var Lr = w((ac, Mr) => {
361
+ "use strict";
362
+ var Ti = require("path"), Dr = Tr(), _r = Cr(), Ci = Nr(), Ii = process.platform === "win32", Ai = /\.(?:com|exe)$/i, Oi = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
363
+ function ji(e) {
364
+ e.file = Dr(e);
365
+ let t = e.file && Ci(e.file);
366
+ return t ? (e.args.unshift(e.file), e.command = t, Dr(e)) : e.file;
367
+ }
368
+ o(ji, "detectShebang");
369
+ function Ri(e) {
370
+ if (!Ii)
371
+ return e;
372
+ let t = ji(e), r = !Ai.test(t);
373
+ if (e.options.forceShell || r) {
374
+ let n = Oi.test(t);
375
+ e.command = Ti.normalize(e.command), e.command = _r.command(e.command), e.args = e.args.map((s) => _r.argument(s, n));
376
+ let i = [e.command].concat(e.args).join(" ");
377
+ e.args = ["/d", "/s", "/c", `"${i}"`], e.command = process.env.comspec || "cmd.exe", e.options.windowsVerbatimArguments = !0;
378
+ }
379
+ return e;
380
+ }
381
+ o(Ri, "parseNonShell");
382
+ function Ni(e, t, r) {
383
+ t && !Array.isArray(t) && (r = t, t = null), t = t ? t.slice(0) : [], r = Object.assign({}, r);
384
+ let n = {
385
+ command: e,
386
+ args: t,
387
+ options: r,
388
+ file: void 0,
389
+ original: {
390
+ command: e,
391
+ args: t
392
+ }
393
+ };
394
+ return r.shell ? n : Ri(n);
395
+ }
396
+ o(Ni, "parse");
397
+ Mr.exports = Ni;
398
+ });
399
+
400
+ // ../node_modules/cross-spawn/lib/enoent.js
401
+ var Gr = w((uc, Br) => {
402
+ "use strict";
403
+ var Ye = process.platform === "win32";
404
+ function Ke(e, t) {
405
+ return Object.assign(new Error(`${t} ${e.command} ENOENT`), {
406
+ code: "ENOENT",
407
+ errno: "ENOENT",
408
+ syscall: `${t} ${e.command}`,
409
+ path: e.command,
410
+ spawnargs: e.args
411
+ });
412
+ }
413
+ o(Ke, "notFoundError");
414
+ function Di(e, t) {
415
+ if (!Ye)
416
+ return;
417
+ let r = e.emit;
418
+ e.emit = function(n, i) {
419
+ if (n === "exit") {
420
+ let s = Fr(i, t, "spawn");
421
+ if (s)
422
+ return r.call(e, "error", s);
423
+ }
424
+ return r.apply(e, arguments);
425
+ };
426
+ }
427
+ o(Di, "hookChildProcess");
428
+ function Fr(e, t) {
429
+ return Ye && e === 1 && !t.file ? Ke(t.original, "spawn") : null;
430
+ }
431
+ o(Fr, "verifyENOENT");
432
+ function _i(e, t) {
433
+ return Ye && e === 1 && !t.file ? Ke(t.original, "spawnSync") : null;
434
+ }
435
+ o(_i, "verifyENOENTSync");
436
+ Br.exports = {
437
+ hookChildProcess: Di,
438
+ verifyENOENT: Fr,
439
+ verifyENOENTSync: _i,
440
+ notFoundError: Ke
441
+ };
442
+ });
443
+
444
+ // ../node_modules/cross-spawn/index.js
445
+ var Wr = w((lc, _) => {
446
+ "use strict";
447
+ var Ur = require("child_process"), Xe = Lr(), Qe = Gr();
448
+ function $r(e, t, r) {
449
+ let n = Xe(e, t, r), i = Ur.spawn(n.command, n.args, n.options);
450
+ return Qe.hookChildProcess(i, n), i;
451
+ }
452
+ o($r, "spawn");
453
+ function Mi(e, t, r) {
454
+ let n = Xe(e, t, r), i = Ur.spawnSync(n.command, n.args, n.options);
455
+ return i.error = i.error || Qe.verifyENOENTSync(i.status, n), i;
456
+ }
457
+ o(Mi, "spawnSync");
458
+ _.exports = $r;
459
+ _.exports.spawn = $r;
460
+ _.exports.sync = Mi;
461
+ _.exports._parse = Xe;
462
+ _.exports._enoent = Qe;
463
+ });
464
+
465
+ // ../node_modules/merge-stream/index.js
466
+ var En = w((Iu, kn) => {
467
+ "use strict";
468
+ var { PassThrough: Ts } = require("stream");
469
+ kn.exports = function() {
470
+ var e = [], t = new Ts({ objectMode: !0 });
471
+ return t.setMaxListeners(0), t.add = r, t.isEmpty = n, t.on("unpipe", i), Array.prototype.slice.call(arguments).forEach(r), t;
472
+ function r(s) {
473
+ return Array.isArray(s) ? (s.forEach(r), this) : (e.push(s), s.once("end", i.bind(null, s)), s.once("error", t.emit.bind(t, "error")),
474
+ s.pipe(t, { end: !1 }), this);
475
+ }
476
+ o(r, "add");
477
+ function n() {
478
+ return e.length == 0;
479
+ }
480
+ o(n, "isEmpty");
481
+ function i(s) {
482
+ e = e.filter(function(a) {
483
+ return a !== s;
484
+ }), !e.length && t.readable && t.end();
485
+ }
486
+ o(i, "remove");
487
+ };
488
+ });
489
+
490
+ // ../node_modules/common-path-prefix/index.js
491
+ var Zn = w((uf, Qn) => {
492
+ "use strict";
493
+ var { sep: Gs } = require("path"), Us = /* @__PURE__ */ o((e) => {
494
+ for (let t of e) {
495
+ let r = /(\/|\\)/.exec(t);
496
+ if (r !== null) return r[0];
497
+ }
498
+ return Gs;
499
+ }, "determineSeparator");
500
+ Qn.exports = /* @__PURE__ */ o(function(t, r = Us(t)) {
501
+ let [n = "", ...i] = t;
502
+ if (n === "" || i.length === 0) return "";
503
+ let s = n.split(r), a = s.length;
504
+ for (let u of i) {
505
+ let f = u.split(r);
506
+ for (let l = 0; l < a; l++)
507
+ f[l] !== s[l] && (a = l);
508
+ if (a === 0) return "";
509
+ }
510
+ let c = s.slice(0, a).join(r);
511
+ return c.endsWith(r) ? c : c + r;
512
+ }, "commonPathPrefix");
513
+ });
514
+
515
+ // ../node_modules/fetch-retry/index.js
516
+ var Do = w((fp, No) => {
517
+ "use strict";
518
+ No.exports = function(e, t) {
519
+ if (t = t || {}, typeof e != "function")
520
+ throw new C("fetch must be a function");
521
+ if (typeof t != "object")
522
+ throw new C("defaults must be an object");
523
+ if (t.retries !== void 0 && !Ae(t.retries))
524
+ throw new C("retries must be a positive integer");
525
+ if (t.retryDelay !== void 0 && !Ae(t.retryDelay) && typeof t.retryDelay != "function")
526
+ throw new C("retryDelay must be a positive integer or a function returning a positive integer");
527
+ if (t.retryOn !== void 0 && !Array.isArray(t.retryOn) && typeof t.retryOn != "function")
528
+ throw new C("retryOn property expects an array or function");
529
+ var r = {
530
+ retries: 3,
531
+ retryDelay: 1e3,
532
+ retryOn: []
533
+ };
534
+ return t = Object.assign(r, t), /* @__PURE__ */ o(function(i, s) {
535
+ var a = t.retries, c = t.retryDelay, u = t.retryOn;
536
+ if (s && s.retries !== void 0)
537
+ if (Ae(s.retries))
538
+ a = s.retries;
539
+ else
540
+ throw new C("retries must be a positive integer");
541
+ if (s && s.retryDelay !== void 0)
542
+ if (Ae(s.retryDelay) || typeof s.retryDelay == "function")
543
+ c = s.retryDelay;
544
+ else
545
+ throw new C("retryDelay must be a positive integer or a function returning a positive integer");
546
+ if (s && s.retryOn)
547
+ if (Array.isArray(s.retryOn) || typeof s.retryOn == "function")
548
+ u = s.retryOn;
549
+ else
550
+ throw new C("retryOn property expects an array or function");
551
+ return new Promise(function(f, l) {
552
+ var y = /* @__PURE__ */ o(function(h) {
553
+ var b = typeof Request < "u" && i instanceof Request ? i.clone() : i;
554
+ e(b, s).then(function(m) {
555
+ if (Array.isArray(u) && u.indexOf(m.status) === -1)
556
+ f(m);
557
+ else if (typeof u == "function")
558
+ try {
559
+ return Promise.resolve(u(h, null, m)).then(function(x) {
560
+ x ? g(h, null, m) : f(m);
561
+ }).catch(l);
562
+ } catch (x) {
563
+ l(x);
564
+ }
565
+ else
566
+ h < a ? g(h, null, m) : f(m);
567
+ }).catch(function(m) {
568
+ if (typeof u == "function")
569
+ try {
570
+ Promise.resolve(u(h, m, null)).then(function(x) {
571
+ x ? g(h, m, null) : l(m);
572
+ }).catch(function(x) {
573
+ l(x);
574
+ });
575
+ } catch (x) {
576
+ l(x);
577
+ }
578
+ else h < a ? g(h, m, null) : l(m);
579
+ });
580
+ }, "wrappedFetch");
581
+ function g(h, b, m) {
582
+ var x = typeof c == "function" ? c(h, b, m) : c;
583
+ setTimeout(function() {
584
+ y(++h);
585
+ }, x);
586
+ }
587
+ o(g, "retry"), y(0);
588
+ });
589
+ }, "fetchRetry");
590
+ };
591
+ function Ae(e) {
592
+ return Number.isInteger(e) && e >= 0;
593
+ }
594
+ o(Ae, "isPositiveInteger");
595
+ function C(e) {
596
+ this.name = "ArgumentError", this.message = e;
597
+ }
598
+ o(C, "ArgumentError");
599
+ });
600
+
601
+ // src/telemetry/index.ts
602
+ var wa = {};
603
+ ei(wa, {
604
+ addToGlobalContext: () => qo,
605
+ cleanPaths: () => N,
606
+ computeStorybookMetadata: () => Ro,
607
+ getPrecedingUpgrade: () => Wo,
608
+ getStorybookMetadata: () => Nt,
609
+ isExampleStoryId: () => ba,
610
+ metaFrameworks: () => jt,
611
+ oneWayHash: () => Oe,
612
+ removeAnsiEscapeCodes: () => Me,
613
+ sanitizeAddonName: () => Rt,
614
+ sanitizeError: () => U,
615
+ telemetry: () => xa
616
+ });
617
+ module.exports = ti(wa);
618
+ var Bt = require("storybook/internal/node-logger");
619
+
620
+ // src/telemetry/notify.ts
621
+ var _e = require("storybook/internal/common"), oe = d(Wt(), 1);
622
+ var Ht = "telemetry-notification-date", R = console, Jt = /* @__PURE__ */ o(async () => {
623
+ await _e.cache.get(Ht, null) || (_e.cache.set(Ht, Date.now()), R.log(), R.log(
624
+ `${oe.default.magenta(
625
+ oe.default.bold("attention")
626
+ )} => Storybook now collects completely anonymous telemetry regarding usage.`
627
+ ), R.log("This information is used to shape Storybook's roadmap and prioritize features."), R.log(
628
+ "You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:"
629
+ ), R.log(oe.default.cyan("https://storybook.js.org/telemetry")), R.log());
630
+ }, "notify");
631
+
632
+ // src/telemetry/sanitize.ts
633
+ var Le = d(require("node:path"), 1);
634
+ function Vt(e) {
635
+ return e.replace(/[-[/{}()*+?.\\^$|]/g, "\\$&");
636
+ }
637
+ o(Vt, "regexpEscape");
638
+ function Me(e = "") {
639
+ return e.replace(/\u001B\[[0-9;]*m/g, "");
640
+ }
641
+ o(Me, "removeAnsiEscapeCodes");
642
+ function N(e, t = Le.default.sep) {
643
+ if (!e)
644
+ return e;
645
+ let r = process.cwd().split(t);
646
+ for (; r.length > 1; ) {
647
+ let n = r.join(t), i = new RegExp(Vt(n), "gi");
648
+ e = e.replace(i, "$SNIP");
649
+ let s = r.join(t + t), a = new RegExp(Vt(s), "gi");
650
+ e = e.replace(a, "$SNIP"), r.pop();
651
+ }
652
+ return e;
653
+ }
654
+ o(N, "cleanPaths");
655
+ function U(e, t = Le.default.sep) {
656
+ try {
657
+ e = {
658
+ ...JSON.parse(JSON.stringify(e)),
659
+ message: Me(e.message),
660
+ stack: Me(e.stack),
661
+ cause: e.cause,
662
+ name: e.name
663
+ };
664
+ let r = N(JSON.stringify(e), t);
665
+ return JSON.parse(r);
666
+ } catch (r) {
667
+ return `Sanitization error: ${r?.message}`;
668
+ }
669
+ }
670
+ o(U, "sanitizeError");
671
+
672
+ // src/telemetry/storybook-metadata.ts
673
+ var Oo = require("node:path"), P = require("storybook/internal/common"), jo = require("storybook/internal/csf-tools");
674
+
675
+ // ../node_modules/fd-package-json/dist/esm/main.js
676
+ var Yt = d(zt(), 1), Kt = require("node:path"), se = require("node:fs/promises"), Xt = require("node:fs");
677
+ async function si(e) {
678
+ try {
679
+ return (await (0, se.stat)(e)).isFile();
680
+ } catch {
681
+ return !1;
682
+ }
683
+ }
684
+ o(si, "fileExists");
685
+ async function Fe(e) {
686
+ for (let t of (0, Yt.walkUp)(e)) {
687
+ let r = (0, Kt.resolve)(t, "package.json");
688
+ if (await si(r))
689
+ return r;
690
+ }
691
+ return null;
692
+ }
693
+ o(Fe, "findPackagePath");
694
+ async function Qt(e) {
695
+ let t = await Fe(e);
696
+ if (!t)
697
+ return null;
698
+ try {
699
+ let r = await (0, se.readFile)(t, { encoding: "utf8" });
700
+ return JSON.parse(r);
701
+ } catch {
702
+ return null;
703
+ }
704
+ }
705
+ o(Qt, "findPackage");
706
+
707
+ // ../node_modules/package-manager-detector/dist/constants.mjs
708
+ var Zt = [
709
+ "npm",
710
+ "yarn",
711
+ "yarn@berry",
712
+ "pnpm",
713
+ "pnpm@6",
714
+ "bun",
715
+ "deno"
716
+ ], Be = {
717
+ "bun.lock": "bun",
718
+ "bun.lockb": "bun",
719
+ "deno.lock": "deno",
720
+ "pnpm-lock.yaml": "pnpm",
721
+ "yarn.lock": "yarn",
722
+ "package-lock.json": "npm",
723
+ "npm-shrinkwrap.json": "npm"
724
+ }, Ge = {
725
+ "node_modules/.deno/": "deno",
726
+ "node_modules/.pnpm/": "pnpm",
727
+ "node_modules/.yarn-state.yml": "yarn",
728
+ // yarn v2+ (node-modules)
729
+ "node_modules/.yarn_integrity": "yarn",
730
+ // yarn v1
731
+ "node_modules/.package-lock.json": "npm",
732
+ ".pnp.cjs": "yarn",
733
+ // yarn v3+ (pnp)
734
+ ".pnp.js": "yarn",
735
+ // yarn v2 (pnp)
736
+ "bun.lock": "bun",
737
+ "bun.lockb": "bun"
738
+ };
739
+
740
+ // ../node_modules/package-manager-detector/dist/detect.mjs
741
+ var $e = d(require("node:fs/promises"), 1), T = d(require("node:path"), 1), tr = d(require("node:process"), 1);
742
+ async function Ue(e, t) {
743
+ try {
744
+ let r = await $e.default.stat(e);
745
+ return t === "file" ? r.isFile() : r.isDirectory();
746
+ } catch {
747
+ return !1;
748
+ }
749
+ }
750
+ o(Ue, "pathExists");
751
+ function* ai(e = tr.default.cwd()) {
752
+ let t = T.default.resolve(e), { root: r } = T.default.parse(t);
753
+ for (; t && t !== r; )
754
+ yield t, t = T.default.dirname(t);
755
+ }
756
+ o(ai, "lookup");
757
+ async function er(e, t) {
758
+ return !e || !Ue(e, "file") ? null : await ui(e, t);
759
+ }
760
+ o(er, "parsePackageJson");
761
+ async function We(e = {}) {
762
+ let { cwd: t, strategies: r = ["lockfile", "packageManager-field", "devEngines-field"], onUnknown: n } = e;
763
+ for (let i of ai(t))
764
+ for (let s of r)
765
+ switch (s) {
766
+ case "lockfile": {
767
+ for (let a of Object.keys(Be))
768
+ if (await Ue(T.default.join(i, a), "file")) {
769
+ let c = Be[a], u = await er(T.default.join(i, "package.json"), n);
770
+ return u || { name: c, agent: c };
771
+ }
772
+ break;
773
+ }
774
+ case "packageManager-field":
775
+ case "devEngines-field": {
776
+ let a = await er(T.default.join(i, "package.json"), n);
777
+ if (a)
778
+ return a;
779
+ break;
780
+ }
781
+ case "install-metadata": {
782
+ for (let a of Object.keys(Ge)) {
783
+ let c = a.endsWith("/") ? "dir" : "file";
784
+ if (await Ue(T.default.join(i, a), c)) {
785
+ let u = Ge[a], f = u === "yarn" ? fi(a) ? "yarn" : "yarn@berry" : u;
786
+ return { name: u, agent: f };
787
+ }
788
+ }
789
+ break;
790
+ }
791
+ }
792
+ return null;
793
+ }
794
+ o(We, "detect");
795
+ function ci(e) {
796
+ let t = /* @__PURE__ */ o((r) => r?.match(/\d+(\.\d+){0,2}/)?.[0] ?? r, "handelVer");
797
+ if (typeof e.packageManager == "string") {
798
+ let [r, n] = e.packageManager.replace(/^\^/, "").split("@");
799
+ return { name: r, ver: t(n) };
800
+ }
801
+ if (typeof e.devEngines?.packageManager?.name == "string")
802
+ return {
803
+ name: e.devEngines.packageManager.name,
804
+ ver: t(e.devEngines.packageManager.version)
805
+ };
806
+ }
807
+ o(ci, "getNameAndVer");
808
+ async function ui(e, t) {
809
+ try {
810
+ let r = JSON.parse(await $e.default.readFile(e, "utf8")), n, i = ci(r);
811
+ if (i) {
812
+ let s = i.name, a = i.ver, c = a;
813
+ return s === "yarn" && a && Number.parseInt(a) > 1 ? (n = "yarn@berry", c = "berry", { name: s, agent: n, version: c }) : s === "pnpm" &&
814
+ a && Number.parseInt(a) < 7 ? (n = "pnpm@6", { name: s, agent: n, version: c }) : Zt.includes(s) ? (n = s, { name: s, agent: n, version: c }) :
815
+ t?.(r.packageManager) ?? null;
816
+ }
817
+ } catch {
818
+ }
819
+ return null;
820
+ }
821
+ o(ui, "handlePackageManager");
822
+ function fi(e) {
823
+ return e.endsWith(".yarn_integrity");
824
+ }
825
+ o(fi, "isMetadataYarnClassic");
826
+
827
+ // ../node_modules/package-manager-detector/dist/index.mjs
828
+ var La = require("node:fs/promises"), Fa = require("node:path"), Ba = require("node:process");
829
+
830
+ // src/telemetry/get-application-file-count.ts
831
+ var ho = require("node:path");
832
+
833
+ // src/telemetry/exec-command-count-lines.ts
834
+ var Kn = require("node:readline");
835
+
836
+ // node_modules/execa/index.js
837
+ var Wn = require("node:buffer"), Hn = d(require("node:path"), 1), Se = d(require("node:child_process"), 1), J = d(require("node:process"), 1),
838
+ Jn = d(Wr(), 1);
839
+
840
+ // ../node_modules/strip-final-newline/index.js
841
+ function Ze(e) {
842
+ let t = typeof e == "string" ? `
843
+ ` : 10, r = typeof e == "string" ? "\r" : 13;
844
+ return e[e.length - 1] === t && (e = e.slice(0, -1)), e[e.length - 1] === r && (e = e.slice(0, -1)), e;
845
+ }
846
+ o(Ze, "stripFinalNewline");
847
+
848
+ // node_modules/npm-run-path/index.js
849
+ var $ = d(require("node:process"), 1), M = d(require("node:path"), 1), Hr = d(require("node:url"), 1);
850
+
851
+ // node_modules/path-key/index.js
852
+ function ce(e = {}) {
853
+ let {
854
+ env: t = process.env,
855
+ platform: r = process.platform
856
+ } = e;
857
+ return r !== "win32" ? "PATH" : Object.keys(t).reverse().find((n) => n.toUpperCase() === "PATH") || "Path";
858
+ }
859
+ o(ce, "pathKey");
860
+
861
+ // node_modules/npm-run-path/index.js
862
+ function Li(e = {}) {
863
+ let {
864
+ cwd: t = $.default.cwd(),
865
+ path: r = $.default.env[ce()],
866
+ execPath: n = $.default.execPath
867
+ } = e, i, s = t instanceof URL ? Hr.default.fileURLToPath(t) : t, a = M.default.resolve(s), c = [];
868
+ for (; i !== a; )
869
+ c.push(M.default.join(a, "node_modules/.bin")), i = a, a = M.default.resolve(a, "..");
870
+ return c.push(M.default.resolve(s, n, "..")), [...c, r].join(M.default.delimiter);
871
+ }
872
+ o(Li, "npmRunPath");
873
+ function Jr({ env: e = $.default.env, ...t } = {}) {
874
+ e = { ...e };
875
+ let r = ce({ env: e });
876
+ return t.path = e[r], e[r] = Li(t), e;
877
+ }
878
+ o(Jr, "npmRunPathEnv");
879
+
880
+ // node_modules/mimic-fn/index.js
881
+ var Fi = /* @__PURE__ */ o((e, t, r, n) => {
882
+ if (r === "length" || r === "prototype" || r === "arguments" || r === "caller")
883
+ return;
884
+ let i = Object.getOwnPropertyDescriptor(e, r), s = Object.getOwnPropertyDescriptor(t, r);
885
+ !Bi(i, s) && n || Object.defineProperty(e, r, s);
886
+ }, "copyProperty"), Bi = /* @__PURE__ */ o(function(e, t) {
887
+ return e === void 0 || e.configurable || e.writable === t.writable && e.enumerable === t.enumerable && e.configurable === t.configurable &&
888
+ (e.writable || e.value === t.value);
889
+ }, "canCopyProperty"), Gi = /* @__PURE__ */ o((e, t) => {
890
+ let r = Object.getPrototypeOf(t);
891
+ r !== Object.getPrototypeOf(e) && Object.setPrototypeOf(e, r);
892
+ }, "changePrototype"), Ui = /* @__PURE__ */ o((e, t) => `/* Wrapped ${e}*/
893
+ ${t}`, "wrappedToString"), $i = Object.getOwnPropertyDescriptor(Function.prototype, "toString"), Wi = Object.getOwnPropertyDescriptor(Function.
894
+ prototype.toString, "name"), Hi = /* @__PURE__ */ o((e, t, r) => {
895
+ let n = r === "" ? "" : `with ${r.trim()}() `, i = Ui.bind(null, n, t.toString());
896
+ Object.defineProperty(i, "name", Wi), Object.defineProperty(e, "toString", { ...$i, value: i });
897
+ }, "changeToString");
898
+ function et(e, t, { ignoreNonConfigurable: r = !1 } = {}) {
899
+ let { name: n } = e;
900
+ for (let i of Reflect.ownKeys(t))
901
+ Fi(e, t, i, r);
902
+ return Gi(e, t), Hi(e, t, n), e;
903
+ }
904
+ o(et, "mimicFunction");
905
+
906
+ // node_modules/onetime/index.js
907
+ var ue = /* @__PURE__ */ new WeakMap(), Vr = /* @__PURE__ */ o((e, t = {}) => {
908
+ if (typeof e != "function")
909
+ throw new TypeError("Expected a function");
910
+ let r, n = 0, i = e.displayName || e.name || "<anonymous>", s = /* @__PURE__ */ o(function(...a) {
911
+ if (ue.set(s, ++n), n === 1)
912
+ r = e.apply(this, a), e = null;
913
+ else if (t.throw === !0)
914
+ throw new Error(`Function \`${i}\` can only be called once`);
915
+ return r;
916
+ }, "onetime");
917
+ return et(s, e), ue.set(s, n), s;
918
+ }, "onetime");
919
+ Vr.callCount = (e) => {
920
+ if (!ue.has(e))
921
+ throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);
922
+ return ue.get(e);
923
+ };
924
+ var qr = Vr;
925
+
926
+ // node_modules/execa/lib/error.js
927
+ var en = d(require("node:process"), 1);
928
+
929
+ // node_modules/human-signals/build/src/main.js
930
+ var Qr = require("node:os");
931
+
932
+ // node_modules/human-signals/build/src/realtime.js
933
+ var zr = /* @__PURE__ */ o(() => {
934
+ let e = tt - Yr + 1;
935
+ return Array.from({ length: e }, Ji);
936
+ }, "getRealtimeSignals"), Ji = /* @__PURE__ */ o((e, t) => ({
937
+ name: `SIGRT${t + 1}`,
938
+ number: Yr + t,
939
+ action: "terminate",
940
+ description: "Application-specific signal (realtime)",
941
+ standard: "posix"
942
+ }), "getRealtimeSignal"), Yr = 34, tt = 64;
943
+
944
+ // node_modules/human-signals/build/src/signals.js
945
+ var Xr = require("node:os");
946
+
947
+ // node_modules/human-signals/build/src/core.js
948
+ var Kr = [
949
+ {
950
+ name: "SIGHUP",
951
+ number: 1,
952
+ action: "terminate",
953
+ description: "Terminal closed",
954
+ standard: "posix"
955
+ },
956
+ {
957
+ name: "SIGINT",
958
+ number: 2,
959
+ action: "terminate",
960
+ description: "User interruption with CTRL-C",
961
+ standard: "ansi"
962
+ },
963
+ {
964
+ name: "SIGQUIT",
965
+ number: 3,
966
+ action: "core",
967
+ description: "User interruption with CTRL-\\",
968
+ standard: "posix"
969
+ },
970
+ {
971
+ name: "SIGILL",
972
+ number: 4,
973
+ action: "core",
974
+ description: "Invalid machine instruction",
975
+ standard: "ansi"
976
+ },
977
+ {
978
+ name: "SIGTRAP",
979
+ number: 5,
980
+ action: "core",
981
+ description: "Debugger breakpoint",
982
+ standard: "posix"
983
+ },
984
+ {
985
+ name: "SIGABRT",
986
+ number: 6,
987
+ action: "core",
988
+ description: "Aborted",
989
+ standard: "ansi"
990
+ },
991
+ {
992
+ name: "SIGIOT",
993
+ number: 6,
994
+ action: "core",
995
+ description: "Aborted",
996
+ standard: "bsd"
997
+ },
998
+ {
999
+ name: "SIGBUS",
1000
+ number: 7,
1001
+ action: "core",
1002
+ description: "Bus error due to misaligned, non-existing address or paging error",
1003
+ standard: "bsd"
1004
+ },
1005
+ {
1006
+ name: "SIGEMT",
1007
+ number: 7,
1008
+ action: "terminate",
1009
+ description: "Command should be emulated but is not implemented",
1010
+ standard: "other"
1011
+ },
1012
+ {
1013
+ name: "SIGFPE",
1014
+ number: 8,
1015
+ action: "core",
1016
+ description: "Floating point arithmetic error",
1017
+ standard: "ansi"
1018
+ },
1019
+ {
1020
+ name: "SIGKILL",
1021
+ number: 9,
1022
+ action: "terminate",
1023
+ description: "Forced termination",
1024
+ standard: "posix",
1025
+ forced: !0
1026
+ },
1027
+ {
1028
+ name: "SIGUSR1",
1029
+ number: 10,
1030
+ action: "terminate",
1031
+ description: "Application-specific signal",
1032
+ standard: "posix"
1033
+ },
1034
+ {
1035
+ name: "SIGSEGV",
1036
+ number: 11,
1037
+ action: "core",
1038
+ description: "Segmentation fault",
1039
+ standard: "ansi"
1040
+ },
1041
+ {
1042
+ name: "SIGUSR2",
1043
+ number: 12,
1044
+ action: "terminate",
1045
+ description: "Application-specific signal",
1046
+ standard: "posix"
1047
+ },
1048
+ {
1049
+ name: "SIGPIPE",
1050
+ number: 13,
1051
+ action: "terminate",
1052
+ description: "Broken pipe or socket",
1053
+ standard: "posix"
1054
+ },
1055
+ {
1056
+ name: "SIGALRM",
1057
+ number: 14,
1058
+ action: "terminate",
1059
+ description: "Timeout or timer",
1060
+ standard: "posix"
1061
+ },
1062
+ {
1063
+ name: "SIGTERM",
1064
+ number: 15,
1065
+ action: "terminate",
1066
+ description: "Termination",
1067
+ standard: "ansi"
1068
+ },
1069
+ {
1070
+ name: "SIGSTKFLT",
1071
+ number: 16,
1072
+ action: "terminate",
1073
+ description: "Stack is empty or overflowed",
1074
+ standard: "other"
1075
+ },
1076
+ {
1077
+ name: "SIGCHLD",
1078
+ number: 17,
1079
+ action: "ignore",
1080
+ description: "Child process terminated, paused or unpaused",
1081
+ standard: "posix"
1082
+ },
1083
+ {
1084
+ name: "SIGCLD",
1085
+ number: 17,
1086
+ action: "ignore",
1087
+ description: "Child process terminated, paused or unpaused",
1088
+ standard: "other"
1089
+ },
1090
+ {
1091
+ name: "SIGCONT",
1092
+ number: 18,
1093
+ action: "unpause",
1094
+ description: "Unpaused",
1095
+ standard: "posix",
1096
+ forced: !0
1097
+ },
1098
+ {
1099
+ name: "SIGSTOP",
1100
+ number: 19,
1101
+ action: "pause",
1102
+ description: "Paused",
1103
+ standard: "posix",
1104
+ forced: !0
1105
+ },
1106
+ {
1107
+ name: "SIGTSTP",
1108
+ number: 20,
1109
+ action: "pause",
1110
+ description: 'Paused using CTRL-Z or "suspend"',
1111
+ standard: "posix"
1112
+ },
1113
+ {
1114
+ name: "SIGTTIN",
1115
+ number: 21,
1116
+ action: "pause",
1117
+ description: "Background process cannot read terminal input",
1118
+ standard: "posix"
1119
+ },
1120
+ {
1121
+ name: "SIGBREAK",
1122
+ number: 21,
1123
+ action: "terminate",
1124
+ description: "User interruption with CTRL-BREAK",
1125
+ standard: "other"
1126
+ },
1127
+ {
1128
+ name: "SIGTTOU",
1129
+ number: 22,
1130
+ action: "pause",
1131
+ description: "Background process cannot write to terminal output",
1132
+ standard: "posix"
1133
+ },
1134
+ {
1135
+ name: "SIGURG",
1136
+ number: 23,
1137
+ action: "ignore",
1138
+ description: "Socket received out-of-band data",
1139
+ standard: "bsd"
1140
+ },
1141
+ {
1142
+ name: "SIGXCPU",
1143
+ number: 24,
1144
+ action: "core",
1145
+ description: "Process timed out",
1146
+ standard: "bsd"
1147
+ },
1148
+ {
1149
+ name: "SIGXFSZ",
1150
+ number: 25,
1151
+ action: "core",
1152
+ description: "File too big",
1153
+ standard: "bsd"
1154
+ },
1155
+ {
1156
+ name: "SIGVTALRM",
1157
+ number: 26,
1158
+ action: "terminate",
1159
+ description: "Timeout or timer",
1160
+ standard: "bsd"
1161
+ },
1162
+ {
1163
+ name: "SIGPROF",
1164
+ number: 27,
1165
+ action: "terminate",
1166
+ description: "Timeout or timer",
1167
+ standard: "bsd"
1168
+ },
1169
+ {
1170
+ name: "SIGWINCH",
1171
+ number: 28,
1172
+ action: "ignore",
1173
+ description: "Terminal window size changed",
1174
+ standard: "bsd"
1175
+ },
1176
+ {
1177
+ name: "SIGIO",
1178
+ number: 29,
1179
+ action: "terminate",
1180
+ description: "I/O is available",
1181
+ standard: "other"
1182
+ },
1183
+ {
1184
+ name: "SIGPOLL",
1185
+ number: 29,
1186
+ action: "terminate",
1187
+ description: "Watched event",
1188
+ standard: "other"
1189
+ },
1190
+ {
1191
+ name: "SIGINFO",
1192
+ number: 29,
1193
+ action: "ignore",
1194
+ description: "Request for process information",
1195
+ standard: "other"
1196
+ },
1197
+ {
1198
+ name: "SIGPWR",
1199
+ number: 30,
1200
+ action: "terminate",
1201
+ description: "Device running out of power",
1202
+ standard: "systemv"
1203
+ },
1204
+ {
1205
+ name: "SIGSYS",
1206
+ number: 31,
1207
+ action: "core",
1208
+ description: "Invalid system call",
1209
+ standard: "other"
1210
+ },
1211
+ {
1212
+ name: "SIGUNUSED",
1213
+ number: 31,
1214
+ action: "terminate",
1215
+ description: "Invalid system call",
1216
+ standard: "other"
1217
+ }
1218
+ ];
1219
+
1220
+ // node_modules/human-signals/build/src/signals.js
1221
+ var rt = /* @__PURE__ */ o(() => {
1222
+ let e = zr();
1223
+ return [...Kr, ...e].map(Vi);
1224
+ }, "getSignals"), Vi = /* @__PURE__ */ o(({
1225
+ name: e,
1226
+ number: t,
1227
+ description: r,
1228
+ action: n,
1229
+ forced: i = !1,
1230
+ standard: s
1231
+ }) => {
1232
+ let {
1233
+ signals: { [e]: a }
1234
+ } = Xr.constants, c = a !== void 0;
1235
+ return { name: e, number: c ? a : t, description: r, supported: c, action: n, forced: i, standard: s };
1236
+ }, "normalizeSignal");
1237
+
1238
+ // node_modules/human-signals/build/src/main.js
1239
+ var qi = /* @__PURE__ */ o(() => {
1240
+ let e = rt();
1241
+ return Object.fromEntries(e.map(zi));
1242
+ }, "getSignalsByName"), zi = /* @__PURE__ */ o(({
1243
+ name: e,
1244
+ number: t,
1245
+ description: r,
1246
+ supported: n,
1247
+ action: i,
1248
+ forced: s,
1249
+ standard: a
1250
+ }) => [e, { name: e, number: t, description: r, supported: n, action: i, forced: s, standard: a }], "getSignalByName"), Zr = qi(), Yi = /* @__PURE__ */ o(
1251
+ () => {
1252
+ let e = rt(), t = tt + 1, r = Array.from(
1253
+ { length: t },
1254
+ (n, i) => Ki(i, e)
1255
+ );
1256
+ return Object.assign({}, ...r);
1257
+ }, "getSignalsByNumber"), Ki = /* @__PURE__ */ o((e, t) => {
1258
+ let r = Xi(e, t);
1259
+ if (r === void 0)
1260
+ return {};
1261
+ let { name: n, description: i, supported: s, action: a, forced: c, standard: u } = r;
1262
+ return {
1263
+ [e]: {
1264
+ name: n,
1265
+ number: e,
1266
+ description: i,
1267
+ supported: s,
1268
+ action: a,
1269
+ forced: c,
1270
+ standard: u
1271
+ }
1272
+ };
1273
+ }, "getSignalByNumber"), Xi = /* @__PURE__ */ o((e, t) => {
1274
+ let r = t.find(({ name: n }) => Qr.constants.signals[n] === e);
1275
+ return r !== void 0 ? r : t.find((n) => n.number === e);
1276
+ }, "findSignalByNumber"), Dc = Yi();
1277
+
1278
+ // node_modules/execa/lib/error.js
1279
+ var Qi = /* @__PURE__ */ o(({ timedOut: e, timeout: t, errorCode: r, signal: n, signalDescription: i, exitCode: s, isCanceled: a }) => e ? `\
1280
+ timed out after ${t} milliseconds` : a ? "was canceled" : r !== void 0 ? `failed with ${r}` : n !== void 0 ? `was killed with ${n} (${i})` :
1281
+ s !== void 0 ? `failed with exit code ${s}` : "failed", "getErrorPrefix"), W = /* @__PURE__ */ o(({
1282
+ stdout: e,
1283
+ stderr: t,
1284
+ all: r,
1285
+ error: n,
1286
+ signal: i,
1287
+ exitCode: s,
1288
+ command: a,
1289
+ escapedCommand: c,
1290
+ timedOut: u,
1291
+ isCanceled: f,
1292
+ killed: l,
1293
+ parsed: { options: { timeout: y, cwd: g = en.default.cwd() } }
1294
+ }) => {
1295
+ s = s === null ? void 0 : s, i = i === null ? void 0 : i;
1296
+ let h = i === void 0 ? void 0 : Zr[i].description, b = n && n.code, x = `Command ${Qi({ timedOut: u, timeout: y, errorCode: b, signal: i, signalDescription: h,
1297
+ exitCode: s, isCanceled: f })}: ${a}`, O = Object.prototype.toString.call(n) === "[object Error]", v = O ? `${x}
1298
+ ${n.message}` : x, j = [v, t, e].filter(Boolean).join(`
1299
+ `);
1300
+ return O ? (n.originalMessage = n.message, n.message = j) : n = new Error(j), n.shortMessage = v, n.command = a, n.escapedCommand = c, n.exitCode =
1301
+ s, n.signal = i, n.signalDescription = h, n.stdout = e, n.stderr = t, n.cwd = g, r !== void 0 && (n.all = r), "bufferedData" in n && delete n.
1302
+ bufferedData, n.failed = !0, n.timedOut = !!u, n.isCanceled = f, n.killed = l && !u, n;
1303
+ }, "makeError");
1304
+
1305
+ // node_modules/execa/lib/stdio.js
1306
+ var fe = ["stdin", "stdout", "stderr"], Zi = /* @__PURE__ */ o((e) => fe.some((t) => e[t] !== void 0), "hasAlias"), tn = /* @__PURE__ */ o((e) => {
1307
+ if (!e)
1308
+ return;
1309
+ let { stdio: t } = e;
1310
+ if (t === void 0)
1311
+ return fe.map((n) => e[n]);
1312
+ if (Zi(e))
1313
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${fe.map((n) => `\`${n}\``).join(", ")}`);
1314
+ if (typeof t == "string")
1315
+ return t;
1316
+ if (!Array.isArray(t))
1317
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);
1318
+ let r = Math.max(t.length, fe.length);
1319
+ return Array.from({ length: r }, (n, i) => t[i]);
1320
+ }, "normalizeStdio");
1321
+
1322
+ // node_modules/execa/lib/kill.js
1323
+ var nn = d(require("node:os"), 1);
1324
+
1325
+ // node_modules/signal-exit/dist/mjs/signals.js
1326
+ var I = [];
1327
+ I.push("SIGHUP", "SIGINT", "SIGTERM");
1328
+ process.platform !== "win32" && I.push(
1329
+ "SIGALRM",
1330
+ "SIGABRT",
1331
+ "SIGVTALRM",
1332
+ "SIGXCPU",
1333
+ "SIGXFSZ",
1334
+ "SIGUSR2",
1335
+ "SIGTRAP",
1336
+ "SIGSYS",
1337
+ "SIGQUIT",
1338
+ "SIGIOT"
1339
+ // should detect profiler and enable/disable accordingly.
1340
+ // see #21
1341
+ // 'SIGPROF'
1342
+ );
1343
+ process.platform === "linux" && I.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1344
+
1345
+ // node_modules/signal-exit/dist/mjs/index.js
1346
+ var le = /* @__PURE__ */ o((e) => !!e && typeof e == "object" && typeof e.removeListener == "function" && typeof e.emit == "function" && typeof e.
1347
+ reallyExit == "function" && typeof e.listeners == "function" && typeof e.kill == "function" && typeof e.pid == "number" && typeof e.on == "f\
1348
+ unction", "processOk"), nt = Symbol.for("signal-exit emitter"), ot = globalThis, es = Object.defineProperty.bind(Object), it = class {
1349
+ static {
1350
+ o(this, "Emitter");
1351
+ }
1352
+ emitted = {
1353
+ afterExit: !1,
1354
+ exit: !1
1355
+ };
1356
+ listeners = {
1357
+ afterExit: [],
1358
+ exit: []
1359
+ };
1360
+ count = 0;
1361
+ id = Math.random();
1362
+ constructor() {
1363
+ if (ot[nt])
1364
+ return ot[nt];
1365
+ es(ot, nt, {
1366
+ value: this,
1367
+ writable: !1,
1368
+ enumerable: !1,
1369
+ configurable: !1
1370
+ });
1371
+ }
1372
+ on(t, r) {
1373
+ this.listeners[t].push(r);
1374
+ }
1375
+ removeListener(t, r) {
1376
+ let n = this.listeners[t], i = n.indexOf(r);
1377
+ i !== -1 && (i === 0 && n.length === 1 ? n.length = 0 : n.splice(i, 1));
1378
+ }
1379
+ emit(t, r, n) {
1380
+ if (this.emitted[t])
1381
+ return !1;
1382
+ this.emitted[t] = !0;
1383
+ let i = !1;
1384
+ for (let s of this.listeners[t])
1385
+ i = s(r, n) === !0 || i;
1386
+ return t === "exit" && (i = this.emit("afterExit", r, n) || i), i;
1387
+ }
1388
+ }, pe = class {
1389
+ static {
1390
+ o(this, "SignalExitBase");
1391
+ }
1392
+ }, ts = /* @__PURE__ */ o((e) => ({
1393
+ onExit(t, r) {
1394
+ return e.onExit(t, r);
1395
+ },
1396
+ load() {
1397
+ return e.load();
1398
+ },
1399
+ unload() {
1400
+ return e.unload();
1401
+ }
1402
+ }), "signalExitWrap"), st = class extends pe {
1403
+ static {
1404
+ o(this, "SignalExitFallback");
1405
+ }
1406
+ onExit() {
1407
+ return () => {
1408
+ };
1409
+ }
1410
+ load() {
1411
+ }
1412
+ unload() {
1413
+ }
1414
+ }, at = class extends pe {
1415
+ static {
1416
+ o(this, "SignalExit");
1417
+ }
1418
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1419
+ // so use a supported signal instead
1420
+ /* c8 ignore start */
1421
+ #s = ct.platform === "win32" ? "SIGINT" : "SIGHUP";
1422
+ /* c8 ignore stop */
1423
+ #t = new it();
1424
+ #e;
1425
+ #o;
1426
+ #i;
1427
+ #n = {};
1428
+ #r = !1;
1429
+ constructor(t) {
1430
+ super(), this.#e = t, this.#n = {};
1431
+ for (let r of I)
1432
+ this.#n[r] = () => {
1433
+ let n = this.#e.listeners(r), { count: i } = this.#t, s = t;
1434
+ if (typeof s.__signal_exit_emitter__ == "object" && typeof s.__signal_exit_emitter__.count == "number" && (i += s.__signal_exit_emitter__.
1435
+ count), n.length === i) {
1436
+ this.unload();
1437
+ let a = this.#t.emit("exit", null, r), c = r === "SIGHUP" ? this.#s : r;
1438
+ a || t.kill(t.pid, c);
1439
+ }
1440
+ };
1441
+ this.#i = t.reallyExit, this.#o = t.emit;
1442
+ }
1443
+ onExit(t, r) {
1444
+ if (!le(this.#e))
1445
+ return () => {
1446
+ };
1447
+ this.#r === !1 && this.load();
1448
+ let n = r?.alwaysLast ? "afterExit" : "exit";
1449
+ return this.#t.on(n, t), () => {
1450
+ this.#t.removeListener(n, t), this.#t.listeners.exit.length === 0 && this.#t.listeners.afterExit.length === 0 && this.unload();
1451
+ };
1452
+ }
1453
+ load() {
1454
+ if (!this.#r) {
1455
+ this.#r = !0, this.#t.count += 1;
1456
+ for (let t of I)
1457
+ try {
1458
+ let r = this.#n[t];
1459
+ r && this.#e.on(t, r);
1460
+ } catch {
1461
+ }
1462
+ this.#e.emit = (t, ...r) => this.#c(t, ...r), this.#e.reallyExit = (t) => this.#a(t);
1463
+ }
1464
+ }
1465
+ unload() {
1466
+ this.#r && (this.#r = !1, I.forEach((t) => {
1467
+ let r = this.#n[t];
1468
+ if (!r)
1469
+ throw new Error("Listener not defined for signal: " + t);
1470
+ try {
1471
+ this.#e.removeListener(t, r);
1472
+ } catch {
1473
+ }
1474
+ }), this.#e.emit = this.#o, this.#e.reallyExit = this.#i, this.#t.count -= 1);
1475
+ }
1476
+ #a(t) {
1477
+ return le(this.#e) ? (this.#e.exitCode = t || 0, this.#t.emit("exit", this.#e.exitCode, null), this.#i.call(this.#e, this.#e.exitCode)) :
1478
+ 0;
1479
+ }
1480
+ #c(t, ...r) {
1481
+ let n = this.#o;
1482
+ if (t === "exit" && le(this.#e)) {
1483
+ typeof r[0] == "number" && (this.#e.exitCode = r[0]);
1484
+ let i = n.call(this.#e, t, ...r);
1485
+ return this.#t.emit("exit", this.#e.exitCode, null), i;
1486
+ } else
1487
+ return n.call(this.#e, t, ...r);
1488
+ }
1489
+ }, ct = globalThis.process, {
1490
+ /**
1491
+ * Called when the process is exiting, whether via signal, explicit
1492
+ * exit, or running out of stuff to do.
1493
+ *
1494
+ * If the global process object is not suitable for instrumentation,
1495
+ * then this will be a no-op.
1496
+ *
1497
+ * Returns a function that may be used to unload signal-exit.
1498
+ */
1499
+ onExit: rn,
1500
+ /**
1501
+ * Load the listeners. Likely you never need to call this, unless
1502
+ * doing a rather deep integration with signal-exit functionality.
1503
+ * Mostly exposed for the benefit of testing.
1504
+ *
1505
+ * @internal
1506
+ */
1507
+ load: Hc,
1508
+ /**
1509
+ * Unload the listeners. Likely you never need to call this, unless
1510
+ * doing a rather deep integration with signal-exit functionality.
1511
+ * Mostly exposed for the benefit of testing.
1512
+ *
1513
+ * @internal
1514
+ */
1515
+ unload: Jc
1516
+ } = ts(le(ct) ? new at(ct) : new st());
1517
+
1518
+ // node_modules/execa/lib/kill.js
1519
+ var rs = 1e3 * 5, on = /* @__PURE__ */ o((e, t = "SIGTERM", r = {}) => {
1520
+ let n = e(t);
1521
+ return ns(e, t, r, n), n;
1522
+ }, "spawnedKill"), ns = /* @__PURE__ */ o((e, t, r, n) => {
1523
+ if (!os(t, r, n))
1524
+ return;
1525
+ let i = ss(r), s = setTimeout(() => {
1526
+ e("SIGKILL");
1527
+ }, i);
1528
+ s.unref && s.unref();
1529
+ }, "setKillTimeout"), os = /* @__PURE__ */ o((e, { forceKillAfterTimeout: t }, r) => is(e) && t !== !1 && r, "shouldForceKill"), is = /* @__PURE__ */ o(
1530
+ (e) => e === nn.default.constants.signals.SIGTERM || typeof e == "string" && e.toUpperCase() === "SIGTERM", "isSigterm"), ss = /* @__PURE__ */ o(
1531
+ ({ forceKillAfterTimeout: e = !0 }) => {
1532
+ if (e === !0)
1533
+ return rs;
1534
+ if (!Number.isFinite(e) || e < 0)
1535
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);
1536
+ return e;
1537
+ }, "getForceKillAfterTimeout"), sn = /* @__PURE__ */ o((e, t) => {
1538
+ e.kill() && (t.isCanceled = !0);
1539
+ }, "spawnedCancel"), as = /* @__PURE__ */ o((e, t, r) => {
1540
+ e.kill(t), r(Object.assign(new Error("Timed out"), { timedOut: !0, signal: t }));
1541
+ }, "timeoutKill"), an = /* @__PURE__ */ o((e, { timeout: t, killSignal: r = "SIGTERM" }, n) => {
1542
+ if (t === 0 || t === void 0)
1543
+ return n;
1544
+ let i, s = new Promise((c, u) => {
1545
+ i = setTimeout(() => {
1546
+ as(e, r, u);
1547
+ }, t);
1548
+ }), a = n.finally(() => {
1549
+ clearTimeout(i);
1550
+ });
1551
+ return Promise.race([s, a]);
1552
+ }, "setupTimeout"), cn = /* @__PURE__ */ o(({ timeout: e }) => {
1553
+ if (e !== void 0 && (!Number.isFinite(e) || e < 0))
1554
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);
1555
+ }, "validateTimeout"), un = /* @__PURE__ */ o(async (e, { cleanup: t, detached: r }, n) => {
1556
+ if (!t || r)
1557
+ return n;
1558
+ let i = rn(() => {
1559
+ e.kill();
1560
+ });
1561
+ return n.finally(() => {
1562
+ i();
1563
+ });
1564
+ }, "setExitHandler");
1565
+
1566
+ // node_modules/execa/lib/pipe.js
1567
+ var fn = require("node:fs"), ln = require("node:child_process");
1568
+
1569
+ // node_modules/is-stream/index.js
1570
+ function me(e) {
1571
+ return e !== null && typeof e == "object" && typeof e.pipe == "function";
1572
+ }
1573
+ o(me, "isStream");
1574
+ function ut(e) {
1575
+ return me(e) && e.writable !== !1 && typeof e._write == "function" && typeof e._writableState == "object";
1576
+ }
1577
+ o(ut, "isWritableStream");
1578
+
1579
+ // node_modules/execa/lib/pipe.js
1580
+ var cs = /* @__PURE__ */ o((e) => e instanceof ln.ChildProcess && typeof e.then == "function", "isExecaChildProcess"), ft = /* @__PURE__ */ o(
1581
+ (e, t, r) => {
1582
+ if (typeof r == "string")
1583
+ return e[t].pipe((0, fn.createWriteStream)(r)), e;
1584
+ if (ut(r))
1585
+ return e[t].pipe(r), e;
1586
+ if (!cs(r))
1587
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
1588
+ if (!ut(r.stdin))
1589
+ throw new TypeError("The target child process's stdin must be available.");
1590
+ return e[t].pipe(r.stdin), r;
1591
+ }, "pipeToTarget"), pn = /* @__PURE__ */ o((e) => {
1592
+ e.stdout !== null && (e.pipeStdout = ft.bind(void 0, e, "stdout")), e.stderr !== null && (e.pipeStderr = ft.bind(void 0, e, "stderr")), e.
1593
+ all !== void 0 && (e.pipeAll = ft.bind(void 0, e, "all"));
1594
+ }, "addPipeMethods");
1595
+
1596
+ // node_modules/execa/lib/stream.js
1597
+ var xe = require("node:fs"), Pn = require("node:timers/promises");
1598
+
1599
+ // node_modules/get-stream/source/contents.js
1600
+ var H = /* @__PURE__ */ o(async (e, { init: t, convertChunk: r, getSize: n, truncateChunk: i, addChunk: s, getFinalChunk: a, finalize: c }, {
1601
+ maxBuffer: u = Number.POSITIVE_INFINITY } = {}) => {
1602
+ if (!fs(e))
1603
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
1604
+ let f = t();
1605
+ f.length = 0;
1606
+ try {
1607
+ for await (let l of e) {
1608
+ let y = ls(l), g = r[y](l, f);
1609
+ yn({ convertedChunk: g, state: f, getSize: n, truncateChunk: i, addChunk: s, maxBuffer: u });
1610
+ }
1611
+ return us({ state: f, convertChunk: r, getSize: n, truncateChunk: i, addChunk: s, getFinalChunk: a, maxBuffer: u }), c(f);
1612
+ } catch (l) {
1613
+ throw l.bufferedData = c(f), l;
1614
+ }
1615
+ }, "getStreamContents"), us = /* @__PURE__ */ o(({ state: e, getSize: t, truncateChunk: r, addChunk: n, getFinalChunk: i, maxBuffer: s }) => {
1616
+ let a = i(e);
1617
+ a !== void 0 && yn({ convertedChunk: a, state: e, getSize: t, truncateChunk: r, addChunk: n, maxBuffer: s });
1618
+ }, "appendFinalChunk"), yn = /* @__PURE__ */ o(({ convertedChunk: e, state: t, getSize: r, truncateChunk: n, addChunk: i, maxBuffer: s }) => {
1619
+ let a = r(e), c = t.length + a;
1620
+ if (c <= s) {
1621
+ mn(e, t, i, c);
1622
+ return;
1623
+ }
1624
+ let u = n(e, s - t.length);
1625
+ throw u !== void 0 && mn(u, t, i, s), new de();
1626
+ }, "appendChunk"), mn = /* @__PURE__ */ o((e, t, r, n) => {
1627
+ t.contents = r(e, t, n), t.length = n;
1628
+ }, "addNewChunk"), fs = /* @__PURE__ */ o((e) => typeof e == "object" && e !== null && typeof e[Symbol.asyncIterator] == "function", "isAsyn\
1629
+ cIterable"), ls = /* @__PURE__ */ o((e) => {
1630
+ let t = typeof e;
1631
+ if (t === "string")
1632
+ return "string";
1633
+ if (t !== "object" || e === null)
1634
+ return "others";
1635
+ if (globalThis.Buffer?.isBuffer(e))
1636
+ return "buffer";
1637
+ let r = dn.call(e);
1638
+ return r === "[object ArrayBuffer]" ? "arrayBuffer" : r === "[object DataView]" ? "dataView" : Number.isInteger(e.byteLength) && Number.isInteger(
1639
+ e.byteOffset) && dn.call(e.buffer) === "[object ArrayBuffer]" ? "typedArray" : "others";
1640
+ }, "getChunkType"), { toString: dn } = Object.prototype, de = class extends Error {
1641
+ static {
1642
+ o(this, "MaxBufferError");
1643
+ }
1644
+ name = "MaxBufferError";
1645
+ constructor() {
1646
+ super("maxBuffer exceeded");
1647
+ }
1648
+ };
1649
+
1650
+ // node_modules/get-stream/source/utils.js
1651
+ var lt = /* @__PURE__ */ o((e) => e, "identity"), pt = /* @__PURE__ */ o(() => {
1652
+ }, "noop"), mt = /* @__PURE__ */ o(({ contents: e }) => e, "getContentsProp"), ye = /* @__PURE__ */ o((e) => {
1653
+ throw new Error(`Streams in object mode are not supported: ${String(e)}`);
1654
+ }, "throwObjectStream"), he = /* @__PURE__ */ o((e) => e.length, "getLengthProp");
1655
+
1656
+ // node_modules/get-stream/source/array-buffer.js
1657
+ async function dt(e, t) {
1658
+ return H(e, ws, t);
1659
+ }
1660
+ o(dt, "getStreamAsArrayBuffer");
1661
+ var ps = /* @__PURE__ */ o(() => ({ contents: new ArrayBuffer(0) }), "initArrayBuffer"), ms = /* @__PURE__ */ o((e) => ds.encode(e), "useTex\
1662
+ tEncoder"), ds = new TextEncoder(), hn = /* @__PURE__ */ o((e) => new Uint8Array(e), "useUint8Array"), gn = /* @__PURE__ */ o((e) => new Uint8Array(
1663
+ e.buffer, e.byteOffset, e.byteLength), "useUint8ArrayWithOffset"), ys = /* @__PURE__ */ o((e, t) => e.slice(0, t), "truncateArrayBufferChunk"),
1664
+ hs = /* @__PURE__ */ o((e, { contents: t, length: r }, n) => {
1665
+ let i = wn() ? bs(t, n) : gs(t, n);
1666
+ return new Uint8Array(i).set(e, r), i;
1667
+ }, "addArrayBufferChunk"), gs = /* @__PURE__ */ o((e, t) => {
1668
+ if (t <= e.byteLength)
1669
+ return e;
1670
+ let r = new ArrayBuffer(xn(t));
1671
+ return new Uint8Array(r).set(new Uint8Array(e), 0), r;
1672
+ }, "resizeArrayBufferSlow"), bs = /* @__PURE__ */ o((e, t) => {
1673
+ if (t <= e.maxByteLength)
1674
+ return e.resize(t), e;
1675
+ let r = new ArrayBuffer(t, { maxByteLength: xn(t) });
1676
+ return new Uint8Array(r).set(new Uint8Array(e), 0), r;
1677
+ }, "resizeArrayBuffer"), xn = /* @__PURE__ */ o((e) => bn ** Math.ceil(Math.log(e) / Math.log(bn)), "getNewContentsLength"), bn = 2, xs = /* @__PURE__ */ o(
1678
+ ({ contents: e, length: t }) => wn() ? e : e.slice(0, t), "finalizeArrayBuffer"), wn = /* @__PURE__ */ o(() => "resize" in ArrayBuffer.prototype,
1679
+ "hasArrayBufferResize"), ws = {
1680
+ init: ps,
1681
+ convertChunk: {
1682
+ string: ms,
1683
+ buffer: hn,
1684
+ arrayBuffer: hn,
1685
+ dataView: gn,
1686
+ typedArray: gn,
1687
+ others: ye
1688
+ },
1689
+ getSize: he,
1690
+ truncateChunk: ys,
1691
+ addChunk: hs,
1692
+ getFinalChunk: pt,
1693
+ finalize: xs
1694
+ };
1695
+
1696
+ // node_modules/get-stream/source/buffer.js
1697
+ async function ge(e, t) {
1698
+ if (!("Buffer" in globalThis))
1699
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
1700
+ try {
1701
+ return Sn(await dt(e, t));
1702
+ } catch (r) {
1703
+ throw r.bufferedData !== void 0 && (r.bufferedData = Sn(r.bufferedData)), r;
1704
+ }
1705
+ }
1706
+ o(ge, "getStreamAsBuffer");
1707
+ var Sn = /* @__PURE__ */ o((e) => globalThis.Buffer.from(e), "arrayBufferToNodeBuffer");
1708
+
1709
+ // node_modules/get-stream/source/string.js
1710
+ async function yt(e, t) {
1711
+ return H(e, vs, t);
1712
+ }
1713
+ o(yt, "getStreamAsString");
1714
+ var Ss = /* @__PURE__ */ o(() => ({ contents: "", textDecoder: new TextDecoder() }), "initString"), be = /* @__PURE__ */ o((e, { textDecoder: t }) => t.
1715
+ decode(e, { stream: !0 }), "useTextDecoder"), ks = /* @__PURE__ */ o((e, { contents: t }) => t + e, "addStringChunk"), Es = /* @__PURE__ */ o(
1716
+ (e, t) => e.slice(0, t), "truncateStringChunk"), Ps = /* @__PURE__ */ o(({ textDecoder: e }) => {
1717
+ let t = e.decode();
1718
+ return t === "" ? void 0 : t;
1719
+ }, "getFinalStringChunk"), vs = {
1720
+ init: Ss,
1721
+ convertChunk: {
1722
+ string: lt,
1723
+ buffer: be,
1724
+ arrayBuffer: be,
1725
+ dataView: be,
1726
+ typedArray: be,
1727
+ others: ye
1728
+ },
1729
+ getSize: he,
1730
+ truncateChunk: Es,
1731
+ addChunk: ks,
1732
+ getFinalChunk: Ps,
1733
+ finalize: mt
1734
+ };
1735
+
1736
+ // node_modules/execa/lib/stream.js
1737
+ var vn = d(En(), 1);
1738
+ var Tn = /* @__PURE__ */ o((e) => {
1739
+ if (e !== void 0)
1740
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
1741
+ }, "validateInputOptions"), Cs = /* @__PURE__ */ o(({ input: e, inputFile: t }) => typeof t != "string" ? e : (Tn(e), (0, xe.readFileSync)(t)),
1742
+ "getInputSync"), Cn = /* @__PURE__ */ o((e) => {
1743
+ let t = Cs(e);
1744
+ if (me(t))
1745
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1746
+ return t;
1747
+ }, "handleInputSync"), Is = /* @__PURE__ */ o(({ input: e, inputFile: t }) => typeof t != "string" ? e : (Tn(e), (0, xe.createReadStream)(t)),
1748
+ "getInput"), In = /* @__PURE__ */ o((e, t) => {
1749
+ let r = Is(t);
1750
+ r !== void 0 && (me(r) ? r.pipe(e.stdin) : e.stdin.end(r));
1751
+ }, "handleInput"), An = /* @__PURE__ */ o((e, { all: t }) => {
1752
+ if (!t || !e.stdout && !e.stderr)
1753
+ return;
1754
+ let r = (0, vn.default)();
1755
+ return e.stdout && r.add(e.stdout), e.stderr && r.add(e.stderr), r;
1756
+ }, "makeAllStream"), ht = /* @__PURE__ */ o(async (e, t) => {
1757
+ if (!(!e || t === void 0)) {
1758
+ await (0, Pn.setTimeout)(0), e.destroy();
1759
+ try {
1760
+ return await t;
1761
+ } catch (r) {
1762
+ return r.bufferedData;
1763
+ }
1764
+ }
1765
+ }, "getBufferedData"), gt = /* @__PURE__ */ o((e, { encoding: t, buffer: r, maxBuffer: n }) => {
1766
+ if (!(!e || !r))
1767
+ return t === "utf8" || t === "utf-8" ? yt(e, { maxBuffer: n }) : t === null || t === "buffer" ? ge(e, { maxBuffer: n }) : As(e, n, t);
1768
+ }, "getStreamPromise"), As = /* @__PURE__ */ o(async (e, t, r) => (await ge(e, { maxBuffer: t })).toString(r), "applyEncoding"), On = /* @__PURE__ */ o(
1769
+ async ({ stdout: e, stderr: t, all: r }, { encoding: n, buffer: i, maxBuffer: s }, a) => {
1770
+ let c = gt(e, { encoding: n, buffer: i, maxBuffer: s }), u = gt(t, { encoding: n, buffer: i, maxBuffer: s }), f = gt(r, { encoding: n, buffer: i,
1771
+ maxBuffer: s * 2 });
1772
+ try {
1773
+ return await Promise.all([a, c, u, f]);
1774
+ } catch (l) {
1775
+ return Promise.all([
1776
+ { error: l, signal: l.signal, timedOut: l.timedOut },
1777
+ ht(e, c),
1778
+ ht(t, u),
1779
+ ht(r, f)
1780
+ ]);
1781
+ }
1782
+ }, "getSpawnedResult");
1783
+
1784
+ // node_modules/execa/lib/promise.js
1785
+ var Os = (async () => {
1786
+ })().constructor.prototype, js = ["then", "catch", "finally"].map((e) => [
1787
+ e,
1788
+ Reflect.getOwnPropertyDescriptor(Os, e)
1789
+ ]), bt = /* @__PURE__ */ o((e, t) => {
1790
+ for (let [r, n] of js) {
1791
+ let i = typeof t == "function" ? (...s) => Reflect.apply(n.value, t(), s) : n.value.bind(t);
1792
+ Reflect.defineProperty(e, r, { ...n, value: i });
1793
+ }
1794
+ }, "mergePromise"), jn = /* @__PURE__ */ o((e) => new Promise((t, r) => {
1795
+ e.on("exit", (n, i) => {
1796
+ t({ exitCode: n, signal: i });
1797
+ }), e.on("error", (n) => {
1798
+ r(n);
1799
+ }), e.stdin && e.stdin.on("error", (n) => {
1800
+ r(n);
1801
+ });
1802
+ }), "getSpawnedPromise");
1803
+
1804
+ // node_modules/execa/lib/command.js
1805
+ var Dn = require("node:buffer"), _n = require("node:child_process");
1806
+ var Mn = /* @__PURE__ */ o((e, t = []) => Array.isArray(t) ? [e, ...t] : [e], "normalizeArgs"), Rs = /^[\w.-]+$/, Ns = /* @__PURE__ */ o((e) => typeof e !=
1807
+ "string" || Rs.test(e) ? e : `"${e.replaceAll('"', '\\"')}"`, "escapeArg"), xt = /* @__PURE__ */ o((e, t) => Mn(e, t).join(" "), "joinComman\
1808
+ d"), wt = /* @__PURE__ */ o((e, t) => Mn(e, t).map((r) => Ns(r)).join(" "), "getEscapedCommand"), Ln = / +/g, Fn = /* @__PURE__ */ o((e) => {
1809
+ let t = [];
1810
+ for (let r of e.trim().split(Ln)) {
1811
+ let n = t.at(-1);
1812
+ n && n.endsWith("\\") ? t[t.length - 1] = `${n.slice(0, -1)} ${r}` : t.push(r);
1813
+ }
1814
+ return t;
1815
+ }, "parseCommand"), Rn = /* @__PURE__ */ o((e) => {
1816
+ let t = typeof e;
1817
+ if (t === "string")
1818
+ return e;
1819
+ if (t === "number")
1820
+ return String(e);
1821
+ if (t === "object" && e !== null && !(e instanceof _n.ChildProcess) && "stdout" in e) {
1822
+ let r = typeof e.stdout;
1823
+ if (r === "string")
1824
+ return e.stdout;
1825
+ if (Dn.Buffer.isBuffer(e.stdout))
1826
+ return e.stdout.toString();
1827
+ throw new TypeError(`Unexpected "${r}" stdout in template expression`);
1828
+ }
1829
+ throw new TypeError(`Unexpected "${t}" in template expression`);
1830
+ }, "parseExpression"), Nn = /* @__PURE__ */ o((e, t, r) => r || e.length === 0 || t.length === 0 ? [...e, ...t] : [
1831
+ ...e.slice(0, -1),
1832
+ `${e.at(-1)}${t[0]}`,
1833
+ ...t.slice(1)
1834
+ ], "concatTokens"), Ds = /* @__PURE__ */ o(({ templates: e, expressions: t, tokens: r, index: n, template: i }) => {
1835
+ let s = i ?? e.raw[n], a = s.split(Ln).filter(Boolean), c = Nn(
1836
+ r,
1837
+ a,
1838
+ s.startsWith(" ")
1839
+ );
1840
+ if (n === t.length)
1841
+ return c;
1842
+ let u = t[n], f = Array.isArray(u) ? u.map((l) => Rn(l)) : [Rn(u)];
1843
+ return Nn(
1844
+ c,
1845
+ f,
1846
+ s.endsWith(" ")
1847
+ );
1848
+ }, "parseTemplate"), St = /* @__PURE__ */ o((e, t) => {
1849
+ let r = [];
1850
+ for (let [n, i] of e.entries())
1851
+ r = Ds({ templates: e, expressions: t, tokens: r, index: n, template: i });
1852
+ return r;
1853
+ }, "parseTemplates");
1854
+
1855
+ // node_modules/execa/lib/verbose.js
1856
+ var Bn = require("node:util"), Gn = d(require("node:process"), 1);
1857
+ var Un = (0, Bn.debuglog)("execa").enabled, we = /* @__PURE__ */ o((e, t) => String(e).padStart(t, "0"), "padField"), _s = /* @__PURE__ */ o(
1858
+ () => {
1859
+ let e = /* @__PURE__ */ new Date();
1860
+ return `${we(e.getHours(), 2)}:${we(e.getMinutes(), 2)}:${we(e.getSeconds(), 2)}.${we(e.getMilliseconds(), 3)}`;
1861
+ }, "getTimestamp"), kt = /* @__PURE__ */ o((e, { verbose: t }) => {
1862
+ t && Gn.default.stderr.write(`[${_s()}] ${e}
1863
+ `);
1864
+ }, "logCommand");
1865
+
1866
+ // node_modules/execa/index.js
1867
+ var Ms = 1e3 * 1e3 * 100, Ls = /* @__PURE__ */ o(({ env: e, extendEnv: t, preferLocal: r, localDir: n, execPath: i }) => {
1868
+ let s = t ? { ...J.default.env, ...e } : e;
1869
+ return r ? Jr({ env: s, cwd: n, execPath: i }) : s;
1870
+ }, "getEnv"), Vn = /* @__PURE__ */ o((e, t, r = {}) => {
1871
+ let n = Jn.default._parse(e, t, r);
1872
+ return e = n.command, t = n.args, r = n.options, r = {
1873
+ maxBuffer: Ms,
1874
+ buffer: !0,
1875
+ stripFinalNewline: !0,
1876
+ extendEnv: !0,
1877
+ preferLocal: !1,
1878
+ localDir: r.cwd || J.default.cwd(),
1879
+ execPath: J.default.execPath,
1880
+ encoding: "utf8",
1881
+ reject: !0,
1882
+ cleanup: !0,
1883
+ all: !1,
1884
+ windowsHide: !0,
1885
+ verbose: Un,
1886
+ ...r
1887
+ }, r.env = Ls(r), r.stdio = tn(r), J.default.platform === "win32" && Hn.default.basename(e, ".exe") === "cmd" && t.unshift("/q"), { file: e,
1888
+ args: t, options: r, parsed: n };
1889
+ }, "handleArguments"), V = /* @__PURE__ */ o((e, t, r) => typeof t != "string" && !Wn.Buffer.isBuffer(t) ? r === void 0 ? void 0 : "" : e.stripFinalNewline ?
1890
+ Ze(t) : t, "handleOutput");
1891
+ function qn(e, t, r) {
1892
+ let n = Vn(e, t, r), i = xt(e, t), s = wt(e, t);
1893
+ kt(s, n.options), cn(n.options);
1894
+ let a;
1895
+ try {
1896
+ a = Se.default.spawn(n.file, n.args, n.options);
1897
+ } catch (h) {
1898
+ let b = new Se.default.ChildProcess(), m = Promise.reject(W({
1899
+ error: h,
1900
+ stdout: "",
1901
+ stderr: "",
1902
+ all: "",
1903
+ command: i,
1904
+ escapedCommand: s,
1905
+ parsed: n,
1906
+ timedOut: !1,
1907
+ isCanceled: !1,
1908
+ killed: !1
1909
+ }));
1910
+ return bt(b, m), b;
1911
+ }
1912
+ let c = jn(a), u = an(a, n.options, c), f = un(a, n.options, u), l = { isCanceled: !1 };
1913
+ a.kill = on.bind(null, a.kill.bind(a)), a.cancel = sn.bind(null, a, l);
1914
+ let g = qr(/* @__PURE__ */ o(async () => {
1915
+ let [{ error: h, exitCode: b, signal: m, timedOut: x }, O, v, j] = await On(a, n.options, f), Z = V(n.options, O), ee = V(n.options, v),
1916
+ p = V(n.options, j);
1917
+ if (h || b !== 0 || m !== null) {
1918
+ let S = W({
1919
+ error: h,
1920
+ exitCode: b,
1921
+ signal: m,
1922
+ stdout: Z,
1923
+ stderr: ee,
1924
+ all: p,
1925
+ command: i,
1926
+ escapedCommand: s,
1927
+ parsed: n,
1928
+ timedOut: x,
1929
+ isCanceled: l.isCanceled || (n.options.signal ? n.options.signal.aborted : !1),
1930
+ killed: a.killed
1931
+ });
1932
+ if (!n.options.reject)
1933
+ return S;
1934
+ throw S;
1935
+ }
1936
+ return {
1937
+ command: i,
1938
+ escapedCommand: s,
1939
+ exitCode: 0,
1940
+ stdout: Z,
1941
+ stderr: ee,
1942
+ all: p,
1943
+ failed: !1,
1944
+ timedOut: !1,
1945
+ isCanceled: !1,
1946
+ killed: !1
1947
+ };
1948
+ }, "handlePromise"));
1949
+ return In(a, n.options), a.all = An(a, n.options), pn(a), bt(a, g), a;
1950
+ }
1951
+ o(qn, "execa");
1952
+ function Fs(e, t, r) {
1953
+ let n = Vn(e, t, r), i = xt(e, t), s = wt(e, t);
1954
+ kt(s, n.options);
1955
+ let a = Cn(n.options), c;
1956
+ try {
1957
+ c = Se.default.spawnSync(n.file, n.args, { ...n.options, input: a });
1958
+ } catch (l) {
1959
+ throw W({
1960
+ error: l,
1961
+ stdout: "",
1962
+ stderr: "",
1963
+ all: "",
1964
+ command: i,
1965
+ escapedCommand: s,
1966
+ parsed: n,
1967
+ timedOut: !1,
1968
+ isCanceled: !1,
1969
+ killed: !1
1970
+ });
1971
+ }
1972
+ let u = V(n.options, c.stdout, c.error), f = V(n.options, c.stderr, c.error);
1973
+ if (c.error || c.status !== 0 || c.signal !== null) {
1974
+ let l = W({
1975
+ stdout: u,
1976
+ stderr: f,
1977
+ error: c.error,
1978
+ signal: c.signal,
1979
+ exitCode: c.status,
1980
+ command: i,
1981
+ escapedCommand: s,
1982
+ parsed: n,
1983
+ timedOut: c.error && c.error.code === "ETIMEDOUT",
1984
+ isCanceled: !1,
1985
+ killed: c.signal !== null
1986
+ });
1987
+ if (!n.options.reject)
1988
+ return l;
1989
+ throw l;
1990
+ }
1991
+ return {
1992
+ command: i,
1993
+ escapedCommand: s,
1994
+ exitCode: 0,
1995
+ stdout: u,
1996
+ stderr: f,
1997
+ failed: !1,
1998
+ timedOut: !1,
1999
+ isCanceled: !1,
2000
+ killed: !1
2001
+ };
2002
+ }
2003
+ o(Fs, "execaSync");
2004
+ var Bs = /* @__PURE__ */ o(({ input: e, inputFile: t, stdio: r }) => e === void 0 && t === void 0 && r === void 0 ? { stdin: "inherit" } : {},
2005
+ "normalizeScriptStdin"), $n = /* @__PURE__ */ o((e = {}) => ({
2006
+ preferLocal: !0,
2007
+ ...Bs(e),
2008
+ ...e
2009
+ }), "normalizeScriptOptions");
2010
+ function zn(e) {
2011
+ function t(r, ...n) {
2012
+ if (!Array.isArray(r))
2013
+ return zn({ ...e, ...r });
2014
+ let [i, ...s] = St(r, n);
2015
+ return qn(i, s, $n(e));
2016
+ }
2017
+ return o(t, "$"), t.sync = (r, ...n) => {
2018
+ if (!Array.isArray(r))
2019
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
2020
+ let [i, ...s] = St(r, n);
2021
+ return Fs(i, s, $n(e));
2022
+ }, t;
2023
+ }
2024
+ o(zn, "create$");
2025
+ var Qu = zn();
2026
+ function Yn(e, t) {
2027
+ let [r, ...n] = Fn(e);
2028
+ return qn(r, n, t);
2029
+ }
2030
+ o(Yn, "execaCommand");
2031
+
2032
+ // src/telemetry/exec-command-count-lines.ts
2033
+ async function ke(e, t) {
2034
+ let r = Yn(e, { shell: !0, buffer: !1, ...t });
2035
+ if (!r.stdout)
2036
+ throw new Error("Unexpected missing stdout");
2037
+ let n = 0, i = (0, Kn.createInterface)(r.stdout);
2038
+ return i.on("line", () => {
2039
+ n += 1;
2040
+ }), await r, i.close(), n;
2041
+ }
2042
+ o(ke, "execCommandCountLines");
2043
+
2044
+ // ../node_modules/slash/index.js
2045
+ function Et(e) {
2046
+ return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
2047
+ }
2048
+ o(Et, "slash");
2049
+
2050
+ // src/common/utils/file-cache.ts
2051
+ var q = require("node:crypto"), k = require("node:fs"), E = require("node:fs/promises"), Xn = require("node:os"), L = require("node:path");
2052
+ var Ee = class {
2053
+ static {
2054
+ o(this, "FileSystemCache");
2055
+ }
2056
+ constructor(t = {}) {
2057
+ this.prefix = (t.ns || t.prefix || "") + "-", this.hash_alg = t.hash_alg || "md5", this.cache_dir = t.basePath || (0, L.join)((0, Xn.tmpdir)(),
2058
+ (0, q.randomBytes)(15).toString("base64").replace(/\//g, "-")), this.ttl = t.ttl || 0, (0, q.createHash)(this.hash_alg), (0, k.mkdirSync)(
2059
+ this.cache_dir, { recursive: !0 });
2060
+ }
2061
+ generateHash(t) {
2062
+ return (0, L.join)(this.cache_dir, this.prefix + (0, q.createHash)(this.hash_alg).update(t).digest("hex"));
2063
+ }
2064
+ isExpired(t, r) {
2065
+ return t.ttl != null && r > t.ttl;
2066
+ }
2067
+ parseCacheData(t, r) {
2068
+ let n = JSON.parse(t);
2069
+ return this.isExpired(n, Date.now()) ? r : n.content;
2070
+ }
2071
+ parseSetData(t, r, n = {}) {
2072
+ let i = n.ttl ?? this.ttl;
2073
+ return JSON.stringify({ key: t, content: r, ...i && { ttl: Date.now() + i * 1e3 } });
2074
+ }
2075
+ async get(t, r) {
2076
+ try {
2077
+ let n = await (0, E.readFile)(this.generateHash(t), "utf8");
2078
+ return this.parseCacheData(n, r);
2079
+ } catch {
2080
+ return r;
2081
+ }
2082
+ }
2083
+ getSync(t, r) {
2084
+ try {
2085
+ let n = (0, k.readFileSync)(this.generateHash(t), "utf8");
2086
+ return this.parseCacheData(n, r);
2087
+ } catch {
2088
+ return r;
2089
+ }
2090
+ }
2091
+ async set(t, r, n = {}) {
2092
+ let i = typeof n == "number" ? { ttl: n } : n;
2093
+ (0, k.mkdirSync)(this.cache_dir, { recursive: !0 }), await (0, E.writeFile)(this.generateHash(t), this.parseSetData(t, r, i), {
2094
+ encoding: i.encoding || "utf8"
2095
+ });
2096
+ }
2097
+ setSync(t, r, n = {}) {
2098
+ let i = typeof n == "number" ? { ttl: n } : n;
2099
+ (0, k.mkdirSync)(this.cache_dir, { recursive: !0 }), (0, k.writeFileSync)(this.generateHash(t), this.parseSetData(t, r, i), {
2100
+ encoding: i.encoding || "utf8"
2101
+ });
2102
+ }
2103
+ async setMany(t, r) {
2104
+ await Promise.all(t.map((n) => this.set(n.key, n.content ?? n.value, r)));
2105
+ }
2106
+ setManySync(t, r) {
2107
+ t.forEach((n) => this.setSync(n.key, n.content ?? n.value, r));
2108
+ }
2109
+ async remove(t) {
2110
+ await (0, E.rm)(this.generateHash(t), { force: !0 });
2111
+ }
2112
+ removeSync(t) {
2113
+ (0, k.rmSync)(this.generateHash(t), { force: !0 });
2114
+ }
2115
+ async clear() {
2116
+ let t = await (0, E.readdir)(this.cache_dir);
2117
+ await Promise.all(
2118
+ t.filter((r) => r.startsWith(this.prefix)).map((r) => (0, E.rm)((0, L.join)(this.cache_dir, r), { force: !0 }))
2119
+ );
2120
+ }
2121
+ clearSync() {
2122
+ (0, k.readdirSync)(this.cache_dir).filter((t) => t.startsWith(this.prefix)).forEach((t) => (0, k.rmSync)((0, L.join)(this.cache_dir, t),
2123
+ { force: !0 }));
2124
+ }
2125
+ async getAll() {
2126
+ let t = Date.now(), r = await (0, E.readdir)(this.cache_dir);
2127
+ return (await Promise.all(
2128
+ r.filter((i) => i.startsWith(this.prefix)).map((i) => (0, E.readFile)((0, L.join)(this.cache_dir, i), "utf8"))
2129
+ )).map((i) => JSON.parse(i)).filter((i) => i.content && !this.isExpired(i, t));
2130
+ }
2131
+ async load() {
2132
+ return {
2133
+ files: (await this.getAll()).map((r) => ({
2134
+ path: this.generateHash(r.key),
2135
+ value: r.content,
2136
+ key: r.key
2137
+ }))
2138
+ };
2139
+ }
2140
+ };
2141
+ function Pt(e) {
2142
+ return new Ee(e);
2143
+ }
2144
+ o(Pt, "createFileSystemCache");
2145
+
2146
+ // src/common/utils/resolve-path-in-sb-cache.ts
2147
+ var It = require("node:path");
2148
+
2149
+ // ../node_modules/find-cache-dir/index.js
2150
+ var lo = d(require("node:process"), 1), F = d(require("node:path"), 1), Y = d(require("node:fs"), 1), po = d(Zn(), 1);
2151
+
2152
+ // ../node_modules/pkg-dir/index.js
2153
+ var ao = d(require("node:path"), 1);
2154
+
2155
+ // ../node_modules/pkg-dir/node_modules/find-up/index.js
2156
+ var z = d(require("node:path"), 1), io = require("node:url");
2157
+
2158
+ // ../node_modules/locate-path/index.js
2159
+ var eo = d(require("node:process"), 1), to = d(require("node:path"), 1), Pe = d(require("node:fs"), 1), ro = require("node:url");
2160
+ var no = {
2161
+ directory: "isDirectory",
2162
+ file: "isFile"
2163
+ };
2164
+ function $s(e) {
2165
+ if (!Object.hasOwnProperty.call(no, e))
2166
+ throw new Error(`Invalid type specified: ${e}`);
2167
+ }
2168
+ o($s, "checkType");
2169
+ var Ws = /* @__PURE__ */ o((e, t) => t[no[e]](), "matchType"), Hs = /* @__PURE__ */ o((e) => e instanceof URL ? (0, ro.fileURLToPath)(e) : e,
2170
+ "toPath");
2171
+ function vt(e, {
2172
+ cwd: t = eo.default.cwd(),
2173
+ type: r = "file",
2174
+ allowSymlinks: n = !0
2175
+ } = {}) {
2176
+ $s(r), t = Hs(t);
2177
+ let i = n ? Pe.default.statSync : Pe.default.lstatSync;
2178
+ for (let s of e)
2179
+ try {
2180
+ let a = i(to.default.resolve(t, s), {
2181
+ throwIfNoEntry: !1
2182
+ });
2183
+ if (!a)
2184
+ continue;
2185
+ if (Ws(r, a))
2186
+ return s;
2187
+ } catch {
2188
+ }
2189
+ }
2190
+ o(vt, "locatePathSync");
2191
+
2192
+ // ../node_modules/pkg-dir/node_modules/path-exists/index.js
2193
+ var oo = d(require("node:fs"), 1);
2194
+
2195
+ // ../node_modules/pkg-dir/node_modules/find-up/index.js
2196
+ var Js = /* @__PURE__ */ o((e) => e instanceof URL ? (0, io.fileURLToPath)(e) : e, "toPath"), Vs = Symbol("findUpStop");
2197
+ function qs(e, t = {}) {
2198
+ let r = z.default.resolve(Js(t.cwd) || ""), { root: n } = z.default.parse(r), i = t.stopAt || n, s = t.limit || Number.POSITIVE_INFINITY, a = [
2199
+ e].flat(), c = /* @__PURE__ */ o((f) => {
2200
+ if (typeof e != "function")
2201
+ return vt(a, f);
2202
+ let l = e(f.cwd);
2203
+ return typeof l == "string" ? vt([l], f) : l;
2204
+ }, "runMatcher"), u = [];
2205
+ for (; ; ) {
2206
+ let f = c({ ...t, cwd: r });
2207
+ if (f === Vs || (f && u.push(z.default.resolve(r, f)), r === i || u.length >= s))
2208
+ break;
2209
+ r = z.default.dirname(r);
2210
+ }
2211
+ return u;
2212
+ }
2213
+ o(qs, "findUpMultipleSync");
2214
+ function so(e, t = {}) {
2215
+ return qs(e, { ...t, limit: 1 })[0];
2216
+ }
2217
+ o(so, "findUpSync");
2218
+
2219
+ // ../node_modules/pkg-dir/index.js
2220
+ function co({ cwd: e } = {}) {
2221
+ let t = so("package.json", { cwd: e });
2222
+ return t && ao.default.dirname(t);
2223
+ }
2224
+ o(co, "packageDirectorySync");
2225
+
2226
+ // ../node_modules/find-cache-dir/index.js
2227
+ var { env: Tt, cwd: zs } = lo.default, uo = /* @__PURE__ */ o((e) => {
2228
+ try {
2229
+ return Y.default.accessSync(e, Y.default.constants.W_OK), !0;
2230
+ } catch {
2231
+ return !1;
2232
+ }
2233
+ }, "isWritable");
2234
+ function fo(e, t) {
2235
+ return t.create && Y.default.mkdirSync(e, { recursive: !0 }), e;
2236
+ }
2237
+ o(fo, "useDirectory");
2238
+ function Ys(e) {
2239
+ let t = F.default.join(e, "node_modules");
2240
+ if (!(!uo(t) && (Y.default.existsSync(t) || !uo(F.default.join(e)))))
2241
+ return t;
2242
+ }
2243
+ o(Ys, "getNodeModuleDirectory");
2244
+ function Ct(e = {}) {
2245
+ if (Tt.CACHE_DIR && !["true", "false", "1", "0"].includes(Tt.CACHE_DIR))
2246
+ return fo(F.default.join(Tt.CACHE_DIR, e.name), e);
2247
+ let { cwd: t = zs(), files: r } = e;
2248
+ if (r) {
2249
+ if (!Array.isArray(r))
2250
+ throw new TypeError(`Expected \`files\` option to be an array, got \`${typeof r}\`.`);
2251
+ t = (0, po.default)(r.map((i) => F.default.resolve(t, i)));
2252
+ }
2253
+ if (t = co({ cwd: t }), !(!t || !Ys(t)))
2254
+ return fo(F.default.join(t, "node_modules", ".cache", e.name), e);
2255
+ }
2256
+ o(Ct, "findCacheDirectory");
2257
+
2258
+ // src/common/utils/resolve-path-in-sb-cache.ts
2259
+ function mo(e, t = "default") {
2260
+ let r = Ct({ name: "storybook" });
2261
+ return r ||= (0, It.join)(process.cwd(), "node_modules", ".cache", "storybook"), (0, It.join)(r, t, e);
2262
+ }
2263
+ o(mo, "resolvePathInStorybookCache");
2264
+
2265
+ // src/telemetry/run-telemetry-operation.ts
2266
+ var yo = Pt({
2267
+ basePath: mo("telemetry"),
2268
+ ns: "storybook",
2269
+ ttl: 24 * 60 * 60 * 1e3
2270
+ // 24h
2271
+ }), ve = /* @__PURE__ */ o(async (e, t) => {
2272
+ let r = await yo.get(e);
2273
+ return r === void 0 && (r = await t(), r !== void 0 && await yo.set(e, r)), r;
2274
+ }, "runTelemetryOperation");
2275
+
2276
+ // src/telemetry/get-application-file-count.ts
2277
+ var Ks = ["page", "screen"], Xs = ["js", "jsx", "ts", "tsx"], Qs = /* @__PURE__ */ o(async (e) => {
2278
+ let r = Ks.flatMap((n) => [
2279
+ n,
2280
+ [n[0].toUpperCase(), ...n.slice(1)].join("")
2281
+ ]).flatMap(
2282
+ (n) => Xs.map((i) => `"${e}${ho.sep}*${n}*.${i}"`)
2283
+ );
2284
+ try {
2285
+ let n = `git ls-files -- ${r.join(" ")}`;
2286
+ return await ke(n);
2287
+ } catch {
2288
+ return;
2289
+ }
2290
+ }, "getApplicationFilesCountUncached"), go = /* @__PURE__ */ o(async (e) => ve(
2291
+ "applicationFiles",
2292
+ async () => Qs(e)
2293
+ ), "getApplicationFileCount");
2294
+
2295
+ // src/telemetry/get-chromatic-version.ts
2296
+ function bo(e) {
2297
+ let t = e.dependencies?.chromatic || e.devDependencies?.chromatic || e.peerDependencies?.chromatic;
2298
+ return t || (e.scripts && Object.values(e.scripts).find((r) => r?.match(/chromatic/)) ? "latest" : void 0);
2299
+ }
2300
+ o(bo, "getChromaticVersionSpecifier");
2301
+
2302
+ // src/telemetry/get-framework-info.ts
2303
+ var ko = require("node:path"), Eo = require("storybook/internal/common");
2304
+
2305
+ // src/telemetry/package-json.ts
2306
+ var xo = require("node:fs/promises"), wo = require("node:path");
2307
+ var At = /* @__PURE__ */ o(async (e) => {
2308
+ let t = Object.keys(e);
2309
+ return Promise.all(t.map(Te));
2310
+ }, "getActualPackageVersions"), Te = /* @__PURE__ */ o(async (e) => {
2311
+ try {
2312
+ let t = await Ot(e);
2313
+ return {
2314
+ name: e,
2315
+ version: t.version
2316
+ };
2317
+ } catch {
2318
+ return { name: e, version: null };
2319
+ }
2320
+ }, "getActualPackageVersion"), Ot = /* @__PURE__ */ o(async (e) => {
2321
+ let t = require.resolve((0, wo.join)(e, "package.json"), {
2322
+ paths: [process.cwd()]
2323
+ });
2324
+ return JSON.parse(await (0, xo.readFile)(t, { encoding: "utf8" }));
2325
+ }, "getActualPackageJson");
2326
+
2327
+ // src/telemetry/get-framework-info.ts
2328
+ var Zs = [
2329
+ "html",
2330
+ "react",
2331
+ "svelte",
2332
+ "vue3",
2333
+ "preact",
2334
+ "server",
2335
+ "vue",
2336
+ "web-components",
2337
+ "angular",
2338
+ "ember"
2339
+ ], ea = ["builder-webpack5", "builder-vite"];
2340
+ function So(e, t) {
2341
+ let { name: r = "", version: n, dependencies: i, devDependencies: s, peerDependencies: a } = e, c = {
2342
+ // We include the framework itself because it may be a renderer too (e.g. angular)
2343
+ [r]: n,
2344
+ ...i,
2345
+ ...s,
2346
+ ...a
2347
+ };
2348
+ return t.map((u) => `@storybook/${u}`).find((u) => c[u]);
2349
+ }
2350
+ o(So, "findMatchingPackage");
2351
+ var ta = /* @__PURE__ */ o((e) => {
2352
+ let t = (0, ko.normalize)(e).replace(new RegExp(/\\/, "g"), "/");
2353
+ return Object.keys(Eo.frameworkPackages).find((n) => t.endsWith(n)) || N(e).replace(/.*node_modules[\\/]/, "");
2354
+ }, "getFrameworkPackageName");
2355
+ async function Po(e) {
2356
+ if (!e?.framework)
2357
+ return {};
2358
+ let t = typeof e.framework == "string" ? e.framework : e.framework?.name;
2359
+ if (!t)
2360
+ return {};
2361
+ let r = await Ot(t);
2362
+ if (!r)
2363
+ return {};
2364
+ let n = So(r, ea), i = So(r, Zs), s = ta(t), a = typeof e.framework == "object" ? e.framework.options : {};
2365
+ return {
2366
+ framework: {
2367
+ name: s,
2368
+ options: a
2369
+ },
2370
+ builder: n,
2371
+ renderer: i
2372
+ };
2373
+ }
2374
+ o(Po, "getFrameworkInfo");
2375
+
2376
+ // src/telemetry/get-has-router-package.ts
2377
+ var ra = /* @__PURE__ */ new Set([
2378
+ "react-router",
2379
+ "react-router-dom",
2380
+ "remix",
2381
+ "@tanstack/react-router",
2382
+ "expo-router",
2383
+ "@reach/router",
2384
+ "react-easy-router",
2385
+ "@remix-run/router",
2386
+ "wouter",
2387
+ "wouter-preact",
2388
+ "preact-router",
2389
+ "vue-router",
2390
+ "unplugin-vue-router",
2391
+ "@angular/router",
2392
+ "@solidjs/router",
2393
+ // metaframeworks that imply routing
2394
+ "next",
2395
+ "react-scripts",
2396
+ "gatsby",
2397
+ "nuxt",
2398
+ "@sveltejs/kit"
2399
+ ]);
2400
+ function vo(e) {
2401
+ return Object.keys(e?.dependencies ?? {}).some(
2402
+ (t) => ra.has(t)
2403
+ );
2404
+ }
2405
+ o(vo, "getHasRouterPackage");
2406
+
2407
+ // src/telemetry/get-monorepo-type.ts
2408
+ var K = require("node:fs"), Ce = require("node:path"), Co = require("storybook/internal/common");
2409
+ var To = {
2410
+ Nx: "nx.json",
2411
+ Turborepo: "turbo.json",
2412
+ Lerna: "lerna.json",
2413
+ Rush: "rush.json",
2414
+ Lage: "lage.config.json"
2415
+ }, Io = /* @__PURE__ */ o(() => {
2416
+ let e = (0, Co.getProjectRoot)();
2417
+ if (!e)
2418
+ return;
2419
+ let r = Object.keys(To).find((i) => {
2420
+ let s = (0, Ce.join)(e, To[i]);
2421
+ return (0, K.existsSync)(s);
2422
+ });
2423
+ if (r)
2424
+ return r;
2425
+ if (!(0, K.existsSync)((0, Ce.join)(e, "package.json")))
2426
+ return;
2427
+ if (JSON.parse(
2428
+ (0, K.readFileSync)((0, Ce.join)(e, "package.json"), { encoding: "utf8" })
2429
+ )?.workspaces)
2430
+ return "Workspaces";
2431
+ }, "getMonorepoType");
2432
+
2433
+ // src/telemetry/get-portable-stories-usage.ts
2434
+ var na = /* @__PURE__ */ o(async (e) => {
2435
+ try {
2436
+ let t = "git grep -l composeStor" + (e ? ` -- ${e}` : "");
2437
+ return await ke(t);
2438
+ } catch (t) {
2439
+ return t.exitCode === 1 ? 0 : void 0;
2440
+ }
2441
+ }, "getPortableStoriesFileCountUncached"), Ao = /* @__PURE__ */ o(async (e) => ve(
2442
+ "portableStories",
2443
+ async () => na(e)
2444
+ ), "getPortableStoriesFileCount");
2445
+
2446
+ // src/telemetry/storybook-metadata.ts
2447
+ var jt = {
2448
+ next: "Next",
2449
+ "react-scripts": "CRA",
2450
+ gatsby: "Gatsby",
2451
+ "@nuxtjs/storybook": "nuxt",
2452
+ "@nrwl/storybook": "nx",
2453
+ "@vue/cli-service": "vue-cli",
2454
+ "@sveltejs/kit": "sveltekit"
2455
+ }, Rt = /* @__PURE__ */ o((e) => N(e).replace(/\/dist\/.*/, "").replace(/\.[mc]?[tj]?s[x]?$/, "").replace(/\/register$/, "").replace(/\/manager$/,
2456
+ "").replace(/\/preset$/, ""), "sanitizeAddonName"), Ro = /* @__PURE__ */ o(async ({
2457
+ packageJsonPath: e,
2458
+ packageJson: t,
2459
+ mainConfig: r
2460
+ }) => {
2461
+ let n = {
2462
+ generatedAt: (/* @__PURE__ */ new Date()).getTime(),
2463
+ hasCustomBabel: !1,
2464
+ hasCustomWebpack: !1,
2465
+ hasStaticDirs: !1,
2466
+ hasStorybookEslint: !1,
2467
+ refCount: 0
2468
+ }, i = {
2469
+ ...t?.dependencies,
2470
+ ...t?.devDependencies,
2471
+ ...t?.peerDependencies
2472
+ }, s = Object.keys(i).find((p) => !!jt[p]);
2473
+ if (s) {
2474
+ let { version: p } = await Te(s);
2475
+ n.metaFramework = {
2476
+ name: jt[s],
2477
+ packageName: s,
2478
+ version: p
2479
+ };
2480
+ }
2481
+ let a = [
2482
+ "playwright",
2483
+ "vitest",
2484
+ "jest",
2485
+ "cypress",
2486
+ "nightwatch",
2487
+ "webdriver",
2488
+ "@web/test-runner",
2489
+ "puppeteer",
2490
+ "karma",
2491
+ "jasmine",
2492
+ "chai",
2493
+ "testing-library",
2494
+ "@ngneat/spectator",
2495
+ "wdio",
2496
+ "msw",
2497
+ "miragejs",
2498
+ "sinon"
2499
+ ], c = Object.keys(i).filter(
2500
+ (p) => a.find((S) => p.includes(S))
2501
+ );
2502
+ n.testPackages = Object.fromEntries(
2503
+ await Promise.all(
2504
+ c.map(async (p) => [p, (await Te(p))?.version])
2505
+ )
2506
+ ), n.hasRouterPackage = vo(t);
2507
+ let u = Io();
2508
+ u && (n.monorepo = u);
2509
+ try {
2510
+ let p = await We({ cwd: (0, P.getProjectRoot)() });
2511
+ p && (n.packageManager = {
2512
+ type: p.name,
2513
+ version: p.version,
2514
+ agent: p.agent
2515
+ });
2516
+ } catch {
2517
+ }
2518
+ let f = i.typescript ? "typescript" : "javascript";
2519
+ if (!r)
2520
+ return {
2521
+ ...n,
2522
+ storybookVersionSpecifier: P.versions.storybook,
2523
+ language: f
2524
+ };
2525
+ n.hasCustomBabel = !!r.babel, n.hasCustomWebpack = !!r.webpackFinal, n.hasStaticDirs = !!r.staticDirs, typeof r.typescript == "object" && (n.
2526
+ typescriptOptions = r.typescript);
2527
+ let l = await Po(r);
2528
+ typeof r.refs == "object" && (n.refCount = Object.keys(r.refs).length), typeof r.features == "object" && (n.features = r.features);
2529
+ let y = {};
2530
+ r.addons && r.addons.forEach((p) => {
2531
+ let S, te;
2532
+ typeof p == "string" ? S = Rt(p) : (p.name.includes("addon-essentials") && (te = p.options), S = Rt(p.name)), y[S] = {
2533
+ options: te,
2534
+ version: void 0
2535
+ };
2536
+ });
2537
+ let g = bo(t);
2538
+ g && (y.chromatic = {
2539
+ version: void 0,
2540
+ versionSpecifier: g,
2541
+ options: void 0
2542
+ }), (await At(y)).forEach(({ name: p, version: S }) => {
2543
+ y[p].version = S;
2544
+ });
2545
+ let b = Object.keys(y), m = Object.keys(i).filter((p) => p.includes("storybook") && !b.includes(p)).reduce((p, S) => ({
2546
+ ...p,
2547
+ [S]: { version: void 0 }
2548
+ }), {});
2549
+ (await At(m)).forEach(({ name: p, version: S }) => {
2550
+ m[p].version = S;
2551
+ });
2552
+ let O = !!i["eslint-plugin-storybook"], v = (0, P.getStorybookInfo)(t);
2553
+ try {
2554
+ let { previewConfig: p } = v;
2555
+ if (p) {
2556
+ let S = await (0, jo.readConfig)(p), te = !!(S.getFieldNode(["globals"]) || S.getFieldNode(["globalTypes"]));
2557
+ n.preview = { ...n.preview, usesGlobals: te };
2558
+ }
2559
+ } catch {
2560
+ }
2561
+ let j = m[v.frameworkPackage]?.version, Z = await Ao(), ee = await go((0, Oo.dirname)(e));
2562
+ return {
2563
+ ...n,
2564
+ ...l,
2565
+ portableStoriesFileCount: Z,
2566
+ applicationFileCount: ee,
2567
+ storybookVersion: j,
2568
+ storybookVersionSpecifier: v.version,
2569
+ language: f,
2570
+ storybookPackages: m,
2571
+ addons: y,
2572
+ hasStorybookEslint: O
2573
+ };
2574
+ }, "computeStorybookMetadata");
2575
+ async function oa() {
2576
+ let e = await Fe(process.cwd());
2577
+ return e ? {
2578
+ packageJsonPath: e,
2579
+ packageJson: await Qt(e) || {}
2580
+ } : {
2581
+ packageJsonPath: process.cwd(),
2582
+ packageJson: {}
2583
+ };
2584
+ }
2585
+ o(oa, "getPackageJsonDetails");
2586
+ var Ie, Nt = /* @__PURE__ */ o(async (e) => {
2587
+ if (Ie)
2588
+ return Ie;
2589
+ let { packageJson: t, packageJsonPath: r } = await oa(), n = (e || (0, P.getStorybookConfiguration)(
2590
+ String(t?.scripts?.storybook || ""),
2591
+ "-c",
2592
+ "--config-dir"
2593
+ )) ?? ".storybook", i = await (0, P.loadMainConfig)({ configDir: n }).catch(() => {
2594
+ });
2595
+ return Ie = await Ro({ mainConfig: i, packageJson: t, packageJsonPath: r }), Ie;
2596
+ }, "getStorybookMetadata");
2597
+
2598
+ // src/telemetry/telemetry.ts
2599
+ var Jo = d(require("node:os"), 1), Vo = d(Do(), 1);
2600
+
2601
+ // ../node_modules/nanoid/index.js
2602
+ var Dt = require("crypto");
2603
+
2604
+ // ../node_modules/nanoid/url-alphabet/index.js
2605
+ var _o = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2606
+
2607
+ // ../node_modules/nanoid/index.js
2608
+ var ia = 128, A, B, sa = /* @__PURE__ */ o((e) => {
2609
+ !A || A.length < e ? (A = Buffer.allocUnsafe(e * ia), (0, Dt.randomFillSync)(A), B = 0) : B + e > A.length && ((0, Dt.randomFillSync)(A), B =
2610
+ 0), B += e;
2611
+ }, "fillPool");
2612
+ var X = /* @__PURE__ */ o((e = 21) => {
2613
+ sa(e -= 0);
2614
+ let t = "";
2615
+ for (let r = B - e; r < B; r++)
2616
+ t += _o[A[r] & 63];
2617
+ return t;
2618
+ }, "nanoid");
2619
+
2620
+ // src/telemetry/anonymous-id.ts
2621
+ var Lo = require("node:path"), Fo = require("storybook/internal/common"), Bo = require("child_process");
2622
+
2623
+ // src/telemetry/one-way-hash.ts
2624
+ var Mo = require("crypto");
2625
+ var Oe = /* @__PURE__ */ o((e) => {
2626
+ let t = (0, Mo.createHash)("sha256");
2627
+ return t.update("storybook-telemetry-salt"), t.update(e), t.digest("hex");
2628
+ }, "oneWayHash");
2629
+
2630
+ // src/telemetry/anonymous-id.ts
2631
+ function aa(e) {
2632
+ let n = e.trim().replace(/#.*$/, "").replace(/^.*@/, "").replace(/^.*\/\//, "");
2633
+ return (n.endsWith(".git") ? n : `${n}.git`).replace(":", "/");
2634
+ }
2635
+ o(aa, "normalizeGitUrl");
2636
+ function ca(e, t) {
2637
+ return `${aa(e)}${Et(t)}`;
2638
+ }
2639
+ o(ca, "unhashedProjectId");
2640
+ var je, Go = /* @__PURE__ */ o(() => {
2641
+ if (je)
2642
+ return je;
2643
+ try {
2644
+ let e = (0, Fo.getProjectRoot)(), t = (0, Lo.relative)(e, process.cwd()), r = (0, Bo.execSync)("git config --local --get remote.origin.u\
2645
+ rl", {
2646
+ timeout: 1e3,
2647
+ stdio: "pipe"
2648
+ });
2649
+ je = Oe(ca(String(r), t));
2650
+ } catch {
2651
+ }
2652
+ return je;
2653
+ }, "getAnonymousProjectId");
2654
+
2655
+ // src/telemetry/event-cache.ts
2656
+ var Re = require("storybook/internal/common");
2657
+ var _t = Promise.resolve(), ua = /* @__PURE__ */ o(async (e, t) => {
2658
+ let r = await Re.cache.get("lastEvents") || {};
2659
+ r[e] = { body: t, timestamp: Date.now() }, await Re.cache.set("lastEvents", r);
2660
+ }, "setHelper"), $o = /* @__PURE__ */ o(async (e, t) => (await _t, _t = ua(e, t), _t), "set");
2661
+ var fa = /* @__PURE__ */ o((e) => {
2662
+ let { body: t, timestamp: r } = e;
2663
+ return {
2664
+ timestamp: r,
2665
+ eventType: t?.eventType,
2666
+ eventId: t?.eventId,
2667
+ sessionId: t?.sessionId
2668
+ };
2669
+ }, "upgradeFields"), la = ["init", "upgrade"], pa = ["build", "dev", "error"], Uo = /* @__PURE__ */ o((e, t) => {
2670
+ let r = t.map((n) => e?.[n]).filter(Boolean).sort((n, i) => i.timestamp - n.timestamp);
2671
+ return r.length > 0 ? r[0] : void 0;
2672
+ }, "lastEvent"), Wo = /* @__PURE__ */ o(async (e = void 0) => {
2673
+ let t = e || await Re.cache.get("lastEvents") || {}, r = Uo(t, la), n = Uo(t, pa);
2674
+ if (r)
2675
+ return !n?.timestamp || r.timestamp > n.timestamp ? fa(r) : void 0;
2676
+ }, "getPrecedingUpgrade");
2677
+
2678
+ // src/telemetry/fetch.ts
2679
+ var Ho = global.fetch;
2680
+
2681
+ // src/telemetry/session-id.ts
2682
+ var Mt = require("storybook/internal/common");
2683
+ var ma = 1e3 * 60 * 60 * 2, Q;
2684
+ var Lt = /* @__PURE__ */ o(async () => {
2685
+ let e = Date.now();
2686
+ if (!Q) {
2687
+ let t = await Mt.cache.get("session");
2688
+ t && t.lastUsed >= e - ma ? Q = t.id : Q = X();
2689
+ }
2690
+ return await Mt.cache.set("session", { id: Q, lastUsed: e }), Q;
2691
+ }, "getSessionId");
2692
+
2693
+ // src/telemetry/telemetry.ts
2694
+ var da = (0, Vo.default)(Ho), ya = process.env.STORYBOOK_TELEMETRY_URL || "https://storybook.js.org/event-log", Ne = [], qo = /* @__PURE__ */ o(
2695
+ (e, t) => {
2696
+ Ft[e] = t;
2697
+ }, "addToGlobalContext"), ha = /* @__PURE__ */ o(() => {
2698
+ try {
2699
+ let e = Jo.platform();
2700
+ return e === "win32" ? "Windows" : e === "darwin" ? "macOS" : e === "linux" ? "Linux" : `Other: ${e}`;
2701
+ } catch {
2702
+ return "Unknown";
2703
+ }
2704
+ }, "getOperatingSystem"), Ft = {
2705
+ inCI: !!process.env.CI,
2706
+ isTTY: process.stdout.isTTY,
2707
+ platform: ha(),
2708
+ nodeVersion: process.versions.node
2709
+ }, ga = /* @__PURE__ */ o(async (e, t, r) => {
2710
+ let { eventType: n, payload: i, metadata: s, ...a } = e, c = await Lt(), u = X(), f = { ...a, eventType: n, eventId: u, sessionId: c, metadata: s,
2711
+ payload: i, context: t };
2712
+ return da(ya, {
2713
+ method: "post",
2714
+ body: JSON.stringify(f),
2715
+ headers: { "Content-Type": "application/json" },
2716
+ retries: 3,
2717
+ retryOn: [503, 504],
2718
+ retryDelay: /* @__PURE__ */ o((l) => 2 ** l * (typeof r?.retryDelay == "number" && !Number.isNaN(r?.retryDelay) ? r.retryDelay : 1e3), "\
2719
+ retryDelay")
2720
+ });
2721
+ }, "prepareRequest");
2722
+ async function zo(e, t = { retryDelay: 1e3, immediate: !1 }) {
2723
+ let { eventType: r, payload: n, metadata: i, ...s } = e, a = t.stripMetadata ? Ft : {
2724
+ ...Ft,
2725
+ anonymousId: Go()
2726
+ }, c;
2727
+ try {
2728
+ c = ga(e, a, t), Ne.push(c), t.immediate ? await Promise.all(Ne) : await c;
2729
+ let u = await Lt(), f = X(), l = { ...s, eventType: r, eventId: f, sessionId: u, metadata: i, payload: n, context: a };
2730
+ await $o(r, l);
2731
+ } catch {
2732
+ } finally {
2733
+ Ne = Ne.filter((u) => u !== c);
2734
+ }
2735
+ }
2736
+ o(zo, "sendTelemetry");
2737
+
2738
+ // src/telemetry/index.ts
2739
+ var ba = /* @__PURE__ */ o((e) => e.startsWith("example-button--") || e.startsWith("example-header--") || e.startsWith("example-page--"), "i\
2740
+ sExampleStoryId"), xa = /* @__PURE__ */ o(async (e, t = {}, r = {}) => {
2741
+ e !== "boot" && r.notify !== !1 && await Jt();
2742
+ let n = {
2743
+ eventType: e,
2744
+ payload: t
2745
+ };
2746
+ try {
2747
+ r?.stripMetadata || (n.metadata = await Nt(r?.configDir));
2748
+ } catch (i) {
2749
+ n.payload.metadataErrorMessage = U(i).message, r?.enableCrashReports && (n.payload.metadataError = U(i));
2750
+ } finally {
2751
+ let { error: i } = n.payload;
2752
+ i && (n.payload.error = U(i)), (!n.payload.error || r?.enableCrashReports) && (process.env?.STORYBOOK_TELEMETRY_DEBUG && (Bt.logger.info(
2753
+ `
2754
+ [telemetry]`), Bt.logger.info(JSON.stringify(n, null, 2))), await zo(n, r));
2755
+ }
2756
+ }, "telemetry");