vitest 0.27.2 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/LICENSE.md +4 -93
  2. package/browser.d.ts +1 -1
  3. package/dist/browser.d.ts +11 -13
  4. package/dist/browser.js +10 -34
  5. package/dist/{chunk-api-setup.029198e3.js → chunk-api-setup.52751a38.js} +27 -12
  6. package/dist/chunk-constants.797d3ebf.js +42 -0
  7. package/dist/{chunk-env-node.787e9561.js → chunk-env-node.ffd1183b.js} +26 -0
  8. package/dist/{chunk-install-pkg.7b006b3e.js → chunk-install-pkg.cfd23146.js} +51 -11
  9. package/dist/chunk-integrations-coverage.48e6286b.js +3993 -0
  10. package/dist/chunk-integrations-globals.0d5f50f0.js +29 -0
  11. package/dist/chunk-integrations-run-once.38756e30.js +27 -0
  12. package/dist/chunk-integrations-utils.f1f6f1ed.js +118 -0
  13. package/dist/{chunk-node-git.125c9008.js → chunk-node-git.d9ad64ab.js} +6 -7
  14. package/dist/{chunk-snapshot-manager.ce714e21.js → chunk-node-pkg.dcdf4369.js} +12653 -9324
  15. package/dist/{chunk-runtime-mocker.58511c38.js → chunk-runtime-mocker.03017e8c.js} +14 -13
  16. package/dist/{chunk-runtime-rpc.d709e91b.js → chunk-runtime-rpc.9c0386cc.js} +3 -2
  17. package/dist/chunk-runtime-setup.d9302cfd.js +20 -0
  18. package/dist/chunk-snapshot-env.6457638e.js +11 -0
  19. package/dist/chunk-utils-base.977ae74f.js +77 -0
  20. package/dist/chunk-utils-env.860d90c2.js +6 -0
  21. package/dist/chunk-utils-global.442d1d33.js +73 -0
  22. package/dist/{chunk-utils-import.054ab315.js → chunk-utils-import.9911c99d.js} +3289 -169
  23. package/dist/chunk-utils-tasks.1b603032.js +103 -0
  24. package/dist/cli-wrapper.js +8 -6
  25. package/dist/cli.js +18 -15
  26. package/dist/config.cjs +10 -7
  27. package/dist/config.d.ts +22 -4
  28. package/dist/config.js +10 -8
  29. package/dist/entry.js +244 -28
  30. package/dist/env-afee91f0.d.ts +10 -0
  31. package/dist/environments.d.ts +7 -2
  32. package/dist/environments.js +1 -1
  33. package/dist/index.d.ts +160 -11
  34. package/dist/index.js +18 -18
  35. package/dist/loader.js +9 -8
  36. package/dist/node.d.ts +9 -7
  37. package/dist/node.js +20 -17
  38. package/dist/runners-chunk.js +215 -0
  39. package/dist/runners.d.ts +39 -0
  40. package/dist/runners.js +18 -0
  41. package/dist/spy.js +1 -2
  42. package/dist/suite.d.ts +2 -0
  43. package/dist/suite.js +2 -18
  44. package/dist/{types-d97c72c7.d.ts → types-c800444e.d.ts} +196 -437
  45. package/dist/{vendor-index.e6c27006.js → vendor-index.618ca5a1.js} +1078 -10
  46. package/dist/{vendor-index.b0346fe4.js → vendor-index.bdee400f.js} +1 -0
  47. package/dist/worker.js +17 -16
  48. package/package.json +22 -12
  49. package/runners.d.ts +1 -0
  50. package/suite.d.ts +1 -0
  51. package/dist/chunk-integrations-coverage.44413252.js +0 -240
  52. package/dist/chunk-integrations-globals.0024ce21.js +0 -27
  53. package/dist/chunk-mock-date.c543fa3e.js +0 -349
  54. package/dist/chunk-runtime-chain.2da9e75c.js +0 -2595
  55. package/dist/chunk-runtime-error.de671af0.js +0 -144
  56. package/dist/chunk-runtime-setup.35da9209.js +0 -649
  57. package/dist/chunk-utils-env.f4a39d2c.js +0 -228
  58. package/dist/chunk-utils-source-map.5f5d12cf.js +0 -408
  59. package/dist/chunk-utils-timers.52534f96.js +0 -3573
  60. package/dist/index-50755efe.d.ts +0 -258
  61. package/dist/vendor-index.451e37bc.js +0 -1071
  62. package/dist/vendor-index.723a074f.js +0 -102
  63. package/dist/vendor-index.9c919048.js +0 -61
  64. package/dist/vendor-index.9f20a9be.js +0 -6291
