vitest 0.0.67 → 0.0.71

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/entry.js ADDED
@@ -0,0 +1,3755 @@
1
+ import { importModule } from 'local-pkg';
2
+ import chai, { expect, util } from 'chai';
3
+ import SinonChai from 'sinon-chai';
4
+ import Subset from 'chai-subset';
5
+ import path, { basename } from 'path';
6
+ import { g as getNames, i as interpretOnlyMode, p as partitionSuiteChildren, c as hasTests, h as hasFailed } from './utils-9dcc4050.js';
7
+ import fs from 'fs';
8
+ import { d as c$1, l as generateDiff } from './error-fb6ff2e6.js';
9
+ import { performance } from 'perf_hooks';
10
+ import { j as setHooks, c as createSuiteHooks, h as clearContext, d as defaultSuite, k as context, l as getHooks, m as getFn } from './suite-819c135e.js';
11
+ import { n as nanoid } from './index-6427e0f2.js';
12
+ import 'tty';
13
+ import 'source-map';
14
+
15
+ var node = {
16
+ name: "node",
17
+ async setup() {
18
+ return {
19
+ teardown() {
20
+ }
21
+ };
22
+ }
23
+ };
24
+
25
+ const LIVING_KEYS = [
26
+ "DOMException",
27
+ "URL",
28
+ "URLSearchParams",
29
+ "EventTarget",
30
+ "NamedNodeMap",
31
+ "Node",
32
+ "Attr",
33
+ "Element",
34
+ "DocumentFragment",
35
+ "DOMImplementation",
36
+ "Document",
37
+ "XMLDocument",
38
+ "CharacterData",
39
+ "Text",
40
+ "CDATASection",
41
+ "ProcessingInstruction",
42
+ "Comment",
43
+ "DocumentType",
44
+ "NodeList",
45
+ "HTMLCollection",
46
+ "HTMLOptionsCollection",
47
+ "DOMStringMap",
48
+ "DOMTokenList",
49
+ "StyleSheetList",
50
+ "HTMLElement",
51
+ "HTMLHeadElement",
52
+ "HTMLTitleElement",
53
+ "HTMLBaseElement",
54
+ "HTMLLinkElement",
55
+ "HTMLMetaElement",
56
+ "HTMLStyleElement",
57
+ "HTMLBodyElement",
58
+ "HTMLHeadingElement",
59
+ "HTMLParagraphElement",
60
+ "HTMLHRElement",
61
+ "HTMLPreElement",
62
+ "HTMLUListElement",
63
+ "HTMLOListElement",
64
+ "HTMLLIElement",
65
+ "HTMLMenuElement",
66
+ "HTMLDListElement",
67
+ "HTMLDivElement",
68
+ "HTMLAnchorElement",
69
+ "HTMLAreaElement",
70
+ "HTMLBRElement",
71
+ "HTMLButtonElement",
72
+ "HTMLCanvasElement",
73
+ "HTMLDataElement",
74
+ "HTMLDataListElement",
75
+ "HTMLDetailsElement",
76
+ "HTMLDialogElement",
77
+ "HTMLDirectoryElement",
78
+ "HTMLFieldSetElement",
79
+ "HTMLFontElement",
80
+ "HTMLFormElement",
81
+ "HTMLHtmlElement",
82
+ "HTMLImageElement",
83
+ "HTMLInputElement",
84
+ "HTMLLabelElement",
85
+ "HTMLLegendElement",
86
+ "HTMLMapElement",
87
+ "HTMLMarqueeElement",
88
+ "HTMLMediaElement",
89
+ "HTMLMeterElement",
90
+ "HTMLModElement",
91
+ "HTMLOptGroupElement",
92
+ "HTMLOptionElement",
93
+ "HTMLOutputElement",
94
+ "HTMLPictureElement",
95
+ "HTMLProgressElement",
96
+ "HTMLQuoteElement",
97
+ "HTMLScriptElement",
98
+ "HTMLSelectElement",
99
+ "HTMLSlotElement",
100
+ "HTMLSourceElement",
101
+ "HTMLSpanElement",
102
+ "HTMLTableCaptionElement",
103
+ "HTMLTableCellElement",
104
+ "HTMLTableColElement",
105
+ "HTMLTableElement",
106
+ "HTMLTimeElement",
107
+ "HTMLTableRowElement",
108
+ "HTMLTableSectionElement",
109
+ "HTMLTemplateElement",
110
+ "HTMLTextAreaElement",
111
+ "HTMLUnknownElement",
112
+ "HTMLFrameElement",
113
+ "HTMLFrameSetElement",
114
+ "HTMLIFrameElement",
115
+ "HTMLEmbedElement",
116
+ "HTMLObjectElement",
117
+ "HTMLParamElement",
118
+ "HTMLVideoElement",
119
+ "HTMLAudioElement",
120
+ "HTMLTrackElement",
121
+ "SVGElement",
122
+ "SVGGraphicsElement",
123
+ "SVGSVGElement",
124
+ "SVGTitleElement",
125
+ "SVGAnimatedString",
126
+ "SVGNumber",
127
+ "SVGStringList",
128
+ "Event",
129
+ "CloseEvent",
130
+ "CustomEvent",
131
+ "MessageEvent",
132
+ "ErrorEvent",
133
+ "HashChangeEvent",
134
+ "PopStateEvent",
135
+ "StorageEvent",
136
+ "ProgressEvent",
137
+ "PageTransitionEvent",
138
+ "UIEvent",
139
+ "FocusEvent",
140
+ "InputEvent",
141
+ "MouseEvent",
142
+ "KeyboardEvent",
143
+ "TouchEvent",
144
+ "CompositionEvent",
145
+ "WheelEvent",
146
+ "BarProp",
147
+ "External",
148
+ "Location",
149
+ "History",
150
+ "Screen",
151
+ "Performance",
152
+ "Navigator",
153
+ "PluginArray",
154
+ "MimeTypeArray",
155
+ "Plugin",
156
+ "MimeType",
157
+ "FileReader",
158
+ "Blob",
159
+ "File",
160
+ "FileList",
161
+ "ValidityState",
162
+ "DOMParser",
163
+ "XMLSerializer",
164
+ "FormData",
165
+ "XMLHttpRequestEventTarget",
166
+ "XMLHttpRequestUpload",
167
+ "XMLHttpRequest",
168
+ "WebSocket",
169
+ "NodeFilter",
170
+ "NodeIterator",
171
+ "TreeWalker",
172
+ "AbstractRange",
173
+ "Range",
174
+ "StaticRange",
175
+ "Selection",
176
+ "Storage",
177
+ "CustomElementRegistry",
178
+ "ShadowRoot",
179
+ "MutationObserver",
180
+ "MutationRecord",
181
+ "Headers",
182
+ "AbortController",
183
+ "AbortSignal"
184
+ ];
185
+ const OTHER_KEYS = [
186
+ "addEventListener",
187
+ "alert",
188
+ "atob",
189
+ "blur",
190
+ "btoa",
191
+ "close",
192
+ "confirm",
193
+ "createPopup",
194
+ "dispatchEvent",
195
+ "document",
196
+ "focus",
197
+ "frames",
198
+ "getComputedStyle",
199
+ "history",
200
+ "innerHeight",
201
+ "innerWidth",
202
+ "length",
203
+ "location",
204
+ "moveBy",
205
+ "moveTo",
206
+ "name",
207
+ "navigator",
208
+ "open",
209
+ "outerHeight",
210
+ "outerWidth",
211
+ "pageXOffset",
212
+ "pageYOffset",
213
+ "parent",
214
+ "postMessage",
215
+ "print",
216
+ "prompt",
217
+ "removeEventListener",
218
+ "resizeBy",
219
+ "resizeTo",
220
+ "screen",
221
+ "screenLeft",
222
+ "screenTop",
223
+ "screenX",
224
+ "screenY",
225
+ "scroll",
226
+ "scrollBy",
227
+ "scrollLeft",
228
+ "scrollTo",
229
+ "scrollTop",
230
+ "scrollX",
231
+ "scrollY",
232
+ "self",
233
+ "stop",
234
+ "top",
235
+ "window"
236
+ ];
237
+ const KEYS = LIVING_KEYS.concat(OTHER_KEYS);
238
+
239
+ var jsdom = {
240
+ name: "jsdom",
241
+ async setup(global) {
242
+ const { JSDOM } = await importModule("jsdom");
243
+ const dom = new JSDOM("<!DOCTYPE html>", {
244
+ pretendToBeVisual: true,
245
+ runScripts: "dangerously",
246
+ url: "http://localhost:3000"
247
+ });
248
+ const keys = KEYS.concat(Object.getOwnPropertyNames(dom.window)).filter((k) => !k.startsWith("_")).filter((k) => !(k in global));
249
+ for (const key of keys)
250
+ global[key] = dom.window[key];
251
+ return {
252
+ teardown(global2) {
253
+ keys.forEach((key) => delete global2[key]);
254
+ }
255
+ };
256
+ }
257
+ };
258
+
259
+ var happy = {
260
+ name: "happy-dom",
261
+ async setup(global) {
262
+ const { Window } = await importModule("happy-dom");
263
+ const win = new Window();
264
+ const keys = KEYS.concat(Object.getOwnPropertyNames(win)).filter((k) => !k.startsWith("_")).filter((k) => !(k in global));
265
+ for (const key of keys)
266
+ global[key] = win[key];
267
+ return {
268
+ teardown(global2) {
269
+ win.happyDOM.cancelAsync();
270
+ keys.forEach((key) => delete global2[key]);
271
+ }
272
+ };
273
+ }
274
+ };
275
+
276
+ const environments = {
277
+ node,
278
+ jsdom,
279
+ "happy-dom": happy
280
+ };
281
+
282
+ const rpc = async (method, ...args) => {
283
+ var _a;
284
+ return (_a = process.__vitest_worker__) == null ? void 0 : _a.rpc(method, ...args);
285
+ };
286
+ const send = async (method, ...args) => {
287
+ var _a;
288
+ return (_a = process.__vitest_worker__) == null ? void 0 : _a.send(method, ...args);
289
+ };
290
+
291
+ var naturalCompare$2 = {exports: {}};
292
+
293
+ /*
294
+ * @version 1.4.0
295
+ * @date 2015-10-26
296
+ * @stability 3 - Stable
297
+ * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite)
298
+ * @license MIT License
299
+ */
300
+
301
+
302
+ var naturalCompare = function(a, b) {
303
+ var i, codeA
304
+ , codeB = 1
305
+ , posA = 0
306
+ , posB = 0
307
+ , alphabet = String.alphabet;
308
+
309
+ function getCode(str, pos, code) {
310
+ if (code) {
311
+ for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i;
312
+ return +str.slice(pos - 1, i)
313
+ }
314
+ code = alphabet && alphabet.indexOf(str.charAt(pos));
315
+ return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code
316
+ : code < 46 ? 65 // -
317
+ : code < 48 ? code - 1
318
+ : code < 58 ? code + 18 // 0-9
319
+ : code < 65 ? code - 11
320
+ : code < 91 ? code + 11 // A-Z
321
+ : code < 97 ? code - 37
322
+ : code < 123 ? code + 5 // a-z
323
+ : code - 63
324
+ }
325
+
326
+
327
+ if ((a+="") != (b+="")) for (;codeB;) {
328
+ codeA = getCode(a, posA++);
329
+ codeB = getCode(b, posB++);
330
+
331
+ if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) {
332
+ codeA = getCode(a, posA, posA);
333
+ codeB = getCode(b, posB, posA = i);
334
+ posB = i;
335
+ }
336
+
337
+ if (codeA != codeB) return (codeA < codeB) ? -1 : 1
338
+ }
339
+ return 0
340
+ };
341
+
342
+ try {
343
+ naturalCompare$2.exports = naturalCompare;
344
+ } catch (e) {
345
+ String.naturalCompare = naturalCompare;
346
+ }
347
+
348
+ var naturalCompare$1 = naturalCompare$2.exports;
349
+
350
+ var build = {};
351
+
352
+ var ansiStyles = {exports: {}};
353
+
354
+ (function (module) {
355
+
356
+ const ANSI_BACKGROUND_OFFSET = 10;
357
+
358
+ const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
359
+
360
+ const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
361
+
362
+ function assembleStyles() {
363
+ const codes = new Map();
364
+ const styles = {
365
+ modifier: {
366
+ reset: [0, 0],
367
+ // 21 isn't widely supported and 22 does the same thing
368
+ bold: [1, 22],
369
+ dim: [2, 22],
370
+ italic: [3, 23],
371
+ underline: [4, 24],
372
+ overline: [53, 55],
373
+ inverse: [7, 27],
374
+ hidden: [8, 28],
375
+ strikethrough: [9, 29]
376
+ },
377
+ color: {
378
+ black: [30, 39],
379
+ red: [31, 39],
380
+ green: [32, 39],
381
+ yellow: [33, 39],
382
+ blue: [34, 39],
383
+ magenta: [35, 39],
384
+ cyan: [36, 39],
385
+ white: [37, 39],
386
+
387
+ // Bright color
388
+ blackBright: [90, 39],
389
+ redBright: [91, 39],
390
+ greenBright: [92, 39],
391
+ yellowBright: [93, 39],
392
+ blueBright: [94, 39],
393
+ magentaBright: [95, 39],
394
+ cyanBright: [96, 39],
395
+ whiteBright: [97, 39]
396
+ },
397
+ bgColor: {
398
+ bgBlack: [40, 49],
399
+ bgRed: [41, 49],
400
+ bgGreen: [42, 49],
401
+ bgYellow: [43, 49],
402
+ bgBlue: [44, 49],
403
+ bgMagenta: [45, 49],
404
+ bgCyan: [46, 49],
405
+ bgWhite: [47, 49],
406
+
407
+ // Bright color
408
+ bgBlackBright: [100, 49],
409
+ bgRedBright: [101, 49],
410
+ bgGreenBright: [102, 49],
411
+ bgYellowBright: [103, 49],
412
+ bgBlueBright: [104, 49],
413
+ bgMagentaBright: [105, 49],
414
+ bgCyanBright: [106, 49],
415
+ bgWhiteBright: [107, 49]
416
+ }
417
+ };
418
+
419
+ // Alias bright black as gray (and grey)
420
+ styles.color.gray = styles.color.blackBright;
421
+ styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
422
+ styles.color.grey = styles.color.blackBright;
423
+ styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
424
+
425
+ for (const [groupName, group] of Object.entries(styles)) {
426
+ for (const [styleName, style] of Object.entries(group)) {
427
+ styles[styleName] = {
428
+ open: `\u001B[${style[0]}m`,
429
+ close: `\u001B[${style[1]}m`
430
+ };
431
+
432
+ group[styleName] = styles[styleName];
433
+
434
+ codes.set(style[0], style[1]);
435
+ }
436
+
437
+ Object.defineProperty(styles, groupName, {
438
+ value: group,
439
+ enumerable: false
440
+ });
441
+ }
442
+
443
+ Object.defineProperty(styles, 'codes', {
444
+ value: codes,
445
+ enumerable: false
446
+ });
447
+
448
+ styles.color.close = '\u001B[39m';
449
+ styles.bgColor.close = '\u001B[49m';
450
+
451
+ styles.color.ansi256 = wrapAnsi256();
452
+ styles.color.ansi16m = wrapAnsi16m();
453
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
454
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
455
+
456
+ // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
457
+ Object.defineProperties(styles, {
458
+ rgbToAnsi256: {
459
+ value: (red, green, blue) => {
460
+ // We use the extended greyscale palette here, with the exception of
461
+ // black and white. normal palette only has 4 greyscale shades.
462
+ if (red === green && green === blue) {
463
+ if (red < 8) {
464
+ return 16;
465
+ }
466
+
467
+ if (red > 248) {
468
+ return 231;
469
+ }
470
+
471
+ return Math.round(((red - 8) / 247) * 24) + 232;
472
+ }
473
+
474
+ return 16 +
475
+ (36 * Math.round(red / 255 * 5)) +
476
+ (6 * Math.round(green / 255 * 5)) +
477
+ Math.round(blue / 255 * 5);
478
+ },
479
+ enumerable: false
480
+ },
481
+ hexToRgb: {
482
+ value: hex => {
483
+ const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
484
+ if (!matches) {
485
+ return [0, 0, 0];
486
+ }
487
+
488
+ let {colorString} = matches.groups;
489
+
490
+ if (colorString.length === 3) {
491
+ colorString = colorString.split('').map(character => character + character).join('');
492
+ }
493
+
494
+ const integer = Number.parseInt(colorString, 16);
495
+
496
+ return [
497
+ (integer >> 16) & 0xFF,
498
+ (integer >> 8) & 0xFF,
499
+ integer & 0xFF
500
+ ];
501
+ },
502
+ enumerable: false
503
+ },
504
+ hexToAnsi256: {
505
+ value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
506
+ enumerable: false
507
+ }
508
+ });
509
+
510
+ return styles;
511
+ }
512
+
513
+ // Make the export immutable
514
+ Object.defineProperty(module, 'exports', {
515
+ enumerable: true,
516
+ get: assembleStyles
517
+ });
518
+ }(ansiStyles));
519
+
520
+ var collections = {};
521
+
522
+ Object.defineProperty(collections, '__esModule', {
523
+ value: true
524
+ });
525
+ collections.printIteratorEntries = printIteratorEntries;
526
+ collections.printIteratorValues = printIteratorValues;
527
+ collections.printListItems = printListItems;
528
+ collections.printObjectProperties = printObjectProperties;
529
+
530
+ /**
531
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
532
+ *
533
+ * This source code is licensed under the MIT license found in the
534
+ * LICENSE file in the root directory of this source tree.
535
+ *
536
+ */
537
+ const getKeysOfEnumerableProperties = (object, compareKeys) => {
538
+ const keys = Object.keys(object).sort(compareKeys);
539
+
540
+ if (Object.getOwnPropertySymbols) {
541
+ Object.getOwnPropertySymbols(object).forEach(symbol => {
542
+ if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
543
+ keys.push(symbol);
544
+ }
545
+ });
546
+ }
547
+
548
+ return keys;
549
+ };
550
+ /**
551
+ * Return entries (for example, of a map)
552
+ * with spacing, indentation, and comma
553
+ * without surrounding punctuation (for example, braces)
554
+ */
555
+
556
+ function printIteratorEntries(
557
+ iterator,
558
+ config,
559
+ indentation,
560
+ depth,
561
+ refs,
562
+ printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
563
+ // What a distracting diff if you change a data structure to/from
564
+ // ECMAScript Object or Immutable.Map/OrderedMap which use the default.
565
+ separator = ': '
566
+ ) {
567
+ let result = '';
568
+ let current = iterator.next();
569
+
570
+ if (!current.done) {
571
+ result += config.spacingOuter;
572
+ const indentationNext = indentation + config.indent;
573
+
574
+ while (!current.done) {
575
+ const name = printer(
576
+ current.value[0],
577
+ config,
578
+ indentationNext,
579
+ depth,
580
+ refs
581
+ );
582
+ const value = printer(
583
+ current.value[1],
584
+ config,
585
+ indentationNext,
586
+ depth,
587
+ refs
588
+ );
589
+ result += indentationNext + name + separator + value;
590
+ current = iterator.next();
591
+
592
+ if (!current.done) {
593
+ result += ',' + config.spacingInner;
594
+ } else if (!config.min) {
595
+ result += ',';
596
+ }
597
+ }
598
+
599
+ result += config.spacingOuter + indentation;
600
+ }
601
+
602
+ return result;
603
+ }
604
+ /**
605
+ * Return values (for example, of a set)
606
+ * with spacing, indentation, and comma
607
+ * without surrounding punctuation (braces or brackets)
608
+ */
609
+
610
+ function printIteratorValues(
611
+ iterator,
612
+ config,
613
+ indentation,
614
+ depth,
615
+ refs,
616
+ printer
617
+ ) {
618
+ let result = '';
619
+ let current = iterator.next();
620
+
621
+ if (!current.done) {
622
+ result += config.spacingOuter;
623
+ const indentationNext = indentation + config.indent;
624
+
625
+ while (!current.done) {
626
+ result +=
627
+ indentationNext +
628
+ printer(current.value, config, indentationNext, depth, refs);
629
+ current = iterator.next();
630
+
631
+ if (!current.done) {
632
+ result += ',' + config.spacingInner;
633
+ } else if (!config.min) {
634
+ result += ',';
635
+ }
636
+ }
637
+
638
+ result += config.spacingOuter + indentation;
639
+ }
640
+
641
+ return result;
642
+ }
643
+ /**
644
+ * Return items (for example, of an array)
645
+ * with spacing, indentation, and comma
646
+ * without surrounding punctuation (for example, brackets)
647
+ **/
648
+
649
+ function printListItems(list, config, indentation, depth, refs, printer) {
650
+ let result = '';
651
+
652
+ if (list.length) {
653
+ result += config.spacingOuter;
654
+ const indentationNext = indentation + config.indent;
655
+
656
+ for (let i = 0; i < list.length; i++) {
657
+ result += indentationNext;
658
+
659
+ if (i in list) {
660
+ result += printer(list[i], config, indentationNext, depth, refs);
661
+ }
662
+
663
+ if (i < list.length - 1) {
664
+ result += ',' + config.spacingInner;
665
+ } else if (!config.min) {
666
+ result += ',';
667
+ }
668
+ }
669
+
670
+ result += config.spacingOuter + indentation;
671
+ }
672
+
673
+ return result;
674
+ }
675
+ /**
676
+ * Return properties of an object
677
+ * with spacing, indentation, and comma
678
+ * without surrounding punctuation (for example, braces)
679
+ */
680
+
681
+ function printObjectProperties(val, config, indentation, depth, refs, printer) {
682
+ let result = '';
683
+ const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
684
+
685
+ if (keys.length) {
686
+ result += config.spacingOuter;
687
+ const indentationNext = indentation + config.indent;
688
+
689
+ for (let i = 0; i < keys.length; i++) {
690
+ const key = keys[i];
691
+ const name = printer(key, config, indentationNext, depth, refs);
692
+ const value = printer(val[key], config, indentationNext, depth, refs);
693
+ result += indentationNext + name + ': ' + value;
694
+
695
+ if (i < keys.length - 1) {
696
+ result += ',' + config.spacingInner;
697
+ } else if (!config.min) {
698
+ result += ',';
699
+ }
700
+ }
701
+
702
+ result += config.spacingOuter + indentation;
703
+ }
704
+
705
+ return result;
706
+ }
707
+
708
+ var AsymmetricMatcher$2 = {};
709
+
710
+ Object.defineProperty(AsymmetricMatcher$2, '__esModule', {
711
+ value: true
712
+ });
713
+ AsymmetricMatcher$2.default = AsymmetricMatcher$2.test = AsymmetricMatcher$2.serialize = void 0;
714
+
715
+ var _collections$3 = collections;
716
+
717
+ var global$1 = (function () {
718
+ if (typeof globalThis !== 'undefined') {
719
+ return globalThis;
720
+ } else if (typeof global$1 !== 'undefined') {
721
+ return global$1;
722
+ } else if (typeof self !== 'undefined') {
723
+ return self;
724
+ } else if (typeof window !== 'undefined') {
725
+ return window;
726
+ } else {
727
+ return Function('return this')();
728
+ }
729
+ })();
730
+
731
+ var Symbol$2 = global$1['jest-symbol-do-not-touch'] || global$1.Symbol;
732
+ const asymmetricMatcher =
733
+ typeof Symbol$2 === 'function' && Symbol$2.for
734
+ ? Symbol$2.for('jest.asymmetricMatcher')
735
+ : 0x1357a5;
736
+ const SPACE$2 = ' ';
737
+
738
+ const serialize$7 = (val, config, indentation, depth, refs, printer) => {
739
+ const stringedValue = val.toString();
740
+
741
+ if (
742
+ stringedValue === 'ArrayContaining' ||
743
+ stringedValue === 'ArrayNotContaining'
744
+ ) {
745
+ if (++depth > config.maxDepth) {
746
+ return '[' + stringedValue + ']';
747
+ }
748
+
749
+ return (
750
+ stringedValue +
751
+ SPACE$2 +
752
+ '[' +
753
+ (0, _collections$3.printListItems)(
754
+ val.sample,
755
+ config,
756
+ indentation,
757
+ depth,
758
+ refs,
759
+ printer
760
+ ) +
761
+ ']'
762
+ );
763
+ }
764
+
765
+ if (
766
+ stringedValue === 'ObjectContaining' ||
767
+ stringedValue === 'ObjectNotContaining'
768
+ ) {
769
+ if (++depth > config.maxDepth) {
770
+ return '[' + stringedValue + ']';
771
+ }
772
+
773
+ return (
774
+ stringedValue +
775
+ SPACE$2 +
776
+ '{' +
777
+ (0, _collections$3.printObjectProperties)(
778
+ val.sample,
779
+ config,
780
+ indentation,
781
+ depth,
782
+ refs,
783
+ printer
784
+ ) +
785
+ '}'
786
+ );
787
+ }
788
+
789
+ if (
790
+ stringedValue === 'StringMatching' ||
791
+ stringedValue === 'StringNotMatching'
792
+ ) {
793
+ return (
794
+ stringedValue +
795
+ SPACE$2 +
796
+ printer(val.sample, config, indentation, depth, refs)
797
+ );
798
+ }
799
+
800
+ if (
801
+ stringedValue === 'StringContaining' ||
802
+ stringedValue === 'StringNotContaining'
803
+ ) {
804
+ return (
805
+ stringedValue +
806
+ SPACE$2 +
807
+ printer(val.sample, config, indentation, depth, refs)
808
+ );
809
+ }
810
+
811
+ return val.toAsymmetricMatcher();
812
+ };
813
+
814
+ AsymmetricMatcher$2.serialize = serialize$7;
815
+
816
+ const test$6 = val => val && val.$$typeof === asymmetricMatcher;
817
+
818
+ AsymmetricMatcher$2.test = test$6;
819
+ const plugin$6 = {
820
+ serialize: serialize$7,
821
+ test: test$6
822
+ };
823
+ var _default$7 = plugin$6;
824
+ AsymmetricMatcher$2.default = _default$7;
825
+
826
+ var ConvertAnsi = {};
827
+
828
+ var ansiRegex = ({onlyFirst = false} = {}) => {
829
+ const pattern = [
830
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
831
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
832
+ ].join('|');
833
+
834
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
835
+ };
836
+
837
+ Object.defineProperty(ConvertAnsi, '__esModule', {
838
+ value: true
839
+ });
840
+ ConvertAnsi.default = ConvertAnsi.serialize = ConvertAnsi.test = void 0;
841
+
842
+ var _ansiRegex = _interopRequireDefault$2(ansiRegex);
843
+
844
+ var _ansiStyles$1 = _interopRequireDefault$2(ansiStyles.exports);
845
+
846
+ function _interopRequireDefault$2(obj) {
847
+ return obj && obj.__esModule ? obj : {default: obj};
848
+ }
849
+
850
+ /**
851
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
852
+ *
853
+ * This source code is licensed under the MIT license found in the
854
+ * LICENSE file in the root directory of this source tree.
855
+ */
856
+ const toHumanReadableAnsi = text =>
857
+ text.replace((0, _ansiRegex.default)(), match => {
858
+ switch (match) {
859
+ case _ansiStyles$1.default.red.close:
860
+ case _ansiStyles$1.default.green.close:
861
+ case _ansiStyles$1.default.cyan.close:
862
+ case _ansiStyles$1.default.gray.close:
863
+ case _ansiStyles$1.default.white.close:
864
+ case _ansiStyles$1.default.yellow.close:
865
+ case _ansiStyles$1.default.bgRed.close:
866
+ case _ansiStyles$1.default.bgGreen.close:
867
+ case _ansiStyles$1.default.bgYellow.close:
868
+ case _ansiStyles$1.default.inverse.close:
869
+ case _ansiStyles$1.default.dim.close:
870
+ case _ansiStyles$1.default.bold.close:
871
+ case _ansiStyles$1.default.reset.open:
872
+ case _ansiStyles$1.default.reset.close:
873
+ return '</>';
874
+
875
+ case _ansiStyles$1.default.red.open:
876
+ return '<red>';
877
+
878
+ case _ansiStyles$1.default.green.open:
879
+ return '<green>';
880
+
881
+ case _ansiStyles$1.default.cyan.open:
882
+ return '<cyan>';
883
+
884
+ case _ansiStyles$1.default.gray.open:
885
+ return '<gray>';
886
+
887
+ case _ansiStyles$1.default.white.open:
888
+ return '<white>';
889
+
890
+ case _ansiStyles$1.default.yellow.open:
891
+ return '<yellow>';
892
+
893
+ case _ansiStyles$1.default.bgRed.open:
894
+ return '<bgRed>';
895
+
896
+ case _ansiStyles$1.default.bgGreen.open:
897
+ return '<bgGreen>';
898
+
899
+ case _ansiStyles$1.default.bgYellow.open:
900
+ return '<bgYellow>';
901
+
902
+ case _ansiStyles$1.default.inverse.open:
903
+ return '<inverse>';
904
+
905
+ case _ansiStyles$1.default.dim.open:
906
+ return '<dim>';
907
+
908
+ case _ansiStyles$1.default.bold.open:
909
+ return '<bold>';
910
+
911
+ default:
912
+ return '';
913
+ }
914
+ });
915
+
916
+ const test$5 = val =>
917
+ typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
918
+
919
+ ConvertAnsi.test = test$5;
920
+
921
+ const serialize$6 = (val, config, indentation, depth, refs, printer) =>
922
+ printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
923
+
924
+ ConvertAnsi.serialize = serialize$6;
925
+ const plugin$5 = {
926
+ serialize: serialize$6,
927
+ test: test$5
928
+ };
929
+ var _default$6 = plugin$5;
930
+ ConvertAnsi.default = _default$6;
931
+
932
+ var DOMCollection$2 = {};
933
+
934
+ Object.defineProperty(DOMCollection$2, '__esModule', {
935
+ value: true
936
+ });
937
+ DOMCollection$2.default = DOMCollection$2.serialize = DOMCollection$2.test = void 0;
938
+
939
+ var _collections$2 = collections;
940
+
941
+ /**
942
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
943
+ *
944
+ * This source code is licensed under the MIT license found in the
945
+ * LICENSE file in the root directory of this source tree.
946
+ */
947
+
948
+ /* eslint-disable local/ban-types-eventually */
949
+ const SPACE$1 = ' ';
950
+ const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
951
+ const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
952
+
953
+ const testName = name =>
954
+ OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
955
+
956
+ const test$4 = val =>
957
+ val &&
958
+ val.constructor &&
959
+ !!val.constructor.name &&
960
+ testName(val.constructor.name);
961
+
962
+ DOMCollection$2.test = test$4;
963
+
964
+ const isNamedNodeMap = collection =>
965
+ collection.constructor.name === 'NamedNodeMap';
966
+
967
+ const serialize$5 = (collection, config, indentation, depth, refs, printer) => {
968
+ const name = collection.constructor.name;
969
+
970
+ if (++depth > config.maxDepth) {
971
+ return '[' + name + ']';
972
+ }
973
+
974
+ return (
975
+ (config.min ? '' : name + SPACE$1) +
976
+ (OBJECT_NAMES.indexOf(name) !== -1
977
+ ? '{' +
978
+ (0, _collections$2.printObjectProperties)(
979
+ isNamedNodeMap(collection)
980
+ ? Array.from(collection).reduce((props, attribute) => {
981
+ props[attribute.name] = attribute.value;
982
+ return props;
983
+ }, {})
984
+ : {...collection},
985
+ config,
986
+ indentation,
987
+ depth,
988
+ refs,
989
+ printer
990
+ ) +
991
+ '}'
992
+ : '[' +
993
+ (0, _collections$2.printListItems)(
994
+ Array.from(collection),
995
+ config,
996
+ indentation,
997
+ depth,
998
+ refs,
999
+ printer
1000
+ ) +
1001
+ ']')
1002
+ );
1003
+ };
1004
+
1005
+ DOMCollection$2.serialize = serialize$5;
1006
+ const plugin$4 = {
1007
+ serialize: serialize$5,
1008
+ test: test$4
1009
+ };
1010
+ var _default$5 = plugin$4;
1011
+ DOMCollection$2.default = _default$5;
1012
+
1013
+ var DOMElement$2 = {};
1014
+
1015
+ var markup = {};
1016
+
1017
+ var escapeHTML$1 = {};
1018
+
1019
+ Object.defineProperty(escapeHTML$1, '__esModule', {
1020
+ value: true
1021
+ });
1022
+ escapeHTML$1.default = escapeHTML;
1023
+
1024
+ /**
1025
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1026
+ *
1027
+ * This source code is licensed under the MIT license found in the
1028
+ * LICENSE file in the root directory of this source tree.
1029
+ */
1030
+ function escapeHTML(str) {
1031
+ return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1032
+ }
1033
+
1034
+ Object.defineProperty(markup, '__esModule', {
1035
+ value: true
1036
+ });
1037
+ markup.printElementAsLeaf =
1038
+ markup.printElement =
1039
+ markup.printComment =
1040
+ markup.printText =
1041
+ markup.printChildren =
1042
+ markup.printProps =
1043
+ void 0;
1044
+
1045
+ var _escapeHTML = _interopRequireDefault$1(escapeHTML$1);
1046
+
1047
+ function _interopRequireDefault$1(obj) {
1048
+ return obj && obj.__esModule ? obj : {default: obj};
1049
+ }
1050
+
1051
+ /**
1052
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1053
+ *
1054
+ * This source code is licensed under the MIT license found in the
1055
+ * LICENSE file in the root directory of this source tree.
1056
+ */
1057
+ // Return empty string if keys is empty.
1058
+ const printProps = (keys, props, config, indentation, depth, refs, printer) => {
1059
+ const indentationNext = indentation + config.indent;
1060
+ const colors = config.colors;
1061
+ return keys
1062
+ .map(key => {
1063
+ const value = props[key];
1064
+ let printed = printer(value, config, indentationNext, depth, refs);
1065
+
1066
+ if (typeof value !== 'string') {
1067
+ if (printed.indexOf('\n') !== -1) {
1068
+ printed =
1069
+ config.spacingOuter +
1070
+ indentationNext +
1071
+ printed +
1072
+ config.spacingOuter +
1073
+ indentation;
1074
+ }
1075
+
1076
+ printed = '{' + printed + '}';
1077
+ }
1078
+
1079
+ return (
1080
+ config.spacingInner +
1081
+ indentation +
1082
+ colors.prop.open +
1083
+ key +
1084
+ colors.prop.close +
1085
+ '=' +
1086
+ colors.value.open +
1087
+ printed +
1088
+ colors.value.close
1089
+ );
1090
+ })
1091
+ .join('');
1092
+ }; // Return empty string if children is empty.
1093
+
1094
+ markup.printProps = printProps;
1095
+
1096
+ const printChildren = (children, config, indentation, depth, refs, printer) =>
1097
+ children
1098
+ .map(
1099
+ child =>
1100
+ config.spacingOuter +
1101
+ indentation +
1102
+ (typeof child === 'string'
1103
+ ? printText(child, config)
1104
+ : printer(child, config, indentation, depth, refs))
1105
+ )
1106
+ .join('');
1107
+
1108
+ markup.printChildren = printChildren;
1109
+
1110
+ const printText = (text, config) => {
1111
+ const contentColor = config.colors.content;
1112
+ return (
1113
+ contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close
1114
+ );
1115
+ };
1116
+
1117
+ markup.printText = printText;
1118
+
1119
+ const printComment = (comment, config) => {
1120
+ const commentColor = config.colors.comment;
1121
+ return (
1122
+ commentColor.open +
1123
+ '<!--' +
1124
+ (0, _escapeHTML.default)(comment) +
1125
+ '-->' +
1126
+ commentColor.close
1127
+ );
1128
+ }; // Separate the functions to format props, children, and element,
1129
+ // so a plugin could override a particular function, if needed.
1130
+ // Too bad, so sad: the traditional (but unnecessary) space
1131
+ // in a self-closing tagColor requires a second test of printedProps.
1132
+
1133
+ markup.printComment = printComment;
1134
+
1135
+ const printElement = (
1136
+ type,
1137
+ printedProps,
1138
+ printedChildren,
1139
+ config,
1140
+ indentation
1141
+ ) => {
1142
+ const tagColor = config.colors.tag;
1143
+ return (
1144
+ tagColor.open +
1145
+ '<' +
1146
+ type +
1147
+ (printedProps &&
1148
+ tagColor.close +
1149
+ printedProps +
1150
+ config.spacingOuter +
1151
+ indentation +
1152
+ tagColor.open) +
1153
+ (printedChildren
1154
+ ? '>' +
1155
+ tagColor.close +
1156
+ printedChildren +
1157
+ config.spacingOuter +
1158
+ indentation +
1159
+ tagColor.open +
1160
+ '</' +
1161
+ type
1162
+ : (printedProps && !config.min ? '' : ' ') + '/') +
1163
+ '>' +
1164
+ tagColor.close
1165
+ );
1166
+ };
1167
+
1168
+ markup.printElement = printElement;
1169
+
1170
+ const printElementAsLeaf = (type, config) => {
1171
+ const tagColor = config.colors.tag;
1172
+ return (
1173
+ tagColor.open +
1174
+ '<' +
1175
+ type +
1176
+ tagColor.close +
1177
+ ' …' +
1178
+ tagColor.open +
1179
+ ' />' +
1180
+ tagColor.close
1181
+ );
1182
+ };
1183
+
1184
+ markup.printElementAsLeaf = printElementAsLeaf;
1185
+
1186
+ Object.defineProperty(DOMElement$2, '__esModule', {
1187
+ value: true
1188
+ });
1189
+ DOMElement$2.default = DOMElement$2.serialize = DOMElement$2.test = void 0;
1190
+
1191
+ var _markup$2 = markup;
1192
+
1193
+ /**
1194
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1195
+ *
1196
+ * This source code is licensed under the MIT license found in the
1197
+ * LICENSE file in the root directory of this source tree.
1198
+ */
1199
+ const ELEMENT_NODE = 1;
1200
+ const TEXT_NODE = 3;
1201
+ const COMMENT_NODE = 8;
1202
+ const FRAGMENT_NODE = 11;
1203
+ const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
1204
+
1205
+ const testHasAttribute = val => {
1206
+ try {
1207
+ return typeof val.hasAttribute === 'function' && val.hasAttribute('is');
1208
+ } catch {
1209
+ return false;
1210
+ }
1211
+ };
1212
+
1213
+ const testNode = val => {
1214
+ const constructorName = val.constructor.name;
1215
+ const {nodeType, tagName} = val;
1216
+ const isCustomElement =
1217
+ (typeof tagName === 'string' && tagName.includes('-')) ||
1218
+ testHasAttribute(val);
1219
+ return (
1220
+ (nodeType === ELEMENT_NODE &&
1221
+ (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
1222
+ (nodeType === TEXT_NODE && constructorName === 'Text') ||
1223
+ (nodeType === COMMENT_NODE && constructorName === 'Comment') ||
1224
+ (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')
1225
+ );
1226
+ };
1227
+
1228
+ const test$3 = val => {
1229
+ var _val$constructor;
1230
+
1231
+ return (
1232
+ (val === null || val === void 0
1233
+ ? void 0
1234
+ : (_val$constructor = val.constructor) === null ||
1235
+ _val$constructor === void 0
1236
+ ? void 0
1237
+ : _val$constructor.name) && testNode(val)
1238
+ );
1239
+ };
1240
+
1241
+ DOMElement$2.test = test$3;
1242
+
1243
+ function nodeIsText(node) {
1244
+ return node.nodeType === TEXT_NODE;
1245
+ }
1246
+
1247
+ function nodeIsComment(node) {
1248
+ return node.nodeType === COMMENT_NODE;
1249
+ }
1250
+
1251
+ function nodeIsFragment(node) {
1252
+ return node.nodeType === FRAGMENT_NODE;
1253
+ }
1254
+
1255
+ const serialize$4 = (node, config, indentation, depth, refs, printer) => {
1256
+ if (nodeIsText(node)) {
1257
+ return (0, _markup$2.printText)(node.data, config);
1258
+ }
1259
+
1260
+ if (nodeIsComment(node)) {
1261
+ return (0, _markup$2.printComment)(node.data, config);
1262
+ }
1263
+
1264
+ const type = nodeIsFragment(node)
1265
+ ? `DocumentFragment`
1266
+ : node.tagName.toLowerCase();
1267
+
1268
+ if (++depth > config.maxDepth) {
1269
+ return (0, _markup$2.printElementAsLeaf)(type, config);
1270
+ }
1271
+
1272
+ return (0, _markup$2.printElement)(
1273
+ type,
1274
+ (0, _markup$2.printProps)(
1275
+ nodeIsFragment(node)
1276
+ ? []
1277
+ : Array.from(node.attributes)
1278
+ .map(attr => attr.name)
1279
+ .sort(),
1280
+ nodeIsFragment(node)
1281
+ ? {}
1282
+ : Array.from(node.attributes).reduce((props, attribute) => {
1283
+ props[attribute.name] = attribute.value;
1284
+ return props;
1285
+ }, {}),
1286
+ config,
1287
+ indentation + config.indent,
1288
+ depth,
1289
+ refs,
1290
+ printer
1291
+ ),
1292
+ (0, _markup$2.printChildren)(
1293
+ Array.prototype.slice.call(node.childNodes || node.children),
1294
+ config,
1295
+ indentation + config.indent,
1296
+ depth,
1297
+ refs,
1298
+ printer
1299
+ ),
1300
+ config,
1301
+ indentation
1302
+ );
1303
+ };
1304
+
1305
+ DOMElement$2.serialize = serialize$4;
1306
+ const plugin$3 = {
1307
+ serialize: serialize$4,
1308
+ test: test$3
1309
+ };
1310
+ var _default$4 = plugin$3;
1311
+ DOMElement$2.default = _default$4;
1312
+
1313
+ var Immutable$2 = {};
1314
+
1315
+ Object.defineProperty(Immutable$2, '__esModule', {
1316
+ value: true
1317
+ });
1318
+ Immutable$2.default = Immutable$2.test = Immutable$2.serialize = void 0;
1319
+
1320
+ var _collections$1 = collections;
1321
+
1322
+ /**
1323
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1324
+ *
1325
+ * This source code is licensed under the MIT license found in the
1326
+ * LICENSE file in the root directory of this source tree.
1327
+ */
1328
+ // SENTINEL constants are from https://github.com/facebook/immutable-js
1329
+ const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
1330
+ const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
1331
+ const IS_KEYED_SENTINEL$1 = '@@__IMMUTABLE_KEYED__@@';
1332
+ const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
1333
+ const IS_ORDERED_SENTINEL$1 = '@@__IMMUTABLE_ORDERED__@@';
1334
+ const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
1335
+
1336
+ const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
1337
+ const IS_SET_SENTINEL$1 = '@@__IMMUTABLE_SET__@@';
1338
+ const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
1339
+
1340
+ const getImmutableName = name => 'Immutable.' + name;
1341
+
1342
+ const printAsLeaf = name => '[' + name + ']';
1343
+
1344
+ const SPACE = ' ';
1345
+ const LAZY = '…'; // Seq is lazy if it calls a method like filter
1346
+
1347
+ const printImmutableEntries = (
1348
+ val,
1349
+ config,
1350
+ indentation,
1351
+ depth,
1352
+ refs,
1353
+ printer,
1354
+ type
1355
+ ) =>
1356
+ ++depth > config.maxDepth
1357
+ ? printAsLeaf(getImmutableName(type))
1358
+ : getImmutableName(type) +
1359
+ SPACE +
1360
+ '{' +
1361
+ (0, _collections$1.printIteratorEntries)(
1362
+ val.entries(),
1363
+ config,
1364
+ indentation,
1365
+ depth,
1366
+ refs,
1367
+ printer
1368
+ ) +
1369
+ '}'; // Record has an entries method because it is a collection in immutable v3.
1370
+ // Return an iterator for Immutable Record from version v3 or v4.
1371
+
1372
+ function getRecordEntries(val) {
1373
+ let i = 0;
1374
+ return {
1375
+ next() {
1376
+ if (i < val._keys.length) {
1377
+ const key = val._keys[i++];
1378
+ return {
1379
+ done: false,
1380
+ value: [key, val.get(key)]
1381
+ };
1382
+ }
1383
+
1384
+ return {
1385
+ done: true,
1386
+ value: undefined
1387
+ };
1388
+ }
1389
+ };
1390
+ }
1391
+
1392
+ const printImmutableRecord = (
1393
+ val,
1394
+ config,
1395
+ indentation,
1396
+ depth,
1397
+ refs,
1398
+ printer
1399
+ ) => {
1400
+ // _name property is defined only for an Immutable Record instance
1401
+ // which was constructed with a second optional descriptive name arg
1402
+ const name = getImmutableName(val._name || 'Record');
1403
+ return ++depth > config.maxDepth
1404
+ ? printAsLeaf(name)
1405
+ : name +
1406
+ SPACE +
1407
+ '{' +
1408
+ (0, _collections$1.printIteratorEntries)(
1409
+ getRecordEntries(val),
1410
+ config,
1411
+ indentation,
1412
+ depth,
1413
+ refs,
1414
+ printer
1415
+ ) +
1416
+ '}';
1417
+ };
1418
+
1419
+ const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
1420
+ const name = getImmutableName('Seq');
1421
+
1422
+ if (++depth > config.maxDepth) {
1423
+ return printAsLeaf(name);
1424
+ }
1425
+
1426
+ if (val[IS_KEYED_SENTINEL$1]) {
1427
+ return (
1428
+ name +
1429
+ SPACE +
1430
+ '{' +
1431
+ (val._iter || val._object
1432
+ ? (0, _collections$1.printIteratorEntries)(
1433
+ val.entries(),
1434
+ config,
1435
+ indentation,
1436
+ depth,
1437
+ refs,
1438
+ printer
1439
+ )
1440
+ : LAZY) +
1441
+ '}'
1442
+ );
1443
+ }
1444
+
1445
+ return (
1446
+ name +
1447
+ SPACE +
1448
+ '[' +
1449
+ (val._iter || // from Immutable collection of values
1450
+ val._array || // from ECMAScript array
1451
+ val._collection || // from ECMAScript collection in immutable v4
1452
+ val._iterable // from ECMAScript collection in immutable v3
1453
+ ? (0, _collections$1.printIteratorValues)(
1454
+ val.values(),
1455
+ config,
1456
+ indentation,
1457
+ depth,
1458
+ refs,
1459
+ printer
1460
+ )
1461
+ : LAZY) +
1462
+ ']'
1463
+ );
1464
+ };
1465
+
1466
+ const printImmutableValues = (
1467
+ val,
1468
+ config,
1469
+ indentation,
1470
+ depth,
1471
+ refs,
1472
+ printer,
1473
+ type
1474
+ ) =>
1475
+ ++depth > config.maxDepth
1476
+ ? printAsLeaf(getImmutableName(type))
1477
+ : getImmutableName(type) +
1478
+ SPACE +
1479
+ '[' +
1480
+ (0, _collections$1.printIteratorValues)(
1481
+ val.values(),
1482
+ config,
1483
+ indentation,
1484
+ depth,
1485
+ refs,
1486
+ printer
1487
+ ) +
1488
+ ']';
1489
+
1490
+ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1491
+ if (val[IS_MAP_SENTINEL]) {
1492
+ return printImmutableEntries(
1493
+ val,
1494
+ config,
1495
+ indentation,
1496
+ depth,
1497
+ refs,
1498
+ printer,
1499
+ val[IS_ORDERED_SENTINEL$1] ? 'OrderedMap' : 'Map'
1500
+ );
1501
+ }
1502
+
1503
+ if (val[IS_LIST_SENTINEL]) {
1504
+ return printImmutableValues(
1505
+ val,
1506
+ config,
1507
+ indentation,
1508
+ depth,
1509
+ refs,
1510
+ printer,
1511
+ 'List'
1512
+ );
1513
+ }
1514
+
1515
+ if (val[IS_SET_SENTINEL$1]) {
1516
+ return printImmutableValues(
1517
+ val,
1518
+ config,
1519
+ indentation,
1520
+ depth,
1521
+ refs,
1522
+ printer,
1523
+ val[IS_ORDERED_SENTINEL$1] ? 'OrderedSet' : 'Set'
1524
+ );
1525
+ }
1526
+
1527
+ if (val[IS_STACK_SENTINEL]) {
1528
+ return printImmutableValues(
1529
+ val,
1530
+ config,
1531
+ indentation,
1532
+ depth,
1533
+ refs,
1534
+ printer,
1535
+ 'Stack'
1536
+ );
1537
+ }
1538
+
1539
+ if (val[IS_SEQ_SENTINEL]) {
1540
+ return printImmutableSeq(val, config, indentation, depth, refs, printer);
1541
+ } // For compatibility with immutable v3 and v4, let record be the default.
1542
+
1543
+ return printImmutableRecord(val, config, indentation, depth, refs, printer);
1544
+ }; // Explicitly comparing sentinel properties to true avoids false positive
1545
+ // when mock identity-obj-proxy returns the key as the value for any key.
1546
+
1547
+ Immutable$2.serialize = serialize$3;
1548
+
1549
+ const test$2 = val =>
1550
+ val &&
1551
+ (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
1552
+
1553
+ Immutable$2.test = test$2;
1554
+ const plugin$2 = {
1555
+ serialize: serialize$3,
1556
+ test: test$2
1557
+ };
1558
+ var _default$3 = plugin$2;
1559
+ Immutable$2.default = _default$3;
1560
+
1561
+ var ReactElement$2 = {};
1562
+
1563
+ var reactIs = {exports: {}};
1564
+
1565
+ var reactIs_production_min = {};
1566
+
1567
+ /** @license React v17.0.2
1568
+ * react-is.production.min.js
1569
+ *
1570
+ * Copyright (c) Facebook, Inc. and its affiliates.
1571
+ *
1572
+ * This source code is licensed under the MIT license found in the
1573
+ * LICENSE file in the root directory of this source tree.
1574
+ */
1575
+ var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
1576
+ if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden");}
1577
+ function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=z;reactIs_production_min.Element=A;reactIs_production_min.ForwardRef=B;reactIs_production_min.Fragment=C;reactIs_production_min.Lazy=D;reactIs_production_min.Memo=E;reactIs_production_min.Portal=F;reactIs_production_min.Profiler=G;reactIs_production_min.StrictMode=H;
1578
+ reactIs_production_min.Suspense=I;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return y(a)===h};reactIs_production_min.isContextProvider=function(a){return y(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return y(a)===k};reactIs_production_min.isFragment=function(a){return y(a)===d};reactIs_production_min.isLazy=function(a){return y(a)===p};reactIs_production_min.isMemo=function(a){return y(a)===n};
1579
+ reactIs_production_min.isPortal=function(a){return y(a)===c};reactIs_production_min.isProfiler=function(a){return y(a)===f};reactIs_production_min.isStrictMode=function(a){return y(a)===e};reactIs_production_min.isSuspense=function(a){return y(a)===l};reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
1580
+ reactIs_production_min.typeOf=y;
1581
+
1582
+ var reactIs_development = {};
1583
+
1584
+ /** @license React v17.0.2
1585
+ * react-is.development.js
1586
+ *
1587
+ * Copyright (c) Facebook, Inc. and its affiliates.
1588
+ *
1589
+ * This source code is licensed under the MIT license found in the
1590
+ * LICENSE file in the root directory of this source tree.
1591
+ */
1592
+
1593
+ if (process.env.NODE_ENV !== "production") {
1594
+ (function() {
1595
+
1596
+ // ATTENTION
1597
+ // When adding new symbols to this file,
1598
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
1599
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1600
+ // nor polyfill, then a plain number is used for performance.
1601
+ var REACT_ELEMENT_TYPE = 0xeac7;
1602
+ var REACT_PORTAL_TYPE = 0xeaca;
1603
+ var REACT_FRAGMENT_TYPE = 0xeacb;
1604
+ var REACT_STRICT_MODE_TYPE = 0xeacc;
1605
+ var REACT_PROFILER_TYPE = 0xead2;
1606
+ var REACT_PROVIDER_TYPE = 0xeacd;
1607
+ var REACT_CONTEXT_TYPE = 0xeace;
1608
+ var REACT_FORWARD_REF_TYPE = 0xead0;
1609
+ var REACT_SUSPENSE_TYPE = 0xead1;
1610
+ var REACT_SUSPENSE_LIST_TYPE = 0xead8;
1611
+ var REACT_MEMO_TYPE = 0xead3;
1612
+ var REACT_LAZY_TYPE = 0xead4;
1613
+ var REACT_BLOCK_TYPE = 0xead9;
1614
+ var REACT_SERVER_BLOCK_TYPE = 0xeada;
1615
+ var REACT_FUNDAMENTAL_TYPE = 0xead5;
1616
+ var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
1617
+ var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
1618
+
1619
+ if (typeof Symbol === 'function' && Symbol.for) {
1620
+ var symbolFor = Symbol.for;
1621
+ REACT_ELEMENT_TYPE = symbolFor('react.element');
1622
+ REACT_PORTAL_TYPE = symbolFor('react.portal');
1623
+ REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
1624
+ REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
1625
+ REACT_PROFILER_TYPE = symbolFor('react.profiler');
1626
+ REACT_PROVIDER_TYPE = symbolFor('react.provider');
1627
+ REACT_CONTEXT_TYPE = symbolFor('react.context');
1628
+ REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
1629
+ REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
1630
+ REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
1631
+ REACT_MEMO_TYPE = symbolFor('react.memo');
1632
+ REACT_LAZY_TYPE = symbolFor('react.lazy');
1633
+ REACT_BLOCK_TYPE = symbolFor('react.block');
1634
+ REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
1635
+ REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
1636
+ symbolFor('react.scope');
1637
+ symbolFor('react.opaque.id');
1638
+ REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
1639
+ symbolFor('react.offscreen');
1640
+ REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
1641
+ }
1642
+
1643
+ // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
1644
+
1645
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
1646
+
1647
+ function isValidElementType(type) {
1648
+ if (typeof type === 'string' || typeof type === 'function') {
1649
+ return true;
1650
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
1651
+
1652
+
1653
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
1654
+ return true;
1655
+ }
1656
+
1657
+ if (typeof type === 'object' && type !== null) {
1658
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
1659
+ return true;
1660
+ }
1661
+ }
1662
+
1663
+ return false;
1664
+ }
1665
+
1666
+ function typeOf(object) {
1667
+ if (typeof object === 'object' && object !== null) {
1668
+ var $$typeof = object.$$typeof;
1669
+
1670
+ switch ($$typeof) {
1671
+ case REACT_ELEMENT_TYPE:
1672
+ var type = object.type;
1673
+
1674
+ switch (type) {
1675
+ case REACT_FRAGMENT_TYPE:
1676
+ case REACT_PROFILER_TYPE:
1677
+ case REACT_STRICT_MODE_TYPE:
1678
+ case REACT_SUSPENSE_TYPE:
1679
+ case REACT_SUSPENSE_LIST_TYPE:
1680
+ return type;
1681
+
1682
+ default:
1683
+ var $$typeofType = type && type.$$typeof;
1684
+
1685
+ switch ($$typeofType) {
1686
+ case REACT_CONTEXT_TYPE:
1687
+ case REACT_FORWARD_REF_TYPE:
1688
+ case REACT_LAZY_TYPE:
1689
+ case REACT_MEMO_TYPE:
1690
+ case REACT_PROVIDER_TYPE:
1691
+ return $$typeofType;
1692
+
1693
+ default:
1694
+ return $$typeof;
1695
+ }
1696
+
1697
+ }
1698
+
1699
+ case REACT_PORTAL_TYPE:
1700
+ return $$typeof;
1701
+ }
1702
+ }
1703
+
1704
+ return undefined;
1705
+ }
1706
+ var ContextConsumer = REACT_CONTEXT_TYPE;
1707
+ var ContextProvider = REACT_PROVIDER_TYPE;
1708
+ var Element = REACT_ELEMENT_TYPE;
1709
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
1710
+ var Fragment = REACT_FRAGMENT_TYPE;
1711
+ var Lazy = REACT_LAZY_TYPE;
1712
+ var Memo = REACT_MEMO_TYPE;
1713
+ var Portal = REACT_PORTAL_TYPE;
1714
+ var Profiler = REACT_PROFILER_TYPE;
1715
+ var StrictMode = REACT_STRICT_MODE_TYPE;
1716
+ var Suspense = REACT_SUSPENSE_TYPE;
1717
+ var hasWarnedAboutDeprecatedIsAsyncMode = false;
1718
+ var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
1719
+
1720
+ function isAsyncMode(object) {
1721
+ {
1722
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1723
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1724
+
1725
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1726
+ }
1727
+ }
1728
+
1729
+ return false;
1730
+ }
1731
+ function isConcurrentMode(object) {
1732
+ {
1733
+ if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
1734
+ hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
1735
+
1736
+ console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
1737
+ }
1738
+ }
1739
+
1740
+ return false;
1741
+ }
1742
+ function isContextConsumer(object) {
1743
+ return typeOf(object) === REACT_CONTEXT_TYPE;
1744
+ }
1745
+ function isContextProvider(object) {
1746
+ return typeOf(object) === REACT_PROVIDER_TYPE;
1747
+ }
1748
+ function isElement(object) {
1749
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1750
+ }
1751
+ function isForwardRef(object) {
1752
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
1753
+ }
1754
+ function isFragment(object) {
1755
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
1756
+ }
1757
+ function isLazy(object) {
1758
+ return typeOf(object) === REACT_LAZY_TYPE;
1759
+ }
1760
+ function isMemo(object) {
1761
+ return typeOf(object) === REACT_MEMO_TYPE;
1762
+ }
1763
+ function isPortal(object) {
1764
+ return typeOf(object) === REACT_PORTAL_TYPE;
1765
+ }
1766
+ function isProfiler(object) {
1767
+ return typeOf(object) === REACT_PROFILER_TYPE;
1768
+ }
1769
+ function isStrictMode(object) {
1770
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
1771
+ }
1772
+ function isSuspense(object) {
1773
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
1774
+ }
1775
+
1776
+ reactIs_development.ContextConsumer = ContextConsumer;
1777
+ reactIs_development.ContextProvider = ContextProvider;
1778
+ reactIs_development.Element = Element;
1779
+ reactIs_development.ForwardRef = ForwardRef;
1780
+ reactIs_development.Fragment = Fragment;
1781
+ reactIs_development.Lazy = Lazy;
1782
+ reactIs_development.Memo = Memo;
1783
+ reactIs_development.Portal = Portal;
1784
+ reactIs_development.Profiler = Profiler;
1785
+ reactIs_development.StrictMode = StrictMode;
1786
+ reactIs_development.Suspense = Suspense;
1787
+ reactIs_development.isAsyncMode = isAsyncMode;
1788
+ reactIs_development.isConcurrentMode = isConcurrentMode;
1789
+ reactIs_development.isContextConsumer = isContextConsumer;
1790
+ reactIs_development.isContextProvider = isContextProvider;
1791
+ reactIs_development.isElement = isElement;
1792
+ reactIs_development.isForwardRef = isForwardRef;
1793
+ reactIs_development.isFragment = isFragment;
1794
+ reactIs_development.isLazy = isLazy;
1795
+ reactIs_development.isMemo = isMemo;
1796
+ reactIs_development.isPortal = isPortal;
1797
+ reactIs_development.isProfiler = isProfiler;
1798
+ reactIs_development.isStrictMode = isStrictMode;
1799
+ reactIs_development.isSuspense = isSuspense;
1800
+ reactIs_development.isValidElementType = isValidElementType;
1801
+ reactIs_development.typeOf = typeOf;
1802
+ })();
1803
+ }
1804
+
1805
+ if (process.env.NODE_ENV === 'production') {
1806
+ reactIs.exports = reactIs_production_min;
1807
+ } else {
1808
+ reactIs.exports = reactIs_development;
1809
+ }
1810
+
1811
+ Object.defineProperty(ReactElement$2, '__esModule', {
1812
+ value: true
1813
+ });
1814
+ ReactElement$2.default = ReactElement$2.test = ReactElement$2.serialize = void 0;
1815
+
1816
+ var ReactIs = _interopRequireWildcard(reactIs.exports);
1817
+
1818
+ var _markup$1 = markup;
1819
+
1820
+ function _getRequireWildcardCache(nodeInterop) {
1821
+ if (typeof WeakMap !== 'function') return null;
1822
+ var cacheBabelInterop = new WeakMap();
1823
+ var cacheNodeInterop = new WeakMap();
1824
+ return (_getRequireWildcardCache = function (nodeInterop) {
1825
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
1826
+ })(nodeInterop);
1827
+ }
1828
+
1829
+ function _interopRequireWildcard(obj, nodeInterop) {
1830
+ if (!nodeInterop && obj && obj.__esModule) {
1831
+ return obj;
1832
+ }
1833
+ if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
1834
+ return {default: obj};
1835
+ }
1836
+ var cache = _getRequireWildcardCache(nodeInterop);
1837
+ if (cache && cache.has(obj)) {
1838
+ return cache.get(obj);
1839
+ }
1840
+ var newObj = {};
1841
+ var hasPropertyDescriptor =
1842
+ Object.defineProperty && Object.getOwnPropertyDescriptor;
1843
+ for (var key in obj) {
1844
+ if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
1845
+ var desc = hasPropertyDescriptor
1846
+ ? Object.getOwnPropertyDescriptor(obj, key)
1847
+ : null;
1848
+ if (desc && (desc.get || desc.set)) {
1849
+ Object.defineProperty(newObj, key, desc);
1850
+ } else {
1851
+ newObj[key] = obj[key];
1852
+ }
1853
+ }
1854
+ }
1855
+ newObj.default = obj;
1856
+ if (cache) {
1857
+ cache.set(obj, newObj);
1858
+ }
1859
+ return newObj;
1860
+ }
1861
+
1862
+ /**
1863
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1864
+ *
1865
+ * This source code is licensed under the MIT license found in the
1866
+ * LICENSE file in the root directory of this source tree.
1867
+ */
1868
+ // Given element.props.children, or subtree during recursive traversal,
1869
+ // return flattened array of children.
1870
+ const getChildren = (arg, children = []) => {
1871
+ if (Array.isArray(arg)) {
1872
+ arg.forEach(item => {
1873
+ getChildren(item, children);
1874
+ });
1875
+ } else if (arg != null && arg !== false) {
1876
+ children.push(arg);
1877
+ }
1878
+
1879
+ return children;
1880
+ };
1881
+
1882
+ const getType = element => {
1883
+ const type = element.type;
1884
+
1885
+ if (typeof type === 'string') {
1886
+ return type;
1887
+ }
1888
+
1889
+ if (typeof type === 'function') {
1890
+ return type.displayName || type.name || 'Unknown';
1891
+ }
1892
+
1893
+ if (ReactIs.isFragment(element)) {
1894
+ return 'React.Fragment';
1895
+ }
1896
+
1897
+ if (ReactIs.isSuspense(element)) {
1898
+ return 'React.Suspense';
1899
+ }
1900
+
1901
+ if (typeof type === 'object' && type !== null) {
1902
+ if (ReactIs.isContextProvider(element)) {
1903
+ return 'Context.Provider';
1904
+ }
1905
+
1906
+ if (ReactIs.isContextConsumer(element)) {
1907
+ return 'Context.Consumer';
1908
+ }
1909
+
1910
+ if (ReactIs.isForwardRef(element)) {
1911
+ if (type.displayName) {
1912
+ return type.displayName;
1913
+ }
1914
+
1915
+ const functionName = type.render.displayName || type.render.name || '';
1916
+ return functionName !== ''
1917
+ ? 'ForwardRef(' + functionName + ')'
1918
+ : 'ForwardRef';
1919
+ }
1920
+
1921
+ if (ReactIs.isMemo(element)) {
1922
+ const functionName =
1923
+ type.displayName || type.type.displayName || type.type.name || '';
1924
+ return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';
1925
+ }
1926
+ }
1927
+
1928
+ return 'UNDEFINED';
1929
+ };
1930
+
1931
+ const getPropKeys$1 = element => {
1932
+ const {props} = element;
1933
+ return Object.keys(props)
1934
+ .filter(key => key !== 'children' && props[key] !== undefined)
1935
+ .sort();
1936
+ };
1937
+
1938
+ const serialize$2 = (element, config, indentation, depth, refs, printer) =>
1939
+ ++depth > config.maxDepth
1940
+ ? (0, _markup$1.printElementAsLeaf)(getType(element), config)
1941
+ : (0, _markup$1.printElement)(
1942
+ getType(element),
1943
+ (0, _markup$1.printProps)(
1944
+ getPropKeys$1(element),
1945
+ element.props,
1946
+ config,
1947
+ indentation + config.indent,
1948
+ depth,
1949
+ refs,
1950
+ printer
1951
+ ),
1952
+ (0, _markup$1.printChildren)(
1953
+ getChildren(element.props.children),
1954
+ config,
1955
+ indentation + config.indent,
1956
+ depth,
1957
+ refs,
1958
+ printer
1959
+ ),
1960
+ config,
1961
+ indentation
1962
+ );
1963
+
1964
+ ReactElement$2.serialize = serialize$2;
1965
+
1966
+ const test$1 = val => val != null && ReactIs.isElement(val);
1967
+
1968
+ ReactElement$2.test = test$1;
1969
+ const plugin$1 = {
1970
+ serialize: serialize$2,
1971
+ test: test$1
1972
+ };
1973
+ var _default$2 = plugin$1;
1974
+ ReactElement$2.default = _default$2;
1975
+
1976
+ var ReactTestComponent$2 = {};
1977
+
1978
+ Object.defineProperty(ReactTestComponent$2, '__esModule', {
1979
+ value: true
1980
+ });
1981
+ ReactTestComponent$2.default = ReactTestComponent$2.test = ReactTestComponent$2.serialize = void 0;
1982
+
1983
+ var _markup = markup;
1984
+
1985
+ var global = (function () {
1986
+ if (typeof globalThis !== 'undefined') {
1987
+ return globalThis;
1988
+ } else if (typeof global !== 'undefined') {
1989
+ return global;
1990
+ } else if (typeof self !== 'undefined') {
1991
+ return self;
1992
+ } else if (typeof window !== 'undefined') {
1993
+ return window;
1994
+ } else {
1995
+ return Function('return this')();
1996
+ }
1997
+ })();
1998
+
1999
+ var Symbol$1 = global['jest-symbol-do-not-touch'] || global.Symbol;
2000
+ const testSymbol =
2001
+ typeof Symbol$1 === 'function' && Symbol$1.for
2002
+ ? Symbol$1.for('react.test.json')
2003
+ : 0xea71357;
2004
+
2005
+ const getPropKeys = object => {
2006
+ const {props} = object;
2007
+ return props
2008
+ ? Object.keys(props)
2009
+ .filter(key => props[key] !== undefined)
2010
+ .sort()
2011
+ : [];
2012
+ };
2013
+
2014
+ const serialize$1 = (object, config, indentation, depth, refs, printer) =>
2015
+ ++depth > config.maxDepth
2016
+ ? (0, _markup.printElementAsLeaf)(object.type, config)
2017
+ : (0, _markup.printElement)(
2018
+ object.type,
2019
+ object.props
2020
+ ? (0, _markup.printProps)(
2021
+ getPropKeys(object),
2022
+ object.props,
2023
+ config,
2024
+ indentation + config.indent,
2025
+ depth,
2026
+ refs,
2027
+ printer
2028
+ )
2029
+ : '',
2030
+ object.children
2031
+ ? (0, _markup.printChildren)(
2032
+ object.children,
2033
+ config,
2034
+ indentation + config.indent,
2035
+ depth,
2036
+ refs,
2037
+ printer
2038
+ )
2039
+ : '',
2040
+ config,
2041
+ indentation
2042
+ );
2043
+
2044
+ ReactTestComponent$2.serialize = serialize$1;
2045
+
2046
+ const test = val => val && val.$$typeof === testSymbol;
2047
+
2048
+ ReactTestComponent$2.test = test;
2049
+ const plugin = {
2050
+ serialize: serialize$1,
2051
+ test
2052
+ };
2053
+ var _default$1 = plugin;
2054
+ ReactTestComponent$2.default = _default$1;
2055
+
2056
+ Object.defineProperty(build, '__esModule', {
2057
+ value: true
2058
+ });
2059
+ var format_1 = build.format = format;
2060
+ build.default = plugins_1 = build.plugins = build.DEFAULT_OPTIONS = void 0;
2061
+
2062
+ var _ansiStyles = _interopRequireDefault(ansiStyles.exports);
2063
+
2064
+ var _collections = collections;
2065
+
2066
+ var _AsymmetricMatcher = _interopRequireDefault(
2067
+ AsymmetricMatcher$2
2068
+ );
2069
+
2070
+ var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
2071
+
2072
+ var _DOMCollection = _interopRequireDefault(DOMCollection$2);
2073
+
2074
+ var _DOMElement = _interopRequireDefault(DOMElement$2);
2075
+
2076
+ var _Immutable = _interopRequireDefault(Immutable$2);
2077
+
2078
+ var _ReactElement = _interopRequireDefault(ReactElement$2);
2079
+
2080
+ var _ReactTestComponent = _interopRequireDefault(
2081
+ ReactTestComponent$2
2082
+ );
2083
+
2084
+ function _interopRequireDefault(obj) {
2085
+ return obj && obj.__esModule ? obj : {default: obj};
2086
+ }
2087
+
2088
+ /**
2089
+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2090
+ *
2091
+ * This source code is licensed under the MIT license found in the
2092
+ * LICENSE file in the root directory of this source tree.
2093
+ */
2094
+
2095
+ /* eslint-disable local/ban-types-eventually */
2096
+ const toString$1 = Object.prototype.toString;
2097
+ const toISOString = Date.prototype.toISOString;
2098
+ const errorToString = Error.prototype.toString;
2099
+ const regExpToString = RegExp.prototype.toString;
2100
+ /**
2101
+ * Explicitly comparing typeof constructor to function avoids undefined as name
2102
+ * when mock identity-obj-proxy returns the key as the value for any key.
2103
+ */
2104
+
2105
+ const getConstructorName = val =>
2106
+ (typeof val.constructor === 'function' && val.constructor.name) || 'Object';
2107
+ /* global window */
2108
+
2109
+ /** Is val is equal to global window object? Works even if it does not exist :) */
2110
+
2111
+ const isWindow = val => typeof window !== 'undefined' && val === window;
2112
+
2113
+ const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
2114
+ const NEWLINE_REGEXP = /\n/gi;
2115
+
2116
+ class PrettyFormatPluginError extends Error {
2117
+ constructor(message, stack) {
2118
+ super(message);
2119
+ this.stack = stack;
2120
+ this.name = this.constructor.name;
2121
+ }
2122
+ }
2123
+
2124
+ function isToStringedArrayType(toStringed) {
2125
+ return (
2126
+ toStringed === '[object Array]' ||
2127
+ toStringed === '[object ArrayBuffer]' ||
2128
+ toStringed === '[object DataView]' ||
2129
+ toStringed === '[object Float32Array]' ||
2130
+ toStringed === '[object Float64Array]' ||
2131
+ toStringed === '[object Int8Array]' ||
2132
+ toStringed === '[object Int16Array]' ||
2133
+ toStringed === '[object Int32Array]' ||
2134
+ toStringed === '[object Uint8Array]' ||
2135
+ toStringed === '[object Uint8ClampedArray]' ||
2136
+ toStringed === '[object Uint16Array]' ||
2137
+ toStringed === '[object Uint32Array]'
2138
+ );
2139
+ }
2140
+
2141
+ function printNumber(val) {
2142
+ return Object.is(val, -0) ? '-0' : String(val);
2143
+ }
2144
+
2145
+ function printBigInt(val) {
2146
+ return String(`${val}n`);
2147
+ }
2148
+
2149
+ function printFunction(val, printFunctionName) {
2150
+ if (!printFunctionName) {
2151
+ return '[Function]';
2152
+ }
2153
+
2154
+ return '[Function ' + (val.name || 'anonymous') + ']';
2155
+ }
2156
+
2157
+ function printSymbol(val) {
2158
+ return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
2159
+ }
2160
+
2161
+ function printError(val) {
2162
+ return '[' + errorToString.call(val) + ']';
2163
+ }
2164
+ /**
2165
+ * The first port of call for printing an object, handles most of the
2166
+ * data-types in JS.
2167
+ */
2168
+
2169
+ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
2170
+ if (val === true || val === false) {
2171
+ return '' + val;
2172
+ }
2173
+
2174
+ if (val === undefined) {
2175
+ return 'undefined';
2176
+ }
2177
+
2178
+ if (val === null) {
2179
+ return 'null';
2180
+ }
2181
+
2182
+ const typeOf = typeof val;
2183
+
2184
+ if (typeOf === 'number') {
2185
+ return printNumber(val);
2186
+ }
2187
+
2188
+ if (typeOf === 'bigint') {
2189
+ return printBigInt(val);
2190
+ }
2191
+
2192
+ if (typeOf === 'string') {
2193
+ if (escapeString) {
2194
+ return '"' + val.replace(/"|\\/g, '\\$&') + '"';
2195
+ }
2196
+
2197
+ return '"' + val + '"';
2198
+ }
2199
+
2200
+ if (typeOf === 'function') {
2201
+ return printFunction(val, printFunctionName);
2202
+ }
2203
+
2204
+ if (typeOf === 'symbol') {
2205
+ return printSymbol(val);
2206
+ }
2207
+
2208
+ const toStringed = toString$1.call(val);
2209
+
2210
+ if (toStringed === '[object WeakMap]') {
2211
+ return 'WeakMap {}';
2212
+ }
2213
+
2214
+ if (toStringed === '[object WeakSet]') {
2215
+ return 'WeakSet {}';
2216
+ }
2217
+
2218
+ if (
2219
+ toStringed === '[object Function]' ||
2220
+ toStringed === '[object GeneratorFunction]'
2221
+ ) {
2222
+ return printFunction(val, printFunctionName);
2223
+ }
2224
+
2225
+ if (toStringed === '[object Symbol]') {
2226
+ return printSymbol(val);
2227
+ }
2228
+
2229
+ if (toStringed === '[object Date]') {
2230
+ return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
2231
+ }
2232
+
2233
+ if (toStringed === '[object Error]') {
2234
+ return printError(val);
2235
+ }
2236
+
2237
+ if (toStringed === '[object RegExp]') {
2238
+ if (escapeRegex) {
2239
+ // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
2240
+ return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
2241
+ }
2242
+
2243
+ return regExpToString.call(val);
2244
+ }
2245
+
2246
+ if (val instanceof Error) {
2247
+ return printError(val);
2248
+ }
2249
+
2250
+ return null;
2251
+ }
2252
+ /**
2253
+ * Handles more complex objects ( such as objects with circular references.
2254
+ * maps and sets etc )
2255
+ */
2256
+
2257
+ function printComplexValue(
2258
+ val,
2259
+ config,
2260
+ indentation,
2261
+ depth,
2262
+ refs,
2263
+ hasCalledToJSON
2264
+ ) {
2265
+ if (refs.indexOf(val) !== -1) {
2266
+ return '[Circular]';
2267
+ }
2268
+
2269
+ refs = refs.slice();
2270
+ refs.push(val);
2271
+ const hitMaxDepth = ++depth > config.maxDepth;
2272
+ const min = config.min;
2273
+
2274
+ if (
2275
+ config.callToJSON &&
2276
+ !hitMaxDepth &&
2277
+ val.toJSON &&
2278
+ typeof val.toJSON === 'function' &&
2279
+ !hasCalledToJSON
2280
+ ) {
2281
+ return printer(val.toJSON(), config, indentation, depth, refs, true);
2282
+ }
2283
+
2284
+ const toStringed = toString$1.call(val);
2285
+
2286
+ if (toStringed === '[object Arguments]') {
2287
+ return hitMaxDepth
2288
+ ? '[Arguments]'
2289
+ : (min ? '' : 'Arguments ') +
2290
+ '[' +
2291
+ (0, _collections.printListItems)(
2292
+ val,
2293
+ config,
2294
+ indentation,
2295
+ depth,
2296
+ refs,
2297
+ printer
2298
+ ) +
2299
+ ']';
2300
+ }
2301
+
2302
+ if (isToStringedArrayType(toStringed)) {
2303
+ return hitMaxDepth
2304
+ ? '[' + val.constructor.name + ']'
2305
+ : (min
2306
+ ? ''
2307
+ : !config.printBasicPrototype && val.constructor.name === 'Array'
2308
+ ? ''
2309
+ : val.constructor.name + ' ') +
2310
+ '[' +
2311
+ (0, _collections.printListItems)(
2312
+ val,
2313
+ config,
2314
+ indentation,
2315
+ depth,
2316
+ refs,
2317
+ printer
2318
+ ) +
2319
+ ']';
2320
+ }
2321
+
2322
+ if (toStringed === '[object Map]') {
2323
+ return hitMaxDepth
2324
+ ? '[Map]'
2325
+ : 'Map {' +
2326
+ (0, _collections.printIteratorEntries)(
2327
+ val.entries(),
2328
+ config,
2329
+ indentation,
2330
+ depth,
2331
+ refs,
2332
+ printer,
2333
+ ' => '
2334
+ ) +
2335
+ '}';
2336
+ }
2337
+
2338
+ if (toStringed === '[object Set]') {
2339
+ return hitMaxDepth
2340
+ ? '[Set]'
2341
+ : 'Set {' +
2342
+ (0, _collections.printIteratorValues)(
2343
+ val.values(),
2344
+ config,
2345
+ indentation,
2346
+ depth,
2347
+ refs,
2348
+ printer
2349
+ ) +
2350
+ '}';
2351
+ } // Avoid failure to serialize global window object in jsdom test environment.
2352
+ // For example, not even relevant if window is prop of React element.
2353
+
2354
+ return hitMaxDepth || isWindow(val)
2355
+ ? '[' + getConstructorName(val) + ']'
2356
+ : (min
2357
+ ? ''
2358
+ : !config.printBasicPrototype && getConstructorName(val) === 'Object'
2359
+ ? ''
2360
+ : getConstructorName(val) + ' ') +
2361
+ '{' +
2362
+ (0, _collections.printObjectProperties)(
2363
+ val,
2364
+ config,
2365
+ indentation,
2366
+ depth,
2367
+ refs,
2368
+ printer
2369
+ ) +
2370
+ '}';
2371
+ }
2372
+
2373
+ function isNewPlugin(plugin) {
2374
+ return plugin.serialize != null;
2375
+ }
2376
+
2377
+ function printPlugin(plugin, val, config, indentation, depth, refs) {
2378
+ let printed;
2379
+
2380
+ try {
2381
+ printed = isNewPlugin(plugin)
2382
+ ? plugin.serialize(val, config, indentation, depth, refs, printer)
2383
+ : plugin.print(
2384
+ val,
2385
+ valChild => printer(valChild, config, indentation, depth, refs),
2386
+ str => {
2387
+ const indentationNext = indentation + config.indent;
2388
+ return (
2389
+ indentationNext +
2390
+ str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
2391
+ );
2392
+ },
2393
+ {
2394
+ edgeSpacing: config.spacingOuter,
2395
+ min: config.min,
2396
+ spacing: config.spacingInner
2397
+ },
2398
+ config.colors
2399
+ );
2400
+ } catch (error) {
2401
+ throw new PrettyFormatPluginError(error.message, error.stack);
2402
+ }
2403
+
2404
+ if (typeof printed !== 'string') {
2405
+ throw new Error(
2406
+ `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
2407
+ );
2408
+ }
2409
+
2410
+ return printed;
2411
+ }
2412
+
2413
+ function findPlugin(plugins, val) {
2414
+ for (let p = 0; p < plugins.length; p++) {
2415
+ try {
2416
+ if (plugins[p].test(val)) {
2417
+ return plugins[p];
2418
+ }
2419
+ } catch (error) {
2420
+ throw new PrettyFormatPluginError(error.message, error.stack);
2421
+ }
2422
+ }
2423
+
2424
+ return null;
2425
+ }
2426
+
2427
+ function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
2428
+ const plugin = findPlugin(config.plugins, val);
2429
+
2430
+ if (plugin !== null) {
2431
+ return printPlugin(plugin, val, config, indentation, depth, refs);
2432
+ }
2433
+
2434
+ const basicResult = printBasicValue(
2435
+ val,
2436
+ config.printFunctionName,
2437
+ config.escapeRegex,
2438
+ config.escapeString
2439
+ );
2440
+
2441
+ if (basicResult !== null) {
2442
+ return basicResult;
2443
+ }
2444
+
2445
+ return printComplexValue(
2446
+ val,
2447
+ config,
2448
+ indentation,
2449
+ depth,
2450
+ refs,
2451
+ hasCalledToJSON
2452
+ );
2453
+ }
2454
+
2455
+ const DEFAULT_THEME = {
2456
+ comment: 'gray',
2457
+ content: 'reset',
2458
+ prop: 'yellow',
2459
+ tag: 'cyan',
2460
+ value: 'green'
2461
+ };
2462
+ const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
2463
+ const DEFAULT_OPTIONS = {
2464
+ callToJSON: true,
2465
+ compareKeys: undefined,
2466
+ escapeRegex: false,
2467
+ escapeString: true,
2468
+ highlight: false,
2469
+ indent: 2,
2470
+ maxDepth: Infinity,
2471
+ min: false,
2472
+ plugins: [],
2473
+ printBasicPrototype: true,
2474
+ printFunctionName: true,
2475
+ theme: DEFAULT_THEME
2476
+ };
2477
+ build.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
2478
+
2479
+ function validateOptions(options) {
2480
+ Object.keys(options).forEach(key => {
2481
+ if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
2482
+ throw new Error(`pretty-format: Unknown option "${key}".`);
2483
+ }
2484
+ });
2485
+
2486
+ if (options.min && options.indent !== undefined && options.indent !== 0) {
2487
+ throw new Error(
2488
+ 'pretty-format: Options "min" and "indent" cannot be used together.'
2489
+ );
2490
+ }
2491
+
2492
+ if (options.theme !== undefined) {
2493
+ if (options.theme === null) {
2494
+ throw new Error(`pretty-format: Option "theme" must not be null.`);
2495
+ }
2496
+
2497
+ if (typeof options.theme !== 'object') {
2498
+ throw new Error(
2499
+ `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
2500
+ );
2501
+ }
2502
+ }
2503
+ }
2504
+
2505
+ const getColorsHighlight = options =>
2506
+ DEFAULT_THEME_KEYS.reduce((colors, key) => {
2507
+ const value =
2508
+ options.theme && options.theme[key] !== undefined
2509
+ ? options.theme[key]
2510
+ : DEFAULT_THEME[key];
2511
+ const color = value && _ansiStyles.default[value];
2512
+
2513
+ if (
2514
+ color &&
2515
+ typeof color.close === 'string' &&
2516
+ typeof color.open === 'string'
2517
+ ) {
2518
+ colors[key] = color;
2519
+ } else {
2520
+ throw new Error(
2521
+ `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
2522
+ );
2523
+ }
2524
+
2525
+ return colors;
2526
+ }, Object.create(null));
2527
+
2528
+ const getColorsEmpty = () =>
2529
+ DEFAULT_THEME_KEYS.reduce((colors, key) => {
2530
+ colors[key] = {
2531
+ close: '',
2532
+ open: ''
2533
+ };
2534
+ return colors;
2535
+ }, Object.create(null));
2536
+
2537
+ const getPrintFunctionName = options =>
2538
+ options && options.printFunctionName !== undefined
2539
+ ? options.printFunctionName
2540
+ : DEFAULT_OPTIONS.printFunctionName;
2541
+
2542
+ const getEscapeRegex = options =>
2543
+ options && options.escapeRegex !== undefined
2544
+ ? options.escapeRegex
2545
+ : DEFAULT_OPTIONS.escapeRegex;
2546
+
2547
+ const getEscapeString = options =>
2548
+ options && options.escapeString !== undefined
2549
+ ? options.escapeString
2550
+ : DEFAULT_OPTIONS.escapeString;
2551
+
2552
+ const getConfig = options => {
2553
+ var _options$printBasicPr;
2554
+
2555
+ return {
2556
+ callToJSON:
2557
+ options && options.callToJSON !== undefined
2558
+ ? options.callToJSON
2559
+ : DEFAULT_OPTIONS.callToJSON,
2560
+ colors:
2561
+ options && options.highlight
2562
+ ? getColorsHighlight(options)
2563
+ : getColorsEmpty(),
2564
+ compareKeys:
2565
+ options && typeof options.compareKeys === 'function'
2566
+ ? options.compareKeys
2567
+ : DEFAULT_OPTIONS.compareKeys,
2568
+ escapeRegex: getEscapeRegex(options),
2569
+ escapeString: getEscapeString(options),
2570
+ indent:
2571
+ options && options.min
2572
+ ? ''
2573
+ : createIndent(
2574
+ options && options.indent !== undefined
2575
+ ? options.indent
2576
+ : DEFAULT_OPTIONS.indent
2577
+ ),
2578
+ maxDepth:
2579
+ options && options.maxDepth !== undefined
2580
+ ? options.maxDepth
2581
+ : DEFAULT_OPTIONS.maxDepth,
2582
+ min:
2583
+ options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
2584
+ plugins:
2585
+ options && options.plugins !== undefined
2586
+ ? options.plugins
2587
+ : DEFAULT_OPTIONS.plugins,
2588
+ printBasicPrototype:
2589
+ (_options$printBasicPr =
2590
+ options === null || options === void 0
2591
+ ? void 0
2592
+ : options.printBasicPrototype) !== null &&
2593
+ _options$printBasicPr !== void 0
2594
+ ? _options$printBasicPr
2595
+ : true,
2596
+ printFunctionName: getPrintFunctionName(options),
2597
+ spacingInner: options && options.min ? ' ' : '\n',
2598
+ spacingOuter: options && options.min ? '' : '\n'
2599
+ };
2600
+ };
2601
+
2602
+ function createIndent(indent) {
2603
+ return new Array(indent + 1).join(' ');
2604
+ }
2605
+ /**
2606
+ * Returns a presentation string of your `val` object
2607
+ * @param val any potential JavaScript object
2608
+ * @param options Custom settings
2609
+ */
2610
+
2611
+ function format(val, options) {
2612
+ if (options) {
2613
+ validateOptions(options);
2614
+
2615
+ if (options.plugins) {
2616
+ const plugin = findPlugin(options.plugins, val);
2617
+
2618
+ if (plugin !== null) {
2619
+ return printPlugin(plugin, val, getConfig(options), '', 0, []);
2620
+ }
2621
+ }
2622
+ }
2623
+
2624
+ const basicResult = printBasicValue(
2625
+ val,
2626
+ getPrintFunctionName(options),
2627
+ getEscapeRegex(options),
2628
+ getEscapeString(options)
2629
+ );
2630
+
2631
+ if (basicResult !== null) {
2632
+ return basicResult;
2633
+ }
2634
+
2635
+ return printComplexValue(val, getConfig(options), '', 0, []);
2636
+ }
2637
+
2638
+ const plugins = {
2639
+ AsymmetricMatcher: _AsymmetricMatcher.default,
2640
+ ConvertAnsi: _ConvertAnsi.default,
2641
+ DOMCollection: _DOMCollection.default,
2642
+ DOMElement: _DOMElement.default,
2643
+ Immutable: _Immutable.default,
2644
+ ReactElement: _ReactElement.default,
2645
+ ReactTestComponent: _ReactTestComponent.default
2646
+ };
2647
+ var plugins_1 = build.plugins = plugins;
2648
+ var _default = format;
2649
+ build.default = _default;
2650
+
2651
+ const {
2652
+ DOMCollection: DOMCollection$1,
2653
+ DOMElement: DOMElement$1,
2654
+ Immutable: Immutable$1,
2655
+ ReactElement: ReactElement$1,
2656
+ ReactTestComponent: ReactTestComponent$1,
2657
+ AsymmetricMatcher: AsymmetricMatcher$1
2658
+ } = plugins_1;
2659
+ let PLUGINS$1 = [
2660
+ ReactTestComponent$1,
2661
+ ReactElement$1,
2662
+ DOMElement$1,
2663
+ DOMCollection$1,
2664
+ Immutable$1,
2665
+ AsymmetricMatcher$1
2666
+ ];
2667
+ const getSerializers = () => PLUGINS$1;
2668
+
2669
+ var __defProp$1 = Object.defineProperty;
2670
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
2671
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
2672
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
2673
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2674
+ var __spreadValues$1 = (a, b) => {
2675
+ for (var prop in b || (b = {}))
2676
+ if (__hasOwnProp$1.call(b, prop))
2677
+ __defNormalProp$1(a, prop, b[prop]);
2678
+ if (__getOwnPropSymbols$1)
2679
+ for (var prop of __getOwnPropSymbols$1(b)) {
2680
+ if (__propIsEnum$1.call(b, prop))
2681
+ __defNormalProp$1(a, prop, b[prop]);
2682
+ }
2683
+ return a;
2684
+ };
2685
+ const SNAPSHOT_VERSION = "1";
2686
+ const writeSnapshotVersion = () => `// Vitest Snapshot v${SNAPSHOT_VERSION}`;
2687
+ const testNameToKey = (testName, count) => `${testName} ${count}`;
2688
+ const keyToTestName = (key) => {
2689
+ if (!/ \d+$/.test(key))
2690
+ throw new Error("Snapshot keys must end with a number.");
2691
+ return key.replace(/ \d+$/, "");
2692
+ };
2693
+ const getSnapshotData = (snapshotPath, update) => {
2694
+ const data = Object.create(null);
2695
+ let snapshotContents = "";
2696
+ let dirty = false;
2697
+ if (fs.existsSync(snapshotPath)) {
2698
+ try {
2699
+ snapshotContents = fs.readFileSync(snapshotPath, "utf8");
2700
+ const populate = new Function("exports", snapshotContents);
2701
+ populate(data);
2702
+ } catch {
2703
+ }
2704
+ }
2705
+ const isInvalid = snapshotContents;
2706
+ if ((update === "all" || update === "new") && isInvalid)
2707
+ dirty = true;
2708
+ return { data, dirty };
2709
+ };
2710
+ const addExtraLineBreaks = (string) => string.includes("\n") ? `
2711
+ ${string}
2712
+ ` : string;
2713
+ const removeExtraLineBreaks = (string) => string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
2714
+ const escapeRegex = true;
2715
+ const printFunctionName = false;
2716
+ function serialize(val, indent = 2, formatOverrides = {}) {
2717
+ return normalizeNewlines(format_1(val, __spreadValues$1({
2718
+ escapeRegex,
2719
+ indent,
2720
+ plugins: getSerializers(),
2721
+ printFunctionName
2722
+ }, formatOverrides)));
2723
+ }
2724
+ function escapeBacktickString(str) {
2725
+ return str.replace(/`|\\|\${/g, "\\$&");
2726
+ }
2727
+ function printBacktickString(str) {
2728
+ return `\`${escapeBacktickString(str)}\``;
2729
+ }
2730
+ function ensureDirectoryExists(filePath) {
2731
+ try {
2732
+ fs.mkdirSync(path.join(path.dirname(filePath)), { recursive: true });
2733
+ } catch {
2734
+ }
2735
+ }
2736
+ function normalizeNewlines(string) {
2737
+ return string.replace(/\r\n|\r/g, "\n");
2738
+ }
2739
+ function saveSnapshotFile(snapshotData, snapshotPath) {
2740
+ const snapshots = Object.keys(snapshotData).sort(naturalCompare$1).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`);
2741
+ ensureDirectoryExists(snapshotPath);
2742
+ fs.writeFileSync(snapshotPath, `${writeSnapshotVersion()}
2743
+
2744
+ ${snapshots.join("\n\n")}
2745
+ `);
2746
+ }
2747
+
2748
+ class SnapshotState {
2749
+ constructor(snapshotPath, options) {
2750
+ this._snapshotPath = snapshotPath;
2751
+ const { data, dirty } = getSnapshotData(this._snapshotPath, options.updateSnapshot);
2752
+ this._initialData = data;
2753
+ this._snapshotData = data;
2754
+ this._dirty = dirty;
2755
+ this._uncheckedKeys = new Set(Object.keys(this._snapshotData));
2756
+ this._counters = new Map();
2757
+ this._index = 0;
2758
+ this.expand = options.expand || false;
2759
+ this.added = 0;
2760
+ this.matched = 0;
2761
+ this.unmatched = 0;
2762
+ this._updateSnapshot = options.updateSnapshot;
2763
+ this.updated = 0;
2764
+ this._snapshotFormat = options.snapshotFormat || {};
2765
+ }
2766
+ markSnapshotsAsCheckedForTest(testName) {
2767
+ this._uncheckedKeys.forEach((uncheckedKey) => {
2768
+ if (keyToTestName(uncheckedKey) === testName)
2769
+ this._uncheckedKeys.delete(uncheckedKey);
2770
+ });
2771
+ }
2772
+ _addSnapshot(key, receivedSerialized, options) {
2773
+ this._dirty = true;
2774
+ this._snapshotData[key] = receivedSerialized;
2775
+ }
2776
+ clear() {
2777
+ this._snapshotData = this._initialData;
2778
+ this._counters = new Map();
2779
+ this._index = 0;
2780
+ this.added = 0;
2781
+ this.matched = 0;
2782
+ this.unmatched = 0;
2783
+ this.updated = 0;
2784
+ }
2785
+ save() {
2786
+ const hasExternalSnapshots = Object.keys(this._snapshotData).length;
2787
+ const isEmpty = !hasExternalSnapshots;
2788
+ const status = {
2789
+ deleted: false,
2790
+ saved: false
2791
+ };
2792
+ if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) {
2793
+ if (hasExternalSnapshots)
2794
+ saveSnapshotFile(this._snapshotData, this._snapshotPath);
2795
+ status.saved = true;
2796
+ } else if (!hasExternalSnapshots && fs.existsSync(this._snapshotPath)) {
2797
+ if (this._updateSnapshot === "all")
2798
+ fs.unlinkSync(this._snapshotPath);
2799
+ status.deleted = true;
2800
+ }
2801
+ return status;
2802
+ }
2803
+ getUncheckedCount() {
2804
+ return this._uncheckedKeys.size || 0;
2805
+ }
2806
+ getUncheckedKeys() {
2807
+ return Array.from(this._uncheckedKeys);
2808
+ }
2809
+ removeUncheckedKeys() {
2810
+ if (this._updateSnapshot === "all" && this._uncheckedKeys.size) {
2811
+ this._dirty = true;
2812
+ this._uncheckedKeys.forEach((key) => delete this._snapshotData[key]);
2813
+ this._uncheckedKeys.clear();
2814
+ }
2815
+ }
2816
+ match({
2817
+ testName,
2818
+ received,
2819
+ key,
2820
+ inlineSnapshot,
2821
+ isInline,
2822
+ error
2823
+ }) {
2824
+ this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
2825
+ const count = Number(this._counters.get(testName));
2826
+ if (!key)
2827
+ key = testNameToKey(testName, count);
2828
+ if (!(isInline && this._snapshotData[key] !== void 0))
2829
+ this._uncheckedKeys.delete(key);
2830
+ const receivedSerialized = addExtraLineBreaks(serialize(received, void 0, this._snapshotFormat));
2831
+ const expected = isInline ? inlineSnapshot : this._snapshotData[key];
2832
+ const pass = expected === receivedSerialized;
2833
+ const hasSnapshot = expected !== void 0;
2834
+ const snapshotIsPersisted = isInline || fs.existsSync(this._snapshotPath);
2835
+ if (pass && !isInline) {
2836
+ this._snapshotData[key] = receivedSerialized;
2837
+ }
2838
+ if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
2839
+ if (this._updateSnapshot === "all") {
2840
+ if (!pass) {
2841
+ if (hasSnapshot)
2842
+ this.updated++;
2843
+ else
2844
+ this.added++;
2845
+ this._addSnapshot(key, receivedSerialized, { error, isInline });
2846
+ } else {
2847
+ this.matched++;
2848
+ }
2849
+ } else {
2850
+ this._addSnapshot(key, receivedSerialized, { error, isInline });
2851
+ this.added++;
2852
+ }
2853
+ return {
2854
+ actual: "",
2855
+ count,
2856
+ expected: "",
2857
+ key,
2858
+ pass: true
2859
+ };
2860
+ } else {
2861
+ if (!pass) {
2862
+ this.unmatched++;
2863
+ return {
2864
+ actual: removeExtraLineBreaks(receivedSerialized),
2865
+ count,
2866
+ expected: expected !== void 0 ? removeExtraLineBreaks(expected) : void 0,
2867
+ key,
2868
+ pass: false
2869
+ };
2870
+ } else {
2871
+ this.matched++;
2872
+ return {
2873
+ actual: "",
2874
+ count,
2875
+ expected: "",
2876
+ key,
2877
+ pass: true
2878
+ };
2879
+ }
2880
+ }
2881
+ }
2882
+ fail(testName, _received, key) {
2883
+ this._counters.set(testName, (this._counters.get(testName) || 0) + 1);
2884
+ const count = Number(this._counters.get(testName));
2885
+ if (!key)
2886
+ key = testNameToKey(testName, count);
2887
+ this._uncheckedKeys.delete(key);
2888
+ this.unmatched++;
2889
+ return key;
2890
+ }
2891
+ }
2892
+
2893
+ const resolveSnapshotPath = (testPath) => path.join(path.join(path.dirname(testPath), "__snapshots__"), `${path.basename(testPath)}.snap`);
2894
+ class SnapshotClient {
2895
+ constructor() {
2896
+ this.testFile = "";
2897
+ }
2898
+ setTest(test) {
2899
+ this.test = test;
2900
+ if (this.testFile !== this.test.file.filepath) {
2901
+ if (this.snapshotState)
2902
+ this.saveSnap();
2903
+ this.testFile = this.test.file.filepath;
2904
+ this.snapshotState = new SnapshotState(resolveSnapshotPath(this.testFile), process.__vitest_worker__.config.snapshotOptions);
2905
+ }
2906
+ }
2907
+ clearTest() {
2908
+ this.test = void 0;
2909
+ }
2910
+ assert(received, message) {
2911
+ if (!this.test)
2912
+ throw new Error("Snapshot can't not be used outside of test");
2913
+ const { actual, expected, key, pass } = this.snapshotState.match({
2914
+ testName: getNames(this.test).slice(1).join(" > "),
2915
+ received,
2916
+ isInline: false
2917
+ });
2918
+ if (!pass) {
2919
+ expect(actual.trim()).equals(expected ? expected.trim() : "", message || `Snapshot name: \`${key}\``);
2920
+ }
2921
+ }
2922
+ async saveSnap() {
2923
+ if (!this.testFile || !this.snapshotState)
2924
+ return;
2925
+ const result = packSnapshotState(this.testFile, this.snapshotState);
2926
+ await rpc("snapshotSaved", result);
2927
+ this.testFile = "";
2928
+ this.snapshotState = void 0;
2929
+ }
2930
+ }
2931
+ function packSnapshotState(filepath, state) {
2932
+ const snapshot = {
2933
+ filepath,
2934
+ added: 0,
2935
+ fileDeleted: false,
2936
+ matched: 0,
2937
+ unchecked: 0,
2938
+ uncheckedKeys: [],
2939
+ unmatched: 0,
2940
+ updated: 0
2941
+ };
2942
+ const uncheckedCount = state.getUncheckedCount();
2943
+ const uncheckedKeys = state.getUncheckedKeys();
2944
+ if (uncheckedCount)
2945
+ state.removeUncheckedKeys();
2946
+ const status = state.save();
2947
+ snapshot.fileDeleted = status.deleted;
2948
+ snapshot.added = state.added;
2949
+ snapshot.matched = state.matched;
2950
+ snapshot.unmatched = state.unmatched;
2951
+ snapshot.updated = state.updated;
2952
+ snapshot.unchecked = !status.deleted ? uncheckedCount : 0;
2953
+ snapshot.uncheckedKeys = Array.from(uncheckedKeys);
2954
+ return snapshot;
2955
+ }
2956
+
2957
+ let _client;
2958
+ function getSnapshotClient() {
2959
+ if (!_client)
2960
+ _client = new SnapshotClient();
2961
+ return _client;
2962
+ }
2963
+ function SnapshotPlugin() {
2964
+ return function(chai, utils) {
2965
+ for (const key of ["matchSnapshot", "toMatchSnapshot"]) {
2966
+ utils.addMethod(chai.Assertion.prototype, key, function(message) {
2967
+ const expected = utils.flag(this, "object");
2968
+ getSnapshotClient().assert(expected, message);
2969
+ });
2970
+ }
2971
+ };
2972
+ }
2973
+
2974
+ const EXPECTED_COLOR = c$1.green;
2975
+ const RECEIVED_COLOR = c$1.red;
2976
+ const INVERTED_COLOR = c$1.inverse;
2977
+ const BOLD_WEIGHT = c$1.bold;
2978
+ const DIM_COLOR = c$1.dim;
2979
+ const {
2980
+ AsymmetricMatcher,
2981
+ DOMCollection,
2982
+ DOMElement,
2983
+ Immutable,
2984
+ ReactElement,
2985
+ ReactTestComponent
2986
+ } = plugins_1;
2987
+ const PLUGINS = [
2988
+ ReactTestComponent,
2989
+ ReactElement,
2990
+ DOMElement,
2991
+ DOMCollection,
2992
+ Immutable,
2993
+ AsymmetricMatcher
2994
+ ];
2995
+ function matcherHint(matcherName, received = "received", expected = "expected", options = {}) {
2996
+ const {
2997
+ comment = "",
2998
+ expectedColor = EXPECTED_COLOR,
2999
+ isDirectExpectCall = false,
3000
+ isNot = false,
3001
+ promise = "",
3002
+ receivedColor = RECEIVED_COLOR,
3003
+ secondArgument = "",
3004
+ secondArgumentColor = EXPECTED_COLOR
3005
+ } = options;
3006
+ let hint = "";
3007
+ let dimString = "expect";
3008
+ if (!isDirectExpectCall && received !== "") {
3009
+ hint += DIM_COLOR(`${dimString}(`) + receivedColor(received);
3010
+ dimString = ")";
3011
+ }
3012
+ if (promise !== "") {
3013
+ hint += DIM_COLOR(`${dimString}.`) + promise;
3014
+ dimString = "";
3015
+ }
3016
+ if (isNot) {
3017
+ hint += `${DIM_COLOR(`${dimString}.`)}not`;
3018
+ dimString = "";
3019
+ }
3020
+ if (matcherName.includes(".")) {
3021
+ dimString += matcherName;
3022
+ } else {
3023
+ hint += DIM_COLOR(`${dimString}.`) + matcherName;
3024
+ dimString = "";
3025
+ }
3026
+ if (expected === "") {
3027
+ dimString += "()";
3028
+ } else {
3029
+ hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected);
3030
+ if (secondArgument)
3031
+ hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument);
3032
+ dimString = ")";
3033
+ }
3034
+ if (comment !== "")
3035
+ dimString += ` // ${comment}`;
3036
+ if (dimString !== "")
3037
+ hint += DIM_COLOR(dimString);
3038
+ return hint;
3039
+ }
3040
+ const SPACE_SYMBOL = "\xB7";
3041
+ const replaceTrailingSpaces = (text) => text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
3042
+ const stringify = (object, maxDepth = 10) => {
3043
+ const MAX_LENGTH = 1e4;
3044
+ let result;
3045
+ try {
3046
+ result = format_1(object, {
3047
+ maxDepth,
3048
+ min: true,
3049
+ plugins: PLUGINS
3050
+ });
3051
+ } catch {
3052
+ result = format_1(object, {
3053
+ callToJSON: false,
3054
+ maxDepth,
3055
+ min: true,
3056
+ plugins: PLUGINS
3057
+ });
3058
+ }
3059
+ return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
3060
+ };
3061
+ const printReceived = (object) => RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
3062
+ const printExpected = (value) => EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
3063
+ function diff(a, b, options) {
3064
+ return generateDiff(stringify(a), stringify(b));
3065
+ }
3066
+
3067
+ var matcherUtils = /*#__PURE__*/Object.freeze({
3068
+ __proto__: null,
3069
+ EXPECTED_COLOR: EXPECTED_COLOR,
3070
+ RECEIVED_COLOR: RECEIVED_COLOR,
3071
+ INVERTED_COLOR: INVERTED_COLOR,
3072
+ BOLD_WEIGHT: BOLD_WEIGHT,
3073
+ DIM_COLOR: DIM_COLOR,
3074
+ matcherHint: matcherHint,
3075
+ stringify: stringify,
3076
+ printReceived: printReceived,
3077
+ printExpected: printExpected,
3078
+ diff: diff
3079
+ });
3080
+
3081
+ // src/math.ts
3082
+ var isObject = (val) => toString.call(val) === "[object Object]";
3083
+
3084
+ function equals(a, b, customTesters, strictCheck) {
3085
+ customTesters = customTesters || [];
3086
+ return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
3087
+ }
3088
+ function isAsymmetric(obj) {
3089
+ return !!obj && isA("Function", obj.asymmetricMatch);
3090
+ }
3091
+ function asymmetricMatch(a, b) {
3092
+ var asymmetricA = isAsymmetric(a), asymmetricB = isAsymmetric(b);
3093
+ if (asymmetricA && asymmetricB) {
3094
+ return void 0;
3095
+ }
3096
+ if (asymmetricA) {
3097
+ return a.asymmetricMatch(b);
3098
+ }
3099
+ if (asymmetricB) {
3100
+ return b.asymmetricMatch(a);
3101
+ }
3102
+ }
3103
+ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
3104
+ var result = true;
3105
+ var asymmetricResult = asymmetricMatch(a, b);
3106
+ if (asymmetricResult !== void 0) {
3107
+ return asymmetricResult;
3108
+ }
3109
+ for (var i = 0; i < customTesters.length; i++) {
3110
+ var customTesterResult = customTesters[i](a, b);
3111
+ if (customTesterResult !== void 0) {
3112
+ return customTesterResult;
3113
+ }
3114
+ }
3115
+ if (a instanceof Error && b instanceof Error) {
3116
+ return a.message == b.message;
3117
+ }
3118
+ if (Object.is(a, b)) {
3119
+ return true;
3120
+ }
3121
+ if (a === null || b === null) {
3122
+ return a === b;
3123
+ }
3124
+ var className = Object.prototype.toString.call(a);
3125
+ if (className != Object.prototype.toString.call(b)) {
3126
+ return false;
3127
+ }
3128
+ switch (className) {
3129
+ case "[object Boolean]":
3130
+ case "[object String]":
3131
+ case "[object Number]":
3132
+ if (typeof a !== typeof b) {
3133
+ return false;
3134
+ } else if (typeof a !== "object" && typeof b !== "object") {
3135
+ return Object.is(a, b);
3136
+ } else {
3137
+ return Object.is(a.valueOf(), b.valueOf());
3138
+ }
3139
+ case "[object Date]":
3140
+ return +a == +b;
3141
+ case "[object RegExp]":
3142
+ return a.source === b.source && a.flags === b.flags;
3143
+ }
3144
+ if (typeof a !== "object" || typeof b !== "object") {
3145
+ return false;
3146
+ }
3147
+ if (isDomNode(a) && isDomNode(b)) {
3148
+ return a.isEqualNode(b);
3149
+ }
3150
+ var length = aStack.length;
3151
+ while (length--) {
3152
+ if (aStack[length] === a) {
3153
+ return bStack[length] === b;
3154
+ } else if (bStack[length] === b) {
3155
+ return false;
3156
+ }
3157
+ }
3158
+ aStack.push(a);
3159
+ bStack.push(b);
3160
+ if (className == "[object Array]" && a.length !== b.length) {
3161
+ return false;
3162
+ }
3163
+ var aKeys = keys(a, hasKey2), key;
3164
+ var size = aKeys.length;
3165
+ if (keys(b, hasKey2).length !== size) {
3166
+ return false;
3167
+ }
3168
+ while (size--) {
3169
+ key = aKeys[size];
3170
+ result = hasKey2(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey2);
3171
+ if (!result) {
3172
+ return false;
3173
+ }
3174
+ }
3175
+ aStack.pop();
3176
+ bStack.pop();
3177
+ return result;
3178
+ }
3179
+ function keys(obj, hasKey2) {
3180
+ var keys2 = [];
3181
+ for (var key in obj) {
3182
+ if (hasKey2(obj, key)) {
3183
+ keys2.push(key);
3184
+ }
3185
+ }
3186
+ return keys2.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable));
3187
+ }
3188
+ function hasDefinedKey(obj, key) {
3189
+ return hasKey(obj, key) && obj[key] !== void 0;
3190
+ }
3191
+ function hasKey(obj, key) {
3192
+ return Object.prototype.hasOwnProperty.call(obj, key);
3193
+ }
3194
+ function isA(typeName, value) {
3195
+ return Object.prototype.toString.apply(value) === "[object " + typeName + "]";
3196
+ }
3197
+ function isDomNode(obj) {
3198
+ return obj !== null && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string" && typeof obj.isEqualNode === "function";
3199
+ }
3200
+ const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
3201
+ const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
3202
+ const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
3203
+ function isImmutableUnorderedKeyed(maybeKeyed) {
3204
+ return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
3205
+ }
3206
+ function isImmutableUnorderedSet(maybeSet) {
3207
+ return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
3208
+ }
3209
+ const IteratorSymbol = Symbol.iterator;
3210
+ const hasIterator = (object) => !!(object != null && object[IteratorSymbol]);
3211
+ const iterableEquality = (a, b, aStack = [], bStack = []) => {
3212
+ if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
3213
+ return void 0;
3214
+ }
3215
+ if (a.constructor !== b.constructor) {
3216
+ return false;
3217
+ }
3218
+ let length = aStack.length;
3219
+ while (length--) {
3220
+ if (aStack[length] === a) {
3221
+ return bStack[length] === b;
3222
+ }
3223
+ }
3224
+ aStack.push(a);
3225
+ bStack.push(b);
3226
+ const iterableEqualityWithStack = (a2, b2) => iterableEquality(a2, b2, [...aStack], [...bStack]);
3227
+ if (a.size !== void 0) {
3228
+ if (a.size !== b.size) {
3229
+ return false;
3230
+ } else if (isA("Set", a) || isImmutableUnorderedSet(a)) {
3231
+ let allFound = true;
3232
+ for (const aValue of a) {
3233
+ if (!b.has(aValue)) {
3234
+ let has = false;
3235
+ for (const bValue of b) {
3236
+ const isEqual = equals(aValue, bValue, [iterableEqualityWithStack]);
3237
+ if (isEqual === true) {
3238
+ has = true;
3239
+ }
3240
+ }
3241
+ if (has === false) {
3242
+ allFound = false;
3243
+ break;
3244
+ }
3245
+ }
3246
+ }
3247
+ aStack.pop();
3248
+ bStack.pop();
3249
+ return allFound;
3250
+ } else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) {
3251
+ let allFound = true;
3252
+ for (const aEntry of a) {
3253
+ if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), [iterableEqualityWithStack])) {
3254
+ let has = false;
3255
+ for (const bEntry of b) {
3256
+ const matchedKey = equals(aEntry[0], bEntry[0], [
3257
+ iterableEqualityWithStack
3258
+ ]);
3259
+ let matchedValue = false;
3260
+ if (matchedKey === true) {
3261
+ matchedValue = equals(aEntry[1], bEntry[1], [
3262
+ iterableEqualityWithStack
3263
+ ]);
3264
+ }
3265
+ if (matchedValue === true) {
3266
+ has = true;
3267
+ }
3268
+ }
3269
+ if (has === false) {
3270
+ allFound = false;
3271
+ break;
3272
+ }
3273
+ }
3274
+ }
3275
+ aStack.pop();
3276
+ bStack.pop();
3277
+ return allFound;
3278
+ }
3279
+ }
3280
+ const bIterator = b[IteratorSymbol]();
3281
+ for (const aValue of a) {
3282
+ const nextB = bIterator.next();
3283
+ if (nextB.done || !equals(aValue, nextB.value, [iterableEqualityWithStack])) {
3284
+ return false;
3285
+ }
3286
+ }
3287
+ if (!bIterator.next().done) {
3288
+ return false;
3289
+ }
3290
+ aStack.pop();
3291
+ bStack.pop();
3292
+ return true;
3293
+ };
3294
+ const hasPropertyInObject = (object, key) => {
3295
+ const shouldTerminate = !object || typeof object !== "object" || object === Object.prototype;
3296
+ if (shouldTerminate) {
3297
+ return false;
3298
+ }
3299
+ return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
3300
+ };
3301
+ const isObjectWithKeys = (a) => isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
3302
+ const subsetEquality = (object, subset) => {
3303
+ const subsetEqualityWithContext = (seenReferences = new WeakMap()) => (object2, subset2) => {
3304
+ if (!isObjectWithKeys(subset2)) {
3305
+ return void 0;
3306
+ }
3307
+ return Object.keys(subset2).every((key) => {
3308
+ if (isObjectWithKeys(subset2[key])) {
3309
+ if (seenReferences.has(subset2[key])) {
3310
+ return equals(object2[key], subset2[key], [iterableEquality]);
3311
+ }
3312
+ seenReferences.set(subset2[key], true);
3313
+ }
3314
+ const result = object2 != null && hasPropertyInObject(object2, key) && equals(object2[key], subset2[key], [
3315
+ iterableEquality,
3316
+ subsetEqualityWithContext(seenReferences)
3317
+ ]);
3318
+ seenReferences.delete(subset2[key]);
3319
+ return result;
3320
+ });
3321
+ };
3322
+ return subsetEqualityWithContext()(object, subset);
3323
+ };
3324
+
3325
+ var __defProp = Object.defineProperty;
3326
+ var __defProps = Object.defineProperties;
3327
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3328
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3329
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3330
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
3331
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3332
+ var __spreadValues = (a, b) => {
3333
+ for (var prop in b || (b = {}))
3334
+ if (__hasOwnProp.call(b, prop))
3335
+ __defNormalProp(a, prop, b[prop]);
3336
+ if (__getOwnPropSymbols)
3337
+ for (var prop of __getOwnPropSymbols(b)) {
3338
+ if (__propIsEnum.call(b, prop))
3339
+ __defNormalProp(a, prop, b[prop]);
3340
+ }
3341
+ return a;
3342
+ };
3343
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3344
+ const isAsyncFunction = (fn) => typeof fn === "function" && fn[Symbol.toStringTag] === "AsyncFunction";
3345
+ const getMatcherState = (assertion) => {
3346
+ const actual = assertion._obj;
3347
+ const isNot = util.flag(assertion, "negate");
3348
+ const jestUtils = __spreadProps(__spreadValues({}, matcherUtils), {
3349
+ iterableEquality,
3350
+ subsetEquality
3351
+ });
3352
+ const matcherState = {
3353
+ isNot,
3354
+ utils: jestUtils,
3355
+ assertionCalls: 0,
3356
+ promise: "",
3357
+ equals,
3358
+ suppressedErrors: []
3359
+ };
3360
+ return {
3361
+ state: matcherState,
3362
+ isNot,
3363
+ actual
3364
+ };
3365
+ };
3366
+ function JestExtendPlugin(expects) {
3367
+ return (c, utils) => {
3368
+ Object.entries(expects).forEach(([expectAssertionName, expectAssertion]) => {
3369
+ function expectSyncWrapper(...args) {
3370
+ const { state, isNot, actual } = getMatcherState(this);
3371
+ const { pass, message } = expectAssertion.call(state, actual, ...args);
3372
+ if (pass && isNot || !pass && !isNot)
3373
+ c.expect.fail(message());
3374
+ }
3375
+ async function expectAsyncWrapper(...args) {
3376
+ const { state, isNot, actual } = getMatcherState(this);
3377
+ const { pass, message } = await expectAssertion.call(state, actual, ...args);
3378
+ if (pass && isNot || !pass && !isNot)
3379
+ c.expect.fail(message());
3380
+ }
3381
+ const expectAssertionWrapper = isAsyncFunction(expectAssertion) ? expectAsyncWrapper : expectSyncWrapper;
3382
+ utils.addMethod(chai.Assertion.prototype, expectAssertionName, expectAssertionWrapper);
3383
+ });
3384
+ };
3385
+ }
3386
+ function JestExtend() {
3387
+ return (chai2, utils) => {
3388
+ utils.addMethod(chai2.expect, "extend", (expects) => {
3389
+ chai2.use(JestExtendPlugin(expects));
3390
+ });
3391
+ };
3392
+ }
3393
+
3394
+ function JestChaiExpect() {
3395
+ return (chai, utils) => {
3396
+ function def(name, fn) {
3397
+ const addMethod = (n) => {
3398
+ utils.addMethod(chai.Assertion.prototype, n, fn);
3399
+ };
3400
+ if (Array.isArray(name))
3401
+ name.forEach((n) => addMethod(n));
3402
+ else
3403
+ addMethod(name);
3404
+ }
3405
+ def("toEqual", function(expected) {
3406
+ return this.eql(expected);
3407
+ });
3408
+ def("toStrictEqual", function(expected) {
3409
+ return this.equal(expected);
3410
+ });
3411
+ def("toBe", function(expected) {
3412
+ return this.equal(expected);
3413
+ });
3414
+ def("toMatchObject", function(expected) {
3415
+ return this.containSubset(expected);
3416
+ });
3417
+ def("toMatch", function(expected) {
3418
+ if (typeof expected === "string")
3419
+ return this.include(expected);
3420
+ else
3421
+ return this.match(expected);
3422
+ });
3423
+ def("toContain", function(item) {
3424
+ return this.contain(item);
3425
+ });
3426
+ def("toContainEqual", function(expected) {
3427
+ const obj = utils.flag(this, "object");
3428
+ const index = Array.from(obj).findIndex((item) => {
3429
+ try {
3430
+ chai.assert.deepEqual(item, expected);
3431
+ } catch {
3432
+ return false;
3433
+ }
3434
+ return true;
3435
+ });
3436
+ this.assert(index !== -1, "expected #{this} to deep equally contain #{exp}", "expected #{this} to not deep equally contain #{exp}", expected);
3437
+ });
3438
+ def("toBeTruthy", function() {
3439
+ const obj = utils.flag(this, "object");
3440
+ this.assert(Boolean(obj), "expected #{this} to be truthy", "expected #{this} to not be truthy", obj);
3441
+ });
3442
+ def("toBeFalsy", function() {
3443
+ const obj = utils.flag(this, "object");
3444
+ this.assert(!obj, "expected #{this} to be falsy", "expected #{this} to not be falsy", obj);
3445
+ });
3446
+ def("toBeGreaterThan", function(expected) {
3447
+ return this.to.greaterThan(expected);
3448
+ });
3449
+ def("toBeGreaterThanOrEqual", function(expected) {
3450
+ return this.to.greaterThanOrEqual(expected);
3451
+ });
3452
+ def("toBeLessThan", function(expected) {
3453
+ return this.to.lessThan(expected);
3454
+ });
3455
+ def("toBeLessThanOrEqual", function(expected) {
3456
+ return this.to.lessThanOrEqual(expected);
3457
+ });
3458
+ def("toBeNaN", function() {
3459
+ return this.be.NaN;
3460
+ });
3461
+ def("toBeUndefined", function() {
3462
+ return this.be.undefined;
3463
+ });
3464
+ def("toBeNull", function() {
3465
+ return this.be.null;
3466
+ });
3467
+ def("toBeDefined", function() {
3468
+ return this.not.be.undefined;
3469
+ });
3470
+ def("toBeInstanceOf", function(obj) {
3471
+ return this.instanceOf(obj);
3472
+ });
3473
+ def("toHaveLength", function(length) {
3474
+ return this.have.length(length);
3475
+ });
3476
+ def("toBeCloseTo", function(number, numDigits = 2) {
3477
+ utils.expectTypes(this, ["number"]);
3478
+ return this.closeTo(number, numDigits);
3479
+ });
3480
+ function isSpy(putativeSpy) {
3481
+ return typeof putativeSpy === "function" && typeof putativeSpy.getCall === "function" && typeof putativeSpy.calledWithExactly === "function";
3482
+ }
3483
+ function isCall(putativeCall) {
3484
+ return putativeCall && isSpy(putativeCall.proxy);
3485
+ }
3486
+ const assertIsMock = (assertion) => {
3487
+ if (!isSpy(assertion._obj) && !isCall(assertion._obj))
3488
+ throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`);
3489
+ };
3490
+ def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) {
3491
+ assertIsMock(this);
3492
+ return this.callCount(number);
3493
+ });
3494
+ def("toHaveBeenCalledOnce", function() {
3495
+ assertIsMock(this);
3496
+ return this.callCount(1);
3497
+ });
3498
+ def(["toHaveBeenCalled", "toBeCalled"], function() {
3499
+ assertIsMock(this);
3500
+ return this.called;
3501
+ });
3502
+ def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) {
3503
+ assertIsMock(this);
3504
+ return this.calledWith(...args);
3505
+ });
3506
+ const ordinalOf = (i) => {
3507
+ const j = i % 10;
3508
+ const k = i % 100;
3509
+ if (j === 1 && k !== 11)
3510
+ return `${i}st`;
3511
+ if (j === 2 && k !== 12)
3512
+ return `${i}nd`;
3513
+ if (j === 3 && k !== 13)
3514
+ return `${i}rd`;
3515
+ return `${i}th`;
3516
+ };
3517
+ def(["toHaveBeenNthCalledWith", "nthCalledWith"], function(times, ...args) {
3518
+ assertIsMock(this);
3519
+ const spy = utils.flag(this, "object");
3520
+ const nthCall = spy.getCall(times - 1);
3521
+ this.assert(nthCall.calledWith(...args), `expected ${ordinalOf(times)} spy call to have been called with #{exp}`, `expected ${ordinalOf(times)} spy call not to have been called with #{exp}`, args, nthCall.args);
3522
+ });
3523
+ def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) {
3524
+ assertIsMock(this);
3525
+ const spy = utils.flag(this, "object");
3526
+ const lastCall = spy.getCall(spy.returnValues.length - 1);
3527
+ this.assert(lastCall.calledWith(...args), "expected last spy call to have been called with #{exp}", "expected last spy call not to have been called with #{exp}", args, lastCall.args);
3528
+ });
3529
+ def(["toThrow", "toThrowError"], function(expected) {
3530
+ const negate = utils.flag(this, "negate");
3531
+ if (negate)
3532
+ this.not.to.throw(expected);
3533
+ else
3534
+ this.to.throw(expected);
3535
+ });
3536
+ def(["toHaveReturned", "toReturn"], function() {
3537
+ assertIsMock(this);
3538
+ const spy = utils.flag(this, "object");
3539
+ const calledAndNotThrew = spy.called && !spy.alwaysThrew();
3540
+ this.assert(calledAndNotThrew, "expected spy to be successfully called at least once", "expected spy not to be successfully called", calledAndNotThrew, !calledAndNotThrew);
3541
+ });
3542
+ def(["toHaveReturnedTimes", "toReturnTimes"], function(times) {
3543
+ assertIsMock(this);
3544
+ const spy = utils.flag(this, "object");
3545
+ const successfullReturns = spy.getCalls().reduce((success, call) => call.threw() ? success : ++success, 0);
3546
+ this.assert(successfullReturns === times, `expected spy to be successfully called ${times} times`, `expected spy not to be successfully called ${times} times`, `expected number of returns: ${times}`, `recieved number of returns: ${successfullReturns}`);
3547
+ });
3548
+ def(["toHaveReturnedWith", "toReturnWith"], function(value) {
3549
+ assertIsMock(this);
3550
+ return this.returned(value);
3551
+ });
3552
+ def(["toHaveLastReturnedWith", "lastReturnedWith"], function(value) {
3553
+ assertIsMock(this);
3554
+ const spy = utils.flag(this, "object");
3555
+ const lastReturn = spy.lastCall.returned(value);
3556
+ this.assert(lastReturn, "expected last spy call to return #{exp}", "expected last spy call not to return #{exp}", value, spy.lastCall.returnValue);
3557
+ });
3558
+ def(["toHaveNthReturnedWith", "nthReturnedWith"], function(nthCall, value) {
3559
+ assertIsMock(this);
3560
+ const spy = utils.flag(this, "object");
3561
+ const isNot = utils.flag(this, "negate");
3562
+ const call = spy.getCall(nthCall - 1);
3563
+ const ordinalCall = `${ordinalOf(nthCall)} call`;
3564
+ if (!isNot && call.threw())
3565
+ chai.assert.fail(`expected ${ordinalCall} to return #{exp}, but instead it threw an error`);
3566
+ const nthCallReturn = call.returned(value);
3567
+ this.assert(nthCallReturn, `expected ${ordinalCall} spy call to return #{exp}`, `expected ${ordinalCall} spy call not to return #{exp}`, value, call.returnValue);
3568
+ });
3569
+ };
3570
+ }
3571
+
3572
+ let installed = false;
3573
+ async function setupChai() {
3574
+ if (installed)
3575
+ return;
3576
+ chai.use(SinonChai);
3577
+ chai.use(JestExtend());
3578
+ chai.use(JestChaiExpect());
3579
+ chai.use(Subset);
3580
+ chai.use(SnapshotPlugin());
3581
+ installed = true;
3582
+ }
3583
+
3584
+ async function setupGlobalEnv(config) {
3585
+ await setupChai();
3586
+ if (config.global)
3587
+ (await import('./global-e40b54d6.js')).registerApiGlobally();
3588
+ }
3589
+ async function withEnv(name, fn) {
3590
+ const env = await environments[name].setup(globalThis);
3591
+ try {
3592
+ await fn();
3593
+ } finally {
3594
+ await env.teardown(globalThis);
3595
+ }
3596
+ }
3597
+
3598
+ function processError(err) {
3599
+ if (!err)
3600
+ return err;
3601
+ if (err.stack)
3602
+ err.stackStr = String(err.stack);
3603
+ if (err.name)
3604
+ err.nameStr = String(err.name);
3605
+ return err;
3606
+ }
3607
+
3608
+ async function collectTests(paths) {
3609
+ const files = [];
3610
+ for (const filepath of paths) {
3611
+ const file = {
3612
+ id: nanoid(),
3613
+ name: basename(filepath),
3614
+ type: "suite",
3615
+ mode: "run",
3616
+ computeMode: "serial",
3617
+ filepath,
3618
+ tasks: []
3619
+ };
3620
+ setHooks(file, createSuiteHooks());
3621
+ clearContext();
3622
+ try {
3623
+ await import(filepath);
3624
+ for (const c of [defaultSuite, ...context.tasks]) {
3625
+ if (c.type === "test") {
3626
+ file.tasks.push(c);
3627
+ } else {
3628
+ const suite = await c.collect(file);
3629
+ if (suite.name || suite.tasks.length)
3630
+ file.tasks.push(suite);
3631
+ }
3632
+ }
3633
+ } catch (e) {
3634
+ file.result = {
3635
+ start: performance.now(),
3636
+ state: "fail",
3637
+ error: processError(e)
3638
+ };
3639
+ process.stdout.write("\0");
3640
+ }
3641
+ files.push(file);
3642
+ }
3643
+ const tasks = files.reduce((tasks2, file) => tasks2.concat(file.tasks), []);
3644
+ interpretOnlyMode(tasks);
3645
+ tasks.forEach((i) => {
3646
+ if (i.type === "suite") {
3647
+ if (i.mode === "skip")
3648
+ i.tasks.forEach((c) => c.mode === "run" && (c.mode = "skip"));
3649
+ else
3650
+ interpretOnlyMode(i.tasks);
3651
+ }
3652
+ });
3653
+ return files;
3654
+ }
3655
+
3656
+ async function callHook(suite, name, args) {
3657
+ await Promise.all(getHooks(suite)[name].map((fn) => fn(...args)));
3658
+ }
3659
+ function updateTask(task) {
3660
+ return rpc("onTaskUpdate", [task.id, task.result]);
3661
+ }
3662
+ async function runTest(test) {
3663
+ if (test.mode !== "run")
3664
+ return;
3665
+ test.result = {
3666
+ start: performance.now(),
3667
+ state: "run"
3668
+ };
3669
+ updateTask(test);
3670
+ getSnapshotClient().setTest(test);
3671
+ try {
3672
+ await callHook(test.suite, "beforeEach", [test, test.suite]);
3673
+ await getFn(test)();
3674
+ test.result.state = "pass";
3675
+ } catch (e) {
3676
+ test.result.state = "fail";
3677
+ test.result.error = processError(e);
3678
+ }
3679
+ try {
3680
+ await callHook(test.suite, "afterEach", [test, test.suite]);
3681
+ } catch (e) {
3682
+ test.result.state = "fail";
3683
+ test.result.error = processError(e);
3684
+ }
3685
+ getSnapshotClient().clearTest();
3686
+ test.result.end = performance.now();
3687
+ updateTask(test);
3688
+ }
3689
+ async function runSuite(suite) {
3690
+ var _a;
3691
+ if (((_a = suite.result) == null ? void 0 : _a.state) === "fail")
3692
+ return;
3693
+ suite.result = {
3694
+ start: performance.now(),
3695
+ state: "run"
3696
+ };
3697
+ updateTask(suite);
3698
+ if (suite.mode === "skip") {
3699
+ suite.result.state = "skip";
3700
+ } else if (suite.mode === "todo") {
3701
+ suite.result.state = "todo";
3702
+ } else {
3703
+ try {
3704
+ await callHook(suite, "beforeAll", [suite]);
3705
+ for (const tasksGroup of partitionSuiteChildren(suite)) {
3706
+ const computeMode = tasksGroup[0].computeMode;
3707
+ if (computeMode === "serial") {
3708
+ for (const c of tasksGroup)
3709
+ await runSuiteChild(c);
3710
+ } else if (computeMode === "concurrent") {
3711
+ await Promise.all(tasksGroup.map((c) => runSuiteChild(c)));
3712
+ }
3713
+ }
3714
+ await callHook(suite, "afterAll", [suite]);
3715
+ } catch (e) {
3716
+ suite.result.state = "fail";
3717
+ suite.result.error = processError(e);
3718
+ }
3719
+ }
3720
+ suite.result.end = performance.now();
3721
+ if (suite.mode === "run") {
3722
+ if (!hasTests(suite)) {
3723
+ suite.result.state = "fail";
3724
+ if (!suite.result.error)
3725
+ suite.result.error = new Error(`No tests found in suite ${suite.name}`);
3726
+ } else if (hasFailed(suite)) {
3727
+ suite.result.state = "fail";
3728
+ } else {
3729
+ suite.result.state = "pass";
3730
+ }
3731
+ }
3732
+ updateTask(suite);
3733
+ }
3734
+ async function runSuiteChild(c) {
3735
+ return c.type === "test" ? runTest(c) : runSuite(c);
3736
+ }
3737
+ async function runSuites(suites) {
3738
+ for (const suite of suites)
3739
+ await runSuite(suite);
3740
+ }
3741
+ async function startTests(paths) {
3742
+ const files = await collectTests(paths);
3743
+ send("onCollected", files);
3744
+ await runSuites(files);
3745
+ await getSnapshotClient().saveSnap();
3746
+ }
3747
+
3748
+ async function run(files, config) {
3749
+ await setupGlobalEnv(config);
3750
+ await withEnv(config.environment, async () => {
3751
+ await startTests(files);
3752
+ });
3753
+ }
3754
+
3755
+ export { run };