vitest-browser-qwik 0.3.4 → 0.3.5

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.
package/dist/index.js CHANGED
@@ -1,7 +1,2874 @@
1
- import { i as renderServerHTML, n as render, r as renderHook, t as cleanup } from "./pure-BlLa_nxU.js";
2
- import { beforeEach } from "vitest";
3
- import { page } from "vitest/browser";
1
+ import { a as page, i as renderServerHTML, n as render, r as renderHook, t as cleanup } from "./pure-CBOslZ8E.js";
4
2
 
3
+ //#region node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.js
4
+ var d = {
5
+ reset: [0, 0],
6
+ bold: [
7
+ 1,
8
+ 22,
9
+ "\x1B[22m\x1B[1m"
10
+ ],
11
+ dim: [
12
+ 2,
13
+ 22,
14
+ "\x1B[22m\x1B[2m"
15
+ ],
16
+ italic: [3, 23],
17
+ underline: [4, 24],
18
+ inverse: [7, 27],
19
+ hidden: [8, 28],
20
+ strikethrough: [9, 29],
21
+ black: [30, 39],
22
+ red: [31, 39],
23
+ green: [32, 39],
24
+ yellow: [33, 39],
25
+ blue: [34, 39],
26
+ magenta: [35, 39],
27
+ cyan: [36, 39],
28
+ white: [37, 39],
29
+ gray: [90, 39],
30
+ bgBlack: [40, 49],
31
+ bgRed: [41, 49],
32
+ bgGreen: [42, 49],
33
+ bgYellow: [43, 49],
34
+ bgBlue: [44, 49],
35
+ bgMagenta: [45, 49],
36
+ bgCyan: [46, 49],
37
+ bgWhite: [47, 49],
38
+ blackBright: [90, 39],
39
+ redBright: [91, 39],
40
+ greenBright: [92, 39],
41
+ yellowBright: [93, 39],
42
+ blueBright: [94, 39],
43
+ magentaBright: [95, 39],
44
+ cyanBright: [96, 39],
45
+ whiteBright: [97, 39],
46
+ bgBlackBright: [100, 49],
47
+ bgRedBright: [101, 49],
48
+ bgGreenBright: [102, 49],
49
+ bgYellowBright: [103, 49],
50
+ bgBlueBright: [104, 49],
51
+ bgMagentaBright: [105, 49],
52
+ bgCyanBright: [106, 49],
53
+ bgWhiteBright: [107, 49]
54
+ };
55
+ function g(e) {
56
+ return String(e);
57
+ }
58
+ g.open = "";
59
+ g.close = "";
60
+ function h() {
61
+ let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
62
+ return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
63
+ }
64
+ function f() {
65
+ let e = h(), n = (r, t, u, o) => {
66
+ let l = "", s = 0;
67
+ do
68
+ l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
69
+ while (~o);
70
+ return l + r.substring(s);
71
+ }, a = (r, t, u = r) => {
72
+ let o = (l) => {
73
+ let s = String(l), b = s.indexOf(t, r.length);
74
+ return ~b ? r + n(s, t, u, b) + t : r + s + t;
75
+ };
76
+ return o.open = r, o.close = t, o;
77
+ }, i = { isColorSupported: e }, c = (r) => `\x1B[${r}m`;
78
+ for (let r in d) {
79
+ let t = d[r];
80
+ i[r] = e ? a(c(t[0]), c(t[1]), t[2]) : g;
81
+ }
82
+ return i;
83
+ }
84
+ var C = f();
85
+
86
+ //#endregion
87
+ //#region node_modules/.pnpm/@vitest+pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.js
88
+ function _mergeNamespaces(n, m) {
89
+ m.forEach(function(e) {
90
+ e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
91
+ if (k !== "default" && !(k in n)) {
92
+ var d$1 = Object.getOwnPropertyDescriptor(e, k);
93
+ Object.defineProperty(n, k, d$1.get ? d$1 : {
94
+ enumerable: true,
95
+ get: function() {
96
+ return e[k];
97
+ }
98
+ });
99
+ }
100
+ });
101
+ });
102
+ return Object.freeze(n);
103
+ }
104
+ function getKeysOfEnumerableProperties(object, compareKeys) {
105
+ const rawKeys = Object.keys(object);
106
+ const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
107
+ if (Object.getOwnPropertySymbols) {
108
+ for (const symbol of Object.getOwnPropertySymbols(object)) if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) keys.push(symbol);
109
+ }
110
+ return keys;
111
+ }
112
+ /**
113
+ * Return entries (for example, of a map)
114
+ * with spacing, indentation, and comma
115
+ * without surrounding punctuation (for example, braces)
116
+ */
117
+ function printIteratorEntries(iterator, config, indentation, depth, refs, printer$1, separator = ": ") {
118
+ let result = "";
119
+ let width = 0;
120
+ let current = iterator.next();
121
+ if (!current.done) {
122
+ result += config.spacingOuter;
123
+ const indentationNext = indentation + config.indent;
124
+ while (!current.done) {
125
+ result += indentationNext;
126
+ if (width++ === config.maxWidth) {
127
+ result += "…";
128
+ break;
129
+ }
130
+ const name = printer$1(current.value[0], config, indentationNext, depth, refs);
131
+ const value = printer$1(current.value[1], config, indentationNext, depth, refs);
132
+ result += name + separator + value;
133
+ current = iterator.next();
134
+ if (!current.done) result += `,${config.spacingInner}`;
135
+ else if (!config.min) result += ",";
136
+ }
137
+ result += config.spacingOuter + indentation;
138
+ }
139
+ return result;
140
+ }
141
+ /**
142
+ * Return values (for example, of a set)
143
+ * with spacing, indentation, and comma
144
+ * without surrounding punctuation (braces or brackets)
145
+ */
146
+ function printIteratorValues(iterator, config, indentation, depth, refs, printer$1) {
147
+ let result = "";
148
+ let width = 0;
149
+ let current = iterator.next();
150
+ if (!current.done) {
151
+ result += config.spacingOuter;
152
+ const indentationNext = indentation + config.indent;
153
+ while (!current.done) {
154
+ result += indentationNext;
155
+ if (width++ === config.maxWidth) {
156
+ result += "…";
157
+ break;
158
+ }
159
+ result += printer$1(current.value, config, indentationNext, depth, refs);
160
+ current = iterator.next();
161
+ if (!current.done) result += `,${config.spacingInner}`;
162
+ else if (!config.min) result += ",";
163
+ }
164
+ result += config.spacingOuter + indentation;
165
+ }
166
+ return result;
167
+ }
168
+ /**
169
+ * Return items (for example, of an array)
170
+ * with spacing, indentation, and comma
171
+ * without surrounding punctuation (for example, brackets)
172
+ */
173
+ function printListItems(list, config, indentation, depth, refs, printer$1) {
174
+ let result = "";
175
+ list = list instanceof ArrayBuffer ? new DataView(list) : list;
176
+ const isDataView = (l) => l instanceof DataView;
177
+ const length = isDataView(list) ? list.byteLength : list.length;
178
+ if (length > 0) {
179
+ result += config.spacingOuter;
180
+ const indentationNext = indentation + config.indent;
181
+ for (let i = 0; i < length; i++) {
182
+ result += indentationNext;
183
+ if (i === config.maxWidth) {
184
+ result += "…";
185
+ break;
186
+ }
187
+ if (isDataView(list) || i in list) result += printer$1(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
188
+ if (i < length - 1) result += `,${config.spacingInner}`;
189
+ else if (!config.min) result += ",";
190
+ }
191
+ result += config.spacingOuter + indentation;
192
+ }
193
+ return result;
194
+ }
195
+ /**
196
+ * Return properties of an object
197
+ * with spacing, indentation, and comma
198
+ * without surrounding punctuation (for example, braces)
199
+ */
200
+ function printObjectProperties(val, config, indentation, depth, refs, printer$1) {
201
+ let result = "";
202
+ const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
203
+ if (keys.length > 0) {
204
+ result += config.spacingOuter;
205
+ const indentationNext = indentation + config.indent;
206
+ for (let i = 0; i < keys.length; i++) {
207
+ const key = keys[i];
208
+ const name = printer$1(key, config, indentationNext, depth, refs);
209
+ const value = printer$1(val[key], config, indentationNext, depth, refs);
210
+ result += `${indentationNext + name}: ${value}`;
211
+ if (i < keys.length - 1) result += `,${config.spacingInner}`;
212
+ else if (!config.min) result += ",";
213
+ }
214
+ result += config.spacingOuter + indentation;
215
+ }
216
+ return result;
217
+ }
218
+ const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
219
+ const SPACE$2 = " ";
220
+ const serialize$5 = (val, config, indentation, depth, refs, printer$1) => {
221
+ const stringedValue = val.toString();
222
+ if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
223
+ if (++depth > config.maxDepth) return `[${stringedValue}]`;
224
+ return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer$1)}]`;
225
+ }
226
+ if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
227
+ if (++depth > config.maxDepth) return `[${stringedValue}]`;
228
+ return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer$1)}}`;
229
+ }
230
+ if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") return stringedValue + SPACE$2 + printer$1(val.sample, config, indentation, depth, refs);
231
+ if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") return stringedValue + SPACE$2 + printer$1(val.sample, config, indentation, depth, refs);
232
+ if (typeof val.toAsymmetricMatcher !== "function") throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
233
+ return val.toAsymmetricMatcher();
234
+ };
235
+ const test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
236
+ const plugin$5 = {
237
+ serialize: serialize$5,
238
+ test: test$5
239
+ };
240
+ const SPACE$1 = " ";
241
+ const OBJECT_NAMES = new Set(["DOMStringMap", "NamedNodeMap"]);
242
+ const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
243
+ function testName(name) {
244
+ return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
245
+ }
246
+ const test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
247
+ function isNamedNodeMap(collection) {
248
+ return collection.constructor.name === "NamedNodeMap";
249
+ }
250
+ const serialize$4 = (collection, config, indentation, depth, refs, printer$1) => {
251
+ const name = collection.constructor.name;
252
+ if (++depth > config.maxDepth) return `[${name}]`;
253
+ return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
254
+ props[attribute.name] = attribute.value;
255
+ return props;
256
+ }, {}) : { ...collection }, config, indentation, depth, refs, printer$1)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer$1)}]`);
257
+ };
258
+ const plugin$4 = {
259
+ serialize: serialize$4,
260
+ test: test$4
261
+ };
262
+ /**
263
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
264
+ *
265
+ * This source code is licensed under the MIT license found in the
266
+ * LICENSE file in the root directory of this source tree.
267
+ */
268
+ function escapeHTML(str) {
269
+ return str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
270
+ }
271
+ function printProps(keys, props, config, indentation, depth, refs, printer$1) {
272
+ const indentationNext = indentation + config.indent;
273
+ const colors = config.colors;
274
+ return keys.map((key) => {
275
+ const value = props[key];
276
+ if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) return "";
277
+ let printed = printer$1(value, config, indentationNext, depth, refs);
278
+ if (typeof value !== "string") {
279
+ if (printed.includes("\n")) printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
280
+ printed = `{${printed}}`;
281
+ }
282
+ return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
283
+ }).join("");
284
+ }
285
+ function printChildren(children, config, indentation, depth, refs, printer$1) {
286
+ return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer$1(child, config, indentation, depth, refs))).join("");
287
+ }
288
+ function printShadowRoot(children, config, indentation, depth, refs, printer$1) {
289
+ if (config.printShadowRoot === false) return "";
290
+ return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer$1)].join("");
291
+ }
292
+ function printText(text, config) {
293
+ const contentColor = config.colors.content;
294
+ return contentColor.open + escapeHTML(text) + contentColor.close;
295
+ }
296
+ function printComment(comment, config) {
297
+ const commentColor = config.colors.comment;
298
+ return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
299
+ }
300
+ function printElement(type, printedProps, printedChildren, config, indentation) {
301
+ const tagColor = config.colors.tag;
302
+ return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
303
+ }
304
+ function printElementAsLeaf(type, config) {
305
+ const tagColor = config.colors.tag;
306
+ return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`;
307
+ }
308
+ const ELEMENT_NODE = 1;
309
+ const TEXT_NODE = 3;
310
+ const COMMENT_NODE = 8;
311
+ const FRAGMENT_NODE = 11;
312
+ const ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
313
+ function testHasAttribute(val) {
314
+ try {
315
+ return typeof val.hasAttribute === "function" && val.hasAttribute("is");
316
+ } catch {
317
+ return false;
318
+ }
319
+ }
320
+ function testNode(val) {
321
+ const constructorName = val.constructor.name;
322
+ const { nodeType, tagName } = val;
323
+ const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
324
+ return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
325
+ }
326
+ const test$3 = (val) => val?.constructor?.name && testNode(val);
327
+ function nodeIsText(node) {
328
+ return node.nodeType === TEXT_NODE;
329
+ }
330
+ function nodeIsComment(node) {
331
+ return node.nodeType === COMMENT_NODE;
332
+ }
333
+ function nodeIsFragment(node) {
334
+ return node.nodeType === FRAGMENT_NODE;
335
+ }
336
+ const serialize$3 = (node, config, indentation, depth, refs, printer$1) => {
337
+ if (nodeIsText(node)) return printText(node.data, config);
338
+ if (nodeIsComment(node)) return printComment(node.data, config);
339
+ const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
340
+ if (++depth > config.maxDepth) return printElementAsLeaf(type, config);
341
+ return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
342
+ props[attribute.name] = attribute.value;
343
+ return props;
344
+ }, {}), config, indentation + config.indent, depth, refs, printer$1), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer$1)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer$1), config, indentation);
345
+ };
346
+ const plugin$3 = {
347
+ serialize: serialize$3,
348
+ test: test$3
349
+ };
350
+ const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
351
+ const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
352
+ const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
353
+ const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
354
+ const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
355
+ const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
356
+ const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
357
+ const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
358
+ const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
359
+ const getImmutableName = (name) => `Immutable.${name}`;
360
+ const printAsLeaf = (name) => `[${name}]`;
361
+ const SPACE = " ";
362
+ const LAZY = "…";
363
+ function printImmutableEntries(val, config, indentation, depth, refs, printer$1, type) {
364
+ return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer$1)}}`;
365
+ }
366
+ function getRecordEntries(val) {
367
+ let i = 0;
368
+ return { next() {
369
+ if (i < val._keys.length) {
370
+ const key = val._keys[i++];
371
+ return {
372
+ done: false,
373
+ value: [key, val.get(key)]
374
+ };
375
+ }
376
+ return {
377
+ done: true,
378
+ value: void 0
379
+ };
380
+ } };
381
+ }
382
+ function printImmutableRecord(val, config, indentation, depth, refs, printer$1) {
383
+ const name = getImmutableName(val._name || "Record");
384
+ return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer$1)}}`;
385
+ }
386
+ function printImmutableSeq(val, config, indentation, depth, refs, printer$1) {
387
+ const name = getImmutableName("Seq");
388
+ if (++depth > config.maxDepth) return printAsLeaf(name);
389
+ if (val[IS_KEYED_SENTINEL]) return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer$1) : LAZY}}`;
390
+ return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer$1) : LAZY}]`;
391
+ }
392
+ function printImmutableValues(val, config, indentation, depth, refs, printer$1, type) {
393
+ return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer$1)}]`;
394
+ }
395
+ const serialize$2 = (val, config, indentation, depth, refs, printer$1) => {
396
+ if (val[IS_MAP_SENTINEL]) return printImmutableEntries(val, config, indentation, depth, refs, printer$1, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
397
+ if (val[IS_LIST_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer$1, "List");
398
+ if (val[IS_SET_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer$1, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
399
+ if (val[IS_STACK_SENTINEL]) return printImmutableValues(val, config, indentation, depth, refs, printer$1, "Stack");
400
+ if (val[IS_SEQ_SENTINEL]) return printImmutableSeq(val, config, indentation, depth, refs, printer$1);
401
+ return printImmutableRecord(val, config, indentation, depth, refs, printer$1);
402
+ };
403
+ const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
404
+ const plugin$2 = {
405
+ serialize: serialize$2,
406
+ test: test$2
407
+ };
408
+ function getDefaultExportFromCjs(x) {
409
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
410
+ }
411
+ var reactIs$1 = { exports: {} };
412
+ var reactIs_production = {};
413
+ /**
414
+ * @license React
415
+ * react-is.production.js
416
+ *
417
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
418
+ *
419
+ * This source code is licensed under the MIT license found in the
420
+ * LICENSE file in the root directory of this source tree.
421
+ */
422
+ var hasRequiredReactIs_production;
423
+ function requireReactIs_production() {
424
+ if (hasRequiredReactIs_production) return reactIs_production;
425
+ hasRequiredReactIs_production = 1;
426
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
427
+ function typeOf(object) {
428
+ if ("object" === typeof object && null !== object) {
429
+ var $$typeof = object.$$typeof;
430
+ switch ($$typeof) {
431
+ case REACT_ELEMENT_TYPE: switch (object = object.type, object) {
432
+ case REACT_FRAGMENT_TYPE:
433
+ case REACT_PROFILER_TYPE:
434
+ case REACT_STRICT_MODE_TYPE:
435
+ case REACT_SUSPENSE_TYPE:
436
+ case REACT_SUSPENSE_LIST_TYPE:
437
+ case REACT_VIEW_TRANSITION_TYPE: return object;
438
+ default: switch (object = object && object.$$typeof, object) {
439
+ case REACT_CONTEXT_TYPE:
440
+ case REACT_FORWARD_REF_TYPE:
441
+ case REACT_LAZY_TYPE:
442
+ case REACT_MEMO_TYPE: return object;
443
+ case REACT_CONSUMER_TYPE: return object;
444
+ default: return $$typeof;
445
+ }
446
+ }
447
+ case REACT_PORTAL_TYPE: return $$typeof;
448
+ }
449
+ }
450
+ }
451
+ reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
452
+ reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
453
+ reactIs_production.Element = REACT_ELEMENT_TYPE;
454
+ reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
455
+ reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
456
+ reactIs_production.Lazy = REACT_LAZY_TYPE;
457
+ reactIs_production.Memo = REACT_MEMO_TYPE;
458
+ reactIs_production.Portal = REACT_PORTAL_TYPE;
459
+ reactIs_production.Profiler = REACT_PROFILER_TYPE;
460
+ reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
461
+ reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
462
+ reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
463
+ reactIs_production.isContextConsumer = function(object) {
464
+ return typeOf(object) === REACT_CONSUMER_TYPE;
465
+ };
466
+ reactIs_production.isContextProvider = function(object) {
467
+ return typeOf(object) === REACT_CONTEXT_TYPE;
468
+ };
469
+ reactIs_production.isElement = function(object) {
470
+ return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
471
+ };
472
+ reactIs_production.isForwardRef = function(object) {
473
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
474
+ };
475
+ reactIs_production.isFragment = function(object) {
476
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
477
+ };
478
+ reactIs_production.isLazy = function(object) {
479
+ return typeOf(object) === REACT_LAZY_TYPE;
480
+ };
481
+ reactIs_production.isMemo = function(object) {
482
+ return typeOf(object) === REACT_MEMO_TYPE;
483
+ };
484
+ reactIs_production.isPortal = function(object) {
485
+ return typeOf(object) === REACT_PORTAL_TYPE;
486
+ };
487
+ reactIs_production.isProfiler = function(object) {
488
+ return typeOf(object) === REACT_PROFILER_TYPE;
489
+ };
490
+ reactIs_production.isStrictMode = function(object) {
491
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
492
+ };
493
+ reactIs_production.isSuspense = function(object) {
494
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
495
+ };
496
+ reactIs_production.isSuspenseList = function(object) {
497
+ return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
498
+ };
499
+ reactIs_production.isValidElementType = function(type) {
500
+ return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
501
+ };
502
+ reactIs_production.typeOf = typeOf;
503
+ return reactIs_production;
504
+ }
505
+ var hasRequiredReactIs$1;
506
+ function requireReactIs$1() {
507
+ if (hasRequiredReactIs$1) return reactIs$1.exports;
508
+ hasRequiredReactIs$1 = 1;
509
+ reactIs$1.exports = requireReactIs_production();
510
+ return reactIs$1.exports;
511
+ }
512
+ var reactIsExports$1 = requireReactIs$1();
513
+ var ReactIs19 = /* @__PURE__ */ _mergeNamespaces({
514
+ __proto__: null,
515
+ default: /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports$1)
516
+ }, [reactIsExports$1]);
517
+ var reactIs = { exports: {} };
518
+ var reactIs_production_min = {};
519
+ /**
520
+ * @license React
521
+ * react-is.production.min.js
522
+ *
523
+ * Copyright (c) Facebook, Inc. and its affiliates.
524
+ *
525
+ * This source code is licensed under the MIT license found in the
526
+ * LICENSE file in the root directory of this source tree.
527
+ */
528
+ var hasRequiredReactIs_production_min;
529
+ function requireReactIs_production_min() {
530
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
531
+ hasRequiredReactIs_production_min = 1;
532
+ var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d$1 = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f$1 = Symbol.for("react.profiler"), g$1 = Symbol.for("react.provider"), h$1 = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u = Symbol.for("react.module.reference");
533
+ function v(a) {
534
+ if ("object" === typeof a && null !== a) {
535
+ var r = a.$$typeof;
536
+ switch (r) {
537
+ case b: switch (a = a.type, a) {
538
+ case d$1:
539
+ case f$1:
540
+ case e:
541
+ case m:
542
+ case n: return a;
543
+ default: switch (a = a && a.$$typeof, a) {
544
+ case k:
545
+ case h$1:
546
+ case l:
547
+ case q:
548
+ case p:
549
+ case g$1: return a;
550
+ default: return r;
551
+ }
552
+ }
553
+ case c: return r;
554
+ }
555
+ }
556
+ }
557
+ reactIs_production_min.ContextConsumer = h$1;
558
+ reactIs_production_min.ContextProvider = g$1;
559
+ reactIs_production_min.Element = b;
560
+ reactIs_production_min.ForwardRef = l;
561
+ reactIs_production_min.Fragment = d$1;
562
+ reactIs_production_min.Lazy = q;
563
+ reactIs_production_min.Memo = p;
564
+ reactIs_production_min.Portal = c;
565
+ reactIs_production_min.Profiler = f$1;
566
+ reactIs_production_min.StrictMode = e;
567
+ reactIs_production_min.Suspense = m;
568
+ reactIs_production_min.SuspenseList = n;
569
+ reactIs_production_min.isAsyncMode = function() {
570
+ return false;
571
+ };
572
+ reactIs_production_min.isConcurrentMode = function() {
573
+ return false;
574
+ };
575
+ reactIs_production_min.isContextConsumer = function(a) {
576
+ return v(a) === h$1;
577
+ };
578
+ reactIs_production_min.isContextProvider = function(a) {
579
+ return v(a) === g$1;
580
+ };
581
+ reactIs_production_min.isElement = function(a) {
582
+ return "object" === typeof a && null !== a && a.$$typeof === b;
583
+ };
584
+ reactIs_production_min.isForwardRef = function(a) {
585
+ return v(a) === l;
586
+ };
587
+ reactIs_production_min.isFragment = function(a) {
588
+ return v(a) === d$1;
589
+ };
590
+ reactIs_production_min.isLazy = function(a) {
591
+ return v(a) === q;
592
+ };
593
+ reactIs_production_min.isMemo = function(a) {
594
+ return v(a) === p;
595
+ };
596
+ reactIs_production_min.isPortal = function(a) {
597
+ return v(a) === c;
598
+ };
599
+ reactIs_production_min.isProfiler = function(a) {
600
+ return v(a) === f$1;
601
+ };
602
+ reactIs_production_min.isStrictMode = function(a) {
603
+ return v(a) === e;
604
+ };
605
+ reactIs_production_min.isSuspense = function(a) {
606
+ return v(a) === m;
607
+ };
608
+ reactIs_production_min.isSuspenseList = function(a) {
609
+ return v(a) === n;
610
+ };
611
+ reactIs_production_min.isValidElementType = function(a) {
612
+ return "string" === typeof a || "function" === typeof a || a === d$1 || a === f$1 || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g$1 || a.$$typeof === h$1 || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
613
+ };
614
+ reactIs_production_min.typeOf = v;
615
+ return reactIs_production_min;
616
+ }
617
+ var hasRequiredReactIs;
618
+ function requireReactIs() {
619
+ if (hasRequiredReactIs) return reactIs.exports;
620
+ hasRequiredReactIs = 1;
621
+ reactIs.exports = requireReactIs_production_min();
622
+ return reactIs.exports;
623
+ }
624
+ var reactIsExports = requireReactIs();
625
+ var ReactIs18 = /* @__PURE__ */ _mergeNamespaces({
626
+ __proto__: null,
627
+ default: /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports)
628
+ }, [reactIsExports]);
629
+ const ReactIs = Object.fromEntries([
630
+ "isAsyncMode",
631
+ "isConcurrentMode",
632
+ "isContextConsumer",
633
+ "isContextProvider",
634
+ "isElement",
635
+ "isForwardRef",
636
+ "isFragment",
637
+ "isLazy",
638
+ "isMemo",
639
+ "isPortal",
640
+ "isProfiler",
641
+ "isStrictMode",
642
+ "isSuspense",
643
+ "isSuspenseList",
644
+ "isValidElementType"
645
+ ].map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)]));
646
+ function getChildren(arg, children = []) {
647
+ if (Array.isArray(arg)) for (const item of arg) getChildren(item, children);
648
+ else if (arg != null && arg !== false && arg !== "") children.push(arg);
649
+ return children;
650
+ }
651
+ function getType(element) {
652
+ const type = element.type;
653
+ if (typeof type === "string") return type;
654
+ if (typeof type === "function") return type.displayName || type.name || "Unknown";
655
+ if (ReactIs.isFragment(element)) return "React.Fragment";
656
+ if (ReactIs.isSuspense(element)) return "React.Suspense";
657
+ if (typeof type === "object" && type !== null) {
658
+ if (ReactIs.isContextProvider(element)) return "Context.Provider";
659
+ if (ReactIs.isContextConsumer(element)) return "Context.Consumer";
660
+ if (ReactIs.isForwardRef(element)) {
661
+ if (type.displayName) return type.displayName;
662
+ const functionName = type.render.displayName || type.render.name || "";
663
+ return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
664
+ }
665
+ if (ReactIs.isMemo(element)) {
666
+ const functionName = type.displayName || type.type.displayName || type.type.name || "";
667
+ return functionName === "" ? "Memo" : `Memo(${functionName})`;
668
+ }
669
+ }
670
+ return "UNDEFINED";
671
+ }
672
+ function getPropKeys$1(element) {
673
+ const { props } = element;
674
+ return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
675
+ }
676
+ const serialize$1 = (element, config, indentation, depth, refs, printer$1) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer$1), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer$1), config, indentation);
677
+ const test$1 = (val) => val != null && ReactIs.isElement(val);
678
+ const plugin$1 = {
679
+ serialize: serialize$1,
680
+ test: test$1
681
+ };
682
+ const testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
683
+ function getPropKeys(object) {
684
+ const { props } = object;
685
+ return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
686
+ }
687
+ const serialize = (object, config, indentation, depth, refs, printer$1) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer$1) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer$1) : "", config, indentation);
688
+ const test$6 = (val) => val && val.$$typeof === testSymbol;
689
+ const plugin = {
690
+ serialize,
691
+ test: test$6
692
+ };
693
+ const toString$1 = Object.prototype.toString;
694
+ const toISOString = Date.prototype.toISOString;
695
+ const errorToString = Error.prototype.toString;
696
+ const regExpToString = RegExp.prototype.toString;
697
+ /**
698
+ * Explicitly comparing typeof constructor to function avoids undefined as name
699
+ * when mock identity-obj-proxy returns the key as the value for any key.
700
+ */
701
+ function getConstructorName(val) {
702
+ return typeof val.constructor === "function" && val.constructor.name || "Object";
703
+ }
704
+ /** Is val is equal to global window object? Works even if it does not exist :) */
705
+ function isWindow(val) {
706
+ return typeof window !== "undefined" && val === window;
707
+ }
708
+ const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
709
+ const NEWLINE_REGEXP = /\n/g;
710
+ var PrettyFormatPluginError = class extends Error {
711
+ constructor(message, stack) {
712
+ super(message);
713
+ this.stack = stack;
714
+ this.name = this.constructor.name;
715
+ }
716
+ };
717
+ function isToStringedArrayType(toStringed) {
718
+ return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
719
+ }
720
+ function printNumber(val) {
721
+ return Object.is(val, -0) ? "-0" : String(val);
722
+ }
723
+ function printBigInt(val) {
724
+ return String(`${val}n`);
725
+ }
726
+ function printFunction(val, printFunctionName) {
727
+ if (!printFunctionName) return "[Function]";
728
+ return `[Function ${val.name || "anonymous"}]`;
729
+ }
730
+ function printSymbol(val) {
731
+ return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
732
+ }
733
+ function printError(val) {
734
+ return `[${errorToString.call(val)}]`;
735
+ }
736
+ /**
737
+ * The first port of call for printing an object, handles most of the
738
+ * data-types in JS.
739
+ */
740
+ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
741
+ if (val === true || val === false) return `${val}`;
742
+ if (val === void 0) return "undefined";
743
+ if (val === null) return "null";
744
+ const typeOf = typeof val;
745
+ if (typeOf === "number") return printNumber(val);
746
+ if (typeOf === "bigint") return printBigInt(val);
747
+ if (typeOf === "string") {
748
+ if (escapeString) return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
749
+ return `"${val}"`;
750
+ }
751
+ if (typeOf === "function") return printFunction(val, printFunctionName);
752
+ if (typeOf === "symbol") return printSymbol(val);
753
+ const toStringed = toString$1.call(val);
754
+ if (toStringed === "[object WeakMap]") return "WeakMap {}";
755
+ if (toStringed === "[object WeakSet]") return "WeakSet {}";
756
+ if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") return printFunction(val, printFunctionName);
757
+ if (toStringed === "[object Symbol]") return printSymbol(val);
758
+ if (toStringed === "[object Date]") return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
759
+ if (toStringed === "[object Error]") return printError(val);
760
+ if (toStringed === "[object RegExp]") {
761
+ if (escapeRegex) return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
762
+ return regExpToString.call(val);
763
+ }
764
+ if (val instanceof Error) return printError(val);
765
+ return null;
766
+ }
767
+ /**
768
+ * Handles more complex objects ( such as objects with circular references.
769
+ * maps and sets etc )
770
+ */
771
+ function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
772
+ if (refs.includes(val)) return "[Circular]";
773
+ refs = [...refs];
774
+ refs.push(val);
775
+ const hitMaxDepth = ++depth > config.maxDepth;
776
+ const min = config.min;
777
+ if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) return printer(val.toJSON(), config, indentation, depth, refs, true);
778
+ const toStringed = toString$1.call(val);
779
+ if (toStringed === "[object Arguments]") return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
780
+ if (isToStringedArrayType(toStringed)) return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
781
+ if (toStringed === "[object Map]") return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
782
+ if (toStringed === "[object Set]") return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
783
+ return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
784
+ }
785
+ const ErrorPlugin = {
786
+ test: (val) => val && val instanceof Error,
787
+ serialize(val, config, indentation, depth, refs, printer$1) {
788
+ if (refs.includes(val)) return "[Circular]";
789
+ refs = [...refs, val];
790
+ const hitMaxDepth = ++depth > config.maxDepth;
791
+ const { message, cause,...rest } = val;
792
+ const entries = {
793
+ message,
794
+ ...typeof cause !== "undefined" ? { cause } : {},
795
+ ...val instanceof AggregateError ? { errors: val.errors } : {},
796
+ ...rest
797
+ };
798
+ const name = val.name !== "Error" ? val.name : getConstructorName(val);
799
+ return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer$1)}}`;
800
+ }
801
+ };
802
+ function isNewPlugin(plugin$6) {
803
+ return plugin$6.serialize != null;
804
+ }
805
+ function printPlugin(plugin$6, val, config, indentation, depth, refs) {
806
+ let printed;
807
+ try {
808
+ printed = isNewPlugin(plugin$6) ? plugin$6.serialize(val, config, indentation, depth, refs, printer) : plugin$6.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
809
+ const indentationNext = indentation + config.indent;
810
+ return indentationNext + str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`);
811
+ }, {
812
+ edgeSpacing: config.spacingOuter,
813
+ min: config.min,
814
+ spacing: config.spacingInner
815
+ }, config.colors);
816
+ } catch (error) {
817
+ throw new PrettyFormatPluginError(error.message, error.stack);
818
+ }
819
+ if (typeof printed !== "string") throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
820
+ return printed;
821
+ }
822
+ function findPlugin(plugins$1, val) {
823
+ for (const plugin$6 of plugins$1) try {
824
+ if (plugin$6.test(val)) return plugin$6;
825
+ } catch (error) {
826
+ throw new PrettyFormatPluginError(error.message, error.stack);
827
+ }
828
+ return null;
829
+ }
830
+ function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
831
+ const plugin$6 = findPlugin(config.plugins, val);
832
+ if (plugin$6 !== null) return printPlugin(plugin$6, val, config, indentation, depth, refs);
833
+ const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
834
+ if (basicResult !== null) return basicResult;
835
+ return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
836
+ }
837
+ const DEFAULT_THEME = {
838
+ comment: "gray",
839
+ content: "reset",
840
+ prop: "yellow",
841
+ tag: "cyan",
842
+ value: "green"
843
+ };
844
+ const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
845
+ const DEFAULT_OPTIONS = {
846
+ callToJSON: true,
847
+ compareKeys: void 0,
848
+ escapeRegex: false,
849
+ escapeString: true,
850
+ highlight: false,
851
+ indent: 2,
852
+ maxDepth: Number.POSITIVE_INFINITY,
853
+ maxWidth: Number.POSITIVE_INFINITY,
854
+ min: false,
855
+ plugins: [],
856
+ printBasicPrototype: true,
857
+ printFunctionName: true,
858
+ printShadowRoot: true,
859
+ theme: DEFAULT_THEME
860
+ };
861
+ function validateOptions(options) {
862
+ for (const key of Object.keys(options)) if (!Object.hasOwn(DEFAULT_OPTIONS, key)) throw new Error(`pretty-format: Unknown option "${key}".`);
863
+ if (options.min && options.indent !== void 0 && options.indent !== 0) throw new Error("pretty-format: Options \"min\" and \"indent\" cannot be used together.");
864
+ }
865
+ function getColorsHighlight() {
866
+ return DEFAULT_THEME_KEYS.reduce((colors, key) => {
867
+ const value = DEFAULT_THEME[key];
868
+ const color = value && C[value];
869
+ if (color && typeof color.close === "string" && typeof color.open === "string") colors[key] = color;
870
+ else throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
871
+ return colors;
872
+ }, Object.create(null));
873
+ }
874
+ function getColorsEmpty() {
875
+ return DEFAULT_THEME_KEYS.reduce((colors, key) => {
876
+ colors[key] = {
877
+ close: "",
878
+ open: ""
879
+ };
880
+ return colors;
881
+ }, Object.create(null));
882
+ }
883
+ function getPrintFunctionName(options) {
884
+ return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
885
+ }
886
+ function getEscapeRegex(options) {
887
+ return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
888
+ }
889
+ function getEscapeString(options) {
890
+ return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
891
+ }
892
+ function getConfig(options) {
893
+ return {
894
+ callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
895
+ colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
896
+ compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
897
+ escapeRegex: getEscapeRegex(options),
898
+ escapeString: getEscapeString(options),
899
+ indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
900
+ maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
901
+ maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
902
+ min: options?.min ?? DEFAULT_OPTIONS.min,
903
+ plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
904
+ printBasicPrototype: options?.printBasicPrototype ?? true,
905
+ printFunctionName: getPrintFunctionName(options),
906
+ printShadowRoot: options?.printShadowRoot ?? true,
907
+ spacingInner: options?.min ? " " : "\n",
908
+ spacingOuter: options?.min ? "" : "\n"
909
+ };
910
+ }
911
+ function createIndent(indent) {
912
+ return Array.from({ length: indent + 1 }).join(" ");
913
+ }
914
+ /**
915
+ * Returns a presentation string of your `val` object
916
+ * @param val any potential JavaScript object
917
+ * @param options Custom settings
918
+ */
919
+ function format$1(val, options) {
920
+ if (options) {
921
+ validateOptions(options);
922
+ if (options.plugins) {
923
+ const plugin$6 = findPlugin(options.plugins, val);
924
+ if (plugin$6 !== null) return printPlugin(plugin$6, val, getConfig(options), "", 0, []);
925
+ }
926
+ }
927
+ const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
928
+ if (basicResult !== null) return basicResult;
929
+ return printComplexValue(val, getConfig(options), "", 0, []);
930
+ }
931
+ const plugins = {
932
+ AsymmetricMatcher: plugin$5,
933
+ DOMCollection: plugin$4,
934
+ DOMElement: plugin$3,
935
+ Immutable: plugin$2,
936
+ ReactElement: plugin$1,
937
+ ReactTestComponent: plugin,
938
+ Error: ErrorPlugin
939
+ };
940
+
941
+ //#endregion
942
+ //#region node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/display.js
943
+ const ansiColors = {
944
+ bold: ["1", "22"],
945
+ dim: ["2", "22"],
946
+ italic: ["3", "23"],
947
+ underline: ["4", "24"],
948
+ inverse: ["7", "27"],
949
+ hidden: ["8", "28"],
950
+ strike: ["9", "29"],
951
+ black: ["30", "39"],
952
+ red: ["31", "39"],
953
+ green: ["32", "39"],
954
+ yellow: ["33", "39"],
955
+ blue: ["34", "39"],
956
+ magenta: ["35", "39"],
957
+ cyan: ["36", "39"],
958
+ white: ["37", "39"],
959
+ brightblack: ["30;1", "39"],
960
+ brightred: ["31;1", "39"],
961
+ brightgreen: ["32;1", "39"],
962
+ brightyellow: ["33;1", "39"],
963
+ brightblue: ["34;1", "39"],
964
+ brightmagenta: ["35;1", "39"],
965
+ brightcyan: ["36;1", "39"],
966
+ brightwhite: ["37;1", "39"],
967
+ grey: ["90", "39"]
968
+ };
969
+ const styles = {
970
+ special: "cyan",
971
+ number: "yellow",
972
+ bigint: "yellow",
973
+ boolean: "yellow",
974
+ undefined: "grey",
975
+ null: "bold",
976
+ string: "green",
977
+ symbol: "green",
978
+ date: "magenta",
979
+ regexp: "red"
980
+ };
981
+ const truncator = "…";
982
+ function colorise(value, styleType) {
983
+ const color = ansiColors[styles[styleType]] || ansiColors[styleType] || "";
984
+ if (!color) return String(value);
985
+ return `\u001b[${color[0]}m${String(value)}\u001b[${color[1]}m`;
986
+ }
987
+ function normaliseOptions({ showHidden = false, depth = 2, colors = false, customInspect = true, showProxy = false, maxArrayLength = Infinity, breakLength = Infinity, seen = [], truncate: truncate$1 = Infinity, stylize = String } = {}, inspect$2) {
988
+ const options = {
989
+ showHidden: Boolean(showHidden),
990
+ depth: Number(depth),
991
+ colors: Boolean(colors),
992
+ customInspect: Boolean(customInspect),
993
+ showProxy: Boolean(showProxy),
994
+ maxArrayLength: Number(maxArrayLength),
995
+ breakLength: Number(breakLength),
996
+ truncate: Number(truncate$1),
997
+ seen,
998
+ inspect: inspect$2,
999
+ stylize
1000
+ };
1001
+ if (options.colors) options.stylize = colorise;
1002
+ return options;
1003
+ }
1004
+ function isHighSurrogate(char) {
1005
+ return char >= "\ud800" && char <= "\udbff";
1006
+ }
1007
+ function truncate(string, length, tail = truncator) {
1008
+ string = String(string);
1009
+ const tailLength = tail.length;
1010
+ const stringLength = string.length;
1011
+ if (tailLength > length && stringLength > tailLength) return tail;
1012
+ if (stringLength > length && stringLength > tailLength) {
1013
+ let end = length - tailLength;
1014
+ if (end > 0 && isHighSurrogate(string[end - 1])) end = end - 1;
1015
+ return `${string.slice(0, end)}${tail}`;
1016
+ }
1017
+ return string;
1018
+ }
1019
+ function inspectList(list, options, inspectItem, separator = ", ") {
1020
+ inspectItem = inspectItem || options.inspect;
1021
+ const size = list.length;
1022
+ if (size === 0) return "";
1023
+ const originalLength = options.truncate;
1024
+ let output = "";
1025
+ let peek = "";
1026
+ let truncated = "";
1027
+ for (let i = 0; i < size; i += 1) {
1028
+ const last = i + 1 === list.length;
1029
+ const secondToLast = i + 2 === list.length;
1030
+ truncated = `${truncator}(${list.length - i})`;
1031
+ const value = list[i];
1032
+ options.truncate = originalLength - output.length - (last ? 0 : separator.length);
1033
+ const string = peek || inspectItem(value, options) + (last ? "" : separator);
1034
+ const nextLength = output.length + string.length;
1035
+ const truncatedLength = nextLength + truncated.length;
1036
+ if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) break;
1037
+ if (!last && !secondToLast && truncatedLength > originalLength) break;
1038
+ peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator);
1039
+ if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) break;
1040
+ output += string;
1041
+ if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
1042
+ truncated = `${truncator}(${list.length - i - 1})`;
1043
+ break;
1044
+ }
1045
+ truncated = "";
1046
+ }
1047
+ return `${output}${truncated}`;
1048
+ }
1049
+ function quoteComplexKey(key) {
1050
+ if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) return key;
1051
+ return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, "\"").replace(/(^"|"$)/g, "'");
1052
+ }
1053
+ function inspectProperty([key, value], options) {
1054
+ options.truncate -= 2;
1055
+ if (typeof key === "string") key = quoteComplexKey(key);
1056
+ else if (typeof key !== "number") key = `[${options.inspect(key, options)}]`;
1057
+ options.truncate -= key.length;
1058
+ value = options.inspect(value, options);
1059
+ return `${key}: ${value}`;
1060
+ }
1061
+ function inspectArray(array, options) {
1062
+ const nonIndexProperties = Object.keys(array).slice(array.length);
1063
+ if (!array.length && !nonIndexProperties.length) return "[]";
1064
+ options.truncate -= 4;
1065
+ const listContents = inspectList(array, options);
1066
+ options.truncate -= listContents.length;
1067
+ let propertyContents = "";
1068
+ if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
1069
+ return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`;
1070
+ }
1071
+ const getArrayName = (array) => {
1072
+ if (typeof Buffer === "function" && array instanceof Buffer) return "Buffer";
1073
+ if (array[Symbol.toStringTag]) return array[Symbol.toStringTag];
1074
+ return array.constructor.name;
1075
+ };
1076
+ function inspectTypedArray(array, options) {
1077
+ const name = getArrayName(array);
1078
+ options.truncate -= name.length + 4;
1079
+ const nonIndexProperties = Object.keys(array).slice(array.length);
1080
+ if (!array.length && !nonIndexProperties.length) return `${name}[]`;
1081
+ let output = "";
1082
+ for (let i = 0; i < array.length; i++) {
1083
+ const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`;
1084
+ options.truncate -= string.length;
1085
+ if (array[i] !== array.length && options.truncate <= 3) {
1086
+ output += `${truncator}(${array.length - array[i] + 1})`;
1087
+ break;
1088
+ }
1089
+ output += string;
1090
+ }
1091
+ let propertyContents = "";
1092
+ if (nonIndexProperties.length) propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty);
1093
+ return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`;
1094
+ }
1095
+ function inspectDate(dateObject, options) {
1096
+ const stringRepresentation = dateObject.toJSON();
1097
+ if (stringRepresentation === null) return "Invalid Date";
1098
+ const split = stringRepresentation.split("T");
1099
+ const date = split[0];
1100
+ return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date");
1101
+ }
1102
+ function inspectFunction(func, options) {
1103
+ const functionType = func[Symbol.toStringTag] || "Function";
1104
+ const name = func.name;
1105
+ if (!name) return options.stylize(`[${functionType}]`, "special");
1106
+ return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special");
1107
+ }
1108
+ function inspectMapEntry([key, value], options) {
1109
+ options.truncate -= 4;
1110
+ key = options.inspect(key, options);
1111
+ options.truncate -= key.length;
1112
+ value = options.inspect(value, options);
1113
+ return `${key} => ${value}`;
1114
+ }
1115
+ function mapToEntries(map) {
1116
+ const entries = [];
1117
+ map.forEach((value, key) => {
1118
+ entries.push([key, value]);
1119
+ });
1120
+ return entries;
1121
+ }
1122
+ function inspectMap(map, options) {
1123
+ if (map.size === 0) return "Map{}";
1124
+ options.truncate -= 7;
1125
+ return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`;
1126
+ }
1127
+ const isNaN = Number.isNaN || ((i) => i !== i);
1128
+ function inspectNumber(number, options) {
1129
+ if (isNaN(number)) return options.stylize("NaN", "number");
1130
+ if (number === Infinity) return options.stylize("Infinity", "number");
1131
+ if (number === -Infinity) return options.stylize("-Infinity", "number");
1132
+ if (number === 0) return options.stylize(1 / number === Infinity ? "+0" : "-0", "number");
1133
+ return options.stylize(truncate(String(number), options.truncate), "number");
1134
+ }
1135
+ function inspectBigInt(number, options) {
1136
+ let nums = truncate(number.toString(), options.truncate - 1);
1137
+ if (nums !== truncator) nums += "n";
1138
+ return options.stylize(nums, "bigint");
1139
+ }
1140
+ function inspectRegExp(value, options) {
1141
+ const flags = value.toString().split("/")[2];
1142
+ const sourceLength = options.truncate - (2 + flags.length);
1143
+ const source = value.source;
1144
+ return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp");
1145
+ }
1146
+ function arrayFromSet(set) {
1147
+ const values = [];
1148
+ set.forEach((value) => {
1149
+ values.push(value);
1150
+ });
1151
+ return values;
1152
+ }
1153
+ function inspectSet(set, options) {
1154
+ if (set.size === 0) return "Set{}";
1155
+ options.truncate -= 7;
1156
+ return `Set{ ${inspectList(arrayFromSet(set), options)} }`;
1157
+ }
1158
+ const stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g");
1159
+ const escapeCharacters = {
1160
+ "\b": "\\b",
1161
+ " ": "\\t",
1162
+ "\n": "\\n",
1163
+ "\f": "\\f",
1164
+ "\r": "\\r",
1165
+ "'": "\\'",
1166
+ "\\": "\\\\"
1167
+ };
1168
+ const hex = 16;
1169
+ function escape(char) {
1170
+ return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`;
1171
+ }
1172
+ function inspectString(string, options) {
1173
+ if (stringEscapeChars.test(string)) string = string.replace(stringEscapeChars, escape);
1174
+ return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string");
1175
+ }
1176
+ function inspectSymbol(value) {
1177
+ if ("description" in Symbol.prototype) return value.description ? `Symbol(${value.description})` : "Symbol()";
1178
+ return value.toString();
1179
+ }
1180
+ const getPromiseValue = () => "Promise{…}";
1181
+ function inspectObject$1(object, options) {
1182
+ const properties = Object.getOwnPropertyNames(object);
1183
+ const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
1184
+ if (properties.length === 0 && symbols.length === 0) return "{}";
1185
+ options.truncate -= 4;
1186
+ options.seen = options.seen || [];
1187
+ if (options.seen.includes(object)) return "[Circular]";
1188
+ options.seen.push(object);
1189
+ const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty);
1190
+ const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty);
1191
+ options.seen.pop();
1192
+ let sep = "";
1193
+ if (propertyContents && symbolContents) sep = ", ";
1194
+ return `{ ${propertyContents}${sep}${symbolContents} }`;
1195
+ }
1196
+ const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false;
1197
+ function inspectClass(value, options) {
1198
+ let name = "";
1199
+ if (toStringTag && toStringTag in value) name = value[toStringTag];
1200
+ name = name || value.constructor.name;
1201
+ if (!name || name === "_class") name = "<Anonymous Class>";
1202
+ options.truncate -= name.length;
1203
+ return `${name}${inspectObject$1(value, options)}`;
1204
+ }
1205
+ function inspectArguments(args, options) {
1206
+ if (args.length === 0) return "Arguments[]";
1207
+ options.truncate -= 13;
1208
+ return `Arguments[ ${inspectList(args, options)} ]`;
1209
+ }
1210
+ const errorKeys = [
1211
+ "stack",
1212
+ "line",
1213
+ "column",
1214
+ "name",
1215
+ "message",
1216
+ "fileName",
1217
+ "lineNumber",
1218
+ "columnNumber",
1219
+ "number",
1220
+ "description",
1221
+ "cause"
1222
+ ];
1223
+ function inspectObject(error, options) {
1224
+ const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1);
1225
+ const name = error.name;
1226
+ options.truncate -= name.length;
1227
+ let message = "";
1228
+ if (typeof error.message === "string") message = truncate(error.message, options.truncate);
1229
+ else properties.unshift("message");
1230
+ message = message ? `: ${message}` : "";
1231
+ options.truncate -= message.length + 5;
1232
+ options.seen = options.seen || [];
1233
+ if (options.seen.includes(error)) return "[Circular]";
1234
+ options.seen.push(error);
1235
+ const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty);
1236
+ return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`;
1237
+ }
1238
+ function inspectAttribute([key, value], options) {
1239
+ options.truncate -= 3;
1240
+ if (!value) return `${options.stylize(String(key), "yellow")}`;
1241
+ return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`;
1242
+ }
1243
+ function inspectNodeCollection(collection, options) {
1244
+ return inspectList(collection, options, inspectNode, "\n");
1245
+ }
1246
+ function inspectNode(node, options) {
1247
+ switch (node.nodeType) {
1248
+ case 1: return inspectHTML(node, options);
1249
+ case 3: return options.inspect(node.data, options);
1250
+ default: return options.inspect(node, options);
1251
+ }
1252
+ }
1253
+ function inspectHTML(element, options) {
1254
+ const properties = element.getAttributeNames();
1255
+ const name = element.tagName.toLowerCase();
1256
+ const head = options.stylize(`<${name}`, "special");
1257
+ const headClose = options.stylize(`>`, "special");
1258
+ const tail = options.stylize(`</${name}>`, "special");
1259
+ options.truncate -= name.length * 2 + 5;
1260
+ let propertyContents = "";
1261
+ if (properties.length > 0) {
1262
+ propertyContents += " ";
1263
+ propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " ");
1264
+ }
1265
+ options.truncate -= propertyContents.length;
1266
+ const truncate$1 = options.truncate;
1267
+ let children = inspectNodeCollection(element.children, options);
1268
+ if (children && children.length > truncate$1) children = `${truncator}(${element.children.length})`;
1269
+ return `${head}${propertyContents}${headClose}${children}${tail}`;
1270
+ }
1271
+ const chaiInspect = typeof Symbol === "function" && typeof Symbol.for === "function" ? Symbol.for("chai/inspect") : "@@chai/inspect";
1272
+ const nodeInspect = Symbol.for("nodejs.util.inspect.custom");
1273
+ const constructorMap = /* @__PURE__ */ new WeakMap();
1274
+ const stringTagMap = {};
1275
+ const baseTypesMap = {
1276
+ undefined: (value, options) => options.stylize("undefined", "undefined"),
1277
+ null: (value, options) => options.stylize("null", "null"),
1278
+ boolean: (value, options) => options.stylize(String(value), "boolean"),
1279
+ Boolean: (value, options) => options.stylize(String(value), "boolean"),
1280
+ number: inspectNumber,
1281
+ Number: inspectNumber,
1282
+ bigint: inspectBigInt,
1283
+ BigInt: inspectBigInt,
1284
+ string: inspectString,
1285
+ String: inspectString,
1286
+ function: inspectFunction,
1287
+ Function: inspectFunction,
1288
+ symbol: inspectSymbol,
1289
+ Symbol: inspectSymbol,
1290
+ Array: inspectArray,
1291
+ Date: inspectDate,
1292
+ Map: inspectMap,
1293
+ Set: inspectSet,
1294
+ RegExp: inspectRegExp,
1295
+ Promise: getPromiseValue,
1296
+ WeakSet: (value, options) => options.stylize("WeakSet{…}", "special"),
1297
+ WeakMap: (value, options) => options.stylize("WeakMap{…}", "special"),
1298
+ Arguments: inspectArguments,
1299
+ Int8Array: inspectTypedArray,
1300
+ Uint8Array: inspectTypedArray,
1301
+ Uint8ClampedArray: inspectTypedArray,
1302
+ Int16Array: inspectTypedArray,
1303
+ Uint16Array: inspectTypedArray,
1304
+ Int32Array: inspectTypedArray,
1305
+ Uint32Array: inspectTypedArray,
1306
+ Float32Array: inspectTypedArray,
1307
+ Float64Array: inspectTypedArray,
1308
+ Generator: () => "",
1309
+ DataView: () => "",
1310
+ ArrayBuffer: () => "",
1311
+ Error: inspectObject,
1312
+ HTMLCollection: inspectNodeCollection,
1313
+ NodeList: inspectNodeCollection
1314
+ };
1315
+ const inspectCustom = (value, options, type, inspectFn) => {
1316
+ if (chaiInspect in value && typeof value[chaiInspect] === "function") return value[chaiInspect](options);
1317
+ if (nodeInspect in value && typeof value[nodeInspect] === "function") return value[nodeInspect](options.depth, options, inspectFn);
1318
+ if ("inspect" in value && typeof value.inspect === "function") return value.inspect(options.depth, options);
1319
+ if ("constructor" in value && constructorMap.has(value.constructor)) return constructorMap.get(value.constructor)(value, options);
1320
+ if (stringTagMap[type]) return stringTagMap[type](value, options);
1321
+ return "";
1322
+ };
1323
+ const toString = Object.prototype.toString;
1324
+ function inspect$1(value, opts = {}) {
1325
+ const options = normaliseOptions(opts, inspect$1);
1326
+ const { customInspect } = options;
1327
+ let type = value === null ? "null" : typeof value;
1328
+ if (type === "object") type = toString.call(value).slice(8, -1);
1329
+ if (type in baseTypesMap) return baseTypesMap[type](value, options);
1330
+ if (customInspect && value) {
1331
+ const output = inspectCustom(value, options, type, inspect$1);
1332
+ if (output) {
1333
+ if (typeof output === "string") return output;
1334
+ return inspect$1(output, options);
1335
+ }
1336
+ }
1337
+ const proto = value ? Object.getPrototypeOf(value) : false;
1338
+ if (proto === Object.prototype || proto === null) return inspectObject$1(value, options);
1339
+ if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) return inspectHTML(value, options);
1340
+ if ("constructor" in value) {
1341
+ if (value.constructor !== Object) return inspectClass(value, options);
1342
+ return inspectObject$1(value, options);
1343
+ }
1344
+ if (value === Object(value)) return inspectObject$1(value, options);
1345
+ return options.stylize(String(value), type);
1346
+ }
1347
+ const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins;
1348
+ const PLUGINS = [
1349
+ ReactTestComponent,
1350
+ ReactElement,
1351
+ DOMElement,
1352
+ DOMCollection,
1353
+ Immutable,
1354
+ AsymmetricMatcher
1355
+ ];
1356
+ function stringify(object, maxDepth = 10, { maxLength,...options } = {}) {
1357
+ const MAX_LENGTH = maxLength ?? 1e4;
1358
+ let result;
1359
+ try {
1360
+ result = format$1(object, {
1361
+ maxDepth,
1362
+ escapeString: false,
1363
+ plugins: PLUGINS,
1364
+ ...options
1365
+ });
1366
+ } catch {
1367
+ result = format$1(object, {
1368
+ callToJSON: false,
1369
+ maxDepth,
1370
+ escapeString: false,
1371
+ plugins: PLUGINS,
1372
+ ...options
1373
+ });
1374
+ }
1375
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), {
1376
+ maxLength,
1377
+ ...options
1378
+ }) : result;
1379
+ }
1380
+ const formatRegExp = /%[sdjifoOc%]/g;
1381
+ function baseFormat(args, options = {}) {
1382
+ const formatArg = (item, inspecOptions) => {
1383
+ if (options.prettifyObject) return stringify(item, void 0, {
1384
+ printBasicPrototype: false,
1385
+ escapeString: false
1386
+ });
1387
+ return inspect(item, inspecOptions);
1388
+ };
1389
+ if (typeof args[0] !== "string") {
1390
+ const objects = [];
1391
+ for (let i$1 = 0; i$1 < args.length; i$1++) objects.push(formatArg(args[i$1], {
1392
+ depth: 0,
1393
+ colors: false
1394
+ }));
1395
+ return objects.join(" ");
1396
+ }
1397
+ const len = args.length;
1398
+ let i = 1;
1399
+ const template = args[0];
1400
+ let str = String(template).replace(formatRegExp, (x) => {
1401
+ if (x === "%%") return "%";
1402
+ if (i >= len) return x;
1403
+ switch (x) {
1404
+ case "%s": {
1405
+ const value = args[i++];
1406
+ if (typeof value === "bigint") return `${value.toString()}n`;
1407
+ if (typeof value === "number" && value === 0 && 1 / value < 0) return "-0";
1408
+ if (typeof value === "object" && value !== null) {
1409
+ if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) return value.toString();
1410
+ return formatArg(value, {
1411
+ depth: 0,
1412
+ colors: false
1413
+ });
1414
+ }
1415
+ return String(value);
1416
+ }
1417
+ case "%d": {
1418
+ const value = args[i++];
1419
+ if (typeof value === "bigint") return `${value.toString()}n`;
1420
+ return Number(value).toString();
1421
+ }
1422
+ case "%i": {
1423
+ const value = args[i++];
1424
+ if (typeof value === "bigint") return `${value.toString()}n`;
1425
+ return Number.parseInt(String(value)).toString();
1426
+ }
1427
+ case "%f": return Number.parseFloat(String(args[i++])).toString();
1428
+ case "%o": return formatArg(args[i++], {
1429
+ showHidden: true,
1430
+ showProxy: true
1431
+ });
1432
+ case "%O": return formatArg(args[i++]);
1433
+ case "%c":
1434
+ i++;
1435
+ return "";
1436
+ case "%j": try {
1437
+ return JSON.stringify(args[i++]);
1438
+ } catch (err) {
1439
+ const m = err.message;
1440
+ if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) return "[Circular]";
1441
+ throw err;
1442
+ }
1443
+ default: return x;
1444
+ }
1445
+ });
1446
+ for (let x = args[i]; i < len; x = args[++i]) if (x === null || typeof x !== "object") str += ` ${x}`;
1447
+ else str += ` ${formatArg(x)}`;
1448
+ return str;
1449
+ }
1450
+ function format(...args) {
1451
+ return baseFormat(args);
1452
+ }
1453
+ function inspect(obj, options = {}) {
1454
+ if (options.truncate === 0) options.truncate = Number.POSITIVE_INFINITY;
1455
+ return inspect$1(obj, options);
1456
+ }
1457
+ function objDisplay(obj, options = {}) {
1458
+ if (typeof options.truncate === "undefined") options.truncate = 40;
1459
+ const str = inspect(obj, options);
1460
+ const type = Object.prototype.toString.call(obj);
1461
+ if (options.truncate && str.length >= options.truncate) if (type === "[object Function]") {
1462
+ const fn = obj;
1463
+ return !fn.name ? "[Function]" : `[Function: ${fn.name}]`;
1464
+ } else if (type === "[object Array]") return `[ Array(${obj.length}) ]`;
1465
+ else if (type === "[object Object]") {
1466
+ const keys = Object.keys(obj);
1467
+ return `{ Object (${keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", ")}) }`;
1468
+ } else return str;
1469
+ return str;
1470
+ }
1471
+
1472
+ //#endregion
1473
+ //#region node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/helpers.js
1474
+ function assertTypes(value, name, types) {
1475
+ const receivedType = typeof value;
1476
+ if (!types.includes(receivedType)) throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
1477
+ }
1478
+ function toArray(array) {
1479
+ if (array === null || array === void 0) array = [];
1480
+ if (Array.isArray(array)) return array;
1481
+ return [array];
1482
+ }
1483
+ function isObject(item) {
1484
+ return item != null && typeof item === "object" && !Array.isArray(item);
1485
+ }
1486
+ function objectAttr(source, path, defaultValue = void 0) {
1487
+ const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
1488
+ let result = source;
1489
+ for (const p of paths) {
1490
+ result = new Object(result)[p];
1491
+ if (result === void 0) return defaultValue;
1492
+ }
1493
+ return result;
1494
+ }
1495
+ function createDefer() {
1496
+ let resolve$1 = null;
1497
+ let reject = null;
1498
+ const p = new Promise((_resolve, _reject) => {
1499
+ resolve$1 = _resolve;
1500
+ reject = _reject;
1501
+ });
1502
+ p.resolve = resolve$1;
1503
+ p.reject = reject;
1504
+ return p;
1505
+ }
1506
+ function isNegativeNaN(val) {
1507
+ if (!Number.isNaN(val)) return false;
1508
+ const f64 = new Float64Array(1);
1509
+ f64[0] = val;
1510
+ return new Uint32Array(f64.buffer)[1] >>> 31 === 1;
1511
+ }
1512
+
1513
+ //#endregion
1514
+ //#region node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/timers.js
1515
+ const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS");
1516
+ function getSafeTimers() {
1517
+ const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
1518
+ const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {};
1519
+ return {
1520
+ nextTick: safeNextTick,
1521
+ setTimeout: safeSetTimeout,
1522
+ setInterval: safeSetInterval,
1523
+ clearInterval: safeClearInterval,
1524
+ clearTimeout: safeClearTimeout,
1525
+ setImmediate: safeSetImmediate,
1526
+ clearImmediate: safeClearImmediate,
1527
+ queueMicrotask: safeQueueMicrotask
1528
+ };
1529
+ }
1530
+
1531
+ //#endregion
1532
+ //#region node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js
1533
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
1534
+ function normalizeWindowsPath(input = "") {
1535
+ if (!input) return input;
1536
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
1537
+ }
1538
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
1539
+ function cwd() {
1540
+ if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
1541
+ return "/";
1542
+ }
1543
+ const resolve = function(...arguments_) {
1544
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
1545
+ let resolvedPath = "";
1546
+ let resolvedAbsolute = false;
1547
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
1548
+ const path = index >= 0 ? arguments_[index] : cwd();
1549
+ if (!path || path.length === 0) continue;
1550
+ resolvedPath = `${path}/${resolvedPath}`;
1551
+ resolvedAbsolute = isAbsolute(path);
1552
+ }
1553
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
1554
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
1555
+ return resolvedPath.length > 0 ? resolvedPath : ".";
1556
+ };
1557
+ function normalizeString(path, allowAboveRoot) {
1558
+ let res = "";
1559
+ let lastSegmentLength = 0;
1560
+ let lastSlash = -1;
1561
+ let dots = 0;
1562
+ let char = null;
1563
+ for (let index = 0; index <= path.length; ++index) {
1564
+ if (index < path.length) char = path[index];
1565
+ else if (char === "/") break;
1566
+ else char = "/";
1567
+ if (char === "/") {
1568
+ if (lastSlash === index - 1 || dots === 1);
1569
+ else if (dots === 2) {
1570
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
1571
+ if (res.length > 2) {
1572
+ const lastSlashIndex = res.lastIndexOf("/");
1573
+ if (lastSlashIndex === -1) {
1574
+ res = "";
1575
+ lastSegmentLength = 0;
1576
+ } else {
1577
+ res = res.slice(0, lastSlashIndex);
1578
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1579
+ }
1580
+ lastSlash = index;
1581
+ dots = 0;
1582
+ continue;
1583
+ } else if (res.length > 0) {
1584
+ res = "";
1585
+ lastSegmentLength = 0;
1586
+ lastSlash = index;
1587
+ dots = 0;
1588
+ continue;
1589
+ }
1590
+ }
1591
+ if (allowAboveRoot) {
1592
+ res += res.length > 0 ? "/.." : "..";
1593
+ lastSegmentLength = 2;
1594
+ }
1595
+ } else {
1596
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
1597
+ else res = path.slice(lastSlash + 1, index);
1598
+ lastSegmentLength = index - lastSlash - 1;
1599
+ }
1600
+ lastSlash = index;
1601
+ dots = 0;
1602
+ } else if (char === "." && dots !== -1) ++dots;
1603
+ else dots = -1;
1604
+ }
1605
+ return res;
1606
+ }
1607
+ const isAbsolute = function(p) {
1608
+ return _IS_ABSOLUTE_RE.test(p);
1609
+ };
1610
+
1611
+ //#endregion
1612
+ //#region node_modules/.pnpm/@vitest+utils@4.0.18/node_modules/@vitest/utils/dist/source-map.js
1613
+ var comma = ",".charCodeAt(0);
1614
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1615
+ var intToChar = new Uint8Array(64);
1616
+ var charToInt = new Uint8Array(128);
1617
+ for (let i = 0; i < chars.length; i++) {
1618
+ const c = chars.charCodeAt(i);
1619
+ intToChar[i] = c;
1620
+ charToInt[c] = i;
1621
+ }
1622
+ const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
1623
+ const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
1624
+ function extractLocation(urlLike) {
1625
+ if (!urlLike.includes(":")) return [urlLike];
1626
+ const parts = /(.+?)(?::(\d+))?(?::(\d+))?$/.exec(urlLike.replace(/^\(|\)$/g, ""));
1627
+ if (!parts) return [urlLike];
1628
+ let url = parts[1];
1629
+ if (url.startsWith("async ")) url = url.slice(6);
1630
+ if (url.startsWith("http:") || url.startsWith("https:")) {
1631
+ const urlObj = new URL(url);
1632
+ urlObj.searchParams.delete("import");
1633
+ urlObj.searchParams.delete("browserv");
1634
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
1635
+ }
1636
+ if (url.startsWith("/@fs/")) {
1637
+ const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
1638
+ url = url.slice(isWindows ? 5 : 4);
1639
+ }
1640
+ return [
1641
+ url,
1642
+ parts[2] || void 0,
1643
+ parts[3] || void 0
1644
+ ];
1645
+ }
1646
+ function parseSingleFFOrSafariStack(raw) {
1647
+ let line = raw.trim();
1648
+ if (SAFARI_NATIVE_CODE_REGEXP.test(line)) return null;
1649
+ if (line.includes(" > eval")) line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
1650
+ if (!line.includes("@")) return null;
1651
+ let atIndex = -1;
1652
+ let locationPart = "";
1653
+ let functionName;
1654
+ for (let i = 0; i < line.length; i++) if (line[i] === "@") {
1655
+ const candidateLocation = line.slice(i + 1);
1656
+ if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
1657
+ atIndex = i;
1658
+ locationPart = candidateLocation;
1659
+ functionName = i > 0 ? line.slice(0, i) : void 0;
1660
+ break;
1661
+ }
1662
+ }
1663
+ if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) return null;
1664
+ const [url, lineNumber, columnNumber] = extractLocation(locationPart);
1665
+ if (!url || !lineNumber || !columnNumber) return null;
1666
+ return {
1667
+ file: url,
1668
+ method: functionName || "",
1669
+ line: Number.parseInt(lineNumber),
1670
+ column: Number.parseInt(columnNumber)
1671
+ };
1672
+ }
1673
+ function parseSingleStack(raw) {
1674
+ const line = raw.trim();
1675
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return parseSingleFFOrSafariStack(line);
1676
+ return parseSingleV8Stack(line);
1677
+ }
1678
+ function parseSingleV8Stack(raw) {
1679
+ let line = raw.trim();
1680
+ if (!CHROME_IE_STACK_REGEXP.test(line)) return null;
1681
+ if (line.includes("(eval ")) line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
1682
+ let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
1683
+ const location = sanitizedLine.match(/ (\(.+\)$)/);
1684
+ sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
1685
+ const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
1686
+ let method = location && sanitizedLine || "";
1687
+ let file = url && ["eval", "<anonymous>"].includes(url) ? void 0 : url;
1688
+ if (!file || !lineNumber || !columnNumber) return null;
1689
+ if (method.startsWith("async ")) method = method.slice(6);
1690
+ if (file.startsWith("file://")) file = file.slice(7);
1691
+ file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
1692
+ if (method) method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
1693
+ return {
1694
+ method,
1695
+ file,
1696
+ line: Number.parseInt(lineNumber),
1697
+ column: Number.parseInt(columnNumber)
1698
+ };
1699
+ }
1700
+
1701
+ //#endregion
1702
+ //#region node_modules/.pnpm/@vitest+runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.js
1703
+ function createChainable(keys, fn) {
1704
+ function create(context) {
1705
+ const chain$1 = function(...args) {
1706
+ return fn.apply(context, args);
1707
+ };
1708
+ Object.assign(chain$1, fn);
1709
+ chain$1.withContext = () => chain$1.bind(context);
1710
+ chain$1.setContext = (key, value) => {
1711
+ context[key] = value;
1712
+ };
1713
+ chain$1.mergeContext = (ctx) => {
1714
+ Object.assign(context, ctx);
1715
+ };
1716
+ for (const key of keys) Object.defineProperty(chain$1, key, { get() {
1717
+ return create({
1718
+ ...context,
1719
+ [key]: true
1720
+ });
1721
+ } });
1722
+ return chain$1;
1723
+ }
1724
+ const chain = create({});
1725
+ chain.fn = fn;
1726
+ return chain;
1727
+ }
1728
+ function findTestFileStackTrace(testFilePath, error) {
1729
+ const lines = error.split("\n").slice(1);
1730
+ for (const line of lines) {
1731
+ const stack = parseSingleStack(line);
1732
+ if (stack && stack.file === testFilePath) return stack;
1733
+ }
1734
+ }
1735
+ function createTaskName(names, separator = " > ") {
1736
+ return names.filter((name) => name !== void 0).join(separator);
1737
+ }
1738
+
1739
+ //#endregion
1740
+ //#region node_modules/.pnpm/@vitest+runner@4.0.18/node_modules/@vitest/runner/dist/index.js
1741
+ var PendingError = class extends Error {
1742
+ code = "VITEST_PENDING";
1743
+ taskId;
1744
+ constructor(message, task, note) {
1745
+ super(message);
1746
+ this.message = message;
1747
+ this.note = note;
1748
+ this.taskId = task.id;
1749
+ }
1750
+ };
1751
+ const fnMap = /* @__PURE__ */ new WeakMap();
1752
+ const testFixtureMap = /* @__PURE__ */ new WeakMap();
1753
+ const hooksMap = /* @__PURE__ */ new WeakMap();
1754
+ function setFn(key, fn) {
1755
+ fnMap.set(key, fn);
1756
+ }
1757
+ function setTestFixture(key, fixture) {
1758
+ testFixtureMap.set(key, fixture);
1759
+ }
1760
+ function getTestFixture(key) {
1761
+ return testFixtureMap.get(key);
1762
+ }
1763
+ function setHooks(key, hooks) {
1764
+ hooksMap.set(key, hooks);
1765
+ }
1766
+ function getHooks(key) {
1767
+ return hooksMap.get(key);
1768
+ }
1769
+ function mergeScopedFixtures(testFixtures, scopedFixtures) {
1770
+ const scopedFixturesMap = scopedFixtures.reduce((map, fixture) => {
1771
+ map[fixture.prop] = fixture;
1772
+ return map;
1773
+ }, {});
1774
+ const newFixtures = {};
1775
+ testFixtures.forEach((fixture) => {
1776
+ const useFixture = scopedFixturesMap[fixture.prop] || { ...fixture };
1777
+ newFixtures[useFixture.prop] = useFixture;
1778
+ });
1779
+ for (const fixtureKep in newFixtures) {
1780
+ var _fixture$deps;
1781
+ const fixture = newFixtures[fixtureKep];
1782
+ fixture.deps = (_fixture$deps = fixture.deps) === null || _fixture$deps === void 0 ? void 0 : _fixture$deps.map((dep) => newFixtures[dep.prop]);
1783
+ }
1784
+ return Object.values(newFixtures);
1785
+ }
1786
+ function mergeContextFixtures(fixtures, context, runner$1) {
1787
+ const fixtureOptionKeys = [
1788
+ "auto",
1789
+ "injected",
1790
+ "scope"
1791
+ ];
1792
+ const fixtureArray = Object.entries(fixtures).map(([prop, value]) => {
1793
+ const fixtureItem = { value };
1794
+ if (Array.isArray(value) && value.length >= 2 && isObject(value[1]) && Object.keys(value[1]).some((key) => fixtureOptionKeys.includes(key))) {
1795
+ var _runner$injectValue;
1796
+ Object.assign(fixtureItem, value[1]);
1797
+ const userValue = value[0];
1798
+ fixtureItem.value = fixtureItem.injected ? ((_runner$injectValue = runner$1.injectValue) === null || _runner$injectValue === void 0 ? void 0 : _runner$injectValue.call(runner$1, prop)) ?? userValue : userValue;
1799
+ }
1800
+ fixtureItem.scope = fixtureItem.scope || "test";
1801
+ if (fixtureItem.scope === "worker" && !runner$1.getWorkerContext) fixtureItem.scope = "file";
1802
+ fixtureItem.prop = prop;
1803
+ fixtureItem.isFn = typeof fixtureItem.value === "function";
1804
+ return fixtureItem;
1805
+ });
1806
+ if (Array.isArray(context.fixtures)) context.fixtures = context.fixtures.concat(fixtureArray);
1807
+ else context.fixtures = fixtureArray;
1808
+ fixtureArray.forEach((fixture) => {
1809
+ if (fixture.isFn) {
1810
+ const usedProps = getUsedProps(fixture.value);
1811
+ if (usedProps.length) fixture.deps = context.fixtures.filter(({ prop }) => prop !== fixture.prop && usedProps.includes(prop));
1812
+ if (fixture.scope !== "test") {
1813
+ var _fixture$deps2;
1814
+ (_fixture$deps2 = fixture.deps) === null || _fixture$deps2 === void 0 || _fixture$deps2.forEach((dep) => {
1815
+ if (!dep.isFn) return;
1816
+ if (fixture.scope === "worker" && dep.scope === "worker") return;
1817
+ if (fixture.scope === "file" && dep.scope !== "test") return;
1818
+ throw new SyntaxError(`cannot use the ${dep.scope} fixture "${dep.prop}" inside the ${fixture.scope} fixture "${fixture.prop}"`);
1819
+ });
1820
+ }
1821
+ }
1822
+ });
1823
+ return context;
1824
+ }
1825
+ const fixtureValueMaps = /* @__PURE__ */ new Map();
1826
+ const cleanupFnArrayMap = /* @__PURE__ */ new Map();
1827
+ function withFixtures(runner$1, fn, testContext) {
1828
+ return (hookContext) => {
1829
+ const context = hookContext || testContext;
1830
+ if (!context) return fn({});
1831
+ const fixtures = getTestFixture(context);
1832
+ if (!(fixtures === null || fixtures === void 0 ? void 0 : fixtures.length)) return fn(context);
1833
+ const usedProps = getUsedProps(fn);
1834
+ const hasAutoFixture = fixtures.some(({ auto }) => auto);
1835
+ if (!usedProps.length && !hasAutoFixture) return fn(context);
1836
+ if (!fixtureValueMaps.get(context)) fixtureValueMaps.set(context, /* @__PURE__ */ new Map());
1837
+ const fixtureValueMap = fixtureValueMaps.get(context);
1838
+ if (!cleanupFnArrayMap.has(context)) cleanupFnArrayMap.set(context, []);
1839
+ const cleanupFnArray = cleanupFnArrayMap.get(context);
1840
+ const pendingFixtures = resolveDeps(fixtures.filter(({ prop, auto }) => auto || usedProps.includes(prop)));
1841
+ if (!pendingFixtures.length) return fn(context);
1842
+ async function resolveFixtures() {
1843
+ for (const fixture of pendingFixtures) {
1844
+ if (fixtureValueMap.has(fixture)) continue;
1845
+ const resolvedValue = await resolveFixtureValue(runner$1, fixture, context, cleanupFnArray);
1846
+ context[fixture.prop] = resolvedValue;
1847
+ fixtureValueMap.set(fixture, resolvedValue);
1848
+ if (fixture.scope === "test") cleanupFnArray.unshift(() => {
1849
+ fixtureValueMap.delete(fixture);
1850
+ });
1851
+ }
1852
+ }
1853
+ return resolveFixtures().then(() => fn(context));
1854
+ };
1855
+ }
1856
+ const globalFixturePromise = /* @__PURE__ */ new WeakMap();
1857
+ function resolveFixtureValue(runner$1, fixture, context, cleanupFnArray) {
1858
+ var _runner$getWorkerCont;
1859
+ const fileContext = getFileContext(context.task.file);
1860
+ const workerContext = (_runner$getWorkerCont = runner$1.getWorkerContext) === null || _runner$getWorkerCont === void 0 ? void 0 : _runner$getWorkerCont.call(runner$1);
1861
+ if (!fixture.isFn) {
1862
+ var _fixture$prop;
1863
+ fileContext[_fixture$prop = fixture.prop] ?? (fileContext[_fixture$prop] = fixture.value);
1864
+ if (workerContext) {
1865
+ var _fixture$prop2;
1866
+ workerContext[_fixture$prop2 = fixture.prop] ?? (workerContext[_fixture$prop2] = fixture.value);
1867
+ }
1868
+ return fixture.value;
1869
+ }
1870
+ if (fixture.scope === "test") return resolveFixtureFunction(fixture.value, context, cleanupFnArray);
1871
+ if (globalFixturePromise.has(fixture)) return globalFixturePromise.get(fixture);
1872
+ let fixtureContext;
1873
+ if (fixture.scope === "worker") {
1874
+ if (!workerContext) throw new TypeError("[@vitest/runner] The worker context is not available in the current test runner. Please, provide the `getWorkerContext` method when initiating the runner.");
1875
+ fixtureContext = workerContext;
1876
+ } else fixtureContext = fileContext;
1877
+ if (fixture.prop in fixtureContext) return fixtureContext[fixture.prop];
1878
+ if (!cleanupFnArrayMap.has(fixtureContext)) cleanupFnArrayMap.set(fixtureContext, []);
1879
+ const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext);
1880
+ const promise = resolveFixtureFunction(fixture.value, fixtureContext, cleanupFnFileArray).then((value) => {
1881
+ fixtureContext[fixture.prop] = value;
1882
+ globalFixturePromise.delete(fixture);
1883
+ return value;
1884
+ });
1885
+ globalFixturePromise.set(fixture, promise);
1886
+ return promise;
1887
+ }
1888
+ async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) {
1889
+ const useFnArgPromise = createDefer();
1890
+ let isUseFnArgResolved = false;
1891
+ const fixtureReturn = fixtureFn(context, async (useFnArg) => {
1892
+ isUseFnArgResolved = true;
1893
+ useFnArgPromise.resolve(useFnArg);
1894
+ const useReturnPromise = createDefer();
1895
+ cleanupFnArray.push(async () => {
1896
+ useReturnPromise.resolve();
1897
+ await fixtureReturn;
1898
+ });
1899
+ await useReturnPromise;
1900
+ }).catch((e) => {
1901
+ if (!isUseFnArgResolved) {
1902
+ useFnArgPromise.reject(e);
1903
+ return;
1904
+ }
1905
+ throw e;
1906
+ });
1907
+ return useFnArgPromise;
1908
+ }
1909
+ function resolveDeps(fixtures, depSet = /* @__PURE__ */ new Set(), pendingFixtures = []) {
1910
+ fixtures.forEach((fixture) => {
1911
+ if (pendingFixtures.includes(fixture)) return;
1912
+ if (!fixture.isFn || !fixture.deps) {
1913
+ pendingFixtures.push(fixture);
1914
+ return;
1915
+ }
1916
+ if (depSet.has(fixture)) throw new Error(`Circular fixture dependency detected: ${fixture.prop} <- ${[...depSet].reverse().map((d$1) => d$1.prop).join(" <- ")}`);
1917
+ depSet.add(fixture);
1918
+ resolveDeps(fixture.deps, depSet, pendingFixtures);
1919
+ pendingFixtures.push(fixture);
1920
+ depSet.clear();
1921
+ });
1922
+ return pendingFixtures;
1923
+ }
1924
+ function getUsedProps(fn) {
1925
+ let fnString = filterOutComments(fn.toString());
1926
+ if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) fnString = fnString.split(/__async\((?:this|null),/)[1];
1927
+ const match = fnString.match(/[^(]*\(([^)]*)/);
1928
+ if (!match) return [];
1929
+ const args = splitByComma(match[1]);
1930
+ if (!args.length) return [];
1931
+ let first = args[0];
1932
+ if ("__VITEST_FIXTURE_INDEX__" in fn) {
1933
+ first = args[fn.__VITEST_FIXTURE_INDEX__];
1934
+ if (!first) return [];
1935
+ }
1936
+ if (!(first[0] === "{" && first.endsWith("}"))) throw new Error(`The first argument inside a fixture must use object destructuring pattern, e.g. ({ test } => {}). Instead, received "${first}".`);
1937
+ const props = splitByComma(first.slice(1, -1).replace(/\s/g, "")).map((prop) => {
1938
+ return prop.replace(/:.*|=.*/g, "");
1939
+ });
1940
+ const last = props.at(-1);
1941
+ if (last && last.startsWith("...")) throw new Error(`Rest parameters are not supported in fixtures, received "${last}".`);
1942
+ return props;
1943
+ }
1944
+ function filterOutComments(s) {
1945
+ const result = [];
1946
+ let commentState = "none";
1947
+ for (let i = 0; i < s.length; ++i) if (commentState === "singleline") {
1948
+ if (s[i] === "\n") commentState = "none";
1949
+ } else if (commentState === "multiline") {
1950
+ if (s[i - 1] === "*" && s[i] === "/") commentState = "none";
1951
+ } else if (commentState === "none") if (s[i] === "/" && s[i + 1] === "/") commentState = "singleline";
1952
+ else if (s[i] === "/" && s[i + 1] === "*") {
1953
+ commentState = "multiline";
1954
+ i += 2;
1955
+ } else result.push(s[i]);
1956
+ return result.join("");
1957
+ }
1958
+ function splitByComma(s) {
1959
+ const result = [];
1960
+ const stack = [];
1961
+ let start = 0;
1962
+ for (let i = 0; i < s.length; i++) if (s[i] === "{" || s[i] === "[") stack.push(s[i] === "{" ? "}" : "]");
1963
+ else if (s[i] === stack.at(-1)) stack.pop();
1964
+ else if (!stack.length && s[i] === ",") {
1965
+ const token = s.substring(start, i).trim();
1966
+ if (token) result.push(token);
1967
+ start = i + 1;
1968
+ }
1969
+ const lastToken = s.substring(start).trim();
1970
+ if (lastToken) result.push(lastToken);
1971
+ return result;
1972
+ }
1973
+ let _test;
1974
+ function getCurrentTest() {
1975
+ return _test;
1976
+ }
1977
+ function getDefaultHookTimeout() {
1978
+ return getRunner().config.hookTimeout;
1979
+ }
1980
+ const CLEANUP_TIMEOUT_KEY = Symbol.for("VITEST_CLEANUP_TIMEOUT");
1981
+ const CLEANUP_STACK_TRACE_KEY = Symbol.for("VITEST_CLEANUP_STACK_TRACE");
1982
+ /**
1983
+ * Registers a callback function to be executed once before all tests within the current suite.
1984
+ * This hook is useful for scenarios where you need to perform setup operations that are common to all tests in a suite, such as initializing a database connection or setting up a test environment.
1985
+ *
1986
+ * **Note:** The `beforeAll` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file.
1987
+ *
1988
+ * @param {Function} fn - The callback function to be executed before all tests.
1989
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
1990
+ * @returns {void}
1991
+ * @example
1992
+ * ```ts
1993
+ * // Example of using beforeAll to set up a database connection
1994
+ * beforeAll(async () => {
1995
+ * await database.connect();
1996
+ * });
1997
+ * ```
1998
+ */
1999
+ function beforeAll(fn, timeout = getDefaultHookTimeout()) {
2000
+ assertTypes(fn, "\"beforeAll\" callback", ["function"]);
2001
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2002
+ return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(fn, timeout, true, stackTraceError), {
2003
+ [CLEANUP_TIMEOUT_KEY]: timeout,
2004
+ [CLEANUP_STACK_TRACE_KEY]: stackTraceError
2005
+ }));
2006
+ }
2007
+ /**
2008
+ * Registers a callback function to be executed once after all tests within the current suite have completed.
2009
+ * This hook is useful for scenarios where you need to perform cleanup operations after all tests in a suite have run, such as closing database connections or cleaning up temporary files.
2010
+ *
2011
+ * **Note:** The `afterAll` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
2012
+ *
2013
+ * @param {Function} fn - The callback function to be executed after all tests.
2014
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2015
+ * @returns {void}
2016
+ * @example
2017
+ * ```ts
2018
+ * // Example of using afterAll to close a database connection
2019
+ * afterAll(async () => {
2020
+ * await database.disconnect();
2021
+ * });
2022
+ * ```
2023
+ */
2024
+ function afterAll(fn, timeout) {
2025
+ assertTypes(fn, "\"afterAll\" callback", ["function"]);
2026
+ return getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR")));
2027
+ }
2028
+ /**
2029
+ * Registers a callback function to be executed before each test within the current suite.
2030
+ * This hook is useful for scenarios where you need to reset or reinitialize the test environment before each test runs, such as resetting database states, clearing caches, or reinitializing variables.
2031
+ *
2032
+ * **Note:** The `beforeEach` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file.
2033
+ *
2034
+ * @param {Function} fn - The callback function to be executed before each test. This function receives an `TestContext` parameter if additional test context is needed.
2035
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2036
+ * @returns {void}
2037
+ * @example
2038
+ * ```ts
2039
+ * // Example of using beforeEach to reset a database state
2040
+ * beforeEach(async () => {
2041
+ * await database.reset();
2042
+ * });
2043
+ * ```
2044
+ */
2045
+ function beforeEach(fn, timeout = getDefaultHookTimeout()) {
2046
+ assertTypes(fn, "\"beforeEach\" callback", ["function"]);
2047
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2048
+ const runner$1 = getRunner();
2049
+ return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(withFixtures(runner$1, fn), timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), {
2050
+ [CLEANUP_TIMEOUT_KEY]: timeout,
2051
+ [CLEANUP_STACK_TRACE_KEY]: stackTraceError
2052
+ }));
2053
+ }
2054
+ /**
2055
+ * Registers a callback function to be executed after each test within the current suite has completed.
2056
+ * This hook is useful for scenarios where you need to clean up or reset the test environment after each test runs, such as deleting temporary files, clearing test-specific database entries, or resetting mocked functions.
2057
+ *
2058
+ * **Note:** The `afterEach` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
2059
+ *
2060
+ * @param {Function} fn - The callback function to be executed after each test. This function receives an `TestContext` parameter if additional test context is needed.
2061
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2062
+ * @returns {void}
2063
+ * @example
2064
+ * ```ts
2065
+ * // Example of using afterEach to delete temporary files created during a test
2066
+ * afterEach(async () => {
2067
+ * await fileSystem.deleteTempFiles();
2068
+ * });
2069
+ * ```
2070
+ */
2071
+ function afterEach(fn, timeout) {
2072
+ assertTypes(fn, "\"afterEach\" callback", ["function"]);
2073
+ const runner$1 = getRunner();
2074
+ return getCurrentSuite().on("afterEach", withTimeout(withFixtures(runner$1, fn), timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2075
+ }
2076
+ /**
2077
+ * Registers a callback function to be executed when a test fails within the current suite.
2078
+ * This function allows for custom actions to be performed in response to test failures, such as logging, cleanup, or additional diagnostics.
2079
+ *
2080
+ * **Note:** The `onTestFailed` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
2081
+ *
2082
+ * @param {Function} fn - The callback function to be executed upon a test failure. The function receives the test result (including errors).
2083
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2084
+ * @throws {Error} Throws an error if the function is not called within a test.
2085
+ * @returns {void}
2086
+ * @example
2087
+ * ```ts
2088
+ * // Example of using onTestFailed to log failure details
2089
+ * onTestFailed(({ errors }) => {
2090
+ * console.log(`Test failed: ${test.name}`, errors);
2091
+ * });
2092
+ * ```
2093
+ */
2094
+ const onTestFailed = createTestHook("onTestFailed", (test$7, handler, timeout) => {
2095
+ test$7.onFailed || (test$7.onFailed = []);
2096
+ test$7.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2097
+ });
2098
+ /**
2099
+ * Registers a callback function to be executed when the current test finishes, regardless of the outcome (pass or fail).
2100
+ * This function is ideal for performing actions that should occur after every test execution, such as cleanup, logging, or resetting shared resources.
2101
+ *
2102
+ * This hook is useful if you have access to a resource in the test itself and you want to clean it up after the test finishes. It is a more compact way to clean up resources than using the combination of `beforeEach` and `afterEach`.
2103
+ *
2104
+ * **Note:** The `onTestFinished` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
2105
+ *
2106
+ * **Note:** The `onTestFinished` hook is not called if the test is canceled with a dynamic `ctx.skip()` call.
2107
+ *
2108
+ * @param {Function} fn - The callback function to be executed after a test finishes. The function can receive parameters providing details about the completed test, including its success or failure status.
2109
+ * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
2110
+ * @throws {Error} Throws an error if the function is not called within a test.
2111
+ * @returns {void}
2112
+ * @example
2113
+ * ```ts
2114
+ * // Example of using onTestFinished for cleanup
2115
+ * const db = await connectToDatabase();
2116
+ * onTestFinished(async () => {
2117
+ * await db.disconnect();
2118
+ * });
2119
+ * ```
2120
+ */
2121
+ const onTestFinished = createTestHook("onTestFinished", (test$7, handler, timeout) => {
2122
+ test$7.onFinished || (test$7.onFinished = []);
2123
+ test$7.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), abortIfTimeout));
2124
+ });
2125
+ function createTestHook(name, handler) {
2126
+ return (fn, timeout) => {
2127
+ assertTypes(fn, `"${name}" callback`, ["function"]);
2128
+ const current = getCurrentTest();
2129
+ if (!current) throw new Error(`Hook ${name}() can only be called inside a test`);
2130
+ return handler(current, fn, timeout);
2131
+ };
2132
+ }
2133
+ /**
2134
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
2135
+ * Suites can contain both tests and other suites, enabling complex test structures.
2136
+ *
2137
+ * @param {string} name - The name of the suite, used for identification and reporting.
2138
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
2139
+ * @example
2140
+ * ```ts
2141
+ * // Define a suite with two tests
2142
+ * suite('Math operations', () => {
2143
+ * test('should add two numbers', () => {
2144
+ * expect(add(1, 2)).toBe(3);
2145
+ * });
2146
+ *
2147
+ * test('should subtract two numbers', () => {
2148
+ * expect(subtract(5, 2)).toBe(3);
2149
+ * });
2150
+ * });
2151
+ * ```
2152
+ * @example
2153
+ * ```ts
2154
+ * // Define nested suites
2155
+ * suite('String operations', () => {
2156
+ * suite('Trimming', () => {
2157
+ * test('should trim whitespace from start and end', () => {
2158
+ * expect(' hello '.trim()).toBe('hello');
2159
+ * });
2160
+ * });
2161
+ *
2162
+ * suite('Concatenation', () => {
2163
+ * test('should concatenate two strings', () => {
2164
+ * expect('hello' + ' ' + 'world').toBe('hello world');
2165
+ * });
2166
+ * });
2167
+ * });
2168
+ * ```
2169
+ */
2170
+ const suite = createSuite();
2171
+ /**
2172
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
2173
+ *
2174
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
2175
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
2176
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
2177
+ * @throws {Error} If called inside another test function.
2178
+ * @example
2179
+ * ```ts
2180
+ * // Define a simple test
2181
+ * test('should add two numbers', () => {
2182
+ * expect(add(1, 2)).toBe(3);
2183
+ * });
2184
+ * ```
2185
+ * @example
2186
+ * ```ts
2187
+ * // Define a test with options
2188
+ * test('should subtract two numbers', { retry: 3 }, () => {
2189
+ * expect(subtract(5, 2)).toBe(3);
2190
+ * });
2191
+ * ```
2192
+ */
2193
+ const test = createTest(function(name, optionsOrFn, optionsOrTest) {
2194
+ if (getCurrentTest()) throw new Error("Calling the test function inside another test function is not allowed. Please put it inside \"describe\" or \"suite\" so it can be properly collected.");
2195
+ getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest);
2196
+ });
2197
+ let runner;
2198
+ let defaultSuite;
2199
+ let currentTestFilepath;
2200
+ function assert(condition, message) {
2201
+ if (!condition) throw new Error(`Vitest failed to find ${message}. One of the following is possible:
2202
+ - "vitest" is imported directly without running "vitest" command
2203
+ - "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
2204
+ - "vitest" is imported inside Vite / Vitest config file
2205
+ - Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
2206
+ `);
2207
+ }
2208
+ function getRunner() {
2209
+ assert(runner, "the runner");
2210
+ return runner;
2211
+ }
2212
+ function getCurrentSuite() {
2213
+ const currentSuite = collectorContext.currentSuite || defaultSuite;
2214
+ assert(currentSuite, "the current suite");
2215
+ return currentSuite;
2216
+ }
2217
+ function createSuiteHooks() {
2218
+ return {
2219
+ beforeAll: [],
2220
+ afterAll: [],
2221
+ beforeEach: [],
2222
+ afterEach: []
2223
+ };
2224
+ }
2225
+ function parseArguments(optionsOrFn, timeoutOrTest) {
2226
+ if (timeoutOrTest != null && typeof timeoutOrTest === "object") throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`);
2227
+ let options = {};
2228
+ let fn;
2229
+ if (typeof timeoutOrTest === "number") options = { timeout: timeoutOrTest };
2230
+ else if (typeof optionsOrFn === "object") options = optionsOrFn;
2231
+ if (typeof optionsOrFn === "function") {
2232
+ if (typeof timeoutOrTest === "function") throw new TypeError("Cannot use two functions as arguments. Please use the second argument for options.");
2233
+ fn = optionsOrFn;
2234
+ } else if (typeof timeoutOrTest === "function") fn = timeoutOrTest;
2235
+ return {
2236
+ options,
2237
+ handler: fn
2238
+ };
2239
+ }
2240
+ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions, parentCollectorFixtures) {
2241
+ const tasks = [];
2242
+ let suite$1;
2243
+ initSuite(true);
2244
+ const task = function(name$1 = "", options = {}) {
2245
+ var _collectorContext$cur, _collectorContext$cur2, _collectorContext$cur3;
2246
+ const timeout = (options === null || options === void 0 ? void 0 : options.timeout) ?? runner.config.testTimeout;
2247
+ const currentSuite = (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.suite;
2248
+ const task$1 = {
2249
+ id: "",
2250
+ name: name$1,
2251
+ fullName: createTaskName([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur2 = collectorContext.currentSuite) === null || _collectorContext$cur2 === void 0 || (_collectorContext$cur2 = _collectorContext$cur2.file) === null || _collectorContext$cur2 === void 0 ? void 0 : _collectorContext$cur2.fullName), name$1]),
2252
+ fullTestName: createTaskName([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name$1]),
2253
+ suite: currentSuite,
2254
+ each: options.each,
2255
+ fails: options.fails,
2256
+ context: void 0,
2257
+ type: "test",
2258
+ file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur3 = collectorContext.currentSuite) === null || _collectorContext$cur3 === void 0 ? void 0 : _collectorContext$cur3.file),
2259
+ timeout,
2260
+ retry: options.retry ?? runner.config.retry,
2261
+ repeats: options.repeats,
2262
+ mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run",
2263
+ meta: options.meta ?? Object.create(null),
2264
+ annotations: [],
2265
+ artifacts: []
2266
+ };
2267
+ const handler = options.handler;
2268
+ if (task$1.mode === "run" && !handler) task$1.mode = "todo";
2269
+ if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) task$1.concurrent = true;
2270
+ task$1.shuffle = suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle;
2271
+ const context = createTestContext(task$1, runner);
2272
+ Object.defineProperty(task$1, "context", {
2273
+ value: context,
2274
+ enumerable: false
2275
+ });
2276
+ setTestFixture(context, options.fixtures);
2277
+ const limit = Error.stackTraceLimit;
2278
+ Error.stackTraceLimit = 15;
2279
+ const stackTraceError = /* @__PURE__ */ new Error("STACK_TRACE_ERROR");
2280
+ Error.stackTraceLimit = limit;
2281
+ if (handler) setFn(task$1, withTimeout(withAwaitAsyncAssertions(withFixtures(runner, handler, context), task$1), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error)));
2282
+ if (runner.config.includeTaskLocation) {
2283
+ const error = stackTraceError.stack;
2284
+ const stack = findTestFileStackTrace(currentTestFilepath, error);
2285
+ if (stack) task$1.location = {
2286
+ line: stack.line,
2287
+ column: stack.column
2288
+ };
2289
+ }
2290
+ tasks.push(task$1);
2291
+ return task$1;
2292
+ };
2293
+ const test$7 = createTest(function(name$1, optionsOrFn, timeoutOrTest) {
2294
+ let { options, handler } = parseArguments(optionsOrFn, timeoutOrTest);
2295
+ if (typeof suiteOptions === "object") options = Object.assign({}, suiteOptions, options);
2296
+ options.concurrent = this.concurrent || !this.sequential && (options === null || options === void 0 ? void 0 : options.concurrent);
2297
+ options.sequential = this.sequential || !this.concurrent && (options === null || options === void 0 ? void 0 : options.sequential);
2298
+ const test$8 = task(formatName(name$1), {
2299
+ ...this,
2300
+ ...options,
2301
+ handler
2302
+ });
2303
+ test$8.type = "test";
2304
+ });
2305
+ let collectorFixtures = parentCollectorFixtures;
2306
+ const collector = {
2307
+ type: "collector",
2308
+ name,
2309
+ mode,
2310
+ suite: suite$1,
2311
+ options: suiteOptions,
2312
+ test: test$7,
2313
+ tasks,
2314
+ collect,
2315
+ task,
2316
+ clear,
2317
+ on: addHook,
2318
+ fixtures() {
2319
+ return collectorFixtures;
2320
+ },
2321
+ scoped(fixtures) {
2322
+ const parsed = mergeContextFixtures(fixtures, { fixtures: collectorFixtures }, runner);
2323
+ if (parsed.fixtures) collectorFixtures = parsed.fixtures;
2324
+ }
2325
+ };
2326
+ function addHook(name$1, ...fn) {
2327
+ getHooks(suite$1)[name$1].push(...fn);
2328
+ }
2329
+ function initSuite(includeLocation) {
2330
+ var _collectorContext$cur4, _collectorContext$cur5, _collectorContext$cur6;
2331
+ if (typeof suiteOptions === "number") suiteOptions = { timeout: suiteOptions };
2332
+ const currentSuite = (_collectorContext$cur4 = collectorContext.currentSuite) === null || _collectorContext$cur4 === void 0 ? void 0 : _collectorContext$cur4.suite;
2333
+ suite$1 = {
2334
+ id: "",
2335
+ type: "suite",
2336
+ name,
2337
+ fullName: createTaskName([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur5 = collectorContext.currentSuite) === null || _collectorContext$cur5 === void 0 || (_collectorContext$cur5 = _collectorContext$cur5.file) === null || _collectorContext$cur5 === void 0 ? void 0 : _collectorContext$cur5.fullName), name]),
2338
+ fullTestName: createTaskName([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name]),
2339
+ suite: currentSuite,
2340
+ mode,
2341
+ each,
2342
+ file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur6 = collectorContext.currentSuite) === null || _collectorContext$cur6 === void 0 ? void 0 : _collectorContext$cur6.file),
2343
+ shuffle: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle,
2344
+ tasks: [],
2345
+ meta: Object.create(null),
2346
+ concurrent: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.concurrent
2347
+ };
2348
+ if (runner && includeLocation && runner.config.includeTaskLocation) {
2349
+ const limit = Error.stackTraceLimit;
2350
+ Error.stackTraceLimit = 15;
2351
+ const error = (/* @__PURE__ */ new Error("stacktrace")).stack;
2352
+ Error.stackTraceLimit = limit;
2353
+ const stack = findTestFileStackTrace(currentTestFilepath, error);
2354
+ if (stack) suite$1.location = {
2355
+ line: stack.line,
2356
+ column: stack.column
2357
+ };
2358
+ }
2359
+ setHooks(suite$1, createSuiteHooks());
2360
+ }
2361
+ function clear() {
2362
+ tasks.length = 0;
2363
+ initSuite(false);
2364
+ }
2365
+ async function collect(file) {
2366
+ if (!file) throw new TypeError("File is required to collect tasks.");
2367
+ if (factory) await runWithSuite(collector, () => factory(test$7));
2368
+ const allChildren = [];
2369
+ for (const i of tasks) allChildren.push(i.type === "collector" ? await i.collect(file) : i);
2370
+ suite$1.tasks = allChildren;
2371
+ return suite$1;
2372
+ }
2373
+ collectTask(collector);
2374
+ return collector;
2375
+ }
2376
+ function withAwaitAsyncAssertions(fn, task) {
2377
+ return (async (...args) => {
2378
+ const fnResult = await fn(...args);
2379
+ if (task.promises) {
2380
+ const errors = (await Promise.allSettled(task.promises)).map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
2381
+ if (errors.length) throw errors;
2382
+ }
2383
+ return fnResult;
2384
+ });
2385
+ }
2386
+ function createSuite() {
2387
+ function suiteFn(name, factoryOrOptions, optionsOrFactory) {
2388
+ var _currentSuite$options;
2389
+ if (getCurrentTest()) throw new Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function.");
2390
+ let mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run";
2391
+ const currentSuite = collectorContext.currentSuite || defaultSuite;
2392
+ let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory);
2393
+ if (mode === "run" && !factory) mode = "todo";
2394
+ const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false;
2395
+ const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false;
2396
+ options = {
2397
+ ...currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.options,
2398
+ ...options,
2399
+ shuffle: this.shuffle ?? options.shuffle ?? (currentSuite === null || currentSuite === void 0 || (_currentSuite$options = currentSuite.options) === null || _currentSuite$options === void 0 ? void 0 : _currentSuite$options.shuffle) ?? (runner === null || runner === void 0 ? void 0 : runner.config.sequence.shuffle)
2400
+ };
2401
+ const isConcurrent = isConcurrentSpecified || options.concurrent && !isSequentialSpecified;
2402
+ const isSequential = isSequentialSpecified || options.sequential && !isConcurrentSpecified;
2403
+ options.concurrent = isConcurrent && !isSequential;
2404
+ options.sequential = isSequential && !isConcurrent;
2405
+ return createSuiteCollector(formatName(name), factory, mode, this.each, options, currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fixtures());
2406
+ }
2407
+ suiteFn.each = function(cases, ...args) {
2408
+ const suite$1 = this.withContext();
2409
+ this.setContext("each", true);
2410
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
2411
+ return (name, optionsOrFn, fnOrOptions) => {
2412
+ const _name = formatName(name);
2413
+ const arrayOnlyCases = cases.every(Array.isArray);
2414
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
2415
+ const fnFirst = typeof optionsOrFn === "function";
2416
+ cases.forEach((i, idx) => {
2417
+ const items = Array.isArray(i) ? i : [i];
2418
+ if (fnFirst) if (arrayOnlyCases) suite$1(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
2419
+ else suite$1(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
2420
+ else if (arrayOnlyCases) suite$1(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
2421
+ else suite$1(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
2422
+ });
2423
+ this.setContext("each", void 0);
2424
+ };
2425
+ };
2426
+ suiteFn.for = function(cases, ...args) {
2427
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
2428
+ return (name, optionsOrFn, fnOrOptions) => {
2429
+ const name_ = formatName(name);
2430
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
2431
+ cases.forEach((item, idx) => {
2432
+ suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : void 0);
2433
+ });
2434
+ };
2435
+ };
2436
+ suiteFn.skipIf = (condition) => condition ? suite.skip : suite;
2437
+ suiteFn.runIf = (condition) => condition ? suite : suite.skip;
2438
+ return createChainable([
2439
+ "concurrent",
2440
+ "sequential",
2441
+ "shuffle",
2442
+ "skip",
2443
+ "only",
2444
+ "todo"
2445
+ ], suiteFn);
2446
+ }
2447
+ function createTaskCollector(fn, context) {
2448
+ const taskFn = fn;
2449
+ taskFn.each = function(cases, ...args) {
2450
+ const test$7 = this.withContext();
2451
+ this.setContext("each", true);
2452
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
2453
+ return (name, optionsOrFn, fnOrOptions) => {
2454
+ const _name = formatName(name);
2455
+ const arrayOnlyCases = cases.every(Array.isArray);
2456
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
2457
+ const fnFirst = typeof optionsOrFn === "function";
2458
+ cases.forEach((i, idx) => {
2459
+ const items = Array.isArray(i) ? i : [i];
2460
+ if (fnFirst) if (arrayOnlyCases) test$7(formatTitle(_name, items, idx), handler ? () => handler(...items) : void 0, options.timeout);
2461
+ else test$7(formatTitle(_name, items, idx), handler ? () => handler(i) : void 0, options.timeout);
2462
+ else if (arrayOnlyCases) test$7(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : void 0);
2463
+ else test$7(formatTitle(_name, items, idx), options, handler ? () => handler(i) : void 0);
2464
+ });
2465
+ this.setContext("each", void 0);
2466
+ };
2467
+ };
2468
+ taskFn.for = function(cases, ...args) {
2469
+ const test$7 = this.withContext();
2470
+ if (Array.isArray(cases) && args.length) cases = formatTemplateString(cases, args);
2471
+ return (name, optionsOrFn, fnOrOptions) => {
2472
+ const _name = formatName(name);
2473
+ const { options, handler } = parseArguments(optionsOrFn, fnOrOptions);
2474
+ cases.forEach((item, idx) => {
2475
+ const handlerWrapper = handler ? (ctx) => handler(item, ctx) : void 0;
2476
+ if (handlerWrapper) {
2477
+ handlerWrapper.__VITEST_FIXTURE_INDEX__ = 1;
2478
+ handlerWrapper.toString = () => handler.toString();
2479
+ }
2480
+ test$7(formatTitle(_name, toArray(item), idx), options, handlerWrapper);
2481
+ });
2482
+ };
2483
+ };
2484
+ taskFn.skipIf = function(condition) {
2485
+ return condition ? this.skip : this;
2486
+ };
2487
+ taskFn.runIf = function(condition) {
2488
+ return condition ? this : this.skip;
2489
+ };
2490
+ taskFn.scoped = function(fixtures) {
2491
+ getCurrentSuite().scoped(fixtures);
2492
+ };
2493
+ taskFn.extend = function(fixtures) {
2494
+ const _context = mergeContextFixtures(fixtures, context || {}, runner);
2495
+ const originalWrapper = fn;
2496
+ return createTest(function(name, optionsOrFn, optionsOrTest) {
2497
+ const scopedFixtures = getCurrentSuite().fixtures();
2498
+ const context$1 = { ...this };
2499
+ if (scopedFixtures) context$1.fixtures = mergeScopedFixtures(context$1.fixtures || [], scopedFixtures);
2500
+ originalWrapper.call(context$1, formatName(name), optionsOrFn, optionsOrTest);
2501
+ }, _context);
2502
+ };
2503
+ taskFn.beforeEach = beforeEach;
2504
+ taskFn.afterEach = afterEach;
2505
+ taskFn.beforeAll = beforeAll;
2506
+ taskFn.afterAll = afterAll;
2507
+ const _test$1 = createChainable([
2508
+ "concurrent",
2509
+ "sequential",
2510
+ "skip",
2511
+ "only",
2512
+ "todo",
2513
+ "fails"
2514
+ ], taskFn);
2515
+ if (context) _test$1.mergeContext(context);
2516
+ return _test$1;
2517
+ }
2518
+ function createTest(fn, context) {
2519
+ return createTaskCollector(fn, context);
2520
+ }
2521
+ function formatName(name) {
2522
+ return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
2523
+ }
2524
+ function formatTitle(template, items, idx) {
2525
+ if (template.includes("%#") || template.includes("%$")) template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/%\$/g, `${idx + 1}`).replace(/__vitest_escaped_%__/g, "%%");
2526
+ const count = template.split("%").length - 1;
2527
+ if (template.includes("%f")) (template.match(/%f/g) || []).forEach((_, i$1) => {
2528
+ if (isNegativeNaN(items[i$1]) || Object.is(items[i$1], -0)) {
2529
+ let occurrence = 0;
2530
+ template = template.replace(/%f/g, (match) => {
2531
+ occurrence++;
2532
+ return occurrence === i$1 + 1 ? "-%f" : match;
2533
+ });
2534
+ }
2535
+ });
2536
+ const isObjectItem = isObject(items[0]);
2537
+ function formatAttribute(s) {
2538
+ return s.replace(/\$([$\w.]+)/g, (_, key) => {
2539
+ var _runner$config;
2540
+ const isArrayKey = /^\d+$/.test(key);
2541
+ if (!isObjectItem && !isArrayKey) return `$${key}`;
2542
+ const arrayElement = isArrayKey ? objectAttr(items, key) : void 0;
2543
+ return objDisplay(isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement, { truncate: runner === null || runner === void 0 || (_runner$config = runner.config) === null || _runner$config === void 0 || (_runner$config = _runner$config.chaiConfig) === null || _runner$config === void 0 ? void 0 : _runner$config.truncateThreshold });
2544
+ });
2545
+ }
2546
+ let output = "";
2547
+ let i = 0;
2548
+ handleRegexMatch(template, formatRegExp, (match) => {
2549
+ if (i < count) output += format(match[0], items[i++]);
2550
+ else output += match[0];
2551
+ }, (nonMatch) => {
2552
+ output += formatAttribute(nonMatch);
2553
+ });
2554
+ return output;
2555
+ }
2556
+ function handleRegexMatch(input, regex, onMatch, onNonMatch) {
2557
+ let lastIndex = 0;
2558
+ for (const m of input.matchAll(regex)) {
2559
+ if (lastIndex < m.index) onNonMatch(input.slice(lastIndex, m.index));
2560
+ onMatch(m);
2561
+ lastIndex = m.index + m[0].length;
2562
+ }
2563
+ if (lastIndex < input.length) onNonMatch(input.slice(lastIndex));
2564
+ }
2565
+ function formatTemplateString(cases, args) {
2566
+ const header = cases.join("").trim().replace(/ /g, "").split("\n").map((i) => i.split("|"))[0];
2567
+ const res = [];
2568
+ for (let i = 0; i < Math.floor(args.length / header.length); i++) {
2569
+ const oneCase = {};
2570
+ for (let j = 0; j < header.length; j++) oneCase[header[j]] = args[i * header.length + j];
2571
+ res.push(oneCase);
2572
+ }
2573
+ return res;
2574
+ }
2575
+ const now$2 = Date.now;
2576
+ const collectorContext = {
2577
+ tasks: [],
2578
+ currentSuite: null
2579
+ };
2580
+ function collectTask(task) {
2581
+ var _collectorContext$cur;
2582
+ (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 || _collectorContext$cur.tasks.push(task);
2583
+ }
2584
+ async function runWithSuite(suite$1, fn) {
2585
+ const prev = collectorContext.currentSuite;
2586
+ collectorContext.currentSuite = suite$1;
2587
+ await fn();
2588
+ collectorContext.currentSuite = prev;
2589
+ }
2590
+ function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
2591
+ if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) return fn;
2592
+ const { setTimeout: setTimeout$2, clearTimeout: clearTimeout$1 } = getSafeTimers();
2593
+ return (function runWithTimeout(...args) {
2594
+ const startTime = now$2();
2595
+ const runner$1 = getRunner();
2596
+ runner$1._currentTaskStartTime = startTime;
2597
+ runner$1._currentTaskTimeout = timeout;
2598
+ return new Promise((resolve_, reject_) => {
2599
+ var _timer$unref;
2600
+ const timer = setTimeout$2(() => {
2601
+ clearTimeout$1(timer);
2602
+ rejectTimeoutError();
2603
+ }, timeout);
2604
+ (_timer$unref = timer.unref) === null || _timer$unref === void 0 || _timer$unref.call(timer);
2605
+ function rejectTimeoutError() {
2606
+ const error = makeTimeoutError(isHook, timeout, stackTraceError);
2607
+ onTimeout === null || onTimeout === void 0 || onTimeout(args, error);
2608
+ reject_(error);
2609
+ }
2610
+ function resolve$1(result) {
2611
+ runner$1._currentTaskStartTime = void 0;
2612
+ runner$1._currentTaskTimeout = void 0;
2613
+ clearTimeout$1(timer);
2614
+ if (now$2() - startTime >= timeout) {
2615
+ rejectTimeoutError();
2616
+ return;
2617
+ }
2618
+ resolve_(result);
2619
+ }
2620
+ function reject(error) {
2621
+ runner$1._currentTaskStartTime = void 0;
2622
+ runner$1._currentTaskTimeout = void 0;
2623
+ clearTimeout$1(timer);
2624
+ reject_(error);
2625
+ }
2626
+ try {
2627
+ const result = fn(...args);
2628
+ if (typeof result === "object" && result != null && typeof result.then === "function") result.then(resolve$1, reject);
2629
+ else resolve$1(result);
2630
+ } catch (error) {
2631
+ reject(error);
2632
+ }
2633
+ });
2634
+ });
2635
+ }
2636
+ const abortControllers = /* @__PURE__ */ new WeakMap();
2637
+ function abortIfTimeout([context], error) {
2638
+ if (context) abortContextSignal(context, error);
2639
+ }
2640
+ function abortContextSignal(context, error) {
2641
+ const abortController = abortControllers.get(context);
2642
+ abortController === null || abortController === void 0 || abortController.abort(error);
2643
+ }
2644
+ function createTestContext(test$7, runner$1) {
2645
+ var _runner$extendTaskCon;
2646
+ const context = function() {
2647
+ throw new Error("done() callback is deprecated, use promise instead");
2648
+ };
2649
+ let abortController = abortControllers.get(context);
2650
+ if (!abortController) {
2651
+ abortController = new AbortController();
2652
+ abortControllers.set(context, abortController);
2653
+ }
2654
+ context.signal = abortController.signal;
2655
+ context.task = test$7;
2656
+ context.skip = (condition, note) => {
2657
+ if (condition === false) return;
2658
+ test$7.result ?? (test$7.result = { state: "skip" });
2659
+ test$7.result.pending = true;
2660
+ throw new PendingError("test is skipped; abort execution", test$7, typeof condition === "string" ? condition : note);
2661
+ };
2662
+ context.annotate = ((message, type, attachment) => {
2663
+ if (test$7.result && test$7.result.state !== "run") throw new Error(`Cannot annotate tests outside of the test run. The test "${test$7.name}" finished running with the "${test$7.result.state}" state already.`);
2664
+ const annotation = {
2665
+ message,
2666
+ type: typeof type === "object" || type === void 0 ? "notice" : type
2667
+ };
2668
+ const annotationAttachment = typeof type === "object" ? type : attachment;
2669
+ if (annotationAttachment) {
2670
+ annotation.attachment = annotationAttachment;
2671
+ manageArtifactAttachment(annotation.attachment);
2672
+ }
2673
+ return recordAsyncOperation(test$7, recordArtifact(test$7, {
2674
+ type: "internal:annotation",
2675
+ annotation
2676
+ }).then(async ({ annotation: annotation$1 }) => {
2677
+ if (!runner$1.onTestAnnotate) throw new Error(`Test runner doesn't support test annotations.`);
2678
+ await finishSendTasksUpdate(runner$1);
2679
+ const resolvedAnnotation = await runner$1.onTestAnnotate(test$7, annotation$1);
2680
+ test$7.annotations.push(resolvedAnnotation);
2681
+ return resolvedAnnotation;
2682
+ }));
2683
+ });
2684
+ context.onTestFailed = (handler, timeout) => {
2685
+ test$7.onFailed || (test$7.onFailed = []);
2686
+ test$7.onFailed.push(withTimeout(handler, timeout ?? runner$1.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
2687
+ };
2688
+ context.onTestFinished = (handler, timeout) => {
2689
+ test$7.onFinished || (test$7.onFinished = []);
2690
+ test$7.onFinished.push(withTimeout(handler, timeout ?? runner$1.config.hookTimeout, true, /* @__PURE__ */ new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
2691
+ };
2692
+ return ((_runner$extendTaskCon = runner$1.extendTaskContext) === null || _runner$extendTaskCon === void 0 ? void 0 : _runner$extendTaskCon.call(runner$1, context)) || context;
2693
+ }
2694
+ function makeTimeoutError(isHook, timeout, stackTraceError) {
2695
+ const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.\nIf this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`;
2696
+ const error = new Error(message);
2697
+ if (stackTraceError === null || stackTraceError === void 0 ? void 0 : stackTraceError.stack) error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message);
2698
+ return error;
2699
+ }
2700
+ const fileContexts = /* @__PURE__ */ new WeakMap();
2701
+ function getFileContext(file) {
2702
+ const context = fileContexts.get(file);
2703
+ if (!context) throw new Error(`Cannot find file context for ${file.name}`);
2704
+ return context;
2705
+ }
2706
+ const now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2707
+ const now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
2708
+ const unixNow = Date.now;
2709
+ const { clearTimeout, setTimeout: setTimeout$1 } = getSafeTimers();
2710
+ const packs = /* @__PURE__ */ new Map();
2711
+ const eventsPacks = [];
2712
+ const pendingTasksUpdates = [];
2713
+ function sendTasksUpdate(runner$1) {
2714
+ if (packs.size) {
2715
+ var _runner$onTaskUpdate;
2716
+ const taskPacks = Array.from(packs).map(([id, task]) => {
2717
+ return [
2718
+ id,
2719
+ task[0],
2720
+ task[1]
2721
+ ];
2722
+ });
2723
+ const p = (_runner$onTaskUpdate = runner$1.onTaskUpdate) === null || _runner$onTaskUpdate === void 0 ? void 0 : _runner$onTaskUpdate.call(runner$1, taskPacks, eventsPacks);
2724
+ if (p) {
2725
+ pendingTasksUpdates.push(p);
2726
+ p.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p), 1), () => {});
2727
+ }
2728
+ eventsPacks.length = 0;
2729
+ packs.clear();
2730
+ }
2731
+ }
2732
+ async function finishSendTasksUpdate(runner$1) {
2733
+ sendTasksUpdate(runner$1);
2734
+ await Promise.all(pendingTasksUpdates);
2735
+ }
2736
+ function throttle(fn, ms) {
2737
+ let last = 0;
2738
+ let pendingCall;
2739
+ return function call(...args) {
2740
+ const now$3 = unixNow();
2741
+ if (now$3 - last > ms) {
2742
+ last = now$3;
2743
+ clearTimeout(pendingCall);
2744
+ pendingCall = void 0;
2745
+ return fn.apply(this, args);
2746
+ }
2747
+ pendingCall ?? (pendingCall = setTimeout$1(() => call.bind(this)(...args), ms));
2748
+ };
2749
+ }
2750
+ const sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100);
2751
+ /**
2752
+ * @experimental
2753
+ * @advanced
2754
+ *
2755
+ * Records a custom test artifact during test execution.
2756
+ *
2757
+ * This function allows you to attach structured data, files, or metadata to a test.
2758
+ *
2759
+ * Vitest automatically injects the source location where the artifact was created and manages any attachments you include.
2760
+ *
2761
+ * @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests
2762
+ * @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase}
2763
+ *
2764
+ * @returns A promise that resolves to the recorded artifact with location injected
2765
+ *
2766
+ * @throws {Error} If called after the test has finished running
2767
+ * @throws {Error} If the test runner doesn't support artifacts
2768
+ *
2769
+ * @example
2770
+ * ```ts
2771
+ * // In a custom assertion
2772
+ * async function toHaveValidSchema(this: MatcherState, actual: unknown) {
2773
+ * const validation = validateSchema(actual)
2774
+ *
2775
+ * await recordArtifact(this.task, {
2776
+ * type: 'my-plugin:schema-validation',
2777
+ * passed: validation.valid,
2778
+ * errors: validation.errors,
2779
+ * })
2780
+ *
2781
+ * return { pass: validation.valid, message: () => '...' }
2782
+ * }
2783
+ * ```
2784
+ */
2785
+ async function recordArtifact(task, artifact) {
2786
+ const runner$1 = getRunner();
2787
+ if (task.result && task.result.state !== "run") throw new Error(`Cannot record a test artifact outside of the test run. The test "${task.name}" finished running with the "${task.result.state}" state already.`);
2788
+ const stack = findTestFileStackTrace(task.file.filepath, (/* @__PURE__ */ new Error("STACK_TRACE")).stack);
2789
+ if (stack) {
2790
+ artifact.location = {
2791
+ file: stack.file,
2792
+ line: stack.line,
2793
+ column: stack.column
2794
+ };
2795
+ if (artifact.type === "internal:annotation") artifact.annotation.location = artifact.location;
2796
+ }
2797
+ if (Array.isArray(artifact.attachments)) for (const attachment of artifact.attachments) manageArtifactAttachment(attachment);
2798
+ if (artifact.type === "internal:annotation") return artifact;
2799
+ if (!runner$1.onTestArtifactRecord) throw new Error(`Test runner doesn't support test artifacts.`);
2800
+ await finishSendTasksUpdate(runner$1);
2801
+ const resolvedArtifact = await runner$1.onTestArtifactRecord(task, artifact);
2802
+ task.artifacts.push(resolvedArtifact);
2803
+ return resolvedArtifact;
2804
+ }
2805
+ const table = [];
2806
+ for (let i = 65; i < 91; i++) table.push(String.fromCharCode(i));
2807
+ for (let i = 97; i < 123; i++) table.push(String.fromCharCode(i));
2808
+ for (let i = 0; i < 10; i++) table.push(i.toString(10));
2809
+ table.push("+", "/");
2810
+ function encodeUint8Array(bytes) {
2811
+ let base64 = "";
2812
+ const len = bytes.byteLength;
2813
+ for (let i = 0; i < len; i += 3) if (len === i + 1) {
2814
+ const a = (bytes[i] & 252) >> 2;
2815
+ const b = (bytes[i] & 3) << 4;
2816
+ base64 += table[a];
2817
+ base64 += table[b];
2818
+ base64 += "==";
2819
+ } else if (len === i + 2) {
2820
+ const a = (bytes[i] & 252) >> 2;
2821
+ const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
2822
+ const c = (bytes[i + 1] & 15) << 2;
2823
+ base64 += table[a];
2824
+ base64 += table[b];
2825
+ base64 += table[c];
2826
+ base64 += "=";
2827
+ } else {
2828
+ const a = (bytes[i] & 252) >> 2;
2829
+ const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4;
2830
+ const c = (bytes[i + 1] & 15) << 2 | (bytes[i + 2] & 192) >> 6;
2831
+ const d$1 = bytes[i + 2] & 63;
2832
+ base64 += table[a];
2833
+ base64 += table[b];
2834
+ base64 += table[c];
2835
+ base64 += table[d$1];
2836
+ }
2837
+ return base64;
2838
+ }
2839
+ /**
2840
+ * Records an async operation associated with a test task.
2841
+ *
2842
+ * This function tracks promises that should be awaited before a test completes.
2843
+ * The promise is automatically removed from the test's promise list once it settles.
2844
+ */
2845
+ function recordAsyncOperation(test$7, promise) {
2846
+ promise = promise.finally(() => {
2847
+ if (!test$7.promises) return;
2848
+ const index = test$7.promises.indexOf(promise);
2849
+ if (index !== -1) test$7.promises.splice(index, 1);
2850
+ });
2851
+ if (!test$7.promises) test$7.promises = [];
2852
+ test$7.promises.push(promise);
2853
+ return promise;
2854
+ }
2855
+ /**
2856
+ * Validates and prepares a test attachment for serialization.
2857
+ *
2858
+ * This function ensures attachments have either `body` or `path` set (but not both), and converts `Uint8Array` bodies to base64-encoded strings for easier serialization.
2859
+ *
2860
+ * @param attachment - The attachment to validate and prepare
2861
+ *
2862
+ * @throws {TypeError} If neither `body` nor `path` is provided
2863
+ * @throws {TypeError} If both `body` and `path` are provided
2864
+ */
2865
+ function manageArtifactAttachment(attachment) {
2866
+ if (attachment.body == null && !attachment.path) throw new TypeError(`Test attachment requires "body" or "path" to be set. Both are missing.`);
2867
+ if (attachment.body && attachment.path) throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`);
2868
+ if (attachment.body instanceof Uint8Array) attachment.body = encodeUint8Array(attachment.body);
2869
+ }
2870
+
2871
+ //#endregion
5
2872
  //#region src/index.ts
6
2873
  function renderSSR(jsxNode) {
7
2874
  const node = jsxNode;