@@ -1,3573 +0,0 @@
1
- import 'picocolors';
2
-
3
- const {
4
- setTimeout: safeSetTimeout,
5
- setInterval: safeSetInterval,
6
- clearInterval: safeClearInterval,
7
- clearTimeout: safeClearTimeout
8
- } = globalThis;
9
-
10
- function Diff() {}
11
- Diff.prototype = {
12
- diff: function diff(oldString, newString) {
13
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
14
- var callback = options.callback;
15
-
16
- if (typeof options === 'function') {
17
- callback = options;
18
- options = {};
19
- }
20
-
21
- this.options = options;
22
- var self = this;
23
-
24
- function done(value) {
25
- if (callback) {
26
- setTimeout(function () {
27
- callback(undefined, value);
28
- }, 0);
29
- return true;
30
- } else {
31
- return value;
32
- }
33
- } // Allow subclasses to massage the input prior to running
34
-
35
-
36
- oldString = this.castInput(oldString);
37
- newString = this.castInput(newString);
38
- oldString = this.removeEmpty(this.tokenize(oldString));
39
- newString = this.removeEmpty(this.tokenize(newString));
40
- var newLen = newString.length,
41
- oldLen = oldString.length;
42
- var editLength = 1;
43
- var maxEditLength = newLen + oldLen;
44
-
45
- if (options.maxEditLength) {
46
- maxEditLength = Math.min(maxEditLength, options.maxEditLength);
47
- }
48
-
49
- var bestPath = [{
50
- newPos: -1,
51
- components: []
52
- }]; // Seed editLength = 0, i.e. the content starts with the same values
53
-
54
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
55
-
56
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
57
- // Identity per the equality and tokenizer
58
- return done([{
59
- value: this.join(newString),
60
- count: newString.length
61
- }]);
62
- } // Main worker method. checks all permutations of a given edit length for acceptance.
63
-
64
-
65
- function execEditLength() {
66
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
67
- var basePath = void 0;
68
-
69
- var addPath = bestPath[diagonalPath - 1],
70
- removePath = bestPath[diagonalPath + 1],
71
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
72
-
73
- if (addPath) {
74
- // No one else is going to attempt to use this value, clear it
75
- bestPath[diagonalPath - 1] = undefined;
76
- }
77
-
78
- var canAdd = addPath && addPath.newPos + 1 < newLen,
79
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
80
-
81
- if (!canAdd && !canRemove) {
82
- // If this path is a terminal then prune
83
- bestPath[diagonalPath] = undefined;
84
- continue;
85
- } // Select the diagonal that we want to branch from. We select the prior
86
- // path whose position in the new string is the farthest from the origin
87
- // and does not pass the bounds of the diff graph
88
-
89
-
90
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
91
- basePath = clonePath(removePath);
92
- self.pushComponent(basePath.components, undefined, true);
93
- } else {
94
- basePath = addPath; // No need to clone, we've pulled it from the list
95
-
96
- basePath.newPos++;
97
- self.pushComponent(basePath.components, true, undefined);
98
- }
99
-
100
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
101
-
102
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
103
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
104
- } else {
105
- // Otherwise track this path as a potential candidate and continue.
106
- bestPath[diagonalPath] = basePath;
107
- }
108
- }
109
-
110
- editLength++;
111
- } // Performs the length of edit iteration. Is a bit fugly as this has to support the
112
- // sync and async mode which is never fun. Loops over execEditLength until a value
113
- // is produced, or until the edit length exceeds options.maxEditLength (if given),
114
- // in which case it will return undefined.
115
-
116
-
117
- if (callback) {
118
- (function exec() {
119
- setTimeout(function () {
120
- if (editLength > maxEditLength) {
121
- return callback();
122
- }
123
-
124
- if (!execEditLength()) {
125
- exec();
126
- }
127
- }, 0);
128
- })();
129
- } else {
130
- while (editLength <= maxEditLength) {
131
- var ret = execEditLength();
132
-
133
- if (ret) {
134
- return ret;
135
- }
136
- }
137
- }
138
- },
139
- pushComponent: function pushComponent(components, added, removed) {
140
- var last = components[components.length - 1];
141
-
142
- if (last && last.added === added && last.removed === removed) {
143
- // We need to clone here as the component clone operation is just
144
- // as shallow array clone
145
- components[components.length - 1] = {
146
- count: last.count + 1,
147
- added: added,
148
- removed: removed
149
- };
150
- } else {
151
- components.push({
152
- count: 1,
153
- added: added,
154
- removed: removed
155
- });
156
- }
157
- },
158
- extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
159
- var newLen = newString.length,
160
- oldLen = oldString.length,
161
- newPos = basePath.newPos,
162
- oldPos = newPos - diagonalPath,
163
- commonCount = 0;
164
-
165
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
166
- newPos++;
167
- oldPos++;
168
- commonCount++;
169
- }
170
-
171
- if (commonCount) {
172
- basePath.components.push({
173
- count: commonCount
174
- });
175
- }
176
-
177
- basePath.newPos = newPos;
178
- return oldPos;
179
- },
180
- equals: function equals(left, right) {
181
- if (this.options.comparator) {
182
- return this.options.comparator(left, right);
183
- } else {
184
- return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
185
- }
186
- },
187
- removeEmpty: function removeEmpty(array) {
188
- var ret = [];
189
-
190
- for (var i = 0; i < array.length; i++) {
191
- if (array[i]) {
192
- ret.push(array[i]);
193
- }
194
- }
195
-
196
- return ret;
197
- },
198
- castInput: function castInput(value) {
199
- return value;
200
- },
201
- tokenize: function tokenize(value) {
202
- return value.split('');
203
- },
204
- join: function join(chars) {
205
- return chars.join('');
206
- }
207
- };
208
-
209
- function buildValues(diff, components, newString, oldString, useLongestToken) {
210
- var componentPos = 0,
211
- componentLen = components.length,
212
- newPos = 0,
213
- oldPos = 0;
214
-
215
- for (; componentPos < componentLen; componentPos++) {
216
- var component = components[componentPos];
217
-
218
- if (!component.removed) {
219
- if (!component.added && useLongestToken) {
220
- var value = newString.slice(newPos, newPos + component.count);
221
- value = value.map(function (value, i) {
222
- var oldValue = oldString[oldPos + i];
223
- return oldValue.length > value.length ? oldValue : value;
224
- });
225
- component.value = diff.join(value);
226
- } else {
227
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
228
- }
229
-
230
- newPos += component.count; // Common case
231
-
232
- if (!component.added) {
233
- oldPos += component.count;
234
- }
235
- } else {
236
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
237
- oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
238
- // The diffing algorithm is tied to add then remove output and this is the simplest
239
- // route to get the desired output with minimal overhead.
240
-
241
- if (componentPos && components[componentPos - 1].added) {
242
- var tmp = components[componentPos - 1];
243
- components[componentPos - 1] = components[componentPos];
244
- components[componentPos] = tmp;
245
- }
246
- }
247
- } // Special case handle for when one terminal is ignored (i.e. whitespace).
248
- // For this case we merge the terminal into the prior string and drop the change.
249
- // This is only available for string mode.
250
-
251
-
252
- var lastComponent = components[componentLen - 1];
253
-
254
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
255
- components[componentLen - 2].value += lastComponent.value;
256
- components.pop();
257
- }
258
-
259
- return components;
260
- }
261
-
262
- function clonePath(path) {
263
- return {
264
- newPos: path.newPos,
265
- components: path.components.slice(0)
266
- };
267
- }
268
-
269
- //
270
- // Ranges and exceptions:
271
- // Latin-1 Supplement, 0080–00FF
272
- // - U+00D7 × Multiplication sign
273
- // - U+00F7 ÷ Division sign
274
- // Latin Extended-A, 0100–017F
275
- // Latin Extended-B, 0180–024F
276
- // IPA Extensions, 0250–02AF
277
- // Spacing Modifier Letters, 02B0–02FF
278
- // - U+02C7 ˇ &#711; Caron
279
- // - U+02D8 ˘ &#728; Breve
280
- // - U+02D9 ˙ &#729; Dot Above
281
- // - U+02DA ˚ &#730; Ring Above
282
- // - U+02DB ˛ &#731; Ogonek
283
- // - U+02DC ˜ &#732; Small Tilde
284
- // - U+02DD ˝ &#733; Double Acute Accent
285
- // Latin Extended Additional, 1E00–1EFF
286
-
287
- var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
288
- var reWhitespace = /\S/;
289
- var wordDiff = new Diff();
290
-
291
- wordDiff.equals = function (left, right) {
292
- if (this.options.ignoreCase) {
293
- left = left.toLowerCase();
294
- right = right.toLowerCase();
295
- }
296
-
297
- return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
298
- };
299
-
300
- wordDiff.tokenize = function (value) {
301
- // All whitespace symbols except newline group into one token, each newline - in separate token
302
- var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
303
-
304
- for (var i = 0; i < tokens.length - 1; i++) {
305
- // If we have an empty string in the next field and we have only word chars before and after, merge
306
- if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
307
- tokens[i] += tokens[i + 2];
308
- tokens.splice(i + 1, 2);
309
- i--;
310
- }
311
- }
312
-
313
- return tokens;
314
- };
315
-
316
- var lineDiff = new Diff();
317
-
318
- lineDiff.tokenize = function (value) {
319
- var retLines = [],
320
- linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
321
-
322
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
323
- linesAndNewlines.pop();
324
- } // Merge the content and line separators into single tokens
325
-
326
-
327
- for (var i = 0; i < linesAndNewlines.length; i++) {
328
- var line = linesAndNewlines[i];
329
-
330
- if (i % 2 && !this.options.newlineIsToken) {
331
- retLines[retLines.length - 1] += line;
332
- } else {
333
- if (this.options.ignoreWhitespace) {
334
- line = line.trim();
335
- }
336
-
337
- retLines.push(line);
338
- }
339
- }
340
-
341
- return retLines;
342
- };
343
-
344
- function diffLines(oldStr, newStr, callback) {
345
- return lineDiff.diff(oldStr, newStr, callback);
346
- }
347
-
348
- var sentenceDiff = new Diff();
349
-
350
- sentenceDiff.tokenize = function (value) {
351
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
352
- };
353
-
354
- var cssDiff = new Diff();
355
-
356
- cssDiff.tokenize = function (value) {
357
- return value.split(/([{}:;,]|\s+)/);
358
- };
359
-
360
- function _typeof(obj) {
361
- "@babel/helpers - typeof";
362
-
363
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
364
- _typeof = function (obj) {
365
- return typeof obj;
366
- };
367
- } else {
368
- _typeof = function (obj) {
369
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
370
- };
371
- }
372
-
373
- return _typeof(obj);
374
- }
375
-
376
- function _toConsumableArray(arr) {
377
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
378
- }
379
-
380
- function _arrayWithoutHoles(arr) {
381
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
382
- }
383
-
384
- function _iterableToArray(iter) {
385
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
386
- }
387
-
388
- function _unsupportedIterableToArray(o, minLen) {
389
- if (!o) return;
390
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
391
- var n = Object.prototype.toString.call(o).slice(8, -1);
392
- if (n === "Object" && o.constructor) n = o.constructor.name;
393
- if (n === "Map" || n === "Set") return Array.from(o);
394
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
395
- }
396
-
397
- function _arrayLikeToArray(arr, len) {
398
- if (len == null || len > arr.length) len = arr.length;
399
-
400
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
401
-
402
- return arr2;
403
- }
404
-
405
- function _nonIterableSpread() {
406
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
407
- }
408
-
409
- var objectPrototypeToString = Object.prototype.toString;
410
- var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
411
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
412
-
413
- jsonDiff.useLongestToken = true;
414
- jsonDiff.tokenize = lineDiff.tokenize;
415
-
416
- jsonDiff.castInput = function (value) {
417
- var _this$options = this.options,
418
- undefinedReplacement = _this$options.undefinedReplacement,
419
- _this$options$stringi = _this$options.stringifyReplacer,
420
- stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
421
- return typeof v === 'undefined' ? undefinedReplacement : v;
422
- } : _this$options$stringi;
423
- return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
424
- };
425
-
426
- jsonDiff.equals = function (left, right) {
427
- return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
428
- };
429
- // object that is already on the "stack" of items being processed. Accepts an optional replacer
430
-
431
- function canonicalize(obj, stack, replacementStack, replacer, key) {
432
- stack = stack || [];
433
- replacementStack = replacementStack || [];
434
-
435
- if (replacer) {
436
- obj = replacer(key, obj);
437
- }
438
-
439
- var i;
440
-
441
- for (i = 0; i < stack.length; i += 1) {
442
- if (stack[i] === obj) {
443
- return replacementStack[i];
444
- }
445
- }
446
-
447
- var canonicalizedObj;
448
-
449
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
450
- stack.push(obj);
451
- canonicalizedObj = new Array(obj.length);
452
- replacementStack.push(canonicalizedObj);
453
-
454
- for (i = 0; i < obj.length; i += 1) {
455
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
456
- }
457
-
458
- stack.pop();
459
- replacementStack.pop();
460
- return canonicalizedObj;
461
- }
462
-
463
- if (obj && obj.toJSON) {
464
- obj = obj.toJSON();
465
- }
466
-
467
- if (_typeof(obj) === 'object' && obj !== null) {
468
- stack.push(obj);
469
- canonicalizedObj = {};
470
- replacementStack.push(canonicalizedObj);
471
-
472
- var sortedKeys = [],
473
- _key;
474
-
475
- for (_key in obj) {
476
- /* istanbul ignore else */
477
- if (obj.hasOwnProperty(_key)) {
478
- sortedKeys.push(_key);
479
- }
480
- }
481
-
482
- sortedKeys.sort();
483
-
484
- for (i = 0; i < sortedKeys.length; i += 1) {
485
- _key = sortedKeys[i];
486
- canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
487
- }
488
-
489
- stack.pop();
490
- replacementStack.pop();
491
- } else {
492
- canonicalizedObj = obj;
493
- }
494
-
495
- return canonicalizedObj;
496
- }
497
-
498
- var arrayDiff = new Diff();
499
-
500
- arrayDiff.tokenize = function (value) {
501
- return value.slice();
502
- };
503
-
504
- arrayDiff.join = arrayDiff.removeEmpty = function (value) {
505
- return value;
506
- };
507
-
508
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
509
- if (!options) {
510
- options = {};
511
- }
512
-
513
- if (typeof options.context === 'undefined') {
514
- options.context = 4;
515
- }
516
-
517
- var diff = diffLines(oldStr, newStr, options);
518
-
519
- if (!diff) {
520
- return;
521
- }
522
-
523
- diff.push({
524
- value: '',
525
- lines: []
526
- }); // Append an empty value to make cleanup easier
527
-
528
- function contextLines(lines) {
529
- return lines.map(function (entry) {
530
- return ' ' + entry;
531
- });
532
- }
533
-
534
- var hunks = [];
535
- var oldRangeStart = 0,
536
- newRangeStart = 0,
537
- curRange = [],
538
- oldLine = 1,
539
- newLine = 1;
540
-
541
- var _loop = function _loop(i) {
542
- var current = diff[i],
543
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
544
- current.lines = lines;
545
-
546
- if (current.added || current.removed) {
547
- var _curRange;
548
-
549
- // If we have previous context, start with that
550
- if (!oldRangeStart) {
551
- var prev = diff[i - 1];
552
- oldRangeStart = oldLine;
553
- newRangeStart = newLine;
554
-
555
- if (prev) {
556
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
557
- oldRangeStart -= curRange.length;
558
- newRangeStart -= curRange.length;
559
- }
560
- } // Output our changes
561
-
562
-
563
- (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) {
564
- return (current.added ? '+' : '-') + entry;
565
- }))); // Track the updated file position
566
-
567
-
568
- if (current.added) {
569
- newLine += lines.length;
570
- } else {
571
- oldLine += lines.length;
572
- }
573
- } else {
574
- // Identical context lines. Track line changes
575
- if (oldRangeStart) {
576
- // Close out any changes that have been output (or join overlapping)
577
- if (lines.length <= options.context * 2 && i < diff.length - 2) {
578
- var _curRange2;
579
-
580
- // Overlapping
581
- (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
582
- } else {
583
- var _curRange3;
584
-
585
- // end the range and output
586
- var contextSize = Math.min(lines.length, options.context);
587
-
588
- (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
589
-
590
- var hunk = {
591
- oldStart: oldRangeStart,
592
- oldLines: oldLine - oldRangeStart + contextSize,
593
- newStart: newRangeStart,
594
- newLines: newLine - newRangeStart + contextSize,
595
- lines: curRange
596
- };
597
-
598
- if (i >= diff.length - 2 && lines.length <= options.context) {
599
- // EOF is inside this hunk
600
- var oldEOFNewline = /\n$/.test(oldStr);
601
- var newEOFNewline = /\n$/.test(newStr);
602
- var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
603
-
604
- if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
605
- // special case: old has no eol and no trailing context; no-nl can end up before adds
606
- // however, if the old file is empty, do not output the no-nl line
607
- curRange.splice(hunk.oldLines, 0, '\');
608
- }
609
-
610
- if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
611
- curRange.push('\');
612
- }
613
- }
614
-
615
- hunks.push(hunk);
616
- oldRangeStart = 0;
617
- newRangeStart = 0;
618
- curRange = [];
619
- }
620
- }
621
-
622
- oldLine += lines.length;
623
- newLine += lines.length;
624
- }
625
- };
626
-
627
- for (var i = 0; i < diff.length; i++) {
628
- _loop(i);
629
- }
630
-
631
- return {
632
- oldFileName: oldFileName,
633
- newFileName: newFileName,
634
- oldHeader: oldHeader,
635
- newHeader: newHeader,
636
- hunks: hunks
637
- };
638
- }
639
- function formatPatch(diff) {
640
- var ret = [];
641
-
642
- if (diff.oldFileName == diff.newFileName) {
643
- ret.push('Index: ' + diff.oldFileName);
644
- }
645
-
646
- ret.push('===================================================================');
647
- ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
648
- ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
649
-
650
- for (var i = 0; i < diff.hunks.length; i++) {
651
- var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
652
- // the first number is one lower than one would expect.
653
- // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
654
-
655
- if (hunk.oldLines === 0) {
656
- hunk.oldStart -= 1;
657
- }
658
-
659
- if (hunk.newLines === 0) {
660
- hunk.newStart -= 1;
661
- }
662
-
663
- ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
664
- ret.push.apply(ret, hunk.lines);
665
- }
666
-
667
- return ret.join('\n') + '\n';
668
- }
669
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
670
- return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
671
- }
672
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
673
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
674
- }
675
-
676
- const ANSI_BACKGROUND_OFFSET = 10;
677
-
678
- const wrapAnsi16 = (offset = 0) => code => `\u001B[${code + offset}m`;
679
-
680
- const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
681
-
682
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
683
-
684
- const styles = {
685
- modifier: {
686
- reset: [0, 0],
687
- // 21 isn't widely supported and 22 does the same thing
688
- bold: [1, 22],
689
- dim: [2, 22],
690
- italic: [3, 23],
691
- underline: [4, 24],
692
- overline: [53, 55],
693
- inverse: [7, 27],
694
- hidden: [8, 28],
695
- strikethrough: [9, 29],
696
- },
697
- color: {
698
- black: [30, 39],
699
- red: [31, 39],
700
- green: [32, 39],
701
- yellow: [33, 39],
702
- blue: [34, 39],
703
- magenta: [35, 39],
704
- cyan: [36, 39],
705
- white: [37, 39],
706
-
707
- // Bright color
708
- blackBright: [90, 39],
709
- gray: [90, 39], // Alias of `blackBright`
710
- grey: [90, 39], // Alias of `blackBright`
711
- redBright: [91, 39],
712
- greenBright: [92, 39],
713
- yellowBright: [93, 39],
714
- blueBright: [94, 39],
715
- magentaBright: [95, 39],
716
- cyanBright: [96, 39],
717
- whiteBright: [97, 39],
718
- },
719
- bgColor: {
720
- bgBlack: [40, 49],
721
- bgRed: [41, 49],
722
- bgGreen: [42, 49],
723
- bgYellow: [43, 49],
724
- bgBlue: [44, 49],
725
- bgMagenta: [45, 49],
726
- bgCyan: [46, 49],
727
- bgWhite: [47, 49],
728
-
729
- // Bright color
730
- bgBlackBright: [100, 49],
731
- bgGray: [100, 49], // Alias of `bgBlackBright`
732
- bgGrey: [100, 49], // Alias of `bgBlackBright`
733
- bgRedBright: [101, 49],
734
- bgGreenBright: [102, 49],
735
- bgYellowBright: [103, 49],
736
- bgBlueBright: [104, 49],
737
- bgMagentaBright: [105, 49],
738
- bgCyanBright: [106, 49],
739
- bgWhiteBright: [107, 49],
740
- },
741
- };
742
-
743
- Object.keys(styles.modifier);
744
- const foregroundColorNames = Object.keys(styles.color);
745
- const backgroundColorNames = Object.keys(styles.bgColor);
746
- [...foregroundColorNames, ...backgroundColorNames];
747
-
748
- function assembleStyles() {
749
- const codes = new Map();
750
-
751
- for (const [groupName, group] of Object.entries(styles)) {
752
- for (const [styleName, style] of Object.entries(group)) {
753
- styles[styleName] = {
754
- open: `\u001B[${style[0]}m`,
755
- close: `\u001B[${style[1]}m`,
756
- };
757
-
758
- group[styleName] = styles[styleName];
759
-
760
- codes.set(style[0], style[1]);
761
- }
762
-
763
- Object.defineProperty(styles, groupName, {
764
- value: group,
765
- enumerable: false,
766
- });
767
- }
768
-
769
- Object.defineProperty(styles, 'codes', {
770
- value: codes,
771
- enumerable: false,
772
- });
773
-
774
- styles.color.close = '\u001B[39m';
775
- styles.bgColor.close = '\u001B[49m';
776
-
777
- styles.color.ansi = wrapAnsi16();
778
- styles.color.ansi256 = wrapAnsi256();
779
- styles.color.ansi16m = wrapAnsi16m();
780
- styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
781
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
782
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
783
-
784
- // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
785
- Object.defineProperties(styles, {
786
- rgbToAnsi256: {
787
- value: (red, green, blue) => {
788
- // We use the extended greyscale palette here, with the exception of
789
- // black and white. normal palette only has 4 greyscale shades.
790
- if (red === green && green === blue) {
791
- if (red < 8) {
792
- return 16;
793
- }
794
-
795
- if (red > 248) {
796
- return 231;
797
- }
798
-
799
- return Math.round(((red - 8) / 247) * 24) + 232;
800
- }
801
-
802
- return 16
803
- + (36 * Math.round(red / 255 * 5))
804
- + (6 * Math.round(green / 255 * 5))
805
- + Math.round(blue / 255 * 5);
806
- },
807
- enumerable: false,
808
- },
809
- hexToRgb: {
810
- value: hex => {
811
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
812
- if (!matches) {
813
- return [0, 0, 0];
814
- }
815
-
816
- let [colorString] = matches;
817
-
818
- if (colorString.length === 3) {
819
- colorString = [...colorString].map(character => character + character).join('');
820
- }
821
-
822
- const integer = Number.parseInt(colorString, 16);
823
-
824
- return [
825
- /* eslint-disable no-bitwise */
826
- (integer >> 16) & 0xFF,
827
- (integer >> 8) & 0xFF,
828
- integer & 0xFF,
829
- /* eslint-enable no-bitwise */
830
- ];
831
- },
832
- enumerable: false,
833
- },
834
- hexToAnsi256: {
835
- value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
836
- enumerable: false,
837
- },
838
- ansi256ToAnsi: {
839
- value: code => {
840
- if (code < 8) {
841
- return 30 + code;
842
- }
843
-
844
- if (code < 16) {
845
- return 90 + (code - 8);
846
- }
847
-
848
- let red;
849
- let green;
850
- let blue;
851
-
852
- if (code >= 232) {
853
- red = (((code - 232) * 10) + 8) / 255;
854
- green = red;
855
- blue = red;
856
- } else {
857
- code -= 16;
858
-
859
- const remainder = code % 36;
860
-
861
- red = Math.floor(code / 36) / 5;
862
- green = Math.floor(remainder / 6) / 5;
863
- blue = (remainder % 6) / 5;
864
- }
865
-
866
- const value = Math.max(red, green, blue) * 2;
867
-
868
- if (value === 0) {
869
- return 30;
870
- }
871
-
872
- // eslint-disable-next-line no-bitwise
873
- let result = 30 + ((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
874
-
875
- if (value === 2) {
876
- result += 60;
877
- }
878
-
879
- return result;
880
- },
881
- enumerable: false,
882
- },
883
- rgbToAnsi: {
884
- value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
885
- enumerable: false,
886
- },
887
- hexToAnsi: {
888
- value: hex => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
889
- enumerable: false,
890
- },
891
- });
892
-
893
- return styles;
894
- }
895
-
896
- const ansiStyles$1 = assembleStyles();
897
-
898
- var eastasianwidth = {exports: {}};
899
-
900
- (function (module) {
901
- var eaw = {};
902
-
903
- {
904
- module.exports = eaw;
905
- }
906
-
907
- eaw.eastAsianWidth = function(character) {
908
- var x = character.charCodeAt(0);
909
- var y = (character.length == 2) ? character.charCodeAt(1) : 0;
910
- var codePoint = x;
911
- if ((0xD800 <= x && x <= 0xDBFF) && (0xDC00 <= y && y <= 0xDFFF)) {
912
- x &= 0x3FF;
913
- y &= 0x3FF;
914
- codePoint = (x << 10) | y;
915
- codePoint += 0x10000;
916
- }
917
-
918
- if ((0x3000 == codePoint) ||
919
- (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
920
- (0xFFE0 <= codePoint && codePoint <= 0xFFE6)) {
921
- return 'F';
922
- }
923
- if ((0x20A9 == codePoint) ||
924
- (0xFF61 <= codePoint && codePoint <= 0xFFBE) ||
925
- (0xFFC2 <= codePoint && codePoint <= 0xFFC7) ||
926
- (0xFFCA <= codePoint && codePoint <= 0xFFCF) ||
927
- (0xFFD2 <= codePoint && codePoint <= 0xFFD7) ||
928
- (0xFFDA <= codePoint && codePoint <= 0xFFDC) ||
929
- (0xFFE8 <= codePoint && codePoint <= 0xFFEE)) {
930
- return 'H';
931
- }
932
- if ((0x1100 <= codePoint && codePoint <= 0x115F) ||
933
- (0x11A3 <= codePoint && codePoint <= 0x11A7) ||
934
- (0x11FA <= codePoint && codePoint <= 0x11FF) ||
935
- (0x2329 <= codePoint && codePoint <= 0x232A) ||
936
- (0x2E80 <= codePoint && codePoint <= 0x2E99) ||
937
- (0x2E9B <= codePoint && codePoint <= 0x2EF3) ||
938
- (0x2F00 <= codePoint && codePoint <= 0x2FD5) ||
939
- (0x2FF0 <= codePoint && codePoint <= 0x2FFB) ||
940
- (0x3001 <= codePoint && codePoint <= 0x303E) ||
941
- (0x3041 <= codePoint && codePoint <= 0x3096) ||
942
- (0x3099 <= codePoint && codePoint <= 0x30FF) ||
943
- (0x3105 <= codePoint && codePoint <= 0x312D) ||
944
- (0x3131 <= codePoint && codePoint <= 0x318E) ||
945
- (0x3190 <= codePoint && codePoint <= 0x31BA) ||
946
- (0x31C0 <= codePoint && codePoint <= 0x31E3) ||
947
- (0x31F0 <= codePoint && codePoint <= 0x321E) ||
948
- (0x3220 <= codePoint && codePoint <= 0x3247) ||
949
- (0x3250 <= codePoint && codePoint <= 0x32FE) ||
950
- (0x3300 <= codePoint && codePoint <= 0x4DBF) ||
951
- (0x4E00 <= codePoint && codePoint <= 0xA48C) ||
952
- (0xA490 <= codePoint && codePoint <= 0xA4C6) ||
953
- (0xA960 <= codePoint && codePoint <= 0xA97C) ||
954
- (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
955
- (0xD7B0 <= codePoint && codePoint <= 0xD7C6) ||
956
- (0xD7CB <= codePoint && codePoint <= 0xD7FB) ||
957
- (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
958
- (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
959
- (0xFE30 <= codePoint && codePoint <= 0xFE52) ||
960
- (0xFE54 <= codePoint && codePoint <= 0xFE66) ||
961
- (0xFE68 <= codePoint && codePoint <= 0xFE6B) ||
962
- (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
963
- (0x1F200 <= codePoint && codePoint <= 0x1F202) ||
964
- (0x1F210 <= codePoint && codePoint <= 0x1F23A) ||
965
- (0x1F240 <= codePoint && codePoint <= 0x1F248) ||
966
- (0x1F250 <= codePoint && codePoint <= 0x1F251) ||
967
- (0x20000 <= codePoint && codePoint <= 0x2F73F) ||
968
- (0x2B740 <= codePoint && codePoint <= 0x2FFFD) ||
969
- (0x30000 <= codePoint && codePoint <= 0x3FFFD)) {
970
- return 'W';
971
- }
972
- if ((0x0020 <= codePoint && codePoint <= 0x007E) ||
973
- (0x00A2 <= codePoint && codePoint <= 0x00A3) ||
974
- (0x00A5 <= codePoint && codePoint <= 0x00A6) ||
975
- (0x00AC == codePoint) ||
976
- (0x00AF == codePoint) ||
977
- (0x27E6 <= codePoint && codePoint <= 0x27ED) ||
978
- (0x2985 <= codePoint && codePoint <= 0x2986)) {
979
- return 'Na';
980
- }
981
- if ((0x00A1 == codePoint) ||
982
- (0x00A4 == codePoint) ||
983
- (0x00A7 <= codePoint && codePoint <= 0x00A8) ||
984
- (0x00AA == codePoint) ||
985
- (0x00AD <= codePoint && codePoint <= 0x00AE) ||
986
- (0x00B0 <= codePoint && codePoint <= 0x00B4) ||
987
- (0x00B6 <= codePoint && codePoint <= 0x00BA) ||
988
- (0x00BC <= codePoint && codePoint <= 0x00BF) ||
989
- (0x00C6 == codePoint) ||
990
- (0x00D0 == codePoint) ||
991
- (0x00D7 <= codePoint && codePoint <= 0x00D8) ||
992
- (0x00DE <= codePoint && codePoint <= 0x00E1) ||
993
- (0x00E6 == codePoint) ||
994
- (0x00E8 <= codePoint && codePoint <= 0x00EA) ||
995
- (0x00EC <= codePoint && codePoint <= 0x00ED) ||
996
- (0x00F0 == codePoint) ||
997
- (0x00F2 <= codePoint && codePoint <= 0x00F3) ||
998
- (0x00F7 <= codePoint && codePoint <= 0x00FA) ||
999
- (0x00FC == codePoint) ||
1000
- (0x00FE == codePoint) ||
1001
- (0x0101 == codePoint) ||
1002
- (0x0111 == codePoint) ||
1003
- (0x0113 == codePoint) ||
1004
- (0x011B == codePoint) ||
1005
- (0x0126 <= codePoint && codePoint <= 0x0127) ||
1006
- (0x012B == codePoint) ||
1007
- (0x0131 <= codePoint && codePoint <= 0x0133) ||
1008
- (0x0138 == codePoint) ||
1009
- (0x013F <= codePoint && codePoint <= 0x0142) ||
1010
- (0x0144 == codePoint) ||
1011
- (0x0148 <= codePoint && codePoint <= 0x014B) ||
1012
- (0x014D == codePoint) ||
1013
- (0x0152 <= codePoint && codePoint <= 0x0153) ||
1014
- (0x0166 <= codePoint && codePoint <= 0x0167) ||
1015
- (0x016B == codePoint) ||
1016
- (0x01CE == codePoint) ||
1017
- (0x01D0 == codePoint) ||
1018
- (0x01D2 == codePoint) ||
1019
- (0x01D4 == codePoint) ||
1020
- (0x01D6 == codePoint) ||
1021
- (0x01D8 == codePoint) ||
1022
- (0x01DA == codePoint) ||
1023
- (0x01DC == codePoint) ||
1024
- (0x0251 == codePoint) ||
1025
- (0x0261 == codePoint) ||
1026
- (0x02C4 == codePoint) ||
1027
- (0x02C7 == codePoint) ||
1028
- (0x02C9 <= codePoint && codePoint <= 0x02CB) ||
1029
- (0x02CD == codePoint) ||
1030
- (0x02D0 == codePoint) ||
1031
- (0x02D8 <= codePoint && codePoint <= 0x02DB) ||
1032
- (0x02DD == codePoint) ||
1033
- (0x02DF == codePoint) ||
1034
- (0x0300 <= codePoint && codePoint <= 0x036F) ||
1035
- (0x0391 <= codePoint && codePoint <= 0x03A1) ||
1036
- (0x03A3 <= codePoint && codePoint <= 0x03A9) ||
1037
- (0x03B1 <= codePoint && codePoint <= 0x03C1) ||
1038
- (0x03C3 <= codePoint && codePoint <= 0x03C9) ||
1039
- (0x0401 == codePoint) ||
1040
- (0x0410 <= codePoint && codePoint <= 0x044F) ||
1041
- (0x0451 == codePoint) ||
1042
- (0x2010 == codePoint) ||
1043
- (0x2013 <= codePoint && codePoint <= 0x2016) ||
1044
- (0x2018 <= codePoint && codePoint <= 0x2019) ||
1045
- (0x201C <= codePoint && codePoint <= 0x201D) ||
1046
- (0x2020 <= codePoint && codePoint <= 0x2022) ||
1047
- (0x2024 <= codePoint && codePoint <= 0x2027) ||
1048
- (0x2030 == codePoint) ||
1049
- (0x2032 <= codePoint && codePoint <= 0x2033) ||
1050
- (0x2035 == codePoint) ||
1051
- (0x203B == codePoint) ||
1052
- (0x203E == codePoint) ||
1053
- (0x2074 == codePoint) ||
1054
- (0x207F == codePoint) ||
1055
- (0x2081 <= codePoint && codePoint <= 0x2084) ||
1056
- (0x20AC == codePoint) ||
1057
- (0x2103 == codePoint) ||
1058
- (0x2105 == codePoint) ||
1059
- (0x2109 == codePoint) ||
1060
- (0x2113 == codePoint) ||
1061
- (0x2116 == codePoint) ||
1062
- (0x2121 <= codePoint && codePoint <= 0x2122) ||
1063
- (0x2126 == codePoint) ||
1064
- (0x212B == codePoint) ||
1065
- (0x2153 <= codePoint && codePoint <= 0x2154) ||
1066
- (0x215B <= codePoint && codePoint <= 0x215E) ||
1067
- (0x2160 <= codePoint && codePoint <= 0x216B) ||
1068
- (0x2170 <= codePoint && codePoint <= 0x2179) ||
1069
- (0x2189 == codePoint) ||
1070
- (0x2190 <= codePoint && codePoint <= 0x2199) ||
1071
- (0x21B8 <= codePoint && codePoint <= 0x21B9) ||
1072
- (0x21D2 == codePoint) ||
1073
- (0x21D4 == codePoint) ||
1074
- (0x21E7 == codePoint) ||
1075
- (0x2200 == codePoint) ||
1076
- (0x2202 <= codePoint && codePoint <= 0x2203) ||
1077
- (0x2207 <= codePoint && codePoint <= 0x2208) ||
1078
- (0x220B == codePoint) ||
1079
- (0x220F == codePoint) ||
1080
- (0x2211 == codePoint) ||
1081
- (0x2215 == codePoint) ||
1082
- (0x221A == codePoint) ||
1083
- (0x221D <= codePoint && codePoint <= 0x2220) ||
1084
- (0x2223 == codePoint) ||
1085
- (0x2225 == codePoint) ||
1086
- (0x2227 <= codePoint && codePoint <= 0x222C) ||
1087
- (0x222E == codePoint) ||
1088
- (0x2234 <= codePoint && codePoint <= 0x2237) ||
1089
- (0x223C <= codePoint && codePoint <= 0x223D) ||
1090
- (0x2248 == codePoint) ||
1091
- (0x224C == codePoint) ||
1092
- (0x2252 == codePoint) ||
1093
- (0x2260 <= codePoint && codePoint <= 0x2261) ||
1094
- (0x2264 <= codePoint && codePoint <= 0x2267) ||
1095
- (0x226A <= codePoint && codePoint <= 0x226B) ||
1096
- (0x226E <= codePoint && codePoint <= 0x226F) ||
1097
- (0x2282 <= codePoint && codePoint <= 0x2283) ||
1098
- (0x2286 <= codePoint && codePoint <= 0x2287) ||
1099
- (0x2295 == codePoint) ||
1100
- (0x2299 == codePoint) ||
1101
- (0x22A5 == codePoint) ||
1102
- (0x22BF == codePoint) ||
1103
- (0x2312 == codePoint) ||
1104
- (0x2460 <= codePoint && codePoint <= 0x24E9) ||
1105
- (0x24EB <= codePoint && codePoint <= 0x254B) ||
1106
- (0x2550 <= codePoint && codePoint <= 0x2573) ||
1107
- (0x2580 <= codePoint && codePoint <= 0x258F) ||
1108
- (0x2592 <= codePoint && codePoint <= 0x2595) ||
1109
- (0x25A0 <= codePoint && codePoint <= 0x25A1) ||
1110
- (0x25A3 <= codePoint && codePoint <= 0x25A9) ||
1111
- (0x25B2 <= codePoint && codePoint <= 0x25B3) ||
1112
- (0x25B6 <= codePoint && codePoint <= 0x25B7) ||
1113
- (0x25BC <= codePoint && codePoint <= 0x25BD) ||
1114
- (0x25C0 <= codePoint && codePoint <= 0x25C1) ||
1115
- (0x25C6 <= codePoint && codePoint <= 0x25C8) ||
1116
- (0x25CB == codePoint) ||
1117
- (0x25CE <= codePoint && codePoint <= 0x25D1) ||
1118
- (0x25E2 <= codePoint && codePoint <= 0x25E5) ||
1119
- (0x25EF == codePoint) ||
1120
- (0x2605 <= codePoint && codePoint <= 0x2606) ||
1121
- (0x2609 == codePoint) ||
1122
- (0x260E <= codePoint && codePoint <= 0x260F) ||
1123
- (0x2614 <= codePoint && codePoint <= 0x2615) ||
1124
- (0x261C == codePoint) ||
1125
- (0x261E == codePoint) ||
1126
- (0x2640 == codePoint) ||
1127
- (0x2642 == codePoint) ||
1128
- (0x2660 <= codePoint && codePoint <= 0x2661) ||
1129
- (0x2663 <= codePoint && codePoint <= 0x2665) ||
1130
- (0x2667 <= codePoint && codePoint <= 0x266A) ||
1131
- (0x266C <= codePoint && codePoint <= 0x266D) ||
1132
- (0x266F == codePoint) ||
1133
- (0x269E <= codePoint && codePoint <= 0x269F) ||
1134
- (0x26BE <= codePoint && codePoint <= 0x26BF) ||
1135
- (0x26C4 <= codePoint && codePoint <= 0x26CD) ||
1136
- (0x26CF <= codePoint && codePoint <= 0x26E1) ||
1137
- (0x26E3 == codePoint) ||
1138
- (0x26E8 <= codePoint && codePoint <= 0x26FF) ||
1139
- (0x273D == codePoint) ||
1140
- (0x2757 == codePoint) ||
1141
- (0x2776 <= codePoint && codePoint <= 0x277F) ||
1142
- (0x2B55 <= codePoint && codePoint <= 0x2B59) ||
1143
- (0x3248 <= codePoint && codePoint <= 0x324F) ||
1144
- (0xE000 <= codePoint && codePoint <= 0xF8FF) ||
1145
- (0xFE00 <= codePoint && codePoint <= 0xFE0F) ||
1146
- (0xFFFD == codePoint) ||
1147
- (0x1F100 <= codePoint && codePoint <= 0x1F10A) ||
1148
- (0x1F110 <= codePoint && codePoint <= 0x1F12D) ||
1149
- (0x1F130 <= codePoint && codePoint <= 0x1F169) ||
1150
- (0x1F170 <= codePoint && codePoint <= 0x1F19A) ||
1151
- (0xE0100 <= codePoint && codePoint <= 0xE01EF) ||
1152
- (0xF0000 <= codePoint && codePoint <= 0xFFFFD) ||
1153
- (0x100000 <= codePoint && codePoint <= 0x10FFFD)) {
1154
- return 'A';
1155
- }
1156
-
1157
- return 'N';
1158
- };
1159
-
1160
- eaw.characterLength = function(character) {
1161
- var code = this.eastAsianWidth(character);
1162
- if (code == 'F' || code == 'W' || code == 'A') {
1163
- return 2;
1164
- } else {
1165
- return 1;
1166
- }
1167
- };
1168
-
1169
- // Split a string considering surrogate-pairs.
1170
- function stringToArray(string) {
1171
- return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
1172
- }
1173
-
1174
- eaw.length = function(string) {
1175
- var characters = stringToArray(string);
1176
- var len = 0;
1177
- for (var i = 0; i < characters.length; i++) {
1178
- len = len + this.characterLength(characters[i]);
1179
- }
1180
- return len;
1181
- };
1182
-
1183
- eaw.slice = function(text, start, end) {
1184
- textLen = eaw.length(text);
1185
- start = start ? start : 0;
1186
- end = end ? end : 1;
1187
- if (start < 0) {
1188
- start = textLen + start;
1189
- }
1190
- if (end < 0) {
1191
- end = textLen + end;
1192
- }
1193
- var result = '';
1194
- var eawLen = 0;
1195
- var chars = stringToArray(text);
1196
- for (var i = 0; i < chars.length; i++) {
1197
- var char = chars[i];
1198
- var charLen = eaw.length(char);
1199
- if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
1200
- if (eawLen + charLen <= end) {
1201
- result += char;
1202
- } else {
1203
- break;
1204
- }
1205
- }
1206
- eawLen += charLen;
1207
- }
1208
- return result;
1209
- };
1210
- } (eastasianwidth));
1211
-
1212
- var eastAsianWidth = eastasianwidth.exports;
1213
-
1214
- var build = {};
1215
-
1216
- var ansiStyles = {exports: {}};
1217
-
1218
- (function (module) {
1219
-
1220
- const ANSI_BACKGROUND_OFFSET = 10;
1221
-
1222
- const wrapAnsi256 = (offset = 0) => code => `\u001B[${38 + offset};5;${code}m`;
1223
-
1224
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
1225
-
1226
- function assembleStyles() {
1227
- const codes = new Map();
1228
- const styles = {
1229
- modifier: {
1230
- reset: [0, 0],
1231
- // 21 isn't widely supported and 22 does the same thing
1232
- bold: [1, 22],
1233
- dim: [2, 22],
1234
- italic: [3, 23],
1235
- underline: [4, 24],
1236
- overline: [53, 55],
1237
- inverse: [7, 27],
1238
- hidden: [8, 28],
1239
- strikethrough: [9, 29]
1240
- },
1241
- color: {
1242
- black: [30, 39],
1243
- red: [31, 39],
1244
- green: [32, 39],
1245
- yellow: [33, 39],
1246
- blue: [34, 39],
1247
- magenta: [35, 39],
1248
- cyan: [36, 39],
1249
- white: [37, 39],
1250
-
1251
- // Bright color
1252
- blackBright: [90, 39],
1253
- redBright: [91, 39],
1254
- greenBright: [92, 39],
1255
- yellowBright: [93, 39],
1256
- blueBright: [94, 39],
1257
- magentaBright: [95, 39],
1258
- cyanBright: [96, 39],
1259
- whiteBright: [97, 39]
1260
- },
1261
- bgColor: {
1262
- bgBlack: [40, 49],
1263
- bgRed: [41, 49],
1264
- bgGreen: [42, 49],
1265
- bgYellow: [43, 49],
1266
- bgBlue: [44, 49],
1267
- bgMagenta: [45, 49],
1268
- bgCyan: [46, 49],
1269
- bgWhite: [47, 49],
1270
-
1271
- // Bright color
1272
- bgBlackBright: [100, 49],
1273
- bgRedBright: [101, 49],
1274
- bgGreenBright: [102, 49],
1275
- bgYellowBright: [103, 49],
1276
- bgBlueBright: [104, 49],
1277
- bgMagentaBright: [105, 49],
1278
- bgCyanBright: [106, 49],
1279
- bgWhiteBright: [107, 49]
1280
- }
1281
- };
1282
-
1283
- // Alias bright black as gray (and grey)
1284
- styles.color.gray = styles.color.blackBright;
1285
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
1286
- styles.color.grey = styles.color.blackBright;
1287
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
1288
-
1289
- for (const [groupName, group] of Object.entries(styles)) {
1290
- for (const [styleName, style] of Object.entries(group)) {
1291
- styles[styleName] = {
1292
- open: `\u001B[${style[0]}m`,
1293
- close: `\u001B[${style[1]}m`
1294
- };
1295
-
1296
- group[styleName] = styles[styleName];
1297
-
1298
- codes.set(style[0], style[1]);
1299
- }
1300
-
1301
- Object.defineProperty(styles, groupName, {
1302
- value: group,
1303
- enumerable: false
1304
- });
1305
- }
1306
-
1307
- Object.defineProperty(styles, 'codes', {
1308
- value: codes,
1309
- enumerable: false
1310
- });
1311
-
1312
- styles.color.close = '\u001B[39m';
1313
- styles.bgColor.close = '\u001B[49m';
1314
-
1315
- styles.color.ansi256 = wrapAnsi256();
1316
- styles.color.ansi16m = wrapAnsi16m();
1317
- styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
1318
- styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
1319
-
1320
- // From https://github.com/Qix-/color-convert/blob/3f0e0d4e92e235796ccb17f6e85c72094a651f49/conversions.js
1321
- Object.defineProperties(styles, {
1322
- rgbToAnsi256: {
1323
- value: (red, green, blue) => {
1324
- // We use the extended greyscale palette here, with the exception of
1325
- // black and white. normal palette only has 4 greyscale shades.
1326
- if (red === green && green === blue) {
1327
- if (red < 8) {
1328
- return 16;
1329
- }
1330
-
1331
- if (red > 248) {
1332
- return 231;
1333
- }
1334
-
1335
- return Math.round(((red - 8) / 247) * 24) + 232;
1336
- }
1337
-
1338
- return 16 +
1339
- (36 * Math.round(red / 255 * 5)) +
1340
- (6 * Math.round(green / 255 * 5)) +
1341
- Math.round(blue / 255 * 5);
1342
- },
1343
- enumerable: false
1344
- },
1345
- hexToRgb: {
1346
- value: hex => {
1347
- const matches = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16));
1348
- if (!matches) {
1349
- return [0, 0, 0];
1350
- }
1351
-
1352
- let {colorString} = matches.groups;
1353
-
1354
- if (colorString.length === 3) {
1355
- colorString = colorString.split('').map(character => character + character).join('');
1356
- }
1357
-
1358
- const integer = Number.parseInt(colorString, 16);
1359
-
1360
- return [
1361
- (integer >> 16) & 0xFF,
1362
- (integer >> 8) & 0xFF,
1363
- integer & 0xFF
1364
- ];
1365
- },
1366
- enumerable: false
1367
- },
1368
- hexToAnsi256: {
1369
- value: hex => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
1370
- enumerable: false
1371
- }
1372
- });
1373
-
1374
- return styles;
1375
- }
1376
-
1377
- // Make the export immutable
1378
- Object.defineProperty(module, 'exports', {
1379
- enumerable: true,
1380
- get: assembleStyles
1381
- });
1382
- } (ansiStyles));
1383
-
1384
- var collections = {};
1385
-
1386
- Object.defineProperty(collections, '__esModule', {
1387
- value: true
1388
- });
1389
- collections.printIteratorEntries = printIteratorEntries;
1390
- collections.printIteratorValues = printIteratorValues;
1391
- collections.printListItems = printListItems;
1392
- collections.printObjectProperties = printObjectProperties;
1393
-
1394
- /**
1395
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1396
- *
1397
- * This source code is licensed under the MIT license found in the
1398
- * LICENSE file in the root directory of this source tree.
1399
- *
1400
- */
1401
- const getKeysOfEnumerableProperties = (object, compareKeys) => {
1402
- const keys = Object.keys(object).sort(compareKeys);
1403
-
1404
- if (Object.getOwnPropertySymbols) {
1405
- Object.getOwnPropertySymbols(object).forEach(symbol => {
1406
- if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
1407
- keys.push(symbol);
1408
- }
1409
- });
1410
- }
1411
-
1412
- return keys;
1413
- };
1414
- /**
1415
- * Return entries (for example, of a map)
1416
- * with spacing, indentation, and comma
1417
- * without surrounding punctuation (for example, braces)
1418
- */
1419
-
1420
- function printIteratorEntries(
1421
- iterator,
1422
- config,
1423
- indentation,
1424
- depth,
1425
- refs,
1426
- printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
1427
- // What a distracting diff if you change a data structure to/from
1428
- // ECMAScript Object or Immutable.Map/OrderedMap which use the default.
1429
- separator = ': '
1430
- ) {
1431
- let result = '';
1432
- let current = iterator.next();
1433
-
1434
- if (!current.done) {
1435
- result += config.spacingOuter;
1436
- const indentationNext = indentation + config.indent;
1437
-
1438
- while (!current.done) {
1439
- const name = printer(
1440
- current.value[0],
1441
- config,
1442
- indentationNext,
1443
- depth,
1444
- refs
1445
- );
1446
- const value = printer(
1447
- current.value[1],
1448
- config,
1449
- indentationNext,
1450
- depth,
1451
- refs
1452
- );
1453
- result += indentationNext + name + separator + value;
1454
- current = iterator.next();
1455
-
1456
- if (!current.done) {
1457
- result += ',' + config.spacingInner;
1458
- } else if (!config.min) {
1459
- result += ',';
1460
- }
1461
- }
1462
-
1463
- result += config.spacingOuter + indentation;
1464
- }
1465
-
1466
- return result;
1467
- }
1468
- /**
1469
- * Return values (for example, of a set)
1470
- * with spacing, indentation, and comma
1471
- * without surrounding punctuation (braces or brackets)
1472
- */
1473
-
1474
- function printIteratorValues(
1475
- iterator,
1476
- config,
1477
- indentation,
1478
- depth,
1479
- refs,
1480
- printer
1481
- ) {
1482
- let result = '';
1483
- let current = iterator.next();
1484
-
1485
- if (!current.done) {
1486
- result += config.spacingOuter;
1487
- const indentationNext = indentation + config.indent;
1488
-
1489
- while (!current.done) {
1490
- result +=
1491
- indentationNext +
1492
- printer(current.value, config, indentationNext, depth, refs);
1493
- current = iterator.next();
1494
-
1495
- if (!current.done) {
1496
- result += ',' + config.spacingInner;
1497
- } else if (!config.min) {
1498
- result += ',';
1499
- }
1500
- }
1501
-
1502
- result += config.spacingOuter + indentation;
1503
- }
1504
-
1505
- return result;
1506
- }
1507
- /**
1508
- * Return items (for example, of an array)
1509
- * with spacing, indentation, and comma
1510
- * without surrounding punctuation (for example, brackets)
1511
- **/
1512
-
1513
- function printListItems(list, config, indentation, depth, refs, printer) {
1514
- let result = '';
1515
-
1516
- if (list.length) {
1517
- result += config.spacingOuter;
1518
- const indentationNext = indentation + config.indent;
1519
-
1520
- for (let i = 0; i < list.length; i++) {
1521
- result += indentationNext;
1522
-
1523
- if (i in list) {
1524
- result += printer(list[i], config, indentationNext, depth, refs);
1525
- }
1526
-
1527
- if (i < list.length - 1) {
1528
- result += ',' + config.spacingInner;
1529
- } else if (!config.min) {
1530
- result += ',';
1531
- }
1532
- }
1533
-
1534
- result += config.spacingOuter + indentation;
1535
- }
1536
-
1537
- return result;
1538
- }
1539
- /**
1540
- * Return properties of an object
1541
- * with spacing, indentation, and comma
1542
- * without surrounding punctuation (for example, braces)
1543
- */
1544
-
1545
- function printObjectProperties(val, config, indentation, depth, refs, printer) {
1546
- let result = '';
1547
- const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
1548
-
1549
- if (keys.length) {
1550
- result += config.spacingOuter;
1551
- const indentationNext = indentation + config.indent;
1552
-
1553
- for (let i = 0; i < keys.length; i++) {
1554
- const key = keys[i];
1555
- const name = printer(key, config, indentationNext, depth, refs);
1556
- const value = printer(val[key], config, indentationNext, depth, refs);
1557
- result += indentationNext + name + ': ' + value;
1558
-
1559
- if (i < keys.length - 1) {
1560
- result += ',' + config.spacingInner;
1561
- } else if (!config.min) {
1562
- result += ',';
1563
- }
1564
- }
1565
-
1566
- result += config.spacingOuter + indentation;
1567
- }
1568
-
1569
- return result;
1570
- }
1571
-
1572
- var AsymmetricMatcher$1 = {};
1573
-
1574
- Object.defineProperty(AsymmetricMatcher$1, '__esModule', {
1575
- value: true
1576
- });
1577
- AsymmetricMatcher$1.test = AsymmetricMatcher$1.serialize = AsymmetricMatcher$1.default = void 0;
1578
-
1579
- var _collections$3 = collections;
1580
-
1581
- var global$1 = (function () {
1582
- if (typeof globalThis !== 'undefined') {
1583
- return globalThis;
1584
- } else if (typeof global$1 !== 'undefined') {
1585
- return global$1;
1586
- } else if (typeof self !== 'undefined') {
1587
- return self;
1588
- } else if (typeof window !== 'undefined') {
1589
- return window;
1590
- } else {
1591
- return Function('return this')();
1592
- }
1593
- })();
1594
-
1595
- var Symbol$2 = global$1['jest-symbol-do-not-touch'] || global$1.Symbol;
1596
- const asymmetricMatcher =
1597
- typeof Symbol$2 === 'function' && Symbol$2.for
1598
- ? Symbol$2.for('jest.asymmetricMatcher')
1599
- : 0x1357a5;
1600
- const SPACE$2 = ' ';
1601
-
1602
- const serialize$6 = (val, config, indentation, depth, refs, printer) => {
1603
- const stringedValue = val.toString();
1604
-
1605
- if (
1606
- stringedValue === 'ArrayContaining' ||
1607
- stringedValue === 'ArrayNotContaining'
1608
- ) {
1609
- if (++depth > config.maxDepth) {
1610
- return '[' + stringedValue + ']';
1611
- }
1612
-
1613
- return (
1614
- stringedValue +
1615
- SPACE$2 +
1616
- '[' +
1617
- (0, _collections$3.printListItems)(
1618
- val.sample,
1619
- config,
1620
- indentation,
1621
- depth,
1622
- refs,
1623
- printer
1624
- ) +
1625
- ']'
1626
- );
1627
- }
1628
-
1629
- if (
1630
- stringedValue === 'ObjectContaining' ||
1631
- stringedValue === 'ObjectNotContaining'
1632
- ) {
1633
- if (++depth > config.maxDepth) {
1634
- return '[' + stringedValue + ']';
1635
- }
1636
-
1637
- return (
1638
- stringedValue +
1639
- SPACE$2 +
1640
- '{' +
1641
- (0, _collections$3.printObjectProperties)(
1642
- val.sample,
1643
- config,
1644
- indentation,
1645
- depth,
1646
- refs,
1647
- printer
1648
- ) +
1649
- '}'
1650
- );
1651
- }
1652
-
1653
- if (
1654
- stringedValue === 'StringMatching' ||
1655
- stringedValue === 'StringNotMatching'
1656
- ) {
1657
- return (
1658
- stringedValue +
1659
- SPACE$2 +
1660
- printer(val.sample, config, indentation, depth, refs)
1661
- );
1662
- }
1663
-
1664
- if (
1665
- stringedValue === 'StringContaining' ||
1666
- stringedValue === 'StringNotContaining'
1667
- ) {
1668
- return (
1669
- stringedValue +
1670
- SPACE$2 +
1671
- printer(val.sample, config, indentation, depth, refs)
1672
- );
1673
- }
1674
-
1675
- return val.toAsymmetricMatcher();
1676
- };
1677
-
1678
- AsymmetricMatcher$1.serialize = serialize$6;
1679
-
1680
- const test$6 = val => val && val.$$typeof === asymmetricMatcher;
1681
-
1682
- AsymmetricMatcher$1.test = test$6;
1683
- const plugin$6 = {
1684
- serialize: serialize$6,
1685
- test: test$6
1686
- };
1687
- var _default$7 = plugin$6;
1688
- AsymmetricMatcher$1.default = _default$7;
1689
-
1690
- var ConvertAnsi = {};
1691
-
1692
- var ansiRegex = ({onlyFirst = false} = {}) => {
1693
- const pattern = [
1694
- '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
1695
- '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
1696
- ].join('|');
1697
-
1698
- return new RegExp(pattern, onlyFirst ? undefined : 'g');
1699
- };
1700
-
1701
- Object.defineProperty(ConvertAnsi, '__esModule', {
1702
- value: true
1703
- });
1704
- ConvertAnsi.test = ConvertAnsi.serialize = ConvertAnsi.default = void 0;
1705
-
1706
- var _ansiRegex = _interopRequireDefault$2(ansiRegex);
1707
-
1708
- var _ansiStyles$1 = _interopRequireDefault$2(ansiStyles.exports);
1709
-
1710
- function _interopRequireDefault$2(obj) {
1711
- return obj && obj.__esModule ? obj : {default: obj};
1712
- }
1713
-
1714
- /**
1715
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1716
- *
1717
- * This source code is licensed under the MIT license found in the
1718
- * LICENSE file in the root directory of this source tree.
1719
- */
1720
- const toHumanReadableAnsi = text =>
1721
- text.replace((0, _ansiRegex.default)(), match => {
1722
- switch (match) {
1723
- case _ansiStyles$1.default.red.close:
1724
- case _ansiStyles$1.default.green.close:
1725
- case _ansiStyles$1.default.cyan.close:
1726
- case _ansiStyles$1.default.gray.close:
1727
- case _ansiStyles$1.default.white.close:
1728
- case _ansiStyles$1.default.yellow.close:
1729
- case _ansiStyles$1.default.bgRed.close:
1730
- case _ansiStyles$1.default.bgGreen.close:
1731
- case _ansiStyles$1.default.bgYellow.close:
1732
- case _ansiStyles$1.default.inverse.close:
1733
- case _ansiStyles$1.default.dim.close:
1734
- case _ansiStyles$1.default.bold.close:
1735
- case _ansiStyles$1.default.reset.open:
1736
- case _ansiStyles$1.default.reset.close:
1737
- return '</>';
1738
-
1739
- case _ansiStyles$1.default.red.open:
1740
- return '<red>';
1741
-
1742
- case _ansiStyles$1.default.green.open:
1743
- return '<green>';
1744
-
1745
- case _ansiStyles$1.default.cyan.open:
1746
- return '<cyan>';
1747
-
1748
- case _ansiStyles$1.default.gray.open:
1749
- return '<gray>';
1750
-
1751
- case _ansiStyles$1.default.white.open:
1752
- return '<white>';
1753
-
1754
- case _ansiStyles$1.default.yellow.open:
1755
- return '<yellow>';
1756
-
1757
- case _ansiStyles$1.default.bgRed.open:
1758
- return '<bgRed>';
1759
-
1760
- case _ansiStyles$1.default.bgGreen.open:
1761
- return '<bgGreen>';
1762
-
1763
- case _ansiStyles$1.default.bgYellow.open:
1764
- return '<bgYellow>';
1765
-
1766
- case _ansiStyles$1.default.inverse.open:
1767
- return '<inverse>';
1768
-
1769
- case _ansiStyles$1.default.dim.open:
1770
- return '<dim>';
1771
-
1772
- case _ansiStyles$1.default.bold.open:
1773
- return '<bold>';
1774
-
1775
- default:
1776
- return '';
1777
- }
1778
- });
1779
-
1780
- const test$5 = val =>
1781
- typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
1782
-
1783
- ConvertAnsi.test = test$5;
1784
-
1785
- const serialize$5 = (val, config, indentation, depth, refs, printer) =>
1786
- printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
1787
-
1788
- ConvertAnsi.serialize = serialize$5;
1789
- const plugin$5 = {
1790
- serialize: serialize$5,
1791
- test: test$5
1792
- };
1793
- var _default$6 = plugin$5;
1794
- ConvertAnsi.default = _default$6;
1795
-
1796
- var DOMCollection$1 = {};
1797
-
1798
- Object.defineProperty(DOMCollection$1, '__esModule', {
1799
- value: true
1800
- });
1801
- DOMCollection$1.test = DOMCollection$1.serialize = DOMCollection$1.default = void 0;
1802
-
1803
- var _collections$2 = collections;
1804
-
1805
- /**
1806
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1807
- *
1808
- * This source code is licensed under the MIT license found in the
1809
- * LICENSE file in the root directory of this source tree.
1810
- */
1811
-
1812
- /* eslint-disable local/ban-types-eventually */
1813
- const SPACE$1 = ' ';
1814
- const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
1815
- const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
1816
-
1817
- const testName = name =>
1818
- OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
1819
-
1820
- const test$4 = val =>
1821
- val &&
1822
- val.constructor &&
1823
- !!val.constructor.name &&
1824
- testName(val.constructor.name);
1825
-
1826
- DOMCollection$1.test = test$4;
1827
-
1828
- const isNamedNodeMap = collection =>
1829
- collection.constructor.name === 'NamedNodeMap';
1830
-
1831
- const serialize$4 = (collection, config, indentation, depth, refs, printer) => {
1832
- const name = collection.constructor.name;
1833
-
1834
- if (++depth > config.maxDepth) {
1835
- return '[' + name + ']';
1836
- }
1837
-
1838
- return (
1839
- (config.min ? '' : name + SPACE$1) +
1840
- (OBJECT_NAMES.indexOf(name) !== -1
1841
- ? '{' +
1842
- (0, _collections$2.printObjectProperties)(
1843
- isNamedNodeMap(collection)
1844
- ? Array.from(collection).reduce((props, attribute) => {
1845
- props[attribute.name] = attribute.value;
1846
- return props;
1847
- }, {})
1848
- : {...collection},
1849
- config,
1850
- indentation,
1851
- depth,
1852
- refs,
1853
- printer
1854
- ) +
1855
- '}'
1856
- : '[' +
1857
- (0, _collections$2.printListItems)(
1858
- Array.from(collection),
1859
- config,
1860
- indentation,
1861
- depth,
1862
- refs,
1863
- printer
1864
- ) +
1865
- ']')
1866
- );
1867
- };
1868
-
1869
- DOMCollection$1.serialize = serialize$4;
1870
- const plugin$4 = {
1871
- serialize: serialize$4,
1872
- test: test$4
1873
- };
1874
- var _default$5 = plugin$4;
1875
- DOMCollection$1.default = _default$5;
1876
-
1877
- var DOMElement$1 = {};
1878
-
1879
- var markup = {};
1880
-
1881
- var escapeHTML$1 = {};
1882
-
1883
- Object.defineProperty(escapeHTML$1, '__esModule', {
1884
- value: true
1885
- });
1886
- escapeHTML$1.default = escapeHTML;
1887
-
1888
- /**
1889
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1890
- *
1891
- * This source code is licensed under the MIT license found in the
1892
- * LICENSE file in the root directory of this source tree.
1893
- */
1894
- function escapeHTML(str) {
1895
- return str.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1896
- }
1897
-
1898
- Object.defineProperty(markup, '__esModule', {
1899
- value: true
1900
- });
1901
- markup.printText =
1902
- markup.printProps =
1903
- markup.printElementAsLeaf =
1904
- markup.printElement =
1905
- markup.printComment =
1906
- markup.printChildren =
1907
- void 0;
1908
-
1909
- var _escapeHTML = _interopRequireDefault$1(escapeHTML$1);
1910
-
1911
- function _interopRequireDefault$1(obj) {
1912
- return obj && obj.__esModule ? obj : {default: obj};
1913
- }
1914
-
1915
- /**
1916
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
1917
- *
1918
- * This source code is licensed under the MIT license found in the
1919
- * LICENSE file in the root directory of this source tree.
1920
- */
1921
- // Return empty string if keys is empty.
1922
- const printProps = (keys, props, config, indentation, depth, refs, printer) => {
1923
- const indentationNext = indentation + config.indent;
1924
- const colors = config.colors;
1925
- return keys
1926
- .map(key => {
1927
- const value = props[key];
1928
- let printed = printer(value, config, indentationNext, depth, refs);
1929
-
1930
- if (typeof value !== 'string') {
1931
- if (printed.indexOf('\n') !== -1) {
1932
- printed =
1933
- config.spacingOuter +
1934
- indentationNext +
1935
- printed +
1936
- config.spacingOuter +
1937
- indentation;
1938
- }
1939
-
1940
- printed = '{' + printed + '}';
1941
- }
1942
-
1943
- return (
1944
- config.spacingInner +
1945
- indentation +
1946
- colors.prop.open +
1947
- key +
1948
- colors.prop.close +
1949
- '=' +
1950
- colors.value.open +
1951
- printed +
1952
- colors.value.close
1953
- );
1954
- })
1955
- .join('');
1956
- }; // Return empty string if children is empty.
1957
-
1958
- markup.printProps = printProps;
1959
-
1960
- const printChildren = (children, config, indentation, depth, refs, printer) =>
1961
- children
1962
- .map(
1963
- child =>
1964
- config.spacingOuter +
1965
- indentation +
1966
- (typeof child === 'string'
1967
- ? printText(child, config)
1968
- : printer(child, config, indentation, depth, refs))
1969
- )
1970
- .join('');
1971
-
1972
- markup.printChildren = printChildren;
1973
-
1974
- const printText = (text, config) => {
1975
- const contentColor = config.colors.content;
1976
- return (
1977
- contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close
1978
- );
1979
- };
1980
-
1981
- markup.printText = printText;
1982
-
1983
- const printComment = (comment, config) => {
1984
- const commentColor = config.colors.comment;
1985
- return (
1986
- commentColor.open +
1987
- '<!--' +
1988
- (0, _escapeHTML.default)(comment) +
1989
- '-->' +
1990
- commentColor.close
1991
- );
1992
- }; // Separate the functions to format props, children, and element,
1993
- // so a plugin could override a particular function, if needed.
1994
- // Too bad, so sad: the traditional (but unnecessary) space
1995
- // in a self-closing tagColor requires a second test of printedProps.
1996
-
1997
- markup.printComment = printComment;
1998
-
1999
- const printElement = (
2000
- type,
2001
- printedProps,
2002
- printedChildren,
2003
- config,
2004
- indentation
2005
- ) => {
2006
- const tagColor = config.colors.tag;
2007
- return (
2008
- tagColor.open +
2009
- '<' +
2010
- type +
2011
- (printedProps &&
2012
- tagColor.close +
2013
- printedProps +
2014
- config.spacingOuter +
2015
- indentation +
2016
- tagColor.open) +
2017
- (printedChildren
2018
- ? '>' +
2019
- tagColor.close +
2020
- printedChildren +
2021
- config.spacingOuter +
2022
- indentation +
2023
- tagColor.open +
2024
- '</' +
2025
- type
2026
- : (printedProps && !config.min ? '' : ' ') + '/') +
2027
- '>' +
2028
- tagColor.close
2029
- );
2030
- };
2031
-
2032
- markup.printElement = printElement;
2033
-
2034
- const printElementAsLeaf = (type, config) => {
2035
- const tagColor = config.colors.tag;
2036
- return (
2037
- tagColor.open +
2038
- '<' +
2039
- type +
2040
- tagColor.close +
2041
- ' …' +
2042
- tagColor.open +
2043
- ' />' +
2044
- tagColor.close
2045
- );
2046
- };
2047
-
2048
- markup.printElementAsLeaf = printElementAsLeaf;
2049
-
2050
- Object.defineProperty(DOMElement$1, '__esModule', {
2051
- value: true
2052
- });
2053
- DOMElement$1.test = DOMElement$1.serialize = DOMElement$1.default = void 0;
2054
-
2055
- var _markup$2 = markup;
2056
-
2057
- /**
2058
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2059
- *
2060
- * This source code is licensed under the MIT license found in the
2061
- * LICENSE file in the root directory of this source tree.
2062
- */
2063
- const ELEMENT_NODE = 1;
2064
- const TEXT_NODE = 3;
2065
- const COMMENT_NODE = 8;
2066
- const FRAGMENT_NODE = 11;
2067
- const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
2068
-
2069
- const testHasAttribute = val => {
2070
- try {
2071
- return typeof val.hasAttribute === 'function' && val.hasAttribute('is');
2072
- } catch {
2073
- return false;
2074
- }
2075
- };
2076
-
2077
- const testNode = val => {
2078
- const constructorName = val.constructor.name;
2079
- const {nodeType, tagName} = val;
2080
- const isCustomElement =
2081
- (typeof tagName === 'string' && tagName.includes('-')) ||
2082
- testHasAttribute(val);
2083
- return (
2084
- (nodeType === ELEMENT_NODE &&
2085
- (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||
2086
- (nodeType === TEXT_NODE && constructorName === 'Text') ||
2087
- (nodeType === COMMENT_NODE && constructorName === 'Comment') ||
2088
- (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')
2089
- );
2090
- };
2091
-
2092
- const test$3 = val => {
2093
- var _val$constructor;
2094
-
2095
- return (
2096
- (val === null || val === void 0
2097
- ? void 0
2098
- : (_val$constructor = val.constructor) === null ||
2099
- _val$constructor === void 0
2100
- ? void 0
2101
- : _val$constructor.name) && testNode(val)
2102
- );
2103
- };
2104
-
2105
- DOMElement$1.test = test$3;
2106
-
2107
- function nodeIsText(node) {
2108
- return node.nodeType === TEXT_NODE;
2109
- }
2110
-
2111
- function nodeIsComment(node) {
2112
- return node.nodeType === COMMENT_NODE;
2113
- }
2114
-
2115
- function nodeIsFragment(node) {
2116
- return node.nodeType === FRAGMENT_NODE;
2117
- }
2118
-
2119
- const serialize$3 = (node, config, indentation, depth, refs, printer) => {
2120
- if (nodeIsText(node)) {
2121
- return (0, _markup$2.printText)(node.data, config);
2122
- }
2123
-
2124
- if (nodeIsComment(node)) {
2125
- return (0, _markup$2.printComment)(node.data, config);
2126
- }
2127
-
2128
- const type = nodeIsFragment(node)
2129
- ? 'DocumentFragment'
2130
- : node.tagName.toLowerCase();
2131
-
2132
- if (++depth > config.maxDepth) {
2133
- return (0, _markup$2.printElementAsLeaf)(type, config);
2134
- }
2135
-
2136
- return (0, _markup$2.printElement)(
2137
- type,
2138
- (0, _markup$2.printProps)(
2139
- nodeIsFragment(node)
2140
- ? []
2141
- : Array.from(node.attributes)
2142
- .map(attr => attr.name)
2143
- .sort(),
2144
- nodeIsFragment(node)
2145
- ? {}
2146
- : Array.from(node.attributes).reduce((props, attribute) => {
2147
- props[attribute.name] = attribute.value;
2148
- return props;
2149
- }, {}),
2150
- config,
2151
- indentation + config.indent,
2152
- depth,
2153
- refs,
2154
- printer
2155
- ),
2156
- (0, _markup$2.printChildren)(
2157
- Array.prototype.slice.call(node.childNodes || node.children),
2158
- config,
2159
- indentation + config.indent,
2160
- depth,
2161
- refs,
2162
- printer
2163
- ),
2164
- config,
2165
- indentation
2166
- );
2167
- };
2168
-
2169
- DOMElement$1.serialize = serialize$3;
2170
- const plugin$3 = {
2171
- serialize: serialize$3,
2172
- test: test$3
2173
- };
2174
- var _default$4 = plugin$3;
2175
- DOMElement$1.default = _default$4;
2176
-
2177
- var Immutable$1 = {};
2178
-
2179
- Object.defineProperty(Immutable$1, '__esModule', {
2180
- value: true
2181
- });
2182
- Immutable$1.test = Immutable$1.serialize = Immutable$1.default = void 0;
2183
-
2184
- var _collections$1 = collections;
2185
-
2186
- /**
2187
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2188
- *
2189
- * This source code is licensed under the MIT license found in the
2190
- * LICENSE file in the root directory of this source tree.
2191
- */
2192
- // SENTINEL constants are from https://github.com/facebook/immutable-js
2193
- const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
2194
- const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
2195
- const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
2196
- const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
2197
- const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
2198
- const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
2199
-
2200
- const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
2201
- const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
2202
- const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
2203
-
2204
- const getImmutableName = name => 'Immutable.' + name;
2205
-
2206
- const printAsLeaf = name => '[' + name + ']';
2207
-
2208
- const SPACE = ' ';
2209
- const LAZY = '…'; // Seq is lazy if it calls a method like filter
2210
-
2211
- const printImmutableEntries = (
2212
- val,
2213
- config,
2214
- indentation,
2215
- depth,
2216
- refs,
2217
- printer,
2218
- type
2219
- ) =>
2220
- ++depth > config.maxDepth
2221
- ? printAsLeaf(getImmutableName(type))
2222
- : getImmutableName(type) +
2223
- SPACE +
2224
- '{' +
2225
- (0, _collections$1.printIteratorEntries)(
2226
- val.entries(),
2227
- config,
2228
- indentation,
2229
- depth,
2230
- refs,
2231
- printer
2232
- ) +
2233
- '}'; // Record has an entries method because it is a collection in immutable v3.
2234
- // Return an iterator for Immutable Record from version v3 or v4.
2235
-
2236
- function getRecordEntries(val) {
2237
- let i = 0;
2238
- return {
2239
- next() {
2240
- if (i < val._keys.length) {
2241
- const key = val._keys[i++];
2242
- return {
2243
- done: false,
2244
- value: [key, val.get(key)]
2245
- };
2246
- }
2247
-
2248
- return {
2249
- done: true,
2250
- value: undefined
2251
- };
2252
- }
2253
- };
2254
- }
2255
-
2256
- const printImmutableRecord = (
2257
- val,
2258
- config,
2259
- indentation,
2260
- depth,
2261
- refs,
2262
- printer
2263
- ) => {
2264
- // _name property is defined only for an Immutable Record instance
2265
- // which was constructed with a second optional descriptive name arg
2266
- const name = getImmutableName(val._name || 'Record');
2267
- return ++depth > config.maxDepth
2268
- ? printAsLeaf(name)
2269
- : name +
2270
- SPACE +
2271
- '{' +
2272
- (0, _collections$1.printIteratorEntries)(
2273
- getRecordEntries(val),
2274
- config,
2275
- indentation,
2276
- depth,
2277
- refs,
2278
- printer
2279
- ) +
2280
- '}';
2281
- };
2282
-
2283
- const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
2284
- const name = getImmutableName('Seq');
2285
-
2286
- if (++depth > config.maxDepth) {
2287
- return printAsLeaf(name);
2288
- }
2289
-
2290
- if (val[IS_KEYED_SENTINEL]) {
2291
- return (
2292
- name +
2293
- SPACE +
2294
- '{' + // from Immutable collection of entries or from ECMAScript object
2295
- (val._iter || val._object
2296
- ? (0, _collections$1.printIteratorEntries)(
2297
- val.entries(),
2298
- config,
2299
- indentation,
2300
- depth,
2301
- refs,
2302
- printer
2303
- )
2304
- : LAZY) +
2305
- '}'
2306
- );
2307
- }
2308
-
2309
- return (
2310
- name +
2311
- SPACE +
2312
- '[' +
2313
- (val._iter || // from Immutable collection of values
2314
- val._array || // from ECMAScript array
2315
- val._collection || // from ECMAScript collection in immutable v4
2316
- val._iterable // from ECMAScript collection in immutable v3
2317
- ? (0, _collections$1.printIteratorValues)(
2318
- val.values(),
2319
- config,
2320
- indentation,
2321
- depth,
2322
- refs,
2323
- printer
2324
- )
2325
- : LAZY) +
2326
- ']'
2327
- );
2328
- };
2329
-
2330
- const printImmutableValues = (
2331
- val,
2332
- config,
2333
- indentation,
2334
- depth,
2335
- refs,
2336
- printer,
2337
- type
2338
- ) =>
2339
- ++depth > config.maxDepth
2340
- ? printAsLeaf(getImmutableName(type))
2341
- : getImmutableName(type) +
2342
- SPACE +
2343
- '[' +
2344
- (0, _collections$1.printIteratorValues)(
2345
- val.values(),
2346
- config,
2347
- indentation,
2348
- depth,
2349
- refs,
2350
- printer
2351
- ) +
2352
- ']';
2353
-
2354
- const serialize$2 = (val, config, indentation, depth, refs, printer) => {
2355
- if (val[IS_MAP_SENTINEL]) {
2356
- return printImmutableEntries(
2357
- val,
2358
- config,
2359
- indentation,
2360
- depth,
2361
- refs,
2362
- printer,
2363
- val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
2364
- );
2365
- }
2366
-
2367
- if (val[IS_LIST_SENTINEL]) {
2368
- return printImmutableValues(
2369
- val,
2370
- config,
2371
- indentation,
2372
- depth,
2373
- refs,
2374
- printer,
2375
- 'List'
2376
- );
2377
- }
2378
-
2379
- if (val[IS_SET_SENTINEL]) {
2380
- return printImmutableValues(
2381
- val,
2382
- config,
2383
- indentation,
2384
- depth,
2385
- refs,
2386
- printer,
2387
- val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
2388
- );
2389
- }
2390
-
2391
- if (val[IS_STACK_SENTINEL]) {
2392
- return printImmutableValues(
2393
- val,
2394
- config,
2395
- indentation,
2396
- depth,
2397
- refs,
2398
- printer,
2399
- 'Stack'
2400
- );
2401
- }
2402
-
2403
- if (val[IS_SEQ_SENTINEL]) {
2404
- return printImmutableSeq(val, config, indentation, depth, refs, printer);
2405
- } // For compatibility with immutable v3 and v4, let record be the default.
2406
-
2407
- return printImmutableRecord(val, config, indentation, depth, refs, printer);
2408
- }; // Explicitly comparing sentinel properties to true avoids false positive
2409
- // when mock identity-obj-proxy returns the key as the value for any key.
2410
-
2411
- Immutable$1.serialize = serialize$2;
2412
-
2413
- const test$2 = val =>
2414
- val &&
2415
- (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
2416
-
2417
- Immutable$1.test = test$2;
2418
- const plugin$2 = {
2419
- serialize: serialize$2,
2420
- test: test$2
2421
- };
2422
- var _default$3 = plugin$2;
2423
- Immutable$1.default = _default$3;
2424
-
2425
- var ReactElement$1 = {};
2426
-
2427
- var reactIs = {exports: {}};
2428
-
2429
- var reactIs_production_min = {};
2430
-
2431
- /** @license React v17.0.2
2432
- * react-is.production.min.js
2433
- *
2434
- * Copyright (c) Facebook, Inc. and its affiliates.
2435
- *
2436
- * This source code is licensed under the MIT license found in the
2437
- * LICENSE file in the root directory of this source tree.
2438
- */
2439
-
2440
- var hasRequiredReactIs_production_min;
2441
-
2442
- function requireReactIs_production_min () {
2443
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
2444
- hasRequiredReactIs_production_min = 1;
2445
- 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;
2446
- 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");}
2447
- 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;
2448
- 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};
2449
- 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};
2450
- reactIs_production_min.typeOf=y;
2451
- return reactIs_production_min;
2452
- }
2453
-
2454
- var reactIs_development = {};
2455
-
2456
- /** @license React v17.0.2
2457
- * react-is.development.js
2458
- *
2459
- * Copyright (c) Facebook, Inc. and its affiliates.
2460
- *
2461
- * This source code is licensed under the MIT license found in the
2462
- * LICENSE file in the root directory of this source tree.
2463
- */
2464
-
2465
- var hasRequiredReactIs_development;
2466
-
2467
- function requireReactIs_development () {
2468
- if (hasRequiredReactIs_development) return reactIs_development;
2469
- hasRequiredReactIs_development = 1;
2470
-
2471
- if (process.env.NODE_ENV !== "production") {
2472
- (function() {
2473
-
2474
- // ATTENTION
2475
- // When adding new symbols to this file,
2476
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
2477
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2478
- // nor polyfill, then a plain number is used for performance.
2479
- var REACT_ELEMENT_TYPE = 0xeac7;
2480
- var REACT_PORTAL_TYPE = 0xeaca;
2481
- var REACT_FRAGMENT_TYPE = 0xeacb;
2482
- var REACT_STRICT_MODE_TYPE = 0xeacc;
2483
- var REACT_PROFILER_TYPE = 0xead2;
2484
- var REACT_PROVIDER_TYPE = 0xeacd;
2485
- var REACT_CONTEXT_TYPE = 0xeace;
2486
- var REACT_FORWARD_REF_TYPE = 0xead0;
2487
- var REACT_SUSPENSE_TYPE = 0xead1;
2488
- var REACT_SUSPENSE_LIST_TYPE = 0xead8;
2489
- var REACT_MEMO_TYPE = 0xead3;
2490
- var REACT_LAZY_TYPE = 0xead4;
2491
- var REACT_BLOCK_TYPE = 0xead9;
2492
- var REACT_SERVER_BLOCK_TYPE = 0xeada;
2493
- var REACT_FUNDAMENTAL_TYPE = 0xead5;
2494
- var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
2495
- var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
2496
-
2497
- if (typeof Symbol === 'function' && Symbol.for) {
2498
- var symbolFor = Symbol.for;
2499
- REACT_ELEMENT_TYPE = symbolFor('react.element');
2500
- REACT_PORTAL_TYPE = symbolFor('react.portal');
2501
- REACT_FRAGMENT_TYPE = symbolFor('react.fragment');
2502
- REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');
2503
- REACT_PROFILER_TYPE = symbolFor('react.profiler');
2504
- REACT_PROVIDER_TYPE = symbolFor('react.provider');
2505
- REACT_CONTEXT_TYPE = symbolFor('react.context');
2506
- REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
2507
- REACT_SUSPENSE_TYPE = symbolFor('react.suspense');
2508
- REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
2509
- REACT_MEMO_TYPE = symbolFor('react.memo');
2510
- REACT_LAZY_TYPE = symbolFor('react.lazy');
2511
- REACT_BLOCK_TYPE = symbolFor('react.block');
2512
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
2513
- REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
2514
- symbolFor('react.scope');
2515
- symbolFor('react.opaque.id');
2516
- REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
2517
- symbolFor('react.offscreen');
2518
- REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
2519
- }
2520
-
2521
- // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
2522
-
2523
- var enableScopeAPI = false; // Experimental Create Event Handle API.
2524
-
2525
- function isValidElementType(type) {
2526
- if (typeof type === 'string' || typeof type === 'function') {
2527
- return true;
2528
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
2529
-
2530
-
2531
- 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 ) {
2532
- return true;
2533
- }
2534
-
2535
- if (typeof type === 'object' && type !== null) {
2536
- 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) {
2537
- return true;
2538
- }
2539
- }
2540
-
2541
- return false;
2542
- }
2543
-
2544
- function typeOf(object) {
2545
- if (typeof object === 'object' && object !== null) {
2546
- var $$typeof = object.$$typeof;
2547
-
2548
- switch ($$typeof) {
2549
- case REACT_ELEMENT_TYPE:
2550
- var type = object.type;
2551
-
2552
- switch (type) {
2553
- case REACT_FRAGMENT_TYPE:
2554
- case REACT_PROFILER_TYPE:
2555
- case REACT_STRICT_MODE_TYPE:
2556
- case REACT_SUSPENSE_TYPE:
2557
- case REACT_SUSPENSE_LIST_TYPE:
2558
- return type;
2559
-
2560
- default:
2561
- var $$typeofType = type && type.$$typeof;
2562
-
2563
- switch ($$typeofType) {
2564
- case REACT_CONTEXT_TYPE:
2565
- case REACT_FORWARD_REF_TYPE:
2566
- case REACT_LAZY_TYPE:
2567
- case REACT_MEMO_TYPE:
2568
- case REACT_PROVIDER_TYPE:
2569
- return $$typeofType;
2570
-
2571
- default:
2572
- return $$typeof;
2573
- }
2574
-
2575
- }
2576
-
2577
- case REACT_PORTAL_TYPE:
2578
- return $$typeof;
2579
- }
2580
- }
2581
-
2582
- return undefined;
2583
- }
2584
- var ContextConsumer = REACT_CONTEXT_TYPE;
2585
- var ContextProvider = REACT_PROVIDER_TYPE;
2586
- var Element = REACT_ELEMENT_TYPE;
2587
- var ForwardRef = REACT_FORWARD_REF_TYPE;
2588
- var Fragment = REACT_FRAGMENT_TYPE;
2589
- var Lazy = REACT_LAZY_TYPE;
2590
- var Memo = REACT_MEMO_TYPE;
2591
- var Portal = REACT_PORTAL_TYPE;
2592
- var Profiler = REACT_PROFILER_TYPE;
2593
- var StrictMode = REACT_STRICT_MODE_TYPE;
2594
- var Suspense = REACT_SUSPENSE_TYPE;
2595
- var hasWarnedAboutDeprecatedIsAsyncMode = false;
2596
- var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
2597
-
2598
- function isAsyncMode(object) {
2599
- {
2600
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
2601
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
2602
-
2603
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
2604
- }
2605
- }
2606
-
2607
- return false;
2608
- }
2609
- function isConcurrentMode(object) {
2610
- {
2611
- if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
2612
- hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
2613
-
2614
- console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
2615
- }
2616
- }
2617
-
2618
- return false;
2619
- }
2620
- function isContextConsumer(object) {
2621
- return typeOf(object) === REACT_CONTEXT_TYPE;
2622
- }
2623
- function isContextProvider(object) {
2624
- return typeOf(object) === REACT_PROVIDER_TYPE;
2625
- }
2626
- function isElement(object) {
2627
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
2628
- }
2629
- function isForwardRef(object) {
2630
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
2631
- }
2632
- function isFragment(object) {
2633
- return typeOf(object) === REACT_FRAGMENT_TYPE;
2634
- }
2635
- function isLazy(object) {
2636
- return typeOf(object) === REACT_LAZY_TYPE;
2637
- }
2638
- function isMemo(object) {
2639
- return typeOf(object) === REACT_MEMO_TYPE;
2640
- }
2641
- function isPortal(object) {
2642
- return typeOf(object) === REACT_PORTAL_TYPE;
2643
- }
2644
- function isProfiler(object) {
2645
- return typeOf(object) === REACT_PROFILER_TYPE;
2646
- }
2647
- function isStrictMode(object) {
2648
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
2649
- }
2650
- function isSuspense(object) {
2651
- return typeOf(object) === REACT_SUSPENSE_TYPE;
2652
- }
2653
-
2654
- reactIs_development.ContextConsumer = ContextConsumer;
2655
- reactIs_development.ContextProvider = ContextProvider;
2656
- reactIs_development.Element = Element;
2657
- reactIs_development.ForwardRef = ForwardRef;
2658
- reactIs_development.Fragment = Fragment;
2659
- reactIs_development.Lazy = Lazy;
2660
- reactIs_development.Memo = Memo;
2661
- reactIs_development.Portal = Portal;
2662
- reactIs_development.Profiler = Profiler;
2663
- reactIs_development.StrictMode = StrictMode;
2664
- reactIs_development.Suspense = Suspense;
2665
- reactIs_development.isAsyncMode = isAsyncMode;
2666
- reactIs_development.isConcurrentMode = isConcurrentMode;
2667
- reactIs_development.isContextConsumer = isContextConsumer;
2668
- reactIs_development.isContextProvider = isContextProvider;
2669
- reactIs_development.isElement = isElement;
2670
- reactIs_development.isForwardRef = isForwardRef;
2671
- reactIs_development.isFragment = isFragment;
2672
- reactIs_development.isLazy = isLazy;
2673
- reactIs_development.isMemo = isMemo;
2674
- reactIs_development.isPortal = isPortal;
2675
- reactIs_development.isProfiler = isProfiler;
2676
- reactIs_development.isStrictMode = isStrictMode;
2677
- reactIs_development.isSuspense = isSuspense;
2678
- reactIs_development.isValidElementType = isValidElementType;
2679
- reactIs_development.typeOf = typeOf;
2680
- })();
2681
- }
2682
- return reactIs_development;
2683
- }
2684
-
2685
- (function (module) {
2686
-
2687
- if (process.env.NODE_ENV === 'production') {
2688
- module.exports = requireReactIs_production_min();
2689
- } else {
2690
- module.exports = requireReactIs_development();
2691
- }
2692
- } (reactIs));
2693
-
2694
- Object.defineProperty(ReactElement$1, '__esModule', {
2695
- value: true
2696
- });
2697
- ReactElement$1.test = ReactElement$1.serialize = ReactElement$1.default = void 0;
2698
-
2699
- var ReactIs = _interopRequireWildcard(reactIs.exports);
2700
-
2701
- var _markup$1 = markup;
2702
-
2703
- function _getRequireWildcardCache(nodeInterop) {
2704
- if (typeof WeakMap !== 'function') return null;
2705
- var cacheBabelInterop = new WeakMap();
2706
- var cacheNodeInterop = new WeakMap();
2707
- return (_getRequireWildcardCache = function (nodeInterop) {
2708
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
2709
- })(nodeInterop);
2710
- }
2711
-
2712
- function _interopRequireWildcard(obj, nodeInterop) {
2713
- if (!nodeInterop && obj && obj.__esModule) {
2714
- return obj;
2715
- }
2716
- if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
2717
- return {default: obj};
2718
- }
2719
- var cache = _getRequireWildcardCache(nodeInterop);
2720
- if (cache && cache.has(obj)) {
2721
- return cache.get(obj);
2722
- }
2723
- var newObj = {};
2724
- var hasPropertyDescriptor =
2725
- Object.defineProperty && Object.getOwnPropertyDescriptor;
2726
- for (var key in obj) {
2727
- if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
2728
- var desc = hasPropertyDescriptor
2729
- ? Object.getOwnPropertyDescriptor(obj, key)
2730
- : null;
2731
- if (desc && (desc.get || desc.set)) {
2732
- Object.defineProperty(newObj, key, desc);
2733
- } else {
2734
- newObj[key] = obj[key];
2735
- }
2736
- }
2737
- }
2738
- newObj.default = obj;
2739
- if (cache) {
2740
- cache.set(obj, newObj);
2741
- }
2742
- return newObj;
2743
- }
2744
-
2745
- /**
2746
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2747
- *
2748
- * This source code is licensed under the MIT license found in the
2749
- * LICENSE file in the root directory of this source tree.
2750
- */
2751
- // Given element.props.children, or subtree during recursive traversal,
2752
- // return flattened array of children.
2753
- const getChildren = (arg, children = []) => {
2754
- if (Array.isArray(arg)) {
2755
- arg.forEach(item => {
2756
- getChildren(item, children);
2757
- });
2758
- } else if (arg != null && arg !== false) {
2759
- children.push(arg);
2760
- }
2761
-
2762
- return children;
2763
- };
2764
-
2765
- const getType = element => {
2766
- const type = element.type;
2767
-
2768
- if (typeof type === 'string') {
2769
- return type;
2770
- }
2771
-
2772
- if (typeof type === 'function') {
2773
- return type.displayName || type.name || 'Unknown';
2774
- }
2775
-
2776
- if (ReactIs.isFragment(element)) {
2777
- return 'React.Fragment';
2778
- }
2779
-
2780
- if (ReactIs.isSuspense(element)) {
2781
- return 'React.Suspense';
2782
- }
2783
-
2784
- if (typeof type === 'object' && type !== null) {
2785
- if (ReactIs.isContextProvider(element)) {
2786
- return 'Context.Provider';
2787
- }
2788
-
2789
- if (ReactIs.isContextConsumer(element)) {
2790
- return 'Context.Consumer';
2791
- }
2792
-
2793
- if (ReactIs.isForwardRef(element)) {
2794
- if (type.displayName) {
2795
- return type.displayName;
2796
- }
2797
-
2798
- const functionName = type.render.displayName || type.render.name || '';
2799
- return functionName !== ''
2800
- ? 'ForwardRef(' + functionName + ')'
2801
- : 'ForwardRef';
2802
- }
2803
-
2804
- if (ReactIs.isMemo(element)) {
2805
- const functionName =
2806
- type.displayName || type.type.displayName || type.type.name || '';
2807
- return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';
2808
- }
2809
- }
2810
-
2811
- return 'UNDEFINED';
2812
- };
2813
-
2814
- const getPropKeys$1 = element => {
2815
- const {props} = element;
2816
- return Object.keys(props)
2817
- .filter(key => key !== 'children' && props[key] !== undefined)
2818
- .sort();
2819
- };
2820
-
2821
- const serialize$1 = (element, config, indentation, depth, refs, printer) =>
2822
- ++depth > config.maxDepth
2823
- ? (0, _markup$1.printElementAsLeaf)(getType(element), config)
2824
- : (0, _markup$1.printElement)(
2825
- getType(element),
2826
- (0, _markup$1.printProps)(
2827
- getPropKeys$1(element),
2828
- element.props,
2829
- config,
2830
- indentation + config.indent,
2831
- depth,
2832
- refs,
2833
- printer
2834
- ),
2835
- (0, _markup$1.printChildren)(
2836
- getChildren(element.props.children),
2837
- config,
2838
- indentation + config.indent,
2839
- depth,
2840
- refs,
2841
- printer
2842
- ),
2843
- config,
2844
- indentation
2845
- );
2846
-
2847
- ReactElement$1.serialize = serialize$1;
2848
-
2849
- const test$1 = val => val != null && ReactIs.isElement(val);
2850
-
2851
- ReactElement$1.test = test$1;
2852
- const plugin$1 = {
2853
- serialize: serialize$1,
2854
- test: test$1
2855
- };
2856
- var _default$2 = plugin$1;
2857
- ReactElement$1.default = _default$2;
2858
-
2859
- var ReactTestComponent$1 = {};
2860
-
2861
- Object.defineProperty(ReactTestComponent$1, '__esModule', {
2862
- value: true
2863
- });
2864
- ReactTestComponent$1.test = ReactTestComponent$1.serialize = ReactTestComponent$1.default = void 0;
2865
-
2866
- var _markup = markup;
2867
-
2868
- var global = (function () {
2869
- if (typeof globalThis !== 'undefined') {
2870
- return globalThis;
2871
- } else if (typeof global !== 'undefined') {
2872
- return global;
2873
- } else if (typeof self !== 'undefined') {
2874
- return self;
2875
- } else if (typeof window !== 'undefined') {
2876
- return window;
2877
- } else {
2878
- return Function('return this')();
2879
- }
2880
- })();
2881
-
2882
- var Symbol$1 = global['jest-symbol-do-not-touch'] || global.Symbol;
2883
- const testSymbol =
2884
- typeof Symbol$1 === 'function' && Symbol$1.for
2885
- ? Symbol$1.for('react.test.json')
2886
- : 0xea71357;
2887
-
2888
- const getPropKeys = object => {
2889
- const {props} = object;
2890
- return props
2891
- ? Object.keys(props)
2892
- .filter(key => props[key] !== undefined)
2893
- .sort()
2894
- : [];
2895
- };
2896
-
2897
- const serialize = (object, config, indentation, depth, refs, printer) =>
2898
- ++depth > config.maxDepth
2899
- ? (0, _markup.printElementAsLeaf)(object.type, config)
2900
- : (0, _markup.printElement)(
2901
- object.type,
2902
- object.props
2903
- ? (0, _markup.printProps)(
2904
- getPropKeys(object),
2905
- object.props,
2906
- config,
2907
- indentation + config.indent,
2908
- depth,
2909
- refs,
2910
- printer
2911
- )
2912
- : '',
2913
- object.children
2914
- ? (0, _markup.printChildren)(
2915
- object.children,
2916
- config,
2917
- indentation + config.indent,
2918
- depth,
2919
- refs,
2920
- printer
2921
- )
2922
- : '',
2923
- config,
2924
- indentation
2925
- );
2926
-
2927
- ReactTestComponent$1.serialize = serialize;
2928
-
2929
- const test = val => val && val.$$typeof === testSymbol;
2930
-
2931
- ReactTestComponent$1.test = test;
2932
- const plugin = {
2933
- serialize,
2934
- test
2935
- };
2936
- var _default$1 = plugin;
2937
- ReactTestComponent$1.default = _default$1;
2938
-
2939
- Object.defineProperty(build, '__esModule', {
2940
- value: true
2941
- });
2942
- build.default = build.DEFAULT_OPTIONS = void 0;
2943
- var format_1 = build.format = format;
2944
- var plugins_1 = build.plugins = void 0;
2945
-
2946
- var _ansiStyles = _interopRequireDefault(ansiStyles.exports);
2947
-
2948
- var _collections = collections;
2949
-
2950
- var _AsymmetricMatcher = _interopRequireDefault(
2951
- AsymmetricMatcher$1
2952
- );
2953
-
2954
- var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
2955
-
2956
- var _DOMCollection = _interopRequireDefault(DOMCollection$1);
2957
-
2958
- var _DOMElement = _interopRequireDefault(DOMElement$1);
2959
-
2960
- var _Immutable = _interopRequireDefault(Immutable$1);
2961
-
2962
- var _ReactElement = _interopRequireDefault(ReactElement$1);
2963
-
2964
- var _ReactTestComponent = _interopRequireDefault(
2965
- ReactTestComponent$1
2966
- );
2967
-
2968
- function _interopRequireDefault(obj) {
2969
- return obj && obj.__esModule ? obj : {default: obj};
2970
- }
2971
-
2972
- /**
2973
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
2974
- *
2975
- * This source code is licensed under the MIT license found in the
2976
- * LICENSE file in the root directory of this source tree.
2977
- */
2978
-
2979
- /* eslint-disable local/ban-types-eventually */
2980
- const toString = Object.prototype.toString;
2981
- const toISOString = Date.prototype.toISOString;
2982
- const errorToString = Error.prototype.toString;
2983
- const regExpToString = RegExp.prototype.toString;
2984
- /**
2985
- * Explicitly comparing typeof constructor to function avoids undefined as name
2986
- * when mock identity-obj-proxy returns the key as the value for any key.
2987
- */
2988
-
2989
- const getConstructorName = val =>
2990
- (typeof val.constructor === 'function' && val.constructor.name) || 'Object';
2991
- /* global window */
2992
-
2993
- /** Is val is equal to global window object? Works even if it does not exist :) */
2994
-
2995
- const isWindow = val => typeof window !== 'undefined' && val === window;
2996
-
2997
- const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
2998
- const NEWLINE_REGEXP = /\n/gi;
2999
-
3000
- class PrettyFormatPluginError extends Error {
3001
- constructor(message, stack) {
3002
- super(message);
3003
- this.stack = stack;
3004
- this.name = this.constructor.name;
3005
- }
3006
- }
3007
-
3008
- function isToStringedArrayType(toStringed) {
3009
- return (
3010
- toStringed === '[object Array]' ||
3011
- toStringed === '[object ArrayBuffer]' ||
3012
- toStringed === '[object DataView]' ||
3013
- toStringed === '[object Float32Array]' ||
3014
- toStringed === '[object Float64Array]' ||
3015
- toStringed === '[object Int8Array]' ||
3016
- toStringed === '[object Int16Array]' ||
3017
- toStringed === '[object Int32Array]' ||
3018
- toStringed === '[object Uint8Array]' ||
3019
- toStringed === '[object Uint8ClampedArray]' ||
3020
- toStringed === '[object Uint16Array]' ||
3021
- toStringed === '[object Uint32Array]'
3022
- );
3023
- }
3024
-
3025
- function printNumber(val) {
3026
- return Object.is(val, -0) ? '-0' : String(val);
3027
- }
3028
-
3029
- function printBigInt(val) {
3030
- return String(`${val}n`);
3031
- }
3032
-
3033
- function printFunction(val, printFunctionName) {
3034
- if (!printFunctionName) {
3035
- return '[Function]';
3036
- }
3037
-
3038
- return '[Function ' + (val.name || 'anonymous') + ']';
3039
- }
3040
-
3041
- function printSymbol(val) {
3042
- return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
3043
- }
3044
-
3045
- function printError(val) {
3046
- return '[' + errorToString.call(val) + ']';
3047
- }
3048
- /**
3049
- * The first port of call for printing an object, handles most of the
3050
- * data-types in JS.
3051
- */
3052
-
3053
- function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
3054
- if (val === true || val === false) {
3055
- return '' + val;
3056
- }
3057
-
3058
- if (val === undefined) {
3059
- return 'undefined';
3060
- }
3061
-
3062
- if (val === null) {
3063
- return 'null';
3064
- }
3065
-
3066
- const typeOf = typeof val;
3067
-
3068
- if (typeOf === 'number') {
3069
- return printNumber(val);
3070
- }
3071
-
3072
- if (typeOf === 'bigint') {
3073
- return printBigInt(val);
3074
- }
3075
-
3076
- if (typeOf === 'string') {
3077
- if (escapeString) {
3078
- return '"' + val.replace(/"|\\/g, '\\$&') + '"';
3079
- }
3080
-
3081
- return '"' + val + '"';
3082
- }
3083
-
3084
- if (typeOf === 'function') {
3085
- return printFunction(val, printFunctionName);
3086
- }
3087
-
3088
- if (typeOf === 'symbol') {
3089
- return printSymbol(val);
3090
- }
3091
-
3092
- const toStringed = toString.call(val);
3093
-
3094
- if (toStringed === '[object WeakMap]') {
3095
- return 'WeakMap {}';
3096
- }
3097
-
3098
- if (toStringed === '[object WeakSet]') {
3099
- return 'WeakSet {}';
3100
- }
3101
-
3102
- if (
3103
- toStringed === '[object Function]' ||
3104
- toStringed === '[object GeneratorFunction]'
3105
- ) {
3106
- return printFunction(val, printFunctionName);
3107
- }
3108
-
3109
- if (toStringed === '[object Symbol]') {
3110
- return printSymbol(val);
3111
- }
3112
-
3113
- if (toStringed === '[object Date]') {
3114
- return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
3115
- }
3116
-
3117
- if (toStringed === '[object Error]') {
3118
- return printError(val);
3119
- }
3120
-
3121
- if (toStringed === '[object RegExp]') {
3122
- if (escapeRegex) {
3123
- // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
3124
- return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
3125
- }
3126
-
3127
- return regExpToString.call(val);
3128
- }
3129
-
3130
- if (val instanceof Error) {
3131
- return printError(val);
3132
- }
3133
-
3134
- return null;
3135
- }
3136
- /**
3137
- * Handles more complex objects ( such as objects with circular references.
3138
- * maps and sets etc )
3139
- */
3140
-
3141
- function printComplexValue(
3142
- val,
3143
- config,
3144
- indentation,
3145
- depth,
3146
- refs,
3147
- hasCalledToJSON
3148
- ) {
3149
- if (refs.indexOf(val) !== -1) {
3150
- return '[Circular]';
3151
- }
3152
-
3153
- refs = refs.slice();
3154
- refs.push(val);
3155
- const hitMaxDepth = ++depth > config.maxDepth;
3156
- const min = config.min;
3157
-
3158
- if (
3159
- config.callToJSON &&
3160
- !hitMaxDepth &&
3161
- val.toJSON &&
3162
- typeof val.toJSON === 'function' &&
3163
- !hasCalledToJSON
3164
- ) {
3165
- return printer(val.toJSON(), config, indentation, depth, refs, true);
3166
- }
3167
-
3168
- const toStringed = toString.call(val);
3169
-
3170
- if (toStringed === '[object Arguments]') {
3171
- return hitMaxDepth
3172
- ? '[Arguments]'
3173
- : (min ? '' : 'Arguments ') +
3174
- '[' +
3175
- (0, _collections.printListItems)(
3176
- val,
3177
- config,
3178
- indentation,
3179
- depth,
3180
- refs,
3181
- printer
3182
- ) +
3183
- ']';
3184
- }
3185
-
3186
- if (isToStringedArrayType(toStringed)) {
3187
- return hitMaxDepth
3188
- ? '[' + val.constructor.name + ']'
3189
- : (min
3190
- ? ''
3191
- : !config.printBasicPrototype && val.constructor.name === 'Array'
3192
- ? ''
3193
- : val.constructor.name + ' ') +
3194
- '[' +
3195
- (0, _collections.printListItems)(
3196
- val,
3197
- config,
3198
- indentation,
3199
- depth,
3200
- refs,
3201
- printer
3202
- ) +
3203
- ']';
3204
- }
3205
-
3206
- if (toStringed === '[object Map]') {
3207
- return hitMaxDepth
3208
- ? '[Map]'
3209
- : 'Map {' +
3210
- (0, _collections.printIteratorEntries)(
3211
- val.entries(),
3212
- config,
3213
- indentation,
3214
- depth,
3215
- refs,
3216
- printer,
3217
- ' => '
3218
- ) +
3219
- '}';
3220
- }
3221
-
3222
- if (toStringed === '[object Set]') {
3223
- return hitMaxDepth
3224
- ? '[Set]'
3225
- : 'Set {' +
3226
- (0, _collections.printIteratorValues)(
3227
- val.values(),
3228
- config,
3229
- indentation,
3230
- depth,
3231
- refs,
3232
- printer
3233
- ) +
3234
- '}';
3235
- } // Avoid failure to serialize global window object in jsdom test environment.
3236
- // For example, not even relevant if window is prop of React element.
3237
-
3238
- return hitMaxDepth || isWindow(val)
3239
- ? '[' + getConstructorName(val) + ']'
3240
- : (min
3241
- ? ''
3242
- : !config.printBasicPrototype && getConstructorName(val) === 'Object'
3243
- ? ''
3244
- : getConstructorName(val) + ' ') +
3245
- '{' +
3246
- (0, _collections.printObjectProperties)(
3247
- val,
3248
- config,
3249
- indentation,
3250
- depth,
3251
- refs,
3252
- printer
3253
- ) +
3254
- '}';
3255
- }
3256
-
3257
- function isNewPlugin(plugin) {
3258
- return plugin.serialize != null;
3259
- }
3260
-
3261
- function printPlugin(plugin, val, config, indentation, depth, refs) {
3262
- let printed;
3263
-
3264
- try {
3265
- printed = isNewPlugin(plugin)
3266
- ? plugin.serialize(val, config, indentation, depth, refs, printer)
3267
- : plugin.print(
3268
- val,
3269
- valChild => printer(valChild, config, indentation, depth, refs),
3270
- str => {
3271
- const indentationNext = indentation + config.indent;
3272
- return (
3273
- indentationNext +
3274
- str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
3275
- );
3276
- },
3277
- {
3278
- edgeSpacing: config.spacingOuter,
3279
- min: config.min,
3280
- spacing: config.spacingInner
3281
- },
3282
- config.colors
3283
- );
3284
- } catch (error) {
3285
- throw new PrettyFormatPluginError(error.message, error.stack);
3286
- }
3287
-
3288
- if (typeof printed !== 'string') {
3289
- throw new Error(
3290
- `pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
3291
- );
3292
- }
3293
-
3294
- return printed;
3295
- }
3296
-
3297
- function findPlugin(plugins, val) {
3298
- for (let p = 0; p < plugins.length; p++) {
3299
- try {
3300
- if (plugins[p].test(val)) {
3301
- return plugins[p];
3302
- }
3303
- } catch (error) {
3304
- throw new PrettyFormatPluginError(error.message, error.stack);
3305
- }
3306
- }
3307
-
3308
- return null;
3309
- }
3310
-
3311
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
3312
- const plugin = findPlugin(config.plugins, val);
3313
-
3314
- if (plugin !== null) {
3315
- return printPlugin(plugin, val, config, indentation, depth, refs);
3316
- }
3317
-
3318
- const basicResult = printBasicValue(
3319
- val,
3320
- config.printFunctionName,
3321
- config.escapeRegex,
3322
- config.escapeString
3323
- );
3324
-
3325
- if (basicResult !== null) {
3326
- return basicResult;
3327
- }
3328
-
3329
- return printComplexValue(
3330
- val,
3331
- config,
3332
- indentation,
3333
- depth,
3334
- refs,
3335
- hasCalledToJSON
3336
- );
3337
- }
3338
-
3339
- const DEFAULT_THEME = {
3340
- comment: 'gray',
3341
- content: 'reset',
3342
- prop: 'yellow',
3343
- tag: 'cyan',
3344
- value: 'green'
3345
- };
3346
- const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
3347
- const DEFAULT_OPTIONS = {
3348
- callToJSON: true,
3349
- compareKeys: undefined,
3350
- escapeRegex: false,
3351
- escapeString: true,
3352
- highlight: false,
3353
- indent: 2,
3354
- maxDepth: Infinity,
3355
- min: false,
3356
- plugins: [],
3357
- printBasicPrototype: true,
3358
- printFunctionName: true,
3359
- theme: DEFAULT_THEME
3360
- };
3361
- build.DEFAULT_OPTIONS = DEFAULT_OPTIONS;
3362
-
3363
- function validateOptions(options) {
3364
- Object.keys(options).forEach(key => {
3365
- if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
3366
- throw new Error(`pretty-format: Unknown option "${key}".`);
3367
- }
3368
- });
3369
-
3370
- if (options.min && options.indent !== undefined && options.indent !== 0) {
3371
- throw new Error(
3372
- 'pretty-format: Options "min" and "indent" cannot be used together.'
3373
- );
3374
- }
3375
-
3376
- if (options.theme !== undefined) {
3377
- if (options.theme === null) {
3378
- throw new Error('pretty-format: Option "theme" must not be null.');
3379
- }
3380
-
3381
- if (typeof options.theme !== 'object') {
3382
- throw new Error(
3383
- `pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
3384
- );
3385
- }
3386
- }
3387
- }
3388
-
3389
- const getColorsHighlight = options =>
3390
- DEFAULT_THEME_KEYS.reduce((colors, key) => {
3391
- const value =
3392
- options.theme && options.theme[key] !== undefined
3393
- ? options.theme[key]
3394
- : DEFAULT_THEME[key];
3395
- const color = value && _ansiStyles.default[value];
3396
-
3397
- if (
3398
- color &&
3399
- typeof color.close === 'string' &&
3400
- typeof color.open === 'string'
3401
- ) {
3402
- colors[key] = color;
3403
- } else {
3404
- throw new Error(
3405
- `pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
3406
- );
3407
- }
3408
-
3409
- return colors;
3410
- }, Object.create(null));
3411
-
3412
- const getColorsEmpty = () =>
3413
- DEFAULT_THEME_KEYS.reduce((colors, key) => {
3414
- colors[key] = {
3415
- close: '',
3416
- open: ''
3417
- };
3418
- return colors;
3419
- }, Object.create(null));
3420
-
3421
- const getPrintFunctionName = options =>
3422
- options && options.printFunctionName !== undefined
3423
- ? options.printFunctionName
3424
- : DEFAULT_OPTIONS.printFunctionName;
3425
-
3426
- const getEscapeRegex = options =>
3427
- options && options.escapeRegex !== undefined
3428
- ? options.escapeRegex
3429
- : DEFAULT_OPTIONS.escapeRegex;
3430
-
3431
- const getEscapeString = options =>
3432
- options && options.escapeString !== undefined
3433
- ? options.escapeString
3434
- : DEFAULT_OPTIONS.escapeString;
3435
-
3436
- const getConfig = options => {
3437
- var _options$printBasicPr;
3438
-
3439
- return {
3440
- callToJSON:
3441
- options && options.callToJSON !== undefined
3442
- ? options.callToJSON
3443
- : DEFAULT_OPTIONS.callToJSON,
3444
- colors:
3445
- options && options.highlight
3446
- ? getColorsHighlight(options)
3447
- : getColorsEmpty(),
3448
- compareKeys:
3449
- options && typeof options.compareKeys === 'function'
3450
- ? options.compareKeys
3451
- : DEFAULT_OPTIONS.compareKeys,
3452
- escapeRegex: getEscapeRegex(options),
3453
- escapeString: getEscapeString(options),
3454
- indent:
3455
- options && options.min
3456
- ? ''
3457
- : createIndent(
3458
- options && options.indent !== undefined
3459
- ? options.indent
3460
- : DEFAULT_OPTIONS.indent
3461
- ),
3462
- maxDepth:
3463
- options && options.maxDepth !== undefined
3464
- ? options.maxDepth
3465
- : DEFAULT_OPTIONS.maxDepth,
3466
- min:
3467
- options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
3468
- plugins:
3469
- options && options.plugins !== undefined
3470
- ? options.plugins
3471
- : DEFAULT_OPTIONS.plugins,
3472
- printBasicPrototype:
3473
- (_options$printBasicPr =
3474
- options === null || options === void 0
3475
- ? void 0
3476
- : options.printBasicPrototype) !== null &&
3477
- _options$printBasicPr !== void 0
3478
- ? _options$printBasicPr
3479
- : true,
3480
- printFunctionName: getPrintFunctionName(options),
3481
- spacingInner: options && options.min ? ' ' : '\n',
3482
- spacingOuter: options && options.min ? '' : '\n'
3483
- };
3484
- };
3485
-
3486
- function createIndent(indent) {
3487
- return new Array(indent + 1).join(' ');
3488
- }
3489
- /**
3490
- * Returns a presentation string of your `val` object
3491
- * @param val any potential JavaScript object
3492
- * @param options Custom settings
3493
- */
3494
-
3495
- function format(val, options) {
3496
- if (options) {
3497
- validateOptions(options);
3498
-
3499
- if (options.plugins) {
3500
- const plugin = findPlugin(options.plugins, val);
3501
-
3502
- if (plugin !== null) {
3503
- return printPlugin(plugin, val, getConfig(options), '', 0, []);
3504
- }
3505
- }
3506
- }
3507
-
3508
- const basicResult = printBasicValue(
3509
- val,
3510
- getPrintFunctionName(options),
3511
- getEscapeRegex(options),
3512
- getEscapeString(options)
3513
- );
3514
-
3515
- if (basicResult !== null) {
3516
- return basicResult;
3517
- }
3518
-
3519
- return printComplexValue(val, getConfig(options), '', 0, []);
3520
- }
3521
-
3522
- const plugins = {
3523
- AsymmetricMatcher: _AsymmetricMatcher.default,
3524
- ConvertAnsi: _ConvertAnsi.default,
3525
- DOMCollection: _DOMCollection.default,
3526
- DOMElement: _DOMElement.default,
3527
- Immutable: _Immutable.default,
3528
- ReactElement: _ReactElement.default,
3529
- ReactTestComponent: _ReactTestComponent.default
3530
- };
3531
- plugins_1 = build.plugins = plugins;
3532
- var _default = format;
3533
- build.default = _default;
3534
-
3535
- const {
3536
- AsymmetricMatcher,
3537
- DOMCollection,
3538
- DOMElement,
3539
- Immutable,
3540
- ReactElement,
3541
- ReactTestComponent
3542
- } = plugins_1;
3543
- const PLUGINS = [
3544
- ReactTestComponent,
3545
- ReactElement,
3546
- DOMElement,
3547
- DOMCollection,
3548
- Immutable,
3549
- AsymmetricMatcher
3550
- ];
3551
- function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
3552
- const MAX_LENGTH = maxLength ?? 1e4;
3553
- let result;
3554
- try {
3555
- result = format_1(object, {
3556
- maxDepth,
3557
- escapeString: false,
3558
- plugins: PLUGINS,
3559
- ...options
3560
- });
3561
- } catch {
3562
- result = format_1(object, {
3563
- callToJSON: false,
3564
- maxDepth,
3565
- escapeString: false,
3566
- plugins: PLUGINS,
3567
- ...options
3568
- });
3569
- }
3570
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
3571
- }
3572
-
3573
- export { stringify as a, safeClearTimeout as b, createPatch as c, ansiStyles$1 as d, eastAsianWidth as e, format_1 as f, safeSetInterval as g, safeClearInterval as h, plugins_1 as p, safeSetTimeout as s };