storybook 9.0.0-alpha.2 → 9.0.0-alpha.21

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 (162) hide show
  1. package/README.md +1 -1
  2. package/assets/docs/addon-backgrounds.gif +0 -0
  3. package/assets/docs/addon-controls-args-annotated.png +0 -0
  4. package/assets/docs/addon-controls-args-background-color.png +0 -0
  5. package/assets/docs/addon-controls-args-background-string.png +0 -0
  6. package/assets/docs/addon-controls-args-docs.png +0 -0
  7. package/assets/docs/addon-controls-args-logging.png +0 -0
  8. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  9. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  10. package/assets/docs/addon-controls-args-reflow.png +0 -0
  11. package/assets/docs/addon-controls-args-template.png +0 -0
  12. package/assets/docs/addon-controls-expanded.png +0 -0
  13. package/assets/docs/addon-controls-hero.gif +0 -0
  14. package/assets/docs/addon-controls-install.png +0 -0
  15. package/assets/docs/hero.gif +0 -0
  16. package/assets/docs/highlight.png +0 -0
  17. package/assets/docs/viewport.png +0 -0
  18. package/assets/server/base-preview-head.html +1 -3
  19. package/bin/index.cjs +2 -2
  20. package/dist/actions/decorator.d.ts +6 -0
  21. package/dist/actions/decorator.js +134 -0
  22. package/dist/actions/index.cjs +123 -0
  23. package/dist/actions/index.d.ts +102 -0
  24. package/dist/actions/index.js +108 -0
  25. package/dist/actions/preview.cjs +161 -0
  26. package/dist/actions/preview.d.ts +54 -0
  27. package/dist/actions/preview.js +152 -0
  28. package/dist/babel/index.cjs +822 -816
  29. package/dist/babel/index.js +822 -816
  30. package/dist/backgrounds/index.cjs +148 -0
  31. package/dist/backgrounds/index.d.ts +91 -0
  32. package/dist/backgrounds/index.js +130 -0
  33. package/dist/backgrounds/preview.cjs +143 -0
  34. package/dist/backgrounds/preview.d.ts +54 -0
  35. package/dist/backgrounds/preview.js +127 -0
  36. package/dist/bin/index.cjs +49 -70
  37. package/dist/bin/index.js +49 -70
  38. package/dist/builder-manager/index.cjs +319 -326
  39. package/dist/builder-manager/index.js +576 -583
  40. package/dist/channels/index.cjs +1026 -981
  41. package/dist/channels/index.js +1258 -1207
  42. package/dist/cli/bin/index.cjs +483 -483
  43. package/dist/cli/bin/index.js +495 -495
  44. package/dist/cli/index.cjs +61735 -7590
  45. package/dist/cli/index.d.ts +25 -21
  46. package/dist/cli/index.js +61776 -7631
  47. package/dist/client-logger/index.cjs +56 -88
  48. package/dist/client-logger/index.js +41 -47
  49. package/dist/common/index.cjs +16137 -9085
  50. package/dist/common/index.d.ts +35 -30
  51. package/dist/common/index.js +16230 -9172
  52. package/dist/component-testing/index.cjs +23 -0
  53. package/dist/component-testing/index.d.ts +3 -0
  54. package/dist/component-testing/index.js +5 -0
  55. package/dist/component-testing/preview.cjs +40 -0
  56. package/dist/component-testing/preview.d.ts +5 -0
  57. package/dist/component-testing/preview.js +25 -0
  58. package/dist/components/index.cjs +16268 -24926
  59. package/dist/components/index.d.ts +98 -347
  60. package/dist/components/index.js +5905 -19177
  61. package/dist/controls/decorator.d.ts +5 -0
  62. package/dist/controls/decorator.js +8 -0
  63. package/dist/controls/index.cjs +26 -0
  64. package/dist/controls/index.d.ts +39 -0
  65. package/dist/controls/index.js +6 -0
  66. package/dist/controls/preview.cjs +26 -0
  67. package/dist/controls/preview.d.ts +54 -0
  68. package/dist/controls/preview.js +9 -0
  69. package/dist/core-events/index.cjs +91 -106
  70. package/dist/core-events/index.d.ts +139 -104
  71. package/dist/core-events/index.js +79 -94
  72. package/dist/core-server/index.cjs +13898 -13409
  73. package/dist/core-server/index.d.ts +270 -3
  74. package/dist/core-server/index.js +13981 -13497
  75. package/dist/core-server/presets/common-manager.css +170 -0
  76. package/dist/core-server/presets/common-manager.js +12149 -17
  77. package/dist/core-server/presets/common-preset.cjs +3009 -3155
  78. package/dist/core-server/presets/common-preset.js +2862 -3009
  79. package/dist/csf/index.cjs +76 -120
  80. package/dist/csf/index.d.ts +2 -6
  81. package/dist/csf/index.js +69 -113
  82. package/dist/csf-tools/index.cjs +412 -403
  83. package/dist/csf-tools/index.d.ts +0 -4
  84. package/dist/csf-tools/index.js +410 -401
  85. package/dist/docs-tools/index.cjs +2569 -575
  86. package/dist/docs-tools/index.d.ts +2 -2
  87. package/dist/docs-tools/index.js +2565 -564
  88. package/dist/highlight/index.cjs +27 -0
  89. package/dist/highlight/index.d.ts +61 -0
  90. package/dist/highlight/index.js +7 -0
  91. package/dist/highlight/preview.cjs +535 -0
  92. package/dist/highlight/preview.d.ts +54 -0
  93. package/dist/highlight/preview.js +519 -0
  94. package/dist/instrumenter/index.cjs +2207 -2342
  95. package/dist/instrumenter/index.d.ts +8 -7
  96. package/dist/instrumenter/index.js +2430 -2603
  97. package/dist/manager/globals-module-info.cjs +291 -151
  98. package/dist/manager/globals-module-info.d.ts +1 -1
  99. package/dist/manager/globals-module-info.js +275 -135
  100. package/dist/manager/globals-runtime.js +60263 -28383
  101. package/dist/manager/globals.cjs +23 -19
  102. package/dist/manager/globals.d.ts +8 -5
  103. package/dist/manager/globals.js +10 -6
  104. package/dist/manager/runtime.js +4625 -3921
  105. package/dist/manager-api/index.cjs +4228 -3833
  106. package/dist/manager-api/index.d.ts +398 -102
  107. package/dist/manager-api/index.js +3500 -3084
  108. package/dist/manager-errors.d.ts +25 -1
  109. package/dist/manager-errors.js +50 -30
  110. package/dist/measure/index.cjs +476 -0
  111. package/dist/measure/index.d.ts +66 -0
  112. package/dist/measure/index.js +464 -0
  113. package/dist/measure/preview.cjs +466 -0
  114. package/dist/measure/preview.d.ts +59 -0
  115. package/dist/measure/preview.js +450 -0
  116. package/dist/outline/index.cjs +528 -0
  117. package/dist/outline/index.d.ts +66 -0
  118. package/dist/outline/index.js +500 -0
  119. package/dist/outline/preview.cjs +518 -0
  120. package/dist/outline/preview.d.ts +59 -0
  121. package/dist/outline/preview.js +486 -0
  122. package/dist/preview/globals.cjs +21 -17
  123. package/dist/preview/globals.d.ts +4 -1
  124. package/dist/preview/globals.js +6 -2
  125. package/dist/preview/runtime.js +46311 -6614
  126. package/dist/preview-api/index.cjs +1363 -1899
  127. package/dist/preview-api/index.d.ts +81 -395
  128. package/dist/preview-api/index.js +1711 -2169
  129. package/dist/preview-errors.cjs +119 -88
  130. package/dist/preview-errors.d.ts +30 -2
  131. package/dist/preview-errors.js +192 -142
  132. package/dist/router/index.cjs +847 -871
  133. package/dist/router/index.js +193 -199
  134. package/dist/server-errors.cjs +188 -124
  135. package/dist/server-errors.d.ts +36 -2
  136. package/dist/server-errors.js +188 -124
  137. package/dist/telemetry/index.cjs +1056 -1979
  138. package/dist/telemetry/index.d.ts +26 -5
  139. package/dist/telemetry/index.js +1091 -2010
  140. package/dist/test/index.cjs +35686 -0
  141. package/dist/test/index.d.ts +186 -0
  142. package/dist/test/index.js +33840 -0
  143. package/dist/test/preview.cjs +15870 -0
  144. package/dist/test/preview.d.ts +48 -0
  145. package/dist/test/preview.js +14501 -0
  146. package/dist/test/spy.cjs +258 -0
  147. package/dist/test/spy.d.ts +66 -0
  148. package/dist/test/spy.js +240 -0
  149. package/dist/theming/create.cjs +79 -2269
  150. package/dist/theming/create.js +67 -841
  151. package/dist/theming/index.cjs +1065 -3232
  152. package/dist/theming/index.js +951 -1719
  153. package/dist/types/index.cjs +11 -12
  154. package/dist/types/index.d.ts +684 -163
  155. package/dist/types/index.js +1 -2
  156. package/dist/viewport/index.cjs +310 -0
  157. package/dist/viewport/index.d.ts +320 -0
  158. package/dist/viewport/index.js +290 -0
  159. package/dist/viewport/preview.cjs +35 -0
  160. package/dist/viewport/preview.d.ts +68 -0
  161. package/dist/viewport/preview.js +19 -0
  162. package/package.json +359 -12
@@ -1,517 +1,2500 @@
1
1
  "use strict";
2
- var P = Object.defineProperty;
3
- var Ee = Object.getOwnPropertyDescriptor;
4
- var je = Object.getOwnPropertyNames;
5
- var ke = Object.prototype.hasOwnProperty;
6
- var o = (e, t) => P(e, "name", { value: t, configurable: !0 });
7
- var Fe = (e, t) => {
8
- for (var r in t)
9
- P(e, r, { get: t[r], enumerable: !0 });
10
- }, Je = (e, t, r, n) => {
11
- if (t && typeof t == "object" || typeof t == "function")
12
- for (let s of je(t))
13
- !ke.call(e, s) && s !== r && P(e, s, { get: () => t[s], enumerable: !(n = Ee(t, s)) || n.enumerable });
14
- return e;
2
+ var Tr = Object.create;
3
+ var z = Object.defineProperty;
4
+ var gr = Object.getOwnPropertyDescriptor;
5
+ var hr = Object.getOwnPropertyNames;
6
+ var xr = Object.getPrototypeOf, Jr = Object.prototype.hasOwnProperty;
7
+ var r = (n, s) => z(n, "name", { value: s, configurable: !0 });
8
+ var Pr = (n, s) => () => (s || n((s = { exports: {} }).exports, s), s.exports), wr = (n, s) => {
9
+ for (var a in s)
10
+ z(n, a, { get: s[a], enumerable: !0 });
11
+ }, it = (n, s, a, p) => {
12
+ if (s && typeof s == "object" || typeof s == "function")
13
+ for (let c of hr(s))
14
+ !Jr.call(n, c) && c !== a && z(n, c, { get: () => s[c], enumerable: !(p = gr(s, c)) || p.enumerable });
15
+ return n;
15
16
  };
16
- var Ne = (e) => Je(P({}, "__esModule", { value: !0 }), e);
17
+ var br = (n, s, a) => (a = n != null ? Tr(xr(n)) : {}, it(
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
+ s || !n || !n.__esModule ? z(a, "default", { value: n, enumerable: !0 }) : a,
23
+ n
24
+ )), Er = (n) => it(z({}, "__esModule", { value: !0 }), n);
25
+
26
+ // ../node_modules/jsdoc-type-pratt-parser/dist/index.js
27
+ var gt = Pr((ue, Tt) => {
28
+ (function(n, s) {
29
+ typeof ue == "object" && typeof Tt < "u" ? s(ue) : typeof define == "function" && define.amd ? define(["exports"], s) : (n = typeof globalThis <
30
+ "u" ? globalThis : n || self, s(n.jtpp = {}));
31
+ })(ue, function(n) {
32
+ "use strict";
33
+ function s(e) {
34
+ return e.text !== void 0 && e.text !== "" ? `'${e.type}' with value '${e.text}'` : `'${e.type}'`;
35
+ }
36
+ r(s, "tokenToString");
37
+ class a extends Error {
38
+ static {
39
+ r(this, "NoParsletFoundError");
40
+ }
41
+ constructor(t) {
42
+ super(`No parslet found for token: ${s(t)}`), this.token = t, Object.setPrototypeOf(this, a.prototype);
43
+ }
44
+ getToken() {
45
+ return this.token;
46
+ }
47
+ }
48
+ class p extends Error {
49
+ static {
50
+ r(this, "EarlyEndOfParseError");
51
+ }
52
+ constructor(t) {
53
+ super(`The parsing ended early. The next token was: ${s(t)}`), this.token = t, Object.setPrototypeOf(this, p.prototype);
54
+ }
55
+ getToken() {
56
+ return this.token;
57
+ }
58
+ }
59
+ class c extends Error {
60
+ static {
61
+ r(this, "UnexpectedTypeError");
62
+ }
63
+ constructor(t, o) {
64
+ let i = `Unexpected type: '${t.type}'.`;
65
+ o !== void 0 && (i += ` Message: ${o}`), super(i), Object.setPrototypeOf(this, c.prototype);
66
+ }
67
+ }
68
+ function u(e) {
69
+ return (t) => t.startsWith(e) ? { type: e, text: e } : null;
70
+ }
71
+ r(u, "makePunctuationRule");
72
+ function m(e) {
73
+ let t = 0, o, i = e[0], l = !1;
74
+ if (i !== "'" && i !== '"')
75
+ return null;
76
+ for (; t < e.length; ) {
77
+ if (t++, o = e[t], !l && o === i) {
78
+ t++;
79
+ break;
80
+ }
81
+ l = !l && o === "\\";
82
+ }
83
+ if (o !== i)
84
+ throw new Error("Unterminated String");
85
+ return e.slice(0, t);
86
+ }
87
+ r(m, "getQuoted");
88
+ let T = /[$_\p{ID_Start}]|\\u\p{Hex_Digit}{4}|\\u\{0*(?:\p{Hex_Digit}{1,5}|10\p{Hex_Digit}{4})\}/u, g = /[$\-\p{ID_Continue}\u200C\u200D]|\\u\p{Hex_Digit}{4}|\\u\{0*(?:\p{Hex_Digit}{1,5}|10\p{Hex_Digit}{4})\}/u;
89
+ function w(e) {
90
+ let t = e[0];
91
+ if (!T.test(t))
92
+ return null;
93
+ let o = 1;
94
+ do {
95
+ if (t = e[o], !g.test(t))
96
+ break;
97
+ o++;
98
+ } while (o < e.length);
99
+ return e.slice(0, o);
100
+ }
101
+ r(w, "getIdentifier");
102
+ let b = /^(NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity))/;
103
+ function fe(e) {
104
+ var t, o;
105
+ return (o = (t = b.exec(e)) === null || t === void 0 ? void 0 : t[0]) !== null && o !== void 0 ? o : null;
106
+ }
107
+ r(fe, "getNumber");
108
+ let $ = /* @__PURE__ */ r((e) => {
109
+ let t = w(e);
110
+ return t == null ? null : {
111
+ type: "Identifier",
112
+ text: t
113
+ };
114
+ }, "identifierRule");
115
+ function E(e) {
116
+ return (t) => {
117
+ if (!t.startsWith(e))
118
+ return null;
119
+ let o = t[e.length];
120
+ return o !== void 0 && g.test(o) ? null : {
121
+ type: e,
122
+ text: e
123
+ };
124
+ };
125
+ }
126
+ r(E, "makeKeyWordRule");
127
+ let Q = /* @__PURE__ */ r((e) => {
128
+ let t = m(e);
129
+ return t == null ? null : {
130
+ type: "StringValue",
131
+ text: t
132
+ };
133
+ }, "stringValueRule"), de = /* @__PURE__ */ r((e) => e.length > 0 ? null : {
134
+ type: "EOF",
135
+ text: ""
136
+ }, "eofRule"), Te = /* @__PURE__ */ r((e) => {
137
+ let t = fe(e);
138
+ return t === null ? null : {
139
+ type: "Number",
140
+ text: t
141
+ };
142
+ }, "numberRule"), jt = [
143
+ de,
144
+ u("=>"),
145
+ u("("),
146
+ u(")"),
147
+ u("{"),
148
+ u("}"),
149
+ u("["),
150
+ u("]"),
151
+ u("|"),
152
+ u("&"),
153
+ u("<"),
154
+ u(">"),
155
+ u(","),
156
+ u(";"),
157
+ u("*"),
158
+ u("?"),
159
+ u("!"),
160
+ u("="),
161
+ u(":"),
162
+ u("..."),
163
+ u("."),
164
+ u("#"),
165
+ u("~"),
166
+ u("/"),
167
+ u("@"),
168
+ E("undefined"),
169
+ E("null"),
170
+ E("function"),
171
+ E("this"),
172
+ E("new"),
173
+ E("module"),
174
+ E("event"),
175
+ E("external"),
176
+ E("typeof"),
177
+ E("keyof"),
178
+ E("readonly"),
179
+ E("import"),
180
+ E("is"),
181
+ E("in"),
182
+ Te,
183
+ $,
184
+ Q
185
+ ], _t = /^\s*\n\s*/;
186
+ class q {
187
+ static {
188
+ r(this, "Lexer");
189
+ }
190
+ static create(t) {
191
+ let o = this.read(t);
192
+ t = o.text;
193
+ let i = this.read(t);
194
+ return t = i.text, new q(t, void 0, o.token, i.token);
195
+ }
196
+ constructor(t, o, i, l) {
197
+ this.text = "", this.text = t, this.previous = o, this.current = i, this.next = l;
198
+ }
199
+ static read(t, o = !1) {
200
+ o = o || _t.test(t), t = t.trim();
201
+ for (let i of jt) {
202
+ let l = i(t);
203
+ if (l !== null) {
204
+ let y = Object.assign(Object.assign({}, l), { startOfLine: o });
205
+ return t = t.slice(y.text.length), { text: t, token: y };
206
+ }
207
+ }
208
+ throw new Error("Unexpected Token " + t);
209
+ }
210
+ advance() {
211
+ let t = q.read(this.text);
212
+ return new q(t.text, this.current, this.next, t.token);
213
+ }
214
+ }
215
+ function P(e) {
216
+ if (e === void 0)
217
+ throw new Error("Unexpected undefined");
218
+ if (e.type === "JsdocTypeKeyValue" || e.type === "JsdocTypeParameterList" || e.type === "JsdocTypeProperty" || e.type === "JsdocTypeRe\
219
+ adonlyProperty" || e.type === "JsdocTypeObjectField" || e.type === "JsdocTypeJsdocObjectField" || e.type === "JsdocTypeIndexSignature" || e.
220
+ type === "JsdocTypeMappedType")
221
+ throw new c(e);
222
+ return e;
223
+ }
224
+ r(P, "assertRootResult");
225
+ function ge(e) {
226
+ return e.type === "JsdocTypeKeyValue" ? Z(e) : P(e);
227
+ }
228
+ r(ge, "assertPlainKeyValueOrRootResult");
229
+ function Lt(e) {
230
+ return e.type === "JsdocTypeName" ? e : Z(e);
231
+ }
232
+ r(Lt, "assertPlainKeyValueOrNameResult");
233
+ function Z(e) {
234
+ if (e.type !== "JsdocTypeKeyValue")
235
+ throw new c(e);
236
+ return e;
237
+ }
238
+ r(Z, "assertPlainKeyValueResult");
239
+ function Vt(e) {
240
+ var t;
241
+ if (e.type === "JsdocTypeVariadic") {
242
+ if (((t = e.element) === null || t === void 0 ? void 0 : t.type) === "JsdocTypeName")
243
+ return e;
244
+ throw new c(e);
245
+ }
246
+ if (e.type !== "JsdocTypeNumber" && e.type !== "JsdocTypeName")
247
+ throw new c(e);
248
+ return e;
249
+ }
250
+ r(Vt, "assertNumberOrVariadicNameResult");
251
+ function he(e) {
252
+ return e.type === "JsdocTypeIndexSignature" || e.type === "JsdocTypeMappedType";
253
+ }
254
+ r(he, "isSquaredProperty");
255
+ var f;
256
+ (function(e) {
257
+ e[e.ALL = 0] = "ALL", e[e.PARAMETER_LIST = 1] = "PARAMETER_LIST", e[e.OBJECT = 2] = "OBJECT", e[e.KEY_VALUE = 3] = "KEY_VALUE", e[e.UNION =
258
+ 4] = "UNION", e[e.INTERSECTION = 5] = "INTERSECTION", e[e.PREFIX = 6] = "PREFIX", e[e.INFIX = 7] = "INFIX", e[e.TUPLE = 8] = "TUPLE", e[e.
259
+ SYMBOL = 9] = "SYMBOL", e[e.OPTIONAL = 10] = "OPTIONAL", e[e.NULLABLE = 11] = "NULLABLE", e[e.KEY_OF_TYPE_OF = 12] = "KEY_OF_TYPE_OF",
260
+ e[e.FUNCTION = 13] = "FUNCTION", e[e.ARROW = 14] = "ARROW", e[e.ARRAY_BRACKETS = 15] = "ARRAY_BRACKETS", e[e.GENERIC = 16] = "GENERIC",
261
+ e[e.NAME_PATH = 17] = "NAME_PATH", e[e.PARENTHESIS = 18] = "PARENTHESIS", e[e.SPECIAL_TYPES = 19] = "SPECIAL_TYPES";
262
+ })(f || (f = {}));
263
+ class V {
264
+ static {
265
+ r(this, "Parser");
266
+ }
267
+ constructor(t, o, i) {
268
+ this.grammar = t, typeof o == "string" ? this._lexer = q.create(o) : this._lexer = o, this.baseParser = i;
269
+ }
270
+ get lexer() {
271
+ return this._lexer;
272
+ }
273
+ /**
274
+ * Parses a given string and throws an error if the parse ended before the end of the string.
275
+ */
276
+ parse() {
277
+ let t = this.parseType(f.ALL);
278
+ if (this.lexer.current.type !== "EOF")
279
+ throw new p(this.lexer.current);
280
+ return t;
281
+ }
282
+ /**
283
+ * Parses with the current lexer and asserts that the result is a {@link RootResult}.
284
+ */
285
+ parseType(t) {
286
+ return P(this.parseIntermediateType(t));
287
+ }
288
+ /**
289
+ * The main parsing function. First it tries to parse the current state in the prefix step, and then it continues
290
+ * to parse the state in the infix step.
291
+ */
292
+ parseIntermediateType(t) {
293
+ let o = this.tryParslets(null, t);
294
+ if (o === null)
295
+ throw new a(this.lexer.current);
296
+ return this.parseInfixIntermediateType(o, t);
297
+ }
298
+ /**
299
+ * In the infix parsing step the parser continues to parse the current state with all parslets until none returns
300
+ * a result.
301
+ */
302
+ parseInfixIntermediateType(t, o) {
303
+ let i = this.tryParslets(t, o);
304
+ for (; i !== null; )
305
+ t = i, i = this.tryParslets(t, o);
306
+ return t;
307
+ }
308
+ /**
309
+ * Tries to parse the current state with all parslets in the grammar and returns the first non null result.
310
+ */
311
+ tryParslets(t, o) {
312
+ for (let i of this.grammar) {
313
+ let l = i(this, o, t);
314
+ if (l !== null)
315
+ return l;
316
+ }
317
+ return null;
318
+ }
319
+ /**
320
+ * If the given type equals the current type of the {@link Lexer} advance the lexer. Return true if the lexer was
321
+ * advanced.
322
+ */
323
+ consume(t) {
324
+ return Array.isArray(t) || (t = [t]), t.includes(this.lexer.current.type) ? (this._lexer = this.lexer.advance(), !0) : !1;
325
+ }
326
+ acceptLexerState(t) {
327
+ this._lexer = t.lexer;
328
+ }
329
+ }
330
+ function ze(e) {
331
+ return e === "EOF" || e === "|" || e === "," || e === ")" || e === ">";
332
+ }
333
+ r(ze, "isQuestionMarkUnknownType");
334
+ let xe = /* @__PURE__ */ r((e, t, o) => {
335
+ let i = e.lexer.current.type, l = e.lexer.next.type;
336
+ return o == null && i === "?" && !ze(l) || o != null && i === "?" ? (e.consume("?"), o == null ? {
337
+ type: "JsdocTypeNullable",
338
+ element: e.parseType(f.NULLABLE),
339
+ meta: {
340
+ position: "prefix"
341
+ }
342
+ } : {
343
+ type: "JsdocTypeNullable",
344
+ element: P(o),
345
+ meta: {
346
+ position: "suffix"
347
+ }
348
+ }) : null;
349
+ }, "nullableParslet");
350
+ function h(e) {
351
+ let t = /* @__PURE__ */ r((o, i, l) => {
352
+ let y = o.lexer.current.type, d = o.lexer.next.type;
353
+ if (l === null) {
354
+ if ("parsePrefix" in e && e.accept(y, d))
355
+ return e.parsePrefix(o);
356
+ } else if ("parseInfix" in e && e.precedence > i && e.accept(y, d))
357
+ return e.parseInfix(o, l);
358
+ return null;
359
+ }, "parslet");
360
+ return Object.defineProperty(t, "name", {
361
+ value: e.name
362
+ }), t;
363
+ }
364
+ r(h, "composeParslet");
365
+ let ee = h({
366
+ name: "optionalParslet",
367
+ accept: /* @__PURE__ */ r((e) => e === "=", "accept"),
368
+ precedence: f.OPTIONAL,
369
+ parsePrefix: /* @__PURE__ */ r((e) => (e.consume("="), {
370
+ type: "JsdocTypeOptional",
371
+ element: e.parseType(f.OPTIONAL),
372
+ meta: {
373
+ position: "prefix"
374
+ }
375
+ }), "parsePrefix"),
376
+ parseInfix: /* @__PURE__ */ r((e, t) => (e.consume("="), {
377
+ type: "JsdocTypeOptional",
378
+ element: P(t),
379
+ meta: {
380
+ position: "suffix"
381
+ }
382
+ }), "parseInfix")
383
+ }), te = h({
384
+ name: "numberParslet",
385
+ accept: /* @__PURE__ */ r((e) => e === "Number", "accept"),
386
+ parsePrefix: /* @__PURE__ */ r((e) => {
387
+ let t = parseFloat(e.lexer.current.text);
388
+ return e.consume("Number"), {
389
+ type: "JsdocTypeNumber",
390
+ value: t
391
+ };
392
+ }, "parsePrefix")
393
+ }), Ut = h({
394
+ name: "parenthesisParslet",
395
+ accept: /* @__PURE__ */ r((e) => e === "(", "accept"),
396
+ parsePrefix: /* @__PURE__ */ r((e) => {
397
+ if (e.consume("("), e.consume(")"))
398
+ return {
399
+ type: "JsdocTypeParameterList",
400
+ elements: []
401
+ };
402
+ let t = e.parseIntermediateType(f.ALL);
403
+ if (!e.consume(")"))
404
+ throw new Error("Unterminated parenthesis");
405
+ return t.type === "JsdocTypeParameterList" ? t : t.type === "JsdocTypeKeyValue" ? {
406
+ type: "JsdocTypeParameterList",
407
+ elements: [t]
408
+ } : {
409
+ type: "JsdocTypeParenthesis",
410
+ element: P(t)
411
+ };
412
+ }, "parsePrefix")
413
+ }), Bt = h({
414
+ name: "specialTypesParslet",
415
+ accept: /* @__PURE__ */ r((e, t) => e === "?" && ze(t) || e === "null" || e === "undefined" || e === "*", "accept"),
416
+ parsePrefix: /* @__PURE__ */ r((e) => {
417
+ if (e.consume("null"))
418
+ return {
419
+ type: "JsdocTypeNull"
420
+ };
421
+ if (e.consume("undefined"))
422
+ return {
423
+ type: "JsdocTypeUndefined"
424
+ };
425
+ if (e.consume("*"))
426
+ return {
427
+ type: "JsdocTypeAny"
428
+ };
429
+ if (e.consume("?"))
430
+ return {
431
+ type: "JsdocTypeUnknown"
432
+ };
433
+ throw new Error("Unacceptable token: " + e.lexer.current.text);
434
+ }, "parsePrefix")
435
+ }), Ct = h({
436
+ name: "notNullableParslet",
437
+ accept: /* @__PURE__ */ r((e) => e === "!", "accept"),
438
+ precedence: f.NULLABLE,
439
+ parsePrefix: /* @__PURE__ */ r((e) => (e.consume("!"), {
440
+ type: "JsdocTypeNotNullable",
441
+ element: e.parseType(f.NULLABLE),
442
+ meta: {
443
+ position: "prefix"
444
+ }
445
+ }), "parsePrefix"),
446
+ parseInfix: /* @__PURE__ */ r((e, t) => (e.consume("!"), {
447
+ type: "JsdocTypeNotNullable",
448
+ element: P(t),
449
+ meta: {
450
+ position: "suffix"
451
+ }
452
+ }), "parseInfix")
453
+ });
454
+ function Mt({ allowTrailingComma: e }) {
455
+ return h({
456
+ name: "parameterListParslet",
457
+ accept: /* @__PURE__ */ r((t) => t === ",", "accept"),
458
+ precedence: f.PARAMETER_LIST,
459
+ parseInfix: /* @__PURE__ */ r((t, o) => {
460
+ let i = [
461
+ ge(o)
462
+ ];
463
+ t.consume(",");
464
+ do
465
+ try {
466
+ let l = t.parseIntermediateType(f.PARAMETER_LIST);
467
+ i.push(ge(l));
468
+ } catch (l) {
469
+ if (e && l instanceof a)
470
+ break;
471
+ throw l;
472
+ }
473
+ while (t.consume(","));
474
+ if (i.length > 0 && i.slice(0, -1).some((l) => l.type === "JsdocTypeVariadic"))
475
+ throw new Error("Only the last parameter may be a rest parameter");
476
+ return {
477
+ type: "JsdocTypeParameterList",
478
+ elements: i
479
+ };
480
+ }, "parseInfix")
481
+ });
482
+ }
483
+ r(Mt, "createParameterListParslet");
484
+ let Kt = h({
485
+ name: "genericParslet",
486
+ accept: /* @__PURE__ */ r((e, t) => e === "<" || e === "." && t === "<", "accept"),
487
+ precedence: f.GENERIC,
488
+ parseInfix: /* @__PURE__ */ r((e, t) => {
489
+ let o = e.consume(".");
490
+ e.consume("<");
491
+ let i = [];
492
+ do
493
+ i.push(e.parseType(f.PARAMETER_LIST));
494
+ while (e.consume(","));
495
+ if (!e.consume(">"))
496
+ throw new Error("Unterminated generic parameter list");
497
+ return {
498
+ type: "JsdocTypeGeneric",
499
+ left: P(t),
500
+ elements: i,
501
+ meta: {
502
+ brackets: "angle",
503
+ dot: o
504
+ }
505
+ };
506
+ }, "parseInfix")
507
+ }), $t = h({
508
+ name: "unionParslet",
509
+ accept: /* @__PURE__ */ r((e) => e === "|", "accept"),
510
+ precedence: f.UNION,
511
+ parseInfix: /* @__PURE__ */ r((e, t) => {
512
+ e.consume("|");
513
+ let o = [];
514
+ do
515
+ o.push(e.parseType(f.UNION));
516
+ while (e.consume("|"));
517
+ return {
518
+ type: "JsdocTypeUnion",
519
+ elements: [P(t), ...o]
520
+ };
521
+ }, "parseInfix")
522
+ }), Je = [
523
+ xe,
524
+ ee,
525
+ te,
526
+ Ut,
527
+ Bt,
528
+ Ct,
529
+ Mt({
530
+ allowTrailingComma: !0
531
+ }),
532
+ Kt,
533
+ $t,
534
+ ee
535
+ ];
536
+ function re({ allowSquareBracketsOnAnyType: e, allowJsdocNamePaths: t, pathGrammar: o }) {
537
+ return /* @__PURE__ */ r(function(l, y, d) {
538
+ if (d == null || y >= f.NAME_PATH)
539
+ return null;
540
+ let x = l.lexer.current.type, N = l.lexer.next.type;
541
+ if (!(x === "." && N !== "<" || x === "[" && (e || d.type === "JsdocTypeName") || t && (x === "~" || x === "#")))
542
+ return null;
543
+ let D, se = !1;
544
+ l.consume(".") ? D = "property" : l.consume("[") ? (D = "property-brackets", se = !0) : l.consume("~") ? D = "inner" : (l.consume("#"),
545
+ D = "instance");
546
+ let st = o !== null ? new V(o, l.lexer, l) : l, k = st.parseIntermediateType(f.NAME_PATH);
547
+ l.acceptLexerState(st);
548
+ let G;
549
+ switch (k.type) {
550
+ case "JsdocTypeName":
551
+ G = {
552
+ type: "JsdocTypeProperty",
553
+ value: k.value,
554
+ meta: {
555
+ quote: void 0
556
+ }
557
+ };
558
+ break;
559
+ case "JsdocTypeNumber":
560
+ G = {
561
+ type: "JsdocTypeProperty",
562
+ value: k.value.toString(10),
563
+ meta: {
564
+ quote: void 0
565
+ }
566
+ };
567
+ break;
568
+ case "JsdocTypeStringValue":
569
+ G = {
570
+ type: "JsdocTypeProperty",
571
+ value: k.value,
572
+ meta: {
573
+ quote: k.meta.quote
574
+ }
575
+ };
576
+ break;
577
+ case "JsdocTypeSpecialNamePath":
578
+ if (k.specialType === "event")
579
+ G = k;
580
+ else
581
+ throw new c(k, "Type 'JsdocTypeSpecialNamePath' is only allowed with specialType 'event'");
582
+ break;
583
+ default:
584
+ throw new c(k, "Expecting 'JsdocTypeName', 'JsdocTypeNumber', 'JsdocStringValue' or 'JsdocTypeSpecialNamePath'");
585
+ }
586
+ if (se && !l.consume("]")) {
587
+ let at = l.lexer.current;
588
+ throw new Error(`Unterminated square brackets. Next token is '${at.type}' with text '${at.text}'`);
589
+ }
590
+ return {
591
+ type: "JsdocTypeNamePath",
592
+ left: P(d),
593
+ right: G,
594
+ pathType: D
595
+ };
596
+ }, "namePathParslet");
597
+ }
598
+ r(re, "createNamePathParslet");
599
+ function R({ allowedAdditionalTokens: e }) {
600
+ return h({
601
+ name: "nameParslet",
602
+ accept: /* @__PURE__ */ r((t) => t === "Identifier" || t === "this" || t === "new" || e.includes(t), "accept"),
603
+ parsePrefix: /* @__PURE__ */ r((t) => {
604
+ let { type: o, text: i } = t.lexer.current;
605
+ return t.consume(o), {
606
+ type: "JsdocTypeName",
607
+ value: i
608
+ };
609
+ }, "parsePrefix")
610
+ });
611
+ }
612
+ r(R, "createNameParslet");
613
+ let Y = h({
614
+ name: "stringValueParslet",
615
+ accept: /* @__PURE__ */ r((e) => e === "StringValue", "accept"),
616
+ parsePrefix: /* @__PURE__ */ r((e) => {
617
+ let t = e.lexer.current.text;
618
+ return e.consume("StringValue"), {
619
+ type: "JsdocTypeStringValue",
620
+ value: t.slice(1, -1),
621
+ meta: {
622
+ quote: t[0] === "'" ? "single" : "double"
623
+ }
624
+ };
625
+ }, "parsePrefix")
626
+ });
627
+ function ne({ pathGrammar: e, allowedTypes: t }) {
628
+ return h({
629
+ name: "specialNamePathParslet",
630
+ accept: /* @__PURE__ */ r((o) => t.includes(o), "accept"),
631
+ parsePrefix: /* @__PURE__ */ r((o) => {
632
+ let i = o.lexer.current.type;
633
+ if (o.consume(i), !o.consume(":"))
634
+ return {
635
+ type: "JsdocTypeName",
636
+ value: i
637
+ };
638
+ let l, y = o.lexer.current;
639
+ if (o.consume("StringValue"))
640
+ l = {
641
+ type: "JsdocTypeSpecialNamePath",
642
+ value: y.text.slice(1, -1),
643
+ specialType: i,
644
+ meta: {
645
+ quote: y.text[0] === "'" ? "single" : "double"
646
+ }
647
+ };
648
+ else {
649
+ let N = "", S = ["Identifier", "@", "/"];
650
+ for (; S.some((D) => o.consume(D)); )
651
+ N += y.text, y = o.lexer.current;
652
+ l = {
653
+ type: "JsdocTypeSpecialNamePath",
654
+ value: N,
655
+ specialType: i,
656
+ meta: {
657
+ quote: void 0
658
+ }
659
+ };
660
+ }
661
+ let d = new V(e, o.lexer, o), x = d.parseInfixIntermediateType(l, f.ALL);
662
+ return o.acceptLexerState(d), P(x);
663
+ }, "parsePrefix")
664
+ });
665
+ }
666
+ r(ne, "createSpecialNamePathParslet");
667
+ let Xe = [
668
+ R({
669
+ allowedAdditionalTokens: ["external", "module"]
670
+ }),
671
+ Y,
672
+ te,
673
+ re({
674
+ allowSquareBracketsOnAnyType: !1,
675
+ allowJsdocNamePaths: !0,
676
+ pathGrammar: null
677
+ })
678
+ ], U = [
679
+ ...Xe,
680
+ ne({
681
+ allowedTypes: ["event"],
682
+ pathGrammar: Xe
683
+ })
684
+ ];
685
+ function Pe(e) {
686
+ let t;
687
+ if (e.type === "JsdocTypeParameterList")
688
+ t = e.elements;
689
+ else if (e.type === "JsdocTypeParenthesis")
690
+ t = [e.element];
691
+ else
692
+ throw new c(e);
693
+ return t.map((o) => ge(o));
694
+ }
695
+ r(Pe, "getParameters");
696
+ function qt(e) {
697
+ let t = Pe(e);
698
+ if (t.some((o) => o.type === "JsdocTypeKeyValue"))
699
+ throw new Error("No parameter should be named");
700
+ return t;
701
+ }
702
+ r(qt, "getUnnamedParameters");
703
+ function we({ allowNamedParameters: e, allowNoReturnType: t, allowWithoutParenthesis: o, allowNewAsFunctionKeyword: i }) {
704
+ return h({
705
+ name: "functionParslet",
706
+ accept: /* @__PURE__ */ r((l, y) => l === "function" || i && l === "new" && y === "(", "accept"),
707
+ parsePrefix: /* @__PURE__ */ r((l) => {
708
+ let y = l.consume("new");
709
+ l.consume("function");
710
+ let d = l.lexer.current.type === "(";
711
+ if (!d) {
712
+ if (!o)
713
+ throw new Error("function is missing parameter list");
714
+ return {
715
+ type: "JsdocTypeName",
716
+ value: "function"
717
+ };
718
+ }
719
+ let x = {
720
+ type: "JsdocTypeFunction",
721
+ parameters: [],
722
+ arrow: !1,
723
+ constructor: y,
724
+ parenthesis: d
725
+ }, N = l.parseIntermediateType(f.FUNCTION);
726
+ if (e === void 0)
727
+ x.parameters = qt(N);
728
+ else {
729
+ if (y && N.type === "JsdocTypeFunction" && N.arrow)
730
+ return x = N, x.constructor = !0, x;
731
+ x.parameters = Pe(N);
732
+ for (let S of x.parameters)
733
+ if (S.type === "JsdocTypeKeyValue" && !e.includes(S.key))
734
+ throw new Error(`only allowed named parameters are ${e.join(", ")} but got ${S.type}`);
735
+ }
736
+ if (l.consume(":"))
737
+ x.returnType = l.parseType(f.PREFIX);
738
+ else if (!t)
739
+ throw new Error("function is missing return type");
740
+ return x;
741
+ }, "parsePrefix")
742
+ });
743
+ }
744
+ r(we, "createFunctionParslet");
745
+ function be({ allowPostfix: e, allowEnclosingBrackets: t }) {
746
+ return h({
747
+ name: "variadicParslet",
748
+ accept: /* @__PURE__ */ r((o) => o === "...", "accept"),
749
+ precedence: f.PREFIX,
750
+ parsePrefix: /* @__PURE__ */ r((o) => {
751
+ o.consume("...");
752
+ let i = t && o.consume("[");
753
+ try {
754
+ let l = o.parseType(f.PREFIX);
755
+ if (i && !o.consume("]"))
756
+ throw new Error("Unterminated variadic type. Missing ']'");
757
+ return {
758
+ type: "JsdocTypeVariadic",
759
+ element: P(l),
760
+ meta: {
761
+ position: "prefix",
762
+ squareBrackets: i
763
+ }
764
+ };
765
+ } catch (l) {
766
+ if (l instanceof a) {
767
+ if (i)
768
+ throw new Error("Empty square brackets for variadic are not allowed.");
769
+ return {
770
+ type: "JsdocTypeVariadic",
771
+ meta: {
772
+ position: void 0,
773
+ squareBrackets: !1
774
+ }
775
+ };
776
+ } else
777
+ throw l;
778
+ }
779
+ }, "parsePrefix"),
780
+ parseInfix: e ? (o, i) => (o.consume("..."), {
781
+ type: "JsdocTypeVariadic",
782
+ element: P(i),
783
+ meta: {
784
+ position: "suffix",
785
+ squareBrackets: !1
786
+ }
787
+ }) : void 0
788
+ });
789
+ }
790
+ r(be, "createVariadicParslet");
791
+ let He = h({
792
+ name: "symbolParslet",
793
+ accept: /* @__PURE__ */ r((e) => e === "(", "accept"),
794
+ precedence: f.SYMBOL,
795
+ parseInfix: /* @__PURE__ */ r((e, t) => {
796
+ if (t.type !== "JsdocTypeName")
797
+ throw new Error("Symbol expects a name on the left side. (Reacting on '(')");
798
+ e.consume("(");
799
+ let o = {
800
+ type: "JsdocTypeSymbol",
801
+ value: t.value
802
+ };
803
+ if (!e.consume(")")) {
804
+ let i = e.parseIntermediateType(f.SYMBOL);
805
+ if (o.element = Vt(i), !e.consume(")"))
806
+ throw new Error("Symbol does not end after value");
807
+ }
808
+ return o;
809
+ }, "parseInfix")
810
+ }), Qe = h({
811
+ name: "arrayBracketsParslet",
812
+ precedence: f.ARRAY_BRACKETS,
813
+ accept: /* @__PURE__ */ r((e, t) => e === "[" && t === "]", "accept"),
814
+ parseInfix: /* @__PURE__ */ r((e, t) => (e.consume("["), e.consume("]"), {
815
+ type: "JsdocTypeGeneric",
816
+ left: {
817
+ type: "JsdocTypeName",
818
+ value: "Array"
819
+ },
820
+ elements: [
821
+ P(t)
822
+ ],
823
+ meta: {
824
+ brackets: "square",
825
+ dot: !1
826
+ }
827
+ }), "parseInfix")
828
+ });
829
+ function Ee({ objectFieldGrammar: e, allowKeyTypes: t }) {
830
+ return h({
831
+ name: "objectParslet",
832
+ accept: /* @__PURE__ */ r((o) => o === "{", "accept"),
833
+ parsePrefix: /* @__PURE__ */ r((o) => {
834
+ o.consume("{");
835
+ let i = {
836
+ type: "JsdocTypeObject",
837
+ meta: {
838
+ separator: "comma"
839
+ },
840
+ elements: []
841
+ };
842
+ if (!o.consume("}")) {
843
+ let l, y = new V(e, o.lexer, o);
844
+ for (; ; ) {
845
+ y.acceptLexerState(o);
846
+ let d = y.parseIntermediateType(f.OBJECT);
847
+ o.acceptLexerState(y), d === void 0 && t && (d = o.parseIntermediateType(f.OBJECT));
848
+ let x = !1;
849
+ if (d.type === "JsdocTypeNullable" && (x = !0, d = d.element), d.type === "JsdocTypeNumber" || d.type === "JsdocTypeName" || d.
850
+ type === "JsdocTypeStringValue") {
851
+ let S;
852
+ d.type === "JsdocTypeStringValue" && (S = d.meta.quote), i.elements.push({
853
+ type: "JsdocTypeObjectField",
854
+ key: d.value.toString(),
855
+ right: void 0,
856
+ optional: x,
857
+ readonly: !1,
858
+ meta: {
859
+ quote: S
860
+ }
861
+ });
862
+ } else if (d.type === "JsdocTypeObjectField" || d.type === "JsdocTypeJsdocObjectField")
863
+ i.elements.push(d);
864
+ else
865
+ throw new c(d);
866
+ if (o.lexer.current.startOfLine)
867
+ l = "linebreak";
868
+ else if (o.consume(","))
869
+ l = "comma";
870
+ else if (o.consume(";"))
871
+ l = "semicolon";
872
+ else
873
+ break;
874
+ if (o.lexer.current.type === "}")
875
+ break;
876
+ }
877
+ if (i.meta.separator = l ?? "comma", !o.consume("}"))
878
+ throw new Error("Unterminated record type. Missing '}'");
879
+ }
880
+ return i;
881
+ }, "parsePrefix")
882
+ });
883
+ }
884
+ r(Ee, "createObjectParslet");
885
+ function Se({ allowSquaredProperties: e, allowKeyTypes: t, allowReadonly: o, allowOptional: i }) {
886
+ return h({
887
+ name: "objectFieldParslet",
888
+ precedence: f.KEY_VALUE,
889
+ accept: /* @__PURE__ */ r((l) => l === ":", "accept"),
890
+ parseInfix: /* @__PURE__ */ r((l, y) => {
891
+ var d;
892
+ let x = !1, N = !1;
893
+ i && y.type === "JsdocTypeNullable" && (x = !0, y = y.element), o && y.type === "JsdocTypeReadonlyProperty" && (N = !0, y = y.element);
894
+ let S = (d = l.baseParser) !== null && d !== void 0 ? d : l;
895
+ if (S.acceptLexerState(l), y.type === "JsdocTypeNumber" || y.type === "JsdocTypeName" || y.type === "JsdocTypeStringValue" || he(y)) {
896
+ if (he(y) && !e)
897
+ throw new c(y);
898
+ S.consume(":");
899
+ let D;
900
+ y.type === "JsdocTypeStringValue" && (D = y.meta.quote);
901
+ let se = S.parseType(f.KEY_VALUE);
902
+ return l.acceptLexerState(S), {
903
+ type: "JsdocTypeObjectField",
904
+ key: he(y) ? y : y.value.toString(),
905
+ right: se,
906
+ optional: x,
907
+ readonly: N,
908
+ meta: {
909
+ quote: D
910
+ }
911
+ };
912
+ } else {
913
+ if (!t)
914
+ throw new c(y);
915
+ S.consume(":");
916
+ let D = S.parseType(f.KEY_VALUE);
917
+ return l.acceptLexerState(S), {
918
+ type: "JsdocTypeJsdocObjectField",
919
+ left: P(y),
920
+ right: D
921
+ };
922
+ }
923
+ }, "parseInfix")
924
+ });
925
+ }
926
+ r(Se, "createObjectFieldParslet");
927
+ function Ne({ allowOptional: e, allowVariadic: t }) {
928
+ return h({
929
+ name: "keyValueParslet",
930
+ precedence: f.KEY_VALUE,
931
+ accept: /* @__PURE__ */ r((o) => o === ":", "accept"),
932
+ parseInfix: /* @__PURE__ */ r((o, i) => {
933
+ let l = !1, y = !1;
934
+ if (e && i.type === "JsdocTypeNullable" && (l = !0, i = i.element), t && i.type === "JsdocTypeVariadic" && i.element !== void 0 &&
935
+ (y = !0, i = i.element), i.type !== "JsdocTypeName")
936
+ throw new c(i);
937
+ o.consume(":");
938
+ let d = o.parseType(f.KEY_VALUE);
939
+ return {
940
+ type: "JsdocTypeKeyValue",
941
+ key: i.value,
942
+ right: d,
943
+ optional: l,
944
+ variadic: y
945
+ };
946
+ }, "parseInfix")
947
+ });
948
+ }
949
+ r(Ne, "createKeyValueParslet");
950
+ let Ze = [
951
+ ...Je,
952
+ we({
953
+ allowWithoutParenthesis: !0,
954
+ allowNamedParameters: ["this", "new"],
955
+ allowNoReturnType: !0,
956
+ allowNewAsFunctionKeyword: !1
957
+ }),
958
+ Y,
959
+ ne({
960
+ allowedTypes: ["module", "external", "event"],
961
+ pathGrammar: U
962
+ }),
963
+ be({
964
+ allowEnclosingBrackets: !0,
965
+ allowPostfix: !0
966
+ }),
967
+ R({
968
+ allowedAdditionalTokens: ["keyof"]
969
+ }),
970
+ He,
971
+ Qe,
972
+ re({
973
+ allowSquareBracketsOnAnyType: !1,
974
+ allowJsdocNamePaths: !0,
975
+ pathGrammar: U
976
+ })
977
+ ], Yt = [
978
+ ...Ze,
979
+ Ee({
980
+ // jsdoc syntax allows full types as keys, so we need to pull in the full grammar here
981
+ // we leave out the object type deliberately
982
+ objectFieldGrammar: [
983
+ R({
984
+ allowedAdditionalTokens: ["module", "in"]
985
+ }),
986
+ Se({
987
+ allowSquaredProperties: !1,
988
+ allowKeyTypes: !0,
989
+ allowOptional: !1,
990
+ allowReadonly: !1
991
+ }),
992
+ ...Ze
993
+ ],
994
+ allowKeyTypes: !0
995
+ }),
996
+ Ne({
997
+ allowOptional: !0,
998
+ allowVariadic: !0
999
+ })
1000
+ ], et = h({
1001
+ name: "typeOfParslet",
1002
+ accept: /* @__PURE__ */ r((e) => e === "typeof", "accept"),
1003
+ parsePrefix: /* @__PURE__ */ r((e) => (e.consume("typeof"), {
1004
+ type: "JsdocTypeTypeof",
1005
+ element: P(e.parseType(f.KEY_OF_TYPE_OF))
1006
+ }), "parsePrefix")
1007
+ }), Wt = [
1008
+ R({
1009
+ allowedAdditionalTokens: ["module", "keyof", "event", "external", "in"]
1010
+ }),
1011
+ xe,
1012
+ ee,
1013
+ Y,
1014
+ te,
1015
+ Se({
1016
+ allowSquaredProperties: !1,
1017
+ allowKeyTypes: !1,
1018
+ allowOptional: !1,
1019
+ allowReadonly: !1
1020
+ })
1021
+ ], Gt = [
1022
+ ...Je,
1023
+ Ee({
1024
+ allowKeyTypes: !1,
1025
+ objectFieldGrammar: Wt
1026
+ }),
1027
+ R({
1028
+ allowedAdditionalTokens: ["event", "external", "in"]
1029
+ }),
1030
+ et,
1031
+ we({
1032
+ allowWithoutParenthesis: !1,
1033
+ allowNamedParameters: ["this", "new"],
1034
+ allowNoReturnType: !0,
1035
+ allowNewAsFunctionKeyword: !1
1036
+ }),
1037
+ be({
1038
+ allowEnclosingBrackets: !1,
1039
+ allowPostfix: !1
1040
+ }),
1041
+ // additional name parslet is needed for some special cases
1042
+ R({
1043
+ allowedAdditionalTokens: ["keyof"]
1044
+ }),
1045
+ ne({
1046
+ allowedTypes: ["module"],
1047
+ pathGrammar: U
1048
+ }),
1049
+ re({
1050
+ allowSquareBracketsOnAnyType: !1,
1051
+ allowJsdocNamePaths: !0,
1052
+ pathGrammar: U
1053
+ }),
1054
+ Ne({
1055
+ allowOptional: !1,
1056
+ allowVariadic: !1
1057
+ }),
1058
+ He
1059
+ ];
1060
+ function zt({ allowQuestionMark: e }) {
1061
+ return h({
1062
+ name: "tupleParslet",
1063
+ accept: /* @__PURE__ */ r((t) => t === "[", "accept"),
1064
+ parsePrefix: /* @__PURE__ */ r((t) => {
1065
+ t.consume("[");
1066
+ let o = {
1067
+ type: "JsdocTypeTuple",
1068
+ elements: []
1069
+ };
1070
+ if (t.consume("]"))
1071
+ return o;
1072
+ let i = t.parseIntermediateType(f.ALL);
1073
+ if (i.type === "JsdocTypeParameterList" ? i.elements[0].type === "JsdocTypeKeyValue" ? o.elements = i.elements.map(Z) : o.elements =
1074
+ i.elements.map(P) : i.type === "JsdocTypeKeyValue" ? o.elements = [Z(i)] : o.elements = [P(i)], !t.consume("]"))
1075
+ throw new Error("Unterminated '['");
1076
+ if (!e && o.elements.some((l) => l.type === "JsdocTypeUnknown"))
1077
+ throw new Error("Question mark in tuple not allowed");
1078
+ return o;
1079
+ }, "parsePrefix")
1080
+ });
1081
+ }
1082
+ r(zt, "createTupleParslet");
1083
+ let Xt = h({
1084
+ name: "keyOfParslet",
1085
+ accept: /* @__PURE__ */ r((e) => e === "keyof", "accept"),
1086
+ parsePrefix: /* @__PURE__ */ r((e) => (e.consume("keyof"), {
1087
+ type: "JsdocTypeKeyof",
1088
+ element: P(e.parseType(f.KEY_OF_TYPE_OF))
1089
+ }), "parsePrefix")
1090
+ }), Ht = h({
1091
+ name: "importParslet",
1092
+ accept: /* @__PURE__ */ r((e) => e === "import", "accept"),
1093
+ parsePrefix: /* @__PURE__ */ r((e) => {
1094
+ if (e.consume("import"), !e.consume("("))
1095
+ throw new Error("Missing parenthesis after import keyword");
1096
+ let t = e.parseType(f.PREFIX);
1097
+ if (t.type !== "JsdocTypeStringValue")
1098
+ throw new Error("Only string values are allowed as paths for imports");
1099
+ if (!e.consume(")"))
1100
+ throw new Error("Missing closing parenthesis after import keyword");
1101
+ return {
1102
+ type: "JsdocTypeImport",
1103
+ element: t
1104
+ };
1105
+ }, "parsePrefix")
1106
+ }), Qt = h({
1107
+ name: "readonlyPropertyParslet",
1108
+ accept: /* @__PURE__ */ r((e) => e === "readonly", "accept"),
1109
+ parsePrefix: /* @__PURE__ */ r((e) => (e.consume("readonly"), {
1110
+ type: "JsdocTypeReadonlyProperty",
1111
+ element: e.parseType(f.KEY_VALUE)
1112
+ }), "parsePrefix")
1113
+ }), Zt = h({
1114
+ name: "arrowFunctionParslet",
1115
+ precedence: f.ARROW,
1116
+ accept: /* @__PURE__ */ r((e) => e === "=>", "accept"),
1117
+ parseInfix: /* @__PURE__ */ r((e, t) => (e.consume("=>"), {
1118
+ type: "JsdocTypeFunction",
1119
+ parameters: Pe(t).map(Lt),
1120
+ arrow: !0,
1121
+ constructor: !1,
1122
+ parenthesis: !0,
1123
+ returnType: e.parseType(f.OBJECT)
1124
+ }), "parseInfix")
1125
+ }), er = h({
1126
+ name: "intersectionParslet",
1127
+ accept: /* @__PURE__ */ r((e) => e === "&", "accept"),
1128
+ precedence: f.INTERSECTION,
1129
+ parseInfix: /* @__PURE__ */ r((e, t) => {
1130
+ e.consume("&");
1131
+ let o = [];
1132
+ do
1133
+ o.push(e.parseType(f.INTERSECTION));
1134
+ while (e.consume("&"));
1135
+ return {
1136
+ type: "JsdocTypeIntersection",
1137
+ elements: [P(t), ...o]
1138
+ };
1139
+ }, "parseInfix")
1140
+ }), tr = h({
1141
+ name: "predicateParslet",
1142
+ precedence: f.INFIX,
1143
+ accept: /* @__PURE__ */ r((e) => e === "is", "accept"),
1144
+ parseInfix: /* @__PURE__ */ r((e, t) => {
1145
+ if (t.type !== "JsdocTypeName")
1146
+ throw new c(t, "A typescript predicate always has to have a name on the left side.");
1147
+ return e.consume("is"), {
1148
+ type: "JsdocTypePredicate",
1149
+ left: t,
1150
+ right: P(e.parseIntermediateType(f.INFIX))
1151
+ };
1152
+ }, "parseInfix")
1153
+ }), rr = h({
1154
+ name: "objectSquareBracketPropertyParslet",
1155
+ accept: /* @__PURE__ */ r((e) => e === "[", "accept"),
1156
+ parsePrefix: /* @__PURE__ */ r((e) => {
1157
+ if (e.baseParser === void 0)
1158
+ throw new Error("Only allowed inside object grammar");
1159
+ e.consume("[");
1160
+ let t = e.lexer.current.text;
1161
+ e.consume("Identifier");
1162
+ let o;
1163
+ if (e.consume(":")) {
1164
+ let i = e.baseParser;
1165
+ i.acceptLexerState(e), o = {
1166
+ type: "JsdocTypeIndexSignature",
1167
+ key: t,
1168
+ right: i.parseType(f.ARRAY_BRACKETS)
1169
+ }, e.acceptLexerState(i);
1170
+ } else if (e.consume("in")) {
1171
+ let i = e.baseParser;
1172
+ i.acceptLexerState(e), o = {
1173
+ type: "JsdocTypeMappedType",
1174
+ key: t,
1175
+ right: i.parseType(f.ARRAY_BRACKETS)
1176
+ }, e.acceptLexerState(i);
1177
+ } else
1178
+ throw new Error("Missing ':' or 'in' inside square bracketed property.");
1179
+ if (!e.consume("]"))
1180
+ throw new Error("Unterminated square brackets");
1181
+ return o;
1182
+ }, "parsePrefix")
1183
+ }), nr = [
1184
+ Qt,
1185
+ R({
1186
+ allowedAdditionalTokens: ["module", "event", "keyof", "event", "external", "in"]
1187
+ }),
1188
+ xe,
1189
+ ee,
1190
+ Y,
1191
+ te,
1192
+ Se({
1193
+ allowSquaredProperties: !0,
1194
+ allowKeyTypes: !1,
1195
+ allowOptional: !0,
1196
+ allowReadonly: !0
1197
+ }),
1198
+ rr
1199
+ ], or = [
1200
+ ...Je,
1201
+ Ee({
1202
+ allowKeyTypes: !1,
1203
+ objectFieldGrammar: nr
1204
+ }),
1205
+ et,
1206
+ Xt,
1207
+ Ht,
1208
+ Y,
1209
+ we({
1210
+ allowWithoutParenthesis: !0,
1211
+ allowNoReturnType: !1,
1212
+ allowNamedParameters: ["this", "new", "args"],
1213
+ allowNewAsFunctionKeyword: !0
1214
+ }),
1215
+ zt({
1216
+ allowQuestionMark: !1
1217
+ }),
1218
+ be({
1219
+ allowEnclosingBrackets: !1,
1220
+ allowPostfix: !1
1221
+ }),
1222
+ R({
1223
+ allowedAdditionalTokens: ["event", "external", "in"]
1224
+ }),
1225
+ ne({
1226
+ allowedTypes: ["module"],
1227
+ pathGrammar: U
1228
+ }),
1229
+ Qe,
1230
+ Zt,
1231
+ re({
1232
+ allowSquareBracketsOnAnyType: !0,
1233
+ allowJsdocNamePaths: !1,
1234
+ pathGrammar: U
1235
+ }),
1236
+ er,
1237
+ tr,
1238
+ Ne({
1239
+ allowVariadic: !0,
1240
+ allowOptional: !0
1241
+ })
1242
+ ];
1243
+ function tt(e, t) {
1244
+ switch (t) {
1245
+ case "closure":
1246
+ return new V(Gt, e).parse();
1247
+ case "jsdoc":
1248
+ return new V(Yt, e).parse();
1249
+ case "typescript":
1250
+ return new V(or, e).parse();
1251
+ }
1252
+ }
1253
+ r(tt, "parse");
1254
+ function sr(e, t = ["typescript", "closure", "jsdoc"]) {
1255
+ let o;
1256
+ for (let i of t)
1257
+ try {
1258
+ return tt(e, i);
1259
+ } catch (l) {
1260
+ o = l;
1261
+ }
1262
+ throw o;
1263
+ }
1264
+ r(sr, "tryParse");
1265
+ function W(e, t) {
1266
+ let o = e[t.type];
1267
+ if (o === void 0)
1268
+ throw new Error(`In this set of transform rules exists no rule for type ${t.type}.`);
1269
+ return o(t, (i) => W(e, i));
1270
+ }
1271
+ r(W, "transform");
1272
+ function O(e) {
1273
+ throw new Error("This transform is not available. Are you trying the correct parsing mode?");
1274
+ }
1275
+ r(O, "notAvailableTransform");
1276
+ function rt(e) {
1277
+ let t = {
1278
+ params: []
1279
+ };
1280
+ for (let o of e.parameters)
1281
+ o.type === "JsdocTypeKeyValue" ? o.key === "this" ? t.this = o.right : o.key === "new" ? t.new = o.right : t.params.push(o) : t.params.
1282
+ push(o);
1283
+ return t;
1284
+ }
1285
+ r(rt, "extractSpecialParams");
1286
+ function oe(e, t, o) {
1287
+ return e === "prefix" ? o + t : t + o;
1288
+ }
1289
+ r(oe, "applyPosition");
1290
+ function I(e, t) {
1291
+ switch (t) {
1292
+ case "double":
1293
+ return `"${e}"`;
1294
+ case "single":
1295
+ return `'${e}'`;
1296
+ case void 0:
1297
+ return e;
1298
+ }
1299
+ }
1300
+ r(I, "quote");
1301
+ function nt() {
1302
+ return {
1303
+ JsdocTypeParenthesis: /* @__PURE__ */ r((e, t) => `(${e.element !== void 0 ? t(e.element) : ""})`, "JsdocTypeParenthesis"),
1304
+ JsdocTypeKeyof: /* @__PURE__ */ r((e, t) => `keyof ${t(e.element)}`, "JsdocTypeKeyof"),
1305
+ JsdocTypeFunction: /* @__PURE__ */ r((e, t) => {
1306
+ if (e.arrow) {
1307
+ if (e.returnType === void 0)
1308
+ throw new Error("Arrow function needs a return type.");
1309
+ let o = `(${e.parameters.map(t).join(", ")}) => ${t(e.returnType)}`;
1310
+ return e.constructor && (o = "new " + o), o;
1311
+ } else {
1312
+ let o = e.constructor ? "new" : "function";
1313
+ return e.parenthesis && (o += `(${e.parameters.map(t).join(", ")})`, e.returnType !== void 0 && (o += `: ${t(e.returnType)}`)), o;
1314
+ }
1315
+ }, "JsdocTypeFunction"),
1316
+ JsdocTypeName: /* @__PURE__ */ r((e) => e.value, "JsdocTypeName"),
1317
+ JsdocTypeTuple: /* @__PURE__ */ r((e, t) => `[${e.elements.map(t).join(", ")}]`, "JsdocTypeTuple"),
1318
+ JsdocTypeVariadic: /* @__PURE__ */ r((e, t) => e.meta.position === void 0 ? "..." : oe(e.meta.position, t(e.element), "..."), "Jsdoc\
1319
+ TypeVariadic"),
1320
+ JsdocTypeNamePath: /* @__PURE__ */ r((e, t) => {
1321
+ let o = t(e.left), i = t(e.right);
1322
+ switch (e.pathType) {
1323
+ case "inner":
1324
+ return `${o}~${i}`;
1325
+ case "instance":
1326
+ return `${o}#${i}`;
1327
+ case "property":
1328
+ return `${o}.${i}`;
1329
+ case "property-brackets":
1330
+ return `${o}[${i}]`;
1331
+ }
1332
+ }, "JsdocTypeNamePath"),
1333
+ JsdocTypeStringValue: /* @__PURE__ */ r((e) => I(e.value, e.meta.quote), "JsdocTypeStringValue"),
1334
+ JsdocTypeAny: /* @__PURE__ */ r(() => "*", "JsdocTypeAny"),
1335
+ JsdocTypeGeneric: /* @__PURE__ */ r((e, t) => {
1336
+ if (e.meta.brackets === "square") {
1337
+ let o = e.elements[0], i = t(o);
1338
+ return o.type === "JsdocTypeUnion" || o.type === "JsdocTypeIntersection" ? `(${i})[]` : `${i}[]`;
1339
+ } else
1340
+ return `${t(e.left)}${e.meta.dot ? "." : ""}<${e.elements.map(t).join(", ")}>`;
1341
+ }, "JsdocTypeGeneric"),
1342
+ JsdocTypeImport: /* @__PURE__ */ r((e, t) => `import(${t(e.element)})`, "JsdocTypeImport"),
1343
+ JsdocTypeObjectField: /* @__PURE__ */ r((e, t) => {
1344
+ let o = "";
1345
+ return e.readonly && (o += "readonly "), typeof e.key == "string" ? o += I(e.key, e.meta.quote) : o += t(e.key), e.optional && (o +=
1346
+ "?"), e.right === void 0 ? o : o + `: ${t(e.right)}`;
1347
+ }, "JsdocTypeObjectField"),
1348
+ JsdocTypeJsdocObjectField: /* @__PURE__ */ r((e, t) => `${t(e.left)}: ${t(e.right)}`, "JsdocTypeJsdocObjectField"),
1349
+ JsdocTypeKeyValue: /* @__PURE__ */ r((e, t) => {
1350
+ let o = e.key;
1351
+ return e.optional && (o += "?"), e.variadic && (o = "..." + o), e.right === void 0 ? o : o + `: ${t(e.right)}`;
1352
+ }, "JsdocTypeKeyValue"),
1353
+ JsdocTypeSpecialNamePath: /* @__PURE__ */ r((e) => `${e.specialType}:${I(e.value, e.meta.quote)}`, "JsdocTypeSpecialNamePath"),
1354
+ JsdocTypeNotNullable: /* @__PURE__ */ r((e, t) => oe(e.meta.position, t(e.element), "!"), "JsdocTypeNotNullable"),
1355
+ JsdocTypeNull: /* @__PURE__ */ r(() => "null", "JsdocTypeNull"),
1356
+ JsdocTypeNullable: /* @__PURE__ */ r((e, t) => oe(e.meta.position, t(e.element), "?"), "JsdocTypeNullable"),
1357
+ JsdocTypeNumber: /* @__PURE__ */ r((e) => e.value.toString(), "JsdocTypeNumber"),
1358
+ JsdocTypeObject: /* @__PURE__ */ r((e, t) => `{${e.elements.map(t).join((e.meta.separator === "comma" ? "," : ";") + " ")}}`, "Jsdoc\
1359
+ TypeObject"),
1360
+ JsdocTypeOptional: /* @__PURE__ */ r((e, t) => oe(e.meta.position, t(e.element), "="), "JsdocTypeOptional"),
1361
+ JsdocTypeSymbol: /* @__PURE__ */ r((e, t) => `${e.value}(${e.element !== void 0 ? t(e.element) : ""})`, "JsdocTypeSymbol"),
1362
+ JsdocTypeTypeof: /* @__PURE__ */ r((e, t) => `typeof ${t(e.element)}`, "JsdocTypeTypeof"),
1363
+ JsdocTypeUndefined: /* @__PURE__ */ r(() => "undefined", "JsdocTypeUndefined"),
1364
+ JsdocTypeUnion: /* @__PURE__ */ r((e, t) => e.elements.map(t).join(" | "), "JsdocTypeUnion"),
1365
+ JsdocTypeUnknown: /* @__PURE__ */ r(() => "?", "JsdocTypeUnknown"),
1366
+ JsdocTypeIntersection: /* @__PURE__ */ r((e, t) => e.elements.map(t).join(" & "), "JsdocTypeIntersection"),
1367
+ JsdocTypeProperty: /* @__PURE__ */ r((e) => I(e.value, e.meta.quote), "JsdocTypeProperty"),
1368
+ JsdocTypePredicate: /* @__PURE__ */ r((e, t) => `${t(e.left)} is ${t(e.right)}`, "JsdocTypePredicate"),
1369
+ JsdocTypeIndexSignature: /* @__PURE__ */ r((e, t) => `[${e.key}: ${t(e.right)}]`, "JsdocTypeIndexSignature"),
1370
+ JsdocTypeMappedType: /* @__PURE__ */ r((e, t) => `[${e.key} in ${t(e.right)}]`, "JsdocTypeMappedType")
1371
+ };
1372
+ }
1373
+ r(nt, "stringifyRules");
1374
+ let ar = nt();
1375
+ function ir(e) {
1376
+ return W(ar, e);
1377
+ }
1378
+ r(ir, "stringify");
1379
+ let pr = [
1380
+ "null",
1381
+ "true",
1382
+ "false",
1383
+ "break",
1384
+ "case",
1385
+ "catch",
1386
+ "class",
1387
+ "const",
1388
+ "continue",
1389
+ "debugger",
1390
+ "default",
1391
+ "delete",
1392
+ "do",
1393
+ "else",
1394
+ "export",
1395
+ "extends",
1396
+ "finally",
1397
+ "for",
1398
+ "function",
1399
+ "if",
1400
+ "import",
1401
+ "in",
1402
+ "instanceof",
1403
+ "new",
1404
+ "return",
1405
+ "super",
1406
+ "switch",
1407
+ "this",
1408
+ "throw",
1409
+ "try",
1410
+ "typeof",
1411
+ "var",
1412
+ "void",
1413
+ "while",
1414
+ "with",
1415
+ "yield"
1416
+ ];
1417
+ function F(e) {
1418
+ let t = {
1419
+ type: "NameExpression",
1420
+ name: e
1421
+ };
1422
+ return pr.includes(e) && (t.reservedWord = !0), t;
1423
+ }
1424
+ r(F, "makeName");
1425
+ let cr = {
1426
+ JsdocTypeOptional: /* @__PURE__ */ r((e, t) => {
1427
+ let o = t(e.element);
1428
+ return o.optional = !0, o;
1429
+ }, "JsdocTypeOptional"),
1430
+ JsdocTypeNullable: /* @__PURE__ */ r((e, t) => {
1431
+ let o = t(e.element);
1432
+ return o.nullable = !0, o;
1433
+ }, "JsdocTypeNullable"),
1434
+ JsdocTypeNotNullable: /* @__PURE__ */ r((e, t) => {
1435
+ let o = t(e.element);
1436
+ return o.nullable = !1, o;
1437
+ }, "JsdocTypeNotNullable"),
1438
+ JsdocTypeVariadic: /* @__PURE__ */ r((e, t) => {
1439
+ if (e.element === void 0)
1440
+ throw new Error("dots without value are not allowed in catharsis mode");
1441
+ let o = t(e.element);
1442
+ return o.repeatable = !0, o;
1443
+ }, "JsdocTypeVariadic"),
1444
+ JsdocTypeAny: /* @__PURE__ */ r(() => ({
1445
+ type: "AllLiteral"
1446
+ }), "JsdocTypeAny"),
1447
+ JsdocTypeNull: /* @__PURE__ */ r(() => ({
1448
+ type: "NullLiteral"
1449
+ }), "JsdocTypeNull"),
1450
+ JsdocTypeStringValue: /* @__PURE__ */ r((e) => F(I(e.value, e.meta.quote)), "JsdocTypeStringValue"),
1451
+ JsdocTypeUndefined: /* @__PURE__ */ r(() => ({
1452
+ type: "UndefinedLiteral"
1453
+ }), "JsdocTypeUndefined"),
1454
+ JsdocTypeUnknown: /* @__PURE__ */ r(() => ({
1455
+ type: "UnknownLiteral"
1456
+ }), "JsdocTypeUnknown"),
1457
+ JsdocTypeFunction: /* @__PURE__ */ r((e, t) => {
1458
+ let o = rt(e), i = {
1459
+ type: "FunctionType",
1460
+ params: o.params.map(t)
1461
+ };
1462
+ return o.this !== void 0 && (i.this = t(o.this)), o.new !== void 0 && (i.new = t(o.new)), e.returnType !== void 0 && (i.result = t(e.
1463
+ returnType)), i;
1464
+ }, "JsdocTypeFunction"),
1465
+ JsdocTypeGeneric: /* @__PURE__ */ r((e, t) => ({
1466
+ type: "TypeApplication",
1467
+ applications: e.elements.map((o) => t(o)),
1468
+ expression: t(e.left)
1469
+ }), "JsdocTypeGeneric"),
1470
+ JsdocTypeSpecialNamePath: /* @__PURE__ */ r((e) => F(e.specialType + ":" + I(e.value, e.meta.quote)), "JsdocTypeSpecialNamePath"),
1471
+ JsdocTypeName: /* @__PURE__ */ r((e) => e.value !== "function" ? F(e.value) : {
1472
+ type: "FunctionType",
1473
+ params: []
1474
+ }, "JsdocTypeName"),
1475
+ JsdocTypeNumber: /* @__PURE__ */ r((e) => F(e.value.toString()), "JsdocTypeNumber"),
1476
+ JsdocTypeObject: /* @__PURE__ */ r((e, t) => {
1477
+ let o = {
1478
+ type: "RecordType",
1479
+ fields: []
1480
+ };
1481
+ for (let i of e.elements)
1482
+ i.type !== "JsdocTypeObjectField" && i.type !== "JsdocTypeJsdocObjectField" ? o.fields.push({
1483
+ type: "FieldType",
1484
+ key: t(i),
1485
+ value: void 0
1486
+ }) : o.fields.push(t(i));
1487
+ return o;
1488
+ }, "JsdocTypeObject"),
1489
+ JsdocTypeObjectField: /* @__PURE__ */ r((e, t) => {
1490
+ if (typeof e.key != "string")
1491
+ throw new Error("Index signatures and mapped types are not supported");
1492
+ return {
1493
+ type: "FieldType",
1494
+ key: F(I(e.key, e.meta.quote)),
1495
+ value: e.right === void 0 ? void 0 : t(e.right)
1496
+ };
1497
+ }, "JsdocTypeObjectField"),
1498
+ JsdocTypeJsdocObjectField: /* @__PURE__ */ r((e, t) => ({
1499
+ type: "FieldType",
1500
+ key: t(e.left),
1501
+ value: t(e.right)
1502
+ }), "JsdocTypeJsdocObjectField"),
1503
+ JsdocTypeUnion: /* @__PURE__ */ r((e, t) => ({
1504
+ type: "TypeUnion",
1505
+ elements: e.elements.map((o) => t(o))
1506
+ }), "JsdocTypeUnion"),
1507
+ JsdocTypeKeyValue: /* @__PURE__ */ r((e, t) => ({
1508
+ type: "FieldType",
1509
+ key: F(e.key),
1510
+ value: e.right === void 0 ? void 0 : t(e.right)
1511
+ }), "JsdocTypeKeyValue"),
1512
+ JsdocTypeNamePath: /* @__PURE__ */ r((e, t) => {
1513
+ let o = t(e.left), i;
1514
+ e.right.type === "JsdocTypeSpecialNamePath" ? i = t(e.right).name : i = I(e.right.value, e.right.meta.quote);
1515
+ let l = e.pathType === "inner" ? "~" : e.pathType === "instance" ? "#" : ".";
1516
+ return F(`${o.name}${l}${i}`);
1517
+ }, "JsdocTypeNamePath"),
1518
+ JsdocTypeSymbol: /* @__PURE__ */ r((e) => {
1519
+ let t = "", o = e.element, i = !1;
1520
+ return o?.type === "JsdocTypeVariadic" && (o.meta.position === "prefix" ? t = "..." : i = !0, o = o.element), o?.type === "JsdocType\
1521
+ Name" ? t += o.value : o?.type === "JsdocTypeNumber" && (t += o.value.toString()), i && (t += "..."), F(`${e.value}(${t})`);
1522
+ }, "JsdocTypeSymbol"),
1523
+ JsdocTypeParenthesis: /* @__PURE__ */ r((e, t) => t(P(e.element)), "JsdocTypeParenthesis"),
1524
+ JsdocTypeMappedType: O,
1525
+ JsdocTypeIndexSignature: O,
1526
+ JsdocTypeImport: O,
1527
+ JsdocTypeKeyof: O,
1528
+ JsdocTypeTuple: O,
1529
+ JsdocTypeTypeof: O,
1530
+ JsdocTypeIntersection: O,
1531
+ JsdocTypeProperty: O,
1532
+ JsdocTypePredicate: O
1533
+ };
1534
+ function lr(e) {
1535
+ return W(cr, e);
1536
+ }
1537
+ r(lr, "catharsisTransform");
1538
+ function _(e) {
1539
+ switch (e) {
1540
+ case void 0:
1541
+ return "none";
1542
+ case "single":
1543
+ return "single";
1544
+ case "double":
1545
+ return "double";
1546
+ }
1547
+ }
1548
+ r(_, "getQuoteStyle");
1549
+ function ur(e) {
1550
+ switch (e) {
1551
+ case "inner":
1552
+ return "INNER_MEMBER";
1553
+ case "instance":
1554
+ return "INSTANCE_MEMBER";
1555
+ case "property":
1556
+ return "MEMBER";
1557
+ case "property-brackets":
1558
+ return "MEMBER";
1559
+ }
1560
+ }
1561
+ r(ur, "getMemberType");
1562
+ function Oe(e, t) {
1563
+ return t.length === 2 ? {
1564
+ type: e,
1565
+ left: t[0],
1566
+ right: t[1]
1567
+ } : {
1568
+ type: e,
1569
+ left: t[0],
1570
+ right: Oe(e, t.slice(1))
1571
+ };
1572
+ }
1573
+ r(Oe, "nestResults");
1574
+ let mr = {
1575
+ JsdocTypeOptional: /* @__PURE__ */ r((e, t) => ({
1576
+ type: "OPTIONAL",
1577
+ value: t(e.element),
1578
+ meta: {
1579
+ syntax: e.meta.position === "prefix" ? "PREFIX_EQUAL_SIGN" : "SUFFIX_EQUALS_SIGN"
1580
+ }
1581
+ }), "JsdocTypeOptional"),
1582
+ JsdocTypeNullable: /* @__PURE__ */ r((e, t) => ({
1583
+ type: "NULLABLE",
1584
+ value: t(e.element),
1585
+ meta: {
1586
+ syntax: e.meta.position === "prefix" ? "PREFIX_QUESTION_MARK" : "SUFFIX_QUESTION_MARK"
1587
+ }
1588
+ }), "JsdocTypeNullable"),
1589
+ JsdocTypeNotNullable: /* @__PURE__ */ r((e, t) => ({
1590
+ type: "NOT_NULLABLE",
1591
+ value: t(e.element),
1592
+ meta: {
1593
+ syntax: e.meta.position === "prefix" ? "PREFIX_BANG" : "SUFFIX_BANG"
1594
+ }
1595
+ }), "JsdocTypeNotNullable"),
1596
+ JsdocTypeVariadic: /* @__PURE__ */ r((e, t) => {
1597
+ let o = {
1598
+ type: "VARIADIC",
1599
+ meta: {
1600
+ syntax: e.meta.position === "prefix" ? "PREFIX_DOTS" : e.meta.position === "suffix" ? "SUFFIX_DOTS" : "ONLY_DOTS"
1601
+ }
1602
+ };
1603
+ return e.element !== void 0 && (o.value = t(e.element)), o;
1604
+ }, "JsdocTypeVariadic"),
1605
+ JsdocTypeName: /* @__PURE__ */ r((e) => ({
1606
+ type: "NAME",
1607
+ name: e.value
1608
+ }), "JsdocTypeName"),
1609
+ JsdocTypeTypeof: /* @__PURE__ */ r((e, t) => ({
1610
+ type: "TYPE_QUERY",
1611
+ name: t(e.element)
1612
+ }), "JsdocTypeTypeof"),
1613
+ JsdocTypeTuple: /* @__PURE__ */ r((e, t) => ({
1614
+ type: "TUPLE",
1615
+ entries: e.elements.map(t)
1616
+ }), "JsdocTypeTuple"),
1617
+ JsdocTypeKeyof: /* @__PURE__ */ r((e, t) => ({
1618
+ type: "KEY_QUERY",
1619
+ value: t(e.element)
1620
+ }), "JsdocTypeKeyof"),
1621
+ JsdocTypeImport: /* @__PURE__ */ r((e) => ({
1622
+ type: "IMPORT",
1623
+ path: {
1624
+ type: "STRING_VALUE",
1625
+ quoteStyle: _(e.element.meta.quote),
1626
+ string: e.element.value
1627
+ }
1628
+ }), "JsdocTypeImport"),
1629
+ JsdocTypeUndefined: /* @__PURE__ */ r(() => ({
1630
+ type: "NAME",
1631
+ name: "undefined"
1632
+ }), "JsdocTypeUndefined"),
1633
+ JsdocTypeAny: /* @__PURE__ */ r(() => ({
1634
+ type: "ANY"
1635
+ }), "JsdocTypeAny"),
1636
+ JsdocTypeFunction: /* @__PURE__ */ r((e, t) => {
1637
+ let o = rt(e), i = {
1638
+ type: e.arrow ? "ARROW" : "FUNCTION",
1639
+ params: o.params.map((l) => {
1640
+ if (l.type === "JsdocTypeKeyValue") {
1641
+ if (l.right === void 0)
1642
+ throw new Error("Function parameter without ':' is not expected to be 'KEY_VALUE'");
1643
+ return {
1644
+ type: "NAMED_PARAMETER",
1645
+ name: l.key,
1646
+ typeName: t(l.right)
1647
+ };
1648
+ } else
1649
+ return t(l);
1650
+ }),
1651
+ new: null,
1652
+ returns: null
1653
+ };
1654
+ return o.this !== void 0 ? i.this = t(o.this) : e.arrow || (i.this = null), o.new !== void 0 && (i.new = t(o.new)), e.returnType !==
1655
+ void 0 && (i.returns = t(e.returnType)), i;
1656
+ }, "JsdocTypeFunction"),
1657
+ JsdocTypeGeneric: /* @__PURE__ */ r((e, t) => {
1658
+ let o = {
1659
+ type: "GENERIC",
1660
+ subject: t(e.left),
1661
+ objects: e.elements.map(t),
1662
+ meta: {
1663
+ syntax: e.meta.brackets === "square" ? "SQUARE_BRACKET" : e.meta.dot ? "ANGLE_BRACKET_WITH_DOT" : "ANGLE_BRACKET"
1664
+ }
1665
+ };
1666
+ return e.meta.brackets === "square" && e.elements[0].type === "JsdocTypeFunction" && !e.elements[0].parenthesis && (o.objects[0] = {
1667
+ type: "NAME",
1668
+ name: "function"
1669
+ }), o;
1670
+ }, "JsdocTypeGeneric"),
1671
+ JsdocTypeObjectField: /* @__PURE__ */ r((e, t) => {
1672
+ if (typeof e.key != "string")
1673
+ throw new Error("Index signatures and mapped types are not supported");
1674
+ if (e.right === void 0)
1675
+ return {
1676
+ type: "RECORD_ENTRY",
1677
+ key: e.key,
1678
+ quoteStyle: _(e.meta.quote),
1679
+ value: null,
1680
+ readonly: !1
1681
+ };
1682
+ let o = t(e.right);
1683
+ return e.optional && (o = {
1684
+ type: "OPTIONAL",
1685
+ value: o,
1686
+ meta: {
1687
+ syntax: "SUFFIX_KEY_QUESTION_MARK"
1688
+ }
1689
+ }), {
1690
+ type: "RECORD_ENTRY",
1691
+ key: e.key.toString(),
1692
+ quoteStyle: _(e.meta.quote),
1693
+ value: o,
1694
+ readonly: !1
1695
+ };
1696
+ }, "JsdocTypeObjectField"),
1697
+ JsdocTypeJsdocObjectField: /* @__PURE__ */ r(() => {
1698
+ throw new Error("Keys may not be typed in jsdoctypeparser.");
1699
+ }, "JsdocTypeJsdocObjectField"),
1700
+ JsdocTypeKeyValue: /* @__PURE__ */ r((e, t) => {
1701
+ if (e.right === void 0)
1702
+ return {
1703
+ type: "RECORD_ENTRY",
1704
+ key: e.key,
1705
+ quoteStyle: "none",
1706
+ value: null,
1707
+ readonly: !1
1708
+ };
1709
+ let o = t(e.right);
1710
+ return e.optional && (o = {
1711
+ type: "OPTIONAL",
1712
+ value: o,
1713
+ meta: {
1714
+ syntax: "SUFFIX_KEY_QUESTION_MARK"
1715
+ }
1716
+ }), {
1717
+ type: "RECORD_ENTRY",
1718
+ key: e.key,
1719
+ quoteStyle: "none",
1720
+ value: o,
1721
+ readonly: !1
1722
+ };
1723
+ }, "JsdocTypeKeyValue"),
1724
+ JsdocTypeObject: /* @__PURE__ */ r((e, t) => {
1725
+ let o = [];
1726
+ for (let i of e.elements)
1727
+ (i.type === "JsdocTypeObjectField" || i.type === "JsdocTypeJsdocObjectField") && o.push(t(i));
1728
+ return {
1729
+ type: "RECORD",
1730
+ entries: o
1731
+ };
1732
+ }, "JsdocTypeObject"),
1733
+ JsdocTypeSpecialNamePath: /* @__PURE__ */ r((e) => {
1734
+ if (e.specialType !== "module")
1735
+ throw new Error(`jsdoctypeparser does not support type ${e.specialType} at this point.`);
1736
+ return {
1737
+ type: "MODULE",
1738
+ value: {
1739
+ type: "FILE_PATH",
1740
+ quoteStyle: _(e.meta.quote),
1741
+ path: e.value
1742
+ }
1743
+ };
1744
+ }, "JsdocTypeSpecialNamePath"),
1745
+ JsdocTypeNamePath: /* @__PURE__ */ r((e, t) => {
1746
+ let o = !1, i, l;
1747
+ e.right.type === "JsdocTypeSpecialNamePath" && e.right.specialType === "event" ? (o = !0, i = e.right.value, l = _(e.right.meta.quote)) :
1748
+ (i = e.right.value, l = _(e.right.meta.quote));
1749
+ let y = {
1750
+ type: ur(e.pathType),
1751
+ owner: t(e.left),
1752
+ name: i,
1753
+ quoteStyle: l,
1754
+ hasEventPrefix: o
1755
+ };
1756
+ if (y.owner.type === "MODULE") {
1757
+ let d = y.owner;
1758
+ return y.owner = y.owner.value, d.value = y, d;
1759
+ } else
1760
+ return y;
1761
+ }, "JsdocTypeNamePath"),
1762
+ JsdocTypeUnion: /* @__PURE__ */ r((e, t) => Oe("UNION", e.elements.map(t)), "JsdocTypeUnion"),
1763
+ JsdocTypeParenthesis: /* @__PURE__ */ r((e, t) => ({
1764
+ type: "PARENTHESIS",
1765
+ value: t(P(e.element))
1766
+ }), "JsdocTypeParenthesis"),
1767
+ JsdocTypeNull: /* @__PURE__ */ r(() => ({
1768
+ type: "NAME",
1769
+ name: "null"
1770
+ }), "JsdocTypeNull"),
1771
+ JsdocTypeUnknown: /* @__PURE__ */ r(() => ({
1772
+ type: "UNKNOWN"
1773
+ }), "JsdocTypeUnknown"),
1774
+ JsdocTypeStringValue: /* @__PURE__ */ r((e) => ({
1775
+ type: "STRING_VALUE",
1776
+ quoteStyle: _(e.meta.quote),
1777
+ string: e.value
1778
+ }), "JsdocTypeStringValue"),
1779
+ JsdocTypeIntersection: /* @__PURE__ */ r((e, t) => Oe("INTERSECTION", e.elements.map(t)), "JsdocTypeIntersection"),
1780
+ JsdocTypeNumber: /* @__PURE__ */ r((e) => ({
1781
+ type: "NUMBER_VALUE",
1782
+ number: e.value.toString()
1783
+ }), "JsdocTypeNumber"),
1784
+ JsdocTypeSymbol: O,
1785
+ JsdocTypeProperty: O,
1786
+ JsdocTypePredicate: O,
1787
+ JsdocTypeMappedType: O,
1788
+ JsdocTypeIndexSignature: O
1789
+ };
1790
+ function yr(e) {
1791
+ return W(mr, e);
1792
+ }
1793
+ r(yr, "jtpTransform");
1794
+ function fr() {
1795
+ return {
1796
+ JsdocTypeIntersection: /* @__PURE__ */ r((e, t) => ({
1797
+ type: "JsdocTypeIntersection",
1798
+ elements: e.elements.map(t)
1799
+ }), "JsdocTypeIntersection"),
1800
+ JsdocTypeGeneric: /* @__PURE__ */ r((e, t) => ({
1801
+ type: "JsdocTypeGeneric",
1802
+ left: t(e.left),
1803
+ elements: e.elements.map(t),
1804
+ meta: {
1805
+ dot: e.meta.dot,
1806
+ brackets: e.meta.brackets
1807
+ }
1808
+ }), "JsdocTypeGeneric"),
1809
+ JsdocTypeNullable: /* @__PURE__ */ r((e) => e, "JsdocTypeNullable"),
1810
+ JsdocTypeUnion: /* @__PURE__ */ r((e, t) => ({
1811
+ type: "JsdocTypeUnion",
1812
+ elements: e.elements.map(t)
1813
+ }), "JsdocTypeUnion"),
1814
+ JsdocTypeUnknown: /* @__PURE__ */ r((e) => e, "JsdocTypeUnknown"),
1815
+ JsdocTypeUndefined: /* @__PURE__ */ r((e) => e, "JsdocTypeUndefined"),
1816
+ JsdocTypeTypeof: /* @__PURE__ */ r((e, t) => ({
1817
+ type: "JsdocTypeTypeof",
1818
+ element: t(e.element)
1819
+ }), "JsdocTypeTypeof"),
1820
+ JsdocTypeSymbol: /* @__PURE__ */ r((e, t) => {
1821
+ let o = {
1822
+ type: "JsdocTypeSymbol",
1823
+ value: e.value
1824
+ };
1825
+ return e.element !== void 0 && (o.element = t(e.element)), o;
1826
+ }, "JsdocTypeSymbol"),
1827
+ JsdocTypeOptional: /* @__PURE__ */ r((e, t) => ({
1828
+ type: "JsdocTypeOptional",
1829
+ element: t(e.element),
1830
+ meta: {
1831
+ position: e.meta.position
1832
+ }
1833
+ }), "JsdocTypeOptional"),
1834
+ JsdocTypeObject: /* @__PURE__ */ r((e, t) => ({
1835
+ type: "JsdocTypeObject",
1836
+ meta: {
1837
+ separator: "comma"
1838
+ },
1839
+ elements: e.elements.map(t)
1840
+ }), "JsdocTypeObject"),
1841
+ JsdocTypeNumber: /* @__PURE__ */ r((e) => e, "JsdocTypeNumber"),
1842
+ JsdocTypeNull: /* @__PURE__ */ r((e) => e, "JsdocTypeNull"),
1843
+ JsdocTypeNotNullable: /* @__PURE__ */ r((e, t) => ({
1844
+ type: "JsdocTypeNotNullable",
1845
+ element: t(e.element),
1846
+ meta: {
1847
+ position: e.meta.position
1848
+ }
1849
+ }), "JsdocTypeNotNullable"),
1850
+ JsdocTypeSpecialNamePath: /* @__PURE__ */ r((e) => e, "JsdocTypeSpecialNamePath"),
1851
+ JsdocTypeObjectField: /* @__PURE__ */ r((e, t) => ({
1852
+ type: "JsdocTypeObjectField",
1853
+ key: e.key,
1854
+ right: e.right === void 0 ? void 0 : t(e.right),
1855
+ optional: e.optional,
1856
+ readonly: e.readonly,
1857
+ meta: e.meta
1858
+ }), "JsdocTypeObjectField"),
1859
+ JsdocTypeJsdocObjectField: /* @__PURE__ */ r((e, t) => ({
1860
+ type: "JsdocTypeJsdocObjectField",
1861
+ left: t(e.left),
1862
+ right: t(e.right)
1863
+ }), "JsdocTypeJsdocObjectField"),
1864
+ JsdocTypeKeyValue: /* @__PURE__ */ r((e, t) => ({
1865
+ type: "JsdocTypeKeyValue",
1866
+ key: e.key,
1867
+ right: e.right === void 0 ? void 0 : t(e.right),
1868
+ optional: e.optional,
1869
+ variadic: e.variadic
1870
+ }), "JsdocTypeKeyValue"),
1871
+ JsdocTypeImport: /* @__PURE__ */ r((e, t) => ({
1872
+ type: "JsdocTypeImport",
1873
+ element: t(e.element)
1874
+ }), "JsdocTypeImport"),
1875
+ JsdocTypeAny: /* @__PURE__ */ r((e) => e, "JsdocTypeAny"),
1876
+ JsdocTypeStringValue: /* @__PURE__ */ r((e) => e, "JsdocTypeStringValue"),
1877
+ JsdocTypeNamePath: /* @__PURE__ */ r((e) => e, "JsdocTypeNamePath"),
1878
+ JsdocTypeVariadic: /* @__PURE__ */ r((e, t) => {
1879
+ let o = {
1880
+ type: "JsdocTypeVariadic",
1881
+ meta: {
1882
+ position: e.meta.position,
1883
+ squareBrackets: e.meta.squareBrackets
1884
+ }
1885
+ };
1886
+ return e.element !== void 0 && (o.element = t(e.element)), o;
1887
+ }, "JsdocTypeVariadic"),
1888
+ JsdocTypeTuple: /* @__PURE__ */ r((e, t) => ({
1889
+ type: "JsdocTypeTuple",
1890
+ elements: e.elements.map(t)
1891
+ }), "JsdocTypeTuple"),
1892
+ JsdocTypeName: /* @__PURE__ */ r((e) => e, "JsdocTypeName"),
1893
+ JsdocTypeFunction: /* @__PURE__ */ r((e, t) => {
1894
+ let o = {
1895
+ type: "JsdocTypeFunction",
1896
+ arrow: e.arrow,
1897
+ parameters: e.parameters.map(t),
1898
+ constructor: e.constructor,
1899
+ parenthesis: e.parenthesis
1900
+ };
1901
+ return e.returnType !== void 0 && (o.returnType = t(e.returnType)), o;
1902
+ }, "JsdocTypeFunction"),
1903
+ JsdocTypeKeyof: /* @__PURE__ */ r((e, t) => ({
1904
+ type: "JsdocTypeKeyof",
1905
+ element: t(e.element)
1906
+ }), "JsdocTypeKeyof"),
1907
+ JsdocTypeParenthesis: /* @__PURE__ */ r((e, t) => ({
1908
+ type: "JsdocTypeParenthesis",
1909
+ element: t(e.element)
1910
+ }), "JsdocTypeParenthesis"),
1911
+ JsdocTypeProperty: /* @__PURE__ */ r((e) => e, "JsdocTypeProperty"),
1912
+ JsdocTypePredicate: /* @__PURE__ */ r((e, t) => ({
1913
+ type: "JsdocTypePredicate",
1914
+ left: t(e.left),
1915
+ right: t(e.right)
1916
+ }), "JsdocTypePredicate"),
1917
+ JsdocTypeIndexSignature: /* @__PURE__ */ r((e, t) => ({
1918
+ type: "JsdocTypeIndexSignature",
1919
+ key: e.key,
1920
+ right: t(e.right)
1921
+ }), "JsdocTypeIndexSignature"),
1922
+ JsdocTypeMappedType: /* @__PURE__ */ r((e, t) => ({
1923
+ type: "JsdocTypeMappedType",
1924
+ key: e.key,
1925
+ right: t(e.right)
1926
+ }), "JsdocTypeMappedType")
1927
+ };
1928
+ }
1929
+ r(fr, "identityTransformRules");
1930
+ let ot = {
1931
+ JsdocTypeAny: [],
1932
+ JsdocTypeFunction: ["parameters", "returnType"],
1933
+ JsdocTypeGeneric: ["left", "elements"],
1934
+ JsdocTypeImport: [],
1935
+ JsdocTypeIndexSignature: ["right"],
1936
+ JsdocTypeIntersection: ["elements"],
1937
+ JsdocTypeKeyof: ["element"],
1938
+ JsdocTypeKeyValue: ["right"],
1939
+ JsdocTypeMappedType: ["right"],
1940
+ JsdocTypeName: [],
1941
+ JsdocTypeNamePath: ["left", "right"],
1942
+ JsdocTypeNotNullable: ["element"],
1943
+ JsdocTypeNull: [],
1944
+ JsdocTypeNullable: ["element"],
1945
+ JsdocTypeNumber: [],
1946
+ JsdocTypeObject: ["elements"],
1947
+ JsdocTypeObjectField: ["right"],
1948
+ JsdocTypeJsdocObjectField: ["left", "right"],
1949
+ JsdocTypeOptional: ["element"],
1950
+ JsdocTypeParenthesis: ["element"],
1951
+ JsdocTypeSpecialNamePath: [],
1952
+ JsdocTypeStringValue: [],
1953
+ JsdocTypeSymbol: ["element"],
1954
+ JsdocTypeTuple: ["elements"],
1955
+ JsdocTypeTypeof: ["element"],
1956
+ JsdocTypeUndefined: [],
1957
+ JsdocTypeUnion: ["elements"],
1958
+ JsdocTypeUnknown: [],
1959
+ JsdocTypeVariadic: ["element"],
1960
+ JsdocTypeProperty: [],
1961
+ JsdocTypePredicate: ["left", "right"]
1962
+ };
1963
+ function De(e, t, o, i, l) {
1964
+ i?.(e, t, o);
1965
+ let y = ot[e.type];
1966
+ for (let d of y) {
1967
+ let x = e[d];
1968
+ if (x !== void 0)
1969
+ if (Array.isArray(x))
1970
+ for (let N of x)
1971
+ De(N, e, d, i, l);
1972
+ else
1973
+ De(x, e, d, i, l);
1974
+ }
1975
+ l?.(e, t, o);
1976
+ }
1977
+ r(De, "_traverse");
1978
+ function dr(e, t, o) {
1979
+ De(e, void 0, void 0, t, o);
1980
+ }
1981
+ r(dr, "traverse"), n.catharsisTransform = lr, n.identityTransformRules = fr, n.jtpTransform = yr, n.parse = tt, n.stringify = ir, n.stringifyRules =
1982
+ nt, n.transform = W, n.traverse = dr, n.tryParse = sr, n.visitorKeys = ot;
1983
+ });
1984
+ });
17
1985
 
18
1986
  // src/docs-tools/index.ts
19
- var Jt = {};
20
- Fe(Jt, {
21
- ADDON_ID: () => K,
22
- MAX_DEFAULT_VALUE_SUMMARY_LENGTH: () => at,
23
- MAX_TYPE_SUMMARY_LENGTH: () => pt,
24
- PANEL_ID: () => wt,
25
- PARAM_KEY: () => Et,
26
- SNIPPET_RENDERED: () => jt,
27
- SourceType: () => Se,
28
- TypeSystem: () => te,
29
- convert: () => b,
30
- createSummaryValue: () => l,
31
- enhanceArgTypes: () => vt,
32
- extractComponentDescription: () => Ot,
33
- extractComponentProps: () => St,
34
- extractComponentSectionArray: () => Te,
35
- extractComponentSectionObject: () => he,
36
- getDocgenDescription: () => C,
37
- getDocgenSection: () => V,
38
- hasDocgen: () => R,
39
- hasDocsOrControls: () => Ft,
40
- isDefaultValueBlacklisted: () => d,
41
- isTooLongForDefaultValueSummary: () => q,
42
- isTooLongForTypeSummary: () => j,
43
- isValidDocgenSection: () => A,
44
- normalizeNewlines: () => ct,
45
- parseJsDoc: () => Y,
46
- str: () => N
1987
+ var En = {};
1988
+ wr(En, {
1989
+ ADDON_ID: () => Ge,
1990
+ MAX_DEFAULT_VALUE_SUMMARY_LENGTH: () => en,
1991
+ MAX_TYPE_SUMMARY_LENGTH: () => Zr,
1992
+ PANEL_ID: () => xn,
1993
+ PARAM_KEY: () => Jn,
1994
+ SNIPPET_RENDERED: () => Pn,
1995
+ SourceType: () => Ft,
1996
+ TypeSystem: () => ut,
1997
+ convert: () => H,
1998
+ createSummaryValue: () => J,
1999
+ enhanceArgTypes: () => hn,
2000
+ extractComponentDescription: () => gn,
2001
+ extractComponentProps: () => Tn,
2002
+ extractComponentSectionArray: () => At,
2003
+ extractComponentSectionObject: () => Rt,
2004
+ getDocgenDescription: () => Fe,
2005
+ getDocgenSection: () => Ie,
2006
+ hasDocgen: () => Ae,
2007
+ hasDocsOrControls: () => bn,
2008
+ isDefaultValueBlacklisted: () => L,
2009
+ isTooLongForDefaultValueSummary: () => qe,
2010
+ isTooLongForTypeSummary: () => me,
2011
+ isValidDocgenSection: () => Re,
2012
+ normalizeNewlines: () => tn,
2013
+ parseJsDoc: () => $e,
2014
+ str: () => ke
47
2015
  });
48
- module.exports = Ne(Jt);
2016
+ module.exports = Er(En);
49
2017
 
50
2018
  // src/docs-tools/argTypes/convert/flow/convert.ts
51
- var Q = require("storybook/internal/preview-errors");
52
- var Re = /* @__PURE__ */ o((e) => e.name === "literal", "isLiteral"), Ae = /* @__PURE__ */ o((e) => e.value.replace(/['|"]/g, ""), "toEnumOp\
53
- tion"), Ve = /* @__PURE__ */ o((e) => {
54
- switch (e.type) {
2019
+ var pt = require("storybook/internal/preview-errors");
2020
+ var Sr = /* @__PURE__ */ r((n) => n.name === "literal", "isLiteral"), Nr = /* @__PURE__ */ r((n) => n.value.replace(/['|"]/g, ""), "toEnumOp\
2021
+ tion"), Or = /* @__PURE__ */ r((n) => {
2022
+ switch (n.type) {
55
2023
  case "function":
56
2024
  return { name: "function" };
57
2025
  case "object":
58
- let t = {};
59
- return e.signature.properties.forEach((r) => {
60
- t[r.key] = x(r.value);
2026
+ let s = {};
2027
+ return n.signature.properties.forEach((a) => {
2028
+ s[a.key] = B(a.value);
61
2029
  }), {
62
2030
  name: "object",
63
- value: t
2031
+ value: s
64
2032
  };
65
2033
  default:
66
- throw new Q.UnknownArgTypesError({ type: e, language: "Flow" });
2034
+ throw new pt.UnknownArgTypesError({ type: n, language: "Flow" });
67
2035
  }
68
- }, "convertSig"), x = /* @__PURE__ */ o((e) => {
69
- let { name: t, raw: r } = e, n = {};
70
- switch (typeof r < "u" && (n.raw = r), e.name) {
2036
+ }, "convertSig"), B = /* @__PURE__ */ r((n) => {
2037
+ let { name: s, raw: a } = n, p = {};
2038
+ switch (typeof a < "u" && (p.raw = a), n.name) {
71
2039
  case "literal":
72
- return { ...n, name: "other", value: e.value };
2040
+ return { ...p, name: "other", value: n.value };
73
2041
  case "string":
74
2042
  case "number":
75
2043
  case "symbol":
76
2044
  case "boolean":
77
- return { ...n, name: t };
2045
+ return { ...p, name: s };
78
2046
  case "Array":
79
- return { ...n, name: "array", value: e.elements.map(x) };
2047
+ return { ...p, name: "array", value: n.elements.map(B) };
80
2048
  case "signature":
81
- return { ...n, ...Ve(e) };
2049
+ return { ...p, ...Or(n) };
82
2050
  case "union":
83
- return e.elements?.every(Re) ? { ...n, name: "enum", value: e.elements?.map(Ae) } : { ...n, name: t, value: e.elements?.map(x) };
2051
+ return n.elements?.every(Sr) ? { ...p, name: "enum", value: n.elements?.map(Nr) } : { ...p, name: s, value: n.elements?.map(B) };
84
2052
  case "intersection":
85
- return { ...n, name: t, value: e.elements?.map(x) };
2053
+ return { ...p, name: s, value: n.elements?.map(B) };
86
2054
  default:
87
- return { ...n, name: "other", value: t };
2055
+ return { ...p, name: "other", value: s };
88
2056
  }
89
2057
  }, "convert");
90
2058
 
2059
+ // ../node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
2060
+ function X(n) {
2061
+ if (typeof n != "object" || n == null)
2062
+ return !1;
2063
+ if (Object.getPrototypeOf(n) === null)
2064
+ return !0;
2065
+ if (n.toString() !== "[object Object]")
2066
+ return !1;
2067
+ let s = n;
2068
+ for (; Object.getPrototypeOf(s) !== null; )
2069
+ s = Object.getPrototypeOf(s);
2070
+ return Object.getPrototypeOf(n) === s;
2071
+ }
2072
+ r(X, "isPlainObject");
2073
+
91
2074
  // ../node_modules/es-toolkit/dist/object/mapValues.mjs
92
- function J(e, t) {
93
- let r = {}, n = Object.keys(e);
94
- for (let s = 0; s < n.length; s++) {
95
- let i = n[s], p = e[i];
96
- r[i] = t(p, i, e);
2075
+ function ve(n, s) {
2076
+ let a = {}, p = Object.keys(n);
2077
+ for (let c = 0; c < p.length; c++) {
2078
+ let u = p[c], m = n[u];
2079
+ a[u] = s(m, u, n);
97
2080
  }
98
- return r;
2081
+ return a;
99
2082
  }
100
- o(J, "mapValues");
2083
+ r(ve, "mapValues");
101
2084
 
102
2085
  // src/docs-tools/argTypes/convert/utils.ts
103
- var Z = /^['"]|['"]$/g, Ce = /* @__PURE__ */ o((e) => e.replace(Z, ""), "trimQuotes"), _e = /* @__PURE__ */ o((e) => Z.test(e), "includesQuo\
104
- tes"), S = /* @__PURE__ */ o((e) => {
105
- let t = Ce(e);
106
- return _e(e) || Number.isNaN(Number(t)) ? t : Number(t);
2086
+ var ct = /^['"]|['"]$/g, Dr = /* @__PURE__ */ r((n) => n.replace(ct, ""), "trimQuotes"), vr = /* @__PURE__ */ r((n) => ct.test(n), "includes\
2087
+ Quotes"), ae = /* @__PURE__ */ r((n) => {
2088
+ let s = Dr(n);
2089
+ return vr(n) || Number.isNaN(Number(s)) ? s : Number(s);
107
2090
  }, "parseLiteral");
108
2091
 
109
2092
  // src/docs-tools/argTypes/convert/proptypes/convert.ts
110
- var Be = /^\(.*\) => /, D = /* @__PURE__ */ o((e) => {
111
- let { name: t, raw: r, computed: n, value: s } = e, i = {};
112
- switch (typeof r < "u" && (i.raw = r), t) {
2093
+ var kr = /^\(.*\) => /, C = /* @__PURE__ */ r((n) => {
2094
+ let { name: s, raw: a, computed: p, value: c } = n, u = {};
2095
+ switch (typeof a < "u" && (u.raw = a), s) {
113
2096
  case "enum": {
114
- let a = n ? s : s.map((c) => S(c.value));
115
- return { ...i, name: t, value: a };
2097
+ let T = p ? c : c.map((g) => ae(g.value));
2098
+ return { ...u, name: s, value: T };
116
2099
  }
117
2100
  case "string":
118
2101
  case "number":
119
2102
  case "symbol":
120
- return { ...i, name: t };
2103
+ return { ...u, name: s };
121
2104
  case "func":
122
- return { ...i, name: "function" };
2105
+ return { ...u, name: "function" };
123
2106
  case "bool":
124
2107
  case "boolean":
125
- return { ...i, name: "boolean" };
2108
+ return { ...u, name: "boolean" };
126
2109
  case "arrayOf":
127
2110
  case "array":
128
- return { ...i, name: "array", value: s && D(s) };
2111
+ return { ...u, name: "array", value: c && C(c) };
129
2112
  case "object":
130
- return { ...i, name: t };
2113
+ return { ...u, name: s };
131
2114
  case "objectOf":
132
- return { ...i, name: t, value: D(s) };
2115
+ return { ...u, name: s, value: C(c) };
133
2116
  case "shape":
134
2117
  case "exact":
135
- let p = J(s, (a) => D(a));
136
- return { ...i, name: "object", value: p };
2118
+ let m = ve(c, (T) => C(T));
2119
+ return { ...u, name: "object", value: m };
137
2120
  case "union":
138
- return { ...i, name: "union", value: s.map((a) => D(a)) };
2121
+ return { ...u, name: "union", value: c.map((T) => C(T)) };
139
2122
  case "instanceOf":
140
2123
  case "element":
141
2124
  case "elementType":
142
2125
  default: {
143
- if (t?.indexOf("|") > 0)
2126
+ if (s?.indexOf("|") > 0)
144
2127
  try {
145
- let u = t.split("|").map((m) => JSON.parse(m));
146
- return { ...i, name: "enum", value: u };
2128
+ let w = s.split("|").map((b) => JSON.parse(b));
2129
+ return { ...u, name: "enum", value: w };
147
2130
  } catch {
148
2131
  }
149
- let a = s ? `${t}(${s})` : t, c = Be.test(t) ? "function" : "other";
150
- return { ...i, name: c, value: a };
2132
+ let T = c ? `${s}(${c})` : s, g = kr.test(s) ? "function" : "other";
2133
+ return { ...u, name: g, value: T };
151
2134
  }
152
2135
  }
153
2136
  }, "convert");
154
2137
 
155
2138
  // src/docs-tools/argTypes/convert/typescript/convert.ts
156
- var ee = require("storybook/internal/preview-errors");
157
- var Ie = /* @__PURE__ */ o((e) => {
158
- switch (e.type) {
2139
+ var lt = require("storybook/internal/preview-errors");
2140
+ var Ar = /* @__PURE__ */ r((n) => {
2141
+ switch (n.type) {
159
2142
  case "function":
160
2143
  return { name: "function" };
161
2144
  case "object":
162
- let t = {};
163
- return e.signature.properties.forEach((r) => {
164
- t[r.key] = T(r.value);
2145
+ let s = {};
2146
+ return n.signature.properties.forEach((a) => {
2147
+ s[a.key] = M(a.value);
165
2148
  }), {
166
2149
  name: "object",
167
- value: t
2150
+ value: s
168
2151
  };
169
2152
  default:
170
- throw new ee.UnknownArgTypesError({ type: e, language: "Typescript" });
2153
+ throw new lt.UnknownArgTypesError({ type: n, language: "Typescript" });
171
2154
  }
172
- }, "convertSig"), T = /* @__PURE__ */ o((e) => {
173
- let { name: t, raw: r } = e, n = {};
174
- switch (typeof r < "u" && (n.raw = r), e.name) {
2155
+ }, "convertSig"), M = /* @__PURE__ */ r((n) => {
2156
+ let { name: s, raw: a } = n, p = {};
2157
+ switch (typeof a < "u" && (p.raw = a), n.name) {
175
2158
  case "string":
176
2159
  case "number":
177
2160
  case "symbol":
178
2161
  case "boolean":
179
- return { ...n, name: t };
2162
+ return { ...p, name: s };
180
2163
  case "Array":
181
- return { ...n, name: "array", value: e.elements.map(T) };
2164
+ return { ...p, name: "array", value: n.elements.map(M) };
182
2165
  case "signature":
183
- return { ...n, ...Ie(e) };
2166
+ return { ...p, ...Ar(n) };
184
2167
  case "union":
185
- let s;
186
- return e.elements?.every((i) => i.name === "literal") ? s = {
187
- ...n,
2168
+ let c;
2169
+ return n.elements?.every((u) => u.name === "literal") ? c = {
2170
+ ...p,
188
2171
  name: "enum",
189
2172
  // @ts-expect-error fix types
190
- value: e.elements?.map((i) => S(i.value))
191
- } : s = { ...n, name: t, value: e.elements?.map(T) }, s;
2173
+ value: n.elements?.map((u) => ae(u.value))
2174
+ } : c = { ...p, name: s, value: n.elements?.map(M) }, c;
192
2175
  case "intersection":
193
- return { ...n, name: t, value: e.elements?.map(T) };
2176
+ return { ...p, name: s, value: n.elements?.map(M) };
194
2177
  default:
195
- return { ...n, name: "other", value: t };
2178
+ return { ...p, name: "other", value: s };
196
2179
  }
197
2180
  }, "convert");
198
2181
 
199
2182
  // src/docs-tools/argTypes/convert/index.ts
200
- var b = /* @__PURE__ */ o((e) => {
201
- let { type: t, tsType: r, flowType: n } = e;
2183
+ var H = /* @__PURE__ */ r((n) => {
2184
+ let { type: s, tsType: a, flowType: p } = n;
202
2185
  try {
203
- if (t != null)
204
- return D(t);
205
- if (r != null)
206
- return T(r);
207
- if (n != null)
208
- return x(n);
209
- } catch (s) {
210
- console.error(s);
2186
+ if (s != null)
2187
+ return C(s);
2188
+ if (a != null)
2189
+ return M(a);
2190
+ if (p != null)
2191
+ return B(p);
2192
+ } catch (c) {
2193
+ console.error(c);
211
2194
  }
212
2195
  return null;
213
2196
  }, "convert");
214
2197
 
215
2198
  // src/docs-tools/argTypes/docgen/types.ts
216
- var te = /* @__PURE__ */ ((s) => (s.JAVASCRIPT = "JavaScript", s.FLOW = "Flow", s.TYPESCRIPT = "TypeScript", s.UNKNOWN = "Unknown", s))(te ||
2199
+ var ut = /* @__PURE__ */ ((c) => (c.JAVASCRIPT = "JavaScript", c.FLOW = "Flow", c.TYPESCRIPT = "TypeScript", c.UNKNOWN = "Unknown", c))(ut ||
217
2200
  {});
218
2201
 
219
2202
  // src/docs-tools/argTypes/docgen/utils/defaultValue.ts
220
- var Le = ["null", "undefined"];
221
- function d(e) {
222
- return Le.some((t) => t === e);
2203
+ var Rr = ["null", "undefined"];
2204
+ function L(n) {
2205
+ return Rr.some((s) => s === n);
223
2206
  }
224
- o(d, "isDefaultValueBlacklisted");
2207
+ r(L, "isDefaultValueBlacklisted");
225
2208
 
226
2209
  // src/docs-tools/argTypes/docgen/utils/string.ts
227
- var N = /* @__PURE__ */ o((e) => {
228
- if (!e)
2210
+ var ke = /* @__PURE__ */ r((n) => {
2211
+ if (!n)
229
2212
  return "";
230
- if (typeof e == "string")
231
- return e;
232
- throw new Error(`Description: expected string, got: ${JSON.stringify(e)}`);
2213
+ if (typeof n == "string")
2214
+ return n;
2215
+ throw new Error(`Description: expected string, got: ${JSON.stringify(n)}`);
233
2216
  }, "str");
234
2217
 
235
2218
  // src/docs-tools/argTypes/docgen/utils/docgenInfo.ts
236
- function R(e) {
237
- return !!e.__docgenInfo;
2219
+ function Ae(n) {
2220
+ return !!n.__docgenInfo;
238
2221
  }
239
- o(R, "hasDocgen");
240
- function A(e) {
241
- return e != null && Object.keys(e).length > 0;
2222
+ r(Ae, "hasDocgen");
2223
+ function Re(n) {
2224
+ return n != null && Object.keys(n).length > 0;
242
2225
  }
243
- o(A, "isValidDocgenSection");
244
- function V(e, t) {
245
- return R(e) ? e.__docgenInfo[t] : null;
2226
+ r(Re, "isValidDocgenSection");
2227
+ function Ie(n, s) {
2228
+ return Ae(n) ? n.__docgenInfo[s] : null;
246
2229
  }
247
- o(V, "getDocgenSection");
248
- function C(e) {
249
- return R(e) ? N(e.__docgenInfo.description) : "";
2230
+ r(Ie, "getDocgenSection");
2231
+ function Fe(n) {
2232
+ return Ae(n) ? ke(n.__docgenInfo.description) : "";
250
2233
  }
251
- o(C, "getDocgenDescription");
2234
+ r(Fe, "getDocgenDescription");
252
2235
 
253
2236
  // ../node_modules/comment-parser/es6/primitives.js
254
- var f;
255
- (function(e) {
256
- e.start = "/**", e.nostart = "/***", e.delim = "*", e.end = "*/";
257
- })(f = f || (f = {}));
2237
+ var v;
2238
+ (function(n) {
2239
+ n.start = "/**", n.nostart = "/***", n.delim = "*", n.end = "*/";
2240
+ })(v = v || (v = {}));
258
2241
 
259
2242
  // ../node_modules/comment-parser/es6/util.js
260
- function _(e) {
261
- return /^\s+$/.test(e);
2243
+ function je(n) {
2244
+ return /^\s+$/.test(n);
262
2245
  }
263
- o(_, "isSpace");
264
- function re(e) {
265
- let t = e.match(/\r+$/);
266
- return t == null ? ["", e] : [e.slice(-t[0].length), e.slice(0, -t[0].length)];
2246
+ r(je, "isSpace");
2247
+ function mt(n) {
2248
+ let s = n.match(/\r+$/);
2249
+ return s == null ? ["", n] : [n.slice(-s[0].length), n.slice(0, -s[0].length)];
267
2250
  }
268
- o(re, "splitCR");
269
- function y(e) {
270
- let t = e.match(/^\s+/);
271
- return t == null ? ["", e] : [e.slice(0, t[0].length), e.slice(t[0].length)];
2251
+ r(mt, "splitCR");
2252
+ function A(n) {
2253
+ let s = n.match(/^\s+/);
2254
+ return s == null ? ["", n] : [n.slice(0, s[0].length), n.slice(s[0].length)];
272
2255
  }
273
- o(y, "splitSpace");
274
- function oe(e) {
275
- return e.split(/\n/);
2256
+ r(A, "splitSpace");
2257
+ function yt(n) {
2258
+ return n.split(/\n/);
276
2259
  }
277
- o(oe, "splitLines");
278
- function ne(e = {}) {
279
- return Object.assign({ tag: "", name: "", type: "", optional: !1, description: "", problems: [], source: [] }, e);
2260
+ r(yt, "splitLines");
2261
+ function ft(n = {}) {
2262
+ return Object.assign({ tag: "", name: "", type: "", optional: !1, description: "", problems: [], source: [] }, n);
280
2263
  }
281
- o(ne, "seedSpec");
282
- function B(e = {}) {
2264
+ r(ft, "seedSpec");
2265
+ function _e(n = {}) {
283
2266
  return Object.assign({ start: "", delimiter: "", postDelimiter: "", tag: "", postTag: "", name: "", postName: "", type: "", postType: "", description: "",
284
- end: "", lineEnd: "" }, e);
2267
+ end: "", lineEnd: "" }, n);
285
2268
  }
286
- o(B, "seedTokens");
2269
+ r(_e, "seedTokens");
287
2270
 
288
2271
  // ../node_modules/comment-parser/es6/parser/block-parser.js
289
- var Ue = /^@\S+/;
290
- function I({ fence: e = "```" } = {}) {
291
- let t = We(e), r = /* @__PURE__ */ o((n, s) => t(n) ? !s : s, "toggleFence");
292
- return /* @__PURE__ */ o(function(s) {
293
- let i = [[]], p = !1;
294
- for (let a of s)
295
- Ue.test(a.tokens.description) && !p ? i.push([a]) : i[i.length - 1].push(a), p = r(a.tokens.description, p);
296
- return i;
2272
+ var Ir = /^@\S+/;
2273
+ function Le({ fence: n = "```" } = {}) {
2274
+ let s = Fr(n), a = /* @__PURE__ */ r((p, c) => s(p) ? !c : c, "toggleFence");
2275
+ return /* @__PURE__ */ r(function(c) {
2276
+ let u = [[]], m = !1;
2277
+ for (let T of c)
2278
+ Ir.test(T.tokens.description) && !m ? u.push([T]) : u[u.length - 1].push(T), m = a(T.tokens.description, m);
2279
+ return u;
297
2280
  }, "parseBlock");
298
2281
  }
299
- o(I, "getParser");
300
- function We(e) {
301
- return typeof e == "string" ? (t) => t.split(e).length % 2 === 0 : e;
2282
+ r(Le, "getParser");
2283
+ function Fr(n) {
2284
+ return typeof n == "string" ? (s) => s.split(n).length % 2 === 0 : n;
302
2285
  }
303
- o(We, "getFencer");
2286
+ r(Fr, "getFencer");
304
2287
 
305
2288
  // ../node_modules/comment-parser/es6/parser/source-parser.js
306
- function L({ startLine: e = 0, markers: t = f } = {}) {
307
- let r = null, n = e;
308
- return /* @__PURE__ */ o(function(i) {
309
- let p = i, a = B();
310
- if ([a.lineEnd, p] = re(p), [a.start, p] = y(p), r === null && p.startsWith(t.start) && !p.startsWith(t.nostart) && (r = [], a.delimiter =
311
- p.slice(0, t.start.length), p = p.slice(t.start.length), [a.postDelimiter, p] = y(p)), r === null)
312
- return n++, null;
313
- let c = p.trimRight().endsWith(t.end);
314
- if (a.delimiter === "" && p.startsWith(t.delim) && !p.startsWith(t.end) && (a.delimiter = t.delim, p = p.slice(t.delim.length), [a.postDelimiter,
315
- p] = y(p)), c) {
316
- let u = p.trimRight();
317
- a.end = p.slice(u.length - t.end.length), p = u.slice(0, -t.end.length);
318
- }
319
- if (a.description = p, r.push({ number: n, source: i, tokens: a }), n++, c) {
320
- let u = r.slice();
321
- return r = null, u;
2289
+ function Ve({ startLine: n = 0, markers: s = v } = {}) {
2290
+ let a = null, p = n;
2291
+ return /* @__PURE__ */ r(function(u) {
2292
+ let m = u, T = _e();
2293
+ if ([T.lineEnd, m] = mt(m), [T.start, m] = A(m), a === null && m.startsWith(s.start) && !m.startsWith(s.nostart) && (a = [], T.delimiter =
2294
+ m.slice(0, s.start.length), m = m.slice(s.start.length), [T.postDelimiter, m] = A(m)), a === null)
2295
+ return p++, null;
2296
+ let g = m.trimRight().endsWith(s.end);
2297
+ if (T.delimiter === "" && m.startsWith(s.delim) && !m.startsWith(s.end) && (T.delimiter = s.delim, m = m.slice(s.delim.length), [T.postDelimiter,
2298
+ m] = A(m)), g) {
2299
+ let w = m.trimRight();
2300
+ T.end = m.slice(w.length - s.end.length), m = w.slice(0, -s.end.length);
2301
+ }
2302
+ if (T.description = m, a.push({ number: p, source: u, tokens: T }), p++, g) {
2303
+ let w = a.slice();
2304
+ return a = null, w;
322
2305
  }
323
2306
  return null;
324
2307
  }, "parseSource");
325
2308
  }
326
- o(L, "getParser");
2309
+ r(Ve, "getParser");
327
2310
 
328
2311
  // ../node_modules/comment-parser/es6/parser/spec-parser.js
329
- function U({ tokenizers: e }) {
330
- return /* @__PURE__ */ o(function(r) {
331
- var n;
332
- let s = ne({ source: r });
333
- for (let i of e)
334
- if (s = i(s), !((n = s.problems[s.problems.length - 1]) === null || n === void 0) && n.critical)
2312
+ function Ue({ tokenizers: n }) {
2313
+ return /* @__PURE__ */ r(function(a) {
2314
+ var p;
2315
+ let c = ft({ source: a });
2316
+ for (let u of n)
2317
+ if (c = u(c), !((p = c.problems[c.problems.length - 1]) === null || p === void 0) && p.critical)
335
2318
  break;
336
- return s;
2319
+ return c;
337
2320
  }, "parseSpec");
338
2321
  }
339
- o(U, "getParser");
2322
+ r(Ue, "getParser");
340
2323
 
341
2324
  // ../node_modules/comment-parser/es6/parser/tokenizers/tag.js
342
- function O() {
343
- return (e) => {
344
- let { tokens: t } = e.source[0], r = t.description.match(/\s*(@(\S+))(\s*)/);
345
- return r === null ? (e.problems.push({
2325
+ function ie() {
2326
+ return (n) => {
2327
+ let { tokens: s } = n.source[0], a = s.description.match(/\s*(@(\S+))(\s*)/);
2328
+ return a === null ? (n.problems.push({
346
2329
  code: "spec:tag:prefix",
347
2330
  message: 'tag should start with "@" symbol',
348
- line: e.source[0].number,
2331
+ line: n.source[0].number,
349
2332
  critical: !0
350
- }), e) : (t.tag = r[1], t.postTag = r[3], t.description = t.description.slice(r[0].length), e.tag = r[2], e);
2333
+ }), n) : (s.tag = a[1], s.postTag = a[3], s.description = s.description.slice(a[0].length), n.tag = a[2], n);
351
2334
  };
352
2335
  }
353
- o(O, "tagTokenizer");
2336
+ r(ie, "tagTokenizer");
354
2337
 
355
2338
  // ../node_modules/comment-parser/es6/parser/tokenizers/type.js
356
- function v(e = "compact") {
357
- let t = ze(e);
358
- return (r) => {
359
- let n = 0, s = [];
360
- for (let [a, { tokens: c }] of r.source.entries()) {
361
- let u = "";
362
- if (a === 0 && c.description[0] !== "{")
363
- return r;
364
- for (let m of c.description)
365
- if (m === "{" && n++, m === "}" && n--, u += m, n === 0)
2339
+ function pe(n = "compact") {
2340
+ let s = _r(n);
2341
+ return (a) => {
2342
+ let p = 0, c = [];
2343
+ for (let [T, { tokens: g }] of a.source.entries()) {
2344
+ let w = "";
2345
+ if (T === 0 && g.description[0] !== "{")
2346
+ return a;
2347
+ for (let b of g.description)
2348
+ if (b === "{" && p++, b === "}" && p--, w += b, p === 0)
366
2349
  break;
367
- if (s.push([c, u]), n === 0)
2350
+ if (c.push([g, w]), p === 0)
368
2351
  break;
369
2352
  }
370
- if (n !== 0)
371
- return r.problems.push({
2353
+ if (p !== 0)
2354
+ return a.problems.push({
372
2355
  code: "spec:type:unpaired-curlies",
373
2356
  message: "unpaired curlies",
374
- line: r.source[0].number,
2357
+ line: a.source[0].number,
375
2358
  critical: !0
376
- }), r;
377
- let i = [], p = s[0][0].postDelimiter.length;
378
- for (let [a, [c, u]] of s.entries())
379
- c.type = u, a > 0 && (c.type = c.postDelimiter.slice(p) + u, c.postDelimiter = c.postDelimiter.slice(0, p)), [c.postType, c.description] =
380
- y(c.description.slice(u.length)), i.push(c.type);
381
- return i[0] = i[0].slice(1), i[i.length - 1] = i[i.length - 1].slice(0, -1), r.type = t(i), r;
2359
+ }), a;
2360
+ let u = [], m = c[0][0].postDelimiter.length;
2361
+ for (let [T, [g, w]] of c.entries())
2362
+ g.type = w, T > 0 && (g.type = g.postDelimiter.slice(m) + w, g.postDelimiter = g.postDelimiter.slice(0, m)), [g.postType, g.description] =
2363
+ A(g.description.slice(w.length)), u.push(g.type);
2364
+ return u[0] = u[0].slice(1), u[u.length - 1] = u[u.length - 1].slice(0, -1), a.type = s(u), a;
382
2365
  };
383
2366
  }
384
- o(v, "typeTokenizer");
385
- var Me = /* @__PURE__ */ o((e) => e.trim(), "trim");
386
- function ze(e) {
387
- return e === "compact" ? (t) => t.map(Me).join("") : e === "preserve" ? (t) => t.join(`
388
- `) : e;
2367
+ r(pe, "typeTokenizer");
2368
+ var jr = /* @__PURE__ */ r((n) => n.trim(), "trim");
2369
+ function _r(n) {
2370
+ return n === "compact" ? (s) => s.map(jr).join("") : n === "preserve" ? (s) => s.join(`
2371
+ `) : n;
389
2372
  }
390
- o(ze, "getJoiner");
2373
+ r(_r, "getJoiner");
391
2374
 
392
2375
  // ../node_modules/comment-parser/es6/parser/tokenizers/name.js
393
- var $e = /* @__PURE__ */ o((e) => e && e.startsWith('"') && e.endsWith('"'), "isQuoted");
394
- function w() {
395
- let e = /* @__PURE__ */ o((t, { tokens: r }, n) => r.type === "" ? t : n, "typeEnd");
396
- return (t) => {
397
- let { tokens: r } = t.source[t.source.reduce(e, 0)], n = r.description.trimLeft(), s = n.split('"');
398
- if (s.length > 1 && s[0] === "" && s.length % 2 === 1)
399
- return t.name = s[1], r.name = `"${s[1]}"`, [r.postName, r.description] = y(n.slice(r.name.length)), t;
400
- let i = 0, p = "", a = !1, c;
401
- for (let m of n) {
402
- if (i === 0 && _(m))
2376
+ var Lr = /* @__PURE__ */ r((n) => n && n.startsWith('"') && n.endsWith('"'), "isQuoted");
2377
+ function ce() {
2378
+ let n = /* @__PURE__ */ r((s, { tokens: a }, p) => a.type === "" ? s : p, "typeEnd");
2379
+ return (s) => {
2380
+ let { tokens: a } = s.source[s.source.reduce(n, 0)], p = a.description.trimLeft(), c = p.split('"');
2381
+ if (c.length > 1 && c[0] === "" && c.length % 2 === 1)
2382
+ return s.name = c[1], a.name = `"${c[1]}"`, [a.postName, a.description] = A(p.slice(a.name.length)), s;
2383
+ let u = 0, m = "", T = !1, g;
2384
+ for (let b of p) {
2385
+ if (u === 0 && je(b))
403
2386
  break;
404
- m === "[" && i++, m === "]" && i--, p += m;
2387
+ b === "[" && u++, b === "]" && u--, m += b;
405
2388
  }
406
- if (i !== 0)
407
- return t.problems.push({
2389
+ if (u !== 0)
2390
+ return s.problems.push({
408
2391
  code: "spec:name:unpaired-brackets",
409
2392
  message: "unpaired brackets",
410
- line: t.source[0].number,
2393
+ line: s.source[0].number,
411
2394
  critical: !0
412
- }), t;
413
- let u = p;
414
- if (p[0] === "[" && p[p.length - 1] === "]") {
415
- a = !0, p = p.slice(1, -1);
416
- let m = p.split("=");
417
- if (p = m[0].trim(), m[1] !== void 0 && (c = m.slice(1).join("=").trim()), p === "")
418
- return t.problems.push({
2395
+ }), s;
2396
+ let w = m;
2397
+ if (m[0] === "[" && m[m.length - 1] === "]") {
2398
+ T = !0, m = m.slice(1, -1);
2399
+ let b = m.split("=");
2400
+ if (m = b[0].trim(), b[1] !== void 0 && (g = b.slice(1).join("=").trim()), m === "")
2401
+ return s.problems.push({
419
2402
  code: "spec:name:empty-name",
420
2403
  message: "empty name",
421
- line: t.source[0].number,
2404
+ line: s.source[0].number,
422
2405
  critical: !0
423
- }), t;
424
- if (c === "")
425
- return t.problems.push({
2406
+ }), s;
2407
+ if (g === "")
2408
+ return s.problems.push({
426
2409
  code: "spec:name:empty-default",
427
2410
  message: "empty default value",
428
- line: t.source[0].number,
2411
+ line: s.source[0].number,
429
2412
  critical: !0
430
- }), t;
431
- if (!$e(c) && /=(?!>)/.test(c))
432
- return t.problems.push({
2413
+ }), s;
2414
+ if (!Lr(g) && /=(?!>)/.test(g))
2415
+ return s.problems.push({
433
2416
  code: "spec:name:invalid-default",
434
2417
  message: "invalid default value syntax",
435
- line: t.source[0].number,
2418
+ line: s.source[0].number,
436
2419
  critical: !0
437
- }), t;
2420
+ }), s;
438
2421
  }
439
- return t.optional = a, t.name = p, r.name = u, c !== void 0 && (t.default = c), [r.postName, r.description] = y(n.slice(r.name.length)),
440
- t;
2422
+ return s.optional = T, s.name = m, a.name = w, g !== void 0 && (s.default = g), [a.postName, a.description] = A(p.slice(a.name.length)),
2423
+ s;
441
2424
  };
442
2425
  }
443
- o(w, "nameTokenizer");
2426
+ r(ce, "nameTokenizer");
444
2427
 
445
2428
  // ../node_modules/comment-parser/es6/parser/tokenizers/description.js
446
- function E(e = "compact", t = f) {
447
- let r = W(e);
448
- return (n) => (n.description = r(n.source, t), n);
449
- }
450
- o(E, "descriptionTokenizer");
451
- function W(e) {
452
- return e === "compact" ? Ye : e === "preserve" ? Ke : e;
453
- }
454
- o(W, "getJoiner");
455
- function Ye(e, t = f) {
456
- return e.map(({ tokens: { description: r } }) => r.trim()).filter((r) => r !== "").join(" ");
457
- }
458
- o(Ye, "compactJoiner");
459
- var qe = /* @__PURE__ */ o((e, { tokens: t }, r) => t.type === "" ? e : r, "lineNo"), Ge = /* @__PURE__ */ o(({ tokens: e }) => (e.delimiter ===
460
- "" ? e.start : e.postDelimiter.slice(1)) + e.description, "getDescription");
461
- function Ke(e, t = f) {
462
- if (e.length === 0)
2429
+ function le(n = "compact", s = v) {
2430
+ let a = Be(n);
2431
+ return (p) => (p.description = a(p.source, s), p);
2432
+ }
2433
+ r(le, "descriptionTokenizer");
2434
+ function Be(n) {
2435
+ return n === "compact" ? Vr : n === "preserve" ? Cr : n;
2436
+ }
2437
+ r(Be, "getJoiner");
2438
+ function Vr(n, s = v) {
2439
+ return n.map(({ tokens: { description: a } }) => a.trim()).filter((a) => a !== "").join(" ");
2440
+ }
2441
+ r(Vr, "compactJoiner");
2442
+ var Ur = /* @__PURE__ */ r((n, { tokens: s }, a) => s.type === "" ? n : a, "lineNo"), Br = /* @__PURE__ */ r(({ tokens: n }) => (n.delimiter ===
2443
+ "" ? n.start : n.postDelimiter.slice(1)) + n.description, "getDescription");
2444
+ function Cr(n, s = v) {
2445
+ if (n.length === 0)
463
2446
  return "";
464
- e[0].tokens.description === "" && e[0].tokens.delimiter === t.start && (e = e.slice(1));
465
- let r = e[e.length - 1];
466
- return r !== void 0 && r.tokens.description === "" && r.tokens.end.endsWith(t.end) && (e = e.slice(0, -1)), e = e.slice(e.reduce(qe, 0)), e.
467
- map(Ge).join(`
2447
+ n[0].tokens.description === "" && n[0].tokens.delimiter === s.start && (n = n.slice(1));
2448
+ let a = n[n.length - 1];
2449
+ return a !== void 0 && a.tokens.description === "" && a.tokens.end.endsWith(s.end) && (n = n.slice(0, -1)), n = n.slice(n.reduce(Ur, 0)), n.
2450
+ map(Br).join(`
468
2451
  `);
469
2452
  }
470
- o(Ke, "preserveJoiner");
2453
+ r(Cr, "preserveJoiner");
471
2454
 
472
2455
  // ../node_modules/comment-parser/es6/parser/index.js
473
- function M({ startLine: e = 0, fence: t = "```", spacing: r = "compact", markers: n = f, tokenizers: s = [
474
- O(),
475
- v(r),
476
- w(),
477
- E(r)
2456
+ function Ce({ startLine: n = 0, fence: s = "```", spacing: a = "compact", markers: p = v, tokenizers: c = [
2457
+ ie(),
2458
+ pe(a),
2459
+ ce(),
2460
+ le(a)
478
2461
  ] } = {}) {
479
- if (e < 0 || e % 1 > 0)
2462
+ if (n < 0 || n % 1 > 0)
480
2463
  throw new Error("Invalid startLine");
481
- let i = L({ startLine: e, markers: n }), p = I({ fence: t }), a = U({ tokenizers: s }), c = W(r);
482
- return function(u) {
483
- let m = [];
484
- for (let Oe of oe(u)) {
485
- let F = i(Oe);
486
- if (F === null)
2464
+ let u = Ve({ startLine: n, markers: p }), m = Le({ fence: s }), T = Ue({ tokenizers: c }), g = Be(a);
2465
+ return function(w) {
2466
+ let b = [];
2467
+ for (let fe of yt(w)) {
2468
+ let $ = u(fe);
2469
+ if ($ === null)
487
2470
  continue;
488
- let X = p(F), H = X.slice(1).map(a);
489
- m.push({
490
- description: c(X[0], n),
491
- tags: H,
492
- source: F,
493
- problems: H.reduce((ve, we) => ve.concat(we.problems), [])
2471
+ let E = m($), Q = E.slice(1).map(T);
2472
+ b.push({
2473
+ description: g(E[0], p),
2474
+ tags: Q,
2475
+ source: $,
2476
+ problems: Q.reduce((de, Te) => de.concat(Te.problems), [])
494
2477
  });
495
2478
  }
496
- return m;
2479
+ return b;
497
2480
  };
498
2481
  }
499
- o(M, "getParser");
2482
+ r(Ce, "getParser");
500
2483
 
501
2484
  // ../node_modules/comment-parser/es6/stringifier/index.js
502
- function Xe(e) {
503
- return e.start + e.delimiter + e.postDelimiter + e.tag + e.postTag + e.type + e.postType + e.name + e.postName + e.description + e.end + e.
2485
+ function Mr(n) {
2486
+ return n.start + n.delimiter + n.postDelimiter + n.tag + n.postTag + n.type + n.postType + n.name + n.postName + n.description + n.end + n.
504
2487
  lineEnd;
505
2488
  }
506
- o(Xe, "join");
507
- function z() {
508
- return (e) => e.source.map(({ tokens: t }) => Xe(t)).join(`
2489
+ r(Mr, "join");
2490
+ function Me() {
2491
+ return (n) => n.source.map(({ tokens: s }) => Mr(s)).join(`
509
2492
  `);
510
2493
  }
511
- o(z, "getStringifier");
2494
+ r(Me, "getStringifier");
512
2495
 
513
2496
  // ../node_modules/comment-parser/es6/stringifier/inspect.js
514
- var He = {
2497
+ var Kr = {
515
2498
  line: 0,
516
2499
  start: 0,
517
2500
  delimiter: 0,
@@ -526,398 +2509,409 @@ var He = {
526
2509
  end: 0,
527
2510
  lineEnd: 0
528
2511
  };
529
- var ro = Object.keys(He);
2512
+ var Zo = Object.keys(Kr);
530
2513
 
531
2514
  // ../node_modules/comment-parser/es6/index.js
532
- function se(e, t = {}) {
533
- return M(t)(e);
2515
+ function dt(n, s = {}) {
2516
+ return Ce(s)(n);
534
2517
  }
535
- o(se, "parse");
536
- var Oo = z();
2518
+ r(dt, "parse");
2519
+ var Js = Me();
537
2520
 
538
2521
  // src/docs-tools/argTypes/jsdocParser.ts
539
- var h = require("jsdoc-type-pratt-parser");
540
- function Qe(e) {
541
- return e != null && e.includes("@");
542
- }
543
- o(Qe, "containsJsDoc");
544
- function Ze(e) {
545
- let n = `/**
546
- ` + (e ?? "").split(`
547
- `).map((i) => ` * ${i}`).join(`
2522
+ var K = br(gt(), 1);
2523
+ function $r(n) {
2524
+ return n != null && n.includes("@");
2525
+ }
2526
+ r($r, "containsJsDoc");
2527
+ function qr(n) {
2528
+ let p = `/**
2529
+ ` + (n ?? "").split(`
2530
+ `).map((u) => ` * ${u}`).join(`
548
2531
  `) + `
549
- */`, s = se(n, {
2532
+ */`, c = dt(p, {
550
2533
  spacing: "preserve"
551
2534
  });
552
- if (!s || s.length === 0)
2535
+ if (!c || c.length === 0)
553
2536
  throw new Error("Cannot parse JSDoc tags.");
554
- return s[0];
2537
+ return c[0];
555
2538
  }
556
- o(Ze, "parse");
557
- var et = {
2539
+ r(qr, "parse");
2540
+ var Yr = {
558
2541
  tags: ["param", "arg", "argument", "returns", "ignore", "deprecated"]
559
- }, Y = /* @__PURE__ */ o((e, t = et) => {
560
- if (!Qe(e))
2542
+ }, $e = /* @__PURE__ */ r((n, s = Yr) => {
2543
+ if (!$r(n))
561
2544
  return {
562
2545
  includesJsDoc: !1,
563
2546
  ignore: !1
564
2547
  };
565
- let r = Ze(e), n = tt(r, t.tags);
566
- return n.ignore ? {
2548
+ let a = qr(n), p = Wr(a, s.tags);
2549
+ return p.ignore ? {
567
2550
  includesJsDoc: !0,
568
2551
  ignore: !0
569
2552
  } : {
570
2553
  includesJsDoc: !0,
571
2554
  ignore: !1,
572
2555
  // Always use the parsed description to ensure JSDoc is removed from the description.
573
- description: r.description.trim(),
574
- extractedTags: n
2556
+ description: a.description.trim(),
2557
+ extractedTags: p
575
2558
  };
576
2559
  }, "parseJsDoc");
577
- function tt(e, t) {
578
- let r = {
2560
+ function Wr(n, s) {
2561
+ let a = {
579
2562
  params: null,
580
2563
  deprecated: null,
581
2564
  returns: null,
582
2565
  ignore: !1
583
2566
  };
584
- for (let n of e.tags)
585
- if (!(t !== void 0 && !t.includes(n.tag)))
586
- if (n.tag === "ignore") {
587
- r.ignore = !0;
2567
+ for (let p of n.tags)
2568
+ if (!(s !== void 0 && !s.includes(p.tag)))
2569
+ if (p.tag === "ignore") {
2570
+ a.ignore = !0;
588
2571
  break;
589
2572
  } else
590
- switch (n.tag) {
2573
+ switch (p.tag) {
591
2574
  // arg & argument are aliases for param.
592
2575
  case "param":
593
2576
  case "arg":
594
2577
  case "argument": {
595
- let s = ot(n);
596
- s != null && (r.params == null && (r.params = []), r.params.push(s));
2578
+ let c = zr(p);
2579
+ c != null && (a.params == null && (a.params = []), a.params.push(c));
597
2580
  break;
598
2581
  }
599
2582
  case "deprecated": {
600
- let s = nt(n);
601
- s != null && (r.deprecated = s);
2583
+ let c = Xr(p);
2584
+ c != null && (a.deprecated = c);
602
2585
  break;
603
2586
  }
604
2587
  case "returns": {
605
- let s = st(n);
606
- s != null && (r.returns = s);
2588
+ let c = Hr(p);
2589
+ c != null && (a.returns = c);
607
2590
  break;
608
2591
  }
609
2592
  default:
610
2593
  break;
611
2594
  }
612
- return r;
2595
+ return a;
613
2596
  }
614
- o(tt, "extractJsDocTags");
615
- function rt(e) {
616
- return e.replace(/[\.-]$/, "");
2597
+ r(Wr, "extractJsDocTags");
2598
+ function Gr(n) {
2599
+ return n.replace(/[\.-]$/, "");
617
2600
  }
618
- o(rt, "normaliseParamName");
619
- function ot(e) {
620
- if (!e.name || e.name === "-")
2601
+ r(Gr, "normaliseParamName");
2602
+ function zr(n) {
2603
+ if (!n.name || n.name === "-")
621
2604
  return null;
622
- let t = ae(e.type);
2605
+ let s = Jt(n.type);
623
2606
  return {
624
- name: e.name,
625
- type: t,
626
- description: pe(e.description),
627
- getPrettyName: /* @__PURE__ */ o(() => rt(e.name), "getPrettyName"),
628
- getTypeName: /* @__PURE__ */ o(() => t ? ce(t) : null, "getTypeName")
2607
+ name: n.name,
2608
+ type: s,
2609
+ description: xt(n.description),
2610
+ getPrettyName: /* @__PURE__ */ r(() => Gr(n.name), "getPrettyName"),
2611
+ getTypeName: /* @__PURE__ */ r(() => s ? Pt(s) : null, "getTypeName")
629
2612
  };
630
2613
  }
631
- o(ot, "extractParam");
632
- function nt(e) {
633
- return e.name ? ie(e.name, e.description) : null;
634
- }
635
- o(nt, "extractDeprecated");
636
- function ie(e, t) {
637
- let r = e === "" ? t : `${e} ${t}`;
638
- return pe(r);
639
- }
640
- o(ie, "joinNameAndDescription");
641
- function pe(e) {
642
- let t = e.replace(/^- /g, "").trim();
643
- return t === "" ? null : t;
644
- }
645
- o(pe, "normaliseDescription");
646
- function st(e) {
647
- let t = ae(e.type);
648
- return t ? {
649
- type: t,
650
- description: ie(e.name, e.description),
651
- getTypeName: /* @__PURE__ */ o(() => ce(t), "getTypeName")
2614
+ r(zr, "extractParam");
2615
+ function Xr(n) {
2616
+ return n.name ? ht(n.name, n.description) : null;
2617
+ }
2618
+ r(Xr, "extractDeprecated");
2619
+ function ht(n, s) {
2620
+ let a = n === "" ? s : `${n} ${s}`;
2621
+ return xt(a);
2622
+ }
2623
+ r(ht, "joinNameAndDescription");
2624
+ function xt(n) {
2625
+ let s = n.replace(/^- /g, "").trim();
2626
+ return s === "" ? null : s;
2627
+ }
2628
+ r(xt, "normaliseDescription");
2629
+ function Hr(n) {
2630
+ let s = Jt(n.type);
2631
+ return s ? {
2632
+ type: s,
2633
+ description: ht(n.name, n.description),
2634
+ getTypeName: /* @__PURE__ */ r(() => Pt(s), "getTypeName")
652
2635
  } : null;
653
2636
  }
654
- o(st, "extractReturns");
655
- var g = (0, h.stringifyRules)(), it = g.JsdocTypeObject;
656
- g.JsdocTypeAny = () => "any";
657
- g.JsdocTypeObject = (e, t) => `(${it(e, t)})`;
658
- g.JsdocTypeOptional = (e, t) => t(e.element);
659
- g.JsdocTypeNullable = (e, t) => t(e.element);
660
- g.JsdocTypeNotNullable = (e, t) => t(e.element);
661
- g.JsdocTypeUnion = (e, t) => e.elements.map(t).join("|");
662
- function ae(e) {
2637
+ r(Hr, "extractReturns");
2638
+ var j = (0, K.stringifyRules)(), Qr = j.JsdocTypeObject;
2639
+ j.JsdocTypeAny = () => "any";
2640
+ j.JsdocTypeObject = (n, s) => `(${Qr(n, s)})`;
2641
+ j.JsdocTypeOptional = (n, s) => s(n.element);
2642
+ j.JsdocTypeNullable = (n, s) => s(n.element);
2643
+ j.JsdocTypeNotNullable = (n, s) => s(n.element);
2644
+ j.JsdocTypeUnion = (n, s) => n.elements.map(s).join("|");
2645
+ function Jt(n) {
663
2646
  try {
664
- return (0, h.parse)(e, "typescript");
2647
+ return (0, K.parse)(n, "typescript");
665
2648
  } catch {
666
2649
  return null;
667
2650
  }
668
2651
  }
669
- o(ae, "extractType");
670
- function ce(e) {
671
- return (0, h.transform)(g, e);
2652
+ r(Jt, "extractType");
2653
+ function Pt(n) {
2654
+ return (0, K.transform)(j, n);
672
2655
  }
673
- o(ce, "extractTypeName");
2656
+ r(Pt, "extractTypeName");
674
2657
 
675
2658
  // src/docs-tools/argTypes/utils.ts
676
- var pt = 90, at = 50;
677
- function j(e) {
678
- return e.length > 90;
2659
+ var Zr = 90, en = 50;
2660
+ function me(n) {
2661
+ return n.length > 90;
679
2662
  }
680
- o(j, "isTooLongForTypeSummary");
681
- function q(e) {
682
- return e.length > 50;
2663
+ r(me, "isTooLongForTypeSummary");
2664
+ function qe(n) {
2665
+ return n.length > 50;
683
2666
  }
684
- o(q, "isTooLongForDefaultValueSummary");
685
- function l(e, t) {
686
- return e === t ? { summary: e } : { summary: e, detail: t };
2667
+ r(qe, "isTooLongForDefaultValueSummary");
2668
+ function J(n, s) {
2669
+ return n === s ? { summary: n } : { summary: n, detail: s };
687
2670
  }
688
- o(l, "createSummaryValue");
689
- var ct = /* @__PURE__ */ o((e) => e.replace(/\\r\\n/g, "\\n"), "normalizeNewlines");
2671
+ r(J, "createSummaryValue");
2672
+ var tn = /* @__PURE__ */ r((n) => n.replace(/\\r\\n/g, "\\n"), "normalizeNewlines");
690
2673
 
691
2674
  // src/docs-tools/argTypes/docgen/flow/createDefaultValue.ts
692
- function le(e, t) {
693
- if (e != null) {
694
- let { value: r } = e;
695
- if (!d(r))
696
- return q(r) ? l(t?.name, r) : l(r);
2675
+ function wt(n, s) {
2676
+ if (n != null) {
2677
+ let { value: a } = n;
2678
+ if (!L(a))
2679
+ return qe(a) ? J(s?.name, a) : J(a);
697
2680
  }
698
2681
  return null;
699
2682
  }
700
- o(le, "createDefaultValue");
2683
+ r(wt, "createDefaultValue");
701
2684
 
702
2685
  // src/docs-tools/argTypes/docgen/flow/createType.ts
703
- function ue({ name: e, value: t, elements: r, raw: n }) {
704
- return t ?? (r != null ? r.map(ue).join(" | ") : n ?? e);
2686
+ function bt({ name: n, value: s, elements: a, raw: p }) {
2687
+ return s ?? (a != null ? a.map(bt).join(" | ") : p ?? n);
705
2688
  }
706
- o(ue, "generateUnionElement");
707
- function lt({ name: e, raw: t, elements: r }) {
708
- return r != null ? l(r.map(ue).join(" | ")) : t != null ? l(t.replace(/^\|\s*/, "")) : l(e);
2689
+ r(bt, "generateUnionElement");
2690
+ function rn({ name: n, raw: s, elements: a }) {
2691
+ return a != null ? J(a.map(bt).join(" | ")) : s != null ? J(s.replace(/^\|\s*/, "")) : J(n);
709
2692
  }
710
- o(lt, "generateUnion");
711
- function ut({ type: e, raw: t }) {
712
- return t != null ? l(t) : l(e);
2693
+ r(rn, "generateUnion");
2694
+ function nn({ type: n, raw: s }) {
2695
+ return s != null ? J(s) : J(n);
713
2696
  }
714
- o(ut, "generateFuncSignature");
715
- function mt({ type: e, raw: t }) {
716
- return t != null ? j(t) ? l(e, t) : l(t) : l(e);
2697
+ r(nn, "generateFuncSignature");
2698
+ function on({ type: n, raw: s }) {
2699
+ return s != null ? me(s) ? J(n, s) : J(s) : J(n);
717
2700
  }
718
- o(mt, "generateObjectSignature");
719
- function ft(e) {
720
- let { type: t } = e;
721
- return t === "object" ? mt(e) : ut(e);
2701
+ r(on, "generateObjectSignature");
2702
+ function sn(n) {
2703
+ let { type: s } = n;
2704
+ return s === "object" ? on(n) : nn(n);
722
2705
  }
723
- o(ft, "generateSignature");
724
- function yt({ name: e, raw: t }) {
725
- return t != null ? j(t) ? l(e, t) : l(t) : l(e);
2706
+ r(sn, "generateSignature");
2707
+ function an({ name: n, raw: s }) {
2708
+ return s != null ? me(s) ? J(n, s) : J(s) : J(n);
726
2709
  }
727
- o(yt, "generateDefault");
728
- function me(e) {
729
- if (e == null)
2710
+ r(an, "generateDefault");
2711
+ function Et(n) {
2712
+ if (n == null)
730
2713
  return null;
731
- switch (e.name) {
2714
+ switch (n.name) {
732
2715
  case "union":
733
- return lt(e);
2716
+ return rn(n);
734
2717
  case "signature":
735
- return ft(e);
2718
+ return sn(n);
736
2719
  default:
737
- return yt(e);
2720
+ return an(n);
738
2721
  }
739
2722
  }
740
- o(me, "createType");
2723
+ r(Et, "createType");
741
2724
 
742
2725
  // src/docs-tools/argTypes/docgen/flow/createPropDef.ts
743
- var fe = /* @__PURE__ */ o((e, t) => {
744
- let { flowType: r, description: n, required: s, defaultValue: i } = t;
2726
+ var St = /* @__PURE__ */ r((n, s) => {
2727
+ let { flowType: a, description: p, required: c, defaultValue: u } = s;
745
2728
  return {
746
- name: e,
747
- type: me(r),
748
- required: s,
749
- description: n,
750
- defaultValue: le(i ?? null, r ?? null)
2729
+ name: n,
2730
+ type: Et(a),
2731
+ required: c,
2732
+ description: p,
2733
+ defaultValue: wt(u ?? null, a ?? null)
751
2734
  };
752
2735
  }, "createFlowPropDef");
753
2736
 
754
2737
  // src/docs-tools/argTypes/docgen/typeScript/createDefaultValue.ts
755
- function ye({ defaultValue: e }) {
756
- if (e != null) {
757
- let { value: t } = e;
758
- if (!d(t))
759
- return l(t);
2738
+ function Nt({ defaultValue: n }) {
2739
+ if (n != null) {
2740
+ let { value: s } = n;
2741
+ if (!L(s))
2742
+ return J(s);
760
2743
  }
761
2744
  return null;
762
2745
  }
763
- o(ye, "createDefaultValue");
2746
+ r(Nt, "createDefaultValue");
764
2747
 
765
2748
  // src/docs-tools/argTypes/docgen/typeScript/createType.ts
766
- function ge({ tsType: e, required: t }) {
767
- if (e == null)
2749
+ function Ot({ tsType: n, required: s }) {
2750
+ if (n == null)
768
2751
  return null;
769
- let r = e.name;
770
- return t || (r = r.replace(" | undefined", "")), l(
771
- ["Array", "Record", "signature"].includes(e.name) ? e.raw : r
2752
+ let a = n.name;
2753
+ return s || (a = a.replace(" | undefined", "")), J(
2754
+ ["Array", "Record", "signature"].includes(n.name) ? n.raw : a
772
2755
  );
773
2756
  }
774
- o(ge, "createType");
2757
+ r(Ot, "createType");
775
2758
 
776
2759
  // src/docs-tools/argTypes/docgen/typeScript/createPropDef.ts
777
- var de = /* @__PURE__ */ o((e, t) => {
778
- let { description: r, required: n } = t;
2760
+ var Dt = /* @__PURE__ */ r((n, s) => {
2761
+ let { description: a, required: p } = s;
779
2762
  return {
780
- name: e,
781
- type: ge(t),
782
- required: n,
783
- description: r,
784
- defaultValue: ye(t)
2763
+ name: n,
2764
+ type: Ot(s),
2765
+ required: p,
2766
+ description: a,
2767
+ defaultValue: Nt(s)
785
2768
  };
786
2769
  }, "createTsPropDef");
787
2770
 
788
2771
  // src/docs-tools/argTypes/docgen/createPropDef.ts
789
- function gt(e) {
790
- return e != null ? l(e.name) : null;
791
- }
792
- o(gt, "createType");
793
- function dt(e) {
794
- let { computed: t, func: r } = e;
795
- return typeof t > "u" && typeof r > "u";
796
- }
797
- o(dt, "isReactDocgenTypescript");
798
- function xt(e) {
799
- return e ? e.name === "string" ? !0 : e.name === "enum" ? Array.isArray(e.value) && e.value.every(
800
- ({ value: t }) => typeof t == "string" && t[0] === '"' && t[t.length - 1] === '"'
2772
+ function pn(n) {
2773
+ return n != null ? J(n.name) : null;
2774
+ }
2775
+ r(pn, "createType");
2776
+ function cn(n) {
2777
+ let { computed: s, func: a } = n;
2778
+ return typeof s > "u" && typeof a > "u";
2779
+ }
2780
+ r(cn, "isReactDocgenTypescript");
2781
+ function ln(n) {
2782
+ return n ? n.name === "string" ? !0 : n.name === "enum" ? Array.isArray(n.value) && n.value.every(
2783
+ ({ value: s }) => typeof s == "string" && s[0] === '"' && s[s.length - 1] === '"'
801
2784
  ) : !1 : !1;
802
2785
  }
803
- o(xt, "isStringValued");
804
- function Dt(e, t) {
805
- if (e != null) {
806
- let { value: r } = e;
807
- if (!d(r))
808
- return dt(e) && xt(t) ? l(JSON.stringify(r)) : l(r);
2786
+ r(ln, "isStringValued");
2787
+ function un(n, s) {
2788
+ if (n != null) {
2789
+ let { value: a } = n;
2790
+ if (!L(a))
2791
+ return cn(n) && ln(s) ? J(JSON.stringify(a)) : J(a);
809
2792
  }
810
2793
  return null;
811
2794
  }
812
- o(Dt, "createDefaultValue");
813
- function xe(e, t, r) {
814
- let { description: n, required: s, defaultValue: i } = r;
2795
+ r(un, "createDefaultValue");
2796
+ function vt(n, s, a) {
2797
+ let { description: p, required: c, defaultValue: u } = a;
815
2798
  return {
816
- name: e,
817
- type: gt(t),
818
- required: s,
819
- description: n,
820
- defaultValue: Dt(i, t)
2799
+ name: n,
2800
+ type: pn(s),
2801
+ required: c,
2802
+ description: p,
2803
+ defaultValue: un(u, s)
821
2804
  };
822
2805
  }
823
- o(xe, "createBasicPropDef");
824
- function k(e, t) {
825
- if (t?.includesJsDoc) {
826
- let { description: r, extractedTags: n } = t;
827
- r != null && (e.description = t.description);
828
- let s = {
829
- ...n,
830
- params: n?.params?.map(
831
- (i) => ({
832
- name: i.getPrettyName(),
833
- description: i.description
2806
+ r(vt, "createBasicPropDef");
2807
+ function ye(n, s) {
2808
+ if (s?.includesJsDoc) {
2809
+ let { description: a, extractedTags: p } = s;
2810
+ a != null && (n.description = s.description);
2811
+ let c = {
2812
+ ...p,
2813
+ params: p?.params?.map(
2814
+ (u) => ({
2815
+ name: u.getPrettyName(),
2816
+ description: u.description
834
2817
  })
835
2818
  )
836
2819
  };
837
- Object.values(s).filter(Boolean).length > 0 && (e.jsDocTags = s);
2820
+ Object.values(c).filter(Boolean).length > 0 && (n.jsDocTags = c);
838
2821
  }
839
- return e;
840
- }
841
- o(k, "applyJsDocResult");
842
- var Tt = /* @__PURE__ */ o((e, t, r) => {
843
- let n = xe(e, t.type, t);
844
- return n.sbType = b(t), k(n, r);
845
- }, "javaScriptFactory"), ht = /* @__PURE__ */ o((e, t, r) => {
846
- let n = de(e, t);
847
- return n.sbType = b(t), k(n, r);
848
- }, "tsFactory"), bt = /* @__PURE__ */ o((e, t, r) => {
849
- let n = fe(e, t);
850
- return n.sbType = b(t), k(n, r);
851
- }, "flowFactory"), Pt = /* @__PURE__ */ o((e, t, r) => {
852
- let n = xe(e, { name: "unknown" }, t);
853
- return k(n, r);
854
- }, "unknownFactory"), G = /* @__PURE__ */ o((e) => {
855
- switch (e) {
2822
+ return n;
2823
+ }
2824
+ r(ye, "applyJsDocResult");
2825
+ var mn = /* @__PURE__ */ r((n, s, a) => {
2826
+ let p = vt(n, s.type, s);
2827
+ return p.sbType = H(s), ye(p, a);
2828
+ }, "javaScriptFactory"), yn = /* @__PURE__ */ r((n, s, a) => {
2829
+ let p = Dt(n, s);
2830
+ return p.sbType = H(s), ye(p, a);
2831
+ }, "tsFactory"), fn = /* @__PURE__ */ r((n, s, a) => {
2832
+ let p = St(n, s);
2833
+ return p.sbType = H(s), ye(p, a);
2834
+ }, "flowFactory"), dn = /* @__PURE__ */ r((n, s, a) => {
2835
+ let p = vt(n, { name: "unknown" }, s);
2836
+ return ye(p, a);
2837
+ }, "unknownFactory"), Ye = /* @__PURE__ */ r((n) => {
2838
+ switch (n) {
856
2839
  case "JavaScript":
857
- return Tt;
2840
+ return mn;
858
2841
  case "TypeScript":
859
- return ht;
2842
+ return yn;
860
2843
  case "Flow":
861
- return bt;
2844
+ return fn;
862
2845
  default:
863
- return Pt;
2846
+ return dn;
864
2847
  }
865
2848
  }, "getPropDefFactory");
866
2849
 
867
2850
  // src/docs-tools/argTypes/docgen/extractDocgenProps.ts
868
- var De = /* @__PURE__ */ o((e) => e.type != null ? "JavaScript" : e.flowType != null ? "Flow" : e.tsType != null ? "TypeScript" : "Unknown",
869
- "getTypeSystem"), Te = /* @__PURE__ */ o((e) => {
870
- let t = De(e[0]), r = G(t);
871
- return e.map((n) => {
872
- let s = n;
873
- return n.type?.elements && (s = {
874
- ...n,
2851
+ var kt = /* @__PURE__ */ r((n) => n.type != null ? "JavaScript" : n.flowType != null ? "Flow" : n.tsType != null ? "TypeScript" : "Unknown",
2852
+ "getTypeSystem"), At = /* @__PURE__ */ r((n) => {
2853
+ let s = kt(n[0]), a = Ye(s);
2854
+ return n.map((p) => {
2855
+ let c = p;
2856
+ return p.type?.elements && (c = {
2857
+ ...p,
875
2858
  type: {
876
- ...n.type,
877
- value: n.type.elements
2859
+ ...p.type,
2860
+ value: p.type.elements
878
2861
  }
879
- }), be(s.name, s, t, r);
2862
+ }), It(c.name, c, s, a);
880
2863
  });
881
- }, "extractComponentSectionArray"), he = /* @__PURE__ */ o((e) => {
882
- let t = Object.keys(e), r = De(e[t[0]]), n = G(r);
883
- return t.map((s) => {
884
- let i = e[s];
885
- return i != null ? be(s, i, r, n) : null;
2864
+ }, "extractComponentSectionArray"), Rt = /* @__PURE__ */ r((n) => {
2865
+ let s = Object.keys(n), a = kt(n[s[0]]), p = Ye(a);
2866
+ return s.map((c) => {
2867
+ let u = n[c];
2868
+ return u != null ? It(c, u, a, p) : null;
886
2869
  }).filter(Boolean);
887
- }, "extractComponentSectionObject"), St = /* @__PURE__ */ o((e, t) => {
888
- let r = V(e, t);
889
- return A(r) ? Array.isArray(r) ? Te(r) : he(r) : [];
2870
+ }, "extractComponentSectionObject"), Tn = /* @__PURE__ */ r((n, s) => {
2871
+ let a = Ie(n, s);
2872
+ return Re(a) ? Array.isArray(a) ? At(a) : Rt(a) : [];
890
2873
  }, "extractComponentProps");
891
- function be(e, t, r, n) {
892
- let s = Y(t.description);
893
- return s.includesJsDoc && s.ignore ? null : {
894
- propDef: n(e, t, s),
895
- jsDocTags: s.extractedTags,
896
- docgenInfo: t,
897
- typeSystem: r
2874
+ function It(n, s, a, p) {
2875
+ let c = $e(s.description);
2876
+ return c.includesJsDoc && c.ignore ? null : {
2877
+ propDef: p(n, s, c),
2878
+ jsDocTags: c.extractedTags,
2879
+ docgenInfo: s,
2880
+ typeSystem: a
898
2881
  };
899
2882
  }
900
- o(be, "extractProp");
901
- function Ot(e) {
902
- return e != null ? C(e) : "";
2883
+ r(It, "extractProp");
2884
+ function gn(n) {
2885
+ return n != null ? Fe(n) : "";
903
2886
  }
904
- o(Ot, "extractComponentDescription");
2887
+ r(gn, "extractComponentDescription");
2888
+
2889
+ // src/preview-api/modules/store/parameters.ts
2890
+ var We = /* @__PURE__ */ r((...n) => {
2891
+ let s = {}, a = n.filter(Boolean), p = a.reduce((c, u) => (Object.entries(u).forEach(([m, T]) => {
2892
+ let g = c[m];
2893
+ Array.isArray(T) || typeof g > "u" ? c[m] = T : X(T) && X(g) ? s[m] = !0 : typeof T < "u" && (c[m] = T);
2894
+ }), c), {});
2895
+ return Object.keys(s).forEach((c) => {
2896
+ let u = a.filter(Boolean).map((m) => m[c]).filter((m) => typeof m < "u");
2897
+ u.every((m) => X(m)) ? p[c] = We(...u) : p[c] = u[u.length - 1];
2898
+ }), p;
2899
+ }, "combineParameters");
905
2900
 
906
2901
  // src/docs-tools/argTypes/enhanceArgTypes.ts
907
- var Pe = require("storybook/internal/preview-api");
908
- var vt = /* @__PURE__ */ o((e) => {
2902
+ var hn = /* @__PURE__ */ r((n) => {
909
2903
  let {
910
- component: t,
911
- argTypes: r,
912
- parameters: { docs: n = {} }
913
- } = e, { extractArgTypes: s } = n, i = s && t ? s(t) : {};
914
- return i ? (0, Pe.combineParameters)(i, r) : r;
2904
+ component: s,
2905
+ argTypes: a,
2906
+ parameters: { docs: p = {} }
2907
+ } = n, { extractArgTypes: c } = p, u = c && s ? c(s) : {};
2908
+ return u ? We(u, a) : a;
915
2909
  }, "enhanceArgTypes");
916
2910
 
917
2911
  // src/docs-tools/shared.ts
918
- var K = "storybook/docs", wt = `${K}/panel`, Et = "docs", jt = `${K}/snippet-rendered`, Se = /* @__PURE__ */ ((n) => (n.AUTO = "auto", n.CODE =
919
- "code", n.DYNAMIC = "dynamic", n))(Se || {});
2912
+ var Ge = "storybook/docs", xn = `${Ge}/panel`, Jn = "docs", Pn = `${Ge}/snippet-rendered`, Ft = /* @__PURE__ */ ((p) => (p.AUTO = "auto", p.
2913
+ CODE = "code", p.DYNAMIC = "dynamic", p))(Ft || {});
920
2914
 
921
2915
  // src/docs-tools/hasDocsOrControls.ts
922
- var kt = /(addons\/|addon-|addon-essentials\/)(docs|controls)/, Ft = /* @__PURE__ */ o((e) => e.presetsList?.some((t) => kt.test(t.name)), "\
2916
+ var wn = /(addons\/|addon-|addon-essentials\/)(docs|controls)/, bn = /* @__PURE__ */ r((n) => n.presetsList?.some((s) => wn.test(s.name)), "\
923
2917
  hasDocsOrControls");