massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prettier / index.js
1 'use strict';
2
3 var require$$0$6 = require('fs');
4 var require$$0$8 = require('path');
5 var require$$0$7 = require('os');
6 var require$$1$3 = require('tty');
7 var require$$0$9 = require('assert');
8 var require$$0$a = require('util');
9 var require$$0$b = require('stream');
10 var require$$0$c = require('events');
11
12 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
14 var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$6);
15 var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$8);
16 var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
17 var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1$3);
18 var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$9);
19 var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$a);
20 var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$b);
21 var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$c);
22
23 function getDefaultExportFromNamespaceIfPresent (n) {
24         return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
25 }
26
27 var require$$0$5 = require("./package.json");
28
29 var lib$6 = {};
30
31 var base$1 = {};
32
33 /*istanbul ignore start*/
34
35 (function (exports) {
36
37   Object.defineProperty(exports, "__esModule", {
38     value: true
39   });
40   exports["default"] = Diff;
41   /*istanbul ignore end*/
42
43   function Diff() {}
44
45   Diff.prototype = {
46     /*istanbul ignore start*/
47
48     /*istanbul ignore end*/
49     diff: function diff(oldString, newString) {
50       /*istanbul ignore start*/
51       var
52       /*istanbul ignore end*/
53       options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
54       var callback = options.callback;
55
56       if (typeof options === 'function') {
57         callback = options;
58         options = {};
59       }
60
61       this.options = options;
62       var self = this;
63
64       function done(value) {
65         if (callback) {
66           setTimeout(function () {
67             callback(undefined, value);
68           }, 0);
69           return true;
70         } else {
71           return value;
72         }
73       } // Allow subclasses to massage the input prior to running
74
75
76       oldString = this.castInput(oldString);
77       newString = this.castInput(newString);
78       oldString = this.removeEmpty(this.tokenize(oldString));
79       newString = this.removeEmpty(this.tokenize(newString));
80       var newLen = newString.length,
81           oldLen = oldString.length;
82       var editLength = 1;
83       var maxEditLength = newLen + oldLen;
84       var bestPath = [{
85         newPos: -1,
86         components: []
87       }]; // Seed editLength = 0, i.e. the content starts with the same values
88
89       var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
90
91       if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
92         // Identity per the equality and tokenizer
93         return done([{
94           value: this.join(newString),
95           count: newString.length
96         }]);
97       } // Main worker method. checks all permutations of a given edit length for acceptance.
98
99
100       function execEditLength() {
101         for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
102           var basePath =
103           /*istanbul ignore start*/
104           void 0
105           /*istanbul ignore end*/
106           ;
107
108           var addPath = bestPath[diagonalPath - 1],
109               removePath = bestPath[diagonalPath + 1],
110               _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
111
112           if (addPath) {
113             // No one else is going to attempt to use this value, clear it
114             bestPath[diagonalPath - 1] = undefined;
115           }
116
117           var canAdd = addPath && addPath.newPos + 1 < newLen,
118               canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
119
120           if (!canAdd && !canRemove) {
121             // If this path is a terminal then prune
122             bestPath[diagonalPath] = undefined;
123             continue;
124           } // Select the diagonal that we want to branch from. We select the prior
125           // path whose position in the new string is the farthest from the origin
126           // and does not pass the bounds of the diff graph
127
128
129           if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
130             basePath = clonePath(removePath);
131             self.pushComponent(basePath.components, undefined, true);
132           } else {
133             basePath = addPath; // No need to clone, we've pulled it from the list
134
135             basePath.newPos++;
136             self.pushComponent(basePath.components, true, undefined);
137           }
138
139           _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
140
141           if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
142             return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
143           } else {
144             // Otherwise track this path as a potential candidate and continue.
145             bestPath[diagonalPath] = basePath;
146           }
147         }
148
149         editLength++;
150       } // Performs the length of edit iteration. Is a bit fugly as this has to support the
151       // sync and async mode which is never fun. Loops over execEditLength until a value
152       // is produced.
153
154
155       if (callback) {
156         (function exec() {
157           setTimeout(function () {
158             // This should not happen, but we want to be safe.
159
160             /* istanbul ignore next */
161             if (editLength > maxEditLength) {
162               return callback();
163             }
164
165             if (!execEditLength()) {
166               exec();
167             }
168           }, 0);
169         })();
170       } else {
171         while (editLength <= maxEditLength) {
172           var ret = execEditLength();
173
174           if (ret) {
175             return ret;
176           }
177         }
178       }
179     },
180
181     /*istanbul ignore start*/
182
183     /*istanbul ignore end*/
184     pushComponent: function pushComponent(components, added, removed) {
185       var last = components[components.length - 1];
186
187       if (last && last.added === added && last.removed === removed) {
188         // We need to clone here as the component clone operation is just
189         // as shallow array clone
190         components[components.length - 1] = {
191           count: last.count + 1,
192           added: added,
193           removed: removed
194         };
195       } else {
196         components.push({
197           count: 1,
198           added: added,
199           removed: removed
200         });
201       }
202     },
203
204     /*istanbul ignore start*/
205
206     /*istanbul ignore end*/
207     extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
208       var newLen = newString.length,
209           oldLen = oldString.length,
210           newPos = basePath.newPos,
211           oldPos = newPos - diagonalPath,
212           commonCount = 0;
213
214       while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
215         newPos++;
216         oldPos++;
217         commonCount++;
218       }
219
220       if (commonCount) {
221         basePath.components.push({
222           count: commonCount
223         });
224       }
225
226       basePath.newPos = newPos;
227       return oldPos;
228     },
229
230     /*istanbul ignore start*/
231
232     /*istanbul ignore end*/
233     equals: function equals(left, right) {
234       if (this.options.comparator) {
235         return this.options.comparator(left, right);
236       } else {
237         return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
238       }
239     },
240
241     /*istanbul ignore start*/
242
243     /*istanbul ignore end*/
244     removeEmpty: function removeEmpty(array) {
245       var ret = [];
246
247       for (var i = 0; i < array.length; i++) {
248         if (array[i]) {
249           ret.push(array[i]);
250         }
251       }
252
253       return ret;
254     },
255
256     /*istanbul ignore start*/
257
258     /*istanbul ignore end*/
259     castInput: function castInput(value) {
260       return value;
261     },
262
263     /*istanbul ignore start*/
264
265     /*istanbul ignore end*/
266     tokenize: function tokenize(value) {
267       return value.split('');
268     },
269
270     /*istanbul ignore start*/
271
272     /*istanbul ignore end*/
273     join: function join(chars) {
274       return chars.join('');
275     }
276   };
277
278   function buildValues(diff, components, newString, oldString, useLongestToken) {
279     var componentPos = 0,
280         componentLen = components.length,
281         newPos = 0,
282         oldPos = 0;
283
284     for (; componentPos < componentLen; componentPos++) {
285       var component = components[componentPos];
286
287       if (!component.removed) {
288         if (!component.added && useLongestToken) {
289           var value = newString.slice(newPos, newPos + component.count);
290           value = value.map(function (value, i) {
291             var oldValue = oldString[oldPos + i];
292             return oldValue.length > value.length ? oldValue : value;
293           });
294           component.value = diff.join(value);
295         } else {
296           component.value = diff.join(newString.slice(newPos, newPos + component.count));
297         }
298
299         newPos += component.count; // Common case
300
301         if (!component.added) {
302           oldPos += component.count;
303         }
304       } else {
305         component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
306         oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
307         // The diffing algorithm is tied to add then remove output and this is the simplest
308         // route to get the desired output with minimal overhead.
309
310         if (componentPos && components[componentPos - 1].added) {
311           var tmp = components[componentPos - 1];
312           components[componentPos - 1] = components[componentPos];
313           components[componentPos] = tmp;
314         }
315       }
316     } // Special case handle for when one terminal is ignored (i.e. whitespace).
317     // For this case we merge the terminal into the prior string and drop the change.
318     // This is only available for string mode.
319
320
321     var lastComponent = components[componentLen - 1];
322
323     if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
324       components[componentLen - 2].value += lastComponent.value;
325       components.pop();
326     }
327
328     return components;
329   }
330
331   function clonePath(path) {
332     return {
333       newPos: path.newPos,
334       components: path.components.slice(0)
335     };
336   }
337 })(base$1);
338
339 var character = {};
340
341 /*istanbul ignore start*/
342
343 Object.defineProperty(character, "__esModule", {
344   value: true
345 });
346 character.diffChars = diffChars;
347 character.characterDiff = void 0;
348 /*istanbul ignore end*/
349
350 var
351 /*istanbul ignore start*/
352 _base$6 = _interopRequireDefault$8(base$1)
353 /*istanbul ignore end*/
354 ;
355 /*istanbul ignore start*/
356
357
358 function _interopRequireDefault$8(obj) {
359   return obj && obj.__esModule ? obj : {
360     "default": obj
361   };
362 }
363 /*istanbul ignore end*/
364
365
366 var characterDiff = new
367 /*istanbul ignore start*/
368 _base$6
369 /*istanbul ignore end*/
370 [
371 /*istanbul ignore start*/
372 "default"
373 /*istanbul ignore end*/
374 ]();
375 /*istanbul ignore start*/
376
377 character.characterDiff = characterDiff;
378 /*istanbul ignore end*/
379
380 function diffChars(oldStr, newStr, options) {
381   return characterDiff.diff(oldStr, newStr, options);
382 }
383
384 var word = {};
385
386 var params = {};
387
388 /*istanbul ignore start*/
389
390 Object.defineProperty(params, "__esModule", {
391   value: true
392 });
393 params.generateOptions = generateOptions;
394 /*istanbul ignore end*/
395
396 function generateOptions(options, defaults) {
397   if (typeof options === 'function') {
398     defaults.callback = options;
399   } else if (options) {
400     for (var name in options) {
401       /* istanbul ignore else */
402       if (options.hasOwnProperty(name)) {
403         defaults[name] = options[name];
404       }
405     }
406   }
407
408   return defaults;
409 }
410
411 /*istanbul ignore start*/
412
413 Object.defineProperty(word, "__esModule", {
414   value: true
415 });
416 word.diffWords = diffWords;
417 word.diffWordsWithSpace = diffWordsWithSpace;
418 word.wordDiff = void 0;
419 /*istanbul ignore end*/
420
421 var
422 /*istanbul ignore start*/
423 _base$5 = _interopRequireDefault$7(base$1)
424 /*istanbul ignore end*/
425 ;
426
427 var
428 /*istanbul ignore start*/
429 _params$1 = params
430 /*istanbul ignore end*/
431 ;
432 /*istanbul ignore start*/
433
434 function _interopRequireDefault$7(obj) {
435   return obj && obj.__esModule ? obj : {
436     "default": obj
437   };
438 }
439 /*istanbul ignore end*/
440 // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
441 //
442 // Ranges and exceptions:
443 // Latin-1 Supplement, 0080–00FF
444 //  - U+00D7  × Multiplication sign
445 //  - U+00F7  ÷ Division sign
446 // Latin Extended-A, 0100–017F
447 // Latin Extended-B, 0180–024F
448 // IPA Extensions, 0250–02AF
449 // Spacing Modifier Letters, 02B0–02FF
450 //  - U+02C7  ˇ &#711;  Caron
451 //  - U+02D8  ˘ &#728;  Breve
452 //  - U+02D9  ˙ &#729;  Dot Above
453 //  - U+02DA  ˚ &#730;  Ring Above
454 //  - U+02DB  ˛ &#731;  Ogonek
455 //  - U+02DC  ˜ &#732;  Small Tilde
456 //  - U+02DD  ˝ &#733;  Double Acute Accent
457 // Latin Extended Additional, 1E00–1EFF
458
459
460 var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
461 var reWhitespace = /\S/;
462 var wordDiff = new
463 /*istanbul ignore start*/
464 _base$5
465 /*istanbul ignore end*/
466 [
467 /*istanbul ignore start*/
468 "default"
469 /*istanbul ignore end*/
470 ]();
471 /*istanbul ignore start*/
472
473 word.wordDiff = wordDiff;
474 /*istanbul ignore end*/
475
476 wordDiff.equals = function (left, right) {
477   if (this.options.ignoreCase) {
478     left = left.toLowerCase();
479     right = right.toLowerCase();
480   }
481
482   return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
483 };
484
485 wordDiff.tokenize = function (value) {
486   // All whitespace symbols except newline group into one token, each newline - in separate token
487   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.
488
489   for (var i = 0; i < tokens.length - 1; i++) {
490     // If we have an empty string in the next field and we have only word chars before and after, merge
491     if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
492       tokens[i] += tokens[i + 2];
493       tokens.splice(i + 1, 2);
494       i--;
495     }
496   }
497
498   return tokens;
499 };
500
501 function diffWords(oldStr, newStr, options) {
502   options =
503   /*istanbul ignore start*/
504   (/*istanbul ignore end*/
505
506   /*istanbul ignore start*/
507   0, _params$1
508   /*istanbul ignore end*/
509   .
510   /*istanbul ignore start*/
511   generateOptions
512   /*istanbul ignore end*/
513   )(options, {
514     ignoreWhitespace: true
515   });
516   return wordDiff.diff(oldStr, newStr, options);
517 }
518
519 function diffWordsWithSpace(oldStr, newStr, options) {
520   return wordDiff.diff(oldStr, newStr, options);
521 }
522
523 var line$B = {};
524
525 /*istanbul ignore start*/
526
527 Object.defineProperty(line$B, "__esModule", {
528   value: true
529 });
530 line$B.diffLines = diffLines;
531 line$B.diffTrimmedLines = diffTrimmedLines;
532 line$B.lineDiff = void 0;
533 /*istanbul ignore end*/
534
535 var
536 /*istanbul ignore start*/
537 _base$4 = _interopRequireDefault$6(base$1)
538 /*istanbul ignore end*/
539 ;
540
541 var
542 /*istanbul ignore start*/
543 _params = params
544 /*istanbul ignore end*/
545 ;
546 /*istanbul ignore start*/
547
548 function _interopRequireDefault$6(obj) {
549   return obj && obj.__esModule ? obj : {
550     "default": obj
551   };
552 }
553 /*istanbul ignore end*/
554
555
556 var lineDiff = new
557 /*istanbul ignore start*/
558 _base$4
559 /*istanbul ignore end*/
560 [
561 /*istanbul ignore start*/
562 "default"
563 /*istanbul ignore end*/
564 ]();
565 /*istanbul ignore start*/
566
567 line$B.lineDiff = lineDiff;
568 /*istanbul ignore end*/
569
570 lineDiff.tokenize = function (value) {
571   var retLines = [],
572       linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
573
574   if (!linesAndNewlines[linesAndNewlines.length - 1]) {
575     linesAndNewlines.pop();
576   } // Merge the content and line separators into single tokens
577
578
579   for (var i = 0; i < linesAndNewlines.length; i++) {
580     var line = linesAndNewlines[i];
581
582     if (i % 2 && !this.options.newlineIsToken) {
583       retLines[retLines.length - 1] += line;
584     } else {
585       if (this.options.ignoreWhitespace) {
586         line = line.trim();
587       }
588
589       retLines.push(line);
590     }
591   }
592
593   return retLines;
594 };
595
596 function diffLines(oldStr, newStr, callback) {
597   return lineDiff.diff(oldStr, newStr, callback);
598 }
599
600 function diffTrimmedLines(oldStr, newStr, callback) {
601   var options =
602   /*istanbul ignore start*/
603   (/*istanbul ignore end*/
604
605   /*istanbul ignore start*/
606   0, _params
607   /*istanbul ignore end*/
608   .
609   /*istanbul ignore start*/
610   generateOptions
611   /*istanbul ignore end*/
612   )(callback, {
613     ignoreWhitespace: true
614   });
615   return lineDiff.diff(oldStr, newStr, options);
616 }
617
618 var sentence = {};
619
620 /*istanbul ignore start*/
621
622 Object.defineProperty(sentence, "__esModule", {
623   value: true
624 });
625 sentence.diffSentences = diffSentences;
626 sentence.sentenceDiff = void 0;
627 /*istanbul ignore end*/
628
629 var
630 /*istanbul ignore start*/
631 _base$3 = _interopRequireDefault$5(base$1)
632 /*istanbul ignore end*/
633 ;
634 /*istanbul ignore start*/
635
636
637 function _interopRequireDefault$5(obj) {
638   return obj && obj.__esModule ? obj : {
639     "default": obj
640   };
641 }
642 /*istanbul ignore end*/
643
644
645 var sentenceDiff = new
646 /*istanbul ignore start*/
647 _base$3
648 /*istanbul ignore end*/
649 [
650 /*istanbul ignore start*/
651 "default"
652 /*istanbul ignore end*/
653 ]();
654 /*istanbul ignore start*/
655
656 sentence.sentenceDiff = sentenceDiff;
657 /*istanbul ignore end*/
658
659 sentenceDiff.tokenize = function (value) {
660   return value.split(/(\S.+?[.!?])(?=\s+|$)/);
661 };
662
663 function diffSentences(oldStr, newStr, callback) {
664   return sentenceDiff.diff(oldStr, newStr, callback);
665 }
666
667 var css$1 = {};
668
669 /*istanbul ignore start*/
670
671 Object.defineProperty(css$1, "__esModule", {
672   value: true
673 });
674 css$1.diffCss = diffCss;
675 css$1.cssDiff = void 0;
676 /*istanbul ignore end*/
677
678 var
679 /*istanbul ignore start*/
680 _base$2 = _interopRequireDefault$4(base$1)
681 /*istanbul ignore end*/
682 ;
683 /*istanbul ignore start*/
684
685
686 function _interopRequireDefault$4(obj) {
687   return obj && obj.__esModule ? obj : {
688     "default": obj
689   };
690 }
691 /*istanbul ignore end*/
692
693
694 var cssDiff = new
695 /*istanbul ignore start*/
696 _base$2
697 /*istanbul ignore end*/
698 [
699 /*istanbul ignore start*/
700 "default"
701 /*istanbul ignore end*/
702 ]();
703 /*istanbul ignore start*/
704
705 css$1.cssDiff = cssDiff;
706 /*istanbul ignore end*/
707
708 cssDiff.tokenize = function (value) {
709   return value.split(/([{}:;,]|\s+)/);
710 };
711
712 function diffCss(oldStr, newStr, callback) {
713   return cssDiff.diff(oldStr, newStr, callback);
714 }
715
716 var check = function (it) {
717   return it && it.Math == Math && it;
718 };
719
720 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
721 var global$s =
722   // eslint-disable-next-line es/no-global-this -- safe
723   check(typeof globalThis == 'object' && globalThis) ||
724   check(typeof window == 'object' && window) ||
725   // eslint-disable-next-line no-restricted-globals -- safe
726   check(typeof self == 'object' && self) ||
727   check(typeof global$s == 'object' && global$s) ||
728   // eslint-disable-next-line no-new-func -- fallback
729   (function () { return this; })() || Function('return this')();
730
731 var objectGetOwnPropertyDescriptor = {};
732
733 var fails$8 = function (exec) {
734   try {
735     return !!exec();
736   } catch (error) {
737     return true;
738   }
739 };
740
741 var fails$7 = fails$8;
742
743 // Detect IE8's incomplete defineProperty implementation
744 var descriptors$1 = !fails$7(function () {
745   // eslint-disable-next-line es/no-object-defineproperty -- required for testing
746   return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
747 });
748
749 var call$7 = Function.prototype.call;
750
751 var functionCall = call$7.bind ? call$7.bind(call$7) : function () {
752   return call$7.apply(call$7, arguments);
753 };
754
755 var objectPropertyIsEnumerable = {};
756
757 var $propertyIsEnumerable = {}.propertyIsEnumerable;
758 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
759 var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
760
761 // Nashorn ~ JDK8 bug
762 var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
763
764 // `Object.prototype.propertyIsEnumerable` method implementation
765 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
766 objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
767   var descriptor = getOwnPropertyDescriptor$1(this, V);
768   return !!descriptor && descriptor.enumerable;
769 } : $propertyIsEnumerable;
770
771 var createPropertyDescriptor$3 = function (bitmap, value) {
772   return {
773     enumerable: !(bitmap & 1),
774     configurable: !(bitmap & 2),
775     writable: !(bitmap & 4),
776     value: value
777   };
778 };
779
780 var FunctionPrototype$1 = Function.prototype;
781 var bind$4 = FunctionPrototype$1.bind;
782 var call$6 = FunctionPrototype$1.call;
783 var callBind = bind$4 && bind$4.bind(call$6);
784
785 var functionUncurryThis = bind$4 ? function (fn) {
786   return fn && callBind(call$6, fn);
787 } : function (fn) {
788   return fn && function () {
789     return call$6.apply(fn, arguments);
790   };
791 };
792
793 var uncurryThis$c = functionUncurryThis;
794
795 var toString$5 = uncurryThis$c({}.toString);
796 var stringSlice = uncurryThis$c(''.slice);
797
798 var classofRaw$1 = function (it) {
799   return stringSlice(toString$5(it), 8, -1);
800 };
801
802 var global$r = global$s;
803 var uncurryThis$b = functionUncurryThis;
804 var fails$6 = fails$8;
805 var classof$5 = classofRaw$1;
806
807 var Object$4 = global$r.Object;
808 var split = uncurryThis$b(''.split);
809
810 // fallback for non-array-like ES3 and non-enumerable old V8 strings
811 var indexedObject = fails$6(function () {
812   // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
813   // eslint-disable-next-line no-prototype-builtins -- safe
814   return !Object$4('z').propertyIsEnumerable(0);
815 }) ? function (it) {
816   return classof$5(it) == 'String' ? split(it, '') : Object$4(it);
817 } : Object$4;
818
819 var global$q = global$s;
820
821 var TypeError$a = global$q.TypeError;
822
823 // `RequireObjectCoercible` abstract operation
824 // https://tc39.es/ecma262/#sec-requireobjectcoercible
825 var requireObjectCoercible$2 = function (it) {
826   if (it == undefined) throw TypeError$a("Can't call method on " + it);
827   return it;
828 };
829
830 // toObject with fallback for non-array-like ES3 strings
831 var IndexedObject = indexedObject;
832 var requireObjectCoercible$1 = requireObjectCoercible$2;
833
834 var toIndexedObject$4 = function (it) {
835   return IndexedObject(requireObjectCoercible$1(it));
836 };
837
838 // `IsCallable` abstract operation
839 // https://tc39.es/ecma262/#sec-iscallable
840 var isCallable$b = function (argument) {
841   return typeof argument == 'function';
842 };
843
844 var isCallable$a = isCallable$b;
845
846 var isObject$c = function (it) {
847   return typeof it == 'object' ? it !== null : isCallable$a(it);
848 };
849
850 var global$p = global$s;
851 var isCallable$9 = isCallable$b;
852
853 var aFunction = function (argument) {
854   return isCallable$9(argument) ? argument : undefined;
855 };
856
857 var getBuiltIn$5 = function (namespace, method) {
858   return arguments.length < 2 ? aFunction(global$p[namespace]) : global$p[namespace] && global$p[namespace][method];
859 };
860
861 var uncurryThis$a = functionUncurryThis;
862
863 var objectIsPrototypeOf = uncurryThis$a({}.isPrototypeOf);
864
865 var getBuiltIn$4 = getBuiltIn$5;
866
867 var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
868
869 var global$o = global$s;
870 var userAgent$2 = engineUserAgent;
871
872 var process$3 = global$o.process;
873 var Deno = global$o.Deno;
874 var versions = process$3 && process$3.versions || Deno && Deno.version;
875 var v8$2 = versions && versions.v8;
876 var match$1, version$2;
877
878 if (v8$2) {
879   match$1 = v8$2.split('.');
880   // in old Chrome, versions of V8 isn't V8 = Chrome / 10
881   // but their correct versions are not interesting for us
882   version$2 = match$1[0] > 0 && match$1[0] < 4 ? 1 : +(match$1[0] + match$1[1]);
883 }
884
885 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
886 // so check `userAgent` even if `.v8` exists, but 0
887 if (!version$2 && userAgent$2) {
888   match$1 = userAgent$2.match(/Edge\/(\d+)/);
889   if (!match$1 || match$1[1] >= 74) {
890     match$1 = userAgent$2.match(/Chrome\/(\d+)/);
891     if (match$1) version$2 = +match$1[1];
892   }
893 }
894
895 var engineV8Version = version$2;
896
897 /* eslint-disable es/no-symbol -- required for testing */
898
899 var V8_VERSION = engineV8Version;
900 var fails$5 = fails$8;
901
902 // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
903 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
904   var symbol = Symbol();
905   // Chrome 38 Symbol has incorrect toString conversion
906   // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
907   return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
908     // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
909     !Symbol.sham && V8_VERSION && V8_VERSION < 41;
910 });
911
912 /* eslint-disable es/no-symbol -- required for testing */
913
914 var NATIVE_SYMBOL$1 = nativeSymbol;
915
916 var useSymbolAsUid = NATIVE_SYMBOL$1
917   && !Symbol.sham
918   && typeof Symbol.iterator == 'symbol';
919
920 var global$n = global$s;
921 var getBuiltIn$3 = getBuiltIn$5;
922 var isCallable$8 = isCallable$b;
923 var isPrototypeOf$1 = objectIsPrototypeOf;
924 var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
925
926 var Object$3 = global$n.Object;
927
928 var isSymbol$6 = USE_SYMBOL_AS_UID$1 ? function (it) {
929   return typeof it == 'symbol';
930 } : function (it) {
931   var $Symbol = getBuiltIn$3('Symbol');
932   return isCallable$8($Symbol) && isPrototypeOf$1($Symbol.prototype, Object$3(it));
933 };
934
935 var global$m = global$s;
936
937 var String$3 = global$m.String;
938
939 var tryToString$3 = function (argument) {
940   try {
941     return String$3(argument);
942   } catch (error) {
943     return 'Object';
944   }
945 };
946
947 var global$l = global$s;
948 var isCallable$7 = isCallable$b;
949 var tryToString$2 = tryToString$3;
950
951 var TypeError$9 = global$l.TypeError;
952
953 // `Assert: IsCallable(argument) is true`
954 var aCallable$5 = function (argument) {
955   if (isCallable$7(argument)) return argument;
956   throw TypeError$9(tryToString$2(argument) + ' is not a function');
957 };
958
959 var aCallable$4 = aCallable$5;
960
961 // `GetMethod` abstract operation
962 // https://tc39.es/ecma262/#sec-getmethod
963 var getMethod$3 = function (V, P) {
964   var func = V[P];
965   return func == null ? undefined : aCallable$4(func);
966 };
967
968 var global$k = global$s;
969 var call$5 = functionCall;
970 var isCallable$6 = isCallable$b;
971 var isObject$b = isObject$c;
972
973 var TypeError$8 = global$k.TypeError;
974
975 // `OrdinaryToPrimitive` abstract operation
976 // https://tc39.es/ecma262/#sec-ordinarytoprimitive
977 var ordinaryToPrimitive$1 = function (input, pref) {
978   var fn, val;
979   if (pref === 'string' && isCallable$6(fn = input.toString) && !isObject$b(val = call$5(fn, input))) return val;
980   if (isCallable$6(fn = input.valueOf) && !isObject$b(val = call$5(fn, input))) return val;
981   if (pref !== 'string' && isCallable$6(fn = input.toString) && !isObject$b(val = call$5(fn, input))) return val;
982   throw TypeError$8("Can't convert object to primitive value");
983 };
984
985 var shared$3 = {exports: {}};
986
987 var global$j = global$s;
988
989 // eslint-disable-next-line es/no-object-defineproperty -- safe
990 var defineProperty$1 = Object.defineProperty;
991
992 var setGlobal$3 = function (key, value) {
993   try {
994     defineProperty$1(global$j, key, { value: value, configurable: true, writable: true });
995   } catch (error) {
996     global$j[key] = value;
997   } return value;
998 };
999
1000 var global$i = global$s;
1001 var setGlobal$2 = setGlobal$3;
1002
1003 var SHARED = '__core-js_shared__';
1004 var store$3 = global$i[SHARED] || setGlobal$2(SHARED, {});
1005
1006 var sharedStore = store$3;
1007
1008 var store$2 = sharedStore;
1009
1010 (shared$3.exports = function (key, value) {
1011   return store$2[key] || (store$2[key] = value !== undefined ? value : {});
1012 })('versions', []).push({
1013   version: '3.19.1',
1014   mode: 'global',
1015   copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
1016 });
1017
1018 var global$h = global$s;
1019 var requireObjectCoercible = requireObjectCoercible$2;
1020
1021 var Object$2 = global$h.Object;
1022
1023 // `ToObject` abstract operation
1024 // https://tc39.es/ecma262/#sec-toobject
1025 var toObject$4 = function (argument) {
1026   return Object$2(requireObjectCoercible(argument));
1027 };
1028
1029 var uncurryThis$9 = functionUncurryThis;
1030 var toObject$3 = toObject$4;
1031
1032 var hasOwnProperty$b = uncurryThis$9({}.hasOwnProperty);
1033
1034 // `HasOwnProperty` abstract operation
1035 // https://tc39.es/ecma262/#sec-hasownproperty
1036 var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
1037   return hasOwnProperty$b(toObject$3(it), key);
1038 };
1039
1040 var uncurryThis$8 = functionUncurryThis;
1041
1042 var id = 0;
1043 var postfix = Math.random();
1044 var toString$4 = uncurryThis$8(1.0.toString);
1045
1046 var uid$3 = function (key) {
1047   return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36);
1048 };
1049
1050 var global$g = global$s;
1051 var shared$2 = shared$3.exports;
1052 var hasOwn$6 = hasOwnProperty_1;
1053 var uid$2 = uid$3;
1054 var NATIVE_SYMBOL = nativeSymbol;
1055 var USE_SYMBOL_AS_UID = useSymbolAsUid;
1056
1057 var WellKnownSymbolsStore = shared$2('wks');
1058 var Symbol$6 = global$g.Symbol;
1059 var symbolFor = Symbol$6 && Symbol$6['for'];
1060 var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$6 : Symbol$6 && Symbol$6.withoutSetter || uid$2;
1061
1062 var wellKnownSymbol$7 = function (name) {
1063   if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
1064     var description = 'Symbol.' + name;
1065     if (NATIVE_SYMBOL && hasOwn$6(Symbol$6, name)) {
1066       WellKnownSymbolsStore[name] = Symbol$6[name];
1067     } else if (USE_SYMBOL_AS_UID && symbolFor) {
1068       WellKnownSymbolsStore[name] = symbolFor(description);
1069     } else {
1070       WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
1071     }
1072   } return WellKnownSymbolsStore[name];
1073 };
1074
1075 var global$f = global$s;
1076 var call$4 = functionCall;
1077 var isObject$a = isObject$c;
1078 var isSymbol$5 = isSymbol$6;
1079 var getMethod$2 = getMethod$3;
1080 var ordinaryToPrimitive = ordinaryToPrimitive$1;
1081 var wellKnownSymbol$6 = wellKnownSymbol$7;
1082
1083 var TypeError$7 = global$f.TypeError;
1084 var TO_PRIMITIVE = wellKnownSymbol$6('toPrimitive');
1085
1086 // `ToPrimitive` abstract operation
1087 // https://tc39.es/ecma262/#sec-toprimitive
1088 var toPrimitive$1 = function (input, pref) {
1089   if (!isObject$a(input) || isSymbol$5(input)) return input;
1090   var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
1091   var result;
1092   if (exoticToPrim) {
1093     if (pref === undefined) pref = 'default';
1094     result = call$4(exoticToPrim, input, pref);
1095     if (!isObject$a(result) || isSymbol$5(result)) return result;
1096     throw TypeError$7("Can't convert object to primitive value");
1097   }
1098   if (pref === undefined) pref = 'number';
1099   return ordinaryToPrimitive(input, pref);
1100 };
1101
1102 var toPrimitive = toPrimitive$1;
1103 var isSymbol$4 = isSymbol$6;
1104
1105 // `ToPropertyKey` abstract operation
1106 // https://tc39.es/ecma262/#sec-topropertykey
1107 var toPropertyKey$3 = function (argument) {
1108   var key = toPrimitive(argument, 'string');
1109   return isSymbol$4(key) ? key : key + '';
1110 };
1111
1112 var global$e = global$s;
1113 var isObject$9 = isObject$c;
1114
1115 var document$1 = global$e.document;
1116 // typeof document.createElement is 'object' in old IE
1117 var EXISTS$1 = isObject$9(document$1) && isObject$9(document$1.createElement);
1118
1119 var documentCreateElement$1 = function (it) {
1120   return EXISTS$1 ? document$1.createElement(it) : {};
1121 };
1122
1123 var DESCRIPTORS$5 = descriptors$1;
1124 var fails$4 = fails$8;
1125 var createElement = documentCreateElement$1;
1126
1127 // Thank's IE8 for his funny defineProperty
1128 var ie8DomDefine = !DESCRIPTORS$5 && !fails$4(function () {
1129   // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
1130   return Object.defineProperty(createElement('div'), 'a', {
1131     get: function () { return 7; }
1132   }).a != 7;
1133 });
1134
1135 var DESCRIPTORS$4 = descriptors$1;
1136 var call$3 = functionCall;
1137 var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1138 var createPropertyDescriptor$2 = createPropertyDescriptor$3;
1139 var toIndexedObject$3 = toIndexedObject$4;
1140 var toPropertyKey$2 = toPropertyKey$3;
1141 var hasOwn$5 = hasOwnProperty_1;
1142 var IE8_DOM_DEFINE$1 = ie8DomDefine;
1143
1144 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1145 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1146
1147 // `Object.getOwnPropertyDescriptor` method
1148 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
1149 objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
1150   O = toIndexedObject$3(O);
1151   P = toPropertyKey$2(P);
1152   if (IE8_DOM_DEFINE$1) try {
1153     return $getOwnPropertyDescriptor(O, P);
1154   } catch (error) { /* empty */ }
1155   if (hasOwn$5(O, P)) return createPropertyDescriptor$2(!call$3(propertyIsEnumerableModule.f, O, P), O[P]);
1156 };
1157
1158 var objectDefineProperty = {};
1159
1160 var global$d = global$s;
1161 var isObject$8 = isObject$c;
1162
1163 var String$2 = global$d.String;
1164 var TypeError$6 = global$d.TypeError;
1165
1166 // `Assert: Type(argument) is Object`
1167 var anObject$7 = function (argument) {
1168   if (isObject$8(argument)) return argument;
1169   throw TypeError$6(String$2(argument) + ' is not an object');
1170 };
1171
1172 var global$c = global$s;
1173 var DESCRIPTORS$3 = descriptors$1;
1174 var IE8_DOM_DEFINE = ie8DomDefine;
1175 var anObject$6 = anObject$7;
1176 var toPropertyKey$1 = toPropertyKey$3;
1177
1178 var TypeError$5 = global$c.TypeError;
1179 // eslint-disable-next-line es/no-object-defineproperty -- safe
1180 var $defineProperty = Object.defineProperty;
1181
1182 // `Object.defineProperty` method
1183 // https://tc39.es/ecma262/#sec-object.defineproperty
1184 objectDefineProperty.f = DESCRIPTORS$3 ? $defineProperty : function defineProperty(O, P, Attributes) {
1185   anObject$6(O);
1186   P = toPropertyKey$1(P);
1187   anObject$6(Attributes);
1188   if (IE8_DOM_DEFINE) try {
1189     return $defineProperty(O, P, Attributes);
1190   } catch (error) { /* empty */ }
1191   if ('get' in Attributes || 'set' in Attributes) throw TypeError$5('Accessors not supported');
1192   if ('value' in Attributes) O[P] = Attributes.value;
1193   return O;
1194 };
1195
1196 var DESCRIPTORS$2 = descriptors$1;
1197 var definePropertyModule$4 = objectDefineProperty;
1198 var createPropertyDescriptor$1 = createPropertyDescriptor$3;
1199
1200 var createNonEnumerableProperty$3 = DESCRIPTORS$2 ? function (object, key, value) {
1201   return definePropertyModule$4.f(object, key, createPropertyDescriptor$1(1, value));
1202 } : function (object, key, value) {
1203   object[key] = value;
1204   return object;
1205 };
1206
1207 var redefine$1 = {exports: {}};
1208
1209 var uncurryThis$7 = functionUncurryThis;
1210 var isCallable$5 = isCallable$b;
1211 var store$1 = sharedStore;
1212
1213 var functionToString = uncurryThis$7(Function.toString);
1214
1215 // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
1216 if (!isCallable$5(store$1.inspectSource)) {
1217   store$1.inspectSource = function (it) {
1218     return functionToString(it);
1219   };
1220 }
1221
1222 var inspectSource$3 = store$1.inspectSource;
1223
1224 var global$b = global$s;
1225 var isCallable$4 = isCallable$b;
1226 var inspectSource$2 = inspectSource$3;
1227
1228 var WeakMap$4 = global$b.WeakMap;
1229
1230 var nativeWeakMap = isCallable$4(WeakMap$4) && /native code/.test(inspectSource$2(WeakMap$4));
1231
1232 var shared$1 = shared$3.exports;
1233 var uid$1 = uid$3;
1234
1235 var keys$4 = shared$1('keys');
1236
1237 var sharedKey$2 = function (key) {
1238   return keys$4[key] || (keys$4[key] = uid$1(key));
1239 };
1240
1241 var hiddenKeys$4 = {};
1242
1243 var NATIVE_WEAK_MAP = nativeWeakMap;
1244 var global$a = global$s;
1245 var uncurryThis$6 = functionUncurryThis;
1246 var isObject$7 = isObject$c;
1247 var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
1248 var hasOwn$4 = hasOwnProperty_1;
1249 var shared = sharedStore;
1250 var sharedKey$1 = sharedKey$2;
1251 var hiddenKeys$3 = hiddenKeys$4;
1252
1253 var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
1254 var TypeError$4 = global$a.TypeError;
1255 var WeakMap$3 = global$a.WeakMap;
1256 var set$1, get$3, has$1;
1257
1258 var enforce = function (it) {
1259   return has$1(it) ? get$3(it) : set$1(it, {});
1260 };
1261
1262 var getterFor = function (TYPE) {
1263   return function (it) {
1264     var state;
1265     if (!isObject$7(it) || (state = get$3(it)).type !== TYPE) {
1266       throw TypeError$4('Incompatible receiver, ' + TYPE + ' required');
1267     } return state;
1268   };
1269 };
1270
1271 if (NATIVE_WEAK_MAP || shared.state) {
1272   var store = shared.state || (shared.state = new WeakMap$3());
1273   var wmget = uncurryThis$6(store.get);
1274   var wmhas = uncurryThis$6(store.has);
1275   var wmset = uncurryThis$6(store.set);
1276   set$1 = function (it, metadata) {
1277     if (wmhas(store, it)) throw new TypeError$4(OBJECT_ALREADY_INITIALIZED);
1278     metadata.facade = it;
1279     wmset(store, it, metadata);
1280     return metadata;
1281   };
1282   get$3 = function (it) {
1283     return wmget(store, it) || {};
1284   };
1285   has$1 = function (it) {
1286     return wmhas(store, it);
1287   };
1288 } else {
1289   var STATE = sharedKey$1('state');
1290   hiddenKeys$3[STATE] = true;
1291   set$1 = function (it, metadata) {
1292     if (hasOwn$4(it, STATE)) throw new TypeError$4(OBJECT_ALREADY_INITIALIZED);
1293     metadata.facade = it;
1294     createNonEnumerableProperty$2(it, STATE, metadata);
1295     return metadata;
1296   };
1297   get$3 = function (it) {
1298     return hasOwn$4(it, STATE) ? it[STATE] : {};
1299   };
1300   has$1 = function (it) {
1301     return hasOwn$4(it, STATE);
1302   };
1303 }
1304
1305 var internalState = {
1306   set: set$1,
1307   get: get$3,
1308   has: has$1,
1309   enforce: enforce,
1310   getterFor: getterFor
1311 };
1312
1313 var DESCRIPTORS$1 = descriptors$1;
1314 var hasOwn$3 = hasOwnProperty_1;
1315
1316 var FunctionPrototype = Function.prototype;
1317 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1318 var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
1319
1320 var EXISTS = hasOwn$3(FunctionPrototype, 'name');
1321 // additional protection from minified / mangled / dropped function names
1322 var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
1323 var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
1324
1325 var functionName = {
1326   EXISTS: EXISTS,
1327   PROPER: PROPER,
1328   CONFIGURABLE: CONFIGURABLE
1329 };
1330
1331 var global$9 = global$s;
1332 var isCallable$3 = isCallable$b;
1333 var hasOwn$2 = hasOwnProperty_1;
1334 var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
1335 var setGlobal$1 = setGlobal$3;
1336 var inspectSource$1 = inspectSource$3;
1337 var InternalStateModule = internalState;
1338 var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
1339
1340 var getInternalState = InternalStateModule.get;
1341 var enforceInternalState = InternalStateModule.enforce;
1342 var TEMPLATE = String(String).split('String');
1343
1344 (redefine$1.exports = function (O, key, value, options) {
1345   var unsafe = options ? !!options.unsafe : false;
1346   var simple = options ? !!options.enumerable : false;
1347   var noTargetGet = options ? !!options.noTargetGet : false;
1348   var name = options && options.name !== undefined ? options.name : key;
1349   var state;
1350   if (isCallable$3(value)) {
1351     if (String(name).slice(0, 7) === 'Symbol(') {
1352       name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
1353     }
1354     if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
1355       createNonEnumerableProperty$1(value, 'name', name);
1356     }
1357     state = enforceInternalState(value);
1358     if (!state.source) {
1359       state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
1360     }
1361   }
1362   if (O === global$9) {
1363     if (simple) O[key] = value;
1364     else setGlobal$1(key, value);
1365     return;
1366   } else if (!unsafe) {
1367     delete O[key];
1368   } else if (!noTargetGet && O[key]) {
1369     simple = true;
1370   }
1371   if (simple) O[key] = value;
1372   else createNonEnumerableProperty$1(O, key, value);
1373 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
1374 })(Function.prototype, 'toString', function toString() {
1375   return isCallable$3(this) && getInternalState(this).source || inspectSource$1(this);
1376 });
1377
1378 var objectGetOwnPropertyNames = {};
1379
1380 var ceil = Math.ceil;
1381 var floor$1 = Math.floor;
1382
1383 // `ToIntegerOrInfinity` abstract operation
1384 // https://tc39.es/ecma262/#sec-tointegerorinfinity
1385 var toIntegerOrInfinity$3 = function (argument) {
1386   var number = +argument;
1387   // eslint-disable-next-line no-self-compare -- safe
1388   return number !== number || number === 0 ? 0 : (number > 0 ? floor$1 : ceil)(number);
1389 };
1390
1391 var toIntegerOrInfinity$2 = toIntegerOrInfinity$3;
1392
1393 var max = Math.max;
1394 var min$1 = Math.min;
1395
1396 // Helper for a popular repeating case of the spec:
1397 // Let integer be ? ToInteger(index).
1398 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
1399 var toAbsoluteIndex$1 = function (index, length) {
1400   var integer = toIntegerOrInfinity$2(index);
1401   return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
1402 };
1403
1404 var toIntegerOrInfinity$1 = toIntegerOrInfinity$3;
1405
1406 var min = Math.min;
1407
1408 // `ToLength` abstract operation
1409 // https://tc39.es/ecma262/#sec-tolength
1410 var toLength$1 = function (argument) {
1411   return argument > 0 ? min(toIntegerOrInfinity$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
1412 };
1413
1414 var toLength = toLength$1;
1415
1416 // `LengthOfArrayLike` abstract operation
1417 // https://tc39.es/ecma262/#sec-lengthofarraylike
1418 var lengthOfArrayLike$6 = function (obj) {
1419   return toLength(obj.length);
1420 };
1421
1422 var toIndexedObject$2 = toIndexedObject$4;
1423 var toAbsoluteIndex = toAbsoluteIndex$1;
1424 var lengthOfArrayLike$5 = lengthOfArrayLike$6;
1425
1426 // `Array.prototype.{ indexOf, includes }` methods implementation
1427 var createMethod = function (IS_INCLUDES) {
1428   return function ($this, el, fromIndex) {
1429     var O = toIndexedObject$2($this);
1430     var length = lengthOfArrayLike$5(O);
1431     var index = toAbsoluteIndex(fromIndex, length);
1432     var value;
1433     // Array#includes uses SameValueZero equality algorithm
1434     // eslint-disable-next-line no-self-compare -- NaN check
1435     if (IS_INCLUDES && el != el) while (length > index) {
1436       value = O[index++];
1437       // eslint-disable-next-line no-self-compare -- NaN check
1438       if (value != value) return true;
1439     // Array#indexOf ignores holes, Array#includes - not
1440     } else for (;length > index; index++) {
1441       if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
1442     } return !IS_INCLUDES && -1;
1443   };
1444 };
1445
1446 var arrayIncludes$2 = {
1447   // `Array.prototype.includes` method
1448   // https://tc39.es/ecma262/#sec-array.prototype.includes
1449   includes: createMethod(true),
1450   // `Array.prototype.indexOf` method
1451   // https://tc39.es/ecma262/#sec-array.prototype.indexof
1452   indexOf: createMethod(false)
1453 };
1454
1455 var uncurryThis$5 = functionUncurryThis;
1456 var hasOwn$1 = hasOwnProperty_1;
1457 var toIndexedObject$1 = toIndexedObject$4;
1458 var indexOf = arrayIncludes$2.indexOf;
1459 var hiddenKeys$2 = hiddenKeys$4;
1460
1461 var push$3 = uncurryThis$5([].push);
1462
1463 var objectKeysInternal = function (object, names) {
1464   var O = toIndexedObject$1(object);
1465   var i = 0;
1466   var result = [];
1467   var key;
1468   for (key in O) !hasOwn$1(hiddenKeys$2, key) && hasOwn$1(O, key) && push$3(result, key);
1469   // Don't enum bug & hidden keys
1470   while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
1471     ~indexOf(result, key) || push$3(result, key);
1472   }
1473   return result;
1474 };
1475
1476 // IE8- don't enum bug keys
1477 var enumBugKeys$3 = [
1478   'constructor',
1479   'hasOwnProperty',
1480   'isPrototypeOf',
1481   'propertyIsEnumerable',
1482   'toLocaleString',
1483   'toString',
1484   'valueOf'
1485 ];
1486
1487 var internalObjectKeys$1 = objectKeysInternal;
1488 var enumBugKeys$2 = enumBugKeys$3;
1489
1490 var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
1491
1492 // `Object.getOwnPropertyNames` method
1493 // https://tc39.es/ecma262/#sec-object.getownpropertynames
1494 // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1495 objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1496   return internalObjectKeys$1(O, hiddenKeys$1);
1497 };
1498
1499 var objectGetOwnPropertySymbols = {};
1500
1501 // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1502 objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1503
1504 var getBuiltIn$2 = getBuiltIn$5;
1505 var uncurryThis$4 = functionUncurryThis;
1506 var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1507 var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1508 var anObject$5 = anObject$7;
1509
1510 var concat = uncurryThis$4([].concat);
1511
1512 // all object keys, includes non-enumerable and symbols
1513 var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
1514   var keys = getOwnPropertyNamesModule.f(anObject$5(it));
1515   var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1516   return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
1517 };
1518
1519 var hasOwn = hasOwnProperty_1;
1520 var ownKeys = ownKeys$1;
1521 var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1522 var definePropertyModule$3 = objectDefineProperty;
1523
1524 var copyConstructorProperties$1 = function (target, source) {
1525   var keys = ownKeys(source);
1526   var defineProperty = definePropertyModule$3.f;
1527   var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1528   for (var i = 0; i < keys.length; i++) {
1529     var key = keys[i];
1530     if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1531   }
1532 };
1533
1534 var fails$3 = fails$8;
1535 var isCallable$2 = isCallable$b;
1536
1537 var replacement = /#|\.prototype\./;
1538
1539 var isForced$1 = function (feature, detection) {
1540   var value = data$3[normalize$3(feature)];
1541   return value == POLYFILL ? true
1542     : value == NATIVE ? false
1543     : isCallable$2(detection) ? fails$3(detection)
1544     : !!detection;
1545 };
1546
1547 var normalize$3 = isForced$1.normalize = function (string) {
1548   return String(string).replace(replacement, '.').toLowerCase();
1549 };
1550
1551 var data$3 = isForced$1.data = {};
1552 var NATIVE = isForced$1.NATIVE = 'N';
1553 var POLYFILL = isForced$1.POLYFILL = 'P';
1554
1555 var isForced_1 = isForced$1;
1556
1557 var global$8 = global$s;
1558 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1559 var createNonEnumerableProperty = createNonEnumerableProperty$3;
1560 var redefine = redefine$1.exports;
1561 var setGlobal = setGlobal$3;
1562 var copyConstructorProperties = copyConstructorProperties$1;
1563 var isForced = isForced_1;
1564
1565 /*
1566   options.target      - name of the target object
1567   options.global      - target is the global object
1568   options.stat        - export as static methods of target
1569   options.proto       - export as prototype methods of target
1570   options.real        - real prototype method for the `pure` version
1571   options.forced      - export even if the native feature is available
1572   options.bind        - bind methods to the target, required for the `pure` version
1573   options.wrap        - wrap constructors to preventing global pollution, required for the `pure` version
1574   options.unsafe      - use the simple assignment of property instead of delete + defineProperty
1575   options.sham        - add a flag to not completely full polyfills
1576   options.enumerable  - export as enumerable property
1577   options.noTargetGet - prevent calling a getter on target
1578   options.name        - the .name of the function if it does not match the key
1579 */
1580 var _export = function (options, source) {
1581   var TARGET = options.target;
1582   var GLOBAL = options.global;
1583   var STATIC = options.stat;
1584   var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1585   if (GLOBAL) {
1586     target = global$8;
1587   } else if (STATIC) {
1588     target = global$8[TARGET] || setGlobal(TARGET, {});
1589   } else {
1590     target = (global$8[TARGET] || {}).prototype;
1591   }
1592   if (target) for (key in source) {
1593     sourceProperty = source[key];
1594     if (options.noTargetGet) {
1595       descriptor = getOwnPropertyDescriptor(target, key);
1596       targetProperty = descriptor && descriptor.value;
1597     } else targetProperty = target[key];
1598     FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1599     // contained in target
1600     if (!FORCED && targetProperty !== undefined) {
1601       if (typeof sourceProperty == typeof targetProperty) continue;
1602       copyConstructorProperties(sourceProperty, targetProperty);
1603     }
1604     // add a flag to not completely full polyfills
1605     if (options.sham || (targetProperty && targetProperty.sham)) {
1606       createNonEnumerableProperty(sourceProperty, 'sham', true);
1607     }
1608     // extend global
1609     redefine(target, key, sourceProperty, options);
1610   }
1611 };
1612
1613 var wellKnownSymbol$5 = wellKnownSymbol$7;
1614
1615 var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
1616 var test$1 = {};
1617
1618 test$1[TO_STRING_TAG$1] = 'z';
1619
1620 var toStringTagSupport = String(test$1) === '[object z]';
1621
1622 var global$7 = global$s;
1623 var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1624 var isCallable$1 = isCallable$b;
1625 var classofRaw = classofRaw$1;
1626 var wellKnownSymbol$4 = wellKnownSymbol$7;
1627
1628 var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1629 var Object$1 = global$7.Object;
1630
1631 // ES3 wrong here
1632 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1633
1634 // fallback for IE11 Script Access Denied error
1635 var tryGet = function (it, key) {
1636   try {
1637     return it[key];
1638   } catch (error) { /* empty */ }
1639 };
1640
1641 // getting tag from ES6+ `Object.prototype.toString`
1642 var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1643   var O, tag, result;
1644   return it === undefined ? 'Undefined' : it === null ? 'Null'
1645     // @@toStringTag case
1646     : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
1647     // builtinTag case
1648     : CORRECT_ARGUMENTS ? classofRaw(O)
1649     // ES3 arguments fallback
1650     : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1651 };
1652
1653 var global$6 = global$s;
1654 var classof$3 = classof$4;
1655
1656 var String$1 = global$6.String;
1657
1658 var toString$3 = function (argument) {
1659   if (classof$3(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1660   return String$1(argument);
1661 };
1662
1663 var uncurryThis$3 = functionUncurryThis;
1664
1665 var arraySlice$1 = uncurryThis$3([].slice);
1666
1667 var arraySlice = arraySlice$1;
1668
1669 var floor = Math.floor;
1670
1671 var mergeSort = function (array, comparefn) {
1672   var length = array.length;
1673   var middle = floor(length / 2);
1674   return length < 8 ? insertionSort(array, comparefn) : merge$3(
1675     array,
1676     mergeSort(arraySlice(array, 0, middle), comparefn),
1677     mergeSort(arraySlice(array, middle), comparefn),
1678     comparefn
1679   );
1680 };
1681
1682 var insertionSort = function (array, comparefn) {
1683   var length = array.length;
1684   var i = 1;
1685   var element, j;
1686
1687   while (i < length) {
1688     j = i;
1689     element = array[i];
1690     while (j && comparefn(array[j - 1], element) > 0) {
1691       array[j] = array[--j];
1692     }
1693     if (j !== i++) array[j] = element;
1694   } return array;
1695 };
1696
1697 var merge$3 = function (array, left, right, comparefn) {
1698   var llength = left.length;
1699   var rlength = right.length;
1700   var lindex = 0;
1701   var rindex = 0;
1702
1703   while (lindex < llength || rindex < rlength) {
1704     array[lindex + rindex] = (lindex < llength && rindex < rlength)
1705       ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
1706       : lindex < llength ? left[lindex++] : right[rindex++];
1707   } return array;
1708 };
1709
1710 var arraySort = mergeSort;
1711
1712 var fails$2 = fails$8;
1713
1714 var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1715   var method = [][METHOD_NAME];
1716   return !!method && fails$2(function () {
1717     // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
1718     method.call(null, argument || function () { throw 1; }, 1);
1719   });
1720 };
1721
1722 var userAgent$1 = engineUserAgent;
1723
1724 var firefox = userAgent$1.match(/firefox\/(\d+)/i);
1725
1726 var engineFfVersion = !!firefox && +firefox[1];
1727
1728 var UA = engineUserAgent;
1729
1730 var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
1731
1732 var userAgent = engineUserAgent;
1733
1734 var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
1735
1736 var engineWebkitVersion = !!webkit && +webkit[1];
1737
1738 var $$3 = _export;
1739 var uncurryThis$2 = functionUncurryThis;
1740 var aCallable$3 = aCallable$5;
1741 var toObject$2 = toObject$4;
1742 var lengthOfArrayLike$4 = lengthOfArrayLike$6;
1743 var toString$2 = toString$3;
1744 var fails$1 = fails$8;
1745 var internalSort = arraySort;
1746 var arrayMethodIsStrict = arrayMethodIsStrict$1;
1747 var FF = engineFfVersion;
1748 var IE_OR_EDGE = engineIsIeOrEdge;
1749 var V8 = engineV8Version;
1750 var WEBKIT = engineWebkitVersion;
1751
1752 var test = [];
1753 var un$Sort = uncurryThis$2(test.sort);
1754 var push$2 = uncurryThis$2(test.push);
1755
1756 // IE8-
1757 var FAILS_ON_UNDEFINED = fails$1(function () {
1758   test.sort(undefined);
1759 });
1760 // V8 bug
1761 var FAILS_ON_NULL = fails$1(function () {
1762   test.sort(null);
1763 });
1764 // Old WebKit
1765 var STRICT_METHOD = arrayMethodIsStrict('sort');
1766
1767 var STABLE_SORT = !fails$1(function () {
1768   // feature detection can be too slow, so check engines versions
1769   if (V8) return V8 < 70;
1770   if (FF && FF > 3) return;
1771   if (IE_OR_EDGE) return true;
1772   if (WEBKIT) return WEBKIT < 603;
1773
1774   var result = '';
1775   var code, chr, value, index;
1776
1777   // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
1778   for (code = 65; code < 76; code++) {
1779     chr = String.fromCharCode(code);
1780
1781     switch (code) {
1782       case 66: case 69: case 70: case 72: value = 3; break;
1783       case 68: case 71: value = 4; break;
1784       default: value = 2;
1785     }
1786
1787     for (index = 0; index < 47; index++) {
1788       test.push({ k: chr + index, v: value });
1789     }
1790   }
1791
1792   test.sort(function (a, b) { return b.v - a.v; });
1793
1794   for (index = 0; index < test.length; index++) {
1795     chr = test[index].k.charAt(0);
1796     if (result.charAt(result.length - 1) !== chr) result += chr;
1797   }
1798
1799   return result !== 'DGBEFHACIJK';
1800 });
1801
1802 var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
1803
1804 var getSortCompare = function (comparefn) {
1805   return function (x, y) {
1806     if (y === undefined) return -1;
1807     if (x === undefined) return 1;
1808     if (comparefn !== undefined) return +comparefn(x, y) || 0;
1809     return toString$2(x) > toString$2(y) ? 1 : -1;
1810   };
1811 };
1812
1813 // `Array.prototype.sort` method
1814 // https://tc39.es/ecma262/#sec-array.prototype.sort
1815 $$3({ target: 'Array', proto: true, forced: FORCED }, {
1816   sort: function sort(comparefn) {
1817     if (comparefn !== undefined) aCallable$3(comparefn);
1818
1819     var array = toObject$2(this);
1820
1821     if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
1822
1823     var items = [];
1824     var arrayLength = lengthOfArrayLike$4(array);
1825     var itemsLength, index;
1826
1827     for (index = 0; index < arrayLength; index++) {
1828       if (index in array) push$2(items, array[index]);
1829     }
1830
1831     internalSort(items, getSortCompare(comparefn));
1832
1833     itemsLength = items.length;
1834     index = 0;
1835
1836     while (index < itemsLength) array[index] = items[index++];
1837     while (index < arrayLength) delete array[index++];
1838
1839     return array;
1840   }
1841 });
1842
1843 var json = {};
1844
1845 Object.defineProperty(json, "__esModule", {
1846   value: true
1847 });
1848 json.diffJson = diffJson;
1849 json.canonicalize = canonicalize;
1850 json.jsonDiff = void 0;
1851 /*istanbul ignore end*/
1852
1853 var
1854 /*istanbul ignore start*/
1855 _base$1 = _interopRequireDefault$3(base$1)
1856 /*istanbul ignore end*/
1857 ;
1858
1859 var
1860 /*istanbul ignore start*/
1861 _line$1 = line$B
1862 /*istanbul ignore end*/
1863 ;
1864 /*istanbul ignore start*/
1865
1866 function _interopRequireDefault$3(obj) {
1867   return obj && obj.__esModule ? obj : {
1868     "default": obj
1869   };
1870 }
1871
1872 function _typeof(obj) {
1873   "@babel/helpers - typeof";
1874
1875   if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1876     _typeof = function _typeof(obj) {
1877       return typeof obj;
1878     };
1879   } else {
1880     _typeof = function _typeof(obj) {
1881       return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1882     };
1883   }
1884
1885   return _typeof(obj);
1886 }
1887 /*istanbul ignore end*/
1888
1889
1890 var objectPrototypeToString = Object.prototype.toString;
1891 var jsonDiff = new
1892 /*istanbul ignore start*/
1893 _base$1
1894 /*istanbul ignore end*/
1895 [
1896 /*istanbul ignore start*/
1897 "default"
1898 /*istanbul ignore end*/
1899 ](); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
1900 // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
1901
1902 /*istanbul ignore start*/
1903
1904 json.jsonDiff = jsonDiff;
1905 /*istanbul ignore end*/
1906
1907 jsonDiff.useLongestToken = true;
1908 jsonDiff.tokenize =
1909 /*istanbul ignore start*/
1910 _line$1
1911 /*istanbul ignore end*/
1912 .
1913 /*istanbul ignore start*/
1914 lineDiff
1915 /*istanbul ignore end*/
1916 .tokenize;
1917
1918 jsonDiff.castInput = function (value) {
1919   /*istanbul ignore start*/
1920   var _this$options =
1921   /*istanbul ignore end*/
1922   this.options,
1923       undefinedReplacement = _this$options.undefinedReplacement,
1924       _this$options$stringi = _this$options.stringifyReplacer,
1925       stringifyReplacer = _this$options$stringi === void 0 ? function (k, v)
1926   /*istanbul ignore start*/
1927   {
1928     return (
1929       /*istanbul ignore end*/
1930       typeof v === 'undefined' ? undefinedReplacement : v
1931     );
1932   } : _this$options$stringi;
1933   return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, '  ');
1934 };
1935
1936 jsonDiff.equals = function (left, right) {
1937   return (
1938     /*istanbul ignore start*/
1939     _base$1
1940     /*istanbul ignore end*/
1941     [
1942     /*istanbul ignore start*/
1943     "default"
1944     /*istanbul ignore end*/
1945     ].prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
1946   );
1947 };
1948
1949 function diffJson(oldObj, newObj, options) {
1950   return jsonDiff.diff(oldObj, newObj, options);
1951 } // This function handles the presence of circular references by bailing out when encountering an
1952 // object that is already on the "stack" of items being processed. Accepts an optional replacer
1953
1954
1955 function canonicalize(obj, stack, replacementStack, replacer, key) {
1956   stack = stack || [];
1957   replacementStack = replacementStack || [];
1958
1959   if (replacer) {
1960     obj = replacer(key, obj);
1961   }
1962
1963   var i;
1964
1965   for (i = 0; i < stack.length; i += 1) {
1966     if (stack[i] === obj) {
1967       return replacementStack[i];
1968     }
1969   }
1970
1971   var canonicalizedObj;
1972
1973   if ('[object Array]' === objectPrototypeToString.call(obj)) {
1974     stack.push(obj);
1975     canonicalizedObj = new Array(obj.length);
1976     replacementStack.push(canonicalizedObj);
1977
1978     for (i = 0; i < obj.length; i += 1) {
1979       canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
1980     }
1981
1982     stack.pop();
1983     replacementStack.pop();
1984     return canonicalizedObj;
1985   }
1986
1987   if (obj && obj.toJSON) {
1988     obj = obj.toJSON();
1989   }
1990
1991   if (
1992   /*istanbul ignore start*/
1993   _typeof(
1994   /*istanbul ignore end*/
1995   obj) === 'object' && obj !== null) {
1996     stack.push(obj);
1997     canonicalizedObj = {};
1998     replacementStack.push(canonicalizedObj);
1999
2000     var sortedKeys = [],
2001         _key;
2002
2003     for (_key in obj) {
2004       /* istanbul ignore else */
2005       if (obj.hasOwnProperty(_key)) {
2006         sortedKeys.push(_key);
2007       }
2008     }
2009
2010     sortedKeys.sort();
2011
2012     for (i = 0; i < sortedKeys.length; i += 1) {
2013       _key = sortedKeys[i];
2014       canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
2015     }
2016
2017     stack.pop();
2018     replacementStack.pop();
2019   } else {
2020     canonicalizedObj = obj;
2021   }
2022
2023   return canonicalizedObj;
2024 }
2025
2026 var array$6 = {};
2027
2028 /*istanbul ignore start*/
2029
2030 Object.defineProperty(array$6, "__esModule", {
2031   value: true
2032 });
2033 array$6.diffArrays = diffArrays;
2034 array$6.arrayDiff = void 0;
2035 /*istanbul ignore end*/
2036
2037 var
2038 /*istanbul ignore start*/
2039 _base = _interopRequireDefault$2(base$1)
2040 /*istanbul ignore end*/
2041 ;
2042 /*istanbul ignore start*/
2043
2044
2045 function _interopRequireDefault$2(obj) {
2046   return obj && obj.__esModule ? obj : {
2047     "default": obj
2048   };
2049 }
2050 /*istanbul ignore end*/
2051
2052
2053 var arrayDiff = new
2054 /*istanbul ignore start*/
2055 _base
2056 /*istanbul ignore end*/
2057 [
2058 /*istanbul ignore start*/
2059 "default"
2060 /*istanbul ignore end*/
2061 ]();
2062 /*istanbul ignore start*/
2063
2064 array$6.arrayDiff = arrayDiff;
2065 /*istanbul ignore end*/
2066
2067 arrayDiff.tokenize = function (value) {
2068   return value.slice();
2069 };
2070
2071 arrayDiff.join = arrayDiff.removeEmpty = function (value) {
2072   return value;
2073 };
2074
2075 function diffArrays(oldArr, newArr, callback) {
2076   return arrayDiff.diff(oldArr, newArr, callback);
2077 }
2078
2079 var apply = {};
2080
2081 var parse$e = {};
2082
2083 /*istanbul ignore start*/
2084
2085 Object.defineProperty(parse$e, "__esModule", {
2086   value: true
2087 });
2088 parse$e.parsePatch = parsePatch;
2089 /*istanbul ignore end*/
2090
2091 function parsePatch(uniDiff) {
2092   /*istanbul ignore start*/
2093   var
2094   /*istanbul ignore end*/
2095   options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2096   var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
2097       delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
2098       list = [],
2099       i = 0;
2100
2101   function parseIndex() {
2102     var index = {};
2103     list.push(index); // Parse diff metadata
2104
2105     while (i < diffstr.length) {
2106       var line = diffstr[i]; // File header found, end parsing diff metadata
2107
2108       if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
2109         break;
2110       } // Diff index
2111
2112
2113       var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
2114
2115       if (header) {
2116         index.index = header[1];
2117       }
2118
2119       i++;
2120     } // Parse file headers if they are defined. Unified diff requires them, but
2121     // there's no technical issues to have an isolated hunk without file header
2122
2123
2124     parseFileHeader(index);
2125     parseFileHeader(index); // Parse hunks
2126
2127     index.hunks = [];
2128
2129     while (i < diffstr.length) {
2130       var _line = diffstr[i];
2131
2132       if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
2133         break;
2134       } else if (/^@@/.test(_line)) {
2135         index.hunks.push(parseHunk());
2136       } else if (_line && options.strict) {
2137         // Ignore unexpected content unless in strict mode
2138         throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
2139       } else {
2140         i++;
2141       }
2142     }
2143   } // Parses the --- and +++ headers, if none are found, no lines
2144   // are consumed.
2145
2146
2147   function parseFileHeader(index) {
2148     var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
2149
2150     if (fileHeader) {
2151       var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
2152       var data = fileHeader[2].split('\t', 2);
2153       var fileName = data[0].replace(/\\\\/g, '\\');
2154
2155       if (/^".*"$/.test(fileName)) {
2156         fileName = fileName.substr(1, fileName.length - 2);
2157       }
2158
2159       index[keyPrefix + 'FileName'] = fileName;
2160       index[keyPrefix + 'Header'] = (data[1] || '').trim();
2161       i++;
2162     }
2163   } // Parses a hunk
2164   // This assumes that we are at the start of a hunk.
2165
2166
2167   function parseHunk() {
2168     var chunkHeaderIndex = i,
2169         chunkHeaderLine = diffstr[i++],
2170         chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
2171     var hunk = {
2172       oldStart: +chunkHeader[1],
2173       oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
2174       newStart: +chunkHeader[3],
2175       newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
2176       lines: [],
2177       linedelimiters: []
2178     }; // Unified Diff Format quirk: If the chunk size is 0,
2179     // the first number is one lower than one would expect.
2180     // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
2181
2182     if (hunk.oldLines === 0) {
2183       hunk.oldStart += 1;
2184     }
2185
2186     if (hunk.newLines === 0) {
2187       hunk.newStart += 1;
2188     }
2189
2190     var addCount = 0,
2191         removeCount = 0;
2192
2193     for (; i < diffstr.length; i++) {
2194       // Lines starting with '---' could be mistaken for the "remove line" operation
2195       // But they could be the header for the next file. Therefore prune such cases out.
2196       if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
2197         break;
2198       }
2199
2200       var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
2201
2202       if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
2203         hunk.lines.push(diffstr[i]);
2204         hunk.linedelimiters.push(delimiters[i] || '\n');
2205
2206         if (operation === '+') {
2207           addCount++;
2208         } else if (operation === '-') {
2209           removeCount++;
2210         } else if (operation === ' ') {
2211           addCount++;
2212           removeCount++;
2213         }
2214       } else {
2215         break;
2216       }
2217     } // Handle the empty block count case
2218
2219
2220     if (!addCount && hunk.newLines === 1) {
2221       hunk.newLines = 0;
2222     }
2223
2224     if (!removeCount && hunk.oldLines === 1) {
2225       hunk.oldLines = 0;
2226     } // Perform optional sanity checking
2227
2228
2229     if (options.strict) {
2230       if (addCount !== hunk.newLines) {
2231         throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
2232       }
2233
2234       if (removeCount !== hunk.oldLines) {
2235         throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
2236       }
2237     }
2238
2239     return hunk;
2240   }
2241
2242   while (i < diffstr.length) {
2243     parseIndex();
2244   }
2245
2246   return list;
2247 }
2248
2249 var distanceIterator = {};
2250
2251 /*istanbul ignore start*/
2252
2253 (function (exports) {
2254
2255   Object.defineProperty(exports, "__esModule", {
2256     value: true
2257   });
2258   exports["default"] = _default;
2259   /*istanbul ignore end*/
2260   // Iterator that traverses in the range of [min, max], stepping
2261   // by distance from a given start position. I.e. for [0, 4], with
2262   // start of 2, this will iterate 2, 3, 1, 4, 0.
2263
2264   function
2265   /*istanbul ignore start*/
2266   _default
2267   /*istanbul ignore end*/
2268   (start, minLine, maxLine) {
2269     var wantForward = true,
2270         backwardExhausted = false,
2271         forwardExhausted = false,
2272         localOffset = 1;
2273     return function iterator() {
2274       if (wantForward && !forwardExhausted) {
2275         if (backwardExhausted) {
2276           localOffset++;
2277         } else {
2278           wantForward = false;
2279         } // Check if trying to fit beyond text length, and if not, check it fits
2280         // after offset location (or desired location on first iteration)
2281
2282
2283         if (start + localOffset <= maxLine) {
2284           return localOffset;
2285         }
2286
2287         forwardExhausted = true;
2288       }
2289
2290       if (!backwardExhausted) {
2291         if (!forwardExhausted) {
2292           wantForward = true;
2293         } // Check if trying to fit before text beginning, and if not, check it fits
2294         // before offset location
2295
2296
2297         if (minLine <= start - localOffset) {
2298           return -localOffset++;
2299         }
2300
2301         backwardExhausted = true;
2302         return iterator();
2303       } // We tried to fit hunk before text beginning and beyond text length, then
2304       // hunk can't fit on the text. Return undefined
2305
2306     };
2307   }
2308 })(distanceIterator);
2309
2310 /*istanbul ignore start*/
2311
2312 Object.defineProperty(apply, "__esModule", {
2313   value: true
2314 });
2315 apply.applyPatch = applyPatch;
2316 apply.applyPatches = applyPatches;
2317 /*istanbul ignore end*/
2318
2319 var
2320 /*istanbul ignore start*/
2321 _parse$1 = parse$e
2322 /*istanbul ignore end*/
2323 ;
2324
2325 var
2326 /*istanbul ignore start*/
2327 _distanceIterator = _interopRequireDefault$1(distanceIterator)
2328 /*istanbul ignore end*/
2329 ;
2330 /*istanbul ignore start*/
2331
2332
2333 function _interopRequireDefault$1(obj) {
2334   return obj && obj.__esModule ? obj : {
2335     "default": obj
2336   };
2337 }
2338 /*istanbul ignore end*/
2339
2340
2341 function applyPatch(source, uniDiff) {
2342   /*istanbul ignore start*/
2343   var
2344   /*istanbul ignore end*/
2345   options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2346
2347   if (typeof uniDiff === 'string') {
2348     uniDiff =
2349     /*istanbul ignore start*/
2350     (/*istanbul ignore end*/
2351
2352     /*istanbul ignore start*/
2353     0, _parse$1
2354     /*istanbul ignore end*/
2355     .
2356     /*istanbul ignore start*/
2357     parsePatch
2358     /*istanbul ignore end*/
2359     )(uniDiff);
2360   }
2361
2362   if (Array.isArray(uniDiff)) {
2363     if (uniDiff.length > 1) {
2364       throw new Error('applyPatch only works with a single input.');
2365     }
2366
2367     uniDiff = uniDiff[0];
2368   } // Apply the diff to the input
2369
2370
2371   var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
2372       delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
2373       hunks = uniDiff.hunks,
2374       compareLine = options.compareLine || function (lineNumber, line, operation, patchContent)
2375   /*istanbul ignore start*/
2376   {
2377     return (
2378       /*istanbul ignore end*/
2379       line === patchContent
2380     );
2381   },
2382       errorCount = 0,
2383       fuzzFactor = options.fuzzFactor || 0,
2384       minLine = 0,
2385       offset = 0,
2386       removeEOFNL,
2387       addEOFNL;
2388   /**
2389    * Checks if the hunk exactly fits on the provided location
2390    */
2391
2392
2393   function hunkFits(hunk, toPos) {
2394     for (var j = 0; j < hunk.lines.length; j++) {
2395       var line = hunk.lines[j],
2396           operation = line.length > 0 ? line[0] : ' ',
2397           content = line.length > 0 ? line.substr(1) : line;
2398
2399       if (operation === ' ' || operation === '-') {
2400         // Context sanity check
2401         if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
2402           errorCount++;
2403
2404           if (errorCount > fuzzFactor) {
2405             return false;
2406           }
2407         }
2408
2409         toPos++;
2410       }
2411     }
2412
2413     return true;
2414   } // Search best fit offsets for each hunk based on the previous ones
2415
2416
2417   for (var i = 0; i < hunks.length; i++) {
2418     var hunk = hunks[i],
2419         maxLine = lines.length - hunk.oldLines,
2420         localOffset = 0,
2421         toPos = offset + hunk.oldStart - 1;
2422     var iterator =
2423     /*istanbul ignore start*/
2424     (/*istanbul ignore end*/
2425
2426     /*istanbul ignore start*/
2427     0, _distanceIterator
2428     /*istanbul ignore end*/
2429     [
2430     /*istanbul ignore start*/
2431     "default"
2432     /*istanbul ignore end*/
2433     ])(toPos, minLine, maxLine);
2434
2435     for (; localOffset !== undefined; localOffset = iterator()) {
2436       if (hunkFits(hunk, toPos + localOffset)) {
2437         hunk.offset = offset += localOffset;
2438         break;
2439       }
2440     }
2441
2442     if (localOffset === undefined) {
2443       return false;
2444     } // Set lower text limit to end of the current hunk, so next ones don't try
2445     // to fit over already patched text
2446
2447
2448     minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
2449   } // Apply patch hunks
2450
2451
2452   var diffOffset = 0;
2453
2454   for (var _i = 0; _i < hunks.length; _i++) {
2455     var _hunk = hunks[_i],
2456         _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
2457
2458     diffOffset += _hunk.newLines - _hunk.oldLines;
2459
2460     for (var j = 0; j < _hunk.lines.length; j++) {
2461       var line = _hunk.lines[j],
2462           operation = line.length > 0 ? line[0] : ' ',
2463           content = line.length > 0 ? line.substr(1) : line,
2464           delimiter = _hunk.linedelimiters[j];
2465
2466       if (operation === ' ') {
2467         _toPos++;
2468       } else if (operation === '-') {
2469         lines.splice(_toPos, 1);
2470         delimiters.splice(_toPos, 1);
2471         /* istanbul ignore else */
2472       } else if (operation === '+') {
2473         lines.splice(_toPos, 0, content);
2474         delimiters.splice(_toPos, 0, delimiter);
2475         _toPos++;
2476       } else if (operation === '\\') {
2477         var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
2478
2479         if (previousOperation === '+') {
2480           removeEOFNL = true;
2481         } else if (previousOperation === '-') {
2482           addEOFNL = true;
2483         }
2484       }
2485     }
2486   } // Handle EOFNL insertion/removal
2487
2488
2489   if (removeEOFNL) {
2490     while (!lines[lines.length - 1]) {
2491       lines.pop();
2492       delimiters.pop();
2493     }
2494   } else if (addEOFNL) {
2495     lines.push('');
2496     delimiters.push('\n');
2497   }
2498
2499   for (var _k = 0; _k < lines.length - 1; _k++) {
2500     lines[_k] = lines[_k] + delimiters[_k];
2501   }
2502
2503   return lines.join('');
2504 } // Wrapper that supports multiple file patches via callbacks.
2505
2506
2507 function applyPatches(uniDiff, options) {
2508   if (typeof uniDiff === 'string') {
2509     uniDiff =
2510     /*istanbul ignore start*/
2511     (/*istanbul ignore end*/
2512
2513     /*istanbul ignore start*/
2514     0, _parse$1
2515     /*istanbul ignore end*/
2516     .
2517     /*istanbul ignore start*/
2518     parsePatch
2519     /*istanbul ignore end*/
2520     )(uniDiff);
2521   }
2522
2523   var currentIndex = 0;
2524
2525   function processIndex() {
2526     var index = uniDiff[currentIndex++];
2527
2528     if (!index) {
2529       return options.complete();
2530     }
2531
2532     options.loadFile(index, function (err, data) {
2533       if (err) {
2534         return options.complete(err);
2535       }
2536
2537       var updatedContent = applyPatch(data, index, options);
2538       options.patched(index, updatedContent, function (err) {
2539         if (err) {
2540           return options.complete(err);
2541         }
2542
2543         processIndex();
2544       });
2545     });
2546   }
2547
2548   processIndex();
2549 }
2550
2551 var merge$2 = {};
2552
2553 var create$1 = {};
2554
2555 /*istanbul ignore start*/
2556
2557 Object.defineProperty(create$1, "__esModule", {
2558   value: true
2559 });
2560 create$1.structuredPatch = structuredPatch;
2561 create$1.formatPatch = formatPatch;
2562 create$1.createTwoFilesPatch = createTwoFilesPatch;
2563 create$1.createPatch = createPatch;
2564 /*istanbul ignore end*/
2565
2566 var
2567 /*istanbul ignore start*/
2568 _line = line$B
2569 /*istanbul ignore end*/
2570 ;
2571 /*istanbul ignore start*/
2572
2573 function _toConsumableArray$1(arr) {
2574   return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
2575 }
2576
2577 function _nonIterableSpread$1() {
2578   throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2579 }
2580
2581 function _unsupportedIterableToArray$1(o, minLen) {
2582   if (!o) return;
2583   if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
2584   var n = Object.prototype.toString.call(o).slice(8, -1);
2585   if (n === "Object" && o.constructor) n = o.constructor.name;
2586   if (n === "Map" || n === "Set") return Array.from(o);
2587   if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
2588 }
2589
2590 function _iterableToArray$1(iter) {
2591   if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
2592 }
2593
2594 function _arrayWithoutHoles$1(arr) {
2595   if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
2596 }
2597
2598 function _arrayLikeToArray$1(arr, len) {
2599   if (len == null || len > arr.length) len = arr.length;
2600
2601   for (var i = 0, arr2 = new Array(len); i < len; i++) {
2602     arr2[i] = arr[i];
2603   }
2604
2605   return arr2;
2606 }
2607 /*istanbul ignore end*/
2608
2609
2610 function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
2611   if (!options) {
2612     options = {};
2613   }
2614
2615   if (typeof options.context === 'undefined') {
2616     options.context = 4;
2617   }
2618
2619   var diff =
2620   /*istanbul ignore start*/
2621   (/*istanbul ignore end*/
2622
2623   /*istanbul ignore start*/
2624   0, _line
2625   /*istanbul ignore end*/
2626   .
2627   /*istanbul ignore start*/
2628   diffLines
2629   /*istanbul ignore end*/
2630   )(oldStr, newStr, options);
2631   diff.push({
2632     value: '',
2633     lines: []
2634   }); // Append an empty value to make cleanup easier
2635
2636   function contextLines(lines) {
2637     return lines.map(function (entry) {
2638       return ' ' + entry;
2639     });
2640   }
2641
2642   var hunks = [];
2643   var oldRangeStart = 0,
2644       newRangeStart = 0,
2645       curRange = [],
2646       oldLine = 1,
2647       newLine = 1;
2648   /*istanbul ignore start*/
2649
2650   var _loop = function _loop(
2651   /*istanbul ignore end*/
2652   i) {
2653     var current = diff[i],
2654         lines = current.lines || current.value.replace(/\n$/, '').split('\n');
2655     current.lines = lines;
2656
2657     if (current.added || current.removed) {
2658       /*istanbul ignore start*/
2659       var _curRange;
2660       /*istanbul ignore end*/
2661       // If we have previous context, start with that
2662
2663
2664       if (!oldRangeStart) {
2665         var prev = diff[i - 1];
2666         oldRangeStart = oldLine;
2667         newRangeStart = newLine;
2668
2669         if (prev) {
2670           curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
2671           oldRangeStart -= curRange.length;
2672           newRangeStart -= curRange.length;
2673         }
2674       } // Output our changes
2675
2676       /*istanbul ignore start*/
2677
2678       /*istanbul ignore end*/
2679
2680       /*istanbul ignore start*/
2681
2682
2683       (_curRange =
2684       /*istanbul ignore end*/
2685       curRange).push.apply(
2686       /*istanbul ignore start*/
2687       _curRange
2688       /*istanbul ignore end*/
2689       ,
2690       /*istanbul ignore start*/
2691       _toConsumableArray$1(
2692       /*istanbul ignore end*/
2693       lines.map(function (entry) {
2694         return (current.added ? '+' : '-') + entry;
2695       }))); // Track the updated file position
2696
2697
2698       if (current.added) {
2699         newLine += lines.length;
2700       } else {
2701         oldLine += lines.length;
2702       }
2703     } else {
2704       // Identical context lines. Track line changes
2705       if (oldRangeStart) {
2706         // Close out any changes that have been output (or join overlapping)
2707         if (lines.length <= options.context * 2 && i < diff.length - 2) {
2708           /*istanbul ignore start*/
2709           var _curRange2;
2710           /*istanbul ignore end*/
2711           // Overlapping
2712
2713           /*istanbul ignore start*/
2714
2715           /*istanbul ignore end*/
2716
2717           /*istanbul ignore start*/
2718
2719
2720           (_curRange2 =
2721           /*istanbul ignore end*/
2722           curRange).push.apply(
2723           /*istanbul ignore start*/
2724           _curRange2
2725           /*istanbul ignore end*/
2726           ,
2727           /*istanbul ignore start*/
2728           _toConsumableArray$1(
2729           /*istanbul ignore end*/
2730           contextLines(lines)));
2731         } else {
2732           /*istanbul ignore start*/
2733           var _curRange3;
2734           /*istanbul ignore end*/
2735           // end the range and output
2736
2737
2738           var contextSize = Math.min(lines.length, options.context);
2739           /*istanbul ignore start*/
2740
2741           /*istanbul ignore end*/
2742
2743           /*istanbul ignore start*/
2744
2745           (_curRange3 =
2746           /*istanbul ignore end*/
2747           curRange).push.apply(
2748           /*istanbul ignore start*/
2749           _curRange3
2750           /*istanbul ignore end*/
2751           ,
2752           /*istanbul ignore start*/
2753           _toConsumableArray$1(
2754           /*istanbul ignore end*/
2755           contextLines(lines.slice(0, contextSize))));
2756
2757           var hunk = {
2758             oldStart: oldRangeStart,
2759             oldLines: oldLine - oldRangeStart + contextSize,
2760             newStart: newRangeStart,
2761             newLines: newLine - newRangeStart + contextSize,
2762             lines: curRange
2763           };
2764
2765           if (i >= diff.length - 2 && lines.length <= options.context) {
2766             // EOF is inside this hunk
2767             var oldEOFNewline = /\n$/.test(oldStr);
2768             var newEOFNewline = /\n$/.test(newStr);
2769             var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
2770
2771             if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
2772               // special case: old has no eol and no trailing context; no-nl can end up before adds
2773               // however, if the old file is empty, do not output the no-nl line
2774               curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
2775             }
2776
2777             if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
2778               curRange.push('\\ No newline at end of file');
2779             }
2780           }
2781
2782           hunks.push(hunk);
2783           oldRangeStart = 0;
2784           newRangeStart = 0;
2785           curRange = [];
2786         }
2787       }
2788
2789       oldLine += lines.length;
2790       newLine += lines.length;
2791     }
2792   };
2793
2794   for (var i = 0; i < diff.length; i++) {
2795     /*istanbul ignore start*/
2796     _loop(
2797     /*istanbul ignore end*/
2798     i);
2799   }
2800
2801   return {
2802     oldFileName: oldFileName,
2803     newFileName: newFileName,
2804     oldHeader: oldHeader,
2805     newHeader: newHeader,
2806     hunks: hunks
2807   };
2808 }
2809
2810 function formatPatch(diff) {
2811   var ret = [];
2812
2813   if (diff.oldFileName == diff.newFileName) {
2814     ret.push('Index: ' + diff.oldFileName);
2815   }
2816
2817   ret.push('===================================================================');
2818   ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
2819   ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
2820
2821   for (var i = 0; i < diff.hunks.length; i++) {
2822     var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
2823     // the first number is one lower than one would expect.
2824     // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
2825
2826     if (hunk.oldLines === 0) {
2827       hunk.oldStart -= 1;
2828     }
2829
2830     if (hunk.newLines === 0) {
2831       hunk.newStart -= 1;
2832     }
2833
2834     ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
2835     ret.push.apply(ret, hunk.lines);
2836   }
2837
2838   return ret.join('\n') + '\n';
2839 }
2840
2841 function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
2842   return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
2843 }
2844
2845 function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
2846   return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
2847 }
2848
2849 var array$5 = {};
2850
2851 /*istanbul ignore start*/
2852
2853 Object.defineProperty(array$5, "__esModule", {
2854   value: true
2855 });
2856 array$5.arrayEqual = arrayEqual;
2857 array$5.arrayStartsWith = arrayStartsWith;
2858 /*istanbul ignore end*/
2859
2860 function arrayEqual(a, b) {
2861   if (a.length !== b.length) {
2862     return false;
2863   }
2864
2865   return arrayStartsWith(a, b);
2866 }
2867
2868 function arrayStartsWith(array, start) {
2869   if (start.length > array.length) {
2870     return false;
2871   }
2872
2873   for (var i = 0; i < start.length; i++) {
2874     if (start[i] !== array[i]) {
2875       return false;
2876     }
2877   }
2878
2879   return true;
2880 }
2881
2882 /*istanbul ignore start*/
2883
2884 Object.defineProperty(merge$2, "__esModule", {
2885   value: true
2886 });
2887 merge$2.calcLineCount = calcLineCount;
2888 merge$2.merge = merge$1;
2889 /*istanbul ignore end*/
2890
2891 var
2892 /*istanbul ignore start*/
2893 _create = create$1
2894 /*istanbul ignore end*/
2895 ;
2896 var
2897 /*istanbul ignore start*/
2898 _parse = parse$e
2899 /*istanbul ignore end*/
2900 ;
2901 var
2902 /*istanbul ignore start*/
2903 _array = array$5
2904 /*istanbul ignore end*/
2905 ;
2906 /*istanbul ignore start*/
2907
2908 function _toConsumableArray(arr) {
2909   return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
2910 }
2911
2912 function _nonIterableSpread() {
2913   throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2914 }
2915
2916 function _unsupportedIterableToArray(o, minLen) {
2917   if (!o) return;
2918   if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2919   var n = Object.prototype.toString.call(o).slice(8, -1);
2920   if (n === "Object" && o.constructor) n = o.constructor.name;
2921   if (n === "Map" || n === "Set") return Array.from(o);
2922   if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2923 }
2924
2925 function _iterableToArray(iter) {
2926   if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
2927 }
2928
2929 function _arrayWithoutHoles(arr) {
2930   if (Array.isArray(arr)) return _arrayLikeToArray(arr);
2931 }
2932
2933 function _arrayLikeToArray(arr, len) {
2934   if (len == null || len > arr.length) len = arr.length;
2935
2936   for (var i = 0, arr2 = new Array(len); i < len; i++) {
2937     arr2[i] = arr[i];
2938   }
2939
2940   return arr2;
2941 }
2942 /*istanbul ignore end*/
2943
2944
2945 function calcLineCount(hunk) {
2946   /*istanbul ignore start*/
2947   var _calcOldNewLineCount =
2948   /*istanbul ignore end*/
2949   calcOldNewLineCount(hunk.lines),
2950       oldLines = _calcOldNewLineCount.oldLines,
2951       newLines = _calcOldNewLineCount.newLines;
2952
2953   if (oldLines !== undefined) {
2954     hunk.oldLines = oldLines;
2955   } else {
2956     delete hunk.oldLines;
2957   }
2958
2959   if (newLines !== undefined) {
2960     hunk.newLines = newLines;
2961   } else {
2962     delete hunk.newLines;
2963   }
2964 }
2965
2966 function merge$1(mine, theirs, base) {
2967   mine = loadPatch(mine, base);
2968   theirs = loadPatch(theirs, base);
2969   var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning.
2970   // Leaving sanity checks on this to the API consumer that may know more about the
2971   // meaning in their own context.
2972
2973   if (mine.index || theirs.index) {
2974     ret.index = mine.index || theirs.index;
2975   }
2976
2977   if (mine.newFileName || theirs.newFileName) {
2978     if (!fileNameChanged(mine)) {
2979       // No header or no change in ours, use theirs (and ours if theirs does not exist)
2980       ret.oldFileName = theirs.oldFileName || mine.oldFileName;
2981       ret.newFileName = theirs.newFileName || mine.newFileName;
2982       ret.oldHeader = theirs.oldHeader || mine.oldHeader;
2983       ret.newHeader = theirs.newHeader || mine.newHeader;
2984     } else if (!fileNameChanged(theirs)) {
2985       // No header or no change in theirs, use ours
2986       ret.oldFileName = mine.oldFileName;
2987       ret.newFileName = mine.newFileName;
2988       ret.oldHeader = mine.oldHeader;
2989       ret.newHeader = mine.newHeader;
2990     } else {
2991       // Both changed... figure it out
2992       ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
2993       ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
2994       ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
2995       ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
2996     }
2997   }
2998
2999   ret.hunks = [];
3000   var mineIndex = 0,
3001       theirsIndex = 0,
3002       mineOffset = 0,
3003       theirsOffset = 0;
3004
3005   while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
3006     var mineCurrent = mine.hunks[mineIndex] || {
3007       oldStart: Infinity
3008     },
3009         theirsCurrent = theirs.hunks[theirsIndex] || {
3010       oldStart: Infinity
3011     };
3012
3013     if (hunkBefore(mineCurrent, theirsCurrent)) {
3014       // This patch does not overlap with any of the others, yay.
3015       ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
3016       mineIndex++;
3017       theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
3018     } else if (hunkBefore(theirsCurrent, mineCurrent)) {
3019       // This patch does not overlap with any of the others, yay.
3020       ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
3021       theirsIndex++;
3022       mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
3023     } else {
3024       // Overlap, merge as best we can
3025       var mergedHunk = {
3026         oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
3027         oldLines: 0,
3028         newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
3029         newLines: 0,
3030         lines: []
3031       };
3032       mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
3033       theirsIndex++;
3034       mineIndex++;
3035       ret.hunks.push(mergedHunk);
3036     }
3037   }
3038
3039   return ret;
3040 }
3041
3042 function loadPatch(param, base) {
3043   if (typeof param === 'string') {
3044     if (/^@@/m.test(param) || /^Index:/m.test(param)) {
3045       return (
3046         /*istanbul ignore start*/
3047         (/*istanbul ignore end*/
3048
3049         /*istanbul ignore start*/
3050         0, _parse
3051         /*istanbul ignore end*/
3052         .
3053         /*istanbul ignore start*/
3054         parsePatch
3055         /*istanbul ignore end*/
3056         )(param)[0]
3057       );
3058     }
3059
3060     if (!base) {
3061       throw new Error('Must provide a base reference or pass in a patch');
3062     }
3063
3064     return (
3065       /*istanbul ignore start*/
3066       (/*istanbul ignore end*/
3067
3068       /*istanbul ignore start*/
3069       0, _create
3070       /*istanbul ignore end*/
3071       .
3072       /*istanbul ignore start*/
3073       structuredPatch
3074       /*istanbul ignore end*/
3075       )(undefined, undefined, base, param)
3076     );
3077   }
3078
3079   return param;
3080 }
3081
3082 function fileNameChanged(patch) {
3083   return patch.newFileName && patch.newFileName !== patch.oldFileName;
3084 }
3085
3086 function selectField(index, mine, theirs) {
3087   if (mine === theirs) {
3088     return mine;
3089   } else {
3090     index.conflict = true;
3091     return {
3092       mine: mine,
3093       theirs: theirs
3094     };
3095   }
3096 }
3097
3098 function hunkBefore(test, check) {
3099   return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
3100 }
3101
3102 function cloneHunk(hunk, offset) {
3103   return {
3104     oldStart: hunk.oldStart,
3105     oldLines: hunk.oldLines,
3106     newStart: hunk.newStart + offset,
3107     newLines: hunk.newLines,
3108     lines: hunk.lines
3109   };
3110 }
3111
3112 function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
3113   // This will generally result in a conflicted hunk, but there are cases where the context
3114   // is the only overlap where we can successfully merge the content here.
3115   var mine = {
3116     offset: mineOffset,
3117     lines: mineLines,
3118     index: 0
3119   },
3120       their = {
3121     offset: theirOffset,
3122     lines: theirLines,
3123     index: 0
3124   }; // Handle any leading content
3125
3126   insertLeading(hunk, mine, their);
3127   insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each.
3128
3129   while (mine.index < mine.lines.length && their.index < their.lines.length) {
3130     var mineCurrent = mine.lines[mine.index],
3131         theirCurrent = their.lines[their.index];
3132
3133     if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
3134       // Both modified ...
3135       mutualChange(hunk, mine, their);
3136     } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
3137       /*istanbul ignore start*/
3138       var _hunk$lines;
3139       /*istanbul ignore end*/
3140       // Mine inserted
3141
3142       /*istanbul ignore start*/
3143
3144       /*istanbul ignore end*/
3145
3146       /*istanbul ignore start*/
3147
3148
3149       (_hunk$lines =
3150       /*istanbul ignore end*/
3151       hunk.lines).push.apply(
3152       /*istanbul ignore start*/
3153       _hunk$lines
3154       /*istanbul ignore end*/
3155       ,
3156       /*istanbul ignore start*/
3157       _toConsumableArray(
3158       /*istanbul ignore end*/
3159       collectChange(mine)));
3160     } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
3161       /*istanbul ignore start*/
3162       var _hunk$lines2;
3163       /*istanbul ignore end*/
3164       // Theirs inserted
3165
3166       /*istanbul ignore start*/
3167
3168       /*istanbul ignore end*/
3169
3170       /*istanbul ignore start*/
3171
3172
3173       (_hunk$lines2 =
3174       /*istanbul ignore end*/
3175       hunk.lines).push.apply(
3176       /*istanbul ignore start*/
3177       _hunk$lines2
3178       /*istanbul ignore end*/
3179       ,
3180       /*istanbul ignore start*/
3181       _toConsumableArray(
3182       /*istanbul ignore end*/
3183       collectChange(their)));
3184     } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
3185       // Mine removed or edited
3186       removal(hunk, mine, their);
3187     } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
3188       // Their removed or edited
3189       removal(hunk, their, mine, true);
3190     } else if (mineCurrent === theirCurrent) {
3191       // Context identity
3192       hunk.lines.push(mineCurrent);
3193       mine.index++;
3194       their.index++;
3195     } else {
3196       // Context mismatch
3197       conflict(hunk, collectChange(mine), collectChange(their));
3198     }
3199   } // Now push anything that may be remaining
3200
3201
3202   insertTrailing(hunk, mine);
3203   insertTrailing(hunk, their);
3204   calcLineCount(hunk);
3205 }
3206
3207 function mutualChange(hunk, mine, their) {
3208   var myChanges = collectChange(mine),
3209       theirChanges = collectChange(their);
3210
3211   if (allRemoves(myChanges) && allRemoves(theirChanges)) {
3212     // Special case for remove changes that are supersets of one another
3213     if (
3214     /*istanbul ignore start*/
3215     (/*istanbul ignore end*/
3216
3217     /*istanbul ignore start*/
3218     0, _array
3219     /*istanbul ignore end*/
3220     .
3221     /*istanbul ignore start*/
3222     arrayStartsWith
3223     /*istanbul ignore end*/
3224     )(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
3225       /*istanbul ignore start*/
3226       var _hunk$lines3;
3227       /*istanbul ignore end*/
3228
3229       /*istanbul ignore start*/
3230
3231       /*istanbul ignore end*/
3232
3233       /*istanbul ignore start*/
3234
3235
3236       (_hunk$lines3 =
3237       /*istanbul ignore end*/
3238       hunk.lines).push.apply(
3239       /*istanbul ignore start*/
3240       _hunk$lines3
3241       /*istanbul ignore end*/
3242       ,
3243       /*istanbul ignore start*/
3244       _toConsumableArray(
3245       /*istanbul ignore end*/
3246       myChanges));
3247
3248       return;
3249     } else if (
3250     /*istanbul ignore start*/
3251     (/*istanbul ignore end*/
3252
3253     /*istanbul ignore start*/
3254     0, _array
3255     /*istanbul ignore end*/
3256     .
3257     /*istanbul ignore start*/
3258     arrayStartsWith
3259     /*istanbul ignore end*/
3260     )(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
3261       /*istanbul ignore start*/
3262       var _hunk$lines4;
3263       /*istanbul ignore end*/
3264
3265       /*istanbul ignore start*/
3266
3267       /*istanbul ignore end*/
3268
3269       /*istanbul ignore start*/
3270
3271
3272       (_hunk$lines4 =
3273       /*istanbul ignore end*/
3274       hunk.lines).push.apply(
3275       /*istanbul ignore start*/
3276       _hunk$lines4
3277       /*istanbul ignore end*/
3278       ,
3279       /*istanbul ignore start*/
3280       _toConsumableArray(
3281       /*istanbul ignore end*/
3282       theirChanges));
3283
3284       return;
3285     }
3286   } else if (
3287   /*istanbul ignore start*/
3288   (/*istanbul ignore end*/
3289
3290   /*istanbul ignore start*/
3291   0, _array
3292   /*istanbul ignore end*/
3293   .
3294   /*istanbul ignore start*/
3295   arrayEqual
3296   /*istanbul ignore end*/
3297   )(myChanges, theirChanges)) {
3298     /*istanbul ignore start*/
3299     var _hunk$lines5;
3300     /*istanbul ignore end*/
3301
3302     /*istanbul ignore start*/
3303
3304     /*istanbul ignore end*/
3305
3306     /*istanbul ignore start*/
3307
3308
3309     (_hunk$lines5 =
3310     /*istanbul ignore end*/
3311     hunk.lines).push.apply(
3312     /*istanbul ignore start*/
3313     _hunk$lines5
3314     /*istanbul ignore end*/
3315     ,
3316     /*istanbul ignore start*/
3317     _toConsumableArray(
3318     /*istanbul ignore end*/
3319     myChanges));
3320
3321     return;
3322   }
3323
3324   conflict(hunk, myChanges, theirChanges);
3325 }
3326
3327 function removal(hunk, mine, their, swap) {
3328   var myChanges = collectChange(mine),
3329       theirChanges = collectContext(their, myChanges);
3330
3331   if (theirChanges.merged) {
3332     /*istanbul ignore start*/
3333     var _hunk$lines6;
3334     /*istanbul ignore end*/
3335
3336     /*istanbul ignore start*/
3337
3338     /*istanbul ignore end*/
3339
3340     /*istanbul ignore start*/
3341
3342
3343     (_hunk$lines6 =
3344     /*istanbul ignore end*/
3345     hunk.lines).push.apply(
3346     /*istanbul ignore start*/
3347     _hunk$lines6
3348     /*istanbul ignore end*/
3349     ,
3350     /*istanbul ignore start*/
3351     _toConsumableArray(
3352     /*istanbul ignore end*/
3353     theirChanges.merged));
3354   } else {
3355     conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
3356   }
3357 }
3358
3359 function conflict(hunk, mine, their) {
3360   hunk.conflict = true;
3361   hunk.lines.push({
3362     conflict: true,
3363     mine: mine,
3364     theirs: their
3365   });
3366 }
3367
3368 function insertLeading(hunk, insert, their) {
3369   while (insert.offset < their.offset && insert.index < insert.lines.length) {
3370     var line = insert.lines[insert.index++];
3371     hunk.lines.push(line);
3372     insert.offset++;
3373   }
3374 }
3375
3376 function insertTrailing(hunk, insert) {
3377   while (insert.index < insert.lines.length) {
3378     var line = insert.lines[insert.index++];
3379     hunk.lines.push(line);
3380   }
3381 }
3382
3383 function collectChange(state) {
3384   var ret = [],
3385       operation = state.lines[state.index][0];
3386
3387   while (state.index < state.lines.length) {
3388     var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
3389
3390     if (operation === '-' && line[0] === '+') {
3391       operation = '+';
3392     }
3393
3394     if (operation === line[0]) {
3395       ret.push(line);
3396       state.index++;
3397     } else {
3398       break;
3399     }
3400   }
3401
3402   return ret;
3403 }
3404
3405 function collectContext(state, matchChanges) {
3406   var changes = [],
3407       merged = [],
3408       matchIndex = 0,
3409       contextChanges = false,
3410       conflicted = false;
3411
3412   while (matchIndex < matchChanges.length && state.index < state.lines.length) {
3413     var change = state.lines[state.index],
3414         match = matchChanges[matchIndex]; // Once we've hit our add, then we are done
3415
3416     if (match[0] === '+') {
3417       break;
3418     }
3419
3420     contextChanges = contextChanges || change[0] !== ' ';
3421     merged.push(match);
3422     matchIndex++; // Consume any additions in the other block as a conflict to attempt
3423     // to pull in the remaining context after this
3424
3425     if (change[0] === '+') {
3426       conflicted = true;
3427
3428       while (change[0] === '+') {
3429         changes.push(change);
3430         change = state.lines[++state.index];
3431       }
3432     }
3433
3434     if (match.substr(1) === change.substr(1)) {
3435       changes.push(change);
3436       state.index++;
3437     } else {
3438       conflicted = true;
3439     }
3440   }
3441
3442   if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
3443     conflicted = true;
3444   }
3445
3446   if (conflicted) {
3447     return changes;
3448   }
3449
3450   while (matchIndex < matchChanges.length) {
3451     merged.push(matchChanges[matchIndex++]);
3452   }
3453
3454   return {
3455     merged: merged,
3456     changes: changes
3457   };
3458 }
3459
3460 function allRemoves(changes) {
3461   return changes.reduce(function (prev, change) {
3462     return prev && change[0] === '-';
3463   }, true);
3464 }
3465
3466 function skipRemoveSuperset(state, removeChanges, delta) {
3467   for (var i = 0; i < delta; i++) {
3468     var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
3469
3470     if (state.lines[state.index + i] !== ' ' + changeContent) {
3471       return false;
3472     }
3473   }
3474
3475   state.index += delta;
3476   return true;
3477 }
3478
3479 function calcOldNewLineCount(lines) {
3480   var oldLines = 0;
3481   var newLines = 0;
3482   lines.forEach(function (line) {
3483     if (typeof line !== 'string') {
3484       var myCount = calcOldNewLineCount(line.mine);
3485       var theirCount = calcOldNewLineCount(line.theirs);
3486
3487       if (oldLines !== undefined) {
3488         if (myCount.oldLines === theirCount.oldLines) {
3489           oldLines += myCount.oldLines;
3490         } else {
3491           oldLines = undefined;
3492         }
3493       }
3494
3495       if (newLines !== undefined) {
3496         if (myCount.newLines === theirCount.newLines) {
3497           newLines += myCount.newLines;
3498         } else {
3499           newLines = undefined;
3500         }
3501       }
3502     } else {
3503       if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
3504         newLines++;
3505       }
3506
3507       if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
3508         oldLines++;
3509       }
3510     }
3511   });
3512   return {
3513     oldLines: oldLines,
3514     newLines: newLines
3515   };
3516 }
3517
3518 var dmp = {};
3519
3520 /*istanbul ignore start*/
3521
3522 Object.defineProperty(dmp, "__esModule", {
3523   value: true
3524 });
3525 dmp.convertChangesToDMP = convertChangesToDMP;
3526 /*istanbul ignore end*/
3527 // See: http://code.google.com/p/google-diff-match-patch/wiki/API
3528
3529 function convertChangesToDMP(changes) {
3530   var ret = [],
3531       change,
3532       operation;
3533
3534   for (var i = 0; i < changes.length; i++) {
3535     change = changes[i];
3536
3537     if (change.added) {
3538       operation = 1;
3539     } else if (change.removed) {
3540       operation = -1;
3541     } else {
3542       operation = 0;
3543     }
3544
3545     ret.push([operation, change.value]);
3546   }
3547
3548   return ret;
3549 }
3550
3551 var xml = {};
3552
3553 /*istanbul ignore start*/
3554
3555 Object.defineProperty(xml, "__esModule", {
3556   value: true
3557 });
3558 xml.convertChangesToXML = convertChangesToXML;
3559 /*istanbul ignore end*/
3560
3561 function convertChangesToXML(changes) {
3562   var ret = [];
3563
3564   for (var i = 0; i < changes.length; i++) {
3565     var change = changes[i];
3566
3567     if (change.added) {
3568       ret.push('<ins>');
3569     } else if (change.removed) {
3570       ret.push('<del>');
3571     }
3572
3573     ret.push(escapeHTML(change.value));
3574
3575     if (change.added) {
3576       ret.push('</ins>');
3577     } else if (change.removed) {
3578       ret.push('</del>');
3579     }
3580   }
3581
3582   return ret.join('');
3583 }
3584
3585 function escapeHTML(s) {
3586   var n = s;
3587   n = n.replace(/&/g, '&amp;');
3588   n = n.replace(/</g, '&lt;');
3589   n = n.replace(/>/g, '&gt;');
3590   n = n.replace(/"/g, '&quot;');
3591   return n;
3592 }
3593
3594 /*istanbul ignore start*/
3595
3596 (function (exports) {
3597
3598   Object.defineProperty(exports, "__esModule", {
3599     value: true
3600   });
3601   Object.defineProperty(exports, "Diff", {
3602     enumerable: true,
3603     get: function get() {
3604       return _base["default"];
3605     }
3606   });
3607   Object.defineProperty(exports, "diffChars", {
3608     enumerable: true,
3609     get: function get() {
3610       return _character.diffChars;
3611     }
3612   });
3613   Object.defineProperty(exports, "diffWords", {
3614     enumerable: true,
3615     get: function get() {
3616       return _word.diffWords;
3617     }
3618   });
3619   Object.defineProperty(exports, "diffWordsWithSpace", {
3620     enumerable: true,
3621     get: function get() {
3622       return _word.diffWordsWithSpace;
3623     }
3624   });
3625   Object.defineProperty(exports, "diffLines", {
3626     enumerable: true,
3627     get: function get() {
3628       return _line.diffLines;
3629     }
3630   });
3631   Object.defineProperty(exports, "diffTrimmedLines", {
3632     enumerable: true,
3633     get: function get() {
3634       return _line.diffTrimmedLines;
3635     }
3636   });
3637   Object.defineProperty(exports, "diffSentences", {
3638     enumerable: true,
3639     get: function get() {
3640       return _sentence.diffSentences;
3641     }
3642   });
3643   Object.defineProperty(exports, "diffCss", {
3644     enumerable: true,
3645     get: function get() {
3646       return _css.diffCss;
3647     }
3648   });
3649   Object.defineProperty(exports, "diffJson", {
3650     enumerable: true,
3651     get: function get() {
3652       return _json.diffJson;
3653     }
3654   });
3655   Object.defineProperty(exports, "canonicalize", {
3656     enumerable: true,
3657     get: function get() {
3658       return _json.canonicalize;
3659     }
3660   });
3661   Object.defineProperty(exports, "diffArrays", {
3662     enumerable: true,
3663     get: function get() {
3664       return _array.diffArrays;
3665     }
3666   });
3667   Object.defineProperty(exports, "applyPatch", {
3668     enumerable: true,
3669     get: function get() {
3670       return _apply.applyPatch;
3671     }
3672   });
3673   Object.defineProperty(exports, "applyPatches", {
3674     enumerable: true,
3675     get: function get() {
3676       return _apply.applyPatches;
3677     }
3678   });
3679   Object.defineProperty(exports, "parsePatch", {
3680     enumerable: true,
3681     get: function get() {
3682       return _parse.parsePatch;
3683     }
3684   });
3685   Object.defineProperty(exports, "merge", {
3686     enumerable: true,
3687     get: function get() {
3688       return _merge.merge;
3689     }
3690   });
3691   Object.defineProperty(exports, "structuredPatch", {
3692     enumerable: true,
3693     get: function get() {
3694       return _create.structuredPatch;
3695     }
3696   });
3697   Object.defineProperty(exports, "createTwoFilesPatch", {
3698     enumerable: true,
3699     get: function get() {
3700       return _create.createTwoFilesPatch;
3701     }
3702   });
3703   Object.defineProperty(exports, "createPatch", {
3704     enumerable: true,
3705     get: function get() {
3706       return _create.createPatch;
3707     }
3708   });
3709   Object.defineProperty(exports, "convertChangesToDMP", {
3710     enumerable: true,
3711     get: function get() {
3712       return _dmp.convertChangesToDMP;
3713     }
3714   });
3715   Object.defineProperty(exports, "convertChangesToXML", {
3716     enumerable: true,
3717     get: function get() {
3718       return _xml.convertChangesToXML;
3719     }
3720   });
3721   /*istanbul ignore end*/
3722
3723   var
3724   /*istanbul ignore start*/
3725   _base = _interopRequireDefault(base$1)
3726   /*istanbul ignore end*/
3727   ;
3728
3729   var
3730   /*istanbul ignore start*/
3731   _character = character
3732   /*istanbul ignore end*/
3733   ;
3734   var
3735   /*istanbul ignore start*/
3736   _word = word
3737   /*istanbul ignore end*/
3738   ;
3739   var
3740   /*istanbul ignore start*/
3741   _line = line$B
3742   /*istanbul ignore end*/
3743   ;
3744   var
3745   /*istanbul ignore start*/
3746   _sentence = sentence
3747   /*istanbul ignore end*/
3748   ;
3749   var
3750   /*istanbul ignore start*/
3751   _css = css$1
3752   /*istanbul ignore end*/
3753   ;
3754   var
3755   /*istanbul ignore start*/
3756   _json = json
3757   /*istanbul ignore end*/
3758   ;
3759   var
3760   /*istanbul ignore start*/
3761   _array = array$6
3762   /*istanbul ignore end*/
3763   ;
3764   var
3765   /*istanbul ignore start*/
3766   _apply = apply
3767   /*istanbul ignore end*/
3768   ;
3769   var
3770   /*istanbul ignore start*/
3771   _parse = parse$e
3772   /*istanbul ignore end*/
3773   ;
3774   var
3775   /*istanbul ignore start*/
3776   _merge = merge$2
3777   /*istanbul ignore end*/
3778   ;
3779   var
3780   /*istanbul ignore start*/
3781   _create = create$1
3782   /*istanbul ignore end*/
3783   ;
3784   var
3785   /*istanbul ignore start*/
3786   _dmp = dmp
3787   /*istanbul ignore end*/
3788   ;
3789   var
3790   /*istanbul ignore start*/
3791   _xml = xml
3792   /*istanbul ignore end*/
3793   ;
3794   /*istanbul ignore start*/
3795
3796   function _interopRequireDefault(obj) {
3797     return obj && obj.__esModule ? obj : {
3798       "default": obj
3799     };
3800   }
3801   /*istanbul ignore end*/
3802
3803 })(lib$6);
3804
3805 var require$$7$3 = require("./doc.js");
3806
3807 var stringWidth$2 = {exports: {}};
3808
3809 var ansiRegex$1 = ({
3810   onlyFirst = false
3811 } = {}) => {
3812   const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
3813   return new RegExp(pattern, onlyFirst ? undefined : 'g');
3814 };
3815
3816 const ansiRegex = ansiRegex$1;
3817
3818 var stripAnsi$1 = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
3819
3820 var isFullwidthCodePoint$2 = {exports: {}};
3821
3822 /* eslint-disable yoda */
3823
3824 const isFullwidthCodePoint$1 = codePoint => {
3825   if (Number.isNaN(codePoint)) {
3826     return false;
3827   } // Code points are derived from:
3828   // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
3829
3830
3831   if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
3832   codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
3833   codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
3834   // CJK Radicals Supplement .. Enclosed CJK Letters and Months
3835   0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
3836   0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
3837   0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
3838   0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
3839   0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
3840   0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
3841   0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
3842   0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
3843   0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
3844   0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
3845   0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
3846   0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
3847     return true;
3848   }
3849
3850   return false;
3851 };
3852
3853 isFullwidthCodePoint$2.exports = isFullwidthCodePoint$1;
3854
3855 isFullwidthCodePoint$2.exports.default = isFullwidthCodePoint$1;
3856
3857 var emojiRegex$1 = function () {
3858   // https://mths.be/emoji
3859   return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
3860 };
3861
3862 const stripAnsi = stripAnsi$1;
3863 const isFullwidthCodePoint = isFullwidthCodePoint$2.exports;
3864 const emojiRegex = emojiRegex$1;
3865
3866 const stringWidth$1 = string => {
3867   if (typeof string !== 'string' || string.length === 0) {
3868     return 0;
3869   }
3870
3871   string = stripAnsi(string);
3872
3873   if (string.length === 0) {
3874     return 0;
3875   }
3876
3877   string = string.replace(emojiRegex(), '  ');
3878   let width = 0;
3879
3880   for (let i = 0; i < string.length; i++) {
3881     const code = string.codePointAt(i); // Ignore control characters
3882
3883     if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
3884       continue;
3885     } // Ignore combining characters
3886
3887
3888     if (code >= 0x300 && code <= 0x36F) {
3889       continue;
3890     } // Surrogates
3891
3892
3893     if (code > 0xFFFF) {
3894       i++;
3895     }
3896
3897     width += isFullwidthCodePoint(code) ? 2 : 1;
3898   }
3899
3900   return width;
3901 };
3902
3903 stringWidth$2.exports = stringWidth$1; // TODO: remove this in the next major version
3904
3905 stringWidth$2.exports.default = stringWidth$1;
3906
3907 var escapeStringRegexp$3 = string => {
3908   if (typeof string !== 'string') {
3909     throw new TypeError('Expected a string');
3910   } // Escape characters with special meaning either inside or outside character sets.
3911   // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
3912
3913
3914   return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
3915 };
3916
3917 const getLast$p = arr => arr[arr.length - 1];
3918
3919 var getLast_1 = getLast$p;
3920
3921 function _objectWithoutPropertiesLoose(source, excluded) {
3922   if (source == null) return {};
3923   var target = {};
3924   var sourceKeys = Object.keys(source);
3925   var key, i;
3926
3927   for (i = 0; i < sourceKeys.length; i++) {
3928     key = sourceKeys[i];
3929     if (excluded.indexOf(key) >= 0) continue;
3930     target[key] = source[key];
3931   }
3932
3933   return target;
3934 }
3935
3936 function _objectWithoutProperties(source, excluded) {
3937   if (source == null) return {};
3938
3939   var target = _objectWithoutPropertiesLoose(source, excluded);
3940
3941   var key, i;
3942
3943   if (Object.getOwnPropertySymbols) {
3944     var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
3945
3946     for (i = 0; i < sourceSymbolKeys.length; i++) {
3947       key = sourceSymbolKeys[i];
3948       if (excluded.indexOf(key) >= 0) continue;
3949       if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
3950       target[key] = source[key];
3951     }
3952   }
3953
3954   return target;
3955 }
3956
3957 var classof$2 = classofRaw$1;
3958
3959 // `IsArray` abstract operation
3960 // https://tc39.es/ecma262/#sec-isarray
3961 // eslint-disable-next-line es/no-array-isarray -- safe
3962 var isArray$e = Array.isArray || function isArray(argument) {
3963   return classof$2(argument) == 'Array';
3964 };
3965
3966 var uncurryThis$1 = functionUncurryThis;
3967 var aCallable$2 = aCallable$5;
3968
3969 var bind$3 = uncurryThis$1(uncurryThis$1.bind);
3970
3971 // optional / simple context binding
3972 var functionBindContext = function (fn, that) {
3973   aCallable$2(fn);
3974   return that === undefined ? fn : bind$3 ? bind$3(fn, that) : function (/* ...args */) {
3975     return fn.apply(that, arguments);
3976   };
3977 };
3978
3979 var global$5 = global$s;
3980 var isArray$d = isArray$e;
3981 var lengthOfArrayLike$3 = lengthOfArrayLike$6;
3982 var bind$2 = functionBindContext;
3983
3984 var TypeError$3 = global$5.TypeError;
3985
3986 // `FlattenIntoArray` abstract operation
3987 // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
3988 var flattenIntoArray$2 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
3989   var targetIndex = start;
3990   var sourceIndex = 0;
3991   var mapFn = mapper ? bind$2(mapper, thisArg) : false;
3992   var element, elementLen;
3993
3994   while (sourceIndex < sourceLen) {
3995     if (sourceIndex in source) {
3996       element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
3997
3998       if (depth > 0 && isArray$d(element)) {
3999         elementLen = lengthOfArrayLike$3(element);
4000         targetIndex = flattenIntoArray$2(target, original, element, elementLen, targetIndex, depth - 1) - 1;
4001       } else {
4002         if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError$3('Exceed the acceptable array length');
4003         target[targetIndex] = element;
4004       }
4005
4006       targetIndex++;
4007     }
4008     sourceIndex++;
4009   }
4010   return targetIndex;
4011 };
4012
4013 var flattenIntoArray_1 = flattenIntoArray$2;
4014
4015 var uncurryThis = functionUncurryThis;
4016 var fails = fails$8;
4017 var isCallable = isCallable$b;
4018 var classof$1 = classof$4;
4019 var getBuiltIn$1 = getBuiltIn$5;
4020 var inspectSource = inspectSource$3;
4021
4022 var noop$3 = function () { /* empty */ };
4023 var empty = [];
4024 var construct = getBuiltIn$1('Reflect', 'construct');
4025 var constructorRegExp = /^\s*(?:class|function)\b/;
4026 var exec = uncurryThis(constructorRegExp.exec);
4027 var INCORRECT_TO_STRING = !constructorRegExp.exec(noop$3);
4028
4029 var isConstructorModern = function (argument) {
4030   if (!isCallable(argument)) return false;
4031   try {
4032     construct(noop$3, empty, argument);
4033     return true;
4034   } catch (error) {
4035     return false;
4036   }
4037 };
4038
4039 var isConstructorLegacy = function (argument) {
4040   if (!isCallable(argument)) return false;
4041   switch (classof$1(argument)) {
4042     case 'AsyncFunction':
4043     case 'GeneratorFunction':
4044     case 'AsyncGeneratorFunction': return false;
4045     // we can't check .prototype since constructors produced by .bind haven't it
4046   } return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
4047 };
4048
4049 // `IsConstructor` abstract operation
4050 // https://tc39.es/ecma262/#sec-isconstructor
4051 var isConstructor$1 = !construct || fails(function () {
4052   var called;
4053   return isConstructorModern(isConstructorModern.call)
4054     || !isConstructorModern(Object)
4055     || !isConstructorModern(function () { called = true; })
4056     || called;
4057 }) ? isConstructorLegacy : isConstructorModern;
4058
4059 var global$4 = global$s;
4060 var isArray$c = isArray$e;
4061 var isConstructor = isConstructor$1;
4062 var isObject$6 = isObject$c;
4063 var wellKnownSymbol$3 = wellKnownSymbol$7;
4064
4065 var SPECIES = wellKnownSymbol$3('species');
4066 var Array$1 = global$4.Array;
4067
4068 // a part of `ArraySpeciesCreate` abstract operation
4069 // https://tc39.es/ecma262/#sec-arrayspeciescreate
4070 var arraySpeciesConstructor$1 = function (originalArray) {
4071   var C;
4072   if (isArray$c(originalArray)) {
4073     C = originalArray.constructor;
4074     // cross-realm fallback
4075     if (isConstructor(C) && (C === Array$1 || isArray$c(C.prototype))) C = undefined;
4076     else if (isObject$6(C)) {
4077       C = C[SPECIES];
4078       if (C === null) C = undefined;
4079     }
4080   } return C === undefined ? Array$1 : C;
4081 };
4082
4083 var arraySpeciesConstructor = arraySpeciesConstructor$1;
4084
4085 // `ArraySpeciesCreate` abstract operation
4086 // https://tc39.es/ecma262/#sec-arrayspeciescreate
4087 var arraySpeciesCreate$2 = function (originalArray, length) {
4088   return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
4089 };
4090
4091 var $$2 = _export;
4092 var flattenIntoArray$1 = flattenIntoArray_1;
4093 var aCallable$1 = aCallable$5;
4094 var toObject$1 = toObject$4;
4095 var lengthOfArrayLike$2 = lengthOfArrayLike$6;
4096 var arraySpeciesCreate$1 = arraySpeciesCreate$2;
4097
4098 // `Array.prototype.flatMap` method
4099 // https://tc39.es/ecma262/#sec-array.prototype.flatmap
4100 $$2({ target: 'Array', proto: true }, {
4101   flatMap: function flatMap(callbackfn /* , thisArg */) {
4102     var O = toObject$1(this);
4103     var sourceLen = lengthOfArrayLike$2(O);
4104     var A;
4105     aCallable$1(callbackfn);
4106     A = arraySpeciesCreate$1(O, 0);
4107     A.length = flattenIntoArray$1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
4108     return A;
4109   }
4110 });
4111
4112 var iterators = {};
4113
4114 var wellKnownSymbol$2 = wellKnownSymbol$7;
4115 var Iterators$1 = iterators;
4116
4117 var ITERATOR$1 = wellKnownSymbol$2('iterator');
4118 var ArrayPrototype$1 = Array.prototype;
4119
4120 // check on default Array iterator
4121 var isArrayIteratorMethod$1 = function (it) {
4122   return it !== undefined && (Iterators$1.Array === it || ArrayPrototype$1[ITERATOR$1] === it);
4123 };
4124
4125 var classof = classof$4;
4126 var getMethod$1 = getMethod$3;
4127 var Iterators = iterators;
4128 var wellKnownSymbol$1 = wellKnownSymbol$7;
4129
4130 var ITERATOR = wellKnownSymbol$1('iterator');
4131
4132 var getIteratorMethod$2 = function (it) {
4133   if (it != undefined) return getMethod$1(it, ITERATOR)
4134     || getMethod$1(it, '@@iterator')
4135     || Iterators[classof(it)];
4136 };
4137
4138 var global$3 = global$s;
4139 var call$2 = functionCall;
4140 var aCallable = aCallable$5;
4141 var anObject$4 = anObject$7;
4142 var tryToString$1 = tryToString$3;
4143 var getIteratorMethod$1 = getIteratorMethod$2;
4144
4145 var TypeError$2 = global$3.TypeError;
4146
4147 var getIterator$1 = function (argument, usingIterator) {
4148   var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
4149   if (aCallable(iteratorMethod)) return anObject$4(call$2(iteratorMethod, argument));
4150   throw TypeError$2(tryToString$1(argument) + ' is not iterable');
4151 };
4152
4153 var call$1 = functionCall;
4154 var anObject$3 = anObject$7;
4155 var getMethod = getMethod$3;
4156
4157 var iteratorClose$1 = function (iterator, kind, value) {
4158   var innerResult, innerError;
4159   anObject$3(iterator);
4160   try {
4161     innerResult = getMethod(iterator, 'return');
4162     if (!innerResult) {
4163       if (kind === 'throw') throw value;
4164       return value;
4165     }
4166     innerResult = call$1(innerResult, iterator);
4167   } catch (error) {
4168     innerError = true;
4169     innerResult = error;
4170   }
4171   if (kind === 'throw') throw value;
4172   if (innerError) throw innerResult;
4173   anObject$3(innerResult);
4174   return value;
4175 };
4176
4177 var global$2 = global$s;
4178 var bind$1 = functionBindContext;
4179 var call = functionCall;
4180 var anObject$2 = anObject$7;
4181 var tryToString = tryToString$3;
4182 var isArrayIteratorMethod = isArrayIteratorMethod$1;
4183 var lengthOfArrayLike$1 = lengthOfArrayLike$6;
4184 var isPrototypeOf = objectIsPrototypeOf;
4185 var getIterator = getIterator$1;
4186 var getIteratorMethod = getIteratorMethod$2;
4187 var iteratorClose = iteratorClose$1;
4188
4189 var TypeError$1 = global$2.TypeError;
4190
4191 var Result = function (stopped, result) {
4192   this.stopped = stopped;
4193   this.result = result;
4194 };
4195
4196 var ResultPrototype = Result.prototype;
4197
4198 var iterate$1 = function (iterable, unboundFunction, options) {
4199   var that = options && options.that;
4200   var AS_ENTRIES = !!(options && options.AS_ENTRIES);
4201   var IS_ITERATOR = !!(options && options.IS_ITERATOR);
4202   var INTERRUPTED = !!(options && options.INTERRUPTED);
4203   var fn = bind$1(unboundFunction, that);
4204   var iterator, iterFn, index, length, result, next, step;
4205
4206   var stop = function (condition) {
4207     if (iterator) iteratorClose(iterator, 'normal', condition);
4208     return new Result(true, condition);
4209   };
4210
4211   var callFn = function (value) {
4212     if (AS_ENTRIES) {
4213       anObject$2(value);
4214       return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
4215     } return INTERRUPTED ? fn(value, stop) : fn(value);
4216   };
4217
4218   if (IS_ITERATOR) {
4219     iterator = iterable;
4220   } else {
4221     iterFn = getIteratorMethod(iterable);
4222     if (!iterFn) throw TypeError$1(tryToString(iterable) + ' is not iterable');
4223     // optimisation for array iterators
4224     if (isArrayIteratorMethod(iterFn)) {
4225       for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
4226         result = callFn(iterable[index]);
4227         if (result && isPrototypeOf(ResultPrototype, result)) return result;
4228       } return new Result(false);
4229     }
4230     iterator = getIterator(iterable, iterFn);
4231   }
4232
4233   next = iterator.next;
4234   while (!(step = call(next, iterator)).done) {
4235     try {
4236       result = callFn(step.value);
4237     } catch (error) {
4238       iteratorClose(iterator, 'throw', error);
4239     }
4240     if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
4241   } return new Result(false);
4242 };
4243
4244 var toPropertyKey = toPropertyKey$3;
4245 var definePropertyModule$2 = objectDefineProperty;
4246 var createPropertyDescriptor = createPropertyDescriptor$3;
4247
4248 var createProperty$1 = function (object, key, value) {
4249   var propertyKey = toPropertyKey(key);
4250   if (propertyKey in object) definePropertyModule$2.f(object, propertyKey, createPropertyDescriptor(0, value));
4251   else object[propertyKey] = value;
4252 };
4253
4254 var $$1 = _export;
4255 var iterate = iterate$1;
4256 var createProperty = createProperty$1;
4257
4258 // `Object.fromEntries` method
4259 // https://github.com/tc39/proposal-object-from-entries
4260 $$1({ target: 'Object', stat: true }, {
4261   fromEntries: function fromEntries(iterable) {
4262     var obj = {};
4263     iterate(iterable, function (k, v) {
4264       createProperty(obj, k, v);
4265     }, { AS_ENTRIES: true });
4266     return obj;
4267   }
4268 });
4269
4270 const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {};
4271 var debug_1 = debug$1;
4272
4273 // Not necessarily the package version of this code.
4274
4275 const SEMVER_SPEC_VERSION = '2.0.0';
4276 const MAX_LENGTH$3 = 256;
4277 const MAX_SAFE_INTEGER$3 = Number.MAX_SAFE_INTEGER ||
4278 /* istanbul ignore next */
4279 9007199254740991; // Max safe segment length for coercion.
4280
4281 const MAX_SAFE_COMPONENT_LENGTH = 16;
4282 var constants$7 = {
4283   SEMVER_SPEC_VERSION,
4284   MAX_LENGTH: MAX_LENGTH$3,
4285   MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$3,
4286   MAX_SAFE_COMPONENT_LENGTH
4287 };
4288
4289 var re$1 = {exports: {}};
4290
4291 (function (module, exports) {
4292   const {
4293     MAX_SAFE_COMPONENT_LENGTH
4294   } = constants$7;
4295   const debug = debug_1;
4296   exports = module.exports = {}; // The actual regexps go on exports.re
4297
4298   const re = exports.re = [];
4299   const src = exports.src = [];
4300   const t = exports.t = {};
4301   let R = 0;
4302
4303   const createToken = (name, value, isGlobal) => {
4304     const index = R++;
4305     debug(index, value);
4306     t[name] = index;
4307     src[index] = value;
4308     re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
4309   }; // The following Regular Expressions can be used for tokenizing,
4310   // validating, and parsing SemVer version strings.
4311   // ## Numeric Identifier
4312   // A single `0`, or a non-zero digit followed by zero or more digits.
4313
4314
4315   createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
4316   createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); // ## Non-numeric Identifier
4317   // Zero or more digits, followed by a letter or hyphen, and then zero or
4318   // more letters, digits, or hyphens.
4319
4320   createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); // ## Main Version
4321   // Three dot-separated numeric identifiers.
4322
4323   createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
4324   createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); // ## Pre-release Version Identifier
4325   // A numeric identifier, or a non-numeric identifier.
4326
4327   createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
4328   createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`); // ## Pre-release Version
4329   // Hyphen, followed by one or more dot-separated pre-release version
4330   // identifiers.
4331
4332   createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
4333   createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); // ## Build Metadata Identifier
4334   // Any combination of digits, letters, or hyphens.
4335
4336   createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); // ## Build Metadata
4337   // Plus sign, followed by one or more period-separated build metadata
4338   // identifiers.
4339
4340   createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); // ## Full Version String
4341   // A main version, followed optionally by a pre-release version and
4342   // build metadata.
4343   // Note that the only major, minor, patch, and pre-release sections of
4344   // the version string are capturing groups.  The build metadata is not a
4345   // capturing group, because it should not ever be used in version
4346   // comparison.
4347
4348   createToken('FULLPLAIN', `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
4349   createToken('FULL', `^${src[t.FULLPLAIN]}$`); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
4350   // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
4351   // common in the npm registry.
4352
4353   createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
4354   createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
4355   createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x".
4356   // Note that "x.x" is a valid xRange identifer, meaning "any version"
4357   // Only the first item is strictly required.
4358
4359   createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
4360   createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
4361   createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
4362   createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
4363   createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
4364   createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); // Coercion.
4365   // Extract anything that could conceivably be a part of a valid semver
4366
4367   createToken('COERCE', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\d])`);
4368   createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges.
4369   // Meaning is "reasonably at or greater than"
4370
4371   createToken('LONETILDE', '(?:~>?)');
4372   createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
4373   exports.tildeTrimReplace = '$1~';
4374   createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
4375   createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); // Caret ranges.
4376   // Meaning is "at least and backwards compatible with"
4377
4378   createToken('LONECARET', '(?:\\^)');
4379   createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
4380   exports.caretTrimReplace = '$1^';
4381   createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
4382   createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); // A simple gt/lt/eq thing, or just "" to indicate "any version"
4383
4384   createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
4385   createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); // An expression to strip any whitespace between the gtlt and the thing
4386   // it modifies, so that `> 1.2.3` ==> `>1.2.3`
4387
4388   createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
4389   exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4`
4390   // Note that these all use the loose form, because they'll be
4391   // checked against either the strict or loose comparator form
4392   // later.
4393
4394   createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
4395   createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`); // Star ranges basically just allow anything at all.
4396
4397   createToken('STAR', '(<|>)?=?\\s*\\*'); // >=0.0.0 is like a star
4398
4399   createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$');
4400   createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$');
4401 })(re$1, re$1.exports);
4402
4403 // obj with keys in a consistent order.
4404
4405 const opts$1 = ['includePrerelease', 'loose', 'rtl'];
4406
4407 const parseOptions$1 = options => !options ? {} : typeof options !== 'object' ? {
4408   loose: true
4409 } : opts$1.filter(k => options[k]).reduce((options, k) => {
4410   options[k] = true;
4411   return options;
4412 }, {});
4413
4414 var parseOptions_1 = parseOptions$1;
4415
4416 const numeric$1 = /^[0-9]+$/;
4417
4418 const compareIdentifiers$1 = (a, b) => {
4419   const anum = numeric$1.test(a);
4420   const bnum = numeric$1.test(b);
4421
4422   if (anum && bnum) {
4423     a = +a;
4424     b = +b;
4425   }
4426
4427   return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
4428 };
4429
4430 const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
4431
4432 var identifiers = {
4433   compareIdentifiers: compareIdentifiers$1,
4434   rcompareIdentifiers
4435 };
4436
4437 const debug = debug_1;
4438 const {
4439   MAX_LENGTH: MAX_LENGTH$2,
4440   MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$2
4441 } = constants$7;
4442 const {
4443   re,
4444   t
4445 } = re$1.exports;
4446 const parseOptions = parseOptions_1;
4447 const {
4448   compareIdentifiers
4449 } = identifiers;
4450
4451 class SemVer$1 {
4452   constructor(version, options) {
4453     options = parseOptions(options);
4454
4455     if (version instanceof SemVer$1) {
4456       if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
4457         return version;
4458       } else {
4459         version = version.version;
4460       }
4461     } else if (typeof version !== 'string') {
4462       throw new TypeError(`Invalid Version: ${version}`);
4463     }
4464
4465     if (version.length > MAX_LENGTH$2) {
4466       throw new TypeError(`version is longer than ${MAX_LENGTH$2} characters`);
4467     }
4468
4469     debug('SemVer', version, options);
4470     this.options = options;
4471     this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we
4472     // don't run into trouble passing this.options around.
4473
4474     this.includePrerelease = !!options.includePrerelease;
4475     const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
4476
4477     if (!m) {
4478       throw new TypeError(`Invalid Version: ${version}`);
4479     }
4480
4481     this.raw = version; // these are actually numbers
4482
4483     this.major = +m[1];
4484     this.minor = +m[2];
4485     this.patch = +m[3];
4486
4487     if (this.major > MAX_SAFE_INTEGER$2 || this.major < 0) {
4488       throw new TypeError('Invalid major version');
4489     }
4490
4491     if (this.minor > MAX_SAFE_INTEGER$2 || this.minor < 0) {
4492       throw new TypeError('Invalid minor version');
4493     }
4494
4495     if (this.patch > MAX_SAFE_INTEGER$2 || this.patch < 0) {
4496       throw new TypeError('Invalid patch version');
4497     } // numberify any prerelease numeric ids
4498
4499
4500     if (!m[4]) {
4501       this.prerelease = [];
4502     } else {
4503       this.prerelease = m[4].split('.').map(id => {
4504         if (/^[0-9]+$/.test(id)) {
4505           const num = +id;
4506
4507           if (num >= 0 && num < MAX_SAFE_INTEGER$2) {
4508             return num;
4509           }
4510         }
4511
4512         return id;
4513       });
4514     }
4515
4516     this.build = m[5] ? m[5].split('.') : [];
4517     this.format();
4518   }
4519
4520   format() {
4521     this.version = `${this.major}.${this.minor}.${this.patch}`;
4522
4523     if (this.prerelease.length) {
4524       this.version += `-${this.prerelease.join('.')}`;
4525     }
4526
4527     return this.version;
4528   }
4529
4530   toString() {
4531     return this.version;
4532   }
4533
4534   compare(other) {
4535     debug('SemVer.compare', this.version, this.options, other);
4536
4537     if (!(other instanceof SemVer$1)) {
4538       if (typeof other === 'string' && other === this.version) {
4539         return 0;
4540       }
4541
4542       other = new SemVer$1(other, this.options);
4543     }
4544
4545     if (other.version === this.version) {
4546       return 0;
4547     }
4548
4549     return this.compareMain(other) || this.comparePre(other);
4550   }
4551
4552   compareMain(other) {
4553     if (!(other instanceof SemVer$1)) {
4554       other = new SemVer$1(other, this.options);
4555     }
4556
4557     return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
4558   }
4559
4560   comparePre(other) {
4561     if (!(other instanceof SemVer$1)) {
4562       other = new SemVer$1(other, this.options);
4563     } // NOT having a prerelease is > having one
4564
4565
4566     if (this.prerelease.length && !other.prerelease.length) {
4567       return -1;
4568     } else if (!this.prerelease.length && other.prerelease.length) {
4569       return 1;
4570     } else if (!this.prerelease.length && !other.prerelease.length) {
4571       return 0;
4572     }
4573
4574     let i = 0;
4575
4576     do {
4577       const a = this.prerelease[i];
4578       const b = other.prerelease[i];
4579       debug('prerelease compare', i, a, b);
4580
4581       if (a === undefined && b === undefined) {
4582         return 0;
4583       } else if (b === undefined) {
4584         return 1;
4585       } else if (a === undefined) {
4586         return -1;
4587       } else if (a === b) {
4588         continue;
4589       } else {
4590         return compareIdentifiers(a, b);
4591       }
4592     } while (++i);
4593   }
4594
4595   compareBuild(other) {
4596     if (!(other instanceof SemVer$1)) {
4597       other = new SemVer$1(other, this.options);
4598     }
4599
4600     let i = 0;
4601
4602     do {
4603       const a = this.build[i];
4604       const b = other.build[i];
4605       debug('prerelease compare', i, a, b);
4606
4607       if (a === undefined && b === undefined) {
4608         return 0;
4609       } else if (b === undefined) {
4610         return 1;
4611       } else if (a === undefined) {
4612         return -1;
4613       } else if (a === b) {
4614         continue;
4615       } else {
4616         return compareIdentifiers(a, b);
4617       }
4618     } while (++i);
4619   } // preminor will bump the version up to the next minor release, and immediately
4620   // down to pre-release. premajor and prepatch work the same way.
4621
4622
4623   inc(release, identifier) {
4624     switch (release) {
4625       case 'premajor':
4626         this.prerelease.length = 0;
4627         this.patch = 0;
4628         this.minor = 0;
4629         this.major++;
4630         this.inc('pre', identifier);
4631         break;
4632
4633       case 'preminor':
4634         this.prerelease.length = 0;
4635         this.patch = 0;
4636         this.minor++;
4637         this.inc('pre', identifier);
4638         break;
4639
4640       case 'prepatch':
4641         // If this is already a prerelease, it will bump to the next version
4642         // drop any prereleases that might already exist, since they are not
4643         // relevant at this point.
4644         this.prerelease.length = 0;
4645         this.inc('patch', identifier);
4646         this.inc('pre', identifier);
4647         break;
4648       // If the input is a non-prerelease version, this acts the same as
4649       // prepatch.
4650
4651       case 'prerelease':
4652         if (this.prerelease.length === 0) {
4653           this.inc('patch', identifier);
4654         }
4655
4656         this.inc('pre', identifier);
4657         break;
4658
4659       case 'major':
4660         // If this is a pre-major version, bump up to the same major version.
4661         // Otherwise increment major.
4662         // 1.0.0-5 bumps to 1.0.0
4663         // 1.1.0 bumps to 2.0.0
4664         if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
4665           this.major++;
4666         }
4667
4668         this.minor = 0;
4669         this.patch = 0;
4670         this.prerelease = [];
4671         break;
4672
4673       case 'minor':
4674         // If this is a pre-minor version, bump up to the same minor version.
4675         // Otherwise increment minor.
4676         // 1.2.0-5 bumps to 1.2.0
4677         // 1.2.1 bumps to 1.3.0
4678         if (this.patch !== 0 || this.prerelease.length === 0) {
4679           this.minor++;
4680         }
4681
4682         this.patch = 0;
4683         this.prerelease = [];
4684         break;
4685
4686       case 'patch':
4687         // If this is not a pre-release version, it will increment the patch.
4688         // If it is a pre-release it will bump up to the same patch version.
4689         // 1.2.0-5 patches to 1.2.0
4690         // 1.2.0 patches to 1.2.1
4691         if (this.prerelease.length === 0) {
4692           this.patch++;
4693         }
4694
4695         this.prerelease = [];
4696         break;
4697       // This probably shouldn't be used publicly.
4698       // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
4699
4700       case 'pre':
4701         if (this.prerelease.length === 0) {
4702           this.prerelease = [0];
4703         } else {
4704           let i = this.prerelease.length;
4705
4706           while (--i >= 0) {
4707             if (typeof this.prerelease[i] === 'number') {
4708               this.prerelease[i]++;
4709               i = -2;
4710             }
4711           }
4712
4713           if (i === -1) {
4714             // didn't increment anything
4715             this.prerelease.push(0);
4716           }
4717         }
4718
4719         if (identifier) {
4720           // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
4721           // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
4722           if (this.prerelease[0] === identifier) {
4723             if (isNaN(this.prerelease[1])) {
4724               this.prerelease = [identifier, 0];
4725             }
4726           } else {
4727             this.prerelease = [identifier, 0];
4728           }
4729         }
4730
4731         break;
4732
4733       default:
4734         throw new Error(`invalid increment argument: ${release}`);
4735     }
4736
4737     this.format();
4738     this.raw = this.version;
4739     return this;
4740   }
4741
4742 }
4743
4744 var semver$3 = SemVer$1;
4745
4746 const SemVer = semver$3;
4747
4748 const compare$3 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
4749
4750 var compare_1 = compare$3;
4751
4752 const compare$2 = compare_1;
4753
4754 const lt = (a, b, loose) => compare$2(a, b, loose) < 0;
4755
4756 var lt_1 = lt;
4757
4758 const compare$1 = compare_1;
4759
4760 const gte$1 = (a, b, loose) => compare$1(a, b, loose) >= 0;
4761
4762 var gte_1 = gte$1;
4763
4764 var arrayify$1 = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
4765   [keyName]: key
4766 }, value));
4767
4768 var lib$5 = {exports: {}};
4769
4770 (function (module, exports) {
4771
4772   Object.defineProperty(exports, "__esModule", {
4773     value: true
4774   });
4775   exports.outdent = void 0; // In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.
4776
4777   function noop() {
4778     var args = [];
4779
4780     for (var _i = 0; _i < arguments.length; _i++) {
4781       args[_i] = arguments[_i];
4782     }
4783   }
4784
4785   function createWeakMap() {
4786     if (typeof WeakMap !== "undefined") {
4787       return new WeakMap();
4788     } else {
4789       return fakeSetOrMap();
4790     }
4791   }
4792   /**
4793    * Creates and returns a no-op implementation of a WeakMap / WeakSet that never stores anything.
4794    */
4795
4796
4797   function fakeSetOrMap() {
4798     return {
4799       add: noop,
4800       delete: noop,
4801       get: noop,
4802       set: noop,
4803       has: function (k) {
4804         return false;
4805       }
4806     };
4807   } // Safe hasOwnProperty
4808
4809
4810   var hop = Object.prototype.hasOwnProperty;
4811
4812   var has = function (obj, prop) {
4813     return hop.call(obj, prop);
4814   }; // Copy all own enumerable properties from source to target
4815
4816
4817   function extend(target, source) {
4818     for (var prop in source) {
4819       if (has(source, prop)) {
4820         target[prop] = source[prop];
4821       }
4822     }
4823
4824     return target;
4825   }
4826
4827   var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
4828   var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
4829   var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
4830   var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
4831   var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
4832
4833   function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
4834     // If first interpolated value is a reference to outdent,
4835     // determine indentation level from the indentation of the interpolated value.
4836     var indentationLevel = 0;
4837     var match = strings[0].match(reDetectIndentation);
4838
4839     if (match) {
4840       indentationLevel = match[1].length;
4841     }
4842
4843     var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
4844     var reMatchIndent = new RegExp(reSource, "g");
4845
4846     if (firstInterpolatedValueSetsIndentationLevel) {
4847       strings = strings.slice(1);
4848     }
4849
4850     var newline = options.newline,
4851         trimLeadingNewline = options.trimLeadingNewline,
4852         trimTrailingNewline = options.trimTrailingNewline;
4853     var normalizeNewlines = typeof newline === "string";
4854     var l = strings.length;
4855     var outdentedStrings = strings.map(function (v, i) {
4856       // Remove leading indentation from all lines
4857       v = v.replace(reMatchIndent, "$1"); // Trim a leading newline from the first string
4858
4859       if (i === 0 && trimLeadingNewline) {
4860         v = v.replace(reLeadingNewline, "");
4861       } // Trim a trailing newline from the last string
4862
4863
4864       if (i === l - 1 && trimTrailingNewline) {
4865         v = v.replace(reTrailingNewline, "");
4866       } // Normalize newlines
4867
4868
4869       if (normalizeNewlines) {
4870         v = v.replace(/\r\n|\n|\r/g, function (_) {
4871           return newline;
4872         });
4873       }
4874
4875       return v;
4876     });
4877     return outdentedStrings;
4878   }
4879
4880   function concatStringsAndValues(strings, values) {
4881     var ret = "";
4882
4883     for (var i = 0, l = strings.length; i < l; i++) {
4884       ret += strings[i];
4885
4886       if (i < l - 1) {
4887         ret += values[i];
4888       }
4889     }
4890
4891     return ret;
4892   }
4893
4894   function isTemplateStringsArray(v) {
4895     return has(v, "raw") && has(v, "length");
4896   }
4897   /**
4898    * It is assumed that opts will not change.  If this is a problem, clone your options object and pass the clone to
4899    * makeInstance
4900    * @param options
4901    * @return {outdent}
4902    */
4903
4904
4905   function createInstance(options) {
4906     /** Cache of pre-processed template literal arrays */
4907     var arrayAutoIndentCache = createWeakMap();
4908     /**
4909        * Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent,
4910        * before interpolated values are injected.
4911        */
4912
4913     var arrayFirstInterpSetsIndentCache = createWeakMap();
4914
4915     function outdent(stringsOrOptions) {
4916       var values = [];
4917
4918       for (var _i = 1; _i < arguments.length; _i++) {
4919         values[_i - 1] = arguments[_i];
4920       }
4921       /* tslint:enable:no-shadowed-variable */
4922
4923
4924       if (isTemplateStringsArray(stringsOrOptions)) {
4925         var strings = stringsOrOptions; // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace?
4926
4927         var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]); // Perform outdentation
4928
4929         var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
4930         var renderedArray = cache.get(strings);
4931
4932         if (!renderedArray) {
4933           renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
4934           cache.set(strings, renderedArray);
4935         }
4936         /** If no interpolated values, skip concatenation step */
4937
4938
4939         if (values.length === 0) {
4940           return renderedArray[0];
4941         }
4942         /** Concatenate string literals with interpolated values */
4943
4944
4945         var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
4946         return rendered;
4947       } else {
4948         // Create and return a new instance of outdent with the given options
4949         return createInstance(extend(extend({}, options), stringsOrOptions || {}));
4950       }
4951     }
4952
4953     var fullOutdent = extend(outdent, {
4954       string: function (str) {
4955         return _outdentArray([str], false, options)[0];
4956       }
4957     });
4958     return fullOutdent;
4959   }
4960
4961   var defaultOutdent = createInstance({
4962     trimLeadingNewline: true,
4963     trimTrailingNewline: true
4964   });
4965   exports.outdent = defaultOutdent; // Named exports.  Simple and preferred.
4966   // import outdent from 'outdent';
4967
4968   exports.default = defaultOutdent;
4969
4970   {
4971     // In webpack harmony-modules environments, module.exports is read-only,
4972     // so we fail gracefully.
4973     try {
4974       module.exports = defaultOutdent;
4975       Object.defineProperty(defaultOutdent, "__esModule", {
4976         value: true
4977       });
4978       defaultOutdent.default = defaultOutdent;
4979       defaultOutdent.outdent = defaultOutdent;
4980     } catch (e) {}
4981   }
4982 })(lib$5, lib$5.exports);
4983
4984 const {
4985   outdent
4986 } = lib$5.exports;
4987 const CATEGORY_CONFIG = "Config";
4988 const CATEGORY_EDITOR = "Editor";
4989 const CATEGORY_FORMAT = "Format";
4990 const CATEGORY_OTHER = "Other";
4991 const CATEGORY_OUTPUT = "Output";
4992 const CATEGORY_GLOBAL = "Global";
4993 const CATEGORY_SPECIAL = "Special";
4994 /**
4995  * @typedef {Object} OptionInfo
4996  * @property {string} [since] - available since version
4997  * @property {string} category
4998  * @property {'int' | 'boolean' | 'choice' | 'path'} type
4999  * @property {boolean} [array] - indicate it's an array of the specified type
5000  * @property {OptionValueInfo} [default]
5001  * @property {OptionRangeInfo} [range] - for type int
5002  * @property {string} description
5003  * @property {string} [deprecated] - deprecated since version
5004  * @property {OptionRedirectInfo} [redirect] - redirect deprecated option
5005  * @property {(value: any) => boolean} [exception]
5006  * @property {OptionChoiceInfo[]} [choices] - for type choice
5007  * @property {string} [cliName]
5008  * @property {string} [cliCategory]
5009  * @property {string} [cliDescription]
5010  *
5011  * @typedef {number | boolean | string} OptionValue
5012  * @typedef {OptionValue | [{ value: OptionValue[] }] | Array<{ since: string, value: OptionValue}>} OptionValueInfo
5013  *
5014  * @typedef {Object} OptionRedirectInfo
5015  * @property {string} option
5016  * @property {OptionValue} value
5017  *
5018  * @typedef {Object} OptionRangeInfo
5019  * @property {number} start - recommended range start
5020  * @property {number} end - recommended range end
5021  * @property {number} step - recommended range step
5022  *
5023  * @typedef {Object} OptionChoiceInfo
5024  * @property {boolean | string} value - boolean for the option that is originally boolean type
5025  * @property {string} description
5026  * @property {string} [since] - undefined if available since the first version of the option
5027  * @property {string} [deprecated] - deprecated since version
5028  * @property {OptionValueInfo} [redirect] - redirect deprecated value
5029  */
5030
5031 /** @type {{ [name: string]: OptionInfo }} */
5032
5033 const options$e = {
5034   cursorOffset: {
5035     since: "1.4.0",
5036     category: CATEGORY_SPECIAL,
5037     type: "int",
5038     default: -1,
5039     range: {
5040       start: -1,
5041       end: Number.POSITIVE_INFINITY,
5042       step: 1
5043     },
5044     description: outdent`
5045       Print (to stderr) where a cursor at the given position would move to after formatting.
5046       This option cannot be used with --range-start and --range-end.
5047     `,
5048     cliCategory: CATEGORY_EDITOR
5049   },
5050   endOfLine: {
5051     since: "1.15.0",
5052     category: CATEGORY_GLOBAL,
5053     type: "choice",
5054     default: [{
5055       since: "1.15.0",
5056       value: "auto"
5057     }, {
5058       since: "2.0.0",
5059       value: "lf"
5060     }],
5061     description: "Which end of line characters to apply.",
5062     choices: [{
5063       value: "lf",
5064       description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
5065     }, {
5066       value: "crlf",
5067       description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
5068     }, {
5069       value: "cr",
5070       description: "Carriage Return character only (\\r), used very rarely"
5071     }, {
5072       value: "auto",
5073       description: outdent`
5074           Maintain existing
5075           (mixed values within one file are normalised by looking at what's used after the first line)
5076         `
5077     }]
5078   },
5079   filepath: {
5080     since: "1.4.0",
5081     category: CATEGORY_SPECIAL,
5082     type: "path",
5083     description: "Specify the input filepath. This will be used to do parser inference.",
5084     cliName: "stdin-filepath",
5085     cliCategory: CATEGORY_OTHER,
5086     cliDescription: "Path to the file to pretend that stdin comes from."
5087   },
5088   insertPragma: {
5089     since: "1.8.0",
5090     category: CATEGORY_SPECIAL,
5091     type: "boolean",
5092     default: false,
5093     description: "Insert @format pragma into file's first docblock comment.",
5094     cliCategory: CATEGORY_OTHER
5095   },
5096   parser: {
5097     since: "0.0.10",
5098     category: CATEGORY_GLOBAL,
5099     type: "choice",
5100     default: [{
5101       since: "0.0.10",
5102       value: "babylon"
5103     }, {
5104       since: "1.13.0",
5105       value: undefined
5106     }],
5107     description: "Which parser to use.",
5108     exception: value => typeof value === "string" || typeof value === "function",
5109     choices: [{
5110       value: "flow",
5111       description: "Flow"
5112     }, {
5113       value: "babel",
5114       since: "1.16.0",
5115       description: "JavaScript"
5116     }, {
5117       value: "babel-flow",
5118       since: "1.16.0",
5119       description: "Flow"
5120     }, {
5121       value: "babel-ts",
5122       since: "2.0.0",
5123       description: "TypeScript"
5124     }, {
5125       value: "typescript",
5126       since: "1.4.0",
5127       description: "TypeScript"
5128     }, {
5129       value: "espree",
5130       since: "2.2.0",
5131       description: "JavaScript"
5132     }, {
5133       value: "meriyah",
5134       since: "2.2.0",
5135       description: "JavaScript"
5136     }, {
5137       value: "css",
5138       since: "1.7.1",
5139       description: "CSS"
5140     }, {
5141       value: "less",
5142       since: "1.7.1",
5143       description: "Less"
5144     }, {
5145       value: "scss",
5146       since: "1.7.1",
5147       description: "SCSS"
5148     }, {
5149       value: "json",
5150       since: "1.5.0",
5151       description: "JSON"
5152     }, {
5153       value: "json5",
5154       since: "1.13.0",
5155       description: "JSON5"
5156     }, {
5157       value: "json-stringify",
5158       since: "1.13.0",
5159       description: "JSON.stringify"
5160     }, {
5161       value: "graphql",
5162       since: "1.5.0",
5163       description: "GraphQL"
5164     }, {
5165       value: "markdown",
5166       since: "1.8.0",
5167       description: "Markdown"
5168     }, {
5169       value: "mdx",
5170       since: "1.15.0",
5171       description: "MDX"
5172     }, {
5173       value: "vue",
5174       since: "1.10.0",
5175       description: "Vue"
5176     }, {
5177       value: "yaml",
5178       since: "1.14.0",
5179       description: "YAML"
5180     }, {
5181       value: "glimmer",
5182       since: "2.3.0",
5183       description: "Ember / Handlebars"
5184     }, {
5185       value: "html",
5186       since: "1.15.0",
5187       description: "HTML"
5188     }, {
5189       value: "angular",
5190       since: "1.15.0",
5191       description: "Angular"
5192     }, {
5193       value: "lwc",
5194       since: "1.17.0",
5195       description: "Lightning Web Components"
5196     }]
5197   },
5198   plugins: {
5199     since: "1.10.0",
5200     type: "path",
5201     array: true,
5202     default: [{
5203       value: []
5204     }],
5205     category: CATEGORY_GLOBAL,
5206     description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
5207     exception: value => typeof value === "string" || typeof value === "object",
5208     cliName: "plugin",
5209     cliCategory: CATEGORY_CONFIG
5210   },
5211   pluginSearchDirs: {
5212     since: "1.13.0",
5213     type: "path",
5214     array: true,
5215     default: [{
5216       value: []
5217     }],
5218     category: CATEGORY_GLOBAL,
5219     description: outdent`
5220       Custom directory that contains prettier plugins in node_modules subdirectory.
5221       Overrides default behavior when plugins are searched relatively to the location of Prettier.
5222       Multiple values are accepted.
5223     `,
5224     exception: value => typeof value === "string" || typeof value === "object",
5225     cliName: "plugin-search-dir",
5226     cliCategory: CATEGORY_CONFIG
5227   },
5228   printWidth: {
5229     since: "0.0.0",
5230     category: CATEGORY_GLOBAL,
5231     type: "int",
5232     default: 80,
5233     description: "The line length where Prettier will try wrap.",
5234     range: {
5235       start: 0,
5236       end: Number.POSITIVE_INFINITY,
5237       step: 1
5238     }
5239   },
5240   rangeEnd: {
5241     since: "1.4.0",
5242     category: CATEGORY_SPECIAL,
5243     type: "int",
5244     default: Number.POSITIVE_INFINITY,
5245     range: {
5246       start: 0,
5247       end: Number.POSITIVE_INFINITY,
5248       step: 1
5249     },
5250     description: outdent`
5251       Format code ending at a given character offset (exclusive).
5252       The range will extend forwards to the end of the selected statement.
5253       This option cannot be used with --cursor-offset.
5254     `,
5255     cliCategory: CATEGORY_EDITOR
5256   },
5257   rangeStart: {
5258     since: "1.4.0",
5259     category: CATEGORY_SPECIAL,
5260     type: "int",
5261     default: 0,
5262     range: {
5263       start: 0,
5264       end: Number.POSITIVE_INFINITY,
5265       step: 1
5266     },
5267     description: outdent`
5268       Format code starting at a given character offset.
5269       The range will extend backwards to the start of the first line containing the selected statement.
5270       This option cannot be used with --cursor-offset.
5271     `,
5272     cliCategory: CATEGORY_EDITOR
5273   },
5274   requirePragma: {
5275     since: "1.7.0",
5276     category: CATEGORY_SPECIAL,
5277     type: "boolean",
5278     default: false,
5279     description: outdent`
5280       Require either '@prettier' or '@format' to be present in the file's first docblock comment
5281       in order for it to be formatted.
5282     `,
5283     cliCategory: CATEGORY_OTHER
5284   },
5285   tabWidth: {
5286     type: "int",
5287     category: CATEGORY_GLOBAL,
5288     default: 2,
5289     description: "Number of spaces per indentation level.",
5290     range: {
5291       start: 0,
5292       end: Number.POSITIVE_INFINITY,
5293       step: 1
5294     }
5295   },
5296   useTabs: {
5297     since: "1.0.0",
5298     category: CATEGORY_GLOBAL,
5299     type: "boolean",
5300     default: false,
5301     description: "Indent with tabs instead of spaces."
5302   },
5303   embeddedLanguageFormatting: {
5304     since: "2.1.0",
5305     category: CATEGORY_GLOBAL,
5306     type: "choice",
5307     default: [{
5308       since: "2.1.0",
5309       value: "auto"
5310     }],
5311     description: "Control how Prettier formats quoted code embedded in the file.",
5312     choices: [{
5313       value: "auto",
5314       description: "Format embedded code if Prettier can automatically identify it."
5315     }, {
5316       value: "off",
5317       description: "Never automatically format embedded code."
5318     }]
5319   }
5320 };
5321 var coreOptions$1 = {
5322   CATEGORY_CONFIG,
5323   CATEGORY_EDITOR,
5324   CATEGORY_FORMAT,
5325   CATEGORY_OTHER,
5326   CATEGORY_OUTPUT,
5327   CATEGORY_GLOBAL,
5328   CATEGORY_SPECIAL,
5329   options: options$e
5330 };
5331
5332 const _excluded$3 = ["cliName", "cliCategory", "cliDescription"];
5333
5334 const semver$2 = {
5335   compare: compare_1,
5336   lt: lt_1,
5337   gte: gte_1
5338 };
5339 const arrayify = arrayify$1;
5340 const currentVersion = require$$0$5.version;
5341 const coreOptions = coreOptions$1.options;
5342 /**
5343  * Strings in `plugins` and `pluginSearchDirs` are handled by a wrapped version
5344  * of this function created by `withPlugins`. Don't pass them here directly.
5345  * @param {object} param0
5346  * @param {(string | object)[]=} param0.plugins Strings are resolved by `withPlugins`.
5347  * @param {string[]=} param0.pluginSearchDirs Added by `withPlugins`.
5348  * @param {boolean=} param0.showUnreleased
5349  * @param {boolean=} param0.showDeprecated
5350  * @param {boolean=} param0.showInternal
5351  */
5352
5353 function getSupportInfo$3({
5354   plugins = [],
5355   showUnreleased = false,
5356   showDeprecated = false,
5357   showInternal = false
5358 } = {}) {
5359   // pre-release version is smaller than the normal version in semver,
5360   // we need to treat it as the normal one so as to test new features.
5361   const version = currentVersion.split("-", 1)[0];
5362   const languages = plugins.flatMap(plugin => plugin.languages || []).filter(filterSince);
5363   const options = arrayify(Object.assign({}, ...plugins.map(({
5364     options
5365   }) => options), coreOptions), "name").filter(option => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map(option => {
5366     option = Object.assign({}, option);
5367
5368     if (Array.isArray(option.default)) {
5369       option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver$2.compare(info2.since, info1.since))[0].value;
5370     }
5371
5372     if (Array.isArray(option.choices)) {
5373       option.choices = option.choices.filter(option => filterSince(option) && filterDeprecated(option));
5374
5375       if (option.name === "parser") {
5376         collectParsersFromLanguages(option, languages, plugins);
5377       }
5378     }
5379
5380     const pluginDefaults = Object.fromEntries(plugins.filter(plugin => plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined).map(plugin => [plugin.name, plugin.defaultOptions[option.name]]));
5381     return Object.assign(Object.assign({}, option), {}, {
5382       pluginDefaults
5383     });
5384   });
5385   return {
5386     languages,
5387     options
5388   };
5389
5390   function filterSince(object) {
5391     return showUnreleased || !("since" in object) || object.since && semver$2.gte(version, object.since);
5392   }
5393
5394   function filterDeprecated(object) {
5395     return showDeprecated || !("deprecated" in object) || object.deprecated && semver$2.lt(version, object.deprecated);
5396   }
5397
5398   function mapInternal(object) {
5399     if (showInternal) {
5400       return object;
5401     }
5402
5403     const newObject = _objectWithoutProperties(object, _excluded$3);
5404
5405     return newObject;
5406   }
5407 }
5408
5409 function collectParsersFromLanguages(option, languages, plugins) {
5410   const existingValues = new Set(option.choices.map(choice => choice.value));
5411
5412   for (const language of languages) {
5413     if (language.parsers) {
5414       for (const value of language.parsers) {
5415         if (!existingValues.has(value)) {
5416           existingValues.add(value);
5417           const plugin = plugins.find(plugin => plugin.parsers && plugin.parsers[value]);
5418           let description = language.name;
5419
5420           if (plugin && plugin.name) {
5421             description += ` (plugin: ${plugin.name})`;
5422           }
5423
5424           option.choices.push({
5425             value,
5426             description
5427           });
5428         }
5429       }
5430     }
5431   }
5432 }
5433
5434 var support = {
5435   getSupportInfo: getSupportInfo$3
5436 };
5437
5438 const stringWidth = stringWidth$2.exports;
5439 const escapeStringRegexp$2 = escapeStringRegexp$3;
5440 const getLast$o = getLast_1;
5441 const {
5442   getSupportInfo: getSupportInfo$2
5443 } = support;
5444 const notAsciiRegex = /[^\x20-\x7F]/;
5445
5446 const getPenultimate$1 = arr => arr[arr.length - 2];
5447 /**
5448  * @typedef {{backwards?: boolean}} SkipOptions
5449  */
5450
5451 /**
5452  * @param {string | RegExp} chars
5453  * @returns {(text: string, index: number | false, opts?: SkipOptions) => number | false}
5454  */
5455
5456
5457 function skip$1(chars) {
5458   return (text, index, opts) => {
5459     const backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
5460     // to check for failures (did someone say monads?).
5461
5462     /* istanbul ignore next */
5463
5464     if (index === false) {
5465       return false;
5466     }
5467
5468     const {
5469       length
5470     } = text;
5471     let cursor = index;
5472
5473     while (cursor >= 0 && cursor < length) {
5474       const c = text.charAt(cursor);
5475
5476       if (chars instanceof RegExp) {
5477         if (!chars.test(c)) {
5478           return cursor;
5479         }
5480       } else if (!chars.includes(c)) {
5481         return cursor;
5482       }
5483
5484       backwards ? cursor-- : cursor++;
5485     }
5486
5487     if (cursor === -1 || cursor === length) {
5488       // If we reached the beginning or end of the file, return the
5489       // out-of-bounds cursor. It's up to the caller to handle this
5490       // correctly. We don't want to indicate `false` though if it
5491       // actually skipped valid characters.
5492       return cursor;
5493     }
5494
5495     return false;
5496   };
5497 }
5498 /**
5499  * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
5500  */
5501
5502
5503 const skipWhitespace$2 = skip$1(/\s/);
5504 /**
5505  * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
5506  */
5507
5508 const skipSpaces$2 = skip$1(" \t");
5509 /**
5510  * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
5511  */
5512
5513 const skipToLineEnd$1 = skip$1(",; \t");
5514 /**
5515  * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
5516  */
5517
5518 const skipEverythingButNewLine$2 = skip$1(/[^\n\r]/);
5519 /**
5520  * @param {string} text
5521  * @param {number | false} index
5522  * @returns {number | false}
5523  */
5524
5525 function skipInlineComment$1(text, index) {
5526   /* istanbul ignore next */
5527   if (index === false) {
5528     return false;
5529   }
5530
5531   if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
5532     for (let i = index + 2; i < text.length; ++i) {
5533       if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
5534         return i + 2;
5535       }
5536     }
5537   }
5538
5539   return index;
5540 }
5541 /**
5542  * @param {string} text
5543  * @param {number | false} index
5544  * @returns {number | false}
5545  */
5546
5547
5548 function skipTrailingComment$1(text, index) {
5549   /* istanbul ignore next */
5550   if (index === false) {
5551     return false;
5552   }
5553
5554   if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
5555     return skipEverythingButNewLine$2(text, index);
5556   }
5557
5558   return index;
5559 } // This one doesn't use the above helper function because it wants to
5560 // test \r\n in order and `skip` doesn't support ordering and we only
5561 // want to skip one newline. It's simple to implement.
5562
5563 /**
5564  * @param {string} text
5565  * @param {number | false} index
5566  * @param {SkipOptions=} opts
5567  * @returns {number | false}
5568  */
5569
5570
5571 function skipNewline$2(text, index, opts) {
5572   const backwards = opts && opts.backwards;
5573
5574   if (index === false) {
5575     return false;
5576   }
5577
5578   const atIndex = text.charAt(index);
5579
5580   if (backwards) {
5581     // We already replace `\r\n` with `\n` before parsing
5582
5583     /* istanbul ignore next */
5584     if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
5585       return index - 2;
5586     }
5587
5588     if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
5589       return index - 1;
5590     }
5591   } else {
5592     // We already replace `\r\n` with `\n` before parsing
5593
5594     /* istanbul ignore next */
5595     if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
5596       return index + 2;
5597     }
5598
5599     if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
5600       return index + 1;
5601     }
5602   }
5603
5604   return index;
5605 }
5606 /**
5607  * @param {string} text
5608  * @param {number} index
5609  * @param {SkipOptions=} opts
5610  * @returns {boolean}
5611  */
5612
5613
5614 function hasNewline$a(text, index, opts = {}) {
5615   const idx = skipSpaces$2(text, opts.backwards ? index - 1 : index, opts);
5616   const idx2 = skipNewline$2(text, idx, opts);
5617   return idx !== idx2;
5618 }
5619 /**
5620  * @param {string} text
5621  * @param {number} start
5622  * @param {number} end
5623  * @returns {boolean}
5624  */
5625
5626
5627 function hasNewlineInRange$5(text, start, end) {
5628   for (let i = start; i < end; ++i) {
5629     if (text.charAt(i) === "\n") {
5630       return true;
5631     }
5632   }
5633
5634   return false;
5635 } // Note: this function doesn't ignore leading comments unlike isNextLineEmpty
5636
5637 /**
5638  * @template N
5639  * @param {string} text
5640  * @param {N} node
5641  * @param {(node: N) => number} locStart
5642  */
5643
5644
5645 function isPreviousLineEmpty$3(text, node, locStart) {
5646   /** @type {number | false} */
5647   let idx = locStart(node) - 1;
5648   idx = skipSpaces$2(text, idx, {
5649     backwards: true
5650   });
5651   idx = skipNewline$2(text, idx, {
5652     backwards: true
5653   });
5654   idx = skipSpaces$2(text, idx, {
5655     backwards: true
5656   });
5657   const idx2 = skipNewline$2(text, idx, {
5658     backwards: true
5659   });
5660   return idx !== idx2;
5661 }
5662 /**
5663  * @param {string} text
5664  * @param {number} index
5665  * @returns {boolean}
5666  */
5667
5668
5669 function isNextLineEmptyAfterIndex$3(text, index) {
5670   /** @type {number | false} */
5671   let oldIdx = null;
5672   /** @type {number | false} */
5673
5674   let idx = index;
5675
5676   while (idx !== oldIdx) {
5677     // We need to skip all the potential trailing inline comments
5678     oldIdx = idx;
5679     idx = skipToLineEnd$1(text, idx);
5680     idx = skipInlineComment$1(text, idx);
5681     idx = skipSpaces$2(text, idx);
5682   }
5683
5684   idx = skipTrailingComment$1(text, idx);
5685   idx = skipNewline$2(text, idx);
5686   return idx !== false && hasNewline$a(text, idx);
5687 }
5688 /**
5689  * @template N
5690  * @param {string} text
5691  * @param {N} node
5692  * @param {(node: N) => number} locEnd
5693  * @returns {boolean}
5694  */
5695
5696
5697 function isNextLineEmpty$e(text, node, locEnd) {
5698   return isNextLineEmptyAfterIndex$3(text, locEnd(node));
5699 }
5700 /**
5701  * @param {string} text
5702  * @param {number} idx
5703  * @returns {number | false}
5704  */
5705
5706
5707 function getNextNonSpaceNonCommentCharacterIndexWithStartIndex$1(text, idx) {
5708   /** @type {number | false} */
5709   let oldIdx = null;
5710   /** @type {number | false} */
5711
5712   let nextIdx = idx;
5713
5714   while (nextIdx !== oldIdx) {
5715     oldIdx = nextIdx;
5716     nextIdx = skipSpaces$2(text, nextIdx);
5717     nextIdx = skipInlineComment$1(text, nextIdx);
5718     nextIdx = skipTrailingComment$1(text, nextIdx);
5719     nextIdx = skipNewline$2(text, nextIdx);
5720   }
5721
5722   return nextIdx;
5723 }
5724 /**
5725  * @template N
5726  * @param {string} text
5727  * @param {N} node
5728  * @param {(node: N) => number} locEnd
5729  * @returns {number | false}
5730  */
5731
5732
5733 function getNextNonSpaceNonCommentCharacterIndex$4(text, node, locEnd) {
5734   return getNextNonSpaceNonCommentCharacterIndexWithStartIndex$1(text, locEnd(node));
5735 }
5736 /**
5737  * @template N
5738  * @param {string} text
5739  * @param {N} node
5740  * @param {(node: N) => number} locEnd
5741  * @returns {string}
5742  */
5743
5744
5745 function getNextNonSpaceNonCommentCharacter$2(text, node, locEnd) {
5746   return text.charAt( // @ts-expect-error => TBD: can return false, should we define a fallback?
5747   getNextNonSpaceNonCommentCharacterIndex$4(text, node, locEnd));
5748 } // Not using, but it's public utils
5749
5750 /* istanbul ignore next */
5751
5752 /**
5753  * @param {string} text
5754  * @param {number} index
5755  * @param {SkipOptions=} opts
5756  * @returns {boolean}
5757  */
5758
5759
5760 function hasSpaces$1(text, index, opts = {}) {
5761   const idx = skipSpaces$2(text, opts.backwards ? index - 1 : index, opts);
5762   return idx !== index;
5763 }
5764 /**
5765  * @param {string} value
5766  * @param {number} tabWidth
5767  * @param {number=} startIndex
5768  * @returns {number}
5769  */
5770
5771
5772 function getAlignmentSize$2(value, tabWidth, startIndex = 0) {
5773   let size = 0;
5774
5775   for (let i = startIndex; i < value.length; ++i) {
5776     if (value[i] === "\t") {
5777       // Tabs behave in a way that they are aligned to the nearest
5778       // multiple of tabWidth:
5779       // 0 -> 4, 1 -> 4, 2 -> 4, 3 -> 4
5780       // 4 -> 8, 5 -> 8, 6 -> 8, 7 -> 8 ...
5781       size = size + tabWidth - size % tabWidth;
5782     } else {
5783       size++;
5784     }
5785   }
5786
5787   return size;
5788 }
5789 /**
5790  * @param {string} value
5791  * @param {number} tabWidth
5792  * @returns {number}
5793  */
5794
5795
5796 function getIndentSize$2(value, tabWidth) {
5797   const lastNewlineIndex = value.lastIndexOf("\n");
5798
5799   if (lastNewlineIndex === -1) {
5800     return 0;
5801   }
5802
5803   return getAlignmentSize$2( // All the leading whitespaces
5804   value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
5805 }
5806 /**
5807  * @typedef {'"' | "'"} Quote
5808  */
5809
5810 /**
5811  *
5812  * @param {string} rawContent
5813  * @param {Quote} preferredQuote
5814  * @returns {{ quote: Quote, regex: RegExp, escaped: string }}
5815  */
5816
5817
5818 function getPreferredQuote$2(rawContent, preferredQuote) {
5819   /** @type {{ quote: '"', regex: RegExp, escaped: "&quot;" }} */
5820   const double = {
5821     quote: '"',
5822     regex: /"/g,
5823     escaped: "&quot;"
5824   };
5825   /** @type {{ quote: "'", regex: RegExp, escaped: "&apos;" }} */
5826
5827   const single = {
5828     quote: "'",
5829     regex: /'/g,
5830     escaped: "&apos;"
5831   };
5832   const preferred = preferredQuote === "'" ? single : double;
5833   const alternate = preferred === single ? double : single;
5834   let result = preferred; // If `rawContent` contains at least one of the quote preferred for enclosing
5835   // the string, we might want to enclose with the alternate quote instead, to
5836   // minimize the number of escaped quotes.
5837
5838   if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
5839     const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
5840     const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
5841     result = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;
5842   }
5843
5844   return result;
5845 }
5846
5847 function printString$4(raw, options) {
5848   // `rawContent` is the string exactly like it appeared in the input source
5849   // code, without its enclosing quotes.
5850   const rawContent = raw.slice(1, -1);
5851   /** @type {Quote} */
5852
5853   const enclosingQuote = options.parser === "json" || options.parser === "json5" && options.quoteProps === "preserve" && !options.singleQuote ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote$2(rawContent, options.singleQuote ? "'" : '"').quote; // It might sound unnecessary to use `makeString` even if the string already
5854   // is enclosed with `enclosingQuote`, but it isn't. The string could contain
5855   // unnecessary escapes (such as in `"\'"`). Always using `makeString` makes
5856   // sure that we consistently output the minimum amount of escaped quotes.
5857
5858   return makeString$1(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.__embeddedInHtml));
5859 }
5860 /**
5861  * @param {string} rawContent
5862  * @param {Quote} enclosingQuote
5863  * @param {boolean=} unescapeUnnecessaryEscapes
5864  * @returns {string}
5865  */
5866
5867
5868 function makeString$1(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
5869   const otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double).
5870
5871   const regex = /\\(.)|(["'])/gs; // Escape and unescape single and double quotes as needed to be able to
5872   // enclose `rawContent` with `enclosingQuote`.
5873
5874   const newContent = rawContent.replace(regex, (match, escaped, quote) => {
5875     // If we matched an escape, and the escaped character is a quote of the
5876     // other type than we intend to enclose the string with, there's no need for
5877     // it to be escaped, so return it _without_ the backslash.
5878     if (escaped === otherQuote) {
5879       return escaped;
5880     } // If we matched an unescaped quote and it is of the _same_ type as we
5881     // intend to enclose the string with, it must be escaped, so return it with
5882     // a backslash.
5883
5884
5885     if (quote === enclosingQuote) {
5886       return "\\" + quote;
5887     }
5888
5889     if (quote) {
5890       return quote;
5891     } // Unescape any unnecessarily escaped character.
5892     // Adapted from https://github.com/eslint/eslint/blob/de0b4ad7bd820ade41b1f606008bea68683dc11a/lib/rules/no-useless-escape.js#L27
5893
5894
5895     return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
5896   });
5897   return enclosingQuote + newContent + enclosingQuote;
5898 }
5899
5900 function printNumber$4(rawNumber) {
5901   return rawNumber.toLowerCase() // Remove unnecessary plus and zeroes from scientific notation.
5902   .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") // Remove unnecessary scientific notation (1e0).
5903   .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") // Make sure numbers always start with a digit.
5904   .replace(/^([+-])?\./, "$10.") // Remove extraneous trailing decimal zeroes.
5905   .replace(/(\.\d+?)0+(?=e|$)/, "$1") // Remove trailing dot.
5906   .replace(/\.(?=e|$)/, "");
5907 }
5908 /**
5909  * @param {string} str
5910  * @param {string} target
5911  * @returns {number}
5912  */
5913
5914
5915 function getMaxContinuousCount$3(str, target) {
5916   const results = str.match(new RegExp(`(${escapeStringRegexp$2(target)})+`, "g"));
5917
5918   if (results === null) {
5919     return 0;
5920   }
5921
5922   return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
5923 }
5924
5925 function getMinNotPresentContinuousCount$1(str, target) {
5926   const matches = str.match(new RegExp(`(${escapeStringRegexp$2(target)})+`, "g"));
5927
5928   if (matches === null) {
5929     return 0;
5930   }
5931
5932   const countPresent = new Map();
5933   let max = 0;
5934
5935   for (const match of matches) {
5936     const count = match.length / target.length;
5937     countPresent.set(count, true);
5938
5939     if (count > max) {
5940       max = count;
5941     }
5942   }
5943
5944   for (let i = 1; i < max; i++) {
5945     if (!countPresent.get(i)) {
5946       return i;
5947     }
5948   }
5949
5950   return max + 1;
5951 }
5952 /**
5953  * @param {string} text
5954  * @returns {number}
5955  */
5956
5957
5958 function getStringWidth$5(text) {
5959   if (!text) {
5960     return 0;
5961   } // shortcut to avoid needless string `RegExp`s, replacements, and allocations within `string-width`
5962
5963
5964   if (!notAsciiRegex.test(text)) {
5965     return text.length;
5966   }
5967
5968   return stringWidth(text);
5969 }
5970
5971 function addCommentHelper(node, comment) {
5972   const comments = node.comments || (node.comments = []);
5973   comments.push(comment);
5974   comment.printed = false;
5975   comment.nodeDescription = describeNodeForDebugging(node);
5976 }
5977
5978 function addLeadingComment$3(node, comment) {
5979   comment.leading = true;
5980   comment.trailing = false;
5981   addCommentHelper(node, comment);
5982 }
5983
5984 function addDanglingComment$3(node, comment, marker) {
5985   comment.leading = false;
5986   comment.trailing = false;
5987
5988   if (marker) {
5989     comment.marker = marker;
5990   }
5991
5992   addCommentHelper(node, comment);
5993 }
5994
5995 function addTrailingComment$3(node, comment) {
5996   comment.leading = false;
5997   comment.trailing = true;
5998   addCommentHelper(node, comment);
5999 }
6000
6001 function inferParserByLanguage$2(language, options) {
6002   const {
6003     languages
6004   } = getSupportInfo$2({
6005     plugins: options.plugins
6006   });
6007   const matched = languages.find(({
6008     name
6009   }) => name.toLowerCase() === language) || languages.find(({
6010     aliases
6011   }) => Array.isArray(aliases) && aliases.includes(language)) || languages.find(({
6012     extensions
6013   }) => Array.isArray(extensions) && extensions.includes(`.${language}`));
6014   return matched && matched.parsers[0];
6015 }
6016
6017 function isFrontMatterNode$5(node) {
6018   return node && node.type === "front-matter";
6019 }
6020
6021 function getShebang$1(text) {
6022   if (!text.startsWith("#!")) {
6023     return "";
6024   }
6025
6026   const index = text.indexOf("\n");
6027
6028   if (index === -1) {
6029     return text;
6030   }
6031
6032   return text.slice(0, index);
6033 }
6034 /**
6035  * @param {any} object
6036  * @returns {object is Array<any>}
6037  */
6038
6039
6040 function isNonEmptyArray$j(object) {
6041   return Array.isArray(object) && object.length > 0;
6042 }
6043 /**
6044  * @param {string} description
6045  * @returns {(node: any) => symbol}
6046  */
6047
6048
6049 function createGroupIdMapper$2(description) {
6050   const groupIds = new WeakMap();
6051   return function (node) {
6052     if (!groupIds.has(node)) {
6053       groupIds.set(node, Symbol(description));
6054     }
6055
6056     return groupIds.get(node);
6057   };
6058 }
6059
6060 function describeNodeForDebugging(node) {
6061   const nodeType = node.type || node.kind || "(unknown type)";
6062   let nodeName = String(node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "");
6063
6064   if (nodeName.length > 20) {
6065     nodeName = nodeName.slice(0, 19) + "…";
6066   }
6067
6068   return nodeType + (nodeName ? " " + nodeName : "");
6069 }
6070
6071 var util$8 = {
6072   inferParserByLanguage: inferParserByLanguage$2,
6073   getStringWidth: getStringWidth$5,
6074   getMaxContinuousCount: getMaxContinuousCount$3,
6075   getMinNotPresentContinuousCount: getMinNotPresentContinuousCount$1,
6076   getPenultimate: getPenultimate$1,
6077   getLast: getLast$o,
6078   getNextNonSpaceNonCommentCharacterIndexWithStartIndex: getNextNonSpaceNonCommentCharacterIndexWithStartIndex$1,
6079   getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$4,
6080   getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter$2,
6081   skip: skip$1,
6082   skipWhitespace: skipWhitespace$2,
6083   skipSpaces: skipSpaces$2,
6084   skipToLineEnd: skipToLineEnd$1,
6085   skipEverythingButNewLine: skipEverythingButNewLine$2,
6086   skipInlineComment: skipInlineComment$1,
6087   skipTrailingComment: skipTrailingComment$1,
6088   skipNewline: skipNewline$2,
6089   isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$3,
6090   isNextLineEmpty: isNextLineEmpty$e,
6091   isPreviousLineEmpty: isPreviousLineEmpty$3,
6092   hasNewline: hasNewline$a,
6093   hasNewlineInRange: hasNewlineInRange$5,
6094   hasSpaces: hasSpaces$1,
6095   getAlignmentSize: getAlignmentSize$2,
6096   getIndentSize: getIndentSize$2,
6097   getPreferredQuote: getPreferredQuote$2,
6098   printString: printString$4,
6099   printNumber: printNumber$4,
6100   makeString: makeString$1,
6101   addLeadingComment: addLeadingComment$3,
6102   addDanglingComment: addDanglingComment$3,
6103   addTrailingComment: addTrailingComment$3,
6104   isFrontMatterNode: isFrontMatterNode$5,
6105   getShebang: getShebang$1,
6106   isNonEmptyArray: isNonEmptyArray$j,
6107   createGroupIdMapper: createGroupIdMapper$2
6108 };
6109
6110 function guessEndOfLine$1(text) {
6111   const index = text.indexOf("\r");
6112
6113   if (index >= 0) {
6114     return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
6115   }
6116
6117   return "lf";
6118 }
6119
6120 function convertEndOfLineToChars$1(value) {
6121   switch (value) {
6122     case "cr":
6123       return "\r";
6124
6125     case "crlf":
6126       return "\r\n";
6127
6128     default:
6129       return "\n";
6130   }
6131 }
6132
6133 function countEndOfLineChars$1(text, eol) {
6134   let regex;
6135   /* istanbul ignore else */
6136
6137   if (eol === "\n") {
6138     regex = /\n/g;
6139   } else if (eol === "\r") {
6140     regex = /\r/g;
6141   } else if (eol === "\r\n") {
6142     regex = /\r\n/g;
6143   } else {
6144     throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
6145   }
6146
6147   const endOfLines = text.match(regex);
6148   return endOfLines ? endOfLines.length : 0;
6149 }
6150
6151 function normalizeEndOfLine$2(text) {
6152   return text.replace(/\r\n?/g, "\n");
6153 }
6154
6155 var endOfLine = {
6156   guessEndOfLine: guessEndOfLine$1,
6157   convertEndOfLineToChars: convertEndOfLineToChars$1,
6158   countEndOfLineChars: countEndOfLineChars$1,
6159   normalizeEndOfLine: normalizeEndOfLine$2
6160 };
6161
6162 const fs$l = require$$0__default["default"];
6163 /**
6164  * @class
6165  */
6166
6167 class LineByLine {
6168   constructor(file, options) {
6169     options = options || {};
6170     if (!options.readChunk) options.readChunk = 1024;
6171
6172     if (!options.newLineCharacter) {
6173       options.newLineCharacter = 0x0a; //linux line ending
6174     } else {
6175       options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
6176     }
6177
6178     if (typeof file === 'number') {
6179       this.fd = file;
6180     } else {
6181       this.fd = fs$l.openSync(file, 'r');
6182     }
6183
6184     this.options = options;
6185     this.newLineCharacter = options.newLineCharacter;
6186     this.reset();
6187   }
6188
6189   _searchInBuffer(buffer, hexNeedle) {
6190     let found = -1;
6191
6192     for (let i = 0; i <= buffer.length; i++) {
6193       let b_byte = buffer[i];
6194
6195       if (b_byte === hexNeedle) {
6196         found = i;
6197         break;
6198       }
6199     }
6200
6201     return found;
6202   }
6203
6204   reset() {
6205     this.eofReached = false;
6206     this.linesCache = [];
6207     this.fdPosition = 0;
6208   }
6209
6210   close() {
6211     fs$l.closeSync(this.fd);
6212     this.fd = null;
6213   }
6214
6215   _extractLines(buffer) {
6216     let line;
6217     const lines = [];
6218     let bufferPosition = 0;
6219     let lastNewLineBufferPosition = 0;
6220
6221     while (true) {
6222       let bufferPositionValue = buffer[bufferPosition++];
6223
6224       if (bufferPositionValue === this.newLineCharacter) {
6225         line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
6226         lines.push(line);
6227         lastNewLineBufferPosition = bufferPosition;
6228       } else if (bufferPositionValue === undefined) {
6229         break;
6230       }
6231     }
6232
6233     let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
6234
6235     if (leftovers.length) {
6236       lines.push(leftovers);
6237     }
6238
6239     return lines;
6240   }
6241
6242   _readChunk(lineLeftovers) {
6243     let totalBytesRead = 0;
6244     let bytesRead;
6245     const buffers = [];
6246
6247     do {
6248       const readBuffer = new Buffer(this.options.readChunk);
6249       bytesRead = fs$l.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
6250       totalBytesRead = totalBytesRead + bytesRead;
6251       this.fdPosition = this.fdPosition + bytesRead;
6252       buffers.push(readBuffer);
6253     } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
6254
6255     let bufferData = Buffer.concat(buffers);
6256
6257     if (bytesRead < this.options.readChunk) {
6258       this.eofReached = true;
6259       bufferData = bufferData.slice(0, totalBytesRead);
6260     }
6261
6262     if (totalBytesRead) {
6263       this.linesCache = this._extractLines(bufferData);
6264
6265       if (lineLeftovers) {
6266         this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
6267       }
6268     }
6269
6270     return totalBytesRead;
6271   }
6272
6273   next() {
6274     if (!this.fd) return false;
6275     let line = false;
6276
6277     if (this.eofReached && this.linesCache.length === 0) {
6278       return line;
6279     }
6280
6281     let bytesRead;
6282
6283     if (!this.linesCache.length) {
6284       bytesRead = this._readChunk();
6285     }
6286
6287     if (this.linesCache.length) {
6288       line = this.linesCache.shift();
6289       const lastLineCharacter = line[line.length - 1];
6290
6291       if (lastLineCharacter !== this.newLineCharacter) {
6292         bytesRead = this._readChunk(line);
6293
6294         if (bytesRead) {
6295           line = this.linesCache.shift();
6296         }
6297       }
6298     }
6299
6300     if (this.eofReached && this.linesCache.length === 0) {
6301       this.close();
6302     }
6303
6304     if (line && line[line.length - 1] === this.newLineCharacter) {
6305       line = line.slice(0, line.length - 1);
6306     }
6307
6308     return line;
6309   }
6310
6311 }
6312
6313 var readlines$1 = LineByLine;
6314
6315 class ConfigError$1 extends Error {}
6316
6317 class DebugError extends Error {}
6318
6319 class UndefinedParserError$1 extends Error {}
6320
6321 class ArgExpansionBailout$3 extends Error {}
6322
6323 var errors = {
6324   ConfigError: ConfigError$1,
6325   DebugError,
6326   UndefinedParserError: UndefinedParserError$1,
6327   ArgExpansionBailout: ArgExpansionBailout$3
6328 };
6329
6330 var lib$4 = {};
6331
6332 /*! *****************************************************************************\r
6333 Copyright (c) Microsoft Corporation.\r
6334 \r
6335 Permission to use, copy, modify, and/or distribute this software for any\r
6336 purpose with or without fee is hereby granted.\r
6337 \r
6338 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r
6339 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r
6340 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r
6341 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r
6342 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r
6343 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r
6344 PERFORMANCE OF THIS SOFTWARE.\r
6345 ***************************************************************************** */
6346
6347 /* global Reflect, Promise */
6348 var extendStatics = function (d, b) {
6349   extendStatics = Object.setPrototypeOf || {
6350     __proto__: []
6351   } instanceof Array && function (d, b) {
6352     d.__proto__ = b;
6353   } || function (d, b) {
6354     for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
6355   };
6356
6357   return extendStatics(d, b);
6358 };
6359
6360 function __extends(d, b) {
6361   extendStatics(d, b);
6362
6363   function __() {
6364     this.constructor = d;
6365   }
6366
6367   d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6368 }
6369 var __assign = function () {
6370   __assign = Object.assign || function __assign(t) {
6371     for (var s, i = 1, n = arguments.length; i < n; i++) {
6372       s = arguments[i];
6373
6374       for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6375     }
6376
6377     return t;
6378   };
6379
6380   return __assign.apply(this, arguments);
6381 };
6382 function __rest(s, e) {
6383   var t = {};
6384
6385   for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6386
6387   if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6388     if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6389   }
6390   return t;
6391 }
6392 function __decorate(decorators, target, key, desc) {
6393   var c = arguments.length,
6394       r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
6395       d;
6396   if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6397   return c > 3 && r && Object.defineProperty(target, key, r), r;
6398 }
6399 function __param(paramIndex, decorator) {
6400   return function (target, key) {
6401     decorator(target, key, paramIndex);
6402   };
6403 }
6404 function __metadata(metadataKey, metadataValue) {
6405   if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
6406 }
6407 function __awaiter$2(thisArg, _arguments, P, generator) {
6408   function adopt(value) {
6409     return value instanceof P ? value : new P(function (resolve) {
6410       resolve(value);
6411     });
6412   }
6413
6414   return new (P || (P = Promise))(function (resolve, reject) {
6415     function fulfilled(value) {
6416       try {
6417         step(generator.next(value));
6418       } catch (e) {
6419         reject(e);
6420       }
6421     }
6422
6423     function rejected(value) {
6424       try {
6425         step(generator["throw"](value));
6426       } catch (e) {
6427         reject(e);
6428       }
6429     }
6430
6431     function step(result) {
6432       result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6433     }
6434
6435     step((generator = generator.apply(thisArg, _arguments || [])).next());
6436   });
6437 }
6438 function __generator$2(thisArg, body) {
6439   var _ = {
6440     label: 0,
6441     sent: function () {
6442       if (t[0] & 1) throw t[1];
6443       return t[1];
6444     },
6445     trys: [],
6446     ops: []
6447   },
6448       f,
6449       y,
6450       t,
6451       g;
6452   return g = {
6453     next: verb(0),
6454     "throw": verb(1),
6455     "return": verb(2)
6456   }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
6457     return this;
6458   }), g;
6459
6460   function verb(n) {
6461     return function (v) {
6462       return step([n, v]);
6463     };
6464   }
6465
6466   function step(op) {
6467     if (f) throw new TypeError("Generator is already executing.");
6468
6469     while (_) try {
6470       if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
6471       if (y = 0, t) op = [op[0] & 2, t.value];
6472
6473       switch (op[0]) {
6474         case 0:
6475         case 1:
6476           t = op;
6477           break;
6478
6479         case 4:
6480           _.label++;
6481           return {
6482             value: op[1],
6483             done: false
6484           };
6485
6486         case 5:
6487           _.label++;
6488           y = op[1];
6489           op = [0];
6490           continue;
6491
6492         case 7:
6493           op = _.ops.pop();
6494
6495           _.trys.pop();
6496
6497           continue;
6498
6499         default:
6500           if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
6501             _ = 0;
6502             continue;
6503           }
6504
6505           if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
6506             _.label = op[1];
6507             break;
6508           }
6509
6510           if (op[0] === 6 && _.label < t[1]) {
6511             _.label = t[1];
6512             t = op;
6513             break;
6514           }
6515
6516           if (t && _.label < t[2]) {
6517             _.label = t[2];
6518
6519             _.ops.push(op);
6520
6521             break;
6522           }
6523
6524           if (t[2]) _.ops.pop();
6525
6526           _.trys.pop();
6527
6528           continue;
6529       }
6530
6531       op = body.call(thisArg, _);
6532     } catch (e) {
6533       op = [6, e];
6534       y = 0;
6535     } finally {
6536       f = t = 0;
6537     }
6538
6539     if (op[0] & 5) throw op[1];
6540     return {
6541       value: op[0] ? op[1] : void 0,
6542       done: true
6543     };
6544   }
6545 }
6546 function __createBinding(o, m, k, k2) {
6547   if (k2 === undefined) k2 = k;
6548   o[k2] = m[k];
6549 }
6550 function __exportStar(m, exports) {
6551   for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
6552 }
6553 function __values(o) {
6554   var s = typeof Symbol === "function" && Symbol.iterator,
6555       m = s && o[s],
6556       i = 0;
6557   if (m) return m.call(o);
6558   if (o && typeof o.length === "number") return {
6559     next: function () {
6560       if (o && i >= o.length) o = void 0;
6561       return {
6562         value: o && o[i++],
6563         done: !o
6564       };
6565     }
6566   };
6567   throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
6568 }
6569 function __read(o, n) {
6570   var m = typeof Symbol === "function" && o[Symbol.iterator];
6571   if (!m) return o;
6572   var i = m.call(o),
6573       r,
6574       ar = [],
6575       e;
6576
6577   try {
6578     while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
6579   } catch (error) {
6580     e = {
6581       error: error
6582     };
6583   } finally {
6584     try {
6585       if (r && !r.done && (m = i["return"])) m.call(i);
6586     } finally {
6587       if (e) throw e.error;
6588     }
6589   }
6590
6591   return ar;
6592 }
6593 function __spread() {
6594   for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
6595
6596   return ar;
6597 }
6598 function __spreadArrays() {
6599   for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
6600
6601   for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
6602
6603   return r;
6604 }
6605 function __await(v) {
6606   return this instanceof __await ? (this.v = v, this) : new __await(v);
6607 }
6608 function __asyncGenerator(thisArg, _arguments, generator) {
6609   if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
6610   var g = generator.apply(thisArg, _arguments || []),
6611       i,
6612       q = [];
6613   return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
6614     return this;
6615   }, i;
6616
6617   function verb(n) {
6618     if (g[n]) i[n] = function (v) {
6619       return new Promise(function (a, b) {
6620         q.push([n, v, a, b]) > 1 || resume(n, v);
6621       });
6622     };
6623   }
6624
6625   function resume(n, v) {
6626     try {
6627       step(g[n](v));
6628     } catch (e) {
6629       settle(q[0][3], e);
6630     }
6631   }
6632
6633   function step(r) {
6634     r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
6635   }
6636
6637   function fulfill(value) {
6638     resume("next", value);
6639   }
6640
6641   function reject(value) {
6642     resume("throw", value);
6643   }
6644
6645   function settle(f, v) {
6646     if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
6647   }
6648 }
6649 function __asyncDelegator(o) {
6650   var i, p;
6651   return i = {}, verb("next"), verb("throw", function (e) {
6652     throw e;
6653   }), verb("return"), i[Symbol.iterator] = function () {
6654     return this;
6655   }, i;
6656
6657   function verb(n, f) {
6658     i[n] = o[n] ? function (v) {
6659       return (p = !p) ? {
6660         value: __await(o[n](v)),
6661         done: n === "return"
6662       } : f ? f(v) : v;
6663     } : f;
6664   }
6665 }
6666 function __asyncValues(o) {
6667   if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
6668   var m = o[Symbol.asyncIterator],
6669       i;
6670   return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
6671     return this;
6672   }, i);
6673
6674   function verb(n) {
6675     i[n] = o[n] && function (v) {
6676       return new Promise(function (resolve, reject) {
6677         v = o[n](v), settle(resolve, reject, v.done, v.value);
6678       });
6679     };
6680   }
6681
6682   function settle(resolve, reject, d, v) {
6683     Promise.resolve(v).then(function (v) {
6684       resolve({
6685         value: v,
6686         done: d
6687       });
6688     }, reject);
6689   }
6690 }
6691 function __makeTemplateObject(cooked, raw) {
6692   if (Object.defineProperty) {
6693     Object.defineProperty(cooked, "raw", {
6694       value: raw
6695     });
6696   } else {
6697     cooked.raw = raw;
6698   }
6699
6700   return cooked;
6701 }
6702 function __importStar$2(mod) {
6703   if (mod && mod.__esModule) return mod;
6704   var result = {};
6705   if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6706   result.default = mod;
6707   return result;
6708 }
6709 function __importDefault$1(mod) {
6710   return mod && mod.__esModule ? mod : {
6711     default: mod
6712   };
6713 }
6714 function __classPrivateFieldGet(receiver, privateMap) {
6715   if (!privateMap.has(receiver)) {
6716     throw new TypeError("attempted to get private field on non-instance");
6717   }
6718
6719   return privateMap.get(receiver);
6720 }
6721 function __classPrivateFieldSet(receiver, privateMap, value) {
6722   if (!privateMap.has(receiver)) {
6723     throw new TypeError("attempted to set private field on non-instance");
6724   }
6725
6726   privateMap.set(receiver, value);
6727   return value;
6728 }
6729
6730 var tslib_es6 = /*#__PURE__*/Object.freeze({
6731         __proto__: null,
6732         __extends: __extends,
6733         get __assign () { return __assign; },
6734         __rest: __rest,
6735         __decorate: __decorate,
6736         __param: __param,
6737         __metadata: __metadata,
6738         __awaiter: __awaiter$2,
6739         __generator: __generator$2,
6740         __createBinding: __createBinding,
6741         __exportStar: __exportStar,
6742         __values: __values,
6743         __read: __read,
6744         __spread: __spread,
6745         __spreadArrays: __spreadArrays,
6746         __await: __await,
6747         __asyncGenerator: __asyncGenerator,
6748         __asyncDelegator: __asyncDelegator,
6749         __asyncValues: __asyncValues,
6750         __makeTemplateObject: __makeTemplateObject,
6751         __importStar: __importStar$2,
6752         __importDefault: __importDefault$1,
6753         __classPrivateFieldGet: __classPrivateFieldGet,
6754         __classPrivateFieldSet: __classPrivateFieldSet
6755 });
6756
6757 var descriptors = {};
6758
6759 var api = {};
6760
6761 (function (exports) {
6762
6763   Object.defineProperty(exports, "__esModule", {
6764     value: true
6765   });
6766   exports.apiDescriptor = {
6767     key: key => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key) ? key : JSON.stringify(key),
6768
6769     value(value) {
6770       if (value === null || typeof value !== 'object') {
6771         return JSON.stringify(value);
6772       }
6773
6774       if (Array.isArray(value)) {
6775         return `[${value.map(subValue => exports.apiDescriptor.value(subValue)).join(', ')}]`;
6776       }
6777
6778       const keys = Object.keys(value);
6779       return keys.length === 0 ? '{}' : `{ ${keys.map(key => `${exports.apiDescriptor.key(key)}: ${exports.apiDescriptor.value(value[key])}`).join(', ')} }`;
6780     },
6781
6782     pair: ({
6783       key,
6784       value
6785     }) => exports.apiDescriptor.value({
6786       [key]: value
6787     })
6788   };
6789 })(api);
6790
6791 (function (exports) {
6792
6793   Object.defineProperty(exports, "__esModule", {
6794     value: true
6795   });
6796   const tslib_1 = tslib_es6;
6797
6798   tslib_1.__exportStar(api, exports);
6799 })(descriptors);
6800
6801 var handlers = {};
6802
6803 var deprecated = {};
6804
6805 var common$8 = {};
6806
6807 var chalk$3 = {exports: {}};
6808
6809 var matchOperatorsRe$1 = /[|\\{}()[\]^$+*?.]/g;
6810
6811 var escapeStringRegexp$1 = function (str) {
6812   if (typeof str !== 'string') {
6813     throw new TypeError('Expected a string');
6814   }
6815
6816   return str.replace(matchOperatorsRe$1, '\\$&');
6817 };
6818
6819 var ansiStyles$2 = {exports: {}};
6820
6821 var conversions$5 = {exports: {}};
6822
6823 var colorName$1 = {
6824   "aliceblue": [240, 248, 255],
6825   "antiquewhite": [250, 235, 215],
6826   "aqua": [0, 255, 255],
6827   "aquamarine": [127, 255, 212],
6828   "azure": [240, 255, 255],
6829   "beige": [245, 245, 220],
6830   "bisque": [255, 228, 196],
6831   "black": [0, 0, 0],
6832   "blanchedalmond": [255, 235, 205],
6833   "blue": [0, 0, 255],
6834   "blueviolet": [138, 43, 226],
6835   "brown": [165, 42, 42],
6836   "burlywood": [222, 184, 135],
6837   "cadetblue": [95, 158, 160],
6838   "chartreuse": [127, 255, 0],
6839   "chocolate": [210, 105, 30],
6840   "coral": [255, 127, 80],
6841   "cornflowerblue": [100, 149, 237],
6842   "cornsilk": [255, 248, 220],
6843   "crimson": [220, 20, 60],
6844   "cyan": [0, 255, 255],
6845   "darkblue": [0, 0, 139],
6846   "darkcyan": [0, 139, 139],
6847   "darkgoldenrod": [184, 134, 11],
6848   "darkgray": [169, 169, 169],
6849   "darkgreen": [0, 100, 0],
6850   "darkgrey": [169, 169, 169],
6851   "darkkhaki": [189, 183, 107],
6852   "darkmagenta": [139, 0, 139],
6853   "darkolivegreen": [85, 107, 47],
6854   "darkorange": [255, 140, 0],
6855   "darkorchid": [153, 50, 204],
6856   "darkred": [139, 0, 0],
6857   "darksalmon": [233, 150, 122],
6858   "darkseagreen": [143, 188, 143],
6859   "darkslateblue": [72, 61, 139],
6860   "darkslategray": [47, 79, 79],
6861   "darkslategrey": [47, 79, 79],
6862   "darkturquoise": [0, 206, 209],
6863   "darkviolet": [148, 0, 211],
6864   "deeppink": [255, 20, 147],
6865   "deepskyblue": [0, 191, 255],
6866   "dimgray": [105, 105, 105],
6867   "dimgrey": [105, 105, 105],
6868   "dodgerblue": [30, 144, 255],
6869   "firebrick": [178, 34, 34],
6870   "floralwhite": [255, 250, 240],
6871   "forestgreen": [34, 139, 34],
6872   "fuchsia": [255, 0, 255],
6873   "gainsboro": [220, 220, 220],
6874   "ghostwhite": [248, 248, 255],
6875   "gold": [255, 215, 0],
6876   "goldenrod": [218, 165, 32],
6877   "gray": [128, 128, 128],
6878   "green": [0, 128, 0],
6879   "greenyellow": [173, 255, 47],
6880   "grey": [128, 128, 128],
6881   "honeydew": [240, 255, 240],
6882   "hotpink": [255, 105, 180],
6883   "indianred": [205, 92, 92],
6884   "indigo": [75, 0, 130],
6885   "ivory": [255, 255, 240],
6886   "khaki": [240, 230, 140],
6887   "lavender": [230, 230, 250],
6888   "lavenderblush": [255, 240, 245],
6889   "lawngreen": [124, 252, 0],
6890   "lemonchiffon": [255, 250, 205],
6891   "lightblue": [173, 216, 230],
6892   "lightcoral": [240, 128, 128],
6893   "lightcyan": [224, 255, 255],
6894   "lightgoldenrodyellow": [250, 250, 210],
6895   "lightgray": [211, 211, 211],
6896   "lightgreen": [144, 238, 144],
6897   "lightgrey": [211, 211, 211],
6898   "lightpink": [255, 182, 193],
6899   "lightsalmon": [255, 160, 122],
6900   "lightseagreen": [32, 178, 170],
6901   "lightskyblue": [135, 206, 250],
6902   "lightslategray": [119, 136, 153],
6903   "lightslategrey": [119, 136, 153],
6904   "lightsteelblue": [176, 196, 222],
6905   "lightyellow": [255, 255, 224],
6906   "lime": [0, 255, 0],
6907   "limegreen": [50, 205, 50],
6908   "linen": [250, 240, 230],
6909   "magenta": [255, 0, 255],
6910   "maroon": [128, 0, 0],
6911   "mediumaquamarine": [102, 205, 170],
6912   "mediumblue": [0, 0, 205],
6913   "mediumorchid": [186, 85, 211],
6914   "mediumpurple": [147, 112, 219],
6915   "mediumseagreen": [60, 179, 113],
6916   "mediumslateblue": [123, 104, 238],
6917   "mediumspringgreen": [0, 250, 154],
6918   "mediumturquoise": [72, 209, 204],
6919   "mediumvioletred": [199, 21, 133],
6920   "midnightblue": [25, 25, 112],
6921   "mintcream": [245, 255, 250],
6922   "mistyrose": [255, 228, 225],
6923   "moccasin": [255, 228, 181],
6924   "navajowhite": [255, 222, 173],
6925   "navy": [0, 0, 128],
6926   "oldlace": [253, 245, 230],
6927   "olive": [128, 128, 0],
6928   "olivedrab": [107, 142, 35],
6929   "orange": [255, 165, 0],
6930   "orangered": [255, 69, 0],
6931   "orchid": [218, 112, 214],
6932   "palegoldenrod": [238, 232, 170],
6933   "palegreen": [152, 251, 152],
6934   "paleturquoise": [175, 238, 238],
6935   "palevioletred": [219, 112, 147],
6936   "papayawhip": [255, 239, 213],
6937   "peachpuff": [255, 218, 185],
6938   "peru": [205, 133, 63],
6939   "pink": [255, 192, 203],
6940   "plum": [221, 160, 221],
6941   "powderblue": [176, 224, 230],
6942   "purple": [128, 0, 128],
6943   "rebeccapurple": [102, 51, 153],
6944   "red": [255, 0, 0],
6945   "rosybrown": [188, 143, 143],
6946   "royalblue": [65, 105, 225],
6947   "saddlebrown": [139, 69, 19],
6948   "salmon": [250, 128, 114],
6949   "sandybrown": [244, 164, 96],
6950   "seagreen": [46, 139, 87],
6951   "seashell": [255, 245, 238],
6952   "sienna": [160, 82, 45],
6953   "silver": [192, 192, 192],
6954   "skyblue": [135, 206, 235],
6955   "slateblue": [106, 90, 205],
6956   "slategray": [112, 128, 144],
6957   "slategrey": [112, 128, 144],
6958   "snow": [255, 250, 250],
6959   "springgreen": [0, 255, 127],
6960   "steelblue": [70, 130, 180],
6961   "tan": [210, 180, 140],
6962   "teal": [0, 128, 128],
6963   "thistle": [216, 191, 216],
6964   "tomato": [255, 99, 71],
6965   "turquoise": [64, 224, 208],
6966   "violet": [238, 130, 238],
6967   "wheat": [245, 222, 179],
6968   "white": [255, 255, 255],
6969   "whitesmoke": [245, 245, 245],
6970   "yellow": [255, 255, 0],
6971   "yellowgreen": [154, 205, 50]
6972 };
6973
6974 /* MIT license */
6975 var cssKeywords$1 = colorName$1; // NOTE: conversions should only return primitive values (i.e. arrays, or
6976 //       values that give correct `typeof` results).
6977 //       do not use box values types (i.e. Number(), String(), etc.)
6978
6979 var reverseKeywords$1 = {};
6980
6981 for (var key$1 in cssKeywords$1) {
6982   if (cssKeywords$1.hasOwnProperty(key$1)) {
6983     reverseKeywords$1[cssKeywords$1[key$1]] = key$1;
6984   }
6985 }
6986
6987 var convert$3 = conversions$5.exports = {
6988   rgb: {
6989     channels: 3,
6990     labels: 'rgb'
6991   },
6992   hsl: {
6993     channels: 3,
6994     labels: 'hsl'
6995   },
6996   hsv: {
6997     channels: 3,
6998     labels: 'hsv'
6999   },
7000   hwb: {
7001     channels: 3,
7002     labels: 'hwb'
7003   },
7004   cmyk: {
7005     channels: 4,
7006     labels: 'cmyk'
7007   },
7008   xyz: {
7009     channels: 3,
7010     labels: 'xyz'
7011   },
7012   lab: {
7013     channels: 3,
7014     labels: 'lab'
7015   },
7016   lch: {
7017     channels: 3,
7018     labels: 'lch'
7019   },
7020   hex: {
7021     channels: 1,
7022     labels: ['hex']
7023   },
7024   keyword: {
7025     channels: 1,
7026     labels: ['keyword']
7027   },
7028   ansi16: {
7029     channels: 1,
7030     labels: ['ansi16']
7031   },
7032   ansi256: {
7033     channels: 1,
7034     labels: ['ansi256']
7035   },
7036   hcg: {
7037     channels: 3,
7038     labels: ['h', 'c', 'g']
7039   },
7040   apple: {
7041     channels: 3,
7042     labels: ['r16', 'g16', 'b16']
7043   },
7044   gray: {
7045     channels: 1,
7046     labels: ['gray']
7047   }
7048 }; // hide .channels and .labels properties
7049
7050 for (var model in convert$3) {
7051   if (convert$3.hasOwnProperty(model)) {
7052     if (!('channels' in convert$3[model])) {
7053       throw new Error('missing channels property: ' + model);
7054     }
7055
7056     if (!('labels' in convert$3[model])) {
7057       throw new Error('missing channel labels property: ' + model);
7058     }
7059
7060     if (convert$3[model].labels.length !== convert$3[model].channels) {
7061       throw new Error('channel and label counts mismatch: ' + model);
7062     }
7063
7064     var channels = convert$3[model].channels;
7065     var labels = convert$3[model].labels;
7066     delete convert$3[model].channels;
7067     delete convert$3[model].labels;
7068     Object.defineProperty(convert$3[model], 'channels', {
7069       value: channels
7070     });
7071     Object.defineProperty(convert$3[model], 'labels', {
7072       value: labels
7073     });
7074   }
7075 }
7076
7077 convert$3.rgb.hsl = function (rgb) {
7078   var r = rgb[0] / 255;
7079   var g = rgb[1] / 255;
7080   var b = rgb[2] / 255;
7081   var min = Math.min(r, g, b);
7082   var max = Math.max(r, g, b);
7083   var delta = max - min;
7084   var h;
7085   var s;
7086   var l;
7087
7088   if (max === min) {
7089     h = 0;
7090   } else if (r === max) {
7091     h = (g - b) / delta;
7092   } else if (g === max) {
7093     h = 2 + (b - r) / delta;
7094   } else if (b === max) {
7095     h = 4 + (r - g) / delta;
7096   }
7097
7098   h = Math.min(h * 60, 360);
7099
7100   if (h < 0) {
7101     h += 360;
7102   }
7103
7104   l = (min + max) / 2;
7105
7106   if (max === min) {
7107     s = 0;
7108   } else if (l <= 0.5) {
7109     s = delta / (max + min);
7110   } else {
7111     s = delta / (2 - max - min);
7112   }
7113
7114   return [h, s * 100, l * 100];
7115 };
7116
7117 convert$3.rgb.hsv = function (rgb) {
7118   var rdif;
7119   var gdif;
7120   var bdif;
7121   var h;
7122   var s;
7123   var r = rgb[0] / 255;
7124   var g = rgb[1] / 255;
7125   var b = rgb[2] / 255;
7126   var v = Math.max(r, g, b);
7127   var diff = v - Math.min(r, g, b);
7128
7129   var diffc = function (c) {
7130     return (v - c) / 6 / diff + 1 / 2;
7131   };
7132
7133   if (diff === 0) {
7134     h = s = 0;
7135   } else {
7136     s = diff / v;
7137     rdif = diffc(r);
7138     gdif = diffc(g);
7139     bdif = diffc(b);
7140
7141     if (r === v) {
7142       h = bdif - gdif;
7143     } else if (g === v) {
7144       h = 1 / 3 + rdif - bdif;
7145     } else if (b === v) {
7146       h = 2 / 3 + gdif - rdif;
7147     }
7148
7149     if (h < 0) {
7150       h += 1;
7151     } else if (h > 1) {
7152       h -= 1;
7153     }
7154   }
7155
7156   return [h * 360, s * 100, v * 100];
7157 };
7158
7159 convert$3.rgb.hwb = function (rgb) {
7160   var r = rgb[0];
7161   var g = rgb[1];
7162   var b = rgb[2];
7163   var h = convert$3.rgb.hsl(rgb)[0];
7164   var w = 1 / 255 * Math.min(r, Math.min(g, b));
7165   b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
7166   return [h, w * 100, b * 100];
7167 };
7168
7169 convert$3.rgb.cmyk = function (rgb) {
7170   var r = rgb[0] / 255;
7171   var g = rgb[1] / 255;
7172   var b = rgb[2] / 255;
7173   var c;
7174   var m;
7175   var y;
7176   var k;
7177   k = Math.min(1 - r, 1 - g, 1 - b);
7178   c = (1 - r - k) / (1 - k) || 0;
7179   m = (1 - g - k) / (1 - k) || 0;
7180   y = (1 - b - k) / (1 - k) || 0;
7181   return [c * 100, m * 100, y * 100, k * 100];
7182 };
7183 /**
7184  * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
7185  * */
7186
7187
7188 function comparativeDistance$1(x, y) {
7189   return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
7190 }
7191
7192 convert$3.rgb.keyword = function (rgb) {
7193   var reversed = reverseKeywords$1[rgb];
7194
7195   if (reversed) {
7196     return reversed;
7197   }
7198
7199   var currentClosestDistance = Infinity;
7200   var currentClosestKeyword;
7201
7202   for (var keyword in cssKeywords$1) {
7203     if (cssKeywords$1.hasOwnProperty(keyword)) {
7204       var value = cssKeywords$1[keyword]; // Compute comparative distance
7205
7206       var distance = comparativeDistance$1(rgb, value); // Check if its less, if so set as closest
7207
7208       if (distance < currentClosestDistance) {
7209         currentClosestDistance = distance;
7210         currentClosestKeyword = keyword;
7211       }
7212     }
7213   }
7214
7215   return currentClosestKeyword;
7216 };
7217
7218 convert$3.keyword.rgb = function (keyword) {
7219   return cssKeywords$1[keyword];
7220 };
7221
7222 convert$3.rgb.xyz = function (rgb) {
7223   var r = rgb[0] / 255;
7224   var g = rgb[1] / 255;
7225   var b = rgb[2] / 255; // assume sRGB
7226
7227   r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
7228   g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
7229   b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
7230   var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
7231   var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
7232   var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
7233   return [x * 100, y * 100, z * 100];
7234 };
7235
7236 convert$3.rgb.lab = function (rgb) {
7237   var xyz = convert$3.rgb.xyz(rgb);
7238   var x = xyz[0];
7239   var y = xyz[1];
7240   var z = xyz[2];
7241   var l;
7242   var a;
7243   var b;
7244   x /= 95.047;
7245   y /= 100;
7246   z /= 108.883;
7247   x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
7248   y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
7249   z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
7250   l = 116 * y - 16;
7251   a = 500 * (x - y);
7252   b = 200 * (y - z);
7253   return [l, a, b];
7254 };
7255
7256 convert$3.hsl.rgb = function (hsl) {
7257   var h = hsl[0] / 360;
7258   var s = hsl[1] / 100;
7259   var l = hsl[2] / 100;
7260   var t1;
7261   var t2;
7262   var t3;
7263   var rgb;
7264   var val;
7265
7266   if (s === 0) {
7267     val = l * 255;
7268     return [val, val, val];
7269   }
7270
7271   if (l < 0.5) {
7272     t2 = l * (1 + s);
7273   } else {
7274     t2 = l + s - l * s;
7275   }
7276
7277   t1 = 2 * l - t2;
7278   rgb = [0, 0, 0];
7279
7280   for (var i = 0; i < 3; i++) {
7281     t3 = h + 1 / 3 * -(i - 1);
7282
7283     if (t3 < 0) {
7284       t3++;
7285     }
7286
7287     if (t3 > 1) {
7288       t3--;
7289     }
7290
7291     if (6 * t3 < 1) {
7292       val = t1 + (t2 - t1) * 6 * t3;
7293     } else if (2 * t3 < 1) {
7294       val = t2;
7295     } else if (3 * t3 < 2) {
7296       val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
7297     } else {
7298       val = t1;
7299     }
7300
7301     rgb[i] = val * 255;
7302   }
7303
7304   return rgb;
7305 };
7306
7307 convert$3.hsl.hsv = function (hsl) {
7308   var h = hsl[0];
7309   var s = hsl[1] / 100;
7310   var l = hsl[2] / 100;
7311   var smin = s;
7312   var lmin = Math.max(l, 0.01);
7313   var sv;
7314   var v;
7315   l *= 2;
7316   s *= l <= 1 ? l : 2 - l;
7317   smin *= lmin <= 1 ? lmin : 2 - lmin;
7318   v = (l + s) / 2;
7319   sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
7320   return [h, sv * 100, v * 100];
7321 };
7322
7323 convert$3.hsv.rgb = function (hsv) {
7324   var h = hsv[0] / 60;
7325   var s = hsv[1] / 100;
7326   var v = hsv[2] / 100;
7327   var hi = Math.floor(h) % 6;
7328   var f = h - Math.floor(h);
7329   var p = 255 * v * (1 - s);
7330   var q = 255 * v * (1 - s * f);
7331   var t = 255 * v * (1 - s * (1 - f));
7332   v *= 255;
7333
7334   switch (hi) {
7335     case 0:
7336       return [v, t, p];
7337
7338     case 1:
7339       return [q, v, p];
7340
7341     case 2:
7342       return [p, v, t];
7343
7344     case 3:
7345       return [p, q, v];
7346
7347     case 4:
7348       return [t, p, v];
7349
7350     case 5:
7351       return [v, p, q];
7352   }
7353 };
7354
7355 convert$3.hsv.hsl = function (hsv) {
7356   var h = hsv[0];
7357   var s = hsv[1] / 100;
7358   var v = hsv[2] / 100;
7359   var vmin = Math.max(v, 0.01);
7360   var lmin;
7361   var sl;
7362   var l;
7363   l = (2 - s) * v;
7364   lmin = (2 - s) * vmin;
7365   sl = s * vmin;
7366   sl /= lmin <= 1 ? lmin : 2 - lmin;
7367   sl = sl || 0;
7368   l /= 2;
7369   return [h, sl * 100, l * 100];
7370 }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
7371
7372
7373 convert$3.hwb.rgb = function (hwb) {
7374   var h = hwb[0] / 360;
7375   var wh = hwb[1] / 100;
7376   var bl = hwb[2] / 100;
7377   var ratio = wh + bl;
7378   var i;
7379   var v;
7380   var f;
7381   var n; // wh + bl cant be > 1
7382
7383   if (ratio > 1) {
7384     wh /= ratio;
7385     bl /= ratio;
7386   }
7387
7388   i = Math.floor(6 * h);
7389   v = 1 - bl;
7390   f = 6 * h - i;
7391
7392   if ((i & 0x01) !== 0) {
7393     f = 1 - f;
7394   }
7395
7396   n = wh + f * (v - wh); // linear interpolation
7397
7398   var r;
7399   var g;
7400   var b;
7401
7402   switch (i) {
7403     default:
7404     case 6:
7405     case 0:
7406       r = v;
7407       g = n;
7408       b = wh;
7409       break;
7410
7411     case 1:
7412       r = n;
7413       g = v;
7414       b = wh;
7415       break;
7416
7417     case 2:
7418       r = wh;
7419       g = v;
7420       b = n;
7421       break;
7422
7423     case 3:
7424       r = wh;
7425       g = n;
7426       b = v;
7427       break;
7428
7429     case 4:
7430       r = n;
7431       g = wh;
7432       b = v;
7433       break;
7434
7435     case 5:
7436       r = v;
7437       g = wh;
7438       b = n;
7439       break;
7440   }
7441
7442   return [r * 255, g * 255, b * 255];
7443 };
7444
7445 convert$3.cmyk.rgb = function (cmyk) {
7446   var c = cmyk[0] / 100;
7447   var m = cmyk[1] / 100;
7448   var y = cmyk[2] / 100;
7449   var k = cmyk[3] / 100;
7450   var r;
7451   var g;
7452   var b;
7453   r = 1 - Math.min(1, c * (1 - k) + k);
7454   g = 1 - Math.min(1, m * (1 - k) + k);
7455   b = 1 - Math.min(1, y * (1 - k) + k);
7456   return [r * 255, g * 255, b * 255];
7457 };
7458
7459 convert$3.xyz.rgb = function (xyz) {
7460   var x = xyz[0] / 100;
7461   var y = xyz[1] / 100;
7462   var z = xyz[2] / 100;
7463   var r;
7464   var g;
7465   var b;
7466   r = x * 3.2406 + y * -1.5372 + z * -0.4986;
7467   g = x * -0.9689 + y * 1.8758 + z * 0.0415;
7468   b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
7469
7470   r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
7471   g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
7472   b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
7473   r = Math.min(Math.max(0, r), 1);
7474   g = Math.min(Math.max(0, g), 1);
7475   b = Math.min(Math.max(0, b), 1);
7476   return [r * 255, g * 255, b * 255];
7477 };
7478
7479 convert$3.xyz.lab = function (xyz) {
7480   var x = xyz[0];
7481   var y = xyz[1];
7482   var z = xyz[2];
7483   var l;
7484   var a;
7485   var b;
7486   x /= 95.047;
7487   y /= 100;
7488   z /= 108.883;
7489   x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
7490   y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
7491   z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
7492   l = 116 * y - 16;
7493   a = 500 * (x - y);
7494   b = 200 * (y - z);
7495   return [l, a, b];
7496 };
7497
7498 convert$3.lab.xyz = function (lab) {
7499   var l = lab[0];
7500   var a = lab[1];
7501   var b = lab[2];
7502   var x;
7503   var y;
7504   var z;
7505   y = (l + 16) / 116;
7506   x = a / 500 + y;
7507   z = y - b / 200;
7508   var y2 = Math.pow(y, 3);
7509   var x2 = Math.pow(x, 3);
7510   var z2 = Math.pow(z, 3);
7511   y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
7512   x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
7513   z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
7514   x *= 95.047;
7515   y *= 100;
7516   z *= 108.883;
7517   return [x, y, z];
7518 };
7519
7520 convert$3.lab.lch = function (lab) {
7521   var l = lab[0];
7522   var a = lab[1];
7523   var b = lab[2];
7524   var hr;
7525   var h;
7526   var c;
7527   hr = Math.atan2(b, a);
7528   h = hr * 360 / 2 / Math.PI;
7529
7530   if (h < 0) {
7531     h += 360;
7532   }
7533
7534   c = Math.sqrt(a * a + b * b);
7535   return [l, c, h];
7536 };
7537
7538 convert$3.lch.lab = function (lch) {
7539   var l = lch[0];
7540   var c = lch[1];
7541   var h = lch[2];
7542   var a;
7543   var b;
7544   var hr;
7545   hr = h / 360 * 2 * Math.PI;
7546   a = c * Math.cos(hr);
7547   b = c * Math.sin(hr);
7548   return [l, a, b];
7549 };
7550
7551 convert$3.rgb.ansi16 = function (args) {
7552   var r = args[0];
7553   var g = args[1];
7554   var b = args[2];
7555   var value = 1 in arguments ? arguments[1] : convert$3.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
7556
7557   value = Math.round(value / 50);
7558
7559   if (value === 0) {
7560     return 30;
7561   }
7562
7563   var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
7564
7565   if (value === 2) {
7566     ansi += 60;
7567   }
7568
7569   return ansi;
7570 };
7571
7572 convert$3.hsv.ansi16 = function (args) {
7573   // optimization here; we already know the value and don't need to get
7574   // it converted for us.
7575   return convert$3.rgb.ansi16(convert$3.hsv.rgb(args), args[2]);
7576 };
7577
7578 convert$3.rgb.ansi256 = function (args) {
7579   var r = args[0];
7580   var g = args[1];
7581   var b = args[2]; // we use the extended greyscale palette here, with the exception of
7582   // black and white. normal palette only has 4 greyscale shades.
7583
7584   if (r === g && g === b) {
7585     if (r < 8) {
7586       return 16;
7587     }
7588
7589     if (r > 248) {
7590       return 231;
7591     }
7592
7593     return Math.round((r - 8) / 247 * 24) + 232;
7594   }
7595
7596   var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
7597   return ansi;
7598 };
7599
7600 convert$3.ansi16.rgb = function (args) {
7601   var color = args % 10; // handle greyscale
7602
7603   if (color === 0 || color === 7) {
7604     if (args > 50) {
7605       color += 3.5;
7606     }
7607
7608     color = color / 10.5 * 255;
7609     return [color, color, color];
7610   }
7611
7612   var mult = (~~(args > 50) + 1) * 0.5;
7613   var r = (color & 1) * mult * 255;
7614   var g = (color >> 1 & 1) * mult * 255;
7615   var b = (color >> 2 & 1) * mult * 255;
7616   return [r, g, b];
7617 };
7618
7619 convert$3.ansi256.rgb = function (args) {
7620   // handle greyscale
7621   if (args >= 232) {
7622     var c = (args - 232) * 10 + 8;
7623     return [c, c, c];
7624   }
7625
7626   args -= 16;
7627   var rem;
7628   var r = Math.floor(args / 36) / 5 * 255;
7629   var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
7630   var b = rem % 6 / 5 * 255;
7631   return [r, g, b];
7632 };
7633
7634 convert$3.rgb.hex = function (args) {
7635   var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
7636   var string = integer.toString(16).toUpperCase();
7637   return '000000'.substring(string.length) + string;
7638 };
7639
7640 convert$3.hex.rgb = function (args) {
7641   var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
7642
7643   if (!match) {
7644     return [0, 0, 0];
7645   }
7646
7647   var colorString = match[0];
7648
7649   if (match[0].length === 3) {
7650     colorString = colorString.split('').map(function (char) {
7651       return char + char;
7652     }).join('');
7653   }
7654
7655   var integer = parseInt(colorString, 16);
7656   var r = integer >> 16 & 0xFF;
7657   var g = integer >> 8 & 0xFF;
7658   var b = integer & 0xFF;
7659   return [r, g, b];
7660 };
7661
7662 convert$3.rgb.hcg = function (rgb) {
7663   var r = rgb[0] / 255;
7664   var g = rgb[1] / 255;
7665   var b = rgb[2] / 255;
7666   var max = Math.max(Math.max(r, g), b);
7667   var min = Math.min(Math.min(r, g), b);
7668   var chroma = max - min;
7669   var grayscale;
7670   var hue;
7671
7672   if (chroma < 1) {
7673     grayscale = min / (1 - chroma);
7674   } else {
7675     grayscale = 0;
7676   }
7677
7678   if (chroma <= 0) {
7679     hue = 0;
7680   } else if (max === r) {
7681     hue = (g - b) / chroma % 6;
7682   } else if (max === g) {
7683     hue = 2 + (b - r) / chroma;
7684   } else {
7685     hue = 4 + (r - g) / chroma + 4;
7686   }
7687
7688   hue /= 6;
7689   hue %= 1;
7690   return [hue * 360, chroma * 100, grayscale * 100];
7691 };
7692
7693 convert$3.hsl.hcg = function (hsl) {
7694   var s = hsl[1] / 100;
7695   var l = hsl[2] / 100;
7696   var c = 1;
7697   var f = 0;
7698
7699   if (l < 0.5) {
7700     c = 2.0 * s * l;
7701   } else {
7702     c = 2.0 * s * (1.0 - l);
7703   }
7704
7705   if (c < 1.0) {
7706     f = (l - 0.5 * c) / (1.0 - c);
7707   }
7708
7709   return [hsl[0], c * 100, f * 100];
7710 };
7711
7712 convert$3.hsv.hcg = function (hsv) {
7713   var s = hsv[1] / 100;
7714   var v = hsv[2] / 100;
7715   var c = s * v;
7716   var f = 0;
7717
7718   if (c < 1.0) {
7719     f = (v - c) / (1 - c);
7720   }
7721
7722   return [hsv[0], c * 100, f * 100];
7723 };
7724
7725 convert$3.hcg.rgb = function (hcg) {
7726   var h = hcg[0] / 360;
7727   var c = hcg[1] / 100;
7728   var g = hcg[2] / 100;
7729
7730   if (c === 0.0) {
7731     return [g * 255, g * 255, g * 255];
7732   }
7733
7734   var pure = [0, 0, 0];
7735   var hi = h % 1 * 6;
7736   var v = hi % 1;
7737   var w = 1 - v;
7738   var mg = 0;
7739
7740   switch (Math.floor(hi)) {
7741     case 0:
7742       pure[0] = 1;
7743       pure[1] = v;
7744       pure[2] = 0;
7745       break;
7746
7747     case 1:
7748       pure[0] = w;
7749       pure[1] = 1;
7750       pure[2] = 0;
7751       break;
7752
7753     case 2:
7754       pure[0] = 0;
7755       pure[1] = 1;
7756       pure[2] = v;
7757       break;
7758
7759     case 3:
7760       pure[0] = 0;
7761       pure[1] = w;
7762       pure[2] = 1;
7763       break;
7764
7765     case 4:
7766       pure[0] = v;
7767       pure[1] = 0;
7768       pure[2] = 1;
7769       break;
7770
7771     default:
7772       pure[0] = 1;
7773       pure[1] = 0;
7774       pure[2] = w;
7775   }
7776
7777   mg = (1.0 - c) * g;
7778   return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
7779 };
7780
7781 convert$3.hcg.hsv = function (hcg) {
7782   var c = hcg[1] / 100;
7783   var g = hcg[2] / 100;
7784   var v = c + g * (1.0 - c);
7785   var f = 0;
7786
7787   if (v > 0.0) {
7788     f = c / v;
7789   }
7790
7791   return [hcg[0], f * 100, v * 100];
7792 };
7793
7794 convert$3.hcg.hsl = function (hcg) {
7795   var c = hcg[1] / 100;
7796   var g = hcg[2] / 100;
7797   var l = g * (1.0 - c) + 0.5 * c;
7798   var s = 0;
7799
7800   if (l > 0.0 && l < 0.5) {
7801     s = c / (2 * l);
7802   } else if (l >= 0.5 && l < 1.0) {
7803     s = c / (2 * (1 - l));
7804   }
7805
7806   return [hcg[0], s * 100, l * 100];
7807 };
7808
7809 convert$3.hcg.hwb = function (hcg) {
7810   var c = hcg[1] / 100;
7811   var g = hcg[2] / 100;
7812   var v = c + g * (1.0 - c);
7813   return [hcg[0], (v - c) * 100, (1 - v) * 100];
7814 };
7815
7816 convert$3.hwb.hcg = function (hwb) {
7817   var w = hwb[1] / 100;
7818   var b = hwb[2] / 100;
7819   var v = 1 - b;
7820   var c = v - w;
7821   var g = 0;
7822
7823   if (c < 1) {
7824     g = (v - c) / (1 - c);
7825   }
7826
7827   return [hwb[0], c * 100, g * 100];
7828 };
7829
7830 convert$3.apple.rgb = function (apple) {
7831   return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
7832 };
7833
7834 convert$3.rgb.apple = function (rgb) {
7835   return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
7836 };
7837
7838 convert$3.gray.rgb = function (args) {
7839   return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
7840 };
7841
7842 convert$3.gray.hsl = convert$3.gray.hsv = function (args) {
7843   return [0, 0, args[0]];
7844 };
7845
7846 convert$3.gray.hwb = function (gray) {
7847   return [0, 100, gray[0]];
7848 };
7849
7850 convert$3.gray.cmyk = function (gray) {
7851   return [0, 0, 0, gray[0]];
7852 };
7853
7854 convert$3.gray.lab = function (gray) {
7855   return [gray[0], 0, 0];
7856 };
7857
7858 convert$3.gray.hex = function (gray) {
7859   var val = Math.round(gray[0] / 100 * 255) & 0xFF;
7860   var integer = (val << 16) + (val << 8) + val;
7861   var string = integer.toString(16).toUpperCase();
7862   return '000000'.substring(string.length) + string;
7863 };
7864
7865 convert$3.rgb.gray = function (rgb) {
7866   var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
7867   return [val / 255 * 100];
7868 };
7869
7870 var conversions$4 = conversions$5.exports;
7871 /*
7872         this function routes a model to all other models.
7873
7874         all functions that are routed have a property `.conversion` attached
7875         to the returned synthetic function. This property is an array
7876         of strings, each with the steps in between the 'from' and 'to'
7877         color models (inclusive).
7878
7879         conversions that are not possible simply are not included.
7880 */
7881
7882 function buildGraph$1() {
7883   var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
7884
7885   var models = Object.keys(conversions$4);
7886
7887   for (var len = models.length, i = 0; i < len; i++) {
7888     graph[models[i]] = {
7889       // http://jsperf.com/1-vs-infinity
7890       // micro-opt, but this is simple.
7891       distance: -1,
7892       parent: null
7893     };
7894   }
7895
7896   return graph;
7897 } // https://en.wikipedia.org/wiki/Breadth-first_search
7898
7899
7900 function deriveBFS$1(fromModel) {
7901   var graph = buildGraph$1();
7902   var queue = [fromModel]; // unshift -> queue -> pop
7903
7904   graph[fromModel].distance = 0;
7905
7906   while (queue.length) {
7907     var current = queue.pop();
7908     var adjacents = Object.keys(conversions$4[current]);
7909
7910     for (var len = adjacents.length, i = 0; i < len; i++) {
7911       var adjacent = adjacents[i];
7912       var node = graph[adjacent];
7913
7914       if (node.distance === -1) {
7915         node.distance = graph[current].distance + 1;
7916         node.parent = current;
7917         queue.unshift(adjacent);
7918       }
7919     }
7920   }
7921
7922   return graph;
7923 }
7924
7925 function link$2(from, to) {
7926   return function (args) {
7927     return to(from(args));
7928   };
7929 }
7930
7931 function wrapConversion$1(toModel, graph) {
7932   var path = [graph[toModel].parent, toModel];
7933   var fn = conversions$4[graph[toModel].parent][toModel];
7934   var cur = graph[toModel].parent;
7935
7936   while (graph[cur].parent) {
7937     path.unshift(graph[cur].parent);
7938     fn = link$2(conversions$4[graph[cur].parent][cur], fn);
7939     cur = graph[cur].parent;
7940   }
7941
7942   fn.conversion = path;
7943   return fn;
7944 }
7945
7946 var route$3 = function (fromModel) {
7947   var graph = deriveBFS$1(fromModel);
7948   var conversion = {};
7949   var models = Object.keys(graph);
7950
7951   for (var len = models.length, i = 0; i < len; i++) {
7952     var toModel = models[i];
7953     var node = graph[toModel];
7954
7955     if (node.parent === null) {
7956       // no possible conversion, or this node is the source model.
7957       continue;
7958     }
7959
7960     conversion[toModel] = wrapConversion$1(toModel, graph);
7961   }
7962
7963   return conversion;
7964 };
7965
7966 var conversions$3 = conversions$5.exports;
7967 var route$2 = route$3;
7968 var convert$2 = {};
7969 var models$1 = Object.keys(conversions$3);
7970
7971 function wrapRaw$1(fn) {
7972   var wrappedFn = function (args) {
7973     if (args === undefined || args === null) {
7974       return args;
7975     }
7976
7977     if (arguments.length > 1) {
7978       args = Array.prototype.slice.call(arguments);
7979     }
7980
7981     return fn(args);
7982   }; // preserve .conversion property if there is one
7983
7984
7985   if ('conversion' in fn) {
7986     wrappedFn.conversion = fn.conversion;
7987   }
7988
7989   return wrappedFn;
7990 }
7991
7992 function wrapRounded$1(fn) {
7993   var wrappedFn = function (args) {
7994     if (args === undefined || args === null) {
7995       return args;
7996     }
7997
7998     if (arguments.length > 1) {
7999       args = Array.prototype.slice.call(arguments);
8000     }
8001
8002     var result = fn(args); // we're assuming the result is an array here.
8003     // see notice in conversions.js; don't use box types
8004     // in conversion functions.
8005
8006     if (typeof result === 'object') {
8007       for (var len = result.length, i = 0; i < len; i++) {
8008         result[i] = Math.round(result[i]);
8009       }
8010     }
8011
8012     return result;
8013   }; // preserve .conversion property if there is one
8014
8015
8016   if ('conversion' in fn) {
8017     wrappedFn.conversion = fn.conversion;
8018   }
8019
8020   return wrappedFn;
8021 }
8022
8023 models$1.forEach(function (fromModel) {
8024   convert$2[fromModel] = {};
8025   Object.defineProperty(convert$2[fromModel], 'channels', {
8026     value: conversions$3[fromModel].channels
8027   });
8028   Object.defineProperty(convert$2[fromModel], 'labels', {
8029     value: conversions$3[fromModel].labels
8030   });
8031   var routes = route$2(fromModel);
8032   var routeModels = Object.keys(routes);
8033   routeModels.forEach(function (toModel) {
8034     var fn = routes[toModel];
8035     convert$2[fromModel][toModel] = wrapRounded$1(fn);
8036     convert$2[fromModel][toModel].raw = wrapRaw$1(fn);
8037   });
8038 });
8039 var colorConvert$1 = convert$2;
8040
8041 (function (module) {
8042
8043   const colorConvert = colorConvert$1;
8044
8045   const wrapAnsi16 = (fn, offset) => function () {
8046     const code = fn.apply(colorConvert, arguments);
8047     return `\u001B[${code + offset}m`;
8048   };
8049
8050   const wrapAnsi256 = (fn, offset) => function () {
8051     const code = fn.apply(colorConvert, arguments);
8052     return `\u001B[${38 + offset};5;${code}m`;
8053   };
8054
8055   const wrapAnsi16m = (fn, offset) => function () {
8056     const rgb = fn.apply(colorConvert, arguments);
8057     return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
8058   };
8059
8060   function assembleStyles() {
8061     const codes = new Map();
8062     const styles = {
8063       modifier: {
8064         reset: [0, 0],
8065         // 21 isn't widely supported and 22 does the same thing
8066         bold: [1, 22],
8067         dim: [2, 22],
8068         italic: [3, 23],
8069         underline: [4, 24],
8070         inverse: [7, 27],
8071         hidden: [8, 28],
8072         strikethrough: [9, 29]
8073       },
8074       color: {
8075         black: [30, 39],
8076         red: [31, 39],
8077         green: [32, 39],
8078         yellow: [33, 39],
8079         blue: [34, 39],
8080         magenta: [35, 39],
8081         cyan: [36, 39],
8082         white: [37, 39],
8083         gray: [90, 39],
8084         // Bright color
8085         redBright: [91, 39],
8086         greenBright: [92, 39],
8087         yellowBright: [93, 39],
8088         blueBright: [94, 39],
8089         magentaBright: [95, 39],
8090         cyanBright: [96, 39],
8091         whiteBright: [97, 39]
8092       },
8093       bgColor: {
8094         bgBlack: [40, 49],
8095         bgRed: [41, 49],
8096         bgGreen: [42, 49],
8097         bgYellow: [43, 49],
8098         bgBlue: [44, 49],
8099         bgMagenta: [45, 49],
8100         bgCyan: [46, 49],
8101         bgWhite: [47, 49],
8102         // Bright color
8103         bgBlackBright: [100, 49],
8104         bgRedBright: [101, 49],
8105         bgGreenBright: [102, 49],
8106         bgYellowBright: [103, 49],
8107         bgBlueBright: [104, 49],
8108         bgMagentaBright: [105, 49],
8109         bgCyanBright: [106, 49],
8110         bgWhiteBright: [107, 49]
8111       }
8112     }; // Fix humans
8113
8114     styles.color.grey = styles.color.gray;
8115
8116     for (const groupName of Object.keys(styles)) {
8117       const group = styles[groupName];
8118
8119       for (const styleName of Object.keys(group)) {
8120         const style = group[styleName];
8121         styles[styleName] = {
8122           open: `\u001B[${style[0]}m`,
8123           close: `\u001B[${style[1]}m`
8124         };
8125         group[styleName] = styles[styleName];
8126         codes.set(style[0], style[1]);
8127       }
8128
8129       Object.defineProperty(styles, groupName, {
8130         value: group,
8131         enumerable: false
8132       });
8133       Object.defineProperty(styles, 'codes', {
8134         value: codes,
8135         enumerable: false
8136       });
8137     }
8138
8139     const ansi2ansi = n => n;
8140
8141     const rgb2rgb = (r, g, b) => [r, g, b];
8142
8143     styles.color.close = '\u001B[39m';
8144     styles.bgColor.close = '\u001B[49m';
8145     styles.color.ansi = {
8146       ansi: wrapAnsi16(ansi2ansi, 0)
8147     };
8148     styles.color.ansi256 = {
8149       ansi256: wrapAnsi256(ansi2ansi, 0)
8150     };
8151     styles.color.ansi16m = {
8152       rgb: wrapAnsi16m(rgb2rgb, 0)
8153     };
8154     styles.bgColor.ansi = {
8155       ansi: wrapAnsi16(ansi2ansi, 10)
8156     };
8157     styles.bgColor.ansi256 = {
8158       ansi256: wrapAnsi256(ansi2ansi, 10)
8159     };
8160     styles.bgColor.ansi16m = {
8161       rgb: wrapAnsi16m(rgb2rgb, 10)
8162     };
8163
8164     for (let key of Object.keys(colorConvert)) {
8165       if (typeof colorConvert[key] !== 'object') {
8166         continue;
8167       }
8168
8169       const suite = colorConvert[key];
8170
8171       if (key === 'ansi16') {
8172         key = 'ansi';
8173       }
8174
8175       if ('ansi16' in suite) {
8176         styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
8177         styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
8178       }
8179
8180       if ('ansi256' in suite) {
8181         styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
8182         styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
8183       }
8184
8185       if ('rgb' in suite) {
8186         styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
8187         styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
8188       }
8189     }
8190
8191     return styles;
8192   } // Make the export immutable
8193
8194
8195   Object.defineProperty(module, 'exports', {
8196     enumerable: true,
8197     get: assembleStyles
8198   });
8199 })(ansiStyles$2);
8200
8201 var hasFlag$5 = (flag, argv) => {
8202   argv = argv || process.argv;
8203   const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
8204   const pos = argv.indexOf(prefix + flag);
8205   const terminatorPos = argv.indexOf('--');
8206   return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
8207 };
8208
8209 const os$4 = require$$0__default$1["default"];
8210 const hasFlag$4 = hasFlag$5;
8211 const env$2 = process.env;
8212 let forceColor$2;
8213
8214 if (hasFlag$4('no-color') || hasFlag$4('no-colors') || hasFlag$4('color=false')) {
8215   forceColor$2 = false;
8216 } else if (hasFlag$4('color') || hasFlag$4('colors') || hasFlag$4('color=true') || hasFlag$4('color=always')) {
8217   forceColor$2 = true;
8218 }
8219
8220 if ('FORCE_COLOR' in env$2) {
8221   forceColor$2 = env$2.FORCE_COLOR.length === 0 || parseInt(env$2.FORCE_COLOR, 10) !== 0;
8222 }
8223
8224 function translateLevel$2(level) {
8225   if (level === 0) {
8226     return false;
8227   }
8228
8229   return {
8230     level,
8231     hasBasic: true,
8232     has256: level >= 2,
8233     has16m: level >= 3
8234   };
8235 }
8236
8237 function supportsColor$2(stream) {
8238   if (forceColor$2 === false) {
8239     return 0;
8240   }
8241
8242   if (hasFlag$4('color=16m') || hasFlag$4('color=full') || hasFlag$4('color=truecolor')) {
8243     return 3;
8244   }
8245
8246   if (hasFlag$4('color=256')) {
8247     return 2;
8248   }
8249
8250   if (stream && !stream.isTTY && forceColor$2 !== true) {
8251     return 0;
8252   }
8253
8254   const min = forceColor$2 ? 1 : 0;
8255
8256   if (process.platform === 'win32') {
8257     // Node.js 7.5.0 is the first version of Node.js to include a patch to
8258     // libuv that enables 256 color output on Windows. Anything earlier and it
8259     // won't work. However, here we target Node.js 8 at minimum as it is an LTS
8260     // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
8261     // release that supports 256 colors. Windows 10 build 14931 is the first release
8262     // that supports 16m/TrueColor.
8263     const osRelease = os$4.release().split('.');
8264
8265     if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
8266       return Number(osRelease[2]) >= 14931 ? 3 : 2;
8267     }
8268
8269     return 1;
8270   }
8271
8272   if ('CI' in env$2) {
8273     if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env$2) || env$2.CI_NAME === 'codeship') {
8274       return 1;
8275     }
8276
8277     return min;
8278   }
8279
8280   if ('TEAMCITY_VERSION' in env$2) {
8281     return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$2.TEAMCITY_VERSION) ? 1 : 0;
8282   }
8283
8284   if (env$2.COLORTERM === 'truecolor') {
8285     return 3;
8286   }
8287
8288   if ('TERM_PROGRAM' in env$2) {
8289     const version = parseInt((env$2.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
8290
8291     switch (env$2.TERM_PROGRAM) {
8292       case 'iTerm.app':
8293         return version >= 3 ? 3 : 2;
8294
8295       case 'Apple_Terminal':
8296         return 2;
8297       // No default
8298     }
8299   }
8300
8301   if (/-256(color)?$/i.test(env$2.TERM)) {
8302     return 2;
8303   }
8304
8305   if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$2.TERM)) {
8306     return 1;
8307   }
8308
8309   if ('COLORTERM' in env$2) {
8310     return 1;
8311   }
8312
8313   if (env$2.TERM === 'dumb') {
8314     return min;
8315   }
8316
8317   return min;
8318 }
8319
8320 function getSupportLevel$2(stream) {
8321   const level = supportsColor$2(stream);
8322   return translateLevel$2(level);
8323 }
8324
8325 var supportsColor_1$2 = {
8326   supportsColor: getSupportLevel$2,
8327   stdout: getSupportLevel$2(process.stdout),
8328   stderr: getSupportLevel$2(process.stderr)
8329 };
8330
8331 const TEMPLATE_REGEX$2 = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
8332 const STYLE_REGEX$2 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
8333 const STRING_REGEX$3 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
8334 const ESCAPE_REGEX$2 = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
8335 const ESCAPES$2 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
8336
8337 function unescape$2(c) {
8338   if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
8339     return String.fromCharCode(parseInt(c.slice(1), 16));
8340   }
8341
8342   return ESCAPES$2.get(c) || c;
8343 }
8344
8345 function parseArguments$2(name, args) {
8346   const results = [];
8347   const chunks = args.trim().split(/\s*,\s*/g);
8348   let matches;
8349
8350   for (const chunk of chunks) {
8351     if (!isNaN(chunk)) {
8352       results.push(Number(chunk));
8353     } else if (matches = chunk.match(STRING_REGEX$3)) {
8354       results.push(matches[2].replace(ESCAPE_REGEX$2, (m, escape, chr) => escape ? unescape$2(escape) : chr));
8355     } else {
8356       throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
8357     }
8358   }
8359
8360   return results;
8361 }
8362
8363 function parseStyle$2(style) {
8364   STYLE_REGEX$2.lastIndex = 0;
8365   const results = [];
8366   let matches;
8367
8368   while ((matches = STYLE_REGEX$2.exec(style)) !== null) {
8369     const name = matches[1];
8370
8371     if (matches[2]) {
8372       const args = parseArguments$2(name, matches[2]);
8373       results.push([name].concat(args));
8374     } else {
8375       results.push([name]);
8376     }
8377   }
8378
8379   return results;
8380 }
8381
8382 function buildStyle$2(chalk, styles) {
8383   const enabled = {};
8384
8385   for (const layer of styles) {
8386     for (const style of layer.styles) {
8387       enabled[style[0]] = layer.inverse ? null : style.slice(1);
8388     }
8389   }
8390
8391   let current = chalk;
8392
8393   for (const styleName of Object.keys(enabled)) {
8394     if (Array.isArray(enabled[styleName])) {
8395       if (!(styleName in current)) {
8396         throw new Error(`Unknown Chalk style: ${styleName}`);
8397       }
8398
8399       if (enabled[styleName].length > 0) {
8400         current = current[styleName].apply(current, enabled[styleName]);
8401       } else {
8402         current = current[styleName];
8403       }
8404     }
8405   }
8406
8407   return current;
8408 }
8409
8410 var templates$2 = (chalk, tmp) => {
8411   const styles = [];
8412   const chunks = [];
8413   let chunk = []; // eslint-disable-next-line max-params
8414
8415   tmp.replace(TEMPLATE_REGEX$2, (m, escapeChar, inverse, style, close, chr) => {
8416     if (escapeChar) {
8417       chunk.push(unescape$2(escapeChar));
8418     } else if (style) {
8419       const str = chunk.join('');
8420       chunk = [];
8421       chunks.push(styles.length === 0 ? str : buildStyle$2(chalk, styles)(str));
8422       styles.push({
8423         inverse,
8424         styles: parseStyle$2(style)
8425       });
8426     } else if (close) {
8427       if (styles.length === 0) {
8428         throw new Error('Found extraneous } in Chalk template literal');
8429       }
8430
8431       chunks.push(buildStyle$2(chalk, styles)(chunk.join('')));
8432       chunk = [];
8433       styles.pop();
8434     } else {
8435       chunk.push(chr);
8436     }
8437   });
8438   chunks.push(chunk.join(''));
8439
8440   if (styles.length > 0) {
8441     const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
8442     throw new Error(errMsg);
8443   }
8444
8445   return chunks.join('');
8446 };
8447
8448 (function (module) {
8449
8450   const escapeStringRegexp = escapeStringRegexp$1;
8451   const ansiStyles = ansiStyles$2.exports;
8452   const stdoutColor = supportsColor_1$2.stdout;
8453   const template = templates$2;
8454   const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
8455
8456   const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
8457
8458   const skipModels = new Set(['gray']);
8459   const styles = Object.create(null);
8460
8461   function applyOptions(obj, options) {
8462     options = options || {}; // Detect level if not set manually
8463
8464     const scLevel = stdoutColor ? stdoutColor.level : 0;
8465     obj.level = options.level === undefined ? scLevel : options.level;
8466     obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
8467   }
8468
8469   function Chalk(options) {
8470     // We check for this.template here since calling `chalk.constructor()`
8471     // by itself will have a `this` of a previously constructed chalk object
8472     if (!this || !(this instanceof Chalk) || this.template) {
8473       const chalk = {};
8474       applyOptions(chalk, options);
8475
8476       chalk.template = function () {
8477         const args = [].slice.call(arguments);
8478         return chalkTag.apply(null, [chalk.template].concat(args));
8479       };
8480
8481       Object.setPrototypeOf(chalk, Chalk.prototype);
8482       Object.setPrototypeOf(chalk.template, chalk);
8483       chalk.template.constructor = Chalk;
8484       return chalk.template;
8485     }
8486
8487     applyOptions(this, options);
8488   } // Use bright blue on Windows as the normal blue color is illegible
8489
8490
8491   if (isSimpleWindowsTerm) {
8492     ansiStyles.blue.open = '\u001B[94m';
8493   }
8494
8495   for (const key of Object.keys(ansiStyles)) {
8496     ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
8497     styles[key] = {
8498       get() {
8499         const codes = ansiStyles[key];
8500         return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
8501       }
8502
8503     };
8504   }
8505
8506   styles.visible = {
8507     get() {
8508       return build.call(this, this._styles || [], true, 'visible');
8509     }
8510
8511   };
8512   ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
8513
8514   for (const model of Object.keys(ansiStyles.color.ansi)) {
8515     if (skipModels.has(model)) {
8516       continue;
8517     }
8518
8519     styles[model] = {
8520       get() {
8521         const level = this.level;
8522         return function () {
8523           const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
8524           const codes = {
8525             open,
8526             close: ansiStyles.color.close,
8527             closeRe: ansiStyles.color.closeRe
8528           };
8529           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
8530         };
8531       }
8532
8533     };
8534   }
8535
8536   ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
8537
8538   for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
8539     if (skipModels.has(model)) {
8540       continue;
8541     }
8542
8543     const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
8544     styles[bgModel] = {
8545       get() {
8546         const level = this.level;
8547         return function () {
8548           const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
8549           const codes = {
8550             open,
8551             close: ansiStyles.bgColor.close,
8552             closeRe: ansiStyles.bgColor.closeRe
8553           };
8554           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
8555         };
8556       }
8557
8558     };
8559   }
8560
8561   const proto = Object.defineProperties(() => {}, styles);
8562
8563   function build(_styles, _empty, key) {
8564     const builder = function () {
8565       return applyStyle.apply(builder, arguments);
8566     };
8567
8568     builder._styles = _styles;
8569     builder._empty = _empty;
8570     const self = this;
8571     Object.defineProperty(builder, 'level', {
8572       enumerable: true,
8573
8574       get() {
8575         return self.level;
8576       },
8577
8578       set(level) {
8579         self.level = level;
8580       }
8581
8582     });
8583     Object.defineProperty(builder, 'enabled', {
8584       enumerable: true,
8585
8586       get() {
8587         return self.enabled;
8588       },
8589
8590       set(enabled) {
8591         self.enabled = enabled;
8592       }
8593
8594     }); // See below for fix regarding invisible grey/dim combination on Windows
8595
8596     builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
8597     // no way to create a function with a different prototype
8598
8599     builder.__proto__ = proto; // eslint-disable-line no-proto
8600
8601     return builder;
8602   }
8603
8604   function applyStyle() {
8605     // Support varags, but simply cast to string in case there's only one arg
8606     const args = arguments;
8607     const argsLen = args.length;
8608     let str = String(arguments[0]);
8609
8610     if (argsLen === 0) {
8611       return '';
8612     }
8613
8614     if (argsLen > 1) {
8615       // Don't slice `arguments`, it prevents V8 optimizations
8616       for (let a = 1; a < argsLen; a++) {
8617         str += ' ' + args[a];
8618       }
8619     }
8620
8621     if (!this.enabled || this.level <= 0 || !str) {
8622       return this._empty ? '' : str;
8623     } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
8624     // see https://github.com/chalk/chalk/issues/58
8625     // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
8626
8627
8628     const originalDim = ansiStyles.dim.open;
8629
8630     if (isSimpleWindowsTerm && this.hasGrey) {
8631       ansiStyles.dim.open = '';
8632     }
8633
8634     for (const code of this._styles.slice().reverse()) {
8635       // Replace any instances already present with a re-opening code
8636       // otherwise only the part of the string until said closing code
8637       // will be colored, and the rest will simply be 'plain'.
8638       str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
8639       // after next line to fix a bleed issue on macOS
8640       // https://github.com/chalk/chalk/pull/92
8641
8642       str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
8643     } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
8644
8645
8646     ansiStyles.dim.open = originalDim;
8647     return str;
8648   }
8649
8650   function chalkTag(chalk, strings) {
8651     if (!Array.isArray(strings)) {
8652       // If chalk() was called by itself or with a string,
8653       // return the string itself as a string.
8654       return [].slice.call(arguments, 1).join(' ');
8655     }
8656
8657     const args = [].slice.call(arguments, 2);
8658     const parts = [strings.raw[0]];
8659
8660     for (let i = 1; i < strings.length; i++) {
8661       parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
8662       parts.push(String(strings.raw[i]));
8663     }
8664
8665     return template(chalk, parts.join(''));
8666   }
8667
8668   Object.defineProperties(Chalk.prototype, styles);
8669   module.exports = Chalk(); // eslint-disable-line new-cap
8670
8671   module.exports.supportsColor = stdoutColor;
8672   module.exports.default = module.exports; // For TypeScript
8673 })(chalk$3);
8674
8675 Object.defineProperty(common$8, "__esModule", {
8676   value: true
8677 });
8678 const chalk_1$2 = chalk$3.exports;
8679
8680 common$8.commonDeprecatedHandler = (keyOrPair, redirectTo, {
8681   descriptor
8682 }) => {
8683   const messages = [`${chalk_1$2.default.yellow(typeof keyOrPair === 'string' ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`];
8684
8685   if (redirectTo) {
8686     messages.push(`we now treat it as ${chalk_1$2.default.blue(typeof redirectTo === 'string' ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`);
8687   }
8688
8689   return messages.join('; ') + '.';
8690 };
8691
8692 (function (exports) {
8693
8694   Object.defineProperty(exports, "__esModule", {
8695     value: true
8696   });
8697   const tslib_1 = tslib_es6;
8698
8699   tslib_1.__exportStar(common$8, exports);
8700 })(deprecated);
8701
8702 var invalid = {};
8703
8704 var common$7 = {};
8705
8706 Object.defineProperty(common$7, "__esModule", {
8707   value: true
8708 });
8709 const chalk_1$1 = chalk$3.exports;
8710
8711 common$7.commonInvalidHandler = (key, value, utils) => [`Invalid ${chalk_1$1.default.red(utils.descriptor.key(key))} value.`, `Expected ${chalk_1$1.default.blue(utils.schemas[key].expected(utils))},`, `but received ${chalk_1$1.default.red(utils.descriptor.value(value))}.`].join(' ');
8712
8713 (function (exports) {
8714
8715   Object.defineProperty(exports, "__esModule", {
8716     value: true
8717   });
8718   const tslib_1 = tslib_es6;
8719
8720   tslib_1.__exportStar(common$7, exports);
8721 })(invalid);
8722
8723 var unknown = {};
8724
8725 var leven$5 = {};
8726
8727 /* eslint-disable no-nested-ternary */
8728
8729 var arr = [];
8730 var charCodeCache$1 = [];
8731
8732 var leven$4 = function (a, b) {
8733   if (a === b) {
8734     return 0;
8735   }
8736
8737   var swap = a; // Swapping the strings if `a` is longer than `b` so we know which one is the
8738   // shortest & which one is the longest
8739
8740   if (a.length > b.length) {
8741     a = b;
8742     b = swap;
8743   }
8744
8745   var aLen = a.length;
8746   var bLen = b.length;
8747
8748   if (aLen === 0) {
8749     return bLen;
8750   }
8751
8752   if (bLen === 0) {
8753     return aLen;
8754   } // Performing suffix trimming:
8755   // We can linearly drop suffix common to both strings since they
8756   // don't increase distance at all
8757   // Note: `~-` is the bitwise way to perform a `- 1` operation
8758
8759
8760   while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
8761     aLen--;
8762     bLen--;
8763   }
8764
8765   if (aLen === 0) {
8766     return bLen;
8767   } // Performing prefix trimming
8768   // We can linearly drop prefix common to both strings since they
8769   // don't increase distance at all
8770
8771
8772   var start = 0;
8773
8774   while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
8775     start++;
8776   }
8777
8778   aLen -= start;
8779   bLen -= start;
8780
8781   if (aLen === 0) {
8782     return bLen;
8783   }
8784
8785   var bCharCode;
8786   var ret;
8787   var tmp;
8788   var tmp2;
8789   var i = 0;
8790   var j = 0;
8791
8792   while (i < aLen) {
8793     charCodeCache$1[start + i] = a.charCodeAt(start + i);
8794     arr[i] = ++i;
8795   }
8796
8797   while (j < bLen) {
8798     bCharCode = b.charCodeAt(start + j);
8799     tmp = j++;
8800     ret = j;
8801
8802     for (i = 0; i < aLen; i++) {
8803       tmp2 = bCharCode === charCodeCache$1[start + i] ? tmp : tmp + 1;
8804       tmp = arr[i];
8805       ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
8806     }
8807   }
8808
8809   return ret;
8810 };
8811
8812 Object.defineProperty(leven$5, "__esModule", {
8813   value: true
8814 });
8815 const chalk_1 = chalk$3.exports;
8816 const leven$3 = leven$4;
8817
8818 leven$5.levenUnknownHandler = (key, value, {
8819   descriptor,
8820   logger,
8821   schemas
8822 }) => {
8823   const messages = [`Ignored unknown option ${chalk_1.default.yellow(descriptor.pair({
8824     key,
8825     value
8826   }))}.`];
8827   const suggestion = Object.keys(schemas).sort().find(knownKey => leven$3(key, knownKey) < 3);
8828
8829   if (suggestion) {
8830     messages.push(`Did you mean ${chalk_1.default.blue(descriptor.key(suggestion))}?`);
8831   }
8832
8833   logger.warn(messages.join(' '));
8834 };
8835
8836 (function (exports) {
8837
8838   Object.defineProperty(exports, "__esModule", {
8839     value: true
8840   });
8841   const tslib_1 = tslib_es6;
8842
8843   tslib_1.__exportStar(leven$5, exports);
8844 })(unknown);
8845
8846 (function (exports) {
8847
8848   Object.defineProperty(exports, "__esModule", {
8849     value: true
8850   });
8851   const tslib_1 = tslib_es6;
8852
8853   tslib_1.__exportStar(deprecated, exports);
8854
8855   tslib_1.__exportStar(invalid, exports);
8856
8857   tslib_1.__exportStar(unknown, exports);
8858 })(handlers);
8859
8860 var schemas = {};
8861
8862 var alias = {};
8863
8864 var schema = {};
8865
8866 Object.defineProperty(schema, "__esModule", {
8867   value: true
8868 });
8869 const HANDLER_KEYS = ['default', 'expected', 'validate', 'deprecated', 'forward', 'redirect', 'overlap', 'preprocess', 'postprocess'];
8870
8871 function createSchema(SchemaConstructor, parameters) {
8872   const schema = new SchemaConstructor(parameters);
8873   const subSchema = Object.create(schema);
8874
8875   for (const handlerKey of HANDLER_KEYS) {
8876     if (handlerKey in parameters) {
8877       subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
8878     }
8879   }
8880
8881   return subSchema;
8882 }
8883
8884 schema.createSchema = createSchema;
8885
8886 class Schema {
8887   constructor(parameters) {
8888     this.name = parameters.name;
8889   }
8890
8891   static create(parameters) {
8892     // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/5863
8893     return createSchema(this, parameters);
8894   }
8895
8896   default(_utils) {
8897     return undefined;
8898   } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
8899
8900
8901   expected(_utils) {
8902     return 'nothing';
8903   } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
8904
8905
8906   validate(_value, _utils) {
8907     return false;
8908   }
8909
8910   deprecated(_value, _utils) {
8911     return false;
8912   }
8913
8914   forward(_value, _utils) {
8915     return undefined;
8916   }
8917
8918   redirect(_value, _utils) {
8919     return undefined;
8920   }
8921
8922   overlap(currentValue, _newValue, _utils) {
8923     return currentValue;
8924   }
8925
8926   preprocess(value, _utils) {
8927     return value;
8928   }
8929
8930   postprocess(value, _utils) {
8931     return value;
8932   }
8933
8934 }
8935
8936 schema.Schema = Schema;
8937
8938 function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
8939   return typeof handler === 'function' ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
8940 }
8941
8942 Object.defineProperty(alias, "__esModule", {
8943   value: true
8944 });
8945 const schema_1$6 = schema;
8946
8947 class AliasSchema extends schema_1$6.Schema {
8948   constructor(parameters) {
8949     super(parameters);
8950     this._sourceName = parameters.sourceName;
8951   }
8952
8953   expected(utils) {
8954     return utils.schemas[this._sourceName].expected(utils);
8955   }
8956
8957   validate(value, utils) {
8958     return utils.schemas[this._sourceName].validate(value, utils);
8959   }
8960
8961   redirect(_value, _utils) {
8962     return this._sourceName;
8963   }
8964
8965 }
8966
8967 alias.AliasSchema = AliasSchema;
8968
8969 var any = {};
8970
8971 Object.defineProperty(any, "__esModule", {
8972   value: true
8973 });
8974 const schema_1$5 = schema;
8975
8976 class AnySchema extends schema_1$5.Schema {
8977   expected() {
8978     return 'anything';
8979   }
8980
8981   validate() {
8982     return true;
8983   }
8984
8985 }
8986
8987 any.AnySchema = AnySchema;
8988
8989 var array$4 = {};
8990
8991 Object.defineProperty(array$4, "__esModule", {
8992   value: true
8993 });
8994 const tslib_1 = tslib_es6;
8995 const schema_1$4 = schema;
8996
8997 class ArraySchema extends schema_1$4.Schema {
8998   constructor(_a) {
8999     var {
9000       valueSchema,
9001       name = valueSchema.name
9002     } = _a,
9003         handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
9004
9005     super(Object.assign({}, handlers, {
9006       name
9007     }));
9008     this._valueSchema = valueSchema;
9009   }
9010
9011   expected(utils) {
9012     return `an array of ${this._valueSchema.expected(utils)}`;
9013   }
9014
9015   validate(value, utils) {
9016     if (!Array.isArray(value)) {
9017       return false;
9018     }
9019
9020     const invalidValues = [];
9021
9022     for (const subValue of value) {
9023       const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
9024
9025       if (subValidateResult !== true) {
9026         invalidValues.push(subValidateResult.value);
9027       }
9028     }
9029
9030     return invalidValues.length === 0 ? true : {
9031       value: invalidValues
9032     };
9033   }
9034
9035   deprecated(value, utils) {
9036     const deprecatedResult = [];
9037
9038     for (const subValue of value) {
9039       const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
9040
9041       if (subDeprecatedResult !== false) {
9042         deprecatedResult.push(...subDeprecatedResult.map(({
9043           value: deprecatedValue
9044         }) => ({
9045           value: [deprecatedValue]
9046         })));
9047       }
9048     }
9049
9050     return deprecatedResult;
9051   }
9052
9053   forward(value, utils) {
9054     const forwardResult = [];
9055
9056     for (const subValue of value) {
9057       const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
9058       forwardResult.push(...subForwardResult.map(wrapTransferResult));
9059     }
9060
9061     return forwardResult;
9062   }
9063
9064   redirect(value, utils) {
9065     const remain = [];
9066     const redirect = [];
9067
9068     for (const subValue of value) {
9069       const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
9070
9071       if ('remain' in subRedirectResult) {
9072         remain.push(subRedirectResult.remain);
9073       }
9074
9075       redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
9076     }
9077
9078     return remain.length === 0 ? {
9079       redirect
9080     } : {
9081       redirect,
9082       remain
9083     };
9084   }
9085
9086   overlap(currentValue, newValue) {
9087     return currentValue.concat(newValue);
9088   }
9089
9090 }
9091
9092 array$4.ArraySchema = ArraySchema;
9093
9094 function wrapTransferResult({
9095   from,
9096   to
9097 }) {
9098   return {
9099     from: [from],
9100     to
9101   };
9102 }
9103
9104 var boolean = {};
9105
9106 Object.defineProperty(boolean, "__esModule", {
9107   value: true
9108 });
9109 const schema_1$3 = schema;
9110
9111 class BooleanSchema extends schema_1$3.Schema {
9112   expected() {
9113     return 'true or false';
9114   }
9115
9116   validate(value) {
9117     return typeof value === 'boolean';
9118   }
9119
9120 }
9121
9122 boolean.BooleanSchema = BooleanSchema;
9123
9124 var choice = {};
9125
9126 var utils$s = {};
9127
9128 Object.defineProperty(utils$s, "__esModule", {
9129   value: true
9130 });
9131
9132 function recordFromArray(array, mainKey) {
9133   const record = Object.create(null);
9134
9135   for (const value of array) {
9136     const key = value[mainKey]; // istanbul ignore next
9137
9138     if (record[key]) {
9139       throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
9140     } // @ts-ignore
9141
9142
9143     record[key] = value;
9144   }
9145
9146   return record;
9147 }
9148
9149 utils$s.recordFromArray = recordFromArray;
9150
9151 function mapFromArray(array, mainKey) {
9152   const map = new Map();
9153
9154   for (const value of array) {
9155     const key = value[mainKey]; // istanbul ignore next
9156
9157     if (map.has(key)) {
9158       throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
9159     }
9160
9161     map.set(key, value);
9162   }
9163
9164   return map;
9165 }
9166
9167 utils$s.mapFromArray = mapFromArray;
9168
9169 function createAutoChecklist() {
9170   const map = Object.create(null);
9171   return id => {
9172     const idString = JSON.stringify(id);
9173
9174     if (map[idString]) {
9175       return true;
9176     }
9177
9178     map[idString] = true;
9179     return false;
9180   };
9181 }
9182
9183 utils$s.createAutoChecklist = createAutoChecklist;
9184
9185 function partition$2(array, predicate) {
9186   const trueArray = [];
9187   const falseArray = [];
9188
9189   for (const value of array) {
9190     if (predicate(value)) {
9191       trueArray.push(value);
9192     } else {
9193       falseArray.push(value);
9194     }
9195   }
9196
9197   return [trueArray, falseArray];
9198 }
9199
9200 utils$s.partition = partition$2;
9201
9202 function isInt(value) {
9203   return value === Math.floor(value);
9204 }
9205
9206 utils$s.isInt = isInt;
9207
9208 function comparePrimitive(a, b) {
9209   if (a === b) {
9210     return 0;
9211   }
9212
9213   const typeofA = typeof a;
9214   const typeofB = typeof b;
9215   const orders = ['undefined', 'object', 'boolean', 'number', 'string'];
9216
9217   if (typeofA !== typeofB) {
9218     return orders.indexOf(typeofA) - orders.indexOf(typeofB);
9219   }
9220
9221   if (typeofA !== 'string') {
9222     return Number(a) - Number(b);
9223   }
9224
9225   return a.localeCompare(b);
9226 }
9227
9228 utils$s.comparePrimitive = comparePrimitive;
9229
9230 function normalizeDefaultResult(result) {
9231   return result === undefined ? {} : result;
9232 }
9233
9234 utils$s.normalizeDefaultResult = normalizeDefaultResult;
9235
9236 function normalizeValidateResult(result, value) {
9237   return result === true ? true : result === false ? {
9238     value
9239   } : result;
9240 }
9241
9242 utils$s.normalizeValidateResult = normalizeValidateResult;
9243
9244 function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
9245   return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
9246     value
9247   }] : 'value' in result ? [result] : result.length === 0 ? false : result;
9248 }
9249
9250 utils$s.normalizeDeprecatedResult = normalizeDeprecatedResult;
9251
9252 function normalizeTransferResult(result, value) {
9253   return typeof result === 'string' || 'key' in result ? {
9254     from: value,
9255     to: result
9256   } : 'from' in result ? {
9257     from: result.from,
9258     to: result.to
9259   } : {
9260     from: value,
9261     to: result.to
9262   };
9263 }
9264
9265 utils$s.normalizeTransferResult = normalizeTransferResult;
9266
9267 function normalizeForwardResult(result, value) {
9268   return result === undefined ? [] : Array.isArray(result) ? result.map(transferResult => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
9269 }
9270
9271 utils$s.normalizeForwardResult = normalizeForwardResult;
9272
9273 function normalizeRedirectResult(result, value) {
9274   const redirect = normalizeForwardResult(typeof result === 'object' && 'redirect' in result ? result.redirect : result, value);
9275   return redirect.length === 0 ? {
9276     remain: value,
9277     redirect
9278   } : typeof result === 'object' && 'remain' in result ? {
9279     remain: result.remain,
9280     redirect
9281   } : {
9282     redirect
9283   };
9284 }
9285
9286 utils$s.normalizeRedirectResult = normalizeRedirectResult;
9287
9288 Object.defineProperty(choice, "__esModule", {
9289   value: true
9290 });
9291 const schema_1$2 = schema;
9292 const utils_1$2 = utils$s;
9293
9294 class ChoiceSchema extends schema_1$2.Schema {
9295   constructor(parameters) {
9296     super(parameters);
9297     this._choices = utils_1$2.mapFromArray(parameters.choices.map(choice => choice && typeof choice === 'object' ? choice : {
9298       value: choice
9299     }), 'value');
9300   }
9301
9302   expected({
9303     descriptor
9304   }) {
9305     const choiceValues = Array.from(this._choices.keys()).map(value => this._choices.get(value)).filter(choiceInfo => !choiceInfo.deprecated).map(choiceInfo => choiceInfo.value).sort(utils_1$2.comparePrimitive).map(descriptor.value);
9306     const head = choiceValues.slice(0, -2);
9307     const tail = choiceValues.slice(-2);
9308     return head.concat(tail.join(' or ')).join(', ');
9309   }
9310
9311   validate(value) {
9312     return this._choices.has(value);
9313   }
9314
9315   deprecated(value) {
9316     const choiceInfo = this._choices.get(value);
9317
9318     return choiceInfo && choiceInfo.deprecated ? {
9319       value
9320     } : false;
9321   }
9322
9323   forward(value) {
9324     const choiceInfo = this._choices.get(value);
9325
9326     return choiceInfo ? choiceInfo.forward : undefined;
9327   }
9328
9329   redirect(value) {
9330     const choiceInfo = this._choices.get(value);
9331
9332     return choiceInfo ? choiceInfo.redirect : undefined;
9333   }
9334
9335 }
9336
9337 choice.ChoiceSchema = ChoiceSchema;
9338
9339 var integer = {};
9340
9341 var number = {};
9342
9343 Object.defineProperty(number, "__esModule", {
9344   value: true
9345 });
9346 const schema_1$1 = schema;
9347
9348 class NumberSchema extends schema_1$1.Schema {
9349   expected() {
9350     return 'a number';
9351   }
9352
9353   validate(value, _utils) {
9354     return typeof value === 'number';
9355   }
9356
9357 }
9358
9359 number.NumberSchema = NumberSchema;
9360
9361 Object.defineProperty(integer, "__esModule", {
9362   value: true
9363 });
9364 const utils_1$1 = utils$s;
9365 const number_1 = number;
9366
9367 class IntegerSchema extends number_1.NumberSchema {
9368   expected() {
9369     return 'an integer';
9370   }
9371
9372   validate(value, utils) {
9373     return utils.normalizeValidateResult(super.validate(value, utils), value) === true && utils_1$1.isInt(value);
9374   }
9375
9376 }
9377
9378 integer.IntegerSchema = IntegerSchema;
9379
9380 var string$2 = {};
9381
9382 Object.defineProperty(string$2, "__esModule", {
9383   value: true
9384 });
9385 const schema_1 = schema;
9386
9387 class StringSchema extends schema_1.Schema {
9388   expected() {
9389     return 'a string';
9390   }
9391
9392   validate(value) {
9393     return typeof value === 'string';
9394   }
9395
9396 }
9397
9398 string$2.StringSchema = StringSchema;
9399
9400 (function (exports) {
9401
9402   Object.defineProperty(exports, "__esModule", {
9403     value: true
9404   });
9405   const tslib_1 = tslib_es6;
9406
9407   tslib_1.__exportStar(alias, exports);
9408
9409   tslib_1.__exportStar(any, exports);
9410
9411   tslib_1.__exportStar(array$4, exports);
9412
9413   tslib_1.__exportStar(boolean, exports);
9414
9415   tslib_1.__exportStar(choice, exports);
9416
9417   tslib_1.__exportStar(integer, exports);
9418
9419   tslib_1.__exportStar(number, exports);
9420
9421   tslib_1.__exportStar(string$2, exports);
9422 })(schemas);
9423
9424 var normalize$2 = {};
9425
9426 var defaults = {};
9427
9428 Object.defineProperty(defaults, "__esModule", {
9429   value: true
9430 });
9431 const api_1 = api;
9432 const common_1 = common$8;
9433 const invalid_1 = invalid;
9434 const leven_1 = leven$5;
9435 defaults.defaultDescriptor = api_1.apiDescriptor;
9436 defaults.defaultUnknownHandler = leven_1.levenUnknownHandler;
9437 defaults.defaultInvalidHandler = invalid_1.commonInvalidHandler;
9438 defaults.defaultDeprecatedHandler = common_1.commonDeprecatedHandler;
9439
9440 Object.defineProperty(normalize$2, "__esModule", {
9441   value: true
9442 });
9443 const defaults_1 = defaults;
9444 const utils_1 = utils$s;
9445
9446 normalize$2.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
9447
9448 class Normalizer {
9449   constructor(schemas, opts) {
9450     // istanbul ignore next
9451     const {
9452       logger = console,
9453       descriptor = defaults_1.defaultDescriptor,
9454       unknown = defaults_1.defaultUnknownHandler,
9455       invalid = defaults_1.defaultInvalidHandler,
9456       deprecated = defaults_1.defaultDeprecatedHandler
9457     } = opts || {};
9458     this._utils = {
9459       descriptor,
9460       logger:
9461       /* istanbul ignore next */
9462       logger || {
9463         warn: () => {}
9464       },
9465       schemas: utils_1.recordFromArray(schemas, 'name'),
9466       normalizeDefaultResult: utils_1.normalizeDefaultResult,
9467       normalizeDeprecatedResult: utils_1.normalizeDeprecatedResult,
9468       normalizeForwardResult: utils_1.normalizeForwardResult,
9469       normalizeRedirectResult: utils_1.normalizeRedirectResult,
9470       normalizeValidateResult: utils_1.normalizeValidateResult
9471     };
9472     this._unknownHandler = unknown;
9473     this._invalidHandler = invalid;
9474     this._deprecatedHandler = deprecated;
9475     this.cleanHistory();
9476   }
9477
9478   cleanHistory() {
9479     this._hasDeprecationWarned = utils_1.createAutoChecklist();
9480   }
9481
9482   normalize(options) {
9483     const normalized = {};
9484     const restOptionsArray = [options];
9485
9486     const applyNormalization = () => {
9487       while (restOptionsArray.length !== 0) {
9488         const currentOptions = restOptionsArray.shift();
9489
9490         const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
9491
9492         restOptionsArray.push(...transferredOptionsArray);
9493       }
9494     };
9495
9496     applyNormalization();
9497
9498     for (const key of Object.keys(this._utils.schemas)) {
9499       const schema = this._utils.schemas[key];
9500
9501       if (!(key in normalized)) {
9502         const defaultResult = utils_1.normalizeDefaultResult(schema.default(this._utils));
9503
9504         if ('value' in defaultResult) {
9505           restOptionsArray.push({
9506             [key]: defaultResult.value
9507           });
9508         }
9509       }
9510     }
9511
9512     applyNormalization();
9513
9514     for (const key of Object.keys(this._utils.schemas)) {
9515       const schema = this._utils.schemas[key];
9516
9517       if (key in normalized) {
9518         normalized[key] = schema.postprocess(normalized[key], this._utils);
9519       }
9520     }
9521
9522     return normalized;
9523   }
9524
9525   _applyNormalization(options, normalized) {
9526     const transferredOptionsArray = [];
9527     const [knownOptionNames, unknownOptionNames] = utils_1.partition(Object.keys(options), key => key in this._utils.schemas);
9528
9529     for (const key of knownOptionNames) {
9530       const schema = this._utils.schemas[key];
9531       const value = schema.preprocess(options[key], this._utils);
9532       const validateResult = utils_1.normalizeValidateResult(schema.validate(value, this._utils), value);
9533
9534       if (validateResult !== true) {
9535         const {
9536           value: invalidValue
9537         } = validateResult;
9538
9539         const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
9540
9541         throw typeof errorMessageOrError === 'string' ? new Error(errorMessageOrError) :
9542         /* istanbul ignore next*/
9543         errorMessageOrError;
9544       }
9545
9546       const appendTransferredOptions = ({
9547         from,
9548         to
9549       }) => {
9550         transferredOptionsArray.push(typeof to === 'string' ? {
9551           [to]: from
9552         } : {
9553           [to.key]: to.value
9554         });
9555       };
9556
9557       const warnDeprecated = ({
9558         value: currentValue,
9559         redirectTo
9560       }) => {
9561         const deprecatedResult = utils_1.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value,
9562         /* doNotNormalizeTrue */
9563         true);
9564
9565         if (deprecatedResult === false) {
9566           return;
9567         }
9568
9569         if (deprecatedResult === true) {
9570           if (!this._hasDeprecationWarned(key)) {
9571             this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
9572           }
9573         } else {
9574           for (const {
9575             value: deprecatedValue
9576           } of deprecatedResult) {
9577             const pair = {
9578               key,
9579               value: deprecatedValue
9580             };
9581
9582             if (!this._hasDeprecationWarned(pair)) {
9583               const redirectToPair = typeof redirectTo === 'string' ? {
9584                 key: redirectTo,
9585                 value: deprecatedValue
9586               } : redirectTo;
9587
9588               this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
9589             }
9590           }
9591         }
9592       };
9593
9594       const forwardResult = utils_1.normalizeForwardResult(schema.forward(value, this._utils), value);
9595       forwardResult.forEach(appendTransferredOptions);
9596       const redirectResult = utils_1.normalizeRedirectResult(schema.redirect(value, this._utils), value);
9597       redirectResult.redirect.forEach(appendTransferredOptions);
9598
9599       if ('remain' in redirectResult) {
9600         const remainingValue = redirectResult.remain;
9601         normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
9602         warnDeprecated({
9603           value: remainingValue
9604         });
9605       }
9606
9607       for (const {
9608         from,
9609         to
9610       } of redirectResult.redirect) {
9611         warnDeprecated({
9612           value: from,
9613           redirectTo: to
9614         });
9615       }
9616     }
9617
9618     for (const key of unknownOptionNames) {
9619       const value = options[key];
9620
9621       const unknownResult = this._unknownHandler(key, value, this._utils);
9622
9623       if (unknownResult) {
9624         for (const unknownKey of Object.keys(unknownResult)) {
9625           const unknownOption = {
9626             [unknownKey]: unknownResult[unknownKey]
9627           };
9628
9629           if (unknownKey in this._utils.schemas) {
9630             transferredOptionsArray.push(unknownOption);
9631           } else {
9632             Object.assign(normalized, unknownOption);
9633           }
9634         }
9635       }
9636     }
9637
9638     return transferredOptionsArray;
9639   }
9640
9641 }
9642
9643 normalize$2.Normalizer = Normalizer;
9644
9645 (function (exports) {
9646
9647   Object.defineProperty(exports, "__esModule", {
9648     value: true
9649   });
9650   const tslib_1 = tslib_es6;
9651
9652   tslib_1.__exportStar(descriptors, exports);
9653
9654   tslib_1.__exportStar(handlers, exports);
9655
9656   tslib_1.__exportStar(schemas, exports);
9657
9658   tslib_1.__exportStar(normalize$2, exports);
9659
9660   tslib_1.__exportStar(schema, exports);
9661 })(lib$4);
9662
9663 var leven$2 = {exports: {}};
9664
9665 const array$3 = [];
9666 const charCodeCache = [];
9667
9668 const leven$1 = (left, right) => {
9669   if (left === right) {
9670     return 0;
9671   }
9672
9673   const swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the
9674   // shortest & which one is the longest
9675
9676   if (left.length > right.length) {
9677     left = right;
9678     right = swap;
9679   }
9680
9681   let leftLength = left.length;
9682   let rightLength = right.length; // Performing suffix trimming:
9683   // We can linearly drop suffix common to both strings since they
9684   // don't increase distance at all
9685   // Note: `~-` is the bitwise way to perform a `- 1` operation
9686
9687   while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) {
9688     leftLength--;
9689     rightLength--;
9690   } // Performing prefix trimming
9691   // We can linearly drop prefix common to both strings since they
9692   // don't increase distance at all
9693
9694
9695   let start = 0;
9696
9697   while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) {
9698     start++;
9699   }
9700
9701   leftLength -= start;
9702   rightLength -= start;
9703
9704   if (leftLength === 0) {
9705     return rightLength;
9706   }
9707
9708   let bCharCode;
9709   let result;
9710   let temp;
9711   let temp2;
9712   let i = 0;
9713   let j = 0;
9714
9715   while (i < leftLength) {
9716     charCodeCache[i] = left.charCodeAt(start + i);
9717     array$3[i] = ++i;
9718   }
9719
9720   while (j < rightLength) {
9721     bCharCode = right.charCodeAt(start + j);
9722     temp = j++;
9723     result = j;
9724
9725     for (i = 0; i < leftLength; i++) {
9726       temp2 = bCharCode === charCodeCache[i] ? temp : temp + 1;
9727       temp = array$3[i]; // eslint-disable-next-line no-multi-assign
9728
9729       result = array$3[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
9730     }
9731   }
9732
9733   return result;
9734 };
9735
9736 leven$2.exports = leven$1; // TODO: Remove this for the next major release
9737
9738 leven$2.exports.default = leven$1;
9739
9740 var ansiStyles$1 = {exports: {}};
9741
9742 var colorName = {
9743   "aliceblue": [240, 248, 255],
9744   "antiquewhite": [250, 235, 215],
9745   "aqua": [0, 255, 255],
9746   "aquamarine": [127, 255, 212],
9747   "azure": [240, 255, 255],
9748   "beige": [245, 245, 220],
9749   "bisque": [255, 228, 196],
9750   "black": [0, 0, 0],
9751   "blanchedalmond": [255, 235, 205],
9752   "blue": [0, 0, 255],
9753   "blueviolet": [138, 43, 226],
9754   "brown": [165, 42, 42],
9755   "burlywood": [222, 184, 135],
9756   "cadetblue": [95, 158, 160],
9757   "chartreuse": [127, 255, 0],
9758   "chocolate": [210, 105, 30],
9759   "coral": [255, 127, 80],
9760   "cornflowerblue": [100, 149, 237],
9761   "cornsilk": [255, 248, 220],
9762   "crimson": [220, 20, 60],
9763   "cyan": [0, 255, 255],
9764   "darkblue": [0, 0, 139],
9765   "darkcyan": [0, 139, 139],
9766   "darkgoldenrod": [184, 134, 11],
9767   "darkgray": [169, 169, 169],
9768   "darkgreen": [0, 100, 0],
9769   "darkgrey": [169, 169, 169],
9770   "darkkhaki": [189, 183, 107],
9771   "darkmagenta": [139, 0, 139],
9772   "darkolivegreen": [85, 107, 47],
9773   "darkorange": [255, 140, 0],
9774   "darkorchid": [153, 50, 204],
9775   "darkred": [139, 0, 0],
9776   "darksalmon": [233, 150, 122],
9777   "darkseagreen": [143, 188, 143],
9778   "darkslateblue": [72, 61, 139],
9779   "darkslategray": [47, 79, 79],
9780   "darkslategrey": [47, 79, 79],
9781   "darkturquoise": [0, 206, 209],
9782   "darkviolet": [148, 0, 211],
9783   "deeppink": [255, 20, 147],
9784   "deepskyblue": [0, 191, 255],
9785   "dimgray": [105, 105, 105],
9786   "dimgrey": [105, 105, 105],
9787   "dodgerblue": [30, 144, 255],
9788   "firebrick": [178, 34, 34],
9789   "floralwhite": [255, 250, 240],
9790   "forestgreen": [34, 139, 34],
9791   "fuchsia": [255, 0, 255],
9792   "gainsboro": [220, 220, 220],
9793   "ghostwhite": [248, 248, 255],
9794   "gold": [255, 215, 0],
9795   "goldenrod": [218, 165, 32],
9796   "gray": [128, 128, 128],
9797   "green": [0, 128, 0],
9798   "greenyellow": [173, 255, 47],
9799   "grey": [128, 128, 128],
9800   "honeydew": [240, 255, 240],
9801   "hotpink": [255, 105, 180],
9802   "indianred": [205, 92, 92],
9803   "indigo": [75, 0, 130],
9804   "ivory": [255, 255, 240],
9805   "khaki": [240, 230, 140],
9806   "lavender": [230, 230, 250],
9807   "lavenderblush": [255, 240, 245],
9808   "lawngreen": [124, 252, 0],
9809   "lemonchiffon": [255, 250, 205],
9810   "lightblue": [173, 216, 230],
9811   "lightcoral": [240, 128, 128],
9812   "lightcyan": [224, 255, 255],
9813   "lightgoldenrodyellow": [250, 250, 210],
9814   "lightgray": [211, 211, 211],
9815   "lightgreen": [144, 238, 144],
9816   "lightgrey": [211, 211, 211],
9817   "lightpink": [255, 182, 193],
9818   "lightsalmon": [255, 160, 122],
9819   "lightseagreen": [32, 178, 170],
9820   "lightskyblue": [135, 206, 250],
9821   "lightslategray": [119, 136, 153],
9822   "lightslategrey": [119, 136, 153],
9823   "lightsteelblue": [176, 196, 222],
9824   "lightyellow": [255, 255, 224],
9825   "lime": [0, 255, 0],
9826   "limegreen": [50, 205, 50],
9827   "linen": [250, 240, 230],
9828   "magenta": [255, 0, 255],
9829   "maroon": [128, 0, 0],
9830   "mediumaquamarine": [102, 205, 170],
9831   "mediumblue": [0, 0, 205],
9832   "mediumorchid": [186, 85, 211],
9833   "mediumpurple": [147, 112, 219],
9834   "mediumseagreen": [60, 179, 113],
9835   "mediumslateblue": [123, 104, 238],
9836   "mediumspringgreen": [0, 250, 154],
9837   "mediumturquoise": [72, 209, 204],
9838   "mediumvioletred": [199, 21, 133],
9839   "midnightblue": [25, 25, 112],
9840   "mintcream": [245, 255, 250],
9841   "mistyrose": [255, 228, 225],
9842   "moccasin": [255, 228, 181],
9843   "navajowhite": [255, 222, 173],
9844   "navy": [0, 0, 128],
9845   "oldlace": [253, 245, 230],
9846   "olive": [128, 128, 0],
9847   "olivedrab": [107, 142, 35],
9848   "orange": [255, 165, 0],
9849   "orangered": [255, 69, 0],
9850   "orchid": [218, 112, 214],
9851   "palegoldenrod": [238, 232, 170],
9852   "palegreen": [152, 251, 152],
9853   "paleturquoise": [175, 238, 238],
9854   "palevioletred": [219, 112, 147],
9855   "papayawhip": [255, 239, 213],
9856   "peachpuff": [255, 218, 185],
9857   "peru": [205, 133, 63],
9858   "pink": [255, 192, 203],
9859   "plum": [221, 160, 221],
9860   "powderblue": [176, 224, 230],
9861   "purple": [128, 0, 128],
9862   "rebeccapurple": [102, 51, 153],
9863   "red": [255, 0, 0],
9864   "rosybrown": [188, 143, 143],
9865   "royalblue": [65, 105, 225],
9866   "saddlebrown": [139, 69, 19],
9867   "salmon": [250, 128, 114],
9868   "sandybrown": [244, 164, 96],
9869   "seagreen": [46, 139, 87],
9870   "seashell": [255, 245, 238],
9871   "sienna": [160, 82, 45],
9872   "silver": [192, 192, 192],
9873   "skyblue": [135, 206, 235],
9874   "slateblue": [106, 90, 205],
9875   "slategray": [112, 128, 144],
9876   "slategrey": [112, 128, 144],
9877   "snow": [255, 250, 250],
9878   "springgreen": [0, 255, 127],
9879   "steelblue": [70, 130, 180],
9880   "tan": [210, 180, 140],
9881   "teal": [0, 128, 128],
9882   "thistle": [216, 191, 216],
9883   "tomato": [255, 99, 71],
9884   "turquoise": [64, 224, 208],
9885   "violet": [238, 130, 238],
9886   "wheat": [245, 222, 179],
9887   "white": [255, 255, 255],
9888   "whitesmoke": [245, 245, 245],
9889   "yellow": [255, 255, 0],
9890   "yellowgreen": [154, 205, 50]
9891 };
9892
9893 /* MIT license */
9894 /* eslint-disable no-mixed-operators */
9895
9896 const cssKeywords = colorName; // NOTE: conversions should only return primitive values (i.e. arrays, or
9897 //       values that give correct `typeof` results).
9898 //       do not use box values types (i.e. Number(), String(), etc.)
9899
9900 const reverseKeywords = {};
9901
9902 for (const key of Object.keys(cssKeywords)) {
9903   reverseKeywords[cssKeywords[key]] = key;
9904 }
9905
9906 const convert$1 = {
9907   rgb: {
9908     channels: 3,
9909     labels: 'rgb'
9910   },
9911   hsl: {
9912     channels: 3,
9913     labels: 'hsl'
9914   },
9915   hsv: {
9916     channels: 3,
9917     labels: 'hsv'
9918   },
9919   hwb: {
9920     channels: 3,
9921     labels: 'hwb'
9922   },
9923   cmyk: {
9924     channels: 4,
9925     labels: 'cmyk'
9926   },
9927   xyz: {
9928     channels: 3,
9929     labels: 'xyz'
9930   },
9931   lab: {
9932     channels: 3,
9933     labels: 'lab'
9934   },
9935   lch: {
9936     channels: 3,
9937     labels: 'lch'
9938   },
9939   hex: {
9940     channels: 1,
9941     labels: ['hex']
9942   },
9943   keyword: {
9944     channels: 1,
9945     labels: ['keyword']
9946   },
9947   ansi16: {
9948     channels: 1,
9949     labels: ['ansi16']
9950   },
9951   ansi256: {
9952     channels: 1,
9953     labels: ['ansi256']
9954   },
9955   hcg: {
9956     channels: 3,
9957     labels: ['h', 'c', 'g']
9958   },
9959   apple: {
9960     channels: 3,
9961     labels: ['r16', 'g16', 'b16']
9962   },
9963   gray: {
9964     channels: 1,
9965     labels: ['gray']
9966   }
9967 };
9968 var conversions$2 = convert$1; // Hide .channels and .labels properties
9969
9970 for (const model of Object.keys(convert$1)) {
9971   if (!('channels' in convert$1[model])) {
9972     throw new Error('missing channels property: ' + model);
9973   }
9974
9975   if (!('labels' in convert$1[model])) {
9976     throw new Error('missing channel labels property: ' + model);
9977   }
9978
9979   if (convert$1[model].labels.length !== convert$1[model].channels) {
9980     throw new Error('channel and label counts mismatch: ' + model);
9981   }
9982
9983   const {
9984     channels,
9985     labels
9986   } = convert$1[model];
9987   delete convert$1[model].channels;
9988   delete convert$1[model].labels;
9989   Object.defineProperty(convert$1[model], 'channels', {
9990     value: channels
9991   });
9992   Object.defineProperty(convert$1[model], 'labels', {
9993     value: labels
9994   });
9995 }
9996
9997 convert$1.rgb.hsl = function (rgb) {
9998   const r = rgb[0] / 255;
9999   const g = rgb[1] / 255;
10000   const b = rgb[2] / 255;
10001   const min = Math.min(r, g, b);
10002   const max = Math.max(r, g, b);
10003   const delta = max - min;
10004   let h;
10005   let s;
10006
10007   if (max === min) {
10008     h = 0;
10009   } else if (r === max) {
10010     h = (g - b) / delta;
10011   } else if (g === max) {
10012     h = 2 + (b - r) / delta;
10013   } else if (b === max) {
10014     h = 4 + (r - g) / delta;
10015   }
10016
10017   h = Math.min(h * 60, 360);
10018
10019   if (h < 0) {
10020     h += 360;
10021   }
10022
10023   const l = (min + max) / 2;
10024
10025   if (max === min) {
10026     s = 0;
10027   } else if (l <= 0.5) {
10028     s = delta / (max + min);
10029   } else {
10030     s = delta / (2 - max - min);
10031   }
10032
10033   return [h, s * 100, l * 100];
10034 };
10035
10036 convert$1.rgb.hsv = function (rgb) {
10037   let rdif;
10038   let gdif;
10039   let bdif;
10040   let h;
10041   let s;
10042   const r = rgb[0] / 255;
10043   const g = rgb[1] / 255;
10044   const b = rgb[2] / 255;
10045   const v = Math.max(r, g, b);
10046   const diff = v - Math.min(r, g, b);
10047
10048   const diffc = function (c) {
10049     return (v - c) / 6 / diff + 1 / 2;
10050   };
10051
10052   if (diff === 0) {
10053     h = 0;
10054     s = 0;
10055   } else {
10056     s = diff / v;
10057     rdif = diffc(r);
10058     gdif = diffc(g);
10059     bdif = diffc(b);
10060
10061     if (r === v) {
10062       h = bdif - gdif;
10063     } else if (g === v) {
10064       h = 1 / 3 + rdif - bdif;
10065     } else if (b === v) {
10066       h = 2 / 3 + gdif - rdif;
10067     }
10068
10069     if (h < 0) {
10070       h += 1;
10071     } else if (h > 1) {
10072       h -= 1;
10073     }
10074   }
10075
10076   return [h * 360, s * 100, v * 100];
10077 };
10078
10079 convert$1.rgb.hwb = function (rgb) {
10080   const r = rgb[0];
10081   const g = rgb[1];
10082   let b = rgb[2];
10083   const h = convert$1.rgb.hsl(rgb)[0];
10084   const w = 1 / 255 * Math.min(r, Math.min(g, b));
10085   b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
10086   return [h, w * 100, b * 100];
10087 };
10088
10089 convert$1.rgb.cmyk = function (rgb) {
10090   const r = rgb[0] / 255;
10091   const g = rgb[1] / 255;
10092   const b = rgb[2] / 255;
10093   const k = Math.min(1 - r, 1 - g, 1 - b);
10094   const c = (1 - r - k) / (1 - k) || 0;
10095   const m = (1 - g - k) / (1 - k) || 0;
10096   const y = (1 - b - k) / (1 - k) || 0;
10097   return [c * 100, m * 100, y * 100, k * 100];
10098 };
10099
10100 function comparativeDistance(x, y) {
10101   /*
10102         See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
10103   */
10104   return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
10105 }
10106
10107 convert$1.rgb.keyword = function (rgb) {
10108   const reversed = reverseKeywords[rgb];
10109
10110   if (reversed) {
10111     return reversed;
10112   }
10113
10114   let currentClosestDistance = Infinity;
10115   let currentClosestKeyword;
10116
10117   for (const keyword of Object.keys(cssKeywords)) {
10118     const value = cssKeywords[keyword]; // Compute comparative distance
10119
10120     const distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
10121
10122     if (distance < currentClosestDistance) {
10123       currentClosestDistance = distance;
10124       currentClosestKeyword = keyword;
10125     }
10126   }
10127
10128   return currentClosestKeyword;
10129 };
10130
10131 convert$1.keyword.rgb = function (keyword) {
10132   return cssKeywords[keyword];
10133 };
10134
10135 convert$1.rgb.xyz = function (rgb) {
10136   let r = rgb[0] / 255;
10137   let g = rgb[1] / 255;
10138   let b = rgb[2] / 255; // Assume sRGB
10139
10140   r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
10141   g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
10142   b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
10143   const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
10144   const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
10145   const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
10146   return [x * 100, y * 100, z * 100];
10147 };
10148
10149 convert$1.rgb.lab = function (rgb) {
10150   const xyz = convert$1.rgb.xyz(rgb);
10151   let x = xyz[0];
10152   let y = xyz[1];
10153   let z = xyz[2];
10154   x /= 95.047;
10155   y /= 100;
10156   z /= 108.883;
10157   x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
10158   y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
10159   z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
10160   const l = 116 * y - 16;
10161   const a = 500 * (x - y);
10162   const b = 200 * (y - z);
10163   return [l, a, b];
10164 };
10165
10166 convert$1.hsl.rgb = function (hsl) {
10167   const h = hsl[0] / 360;
10168   const s = hsl[1] / 100;
10169   const l = hsl[2] / 100;
10170   let t2;
10171   let t3;
10172   let val;
10173
10174   if (s === 0) {
10175     val = l * 255;
10176     return [val, val, val];
10177   }
10178
10179   if (l < 0.5) {
10180     t2 = l * (1 + s);
10181   } else {
10182     t2 = l + s - l * s;
10183   }
10184
10185   const t1 = 2 * l - t2;
10186   const rgb = [0, 0, 0];
10187
10188   for (let i = 0; i < 3; i++) {
10189     t3 = h + 1 / 3 * -(i - 1);
10190
10191     if (t3 < 0) {
10192       t3++;
10193     }
10194
10195     if (t3 > 1) {
10196       t3--;
10197     }
10198
10199     if (6 * t3 < 1) {
10200       val = t1 + (t2 - t1) * 6 * t3;
10201     } else if (2 * t3 < 1) {
10202       val = t2;
10203     } else if (3 * t3 < 2) {
10204       val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
10205     } else {
10206       val = t1;
10207     }
10208
10209     rgb[i] = val * 255;
10210   }
10211
10212   return rgb;
10213 };
10214
10215 convert$1.hsl.hsv = function (hsl) {
10216   const h = hsl[0];
10217   let s = hsl[1] / 100;
10218   let l = hsl[2] / 100;
10219   let smin = s;
10220   const lmin = Math.max(l, 0.01);
10221   l *= 2;
10222   s *= l <= 1 ? l : 2 - l;
10223   smin *= lmin <= 1 ? lmin : 2 - lmin;
10224   const v = (l + s) / 2;
10225   const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
10226   return [h, sv * 100, v * 100];
10227 };
10228
10229 convert$1.hsv.rgb = function (hsv) {
10230   const h = hsv[0] / 60;
10231   const s = hsv[1] / 100;
10232   let v = hsv[2] / 100;
10233   const hi = Math.floor(h) % 6;
10234   const f = h - Math.floor(h);
10235   const p = 255 * v * (1 - s);
10236   const q = 255 * v * (1 - s * f);
10237   const t = 255 * v * (1 - s * (1 - f));
10238   v *= 255;
10239
10240   switch (hi) {
10241     case 0:
10242       return [v, t, p];
10243
10244     case 1:
10245       return [q, v, p];
10246
10247     case 2:
10248       return [p, v, t];
10249
10250     case 3:
10251       return [p, q, v];
10252
10253     case 4:
10254       return [t, p, v];
10255
10256     case 5:
10257       return [v, p, q];
10258   }
10259 };
10260
10261 convert$1.hsv.hsl = function (hsv) {
10262   const h = hsv[0];
10263   const s = hsv[1] / 100;
10264   const v = hsv[2] / 100;
10265   const vmin = Math.max(v, 0.01);
10266   let sl;
10267   let l;
10268   l = (2 - s) * v;
10269   const lmin = (2 - s) * vmin;
10270   sl = s * vmin;
10271   sl /= lmin <= 1 ? lmin : 2 - lmin;
10272   sl = sl || 0;
10273   l /= 2;
10274   return [h, sl * 100, l * 100];
10275 }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
10276
10277
10278 convert$1.hwb.rgb = function (hwb) {
10279   const h = hwb[0] / 360;
10280   let wh = hwb[1] / 100;
10281   let bl = hwb[2] / 100;
10282   const ratio = wh + bl;
10283   let f; // Wh + bl cant be > 1
10284
10285   if (ratio > 1) {
10286     wh /= ratio;
10287     bl /= ratio;
10288   }
10289
10290   const i = Math.floor(6 * h);
10291   const v = 1 - bl;
10292   f = 6 * h - i;
10293
10294   if ((i & 0x01) !== 0) {
10295     f = 1 - f;
10296   }
10297
10298   const n = wh + f * (v - wh); // Linear interpolation
10299
10300   let r;
10301   let g;
10302   let b;
10303   /* eslint-disable max-statements-per-line,no-multi-spaces */
10304
10305   switch (i) {
10306     default:
10307     case 6:
10308     case 0:
10309       r = v;
10310       g = n;
10311       b = wh;
10312       break;
10313
10314     case 1:
10315       r = n;
10316       g = v;
10317       b = wh;
10318       break;
10319
10320     case 2:
10321       r = wh;
10322       g = v;
10323       b = n;
10324       break;
10325
10326     case 3:
10327       r = wh;
10328       g = n;
10329       b = v;
10330       break;
10331
10332     case 4:
10333       r = n;
10334       g = wh;
10335       b = v;
10336       break;
10337
10338     case 5:
10339       r = v;
10340       g = wh;
10341       b = n;
10342       break;
10343   }
10344   /* eslint-enable max-statements-per-line,no-multi-spaces */
10345
10346
10347   return [r * 255, g * 255, b * 255];
10348 };
10349
10350 convert$1.cmyk.rgb = function (cmyk) {
10351   const c = cmyk[0] / 100;
10352   const m = cmyk[1] / 100;
10353   const y = cmyk[2] / 100;
10354   const k = cmyk[3] / 100;
10355   const r = 1 - Math.min(1, c * (1 - k) + k);
10356   const g = 1 - Math.min(1, m * (1 - k) + k);
10357   const b = 1 - Math.min(1, y * (1 - k) + k);
10358   return [r * 255, g * 255, b * 255];
10359 };
10360
10361 convert$1.xyz.rgb = function (xyz) {
10362   const x = xyz[0] / 100;
10363   const y = xyz[1] / 100;
10364   const z = xyz[2] / 100;
10365   let r;
10366   let g;
10367   let b;
10368   r = x * 3.2406 + y * -1.5372 + z * -0.4986;
10369   g = x * -0.9689 + y * 1.8758 + z * 0.0415;
10370   b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
10371
10372   r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
10373   g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
10374   b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
10375   r = Math.min(Math.max(0, r), 1);
10376   g = Math.min(Math.max(0, g), 1);
10377   b = Math.min(Math.max(0, b), 1);
10378   return [r * 255, g * 255, b * 255];
10379 };
10380
10381 convert$1.xyz.lab = function (xyz) {
10382   let x = xyz[0];
10383   let y = xyz[1];
10384   let z = xyz[2];
10385   x /= 95.047;
10386   y /= 100;
10387   z /= 108.883;
10388   x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
10389   y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
10390   z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
10391   const l = 116 * y - 16;
10392   const a = 500 * (x - y);
10393   const b = 200 * (y - z);
10394   return [l, a, b];
10395 };
10396
10397 convert$1.lab.xyz = function (lab) {
10398   const l = lab[0];
10399   const a = lab[1];
10400   const b = lab[2];
10401   let x;
10402   let y;
10403   let z;
10404   y = (l + 16) / 116;
10405   x = a / 500 + y;
10406   z = y - b / 200;
10407   const y2 = y ** 3;
10408   const x2 = x ** 3;
10409   const z2 = z ** 3;
10410   y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
10411   x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
10412   z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
10413   x *= 95.047;
10414   y *= 100;
10415   z *= 108.883;
10416   return [x, y, z];
10417 };
10418
10419 convert$1.lab.lch = function (lab) {
10420   const l = lab[0];
10421   const a = lab[1];
10422   const b = lab[2];
10423   let h;
10424   const hr = Math.atan2(b, a);
10425   h = hr * 360 / 2 / Math.PI;
10426
10427   if (h < 0) {
10428     h += 360;
10429   }
10430
10431   const c = Math.sqrt(a * a + b * b);
10432   return [l, c, h];
10433 };
10434
10435 convert$1.lch.lab = function (lch) {
10436   const l = lch[0];
10437   const c = lch[1];
10438   const h = lch[2];
10439   const hr = h / 360 * 2 * Math.PI;
10440   const a = c * Math.cos(hr);
10441   const b = c * Math.sin(hr);
10442   return [l, a, b];
10443 };
10444
10445 convert$1.rgb.ansi16 = function (args, saturation = null) {
10446   const [r, g, b] = args;
10447   let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
10448
10449   value = Math.round(value / 50);
10450
10451   if (value === 0) {
10452     return 30;
10453   }
10454
10455   let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
10456
10457   if (value === 2) {
10458     ansi += 60;
10459   }
10460
10461   return ansi;
10462 };
10463
10464 convert$1.hsv.ansi16 = function (args) {
10465   // Optimization here; we already know the value and don't need to get
10466   // it converted for us.
10467   return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
10468 };
10469
10470 convert$1.rgb.ansi256 = function (args) {
10471   const r = args[0];
10472   const g = args[1];
10473   const b = args[2]; // We use the extended greyscale palette here, with the exception of
10474   // black and white. normal palette only has 4 greyscale shades.
10475
10476   if (r === g && g === b) {
10477     if (r < 8) {
10478       return 16;
10479     }
10480
10481     if (r > 248) {
10482       return 231;
10483     }
10484
10485     return Math.round((r - 8) / 247 * 24) + 232;
10486   }
10487
10488   const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
10489   return ansi;
10490 };
10491
10492 convert$1.ansi16.rgb = function (args) {
10493   let color = args % 10; // Handle greyscale
10494
10495   if (color === 0 || color === 7) {
10496     if (args > 50) {
10497       color += 3.5;
10498     }
10499
10500     color = color / 10.5 * 255;
10501     return [color, color, color];
10502   }
10503
10504   const mult = (~~(args > 50) + 1) * 0.5;
10505   const r = (color & 1) * mult * 255;
10506   const g = (color >> 1 & 1) * mult * 255;
10507   const b = (color >> 2 & 1) * mult * 255;
10508   return [r, g, b];
10509 };
10510
10511 convert$1.ansi256.rgb = function (args) {
10512   // Handle greyscale
10513   if (args >= 232) {
10514     const c = (args - 232) * 10 + 8;
10515     return [c, c, c];
10516   }
10517
10518   args -= 16;
10519   let rem;
10520   const r = Math.floor(args / 36) / 5 * 255;
10521   const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
10522   const b = rem % 6 / 5 * 255;
10523   return [r, g, b];
10524 };
10525
10526 convert$1.rgb.hex = function (args) {
10527   const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
10528   const string = integer.toString(16).toUpperCase();
10529   return '000000'.substring(string.length) + string;
10530 };
10531
10532 convert$1.hex.rgb = function (args) {
10533   const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
10534
10535   if (!match) {
10536     return [0, 0, 0];
10537   }
10538
10539   let colorString = match[0];
10540
10541   if (match[0].length === 3) {
10542     colorString = colorString.split('').map(char => {
10543       return char + char;
10544     }).join('');
10545   }
10546
10547   const integer = parseInt(colorString, 16);
10548   const r = integer >> 16 & 0xFF;
10549   const g = integer >> 8 & 0xFF;
10550   const b = integer & 0xFF;
10551   return [r, g, b];
10552 };
10553
10554 convert$1.rgb.hcg = function (rgb) {
10555   const r = rgb[0] / 255;
10556   const g = rgb[1] / 255;
10557   const b = rgb[2] / 255;
10558   const max = Math.max(Math.max(r, g), b);
10559   const min = Math.min(Math.min(r, g), b);
10560   const chroma = max - min;
10561   let grayscale;
10562   let hue;
10563
10564   if (chroma < 1) {
10565     grayscale = min / (1 - chroma);
10566   } else {
10567     grayscale = 0;
10568   }
10569
10570   if (chroma <= 0) {
10571     hue = 0;
10572   } else if (max === r) {
10573     hue = (g - b) / chroma % 6;
10574   } else if (max === g) {
10575     hue = 2 + (b - r) / chroma;
10576   } else {
10577     hue = 4 + (r - g) / chroma;
10578   }
10579
10580   hue /= 6;
10581   hue %= 1;
10582   return [hue * 360, chroma * 100, grayscale * 100];
10583 };
10584
10585 convert$1.hsl.hcg = function (hsl) {
10586   const s = hsl[1] / 100;
10587   const l = hsl[2] / 100;
10588   const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
10589   let f = 0;
10590
10591   if (c < 1.0) {
10592     f = (l - 0.5 * c) / (1.0 - c);
10593   }
10594
10595   return [hsl[0], c * 100, f * 100];
10596 };
10597
10598 convert$1.hsv.hcg = function (hsv) {
10599   const s = hsv[1] / 100;
10600   const v = hsv[2] / 100;
10601   const c = s * v;
10602   let f = 0;
10603
10604   if (c < 1.0) {
10605     f = (v - c) / (1 - c);
10606   }
10607
10608   return [hsv[0], c * 100, f * 100];
10609 };
10610
10611 convert$1.hcg.rgb = function (hcg) {
10612   const h = hcg[0] / 360;
10613   const c = hcg[1] / 100;
10614   const g = hcg[2] / 100;
10615
10616   if (c === 0.0) {
10617     return [g * 255, g * 255, g * 255];
10618   }
10619
10620   const pure = [0, 0, 0];
10621   const hi = h % 1 * 6;
10622   const v = hi % 1;
10623   const w = 1 - v;
10624   let mg = 0;
10625   /* eslint-disable max-statements-per-line */
10626
10627   switch (Math.floor(hi)) {
10628     case 0:
10629       pure[0] = 1;
10630       pure[1] = v;
10631       pure[2] = 0;
10632       break;
10633
10634     case 1:
10635       pure[0] = w;
10636       pure[1] = 1;
10637       pure[2] = 0;
10638       break;
10639
10640     case 2:
10641       pure[0] = 0;
10642       pure[1] = 1;
10643       pure[2] = v;
10644       break;
10645
10646     case 3:
10647       pure[0] = 0;
10648       pure[1] = w;
10649       pure[2] = 1;
10650       break;
10651
10652     case 4:
10653       pure[0] = v;
10654       pure[1] = 0;
10655       pure[2] = 1;
10656       break;
10657
10658     default:
10659       pure[0] = 1;
10660       pure[1] = 0;
10661       pure[2] = w;
10662   }
10663   /* eslint-enable max-statements-per-line */
10664
10665
10666   mg = (1.0 - c) * g;
10667   return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
10668 };
10669
10670 convert$1.hcg.hsv = function (hcg) {
10671   const c = hcg[1] / 100;
10672   const g = hcg[2] / 100;
10673   const v = c + g * (1.0 - c);
10674   let f = 0;
10675
10676   if (v > 0.0) {
10677     f = c / v;
10678   }
10679
10680   return [hcg[0], f * 100, v * 100];
10681 };
10682
10683 convert$1.hcg.hsl = function (hcg) {
10684   const c = hcg[1] / 100;
10685   const g = hcg[2] / 100;
10686   const l = g * (1.0 - c) + 0.5 * c;
10687   let s = 0;
10688
10689   if (l > 0.0 && l < 0.5) {
10690     s = c / (2 * l);
10691   } else if (l >= 0.5 && l < 1.0) {
10692     s = c / (2 * (1 - l));
10693   }
10694
10695   return [hcg[0], s * 100, l * 100];
10696 };
10697
10698 convert$1.hcg.hwb = function (hcg) {
10699   const c = hcg[1] / 100;
10700   const g = hcg[2] / 100;
10701   const v = c + g * (1.0 - c);
10702   return [hcg[0], (v - c) * 100, (1 - v) * 100];
10703 };
10704
10705 convert$1.hwb.hcg = function (hwb) {
10706   const w = hwb[1] / 100;
10707   const b = hwb[2] / 100;
10708   const v = 1 - b;
10709   const c = v - w;
10710   let g = 0;
10711
10712   if (c < 1) {
10713     g = (v - c) / (1 - c);
10714   }
10715
10716   return [hwb[0], c * 100, g * 100];
10717 };
10718
10719 convert$1.apple.rgb = function (apple) {
10720   return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
10721 };
10722
10723 convert$1.rgb.apple = function (rgb) {
10724   return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
10725 };
10726
10727 convert$1.gray.rgb = function (args) {
10728   return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
10729 };
10730
10731 convert$1.gray.hsl = function (args) {
10732   return [0, 0, args[0]];
10733 };
10734
10735 convert$1.gray.hsv = convert$1.gray.hsl;
10736
10737 convert$1.gray.hwb = function (gray) {
10738   return [0, 100, gray[0]];
10739 };
10740
10741 convert$1.gray.cmyk = function (gray) {
10742   return [0, 0, 0, gray[0]];
10743 };
10744
10745 convert$1.gray.lab = function (gray) {
10746   return [gray[0], 0, 0];
10747 };
10748
10749 convert$1.gray.hex = function (gray) {
10750   const val = Math.round(gray[0] / 100 * 255) & 0xFF;
10751   const integer = (val << 16) + (val << 8) + val;
10752   const string = integer.toString(16).toUpperCase();
10753   return '000000'.substring(string.length) + string;
10754 };
10755
10756 convert$1.rgb.gray = function (rgb) {
10757   const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
10758   return [val / 255 * 100];
10759 };
10760
10761 const conversions$1 = conversions$2;
10762 /*
10763         This function routes a model to all other models.
10764
10765         all functions that are routed have a property `.conversion` attached
10766         to the returned synthetic function. This property is an array
10767         of strings, each with the steps in between the 'from' and 'to'
10768         color models (inclusive).
10769
10770         conversions that are not possible simply are not included.
10771 */
10772
10773 function buildGraph() {
10774   const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
10775
10776   const models = Object.keys(conversions$1);
10777
10778   for (let len = models.length, i = 0; i < len; i++) {
10779     graph[models[i]] = {
10780       // http://jsperf.com/1-vs-infinity
10781       // micro-opt, but this is simple.
10782       distance: -1,
10783       parent: null
10784     };
10785   }
10786
10787   return graph;
10788 } // https://en.wikipedia.org/wiki/Breadth-first_search
10789
10790
10791 function deriveBFS(fromModel) {
10792   const graph = buildGraph();
10793   const queue = [fromModel]; // Unshift -> queue -> pop
10794
10795   graph[fromModel].distance = 0;
10796
10797   while (queue.length) {
10798     const current = queue.pop();
10799     const adjacents = Object.keys(conversions$1[current]);
10800
10801     for (let len = adjacents.length, i = 0; i < len; i++) {
10802       const adjacent = adjacents[i];
10803       const node = graph[adjacent];
10804
10805       if (node.distance === -1) {
10806         node.distance = graph[current].distance + 1;
10807         node.parent = current;
10808         queue.unshift(adjacent);
10809       }
10810     }
10811   }
10812
10813   return graph;
10814 }
10815
10816 function link$1(from, to) {
10817   return function (args) {
10818     return to(from(args));
10819   };
10820 }
10821
10822 function wrapConversion(toModel, graph) {
10823   const path = [graph[toModel].parent, toModel];
10824   let fn = conversions$1[graph[toModel].parent][toModel];
10825   let cur = graph[toModel].parent;
10826
10827   while (graph[cur].parent) {
10828     path.unshift(graph[cur].parent);
10829     fn = link$1(conversions$1[graph[cur].parent][cur], fn);
10830     cur = graph[cur].parent;
10831   }
10832
10833   fn.conversion = path;
10834   return fn;
10835 }
10836
10837 var route$1 = function (fromModel) {
10838   const graph = deriveBFS(fromModel);
10839   const conversion = {};
10840   const models = Object.keys(graph);
10841
10842   for (let len = models.length, i = 0; i < len; i++) {
10843     const toModel = models[i];
10844     const node = graph[toModel];
10845
10846     if (node.parent === null) {
10847       // No possible conversion, or this node is the source model.
10848       continue;
10849     }
10850
10851     conversion[toModel] = wrapConversion(toModel, graph);
10852   }
10853
10854   return conversion;
10855 };
10856
10857 const conversions = conversions$2;
10858 const route = route$1;
10859 const convert = {};
10860 const models = Object.keys(conversions);
10861
10862 function wrapRaw(fn) {
10863   const wrappedFn = function (...args) {
10864     const arg0 = args[0];
10865
10866     if (arg0 === undefined || arg0 === null) {
10867       return arg0;
10868     }
10869
10870     if (arg0.length > 1) {
10871       args = arg0;
10872     }
10873
10874     return fn(args);
10875   }; // Preserve .conversion property if there is one
10876
10877
10878   if ('conversion' in fn) {
10879     wrappedFn.conversion = fn.conversion;
10880   }
10881
10882   return wrappedFn;
10883 }
10884
10885 function wrapRounded(fn) {
10886   const wrappedFn = function (...args) {
10887     const arg0 = args[0];
10888
10889     if (arg0 === undefined || arg0 === null) {
10890       return arg0;
10891     }
10892
10893     if (arg0.length > 1) {
10894       args = arg0;
10895     }
10896
10897     const result = fn(args); // We're assuming the result is an array here.
10898     // see notice in conversions.js; don't use box types
10899     // in conversion functions.
10900
10901     if (typeof result === 'object') {
10902       for (let len = result.length, i = 0; i < len; i++) {
10903         result[i] = Math.round(result[i]);
10904       }
10905     }
10906
10907     return result;
10908   }; // Preserve .conversion property if there is one
10909
10910
10911   if ('conversion' in fn) {
10912     wrappedFn.conversion = fn.conversion;
10913   }
10914
10915   return wrappedFn;
10916 }
10917
10918 models.forEach(fromModel => {
10919   convert[fromModel] = {};
10920   Object.defineProperty(convert[fromModel], 'channels', {
10921     value: conversions[fromModel].channels
10922   });
10923   Object.defineProperty(convert[fromModel], 'labels', {
10924     value: conversions[fromModel].labels
10925   });
10926   const routes = route(fromModel);
10927   const routeModels = Object.keys(routes);
10928   routeModels.forEach(toModel => {
10929     const fn = routes[toModel];
10930     convert[fromModel][toModel] = wrapRounded(fn);
10931     convert[fromModel][toModel].raw = wrapRaw(fn);
10932   });
10933 });
10934 var colorConvert = convert;
10935
10936 (function (module) {
10937
10938   const wrapAnsi16 = (fn, offset) => (...args) => {
10939     const code = fn(...args);
10940     return `\u001B[${code + offset}m`;
10941   };
10942
10943   const wrapAnsi256 = (fn, offset) => (...args) => {
10944     const code = fn(...args);
10945     return `\u001B[${38 + offset};5;${code}m`;
10946   };
10947
10948   const wrapAnsi16m = (fn, offset) => (...args) => {
10949     const rgb = fn(...args);
10950     return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
10951   };
10952
10953   const ansi2ansi = n => n;
10954
10955   const rgb2rgb = (r, g, b) => [r, g, b];
10956
10957   const setLazyProperty = (object, property, get) => {
10958     Object.defineProperty(object, property, {
10959       get: () => {
10960         const value = get();
10961         Object.defineProperty(object, property, {
10962           value,
10963           enumerable: true,
10964           configurable: true
10965         });
10966         return value;
10967       },
10968       enumerable: true,
10969       configurable: true
10970     });
10971   };
10972   /** @type {typeof import('color-convert')} */
10973
10974
10975   let colorConvert$1;
10976
10977   const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
10978     if (colorConvert$1 === undefined) {
10979       colorConvert$1 = colorConvert;
10980     }
10981
10982     const offset = isBackground ? 10 : 0;
10983     const styles = {};
10984
10985     for (const [sourceSpace, suite] of Object.entries(colorConvert$1)) {
10986       const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
10987
10988       if (sourceSpace === targetSpace) {
10989         styles[name] = wrap(identity, offset);
10990       } else if (typeof suite === 'object') {
10991         styles[name] = wrap(suite[targetSpace], offset);
10992       }
10993     }
10994
10995     return styles;
10996   };
10997
10998   function assembleStyles() {
10999     const codes = new Map();
11000     const styles = {
11001       modifier: {
11002         reset: [0, 0],
11003         // 21 isn't widely supported and 22 does the same thing
11004         bold: [1, 22],
11005         dim: [2, 22],
11006         italic: [3, 23],
11007         underline: [4, 24],
11008         inverse: [7, 27],
11009         hidden: [8, 28],
11010         strikethrough: [9, 29]
11011       },
11012       color: {
11013         black: [30, 39],
11014         red: [31, 39],
11015         green: [32, 39],
11016         yellow: [33, 39],
11017         blue: [34, 39],
11018         magenta: [35, 39],
11019         cyan: [36, 39],
11020         white: [37, 39],
11021         // Bright color
11022         blackBright: [90, 39],
11023         redBright: [91, 39],
11024         greenBright: [92, 39],
11025         yellowBright: [93, 39],
11026         blueBright: [94, 39],
11027         magentaBright: [95, 39],
11028         cyanBright: [96, 39],
11029         whiteBright: [97, 39]
11030       },
11031       bgColor: {
11032         bgBlack: [40, 49],
11033         bgRed: [41, 49],
11034         bgGreen: [42, 49],
11035         bgYellow: [43, 49],
11036         bgBlue: [44, 49],
11037         bgMagenta: [45, 49],
11038         bgCyan: [46, 49],
11039         bgWhite: [47, 49],
11040         // Bright color
11041         bgBlackBright: [100, 49],
11042         bgRedBright: [101, 49],
11043         bgGreenBright: [102, 49],
11044         bgYellowBright: [103, 49],
11045         bgBlueBright: [104, 49],
11046         bgMagentaBright: [105, 49],
11047         bgCyanBright: [106, 49],
11048         bgWhiteBright: [107, 49]
11049       }
11050     }; // Alias bright black as gray (and grey)
11051
11052     styles.color.gray = styles.color.blackBright;
11053     styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
11054     styles.color.grey = styles.color.blackBright;
11055     styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
11056
11057     for (const [groupName, group] of Object.entries(styles)) {
11058       for (const [styleName, style] of Object.entries(group)) {
11059         styles[styleName] = {
11060           open: `\u001B[${style[0]}m`,
11061           close: `\u001B[${style[1]}m`
11062         };
11063         group[styleName] = styles[styleName];
11064         codes.set(style[0], style[1]);
11065       }
11066
11067       Object.defineProperty(styles, groupName, {
11068         value: group,
11069         enumerable: false
11070       });
11071     }
11072
11073     Object.defineProperty(styles, 'codes', {
11074       value: codes,
11075       enumerable: false
11076     });
11077     styles.color.close = '\u001B[39m';
11078     styles.bgColor.close = '\u001B[49m';
11079     setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
11080     setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
11081     setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
11082     setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
11083     setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
11084     setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
11085     return styles;
11086   } // Make the export immutable
11087
11088
11089   Object.defineProperty(module, 'exports', {
11090     enumerable: true,
11091     get: assembleStyles
11092   });
11093 })(ansiStyles$1);
11094
11095 var hasFlag$3 = (flag, argv = process.argv) => {
11096   const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
11097   const position = argv.indexOf(prefix + flag);
11098   const terminatorPosition = argv.indexOf('--');
11099   return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
11100 };
11101
11102 const os$3 = require$$0__default$1["default"];
11103 const tty$2 = require$$1__default["default"];
11104 const hasFlag$2 = hasFlag$3;
11105 const {
11106   env: env$1
11107 } = process;
11108 let forceColor$1;
11109
11110 if (hasFlag$2('no-color') || hasFlag$2('no-colors') || hasFlag$2('color=false') || hasFlag$2('color=never')) {
11111   forceColor$1 = 0;
11112 } else if (hasFlag$2('color') || hasFlag$2('colors') || hasFlag$2('color=true') || hasFlag$2('color=always')) {
11113   forceColor$1 = 1;
11114 }
11115
11116 if ('FORCE_COLOR' in env$1) {
11117   if (env$1.FORCE_COLOR === 'true') {
11118     forceColor$1 = 1;
11119   } else if (env$1.FORCE_COLOR === 'false') {
11120     forceColor$1 = 0;
11121   } else {
11122     forceColor$1 = env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env$1.FORCE_COLOR, 10), 3);
11123   }
11124 }
11125
11126 function translateLevel$1(level) {
11127   if (level === 0) {
11128     return false;
11129   }
11130
11131   return {
11132     level,
11133     hasBasic: true,
11134     has256: level >= 2,
11135     has16m: level >= 3
11136   };
11137 }
11138
11139 function supportsColor$1(haveStream, streamIsTTY) {
11140   if (forceColor$1 === 0) {
11141     return 0;
11142   }
11143
11144   if (hasFlag$2('color=16m') || hasFlag$2('color=full') || hasFlag$2('color=truecolor')) {
11145     return 3;
11146   }
11147
11148   if (hasFlag$2('color=256')) {
11149     return 2;
11150   }
11151
11152   if (haveStream && !streamIsTTY && forceColor$1 === undefined) {
11153     return 0;
11154   }
11155
11156   const min = forceColor$1 || 0;
11157
11158   if (env$1.TERM === 'dumb') {
11159     return min;
11160   }
11161
11162   if (process.platform === 'win32') {
11163     // Windows 10 build 10586 is the first Windows release that supports 256 colors.
11164     // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
11165     const osRelease = os$3.release().split('.');
11166
11167     if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
11168       return Number(osRelease[2]) >= 14931 ? 3 : 2;
11169     }
11170
11171     return 1;
11172   }
11173
11174   if ('CI' in env$1) {
11175     if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
11176       return 1;
11177     }
11178
11179     return min;
11180   }
11181
11182   if ('TEAMCITY_VERSION' in env$1) {
11183     return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
11184   }
11185
11186   if (env$1.COLORTERM === 'truecolor') {
11187     return 3;
11188   }
11189
11190   if ('TERM_PROGRAM' in env$1) {
11191     const version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
11192
11193     switch (env$1.TERM_PROGRAM) {
11194       case 'iTerm.app':
11195         return version >= 3 ? 3 : 2;
11196
11197       case 'Apple_Terminal':
11198         return 2;
11199       // No default
11200     }
11201   }
11202
11203   if (/-256(color)?$/i.test(env$1.TERM)) {
11204     return 2;
11205   }
11206
11207   if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
11208     return 1;
11209   }
11210
11211   if ('COLORTERM' in env$1) {
11212     return 1;
11213   }
11214
11215   return min;
11216 }
11217
11218 function getSupportLevel$1(stream) {
11219   const level = supportsColor$1(stream, stream && stream.isTTY);
11220   return translateLevel$1(level);
11221 }
11222
11223 var supportsColor_1$1 = {
11224   supportsColor: getSupportLevel$1,
11225   stdout: translateLevel$1(supportsColor$1(true, tty$2.isatty(1))),
11226   stderr: translateLevel$1(supportsColor$1(true, tty$2.isatty(2)))
11227 };
11228
11229 const stringReplaceAll$1 = (string, substring, replacer) => {
11230   let index = string.indexOf(substring);
11231
11232   if (index === -1) {
11233     return string;
11234   }
11235
11236   const substringLength = substring.length;
11237   let endIndex = 0;
11238   let returnValue = '';
11239
11240   do {
11241     returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
11242     endIndex = index + substringLength;
11243     index = string.indexOf(substring, endIndex);
11244   } while (index !== -1);
11245
11246   returnValue += string.substr(endIndex);
11247   return returnValue;
11248 };
11249
11250 const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
11251   let endIndex = 0;
11252   let returnValue = '';
11253
11254   do {
11255     const gotCR = string[index - 1] === '\r';
11256     returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
11257     endIndex = index + 1;
11258     index = string.indexOf('\n', endIndex);
11259   } while (index !== -1);
11260
11261   returnValue += string.substr(endIndex);
11262   return returnValue;
11263 };
11264
11265 var util$7 = {
11266   stringReplaceAll: stringReplaceAll$1,
11267   stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
11268 };
11269
11270 const TEMPLATE_REGEX$1 = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
11271 const STYLE_REGEX$1 = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
11272 const STRING_REGEX$2 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
11273 const ESCAPE_REGEX$1 = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
11274 const ESCAPES$1 = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
11275
11276 function unescape$1(c) {
11277   const u = c[0] === 'u';
11278   const bracket = c[1] === '{';
11279
11280   if (u && !bracket && c.length === 5 || c[0] === 'x' && c.length === 3) {
11281     return String.fromCharCode(parseInt(c.slice(1), 16));
11282   }
11283
11284   if (u && bracket) {
11285     return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
11286   }
11287
11288   return ESCAPES$1.get(c) || c;
11289 }
11290
11291 function parseArguments$1(name, arguments_) {
11292   const results = [];
11293   const chunks = arguments_.trim().split(/\s*,\s*/g);
11294   let matches;
11295
11296   for (const chunk of chunks) {
11297     const number = Number(chunk);
11298
11299     if (!Number.isNaN(number)) {
11300       results.push(number);
11301     } else if (matches = chunk.match(STRING_REGEX$2)) {
11302       results.push(matches[2].replace(ESCAPE_REGEX$1, (m, escape, character) => escape ? unescape$1(escape) : character));
11303     } else {
11304       throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
11305     }
11306   }
11307
11308   return results;
11309 }
11310
11311 function parseStyle$1(style) {
11312   STYLE_REGEX$1.lastIndex = 0;
11313   const results = [];
11314   let matches;
11315
11316   while ((matches = STYLE_REGEX$1.exec(style)) !== null) {
11317     const name = matches[1];
11318
11319     if (matches[2]) {
11320       const args = parseArguments$1(name, matches[2]);
11321       results.push([name].concat(args));
11322     } else {
11323       results.push([name]);
11324     }
11325   }
11326
11327   return results;
11328 }
11329
11330 function buildStyle$1(chalk, styles) {
11331   const enabled = {};
11332
11333   for (const layer of styles) {
11334     for (const style of layer.styles) {
11335       enabled[style[0]] = layer.inverse ? null : style.slice(1);
11336     }
11337   }
11338
11339   let current = chalk;
11340
11341   for (const [styleName, styles] of Object.entries(enabled)) {
11342     if (!Array.isArray(styles)) {
11343       continue;
11344     }
11345
11346     if (!(styleName in current)) {
11347       throw new Error(`Unknown Chalk style: ${styleName}`);
11348     }
11349
11350     current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
11351   }
11352
11353   return current;
11354 }
11355
11356 var templates$1 = (chalk, temporary) => {
11357   const styles = [];
11358   const chunks = [];
11359   let chunk = []; // eslint-disable-next-line max-params
11360
11361   temporary.replace(TEMPLATE_REGEX$1, (m, escapeCharacter, inverse, style, close, character) => {
11362     if (escapeCharacter) {
11363       chunk.push(unescape$1(escapeCharacter));
11364     } else if (style) {
11365       const string = chunk.join('');
11366       chunk = [];
11367       chunks.push(styles.length === 0 ? string : buildStyle$1(chalk, styles)(string));
11368       styles.push({
11369         inverse,
11370         styles: parseStyle$1(style)
11371       });
11372     } else if (close) {
11373       if (styles.length === 0) {
11374         throw new Error('Found extraneous } in Chalk template literal');
11375       }
11376
11377       chunks.push(buildStyle$1(chalk, styles)(chunk.join('')));
11378       chunk = [];
11379       styles.pop();
11380     } else {
11381       chunk.push(character);
11382     }
11383   });
11384   chunks.push(chunk.join(''));
11385
11386   if (styles.length > 0) {
11387     const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
11388     throw new Error(errMessage);
11389   }
11390
11391   return chunks.join('');
11392 };
11393
11394 const ansiStyles = ansiStyles$1.exports;
11395 const {
11396   stdout: stdoutColor,
11397   stderr: stderrColor
11398 } = supportsColor_1$1;
11399 const {
11400   stringReplaceAll,
11401   stringEncaseCRLFWithFirstIndex
11402 } = util$7;
11403 const {
11404   isArray: isArray$b
11405 } = Array; // `supportsColor.level` → `ansiStyles.color[name]` mapping
11406
11407 const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
11408 const styles = Object.create(null);
11409
11410 const applyOptions = (object, options = {}) => {
11411   if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
11412     throw new Error('The `level` option should be an integer from 0 to 3');
11413   } // Detect level if not set manually
11414
11415
11416   const colorLevel = stdoutColor ? stdoutColor.level : 0;
11417   object.level = options.level === undefined ? colorLevel : options.level;
11418 };
11419
11420 class ChalkClass {
11421   constructor(options) {
11422     // eslint-disable-next-line no-constructor-return
11423     return chalkFactory(options);
11424   }
11425
11426 }
11427
11428 const chalkFactory = options => {
11429   const chalk = {};
11430   applyOptions(chalk, options);
11431
11432   chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
11433
11434   Object.setPrototypeOf(chalk, Chalk.prototype);
11435   Object.setPrototypeOf(chalk.template, chalk);
11436
11437   chalk.template.constructor = () => {
11438     throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
11439   };
11440
11441   chalk.template.Instance = ChalkClass;
11442   return chalk.template;
11443 };
11444
11445 function Chalk(options) {
11446   return chalkFactory(options);
11447 }
11448
11449 for (const [styleName, style] of Object.entries(ansiStyles)) {
11450   styles[styleName] = {
11451     get() {
11452       const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
11453       Object.defineProperty(this, styleName, {
11454         value: builder
11455       });
11456       return builder;
11457     }
11458
11459   };
11460 }
11461
11462 styles.visible = {
11463   get() {
11464     const builder = createBuilder(this, this._styler, true);
11465     Object.defineProperty(this, 'visible', {
11466       value: builder
11467     });
11468     return builder;
11469   }
11470
11471 };
11472 const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
11473
11474 for (const model of usedModels) {
11475   styles[model] = {
11476     get() {
11477       const {
11478         level
11479       } = this;
11480       return function (...arguments_) {
11481         const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
11482         return createBuilder(this, styler, this._isEmpty);
11483       };
11484     }
11485
11486   };
11487 }
11488
11489 for (const model of usedModels) {
11490   const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
11491   styles[bgModel] = {
11492     get() {
11493       const {
11494         level
11495       } = this;
11496       return function (...arguments_) {
11497         const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
11498         return createBuilder(this, styler, this._isEmpty);
11499       };
11500     }
11501
11502   };
11503 }
11504
11505 const proto = Object.defineProperties(() => {}, Object.assign(Object.assign({}, styles), {}, {
11506   level: {
11507     enumerable: true,
11508
11509     get() {
11510       return this._generator.level;
11511     },
11512
11513     set(level) {
11514       this._generator.level = level;
11515     }
11516
11517   }
11518 }));
11519
11520 const createStyler = (open, close, parent) => {
11521   let openAll;
11522   let closeAll;
11523
11524   if (parent === undefined) {
11525     openAll = open;
11526     closeAll = close;
11527   } else {
11528     openAll = parent.openAll + open;
11529     closeAll = close + parent.closeAll;
11530   }
11531
11532   return {
11533     open,
11534     close,
11535     openAll,
11536     closeAll,
11537     parent
11538   };
11539 };
11540
11541 const createBuilder = (self, _styler, _isEmpty) => {
11542   const builder = (...arguments_) => {
11543     if (isArray$b(arguments_[0]) && isArray$b(arguments_[0].raw)) {
11544       // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
11545       return applyStyle(builder, chalkTag(builder, ...arguments_));
11546     } // Single argument is hot path, implicit coercion is faster than anything
11547     // eslint-disable-next-line no-implicit-coercion
11548
11549
11550     return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
11551   }; // We alter the prototype because we must return a function, but there is
11552   // no way to create a function with a different prototype
11553
11554
11555   Object.setPrototypeOf(builder, proto);
11556   builder._generator = self;
11557   builder._styler = _styler;
11558   builder._isEmpty = _isEmpty;
11559   return builder;
11560 };
11561
11562 const applyStyle = (self, string) => {
11563   if (self.level <= 0 || !string) {
11564     return self._isEmpty ? '' : string;
11565   }
11566
11567   let styler = self._styler;
11568
11569   if (styler === undefined) {
11570     return string;
11571   }
11572
11573   const {
11574     openAll,
11575     closeAll
11576   } = styler;
11577
11578   if (string.indexOf('\u001B') !== -1) {
11579     while (styler !== undefined) {
11580       // Replace any instances already present with a re-opening code
11581       // otherwise only the part of the string until said closing code
11582       // will be colored, and the rest will simply be 'plain'.
11583       string = stringReplaceAll(string, styler.close, styler.open);
11584       styler = styler.parent;
11585     }
11586   } // We can move both next actions out of loop, because remaining actions in loop won't have
11587   // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
11588   // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
11589
11590
11591   const lfIndex = string.indexOf('\n');
11592
11593   if (lfIndex !== -1) {
11594     string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
11595   }
11596
11597   return openAll + string + closeAll;
11598 };
11599
11600 let template;
11601
11602 const chalkTag = (chalk, ...strings) => {
11603   const [firstString] = strings;
11604
11605   if (!isArray$b(firstString) || !isArray$b(firstString.raw)) {
11606     // If chalk() was called by itself or with a string,
11607     // return the string itself as a string.
11608     return strings.join(' ');
11609   }
11610
11611   const arguments_ = strings.slice(1);
11612   const parts = [firstString.raw[0]];
11613
11614   for (let i = 1; i < firstString.length; i++) {
11615     parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i]));
11616   }
11617
11618   if (template === undefined) {
11619     template = templates$1;
11620   }
11621
11622   return template(chalk, parts.join(''));
11623 };
11624
11625 Object.defineProperties(Chalk.prototype, styles);
11626 const chalk$2 = Chalk(); // eslint-disable-line new-cap
11627
11628 chalk$2.supportsColor = stdoutColor;
11629 chalk$2.stderr = Chalk({
11630   level: stderrColor ? stderrColor.level : 0
11631 }); // eslint-disable-line new-cap
11632
11633 chalk$2.stderr.supportsColor = stderrColor;
11634 var source$2 = chalk$2;
11635
11636 const _excluded$2 = ["_"];
11637
11638 const vnopts = lib$4;
11639 const leven = leven$2.exports;
11640 const chalk$1 = source$2;
11641 const getLast$n = getLast_1;
11642 const cliDescriptor = {
11643   key: key => key.length === 1 ? `-${key}` : `--${key}`,
11644   value: value => vnopts.apiDescriptor.value(value),
11645   pair: ({
11646     key,
11647     value
11648   }) => value === false ? `--no-${key}` : value === true ? cliDescriptor.key(key) : value === "" ? `${cliDescriptor.key(key)} without an argument` : `${cliDescriptor.key(key)}=${value}`
11649 };
11650
11651 class FlagSchema extends vnopts.ChoiceSchema {
11652   constructor({
11653     name,
11654     flags
11655   }) {
11656     super({
11657       name,
11658       choices: flags
11659     });
11660     this._flags = [...flags].sort();
11661   }
11662
11663   preprocess(value, utils) {
11664     if (typeof value === "string" && value.length > 0 && !this._flags.includes(value)) {
11665       const suggestion = this._flags.find(flag => leven(flag, value) < 3);
11666
11667       if (suggestion) {
11668         utils.logger.warn([`Unknown flag ${chalk$1.yellow(utils.descriptor.value(value))},`, `did you mean ${chalk$1.blue(utils.descriptor.value(suggestion))}?`].join(" "));
11669         return suggestion;
11670       }
11671     }
11672
11673     return value;
11674   }
11675
11676   expected() {
11677     return "a flag";
11678   }
11679
11680 }
11681
11682 let hasDeprecationWarned;
11683
11684 function normalizeOptions$5(options, optionInfos, {
11685   logger,
11686   isCLI = false,
11687   passThrough = false
11688 } = {}) {
11689   const unknown = !passThrough ? (key, value, options) => {
11690     // Don't suggest `_` for unknown flags
11691     const _options$schemas = options.schemas,
11692           schemas = _objectWithoutProperties(_options$schemas, _excluded$2);
11693
11694     return vnopts.levenUnknownHandler(key, value, Object.assign(Object.assign({}, options), {}, {
11695       schemas
11696     }));
11697   } : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? undefined : {
11698     [key]: value
11699   } : (key, value) => ({
11700     [key]: value
11701   });
11702   const descriptor = isCLI ? cliDescriptor : vnopts.apiDescriptor;
11703   const schemas = optionInfosToSchemas(optionInfos, {
11704     isCLI
11705   });
11706   const normalizer = new vnopts.Normalizer(schemas, {
11707     logger,
11708     unknown,
11709     descriptor
11710   });
11711   const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
11712
11713   if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
11714     normalizer._hasDeprecationWarned = hasDeprecationWarned;
11715   }
11716
11717   const normalized = normalizer.normalize(options);
11718
11719   if (shouldSuppressDuplicateDeprecationWarnings) {
11720     hasDeprecationWarned = normalizer._hasDeprecationWarned;
11721   }
11722
11723   return normalized;
11724 }
11725
11726 function optionInfosToSchemas(optionInfos, {
11727   isCLI
11728 }) {
11729   const schemas = [];
11730
11731   if (isCLI) {
11732     schemas.push(vnopts.AnySchema.create({
11733       name: "_"
11734     }));
11735   }
11736
11737   for (const optionInfo of optionInfos) {
11738     schemas.push(optionInfoToSchema(optionInfo, {
11739       isCLI,
11740       optionInfos
11741     }));
11742
11743     if (optionInfo.alias && isCLI) {
11744       schemas.push(vnopts.AliasSchema.create({
11745         name: optionInfo.alias,
11746         sourceName: optionInfo.name
11747       }));
11748     }
11749   }
11750
11751   return schemas;
11752 }
11753
11754 function optionInfoToSchema(optionInfo, {
11755   isCLI,
11756   optionInfos
11757 }) {
11758   let SchemaConstructor;
11759   const parameters = {
11760     name: optionInfo.name
11761   };
11762   const handlers = {};
11763
11764   switch (optionInfo.type) {
11765     case "int":
11766       SchemaConstructor = vnopts.IntegerSchema;
11767
11768       if (isCLI) {
11769         parameters.preprocess = value => Number(value);
11770       }
11771
11772       break;
11773
11774     case "string":
11775       SchemaConstructor = vnopts.StringSchema;
11776       break;
11777
11778     case "choice":
11779       SchemaConstructor = vnopts.ChoiceSchema;
11780       parameters.choices = optionInfo.choices.map(choiceInfo => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign(Object.assign({}, choiceInfo), {}, {
11781         redirect: {
11782           to: {
11783             key: optionInfo.name,
11784             value: choiceInfo.redirect
11785           }
11786         }
11787       }) : choiceInfo);
11788       break;
11789
11790     case "boolean":
11791       SchemaConstructor = vnopts.BooleanSchema;
11792       break;
11793
11794     case "flag":
11795       SchemaConstructor = FlagSchema;
11796       parameters.flags = optionInfos.flatMap(optionInfo => [optionInfo.alias, optionInfo.description && optionInfo.name, optionInfo.oppositeDescription && `no-${optionInfo.name}`].filter(Boolean));
11797       break;
11798
11799     case "path":
11800       SchemaConstructor = vnopts.StringSchema;
11801       break;
11802
11803     default:
11804       /* istanbul ignore next */
11805       throw new Error(`Unexpected type ${optionInfo.type}`);
11806   }
11807
11808   if (optionInfo.exception) {
11809     parameters.validate = (value, schema, utils) => optionInfo.exception(value) || schema.validate(value, utils);
11810   } else {
11811     parameters.validate = (value, schema, utils) => value === undefined || schema.validate(value, utils);
11812   }
11813   /* istanbul ignore next */
11814
11815
11816   if (optionInfo.redirect) {
11817     handlers.redirect = value => !value ? undefined : {
11818       to: {
11819         key: optionInfo.redirect.option,
11820         value: optionInfo.redirect.value
11821       }
11822     };
11823   }
11824   /* istanbul ignore next */
11825
11826
11827   if (optionInfo.deprecated) {
11828     handlers.deprecated = true;
11829   } // allow CLI overriding, e.g., prettier package.json --tab-width 1 --tab-width 2
11830
11831
11832   if (isCLI && !optionInfo.array) {
11833     const originalPreprocess = parameters.preprocess || (x => x);
11834
11835     parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? getLast$n(value) : value), utils);
11836   }
11837
11838   return optionInfo.array ? vnopts.ArraySchema.create(Object.assign(Object.assign(Object.assign({}, isCLI ? {
11839     preprocess: v => Array.isArray(v) ? v : [v]
11840   } : {}), handlers), {}, {
11841     valueSchema: SchemaConstructor.create(parameters)
11842   })) : SchemaConstructor.create(Object.assign(Object.assign({}, parameters), handlers));
11843 }
11844
11845 function normalizeApiOptions(options, optionInfos, opts) {
11846   return normalizeOptions$5(options, optionInfos, opts);
11847 }
11848
11849 function normalizeCliOptions(options, optionInfos, opts) {
11850   return normalizeOptions$5(options, optionInfos, Object.assign({
11851     isCLI: true
11852   }, opts));
11853 }
11854
11855 var optionsNormalizer = {
11856   normalizeApiOptions,
11857   normalizeCliOptions
11858 };
11859
11860 const {
11861   isNonEmptyArray: isNonEmptyArray$i
11862 } = util$8;
11863 /**
11864  * @typedef {import("./types/estree").Node} Node
11865  */
11866
11867 function locStart$s(node, opts) {
11868   const {
11869     ignoreDecorators
11870   } = opts || {}; // Handle nodes with decorators. They should start at the first decorator
11871
11872   if (!ignoreDecorators) {
11873     const decorators = node.declaration && node.declaration.decorators || node.decorators;
11874
11875     if (isNonEmptyArray$i(decorators)) {
11876       return locStart$s(decorators[0]);
11877     }
11878   }
11879
11880   return node.range ? node.range[0] : node.start;
11881 }
11882
11883 function locEnd$r(node) {
11884   return node.range ? node.range[1] : node.end;
11885 }
11886 /**
11887  * @param {Node} nodeA
11888  * @param {Node} nodeB
11889  * @returns {boolean}
11890  */
11891
11892
11893 function hasSameLocStart$1(nodeA, nodeB) {
11894   return locStart$s(nodeA) === locStart$s(nodeB);
11895 }
11896 /**
11897  * @param {Node} nodeA
11898  * @param {Node} nodeB
11899  * @returns {boolean}
11900  */
11901
11902
11903 function hasSameLocEnd(nodeA, nodeB) {
11904   return locEnd$r(nodeA) === locEnd$r(nodeB);
11905 }
11906 /**
11907  * @param {Node} nodeA
11908  * @param {Node} nodeB
11909  * @returns {boolean}
11910  */
11911
11912
11913 function hasSameLoc$1(nodeA, nodeB) {
11914   return hasSameLocStart$1(nodeA, nodeB) && hasSameLocEnd(nodeA, nodeB);
11915 }
11916
11917 var loc$6 = {
11918   locStart: locStart$s,
11919   locEnd: locEnd$r,
11920   hasSameLocStart: hasSameLocStart$1,
11921   hasSameLoc: hasSameLoc$1
11922 };
11923
11924 var lib$3 = {};
11925
11926 var lib$2 = {};
11927
11928 var jsTokens = {};
11929
11930 // License: MIT. (See LICENSE.)
11931
11932 Object.defineProperty(jsTokens, "__esModule", {
11933   value: true
11934 }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
11935 // (run `npm run build`).
11936
11937 jsTokens.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
11938
11939 jsTokens.matchToToken = function (match) {
11940   var token = {
11941     type: "invalid",
11942     value: match[0],
11943     closed: undefined
11944   };
11945   if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
11946   return token;
11947 };
11948
11949 var lib$1 = {};
11950
11951 var identifier = {};
11952
11953 Object.defineProperty(identifier, "__esModule", {
11954   value: true
11955 });
11956 identifier.isIdentifierStart = isIdentifierStart;
11957 identifier.isIdentifierChar = isIdentifierChar;
11958 identifier.isIdentifierName = isIdentifierName$1;
11959 let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
11960 let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0898-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
11961 const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
11962 const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
11963 nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
11964 const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
11965 const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
11966
11967 function isInAstralSet(code, set) {
11968   let pos = 0x10000;
11969
11970   for (let i = 0, length = set.length; i < length; i += 2) {
11971     pos += set[i];
11972     if (pos > code) return false;
11973     pos += set[i + 1];
11974     if (pos >= code) return true;
11975   }
11976
11977   return false;
11978 }
11979
11980 function isIdentifierStart(code) {
11981   if (code < 65) return code === 36;
11982   if (code <= 90) return true;
11983   if (code < 97) return code === 95;
11984   if (code <= 122) return true;
11985
11986   if (code <= 0xffff) {
11987     return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
11988   }
11989
11990   return isInAstralSet(code, astralIdentifierStartCodes);
11991 }
11992
11993 function isIdentifierChar(code) {
11994   if (code < 48) return code === 36;
11995   if (code < 58) return true;
11996   if (code < 65) return false;
11997   if (code <= 90) return true;
11998   if (code < 97) return code === 95;
11999   if (code <= 122) return true;
12000
12001   if (code <= 0xffff) {
12002     return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
12003   }
12004
12005   return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
12006 }
12007
12008 function isIdentifierName$1(name) {
12009   let isFirst = true;
12010
12011   for (let i = 0; i < name.length; i++) {
12012     let cp = name.charCodeAt(i);
12013
12014     if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
12015       const trail = name.charCodeAt(++i);
12016
12017       if ((trail & 0xfc00) === 0xdc00) {
12018         cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
12019       }
12020     }
12021
12022     if (isFirst) {
12023       isFirst = false;
12024
12025       if (!isIdentifierStart(cp)) {
12026         return false;
12027       }
12028     } else if (!isIdentifierChar(cp)) {
12029       return false;
12030     }
12031   }
12032
12033   return !isFirst;
12034 }
12035
12036 var keyword$1 = {};
12037
12038 Object.defineProperty(keyword$1, "__esModule", {
12039   value: true
12040 });
12041 keyword$1.isReservedWord = isReservedWord;
12042 keyword$1.isStrictReservedWord = isStrictReservedWord;
12043 keyword$1.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
12044 keyword$1.isStrictBindReservedWord = isStrictBindReservedWord;
12045 keyword$1.isKeyword = isKeyword;
12046 const reservedWords = {
12047   keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
12048   strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
12049   strictBind: ["eval", "arguments"]
12050 };
12051 const keywords$1 = new Set(reservedWords.keyword);
12052 const reservedWordsStrictSet = new Set(reservedWords.strict);
12053 const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
12054
12055 function isReservedWord(word, inModule) {
12056   return inModule && word === "await" || word === "enum";
12057 }
12058
12059 function isStrictReservedWord(word, inModule) {
12060   return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
12061 }
12062
12063 function isStrictBindOnlyReservedWord(word) {
12064   return reservedWordsStrictBindSet.has(word);
12065 }
12066
12067 function isStrictBindReservedWord(word, inModule) {
12068   return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
12069 }
12070
12071 function isKeyword(word) {
12072   return keywords$1.has(word);
12073 }
12074
12075 (function (exports) {
12076
12077   Object.defineProperty(exports, "__esModule", {
12078     value: true
12079   });
12080   Object.defineProperty(exports, "isIdentifierName", {
12081     enumerable: true,
12082     get: function () {
12083       return _identifier.isIdentifierName;
12084     }
12085   });
12086   Object.defineProperty(exports, "isIdentifierChar", {
12087     enumerable: true,
12088     get: function () {
12089       return _identifier.isIdentifierChar;
12090     }
12091   });
12092   Object.defineProperty(exports, "isIdentifierStart", {
12093     enumerable: true,
12094     get: function () {
12095       return _identifier.isIdentifierStart;
12096     }
12097   });
12098   Object.defineProperty(exports, "isReservedWord", {
12099     enumerable: true,
12100     get: function () {
12101       return _keyword.isReservedWord;
12102     }
12103   });
12104   Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
12105     enumerable: true,
12106     get: function () {
12107       return _keyword.isStrictBindOnlyReservedWord;
12108     }
12109   });
12110   Object.defineProperty(exports, "isStrictBindReservedWord", {
12111     enumerable: true,
12112     get: function () {
12113       return _keyword.isStrictBindReservedWord;
12114     }
12115   });
12116   Object.defineProperty(exports, "isStrictReservedWord", {
12117     enumerable: true,
12118     get: function () {
12119       return _keyword.isStrictReservedWord;
12120     }
12121   });
12122   Object.defineProperty(exports, "isKeyword", {
12123     enumerable: true,
12124     get: function () {
12125       return _keyword.isKeyword;
12126     }
12127   });
12128   var _identifier = identifier;
12129   var _keyword = keyword$1;
12130 })(lib$1);
12131
12132 var chalk = {exports: {}};
12133
12134 var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
12135
12136 var escapeStringRegexp = function (str) {
12137   if (typeof str !== 'string') {
12138     throw new TypeError('Expected a string');
12139   }
12140
12141   return str.replace(matchOperatorsRe, '\\$&');
12142 };
12143
12144 var hasFlag$1 = (flag, argv) => {
12145   argv = argv || process.argv;
12146   const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
12147   const pos = argv.indexOf(prefix + flag);
12148   const terminatorPos = argv.indexOf('--');
12149   return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
12150 };
12151
12152 const os$2 = require$$0__default$1["default"];
12153 const hasFlag = hasFlag$1;
12154 const env = process.env;
12155 let forceColor;
12156
12157 if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
12158   forceColor = false;
12159 } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
12160   forceColor = true;
12161 }
12162
12163 if ('FORCE_COLOR' in env) {
12164   forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
12165 }
12166
12167 function translateLevel(level) {
12168   if (level === 0) {
12169     return false;
12170   }
12171
12172   return {
12173     level,
12174     hasBasic: true,
12175     has256: level >= 2,
12176     has16m: level >= 3
12177   };
12178 }
12179
12180 function supportsColor(stream) {
12181   if (forceColor === false) {
12182     return 0;
12183   }
12184
12185   if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
12186     return 3;
12187   }
12188
12189   if (hasFlag('color=256')) {
12190     return 2;
12191   }
12192
12193   if (stream && !stream.isTTY && forceColor !== true) {
12194     return 0;
12195   }
12196
12197   const min = forceColor ? 1 : 0;
12198
12199   if (process.platform === 'win32') {
12200     // Node.js 7.5.0 is the first version of Node.js to include a patch to
12201     // libuv that enables 256 color output on Windows. Anything earlier and it
12202     // won't work. However, here we target Node.js 8 at minimum as it is an LTS
12203     // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
12204     // release that supports 256 colors. Windows 10 build 14931 is the first release
12205     // that supports 16m/TrueColor.
12206     const osRelease = os$2.release().split('.');
12207
12208     if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
12209       return Number(osRelease[2]) >= 14931 ? 3 : 2;
12210     }
12211
12212     return 1;
12213   }
12214
12215   if ('CI' in env) {
12216     if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
12217       return 1;
12218     }
12219
12220     return min;
12221   }
12222
12223   if ('TEAMCITY_VERSION' in env) {
12224     return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
12225   }
12226
12227   if (env.COLORTERM === 'truecolor') {
12228     return 3;
12229   }
12230
12231   if ('TERM_PROGRAM' in env) {
12232     const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
12233
12234     switch (env.TERM_PROGRAM) {
12235       case 'iTerm.app':
12236         return version >= 3 ? 3 : 2;
12237
12238       case 'Apple_Terminal':
12239         return 2;
12240       // No default
12241     }
12242   }
12243
12244   if (/-256(color)?$/i.test(env.TERM)) {
12245     return 2;
12246   }
12247
12248   if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
12249     return 1;
12250   }
12251
12252   if ('COLORTERM' in env) {
12253     return 1;
12254   }
12255
12256   if (env.TERM === 'dumb') {
12257     return min;
12258   }
12259
12260   return min;
12261 }
12262
12263 function getSupportLevel(stream) {
12264   const level = supportsColor(stream);
12265   return translateLevel(level);
12266 }
12267
12268 var supportsColor_1 = {
12269   supportsColor: getSupportLevel,
12270   stdout: getSupportLevel(process.stdout),
12271   stderr: getSupportLevel(process.stderr)
12272 };
12273
12274 const TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
12275 const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
12276 const STRING_REGEX$1 = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
12277 const ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
12278 const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
12279
12280 function unescape(c) {
12281   if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
12282     return String.fromCharCode(parseInt(c.slice(1), 16));
12283   }
12284
12285   return ESCAPES.get(c) || c;
12286 }
12287
12288 function parseArguments(name, args) {
12289   const results = [];
12290   const chunks = args.trim().split(/\s*,\s*/g);
12291   let matches;
12292
12293   for (const chunk of chunks) {
12294     if (!isNaN(chunk)) {
12295       results.push(Number(chunk));
12296     } else if (matches = chunk.match(STRING_REGEX$1)) {
12297       results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
12298     } else {
12299       throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
12300     }
12301   }
12302
12303   return results;
12304 }
12305
12306 function parseStyle(style) {
12307   STYLE_REGEX.lastIndex = 0;
12308   const results = [];
12309   let matches;
12310
12311   while ((matches = STYLE_REGEX.exec(style)) !== null) {
12312     const name = matches[1];
12313
12314     if (matches[2]) {
12315       const args = parseArguments(name, matches[2]);
12316       results.push([name].concat(args));
12317     } else {
12318       results.push([name]);
12319     }
12320   }
12321
12322   return results;
12323 }
12324
12325 function buildStyle(chalk, styles) {
12326   const enabled = {};
12327
12328   for (const layer of styles) {
12329     for (const style of layer.styles) {
12330       enabled[style[0]] = layer.inverse ? null : style.slice(1);
12331     }
12332   }
12333
12334   let current = chalk;
12335
12336   for (const styleName of Object.keys(enabled)) {
12337     if (Array.isArray(enabled[styleName])) {
12338       if (!(styleName in current)) {
12339         throw new Error(`Unknown Chalk style: ${styleName}`);
12340       }
12341
12342       if (enabled[styleName].length > 0) {
12343         current = current[styleName].apply(current, enabled[styleName]);
12344       } else {
12345         current = current[styleName];
12346       }
12347     }
12348   }
12349
12350   return current;
12351 }
12352
12353 var templates = (chalk, tmp) => {
12354   const styles = [];
12355   const chunks = [];
12356   let chunk = []; // eslint-disable-next-line max-params
12357
12358   tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
12359     if (escapeChar) {
12360       chunk.push(unescape(escapeChar));
12361     } else if (style) {
12362       const str = chunk.join('');
12363       chunk = [];
12364       chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
12365       styles.push({
12366         inverse,
12367         styles: parseStyle(style)
12368       });
12369     } else if (close) {
12370       if (styles.length === 0) {
12371         throw new Error('Found extraneous } in Chalk template literal');
12372       }
12373
12374       chunks.push(buildStyle(chalk, styles)(chunk.join('')));
12375       chunk = [];
12376       styles.pop();
12377     } else {
12378       chunk.push(chr);
12379     }
12380   });
12381   chunks.push(chunk.join(''));
12382
12383   if (styles.length > 0) {
12384     const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
12385     throw new Error(errMsg);
12386   }
12387
12388   return chunks.join('');
12389 };
12390
12391 (function (module) {
12392
12393   const escapeStringRegexp$1 = escapeStringRegexp;
12394   const ansiStyles = ansiStyles$2.exports;
12395   const stdoutColor = supportsColor_1.stdout;
12396   const template = templates;
12397   const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
12398
12399   const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
12400
12401   const skipModels = new Set(['gray']);
12402   const styles = Object.create(null);
12403
12404   function applyOptions(obj, options) {
12405     options = options || {}; // Detect level if not set manually
12406
12407     const scLevel = stdoutColor ? stdoutColor.level : 0;
12408     obj.level = options.level === undefined ? scLevel : options.level;
12409     obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
12410   }
12411
12412   function Chalk(options) {
12413     // We check for this.template here since calling `chalk.constructor()`
12414     // by itself will have a `this` of a previously constructed chalk object
12415     if (!this || !(this instanceof Chalk) || this.template) {
12416       const chalk = {};
12417       applyOptions(chalk, options);
12418
12419       chalk.template = function () {
12420         const args = [].slice.call(arguments);
12421         return chalkTag.apply(null, [chalk.template].concat(args));
12422       };
12423
12424       Object.setPrototypeOf(chalk, Chalk.prototype);
12425       Object.setPrototypeOf(chalk.template, chalk);
12426       chalk.template.constructor = Chalk;
12427       return chalk.template;
12428     }
12429
12430     applyOptions(this, options);
12431   } // Use bright blue on Windows as the normal blue color is illegible
12432
12433
12434   if (isSimpleWindowsTerm) {
12435     ansiStyles.blue.open = '\u001B[94m';
12436   }
12437
12438   for (const key of Object.keys(ansiStyles)) {
12439     ansiStyles[key].closeRe = new RegExp(escapeStringRegexp$1(ansiStyles[key].close), 'g');
12440     styles[key] = {
12441       get() {
12442         const codes = ansiStyles[key];
12443         return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
12444       }
12445
12446     };
12447   }
12448
12449   styles.visible = {
12450     get() {
12451       return build.call(this, this._styles || [], true, 'visible');
12452     }
12453
12454   };
12455   ansiStyles.color.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles.color.close), 'g');
12456
12457   for (const model of Object.keys(ansiStyles.color.ansi)) {
12458     if (skipModels.has(model)) {
12459       continue;
12460     }
12461
12462     styles[model] = {
12463       get() {
12464         const level = this.level;
12465         return function () {
12466           const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
12467           const codes = {
12468             open,
12469             close: ansiStyles.color.close,
12470             closeRe: ansiStyles.color.closeRe
12471           };
12472           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
12473         };
12474       }
12475
12476     };
12477   }
12478
12479   ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp$1(ansiStyles.bgColor.close), 'g');
12480
12481   for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
12482     if (skipModels.has(model)) {
12483       continue;
12484     }
12485
12486     const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
12487     styles[bgModel] = {
12488       get() {
12489         const level = this.level;
12490         return function () {
12491           const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
12492           const codes = {
12493             open,
12494             close: ansiStyles.bgColor.close,
12495             closeRe: ansiStyles.bgColor.closeRe
12496           };
12497           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
12498         };
12499       }
12500
12501     };
12502   }
12503
12504   const proto = Object.defineProperties(() => {}, styles);
12505
12506   function build(_styles, _empty, key) {
12507     const builder = function () {
12508       return applyStyle.apply(builder, arguments);
12509     };
12510
12511     builder._styles = _styles;
12512     builder._empty = _empty;
12513     const self = this;
12514     Object.defineProperty(builder, 'level', {
12515       enumerable: true,
12516
12517       get() {
12518         return self.level;
12519       },
12520
12521       set(level) {
12522         self.level = level;
12523       }
12524
12525     });
12526     Object.defineProperty(builder, 'enabled', {
12527       enumerable: true,
12528
12529       get() {
12530         return self.enabled;
12531       },
12532
12533       set(enabled) {
12534         self.enabled = enabled;
12535       }
12536
12537     }); // See below for fix regarding invisible grey/dim combination on Windows
12538
12539     builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
12540     // no way to create a function with a different prototype
12541
12542     builder.__proto__ = proto; // eslint-disable-line no-proto
12543
12544     return builder;
12545   }
12546
12547   function applyStyle() {
12548     // Support varags, but simply cast to string in case there's only one arg
12549     const args = arguments;
12550     const argsLen = args.length;
12551     let str = String(arguments[0]);
12552
12553     if (argsLen === 0) {
12554       return '';
12555     }
12556
12557     if (argsLen > 1) {
12558       // Don't slice `arguments`, it prevents V8 optimizations
12559       for (let a = 1; a < argsLen; a++) {
12560         str += ' ' + args[a];
12561       }
12562     }
12563
12564     if (!this.enabled || this.level <= 0 || !str) {
12565       return this._empty ? '' : str;
12566     } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
12567     // see https://github.com/chalk/chalk/issues/58
12568     // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
12569
12570
12571     const originalDim = ansiStyles.dim.open;
12572
12573     if (isSimpleWindowsTerm && this.hasGrey) {
12574       ansiStyles.dim.open = '';
12575     }
12576
12577     for (const code of this._styles.slice().reverse()) {
12578       // Replace any instances already present with a re-opening code
12579       // otherwise only the part of the string until said closing code
12580       // will be colored, and the rest will simply be 'plain'.
12581       str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
12582       // after next line to fix a bleed issue on macOS
12583       // https://github.com/chalk/chalk/pull/92
12584
12585       str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
12586     } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
12587
12588
12589     ansiStyles.dim.open = originalDim;
12590     return str;
12591   }
12592
12593   function chalkTag(chalk, strings) {
12594     if (!Array.isArray(strings)) {
12595       // If chalk() was called by itself or with a string,
12596       // return the string itself as a string.
12597       return [].slice.call(arguments, 1).join(' ');
12598     }
12599
12600     const args = [].slice.call(arguments, 2);
12601     const parts = [strings.raw[0]];
12602
12603     for (let i = 1; i < strings.length; i++) {
12604       parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
12605       parts.push(String(strings.raw[i]));
12606     }
12607
12608     return template(chalk, parts.join(''));
12609   }
12610
12611   Object.defineProperties(Chalk.prototype, styles);
12612   module.exports = Chalk(); // eslint-disable-line new-cap
12613
12614   module.exports.supportsColor = stdoutColor;
12615   module.exports.default = module.exports; // For TypeScript
12616 })(chalk);
12617
12618 Object.defineProperty(lib$2, "__esModule", {
12619   value: true
12620 });
12621
12622 lib$2.default = highlight;
12623
12624 lib$2.getChalk = getChalk;
12625 lib$2.shouldHighlight = shouldHighlight;
12626 var _jsTokens = jsTokens;
12627 var _helperValidatorIdentifier = lib$1;
12628 var _chalk = chalk.exports;
12629 const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
12630
12631 function getDefs$1(chalk) {
12632   return {
12633     keyword: chalk.cyan,
12634     capitalized: chalk.yellow,
12635     jsxIdentifier: chalk.yellow,
12636     punctuator: chalk.yellow,
12637     number: chalk.magenta,
12638     string: chalk.green,
12639     regex: chalk.magenta,
12640     comment: chalk.grey,
12641     invalid: chalk.white.bgRed.bold
12642   };
12643 }
12644
12645 const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
12646 const BRACKET = /^[()[\]{}]$/;
12647 let tokenize;
12648 {
12649   const JSX_TAG = /^[a-z][\w-]*$/i;
12650
12651   const getTokenType = function (token, offset, text) {
12652     if (token.type === "name") {
12653       if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
12654         return "keyword";
12655       }
12656
12657       if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
12658         return "jsxIdentifier";
12659       }
12660
12661       if (token.value[0] !== token.value[0].toLowerCase()) {
12662         return "capitalized";
12663       }
12664     }
12665
12666     if (token.type === "punctuator" && BRACKET.test(token.value)) {
12667       return "bracket";
12668     }
12669
12670     if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
12671       return "punctuator";
12672     }
12673
12674     return token.type;
12675   };
12676
12677   tokenize = function* (text) {
12678     let match;
12679
12680     while (match = _jsTokens.default.exec(text)) {
12681       const token = _jsTokens.matchToToken(match);
12682
12683       yield {
12684         type: getTokenType(token, match.index, text),
12685         value: token.value
12686       };
12687     }
12688   };
12689 }
12690
12691 function highlightTokens(defs, text) {
12692   let highlighted = "";
12693
12694   for (const {
12695     type,
12696     value
12697   } of tokenize(text)) {
12698     const colorize = defs[type];
12699
12700     if (colorize) {
12701       highlighted += value.split(NEWLINE$1).map(str => colorize(str)).join("\n");
12702     } else {
12703       highlighted += value;
12704     }
12705   }
12706
12707   return highlighted;
12708 }
12709
12710 function shouldHighlight(options) {
12711   return !!_chalk.supportsColor || options.forceColor;
12712 }
12713
12714 function getChalk(options) {
12715   return options.forceColor ? new _chalk.constructor({
12716     enabled: true,
12717     level: 1
12718   }) : _chalk;
12719 }
12720
12721 function highlight(code, options = {}) {
12722   if (shouldHighlight(options)) {
12723     const chalk = getChalk(options);
12724     const defs = getDefs$1(chalk);
12725     return highlightTokens(defs, code);
12726   } else {
12727     return code;
12728   }
12729 }
12730
12731 Object.defineProperty(lib$3, "__esModule", {
12732   value: true
12733 });
12734 lib$3.codeFrameColumns = codeFrameColumns;
12735 lib$3.default = _default;
12736 var _highlight = lib$2;
12737 let deprecationWarningShown = false;
12738
12739 function getDefs(chalk) {
12740   return {
12741     gutter: chalk.grey,
12742     marker: chalk.red.bold,
12743     message: chalk.red.bold
12744   };
12745 }
12746
12747 const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
12748
12749 function getMarkerLines(loc, source, opts) {
12750   const startLoc = Object.assign({
12751     column: 0,
12752     line: -1
12753   }, loc.start);
12754   const endLoc = Object.assign({}, startLoc, loc.end);
12755   const {
12756     linesAbove = 2,
12757     linesBelow = 3
12758   } = opts || {};
12759   const startLine = startLoc.line;
12760   const startColumn = startLoc.column;
12761   const endLine = endLoc.line;
12762   const endColumn = endLoc.column;
12763   let start = Math.max(startLine - (linesAbove + 1), 0);
12764   let end = Math.min(source.length, endLine + linesBelow);
12765
12766   if (startLine === -1) {
12767     start = 0;
12768   }
12769
12770   if (endLine === -1) {
12771     end = source.length;
12772   }
12773
12774   const lineDiff = endLine - startLine;
12775   const markerLines = {};
12776
12777   if (lineDiff) {
12778     for (let i = 0; i <= lineDiff; i++) {
12779       const lineNumber = i + startLine;
12780
12781       if (!startColumn) {
12782         markerLines[lineNumber] = true;
12783       } else if (i === 0) {
12784         const sourceLength = source[lineNumber - 1].length;
12785         markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
12786       } else if (i === lineDiff) {
12787         markerLines[lineNumber] = [0, endColumn];
12788       } else {
12789         const sourceLength = source[lineNumber - i].length;
12790         markerLines[lineNumber] = [0, sourceLength];
12791       }
12792     }
12793   } else {
12794     if (startColumn === endColumn) {
12795       if (startColumn) {
12796         markerLines[startLine] = [startColumn, 0];
12797       } else {
12798         markerLines[startLine] = true;
12799       }
12800     } else {
12801       markerLines[startLine] = [startColumn, endColumn - startColumn];
12802     }
12803   }
12804
12805   return {
12806     start,
12807     end,
12808     markerLines
12809   };
12810 }
12811
12812 function codeFrameColumns(rawLines, loc, opts = {}) {
12813   const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
12814   const chalk = (0, _highlight.getChalk)(opts);
12815   const defs = getDefs(chalk);
12816
12817   const maybeHighlight = (chalkFn, string) => {
12818     return highlighted ? chalkFn(string) : string;
12819   };
12820
12821   const lines = rawLines.split(NEWLINE);
12822   const {
12823     start,
12824     end,
12825     markerLines
12826   } = getMarkerLines(loc, lines, opts);
12827   const hasColumns = loc.start && typeof loc.start.column === "number";
12828   const numberMaxWidth = String(end).length;
12829   const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
12830   let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
12831     const number = start + 1 + index;
12832     const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
12833     const gutter = ` ${paddedNumber} |`;
12834     const hasMarker = markerLines[number];
12835     const lastMarkerLine = !markerLines[number + 1];
12836
12837     if (hasMarker) {
12838       let markerLine = "";
12839
12840       if (Array.isArray(hasMarker)) {
12841         const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
12842         const numberOfMarkers = hasMarker[1] || 1;
12843         markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
12844
12845         if (lastMarkerLine && opts.message) {
12846           markerLine += " " + maybeHighlight(defs.message, opts.message);
12847         }
12848       }
12849
12850       return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
12851     } else {
12852       return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
12853     }
12854   }).join("\n");
12855
12856   if (opts.message && !hasColumns) {
12857     frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
12858   }
12859
12860   if (highlighted) {
12861     return chalk.reset(frame);
12862   } else {
12863     return frame;
12864   }
12865 }
12866
12867 function _default(rawLines, lineNumber, colNumber, opts = {}) {
12868   if (!deprecationWarningShown) {
12869     deprecationWarningShown = true;
12870     const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
12871
12872     if (process.emitWarning) {
12873       process.emitWarning(message, "DeprecationWarning");
12874     } else {
12875       const deprecationError = new Error(message);
12876       deprecationError.name = "DeprecationWarning";
12877       console.warn(new Error(message));
12878     }
12879   }
12880
12881   colNumber = Math.max(colNumber, 0);
12882   const location = {
12883     start: {
12884       column: colNumber,
12885       line: lineNumber
12886     }
12887   };
12888   return codeFrameColumns(rawLines, location, opts);
12889 }
12890
12891 const path$q = require$$0__default$2["default"];
12892 const {
12893   ConfigError
12894 } = errors;
12895 const jsLoc = loc$6;
12896 const {
12897   locStart: locStart$r,
12898   locEnd: locEnd$q
12899 } = jsLoc; // Use defineProperties()/getOwnPropertyDescriptor() to prevent
12900 // triggering the parsers getters.
12901
12902 const ownNames = Object.getOwnPropertyNames;
12903 const ownDescriptor = Object.getOwnPropertyDescriptor;
12904
12905 function getParsers(options) {
12906   const parsers = {};
12907
12908   for (const plugin of options.plugins) {
12909     // TODO: test this with plugins
12910
12911     /* istanbul ignore next */
12912     if (!plugin.parsers) {
12913       continue;
12914     }
12915
12916     for (const name of ownNames(plugin.parsers)) {
12917       Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
12918     }
12919   }
12920
12921   return parsers;
12922 }
12923
12924 function resolveParser$1(opts, parsers = getParsers(opts)) {
12925   if (typeof opts.parser === "function") {
12926     // Custom parser API always works with JavaScript.
12927     return {
12928       parse: opts.parser,
12929       astFormat: "estree",
12930       locStart: locStart$r,
12931       locEnd: locEnd$q
12932     };
12933   }
12934
12935   if (typeof opts.parser === "string") {
12936     if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
12937       return parsers[opts.parser];
12938     }
12939
12940     try {
12941       return {
12942         parse: require(path$q.resolve(process.cwd(), opts.parser)),
12943         astFormat: "estree",
12944         locStart: locStart$r,
12945         locEnd: locEnd$q
12946       };
12947     } catch {
12948       /* istanbul ignore next */
12949       throw new ConfigError(`Couldn't resolve parser "${opts.parser}"`);
12950     }
12951   }
12952 }
12953
12954 function parse$d(text, opts) {
12955   const parsers = getParsers(opts); // Create a new object {parserName: parseFn}. Uses defineProperty() to only call
12956   // the parsers getters when actually calling the parser `parse` function.
12957
12958   const parsersForCustomParserApi = Object.defineProperties({}, Object.fromEntries(Object.keys(parsers).map(parserName => [parserName, {
12959     enumerable: true,
12960
12961     get() {
12962       return parsers[parserName].parse;
12963     }
12964
12965   }])));
12966   const parser = resolveParser$1(opts, parsers);
12967
12968   try {
12969     if (parser.preprocess) {
12970       text = parser.preprocess(text, opts);
12971     }
12972
12973     return {
12974       text,
12975       ast: parser.parse(text, parsersForCustomParserApi, opts)
12976     };
12977   } catch (error) {
12978     const {
12979       loc
12980     } = error;
12981
12982     if (loc) {
12983       const {
12984         codeFrameColumns
12985       } = lib$3;
12986       error.codeFrame = codeFrameColumns(text, loc, {
12987         highlightCode: true
12988       });
12989       error.message += "\n" + error.codeFrame;
12990       throw error;
12991     }
12992     /* istanbul ignore next */
12993
12994
12995     throw error.stack;
12996   }
12997 }
12998
12999 var parser$2 = {
13000   parse: parse$d,
13001   resolveParser: resolveParser$1
13002 };
13003
13004 const fs$k = require$$0__default["default"];
13005 const path$p = require$$0__default$2["default"];
13006 const readlines = readlines$1;
13007 const {
13008   UndefinedParserError
13009 } = errors;
13010 const {
13011   getSupportInfo: getSupportInfo$1
13012 } = support;
13013 const normalizer = optionsNormalizer;
13014 const {
13015   resolveParser
13016 } = parser$2;
13017 const hiddenDefaults = {
13018   astFormat: "estree",
13019   printer: {},
13020   originalText: undefined,
13021   locStart: null,
13022   locEnd: null
13023 }; // Copy options and fill in default values.
13024
13025 function normalize$1(options, opts = {}) {
13026   const rawOptions = Object.assign({}, options);
13027   const supportOptions = getSupportInfo$1({
13028     plugins: options.plugins,
13029     showUnreleased: true,
13030     showDeprecated: true
13031   }).options;
13032   const defaults = Object.assign(Object.assign({}, hiddenDefaults), Object.fromEntries(supportOptions.filter(optionInfo => optionInfo.default !== undefined).map(option => [option.name, option.default])));
13033
13034   if (!rawOptions.parser) {
13035     if (!rawOptions.filepath) {
13036       const logger = opts.logger || console;
13037       logger.warn("No parser and no filepath given, using 'babel' the parser now " + "but this will throw an error in the future. " + "Please specify a parser or a filepath so one can be inferred.");
13038       rawOptions.parser = "babel";
13039     } else {
13040       rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
13041
13042       if (!rawOptions.parser) {
13043         throw new UndefinedParserError(`No parser could be inferred for file: ${rawOptions.filepath}`);
13044       }
13045     }
13046   }
13047
13048   const parser = resolveParser(normalizer.normalizeApiOptions(rawOptions, [supportOptions.find(x => x.name === "parser")], {
13049     passThrough: true,
13050     logger: false
13051   }));
13052   rawOptions.astFormat = parser.astFormat;
13053   rawOptions.locEnd = parser.locEnd;
13054   rawOptions.locStart = parser.locStart;
13055   const plugin = getPlugin(rawOptions);
13056   rawOptions.printer = plugin.printers[rawOptions.astFormat];
13057   const pluginDefaults = Object.fromEntries(supportOptions.filter(optionInfo => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== undefined).map(optionInfo => [optionInfo.name, optionInfo.pluginDefaults[plugin.name]]));
13058   const mixedDefaults = Object.assign(Object.assign({}, defaults), pluginDefaults);
13059
13060   for (const [k, value] of Object.entries(mixedDefaults)) {
13061     if (rawOptions[k] === null || rawOptions[k] === undefined) {
13062       rawOptions[k] = value;
13063     }
13064   }
13065
13066   if (rawOptions.parser === "json") {
13067     rawOptions.trailingComma = "none";
13068   }
13069
13070   return normalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
13071     passThrough: Object.keys(hiddenDefaults)
13072   }, opts));
13073 }
13074
13075 function getPlugin(options) {
13076   const {
13077     astFormat
13078   } = options; // TODO: test this with plugins
13079
13080   /* istanbul ignore next */
13081
13082   if (!astFormat) {
13083     throw new Error("getPlugin() requires astFormat to be set");
13084   }
13085
13086   const printerPlugin = options.plugins.find(plugin => plugin.printers && plugin.printers[astFormat]); // TODO: test this with plugins
13087
13088   /* istanbul ignore next */
13089
13090   if (!printerPlugin) {
13091     throw new Error(`Couldn't find plugin for AST format "${astFormat}"`);
13092   }
13093
13094   return printerPlugin;
13095 }
13096
13097 function getInterpreter(filepath) {
13098   /* istanbul ignore next */
13099   if (typeof filepath !== "string") {
13100     return "";
13101   }
13102
13103   let fd;
13104
13105   try {
13106     fd = fs$k.openSync(filepath, "r");
13107   } catch {
13108     // istanbul ignore next
13109     return "";
13110   }
13111
13112   try {
13113     const liner = new readlines(fd);
13114     const firstLine = liner.next().toString("utf8"); // #!/bin/env node, #!/usr/bin/env node
13115
13116     const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
13117
13118     if (m1) {
13119       return m1[1];
13120     } // #!/bin/node, #!/usr/bin/node, #!/usr/local/bin/node
13121
13122
13123     const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
13124
13125     if (m2) {
13126       return m2[1];
13127     }
13128
13129     return "";
13130   } catch {
13131     // There are some weird cases where paths are missing, causing Jest
13132     // failures. It's unclear what these correspond to in the real world.
13133
13134     /* istanbul ignore next */
13135     return "";
13136   } finally {
13137     try {
13138       // There are some weird cases where paths are missing, causing Jest
13139       // failures. It's unclear what these correspond to in the real world.
13140       fs$k.closeSync(fd);
13141     } catch {// nop
13142     }
13143   }
13144 }
13145
13146 function inferParser(filepath, plugins) {
13147   const filename = path$p.basename(filepath).toLowerCase();
13148   const languages = getSupportInfo$1({
13149     plugins
13150   }).languages.filter(language => language.since !== null); // If the file has no extension, we can try to infer the language from the
13151   // interpreter in the shebang line, if any; but since this requires FS access,
13152   // do it last.
13153
13154   let language = languages.find(language => language.extensions && language.extensions.some(extension => filename.endsWith(extension)) || language.filenames && language.filenames.some(name => name.toLowerCase() === filename));
13155
13156   if (!language && !filename.includes(".")) {
13157     const interpreter = getInterpreter(filepath);
13158     language = languages.find(language => language.interpreters && language.interpreters.includes(interpreter));
13159   }
13160
13161   return language && language.parsers[0];
13162 }
13163
13164 var options$d = {
13165   normalize: normalize$1,
13166   hiddenDefaults,
13167   inferParser
13168 };
13169
13170 function massageAST$1(ast, options, parent) {
13171   if (Array.isArray(ast)) {
13172     return ast.map(e => massageAST$1(e, options, parent)).filter(Boolean);
13173   }
13174
13175   if (!ast || typeof ast !== "object") {
13176     return ast;
13177   }
13178
13179   const cleanFunction = options.printer.massageAstNode;
13180   let ignoredProperties;
13181
13182   if (cleanFunction && cleanFunction.ignoredProperties) {
13183     ignoredProperties = cleanFunction.ignoredProperties;
13184   } else {
13185     ignoredProperties = new Set();
13186   }
13187
13188   const newObj = {};
13189
13190   for (const [key, value] of Object.entries(ast)) {
13191     if (!ignoredProperties.has(key) && typeof value !== "function") {
13192       newObj[key] = massageAST$1(value, options, ast);
13193     }
13194   }
13195
13196   if (cleanFunction) {
13197     const result = cleanFunction(ast, newObj, parent);
13198
13199     if (result === null) {
13200       return;
13201     }
13202
13203     if (result) {
13204       return result;
13205     }
13206   }
13207
13208   return newObj;
13209 }
13210
13211 var massageAst = massageAST$1;
13212
13213 const assert$6 = require$$0__default$3["default"];
13214 const {
13215   builders: {
13216     line: line$A,
13217     hardline: hardline$C,
13218     breakParent: breakParent$a,
13219     indent: indent$z,
13220     lineSuffix: lineSuffix$1,
13221     join: join$v,
13222     cursor
13223   }
13224 } = require$$7$3;
13225 const {
13226   hasNewline: hasNewline$9,
13227   skipNewline: skipNewline$1,
13228   skipSpaces: skipSpaces$1,
13229   isPreviousLineEmpty: isPreviousLineEmpty$2,
13230   addLeadingComment: addLeadingComment$2,
13231   addDanglingComment: addDanglingComment$2,
13232   addTrailingComment: addTrailingComment$2
13233 } = util$8;
13234 const childNodesCache = new WeakMap();
13235
13236 function getSortedChildNodes(node, options, resultArray) {
13237   if (!node) {
13238     return;
13239   }
13240
13241   const {
13242     printer,
13243     locStart,
13244     locEnd
13245   } = options;
13246
13247   if (resultArray) {
13248     if (printer.canAttachComment && printer.canAttachComment(node)) {
13249       // This reverse insertion sort almost always takes constant
13250       // time because we almost always (maybe always?) append the
13251       // nodes in order anyway.
13252       let i;
13253
13254       for (i = resultArray.length - 1; i >= 0; --i) {
13255         if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
13256           break;
13257         }
13258       }
13259
13260       resultArray.splice(i + 1, 0, node);
13261       return;
13262     }
13263   } else if (childNodesCache.has(node)) {
13264     return childNodesCache.get(node);
13265   }
13266
13267   const childNodes = printer.getCommentChildNodes && printer.getCommentChildNodes(node, options) || typeof node === "object" && Object.entries(node).filter(([key]) => key !== "enclosingNode" && key !== "precedingNode" && key !== "followingNode" && key !== "tokens" && key !== "comments").map(([, value]) => value);
13268
13269   if (!childNodes) {
13270     return;
13271   }
13272
13273   if (!resultArray) {
13274     resultArray = [];
13275     childNodesCache.set(node, resultArray);
13276   }
13277
13278   for (const childNode of childNodes) {
13279     getSortedChildNodes(childNode, options, resultArray);
13280   }
13281
13282   return resultArray;
13283 } // As efficiently as possible, decorate the comment object with
13284 // .precedingNode, .enclosingNode, and/or .followingNode properties, at
13285 // least one of which is guaranteed to be defined.
13286
13287
13288 function decorateComment(node, comment, options, enclosingNode) {
13289   const {
13290     locStart,
13291     locEnd
13292   } = options;
13293   const commentStart = locStart(comment);
13294   const commentEnd = locEnd(comment);
13295   const childNodes = getSortedChildNodes(node, options);
13296   let precedingNode;
13297   let followingNode; // Time to dust off the old binary search robes and wizard hat.
13298
13299   let left = 0;
13300   let right = childNodes.length;
13301
13302   while (left < right) {
13303     const middle = left + right >> 1;
13304     const child = childNodes[middle];
13305     const start = locStart(child);
13306     const end = locEnd(child); // The comment is completely contained by this child node.
13307
13308     if (start <= commentStart && commentEnd <= end) {
13309       // Abandon the binary search at this level.
13310       return decorateComment(child, comment, options, child);
13311     }
13312
13313     if (end <= commentStart) {
13314       // This child node falls completely before the comment.
13315       // Because we will never consider this node or any nodes
13316       // before it again, this node must be the closest preceding
13317       // node we have encountered so far.
13318       precedingNode = child;
13319       left = middle + 1;
13320       continue;
13321     }
13322
13323     if (commentEnd <= start) {
13324       // This child node falls completely after the comment.
13325       // Because we will never consider this node or any nodes after
13326       // it again, this node must be the closest following node we
13327       // have encountered so far.
13328       followingNode = child;
13329       right = middle;
13330       continue;
13331     }
13332     /* istanbul ignore next */
13333
13334
13335     throw new Error("Comment location overlaps with node location");
13336   } // We don't want comments inside of different expressions inside of the same
13337   // template literal to move to another expression.
13338
13339
13340   if (enclosingNode && enclosingNode.type === "TemplateLiteral") {
13341     const {
13342       quasis
13343     } = enclosingNode;
13344     const commentIndex = findExpressionIndexForComment(quasis, comment, options);
13345
13346     if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
13347       precedingNode = null;
13348     }
13349
13350     if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
13351       followingNode = null;
13352     }
13353   }
13354
13355   return {
13356     enclosingNode,
13357     precedingNode,
13358     followingNode
13359   };
13360 }
13361
13362 const returnFalse$1 = () => false;
13363
13364 function attach(comments, ast, text, options) {
13365   if (!Array.isArray(comments)) {
13366     return;
13367   }
13368
13369   const tiesToBreak = [];
13370   const {
13371     locStart,
13372     locEnd,
13373     printer: {
13374       handleComments = {}
13375     }
13376   } = options; // TODO: Make this as default behavior
13377
13378   const {
13379     avoidAstMutation,
13380     ownLine: handleOwnLineComment = returnFalse$1,
13381     endOfLine: handleEndOfLineComment = returnFalse$1,
13382     remaining: handleRemainingComment = returnFalse$1
13383   } = handleComments;
13384   const decoratedComments = comments.map((comment, index) => Object.assign(Object.assign({}, decorateComment(ast, comment, options)), {}, {
13385     comment,
13386     text,
13387     options,
13388     ast,
13389     isLastComment: comments.length - 1 === index
13390   }));
13391
13392   for (const [index, context] of decoratedComments.entries()) {
13393     const {
13394       comment,
13395       precedingNode,
13396       enclosingNode,
13397       followingNode,
13398       text,
13399       options,
13400       ast,
13401       isLastComment
13402     } = context;
13403
13404     if (options.parser === "json" || options.parser === "json5" || options.parser === "__js_expression" || options.parser === "__vue_expression") {
13405       if (locStart(comment) - locStart(ast) <= 0) {
13406         addLeadingComment$2(ast, comment);
13407         continue;
13408       }
13409
13410       if (locEnd(comment) - locEnd(ast) >= 0) {
13411         addTrailingComment$2(ast, comment);
13412         continue;
13413       }
13414     }
13415
13416     let args;
13417
13418     if (avoidAstMutation) {
13419       args = [context];
13420     } else {
13421       comment.enclosingNode = enclosingNode;
13422       comment.precedingNode = precedingNode;
13423       comment.followingNode = followingNode;
13424       args = [comment, text, options, ast, isLastComment];
13425     }
13426
13427     if (isOwnLineComment(text, options, decoratedComments, index)) {
13428       comment.placement = "ownLine"; // If a comment exists on its own line, prefer a leading comment.
13429       // We also need to check if it's the first line of the file.
13430
13431       if (handleOwnLineComment(...args)) ; else if (followingNode) {
13432         // Always a leading comment.
13433         addLeadingComment$2(followingNode, comment);
13434       } else if (precedingNode) {
13435         addTrailingComment$2(precedingNode, comment);
13436       } else if (enclosingNode) {
13437         addDanglingComment$2(enclosingNode, comment);
13438       } else {
13439         // There are no nodes, let's attach it to the root of the ast
13440
13441         /* istanbul ignore next */
13442         addDanglingComment$2(ast, comment);
13443       }
13444     } else if (isEndOfLineComment(text, options, decoratedComments, index)) {
13445       comment.placement = "endOfLine";
13446
13447       if (handleEndOfLineComment(...args)) ; else if (precedingNode) {
13448         // There is content before this comment on the same line, but
13449         // none after it, so prefer a trailing comment of the previous node.
13450         addTrailingComment$2(precedingNode, comment);
13451       } else if (followingNode) {
13452         addLeadingComment$2(followingNode, comment);
13453       } else if (enclosingNode) {
13454         addDanglingComment$2(enclosingNode, comment);
13455       } else {
13456         // There are no nodes, let's attach it to the root of the ast
13457
13458         /* istanbul ignore next */
13459         addDanglingComment$2(ast, comment);
13460       }
13461     } else {
13462       comment.placement = "remaining";
13463
13464       if (handleRemainingComment(...args)) ; else if (precedingNode && followingNode) {
13465         // Otherwise, text exists both before and after the comment on
13466         // the same line. If there is both a preceding and following
13467         // node, use a tie-breaking algorithm to determine if it should
13468         // be attached to the next or previous node. In the last case,
13469         // simply attach the right node;
13470         const tieCount = tiesToBreak.length;
13471
13472         if (tieCount > 0) {
13473           const lastTie = tiesToBreak[tieCount - 1];
13474
13475           if (lastTie.followingNode !== followingNode) {
13476             breakTies(tiesToBreak, text, options);
13477           }
13478         }
13479
13480         tiesToBreak.push(context);
13481       } else if (precedingNode) {
13482         addTrailingComment$2(precedingNode, comment);
13483       } else if (followingNode) {
13484         addLeadingComment$2(followingNode, comment);
13485       } else if (enclosingNode) {
13486         addDanglingComment$2(enclosingNode, comment);
13487       } else {
13488         // There are no nodes, let's attach it to the root of the ast
13489
13490         /* istanbul ignore next */
13491         addDanglingComment$2(ast, comment);
13492       }
13493     }
13494   }
13495
13496   breakTies(tiesToBreak, text, options);
13497
13498   if (!avoidAstMutation) {
13499     for (const comment of comments) {
13500       // These node references were useful for breaking ties, but we
13501       // don't need them anymore, and they create cycles in the AST that
13502       // may lead to infinite recursion if we don't delete them here.
13503       delete comment.precedingNode;
13504       delete comment.enclosingNode;
13505       delete comment.followingNode;
13506     }
13507   }
13508 }
13509
13510 const isAllEmptyAndNoLineBreak = text => !/[\S\n\u2028\u2029]/.test(text);
13511
13512 function isOwnLineComment(text, options, decoratedComments, commentIndex) {
13513   const {
13514     comment,
13515     precedingNode
13516   } = decoratedComments[commentIndex];
13517   const {
13518     locStart,
13519     locEnd
13520   } = options;
13521   let start = locStart(comment);
13522
13523   if (precedingNode) {
13524     // Find first comment on the same line
13525     for (let index = commentIndex - 1; index >= 0; index--) {
13526       const {
13527         comment,
13528         precedingNode: currentCommentPrecedingNode
13529       } = decoratedComments[index];
13530
13531       if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment), start))) {
13532         break;
13533       }
13534
13535       start = locStart(comment);
13536     }
13537   }
13538
13539   return hasNewline$9(text, start, {
13540     backwards: true
13541   });
13542 }
13543
13544 function isEndOfLineComment(text, options, decoratedComments, commentIndex) {
13545   const {
13546     comment,
13547     followingNode
13548   } = decoratedComments[commentIndex];
13549   const {
13550     locStart,
13551     locEnd
13552   } = options;
13553   let end = locEnd(comment);
13554
13555   if (followingNode) {
13556     // Find last comment on the same line
13557     for (let index = commentIndex + 1; index < decoratedComments.length; index++) {
13558       const {
13559         comment,
13560         followingNode: currentCommentFollowingNode
13561       } = decoratedComments[index];
13562
13563       if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment)))) {
13564         break;
13565       }
13566
13567       end = locEnd(comment);
13568     }
13569   }
13570
13571   return hasNewline$9(text, end);
13572 }
13573
13574 function breakTies(tiesToBreak, text, options) {
13575   const tieCount = tiesToBreak.length;
13576
13577   if (tieCount === 0) {
13578     return;
13579   }
13580
13581   const {
13582     precedingNode,
13583     followingNode,
13584     enclosingNode
13585   } = tiesToBreak[0];
13586   const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
13587   let gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps
13588   // between the tied comments. In order to qualify as leading, a
13589   // comment must be separated from followingNode by an unbroken series of
13590   // gaps (or other comments). Gaps should only contain whitespace or open
13591   // parentheses.
13592
13593   let indexOfFirstLeadingComment;
13594
13595   for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
13596     const {
13597       comment,
13598       precedingNode: currentCommentPrecedingNode,
13599       followingNode: currentCommentFollowingNode
13600     } = tiesToBreak[indexOfFirstLeadingComment - 1];
13601     assert$6.strictEqual(currentCommentPrecedingNode, precedingNode);
13602     assert$6.strictEqual(currentCommentFollowingNode, followingNode);
13603     const gap = text.slice(options.locEnd(comment), gapEndPos);
13604
13605     if (gapRegExp.test(gap)) {
13606       gapEndPos = options.locStart(comment);
13607     } else {
13608       // The gap string contained something other than whitespace or open
13609       // parentheses.
13610       break;
13611     }
13612   }
13613
13614   for (const [i, {
13615     comment
13616   }] of tiesToBreak.entries()) {
13617     if (i < indexOfFirstLeadingComment) {
13618       addTrailingComment$2(precedingNode, comment);
13619     } else {
13620       addLeadingComment$2(followingNode, comment);
13621     }
13622   }
13623
13624   for (const node of [precedingNode, followingNode]) {
13625     if (node.comments && node.comments.length > 1) {
13626       node.comments.sort((a, b) => options.locStart(a) - options.locStart(b));
13627     }
13628   }
13629
13630   tiesToBreak.length = 0;
13631 }
13632
13633 function printComment$3(path, options) {
13634   const comment = path.getValue();
13635   comment.printed = true;
13636   return options.printer.printComment(path, options);
13637 }
13638
13639 function findExpressionIndexForComment(quasis, comment, options) {
13640   const startPos = options.locStart(comment) - 1;
13641
13642   for (let i = 1; i < quasis.length; ++i) {
13643     if (startPos < options.locStart(quasis[i])) {
13644       return i - 1;
13645     }
13646   } // We haven't found it, it probably means that some of the locations are off.
13647   // Let's just return the first one.
13648
13649   /* istanbul ignore next */
13650
13651
13652   return 0;
13653 }
13654
13655 function printLeadingComment(path, options) {
13656   const comment = path.getValue();
13657   const parts = [printComment$3(path, options)];
13658   const {
13659     printer,
13660     originalText,
13661     locStart,
13662     locEnd
13663   } = options;
13664   const isBlock = printer.isBlockComment && printer.isBlockComment(comment); // Leading block comments should see if they need to stay on the
13665   // same line or not.
13666
13667   if (isBlock) {
13668     const lineBreak = hasNewline$9(originalText, locEnd(comment)) ? hasNewline$9(originalText, locStart(comment), {
13669       backwards: true
13670     }) ? hardline$C : line$A : " ";
13671     parts.push(lineBreak);
13672   } else {
13673     parts.push(hardline$C);
13674   }
13675
13676   const index = skipNewline$1(originalText, skipSpaces$1(originalText, locEnd(comment)));
13677
13678   if (index !== false && hasNewline$9(originalText, index)) {
13679     parts.push(hardline$C);
13680   }
13681
13682   return parts;
13683 }
13684
13685 function printTrailingComment(path, options) {
13686   const comment = path.getValue();
13687   const printed = printComment$3(path, options);
13688   const {
13689     printer,
13690     originalText,
13691     locStart
13692   } = options;
13693   const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
13694
13695   if (hasNewline$9(originalText, locStart(comment), {
13696     backwards: true
13697   })) {
13698     // This allows comments at the end of nested structures:
13699     // {
13700     //   x: 1,
13701     //   y: 2
13702     //   // A comment
13703     // }
13704     // Those kinds of comments are almost always leading comments, but
13705     // here it doesn't go "outside" the block and turns it into a
13706     // trailing comment for `2`. We can simulate the above by checking
13707     // if this a comment on its own line; normal trailing comments are
13708     // always at the end of another expression.
13709     const isLineBeforeEmpty = isPreviousLineEmpty$2(originalText, comment, locStart);
13710     return lineSuffix$1([hardline$C, isLineBeforeEmpty ? hardline$C : "", printed]);
13711   }
13712
13713   let parts = [" ", printed]; // Trailing block comments never need a newline
13714
13715   if (!isBlock) {
13716     parts = [lineSuffix$1(parts), breakParent$a];
13717   }
13718
13719   return parts;
13720 }
13721
13722 function printDanglingComments$e(path, options, sameIndent, filter) {
13723   const parts = [];
13724   const node = path.getValue();
13725
13726   if (!node || !node.comments) {
13727     return "";
13728   }
13729
13730   path.each(() => {
13731     const comment = path.getValue();
13732
13733     if (!comment.leading && !comment.trailing && (!filter || filter(comment))) {
13734       parts.push(printComment$3(path, options));
13735     }
13736   }, "comments");
13737
13738   if (parts.length === 0) {
13739     return "";
13740   }
13741
13742   if (sameIndent) {
13743     return join$v(hardline$C, parts);
13744   }
13745
13746   return indent$z([hardline$C, join$v(hardline$C, parts)]);
13747 }
13748
13749 function printCommentsSeparately$1(path, options, ignored) {
13750   const value = path.getValue();
13751
13752   if (!value) {
13753     return {};
13754   }
13755
13756   let comments = value.comments || [];
13757
13758   if (ignored) {
13759     comments = comments.filter(comment => !ignored.has(comment));
13760   }
13761
13762   const isCursorNode = value === options.cursorNode;
13763
13764   if (comments.length === 0) {
13765     const maybeCursor = isCursorNode ? cursor : "";
13766     return {
13767       leading: maybeCursor,
13768       trailing: maybeCursor
13769     };
13770   }
13771
13772   const leadingParts = [];
13773   const trailingParts = [];
13774   path.each(() => {
13775     const comment = path.getValue();
13776
13777     if (ignored && ignored.has(comment)) {
13778       return;
13779     }
13780
13781     const {
13782       leading,
13783       trailing
13784     } = comment;
13785
13786     if (leading) {
13787       leadingParts.push(printLeadingComment(path, options));
13788     } else if (trailing) {
13789       trailingParts.push(printTrailingComment(path, options));
13790     }
13791   }, "comments");
13792
13793   if (isCursorNode) {
13794     leadingParts.unshift(cursor);
13795     trailingParts.push(cursor);
13796   }
13797
13798   return {
13799     leading: leadingParts,
13800     trailing: trailingParts
13801   };
13802 }
13803
13804 function printComments$7(path, doc, options, ignored) {
13805   const {
13806     leading,
13807     trailing
13808   } = printCommentsSeparately$1(path, options, ignored);
13809
13810   if (!leading && !trailing) {
13811     return doc;
13812   }
13813
13814   return [leading, doc, trailing];
13815 }
13816
13817 function ensureAllCommentsPrinted(astComments) {
13818   if (!astComments) {
13819     return;
13820   }
13821
13822   for (const comment of astComments) {
13823     if (!comment.printed) {
13824       throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
13825     }
13826
13827     delete comment.printed;
13828   }
13829 }
13830
13831 var comments$4 = {
13832   attach,
13833   printComments: printComments$7,
13834   printCommentsSeparately: printCommentsSeparately$1,
13835   printDanglingComments: printDanglingComments$e,
13836   getSortedChildNodes,
13837   ensureAllCommentsPrinted
13838 };
13839
13840 const getLast$m = getLast_1;
13841
13842 function getNodeHelper(path, count) {
13843   const stackIndex = getNodeStackIndexHelper(path.stack, count);
13844   return stackIndex === -1 ? null : path.stack[stackIndex];
13845 }
13846
13847 function getNodeStackIndexHelper(stack, count) {
13848   for (let i = stack.length - 1; i >= 0; i -= 2) {
13849     const value = stack[i];
13850
13851     if (value && !Array.isArray(value) && --count < 0) {
13852       return i;
13853     }
13854   }
13855
13856   return -1;
13857 }
13858
13859 class AstPath$1 {
13860   constructor(value) {
13861     this.stack = [value];
13862   } // The name of the current property is always the penultimate element of
13863   // this.stack, and always a String.
13864
13865
13866   getName() {
13867     const {
13868       stack
13869     } = this;
13870     const {
13871       length
13872     } = stack;
13873
13874     if (length > 1) {
13875       return stack[length - 2];
13876     } // Since the name is always a string, null is a safe sentinel value to
13877     // return if we do not know the name of the (root) value.
13878
13879     /* istanbul ignore next */
13880
13881
13882     return null;
13883   } // The value of the current property is always the final element of
13884   // this.stack.
13885
13886
13887   getValue() {
13888     return getLast$m(this.stack);
13889   }
13890
13891   getNode(count = 0) {
13892     return getNodeHelper(this, count);
13893   }
13894
13895   getParentNode(count = 0) {
13896     return getNodeHelper(this, count + 1);
13897   } // Temporarily push properties named by string arguments given after the
13898   // callback function onto this.stack, then call the callback with a
13899   // reference to this (modified) AstPath object. Note that the stack will
13900   // be restored to its original state after the callback is finished, so it
13901   // is probably a mistake to retain a reference to the path.
13902
13903
13904   call(callback, ...names) {
13905     const {
13906       stack
13907     } = this;
13908     const {
13909       length
13910     } = stack;
13911     let value = getLast$m(stack);
13912
13913     for (const name of names) {
13914       value = value[name];
13915       stack.push(name, value);
13916     }
13917
13918     const result = callback(this);
13919     stack.length = length;
13920     return result;
13921   }
13922
13923   callParent(callback, count = 0) {
13924     const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
13925     const parentValues = this.stack.splice(stackIndex + 1);
13926     const result = callback(this);
13927     this.stack.push(...parentValues);
13928     return result;
13929   } // Similar to AstPath.prototype.call, except that the value obtained by
13930   // accessing this.getValue()[name1][name2]... should be array. The
13931   // callback will be called with a reference to this path object for each
13932   // element of the array.
13933
13934
13935   each(callback, ...names) {
13936     const {
13937       stack
13938     } = this;
13939     const {
13940       length
13941     } = stack;
13942     let value = getLast$m(stack);
13943
13944     for (const name of names) {
13945       value = value[name];
13946       stack.push(name, value);
13947     }
13948
13949     for (let i = 0; i < value.length; ++i) {
13950       stack.push(i, value[i]);
13951       callback(this, i, value);
13952       stack.length -= 2;
13953     }
13954
13955     stack.length = length;
13956   } // Similar to AstPath.prototype.each, except that the results of the
13957   // callback function invocations are stored in an array and returned at
13958   // the end of the iteration.
13959
13960
13961   map(callback, ...names) {
13962     const result = [];
13963     this.each((path, index, value) => {
13964       result[index] = callback(path, index, value);
13965     }, ...names);
13966     return result;
13967   }
13968   /**
13969    * @param {() => void} callback
13970    * @internal Unstable API. Don't use in plugins for now.
13971    */
13972
13973
13974   try(callback) {
13975     const {
13976       stack
13977     } = this;
13978     const stackBackup = [...stack];
13979
13980     try {
13981       return callback();
13982     } finally {
13983       stack.length = 0;
13984       stack.push(...stackBackup);
13985     }
13986   }
13987   /**
13988    * @param {...(
13989    *   | ((node: any, name: string | null, number: number | null) => boolean)
13990    *   | undefined
13991    * )} predicates
13992    */
13993
13994
13995   match(...predicates) {
13996     let stackPointer = this.stack.length - 1;
13997     let name = null;
13998     let node = this.stack[stackPointer--];
13999
14000     for (const predicate of predicates) {
14001       /* istanbul ignore next */
14002       if (node === undefined) {
14003         return false;
14004       } // skip index/array
14005
14006
14007       let number = null;
14008
14009       if (typeof name === "number") {
14010         number = name;
14011         name = this.stack[stackPointer--];
14012         node = this.stack[stackPointer--];
14013       }
14014
14015       if (predicate && !predicate(node, name, number)) {
14016         return false;
14017       }
14018
14019       name = this.stack[stackPointer--];
14020       node = this.stack[stackPointer--];
14021     }
14022
14023     return true;
14024   }
14025   /**
14026    * Traverses the ancestors of the current node heading toward the tree root
14027    * until it finds a node that matches the provided predicate function. Will
14028    * return the first matching ancestor. If no such node exists, returns undefined.
14029    * @param {(node: any, name: string, number: number | null) => boolean} predicate
14030    * @internal Unstable API. Don't use in plugins for now.
14031    */
14032
14033
14034   findAncestor(predicate) {
14035     let stackPointer = this.stack.length - 1;
14036     let name = null;
14037     let node = this.stack[stackPointer--];
14038
14039     while (node) {
14040       // skip index/array
14041       let number = null;
14042
14043       if (typeof name === "number") {
14044         number = name;
14045         name = this.stack[stackPointer--];
14046         node = this.stack[stackPointer--];
14047       }
14048
14049       if (name !== null && predicate(node, name, number)) {
14050         return node;
14051       }
14052
14053       name = this.stack[stackPointer--];
14054       node = this.stack[stackPointer--];
14055     }
14056   }
14057
14058 }
14059
14060 var astPath = AstPath$1;
14061
14062 const {
14063   utils: {
14064     stripTrailingHardline
14065   }
14066 } = require$$7$3;
14067 const {
14068   normalize
14069 } = options$d;
14070 const comments$3 = comments$4;
14071
14072 function printSubtree(path, print, options, printAstToDoc) {
14073   if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
14074     return options.printer.embed(path, print, (text, partialNextOptions, textToDocOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc, textToDocOptions), options);
14075   }
14076 }
14077
14078 function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc, // TODO: remove `stripTrailingHardline` in v3.0.0
14079 {
14080   stripTrailingHardline: shouldStripTrailingHardline = false
14081 } = {}) {
14082   const nextOptions = normalize(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
14083     parentParser: parentOptions.parser,
14084     originalText: text
14085   }), {
14086     passThrough: true
14087   });
14088   const result = parser$2.parse(text, nextOptions);
14089   const {
14090     ast
14091   } = result;
14092   text = result.text;
14093   const astComments = ast.comments;
14094   delete ast.comments;
14095   comments$3.attach(astComments, ast, text, nextOptions);
14096   nextOptions[Symbol.for("comments")] = astComments || [];
14097   nextOptions[Symbol.for("tokens")] = ast.tokens || [];
14098   const doc = printAstToDoc(ast, nextOptions);
14099   comments$3.ensureAllCommentsPrinted(astComments);
14100
14101   if (shouldStripTrailingHardline) {
14102     // TODO: move this to `stripTrailingHardline` function in `/src/document/doc-utils.js`
14103     if (typeof doc === "string") {
14104       return doc.replace(/(?:\r?\n)*$/, "");
14105     }
14106
14107     return stripTrailingHardline(doc);
14108   }
14109   /* istanbul ignore next */
14110
14111
14112   return doc;
14113 }
14114
14115 var multiparser$1 = {
14116   printSubtree
14117 };
14118
14119 const AstPath = astPath;
14120 const {
14121   builders: {
14122     hardline: hardline$B,
14123     addAlignmentToDoc: addAlignmentToDoc$1
14124   },
14125   utils: {
14126     propagateBreaks
14127   }
14128 } = require$$7$3;
14129 const {
14130   printComments: printComments$6
14131 } = comments$4;
14132 const multiparser = multiparser$1;
14133 /**
14134  * Takes an abstract syntax tree (AST) and recursively converts it to a
14135  * document (series of printing primitives).
14136  *
14137  * This is done by descending down the AST recursively. The recursion
14138  * involves two functions that call each other:
14139  *
14140  * 1. mainPrint(), which is defined as an inner function here.
14141  *    It basically takes care of node caching.
14142  * 2. callPluginPrintFunction(), which checks for some options, and
14143  *    ultimately calls the print() function provided by the plugin.
14144  *
14145  * The plugin function will call mainPrint() again for child nodes
14146  * of the current node. mainPrint() will do its housekeeping, then call
14147  * the plugin function again, and so on.
14148  *
14149  * All the while, these functions pass a "path" variable around, which
14150  * is a stack-like data structure (AstPath) that maintains the current
14151  * state of the recursion. It is called "path", because it represents
14152  * the path to the current node through the Abstract Syntax Tree.
14153  */
14154
14155 function printAstToDoc$1(ast, options, alignmentSize = 0) {
14156   const {
14157     printer
14158   } = options;
14159
14160   if (printer.preprocess) {
14161     ast = printer.preprocess(ast, options);
14162   }
14163
14164   const cache = new Map();
14165   const path = new AstPath(ast);
14166   let doc = mainPrint();
14167
14168   if (alignmentSize > 0) {
14169     // Add a hardline to make the indents take effect
14170     // It should be removed in index.js format()
14171     doc = addAlignmentToDoc$1([hardline$B, doc], alignmentSize, options.tabWidth);
14172   }
14173
14174   propagateBreaks(doc);
14175   return doc;
14176
14177   function mainPrint(selector, args) {
14178     if (selector === undefined || selector === path) {
14179       return mainPrintInternal(args);
14180     }
14181
14182     if (Array.isArray(selector)) {
14183       return path.call(() => mainPrintInternal(args), ...selector);
14184     }
14185
14186     return path.call(() => mainPrintInternal(args), selector);
14187   }
14188
14189   function mainPrintInternal(args) {
14190     const value = path.getValue();
14191     const shouldCache = value && typeof value === "object" && args === undefined;
14192
14193     if (shouldCache && cache.has(value)) {
14194       return cache.get(value);
14195     }
14196
14197     const doc = callPluginPrintFunction(path, options, mainPrint, args);
14198
14199     if (shouldCache) {
14200       cache.set(value, doc);
14201     }
14202
14203     return doc;
14204   }
14205 }
14206
14207 function printPrettierIgnoredNode(node, options) {
14208   const {
14209     originalText,
14210     [Symbol.for("comments")]: comments,
14211     locStart,
14212     locEnd
14213   } = options;
14214   const start = locStart(node);
14215   const end = locEnd(node);
14216   const printedComments = new Set();
14217
14218   for (const comment of comments) {
14219     if (locStart(comment) >= start && locEnd(comment) <= end) {
14220       comment.printed = true;
14221       printedComments.add(comment);
14222     }
14223   }
14224
14225   return {
14226     doc: originalText.slice(start, end),
14227     printedComments
14228   };
14229 }
14230
14231 function callPluginPrintFunction(path, options, printPath, args) {
14232   const node = path.getValue();
14233   const {
14234     printer
14235   } = options;
14236   let doc;
14237   let printedComments; // Escape hatch
14238
14239   if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
14240     ({
14241       doc,
14242       printedComments
14243     } = printPrettierIgnoredNode(node, options));
14244   } else {
14245     if (node) {
14246       try {
14247         // Potentially switch to a different parser
14248         doc = multiparser.printSubtree(path, printPath, options, printAstToDoc$1);
14249       } catch (error) {
14250         /* istanbul ignore if */
14251         if (process.env.PRETTIER_DEBUG) {
14252           throw error;
14253         } // Continue with current parser
14254
14255       }
14256     }
14257
14258     if (!doc) {
14259       doc = printer.print(path, options, printPath, args);
14260     }
14261   } // We let JSXElement print its comments itself because it adds () around
14262   // UnionTypeAnnotation has to align the child without the comments
14263
14264
14265   if (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path, options)) {
14266     // printComments will call the plugin print function and check for
14267     // comments to print
14268     doc = printComments$6(path, doc, options, printedComments);
14269   }
14270
14271   return doc;
14272 }
14273
14274 var astToDoc = printAstToDoc$1;
14275
14276 const assert$5 = require$$0__default$3["default"];
14277 const comments$2 = comments$4;
14278
14279 const isJsonParser = ({
14280   parser
14281 }) => parser === "json" || parser === "json5" || parser === "json-stringify";
14282
14283 function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
14284   const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
14285   const endNodeAndAncestors = new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
14286   return startNodeAndAncestors.find(node => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
14287 }
14288
14289 function dropRootParents(parents) {
14290   let lastParentIndex = parents.length - 1;
14291
14292   for (;;) {
14293     const parent = parents[lastParentIndex];
14294
14295     if (parent && (parent.type === "Program" || parent.type === "File")) {
14296       lastParentIndex--;
14297     } else {
14298       break;
14299     }
14300   }
14301
14302   return parents.slice(0, lastParentIndex + 1);
14303 }
14304
14305 function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
14306   locStart,
14307   locEnd
14308 }) {
14309   let resultStartNode = startNodeAndParents.node;
14310   let resultEndNode = endNodeAndParents.node;
14311
14312   if (resultStartNode === resultEndNode) {
14313     return {
14314       startNode: resultStartNode,
14315       endNode: resultEndNode
14316     };
14317   }
14318
14319   const startNodeStart = locStart(startNodeAndParents.node);
14320
14321   for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) {
14322     if (locStart(endParent) >= startNodeStart) {
14323       resultEndNode = endParent;
14324     } else {
14325       break;
14326     }
14327   }
14328
14329   const endNodeEnd = locEnd(endNodeAndParents.node);
14330
14331   for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) {
14332     if (locEnd(startParent) <= endNodeEnd) {
14333       resultStartNode = startParent;
14334     } else {
14335       break;
14336     }
14337   }
14338
14339   return {
14340     startNode: resultStartNode,
14341     endNode: resultEndNode
14342   };
14343 }
14344
14345 function findNodeAtOffset(node, offset, options, predicate, parentNodes = [], type) {
14346   const {
14347     locStart,
14348     locEnd
14349   } = options;
14350   const start = locStart(node);
14351   const end = locEnd(node);
14352
14353   if (offset > end || offset < start || type === "rangeEnd" && offset === start || type === "rangeStart" && offset === end) {
14354     return;
14355   }
14356
14357   for (const childNode of comments$2.getSortedChildNodes(node, options)) {
14358     const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node, ...parentNodes], type);
14359
14360     if (childResult) {
14361       return childResult;
14362     }
14363   }
14364
14365   if (!predicate || predicate(node, parentNodes[0])) {
14366     return {
14367       node,
14368       parentNodes
14369     };
14370   }
14371 } // See https://www.ecma-international.org/ecma-262/5.1/#sec-A.5
14372
14373
14374 function isJsSourceElement(type, parentType) {
14375   return parentType !== "DeclareExportDeclaration" && type !== "TypeParameterDeclaration" && (type === "Directive" || type === "TypeAlias" || type === "TSExportAssignment" || type.startsWith("Declare") || type.startsWith("TSDeclare") || type.endsWith("Statement") || type.endsWith("Declaration"));
14376 }
14377
14378 const jsonSourceElements = new Set(["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
14379 const graphqlSourceElements = new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
14380
14381 function isSourceElement(opts, node, parentNode) {
14382   /* istanbul ignore next */
14383   if (!node) {
14384     return false;
14385   }
14386
14387   switch (opts.parser) {
14388     case "flow":
14389     case "babel":
14390     case "babel-flow":
14391     case "babel-ts":
14392     case "typescript":
14393     case "espree":
14394     case "meriyah":
14395     case "__babel_estree":
14396       return isJsSourceElement(node.type, parentNode && parentNode.type);
14397
14398     case "json":
14399     case "json5":
14400     case "json-stringify":
14401       return jsonSourceElements.has(node.type);
14402
14403     case "graphql":
14404       return graphqlSourceElements.has(node.kind);
14405
14406     case "vue":
14407       return node.tag !== "root";
14408   }
14409
14410   return false;
14411 }
14412
14413 function calculateRange(text, opts, ast) {
14414   let {
14415     rangeStart: start,
14416     rangeEnd: end,
14417     locStart,
14418     locEnd
14419   } = opts;
14420   assert$5.ok(end > start); // Contract the range so that it has non-whitespace characters at its endpoints.
14421   // This ensures we can format a range that doesn't end on a node.
14422
14423   const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/);
14424   const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
14425
14426   if (!isAllWhitespace) {
14427     start += firstNonWhitespaceCharacterIndex;
14428
14429     for (; end > start; --end) {
14430       if (/\S/.test(text[end - 1])) {
14431         break;
14432       }
14433     }
14434   }
14435
14436   const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
14437   const endNodeAndParents = // No need find Node at `end`, it will be the same as `startNodeAndParents`
14438   isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, node => isSourceElement(opts, node), [], "rangeEnd");
14439
14440   if (!startNodeAndParents || !endNodeAndParents) {
14441     return {
14442       rangeStart: 0,
14443       rangeEnd: 0
14444     };
14445   }
14446
14447   let startNode;
14448   let endNode;
14449
14450   if (isJsonParser(opts)) {
14451     const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
14452     startNode = commonAncestor;
14453     endNode = commonAncestor;
14454   } else {
14455     ({
14456       startNode,
14457       endNode
14458     } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
14459   }
14460
14461   return {
14462     rangeStart: Math.min(locStart(startNode), locStart(endNode)),
14463     rangeEnd: Math.max(locEnd(startNode), locEnd(endNode))
14464   };
14465 }
14466
14467 var rangeUtil$1 = {
14468   calculateRange,
14469   findNodeAtOffset
14470 };
14471
14472 const diff = lib$6;
14473 const {
14474   printer: {
14475     printDocToString: printDocToString$2
14476   },
14477   debug: {
14478     printDocToDebug
14479   }
14480 } = require$$7$3;
14481 const {
14482   getAlignmentSize: getAlignmentSize$1
14483 } = util$8;
14484 const {
14485   guessEndOfLine,
14486   convertEndOfLineToChars,
14487   countEndOfLineChars,
14488   normalizeEndOfLine: normalizeEndOfLine$1
14489 } = endOfLine;
14490 const normalizeOptions$4 = options$d.normalize;
14491 const massageAST = massageAst;
14492 const comments$1 = comments$4;
14493 const parser$1 = parser$2;
14494 const printAstToDoc = astToDoc;
14495 const rangeUtil = rangeUtil$1;
14496 const BOM = "\uFEFF";
14497 const CURSOR = Symbol("cursor");
14498
14499 function attachComments(text, ast, opts) {
14500   const astComments = ast.comments;
14501
14502   if (astComments) {
14503     delete ast.comments;
14504     comments$1.attach(astComments, ast, text, opts);
14505   }
14506
14507   opts[Symbol.for("comments")] = astComments || [];
14508   opts[Symbol.for("tokens")] = ast.tokens || [];
14509   opts.originalText = text;
14510   return astComments;
14511 }
14512
14513 function coreFormat(originalText, opts, addAlignmentSize = 0) {
14514   if (!originalText || originalText.trim().length === 0) {
14515     return {
14516       formatted: "",
14517       cursorOffset: -1,
14518       comments: []
14519     };
14520   }
14521
14522   const {
14523     ast,
14524     text
14525   } = parser$1.parse(originalText, opts);
14526
14527   if (opts.cursorOffset >= 0) {
14528     const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
14529
14530     if (nodeResult && nodeResult.node) {
14531       opts.cursorNode = nodeResult.node;
14532     }
14533   }
14534
14535   const astComments = attachComments(text, ast, opts);
14536   const doc = printAstToDoc(ast, opts, addAlignmentSize);
14537   const result = printDocToString$2(doc, opts);
14538   comments$1.ensureAllCommentsPrinted(astComments); // Remove extra leading indentation as well as the added indentation after last newline
14539
14540   if (addAlignmentSize > 0) {
14541     const trimmed = result.formatted.trim();
14542
14543     if (result.cursorNodeStart !== undefined) {
14544       result.cursorNodeStart -= result.formatted.indexOf(trimmed);
14545     }
14546
14547     result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine);
14548   }
14549
14550   if (opts.cursorOffset >= 0) {
14551     let oldCursorNodeStart;
14552     let oldCursorNodeText;
14553     let cursorOffsetRelativeToOldCursorNode;
14554     let newCursorNodeStart;
14555     let newCursorNodeText;
14556
14557     if (opts.cursorNode && result.cursorNodeText) {
14558       oldCursorNodeStart = opts.locStart(opts.cursorNode);
14559       oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
14560       cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
14561       newCursorNodeStart = result.cursorNodeStart;
14562       newCursorNodeText = result.cursorNodeText;
14563     } else {
14564       oldCursorNodeStart = 0;
14565       oldCursorNodeText = text;
14566       cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
14567       newCursorNodeStart = 0;
14568       newCursorNodeText = result.formatted;
14569     }
14570
14571     if (oldCursorNodeText === newCursorNodeText) {
14572       return {
14573         formatted: result.formatted,
14574         cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
14575         comments: astComments
14576       };
14577     } // diff old and new cursor node texts, with a special cursor
14578     // symbol inserted to find out where it moves to
14579
14580
14581     const oldCursorNodeCharArray = [...oldCursorNodeText];
14582     oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
14583     const newCursorNodeCharArray = [...newCursorNodeText];
14584     const cursorNodeDiff = diff.diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
14585     let cursorOffset = newCursorNodeStart;
14586
14587     for (const entry of cursorNodeDiff) {
14588       if (entry.removed) {
14589         if (entry.value.includes(CURSOR)) {
14590           break;
14591         }
14592       } else {
14593         cursorOffset += entry.count;
14594       }
14595     }
14596
14597     return {
14598       formatted: result.formatted,
14599       cursorOffset,
14600       comments: astComments
14601     };
14602   }
14603
14604   return {
14605     formatted: result.formatted,
14606     cursorOffset: -1,
14607     comments: astComments
14608   };
14609 }
14610
14611 function formatRange(originalText, opts) {
14612   const {
14613     ast,
14614     text
14615   } = parser$1.parse(originalText, opts);
14616   const {
14617     rangeStart,
14618     rangeEnd
14619   } = rangeUtil.calculateRange(text, opts, ast);
14620   const rangeString = text.slice(rangeStart, rangeEnd); // Try to extend the range backwards to the beginning of the line.
14621   // This is so we can detect indentation correctly and restore it.
14622   // Use `Math.min` since `lastIndexOf` returns 0 when `rangeStart` is 0
14623
14624   const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
14625   const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
14626   const alignmentSize = getAlignmentSize$1(indentString, opts.tabWidth);
14627   const rangeResult = coreFormat(rangeString, Object.assign(Object.assign({}, opts), {}, {
14628     rangeStart: 0,
14629     rangeEnd: Number.POSITIVE_INFINITY,
14630     // Track the cursor offset only if it's within our range
14631     cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1,
14632     // Always use `lf` to format, we'll replace it later
14633     endOfLine: "lf"
14634   }), alignmentSize); // Since the range contracts to avoid trailing whitespace,
14635   // we need to remove the newline that was inserted by the `format` call.
14636
14637   const rangeTrimmed = rangeResult.formatted.trimEnd();
14638   let {
14639     cursorOffset
14640   } = opts;
14641
14642   if (cursorOffset > rangeEnd) {
14643     // handle the case where the cursor was past the end of the range
14644     cursorOffset += rangeTrimmed.length - rangeString.length;
14645   } else if (rangeResult.cursorOffset >= 0) {
14646     // handle the case where the cursor was in the range
14647     cursorOffset = rangeResult.cursorOffset + rangeStart;
14648   } // keep the cursor as it was if it was before the start of the range
14649
14650
14651   let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
14652
14653   if (opts.endOfLine !== "lf") {
14654     const eol = convertEndOfLineToChars(opts.endOfLine);
14655
14656     if (cursorOffset >= 0 && eol === "\r\n") {
14657       cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n");
14658     }
14659
14660     formatted = formatted.replace(/\n/g, eol);
14661   }
14662
14663   return {
14664     formatted,
14665     cursorOffset,
14666     comments: rangeResult.comments
14667   };
14668 }
14669
14670 function ensureIndexInText(text, index, defaultValue) {
14671   if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) {
14672     return defaultValue;
14673   }
14674
14675   return index;
14676 }
14677
14678 function normalizeIndexes(text, options) {
14679   let {
14680     cursorOffset,
14681     rangeStart,
14682     rangeEnd
14683   } = options;
14684   cursorOffset = ensureIndexInText(text, cursorOffset, -1);
14685   rangeStart = ensureIndexInText(text, rangeStart, 0);
14686   rangeEnd = ensureIndexInText(text, rangeEnd, text.length);
14687   return Object.assign(Object.assign({}, options), {}, {
14688     cursorOffset,
14689     rangeStart,
14690     rangeEnd
14691   });
14692 }
14693
14694 function normalizeInputAndOptions(text, options) {
14695   let {
14696     cursorOffset,
14697     rangeStart,
14698     rangeEnd,
14699     endOfLine
14700   } = normalizeIndexes(text, options);
14701   const hasBOM = text.charAt(0) === BOM;
14702
14703   if (hasBOM) {
14704     text = text.slice(1);
14705     cursorOffset--;
14706     rangeStart--;
14707     rangeEnd--;
14708   }
14709
14710   if (endOfLine === "auto") {
14711     endOfLine = guessEndOfLine(text);
14712   } // get rid of CR/CRLF parsing
14713
14714
14715   if (text.includes("\r")) {
14716     const countCrlfBefore = index => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n");
14717
14718     cursorOffset -= countCrlfBefore(cursorOffset);
14719     rangeStart -= countCrlfBefore(rangeStart);
14720     rangeEnd -= countCrlfBefore(rangeEnd);
14721     text = normalizeEndOfLine$1(text);
14722   }
14723
14724   return {
14725     hasBOM,
14726     text,
14727     options: normalizeIndexes(text, Object.assign(Object.assign({}, options), {}, {
14728       cursorOffset,
14729       rangeStart,
14730       rangeEnd,
14731       endOfLine
14732     }))
14733   };
14734 }
14735
14736 function hasPragma$5(text, options) {
14737   const selectedParser = parser$1.resolveParser(options);
14738   return !selectedParser.hasPragma || selectedParser.hasPragma(text);
14739 }
14740
14741 function formatWithCursor$1(originalText, originalOptions) {
14742   let {
14743     hasBOM,
14744     text,
14745     options
14746   } = normalizeInputAndOptions(originalText, normalizeOptions$4(originalOptions));
14747
14748   if (options.rangeStart >= options.rangeEnd && text !== "" || options.requirePragma && !hasPragma$5(text, options)) {
14749     return {
14750       formatted: originalText,
14751       cursorOffset: originalOptions.cursorOffset,
14752       comments: []
14753     };
14754   }
14755
14756   let result;
14757
14758   if (options.rangeStart > 0 || options.rangeEnd < text.length) {
14759     result = formatRange(text, options);
14760   } else {
14761     if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma$5(text, options)) {
14762       text = options.printer.insertPragma(text);
14763     }
14764
14765     result = coreFormat(text, options);
14766   }
14767
14768   if (hasBOM) {
14769     result.formatted = BOM + result.formatted;
14770
14771     if (result.cursorOffset >= 0) {
14772       result.cursorOffset++;
14773     }
14774   }
14775
14776   return result;
14777 }
14778
14779 var core$2 = {
14780   formatWithCursor: formatWithCursor$1,
14781
14782   parse(originalText, originalOptions, massage) {
14783     const {
14784       text,
14785       options
14786     } = normalizeInputAndOptions(originalText, normalizeOptions$4(originalOptions));
14787     const parsed = parser$1.parse(text, options);
14788
14789     if (massage) {
14790       parsed.ast = massageAST(parsed.ast, options);
14791     }
14792
14793     return parsed;
14794   },
14795
14796   formatAST(ast, options) {
14797     options = normalizeOptions$4(options);
14798     const doc = printAstToDoc(ast, options);
14799     return printDocToString$2(doc, options);
14800   },
14801
14802   // Doesn't handle shebang for now
14803   formatDoc(doc, options) {
14804     return formatWithCursor$1(printDocToDebug(doc), Object.assign(Object.assign({}, options), {}, {
14805       parser: "__js_expression"
14806     })).formatted;
14807   },
14808
14809   printToDoc(originalText, options) {
14810     options = normalizeOptions$4(options);
14811     const {
14812       ast,
14813       text
14814     } = parser$1.parse(originalText, options);
14815     attachComments(text, ast, options);
14816     return printAstToDoc(ast, options);
14817   },
14818
14819   printDocToString(doc, options) {
14820     return printDocToString$2(doc, normalizeOptions$4(options));
14821   }
14822
14823 };
14824
14825 var concatMap$1 = function (xs, fn) {
14826   var res = [];
14827
14828   for (var i = 0; i < xs.length; i++) {
14829     var x = fn(xs[i], i);
14830     if (isArray$a(x)) res.push.apply(res, x);else res.push(x);
14831   }
14832
14833   return res;
14834 };
14835
14836 var isArray$a = Array.isArray || function (xs) {
14837   return Object.prototype.toString.call(xs) === '[object Array]';
14838 };
14839
14840 var balancedMatch = balanced$1;
14841
14842 function balanced$1(a, b, str) {
14843   if (a instanceof RegExp) a = maybeMatch(a, str);
14844   if (b instanceof RegExp) b = maybeMatch(b, str);
14845   var r = range(a, b, str);
14846   return r && {
14847     start: r[0],
14848     end: r[1],
14849     pre: str.slice(0, r[0]),
14850     body: str.slice(r[0] + a.length, r[1]),
14851     post: str.slice(r[1] + b.length)
14852   };
14853 }
14854
14855 function maybeMatch(reg, str) {
14856   var m = str.match(reg);
14857   return m ? m[0] : null;
14858 }
14859
14860 balanced$1.range = range;
14861
14862 function range(a, b, str) {
14863   var begs, beg, left, right, result;
14864   var ai = str.indexOf(a);
14865   var bi = str.indexOf(b, ai + 1);
14866   var i = ai;
14867
14868   if (ai >= 0 && bi > 0) {
14869     if (a === b) {
14870       return [ai, bi];
14871     }
14872
14873     begs = [];
14874     left = str.length;
14875
14876     while (i >= 0 && !result) {
14877       if (i == ai) {
14878         begs.push(i);
14879         ai = str.indexOf(a, i + 1);
14880       } else if (begs.length == 1) {
14881         result = [begs.pop(), bi];
14882       } else {
14883         beg = begs.pop();
14884
14885         if (beg < left) {
14886           left = beg;
14887           right = bi;
14888         }
14889
14890         bi = str.indexOf(b, i + 1);
14891       }
14892
14893       i = ai < bi && ai >= 0 ? ai : bi;
14894     }
14895
14896     if (begs.length) {
14897       result = [left, right];
14898     }
14899   }
14900
14901   return result;
14902 }
14903
14904 var concatMap = concatMap$1;
14905 var balanced = balancedMatch;
14906 var braceExpansion = expandTop;
14907 var escSlash = '\0SLASH' + Math.random() + '\0';
14908 var escOpen = '\0OPEN' + Math.random() + '\0';
14909 var escClose = '\0CLOSE' + Math.random() + '\0';
14910 var escComma = '\0COMMA' + Math.random() + '\0';
14911 var escPeriod = '\0PERIOD' + Math.random() + '\0';
14912
14913 function numeric(str) {
14914   return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
14915 }
14916
14917 function escapeBraces(str) {
14918   return str.split('\\\\').join(escSlash).split('\\{').join(escOpen).split('\\}').join(escClose).split('\\,').join(escComma).split('\\.').join(escPeriod);
14919 }
14920
14921 function unescapeBraces(str) {
14922   return str.split(escSlash).join('\\').split(escOpen).join('{').split(escClose).join('}').split(escComma).join(',').split(escPeriod).join('.');
14923 } // Basically just str.split(","), but handling cases
14924 // where we have nested braced sections, which should be
14925 // treated as individual members, like {a,{b,c},d}
14926
14927
14928 function parseCommaParts(str) {
14929   if (!str) return [''];
14930   var parts = [];
14931   var m = balanced('{', '}', str);
14932   if (!m) return str.split(',');
14933   var pre = m.pre;
14934   var body = m.body;
14935   var post = m.post;
14936   var p = pre.split(',');
14937   p[p.length - 1] += '{' + body + '}';
14938   var postParts = parseCommaParts(post);
14939
14940   if (post.length) {
14941     p[p.length - 1] += postParts.shift();
14942     p.push.apply(p, postParts);
14943   }
14944
14945   parts.push.apply(parts, p);
14946   return parts;
14947 }
14948
14949 function expandTop(str) {
14950   if (!str) return []; // I don't know why Bash 4.3 does this, but it does.
14951   // Anything starting with {} will have the first two bytes preserved
14952   // but *only* at the top level, so {},a}b will not expand to anything,
14953   // but a{},b}c will be expanded to [a}c,abc].
14954   // One could argue that this is a bug in Bash, but since the goal of
14955   // this module is to match Bash's rules, we escape a leading {}
14956
14957   if (str.substr(0, 2) === '{}') {
14958     str = '\\{\\}' + str.substr(2);
14959   }
14960
14961   return expand$3(escapeBraces(str), true).map(unescapeBraces);
14962 }
14963
14964 function embrace(str) {
14965   return '{' + str + '}';
14966 }
14967
14968 function isPadded(el) {
14969   return /^-?0\d/.test(el);
14970 }
14971
14972 function lte(i, y) {
14973   return i <= y;
14974 }
14975
14976 function gte(i, y) {
14977   return i >= y;
14978 }
14979
14980 function expand$3(str, isTop) {
14981   var expansions = [];
14982   var m = balanced('{', '}', str);
14983   if (!m || /\$$/.test(m.pre)) return [str];
14984   var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
14985   var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
14986   var isSequence = isNumericSequence || isAlphaSequence;
14987   var isOptions = m.body.indexOf(',') >= 0;
14988
14989   if (!isSequence && !isOptions) {
14990     // {a},b}
14991     if (m.post.match(/,.*\}/)) {
14992       str = m.pre + '{' + m.body + escClose + m.post;
14993       return expand$3(str);
14994     }
14995
14996     return [str];
14997   }
14998
14999   var n;
15000
15001   if (isSequence) {
15002     n = m.body.split(/\.\./);
15003   } else {
15004     n = parseCommaParts(m.body);
15005
15006     if (n.length === 1) {
15007       // x{{a,b}}y ==> x{a}y x{b}y
15008       n = expand$3(n[0], false).map(embrace);
15009
15010       if (n.length === 1) {
15011         var post = m.post.length ? expand$3(m.post, false) : [''];
15012         return post.map(function (p) {
15013           return m.pre + n[0] + p;
15014         });
15015       }
15016     }
15017   } // at this point, n is the parts, and we know it's not a comma set
15018   // with a single entry.
15019   // no need to expand pre, since it is guaranteed to be free of brace-sets
15020
15021
15022   var pre = m.pre;
15023   var post = m.post.length ? expand$3(m.post, false) : [''];
15024   var N;
15025
15026   if (isSequence) {
15027     var x = numeric(n[0]);
15028     var y = numeric(n[1]);
15029     var width = Math.max(n[0].length, n[1].length);
15030     var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
15031     var test = lte;
15032     var reverse = y < x;
15033
15034     if (reverse) {
15035       incr *= -1;
15036       test = gte;
15037     }
15038
15039     var pad = n.some(isPadded);
15040     N = [];
15041
15042     for (var i = x; test(i, y); i += incr) {
15043       var c;
15044
15045       if (isAlphaSequence) {
15046         c = String.fromCharCode(i);
15047         if (c === '\\') c = '';
15048       } else {
15049         c = String(i);
15050
15051         if (pad) {
15052           var need = width - c.length;
15053
15054           if (need > 0) {
15055             var z = new Array(need + 1).join('0');
15056             if (i < 0) c = '-' + z + c.slice(1);else c = z + c;
15057           }
15058         }
15059       }
15060
15061       N.push(c);
15062     }
15063   } else {
15064     N = concatMap(n, function (el) {
15065       return expand$3(el, false);
15066     });
15067   }
15068
15069   for (var j = 0; j < N.length; j++) {
15070     for (var k = 0; k < post.length; k++) {
15071       var expansion = pre + N[j] + post[k];
15072       if (!isTop || isSequence || expansion) expansions.push(expansion);
15073     }
15074   }
15075
15076   return expansions;
15077 }
15078
15079 var minimatch_1 = minimatch$1;
15080 minimatch$1.Minimatch = Minimatch;
15081 var path$o = {
15082   sep: '/'
15083 };
15084
15085 try {
15086   path$o = require('path');
15087 } catch (er) {}
15088
15089 var GLOBSTAR$1 = minimatch$1.GLOBSTAR = Minimatch.GLOBSTAR = {};
15090 var expand$2 = braceExpansion;
15091 var plTypes = {
15092   '!': {
15093     open: '(?:(?!(?:',
15094     close: '))[^/]*?)'
15095   },
15096   '?': {
15097     open: '(?:',
15098     close: ')?'
15099   },
15100   '+': {
15101     open: '(?:',
15102     close: ')+'
15103   },
15104   '*': {
15105     open: '(?:',
15106     close: ')*'
15107   },
15108   '@': {
15109     open: '(?:',
15110     close: ')'
15111   }
15112 }; // any single thing other than /
15113 // don't need to escape / when using new RegExp()
15114
15115 var qmark = '[^/]'; // * => any number of characters
15116
15117 var star = qmark + '*?'; // ** when dots are allowed.  Anything goes, except .. and .
15118 // not (^ or / followed by one or two dots followed by $ or /),
15119 // followed by anything, any number of times.
15120
15121 var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'; // not a ^ or / followed by a dot,
15122 // followed by anything, any number of times.
15123
15124 var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'; // characters that need to be escaped in RegExp.
15125
15126 var reSpecials = charSet('().*{}+?[]^$\\!'); // "abc" -> { a:true, b:true, c:true }
15127
15128 function charSet(s) {
15129   return s.split('').reduce(function (set, c) {
15130     set[c] = true;
15131     return set;
15132   }, {});
15133 } // normalizes slashes.
15134
15135
15136 var slashSplit = /\/+/;
15137 minimatch$1.filter = filter;
15138
15139 function filter(pattern, options) {
15140   options = options || {};
15141   return function (p, i, list) {
15142     return minimatch$1(p, pattern, options);
15143   };
15144 }
15145
15146 function ext(a, b) {
15147   a = a || {};
15148   b = b || {};
15149   var t = {};
15150   Object.keys(b).forEach(function (k) {
15151     t[k] = b[k];
15152   });
15153   Object.keys(a).forEach(function (k) {
15154     t[k] = a[k];
15155   });
15156   return t;
15157 }
15158
15159 minimatch$1.defaults = function (def) {
15160   if (!def || !Object.keys(def).length) return minimatch$1;
15161   var orig = minimatch$1;
15162
15163   var m = function minimatch(p, pattern, options) {
15164     return orig.minimatch(p, pattern, ext(def, options));
15165   };
15166
15167   m.Minimatch = function Minimatch(pattern, options) {
15168     return new orig.Minimatch(pattern, ext(def, options));
15169   };
15170
15171   return m;
15172 };
15173
15174 Minimatch.defaults = function (def) {
15175   if (!def || !Object.keys(def).length) return Minimatch;
15176   return minimatch$1.defaults(def).Minimatch;
15177 };
15178
15179 function minimatch$1(p, pattern, options) {
15180   if (typeof pattern !== 'string') {
15181     throw new TypeError('glob pattern string required');
15182   }
15183
15184   if (!options) options = {}; // shortcut: comments match nothing.
15185
15186   if (!options.nocomment && pattern.charAt(0) === '#') {
15187     return false;
15188   } // "" only matches ""
15189
15190
15191   if (pattern.trim() === '') return p === '';
15192   return new Minimatch(pattern, options).match(p);
15193 }
15194
15195 function Minimatch(pattern, options) {
15196   if (!(this instanceof Minimatch)) {
15197     return new Minimatch(pattern, options);
15198   }
15199
15200   if (typeof pattern !== 'string') {
15201     throw new TypeError('glob pattern string required');
15202   }
15203
15204   if (!options) options = {};
15205   pattern = pattern.trim(); // windows support: need to use /, not \
15206
15207   if (path$o.sep !== '/') {
15208     pattern = pattern.split(path$o.sep).join('/');
15209   }
15210
15211   this.options = options;
15212   this.set = [];
15213   this.pattern = pattern;
15214   this.regexp = null;
15215   this.negate = false;
15216   this.comment = false;
15217   this.empty = false; // make the set of regexps etc.
15218
15219   this.make();
15220 }
15221
15222 Minimatch.prototype.debug = function () {};
15223
15224 Minimatch.prototype.make = make;
15225
15226 function make() {
15227   // don't do it more than once.
15228   if (this._made) return;
15229   var pattern = this.pattern;
15230   var options = this.options; // empty patterns and comments match nothing.
15231
15232   if (!options.nocomment && pattern.charAt(0) === '#') {
15233     this.comment = true;
15234     return;
15235   }
15236
15237   if (!pattern) {
15238     this.empty = true;
15239     return;
15240   } // step 1: figure out negation, etc.
15241
15242
15243   this.parseNegate(); // step 2: expand braces
15244
15245   var set = this.globSet = this.braceExpand();
15246   if (options.debug) this.debug = console.error;
15247   this.debug(this.pattern, set); // step 3: now we have a set, so turn each one into a series of path-portion
15248   // matching patterns.
15249   // These will be regexps, except in the case of "**", which is
15250   // set to the GLOBSTAR object for globstar behavior,
15251   // and will not contain any / characters
15252
15253   set = this.globParts = set.map(function (s) {
15254     return s.split(slashSplit);
15255   });
15256   this.debug(this.pattern, set); // glob --> regexps
15257
15258   set = set.map(function (s, si, set) {
15259     return s.map(this.parse, this);
15260   }, this);
15261   this.debug(this.pattern, set); // filter out everything that didn't compile properly.
15262
15263   set = set.filter(function (s) {
15264     return s.indexOf(false) === -1;
15265   });
15266   this.debug(this.pattern, set);
15267   this.set = set;
15268 }
15269
15270 Minimatch.prototype.parseNegate = parseNegate;
15271
15272 function parseNegate() {
15273   var pattern = this.pattern;
15274   var negate = false;
15275   var options = this.options;
15276   var negateOffset = 0;
15277   if (options.nonegate) return;
15278
15279   for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === '!'; i++) {
15280     negate = !negate;
15281     negateOffset++;
15282   }
15283
15284   if (negateOffset) this.pattern = pattern.substr(negateOffset);
15285   this.negate = negate;
15286 } // Brace expansion:
15287 // a{b,c}d -> abd acd
15288 // a{b,}c -> abc ac
15289 // a{0..3}d -> a0d a1d a2d a3d
15290 // a{b,c{d,e}f}g -> abg acdfg acefg
15291 // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
15292 //
15293 // Invalid sets are not expanded.
15294 // a{2..}b -> a{2..}b
15295 // a{b}c -> a{b}c
15296
15297
15298 minimatch$1.braceExpand = function (pattern, options) {
15299   return braceExpand(pattern, options);
15300 };
15301
15302 Minimatch.prototype.braceExpand = braceExpand;
15303
15304 function braceExpand(pattern, options) {
15305   if (!options) {
15306     if (this instanceof Minimatch) {
15307       options = this.options;
15308     } else {
15309       options = {};
15310     }
15311   }
15312
15313   pattern = typeof pattern === 'undefined' ? this.pattern : pattern;
15314
15315   if (typeof pattern === 'undefined') {
15316     throw new TypeError('undefined pattern');
15317   }
15318
15319   if (options.nobrace || !pattern.match(/\{.*\}/)) {
15320     // shortcut. no need to expand.
15321     return [pattern];
15322   }
15323
15324   return expand$2(pattern);
15325 } // parse a component of the expanded set.
15326 // At this point, no pattern may contain "/" in it
15327 // so we're going to return a 2d array, where each entry is the full
15328 // pattern, split on '/', and then turned into a regular expression.
15329 // A regexp is made at the end which joins each array with an
15330 // escaped /, and another full one which joins each regexp with |.
15331 //
15332 // Following the lead of Bash 4.1, note that "**" only has special meaning
15333 // when it is the *only* thing in a path portion.  Otherwise, any series
15334 // of * is equivalent to a single *.  Globstar behavior is enabled by
15335 // default, and can be disabled by setting options.noglobstar.
15336
15337
15338 Minimatch.prototype.parse = parse$c;
15339 var SUBPARSE = {};
15340
15341 function parse$c(pattern, isSub) {
15342   if (pattern.length > 1024 * 64) {
15343     throw new TypeError('pattern is too long');
15344   }
15345
15346   var options = this.options; // shortcuts
15347
15348   if (!options.noglobstar && pattern === '**') return GLOBSTAR$1;
15349   if (pattern === '') return '';
15350   var re = '';
15351   var hasMagic = !!options.nocase;
15352   var escaping = false; // ? => one single character
15353
15354   var patternListStack = [];
15355   var negativeLists = [];
15356   var stateChar;
15357   var inClass = false;
15358   var reClassStart = -1;
15359   var classStart = -1; // . and .. never match anything that doesn't start with .,
15360   // even when options.dot is set.
15361
15362   var patternStart = pattern.charAt(0) === '.' ? '' // anything
15363   // not (start or / followed by . or .. followed by / or end)
15364   : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' : '(?!\\.)';
15365   var self = this;
15366
15367   function clearStateChar() {
15368     if (stateChar) {
15369       // we had some state-tracking character
15370       // that wasn't consumed by this pass.
15371       switch (stateChar) {
15372         case '*':
15373           re += star;
15374           hasMagic = true;
15375           break;
15376
15377         case '?':
15378           re += qmark;
15379           hasMagic = true;
15380           break;
15381
15382         default:
15383           re += '\\' + stateChar;
15384           break;
15385       }
15386
15387       self.debug('clearStateChar %j %j', stateChar, re);
15388       stateChar = false;
15389     }
15390   }
15391
15392   for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
15393     this.debug('%s\t%s %s %j', pattern, i, re, c); // skip over any that are escaped.
15394
15395     if (escaping && reSpecials[c]) {
15396       re += '\\' + c;
15397       escaping = false;
15398       continue;
15399     }
15400
15401     switch (c) {
15402       case '/':
15403         // completely not allowed, even escaped.
15404         // Should already be path-split by now.
15405         return false;
15406
15407       case '\\':
15408         clearStateChar();
15409         escaping = true;
15410         continue;
15411       // the various stateChar values
15412       // for the "extglob" stuff.
15413
15414       case '?':
15415       case '*':
15416       case '+':
15417       case '@':
15418       case '!':
15419         this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c); // all of those are literals inside a class, except that
15420         // the glob [!a] means [^a] in regexp
15421
15422         if (inClass) {
15423           this.debug('  in class');
15424           if (c === '!' && i === classStart + 1) c = '^';
15425           re += c;
15426           continue;
15427         } // if we already have a stateChar, then it means
15428         // that there was something like ** or +? in there.
15429         // Handle the stateChar, then proceed with this one.
15430
15431
15432         self.debug('call clearStateChar %j', stateChar);
15433         clearStateChar();
15434         stateChar = c; // if extglob is disabled, then +(asdf|foo) isn't a thing.
15435         // just clear the statechar *now*, rather than even diving into
15436         // the patternList stuff.
15437
15438         if (options.noext) clearStateChar();
15439         continue;
15440
15441       case '(':
15442         if (inClass) {
15443           re += '(';
15444           continue;
15445         }
15446
15447         if (!stateChar) {
15448           re += '\\(';
15449           continue;
15450         }
15451
15452         patternListStack.push({
15453           type: stateChar,
15454           start: i - 1,
15455           reStart: re.length,
15456           open: plTypes[stateChar].open,
15457           close: plTypes[stateChar].close
15458         }); // negation is (?:(?!js)[^/]*)
15459
15460         re += stateChar === '!' ? '(?:(?!(?:' : '(?:';
15461         this.debug('plType %j %j', stateChar, re);
15462         stateChar = false;
15463         continue;
15464
15465       case ')':
15466         if (inClass || !patternListStack.length) {
15467           re += '\\)';
15468           continue;
15469         }
15470
15471         clearStateChar();
15472         hasMagic = true;
15473         var pl = patternListStack.pop(); // negation is (?:(?!js)[^/]*)
15474         // The others are (?:<pattern>)<type>
15475
15476         re += pl.close;
15477
15478         if (pl.type === '!') {
15479           negativeLists.push(pl);
15480         }
15481
15482         pl.reEnd = re.length;
15483         continue;
15484
15485       case '|':
15486         if (inClass || !patternListStack.length || escaping) {
15487           re += '\\|';
15488           escaping = false;
15489           continue;
15490         }
15491
15492         clearStateChar();
15493         re += '|';
15494         continue;
15495       // these are mostly the same in regexp and glob
15496
15497       case '[':
15498         // swallow any state-tracking char before the [
15499         clearStateChar();
15500
15501         if (inClass) {
15502           re += '\\' + c;
15503           continue;
15504         }
15505
15506         inClass = true;
15507         classStart = i;
15508         reClassStart = re.length;
15509         re += c;
15510         continue;
15511
15512       case ']':
15513         //  a right bracket shall lose its special
15514         //  meaning and represent itself in
15515         //  a bracket expression if it occurs
15516         //  first in the list.  -- POSIX.2 2.8.3.2
15517         if (i === classStart + 1 || !inClass) {
15518           re += '\\' + c;
15519           escaping = false;
15520           continue;
15521         } // handle the case where we left a class open.
15522         // "[z-a]" is valid, equivalent to "\[z-a\]"
15523
15524
15525         if (inClass) {
15526           // split where the last [ was, make sure we don't have
15527           // an invalid re. if so, re-walk the contents of the
15528           // would-be class to re-translate any characters that
15529           // were passed through as-is
15530           // TODO: It would probably be faster to determine this
15531           // without a try/catch and a new RegExp, but it's tricky
15532           // to do safely.  For now, this is safe and works.
15533           var cs = pattern.substring(classStart + 1, i);
15534
15535           try {
15536             RegExp('[' + cs + ']');
15537           } catch (er) {
15538             // not a valid class!
15539             var sp = this.parse(cs, SUBPARSE);
15540             re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]';
15541             hasMagic = hasMagic || sp[1];
15542             inClass = false;
15543             continue;
15544           }
15545         } // finish up the class.
15546
15547
15548         hasMagic = true;
15549         inClass = false;
15550         re += c;
15551         continue;
15552
15553       default:
15554         // swallow any state char that wasn't consumed
15555         clearStateChar();
15556
15557         if (escaping) {
15558           // no need
15559           escaping = false;
15560         } else if (reSpecials[c] && !(c === '^' && inClass)) {
15561           re += '\\';
15562         }
15563
15564         re += c;
15565     } // switch
15566
15567   } // for
15568   // handle the case where we left a class open.
15569   // "[abc" is valid, equivalent to "\[abc"
15570
15571
15572   if (inClass) {
15573     // split where the last [ was, and escape it
15574     // this is a huge pita.  We now have to re-walk
15575     // the contents of the would-be class to re-translate
15576     // any characters that were passed through as-is
15577     cs = pattern.substr(classStart + 1);
15578     sp = this.parse(cs, SUBPARSE);
15579     re = re.substr(0, reClassStart) + '\\[' + sp[0];
15580     hasMagic = hasMagic || sp[1];
15581   } // handle the case where we had a +( thing at the *end*
15582   // of the pattern.
15583   // each pattern list stack adds 3 chars, and we need to go through
15584   // and escape any | chars that were passed through as-is for the regexp.
15585   // Go through and escape them, taking care not to double-escape any
15586   // | chars that were already escaped.
15587
15588
15589   for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
15590     var tail = re.slice(pl.reStart + pl.open.length);
15591     this.debug('setting tail', re, pl); // maybe some even number of \, then maybe 1 \, followed by a |
15592
15593     tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
15594       if (!$2) {
15595         // the | isn't already escaped, so escape it.
15596         $2 = '\\';
15597       } // need to escape all those slashes *again*, without escaping the
15598       // one that we need for escaping the | character.  As it works out,
15599       // escaping an even number of slashes can be done by simply repeating
15600       // it exactly after itself.  That's why this trick works.
15601       //
15602       // I am sorry that you have to see this.
15603
15604
15605       return $1 + $1 + $2 + '|';
15606     });
15607     this.debug('tail=%j\n   %s', tail, tail, pl, re);
15608     var t = pl.type === '*' ? star : pl.type === '?' ? qmark : '\\' + pl.type;
15609     hasMagic = true;
15610     re = re.slice(0, pl.reStart) + t + '\\(' + tail;
15611   } // handle trailing things that only matter at the very end.
15612
15613
15614   clearStateChar();
15615
15616   if (escaping) {
15617     // trailing \\
15618     re += '\\\\';
15619   } // only need to apply the nodot start if the re starts with
15620   // something that could conceivably capture a dot
15621
15622
15623   var addPatternStart = false;
15624
15625   switch (re.charAt(0)) {
15626     case '.':
15627     case '[':
15628     case '(':
15629       addPatternStart = true;
15630   } // Hack to work around lack of negative lookbehind in JS
15631   // A pattern like: *.!(x).!(y|z) needs to ensure that a name
15632   // like 'a.xyz.yz' doesn't match.  So, the first negative
15633   // lookahead, has to look ALL the way ahead, to the end of
15634   // the pattern.
15635
15636
15637   for (var n = negativeLists.length - 1; n > -1; n--) {
15638     var nl = negativeLists[n];
15639     var nlBefore = re.slice(0, nl.reStart);
15640     var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
15641     var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
15642     var nlAfter = re.slice(nl.reEnd);
15643     nlLast += nlAfter; // Handle nested stuff like *(*.js|!(*.json)), where open parens
15644     // mean that we should *not* include the ) in the bit that is considered
15645     // "after" the negated section.
15646
15647     var openParensBefore = nlBefore.split('(').length - 1;
15648     var cleanAfter = nlAfter;
15649
15650     for (i = 0; i < openParensBefore; i++) {
15651       cleanAfter = cleanAfter.replace(/\)[+*?]?/, '');
15652     }
15653
15654     nlAfter = cleanAfter;
15655     var dollar = '';
15656
15657     if (nlAfter === '' && isSub !== SUBPARSE) {
15658       dollar = '$';
15659     }
15660
15661     var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
15662     re = newRe;
15663   } // if the re is not "" at this point, then we need to make sure
15664   // it doesn't match against an empty path part.
15665   // Otherwise a/* will match a/, which it should not.
15666
15667
15668   if (re !== '' && hasMagic) {
15669     re = '(?=.)' + re;
15670   }
15671
15672   if (addPatternStart) {
15673     re = patternStart + re;
15674   } // parsing just a piece of a larger pattern.
15675
15676
15677   if (isSub === SUBPARSE) {
15678     return [re, hasMagic];
15679   } // skip the regexp for non-magical patterns
15680   // unescape anything in it, though, so that it'll be
15681   // an exact match against a file etc.
15682
15683
15684   if (!hasMagic) {
15685     return globUnescape(pattern);
15686   }
15687
15688   var flags = options.nocase ? 'i' : '';
15689
15690   try {
15691     var regExp = new RegExp('^' + re + '$', flags);
15692   } catch (er) {
15693     // If it was an invalid regular expression, then it can't match
15694     // anything.  This trick looks for a character after the end of
15695     // the string, which is of course impossible, except in multi-line
15696     // mode, but it's not a /m regex.
15697     return new RegExp('$.');
15698   }
15699
15700   regExp._glob = pattern;
15701   regExp._src = re;
15702   return regExp;
15703 }
15704
15705 minimatch$1.makeRe = function (pattern, options) {
15706   return new Minimatch(pattern, options || {}).makeRe();
15707 };
15708
15709 Minimatch.prototype.makeRe = makeRe$1;
15710
15711 function makeRe$1() {
15712   if (this.regexp || this.regexp === false) return this.regexp; // at this point, this.set is a 2d array of partial
15713   // pattern strings, or "**".
15714   //
15715   // It's better to use .match().  This function shouldn't
15716   // be used, really, but it's pretty convenient sometimes,
15717   // when you just want to work with a regex.
15718
15719   var set = this.set;
15720
15721   if (!set.length) {
15722     this.regexp = false;
15723     return this.regexp;
15724   }
15725
15726   var options = this.options;
15727   var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
15728   var flags = options.nocase ? 'i' : '';
15729   var re = set.map(function (pattern) {
15730     return pattern.map(function (p) {
15731       return p === GLOBSTAR$1 ? twoStar : typeof p === 'string' ? regExpEscape(p) : p._src;
15732     }).join('\\\/');
15733   }).join('|'); // must match entire pattern
15734   // ending in a * or ** will make it less strict.
15735
15736   re = '^(?:' + re + ')$'; // can match anything, as long as it's not this.
15737
15738   if (this.negate) re = '^(?!' + re + ').*$';
15739
15740   try {
15741     this.regexp = new RegExp(re, flags);
15742   } catch (ex) {
15743     this.regexp = false;
15744   }
15745
15746   return this.regexp;
15747 }
15748
15749 minimatch$1.match = function (list, pattern, options) {
15750   options = options || {};
15751   var mm = new Minimatch(pattern, options);
15752   list = list.filter(function (f) {
15753     return mm.match(f);
15754   });
15755
15756   if (mm.options.nonull && !list.length) {
15757     list.push(pattern);
15758   }
15759
15760   return list;
15761 };
15762
15763 Minimatch.prototype.match = match;
15764
15765 function match(f, partial) {
15766   this.debug('match', f, this.pattern); // short-circuit in the case of busted things.
15767   // comments, etc.
15768
15769   if (this.comment) return false;
15770   if (this.empty) return f === '';
15771   if (f === '/' && partial) return true;
15772   var options = this.options; // windows: need to use /, not \
15773
15774   if (path$o.sep !== '/') {
15775     f = f.split(path$o.sep).join('/');
15776   } // treat the test path as a set of pathparts.
15777
15778
15779   f = f.split(slashSplit);
15780   this.debug(this.pattern, 'split', f); // just ONE of the pattern sets in this.set needs to match
15781   // in order for it to be valid.  If negating, then just one
15782   // match means that we have failed.
15783   // Either way, return on the first hit.
15784
15785   var set = this.set;
15786   this.debug(this.pattern, 'set', set); // Find the basename of the path by looking for the last non-empty segment
15787
15788   var filename;
15789   var i;
15790
15791   for (i = f.length - 1; i >= 0; i--) {
15792     filename = f[i];
15793     if (filename) break;
15794   }
15795
15796   for (i = 0; i < set.length; i++) {
15797     var pattern = set[i];
15798     var file = f;
15799
15800     if (options.matchBase && pattern.length === 1) {
15801       file = [filename];
15802     }
15803
15804     var hit = this.matchOne(file, pattern, partial);
15805
15806     if (hit) {
15807       if (options.flipNegate) return true;
15808       return !this.negate;
15809     }
15810   } // didn't get any hits.  this is success if it's a negative
15811   // pattern, failure otherwise.
15812
15813
15814   if (options.flipNegate) return false;
15815   return this.negate;
15816 } // set partial to true to test if, for example,
15817 // "/a/b" matches the start of "/*/b/*/d"
15818 // Partial means, if you run out of file before you run
15819 // out of pattern, then that's fine, as long as all
15820 // the parts match.
15821
15822
15823 Minimatch.prototype.matchOne = function (file, pattern, partial) {
15824   var options = this.options;
15825   this.debug('matchOne', {
15826     'this': this,
15827     file: file,
15828     pattern: pattern
15829   });
15830   this.debug('matchOne', file.length, pattern.length);
15831
15832   for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
15833     this.debug('matchOne loop');
15834     var p = pattern[pi];
15835     var f = file[fi];
15836     this.debug(pattern, p, f); // should be impossible.
15837     // some invalid regexp stuff in the set.
15838
15839     if (p === false) return false;
15840
15841     if (p === GLOBSTAR$1) {
15842       this.debug('GLOBSTAR', [pattern, p, f]); // "**"
15843       // a/**/b/**/c would match the following:
15844       // a/b/x/y/z/c
15845       // a/x/y/z/b/c
15846       // a/b/x/b/x/c
15847       // a/b/c
15848       // To do this, take the rest of the pattern after
15849       // the **, and see if it would match the file remainder.
15850       // If so, return success.
15851       // If not, the ** "swallows" a segment, and try again.
15852       // This is recursively awful.
15853       //
15854       // a/**/b/**/c matching a/b/x/y/z/c
15855       // - a matches a
15856       // - doublestar
15857       //   - matchOne(b/x/y/z/c, b/**/c)
15858       //     - b matches b
15859       //     - doublestar
15860       //       - matchOne(x/y/z/c, c) -> no
15861       //       - matchOne(y/z/c, c) -> no
15862       //       - matchOne(z/c, c) -> no
15863       //       - matchOne(c, c) yes, hit
15864
15865       var fr = fi;
15866       var pr = pi + 1;
15867
15868       if (pr === pl) {
15869         this.debug('** at the end'); // a ** at the end will just swallow the rest.
15870         // We have found a match.
15871         // however, it will not swallow /.x, unless
15872         // options.dot is set.
15873         // . and .. are *never* matched by **, for explosively
15874         // exponential reasons.
15875
15876         for (; fi < fl; fi++) {
15877           if (file[fi] === '.' || file[fi] === '..' || !options.dot && file[fi].charAt(0) === '.') return false;
15878         }
15879
15880         return true;
15881       } // ok, let's see if we can swallow whatever we can.
15882
15883
15884       while (fr < fl) {
15885         var swallowee = file[fr];
15886         this.debug('\nglobstar while', file, fr, pattern, pr, swallowee); // XXX remove this slice.  Just pass the start index.
15887
15888         if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
15889           this.debug('globstar found match!', fr, fl, swallowee); // found a match.
15890
15891           return true;
15892         } else {
15893           // can't swallow "." or ".." ever.
15894           // can only swallow ".foo" when explicitly asked.
15895           if (swallowee === '.' || swallowee === '..' || !options.dot && swallowee.charAt(0) === '.') {
15896             this.debug('dot detected!', file, fr, pattern, pr);
15897             break;
15898           } // ** swallows a segment, and continue.
15899
15900
15901           this.debug('globstar swallow a segment, and continue');
15902           fr++;
15903         }
15904       } // no match was found.
15905       // However, in partial mode, we can't say this is necessarily over.
15906       // If there's more *pattern* left, then
15907
15908
15909       if (partial) {
15910         // ran out of file
15911         this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
15912         if (fr === fl) return true;
15913       }
15914
15915       return false;
15916     } // something other than **
15917     // non-magic patterns just have to match exactly
15918     // patterns with magic have been turned into regexps.
15919
15920
15921     var hit;
15922
15923     if (typeof p === 'string') {
15924       if (options.nocase) {
15925         hit = f.toLowerCase() === p.toLowerCase();
15926       } else {
15927         hit = f === p;
15928       }
15929
15930       this.debug('string match', p, f, hit);
15931     } else {
15932       hit = f.match(p);
15933       this.debug('pattern match', p, f, hit);
15934     }
15935
15936     if (!hit) return false;
15937   } // Note: ending in / means that we'll get a final ""
15938   // at the end of the pattern.  This can only match a
15939   // corresponding "" at the end of the file.
15940   // If the file ends in /, then it can only match a
15941   // a pattern that ends in /, unless the pattern just
15942   // doesn't have any more for it. But, a/b/ should *not*
15943   // match "a/b/*", even though "" matches against the
15944   // [^/]*? pattern, except in partial mode, where it might
15945   // simply not be reached yet.
15946   // However, a/b/ should still satisfy a/*
15947   // now either we fell off the end of the pattern, or we're done.
15948
15949
15950   if (fi === fl && pi === pl) {
15951     // ran out of pattern and filename at the same time.
15952     // an exact hit!
15953     return true;
15954   } else if (fi === fl) {
15955     // ran out of file, but still had pattern left.
15956     // this is ok if we're doing the match as part of
15957     // a glob fs traversal.
15958     return partial;
15959   } else if (pi === pl) {
15960     // ran out of pattern, still have file left.
15961     // this is only acceptable if we're on the very last
15962     // empty segment of a file with a trailing slash.
15963     // a/* should match a/b/
15964     var emptyFileEnd = fi === fl - 1 && file[fi] === '';
15965     return emptyFileEnd;
15966   } // should be unreachable.
15967
15968
15969   throw new Error('wtf?');
15970 }; // replace stuff like \* with *
15971
15972
15973 function globUnescape(s) {
15974   return s.replace(/\\(.)/g, '$1');
15975 }
15976
15977 function regExpEscape(s) {
15978   return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
15979 }
15980
15981 const copyProperty = (to, from, property, ignoreNonConfigurable) => {
15982   // `Function#length` should reflect the parameters of `to` not `from` since we keep its body.
15983   // `Function#prototype` is non-writable and non-configurable so can never be modified.
15984   if (property === 'length' || property === 'prototype') {
15985     return;
15986   } // `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.
15987
15988
15989   if (property === 'arguments' || property === 'caller') {
15990     return;
15991   }
15992
15993   const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
15994   const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
15995
15996   if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
15997     return;
15998   }
15999
16000   Object.defineProperty(to, property, fromDescriptor);
16001 }; // `Object.defineProperty()` throws if the property exists, is not configurable and either:
16002 //  - one its descriptors is changed
16003 //  - it is non-writable and its value is changed
16004
16005
16006 const canCopyProperty = function (toDescriptor, fromDescriptor) {
16007   return toDescriptor === undefined || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
16008 };
16009
16010 const changePrototype = (to, from) => {
16011   const fromPrototype = Object.getPrototypeOf(from);
16012
16013   if (fromPrototype === Object.getPrototypeOf(to)) {
16014     return;
16015   }
16016
16017   Object.setPrototypeOf(to, fromPrototype);
16018 };
16019
16020 const wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\n${fromBody}`;
16021
16022 const toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');
16023 const toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name'); // We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.
16024 // We use `bind()` instead of a closure for the same reason.
16025 // Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.
16026
16027 const changeToString = (to, from, name) => {
16028   const withName = name === '' ? '' : `with ${name.trim()}() `;
16029   const newToString = wrappedToString.bind(null, withName, from.toString()); // Ensure `to.toString.toString` is non-enumerable and has the same `same`
16030
16031   Object.defineProperty(newToString, 'name', toStringName);
16032   Object.defineProperty(to, 'toString', Object.assign(Object.assign({}, toStringDescriptor), {}, {
16033     value: newToString
16034   }));
16035 };
16036
16037 const mimicFn$1 = (to, from, {
16038   ignoreNonConfigurable = false
16039 } = {}) => {
16040   const {
16041     name
16042   } = to;
16043
16044   for (const property of Reflect.ownKeys(from)) {
16045     copyProperty(to, from, property, ignoreNonConfigurable);
16046   }
16047
16048   changePrototype(to, from);
16049   changeToString(to, from, name);
16050   return to;
16051 };
16052
16053 var mimicFn_1 = mimicFn$1;
16054
16055 var dist$2 = {exports: {}};
16056
16057 var pDefer = () => {
16058   const ret = {};
16059   ret.promise = new Promise((resolve, reject) => {
16060     ret.resolve = resolve;
16061     ret.reject = reject;
16062   });
16063   return ret;
16064 };
16065
16066 (function (module, exports) {
16067
16068   var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
16069     return new (P || (P = Promise))(function (resolve, reject) {
16070       function fulfilled(value) {
16071         try {
16072           step(generator.next(value));
16073         } catch (e) {
16074           reject(e);
16075         }
16076       }
16077
16078       function rejected(value) {
16079         try {
16080           step(generator["throw"](value));
16081         } catch (e) {
16082           reject(e);
16083         }
16084       }
16085
16086       function step(result) {
16087         result.done ? resolve(result.value) : new P(function (resolve) {
16088           resolve(result.value);
16089         }).then(fulfilled, rejected);
16090       }
16091
16092       step((generator = generator.apply(thisArg, _arguments || [])).next());
16093     });
16094   };
16095
16096   var __importDefault = this && this.__importDefault || function (mod) {
16097     return mod && mod.__esModule ? mod : {
16098       "default": mod
16099     };
16100   };
16101
16102   Object.defineProperty(exports, "__esModule", {
16103     value: true
16104   });
16105
16106   const p_defer_1 = __importDefault(pDefer);
16107
16108   function mapAgeCleaner(map, property = 'maxAge') {
16109     let processingKey;
16110     let processingTimer;
16111     let processingDeferred;
16112
16113     const cleanup = () => __awaiter(this, void 0, void 0, function* () {
16114       if (processingKey !== undefined) {
16115         // If we are already processing an item, we can safely exit
16116         return;
16117       }
16118
16119       const setupTimer = item => __awaiter(this, void 0, void 0, function* () {
16120         processingDeferred = p_defer_1.default();
16121         const delay = item[1][property] - Date.now();
16122
16123         if (delay <= 0) {
16124           // Remove the item immediately if the delay is equal to or below 0
16125           map.delete(item[0]);
16126           processingDeferred.resolve();
16127           return;
16128         } // Keep track of the current processed key
16129
16130
16131         processingKey = item[0];
16132         processingTimer = setTimeout(() => {
16133           // Remove the item when the timeout fires
16134           map.delete(item[0]);
16135
16136           if (processingDeferred) {
16137             processingDeferred.resolve();
16138           }
16139         }, delay); // tslint:disable-next-line:strict-type-predicates
16140
16141         if (typeof processingTimer.unref === 'function') {
16142           // Don't hold up the process from exiting
16143           processingTimer.unref();
16144         }
16145
16146         return processingDeferred.promise;
16147       });
16148
16149       try {
16150         for (const entry of map) {
16151           yield setupTimer(entry);
16152         }
16153       } catch (_a) {// Do nothing if an error occurs, this means the timer was cleaned up and we should stop processing
16154       }
16155
16156       processingKey = undefined;
16157     });
16158
16159     const reset = () => {
16160       processingKey = undefined;
16161
16162       if (processingTimer !== undefined) {
16163         clearTimeout(processingTimer);
16164         processingTimer = undefined;
16165       }
16166
16167       if (processingDeferred !== undefined) {
16168         // tslint:disable-line:early-exit
16169         processingDeferred.reject(undefined);
16170         processingDeferred = undefined;
16171       }
16172     };
16173
16174     const originalSet = map.set.bind(map);
16175
16176     map.set = (key, value) => {
16177       if (map.has(key)) {
16178         // If the key already exist, remove it so we can add it back at the end of the map.
16179         map.delete(key);
16180       } // Call the original `map.set`
16181
16182
16183       const result = originalSet(key, value); // If we are already processing a key and the key added is the current processed key, stop processing it
16184
16185       if (processingKey && processingKey === key) {
16186         reset();
16187       } // Always run the cleanup method in case it wasn't started yet
16188
16189
16190       cleanup(); // tslint:disable-line:no-floating-promises
16191
16192       return result;
16193     };
16194
16195     cleanup(); // tslint:disable-line:no-floating-promises
16196
16197     return map;
16198   }
16199
16200   exports.default = mapAgeCleaner; // Add support for CJS
16201
16202   module.exports = mapAgeCleaner;
16203   module.exports.default = mapAgeCleaner;
16204 })(dist$2, dist$2.exports);
16205
16206 const mimicFn = mimicFn_1;
16207 const mapAgeCleaner = dist$2.exports;
16208 const decoratorInstanceMap = new WeakMap();
16209 const cacheStore = new WeakMap();
16210 /**
16211 [Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input.
16212
16213 @param fn - Function to be memoized.
16214
16215 @example
16216 ```
16217 import mem = require('mem');
16218
16219 let i = 0;
16220 const counter = () => ++i;
16221 const memoized = mem(counter);
16222
16223 memoized('foo');
16224 //=> 1
16225
16226 // Cached as it's the same arguments
16227 memoized('foo');
16228 //=> 1
16229
16230 // Not cached anymore as the arguments changed
16231 memoized('bar');
16232 //=> 2
16233
16234 memoized('bar');
16235 //=> 2
16236 ```
16237 */
16238
16239 const mem$3 = (fn, {
16240   cacheKey,
16241   cache = new Map(),
16242   maxAge
16243 } = {}) => {
16244   if (typeof maxAge === 'number') {
16245     // TODO: Drop after https://github.com/SamVerschueren/map-age-cleaner/issues/5
16246     // @ts-expect-error
16247     mapAgeCleaner(cache);
16248   }
16249
16250   const memoized = function (...arguments_) {
16251     const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
16252     const cacheItem = cache.get(key);
16253
16254     if (cacheItem) {
16255       return cacheItem.data;
16256     }
16257
16258     const result = fn.apply(this, arguments_);
16259     cache.set(key, {
16260       data: result,
16261       maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
16262     });
16263     return result;
16264   };
16265
16266   mimicFn(memoized, fn, {
16267     ignoreNonConfigurable: true
16268   });
16269   cacheStore.set(memoized, cache);
16270   return memoized;
16271 };
16272 /**
16273 @returns A [decorator](https://github.com/tc39/proposal-decorators) to memoize class methods or static class methods.
16274
16275 @example
16276 ```
16277 import mem = require('mem');
16278
16279 class Example {
16280     index = 0
16281
16282     @mem.decorator()
16283     counter() {
16284         return ++this.index;
16285     }
16286 }
16287
16288 class ExampleWithOptions {
16289     index = 0
16290
16291     @mem.decorator({maxAge: 1000})
16292     counter() {
16293         return ++this.index;
16294     }
16295 }
16296 ```
16297 */
16298
16299
16300 mem$3.decorator = (options = {}) => (target, propertyKey, descriptor) => {
16301   const input = target[propertyKey];
16302
16303   if (typeof input !== 'function') {
16304     throw new TypeError('The decorated value must be a function');
16305   }
16306
16307   delete descriptor.value;
16308   delete descriptor.writable;
16309
16310   descriptor.get = function () {
16311     if (!decoratorInstanceMap.has(this)) {
16312       const value = mem$3(input, options);
16313       decoratorInstanceMap.set(this, value);
16314       return value;
16315     }
16316
16317     return decoratorInstanceMap.get(this);
16318   };
16319 };
16320 /**
16321 Clear all cached data of a memoized function.
16322
16323 @param fn - Memoized function.
16324 */
16325
16326
16327 mem$3.clear = fn => {
16328   const cache = cacheStore.get(fn);
16329
16330   if (!cache) {
16331     throw new TypeError('Can\'t clear a function that was not memoized!');
16332   }
16333
16334   if (typeof cache.clear !== 'function') {
16335     throw new TypeError('The cache Map can\'t be cleared!');
16336   }
16337
16338   cache.clear();
16339 };
16340
16341 var dist$1 = mem$3;
16342
16343 var require$$7$2 = require("./third-party.js");
16344
16345 var tomlParser = {exports: {}};
16346
16347 const ParserEND = 0x110000;
16348
16349 class ParserError extends Error {
16350   /* istanbul ignore next */
16351   constructor(msg, filename, linenumber) {
16352     super('[ParserError] ' + msg, filename, linenumber);
16353     this.name = 'ParserError';
16354     this.code = 'ParserError';
16355     if (Error.captureStackTrace) Error.captureStackTrace(this, ParserError);
16356   }
16357
16358 }
16359
16360 class State {
16361   constructor(parser) {
16362     this.parser = parser;
16363     this.buf = '';
16364     this.returned = null;
16365     this.result = null;
16366     this.resultTable = null;
16367     this.resultArr = null;
16368   }
16369
16370 }
16371
16372 class Parser {
16373   constructor() {
16374     this.pos = 0;
16375     this.col = 0;
16376     this.line = 0;
16377     this.obj = {};
16378     this.ctx = this.obj;
16379     this.stack = [];
16380     this._buf = '';
16381     this.char = null;
16382     this.ii = 0;
16383     this.state = new State(this.parseStart);
16384   }
16385
16386   parse(str) {
16387     /* istanbul ignore next */
16388     if (str.length === 0 || str.length == null) return;
16389     this._buf = String(str);
16390     this.ii = -1;
16391     this.char = -1;
16392     let getNext;
16393
16394     while (getNext === false || this.nextChar()) {
16395       getNext = this.runOne();
16396     }
16397
16398     this._buf = null;
16399   }
16400
16401   nextChar() {
16402     if (this.char === 0x0A) {
16403       ++this.line;
16404       this.col = -1;
16405     }
16406
16407     ++this.ii;
16408     this.char = this._buf.codePointAt(this.ii);
16409     ++this.pos;
16410     ++this.col;
16411     return this.haveBuffer();
16412   }
16413
16414   haveBuffer() {
16415     return this.ii < this._buf.length;
16416   }
16417
16418   runOne() {
16419     return this.state.parser.call(this, this.state.returned);
16420   }
16421
16422   finish() {
16423     this.char = ParserEND;
16424     let last;
16425
16426     do {
16427       last = this.state.parser;
16428       this.runOne();
16429     } while (this.state.parser !== last);
16430
16431     this.ctx = null;
16432     this.state = null;
16433     this._buf = null;
16434     return this.obj;
16435   }
16436
16437   next(fn) {
16438     /* istanbul ignore next */
16439     if (typeof fn !== 'function') throw new ParserError('Tried to set state to non-existent state: ' + JSON.stringify(fn));
16440     this.state.parser = fn;
16441   }
16442
16443   goto(fn) {
16444     this.next(fn);
16445     return this.runOne();
16446   }
16447
16448   call(fn, returnWith) {
16449     if (returnWith) this.next(returnWith);
16450     this.stack.push(this.state);
16451     this.state = new State(fn);
16452   }
16453
16454   callNow(fn, returnWith) {
16455     this.call(fn, returnWith);
16456     return this.runOne();
16457   }
16458
16459   return(value) {
16460     /* istanbul ignore next */
16461     if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow'));
16462     if (value === undefined) value = this.state.buf;
16463     this.state = this.stack.pop();
16464     this.state.returned = value;
16465   }
16466
16467   returnNow(value) {
16468     this.return(value);
16469     return this.runOne();
16470   }
16471
16472   consume() {
16473     /* istanbul ignore next */
16474     if (this.char === ParserEND) throw this.error(new ParserError('Unexpected end-of-buffer'));
16475     this.state.buf += this._buf[this.ii];
16476   }
16477
16478   error(err) {
16479     err.line = this.line;
16480     err.col = this.col;
16481     err.pos = this.pos;
16482     return err;
16483   }
16484   /* istanbul ignore next */
16485
16486
16487   parseStart() {
16488     throw new ParserError('Must declare a parseStart method');
16489   }
16490
16491 }
16492
16493 Parser.END = ParserEND;
16494 Parser.Error = ParserError;
16495 var parser = Parser;
16496
16497 var createDatetime = value => {
16498   const date = new Date(value);
16499   /* istanbul ignore if */
16500
16501   if (isNaN(date)) {
16502     throw new TypeError('Invalid Datetime');
16503   } else {
16504     return date;
16505   }
16506 };
16507
16508 var formatNum = (d, num) => {
16509   num = String(num);
16510
16511   while (num.length < d) num = '0' + num;
16512
16513   return num;
16514 };
16515
16516 const f$2 = formatNum;
16517
16518 class FloatingDateTime extends Date {
16519   constructor(value) {
16520     super(value + 'Z');
16521     this.isFloating = true;
16522   }
16523
16524   toISOString() {
16525     const date = `${this.getUTCFullYear()}-${f$2(2, this.getUTCMonth() + 1)}-${f$2(2, this.getUTCDate())}`;
16526     const time = `${f$2(2, this.getUTCHours())}:${f$2(2, this.getUTCMinutes())}:${f$2(2, this.getUTCSeconds())}.${f$2(3, this.getUTCMilliseconds())}`;
16527     return `${date}T${time}`;
16528   }
16529
16530 }
16531
16532 var createDatetimeFloat = value => {
16533   const date = new FloatingDateTime(value);
16534   /* istanbul ignore if */
16535
16536   if (isNaN(date)) {
16537     throw new TypeError('Invalid Datetime');
16538   } else {
16539     return date;
16540   }
16541 };
16542
16543 const f$1 = formatNum;
16544 const DateTime = global.Date;
16545
16546 class Date$1 extends DateTime {
16547   constructor(value) {
16548     super(value);
16549     this.isDate = true;
16550   }
16551
16552   toISOString() {
16553     return `${this.getUTCFullYear()}-${f$1(2, this.getUTCMonth() + 1)}-${f$1(2, this.getUTCDate())}`;
16554   }
16555
16556 }
16557
16558 var createDate$1 = value => {
16559   const date = new Date$1(value);
16560   /* istanbul ignore if */
16561
16562   if (isNaN(date)) {
16563     throw new TypeError('Invalid Datetime');
16564   } else {
16565     return date;
16566   }
16567 };
16568
16569 const f = formatNum;
16570
16571 class Time extends Date {
16572   constructor(value) {
16573     super(`0000-01-01T${value}Z`);
16574     this.isTime = true;
16575   }
16576
16577   toISOString() {
16578     return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
16579   }
16580
16581 }
16582
16583 var createTime$1 = value => {
16584   const date = new Time(value);
16585   /* istanbul ignore if */
16586
16587   if (isNaN(date)) {
16588     throw new TypeError('Invalid Datetime');
16589   } else {
16590     return date;
16591   }
16592 };
16593
16594 /* eslint-disable no-new-wrappers, no-eval, camelcase, operator-linebreak */
16595
16596
16597 tomlParser.exports = makeParserClass(parser);
16598 tomlParser.exports.makeParserClass = makeParserClass;
16599
16600 class TomlError extends Error {
16601   constructor(msg) {
16602     super(msg);
16603     this.name = 'TomlError';
16604     /* istanbul ignore next */
16605
16606     if (Error.captureStackTrace) Error.captureStackTrace(this, TomlError);
16607     this.fromTOML = true;
16608     this.wrapped = null;
16609   }
16610
16611 }
16612
16613 TomlError.wrap = err => {
16614   const terr = new TomlError(err.message);
16615   terr.code = err.code;
16616   terr.wrapped = err;
16617   return terr;
16618 };
16619
16620 tomlParser.exports.TomlError = TomlError;
16621 const createDateTime = createDatetime;
16622 const createDateTimeFloat = createDatetimeFloat;
16623 const createDate = createDate$1;
16624 const createTime = createTime$1;
16625 const CTRL_I = 0x09;
16626 const CTRL_J = 0x0A;
16627 const CTRL_M = 0x0D;
16628 const CTRL_CHAR_BOUNDARY = 0x1F; // the last non-character in the latin1 region of unicode, except DEL
16629
16630 const CHAR_SP = 0x20;
16631 const CHAR_QUOT = 0x22;
16632 const CHAR_NUM = 0x23;
16633 const CHAR_APOS = 0x27;
16634 const CHAR_PLUS$1 = 0x2B;
16635 const CHAR_COMMA$2 = 0x2C;
16636 const CHAR_HYPHEN = 0x2D;
16637 const CHAR_PERIOD = 0x2E;
16638 const CHAR_0 = 0x30;
16639 const CHAR_1 = 0x31;
16640 const CHAR_7 = 0x37;
16641 const CHAR_9 = 0x39;
16642 const CHAR_COLON = 0x3A;
16643 const CHAR_EQUALS = 0x3D;
16644 const CHAR_A = 0x41;
16645 const CHAR_E = 0x45;
16646 const CHAR_F = 0x46;
16647 const CHAR_T = 0x54;
16648 const CHAR_U = 0x55;
16649 const CHAR_Z = 0x5A;
16650 const CHAR_LOWBAR = 0x5F;
16651 const CHAR_a = 0x61;
16652 const CHAR_b = 0x62;
16653 const CHAR_e = 0x65;
16654 const CHAR_f = 0x66;
16655 const CHAR_i = 0x69;
16656 const CHAR_l = 0x6C;
16657 const CHAR_n = 0x6E;
16658 const CHAR_o = 0x6F;
16659 const CHAR_r = 0x72;
16660 const CHAR_s = 0x73;
16661 const CHAR_t = 0x74;
16662 const CHAR_u = 0x75;
16663 const CHAR_x = 0x78;
16664 const CHAR_z = 0x7A;
16665 const CHAR_LCUB = 0x7B;
16666 const CHAR_RCUB = 0x7D;
16667 const CHAR_LSQB = 0x5B;
16668 const CHAR_BSOL = 0x5C;
16669 const CHAR_RSQB = 0x5D;
16670 const CHAR_DEL = 0x7F;
16671 const SURROGATE_FIRST = 0xD800;
16672 const SURROGATE_LAST = 0xDFFF;
16673 const escapes = {
16674   [CHAR_b]: '\u0008',
16675   [CHAR_t]: '\u0009',
16676   [CHAR_n]: '\u000A',
16677   [CHAR_f]: '\u000C',
16678   [CHAR_r]: '\u000D',
16679   [CHAR_QUOT]: '\u0022',
16680   [CHAR_BSOL]: '\u005C'
16681 };
16682
16683 function isDigit(cp) {
16684   return cp >= CHAR_0 && cp <= CHAR_9;
16685 }
16686
16687 function isHexit(cp) {
16688   return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
16689 }
16690
16691 function isBit(cp) {
16692   return cp === CHAR_1 || cp === CHAR_0;
16693 }
16694
16695 function isOctit(cp) {
16696   return cp >= CHAR_0 && cp <= CHAR_7;
16697 }
16698
16699 function isAlphaNumQuoteHyphen(cp) {
16700   return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
16701 }
16702
16703 function isAlphaNumHyphen(cp) {
16704   return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
16705 }
16706
16707 const _type = Symbol('type');
16708
16709 const _declared = Symbol('declared');
16710
16711 const hasOwnProperty$a = Object.prototype.hasOwnProperty;
16712 const defineProperty = Object.defineProperty;
16713 const descriptor = {
16714   configurable: true,
16715   enumerable: true,
16716   writable: true,
16717   value: undefined
16718 };
16719
16720 function hasKey(obj, key) {
16721   if (hasOwnProperty$a.call(obj, key)) return true;
16722   if (key === '__proto__') defineProperty(obj, '__proto__', descriptor);
16723   return false;
16724 }
16725
16726 const INLINE_TABLE = Symbol('inline-table');
16727
16728 function InlineTable() {
16729   return Object.defineProperties({}, {
16730     [_type]: {
16731       value: INLINE_TABLE
16732     }
16733   });
16734 }
16735
16736 function isInlineTable(obj) {
16737   if (obj === null || typeof obj !== 'object') return false;
16738   return obj[_type] === INLINE_TABLE;
16739 }
16740
16741 const TABLE = Symbol('table');
16742
16743 function Table() {
16744   return Object.defineProperties({}, {
16745     [_type]: {
16746       value: TABLE
16747     },
16748     [_declared]: {
16749       value: false,
16750       writable: true
16751     }
16752   });
16753 }
16754
16755 function isTable(obj) {
16756   if (obj === null || typeof obj !== 'object') return false;
16757   return obj[_type] === TABLE;
16758 }
16759
16760 const _contentType = Symbol('content-type');
16761
16762 const INLINE_LIST = Symbol('inline-list');
16763
16764 function InlineList(type) {
16765   return Object.defineProperties([], {
16766     [_type]: {
16767       value: INLINE_LIST
16768     },
16769     [_contentType]: {
16770       value: type
16771     }
16772   });
16773 }
16774
16775 function isInlineList(obj) {
16776   if (obj === null || typeof obj !== 'object') return false;
16777   return obj[_type] === INLINE_LIST;
16778 }
16779
16780 const LIST = Symbol('list');
16781
16782 function List() {
16783   return Object.defineProperties([], {
16784     [_type]: {
16785       value: LIST
16786     }
16787   });
16788 }
16789
16790 function isList(obj) {
16791   if (obj === null || typeof obj !== 'object') return false;
16792   return obj[_type] === LIST;
16793 } // in an eval, to let bundlers not slurp in a util proxy
16794
16795
16796 let _custom;
16797
16798 try {
16799   const utilInspect = require('util').inspect;
16800
16801   _custom = utilInspect.custom;
16802 } catch (_) {
16803   /* eval require not available in transpiled bundle */
16804 }
16805 /* istanbul ignore next */
16806
16807
16808 const _inspect = _custom || 'inspect';
16809
16810 class BoxedBigInt {
16811   constructor(value) {
16812     try {
16813       this.value = global.BigInt.asIntN(64, value);
16814     } catch (_) {
16815       /* istanbul ignore next */
16816       this.value = null;
16817     }
16818
16819     Object.defineProperty(this, _type, {
16820       value: INTEGER
16821     });
16822   }
16823
16824   isNaN() {
16825     return this.value === null;
16826   }
16827   /* istanbul ignore next */
16828
16829
16830   toString() {
16831     return String(this.value);
16832   }
16833   /* istanbul ignore next */
16834
16835
16836   [_inspect]() {
16837     return `[BigInt: ${this.toString()}]}`;
16838   }
16839
16840   valueOf() {
16841     return this.value;
16842   }
16843
16844 }
16845
16846 const INTEGER = Symbol('integer');
16847
16848 function Integer(value) {
16849   let num = Number(value); // -0 is a float thing, not an int thing
16850
16851   if (Object.is(num, -0)) num = 0;
16852   /* istanbul ignore else */
16853
16854   if (global.BigInt && !Number.isSafeInteger(num)) {
16855     return new BoxedBigInt(value);
16856   } else {
16857     /* istanbul ignore next */
16858     return Object.defineProperties(new Number(num), {
16859       isNaN: {
16860         value: function () {
16861           return isNaN(this);
16862         }
16863       },
16864       [_type]: {
16865         value: INTEGER
16866       },
16867       [_inspect]: {
16868         value: () => `[Integer: ${value}]`
16869       }
16870     });
16871   }
16872 }
16873
16874 function isInteger(obj) {
16875   if (obj === null || typeof obj !== 'object') return false;
16876   return obj[_type] === INTEGER;
16877 }
16878
16879 const FLOAT = Symbol('float');
16880
16881 function Float(value) {
16882   /* istanbul ignore next */
16883   return Object.defineProperties(new Number(value), {
16884     [_type]: {
16885       value: FLOAT
16886     },
16887     [_inspect]: {
16888       value: () => `[Float: ${value}]`
16889     }
16890   });
16891 }
16892
16893 function isFloat(obj) {
16894   if (obj === null || typeof obj !== 'object') return false;
16895   return obj[_type] === FLOAT;
16896 }
16897
16898 function tomlType(value) {
16899   const type = typeof value;
16900
16901   if (type === 'object') {
16902     /* istanbul ignore if */
16903     if (value === null) return 'null';
16904     if (value instanceof Date) return 'datetime';
16905     /* istanbul ignore else */
16906
16907     if (_type in value) {
16908       switch (value[_type]) {
16909         case INLINE_TABLE:
16910           return 'inline-table';
16911
16912         case INLINE_LIST:
16913           return 'inline-list';
16914
16915         /* istanbul ignore next */
16916
16917         case TABLE:
16918           return 'table';
16919
16920         /* istanbul ignore next */
16921
16922         case LIST:
16923           return 'list';
16924
16925         case FLOAT:
16926           return 'float';
16927
16928         case INTEGER:
16929           return 'integer';
16930       }
16931     }
16932   }
16933
16934   return type;
16935 }
16936
16937 function makeParserClass(Parser) {
16938   class TOMLParser extends Parser {
16939     constructor() {
16940       super();
16941       this.ctx = this.obj = Table();
16942     }
16943     /* MATCH HELPER */
16944
16945
16946     atEndOfWord() {
16947       return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
16948     }
16949
16950     atEndOfLine() {
16951       return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
16952     }
16953
16954     parseStart() {
16955       if (this.char === Parser.END) {
16956         return null;
16957       } else if (this.char === CHAR_LSQB) {
16958         return this.call(this.parseTableOrList);
16959       } else if (this.char === CHAR_NUM) {
16960         return this.call(this.parseComment);
16961       } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
16962         return null;
16963       } else if (isAlphaNumQuoteHyphen(this.char)) {
16964         return this.callNow(this.parseAssignStatement);
16965       } else {
16966         throw this.error(new TomlError(`Unknown character "${this.char}"`));
16967       }
16968     } // HELPER, this strips any whitespace and comments to the end of the line
16969     // then RETURNS. Last state in a production.
16970
16971
16972     parseWhitespaceToEOL() {
16973       if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
16974         return null;
16975       } else if (this.char === CHAR_NUM) {
16976         return this.goto(this.parseComment);
16977       } else if (this.char === Parser.END || this.char === CTRL_J) {
16978         return this.return();
16979       } else {
16980         throw this.error(new TomlError('Unexpected character, expected only whitespace or comments till end of line'));
16981       }
16982     }
16983     /* ASSIGNMENT: key = value */
16984
16985
16986     parseAssignStatement() {
16987       return this.callNow(this.parseAssign, this.recordAssignStatement);
16988     }
16989
16990     recordAssignStatement(kv) {
16991       let target = this.ctx;
16992       let finalKey = kv.key.pop();
16993
16994       for (let kw of kv.key) {
16995         if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
16996           throw this.error(new TomlError("Can't redefine existing key"));
16997         }
16998
16999         target = target[kw] = target[kw] || Table();
17000       }
17001
17002       if (hasKey(target, finalKey)) {
17003         throw this.error(new TomlError("Can't redefine existing key"));
17004       } // unbox our numbers
17005
17006
17007       if (isInteger(kv.value) || isFloat(kv.value)) {
17008         target[finalKey] = kv.value.valueOf();
17009       } else {
17010         target[finalKey] = kv.value;
17011       }
17012
17013       return this.goto(this.parseWhitespaceToEOL);
17014     }
17015     /* ASSSIGNMENT expression, key = value possibly inside an inline table */
17016
17017
17018     parseAssign() {
17019       return this.callNow(this.parseKeyword, this.recordAssignKeyword);
17020     }
17021
17022     recordAssignKeyword(key) {
17023       if (this.state.resultTable) {
17024         this.state.resultTable.push(key);
17025       } else {
17026         this.state.resultTable = [key];
17027       }
17028
17029       return this.goto(this.parseAssignKeywordPreDot);
17030     }
17031
17032     parseAssignKeywordPreDot() {
17033       if (this.char === CHAR_PERIOD) {
17034         return this.next(this.parseAssignKeywordPostDot);
17035       } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
17036         return this.goto(this.parseAssignEqual);
17037       }
17038     }
17039
17040     parseAssignKeywordPostDot() {
17041       if (this.char !== CHAR_SP && this.char !== CTRL_I) {
17042         return this.callNow(this.parseKeyword, this.recordAssignKeyword);
17043       }
17044     }
17045
17046     parseAssignEqual() {
17047       if (this.char === CHAR_EQUALS) {
17048         return this.next(this.parseAssignPreValue);
17049       } else {
17050         throw this.error(new TomlError('Invalid character, expected "="'));
17051       }
17052     }
17053
17054     parseAssignPreValue() {
17055       if (this.char === CHAR_SP || this.char === CTRL_I) {
17056         return null;
17057       } else {
17058         return this.callNow(this.parseValue, this.recordAssignValue);
17059       }
17060     }
17061
17062     recordAssignValue(value) {
17063       return this.returnNow({
17064         key: this.state.resultTable,
17065         value: value
17066       });
17067     }
17068     /* COMMENTS: #...eol */
17069
17070
17071     parseComment() {
17072       do {
17073         if (this.char === Parser.END || this.char === CTRL_J) {
17074           return this.return();
17075         }
17076       } while (this.nextChar());
17077     }
17078     /* TABLES AND LISTS, [foo] and [[foo]] */
17079
17080
17081     parseTableOrList() {
17082       if (this.char === CHAR_LSQB) {
17083         this.next(this.parseList);
17084       } else {
17085         return this.goto(this.parseTable);
17086       }
17087     }
17088     /* TABLE [foo.bar.baz] */
17089
17090
17091     parseTable() {
17092       this.ctx = this.obj;
17093       return this.goto(this.parseTableNext);
17094     }
17095
17096     parseTableNext() {
17097       if (this.char === CHAR_SP || this.char === CTRL_I) {
17098         return null;
17099       } else {
17100         return this.callNow(this.parseKeyword, this.parseTableMore);
17101       }
17102     }
17103
17104     parseTableMore(keyword) {
17105       if (this.char === CHAR_SP || this.char === CTRL_I) {
17106         return null;
17107       } else if (this.char === CHAR_RSQB) {
17108         if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
17109           throw this.error(new TomlError("Can't redefine existing key"));
17110         } else {
17111           this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
17112           this.ctx[_declared] = true;
17113         }
17114
17115         return this.next(this.parseWhitespaceToEOL);
17116       } else if (this.char === CHAR_PERIOD) {
17117         if (!hasKey(this.ctx, keyword)) {
17118           this.ctx = this.ctx[keyword] = Table();
17119         } else if (isTable(this.ctx[keyword])) {
17120           this.ctx = this.ctx[keyword];
17121         } else if (isList(this.ctx[keyword])) {
17122           this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
17123         } else {
17124           throw this.error(new TomlError("Can't redefine existing key"));
17125         }
17126
17127         return this.next(this.parseTableNext);
17128       } else {
17129         throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]'));
17130       }
17131     }
17132     /* LIST [[a.b.c]] */
17133
17134
17135     parseList() {
17136       this.ctx = this.obj;
17137       return this.goto(this.parseListNext);
17138     }
17139
17140     parseListNext() {
17141       if (this.char === CHAR_SP || this.char === CTRL_I) {
17142         return null;
17143       } else {
17144         return this.callNow(this.parseKeyword, this.parseListMore);
17145       }
17146     }
17147
17148     parseListMore(keyword) {
17149       if (this.char === CHAR_SP || this.char === CTRL_I) {
17150         return null;
17151       } else if (this.char === CHAR_RSQB) {
17152         if (!hasKey(this.ctx, keyword)) {
17153           this.ctx[keyword] = List();
17154         }
17155
17156         if (isInlineList(this.ctx[keyword])) {
17157           throw this.error(new TomlError("Can't extend an inline array"));
17158         } else if (isList(this.ctx[keyword])) {
17159           const next = Table();
17160           this.ctx[keyword].push(next);
17161           this.ctx = next;
17162         } else {
17163           throw this.error(new TomlError("Can't redefine an existing key"));
17164         }
17165
17166         return this.next(this.parseListEnd);
17167       } else if (this.char === CHAR_PERIOD) {
17168         if (!hasKey(this.ctx, keyword)) {
17169           this.ctx = this.ctx[keyword] = Table();
17170         } else if (isInlineList(this.ctx[keyword])) {
17171           throw this.error(new TomlError("Can't extend an inline array"));
17172         } else if (isInlineTable(this.ctx[keyword])) {
17173           throw this.error(new TomlError("Can't extend an inline table"));
17174         } else if (isList(this.ctx[keyword])) {
17175           this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
17176         } else if (isTable(this.ctx[keyword])) {
17177           this.ctx = this.ctx[keyword];
17178         } else {
17179           throw this.error(new TomlError("Can't redefine an existing key"));
17180         }
17181
17182         return this.next(this.parseListNext);
17183       } else {
17184         throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]'));
17185       }
17186     }
17187
17188     parseListEnd(keyword) {
17189       if (this.char === CHAR_RSQB) {
17190         return this.next(this.parseWhitespaceToEOL);
17191       } else {
17192         throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]'));
17193       }
17194     }
17195     /* VALUE string, number, boolean, inline list, inline object */
17196
17197
17198     parseValue() {
17199       if (this.char === Parser.END) {
17200         throw this.error(new TomlError('Key without value'));
17201       } else if (this.char === CHAR_QUOT) {
17202         return this.next(this.parseDoubleString);
17203       }
17204
17205       if (this.char === CHAR_APOS) {
17206         return this.next(this.parseSingleString);
17207       } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS$1) {
17208         return this.goto(this.parseNumberSign);
17209       } else if (this.char === CHAR_i) {
17210         return this.next(this.parseInf);
17211       } else if (this.char === CHAR_n) {
17212         return this.next(this.parseNan);
17213       } else if (isDigit(this.char)) {
17214         return this.goto(this.parseNumberOrDateTime);
17215       } else if (this.char === CHAR_t || this.char === CHAR_f) {
17216         return this.goto(this.parseBoolean);
17217       } else if (this.char === CHAR_LSQB) {
17218         return this.call(this.parseInlineList, this.recordValue);
17219       } else if (this.char === CHAR_LCUB) {
17220         return this.call(this.parseInlineTable, this.recordValue);
17221       } else {
17222         throw this.error(new TomlError('Unexpected character, expecting string, number, datetime, boolean, inline array or inline table'));
17223       }
17224     }
17225
17226     recordValue(value) {
17227       return this.returnNow(value);
17228     }
17229
17230     parseInf() {
17231       if (this.char === CHAR_n) {
17232         return this.next(this.parseInf2);
17233       } else {
17234         throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
17235       }
17236     }
17237
17238     parseInf2() {
17239       if (this.char === CHAR_f) {
17240         if (this.state.buf === '-') {
17241           return this.return(-Infinity);
17242         } else {
17243           return this.return(Infinity);
17244         }
17245       } else {
17246         throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
17247       }
17248     }
17249
17250     parseNan() {
17251       if (this.char === CHAR_a) {
17252         return this.next(this.parseNan2);
17253       } else {
17254         throw this.error(new TomlError('Unexpected character, expected "nan"'));
17255       }
17256     }
17257
17258     parseNan2() {
17259       if (this.char === CHAR_n) {
17260         return this.return(NaN);
17261       } else {
17262         throw this.error(new TomlError('Unexpected character, expected "nan"'));
17263       }
17264     }
17265     /* KEYS, barewords or basic, literal, or dotted */
17266
17267
17268     parseKeyword() {
17269       if (this.char === CHAR_QUOT) {
17270         return this.next(this.parseBasicString);
17271       } else if (this.char === CHAR_APOS) {
17272         return this.next(this.parseLiteralString);
17273       } else {
17274         return this.goto(this.parseBareKey);
17275       }
17276     }
17277     /* KEYS: barewords */
17278
17279
17280     parseBareKey() {
17281       do {
17282         if (this.char === Parser.END) {
17283           throw this.error(new TomlError('Key ended without value'));
17284         } else if (isAlphaNumHyphen(this.char)) {
17285           this.consume();
17286         } else if (this.state.buf.length === 0) {
17287           throw this.error(new TomlError('Empty bare keys are not allowed'));
17288         } else {
17289           return this.returnNow();
17290         }
17291       } while (this.nextChar());
17292     }
17293     /* STRINGS, single quoted (literal) */
17294
17295
17296     parseSingleString() {
17297       if (this.char === CHAR_APOS) {
17298         return this.next(this.parseLiteralMultiStringMaybe);
17299       } else {
17300         return this.goto(this.parseLiteralString);
17301       }
17302     }
17303
17304     parseLiteralString() {
17305       do {
17306         if (this.char === CHAR_APOS) {
17307           return this.return();
17308         } else if (this.atEndOfLine()) {
17309           throw this.error(new TomlError('Unterminated string'));
17310         } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
17311           throw this.errorControlCharInString();
17312         } else {
17313           this.consume();
17314         }
17315       } while (this.nextChar());
17316     }
17317
17318     parseLiteralMultiStringMaybe() {
17319       if (this.char === CHAR_APOS) {
17320         return this.next(this.parseLiteralMultiString);
17321       } else {
17322         return this.returnNow();
17323       }
17324     }
17325
17326     parseLiteralMultiString() {
17327       if (this.char === CTRL_M) {
17328         return null;
17329       } else if (this.char === CTRL_J) {
17330         return this.next(this.parseLiteralMultiStringContent);
17331       } else {
17332         return this.goto(this.parseLiteralMultiStringContent);
17333       }
17334     }
17335
17336     parseLiteralMultiStringContent() {
17337       do {
17338         if (this.char === CHAR_APOS) {
17339           return this.next(this.parseLiteralMultiEnd);
17340         } else if (this.char === Parser.END) {
17341           throw this.error(new TomlError('Unterminated multi-line string'));
17342         } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
17343           throw this.errorControlCharInString();
17344         } else {
17345           this.consume();
17346         }
17347       } while (this.nextChar());
17348     }
17349
17350     parseLiteralMultiEnd() {
17351       if (this.char === CHAR_APOS) {
17352         return this.next(this.parseLiteralMultiEnd2);
17353       } else {
17354         this.state.buf += "'";
17355         return this.goto(this.parseLiteralMultiStringContent);
17356       }
17357     }
17358
17359     parseLiteralMultiEnd2() {
17360       if (this.char === CHAR_APOS) {
17361         return this.return();
17362       } else {
17363         this.state.buf += "''";
17364         return this.goto(this.parseLiteralMultiStringContent);
17365       }
17366     }
17367     /* STRINGS double quoted */
17368
17369
17370     parseDoubleString() {
17371       if (this.char === CHAR_QUOT) {
17372         return this.next(this.parseMultiStringMaybe);
17373       } else {
17374         return this.goto(this.parseBasicString);
17375       }
17376     }
17377
17378     parseBasicString() {
17379       do {
17380         if (this.char === CHAR_BSOL) {
17381           return this.call(this.parseEscape, this.recordEscapeReplacement);
17382         } else if (this.char === CHAR_QUOT) {
17383           return this.return();
17384         } else if (this.atEndOfLine()) {
17385           throw this.error(new TomlError('Unterminated string'));
17386         } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
17387           throw this.errorControlCharInString();
17388         } else {
17389           this.consume();
17390         }
17391       } while (this.nextChar());
17392     }
17393
17394     recordEscapeReplacement(replacement) {
17395       this.state.buf += replacement;
17396       return this.goto(this.parseBasicString);
17397     }
17398
17399     parseMultiStringMaybe() {
17400       if (this.char === CHAR_QUOT) {
17401         return this.next(this.parseMultiString);
17402       } else {
17403         return this.returnNow();
17404       }
17405     }
17406
17407     parseMultiString() {
17408       if (this.char === CTRL_M) {
17409         return null;
17410       } else if (this.char === CTRL_J) {
17411         return this.next(this.parseMultiStringContent);
17412       } else {
17413         return this.goto(this.parseMultiStringContent);
17414       }
17415     }
17416
17417     parseMultiStringContent() {
17418       do {
17419         if (this.char === CHAR_BSOL) {
17420           return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
17421         } else if (this.char === CHAR_QUOT) {
17422           return this.next(this.parseMultiEnd);
17423         } else if (this.char === Parser.END) {
17424           throw this.error(new TomlError('Unterminated multi-line string'));
17425         } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
17426           throw this.errorControlCharInString();
17427         } else {
17428           this.consume();
17429         }
17430       } while (this.nextChar());
17431     }
17432
17433     errorControlCharInString() {
17434       let displayCode = '\\u00';
17435
17436       if (this.char < 16) {
17437         displayCode += '0';
17438       }
17439
17440       displayCode += this.char.toString(16);
17441       return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
17442     }
17443
17444     recordMultiEscapeReplacement(replacement) {
17445       this.state.buf += replacement;
17446       return this.goto(this.parseMultiStringContent);
17447     }
17448
17449     parseMultiEnd() {
17450       if (this.char === CHAR_QUOT) {
17451         return this.next(this.parseMultiEnd2);
17452       } else {
17453         this.state.buf += '"';
17454         return this.goto(this.parseMultiStringContent);
17455       }
17456     }
17457
17458     parseMultiEnd2() {
17459       if (this.char === CHAR_QUOT) {
17460         return this.return();
17461       } else {
17462         this.state.buf += '""';
17463         return this.goto(this.parseMultiStringContent);
17464       }
17465     }
17466
17467     parseMultiEscape() {
17468       if (this.char === CTRL_M || this.char === CTRL_J) {
17469         return this.next(this.parseMultiTrim);
17470       } else if (this.char === CHAR_SP || this.char === CTRL_I) {
17471         return this.next(this.parsePreMultiTrim);
17472       } else {
17473         return this.goto(this.parseEscape);
17474       }
17475     }
17476
17477     parsePreMultiTrim() {
17478       if (this.char === CHAR_SP || this.char === CTRL_I) {
17479         return null;
17480       } else if (this.char === CTRL_M || this.char === CTRL_J) {
17481         return this.next(this.parseMultiTrim);
17482       } else {
17483         throw this.error(new TomlError("Can't escape whitespace"));
17484       }
17485     }
17486
17487     parseMultiTrim() {
17488       // explicitly whitespace here, END should follow the same path as chars
17489       if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
17490         return null;
17491       } else {
17492         return this.returnNow();
17493       }
17494     }
17495
17496     parseEscape() {
17497       if (this.char in escapes) {
17498         return this.return(escapes[this.char]);
17499       } else if (this.char === CHAR_u) {
17500         return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
17501       } else if (this.char === CHAR_U) {
17502         return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
17503       } else {
17504         throw this.error(new TomlError('Unknown escape character: ' + this.char));
17505       }
17506     }
17507
17508     parseUnicodeReturn(char) {
17509       try {
17510         const codePoint = parseInt(char, 16);
17511
17512         if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
17513           throw this.error(new TomlError('Invalid unicode, character in range 0xD800 - 0xDFFF is reserved'));
17514         }
17515
17516         return this.returnNow(String.fromCodePoint(codePoint));
17517       } catch (err) {
17518         throw this.error(TomlError.wrap(err));
17519       }
17520     }
17521
17522     parseSmallUnicode() {
17523       if (!isHexit(this.char)) {
17524         throw this.error(new TomlError('Invalid character in unicode sequence, expected hex'));
17525       } else {
17526         this.consume();
17527         if (this.state.buf.length >= 4) return this.return();
17528       }
17529     }
17530
17531     parseLargeUnicode() {
17532       if (!isHexit(this.char)) {
17533         throw this.error(new TomlError('Invalid character in unicode sequence, expected hex'));
17534       } else {
17535         this.consume();
17536         if (this.state.buf.length >= 8) return this.return();
17537       }
17538     }
17539     /* NUMBERS */
17540
17541
17542     parseNumberSign() {
17543       this.consume();
17544       return this.next(this.parseMaybeSignedInfOrNan);
17545     }
17546
17547     parseMaybeSignedInfOrNan() {
17548       if (this.char === CHAR_i) {
17549         return this.next(this.parseInf);
17550       } else if (this.char === CHAR_n) {
17551         return this.next(this.parseNan);
17552       } else {
17553         return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
17554       }
17555     }
17556
17557     parseNumberIntegerStart() {
17558       if (this.char === CHAR_0) {
17559         this.consume();
17560         return this.next(this.parseNumberIntegerExponentOrDecimal);
17561       } else {
17562         return this.goto(this.parseNumberInteger);
17563       }
17564     }
17565
17566     parseNumberIntegerExponentOrDecimal() {
17567       if (this.char === CHAR_PERIOD) {
17568         this.consume();
17569         return this.call(this.parseNoUnder, this.parseNumberFloat);
17570       } else if (this.char === CHAR_E || this.char === CHAR_e) {
17571         this.consume();
17572         return this.next(this.parseNumberExponentSign);
17573       } else {
17574         return this.returnNow(Integer(this.state.buf));
17575       }
17576     }
17577
17578     parseNumberInteger() {
17579       if (isDigit(this.char)) {
17580         this.consume();
17581       } else if (this.char === CHAR_LOWBAR) {
17582         return this.call(this.parseNoUnder);
17583       } else if (this.char === CHAR_E || this.char === CHAR_e) {
17584         this.consume();
17585         return this.next(this.parseNumberExponentSign);
17586       } else if (this.char === CHAR_PERIOD) {
17587         this.consume();
17588         return this.call(this.parseNoUnder, this.parseNumberFloat);
17589       } else {
17590         const result = Integer(this.state.buf);
17591         /* istanbul ignore if */
17592
17593         if (result.isNaN()) {
17594           throw this.error(new TomlError('Invalid number'));
17595         } else {
17596           return this.returnNow(result);
17597         }
17598       }
17599     }
17600
17601     parseNoUnder() {
17602       if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
17603         throw this.error(new TomlError('Unexpected character, expected digit'));
17604       } else if (this.atEndOfWord()) {
17605         throw this.error(new TomlError('Incomplete number'));
17606       }
17607
17608       return this.returnNow();
17609     }
17610
17611     parseNoUnderHexOctBinLiteral() {
17612       if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
17613         throw this.error(new TomlError('Unexpected character, expected digit'));
17614       } else if (this.atEndOfWord()) {
17615         throw this.error(new TomlError('Incomplete number'));
17616       }
17617
17618       return this.returnNow();
17619     }
17620
17621     parseNumberFloat() {
17622       if (this.char === CHAR_LOWBAR) {
17623         return this.call(this.parseNoUnder, this.parseNumberFloat);
17624       } else if (isDigit(this.char)) {
17625         this.consume();
17626       } else if (this.char === CHAR_E || this.char === CHAR_e) {
17627         this.consume();
17628         return this.next(this.parseNumberExponentSign);
17629       } else {
17630         return this.returnNow(Float(this.state.buf));
17631       }
17632     }
17633
17634     parseNumberExponentSign() {
17635       if (isDigit(this.char)) {
17636         return this.goto(this.parseNumberExponent);
17637       } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS$1) {
17638         this.consume();
17639         this.call(this.parseNoUnder, this.parseNumberExponent);
17640       } else {
17641         throw this.error(new TomlError('Unexpected character, expected -, + or digit'));
17642       }
17643     }
17644
17645     parseNumberExponent() {
17646       if (isDigit(this.char)) {
17647         this.consume();
17648       } else if (this.char === CHAR_LOWBAR) {
17649         return this.call(this.parseNoUnder);
17650       } else {
17651         return this.returnNow(Float(this.state.buf));
17652       }
17653     }
17654     /* NUMBERS or DATETIMES  */
17655
17656
17657     parseNumberOrDateTime() {
17658       if (this.char === CHAR_0) {
17659         this.consume();
17660         return this.next(this.parseNumberBaseOrDateTime);
17661       } else {
17662         return this.goto(this.parseNumberOrDateTimeOnly);
17663       }
17664     }
17665
17666     parseNumberOrDateTimeOnly() {
17667       // note, if two zeros are in a row then it MUST be a date
17668       if (this.char === CHAR_LOWBAR) {
17669         return this.call(this.parseNoUnder, this.parseNumberInteger);
17670       } else if (isDigit(this.char)) {
17671         this.consume();
17672         if (this.state.buf.length > 4) this.next(this.parseNumberInteger);
17673       } else if (this.char === CHAR_E || this.char === CHAR_e) {
17674         this.consume();
17675         return this.next(this.parseNumberExponentSign);
17676       } else if (this.char === CHAR_PERIOD) {
17677         this.consume();
17678         return this.call(this.parseNoUnder, this.parseNumberFloat);
17679       } else if (this.char === CHAR_HYPHEN) {
17680         return this.goto(this.parseDateTime);
17681       } else if (this.char === CHAR_COLON) {
17682         return this.goto(this.parseOnlyTimeHour);
17683       } else {
17684         return this.returnNow(Integer(this.state.buf));
17685       }
17686     }
17687
17688     parseDateTimeOnly() {
17689       if (this.state.buf.length < 4) {
17690         if (isDigit(this.char)) {
17691           return this.consume();
17692         } else if (this.char === CHAR_COLON) {
17693           return this.goto(this.parseOnlyTimeHour);
17694         } else {
17695           throw this.error(new TomlError('Expected digit while parsing year part of a date'));
17696         }
17697       } else {
17698         if (this.char === CHAR_HYPHEN) {
17699           return this.goto(this.parseDateTime);
17700         } else {
17701           throw this.error(new TomlError('Expected hyphen (-) while parsing year part of date'));
17702         }
17703       }
17704     }
17705
17706     parseNumberBaseOrDateTime() {
17707       if (this.char === CHAR_b) {
17708         this.consume();
17709         return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
17710       } else if (this.char === CHAR_o) {
17711         this.consume();
17712         return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
17713       } else if (this.char === CHAR_x) {
17714         this.consume();
17715         return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
17716       } else if (this.char === CHAR_PERIOD) {
17717         return this.goto(this.parseNumberInteger);
17718       } else if (isDigit(this.char)) {
17719         return this.goto(this.parseDateTimeOnly);
17720       } else {
17721         return this.returnNow(Integer(this.state.buf));
17722       }
17723     }
17724
17725     parseIntegerHex() {
17726       if (isHexit(this.char)) {
17727         this.consume();
17728       } else if (this.char === CHAR_LOWBAR) {
17729         return this.call(this.parseNoUnderHexOctBinLiteral);
17730       } else {
17731         const result = Integer(this.state.buf);
17732         /* istanbul ignore if */
17733
17734         if (result.isNaN()) {
17735           throw this.error(new TomlError('Invalid number'));
17736         } else {
17737           return this.returnNow(result);
17738         }
17739       }
17740     }
17741
17742     parseIntegerOct() {
17743       if (isOctit(this.char)) {
17744         this.consume();
17745       } else if (this.char === CHAR_LOWBAR) {
17746         return this.call(this.parseNoUnderHexOctBinLiteral);
17747       } else {
17748         const result = Integer(this.state.buf);
17749         /* istanbul ignore if */
17750
17751         if (result.isNaN()) {
17752           throw this.error(new TomlError('Invalid number'));
17753         } else {
17754           return this.returnNow(result);
17755         }
17756       }
17757     }
17758
17759     parseIntegerBin() {
17760       if (isBit(this.char)) {
17761         this.consume();
17762       } else if (this.char === CHAR_LOWBAR) {
17763         return this.call(this.parseNoUnderHexOctBinLiteral);
17764       } else {
17765         const result = Integer(this.state.buf);
17766         /* istanbul ignore if */
17767
17768         if (result.isNaN()) {
17769           throw this.error(new TomlError('Invalid number'));
17770         } else {
17771           return this.returnNow(result);
17772         }
17773       }
17774     }
17775     /* DATETIME */
17776
17777
17778     parseDateTime() {
17779       // we enter here having just consumed the year and about to consume the hyphen
17780       if (this.state.buf.length < 4) {
17781         throw this.error(new TomlError('Years less than 1000 must be zero padded to four characters'));
17782       }
17783
17784       this.state.result = this.state.buf;
17785       this.state.buf = '';
17786       return this.next(this.parseDateMonth);
17787     }
17788
17789     parseDateMonth() {
17790       if (this.char === CHAR_HYPHEN) {
17791         if (this.state.buf.length < 2) {
17792           throw this.error(new TomlError('Months less than 10 must be zero padded to two characters'));
17793         }
17794
17795         this.state.result += '-' + this.state.buf;
17796         this.state.buf = '';
17797         return this.next(this.parseDateDay);
17798       } else if (isDigit(this.char)) {
17799         this.consume();
17800       } else {
17801         throw this.error(new TomlError('Incomplete datetime'));
17802       }
17803     }
17804
17805     parseDateDay() {
17806       if (this.char === CHAR_T || this.char === CHAR_SP) {
17807         if (this.state.buf.length < 2) {
17808           throw this.error(new TomlError('Days less than 10 must be zero padded to two characters'));
17809         }
17810
17811         this.state.result += '-' + this.state.buf;
17812         this.state.buf = '';
17813         return this.next(this.parseStartTimeHour);
17814       } else if (this.atEndOfWord()) {
17815         return this.returnNow(createDate(this.state.result + '-' + this.state.buf));
17816       } else if (isDigit(this.char)) {
17817         this.consume();
17818       } else {
17819         throw this.error(new TomlError('Incomplete datetime'));
17820       }
17821     }
17822
17823     parseStartTimeHour() {
17824       if (this.atEndOfWord()) {
17825         return this.returnNow(createDate(this.state.result));
17826       } else {
17827         return this.goto(this.parseTimeHour);
17828       }
17829     }
17830
17831     parseTimeHour() {
17832       if (this.char === CHAR_COLON) {
17833         if (this.state.buf.length < 2) {
17834           throw this.error(new TomlError('Hours less than 10 must be zero padded to two characters'));
17835         }
17836
17837         this.state.result += 'T' + this.state.buf;
17838         this.state.buf = '';
17839         return this.next(this.parseTimeMin);
17840       } else if (isDigit(this.char)) {
17841         this.consume();
17842       } else {
17843         throw this.error(new TomlError('Incomplete datetime'));
17844       }
17845     }
17846
17847     parseTimeMin() {
17848       if (this.state.buf.length < 2 && isDigit(this.char)) {
17849         this.consume();
17850       } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
17851         this.state.result += ':' + this.state.buf;
17852         this.state.buf = '';
17853         return this.next(this.parseTimeSec);
17854       } else {
17855         throw this.error(new TomlError('Incomplete datetime'));
17856       }
17857     }
17858
17859     parseTimeSec() {
17860       if (isDigit(this.char)) {
17861         this.consume();
17862
17863         if (this.state.buf.length === 2) {
17864           this.state.result += ':' + this.state.buf;
17865           this.state.buf = '';
17866           return this.next(this.parseTimeZoneOrFraction);
17867         }
17868       } else {
17869         throw this.error(new TomlError('Incomplete datetime'));
17870       }
17871     }
17872
17873     parseOnlyTimeHour() {
17874       /* istanbul ignore else */
17875       if (this.char === CHAR_COLON) {
17876         if (this.state.buf.length < 2) {
17877           throw this.error(new TomlError('Hours less than 10 must be zero padded to two characters'));
17878         }
17879
17880         this.state.result = this.state.buf;
17881         this.state.buf = '';
17882         return this.next(this.parseOnlyTimeMin);
17883       } else {
17884         throw this.error(new TomlError('Incomplete time'));
17885       }
17886     }
17887
17888     parseOnlyTimeMin() {
17889       if (this.state.buf.length < 2 && isDigit(this.char)) {
17890         this.consume();
17891       } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
17892         this.state.result += ':' + this.state.buf;
17893         this.state.buf = '';
17894         return this.next(this.parseOnlyTimeSec);
17895       } else {
17896         throw this.error(new TomlError('Incomplete time'));
17897       }
17898     }
17899
17900     parseOnlyTimeSec() {
17901       if (isDigit(this.char)) {
17902         this.consume();
17903
17904         if (this.state.buf.length === 2) {
17905           return this.next(this.parseOnlyTimeFractionMaybe);
17906         }
17907       } else {
17908         throw this.error(new TomlError('Incomplete time'));
17909       }
17910     }
17911
17912     parseOnlyTimeFractionMaybe() {
17913       this.state.result += ':' + this.state.buf;
17914
17915       if (this.char === CHAR_PERIOD) {
17916         this.state.buf = '';
17917         this.next(this.parseOnlyTimeFraction);
17918       } else {
17919         return this.return(createTime(this.state.result));
17920       }
17921     }
17922
17923     parseOnlyTimeFraction() {
17924       if (isDigit(this.char)) {
17925         this.consume();
17926       } else if (this.atEndOfWord()) {
17927         if (this.state.buf.length === 0) throw this.error(new TomlError('Expected digit in milliseconds'));
17928         return this.returnNow(createTime(this.state.result + '.' + this.state.buf));
17929       } else {
17930         throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z'));
17931       }
17932     }
17933
17934     parseTimeZoneOrFraction() {
17935       if (this.char === CHAR_PERIOD) {
17936         this.consume();
17937         this.next(this.parseDateTimeFraction);
17938       } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS$1) {
17939         this.consume();
17940         this.next(this.parseTimeZoneHour);
17941       } else if (this.char === CHAR_Z) {
17942         this.consume();
17943         return this.return(createDateTime(this.state.result + this.state.buf));
17944       } else if (this.atEndOfWord()) {
17945         return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
17946       } else {
17947         throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z'));
17948       }
17949     }
17950
17951     parseDateTimeFraction() {
17952       if (isDigit(this.char)) {
17953         this.consume();
17954       } else if (this.state.buf.length === 1) {
17955         throw this.error(new TomlError('Expected digit in milliseconds'));
17956       } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS$1) {
17957         this.consume();
17958         this.next(this.parseTimeZoneHour);
17959       } else if (this.char === CHAR_Z) {
17960         this.consume();
17961         return this.return(createDateTime(this.state.result + this.state.buf));
17962       } else if (this.atEndOfWord()) {
17963         return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
17964       } else {
17965         throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z'));
17966       }
17967     }
17968
17969     parseTimeZoneHour() {
17970       if (isDigit(this.char)) {
17971         this.consume(); // FIXME: No more regexps
17972
17973         if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep);
17974       } else {
17975         throw this.error(new TomlError('Unexpected character in datetime, expected digit'));
17976       }
17977     }
17978
17979     parseTimeZoneSep() {
17980       if (this.char === CHAR_COLON) {
17981         this.consume();
17982         this.next(this.parseTimeZoneMin);
17983       } else {
17984         throw this.error(new TomlError('Unexpected character in datetime, expected colon'));
17985       }
17986     }
17987
17988     parseTimeZoneMin() {
17989       if (isDigit(this.char)) {
17990         this.consume();
17991         if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf));
17992       } else {
17993         throw this.error(new TomlError('Unexpected character in datetime, expected digit'));
17994       }
17995     }
17996     /* BOOLEAN */
17997
17998
17999     parseBoolean() {
18000       /* istanbul ignore else */
18001       if (this.char === CHAR_t) {
18002         this.consume();
18003         return this.next(this.parseTrue_r);
18004       } else if (this.char === CHAR_f) {
18005         this.consume();
18006         return this.next(this.parseFalse_a);
18007       }
18008     }
18009
18010     parseTrue_r() {
18011       if (this.char === CHAR_r) {
18012         this.consume();
18013         return this.next(this.parseTrue_u);
18014       } else {
18015         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18016       }
18017     }
18018
18019     parseTrue_u() {
18020       if (this.char === CHAR_u) {
18021         this.consume();
18022         return this.next(this.parseTrue_e);
18023       } else {
18024         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18025       }
18026     }
18027
18028     parseTrue_e() {
18029       if (this.char === CHAR_e) {
18030         return this.return(true);
18031       } else {
18032         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18033       }
18034     }
18035
18036     parseFalse_a() {
18037       if (this.char === CHAR_a) {
18038         this.consume();
18039         return this.next(this.parseFalse_l);
18040       } else {
18041         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18042       }
18043     }
18044
18045     parseFalse_l() {
18046       if (this.char === CHAR_l) {
18047         this.consume();
18048         return this.next(this.parseFalse_s);
18049       } else {
18050         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18051       }
18052     }
18053
18054     parseFalse_s() {
18055       if (this.char === CHAR_s) {
18056         this.consume();
18057         return this.next(this.parseFalse_e);
18058       } else {
18059         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18060       }
18061     }
18062
18063     parseFalse_e() {
18064       if (this.char === CHAR_e) {
18065         return this.return(false);
18066       } else {
18067         throw this.error(new TomlError('Invalid boolean, expected true or false'));
18068       }
18069     }
18070     /* INLINE LISTS */
18071
18072
18073     parseInlineList() {
18074       if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
18075         return null;
18076       } else if (this.char === Parser.END) {
18077         throw this.error(new TomlError('Unterminated inline array'));
18078       } else if (this.char === CHAR_NUM) {
18079         return this.call(this.parseComment);
18080       } else if (this.char === CHAR_RSQB) {
18081         return this.return(this.state.resultArr || InlineList());
18082       } else {
18083         return this.callNow(this.parseValue, this.recordInlineListValue);
18084       }
18085     }
18086
18087     recordInlineListValue(value) {
18088       if (this.state.resultArr) {
18089         const listType = this.state.resultArr[_contentType];
18090         const valueType = tomlType(value);
18091
18092         if (listType !== valueType) {
18093           throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
18094         }
18095       } else {
18096         this.state.resultArr = InlineList(tomlType(value));
18097       }
18098
18099       if (isFloat(value) || isInteger(value)) {
18100         // unbox now that we've verified they're ok
18101         this.state.resultArr.push(value.valueOf());
18102       } else {
18103         this.state.resultArr.push(value);
18104       }
18105
18106       return this.goto(this.parseInlineListNext);
18107     }
18108
18109     parseInlineListNext() {
18110       if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
18111         return null;
18112       } else if (this.char === CHAR_NUM) {
18113         return this.call(this.parseComment);
18114       } else if (this.char === CHAR_COMMA$2) {
18115         return this.next(this.parseInlineList);
18116       } else if (this.char === CHAR_RSQB) {
18117         return this.goto(this.parseInlineList);
18118       } else {
18119         throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])'));
18120       }
18121     }
18122     /* INLINE TABLE */
18123
18124
18125     parseInlineTable() {
18126       if (this.char === CHAR_SP || this.char === CTRL_I) {
18127         return null;
18128       } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
18129         throw this.error(new TomlError('Unterminated inline array'));
18130       } else if (this.char === CHAR_RCUB) {
18131         return this.return(this.state.resultTable || InlineTable());
18132       } else {
18133         if (!this.state.resultTable) this.state.resultTable = InlineTable();
18134         return this.callNow(this.parseAssign, this.recordInlineTableValue);
18135       }
18136     }
18137
18138     recordInlineTableValue(kv) {
18139       let target = this.state.resultTable;
18140       let finalKey = kv.key.pop();
18141
18142       for (let kw of kv.key) {
18143         if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
18144           throw this.error(new TomlError("Can't redefine existing key"));
18145         }
18146
18147         target = target[kw] = target[kw] || Table();
18148       }
18149
18150       if (hasKey(target, finalKey)) {
18151         throw this.error(new TomlError("Can't redefine existing key"));
18152       }
18153
18154       if (isInteger(kv.value) || isFloat(kv.value)) {
18155         target[finalKey] = kv.value.valueOf();
18156       } else {
18157         target[finalKey] = kv.value;
18158       }
18159
18160       return this.goto(this.parseInlineTableNext);
18161     }
18162
18163     parseInlineTableNext() {
18164       if (this.char === CHAR_SP || this.char === CTRL_I) {
18165         return null;
18166       } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
18167         throw this.error(new TomlError('Unterminated inline array'));
18168       } else if (this.char === CHAR_COMMA$2) {
18169         return this.next(this.parseInlineTable);
18170       } else if (this.char === CHAR_RCUB) {
18171         return this.goto(this.parseInlineTable);
18172       } else {
18173         throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])'));
18174       }
18175     }
18176
18177   }
18178
18179   return TOMLParser;
18180 }
18181
18182 var parsePrettyError = prettyError$1;
18183
18184 function prettyError$1(err, buf) {
18185   /* istanbul ignore if */
18186   if (err.pos == null || err.line == null) return err;
18187   let msg = err.message;
18188   msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:\n`;
18189   /* istanbul ignore else */
18190
18191   if (buf && buf.split) {
18192     const lines = buf.split(/\n/);
18193     const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
18194     let linePadding = ' ';
18195
18196     while (linePadding.length < lineNumWidth) linePadding += ' ';
18197
18198     for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
18199       let lineNum = String(ii + 1);
18200       if (lineNum.length < lineNumWidth) lineNum = ' ' + lineNum;
18201
18202       if (err.line === ii) {
18203         msg += lineNum + '> ' + lines[ii] + '\n';
18204         msg += linePadding + '  ';
18205
18206         for (let hh = 0; hh < err.col; ++hh) {
18207           msg += ' ';
18208         }
18209
18210         msg += '^\n';
18211       } else {
18212         msg += lineNum + ': ' + lines[ii] + '\n';
18213       }
18214     }
18215   }
18216
18217   err.message = msg + '\n';
18218   return err;
18219 }
18220
18221 var parseString_1 = parseString$1;
18222 const TOMLParser = tomlParser.exports;
18223 const prettyError = parsePrettyError;
18224
18225 function parseString$1(str) {
18226   if (global.Buffer && global.Buffer.isBuffer(str)) {
18227     str = str.toString('utf8');
18228   }
18229
18230   const parser = new TOMLParser();
18231
18232   try {
18233     parser.parse(str);
18234     return parser.finish();
18235   } catch (err) {
18236     throw prettyError(err, str);
18237   }
18238 }
18239
18240 const parse$b = parseString_1;
18241
18242 var loadToml$1 = function (filePath, content) {
18243   try {
18244     return parse$b(content);
18245   } catch (error) {
18246     error.message = `TOML Error in ${filePath}:\n${error.message}`;
18247     throw error;
18248   }
18249 };
18250
18251 // This is a generated file. Do not edit.
18252 var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
18253 var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
18254 var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
18255 var unicode = {
18256   Space_Separator: Space_Separator,
18257   ID_Start: ID_Start,
18258   ID_Continue: ID_Continue
18259 };
18260 var util$6 = {
18261   isSpaceSeparator(c) {
18262     return typeof c === 'string' && unicode.Space_Separator.test(c);
18263   },
18264
18265   isIdStartChar(c) {
18266     return typeof c === 'string' && (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c === '$' || c === '_' || unicode.ID_Start.test(c));
18267   },
18268
18269   isIdContinueChar(c) {
18270     return typeof c === 'string' && (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9' || c === '$' || c === '_' || c === '\u200C' || c === '\u200D' || unicode.ID_Continue.test(c));
18271   },
18272
18273   isDigit(c) {
18274     return typeof c === 'string' && /[0-9]/.test(c);
18275   },
18276
18277   isHexDigit(c) {
18278     return typeof c === 'string' && /[0-9A-Fa-f]/.test(c);
18279   }
18280
18281 };
18282 let source$1;
18283 let parseState;
18284 let stack;
18285 let pos;
18286 let line$z;
18287 let column;
18288 let token;
18289 let key;
18290 let root$9;
18291
18292 var parse$a = function parse(text, reviver) {
18293   source$1 = String(text);
18294   parseState = 'start';
18295   stack = [];
18296   pos = 0;
18297   line$z = 1;
18298   column = 0;
18299   token = undefined;
18300   key = undefined;
18301   root$9 = undefined;
18302
18303   do {
18304     token = lex(); // This code is unreachable.
18305     // if (!parseStates[parseState]) {
18306     //     throw invalidParseState()
18307     // }
18308
18309     parseStates[parseState]();
18310   } while (token.type !== 'eof');
18311
18312   if (typeof reviver === 'function') {
18313     return internalize({
18314       '': root$9
18315     }, '', reviver);
18316   }
18317
18318   return root$9;
18319 };
18320
18321 function internalize(holder, name, reviver) {
18322   const value = holder[name];
18323
18324   if (value != null && typeof value === 'object') {
18325     for (const key in value) {
18326       const replacement = internalize(value, key, reviver);
18327
18328       if (replacement === undefined) {
18329         delete value[key];
18330       } else {
18331         value[key] = replacement;
18332       }
18333     }
18334   }
18335
18336   return reviver.call(holder, name, value);
18337 }
18338
18339 let lexState;
18340 let buffer$2;
18341 let doubleQuote;
18342 let sign;
18343 let c;
18344
18345 function lex() {
18346   lexState = 'default';
18347   buffer$2 = '';
18348   doubleQuote = false;
18349   sign = 1;
18350
18351   for (;;) {
18352     c = peek(); // This code is unreachable.
18353     // if (!lexStates[lexState]) {
18354     //     throw invalidLexState(lexState)
18355     // }
18356
18357     const token = lexStates[lexState]();
18358
18359     if (token) {
18360       return token;
18361     }
18362   }
18363 }
18364
18365 function peek() {
18366   if (source$1[pos]) {
18367     return String.fromCodePoint(source$1.codePointAt(pos));
18368   }
18369 }
18370
18371 function read$4() {
18372   const c = peek();
18373
18374   if (c === '\n') {
18375     line$z++;
18376     column = 0;
18377   } else if (c) {
18378     column += c.length;
18379   } else {
18380     column++;
18381   }
18382
18383   if (c) {
18384     pos += c.length;
18385   }
18386
18387   return c;
18388 }
18389
18390 const lexStates = {
18391   default() {
18392     switch (c) {
18393       case '\t':
18394       case '\v':
18395       case '\f':
18396       case ' ':
18397       case '\u00A0':
18398       case '\uFEFF':
18399       case '\n':
18400       case '\r':
18401       case '\u2028':
18402       case '\u2029':
18403         read$4();
18404         return;
18405
18406       case '/':
18407         read$4();
18408         lexState = 'comment';
18409         return;
18410
18411       case undefined:
18412         read$4();
18413         return newToken('eof');
18414     }
18415
18416     if (util$6.isSpaceSeparator(c)) {
18417       read$4();
18418       return;
18419     } // This code is unreachable.
18420     // if (!lexStates[parseState]) {
18421     //     throw invalidLexState(parseState)
18422     // }
18423
18424
18425     return lexStates[parseState]();
18426   },
18427
18428   comment() {
18429     switch (c) {
18430       case '*':
18431         read$4();
18432         lexState = 'multiLineComment';
18433         return;
18434
18435       case '/':
18436         read$4();
18437         lexState = 'singleLineComment';
18438         return;
18439     }
18440
18441     throw invalidChar(read$4());
18442   },
18443
18444   multiLineComment() {
18445     switch (c) {
18446       case '*':
18447         read$4();
18448         lexState = 'multiLineCommentAsterisk';
18449         return;
18450
18451       case undefined:
18452         throw invalidChar(read$4());
18453     }
18454
18455     read$4();
18456   },
18457
18458   multiLineCommentAsterisk() {
18459     switch (c) {
18460       case '*':
18461         read$4();
18462         return;
18463
18464       case '/':
18465         read$4();
18466         lexState = 'default';
18467         return;
18468
18469       case undefined:
18470         throw invalidChar(read$4());
18471     }
18472
18473     read$4();
18474     lexState = 'multiLineComment';
18475   },
18476
18477   singleLineComment() {
18478     switch (c) {
18479       case '\n':
18480       case '\r':
18481       case '\u2028':
18482       case '\u2029':
18483         read$4();
18484         lexState = 'default';
18485         return;
18486
18487       case undefined:
18488         read$4();
18489         return newToken('eof');
18490     }
18491
18492     read$4();
18493   },
18494
18495   value() {
18496     switch (c) {
18497       case '{':
18498       case '[':
18499         return newToken('punctuator', read$4());
18500
18501       case 'n':
18502         read$4();
18503         literal$1('ull');
18504         return newToken('null', null);
18505
18506       case 't':
18507         read$4();
18508         literal$1('rue');
18509         return newToken('boolean', true);
18510
18511       case 'f':
18512         read$4();
18513         literal$1('alse');
18514         return newToken('boolean', false);
18515
18516       case '-':
18517       case '+':
18518         if (read$4() === '-') {
18519           sign = -1;
18520         }
18521
18522         lexState = 'sign';
18523         return;
18524
18525       case '.':
18526         buffer$2 = read$4();
18527         lexState = 'decimalPointLeading';
18528         return;
18529
18530       case '0':
18531         buffer$2 = read$4();
18532         lexState = 'zero';
18533         return;
18534
18535       case '1':
18536       case '2':
18537       case '3':
18538       case '4':
18539       case '5':
18540       case '6':
18541       case '7':
18542       case '8':
18543       case '9':
18544         buffer$2 = read$4();
18545         lexState = 'decimalInteger';
18546         return;
18547
18548       case 'I':
18549         read$4();
18550         literal$1('nfinity');
18551         return newToken('numeric', Infinity);
18552
18553       case 'N':
18554         read$4();
18555         literal$1('aN');
18556         return newToken('numeric', NaN);
18557
18558       case '"':
18559       case "'":
18560         doubleQuote = read$4() === '"';
18561         buffer$2 = '';
18562         lexState = 'string';
18563         return;
18564     }
18565
18566     throw invalidChar(read$4());
18567   },
18568
18569   identifierNameStartEscape() {
18570     if (c !== 'u') {
18571       throw invalidChar(read$4());
18572     }
18573
18574     read$4();
18575     const u = unicodeEscape();
18576
18577     switch (u) {
18578       case '$':
18579       case '_':
18580         break;
18581
18582       default:
18583         if (!util$6.isIdStartChar(u)) {
18584           throw invalidIdentifier();
18585         }
18586
18587         break;
18588     }
18589
18590     buffer$2 += u;
18591     lexState = 'identifierName';
18592   },
18593
18594   identifierName() {
18595     switch (c) {
18596       case '$':
18597       case '_':
18598       case '\u200C':
18599       case '\u200D':
18600         buffer$2 += read$4();
18601         return;
18602
18603       case '\\':
18604         read$4();
18605         lexState = 'identifierNameEscape';
18606         return;
18607     }
18608
18609     if (util$6.isIdContinueChar(c)) {
18610       buffer$2 += read$4();
18611       return;
18612     }
18613
18614     return newToken('identifier', buffer$2);
18615   },
18616
18617   identifierNameEscape() {
18618     if (c !== 'u') {
18619       throw invalidChar(read$4());
18620     }
18621
18622     read$4();
18623     const u = unicodeEscape();
18624
18625     switch (u) {
18626       case '$':
18627       case '_':
18628       case '\u200C':
18629       case '\u200D':
18630         break;
18631
18632       default:
18633         if (!util$6.isIdContinueChar(u)) {
18634           throw invalidIdentifier();
18635         }
18636
18637         break;
18638     }
18639
18640     buffer$2 += u;
18641     lexState = 'identifierName';
18642   },
18643
18644   sign() {
18645     switch (c) {
18646       case '.':
18647         buffer$2 = read$4();
18648         lexState = 'decimalPointLeading';
18649         return;
18650
18651       case '0':
18652         buffer$2 = read$4();
18653         lexState = 'zero';
18654         return;
18655
18656       case '1':
18657       case '2':
18658       case '3':
18659       case '4':
18660       case '5':
18661       case '6':
18662       case '7':
18663       case '8':
18664       case '9':
18665         buffer$2 = read$4();
18666         lexState = 'decimalInteger';
18667         return;
18668
18669       case 'I':
18670         read$4();
18671         literal$1('nfinity');
18672         return newToken('numeric', sign * Infinity);
18673
18674       case 'N':
18675         read$4();
18676         literal$1('aN');
18677         return newToken('numeric', NaN);
18678     }
18679
18680     throw invalidChar(read$4());
18681   },
18682
18683   zero() {
18684     switch (c) {
18685       case '.':
18686         buffer$2 += read$4();
18687         lexState = 'decimalPoint';
18688         return;
18689
18690       case 'e':
18691       case 'E':
18692         buffer$2 += read$4();
18693         lexState = 'decimalExponent';
18694         return;
18695
18696       case 'x':
18697       case 'X':
18698         buffer$2 += read$4();
18699         lexState = 'hexadecimal';
18700         return;
18701     }
18702
18703     return newToken('numeric', sign * 0);
18704   },
18705
18706   decimalInteger() {
18707     switch (c) {
18708       case '.':
18709         buffer$2 += read$4();
18710         lexState = 'decimalPoint';
18711         return;
18712
18713       case 'e':
18714       case 'E':
18715         buffer$2 += read$4();
18716         lexState = 'decimalExponent';
18717         return;
18718     }
18719
18720     if (util$6.isDigit(c)) {
18721       buffer$2 += read$4();
18722       return;
18723     }
18724
18725     return newToken('numeric', sign * Number(buffer$2));
18726   },
18727
18728   decimalPointLeading() {
18729     if (util$6.isDigit(c)) {
18730       buffer$2 += read$4();
18731       lexState = 'decimalFraction';
18732       return;
18733     }
18734
18735     throw invalidChar(read$4());
18736   },
18737
18738   decimalPoint() {
18739     switch (c) {
18740       case 'e':
18741       case 'E':
18742         buffer$2 += read$4();
18743         lexState = 'decimalExponent';
18744         return;
18745     }
18746
18747     if (util$6.isDigit(c)) {
18748       buffer$2 += read$4();
18749       lexState = 'decimalFraction';
18750       return;
18751     }
18752
18753     return newToken('numeric', sign * Number(buffer$2));
18754   },
18755
18756   decimalFraction() {
18757     switch (c) {
18758       case 'e':
18759       case 'E':
18760         buffer$2 += read$4();
18761         lexState = 'decimalExponent';
18762         return;
18763     }
18764
18765     if (util$6.isDigit(c)) {
18766       buffer$2 += read$4();
18767       return;
18768     }
18769
18770     return newToken('numeric', sign * Number(buffer$2));
18771   },
18772
18773   decimalExponent() {
18774     switch (c) {
18775       case '+':
18776       case '-':
18777         buffer$2 += read$4();
18778         lexState = 'decimalExponentSign';
18779         return;
18780     }
18781
18782     if (util$6.isDigit(c)) {
18783       buffer$2 += read$4();
18784       lexState = 'decimalExponentInteger';
18785       return;
18786     }
18787
18788     throw invalidChar(read$4());
18789   },
18790
18791   decimalExponentSign() {
18792     if (util$6.isDigit(c)) {
18793       buffer$2 += read$4();
18794       lexState = 'decimalExponentInteger';
18795       return;
18796     }
18797
18798     throw invalidChar(read$4());
18799   },
18800
18801   decimalExponentInteger() {
18802     if (util$6.isDigit(c)) {
18803       buffer$2 += read$4();
18804       return;
18805     }
18806
18807     return newToken('numeric', sign * Number(buffer$2));
18808   },
18809
18810   hexadecimal() {
18811     if (util$6.isHexDigit(c)) {
18812       buffer$2 += read$4();
18813       lexState = 'hexadecimalInteger';
18814       return;
18815     }
18816
18817     throw invalidChar(read$4());
18818   },
18819
18820   hexadecimalInteger() {
18821     if (util$6.isHexDigit(c)) {
18822       buffer$2 += read$4();
18823       return;
18824     }
18825
18826     return newToken('numeric', sign * Number(buffer$2));
18827   },
18828
18829   string() {
18830     switch (c) {
18831       case '\\':
18832         read$4();
18833         buffer$2 += escape$1();
18834         return;
18835
18836       case '"':
18837         if (doubleQuote) {
18838           read$4();
18839           return newToken('string', buffer$2);
18840         }
18841
18842         buffer$2 += read$4();
18843         return;
18844
18845       case "'":
18846         if (!doubleQuote) {
18847           read$4();
18848           return newToken('string', buffer$2);
18849         }
18850
18851         buffer$2 += read$4();
18852         return;
18853
18854       case '\n':
18855       case '\r':
18856         throw invalidChar(read$4());
18857
18858       case '\u2028':
18859       case '\u2029':
18860         separatorChar(c);
18861         break;
18862
18863       case undefined:
18864         throw invalidChar(read$4());
18865     }
18866
18867     buffer$2 += read$4();
18868   },
18869
18870   start() {
18871     switch (c) {
18872       case '{':
18873       case '[':
18874         return newToken('punctuator', read$4());
18875       // This code is unreachable since the default lexState handles eof.
18876       // case undefined:
18877       //     return newToken('eof')
18878     }
18879
18880     lexState = 'value';
18881   },
18882
18883   beforePropertyName() {
18884     switch (c) {
18885       case '$':
18886       case '_':
18887         buffer$2 = read$4();
18888         lexState = 'identifierName';
18889         return;
18890
18891       case '\\':
18892         read$4();
18893         lexState = 'identifierNameStartEscape';
18894         return;
18895
18896       case '}':
18897         return newToken('punctuator', read$4());
18898
18899       case '"':
18900       case "'":
18901         doubleQuote = read$4() === '"';
18902         lexState = 'string';
18903         return;
18904     }
18905
18906     if (util$6.isIdStartChar(c)) {
18907       buffer$2 += read$4();
18908       lexState = 'identifierName';
18909       return;
18910     }
18911
18912     throw invalidChar(read$4());
18913   },
18914
18915   afterPropertyName() {
18916     if (c === ':') {
18917       return newToken('punctuator', read$4());
18918     }
18919
18920     throw invalidChar(read$4());
18921   },
18922
18923   beforePropertyValue() {
18924     lexState = 'value';
18925   },
18926
18927   afterPropertyValue() {
18928     switch (c) {
18929       case ',':
18930       case '}':
18931         return newToken('punctuator', read$4());
18932     }
18933
18934     throw invalidChar(read$4());
18935   },
18936
18937   beforeArrayValue() {
18938     if (c === ']') {
18939       return newToken('punctuator', read$4());
18940     }
18941
18942     lexState = 'value';
18943   },
18944
18945   afterArrayValue() {
18946     switch (c) {
18947       case ',':
18948       case ']':
18949         return newToken('punctuator', read$4());
18950     }
18951
18952     throw invalidChar(read$4());
18953   },
18954
18955   end() {
18956     // This code is unreachable since it's handled by the default lexState.
18957     // if (c === undefined) {
18958     //     read()
18959     //     return newToken('eof')
18960     // }
18961     throw invalidChar(read$4());
18962   }
18963
18964 };
18965
18966 function newToken(type, value) {
18967   return {
18968     type,
18969     value,
18970     line: line$z,
18971     column
18972   };
18973 }
18974
18975 function literal$1(s) {
18976   for (const c of s) {
18977     const p = peek();
18978
18979     if (p !== c) {
18980       throw invalidChar(read$4());
18981     }
18982
18983     read$4();
18984   }
18985 }
18986
18987 function escape$1() {
18988   const c = peek();
18989
18990   switch (c) {
18991     case 'b':
18992       read$4();
18993       return '\b';
18994
18995     case 'f':
18996       read$4();
18997       return '\f';
18998
18999     case 'n':
19000       read$4();
19001       return '\n';
19002
19003     case 'r':
19004       read$4();
19005       return '\r';
19006
19007     case 't':
19008       read$4();
19009       return '\t';
19010
19011     case 'v':
19012       read$4();
19013       return '\v';
19014
19015     case '0':
19016       read$4();
19017
19018       if (util$6.isDigit(peek())) {
19019         throw invalidChar(read$4());
19020       }
19021
19022       return '\0';
19023
19024     case 'x':
19025       read$4();
19026       return hexEscape();
19027
19028     case 'u':
19029       read$4();
19030       return unicodeEscape();
19031
19032     case '\n':
19033     case '\u2028':
19034     case '\u2029':
19035       read$4();
19036       return '';
19037
19038     case '\r':
19039       read$4();
19040
19041       if (peek() === '\n') {
19042         read$4();
19043       }
19044
19045       return '';
19046
19047     case '1':
19048     case '2':
19049     case '3':
19050     case '4':
19051     case '5':
19052     case '6':
19053     case '7':
19054     case '8':
19055     case '9':
19056       throw invalidChar(read$4());
19057
19058     case undefined:
19059       throw invalidChar(read$4());
19060   }
19061
19062   return read$4();
19063 }
19064
19065 function hexEscape() {
19066   let buffer = '';
19067   let c = peek();
19068
19069   if (!util$6.isHexDigit(c)) {
19070     throw invalidChar(read$4());
19071   }
19072
19073   buffer += read$4();
19074   c = peek();
19075
19076   if (!util$6.isHexDigit(c)) {
19077     throw invalidChar(read$4());
19078   }
19079
19080   buffer += read$4();
19081   return String.fromCodePoint(parseInt(buffer, 16));
19082 }
19083
19084 function unicodeEscape() {
19085   let buffer = '';
19086   let count = 4;
19087
19088   while (count-- > 0) {
19089     const c = peek();
19090
19091     if (!util$6.isHexDigit(c)) {
19092       throw invalidChar(read$4());
19093     }
19094
19095     buffer += read$4();
19096   }
19097
19098   return String.fromCodePoint(parseInt(buffer, 16));
19099 }
19100
19101 const parseStates = {
19102   start() {
19103     if (token.type === 'eof') {
19104       throw invalidEOF();
19105     }
19106
19107     push$1();
19108   },
19109
19110   beforePropertyName() {
19111     switch (token.type) {
19112       case 'identifier':
19113       case 'string':
19114         key = token.value;
19115         parseState = 'afterPropertyName';
19116         return;
19117
19118       case 'punctuator':
19119         // This code is unreachable since it's handled by the lexState.
19120         // if (token.value !== '}') {
19121         //     throw invalidToken()
19122         // }
19123         pop();
19124         return;
19125
19126       case 'eof':
19127         throw invalidEOF();
19128     } // This code is unreachable since it's handled by the lexState.
19129     // throw invalidToken()
19130
19131   },
19132
19133   afterPropertyName() {
19134     // This code is unreachable since it's handled by the lexState.
19135     // if (token.type !== 'punctuator' || token.value !== ':') {
19136     //     throw invalidToken()
19137     // }
19138     if (token.type === 'eof') {
19139       throw invalidEOF();
19140     }
19141
19142     parseState = 'beforePropertyValue';
19143   },
19144
19145   beforePropertyValue() {
19146     if (token.type === 'eof') {
19147       throw invalidEOF();
19148     }
19149
19150     push$1();
19151   },
19152
19153   beforeArrayValue() {
19154     if (token.type === 'eof') {
19155       throw invalidEOF();
19156     }
19157
19158     if (token.type === 'punctuator' && token.value === ']') {
19159       pop();
19160       return;
19161     }
19162
19163     push$1();
19164   },
19165
19166   afterPropertyValue() {
19167     // This code is unreachable since it's handled by the lexState.
19168     // if (token.type !== 'punctuator') {
19169     //     throw invalidToken()
19170     // }
19171     if (token.type === 'eof') {
19172       throw invalidEOF();
19173     }
19174
19175     switch (token.value) {
19176       case ',':
19177         parseState = 'beforePropertyName';
19178         return;
19179
19180       case '}':
19181         pop();
19182     } // This code is unreachable since it's handled by the lexState.
19183     // throw invalidToken()
19184
19185   },
19186
19187   afterArrayValue() {
19188     // This code is unreachable since it's handled by the lexState.
19189     // if (token.type !== 'punctuator') {
19190     //     throw invalidToken()
19191     // }
19192     if (token.type === 'eof') {
19193       throw invalidEOF();
19194     }
19195
19196     switch (token.value) {
19197       case ',':
19198         parseState = 'beforeArrayValue';
19199         return;
19200
19201       case ']':
19202         pop();
19203     } // This code is unreachable since it's handled by the lexState.
19204     // throw invalidToken()
19205
19206   },
19207
19208   end() {// This code is unreachable since it's handled by the lexState.
19209     // if (token.type !== 'eof') {
19210     //     throw invalidToken()
19211     // }
19212   }
19213
19214 };
19215
19216 function push$1() {
19217   let value;
19218
19219   switch (token.type) {
19220     case 'punctuator':
19221       switch (token.value) {
19222         case '{':
19223           value = {};
19224           break;
19225
19226         case '[':
19227           value = [];
19228           break;
19229       }
19230
19231       break;
19232
19233     case 'null':
19234     case 'boolean':
19235     case 'numeric':
19236     case 'string':
19237       value = token.value;
19238       break;
19239     // This code is unreachable.
19240     // default:
19241     //     throw invalidToken()
19242   }
19243
19244   if (root$9 === undefined) {
19245     root$9 = value;
19246   } else {
19247     const parent = stack[stack.length - 1];
19248
19249     if (Array.isArray(parent)) {
19250       parent.push(value);
19251     } else {
19252       parent[key] = value;
19253     }
19254   }
19255
19256   if (value !== null && typeof value === 'object') {
19257     stack.push(value);
19258
19259     if (Array.isArray(value)) {
19260       parseState = 'beforeArrayValue';
19261     } else {
19262       parseState = 'beforePropertyName';
19263     }
19264   } else {
19265     const current = stack[stack.length - 1];
19266
19267     if (current == null) {
19268       parseState = 'end';
19269     } else if (Array.isArray(current)) {
19270       parseState = 'afterArrayValue';
19271     } else {
19272       parseState = 'afterPropertyValue';
19273     }
19274   }
19275 }
19276
19277 function pop() {
19278   stack.pop();
19279   const current = stack[stack.length - 1];
19280
19281   if (current == null) {
19282     parseState = 'end';
19283   } else if (Array.isArray(current)) {
19284     parseState = 'afterArrayValue';
19285   } else {
19286     parseState = 'afterPropertyValue';
19287   }
19288 } // This code is unreachable.
19289 // function invalidParseState () {
19290 //     return new Error(`JSON5: invalid parse state '${parseState}'`)
19291 // }
19292 // This code is unreachable.
19293 // function invalidLexState (state) {
19294 //     return new Error(`JSON5: invalid lex state '${state}'`)
19295 // }
19296
19297
19298 function invalidChar(c) {
19299   if (c === undefined) {
19300     return syntaxError$2(`JSON5: invalid end of input at ${line$z}:${column}`);
19301   }
19302
19303   return syntaxError$2(`JSON5: invalid character '${formatChar(c)}' at ${line$z}:${column}`);
19304 }
19305
19306 function invalidEOF() {
19307   return syntaxError$2(`JSON5: invalid end of input at ${line$z}:${column}`);
19308 } // This code is unreachable.
19309 // function invalidToken () {
19310 //     if (token.type === 'eof') {
19311 //         return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
19312 //     }
19313 //     const c = String.fromCodePoint(token.value.codePointAt(0))
19314 //     return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
19315 // }
19316
19317
19318 function invalidIdentifier() {
19319   column -= 5;
19320   return syntaxError$2(`JSON5: invalid identifier character at ${line$z}:${column}`);
19321 }
19322
19323 function separatorChar(c) {
19324   console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`);
19325 }
19326
19327 function formatChar(c) {
19328   const replacements = {
19329     "'": "\\'",
19330     '"': '\\"',
19331     '\\': '\\\\',
19332     '\b': '\\b',
19333     '\f': '\\f',
19334     '\n': '\\n',
19335     '\r': '\\r',
19336     '\t': '\\t',
19337     '\v': '\\v',
19338     '\0': '\\0',
19339     '\u2028': '\\u2028',
19340     '\u2029': '\\u2029'
19341   };
19342
19343   if (replacements[c]) {
19344     return replacements[c];
19345   }
19346
19347   if (c < ' ') {
19348     const hexString = c.charCodeAt(0).toString(16);
19349     return '\\x' + ('00' + hexString).substring(hexString.length);
19350   }
19351
19352   return c;
19353 }
19354
19355 function syntaxError$2(message) {
19356   const err = new SyntaxError(message);
19357   err.lineNumber = line$z;
19358   err.columnNumber = column;
19359   return err;
19360 }
19361
19362 var stringify$6 = function stringify(value, replacer, space) {
19363   const stack = [];
19364   let indent = '';
19365   let propertyList;
19366   let replacerFunc;
19367   let gap = '';
19368   let quote;
19369
19370   if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
19371     space = replacer.space;
19372     quote = replacer.quote;
19373     replacer = replacer.replacer;
19374   }
19375
19376   if (typeof replacer === 'function') {
19377     replacerFunc = replacer;
19378   } else if (Array.isArray(replacer)) {
19379     propertyList = [];
19380
19381     for (const v of replacer) {
19382       let item;
19383
19384       if (typeof v === 'string') {
19385         item = v;
19386       } else if (typeof v === 'number' || v instanceof String || v instanceof Number) {
19387         item = String(v);
19388       }
19389
19390       if (item !== undefined && propertyList.indexOf(item) < 0) {
19391         propertyList.push(item);
19392       }
19393     }
19394   }
19395
19396   if (space instanceof Number) {
19397     space = Number(space);
19398   } else if (space instanceof String) {
19399     space = String(space);
19400   }
19401
19402   if (typeof space === 'number') {
19403     if (space > 0) {
19404       space = Math.min(10, Math.floor(space));
19405       gap = '          '.substr(0, space);
19406     }
19407   } else if (typeof space === 'string') {
19408     gap = space.substr(0, 10);
19409   }
19410
19411   return serializeProperty('', {
19412     '': value
19413   });
19414
19415   function serializeProperty(key, holder) {
19416     let value = holder[key];
19417
19418     if (value != null) {
19419       if (typeof value.toJSON5 === 'function') {
19420         value = value.toJSON5(key);
19421       } else if (typeof value.toJSON === 'function') {
19422         value = value.toJSON(key);
19423       }
19424     }
19425
19426     if (replacerFunc) {
19427       value = replacerFunc.call(holder, key, value);
19428     }
19429
19430     if (value instanceof Number) {
19431       value = Number(value);
19432     } else if (value instanceof String) {
19433       value = String(value);
19434     } else if (value instanceof Boolean) {
19435       value = value.valueOf();
19436     }
19437
19438     switch (value) {
19439       case null:
19440         return 'null';
19441
19442       case true:
19443         return 'true';
19444
19445       case false:
19446         return 'false';
19447     }
19448
19449     if (typeof value === 'string') {
19450       return quoteString(value);
19451     }
19452
19453     if (typeof value === 'number') {
19454       return String(value);
19455     }
19456
19457     if (typeof value === 'object') {
19458       return Array.isArray(value) ? serializeArray(value) : serializeObject(value);
19459     }
19460
19461     return undefined;
19462   }
19463
19464   function quoteString(value) {
19465     const quotes = {
19466       "'": 0.1,
19467       '"': 0.2
19468     };
19469     const replacements = {
19470       "'": "\\'",
19471       '"': '\\"',
19472       '\\': '\\\\',
19473       '\b': '\\b',
19474       '\f': '\\f',
19475       '\n': '\\n',
19476       '\r': '\\r',
19477       '\t': '\\t',
19478       '\v': '\\v',
19479       '\0': '\\0',
19480       '\u2028': '\\u2028',
19481       '\u2029': '\\u2029'
19482     };
19483     let product = '';
19484
19485     for (let i = 0; i < value.length; i++) {
19486       const c = value[i];
19487
19488       switch (c) {
19489         case "'":
19490         case '"':
19491           quotes[c]++;
19492           product += c;
19493           continue;
19494
19495         case '\0':
19496           if (util$6.isDigit(value[i + 1])) {
19497             product += '\\x00';
19498             continue;
19499           }
19500
19501       }
19502
19503       if (replacements[c]) {
19504         product += replacements[c];
19505         continue;
19506       }
19507
19508       if (c < ' ') {
19509         let hexString = c.charCodeAt(0).toString(16);
19510         product += '\\x' + ('00' + hexString).substring(hexString.length);
19511         continue;
19512       }
19513
19514       product += c;
19515     }
19516
19517     const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
19518     product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
19519     return quoteChar + product + quoteChar;
19520   }
19521
19522   function serializeObject(value) {
19523     if (stack.indexOf(value) >= 0) {
19524       throw TypeError('Converting circular structure to JSON5');
19525     }
19526
19527     stack.push(value);
19528     let stepback = indent;
19529     indent = indent + gap;
19530     let keys = propertyList || Object.keys(value);
19531     let partial = [];
19532
19533     for (const key of keys) {
19534       const propertyString = serializeProperty(key, value);
19535
19536       if (propertyString !== undefined) {
19537         let member = serializeKey(key) + ':';
19538
19539         if (gap !== '') {
19540           member += ' ';
19541         }
19542
19543         member += propertyString;
19544         partial.push(member);
19545       }
19546     }
19547
19548     let final;
19549
19550     if (partial.length === 0) {
19551       final = '{}';
19552     } else {
19553       let properties;
19554
19555       if (gap === '') {
19556         properties = partial.join(',');
19557         final = '{' + properties + '}';
19558       } else {
19559         let separator = ',\n' + indent;
19560         properties = partial.join(separator);
19561         final = '{\n' + indent + properties + ',\n' + stepback + '}';
19562       }
19563     }
19564
19565     stack.pop();
19566     indent = stepback;
19567     return final;
19568   }
19569
19570   function serializeKey(key) {
19571     if (key.length === 0) {
19572       return quoteString(key);
19573     }
19574
19575     const firstChar = String.fromCodePoint(key.codePointAt(0));
19576
19577     if (!util$6.isIdStartChar(firstChar)) {
19578       return quoteString(key);
19579     }
19580
19581     for (let i = firstChar.length; i < key.length; i++) {
19582       if (!util$6.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
19583         return quoteString(key);
19584       }
19585     }
19586
19587     return key;
19588   }
19589
19590   function serializeArray(value) {
19591     if (stack.indexOf(value) >= 0) {
19592       throw TypeError('Converting circular structure to JSON5');
19593     }
19594
19595     stack.push(value);
19596     let stepback = indent;
19597     indent = indent + gap;
19598     let partial = [];
19599
19600     for (let i = 0; i < value.length; i++) {
19601       const propertyString = serializeProperty(String(i), value);
19602       partial.push(propertyString !== undefined ? propertyString : 'null');
19603     }
19604
19605     let final;
19606
19607     if (partial.length === 0) {
19608       final = '[]';
19609     } else {
19610       if (gap === '') {
19611         let properties = partial.join(',');
19612         final = '[' + properties + ']';
19613       } else {
19614         let separator = ',\n' + indent;
19615         let properties = partial.join(separator);
19616         final = '[\n' + indent + properties + ',\n' + stepback + ']';
19617       }
19618     }
19619
19620     stack.pop();
19621     indent = stepback;
19622     return final;
19623   }
19624 };
19625
19626 const JSON5 = {
19627   parse: parse$a,
19628   stringify: stringify$6
19629 };
19630 var lib = JSON5;
19631
19632 var dist = /*#__PURE__*/Object.freeze({
19633         __proto__: null,
19634         'default': lib
19635 });
19636
19637 var require$$0$4 = /*@__PURE__*/getDefaultExportFromNamespaceIfPresent(dist);
19638
19639 const {
19640   parse: parse$9
19641 } = require$$0$4;
19642
19643 var loadJson5$1 = function (filePath, content) {
19644   try {
19645     return parse$9(content);
19646   } catch (error) {
19647     error.message = `JSON5 Error in ${filePath}:\n${error.message}`;
19648     throw error;
19649   }
19650 };
19651
19652 var caller$2 = function () {
19653   // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
19654   var origPrepareStackTrace = Error.prepareStackTrace;
19655
19656   Error.prepareStackTrace = function (_, stack) {
19657     return stack;
19658   };
19659
19660   var stack = new Error().stack;
19661   Error.prepareStackTrace = origPrepareStackTrace;
19662   return stack[2].getFileName();
19663 };
19664
19665 var pathParse = {exports: {}};
19666
19667 var isWindows = process.platform === 'win32'; // Regex to split a windows path into into [dir, root, basename, name, ext]
19668
19669 var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
19670 var win32 = {};
19671
19672 function win32SplitPath(filename) {
19673   return splitWindowsRe.exec(filename).slice(1);
19674 }
19675
19676 win32.parse = function (pathString) {
19677   if (typeof pathString !== 'string') {
19678     throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
19679   }
19680
19681   var allParts = win32SplitPath(pathString);
19682
19683   if (!allParts || allParts.length !== 5) {
19684     throw new TypeError("Invalid path '" + pathString + "'");
19685   }
19686
19687   return {
19688     root: allParts[1],
19689     dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
19690     base: allParts[2],
19691     ext: allParts[4],
19692     name: allParts[3]
19693   };
19694 }; // Split a filename into [dir, root, basename, name, ext], unix version
19695 // 'root' is just a slash, or nothing.
19696
19697
19698 var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
19699 var posix = {};
19700
19701 function posixSplitPath(filename) {
19702   return splitPathRe.exec(filename).slice(1);
19703 }
19704
19705 posix.parse = function (pathString) {
19706   if (typeof pathString !== 'string') {
19707     throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
19708   }
19709
19710   var allParts = posixSplitPath(pathString);
19711
19712   if (!allParts || allParts.length !== 5) {
19713     throw new TypeError("Invalid path '" + pathString + "'");
19714   }
19715
19716   return {
19717     root: allParts[1],
19718     dir: allParts[0].slice(0, -1),
19719     base: allParts[2],
19720     ext: allParts[4],
19721     name: allParts[3]
19722   };
19723 };
19724
19725 if (isWindows) pathParse.exports = win32.parse;else
19726   /* posix */
19727   pathParse.exports = posix.parse;
19728 pathParse.exports.posix = posix.parse;
19729 pathParse.exports.win32 = win32.parse;
19730
19731 var path$n = require$$0__default$2["default"];
19732 var parse$8 = path$n.parse || pathParse.exports;
19733
19734 var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
19735   var prefix = '/';
19736
19737   if (/^([A-Za-z]:)/.test(absoluteStart)) {
19738     prefix = '';
19739   } else if (/^\\\\/.test(absoluteStart)) {
19740     prefix = '\\\\';
19741   }
19742
19743   var paths = [absoluteStart];
19744   var parsed = parse$8(absoluteStart);
19745
19746   while (parsed.dir !== paths[paths.length - 1]) {
19747     paths.push(parsed.dir);
19748     parsed = parse$8(parsed.dir);
19749   }
19750
19751   return paths.reduce(function (dirs, aPath) {
19752     return dirs.concat(modules.map(function (moduleDir) {
19753       return path$n.resolve(prefix, aPath, moduleDir);
19754     }));
19755   }, []);
19756 };
19757
19758 var nodeModulesPaths$2 = function nodeModulesPaths(start, opts, request) {
19759   var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ['node_modules'];
19760
19761   if (opts && typeof opts.paths === 'function') {
19762     return opts.paths(request, start, function () {
19763       return getNodeModulesDirs(start, modules);
19764     }, opts);
19765   }
19766
19767   var dirs = getNodeModulesDirs(start, modules);
19768   return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
19769 };
19770
19771 var normalizeOptions$3 = function (x, opts) {
19772   /**
19773    * This file is purposefully a passthrough. It's expected that third-party
19774    * environments will override it at runtime in order to inject special logic
19775    * into `resolve` (by manipulating the options). One such example is the PnP
19776    * code path in Yarn.
19777    */
19778   return opts || {};
19779 };
19780
19781 /* eslint no-invalid-this: 1 */
19782
19783
19784 var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
19785 var slice$1 = Array.prototype.slice;
19786 var toStr = Object.prototype.toString;
19787 var funcType = '[object Function]';
19788
19789 var implementation$1 = function bind(that) {
19790   var target = this;
19791
19792   if (typeof target !== 'function' || toStr.call(target) !== funcType) {
19793     throw new TypeError(ERROR_MESSAGE + target);
19794   }
19795
19796   var args = slice$1.call(arguments, 1);
19797   var bound;
19798
19799   var binder = function () {
19800     if (this instanceof bound) {
19801       var result = target.apply(this, args.concat(slice$1.call(arguments)));
19802
19803       if (Object(result) === result) {
19804         return result;
19805       }
19806
19807       return this;
19808     } else {
19809       return target.apply(that, args.concat(slice$1.call(arguments)));
19810     }
19811   };
19812
19813   var boundLength = Math.max(0, target.length - args.length);
19814   var boundArgs = [];
19815
19816   for (var i = 0; i < boundLength; i++) {
19817     boundArgs.push('$' + i);
19818   }
19819
19820   bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
19821
19822   if (target.prototype) {
19823     var Empty = function Empty() {};
19824
19825     Empty.prototype = target.prototype;
19826     bound.prototype = new Empty();
19827     Empty.prototype = null;
19828   }
19829
19830   return bound;
19831 };
19832
19833 var implementation = implementation$1;
19834 var functionBind = Function.prototype.bind || implementation;
19835
19836 var bind = functionBind;
19837 var src$2 = bind.call(Function.call, Object.prototype.hasOwnProperty);
19838
19839 var assert$4 = true;
19840 var async_hooks$1 = ">= 8";
19841 var buffer_ieee754$1 = "< 0.9.7";
19842 var buffer$1 = true;
19843 var child_process$1 = true;
19844 var cluster$1 = true;
19845 var console$2 = true;
19846 var constants$6 = true;
19847 var crypto$1 = true;
19848 var _debug_agent$1 = ">= 1 && < 8";
19849 var _debugger$1 = "< 8";
19850 var dgram$1 = true;
19851 var diagnostics_channel$1 = [
19852         ">= 14.17 && < 15",
19853         ">= 15.1"
19854 ];
19855 var dns$1 = true;
19856 var domain$1 = ">= 0.7.12";
19857 var events$1 = true;
19858 var freelist$1 = "< 6";
19859 var fs$j = true;
19860 var _http_agent$1 = ">= 0.11.1";
19861 var _http_client$1 = ">= 0.11.1";
19862 var _http_common$1 = ">= 0.11.1";
19863 var _http_incoming$1 = ">= 0.11.1";
19864 var _http_outgoing$1 = ">= 0.11.1";
19865 var _http_server$1 = ">= 0.11.1";
19866 var http$1 = true;
19867 var http2$1 = ">= 8.8";
19868 var https$1 = true;
19869 var inspector$1 = ">= 8";
19870 var _linklist$1 = "< 8";
19871 var module$3 = true;
19872 var net$1 = true;
19873 var os$1 = true;
19874 var path$m = true;
19875 var perf_hooks$1 = ">= 8.5";
19876 var process$2 = ">= 1";
19877 var punycode$1 = true;
19878 var querystring$1 = true;
19879 var readline$1 = true;
19880 var repl$1 = true;
19881 var smalloc$1 = ">= 0.11.5 && < 3";
19882 var _stream_duplex$1 = ">= 0.9.4";
19883 var _stream_transform$1 = ">= 0.9.4";
19884 var _stream_wrap$1 = ">= 1.4.1";
19885 var _stream_passthrough$1 = ">= 0.9.4";
19886 var _stream_readable$1 = ">= 0.9.4";
19887 var _stream_writable$1 = ">= 0.9.4";
19888 var stream$6 = true;
19889 var string_decoder$1 = true;
19890 var sys$1 = [
19891         ">= 0.6 && < 0.7",
19892         ">= 0.8"
19893 ];
19894 var timers$1 = true;
19895 var _tls_common$1 = ">= 0.11.13";
19896 var _tls_legacy$1 = ">= 0.11.3 && < 10";
19897 var _tls_wrap$1 = ">= 0.11.3";
19898 var tls$1 = true;
19899 var trace_events$1 = ">= 10";
19900 var tty$1 = true;
19901 var url$1 = true;
19902 var util$5 = true;
19903 var v8$1 = ">= 1";
19904 var vm$1 = true;
19905 var wasi$1 = ">= 13.4 && < 13.5";
19906 var worker_threads$1 = ">= 11.7";
19907 var zlib$1 = true;
19908 var require$$1$2 = {
19909         assert: assert$4,
19910         "node:assert": [
19911         ">= 14.18 && < 15",
19912         ">= 16"
19913 ],
19914         "assert/strict": ">= 15",
19915         "node:assert/strict": ">= 16",
19916         async_hooks: async_hooks$1,
19917         "node:async_hooks": [
19918         ">= 14.18 && < 15",
19919         ">= 16"
19920 ],
19921         buffer_ieee754: buffer_ieee754$1,
19922         buffer: buffer$1,
19923         "node:buffer": [
19924         ">= 14.18 && < 15",
19925         ">= 16"
19926 ],
19927         child_process: child_process$1,
19928         "node:child_process": [
19929         ">= 14.18 && < 15",
19930         ">= 16"
19931 ],
19932         cluster: cluster$1,
19933         "node:cluster": [
19934         ">= 14.18 && < 15",
19935         ">= 16"
19936 ],
19937         console: console$2,
19938         "node:console": [
19939         ">= 14.18 && < 15",
19940         ">= 16"
19941 ],
19942         constants: constants$6,
19943         "node:constants": [
19944         ">= 14.18 && < 15",
19945         ">= 16"
19946 ],
19947         crypto: crypto$1,
19948         "node:crypto": [
19949         ">= 14.18 && < 15",
19950         ">= 16"
19951 ],
19952         _debug_agent: _debug_agent$1,
19953         _debugger: _debugger$1,
19954         dgram: dgram$1,
19955         "node:dgram": [
19956         ">= 14.18 && < 15",
19957         ">= 16"
19958 ],
19959         diagnostics_channel: diagnostics_channel$1,
19960         "node:diagnostics_channel": [
19961         ">= 14.18 && < 15",
19962         ">= 16"
19963 ],
19964         dns: dns$1,
19965         "node:dns": [
19966         ">= 14.18 && < 15",
19967         ">= 16"
19968 ],
19969         "dns/promises": ">= 15",
19970         "node:dns/promises": ">= 16",
19971         domain: domain$1,
19972         "node:domain": [
19973         ">= 14.18 && < 15",
19974         ">= 16"
19975 ],
19976         events: events$1,
19977         "node:events": [
19978         ">= 14.18 && < 15",
19979         ">= 16"
19980 ],
19981         freelist: freelist$1,
19982         fs: fs$j,
19983         "node:fs": [
19984         ">= 14.18 && < 15",
19985         ">= 16"
19986 ],
19987         "fs/promises": [
19988         ">= 10 && < 10.1",
19989         ">= 14"
19990 ],
19991         "node:fs/promises": [
19992         ">= 14.18 && < 15",
19993         ">= 16"
19994 ],
19995         _http_agent: _http_agent$1,
19996         "node:_http_agent": [
19997         ">= 14.18 && < 15",
19998         ">= 16"
19999 ],
20000         _http_client: _http_client$1,
20001         "node:_http_client": [
20002         ">= 14.18 && < 15",
20003         ">= 16"
20004 ],
20005         _http_common: _http_common$1,
20006         "node:_http_common": [
20007         ">= 14.18 && < 15",
20008         ">= 16"
20009 ],
20010         _http_incoming: _http_incoming$1,
20011         "node:_http_incoming": [
20012         ">= 14.18 && < 15",
20013         ">= 16"
20014 ],
20015         _http_outgoing: _http_outgoing$1,
20016         "node:_http_outgoing": [
20017         ">= 14.18 && < 15",
20018         ">= 16"
20019 ],
20020         _http_server: _http_server$1,
20021         "node:_http_server": [
20022         ">= 14.18 && < 15",
20023         ">= 16"
20024 ],
20025         http: http$1,
20026         "node:http": [
20027         ">= 14.18 && < 15",
20028         ">= 16"
20029 ],
20030         http2: http2$1,
20031         "node:http2": [
20032         ">= 14.18 && < 15",
20033         ">= 16"
20034 ],
20035         https: https$1,
20036         "node:https": [
20037         ">= 14.18 && < 15",
20038         ">= 16"
20039 ],
20040         inspector: inspector$1,
20041         "node:inspector": [
20042         ">= 14.18 && < 15",
20043         ">= 16"
20044 ],
20045         _linklist: _linklist$1,
20046         module: module$3,
20047         "node:module": [
20048         ">= 14.18 && < 15",
20049         ">= 16"
20050 ],
20051         net: net$1,
20052         "node:net": [
20053         ">= 14.18 && < 15",
20054         ">= 16"
20055 ],
20056         "node-inspect/lib/_inspect": ">= 7.6 && < 12",
20057         "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
20058         "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
20059         os: os$1,
20060         "node:os": [
20061         ">= 14.18 && < 15",
20062         ">= 16"
20063 ],
20064         path: path$m,
20065         "node:path": [
20066         ">= 14.18 && < 15",
20067         ">= 16"
20068 ],
20069         "path/posix": ">= 15.3",
20070         "node:path/posix": ">= 16",
20071         "path/win32": ">= 15.3",
20072         "node:path/win32": ">= 16",
20073         perf_hooks: perf_hooks$1,
20074         "node:perf_hooks": [
20075         ">= 14.18 && < 15",
20076         ">= 16"
20077 ],
20078         process: process$2,
20079         "node:process": [
20080         ">= 14.18 && < 15",
20081         ">= 16"
20082 ],
20083         punycode: punycode$1,
20084         "node:punycode": [
20085         ">= 14.18 && < 15",
20086         ">= 16"
20087 ],
20088         querystring: querystring$1,
20089         "node:querystring": [
20090         ">= 14.18 && < 15",
20091         ">= 16"
20092 ],
20093         readline: readline$1,
20094         "node:readline": [
20095         ">= 14.18 && < 15",
20096         ">= 16"
20097 ],
20098         "readline/promises": ">= 17",
20099         "node:readline/promises": ">= 17",
20100         repl: repl$1,
20101         "node:repl": [
20102         ">= 14.18 && < 15",
20103         ">= 16"
20104 ],
20105         smalloc: smalloc$1,
20106         _stream_duplex: _stream_duplex$1,
20107         "node:_stream_duplex": [
20108         ">= 14.18 && < 15",
20109         ">= 16"
20110 ],
20111         _stream_transform: _stream_transform$1,
20112         "node:_stream_transform": [
20113         ">= 14.18 && < 15",
20114         ">= 16"
20115 ],
20116         _stream_wrap: _stream_wrap$1,
20117         "node:_stream_wrap": [
20118         ">= 14.18 && < 15",
20119         ">= 16"
20120 ],
20121         _stream_passthrough: _stream_passthrough$1,
20122         "node:_stream_passthrough": [
20123         ">= 14.18 && < 15",
20124         ">= 16"
20125 ],
20126         _stream_readable: _stream_readable$1,
20127         "node:_stream_readable": [
20128         ">= 14.18 && < 15",
20129         ">= 16"
20130 ],
20131         _stream_writable: _stream_writable$1,
20132         "node:_stream_writable": [
20133         ">= 14.18 && < 15",
20134         ">= 16"
20135 ],
20136         stream: stream$6,
20137         "node:stream": [
20138         ">= 14.18 && < 15",
20139         ">= 16"
20140 ],
20141         "stream/consumers": ">= 16.7",
20142         "node:stream/consumers": ">= 16.7",
20143         "stream/promises": ">= 15",
20144         "node:stream/promises": ">= 16",
20145         "stream/web": ">= 16.5",
20146         "node:stream/web": ">= 16.5",
20147         string_decoder: string_decoder$1,
20148         "node:string_decoder": [
20149         ">= 14.18 && < 15",
20150         ">= 16"
20151 ],
20152         sys: sys$1,
20153         "node:sys": [
20154         ">= 14.18 && < 15",
20155         ">= 16"
20156 ],
20157         timers: timers$1,
20158         "node:timers": [
20159         ">= 14.18 && < 15",
20160         ">= 16"
20161 ],
20162         "timers/promises": ">= 15",
20163         "node:timers/promises": ">= 16",
20164         _tls_common: _tls_common$1,
20165         "node:_tls_common": [
20166         ">= 14.18 && < 15",
20167         ">= 16"
20168 ],
20169         _tls_legacy: _tls_legacy$1,
20170         _tls_wrap: _tls_wrap$1,
20171         "node:_tls_wrap": [
20172         ">= 14.18 && < 15",
20173         ">= 16"
20174 ],
20175         tls: tls$1,
20176         "node:tls": [
20177         ">= 14.18 && < 15",
20178         ">= 16"
20179 ],
20180         trace_events: trace_events$1,
20181         "node:trace_events": [
20182         ">= 14.18 && < 15",
20183         ">= 16"
20184 ],
20185         tty: tty$1,
20186         "node:tty": [
20187         ">= 14.18 && < 15",
20188         ">= 16"
20189 ],
20190         url: url$1,
20191         "node:url": [
20192         ">= 14.18 && < 15",
20193         ">= 16"
20194 ],
20195         util: util$5,
20196         "node:util": [
20197         ">= 14.18 && < 15",
20198         ">= 16"
20199 ],
20200         "util/types": ">= 15.3",
20201         "node:util/types": ">= 16",
20202         "v8/tools/arguments": ">= 10 && < 12",
20203         "v8/tools/codemap": [
20204         ">= 4.4 && < 5",
20205         ">= 5.2 && < 12"
20206 ],
20207         "v8/tools/consarray": [
20208         ">= 4.4 && < 5",
20209         ">= 5.2 && < 12"
20210 ],
20211         "v8/tools/csvparser": [
20212         ">= 4.4 && < 5",
20213         ">= 5.2 && < 12"
20214 ],
20215         "v8/tools/logreader": [
20216         ">= 4.4 && < 5",
20217         ">= 5.2 && < 12"
20218 ],
20219         "v8/tools/profile_view": [
20220         ">= 4.4 && < 5",
20221         ">= 5.2 && < 12"
20222 ],
20223         "v8/tools/splaytree": [
20224         ">= 4.4 && < 5",
20225         ">= 5.2 && < 12"
20226 ],
20227         v8: v8$1,
20228         "node:v8": [
20229         ">= 14.18 && < 15",
20230         ">= 16"
20231 ],
20232         vm: vm$1,
20233         "node:vm": [
20234         ">= 14.18 && < 15",
20235         ">= 16"
20236 ],
20237         wasi: wasi$1,
20238         worker_threads: worker_threads$1,
20239         "node:worker_threads": [
20240         ">= 14.18 && < 15",
20241         ">= 16"
20242 ],
20243         zlib: zlib$1,
20244         "node:zlib": [
20245         ">= 14.18 && < 15",
20246         ">= 16"
20247 ]
20248 };
20249
20250 var has = src$2;
20251
20252 function specifierIncluded$1(current, specifier) {
20253   var nodeParts = current.split('.');
20254   var parts = specifier.split(' ');
20255   var op = parts.length > 1 ? parts[0] : '=';
20256   var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
20257
20258   for (var i = 0; i < 3; ++i) {
20259     var cur = parseInt(nodeParts[i] || 0, 10);
20260     var ver = parseInt(versionParts[i] || 0, 10);
20261
20262     if (cur === ver) {
20263       continue; // eslint-disable-line no-restricted-syntax, no-continue
20264     }
20265
20266     if (op === '<') {
20267       return cur < ver;
20268     }
20269
20270     if (op === '>=') {
20271       return cur >= ver;
20272     }
20273
20274     return false;
20275   }
20276
20277   return op === '>=';
20278 }
20279
20280 function matchesRange$1(current, range) {
20281   var specifiers = range.split(/ ?&& ?/);
20282
20283   if (specifiers.length === 0) {
20284     return false;
20285   }
20286
20287   for (var i = 0; i < specifiers.length; ++i) {
20288     if (!specifierIncluded$1(current, specifiers[i])) {
20289       return false;
20290     }
20291   }
20292
20293   return true;
20294 }
20295
20296 function versionIncluded$1(nodeVersion, specifierValue) {
20297   if (typeof specifierValue === 'boolean') {
20298     return specifierValue;
20299   }
20300
20301   var current = typeof nodeVersion === 'undefined' ? process.versions && process.versions.node : nodeVersion;
20302
20303   if (typeof current !== 'string') {
20304     throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required');
20305   }
20306
20307   if (specifierValue && typeof specifierValue === 'object') {
20308     for (var i = 0; i < specifierValue.length; ++i) {
20309       if (matchesRange$1(current, specifierValue[i])) {
20310         return true;
20311       }
20312     }
20313
20314     return false;
20315   }
20316
20317   return matchesRange$1(current, specifierValue);
20318 }
20319
20320 var data$2 = require$$1$2;
20321
20322 var isCoreModule$1 = function isCore(x, nodeVersion) {
20323   return has(data$2, x) && versionIncluded$1(nodeVersion, data$2[x]);
20324 };
20325
20326 var fs$i = require$$0__default["default"];
20327 var path$l = require$$0__default$2["default"];
20328 var caller$1 = caller$2;
20329 var nodeModulesPaths$1 = nodeModulesPaths$2;
20330 var normalizeOptions$2 = normalizeOptions$3;
20331 var isCore$2 = isCoreModule$1;
20332 var realpathFS$1 = fs$i.realpath && typeof fs$i.realpath.native === 'function' ? fs$i.realpath.native : fs$i.realpath;
20333
20334 var defaultIsFile$1 = function isFile(file, cb) {
20335   fs$i.stat(file, function (err, stat) {
20336     if (!err) {
20337       return cb(null, stat.isFile() || stat.isFIFO());
20338     }
20339
20340     if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
20341     return cb(err);
20342   });
20343 };
20344
20345 var defaultIsDir$1 = function isDirectory(dir, cb) {
20346   fs$i.stat(dir, function (err, stat) {
20347     if (!err) {
20348       return cb(null, stat.isDirectory());
20349     }
20350
20351     if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
20352     return cb(err);
20353   });
20354 };
20355
20356 var defaultRealpath = function realpath(x, cb) {
20357   realpathFS$1(x, function (realpathErr, realPath) {
20358     if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);else cb(null, realpathErr ? x : realPath);
20359   });
20360 };
20361
20362 var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
20363   if (opts && opts.preserveSymlinks === false) {
20364     realpath(x, cb);
20365   } else {
20366     cb(null, x);
20367   }
20368 };
20369
20370 var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) {
20371   readFile(pkgfile, function (readFileErr, body) {
20372     if (readFileErr) cb(readFileErr);else {
20373       try {
20374         var pkg = JSON.parse(body);
20375         cb(null, pkg);
20376       } catch (jsonErr) {
20377         cb(null);
20378       }
20379     }
20380   });
20381 };
20382
20383 var getPackageCandidates$1 = function getPackageCandidates(x, start, opts) {
20384   var dirs = nodeModulesPaths$1(start, opts, x);
20385
20386   for (var i = 0; i < dirs.length; i++) {
20387     dirs[i] = path$l.join(dirs[i], x);
20388   }
20389
20390   return dirs;
20391 };
20392
20393 var async$8 = function resolve(x, options, callback) {
20394   var cb = callback;
20395   var opts = options;
20396
20397   if (typeof options === 'function') {
20398     cb = opts;
20399     opts = {};
20400   }
20401
20402   if (typeof x !== 'string') {
20403     var err = new TypeError('Path must be a string.');
20404     return process.nextTick(function () {
20405       cb(err);
20406     });
20407   }
20408
20409   opts = normalizeOptions$2(x, opts);
20410   var isFile = opts.isFile || defaultIsFile$1;
20411   var isDirectory = opts.isDirectory || defaultIsDir$1;
20412   var readFile = opts.readFile || fs$i.readFile;
20413   var realpath = opts.realpath || defaultRealpath;
20414   var readPackage = opts.readPackage || defaultReadPackage;
20415
20416   if (opts.readFile && opts.readPackage) {
20417     var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.');
20418     return process.nextTick(function () {
20419       cb(conflictErr);
20420     });
20421   }
20422
20423   var packageIterator = opts.packageIterator;
20424   var extensions = opts.extensions || ['.js'];
20425   var includeCoreModules = opts.includeCoreModules !== false;
20426   var basedir = opts.basedir || path$l.dirname(caller$1());
20427   var parent = opts.filename || basedir;
20428   opts.paths = opts.paths || []; // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
20429
20430   var absoluteStart = path$l.resolve(basedir);
20431   maybeRealpath(realpath, absoluteStart, opts, function (err, realStart) {
20432     if (err) cb(err);else init(realStart);
20433   });
20434   var res;
20435
20436   function init(basedir) {
20437     if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
20438       res = path$l.resolve(basedir, x);
20439       if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
20440
20441       if (/\/$/.test(x) && res === basedir) {
20442         loadAsDirectory(res, opts.package, onfile);
20443       } else loadAsFile(res, opts.package, onfile);
20444     } else if (includeCoreModules && isCore$2(x)) {
20445       return cb(null, x);
20446     } else loadNodeModules(x, basedir, function (err, n, pkg) {
20447       if (err) cb(err);else if (n) {
20448         return maybeRealpath(realpath, n, opts, function (err, realN) {
20449           if (err) {
20450             cb(err);
20451           } else {
20452             cb(null, realN, pkg);
20453           }
20454         });
20455       } else {
20456         var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
20457         moduleError.code = 'MODULE_NOT_FOUND';
20458         cb(moduleError);
20459       }
20460     });
20461   }
20462
20463   function onfile(err, m, pkg) {
20464     if (err) cb(err);else if (m) cb(null, m, pkg);else loadAsDirectory(res, function (err, d, pkg) {
20465       if (err) cb(err);else if (d) {
20466         maybeRealpath(realpath, d, opts, function (err, realD) {
20467           if (err) {
20468             cb(err);
20469           } else {
20470             cb(null, realD, pkg);
20471           }
20472         });
20473       } else {
20474         var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
20475         moduleError.code = 'MODULE_NOT_FOUND';
20476         cb(moduleError);
20477       }
20478     });
20479   }
20480
20481   function loadAsFile(x, thePackage, callback) {
20482     var loadAsFilePackage = thePackage;
20483     var cb = callback;
20484
20485     if (typeof loadAsFilePackage === 'function') {
20486       cb = loadAsFilePackage;
20487       loadAsFilePackage = undefined;
20488     }
20489
20490     var exts = [''].concat(extensions);
20491     load(exts, x, loadAsFilePackage);
20492
20493     function load(exts, x, loadPackage) {
20494       if (exts.length === 0) return cb(null, undefined, loadPackage);
20495       var file = x + exts[0];
20496       var pkg = loadPackage;
20497       if (pkg) onpkg(null, pkg);else loadpkg(path$l.dirname(file), onpkg);
20498
20499       function onpkg(err, pkg_, dir) {
20500         pkg = pkg_;
20501         if (err) return cb(err);
20502
20503         if (dir && pkg && opts.pathFilter) {
20504           var rfile = path$l.relative(dir, file);
20505           var rel = rfile.slice(0, rfile.length - exts[0].length);
20506           var r = opts.pathFilter(pkg, x, rel);
20507           if (r) return load([''].concat(extensions.slice()), path$l.resolve(dir, r), pkg);
20508         }
20509
20510         isFile(file, onex);
20511       }
20512
20513       function onex(err, ex) {
20514         if (err) return cb(err);
20515         if (ex) return cb(null, file, pkg);
20516         load(exts.slice(1), x, pkg);
20517       }
20518     }
20519   }
20520
20521   function loadpkg(dir, cb) {
20522     if (dir === '' || dir === '/') return cb(null);
20523
20524     if (process.platform === 'win32' && /^\w:[/\\]*$/.test(dir)) {
20525       return cb(null);
20526     }
20527
20528     if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb(null);
20529     maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
20530       if (unwrapErr) return loadpkg(path$l.dirname(dir), cb);
20531       var pkgfile = path$l.join(pkgdir, 'package.json');
20532       isFile(pkgfile, function (err, ex) {
20533         // on err, ex is false
20534         if (!ex) return loadpkg(path$l.dirname(dir), cb);
20535         readPackage(readFile, pkgfile, function (err, pkgParam) {
20536           if (err) cb(err);
20537           var pkg = pkgParam;
20538
20539           if (pkg && opts.packageFilter) {
20540             pkg = opts.packageFilter(pkg, pkgfile);
20541           }
20542
20543           cb(null, pkg, dir);
20544         });
20545       });
20546     });
20547   }
20548
20549   function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
20550     var cb = callback;
20551     var fpkg = loadAsDirectoryPackage;
20552
20553     if (typeof fpkg === 'function') {
20554       cb = fpkg;
20555       fpkg = opts.package;
20556     }
20557
20558     maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
20559       if (unwrapErr) return cb(unwrapErr);
20560       var pkgfile = path$l.join(pkgdir, 'package.json');
20561       isFile(pkgfile, function (err, ex) {
20562         if (err) return cb(err);
20563         if (!ex) return loadAsFile(path$l.join(x, 'index'), fpkg, cb);
20564         readPackage(readFile, pkgfile, function (err, pkgParam) {
20565           if (err) return cb(err);
20566           var pkg = pkgParam;
20567
20568           if (pkg && opts.packageFilter) {
20569             pkg = opts.packageFilter(pkg, pkgfile);
20570           }
20571
20572           if (pkg && pkg.main) {
20573             if (typeof pkg.main !== 'string') {
20574               var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
20575               mainError.code = 'INVALID_PACKAGE_MAIN';
20576               return cb(mainError);
20577             }
20578
20579             if (pkg.main === '.' || pkg.main === './') {
20580               pkg.main = 'index';
20581             }
20582
20583             loadAsFile(path$l.resolve(x, pkg.main), pkg, function (err, m, pkg) {
20584               if (err) return cb(err);
20585               if (m) return cb(null, m, pkg);
20586               if (!pkg) return loadAsFile(path$l.join(x, 'index'), pkg, cb);
20587               var dir = path$l.resolve(x, pkg.main);
20588               loadAsDirectory(dir, pkg, function (err, n, pkg) {
20589                 if (err) return cb(err);
20590                 if (n) return cb(null, n, pkg);
20591                 loadAsFile(path$l.join(x, 'index'), pkg, cb);
20592               });
20593             });
20594             return;
20595           }
20596
20597           loadAsFile(path$l.join(x, '/index'), pkg, cb);
20598         });
20599       });
20600     });
20601   }
20602
20603   function processDirs(cb, dirs) {
20604     if (dirs.length === 0) return cb(null, undefined);
20605     var dir = dirs[0];
20606     isDirectory(path$l.dirname(dir), isdir);
20607
20608     function isdir(err, isdir) {
20609       if (err) return cb(err);
20610       if (!isdir) return processDirs(cb, dirs.slice(1));
20611       loadAsFile(dir, opts.package, onfile);
20612     }
20613
20614     function onfile(err, m, pkg) {
20615       if (err) return cb(err);
20616       if (m) return cb(null, m, pkg);
20617       loadAsDirectory(dir, opts.package, ondir);
20618     }
20619
20620     function ondir(err, n, pkg) {
20621       if (err) return cb(err);
20622       if (n) return cb(null, n, pkg);
20623       processDirs(cb, dirs.slice(1));
20624     }
20625   }
20626
20627   function loadNodeModules(x, start, cb) {
20628     var thunk = function () {
20629       return getPackageCandidates$1(x, start, opts);
20630     };
20631
20632     processDirs(cb, packageIterator ? packageIterator(x, start, thunk, opts) : thunk());
20633   }
20634 };
20635
20636 var assert$3 = true;
20637 var async_hooks = ">= 8";
20638 var buffer_ieee754 = "< 0.9.7";
20639 var buffer = true;
20640 var child_process = true;
20641 var cluster = true;
20642 var console$1 = true;
20643 var constants$5 = true;
20644 var crypto = true;
20645 var _debug_agent = ">= 1 && < 8";
20646 var _debugger = "< 8";
20647 var dgram = true;
20648 var diagnostics_channel = ">= 15.1";
20649 var dns = true;
20650 var domain = ">= 0.7.12";
20651 var events = true;
20652 var freelist = "< 6";
20653 var fs$h = true;
20654 var _http_agent = ">= 0.11.1";
20655 var _http_client = ">= 0.11.1";
20656 var _http_common = ">= 0.11.1";
20657 var _http_incoming = ">= 0.11.1";
20658 var _http_outgoing = ">= 0.11.1";
20659 var _http_server = ">= 0.11.1";
20660 var http = true;
20661 var http2 = ">= 8.8";
20662 var https = true;
20663 var inspector = ">= 8.0.0";
20664 var _linklist = "< 8";
20665 var module$2 = true;
20666 var net = true;
20667 var os = true;
20668 var path$k = true;
20669 var perf_hooks = ">= 8.5";
20670 var process$1 = ">= 1";
20671 var punycode = true;
20672 var querystring = true;
20673 var readline = true;
20674 var repl = true;
20675 var smalloc = ">= 0.11.5 && < 3";
20676 var _stream_duplex = ">= 0.9.4";
20677 var _stream_transform = ">= 0.9.4";
20678 var _stream_wrap = ">= 1.4.1";
20679 var _stream_passthrough = ">= 0.9.4";
20680 var _stream_readable = ">= 0.9.4";
20681 var _stream_writable = ">= 0.9.4";
20682 var stream$5 = true;
20683 var string_decoder = true;
20684 var sys = [
20685         ">= 0.6 && < 0.7",
20686         ">= 0.8"
20687 ];
20688 var timers = true;
20689 var _tls_common = ">= 0.11.13";
20690 var _tls_legacy = ">= 0.11.3 && < 10";
20691 var _tls_wrap = ">= 0.11.3";
20692 var tls = true;
20693 var trace_events = ">= 10";
20694 var tty = true;
20695 var url = true;
20696 var util$4 = true;
20697 var v8 = ">= 1";
20698 var vm = true;
20699 var wasi = ">= 13.4 && < 13.5";
20700 var worker_threads = ">= 11.7";
20701 var zlib = true;
20702 var require$$0$3 = {
20703         assert: assert$3,
20704         "assert/strict": ">= 15",
20705         async_hooks: async_hooks,
20706         buffer_ieee754: buffer_ieee754,
20707         buffer: buffer,
20708         child_process: child_process,
20709         cluster: cluster,
20710         console: console$1,
20711         constants: constants$5,
20712         crypto: crypto,
20713         _debug_agent: _debug_agent,
20714         _debugger: _debugger,
20715         dgram: dgram,
20716         diagnostics_channel: diagnostics_channel,
20717         dns: dns,
20718         "dns/promises": ">= 15",
20719         domain: domain,
20720         events: events,
20721         freelist: freelist,
20722         fs: fs$h,
20723         "fs/promises": [
20724         ">= 10 && < 10.1",
20725         ">= 14"
20726 ],
20727         _http_agent: _http_agent,
20728         _http_client: _http_client,
20729         _http_common: _http_common,
20730         _http_incoming: _http_incoming,
20731         _http_outgoing: _http_outgoing,
20732         _http_server: _http_server,
20733         http: http,
20734         http2: http2,
20735         https: https,
20736         inspector: inspector,
20737         _linklist: _linklist,
20738         module: module$2,
20739         net: net,
20740         "node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
20741         "node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
20742         "node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
20743         os: os,
20744         path: path$k,
20745         "path/posix": ">= 15.3",
20746         "path/win32": ">= 15.3",
20747         perf_hooks: perf_hooks,
20748         process: process$1,
20749         punycode: punycode,
20750         querystring: querystring,
20751         readline: readline,
20752         repl: repl,
20753         smalloc: smalloc,
20754         _stream_duplex: _stream_duplex,
20755         _stream_transform: _stream_transform,
20756         _stream_wrap: _stream_wrap,
20757         _stream_passthrough: _stream_passthrough,
20758         _stream_readable: _stream_readable,
20759         _stream_writable: _stream_writable,
20760         stream: stream$5,
20761         "stream/promises": ">= 15",
20762         string_decoder: string_decoder,
20763         sys: sys,
20764         timers: timers,
20765         "timers/promises": ">= 15",
20766         _tls_common: _tls_common,
20767         _tls_legacy: _tls_legacy,
20768         _tls_wrap: _tls_wrap,
20769         tls: tls,
20770         trace_events: trace_events,
20771         tty: tty,
20772         url: url,
20773         util: util$4,
20774         "util/types": ">= 15.3",
20775         "v8/tools/arguments": ">= 10 && < 12",
20776         "v8/tools/codemap": [
20777         ">= 4.4.0 && < 5",
20778         ">= 5.2.0 && < 12"
20779 ],
20780         "v8/tools/consarray": [
20781         ">= 4.4.0 && < 5",
20782         ">= 5.2.0 && < 12"
20783 ],
20784         "v8/tools/csvparser": [
20785         ">= 4.4.0 && < 5",
20786         ">= 5.2.0 && < 12"
20787 ],
20788         "v8/tools/logreader": [
20789         ">= 4.4.0 && < 5",
20790         ">= 5.2.0 && < 12"
20791 ],
20792         "v8/tools/profile_view": [
20793         ">= 4.4.0 && < 5",
20794         ">= 5.2.0 && < 12"
20795 ],
20796         "v8/tools/splaytree": [
20797         ">= 4.4.0 && < 5",
20798         ">= 5.2.0 && < 12"
20799 ],
20800         v8: v8,
20801         vm: vm,
20802         wasi: wasi,
20803         worker_threads: worker_threads,
20804         zlib: zlib
20805 };
20806
20807 var current = process.versions && process.versions.node && process.versions.node.split('.') || [];
20808
20809 function specifierIncluded(specifier) {
20810   var parts = specifier.split(' ');
20811   var op = parts.length > 1 ? parts[0] : '=';
20812   var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
20813
20814   for (var i = 0; i < 3; ++i) {
20815     var cur = parseInt(current[i] || 0, 10);
20816     var ver = parseInt(versionParts[i] || 0, 10);
20817
20818     if (cur === ver) {
20819       continue; // eslint-disable-line no-restricted-syntax, no-continue
20820     }
20821
20822     if (op === '<') {
20823       return cur < ver;
20824     } else if (op === '>=') {
20825       return cur >= ver;
20826     } else {
20827       return false;
20828     }
20829   }
20830
20831   return op === '>=';
20832 }
20833
20834 function matchesRange(range) {
20835   var specifiers = range.split(/ ?&& ?/);
20836
20837   if (specifiers.length === 0) {
20838     return false;
20839   }
20840
20841   for (var i = 0; i < specifiers.length; ++i) {
20842     if (!specifierIncluded(specifiers[i])) {
20843       return false;
20844     }
20845   }
20846
20847   return true;
20848 }
20849
20850 function versionIncluded(specifierValue) {
20851   if (typeof specifierValue === 'boolean') {
20852     return specifierValue;
20853   }
20854
20855   if (specifierValue && typeof specifierValue === 'object') {
20856     for (var i = 0; i < specifierValue.length; ++i) {
20857       if (matchesRange(specifierValue[i])) {
20858         return true;
20859       }
20860     }
20861
20862     return false;
20863   }
20864
20865   return matchesRange(specifierValue);
20866 }
20867
20868 var data$1 = require$$0$3;
20869 var core$1 = {};
20870
20871 for (var mod in data$1) {
20872   // eslint-disable-line no-restricted-syntax
20873   if (Object.prototype.hasOwnProperty.call(data$1, mod)) {
20874     core$1[mod] = versionIncluded(data$1[mod]);
20875   }
20876 }
20877
20878 var core_1 = core$1;
20879
20880 var isCoreModule = isCoreModule$1;
20881
20882 var isCore$1 = function isCore(x) {
20883   return isCoreModule(x);
20884 };
20885
20886 var isCore = isCoreModule$1;
20887 var fs$g = require$$0__default["default"];
20888 var path$j = require$$0__default$2["default"];
20889 var caller = caller$2;
20890 var nodeModulesPaths = nodeModulesPaths$2;
20891 var normalizeOptions$1 = normalizeOptions$3;
20892 var realpathFS = fs$g.realpathSync && typeof fs$g.realpathSync.native === 'function' ? fs$g.realpathSync.native : fs$g.realpathSync;
20893
20894 var defaultIsFile = function isFile(file) {
20895   try {
20896     var stat = fs$g.statSync(file);
20897   } catch (e) {
20898     if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
20899     throw e;
20900   }
20901
20902   return stat.isFile() || stat.isFIFO();
20903 };
20904
20905 var defaultIsDir = function isDirectory(dir) {
20906   try {
20907     var stat = fs$g.statSync(dir);
20908   } catch (e) {
20909     if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
20910     throw e;
20911   }
20912
20913   return stat.isDirectory();
20914 };
20915
20916 var defaultRealpathSync = function realpathSync(x) {
20917   try {
20918     return realpathFS(x);
20919   } catch (realpathErr) {
20920     if (realpathErr.code !== 'ENOENT') {
20921       throw realpathErr;
20922     }
20923   }
20924
20925   return x;
20926 };
20927
20928 var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) {
20929   if (opts && opts.preserveSymlinks === false) {
20930     return realpathSync(x);
20931   }
20932
20933   return x;
20934 };
20935
20936 var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) {
20937   var body = readFileSync(pkgfile);
20938
20939   try {
20940     var pkg = JSON.parse(body);
20941     return pkg;
20942   } catch (jsonErr) {}
20943 };
20944
20945 var getPackageCandidates = function getPackageCandidates(x, start, opts) {
20946   var dirs = nodeModulesPaths(start, opts, x);
20947
20948   for (var i = 0; i < dirs.length; i++) {
20949     dirs[i] = path$j.join(dirs[i], x);
20950   }
20951
20952   return dirs;
20953 };
20954
20955 var sync$8 = function resolveSync(x, options) {
20956   if (typeof x !== 'string') {
20957     throw new TypeError('Path must be a string.');
20958   }
20959
20960   var opts = normalizeOptions$1(x, options);
20961   var isFile = opts.isFile || defaultIsFile;
20962   var readFileSync = opts.readFileSync || fs$g.readFileSync;
20963   var isDirectory = opts.isDirectory || defaultIsDir;
20964   var realpathSync = opts.realpathSync || defaultRealpathSync;
20965   var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
20966
20967   if (opts.readFileSync && opts.readPackageSync) {
20968     throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.');
20969   }
20970
20971   var packageIterator = opts.packageIterator;
20972   var extensions = opts.extensions || ['.js'];
20973   var includeCoreModules = opts.includeCoreModules !== false;
20974   var basedir = opts.basedir || path$j.dirname(caller());
20975   var parent = opts.filename || basedir;
20976   opts.paths = opts.paths || []; // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
20977
20978   var absoluteStart = maybeRealpathSync(realpathSync, path$j.resolve(basedir), opts);
20979
20980   if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
20981     var res = path$j.resolve(absoluteStart, x);
20982     if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
20983     var m = loadAsFileSync(res) || loadAsDirectorySync(res);
20984     if (m) return maybeRealpathSync(realpathSync, m, opts);
20985   } else if (includeCoreModules && isCore(x)) {
20986     return x;
20987   } else {
20988     var n = loadNodeModulesSync(x, absoluteStart);
20989     if (n) return maybeRealpathSync(realpathSync, n, opts);
20990   }
20991
20992   var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
20993   err.code = 'MODULE_NOT_FOUND';
20994   throw err;
20995
20996   function loadAsFileSync(x) {
20997     var pkg = loadpkg(path$j.dirname(x));
20998
20999     if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
21000       var rfile = path$j.relative(pkg.dir, x);
21001       var r = opts.pathFilter(pkg.pkg, x, rfile);
21002
21003       if (r) {
21004         x = path$j.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign
21005       }
21006     }
21007
21008     if (isFile(x)) {
21009       return x;
21010     }
21011
21012     for (var i = 0; i < extensions.length; i++) {
21013       var file = x + extensions[i];
21014
21015       if (isFile(file)) {
21016         return file;
21017       }
21018     }
21019   }
21020
21021   function loadpkg(dir) {
21022     if (dir === '' || dir === '/') return;
21023
21024     if (process.platform === 'win32' && /^\w:[/\\]*$/.test(dir)) {
21025       return;
21026     }
21027
21028     if (/[/\\]node_modules[/\\]*$/.test(dir)) return;
21029     var pkgfile = path$j.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json');
21030
21031     if (!isFile(pkgfile)) {
21032       return loadpkg(path$j.dirname(dir));
21033     }
21034
21035     var pkg = readPackageSync(readFileSync, pkgfile);
21036
21037     if (pkg && opts.packageFilter) {
21038       // v2 will pass pkgfile
21039       pkg = opts.packageFilter(pkg,
21040       /*pkgfile,*/
21041       dir); // eslint-disable-line spaced-comment
21042     }
21043
21044     return {
21045       pkg: pkg,
21046       dir: dir
21047     };
21048   }
21049
21050   function loadAsDirectorySync(x) {
21051     var pkgfile = path$j.join(maybeRealpathSync(realpathSync, x, opts), '/package.json');
21052
21053     if (isFile(pkgfile)) {
21054       try {
21055         var pkg = readPackageSync(readFileSync, pkgfile);
21056       } catch (e) {}
21057
21058       if (pkg && opts.packageFilter) {
21059         // v2 will pass pkgfile
21060         pkg = opts.packageFilter(pkg,
21061         /*pkgfile,*/
21062         x); // eslint-disable-line spaced-comment
21063       }
21064
21065       if (pkg && pkg.main) {
21066         if (typeof pkg.main !== 'string') {
21067           var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
21068           mainError.code = 'INVALID_PACKAGE_MAIN';
21069           throw mainError;
21070         }
21071
21072         if (pkg.main === '.' || pkg.main === './') {
21073           pkg.main = 'index';
21074         }
21075
21076         try {
21077           var m = loadAsFileSync(path$j.resolve(x, pkg.main));
21078           if (m) return m;
21079           var n = loadAsDirectorySync(path$j.resolve(x, pkg.main));
21080           if (n) return n;
21081         } catch (e) {}
21082       }
21083     }
21084
21085     return loadAsFileSync(path$j.join(x, '/index'));
21086   }
21087
21088   function loadNodeModulesSync(x, start) {
21089     var thunk = function () {
21090       return getPackageCandidates(x, start, opts);
21091     };
21092
21093     var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk();
21094
21095     for (var i = 0; i < dirs.length; i++) {
21096       var dir = dirs[i];
21097
21098       if (isDirectory(path$j.dirname(dir))) {
21099         var m = loadAsFileSync(dir);
21100         if (m) return m;
21101         var n = loadAsDirectorySync(dir);
21102         if (n) return n;
21103       }
21104     }
21105   }
21106 };
21107
21108 var async$7 = async$8;
21109 async$7.core = core_1;
21110 async$7.isCore = isCore$1;
21111 async$7.sync = sync$8;
21112 var resolve$3 = async$7;
21113
21114 let {
21115   resolve: resolve$2
21116 } = require; // In the VS Code and Atom extensions `require` is overridden and `require.resolve` doesn't support the 2nd argument.
21117
21118 if (resolve$2.length === 1 || process.env.PRETTIER_FALLBACK_RESOLVE) {
21119   // @ts-expect-error
21120   resolve$2 = (id, options) => {
21121     let basedir;
21122
21123     if (options && options.paths && options.paths.length === 1) {
21124       basedir = options.paths[0];
21125     }
21126
21127     return resolve$3.sync(id, {
21128       basedir
21129     });
21130   };
21131 }
21132
21133 var resolve_1 = resolve$2;
21134
21135 var src$1 = {};
21136
21137 var semver$1 = {exports: {}};
21138
21139 (function (module, exports) {
21140   exports = module.exports = SemVer;
21141   var debug;
21142   /* istanbul ignore next */
21143
21144   if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
21145     debug = function () {
21146       var args = Array.prototype.slice.call(arguments, 0);
21147       args.unshift('SEMVER');
21148       console.log.apply(console, args);
21149     };
21150   } else {
21151     debug = function () {};
21152   } // Note: this is the semver.org version of the spec that it implements
21153   // Not necessarily the package version of this code.
21154
21155
21156   exports.SEMVER_SPEC_VERSION = '2.0.0';
21157   var MAX_LENGTH = 256;
21158   var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
21159   /* istanbul ignore next */
21160   9007199254740991; // Max safe segment length for coercion.
21161
21162   var MAX_SAFE_COMPONENT_LENGTH = 16; // The actual regexps go on exports.re
21163
21164   var re = exports.re = [];
21165   var src = exports.src = [];
21166   var R = 0; // The following Regular Expressions can be used for tokenizing,
21167   // validating, and parsing SemVer version strings.
21168   // ## Numeric Identifier
21169   // A single `0`, or a non-zero digit followed by zero or more digits.
21170
21171   var NUMERICIDENTIFIER = R++;
21172   src[NUMERICIDENTIFIER] = '0|[1-9]\\d*';
21173   var NUMERICIDENTIFIERLOOSE = R++;
21174   src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; // ## Non-numeric Identifier
21175   // Zero or more digits, followed by a letter or hyphen, and then zero or
21176   // more letters, digits, or hyphens.
21177
21178   var NONNUMERICIDENTIFIER = R++;
21179   src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; // ## Main Version
21180   // Three dot-separated numeric identifiers.
21181
21182   var MAINVERSION = R++;
21183   src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')\\.' + '(' + src[NUMERICIDENTIFIER] + ')';
21184   var MAINVERSIONLOOSE = R++;
21185   src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; // ## Pre-release Version Identifier
21186   // A numeric identifier, or a non-numeric identifier.
21187
21188   var PRERELEASEIDENTIFIER = R++;
21189   src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + '|' + src[NONNUMERICIDENTIFIER] + ')';
21190   var PRERELEASEIDENTIFIERLOOSE = R++;
21191   src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + '|' + src[NONNUMERICIDENTIFIER] + ')'; // ## Pre-release Version
21192   // Hyphen, followed by one or more dot-separated pre-release version
21193   // identifiers.
21194
21195   var PRERELEASE = R++;
21196   src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))';
21197   var PRERELEASELOOSE = R++;
21198   src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; // ## Build Metadata Identifier
21199   // Any combination of digits, letters, or hyphens.
21200
21201   var BUILDIDENTIFIER = R++;
21202   src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; // ## Build Metadata
21203   // Plus sign, followed by one or more period-separated build metadata
21204   // identifiers.
21205
21206   var BUILD = R++;
21207   src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; // ## Full Version String
21208   // A main version, followed optionally by a pre-release version and
21209   // build metadata.
21210   // Note that the only major, minor, patch, and pre-release sections of
21211   // the version string are capturing groups.  The build metadata is not a
21212   // capturing group, because it should not ever be used in version
21213   // comparison.
21214
21215   var FULL = R++;
21216   var FULLPLAIN = 'v?' + src[MAINVERSION] + src[PRERELEASE] + '?' + src[BUILD] + '?';
21217   src[FULL] = '^' + FULLPLAIN + '$'; // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
21218   // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
21219   // common in the npm registry.
21220
21221   var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + src[PRERELEASELOOSE] + '?' + src[BUILD] + '?';
21222   var LOOSE = R++;
21223   src[LOOSE] = '^' + LOOSEPLAIN + '$';
21224   var GTLT = R++;
21225   src[GTLT] = '((?:<|>)?=?)'; // Something like "2.*" or "1.2.x".
21226   // Note that "x.x" is a valid xRange identifer, meaning "any version"
21227   // Only the first item is strictly required.
21228
21229   var XRANGEIDENTIFIERLOOSE = R++;
21230   src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
21231   var XRANGEIDENTIFIER = R++;
21232   src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*';
21233   var XRANGEPLAIN = R++;
21234   src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + '(?:' + src[PRERELEASE] + ')?' + src[BUILD] + '?' + ')?)?';
21235   var XRANGEPLAINLOOSE = R++;
21236   src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[PRERELEASELOOSE] + ')?' + src[BUILD] + '?' + ')?)?';
21237   var XRANGE = R++;
21238   src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$';
21239   var XRANGELOOSE = R++;
21240   src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; // Coercion.
21241   // Extract anything that could conceivably be a part of a valid semver
21242
21243   var COERCE = R++;
21244   src[COERCE] = '(?:^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])'; // Tilde ranges.
21245   // Meaning is "reasonably at or greater than"
21246
21247   var LONETILDE = R++;
21248   src[LONETILDE] = '(?:~>?)';
21249   var TILDETRIM = R++;
21250   src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+';
21251   re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g');
21252   var tildeTrimReplace = '$1~';
21253   var TILDE = R++;
21254   src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$';
21255   var TILDELOOSE = R++;
21256   src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; // Caret ranges.
21257   // Meaning is "at least and backwards compatible with"
21258
21259   var LONECARET = R++;
21260   src[LONECARET] = '(?:\\^)';
21261   var CARETTRIM = R++;
21262   src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+';
21263   re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g');
21264   var caretTrimReplace = '$1^';
21265   var CARET = R++;
21266   src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$';
21267   var CARETLOOSE = R++;
21268   src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; // A simple gt/lt/eq thing, or just "" to indicate "any version"
21269
21270   var COMPARATORLOOSE = R++;
21271   src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$';
21272   var COMPARATOR = R++;
21273   src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; // An expression to strip any whitespace between the gtlt and the thing
21274   // it modifies, so that `> 1.2.3` ==> `>1.2.3`
21275
21276   var COMPARATORTRIM = R++;
21277   src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; // this one has to use the /g flag
21278
21279   re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g');
21280   var comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4`
21281   // Note that these all use the loose form, because they'll be
21282   // checked against either the strict or loose comparator form
21283   // later.
21284
21285   var HYPHENRANGE = R++;
21286   src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAIN] + ')' + '\\s*$';
21287   var HYPHENRANGELOOSE = R++;
21288   src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[XRANGEPLAINLOOSE] + ')' + '\\s*$'; // Star ranges basically just allow anything at all.
21289
21290   var STAR = R++;
21291   src[STAR] = '(<|>)?=?\\s*\\*'; // Compile to actual regexp objects.
21292   // All are flag-free, unless they were created above with a flag.
21293
21294   for (var i = 0; i < R; i++) {
21295     debug(i, src[i]);
21296
21297     if (!re[i]) {
21298       re[i] = new RegExp(src[i]);
21299     }
21300   }
21301
21302   exports.parse = parse;
21303
21304   function parse(version, options) {
21305     if (!options || typeof options !== 'object') {
21306       options = {
21307         loose: !!options,
21308         includePrerelease: false
21309       };
21310     }
21311
21312     if (version instanceof SemVer) {
21313       return version;
21314     }
21315
21316     if (typeof version !== 'string') {
21317       return null;
21318     }
21319
21320     if (version.length > MAX_LENGTH) {
21321       return null;
21322     }
21323
21324     var r = options.loose ? re[LOOSE] : re[FULL];
21325
21326     if (!r.test(version)) {
21327       return null;
21328     }
21329
21330     try {
21331       return new SemVer(version, options);
21332     } catch (er) {
21333       return null;
21334     }
21335   }
21336
21337   exports.valid = valid;
21338
21339   function valid(version, options) {
21340     var v = parse(version, options);
21341     return v ? v.version : null;
21342   }
21343
21344   exports.clean = clean;
21345
21346   function clean(version, options) {
21347     var s = parse(version.trim().replace(/^[=v]+/, ''), options);
21348     return s ? s.version : null;
21349   }
21350
21351   exports.SemVer = SemVer;
21352
21353   function SemVer(version, options) {
21354     if (!options || typeof options !== 'object') {
21355       options = {
21356         loose: !!options,
21357         includePrerelease: false
21358       };
21359     }
21360
21361     if (version instanceof SemVer) {
21362       if (version.loose === options.loose) {
21363         return version;
21364       } else {
21365         version = version.version;
21366       }
21367     } else if (typeof version !== 'string') {
21368       throw new TypeError('Invalid Version: ' + version);
21369     }
21370
21371     if (version.length > MAX_LENGTH) {
21372       throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
21373     }
21374
21375     if (!(this instanceof SemVer)) {
21376       return new SemVer(version, options);
21377     }
21378
21379     debug('SemVer', version, options);
21380     this.options = options;
21381     this.loose = !!options.loose;
21382     var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
21383
21384     if (!m) {
21385       throw new TypeError('Invalid Version: ' + version);
21386     }
21387
21388     this.raw = version; // these are actually numbers
21389
21390     this.major = +m[1];
21391     this.minor = +m[2];
21392     this.patch = +m[3];
21393
21394     if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
21395       throw new TypeError('Invalid major version');
21396     }
21397
21398     if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
21399       throw new TypeError('Invalid minor version');
21400     }
21401
21402     if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
21403       throw new TypeError('Invalid patch version');
21404     } // numberify any prerelease numeric ids
21405
21406
21407     if (!m[4]) {
21408       this.prerelease = [];
21409     } else {
21410       this.prerelease = m[4].split('.').map(function (id) {
21411         if (/^[0-9]+$/.test(id)) {
21412           var num = +id;
21413
21414           if (num >= 0 && num < MAX_SAFE_INTEGER) {
21415             return num;
21416           }
21417         }
21418
21419         return id;
21420       });
21421     }
21422
21423     this.build = m[5] ? m[5].split('.') : [];
21424     this.format();
21425   }
21426
21427   SemVer.prototype.format = function () {
21428     this.version = this.major + '.' + this.minor + '.' + this.patch;
21429
21430     if (this.prerelease.length) {
21431       this.version += '-' + this.prerelease.join('.');
21432     }
21433
21434     return this.version;
21435   };
21436
21437   SemVer.prototype.toString = function () {
21438     return this.version;
21439   };
21440
21441   SemVer.prototype.compare = function (other) {
21442     debug('SemVer.compare', this.version, this.options, other);
21443
21444     if (!(other instanceof SemVer)) {
21445       other = new SemVer(other, this.options);
21446     }
21447
21448     return this.compareMain(other) || this.comparePre(other);
21449   };
21450
21451   SemVer.prototype.compareMain = function (other) {
21452     if (!(other instanceof SemVer)) {
21453       other = new SemVer(other, this.options);
21454     }
21455
21456     return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
21457   };
21458
21459   SemVer.prototype.comparePre = function (other) {
21460     if (!(other instanceof SemVer)) {
21461       other = new SemVer(other, this.options);
21462     } // NOT having a prerelease is > having one
21463
21464
21465     if (this.prerelease.length && !other.prerelease.length) {
21466       return -1;
21467     } else if (!this.prerelease.length && other.prerelease.length) {
21468       return 1;
21469     } else if (!this.prerelease.length && !other.prerelease.length) {
21470       return 0;
21471     }
21472
21473     var i = 0;
21474
21475     do {
21476       var a = this.prerelease[i];
21477       var b = other.prerelease[i];
21478       debug('prerelease compare', i, a, b);
21479
21480       if (a === undefined && b === undefined) {
21481         return 0;
21482       } else if (b === undefined) {
21483         return 1;
21484       } else if (a === undefined) {
21485         return -1;
21486       } else if (a === b) {
21487         continue;
21488       } else {
21489         return compareIdentifiers(a, b);
21490       }
21491     } while (++i);
21492   }; // preminor will bump the version up to the next minor release, and immediately
21493   // down to pre-release. premajor and prepatch work the same way.
21494
21495
21496   SemVer.prototype.inc = function (release, identifier) {
21497     switch (release) {
21498       case 'premajor':
21499         this.prerelease.length = 0;
21500         this.patch = 0;
21501         this.minor = 0;
21502         this.major++;
21503         this.inc('pre', identifier);
21504         break;
21505
21506       case 'preminor':
21507         this.prerelease.length = 0;
21508         this.patch = 0;
21509         this.minor++;
21510         this.inc('pre', identifier);
21511         break;
21512
21513       case 'prepatch':
21514         // If this is already a prerelease, it will bump to the next version
21515         // drop any prereleases that might already exist, since they are not
21516         // relevant at this point.
21517         this.prerelease.length = 0;
21518         this.inc('patch', identifier);
21519         this.inc('pre', identifier);
21520         break;
21521       // If the input is a non-prerelease version, this acts the same as
21522       // prepatch.
21523
21524       case 'prerelease':
21525         if (this.prerelease.length === 0) {
21526           this.inc('patch', identifier);
21527         }
21528
21529         this.inc('pre', identifier);
21530         break;
21531
21532       case 'major':
21533         // If this is a pre-major version, bump up to the same major version.
21534         // Otherwise increment major.
21535         // 1.0.0-5 bumps to 1.0.0
21536         // 1.1.0 bumps to 2.0.0
21537         if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
21538           this.major++;
21539         }
21540
21541         this.minor = 0;
21542         this.patch = 0;
21543         this.prerelease = [];
21544         break;
21545
21546       case 'minor':
21547         // If this is a pre-minor version, bump up to the same minor version.
21548         // Otherwise increment minor.
21549         // 1.2.0-5 bumps to 1.2.0
21550         // 1.2.1 bumps to 1.3.0
21551         if (this.patch !== 0 || this.prerelease.length === 0) {
21552           this.minor++;
21553         }
21554
21555         this.patch = 0;
21556         this.prerelease = [];
21557         break;
21558
21559       case 'patch':
21560         // If this is not a pre-release version, it will increment the patch.
21561         // If it is a pre-release it will bump up to the same patch version.
21562         // 1.2.0-5 patches to 1.2.0
21563         // 1.2.0 patches to 1.2.1
21564         if (this.prerelease.length === 0) {
21565           this.patch++;
21566         }
21567
21568         this.prerelease = [];
21569         break;
21570       // This probably shouldn't be used publicly.
21571       // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
21572
21573       case 'pre':
21574         if (this.prerelease.length === 0) {
21575           this.prerelease = [0];
21576         } else {
21577           var i = this.prerelease.length;
21578
21579           while (--i >= 0) {
21580             if (typeof this.prerelease[i] === 'number') {
21581               this.prerelease[i]++;
21582               i = -2;
21583             }
21584           }
21585
21586           if (i === -1) {
21587             // didn't increment anything
21588             this.prerelease.push(0);
21589           }
21590         }
21591
21592         if (identifier) {
21593           // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
21594           // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
21595           if (this.prerelease[0] === identifier) {
21596             if (isNaN(this.prerelease[1])) {
21597               this.prerelease = [identifier, 0];
21598             }
21599           } else {
21600             this.prerelease = [identifier, 0];
21601           }
21602         }
21603
21604         break;
21605
21606       default:
21607         throw new Error('invalid increment argument: ' + release);
21608     }
21609
21610     this.format();
21611     this.raw = this.version;
21612     return this;
21613   };
21614
21615   exports.inc = inc;
21616
21617   function inc(version, release, loose, identifier) {
21618     if (typeof loose === 'string') {
21619       identifier = loose;
21620       loose = undefined;
21621     }
21622
21623     try {
21624       return new SemVer(version, loose).inc(release, identifier).version;
21625     } catch (er) {
21626       return null;
21627     }
21628   }
21629
21630   exports.diff = diff;
21631
21632   function diff(version1, version2) {
21633     if (eq(version1, version2)) {
21634       return null;
21635     } else {
21636       var v1 = parse(version1);
21637       var v2 = parse(version2);
21638       var prefix = '';
21639
21640       if (v1.prerelease.length || v2.prerelease.length) {
21641         prefix = 'pre';
21642         var defaultResult = 'prerelease';
21643       }
21644
21645       for (var key in v1) {
21646         if (key === 'major' || key === 'minor' || key === 'patch') {
21647           if (v1[key] !== v2[key]) {
21648             return prefix + key;
21649           }
21650         }
21651       }
21652
21653       return defaultResult; // may be undefined
21654     }
21655   }
21656
21657   exports.compareIdentifiers = compareIdentifiers;
21658   var numeric = /^[0-9]+$/;
21659
21660   function compareIdentifiers(a, b) {
21661     var anum = numeric.test(a);
21662     var bnum = numeric.test(b);
21663
21664     if (anum && bnum) {
21665       a = +a;
21666       b = +b;
21667     }
21668
21669     return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
21670   }
21671
21672   exports.rcompareIdentifiers = rcompareIdentifiers;
21673
21674   function rcompareIdentifiers(a, b) {
21675     return compareIdentifiers(b, a);
21676   }
21677
21678   exports.major = major;
21679
21680   function major(a, loose) {
21681     return new SemVer(a, loose).major;
21682   }
21683
21684   exports.minor = minor;
21685
21686   function minor(a, loose) {
21687     return new SemVer(a, loose).minor;
21688   }
21689
21690   exports.patch = patch;
21691
21692   function patch(a, loose) {
21693     return new SemVer(a, loose).patch;
21694   }
21695
21696   exports.compare = compare;
21697
21698   function compare(a, b, loose) {
21699     return new SemVer(a, loose).compare(new SemVer(b, loose));
21700   }
21701
21702   exports.compareLoose = compareLoose;
21703
21704   function compareLoose(a, b) {
21705     return compare(a, b, true);
21706   }
21707
21708   exports.rcompare = rcompare;
21709
21710   function rcompare(a, b, loose) {
21711     return compare(b, a, loose);
21712   }
21713
21714   exports.sort = sort;
21715
21716   function sort(list, loose) {
21717     return list.sort(function (a, b) {
21718       return exports.compare(a, b, loose);
21719     });
21720   }
21721
21722   exports.rsort = rsort;
21723
21724   function rsort(list, loose) {
21725     return list.sort(function (a, b) {
21726       return exports.rcompare(a, b, loose);
21727     });
21728   }
21729
21730   exports.gt = gt;
21731
21732   function gt(a, b, loose) {
21733     return compare(a, b, loose) > 0;
21734   }
21735
21736   exports.lt = lt;
21737
21738   function lt(a, b, loose) {
21739     return compare(a, b, loose) < 0;
21740   }
21741
21742   exports.eq = eq;
21743
21744   function eq(a, b, loose) {
21745     return compare(a, b, loose) === 0;
21746   }
21747
21748   exports.neq = neq;
21749
21750   function neq(a, b, loose) {
21751     return compare(a, b, loose) !== 0;
21752   }
21753
21754   exports.gte = gte;
21755
21756   function gte(a, b, loose) {
21757     return compare(a, b, loose) >= 0;
21758   }
21759
21760   exports.lte = lte;
21761
21762   function lte(a, b, loose) {
21763     return compare(a, b, loose) <= 0;
21764   }
21765
21766   exports.cmp = cmp;
21767
21768   function cmp(a, op, b, loose) {
21769     switch (op) {
21770       case '===':
21771         if (typeof a === 'object') a = a.version;
21772         if (typeof b === 'object') b = b.version;
21773         return a === b;
21774
21775       case '!==':
21776         if (typeof a === 'object') a = a.version;
21777         if (typeof b === 'object') b = b.version;
21778         return a !== b;
21779
21780       case '':
21781       case '=':
21782       case '==':
21783         return eq(a, b, loose);
21784
21785       case '!=':
21786         return neq(a, b, loose);
21787
21788       case '>':
21789         return gt(a, b, loose);
21790
21791       case '>=':
21792         return gte(a, b, loose);
21793
21794       case '<':
21795         return lt(a, b, loose);
21796
21797       case '<=':
21798         return lte(a, b, loose);
21799
21800       default:
21801         throw new TypeError('Invalid operator: ' + op);
21802     }
21803   }
21804
21805   exports.Comparator = Comparator;
21806
21807   function Comparator(comp, options) {
21808     if (!options || typeof options !== 'object') {
21809       options = {
21810         loose: !!options,
21811         includePrerelease: false
21812       };
21813     }
21814
21815     if (comp instanceof Comparator) {
21816       if (comp.loose === !!options.loose) {
21817         return comp;
21818       } else {
21819         comp = comp.value;
21820       }
21821     }
21822
21823     if (!(this instanceof Comparator)) {
21824       return new Comparator(comp, options);
21825     }
21826
21827     debug('comparator', comp, options);
21828     this.options = options;
21829     this.loose = !!options.loose;
21830     this.parse(comp);
21831
21832     if (this.semver === ANY) {
21833       this.value = '';
21834     } else {
21835       this.value = this.operator + this.semver.version;
21836     }
21837
21838     debug('comp', this);
21839   }
21840
21841   var ANY = {};
21842
21843   Comparator.prototype.parse = function (comp) {
21844     var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
21845     var m = comp.match(r);
21846
21847     if (!m) {
21848       throw new TypeError('Invalid comparator: ' + comp);
21849     }
21850
21851     this.operator = m[1];
21852
21853     if (this.operator === '=') {
21854       this.operator = '';
21855     } // if it literally is just '>' or '' then allow anything.
21856
21857
21858     if (!m[2]) {
21859       this.semver = ANY;
21860     } else {
21861       this.semver = new SemVer(m[2], this.options.loose);
21862     }
21863   };
21864
21865   Comparator.prototype.toString = function () {
21866     return this.value;
21867   };
21868
21869   Comparator.prototype.test = function (version) {
21870     debug('Comparator.test', version, this.options.loose);
21871
21872     if (this.semver === ANY) {
21873       return true;
21874     }
21875
21876     if (typeof version === 'string') {
21877       version = new SemVer(version, this.options);
21878     }
21879
21880     return cmp(version, this.operator, this.semver, this.options);
21881   };
21882
21883   Comparator.prototype.intersects = function (comp, options) {
21884     if (!(comp instanceof Comparator)) {
21885       throw new TypeError('a Comparator is required');
21886     }
21887
21888     if (!options || typeof options !== 'object') {
21889       options = {
21890         loose: !!options,
21891         includePrerelease: false
21892       };
21893     }
21894
21895     var rangeTmp;
21896
21897     if (this.operator === '') {
21898       rangeTmp = new Range(comp.value, options);
21899       return satisfies(this.value, rangeTmp, options);
21900     } else if (comp.operator === '') {
21901       rangeTmp = new Range(this.value, options);
21902       return satisfies(comp.semver, rangeTmp, options);
21903     }
21904
21905     var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
21906     var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
21907     var sameSemVer = this.semver.version === comp.semver.version;
21908     var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
21909     var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
21910     var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
21911     return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
21912   };
21913
21914   exports.Range = Range;
21915
21916   function Range(range, options) {
21917     if (!options || typeof options !== 'object') {
21918       options = {
21919         loose: !!options,
21920         includePrerelease: false
21921       };
21922     }
21923
21924     if (range instanceof Range) {
21925       if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
21926         return range;
21927       } else {
21928         return new Range(range.raw, options);
21929       }
21930     }
21931
21932     if (range instanceof Comparator) {
21933       return new Range(range.value, options);
21934     }
21935
21936     if (!(this instanceof Range)) {
21937       return new Range(range, options);
21938     }
21939
21940     this.options = options;
21941     this.loose = !!options.loose;
21942     this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or ||
21943
21944     this.raw = range;
21945     this.set = range.split(/\s*\|\|\s*/).map(function (range) {
21946       return this.parseRange(range.trim());
21947     }, this).filter(function (c) {
21948       // throw out any that are not relevant for whatever reason
21949       return c.length;
21950     });
21951
21952     if (!this.set.length) {
21953       throw new TypeError('Invalid SemVer Range: ' + range);
21954     }
21955
21956     this.format();
21957   }
21958
21959   Range.prototype.format = function () {
21960     this.range = this.set.map(function (comps) {
21961       return comps.join(' ').trim();
21962     }).join('||').trim();
21963     return this.range;
21964   };
21965
21966   Range.prototype.toString = function () {
21967     return this.range;
21968   };
21969
21970   Range.prototype.parseRange = function (range) {
21971     var loose = this.options.loose;
21972     range = range.trim(); // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
21973
21974     var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
21975     range = range.replace(hr, hyphenReplace);
21976     debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
21977
21978     range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace);
21979     debug('comparator trim', range, re[COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3`
21980
21981     range = range.replace(re[TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3`
21982
21983     range = range.replace(re[CARETTRIM], caretTrimReplace); // normalize spaces
21984
21985     range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and
21986     // ready to be split into comparators.
21987
21988     var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
21989     var set = range.split(' ').map(function (comp) {
21990       return parseComparator(comp, this.options);
21991     }, this).join(' ').split(/\s+/);
21992
21993     if (this.options.loose) {
21994       // in loose mode, throw out any that are not valid comparators
21995       set = set.filter(function (comp) {
21996         return !!comp.match(compRe);
21997       });
21998     }
21999
22000     set = set.map(function (comp) {
22001       return new Comparator(comp, this.options);
22002     }, this);
22003     return set;
22004   };
22005
22006   Range.prototype.intersects = function (range, options) {
22007     if (!(range instanceof Range)) {
22008       throw new TypeError('a Range is required');
22009     }
22010
22011     return this.set.some(function (thisComparators) {
22012       return thisComparators.every(function (thisComparator) {
22013         return range.set.some(function (rangeComparators) {
22014           return rangeComparators.every(function (rangeComparator) {
22015             return thisComparator.intersects(rangeComparator, options);
22016           });
22017         });
22018       });
22019     });
22020   }; // Mostly just for testing and legacy API reasons
22021
22022
22023   exports.toComparators = toComparators;
22024
22025   function toComparators(range, options) {
22026     return new Range(range, options).set.map(function (comp) {
22027       return comp.map(function (c) {
22028         return c.value;
22029       }).join(' ').trim().split(' ');
22030     });
22031   } // comprised of xranges, tildes, stars, and gtlt's at this point.
22032   // already replaced the hyphen ranges
22033   // turn into a set of JUST comparators.
22034
22035
22036   function parseComparator(comp, options) {
22037     debug('comp', comp, options);
22038     comp = replaceCarets(comp, options);
22039     debug('caret', comp);
22040     comp = replaceTildes(comp, options);
22041     debug('tildes', comp);
22042     comp = replaceXRanges(comp, options);
22043     debug('xrange', comp);
22044     comp = replaceStars(comp, options);
22045     debug('stars', comp);
22046     return comp;
22047   }
22048
22049   function isX(id) {
22050     return !id || id.toLowerCase() === 'x' || id === '*';
22051   } // ~, ~> --> * (any, kinda silly)
22052   // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
22053   // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
22054   // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
22055   // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
22056   // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
22057
22058
22059   function replaceTildes(comp, options) {
22060     return comp.trim().split(/\s+/).map(function (comp) {
22061       return replaceTilde(comp, options);
22062     }).join(' ');
22063   }
22064
22065   function replaceTilde(comp, options) {
22066     var r = options.loose ? re[TILDELOOSE] : re[TILDE];
22067     return comp.replace(r, function (_, M, m, p, pr) {
22068       debug('tilde', comp, _, M, m, p, pr);
22069       var ret;
22070
22071       if (isX(M)) {
22072         ret = '';
22073       } else if (isX(m)) {
22074         ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
22075       } else if (isX(p)) {
22076         // ~1.2 == >=1.2.0 <1.3.0
22077         ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
22078       } else if (pr) {
22079         debug('replaceTilde pr', pr);
22080         ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
22081       } else {
22082         // ~1.2.3 == >=1.2.3 <1.3.0
22083         ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
22084       }
22085
22086       debug('tilde return', ret);
22087       return ret;
22088     });
22089   } // ^ --> * (any, kinda silly)
22090   // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
22091   // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
22092   // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
22093   // ^1.2.3 --> >=1.2.3 <2.0.0
22094   // ^1.2.0 --> >=1.2.0 <2.0.0
22095
22096
22097   function replaceCarets(comp, options) {
22098     return comp.trim().split(/\s+/).map(function (comp) {
22099       return replaceCaret(comp, options);
22100     }).join(' ');
22101   }
22102
22103   function replaceCaret(comp, options) {
22104     debug('caret', comp, options);
22105     var r = options.loose ? re[CARETLOOSE] : re[CARET];
22106     return comp.replace(r, function (_, M, m, p, pr) {
22107       debug('caret', comp, _, M, m, p, pr);
22108       var ret;
22109
22110       if (isX(M)) {
22111         ret = '';
22112       } else if (isX(m)) {
22113         ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
22114       } else if (isX(p)) {
22115         if (M === '0') {
22116           ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
22117         } else {
22118           ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
22119         }
22120       } else if (pr) {
22121         debug('replaceCaret pr', pr);
22122
22123         if (M === '0') {
22124           if (m === '0') {
22125             ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
22126           } else {
22127             ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
22128           }
22129         } else {
22130           ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
22131         }
22132       } else {
22133         debug('no pr');
22134
22135         if (M === '0') {
22136           if (m === '0') {
22137             ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
22138           } else {
22139             ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
22140           }
22141         } else {
22142           ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
22143         }
22144       }
22145
22146       debug('caret return', ret);
22147       return ret;
22148     });
22149   }
22150
22151   function replaceXRanges(comp, options) {
22152     debug('replaceXRanges', comp, options);
22153     return comp.split(/\s+/).map(function (comp) {
22154       return replaceXRange(comp, options);
22155     }).join(' ');
22156   }
22157
22158   function replaceXRange(comp, options) {
22159     comp = comp.trim();
22160     var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
22161     return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
22162       debug('xRange', comp, ret, gtlt, M, m, p, pr);
22163       var xM = isX(M);
22164       var xm = xM || isX(m);
22165       var xp = xm || isX(p);
22166       var anyX = xp;
22167
22168       if (gtlt === '=' && anyX) {
22169         gtlt = '';
22170       }
22171
22172       if (xM) {
22173         if (gtlt === '>' || gtlt === '<') {
22174           // nothing is allowed
22175           ret = '<0.0.0';
22176         } else {
22177           // nothing is forbidden
22178           ret = '*';
22179         }
22180       } else if (gtlt && anyX) {
22181         // we know patch is an x, because we have any x at all.
22182         // replace X with 0
22183         if (xm) {
22184           m = 0;
22185         }
22186
22187         p = 0;
22188
22189         if (gtlt === '>') {
22190           // >1 => >=2.0.0
22191           // >1.2 => >=1.3.0
22192           // >1.2.3 => >= 1.2.4
22193           gtlt = '>=';
22194
22195           if (xm) {
22196             M = +M + 1;
22197             m = 0;
22198             p = 0;
22199           } else {
22200             m = +m + 1;
22201             p = 0;
22202           }
22203         } else if (gtlt === '<=') {
22204           // <=0.7.x is actually <0.8.0, since any 0.7.x should
22205           // pass.  Similarly, <=7.x is actually <8.0.0, etc.
22206           gtlt = '<';
22207
22208           if (xm) {
22209             M = +M + 1;
22210           } else {
22211             m = +m + 1;
22212           }
22213         }
22214
22215         ret = gtlt + M + '.' + m + '.' + p;
22216       } else if (xm) {
22217         ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
22218       } else if (xp) {
22219         ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
22220       }
22221
22222       debug('xRange return', ret);
22223       return ret;
22224     });
22225   } // Because * is AND-ed with everything else in the comparator,
22226   // and '' means "any version", just remove the *s entirely.
22227
22228
22229   function replaceStars(comp, options) {
22230     debug('replaceStars', comp, options); // Looseness is ignored here.  star is always as loose as it gets!
22231
22232     return comp.trim().replace(re[STAR], '');
22233   } // This function is passed to string.replace(re[HYPHENRANGE])
22234   // M, m, patch, prerelease, build
22235   // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
22236   // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
22237   // 1.2 - 3.4 => >=1.2.0 <3.5.0
22238
22239
22240   function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
22241     if (isX(fM)) {
22242       from = '';
22243     } else if (isX(fm)) {
22244       from = '>=' + fM + '.0.0';
22245     } else if (isX(fp)) {
22246       from = '>=' + fM + '.' + fm + '.0';
22247     } else {
22248       from = '>=' + from;
22249     }
22250
22251     if (isX(tM)) {
22252       to = '';
22253     } else if (isX(tm)) {
22254       to = '<' + (+tM + 1) + '.0.0';
22255     } else if (isX(tp)) {
22256       to = '<' + tM + '.' + (+tm + 1) + '.0';
22257     } else if (tpr) {
22258       to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
22259     } else {
22260       to = '<=' + to;
22261     }
22262
22263     return (from + ' ' + to).trim();
22264   } // if ANY of the sets match ALL of its comparators, then pass
22265
22266
22267   Range.prototype.test = function (version) {
22268     if (!version) {
22269       return false;
22270     }
22271
22272     if (typeof version === 'string') {
22273       version = new SemVer(version, this.options);
22274     }
22275
22276     for (var i = 0; i < this.set.length; i++) {
22277       if (testSet(this.set[i], version, this.options)) {
22278         return true;
22279       }
22280     }
22281
22282     return false;
22283   };
22284
22285   function testSet(set, version, options) {
22286     for (var i = 0; i < set.length; i++) {
22287       if (!set[i].test(version)) {
22288         return false;
22289       }
22290     }
22291
22292     if (version.prerelease.length && !options.includePrerelease) {
22293       // Find the set of versions that are allowed to have prereleases
22294       // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
22295       // That should allow `1.2.3-pr.2` to pass.
22296       // However, `1.2.4-alpha.notready` should NOT be allowed,
22297       // even though it's within the range set by the comparators.
22298       for (i = 0; i < set.length; i++) {
22299         debug(set[i].semver);
22300
22301         if (set[i].semver === ANY) {
22302           continue;
22303         }
22304
22305         if (set[i].semver.prerelease.length > 0) {
22306           var allowed = set[i].semver;
22307
22308           if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
22309             return true;
22310           }
22311         }
22312       } // Version has a -pre, but it's not one of the ones we like.
22313
22314
22315       return false;
22316     }
22317
22318     return true;
22319   }
22320
22321   exports.satisfies = satisfies;
22322
22323   function satisfies(version, range, options) {
22324     try {
22325       range = new Range(range, options);
22326     } catch (er) {
22327       return false;
22328     }
22329
22330     return range.test(version);
22331   }
22332
22333   exports.maxSatisfying = maxSatisfying;
22334
22335   function maxSatisfying(versions, range, options) {
22336     var max = null;
22337     var maxSV = null;
22338
22339     try {
22340       var rangeObj = new Range(range, options);
22341     } catch (er) {
22342       return null;
22343     }
22344
22345     versions.forEach(function (v) {
22346       if (rangeObj.test(v)) {
22347         // satisfies(v, range, options)
22348         if (!max || maxSV.compare(v) === -1) {
22349           // compare(max, v, true)
22350           max = v;
22351           maxSV = new SemVer(max, options);
22352         }
22353       }
22354     });
22355     return max;
22356   }
22357
22358   exports.minSatisfying = minSatisfying;
22359
22360   function minSatisfying(versions, range, options) {
22361     var min = null;
22362     var minSV = null;
22363
22364     try {
22365       var rangeObj = new Range(range, options);
22366     } catch (er) {
22367       return null;
22368     }
22369
22370     versions.forEach(function (v) {
22371       if (rangeObj.test(v)) {
22372         // satisfies(v, range, options)
22373         if (!min || minSV.compare(v) === 1) {
22374           // compare(min, v, true)
22375           min = v;
22376           minSV = new SemVer(min, options);
22377         }
22378       }
22379     });
22380     return min;
22381   }
22382
22383   exports.minVersion = minVersion;
22384
22385   function minVersion(range, loose) {
22386     range = new Range(range, loose);
22387     var minver = new SemVer('0.0.0');
22388
22389     if (range.test(minver)) {
22390       return minver;
22391     }
22392
22393     minver = new SemVer('0.0.0-0');
22394
22395     if (range.test(minver)) {
22396       return minver;
22397     }
22398
22399     minver = null;
22400
22401     for (var i = 0; i < range.set.length; ++i) {
22402       var comparators = range.set[i];
22403       comparators.forEach(function (comparator) {
22404         // Clone to avoid manipulating the comparator's semver object.
22405         var compver = new SemVer(comparator.semver.version);
22406
22407         switch (comparator.operator) {
22408           case '>':
22409             if (compver.prerelease.length === 0) {
22410               compver.patch++;
22411             } else {
22412               compver.prerelease.push(0);
22413             }
22414
22415             compver.raw = compver.format();
22416
22417           /* fallthrough */
22418
22419           case '':
22420           case '>=':
22421             if (!minver || gt(minver, compver)) {
22422               minver = compver;
22423             }
22424
22425             break;
22426
22427           case '<':
22428           case '<=':
22429             /* Ignore maximum versions */
22430             break;
22431
22432           /* istanbul ignore next */
22433
22434           default:
22435             throw new Error('Unexpected operation: ' + comparator.operator);
22436         }
22437       });
22438     }
22439
22440     if (minver && range.test(minver)) {
22441       return minver;
22442     }
22443
22444     return null;
22445   }
22446
22447   exports.validRange = validRange;
22448
22449   function validRange(range, options) {
22450     try {
22451       // Return '*' instead of '' so that truthiness works.
22452       // This will throw if it's invalid anyway
22453       return new Range(range, options).range || '*';
22454     } catch (er) {
22455       return null;
22456     }
22457   } // Determine if version is less than all the versions possible in the range
22458
22459
22460   exports.ltr = ltr;
22461
22462   function ltr(version, range, options) {
22463     return outside(version, range, '<', options);
22464   } // Determine if version is greater than all the versions possible in the range.
22465
22466
22467   exports.gtr = gtr;
22468
22469   function gtr(version, range, options) {
22470     return outside(version, range, '>', options);
22471   }
22472
22473   exports.outside = outside;
22474
22475   function outside(version, range, hilo, options) {
22476     version = new SemVer(version, options);
22477     range = new Range(range, options);
22478     var gtfn, ltefn, ltfn, comp, ecomp;
22479
22480     switch (hilo) {
22481       case '>':
22482         gtfn = gt;
22483         ltefn = lte;
22484         ltfn = lt;
22485         comp = '>';
22486         ecomp = '>=';
22487         break;
22488
22489       case '<':
22490         gtfn = lt;
22491         ltefn = gte;
22492         ltfn = gt;
22493         comp = '<';
22494         ecomp = '<=';
22495         break;
22496
22497       default:
22498         throw new TypeError('Must provide a hilo val of "<" or ">"');
22499     } // If it satisifes the range it is not outside
22500
22501
22502     if (satisfies(version, range, options)) {
22503       return false;
22504     } // From now on, variable terms are as if we're in "gtr" mode.
22505     // but note that everything is flipped for the "ltr" function.
22506
22507
22508     for (var i = 0; i < range.set.length; ++i) {
22509       var comparators = range.set[i];
22510       var high = null;
22511       var low = null;
22512       comparators.forEach(function (comparator) {
22513         if (comparator.semver === ANY) {
22514           comparator = new Comparator('>=0.0.0');
22515         }
22516
22517         high = high || comparator;
22518         low = low || comparator;
22519
22520         if (gtfn(comparator.semver, high.semver, options)) {
22521           high = comparator;
22522         } else if (ltfn(comparator.semver, low.semver, options)) {
22523           low = comparator;
22524         }
22525       }); // If the edge version comparator has a operator then our version
22526       // isn't outside it
22527
22528       if (high.operator === comp || high.operator === ecomp) {
22529         return false;
22530       } // If the lowest version comparator has an operator and our version
22531       // is less than it then it isn't higher than the range
22532
22533
22534       if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
22535         return false;
22536       } else if (low.operator === ecomp && ltfn(version, low.semver)) {
22537         return false;
22538       }
22539     }
22540
22541     return true;
22542   }
22543
22544   exports.prerelease = prerelease;
22545
22546   function prerelease(version, options) {
22547     var parsed = parse(version, options);
22548     return parsed && parsed.prerelease.length ? parsed.prerelease : null;
22549   }
22550
22551   exports.intersects = intersects;
22552
22553   function intersects(r1, r2, options) {
22554     r1 = new Range(r1, options);
22555     r2 = new Range(r2, options);
22556     return r1.intersects(r2);
22557   }
22558
22559   exports.coerce = coerce;
22560
22561   function coerce(version) {
22562     if (version instanceof SemVer) {
22563       return version;
22564     }
22565
22566     if (typeof version !== 'string') {
22567       return null;
22568     }
22569
22570     var match = version.match(re[COERCE]);
22571
22572     if (match == null) {
22573       return null;
22574     }
22575
22576     return parse(match[1] + '.' + (match[2] || '0') + '.' + (match[3] || '0'));
22577   }
22578 })(semver$1, semver$1.exports);
22579
22580 var fnmatch$1 = {exports: {}};
22581
22582 var map$1 = {exports: {}};
22583
22584 var hasOwnProperty$9 = Object.prototype.hasOwnProperty;
22585 var pseudomap = PseudoMap;
22586
22587 function PseudoMap(set) {
22588   if (!(this instanceof PseudoMap)) // whyyyyyyy
22589     throw new TypeError("Constructor PseudoMap requires 'new'");
22590   this.clear();
22591
22592   if (set) {
22593     if (set instanceof PseudoMap || typeof Map === 'function' && set instanceof Map) set.forEach(function (value, key) {
22594       this.set(key, value);
22595     }, this);else if (Array.isArray(set)) set.forEach(function (kv) {
22596       this.set(kv[0], kv[1]);
22597     }, this);else throw new TypeError('invalid argument');
22598   }
22599 }
22600
22601 PseudoMap.prototype.forEach = function (fn, thisp) {
22602   thisp = thisp || this;
22603   Object.keys(this._data).forEach(function (k) {
22604     if (k !== 'size') fn.call(thisp, this._data[k].value, this._data[k].key);
22605   }, this);
22606 };
22607
22608 PseudoMap.prototype.has = function (k) {
22609   return !!find(this._data, k);
22610 };
22611
22612 PseudoMap.prototype.get = function (k) {
22613   var res = find(this._data, k);
22614   return res && res.value;
22615 };
22616
22617 PseudoMap.prototype.set = function (k, v) {
22618   set(this._data, k, v);
22619 };
22620
22621 PseudoMap.prototype.delete = function (k) {
22622   var res = find(this._data, k);
22623
22624   if (res) {
22625     delete this._data[res._index];
22626     this._data.size--;
22627   }
22628 };
22629
22630 PseudoMap.prototype.clear = function () {
22631   var data = Object.create(null);
22632   data.size = 0;
22633   Object.defineProperty(this, '_data', {
22634     value: data,
22635     enumerable: false,
22636     configurable: true,
22637     writable: false
22638   });
22639 };
22640
22641 Object.defineProperty(PseudoMap.prototype, 'size', {
22642   get: function () {
22643     return this._data.size;
22644   },
22645   set: function (n) {},
22646   enumerable: true,
22647   configurable: true
22648 });
22649
22650 PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function () {
22651   throw new Error('iterators are not implemented in this version');
22652 }; // Either identical, or both NaN
22653
22654
22655 function same(a, b) {
22656   return a === b || a !== a && b !== b;
22657 }
22658
22659 function Entry$1(k, v, i) {
22660   this.key = k;
22661   this.value = v;
22662   this._index = i;
22663 }
22664
22665 function find(data, k) {
22666   for (var i = 0, s = '_' + k, key = s; hasOwnProperty$9.call(data, key); key = s + i++) {
22667     if (same(data[key].key, k)) return data[key];
22668   }
22669 }
22670
22671 function set(data, k, v) {
22672   for (var i = 0, s = '_' + k, key = s; hasOwnProperty$9.call(data, key); key = s + i++) {
22673     if (same(data[key].key, k)) {
22674       data[key].value = v;
22675       return;
22676     }
22677   }
22678
22679   data.size++;
22680   data[key] = new Entry$1(k, v, key);
22681 }
22682
22683 if (process.env.npm_package_name === 'pseudomap' && process.env.npm_lifecycle_script === 'test') process.env.TEST_PSEUDOMAP = 'true';
22684
22685 if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {
22686   map$1.exports = Map;
22687 } else {
22688   map$1.exports = pseudomap;
22689 }
22690
22691 var yallist = Yallist$1;
22692 Yallist$1.Node = Node;
22693 Yallist$1.create = Yallist$1;
22694
22695 function Yallist$1(list) {
22696   var self = this;
22697
22698   if (!(self instanceof Yallist$1)) {
22699     self = new Yallist$1();
22700   }
22701
22702   self.tail = null;
22703   self.head = null;
22704   self.length = 0;
22705
22706   if (list && typeof list.forEach === 'function') {
22707     list.forEach(function (item) {
22708       self.push(item);
22709     });
22710   } else if (arguments.length > 0) {
22711     for (var i = 0, l = arguments.length; i < l; i++) {
22712       self.push(arguments[i]);
22713     }
22714   }
22715
22716   return self;
22717 }
22718
22719 Yallist$1.prototype.removeNode = function (node) {
22720   if (node.list !== this) {
22721     throw new Error('removing node which does not belong to this list');
22722   }
22723
22724   var next = node.next;
22725   var prev = node.prev;
22726
22727   if (next) {
22728     next.prev = prev;
22729   }
22730
22731   if (prev) {
22732     prev.next = next;
22733   }
22734
22735   if (node === this.head) {
22736     this.head = next;
22737   }
22738
22739   if (node === this.tail) {
22740     this.tail = prev;
22741   }
22742
22743   node.list.length--;
22744   node.next = null;
22745   node.prev = null;
22746   node.list = null;
22747 };
22748
22749 Yallist$1.prototype.unshiftNode = function (node) {
22750   if (node === this.head) {
22751     return;
22752   }
22753
22754   if (node.list) {
22755     node.list.removeNode(node);
22756   }
22757
22758   var head = this.head;
22759   node.list = this;
22760   node.next = head;
22761
22762   if (head) {
22763     head.prev = node;
22764   }
22765
22766   this.head = node;
22767
22768   if (!this.tail) {
22769     this.tail = node;
22770   }
22771
22772   this.length++;
22773 };
22774
22775 Yallist$1.prototype.pushNode = function (node) {
22776   if (node === this.tail) {
22777     return;
22778   }
22779
22780   if (node.list) {
22781     node.list.removeNode(node);
22782   }
22783
22784   var tail = this.tail;
22785   node.list = this;
22786   node.prev = tail;
22787
22788   if (tail) {
22789     tail.next = node;
22790   }
22791
22792   this.tail = node;
22793
22794   if (!this.head) {
22795     this.head = node;
22796   }
22797
22798   this.length++;
22799 };
22800
22801 Yallist$1.prototype.push = function () {
22802   for (var i = 0, l = arguments.length; i < l; i++) {
22803     push(this, arguments[i]);
22804   }
22805
22806   return this.length;
22807 };
22808
22809 Yallist$1.prototype.unshift = function () {
22810   for (var i = 0, l = arguments.length; i < l; i++) {
22811     unshift(this, arguments[i]);
22812   }
22813
22814   return this.length;
22815 };
22816
22817 Yallist$1.prototype.pop = function () {
22818   if (!this.tail) {
22819     return undefined;
22820   }
22821
22822   var res = this.tail.value;
22823   this.tail = this.tail.prev;
22824
22825   if (this.tail) {
22826     this.tail.next = null;
22827   } else {
22828     this.head = null;
22829   }
22830
22831   this.length--;
22832   return res;
22833 };
22834
22835 Yallist$1.prototype.shift = function () {
22836   if (!this.head) {
22837     return undefined;
22838   }
22839
22840   var res = this.head.value;
22841   this.head = this.head.next;
22842
22843   if (this.head) {
22844     this.head.prev = null;
22845   } else {
22846     this.tail = null;
22847   }
22848
22849   this.length--;
22850   return res;
22851 };
22852
22853 Yallist$1.prototype.forEach = function (fn, thisp) {
22854   thisp = thisp || this;
22855
22856   for (var walker = this.head, i = 0; walker !== null; i++) {
22857     fn.call(thisp, walker.value, i, this);
22858     walker = walker.next;
22859   }
22860 };
22861
22862 Yallist$1.prototype.forEachReverse = function (fn, thisp) {
22863   thisp = thisp || this;
22864
22865   for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
22866     fn.call(thisp, walker.value, i, this);
22867     walker = walker.prev;
22868   }
22869 };
22870
22871 Yallist$1.prototype.get = function (n) {
22872   for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
22873     // abort out of the list early if we hit a cycle
22874     walker = walker.next;
22875   }
22876
22877   if (i === n && walker !== null) {
22878     return walker.value;
22879   }
22880 };
22881
22882 Yallist$1.prototype.getReverse = function (n) {
22883   for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
22884     // abort out of the list early if we hit a cycle
22885     walker = walker.prev;
22886   }
22887
22888   if (i === n && walker !== null) {
22889     return walker.value;
22890   }
22891 };
22892
22893 Yallist$1.prototype.map = function (fn, thisp) {
22894   thisp = thisp || this;
22895   var res = new Yallist$1();
22896
22897   for (var walker = this.head; walker !== null;) {
22898     res.push(fn.call(thisp, walker.value, this));
22899     walker = walker.next;
22900   }
22901
22902   return res;
22903 };
22904
22905 Yallist$1.prototype.mapReverse = function (fn, thisp) {
22906   thisp = thisp || this;
22907   var res = new Yallist$1();
22908
22909   for (var walker = this.tail; walker !== null;) {
22910     res.push(fn.call(thisp, walker.value, this));
22911     walker = walker.prev;
22912   }
22913
22914   return res;
22915 };
22916
22917 Yallist$1.prototype.reduce = function (fn, initial) {
22918   var acc;
22919   var walker = this.head;
22920
22921   if (arguments.length > 1) {
22922     acc = initial;
22923   } else if (this.head) {
22924     walker = this.head.next;
22925     acc = this.head.value;
22926   } else {
22927     throw new TypeError('Reduce of empty list with no initial value');
22928   }
22929
22930   for (var i = 0; walker !== null; i++) {
22931     acc = fn(acc, walker.value, i);
22932     walker = walker.next;
22933   }
22934
22935   return acc;
22936 };
22937
22938 Yallist$1.prototype.reduceReverse = function (fn, initial) {
22939   var acc;
22940   var walker = this.tail;
22941
22942   if (arguments.length > 1) {
22943     acc = initial;
22944   } else if (this.tail) {
22945     walker = this.tail.prev;
22946     acc = this.tail.value;
22947   } else {
22948     throw new TypeError('Reduce of empty list with no initial value');
22949   }
22950
22951   for (var i = this.length - 1; walker !== null; i--) {
22952     acc = fn(acc, walker.value, i);
22953     walker = walker.prev;
22954   }
22955
22956   return acc;
22957 };
22958
22959 Yallist$1.prototype.toArray = function () {
22960   var arr = new Array(this.length);
22961
22962   for (var i = 0, walker = this.head; walker !== null; i++) {
22963     arr[i] = walker.value;
22964     walker = walker.next;
22965   }
22966
22967   return arr;
22968 };
22969
22970 Yallist$1.prototype.toArrayReverse = function () {
22971   var arr = new Array(this.length);
22972
22973   for (var i = 0, walker = this.tail; walker !== null; i++) {
22974     arr[i] = walker.value;
22975     walker = walker.prev;
22976   }
22977
22978   return arr;
22979 };
22980
22981 Yallist$1.prototype.slice = function (from, to) {
22982   to = to || this.length;
22983
22984   if (to < 0) {
22985     to += this.length;
22986   }
22987
22988   from = from || 0;
22989
22990   if (from < 0) {
22991     from += this.length;
22992   }
22993
22994   var ret = new Yallist$1();
22995
22996   if (to < from || to < 0) {
22997     return ret;
22998   }
22999
23000   if (from < 0) {
23001     from = 0;
23002   }
23003
23004   if (to > this.length) {
23005     to = this.length;
23006   }
23007
23008   for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
23009     walker = walker.next;
23010   }
23011
23012   for (; walker !== null && i < to; i++, walker = walker.next) {
23013     ret.push(walker.value);
23014   }
23015
23016   return ret;
23017 };
23018
23019 Yallist$1.prototype.sliceReverse = function (from, to) {
23020   to = to || this.length;
23021
23022   if (to < 0) {
23023     to += this.length;
23024   }
23025
23026   from = from || 0;
23027
23028   if (from < 0) {
23029     from += this.length;
23030   }
23031
23032   var ret = new Yallist$1();
23033
23034   if (to < from || to < 0) {
23035     return ret;
23036   }
23037
23038   if (from < 0) {
23039     from = 0;
23040   }
23041
23042   if (to > this.length) {
23043     to = this.length;
23044   }
23045
23046   for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
23047     walker = walker.prev;
23048   }
23049
23050   for (; walker !== null && i > from; i--, walker = walker.prev) {
23051     ret.push(walker.value);
23052   }
23053
23054   return ret;
23055 };
23056
23057 Yallist$1.prototype.reverse = function () {
23058   var head = this.head;
23059   var tail = this.tail;
23060
23061   for (var walker = head; walker !== null; walker = walker.prev) {
23062     var p = walker.prev;
23063     walker.prev = walker.next;
23064     walker.next = p;
23065   }
23066
23067   this.head = tail;
23068   this.tail = head;
23069   return this;
23070 };
23071
23072 function push(self, item) {
23073   self.tail = new Node(item, self.tail, null, self);
23074
23075   if (!self.head) {
23076     self.head = self.tail;
23077   }
23078
23079   self.length++;
23080 }
23081
23082 function unshift(self, item) {
23083   self.head = new Node(item, null, self.head, self);
23084
23085   if (!self.tail) {
23086     self.tail = self.head;
23087   }
23088
23089   self.length++;
23090 }
23091
23092 function Node(value, prev, next, list) {
23093   if (!(this instanceof Node)) {
23094     return new Node(value, prev, next, list);
23095   }
23096
23097   this.list = list;
23098   this.value = value;
23099
23100   if (prev) {
23101     prev.next = this;
23102     this.prev = prev;
23103   } else {
23104     this.prev = null;
23105   }
23106
23107   if (next) {
23108     next.prev = this;
23109     this.next = next;
23110   } else {
23111     this.next = null;
23112   }
23113 }
23114
23115 var lruCache = LRUCache; // This will be a proper iterable 'Map' in engines that support it,
23116 // or a fakey-fake PseudoMap in older versions.
23117
23118 var Map$5 = map$1.exports;
23119 var util$3 = require$$0__default$4["default"]; // A linked list to keep track of recently-used-ness
23120
23121 var Yallist = yallist; // use symbols if possible, otherwise just _props
23122
23123 var hasSymbol = typeof Symbol === 'function' && process.env._nodeLRUCacheForceNoSymbol !== '1';
23124 var makeSymbol;
23125
23126 if (hasSymbol) {
23127   makeSymbol = function (key) {
23128     return Symbol(key);
23129   };
23130 } else {
23131   makeSymbol = function (key) {
23132     return '_' + key;
23133   };
23134 }
23135
23136 var MAX = makeSymbol('max');
23137 var LENGTH = makeSymbol('length');
23138 var LENGTH_CALCULATOR = makeSymbol('lengthCalculator');
23139 var ALLOW_STALE = makeSymbol('allowStale');
23140 var MAX_AGE = makeSymbol('maxAge');
23141 var DISPOSE = makeSymbol('dispose');
23142 var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet');
23143 var LRU_LIST = makeSymbol('lruList');
23144 var CACHE = makeSymbol('cache');
23145
23146 function naiveLength() {
23147   return 1;
23148 } // lruList is a yallist where the head is the youngest
23149 // item, and the tail is the oldest.  the list contains the Hit
23150 // objects as the entries.
23151 // Each Hit object has a reference to its Yallist.Node.  This
23152 // never changes.
23153 //
23154 // cache is a Map (or PseudoMap) that matches the keys to
23155 // the Yallist.Node object.
23156
23157
23158 function LRUCache(options) {
23159   if (!(this instanceof LRUCache)) {
23160     return new LRUCache(options);
23161   }
23162
23163   if (typeof options === 'number') {
23164     options = {
23165       max: options
23166     };
23167   }
23168
23169   if (!options) {
23170     options = {};
23171   }
23172
23173   var max = this[MAX] = options.max; // Kind of weird to have a default max of Infinity, but oh well.
23174
23175   if (!max || !(typeof max === 'number') || max <= 0) {
23176     this[MAX] = Infinity;
23177   }
23178
23179   var lc = options.length || naiveLength;
23180
23181   if (typeof lc !== 'function') {
23182     lc = naiveLength;
23183   }
23184
23185   this[LENGTH_CALCULATOR] = lc;
23186   this[ALLOW_STALE] = options.stale || false;
23187   this[MAX_AGE] = options.maxAge || 0;
23188   this[DISPOSE] = options.dispose;
23189   this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
23190   this.reset();
23191 } // resize the cache when the max changes.
23192
23193
23194 Object.defineProperty(LRUCache.prototype, 'max', {
23195   set: function (mL) {
23196     if (!mL || !(typeof mL === 'number') || mL <= 0) {
23197       mL = Infinity;
23198     }
23199
23200     this[MAX] = mL;
23201     trim(this);
23202   },
23203   get: function () {
23204     return this[MAX];
23205   },
23206   enumerable: true
23207 });
23208 Object.defineProperty(LRUCache.prototype, 'allowStale', {
23209   set: function (allowStale) {
23210     this[ALLOW_STALE] = !!allowStale;
23211   },
23212   get: function () {
23213     return this[ALLOW_STALE];
23214   },
23215   enumerable: true
23216 });
23217 Object.defineProperty(LRUCache.prototype, 'maxAge', {
23218   set: function (mA) {
23219     if (!mA || !(typeof mA === 'number') || mA < 0) {
23220       mA = 0;
23221     }
23222
23223     this[MAX_AGE] = mA;
23224     trim(this);
23225   },
23226   get: function () {
23227     return this[MAX_AGE];
23228   },
23229   enumerable: true
23230 }); // resize the cache when the lengthCalculator changes.
23231
23232 Object.defineProperty(LRUCache.prototype, 'lengthCalculator', {
23233   set: function (lC) {
23234     if (typeof lC !== 'function') {
23235       lC = naiveLength;
23236     }
23237
23238     if (lC !== this[LENGTH_CALCULATOR]) {
23239       this[LENGTH_CALCULATOR] = lC;
23240       this[LENGTH] = 0;
23241       this[LRU_LIST].forEach(function (hit) {
23242         hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
23243         this[LENGTH] += hit.length;
23244       }, this);
23245     }
23246
23247     trim(this);
23248   },
23249   get: function () {
23250     return this[LENGTH_CALCULATOR];
23251   },
23252   enumerable: true
23253 });
23254 Object.defineProperty(LRUCache.prototype, 'length', {
23255   get: function () {
23256     return this[LENGTH];
23257   },
23258   enumerable: true
23259 });
23260 Object.defineProperty(LRUCache.prototype, 'itemCount', {
23261   get: function () {
23262     return this[LRU_LIST].length;
23263   },
23264   enumerable: true
23265 });
23266
23267 LRUCache.prototype.rforEach = function (fn, thisp) {
23268   thisp = thisp || this;
23269
23270   for (var walker = this[LRU_LIST].tail; walker !== null;) {
23271     var prev = walker.prev;
23272     forEachStep(this, fn, walker, thisp);
23273     walker = prev;
23274   }
23275 };
23276
23277 function forEachStep(self, fn, node, thisp) {
23278   var hit = node.value;
23279
23280   if (isStale(self, hit)) {
23281     del$1(self, node);
23282
23283     if (!self[ALLOW_STALE]) {
23284       hit = undefined;
23285     }
23286   }
23287
23288   if (hit) {
23289     fn.call(thisp, hit.value, hit.key, self);
23290   }
23291 }
23292
23293 LRUCache.prototype.forEach = function (fn, thisp) {
23294   thisp = thisp || this;
23295
23296   for (var walker = this[LRU_LIST].head; walker !== null;) {
23297     var next = walker.next;
23298     forEachStep(this, fn, walker, thisp);
23299     walker = next;
23300   }
23301 };
23302
23303 LRUCache.prototype.keys = function () {
23304   return this[LRU_LIST].toArray().map(function (k) {
23305     return k.key;
23306   }, this);
23307 };
23308
23309 LRUCache.prototype.values = function () {
23310   return this[LRU_LIST].toArray().map(function (k) {
23311     return k.value;
23312   }, this);
23313 };
23314
23315 LRUCache.prototype.reset = function () {
23316   if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
23317     this[LRU_LIST].forEach(function (hit) {
23318       this[DISPOSE](hit.key, hit.value);
23319     }, this);
23320   }
23321
23322   this[CACHE] = new Map$5(); // hash of items by key
23323
23324   this[LRU_LIST] = new Yallist(); // list of items in order of use recency
23325
23326   this[LENGTH] = 0; // length of items in the list
23327 };
23328
23329 LRUCache.prototype.dump = function () {
23330   return this[LRU_LIST].map(function (hit) {
23331     if (!isStale(this, hit)) {
23332       return {
23333         k: hit.key,
23334         v: hit.value,
23335         e: hit.now + (hit.maxAge || 0)
23336       };
23337     }
23338   }, this).toArray().filter(function (h) {
23339     return h;
23340   });
23341 };
23342
23343 LRUCache.prototype.dumpLru = function () {
23344   return this[LRU_LIST];
23345 };
23346 /* istanbul ignore next */
23347
23348
23349 LRUCache.prototype.inspect = function (n, opts) {
23350   var str = 'LRUCache {';
23351   var extras = false;
23352   var as = this[ALLOW_STALE];
23353
23354   if (as) {
23355     str += '\n  allowStale: true';
23356     extras = true;
23357   }
23358
23359   var max = this[MAX];
23360
23361   if (max && max !== Infinity) {
23362     if (extras) {
23363       str += ',';
23364     }
23365
23366     str += '\n  max: ' + util$3.inspect(max, opts);
23367     extras = true;
23368   }
23369
23370   var maxAge = this[MAX_AGE];
23371
23372   if (maxAge) {
23373     if (extras) {
23374       str += ',';
23375     }
23376
23377     str += '\n  maxAge: ' + util$3.inspect(maxAge, opts);
23378     extras = true;
23379   }
23380
23381   var lc = this[LENGTH_CALCULATOR];
23382
23383   if (lc && lc !== naiveLength) {
23384     if (extras) {
23385       str += ',';
23386     }
23387
23388     str += '\n  length: ' + util$3.inspect(this[LENGTH], opts);
23389     extras = true;
23390   }
23391
23392   var didFirst = false;
23393   this[LRU_LIST].forEach(function (item) {
23394     if (didFirst) {
23395       str += ',\n  ';
23396     } else {
23397       if (extras) {
23398         str += ',\n';
23399       }
23400
23401       didFirst = true;
23402       str += '\n  ';
23403     }
23404
23405     var key = util$3.inspect(item.key).split('\n').join('\n  ');
23406     var val = {
23407       value: item.value
23408     };
23409
23410     if (item.maxAge !== maxAge) {
23411       val.maxAge = item.maxAge;
23412     }
23413
23414     if (lc !== naiveLength) {
23415       val.length = item.length;
23416     }
23417
23418     if (isStale(this, item)) {
23419       val.stale = true;
23420     }
23421
23422     val = util$3.inspect(val, opts).split('\n').join('\n  ');
23423     str += key + ' => ' + val;
23424   });
23425
23426   if (didFirst || extras) {
23427     str += '\n';
23428   }
23429
23430   str += '}';
23431   return str;
23432 };
23433
23434 LRUCache.prototype.set = function (key, value, maxAge) {
23435   maxAge = maxAge || this[MAX_AGE];
23436   var now = maxAge ? Date.now() : 0;
23437   var len = this[LENGTH_CALCULATOR](value, key);
23438
23439   if (this[CACHE].has(key)) {
23440     if (len > this[MAX]) {
23441       del$1(this, this[CACHE].get(key));
23442       return false;
23443     }
23444
23445     var node = this[CACHE].get(key);
23446     var item = node.value; // dispose of the old one before overwriting
23447     // split out into 2 ifs for better coverage tracking
23448
23449     if (this[DISPOSE]) {
23450       if (!this[NO_DISPOSE_ON_SET]) {
23451         this[DISPOSE](key, item.value);
23452       }
23453     }
23454
23455     item.now = now;
23456     item.maxAge = maxAge;
23457     item.value = value;
23458     this[LENGTH] += len - item.length;
23459     item.length = len;
23460     this.get(key);
23461     trim(this);
23462     return true;
23463   }
23464
23465   var hit = new Entry(key, value, len, now, maxAge); // oversized objects fall out of cache automatically.
23466
23467   if (hit.length > this[MAX]) {
23468     if (this[DISPOSE]) {
23469       this[DISPOSE](key, value);
23470     }
23471
23472     return false;
23473   }
23474
23475   this[LENGTH] += hit.length;
23476   this[LRU_LIST].unshift(hit);
23477   this[CACHE].set(key, this[LRU_LIST].head);
23478   trim(this);
23479   return true;
23480 };
23481
23482 LRUCache.prototype.has = function (key) {
23483   if (!this[CACHE].has(key)) return false;
23484   var hit = this[CACHE].get(key).value;
23485
23486   if (isStale(this, hit)) {
23487     return false;
23488   }
23489
23490   return true;
23491 };
23492
23493 LRUCache.prototype.get = function (key) {
23494   return get$2(this, key, true);
23495 };
23496
23497 LRUCache.prototype.peek = function (key) {
23498   return get$2(this, key, false);
23499 };
23500
23501 LRUCache.prototype.pop = function () {
23502   var node = this[LRU_LIST].tail;
23503   if (!node) return null;
23504   del$1(this, node);
23505   return node.value;
23506 };
23507
23508 LRUCache.prototype.del = function (key) {
23509   del$1(this, this[CACHE].get(key));
23510 };
23511
23512 LRUCache.prototype.load = function (arr) {
23513   // reset the cache
23514   this.reset();
23515   var now = Date.now(); // A previous serialized cache has the most recent items first
23516
23517   for (var l = arr.length - 1; l >= 0; l--) {
23518     var hit = arr[l];
23519     var expiresAt = hit.e || 0;
23520
23521     if (expiresAt === 0) {
23522       // the item was created without expiration in a non aged cache
23523       this.set(hit.k, hit.v);
23524     } else {
23525       var maxAge = expiresAt - now; // dont add already expired items
23526
23527       if (maxAge > 0) {
23528         this.set(hit.k, hit.v, maxAge);
23529       }
23530     }
23531   }
23532 };
23533
23534 LRUCache.prototype.prune = function () {
23535   var self = this;
23536   this[CACHE].forEach(function (value, key) {
23537     get$2(self, key, false);
23538   });
23539 };
23540
23541 function get$2(self, key, doUse) {
23542   var node = self[CACHE].get(key);
23543
23544   if (node) {
23545     var hit = node.value;
23546
23547     if (isStale(self, hit)) {
23548       del$1(self, node);
23549       if (!self[ALLOW_STALE]) hit = undefined;
23550     } else {
23551       if (doUse) {
23552         self[LRU_LIST].unshiftNode(node);
23553       }
23554     }
23555
23556     if (hit) hit = hit.value;
23557   }
23558
23559   return hit;
23560 }
23561
23562 function isStale(self, hit) {
23563   if (!hit || !hit.maxAge && !self[MAX_AGE]) {
23564     return false;
23565   }
23566
23567   var stale = false;
23568   var diff = Date.now() - hit.now;
23569
23570   if (hit.maxAge) {
23571     stale = diff > hit.maxAge;
23572   } else {
23573     stale = self[MAX_AGE] && diff > self[MAX_AGE];
23574   }
23575
23576   return stale;
23577 }
23578
23579 function trim(self) {
23580   if (self[LENGTH] > self[MAX]) {
23581     for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) {
23582       // We know that we're about to delete this one, and also
23583       // what the next least recently used key will be, so just
23584       // go ahead and set it now.
23585       var prev = walker.prev;
23586       del$1(self, walker);
23587       walker = prev;
23588     }
23589   }
23590 }
23591
23592 function del$1(self, node) {
23593   if (node) {
23594     var hit = node.value;
23595
23596     if (self[DISPOSE]) {
23597       self[DISPOSE](hit.key, hit.value);
23598     }
23599
23600     self[LENGTH] -= hit.length;
23601     self[CACHE].delete(hit.key);
23602     self[LRU_LIST].removeNode(node);
23603   }
23604 } // classy, since V8 prefers predictable objects.
23605
23606
23607 function Entry(key, value, length, now, maxAge) {
23608   this.key = key;
23609   this.value = value;
23610   this.length = length;
23611   this.now = now;
23612   this.maxAge = maxAge || 0;
23613 }
23614
23615 var sigmund_1 = sigmund;
23616
23617 function sigmund(subject, maxSessions) {
23618   maxSessions = maxSessions || 10;
23619   var notes = [];
23620   var analysis = '';
23621   var RE = RegExp;
23622
23623   function psychoAnalyze(subject, session) {
23624     if (session > maxSessions) return;
23625
23626     if (typeof subject === 'function' || typeof subject === 'undefined') {
23627       return;
23628     }
23629
23630     if (typeof subject !== 'object' || !subject || subject instanceof RE) {
23631       analysis += subject;
23632       return;
23633     }
23634
23635     if (notes.indexOf(subject) !== -1 || session === maxSessions) return;
23636     notes.push(subject);
23637     analysis += '{';
23638     Object.keys(subject).forEach(function (issue, _, __) {
23639       // pseudo-private values.  skip those.
23640       if (issue.charAt(0) === '_') return;
23641       var to = typeof subject[issue];
23642       if (to === 'function' || to === 'undefined') return;
23643       analysis += issue;
23644       psychoAnalyze(subject[issue], session + 1);
23645     });
23646   }
23647
23648   psychoAnalyze(subject, 0);
23649   return analysis;
23650 } // vim: set softtabstop=4 shiftwidth=4:
23651
23652 (function (module, exports) {
23653   // Based on minimatch.js by isaacs <https://npmjs.org/package/minimatch>
23654   var platform = typeof process === "object" ? process.platform : "win32";
23655   if (module) module.exports = minimatch;else exports.minimatch = minimatch;
23656   minimatch.Minimatch = Minimatch;
23657   var LRU = lruCache,
23658       cache = minimatch.cache = new LRU({
23659     max: 100
23660   }),
23661       GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {},
23662       sigmund = sigmund_1;
23663   var path = require$$0__default$2["default"] // any single thing other than /
23664   // don't need to escape / when using new RegExp()
23665   ,
23666       qmark = "[^/]" // * => any number of characters
23667   ,
23668       star = qmark + "*?" // ** when dots are allowed.  Anything goes, except .. and .
23669   // not (^ or / followed by one or two dots followed by $ or /),
23670   // followed by anything, any number of times.
23671   ,
23672       twoStarDot = "(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?" // not a ^ or / followed by a dot,
23673   // followed by anything, any number of times.
23674   ,
23675       twoStarNoDot = "(?:(?!(?:\\\/|^)\\.).)*?" // characters that need to be escaped in RegExp.
23676   ,
23677       reSpecials = charSet("().*{}+?[]^$\\!"); // "abc" -> { a:true, b:true, c:true }
23678
23679   function charSet(s) {
23680     return s.split("").reduce(function (set, c) {
23681       set[c] = true;
23682       return set;
23683     }, {});
23684   } // normalizes slashes.
23685
23686
23687   var slashSplit = /\/+/;
23688   minimatch.monkeyPatch = monkeyPatch;
23689
23690   function monkeyPatch() {
23691     var desc = Object.getOwnPropertyDescriptor(String.prototype, "match");
23692     var orig = desc.value;
23693
23694     desc.value = function (p) {
23695       if (p instanceof Minimatch) return p.match(this);
23696       return orig.call(this, p);
23697     };
23698
23699     Object.defineProperty(String.prototype, desc);
23700   }
23701
23702   minimatch.filter = filter;
23703
23704   function filter(pattern, options) {
23705     options = options || {};
23706     return function (p, i, list) {
23707       return minimatch(p, pattern, options);
23708     };
23709   }
23710
23711   function ext(a, b) {
23712     a = a || {};
23713     b = b || {};
23714     var t = {};
23715     Object.keys(b).forEach(function (k) {
23716       t[k] = b[k];
23717     });
23718     Object.keys(a).forEach(function (k) {
23719       t[k] = a[k];
23720     });
23721     return t;
23722   }
23723
23724   minimatch.defaults = function (def) {
23725     if (!def || !Object.keys(def).length) return minimatch;
23726     var orig = minimatch;
23727
23728     var m = function minimatch(p, pattern, options) {
23729       return orig.minimatch(p, pattern, ext(def, options));
23730     };
23731
23732     m.Minimatch = function Minimatch(pattern, options) {
23733       return new orig.Minimatch(pattern, ext(def, options));
23734     };
23735
23736     return m;
23737   };
23738
23739   Minimatch.defaults = function (def) {
23740     if (!def || !Object.keys(def).length) return Minimatch;
23741     return minimatch.defaults(def).Minimatch;
23742   };
23743
23744   function minimatch(p, pattern, options) {
23745     if (typeof pattern !== "string") {
23746       throw new TypeError("glob pattern string required");
23747     }
23748
23749     if (!options) options = {}; // shortcut: comments match nothing.
23750
23751     if (!options.nocomment && pattern.charAt(0) === "#") {
23752       return false;
23753     } // "" only matches ""
23754
23755
23756     if (pattern.trim() === "") return p === "";
23757     return new Minimatch(pattern, options).match(p);
23758   }
23759
23760   function Minimatch(pattern, options) {
23761     if (!(this instanceof Minimatch)) {
23762       return new Minimatch(pattern, options, cache);
23763     }
23764
23765     if (typeof pattern !== "string") {
23766       throw new TypeError("glob pattern string required");
23767     }
23768
23769     if (!options) options = {}; // windows: need to use /, not \
23770     // On other platforms, \ is a valid (albeit bad) filename char.
23771
23772     if (platform === "win32") {
23773       pattern = pattern.split("\\").join("/");
23774     } // lru storage.
23775     // these things aren't particularly big, but walking down the string
23776     // and turning it into a regexp can get pretty costly.
23777
23778
23779     var cacheKey = pattern + "\n" + sigmund(options);
23780     var cached = minimatch.cache.get(cacheKey);
23781     if (cached) return cached;
23782     minimatch.cache.set(cacheKey, this);
23783     this.options = options;
23784     this.set = [];
23785     this.pattern = pattern;
23786     this.regexp = null;
23787     this.negate = false;
23788     this.comment = false;
23789     this.empty = false; // make the set of regexps etc.
23790
23791     this.make();
23792   }
23793
23794   Minimatch.prototype.make = make;
23795
23796   function make() {
23797     // don't do it more than once.
23798     if (this._made) return;
23799     var pattern = this.pattern;
23800     var options = this.options; // empty patterns and comments match nothing.
23801
23802     if (!options.nocomment && pattern.charAt(0) === "#") {
23803       this.comment = true;
23804       return;
23805     }
23806
23807     if (!pattern) {
23808       this.empty = true;
23809       return;
23810     } // step 1: figure out negation, etc.
23811
23812
23813     this.parseNegate(); // step 2: expand braces
23814
23815     var set = this.globSet = this.braceExpand();
23816     if (options.debug) console.error(this.pattern, set); // step 3: now we have a set, so turn each one into a series of path-portion
23817     // matching patterns.
23818     // These will be regexps, except in the case of "**", which is
23819     // set to the GLOBSTAR object for globstar behavior,
23820     // and will not contain any / characters
23821
23822     set = this.globParts = set.map(function (s) {
23823       return s.split(slashSplit);
23824     });
23825     if (options.debug) console.error(this.pattern, set); // glob --> regexps
23826
23827     set = set.map(function (s, si, set) {
23828       return s.map(this.parse, this);
23829     }, this);
23830     if (options.debug) console.error(this.pattern, set); // filter out everything that didn't compile properly.
23831
23832     set = set.filter(function (s) {
23833       return -1 === s.indexOf(false);
23834     });
23835     if (options.debug) console.error(this.pattern, set);
23836     this.set = set;
23837   }
23838
23839   Minimatch.prototype.parseNegate = parseNegate;
23840
23841   function parseNegate() {
23842     var pattern = this.pattern,
23843         negate = false,
23844         options = this.options,
23845         negateOffset = 0;
23846     if (options.nonegate) return;
23847
23848     for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
23849       negate = !negate;
23850       negateOffset++;
23851     }
23852
23853     if (negateOffset) this.pattern = pattern.substr(negateOffset);
23854     this.negate = negate;
23855   } // Brace expansion:
23856   // a{b,c}d -> abd acd
23857   // a{b,}c -> abc ac
23858   // a{0..3}d -> a0d a1d a2d a3d
23859   // a{b,c{d,e}f}g -> abg acdfg acefg
23860   // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
23861   //
23862   // Invalid sets are not expanded.
23863   // a{2..}b -> a{2..}b
23864   // a{b}c -> a{b}c
23865
23866
23867   minimatch.braceExpand = function (pattern, options) {
23868     return new Minimatch(pattern, options).braceExpand();
23869   };
23870
23871   Minimatch.prototype.braceExpand = braceExpand;
23872
23873   function braceExpand(pattern, options) {
23874     options = options || this.options;
23875     pattern = typeof pattern === "undefined" ? this.pattern : pattern;
23876
23877     if (typeof pattern === "undefined") {
23878       throw new Error("undefined pattern");
23879     }
23880
23881     if (options.nobrace || !pattern.match(/\{.*\}/)) {
23882       // shortcut. no need to expand.
23883       return [pattern];
23884     }
23885
23886     var escaping = false; // examples and comments refer to this crazy pattern:
23887     // a{b,c{d,e},{f,g}h}x{y,z}
23888     // expected:
23889     // abxy
23890     // abxz
23891     // acdxy
23892     // acdxz
23893     // acexy
23894     // acexz
23895     // afhxy
23896     // afhxz
23897     // aghxy
23898     // aghxz
23899     // everything before the first \{ is just a prefix.
23900     // So, we pluck that off, and work with the rest,
23901     // and then prepend it to everything we find.
23902
23903     if (pattern.charAt(0) !== "{") {
23904       // console.error(pattern)
23905       var prefix = null;
23906
23907       for (var i = 0, l = pattern.length; i < l; i++) {
23908         var c = pattern.charAt(i); // console.error(i, c)
23909
23910         if (c === "\\") {
23911           escaping = !escaping;
23912         } else if (c === "{" && !escaping) {
23913           prefix = pattern.substr(0, i);
23914           break;
23915         }
23916       } // actually no sets, all { were escaped.
23917
23918
23919       if (prefix === null) {
23920         // console.error("no sets")
23921         return [pattern];
23922       }
23923
23924       var tail = braceExpand(pattern.substr(i), options);
23925       return tail.map(function (t) {
23926         return prefix + t;
23927       });
23928     } // now we have something like:
23929     // {b,c{d,e},{f,g}h}x{y,z}
23930     // walk through the set, expanding each part, until
23931     // the set ends.  then, we'll expand the suffix.
23932     // If the set only has a single member, then'll put the {} back
23933     // first, handle numeric sets, since they're easier
23934
23935
23936     var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/);
23937
23938     if (numset) {
23939       // console.error("numset", numset[1], numset[2])
23940       var suf = braceExpand(pattern.substr(numset[0].length), options),
23941           start = +numset[1],
23942           end = +numset[2],
23943           inc = start > end ? -1 : 1,
23944           set = [];
23945
23946       for (var i = start; i != end + inc; i += inc) {
23947         // append all the suffixes
23948         for (var ii = 0, ll = suf.length; ii < ll; ii++) {
23949           set.push(i + suf[ii]);
23950         }
23951       }
23952
23953       return set;
23954     } // ok, walk through the set
23955     // We hope, somewhat optimistically, that there
23956     // will be a } at the end.
23957     // If the closing brace isn't found, then the pattern is
23958     // interpreted as braceExpand("\\" + pattern) so that
23959     // the leading \{ will be interpreted literally.
23960
23961
23962     var i = 1 // skip the \{
23963     ,
23964         depth = 1,
23965         set = [],
23966         member = "",
23967         escaping = false;
23968
23969     function addMember() {
23970       set.push(member);
23971       member = "";
23972     } // console.error("Entering for")
23973
23974
23975     FOR: for (i = 1, l = pattern.length; i < l; i++) {
23976       var c = pattern.charAt(i); // console.error("", i, c)
23977
23978       if (escaping) {
23979         escaping = false;
23980         member += "\\" + c;
23981       } else {
23982         switch (c) {
23983           case "\\":
23984             escaping = true;
23985             continue;
23986
23987           case "{":
23988             depth++;
23989             member += "{";
23990             continue;
23991
23992           case "}":
23993             depth--; // if this closes the actual set, then we're done
23994
23995             if (depth === 0) {
23996               addMember(); // pluck off the close-brace
23997
23998               i++;
23999               break FOR;
24000             } else {
24001               member += c;
24002               continue;
24003             }
24004
24005           case ",":
24006             if (depth === 1) {
24007               addMember();
24008             } else {
24009               member += c;
24010             }
24011
24012             continue;
24013
24014           default:
24015             member += c;
24016             continue;
24017         } // switch
24018
24019       } // else
24020
24021     } // for
24022     // now we've either finished the set, and the suffix is
24023     // pattern.substr(i), or we have *not* closed the set,
24024     // and need to escape the leading brace
24025
24026
24027     if (depth !== 0) {
24028       // console.error("didn't close", pattern)
24029       return braceExpand("\\" + pattern, options);
24030     } // x{y,z} -> ["xy", "xz"]
24031     // console.error("set", set)
24032     // console.error("suffix", pattern.substr(i))
24033
24034
24035     var suf = braceExpand(pattern.substr(i), options); // ["b", "c{d,e}","{f,g}h"] ->
24036     //   [["b"], ["cd", "ce"], ["fh", "gh"]]
24037
24038     var addBraces = set.length === 1; // console.error("set pre-expanded", set)
24039
24040     set = set.map(function (p) {
24041       return braceExpand(p, options);
24042     }); // console.error("set expanded", set)
24043     // [["b"], ["cd", "ce"], ["fh", "gh"]] ->
24044     //   ["b", "cd", "ce", "fh", "gh"]
24045
24046     set = set.reduce(function (l, r) {
24047       return l.concat(r);
24048     });
24049
24050     if (addBraces) {
24051       set = set.map(function (s) {
24052         return "{" + s + "}";
24053       });
24054     } // now attach the suffixes.
24055
24056
24057     var ret = [];
24058
24059     for (var i = 0, l = set.length; i < l; i++) {
24060       for (var ii = 0, ll = suf.length; ii < ll; ii++) {
24061         ret.push(set[i] + suf[ii]);
24062       }
24063     }
24064
24065     return ret;
24066   } // parse a component of the expanded set.
24067   // At this point, no pattern may contain "/" in it
24068   // so we're going to return a 2d array, where each entry is the full
24069   // pattern, split on '/', and then turned into a regular expression.
24070   // A regexp is made at the end which joins each array with an
24071   // escaped /, and another full one which joins each regexp with |.
24072   //
24073   // Following the lead of Bash 4.1, note that "**" only has special meaning
24074   // when it is the *only* thing in a path portion.  Otherwise, any series
24075   // of * is equivalent to a single *.  Globstar behavior is enabled by
24076   // default, and can be disabled by setting options.noglobstar.
24077
24078
24079   Minimatch.prototype.parse = parse;
24080   var SUBPARSE = {};
24081
24082   function parse(pattern, isSub) {
24083     var options = this.options; // shortcuts
24084
24085     if (!options.noglobstar && pattern === "**") return GLOBSTAR;
24086     if (pattern === "") return "";
24087     var re = "",
24088         hasMagic = !!options.nocase,
24089         escaping = false // ? => one single character
24090     ,
24091         patternListStack = [],
24092         plType,
24093         stateChar,
24094         inClass = false,
24095         reClassStart = -1,
24096         classStart = -1 // . and .. never match anything that doesn't start with .,
24097     // even when options.dot is set.
24098     ,
24099         patternStart = pattern.charAt(0) === "." ? "" // anything
24100     // not (start or / followed by . or .. followed by / or end)
24101     : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))" : "(?!\\.)";
24102
24103     function clearStateChar() {
24104       if (stateChar) {
24105         // we had some state-tracking character
24106         // that wasn't consumed by this pass.
24107         switch (stateChar) {
24108           case "*":
24109             re += star;
24110             hasMagic = true;
24111             break;
24112
24113           case "?":
24114             re += qmark;
24115             hasMagic = true;
24116             break;
24117
24118           default:
24119             re += "\\" + stateChar;
24120             break;
24121         }
24122
24123         stateChar = false;
24124       }
24125     }
24126
24127     for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
24128       if (options.debug) {
24129         console.error("%s\t%s %s %j", pattern, i, re, c);
24130       } // skip over any that are escaped.
24131
24132
24133       if (escaping && reSpecials[c]) {
24134         re += "\\" + c;
24135         escaping = false;
24136         continue;
24137       }
24138
24139       switch (c) {
24140         case "/":
24141           // completely not allowed, even escaped.
24142           // Should already be path-split by now.
24143           return false;
24144
24145         case "\\":
24146           clearStateChar();
24147           escaping = true;
24148           continue;
24149         // the various stateChar values
24150         // for the "extglob" stuff.
24151
24152         case "?":
24153         case "*":
24154         case "+":
24155         case "@":
24156         case "!":
24157           if (options.debug) {
24158             console.error("%s\t%s %s %j <-- stateChar", pattern, i, re, c);
24159           } // all of those are literals inside a class, except that
24160           // the glob [!a] means [^a] in regexp
24161
24162
24163           if (inClass) {
24164             if (c === "!" && i === classStart + 1) c = "^";
24165             re += c;
24166             continue;
24167           } // if we already have a stateChar, then it means
24168           // that there was something like ** or +? in there.
24169           // Handle the stateChar, then proceed with this one.
24170
24171
24172           clearStateChar();
24173           stateChar = c; // if extglob is disabled, then +(asdf|foo) isn't a thing.
24174           // just clear the statechar *now*, rather than even diving into
24175           // the patternList stuff.
24176
24177           if (options.noext) clearStateChar();
24178           continue;
24179
24180         case "(":
24181           if (inClass) {
24182             re += "(";
24183             continue;
24184           }
24185
24186           if (!stateChar) {
24187             re += "\\(";
24188             continue;
24189           }
24190
24191           plType = stateChar;
24192           patternListStack.push({
24193             type: plType,
24194             start: i - 1,
24195             reStart: re.length
24196           }); // negation is (?:(?!js)[^/]*)
24197
24198           re += stateChar === "!" ? "(?:(?!" : "(?:";
24199           stateChar = false;
24200           continue;
24201
24202         case ")":
24203           if (inClass || !patternListStack.length) {
24204             re += "\\)";
24205             continue;
24206           }
24207
24208           hasMagic = true;
24209           re += ")";
24210           plType = patternListStack.pop().type; // negation is (?:(?!js)[^/]*)
24211           // The others are (?:<pattern>)<type>
24212
24213           switch (plType) {
24214             case "!":
24215               re += "[^/]*?)";
24216               break;
24217
24218             case "?":
24219             case "+":
24220             case "*":
24221               re += plType;
24222             // the default anyway
24223           }
24224
24225           continue;
24226
24227         case "|":
24228           if (inClass || !patternListStack.length || escaping) {
24229             re += "\\|";
24230             escaping = false;
24231             continue;
24232           }
24233
24234           re += "|";
24235           continue;
24236         // these are mostly the same in regexp and glob
24237
24238         case "[":
24239           // swallow any state-tracking char before the [
24240           clearStateChar();
24241
24242           if (inClass) {
24243             re += "\\" + c;
24244             continue;
24245           }
24246
24247           inClass = true;
24248           classStart = i;
24249           reClassStart = re.length;
24250           re += c;
24251           continue;
24252
24253         case "]":
24254           //  a right bracket shall lose its special
24255           //  meaning and represent itself in
24256           //  a bracket expression if it occurs
24257           //  first in the list.  -- POSIX.2 2.8.3.2
24258           if (i === classStart + 1 || !inClass) {
24259             re += "\\" + c;
24260             escaping = false;
24261             continue;
24262           } // finish up the class.
24263
24264
24265           hasMagic = true;
24266           inClass = false;
24267           re += c;
24268           continue;
24269
24270         default:
24271           // swallow any state char that wasn't consumed
24272           clearStateChar();
24273
24274           if (escaping) {
24275             // no need
24276             escaping = false;
24277           } else if (reSpecials[c] && !(c === "^" && inClass)) {
24278             re += "\\";
24279           }
24280
24281           re += c;
24282       } // switch
24283
24284     } // for
24285     // handle the case where we left a class open.
24286     // "[abc" is valid, equivalent to "\[abc"
24287
24288
24289     if (inClass) {
24290       // split where the last [ was, and escape it
24291       // this is a huge pita.  We now have to re-walk
24292       // the contents of the would-be class to re-translate
24293       // any characters that were passed through as-is
24294       var cs = pattern.substr(classStart + 1),
24295           sp = this.parse(cs, SUBPARSE);
24296       re = re.substr(0, reClassStart) + "\\[" + sp[0];
24297       hasMagic = hasMagic || sp[1];
24298     } // handle the case where we had a +( thing at the *end*
24299     // of the pattern.
24300     // each pattern list stack adds 3 chars, and we need to go through
24301     // and escape any | chars that were passed through as-is for the regexp.
24302     // Go through and escape them, taking care not to double-escape any
24303     // | chars that were already escaped.
24304
24305
24306     var pl;
24307
24308     while (pl = patternListStack.pop()) {
24309       var tail = re.slice(pl.reStart + 3); // maybe some even number of \, then maybe 1 \, followed by a |
24310
24311       tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) {
24312         if (!$2) {
24313           // the | isn't already escaped, so escape it.
24314           $2 = "\\";
24315         } // need to escape all those slashes *again*, without escaping the
24316         // one that we need for escaping the | character.  As it works out,
24317         // escaping an even number of slashes can be done by simply repeating
24318         // it exactly after itself.  That's why this trick works.
24319         //
24320         // I am sorry that you have to see this.
24321
24322
24323         return $1 + $1 + $2 + "|";
24324       }); // console.error("tail=%j\n   %s", tail, tail)
24325
24326       var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
24327       hasMagic = true;
24328       re = re.slice(0, pl.reStart) + t + "\\(" + tail;
24329     } // handle trailing things that only matter at the very end.
24330
24331
24332     clearStateChar();
24333
24334     if (escaping) {
24335       // trailing \\
24336       re += "\\\\";
24337     } // only need to apply the nodot start if the re starts with
24338     // something that could conceivably capture a dot
24339
24340
24341     var addPatternStart = false;
24342
24343     switch (re.charAt(0)) {
24344       case ".":
24345       case "[":
24346       case "(":
24347         addPatternStart = true;
24348     } // if the re is not "" at this point, then we need to make sure
24349     // it doesn't match against an empty path part.
24350     // Otherwise a/* will match a/, which it should not.
24351
24352
24353     if (re !== "" && hasMagic) re = "(?=.)" + re;
24354     if (addPatternStart) re = patternStart + re; // parsing just a piece of a larger pattern.
24355
24356     if (isSub === SUBPARSE) {
24357       return [re, hasMagic];
24358     } // skip the regexp for non-magical patterns
24359     // unescape anything in it, though, so that it'll be
24360     // an exact match against a file etc.
24361
24362
24363     if (!hasMagic) {
24364       return globUnescape(pattern);
24365     }
24366
24367     var flags = options.nocase ? "i" : "",
24368         regExp = new RegExp("^" + re + "$", flags);
24369     regExp._glob = pattern;
24370     regExp._src = re;
24371     return regExp;
24372   }
24373
24374   minimatch.makeRe = function (pattern, options) {
24375     return new Minimatch(pattern, options || {}).makeRe();
24376   };
24377
24378   Minimatch.prototype.makeRe = makeRe;
24379
24380   function makeRe() {
24381     if (this.regexp || this.regexp === false) return this.regexp; // at this point, this.set is a 2d array of partial
24382     // pattern strings, or "**".
24383     //
24384     // It's better to use .match().  This function shouldn't
24385     // be used, really, but it's pretty convenient sometimes,
24386     // when you just want to work with a regex.
24387
24388     var set = this.set;
24389     if (!set.length) return this.regexp = false;
24390     var options = this.options;
24391     var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot,
24392         flags = options.nocase ? "i" : "";
24393     var re = set.map(function (pattern) {
24394       return pattern.map(function (p) {
24395         return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
24396       }).join("\\\/");
24397     }).join("|"); // must match entire pattern
24398     // ending in a * or ** will make it less strict.
24399
24400     re = "^(?:" + re + ")$"; // can match anything, as long as it's not this.
24401
24402     if (this.negate) re = "^(?!" + re + ").*$";
24403
24404     try {
24405       return this.regexp = new RegExp(re, flags);
24406     } catch (ex) {
24407       return this.regexp = false;
24408     }
24409   }
24410
24411   minimatch.match = function (list, pattern, options) {
24412     var mm = new Minimatch(pattern, options);
24413     list = list.filter(function (f) {
24414       return mm.match(f);
24415     });
24416
24417     if (options.nonull && !list.length) {
24418       list.push(pattern);
24419     }
24420
24421     return list;
24422   };
24423
24424   Minimatch.prototype.match = match;
24425
24426   function match(f, partial) {
24427     // console.error("match", f, this.pattern)
24428     // short-circuit in the case of busted things.
24429     // comments, etc.
24430     if (this.comment) return false;
24431     if (this.empty) return f === "";
24432     if (f === "/" && partial) return true;
24433     var options = this.options; // windows: need to use /, not \
24434     // On other platforms, \ is a valid (albeit bad) filename char.
24435
24436     if (platform === "win32") {
24437       f = f.split("\\").join("/");
24438     } // treat the test path as a set of pathparts.
24439
24440
24441     f = f.split(slashSplit);
24442
24443     if (options.debug) {
24444       console.error(this.pattern, "split", f);
24445     } // just ONE of the pattern sets in this.set needs to match
24446     // in order for it to be valid.  If negating, then just one
24447     // match means that we have failed.
24448     // Either way, return on the first hit.
24449
24450
24451     var set = this.set; // console.error(this.pattern, "set", set)
24452
24453     for (var i = 0, l = set.length; i < l; i++) {
24454       var pattern = set[i];
24455       var hit = this.matchOne(f, pattern, partial);
24456
24457       if (hit) {
24458         if (options.flipNegate) return true;
24459         return !this.negate;
24460       }
24461     } // didn't get any hits.  this is success if it's a negative
24462     // pattern, failure otherwise.
24463
24464
24465     if (options.flipNegate) return false;
24466     return this.negate;
24467   } // set partial to true to test if, for example,
24468   // "/a/b" matches the start of "/*/b/*/d"
24469   // Partial means, if you run out of file before you run
24470   // out of pattern, then that's fine, as long as all
24471   // the parts match.
24472
24473
24474   Minimatch.prototype.matchOne = function (file, pattern, partial) {
24475     var options = this.options;
24476
24477     if (options.debug) {
24478       console.error("matchOne", {
24479         "this": this,
24480         file: file,
24481         pattern: pattern
24482       });
24483     }
24484
24485     if (options.matchBase && pattern.length === 1) {
24486       file = path.basename(file.join("/")).split("/");
24487     }
24488
24489     if (options.debug) {
24490       console.error("matchOne", file.length, pattern.length);
24491     }
24492
24493     for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
24494       if (options.debug) {
24495         console.error("matchOne loop");
24496       }
24497
24498       var p = pattern[pi],
24499           f = file[fi];
24500
24501       if (options.debug) {
24502         console.error(pattern, p, f);
24503       } // should be impossible.
24504       // some invalid regexp stuff in the set.
24505
24506
24507       if (p === false) return false;
24508
24509       if (p === GLOBSTAR) {
24510         if (options.debug) console.error('GLOBSTAR', [pattern, p, f]); // "**"
24511         // a/**/b/**/c would match the following:
24512         // a/b/x/y/z/c
24513         // a/x/y/z/b/c
24514         // a/b/x/b/x/c
24515         // a/b/c
24516         // To do this, take the rest of the pattern after
24517         // the **, and see if it would match the file remainder.
24518         // If so, return success.
24519         // If not, the ** "swallows" a segment, and try again.
24520         // This is recursively awful.
24521         //
24522         // a/**/b/**/c matching a/b/x/y/z/c
24523         // - a matches a
24524         // - doublestar
24525         //   - matchOne(b/x/y/z/c, b/**/c)
24526         //     - b matches b
24527         //     - doublestar
24528         //       - matchOne(x/y/z/c, c) -> no
24529         //       - matchOne(y/z/c, c) -> no
24530         //       - matchOne(z/c, c) -> no
24531         //       - matchOne(c, c) yes, hit
24532
24533         var fr = fi,
24534             pr = pi + 1;
24535
24536         if (pr === pl) {
24537           if (options.debug) console.error('** at the end'); // a ** at the end will just swallow the rest.
24538           // We have found a match.
24539           // however, it will not swallow /.x, unless
24540           // options.dot is set.
24541           // . and .. are *never* matched by **, for explosively
24542           // exponential reasons.
24543
24544           for (; fi < fl; fi++) {
24545             if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
24546           }
24547
24548           return true;
24549         } // ok, let's see if we can swallow whatever we can.
24550
24551
24552         WHILE: while (fr < fl) {
24553           var swallowee = file[fr];
24554
24555           if (options.debug) {
24556             console.error('\nglobstar while', file, fr, pattern, pr, swallowee);
24557           } // XXX remove this slice.  Just pass the start index.
24558
24559
24560           if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
24561             if (options.debug) console.error('globstar found match!', fr, fl, swallowee); // found a match.
24562
24563             return true;
24564           } else {
24565             // can't swallow "." or ".." ever.
24566             // can only swallow ".foo" when explicitly asked.
24567             if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
24568               if (options.debug) console.error("dot detected!", file, fr, pattern, pr);
24569               break WHILE;
24570             } // ** swallows a segment, and continue.
24571
24572
24573             if (options.debug) console.error('globstar swallow a segment, and continue');
24574             fr++;
24575           }
24576         } // no match was found.
24577         // However, in partial mode, we can't say this is necessarily over.
24578         // If there's more *pattern* left, then
24579
24580
24581         if (partial) {
24582           // ran out of file
24583           // console.error("\n>>> no match, partial?", file, fr, pattern, pr)
24584           if (fr === fl) return true;
24585         }
24586
24587         return false;
24588       } // something other than **
24589       // non-magic patterns just have to match exactly
24590       // patterns with magic have been turned into regexps.
24591
24592
24593       var hit;
24594
24595       if (typeof p === "string") {
24596         if (options.nocase) {
24597           hit = f.toLowerCase() === p.toLowerCase();
24598         } else {
24599           hit = f === p;
24600         }
24601
24602         if (options.debug) {
24603           console.error("string match", p, f, hit);
24604         }
24605       } else {
24606         hit = f.match(p);
24607
24608         if (options.debug) {
24609           console.error("pattern match", p, f, hit);
24610         }
24611       }
24612
24613       if (!hit) return false;
24614     } // Note: ending in / means that we'll get a final ""
24615     // at the end of the pattern.  This can only match a
24616     // corresponding "" at the end of the file.
24617     // If the file ends in /, then it can only match a
24618     // a pattern that ends in /, unless the pattern just
24619     // doesn't have any more for it. But, a/b/ should *not*
24620     // match "a/b/*", even though "" matches against the
24621     // [^/]*? pattern, except in partial mode, where it might
24622     // simply not be reached yet.
24623     // However, a/b/ should still satisfy a/*
24624     // now either we fell off the end of the pattern, or we're done.
24625
24626
24627     if (fi === fl && pi === pl) {
24628       // ran out of pattern and filename at the same time.
24629       // an exact hit!
24630       return true;
24631     } else if (fi === fl) {
24632       // ran out of file, but still had pattern left.
24633       // this is ok if we're doing the match as part of
24634       // a glob fs traversal.
24635       return partial;
24636     } else if (pi === pl) {
24637       // ran out of pattern, still have file left.
24638       // this is only acceptable if we're on the very last
24639       // empty segment of a file with a trailing slash.
24640       // a/* should match a/b/
24641       var emptyFileEnd = fi === fl - 1 && file[fi] === "";
24642       return emptyFileEnd;
24643     } // should be unreachable.
24644
24645
24646     throw new Error("wtf?");
24647   }; // replace stuff like \* with *
24648
24649
24650   function globUnescape(s) {
24651     return s.replace(/\\(.)/g, "$1");
24652   }
24653
24654   function regExpEscape(s) {
24655     return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
24656   }
24657 })(fnmatch$1, fnmatch$1.exports);
24658
24659 var ini = {};
24660
24661 var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
24662   return new (P || (P = Promise))(function (resolve, reject) {
24663     function fulfilled(value) {
24664       try {
24665         step(generator.next(value));
24666       } catch (e) {
24667         reject(e);
24668       }
24669     }
24670
24671     function rejected(value) {
24672       try {
24673         step(generator["throw"](value));
24674       } catch (e) {
24675         reject(e);
24676       }
24677     }
24678
24679     function step(result) {
24680       result.done ? resolve(result.value) : new P(function (resolve) {
24681         resolve(result.value);
24682       }).then(fulfilled, rejected);
24683     }
24684
24685     step((generator = generator.apply(thisArg, _arguments || [])).next());
24686   });
24687 };
24688
24689 var __generator$1 = undefined && undefined.__generator || function (thisArg, body) {
24690   var _ = {
24691     label: 0,
24692     sent: function () {
24693       if (t[0] & 1) throw t[1];
24694       return t[1];
24695     },
24696     trys: [],
24697     ops: []
24698   },
24699       f,
24700       y,
24701       t,
24702       g;
24703   return g = {
24704     next: verb(0),
24705     "throw": verb(1),
24706     "return": verb(2)
24707   }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
24708     return this;
24709   }), g;
24710
24711   function verb(n) {
24712     return function (v) {
24713       return step([n, v]);
24714     };
24715   }
24716
24717   function step(op) {
24718     if (f) throw new TypeError("Generator is already executing.");
24719
24720     while (_) try {
24721       if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
24722       if (y = 0, t) op = [op[0] & 2, t.value];
24723
24724       switch (op[0]) {
24725         case 0:
24726         case 1:
24727           t = op;
24728           break;
24729
24730         case 4:
24731           _.label++;
24732           return {
24733             value: op[1],
24734             done: false
24735           };
24736
24737         case 5:
24738           _.label++;
24739           y = op[1];
24740           op = [0];
24741           continue;
24742
24743         case 7:
24744           op = _.ops.pop();
24745
24746           _.trys.pop();
24747
24748           continue;
24749
24750         default:
24751           if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
24752             _ = 0;
24753             continue;
24754           }
24755
24756           if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
24757             _.label = op[1];
24758             break;
24759           }
24760
24761           if (op[0] === 6 && _.label < t[1]) {
24762             _.label = t[1];
24763             t = op;
24764             break;
24765           }
24766
24767           if (t && _.label < t[2]) {
24768             _.label = t[2];
24769
24770             _.ops.push(op);
24771
24772             break;
24773           }
24774
24775           if (t[2]) _.ops.pop();
24776
24777           _.trys.pop();
24778
24779           continue;
24780       }
24781
24782       op = body.call(thisArg, _);
24783     } catch (e) {
24784       op = [6, e];
24785       y = 0;
24786     } finally {
24787       f = t = 0;
24788     }
24789
24790     if (op[0] & 5) throw op[1];
24791     return {
24792       value: op[0] ? op[1] : void 0,
24793       done: true
24794     };
24795   }
24796 };
24797
24798 var __importStar$1 = undefined && undefined.__importStar || function (mod) {
24799   if (mod && mod.__esModule) return mod;
24800   var result = {};
24801   if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
24802   result["default"] = mod;
24803   return result;
24804 };
24805
24806 Object.defineProperty(ini, "__esModule", {
24807   value: true
24808 });
24809
24810 var fs$f = __importStar$1(require$$0__default["default"]);
24811 /**\r
24812  * define the possible values:\r
24813  * section: [section]\r
24814  * param: key=value\r
24815  * comment: ;this is a comment\r
24816  */
24817
24818
24819 var regex = {
24820   section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
24821   param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
24822   comment: /^\s*[#;].*$/
24823 };
24824 /**\r
24825  * Parses an .ini file\r
24826  * @param file The location of the .ini file\r
24827  */
24828
24829 function parse$7(file) {
24830   return __awaiter$1(this, void 0, void 0, function () {
24831     return __generator$1(this, function (_a) {
24832       return [2
24833       /*return*/
24834       , new Promise(function (resolve, reject) {
24835         fs$f.readFile(file, 'utf8', function (err, data) {
24836           if (err) {
24837             reject(err);
24838             return;
24839           }
24840
24841           resolve(parseString(data));
24842         });
24843       })];
24844     });
24845   });
24846 }
24847
24848 ini.parse = parse$7;
24849
24850 function parseSync$1(file) {
24851   return parseString(fs$f.readFileSync(file, 'utf8'));
24852 }
24853
24854 ini.parseSync = parseSync$1;
24855
24856 function parseString(data) {
24857   var sectionBody = {};
24858   var sectionName = null;
24859   var value = [[sectionName, sectionBody]];
24860   var lines = data.split(/\r\n|\r|\n/);
24861   lines.forEach(function (line) {
24862     var match;
24863
24864     if (regex.comment.test(line)) {
24865       return;
24866     }
24867
24868     if (regex.param.test(line)) {
24869       match = line.match(regex.param);
24870       sectionBody[match[1]] = match[2];
24871     } else if (regex.section.test(line)) {
24872       match = line.match(regex.section);
24873       sectionName = match[1];
24874       sectionBody = {};
24875       value.push([sectionName, sectionBody]);
24876     }
24877   });
24878   return value;
24879 }
24880
24881 ini.parseString = parseString;
24882
24883 var name$g = "editorconfig";
24884 var version$1 = "0.15.3";
24885 var description = "EditorConfig File Locator and Interpreter for Node.js";
24886 var keywords = [
24887         "editorconfig",
24888         "core"
24889 ];
24890 var main = "src/index.js";
24891 var contributors = [
24892         "Hong Xu (topbug.net)",
24893         "Jed Mao (https://github.com/jedmao/)",
24894         "Trey Hunner (http://treyhunner.com)"
24895 ];
24896 var directories = {
24897         bin: "./bin",
24898         lib: "./lib"
24899 };
24900 var scripts = {
24901         clean: "rimraf dist",
24902         prebuild: "npm run clean",
24903         build: "tsc",
24904         pretest: "npm run lint && npm run build && npm run copy && cmake .",
24905         test: "ctest .",
24906         "pretest:ci": "npm run pretest",
24907         "test:ci": "ctest -VV --output-on-failure .",
24908         lint: "npm run eclint && npm run tslint",
24909         eclint: "eclint check --indent_size ignore \"src/**\"",
24910         tslint: "tslint --project tsconfig.json --exclude package.json",
24911         copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
24912         prepub: "npm run lint && npm run build && npm run copy",
24913         pub: "npm publish ./dist"
24914 };
24915 var repository = {
24916         type: "git",
24917         url: "git://github.com/editorconfig/editorconfig-core-js.git"
24918 };
24919 var bugs = "https://github.com/editorconfig/editorconfig-core-js/issues";
24920 var author = "EditorConfig Team";
24921 var license = "MIT";
24922 var dependencies = {
24923         commander: "^2.19.0",
24924         "lru-cache": "^4.1.5",
24925         semver: "^5.6.0",
24926         sigmund: "^1.0.1"
24927 };
24928 var devDependencies = {
24929         "@types/mocha": "^5.2.6",
24930         "@types/node": "^10.12.29",
24931         "@types/semver": "^5.5.0",
24932         "cpy-cli": "^2.0.0",
24933         eclint: "^2.8.1",
24934         mocha: "^5.2.0",
24935         rimraf: "^2.6.3",
24936         should: "^13.2.3",
24937         tslint: "^5.13.1",
24938         typescript: "^3.3.3333"
24939 };
24940 var require$$5$4 = {
24941         name: name$g,
24942         version: version$1,
24943         description: description,
24944         keywords: keywords,
24945         main: main,
24946         contributors: contributors,
24947         directories: directories,
24948         scripts: scripts,
24949         repository: repository,
24950         bugs: bugs,
24951         author: author,
24952         license: license,
24953         dependencies: dependencies,
24954         devDependencies: devDependencies
24955 };
24956
24957 var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
24958   return new (P || (P = Promise))(function (resolve, reject) {
24959     function fulfilled(value) {
24960       try {
24961         step(generator.next(value));
24962       } catch (e) {
24963         reject(e);
24964       }
24965     }
24966
24967     function rejected(value) {
24968       try {
24969         step(generator["throw"](value));
24970       } catch (e) {
24971         reject(e);
24972       }
24973     }
24974
24975     function step(result) {
24976       result.done ? resolve(result.value) : new P(function (resolve) {
24977         resolve(result.value);
24978       }).then(fulfilled, rejected);
24979     }
24980
24981     step((generator = generator.apply(thisArg, _arguments || [])).next());
24982   });
24983 };
24984
24985 var __generator = undefined && undefined.__generator || function (thisArg, body) {
24986   var _ = {
24987     label: 0,
24988     sent: function () {
24989       if (t[0] & 1) throw t[1];
24990       return t[1];
24991     },
24992     trys: [],
24993     ops: []
24994   },
24995       f,
24996       y,
24997       t,
24998       g;
24999   return g = {
25000     next: verb(0),
25001     "throw": verb(1),
25002     "return": verb(2)
25003   }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
25004     return this;
25005   }), g;
25006
25007   function verb(n) {
25008     return function (v) {
25009       return step([n, v]);
25010     };
25011   }
25012
25013   function step(op) {
25014     if (f) throw new TypeError("Generator is already executing.");
25015
25016     while (_) try {
25017       if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25018       if (y = 0, t) op = [op[0] & 2, t.value];
25019
25020       switch (op[0]) {
25021         case 0:
25022         case 1:
25023           t = op;
25024           break;
25025
25026         case 4:
25027           _.label++;
25028           return {
25029             value: op[1],
25030             done: false
25031           };
25032
25033         case 5:
25034           _.label++;
25035           y = op[1];
25036           op = [0];
25037           continue;
25038
25039         case 7:
25040           op = _.ops.pop();
25041
25042           _.trys.pop();
25043
25044           continue;
25045
25046         default:
25047           if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
25048             _ = 0;
25049             continue;
25050           }
25051
25052           if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
25053             _.label = op[1];
25054             break;
25055           }
25056
25057           if (op[0] === 6 && _.label < t[1]) {
25058             _.label = t[1];
25059             t = op;
25060             break;
25061           }
25062
25063           if (t && _.label < t[2]) {
25064             _.label = t[2];
25065
25066             _.ops.push(op);
25067
25068             break;
25069           }
25070
25071           if (t[2]) _.ops.pop();
25072
25073           _.trys.pop();
25074
25075           continue;
25076       }
25077
25078       op = body.call(thisArg, _);
25079     } catch (e) {
25080       op = [6, e];
25081       y = 0;
25082     } finally {
25083       f = t = 0;
25084     }
25085
25086     if (op[0] & 5) throw op[1];
25087     return {
25088       value: op[0] ? op[1] : void 0,
25089       done: true
25090     };
25091   }
25092 };
25093
25094 var __importStar = undefined && undefined.__importStar || function (mod) {
25095   if (mod && mod.__esModule) return mod;
25096   var result = {};
25097   if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
25098   result["default"] = mod;
25099   return result;
25100 };
25101
25102 var __importDefault = undefined && undefined.__importDefault || function (mod) {
25103   return mod && mod.__esModule ? mod : {
25104     "default": mod
25105   };
25106 };
25107
25108 Object.defineProperty(src$1, "__esModule", {
25109   value: true
25110 });
25111
25112 var fs$e = __importStar(require$$0__default["default"]);
25113
25114 var path$i = __importStar(require$$0__default$2["default"]);
25115
25116 var semver = __importStar(semver$1.exports);
25117
25118 var fnmatch_1 = __importDefault(fnmatch$1.exports);
25119
25120 var ini_1 = ini;
25121 src$1.parseString = ini_1.parseString;
25122
25123 var package_json_1 = __importDefault(require$$5$4);
25124
25125 var knownProps = {
25126   end_of_line: true,
25127   indent_style: true,
25128   indent_size: true,
25129   insert_final_newline: true,
25130   trim_trailing_whitespace: true,
25131   charset: true
25132 };
25133
25134 function fnmatch(filepath, glob) {
25135   var matchOptions = {
25136     matchBase: true,
25137     dot: true,
25138     noext: true
25139   };
25140   glob = glob.replace(/\*\*/g, '{*,**/**/**}');
25141   return fnmatch_1.default(filepath, glob, matchOptions);
25142 }
25143
25144 function getConfigFileNames(filepath, options) {
25145   var paths = [];
25146
25147   do {
25148     filepath = path$i.dirname(filepath);
25149     paths.push(path$i.join(filepath, options.config));
25150   } while (filepath !== options.root);
25151
25152   return paths;
25153 }
25154
25155 function processMatches(matches, version) {
25156   // Set indent_size to 'tab' if indent_size is unspecified and
25157   // indent_style is set to 'tab'.
25158   if ('indent_style' in matches && matches.indent_style === 'tab' && !('indent_size' in matches) && semver.gte(version, '0.10.0')) {
25159     matches.indent_size = 'tab';
25160   } // Set tab_width to indent_size if indent_size is specified and
25161   // tab_width is unspecified
25162
25163
25164   if ('indent_size' in matches && !('tab_width' in matches) && matches.indent_size !== 'tab') {
25165     matches.tab_width = matches.indent_size;
25166   } // Set indent_size to tab_width if indent_size is 'tab'
25167
25168
25169   if ('indent_size' in matches && 'tab_width' in matches && matches.indent_size === 'tab') {
25170     matches.indent_size = matches.tab_width;
25171   }
25172
25173   return matches;
25174 }
25175
25176 function processOptions(options, filepath) {
25177   if (options === void 0) {
25178     options = {};
25179   }
25180
25181   return {
25182     config: options.config || '.editorconfig',
25183     version: options.version || package_json_1.default.version,
25184     root: path$i.resolve(options.root || path$i.parse(filepath).root)
25185   };
25186 }
25187
25188 function buildFullGlob(pathPrefix, glob) {
25189   switch (glob.indexOf('/')) {
25190     case -1:
25191       glob = '**/' + glob;
25192       break;
25193
25194     case 0:
25195       glob = glob.substring(1);
25196       break;
25197   }
25198
25199   return path$i.join(pathPrefix, glob);
25200 }
25201
25202 function extendProps(props, options) {
25203   if (props === void 0) {
25204     props = {};
25205   }
25206
25207   if (options === void 0) {
25208     options = {};
25209   }
25210
25211   for (var key in options) {
25212     if (options.hasOwnProperty(key)) {
25213       var value = options[key];
25214       var key2 = key.toLowerCase();
25215       var value2 = value;
25216
25217       if (knownProps[key2]) {
25218         value2 = value.toLowerCase();
25219       }
25220
25221       try {
25222         value2 = JSON.parse(value);
25223       } catch (e) {}
25224
25225       if (typeof value === 'undefined' || value === null) {
25226         // null and undefined are values specific to JSON (no special meaning
25227         // in editorconfig) & should just be returned as regular strings.
25228         value2 = String(value);
25229       }
25230
25231       props[key2] = value2;
25232     }
25233   }
25234
25235   return props;
25236 }
25237
25238 function parseFromConfigs(configs, filepath, options) {
25239   return processMatches(configs.reverse().reduce(function (matches, file) {
25240     var pathPrefix = path$i.dirname(file.name);
25241     file.contents.forEach(function (section) {
25242       var glob = section[0];
25243       var options2 = section[1];
25244
25245       if (!glob) {
25246         return;
25247       }
25248
25249       var fullGlob = buildFullGlob(pathPrefix, glob);
25250
25251       if (!fnmatch(filepath, fullGlob)) {
25252         return;
25253       }
25254
25255       matches = extendProps(matches, options2);
25256     });
25257     return matches;
25258   }, {}), options.version);
25259 }
25260
25261 function getConfigsForFiles(files) {
25262   var configs = [];
25263
25264   for (var i in files) {
25265     if (files.hasOwnProperty(i)) {
25266       var file = files[i];
25267       var contents = ini_1.parseString(file.contents);
25268       configs.push({
25269         name: file.name,
25270         contents: contents
25271       });
25272
25273       if ((contents[0][1].root || '').toLowerCase() === 'true') {
25274         break;
25275       }
25276     }
25277   }
25278
25279   return configs;
25280 }
25281
25282 function readConfigFiles(filepaths) {
25283   return __awaiter(this, void 0, void 0, function () {
25284     return __generator(this, function (_a) {
25285       return [2
25286       /*return*/
25287       , Promise.all(filepaths.map(function (name) {
25288         return new Promise(function (resolve) {
25289           fs$e.readFile(name, 'utf8', function (err, data) {
25290             resolve({
25291               name: name,
25292               contents: err ? '' : data
25293             });
25294           });
25295         });
25296       }))];
25297     });
25298   });
25299 }
25300
25301 function readConfigFilesSync(filepaths) {
25302   var files = [];
25303   var file;
25304   filepaths.forEach(function (filepath) {
25305     try {
25306       file = fs$e.readFileSync(filepath, 'utf8');
25307     } catch (e) {
25308       file = '';
25309     }
25310
25311     files.push({
25312       name: filepath,
25313       contents: file
25314     });
25315   });
25316   return files;
25317 }
25318
25319 function opts(filepath, options) {
25320   if (options === void 0) {
25321     options = {};
25322   }
25323
25324   var resolvedFilePath = path$i.resolve(filepath);
25325   return [resolvedFilePath, processOptions(options, resolvedFilePath)];
25326 }
25327
25328 function parseFromFiles(filepath, files, options) {
25329   if (options === void 0) {
25330     options = {};
25331   }
25332
25333   return __awaiter(this, void 0, void 0, function () {
25334     var _a, resolvedFilePath, processedOptions;
25335
25336     return __generator(this, function (_b) {
25337       _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
25338       return [2
25339       /*return*/
25340       , files.then(getConfigsForFiles).then(function (configs) {
25341         return parseFromConfigs(configs, resolvedFilePath, processedOptions);
25342       })];
25343     });
25344   });
25345 }
25346
25347 src$1.parseFromFiles = parseFromFiles;
25348
25349 function parseFromFilesSync(filepath, files, options) {
25350   if (options === void 0) {
25351     options = {};
25352   }
25353
25354   var _a = opts(filepath, options),
25355       resolvedFilePath = _a[0],
25356       processedOptions = _a[1];
25357
25358   return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
25359 }
25360
25361 src$1.parseFromFilesSync = parseFromFilesSync;
25362
25363 function parse$6(_filepath, _options) {
25364   if (_options === void 0) {
25365     _options = {};
25366   }
25367
25368   return __awaiter(this, void 0, void 0, function () {
25369     var _a, resolvedFilePath, processedOptions, filepaths;
25370
25371     return __generator(this, function (_b) {
25372       _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
25373       filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
25374       return [2
25375       /*return*/
25376       , readConfigFiles(filepaths).then(getConfigsForFiles).then(function (configs) {
25377         return parseFromConfigs(configs, resolvedFilePath, processedOptions);
25378       })];
25379     });
25380   });
25381 }
25382
25383 src$1.parse = parse$6;
25384
25385 function parseSync(_filepath, _options) {
25386   if (_options === void 0) {
25387     _options = {};
25388   }
25389
25390   var _a = opts(_filepath, _options),
25391       resolvedFilePath = _a[0],
25392       processedOptions = _a[1];
25393
25394   var filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
25395   var files = readConfigFilesSync(filepaths);
25396   return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
25397 }
25398
25399 src$1.parseSync = parseSync;
25400
25401 var editorconfigToPrettier = editorConfigToPrettier$1;
25402
25403 function removeUnset(editorConfig) {
25404   const result = {};
25405   const keys = Object.keys(editorConfig);
25406
25407   for (let i = 0; i < keys.length; i++) {
25408     const key = keys[i];
25409
25410     if (editorConfig[key] === "unset") {
25411       continue;
25412     }
25413
25414     result[key] = editorConfig[key];
25415   }
25416
25417   return result;
25418 }
25419
25420 function editorConfigToPrettier$1(editorConfig) {
25421   if (!editorConfig) {
25422     return null;
25423   }
25424
25425   editorConfig = removeUnset(editorConfig);
25426
25427   if (Object.keys(editorConfig).length === 0) {
25428     return null;
25429   }
25430
25431   const result = {};
25432
25433   if (editorConfig.indent_style) {
25434     result.useTabs = editorConfig.indent_style === "tab";
25435   }
25436
25437   if (editorConfig.indent_size === "tab") {
25438     result.useTabs = true;
25439   }
25440
25441   if (result.useTabs && editorConfig.tab_width) {
25442     result.tabWidth = editorConfig.tab_width;
25443   } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") {
25444     result.tabWidth = editorConfig.indent_size;
25445   } else if (editorConfig.tab_width !== undefined) {
25446     result.tabWidth = editorConfig.tab_width;
25447   }
25448
25449   if (editorConfig.max_line_length && editorConfig.max_line_length !== "off") {
25450     result.printWidth = editorConfig.max_line_length;
25451   }
25452
25453   if (editorConfig.quote_type === "single") {
25454     result.singleQuote = true;
25455   } else if (editorConfig.quote_type === "double") {
25456     result.singleQuote = false;
25457   }
25458
25459   if (["cr", "crlf", "lf"].indexOf(editorConfig.end_of_line) !== -1) {
25460     result.endOfLine = editorConfig.end_of_line;
25461   }
25462
25463   if (editorConfig.insert_final_newline === false || editorConfig.insert_final_newline === true) {
25464     result.insertFinalNewline = editorConfig.insert_final_newline;
25465   }
25466
25467   return result;
25468 }
25469
25470 // https://github.com/kirstein/find-project-root/blob/master/index.js
25471
25472
25473 const fs$d = require$$0__default["default"];
25474 const path$h = require$$0__default$2["default"];
25475 const MARKERS = [".git", ".hg"];
25476
25477 const markerExists = directory => MARKERS.some(mark => fs$d.existsSync(path$h.join(directory, mark)));
25478
25479 function findProjectRoot$1(directory) {
25480   while (!markerExists(directory)) {
25481     const parentDirectory = path$h.resolve(directory, "..");
25482
25483     if (parentDirectory === directory) {
25484       break;
25485     }
25486
25487     directory = parentDirectory;
25488   }
25489
25490   return directory;
25491 }
25492
25493 var findProjectRoot_1 = findProjectRoot$1;
25494
25495 const path$g = require$$0__default$2["default"];
25496 const editorconfig = src$1;
25497 const mem$2 = dist$1;
25498 const editorConfigToPrettier = editorconfigToPrettier;
25499 const findProjectRoot = findProjectRoot_1;
25500
25501 const jsonStringifyMem = fn => mem$2(fn, {
25502   cacheKey: JSON.stringify
25503 });
25504
25505 const maybeParse = (filePath, parse) => filePath && parse(filePath, {
25506   root: findProjectRoot(path$g.dirname(path$g.resolve(filePath)))
25507 });
25508
25509 const editorconfigAsyncNoCache = async filePath => editorConfigToPrettier(await maybeParse(filePath, editorconfig.parse));
25510
25511 const editorconfigAsyncWithCache = jsonStringifyMem(editorconfigAsyncNoCache);
25512
25513 const editorconfigSyncNoCache = filePath => editorConfigToPrettier(maybeParse(filePath, editorconfig.parseSync));
25514
25515 const editorconfigSyncWithCache = jsonStringifyMem(editorconfigSyncNoCache);
25516
25517 function getLoadFunction(opts) {
25518   if (!opts.editorconfig) {
25519     return () => null;
25520   }
25521
25522   if (opts.sync) {
25523     return opts.cache ? editorconfigSyncWithCache : editorconfigSyncNoCache;
25524   }
25525
25526   return opts.cache ? editorconfigAsyncWithCache : editorconfigAsyncNoCache;
25527 }
25528
25529 function clearCache$2() {
25530   mem$2.clear(editorconfigSyncWithCache);
25531   mem$2.clear(editorconfigAsyncWithCache);
25532 }
25533
25534 var resolveConfigEditorconfig = {
25535   getLoadFunction,
25536   clearCache: clearCache$2
25537 };
25538
25539 const _excluded$1 = ["overrides"];
25540
25541 const path$f = require$$0__default$2["default"];
25542 const minimatch = minimatch_1;
25543 const mem$1 = dist$1;
25544 const thirdParty$1 = require$$7$2;
25545 const loadToml = loadToml$1;
25546 const loadJson5 = loadJson5$1;
25547 const resolve$1 = resolve_1;
25548 const resolveEditorConfig = resolveConfigEditorconfig;
25549 /**
25550  * @typedef {import("cosmiconfig/dist/Explorer").Explorer} Explorer
25551  * @typedef {{sync: boolean; cache: boolean }} Options
25552  */
25553
25554 /**
25555  * @type {(opts: Options) => Explorer}
25556  */
25557
25558 const getExplorerMemoized = mem$1(opts => {
25559   const cosmiconfig = thirdParty$1["cosmiconfig" + (opts.sync ? "Sync" : "")];
25560   const explorer = cosmiconfig("prettier", {
25561     cache: opts.cache,
25562     transform: result => {
25563       if (result && result.config) {
25564         if (typeof result.config === "string") {
25565           const dir = path$f.dirname(result.filepath);
25566           const modulePath = resolve$1(result.config, {
25567             paths: [dir]
25568           });
25569           result.config = require(modulePath);
25570         }
25571
25572         if (typeof result.config !== "object") {
25573           throw new TypeError("Config is only allowed to be an object, " + `but received ${typeof result.config} in "${result.filepath}"`);
25574         }
25575
25576         delete result.config.$schema;
25577       }
25578
25579       return result;
25580     },
25581     searchPlaces: ["package.json", ".prettierrc", ".prettierrc.json", ".prettierrc.yaml", ".prettierrc.yml", ".prettierrc.json5", ".prettierrc.js", ".prettierrc.cjs", "prettier.config.js", "prettier.config.cjs", ".prettierrc.toml"],
25582     loaders: {
25583       ".toml": loadToml,
25584       ".json5": loadJson5
25585     }
25586   });
25587   return explorer;
25588 }, {
25589   cacheKey: JSON.stringify
25590 });
25591 /**
25592  * @param {Options} opts
25593  * @return {Explorer}
25594  */
25595
25596 function getExplorer(opts) {
25597   // Normalize opts before passing to a memoized function
25598   opts = Object.assign({
25599     sync: false,
25600     cache: false
25601   }, opts);
25602   return getExplorerMemoized(opts);
25603 }
25604
25605 function _resolveConfig(filePath, opts, sync) {
25606   opts = Object.assign({
25607     useCache: true
25608   }, opts);
25609   const loadOpts = {
25610     cache: Boolean(opts.useCache),
25611     sync: Boolean(sync),
25612     editorconfig: Boolean(opts.editorconfig)
25613   };
25614   const {
25615     load,
25616     search
25617   } = getExplorer(loadOpts);
25618   const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
25619   const arr = [opts.config ? load(opts.config) : search(filePath), loadEditorConfig(filePath)];
25620
25621   const unwrapAndMerge = ([result, editorConfigured]) => {
25622     const merged = Object.assign(Object.assign({}, editorConfigured), mergeOverrides(result, filePath));
25623
25624     for (const optionName of ["plugins", "pluginSearchDirs"]) {
25625       if (Array.isArray(merged[optionName])) {
25626         merged[optionName] = merged[optionName].map(value => typeof value === "string" && value.startsWith(".") // relative path
25627         ? path$f.resolve(path$f.dirname(result.filepath), value) : value);
25628       }
25629     }
25630
25631     if (!result && !editorConfigured) {
25632       return null;
25633     } // We are not using this option
25634
25635
25636     delete merged.insertFinalNewline;
25637     return merged;
25638   };
25639
25640   if (loadOpts.sync) {
25641     return unwrapAndMerge(arr);
25642   }
25643
25644   return Promise.all(arr).then(unwrapAndMerge);
25645 }
25646
25647 const resolveConfig = (filePath, opts) => _resolveConfig(filePath, opts, false);
25648
25649 resolveConfig.sync = (filePath, opts) => _resolveConfig(filePath, opts, true);
25650
25651 function clearCache$1() {
25652   mem$1.clear(getExplorerMemoized);
25653   resolveEditorConfig.clearCache();
25654 }
25655
25656 async function resolveConfigFile(filePath) {
25657   const {
25658     search
25659   } = getExplorer({
25660     sync: false
25661   });
25662   const result = await search(filePath);
25663   return result ? result.filepath : null;
25664 }
25665
25666 resolveConfigFile.sync = filePath => {
25667   const {
25668     search
25669   } = getExplorer({
25670     sync: true
25671   });
25672   const result = search(filePath);
25673   return result ? result.filepath : null;
25674 };
25675
25676 function mergeOverrides(configResult, filePath) {
25677   const {
25678     config,
25679     filepath: configPath
25680   } = configResult || {};
25681
25682   const _ref = config || {},
25683         {
25684     overrides
25685   } = _ref,
25686         options = _objectWithoutProperties(_ref, _excluded$1);
25687
25688   if (filePath && overrides) {
25689     const relativeFilePath = path$f.relative(path$f.dirname(configPath), filePath);
25690
25691     for (const override of overrides) {
25692       if (pathMatchesGlobs(relativeFilePath, override.files, override.excludeFiles)) {
25693         Object.assign(options, override.options);
25694       }
25695     }
25696   }
25697
25698   return options;
25699 } // Based on eslint: https://github.com/eslint/eslint/blob/master/lib/config/config-ops.js
25700
25701
25702 function pathMatchesGlobs(filePath, patterns, excludedPatterns = []) {
25703   const patternList = Array.isArray(patterns) ? patterns : [patterns];
25704   const excludedPatternList = Array.isArray(excludedPatterns) ? excludedPatterns : [excludedPatterns];
25705   const opts = {
25706     matchBase: true,
25707     dot: true
25708   };
25709   return patternList.some(pattern => minimatch(filePath, pattern, opts)) && !excludedPatternList.some(excludedPattern => minimatch(filePath, excludedPattern, opts));
25710 }
25711
25712 var resolveConfig_1 = {
25713   resolveConfig,
25714   resolveConfigFile,
25715   clearCache: clearCache$1
25716 };
25717
25718 function make_array(subject) {
25719   return Array.isArray(subject) ? subject : [subject];
25720 }
25721
25722 const REGEX_BLANK_LINE = /^\s+$/;
25723 const REGEX_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
25724 const REGEX_LEADING_EXCAPED_HASH = /^\\#/;
25725 const SLASH$1 = '/';
25726 const KEY_IGNORE$1 = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore')
25727 /* istanbul ignore next */
25728 : 'node-ignore';
25729
25730 const define$1 = (object, key, value) => Object.defineProperty(object, key, {
25731   value
25732 });
25733
25734 const REGEX_REGEXP_RANGE$1 = /([0-z])-([0-z])/g; // Sanitize the range of a regular expression
25735 // The cases are complicated, see test cases for details
25736
25737 const sanitizeRange$1 = range => range.replace(REGEX_REGEXP_RANGE$1, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but
25738 //   fatal for JavaScript regular expression, so eliminate it.
25739 : ''); // > If the pattern ends with a slash,
25740 // > it is removed for the purpose of the following description,
25741 // > but it would only find a match with a directory.
25742 // > In other words, foo/ will match a directory foo and paths underneath it,
25743 // > but will not match a regular file or a symbolic link foo
25744 // >  (this is consistent with the way how pathspec works in general in Git).
25745 // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
25746 // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
25747 //      you could use option `mark: true` with `glob`
25748 // '`foo/`' should not continue with the '`..`'
25749
25750
25751 const DEFAULT_REPLACER_PREFIX = [// > Trailing spaces are ignored unless they are quoted with backslash ("\")
25752 [// (a\ ) -> (a )
25753 // (a  ) -> (a)
25754 // (a \ ) -> (a  )
25755 /\\?\s+$/, match => match.indexOf('\\') === 0 ? ' ' : ''], // replace (\ ) with ' '
25756 [/\\\s/g, () => ' '], // Escape metacharacters
25757 // which is written down by users but means special for regular expressions.
25758 // > There are 12 characters with special meanings:
25759 // > - the backslash \,
25760 // > - the caret ^,
25761 // > - the dollar sign $,
25762 // > - the period or dot .,
25763 // > - the vertical bar or pipe symbol |,
25764 // > - the question mark ?,
25765 // > - the asterisk or star *,
25766 // > - the plus sign +,
25767 // > - the opening parenthesis (,
25768 // > - the closing parenthesis ),
25769 // > - and the opening square bracket [,
25770 // > - the opening curly brace {,
25771 // > These special characters are often called "metacharacters".
25772 [/[\\^$.|*+(){]/g, match => `\\${match}`], [// > [abc] matches any character inside the brackets
25773 // >    (in this case a, b, or c);
25774 /\[([^\]/]*)($|\])/g, (match, p1, p2) => p2 === ']' ? `[${sanitizeRange$1(p1)}]` : `\\${match}`], [// > a question mark (?) matches a single character
25775 /(?!\\)\?/g, () => '[^/]'], // leading slash
25776 [// > A leading slash matches the beginning of the pathname.
25777 // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
25778 // A leading slash matches the beginning of the pathname
25779 /^\//, () => '^'], // replace special metacharacter slash after the leading slash
25780 [/\//g, () => '\\/'], [// > A leading "**" followed by a slash means match in all directories.
25781 // > For example, "**/foo" matches file or directory "foo" anywhere,
25782 // > the same as pattern "foo".
25783 // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
25784 // >   under directory "foo".
25785 // Notice that the '*'s have been replaced as '\\*'
25786 /^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo'
25787 () => '^(?:.*\\/)?']];
25788 const DEFAULT_REPLACER_SUFFIX = [// starting
25789 [// there will be no leading '/'
25790 //   (which has been replaced by section "leading slash")
25791 // If starts with '**', adding a '^' to the regular expression also works
25792 /^(?=[^^])/, function startingReplacer() {
25793   return !/\/(?!$)/.test(this) // > If the pattern does not contain a slash /,
25794   // >   Git treats it as a shell glob pattern
25795   // Actually, if there is only a trailing slash,
25796   //   git also treats it as a shell glob pattern
25797   ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for
25798   // >   consumption by fnmatch(3)
25799   : '^';
25800 }], // two globstars
25801 [// Use lookahead assertions so that we could match more than one `'/**'`
25802 /\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories
25803 // should not use '*', or it will be replaced by the next replacer
25804 // Check if it is not the last `'/**'`
25805 (match, index, str) => index + 6 < str.length // case: /**/
25806 // > A slash followed by two consecutive asterisks then a slash matches
25807 // >   zero or more directories.
25808 // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
25809 // '/**/'
25810 ? '(?:\\/[^\\/]+)*' // case: /**
25811 // > A trailing `"/**"` matches everything inside.
25812 // #21: everything inside but it should not include the current folder
25813 : '\\/.+'], // intermediate wildcards
25814 [// Never replace escaped '*'
25815 // ignore rule '\*' will match the path '*'
25816 // 'abc.*/' -> go
25817 // 'abc.*'  -> skip this rule
25818 /(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js'
25819 // '*.js' doesn't match 'abc'
25820 (match, p1) => `${p1}[^\\/]*`], // trailing wildcard
25821 [/(\^|\\\/)?\\\*$/, (match, p1) => {
25822   const prefix = p1 // '\^':
25823   // '/*' does not match ''
25824   // '/*' does not match everything
25825   // '\\\/':
25826   // 'abc/*' does not match 'abc/'
25827   ? `${p1}[^/]+` // 'a*' matches 'a'
25828   // 'a*' matches 'aa'
25829   : '[^/]*';
25830   return `${prefix}(?=$|\\/$)`;
25831 }], [// unescape
25832 /\\\\\\/g, () => '\\']];
25833 const POSITIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // 'f'
25834 // matches
25835 // - /f(end)
25836 // - /f/
25837 // - (start)f(end)
25838 // - (start)f/
25839 // doesn't match
25840 // - oof
25841 // - foo
25842 // pseudo:
25843 // -> (^|/)f(/|$)
25844 // ending
25845 [// 'js' will not match 'js.'
25846 // 'ab' will not match 'abc'
25847 /(?:[^*/])$/, // 'js*' will not match 'a.js'
25848 // 'js/' will not match 'a.js'
25849 // 'js' will match 'a.js' and 'a.js/'
25850 match => `${match}(?=$|\\/)`], ...DEFAULT_REPLACER_SUFFIX];
25851 const NEGATIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // #24, #38
25852 // The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore)
25853 // A negative pattern without a trailing wildcard should not
25854 // re-include the things inside that directory.
25855 // eg:
25856 // ['node_modules/*', '!node_modules']
25857 // should ignore `node_modules/a.js`
25858 [/(?:[^*])$/, match => `${match}(?=$|\\/$)`], ...DEFAULT_REPLACER_SUFFIX]; // A simple cache, because an ignore rule only has only one certain meaning
25859
25860 const cache = Object.create(null); // @param {pattern}
25861
25862 const make_regex = (pattern, negative, ignorecase) => {
25863   const r = cache[pattern];
25864
25865   if (r) {
25866     return r;
25867   }
25868
25869   const replacers = negative ? NEGATIVE_REPLACERS : POSITIVE_REPLACERS;
25870   const source = replacers.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
25871   return cache[pattern] = ignorecase ? new RegExp(source, 'i') : new RegExp(source);
25872 }; // > A blank line matches no files, so it can serve as a separator for readability.
25873
25874
25875 const checkPattern$1 = pattern => pattern && typeof pattern === 'string' && !REGEX_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment.
25876 && pattern.indexOf('#') !== 0;
25877
25878 const createRule$1 = (pattern, ignorecase) => {
25879   const origin = pattern;
25880   let negative = false; // > An optional prefix "!" which negates the pattern;
25881
25882   if (pattern.indexOf('!') === 0) {
25883     negative = true;
25884     pattern = pattern.substr(1);
25885   }
25886
25887   pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that
25888   // >   begin with a literal "!", for example, `"\!important!.txt"`.
25889   .replace(REGEX_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that
25890   // >   begin with a hash.
25891   .replace(REGEX_LEADING_EXCAPED_HASH, '#');
25892   const regex = make_regex(pattern, negative, ignorecase);
25893   return {
25894     origin,
25895     pattern,
25896     negative,
25897     regex
25898   };
25899 };
25900
25901 class IgnoreBase {
25902   constructor({
25903     ignorecase = true
25904   } = {}) {
25905     this._rules = [];
25906     this._ignorecase = ignorecase;
25907     define$1(this, KEY_IGNORE$1, true);
25908
25909     this._initCache();
25910   }
25911
25912   _initCache() {
25913     this._cache = Object.create(null);
25914   } // @param {Array.<string>|string|Ignore} pattern
25915
25916
25917   add(pattern) {
25918     this._added = false;
25919
25920     if (typeof pattern === 'string') {
25921       pattern = pattern.split(/\r?\n/g);
25922     }
25923
25924     make_array(pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore,
25925     // making the behavior changed.
25926
25927     if (this._added) {
25928       this._initCache();
25929     }
25930
25931     return this;
25932   } // legacy
25933
25934
25935   addPattern(pattern) {
25936     return this.add(pattern);
25937   }
25938
25939   _addPattern(pattern) {
25940     // #32
25941     if (pattern && pattern[KEY_IGNORE$1]) {
25942       this._rules = this._rules.concat(pattern._rules);
25943       this._added = true;
25944       return;
25945     }
25946
25947     if (checkPattern$1(pattern)) {
25948       const rule = createRule$1(pattern, this._ignorecase);
25949       this._added = true;
25950
25951       this._rules.push(rule);
25952     }
25953   }
25954
25955   filter(paths) {
25956     return make_array(paths).filter(path => this._filter(path));
25957   }
25958
25959   createFilter() {
25960     return path => this._filter(path);
25961   }
25962
25963   ignores(path) {
25964     return !this._filter(path);
25965   } // @returns `Boolean` true if the `path` is NOT ignored
25966
25967
25968   _filter(path, slices) {
25969     if (!path) {
25970       return false;
25971     }
25972
25973     if (path in this._cache) {
25974       return this._cache[path];
25975     }
25976
25977     if (!slices) {
25978       // path/to/a.js
25979       // ['path', 'to', 'a.js']
25980       slices = path.split(SLASH$1);
25981     }
25982
25983     slices.pop();
25984     return this._cache[path] = slices.length // > It is not possible to re-include a file if a parent directory of
25985     // >   that file is excluded.
25986     // If the path contains a parent directory, check the parent first
25987     ? this._filter(slices.join(SLASH$1) + SLASH$1, slices) && this._test(path) // Or only test the path
25988     : this._test(path);
25989   } // @returns {Boolean} true if a file is NOT ignored
25990
25991
25992   _test(path) {
25993     // Explicitly define variable type by setting matched to `0`
25994     let matched = 0;
25995
25996     this._rules.forEach(rule => {
25997       // if matched = true, then we only test negative rules
25998       // if matched = false, then we test non-negative rules
25999       if (!(matched ^ rule.negative)) {
26000         matched = rule.negative ^ rule.regex.test(path);
26001       }
26002     });
26003
26004     return !matched;
26005   }
26006
26007 } // Windows
26008 // --------------------------------------------------------------
26009
26010 /* istanbul ignore if  */
26011
26012
26013 if ( // Detect `process` so that it can run in browsers.
26014 typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) {
26015   const filter = IgnoreBase.prototype._filter;
26016   /* eslint no-control-regex: "off" */
26017
26018   const make_posix = str => /^\\\\\?\\/.test(str) || /[^\x00-\x80]+/.test(str) ? str : str.replace(/\\/g, '/');
26019
26020   IgnoreBase.prototype._filter = function filterWin32(path, slices) {
26021     path = make_posix(path);
26022     return filter.call(this, path, slices);
26023   };
26024 }
26025
26026 var ignore$2 = options => new IgnoreBase(options);
26027
26028 const fs$c = require$$0__default["default"];
26029 const fsAsync = fs$c.promises;
26030 /**
26031  * @param {string} filename
26032  * @returns {Promise<null | string>}
26033  */
26034
26035 async function getFileContentOrNull$1(filename) {
26036   try {
26037     return await fsAsync.readFile(filename, "utf8");
26038   } catch (error) {
26039     return handleError(filename, error);
26040   }
26041 }
26042 /**
26043  * @param {string} filename
26044  * @returns {null | string}
26045  */
26046
26047
26048 getFileContentOrNull$1.sync = function (filename) {
26049   try {
26050     return fs$c.readFileSync(filename, "utf8");
26051   } catch (error) {
26052     return handleError(filename, error);
26053   }
26054 };
26055
26056 function handleError(filename, error) {
26057   if (error && error.code === "ENOENT") {
26058     return null;
26059   }
26060
26061   throw new Error(`Unable to read ${filename}: ${error.message}`);
26062 }
26063
26064 var getFileContentOrNull_1 = getFileContentOrNull$1;
26065
26066 const path$e = require$$0__default$2["default"];
26067 const ignore$1 = ignore$2;
26068 const getFileContentOrNull = getFileContentOrNull_1;
26069 /**
26070  * @param {string?} ignorePath
26071  * @param {boolean?} withNodeModules
26072  */
26073
26074 async function createIgnorer$1(ignorePath, withNodeModules) {
26075   const ignoreContent = ignorePath ? await getFileContentOrNull(path$e.resolve(ignorePath)) : null;
26076   return _createIgnorer(ignoreContent, withNodeModules);
26077 }
26078 /**
26079  * @param {string?} ignorePath
26080  * @param {boolean?} withNodeModules
26081  */
26082
26083
26084 createIgnorer$1.sync = function (ignorePath, withNodeModules) {
26085   const ignoreContent = !ignorePath ? null : getFileContentOrNull.sync(path$e.resolve(ignorePath));
26086   return _createIgnorer(ignoreContent, withNodeModules);
26087 };
26088 /**
26089  * @param {null | string} ignoreContent
26090  * @param {boolean?} withNodeModules
26091  */
26092
26093
26094 function _createIgnorer(ignoreContent, withNodeModules) {
26095   const ignorer = ignore$1().add(ignoreContent || "");
26096
26097   if (!withNodeModules) {
26098     ignorer.add("node_modules");
26099   }
26100
26101   return ignorer;
26102 }
26103
26104 var createIgnorer_1 = createIgnorer$1;
26105
26106 const path$d = require$$0__default$2["default"];
26107 const options$c = options$d;
26108 const config$1 = resolveConfig_1;
26109 const createIgnorer = createIgnorer_1;
26110 /**
26111  * @typedef {{ ignorePath?: string, withNodeModules?: boolean, plugins: object }} FileInfoOptions
26112  * @typedef {{ ignored: boolean, inferredParser: string | null }} FileInfoResult
26113  */
26114
26115 /**
26116  * @param {string} filePath
26117  * @param {FileInfoOptions} opts
26118  * @returns {Promise<FileInfoResult>}
26119  *
26120  * Please note that prettier.getFileInfo() expects opts.plugins to be an array of paths,
26121  * not an object. A transformation from this array to an object is automatically done
26122  * internally by the method wrapper. See withPlugins() in index.js.
26123  */
26124
26125 async function getFileInfo$1(filePath, opts) {
26126   if (typeof filePath !== "string") {
26127     throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
26128   }
26129
26130   const ignorer = await createIgnorer(opts.ignorePath, opts.withNodeModules);
26131   return _getFileInfo({
26132     ignorer,
26133     filePath,
26134     plugins: opts.plugins,
26135     resolveConfig: opts.resolveConfig,
26136     ignorePath: opts.ignorePath,
26137     sync: false
26138   });
26139 }
26140 /**
26141  * @param {string} filePath
26142  * @param {FileInfoOptions} opts
26143  * @returns {FileInfoResult}
26144  */
26145
26146
26147 getFileInfo$1.sync = function (filePath, opts) {
26148   if (typeof filePath !== "string") {
26149     throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
26150   }
26151
26152   const ignorer = createIgnorer.sync(opts.ignorePath, opts.withNodeModules);
26153   return _getFileInfo({
26154     ignorer,
26155     filePath,
26156     plugins: opts.plugins,
26157     resolveConfig: opts.resolveConfig,
26158     ignorePath: opts.ignorePath,
26159     sync: true
26160   });
26161 };
26162
26163 function getFileParser(resolvedConfig, filePath, plugins) {
26164   if (resolvedConfig && resolvedConfig.parser) {
26165     return resolvedConfig.parser;
26166   }
26167
26168   const inferredParser = options$c.inferParser(filePath, plugins);
26169
26170   if (inferredParser) {
26171     return inferredParser;
26172   }
26173
26174   return null;
26175 }
26176
26177 function _getFileInfo({
26178   ignorer,
26179   filePath,
26180   plugins,
26181   resolveConfig = false,
26182   ignorePath,
26183   sync = false
26184 }) {
26185   const normalizedFilePath = normalizeFilePath(filePath, ignorePath);
26186   const fileInfo = {
26187     ignored: ignorer.ignores(normalizedFilePath),
26188     inferredParser: null
26189   };
26190
26191   if (fileInfo.ignored) {
26192     return fileInfo;
26193   }
26194
26195   let resolvedConfig;
26196
26197   if (resolveConfig) {
26198     if (sync) {
26199       resolvedConfig = config$1.resolveConfig.sync(filePath);
26200     } else {
26201       return config$1.resolveConfig(filePath).then(resolvedConfig => {
26202         fileInfo.inferredParser = getFileParser(resolvedConfig, filePath, plugins);
26203         return fileInfo;
26204       });
26205     }
26206   }
26207
26208   fileInfo.inferredParser = getFileParser(resolvedConfig, filePath, plugins);
26209   return fileInfo;
26210 }
26211
26212 function normalizeFilePath(filePath, ignorePath) {
26213   return ignorePath ? path$d.relative(path$d.dirname(ignorePath), filePath) : filePath;
26214 }
26215
26216 var getFileInfo_1 = getFileInfo$1;
26217
26218 const {
26219   getMaxContinuousCount: getMaxContinuousCount$2,
26220   getStringWidth: getStringWidth$4,
26221   getAlignmentSize,
26222   getIndentSize: getIndentSize$1,
26223   skip,
26224   skipWhitespace: skipWhitespace$1,
26225   skipSpaces,
26226   skipNewline,
26227   skipToLineEnd,
26228   skipEverythingButNewLine: skipEverythingButNewLine$1,
26229   skipInlineComment,
26230   skipTrailingComment,
26231   hasNewline: hasNewline$8,
26232   hasNewlineInRange: hasNewlineInRange$4,
26233   hasSpaces,
26234   isNextLineEmpty: isNextLineEmpty$d,
26235   isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$2,
26236   isPreviousLineEmpty: isPreviousLineEmpty$1,
26237   getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$3,
26238   makeString,
26239   addLeadingComment: addLeadingComment$1,
26240   addDanglingComment: addDanglingComment$1,
26241   addTrailingComment: addTrailingComment$1
26242 } = util$8;
26243 var utilShared = {
26244   getMaxContinuousCount: getMaxContinuousCount$2,
26245   getStringWidth: getStringWidth$4,
26246   getAlignmentSize,
26247   getIndentSize: getIndentSize$1,
26248   skip,
26249   skipWhitespace: skipWhitespace$1,
26250   skipSpaces,
26251   skipNewline,
26252   skipToLineEnd,
26253   skipEverythingButNewLine: skipEverythingButNewLine$1,
26254   skipInlineComment,
26255   skipTrailingComment,
26256   hasNewline: hasNewline$8,
26257   hasNewlineInRange: hasNewlineInRange$4,
26258   hasSpaces,
26259   isNextLineEmpty: isNextLineEmpty$d,
26260   isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$2,
26261   isPreviousLineEmpty: isPreviousLineEmpty$1,
26262   getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$3,
26263   makeString,
26264   addLeadingComment: addLeadingComment$1,
26265   addDanglingComment: addDanglingComment$1,
26266   addTrailingComment: addTrailingComment$1
26267 };
26268
26269 /**
26270  * Removes all key-value entries from the list cache.
26271  *
26272  * @private
26273  * @name clear
26274  * @memberOf ListCache
26275  */
26276
26277 function listCacheClear$1() {
26278   this.__data__ = [];
26279   this.size = 0;
26280 }
26281
26282 var _listCacheClear = listCacheClear$1;
26283
26284 /**
26285  * Performs a
26286  * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
26287  * comparison between two values to determine if they are equivalent.
26288  *
26289  * @static
26290  * @memberOf _
26291  * @since 4.0.0
26292  * @category Lang
26293  * @param {*} value The value to compare.
26294  * @param {*} other The other value to compare.
26295  * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
26296  * @example
26297  *
26298  * var object = { 'a': 1 };
26299  * var other = { 'a': 1 };
26300  *
26301  * _.eq(object, object);
26302  * // => true
26303  *
26304  * _.eq(object, other);
26305  * // => false
26306  *
26307  * _.eq('a', 'a');
26308  * // => true
26309  *
26310  * _.eq('a', Object('a'));
26311  * // => false
26312  *
26313  * _.eq(NaN, NaN);
26314  * // => true
26315  */
26316
26317 function eq$2(value, other) {
26318   return value === other || value !== value && other !== other;
26319 }
26320
26321 var eq_1 = eq$2;
26322
26323 var eq$1 = eq_1;
26324 /**
26325  * Gets the index at which the `key` is found in `array` of key-value pairs.
26326  *
26327  * @private
26328  * @param {Array} array The array to inspect.
26329  * @param {*} key The key to search for.
26330  * @returns {number} Returns the index of the matched value, else `-1`.
26331  */
26332
26333 function assocIndexOf$4(array, key) {
26334   var length = array.length;
26335
26336   while (length--) {
26337     if (eq$1(array[length][0], key)) {
26338       return length;
26339     }
26340   }
26341
26342   return -1;
26343 }
26344
26345 var _assocIndexOf = assocIndexOf$4;
26346
26347 var assocIndexOf$3 = _assocIndexOf;
26348 /** Used for built-in method references. */
26349
26350 var arrayProto = Array.prototype;
26351 /** Built-in value references. */
26352
26353 var splice = arrayProto.splice;
26354 /**
26355  * Removes `key` and its value from the list cache.
26356  *
26357  * @private
26358  * @name delete
26359  * @memberOf ListCache
26360  * @param {string} key The key of the value to remove.
26361  * @returns {boolean} Returns `true` if the entry was removed, else `false`.
26362  */
26363
26364 function listCacheDelete$1(key) {
26365   var data = this.__data__,
26366       index = assocIndexOf$3(data, key);
26367
26368   if (index < 0) {
26369     return false;
26370   }
26371
26372   var lastIndex = data.length - 1;
26373
26374   if (index == lastIndex) {
26375     data.pop();
26376   } else {
26377     splice.call(data, index, 1);
26378   }
26379
26380   --this.size;
26381   return true;
26382 }
26383
26384 var _listCacheDelete = listCacheDelete$1;
26385
26386 var assocIndexOf$2 = _assocIndexOf;
26387 /**
26388  * Gets the list cache value for `key`.
26389  *
26390  * @private
26391  * @name get
26392  * @memberOf ListCache
26393  * @param {string} key The key of the value to get.
26394  * @returns {*} Returns the entry value.
26395  */
26396
26397 function listCacheGet$1(key) {
26398   var data = this.__data__,
26399       index = assocIndexOf$2(data, key);
26400   return index < 0 ? undefined : data[index][1];
26401 }
26402
26403 var _listCacheGet = listCacheGet$1;
26404
26405 var assocIndexOf$1 = _assocIndexOf;
26406 /**
26407  * Checks if a list cache value for `key` exists.
26408  *
26409  * @private
26410  * @name has
26411  * @memberOf ListCache
26412  * @param {string} key The key of the entry to check.
26413  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
26414  */
26415
26416 function listCacheHas$1(key) {
26417   return assocIndexOf$1(this.__data__, key) > -1;
26418 }
26419
26420 var _listCacheHas = listCacheHas$1;
26421
26422 var assocIndexOf = _assocIndexOf;
26423 /**
26424  * Sets the list cache `key` to `value`.
26425  *
26426  * @private
26427  * @name set
26428  * @memberOf ListCache
26429  * @param {string} key The key of the value to set.
26430  * @param {*} value The value to set.
26431  * @returns {Object} Returns the list cache instance.
26432  */
26433
26434 function listCacheSet$1(key, value) {
26435   var data = this.__data__,
26436       index = assocIndexOf(data, key);
26437
26438   if (index < 0) {
26439     ++this.size;
26440     data.push([key, value]);
26441   } else {
26442     data[index][1] = value;
26443   }
26444
26445   return this;
26446 }
26447
26448 var _listCacheSet = listCacheSet$1;
26449
26450 var listCacheClear = _listCacheClear,
26451     listCacheDelete = _listCacheDelete,
26452     listCacheGet = _listCacheGet,
26453     listCacheHas = _listCacheHas,
26454     listCacheSet = _listCacheSet;
26455 /**
26456  * Creates an list cache object.
26457  *
26458  * @private
26459  * @constructor
26460  * @param {Array} [entries] The key-value pairs to cache.
26461  */
26462
26463 function ListCache$4(entries) {
26464   var index = -1,
26465       length = entries == null ? 0 : entries.length;
26466   this.clear();
26467
26468   while (++index < length) {
26469     var entry = entries[index];
26470     this.set(entry[0], entry[1]);
26471   }
26472 } // Add methods to `ListCache`.
26473
26474
26475 ListCache$4.prototype.clear = listCacheClear;
26476 ListCache$4.prototype['delete'] = listCacheDelete;
26477 ListCache$4.prototype.get = listCacheGet;
26478 ListCache$4.prototype.has = listCacheHas;
26479 ListCache$4.prototype.set = listCacheSet;
26480 var _ListCache = ListCache$4;
26481
26482 var ListCache$3 = _ListCache;
26483 /**
26484  * Removes all key-value entries from the stack.
26485  *
26486  * @private
26487  * @name clear
26488  * @memberOf Stack
26489  */
26490
26491 function stackClear$1() {
26492   this.__data__ = new ListCache$3();
26493   this.size = 0;
26494 }
26495
26496 var _stackClear = stackClear$1;
26497
26498 /**
26499  * Removes `key` and its value from the stack.
26500  *
26501  * @private
26502  * @name delete
26503  * @memberOf Stack
26504  * @param {string} key The key of the value to remove.
26505  * @returns {boolean} Returns `true` if the entry was removed, else `false`.
26506  */
26507
26508 function stackDelete$1(key) {
26509   var data = this.__data__,
26510       result = data['delete'](key);
26511   this.size = data.size;
26512   return result;
26513 }
26514
26515 var _stackDelete = stackDelete$1;
26516
26517 /**
26518  * Gets the stack value for `key`.
26519  *
26520  * @private
26521  * @name get
26522  * @memberOf Stack
26523  * @param {string} key The key of the value to get.
26524  * @returns {*} Returns the entry value.
26525  */
26526
26527 function stackGet$1(key) {
26528   return this.__data__.get(key);
26529 }
26530
26531 var _stackGet = stackGet$1;
26532
26533 /**
26534  * Checks if a stack value for `key` exists.
26535  *
26536  * @private
26537  * @name has
26538  * @memberOf Stack
26539  * @param {string} key The key of the entry to check.
26540  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
26541  */
26542
26543 function stackHas$1(key) {
26544   return this.__data__.has(key);
26545 }
26546
26547 var _stackHas = stackHas$1;
26548
26549 /** Detect free variable `global` from Node.js. */
26550 var freeGlobal$1 = typeof global == 'object' && global && global.Object === Object && global;
26551 var _freeGlobal = freeGlobal$1;
26552
26553 var freeGlobal = _freeGlobal;
26554 /** Detect free variable `self`. */
26555
26556 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
26557 /** Used as a reference to the global object. */
26558
26559 var root$8 = freeGlobal || freeSelf || Function('return this')();
26560 var _root = root$8;
26561
26562 var root$7 = _root;
26563 /** Built-in value references. */
26564
26565 var Symbol$5 = root$7.Symbol;
26566 var _Symbol = Symbol$5;
26567
26568 var Symbol$4 = _Symbol;
26569 /** Used for built-in method references. */
26570
26571 var objectProto$b = Object.prototype;
26572 /** Used to check objects for own properties. */
26573
26574 var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
26575 /**
26576  * Used to resolve the
26577  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
26578  * of values.
26579  */
26580
26581 var nativeObjectToString$1 = objectProto$b.toString;
26582 /** Built-in value references. */
26583
26584 var symToStringTag$1 = Symbol$4 ? Symbol$4.toStringTag : undefined;
26585 /**
26586  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
26587  *
26588  * @private
26589  * @param {*} value The value to query.
26590  * @returns {string} Returns the raw `toStringTag`.
26591  */
26592
26593 function getRawTag$1(value) {
26594   var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
26595       tag = value[symToStringTag$1];
26596
26597   try {
26598     value[symToStringTag$1] = undefined;
26599     var unmasked = true;
26600   } catch (e) {}
26601
26602   var result = nativeObjectToString$1.call(value);
26603
26604   if (unmasked) {
26605     if (isOwn) {
26606       value[symToStringTag$1] = tag;
26607     } else {
26608       delete value[symToStringTag$1];
26609     }
26610   }
26611
26612   return result;
26613 }
26614
26615 var _getRawTag = getRawTag$1;
26616
26617 /** Used for built-in method references. */
26618 var objectProto$a = Object.prototype;
26619 /**
26620  * Used to resolve the
26621  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
26622  * of values.
26623  */
26624
26625 var nativeObjectToString = objectProto$a.toString;
26626 /**
26627  * Converts `value` to a string using `Object.prototype.toString`.
26628  *
26629  * @private
26630  * @param {*} value The value to convert.
26631  * @returns {string} Returns the converted string.
26632  */
26633
26634 function objectToString$1(value) {
26635   return nativeObjectToString.call(value);
26636 }
26637
26638 var _objectToString = objectToString$1;
26639
26640 var Symbol$3 = _Symbol,
26641     getRawTag = _getRawTag,
26642     objectToString = _objectToString;
26643 /** `Object#toString` result references. */
26644
26645 var nullTag = '[object Null]',
26646     undefinedTag = '[object Undefined]';
26647 /** Built-in value references. */
26648
26649 var symToStringTag = Symbol$3 ? Symbol$3.toStringTag : undefined;
26650 /**
26651  * The base implementation of `getTag` without fallbacks for buggy environments.
26652  *
26653  * @private
26654  * @param {*} value The value to query.
26655  * @returns {string} Returns the `toStringTag`.
26656  */
26657
26658 function baseGetTag$5(value) {
26659   if (value == null) {
26660     return value === undefined ? undefinedTag : nullTag;
26661   }
26662
26663   return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
26664 }
26665
26666 var _baseGetTag = baseGetTag$5;
26667
26668 /**
26669  * Checks if `value` is the
26670  * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
26671  * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
26672  *
26673  * @static
26674  * @memberOf _
26675  * @since 0.1.0
26676  * @category Lang
26677  * @param {*} value The value to check.
26678  * @returns {boolean} Returns `true` if `value` is an object, else `false`.
26679  * @example
26680  *
26681  * _.isObject({});
26682  * // => true
26683  *
26684  * _.isObject([1, 2, 3]);
26685  * // => true
26686  *
26687  * _.isObject(_.noop);
26688  * // => true
26689  *
26690  * _.isObject(null);
26691  * // => false
26692  */
26693
26694 function isObject$5(value) {
26695   var type = typeof value;
26696   return value != null && (type == 'object' || type == 'function');
26697 }
26698
26699 var isObject_1 = isObject$5;
26700
26701 var baseGetTag$4 = _baseGetTag,
26702     isObject$4 = isObject_1;
26703 /** `Object#toString` result references. */
26704
26705 var asyncTag = '[object AsyncFunction]',
26706     funcTag$1 = '[object Function]',
26707     genTag = '[object GeneratorFunction]',
26708     proxyTag = '[object Proxy]';
26709 /**
26710  * Checks if `value` is classified as a `Function` object.
26711  *
26712  * @static
26713  * @memberOf _
26714  * @since 0.1.0
26715  * @category Lang
26716  * @param {*} value The value to check.
26717  * @returns {boolean} Returns `true` if `value` is a function, else `false`.
26718  * @example
26719  *
26720  * _.isFunction(_);
26721  * // => true
26722  *
26723  * _.isFunction(/abc/);
26724  * // => false
26725  */
26726
26727 function isFunction$2(value) {
26728   if (!isObject$4(value)) {
26729     return false;
26730   } // The use of `Object#toString` avoids issues with the `typeof` operator
26731   // in Safari 9 which returns 'object' for typed arrays and other constructors.
26732
26733
26734   var tag = baseGetTag$4(value);
26735   return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
26736 }
26737
26738 var isFunction_1 = isFunction$2;
26739
26740 var root$6 = _root;
26741 /** Used to detect overreaching core-js shims. */
26742
26743 var coreJsData$1 = root$6['__core-js_shared__'];
26744 var _coreJsData = coreJsData$1;
26745
26746 var coreJsData = _coreJsData;
26747 /** Used to detect methods masquerading as native. */
26748
26749 var maskSrcKey = function () {
26750   var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
26751   return uid ? 'Symbol(src)_1.' + uid : '';
26752 }();
26753 /**
26754  * Checks if `func` has its source masked.
26755  *
26756  * @private
26757  * @param {Function} func The function to check.
26758  * @returns {boolean} Returns `true` if `func` is masked, else `false`.
26759  */
26760
26761
26762 function isMasked$1(func) {
26763   return !!maskSrcKey && maskSrcKey in func;
26764 }
26765
26766 var _isMasked = isMasked$1;
26767
26768 /** Used for built-in method references. */
26769 var funcProto$1 = Function.prototype;
26770 /** Used to resolve the decompiled source of functions. */
26771
26772 var funcToString$1 = funcProto$1.toString;
26773 /**
26774  * Converts `func` to its source code.
26775  *
26776  * @private
26777  * @param {Function} func The function to convert.
26778  * @returns {string} Returns the source code.
26779  */
26780
26781 function toSource$2(func) {
26782   if (func != null) {
26783     try {
26784       return funcToString$1.call(func);
26785     } catch (e) {}
26786
26787     try {
26788       return func + '';
26789     } catch (e) {}
26790   }
26791
26792   return '';
26793 }
26794
26795 var _toSource = toSource$2;
26796
26797 var isFunction$1 = isFunction_1,
26798     isMasked = _isMasked,
26799     isObject$3 = isObject_1,
26800     toSource$1 = _toSource;
26801 /**
26802  * Used to match `RegExp`
26803  * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
26804  */
26805
26806 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
26807 /** Used to detect host constructors (Safari). */
26808
26809 var reIsHostCtor = /^\[object .+?Constructor\]$/;
26810 /** Used for built-in method references. */
26811
26812 var funcProto = Function.prototype,
26813     objectProto$9 = Object.prototype;
26814 /** Used to resolve the decompiled source of functions. */
26815
26816 var funcToString = funcProto.toString;
26817 /** Used to check objects for own properties. */
26818
26819 var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
26820 /** Used to detect if a method is native. */
26821
26822 var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
26823 /**
26824  * The base implementation of `_.isNative` without bad shim checks.
26825  *
26826  * @private
26827  * @param {*} value The value to check.
26828  * @returns {boolean} Returns `true` if `value` is a native function,
26829  *  else `false`.
26830  */
26831
26832 function baseIsNative$1(value) {
26833   if (!isObject$3(value) || isMasked(value)) {
26834     return false;
26835   }
26836
26837   var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
26838   return pattern.test(toSource$1(value));
26839 }
26840
26841 var _baseIsNative = baseIsNative$1;
26842
26843 /**
26844  * Gets the value at `key` of `object`.
26845  *
26846  * @private
26847  * @param {Object} [object] The object to query.
26848  * @param {string} key The key of the property to get.
26849  * @returns {*} Returns the property value.
26850  */
26851
26852 function getValue$1(object, key) {
26853   return object == null ? undefined : object[key];
26854 }
26855
26856 var _getValue = getValue$1;
26857
26858 var baseIsNative = _baseIsNative,
26859     getValue = _getValue;
26860 /**
26861  * Gets the native function at `key` of `object`.
26862  *
26863  * @private
26864  * @param {Object} object The object to query.
26865  * @param {string} key The key of the method to get.
26866  * @returns {*} Returns the function if it's native, else `undefined`.
26867  */
26868
26869 function getNative$6(object, key) {
26870   var value = getValue(object, key);
26871   return baseIsNative(value) ? value : undefined;
26872 }
26873
26874 var _getNative = getNative$6;
26875
26876 var getNative$5 = _getNative,
26877     root$5 = _root;
26878 /* Built-in method references that are verified to be native. */
26879
26880 var Map$4 = getNative$5(root$5, 'Map');
26881 var _Map = Map$4;
26882
26883 var getNative$4 = _getNative;
26884 /* Built-in method references that are verified to be native. */
26885
26886 var nativeCreate$4 = getNative$4(Object, 'create');
26887 var _nativeCreate = nativeCreate$4;
26888
26889 var nativeCreate$3 = _nativeCreate;
26890 /**
26891  * Removes all key-value entries from the hash.
26892  *
26893  * @private
26894  * @name clear
26895  * @memberOf Hash
26896  */
26897
26898 function hashClear$1() {
26899   this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
26900   this.size = 0;
26901 }
26902
26903 var _hashClear = hashClear$1;
26904
26905 /**
26906  * Removes `key` and its value from the hash.
26907  *
26908  * @private
26909  * @name delete
26910  * @memberOf Hash
26911  * @param {Object} hash The hash to modify.
26912  * @param {string} key The key of the value to remove.
26913  * @returns {boolean} Returns `true` if the entry was removed, else `false`.
26914  */
26915
26916 function hashDelete$1(key) {
26917   var result = this.has(key) && delete this.__data__[key];
26918   this.size -= result ? 1 : 0;
26919   return result;
26920 }
26921
26922 var _hashDelete = hashDelete$1;
26923
26924 var nativeCreate$2 = _nativeCreate;
26925 /** Used to stand-in for `undefined` hash values. */
26926
26927 var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
26928 /** Used for built-in method references. */
26929
26930 var objectProto$8 = Object.prototype;
26931 /** Used to check objects for own properties. */
26932
26933 var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
26934 /**
26935  * Gets the hash value for `key`.
26936  *
26937  * @private
26938  * @name get
26939  * @memberOf Hash
26940  * @param {string} key The key of the value to get.
26941  * @returns {*} Returns the entry value.
26942  */
26943
26944 function hashGet$1(key) {
26945   var data = this.__data__;
26946
26947   if (nativeCreate$2) {
26948     var result = data[key];
26949     return result === HASH_UNDEFINED$2 ? undefined : result;
26950   }
26951
26952   return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
26953 }
26954
26955 var _hashGet = hashGet$1;
26956
26957 var nativeCreate$1 = _nativeCreate;
26958 /** Used for built-in method references. */
26959
26960 var objectProto$7 = Object.prototype;
26961 /** Used to check objects for own properties. */
26962
26963 var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
26964 /**
26965  * Checks if a hash value for `key` exists.
26966  *
26967  * @private
26968  * @name has
26969  * @memberOf Hash
26970  * @param {string} key The key of the entry to check.
26971  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
26972  */
26973
26974 function hashHas$1(key) {
26975   var data = this.__data__;
26976   return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$5.call(data, key);
26977 }
26978
26979 var _hashHas = hashHas$1;
26980
26981 var nativeCreate = _nativeCreate;
26982 /** Used to stand-in for `undefined` hash values. */
26983
26984 var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
26985 /**
26986  * Sets the hash `key` to `value`.
26987  *
26988  * @private
26989  * @name set
26990  * @memberOf Hash
26991  * @param {string} key The key of the value to set.
26992  * @param {*} value The value to set.
26993  * @returns {Object} Returns the hash instance.
26994  */
26995
26996 function hashSet$1(key, value) {
26997   var data = this.__data__;
26998   this.size += this.has(key) ? 0 : 1;
26999   data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value;
27000   return this;
27001 }
27002
27003 var _hashSet = hashSet$1;
27004
27005 var hashClear = _hashClear,
27006     hashDelete = _hashDelete,
27007     hashGet = _hashGet,
27008     hashHas = _hashHas,
27009     hashSet = _hashSet;
27010 /**
27011  * Creates a hash object.
27012  *
27013  * @private
27014  * @constructor
27015  * @param {Array} [entries] The key-value pairs to cache.
27016  */
27017
27018 function Hash$1(entries) {
27019   var index = -1,
27020       length = entries == null ? 0 : entries.length;
27021   this.clear();
27022
27023   while (++index < length) {
27024     var entry = entries[index];
27025     this.set(entry[0], entry[1]);
27026   }
27027 } // Add methods to `Hash`.
27028
27029
27030 Hash$1.prototype.clear = hashClear;
27031 Hash$1.prototype['delete'] = hashDelete;
27032 Hash$1.prototype.get = hashGet;
27033 Hash$1.prototype.has = hashHas;
27034 Hash$1.prototype.set = hashSet;
27035 var _Hash = Hash$1;
27036
27037 var Hash = _Hash,
27038     ListCache$2 = _ListCache,
27039     Map$3 = _Map;
27040 /**
27041  * Removes all key-value entries from the map.
27042  *
27043  * @private
27044  * @name clear
27045  * @memberOf MapCache
27046  */
27047
27048 function mapCacheClear$1() {
27049   this.size = 0;
27050   this.__data__ = {
27051     'hash': new Hash(),
27052     'map': new (Map$3 || ListCache$2)(),
27053     'string': new Hash()
27054   };
27055 }
27056
27057 var _mapCacheClear = mapCacheClear$1;
27058
27059 /**
27060  * Checks if `value` is suitable for use as unique object key.
27061  *
27062  * @private
27063  * @param {*} value The value to check.
27064  * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
27065  */
27066
27067 function isKeyable$1(value) {
27068   var type = typeof value;
27069   return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
27070 }
27071
27072 var _isKeyable = isKeyable$1;
27073
27074 var isKeyable = _isKeyable;
27075 /**
27076  * Gets the data for `map`.
27077  *
27078  * @private
27079  * @param {Object} map The map to query.
27080  * @param {string} key The reference key.
27081  * @returns {*} Returns the map data.
27082  */
27083
27084 function getMapData$4(map, key) {
27085   var data = map.__data__;
27086   return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
27087 }
27088
27089 var _getMapData = getMapData$4;
27090
27091 var getMapData$3 = _getMapData;
27092 /**
27093  * Removes `key` and its value from the map.
27094  *
27095  * @private
27096  * @name delete
27097  * @memberOf MapCache
27098  * @param {string} key The key of the value to remove.
27099  * @returns {boolean} Returns `true` if the entry was removed, else `false`.
27100  */
27101
27102 function mapCacheDelete$1(key) {
27103   var result = getMapData$3(this, key)['delete'](key);
27104   this.size -= result ? 1 : 0;
27105   return result;
27106 }
27107
27108 var _mapCacheDelete = mapCacheDelete$1;
27109
27110 var getMapData$2 = _getMapData;
27111 /**
27112  * Gets the map value for `key`.
27113  *
27114  * @private
27115  * @name get
27116  * @memberOf MapCache
27117  * @param {string} key The key of the value to get.
27118  * @returns {*} Returns the entry value.
27119  */
27120
27121 function mapCacheGet$1(key) {
27122   return getMapData$2(this, key).get(key);
27123 }
27124
27125 var _mapCacheGet = mapCacheGet$1;
27126
27127 var getMapData$1 = _getMapData;
27128 /**
27129  * Checks if a map value for `key` exists.
27130  *
27131  * @private
27132  * @name has
27133  * @memberOf MapCache
27134  * @param {string} key The key of the entry to check.
27135  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
27136  */
27137
27138 function mapCacheHas$1(key) {
27139   return getMapData$1(this, key).has(key);
27140 }
27141
27142 var _mapCacheHas = mapCacheHas$1;
27143
27144 var getMapData = _getMapData;
27145 /**
27146  * Sets the map `key` to `value`.
27147  *
27148  * @private
27149  * @name set
27150  * @memberOf MapCache
27151  * @param {string} key The key of the value to set.
27152  * @param {*} value The value to set.
27153  * @returns {Object} Returns the map cache instance.
27154  */
27155
27156 function mapCacheSet$1(key, value) {
27157   var data = getMapData(this, key),
27158       size = data.size;
27159   data.set(key, value);
27160   this.size += data.size == size ? 0 : 1;
27161   return this;
27162 }
27163
27164 var _mapCacheSet = mapCacheSet$1;
27165
27166 var mapCacheClear = _mapCacheClear,
27167     mapCacheDelete = _mapCacheDelete,
27168     mapCacheGet = _mapCacheGet,
27169     mapCacheHas = _mapCacheHas,
27170     mapCacheSet = _mapCacheSet;
27171 /**
27172  * Creates a map cache object to store key-value pairs.
27173  *
27174  * @private
27175  * @constructor
27176  * @param {Array} [entries] The key-value pairs to cache.
27177  */
27178
27179 function MapCache$3(entries) {
27180   var index = -1,
27181       length = entries == null ? 0 : entries.length;
27182   this.clear();
27183
27184   while (++index < length) {
27185     var entry = entries[index];
27186     this.set(entry[0], entry[1]);
27187   }
27188 } // Add methods to `MapCache`.
27189
27190
27191 MapCache$3.prototype.clear = mapCacheClear;
27192 MapCache$3.prototype['delete'] = mapCacheDelete;
27193 MapCache$3.prototype.get = mapCacheGet;
27194 MapCache$3.prototype.has = mapCacheHas;
27195 MapCache$3.prototype.set = mapCacheSet;
27196 var _MapCache = MapCache$3;
27197
27198 var ListCache$1 = _ListCache,
27199     Map$2 = _Map,
27200     MapCache$2 = _MapCache;
27201 /** Used as the size to enable large array optimizations. */
27202
27203 var LARGE_ARRAY_SIZE$1 = 200;
27204 /**
27205  * Sets the stack `key` to `value`.
27206  *
27207  * @private
27208  * @name set
27209  * @memberOf Stack
27210  * @param {string} key The key of the value to set.
27211  * @param {*} value The value to set.
27212  * @returns {Object} Returns the stack cache instance.
27213  */
27214
27215 function stackSet$1(key, value) {
27216   var data = this.__data__;
27217
27218   if (data instanceof ListCache$1) {
27219     var pairs = data.__data__;
27220
27221     if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
27222       pairs.push([key, value]);
27223       this.size = ++data.size;
27224       return this;
27225     }
27226
27227     data = this.__data__ = new MapCache$2(pairs);
27228   }
27229
27230   data.set(key, value);
27231   this.size = data.size;
27232   return this;
27233 }
27234
27235 var _stackSet = stackSet$1;
27236
27237 var ListCache = _ListCache,
27238     stackClear = _stackClear,
27239     stackDelete = _stackDelete,
27240     stackGet = _stackGet,
27241     stackHas = _stackHas,
27242     stackSet = _stackSet;
27243 /**
27244  * Creates a stack cache object to store key-value pairs.
27245  *
27246  * @private
27247  * @constructor
27248  * @param {Array} [entries] The key-value pairs to cache.
27249  */
27250
27251 function Stack$2(entries) {
27252   var data = this.__data__ = new ListCache(entries);
27253   this.size = data.size;
27254 } // Add methods to `Stack`.
27255
27256
27257 Stack$2.prototype.clear = stackClear;
27258 Stack$2.prototype['delete'] = stackDelete;
27259 Stack$2.prototype.get = stackGet;
27260 Stack$2.prototype.has = stackHas;
27261 Stack$2.prototype.set = stackSet;
27262 var _Stack = Stack$2;
27263
27264 /** Used to stand-in for `undefined` hash values. */
27265 var HASH_UNDEFINED = '__lodash_hash_undefined__';
27266 /**
27267  * Adds `value` to the array cache.
27268  *
27269  * @private
27270  * @name add
27271  * @memberOf SetCache
27272  * @alias push
27273  * @param {*} value The value to cache.
27274  * @returns {Object} Returns the cache instance.
27275  */
27276
27277 function setCacheAdd$1(value) {
27278   this.__data__.set(value, HASH_UNDEFINED);
27279
27280   return this;
27281 }
27282
27283 var _setCacheAdd = setCacheAdd$1;
27284
27285 /**
27286  * Checks if `value` is in the array cache.
27287  *
27288  * @private
27289  * @name has
27290  * @memberOf SetCache
27291  * @param {*} value The value to search for.
27292  * @returns {number} Returns `true` if `value` is found, else `false`.
27293  */
27294
27295 function setCacheHas$1(value) {
27296   return this.__data__.has(value);
27297 }
27298
27299 var _setCacheHas = setCacheHas$1;
27300
27301 var MapCache$1 = _MapCache,
27302     setCacheAdd = _setCacheAdd,
27303     setCacheHas = _setCacheHas;
27304 /**
27305  *
27306  * Creates an array cache object to store unique values.
27307  *
27308  * @private
27309  * @constructor
27310  * @param {Array} [values] The values to cache.
27311  */
27312
27313 function SetCache$2(values) {
27314   var index = -1,
27315       length = values == null ? 0 : values.length;
27316   this.__data__ = new MapCache$1();
27317
27318   while (++index < length) {
27319     this.add(values[index]);
27320   }
27321 } // Add methods to `SetCache`.
27322
27323
27324 SetCache$2.prototype.add = SetCache$2.prototype.push = setCacheAdd;
27325 SetCache$2.prototype.has = setCacheHas;
27326 var _SetCache = SetCache$2;
27327
27328 /**
27329  * A specialized version of `_.some` for arrays without support for iteratee
27330  * shorthands.
27331  *
27332  * @private
27333  * @param {Array} [array] The array to iterate over.
27334  * @param {Function} predicate The function invoked per iteration.
27335  * @returns {boolean} Returns `true` if any element passes the predicate check,
27336  *  else `false`.
27337  */
27338
27339 function arraySome$1(array, predicate) {
27340   var index = -1,
27341       length = array == null ? 0 : array.length;
27342
27343   while (++index < length) {
27344     if (predicate(array[index], index, array)) {
27345       return true;
27346     }
27347   }
27348
27349   return false;
27350 }
27351
27352 var _arraySome = arraySome$1;
27353
27354 /**
27355  * Checks if a `cache` value for `key` exists.
27356  *
27357  * @private
27358  * @param {Object} cache The cache to query.
27359  * @param {string} key The key of the entry to check.
27360  * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
27361  */
27362
27363 function cacheHas$2(cache, key) {
27364   return cache.has(key);
27365 }
27366
27367 var _cacheHas = cacheHas$2;
27368
27369 var SetCache$1 = _SetCache,
27370     arraySome = _arraySome,
27371     cacheHas$1 = _cacheHas;
27372 /** Used to compose bitmasks for value comparisons. */
27373
27374 var COMPARE_PARTIAL_FLAG$5 = 1,
27375     COMPARE_UNORDERED_FLAG$3 = 2;
27376 /**
27377  * A specialized version of `baseIsEqualDeep` for arrays with support for
27378  * partial deep comparisons.
27379  *
27380  * @private
27381  * @param {Array} array The array to compare.
27382  * @param {Array} other The other array to compare.
27383  * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
27384  * @param {Function} customizer The function to customize comparisons.
27385  * @param {Function} equalFunc The function to determine equivalents of values.
27386  * @param {Object} stack Tracks traversed `array` and `other` objects.
27387  * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
27388  */
27389
27390 function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
27391   var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
27392       arrLength = array.length,
27393       othLength = other.length;
27394
27395   if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
27396     return false;
27397   } // Check that cyclic values are equal.
27398
27399
27400   var arrStacked = stack.get(array);
27401   var othStacked = stack.get(other);
27402
27403   if (arrStacked && othStacked) {
27404     return arrStacked == other && othStacked == array;
27405   }
27406
27407   var index = -1,
27408       result = true,
27409       seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache$1() : undefined;
27410   stack.set(array, other);
27411   stack.set(other, array); // Ignore non-index properties.
27412
27413   while (++index < arrLength) {
27414     var arrValue = array[index],
27415         othValue = other[index];
27416
27417     if (customizer) {
27418       var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
27419     }
27420
27421     if (compared !== undefined) {
27422       if (compared) {
27423         continue;
27424       }
27425
27426       result = false;
27427       break;
27428     } // Recursively compare arrays (susceptible to call stack limits).
27429
27430
27431     if (seen) {
27432       if (!arraySome(other, function (othValue, othIndex) {
27433         if (!cacheHas$1(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
27434           return seen.push(othIndex);
27435         }
27436       })) {
27437         result = false;
27438         break;
27439       }
27440     } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
27441       result = false;
27442       break;
27443     }
27444   }
27445
27446   stack['delete'](array);
27447   stack['delete'](other);
27448   return result;
27449 }
27450
27451 var _equalArrays = equalArrays$2;
27452
27453 var root$4 = _root;
27454 /** Built-in value references. */
27455
27456 var Uint8Array$1 = root$4.Uint8Array;
27457 var _Uint8Array = Uint8Array$1;
27458
27459 /**
27460  * Converts `map` to its key-value pairs.
27461  *
27462  * @private
27463  * @param {Object} map The map to convert.
27464  * @returns {Array} Returns the key-value pairs.
27465  */
27466
27467 function mapToArray$1(map) {
27468   var index = -1,
27469       result = Array(map.size);
27470   map.forEach(function (value, key) {
27471     result[++index] = [key, value];
27472   });
27473   return result;
27474 }
27475
27476 var _mapToArray = mapToArray$1;
27477
27478 /**
27479  * Converts `set` to an array of its values.
27480  *
27481  * @private
27482  * @param {Object} set The set to convert.
27483  * @returns {Array} Returns the values.
27484  */
27485
27486 function setToArray$3(set) {
27487   var index = -1,
27488       result = Array(set.size);
27489   set.forEach(function (value) {
27490     result[++index] = value;
27491   });
27492   return result;
27493 }
27494
27495 var _setToArray = setToArray$3;
27496
27497 var Symbol$2 = _Symbol,
27498     Uint8Array = _Uint8Array,
27499     eq = eq_1,
27500     equalArrays$1 = _equalArrays,
27501     mapToArray = _mapToArray,
27502     setToArray$2 = _setToArray;
27503 /** Used to compose bitmasks for value comparisons. */
27504
27505 var COMPARE_PARTIAL_FLAG$4 = 1,
27506     COMPARE_UNORDERED_FLAG$2 = 2;
27507 /** `Object#toString` result references. */
27508
27509 var boolTag$1 = '[object Boolean]',
27510     dateTag$1 = '[object Date]',
27511     errorTag$1 = '[object Error]',
27512     mapTag$2 = '[object Map]',
27513     numberTag$1 = '[object Number]',
27514     regexpTag$1 = '[object RegExp]',
27515     setTag$2 = '[object Set]',
27516     stringTag$1 = '[object String]',
27517     symbolTag$1 = '[object Symbol]';
27518 var arrayBufferTag$1 = '[object ArrayBuffer]',
27519     dataViewTag$2 = '[object DataView]';
27520 /** Used to convert symbols to primitives and strings. */
27521
27522 var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : undefined,
27523     symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
27524 /**
27525  * A specialized version of `baseIsEqualDeep` for comparing objects of
27526  * the same `toStringTag`.
27527  *
27528  * **Note:** This function only supports comparing values with tags of
27529  * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
27530  *
27531  * @private
27532  * @param {Object} object The object to compare.
27533  * @param {Object} other The other object to compare.
27534  * @param {string} tag The `toStringTag` of the objects to compare.
27535  * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
27536  * @param {Function} customizer The function to customize comparisons.
27537  * @param {Function} equalFunc The function to determine equivalents of values.
27538  * @param {Object} stack Tracks traversed `object` and `other` objects.
27539  * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
27540  */
27541
27542 function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack) {
27543   switch (tag) {
27544     case dataViewTag$2:
27545       if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
27546         return false;
27547       }
27548
27549       object = object.buffer;
27550       other = other.buffer;
27551
27552     case arrayBufferTag$1:
27553       if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
27554         return false;
27555       }
27556
27557       return true;
27558
27559     case boolTag$1:
27560     case dateTag$1:
27561     case numberTag$1:
27562       // Coerce booleans to `1` or `0` and dates to milliseconds.
27563       // Invalid dates are coerced to `NaN`.
27564       return eq(+object, +other);
27565
27566     case errorTag$1:
27567       return object.name == other.name && object.message == other.message;
27568
27569     case regexpTag$1:
27570     case stringTag$1:
27571       // Coerce regexes to strings and treat strings, primitives and objects,
27572       // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
27573       // for more details.
27574       return object == other + '';
27575
27576     case mapTag$2:
27577       var convert = mapToArray;
27578
27579     case setTag$2:
27580       var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
27581       convert || (convert = setToArray$2);
27582
27583       if (object.size != other.size && !isPartial) {
27584         return false;
27585       } // Assume cyclic values are equal.
27586
27587
27588       var stacked = stack.get(object);
27589
27590       if (stacked) {
27591         return stacked == other;
27592       }
27593
27594       bitmask |= COMPARE_UNORDERED_FLAG$2; // Recursively compare objects (susceptible to call stack limits).
27595
27596       stack.set(object, other);
27597       var result = equalArrays$1(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
27598       stack['delete'](object);
27599       return result;
27600
27601     case symbolTag$1:
27602       if (symbolValueOf) {
27603         return symbolValueOf.call(object) == symbolValueOf.call(other);
27604       }
27605
27606   }
27607
27608   return false;
27609 }
27610
27611 var _equalByTag = equalByTag$1;
27612
27613 /**
27614  * Appends the elements of `values` to `array`.
27615  *
27616  * @private
27617  * @param {Array} array The array to modify.
27618  * @param {Array} values The values to append.
27619  * @returns {Array} Returns `array`.
27620  */
27621
27622 function arrayPush$1(array, values) {
27623   var index = -1,
27624       length = values.length,
27625       offset = array.length;
27626
27627   while (++index < length) {
27628     array[offset + index] = values[index];
27629   }
27630
27631   return array;
27632 }
27633
27634 var _arrayPush = arrayPush$1;
27635
27636 /**
27637  * Checks if `value` is classified as an `Array` object.
27638  *
27639  * @static
27640  * @memberOf _
27641  * @since 0.1.0
27642  * @category Lang
27643  * @param {*} value The value to check.
27644  * @returns {boolean} Returns `true` if `value` is an array, else `false`.
27645  * @example
27646  *
27647  * _.isArray([1, 2, 3]);
27648  * // => true
27649  *
27650  * _.isArray(document.body.children);
27651  * // => false
27652  *
27653  * _.isArray('abc');
27654  * // => false
27655  *
27656  * _.isArray(_.noop);
27657  * // => false
27658  */
27659 var isArray$9 = Array.isArray;
27660 var isArray_1 = isArray$9;
27661
27662 var arrayPush = _arrayPush,
27663     isArray$8 = isArray_1;
27664 /**
27665  * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
27666  * `keysFunc` and `symbolsFunc` to get the enumerable property names and
27667  * symbols of `object`.
27668  *
27669  * @private
27670  * @param {Object} object The object to query.
27671  * @param {Function} keysFunc The function to get the keys of `object`.
27672  * @param {Function} symbolsFunc The function to get the symbols of `object`.
27673  * @returns {Array} Returns the array of property names and symbols.
27674  */
27675
27676 function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
27677   var result = keysFunc(object);
27678   return isArray$8(object) ? result : arrayPush(result, symbolsFunc(object));
27679 }
27680
27681 var _baseGetAllKeys = baseGetAllKeys$1;
27682
27683 /**
27684  * A specialized version of `_.filter` for arrays without support for
27685  * iteratee shorthands.
27686  *
27687  * @private
27688  * @param {Array} [array] The array to iterate over.
27689  * @param {Function} predicate The function invoked per iteration.
27690  * @returns {Array} Returns the new filtered array.
27691  */
27692
27693 function arrayFilter$1(array, predicate) {
27694   var index = -1,
27695       length = array == null ? 0 : array.length,
27696       resIndex = 0,
27697       result = [];
27698
27699   while (++index < length) {
27700     var value = array[index];
27701
27702     if (predicate(value, index, array)) {
27703       result[resIndex++] = value;
27704     }
27705   }
27706
27707   return result;
27708 }
27709
27710 var _arrayFilter = arrayFilter$1;
27711
27712 /**
27713  * This method returns a new empty array.
27714  *
27715  * @static
27716  * @memberOf _
27717  * @since 4.13.0
27718  * @category Util
27719  * @returns {Array} Returns the new empty array.
27720  * @example
27721  *
27722  * var arrays = _.times(2, _.stubArray);
27723  *
27724  * console.log(arrays);
27725  * // => [[], []]
27726  *
27727  * console.log(arrays[0] === arrays[1]);
27728  * // => false
27729  */
27730
27731 function stubArray$1() {
27732   return [];
27733 }
27734
27735 var stubArray_1 = stubArray$1;
27736
27737 var arrayFilter = _arrayFilter,
27738     stubArray = stubArray_1;
27739 /** Used for built-in method references. */
27740
27741 var objectProto$6 = Object.prototype;
27742 /** Built-in value references. */
27743
27744 var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
27745 /* Built-in method references for those with the same name as other `lodash` methods. */
27746
27747 var nativeGetSymbols = Object.getOwnPropertySymbols;
27748 /**
27749  * Creates an array of the own enumerable symbols of `object`.
27750  *
27751  * @private
27752  * @param {Object} object The object to query.
27753  * @returns {Array} Returns the array of symbols.
27754  */
27755
27756 var getSymbols$1 = !nativeGetSymbols ? stubArray : function (object) {
27757   if (object == null) {
27758     return [];
27759   }
27760
27761   object = Object(object);
27762   return arrayFilter(nativeGetSymbols(object), function (symbol) {
27763     return propertyIsEnumerable$1.call(object, symbol);
27764   });
27765 };
27766 var _getSymbols = getSymbols$1;
27767
27768 /**
27769  * The base implementation of `_.times` without support for iteratee shorthands
27770  * or max array length checks.
27771  *
27772  * @private
27773  * @param {number} n The number of times to invoke `iteratee`.
27774  * @param {Function} iteratee The function invoked per iteration.
27775  * @returns {Array} Returns the array of results.
27776  */
27777
27778 function baseTimes$1(n, iteratee) {
27779   var index = -1,
27780       result = Array(n);
27781
27782   while (++index < n) {
27783     result[index] = iteratee(index);
27784   }
27785
27786   return result;
27787 }
27788
27789 var _baseTimes = baseTimes$1;
27790
27791 /**
27792  * Checks if `value` is object-like. A value is object-like if it's not `null`
27793  * and has a `typeof` result of "object".
27794  *
27795  * @static
27796  * @memberOf _
27797  * @since 4.0.0
27798  * @category Lang
27799  * @param {*} value The value to check.
27800  * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
27801  * @example
27802  *
27803  * _.isObjectLike({});
27804  * // => true
27805  *
27806  * _.isObjectLike([1, 2, 3]);
27807  * // => true
27808  *
27809  * _.isObjectLike(_.noop);
27810  * // => false
27811  *
27812  * _.isObjectLike(null);
27813  * // => false
27814  */
27815
27816 function isObjectLike$5(value) {
27817   return value != null && typeof value == 'object';
27818 }
27819
27820 var isObjectLike_1 = isObjectLike$5;
27821
27822 var baseGetTag$3 = _baseGetTag,
27823     isObjectLike$4 = isObjectLike_1;
27824 /** `Object#toString` result references. */
27825
27826 var argsTag$2 = '[object Arguments]';
27827 /**
27828  * The base implementation of `_.isArguments`.
27829  *
27830  * @private
27831  * @param {*} value The value to check.
27832  * @returns {boolean} Returns `true` if `value` is an `arguments` object,
27833  */
27834
27835 function baseIsArguments$1(value) {
27836   return isObjectLike$4(value) && baseGetTag$3(value) == argsTag$2;
27837 }
27838
27839 var _baseIsArguments = baseIsArguments$1;
27840
27841 var baseIsArguments = _baseIsArguments,
27842     isObjectLike$3 = isObjectLike_1;
27843 /** Used for built-in method references. */
27844
27845 var objectProto$5 = Object.prototype;
27846 /** Used to check objects for own properties. */
27847
27848 var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
27849 /** Built-in value references. */
27850
27851 var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
27852 /**
27853  * Checks if `value` is likely an `arguments` object.
27854  *
27855  * @static
27856  * @memberOf _
27857  * @since 0.1.0
27858  * @category Lang
27859  * @param {*} value The value to check.
27860  * @returns {boolean} Returns `true` if `value` is an `arguments` object,
27861  *  else `false`.
27862  * @example
27863  *
27864  * _.isArguments(function() { return arguments; }());
27865  * // => true
27866  *
27867  * _.isArguments([1, 2, 3]);
27868  * // => false
27869  */
27870
27871 var isArguments$2 = baseIsArguments(function () {
27872   return arguments;
27873 }()) ? baseIsArguments : function (value) {
27874   return isObjectLike$3(value) && hasOwnProperty$4.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
27875 };
27876 var isArguments_1 = isArguments$2;
27877
27878 var isBuffer$2 = {exports: {}};
27879
27880 /**
27881  * This method returns `false`.
27882  *
27883  * @static
27884  * @memberOf _
27885  * @since 4.13.0
27886  * @category Util
27887  * @returns {boolean} Returns `false`.
27888  * @example
27889  *
27890  * _.times(2, _.stubFalse);
27891  * // => [false, false]
27892  */
27893
27894 function stubFalse() {
27895   return false;
27896 }
27897
27898 var stubFalse_1 = stubFalse;
27899
27900 (function (module, exports) {
27901   var root = _root,
27902       stubFalse = stubFalse_1;
27903   /** Detect free variable `exports`. */
27904
27905   var freeExports = exports && !exports.nodeType && exports;
27906   /** Detect free variable `module`. */
27907
27908   var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
27909   /** Detect the popular CommonJS extension `module.exports`. */
27910
27911   var moduleExports = freeModule && freeModule.exports === freeExports;
27912   /** Built-in value references. */
27913
27914   var Buffer = moduleExports ? root.Buffer : undefined;
27915   /* Built-in method references for those with the same name as other `lodash` methods. */
27916
27917   var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
27918   /**
27919    * Checks if `value` is a buffer.
27920    *
27921    * @static
27922    * @memberOf _
27923    * @since 4.3.0
27924    * @category Lang
27925    * @param {*} value The value to check.
27926    * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
27927    * @example
27928    *
27929    * _.isBuffer(new Buffer(2));
27930    * // => true
27931    *
27932    * _.isBuffer(new Uint8Array(2));
27933    * // => false
27934    */
27935
27936   var isBuffer = nativeIsBuffer || stubFalse;
27937   module.exports = isBuffer;
27938 })(isBuffer$2, isBuffer$2.exports);
27939
27940 /** Used as references for various `Number` constants. */
27941 var MAX_SAFE_INTEGER$1 = 9007199254740991;
27942 /** Used to detect unsigned integer values. */
27943
27944 var reIsUint = /^(?:0|[1-9]\d*)$/;
27945 /**
27946  * Checks if `value` is a valid array-like index.
27947  *
27948  * @private
27949  * @param {*} value The value to check.
27950  * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
27951  * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
27952  */
27953
27954 function isIndex$2(value, length) {
27955   var type = typeof value;
27956   length = length == null ? MAX_SAFE_INTEGER$1 : length;
27957   return !!length && (type == 'number' || type != 'symbol' && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
27958 }
27959
27960 var _isIndex = isIndex$2;
27961
27962 /** Used as references for various `Number` constants. */
27963 var MAX_SAFE_INTEGER = 9007199254740991;
27964 /**
27965  * Checks if `value` is a valid array-like length.
27966  *
27967  * **Note:** This method is loosely based on
27968  * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
27969  *
27970  * @static
27971  * @memberOf _
27972  * @since 4.0.0
27973  * @category Lang
27974  * @param {*} value The value to check.
27975  * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
27976  * @example
27977  *
27978  * _.isLength(3);
27979  * // => true
27980  *
27981  * _.isLength(Number.MIN_VALUE);
27982  * // => false
27983  *
27984  * _.isLength(Infinity);
27985  * // => false
27986  *
27987  * _.isLength('3');
27988  * // => false
27989  */
27990
27991 function isLength$3(value) {
27992   return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
27993 }
27994
27995 var isLength_1 = isLength$3;
27996
27997 var baseGetTag$2 = _baseGetTag,
27998     isLength$2 = isLength_1,
27999     isObjectLike$2 = isObjectLike_1;
28000 /** `Object#toString` result references. */
28001
28002 var argsTag$1 = '[object Arguments]',
28003     arrayTag$1 = '[object Array]',
28004     boolTag = '[object Boolean]',
28005     dateTag = '[object Date]',
28006     errorTag = '[object Error]',
28007     funcTag = '[object Function]',
28008     mapTag$1 = '[object Map]',
28009     numberTag = '[object Number]',
28010     objectTag$2 = '[object Object]',
28011     regexpTag = '[object RegExp]',
28012     setTag$1 = '[object Set]',
28013     stringTag = '[object String]',
28014     weakMapTag$1 = '[object WeakMap]';
28015 var arrayBufferTag = '[object ArrayBuffer]',
28016     dataViewTag$1 = '[object DataView]',
28017     float32Tag = '[object Float32Array]',
28018     float64Tag = '[object Float64Array]',
28019     int8Tag = '[object Int8Array]',
28020     int16Tag = '[object Int16Array]',
28021     int32Tag = '[object Int32Array]',
28022     uint8Tag = '[object Uint8Array]',
28023     uint8ClampedTag = '[object Uint8ClampedArray]',
28024     uint16Tag = '[object Uint16Array]',
28025     uint32Tag = '[object Uint32Array]';
28026 /** Used to identify `toStringTag` values of typed arrays. */
28027
28028 var typedArrayTags = {};
28029 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
28030 typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag$1] = typedArrayTags[numberTag] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] = typedArrayTags[setTag$1] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag$1] = false;
28031 /**
28032  * The base implementation of `_.isTypedArray` without Node.js optimizations.
28033  *
28034  * @private
28035  * @param {*} value The value to check.
28036  * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
28037  */
28038
28039 function baseIsTypedArray$1(value) {
28040   return isObjectLike$2(value) && isLength$2(value.length) && !!typedArrayTags[baseGetTag$2(value)];
28041 }
28042
28043 var _baseIsTypedArray = baseIsTypedArray$1;
28044
28045 /**
28046  * The base implementation of `_.unary` without support for storing metadata.
28047  *
28048  * @private
28049  * @param {Function} func The function to cap arguments for.
28050  * @returns {Function} Returns the new capped function.
28051  */
28052
28053 function baseUnary$1(func) {
28054   return function (value) {
28055     return func(value);
28056   };
28057 }
28058
28059 var _baseUnary = baseUnary$1;
28060
28061 var _nodeUtil = {exports: {}};
28062
28063 (function (module, exports) {
28064   var freeGlobal = _freeGlobal;
28065   /** Detect free variable `exports`. */
28066
28067   var freeExports = exports && !exports.nodeType && exports;
28068   /** Detect free variable `module`. */
28069
28070   var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
28071   /** Detect the popular CommonJS extension `module.exports`. */
28072
28073   var moduleExports = freeModule && freeModule.exports === freeExports;
28074   /** Detect free variable `process` from Node.js. */
28075
28076   var freeProcess = moduleExports && freeGlobal.process;
28077   /** Used to access faster Node.js helpers. */
28078
28079   var nodeUtil = function () {
28080     try {
28081       // Use `util.types` for Node.js 10+.
28082       var types = freeModule && freeModule.require && freeModule.require('util').types;
28083
28084       if (types) {
28085         return types;
28086       } // Legacy `process.binding('util')` for Node.js < 10.
28087
28088
28089       return freeProcess && freeProcess.binding && freeProcess.binding('util');
28090     } catch (e) {}
28091   }();
28092
28093   module.exports = nodeUtil;
28094 })(_nodeUtil, _nodeUtil.exports);
28095
28096 var baseIsTypedArray = _baseIsTypedArray,
28097     baseUnary = _baseUnary,
28098     nodeUtil = _nodeUtil.exports;
28099 /* Node.js helper references. */
28100
28101 var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
28102 /**
28103  * Checks if `value` is classified as a typed array.
28104  *
28105  * @static
28106  * @memberOf _
28107  * @since 3.0.0
28108  * @category Lang
28109  * @param {*} value The value to check.
28110  * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
28111  * @example
28112  *
28113  * _.isTypedArray(new Uint8Array);
28114  * // => true
28115  *
28116  * _.isTypedArray([]);
28117  * // => false
28118  */
28119
28120 var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
28121 var isTypedArray_1 = isTypedArray$2;
28122
28123 var baseTimes = _baseTimes,
28124     isArguments$1 = isArguments_1,
28125     isArray$7 = isArray_1,
28126     isBuffer$1 = isBuffer$2.exports,
28127     isIndex$1 = _isIndex,
28128     isTypedArray$1 = isTypedArray_1;
28129 /** Used for built-in method references. */
28130
28131 var objectProto$4 = Object.prototype;
28132 /** Used to check objects for own properties. */
28133
28134 var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
28135 /**
28136  * Creates an array of the enumerable property names of the array-like `value`.
28137  *
28138  * @private
28139  * @param {*} value The value to query.
28140  * @param {boolean} inherited Specify returning inherited property names.
28141  * @returns {Array} Returns the array of property names.
28142  */
28143
28144 function arrayLikeKeys$1(value, inherited) {
28145   var isArr = isArray$7(value),
28146       isArg = !isArr && isArguments$1(value),
28147       isBuff = !isArr && !isArg && isBuffer$1(value),
28148       isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
28149       skipIndexes = isArr || isArg || isBuff || isType,
28150       result = skipIndexes ? baseTimes(value.length, String) : [],
28151       length = result.length;
28152
28153   for (var key in value) {
28154     if ((inherited || hasOwnProperty$3.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode.
28155     key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers.
28156     isBuff && (key == 'offset' || key == 'parent') || // PhantomJS 2 has enumerable non-index properties on typed arrays.
28157     isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties.
28158     isIndex$1(key, length)))) {
28159       result.push(key);
28160     }
28161   }
28162
28163   return result;
28164 }
28165
28166 var _arrayLikeKeys = arrayLikeKeys$1;
28167
28168 /** Used for built-in method references. */
28169 var objectProto$3 = Object.prototype;
28170 /**
28171  * Checks if `value` is likely a prototype object.
28172  *
28173  * @private
28174  * @param {*} value The value to check.
28175  * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
28176  */
28177
28178 function isPrototype$1(value) {
28179   var Ctor = value && value.constructor,
28180       proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$3;
28181   return value === proto;
28182 }
28183
28184 var _isPrototype = isPrototype$1;
28185
28186 /**
28187  * Creates a unary function that invokes `func` with its argument transformed.
28188  *
28189  * @private
28190  * @param {Function} func The function to wrap.
28191  * @param {Function} transform The argument transform.
28192  * @returns {Function} Returns the new function.
28193  */
28194
28195 function overArg$1(func, transform) {
28196   return function (arg) {
28197     return func(transform(arg));
28198   };
28199 }
28200
28201 var _overArg = overArg$1;
28202
28203 var overArg = _overArg;
28204 /* Built-in method references for those with the same name as other `lodash` methods. */
28205
28206 var nativeKeys$1 = overArg(Object.keys, Object);
28207 var _nativeKeys = nativeKeys$1;
28208
28209 var isPrototype = _isPrototype,
28210     nativeKeys = _nativeKeys;
28211 /** Used for built-in method references. */
28212
28213 var objectProto$2 = Object.prototype;
28214 /** Used to check objects for own properties. */
28215
28216 var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
28217 /**
28218  * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
28219  *
28220  * @private
28221  * @param {Object} object The object to query.
28222  * @returns {Array} Returns the array of property names.
28223  */
28224
28225 function baseKeys$1(object) {
28226   if (!isPrototype(object)) {
28227     return nativeKeys(object);
28228   }
28229
28230   var result = [];
28231
28232   for (var key in Object(object)) {
28233     if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
28234       result.push(key);
28235     }
28236   }
28237
28238   return result;
28239 }
28240
28241 var _baseKeys = baseKeys$1;
28242
28243 var isFunction = isFunction_1,
28244     isLength$1 = isLength_1;
28245 /**
28246  * Checks if `value` is array-like. A value is considered array-like if it's
28247  * not a function and has a `value.length` that's an integer greater than or
28248  * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
28249  *
28250  * @static
28251  * @memberOf _
28252  * @since 4.0.0
28253  * @category Lang
28254  * @param {*} value The value to check.
28255  * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
28256  * @example
28257  *
28258  * _.isArrayLike([1, 2, 3]);
28259  * // => true
28260  *
28261  * _.isArrayLike(document.body.children);
28262  * // => true
28263  *
28264  * _.isArrayLike('abc');
28265  * // => true
28266  *
28267  * _.isArrayLike(_.noop);
28268  * // => false
28269  */
28270
28271 function isArrayLike$2(value) {
28272   return value != null && isLength$1(value.length) && !isFunction(value);
28273 }
28274
28275 var isArrayLike_1 = isArrayLike$2;
28276
28277 var arrayLikeKeys = _arrayLikeKeys,
28278     baseKeys = _baseKeys,
28279     isArrayLike$1 = isArrayLike_1;
28280 /**
28281  * Creates an array of the own enumerable property names of `object`.
28282  *
28283  * **Note:** Non-object values are coerced to objects. See the
28284  * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
28285  * for more details.
28286  *
28287  * @static
28288  * @since 0.1.0
28289  * @memberOf _
28290  * @category Object
28291  * @param {Object} object The object to query.
28292  * @returns {Array} Returns the array of property names.
28293  * @example
28294  *
28295  * function Foo() {
28296  *   this.a = 1;
28297  *   this.b = 2;
28298  * }
28299  *
28300  * Foo.prototype.c = 3;
28301  *
28302  * _.keys(new Foo);
28303  * // => ['a', 'b'] (iteration order is not guaranteed)
28304  *
28305  * _.keys('hi');
28306  * // => ['0', '1']
28307  */
28308
28309 function keys$3(object) {
28310   return isArrayLike$1(object) ? arrayLikeKeys(object) : baseKeys(object);
28311 }
28312
28313 var keys_1 = keys$3;
28314
28315 var baseGetAllKeys = _baseGetAllKeys,
28316     getSymbols = _getSymbols,
28317     keys$2 = keys_1;
28318 /**
28319  * Creates an array of own enumerable property names and symbols of `object`.
28320  *
28321  * @private
28322  * @param {Object} object The object to query.
28323  * @returns {Array} Returns the array of property names and symbols.
28324  */
28325
28326 function getAllKeys$1(object) {
28327   return baseGetAllKeys(object, keys$2, getSymbols);
28328 }
28329
28330 var _getAllKeys = getAllKeys$1;
28331
28332 var getAllKeys = _getAllKeys;
28333 /** Used to compose bitmasks for value comparisons. */
28334
28335 var COMPARE_PARTIAL_FLAG$3 = 1;
28336 /** Used for built-in method references. */
28337
28338 var objectProto$1 = Object.prototype;
28339 /** Used to check objects for own properties. */
28340
28341 var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
28342 /**
28343  * A specialized version of `baseIsEqualDeep` for objects with support for
28344  * partial deep comparisons.
28345  *
28346  * @private
28347  * @param {Object} object The object to compare.
28348  * @param {Object} other The other object to compare.
28349  * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
28350  * @param {Function} customizer The function to customize comparisons.
28351  * @param {Function} equalFunc The function to determine equivalents of values.
28352  * @param {Object} stack Tracks traversed `object` and `other` objects.
28353  * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
28354  */
28355
28356 function equalObjects$1(object, other, bitmask, customizer, equalFunc, stack) {
28357   var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
28358       objProps = getAllKeys(object),
28359       objLength = objProps.length,
28360       othProps = getAllKeys(other),
28361       othLength = othProps.length;
28362
28363   if (objLength != othLength && !isPartial) {
28364     return false;
28365   }
28366
28367   var index = objLength;
28368
28369   while (index--) {
28370     var key = objProps[index];
28371
28372     if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
28373       return false;
28374     }
28375   } // Check that cyclic values are equal.
28376
28377
28378   var objStacked = stack.get(object);
28379   var othStacked = stack.get(other);
28380
28381   if (objStacked && othStacked) {
28382     return objStacked == other && othStacked == object;
28383   }
28384
28385   var result = true;
28386   stack.set(object, other);
28387   stack.set(other, object);
28388   var skipCtor = isPartial;
28389
28390   while (++index < objLength) {
28391     key = objProps[index];
28392     var objValue = object[key],
28393         othValue = other[key];
28394
28395     if (customizer) {
28396       var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
28397     } // Recursively compare objects (susceptible to call stack limits).
28398
28399
28400     if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
28401       result = false;
28402       break;
28403     }
28404
28405     skipCtor || (skipCtor = key == 'constructor');
28406   }
28407
28408   if (result && !skipCtor) {
28409     var objCtor = object.constructor,
28410         othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal.
28411
28412     if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
28413       result = false;
28414     }
28415   }
28416
28417   stack['delete'](object);
28418   stack['delete'](other);
28419   return result;
28420 }
28421
28422 var _equalObjects = equalObjects$1;
28423
28424 var getNative$3 = _getNative,
28425     root$3 = _root;
28426 /* Built-in method references that are verified to be native. */
28427
28428 var DataView$1 = getNative$3(root$3, 'DataView');
28429 var _DataView = DataView$1;
28430
28431 var getNative$2 = _getNative,
28432     root$2 = _root;
28433 /* Built-in method references that are verified to be native. */
28434
28435 var Promise$2 = getNative$2(root$2, 'Promise');
28436 var _Promise = Promise$2;
28437
28438 var getNative$1 = _getNative,
28439     root$1 = _root;
28440 /* Built-in method references that are verified to be native. */
28441
28442 var Set$3 = getNative$1(root$1, 'Set');
28443 var _Set = Set$3;
28444
28445 var getNative = _getNative,
28446     root = _root;
28447 /* Built-in method references that are verified to be native. */
28448
28449 var WeakMap$2 = getNative(root, 'WeakMap');
28450 var _WeakMap = WeakMap$2;
28451
28452 var DataView = _DataView,
28453     Map$1 = _Map,
28454     Promise$1 = _Promise,
28455     Set$2 = _Set,
28456     WeakMap$1 = _WeakMap,
28457     baseGetTag$1 = _baseGetTag,
28458     toSource = _toSource;
28459 /** `Object#toString` result references. */
28460
28461 var mapTag = '[object Map]',
28462     objectTag$1 = '[object Object]',
28463     promiseTag = '[object Promise]',
28464     setTag = '[object Set]',
28465     weakMapTag = '[object WeakMap]';
28466 var dataViewTag = '[object DataView]';
28467 /** Used to detect maps, sets, and weakmaps. */
28468
28469 var dataViewCtorString = toSource(DataView),
28470     mapCtorString = toSource(Map$1),
28471     promiseCtorString = toSource(Promise$1),
28472     setCtorString = toSource(Set$2),
28473     weakMapCtorString = toSource(WeakMap$1);
28474 /**
28475  * Gets the `toStringTag` of `value`.
28476  *
28477  * @private
28478  * @param {*} value The value to query.
28479  * @returns {string} Returns the `toStringTag`.
28480  */
28481
28482 var getTag$1 = baseGetTag$1; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
28483
28484 if (DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag$1(new Map$1()) != mapTag || Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag || Set$2 && getTag$1(new Set$2()) != setTag || WeakMap$1 && getTag$1(new WeakMap$1()) != weakMapTag) {
28485   getTag$1 = function (value) {
28486     var result = baseGetTag$1(value),
28487         Ctor = result == objectTag$1 ? value.constructor : undefined,
28488         ctorString = Ctor ? toSource(Ctor) : '';
28489
28490     if (ctorString) {
28491       switch (ctorString) {
28492         case dataViewCtorString:
28493           return dataViewTag;
28494
28495         case mapCtorString:
28496           return mapTag;
28497
28498         case promiseCtorString:
28499           return promiseTag;
28500
28501         case setCtorString:
28502           return setTag;
28503
28504         case weakMapCtorString:
28505           return weakMapTag;
28506       }
28507     }
28508
28509     return result;
28510   };
28511 }
28512
28513 var _getTag = getTag$1;
28514
28515 var Stack$1 = _Stack,
28516     equalArrays = _equalArrays,
28517     equalByTag = _equalByTag,
28518     equalObjects = _equalObjects,
28519     getTag = _getTag,
28520     isArray$6 = isArray_1,
28521     isBuffer = isBuffer$2.exports,
28522     isTypedArray = isTypedArray_1;
28523 /** Used to compose bitmasks for value comparisons. */
28524
28525 var COMPARE_PARTIAL_FLAG$2 = 1;
28526 /** `Object#toString` result references. */
28527
28528 var argsTag = '[object Arguments]',
28529     arrayTag = '[object Array]',
28530     objectTag = '[object Object]';
28531 /** Used for built-in method references. */
28532
28533 var objectProto = Object.prototype;
28534 /** Used to check objects for own properties. */
28535
28536 var hasOwnProperty = objectProto.hasOwnProperty;
28537 /**
28538  * A specialized version of `baseIsEqual` for arrays and objects which performs
28539  * deep comparisons and tracks traversed objects enabling objects with circular
28540  * references to be compared.
28541  *
28542  * @private
28543  * @param {Object} object The object to compare.
28544  * @param {Object} other The other object to compare.
28545  * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
28546  * @param {Function} customizer The function to customize comparisons.
28547  * @param {Function} equalFunc The function to determine equivalents of values.
28548  * @param {Object} [stack] Tracks traversed `object` and `other` objects.
28549  * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
28550  */
28551
28552 function baseIsEqualDeep$1(object, other, bitmask, customizer, equalFunc, stack) {
28553   var objIsArr = isArray$6(object),
28554       othIsArr = isArray$6(other),
28555       objTag = objIsArr ? arrayTag : getTag(object),
28556       othTag = othIsArr ? arrayTag : getTag(other);
28557   objTag = objTag == argsTag ? objectTag : objTag;
28558   othTag = othTag == argsTag ? objectTag : othTag;
28559   var objIsObj = objTag == objectTag,
28560       othIsObj = othTag == objectTag,
28561       isSameTag = objTag == othTag;
28562
28563   if (isSameTag && isBuffer(object)) {
28564     if (!isBuffer(other)) {
28565       return false;
28566     }
28567
28568     objIsArr = true;
28569     objIsObj = false;
28570   }
28571
28572   if (isSameTag && !objIsObj) {
28573     stack || (stack = new Stack$1());
28574     return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
28575   }
28576
28577   if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
28578     var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
28579         othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
28580
28581     if (objIsWrapped || othIsWrapped) {
28582       var objUnwrapped = objIsWrapped ? object.value() : object,
28583           othUnwrapped = othIsWrapped ? other.value() : other;
28584       stack || (stack = new Stack$1());
28585       return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
28586     }
28587   }
28588
28589   if (!isSameTag) {
28590     return false;
28591   }
28592
28593   stack || (stack = new Stack$1());
28594   return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
28595 }
28596
28597 var _baseIsEqualDeep = baseIsEqualDeep$1;
28598
28599 var baseIsEqualDeep = _baseIsEqualDeep,
28600     isObjectLike$1 = isObjectLike_1;
28601 /**
28602  * The base implementation of `_.isEqual` which supports partial comparisons
28603  * and tracks traversed objects.
28604  *
28605  * @private
28606  * @param {*} value The value to compare.
28607  * @param {*} other The other value to compare.
28608  * @param {boolean} bitmask The bitmask flags.
28609  *  1 - Unordered comparison
28610  *  2 - Partial comparison
28611  * @param {Function} [customizer] The function to customize comparisons.
28612  * @param {Object} [stack] Tracks traversed `value` and `other` objects.
28613  * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
28614  */
28615
28616 function baseIsEqual$2(value, other, bitmask, customizer, stack) {
28617   if (value === other) {
28618     return true;
28619   }
28620
28621   if (value == null || other == null || !isObjectLike$1(value) && !isObjectLike$1(other)) {
28622     return value !== value && other !== other;
28623   }
28624
28625   return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$2, stack);
28626 }
28627
28628 var _baseIsEqual = baseIsEqual$2;
28629
28630 var Stack = _Stack,
28631     baseIsEqual$1 = _baseIsEqual;
28632 /** Used to compose bitmasks for value comparisons. */
28633
28634 var COMPARE_PARTIAL_FLAG$1 = 1,
28635     COMPARE_UNORDERED_FLAG$1 = 2;
28636 /**
28637  * The base implementation of `_.isMatch` without support for iteratee shorthands.
28638  *
28639  * @private
28640  * @param {Object} object The object to inspect.
28641  * @param {Object} source The object of property values to match.
28642  * @param {Array} matchData The property names, values, and compare flags to match.
28643  * @param {Function} [customizer] The function to customize comparisons.
28644  * @returns {boolean} Returns `true` if `object` is a match, else `false`.
28645  */
28646
28647 function baseIsMatch$1(object, source, matchData, customizer) {
28648   var index = matchData.length,
28649       length = index,
28650       noCustomizer = !customizer;
28651
28652   if (object == null) {
28653     return !length;
28654   }
28655
28656   object = Object(object);
28657
28658   while (index--) {
28659     var data = matchData[index];
28660
28661     if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
28662       return false;
28663     }
28664   }
28665
28666   while (++index < length) {
28667     data = matchData[index];
28668     var key = data[0],
28669         objValue = object[key],
28670         srcValue = data[1];
28671
28672     if (noCustomizer && data[2]) {
28673       if (objValue === undefined && !(key in object)) {
28674         return false;
28675       }
28676     } else {
28677       var stack = new Stack();
28678
28679       if (customizer) {
28680         var result = customizer(objValue, srcValue, key, object, source, stack);
28681       }
28682
28683       if (!(result === undefined ? baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
28684         return false;
28685       }
28686     }
28687   }
28688
28689   return true;
28690 }
28691
28692 var _baseIsMatch = baseIsMatch$1;
28693
28694 var isObject$2 = isObject_1;
28695 /**
28696  * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
28697  *
28698  * @private
28699  * @param {*} value The value to check.
28700  * @returns {boolean} Returns `true` if `value` if suitable for strict
28701  *  equality comparisons, else `false`.
28702  */
28703
28704 function isStrictComparable$2(value) {
28705   return value === value && !isObject$2(value);
28706 }
28707
28708 var _isStrictComparable = isStrictComparable$2;
28709
28710 var isStrictComparable$1 = _isStrictComparable,
28711     keys$1 = keys_1;
28712 /**
28713  * Gets the property names, values, and compare flags of `object`.
28714  *
28715  * @private
28716  * @param {Object} object The object to query.
28717  * @returns {Array} Returns the match data of `object`.
28718  */
28719
28720 function getMatchData$1(object) {
28721   var result = keys$1(object),
28722       length = result.length;
28723
28724   while (length--) {
28725     var key = result[length],
28726         value = object[key];
28727     result[length] = [key, value, isStrictComparable$1(value)];
28728   }
28729
28730   return result;
28731 }
28732
28733 var _getMatchData = getMatchData$1;
28734
28735 /**
28736  * A specialized version of `matchesProperty` for source values suitable
28737  * for strict equality comparisons, i.e. `===`.
28738  *
28739  * @private
28740  * @param {string} key The key of the property to get.
28741  * @param {*} srcValue The value to match.
28742  * @returns {Function} Returns the new spec function.
28743  */
28744
28745 function matchesStrictComparable$2(key, srcValue) {
28746   return function (object) {
28747     if (object == null) {
28748       return false;
28749     }
28750
28751     return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
28752   };
28753 }
28754
28755 var _matchesStrictComparable = matchesStrictComparable$2;
28756
28757 var baseIsMatch = _baseIsMatch,
28758     getMatchData = _getMatchData,
28759     matchesStrictComparable$1 = _matchesStrictComparable;
28760 /**
28761  * The base implementation of `_.matches` which doesn't clone `source`.
28762  *
28763  * @private
28764  * @param {Object} source The object of property values to match.
28765  * @returns {Function} Returns the new spec function.
28766  */
28767
28768 function baseMatches$1(source) {
28769   var matchData = getMatchData(source);
28770
28771   if (matchData.length == 1 && matchData[0][2]) {
28772     return matchesStrictComparable$1(matchData[0][0], matchData[0][1]);
28773   }
28774
28775   return function (object) {
28776     return object === source || baseIsMatch(object, source, matchData);
28777   };
28778 }
28779
28780 var _baseMatches = baseMatches$1;
28781
28782 var baseGetTag = _baseGetTag,
28783     isObjectLike = isObjectLike_1;
28784 /** `Object#toString` result references. */
28785
28786 var symbolTag = '[object Symbol]';
28787 /**
28788  * Checks if `value` is classified as a `Symbol` primitive or object.
28789  *
28790  * @static
28791  * @memberOf _
28792  * @since 4.0.0
28793  * @category Lang
28794  * @param {*} value The value to check.
28795  * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
28796  * @example
28797  *
28798  * _.isSymbol(Symbol.iterator);
28799  * // => true
28800  *
28801  * _.isSymbol('abc');
28802  * // => false
28803  */
28804
28805 function isSymbol$3(value) {
28806   return typeof value == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
28807 }
28808
28809 var isSymbol_1 = isSymbol$3;
28810
28811 var isArray$5 = isArray_1,
28812     isSymbol$2 = isSymbol_1;
28813 /** Used to match property names within property paths. */
28814
28815 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
28816     reIsPlainProp = /^\w*$/;
28817 /**
28818  * Checks if `value` is a property name and not a property path.
28819  *
28820  * @private
28821  * @param {*} value The value to check.
28822  * @param {Object} [object] The object to query keys on.
28823  * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
28824  */
28825
28826 function isKey$3(value, object) {
28827   if (isArray$5(value)) {
28828     return false;
28829   }
28830
28831   var type = typeof value;
28832
28833   if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol$2(value)) {
28834     return true;
28835   }
28836
28837   return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
28838 }
28839
28840 var _isKey = isKey$3;
28841
28842 var MapCache = _MapCache;
28843 /** Error message constants. */
28844
28845 var FUNC_ERROR_TEXT = 'Expected a function';
28846 /**
28847  * Creates a function that memoizes the result of `func`. If `resolver` is
28848  * provided, it determines the cache key for storing the result based on the
28849  * arguments provided to the memoized function. By default, the first argument
28850  * provided to the memoized function is used as the map cache key. The `func`
28851  * is invoked with the `this` binding of the memoized function.
28852  *
28853  * **Note:** The cache is exposed as the `cache` property on the memoized
28854  * function. Its creation may be customized by replacing the `_.memoize.Cache`
28855  * constructor with one whose instances implement the
28856  * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
28857  * method interface of `clear`, `delete`, `get`, `has`, and `set`.
28858  *
28859  * @static
28860  * @memberOf _
28861  * @since 0.1.0
28862  * @category Function
28863  * @param {Function} func The function to have its output memoized.
28864  * @param {Function} [resolver] The function to resolve the cache key.
28865  * @returns {Function} Returns the new memoized function.
28866  * @example
28867  *
28868  * var object = { 'a': 1, 'b': 2 };
28869  * var other = { 'c': 3, 'd': 4 };
28870  *
28871  * var values = _.memoize(_.values);
28872  * values(object);
28873  * // => [1, 2]
28874  *
28875  * values(other);
28876  * // => [3, 4]
28877  *
28878  * object.a = 2;
28879  * values(object);
28880  * // => [1, 2]
28881  *
28882  * // Modify the result cache.
28883  * values.cache.set(object, ['a', 'b']);
28884  * values(object);
28885  * // => ['a', 'b']
28886  *
28887  * // Replace `_.memoize.Cache`.
28888  * _.memoize.Cache = WeakMap;
28889  */
28890
28891 function memoize$1(func, resolver) {
28892   if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {
28893     throw new TypeError(FUNC_ERROR_TEXT);
28894   }
28895
28896   var memoized = function () {
28897     var args = arguments,
28898         key = resolver ? resolver.apply(this, args) : args[0],
28899         cache = memoized.cache;
28900
28901     if (cache.has(key)) {
28902       return cache.get(key);
28903     }
28904
28905     var result = func.apply(this, args);
28906     memoized.cache = cache.set(key, result) || cache;
28907     return result;
28908   };
28909
28910   memoized.cache = new (memoize$1.Cache || MapCache)();
28911   return memoized;
28912 } // Expose `MapCache`.
28913
28914
28915 memoize$1.Cache = MapCache;
28916 var memoize_1 = memoize$1;
28917
28918 var memoize = memoize_1;
28919 /** Used as the maximum memoize cache size. */
28920
28921 var MAX_MEMOIZE_SIZE = 500;
28922 /**
28923  * A specialized version of `_.memoize` which clears the memoized function's
28924  * cache when it exceeds `MAX_MEMOIZE_SIZE`.
28925  *
28926  * @private
28927  * @param {Function} func The function to have its output memoized.
28928  * @returns {Function} Returns the new memoized function.
28929  */
28930
28931 function memoizeCapped$1(func) {
28932   var result = memoize(func, function (key) {
28933     if (cache.size === MAX_MEMOIZE_SIZE) {
28934       cache.clear();
28935     }
28936
28937     return key;
28938   });
28939   var cache = result.cache;
28940   return result;
28941 }
28942
28943 var _memoizeCapped = memoizeCapped$1;
28944
28945 var memoizeCapped = _memoizeCapped;
28946 /** Used to match property names within property paths. */
28947
28948 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
28949 /** Used to match backslashes in property paths. */
28950
28951 var reEscapeChar = /\\(\\)?/g;
28952 /**
28953  * Converts `string` to a property path array.
28954  *
28955  * @private
28956  * @param {string} string The string to convert.
28957  * @returns {Array} Returns the property path array.
28958  */
28959
28960 var stringToPath$1 = memoizeCapped(function (string) {
28961   var result = [];
28962
28963   if (string.charCodeAt(0) === 46
28964   /* . */
28965   ) {
28966     result.push('');
28967   }
28968
28969   string.replace(rePropName, function (match, number, quote, subString) {
28970     result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match);
28971   });
28972   return result;
28973 });
28974 var _stringToPath = stringToPath$1;
28975
28976 /**
28977  * A specialized version of `_.map` for arrays without support for iteratee
28978  * shorthands.
28979  *
28980  * @private
28981  * @param {Array} [array] The array to iterate over.
28982  * @param {Function} iteratee The function invoked per iteration.
28983  * @returns {Array} Returns the new mapped array.
28984  */
28985
28986 function arrayMap$1(array, iteratee) {
28987   var index = -1,
28988       length = array == null ? 0 : array.length,
28989       result = Array(length);
28990
28991   while (++index < length) {
28992     result[index] = iteratee(array[index], index, array);
28993   }
28994
28995   return result;
28996 }
28997
28998 var _arrayMap = arrayMap$1;
28999
29000 var Symbol$1 = _Symbol,
29001     arrayMap = _arrayMap,
29002     isArray$4 = isArray_1,
29003     isSymbol$1 = isSymbol_1;
29004 /** Used as references for various `Number` constants. */
29005
29006 var INFINITY$2 = 1 / 0;
29007 /** Used to convert symbols to primitives and strings. */
29008
29009 var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
29010     symbolToString = symbolProto ? symbolProto.toString : undefined;
29011 /**
29012  * The base implementation of `_.toString` which doesn't convert nullish
29013  * values to empty strings.
29014  *
29015  * @private
29016  * @param {*} value The value to process.
29017  * @returns {string} Returns the string.
29018  */
29019
29020 function baseToString$1(value) {
29021   // Exit early for strings to avoid a performance hit in some environments.
29022   if (typeof value == 'string') {
29023     return value;
29024   }
29025
29026   if (isArray$4(value)) {
29027     // Recursively convert values (susceptible to call stack limits).
29028     return arrayMap(value, baseToString$1) + '';
29029   }
29030
29031   if (isSymbol$1(value)) {
29032     return symbolToString ? symbolToString.call(value) : '';
29033   }
29034
29035   var result = value + '';
29036   return result == '0' && 1 / value == -INFINITY$2 ? '-0' : result;
29037 }
29038
29039 var _baseToString = baseToString$1;
29040
29041 var baseToString = _baseToString;
29042 /**
29043  * Converts `value` to a string. An empty string is returned for `null`
29044  * and `undefined` values. The sign of `-0` is preserved.
29045  *
29046  * @static
29047  * @memberOf _
29048  * @since 4.0.0
29049  * @category Lang
29050  * @param {*} value The value to convert.
29051  * @returns {string} Returns the converted string.
29052  * @example
29053  *
29054  * _.toString(null);
29055  * // => ''
29056  *
29057  * _.toString(-0);
29058  * // => '-0'
29059  *
29060  * _.toString([1, 2, 3]);
29061  * // => '1,2,3'
29062  */
29063
29064 function toString$1(value) {
29065   return value == null ? '' : baseToString(value);
29066 }
29067
29068 var toString_1 = toString$1;
29069
29070 var isArray$3 = isArray_1,
29071     isKey$2 = _isKey,
29072     stringToPath = _stringToPath,
29073     toString = toString_1;
29074 /**
29075  * Casts `value` to a path array if it's not one.
29076  *
29077  * @private
29078  * @param {*} value The value to inspect.
29079  * @param {Object} [object] The object to query keys on.
29080  * @returns {Array} Returns the cast property path array.
29081  */
29082
29083 function castPath$2(value, object) {
29084   if (isArray$3(value)) {
29085     return value;
29086   }
29087
29088   return isKey$2(value, object) ? [value] : stringToPath(toString(value));
29089 }
29090
29091 var _castPath = castPath$2;
29092
29093 var isSymbol = isSymbol_1;
29094 /** Used as references for various `Number` constants. */
29095
29096 var INFINITY$1 = 1 / 0;
29097 /**
29098  * Converts `value` to a string key if it's not a string or symbol.
29099  *
29100  * @private
29101  * @param {*} value The value to inspect.
29102  * @returns {string|symbol} Returns the key.
29103  */
29104
29105 function toKey$4(value) {
29106   if (typeof value == 'string' || isSymbol(value)) {
29107     return value;
29108   }
29109
29110   var result = value + '';
29111   return result == '0' && 1 / value == -INFINITY$1 ? '-0' : result;
29112 }
29113
29114 var _toKey = toKey$4;
29115
29116 var castPath$1 = _castPath,
29117     toKey$3 = _toKey;
29118 /**
29119  * The base implementation of `_.get` without support for default values.
29120  *
29121  * @private
29122  * @param {Object} object The object to query.
29123  * @param {Array|string} path The path of the property to get.
29124  * @returns {*} Returns the resolved value.
29125  */
29126
29127 function baseGet$2(object, path) {
29128   path = castPath$1(path, object);
29129   var index = 0,
29130       length = path.length;
29131
29132   while (object != null && index < length) {
29133     object = object[toKey$3(path[index++])];
29134   }
29135
29136   return index && index == length ? object : undefined;
29137 }
29138
29139 var _baseGet = baseGet$2;
29140
29141 var baseGet$1 = _baseGet;
29142 /**
29143  * Gets the value at `path` of `object`. If the resolved value is
29144  * `undefined`, the `defaultValue` is returned in its place.
29145  *
29146  * @static
29147  * @memberOf _
29148  * @since 3.7.0
29149  * @category Object
29150  * @param {Object} object The object to query.
29151  * @param {Array|string} path The path of the property to get.
29152  * @param {*} [defaultValue] The value returned for `undefined` resolved values.
29153  * @returns {*} Returns the resolved value.
29154  * @example
29155  *
29156  * var object = { 'a': [{ 'b': { 'c': 3 } }] };
29157  *
29158  * _.get(object, 'a[0].b.c');
29159  * // => 3
29160  *
29161  * _.get(object, ['a', '0', 'b', 'c']);
29162  * // => 3
29163  *
29164  * _.get(object, 'a.b.c', 'default');
29165  * // => 'default'
29166  */
29167
29168 function get$1(object, path, defaultValue) {
29169   var result = object == null ? undefined : baseGet$1(object, path);
29170   return result === undefined ? defaultValue : result;
29171 }
29172
29173 var get_1 = get$1;
29174
29175 /**
29176  * The base implementation of `_.hasIn` without support for deep paths.
29177  *
29178  * @private
29179  * @param {Object} [object] The object to query.
29180  * @param {Array|string} key The key to check.
29181  * @returns {boolean} Returns `true` if `key` exists, else `false`.
29182  */
29183
29184 function baseHasIn$1(object, key) {
29185   return object != null && key in Object(object);
29186 }
29187
29188 var _baseHasIn = baseHasIn$1;
29189
29190 var castPath = _castPath,
29191     isArguments = isArguments_1,
29192     isArray$2 = isArray_1,
29193     isIndex = _isIndex,
29194     isLength = isLength_1,
29195     toKey$2 = _toKey;
29196 /**
29197  * Checks if `path` exists on `object`.
29198  *
29199  * @private
29200  * @param {Object} object The object to query.
29201  * @param {Array|string} path The path to check.
29202  * @param {Function} hasFunc The function to check properties.
29203  * @returns {boolean} Returns `true` if `path` exists, else `false`.
29204  */
29205
29206 function hasPath$1(object, path, hasFunc) {
29207   path = castPath(path, object);
29208   var index = -1,
29209       length = path.length,
29210       result = false;
29211
29212   while (++index < length) {
29213     var key = toKey$2(path[index]);
29214
29215     if (!(result = object != null && hasFunc(object, key))) {
29216       break;
29217     }
29218
29219     object = object[key];
29220   }
29221
29222   if (result || ++index != length) {
29223     return result;
29224   }
29225
29226   length = object == null ? 0 : object.length;
29227   return !!length && isLength(length) && isIndex(key, length) && (isArray$2(object) || isArguments(object));
29228 }
29229
29230 var _hasPath = hasPath$1;
29231
29232 var baseHasIn = _baseHasIn,
29233     hasPath = _hasPath;
29234 /**
29235  * Checks if `path` is a direct or inherited property of `object`.
29236  *
29237  * @static
29238  * @memberOf _
29239  * @since 4.0.0
29240  * @category Object
29241  * @param {Object} object The object to query.
29242  * @param {Array|string} path The path to check.
29243  * @returns {boolean} Returns `true` if `path` exists, else `false`.
29244  * @example
29245  *
29246  * var object = _.create({ 'a': _.create({ 'b': 2 }) });
29247  *
29248  * _.hasIn(object, 'a');
29249  * // => true
29250  *
29251  * _.hasIn(object, 'a.b');
29252  * // => true
29253  *
29254  * _.hasIn(object, ['a', 'b']);
29255  * // => true
29256  *
29257  * _.hasIn(object, 'b');
29258  * // => false
29259  */
29260
29261 function hasIn$1(object, path) {
29262   return object != null && hasPath(object, path, baseHasIn);
29263 }
29264
29265 var hasIn_1 = hasIn$1;
29266
29267 var baseIsEqual = _baseIsEqual,
29268     get = get_1,
29269     hasIn = hasIn_1,
29270     isKey$1 = _isKey,
29271     isStrictComparable = _isStrictComparable,
29272     matchesStrictComparable = _matchesStrictComparable,
29273     toKey$1 = _toKey;
29274 /** Used to compose bitmasks for value comparisons. */
29275
29276 var COMPARE_PARTIAL_FLAG = 1,
29277     COMPARE_UNORDERED_FLAG = 2;
29278 /**
29279  * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
29280  *
29281  * @private
29282  * @param {string} path The path of the property to get.
29283  * @param {*} srcValue The value to match.
29284  * @returns {Function} Returns the new spec function.
29285  */
29286
29287 function baseMatchesProperty$1(path, srcValue) {
29288   if (isKey$1(path) && isStrictComparable(srcValue)) {
29289     return matchesStrictComparable(toKey$1(path), srcValue);
29290   }
29291
29292   return function (object) {
29293     var objValue = get(object, path);
29294     return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
29295   };
29296 }
29297
29298 var _baseMatchesProperty = baseMatchesProperty$1;
29299
29300 /**
29301  * This method returns the first argument it receives.
29302  *
29303  * @static
29304  * @since 0.1.0
29305  * @memberOf _
29306  * @category Util
29307  * @param {*} value Any value.
29308  * @returns {*} Returns `value`.
29309  * @example
29310  *
29311  * var object = { 'a': 1 };
29312  *
29313  * console.log(_.identity(object) === object);
29314  * // => true
29315  */
29316
29317 function identity$3(value) {
29318   return value;
29319 }
29320
29321 var identity_1 = identity$3;
29322
29323 /**
29324  * The base implementation of `_.property` without support for deep paths.
29325  *
29326  * @private
29327  * @param {string} key The key of the property to get.
29328  * @returns {Function} Returns the new accessor function.
29329  */
29330
29331 function baseProperty$1(key) {
29332   return function (object) {
29333     return object == null ? undefined : object[key];
29334   };
29335 }
29336
29337 var _baseProperty = baseProperty$1;
29338
29339 var baseGet = _baseGet;
29340 /**
29341  * A specialized version of `baseProperty` which supports deep paths.
29342  *
29343  * @private
29344  * @param {Array|string} path The path of the property to get.
29345  * @returns {Function} Returns the new accessor function.
29346  */
29347
29348 function basePropertyDeep$1(path) {
29349   return function (object) {
29350     return baseGet(object, path);
29351   };
29352 }
29353
29354 var _basePropertyDeep = basePropertyDeep$1;
29355
29356 var baseProperty = _baseProperty,
29357     basePropertyDeep = _basePropertyDeep,
29358     isKey = _isKey,
29359     toKey = _toKey;
29360 /**
29361  * Creates a function that returns the value at `path` of a given object.
29362  *
29363  * @static
29364  * @memberOf _
29365  * @since 2.4.0
29366  * @category Util
29367  * @param {Array|string} path The path of the property to get.
29368  * @returns {Function} Returns the new accessor function.
29369  * @example
29370  *
29371  * var objects = [
29372  *   { 'a': { 'b': 2 } },
29373  *   { 'a': { 'b': 1 } }
29374  * ];
29375  *
29376  * _.map(objects, _.property('a.b'));
29377  * // => [2, 1]
29378  *
29379  * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
29380  * // => [1, 2]
29381  */
29382
29383 function property$2(path) {
29384   return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
29385 }
29386
29387 var property_1 = property$2;
29388
29389 var baseMatches = _baseMatches,
29390     baseMatchesProperty = _baseMatchesProperty,
29391     identity$2 = identity_1,
29392     isArray$1 = isArray_1,
29393     property$1 = property_1;
29394 /**
29395  * The base implementation of `_.iteratee`.
29396  *
29397  * @private
29398  * @param {*} [value=_.identity] The value to convert to an iteratee.
29399  * @returns {Function} Returns the iteratee.
29400  */
29401
29402 function baseIteratee$2(value) {
29403   // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
29404   // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
29405   if (typeof value == 'function') {
29406     return value;
29407   }
29408
29409   if (value == null) {
29410     return identity$2;
29411   }
29412
29413   if (typeof value == 'object') {
29414     return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
29415   }
29416
29417   return property$1(value);
29418 }
29419
29420 var _baseIteratee = baseIteratee$2;
29421
29422 /**
29423  * The base implementation of `_.findIndex` and `_.findLastIndex` without
29424  * support for iteratee shorthands.
29425  *
29426  * @private
29427  * @param {Array} array The array to inspect.
29428  * @param {Function} predicate The function invoked per iteration.
29429  * @param {number} fromIndex The index to search from.
29430  * @param {boolean} [fromRight] Specify iterating from right to left.
29431  * @returns {number} Returns the index of the matched value, else `-1`.
29432  */
29433
29434 function baseFindIndex$1(array, predicate, fromIndex, fromRight) {
29435   var length = array.length,
29436       index = fromIndex + (fromRight ? 1 : -1);
29437
29438   while (fromRight ? index-- : ++index < length) {
29439     if (predicate(array[index], index, array)) {
29440       return index;
29441     }
29442   }
29443
29444   return -1;
29445 }
29446
29447 var _baseFindIndex = baseFindIndex$1;
29448
29449 /**
29450  * The base implementation of `_.isNaN` without support for number objects.
29451  *
29452  * @private
29453  * @param {*} value The value to check.
29454  * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
29455  */
29456
29457 function baseIsNaN$1(value) {
29458   return value !== value;
29459 }
29460
29461 var _baseIsNaN = baseIsNaN$1;
29462
29463 /**
29464  * A specialized version of `_.indexOf` which performs strict equality
29465  * comparisons of values, i.e. `===`.
29466  *
29467  * @private
29468  * @param {Array} array The array to inspect.
29469  * @param {*} value The value to search for.
29470  * @param {number} fromIndex The index to search from.
29471  * @returns {number} Returns the index of the matched value, else `-1`.
29472  */
29473
29474 function strictIndexOf$1(array, value, fromIndex) {
29475   var index = fromIndex - 1,
29476       length = array.length;
29477
29478   while (++index < length) {
29479     if (array[index] === value) {
29480       return index;
29481     }
29482   }
29483
29484   return -1;
29485 }
29486
29487 var _strictIndexOf = strictIndexOf$1;
29488
29489 var baseFindIndex = _baseFindIndex,
29490     baseIsNaN = _baseIsNaN,
29491     strictIndexOf = _strictIndexOf;
29492 /**
29493  * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
29494  *
29495  * @private
29496  * @param {Array} array The array to inspect.
29497  * @param {*} value The value to search for.
29498  * @param {number} fromIndex The index to search from.
29499  * @returns {number} Returns the index of the matched value, else `-1`.
29500  */
29501
29502 function baseIndexOf$1(array, value, fromIndex) {
29503   return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
29504 }
29505
29506 var _baseIndexOf = baseIndexOf$1;
29507
29508 var baseIndexOf = _baseIndexOf;
29509 /**
29510  * A specialized version of `_.includes` for arrays without support for
29511  * specifying an index to search from.
29512  *
29513  * @private
29514  * @param {Array} [array] The array to inspect.
29515  * @param {*} target The value to search for.
29516  * @returns {boolean} Returns `true` if `target` is found, else `false`.
29517  */
29518
29519 function arrayIncludes$1(array, value) {
29520   var length = array == null ? 0 : array.length;
29521   return !!length && baseIndexOf(array, value, 0) > -1;
29522 }
29523
29524 var _arrayIncludes = arrayIncludes$1;
29525
29526 /**
29527  * This function is like `arrayIncludes` except that it accepts a comparator.
29528  *
29529  * @private
29530  * @param {Array} [array] The array to inspect.
29531  * @param {*} target The value to search for.
29532  * @param {Function} comparator The comparator invoked per element.
29533  * @returns {boolean} Returns `true` if `target` is found, else `false`.
29534  */
29535
29536 function arrayIncludesWith$1(array, value, comparator) {
29537   var index = -1,
29538       length = array == null ? 0 : array.length;
29539
29540   while (++index < length) {
29541     if (comparator(value, array[index])) {
29542       return true;
29543     }
29544   }
29545
29546   return false;
29547 }
29548
29549 var _arrayIncludesWith = arrayIncludesWith$1;
29550
29551 /**
29552  * This method returns `undefined`.
29553  *
29554  * @static
29555  * @memberOf _
29556  * @since 2.3.0
29557  * @category Util
29558  * @example
29559  *
29560  * _.times(2, _.noop);
29561  * // => [undefined, undefined]
29562  */
29563
29564 function noop$2() {// No operation performed.
29565 }
29566
29567 var noop_1 = noop$2;
29568
29569 var Set$1 = _Set,
29570     noop$1 = noop_1,
29571     setToArray$1 = _setToArray;
29572 /** Used as references for various `Number` constants. */
29573
29574 var INFINITY = 1 / 0;
29575 /**
29576  * Creates a set object of `values`.
29577  *
29578  * @private
29579  * @param {Array} values The values to add to the set.
29580  * @returns {Object} Returns the new set.
29581  */
29582
29583 var createSet$1 = !(Set$1 && 1 / setToArray$1(new Set$1([, -0]))[1] == INFINITY) ? noop$1 : function (values) {
29584   return new Set$1(values);
29585 };
29586 var _createSet = createSet$1;
29587
29588 var SetCache = _SetCache,
29589     arrayIncludes = _arrayIncludes,
29590     arrayIncludesWith = _arrayIncludesWith,
29591     cacheHas = _cacheHas,
29592     createSet = _createSet,
29593     setToArray = _setToArray;
29594 /** Used as the size to enable large array optimizations. */
29595
29596 var LARGE_ARRAY_SIZE = 200;
29597 /**
29598  * The base implementation of `_.uniqBy` without support for iteratee shorthands.
29599  *
29600  * @private
29601  * @param {Array} array The array to inspect.
29602  * @param {Function} [iteratee] The iteratee invoked per element.
29603  * @param {Function} [comparator] The comparator invoked per element.
29604  * @returns {Array} Returns the new duplicate free array.
29605  */
29606
29607 function baseUniq$1(array, iteratee, comparator) {
29608   var index = -1,
29609       includes = arrayIncludes,
29610       length = array.length,
29611       isCommon = true,
29612       result = [],
29613       seen = result;
29614
29615   if (comparator) {
29616     isCommon = false;
29617     includes = arrayIncludesWith;
29618   } else if (length >= LARGE_ARRAY_SIZE) {
29619     var set = iteratee ? null : createSet(array);
29620
29621     if (set) {
29622       return setToArray(set);
29623     }
29624
29625     isCommon = false;
29626     includes = cacheHas;
29627     seen = new SetCache();
29628   } else {
29629     seen = iteratee ? [] : result;
29630   }
29631
29632   outer: while (++index < length) {
29633     var value = array[index],
29634         computed = iteratee ? iteratee(value) : value;
29635     value = comparator || value !== 0 ? value : 0;
29636
29637     if (isCommon && computed === computed) {
29638       var seenIndex = seen.length;
29639
29640       while (seenIndex--) {
29641         if (seen[seenIndex] === computed) {
29642           continue outer;
29643         }
29644       }
29645
29646       if (iteratee) {
29647         seen.push(computed);
29648       }
29649
29650       result.push(value);
29651     } else if (!includes(seen, computed, comparator)) {
29652       if (seen !== result) {
29653         seen.push(computed);
29654       }
29655
29656       result.push(value);
29657     }
29658   }
29659
29660   return result;
29661 }
29662
29663 var _baseUniq = baseUniq$1;
29664
29665 var baseIteratee$1 = _baseIteratee,
29666     baseUniq = _baseUniq;
29667 /**
29668  * This method is like `_.uniq` except that it accepts `iteratee` which is
29669  * invoked for each element in `array` to generate the criterion by which
29670  * uniqueness is computed. The order of result values is determined by the
29671  * order they occur in the array. The iteratee is invoked with one argument:
29672  * (value).
29673  *
29674  * @static
29675  * @memberOf _
29676  * @since 4.0.0
29677  * @category Array
29678  * @param {Array} array The array to inspect.
29679  * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
29680  * @returns {Array} Returns the new duplicate free array.
29681  * @example
29682  *
29683  * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
29684  * // => [2.1, 1.2]
29685  *
29686  * // The `_.property` iteratee shorthand.
29687  * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
29688  * // => [{ 'x': 1 }, { 'x': 2 }]
29689  */
29690
29691 function uniqBy$1(array, iteratee) {
29692   return array && array.length ? baseUniq(array, baseIteratee$1(iteratee)) : [];
29693 }
29694
29695 var uniqBy_1 = uniqBy$1;
29696
29697 /**
29698  * A specialized version of `baseAggregator` for arrays.
29699  *
29700  * @private
29701  * @param {Array} [array] The array to iterate over.
29702  * @param {Function} setter The function to set `accumulator` values.
29703  * @param {Function} iteratee The iteratee to transform keys.
29704  * @param {Object} accumulator The initial aggregated object.
29705  * @returns {Function} Returns `accumulator`.
29706  */
29707
29708 function arrayAggregator$1(array, setter, iteratee, accumulator) {
29709   var index = -1,
29710       length = array == null ? 0 : array.length;
29711
29712   while (++index < length) {
29713     var value = array[index];
29714     setter(accumulator, value, iteratee(value), array);
29715   }
29716
29717   return accumulator;
29718 }
29719
29720 var _arrayAggregator = arrayAggregator$1;
29721
29722 /**
29723  * Creates a base function for methods like `_.forIn` and `_.forOwn`.
29724  *
29725  * @private
29726  * @param {boolean} [fromRight] Specify iterating from right to left.
29727  * @returns {Function} Returns the new base function.
29728  */
29729
29730 function createBaseFor$1(fromRight) {
29731   return function (object, iteratee, keysFunc) {
29732     var index = -1,
29733         iterable = Object(object),
29734         props = keysFunc(object),
29735         length = props.length;
29736
29737     while (length--) {
29738       var key = props[fromRight ? length : ++index];
29739
29740       if (iteratee(iterable[key], key, iterable) === false) {
29741         break;
29742       }
29743     }
29744
29745     return object;
29746   };
29747 }
29748
29749 var _createBaseFor = createBaseFor$1;
29750
29751 var createBaseFor = _createBaseFor;
29752 /**
29753  * The base implementation of `baseForOwn` which iterates over `object`
29754  * properties returned by `keysFunc` and invokes `iteratee` for each property.
29755  * Iteratee functions may exit iteration early by explicitly returning `false`.
29756  *
29757  * @private
29758  * @param {Object} object The object to iterate over.
29759  * @param {Function} iteratee The function invoked per iteration.
29760  * @param {Function} keysFunc The function to get the keys of `object`.
29761  * @returns {Object} Returns `object`.
29762  */
29763
29764 var baseFor$1 = createBaseFor();
29765 var _baseFor = baseFor$1;
29766
29767 var baseFor = _baseFor,
29768     keys = keys_1;
29769 /**
29770  * The base implementation of `_.forOwn` without support for iteratee shorthands.
29771  *
29772  * @private
29773  * @param {Object} object The object to iterate over.
29774  * @param {Function} iteratee The function invoked per iteration.
29775  * @returns {Object} Returns `object`.
29776  */
29777
29778 function baseForOwn$1(object, iteratee) {
29779   return object && baseFor(object, iteratee, keys);
29780 }
29781
29782 var _baseForOwn = baseForOwn$1;
29783
29784 var isArrayLike = isArrayLike_1;
29785 /**
29786  * Creates a `baseEach` or `baseEachRight` function.
29787  *
29788  * @private
29789  * @param {Function} eachFunc The function to iterate over a collection.
29790  * @param {boolean} [fromRight] Specify iterating from right to left.
29791  * @returns {Function} Returns the new base function.
29792  */
29793
29794 function createBaseEach$1(eachFunc, fromRight) {
29795   return function (collection, iteratee) {
29796     if (collection == null) {
29797       return collection;
29798     }
29799
29800     if (!isArrayLike(collection)) {
29801       return eachFunc(collection, iteratee);
29802     }
29803
29804     var length = collection.length,
29805         index = fromRight ? length : -1,
29806         iterable = Object(collection);
29807
29808     while (fromRight ? index-- : ++index < length) {
29809       if (iteratee(iterable[index], index, iterable) === false) {
29810         break;
29811       }
29812     }
29813
29814     return collection;
29815   };
29816 }
29817
29818 var _createBaseEach = createBaseEach$1;
29819
29820 var baseForOwn = _baseForOwn,
29821     createBaseEach = _createBaseEach;
29822 /**
29823  * The base implementation of `_.forEach` without support for iteratee shorthands.
29824  *
29825  * @private
29826  * @param {Array|Object} collection The collection to iterate over.
29827  * @param {Function} iteratee The function invoked per iteration.
29828  * @returns {Array|Object} Returns `collection`.
29829  */
29830
29831 var baseEach$1 = createBaseEach(baseForOwn);
29832 var _baseEach = baseEach$1;
29833
29834 var baseEach = _baseEach;
29835 /**
29836  * Aggregates elements of `collection` on `accumulator` with keys transformed
29837  * by `iteratee` and values set by `setter`.
29838  *
29839  * @private
29840  * @param {Array|Object} collection The collection to iterate over.
29841  * @param {Function} setter The function to set `accumulator` values.
29842  * @param {Function} iteratee The iteratee to transform keys.
29843  * @param {Object} accumulator The initial aggregated object.
29844  * @returns {Function} Returns `accumulator`.
29845  */
29846
29847 function baseAggregator$1(collection, setter, iteratee, accumulator) {
29848   baseEach(collection, function (value, key, collection) {
29849     setter(accumulator, value, iteratee(value), collection);
29850   });
29851   return accumulator;
29852 }
29853
29854 var _baseAggregator = baseAggregator$1;
29855
29856 var arrayAggregator = _arrayAggregator,
29857     baseAggregator = _baseAggregator,
29858     baseIteratee = _baseIteratee,
29859     isArray = isArray_1;
29860 /**
29861  * Creates a function like `_.groupBy`.
29862  *
29863  * @private
29864  * @param {Function} setter The function to set accumulator values.
29865  * @param {Function} [initializer] The accumulator object initializer.
29866  * @returns {Function} Returns the new aggregator function.
29867  */
29868
29869 function createAggregator$1(setter, initializer) {
29870   return function (collection, iteratee) {
29871     var func = isArray(collection) ? arrayAggregator : baseAggregator,
29872         accumulator = initializer ? initializer() : {};
29873     return func(collection, setter, baseIteratee(iteratee), accumulator);
29874   };
29875 }
29876
29877 var _createAggregator = createAggregator$1;
29878
29879 var createAggregator = _createAggregator;
29880 /**
29881  * Creates an array of elements split into two groups, the first of which
29882  * contains elements `predicate` returns truthy for, the second of which
29883  * contains elements `predicate` returns falsey for. The predicate is
29884  * invoked with one argument: (value).
29885  *
29886  * @static
29887  * @memberOf _
29888  * @since 3.0.0
29889  * @category Collection
29890  * @param {Array|Object} collection The collection to iterate over.
29891  * @param {Function} [predicate=_.identity] The function invoked per iteration.
29892  * @returns {Array} Returns the array of grouped elements.
29893  * @example
29894  *
29895  * var users = [
29896  *   { 'user': 'barney',  'age': 36, 'active': false },
29897  *   { 'user': 'fred',    'age': 40, 'active': true },
29898  *   { 'user': 'pebbles', 'age': 1,  'active': false }
29899  * ];
29900  *
29901  * _.partition(users, function(o) { return o.active; });
29902  * // => objects for [['fred'], ['barney', 'pebbles']]
29903  *
29904  * // The `_.matches` iteratee shorthand.
29905  * _.partition(users, { 'age': 1, 'active': false });
29906  * // => objects for [['pebbles'], ['barney', 'fred']]
29907  *
29908  * // The `_.matchesProperty` iteratee shorthand.
29909  * _.partition(users, ['active', false]);
29910  * // => objects for [['barney', 'pebbles'], ['fred']]
29911  *
29912  * // The `_.property` iteratee shorthand.
29913  * _.partition(users, 'active');
29914  * // => objects for [['fred'], ['barney', 'pebbles']]
29915  */
29916
29917 var partition$1 = createAggregator(function (result, value, key) {
29918   result[key ? 0 : 1].push(value);
29919 }, function () {
29920   return [[], []];
29921 });
29922 var partition_1 = partition$1;
29923
29924 var globby$2 = {exports: {}};
29925
29926 var arrayUnion$1 = (...arguments_) => {
29927   return [...new Set([].concat(...arguments_))];
29928 };
29929
29930 /*
29931  * merge2
29932  * https://github.com/teambition/merge2
29933  *
29934  * Copyright (c) 2014-2020 Teambition
29935  * Licensed under the MIT license.
29936  */
29937
29938
29939 const Stream = require$$0__default$5["default"];
29940 const PassThrough = Stream.PassThrough;
29941 const slice = Array.prototype.slice;
29942 var merge2_1 = merge2$2;
29943
29944 function merge2$2() {
29945   const streamsQueue = [];
29946   const args = slice.call(arguments);
29947   let merging = false;
29948   let options = args[args.length - 1];
29949
29950   if (options && !Array.isArray(options) && options.pipe == null) {
29951     args.pop();
29952   } else {
29953     options = {};
29954   }
29955
29956   const doEnd = options.end !== false;
29957   const doPipeError = options.pipeError === true;
29958
29959   if (options.objectMode == null) {
29960     options.objectMode = true;
29961   }
29962
29963   if (options.highWaterMark == null) {
29964     options.highWaterMark = 64 * 1024;
29965   }
29966
29967   const mergedStream = PassThrough(options);
29968
29969   function addStream() {
29970     for (let i = 0, len = arguments.length; i < len; i++) {
29971       streamsQueue.push(pauseStreams(arguments[i], options));
29972     }
29973
29974     mergeStream();
29975     return this;
29976   }
29977
29978   function mergeStream() {
29979     if (merging) {
29980       return;
29981     }
29982
29983     merging = true;
29984     let streams = streamsQueue.shift();
29985
29986     if (!streams) {
29987       process.nextTick(endStream);
29988       return;
29989     }
29990
29991     if (!Array.isArray(streams)) {
29992       streams = [streams];
29993     }
29994
29995     let pipesCount = streams.length + 1;
29996
29997     function next() {
29998       if (--pipesCount > 0) {
29999         return;
30000       }
30001
30002       merging = false;
30003       mergeStream();
30004     }
30005
30006     function pipe(stream) {
30007       function onend() {
30008         stream.removeListener('merge2UnpipeEnd', onend);
30009         stream.removeListener('end', onend);
30010
30011         if (doPipeError) {
30012           stream.removeListener('error', onerror);
30013         }
30014
30015         next();
30016       }
30017
30018       function onerror(err) {
30019         mergedStream.emit('error', err);
30020       } // skip ended stream
30021
30022
30023       if (stream._readableState.endEmitted) {
30024         return next();
30025       }
30026
30027       stream.on('merge2UnpipeEnd', onend);
30028       stream.on('end', onend);
30029
30030       if (doPipeError) {
30031         stream.on('error', onerror);
30032       }
30033
30034       stream.pipe(mergedStream, {
30035         end: false
30036       }); // compatible for old stream
30037
30038       stream.resume();
30039     }
30040
30041     for (let i = 0; i < streams.length; i++) {
30042       pipe(streams[i]);
30043     }
30044
30045     next();
30046   }
30047
30048   function endStream() {
30049     merging = false; // emit 'queueDrain' when all streams merged.
30050
30051     mergedStream.emit('queueDrain');
30052
30053     if (doEnd) {
30054       mergedStream.end();
30055     }
30056   }
30057
30058   mergedStream.setMaxListeners(0);
30059   mergedStream.add = addStream;
30060   mergedStream.on('unpipe', function (stream) {
30061     stream.emit('merge2UnpipeEnd');
30062   });
30063
30064   if (args.length) {
30065     addStream.apply(null, args);
30066   }
30067
30068   return mergedStream;
30069 } // check and pause streams for pipe.
30070
30071
30072 function pauseStreams(streams, options) {
30073   if (!Array.isArray(streams)) {
30074     // Backwards-compat with old-style streams
30075     if (!streams._readableState && streams.pipe) {
30076       streams = streams.pipe(PassThrough(options));
30077     }
30078
30079     if (!streams._readableState || !streams.pause || !streams.pipe) {
30080       throw new Error('Only readable stream can be merged.');
30081     }
30082
30083     streams.pause();
30084   } else {
30085     for (let i = 0, len = streams.length; i < len; i++) {
30086       streams[i] = pauseStreams(streams[i], options);
30087     }
30088   }
30089
30090   return streams;
30091 }
30092
30093 var tasks = {};
30094
30095 var utils$r = {};
30096
30097 var array$2 = {};
30098
30099 Object.defineProperty(array$2, "__esModule", {
30100   value: true
30101 });
30102 array$2.splitWhen = array$2.flatten = void 0;
30103
30104 function flatten(items) {
30105   return items.reduce((collection, item) => [].concat(collection, item), []);
30106 }
30107
30108 array$2.flatten = flatten;
30109
30110 function splitWhen(items, predicate) {
30111   const result = [[]];
30112   let groupIndex = 0;
30113
30114   for (const item of items) {
30115     if (predicate(item)) {
30116       groupIndex++;
30117       result[groupIndex] = [];
30118     } else {
30119       result[groupIndex].push(item);
30120     }
30121   }
30122
30123   return result;
30124 }
30125
30126 array$2.splitWhen = splitWhen;
30127
30128 var errno$1 = {};
30129
30130 Object.defineProperty(errno$1, "__esModule", {
30131   value: true
30132 });
30133 errno$1.isEnoentCodeError = void 0;
30134
30135 function isEnoentCodeError(error) {
30136   return error.code === 'ENOENT';
30137 }
30138
30139 errno$1.isEnoentCodeError = isEnoentCodeError;
30140
30141 var fs$b = {};
30142
30143 Object.defineProperty(fs$b, "__esModule", {
30144   value: true
30145 });
30146 fs$b.createDirentFromStats = void 0;
30147
30148 class DirentFromStats$1 {
30149   constructor(name, stats) {
30150     this.name = name;
30151     this.isBlockDevice = stats.isBlockDevice.bind(stats);
30152     this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
30153     this.isDirectory = stats.isDirectory.bind(stats);
30154     this.isFIFO = stats.isFIFO.bind(stats);
30155     this.isFile = stats.isFile.bind(stats);
30156     this.isSocket = stats.isSocket.bind(stats);
30157     this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
30158   }
30159
30160 }
30161
30162 function createDirentFromStats$1(name, stats) {
30163   return new DirentFromStats$1(name, stats);
30164 }
30165
30166 fs$b.createDirentFromStats = createDirentFromStats$1;
30167
30168 var path$c = {};
30169
30170 Object.defineProperty(path$c, "__esModule", {
30171   value: true
30172 });
30173 path$c.removeLeadingDotSegment = path$c.escape = path$c.makeAbsolute = path$c.unixify = void 0;
30174 const path$b = require$$0__default$2["default"];
30175 const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
30176
30177 const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
30178 /**
30179  * Designed to work only with simple paths: `dir\\file`.
30180  */
30181
30182 function unixify(filepath) {
30183   return filepath.replace(/\\/g, '/');
30184 }
30185
30186 path$c.unixify = unixify;
30187
30188 function makeAbsolute(cwd, filepath) {
30189   return path$b.resolve(cwd, filepath);
30190 }
30191
30192 path$c.makeAbsolute = makeAbsolute;
30193
30194 function escape(pattern) {
30195   return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
30196 }
30197
30198 path$c.escape = escape;
30199
30200 function removeLeadingDotSegment(entry) {
30201   // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
30202   // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
30203   if (entry.charAt(0) === '.') {
30204     const secondCharactery = entry.charAt(1);
30205
30206     if (secondCharactery === '/' || secondCharactery === '\\') {
30207       return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
30208     }
30209   }
30210
30211   return entry;
30212 }
30213
30214 path$c.removeLeadingDotSegment = removeLeadingDotSegment;
30215
30216 var pattern$1 = {};
30217
30218 /*!
30219  * is-extglob <https://github.com/jonschlinkert/is-extglob>
30220  *
30221  * Copyright (c) 2014-2016, Jon Schlinkert.
30222  * Licensed under the MIT License.
30223  */
30224
30225 var isExtglob$1 = function isExtglob(str) {
30226   if (typeof str !== 'string' || str === '') {
30227     return false;
30228   }
30229
30230   var match;
30231
30232   while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
30233     if (match[2]) return true;
30234     str = str.slice(match.index + match[0].length);
30235   }
30236
30237   return false;
30238 };
30239
30240 /*!
30241  * is-glob <https://github.com/jonschlinkert/is-glob>
30242  *
30243  * Copyright (c) 2014-2017, Jon Schlinkert.
30244  * Released under the MIT License.
30245  */
30246 var isExtglob = isExtglob$1;
30247 var chars$1 = {
30248   '{': '}',
30249   '(': ')',
30250   '[': ']'
30251 };
30252
30253 var strictCheck = function (str) {
30254   if (str[0] === '!') {
30255     return true;
30256   }
30257
30258   var index = 0;
30259   var pipeIndex = -2;
30260   var closeSquareIndex = -2;
30261   var closeCurlyIndex = -2;
30262   var closeParenIndex = -2;
30263   var backSlashIndex = -2;
30264
30265   while (index < str.length) {
30266     if (str[index] === '*') {
30267       return true;
30268     }
30269
30270     if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) {
30271       return true;
30272     }
30273
30274     if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') {
30275       if (closeSquareIndex < index) {
30276         closeSquareIndex = str.indexOf(']', index);
30277       }
30278
30279       if (closeSquareIndex > index) {
30280         if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
30281           return true;
30282         }
30283
30284         backSlashIndex = str.indexOf('\\', index);
30285
30286         if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
30287           return true;
30288         }
30289       }
30290     }
30291
30292     if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') {
30293       closeCurlyIndex = str.indexOf('}', index);
30294
30295       if (closeCurlyIndex > index) {
30296         backSlashIndex = str.indexOf('\\', index);
30297
30298         if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
30299           return true;
30300         }
30301       }
30302     }
30303
30304     if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') {
30305       closeParenIndex = str.indexOf(')', index);
30306
30307       if (closeParenIndex > index) {
30308         backSlashIndex = str.indexOf('\\', index);
30309
30310         if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
30311           return true;
30312         }
30313       }
30314     }
30315
30316     if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') {
30317       if (pipeIndex < index) {
30318         pipeIndex = str.indexOf('|', index);
30319       }
30320
30321       if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') {
30322         closeParenIndex = str.indexOf(')', pipeIndex);
30323
30324         if (closeParenIndex > pipeIndex) {
30325           backSlashIndex = str.indexOf('\\', pipeIndex);
30326
30327           if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
30328             return true;
30329           }
30330         }
30331       }
30332     }
30333
30334     if (str[index] === '\\') {
30335       var open = str[index + 1];
30336       index += 2;
30337       var close = chars$1[open];
30338
30339       if (close) {
30340         var n = str.indexOf(close, index);
30341
30342         if (n !== -1) {
30343           index = n + 1;
30344         }
30345       }
30346
30347       if (str[index] === '!') {
30348         return true;
30349       }
30350     } else {
30351       index++;
30352     }
30353   }
30354
30355   return false;
30356 };
30357
30358 var relaxedCheck = function (str) {
30359   if (str[0] === '!') {
30360     return true;
30361   }
30362
30363   var index = 0;
30364
30365   while (index < str.length) {
30366     if (/[*?{}()[\]]/.test(str[index])) {
30367       return true;
30368     }
30369
30370     if (str[index] === '\\') {
30371       var open = str[index + 1];
30372       index += 2;
30373       var close = chars$1[open];
30374
30375       if (close) {
30376         var n = str.indexOf(close, index);
30377
30378         if (n !== -1) {
30379           index = n + 1;
30380         }
30381       }
30382
30383       if (str[index] === '!') {
30384         return true;
30385       }
30386     } else {
30387       index++;
30388     }
30389   }
30390
30391   return false;
30392 };
30393
30394 var isGlob$1 = function isGlob(str, options) {
30395   if (typeof str !== 'string' || str === '') {
30396     return false;
30397   }
30398
30399   if (isExtglob(str)) {
30400     return true;
30401   }
30402
30403   var check = strictCheck; // optionally relax check
30404
30405   if (options && options.strict === false) {
30406     check = relaxedCheck;
30407   }
30408
30409   return check(str);
30410 };
30411
30412 var isGlob = isGlob$1;
30413 var pathPosixDirname = require$$0__default$2["default"].posix.dirname;
30414 var isWin32 = require$$0__default$1["default"].platform() === 'win32';
30415 var slash$2 = '/';
30416 var backslash = /\\/g;
30417 var enclosure = /[\{\[].*[\}\]]$/;
30418 var globby$1 = /(^|[^\\])([\{\[]|\([^\)]+$)/;
30419 var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
30420 /**
30421  * @param {string} str
30422  * @param {Object} opts
30423  * @param {boolean} [opts.flipBackslashes=true]
30424  * @returns {string}
30425  */
30426
30427 var globParent$1 = function globParent(str, opts) {
30428   var options = Object.assign({
30429     flipBackslashes: true
30430   }, opts); // flip windows path separators
30431
30432   if (options.flipBackslashes && isWin32 && str.indexOf(slash$2) < 0) {
30433     str = str.replace(backslash, slash$2);
30434   } // special case for strings ending in enclosure containing path separator
30435
30436
30437   if (enclosure.test(str)) {
30438     str += slash$2;
30439   } // preserves full path in case of trailing path separator
30440
30441
30442   str += 'a'; // remove path parts that are globby
30443
30444   do {
30445     str = pathPosixDirname(str);
30446   } while (isGlob(str) || globby$1.test(str)); // remove escape chars and return result
30447
30448
30449   return str.replace(escaped, '$1');
30450 };
30451
30452 var utils$q = {};
30453
30454 (function (exports) {
30455
30456   exports.isInteger = num => {
30457     if (typeof num === 'number') {
30458       return Number.isInteger(num);
30459     }
30460
30461     if (typeof num === 'string' && num.trim() !== '') {
30462       return Number.isInteger(Number(num));
30463     }
30464
30465     return false;
30466   };
30467   /**
30468    * Find a node of the given type
30469    */
30470
30471
30472   exports.find = (node, type) => node.nodes.find(node => node.type === type);
30473   /**
30474    * Find a node of the given type
30475    */
30476
30477
30478   exports.exceedsLimit = (min, max, step = 1, limit) => {
30479     if (limit === false) return false;
30480     if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
30481     return (Number(max) - Number(min)) / Number(step) >= limit;
30482   };
30483   /**
30484    * Escape the given node with '\\' before node.value
30485    */
30486
30487
30488   exports.escapeNode = (block, n = 0, type) => {
30489     let node = block.nodes[n];
30490     if (!node) return;
30491
30492     if (type && node.type === type || node.type === 'open' || node.type === 'close') {
30493       if (node.escaped !== true) {
30494         node.value = '\\' + node.value;
30495         node.escaped = true;
30496       }
30497     }
30498   };
30499   /**
30500    * Returns true if the given brace node should be enclosed in literal braces
30501    */
30502
30503
30504   exports.encloseBrace = node => {
30505     if (node.type !== 'brace') return false;
30506
30507     if (node.commas >> 0 + node.ranges >> 0 === 0) {
30508       node.invalid = true;
30509       return true;
30510     }
30511
30512     return false;
30513   };
30514   /**
30515    * Returns true if a brace node is invalid.
30516    */
30517
30518
30519   exports.isInvalidBrace = block => {
30520     if (block.type !== 'brace') return false;
30521     if (block.invalid === true || block.dollar) return true;
30522
30523     if (block.commas >> 0 + block.ranges >> 0 === 0) {
30524       block.invalid = true;
30525       return true;
30526     }
30527
30528     if (block.open !== true || block.close !== true) {
30529       block.invalid = true;
30530       return true;
30531     }
30532
30533     return false;
30534   };
30535   /**
30536    * Returns true if a node is an open or close node
30537    */
30538
30539
30540   exports.isOpenOrClose = node => {
30541     if (node.type === 'open' || node.type === 'close') {
30542       return true;
30543     }
30544
30545     return node.open === true || node.close === true;
30546   };
30547   /**
30548    * Reduce an array of text nodes.
30549    */
30550
30551
30552   exports.reduce = nodes => nodes.reduce((acc, node) => {
30553     if (node.type === 'text') acc.push(node.value);
30554     if (node.type === 'range') node.type = 'text';
30555     return acc;
30556   }, []);
30557   /**
30558    * Flatten an array
30559    */
30560
30561
30562   exports.flatten = (...args) => {
30563     const result = [];
30564
30565     const flat = arr => {
30566       for (let i = 0; i < arr.length; i++) {
30567         let ele = arr[i];
30568         Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
30569       }
30570
30571       return result;
30572     };
30573
30574     flat(args);
30575     return result;
30576   };
30577 })(utils$q);
30578
30579 const utils$p = utils$q;
30580
30581 var stringify$5 = (ast, options = {}) => {
30582   let stringify = (node, parent = {}) => {
30583     let invalidBlock = options.escapeInvalid && utils$p.isInvalidBrace(parent);
30584     let invalidNode = node.invalid === true && options.escapeInvalid === true;
30585     let output = '';
30586
30587     if (node.value) {
30588       if ((invalidBlock || invalidNode) && utils$p.isOpenOrClose(node)) {
30589         return '\\' + node.value;
30590       }
30591
30592       return node.value;
30593     }
30594
30595     if (node.value) {
30596       return node.value;
30597     }
30598
30599     if (node.nodes) {
30600       for (let child of node.nodes) {
30601         output += stringify(child);
30602       }
30603     }
30604
30605     return output;
30606   };
30607
30608   return stringify(ast);
30609 };
30610
30611 /*!
30612  * is-number <https://github.com/jonschlinkert/is-number>
30613  *
30614  * Copyright (c) 2014-present, Jon Schlinkert.
30615  * Released under the MIT License.
30616  */
30617
30618 var isNumber$2 = function (num) {
30619   if (typeof num === 'number') {
30620     return num - num === 0;
30621   }
30622
30623   if (typeof num === 'string' && num.trim() !== '') {
30624     return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
30625   }
30626
30627   return false;
30628 };
30629
30630 const isNumber$1 = isNumber$2;
30631
30632 const toRegexRange$1 = (min, max, options) => {
30633   if (isNumber$1(min) === false) {
30634     throw new TypeError('toRegexRange: expected the first argument to be a number');
30635   }
30636
30637   if (max === void 0 || min === max) {
30638     return String(min);
30639   }
30640
30641   if (isNumber$1(max) === false) {
30642     throw new TypeError('toRegexRange: expected the second argument to be a number.');
30643   }
30644
30645   let opts = Object.assign({
30646     relaxZeros: true
30647   }, options);
30648
30649   if (typeof opts.strictZeros === 'boolean') {
30650     opts.relaxZeros = opts.strictZeros === false;
30651   }
30652
30653   let relax = String(opts.relaxZeros);
30654   let shorthand = String(opts.shorthand);
30655   let capture = String(opts.capture);
30656   let wrap = String(opts.wrap);
30657   let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
30658
30659   if (toRegexRange$1.cache.hasOwnProperty(cacheKey)) {
30660     return toRegexRange$1.cache[cacheKey].result;
30661   }
30662
30663   let a = Math.min(min, max);
30664   let b = Math.max(min, max);
30665
30666   if (Math.abs(a - b) === 1) {
30667     let result = min + '|' + max;
30668
30669     if (opts.capture) {
30670       return `(${result})`;
30671     }
30672
30673     if (opts.wrap === false) {
30674       return result;
30675     }
30676
30677     return `(?:${result})`;
30678   }
30679
30680   let isPadded = hasPadding(min) || hasPadding(max);
30681   let state = {
30682     min,
30683     max,
30684     a,
30685     b
30686   };
30687   let positives = [];
30688   let negatives = [];
30689
30690   if (isPadded) {
30691     state.isPadded = isPadded;
30692     state.maxLen = String(state.max).length;
30693   }
30694
30695   if (a < 0) {
30696     let newMin = b < 0 ? Math.abs(b) : 1;
30697     negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
30698     a = state.a = 0;
30699   }
30700
30701   if (b >= 0) {
30702     positives = splitToPatterns(a, b, state, opts);
30703   }
30704
30705   state.negatives = negatives;
30706   state.positives = positives;
30707   state.result = collatePatterns(negatives, positives);
30708
30709   if (opts.capture === true) {
30710     state.result = `(${state.result})`;
30711   } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
30712     state.result = `(?:${state.result})`;
30713   }
30714
30715   toRegexRange$1.cache[cacheKey] = state;
30716   return state.result;
30717 };
30718
30719 function collatePatterns(neg, pos, options) {
30720   let onlyNegative = filterPatterns(neg, pos, '-', false) || [];
30721   let onlyPositive = filterPatterns(pos, neg, '', false) || [];
30722   let intersected = filterPatterns(neg, pos, '-?', true) || [];
30723   let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
30724   return subpatterns.join('|');
30725 }
30726
30727 function splitToRanges(min, max) {
30728   let nines = 1;
30729   let zeros = 1;
30730   let stop = countNines(min, nines);
30731   let stops = new Set([max]);
30732
30733   while (min <= stop && stop <= max) {
30734     stops.add(stop);
30735     nines += 1;
30736     stop = countNines(min, nines);
30737   }
30738
30739   stop = countZeros(max + 1, zeros) - 1;
30740
30741   while (min < stop && stop <= max) {
30742     stops.add(stop);
30743     zeros += 1;
30744     stop = countZeros(max + 1, zeros) - 1;
30745   }
30746
30747   stops = [...stops];
30748   stops.sort(compare);
30749   return stops;
30750 }
30751 /**
30752  * Convert a range to a regex pattern
30753  * @param {Number} `start`
30754  * @param {Number} `stop`
30755  * @return {String}
30756  */
30757
30758
30759 function rangeToPattern(start, stop, options) {
30760   if (start === stop) {
30761     return {
30762       pattern: start,
30763       count: [],
30764       digits: 0
30765     };
30766   }
30767
30768   let zipped = zip(start, stop);
30769   let digits = zipped.length;
30770   let pattern = '';
30771   let count = 0;
30772
30773   for (let i = 0; i < digits; i++) {
30774     let [startDigit, stopDigit] = zipped[i];
30775
30776     if (startDigit === stopDigit) {
30777       pattern += startDigit;
30778     } else if (startDigit !== '0' || stopDigit !== '9') {
30779       pattern += toCharacterClass(startDigit, stopDigit);
30780     } else {
30781       count++;
30782     }
30783   }
30784
30785   if (count) {
30786     pattern += options.shorthand === true ? '\\d' : '[0-9]';
30787   }
30788
30789   return {
30790     pattern,
30791     count: [count],
30792     digits
30793   };
30794 }
30795
30796 function splitToPatterns(min, max, tok, options) {
30797   let ranges = splitToRanges(min, max);
30798   let tokens = [];
30799   let start = min;
30800   let prev;
30801
30802   for (let i = 0; i < ranges.length; i++) {
30803     let max = ranges[i];
30804     let obj = rangeToPattern(String(start), String(max), options);
30805     let zeros = '';
30806
30807     if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
30808       if (prev.count.length > 1) {
30809         prev.count.pop();
30810       }
30811
30812       prev.count.push(obj.count[0]);
30813       prev.string = prev.pattern + toQuantifier(prev.count);
30814       start = max + 1;
30815       continue;
30816     }
30817
30818     if (tok.isPadded) {
30819       zeros = padZeros(max, tok, options);
30820     }
30821
30822     obj.string = zeros + obj.pattern + toQuantifier(obj.count);
30823     tokens.push(obj);
30824     start = max + 1;
30825     prev = obj;
30826   }
30827
30828   return tokens;
30829 }
30830
30831 function filterPatterns(arr, comparison, prefix, intersection, options) {
30832   let result = [];
30833
30834   for (let ele of arr) {
30835     let {
30836       string
30837     } = ele; // only push if _both_ are negative...
30838
30839     if (!intersection && !contains(comparison, 'string', string)) {
30840       result.push(prefix + string);
30841     } // or _both_ are positive
30842
30843
30844     if (intersection && contains(comparison, 'string', string)) {
30845       result.push(prefix + string);
30846     }
30847   }
30848
30849   return result;
30850 }
30851 /**
30852  * Zip strings
30853  */
30854
30855
30856 function zip(a, b) {
30857   let arr = [];
30858
30859   for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
30860
30861   return arr;
30862 }
30863
30864 function compare(a, b) {
30865   return a > b ? 1 : b > a ? -1 : 0;
30866 }
30867
30868 function contains(arr, key, val) {
30869   return arr.some(ele => ele[key] === val);
30870 }
30871
30872 function countNines(min, len) {
30873   return Number(String(min).slice(0, -len) + '9'.repeat(len));
30874 }
30875
30876 function countZeros(integer, zeros) {
30877   return integer - integer % Math.pow(10, zeros);
30878 }
30879
30880 function toQuantifier(digits) {
30881   let [start = 0, stop = ''] = digits;
30882
30883   if (stop || start > 1) {
30884     return `{${start + (stop ? ',' + stop : '')}}`;
30885   }
30886
30887   return '';
30888 }
30889
30890 function toCharacterClass(a, b, options) {
30891   return `[${a}${b - a === 1 ? '' : '-'}${b}]`;
30892 }
30893
30894 function hasPadding(str) {
30895   return /^-?(0+)\d/.test(str);
30896 }
30897
30898 function padZeros(value, tok, options) {
30899   if (!tok.isPadded) {
30900     return value;
30901   }
30902
30903   let diff = Math.abs(tok.maxLen - String(value).length);
30904   let relax = options.relaxZeros !== false;
30905
30906   switch (diff) {
30907     case 0:
30908       return '';
30909
30910     case 1:
30911       return relax ? '0?' : '0';
30912
30913     case 2:
30914       return relax ? '0{0,2}' : '00';
30915
30916     default:
30917       {
30918         return relax ? `0{0,${diff}}` : `0{${diff}}`;
30919       }
30920   }
30921 }
30922 /**
30923  * Cache
30924  */
30925
30926
30927 toRegexRange$1.cache = {};
30928
30929 toRegexRange$1.clearCache = () => toRegexRange$1.cache = {};
30930 /**
30931  * Expose `toRegexRange`
30932  */
30933
30934
30935 var toRegexRange_1 = toRegexRange$1;
30936
30937 const util$2 = require$$0__default$4["default"];
30938 const toRegexRange = toRegexRange_1;
30939
30940 const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
30941
30942 const transform = toNumber => {
30943   return value => toNumber === true ? Number(value) : String(value);
30944 };
30945
30946 const isValidValue = value => {
30947   return typeof value === 'number' || typeof value === 'string' && value !== '';
30948 };
30949
30950 const isNumber = num => Number.isInteger(+num);
30951
30952 const zeros = input => {
30953   let value = `${input}`;
30954   let index = -1;
30955   if (value[0] === '-') value = value.slice(1);
30956   if (value === '0') return false;
30957
30958   while (value[++index] === '0');
30959
30960   return index > 0;
30961 };
30962
30963 const stringify$4 = (start, end, options) => {
30964   if (typeof start === 'string' || typeof end === 'string') {
30965     return true;
30966   }
30967
30968   return options.stringify === true;
30969 };
30970
30971 const pad = (input, maxLength, toNumber) => {
30972   if (maxLength > 0) {
30973     let dash = input[0] === '-' ? '-' : '';
30974     if (dash) input = input.slice(1);
30975     input = dash + input.padStart(dash ? maxLength - 1 : maxLength, '0');
30976   }
30977
30978   if (toNumber === false) {
30979     return String(input);
30980   }
30981
30982   return input;
30983 };
30984
30985 const toMaxLen = (input, maxLength) => {
30986   let negative = input[0] === '-' ? '-' : '';
30987
30988   if (negative) {
30989     input = input.slice(1);
30990     maxLength--;
30991   }
30992
30993   while (input.length < maxLength) input = '0' + input;
30994
30995   return negative ? '-' + input : input;
30996 };
30997
30998 const toSequence = (parts, options) => {
30999   parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
31000   parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
31001   let prefix = options.capture ? '' : '?:';
31002   let positives = '';
31003   let negatives = '';
31004   let result;
31005
31006   if (parts.positives.length) {
31007     positives = parts.positives.join('|');
31008   }
31009
31010   if (parts.negatives.length) {
31011     negatives = `-(${prefix}${parts.negatives.join('|')})`;
31012   }
31013
31014   if (positives && negatives) {
31015     result = `${positives}|${negatives}`;
31016   } else {
31017     result = positives || negatives;
31018   }
31019
31020   if (options.wrap) {
31021     return `(${prefix}${result})`;
31022   }
31023
31024   return result;
31025 };
31026
31027 const toRange = (a, b, isNumbers, options) => {
31028   if (isNumbers) {
31029     return toRegexRange(a, b, Object.assign({
31030       wrap: false
31031     }, options));
31032   }
31033
31034   let start = String.fromCharCode(a);
31035   if (a === b) return start;
31036   let stop = String.fromCharCode(b);
31037   return `[${start}-${stop}]`;
31038 };
31039
31040 const toRegex = (start, end, options) => {
31041   if (Array.isArray(start)) {
31042     let wrap = options.wrap === true;
31043     let prefix = options.capture ? '' : '?:';
31044     return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
31045   }
31046
31047   return toRegexRange(start, end, options);
31048 };
31049
31050 const rangeError = (...args) => {
31051   return new RangeError('Invalid range arguments: ' + util$2.inspect(...args));
31052 };
31053
31054 const invalidRange = (start, end, options) => {
31055   if (options.strictRanges === true) throw rangeError([start, end]);
31056   return [];
31057 };
31058
31059 const invalidStep = (step, options) => {
31060   if (options.strictRanges === true) {
31061     throw new TypeError(`Expected step "${step}" to be a number`);
31062   }
31063
31064   return [];
31065 };
31066
31067 const fillNumbers = (start, end, step = 1, options = {}) => {
31068   let a = Number(start);
31069   let b = Number(end);
31070
31071   if (!Number.isInteger(a) || !Number.isInteger(b)) {
31072     if (options.strictRanges === true) throw rangeError([start, end]);
31073     return [];
31074   } // fix negative zero
31075
31076
31077   if (a === 0) a = 0;
31078   if (b === 0) b = 0;
31079   let descending = a > b;
31080   let startString = String(start);
31081   let endString = String(end);
31082   let stepString = String(step);
31083   step = Math.max(Math.abs(step), 1);
31084   let padded = zeros(startString) || zeros(endString) || zeros(stepString);
31085   let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
31086   let toNumber = padded === false && stringify$4(start, end, options) === false;
31087   let format = options.transform || transform(toNumber);
31088
31089   if (options.toRegex && step === 1) {
31090     return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
31091   }
31092
31093   let parts = {
31094     negatives: [],
31095     positives: []
31096   };
31097
31098   let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
31099
31100   let range = [];
31101   let index = 0;
31102
31103   while (descending ? a >= b : a <= b) {
31104     if (options.toRegex === true && step > 1) {
31105       push(a);
31106     } else {
31107       range.push(pad(format(a, index), maxLen, toNumber));
31108     }
31109
31110     a = descending ? a - step : a + step;
31111     index++;
31112   }
31113
31114   if (options.toRegex === true) {
31115     return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
31116       wrap: false
31117     }, options));
31118   }
31119
31120   return range;
31121 };
31122
31123 const fillLetters = (start, end, step = 1, options = {}) => {
31124   if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
31125     return invalidRange(start, end, options);
31126   }
31127
31128   let format = options.transform || (val => String.fromCharCode(val));
31129
31130   let a = `${start}`.charCodeAt(0);
31131   let b = `${end}`.charCodeAt(0);
31132   let descending = a > b;
31133   let min = Math.min(a, b);
31134   let max = Math.max(a, b);
31135
31136   if (options.toRegex && step === 1) {
31137     return toRange(min, max, false, options);
31138   }
31139
31140   let range = [];
31141   let index = 0;
31142
31143   while (descending ? a >= b : a <= b) {
31144     range.push(format(a, index));
31145     a = descending ? a - step : a + step;
31146     index++;
31147   }
31148
31149   if (options.toRegex === true) {
31150     return toRegex(range, null, {
31151       wrap: false,
31152       options
31153     });
31154   }
31155
31156   return range;
31157 };
31158
31159 const fill$b = (start, end, step, options = {}) => {
31160   if (end == null && isValidValue(start)) {
31161     return [start];
31162   }
31163
31164   if (!isValidValue(start) || !isValidValue(end)) {
31165     return invalidRange(start, end, options);
31166   }
31167
31168   if (typeof step === 'function') {
31169     return fill$b(start, end, 1, {
31170       transform: step
31171     });
31172   }
31173
31174   if (isObject$1(step)) {
31175     return fill$b(start, end, 0, step);
31176   }
31177
31178   let opts = Object.assign({}, options);
31179   if (opts.capture === true) opts.wrap = true;
31180   step = step || opts.step || 1;
31181
31182   if (!isNumber(step)) {
31183     if (step != null && !isObject$1(step)) return invalidStep(step, opts);
31184     return fill$b(start, end, 1, step);
31185   }
31186
31187   if (isNumber(start) && isNumber(end)) {
31188     return fillNumbers(start, end, step, opts);
31189   }
31190
31191   return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
31192 };
31193
31194 var fillRange = fill$b;
31195
31196 const fill$a = fillRange;
31197 const utils$o = utils$q;
31198
31199 const compile$1 = (ast, options = {}) => {
31200   let walk = (node, parent = {}) => {
31201     let invalidBlock = utils$o.isInvalidBrace(parent);
31202     let invalidNode = node.invalid === true && options.escapeInvalid === true;
31203     let invalid = invalidBlock === true || invalidNode === true;
31204     let prefix = options.escapeInvalid === true ? '\\' : '';
31205     let output = '';
31206
31207     if (node.isOpen === true) {
31208       return prefix + node.value;
31209     }
31210
31211     if (node.isClose === true) {
31212       return prefix + node.value;
31213     }
31214
31215     if (node.type === 'open') {
31216       return invalid ? prefix + node.value : '(';
31217     }
31218
31219     if (node.type === 'close') {
31220       return invalid ? prefix + node.value : ')';
31221     }
31222
31223     if (node.type === 'comma') {
31224       return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
31225     }
31226
31227     if (node.value) {
31228       return node.value;
31229     }
31230
31231     if (node.nodes && node.ranges > 0) {
31232       let args = utils$o.reduce(node.nodes);
31233       let range = fill$a(...args, Object.assign(Object.assign({}, options), {}, {
31234         wrap: false,
31235         toRegex: true
31236       }));
31237
31238       if (range.length !== 0) {
31239         return args.length > 1 && range.length > 1 ? `(${range})` : range;
31240       }
31241     }
31242
31243     if (node.nodes) {
31244       for (let child of node.nodes) {
31245         output += walk(child, node);
31246       }
31247     }
31248
31249     return output;
31250   };
31251
31252   return walk(ast);
31253 };
31254
31255 var compile_1 = compile$1;
31256
31257 const fill$9 = fillRange;
31258 const stringify$3 = stringify$5;
31259 const utils$n = utils$q;
31260
31261 const append = (queue = '', stash = '', enclose = false) => {
31262   let result = [];
31263   queue = [].concat(queue);
31264   stash = [].concat(stash);
31265   if (!stash.length) return queue;
31266
31267   if (!queue.length) {
31268     return enclose ? utils$n.flatten(stash).map(ele => `{${ele}}`) : stash;
31269   }
31270
31271   for (let item of queue) {
31272     if (Array.isArray(item)) {
31273       for (let value of item) {
31274         result.push(append(value, stash, enclose));
31275       }
31276     } else {
31277       for (let ele of stash) {
31278         if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
31279         result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
31280       }
31281     }
31282   }
31283
31284   return utils$n.flatten(result);
31285 };
31286
31287 const expand$1 = (ast, options = {}) => {
31288   let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
31289
31290   let walk = (node, parent = {}) => {
31291     node.queue = [];
31292     let p = parent;
31293     let q = parent.queue;
31294
31295     while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
31296       p = p.parent;
31297       q = p.queue;
31298     }
31299
31300     if (node.invalid || node.dollar) {
31301       q.push(append(q.pop(), stringify$3(node, options)));
31302       return;
31303     }
31304
31305     if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
31306       q.push(append(q.pop(), ['{}']));
31307       return;
31308     }
31309
31310     if (node.nodes && node.ranges > 0) {
31311       let args = utils$n.reduce(node.nodes);
31312
31313       if (utils$n.exceedsLimit(...args, options.step, rangeLimit)) {
31314         throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
31315       }
31316
31317       let range = fill$9(...args, options);
31318
31319       if (range.length === 0) {
31320         range = stringify$3(node, options);
31321       }
31322
31323       q.push(append(q.pop(), range));
31324       node.nodes = [];
31325       return;
31326     }
31327
31328     let enclose = utils$n.encloseBrace(node);
31329     let queue = node.queue;
31330     let block = node;
31331
31332     while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
31333       block = block.parent;
31334       queue = block.queue;
31335     }
31336
31337     for (let i = 0; i < node.nodes.length; i++) {
31338       let child = node.nodes[i];
31339
31340       if (child.type === 'comma' && node.type === 'brace') {
31341         if (i === 1) queue.push('');
31342         queue.push('');
31343         continue;
31344       }
31345
31346       if (child.type === 'close') {
31347         q.push(append(q.pop(), queue, enclose));
31348         continue;
31349       }
31350
31351       if (child.value && child.type !== 'open') {
31352         queue.push(append(queue.pop(), child.value));
31353         continue;
31354       }
31355
31356       if (child.nodes) {
31357         walk(child, node);
31358       }
31359     }
31360
31361     return queue;
31362   };
31363
31364   return utils$n.flatten(walk(ast));
31365 };
31366
31367 var expand_1 = expand$1;
31368
31369 var constants$4 = {
31370   MAX_LENGTH: 1024 * 64,
31371   // Digits
31372   CHAR_0: '0',
31373
31374   /* 0 */
31375   CHAR_9: '9',
31376
31377   /* 9 */
31378   // Alphabet chars.
31379   CHAR_UPPERCASE_A: 'A',
31380
31381   /* A */
31382   CHAR_LOWERCASE_A: 'a',
31383
31384   /* a */
31385   CHAR_UPPERCASE_Z: 'Z',
31386
31387   /* Z */
31388   CHAR_LOWERCASE_Z: 'z',
31389
31390   /* z */
31391   CHAR_LEFT_PARENTHESES: '(',
31392
31393   /* ( */
31394   CHAR_RIGHT_PARENTHESES: ')',
31395
31396   /* ) */
31397   CHAR_ASTERISK: '*',
31398
31399   /* * */
31400   // Non-alphabetic chars.
31401   CHAR_AMPERSAND: '&',
31402
31403   /* & */
31404   CHAR_AT: '@',
31405
31406   /* @ */
31407   CHAR_BACKSLASH: '\\',
31408
31409   /* \ */
31410   CHAR_BACKTICK: '`',
31411
31412   /* ` */
31413   CHAR_CARRIAGE_RETURN: '\r',
31414
31415   /* \r */
31416   CHAR_CIRCUMFLEX_ACCENT: '^',
31417
31418   /* ^ */
31419   CHAR_COLON: ':',
31420
31421   /* : */
31422   CHAR_COMMA: ',',
31423
31424   /* , */
31425   CHAR_DOLLAR: '$',
31426
31427   /* . */
31428   CHAR_DOT: '.',
31429
31430   /* . */
31431   CHAR_DOUBLE_QUOTE: '"',
31432
31433   /* " */
31434   CHAR_EQUAL: '=',
31435
31436   /* = */
31437   CHAR_EXCLAMATION_MARK: '!',
31438
31439   /* ! */
31440   CHAR_FORM_FEED: '\f',
31441
31442   /* \f */
31443   CHAR_FORWARD_SLASH: '/',
31444
31445   /* / */
31446   CHAR_HASH: '#',
31447
31448   /* # */
31449   CHAR_HYPHEN_MINUS: '-',
31450
31451   /* - */
31452   CHAR_LEFT_ANGLE_BRACKET: '<',
31453
31454   /* < */
31455   CHAR_LEFT_CURLY_BRACE: '{',
31456
31457   /* { */
31458   CHAR_LEFT_SQUARE_BRACKET: '[',
31459
31460   /* [ */
31461   CHAR_LINE_FEED: '\n',
31462
31463   /* \n */
31464   CHAR_NO_BREAK_SPACE: '\u00A0',
31465
31466   /* \u00A0 */
31467   CHAR_PERCENT: '%',
31468
31469   /* % */
31470   CHAR_PLUS: '+',
31471
31472   /* + */
31473   CHAR_QUESTION_MARK: '?',
31474
31475   /* ? */
31476   CHAR_RIGHT_ANGLE_BRACKET: '>',
31477
31478   /* > */
31479   CHAR_RIGHT_CURLY_BRACE: '}',
31480
31481   /* } */
31482   CHAR_RIGHT_SQUARE_BRACKET: ']',
31483
31484   /* ] */
31485   CHAR_SEMICOLON: ';',
31486
31487   /* ; */
31488   CHAR_SINGLE_QUOTE: '\'',
31489
31490   /* ' */
31491   CHAR_SPACE: ' ',
31492
31493   /*   */
31494   CHAR_TAB: '\t',
31495
31496   /* \t */
31497   CHAR_UNDERSCORE: '_',
31498
31499   /* _ */
31500   CHAR_VERTICAL_LINE: '|',
31501
31502   /* | */
31503   CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF'
31504   /* \uFEFF */
31505
31506 };
31507
31508 const stringify$2 = stringify$5;
31509 /**
31510  * Constants
31511  */
31512
31513 const {
31514   MAX_LENGTH: MAX_LENGTH$1,
31515   CHAR_BACKSLASH,
31516
31517   /* \ */
31518   CHAR_BACKTICK,
31519
31520   /* ` */
31521   CHAR_COMMA: CHAR_COMMA$1,
31522
31523   /* , */
31524   CHAR_DOT: CHAR_DOT$1,
31525
31526   /* . */
31527   CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1,
31528
31529   /* ( */
31530   CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1,
31531
31532   /* ) */
31533   CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1,
31534
31535   /* { */
31536   CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1,
31537
31538   /* } */
31539   CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1,
31540
31541   /* [ */
31542   CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1,
31543
31544   /* ] */
31545   CHAR_DOUBLE_QUOTE,
31546
31547   /* " */
31548   CHAR_SINGLE_QUOTE,
31549
31550   /* ' */
31551   CHAR_NO_BREAK_SPACE,
31552   CHAR_ZERO_WIDTH_NOBREAK_SPACE
31553 } = constants$4;
31554 /**
31555  * parse
31556  */
31557
31558 const parse$5 = (input, options = {}) => {
31559   if (typeof input !== 'string') {
31560     throw new TypeError('Expected a string');
31561   }
31562
31563   let opts = options || {};
31564   let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
31565
31566   if (input.length > max) {
31567     throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
31568   }
31569
31570   let ast = {
31571     type: 'root',
31572     input,
31573     nodes: []
31574   };
31575   let stack = [ast];
31576   let block = ast;
31577   let prev = ast;
31578   let brackets = 0;
31579   let length = input.length;
31580   let index = 0;
31581   let depth = 0;
31582   let value;
31583   /**
31584    * Helpers
31585    */
31586
31587   const advance = () => input[index++];
31588
31589   const push = node => {
31590     if (node.type === 'text' && prev.type === 'dot') {
31591       prev.type = 'text';
31592     }
31593
31594     if (prev && prev.type === 'text' && node.type === 'text') {
31595       prev.value += node.value;
31596       return;
31597     }
31598
31599     block.nodes.push(node);
31600     node.parent = block;
31601     node.prev = prev;
31602     prev = node;
31603     return node;
31604   };
31605
31606   push({
31607     type: 'bos'
31608   });
31609
31610   while (index < length) {
31611     block = stack[stack.length - 1];
31612     value = advance();
31613     /**
31614      * Invalid chars
31615      */
31616
31617     if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
31618       continue;
31619     }
31620     /**
31621      * Escaped chars
31622      */
31623
31624
31625     if (value === CHAR_BACKSLASH) {
31626       push({
31627         type: 'text',
31628         value: (options.keepEscaping ? value : '') + advance()
31629       });
31630       continue;
31631     }
31632     /**
31633      * Right square bracket (literal): ']'
31634      */
31635
31636
31637     if (value === CHAR_RIGHT_SQUARE_BRACKET$1) {
31638       push({
31639         type: 'text',
31640         value: '\\' + value
31641       });
31642       continue;
31643     }
31644     /**
31645      * Left square bracket: '['
31646      */
31647
31648
31649     if (value === CHAR_LEFT_SQUARE_BRACKET$1) {
31650       brackets++;
31651       let next;
31652
31653       while (index < length && (next = advance())) {
31654         value += next;
31655
31656         if (next === CHAR_LEFT_SQUARE_BRACKET$1) {
31657           brackets++;
31658           continue;
31659         }
31660
31661         if (next === CHAR_BACKSLASH) {
31662           value += advance();
31663           continue;
31664         }
31665
31666         if (next === CHAR_RIGHT_SQUARE_BRACKET$1) {
31667           brackets--;
31668
31669           if (brackets === 0) {
31670             break;
31671           }
31672         }
31673       }
31674
31675       push({
31676         type: 'text',
31677         value
31678       });
31679       continue;
31680     }
31681     /**
31682      * Parentheses
31683      */
31684
31685
31686     if (value === CHAR_LEFT_PARENTHESES$1) {
31687       block = push({
31688         type: 'paren',
31689         nodes: []
31690       });
31691       stack.push(block);
31692       push({
31693         type: 'text',
31694         value
31695       });
31696       continue;
31697     }
31698
31699     if (value === CHAR_RIGHT_PARENTHESES$1) {
31700       if (block.type !== 'paren') {
31701         push({
31702           type: 'text',
31703           value
31704         });
31705         continue;
31706       }
31707
31708       block = stack.pop();
31709       push({
31710         type: 'text',
31711         value
31712       });
31713       block = stack[stack.length - 1];
31714       continue;
31715     }
31716     /**
31717      * Quotes: '|"|`
31718      */
31719
31720
31721     if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
31722       let open = value;
31723       let next;
31724
31725       if (options.keepQuotes !== true) {
31726         value = '';
31727       }
31728
31729       while (index < length && (next = advance())) {
31730         if (next === CHAR_BACKSLASH) {
31731           value += next + advance();
31732           continue;
31733         }
31734
31735         if (next === open) {
31736           if (options.keepQuotes === true) value += next;
31737           break;
31738         }
31739
31740         value += next;
31741       }
31742
31743       push({
31744         type: 'text',
31745         value
31746       });
31747       continue;
31748     }
31749     /**
31750      * Left curly brace: '{'
31751      */
31752
31753
31754     if (value === CHAR_LEFT_CURLY_BRACE$1) {
31755       depth++;
31756       let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
31757       let brace = {
31758         type: 'brace',
31759         open: true,
31760         close: false,
31761         dollar,
31762         depth,
31763         commas: 0,
31764         ranges: 0,
31765         nodes: []
31766       };
31767       block = push(brace);
31768       stack.push(block);
31769       push({
31770         type: 'open',
31771         value
31772       });
31773       continue;
31774     }
31775     /**
31776      * Right curly brace: '}'
31777      */
31778
31779
31780     if (value === CHAR_RIGHT_CURLY_BRACE$1) {
31781       if (block.type !== 'brace') {
31782         push({
31783           type: 'text',
31784           value
31785         });
31786         continue;
31787       }
31788
31789       let type = 'close';
31790       block = stack.pop();
31791       block.close = true;
31792       push({
31793         type,
31794         value
31795       });
31796       depth--;
31797       block = stack[stack.length - 1];
31798       continue;
31799     }
31800     /**
31801      * Comma: ','
31802      */
31803
31804
31805     if (value === CHAR_COMMA$1 && depth > 0) {
31806       if (block.ranges > 0) {
31807         block.ranges = 0;
31808         let open = block.nodes.shift();
31809         block.nodes = [open, {
31810           type: 'text',
31811           value: stringify$2(block)
31812         }];
31813       }
31814
31815       push({
31816         type: 'comma',
31817         value
31818       });
31819       block.commas++;
31820       continue;
31821     }
31822     /**
31823      * Dot: '.'
31824      */
31825
31826
31827     if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) {
31828       let siblings = block.nodes;
31829
31830       if (depth === 0 || siblings.length === 0) {
31831         push({
31832           type: 'text',
31833           value
31834         });
31835         continue;
31836       }
31837
31838       if (prev.type === 'dot') {
31839         block.range = [];
31840         prev.value += value;
31841         prev.type = 'range';
31842
31843         if (block.nodes.length !== 3 && block.nodes.length !== 5) {
31844           block.invalid = true;
31845           block.ranges = 0;
31846           prev.type = 'text';
31847           continue;
31848         }
31849
31850         block.ranges++;
31851         block.args = [];
31852         continue;
31853       }
31854
31855       if (prev.type === 'range') {
31856         siblings.pop();
31857         let before = siblings[siblings.length - 1];
31858         before.value += prev.value + value;
31859         prev = before;
31860         block.ranges--;
31861         continue;
31862       }
31863
31864       push({
31865         type: 'dot',
31866         value
31867       });
31868       continue;
31869     }
31870     /**
31871      * Text
31872      */
31873
31874
31875     push({
31876       type: 'text',
31877       value
31878     });
31879   } // Mark imbalanced braces and brackets as invalid
31880
31881
31882   do {
31883     block = stack.pop();
31884
31885     if (block.type !== 'root') {
31886       block.nodes.forEach(node => {
31887         if (!node.nodes) {
31888           if (node.type === 'open') node.isOpen = true;
31889           if (node.type === 'close') node.isClose = true;
31890           if (!node.nodes) node.type = 'text';
31891           node.invalid = true;
31892         }
31893       }); // get the location of the block on parent.nodes (block's siblings)
31894
31895       let parent = stack[stack.length - 1];
31896       let index = parent.nodes.indexOf(block); // replace the (invalid) block with it's nodes
31897
31898       parent.nodes.splice(index, 1, ...block.nodes);
31899     }
31900   } while (stack.length > 0);
31901
31902   push({
31903     type: 'eos'
31904   });
31905   return ast;
31906 };
31907
31908 var parse_1$2 = parse$5;
31909
31910 const stringify$1 = stringify$5;
31911 const compile = compile_1;
31912 const expand = expand_1;
31913 const parse$4 = parse_1$2;
31914 /**
31915  * Expand the given pattern or create a regex-compatible string.
31916  *
31917  * ```js
31918  * const braces = require('braces');
31919  * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
31920  * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
31921  * ```
31922  * @param {String} `str`
31923  * @param {Object} `options`
31924  * @return {String}
31925  * @api public
31926  */
31927
31928 const braces$1 = (input, options = {}) => {
31929   let output = [];
31930
31931   if (Array.isArray(input)) {
31932     for (let pattern of input) {
31933       let result = braces$1.create(pattern, options);
31934
31935       if (Array.isArray(result)) {
31936         output.push(...result);
31937       } else {
31938         output.push(result);
31939       }
31940     }
31941   } else {
31942     output = [].concat(braces$1.create(input, options));
31943   }
31944
31945   if (options && options.expand === true && options.nodupes === true) {
31946     output = [...new Set(output)];
31947   }
31948
31949   return output;
31950 };
31951 /**
31952  * Parse the given `str` with the given `options`.
31953  *
31954  * ```js
31955  * // braces.parse(pattern, [, options]);
31956  * const ast = braces.parse('a/{b,c}/d');
31957  * console.log(ast);
31958  * ```
31959  * @param {String} pattern Brace pattern to parse
31960  * @param {Object} options
31961  * @return {Object} Returns an AST
31962  * @api public
31963  */
31964
31965
31966 braces$1.parse = (input, options = {}) => parse$4(input, options);
31967 /**
31968  * Creates a braces string from an AST, or an AST node.
31969  *
31970  * ```js
31971  * const braces = require('braces');
31972  * let ast = braces.parse('foo/{a,b}/bar');
31973  * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
31974  * ```
31975  * @param {String} `input` Brace pattern or AST.
31976  * @param {Object} `options`
31977  * @return {Array} Returns an array of expanded values.
31978  * @api public
31979  */
31980
31981
31982 braces$1.stringify = (input, options = {}) => {
31983   if (typeof input === 'string') {
31984     return stringify$1(braces$1.parse(input, options), options);
31985   }
31986
31987   return stringify$1(input, options);
31988 };
31989 /**
31990  * Compiles a brace pattern into a regex-compatible, optimized string.
31991  * This method is called by the main [braces](#braces) function by default.
31992  *
31993  * ```js
31994  * const braces = require('braces');
31995  * console.log(braces.compile('a/{b,c}/d'));
31996  * //=> ['a/(b|c)/d']
31997  * ```
31998  * @param {String} `input` Brace pattern or AST.
31999  * @param {Object} `options`
32000  * @return {Array} Returns an array of expanded values.
32001  * @api public
32002  */
32003
32004
32005 braces$1.compile = (input, options = {}) => {
32006   if (typeof input === 'string') {
32007     input = braces$1.parse(input, options);
32008   }
32009
32010   return compile(input, options);
32011 };
32012 /**
32013  * Expands a brace pattern into an array. This method is called by the
32014  * main [braces](#braces) function when `options.expand` is true. Before
32015  * using this method it's recommended that you read the [performance notes](#performance))
32016  * and advantages of using [.compile](#compile) instead.
32017  *
32018  * ```js
32019  * const braces = require('braces');
32020  * console.log(braces.expand('a/{b,c}/d'));
32021  * //=> ['a/b/d', 'a/c/d'];
32022  * ```
32023  * @param {String} `pattern` Brace pattern
32024  * @param {Object} `options`
32025  * @return {Array} Returns an array of expanded values.
32026  * @api public
32027  */
32028
32029
32030 braces$1.expand = (input, options = {}) => {
32031   if (typeof input === 'string') {
32032     input = braces$1.parse(input, options);
32033   }
32034
32035   let result = expand(input, options); // filter out empty strings if specified
32036
32037   if (options.noempty === true) {
32038     result = result.filter(Boolean);
32039   } // filter out duplicates if specified
32040
32041
32042   if (options.nodupes === true) {
32043     result = [...new Set(result)];
32044   }
32045
32046   return result;
32047 };
32048 /**
32049  * Processes a brace pattern and returns either an expanded array
32050  * (if `options.expand` is true), a highly optimized regex-compatible string.
32051  * This method is called by the main [braces](#braces) function.
32052  *
32053  * ```js
32054  * const braces = require('braces');
32055  * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
32056  * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
32057  * ```
32058  * @param {String} `pattern` Brace pattern
32059  * @param {Object} `options`
32060  * @return {Array} Returns an array of expanded values.
32061  * @api public
32062  */
32063
32064
32065 braces$1.create = (input, options = {}) => {
32066   if (input === '' || input.length < 3) {
32067     return [input];
32068   }
32069
32070   return options.expand !== true ? braces$1.compile(input, options) : braces$1.expand(input, options);
32071 };
32072 /**
32073  * Expose "braces"
32074  */
32075
32076
32077 var braces_1 = braces$1;
32078
32079 var utils$m = {};
32080
32081 const path$a = require$$0__default$2["default"];
32082 const WIN_SLASH = '\\\\/';
32083 const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
32084 /**
32085  * Posix glob regex
32086  */
32087
32088 const DOT_LITERAL = '\\.';
32089 const PLUS_LITERAL = '\\+';
32090 const QMARK_LITERAL = '\\?';
32091 const SLASH_LITERAL = '\\/';
32092 const ONE_CHAR = '(?=.)';
32093 const QMARK = '[^/]';
32094 const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
32095 const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
32096 const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
32097 const NO_DOT = `(?!${DOT_LITERAL})`;
32098 const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
32099 const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
32100 const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
32101 const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
32102 const STAR = `${QMARK}*?`;
32103 const POSIX_CHARS = {
32104   DOT_LITERAL,
32105   PLUS_LITERAL,
32106   QMARK_LITERAL,
32107   SLASH_LITERAL,
32108   ONE_CHAR,
32109   QMARK,
32110   END_ANCHOR,
32111   DOTS_SLASH,
32112   NO_DOT,
32113   NO_DOTS,
32114   NO_DOT_SLASH,
32115   NO_DOTS_SLASH,
32116   QMARK_NO_DOT,
32117   STAR,
32118   START_ANCHOR
32119 };
32120 /**
32121  * Windows glob regex
32122  */
32123
32124 const WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
32125   SLASH_LITERAL: `[${WIN_SLASH}]`,
32126   QMARK: WIN_NO_SLASH,
32127   STAR: `${WIN_NO_SLASH}*?`,
32128   DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
32129   NO_DOT: `(?!${DOT_LITERAL})`,
32130   NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
32131   NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
32132   NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
32133   QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
32134   START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
32135   END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
32136 });
32137 /**
32138  * POSIX Bracket Regex
32139  */
32140
32141 const POSIX_REGEX_SOURCE$1 = {
32142   alnum: 'a-zA-Z0-9',
32143   alpha: 'a-zA-Z',
32144   ascii: '\\x00-\\x7F',
32145   blank: ' \\t',
32146   cntrl: '\\x00-\\x1F\\x7F',
32147   digit: '0-9',
32148   graph: '\\x21-\\x7E',
32149   lower: 'a-z',
32150   print: '\\x20-\\x7E ',
32151   punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
32152   space: ' \\t\\r\\n\\v\\f',
32153   upper: 'A-Z',
32154   word: 'A-Za-z0-9_',
32155   xdigit: 'A-Fa-f0-9'
32156 };
32157 var constants$3 = {
32158   MAX_LENGTH: 1024 * 64,
32159   POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
32160   // regular expressions
32161   REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
32162   REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
32163   REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
32164   REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
32165   REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
32166   REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
32167   // Replace globs with equivalent patterns to reduce parsing time.
32168   REPLACEMENTS: {
32169     '***': '*',
32170     '**/**': '**',
32171     '**/**/**': '**'
32172   },
32173   // Digits
32174   CHAR_0: 48,
32175
32176   /* 0 */
32177   CHAR_9: 57,
32178
32179   /* 9 */
32180   // Alphabet chars.
32181   CHAR_UPPERCASE_A: 65,
32182
32183   /* A */
32184   CHAR_LOWERCASE_A: 97,
32185
32186   /* a */
32187   CHAR_UPPERCASE_Z: 90,
32188
32189   /* Z */
32190   CHAR_LOWERCASE_Z: 122,
32191
32192   /* z */
32193   CHAR_LEFT_PARENTHESES: 40,
32194
32195   /* ( */
32196   CHAR_RIGHT_PARENTHESES: 41,
32197
32198   /* ) */
32199   CHAR_ASTERISK: 42,
32200
32201   /* * */
32202   // Non-alphabetic chars.
32203   CHAR_AMPERSAND: 38,
32204
32205   /* & */
32206   CHAR_AT: 64,
32207
32208   /* @ */
32209   CHAR_BACKWARD_SLASH: 92,
32210
32211   /* \ */
32212   CHAR_CARRIAGE_RETURN: 13,
32213
32214   /* \r */
32215   CHAR_CIRCUMFLEX_ACCENT: 94,
32216
32217   /* ^ */
32218   CHAR_COLON: 58,
32219
32220   /* : */
32221   CHAR_COMMA: 44,
32222
32223   /* , */
32224   CHAR_DOT: 46,
32225
32226   /* . */
32227   CHAR_DOUBLE_QUOTE: 34,
32228
32229   /* " */
32230   CHAR_EQUAL: 61,
32231
32232   /* = */
32233   CHAR_EXCLAMATION_MARK: 33,
32234
32235   /* ! */
32236   CHAR_FORM_FEED: 12,
32237
32238   /* \f */
32239   CHAR_FORWARD_SLASH: 47,
32240
32241   /* / */
32242   CHAR_GRAVE_ACCENT: 96,
32243
32244   /* ` */
32245   CHAR_HASH: 35,
32246
32247   /* # */
32248   CHAR_HYPHEN_MINUS: 45,
32249
32250   /* - */
32251   CHAR_LEFT_ANGLE_BRACKET: 60,
32252
32253   /* < */
32254   CHAR_LEFT_CURLY_BRACE: 123,
32255
32256   /* { */
32257   CHAR_LEFT_SQUARE_BRACKET: 91,
32258
32259   /* [ */
32260   CHAR_LINE_FEED: 10,
32261
32262   /* \n */
32263   CHAR_NO_BREAK_SPACE: 160,
32264
32265   /* \u00A0 */
32266   CHAR_PERCENT: 37,
32267
32268   /* % */
32269   CHAR_PLUS: 43,
32270
32271   /* + */
32272   CHAR_QUESTION_MARK: 63,
32273
32274   /* ? */
32275   CHAR_RIGHT_ANGLE_BRACKET: 62,
32276
32277   /* > */
32278   CHAR_RIGHT_CURLY_BRACE: 125,
32279
32280   /* } */
32281   CHAR_RIGHT_SQUARE_BRACKET: 93,
32282
32283   /* ] */
32284   CHAR_SEMICOLON: 59,
32285
32286   /* ; */
32287   CHAR_SINGLE_QUOTE: 39,
32288
32289   /* ' */
32290   CHAR_SPACE: 32,
32291
32292   /*   */
32293   CHAR_TAB: 9,
32294
32295   /* \t */
32296   CHAR_UNDERSCORE: 95,
32297
32298   /* _ */
32299   CHAR_VERTICAL_LINE: 124,
32300
32301   /* | */
32302   CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
32303
32304   /* \uFEFF */
32305   SEP: path$a.sep,
32306
32307   /**
32308    * Create EXTGLOB_CHARS
32309    */
32310   extglobChars(chars) {
32311     return {
32312       '!': {
32313         type: 'negate',
32314         open: '(?:(?!(?:',
32315         close: `))${chars.STAR})`
32316       },
32317       '?': {
32318         type: 'qmark',
32319         open: '(?:',
32320         close: ')?'
32321       },
32322       '+': {
32323         type: 'plus',
32324         open: '(?:',
32325         close: ')+'
32326       },
32327       '*': {
32328         type: 'star',
32329         open: '(?:',
32330         close: ')*'
32331       },
32332       '@': {
32333         type: 'at',
32334         open: '(?:',
32335         close: ')'
32336       }
32337     };
32338   },
32339
32340   /**
32341    * Create GLOB_CHARS
32342    */
32343   globChars(win32) {
32344     return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
32345   }
32346
32347 };
32348
32349 (function (exports) {
32350
32351   const path = require$$0__default$2["default"];
32352   const win32 = process.platform === 'win32';
32353   const {
32354     REGEX_BACKSLASH,
32355     REGEX_REMOVE_BACKSLASH,
32356     REGEX_SPECIAL_CHARS,
32357     REGEX_SPECIAL_CHARS_GLOBAL
32358   } = constants$3;
32359
32360   exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
32361
32362   exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
32363
32364   exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
32365
32366   exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
32367
32368   exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
32369
32370   exports.removeBackslashes = str => {
32371     return str.replace(REGEX_REMOVE_BACKSLASH, match => {
32372       return match === '\\' ? '' : match;
32373     });
32374   };
32375
32376   exports.supportsLookbehinds = () => {
32377     const segs = process.version.slice(1).split('.').map(Number);
32378
32379     if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
32380       return true;
32381     }
32382
32383     return false;
32384   };
32385
32386   exports.isWindows = options => {
32387     if (options && typeof options.windows === 'boolean') {
32388       return options.windows;
32389     }
32390
32391     return win32 === true || path.sep === '\\';
32392   };
32393
32394   exports.escapeLast = (input, char, lastIdx) => {
32395     const idx = input.lastIndexOf(char, lastIdx);
32396     if (idx === -1) return input;
32397     if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
32398     return `${input.slice(0, idx)}\\${input.slice(idx)}`;
32399   };
32400
32401   exports.removePrefix = (input, state = {}) => {
32402     let output = input;
32403
32404     if (output.startsWith('./')) {
32405       output = output.slice(2);
32406       state.prefix = './';
32407     }
32408
32409     return output;
32410   };
32411
32412   exports.wrapOutput = (input, state = {}, options = {}) => {
32413     const prepend = options.contains ? '' : '^';
32414     const append = options.contains ? '' : '$';
32415     let output = `${prepend}(?:${input})${append}`;
32416
32417     if (state.negated === true) {
32418       output = `(?:^(?!${output}).*$)`;
32419     }
32420
32421     return output;
32422   };
32423 })(utils$m);
32424
32425 const utils$l = utils$m;
32426 const {
32427   CHAR_ASTERISK,
32428
32429   /* * */
32430   CHAR_AT,
32431
32432   /* @ */
32433   CHAR_BACKWARD_SLASH,
32434
32435   /* \ */
32436   CHAR_COMMA,
32437
32438   /* , */
32439   CHAR_DOT,
32440
32441   /* . */
32442   CHAR_EXCLAMATION_MARK,
32443
32444   /* ! */
32445   CHAR_FORWARD_SLASH,
32446
32447   /* / */
32448   CHAR_LEFT_CURLY_BRACE,
32449
32450   /* { */
32451   CHAR_LEFT_PARENTHESES,
32452
32453   /* ( */
32454   CHAR_LEFT_SQUARE_BRACKET,
32455
32456   /* [ */
32457   CHAR_PLUS,
32458
32459   /* + */
32460   CHAR_QUESTION_MARK,
32461
32462   /* ? */
32463   CHAR_RIGHT_CURLY_BRACE,
32464
32465   /* } */
32466   CHAR_RIGHT_PARENTHESES,
32467
32468   /* ) */
32469   CHAR_RIGHT_SQUARE_BRACKET
32470   /* ] */
32471
32472 } = constants$3;
32473
32474 const isPathSeparator = code => {
32475   return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
32476 };
32477
32478 const depth = token => {
32479   if (token.isPrefix !== true) {
32480     token.depth = token.isGlobstar ? Infinity : 1;
32481   }
32482 };
32483 /**
32484  * Quickly scans a glob pattern and returns an object with a handful of
32485  * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
32486  * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
32487  * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
32488  *
32489  * ```js
32490  * const pm = require('picomatch');
32491  * console.log(pm.scan('foo/bar/*.js'));
32492  * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
32493  * ```
32494  * @param {String} `str`
32495  * @param {Object} `options`
32496  * @return {Object} Returns an object with tokens and regex source string.
32497  * @api public
32498  */
32499
32500
32501 const scan$1 = (input, options) => {
32502   const opts = options || {};
32503   const length = input.length - 1;
32504   const scanToEnd = opts.parts === true || opts.scanToEnd === true;
32505   const slashes = [];
32506   const tokens = [];
32507   const parts = [];
32508   let str = input;
32509   let index = -1;
32510   let start = 0;
32511   let lastIndex = 0;
32512   let isBrace = false;
32513   let isBracket = false;
32514   let isGlob = false;
32515   let isExtglob = false;
32516   let isGlobstar = false;
32517   let braceEscaped = false;
32518   let backslashes = false;
32519   let negated = false;
32520   let negatedExtglob = false;
32521   let finished = false;
32522   let braces = 0;
32523   let prev;
32524   let code;
32525   let token = {
32526     value: '',
32527     depth: 0,
32528     isGlob: false
32529   };
32530
32531   const eos = () => index >= length;
32532
32533   const peek = () => str.charCodeAt(index + 1);
32534
32535   const advance = () => {
32536     prev = code;
32537     return str.charCodeAt(++index);
32538   };
32539
32540   while (index < length) {
32541     code = advance();
32542     let next;
32543
32544     if (code === CHAR_BACKWARD_SLASH) {
32545       backslashes = token.backslashes = true;
32546       code = advance();
32547
32548       if (code === CHAR_LEFT_CURLY_BRACE) {
32549         braceEscaped = true;
32550       }
32551
32552       continue;
32553     }
32554
32555     if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
32556       braces++;
32557
32558       while (eos() !== true && (code = advance())) {
32559         if (code === CHAR_BACKWARD_SLASH) {
32560           backslashes = token.backslashes = true;
32561           advance();
32562           continue;
32563         }
32564
32565         if (code === CHAR_LEFT_CURLY_BRACE) {
32566           braces++;
32567           continue;
32568         }
32569
32570         if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
32571           isBrace = token.isBrace = true;
32572           isGlob = token.isGlob = true;
32573           finished = true;
32574
32575           if (scanToEnd === true) {
32576             continue;
32577           }
32578
32579           break;
32580         }
32581
32582         if (braceEscaped !== true && code === CHAR_COMMA) {
32583           isBrace = token.isBrace = true;
32584           isGlob = token.isGlob = true;
32585           finished = true;
32586
32587           if (scanToEnd === true) {
32588             continue;
32589           }
32590
32591           break;
32592         }
32593
32594         if (code === CHAR_RIGHT_CURLY_BRACE) {
32595           braces--;
32596
32597           if (braces === 0) {
32598             braceEscaped = false;
32599             isBrace = token.isBrace = true;
32600             finished = true;
32601             break;
32602           }
32603         }
32604       }
32605
32606       if (scanToEnd === true) {
32607         continue;
32608       }
32609
32610       break;
32611     }
32612
32613     if (code === CHAR_FORWARD_SLASH) {
32614       slashes.push(index);
32615       tokens.push(token);
32616       token = {
32617         value: '',
32618         depth: 0,
32619         isGlob: false
32620       };
32621       if (finished === true) continue;
32622
32623       if (prev === CHAR_DOT && index === start + 1) {
32624         start += 2;
32625         continue;
32626       }
32627
32628       lastIndex = index + 1;
32629       continue;
32630     }
32631
32632     if (opts.noext !== true) {
32633       const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
32634
32635       if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
32636         isGlob = token.isGlob = true;
32637         isExtglob = token.isExtglob = true;
32638         finished = true;
32639
32640         if (code === CHAR_EXCLAMATION_MARK && index === start) {
32641           negatedExtglob = true;
32642         }
32643
32644         if (scanToEnd === true) {
32645           while (eos() !== true && (code = advance())) {
32646             if (code === CHAR_BACKWARD_SLASH) {
32647               backslashes = token.backslashes = true;
32648               code = advance();
32649               continue;
32650             }
32651
32652             if (code === CHAR_RIGHT_PARENTHESES) {
32653               isGlob = token.isGlob = true;
32654               finished = true;
32655               break;
32656             }
32657           }
32658
32659           continue;
32660         }
32661
32662         break;
32663       }
32664     }
32665
32666     if (code === CHAR_ASTERISK) {
32667       if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
32668       isGlob = token.isGlob = true;
32669       finished = true;
32670
32671       if (scanToEnd === true) {
32672         continue;
32673       }
32674
32675       break;
32676     }
32677
32678     if (code === CHAR_QUESTION_MARK) {
32679       isGlob = token.isGlob = true;
32680       finished = true;
32681
32682       if (scanToEnd === true) {
32683         continue;
32684       }
32685
32686       break;
32687     }
32688
32689     if (code === CHAR_LEFT_SQUARE_BRACKET) {
32690       while (eos() !== true && (next = advance())) {
32691         if (next === CHAR_BACKWARD_SLASH) {
32692           backslashes = token.backslashes = true;
32693           advance();
32694           continue;
32695         }
32696
32697         if (next === CHAR_RIGHT_SQUARE_BRACKET) {
32698           isBracket = token.isBracket = true;
32699           isGlob = token.isGlob = true;
32700           finished = true;
32701           break;
32702         }
32703       }
32704
32705       if (scanToEnd === true) {
32706         continue;
32707       }
32708
32709       break;
32710     }
32711
32712     if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
32713       negated = token.negated = true;
32714       start++;
32715       continue;
32716     }
32717
32718     if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
32719       isGlob = token.isGlob = true;
32720
32721       if (scanToEnd === true) {
32722         while (eos() !== true && (code = advance())) {
32723           if (code === CHAR_LEFT_PARENTHESES) {
32724             backslashes = token.backslashes = true;
32725             code = advance();
32726             continue;
32727           }
32728
32729           if (code === CHAR_RIGHT_PARENTHESES) {
32730             finished = true;
32731             break;
32732           }
32733         }
32734
32735         continue;
32736       }
32737
32738       break;
32739     }
32740
32741     if (isGlob === true) {
32742       finished = true;
32743
32744       if (scanToEnd === true) {
32745         continue;
32746       }
32747
32748       break;
32749     }
32750   }
32751
32752   if (opts.noext === true) {
32753     isExtglob = false;
32754     isGlob = false;
32755   }
32756
32757   let base = str;
32758   let prefix = '';
32759   let glob = '';
32760
32761   if (start > 0) {
32762     prefix = str.slice(0, start);
32763     str = str.slice(start);
32764     lastIndex -= start;
32765   }
32766
32767   if (base && isGlob === true && lastIndex > 0) {
32768     base = str.slice(0, lastIndex);
32769     glob = str.slice(lastIndex);
32770   } else if (isGlob === true) {
32771     base = '';
32772     glob = str;
32773   } else {
32774     base = str;
32775   }
32776
32777   if (base && base !== '' && base !== '/' && base !== str) {
32778     if (isPathSeparator(base.charCodeAt(base.length - 1))) {
32779       base = base.slice(0, -1);
32780     }
32781   }
32782
32783   if (opts.unescape === true) {
32784     if (glob) glob = utils$l.removeBackslashes(glob);
32785
32786     if (base && backslashes === true) {
32787       base = utils$l.removeBackslashes(base);
32788     }
32789   }
32790
32791   const state = {
32792     prefix,
32793     input,
32794     start,
32795     base,
32796     glob,
32797     isBrace,
32798     isBracket,
32799     isGlob,
32800     isExtglob,
32801     isGlobstar,
32802     negated,
32803     negatedExtglob
32804   };
32805
32806   if (opts.tokens === true) {
32807     state.maxDepth = 0;
32808
32809     if (!isPathSeparator(code)) {
32810       tokens.push(token);
32811     }
32812
32813     state.tokens = tokens;
32814   }
32815
32816   if (opts.parts === true || opts.tokens === true) {
32817     let prevIndex;
32818
32819     for (let idx = 0; idx < slashes.length; idx++) {
32820       const n = prevIndex ? prevIndex + 1 : start;
32821       const i = slashes[idx];
32822       const value = input.slice(n, i);
32823
32824       if (opts.tokens) {
32825         if (idx === 0 && start !== 0) {
32826           tokens[idx].isPrefix = true;
32827           tokens[idx].value = prefix;
32828         } else {
32829           tokens[idx].value = value;
32830         }
32831
32832         depth(tokens[idx]);
32833         state.maxDepth += tokens[idx].depth;
32834       }
32835
32836       if (idx !== 0 || value !== '') {
32837         parts.push(value);
32838       }
32839
32840       prevIndex = i;
32841     }
32842
32843     if (prevIndex && prevIndex + 1 < input.length) {
32844       const value = input.slice(prevIndex + 1);
32845       parts.push(value);
32846
32847       if (opts.tokens) {
32848         tokens[tokens.length - 1].value = value;
32849         depth(tokens[tokens.length - 1]);
32850         state.maxDepth += tokens[tokens.length - 1].depth;
32851       }
32852     }
32853
32854     state.slashes = slashes;
32855     state.parts = parts;
32856   }
32857
32858   return state;
32859 };
32860
32861 var scan_1 = scan$1;
32862
32863 const constants$2 = constants$3;
32864 const utils$k = utils$m;
32865 /**
32866  * Constants
32867  */
32868
32869 const {
32870   MAX_LENGTH,
32871   POSIX_REGEX_SOURCE,
32872   REGEX_NON_SPECIAL_CHARS,
32873   REGEX_SPECIAL_CHARS_BACKREF,
32874   REPLACEMENTS
32875 } = constants$2;
32876 /**
32877  * Helpers
32878  */
32879
32880 const expandRange = (args, options) => {
32881   if (typeof options.expandRange === 'function') {
32882     return options.expandRange(...args, options);
32883   }
32884
32885   args.sort();
32886   const value = `[${args.join('-')}]`;
32887
32888   try {
32889     /* eslint-disable-next-line no-new */
32890     new RegExp(value);
32891   } catch (ex) {
32892     return args.map(v => utils$k.escapeRegex(v)).join('..');
32893   }
32894
32895   return value;
32896 };
32897 /**
32898  * Create the message for a syntax error
32899  */
32900
32901
32902 const syntaxError$1 = (type, char) => {
32903   return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
32904 };
32905 /**
32906  * Parse the given input string.
32907  * @param {String} input
32908  * @param {Object} options
32909  * @return {Object}
32910  */
32911
32912
32913 const parse$3 = (input, options) => {
32914   if (typeof input !== 'string') {
32915     throw new TypeError('Expected a string');
32916   }
32917
32918   input = REPLACEMENTS[input] || input;
32919   const opts = Object.assign({}, options);
32920   const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
32921   let len = input.length;
32922
32923   if (len > max) {
32924     throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
32925   }
32926
32927   const bos = {
32928     type: 'bos',
32929     value: '',
32930     output: opts.prepend || ''
32931   };
32932   const tokens = [bos];
32933   const capture = opts.capture ? '' : '?:';
32934   const win32 = utils$k.isWindows(options); // create constants based on platform, for windows or posix
32935
32936   const PLATFORM_CHARS = constants$2.globChars(win32);
32937   const EXTGLOB_CHARS = constants$2.extglobChars(PLATFORM_CHARS);
32938   const {
32939     DOT_LITERAL,
32940     PLUS_LITERAL,
32941     SLASH_LITERAL,
32942     ONE_CHAR,
32943     DOTS_SLASH,
32944     NO_DOT,
32945     NO_DOT_SLASH,
32946     NO_DOTS_SLASH,
32947     QMARK,
32948     QMARK_NO_DOT,
32949     STAR,
32950     START_ANCHOR
32951   } = PLATFORM_CHARS;
32952
32953   const globstar = opts => {
32954     return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
32955   };
32956
32957   const nodot = opts.dot ? '' : NO_DOT;
32958   const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
32959   let star = opts.bash === true ? globstar(opts) : STAR;
32960
32961   if (opts.capture) {
32962     star = `(${star})`;
32963   } // minimatch options support
32964
32965
32966   if (typeof opts.noext === 'boolean') {
32967     opts.noextglob = opts.noext;
32968   }
32969
32970   const state = {
32971     input,
32972     index: -1,
32973     start: 0,
32974     dot: opts.dot === true,
32975     consumed: '',
32976     output: '',
32977     prefix: '',
32978     backtrack: false,
32979     negated: false,
32980     brackets: 0,
32981     braces: 0,
32982     parens: 0,
32983     quotes: 0,
32984     globstar: false,
32985     tokens
32986   };
32987   input = utils$k.removePrefix(input, state);
32988   len = input.length;
32989   const extglobs = [];
32990   const braces = [];
32991   const stack = [];
32992   let prev = bos;
32993   let value;
32994   /**
32995    * Tokenizing helpers
32996    */
32997
32998   const eos = () => state.index === len - 1;
32999
33000   const peek = state.peek = (n = 1) => input[state.index + n];
33001
33002   const advance = state.advance = () => input[++state.index] || '';
33003
33004   const remaining = () => input.slice(state.index + 1);
33005
33006   const consume = (value = '', num = 0) => {
33007     state.consumed += value;
33008     state.index += num;
33009   };
33010
33011   const append = token => {
33012     state.output += token.output != null ? token.output : token.value;
33013     consume(token.value);
33014   };
33015
33016   const negate = () => {
33017     let count = 1;
33018
33019     while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
33020       advance();
33021       state.start++;
33022       count++;
33023     }
33024
33025     if (count % 2 === 0) {
33026       return false;
33027     }
33028
33029     state.negated = true;
33030     state.start++;
33031     return true;
33032   };
33033
33034   const increment = type => {
33035     state[type]++;
33036     stack.push(type);
33037   };
33038
33039   const decrement = type => {
33040     state[type]--;
33041     stack.pop();
33042   };
33043   /**
33044    * Push tokens onto the tokens array. This helper speeds up
33045    * tokenizing by 1) helping us avoid backtracking as much as possible,
33046    * and 2) helping us avoid creating extra tokens when consecutive
33047    * characters are plain text. This improves performance and simplifies
33048    * lookbehinds.
33049    */
33050
33051
33052   const push = tok => {
33053     if (prev.type === 'globstar') {
33054       const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
33055       const isExtglob = tok.extglob === true || extglobs.length && (tok.type === 'pipe' || tok.type === 'paren');
33056
33057       if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
33058         state.output = state.output.slice(0, -prev.output.length);
33059         prev.type = 'star';
33060         prev.value = '*';
33061         prev.output = star;
33062         state.output += prev.output;
33063       }
33064     }
33065
33066     if (extglobs.length && tok.type !== 'paren') {
33067       extglobs[extglobs.length - 1].inner += tok.value;
33068     }
33069
33070     if (tok.value || tok.output) append(tok);
33071
33072     if (prev && prev.type === 'text' && tok.type === 'text') {
33073       prev.value += tok.value;
33074       prev.output = (prev.output || '') + tok.value;
33075       return;
33076     }
33077
33078     tok.prev = prev;
33079     tokens.push(tok);
33080     prev = tok;
33081   };
33082
33083   const extglobOpen = (type, value) => {
33084     const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value]), {}, {
33085       conditions: 1,
33086       inner: ''
33087     });
33088     token.prev = prev;
33089     token.parens = state.parens;
33090     token.output = state.output;
33091     const output = (opts.capture ? '(' : '') + token.open;
33092     increment('parens');
33093     push({
33094       type,
33095       value,
33096       output: state.output ? '' : ONE_CHAR
33097     });
33098     push({
33099       type: 'paren',
33100       extglob: true,
33101       value: advance(),
33102       output
33103     });
33104     extglobs.push(token);
33105   };
33106
33107   const extglobClose = token => {
33108     let output = token.close + (opts.capture ? ')' : '');
33109     let rest;
33110
33111     if (token.type === 'negate') {
33112       let extglobStar = star;
33113
33114       if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
33115         extglobStar = globstar(opts);
33116       }
33117
33118       if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
33119         output = token.close = `)$))${extglobStar}`;
33120       }
33121
33122       if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
33123         output = token.close = `)${rest})${extglobStar})`;
33124       }
33125
33126       if (token.prev.type === 'bos') {
33127         state.negatedExtglob = true;
33128       }
33129     }
33130
33131     push({
33132       type: 'paren',
33133       extglob: true,
33134       value,
33135       output
33136     });
33137     decrement('parens');
33138   };
33139   /**
33140    * Fast paths
33141    */
33142
33143
33144   if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
33145     let backslashes = false;
33146     let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
33147       if (first === '\\') {
33148         backslashes = true;
33149         return m;
33150       }
33151
33152       if (first === '?') {
33153         if (esc) {
33154           return esc + first + (rest ? QMARK.repeat(rest.length) : '');
33155         }
33156
33157         if (index === 0) {
33158           return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
33159         }
33160
33161         return QMARK.repeat(chars.length);
33162       }
33163
33164       if (first === '.') {
33165         return DOT_LITERAL.repeat(chars.length);
33166       }
33167
33168       if (first === '*') {
33169         if (esc) {
33170           return esc + first + (rest ? star : '');
33171         }
33172
33173         return star;
33174       }
33175
33176       return esc ? m : `\\${m}`;
33177     });
33178
33179     if (backslashes === true) {
33180       if (opts.unescape === true) {
33181         output = output.replace(/\\/g, '');
33182       } else {
33183         output = output.replace(/\\+/g, m => {
33184           return m.length % 2 === 0 ? '\\\\' : m ? '\\' : '';
33185         });
33186       }
33187     }
33188
33189     if (output === input && opts.contains === true) {
33190       state.output = input;
33191       return state;
33192     }
33193
33194     state.output = utils$k.wrapOutput(output, state, options);
33195     return state;
33196   }
33197   /**
33198    * Tokenize input until we reach end-of-string
33199    */
33200
33201
33202   while (!eos()) {
33203     value = advance();
33204
33205     if (value === '\u0000') {
33206       continue;
33207     }
33208     /**
33209      * Escaped characters
33210      */
33211
33212
33213     if (value === '\\') {
33214       const next = peek();
33215
33216       if (next === '/' && opts.bash !== true) {
33217         continue;
33218       }
33219
33220       if (next === '.' || next === ';') {
33221         continue;
33222       }
33223
33224       if (!next) {
33225         value += '\\';
33226         push({
33227           type: 'text',
33228           value
33229         });
33230         continue;
33231       } // collapse slashes to reduce potential for exploits
33232
33233
33234       const match = /^\\+/.exec(remaining());
33235       let slashes = 0;
33236
33237       if (match && match[0].length > 2) {
33238         slashes = match[0].length;
33239         state.index += slashes;
33240
33241         if (slashes % 2 !== 0) {
33242           value += '\\';
33243         }
33244       }
33245
33246       if (opts.unescape === true) {
33247         value = advance();
33248       } else {
33249         value += advance();
33250       }
33251
33252       if (state.brackets === 0) {
33253         push({
33254           type: 'text',
33255           value
33256         });
33257         continue;
33258       }
33259     }
33260     /**
33261      * If we're inside a regex character class, continue
33262      * until we reach the closing bracket.
33263      */
33264
33265
33266     if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
33267       if (opts.posix !== false && value === ':') {
33268         const inner = prev.value.slice(1);
33269
33270         if (inner.includes('[')) {
33271           prev.posix = true;
33272
33273           if (inner.includes(':')) {
33274             const idx = prev.value.lastIndexOf('[');
33275             const pre = prev.value.slice(0, idx);
33276             const rest = prev.value.slice(idx + 2);
33277             const posix = POSIX_REGEX_SOURCE[rest];
33278
33279             if (posix) {
33280               prev.value = pre + posix;
33281               state.backtrack = true;
33282               advance();
33283
33284               if (!bos.output && tokens.indexOf(prev) === 1) {
33285                 bos.output = ONE_CHAR;
33286               }
33287
33288               continue;
33289             }
33290           }
33291         }
33292       }
33293
33294       if (value === '[' && peek() !== ':' || value === '-' && peek() === ']') {
33295         value = `\\${value}`;
33296       }
33297
33298       if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
33299         value = `\\${value}`;
33300       }
33301
33302       if (opts.posix === true && value === '!' && prev.value === '[') {
33303         value = '^';
33304       }
33305
33306       prev.value += value;
33307       append({
33308         value
33309       });
33310       continue;
33311     }
33312     /**
33313      * If we're inside a quoted string, continue
33314      * until we reach the closing double quote.
33315      */
33316
33317
33318     if (state.quotes === 1 && value !== '"') {
33319       value = utils$k.escapeRegex(value);
33320       prev.value += value;
33321       append({
33322         value
33323       });
33324       continue;
33325     }
33326     /**
33327      * Double quotes
33328      */
33329
33330
33331     if (value === '"') {
33332       state.quotes = state.quotes === 1 ? 0 : 1;
33333
33334       if (opts.keepQuotes === true) {
33335         push({
33336           type: 'text',
33337           value
33338         });
33339       }
33340
33341       continue;
33342     }
33343     /**
33344      * Parentheses
33345      */
33346
33347
33348     if (value === '(') {
33349       increment('parens');
33350       push({
33351         type: 'paren',
33352         value
33353       });
33354       continue;
33355     }
33356
33357     if (value === ')') {
33358       if (state.parens === 0 && opts.strictBrackets === true) {
33359         throw new SyntaxError(syntaxError$1('opening', '('));
33360       }
33361
33362       const extglob = extglobs[extglobs.length - 1];
33363
33364       if (extglob && state.parens === extglob.parens + 1) {
33365         extglobClose(extglobs.pop());
33366         continue;
33367       }
33368
33369       push({
33370         type: 'paren',
33371         value,
33372         output: state.parens ? ')' : '\\)'
33373       });
33374       decrement('parens');
33375       continue;
33376     }
33377     /**
33378      * Square brackets
33379      */
33380
33381
33382     if (value === '[') {
33383       if (opts.nobracket === true || !remaining().includes(']')) {
33384         if (opts.nobracket !== true && opts.strictBrackets === true) {
33385           throw new SyntaxError(syntaxError$1('closing', ']'));
33386         }
33387
33388         value = `\\${value}`;
33389       } else {
33390         increment('brackets');
33391       }
33392
33393       push({
33394         type: 'bracket',
33395         value
33396       });
33397       continue;
33398     }
33399
33400     if (value === ']') {
33401       if (opts.nobracket === true || prev && prev.type === 'bracket' && prev.value.length === 1) {
33402         push({
33403           type: 'text',
33404           value,
33405           output: `\\${value}`
33406         });
33407         continue;
33408       }
33409
33410       if (state.brackets === 0) {
33411         if (opts.strictBrackets === true) {
33412           throw new SyntaxError(syntaxError$1('opening', '['));
33413         }
33414
33415         push({
33416           type: 'text',
33417           value,
33418           output: `\\${value}`
33419         });
33420         continue;
33421       }
33422
33423       decrement('brackets');
33424       const prevValue = prev.value.slice(1);
33425
33426       if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
33427         value = `/${value}`;
33428       }
33429
33430       prev.value += value;
33431       append({
33432         value
33433       }); // when literal brackets are explicitly disabled
33434       // assume we should match with a regex character class
33435
33436       if (opts.literalBrackets === false || utils$k.hasRegexChars(prevValue)) {
33437         continue;
33438       }
33439
33440       const escaped = utils$k.escapeRegex(prev.value);
33441       state.output = state.output.slice(0, -prev.value.length); // when literal brackets are explicitly enabled
33442       // assume we should escape the brackets to match literal characters
33443
33444       if (opts.literalBrackets === true) {
33445         state.output += escaped;
33446         prev.value = escaped;
33447         continue;
33448       } // when the user specifies nothing, try to match both
33449
33450
33451       prev.value = `(${capture}${escaped}|${prev.value})`;
33452       state.output += prev.value;
33453       continue;
33454     }
33455     /**
33456      * Braces
33457      */
33458
33459
33460     if (value === '{' && opts.nobrace !== true) {
33461       increment('braces');
33462       const open = {
33463         type: 'brace',
33464         value,
33465         output: '(',
33466         outputIndex: state.output.length,
33467         tokensIndex: state.tokens.length
33468       };
33469       braces.push(open);
33470       push(open);
33471       continue;
33472     }
33473
33474     if (value === '}') {
33475       const brace = braces[braces.length - 1];
33476
33477       if (opts.nobrace === true || !brace) {
33478         push({
33479           type: 'text',
33480           value,
33481           output: value
33482         });
33483         continue;
33484       }
33485
33486       let output = ')';
33487
33488       if (brace.dots === true) {
33489         const arr = tokens.slice();
33490         const range = [];
33491
33492         for (let i = arr.length - 1; i >= 0; i--) {
33493           tokens.pop();
33494
33495           if (arr[i].type === 'brace') {
33496             break;
33497           }
33498
33499           if (arr[i].type !== 'dots') {
33500             range.unshift(arr[i].value);
33501           }
33502         }
33503
33504         output = expandRange(range, opts);
33505         state.backtrack = true;
33506       }
33507
33508       if (brace.comma !== true && brace.dots !== true) {
33509         const out = state.output.slice(0, brace.outputIndex);
33510         const toks = state.tokens.slice(brace.tokensIndex);
33511         brace.value = brace.output = '\\{';
33512         value = output = '\\}';
33513         state.output = out;
33514
33515         for (const t of toks) {
33516           state.output += t.output || t.value;
33517         }
33518       }
33519
33520       push({
33521         type: 'brace',
33522         value,
33523         output
33524       });
33525       decrement('braces');
33526       braces.pop();
33527       continue;
33528     }
33529     /**
33530      * Pipes
33531      */
33532
33533
33534     if (value === '|') {
33535       if (extglobs.length > 0) {
33536         extglobs[extglobs.length - 1].conditions++;
33537       }
33538
33539       push({
33540         type: 'text',
33541         value
33542       });
33543       continue;
33544     }
33545     /**
33546      * Commas
33547      */
33548
33549
33550     if (value === ',') {
33551       let output = value;
33552       const brace = braces[braces.length - 1];
33553
33554       if (brace && stack[stack.length - 1] === 'braces') {
33555         brace.comma = true;
33556         output = '|';
33557       }
33558
33559       push({
33560         type: 'comma',
33561         value,
33562         output
33563       });
33564       continue;
33565     }
33566     /**
33567      * Slashes
33568      */
33569
33570
33571     if (value === '/') {
33572       // if the beginning of the glob is "./", advance the start
33573       // to the current index, and don't add the "./" characters
33574       // to the state. This greatly simplifies lookbehinds when
33575       // checking for BOS characters like "!" and "." (not "./")
33576       if (prev.type === 'dot' && state.index === state.start + 1) {
33577         state.start = state.index + 1;
33578         state.consumed = '';
33579         state.output = '';
33580         tokens.pop();
33581         prev = bos; // reset "prev" to the first token
33582
33583         continue;
33584       }
33585
33586       push({
33587         type: 'slash',
33588         value,
33589         output: SLASH_LITERAL
33590       });
33591       continue;
33592     }
33593     /**
33594      * Dots
33595      */
33596
33597
33598     if (value === '.') {
33599       if (state.braces > 0 && prev.type === 'dot') {
33600         if (prev.value === '.') prev.output = DOT_LITERAL;
33601         const brace = braces[braces.length - 1];
33602         prev.type = 'dots';
33603         prev.output += value;
33604         prev.value += value;
33605         brace.dots = true;
33606         continue;
33607       }
33608
33609       if (state.braces + state.parens === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
33610         push({
33611           type: 'text',
33612           value,
33613           output: DOT_LITERAL
33614         });
33615         continue;
33616       }
33617
33618       push({
33619         type: 'dot',
33620         value,
33621         output: DOT_LITERAL
33622       });
33623       continue;
33624     }
33625     /**
33626      * Question marks
33627      */
33628
33629
33630     if (value === '?') {
33631       const isGroup = prev && prev.value === '(';
33632
33633       if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
33634         extglobOpen('qmark', value);
33635         continue;
33636       }
33637
33638       if (prev && prev.type === 'paren') {
33639         const next = peek();
33640         let output = value;
33641
33642         if (next === '<' && !utils$k.supportsLookbehinds()) {
33643           throw new Error('Node.js v10 or higher is required for regex lookbehinds');
33644         }
33645
33646         if (prev.value === '(' && !/[!=<:]/.test(next) || next === '<' && !/<([!=]|\w+>)/.test(remaining())) {
33647           output = `\\${value}`;
33648         }
33649
33650         push({
33651           type: 'text',
33652           value,
33653           output
33654         });
33655         continue;
33656       }
33657
33658       if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
33659         push({
33660           type: 'qmark',
33661           value,
33662           output: QMARK_NO_DOT
33663         });
33664         continue;
33665       }
33666
33667       push({
33668         type: 'qmark',
33669         value,
33670         output: QMARK
33671       });
33672       continue;
33673     }
33674     /**
33675      * Exclamation
33676      */
33677
33678
33679     if (value === '!') {
33680       if (opts.noextglob !== true && peek() === '(') {
33681         if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
33682           extglobOpen('negate', value);
33683           continue;
33684         }
33685       }
33686
33687       if (opts.nonegate !== true && state.index === 0) {
33688         negate();
33689         continue;
33690       }
33691     }
33692     /**
33693      * Plus
33694      */
33695
33696
33697     if (value === '+') {
33698       if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
33699         extglobOpen('plus', value);
33700         continue;
33701       }
33702
33703       if (prev && prev.value === '(' || opts.regex === false) {
33704         push({
33705           type: 'plus',
33706           value,
33707           output: PLUS_LITERAL
33708         });
33709         continue;
33710       }
33711
33712       if (prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace') || state.parens > 0) {
33713         push({
33714           type: 'plus',
33715           value
33716         });
33717         continue;
33718       }
33719
33720       push({
33721         type: 'plus',
33722         value: PLUS_LITERAL
33723       });
33724       continue;
33725     }
33726     /**
33727      * Plain text
33728      */
33729
33730
33731     if (value === '@') {
33732       if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
33733         push({
33734           type: 'at',
33735           extglob: true,
33736           value,
33737           output: ''
33738         });
33739         continue;
33740       }
33741
33742       push({
33743         type: 'text',
33744         value
33745       });
33746       continue;
33747     }
33748     /**
33749      * Plain text
33750      */
33751
33752
33753     if (value !== '*') {
33754       if (value === '$' || value === '^') {
33755         value = `\\${value}`;
33756       }
33757
33758       const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
33759
33760       if (match) {
33761         value += match[0];
33762         state.index += match[0].length;
33763       }
33764
33765       push({
33766         type: 'text',
33767         value
33768       });
33769       continue;
33770     }
33771     /**
33772      * Stars
33773      */
33774
33775
33776     if (prev && (prev.type === 'globstar' || prev.star === true)) {
33777       prev.type = 'star';
33778       prev.star = true;
33779       prev.value += value;
33780       prev.output = star;
33781       state.backtrack = true;
33782       state.globstar = true;
33783       consume(value);
33784       continue;
33785     }
33786
33787     let rest = remaining();
33788
33789     if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
33790       extglobOpen('star', value);
33791       continue;
33792     }
33793
33794     if (prev.type === 'star') {
33795       if (opts.noglobstar === true) {
33796         consume(value);
33797         continue;
33798       }
33799
33800       const prior = prev.prev;
33801       const before = prior.prev;
33802       const isStart = prior.type === 'slash' || prior.type === 'bos';
33803       const afterStar = before && (before.type === 'star' || before.type === 'globstar');
33804
33805       if (opts.bash === true && (!isStart || rest[0] && rest[0] !== '/')) {
33806         push({
33807           type: 'star',
33808           value,
33809           output: ''
33810         });
33811         continue;
33812       }
33813
33814       const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
33815       const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
33816
33817       if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
33818         push({
33819           type: 'star',
33820           value,
33821           output: ''
33822         });
33823         continue;
33824       } // strip consecutive `/**/`
33825
33826
33827       while (rest.slice(0, 3) === '/**') {
33828         const after = input[state.index + 4];
33829
33830         if (after && after !== '/') {
33831           break;
33832         }
33833
33834         rest = rest.slice(3);
33835         consume('/**', 3);
33836       }
33837
33838       if (prior.type === 'bos' && eos()) {
33839         prev.type = 'globstar';
33840         prev.value += value;
33841         prev.output = globstar(opts);
33842         state.output = prev.output;
33843         state.globstar = true;
33844         consume(value);
33845         continue;
33846       }
33847
33848       if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
33849         state.output = state.output.slice(0, -(prior.output + prev.output).length);
33850         prior.output = `(?:${prior.output}`;
33851         prev.type = 'globstar';
33852         prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
33853         prev.value += value;
33854         state.globstar = true;
33855         state.output += prior.output + prev.output;
33856         consume(value);
33857         continue;
33858       }
33859
33860       if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
33861         const end = rest[1] !== void 0 ? '|$' : '';
33862         state.output = state.output.slice(0, -(prior.output + prev.output).length);
33863         prior.output = `(?:${prior.output}`;
33864         prev.type = 'globstar';
33865         prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
33866         prev.value += value;
33867         state.output += prior.output + prev.output;
33868         state.globstar = true;
33869         consume(value + advance());
33870         push({
33871           type: 'slash',
33872           value: '/',
33873           output: ''
33874         });
33875         continue;
33876       }
33877
33878       if (prior.type === 'bos' && rest[0] === '/') {
33879         prev.type = 'globstar';
33880         prev.value += value;
33881         prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
33882         state.output = prev.output;
33883         state.globstar = true;
33884         consume(value + advance());
33885         push({
33886           type: 'slash',
33887           value: '/',
33888           output: ''
33889         });
33890         continue;
33891       } // remove single star from output
33892
33893
33894       state.output = state.output.slice(0, -prev.output.length); // reset previous token to globstar
33895
33896       prev.type = 'globstar';
33897       prev.output = globstar(opts);
33898       prev.value += value; // reset output with globstar
33899
33900       state.output += prev.output;
33901       state.globstar = true;
33902       consume(value);
33903       continue;
33904     }
33905
33906     const token = {
33907       type: 'star',
33908       value,
33909       output: star
33910     };
33911
33912     if (opts.bash === true) {
33913       token.output = '.*?';
33914
33915       if (prev.type === 'bos' || prev.type === 'slash') {
33916         token.output = nodot + token.output;
33917       }
33918
33919       push(token);
33920       continue;
33921     }
33922
33923     if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
33924       token.output = value;
33925       push(token);
33926       continue;
33927     }
33928
33929     if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
33930       if (prev.type === 'dot') {
33931         state.output += NO_DOT_SLASH;
33932         prev.output += NO_DOT_SLASH;
33933       } else if (opts.dot === true) {
33934         state.output += NO_DOTS_SLASH;
33935         prev.output += NO_DOTS_SLASH;
33936       } else {
33937         state.output += nodot;
33938         prev.output += nodot;
33939       }
33940
33941       if (peek() !== '*') {
33942         state.output += ONE_CHAR;
33943         prev.output += ONE_CHAR;
33944       }
33945     }
33946
33947     push(token);
33948   }
33949
33950   while (state.brackets > 0) {
33951     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ']'));
33952     state.output = utils$k.escapeLast(state.output, '[');
33953     decrement('brackets');
33954   }
33955
33956   while (state.parens > 0) {
33957     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', ')'));
33958     state.output = utils$k.escapeLast(state.output, '(');
33959     decrement('parens');
33960   }
33961
33962   while (state.braces > 0) {
33963     if (opts.strictBrackets === true) throw new SyntaxError(syntaxError$1('closing', '}'));
33964     state.output = utils$k.escapeLast(state.output, '{');
33965     decrement('braces');
33966   }
33967
33968   if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
33969     push({
33970       type: 'maybe_slash',
33971       value: '',
33972       output: `${SLASH_LITERAL}?`
33973     });
33974   } // rebuild the output if we had to backtrack at any point
33975
33976
33977   if (state.backtrack === true) {
33978     state.output = '';
33979
33980     for (const token of state.tokens) {
33981       state.output += token.output != null ? token.output : token.value;
33982
33983       if (token.suffix) {
33984         state.output += token.suffix;
33985       }
33986     }
33987   }
33988
33989   return state;
33990 };
33991 /**
33992  * Fast paths for creating regular expressions for common glob patterns.
33993  * This can significantly speed up processing and has very little downside
33994  * impact when none of the fast paths match.
33995  */
33996
33997
33998 parse$3.fastpaths = (input, options) => {
33999   const opts = Object.assign({}, options);
34000   const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
34001   const len = input.length;
34002
34003   if (len > max) {
34004     throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
34005   }
34006
34007   input = REPLACEMENTS[input] || input;
34008   const win32 = utils$k.isWindows(options); // create constants based on platform, for windows or posix
34009
34010   const {
34011     DOT_LITERAL,
34012     SLASH_LITERAL,
34013     ONE_CHAR,
34014     DOTS_SLASH,
34015     NO_DOT,
34016     NO_DOTS,
34017     NO_DOTS_SLASH,
34018     STAR,
34019     START_ANCHOR
34020   } = constants$2.globChars(win32);
34021   const nodot = opts.dot ? NO_DOTS : NO_DOT;
34022   const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
34023   const capture = opts.capture ? '' : '?:';
34024   const state = {
34025     negated: false,
34026     prefix: ''
34027   };
34028   let star = opts.bash === true ? '.*?' : STAR;
34029
34030   if (opts.capture) {
34031     star = `(${star})`;
34032   }
34033
34034   const globstar = opts => {
34035     if (opts.noglobstar === true) return star;
34036     return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
34037   };
34038
34039   const create = str => {
34040     switch (str) {
34041       case '*':
34042         return `${nodot}${ONE_CHAR}${star}`;
34043
34044       case '.*':
34045         return `${DOT_LITERAL}${ONE_CHAR}${star}`;
34046
34047       case '*.*':
34048         return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
34049
34050       case '*/*':
34051         return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
34052
34053       case '**':
34054         return nodot + globstar(opts);
34055
34056       case '**/*':
34057         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
34058
34059       case '**/*.*':
34060         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
34061
34062       case '**/.*':
34063         return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
34064
34065       default:
34066         {
34067           const match = /^(.*?)\.(\w+)$/.exec(str);
34068           if (!match) return;
34069           const source = create(match[1]);
34070           if (!source) return;
34071           return source + DOT_LITERAL + match[2];
34072         }
34073     }
34074   };
34075
34076   const output = utils$k.removePrefix(input, state);
34077   let source = create(output);
34078
34079   if (source && opts.strictSlashes !== true) {
34080     source += `${SLASH_LITERAL}?`;
34081   }
34082
34083   return source;
34084 };
34085
34086 var parse_1$1 = parse$3;
34087
34088 const path$9 = require$$0__default$2["default"];
34089 const scan = scan_1;
34090 const parse$2 = parse_1$1;
34091 const utils$j = utils$m;
34092 const constants$1 = constants$3;
34093
34094 const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
34095 /**
34096  * Creates a matcher function from one or more glob patterns. The
34097  * returned function takes a string to match as its first argument,
34098  * and returns true if the string is a match. The returned matcher
34099  * function also takes a boolean as the second argument that, when true,
34100  * returns an object with additional information.
34101  *
34102  * ```js
34103  * const picomatch = require('picomatch');
34104  * // picomatch(glob[, options]);
34105  *
34106  * const isMatch = picomatch('*.!(*a)');
34107  * console.log(isMatch('a.a')); //=> false
34108  * console.log(isMatch('a.b')); //=> true
34109  * ```
34110  * @name picomatch
34111  * @param {String|Array} `globs` One or more glob patterns.
34112  * @param {Object=} `options`
34113  * @return {Function=} Returns a matcher function.
34114  * @api public
34115  */
34116
34117
34118 const picomatch$2 = (glob, options, returnState = false) => {
34119   if (Array.isArray(glob)) {
34120     const fns = glob.map(input => picomatch$2(input, options, returnState));
34121
34122     const arrayMatcher = str => {
34123       for (const isMatch of fns) {
34124         const state = isMatch(str);
34125         if (state) return state;
34126       }
34127
34128       return false;
34129     };
34130
34131     return arrayMatcher;
34132   }
34133
34134   const isState = isObject(glob) && glob.tokens && glob.input;
34135
34136   if (glob === '' || typeof glob !== 'string' && !isState) {
34137     throw new TypeError('Expected pattern to be a non-empty string');
34138   }
34139
34140   const opts = options || {};
34141   const posix = utils$j.isWindows(options);
34142   const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
34143   const state = regex.state;
34144   delete regex.state;
34145
34146   let isIgnored = () => false;
34147
34148   if (opts.ignore) {
34149     const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
34150       ignore: null,
34151       onMatch: null,
34152       onResult: null
34153     });
34154     isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
34155   }
34156
34157   const matcher = (input, returnObject = false) => {
34158     const {
34159       isMatch,
34160       match,
34161       output
34162     } = picomatch$2.test(input, regex, options, {
34163       glob,
34164       posix
34165     });
34166     const result = {
34167       glob,
34168       state,
34169       regex,
34170       posix,
34171       input,
34172       output,
34173       match,
34174       isMatch
34175     };
34176
34177     if (typeof opts.onResult === 'function') {
34178       opts.onResult(result);
34179     }
34180
34181     if (isMatch === false) {
34182       result.isMatch = false;
34183       return returnObject ? result : false;
34184     }
34185
34186     if (isIgnored(input)) {
34187       if (typeof opts.onIgnore === 'function') {
34188         opts.onIgnore(result);
34189       }
34190
34191       result.isMatch = false;
34192       return returnObject ? result : false;
34193     }
34194
34195     if (typeof opts.onMatch === 'function') {
34196       opts.onMatch(result);
34197     }
34198
34199     return returnObject ? result : true;
34200   };
34201
34202   if (returnState) {
34203     matcher.state = state;
34204   }
34205
34206   return matcher;
34207 };
34208 /**
34209  * Test `input` with the given `regex`. This is used by the main
34210  * `picomatch()` function to test the input string.
34211  *
34212  * ```js
34213  * const picomatch = require('picomatch');
34214  * // picomatch.test(input, regex[, options]);
34215  *
34216  * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
34217  * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
34218  * ```
34219  * @param {String} `input` String to test.
34220  * @param {RegExp} `regex`
34221  * @return {Object} Returns an object with matching info.
34222  * @api public
34223  */
34224
34225
34226 picomatch$2.test = (input, regex, options, {
34227   glob,
34228   posix
34229 } = {}) => {
34230   if (typeof input !== 'string') {
34231     throw new TypeError('Expected input to be a string');
34232   }
34233
34234   if (input === '') {
34235     return {
34236       isMatch: false,
34237       output: ''
34238     };
34239   }
34240
34241   const opts = options || {};
34242   const format = opts.format || (posix ? utils$j.toPosixSlashes : null);
34243   let match = input === glob;
34244   let output = match && format ? format(input) : input;
34245
34246   if (match === false) {
34247     output = format ? format(input) : input;
34248     match = output === glob;
34249   }
34250
34251   if (match === false || opts.capture === true) {
34252     if (opts.matchBase === true || opts.basename === true) {
34253       match = picomatch$2.matchBase(input, regex, options, posix);
34254     } else {
34255       match = regex.exec(output);
34256     }
34257   }
34258
34259   return {
34260     isMatch: Boolean(match),
34261     match,
34262     output
34263   };
34264 };
34265 /**
34266  * Match the basename of a filepath.
34267  *
34268  * ```js
34269  * const picomatch = require('picomatch');
34270  * // picomatch.matchBase(input, glob[, options]);
34271  * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
34272  * ```
34273  * @param {String} `input` String to test.
34274  * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
34275  * @return {Boolean}
34276  * @api public
34277  */
34278
34279
34280 picomatch$2.matchBase = (input, glob, options, posix = utils$j.isWindows(options)) => {
34281   const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
34282   return regex.test(path$9.basename(input));
34283 };
34284 /**
34285  * Returns true if **any** of the given glob `patterns` match the specified `string`.
34286  *
34287  * ```js
34288  * const picomatch = require('picomatch');
34289  * // picomatch.isMatch(string, patterns[, options]);
34290  *
34291  * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
34292  * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
34293  * ```
34294  * @param {String|Array} str The string to test.
34295  * @param {String|Array} patterns One or more glob patterns to use for matching.
34296  * @param {Object} [options] See available [options](#options).
34297  * @return {Boolean} Returns true if any patterns match `str`
34298  * @api public
34299  */
34300
34301
34302 picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
34303 /**
34304  * Parse a glob pattern to create the source string for a regular
34305  * expression.
34306  *
34307  * ```js
34308  * const picomatch = require('picomatch');
34309  * const result = picomatch.parse(pattern[, options]);
34310  * ```
34311  * @param {String} `pattern`
34312  * @param {Object} `options`
34313  * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
34314  * @api public
34315  */
34316
34317
34318 picomatch$2.parse = (pattern, options) => {
34319   if (Array.isArray(pattern)) return pattern.map(p => picomatch$2.parse(p, options));
34320   return parse$2(pattern, Object.assign(Object.assign({}, options), {}, {
34321     fastpaths: false
34322   }));
34323 };
34324 /**
34325  * Scan a glob pattern to separate the pattern into segments.
34326  *
34327  * ```js
34328  * const picomatch = require('picomatch');
34329  * // picomatch.scan(input[, options]);
34330  *
34331  * const result = picomatch.scan('!./foo/*.js');
34332  * console.log(result);
34333  * { prefix: '!./',
34334  *   input: '!./foo/*.js',
34335  *   start: 3,
34336  *   base: 'foo',
34337  *   glob: '*.js',
34338  *   isBrace: false,
34339  *   isBracket: false,
34340  *   isGlob: true,
34341  *   isExtglob: false,
34342  *   isGlobstar: false,
34343  *   negated: true }
34344  * ```
34345  * @param {String} `input` Glob pattern to scan.
34346  * @param {Object} `options`
34347  * @return {Object} Returns an object with
34348  * @api public
34349  */
34350
34351
34352 picomatch$2.scan = (input, options) => scan(input, options);
34353 /**
34354  * Compile a regular expression from the `state` object returned by the
34355  * [parse()](#parse) method.
34356  *
34357  * @param {Object} `state`
34358  * @param {Object} `options`
34359  * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
34360  * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
34361  * @return {RegExp}
34362  * @api public
34363  */
34364
34365
34366 picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
34367   if (returnOutput === true) {
34368     return state.output;
34369   }
34370
34371   const opts = options || {};
34372   const prepend = opts.contains ? '' : '^';
34373   const append = opts.contains ? '' : '$';
34374   let source = `${prepend}(?:${state.output})${append}`;
34375
34376   if (state && state.negated === true) {
34377     source = `^(?!${source}).*$`;
34378   }
34379
34380   const regex = picomatch$2.toRegex(source, options);
34381
34382   if (returnState === true) {
34383     regex.state = state;
34384   }
34385
34386   return regex;
34387 };
34388 /**
34389  * Create a regular expression from a parsed glob pattern.
34390  *
34391  * ```js
34392  * const picomatch = require('picomatch');
34393  * const state = picomatch.parse('*.js');
34394  * // picomatch.compileRe(state[, options]);
34395  *
34396  * console.log(picomatch.compileRe(state));
34397  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
34398  * ```
34399  * @param {String} `state` The object returned from the `.parse` method.
34400  * @param {Object} `options`
34401  * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
34402  * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
34403  * @return {RegExp} Returns a regex created from the given pattern.
34404  * @api public
34405  */
34406
34407
34408 picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
34409   if (!input || typeof input !== 'string') {
34410     throw new TypeError('Expected a non-empty string');
34411   }
34412
34413   let parsed = {
34414     negated: false,
34415     fastpaths: true
34416   };
34417
34418   if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
34419     parsed.output = parse$2.fastpaths(input, options);
34420   }
34421
34422   if (!parsed.output) {
34423     parsed = parse$2(input, options);
34424   }
34425
34426   return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
34427 };
34428 /**
34429  * Create a regular expression from the given regex source string.
34430  *
34431  * ```js
34432  * const picomatch = require('picomatch');
34433  * // picomatch.toRegex(source[, options]);
34434  *
34435  * const { output } = picomatch.parse('*.js');
34436  * console.log(picomatch.toRegex(output));
34437  * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
34438  * ```
34439  * @param {String} `source` Regular expression source string.
34440  * @param {Object} `options`
34441  * @return {RegExp}
34442  * @api public
34443  */
34444
34445
34446 picomatch$2.toRegex = (source, options) => {
34447   try {
34448     const opts = options || {};
34449     return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
34450   } catch (err) {
34451     if (options && options.debug === true) throw err;
34452     return /$^/;
34453   }
34454 };
34455 /**
34456  * Picomatch constants.
34457  * @return {Object}
34458  */
34459
34460
34461 picomatch$2.constants = constants$1;
34462 /**
34463  * Expose "picomatch"
34464  */
34465
34466 var picomatch_1 = picomatch$2;
34467
34468 var picomatch$1 = picomatch_1;
34469
34470 const util$1 = require$$0__default$4["default"];
34471 const braces = braces_1;
34472 const picomatch = picomatch$1;
34473 const utils$i = utils$m;
34474
34475 const isEmptyString = val => val === '' || val === './';
34476 /**
34477  * Returns an array of strings that match one or more glob patterns.
34478  *
34479  * ```js
34480  * const mm = require('micromatch');
34481  * // mm(list, patterns[, options]);
34482  *
34483  * console.log(mm(['a.js', 'a.txt'], ['*.js']));
34484  * //=> [ 'a.js' ]
34485  * ```
34486  * @param {String|Array<string>} `list` List of strings to match.
34487  * @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
34488  * @param {Object} `options` See available [options](#options)
34489  * @return {Array} Returns an array of matches
34490  * @summary false
34491  * @api public
34492  */
34493
34494
34495 const micromatch$1 = (list, patterns, options) => {
34496   patterns = [].concat(patterns);
34497   list = [].concat(list);
34498   let omit = new Set();
34499   let keep = new Set();
34500   let items = new Set();
34501   let negatives = 0;
34502
34503   let onResult = state => {
34504     items.add(state.output);
34505
34506     if (options && options.onResult) {
34507       options.onResult(state);
34508     }
34509   };
34510
34511   for (let i = 0; i < patterns.length; i++) {
34512     let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
34513       onResult
34514     }), true);
34515     let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
34516     if (negated) negatives++;
34517
34518     for (let item of list) {
34519       let matched = isMatch(item, true);
34520       let match = negated ? !matched.isMatch : matched.isMatch;
34521       if (!match) continue;
34522
34523       if (negated) {
34524         omit.add(matched.output);
34525       } else {
34526         omit.delete(matched.output);
34527         keep.add(matched.output);
34528       }
34529     }
34530   }
34531
34532   let result = negatives === patterns.length ? [...items] : [...keep];
34533   let matches = result.filter(item => !omit.has(item));
34534
34535   if (options && matches.length === 0) {
34536     if (options.failglob === true) {
34537       throw new Error(`No matches found for "${patterns.join(', ')}"`);
34538     }
34539
34540     if (options.nonull === true || options.nullglob === true) {
34541       return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
34542     }
34543   }
34544
34545   return matches;
34546 };
34547 /**
34548  * Backwards compatibility
34549  */
34550
34551
34552 micromatch$1.match = micromatch$1;
34553 /**
34554  * Returns a matcher function from the given glob `pattern` and `options`.
34555  * The returned function takes a string to match as its only argument and returns
34556  * true if the string is a match.
34557  *
34558  * ```js
34559  * const mm = require('micromatch');
34560  * // mm.matcher(pattern[, options]);
34561  *
34562  * const isMatch = mm.matcher('*.!(*a)');
34563  * console.log(isMatch('a.a')); //=> false
34564  * console.log(isMatch('a.b')); //=> true
34565  * ```
34566  * @param {String} `pattern` Glob pattern
34567  * @param {Object} `options`
34568  * @return {Function} Returns a matcher function.
34569  * @api public
34570  */
34571
34572 micromatch$1.matcher = (pattern, options) => picomatch(pattern, options);
34573 /**
34574  * Returns true if **any** of the given glob `patterns` match the specified `string`.
34575  *
34576  * ```js
34577  * const mm = require('micromatch');
34578  * // mm.isMatch(string, patterns[, options]);
34579  *
34580  * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
34581  * console.log(mm.isMatch('a.a', 'b.*')); //=> false
34582  * ```
34583  * @param {String} `str` The string to test.
34584  * @param {String|Array} `patterns` One or more glob patterns to use for matching.
34585  * @param {Object} `[options]` See available [options](#options).
34586  * @return {Boolean} Returns true if any patterns match `str`
34587  * @api public
34588  */
34589
34590
34591 micromatch$1.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
34592 /**
34593  * Backwards compatibility
34594  */
34595
34596
34597 micromatch$1.any = micromatch$1.isMatch;
34598 /**
34599  * Returns a list of strings that _**do not match any**_ of the given `patterns`.
34600  *
34601  * ```js
34602  * const mm = require('micromatch');
34603  * // mm.not(list, patterns[, options]);
34604  *
34605  * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
34606  * //=> ['b.b', 'c.c']
34607  * ```
34608  * @param {Array} `list` Array of strings to match.
34609  * @param {String|Array} `patterns` One or more glob pattern to use for matching.
34610  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34611  * @return {Array} Returns an array of strings that **do not match** the given patterns.
34612  * @api public
34613  */
34614
34615 micromatch$1.not = (list, patterns, options = {}) => {
34616   patterns = [].concat(patterns).map(String);
34617   let result = new Set();
34618   let items = [];
34619
34620   let onResult = state => {
34621     if (options.onResult) options.onResult(state);
34622     items.push(state.output);
34623   };
34624
34625   let matches = micromatch$1(list, patterns, Object.assign(Object.assign({}, options), {}, {
34626     onResult
34627   }));
34628
34629   for (let item of items) {
34630     if (!matches.includes(item)) {
34631       result.add(item);
34632     }
34633   }
34634
34635   return [...result];
34636 };
34637 /**
34638  * Returns true if the given `string` contains the given pattern. Similar
34639  * to [.isMatch](#isMatch) but the pattern can match any part of the string.
34640  *
34641  * ```js
34642  * var mm = require('micromatch');
34643  * // mm.contains(string, pattern[, options]);
34644  *
34645  * console.log(mm.contains('aa/bb/cc', '*b'));
34646  * //=> true
34647  * console.log(mm.contains('aa/bb/cc', '*d'));
34648  * //=> false
34649  * ```
34650  * @param {String} `str` The string to match.
34651  * @param {String|Array} `patterns` Glob pattern to use for matching.
34652  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34653  * @return {Boolean} Returns true if any of the patterns matches any part of `str`.
34654  * @api public
34655  */
34656
34657
34658 micromatch$1.contains = (str, pattern, options) => {
34659   if (typeof str !== 'string') {
34660     throw new TypeError(`Expected a string: "${util$1.inspect(str)}"`);
34661   }
34662
34663   if (Array.isArray(pattern)) {
34664     return pattern.some(p => micromatch$1.contains(str, p, options));
34665   }
34666
34667   if (typeof pattern === 'string') {
34668     if (isEmptyString(str) || isEmptyString(pattern)) {
34669       return false;
34670     }
34671
34672     if (str.includes(pattern) || str.startsWith('./') && str.slice(2).includes(pattern)) {
34673       return true;
34674     }
34675   }
34676
34677   return micromatch$1.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
34678     contains: true
34679   }));
34680 };
34681 /**
34682  * Filter the keys of the given object with the given `glob` pattern
34683  * and `options`. Does not attempt to match nested keys. If you need this feature,
34684  * use [glob-object][] instead.
34685  *
34686  * ```js
34687  * const mm = require('micromatch');
34688  * // mm.matchKeys(object, patterns[, options]);
34689  *
34690  * const obj = { aa: 'a', ab: 'b', ac: 'c' };
34691  * console.log(mm.matchKeys(obj, '*b'));
34692  * //=> { ab: 'b' }
34693  * ```
34694  * @param {Object} `object` The object with keys to filter.
34695  * @param {String|Array} `patterns` One or more glob patterns to use for matching.
34696  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34697  * @return {Object} Returns an object with only keys that match the given patterns.
34698  * @api public
34699  */
34700
34701
34702 micromatch$1.matchKeys = (obj, patterns, options) => {
34703   if (!utils$i.isObject(obj)) {
34704     throw new TypeError('Expected the first argument to be an object');
34705   }
34706
34707   let keys = micromatch$1(Object.keys(obj), patterns, options);
34708   let res = {};
34709
34710   for (let key of keys) res[key] = obj[key];
34711
34712   return res;
34713 };
34714 /**
34715  * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
34716  *
34717  * ```js
34718  * const mm = require('micromatch');
34719  * // mm.some(list, patterns[, options]);
34720  *
34721  * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
34722  * // true
34723  * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
34724  * // false
34725  * ```
34726  * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
34727  * @param {String|Array} `patterns` One or more glob patterns to use for matching.
34728  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34729  * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
34730  * @api public
34731  */
34732
34733
34734 micromatch$1.some = (list, patterns, options) => {
34735   let items = [].concat(list);
34736
34737   for (let pattern of [].concat(patterns)) {
34738     let isMatch = picomatch(String(pattern), options);
34739
34740     if (items.some(item => isMatch(item))) {
34741       return true;
34742     }
34743   }
34744
34745   return false;
34746 };
34747 /**
34748  * Returns true if every string in the given `list` matches
34749  * any of the given glob `patterns`.
34750  *
34751  * ```js
34752  * const mm = require('micromatch');
34753  * // mm.every(list, patterns[, options]);
34754  *
34755  * console.log(mm.every('foo.js', ['foo.js']));
34756  * // true
34757  * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
34758  * // true
34759  * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
34760  * // false
34761  * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
34762  * // false
34763  * ```
34764  * @param {String|Array} `list` The string or array of strings to test.
34765  * @param {String|Array} `patterns` One or more glob patterns to use for matching.
34766  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34767  * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
34768  * @api public
34769  */
34770
34771
34772 micromatch$1.every = (list, patterns, options) => {
34773   let items = [].concat(list);
34774
34775   for (let pattern of [].concat(patterns)) {
34776     let isMatch = picomatch(String(pattern), options);
34777
34778     if (!items.every(item => isMatch(item))) {
34779       return false;
34780     }
34781   }
34782
34783   return true;
34784 };
34785 /**
34786  * Returns true if **all** of the given `patterns` match
34787  * the specified string.
34788  *
34789  * ```js
34790  * const mm = require('micromatch');
34791  * // mm.all(string, patterns[, options]);
34792  *
34793  * console.log(mm.all('foo.js', ['foo.js']));
34794  * // true
34795  *
34796  * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
34797  * // false
34798  *
34799  * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
34800  * // true
34801  *
34802  * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
34803  * // true
34804  * ```
34805  * @param {String|Array} `str` The string to test.
34806  * @param {String|Array} `patterns` One or more glob patterns to use for matching.
34807  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34808  * @return {Boolean} Returns true if any patterns match `str`
34809  * @api public
34810  */
34811
34812
34813 micromatch$1.all = (str, patterns, options) => {
34814   if (typeof str !== 'string') {
34815     throw new TypeError(`Expected a string: "${util$1.inspect(str)}"`);
34816   }
34817
34818   return [].concat(patterns).every(p => picomatch(p, options)(str));
34819 };
34820 /**
34821  * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
34822  *
34823  * ```js
34824  * const mm = require('micromatch');
34825  * // mm.capture(pattern, string[, options]);
34826  *
34827  * console.log(mm.capture('test/*.js', 'test/foo.js'));
34828  * //=> ['foo']
34829  * console.log(mm.capture('test/*.js', 'foo/bar.css'));
34830  * //=> null
34831  * ```
34832  * @param {String} `glob` Glob pattern to use for matching.
34833  * @param {String} `input` String to match
34834  * @param {Object} `options` See available [options](#options) for changing how matches are performed
34835  * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
34836  * @api public
34837  */
34838
34839
34840 micromatch$1.capture = (glob, input, options) => {
34841   let posix = utils$i.isWindows(options);
34842   let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
34843     capture: true
34844   }));
34845   let match = regex.exec(posix ? utils$i.toPosixSlashes(input) : input);
34846
34847   if (match) {
34848     return match.slice(1).map(v => v === void 0 ? '' : v);
34849   }
34850 };
34851 /**
34852  * Create a regular expression from the given glob `pattern`.
34853  *
34854  * ```js
34855  * const mm = require('micromatch');
34856  * // mm.makeRe(pattern[, options]);
34857  *
34858  * console.log(mm.makeRe('*.js'));
34859  * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
34860  * ```
34861  * @param {String} `pattern` A glob pattern to convert to regex.
34862  * @param {Object} `options`
34863  * @return {RegExp} Returns a regex created from the given pattern.
34864  * @api public
34865  */
34866
34867
34868 micromatch$1.makeRe = (...args) => picomatch.makeRe(...args);
34869 /**
34870  * Scan a glob pattern to separate the pattern into segments. Used
34871  * by the [split](#split) method.
34872  *
34873  * ```js
34874  * const mm = require('micromatch');
34875  * const state = mm.scan(pattern[, options]);
34876  * ```
34877  * @param {String} `pattern`
34878  * @param {Object} `options`
34879  * @return {Object} Returns an object with
34880  * @api public
34881  */
34882
34883
34884 micromatch$1.scan = (...args) => picomatch.scan(...args);
34885 /**
34886  * Parse a glob pattern to create the source string for a regular
34887  * expression.
34888  *
34889  * ```js
34890  * const mm = require('micromatch');
34891  * const state = mm(pattern[, options]);
34892  * ```
34893  * @param {String} `glob`
34894  * @param {Object} `options`
34895  * @return {Object} Returns an object with useful properties and output to be used as regex source string.
34896  * @api public
34897  */
34898
34899
34900 micromatch$1.parse = (patterns, options) => {
34901   let res = [];
34902
34903   for (let pattern of [].concat(patterns || [])) {
34904     for (let str of braces(String(pattern), options)) {
34905       res.push(picomatch.parse(str, options));
34906     }
34907   }
34908
34909   return res;
34910 };
34911 /**
34912  * Process the given brace `pattern`.
34913  *
34914  * ```js
34915  * const { braces } = require('micromatch');
34916  * console.log(braces('foo/{a,b,c}/bar'));
34917  * //=> [ 'foo/(a|b|c)/bar' ]
34918  *
34919  * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
34920  * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
34921  * ```
34922  * @param {String} `pattern` String with brace pattern to process.
34923  * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
34924  * @return {Array}
34925  * @api public
34926  */
34927
34928
34929 micromatch$1.braces = (pattern, options) => {
34930   if (typeof pattern !== 'string') throw new TypeError('Expected a string');
34931
34932   if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
34933     return [pattern];
34934   }
34935
34936   return braces(pattern, options);
34937 };
34938 /**
34939  * Expand braces
34940  */
34941
34942
34943 micromatch$1.braceExpand = (pattern, options) => {
34944   if (typeof pattern !== 'string') throw new TypeError('Expected a string');
34945   return micromatch$1.braces(pattern, Object.assign(Object.assign({}, options), {}, {
34946     expand: true
34947   }));
34948 };
34949 /**
34950  * Expose micromatch
34951  */
34952
34953
34954 var micromatch_1 = micromatch$1;
34955
34956 Object.defineProperty(pattern$1, "__esModule", {
34957   value: true
34958 });
34959 pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
34960 const path$8 = require$$0__default$2["default"];
34961 const globParent = globParent$1;
34962 const micromatch = micromatch_1;
34963 const GLOBSTAR = '**';
34964 const ESCAPE_SYMBOL = '\\';
34965 const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
34966 const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/;
34967 const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/;
34968 const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/;
34969 const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/;
34970
34971 function isStaticPattern(pattern, options = {}) {
34972   return !isDynamicPattern(pattern, options);
34973 }
34974
34975 pattern$1.isStaticPattern = isStaticPattern;
34976
34977 function isDynamicPattern(pattern, options = {}) {
34978   /**
34979    * A special case with an empty string is necessary for matching patterns that start with a forward slash.
34980    * An empty string cannot be a dynamic pattern.
34981    * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
34982    */
34983   if (pattern === '') {
34984     return false;
34985   }
34986   /**
34987    * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
34988    * filepath directly (without read directory).
34989    */
34990
34991
34992   if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
34993     return true;
34994   }
34995
34996   if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
34997     return true;
34998   }
34999
35000   if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
35001     return true;
35002   }
35003
35004   if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) {
35005     return true;
35006   }
35007
35008   return false;
35009 }
35010
35011 pattern$1.isDynamicPattern = isDynamicPattern;
35012
35013 function convertToPositivePattern(pattern) {
35014   return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
35015 }
35016
35017 pattern$1.convertToPositivePattern = convertToPositivePattern;
35018
35019 function convertToNegativePattern(pattern) {
35020   return '!' + pattern;
35021 }
35022
35023 pattern$1.convertToNegativePattern = convertToNegativePattern;
35024
35025 function isNegativePattern(pattern) {
35026   return pattern.startsWith('!') && pattern[1] !== '(';
35027 }
35028
35029 pattern$1.isNegativePattern = isNegativePattern;
35030
35031 function isPositivePattern(pattern) {
35032   return !isNegativePattern(pattern);
35033 }
35034
35035 pattern$1.isPositivePattern = isPositivePattern;
35036
35037 function getNegativePatterns(patterns) {
35038   return patterns.filter(isNegativePattern);
35039 }
35040
35041 pattern$1.getNegativePatterns = getNegativePatterns;
35042
35043 function getPositivePatterns$1(patterns) {
35044   return patterns.filter(isPositivePattern);
35045 }
35046
35047 pattern$1.getPositivePatterns = getPositivePatterns$1;
35048 /**
35049  * Returns patterns that can be applied inside the current directory.
35050  *
35051  * @example
35052  * // ['./*', '*', 'a/*']
35053  * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
35054  */
35055
35056 function getPatternsInsideCurrentDirectory(patterns) {
35057   return patterns.filter(pattern => !isPatternRelatedToParentDirectory(pattern));
35058 }
35059
35060 pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
35061 /**
35062  * Returns patterns to be expanded relative to (outside) the current directory.
35063  *
35064  * @example
35065  * // ['../*', './../*']
35066  * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
35067  */
35068
35069 function getPatternsOutsideCurrentDirectory(patterns) {
35070   return patterns.filter(isPatternRelatedToParentDirectory);
35071 }
35072
35073 pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
35074
35075 function isPatternRelatedToParentDirectory(pattern) {
35076   return pattern.startsWith('..') || pattern.startsWith('./..');
35077 }
35078
35079 pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
35080
35081 function getBaseDirectory(pattern) {
35082   return globParent(pattern, {
35083     flipBackslashes: false
35084   });
35085 }
35086
35087 pattern$1.getBaseDirectory = getBaseDirectory;
35088
35089 function hasGlobStar(pattern) {
35090   return pattern.includes(GLOBSTAR);
35091 }
35092
35093 pattern$1.hasGlobStar = hasGlobStar;
35094
35095 function endsWithSlashGlobStar(pattern) {
35096   return pattern.endsWith('/' + GLOBSTAR);
35097 }
35098
35099 pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
35100
35101 function isAffectDepthOfReadingPattern(pattern) {
35102   const basename = path$8.basename(pattern);
35103   return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
35104 }
35105
35106 pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
35107
35108 function expandPatternsWithBraceExpansion(patterns) {
35109   return patterns.reduce((collection, pattern) => {
35110     return collection.concat(expandBraceExpansion(pattern));
35111   }, []);
35112 }
35113
35114 pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
35115
35116 function expandBraceExpansion(pattern) {
35117   return micromatch.braces(pattern, {
35118     expand: true,
35119     nodupes: true
35120   });
35121 }
35122
35123 pattern$1.expandBraceExpansion = expandBraceExpansion;
35124
35125 function getPatternParts(pattern, options) {
35126   let {
35127     parts
35128   } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
35129     parts: true
35130   }));
35131   /**
35132    * The scan method returns an empty array in some cases.
35133    * See micromatch/picomatch#58 for more details.
35134    */
35135
35136   if (parts.length === 0) {
35137     parts = [pattern];
35138   }
35139   /**
35140    * The scan method does not return an empty part for the pattern with a forward slash.
35141    * This is another part of micromatch/picomatch#58.
35142    */
35143
35144
35145   if (parts[0].startsWith('/')) {
35146     parts[0] = parts[0].slice(1);
35147     parts.unshift('');
35148   }
35149
35150   return parts;
35151 }
35152
35153 pattern$1.getPatternParts = getPatternParts;
35154
35155 function makeRe(pattern, options) {
35156   return micromatch.makeRe(pattern, options);
35157 }
35158
35159 pattern$1.makeRe = makeRe;
35160
35161 function convertPatternsToRe(patterns, options) {
35162   return patterns.map(pattern => makeRe(pattern, options));
35163 }
35164
35165 pattern$1.convertPatternsToRe = convertPatternsToRe;
35166
35167 function matchAny(entry, patternsRe) {
35168   return patternsRe.some(patternRe => patternRe.test(entry));
35169 }
35170
35171 pattern$1.matchAny = matchAny;
35172
35173 var stream$4 = {};
35174
35175 Object.defineProperty(stream$4, "__esModule", {
35176   value: true
35177 });
35178 stream$4.merge = void 0;
35179 const merge2$1 = merge2_1;
35180
35181 function merge(streams) {
35182   const mergedStream = merge2$1(streams);
35183   streams.forEach(stream => {
35184     stream.once('error', error => mergedStream.emit('error', error));
35185   });
35186   mergedStream.once('close', () => propagateCloseEventToSources(streams));
35187   mergedStream.once('end', () => propagateCloseEventToSources(streams));
35188   return mergedStream;
35189 }
35190
35191 stream$4.merge = merge;
35192
35193 function propagateCloseEventToSources(streams) {
35194   streams.forEach(stream => stream.emit('close'));
35195 }
35196
35197 var string$1 = {};
35198
35199 Object.defineProperty(string$1, "__esModule", {
35200   value: true
35201 });
35202 string$1.isEmpty = string$1.isString = void 0;
35203
35204 function isString$1(input) {
35205   return typeof input === 'string';
35206 }
35207
35208 string$1.isString = isString$1;
35209
35210 function isEmpty(input) {
35211   return input === '';
35212 }
35213
35214 string$1.isEmpty = isEmpty;
35215
35216 Object.defineProperty(utils$r, "__esModule", {
35217   value: true
35218 });
35219 utils$r.string = utils$r.stream = utils$r.pattern = utils$r.path = utils$r.fs = utils$r.errno = utils$r.array = void 0;
35220 const array$1 = array$2;
35221 utils$r.array = array$1;
35222 const errno = errno$1;
35223 utils$r.errno = errno;
35224 const fs$a = fs$b;
35225 utils$r.fs = fs$a;
35226 const path$7 = path$c;
35227 utils$r.path = path$7;
35228 const pattern = pattern$1;
35229 utils$r.pattern = pattern;
35230 const stream$3 = stream$4;
35231 utils$r.stream = stream$3;
35232 const string = string$1;
35233 utils$r.string = string;
35234
35235 Object.defineProperty(tasks, "__esModule", {
35236   value: true
35237 });
35238 tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
35239 const utils$h = utils$r;
35240
35241 function generate(patterns, settings) {
35242   const positivePatterns = getPositivePatterns(patterns);
35243   const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
35244   const staticPatterns = positivePatterns.filter(pattern => utils$h.pattern.isStaticPattern(pattern, settings));
35245   const dynamicPatterns = positivePatterns.filter(pattern => utils$h.pattern.isDynamicPattern(pattern, settings));
35246   const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns,
35247   /* dynamic */
35248   false);
35249   const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns,
35250   /* dynamic */
35251   true);
35252   return staticTasks.concat(dynamicTasks);
35253 }
35254
35255 tasks.generate = generate;
35256 /**
35257  * Returns tasks grouped by basic pattern directories.
35258  *
35259  * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
35260  * This is necessary because directory traversal starts at the base directory and goes deeper.
35261  */
35262
35263 function convertPatternsToTasks(positive, negative, dynamic) {
35264   const tasks = [];
35265   const patternsOutsideCurrentDirectory = utils$h.pattern.getPatternsOutsideCurrentDirectory(positive);
35266   const patternsInsideCurrentDirectory = utils$h.pattern.getPatternsInsideCurrentDirectory(positive);
35267   const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
35268   const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
35269   tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
35270   /*
35271    * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
35272    * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
35273    */
35274
35275   if ('.' in insideCurrentDirectoryGroup) {
35276     tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
35277   } else {
35278     tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
35279   }
35280
35281   return tasks;
35282 }
35283
35284 tasks.convertPatternsToTasks = convertPatternsToTasks;
35285
35286 function getPositivePatterns(patterns) {
35287   return utils$h.pattern.getPositivePatterns(patterns);
35288 }
35289
35290 tasks.getPositivePatterns = getPositivePatterns;
35291
35292 function getNegativePatternsAsPositive(patterns, ignore) {
35293   const negative = utils$h.pattern.getNegativePatterns(patterns).concat(ignore);
35294   const positive = negative.map(utils$h.pattern.convertToPositivePattern);
35295   return positive;
35296 }
35297
35298 tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
35299
35300 function groupPatternsByBaseDirectory(patterns) {
35301   const group = {};
35302   return patterns.reduce((collection, pattern) => {
35303     const base = utils$h.pattern.getBaseDirectory(pattern);
35304
35305     if (base in collection) {
35306       collection[base].push(pattern);
35307     } else {
35308       collection[base] = [pattern];
35309     }
35310
35311     return collection;
35312   }, group);
35313 }
35314
35315 tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
35316
35317 function convertPatternGroupsToTasks(positive, negative, dynamic) {
35318   return Object.keys(positive).map(base => {
35319     return convertPatternGroupToTask(base, positive[base], negative, dynamic);
35320   });
35321 }
35322
35323 tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
35324
35325 function convertPatternGroupToTask(base, positive, negative, dynamic) {
35326   return {
35327     dynamic,
35328     positive,
35329     negative,
35330     base,
35331     patterns: [].concat(positive, negative.map(utils$h.pattern.convertToNegativePattern))
35332   };
35333 }
35334
35335 tasks.convertPatternGroupToTask = convertPatternGroupToTask;
35336
35337 var async$6 = {};
35338
35339 var stream$2 = {};
35340
35341 var out$3 = {};
35342
35343 var async$5 = {};
35344
35345 Object.defineProperty(async$5, "__esModule", {
35346   value: true
35347 });
35348 async$5.read = void 0;
35349
35350 function read$3(path, settings, callback) {
35351   settings.fs.lstat(path, (lstatError, lstat) => {
35352     if (lstatError !== null) {
35353       callFailureCallback$2(callback, lstatError);
35354       return;
35355     }
35356
35357     if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
35358       callSuccessCallback$2(callback, lstat);
35359       return;
35360     }
35361
35362     settings.fs.stat(path, (statError, stat) => {
35363       if (statError !== null) {
35364         if (settings.throwErrorOnBrokenSymbolicLink) {
35365           callFailureCallback$2(callback, statError);
35366           return;
35367         }
35368
35369         callSuccessCallback$2(callback, lstat);
35370         return;
35371       }
35372
35373       if (settings.markSymbolicLink) {
35374         stat.isSymbolicLink = () => true;
35375       }
35376
35377       callSuccessCallback$2(callback, stat);
35378     });
35379   });
35380 }
35381
35382 async$5.read = read$3;
35383
35384 function callFailureCallback$2(callback, error) {
35385   callback(error);
35386 }
35387
35388 function callSuccessCallback$2(callback, result) {
35389   callback(null, result);
35390 }
35391
35392 var sync$7 = {};
35393
35394 Object.defineProperty(sync$7, "__esModule", {
35395   value: true
35396 });
35397 sync$7.read = void 0;
35398
35399 function read$2(path, settings) {
35400   const lstat = settings.fs.lstatSync(path);
35401
35402   if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
35403     return lstat;
35404   }
35405
35406   try {
35407     const stat = settings.fs.statSync(path);
35408
35409     if (settings.markSymbolicLink) {
35410       stat.isSymbolicLink = () => true;
35411     }
35412
35413     return stat;
35414   } catch (error) {
35415     if (!settings.throwErrorOnBrokenSymbolicLink) {
35416       return lstat;
35417     }
35418
35419     throw error;
35420   }
35421 }
35422
35423 sync$7.read = read$2;
35424
35425 var settings$3 = {};
35426
35427 var fs$9 = {};
35428
35429 (function (exports) {
35430
35431   Object.defineProperty(exports, "__esModule", {
35432     value: true
35433   });
35434   exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
35435   const fs = require$$0__default["default"];
35436   exports.FILE_SYSTEM_ADAPTER = {
35437     lstat: fs.lstat,
35438     stat: fs.stat,
35439     lstatSync: fs.lstatSync,
35440     statSync: fs.statSync
35441   };
35442
35443   function createFileSystemAdapter(fsMethods) {
35444     if (fsMethods === undefined) {
35445       return exports.FILE_SYSTEM_ADAPTER;
35446     }
35447
35448     return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
35449   }
35450
35451   exports.createFileSystemAdapter = createFileSystemAdapter;
35452 })(fs$9);
35453
35454 Object.defineProperty(settings$3, "__esModule", {
35455   value: true
35456 });
35457 const fs$8 = fs$9;
35458
35459 class Settings$2 {
35460   constructor(_options = {}) {
35461     this._options = _options;
35462     this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
35463     this.fs = fs$8.createFileSystemAdapter(this._options.fs);
35464     this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
35465     this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
35466   }
35467
35468   _getValue(option, value) {
35469     return option !== null && option !== void 0 ? option : value;
35470   }
35471
35472 }
35473
35474 settings$3.default = Settings$2;
35475
35476 Object.defineProperty(out$3, "__esModule", {
35477   value: true
35478 });
35479 out$3.statSync = out$3.stat = out$3.Settings = void 0;
35480 const async$4 = async$5;
35481 const sync$6 = sync$7;
35482 const settings_1$3 = settings$3;
35483 out$3.Settings = settings_1$3.default;
35484
35485 function stat(path, optionsOrSettingsOrCallback, callback) {
35486   if (typeof optionsOrSettingsOrCallback === 'function') {
35487     async$4.read(path, getSettings$2(), optionsOrSettingsOrCallback);
35488     return;
35489   }
35490
35491   async$4.read(path, getSettings$2(optionsOrSettingsOrCallback), callback);
35492 }
35493
35494 out$3.stat = stat;
35495
35496 function statSync(path, optionsOrSettings) {
35497   const settings = getSettings$2(optionsOrSettings);
35498   return sync$6.read(path, settings);
35499 }
35500
35501 out$3.statSync = statSync;
35502
35503 function getSettings$2(settingsOrOptions = {}) {
35504   if (settingsOrOptions instanceof settings_1$3.default) {
35505     return settingsOrOptions;
35506   }
35507
35508   return new settings_1$3.default(settingsOrOptions);
35509 }
35510
35511 var out$2 = {};
35512
35513 var async$3 = {};
35514
35515 var async$2 = {};
35516
35517 var out$1 = {};
35518
35519 var async$1 = {};
35520
35521 /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
35522 let promise;
35523 var queueMicrotask_1 = typeof queueMicrotask === 'function' ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global) // reuse resolved promise, and allocate it lazily
35524 : cb => (promise || (promise = Promise.resolve())).then(cb).catch(err => setTimeout(() => {
35525   throw err;
35526 }, 0));
35527
35528 /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
35529 var runParallel_1 = runParallel;
35530 const queueMicrotask$1 = queueMicrotask_1;
35531
35532 function runParallel(tasks, cb) {
35533   let results, pending, keys;
35534   let isSync = true;
35535
35536   if (Array.isArray(tasks)) {
35537     results = [];
35538     pending = tasks.length;
35539   } else {
35540     keys = Object.keys(tasks);
35541     results = {};
35542     pending = keys.length;
35543   }
35544
35545   function done(err) {
35546     function end() {
35547       if (cb) cb(err, results);
35548       cb = null;
35549     }
35550
35551     if (isSync) queueMicrotask$1(end);else end();
35552   }
35553
35554   function each(i, err, result) {
35555     results[i] = result;
35556
35557     if (--pending === 0 || err) {
35558       done(err);
35559     }
35560   }
35561
35562   if (!pending) {
35563     // empty
35564     done(null);
35565   } else if (keys) {
35566     // object
35567     keys.forEach(function (key) {
35568       tasks[key](function (err, result) {
35569         each(key, err, result);
35570       });
35571     });
35572   } else {
35573     // array
35574     tasks.forEach(function (task, i) {
35575       task(function (err, result) {
35576         each(i, err, result);
35577       });
35578     });
35579   }
35580
35581   isSync = false;
35582 }
35583
35584 var constants = {};
35585
35586 Object.defineProperty(constants, "__esModule", {
35587   value: true
35588 });
35589 constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
35590 const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
35591
35592 if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
35593   throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
35594 }
35595
35596 const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
35597 const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
35598 const SUPPORTED_MAJOR_VERSION = 10;
35599 const SUPPORTED_MINOR_VERSION = 10;
35600 const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
35601 const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
35602 /**
35603  * IS `true` for Node.js 10.10 and greater.
35604  */
35605
35606 constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
35607
35608 var utils$g = {};
35609
35610 var fs$7 = {};
35611
35612 Object.defineProperty(fs$7, "__esModule", {
35613   value: true
35614 });
35615 fs$7.createDirentFromStats = void 0;
35616
35617 class DirentFromStats {
35618   constructor(name, stats) {
35619     this.name = name;
35620     this.isBlockDevice = stats.isBlockDevice.bind(stats);
35621     this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
35622     this.isDirectory = stats.isDirectory.bind(stats);
35623     this.isFIFO = stats.isFIFO.bind(stats);
35624     this.isFile = stats.isFile.bind(stats);
35625     this.isSocket = stats.isSocket.bind(stats);
35626     this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
35627   }
35628
35629 }
35630
35631 function createDirentFromStats(name, stats) {
35632   return new DirentFromStats(name, stats);
35633 }
35634
35635 fs$7.createDirentFromStats = createDirentFromStats;
35636
35637 Object.defineProperty(utils$g, "__esModule", {
35638   value: true
35639 });
35640 utils$g.fs = void 0;
35641 const fs$6 = fs$7;
35642 utils$g.fs = fs$6;
35643
35644 var common$6 = {};
35645
35646 Object.defineProperty(common$6, "__esModule", {
35647   value: true
35648 });
35649 common$6.joinPathSegments = void 0;
35650
35651 function joinPathSegments$1(a, b, separator) {
35652   /**
35653    * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
35654    */
35655   if (a.endsWith(separator)) {
35656     return a + b;
35657   }
35658
35659   return a + separator + b;
35660 }
35661
35662 common$6.joinPathSegments = joinPathSegments$1;
35663
35664 Object.defineProperty(async$1, "__esModule", {
35665   value: true
35666 });
35667 async$1.readdir = async$1.readdirWithFileTypes = async$1.read = void 0;
35668 const fsStat$5 = out$3;
35669 const rpl = runParallel_1;
35670 const constants_1$1 = constants;
35671 const utils$f = utils$g;
35672 const common$5 = common$6;
35673
35674 function read$1(directory, settings, callback) {
35675   if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
35676     readdirWithFileTypes$1(directory, settings, callback);
35677     return;
35678   }
35679
35680   readdir$1(directory, settings, callback);
35681 }
35682
35683 async$1.read = read$1;
35684
35685 function readdirWithFileTypes$1(directory, settings, callback) {
35686   settings.fs.readdir(directory, {
35687     withFileTypes: true
35688   }, (readdirError, dirents) => {
35689     if (readdirError !== null) {
35690       callFailureCallback$1(callback, readdirError);
35691       return;
35692     }
35693
35694     const entries = dirents.map(dirent => ({
35695       dirent,
35696       name: dirent.name,
35697       path: common$5.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
35698     }));
35699
35700     if (!settings.followSymbolicLinks) {
35701       callSuccessCallback$1(callback, entries);
35702       return;
35703     }
35704
35705     const tasks = entries.map(entry => makeRplTaskEntry(entry, settings));
35706     rpl(tasks, (rplError, rplEntries) => {
35707       if (rplError !== null) {
35708         callFailureCallback$1(callback, rplError);
35709         return;
35710       }
35711
35712       callSuccessCallback$1(callback, rplEntries);
35713     });
35714   });
35715 }
35716
35717 async$1.readdirWithFileTypes = readdirWithFileTypes$1;
35718
35719 function makeRplTaskEntry(entry, settings) {
35720   return done => {
35721     if (!entry.dirent.isSymbolicLink()) {
35722       done(null, entry);
35723       return;
35724     }
35725
35726     settings.fs.stat(entry.path, (statError, stats) => {
35727       if (statError !== null) {
35728         if (settings.throwErrorOnBrokenSymbolicLink) {
35729           done(statError);
35730           return;
35731         }
35732
35733         done(null, entry);
35734         return;
35735       }
35736
35737       entry.dirent = utils$f.fs.createDirentFromStats(entry.name, stats);
35738       done(null, entry);
35739     });
35740   };
35741 }
35742
35743 function readdir$1(directory, settings, callback) {
35744   settings.fs.readdir(directory, (readdirError, names) => {
35745     if (readdirError !== null) {
35746       callFailureCallback$1(callback, readdirError);
35747       return;
35748     }
35749
35750     const tasks = names.map(name => {
35751       const path = common$5.joinPathSegments(directory, name, settings.pathSegmentSeparator);
35752       return done => {
35753         fsStat$5.stat(path, settings.fsStatSettings, (error, stats) => {
35754           if (error !== null) {
35755             done(error);
35756             return;
35757           }
35758
35759           const entry = {
35760             name,
35761             path,
35762             dirent: utils$f.fs.createDirentFromStats(name, stats)
35763           };
35764
35765           if (settings.stats) {
35766             entry.stats = stats;
35767           }
35768
35769           done(null, entry);
35770         });
35771       };
35772     });
35773     rpl(tasks, (rplError, entries) => {
35774       if (rplError !== null) {
35775         callFailureCallback$1(callback, rplError);
35776         return;
35777       }
35778
35779       callSuccessCallback$1(callback, entries);
35780     });
35781   });
35782 }
35783
35784 async$1.readdir = readdir$1;
35785
35786 function callFailureCallback$1(callback, error) {
35787   callback(error);
35788 }
35789
35790 function callSuccessCallback$1(callback, result) {
35791   callback(null, result);
35792 }
35793
35794 var sync$5 = {};
35795
35796 Object.defineProperty(sync$5, "__esModule", {
35797   value: true
35798 });
35799 sync$5.readdir = sync$5.readdirWithFileTypes = sync$5.read = void 0;
35800 const fsStat$4 = out$3;
35801 const constants_1 = constants;
35802 const utils$e = utils$g;
35803 const common$4 = common$6;
35804
35805 function read(directory, settings) {
35806   if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
35807     return readdirWithFileTypes(directory, settings);
35808   }
35809
35810   return readdir(directory, settings);
35811 }
35812
35813 sync$5.read = read;
35814
35815 function readdirWithFileTypes(directory, settings) {
35816   const dirents = settings.fs.readdirSync(directory, {
35817     withFileTypes: true
35818   });
35819   return dirents.map(dirent => {
35820     const entry = {
35821       dirent,
35822       name: dirent.name,
35823       path: common$4.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
35824     };
35825
35826     if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
35827       try {
35828         const stats = settings.fs.statSync(entry.path);
35829         entry.dirent = utils$e.fs.createDirentFromStats(entry.name, stats);
35830       } catch (error) {
35831         if (settings.throwErrorOnBrokenSymbolicLink) {
35832           throw error;
35833         }
35834       }
35835     }
35836
35837     return entry;
35838   });
35839 }
35840
35841 sync$5.readdirWithFileTypes = readdirWithFileTypes;
35842
35843 function readdir(directory, settings) {
35844   const names = settings.fs.readdirSync(directory);
35845   return names.map(name => {
35846     const entryPath = common$4.joinPathSegments(directory, name, settings.pathSegmentSeparator);
35847     const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
35848     const entry = {
35849       name,
35850       path: entryPath,
35851       dirent: utils$e.fs.createDirentFromStats(name, stats)
35852     };
35853
35854     if (settings.stats) {
35855       entry.stats = stats;
35856     }
35857
35858     return entry;
35859   });
35860 }
35861
35862 sync$5.readdir = readdir;
35863
35864 var settings$2 = {};
35865
35866 var fs$5 = {};
35867
35868 (function (exports) {
35869
35870   Object.defineProperty(exports, "__esModule", {
35871     value: true
35872   });
35873   exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
35874   const fs = require$$0__default["default"];
35875   exports.FILE_SYSTEM_ADAPTER = {
35876     lstat: fs.lstat,
35877     stat: fs.stat,
35878     lstatSync: fs.lstatSync,
35879     statSync: fs.statSync,
35880     readdir: fs.readdir,
35881     readdirSync: fs.readdirSync
35882   };
35883
35884   function createFileSystemAdapter(fsMethods) {
35885     if (fsMethods === undefined) {
35886       return exports.FILE_SYSTEM_ADAPTER;
35887     }
35888
35889     return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
35890   }
35891
35892   exports.createFileSystemAdapter = createFileSystemAdapter;
35893 })(fs$5);
35894
35895 Object.defineProperty(settings$2, "__esModule", {
35896   value: true
35897 });
35898 const path$6 = require$$0__default$2["default"];
35899 const fsStat$3 = out$3;
35900 const fs$4 = fs$5;
35901
35902 class Settings$1 {
35903   constructor(_options = {}) {
35904     this._options = _options;
35905     this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
35906     this.fs = fs$4.createFileSystemAdapter(this._options.fs);
35907     this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$6.sep);
35908     this.stats = this._getValue(this._options.stats, false);
35909     this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
35910     this.fsStatSettings = new fsStat$3.Settings({
35911       followSymbolicLink: this.followSymbolicLinks,
35912       fs: this.fs,
35913       throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
35914     });
35915   }
35916
35917   _getValue(option, value) {
35918     return option !== null && option !== void 0 ? option : value;
35919   }
35920
35921 }
35922
35923 settings$2.default = Settings$1;
35924
35925 Object.defineProperty(out$1, "__esModule", {
35926   value: true
35927 });
35928 out$1.Settings = out$1.scandirSync = out$1.scandir = void 0;
35929 const async = async$1;
35930 const sync$4 = sync$5;
35931 const settings_1$2 = settings$2;
35932 out$1.Settings = settings_1$2.default;
35933
35934 function scandir(path, optionsOrSettingsOrCallback, callback) {
35935   if (typeof optionsOrSettingsOrCallback === 'function') {
35936     async.read(path, getSettings$1(), optionsOrSettingsOrCallback);
35937     return;
35938   }
35939
35940   async.read(path, getSettings$1(optionsOrSettingsOrCallback), callback);
35941 }
35942
35943 out$1.scandir = scandir;
35944
35945 function scandirSync(path, optionsOrSettings) {
35946   const settings = getSettings$1(optionsOrSettings);
35947   return sync$4.read(path, settings);
35948 }
35949
35950 out$1.scandirSync = scandirSync;
35951
35952 function getSettings$1(settingsOrOptions = {}) {
35953   if (settingsOrOptions instanceof settings_1$2.default) {
35954     return settingsOrOptions;
35955   }
35956
35957   return new settings_1$2.default(settingsOrOptions);
35958 }
35959
35960 var queue = {exports: {}};
35961
35962 function reusify$1(Constructor) {
35963   var head = new Constructor();
35964   var tail = head;
35965
35966   function get() {
35967     var current = head;
35968
35969     if (current.next) {
35970       head = current.next;
35971     } else {
35972       head = new Constructor();
35973       tail = head;
35974     }
35975
35976     current.next = null;
35977     return current;
35978   }
35979
35980   function release(obj) {
35981     tail.next = obj;
35982     tail = obj;
35983   }
35984
35985   return {
35986     get: get,
35987     release: release
35988   };
35989 }
35990
35991 var reusify_1 = reusify$1;
35992
35993 /* eslint-disable no-var */
35994
35995
35996 var reusify = reusify_1;
35997
35998 function fastqueue(context, worker, concurrency) {
35999   if (typeof context === 'function') {
36000     concurrency = worker;
36001     worker = context;
36002     context = null;
36003   }
36004
36005   if (concurrency < 1) {
36006     throw new Error('fastqueue concurrency must be greater than 1');
36007   }
36008
36009   var cache = reusify(Task);
36010   var queueHead = null;
36011   var queueTail = null;
36012   var _running = 0;
36013   var errorHandler = null;
36014   var self = {
36015     push: push,
36016     drain: noop,
36017     saturated: noop,
36018     pause: pause,
36019     paused: false,
36020     concurrency: concurrency,
36021     running: running,
36022     resume: resume,
36023     idle: idle,
36024     length: length,
36025     getQueue: getQueue,
36026     unshift: unshift,
36027     empty: noop,
36028     kill: kill,
36029     killAndDrain: killAndDrain,
36030     error: error
36031   };
36032   return self;
36033
36034   function running() {
36035     return _running;
36036   }
36037
36038   function pause() {
36039     self.paused = true;
36040   }
36041
36042   function length() {
36043     var current = queueHead;
36044     var counter = 0;
36045
36046     while (current) {
36047       current = current.next;
36048       counter++;
36049     }
36050
36051     return counter;
36052   }
36053
36054   function getQueue() {
36055     var current = queueHead;
36056     var tasks = [];
36057
36058     while (current) {
36059       tasks.push(current.value);
36060       current = current.next;
36061     }
36062
36063     return tasks;
36064   }
36065
36066   function resume() {
36067     if (!self.paused) return;
36068     self.paused = false;
36069
36070     for (var i = 0; i < self.concurrency; i++) {
36071       _running++;
36072       release();
36073     }
36074   }
36075
36076   function idle() {
36077     return _running === 0 && self.length() === 0;
36078   }
36079
36080   function push(value, done) {
36081     var current = cache.get();
36082     current.context = context;
36083     current.release = release;
36084     current.value = value;
36085     current.callback = done || noop;
36086     current.errorHandler = errorHandler;
36087
36088     if (_running === self.concurrency || self.paused) {
36089       if (queueTail) {
36090         queueTail.next = current;
36091         queueTail = current;
36092       } else {
36093         queueHead = current;
36094         queueTail = current;
36095         self.saturated();
36096       }
36097     } else {
36098       _running++;
36099       worker.call(context, current.value, current.worked);
36100     }
36101   }
36102
36103   function unshift(value, done) {
36104     var current = cache.get();
36105     current.context = context;
36106     current.release = release;
36107     current.value = value;
36108     current.callback = done || noop;
36109
36110     if (_running === self.concurrency || self.paused) {
36111       if (queueHead) {
36112         current.next = queueHead;
36113         queueHead = current;
36114       } else {
36115         queueHead = current;
36116         queueTail = current;
36117         self.saturated();
36118       }
36119     } else {
36120       _running++;
36121       worker.call(context, current.value, current.worked);
36122     }
36123   }
36124
36125   function release(holder) {
36126     if (holder) {
36127       cache.release(holder);
36128     }
36129
36130     var next = queueHead;
36131
36132     if (next) {
36133       if (!self.paused) {
36134         if (queueTail === queueHead) {
36135           queueTail = null;
36136         }
36137
36138         queueHead = next.next;
36139         next.next = null;
36140         worker.call(context, next.value, next.worked);
36141
36142         if (queueTail === null) {
36143           self.empty();
36144         }
36145       } else {
36146         _running--;
36147       }
36148     } else if (--_running === 0) {
36149       self.drain();
36150     }
36151   }
36152
36153   function kill() {
36154     queueHead = null;
36155     queueTail = null;
36156     self.drain = noop;
36157   }
36158
36159   function killAndDrain() {
36160     queueHead = null;
36161     queueTail = null;
36162     self.drain();
36163     self.drain = noop;
36164   }
36165
36166   function error(handler) {
36167     errorHandler = handler;
36168   }
36169 }
36170
36171 function noop() {}
36172
36173 function Task() {
36174   this.value = null;
36175   this.callback = noop;
36176   this.next = null;
36177   this.release = noop;
36178   this.context = null;
36179   this.errorHandler = null;
36180   var self = this;
36181
36182   this.worked = function worked(err, result) {
36183     var callback = self.callback;
36184     var errorHandler = self.errorHandler;
36185     var val = self.value;
36186     self.value = null;
36187     self.callback = noop;
36188
36189     if (self.errorHandler) {
36190       errorHandler(err, val);
36191     }
36192
36193     callback.call(self.context, err, result);
36194     self.release(self);
36195   };
36196 }
36197
36198 function queueAsPromised(context, worker, concurrency) {
36199   if (typeof context === 'function') {
36200     concurrency = worker;
36201     worker = context;
36202     context = null;
36203   }
36204
36205   function asyncWrapper(arg, cb) {
36206     worker.call(this, arg).then(function (res) {
36207       cb(null, res);
36208     }, cb);
36209   }
36210
36211   var queue = fastqueue(context, asyncWrapper, concurrency);
36212   var pushCb = queue.push;
36213   var unshiftCb = queue.unshift;
36214   queue.push = push;
36215   queue.unshift = unshift;
36216   queue.drained = drained;
36217   return queue;
36218
36219   function push(value) {
36220     var p = new Promise(function (resolve, reject) {
36221       pushCb(value, function (err, result) {
36222         if (err) {
36223           reject(err);
36224           return;
36225         }
36226
36227         resolve(result);
36228       });
36229     }); // Let's fork the promise chain to
36230     // make the error bubble up to the user but
36231     // not lead to a unhandledRejection
36232
36233     p.catch(noop);
36234     return p;
36235   }
36236
36237   function unshift(value) {
36238     var p = new Promise(function (resolve, reject) {
36239       unshiftCb(value, function (err, result) {
36240         if (err) {
36241           reject(err);
36242           return;
36243         }
36244
36245         resolve(result);
36246       });
36247     }); // Let's fork the promise chain to
36248     // make the error bubble up to the user but
36249     // not lead to a unhandledRejection
36250
36251     p.catch(noop);
36252     return p;
36253   }
36254
36255   function drained() {
36256     var previousDrain = queue.drain;
36257     var p = new Promise(function (resolve) {
36258       queue.drain = function () {
36259         previousDrain();
36260         resolve();
36261       };
36262     });
36263     return p;
36264   }
36265 }
36266
36267 queue.exports = fastqueue;
36268 queue.exports.promise = queueAsPromised;
36269
36270 var common$3 = {};
36271
36272 Object.defineProperty(common$3, "__esModule", {
36273   value: true
36274 });
36275 common$3.joinPathSegments = common$3.replacePathSegmentSeparator = common$3.isAppliedFilter = common$3.isFatalError = void 0;
36276
36277 function isFatalError(settings, error) {
36278   if (settings.errorFilter === null) {
36279     return true;
36280   }
36281
36282   return !settings.errorFilter(error);
36283 }
36284
36285 common$3.isFatalError = isFatalError;
36286
36287 function isAppliedFilter(filter, value) {
36288   return filter === null || filter(value);
36289 }
36290
36291 common$3.isAppliedFilter = isAppliedFilter;
36292
36293 function replacePathSegmentSeparator(filepath, separator) {
36294   return filepath.split(/[/\\]/).join(separator);
36295 }
36296
36297 common$3.replacePathSegmentSeparator = replacePathSegmentSeparator;
36298
36299 function joinPathSegments(a, b, separator) {
36300   if (a === '') {
36301     return b;
36302   }
36303   /**
36304    * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
36305    */
36306
36307
36308   if (a.endsWith(separator)) {
36309     return a + b;
36310   }
36311
36312   return a + separator + b;
36313 }
36314
36315 common$3.joinPathSegments = joinPathSegments;
36316
36317 var reader$1 = {};
36318
36319 Object.defineProperty(reader$1, "__esModule", {
36320   value: true
36321 });
36322 const common$2 = common$3;
36323
36324 class Reader$1 {
36325   constructor(_root, _settings) {
36326     this._root = _root;
36327     this._settings = _settings;
36328     this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
36329   }
36330
36331 }
36332
36333 reader$1.default = Reader$1;
36334
36335 Object.defineProperty(async$2, "__esModule", {
36336   value: true
36337 });
36338 const events_1 = require$$0__default$6["default"];
36339 const fsScandir$2 = out$1;
36340 const fastq = queue.exports;
36341 const common$1 = common$3;
36342 const reader_1$3 = reader$1;
36343
36344 class AsyncReader extends reader_1$3.default {
36345   constructor(_root, _settings) {
36346     super(_root, _settings);
36347     this._settings = _settings;
36348     this._scandir = fsScandir$2.scandir;
36349     this._emitter = new events_1.EventEmitter();
36350     this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
36351     this._isFatalError = false;
36352     this._isDestroyed = false;
36353
36354     this._queue.drain = () => {
36355       if (!this._isFatalError) {
36356         this._emitter.emit('end');
36357       }
36358     };
36359   }
36360
36361   read() {
36362     this._isFatalError = false;
36363     this._isDestroyed = false;
36364     setImmediate(() => {
36365       this._pushToQueue(this._root, this._settings.basePath);
36366     });
36367     return this._emitter;
36368   }
36369
36370   get isDestroyed() {
36371     return this._isDestroyed;
36372   }
36373
36374   destroy() {
36375     if (this._isDestroyed) {
36376       throw new Error('The reader is already destroyed');
36377     }
36378
36379     this._isDestroyed = true;
36380
36381     this._queue.killAndDrain();
36382   }
36383
36384   onEntry(callback) {
36385     this._emitter.on('entry', callback);
36386   }
36387
36388   onError(callback) {
36389     this._emitter.once('error', callback);
36390   }
36391
36392   onEnd(callback) {
36393     this._emitter.once('end', callback);
36394   }
36395
36396   _pushToQueue(directory, base) {
36397     const queueItem = {
36398       directory,
36399       base
36400     };
36401
36402     this._queue.push(queueItem, error => {
36403       if (error !== null) {
36404         this._handleError(error);
36405       }
36406     });
36407   }
36408
36409   _worker(item, done) {
36410     this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
36411       if (error !== null) {
36412         done(error, undefined);
36413         return;
36414       }
36415
36416       for (const entry of entries) {
36417         this._handleEntry(entry, item.base);
36418       }
36419
36420       done(null, undefined);
36421     });
36422   }
36423
36424   _handleError(error) {
36425     if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) {
36426       return;
36427     }
36428
36429     this._isFatalError = true;
36430     this._isDestroyed = true;
36431
36432     this._emitter.emit('error', error);
36433   }
36434
36435   _handleEntry(entry, base) {
36436     if (this._isDestroyed || this._isFatalError) {
36437       return;
36438     }
36439
36440     const fullpath = entry.path;
36441
36442     if (base !== undefined) {
36443       entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
36444     }
36445
36446     if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) {
36447       this._emitEntry(entry);
36448     }
36449
36450     if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) {
36451       this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
36452     }
36453   }
36454
36455   _emitEntry(entry) {
36456     this._emitter.emit('entry', entry);
36457   }
36458
36459 }
36460
36461 async$2.default = AsyncReader;
36462
36463 Object.defineProperty(async$3, "__esModule", {
36464   value: true
36465 });
36466 const async_1$3 = async$2;
36467
36468 class AsyncProvider {
36469   constructor(_root, _settings) {
36470     this._root = _root;
36471     this._settings = _settings;
36472     this._reader = new async_1$3.default(this._root, this._settings);
36473     this._storage = [];
36474   }
36475
36476   read(callback) {
36477     this._reader.onError(error => {
36478       callFailureCallback(callback, error);
36479     });
36480
36481     this._reader.onEntry(entry => {
36482       this._storage.push(entry);
36483     });
36484
36485     this._reader.onEnd(() => {
36486       callSuccessCallback(callback, this._storage);
36487     });
36488
36489     this._reader.read();
36490   }
36491
36492 }
36493
36494 async$3.default = AsyncProvider;
36495
36496 function callFailureCallback(callback, error) {
36497   callback(error);
36498 }
36499
36500 function callSuccessCallback(callback, entries) {
36501   callback(null, entries);
36502 }
36503
36504 var stream$1 = {};
36505
36506 Object.defineProperty(stream$1, "__esModule", {
36507   value: true
36508 });
36509 const stream_1$5 = require$$0__default$5["default"];
36510 const async_1$2 = async$2;
36511
36512 class StreamProvider {
36513   constructor(_root, _settings) {
36514     this._root = _root;
36515     this._settings = _settings;
36516     this._reader = new async_1$2.default(this._root, this._settings);
36517     this._stream = new stream_1$5.Readable({
36518       objectMode: true,
36519       read: () => {},
36520       destroy: () => {
36521         if (!this._reader.isDestroyed) {
36522           this._reader.destroy();
36523         }
36524       }
36525     });
36526   }
36527
36528   read() {
36529     this._reader.onError(error => {
36530       this._stream.emit('error', error);
36531     });
36532
36533     this._reader.onEntry(entry => {
36534       this._stream.push(entry);
36535     });
36536
36537     this._reader.onEnd(() => {
36538       this._stream.push(null);
36539     });
36540
36541     this._reader.read();
36542
36543     return this._stream;
36544   }
36545
36546 }
36547
36548 stream$1.default = StreamProvider;
36549
36550 var sync$3 = {};
36551
36552 var sync$2 = {};
36553
36554 Object.defineProperty(sync$2, "__esModule", {
36555   value: true
36556 });
36557 const fsScandir$1 = out$1;
36558 const common = common$3;
36559 const reader_1$2 = reader$1;
36560
36561 class SyncReader extends reader_1$2.default {
36562   constructor() {
36563     super(...arguments);
36564     this._scandir = fsScandir$1.scandirSync;
36565     this._storage = [];
36566     this._queue = new Set();
36567   }
36568
36569   read() {
36570     this._pushToQueue(this._root, this._settings.basePath);
36571
36572     this._handleQueue();
36573
36574     return this._storage;
36575   }
36576
36577   _pushToQueue(directory, base) {
36578     this._queue.add({
36579       directory,
36580       base
36581     });
36582   }
36583
36584   _handleQueue() {
36585     for (const item of this._queue.values()) {
36586       this._handleDirectory(item.directory, item.base);
36587     }
36588   }
36589
36590   _handleDirectory(directory, base) {
36591     try {
36592       const entries = this._scandir(directory, this._settings.fsScandirSettings);
36593
36594       for (const entry of entries) {
36595         this._handleEntry(entry, base);
36596       }
36597     } catch (error) {
36598       this._handleError(error);
36599     }
36600   }
36601
36602   _handleError(error) {
36603     if (!common.isFatalError(this._settings, error)) {
36604       return;
36605     }
36606
36607     throw error;
36608   }
36609
36610   _handleEntry(entry, base) {
36611     const fullpath = entry.path;
36612
36613     if (base !== undefined) {
36614       entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
36615     }
36616
36617     if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
36618       this._pushToStorage(entry);
36619     }
36620
36621     if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
36622       this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
36623     }
36624   }
36625
36626   _pushToStorage(entry) {
36627     this._storage.push(entry);
36628   }
36629
36630 }
36631
36632 sync$2.default = SyncReader;
36633
36634 Object.defineProperty(sync$3, "__esModule", {
36635   value: true
36636 });
36637 const sync_1$3 = sync$2;
36638
36639 class SyncProvider {
36640   constructor(_root, _settings) {
36641     this._root = _root;
36642     this._settings = _settings;
36643     this._reader = new sync_1$3.default(this._root, this._settings);
36644   }
36645
36646   read() {
36647     return this._reader.read();
36648   }
36649
36650 }
36651
36652 sync$3.default = SyncProvider;
36653
36654 var settings$1 = {};
36655
36656 Object.defineProperty(settings$1, "__esModule", {
36657   value: true
36658 });
36659 const path$5 = require$$0__default$2["default"];
36660 const fsScandir = out$1;
36661
36662 class Settings {
36663   constructor(_options = {}) {
36664     this._options = _options;
36665     this.basePath = this._getValue(this._options.basePath, undefined);
36666     this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
36667     this.deepFilter = this._getValue(this._options.deepFilter, null);
36668     this.entryFilter = this._getValue(this._options.entryFilter, null);
36669     this.errorFilter = this._getValue(this._options.errorFilter, null);
36670     this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$5.sep);
36671     this.fsScandirSettings = new fsScandir.Settings({
36672       followSymbolicLinks: this._options.followSymbolicLinks,
36673       fs: this._options.fs,
36674       pathSegmentSeparator: this._options.pathSegmentSeparator,
36675       stats: this._options.stats,
36676       throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
36677     });
36678   }
36679
36680   _getValue(option, value) {
36681     return option !== null && option !== void 0 ? option : value;
36682   }
36683
36684 }
36685
36686 settings$1.default = Settings;
36687
36688 Object.defineProperty(out$2, "__esModule", {
36689   value: true
36690 });
36691 out$2.Settings = out$2.walkStream = out$2.walkSync = out$2.walk = void 0;
36692 const async_1$1 = async$3;
36693 const stream_1$4 = stream$1;
36694 const sync_1$2 = sync$3;
36695 const settings_1$1 = settings$1;
36696 out$2.Settings = settings_1$1.default;
36697
36698 function walk(directory, optionsOrSettingsOrCallback, callback) {
36699   if (typeof optionsOrSettingsOrCallback === 'function') {
36700     new async_1$1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
36701     return;
36702   }
36703
36704   new async_1$1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
36705 }
36706
36707 out$2.walk = walk;
36708
36709 function walkSync(directory, optionsOrSettings) {
36710   const settings = getSettings(optionsOrSettings);
36711   const provider = new sync_1$2.default(directory, settings);
36712   return provider.read();
36713 }
36714
36715 out$2.walkSync = walkSync;
36716
36717 function walkStream(directory, optionsOrSettings) {
36718   const settings = getSettings(optionsOrSettings);
36719   const provider = new stream_1$4.default(directory, settings);
36720   return provider.read();
36721 }
36722
36723 out$2.walkStream = walkStream;
36724
36725 function getSettings(settingsOrOptions = {}) {
36726   if (settingsOrOptions instanceof settings_1$1.default) {
36727     return settingsOrOptions;
36728   }
36729
36730   return new settings_1$1.default(settingsOrOptions);
36731 }
36732
36733 var reader = {};
36734
36735 Object.defineProperty(reader, "__esModule", {
36736   value: true
36737 });
36738 const path$4 = require$$0__default$2["default"];
36739 const fsStat$2 = out$3;
36740 const utils$d = utils$r;
36741
36742 class Reader {
36743   constructor(_settings) {
36744     this._settings = _settings;
36745     this._fsStatSettings = new fsStat$2.Settings({
36746       followSymbolicLink: this._settings.followSymbolicLinks,
36747       fs: this._settings.fs,
36748       throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
36749     });
36750   }
36751
36752   _getFullEntryPath(filepath) {
36753     return path$4.resolve(this._settings.cwd, filepath);
36754   }
36755
36756   _makeEntry(stats, pattern) {
36757     const entry = {
36758       name: pattern,
36759       path: pattern,
36760       dirent: utils$d.fs.createDirentFromStats(pattern, stats)
36761     };
36762
36763     if (this._settings.stats) {
36764       entry.stats = stats;
36765     }
36766
36767     return entry;
36768   }
36769
36770   _isFatalError(error) {
36771     return !utils$d.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
36772   }
36773
36774 }
36775
36776 reader.default = Reader;
36777
36778 Object.defineProperty(stream$2, "__esModule", {
36779   value: true
36780 });
36781 const stream_1$3 = require$$0__default$5["default"];
36782 const fsStat$1 = out$3;
36783 const fsWalk$1 = out$2;
36784 const reader_1$1 = reader;
36785
36786 class ReaderStream extends reader_1$1.default {
36787   constructor() {
36788     super(...arguments);
36789     this._walkStream = fsWalk$1.walkStream;
36790     this._stat = fsStat$1.stat;
36791   }
36792
36793   dynamic(root, options) {
36794     return this._walkStream(root, options);
36795   }
36796
36797   static(patterns, options) {
36798     const filepaths = patterns.map(this._getFullEntryPath, this);
36799     const stream = new stream_1$3.PassThrough({
36800       objectMode: true
36801     });
36802
36803     stream._write = (index, _enc, done) => {
36804       return this._getEntry(filepaths[index], patterns[index], options).then(entry => {
36805         if (entry !== null && options.entryFilter(entry)) {
36806           stream.push(entry);
36807         }
36808
36809         if (index === filepaths.length - 1) {
36810           stream.end();
36811         }
36812
36813         done();
36814       }).catch(done);
36815     };
36816
36817     for (let i = 0; i < filepaths.length; i++) {
36818       stream.write(i);
36819     }
36820
36821     return stream;
36822   }
36823
36824   _getEntry(filepath, pattern, options) {
36825     return this._getStat(filepath).then(stats => this._makeEntry(stats, pattern)).catch(error => {
36826       if (options.errorFilter(error)) {
36827         return null;
36828       }
36829
36830       throw error;
36831     });
36832   }
36833
36834   _getStat(filepath) {
36835     return new Promise((resolve, reject) => {
36836       this._stat(filepath, this._fsStatSettings, (error, stats) => {
36837         return error === null ? resolve(stats) : reject(error);
36838       });
36839     });
36840   }
36841
36842 }
36843
36844 stream$2.default = ReaderStream;
36845
36846 var provider = {};
36847
36848 var deep = {};
36849
36850 var partial = {};
36851
36852 var matcher = {};
36853
36854 Object.defineProperty(matcher, "__esModule", {
36855   value: true
36856 });
36857 const utils$c = utils$r;
36858
36859 class Matcher {
36860   constructor(_patterns, _settings, _micromatchOptions) {
36861     this._patterns = _patterns;
36862     this._settings = _settings;
36863     this._micromatchOptions = _micromatchOptions;
36864     this._storage = [];
36865
36866     this._fillStorage();
36867   }
36868
36869   _fillStorage() {
36870     /**
36871      * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level).
36872      * So, before expand patterns with brace expansion into separated patterns.
36873      */
36874     const patterns = utils$c.pattern.expandPatternsWithBraceExpansion(this._patterns);
36875
36876     for (const pattern of patterns) {
36877       const segments = this._getPatternSegments(pattern);
36878
36879       const sections = this._splitSegmentsIntoSections(segments);
36880
36881       this._storage.push({
36882         complete: sections.length <= 1,
36883         pattern,
36884         segments,
36885         sections
36886       });
36887     }
36888   }
36889
36890   _getPatternSegments(pattern) {
36891     const parts = utils$c.pattern.getPatternParts(pattern, this._micromatchOptions);
36892     return parts.map(part => {
36893       const dynamic = utils$c.pattern.isDynamicPattern(part, this._settings);
36894
36895       if (!dynamic) {
36896         return {
36897           dynamic: false,
36898           pattern: part
36899         };
36900       }
36901
36902       return {
36903         dynamic: true,
36904         pattern: part,
36905         patternRe: utils$c.pattern.makeRe(part, this._micromatchOptions)
36906       };
36907     });
36908   }
36909
36910   _splitSegmentsIntoSections(segments) {
36911     return utils$c.array.splitWhen(segments, segment => segment.dynamic && utils$c.pattern.hasGlobStar(segment.pattern));
36912   }
36913
36914 }
36915
36916 matcher.default = Matcher;
36917
36918 Object.defineProperty(partial, "__esModule", {
36919   value: true
36920 });
36921 const matcher_1 = matcher;
36922
36923 class PartialMatcher extends matcher_1.default {
36924   match(filepath) {
36925     const parts = filepath.split('/');
36926     const levels = parts.length;
36927
36928     const patterns = this._storage.filter(info => !info.complete || info.segments.length > levels);
36929
36930     for (const pattern of patterns) {
36931       const section = pattern.sections[0];
36932       /**
36933        * In this case, the pattern has a globstar and we must read all directories unconditionally,
36934        * but only if the level has reached the end of the first group.
36935        *
36936        * fixtures/{a,b}/**
36937        *  ^ true/false  ^ always true
36938       */
36939
36940       if (!pattern.complete && levels > section.length) {
36941         return true;
36942       }
36943
36944       const match = parts.every((part, index) => {
36945         const segment = pattern.segments[index];
36946
36947         if (segment.dynamic && segment.patternRe.test(part)) {
36948           return true;
36949         }
36950
36951         if (!segment.dynamic && segment.pattern === part) {
36952           return true;
36953         }
36954
36955         return false;
36956       });
36957
36958       if (match) {
36959         return true;
36960       }
36961     }
36962
36963     return false;
36964   }
36965
36966 }
36967
36968 partial.default = PartialMatcher;
36969
36970 Object.defineProperty(deep, "__esModule", {
36971   value: true
36972 });
36973 const utils$b = utils$r;
36974 const partial_1 = partial;
36975
36976 class DeepFilter {
36977   constructor(_settings, _micromatchOptions) {
36978     this._settings = _settings;
36979     this._micromatchOptions = _micromatchOptions;
36980   }
36981
36982   getFilter(basePath, positive, negative) {
36983     const matcher = this._getMatcher(positive);
36984
36985     const negativeRe = this._getNegativePatternsRe(negative);
36986
36987     return entry => this._filter(basePath, entry, matcher, negativeRe);
36988   }
36989
36990   _getMatcher(patterns) {
36991     return new partial_1.default(patterns, this._settings, this._micromatchOptions);
36992   }
36993
36994   _getNegativePatternsRe(patterns) {
36995     const affectDepthOfReadingPatterns = patterns.filter(utils$b.pattern.isAffectDepthOfReadingPattern);
36996     return utils$b.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
36997   }
36998
36999   _filter(basePath, entry, matcher, negativeRe) {
37000     if (this._isSkippedByDeep(basePath, entry.path)) {
37001       return false;
37002     }
37003
37004     if (this._isSkippedSymbolicLink(entry)) {
37005       return false;
37006     }
37007
37008     const filepath = utils$b.path.removeLeadingDotSegment(entry.path);
37009
37010     if (this._isSkippedByPositivePatterns(filepath, matcher)) {
37011       return false;
37012     }
37013
37014     return this._isSkippedByNegativePatterns(filepath, negativeRe);
37015   }
37016
37017   _isSkippedByDeep(basePath, entryPath) {
37018     /**
37019      * Avoid unnecessary depth calculations when it doesn't matter.
37020      */
37021     if (this._settings.deep === Infinity) {
37022       return false;
37023     }
37024
37025     return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
37026   }
37027
37028   _getEntryLevel(basePath, entryPath) {
37029     const entryPathDepth = entryPath.split('/').length;
37030
37031     if (basePath === '') {
37032       return entryPathDepth;
37033     }
37034
37035     const basePathDepth = basePath.split('/').length;
37036     return entryPathDepth - basePathDepth;
37037   }
37038
37039   _isSkippedSymbolicLink(entry) {
37040     return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
37041   }
37042
37043   _isSkippedByPositivePatterns(entryPath, matcher) {
37044     return !this._settings.baseNameMatch && !matcher.match(entryPath);
37045   }
37046
37047   _isSkippedByNegativePatterns(entryPath, patternsRe) {
37048     return !utils$b.pattern.matchAny(entryPath, patternsRe);
37049   }
37050
37051 }
37052
37053 deep.default = DeepFilter;
37054
37055 var entry$1 = {};
37056
37057 Object.defineProperty(entry$1, "__esModule", {
37058   value: true
37059 });
37060 const utils$a = utils$r;
37061
37062 class EntryFilter {
37063   constructor(_settings, _micromatchOptions) {
37064     this._settings = _settings;
37065     this._micromatchOptions = _micromatchOptions;
37066     this.index = new Map();
37067   }
37068
37069   getFilter(positive, negative) {
37070     const positiveRe = utils$a.pattern.convertPatternsToRe(positive, this._micromatchOptions);
37071     const negativeRe = utils$a.pattern.convertPatternsToRe(negative, this._micromatchOptions);
37072     return entry => this._filter(entry, positiveRe, negativeRe);
37073   }
37074
37075   _filter(entry, positiveRe, negativeRe) {
37076     if (this._settings.unique && this._isDuplicateEntry(entry)) {
37077       return false;
37078     }
37079
37080     if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
37081       return false;
37082     }
37083
37084     if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
37085       return false;
37086     }
37087
37088     const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
37089     const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
37090
37091     if (this._settings.unique && isMatched) {
37092       this._createIndexRecord(entry);
37093     }
37094
37095     return isMatched;
37096   }
37097
37098   _isDuplicateEntry(entry) {
37099     return this.index.has(entry.path);
37100   }
37101
37102   _createIndexRecord(entry) {
37103     this.index.set(entry.path, undefined);
37104   }
37105
37106   _onlyFileFilter(entry) {
37107     return this._settings.onlyFiles && !entry.dirent.isFile();
37108   }
37109
37110   _onlyDirectoryFilter(entry) {
37111     return this._settings.onlyDirectories && !entry.dirent.isDirectory();
37112   }
37113
37114   _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
37115     if (!this._settings.absolute) {
37116       return false;
37117     }
37118
37119     const fullpath = utils$a.path.makeAbsolute(this._settings.cwd, entryPath);
37120     return utils$a.pattern.matchAny(fullpath, patternsRe);
37121   }
37122
37123   _isMatchToPatterns(entryPath, patternsRe) {
37124     const filepath = utils$a.path.removeLeadingDotSegment(entryPath);
37125     return utils$a.pattern.matchAny(filepath, patternsRe);
37126   }
37127
37128 }
37129
37130 entry$1.default = EntryFilter;
37131
37132 var error$1 = {};
37133
37134 Object.defineProperty(error$1, "__esModule", {
37135   value: true
37136 });
37137 const utils$9 = utils$r;
37138
37139 class ErrorFilter {
37140   constructor(_settings) {
37141     this._settings = _settings;
37142   }
37143
37144   getFilter() {
37145     return error => this._isNonFatalError(error);
37146   }
37147
37148   _isNonFatalError(error) {
37149     return utils$9.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
37150   }
37151
37152 }
37153
37154 error$1.default = ErrorFilter;
37155
37156 var entry = {};
37157
37158 Object.defineProperty(entry, "__esModule", {
37159   value: true
37160 });
37161 const utils$8 = utils$r;
37162
37163 class EntryTransformer {
37164   constructor(_settings) {
37165     this._settings = _settings;
37166   }
37167
37168   getTransformer() {
37169     return entry => this._transform(entry);
37170   }
37171
37172   _transform(entry) {
37173     let filepath = entry.path;
37174
37175     if (this._settings.absolute) {
37176       filepath = utils$8.path.makeAbsolute(this._settings.cwd, filepath);
37177       filepath = utils$8.path.unixify(filepath);
37178     }
37179
37180     if (this._settings.markDirectories && entry.dirent.isDirectory()) {
37181       filepath += '/';
37182     }
37183
37184     if (!this._settings.objectMode) {
37185       return filepath;
37186     }
37187
37188     return Object.assign(Object.assign({}, entry), {
37189       path: filepath
37190     });
37191   }
37192
37193 }
37194
37195 entry.default = EntryTransformer;
37196
37197 Object.defineProperty(provider, "__esModule", {
37198   value: true
37199 });
37200 const path$3 = require$$0__default$2["default"];
37201 const deep_1 = deep;
37202 const entry_1 = entry$1;
37203 const error_1 = error$1;
37204 const entry_2 = entry;
37205
37206 class Provider {
37207   constructor(_settings) {
37208     this._settings = _settings;
37209     this.errorFilter = new error_1.default(this._settings);
37210     this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
37211     this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
37212     this.entryTransformer = new entry_2.default(this._settings);
37213   }
37214
37215   _getRootDirectory(task) {
37216     return path$3.resolve(this._settings.cwd, task.base);
37217   }
37218
37219   _getReaderOptions(task) {
37220     const basePath = task.base === '.' ? '' : task.base;
37221     return {
37222       basePath,
37223       pathSegmentSeparator: '/',
37224       concurrency: this._settings.concurrency,
37225       deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
37226       entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
37227       errorFilter: this.errorFilter.getFilter(),
37228       followSymbolicLinks: this._settings.followSymbolicLinks,
37229       fs: this._settings.fs,
37230       stats: this._settings.stats,
37231       throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
37232       transform: this.entryTransformer.getTransformer()
37233     };
37234   }
37235
37236   _getMicromatchOptions() {
37237     return {
37238       dot: this._settings.dot,
37239       matchBase: this._settings.baseNameMatch,
37240       nobrace: !this._settings.braceExpansion,
37241       nocase: !this._settings.caseSensitiveMatch,
37242       noext: !this._settings.extglob,
37243       noglobstar: !this._settings.globstar,
37244       posix: true,
37245       strictSlashes: false
37246     };
37247   }
37248
37249 }
37250
37251 provider.default = Provider;
37252
37253 Object.defineProperty(async$6, "__esModule", {
37254   value: true
37255 });
37256 const stream_1$2 = stream$2;
37257 const provider_1$2 = provider;
37258
37259 class ProviderAsync extends provider_1$2.default {
37260   constructor() {
37261     super(...arguments);
37262     this._reader = new stream_1$2.default(this._settings);
37263   }
37264
37265   read(task) {
37266     const root = this._getRootDirectory(task);
37267
37268     const options = this._getReaderOptions(task);
37269
37270     const entries = [];
37271     return new Promise((resolve, reject) => {
37272       const stream = this.api(root, task, options);
37273       stream.once('error', reject);
37274       stream.on('data', entry => entries.push(options.transform(entry)));
37275       stream.once('end', () => resolve(entries));
37276     });
37277   }
37278
37279   api(root, task, options) {
37280     if (task.dynamic) {
37281       return this._reader.dynamic(root, options);
37282     }
37283
37284     return this._reader.static(task.patterns, options);
37285   }
37286
37287 }
37288
37289 async$6.default = ProviderAsync;
37290
37291 var stream = {};
37292
37293 Object.defineProperty(stream, "__esModule", {
37294   value: true
37295 });
37296 const stream_1$1 = require$$0__default$5["default"];
37297 const stream_2 = stream$2;
37298 const provider_1$1 = provider;
37299
37300 class ProviderStream extends provider_1$1.default {
37301   constructor() {
37302     super(...arguments);
37303     this._reader = new stream_2.default(this._settings);
37304   }
37305
37306   read(task) {
37307     const root = this._getRootDirectory(task);
37308
37309     const options = this._getReaderOptions(task);
37310
37311     const source = this.api(root, task, options);
37312     const destination = new stream_1$1.Readable({
37313       objectMode: true,
37314       read: () => {}
37315     });
37316     source.once('error', error => destination.emit('error', error)).on('data', entry => destination.emit('data', options.transform(entry))).once('end', () => destination.emit('end'));
37317     destination.once('close', () => source.destroy());
37318     return destination;
37319   }
37320
37321   api(root, task, options) {
37322     if (task.dynamic) {
37323       return this._reader.dynamic(root, options);
37324     }
37325
37326     return this._reader.static(task.patterns, options);
37327   }
37328
37329 }
37330
37331 stream.default = ProviderStream;
37332
37333 var sync$1 = {};
37334
37335 var sync = {};
37336
37337 Object.defineProperty(sync, "__esModule", {
37338   value: true
37339 });
37340 const fsStat = out$3;
37341 const fsWalk = out$2;
37342 const reader_1 = reader;
37343
37344 class ReaderSync extends reader_1.default {
37345   constructor() {
37346     super(...arguments);
37347     this._walkSync = fsWalk.walkSync;
37348     this._statSync = fsStat.statSync;
37349   }
37350
37351   dynamic(root, options) {
37352     return this._walkSync(root, options);
37353   }
37354
37355   static(patterns, options) {
37356     const entries = [];
37357
37358     for (const pattern of patterns) {
37359       const filepath = this._getFullEntryPath(pattern);
37360
37361       const entry = this._getEntry(filepath, pattern, options);
37362
37363       if (entry === null || !options.entryFilter(entry)) {
37364         continue;
37365       }
37366
37367       entries.push(entry);
37368     }
37369
37370     return entries;
37371   }
37372
37373   _getEntry(filepath, pattern, options) {
37374     try {
37375       const stats = this._getStat(filepath);
37376
37377       return this._makeEntry(stats, pattern);
37378     } catch (error) {
37379       if (options.errorFilter(error)) {
37380         return null;
37381       }
37382
37383       throw error;
37384     }
37385   }
37386
37387   _getStat(filepath) {
37388     return this._statSync(filepath, this._fsStatSettings);
37389   }
37390
37391 }
37392
37393 sync.default = ReaderSync;
37394
37395 Object.defineProperty(sync$1, "__esModule", {
37396   value: true
37397 });
37398 const sync_1$1 = sync;
37399 const provider_1 = provider;
37400
37401 class ProviderSync extends provider_1.default {
37402   constructor() {
37403     super(...arguments);
37404     this._reader = new sync_1$1.default(this._settings);
37405   }
37406
37407   read(task) {
37408     const root = this._getRootDirectory(task);
37409
37410     const options = this._getReaderOptions(task);
37411
37412     const entries = this.api(root, task, options);
37413     return entries.map(options.transform);
37414   }
37415
37416   api(root, task, options) {
37417     if (task.dynamic) {
37418       return this._reader.dynamic(root, options);
37419     }
37420
37421     return this._reader.static(task.patterns, options);
37422   }
37423
37424 }
37425
37426 sync$1.default = ProviderSync;
37427
37428 var settings = {};
37429
37430 (function (exports) {
37431
37432   Object.defineProperty(exports, "__esModule", {
37433     value: true
37434   });
37435   exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
37436   const fs = require$$0__default["default"];
37437   const os = require$$0__default$1["default"];
37438   /**
37439    * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
37440    * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
37441    */
37442
37443   const CPU_COUNT = Math.max(os.cpus().length, 1);
37444   exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
37445     lstat: fs.lstat,
37446     lstatSync: fs.lstatSync,
37447     stat: fs.stat,
37448     statSync: fs.statSync,
37449     readdir: fs.readdir,
37450     readdirSync: fs.readdirSync
37451   };
37452
37453   class Settings {
37454     constructor(_options = {}) {
37455       this._options = _options;
37456       this.absolute = this._getValue(this._options.absolute, false);
37457       this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
37458       this.braceExpansion = this._getValue(this._options.braceExpansion, true);
37459       this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
37460       this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
37461       this.cwd = this._getValue(this._options.cwd, process.cwd());
37462       this.deep = this._getValue(this._options.deep, Infinity);
37463       this.dot = this._getValue(this._options.dot, false);
37464       this.extglob = this._getValue(this._options.extglob, true);
37465       this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
37466       this.fs = this._getFileSystemMethods(this._options.fs);
37467       this.globstar = this._getValue(this._options.globstar, true);
37468       this.ignore = this._getValue(this._options.ignore, []);
37469       this.markDirectories = this._getValue(this._options.markDirectories, false);
37470       this.objectMode = this._getValue(this._options.objectMode, false);
37471       this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
37472       this.onlyFiles = this._getValue(this._options.onlyFiles, true);
37473       this.stats = this._getValue(this._options.stats, false);
37474       this.suppressErrors = this._getValue(this._options.suppressErrors, false);
37475       this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
37476       this.unique = this._getValue(this._options.unique, true);
37477
37478       if (this.onlyDirectories) {
37479         this.onlyFiles = false;
37480       }
37481
37482       if (this.stats) {
37483         this.objectMode = true;
37484       }
37485     }
37486
37487     _getValue(option, value) {
37488       return option === undefined ? value : option;
37489     }
37490
37491     _getFileSystemMethods(methods = {}) {
37492       return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
37493     }
37494
37495   }
37496
37497   exports.default = Settings;
37498 })(settings);
37499
37500 const taskManager = tasks;
37501 const async_1 = async$6;
37502 const stream_1 = stream;
37503 const sync_1 = sync$1;
37504 const settings_1 = settings;
37505 const utils$7 = utils$r;
37506
37507 async function FastGlob(source, options) {
37508   assertPatternsInput$1(source);
37509   const works = getWorks(source, async_1.default, options);
37510   const result = await Promise.all(works);
37511   return utils$7.array.flatten(result);
37512 } // https://github.com/typescript-eslint/typescript-eslint/issues/60
37513 // eslint-disable-next-line no-redeclare
37514
37515
37516 (function (FastGlob) {
37517   function sync(source, options) {
37518     assertPatternsInput$1(source);
37519     const works = getWorks(source, sync_1.default, options);
37520     return utils$7.array.flatten(works);
37521   }
37522
37523   FastGlob.sync = sync;
37524
37525   function stream(source, options) {
37526     assertPatternsInput$1(source);
37527     const works = getWorks(source, stream_1.default, options);
37528     /**
37529      * The stream returned by the provider cannot work with an asynchronous iterator.
37530      * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
37531      * This affects performance (+25%). I don't see best solution right now.
37532      */
37533
37534     return utils$7.stream.merge(works);
37535   }
37536
37537   FastGlob.stream = stream;
37538
37539   function generateTasks(source, options) {
37540     assertPatternsInput$1(source);
37541     const patterns = [].concat(source);
37542     const settings = new settings_1.default(options);
37543     return taskManager.generate(patterns, settings);
37544   }
37545
37546   FastGlob.generateTasks = generateTasks;
37547
37548   function isDynamicPattern(source, options) {
37549     assertPatternsInput$1(source);
37550     const settings = new settings_1.default(options);
37551     return utils$7.pattern.isDynamicPattern(source, settings);
37552   }
37553
37554   FastGlob.isDynamicPattern = isDynamicPattern;
37555
37556   function escapePath(source) {
37557     assertPatternsInput$1(source);
37558     return utils$7.path.escape(source);
37559   }
37560
37561   FastGlob.escapePath = escapePath;
37562 })(FastGlob || (FastGlob = {}));
37563
37564 function getWorks(source, _Provider, options) {
37565   const patterns = [].concat(source);
37566   const settings = new settings_1.default(options);
37567   const tasks = taskManager.generate(patterns, settings);
37568   const provider = new _Provider(settings);
37569   return tasks.map(provider.read, provider);
37570 }
37571
37572 function assertPatternsInput$1(input) {
37573   const source = [].concat(input);
37574   const isValidSource = source.every(item => utils$7.string.isString(item) && !utils$7.string.isEmpty(item));
37575
37576   if (!isValidSource) {
37577     throw new TypeError('Patterns must be a string (non empty) or an array of strings');
37578   }
37579 }
37580
37581 var out = FastGlob;
37582
37583 var dirGlob$1 = {exports: {}};
37584
37585 var pathType$1 = {};
37586
37587 const {
37588   promisify: promisify$1
37589 } = require$$0__default$4["default"];
37590 const fs$3 = require$$0__default["default"];
37591
37592 async function isType(fsStatType, statsMethodName, filePath) {
37593   if (typeof filePath !== 'string') {
37594     throw new TypeError(`Expected a string, got ${typeof filePath}`);
37595   }
37596
37597   try {
37598     const stats = await promisify$1(fs$3[fsStatType])(filePath);
37599     return stats[statsMethodName]();
37600   } catch (error) {
37601     if (error.code === 'ENOENT') {
37602       return false;
37603     }
37604
37605     throw error;
37606   }
37607 }
37608
37609 function isTypeSync(fsStatType, statsMethodName, filePath) {
37610   if (typeof filePath !== 'string') {
37611     throw new TypeError(`Expected a string, got ${typeof filePath}`);
37612   }
37613
37614   try {
37615     return fs$3[fsStatType](filePath)[statsMethodName]();
37616   } catch (error) {
37617     if (error.code === 'ENOENT') {
37618       return false;
37619     }
37620
37621     throw error;
37622   }
37623 }
37624
37625 pathType$1.isFile = isType.bind(null, 'stat', 'isFile');
37626 pathType$1.isDirectory = isType.bind(null, 'stat', 'isDirectory');
37627 pathType$1.isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
37628 pathType$1.isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
37629 pathType$1.isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
37630 pathType$1.isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
37631
37632 const path$2 = require$$0__default$2["default"];
37633 const pathType = pathType$1;
37634
37635 const getExtensions = extensions => extensions.length > 1 ? `{${extensions.join(',')}}` : extensions[0];
37636
37637 const getPath = (filepath, cwd) => {
37638   const pth = filepath[0] === '!' ? filepath.slice(1) : filepath;
37639   return path$2.isAbsolute(pth) ? pth : path$2.join(cwd, pth);
37640 };
37641
37642 const addExtensions = (file, extensions) => {
37643   if (path$2.extname(file)) {
37644     return `**/${file}`;
37645   }
37646
37647   return `**/${file}.${getExtensions(extensions)}`;
37648 };
37649
37650 const getGlob = (directory, options) => {
37651   if (options.files && !Array.isArray(options.files)) {
37652     throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``);
37653   }
37654
37655   if (options.extensions && !Array.isArray(options.extensions)) {
37656     throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``);
37657   }
37658
37659   if (options.files && options.extensions) {
37660     return options.files.map(x => path$2.posix.join(directory, addExtensions(x, options.extensions)));
37661   }
37662
37663   if (options.files) {
37664     return options.files.map(x => path$2.posix.join(directory, `**/${x}`));
37665   }
37666
37667   if (options.extensions) {
37668     return [path$2.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)];
37669   }
37670
37671   return [path$2.posix.join(directory, '**')];
37672 };
37673
37674 dirGlob$1.exports = async (input, options) => {
37675   options = Object.assign({
37676     cwd: process.cwd()
37677   }, options);
37678
37679   if (typeof options.cwd !== 'string') {
37680     throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
37681   }
37682
37683   const globs = await Promise.all([].concat(input).map(async x => {
37684     const isDirectory = await pathType.isDirectory(getPath(x, options.cwd));
37685     return isDirectory ? getGlob(x, options) : x;
37686   }));
37687   return [].concat.apply([], globs); // eslint-disable-line prefer-spread
37688 };
37689
37690 dirGlob$1.exports.sync = (input, options) => {
37691   options = Object.assign({
37692     cwd: process.cwd()
37693   }, options);
37694
37695   if (typeof options.cwd !== 'string') {
37696     throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
37697   }
37698
37699   const globs = [].concat(input).map(x => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x);
37700   return [].concat.apply([], globs); // eslint-disable-line prefer-spread
37701 };
37702
37703 var gitignore$1 = {exports: {}};
37704
37705 function makeArray(subject) {
37706   return Array.isArray(subject) ? subject : [subject];
37707 }
37708
37709 const EMPTY = '';
37710 const SPACE = ' ';
37711 const ESCAPE = '\\';
37712 const REGEX_TEST_BLANK_LINE = /^\s+$/;
37713 const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
37714 const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
37715 const REGEX_SPLITALL_CRLF = /\r?\n/g; // /foo,
37716 // ./foo,
37717 // ../foo,
37718 // .
37719 // ..
37720
37721 const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
37722 const SLASH = '/';
37723 const KEY_IGNORE = typeof Symbol !== 'undefined' ? Symbol.for('node-ignore')
37724 /* istanbul ignore next */
37725 : 'node-ignore';
37726
37727 const define = (object, key, value) => Object.defineProperty(object, key, {
37728   value
37729 });
37730
37731 const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g; // Sanitize the range of a regular expression
37732 // The cases are complicated, see test cases for details
37733
37734 const sanitizeRange = range => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match // Invalid range (out of order) which is ok for gitignore rules but
37735 //   fatal for JavaScript regular expression, so eliminate it.
37736 : EMPTY); // See fixtures #59
37737
37738
37739 const cleanRangeBackSlash = slashes => {
37740   const {
37741     length
37742   } = slashes;
37743   return slashes.slice(0, length - length % 2);
37744 }; // > If the pattern ends with a slash,
37745 // > it is removed for the purpose of the following description,
37746 // > but it would only find a match with a directory.
37747 // > In other words, foo/ will match a directory foo and paths underneath it,
37748 // > but will not match a regular file or a symbolic link foo
37749 // >  (this is consistent with the way how pathspec works in general in Git).
37750 // '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
37751 // -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
37752 //      you could use option `mark: true` with `glob`
37753 // '`foo/`' should not continue with the '`..`'
37754
37755
37756 const REPLACERS = [// > Trailing spaces are ignored unless they are quoted with backslash ("\")
37757 [// (a\ ) -> (a )
37758 // (a  ) -> (a)
37759 // (a \ ) -> (a  )
37760 /\\?\s+$/, match => match.indexOf('\\') === 0 ? SPACE : EMPTY], // replace (\ ) with ' '
37761 [/\\\s/g, () => SPACE], // Escape metacharacters
37762 // which is written down by users but means special for regular expressions.
37763 // > There are 12 characters with special meanings:
37764 // > - the backslash \,
37765 // > - the caret ^,
37766 // > - the dollar sign $,
37767 // > - the period or dot .,
37768 // > - the vertical bar or pipe symbol |,
37769 // > - the question mark ?,
37770 // > - the asterisk or star *,
37771 // > - the plus sign +,
37772 // > - the opening parenthesis (,
37773 // > - the closing parenthesis ),
37774 // > - and the opening square bracket [,
37775 // > - the opening curly brace {,
37776 // > These special characters are often called "metacharacters".
37777 [/[\\$.|*+(){^]/g, match => `\\${match}`], [// > a question mark (?) matches a single character
37778 /(?!\\)\?/g, () => '[^/]'], // leading slash
37779 [// > A leading slash matches the beginning of the pathname.
37780 // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
37781 // A leading slash matches the beginning of the pathname
37782 /^\//, () => '^'], // replace special metacharacter slash after the leading slash
37783 [/\//g, () => '\\/'], [// > A leading "**" followed by a slash means match in all directories.
37784 // > For example, "**/foo" matches file or directory "foo" anywhere,
37785 // > the same as pattern "foo".
37786 // > "**/foo/bar" matches file or directory "bar" anywhere that is directly
37787 // >   under directory "foo".
37788 // Notice that the '*'s have been replaced as '\\*'
37789 /^\^*\\\*\\\*\\\//, // '**/foo' <-> 'foo'
37790 () => '^(?:.*\\/)?'], // starting
37791 [// there will be no leading '/'
37792 //   (which has been replaced by section "leading slash")
37793 // If starts with '**', adding a '^' to the regular expression also works
37794 /^(?=[^^])/, function startingReplacer() {
37795   // If has a slash `/` at the beginning or middle
37796   return !/\/(?!$)/.test(this) // > Prior to 2.22.1
37797   // > If the pattern does not contain a slash /,
37798   // >   Git treats it as a shell glob pattern
37799   // Actually, if there is only a trailing slash,
37800   //   git also treats it as a shell glob pattern
37801   // After 2.22.1 (compatible but clearer)
37802   // > If there is a separator at the beginning or middle (or both)
37803   // > of the pattern, then the pattern is relative to the directory
37804   // > level of the particular .gitignore file itself.
37805   // > Otherwise the pattern may also match at any level below
37806   // > the .gitignore level.
37807   ? '(?:^|\\/)' // > Otherwise, Git treats the pattern as a shell glob suitable for
37808   // >   consumption by fnmatch(3)
37809   : '^';
37810 }], // two globstars
37811 [// Use lookahead assertions so that we could match more than one `'/**'`
37812 /\\\/\\\*\\\*(?=\\\/|$)/g, // Zero, one or several directories
37813 // should not use '*', or it will be replaced by the next replacer
37814 // Check if it is not the last `'/**'`
37815 (_, index, str) => index + 6 < str.length // case: /**/
37816 // > A slash followed by two consecutive asterisks then a slash matches
37817 // >   zero or more directories.
37818 // > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
37819 // '/**/'
37820 ? '(?:\\/[^\\/]+)*' // case: /**
37821 // > A trailing `"/**"` matches everything inside.
37822 // #21: everything inside but it should not include the current folder
37823 : '\\/.+'], // intermediate wildcards
37824 [// Never replace escaped '*'
37825 // ignore rule '\*' will match the path '*'
37826 // 'abc.*/' -> go
37827 // 'abc.*'  -> skip this rule
37828 /(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js'
37829 // '*.js' doesn't match 'abc'
37830 (_, p1) => `${p1}[^\\/]*`], [// unescape, revert step 3 except for back slash
37831 // For example, if a user escape a '\\*',
37832 // after step 3, the result will be '\\\\\\*'
37833 /\\\\\\(?=[$.|*+(){^])/g, () => ESCAPE], [// '\\\\' -> '\\'
37834 /\\\\/g, () => ESCAPE], [// > The range notation, e.g. [a-zA-Z],
37835 // > can be used to match one of the characters in a range.
37836 // `\` is escaped by step 3
37837 /(\\)?\[([^\]/]*?)(\\*)($|\])/g, (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE // '\\[bar]' -> '\\\\[bar\\]'
37838 ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === ']' ? endEscape.length % 2 === 0 // A normal case, and it is a range notation
37839 // '[bar]'
37840 // '[bar\\\\]'
37841 ? `[${sanitizeRange(range)}${endEscape}]` // Invalid range notaton
37842 // '[bar\\]' -> '[bar\\\\]'
37843 : '[]' : '[]'], // ending
37844 [// 'js' will not match 'js.'
37845 // 'ab' will not match 'abc'
37846 /(?:[^*])$/, // WTF!
37847 // https://git-scm.com/docs/gitignore
37848 // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
37849 // which re-fixes #24, #38
37850 // > If there is a separator at the end of the pattern then the pattern
37851 // > will only match directories, otherwise the pattern can match both
37852 // > files and directories.
37853 // 'js*' will not match 'a.js'
37854 // 'js/' will not match 'a.js'
37855 // 'js' will match 'a.js' and 'a.js/'
37856 match => /\/$/.test(match) // foo/ will not match 'foo'
37857 ? `${match}$` // foo matches 'foo' and 'foo/'
37858 : `${match}(?=$|\\/$)`], // trailing wildcard
37859 [/(\^|\\\/)?\\\*$/, (_, p1) => {
37860   const prefix = p1 // '\^':
37861   // '/*' does not match EMPTY
37862   // '/*' does not match everything
37863   // '\\\/':
37864   // 'abc/*' does not match 'abc/'
37865   ? `${p1}[^/]+` // 'a*' matches 'a'
37866   // 'a*' matches 'aa'
37867   : '[^/]*';
37868   return `${prefix}(?=$|\\/$)`;
37869 }]]; // A simple cache, because an ignore rule only has only one certain meaning
37870
37871 const regexCache = Object.create(null); // @param {pattern}
37872
37873 const makeRegex = (pattern, ignorecase) => {
37874   let source = regexCache[pattern];
37875
37876   if (!source) {
37877     source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
37878     regexCache[pattern] = source;
37879   }
37880
37881   return ignorecase ? new RegExp(source, 'i') : new RegExp(source);
37882 };
37883
37884 const isString = subject => typeof subject === 'string'; // > A blank line matches no files, so it can serve as a separator for readability.
37885
37886
37887 const checkPattern = pattern => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) // > A line starting with # serves as a comment.
37888 && pattern.indexOf('#') !== 0;
37889
37890 const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF);
37891
37892 class IgnoreRule {
37893   constructor(origin, pattern, negative, regex) {
37894     this.origin = origin;
37895     this.pattern = pattern;
37896     this.negative = negative;
37897     this.regex = regex;
37898   }
37899
37900 }
37901
37902 const createRule = (pattern, ignorecase) => {
37903   const origin = pattern;
37904   let negative = false; // > An optional prefix "!" which negates the pattern;
37905
37906   if (pattern.indexOf('!') === 0) {
37907     negative = true;
37908     pattern = pattern.substr(1);
37909   }
37910
37911   pattern = pattern // > Put a backslash ("\") in front of the first "!" for patterns that
37912   // >   begin with a literal "!", for example, `"\!important!.txt"`.
37913   .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!') // > Put a backslash ("\") in front of the first hash for patterns that
37914   // >   begin with a hash.
37915   .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#');
37916   const regex = makeRegex(pattern, ignorecase);
37917   return new IgnoreRule(origin, pattern, negative, regex);
37918 };
37919
37920 const throwError = (message, Ctor) => {
37921   throw new Ctor(message);
37922 };
37923
37924 const checkPath = (path, originalPath, doThrow) => {
37925   if (!isString(path)) {
37926     return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
37927   } // We don't know if we should ignore EMPTY, so throw
37928
37929
37930   if (!path) {
37931     return doThrow(`path must not be empty`, TypeError);
37932   } // Check if it is a relative path
37933
37934
37935   if (checkPath.isNotRelative(path)) {
37936     const r = '`path.relative()`d';
37937     return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
37938   }
37939
37940   return true;
37941 };
37942
37943 const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path);
37944
37945 checkPath.isNotRelative = isNotRelative;
37946
37947 checkPath.convert = p => p;
37948
37949 class Ignore {
37950   constructor({
37951     ignorecase = true
37952   } = {}) {
37953     define(this, KEY_IGNORE, true);
37954     this._rules = [];
37955     this._ignorecase = ignorecase;
37956
37957     this._initCache();
37958   }
37959
37960   _initCache() {
37961     this._ignoreCache = Object.create(null);
37962     this._testCache = Object.create(null);
37963   }
37964
37965   _addPattern(pattern) {
37966     // #32
37967     if (pattern && pattern[KEY_IGNORE]) {
37968       this._rules = this._rules.concat(pattern._rules);
37969       this._added = true;
37970       return;
37971     }
37972
37973     if (checkPattern(pattern)) {
37974       const rule = createRule(pattern, this._ignorecase);
37975       this._added = true;
37976
37977       this._rules.push(rule);
37978     }
37979   } // @param {Array<string> | string | Ignore} pattern
37980
37981
37982   add(pattern) {
37983     this._added = false;
37984     makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this); // Some rules have just added to the ignore,
37985     // making the behavior changed.
37986
37987     if (this._added) {
37988       this._initCache();
37989     }
37990
37991     return this;
37992   } // legacy
37993
37994
37995   addPattern(pattern) {
37996     return this.add(pattern);
37997   } //          |           ignored : unignored
37998   // negative |   0:0   |   0:1   |   1:0   |   1:1
37999   // -------- | ------- | ------- | ------- | --------
38000   //     0    |  TEST   |  TEST   |  SKIP   |    X
38001   //     1    |  TESTIF |  SKIP   |  TEST   |    X
38002   // - SKIP: always skip
38003   // - TEST: always test
38004   // - TESTIF: only test if checkUnignored
38005   // - X: that never happen
38006   // @param {boolean} whether should check if the path is unignored,
38007   //   setting `checkUnignored` to `false` could reduce additional
38008   //   path matching.
38009   // @returns {TestResult} true if a file is ignored
38010
38011
38012   _testOne(path, checkUnignored) {
38013     let ignored = false;
38014     let unignored = false;
38015
38016     this._rules.forEach(rule => {
38017       const {
38018         negative
38019       } = rule;
38020
38021       if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
38022         return;
38023       }
38024
38025       const matched = rule.regex.test(path);
38026
38027       if (matched) {
38028         ignored = !negative;
38029         unignored = negative;
38030       }
38031     });
38032
38033     return {
38034       ignored,
38035       unignored
38036     };
38037   } // @returns {TestResult}
38038
38039
38040   _test(originalPath, cache, checkUnignored, slices) {
38041     const path = originalPath // Supports nullable path
38042     && checkPath.convert(originalPath);
38043     checkPath(path, originalPath, throwError);
38044     return this._t(path, cache, checkUnignored, slices);
38045   }
38046
38047   _t(path, cache, checkUnignored, slices) {
38048     if (path in cache) {
38049       return cache[path];
38050     }
38051
38052     if (!slices) {
38053       // path/to/a.js
38054       // ['path', 'to', 'a.js']
38055       slices = path.split(SLASH);
38056     }
38057
38058     slices.pop(); // If the path has no parent directory, just test it
38059
38060     if (!slices.length) {
38061       return cache[path] = this._testOne(path, checkUnignored);
38062     }
38063
38064     const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices); // If the path contains a parent directory, check the parent first
38065
38066
38067     return cache[path] = parent.ignored // > It is not possible to re-include a file if a parent directory of
38068     // >   that file is excluded.
38069     ? parent : this._testOne(path, checkUnignored);
38070   }
38071
38072   ignores(path) {
38073     return this._test(path, this._ignoreCache, false).ignored;
38074   }
38075
38076   createFilter() {
38077     return path => !this.ignores(path);
38078   }
38079
38080   filter(paths) {
38081     return makeArray(paths).filter(this.createFilter());
38082   } // @returns {TestResult}
38083
38084
38085   test(path) {
38086     return this._test(path, this._testCache, true);
38087   }
38088
38089 }
38090
38091 const factory = options => new Ignore(options);
38092
38093 const returnFalse = () => false;
38094
38095 const isPathValid = path => checkPath(path && checkPath.convert(path), path, returnFalse);
38096
38097 factory.isPathValid = isPathValid; // Fixes typescript
38098
38099 factory.default = factory;
38100 var ignore = factory; // Windows
38101 // --------------------------------------------------------------
38102
38103 /* istanbul ignore if  */
38104
38105 if ( // Detect `process` so that it can run in browsers.
38106 typeof process !== 'undefined' && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === 'win32')) {
38107   /* eslint no-control-regex: "off" */
38108   const makePosix = str => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, '/');
38109
38110   checkPath.convert = makePosix; // 'C:\\foo'     <- 'C:\\foo' has been converted to 'C:/'
38111   // 'd:\\foo'
38112
38113   const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
38114
38115   checkPath.isNotRelative = path => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
38116 }
38117
38118 var slash$1 = path => {
38119   const isExtendedLengthPath = /^\\\\\?\\/.test(path);
38120   const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex
38121
38122   if (isExtendedLengthPath || hasNonAscii) {
38123     return path;
38124   }
38125
38126   return path.replace(/\\/g, '/');
38127 };
38128
38129 const {
38130   promisify
38131 } = require$$0__default$4["default"];
38132 const fs$2 = require$$0__default["default"];
38133 const path$1 = require$$0__default$2["default"];
38134 const fastGlob$1 = out;
38135 const gitIgnore = ignore;
38136 const slash = slash$1;
38137 const DEFAULT_IGNORE = ['**/node_modules/**', '**/flow-typed/**', '**/coverage/**', '**/.git'];
38138 const readFileP = promisify(fs$2.readFile);
38139
38140 const mapGitIgnorePatternTo = base => ignore => {
38141   if (ignore.startsWith('!')) {
38142     return '!' + path$1.posix.join(base, ignore.slice(1));
38143   }
38144
38145   return path$1.posix.join(base, ignore);
38146 };
38147
38148 const parseGitIgnore = (content, options) => {
38149   const base = slash(path$1.relative(options.cwd, path$1.dirname(options.fileName)));
38150   return content.split(/\r?\n/).filter(Boolean).filter(line => !line.startsWith('#')).map(mapGitIgnorePatternTo(base));
38151 };
38152
38153 const reduceIgnore = files => {
38154   const ignores = gitIgnore();
38155
38156   for (const file of files) {
38157     ignores.add(parseGitIgnore(file.content, {
38158       cwd: file.cwd,
38159       fileName: file.filePath
38160     }));
38161   }
38162
38163   return ignores;
38164 };
38165
38166 const ensureAbsolutePathForCwd = (cwd, p) => {
38167   cwd = slash(cwd);
38168
38169   if (path$1.isAbsolute(p)) {
38170     if (slash(p).startsWith(cwd)) {
38171       return p;
38172     }
38173
38174     throw new Error(`Path ${p} is not in cwd ${cwd}`);
38175   }
38176
38177   return path$1.join(cwd, p);
38178 };
38179
38180 const getIsIgnoredPredecate = (ignores, cwd) => {
38181   return p => ignores.ignores(slash(path$1.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p))));
38182 };
38183
38184 const getFile = async (file, cwd) => {
38185   const filePath = path$1.join(cwd, file);
38186   const content = await readFileP(filePath, 'utf8');
38187   return {
38188     cwd,
38189     filePath,
38190     content
38191   };
38192 };
38193
38194 const getFileSync = (file, cwd) => {
38195   const filePath = path$1.join(cwd, file);
38196   const content = fs$2.readFileSync(filePath, 'utf8');
38197   return {
38198     cwd,
38199     filePath,
38200     content
38201   };
38202 };
38203
38204 const normalizeOptions = ({
38205   ignore = [],
38206   cwd = slash(process.cwd())
38207 } = {}) => {
38208   return {
38209     ignore,
38210     cwd
38211   };
38212 };
38213
38214 gitignore$1.exports = async options => {
38215   options = normalizeOptions(options);
38216   const paths = await fastGlob$1('**/.gitignore', {
38217     ignore: DEFAULT_IGNORE.concat(options.ignore),
38218     cwd: options.cwd
38219   });
38220   const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
38221   const ignores = reduceIgnore(files);
38222   return getIsIgnoredPredecate(ignores, options.cwd);
38223 };
38224
38225 gitignore$1.exports.sync = options => {
38226   options = normalizeOptions(options);
38227   const paths = fastGlob$1.sync('**/.gitignore', {
38228     ignore: DEFAULT_IGNORE.concat(options.ignore),
38229     cwd: options.cwd
38230   });
38231   const files = paths.map(file => getFileSync(file, options.cwd));
38232   const ignores = reduceIgnore(files);
38233   return getIsIgnoredPredecate(ignores, options.cwd);
38234 };
38235
38236 const {
38237   Transform
38238 } = require$$0__default$5["default"];
38239
38240 class ObjectTransform extends Transform {
38241   constructor() {
38242     super({
38243       objectMode: true
38244     });
38245   }
38246
38247 }
38248
38249 class FilterStream$1 extends ObjectTransform {
38250   constructor(filter) {
38251     super();
38252     this._filter = filter;
38253   }
38254
38255   _transform(data, encoding, callback) {
38256     if (this._filter(data)) {
38257       this.push(data);
38258     }
38259
38260     callback();
38261   }
38262
38263 }
38264
38265 class UniqueStream$1 extends ObjectTransform {
38266   constructor() {
38267     super();
38268     this._pushed = new Set();
38269   }
38270
38271   _transform(data, encoding, callback) {
38272     if (!this._pushed.has(data)) {
38273       this.push(data);
38274
38275       this._pushed.add(data);
38276     }
38277
38278     callback();
38279   }
38280
38281 }
38282
38283 var streamUtils = {
38284   FilterStream: FilterStream$1,
38285   UniqueStream: UniqueStream$1
38286 };
38287
38288 const fs$1 = require$$0__default["default"];
38289 const arrayUnion = arrayUnion$1;
38290 const merge2 = merge2_1;
38291 const fastGlob = out;
38292 const dirGlob = dirGlob$1.exports;
38293 const gitignore = gitignore$1.exports;
38294 const {
38295   FilterStream,
38296   UniqueStream
38297 } = streamUtils;
38298
38299 const DEFAULT_FILTER = () => false;
38300
38301 const isNegative = pattern => pattern[0] === '!';
38302
38303 const assertPatternsInput = patterns => {
38304   if (!patterns.every(pattern => typeof pattern === 'string')) {
38305     throw new TypeError('Patterns must be a string or an array of strings');
38306   }
38307 };
38308
38309 const checkCwdOption = (options = {}) => {
38310   if (!options.cwd) {
38311     return;
38312   }
38313
38314   let stat;
38315
38316   try {
38317     stat = fs$1.statSync(options.cwd);
38318   } catch {
38319     return;
38320   }
38321
38322   if (!stat.isDirectory()) {
38323     throw new Error('The `cwd` option must be a path to a directory');
38324   }
38325 };
38326
38327 const getPathString = p => p.stats instanceof fs$1.Stats ? p.path : p;
38328
38329 const generateGlobTasks = (patterns, taskOptions) => {
38330   patterns = arrayUnion([].concat(patterns));
38331   assertPatternsInput(patterns);
38332   checkCwdOption(taskOptions);
38333   const globTasks = [];
38334   taskOptions = Object.assign({
38335     ignore: [],
38336     expandDirectories: true
38337   }, taskOptions);
38338
38339   for (const [index, pattern] of patterns.entries()) {
38340     if (isNegative(pattern)) {
38341       continue;
38342     }
38343
38344     const ignore = patterns.slice(index).filter(pattern => isNegative(pattern)).map(pattern => pattern.slice(1));
38345     const options = Object.assign(Object.assign({}, taskOptions), {}, {
38346       ignore: taskOptions.ignore.concat(ignore)
38347     });
38348     globTasks.push({
38349       pattern,
38350       options
38351     });
38352   }
38353
38354   return globTasks;
38355 };
38356
38357 const globDirs = (task, fn) => {
38358   let options = {};
38359
38360   if (task.options.cwd) {
38361     options.cwd = task.options.cwd;
38362   }
38363
38364   if (Array.isArray(task.options.expandDirectories)) {
38365     options = Object.assign(Object.assign({}, options), {}, {
38366       files: task.options.expandDirectories
38367     });
38368   } else if (typeof task.options.expandDirectories === 'object') {
38369     options = Object.assign(Object.assign({}, options), task.options.expandDirectories);
38370   }
38371
38372   return fn(task.pattern, options);
38373 };
38374
38375 const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern];
38376
38377 const getFilterSync = options => {
38378   return options && options.gitignore ? gitignore.sync({
38379     cwd: options.cwd,
38380     ignore: options.ignore
38381   }) : DEFAULT_FILTER;
38382 };
38383
38384 const globToTask = task => glob => {
38385   const {
38386     options
38387   } = task;
38388
38389   if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
38390     options.ignore = dirGlob.sync(options.ignore);
38391   }
38392
38393   return {
38394     pattern: glob,
38395     options
38396   };
38397 };
38398
38399 globby$2.exports = async (patterns, options) => {
38400   const globTasks = generateGlobTasks(patterns, options);
38401
38402   const getFilter = async () => {
38403     return options && options.gitignore ? gitignore({
38404       cwd: options.cwd,
38405       ignore: options.ignore
38406     }) : DEFAULT_FILTER;
38407   };
38408
38409   const getTasks = async () => {
38410     const tasks = await Promise.all(globTasks.map(async task => {
38411       const globs = await getPattern(task, dirGlob);
38412       return Promise.all(globs.map(globToTask(task)));
38413     }));
38414     return arrayUnion(...tasks);
38415   };
38416
38417   const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
38418   const paths = await Promise.all(tasks.map(task => fastGlob(task.pattern, task.options)));
38419   return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_)));
38420 };
38421
38422 globby$2.exports.sync = (patterns, options) => {
38423   const globTasks = generateGlobTasks(patterns, options);
38424   const tasks = [];
38425
38426   for (const task of globTasks) {
38427     const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
38428     tasks.push(...newTask);
38429   }
38430
38431   const filter = getFilterSync(options);
38432   let matches = [];
38433
38434   for (const task of tasks) {
38435     matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options));
38436   }
38437
38438   return matches.filter(path_ => !filter(path_));
38439 };
38440
38441 globby$2.exports.stream = (patterns, options) => {
38442   const globTasks = generateGlobTasks(patterns, options);
38443   const tasks = [];
38444
38445   for (const task of globTasks) {
38446     const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
38447     tasks.push(...newTask);
38448   }
38449
38450   const filter = getFilterSync(options);
38451   const filterStream = new FilterStream(p => !filter(p));
38452   const uniqueStream = new UniqueStream();
38453   return merge2(tasks.map(task => fastGlob.stream(task.pattern, task.options))).pipe(filterStream).pipe(uniqueStream);
38454 };
38455
38456 globby$2.exports.generateGlobTasks = generateGlobTasks;
38457
38458 globby$2.exports.hasMagic = (patterns, options) => [].concat(patterns).some(pattern => fastGlob.isDynamicPattern(pattern, options));
38459
38460 globby$2.exports.gitignore = gitignore;
38461
38462 const _excluded = ["languageId"];
38463
38464 var createLanguage$7 = function (linguistData, override) {
38465   const {
38466     languageId
38467   } = linguistData,
38468         rest = _objectWithoutProperties(linguistData, _excluded);
38469
38470   return Object.assign(Object.assign({
38471     linguistLanguageId: languageId
38472   }, rest), override(linguistData));
38473 };
38474
38475 var utils$6 = {};
38476
38477 var ast = {exports: {}};
38478
38479 /*
38480   Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
38481
38482   Redistribution and use in source and binary forms, with or without
38483   modification, are permitted provided that the following conditions are met:
38484
38485     * Redistributions of source code must retain the above copyright
38486       notice, this list of conditions and the following disclaimer.
38487     * Redistributions in binary form must reproduce the above copyright
38488       notice, this list of conditions and the following disclaimer in the
38489       documentation and/or other materials provided with the distribution.
38490
38491   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
38492   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38493   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38494   ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
38495   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38496   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38497   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38498   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38499   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
38500   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38501 */
38502
38503 (function () {
38504
38505   function isExpression(node) {
38506     if (node == null) {
38507       return false;
38508     }
38509
38510     switch (node.type) {
38511       case 'ArrayExpression':
38512       case 'AssignmentExpression':
38513       case 'BinaryExpression':
38514       case 'CallExpression':
38515       case 'ConditionalExpression':
38516       case 'FunctionExpression':
38517       case 'Identifier':
38518       case 'Literal':
38519       case 'LogicalExpression':
38520       case 'MemberExpression':
38521       case 'NewExpression':
38522       case 'ObjectExpression':
38523       case 'SequenceExpression':
38524       case 'ThisExpression':
38525       case 'UnaryExpression':
38526       case 'UpdateExpression':
38527         return true;
38528     }
38529
38530     return false;
38531   }
38532
38533   function isIterationStatement(node) {
38534     if (node == null) {
38535       return false;
38536     }
38537
38538     switch (node.type) {
38539       case 'DoWhileStatement':
38540       case 'ForInStatement':
38541       case 'ForStatement':
38542       case 'WhileStatement':
38543         return true;
38544     }
38545
38546     return false;
38547   }
38548
38549   function isStatement(node) {
38550     if (node == null) {
38551       return false;
38552     }
38553
38554     switch (node.type) {
38555       case 'BlockStatement':
38556       case 'BreakStatement':
38557       case 'ContinueStatement':
38558       case 'DebuggerStatement':
38559       case 'DoWhileStatement':
38560       case 'EmptyStatement':
38561       case 'ExpressionStatement':
38562       case 'ForInStatement':
38563       case 'ForStatement':
38564       case 'IfStatement':
38565       case 'LabeledStatement':
38566       case 'ReturnStatement':
38567       case 'SwitchStatement':
38568       case 'ThrowStatement':
38569       case 'TryStatement':
38570       case 'VariableDeclaration':
38571       case 'WhileStatement':
38572       case 'WithStatement':
38573         return true;
38574     }
38575
38576     return false;
38577   }
38578
38579   function isSourceElement(node) {
38580     return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
38581   }
38582
38583   function trailingStatement(node) {
38584     switch (node.type) {
38585       case 'IfStatement':
38586         if (node.alternate != null) {
38587           return node.alternate;
38588         }
38589
38590         return node.consequent;
38591
38592       case 'LabeledStatement':
38593       case 'ForStatement':
38594       case 'ForInStatement':
38595       case 'WhileStatement':
38596       case 'WithStatement':
38597         return node.body;
38598     }
38599
38600     return null;
38601   }
38602
38603   function isProblematicIfStatement(node) {
38604     var current;
38605
38606     if (node.type !== 'IfStatement') {
38607       return false;
38608     }
38609
38610     if (node.alternate == null) {
38611       return false;
38612     }
38613
38614     current = node.consequent;
38615
38616     do {
38617       if (current.type === 'IfStatement') {
38618         if (current.alternate == null) {
38619           return true;
38620         }
38621       }
38622
38623       current = trailingStatement(current);
38624     } while (current);
38625
38626     return false;
38627   }
38628
38629   ast.exports = {
38630     isExpression: isExpression,
38631     isStatement: isStatement,
38632     isIterationStatement: isIterationStatement,
38633     isSourceElement: isSourceElement,
38634     isProblematicIfStatement: isProblematicIfStatement,
38635     trailingStatement: trailingStatement
38636   };
38637 })();
38638
38639 var code = {exports: {}};
38640
38641 /*
38642   Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
38643   Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
38644
38645   Redistribution and use in source and binary forms, with or without
38646   modification, are permitted provided that the following conditions are met:
38647
38648     * Redistributions of source code must retain the above copyright
38649       notice, this list of conditions and the following disclaimer.
38650     * Redistributions in binary form must reproduce the above copyright
38651       notice, this list of conditions and the following disclaimer in the
38652       documentation and/or other materials provided with the distribution.
38653
38654   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38655   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38656   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38657   ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
38658   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38659   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38660   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38661   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38662   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
38663   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38664 */
38665
38666 (function () {
38667
38668   var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
38669
38670   ES5Regex = {
38671     // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart:
38672     NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
38673     // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart:
38674     NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
38675   };
38676   ES6Regex = {
38677     // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart:
38678     NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
38679     // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart:
38680     NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
38681   };
38682
38683   function isDecimalDigit(ch) {
38684     return 0x30 <= ch && ch <= 0x39; // 0..9
38685   }
38686
38687   function isHexDigit(ch) {
38688     return 0x30 <= ch && ch <= 0x39 || // 0..9
38689     0x61 <= ch && ch <= 0x66 || // a..f
38690     0x41 <= ch && ch <= 0x46; // A..F
38691   }
38692
38693   function isOctalDigit(ch) {
38694     return ch >= 0x30 && ch <= 0x37; // 0..7
38695   } // 7.2 White Space
38696
38697
38698   NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
38699
38700   function isWhiteSpace(ch) {
38701     return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
38702   } // 7.3 Line Terminators
38703
38704
38705   function isLineTerminator(ch) {
38706     return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
38707   } // 7.6 Identifier Names and Identifiers
38708
38709
38710   function fromCodePoint(cp) {
38711     if (cp <= 0xFFFF) {
38712       return String.fromCharCode(cp);
38713     }
38714
38715     var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
38716     var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
38717     return cu1 + cu2;
38718   }
38719
38720   IDENTIFIER_START = new Array(0x80);
38721
38722   for (ch = 0; ch < 0x80; ++ch) {
38723     IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
38724     ch >= 0x41 && ch <= 0x5A || // A..Z
38725     ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
38726   }
38727
38728   IDENTIFIER_PART = new Array(0x80);
38729
38730   for (ch = 0; ch < 0x80; ++ch) {
38731     IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
38732     ch >= 0x41 && ch <= 0x5A || // A..Z
38733     ch >= 0x30 && ch <= 0x39 || // 0..9
38734     ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
38735   }
38736
38737   function isIdentifierStartES5(ch) {
38738     return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
38739   }
38740
38741   function isIdentifierPartES5(ch) {
38742     return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
38743   }
38744
38745   function isIdentifierStartES6(ch) {
38746     return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
38747   }
38748
38749   function isIdentifierPartES6(ch) {
38750     return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
38751   }
38752
38753   code.exports = {
38754     isDecimalDigit: isDecimalDigit,
38755     isHexDigit: isHexDigit,
38756     isOctalDigit: isOctalDigit,
38757     isWhiteSpace: isWhiteSpace,
38758     isLineTerminator: isLineTerminator,
38759     isIdentifierStartES5: isIdentifierStartES5,
38760     isIdentifierPartES5: isIdentifierPartES5,
38761     isIdentifierStartES6: isIdentifierStartES6,
38762     isIdentifierPartES6: isIdentifierPartES6
38763   };
38764 })();
38765
38766 var keyword = {exports: {}};
38767
38768 /*
38769   Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
38770
38771   Redistribution and use in source and binary forms, with or without
38772   modification, are permitted provided that the following conditions are met:
38773
38774     * Redistributions of source code must retain the above copyright
38775       notice, this list of conditions and the following disclaimer.
38776     * Redistributions in binary form must reproduce the above copyright
38777       notice, this list of conditions and the following disclaimer in the
38778       documentation and/or other materials provided with the distribution.
38779
38780   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38781   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38782   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38783   ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
38784   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38785   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38786   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38787   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38788   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
38789   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38790 */
38791
38792 (function () {
38793
38794   var code$1 = code.exports;
38795
38796   function isStrictModeReservedWordES6(id) {
38797     switch (id) {
38798       case 'implements':
38799       case 'interface':
38800       case 'package':
38801       case 'private':
38802       case 'protected':
38803       case 'public':
38804       case 'static':
38805       case 'let':
38806         return true;
38807
38808       default:
38809         return false;
38810     }
38811   }
38812
38813   function isKeywordES5(id, strict) {
38814     // yield should not be treated as keyword under non-strict mode.
38815     if (!strict && id === 'yield') {
38816       return false;
38817     }
38818
38819     return isKeywordES6(id, strict);
38820   }
38821
38822   function isKeywordES6(id, strict) {
38823     if (strict && isStrictModeReservedWordES6(id)) {
38824       return true;
38825     }
38826
38827     switch (id.length) {
38828       case 2:
38829         return id === 'if' || id === 'in' || id === 'do';
38830
38831       case 3:
38832         return id === 'var' || id === 'for' || id === 'new' || id === 'try';
38833
38834       case 4:
38835         return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
38836
38837       case 5:
38838         return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
38839
38840       case 6:
38841         return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
38842
38843       case 7:
38844         return id === 'default' || id === 'finally' || id === 'extends';
38845
38846       case 8:
38847         return id === 'function' || id === 'continue' || id === 'debugger';
38848
38849       case 10:
38850         return id === 'instanceof';
38851
38852       default:
38853         return false;
38854     }
38855   }
38856
38857   function isReservedWordES5(id, strict) {
38858     return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
38859   }
38860
38861   function isReservedWordES6(id, strict) {
38862     return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
38863   }
38864
38865   function isRestrictedWord(id) {
38866     return id === 'eval' || id === 'arguments';
38867   }
38868
38869   function isIdentifierNameES5(id) {
38870     var i, iz, ch;
38871
38872     if (id.length === 0) {
38873       return false;
38874     }
38875
38876     ch = id.charCodeAt(0);
38877
38878     if (!code$1.isIdentifierStartES5(ch)) {
38879       return false;
38880     }
38881
38882     for (i = 1, iz = id.length; i < iz; ++i) {
38883       ch = id.charCodeAt(i);
38884
38885       if (!code$1.isIdentifierPartES5(ch)) {
38886         return false;
38887       }
38888     }
38889
38890     return true;
38891   }
38892
38893   function decodeUtf16(lead, trail) {
38894     return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
38895   }
38896
38897   function isIdentifierNameES6(id) {
38898     var i, iz, ch, lowCh, check;
38899
38900     if (id.length === 0) {
38901       return false;
38902     }
38903
38904     check = code$1.isIdentifierStartES6;
38905
38906     for (i = 0, iz = id.length; i < iz; ++i) {
38907       ch = id.charCodeAt(i);
38908
38909       if (0xD800 <= ch && ch <= 0xDBFF) {
38910         ++i;
38911
38912         if (i >= iz) {
38913           return false;
38914         }
38915
38916         lowCh = id.charCodeAt(i);
38917
38918         if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
38919           return false;
38920         }
38921
38922         ch = decodeUtf16(ch, lowCh);
38923       }
38924
38925       if (!check(ch)) {
38926         return false;
38927       }
38928
38929       check = code$1.isIdentifierPartES6;
38930     }
38931
38932     return true;
38933   }
38934
38935   function isIdentifierES5(id, strict) {
38936     return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
38937   }
38938
38939   function isIdentifierES6(id, strict) {
38940     return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
38941   }
38942
38943   keyword.exports = {
38944     isKeywordES5: isKeywordES5,
38945     isKeywordES6: isKeywordES6,
38946     isReservedWordES5: isReservedWordES5,
38947     isReservedWordES6: isReservedWordES6,
38948     isRestrictedWord: isRestrictedWord,
38949     isIdentifierNameES5: isIdentifierNameES5,
38950     isIdentifierNameES6: isIdentifierNameES6,
38951     isIdentifierES5: isIdentifierES5,
38952     isIdentifierES6: isIdentifierES6
38953   };
38954 })();
38955
38956 /*
38957   Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
38958
38959   Redistribution and use in source and binary forms, with or without
38960   modification, are permitted provided that the following conditions are met:
38961
38962     * Redistributions of source code must retain the above copyright
38963       notice, this list of conditions and the following disclaimer.
38964     * Redistributions in binary form must reproduce the above copyright
38965       notice, this list of conditions and the following disclaimer in the
38966       documentation and/or other materials provided with the distribution.
38967
38968   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38969   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38970   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38971   ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
38972   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38973   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38974   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38975   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38976   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
38977   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38978 */
38979
38980 (function () {
38981
38982   utils$6.ast = ast.exports;
38983   utils$6.code = code.exports;
38984   utils$6.keyword = keyword.exports;
38985 })();
38986
38987 const isIdentifierName = utils$6.keyword.isIdentifierNameES5;
38988 const {
38989   getLast: getLast$l,
38990   hasNewline: hasNewline$7,
38991   skipWhitespace,
38992   isNonEmptyArray: isNonEmptyArray$h,
38993   isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex$1,
38994   getStringWidth: getStringWidth$3
38995 } = util$8;
38996 const {
38997   locStart: locStart$q,
38998   locEnd: locEnd$p,
38999   hasSameLocStart
39000 } = loc$6;
39001 /**
39002  * @typedef {import("./types/estree").Node} Node
39003  * @typedef {import("./types/estree").TemplateLiteral} TemplateLiteral
39004  * @typedef {import("./types/estree").Comment} Comment
39005  * @typedef {import("./types/estree").MemberExpression} MemberExpression
39006  * @typedef {import("./types/estree").OptionalMemberExpression} OptionalMemberExpression
39007  * @typedef {import("./types/estree").CallExpression} CallExpression
39008  * @typedef {import("./types/estree").OptionalCallExpression} OptionalCallExpression
39009  * @typedef {import("./types/estree").Expression} Expression
39010  * @typedef {import("./types/estree").Property} Property
39011  * @typedef {import("./types/estree").ObjectTypeProperty} ObjectTypeProperty
39012  * @typedef {import("./types/estree").TaggedTemplateExpression} TaggedTemplateExpression
39013  * @typedef {import("./types/estree").Literal} Literal
39014  *
39015  * @typedef {import("../common/ast-path")} AstPath
39016  */
39017 // We match any whitespace except line terminators because
39018 // Flow annotation comments cannot be split across lines. For example:
39019 //
39020 // (this /*
39021 // : any */).foo = 5;
39022 //
39023 // is not picked up by Flow (see https://github.com/facebook/flow/issues/7050), so
39024 // removing the newline would create a type annotation that the user did not intend
39025 // to create.
39026
39027 const NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
39028 const FLOW_SHORTHAND_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*:`);
39029 const FLOW_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*::`);
39030 /**
39031  * @param {Node} node
39032  * @returns {boolean}
39033  */
39034
39035 function hasFlowShorthandAnnotationComment$3(node) {
39036   // https://flow.org/en/docs/types/comments/
39037   // Syntax example: const r = new (window.Request /*: Class<Request> */)("");
39038   return node.extra && node.extra.parenthesized && isNonEmptyArray$h(node.trailingComments) && isBlockComment$5(node.trailingComments[0]) && FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value);
39039 }
39040 /**
39041  * @param {Comment[]} comments
39042  * @returns {boolean}
39043  */
39044
39045
39046 function hasFlowAnnotationComment$2(comments) {
39047   return isNonEmptyArray$h(comments) && isBlockComment$5(comments[0]) && FLOW_ANNOTATION.test(comments[0].value);
39048 }
39049 /**
39050  * @param {Node} node
39051  * @param {(Node) => boolean} fn
39052  * @returns {boolean}
39053  */
39054
39055
39056 function hasNode$2(node, fn) {
39057   if (!node || typeof node !== "object") {
39058     return false;
39059   }
39060
39061   if (Array.isArray(node)) {
39062     return node.some(value => hasNode$2(value, fn));
39063   }
39064
39065   const result = fn(node);
39066   return typeof result === "boolean" ? result : Object.values(node).some(value => hasNode$2(value, fn));
39067 }
39068 /**
39069  * @param {Node} node
39070  * @returns {boolean}
39071  */
39072
39073
39074 function hasNakedLeftSide$3(node) {
39075   return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || isCallExpression$d(node) || isMemberExpression$a(node) || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSAsExpression" || node.type === "TSNonNullExpression";
39076 }
39077
39078 function getLeftSide$1(node) {
39079   if (node.expressions) {
39080     return node.expressions[0];
39081   }
39082
39083   return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
39084 }
39085
39086 function getLeftSidePathName$2(path, node) {
39087   if (node.expressions) {
39088     return ["expressions", 0];
39089   }
39090
39091   if (node.left) {
39092     return ["left"];
39093   }
39094
39095   if (node.test) {
39096     return ["test"];
39097   }
39098
39099   if (node.object) {
39100     return ["object"];
39101   }
39102
39103   if (node.callee) {
39104     return ["callee"];
39105   }
39106
39107   if (node.tag) {
39108     return ["tag"];
39109   }
39110
39111   if (node.argument) {
39112     return ["argument"];
39113   }
39114
39115   if (node.expression) {
39116     return ["expression"];
39117   }
39118
39119   throw new Error("Unexpected node has no left side.");
39120 }
39121 /**
39122  * @param {Comment} comment
39123  * @returns {boolean}
39124  */
39125
39126
39127 function isBlockComment$5(comment) {
39128   return comment.type === "Block" || comment.type === "CommentBlock" || // `meriyah`
39129   comment.type === "MultiLine";
39130 }
39131 /**
39132  * @param {Comment} comment
39133  * @returns {boolean}
39134  */
39135
39136
39137 function isLineComment$3(comment) {
39138   return comment.type === "Line" || comment.type === "CommentLine" || // `meriyah` has `SingleLine`, `HashbangComment`, `HTMLOpen`, and `HTMLClose`
39139   comment.type === "SingleLine" || comment.type === "HashbangComment" || comment.type === "HTMLOpen" || comment.type === "HTMLClose";
39140 }
39141
39142 const exportDeclarationTypes = new Set(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
39143 /**
39144  * @param {Node} node
39145  * @returns {boolean}
39146  */
39147
39148 function isExportDeclaration(node) {
39149   return node && exportDeclarationTypes.has(node.type);
39150 }
39151 /**
39152  * @param {AstPath} path
39153  * @returns {Node | null}
39154  */
39155
39156
39157 function getParentExportDeclaration$2(path) {
39158   const parentNode = path.getParentNode();
39159
39160   if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
39161     return parentNode;
39162   }
39163
39164   return null;
39165 }
39166 /**
39167  * @param {Node} node
39168  * @returns {boolean}
39169  */
39170
39171
39172 function isLiteral$3(node) {
39173   return node.type === "BooleanLiteral" || node.type === "DirectiveLiteral" || node.type === "Literal" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "BigIntLiteral" || node.type === "DecimalLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "TemplateLiteral" || node.type === "TSTypeLiteral" || node.type === "JSXText";
39174 }
39175 /**
39176  * @param {Node} node
39177  * @returns {boolean}
39178  */
39179
39180
39181 function isNumericLiteral$5(node) {
39182   return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
39183 }
39184
39185 function isSignedNumericLiteral$2(node) {
39186   return node.type === "UnaryExpression" && (node.operator === "+" || node.operator === "-") && isNumericLiteral$5(node.argument);
39187 }
39188 /**
39189  * @param {Node} node
39190  * @returns {boolean}
39191  */
39192
39193
39194 function isStringLiteral$5(node) {
39195   return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
39196 }
39197 /**
39198  * @param {Node} node
39199  * @returns {boolean}
39200  */
39201
39202
39203 function isObjectType$3(node) {
39204   return node.type === "ObjectTypeAnnotation" || node.type === "TSTypeLiteral" || node.type === "TSMappedType";
39205 }
39206 /**
39207  * @param {Node} node
39208  * @returns {boolean}
39209  */
39210
39211
39212 function isFunctionOrArrowExpression$1(node) {
39213   return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
39214 }
39215 /**
39216  * @param {Node} node
39217  * @returns {boolean}
39218  */
39219
39220
39221 function isFunctionOrArrowExpressionWithBody(node) {
39222   return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
39223 }
39224 /**
39225  * @param {Node} node
39226  * @returns {boolean}
39227  */
39228
39229
39230 function isTemplateLiteral(node) {
39231   return node.type === "TemplateLiteral";
39232 }
39233 /**
39234  * Note: `inject` is used in AngularJS 1.x, `async` in Angular 2+
39235  * example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
39236  *
39237  * @param {CallExpression} node
39238  * @returns {boolean}
39239  */
39240
39241
39242 function isAngularTestWrapper(node) {
39243   return isCallExpression$d(node) && node.callee.type === "Identifier" && (node.callee.name === "async" || node.callee.name === "inject" || node.callee.name === "fakeAsync");
39244 }
39245 /**
39246  * @param {Node} node
39247  * @returns {boolean}
39248  */
39249
39250
39251 function isJsxNode$7(node) {
39252   return node.type === "JSXElement" || node.type === "JSXFragment";
39253 }
39254
39255 function isTheOnlyJsxElementInMarkdown$2(options, path) {
39256   if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
39257     return false;
39258   }
39259
39260   const node = path.getNode();
39261
39262   if (!node.expression || !isJsxNode$7(node.expression)) {
39263     return false;
39264   }
39265
39266   const parent = path.getParentNode();
39267   return parent.type === "Program" && parent.body.length === 1;
39268 }
39269
39270 function isGetterOrSetter$1(node) {
39271   return node.kind === "get" || node.kind === "set";
39272 } // TODO: This is a bad hack and we need a better way to distinguish between
39273 // arrow functions and otherwise
39274
39275
39276 function isFunctionNotation$1(node) {
39277   return isGetterOrSetter$1(node) || hasSameLocStart(node, node.value);
39278 } // Hack to differentiate between the following two which have the same ast
39279 // type T = { method: () => void };
39280 // type T = { method(): void };
39281
39282 /**
39283  * @param {Node} node
39284  * @returns {boolean}
39285  */
39286
39287
39288 function isObjectTypePropertyAFunction$2(node) {
39289   return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation$1(node);
39290 } // Hack to differentiate between the following two which have the same ast
39291 // declare function f(a): void;
39292 // var f: (a) => void;
39293
39294
39295 function isTypeAnnotationAFunction$1(node) {
39296   return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !hasSameLocStart(node, node.typeAnnotation);
39297 }
39298
39299 const binaryishNodeTypes = new Set(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
39300 /**
39301  * @param {Node} node
39302  * @returns {boolean}
39303  */
39304
39305 function isBinaryish$5(node) {
39306   return binaryishNodeTypes.has(node.type);
39307 }
39308 /**
39309  * @param {Node} node
39310  * @returns {boolean}
39311  */
39312
39313
39314 function isMemberish$2(node) {
39315   return isMemberExpression$a(node) || node.type === "BindExpression" && Boolean(node.object);
39316 }
39317
39318 const simpleTypeAnnotations = new Set([// `any`
39319 "AnyTypeAnnotation", "TSAnyKeyword", // `null`
39320 "NullLiteralTypeAnnotation", "TSNullKeyword", // `this`
39321 "ThisTypeAnnotation", "TSThisType", // `number`
39322 "NumberTypeAnnotation", "TSNumberKeyword", // `void`
39323 "VoidTypeAnnotation", "TSVoidKeyword", // `boolean`
39324 "BooleanTypeAnnotation", "TSBooleanKeyword", // `bigint`
39325 "BigIntTypeAnnotation", "TSBigIntKeyword", // `symbol`
39326 "SymbolTypeAnnotation", "TSSymbolKeyword", // `string`
39327 "StringTypeAnnotation", "TSStringKeyword", // literals
39328 "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType", // flow only, `empty`, `mixed`
39329 "EmptyTypeAnnotation", "MixedTypeAnnotation", // typescript only, `never`, `object`, `undefined`, `unknown`
39330 "TSNeverKeyword", "TSObjectKeyword", "TSUndefinedKeyword", "TSUnknownKeyword"]);
39331 /**
39332  * @param {Node} node
39333  * @returns {boolean}
39334  */
39335
39336 function isSimpleType$2(node) {
39337   if (!node) {
39338     return false;
39339   }
39340
39341   if ((node.type === "GenericTypeAnnotation" || node.type === "TSTypeReference") && !node.typeParameters) {
39342     return true;
39343   }
39344
39345   if (simpleTypeAnnotations.has(node.type)) {
39346     return true;
39347   }
39348
39349   return false;
39350 }
39351
39352 const unitTestRe = /^(?:skip|[fx]?(?:it|describe|test))$/;
39353 /**
39354  * @param {{callee: MemberExpression | OptionalMemberExpression}} node
39355  * @returns {boolean}
39356  */
39357
39358 function isSkipOrOnlyBlock(node) {
39359   return isMemberExpression$a(node.callee) && node.callee.object.type === "Identifier" && node.callee.property.type === "Identifier" && unitTestRe.test(node.callee.object.name) && (node.callee.property.name === "only" || node.callee.property.name === "skip");
39360 }
39361 /**
39362  * @param {CallExpression} node
39363  * @returns {boolean}
39364  */
39365
39366
39367 function isUnitTestSetUp(node) {
39368   const unitTestSetUpRe = /^(?:before|after)(?:Each|All)$/;
39369   return node.callee.type === "Identifier" && unitTestSetUpRe.test(node.callee.name) && node.arguments.length === 1;
39370 } // eg; `describe("some string", (done) => {})`
39371
39372
39373 function isTestCall$3(node, parent) {
39374   if (node.type !== "CallExpression") {
39375     return false;
39376   }
39377
39378   if (node.arguments.length === 1) {
39379     if (isAngularTestWrapper(node) && parent && isTestCall$3(parent)) {
39380       return isFunctionOrArrowExpression$1(node.arguments[0]);
39381     }
39382
39383     if (isUnitTestSetUp(node)) {
39384       return isAngularTestWrapper(node.arguments[0]);
39385     }
39386   } else if (node.arguments.length === 2 || node.arguments.length === 3) {
39387     if ((node.callee.type === "Identifier" && unitTestRe.test(node.callee.name) || isSkipOrOnlyBlock(node)) && (isTemplateLiteral(node.arguments[0]) || isStringLiteral$5(node.arguments[0]))) {
39388       // it("name", () => { ... }, 2500)
39389       if (node.arguments[2] && !isNumericLiteral$5(node.arguments[2])) {
39390         return false;
39391       }
39392
39393       return (node.arguments.length === 2 ? isFunctionOrArrowExpression$1(node.arguments[1]) : isFunctionOrArrowExpressionWithBody(node.arguments[1]) && getFunctionParameters$6(node.arguments[1]).length <= 1) || isAngularTestWrapper(node.arguments[1]);
39394     }
39395   }
39396
39397   return false;
39398 }
39399 /**
39400  * @param {Node} node
39401  * @returns {boolean}
39402  */
39403
39404
39405 function isCallExpression$d(node) {
39406   return node && (node.type === "CallExpression" || node.type === "OptionalCallExpression");
39407 }
39408 /**
39409  * @param {Node} node
39410  * @returns {boolean}
39411  */
39412
39413
39414 function isMemberExpression$a(node) {
39415   return node && (node.type === "MemberExpression" || node.type === "OptionalMemberExpression");
39416 }
39417 /**
39418  *
39419  * @param {any} node
39420  * @returns {boolean}
39421  */
39422
39423
39424 function isSimpleTemplateLiteral$1(node) {
39425   let expressionsKey = "expressions";
39426
39427   if (node.type === "TSTemplateLiteralType") {
39428     expressionsKey = "types";
39429   }
39430
39431   const expressions = node[expressionsKey];
39432
39433   if (expressions.length === 0) {
39434     return false;
39435   }
39436
39437   return expressions.every(expr => {
39438     // Disallow comments since printDocToString can't print them here
39439     if (hasComment$j(expr)) {
39440       return false;
39441     } // Allow `x` and `this`
39442
39443
39444     if (expr.type === "Identifier" || expr.type === "ThisExpression") {
39445       return true;
39446     } // Allow `a.b.c`, `a.b[c]`, and `this.x.y`
39447
39448
39449     if (isMemberExpression$a(expr)) {
39450       let head = expr;
39451
39452       while (isMemberExpression$a(head)) {
39453         if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
39454           return false;
39455         }
39456
39457         head = head.object;
39458
39459         if (hasComment$j(head)) {
39460           return false;
39461         }
39462       }
39463
39464       if (head.type === "Identifier" || head.type === "ThisExpression") {
39465         return true;
39466       }
39467
39468       return false;
39469     }
39470
39471     return false;
39472   });
39473 }
39474 /**
39475  * @param {string} tokenNode
39476  * @param {string} keyword
39477  * @returns {string}
39478  */
39479
39480
39481 function getTypeScriptMappedTypeModifier$1(tokenNode, keyword) {
39482   if (tokenNode === "+") {
39483     return "+" + keyword;
39484   }
39485
39486   if (tokenNode === "-") {
39487     return "-" + keyword;
39488   }
39489
39490   return keyword;
39491 }
39492 /**
39493  * @param {string} text
39494  * @param {Node} typeAnnotation
39495  * @returns {boolean}
39496  */
39497
39498
39499 function isFlowAnnotationComment$2(text, typeAnnotation) {
39500   const start = locStart$q(typeAnnotation);
39501   const end = skipWhitespace(text, locEnd$p(typeAnnotation));
39502   return end !== false && text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
39503 }
39504 /**
39505  * @param {string} text
39506  * @param {Node} node
39507  * @returns {boolean}
39508  */
39509
39510
39511 function hasLeadingOwnLineComment$4(text, node) {
39512   if (isJsxNode$7(node)) {
39513     return hasNodeIgnoreComment$1(node);
39514   }
39515
39516   return hasComment$j(node, CommentCheckFlags$g.Leading, comment => hasNewline$7(text, locEnd$p(comment)));
39517 } // Note: Quoting/unquoting numbers in TypeScript is not safe.
39518 //
39519 // let a = { 1: 1, 2: 2 }
39520 // let b = { '1': 1, '2': 2 }
39521 //
39522 // declare let aa: keyof typeof a;
39523 // declare let bb: keyof typeof b;
39524 //
39525 // aa = bb;
39526 // ^^
39527 // Type '"1" | "2"' is not assignable to type '1 | 2'.
39528 //   Type '"1"' is not assignable to type '1 | 2'.(2322)
39529 //
39530 // And in Flow, you get:
39531 //
39532 // const x = {
39533 //   0: 1
39534 //   ^ Non-string literal property keys not supported. [unsupported-syntax]
39535 // }
39536 //
39537 // Angular does not support unquoted numbers in expressions.
39538 //
39539 // So we play it safe and only unquote numbers for the JavaScript parsers.
39540 // (Vue supports unquoted numbers in expressions, but let’s keep it simple.)
39541 //
39542 // Identifiers can be unquoted in more circumstances, though.
39543
39544
39545 function isStringPropSafeToUnquote$1(node, options) {
39546   return options.parser !== "json" && isStringLiteral$5(node.key) && rawText$5(node.key).slice(1, -1) === node.key.value && (isIdentifierName(node.key.value) && // With `--strictPropertyInitialization`, TS treats properties with quoted names differently than unquoted ones.
39547   // See https://github.com/microsoft/TypeScript/pull/20075
39548   !(options.parser === "babel-ts" && node.type === "ClassProperty" || options.parser === "typescript" && node.type === "PropertyDefinition") || isSimpleNumber$1(node.key.value) && String(Number(node.key.value)) === node.key.value && (options.parser === "babel" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree"));
39549 } // Matches “simple” numbers like `123` and `2.5` but not `1_000`, `1e+100` or `0b10`.
39550
39551
39552 function isSimpleNumber$1(numberString) {
39553   return /^(?:\d+|\d+\.\d+)$/.test(numberString);
39554 }
39555 /**
39556  * @param {Node} node
39557  * @param {Node} parentNode
39558  * @returns {boolean}
39559  */
39560
39561
39562 function isJestEachTemplateLiteral$1(node, parentNode) {
39563   /**
39564    * describe.each`table`(name, fn)
39565    * describe.only.each`table`(name, fn)
39566    * describe.skip.each`table`(name, fn)
39567    * test.each`table`(name, fn)
39568    * test.only.each`table`(name, fn)
39569    * test.skip.each`table`(name, fn)
39570    *
39571    * Ref: https://github.com/facebook/jest/pull/6102
39572    */
39573   const jestEachTriggerRegex = /^[fx]?(?:describe|it|test)$/;
39574   return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name));
39575 }
39576 /**
39577  * @param {TemplateLiteral} template
39578  * @returns {boolean}
39579  */
39580
39581
39582 function templateLiteralHasNewLines(template) {
39583   return template.quasis.some(quasi => quasi.value.raw.includes("\n"));
39584 }
39585 /**
39586  * @param {TemplateLiteral | TaggedTemplateExpression} node
39587  * @param {string} text
39588  * @returns {boolean}
39589  */
39590
39591
39592 function isTemplateOnItsOwnLine$2(node, text) {
39593   return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline$7(text, locStart$q(node), {
39594     backwards: true
39595   });
39596 }
39597 /**
39598  * @param {Node} node
39599  * @returns {boolean}
39600  */
39601
39602
39603 function needsHardlineAfterDanglingComment$2(node) {
39604   if (!hasComment$j(node)) {
39605     return false;
39606   }
39607
39608   const lastDanglingComment = getLast$l(getComments$5(node, CommentCheckFlags$g.Dangling));
39609   return lastDanglingComment && !isBlockComment$5(lastDanglingComment);
39610 } // Logic to check for args with multiple anonymous functions. For instance,
39611 // the following call should be split on multiple lines for readability:
39612 // source.pipe(map((x) => x + x), filter((x) => x % 2 === 0))
39613
39614
39615 function isFunctionCompositionArgs$1(args) {
39616   if (args.length <= 1) {
39617     return false;
39618   }
39619
39620   let count = 0;
39621
39622   for (const arg of args) {
39623     if (isFunctionOrArrowExpression$1(arg)) {
39624       count += 1;
39625
39626       if (count > 1) {
39627         return true;
39628       }
39629     } else if (isCallExpression$d(arg)) {
39630       for (const childArg of arg.arguments) {
39631         if (isFunctionOrArrowExpression$1(childArg)) {
39632           return true;
39633         }
39634       }
39635     }
39636   }
39637
39638   return false;
39639 } // Logic to determine if a call is a “long curried function call”.
39640 // See https://github.com/prettier/prettier/issues/1420.
39641 //
39642 // `connect(a, b, c)(d)`
39643 // In the above call expression, the second call is the parent node and the
39644 // first call is the current node.
39645
39646 /**
39647  * @param {AstPath} path
39648  * @returns {boolean}
39649  */
39650
39651
39652 function isLongCurriedCallExpression$2(path) {
39653   const node = path.getValue();
39654   const parent = path.getParentNode();
39655   return isCallExpression$d(node) && isCallExpression$d(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
39656 }
39657 /**
39658  * @param {any} node
39659  * @param {number} depth
39660  * @returns {boolean}
39661  */
39662
39663
39664 function isSimpleCallArgument$1(node, depth) {
39665   if (depth >= 2) {
39666     return false;
39667   }
39668
39669   const isChildSimple = child => isSimpleCallArgument$1(child, depth + 1);
39670
39671   const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
39672
39673   if (regexpPattern && getStringWidth$3(regexpPattern) > 5) {
39674     return false;
39675   }
39676
39677   if (node.type === "Literal" || node.type === "BigIntLiteral" || node.type === "DecimalLiteral" || node.type === "BooleanLiteral" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "Identifier" || node.type === "ThisExpression" || node.type === "Super" || node.type === "PrivateName" || node.type === "PrivateIdentifier" || node.type === "ArgumentPlaceholder" || node.type === "Import") {
39678     return true;
39679   }
39680
39681   if (node.type === "TemplateLiteral") {
39682     return node.quasis.every(element => !element.value.raw.includes("\n")) && node.expressions.every(isChildSimple);
39683   }
39684
39685   if (node.type === "ObjectExpression") {
39686     return node.properties.every(p => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
39687   }
39688
39689   if (node.type === "ArrayExpression") {
39690     return node.elements.every(x => x === null || isChildSimple(x));
39691   }
39692
39693   if (isCallLikeExpression$2(node)) {
39694     return (node.type === "ImportExpression" || isSimpleCallArgument$1(node.callee, depth)) && getCallArguments$5(node).every(isChildSimple);
39695   }
39696
39697   if (isMemberExpression$a(node)) {
39698     return isSimpleCallArgument$1(node.object, depth) && isSimpleCallArgument$1(node.property, depth);
39699   }
39700
39701   if (node.type === "UnaryExpression" && (node.operator === "!" || node.operator === "-")) {
39702     return isSimpleCallArgument$1(node.argument, depth);
39703   }
39704
39705   if (node.type === "TSNonNullExpression") {
39706     return isSimpleCallArgument$1(node.expression, depth);
39707   }
39708
39709   return false;
39710 }
39711
39712 function rawText$5(node) {
39713   return node.extra ? node.extra.raw : node.raw;
39714 }
39715
39716 function identity$1(x) {
39717   return x;
39718 }
39719
39720 function isTSXFile$1(options) {
39721   return options.filepath && /\.tsx$/i.test(options.filepath);
39722 }
39723 /**
39724  * @param {any} options
39725  * @param {("es5" | "all")} [level]
39726  * @returns {boolean}
39727  */
39728
39729
39730 function shouldPrintComma$b(options, level = "es5") {
39731   return options.trailingComma === "es5" && level === "es5" || options.trailingComma === "all" && (level === "all" || level === "es5");
39732 }
39733 /**
39734  * Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr
39735  * holds) `function`, `class`, or `do {}`. Will be overzealous if there's
39736  * already necessary grouping parentheses.
39737  *
39738  * @param {Node} node
39739  * @param {boolean} forbidFunctionClassAndDoExpr
39740  * @returns {boolean}
39741  */
39742
39743
39744 function startsWithNoLookaheadToken$2(node, forbidFunctionClassAndDoExpr) {
39745   node = getLeftMost(node);
39746
39747   switch (node.type) {
39748     case "FunctionExpression":
39749     case "ClassExpression":
39750     case "DoExpression":
39751       return forbidFunctionClassAndDoExpr;
39752
39753     case "ObjectExpression":
39754       return true;
39755
39756     case "MemberExpression":
39757     case "OptionalMemberExpression":
39758       return startsWithNoLookaheadToken$2(node.object, forbidFunctionClassAndDoExpr);
39759
39760     case "TaggedTemplateExpression":
39761       if (node.tag.type === "FunctionExpression") {
39762         // IIFEs are always already parenthesized
39763         return false;
39764       }
39765
39766       return startsWithNoLookaheadToken$2(node.tag, forbidFunctionClassAndDoExpr);
39767
39768     case "CallExpression":
39769     case "OptionalCallExpression":
39770       if (node.callee.type === "FunctionExpression") {
39771         // IIFEs are always already parenthesized
39772         return false;
39773       }
39774
39775       return startsWithNoLookaheadToken$2(node.callee, forbidFunctionClassAndDoExpr);
39776
39777     case "ConditionalExpression":
39778       return startsWithNoLookaheadToken$2(node.test, forbidFunctionClassAndDoExpr);
39779
39780     case "UpdateExpression":
39781       return !node.prefix && startsWithNoLookaheadToken$2(node.argument, forbidFunctionClassAndDoExpr);
39782
39783     case "BindExpression":
39784       return node.object && startsWithNoLookaheadToken$2(node.object, forbidFunctionClassAndDoExpr);
39785
39786     case "SequenceExpression":
39787       return startsWithNoLookaheadToken$2(node.expressions[0], forbidFunctionClassAndDoExpr);
39788
39789     case "TSAsExpression":
39790     case "TSNonNullExpression":
39791       return startsWithNoLookaheadToken$2(node.expression, forbidFunctionClassAndDoExpr);
39792
39793     default:
39794       return false;
39795   }
39796 }
39797
39798 const equalityOperators = {
39799   "==": true,
39800   "!=": true,
39801   "===": true,
39802   "!==": true
39803 };
39804 const multiplicativeOperators = {
39805   "*": true,
39806   "/": true,
39807   "%": true
39808 };
39809 const bitshiftOperators = {
39810   ">>": true,
39811   ">>>": true,
39812   "<<": true
39813 };
39814
39815 function shouldFlatten$2(parentOp, nodeOp) {
39816   if (getPrecedence$1(nodeOp) !== getPrecedence$1(parentOp)) {
39817     return false;
39818   } // ** is right-associative
39819   // x ** y ** z --> x ** (y ** z)
39820
39821
39822   if (parentOp === "**") {
39823     return false;
39824   } // x == y == z --> (x == y) == z
39825
39826
39827   if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
39828     return false;
39829   } // x * y % z --> (x * y) % z
39830
39831
39832   if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
39833     return false;
39834   } // x * y / z --> (x * y) / z
39835   // x / y * z --> (x / y) * z
39836
39837
39838   if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
39839     return false;
39840   } // x << y << z --> (x << y) << z
39841
39842
39843   if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
39844     return false;
39845   }
39846
39847   return true;
39848 }
39849
39850 const PRECEDENCE = {};
39851
39852 for (const [i, tier] of [["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].entries()) {
39853   for (const op of tier) {
39854     PRECEDENCE[op] = i;
39855   }
39856 }
39857
39858 function getPrecedence$1(op) {
39859   return PRECEDENCE[op];
39860 }
39861
39862 function getLeftMost(node) {
39863   while (node.left) {
39864     node = node.left;
39865   }
39866
39867   return node;
39868 }
39869
39870 function isBitwiseOperator$1(operator) {
39871   return Boolean(bitshiftOperators[operator]) || operator === "|" || operator === "^" || operator === "&";
39872 }
39873
39874 function hasRestParameter$1(node) {
39875   if (node.rest) {
39876     return true;
39877   }
39878
39879   const parameters = getFunctionParameters$6(node);
39880   return parameters.length > 0 && getLast$l(parameters).type === "RestElement";
39881 }
39882
39883 const functionParametersCache = new WeakMap();
39884
39885 function getFunctionParameters$6(node) {
39886   if (functionParametersCache.has(node)) {
39887     return functionParametersCache.get(node);
39888   }
39889
39890   const parameters = [];
39891
39892   if (node.this) {
39893     parameters.push(node.this);
39894   } // `params` vs `parameters` - see https://github.com/babel/babel/issues/9231
39895
39896
39897   if (Array.isArray(node.parameters)) {
39898     parameters.push(...node.parameters);
39899   } else if (Array.isArray(node.params)) {
39900     parameters.push(...node.params);
39901   }
39902
39903   if (node.rest) {
39904     parameters.push(node.rest);
39905   }
39906
39907   functionParametersCache.set(node, parameters);
39908   return parameters;
39909 }
39910
39911 function iterateFunctionParametersPath$1(path, iteratee) {
39912   const node = path.getValue();
39913   let index = 0;
39914
39915   const callback = childPath => iteratee(childPath, index++);
39916
39917   if (node.this) {
39918     path.call(callback, "this");
39919   }
39920
39921   if (Array.isArray(node.parameters)) {
39922     path.each(callback, "parameters");
39923   } else if (Array.isArray(node.params)) {
39924     path.each(callback, "params");
39925   }
39926
39927   if (node.rest) {
39928     path.call(callback, "rest");
39929   }
39930 }
39931
39932 const callArgumentsCache = new WeakMap();
39933
39934 function getCallArguments$5(node) {
39935   if (callArgumentsCache.has(node)) {
39936     return callArgumentsCache.get(node);
39937   }
39938
39939   let args = node.arguments;
39940
39941   if (node.type === "ImportExpression") {
39942     args = [node.source];
39943
39944     if (node.attributes) {
39945       args.push(node.attributes);
39946     }
39947   }
39948
39949   callArgumentsCache.set(node, args);
39950   return args;
39951 }
39952
39953 function iterateCallArgumentsPath$2(path, iteratee) {
39954   const node = path.getValue();
39955
39956   if (node.type === "ImportExpression") {
39957     path.call(sourcePath => iteratee(sourcePath, 0), "source");
39958
39959     if (node.attributes) {
39960       path.call(sourcePath => iteratee(sourcePath, 1), "attributes");
39961     }
39962   } else {
39963     path.each(iteratee, "arguments");
39964   }
39965 }
39966
39967 function isPrettierIgnoreComment$1(comment) {
39968   return comment.value.trim() === "prettier-ignore" && !comment.unignore;
39969 }
39970
39971 function hasNodeIgnoreComment$1(node) {
39972   return node && (node.prettierIgnore || hasComment$j(node, CommentCheckFlags$g.PrettierIgnore));
39973 }
39974
39975 function hasIgnoreComment$2(path) {
39976   const node = path.getValue();
39977   return hasNodeIgnoreComment$1(node);
39978 }
39979
39980 const CommentCheckFlags$g = {
39981   /** Check comment is a leading comment */
39982   Leading: 1 << 1,
39983
39984   /** Check comment is a trailing comment */
39985   Trailing: 1 << 2,
39986
39987   /** Check comment is a dangling comment */
39988   Dangling: 1 << 3,
39989
39990   /** Check comment is a block comment */
39991   Block: 1 << 4,
39992
39993   /** Check comment is a line comment */
39994   Line: 1 << 5,
39995
39996   /** Check comment is a `prettier-ignore` comment */
39997   PrettierIgnore: 1 << 6,
39998
39999   /** Check comment is the first attached comment */
40000   First: 1 << 7,
40001
40002   /** Check comment is the last attached comment */
40003   Last: 1 << 8
40004 };
40005
40006 const getCommentTestFunction = (flags, fn) => {
40007   if (typeof flags === "function") {
40008     fn = flags;
40009     flags = 0;
40010   }
40011
40012   if (flags || fn) {
40013     return (comment, index, comments) => !(flags & CommentCheckFlags$g.Leading && !comment.leading || flags & CommentCheckFlags$g.Trailing && !comment.trailing || flags & CommentCheckFlags$g.Dangling && (comment.leading || comment.trailing) || flags & CommentCheckFlags$g.Block && !isBlockComment$5(comment) || flags & CommentCheckFlags$g.Line && !isLineComment$3(comment) || flags & CommentCheckFlags$g.First && index !== 0 || flags & CommentCheckFlags$g.Last && index !== comments.length - 1 || flags & CommentCheckFlags$g.PrettierIgnore && !isPrettierIgnoreComment$1(comment) || fn && !fn(comment));
40014   }
40015 };
40016 /**
40017  * @param {Node} node
40018  * @param {number | function} [flags]
40019  * @param {function} [fn]
40020  * @returns {boolean}
40021  */
40022
40023
40024 function hasComment$j(node, flags, fn) {
40025   if (!node || !isNonEmptyArray$h(node.comments)) {
40026     return false;
40027   }
40028
40029   const test = getCommentTestFunction(flags, fn);
40030   return test ? node.comments.some(test) : true;
40031 }
40032 /**
40033  * @param {Node} node
40034  * @param {number | function} [flags]
40035  * @param {function} [fn]
40036  * @returns {Comment[]}
40037  */
40038
40039
40040 function getComments$5(node, flags, fn) {
40041   if (!node || !Array.isArray(node.comments)) {
40042     return [];
40043   }
40044
40045   const test = getCommentTestFunction(flags, fn);
40046   return test ? node.comments.filter(test) : node.comments;
40047 }
40048 /**
40049  * @param {Node} node
40050  * @returns {boolean}
40051  */
40052
40053
40054 const isNextLineEmpty$c = (node, {
40055   originalText
40056 }) => isNextLineEmptyAfterIndex$1(originalText, locEnd$p(node));
40057
40058 function isCallLikeExpression$2(node) {
40059   return isCallExpression$d(node) || node.type === "NewExpression" || node.type === "ImportExpression";
40060 }
40061
40062 function isObjectProperty$6(node) {
40063   return node && (node.type === "ObjectProperty" || node.type === "Property" && !node.method && node.kind === "init");
40064 }
40065
40066 function isEnabledHackPipeline$1(options) {
40067   return Boolean(options.__isUsingHackPipeline);
40068 }
40069
40070 var utils$5 = {
40071   getFunctionParameters: getFunctionParameters$6,
40072   iterateFunctionParametersPath: iterateFunctionParametersPath$1,
40073   getCallArguments: getCallArguments$5,
40074   iterateCallArgumentsPath: iterateCallArgumentsPath$2,
40075   hasRestParameter: hasRestParameter$1,
40076   getLeftSide: getLeftSide$1,
40077   getLeftSidePathName: getLeftSidePathName$2,
40078   getParentExportDeclaration: getParentExportDeclaration$2,
40079   getTypeScriptMappedTypeModifier: getTypeScriptMappedTypeModifier$1,
40080   hasFlowAnnotationComment: hasFlowAnnotationComment$2,
40081   hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$3,
40082   hasLeadingOwnLineComment: hasLeadingOwnLineComment$4,
40083   hasNakedLeftSide: hasNakedLeftSide$3,
40084   hasNode: hasNode$2,
40085   hasIgnoreComment: hasIgnoreComment$2,
40086   hasNodeIgnoreComment: hasNodeIgnoreComment$1,
40087   identity: identity$1,
40088   isBinaryish: isBinaryish$5,
40089   isBlockComment: isBlockComment$5,
40090   isCallLikeExpression: isCallLikeExpression$2,
40091   isEnabledHackPipeline: isEnabledHackPipeline$1,
40092   isLineComment: isLineComment$3,
40093   isPrettierIgnoreComment: isPrettierIgnoreComment$1,
40094   isCallExpression: isCallExpression$d,
40095   isMemberExpression: isMemberExpression$a,
40096   isExportDeclaration,
40097   isFlowAnnotationComment: isFlowAnnotationComment$2,
40098   isFunctionCompositionArgs: isFunctionCompositionArgs$1,
40099   isFunctionNotation: isFunctionNotation$1,
40100   isFunctionOrArrowExpression: isFunctionOrArrowExpression$1,
40101   isGetterOrSetter: isGetterOrSetter$1,
40102   isJestEachTemplateLiteral: isJestEachTemplateLiteral$1,
40103   isJsxNode: isJsxNode$7,
40104   isLiteral: isLiteral$3,
40105   isLongCurriedCallExpression: isLongCurriedCallExpression$2,
40106   isSimpleCallArgument: isSimpleCallArgument$1,
40107   isMemberish: isMemberish$2,
40108   isNumericLiteral: isNumericLiteral$5,
40109   isSignedNumericLiteral: isSignedNumericLiteral$2,
40110   isObjectProperty: isObjectProperty$6,
40111   isObjectType: isObjectType$3,
40112   isObjectTypePropertyAFunction: isObjectTypePropertyAFunction$2,
40113   isSimpleType: isSimpleType$2,
40114   isSimpleNumber: isSimpleNumber$1,
40115   isSimpleTemplateLiteral: isSimpleTemplateLiteral$1,
40116   isStringLiteral: isStringLiteral$5,
40117   isStringPropSafeToUnquote: isStringPropSafeToUnquote$1,
40118   isTemplateOnItsOwnLine: isTemplateOnItsOwnLine$2,
40119   isTestCall: isTestCall$3,
40120   isTheOnlyJsxElementInMarkdown: isTheOnlyJsxElementInMarkdown$2,
40121   isTSXFile: isTSXFile$1,
40122   isTypeAnnotationAFunction: isTypeAnnotationAFunction$1,
40123   isNextLineEmpty: isNextLineEmpty$c,
40124   needsHardlineAfterDanglingComment: needsHardlineAfterDanglingComment$2,
40125   rawText: rawText$5,
40126   shouldPrintComma: shouldPrintComma$b,
40127   isBitwiseOperator: isBitwiseOperator$1,
40128   shouldFlatten: shouldFlatten$2,
40129   startsWithNoLookaheadToken: startsWithNoLookaheadToken$2,
40130   getPrecedence: getPrecedence$1,
40131   hasComment: hasComment$j,
40132   getComments: getComments$5,
40133   CommentCheckFlags: CommentCheckFlags$g
40134 };
40135
40136 const getLast$k = getLast_1;
40137 const {
40138   getStringWidth: getStringWidth$2,
40139   getIndentSize
40140 } = util$8;
40141 const {
40142   builders: {
40143     join: join$u,
40144     hardline: hardline$A,
40145     softline: softline$t,
40146     group: group$C,
40147     indent: indent$y,
40148     align: align$5,
40149     lineSuffixBoundary: lineSuffixBoundary$1,
40150     addAlignmentToDoc
40151   },
40152   printer: {
40153     printDocToString: printDocToString$1
40154   },
40155   utils: {
40156     mapDoc: mapDoc$3
40157   }
40158 } = require$$7$3;
40159 const {
40160   isBinaryish: isBinaryish$4,
40161   isJestEachTemplateLiteral,
40162   isSimpleTemplateLiteral,
40163   hasComment: hasComment$i,
40164   isMemberExpression: isMemberExpression$9
40165 } = utils$5;
40166
40167 function printTemplateLiteral$2(path, print, options) {
40168   const node = path.getValue();
40169   const isTemplateLiteral = node.type === "TemplateLiteral";
40170
40171   if (isTemplateLiteral && isJestEachTemplateLiteral(node, path.getParentNode())) {
40172     const printed = printJestEachTemplateLiteral(path, options, print);
40173
40174     if (printed) {
40175       return printed;
40176     }
40177   }
40178
40179   let expressionsKey = "expressions";
40180
40181   if (node.type === "TSTemplateLiteralType") {
40182     expressionsKey = "types";
40183   }
40184
40185   const parts = [];
40186   let expressions = path.map(print, expressionsKey);
40187   const isSimple = isSimpleTemplateLiteral(node);
40188
40189   if (isSimple) {
40190     expressions = expressions.map(doc => printDocToString$1(doc, Object.assign(Object.assign({}, options), {}, {
40191       printWidth: Number.POSITIVE_INFINITY
40192     })).formatted);
40193   }
40194
40195   parts.push(lineSuffixBoundary$1, "`");
40196   path.each(childPath => {
40197     const i = childPath.getName();
40198     parts.push(print());
40199
40200     if (i < expressions.length) {
40201       // For a template literal of the following form:
40202       //   `someQuery {
40203       //     ${call({
40204       //       a,
40205       //       b,
40206       //     })}
40207       //   }`
40208       // the expression is on its own line (there is a \n in the previous
40209       // quasi literal), therefore we want to indent the JavaScript
40210       // expression inside at the beginning of ${ instead of the beginning
40211       // of the `.
40212       const {
40213         tabWidth
40214       } = options;
40215       const quasi = childPath.getValue();
40216       const indentSize = getIndentSize(quasi.value.raw, tabWidth);
40217       let printed = expressions[i];
40218
40219       if (!isSimple) {
40220         const expression = node[expressionsKey][i]; // Breaks at the template element boundaries (${ and }) are preferred to breaking
40221         // in the middle of a MemberExpression
40222
40223         if (hasComment$i(expression) || isMemberExpression$9(expression) || expression.type === "ConditionalExpression" || expression.type === "SequenceExpression" || expression.type === "TSAsExpression" || isBinaryish$4(expression)) {
40224           printed = [indent$y([softline$t, printed]), softline$t];
40225         }
40226       }
40227
40228       const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$5(Number.NEGATIVE_INFINITY, printed) : addAlignmentToDoc(printed, indentSize, tabWidth);
40229       parts.push(group$C(["${", aligned, lineSuffixBoundary$1, "}"]));
40230     }
40231   }, "quasis");
40232   parts.push("`");
40233   return parts;
40234 }
40235
40236 function printJestEachTemplateLiteral(path, options, print) {
40237   /**
40238    * a    | b    | expected
40239    * ${1} | ${1} | ${2}
40240    * ${1} | ${2} | ${3}
40241    * ${2} | ${1} | ${3}
40242    */
40243   const node = path.getNode();
40244   const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
40245
40246   if (headerNames.length > 1 || headerNames.some(headerName => headerName.length > 0)) {
40247     options.__inJestEach = true;
40248     const expressions = path.map(print, "expressions");
40249     options.__inJestEach = false;
40250     const parts = [];
40251     const stringifiedExpressions = expressions.map(doc => "${" + printDocToString$1(doc, Object.assign(Object.assign({}, options), {}, {
40252       printWidth: Number.POSITIVE_INFINITY,
40253       endOfLine: "lf"
40254     })).formatted + "}");
40255     const tableBody = [{
40256       hasLineBreak: false,
40257       cells: []
40258     }];
40259
40260     for (let i = 1; i < node.quasis.length; i++) {
40261       const row = getLast$k(tableBody);
40262       const correspondingExpression = stringifiedExpressions[i - 1];
40263       row.cells.push(correspondingExpression);
40264
40265       if (correspondingExpression.includes("\n")) {
40266         row.hasLineBreak = true;
40267       }
40268
40269       if (node.quasis[i].value.raw.includes("\n")) {
40270         tableBody.push({
40271           hasLineBreak: false,
40272           cells: []
40273         });
40274       }
40275     }
40276
40277     const maxColumnCount = Math.max(headerNames.length, ...tableBody.map(row => row.cells.length));
40278     const maxColumnWidths = Array.from({
40279       length: maxColumnCount
40280     }).fill(0);
40281     const table = [{
40282       cells: headerNames
40283     }, ...tableBody.filter(row => row.cells.length > 0)];
40284
40285     for (const {
40286       cells
40287     } of table.filter(row => !row.hasLineBreak)) {
40288       for (const [index, cell] of cells.entries()) {
40289         maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
40290       }
40291     }
40292
40293     parts.push(lineSuffixBoundary$1, "`", indent$y([hardline$A, join$u(hardline$A, table.map(row => join$u(" | ", row.cells.map((cell, index) => row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell))))))]), hardline$A, "`");
40294     return parts;
40295   }
40296 }
40297
40298 function printTemplateExpression(path, print) {
40299   const node = path.getValue();
40300   let printed = print();
40301
40302   if (hasComment$i(node)) {
40303     printed = group$C([indent$y([softline$t, printed]), softline$t]);
40304   }
40305
40306   return ["${", printed, lineSuffixBoundary$1, "}"];
40307 }
40308
40309 function printTemplateExpressions$3(path, print) {
40310   return path.map(path => printTemplateExpression(path, print), "expressions");
40311 }
40312
40313 function escapeTemplateCharacters$2(doc, raw) {
40314   return mapDoc$3(doc, currentDoc => {
40315     if (typeof currentDoc === "string") {
40316       return raw ? currentDoc.replace(/(\\*)`/g, "$1$1\\`") : uncookTemplateElementValue$1(currentDoc);
40317     }
40318
40319     return currentDoc;
40320   });
40321 }
40322
40323 function uncookTemplateElementValue$1(cookedValue) {
40324   return cookedValue.replace(/([\\`]|\${)/g, "\\$1");
40325 }
40326
40327 var templateLiteral = {
40328   printTemplateLiteral: printTemplateLiteral$2,
40329   printTemplateExpressions: printTemplateExpressions$3,
40330   escapeTemplateCharacters: escapeTemplateCharacters$2,
40331   uncookTemplateElementValue: uncookTemplateElementValue$1
40332 };
40333
40334 const {
40335   builders: {
40336     indent: indent$x,
40337     softline: softline$s,
40338     literalline: literalline$4,
40339     dedentToRoot: dedentToRoot$2
40340   }
40341 } = require$$7$3;
40342 const {
40343   escapeTemplateCharacters: escapeTemplateCharacters$1
40344 } = templateLiteral;
40345
40346 function format$3(path, print, textToDoc) {
40347   const node = path.getValue();
40348   let text = node.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
40349   const indentation = getIndentation(text);
40350   const hasIndent = indentation !== "";
40351
40352   if (hasIndent) {
40353     text = text.replace(new RegExp(`^${indentation}`, "gm"), "");
40354   }
40355
40356   const doc = escapeTemplateCharacters$1(textToDoc(text, {
40357     parser: "markdown",
40358     __inJsTemplate: true
40359   }, {
40360     stripTrailingHardline: true
40361   }), true);
40362   return ["`", hasIndent ? indent$x([softline$s, doc]) : [literalline$4, dedentToRoot$2(doc)], softline$s, "`"];
40363 }
40364
40365 function getIndentation(str) {
40366   const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
40367   return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
40368 }
40369
40370 var markdown = format$3;
40371
40372 const {
40373   isNonEmptyArray: isNonEmptyArray$g
40374 } = util$8;
40375 const {
40376   builders: {
40377     indent: indent$w,
40378     hardline: hardline$z,
40379     softline: softline$r
40380   },
40381   utils: {
40382     mapDoc: mapDoc$2,
40383     replaceEndOfLine: replaceEndOfLine$1,
40384     cleanDoc: cleanDoc$3
40385   }
40386 } = require$$7$3;
40387 const {
40388   printTemplateExpressions: printTemplateExpressions$2
40389 } = templateLiteral;
40390
40391 function format$2(path, print, textToDoc) {
40392   const node = path.getValue(); // Get full template literal with expressions replaced by placeholders
40393
40394   const rawQuasis = node.quasis.map(q => q.value.raw);
40395   let placeholderID = 0;
40396   const text = rawQuasis.reduce((prevVal, currVal, idx) => idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal, "");
40397   const doc = textToDoc(text, {
40398     parser: "scss"
40399   }, {
40400     stripTrailingHardline: true
40401   });
40402   const expressionDocs = printTemplateExpressions$2(path, print);
40403   return transformCssDoc(doc, node, expressionDocs);
40404 }
40405
40406 function transformCssDoc(quasisDoc, parentNode, expressionDocs) {
40407   const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
40408
40409   if (isEmpty) {
40410     return "``";
40411   }
40412
40413   const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
40414   /* istanbul ignore if */
40415
40416   if (!newDoc) {
40417     throw new Error("Couldn't insert all the expressions");
40418   }
40419
40420   return ["`", indent$w([hardline$z, newDoc]), softline$r, "`"];
40421 } // Search all the placeholders in the quasisDoc tree
40422 // and replace them with the expression docs one by one
40423 // returns a new doc with all the placeholders replaced,
40424 // or null if it couldn't replace any expression
40425
40426
40427 function replacePlaceholders(quasisDoc, expressionDocs) {
40428   if (!isNonEmptyArray$g(expressionDocs)) {
40429     return quasisDoc;
40430   }
40431
40432   let replaceCounter = 0;
40433   const newDoc = mapDoc$2(cleanDoc$3(quasisDoc), doc => {
40434     if (typeof doc !== "string" || !doc.includes("@prettier-placeholder")) {
40435       return doc;
40436     } // When we have multiple placeholders in one line, like:
40437     // ${Child}${Child2}:not(:first-child)
40438
40439
40440     return doc.split(/@prettier-placeholder-(\d+)-id/).map((component, idx) => {
40441       // The placeholder is always at odd indices
40442       if (idx % 2 === 0) {
40443         return replaceEndOfLine$1(component);
40444       } // The component will always be a number at odd index
40445
40446
40447       replaceCounter++;
40448       return expressionDocs[component];
40449     });
40450   });
40451   return expressionDocs.length === replaceCounter ? newDoc : null;
40452 }
40453
40454 var css = format$2;
40455
40456 const {
40457   builders: {
40458     indent: indent$v,
40459     join: join$t,
40460     hardline: hardline$y
40461   }
40462 } = require$$7$3;
40463 const {
40464   escapeTemplateCharacters,
40465   printTemplateExpressions: printTemplateExpressions$1
40466 } = templateLiteral;
40467
40468 function format$1(path, print, textToDoc) {
40469   const node = path.getValue();
40470   const numQuasis = node.quasis.length;
40471
40472   if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
40473     return "``";
40474   }
40475
40476   const expressionDocs = printTemplateExpressions$1(path, print);
40477   const parts = [];
40478
40479   for (let i = 0; i < numQuasis; i++) {
40480     const templateElement = node.quasis[i];
40481     const isFirst = i === 0;
40482     const isLast = i === numQuasis - 1;
40483     const text = templateElement.value.cooked;
40484     const lines = text.split("\n");
40485     const numLines = lines.length;
40486     const expressionDoc = expressionDocs[i];
40487     const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
40488     const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
40489     const commentsAndWhitespaceOnly = lines.every(line => /^\s*(?:#[^\n\r]*)?$/.test(line)); // Bail out if an interpolation occurs within a comment.
40490
40491     if (!isLast && /#[^\n\r]*$/.test(lines[numLines - 1])) {
40492       return null;
40493     }
40494
40495     let doc = null;
40496
40497     if (commentsAndWhitespaceOnly) {
40498       doc = printGraphqlComments(lines);
40499     } else {
40500       doc = textToDoc(text, {
40501         parser: "graphql"
40502       }, {
40503         stripTrailingHardline: true
40504       });
40505     }
40506
40507     if (doc) {
40508       doc = escapeTemplateCharacters(doc, false);
40509
40510       if (!isFirst && startsWithBlankLine) {
40511         parts.push("");
40512       }
40513
40514       parts.push(doc);
40515
40516       if (!isLast && endsWithBlankLine) {
40517         parts.push("");
40518       }
40519     } else if (!isFirst && !isLast && startsWithBlankLine) {
40520       parts.push("");
40521     }
40522
40523     if (expressionDoc) {
40524       parts.push(expressionDoc);
40525     }
40526   }
40527
40528   return ["`", indent$v([hardline$y, join$t(hardline$y, parts)]), hardline$y, "`"];
40529 }
40530
40531 function printGraphqlComments(lines) {
40532   const parts = [];
40533   let seenComment = false;
40534   const array = lines.map(textLine => textLine.trim());
40535
40536   for (const [i, textLine] of array.entries()) {
40537     // Lines are either whitespace only, or a comment (with potential whitespace
40538     // around it). Drop whitespace-only lines.
40539     if (textLine === "") {
40540       continue;
40541     }
40542
40543     if (array[i - 1] === "" && seenComment) {
40544       // If a non-first comment is preceded by a blank (whitespace only) line,
40545       // add in a blank line.
40546       parts.push([hardline$y, textLine]);
40547     } else {
40548       parts.push(textLine);
40549     }
40550
40551     seenComment = true;
40552   } // If `lines` was whitespace only, return `null`.
40553
40554
40555   return parts.length === 0 ? null : join$t(hardline$y, parts);
40556 }
40557
40558 var graphql = format$1;
40559
40560 const {
40561   builders: {
40562     indent: indent$u,
40563     line: line$y,
40564     hardline: hardline$x,
40565     group: group$B
40566   },
40567   utils: {
40568     mapDoc: mapDoc$1
40569   }
40570 } = require$$7$3;
40571 const {
40572   printTemplateExpressions,
40573   uncookTemplateElementValue
40574 } = templateLiteral; // The counter is needed to distinguish nested embeds.
40575
40576 let htmlTemplateLiteralCounter = 0;
40577
40578 function format(path, print, textToDoc, options, {
40579   parser
40580 }) {
40581   const node = path.getValue();
40582   const counter = htmlTemplateLiteralCounter;
40583   htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
40584
40585   const composePlaceholder = index => `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
40586
40587   const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
40588   const expressionDocs = printTemplateExpressions(path, print);
40589
40590   if (expressionDocs.length === 0 && text.trim().length === 0) {
40591     return "``";
40592   }
40593
40594   const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
40595   let topLevelCount = 0;
40596   const doc = textToDoc(text, {
40597     parser,
40598
40599     __onHtmlRoot(root) {
40600       topLevelCount = root.children.length;
40601     }
40602
40603   }, {
40604     stripTrailingHardline: true
40605   });
40606   const contentDoc = mapDoc$1(doc, doc => {
40607     if (typeof doc !== "string") {
40608       return doc;
40609     }
40610
40611     const parts = [];
40612     const components = doc.split(placeholderRegex);
40613
40614     for (let i = 0; i < components.length; i++) {
40615       let component = components[i];
40616
40617       if (i % 2 === 0) {
40618         if (component) {
40619           component = uncookTemplateElementValue(component);
40620
40621           if (options.__embeddedInHtml) {
40622             component = component.replace(/<\/(script)\b/gi, "<\\/$1");
40623           }
40624
40625           parts.push(component);
40626         }
40627
40628         continue;
40629       }
40630
40631       const placeholderIndex = Number(component);
40632       parts.push(expressionDocs[placeholderIndex]);
40633     }
40634
40635     return parts;
40636   });
40637   const leadingWhitespace = /^\s/.test(text) ? " " : "";
40638   const trailingWhitespace = /\s$/.test(text) ? " " : "";
40639   const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline$x : leadingWhitespace && trailingWhitespace ? line$y : null;
40640
40641   if (linebreak) {
40642     return group$B(["`", indent$u([linebreak, group$B(contentDoc)]), linebreak, "`"]);
40643   }
40644
40645   return group$B(["`", leadingWhitespace, topLevelCount > 1 ? indent$u(group$B(contentDoc)) : group$B(contentDoc), trailingWhitespace, "`"]);
40646 }
40647
40648 var html$3 = format;
40649
40650 const {
40651   hasComment: hasComment$h,
40652   CommentCheckFlags: CommentCheckFlags$f,
40653   isObjectProperty: isObjectProperty$5
40654 } = utils$5;
40655 const formatMarkdown = markdown;
40656 const formatCss = css;
40657 const formatGraphql = graphql;
40658 const formatHtml = html$3;
40659
40660 function getLanguage(path) {
40661   if (isStyledJsx(path) || isStyledComponents(path) || isCssProp(path) || isAngularComponentStyles(path)) {
40662     return "css";
40663   }
40664
40665   if (isGraphQL(path)) {
40666     return "graphql";
40667   }
40668
40669   if (isHtml(path)) {
40670     return "html";
40671   }
40672
40673   if (isAngularComponentTemplate(path)) {
40674     return "angular";
40675   }
40676
40677   if (isMarkdown(path)) {
40678     return "markdown";
40679   }
40680 }
40681
40682 function embed$a(path, print, textToDoc, options) {
40683   const node = path.getValue();
40684
40685   if (node.type !== "TemplateLiteral" || // Bail out if any of the quasis have an invalid escape sequence
40686   // (which would make the `cooked` value be `null`)
40687   hasInvalidCookedValue(node)) {
40688     return;
40689   }
40690
40691   const language = getLanguage(path);
40692
40693   if (!language) {
40694     return;
40695   }
40696
40697   if (language === "markdown") {
40698     return formatMarkdown(path, print, textToDoc);
40699   }
40700
40701   if (language === "css") {
40702     return formatCss(path, print, textToDoc);
40703   }
40704
40705   if (language === "graphql") {
40706     return formatGraphql(path, print, textToDoc);
40707   }
40708
40709   if (language === "html" || language === "angular") {
40710     return formatHtml(path, print, textToDoc, options, {
40711       parser: language
40712     });
40713   }
40714 }
40715 /**
40716  * md`...`
40717  * markdown`...`
40718  */
40719
40720
40721 function isMarkdown(path) {
40722   const node = path.getValue();
40723   const parent = path.getParentNode();
40724   return parent && parent.type === "TaggedTemplateExpression" && node.quasis.length === 1 && parent.tag.type === "Identifier" && (parent.tag.name === "md" || parent.tag.name === "markdown");
40725 }
40726 /**
40727  * Template literal in these contexts:
40728  * <style jsx>{`div{color:red}`}</style>
40729  * css``
40730  * css.global``
40731  * css.resolve``
40732  */
40733
40734
40735 function isStyledJsx(path) {
40736   const node = path.getValue();
40737   const parent = path.getParentNode();
40738   const parentParent = path.getParentNode(1);
40739   return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(attribute => attribute.name.name === "jsx") || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "Identifier" && parent.tag.name === "css" || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && parent.tag.object.name === "css" && (parent.tag.property.name === "global" || parent.tag.property.name === "resolve");
40740 }
40741 /**
40742  * Angular Components can have:
40743  * - Inline HTML template
40744  * - Inline CSS styles
40745  *
40746  * ...which are both within template literals somewhere
40747  * inside of the Component decorator factory.
40748  *
40749  * E.g.
40750  * @Component({
40751  *  template: `<div>...</div>`,
40752  *  styles: [`h1 { color: blue; }`]
40753  * })
40754  */
40755
40756
40757 function isAngularComponentStyles(path) {
40758   return path.match(node => node.type === "TemplateLiteral", (node, name) => node.type === "ArrayExpression" && name === "elements", (node, name) => isObjectProperty$5(node) && node.key.type === "Identifier" && node.key.name === "styles" && name === "value", ...angularComponentObjectExpressionPredicates);
40759 }
40760
40761 function isAngularComponentTemplate(path) {
40762   return path.match(node => node.type === "TemplateLiteral", (node, name) => isObjectProperty$5(node) && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates);
40763 }
40764
40765 const angularComponentObjectExpressionPredicates = [(node, name) => node.type === "ObjectExpression" && name === "properties", (node, name) => node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "Component" && name === "arguments", (node, name) => node.type === "Decorator" && name === "expression"];
40766 /**
40767  * styled-components template literals
40768  */
40769
40770 function isStyledComponents(path) {
40771   const parent = path.getParentNode();
40772
40773   if (!parent || parent.type !== "TaggedTemplateExpression") {
40774     return false;
40775   }
40776
40777   const tag = parent.tag.type === "ParenthesizedExpression" ? parent.tag.expression : parent.tag;
40778
40779   switch (tag.type) {
40780     case "MemberExpression":
40781       return (// styled.foo``
40782         isStyledIdentifier(tag.object) || // Component.extend``
40783         isStyledExtend(tag)
40784       );
40785
40786     case "CallExpression":
40787       return (// styled(Component)``
40788         isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})``
40789         isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})``
40790         isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})``
40791         tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
40792       );
40793
40794     case "Identifier":
40795       // css``
40796       return tag.name === "css";
40797
40798     default:
40799       return false;
40800   }
40801 }
40802 /**
40803  * JSX element with CSS prop
40804  */
40805
40806
40807 function isCssProp(path) {
40808   const parent = path.getParentNode();
40809   const parentParent = path.getParentNode(1);
40810   return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
40811 }
40812
40813 function isStyledIdentifier(node) {
40814   return node.type === "Identifier" && node.name === "styled";
40815 }
40816
40817 function isStyledExtend(node) {
40818   return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
40819 }
40820 /*
40821  * react-relay and graphql-tag
40822  * graphql`...`
40823  * graphql.experimental`...`
40824  * gql`...`
40825  * GraphQL comment block
40826  *
40827  * This intentionally excludes Relay Classic tags, as Prettier does not
40828  * support Relay Classic formatting.
40829  */
40830
40831
40832 function isGraphQL(path) {
40833   const node = path.getValue();
40834   const parent = path.getParentNode();
40835   return hasLanguageComment(node, "GraphQL") || parent && (parent.type === "TaggedTemplateExpression" && (parent.tag.type === "MemberExpression" && parent.tag.object.name === "graphql" && parent.tag.property.name === "experimental" || parent.tag.type === "Identifier" && (parent.tag.name === "gql" || parent.tag.name === "graphql")) || parent.type === "CallExpression" && parent.callee.type === "Identifier" && parent.callee.name === "graphql");
40836 }
40837
40838 function hasLanguageComment(node, languageName) {
40839   // This checks for a leading comment that is exactly `/* GraphQL */`
40840   // In order to be in line with other implementations of this comment tag
40841   // we will not trim the comment value and we will expect exactly one space on
40842   // either side of the GraphQL string
40843   // Also see ./clean.js
40844   return hasComment$h(node, CommentCheckFlags$f.Block | CommentCheckFlags$f.Leading, ({
40845     value
40846   }) => value === ` ${languageName} `);
40847 }
40848 /**
40849  *     - html`...`
40850  *     - HTML comment block
40851  */
40852
40853
40854 function isHtml(path) {
40855   return hasLanguageComment(path.getValue(), "HTML") || path.match(node => node.type === "TemplateLiteral", (node, name) => node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi");
40856 }
40857
40858 function hasInvalidCookedValue({
40859   quasis
40860 }) {
40861   return quasis.some(({
40862     value: {
40863       cooked
40864     }
40865   }) => cooked === null);
40866 }
40867
40868 var embed_1$4 = embed$a;
40869
40870 const {
40871   isBlockComment: isBlockComment$4
40872 } = utils$5;
40873 const ignoredProperties$4 = new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]);
40874
40875 const removeTemplateElementsValue = node => {
40876   for (const templateElement of node.quasis) {
40877     delete templateElement.value;
40878   }
40879 };
40880
40881 function clean$c(ast, newObj, parent) {
40882   if (ast.type === "Program") {
40883     delete newObj.sourceType;
40884   }
40885
40886   if (ast.type === "BigIntLiteral" || ast.type === "BigIntLiteralTypeAnnotation") {
40887     if (newObj.value) {
40888       newObj.value = newObj.value.toLowerCase();
40889     }
40890   }
40891
40892   if (ast.type === "BigIntLiteral" || ast.type === "Literal") {
40893     if (newObj.bigint) {
40894       newObj.bigint = newObj.bigint.toLowerCase();
40895     }
40896   }
40897
40898   if (ast.type === "DecimalLiteral") {
40899     newObj.value = Number(newObj.value);
40900   }
40901
40902   if (ast.type === "Literal" && newObj.decimal) {
40903     newObj.decimal = Number(newObj.decimal);
40904   } // We remove extra `;` and add them when needed
40905
40906
40907   if (ast.type === "EmptyStatement") {
40908     return null;
40909   } // We move text around, including whitespaces and add {" "}
40910
40911
40912   if (ast.type === "JSXText") {
40913     return null;
40914   }
40915
40916   if (ast.type === "JSXExpressionContainer" && (ast.expression.type === "Literal" || ast.expression.type === "StringLiteral") && ast.expression.value === " ") {
40917     return null;
40918   } // We change {'key': value} into {key: value}.
40919   // And {key: value} into {'key': value}.
40920   // Also for (some) number keys.
40921
40922
40923   if ((ast.type === "Property" || ast.type === "ObjectProperty" || ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "ClassMethod" || ast.type === "PropertyDefinition" || ast.type === "TSDeclareMethod" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && typeof ast.key === "object" && ast.key && (ast.key.type === "Literal" || ast.key.type === "NumericLiteral" || ast.key.type === "StringLiteral" || ast.key.type === "Identifier")) {
40924     delete newObj.key;
40925   } // Remove raw and cooked values from TemplateElement when it's CSS
40926   // styled-jsx
40927
40928
40929   if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some(attr => attr.name.name === "jsx")) {
40930     for (const {
40931       type,
40932       expression
40933     } of newObj.children) {
40934       if (type === "JSXExpressionContainer" && expression.type === "TemplateLiteral") {
40935         removeTemplateElementsValue(expression);
40936       }
40937     }
40938   } // CSS template literals in css prop
40939
40940
40941   if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
40942     removeTemplateElementsValue(newObj.value.expression);
40943   } // We change quotes
40944
40945
40946   if (ast.type === "JSXAttribute" && ast.value && ast.value.type === "Literal" && /["']|&quot;|&apos;/.test(ast.value.value)) {
40947     newObj.value.value = newObj.value.value.replace(/["']|&quot;|&apos;/g, '"');
40948   } // Angular Components: Inline HTML template and Inline CSS styles
40949
40950
40951   const expression = ast.expression || ast.callee;
40952
40953   if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
40954     const astProps = ast.expression.arguments[0].properties;
40955
40956     for (const [index, prop] of newObj.expression.arguments[0].properties.entries()) {
40957       switch (astProps[index].key.name) {
40958         case "styles":
40959           if (prop.value.type === "ArrayExpression") {
40960             removeTemplateElementsValue(prop.value.elements[0]);
40961           }
40962
40963           break;
40964
40965         case "template":
40966           if (prop.value.type === "TemplateLiteral") {
40967             removeTemplateElementsValue(prop.value);
40968           }
40969
40970           break;
40971       }
40972     }
40973   } // styled-components, graphql, markdown
40974
40975
40976   if (ast.type === "TaggedTemplateExpression" && (ast.tag.type === "MemberExpression" || ast.tag.type === "Identifier" && (ast.tag.name === "gql" || ast.tag.name === "graphql" || ast.tag.name === "css" || ast.tag.name === "md" || ast.tag.name === "markdown" || ast.tag.name === "html") || ast.tag.type === "CallExpression")) {
40977     removeTemplateElementsValue(newObj.quasi);
40978   }
40979
40980   if (ast.type === "TemplateLiteral") {
40981     // This checks for a leading comment that is exactly `/* GraphQL */`
40982     // In order to be in line with other implementations of this comment tag
40983     // we will not trim the comment value and we will expect exactly one space on
40984     // either side of the GraphQL string
40985     // Also see ./embed.js
40986     const hasLanguageComment = ast.leadingComments && ast.leadingComments.some(comment => isBlockComment$4(comment) && ["GraphQL", "HTML"].some(languageName => comment.value === ` ${languageName} `));
40987
40988     if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql" || // TODO: check parser
40989     // `flow` and `typescript` don't have `leadingComments`
40990     !ast.leadingComments) {
40991       removeTemplateElementsValue(newObj);
40992     }
40993   }
40994
40995   if (ast.type === "InterpreterDirective") {
40996     newObj.value = newObj.value.trimEnd();
40997   } // Prettier removes degenerate union and intersection types with only one member.
40998
40999
41000   if ((ast.type === "TSIntersectionType" || ast.type === "TSUnionType") && ast.types.length === 1) {
41001     return newObj.types[0];
41002   }
41003 }
41004
41005 clean$c.ignoredProperties = ignoredProperties$4;
41006 var clean_1$4 = clean$c;
41007
41008 var build = {};
41009
41010 var detectNewline$1 = {exports: {}};
41011
41012 const detectNewline = string => {
41013   if (typeof string !== 'string') {
41014     throw new TypeError('Expected a string');
41015   }
41016
41017   const newlines = string.match(/(?:\r?\n)/g) || [];
41018
41019   if (newlines.length === 0) {
41020     return;
41021   }
41022
41023   const crlf = newlines.filter(newline => newline === '\r\n').length;
41024   const lf = newlines.length - crlf;
41025   return crlf > lf ? '\r\n' : '\n';
41026 };
41027
41028 detectNewline$1.exports = detectNewline;
41029
41030 detectNewline$1.exports.graceful = string => typeof string === 'string' && detectNewline(string) || '\n';
41031
41032 Object.defineProperty(build, '__esModule', {
41033   value: true
41034 });
41035 build.extract = extract$1;
41036 build.strip = strip$1;
41037 build.parse = parse$1;
41038 build.parseWithComments = parseWithComments$1;
41039 build.print = print$3;
41040
41041 function _os() {
41042   const data = require$$0__default$1["default"];
41043
41044   _os = function () {
41045     return data;
41046   };
41047
41048   return data;
41049 }
41050
41051 function _detectNewline() {
41052   const data = _interopRequireDefault(detectNewline$1.exports);
41053
41054   _detectNewline = function () {
41055     return data;
41056   };
41057
41058   return data;
41059 }
41060
41061 function _interopRequireDefault(obj) {
41062   return obj && obj.__esModule ? obj : {
41063     default: obj
41064   };
41065 }
41066 /**
41067  * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
41068  *
41069  * This source code is licensed under the MIT license found in the
41070  * LICENSE file in the root directory of this source tree.
41071  */
41072
41073
41074 const commentEndRe = /\*\/$/;
41075 const commentStartRe = /^\/\*\*/;
41076 const docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
41077 const lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
41078 const ltrimNewlineRe = /^(\r?\n)+/;
41079 const multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
41080 const propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
41081 const stringStartRe = /(\r?\n|^) *\* ?/g;
41082 const STRING_ARRAY = [];
41083
41084 function extract$1(contents) {
41085   const match = contents.match(docblockRe);
41086   return match ? match[0].trimLeft() : '';
41087 }
41088
41089 function strip$1(contents) {
41090   const match = contents.match(docblockRe);
41091   return match && match[0] ? contents.substring(match[0].length) : contents;
41092 }
41093
41094 function parse$1(docblock) {
41095   return parseWithComments$1(docblock).pragmas;
41096 }
41097
41098 function parseWithComments$1(docblock) {
41099   const line = (0, _detectNewline().default)(docblock) || _os().EOL;
41100
41101   docblock = docblock.replace(commentStartRe, '').replace(commentEndRe, '').replace(stringStartRe, '$1'); // Normalize multi-line directives
41102
41103   let prev = '';
41104
41105   while (prev !== docblock) {
41106     prev = docblock;
41107     docblock = docblock.replace(multilineRe, `${line}$1 $2${line}`);
41108   }
41109
41110   docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
41111   const result = Object.create(null);
41112   const comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
41113   let match;
41114
41115   while (match = propertyRe.exec(docblock)) {
41116     // strip linecomments from pragmas
41117     const nextPragma = match[2].replace(lineCommentRe, '');
41118
41119     if (typeof result[match[1]] === 'string' || Array.isArray(result[match[1]])) {
41120       result[match[1]] = STRING_ARRAY.concat(result[match[1]], nextPragma);
41121     } else {
41122       result[match[1]] = nextPragma;
41123     }
41124   }
41125
41126   return {
41127     comments,
41128     pragmas: result
41129   };
41130 }
41131
41132 function print$3({
41133   comments = '',
41134   pragmas = {}
41135 }) {
41136   const line = (0, _detectNewline().default)(comments) || _os().EOL;
41137
41138   const head = '/**';
41139   const start = ' *';
41140   const tail = ' */';
41141   const keys = Object.keys(pragmas);
41142   const printedObject = keys.map(key => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map(keyValue => start + ' ' + keyValue + line).join('');
41143
41144   if (!comments) {
41145     if (keys.length === 0) {
41146       return '';
41147     }
41148
41149     if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
41150       const value = pragmas[keys[0]];
41151       return `${head} ${printKeyValues(keys[0], value)[0]}${tail}`;
41152     }
41153   }
41154
41155   const printedComments = comments.split(line).map(textLine => `${start} ${textLine}`).join(line) + line;
41156   return head + line + (comments ? printedComments : '') + (comments && keys.length ? start + line : '') + printedObject + tail;
41157 }
41158
41159 function printKeyValues(key, valueOrArray) {
41160   return STRING_ARRAY.concat(valueOrArray).map(value => `@${key} ${value}`.trim());
41161 }
41162
41163 const {
41164   parseWithComments,
41165   strip,
41166   extract,
41167   print: print$2
41168 } = build;
41169 const {
41170   getShebang
41171 } = util$8;
41172 const {
41173   normalizeEndOfLine
41174 } = endOfLine;
41175
41176 function parseDocBlock(text) {
41177   const shebang = getShebang(text);
41178
41179   if (shebang) {
41180     text = text.slice(shebang.length + 1);
41181   }
41182
41183   const docBlock = extract(text);
41184   const {
41185     pragmas,
41186     comments
41187   } = parseWithComments(docBlock);
41188   return {
41189     shebang,
41190     text,
41191     pragmas,
41192     comments
41193   };
41194 }
41195
41196 function hasPragma$4(text) {
41197   const pragmas = Object.keys(parseDocBlock(text).pragmas);
41198   return pragmas.includes("prettier") || pragmas.includes("format");
41199 }
41200
41201 function insertPragma$a(originalText) {
41202   const {
41203     shebang,
41204     text,
41205     pragmas,
41206     comments
41207   } = parseDocBlock(originalText);
41208   const strippedText = strip(text);
41209   const docBlock = print$2({
41210     pragmas: Object.assign({
41211       format: ""
41212     }, pragmas),
41213     comments: comments.trimStart()
41214   });
41215   return (shebang ? `${shebang}\n` : "") + // normalise newlines (mitigate use of os.EOL by jest-docblock)
41216   normalizeEndOfLine(docBlock) + (strippedText.startsWith("\n") ? "\n" : "\n\n") + strippedText;
41217 }
41218
41219 var pragma$5 = {
41220   hasPragma: hasPragma$4,
41221   insertPragma: insertPragma$a
41222 };
41223
41224 const {
41225   getLast: getLast$j,
41226   hasNewline: hasNewline$6,
41227   getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
41228   getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter$1,
41229   hasNewlineInRange: hasNewlineInRange$3,
41230   addLeadingComment,
41231   addTrailingComment,
41232   addDanglingComment,
41233   getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$2,
41234   isNonEmptyArray: isNonEmptyArray$f
41235 } = util$8;
41236 const {
41237   isBlockComment: isBlockComment$3,
41238   getFunctionParameters: getFunctionParameters$5,
41239   isPrettierIgnoreComment,
41240   isJsxNode: isJsxNode$6,
41241   hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$2,
41242   hasFlowAnnotationComment: hasFlowAnnotationComment$1,
41243   hasIgnoreComment: hasIgnoreComment$1,
41244   isCallLikeExpression: isCallLikeExpression$1,
41245   getCallArguments: getCallArguments$4,
41246   isCallExpression: isCallExpression$c,
41247   isMemberExpression: isMemberExpression$8,
41248   isObjectProperty: isObjectProperty$4,
41249   getComments: getComments$4,
41250   CommentCheckFlags: CommentCheckFlags$e
41251 } = utils$5;
41252 const {
41253   locStart: locStart$p,
41254   locEnd: locEnd$o
41255 } = loc$6;
41256 /**
41257  * @typedef {import("./types/estree").Node} Node
41258  * @typedef {import("./types/estree").Comment} Comment
41259  * @typedef {import("../common/ast-path")} AstPath
41260  *
41261  * @typedef {Object} CommentContext
41262  * @property {Comment} comment
41263  * @property {Node} precedingNode
41264  * @property {Node} enclosingNode
41265  * @property {Node} followingNode
41266  * @property {string} text
41267  * @property {any} options
41268  * @property {Node} ast
41269  * @property {boolean} isLastComment
41270  */
41271
41272 /**
41273  * @param {CommentContext} context
41274  * @returns {boolean}
41275  */
41276
41277 function handleOwnLineComment(context) {
41278   return [handleIgnoreComments, handleLastFunctionArgComments, handleMemberExpressionComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleImportSpecifierComments, handleForComments, handleUnionTypeComments, handleOnlyComments, handleImportDeclarationComments, handleAssignmentPatternComments, handleMethodNameComments, handleLabeledStatementComments].some(fn => fn(context));
41279 }
41280 /**
41281  * @param {CommentContext} context
41282  * @returns {boolean}
41283  */
41284
41285
41286 function handleEndOfLineComment(context) {
41287   return [handleClosureTypeCastComments, handleLastFunctionArgComments, handleConditionalExpressionComments, handleImportSpecifierComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleLabeledStatementComments, handleCallExpressionComments, handlePropertyComments, handleOnlyComments, handleTypeAliasComments, handleVariableDeclaratorComments].some(fn => fn(context));
41288 }
41289 /**
41290  * @param {CommentContext} context
41291  * @returns {boolean}
41292  */
41293
41294
41295 function handleRemainingComment(context) {
41296   return [handleIgnoreComments, handleIfStatementComments, handleWhileComments, handleObjectPropertyAssignment, handleCommentInEmptyParens, handleMethodNameComments, handleOnlyComments, handleCommentAfterArrowParams, handleFunctionNameComments, handleTSMappedTypeComments, handleBreakAndContinueStatementComments, handleTSFunctionTrailingComments].some(fn => fn(context));
41297 }
41298 /**
41299  * @param {Node} node
41300  * @returns {void}
41301  */
41302
41303
41304 function addBlockStatementFirstComment(node, comment) {
41305   // @ts-expect-error
41306   const firstNonEmptyNode = (node.body || node.properties).find(({
41307     type
41308   }) => type !== "EmptyStatement");
41309
41310   if (firstNonEmptyNode) {
41311     addLeadingComment(firstNonEmptyNode, comment);
41312   } else {
41313     addDanglingComment(node, comment);
41314   }
41315 }
41316 /**
41317  * @param {Node} node
41318  * @returns {void}
41319  */
41320
41321
41322 function addBlockOrNotComment(node, comment) {
41323   if (node.type === "BlockStatement") {
41324     addBlockStatementFirstComment(node, comment);
41325   } else {
41326     addLeadingComment(node, comment);
41327   }
41328 }
41329
41330 function handleClosureTypeCastComments({
41331   comment,
41332   followingNode
41333 }) {
41334   if (followingNode && isTypeCastComment(comment)) {
41335     addLeadingComment(followingNode, comment);
41336     return true;
41337   }
41338
41339   return false;
41340 } // There are often comments before the else clause of if statements like
41341 //
41342 //   if (1) { ... }
41343 //   // comment
41344 //   else { ... }
41345 //
41346 // They are being attached as leading comments of the BlockExpression which
41347 // is not well printed. What we want is to instead move the comment inside
41348 // of the block and make it leadingComment of the first element of the block
41349 // or dangling comment of the block if there is nothing inside
41350 //
41351 //   if (1) { ... }
41352 //   else {
41353 //     // comment
41354 //     ...
41355 //   }
41356
41357
41358 function handleIfStatementComments({
41359   comment,
41360   precedingNode,
41361   enclosingNode,
41362   followingNode,
41363   text
41364 }) {
41365   if (!enclosingNode || enclosingNode.type !== "IfStatement" || !followingNode) {
41366     return false;
41367   } // We unfortunately have no way using the AST or location of nodes to know
41368   // if the comment is positioned before the condition parenthesis:
41369   //   if (a /* comment */) {}
41370   // The only workaround I found is to look at the next character to see if
41371   // it is a ).
41372
41373
41374   const nextCharacter = getNextNonSpaceNonCommentCharacter$1(text, comment, locEnd$o);
41375
41376   if (nextCharacter === ")") {
41377     addTrailingComment(precedingNode, comment);
41378     return true;
41379   } // Comments before `else`:
41380   // - treat as trailing comments of the consequent, if it's a BlockStatement
41381   // - treat as a dangling comment otherwise
41382
41383
41384   if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
41385     if (precedingNode.type === "BlockStatement") {
41386       addTrailingComment(precedingNode, comment);
41387     } else {
41388       addDanglingComment(enclosingNode, comment);
41389     }
41390
41391     return true;
41392   }
41393
41394   if (followingNode.type === "BlockStatement") {
41395     addBlockStatementFirstComment(followingNode, comment);
41396     return true;
41397   }
41398
41399   if (followingNode.type === "IfStatement") {
41400     addBlockOrNotComment(followingNode.consequent, comment);
41401     return true;
41402   } // For comments positioned after the condition parenthesis in an if statement
41403   // before the consequent without brackets on, such as
41404   // if (a) /* comment */ true,
41405   // we look at the next character to see if the following node
41406   // is the consequent for the if statement
41407
41408
41409   if (enclosingNode.consequent === followingNode) {
41410     addLeadingComment(followingNode, comment);
41411     return true;
41412   }
41413
41414   return false;
41415 }
41416
41417 function handleWhileComments({
41418   comment,
41419   precedingNode,
41420   enclosingNode,
41421   followingNode,
41422   text
41423 }) {
41424   if (!enclosingNode || enclosingNode.type !== "WhileStatement" || !followingNode) {
41425     return false;
41426   } // We unfortunately have no way using the AST or location of nodes to know
41427   // if the comment is positioned before the condition parenthesis:
41428   //   while (a /* comment */) {}
41429   // The only workaround I found is to look at the next character to see if
41430   // it is a ).
41431
41432
41433   const nextCharacter = getNextNonSpaceNonCommentCharacter$1(text, comment, locEnd$o);
41434
41435   if (nextCharacter === ")") {
41436     addTrailingComment(precedingNode, comment);
41437     return true;
41438   }
41439
41440   if (followingNode.type === "BlockStatement") {
41441     addBlockStatementFirstComment(followingNode, comment);
41442     return true;
41443   }
41444
41445   if (enclosingNode.body === followingNode) {
41446     addLeadingComment(followingNode, comment);
41447     return true;
41448   }
41449
41450   return false;
41451 } // Same as IfStatement but for TryStatement
41452
41453
41454 function handleTryStatementComments({
41455   comment,
41456   precedingNode,
41457   enclosingNode,
41458   followingNode
41459 }) {
41460   if (!enclosingNode || enclosingNode.type !== "TryStatement" && enclosingNode.type !== "CatchClause" || !followingNode) {
41461     return false;
41462   }
41463
41464   if (enclosingNode.type === "CatchClause" && precedingNode) {
41465     addTrailingComment(precedingNode, comment);
41466     return true;
41467   }
41468
41469   if (followingNode.type === "BlockStatement") {
41470     addBlockStatementFirstComment(followingNode, comment);
41471     return true;
41472   }
41473
41474   if (followingNode.type === "TryStatement") {
41475     addBlockOrNotComment(followingNode.finalizer, comment);
41476     return true;
41477   }
41478
41479   if (followingNode.type === "CatchClause") {
41480     addBlockOrNotComment(followingNode.body, comment);
41481     return true;
41482   }
41483
41484   return false;
41485 }
41486
41487 function handleMemberExpressionComments({
41488   comment,
41489   enclosingNode,
41490   followingNode
41491 }) {
41492   if (isMemberExpression$8(enclosingNode) && followingNode && followingNode.type === "Identifier") {
41493     addLeadingComment(enclosingNode, comment);
41494     return true;
41495   }
41496
41497   return false;
41498 }
41499
41500 function handleConditionalExpressionComments({
41501   comment,
41502   precedingNode,
41503   enclosingNode,
41504   followingNode,
41505   text
41506 }) {
41507   const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange$3(text, locEnd$o(precedingNode), locStart$p(comment));
41508
41509   if ((!precedingNode || !isSameLineAsPrecedingNode) && enclosingNode && (enclosingNode.type === "ConditionalExpression" || enclosingNode.type === "TSConditionalType") && followingNode) {
41510     addLeadingComment(followingNode, comment);
41511     return true;
41512   }
41513
41514   return false;
41515 }
41516
41517 function handleObjectPropertyAssignment({
41518   comment,
41519   precedingNode,
41520   enclosingNode
41521 }) {
41522   if (isObjectProperty$4(enclosingNode) && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
41523     addTrailingComment(enclosingNode.value.left, comment);
41524     return true;
41525   }
41526
41527   return false;
41528 }
41529
41530 function handleClassComments({
41531   comment,
41532   precedingNode,
41533   enclosingNode,
41534   followingNode
41535 }) {
41536   if (enclosingNode && (enclosingNode.type === "ClassDeclaration" || enclosingNode.type === "ClassExpression" || enclosingNode.type === "DeclareClass" || enclosingNode.type === "DeclareInterface" || enclosingNode.type === "InterfaceDeclaration" || enclosingNode.type === "TSInterfaceDeclaration")) {
41537     if (isNonEmptyArray$f(enclosingNode.decorators) && !(followingNode && followingNode.type === "Decorator")) {
41538       addTrailingComment(getLast$j(enclosingNode.decorators), comment);
41539       return true;
41540     }
41541
41542     if (enclosingNode.body && followingNode === enclosingNode.body) {
41543       addBlockStatementFirstComment(enclosingNode.body, comment);
41544       return true;
41545     } // Don't add leading comments to `implements`, `extends`, `mixins` to
41546     // avoid printing the comment after the keyword.
41547
41548
41549     if (followingNode) {
41550       for (const prop of ["implements", "extends", "mixins"]) {
41551         if (enclosingNode[prop] && followingNode === enclosingNode[prop][0]) {
41552           if (precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters || precedingNode === enclosingNode.superClass)) {
41553             addTrailingComment(precedingNode, comment);
41554           } else {
41555             addDanglingComment(enclosingNode, comment, prop);
41556           }
41557
41558           return true;
41559         }
41560       }
41561     }
41562   }
41563
41564   return false;
41565 }
41566
41567 function handleMethodNameComments({
41568   comment,
41569   precedingNode,
41570   enclosingNode,
41571   text
41572 }) {
41573   // This is only needed for estree parsers (flow, typescript) to attach
41574   // after a method name:
41575   // obj = { fn /*comment*/() {} };
41576   if (enclosingNode && precedingNode && ( // "MethodDefinition" is handled in getCommentChildNodes
41577   enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && // special Property case: { key: /*comment*/(value) };
41578   // comment should be attached to value instead of key
41579   getNextNonSpaceNonCommentCharacter$1(text, precedingNode, locEnd$o) !== ":") {
41580     addTrailingComment(precedingNode, comment);
41581     return true;
41582   } // Print comments between decorators and class methods as a trailing comment
41583   // on the decorator node instead of the method node
41584
41585
41586   if (precedingNode && enclosingNode && precedingNode.type === "Decorator" && (enclosingNode.type === "ClassMethod" || enclosingNode.type === "ClassProperty" || enclosingNode.type === "PropertyDefinition" || enclosingNode.type === "TSAbstractPropertyDefinition" || enclosingNode.type === "TSAbstractMethodDefinition" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "MethodDefinition")) {
41587     addTrailingComment(precedingNode, comment);
41588     return true;
41589   }
41590
41591   return false;
41592 }
41593
41594 function handleFunctionNameComments({
41595   comment,
41596   precedingNode,
41597   enclosingNode,
41598   text
41599 }) {
41600   if (getNextNonSpaceNonCommentCharacter$1(text, comment, locEnd$o) !== "(") {
41601     return false;
41602   }
41603
41604   if (precedingNode && enclosingNode && (enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "MethodDefinition" || enclosingNode.type === "ObjectMethod")) {
41605     addTrailingComment(precedingNode, comment);
41606     return true;
41607   }
41608
41609   return false;
41610 }
41611
41612 function handleCommentAfterArrowParams({
41613   comment,
41614   enclosingNode,
41615   text
41616 }) {
41617   if (!(enclosingNode && enclosingNode.type === "ArrowFunctionExpression")) {
41618     return false;
41619   }
41620
41621   const index = getNextNonSpaceNonCommentCharacterIndex$2(text, comment, locEnd$o);
41622
41623   if (index !== false && text.slice(index, index + 2) === "=>") {
41624     addDanglingComment(enclosingNode, comment);
41625     return true;
41626   }
41627
41628   return false;
41629 }
41630
41631 function handleCommentInEmptyParens({
41632   comment,
41633   enclosingNode,
41634   text
41635 }) {
41636   if (getNextNonSpaceNonCommentCharacter$1(text, comment, locEnd$o) !== ")") {
41637     return false;
41638   } // Only add dangling comments to fix the case when no params are present,
41639   // i.e. a function without any argument.
41640
41641
41642   if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && getFunctionParameters$5(enclosingNode).length === 0 || isCallLikeExpression$1(enclosingNode) && getCallArguments$4(enclosingNode).length === 0)) {
41643     addDanglingComment(enclosingNode, comment);
41644     return true;
41645   }
41646
41647   if (enclosingNode && (enclosingNode.type === "MethodDefinition" || enclosingNode.type === "TSAbstractMethodDefinition") && getFunctionParameters$5(enclosingNode.value).length === 0) {
41648     addDanglingComment(enclosingNode.value, comment);
41649     return true;
41650   }
41651
41652   return false;
41653 }
41654
41655 function handleLastFunctionArgComments({
41656   comment,
41657   precedingNode,
41658   enclosingNode,
41659   followingNode,
41660   text
41661 }) {
41662   // Flow function type definitions
41663   if (precedingNode && precedingNode.type === "FunctionTypeParam" && enclosingNode && enclosingNode.type === "FunctionTypeAnnotation" && followingNode && followingNode.type !== "FunctionTypeParam") {
41664     addTrailingComment(precedingNode, comment);
41665     return true;
41666   } // Real functions and TypeScript function type definitions
41667
41668
41669   if (precedingNode && (precedingNode.type === "Identifier" || precedingNode.type === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && getNextNonSpaceNonCommentCharacter$1(text, comment, locEnd$o) === ")") {
41670     addTrailingComment(precedingNode, comment);
41671     return true;
41672   }
41673
41674   if (enclosingNode && enclosingNode.type === "FunctionDeclaration" && followingNode && followingNode.type === "BlockStatement") {
41675     const functionParamRightParenIndex = (() => {
41676       const parameters = getFunctionParameters$5(enclosingNode);
41677
41678       if (parameters.length > 0) {
41679         return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd$o(getLast$j(parameters)));
41680       }
41681
41682       const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd$o(enclosingNode.id));
41683       return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
41684     })();
41685
41686     if (locStart$p(comment) > functionParamRightParenIndex) {
41687       addBlockStatementFirstComment(followingNode, comment);
41688       return true;
41689     }
41690   }
41691
41692   return false;
41693 }
41694
41695 function handleImportSpecifierComments({
41696   comment,
41697   enclosingNode
41698 }) {
41699   if (enclosingNode && enclosingNode.type === "ImportSpecifier") {
41700     addLeadingComment(enclosingNode, comment);
41701     return true;
41702   }
41703
41704   return false;
41705 }
41706
41707 function handleLabeledStatementComments({
41708   comment,
41709   enclosingNode
41710 }) {
41711   if (enclosingNode && enclosingNode.type === "LabeledStatement") {
41712     addLeadingComment(enclosingNode, comment);
41713     return true;
41714   }
41715
41716   return false;
41717 }
41718
41719 function handleBreakAndContinueStatementComments({
41720   comment,
41721   enclosingNode
41722 }) {
41723   if (enclosingNode && (enclosingNode.type === "ContinueStatement" || enclosingNode.type === "BreakStatement") && !enclosingNode.label) {
41724     addTrailingComment(enclosingNode, comment);
41725     return true;
41726   }
41727
41728   return false;
41729 }
41730
41731 function handleCallExpressionComments({
41732   comment,
41733   precedingNode,
41734   enclosingNode
41735 }) {
41736   if (isCallExpression$c(enclosingNode) && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
41737     addLeadingComment(enclosingNode.arguments[0], comment);
41738     return true;
41739   }
41740
41741   return false;
41742 }
41743
41744 function handleUnionTypeComments({
41745   comment,
41746   precedingNode,
41747   enclosingNode,
41748   followingNode
41749 }) {
41750   if (enclosingNode && (enclosingNode.type === "UnionTypeAnnotation" || enclosingNode.type === "TSUnionType")) {
41751     if (isPrettierIgnoreComment(comment)) {
41752       followingNode.prettierIgnore = true;
41753       comment.unignore = true;
41754     }
41755
41756     if (precedingNode) {
41757       addTrailingComment(precedingNode, comment);
41758       return true;
41759     }
41760
41761     return false;
41762   }
41763
41764   if (followingNode && (followingNode.type === "UnionTypeAnnotation" || followingNode.type === "TSUnionType") && isPrettierIgnoreComment(comment)) {
41765     followingNode.types[0].prettierIgnore = true;
41766     comment.unignore = true;
41767   }
41768
41769   return false;
41770 }
41771
41772 function handlePropertyComments({
41773   comment,
41774   enclosingNode
41775 }) {
41776   if (isObjectProperty$4(enclosingNode)) {
41777     addLeadingComment(enclosingNode, comment);
41778     return true;
41779   }
41780
41781   return false;
41782 }
41783
41784 function handleOnlyComments({
41785   comment,
41786   enclosingNode,
41787   followingNode,
41788   ast,
41789   isLastComment
41790 }) {
41791   // With Flow the enclosingNode is undefined so use the AST instead.
41792   if (ast && ast.body && ast.body.length === 0) {
41793     if (isLastComment) {
41794       addDanglingComment(ast, comment);
41795     } else {
41796       addLeadingComment(ast, comment);
41797     }
41798
41799     return true;
41800   }
41801
41802   if (enclosingNode && enclosingNode.type === "Program" && enclosingNode.body.length === 0 && !isNonEmptyArray$f(enclosingNode.directives)) {
41803     if (isLastComment) {
41804       addDanglingComment(enclosingNode, comment);
41805     } else {
41806       addLeadingComment(enclosingNode, comment);
41807     }
41808
41809     return true;
41810   }
41811
41812   if (followingNode && followingNode.type === "Program" && followingNode.body.length === 0 && enclosingNode && enclosingNode.type === "ModuleExpression") {
41813     addDanglingComment(followingNode, comment);
41814     return true;
41815   }
41816
41817   return false;
41818 }
41819
41820 function handleForComments({
41821   comment,
41822   enclosingNode
41823 }) {
41824   if (enclosingNode && (enclosingNode.type === "ForInStatement" || enclosingNode.type === "ForOfStatement")) {
41825     addLeadingComment(enclosingNode, comment);
41826     return true;
41827   }
41828
41829   return false;
41830 }
41831
41832 function handleImportDeclarationComments({
41833   comment,
41834   precedingNode,
41835   enclosingNode,
41836   text
41837 }) {
41838   if (precedingNode && precedingNode.type === "ImportSpecifier" && enclosingNode && enclosingNode.type === "ImportDeclaration" && hasNewline$6(text, locEnd$o(comment))) {
41839     addTrailingComment(precedingNode, comment);
41840     return true;
41841   }
41842
41843   return false;
41844 }
41845
41846 function handleAssignmentPatternComments({
41847   comment,
41848   enclosingNode
41849 }) {
41850   if (enclosingNode && enclosingNode.type === "AssignmentPattern") {
41851     addLeadingComment(enclosingNode, comment);
41852     return true;
41853   }
41854
41855   return false;
41856 }
41857
41858 function handleTypeAliasComments({
41859   comment,
41860   enclosingNode
41861 }) {
41862   if (enclosingNode && enclosingNode.type === "TypeAlias") {
41863     addLeadingComment(enclosingNode, comment);
41864     return true;
41865   }
41866
41867   return false;
41868 }
41869
41870 function handleVariableDeclaratorComments({
41871   comment,
41872   enclosingNode,
41873   followingNode
41874 }) {
41875   if (enclosingNode && (enclosingNode.type === "VariableDeclarator" || enclosingNode.type === "AssignmentExpression") && followingNode && (followingNode.type === "ObjectExpression" || followingNode.type === "ArrayExpression" || followingNode.type === "TemplateLiteral" || followingNode.type === "TaggedTemplateExpression" || isBlockComment$3(comment))) {
41876     addLeadingComment(followingNode, comment);
41877     return true;
41878   }
41879
41880   return false;
41881 }
41882
41883 function handleTSFunctionTrailingComments({
41884   comment,
41885   enclosingNode,
41886   followingNode,
41887   text
41888 }) {
41889   if (!followingNode && enclosingNode && (enclosingNode.type === "TSMethodSignature" || enclosingNode.type === "TSDeclareFunction" || enclosingNode.type === "TSAbstractMethodDefinition") && getNextNonSpaceNonCommentCharacter$1(text, comment, locEnd$o) === ";") {
41890     addTrailingComment(enclosingNode, comment);
41891     return true;
41892   }
41893
41894   return false;
41895 }
41896
41897 function handleIgnoreComments({
41898   comment,
41899   enclosingNode,
41900   followingNode
41901 }) {
41902   if (isPrettierIgnoreComment(comment) && enclosingNode && enclosingNode.type === "TSMappedType" && followingNode && followingNode.type === "TSTypeParameter" && followingNode.constraint) {
41903     enclosingNode.prettierIgnore = true;
41904     comment.unignore = true;
41905     return true;
41906   }
41907 }
41908
41909 function handleTSMappedTypeComments({
41910   comment,
41911   precedingNode,
41912   enclosingNode,
41913   followingNode
41914 }) {
41915   if (!enclosingNode || enclosingNode.type !== "TSMappedType") {
41916     return false;
41917   }
41918
41919   if (followingNode && followingNode.type === "TSTypeParameter" && followingNode.name) {
41920     addLeadingComment(followingNode.name, comment);
41921     return true;
41922   }
41923
41924   if (precedingNode && precedingNode.type === "TSTypeParameter" && precedingNode.constraint) {
41925     addTrailingComment(precedingNode.constraint, comment);
41926     return true;
41927   }
41928
41929   return false;
41930 }
41931 /**
41932  * @param {Node} node
41933  * @returns {boolean}
41934  */
41935
41936
41937 function isRealFunctionLikeNode(node) {
41938   return node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration" || node.type === "ObjectMethod" || node.type === "ClassMethod" || node.type === "TSDeclareFunction" || node.type === "TSCallSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSMethodSignature" || node.type === "TSConstructorType" || node.type === "TSFunctionType" || node.type === "TSDeclareMethod";
41939 }
41940 /**
41941  * @param {any} node
41942  * @returns {Node[] | void}
41943  */
41944
41945
41946 function getCommentChildNodes(node, options) {
41947   // Prevent attaching comments to FunctionExpression in this case:
41948   //     class Foo {
41949   //       bar() // comment
41950   //       {
41951   //         baz();
41952   //       }
41953   //     }
41954   if ((options.parser === "typescript" || options.parser === "flow" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree") && node.type === "MethodDefinition" && node.value && node.value.type === "FunctionExpression" && getFunctionParameters$5(node.value).length === 0 && !node.value.returnType && !isNonEmptyArray$f(node.value.typeParameters) && node.value.body) {
41955     return [...(node.decorators || []), node.key, node.value.body];
41956   }
41957 }
41958 /**
41959  * @param {Comment} comment
41960  * @returns {boolean}
41961  */
41962
41963
41964 function isTypeCastComment(comment) {
41965   return isBlockComment$3(comment) && comment.value[0] === "*" && // TypeScript expects the type to be enclosed in curly brackets, however
41966   // Closure Compiler accepts types in parens and even without any delimiters at all.
41967   // That's why we just search for "@type".
41968   /@type\b/.test(comment.value);
41969 }
41970 /**
41971  * @param {AstPath} path
41972  * @returns {boolean}
41973  */
41974
41975
41976 function willPrintOwnComments$1(path
41977 /*, options */
41978 ) {
41979   const node = path.getValue();
41980   const parent = path.getParentNode();
41981
41982   const hasFlowAnnotations = node => hasFlowAnnotationComment$1(getComments$4(node, CommentCheckFlags$e.Leading)) || hasFlowAnnotationComment$1(getComments$4(node, CommentCheckFlags$e.Trailing));
41983
41984   return (node && (isJsxNode$6(node) || hasFlowShorthandAnnotationComment$2(node) || isCallExpression$c(parent) && hasFlowAnnotations(node)) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && (!hasIgnoreComment$1(path) || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType");
41985 }
41986
41987 var comments = {
41988   handleOwnLineComment,
41989   handleEndOfLineComment,
41990   handleRemainingComment,
41991   isTypeCastComment,
41992   getCommentChildNodes,
41993   willPrintOwnComments: willPrintOwnComments$1
41994 };
41995
41996 const getLast$i = getLast_1;
41997 const {
41998   getFunctionParameters: getFunctionParameters$4,
41999   getLeftSidePathName: getLeftSidePathName$1,
42000   hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment$1,
42001   hasNakedLeftSide: hasNakedLeftSide$2,
42002   hasNode: hasNode$1,
42003   isBitwiseOperator,
42004   startsWithNoLookaheadToken: startsWithNoLookaheadToken$1,
42005   shouldFlatten: shouldFlatten$1,
42006   getPrecedence,
42007   isCallExpression: isCallExpression$b,
42008   isMemberExpression: isMemberExpression$7,
42009   isObjectProperty: isObjectProperty$3
42010 } = utils$5;
42011
42012 function needsParens(path, options) {
42013   const parent = path.getParentNode();
42014
42015   if (!parent) {
42016     return false;
42017   }
42018
42019   const name = path.getName();
42020   const node = path.getNode(); // to avoid unexpected `}}` in HTML interpolations
42021
42022   if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
42023     return true;
42024   } // Only statements don't need parentheses.
42025
42026
42027   if (isStatement(node)) {
42028     return false;
42029   }
42030
42031   if ( // Preserve parens if we have a Flow annotation comment, unless we're using the Flow
42032   // parser. The Flow parser turns Flow comments into type annotation nodes in its
42033   // AST, which we handle separately.
42034   options.parser !== "flow" && hasFlowShorthandAnnotationComment$1(path.getValue())) {
42035     return true;
42036   } // Identifiers never need parentheses.
42037
42038
42039   if (node.type === "Identifier") {
42040     // ...unless those identifiers are embed placeholders. They might be substituted by complex
42041     // expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS):
42042     //     let tpl = html`<script> f((${expr}) / 2); </script>`;
42043     // If the inner JS formatter removes the parens, the expression might change its meaning:
42044     //     f((a + b) / 2)  vs  f(a + b / 2)
42045     if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
42046       return true;
42047     } // `for (async of []);` is invalid
42048
42049
42050     if (name === "left" && node.name === "async" && parent.type === "ForOfStatement" && !parent.await) {
42051       return true;
42052     }
42053
42054     return false;
42055   }
42056
42057   switch (parent.type) {
42058     case "ParenthesizedExpression":
42059       return false;
42060
42061     case "ClassDeclaration":
42062     case "ClassExpression":
42063       {
42064         // Add parens around the extends clause of a class. It is needed for almost
42065         // all expressions.
42066         if (name === "superClass" && (node.type === "ArrowFunctionExpression" || node.type === "AssignmentExpression" || node.type === "AwaitExpression" || node.type === "BinaryExpression" || node.type === "ConditionalExpression" || node.type === "LogicalExpression" || node.type === "NewExpression" || node.type === "ObjectExpression" || node.type === "ParenthesizedExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "UnaryExpression" || node.type === "UpdateExpression" || node.type === "YieldExpression" || node.type === "TSNonNullExpression")) {
42067           return true;
42068         }
42069
42070         break;
42071       }
42072
42073     case "ExportDefaultDeclaration":
42074       {
42075         return (// `export default function` or `export default class` can't be followed by
42076           // anything after. So an expression like `export default (function(){}).toString()`
42077           // needs to be followed by a parentheses
42078           shouldWrapFunctionForExportDefault(path, options) || // `export default (foo, bar)` also needs parentheses
42079           node.type === "SequenceExpression"
42080         );
42081       }
42082
42083     case "Decorator":
42084       {
42085         if (name === "expression") {
42086           let hasCallExpression = false;
42087           let hasMemberExpression = false;
42088           let current = node;
42089
42090           while (current) {
42091             switch (current.type) {
42092               case "MemberExpression":
42093                 hasMemberExpression = true;
42094                 current = current.object;
42095                 break;
42096
42097               case "CallExpression":
42098                 if (
42099                 /** @(x().y) */
42100                 hasMemberExpression ||
42101                 /** @(x().y()) */
42102                 hasCallExpression) {
42103                   return options.parser !== "typescript";
42104                 }
42105
42106                 hasCallExpression = true;
42107                 current = current.callee;
42108                 break;
42109
42110               case "Identifier":
42111                 return false;
42112
42113               case "TaggedTemplateExpression":
42114                 // babel-parser cannot parse
42115                 //   @foo`bar`
42116                 return options.parser !== "typescript";
42117
42118               default:
42119                 return true;
42120             }
42121           }
42122
42123           return true;
42124         }
42125
42126         break;
42127       }
42128
42129     case "ExpressionStatement":
42130       {
42131         if (startsWithNoLookaheadToken$1(node,
42132         /* forbidFunctionClassAndDoExpr */
42133         true)) {
42134           return true;
42135         }
42136
42137         break;
42138       }
42139
42140     case "ArrowFunctionExpression":
42141       {
42142         if (name === "body" && node.type !== "SequenceExpression" && // these have parens added anyway
42143         startsWithNoLookaheadToken$1(node,
42144         /* forbidFunctionClassAndDoExpr */
42145         false)) {
42146           return true;
42147         }
42148
42149         break;
42150       }
42151   }
42152
42153   switch (node.type) {
42154     case "UpdateExpression":
42155       if (parent.type === "UnaryExpression") {
42156         return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
42157       }
42158
42159     // else fallthrough
42160
42161     case "UnaryExpression":
42162       switch (parent.type) {
42163         case "UnaryExpression":
42164           return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
42165
42166         case "BindExpression":
42167           return true;
42168
42169         case "MemberExpression":
42170         case "OptionalMemberExpression":
42171           return name === "object";
42172
42173         case "TaggedTemplateExpression":
42174           return true;
42175
42176         case "NewExpression":
42177         case "CallExpression":
42178         case "OptionalCallExpression":
42179           return name === "callee";
42180
42181         case "BinaryExpression":
42182           return name === "left" && parent.operator === "**";
42183
42184         case "TSNonNullExpression":
42185           return true;
42186
42187         default:
42188           return false;
42189       }
42190
42191     case "BinaryExpression":
42192       {
42193         if (parent.type === "UpdateExpression") {
42194           return true;
42195         } // We add parentheses to any `a in b` inside `ForStatement` initializer
42196         // https://github.com/prettier/prettier/issues/907#issuecomment-284304321
42197
42198
42199         if (node.operator === "in" && isPathInForStatementInitializer(path)) {
42200           return true;
42201         }
42202
42203         if (node.operator === "|>" && node.extra && node.extra.parenthesized) {
42204           const grandParent = path.getParentNode(1);
42205
42206           if (grandParent.type === "BinaryExpression" && grandParent.operator === "|>") {
42207             return true;
42208           }
42209         }
42210       }
42211     // fallthrough
42212
42213     case "TSTypeAssertion":
42214     case "TSAsExpression":
42215     case "LogicalExpression":
42216       switch (parent.type) {
42217         case "TSAsExpression":
42218           // example: foo as unknown as Bar
42219           return node.type !== "TSAsExpression";
42220
42221         case "ConditionalExpression":
42222           return node.type === "TSAsExpression";
42223
42224         case "CallExpression":
42225         case "NewExpression":
42226         case "OptionalCallExpression":
42227           return name === "callee";
42228
42229         case "ClassExpression":
42230         case "ClassDeclaration":
42231           return name === "superClass";
42232
42233         case "TSTypeAssertion":
42234         case "TaggedTemplateExpression":
42235         case "UnaryExpression":
42236         case "JSXSpreadAttribute":
42237         case "SpreadElement":
42238         case "SpreadProperty":
42239         case "BindExpression":
42240         case "AwaitExpression":
42241         case "TSNonNullExpression":
42242         case "UpdateExpression":
42243           return true;
42244
42245         case "MemberExpression":
42246         case "OptionalMemberExpression":
42247           return name === "object";
42248
42249         case "AssignmentExpression":
42250         case "AssignmentPattern":
42251           return name === "left" && (node.type === "TSTypeAssertion" || node.type === "TSAsExpression");
42252
42253         case "LogicalExpression":
42254           if (node.type === "LogicalExpression") {
42255             return parent.operator !== node.operator;
42256           }
42257
42258         // else fallthrough
42259
42260         case "BinaryExpression":
42261           {
42262             const {
42263               operator,
42264               type
42265             } = node;
42266
42267             if (!operator && type !== "TSTypeAssertion") {
42268               return true;
42269             }
42270
42271             const precedence = getPrecedence(operator);
42272             const parentOperator = parent.operator;
42273             const parentPrecedence = getPrecedence(parentOperator);
42274
42275             if (parentPrecedence > precedence) {
42276               return true;
42277             }
42278
42279             if (name === "right" && parentPrecedence === precedence) {
42280               return true;
42281             }
42282
42283             if (parentPrecedence === precedence && !shouldFlatten$1(parentOperator, operator)) {
42284               return true;
42285             }
42286
42287             if (parentPrecedence < precedence && operator === "%") {
42288               return parentOperator === "+" || parentOperator === "-";
42289             } // Add parenthesis when working with bitwise operators
42290             // It's not strictly needed but helps with code understanding
42291
42292
42293             if (isBitwiseOperator(parentOperator)) {
42294               return true;
42295             }
42296
42297             return false;
42298           }
42299
42300         default:
42301           return false;
42302       }
42303
42304     case "SequenceExpression":
42305       switch (parent.type) {
42306         case "ReturnStatement":
42307           return false;
42308
42309         case "ForStatement":
42310           // Although parentheses wouldn't hurt around sequence
42311           // expressions in the head of for loops, traditional style
42312           // dictates that e.g. i++, j++ should not be wrapped with
42313           // parentheses.
42314           return false;
42315
42316         case "ExpressionStatement":
42317           return name !== "expression";
42318
42319         case "ArrowFunctionExpression":
42320           // We do need parentheses, but SequenceExpressions are handled
42321           // specially when printing bodies of arrow functions.
42322           return name !== "body";
42323
42324         default:
42325           // Otherwise err on the side of overparenthesization, adding
42326           // explicit exceptions above if this proves overzealous.
42327           return true;
42328       }
42329
42330     case "YieldExpression":
42331       if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || parent.type === "TSAsExpression" || parent.type === "TSNonNullExpression") {
42332         return true;
42333       }
42334
42335     // else fallthrough
42336
42337     case "AwaitExpression":
42338       switch (parent.type) {
42339         case "TaggedTemplateExpression":
42340         case "UnaryExpression":
42341         case "LogicalExpression":
42342         case "SpreadElement":
42343         case "SpreadProperty":
42344         case "TSAsExpression":
42345         case "TSNonNullExpression":
42346         case "BindExpression":
42347           return true;
42348
42349         case "MemberExpression":
42350         case "OptionalMemberExpression":
42351           return name === "object";
42352
42353         case "NewExpression":
42354         case "CallExpression":
42355         case "OptionalCallExpression":
42356           return name === "callee";
42357
42358         case "ConditionalExpression":
42359           return name === "test";
42360
42361         case "BinaryExpression":
42362           {
42363             if (!node.argument && parent.operator === "|>") {
42364               return false;
42365             }
42366
42367             return true;
42368           }
42369
42370         default:
42371           return false;
42372       }
42373
42374     case "TSConditionalType":
42375       if (name === "extendsType" && parent.type === "TSConditionalType") {
42376         return true;
42377       }
42378
42379     // fallthrough
42380
42381     case "TSFunctionType":
42382     case "TSConstructorType":
42383       if (name === "checkType" && parent.type === "TSConditionalType") {
42384         return true;
42385       }
42386
42387     // fallthrough
42388
42389     case "TSUnionType":
42390     case "TSIntersectionType":
42391       if ((parent.type === "TSUnionType" || parent.type === "TSIntersectionType") && parent.types.length > 1 && (!node.types || node.types.length > 1)) {
42392         return true;
42393       }
42394
42395     // fallthrough
42396
42397     case "TSInferType":
42398       if (node.type === "TSInferType" && parent.type === "TSRestType") {
42399         return false;
42400       }
42401
42402     // fallthrough
42403
42404     case "TSTypeOperator":
42405       return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || name === "objectType" && parent.type === "TSIndexedAccessType" || parent.type === "TSTypeOperator" || parent.type === "TSTypeAnnotation" && path.getParentNode(1).type.startsWith("TSJSDoc");
42406
42407     case "ArrayTypeAnnotation":
42408       return parent.type === "NullableTypeAnnotation";
42409
42410     case "IntersectionTypeAnnotation":
42411     case "UnionTypeAnnotation":
42412       return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
42413
42414     case "NullableTypeAnnotation":
42415       return parent.type === "ArrayTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
42416
42417     case "FunctionTypeAnnotation":
42418       {
42419         const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
42420         return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || name === "objectType" && (ancestor.type === "IndexedAccessType" || ancestor.type === "OptionalIndexedAccessType") || // We should check ancestor's parent to know whether the parentheses
42421         // are really needed, but since ??T doesn't make sense this check
42422         // will almost never be true.
42423         ancestor.type === "NullableTypeAnnotation" || // See #5283
42424         parent.type === "FunctionTypeParam" && parent.name === null && getFunctionParameters$4(node).some(param => param.typeAnnotation && param.typeAnnotation.type === "NullableTypeAnnotation");
42425       }
42426
42427     case "OptionalIndexedAccessType":
42428       return name === "objectType" && parent.type === "IndexedAccessType";
42429
42430     case "TypeofTypeAnnotation":
42431       return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
42432
42433     case "StringLiteral":
42434     case "NumericLiteral":
42435     case "Literal":
42436       if (typeof node.value === "string" && parent.type === "ExpressionStatement" && !parent.directive) {
42437         // To avoid becoming a directive
42438         const grandParent = path.getParentNode(1);
42439         return grandParent.type === "Program" || grandParent.type === "BlockStatement";
42440       }
42441
42442       return name === "object" && parent.type === "MemberExpression" && typeof node.value === "number";
42443
42444     case "AssignmentExpression":
42445       {
42446         const grandParent = path.getParentNode(1);
42447
42448         if (name === "body" && parent.type === "ArrowFunctionExpression") {
42449           return true;
42450         }
42451
42452         if (name === "key" && (parent.type === "ClassProperty" || parent.type === "PropertyDefinition") && parent.computed) {
42453           return false;
42454         }
42455
42456         if ((name === "init" || name === "update") && parent.type === "ForStatement") {
42457           return false;
42458         }
42459
42460         if (parent.type === "ExpressionStatement") {
42461           return node.left.type === "ObjectPattern";
42462         }
42463
42464         if (name === "key" && parent.type === "TSPropertySignature") {
42465           return false;
42466         }
42467
42468         if (parent.type === "AssignmentExpression") {
42469           return false;
42470         }
42471
42472         if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
42473           return false;
42474         }
42475
42476         if (name === "value" && parent.type === "Property" && grandParent && grandParent.type === "ObjectPattern" && grandParent.properties.includes(parent)) {
42477           return false;
42478         }
42479
42480         if (parent.type === "NGChainedExpression") {
42481           return false;
42482         }
42483
42484         return true;
42485       }
42486
42487     case "ConditionalExpression":
42488       switch (parent.type) {
42489         case "TaggedTemplateExpression":
42490         case "UnaryExpression":
42491         case "SpreadElement":
42492         case "SpreadProperty":
42493         case "BinaryExpression":
42494         case "LogicalExpression":
42495         case "NGPipeExpression":
42496         case "ExportDefaultDeclaration":
42497         case "AwaitExpression":
42498         case "JSXSpreadAttribute":
42499         case "TSTypeAssertion":
42500         case "TypeCastExpression":
42501         case "TSAsExpression":
42502         case "TSNonNullExpression":
42503           return true;
42504
42505         case "NewExpression":
42506         case "CallExpression":
42507         case "OptionalCallExpression":
42508           return name === "callee";
42509
42510         case "ConditionalExpression":
42511           return name === "test";
42512
42513         case "MemberExpression":
42514         case "OptionalMemberExpression":
42515           return name === "object";
42516
42517         default:
42518           return false;
42519       }
42520
42521     case "FunctionExpression":
42522       switch (parent.type) {
42523         case "NewExpression":
42524         case "CallExpression":
42525         case "OptionalCallExpression":
42526           // Not always necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses.
42527           // Is necessary if it is `expression` of `ExpressionStatement`.
42528           return name === "callee";
42529
42530         case "TaggedTemplateExpression":
42531           return true;
42532         // This is basically a kind of IIFE.
42533
42534         default:
42535           return false;
42536       }
42537
42538     case "ArrowFunctionExpression":
42539       switch (parent.type) {
42540         case "BinaryExpression":
42541           return parent.operator !== "|>" || node.extra && node.extra.parenthesized;
42542
42543         case "NewExpression":
42544         case "CallExpression":
42545         case "OptionalCallExpression":
42546           return name === "callee";
42547
42548         case "MemberExpression":
42549         case "OptionalMemberExpression":
42550           return name === "object";
42551
42552         case "TSAsExpression":
42553         case "TSNonNullExpression":
42554         case "BindExpression":
42555         case "TaggedTemplateExpression":
42556         case "UnaryExpression":
42557         case "LogicalExpression":
42558         case "AwaitExpression":
42559         case "TSTypeAssertion":
42560           return true;
42561
42562         case "ConditionalExpression":
42563           return name === "test";
42564
42565         default:
42566           return false;
42567       }
42568
42569     case "ClassExpression":
42570       switch (parent.type) {
42571         case "NewExpression":
42572           return name === "callee";
42573
42574         default:
42575           return false;
42576       }
42577
42578     case "OptionalMemberExpression":
42579     case "OptionalCallExpression":
42580       {
42581         const parentParent = path.getParentNode(1);
42582
42583         if (name === "object" && parent.type === "MemberExpression" || name === "callee" && (parent.type === "CallExpression" || parent.type === "NewExpression") || parent.type === "TSNonNullExpression" && parentParent.type === "MemberExpression" && parentParent.object === parent) {
42584           return true;
42585         }
42586       }
42587     // fallthrough
42588
42589     case "CallExpression":
42590     case "MemberExpression":
42591     case "TaggedTemplateExpression":
42592     case "TSNonNullExpression":
42593       if (name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression")) {
42594         let object = node;
42595
42596         while (object) {
42597           switch (object.type) {
42598             case "CallExpression":
42599             case "OptionalCallExpression":
42600               return true;
42601
42602             case "MemberExpression":
42603             case "OptionalMemberExpression":
42604             case "BindExpression":
42605               object = object.object;
42606               break;
42607             // tagged templates are basically member expressions from a grammar perspective
42608             // see https://tc39.github.io/ecma262/#prod-MemberExpression
42609
42610             case "TaggedTemplateExpression":
42611               object = object.tag;
42612               break;
42613
42614             case "TSNonNullExpression":
42615               object = object.expression;
42616               break;
42617
42618             default:
42619               return false;
42620           }
42621         }
42622       }
42623
42624       return false;
42625
42626     case "BindExpression":
42627       return name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression") || name === "object" && isMemberExpression$7(parent);
42628
42629     case "NGPipeExpression":
42630       if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" && // Preserve parens for compatibility with AngularJS expressions
42631       !(node.extra && node.extra.parenthesized) || parent.type === "ArrayExpression" || isCallExpression$b(parent) && parent.arguments[name] === node || name === "right" && parent.type === "NGPipeExpression" || name === "property" && parent.type === "MemberExpression" || parent.type === "AssignmentExpression") {
42632         return false;
42633       }
42634
42635       return true;
42636
42637     case "JSXFragment":
42638     case "JSXElement":
42639       return name === "callee" || name === "left" && parent.type === "BinaryExpression" && parent.operator === "<" || parent.type !== "ArrayExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "AssignmentExpression" && parent.type !== "AssignmentPattern" && parent.type !== "BinaryExpression" && parent.type !== "NewExpression" && parent.type !== "ConditionalExpression" && parent.type !== "ExpressionStatement" && parent.type !== "JsExpressionRoot" && parent.type !== "JSXAttribute" && parent.type !== "JSXElement" && parent.type !== "JSXExpressionContainer" && parent.type !== "JSXFragment" && parent.type !== "LogicalExpression" && !isCallExpression$b(parent) && !isObjectProperty$3(parent) && parent.type !== "ReturnStatement" && parent.type !== "ThrowStatement" && parent.type !== "TypeCastExpression" && parent.type !== "VariableDeclarator" && parent.type !== "YieldExpression";
42640
42641     case "TypeAnnotation":
42642       return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
42643   }
42644
42645   return false;
42646 }
42647
42648 function isStatement(node) {
42649   return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "PropertyDefinition" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
42650 }
42651
42652 function isPathInForStatementInitializer(path) {
42653   let i = 0;
42654   let node = path.getValue();
42655
42656   while (node) {
42657     const parent = path.getParentNode(i++);
42658
42659     if (parent && parent.type === "ForStatement" && parent.init === node) {
42660       return true;
42661     }
42662
42663     node = parent;
42664   }
42665
42666   return false;
42667 }
42668
42669 function includesFunctionTypeInObjectType(node) {
42670   return hasNode$1(node, n1 => n1.type === "ObjectTypeAnnotation" && hasNode$1(n1, n2 => n2.type === "FunctionTypeAnnotation" || undefined) || undefined);
42671 }
42672
42673 function endsWithRightBracket(node) {
42674   switch (node.type) {
42675     case "ObjectExpression":
42676       return true;
42677
42678     default:
42679       return false;
42680   }
42681 }
42682
42683 function isFollowedByRightBracket(path) {
42684   const node = path.getValue();
42685   const parent = path.getParentNode();
42686   const name = path.getName();
42687
42688   switch (parent.type) {
42689     case "NGPipeExpression":
42690       if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
42691         return path.callParent(isFollowedByRightBracket);
42692       }
42693
42694       break;
42695
42696     case "ObjectProperty":
42697       if (name === "value") {
42698         const parentParent = path.getParentNode(1);
42699         return getLast$i(parentParent.properties) === parent;
42700       }
42701
42702       break;
42703
42704     case "BinaryExpression":
42705     case "LogicalExpression":
42706       if (name === "right") {
42707         return path.callParent(isFollowedByRightBracket);
42708       }
42709
42710       break;
42711
42712     case "ConditionalExpression":
42713       if (name === "alternate") {
42714         return path.callParent(isFollowedByRightBracket);
42715       }
42716
42717       break;
42718
42719     case "UnaryExpression":
42720       if (parent.prefix) {
42721         return path.callParent(isFollowedByRightBracket);
42722       }
42723
42724       break;
42725   }
42726
42727   return false;
42728 }
42729
42730 function shouldWrapFunctionForExportDefault(path, options) {
42731   const node = path.getValue();
42732   const parent = path.getParentNode();
42733
42734   if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
42735     return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped
42736     // (e.g. `export default (function() {})();`)
42737     // in this case we don't need to add extra parens
42738     !needsParens(path, options);
42739   }
42740
42741   if (!hasNakedLeftSide$2(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
42742     return false;
42743   }
42744
42745   return path.call(childPath => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName$1(path, node));
42746 }
42747
42748 var needsParens_1 = needsParens;
42749
42750 function preprocess$8(ast, options) {
42751   switch (options.parser) {
42752     case "json":
42753     case "json5":
42754     case "json-stringify":
42755     case "__js_expression":
42756     case "__vue_expression":
42757       return Object.assign(Object.assign({}, ast), {}, {
42758         type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
42759         node: ast,
42760         comments: [],
42761         rootMarker: options.rootMarker
42762       });
42763
42764     default:
42765       return ast;
42766   }
42767 }
42768
42769 var printPreprocess$3 = preprocess$8;
42770
42771 const {
42772   builders: {
42773     join: join$s,
42774     line: line$x,
42775     group: group$A,
42776     softline: softline$q,
42777     indent: indent$t
42778   }
42779 } = require$$7$3;
42780
42781 function printHtmlBinding$1(path, options, print) {
42782   const node = path.getValue();
42783
42784   if (options.__onHtmlBindingRoot && path.getName() === null) {
42785     options.__onHtmlBindingRoot(node, options);
42786   }
42787
42788   if (node.type !== "File") {
42789     return;
42790   }
42791
42792   if (options.__isVueForBindingLeft) {
42793     return path.call(functionDeclarationPath => {
42794       const printed = join$s([",", line$x], functionDeclarationPath.map(print, "params"));
42795       const {
42796         params
42797       } = functionDeclarationPath.getValue();
42798
42799       if (params.length === 1) {
42800         return printed;
42801       }
42802
42803       return ["(", indent$t([softline$q, group$A(printed)]), softline$q, ")"];
42804     }, "program", "body", 0);
42805   }
42806
42807   if (options.__isVueBindings) {
42808     return path.call(functionDeclarationPath => join$s([",", line$x], functionDeclarationPath.map(print, "params")), "program", "body", 0);
42809   }
42810 } // based on https://github.com/prettier/prettier/blob/main/src/language-html/syntax-vue.js isVueEventBindingExpression()
42811
42812
42813 function isVueEventBindingExpression$3(node) {
42814   switch (node.type) {
42815     case "MemberExpression":
42816       switch (node.property.type) {
42817         case "Identifier":
42818         case "NumericLiteral":
42819         case "StringLiteral":
42820           return isVueEventBindingExpression$3(node.object);
42821       }
42822
42823       return false;
42824
42825     case "Identifier":
42826       return true;
42827
42828     default:
42829       return false;
42830   }
42831 }
42832
42833 var htmlBinding = {
42834   isVueEventBindingExpression: isVueEventBindingExpression$3,
42835   printHtmlBinding: printHtmlBinding$1
42836 };
42837
42838 const {
42839   printComments: printComments$5
42840 } = comments$4;
42841 const {
42842   getLast: getLast$h
42843 } = util$8;
42844 const {
42845   builders: {
42846     join: join$r,
42847     line: line$w,
42848     softline: softline$p,
42849     group: group$z,
42850     indent: indent$s,
42851     align: align$4,
42852     ifBreak: ifBreak$m,
42853     indentIfBreak: indentIfBreak$3
42854   },
42855   utils: {
42856     cleanDoc: cleanDoc$2,
42857     getDocParts: getDocParts$6,
42858     isConcat: isConcat$1
42859   }
42860 } = require$$7$3;
42861 const {
42862   hasLeadingOwnLineComment: hasLeadingOwnLineComment$3,
42863   isBinaryish: isBinaryish$3,
42864   isJsxNode: isJsxNode$5,
42865   shouldFlatten,
42866   hasComment: hasComment$g,
42867   CommentCheckFlags: CommentCheckFlags$d,
42868   isCallExpression: isCallExpression$a,
42869   isMemberExpression: isMemberExpression$6,
42870   isObjectProperty: isObjectProperty$2,
42871   isEnabledHackPipeline
42872 } = utils$5;
42873 /** @typedef {import("../../document").Doc} Doc */
42874
42875 let uid = 0;
42876
42877 function printBinaryishExpression$2(path, options, print) {
42878   const node = path.getValue();
42879   const parent = path.getParentNode();
42880   const parentParent = path.getParentNode(1);
42881   const isInsideParenthesis = node !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
42882   const isHackPipeline = isEnabledHackPipeline(options) && node.operator === "|>";
42883   const parts = printBinaryishExpressions(path, print, options,
42884   /* isNested */
42885   false, isInsideParenthesis); //   if (
42886   //     this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft
42887   //   ) {
42888   //
42889   // looks super weird, we want to break the children if the parent breaks
42890   //
42891   //   if (
42892   //     this.hasPlugin("dynamicImports") &&
42893   //     this.lookahead().type === tt.parenLeft
42894   //   ) {
42895
42896   if (isInsideParenthesis) {
42897     return parts;
42898   }
42899
42900   if (isHackPipeline) {
42901     return group$z(parts);
42902   } // Break between the parens in
42903   // unaries or in a member or specific call expression, i.e.
42904   //
42905   //   (
42906   //     a &&
42907   //     b &&
42908   //     c
42909   //   ).call()
42910
42911
42912   if (isCallExpression$a(parent) && parent.callee === node || parent.type === "UnaryExpression" || isMemberExpression$6(parent) && !parent.computed) {
42913     return group$z([indent$s([softline$p, ...parts]), softline$p]);
42914   } // Avoid indenting sub-expressions in some cases where the first sub-expression is already
42915   // indented accordingly. We should indent sub-expressions where the first case isn't indented.
42916
42917
42918   const shouldNotIndent = parent.type === "ReturnStatement" || parent.type === "ThrowStatement" || parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || node.operator !== "|" && parent.type === "JsExpressionRoot" || node.type !== "NGPipeExpression" && (parent.type === "NGRoot" && options.parser === "__ng_binding" || parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || node === parent.body && parent.type === "ArrowFunctionExpression" || node !== parent.body && parent.type === "ForStatement" || parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "ThrowStatement" && !isCallExpression$a(parentParent) || parent.type === "TemplateLiteral";
42919   const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "PropertyDefinition" || parent.type === "TSAbstractPropertyDefinition" || parent.type === "ClassPrivateProperty" || isObjectProperty$2(parent);
42920   const samePrecedenceSubExpression = isBinaryish$3(node.left) && shouldFlatten(node.operator, node.left.operator);
42921
42922   if (shouldNotIndent || shouldInlineLogicalExpression$1(node) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression$1(node) && shouldIndentIfInlining) {
42923     return group$z(parts);
42924   }
42925
42926   if (parts.length === 0) {
42927     return "";
42928   } // If the right part is a JSX node, we include it in a separate group to
42929   // prevent it breaking the whole chain, so we can print the expression like:
42930   //
42931   //   foo && bar && (
42932   //     <Foo>
42933   //       <Bar />
42934   //     </Foo>
42935   //   )
42936
42937
42938   const hasJsx = isJsxNode$5(node.right);
42939   const firstGroupIndex = parts.findIndex(part => typeof part !== "string" && !Array.isArray(part) && part.type === "group"); // Separate the leftmost expression, possibly with its leading comments.
42940
42941   const headParts = parts.slice(0, firstGroupIndex === -1 ? 1 : firstGroupIndex + 1);
42942   const rest = parts.slice(headParts.length, hasJsx ? -1 : undefined);
42943   const groupId = Symbol("logicalChain-" + ++uid);
42944   const chain = group$z([// Don't include the initial expression in the indentation
42945   // level. The first item is guaranteed to be the first
42946   // left-most expression.
42947   ...headParts, indent$s(rest)], {
42948     id: groupId
42949   });
42950
42951   if (!hasJsx) {
42952     return chain;
42953   }
42954
42955   const jsxPart = getLast$h(parts);
42956   return group$z([chain, indentIfBreak$3(jsxPart, {
42957     groupId
42958   })]);
42959 } // For binary expressions to be consistent, we need to group
42960 // subsequent operators with the same precedence level under a single
42961 // group. Otherwise they will be nested such that some of them break
42962 // onto new lines but not all. Operators with the same precedence
42963 // level should either all break or not. Because we group them by
42964 // precedence level and the AST is structured based on precedence
42965 // level, things are naturally broken up correctly, i.e. `&&` is
42966 // broken before `+`.
42967
42968
42969 function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
42970   const node = path.getValue(); // Simply print the node normally.
42971
42972   if (!isBinaryish$3(node)) {
42973     return [group$z(print())];
42974   }
42975   /** @type{Doc[]} */
42976
42977
42978   let parts = []; // We treat BinaryExpression and LogicalExpression nodes the same.
42979   // Put all operators with the same precedence level in the same
42980   // group. The reason we only need to do this with the `left`
42981   // expression is because given an expression like `1 + 2 - 3`, it
42982   // is always parsed like `((1 + 2) - 3)`, meaning the `left` side
42983   // is where the rest of the expression will exist. Binary
42984   // expressions on the right side mean they have a difference
42985   // precedence level and should be treated as a separate group, so
42986   // print them normally. (This doesn't hold for the `**` operator,
42987   // which is unique in that it is right-associative.)
42988
42989   if (shouldFlatten(node.operator, node.left.operator)) {
42990     // Flatten them out by recursively calling this function.
42991     parts = path.call(left => printBinaryishExpressions(left, print, options,
42992     /* isNested */
42993     true, isInsideParenthesis), "left");
42994   } else {
42995     parts.push(group$z(print("left")));
42996   }
42997
42998   const shouldInline = shouldInlineLogicalExpression$1(node);
42999   const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment$3(options.originalText, node.right);
43000   const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
43001   const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length > 0 ? group$z(indent$s([softline$p, ": ", join$r([softline$p, ":", ifBreak$m(" ")], path.map(print, "arguments").map(arg => align$4(2, group$z(arg))))])) : "";
43002   /** @type {Doc} */
43003
43004   let right;
43005
43006   if (shouldInline) {
43007     right = [operator, " ", print("right"), rightSuffix];
43008   } else {
43009     const isHackPipeline = isEnabledHackPipeline(options) && operator === "|>";
43010     const rightContent = isHackPipeline ? path.call(left => printBinaryishExpressions(left, print, options,
43011     /* isNested */
43012     true, isInsideParenthesis), "right") : print("right");
43013     right = [lineBeforeOperator ? line$w : "", operator, lineBeforeOperator ? " " : line$w, rightContent, rightSuffix];
43014   } // If there's only a single binary expression, we want to create a group
43015   // in order to avoid having a small right part like -1 be on its own line.
43016
43017
43018   const parent = path.getParentNode();
43019   const shouldBreak = hasComment$g(node.left, CommentCheckFlags$d.Trailing | CommentCheckFlags$d.Line);
43020   const shouldGroup = shouldBreak || !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
43021   parts.push(lineBeforeOperator ? "" : " ", shouldGroup ? group$z(right, {
43022     shouldBreak
43023   }) : right); // The root comments are already printed, but we need to manually print
43024   // the other ones since we don't call the normal print on BinaryExpression,
43025   // only for the left and right parts
43026
43027   if (isNested && hasComment$g(node)) {
43028     const printed = cleanDoc$2(printComments$5(path, parts, options));
43029     /* istanbul ignore else */
43030
43031     if (isConcat$1(printed) || printed.type === "fill") {
43032       return getDocParts$6(printed);
43033     }
43034
43035     return [printed];
43036   }
43037
43038   return parts;
43039 }
43040
43041 function shouldInlineLogicalExpression$1(node) {
43042   if (node.type !== "LogicalExpression") {
43043     return false;
43044   }
43045
43046   if (node.right.type === "ObjectExpression" && node.right.properties.length > 0) {
43047     return true;
43048   }
43049
43050   if (node.right.type === "ArrayExpression" && node.right.elements.length > 0) {
43051     return true;
43052   }
43053
43054   if (isJsxNode$5(node.right)) {
43055     return true;
43056   }
43057
43058   return false;
43059 }
43060
43061 var binaryish = {
43062   printBinaryishExpression: printBinaryishExpression$2,
43063   shouldInlineLogicalExpression: shouldInlineLogicalExpression$1
43064 };
43065
43066 const {
43067   builders: {
43068     join: join$q,
43069     line: line$v,
43070     group: group$y
43071   }
43072 } = require$$7$3;
43073 const {
43074   hasNode,
43075   hasComment: hasComment$f,
43076   getComments: getComments$3
43077 } = utils$5;
43078 const {
43079   printBinaryishExpression: printBinaryishExpression$1
43080 } = binaryish;
43081 /** @typedef {import("../../common/ast-path")} AstPath */
43082
43083 function printAngular$1(path, options, print) {
43084   const node = path.getValue(); // Angular nodes always starts with `NG`
43085
43086   if (!node.type.startsWith("NG")) {
43087     return;
43088   }
43089
43090   switch (node.type) {
43091     case "NGRoot":
43092       return [print("node"), !hasComment$f(node.node) ? "" : " //" + getComments$3(node.node)[0].value.trimEnd()];
43093
43094     case "NGPipeExpression":
43095       return printBinaryishExpression$1(path, options, print);
43096
43097     case "NGChainedExpression":
43098       return group$y(join$q([";", line$v], path.map(childPath => hasNgSideEffect(childPath) ? print() : ["(", print(), ")"], "expressions")));
43099
43100     case "NGEmptyExpression":
43101       return "";
43102
43103     case "NGQuotedExpression":
43104       return [node.prefix, ": ", node.value.trim()];
43105
43106     case "NGMicrosyntax":
43107       return path.map((childPath, index) => [index === 0 ? "" : isNgForOf(childPath.getValue(), index, node) ? " " : [";", line$v], print()], "body");
43108
43109     case "NGMicrosyntaxKey":
43110       return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/i.test(node.name) ? node.name : JSON.stringify(node.name);
43111
43112     case "NGMicrosyntaxExpression":
43113       return [print("expression"), node.alias === null ? "" : [" as ", print("alias")]];
43114
43115     case "NGMicrosyntaxKeyedExpression":
43116       {
43117         const index = path.getName();
43118         const parentNode = path.getParentNode();
43119         const shouldNotPrintColon = isNgForOf(node, index, parentNode) || (index === 1 && (node.key.name === "then" || node.key.name === "else") || index === 2 && node.key.name === "else" && parentNode.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && parentNode.body[index - 1].key.name === "then") && parentNode.body[0].type === "NGMicrosyntaxExpression";
43120         return [print("key"), shouldNotPrintColon ? " " : ": ", print("expression")];
43121       }
43122
43123     case "NGMicrosyntaxLet":
43124       return ["let ", print("key"), node.value === null ? "" : [" = ", print("value")]];
43125
43126     case "NGMicrosyntaxAs":
43127       return [print("key"), " as ", print("alias")];
43128
43129     default:
43130       /* istanbul ignore next */
43131       throw new Error(`Unknown Angular node type: ${JSON.stringify(node.type)}.`);
43132   }
43133 }
43134
43135 function isNgForOf(node, index, parentNode) {
43136   return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
43137 }
43138 /** identify if an angular expression seems to have side effects */
43139
43140 /**
43141  * @param {AstPath} path
43142  * @returns {boolean}
43143  */
43144
43145
43146 function hasNgSideEffect(path) {
43147   return hasNode(path.getValue(), node => {
43148     switch (node.type) {
43149       case undefined:
43150         return false;
43151
43152       case "CallExpression":
43153       case "OptionalCallExpression":
43154       case "AssignmentExpression":
43155         return true;
43156     }
43157   });
43158 }
43159
43160 var angular = {
43161   printAngular: printAngular$1
43162 };
43163
43164 const {
43165   printComments: printComments$4,
43166   printDanglingComments: printDanglingComments$d
43167 } = comments$4;
43168 const {
43169   builders: {
43170     line: line$u,
43171     hardline: hardline$w,
43172     softline: softline$o,
43173     group: group$x,
43174     indent: indent$r,
43175     conditionalGroup: conditionalGroup$4,
43176     fill: fill$8,
43177     ifBreak: ifBreak$l,
43178     lineSuffixBoundary,
43179     join: join$p
43180   },
43181   utils: {
43182     willBreak: willBreak$5
43183   }
43184 } = require$$7$3;
43185 const {
43186   getLast: getLast$g,
43187   getPreferredQuote: getPreferredQuote$1
43188 } = util$8;
43189 const {
43190   isJsxNode: isJsxNode$4,
43191   rawText: rawText$4,
43192   isLiteral: isLiteral$2,
43193   isCallExpression: isCallExpression$9,
43194   isStringLiteral: isStringLiteral$4,
43195   isBinaryish: isBinaryish$2,
43196   hasComment: hasComment$e,
43197   CommentCheckFlags: CommentCheckFlags$c,
43198   hasNodeIgnoreComment
43199 } = utils$5;
43200 const pathNeedsParens$5 = needsParens_1;
43201 const {
43202   willPrintOwnComments
43203 } = comments;
43204
43205 const isEmptyStringOrAnyLine = doc => doc === "" || doc === line$u || doc === hardline$w || doc === softline$o;
43206 /**
43207  * @typedef {import("../../common/ast-path")} AstPath
43208  * @typedef {import("../types/estree").Node} Node
43209  * @typedef {import("../types/estree").JSXElement} JSXElement
43210  */
43211 // JSX expands children from the inside-out, instead of the outside-in.
43212 // This is both to break children before attributes,
43213 // and to ensure that when children break, their parents do as well.
43214 //
43215 // Any element that is written without any newlines and fits on a single line
43216 // is left that way.
43217 // Not only that, any user-written-line containing multiple JSX siblings
43218 // should also be kept on one line if possible,
43219 // so each user-written-line is wrapped in its own group.
43220 //
43221 // Elements that contain newlines or don't fit on a single line (recursively)
43222 // are fully-split, using hardline and shouldBreak: true.
43223 //
43224 // To support that case properly, all leading and trailing spaces
43225 // are stripped from the list of children, and replaced with a single hardline.
43226
43227
43228 function printJsxElementInternal(path, options, print) {
43229   const node = path.getValue();
43230
43231   if (node.type === "JSXElement" && isEmptyJsxElement(node)) {
43232     return [print("openingElement"), print("closingElement")];
43233   }
43234
43235   const openingLines = node.type === "JSXElement" ? print("openingElement") : print("openingFragment");
43236   const closingLines = node.type === "JSXElement" ? print("closingElement") : print("closingFragment");
43237
43238   if (node.children.length === 1 && node.children[0].type === "JSXExpressionContainer" && (node.children[0].expression.type === "TemplateLiteral" || node.children[0].expression.type === "TaggedTemplateExpression")) {
43239     return [openingLines, ...path.map(print, "children"), closingLines];
43240   } // Convert `{" "}` to text nodes containing a space.
43241   // This makes it easy to turn them into `jsxWhitespace` which
43242   // can then print as either a space or `{" "}` when breaking.
43243
43244
43245   node.children = node.children.map(child => {
43246     if (isJsxWhitespaceExpression(child)) {
43247       return {
43248         type: "JSXText",
43249         value: " ",
43250         raw: " "
43251       };
43252     }
43253
43254     return child;
43255   });
43256   const containsTag = node.children.some(isJsxNode$4);
43257   const containsMultipleExpressions = node.children.filter(child => child.type === "JSXExpressionContainer").length > 1;
43258   const containsMultipleAttributes = node.type === "JSXElement" && node.openingElement.attributes.length > 1; // Record any breaks. Should never go from true to false, only false to true.
43259
43260   let forcedBreak = willBreak$5(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
43261   const isMdxBlock = path.getParentNode().rootMarker === "mdx";
43262   const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
43263   const jsxWhitespace = isMdxBlock ? " " : ifBreak$l([rawJsxWhitespace, softline$o], " ");
43264   const isFacebookTranslationTag = node.openingElement && node.openingElement.name && node.openingElement.name.name === "fbt";
43265   const children = printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
43266   const containsText = node.children.some(child => isMeaningfulJsxText(child)); // We can end up we multiple whitespace elements with empty string
43267   // content between them.
43268   // We need to remove empty whitespace and softlines before JSX whitespace
43269   // to get the correct output.
43270
43271   for (let i = children.length - 2; i >= 0; i--) {
43272     const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
43273     const isPairOfHardlines = children[i] === hardline$w && children[i + 1] === "" && children[i + 2] === hardline$w;
43274     const isLineFollowedByJsxWhitespace = (children[i] === softline$o || children[i] === hardline$w) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
43275     const isJsxWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline$o || children[i + 2] === hardline$w);
43276     const isDoubleJsxWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
43277     const isPairOfHardOrSoftLines = children[i] === softline$o && children[i + 1] === "" && children[i + 2] === hardline$w || children[i] === hardline$w && children[i + 1] === "" && children[i + 2] === softline$o;
43278
43279     if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJsxWhitespace || isDoubleJsxWhitespace || isPairOfHardOrSoftLines) {
43280       children.splice(i, 2);
43281     } else if (isJsxWhitespaceFollowedByLine) {
43282       children.splice(i + 1, 2);
43283     }
43284   } // Trim trailing lines (or empty strings)
43285
43286
43287   while (children.length > 0 && isEmptyStringOrAnyLine(getLast$g(children))) {
43288     children.pop();
43289   } // Trim leading lines (or empty strings)
43290
43291
43292   while (children.length > 1 && isEmptyStringOrAnyLine(children[0]) && isEmptyStringOrAnyLine(children[1])) {
43293     children.shift();
43294     children.shift();
43295   } // Tweak how we format children if outputting this element over multiple lines.
43296   // Also detect whether we will force this element to output over multiple lines.
43297
43298
43299   const multilineChildren = [];
43300
43301   for (const [i, child] of children.entries()) {
43302     // There are a number of situations where we need to ensure we display
43303     // whitespace as `{" "}` when outputting this element over multiple lines.
43304     if (child === jsxWhitespace) {
43305       if (i === 1 && children[i - 1] === "") {
43306         if (children.length === 2) {
43307           // Solitary whitespace
43308           multilineChildren.push(rawJsxWhitespace);
43309           continue;
43310         } // Leading whitespace
43311
43312
43313         multilineChildren.push([rawJsxWhitespace, hardline$w]);
43314         continue;
43315       } else if (i === children.length - 1) {
43316         // Trailing whitespace
43317         multilineChildren.push(rawJsxWhitespace);
43318         continue;
43319       } else if (children[i - 1] === "" && children[i - 2] === hardline$w) {
43320         // Whitespace after line break
43321         multilineChildren.push(rawJsxWhitespace);
43322         continue;
43323       }
43324     }
43325
43326     multilineChildren.push(child);
43327
43328     if (willBreak$5(child)) {
43329       forcedBreak = true;
43330     }
43331   } // If there is text we use `fill` to fit as much onto each line as possible.
43332   // When there is no text (just tags and expressions) we use `group`
43333   // to output each on a separate line.
43334
43335
43336   const content = containsText ? fill$8(multilineChildren) : group$x(multilineChildren, {
43337     shouldBreak: true
43338   });
43339
43340   if (isMdxBlock) {
43341     return content;
43342   }
43343
43344   const multiLineElem = group$x([openingLines, indent$r([hardline$w, content]), hardline$w, closingLines]);
43345
43346   if (forcedBreak) {
43347     return multiLineElem;
43348   }
43349
43350   return conditionalGroup$4([group$x([openingLines, ...children, closingLines]), multiLineElem]);
43351 } // JSX Children are strange, mostly for two reasons:
43352 // 1. JSX reads newlines into string values, instead of skipping them like JS
43353 // 2. up to one whitespace between elements within a line is significant,
43354 //    but not between lines.
43355 //
43356 // Leading, trailing, and lone whitespace all need to
43357 // turn themselves into the rather ugly `{' '}` when breaking.
43358 //
43359 // We print JSX using the `fill` doc primitive.
43360 // This requires that we give it an array of alternating
43361 // content and whitespace elements.
43362 // To ensure this we add dummy `""` content elements as needed.
43363
43364
43365 function printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
43366   const parts = [];
43367   path.each((childPath, i, children) => {
43368     const child = childPath.getValue();
43369
43370     if (isLiteral$2(child)) {
43371       const text = rawText$4(child); // Contains a non-whitespace character
43372
43373       if (isMeaningfulJsxText(child)) {
43374         const words = text.split(matchJsxWhitespaceRegex); // Starts with whitespace
43375
43376         if (words[0] === "") {
43377           parts.push("");
43378           words.shift();
43379
43380           if (/\n/.test(words[0])) {
43381             const next = children[i + 1];
43382             parts.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
43383           } else {
43384             parts.push(jsxWhitespace);
43385           }
43386
43387           words.shift();
43388         }
43389
43390         let endWhitespace; // Ends with whitespace
43391
43392         if (getLast$g(words) === "") {
43393           words.pop();
43394           endWhitespace = words.pop();
43395         } // This was whitespace only without a new line.
43396
43397
43398         if (words.length === 0) {
43399           return;
43400         }
43401
43402         for (const [i, word] of words.entries()) {
43403           if (i % 2 === 1) {
43404             parts.push(line$u);
43405           } else {
43406             parts.push(word);
43407           }
43408         }
43409
43410         if (endWhitespace !== undefined) {
43411           if (/\n/.test(endWhitespace)) {
43412             const next = children[i + 1];
43413             parts.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$g(parts), child, next));
43414           } else {
43415             parts.push(jsxWhitespace);
43416           }
43417         } else {
43418           const next = children[i + 1];
43419           parts.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$g(parts), child, next));
43420         }
43421       } else if (/\n/.test(text)) {
43422         // Keep (up to one) blank line between tags/expressions/text.
43423         // Note: We don't keep blank lines between text elements.
43424         if (text.match(/\n/g).length > 1) {
43425           parts.push("", hardline$w);
43426         }
43427       } else {
43428         parts.push("", jsxWhitespace);
43429       }
43430     } else {
43431       const printedChild = print();
43432       parts.push(printedChild);
43433       const next = children[i + 1];
43434       const directlyFollowedByMeaningfulText = next && isMeaningfulJsxText(next);
43435
43436       if (directlyFollowedByMeaningfulText) {
43437         const firstWord = trimJsxWhitespace(rawText$4(next)).split(matchJsxWhitespaceRegex)[0];
43438         parts.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
43439       } else {
43440         parts.push(hardline$w);
43441       }
43442     }
43443   }, "children");
43444   return parts;
43445 }
43446
43447 function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
43448   if (isFacebookTranslationTag) {
43449     return "";
43450   }
43451
43452   if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
43453     return child.length === 1 ? softline$o : hardline$w;
43454   }
43455
43456   return softline$o;
43457 }
43458
43459 function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
43460   if (isFacebookTranslationTag) {
43461     return hardline$w;
43462   }
43463
43464   if (child.length === 1) {
43465     return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline$w : softline$o;
43466   }
43467
43468   return hardline$w;
43469 }
43470
43471 function maybeWrapJsxElementInParens(path, elem, options) {
43472   const parent = path.getParentNode();
43473   /* istanbul ignore next */
43474
43475   if (!parent) {
43476     return elem;
43477   }
43478
43479   const NO_WRAP_PARENTS = {
43480     ArrayExpression: true,
43481     JSXAttribute: true,
43482     JSXElement: true,
43483     JSXExpressionContainer: true,
43484     JSXFragment: true,
43485     ExpressionStatement: true,
43486     CallExpression: true,
43487     OptionalCallExpression: true,
43488     ConditionalExpression: true,
43489     JsExpressionRoot: true
43490   };
43491
43492   if (NO_WRAP_PARENTS[parent.type]) {
43493     return elem;
43494   }
43495
43496   const shouldBreak = path.match(undefined, node => node.type === "ArrowFunctionExpression", isCallExpression$9, node => node.type === "JSXExpressionContainer");
43497   const needsParens = pathNeedsParens$5(path, options);
43498   return group$x([needsParens ? "" : ifBreak$l("("), indent$r([softline$o, elem]), softline$o, needsParens ? "" : ifBreak$l(")")], {
43499     shouldBreak
43500   });
43501 }
43502
43503 function printJsxAttribute(path, options, print) {
43504   const node = path.getValue();
43505   const parts = [];
43506   parts.push(print("name"));
43507
43508   if (node.value) {
43509     let res;
43510
43511     if (isStringLiteral$4(node.value)) {
43512       const raw = rawText$4(node.value); // Remove enclosing quotes and unescape
43513       // all quotes so we get an accurate preferred quote
43514
43515       let final = raw.slice(1, -1).replace(/&apos;/g, "'").replace(/&quot;/g, '"');
43516       const {
43517         escaped,
43518         quote,
43519         regex
43520       } = getPreferredQuote$1(final, options.jsxSingleQuote ? "'" : '"');
43521       final = final.replace(regex, escaped);
43522       res = [quote, final, quote];
43523     } else {
43524       res = print("value");
43525     }
43526
43527     parts.push("=", res);
43528   }
43529
43530   return parts;
43531 }
43532
43533 function printJsxExpressionContainer(path, options, print) {
43534   const node = path.getValue();
43535   const parent = path.getParentNode(0);
43536   const shouldInline = node.expression.type === "JSXEmptyExpression" || !hasComment$e(node.expression) && (node.expression.type === "ArrayExpression" || node.expression.type === "ObjectExpression" || node.expression.type === "ArrowFunctionExpression" || isCallExpression$9(node.expression) || node.expression.type === "FunctionExpression" || node.expression.type === "TemplateLiteral" || node.expression.type === "TaggedTemplateExpression" || node.expression.type === "DoExpression" || isJsxNode$4(parent) && (node.expression.type === "ConditionalExpression" || isBinaryish$2(node.expression)));
43537
43538   if (shouldInline) {
43539     return group$x(["{", print("expression"), lineSuffixBoundary, "}"]);
43540   }
43541
43542   return group$x(["{", indent$r([softline$o, print("expression")]), softline$o, lineSuffixBoundary, "}"]);
43543 }
43544
43545 function printJsxOpeningElement(path, options, print) {
43546   const node = path.getValue();
43547   const nameHasComments = node.name && hasComment$e(node.name) || node.typeParameters && hasComment$e(node.typeParameters); // Don't break self-closing elements with no attributes and no comments
43548
43549   if (node.selfClosing && node.attributes.length === 0 && !nameHasComments) {
43550     return ["<", print("name"), print("typeParameters"), " />"];
43551   } // don't break up opening elements with a single long text attribute
43552
43553
43554   if (node.attributes && node.attributes.length === 1 && node.attributes[0].value && isStringLiteral$4(node.attributes[0].value) && !node.attributes[0].value.value.includes("\n") && // We should break for the following cases:
43555   // <div
43556   //   // comment
43557   //   attr="value"
43558   // >
43559   // <div
43560   //   attr="value"
43561   //   // comment
43562   // >
43563   !nameHasComments && !hasComment$e(node.attributes[0])) {
43564     return group$x(["<", print("name"), print("typeParameters"), " ", ...path.map(print, "attributes"), node.selfClosing ? " />" : ">"]);
43565   }
43566
43567   const lastAttrHasTrailingComments = node.attributes.length > 0 && hasComment$e(getLast$g(node.attributes), CommentCheckFlags$c.Trailing);
43568   const bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be
43569   // kept unbroken regardless of `bracketSameLine`.
43570   // jsxBracketSameLine is deprecated in favour of bracketSameLine,
43571   // but is still needed for backwards compatibility.
43572   node.attributes.length === 0 && !nameHasComments || (options.bracketSameLine || options.jsxBracketSameLine) && ( // We should print the bracket in a new line for the following cases:
43573   // <div
43574   //   // comment
43575   // >
43576   // <div
43577   //   attr // comment
43578   // >
43579   !nameHasComments || node.attributes.length > 0) && !lastAttrHasTrailingComments; // We should print the opening element expanded if any prop value is a
43580   // string literal with newlines
43581
43582   const shouldBreak = node.attributes && node.attributes.some(attr => attr.value && isStringLiteral$4(attr.value) && attr.value.value.includes("\n"));
43583   return group$x(["<", print("name"), print("typeParameters"), indent$r(path.map(() => [line$u, print()], "attributes")), node.selfClosing ? line$u : bracketSameLine ? ">" : softline$o, node.selfClosing ? "/>" : bracketSameLine ? "" : ">"], {
43584     shouldBreak
43585   });
43586 }
43587
43588 function printJsxClosingElement(path, options, print) {
43589   const node = path.getValue();
43590   const parts = [];
43591   parts.push("</");
43592   const printed = print("name");
43593
43594   if (hasComment$e(node.name, CommentCheckFlags$c.Leading | CommentCheckFlags$c.Line)) {
43595     parts.push(indent$r([hardline$w, printed]), hardline$w);
43596   } else if (hasComment$e(node.name, CommentCheckFlags$c.Leading | CommentCheckFlags$c.Block)) {
43597     parts.push(" ", printed);
43598   } else {
43599     parts.push(printed);
43600   }
43601
43602   parts.push(">");
43603   return parts;
43604 }
43605
43606 function printJsxOpeningClosingFragment(path, options
43607 /*, print*/
43608 ) {
43609   const node = path.getValue();
43610   const nodeHasComment = hasComment$e(node);
43611   const hasOwnLineComment = hasComment$e(node, CommentCheckFlags$c.Line);
43612   const isOpeningFragment = node.type === "JSXOpeningFragment";
43613   return [isOpeningFragment ? "<" : "</", indent$r([hasOwnLineComment ? hardline$w : nodeHasComment && !isOpeningFragment ? " " : "", printDanglingComments$d(path, options, true)]), hasOwnLineComment ? hardline$w : "", ">"];
43614 }
43615
43616 function printJsxElement(path, options, print) {
43617   const elem = printComments$4(path, printJsxElementInternal(path, options, print), options);
43618   return maybeWrapJsxElementInParens(path, elem, options);
43619 }
43620
43621 function printJsxEmptyExpression(path, options
43622 /*, print*/
43623 ) {
43624   const node = path.getValue();
43625   const requiresHardline = hasComment$e(node, CommentCheckFlags$c.Line);
43626   return [printDanglingComments$d(path, options,
43627   /* sameIndent */
43628   !requiresHardline), requiresHardline ? hardline$w : ""];
43629 } // `JSXSpreadAttribute` and `JSXSpreadChild`
43630
43631
43632 function printJsxSpreadAttribute(path, options, print) {
43633   const node = path.getValue();
43634   return ["{", path.call(p => {
43635     const printed = ["...", print()];
43636     const node = p.getValue();
43637
43638     if (!hasComment$e(node) || !willPrintOwnComments(p)) {
43639       return printed;
43640     }
43641
43642     return [indent$r([softline$o, printComments$4(p, printed, options)]), softline$o];
43643   }, node.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
43644 }
43645
43646 function printJsx$1(path, options, print) {
43647   const node = path.getValue(); // JSX nodes always starts with `JSX`
43648
43649   if (!node.type.startsWith("JSX")) {
43650     return;
43651   }
43652
43653   switch (node.type) {
43654     case "JSXAttribute":
43655       return printJsxAttribute(path, options, print);
43656
43657     case "JSXIdentifier":
43658       return String(node.name);
43659
43660     case "JSXNamespacedName":
43661       return join$p(":", [print("namespace"), print("name")]);
43662
43663     case "JSXMemberExpression":
43664       return join$p(".", [print("object"), print("property")]);
43665
43666     case "JSXSpreadAttribute":
43667       return printJsxSpreadAttribute(path, options, print);
43668
43669     case "JSXSpreadChild":
43670       {
43671         // Same as `printJsxSpreadAttribute`
43672         const printJsxSpreadChild = printJsxSpreadAttribute;
43673         return printJsxSpreadChild(path, options, print);
43674       }
43675
43676     case "JSXExpressionContainer":
43677       return printJsxExpressionContainer(path, options, print);
43678
43679     case "JSXFragment":
43680     case "JSXElement":
43681       return printJsxElement(path, options, print);
43682
43683     case "JSXOpeningElement":
43684       return printJsxOpeningElement(path, options, print);
43685
43686     case "JSXClosingElement":
43687       return printJsxClosingElement(path, options, print);
43688
43689     case "JSXOpeningFragment":
43690     case "JSXClosingFragment":
43691       return printJsxOpeningClosingFragment(path, options
43692       /*, print*/
43693       );
43694
43695     case "JSXEmptyExpression":
43696       return printJsxEmptyExpression(path, options
43697       /*, print*/
43698       );
43699
43700     case "JSXText":
43701       /* istanbul ignore next */
43702       throw new Error("JSXTest should be handled by JSXElement");
43703
43704     default:
43705       /* istanbul ignore next */
43706       throw new Error(`Unknown JSX node type: ${JSON.stringify(node.type)}.`);
43707   }
43708 } // Only space, newline, carriage return, and tab are treated as whitespace
43709 // inside JSX.
43710
43711
43712 const jsxWhitespaceChars = " \n\r\t";
43713 const matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
43714 const containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]");
43715
43716 const trimJsxWhitespace = text => text.replace(new RegExp("(?:^" + matchJsxWhitespaceRegex.source + "|" + matchJsxWhitespaceRegex.source + "$)"), "");
43717 /**
43718  * @param {JSXElement} node
43719  * @returns {boolean}
43720  */
43721
43722
43723 function isEmptyJsxElement(node) {
43724   if (node.children.length === 0) {
43725     return true;
43726   }
43727
43728   if (node.children.length > 1) {
43729     return false;
43730   } // if there is one text child and does not contain any meaningful text
43731   // we can treat the element as empty.
43732
43733
43734   const child = node.children[0];
43735   return isLiteral$2(child) && !isMeaningfulJsxText(child);
43736 } // Meaningful if it contains non-whitespace characters,
43737 // or it contains whitespace without a new line.
43738
43739 /**
43740  * @param {Node} node
43741  * @returns {boolean}
43742  */
43743
43744
43745 function isMeaningfulJsxText(node) {
43746   return isLiteral$2(node) && (containsNonJsxWhitespaceRegex.test(rawText$4(node)) || !/\n/.test(rawText$4(node)));
43747 } // Detect an expression node representing `{" "}`
43748
43749
43750 function isJsxWhitespaceExpression(node) {
43751   return node.type === "JSXExpressionContainer" && isLiteral$2(node.expression) && node.expression.value === " " && !hasComment$e(node.expression);
43752 }
43753 /**
43754  * @param {AstPath} path
43755  * @returns {boolean}
43756  */
43757
43758
43759 function hasJsxIgnoreComment$1(path) {
43760   const node = path.getValue();
43761   const parent = path.getParentNode();
43762
43763   if (!parent || !node || !isJsxNode$4(node) || !isJsxNode$4(parent)) {
43764     return false;
43765   } // Lookup the previous sibling, ignoring any empty JSXText elements
43766
43767
43768   const index = parent.children.indexOf(node);
43769   let prevSibling = null;
43770
43771   for (let i = index; i > 0; i--) {
43772     const candidate = parent.children[i - 1];
43773
43774     if (candidate.type === "JSXText" && !isMeaningfulJsxText(candidate)) {
43775       continue;
43776     }
43777
43778     prevSibling = candidate;
43779     break;
43780   }
43781
43782   return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && hasNodeIgnoreComment(prevSibling.expression);
43783 }
43784
43785 var jsx = {
43786   hasJsxIgnoreComment: hasJsxIgnoreComment$1,
43787   printJsx: printJsx$1
43788 };
43789
43790 var $ = _export;
43791 var flattenIntoArray = flattenIntoArray_1;
43792 var toObject = toObject$4;
43793 var lengthOfArrayLike = lengthOfArrayLike$6;
43794 var toIntegerOrInfinity = toIntegerOrInfinity$3;
43795 var arraySpeciesCreate = arraySpeciesCreate$2;
43796
43797 // `Array.prototype.flat` method
43798 // https://tc39.es/ecma262/#sec-array.prototype.flat
43799 $({ target: 'Array', proto: true }, {
43800   flat: function flat(/* depthArg = 1 */) {
43801     var depthArg = arguments.length ? arguments[0] : undefined;
43802     var O = toObject(this);
43803     var sourceLen = lengthOfArrayLike(O);
43804     var A = arraySpeciesCreate(O, 0);
43805     A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
43806     return A;
43807   }
43808 });
43809
43810 var internalObjectKeys = objectKeysInternal;
43811 var enumBugKeys$1 = enumBugKeys$3;
43812
43813 // `Object.keys` method
43814 // https://tc39.es/ecma262/#sec-object.keys
43815 // eslint-disable-next-line es/no-object-keys -- safe
43816 var objectKeys$1 = Object.keys || function keys(O) {
43817   return internalObjectKeys(O, enumBugKeys$1);
43818 };
43819
43820 var DESCRIPTORS = descriptors$1;
43821 var definePropertyModule$1 = objectDefineProperty;
43822 var anObject$1 = anObject$7;
43823 var toIndexedObject = toIndexedObject$4;
43824 var objectKeys = objectKeys$1;
43825
43826 // `Object.defineProperties` method
43827 // https://tc39.es/ecma262/#sec-object.defineproperties
43828 // eslint-disable-next-line es/no-object-defineproperties -- safe
43829 var objectDefineProperties = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
43830   anObject$1(O);
43831   var props = toIndexedObject(Properties);
43832   var keys = objectKeys(Properties);
43833   var length = keys.length;
43834   var index = 0;
43835   var key;
43836   while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]);
43837   return O;
43838 };
43839
43840 var getBuiltIn = getBuiltIn$5;
43841
43842 var html$2 = getBuiltIn('document', 'documentElement');
43843
43844 /* global ActiveXObject -- old IE, WSH */
43845
43846 var anObject = anObject$7;
43847 var defineProperties = objectDefineProperties;
43848 var enumBugKeys = enumBugKeys$3;
43849 var hiddenKeys = hiddenKeys$4;
43850 var html$1 = html$2;
43851 var documentCreateElement = documentCreateElement$1;
43852 var sharedKey = sharedKey$2;
43853
43854 var GT = '>';
43855 var LT = '<';
43856 var PROTOTYPE = 'prototype';
43857 var SCRIPT = 'script';
43858 var IE_PROTO = sharedKey('IE_PROTO');
43859
43860 var EmptyConstructor = function () { /* empty */ };
43861
43862 var scriptTag = function (content) {
43863   return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
43864 };
43865
43866 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
43867 var NullProtoObjectViaActiveX = function (activeXDocument) {
43868   activeXDocument.write(scriptTag(''));
43869   activeXDocument.close();
43870   var temp = activeXDocument.parentWindow.Object;
43871   activeXDocument = null; // avoid memory leak
43872   return temp;
43873 };
43874
43875 // Create object with fake `null` prototype: use iframe Object with cleared prototype
43876 var NullProtoObjectViaIFrame = function () {
43877   // Thrash, waste and sodomy: IE GC bug
43878   var iframe = documentCreateElement('iframe');
43879   var JS = 'java' + SCRIPT + ':';
43880   var iframeDocument;
43881   iframe.style.display = 'none';
43882   html$1.appendChild(iframe);
43883   // https://github.com/zloirock/core-js/issues/475
43884   iframe.src = String(JS);
43885   iframeDocument = iframe.contentWindow.document;
43886   iframeDocument.open();
43887   iframeDocument.write(scriptTag('document.F=Object'));
43888   iframeDocument.close();
43889   return iframeDocument.F;
43890 };
43891
43892 // Check for document.domain and active x support
43893 // No need to use active x approach when document.domain is not set
43894 // see https://github.com/es-shims/es5-shim/issues/150
43895 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
43896 // avoid IE GC bug
43897 var activeXDocument;
43898 var NullProtoObject = function () {
43899   try {
43900     activeXDocument = new ActiveXObject('htmlfile');
43901   } catch (error) { /* ignore */ }
43902   NullProtoObject = typeof document != 'undefined'
43903     ? document.domain && activeXDocument
43904       ? NullProtoObjectViaActiveX(activeXDocument) // old IE
43905       : NullProtoObjectViaIFrame()
43906     : NullProtoObjectViaActiveX(activeXDocument); // WSH
43907   var length = enumBugKeys.length;
43908   while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
43909   return NullProtoObject();
43910 };
43911
43912 hiddenKeys[IE_PROTO] = true;
43913
43914 // `Object.create` method
43915 // https://tc39.es/ecma262/#sec-object.create
43916 var objectCreate = Object.create || function create(O, Properties) {
43917   var result;
43918   if (O !== null) {
43919     EmptyConstructor[PROTOTYPE] = anObject(O);
43920     result = new EmptyConstructor();
43921     EmptyConstructor[PROTOTYPE] = null;
43922     // add "__proto__" for Object.getPrototypeOf polyfill
43923     result[IE_PROTO] = O;
43924   } else result = NullProtoObject();
43925   return Properties === undefined ? result : defineProperties(result, Properties);
43926 };
43927
43928 var wellKnownSymbol = wellKnownSymbol$7;
43929 var create = objectCreate;
43930 var definePropertyModule = objectDefineProperty;
43931
43932 var UNSCOPABLES = wellKnownSymbol('unscopables');
43933 var ArrayPrototype = Array.prototype;
43934
43935 // Array.prototype[@@unscopables]
43936 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
43937 if (ArrayPrototype[UNSCOPABLES] == undefined) {
43938   definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
43939     configurable: true,
43940     value: create(null)
43941   });
43942 }
43943
43944 // add a key to Array.prototype[@@unscopables]
43945 var addToUnscopables$1 = function (key) {
43946   ArrayPrototype[UNSCOPABLES][key] = true;
43947 };
43948
43949 // this method was added to unscopables after implementation
43950 // in popular engines, so it's moved to a separate module
43951 var addToUnscopables = addToUnscopables$1;
43952
43953 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
43954 addToUnscopables('flat');
43955
43956 const {
43957   isNonEmptyArray: isNonEmptyArray$e
43958 } = util$8;
43959 const {
43960   builders: {
43961     indent: indent$q,
43962     join: join$o,
43963     line: line$t
43964   }
43965 } = require$$7$3;
43966 const {
43967   isFlowAnnotationComment: isFlowAnnotationComment$1
43968 } = utils$5;
43969
43970 function printOptionalToken$9(path) {
43971   const node = path.getValue();
43972
43973   if (!node.optional || // It's an optional computed method parsed by typescript-estree.
43974   // "?" is printed in `printMethod`.
43975   node.type === "Identifier" && node === path.getParentNode().key) {
43976     return "";
43977   }
43978
43979   if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
43980     return "?.";
43981   }
43982
43983   return "?";
43984 }
43985
43986 function printFunctionTypeParameters$4(path, options, print) {
43987   const fun = path.getValue();
43988
43989   if (fun.typeArguments) {
43990     return print("typeArguments");
43991   }
43992
43993   if (fun.typeParameters) {
43994     return print("typeParameters");
43995   }
43996
43997   return "";
43998 }
43999
44000 function printTypeAnnotation$5(path, options, print) {
44001   const node = path.getValue();
44002
44003   if (!node.typeAnnotation) {
44004     return "";
44005   }
44006
44007   const parentNode = path.getParentNode();
44008   const isDefinite = node.definite || parentNode && parentNode.type === "VariableDeclarator" && parentNode.definite;
44009   const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
44010
44011   if (isFlowAnnotationComment$1(options.originalText, node.typeAnnotation)) {
44012     return [" /*: ", print("typeAnnotation"), " */"];
44013   }
44014
44015   return [isFunctionDeclarationIdentifier ? "" : isDefinite ? "!: " : ": ", print("typeAnnotation")];
44016 }
44017
44018 function printBindExpressionCallee$2(path, options, print) {
44019   return ["::", print("callee")];
44020 }
44021
44022 function printTypeScriptModifiers$2(path, options, print) {
44023   const node = path.getValue();
44024
44025   if (!isNonEmptyArray$e(node.modifiers)) {
44026     return "";
44027   }
44028
44029   return [join$o(" ", path.map(print, "modifiers")), " "];
44030 }
44031
44032 function adjustClause$1(node, clause, forceSpace) {
44033   if (node.type === "EmptyStatement") {
44034     return ";";
44035   }
44036
44037   if (node.type === "BlockStatement" || forceSpace) {
44038     return [" ", clause];
44039   }
44040
44041   return indent$q([line$t, clause]);
44042 }
44043
44044 function printRestSpread$2(path, options, print) {
44045   return ["...", print("argument"), printTypeAnnotation$5(path, options, print)];
44046 }
44047
44048 var misc$1 = {
44049   printOptionalToken: printOptionalToken$9,
44050   printFunctionTypeParameters: printFunctionTypeParameters$4,
44051   printBindExpressionCallee: printBindExpressionCallee$2,
44052   printTypeScriptModifiers: printTypeScriptModifiers$2,
44053   printTypeAnnotation: printTypeAnnotation$5,
44054   printRestSpread: printRestSpread$2,
44055   adjustClause: adjustClause$1
44056 };
44057
44058 const {
44059   printDanglingComments: printDanglingComments$c
44060 } = comments$4;
44061 const {
44062   builders: {
44063     line: line$s,
44064     softline: softline$n,
44065     hardline: hardline$v,
44066     group: group$w,
44067     indent: indent$p,
44068     ifBreak: ifBreak$k,
44069     fill: fill$7
44070   }
44071 } = require$$7$3;
44072 const {
44073   getLast: getLast$f,
44074   hasNewline: hasNewline$5
44075 } = util$8;
44076 const {
44077   shouldPrintComma: shouldPrintComma$a,
44078   hasComment: hasComment$d,
44079   CommentCheckFlags: CommentCheckFlags$b,
44080   isNextLineEmpty: isNextLineEmpty$b,
44081   isNumericLiteral: isNumericLiteral$4,
44082   isSignedNumericLiteral: isSignedNumericLiteral$1
44083 } = utils$5;
44084 const {
44085   locStart: locStart$o
44086 } = loc$6;
44087 const {
44088   printOptionalToken: printOptionalToken$8,
44089   printTypeAnnotation: printTypeAnnotation$4
44090 } = misc$1;
44091 /** @typedef {import("../../document").Doc} Doc */
44092
44093 function printArray$1(path, options, print) {
44094   const node = path.getValue();
44095   /** @type{Doc[]} */
44096
44097   const parts = [];
44098   const openBracket = node.type === "TupleExpression" ? "#[" : "[";
44099   const closeBracket = "]";
44100
44101   if (node.elements.length === 0) {
44102     if (!hasComment$d(node, CommentCheckFlags$b.Dangling)) {
44103       parts.push(openBracket, closeBracket);
44104     } else {
44105       parts.push(group$w([openBracket, printDanglingComments$c(path, options), softline$n, closeBracket]));
44106     }
44107   } else {
44108     const lastElem = getLast$f(node.elements);
44109     const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which
44110     // changes its length based on the number of commas. The algorithm
44111     // is that if the last argument is null, we need to force insert
44112     // a comma to ensure JavaScript recognizes it.
44113     //   [,].length === 1
44114     //   [1,].length === 1
44115     //   [1,,].length === 2
44116     //
44117     // Note that getLast returns null if the array is empty, but
44118     // we already check for an empty array just above so we are safe
44119
44120     const needsForcedTrailingComma = lastElem === null;
44121     const groupId = Symbol("array");
44122     const shouldBreak = !options.__inJestEach && node.elements.length > 1 && node.elements.every((element, i, elements) => {
44123       const elementType = element && element.type;
44124
44125       if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
44126         return false;
44127       }
44128
44129       const nextElement = elements[i + 1];
44130
44131       if (nextElement && elementType !== nextElement.type) {
44132         return false;
44133       }
44134
44135       const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
44136       return element[itemsKey] && element[itemsKey].length > 1;
44137     });
44138     const shouldUseConciseFormatting = isConciselyPrintedArray$1(node, options);
44139     const trailingComma = !canHaveTrailingComma ? "" : needsForcedTrailingComma ? "," : !shouldPrintComma$a(options) ? "" : shouldUseConciseFormatting ? ifBreak$k(",", "", {
44140       groupId
44141     }) : ifBreak$k(",");
44142     parts.push(group$w([openBracket, indent$p([softline$n, shouldUseConciseFormatting ? printArrayItemsConcisely(path, options, print, trailingComma) : [printArrayItems$3(path, options, "elements", print), trailingComma], printDanglingComments$c(path, options,
44143     /* sameIndent */
44144     true)]), softline$n, closeBracket], {
44145       shouldBreak,
44146       id: groupId
44147     }));
44148   }
44149
44150   parts.push(printOptionalToken$8(path), printTypeAnnotation$4(path, options, print));
44151   return parts;
44152 }
44153
44154 function isConciselyPrintedArray$1(node, options) {
44155   return node.elements.length > 1 && node.elements.every(element => element && (isNumericLiteral$4(element) || isSignedNumericLiteral$1(element) && !hasComment$d(element.argument)) && !hasComment$d(element, CommentCheckFlags$b.Trailing | CommentCheckFlags$b.Line, comment => !hasNewline$5(options.originalText, locStart$o(comment), {
44156     backwards: true
44157   })));
44158 }
44159
44160 function printArrayItems$3(path, options, printPath, print) {
44161   const printedElements = [];
44162   let separatorParts = [];
44163   path.each(childPath => {
44164     printedElements.push(separatorParts, group$w(print()));
44165     separatorParts = [",", line$s];
44166
44167     if (childPath.getValue() && isNextLineEmpty$b(childPath.getValue(), options)) {
44168       separatorParts.push(softline$n);
44169     }
44170   }, printPath);
44171   return printedElements;
44172 }
44173
44174 function printArrayItemsConcisely(path, options, print, trailingComma) {
44175   const parts = [];
44176   path.each((childPath, i, elements) => {
44177     const isLast = i === elements.length - 1;
44178     parts.push([print(), isLast ? trailingComma : ","]);
44179
44180     if (!isLast) {
44181       parts.push(isNextLineEmpty$b(childPath.getValue(), options) ? [hardline$v, hardline$v] : hasComment$d(elements[i + 1], CommentCheckFlags$b.Leading | CommentCheckFlags$b.Line) ? hardline$v : line$s);
44182     }
44183   }, "elements");
44184   return fill$7(parts);
44185 }
44186
44187 var array = {
44188   printArray: printArray$1,
44189   printArrayItems: printArrayItems$3,
44190   isConciselyPrintedArray: isConciselyPrintedArray$1
44191 };
44192
44193 const {
44194   printDanglingComments: printDanglingComments$b
44195 } = comments$4;
44196 const {
44197   getLast: getLast$e,
44198   getPenultimate
44199 } = util$8;
44200 const {
44201   getFunctionParameters: getFunctionParameters$3,
44202   hasComment: hasComment$c,
44203   CommentCheckFlags: CommentCheckFlags$a,
44204   isFunctionCompositionArgs,
44205   isJsxNode: isJsxNode$3,
44206   isLongCurriedCallExpression: isLongCurriedCallExpression$1,
44207   shouldPrintComma: shouldPrintComma$9,
44208   getCallArguments: getCallArguments$3,
44209   iterateCallArgumentsPath: iterateCallArgumentsPath$1,
44210   isNextLineEmpty: isNextLineEmpty$a,
44211   isCallExpression: isCallExpression$8,
44212   isStringLiteral: isStringLiteral$3,
44213   isObjectProperty: isObjectProperty$1
44214 } = utils$5;
44215 const {
44216   builders: {
44217     line: line$r,
44218     hardline: hardline$u,
44219     softline: softline$m,
44220     group: group$v,
44221     indent: indent$o,
44222     conditionalGroup: conditionalGroup$3,
44223     ifBreak: ifBreak$j,
44224     breakParent: breakParent$9
44225   },
44226   utils: {
44227     willBreak: willBreak$4
44228   }
44229 } = require$$7$3;
44230 const {
44231   ArgExpansionBailout: ArgExpansionBailout$2
44232 } = errors;
44233 const {
44234   isConciselyPrintedArray
44235 } = array;
44236
44237 function printCallArguments$2(path, options, print) {
44238   const node = path.getValue();
44239   const isDynamicImport = node.type === "ImportExpression";
44240   const args = getCallArguments$3(node);
44241
44242   if (args.length === 0) {
44243     return ["(", printDanglingComments$b(path, options,
44244     /* sameIndent */
44245     true), ")"];
44246   } // useEffect(() => { ... }, [foo, bar, baz])
44247
44248
44249   if (isReactHookCallWithDepsArray(args)) {
44250     return ["(", print(["arguments", 0]), ", ", print(["arguments", 1]), ")"];
44251   }
44252
44253   let anyArgEmptyLine = false;
44254   let hasEmptyLineFollowingFirstArg = false;
44255   const lastArgIndex = args.length - 1;
44256   const printedArguments = [];
44257   iterateCallArgumentsPath$1(path, (argPath, index) => {
44258     const arg = argPath.getNode();
44259     const parts = [print()];
44260
44261     if (index === lastArgIndex) ; else if (isNextLineEmpty$a(arg, options)) {
44262       if (index === 0) {
44263         hasEmptyLineFollowingFirstArg = true;
44264       }
44265
44266       anyArgEmptyLine = true;
44267       parts.push(",", hardline$u, hardline$u);
44268     } else {
44269       parts.push(",", line$r);
44270     }
44271
44272     printedArguments.push(parts);
44273   });
44274   const maybeTrailingComma = // Dynamic imports cannot have trailing commas
44275   !(isDynamicImport || node.callee && node.callee.type === "Import") && shouldPrintComma$9(options, "all") ? "," : "";
44276
44277   function allArgsBrokenOut() {
44278     return group$v(["(", indent$o([line$r, ...printedArguments]), maybeTrailingComma, line$r, ")"], {
44279       shouldBreak: true
44280     });
44281   }
44282
44283   if (anyArgEmptyLine || path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs(args)) {
44284     return allArgsBrokenOut();
44285   }
44286
44287   const shouldGroupFirst = shouldGroupFirstArg(args);
44288   const shouldGroupLast = shouldGroupLastArg(args, options);
44289
44290   if (shouldGroupFirst || shouldGroupLast) {
44291     if (shouldGroupFirst ? printedArguments.slice(1).some(willBreak$4) : printedArguments.slice(0, -1).some(willBreak$4)) {
44292       return allArgsBrokenOut();
44293     } // We want to print the last argument with a special flag
44294
44295
44296     let printedExpanded = [];
44297
44298     try {
44299       path.try(() => {
44300         iterateCallArgumentsPath$1(path, (argPath, i) => {
44301           if (shouldGroupFirst && i === 0) {
44302             printedExpanded = [[print([], {
44303               expandFirstArg: true
44304             }), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline$u : line$r, hasEmptyLineFollowingFirstArg ? hardline$u : ""], ...printedArguments.slice(1)];
44305           }
44306
44307           if (shouldGroupLast && i === lastArgIndex) {
44308             printedExpanded = [...printedArguments.slice(0, -1), print([], {
44309               expandLastArg: true
44310             })];
44311           }
44312         });
44313       });
44314     } catch (caught) {
44315       if (caught instanceof ArgExpansionBailout$2) {
44316         return allArgsBrokenOut();
44317       }
44318       /* istanbul ignore next */
44319
44320
44321       throw caught;
44322     }
44323
44324     return [printedArguments.some(willBreak$4) ? breakParent$9 : "", conditionalGroup$3([["(", ...printedExpanded, ")"], shouldGroupFirst ? ["(", group$v(printedExpanded[0], {
44325       shouldBreak: true
44326     }), ...printedExpanded.slice(1), ")"] : ["(", ...printedArguments.slice(0, -1), group$v(getLast$e(printedExpanded), {
44327       shouldBreak: true
44328     }), ")"], allArgsBrokenOut()])];
44329   }
44330
44331   const contents = ["(", indent$o([softline$m, ...printedArguments]), ifBreak$j(maybeTrailingComma), softline$m, ")"];
44332
44333   if (isLongCurriedCallExpression$1(path)) {
44334     // By not wrapping the arguments in a group, the printer prioritizes
44335     // breaking up these arguments rather than the args of the parent call.
44336     return contents;
44337   }
44338
44339   return group$v(contents, {
44340     shouldBreak: printedArguments.some(willBreak$4) || anyArgEmptyLine
44341   });
44342 }
44343
44344 function couldGroupArg(arg, arrowChainRecursion = false) {
44345   return arg.type === "ObjectExpression" && (arg.properties.length > 0 || hasComment$c(arg)) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || hasComment$c(arg)) || arg.type === "TSTypeAssertion" && couldGroupArg(arg.expression) || arg.type === "TSAsExpression" && couldGroupArg(arg.expression) || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && ( // we want to avoid breaking inside composite return types but not simple keywords
44346   // https://github.com/prettier/prettier/issues/4070
44347   // export class Thing implements OtherThing {
44348   //   do: (type: Type) => Provider<Prop> = memoize(
44349   //     (type: ObjectType): Provider<Opts> => {}
44350   //   );
44351   // }
44352   // https://github.com/prettier/prettier/issues/6099
44353   // app.get("/", (req, res): void => {
44354   //   res.send("Hello World!");
44355   // });
44356   !arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference" || // https://github.com/prettier/prettier/issues/7542
44357   isNonEmptyBlockStatement(arg.body)) && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" && couldGroupArg(arg.body, true) || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || !arrowChainRecursion && (isCallExpression$8(arg.body) || arg.body.type === "ConditionalExpression") || isJsxNode$3(arg.body)) || arg.type === "DoExpression" || arg.type === "ModuleExpression";
44358 }
44359
44360 function shouldGroupLastArg(args, options) {
44361   const lastArg = getLast$e(args);
44362   const penultimateArg = getPenultimate(args);
44363   return !hasComment$c(lastArg, CommentCheckFlags$a.Leading) && !hasComment$c(lastArg, CommentCheckFlags$a.Trailing) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type,
44364   // disable last element expansion.
44365   !penultimateArg || penultimateArg.type !== lastArg.type) && ( // useMemo(() => func(), [foo, bar, baz])
44366   args.length !== 2 || penultimateArg.type !== "ArrowFunctionExpression" || lastArg.type !== "ArrayExpression") && !(args.length > 1 && lastArg.type === "ArrayExpression" && isConciselyPrintedArray(lastArg, options));
44367 }
44368
44369 function shouldGroupFirstArg(args) {
44370   if (args.length !== 2) {
44371     return false;
44372   }
44373
44374   const [firstArg, secondArg] = args;
44375
44376   if (firstArg.type === "ModuleExpression" && isTypeModuleObjectExpression(secondArg)) {
44377     return true;
44378   }
44379
44380   return !hasComment$c(firstArg) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
44381 }
44382
44383 function isReactHookCallWithDepsArray(args) {
44384   return args.length === 2 && args[0].type === "ArrowFunctionExpression" && getFunctionParameters$3(args[0]).length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.some(arg => hasComment$c(arg));
44385 }
44386
44387 function isNonEmptyBlockStatement(node) {
44388   return node.type === "BlockStatement" && (node.body.some(node => node.type !== "EmptyStatement") || hasComment$c(node, CommentCheckFlags$a.Dangling));
44389 } // { type: "module" }
44390
44391
44392 function isTypeModuleObjectExpression(node) {
44393   return node.type === "ObjectExpression" && node.properties.length === 1 && isObjectProperty$1(node.properties[0]) && node.properties[0].key.type === "Identifier" && node.properties[0].key.name === "type" && isStringLiteral$3(node.properties[0].value) && node.properties[0].value.value === "module";
44394 }
44395
44396 var callArguments = printCallArguments$2;
44397
44398 const {
44399   builders: {
44400     softline: softline$l,
44401     group: group$u,
44402     indent: indent$n,
44403     label: label$2
44404   }
44405 } = require$$7$3;
44406 const {
44407   isNumericLiteral: isNumericLiteral$3,
44408   isMemberExpression: isMemberExpression$5,
44409   isCallExpression: isCallExpression$7
44410 } = utils$5;
44411 const {
44412   printOptionalToken: printOptionalToken$7
44413 } = misc$1;
44414
44415 function printMemberExpression$1(path, options, print) {
44416   const node = path.getValue();
44417   const parent = path.getParentNode();
44418   let firstNonMemberParent;
44419   let i = 0;
44420
44421   do {
44422     firstNonMemberParent = path.getParentNode(i);
44423     i++;
44424   } while (firstNonMemberParent && (isMemberExpression$5(firstNonMemberParent) || firstNonMemberParent.type === "TSNonNullExpression"));
44425
44426   const objectDoc = print("object");
44427   const lookupDoc = printMemberLookup$1(path, options, print);
44428   const shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || node.computed || node.object.type === "Identifier" && node.property.type === "Identifier" && !isMemberExpression$5(parent) || (parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator") && (isCallExpression$7(node.object) && node.object.arguments.length > 0 || node.object.type === "TSNonNullExpression" && isCallExpression$7(node.object.expression) && node.object.expression.arguments.length > 0 || objectDoc.label === "member-chain");
44429   return label$2(objectDoc.label === "member-chain" ? "member-chain" : "member", [objectDoc, shouldInline ? lookupDoc : group$u(indent$n([softline$l, lookupDoc]))]);
44430 }
44431
44432 function printMemberLookup$1(path, options, print) {
44433   const property = print("property");
44434   const node = path.getValue();
44435   const optional = printOptionalToken$7(path);
44436
44437   if (!node.computed) {
44438     return [optional, ".", property];
44439   }
44440
44441   if (!node.property || isNumericLiteral$3(node.property)) {
44442     return [optional, "[", property, "]"];
44443   }
44444
44445   return group$u([optional, "[", indent$n([softline$l, property]), softline$l, "]"]);
44446 }
44447
44448 var member = {
44449   printMemberExpression: printMemberExpression$1,
44450   printMemberLookup: printMemberLookup$1
44451 };
44452
44453 const {
44454   printComments: printComments$3
44455 } = comments$4;
44456 const {
44457   getLast: getLast$d,
44458   isNextLineEmptyAfterIndex,
44459   getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1
44460 } = util$8;
44461 const pathNeedsParens$4 = needsParens_1;
44462 const {
44463   isCallExpression: isCallExpression$6,
44464   isMemberExpression: isMemberExpression$4,
44465   isFunctionOrArrowExpression,
44466   isLongCurriedCallExpression,
44467   isMemberish: isMemberish$1,
44468   isNumericLiteral: isNumericLiteral$2,
44469   isSimpleCallArgument,
44470   hasComment: hasComment$b,
44471   CommentCheckFlags: CommentCheckFlags$9,
44472   isNextLineEmpty: isNextLineEmpty$9
44473 } = utils$5;
44474 const {
44475   locEnd: locEnd$n
44476 } = loc$6;
44477 const {
44478   builders: {
44479     join: join$n,
44480     hardline: hardline$t,
44481     group: group$t,
44482     indent: indent$m,
44483     conditionalGroup: conditionalGroup$2,
44484     breakParent: breakParent$8,
44485     label: label$1
44486   },
44487   utils: {
44488     willBreak: willBreak$3
44489   }
44490 } = require$$7$3;
44491 const printCallArguments$1 = callArguments;
44492 const {
44493   printMemberLookup
44494 } = member;
44495 const {
44496   printOptionalToken: printOptionalToken$6,
44497   printFunctionTypeParameters: printFunctionTypeParameters$3,
44498   printBindExpressionCallee: printBindExpressionCallee$1
44499 } = misc$1; // We detect calls on member expressions specially to format a
44500 // common pattern better. The pattern we are looking for is this:
44501 //
44502 // arr
44503 //   .map(x => x + 1)
44504 //   .filter(x => x > 10)
44505 //   .some(x => x % 2)
44506 //
44507 // The way it is structured in the AST is via a nested sequence of
44508 // MemberExpression and CallExpression. We need to traverse the AST
44509 // and make groups out of it to print it in the desired way.
44510
44511 function printMemberChain$1(path, options, print) {
44512   const parent = path.getParentNode();
44513   const isExpressionStatement = !parent || parent.type === "ExpressionStatement"; // The first phase is to linearize the AST by traversing it down.
44514   //
44515   //   a().b()
44516   // has the following AST structure:
44517   //   CallExpression(MemberExpression(CallExpression(Identifier)))
44518   // and we transform it into
44519   //   [Identifier, CallExpression, MemberExpression, CallExpression]
44520
44521   const printedNodes = []; // Here we try to retain one typed empty line after each call expression or
44522   // the first group whether it is in parentheses or not
44523
44524   function shouldInsertEmptyLineAfter(node) {
44525     const {
44526       originalText
44527     } = options;
44528     const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$1(originalText, node, locEnd$n);
44529     const nextChar = originalText.charAt(nextCharIndex); // if it is cut off by a parenthesis, we only account for one typed empty
44530     // line after that parenthesis
44531
44532     if (nextChar === ")") {
44533       return nextCharIndex !== false && isNextLineEmptyAfterIndex(originalText, nextCharIndex + 1);
44534     }
44535
44536     return isNextLineEmpty$9(node, options);
44537   }
44538
44539   function rec(path) {
44540     const node = path.getValue();
44541
44542     if (isCallExpression$6(node) && (isMemberish$1(node.callee) || isCallExpression$6(node.callee))) {
44543       printedNodes.unshift({
44544         node,
44545         printed: [printComments$3(path, [printOptionalToken$6(path), printFunctionTypeParameters$3(path, options, print), printCallArguments$1(path, options, print)], options), shouldInsertEmptyLineAfter(node) ? hardline$t : ""]
44546       });
44547       path.call(callee => rec(callee), "callee");
44548     } else if (isMemberish$1(node)) {
44549       printedNodes.unshift({
44550         node,
44551         needsParens: pathNeedsParens$4(path, options),
44552         printed: printComments$3(path, isMemberExpression$4(node) ? printMemberLookup(path, options, print) : printBindExpressionCallee$1(path, options, print), options)
44553       });
44554       path.call(object => rec(object), "object");
44555     } else if (node.type === "TSNonNullExpression") {
44556       printedNodes.unshift({
44557         node,
44558         printed: printComments$3(path, "!", options)
44559       });
44560       path.call(expression => rec(expression), "expression");
44561     } else {
44562       printedNodes.unshift({
44563         node,
44564         printed: print()
44565       });
44566     }
44567   } // Note: the comments of the root node have already been printed, so we
44568   // need to extract this first call without printing them as they would
44569   // if handled inside of the recursive call.
44570
44571
44572   const node = path.getValue();
44573   printedNodes.unshift({
44574     node,
44575     printed: [printOptionalToken$6(path), printFunctionTypeParameters$3(path, options, print), printCallArguments$1(path, options, print)]
44576   });
44577
44578   if (node.callee) {
44579     path.call(callee => rec(callee), "callee");
44580   } // Once we have a linear list of printed nodes, we want to create groups out
44581   // of it.
44582   //
44583   //   a().b.c().d().e
44584   // will be grouped as
44585   //   [
44586   //     [Identifier, CallExpression],
44587   //     [MemberExpression, MemberExpression, CallExpression],
44588   //     [MemberExpression, CallExpression],
44589   //     [MemberExpression],
44590   //   ]
44591   // so that we can print it as
44592   //   a()
44593   //     .b.c()
44594   //     .d()
44595   //     .e
44596   // The first group is the first node followed by
44597   //   - as many CallExpression as possible
44598   //       < fn()()() >.something()
44599   //   - as many array accessors as possible
44600   //       < fn()[0][1][2] >.something()
44601   //   - then, as many MemberExpression as possible but the last one
44602   //       < this.items >.something()
44603
44604
44605   const groups = [];
44606   let currentGroup = [printedNodes[0]];
44607   let i = 1;
44608
44609   for (; i < printedNodes.length; ++i) {
44610     if (printedNodes[i].node.type === "TSNonNullExpression" || isCallExpression$6(printedNodes[i].node) || isMemberExpression$4(printedNodes[i].node) && printedNodes[i].node.computed && isNumericLiteral$2(printedNodes[i].node.property)) {
44611       currentGroup.push(printedNodes[i]);
44612     } else {
44613       break;
44614     }
44615   }
44616
44617   if (!isCallExpression$6(printedNodes[0].node)) {
44618     for (; i + 1 < printedNodes.length; ++i) {
44619       if (isMemberish$1(printedNodes[i].node) && isMemberish$1(printedNodes[i + 1].node)) {
44620         currentGroup.push(printedNodes[i]);
44621       } else {
44622         break;
44623       }
44624     }
44625   }
44626
44627   groups.push(currentGroup);
44628   currentGroup = []; // Then, each following group is a sequence of MemberExpression followed by
44629   // a sequence of CallExpression. To compute it, we keep adding things to the
44630   // group until we has seen a CallExpression in the past and reach a
44631   // MemberExpression
44632
44633   let hasSeenCallExpression = false;
44634
44635   for (; i < printedNodes.length; ++i) {
44636     if (hasSeenCallExpression && isMemberish$1(printedNodes[i].node)) {
44637       // [0] should be appended at the end of the group instead of the
44638       // beginning of the next one
44639       if (printedNodes[i].node.computed && isNumericLiteral$2(printedNodes[i].node.property)) {
44640         currentGroup.push(printedNodes[i]);
44641         continue;
44642       }
44643
44644       groups.push(currentGroup);
44645       currentGroup = [];
44646       hasSeenCallExpression = false;
44647     }
44648
44649     if (isCallExpression$6(printedNodes[i].node) || printedNodes[i].node.type === "ImportExpression") {
44650       hasSeenCallExpression = true;
44651     }
44652
44653     currentGroup.push(printedNodes[i]);
44654
44655     if (hasComment$b(printedNodes[i].node, CommentCheckFlags$9.Trailing)) {
44656       groups.push(currentGroup);
44657       currentGroup = [];
44658       hasSeenCallExpression = false;
44659     }
44660   }
44661
44662   if (currentGroup.length > 0) {
44663     groups.push(currentGroup);
44664   } // There are cases like Object.keys(), Observable.of(), _.values() where
44665   // they are the subject of all the chained calls and therefore should
44666   // be kept on the same line:
44667   //
44668   //   Object.keys(items)
44669   //     .filter(x => x)
44670   //     .map(x => x)
44671   //
44672   // In order to detect those cases, we use an heuristic: if the first
44673   // node is an identifier with the name starting with a capital
44674   // letter or just a sequence of _$. The rationale is that they are
44675   // likely to be factories.
44676
44677
44678   function isFactory(name) {
44679     return /^[A-Z]|^[$_]+$/.test(name);
44680   } // In case the Identifier is shorter than tab width, we can keep the
44681   // first call in a single line, if it's an ExpressionStatement.
44682   //
44683   //   d3.scaleLinear()
44684   //     .domain([0, 100])
44685   //     .range([0, width]);
44686   //
44687
44688
44689   function isShort(name) {
44690     return name.length <= options.tabWidth;
44691   }
44692
44693   function shouldNotWrap(groups) {
44694     const hasComputed = groups[1].length > 0 && groups[1][0].node.computed;
44695
44696     if (groups[0].length === 1) {
44697       const firstNode = groups[0][0].node;
44698       return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpressionStatement && isShort(firstNode.name) || hasComputed);
44699     }
44700
44701     const lastNode = getLast$d(groups[0]).node;
44702     return isMemberExpression$4(lastNode) && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
44703   }
44704
44705   const shouldMerge = groups.length >= 2 && !hasComment$b(groups[1][0].node) && shouldNotWrap(groups);
44706
44707   function printGroup(printedGroup) {
44708     const printed = printedGroup.map(tuple => tuple.printed); // Checks if the last node (i.e. the parent node) needs parens and print
44709     // accordingly
44710
44711     if (printedGroup.length > 0 && getLast$d(printedGroup).needsParens) {
44712       return ["(", ...printed, ")"];
44713     }
44714
44715     return printed;
44716   }
44717
44718   function printIndentedGroup(groups) {
44719     /* istanbul ignore next */
44720     if (groups.length === 0) {
44721       return "";
44722     }
44723
44724     return indent$m(group$t([hardline$t, join$n(hardline$t, groups.map(printGroup))]));
44725   }
44726
44727   const printedGroups = groups.map(printGroup);
44728   const oneLine = printedGroups;
44729   const cutoff = shouldMerge ? 3 : 2;
44730   const flatGroups = groups.flat();
44731   const nodeHasComment = flatGroups.slice(1, -1).some(node => hasComment$b(node.node, CommentCheckFlags$9.Leading)) || flatGroups.slice(0, -1).some(node => hasComment$b(node.node, CommentCheckFlags$9.Trailing)) || groups[cutoff] && hasComment$b(groups[cutoff][0].node, CommentCheckFlags$9.Leading); // If we only have a single `.`, we shouldn't do anything fancy and just
44732   // render everything concatenated together.
44733
44734   if (groups.length <= cutoff && !nodeHasComment) {
44735     if (isLongCurriedCallExpression(path)) {
44736       return oneLine;
44737     }
44738
44739     return group$t(oneLine);
44740   } // Find out the last node in the first group and check if it has an
44741   // empty line after
44742
44743
44744   const lastNodeBeforeIndent = getLast$d(groups[shouldMerge ? 1 : 0]).node;
44745   const shouldHaveEmptyLineBeforeIndent = !isCallExpression$6(lastNodeBeforeIndent) && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
44746   const expanded = [printGroup(groups[0]), shouldMerge ? groups.slice(1, 2).map(printGroup) : "", shouldHaveEmptyLineBeforeIndent ? hardline$t : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))];
44747   const callExpressions = printedNodes.map(({
44748     node
44749   }) => node).filter(isCallExpression$6);
44750
44751   function lastGroupWillBreakAndOtherCallsHaveFunctionArguments() {
44752     const lastGroupNode = getLast$d(getLast$d(groups)).node;
44753     const lastGroupDoc = getLast$d(printedGroups);
44754     return isCallExpression$6(lastGroupNode) && willBreak$3(lastGroupDoc) && callExpressions.slice(0, -1).some(node => node.arguments.some(isFunctionOrArrowExpression));
44755   }
44756
44757   let result; // We don't want to print in one line if at least one of these conditions occurs:
44758   //  * the chain has comments,
44759   //  * the chain is an expression statement and all the arguments are literal-like ("fluent configuration" pattern),
44760   //  * the chain is longer than 2 calls and has non-trivial arguments or more than 2 arguments in any call but the first one,
44761   //  * any group but the last one has a hard line,
44762   //  * the last call's arguments have a hard line and other calls have non-trivial arguments.
44763
44764   if (nodeHasComment || callExpressions.length > 2 && callExpressions.some(expr => !expr.arguments.every(arg => isSimpleCallArgument(arg, 0))) || printedGroups.slice(0, -1).some(willBreak$3) || lastGroupWillBreakAndOtherCallsHaveFunctionArguments()) {
44765     result = group$t(expanded);
44766   } else {
44767     result = [// We only need to check `oneLine` because if `expanded` is chosen
44768     // that means that the parent group has already been broken
44769     // naturally
44770     willBreak$3(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent$8 : "", conditionalGroup$2([oneLine, expanded])];
44771   }
44772
44773   return label$1("member-chain", result);
44774 }
44775
44776 var memberChain = printMemberChain$1;
44777
44778 const {
44779   builders: {
44780     join: join$m,
44781     group: group$s
44782   }
44783 } = require$$7$3;
44784 const pathNeedsParens$3 = needsParens_1;
44785 const {
44786   getCallArguments: getCallArguments$2,
44787   hasFlowAnnotationComment,
44788   isCallExpression: isCallExpression$5,
44789   isMemberish,
44790   isStringLiteral: isStringLiteral$2,
44791   isTemplateOnItsOwnLine: isTemplateOnItsOwnLine$1,
44792   isTestCall: isTestCall$2,
44793   iterateCallArgumentsPath
44794 } = utils$5;
44795 const printMemberChain = memberChain;
44796 const printCallArguments = callArguments;
44797 const {
44798   printOptionalToken: printOptionalToken$5,
44799   printFunctionTypeParameters: printFunctionTypeParameters$2
44800 } = misc$1;
44801
44802 function printCallExpression$2(path, options, print) {
44803   const node = path.getValue();
44804   const parentNode = path.getParentNode();
44805   const isNew = node.type === "NewExpression";
44806   const isDynamicImport = node.type === "ImportExpression";
44807   const optional = printOptionalToken$5(path);
44808   const args = getCallArguments$2(node);
44809
44810   if ( // Dangling comments are not handled, all these special cases should have arguments #9668
44811   args.length > 0 && ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style
44812   // define calls, as a unit.
44813   // e.g. `define(["some/lib"], (lib) => {`
44814   !isDynamicImport && !isNew && isCommonsJsOrAmdCall(node, parentNode) || // Template literals as single arguments
44815   args.length === 1 && isTemplateOnItsOwnLine$1(args[0], options.originalText) || // Keep test declarations on a single line
44816   // e.g. `it('long name', () => {`
44817   !isNew && isTestCall$2(node, parentNode))) {
44818     const printed = [];
44819     iterateCallArgumentsPath(path, () => {
44820       printed.push(print());
44821     });
44822     return [isNew ? "new " : "", print("callee"), optional, printFunctionTypeParameters$2(path, options, print), "(", join$m(", ", printed), ")"];
44823   } // Inline Flow annotation comments following Identifiers in Call nodes need to
44824   // stay with the Identifier. For example:
44825   //
44826   // foo /*:: <SomeGeneric> */(bar);
44827   //
44828   // Here, we ensure that such comments stay between the Identifier and the Callee.
44829
44830
44831   const isIdentifierWithFlowAnnotation = (options.parser === "babel" || options.parser === "babel-flow") && node.callee && node.callee.type === "Identifier" && hasFlowAnnotationComment(node.callee.trailingComments);
44832
44833   if (isIdentifierWithFlowAnnotation) {
44834     node.callee.trailingComments[0].printed = true;
44835   } // We detect calls on member lookups and possibly print them in a
44836   // special chain format. See `printMemberChain` for more info.
44837
44838
44839   if (!isDynamicImport && !isNew && isMemberish(node.callee) && !path.call(path => pathNeedsParens$3(path, options), "callee")) {
44840     return printMemberChain(path, options, print);
44841   }
44842
44843   const contents = [isNew ? "new " : "", isDynamicImport ? "import" : print("callee"), optional, isIdentifierWithFlowAnnotation ? `/*:: ${node.callee.trailingComments[0].value.slice(2).trim()} */` : "", printFunctionTypeParameters$2(path, options, print), printCallArguments(path, options, print)]; // We group here when the callee is itself a call expression.
44844   // See `isLongCurriedCallExpression` for more info.
44845
44846   if (isDynamicImport || isCallExpression$5(node.callee)) {
44847     return group$s(contents);
44848   }
44849
44850   return contents;
44851 }
44852
44853 function isCommonsJsOrAmdCall(node, parentNode) {
44854   if (node.callee.type !== "Identifier") {
44855     return false;
44856   }
44857
44858   if (node.callee.name === "require") {
44859     return true;
44860   }
44861
44862   if (node.callee.name === "define") {
44863     const args = getCallArguments$2(node);
44864     return parentNode.type === "ExpressionStatement" && (args.length === 1 || args.length === 2 && args[0].type === "ArrayExpression" || args.length === 3 && isStringLiteral$2(args[0]) && args[1].type === "ArrayExpression");
44865   }
44866
44867   return false;
44868 }
44869
44870 var callExpression = {
44871   printCallExpression: printCallExpression$2
44872 };
44873
44874 const {
44875   isNonEmptyArray: isNonEmptyArray$d,
44876   getStringWidth: getStringWidth$1
44877 } = util$8;
44878 const {
44879   builders: {
44880     line: line$q,
44881     group: group$r,
44882     indent: indent$l,
44883     indentIfBreak: indentIfBreak$2
44884   },
44885   utils: {
44886     cleanDoc: cleanDoc$1,
44887     willBreak: willBreak$2,
44888     canBreak
44889   }
44890 } = require$$7$3;
44891 const {
44892   hasLeadingOwnLineComment: hasLeadingOwnLineComment$2,
44893   isBinaryish: isBinaryish$1,
44894   isStringLiteral: isStringLiteral$1,
44895   isLiteral: isLiteral$1,
44896   isNumericLiteral: isNumericLiteral$1,
44897   isCallExpression: isCallExpression$4,
44898   isMemberExpression: isMemberExpression$3,
44899   getCallArguments: getCallArguments$1,
44900   rawText: rawText$3,
44901   hasComment: hasComment$a,
44902   isSignedNumericLiteral,
44903   isObjectProperty
44904 } = utils$5;
44905 const {
44906   shouldInlineLogicalExpression
44907 } = binaryish;
44908 const {
44909   printCallExpression: printCallExpression$1
44910 } = callExpression;
44911
44912 function printAssignment$3(path, options, print, leftDoc, operator, rightPropertyName) {
44913   const layout = chooseLayout(path, options, print, leftDoc, rightPropertyName);
44914   const rightDoc = print(rightPropertyName, {
44915     assignmentLayout: layout
44916   });
44917
44918   switch (layout) {
44919     // First break after operator, then the sides are broken independently on their own lines
44920     case "break-after-operator":
44921       return group$r([group$r(leftDoc), operator, group$r(indent$l([line$q, rightDoc]))]);
44922     // First break right-hand side, then left-hand side
44923
44924     case "never-break-after-operator":
44925       return group$r([group$r(leftDoc), operator, " ", rightDoc]);
44926     // First break right-hand side, then after operator
44927
44928     case "fluid":
44929       {
44930         const groupId = Symbol("assignment");
44931         return group$r([group$r(leftDoc), operator, group$r(indent$l(line$q), {
44932           id: groupId
44933         }), indentIfBreak$2(rightDoc, {
44934           groupId
44935         })]);
44936       }
44937
44938     case "break-lhs":
44939       return group$r([leftDoc, operator, " ", group$r(rightDoc)]);
44940     // Parts of assignment chains aren't wrapped in groups.
44941     // Once one of them breaks, the chain breaks too.
44942
44943     case "chain":
44944       return [group$r(leftDoc), operator, line$q, rightDoc];
44945
44946     case "chain-tail":
44947       return [group$r(leftDoc), operator, indent$l([line$q, rightDoc])];
44948
44949     case "chain-tail-arrow-chain":
44950       return [group$r(leftDoc), operator, rightDoc];
44951
44952     case "only-left":
44953       return leftDoc;
44954   }
44955 }
44956
44957 function printAssignmentExpression$1(path, options, print) {
44958   const node = path.getValue();
44959   return printAssignment$3(path, options, print, print("left"), [" ", node.operator], "right");
44960 }
44961
44962 function printVariableDeclarator$1(path, options, print) {
44963   return printAssignment$3(path, options, print, print("id"), " =", "init");
44964 }
44965
44966 function chooseLayout(path, options, print, leftDoc, rightPropertyName) {
44967   const node = path.getValue();
44968   const rightNode = node[rightPropertyName];
44969
44970   if (!rightNode) {
44971     return "only-left";
44972   } // Short assignment chains (only 2 segments) are NOT formatted as chains.
44973   //   1) a = b = c; (expression statements)
44974   //   2) var/let/const a = b = c;
44975
44976
44977   const isTail = !isAssignment(rightNode);
44978   const shouldUseChainFormatting = path.match(isAssignment, isAssignmentOrVariableDeclarator, node => !isTail || node.type !== "ExpressionStatement" && node.type !== "VariableDeclaration");
44979
44980   if (shouldUseChainFormatting) {
44981     return !isTail ? "chain" : rightNode.type === "ArrowFunctionExpression" && rightNode.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail";
44982   }
44983
44984   const isHeadOfLongChain = !isTail && isAssignment(rightNode.right);
44985
44986   if (isHeadOfLongChain || hasLeadingOwnLineComment$2(options.originalText, rightNode)) {
44987     return "break-after-operator";
44988   }
44989
44990   if (rightNode.type === "CallExpression" && rightNode.callee.name === "require" || // do not put values on a separate line from the key in json
44991   options.parser === "json5" || options.parser === "json") {
44992     return "never-break-after-operator";
44993   }
44994
44995   if (isComplexDestructuring(node) || isComplexTypeAliasParams(node) || hasComplexTypeAnnotation(node) || isArrowFunctionVariableDeclarator$1(node) && canBreak(leftDoc)) {
44996     return "break-lhs";
44997   } // wrapping object properties with very short keys usually doesn't add much value
44998
44999
45000   const hasShortKey = isObjectPropertyWithShortKey(node, leftDoc, options);
45001
45002   if (path.call(() => shouldBreakAfterOperator(path, options, print, hasShortKey), rightPropertyName)) {
45003     return "break-after-operator";
45004   }
45005
45006   if (hasShortKey || rightNode.type === "TemplateLiteral" || rightNode.type === "TaggedTemplateExpression" || rightNode.type === "BooleanLiteral" || isNumericLiteral$1(rightNode) || rightNode.type === "ClassExpression") {
45007     return "never-break-after-operator";
45008   }
45009
45010   return "fluid";
45011 }
45012
45013 function shouldBreakAfterOperator(path, options, print, hasShortKey) {
45014   const rightNode = path.getValue();
45015
45016   if (isBinaryish$1(rightNode) && !shouldInlineLogicalExpression(rightNode)) {
45017     return true;
45018   }
45019
45020   switch (rightNode.type) {
45021     case "StringLiteralTypeAnnotation":
45022     case "SequenceExpression":
45023       return true;
45024
45025     case "ConditionalExpression":
45026       {
45027         const {
45028           test
45029         } = rightNode;
45030         return isBinaryish$1(test) && !shouldInlineLogicalExpression(test);
45031       }
45032
45033     case "ClassExpression":
45034       return isNonEmptyArray$d(rightNode.decorators);
45035   }
45036
45037   if (hasShortKey) {
45038     return false;
45039   }
45040
45041   let node = rightNode;
45042   const propertiesForPath = [];
45043
45044   for (;;) {
45045     if (node.type === "UnaryExpression") {
45046       node = node.argument;
45047       propertiesForPath.push("argument");
45048     } else if (node.type === "TSNonNullExpression") {
45049       node = node.expression;
45050       propertiesForPath.push("expression");
45051     } else {
45052       break;
45053     }
45054   }
45055
45056   if (isStringLiteral$1(node) || path.call(() => isPoorlyBreakableMemberOrCallChain(path, options, print), ...propertiesForPath)) {
45057     return true;
45058   }
45059
45060   return false;
45061 } // prefer to break destructuring assignment
45062 // if it includes default values or non-shorthand properties
45063
45064
45065 function isComplexDestructuring(node) {
45066   if (isAssignmentOrVariableDeclarator(node)) {
45067     const leftNode = node.left || node.id;
45068     return leftNode.type === "ObjectPattern" && leftNode.properties.length > 2 && leftNode.properties.some(property => isObjectProperty(property) && (!property.shorthand || property.value && property.value.type === "AssignmentPattern"));
45069   }
45070
45071   return false;
45072 }
45073
45074 function isAssignment(node) {
45075   return node.type === "AssignmentExpression";
45076 }
45077
45078 function isAssignmentOrVariableDeclarator(node) {
45079   return isAssignment(node) || node.type === "VariableDeclarator";
45080 }
45081
45082 function isComplexTypeAliasParams(node) {
45083   const typeParams = getTypeParametersFromTypeAlias(node);
45084
45085   if (isNonEmptyArray$d(typeParams)) {
45086     const constraintPropertyName = node.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
45087
45088     if (typeParams.length > 1 && typeParams.some(param => param[constraintPropertyName] || param.default)) {
45089       return true;
45090     }
45091   }
45092
45093   return false;
45094 }
45095
45096 function getTypeParametersFromTypeAlias(node) {
45097   if (isTypeAlias(node) && node.typeParameters && node.typeParameters.params) {
45098     return node.typeParameters.params;
45099   }
45100
45101   return null;
45102 }
45103
45104 function isTypeAlias(node) {
45105   return node.type === "TSTypeAliasDeclaration" || node.type === "TypeAlias";
45106 }
45107
45108 function hasComplexTypeAnnotation(node) {
45109   if (node.type !== "VariableDeclarator") {
45110     return false;
45111   }
45112
45113   const {
45114     typeAnnotation
45115   } = node.id;
45116
45117   if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
45118     return false;
45119   }
45120
45121   const typeParams = getTypeParametersFromTypeReference(typeAnnotation.typeAnnotation);
45122   return isNonEmptyArray$d(typeParams) && typeParams.length > 1 && typeParams.some(param => isNonEmptyArray$d(getTypeParametersFromTypeReference(param)) || param.type === "TSConditionalType");
45123 }
45124
45125 function isArrowFunctionVariableDeclarator$1(node) {
45126   return node.type === "VariableDeclarator" && node.init && node.init.type === "ArrowFunctionExpression";
45127 }
45128
45129 function getTypeParametersFromTypeReference(node) {
45130   if (isTypeReference(node) && node.typeParameters && node.typeParameters.params) {
45131     return node.typeParameters.params;
45132   }
45133
45134   return null;
45135 }
45136
45137 function isTypeReference(node) {
45138   return node.type === "TSTypeReference" || node.type === "GenericTypeAnnotation";
45139 }
45140 /**
45141  * A chain with no calls at all or whose calls are all without arguments or with lone short arguments,
45142  * excluding chains printed by `printMemberChain`
45143  */
45144
45145
45146 function isPoorlyBreakableMemberOrCallChain(path, options, print, deep = false) {
45147   const node = path.getValue();
45148
45149   const goDeeper = () => isPoorlyBreakableMemberOrCallChain(path, options, print, true);
45150
45151   if (node.type === "TSNonNullExpression") {
45152     return path.call(goDeeper, "expression");
45153   }
45154
45155   if (isCallExpression$4(node)) {
45156     /** @type {any} TODO */
45157     const doc = printCallExpression$1(path, options, print);
45158
45159     if (doc.label === "member-chain") {
45160       return false;
45161     }
45162
45163     const args = getCallArguments$1(node);
45164     const isPoorlyBreakableCall = args.length === 0 || args.length === 1 && isLoneShortArgument(args[0], options);
45165
45166     if (!isPoorlyBreakableCall) {
45167       return false;
45168     }
45169
45170     if (isCallExpressionWithComplexTypeArguments(node, print)) {
45171       return false;
45172     }
45173
45174     return path.call(goDeeper, "callee");
45175   }
45176
45177   if (isMemberExpression$3(node)) {
45178     return path.call(goDeeper, "object");
45179   }
45180
45181   return deep && (node.type === "Identifier" || node.type === "ThisExpression");
45182 }
45183
45184 const LONE_SHORT_ARGUMENT_THRESHOLD_RATE = 0.25;
45185
45186 function isLoneShortArgument(node, {
45187   printWidth
45188 }) {
45189   if (hasComment$a(node)) {
45190     return false;
45191   }
45192
45193   const threshold = printWidth * LONE_SHORT_ARGUMENT_THRESHOLD_RATE;
45194
45195   if (node.type === "ThisExpression" || node.type === "Identifier" && node.name.length <= threshold || isSignedNumericLiteral(node) && !hasComment$a(node.argument)) {
45196     return true;
45197   }
45198
45199   const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
45200
45201   if (regexpPattern) {
45202     return regexpPattern.length <= threshold;
45203   }
45204
45205   if (isStringLiteral$1(node)) {
45206     return rawText$3(node).length <= threshold;
45207   }
45208
45209   if (node.type === "TemplateLiteral") {
45210     return node.expressions.length === 0 && node.quasis[0].value.raw.length <= threshold && !node.quasis[0].value.raw.includes("\n");
45211   }
45212
45213   return isLiteral$1(node);
45214 }
45215
45216 function isObjectPropertyWithShortKey(node, keyDoc, options) {
45217   if (!isObjectProperty(node)) {
45218     return false;
45219   } // TODO: for performance, it might make sense to use a more lightweight
45220   // version of cleanDoc, such that it would stop once it detects that
45221   // the doc can't be reduced to a string.
45222
45223
45224   keyDoc = cleanDoc$1(keyDoc);
45225   const MIN_OVERLAP_FOR_BREAK = 3; //   ↓↓ - insufficient overlap for a line break
45226   // key1: longValue1,
45227   //   ↓↓↓↓↓↓ - overlap is long enough to break
45228   // key2abcd:
45229   //   longValue2
45230
45231   return typeof keyDoc === "string" && getStringWidth$1(keyDoc) < options.tabWidth + MIN_OVERLAP_FOR_BREAK;
45232 }
45233
45234 function isCallExpressionWithComplexTypeArguments(node, print) {
45235   const typeArgs = getTypeArgumentsFromCallExpression(node);
45236
45237   if (isNonEmptyArray$d(typeArgs)) {
45238     if (typeArgs.length > 1) {
45239       return true;
45240     }
45241
45242     if (typeArgs.length === 1) {
45243       const firstArg = typeArgs[0];
45244
45245       if (firstArg.type === "TSUnionType" || firstArg.type === "UnionTypeAnnotation" || firstArg.type === "TSIntersectionType" || firstArg.type === "IntersectionTypeAnnotation") {
45246         return true;
45247       }
45248     }
45249
45250     const typeArgsKeyName = node.typeParameters ? "typeParameters" : "typeArguments";
45251
45252     if (willBreak$2(print(typeArgsKeyName))) {
45253       return true;
45254     }
45255   }
45256
45257   return false;
45258 }
45259
45260 function getTypeArgumentsFromCallExpression(node) {
45261   return node.typeParameters && node.typeParameters.params || node.typeArguments && node.typeArguments.params;
45262 }
45263
45264 var assignment = {
45265   printVariableDeclarator: printVariableDeclarator$1,
45266   printAssignmentExpression: printAssignmentExpression$1,
45267   printAssignment: printAssignment$3,
45268   isArrowFunctionVariableDeclarator: isArrowFunctionVariableDeclarator$1
45269 };
45270
45271 const {
45272   getNextNonSpaceNonCommentCharacter
45273 } = util$8;
45274 const {
45275   printDanglingComments: printDanglingComments$a
45276 } = comments$4;
45277 const {
45278   builders: {
45279     line: line$p,
45280     hardline: hardline$s,
45281     softline: softline$k,
45282     group: group$q,
45283     indent: indent$k,
45284     ifBreak: ifBreak$i
45285   },
45286   utils: {
45287     removeLines: removeLines$2,
45288     willBreak: willBreak$1
45289   }
45290 } = require$$7$3;
45291 const {
45292   getFunctionParameters: getFunctionParameters$2,
45293   iterateFunctionParametersPath,
45294   isSimpleType: isSimpleType$1,
45295   isTestCall: isTestCall$1,
45296   isTypeAnnotationAFunction,
45297   isObjectType: isObjectType$2,
45298   isObjectTypePropertyAFunction: isObjectTypePropertyAFunction$1,
45299   hasRestParameter,
45300   shouldPrintComma: shouldPrintComma$8,
45301   hasComment: hasComment$9,
45302   isNextLineEmpty: isNextLineEmpty$8
45303 } = utils$5;
45304 const {
45305   locEnd: locEnd$m
45306 } = loc$6;
45307 const {
45308   ArgExpansionBailout: ArgExpansionBailout$1
45309 } = errors;
45310 const {
45311   printFunctionTypeParameters: printFunctionTypeParameters$1
45312 } = misc$1;
45313
45314 function printFunctionParameters$3(path, print, options, expandArg, printTypeParams) {
45315   const functionNode = path.getValue();
45316   const parameters = getFunctionParameters$2(functionNode);
45317   const typeParams = printTypeParams ? printFunctionTypeParameters$1(path, options, print) : "";
45318
45319   if (parameters.length === 0) {
45320     return [typeParams, "(", printDanglingComments$a(path, options,
45321     /* sameIndent */
45322     true, comment => getNextNonSpaceNonCommentCharacter(options.originalText, comment, locEnd$m) === ")"), ")"];
45323   }
45324
45325   const parent = path.getParentNode();
45326   const isParametersInTestCall = isTestCall$1(parent);
45327   const shouldHugParameters = shouldHugFunctionParameters$1(functionNode);
45328   const printed = [];
45329   iterateFunctionParametersPath(path, (parameterPath, index) => {
45330     const isLastParameter = index === parameters.length - 1;
45331
45332     if (isLastParameter && functionNode.rest) {
45333       printed.push("...");
45334     }
45335
45336     printed.push(print());
45337
45338     if (isLastParameter) {
45339       return;
45340     }
45341
45342     printed.push(",");
45343
45344     if (isParametersInTestCall || shouldHugParameters) {
45345       printed.push(" ");
45346     } else if (isNextLineEmpty$8(parameters[index], options)) {
45347       printed.push(hardline$s, hardline$s);
45348     } else {
45349       printed.push(line$p);
45350     }
45351   }); // If the parent is a call with the first/last argument expansion and this is the
45352   // params of the first/last argument, we don't want the arguments to break and instead
45353   // want the whole expression to be on a new line.
45354   //
45355   // Good:                 Bad:
45356   //   verylongcall(         verylongcall((
45357   //     (a, b) => {           a,
45358   //     }                     b,
45359   //   )                     ) => {
45360   //                         })
45361
45362   if (expandArg) {
45363     if (willBreak$1(typeParams) || willBreak$1(printed)) {
45364       // Removing lines in this case leads to broken or ugly output
45365       throw new ArgExpansionBailout$1();
45366     }
45367
45368     return group$q([removeLines$2(typeParams), "(", removeLines$2(printed), ")"]);
45369   } // Single object destructuring should hug
45370   //
45371   // function({
45372   //   a,
45373   //   b,
45374   //   c
45375   // }) {}
45376
45377
45378   const hasNotParameterDecorator = parameters.every(node => !node.decorators);
45379
45380   if (shouldHugParameters && hasNotParameterDecorator) {
45381     return [typeParams, "(", ...printed, ")"];
45382   } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
45383
45384
45385   if (isParametersInTestCall) {
45386     return [typeParams, "(", ...printed, ")"];
45387   }
45388
45389   const isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction$1(parent) || isTypeAnnotationAFunction(parent) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === functionNode) && parameters.length === 1 && parameters[0].name === null && // `type q = (this: string) => void;`
45390   functionNode.this !== parameters[0] && parameters[0].typeAnnotation && functionNode.typeParameters === null && isSimpleType$1(parameters[0].typeAnnotation) && !functionNode.rest;
45391
45392   if (isFlowShorthandWithOneArg) {
45393     if (options.arrowParens === "always") {
45394       return ["(", ...printed, ")"];
45395     }
45396
45397     return printed;
45398   }
45399
45400   return [typeParams, "(", indent$k([softline$k, ...printed]), ifBreak$i(!hasRestParameter(functionNode) && shouldPrintComma$8(options, "all") ? "," : ""), softline$k, ")"];
45401 }
45402
45403 function shouldHugFunctionParameters$1(node) {
45404   if (!node) {
45405     return false;
45406   }
45407
45408   const parameters = getFunctionParameters$2(node);
45409
45410   if (parameters.length !== 1) {
45411     return false;
45412   }
45413
45414   const [parameter] = parameters;
45415   return !hasComment$9(parameter) && (parameter.type === "ObjectPattern" || parameter.type === "ArrayPattern" || parameter.type === "Identifier" && parameter.typeAnnotation && (parameter.typeAnnotation.type === "TypeAnnotation" || parameter.typeAnnotation.type === "TSTypeAnnotation") && isObjectType$2(parameter.typeAnnotation.typeAnnotation) || parameter.type === "FunctionTypeParam" && isObjectType$2(parameter.typeAnnotation) || parameter.type === "AssignmentPattern" && (parameter.left.type === "ObjectPattern" || parameter.left.type === "ArrayPattern") && (parameter.right.type === "Identifier" || parameter.right.type === "ObjectExpression" && parameter.right.properties.length === 0 || parameter.right.type === "ArrayExpression" && parameter.right.elements.length === 0));
45416 }
45417
45418 function getReturnTypeNode(functionNode) {
45419   let returnTypeNode;
45420
45421   if (functionNode.returnType) {
45422     returnTypeNode = functionNode.returnType;
45423
45424     if (returnTypeNode.typeAnnotation) {
45425       returnTypeNode = returnTypeNode.typeAnnotation;
45426     }
45427   } else if (functionNode.typeAnnotation) {
45428     returnTypeNode = functionNode.typeAnnotation;
45429   }
45430
45431   return returnTypeNode;
45432 } // When parameters are grouped, the return type annotation breaks first.
45433
45434
45435 function shouldGroupFunctionParameters$3(functionNode, returnTypeDoc) {
45436   const returnTypeNode = getReturnTypeNode(functionNode);
45437
45438   if (!returnTypeNode) {
45439     return false;
45440   }
45441
45442   const typeParameters = functionNode.typeParameters && functionNode.typeParameters.params;
45443
45444   if (typeParameters) {
45445     if (typeParameters.length > 1) {
45446       return false;
45447     }
45448
45449     if (typeParameters.length === 1) {
45450       const typeParameter = typeParameters[0];
45451
45452       if (typeParameter.constraint || typeParameter.default) {
45453         return false;
45454       }
45455     }
45456   }
45457
45458   return getFunctionParameters$2(functionNode).length === 1 && (isObjectType$2(returnTypeNode) || willBreak$1(returnTypeDoc));
45459 }
45460
45461 var functionParameters = {
45462   printFunctionParameters: printFunctionParameters$3,
45463   shouldHugFunctionParameters: shouldHugFunctionParameters$1,
45464   shouldGroupFunctionParameters: shouldGroupFunctionParameters$3
45465 };
45466
45467 const {
45468   printComments: printComments$2,
45469   printDanglingComments: printDanglingComments$9
45470 } = comments$4;
45471 const {
45472   getLast: getLast$c
45473 } = util$8;
45474 const {
45475   builders: {
45476     group: group$p,
45477     join: join$l,
45478     line: line$o,
45479     softline: softline$j,
45480     indent: indent$j,
45481     align: align$3,
45482     ifBreak: ifBreak$h
45483   }
45484 } = require$$7$3;
45485 const pathNeedsParens$2 = needsParens_1;
45486 const {
45487   locStart: locStart$n
45488 } = loc$6;
45489 const {
45490   isSimpleType,
45491   isObjectType: isObjectType$1,
45492   hasLeadingOwnLineComment: hasLeadingOwnLineComment$1,
45493   isObjectTypePropertyAFunction,
45494   shouldPrintComma: shouldPrintComma$7
45495 } = utils$5;
45496 const {
45497   printAssignment: printAssignment$2
45498 } = assignment;
45499 const {
45500   printFunctionParameters: printFunctionParameters$2,
45501   shouldGroupFunctionParameters: shouldGroupFunctionParameters$2
45502 } = functionParameters;
45503 const {
45504   printArrayItems: printArrayItems$2
45505 } = array;
45506
45507 function shouldHugType$2(node) {
45508   if (isSimpleType(node) || isObjectType$1(node)) {
45509     return true;
45510   }
45511
45512   if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
45513     const voidCount = node.types.filter(node => node.type === "VoidTypeAnnotation" || node.type === "TSVoidKeyword" || node.type === "NullLiteralTypeAnnotation" || node.type === "TSNullKeyword").length;
45514     const hasObject = node.types.some(node => node.type === "ObjectTypeAnnotation" || node.type === "TSTypeLiteral" || // This is a bit aggressive but captures Array<{x}>
45515     node.type === "GenericTypeAnnotation" || node.type === "TSTypeReference");
45516
45517     if (node.types.length - 1 === voidCount && hasObject) {
45518       return true;
45519     }
45520   }
45521
45522   return false;
45523 }
45524
45525 function printOpaqueType$1(path, options, print) {
45526   const semi = options.semi ? ";" : "";
45527   const node = path.getValue();
45528   const parts = [];
45529   parts.push("opaque type ", print("id"), print("typeParameters"));
45530
45531   if (node.supertype) {
45532     parts.push(": ", print("supertype"));
45533   }
45534
45535   if (node.impltype) {
45536     parts.push(" = ", print("impltype"));
45537   }
45538
45539   parts.push(semi);
45540   return parts;
45541 }
45542
45543 function printTypeAlias$2(path, options, print) {
45544   const semi = options.semi ? ";" : "";
45545   const node = path.getValue();
45546   const parts = [];
45547
45548   if (node.declare) {
45549     parts.push("declare ");
45550   }
45551
45552   parts.push("type ", print("id"), print("typeParameters"));
45553   const rightPropertyName = node.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
45554   return [printAssignment$2(path, options, print, parts, " =", rightPropertyName), semi];
45555 } // `TSIntersectionType` and `IntersectionTypeAnnotation`
45556
45557
45558 function printIntersectionType$2(path, options, print) {
45559   const node = path.getValue();
45560   const types = path.map(print, "types");
45561   const result = [];
45562   let wasIndented = false;
45563
45564   for (let i = 0; i < types.length; ++i) {
45565     if (i === 0) {
45566       result.push(types[i]);
45567     } else if (isObjectType$1(node.types[i - 1]) && isObjectType$1(node.types[i])) {
45568       // If both are objects, don't indent
45569       result.push([" & ", wasIndented ? indent$j(types[i]) : types[i]]);
45570     } else if (!isObjectType$1(node.types[i - 1]) && !isObjectType$1(node.types[i])) {
45571       // If no object is involved, go to the next line if it breaks
45572       result.push(indent$j([" &", line$o, types[i]]));
45573     } else {
45574       // If you go from object to non-object or vis-versa, then inline it
45575       if (i > 1) {
45576         wasIndented = true;
45577       }
45578
45579       result.push(" & ", i > 1 ? indent$j(types[i]) : types[i]);
45580     }
45581   }
45582
45583   return group$p(result);
45584 } // `TSUnionType` and `UnionTypeAnnotation`
45585
45586
45587 function printUnionType$2(path, options, print) {
45588   const node = path.getValue(); // single-line variation
45589   // A | B | C
45590   // multi-line variation
45591   // | A
45592   // | B
45593   // | C
45594
45595   const parent = path.getParentNode(); // If there's a leading comment, the parent is doing the indentation
45596
45597   const shouldIndent = parent.type !== "TypeParameterInstantiation" && parent.type !== "TSTypeParameterInstantiation" && parent.type !== "GenericTypeAnnotation" && parent.type !== "TSTypeReference" && parent.type !== "TSTypeAssertion" && parent.type !== "TupleTypeAnnotation" && parent.type !== "TSTupleType" && !(parent.type === "FunctionTypeParam" && !parent.name && path.getParentNode(1).this !== parent) && !((parent.type === "TypeAlias" || parent.type === "VariableDeclarator" || parent.type === "TSTypeAliasDeclaration") && hasLeadingOwnLineComment$1(options.originalText, node)); // {
45598   //   a: string
45599   // } | null | void
45600   // should be inlined and not be printed in the multi-line variant
45601
45602   const shouldHug = shouldHugType$2(node); // We want to align the children but without its comment, so it looks like
45603   // | child1
45604   // // comment
45605   // | child2
45606
45607   const printed = path.map(typePath => {
45608     let printedType = print();
45609
45610     if (!shouldHug) {
45611       printedType = align$3(2, printedType);
45612     }
45613
45614     return printComments$2(typePath, printedType, options);
45615   }, "types");
45616
45617   if (shouldHug) {
45618     return join$l(" | ", printed);
45619   }
45620
45621   const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment$1(options.originalText, node);
45622   const code = [ifBreak$h([shouldAddStartLine ? line$o : "", "| "]), join$l([line$o, "| "], printed)];
45623
45624   if (pathNeedsParens$2(path, options)) {
45625     return group$p([indent$j(code), softline$j]);
45626   }
45627
45628   if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
45629     return group$p([indent$j([ifBreak$h(["(", softline$j]), code]), softline$j, ifBreak$h(")")]);
45630   }
45631
45632   return group$p(shouldIndent ? indent$j(code) : code);
45633 } // `TSFunctionType` and `FunctionTypeAnnotation`
45634
45635
45636 function printFunctionType$2(path, options, print) {
45637   const node = path.getValue();
45638   const parts = []; // FunctionTypeAnnotation is ambiguous:
45639   // declare function foo(a: B): void; OR
45640   // var A: (a: B) => void;
45641
45642   const parent = path.getParentNode(0);
45643   const parentParent = path.getParentNode(1);
45644   const parentParentParent = path.getParentNode(2);
45645   let isArrowFunctionTypeAnnotation = node.type === "TSFunctionType" || !((parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeInternalSlot") && !parent.variance && !parent.optional && locStart$n(parent) === locStart$n(node) || parent.type === "ObjectTypeCallProperty" || parentParentParent && parentParentParent.type === "DeclareFunction");
45646   let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation"); // Sadly we can't put it inside of AstPath::needsColon because we are
45647   // printing ":" as part of the expression and it would put parenthesis
45648   // around :(
45649
45650   const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
45651
45652   if (isObjectTypePropertyAFunction(parent)) {
45653     isArrowFunctionTypeAnnotation = true;
45654     needsColon = true;
45655   }
45656
45657   if (needsParens) {
45658     parts.push("(");
45659   }
45660
45661   const parametersDoc = printFunctionParameters$2(path, print, options,
45662   /* expandArg */
45663   false,
45664   /* printTypeParams */
45665   true); // The returnType is not wrapped in a TypeAnnotation, so the colon
45666   // needs to be added separately.
45667
45668   const returnTypeDoc = node.returnType || node.predicate || node.typeAnnotation ? [isArrowFunctionTypeAnnotation ? " => " : ": ", print("returnType"), print("predicate"), print("typeAnnotation")] : "";
45669   const shouldGroupParameters = shouldGroupFunctionParameters$2(node, returnTypeDoc);
45670   parts.push(shouldGroupParameters ? group$p(parametersDoc) : parametersDoc);
45671
45672   if (returnTypeDoc) {
45673     parts.push(returnTypeDoc);
45674   }
45675
45676   if (needsParens) {
45677     parts.push(")");
45678   }
45679
45680   return group$p(parts);
45681 } // `TSTupleType` and `TupleTypeAnnotation`
45682
45683
45684 function printTupleType$2(path, options, print) {
45685   const node = path.getValue();
45686   const typesField = node.type === "TSTupleType" ? "elementTypes" : "types";
45687   const hasRest = node[typesField].length > 0 && getLast$c(node[typesField]).type === "TSRestType";
45688   return group$p(["[", indent$j([softline$j, printArrayItems$2(path, options, typesField, print)]), ifBreak$h(shouldPrintComma$7(options, "all") && !hasRest ? "," : ""), printDanglingComments$9(path, options,
45689   /* sameIndent */
45690   true), softline$j, "]"]);
45691 } // `TSIndexedAccessType`, `IndexedAccessType`, and `OptionalIndexedAccessType`
45692
45693
45694 function printIndexedAccessType$2(path, options, print) {
45695   const node = path.getValue();
45696   const leftDelimiter = node.type === "OptionalIndexedAccessType" && node.optional ? "?.[" : "[";
45697   return [print("objectType"), leftDelimiter, print("indexType"), "]"];
45698 }
45699
45700 var typeAnnotation = {
45701   printOpaqueType: printOpaqueType$1,
45702   printTypeAlias: printTypeAlias$2,
45703   printIntersectionType: printIntersectionType$2,
45704   printUnionType: printUnionType$2,
45705   printFunctionType: printFunctionType$2,
45706   printTupleType: printTupleType$2,
45707   printIndexedAccessType: printIndexedAccessType$2,
45708   shouldHugType: shouldHugType$2
45709 };
45710
45711 const {
45712   printDanglingComments: printDanglingComments$8
45713 } = comments$4;
45714 const {
45715   builders: {
45716     join: join$k,
45717     line: line$n,
45718     hardline: hardline$r,
45719     softline: softline$i,
45720     group: group$o,
45721     indent: indent$i,
45722     ifBreak: ifBreak$g
45723   }
45724 } = require$$7$3;
45725 const {
45726   isTestCall,
45727   hasComment: hasComment$8,
45728   CommentCheckFlags: CommentCheckFlags$8,
45729   isTSXFile,
45730   shouldPrintComma: shouldPrintComma$6,
45731   getFunctionParameters: getFunctionParameters$1,
45732   isObjectType
45733 } = utils$5;
45734 const {
45735   createGroupIdMapper: createGroupIdMapper$1
45736 } = util$8;
45737 const {
45738   shouldHugType: shouldHugType$1
45739 } = typeAnnotation;
45740 const {
45741   isArrowFunctionVariableDeclarator
45742 } = assignment;
45743 const getTypeParametersGroupId$2 = createGroupIdMapper$1("typeParameters");
45744
45745 function printTypeParameters$2(path, options, print, paramsKey) {
45746   const node = path.getValue();
45747
45748   if (!node[paramsKey]) {
45749     return "";
45750   } // for TypeParameterDeclaration typeParameters is a single node
45751
45752
45753   if (!Array.isArray(node[paramsKey])) {
45754     return print(paramsKey);
45755   }
45756
45757   const grandparent = path.getNode(2);
45758   const isParameterInTestCall = grandparent && isTestCall(grandparent);
45759   const isArrowFunctionVariable = path.match(node => !(node[paramsKey].length === 1 && isObjectType(node[paramsKey][0])), undefined, (node, name) => name === "typeAnnotation", node => node.type === "Identifier", isArrowFunctionVariableDeclarator);
45760   const shouldInline = !isArrowFunctionVariable && (isParameterInTestCall || node[paramsKey].length === 0 || node[paramsKey].length === 1 && (node[paramsKey][0].type === "NullableTypeAnnotation" || shouldHugType$1(node[paramsKey][0])));
45761
45762   if (shouldInline) {
45763     return ["<", join$k(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(path, options), ">"];
45764   } // Keep comma if the file extension is .tsx and
45765   // has one type parameter that isn't extend with any types.
45766   // Because, otherwise formatted result will be invalid as tsx.
45767
45768
45769   const trailingComma = node.type === "TSTypeParameterInstantiation" // https://github.com/microsoft/TypeScript/issues/21984
45770   ? "" : getFunctionParameters$1(node).length === 1 && isTSXFile(options) && !node[paramsKey][0].constraint && path.getParentNode().type === "ArrowFunctionExpression" ? "," : shouldPrintComma$6(options, "all") ? ifBreak$g(",") : "";
45771   return group$o(["<", indent$i([softline$i, join$k([",", line$n], path.map(print, paramsKey))]), trailingComma, softline$i, ">"], {
45772     id: getTypeParametersGroupId$2(node)
45773   });
45774 }
45775
45776 function printDanglingCommentsForInline(path, options) {
45777   const node = path.getValue();
45778
45779   if (!hasComment$8(node, CommentCheckFlags$8.Dangling)) {
45780     return "";
45781   }
45782
45783   const hasOnlyBlockComments = !hasComment$8(node, CommentCheckFlags$8.Line);
45784   const printed = printDanglingComments$8(path, options,
45785   /* sameIndent */
45786   hasOnlyBlockComments);
45787
45788   if (hasOnlyBlockComments) {
45789     return printed;
45790   }
45791
45792   return [printed, hardline$r];
45793 }
45794
45795 function printTypeParameter$2(path, options, print) {
45796   const node = path.getValue();
45797   const parts = [];
45798   const parent = path.getParentNode();
45799
45800   if (parent.type === "TSMappedType") {
45801     parts.push("[", print("name"));
45802
45803     if (node.constraint) {
45804       parts.push(" in ", print("constraint"));
45805     }
45806
45807     if (parent.nameType) {
45808       parts.push(" as ", path.callParent(() => print("nameType")));
45809     }
45810
45811     parts.push("]");
45812     return parts;
45813   }
45814
45815   if (node.variance) {
45816     parts.push(print("variance"));
45817   }
45818
45819   parts.push(print("name"));
45820
45821   if (node.bound) {
45822     parts.push(": ", print("bound"));
45823   }
45824
45825   if (node.constraint) {
45826     parts.push(" extends ", print("constraint"));
45827   }
45828
45829   if (node.default) {
45830     parts.push(" = ", print("default"));
45831   }
45832
45833   return parts;
45834 }
45835
45836 var typeParameters = {
45837   printTypeParameter: printTypeParameter$2,
45838   printTypeParameters: printTypeParameters$2,
45839   getTypeParametersGroupId: getTypeParametersGroupId$2
45840 };
45841
45842 const {
45843   printComments: printComments$1
45844 } = comments$4;
45845 const {
45846   printString: printString$3,
45847   printNumber: printNumber$3
45848 } = util$8;
45849 const {
45850   isNumericLiteral,
45851   isSimpleNumber,
45852   isStringLiteral,
45853   isStringPropSafeToUnquote,
45854   rawText: rawText$2
45855 } = utils$5;
45856 const {
45857   printAssignment: printAssignment$1
45858 } = assignment;
45859 const needsQuoteProps = new WeakMap();
45860
45861 function printPropertyKey$4(path, options, print) {
45862   const node = path.getNode();
45863
45864   if (node.computed) {
45865     return ["[", print("key"), "]"];
45866   }
45867
45868   const parent = path.getParentNode();
45869   const {
45870     key
45871   } = node; // flow has `Identifier` key, other parsers use `PrivateIdentifier` (ESTree) or `PrivateName`
45872
45873   if (node.type === "ClassPrivateProperty" && key.type === "Identifier") {
45874     return ["#", print("key")];
45875   }
45876
45877   if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
45878     const objectHasStringProp = (parent.properties || parent.body || parent.members).some(prop => !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToUnquote(prop, options));
45879     needsQuoteProps.set(parent, objectHasStringProp);
45880   }
45881
45882   if ((key.type === "Identifier" || isNumericLiteral(key) && isSimpleNumber(printNumber$3(rawText$2(key))) && // Avoid converting 999999999999999999999 to 1e+21, 0.99999999999999999 to 1 and 1.0 to 1.
45883   String(key.value) === printNumber$3(rawText$2(key)) && // Quoting number keys is safe in JS and Flow, but not in TypeScript (as
45884   // mentioned in `isStringPropSafeToUnquote`).
45885   !(options.parser === "typescript" || options.parser === "babel-ts")) && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
45886     // a -> "a"
45887     // 1 -> "1"
45888     // 1.5 -> "1.5"
45889     const prop = printString$3(JSON.stringify(key.type === "Identifier" ? key.name : key.value.toString()), options);
45890     return path.call(keyPath => printComments$1(keyPath, prop, options), "key");
45891   }
45892
45893   if (isStringPropSafeToUnquote(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
45894     // 'a' -> a
45895     // '1' -> 1
45896     // '1.5' -> 1.5
45897     return path.call(keyPath => printComments$1(keyPath, /^\d/.test(key.value) ? printNumber$3(key.value) : key.value, options), "key");
45898   }
45899
45900   return print("key");
45901 }
45902
45903 function printProperty$1(path, options, print) {
45904   const node = path.getValue();
45905
45906   if (node.shorthand) {
45907     return print("value");
45908   }
45909
45910   return printAssignment$1(path, options, print, printPropertyKey$4(path, options, print), ":", "value");
45911 }
45912
45913 var property = {
45914   printProperty: printProperty$1,
45915   printPropertyKey: printPropertyKey$4
45916 };
45917
45918 /** @typedef {import("../../document/doc-builders").Doc} Doc */
45919
45920
45921 const assert$2 = require$$0__default$3["default"];
45922 const {
45923   printDanglingComments: printDanglingComments$7,
45924   printCommentsSeparately
45925 } = comments$4;
45926 const getLast$b = getLast_1;
45927 const {
45928   getNextNonSpaceNonCommentCharacterIndex
45929 } = util$8;
45930 const {
45931   builders: {
45932     line: line$m,
45933     softline: softline$h,
45934     group: group$n,
45935     indent: indent$h,
45936     ifBreak: ifBreak$f,
45937     hardline: hardline$q,
45938     join: join$j,
45939     indentIfBreak: indentIfBreak$1
45940   },
45941   utils: {
45942     removeLines: removeLines$1,
45943     willBreak
45944   }
45945 } = require$$7$3;
45946 const {
45947   ArgExpansionBailout
45948 } = errors;
45949 const {
45950   getFunctionParameters,
45951   hasLeadingOwnLineComment,
45952   isFlowAnnotationComment,
45953   isJsxNode: isJsxNode$2,
45954   isTemplateOnItsOwnLine,
45955   shouldPrintComma: shouldPrintComma$5,
45956   startsWithNoLookaheadToken,
45957   isBinaryish,
45958   isLineComment: isLineComment$2,
45959   hasComment: hasComment$7,
45960   getComments: getComments$2,
45961   CommentCheckFlags: CommentCheckFlags$7,
45962   isCallLikeExpression,
45963   isCallExpression: isCallExpression$3,
45964   getCallArguments,
45965   hasNakedLeftSide: hasNakedLeftSide$1,
45966   getLeftSide
45967 } = utils$5;
45968 const {
45969   locEnd: locEnd$l
45970 } = loc$6;
45971 const {
45972   printFunctionParameters: printFunctionParameters$1,
45973   shouldGroupFunctionParameters: shouldGroupFunctionParameters$1
45974 } = functionParameters;
45975 const {
45976   printPropertyKey: printPropertyKey$3
45977 } = property;
45978 const {
45979   printFunctionTypeParameters
45980 } = misc$1;
45981
45982 function printFunction$2(path, print, options, args) {
45983   const node = path.getValue();
45984   let expandArg = false;
45985
45986   if ((node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && args && args.expandLastArg) {
45987     const parent = path.getParentNode();
45988
45989     if (isCallExpression$3(parent) && getCallArguments(parent).length > 1) {
45990       expandArg = true;
45991     }
45992   }
45993
45994   const parts = []; // For TypeScript the TSDeclareFunction node shares the AST
45995   // structure with FunctionDeclaration
45996
45997   if (node.type === "TSDeclareFunction" && node.declare) {
45998     parts.push("declare ");
45999   }
46000
46001   if (node.async) {
46002     parts.push("async ");
46003   }
46004
46005   if (node.generator) {
46006     parts.push("function* ");
46007   } else {
46008     parts.push("function ");
46009   }
46010
46011   if (node.id) {
46012     parts.push(print("id"));
46013   }
46014
46015   const parametersDoc = printFunctionParameters$1(path, print, options, expandArg);
46016   const returnTypeDoc = printReturnType(path, print, options);
46017   const shouldGroupParameters = shouldGroupFunctionParameters$1(node, returnTypeDoc);
46018   parts.push(printFunctionTypeParameters(path, options, print), group$n([shouldGroupParameters ? group$n(parametersDoc) : parametersDoc, returnTypeDoc]), node.body ? " " : "", print("body"));
46019
46020   if (options.semi && (node.declare || !node.body)) {
46021     parts.push(";");
46022   }
46023
46024   return parts;
46025 }
46026
46027 function printMethod$2(path, options, print) {
46028   const node = path.getNode();
46029   const {
46030     kind
46031   } = node;
46032   const value = node.value || node;
46033   const parts = [];
46034
46035   if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
46036     if (value.async) {
46037       parts.push("async ");
46038     }
46039   } else {
46040     assert$2.ok(kind === "get" || kind === "set");
46041     parts.push(kind, " ");
46042   } // A `getter`/`setter` can't be a generator, but it's recoverable
46043
46044
46045   if (value.generator) {
46046     parts.push("*");
46047   }
46048
46049   parts.push(printPropertyKey$3(path, options, print), node.optional || node.key.optional ? "?" : "");
46050
46051   if (node === value) {
46052     parts.push(printMethodInternal$1(path, options, print));
46053   } else if (value.type === "FunctionExpression") {
46054     parts.push(path.call(path => printMethodInternal$1(path, options, print), "value"));
46055   } else {
46056     parts.push(print("value"));
46057   }
46058
46059   return parts;
46060 }
46061
46062 function printMethodInternal$1(path, options, print) {
46063   const node = path.getNode();
46064   const parametersDoc = printFunctionParameters$1(path, print, options);
46065   const returnTypeDoc = printReturnType(path, print, options);
46066   const shouldGroupParameters = shouldGroupFunctionParameters$1(node, returnTypeDoc);
46067   const parts = [printFunctionTypeParameters(path, options, print), group$n([shouldGroupParameters ? group$n(parametersDoc) : parametersDoc, returnTypeDoc])];
46068
46069   if (node.body) {
46070     parts.push(" ", print("body"));
46071   } else {
46072     parts.push(options.semi ? ";" : "");
46073   }
46074
46075   return parts;
46076 }
46077
46078 function printArrowFunctionSignature(path, options, print, args) {
46079   const node = path.getValue();
46080   const parts = [];
46081
46082   if (node.async) {
46083     parts.push("async ");
46084   }
46085
46086   if (shouldPrintParamsWithoutParens$1(path, options)) {
46087     parts.push(print(["params", 0]));
46088   } else {
46089     const expandArg = args && (args.expandLastArg || args.expandFirstArg);
46090     let returnTypeDoc = printReturnType(path, print, options);
46091
46092     if (expandArg) {
46093       if (willBreak(returnTypeDoc)) {
46094         throw new ArgExpansionBailout();
46095       }
46096
46097       returnTypeDoc = group$n(removeLines$1(returnTypeDoc));
46098     }
46099
46100     parts.push(group$n([printFunctionParameters$1(path, print, options, expandArg,
46101     /* printTypeParams */
46102     true), returnTypeDoc]));
46103   }
46104
46105   const dangling = printDanglingComments$7(path, options,
46106   /* sameIndent */
46107   true, comment => {
46108     const nextCharacter = getNextNonSpaceNonCommentCharacterIndex(options.originalText, comment, locEnd$l);
46109     return nextCharacter !== false && options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
46110   });
46111
46112   if (dangling) {
46113     parts.push(" ", dangling);
46114   }
46115
46116   return parts;
46117 }
46118
46119 function printArrowChain(path, args, signatures, shouldBreak, bodyDoc, tailNode) {
46120   const name = path.getName();
46121   const parent = path.getParentNode();
46122   const isCallee = isCallLikeExpression(parent) && name === "callee";
46123   const isAssignmentRhs = Boolean(args && args.assignmentLayout);
46124   const shouldPutBodyOnSeparateLine = tailNode.body.type !== "BlockStatement" && tailNode.body.type !== "ObjectExpression" && tailNode.body.type !== "SequenceExpression";
46125   const shouldBreakBeforeChain = isCallee && shouldPutBodyOnSeparateLine || args && args.assignmentLayout === "chain-tail-arrow-chain";
46126   const groupId = Symbol("arrow-chain"); // We handle sequence expressions as the body of arrows specially,
46127   // so that the required parentheses end up on their own lines.
46128
46129   if (tailNode.body.type === "SequenceExpression") {
46130     bodyDoc = group$n(["(", indent$h([softline$h, bodyDoc]), softline$h, ")"]);
46131   }
46132
46133   return group$n([group$n(indent$h([isCallee || isAssignmentRhs ? softline$h : "", group$n(join$j([" =>", line$m], signatures), {
46134     shouldBreak
46135   })]), {
46136     id: groupId,
46137     shouldBreak: shouldBreakBeforeChain
46138   }), " =>", indentIfBreak$1(shouldPutBodyOnSeparateLine ? indent$h([line$m, bodyDoc]) : [" ", bodyDoc], {
46139     groupId
46140   }), isCallee ? ifBreak$f(softline$h, "", {
46141     groupId
46142   }) : ""]);
46143 }
46144
46145 function printArrowFunction$1(path, options, print, args) {
46146   let node = path.getValue();
46147   /** @type {Doc[]} */
46148
46149   const signatures = [];
46150   const body = [];
46151   let chainShouldBreak = false;
46152
46153   (function rec() {
46154     const doc = printArrowFunctionSignature(path, options, print, args);
46155
46156     if (signatures.length === 0) {
46157       signatures.push(doc);
46158     } else {
46159       const {
46160         leading,
46161         trailing
46162       } = printCommentsSeparately(path, options);
46163       signatures.push([leading, doc]);
46164       body.unshift(trailing);
46165     }
46166
46167     chainShouldBreak = chainShouldBreak || // Always break the chain if:
46168     node.returnType && getFunctionParameters(node).length > 0 || node.typeParameters || getFunctionParameters(node).some(param => param.type !== "Identifier");
46169
46170     if (node.body.type !== "ArrowFunctionExpression" || args && args.expandLastArg) {
46171       body.unshift(print("body", args));
46172     } else {
46173       node = node.body;
46174       path.call(rec, "body");
46175     }
46176   })();
46177
46178   if (signatures.length > 1) {
46179     return printArrowChain(path, args, signatures, chainShouldBreak, body, node);
46180   }
46181
46182   const parts = signatures;
46183   parts.push(" =>"); // We want to always keep these types of nodes on the same line
46184   // as the arrow.
46185
46186   if (!hasLeadingOwnLineComment(options.originalText, node.body) && (node.body.type === "ArrayExpression" || node.body.type === "ObjectExpression" || node.body.type === "BlockStatement" || isJsxNode$2(node.body) || isTemplateOnItsOwnLine(node.body, options.originalText) || node.body.type === "ArrowFunctionExpression" || node.body.type === "DoExpression")) {
46187     return group$n([...parts, " ", body]);
46188   } // We handle sequence expressions as the body of arrows specially,
46189   // so that the required parentheses end up on their own lines.
46190
46191
46192   if (node.body.type === "SequenceExpression") {
46193     return group$n([...parts, group$n([" (", indent$h([softline$h, body]), softline$h, ")"])]);
46194   } // if the arrow function is expanded as last argument, we are adding a
46195   // level of indentation and need to add a softline to align the closing )
46196   // with the opening (, or if it's inside a JSXExpression (e.g. an attribute)
46197   // we should align the expression's closing } with the line with the opening {.
46198
46199
46200   const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !hasComment$7(node);
46201   const printTrailingComma = args && args.expandLastArg && shouldPrintComma$5(options, "all"); // In order to avoid confusion between
46202   // a => a ? a : a
46203   // a <= a ? a : a
46204
46205   const shouldAddParens = node.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken(node.body,
46206   /* forbidFunctionAndClass */
46207   false);
46208   return group$n([...parts, group$n([indent$h([line$m, shouldAddParens ? ifBreak$f("", "(") : "", body, shouldAddParens ? ifBreak$f("", ")") : ""]), shouldAddSoftLine ? [ifBreak$f(printTrailingComma ? "," : ""), softline$h] : ""])]);
46209 }
46210
46211 function canPrintParamsWithoutParens(node) {
46212   const parameters = getFunctionParameters(node);
46213   return parameters.length === 1 && !node.typeParameters && !hasComment$7(node, CommentCheckFlags$7.Dangling) && parameters[0].type === "Identifier" && !parameters[0].typeAnnotation && !hasComment$7(parameters[0]) && !parameters[0].optional && !node.predicate && !node.returnType;
46214 }
46215
46216 function shouldPrintParamsWithoutParens$1(path, options) {
46217   if (options.arrowParens === "always") {
46218     return false;
46219   }
46220
46221   if (options.arrowParens === "avoid") {
46222     const node = path.getValue();
46223     return canPrintParamsWithoutParens(node);
46224   } // Fallback default; should be unreachable
46225
46226   /* istanbul ignore next */
46227
46228
46229   return false;
46230 }
46231 /** @returns {Doc} */
46232
46233
46234 function printReturnType(path, print, options) {
46235   const node = path.getValue();
46236   const returnType = print("returnType");
46237
46238   if (node.returnType && isFlowAnnotationComment(options.originalText, node.returnType)) {
46239     return [" /*: ", returnType, " */"];
46240   }
46241
46242   const parts = [returnType]; // prepend colon to TypeScript type annotation
46243
46244   if (node.returnType && node.returnType.typeAnnotation) {
46245     parts.unshift(": ");
46246   }
46247
46248   if (node.predicate) {
46249     // The return type will already add the colon, but otherwise we
46250     // need to do it ourselves
46251     parts.push(node.returnType ? " " : ": ", print("predicate"));
46252   }
46253
46254   return parts;
46255 } // `ReturnStatement` and `ThrowStatement`
46256
46257
46258 function printReturnOrThrowArgument(path, options, print) {
46259   const node = path.getValue();
46260   const semi = options.semi ? ";" : "";
46261   const parts = [];
46262
46263   if (node.argument) {
46264     if (returnArgumentHasLeadingComment(options, node.argument)) {
46265       parts.push([" (", indent$h([hardline$q, print("argument")]), hardline$q, ")"]);
46266     } else if (isBinaryish(node.argument) || node.argument.type === "SequenceExpression") {
46267       parts.push(group$n([ifBreak$f(" (", " "), indent$h([softline$h, print("argument")]), softline$h, ifBreak$f(")")]));
46268     } else {
46269       parts.push(" ", print("argument"));
46270     }
46271   }
46272
46273   const comments = getComments$2(node);
46274   const lastComment = getLast$b(comments);
46275   const isLastCommentLine = lastComment && isLineComment$2(lastComment);
46276
46277   if (isLastCommentLine) {
46278     parts.push(semi);
46279   }
46280
46281   if (hasComment$7(node, CommentCheckFlags$7.Dangling)) {
46282     parts.push(" ", printDanglingComments$7(path, options,
46283     /* sameIndent */
46284     true));
46285   }
46286
46287   if (!isLastCommentLine) {
46288     parts.push(semi);
46289   }
46290
46291   return parts;
46292 }
46293
46294 function printReturnStatement$1(path, options, print) {
46295   return ["return", printReturnOrThrowArgument(path, options, print)];
46296 }
46297
46298 function printThrowStatement$1(path, options, print) {
46299   return ["throw", printReturnOrThrowArgument(path, options, print)];
46300 } // This recurses the return argument, looking for the first token
46301 // (the leftmost leaf node) and, if it (or its parents) has any
46302 // leadingComments, returns true (so it can be wrapped in parens).
46303
46304
46305 function returnArgumentHasLeadingComment(options, argument) {
46306   if (hasLeadingOwnLineComment(options.originalText, argument)) {
46307     return true;
46308   }
46309
46310   if (hasNakedLeftSide$1(argument)) {
46311     let leftMost = argument;
46312     let newLeftMost;
46313
46314     while (newLeftMost = getLeftSide(leftMost)) {
46315       leftMost = newLeftMost;
46316
46317       if (hasLeadingOwnLineComment(options.originalText, leftMost)) {
46318         return true;
46319       }
46320     }
46321   }
46322
46323   return false;
46324 }
46325
46326 var _function = {
46327   printFunction: printFunction$2,
46328   printArrowFunction: printArrowFunction$1,
46329   printMethod: printMethod$2,
46330   printReturnStatement: printReturnStatement$1,
46331   printThrowStatement: printThrowStatement$1,
46332   printMethodInternal: printMethodInternal$1,
46333   shouldPrintParamsWithoutParens: shouldPrintParamsWithoutParens$1
46334 };
46335
46336 const {
46337   isNonEmptyArray: isNonEmptyArray$c,
46338   hasNewline: hasNewline$4
46339 } = util$8;
46340 const {
46341   builders: {
46342     line: line$l,
46343     hardline: hardline$p,
46344     join: join$i,
46345     breakParent: breakParent$7,
46346     group: group$m
46347   }
46348 } = require$$7$3;
46349 const {
46350   locStart: locStart$m,
46351   locEnd: locEnd$k
46352 } = loc$6;
46353 const {
46354   getParentExportDeclaration: getParentExportDeclaration$1
46355 } = utils$5;
46356
46357 function printClassMemberDecorators$1(path, options, print) {
46358   const node = path.getValue();
46359   return group$m([join$i(line$l, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators(node, options) ? hardline$p : line$l]);
46360 }
46361
46362 function printDecoratorsBeforeExport$1(path, options, print) {
46363   // Export declarations are responsible for printing any decorators
46364   // that logically apply to node.declaration.
46365   return [join$i(hardline$p, path.map(print, "declaration", "decorators")), hardline$p];
46366 }
46367
46368 function printDecorators$1(path, options, print) {
46369   const node = path.getValue();
46370   const {
46371     decorators
46372   } = node;
46373
46374   if (!isNonEmptyArray$c(decorators) || // If the parent node is an export declaration and the decorator
46375   // was written before the export, the export will be responsible
46376   // for printing the decorators.
46377   hasDecoratorsBeforeExport$1(path.getParentNode())) {
46378     return;
46379   }
46380
46381   const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators(node, options);
46382   return [getParentExportDeclaration$1(path) ? hardline$p : shouldBreak ? breakParent$7 : "", join$i(line$l, path.map(print, "decorators")), line$l];
46383 }
46384
46385 function hasNewlineBetweenOrAfterDecorators(node, options) {
46386   return node.decorators.some(decorator => hasNewline$4(options.originalText, locEnd$k(decorator)));
46387 }
46388
46389 function hasDecoratorsBeforeExport$1(node) {
46390   if (node.type !== "ExportDefaultDeclaration" && node.type !== "ExportNamedDeclaration" && node.type !== "DeclareExportDeclaration") {
46391     return false;
46392   }
46393
46394   const decorators = node.declaration && node.declaration.decorators;
46395   return isNonEmptyArray$c(decorators) && locStart$m(node, {
46396     ignoreDecorators: true
46397   }) > locStart$m(decorators[0]);
46398 }
46399
46400 var decorators = {
46401   printDecorators: printDecorators$1,
46402   printClassMemberDecorators: printClassMemberDecorators$1,
46403   printDecoratorsBeforeExport: printDecoratorsBeforeExport$1,
46404   hasDecoratorsBeforeExport: hasDecoratorsBeforeExport$1
46405 };
46406
46407 const {
46408   isNonEmptyArray: isNonEmptyArray$b,
46409   createGroupIdMapper
46410 } = util$8;
46411 const {
46412   printComments,
46413   printDanglingComments: printDanglingComments$6
46414 } = comments$4;
46415 const {
46416   builders: {
46417     join: join$h,
46418     line: line$k,
46419     hardline: hardline$o,
46420     softline: softline$g,
46421     group: group$l,
46422     indent: indent$g,
46423     ifBreak: ifBreak$e
46424   }
46425 } = require$$7$3;
46426 const {
46427   hasComment: hasComment$6,
46428   CommentCheckFlags: CommentCheckFlags$6
46429 } = utils$5;
46430 const {
46431   getTypeParametersGroupId: getTypeParametersGroupId$1
46432 } = typeParameters;
46433 const {
46434   printMethod: printMethod$1
46435 } = _function;
46436 const {
46437   printOptionalToken: printOptionalToken$4,
46438   printTypeAnnotation: printTypeAnnotation$3
46439 } = misc$1;
46440 const {
46441   printPropertyKey: printPropertyKey$2
46442 } = property;
46443 const {
46444   printAssignment
46445 } = assignment;
46446 const {
46447   printClassMemberDecorators
46448 } = decorators;
46449
46450 function printClass$2(path, options, print) {
46451   const node = path.getValue();
46452   const parts = [];
46453
46454   if (node.declare) {
46455     parts.push("declare ");
46456   }
46457
46458   if (node.abstract) {
46459     parts.push("abstract ");
46460   }
46461
46462   parts.push("class"); // Keep old behaviour of extends in same line
46463   // If there is only on extends and there are not comments
46464
46465   const groupMode = node.id && hasComment$6(node.id, CommentCheckFlags$6.Trailing) || node.superClass && hasComment$6(node.superClass) || isNonEmptyArray$b(node.extends) || // DeclareClass
46466   isNonEmptyArray$b(node.mixins) || isNonEmptyArray$b(node.implements);
46467   const partsGroup = [];
46468   const extendsParts = [];
46469
46470   if (node.id) {
46471     partsGroup.push(" ", print("id"));
46472   }
46473
46474   partsGroup.push(print("typeParameters"));
46475
46476   if (node.superClass) {
46477     const printed = ["extends ", printSuperClass(path, options, print), print("superTypeParameters")];
46478     const printedWithComments = path.call(superClass => printComments(superClass, printed, options), "superClass");
46479
46480     if (groupMode) {
46481       extendsParts.push(line$k, group$l(printedWithComments));
46482     } else {
46483       extendsParts.push(" ", printedWithComments);
46484     }
46485   } else {
46486     extendsParts.push(printList(path, options, print, "extends"));
46487   }
46488
46489   extendsParts.push(printList(path, options, print, "mixins"), printList(path, options, print, "implements"));
46490
46491   if (groupMode) {
46492     let printedPartsGroup;
46493
46494     if (shouldIndentOnlyHeritageClauses(node)) {
46495       printedPartsGroup = [...partsGroup, indent$g(extendsParts)];
46496     } else {
46497       printedPartsGroup = indent$g([...partsGroup, extendsParts]);
46498     }
46499
46500     parts.push(group$l(printedPartsGroup, {
46501       id: getHeritageGroupId(node)
46502     }));
46503   } else {
46504     parts.push(...partsGroup, ...extendsParts);
46505   }
46506
46507   parts.push(" ", print("body"));
46508   return parts;
46509 }
46510
46511 const getHeritageGroupId = createGroupIdMapper("heritageGroup");
46512
46513 function printHardlineAfterHeritage$2(node) {
46514   return ifBreak$e(hardline$o, "", {
46515     groupId: getHeritageGroupId(node)
46516   });
46517 }
46518
46519 function hasMultipleHeritage(node) {
46520   return ["superClass", "extends", "mixins", "implements"].filter(key => Boolean(node[key])).length > 1;
46521 }
46522
46523 function shouldIndentOnlyHeritageClauses(node) {
46524   return node.typeParameters && !hasComment$6(node.typeParameters, CommentCheckFlags$6.Trailing | CommentCheckFlags$6.Line) && !hasMultipleHeritage(node);
46525 }
46526
46527 function printList(path, options, print, listName) {
46528   const node = path.getValue();
46529
46530   if (!isNonEmptyArray$b(node[listName])) {
46531     return "";
46532   }
46533
46534   const printedLeadingComments = printDanglingComments$6(path, options,
46535   /* sameIndent */
46536   true, ({
46537     marker
46538   }) => marker === listName);
46539   return [shouldIndentOnlyHeritageClauses(node) ? ifBreak$e(" ", line$k, {
46540     groupId: getTypeParametersGroupId$1(node.typeParameters)
46541   }) : line$k, printedLeadingComments, printedLeadingComments && hardline$o, listName, group$l(indent$g([line$k, join$h([",", line$k], path.map(print, listName))]))];
46542 }
46543
46544 function printSuperClass(path, options, print) {
46545   const printed = print("superClass");
46546   const parent = path.getParentNode();
46547
46548   if (parent.type === "AssignmentExpression") {
46549     return group$l(ifBreak$e(["(", indent$g([softline$g, printed]), softline$g, ")"], printed));
46550   }
46551
46552   return printed;
46553 }
46554
46555 function printClassMethod$2(path, options, print) {
46556   const node = path.getValue();
46557   const parts = [];
46558
46559   if (isNonEmptyArray$b(node.decorators)) {
46560     parts.push(printClassMemberDecorators(path, options, print));
46561   }
46562
46563   if (node.accessibility) {
46564     parts.push(node.accessibility + " ");
46565   } // "readonly" and "declare" are supported by only "babel-ts"
46566   // https://github.com/prettier/prettier/issues/9760
46567
46568
46569   if (node.readonly) {
46570     parts.push("readonly ");
46571   }
46572
46573   if (node.declare) {
46574     parts.push("declare ");
46575   }
46576
46577   if (node.static) {
46578     parts.push("static ");
46579   }
46580
46581   if (node.type === "TSAbstractMethodDefinition" || node.abstract) {
46582     parts.push("abstract ");
46583   }
46584
46585   if (node.override) {
46586     parts.push("override ");
46587   }
46588
46589   parts.push(printMethod$1(path, options, print));
46590   return parts;
46591 }
46592
46593 function printClassProperty$2(path, options, print) {
46594   const node = path.getValue();
46595   const parts = [];
46596   const semi = options.semi ? ";" : "";
46597
46598   if (isNonEmptyArray$b(node.decorators)) {
46599     parts.push(printClassMemberDecorators(path, options, print));
46600   }
46601
46602   if (node.accessibility) {
46603     parts.push(node.accessibility + " ");
46604   }
46605
46606   if (node.declare) {
46607     parts.push("declare ");
46608   }
46609
46610   if (node.static) {
46611     parts.push("static ");
46612   }
46613
46614   if (node.type === "TSAbstractPropertyDefinition" || node.abstract) {
46615     parts.push("abstract ");
46616   }
46617
46618   if (node.override) {
46619     parts.push("override ");
46620   }
46621
46622   if (node.readonly) {
46623     parts.push("readonly ");
46624   }
46625
46626   if (node.variance) {
46627     parts.push(print("variance"));
46628   }
46629
46630   parts.push(printPropertyKey$2(path, options, print), printOptionalToken$4(path), printTypeAnnotation$3(path, options, print));
46631   return [printAssignment(path, options, print, parts, " =", "value"), semi];
46632 }
46633
46634 var _class = {
46635   printClass: printClass$2,
46636   printClassMethod: printClassMethod$2,
46637   printClassProperty: printClassProperty$2,
46638   printHardlineAfterHeritage: printHardlineAfterHeritage$2
46639 };
46640
46641 const {
46642   isNonEmptyArray: isNonEmptyArray$a
46643 } = util$8;
46644 const {
46645   builders: {
46646     join: join$g,
46647     line: line$j,
46648     group: group$k,
46649     indent: indent$f,
46650     ifBreak: ifBreak$d
46651   }
46652 } = require$$7$3;
46653 const {
46654   hasComment: hasComment$5,
46655   identity,
46656   CommentCheckFlags: CommentCheckFlags$5
46657 } = utils$5;
46658 const {
46659   getTypeParametersGroupId
46660 } = typeParameters;
46661 const {
46662   printTypeScriptModifiers: printTypeScriptModifiers$1
46663 } = misc$1;
46664
46665 function printInterface$2(path, options, print) {
46666   const node = path.getValue();
46667   const parts = [];
46668
46669   if (node.declare) {
46670     parts.push("declare ");
46671   }
46672
46673   if (node.type === "TSInterfaceDeclaration") {
46674     parts.push(node.abstract ? "abstract " : "", printTypeScriptModifiers$1(path, options, print));
46675   }
46676
46677   parts.push("interface");
46678   const partsGroup = [];
46679   const extendsParts = [];
46680
46681   if (node.type !== "InterfaceTypeAnnotation") {
46682     partsGroup.push(" ", print("id"), print("typeParameters"));
46683   }
46684
46685   const shouldIndentOnlyHeritageClauses = node.typeParameters && !hasComment$5(node.typeParameters, CommentCheckFlags$5.Trailing | CommentCheckFlags$5.Line);
46686
46687   if (isNonEmptyArray$a(node.extends)) {
46688     extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak$d(" ", line$j, {
46689       groupId: getTypeParametersGroupId(node.typeParameters)
46690     }) : line$j, "extends ", (node.extends.length === 1 ? identity : indent$f)(join$g([",", line$j], path.map(print, "extends"))));
46691   }
46692
46693   if (node.id && hasComment$5(node.id, CommentCheckFlags$5.Trailing) || isNonEmptyArray$a(node.extends)) {
46694     if (shouldIndentOnlyHeritageClauses) {
46695       parts.push(group$k([...partsGroup, indent$f(extendsParts)]));
46696     } else {
46697       parts.push(group$k(indent$f([...partsGroup, ...extendsParts])));
46698     }
46699   } else {
46700     parts.push(...partsGroup, ...extendsParts);
46701   }
46702
46703   parts.push(" ", print("body"));
46704   return group$k(parts);
46705 }
46706
46707 var _interface = {
46708   printInterface: printInterface$2
46709 };
46710
46711 const {
46712   isNonEmptyArray: isNonEmptyArray$9
46713 } = util$8;
46714 const {
46715   builders: {
46716     softline: softline$f,
46717     group: group$j,
46718     indent: indent$e,
46719     join: join$f,
46720     line: line$i,
46721     ifBreak: ifBreak$c,
46722     hardline: hardline$n
46723   }
46724 } = require$$7$3;
46725 const {
46726   printDanglingComments: printDanglingComments$5
46727 } = comments$4;
46728 const {
46729   hasComment: hasComment$4,
46730   CommentCheckFlags: CommentCheckFlags$4,
46731   shouldPrintComma: shouldPrintComma$4,
46732   needsHardlineAfterDanglingComment: needsHardlineAfterDanglingComment$1
46733 } = utils$5;
46734 const {
46735   locStart: locStart$l,
46736   hasSameLoc
46737 } = loc$6;
46738 const {
46739   hasDecoratorsBeforeExport,
46740   printDecoratorsBeforeExport
46741 } = decorators;
46742 /**
46743  * @typedef {import("../../document").Doc} Doc
46744  */
46745
46746 function printImportDeclaration$1(path, options, print) {
46747   const node = path.getValue();
46748   const semi = options.semi ? ";" : "";
46749   /** @type{Doc[]} */
46750
46751   const parts = [];
46752   const {
46753     importKind
46754   } = node;
46755   parts.push("import");
46756
46757   if (importKind && importKind !== "value") {
46758     parts.push(" ", importKind);
46759   }
46760
46761   parts.push(printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
46762   return parts;
46763 }
46764
46765 function printExportDeclaration$2(path, options, print) {
46766   const node = path.getValue();
46767   /** @type{Doc[]} */
46768
46769   const parts = []; // Only print decorators here if they were written before the export,
46770   // otherwise they are printed by the node.declaration
46771
46772   if (hasDecoratorsBeforeExport(node)) {
46773     parts.push(printDecoratorsBeforeExport(path, options, print));
46774   }
46775
46776   const {
46777     type,
46778     exportKind,
46779     declaration
46780   } = node;
46781   parts.push("export");
46782   const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
46783
46784   if (isDefaultExport) {
46785     parts.push(" default");
46786   }
46787
46788   if (hasComment$4(node, CommentCheckFlags$4.Dangling)) {
46789     parts.push(" ", printDanglingComments$5(path, options,
46790     /* sameIndent */
46791     true));
46792
46793     if (needsHardlineAfterDanglingComment$1(node)) {
46794       parts.push(hardline$n);
46795     }
46796   }
46797
46798   if (declaration) {
46799     parts.push(" ", print("declaration"));
46800   } else {
46801     parts.push(exportKind === "type" ? " type" : "", printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print));
46802   }
46803
46804   if (shouldExportDeclarationPrintSemi(node, options)) {
46805     parts.push(";");
46806   }
46807
46808   return parts;
46809 }
46810
46811 function printExportAllDeclaration$2(path, options, print) {
46812   const node = path.getValue();
46813   const semi = options.semi ? ";" : "";
46814   /** @type{Doc[]} */
46815
46816   const parts = [];
46817   const {
46818     exportKind,
46819     exported
46820   } = node;
46821   parts.push("export");
46822
46823   if (exportKind === "type") {
46824     parts.push(" type");
46825   }
46826
46827   parts.push(" *");
46828
46829   if (exported) {
46830     parts.push(" as ", print("exported"));
46831   }
46832
46833   parts.push(printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
46834   return parts;
46835 }
46836
46837 function shouldExportDeclarationPrintSemi(node, options) {
46838   if (!options.semi) {
46839     return false;
46840   }
46841
46842   const {
46843     type,
46844     declaration
46845   } = node;
46846   const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
46847
46848   if (!declaration) {
46849     return true;
46850   }
46851
46852   const {
46853     type: declarationType
46854   } = declaration;
46855
46856   if (isDefaultExport && declarationType !== "ClassDeclaration" && declarationType !== "FunctionDeclaration" && declarationType !== "TSInterfaceDeclaration" && declarationType !== "DeclareClass" && declarationType !== "DeclareFunction" && declarationType !== "TSDeclareFunction" && declarationType !== "EnumDeclaration") {
46857     return true;
46858   }
46859
46860   return false;
46861 }
46862
46863 function printModuleSource(path, options, print) {
46864   const node = path.getValue();
46865
46866   if (!node.source) {
46867     return "";
46868   }
46869   /** @type{Doc[]} */
46870
46871
46872   const parts = [];
46873
46874   if (!shouldNotPrintSpecifiers(node, options)) {
46875     parts.push(" from");
46876   }
46877
46878   parts.push(" ", print("source"));
46879   return parts;
46880 }
46881
46882 function printModuleSpecifiers(path, options, print) {
46883   const node = path.getValue();
46884
46885   if (shouldNotPrintSpecifiers(node, options)) {
46886     return "";
46887   }
46888   /** @type{Doc[]} */
46889
46890
46891   const parts = [" "];
46892
46893   if (isNonEmptyArray$9(node.specifiers)) {
46894     const standaloneSpecifiers = [];
46895     const groupedSpecifiers = [];
46896     path.each(() => {
46897       const specifierType = path.getValue().type;
46898
46899       if (specifierType === "ExportNamespaceSpecifier" || specifierType === "ExportDefaultSpecifier" || specifierType === "ImportNamespaceSpecifier" || specifierType === "ImportDefaultSpecifier") {
46900         standaloneSpecifiers.push(print());
46901       } else if (specifierType === "ExportSpecifier" || specifierType === "ImportSpecifier") {
46902         groupedSpecifiers.push(print());
46903       } else {
46904         /* istanbul ignore next */
46905         throw new Error(`Unknown specifier type ${JSON.stringify(specifierType)}`);
46906       }
46907     }, "specifiers");
46908     parts.push(join$f(", ", standaloneSpecifiers));
46909
46910     if (groupedSpecifiers.length > 0) {
46911       if (standaloneSpecifiers.length > 0) {
46912         parts.push(", ");
46913       }
46914
46915       const canBreak = groupedSpecifiers.length > 1 || standaloneSpecifiers.length > 0 || node.specifiers.some(node => hasComment$4(node));
46916
46917       if (canBreak) {
46918         parts.push(group$j(["{", indent$e([options.bracketSpacing ? line$i : softline$f, join$f([",", line$i], groupedSpecifiers)]), ifBreak$c(shouldPrintComma$4(options) ? "," : ""), options.bracketSpacing ? line$i : softline$f, "}"]));
46919       } else {
46920         parts.push(["{", options.bracketSpacing ? " " : "", ...groupedSpecifiers, options.bracketSpacing ? " " : "", "}"]);
46921       }
46922     }
46923   } else {
46924     parts.push("{}");
46925   }
46926
46927   return parts;
46928 }
46929
46930 function shouldNotPrintSpecifiers(node, options) {
46931   const {
46932     type,
46933     importKind,
46934     source,
46935     specifiers
46936   } = node;
46937
46938   if (type !== "ImportDeclaration" || isNonEmptyArray$9(specifiers) || importKind === "type") {
46939     return false;
46940   } // TODO: check tokens
46941
46942
46943   return !/{\s*}/.test(options.originalText.slice(locStart$l(node), locStart$l(source)));
46944 }
46945
46946 function printImportAssertions(path, options, print) {
46947   const node = path.getNode();
46948
46949   if (isNonEmptyArray$9(node.assertions)) {
46950     return [" assert {", options.bracketSpacing ? " " : "", join$f(", ", path.map(print, "assertions")), options.bracketSpacing ? " " : "", "}"];
46951   }
46952
46953   return "";
46954 }
46955
46956 function printModuleSpecifier$1(path, options, print) {
46957   const node = path.getNode();
46958   const {
46959     type
46960   } = node;
46961   /** @type {Doc[]} */
46962
46963   const parts = [];
46964   /** @type {"type" | "typeof" | "value"} */
46965
46966   const kind = type === "ImportSpecifier" ? node.importKind : node.exportKind;
46967
46968   if (kind && kind !== "value") {
46969     parts.push(kind, " ");
46970   }
46971
46972   const isImport = type.startsWith("Import");
46973   const leftSideProperty = isImport ? "imported" : "local";
46974   const rightSideProperty = isImport ? "local" : "exported";
46975   let left = "";
46976   let right = "";
46977
46978   if (type === "ExportNamespaceSpecifier" || type === "ImportNamespaceSpecifier") {
46979     left = "*";
46980   } else if (node[leftSideProperty]) {
46981     left = print(leftSideProperty);
46982   }
46983
46984   if (node[rightSideProperty] && (!node[leftSideProperty] || // import {a as a} from '.'
46985   !hasSameLoc(node[leftSideProperty], node[rightSideProperty]))) {
46986     right = print(rightSideProperty);
46987   }
46988
46989   parts.push(left, left && right ? " as " : "", right);
46990   return parts;
46991 }
46992
46993 var module$1 = {
46994   printImportDeclaration: printImportDeclaration$1,
46995   printExportDeclaration: printExportDeclaration$2,
46996   printExportAllDeclaration: printExportAllDeclaration$2,
46997   printModuleSpecifier: printModuleSpecifier$1
46998 };
46999
47000 const {
47001   printDanglingComments: printDanglingComments$4
47002 } = comments$4;
47003 const {
47004   builders: {
47005     line: line$h,
47006     softline: softline$e,
47007     group: group$i,
47008     indent: indent$d,
47009     ifBreak: ifBreak$b,
47010     hardline: hardline$m
47011   }
47012 } = require$$7$3;
47013 const {
47014   getLast: getLast$a,
47015   hasNewlineInRange: hasNewlineInRange$2,
47016   hasNewline: hasNewline$3,
47017   isNonEmptyArray: isNonEmptyArray$8
47018 } = util$8;
47019 const {
47020   shouldPrintComma: shouldPrintComma$3,
47021   hasComment: hasComment$3,
47022   getComments: getComments$1,
47023   CommentCheckFlags: CommentCheckFlags$3,
47024   isNextLineEmpty: isNextLineEmpty$7
47025 } = utils$5;
47026 const {
47027   locStart: locStart$k,
47028   locEnd: locEnd$j
47029 } = loc$6;
47030 const {
47031   printOptionalToken: printOptionalToken$3,
47032   printTypeAnnotation: printTypeAnnotation$2
47033 } = misc$1;
47034 const {
47035   shouldHugFunctionParameters
47036 } = functionParameters;
47037 const {
47038   shouldHugType
47039 } = typeAnnotation;
47040 const {
47041   printHardlineAfterHeritage: printHardlineAfterHeritage$1
47042 } = _class;
47043 /** @typedef {import("../../document").Doc} Doc */
47044
47045 function printObject$3(path, options, print) {
47046   const semi = options.semi ? ";" : "";
47047   const node = path.getValue();
47048   let propertiesField;
47049
47050   if (node.type === "TSTypeLiteral") {
47051     propertiesField = "members";
47052   } else if (node.type === "TSInterfaceBody") {
47053     propertiesField = "body";
47054   } else {
47055     propertiesField = "properties";
47056   }
47057
47058   const isTypeAnnotation = node.type === "ObjectTypeAnnotation";
47059   const fields = [propertiesField];
47060
47061   if (isTypeAnnotation) {
47062     fields.push("indexers", "callProperties", "internalSlots");
47063   }
47064
47065   const firstProperty = fields.map(field => node[field][0]).sort((a, b) => locStart$k(a) - locStart$k(b))[0];
47066   const parent = path.getParentNode(0);
47067   const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
47068   const shouldBreak = node.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || node.type === "ObjectPattern" && parent.type !== "FunctionDeclaration" && parent.type !== "FunctionExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "ObjectMethod" && parent.type !== "ClassMethod" && parent.type !== "ClassPrivateMethod" && parent.type !== "AssignmentPattern" && parent.type !== "CatchClause" && node.properties.some(property => property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern")) || node.type !== "ObjectPattern" && firstProperty && hasNewlineInRange$2(options.originalText, locStart$k(node), locStart$k(firstProperty));
47069   const separator = isFlowInterfaceLikeBody ? ";" : node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral" ? ifBreak$b(semi, ";") : ",";
47070   const leftBrace = node.type === "RecordExpression" ? "#{" : node.exact ? "{|" : "{";
47071   const rightBrace = node.exact ? "|}" : "}"; // Unfortunately, things are grouped together in the ast can be
47072   // interleaved in the source code. So we need to reorder them before
47073   // printing them.
47074
47075   const propsAndLoc = [];
47076
47077   for (const field of fields) {
47078     path.each(childPath => {
47079       const node = childPath.getValue();
47080       propsAndLoc.push({
47081         node,
47082         printed: print(),
47083         loc: locStart$k(node)
47084       });
47085     }, field);
47086   }
47087
47088   if (fields.length > 1) {
47089     propsAndLoc.sort((a, b) => a.loc - b.loc);
47090   }
47091   /** @type {Doc[]} */
47092
47093
47094   let separatorParts = [];
47095   const props = propsAndLoc.map(prop => {
47096     const result = [...separatorParts, group$i(prop.printed)];
47097     separatorParts = [separator, line$h];
47098
47099     if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasComment$3(prop.node, CommentCheckFlags$3.PrettierIgnore)) {
47100       separatorParts.shift();
47101     }
47102
47103     if (isNextLineEmpty$7(prop.node, options)) {
47104       separatorParts.push(hardline$m);
47105     }
47106
47107     return result;
47108   });
47109
47110   if (node.inexact) {
47111     let printed;
47112
47113     if (hasComment$3(node, CommentCheckFlags$3.Dangling)) {
47114       const hasLineComments = hasComment$3(node, CommentCheckFlags$3.Line);
47115       const printedDanglingComments = printDanglingComments$4(path, options,
47116       /* sameIndent */
47117       true);
47118       printed = [printedDanglingComments, hasLineComments || hasNewline$3(options.originalText, locEnd$j(getLast$a(getComments$1(node)))) ? hardline$m : line$h, "..."];
47119     } else {
47120       printed = ["..."];
47121     }
47122
47123     props.push([...separatorParts, ...printed]);
47124   }
47125
47126   const lastElem = getLast$a(node[propertiesField]);
47127   const canHaveTrailingSeparator = !(node.inexact || lastElem && lastElem.type === "RestElement" || lastElem && (lastElem.type === "TSPropertySignature" || lastElem.type === "TSCallSignatureDeclaration" || lastElem.type === "TSMethodSignature" || lastElem.type === "TSConstructSignatureDeclaration") && hasComment$3(lastElem, CommentCheckFlags$3.PrettierIgnore));
47128   let content;
47129
47130   if (props.length === 0) {
47131     if (!hasComment$3(node, CommentCheckFlags$3.Dangling)) {
47132       return [leftBrace, rightBrace, printTypeAnnotation$2(path, options, print)];
47133     }
47134
47135     content = group$i([leftBrace, printDanglingComments$4(path, options), softline$e, rightBrace, printOptionalToken$3(path), printTypeAnnotation$2(path, options, print)]);
47136   } else {
47137     content = [isFlowInterfaceLikeBody && isNonEmptyArray$8(node.properties) ? printHardlineAfterHeritage$1(parent) : "", leftBrace, indent$d([options.bracketSpacing ? line$h : softline$e, ...props]), ifBreak$b(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma$3(options)) ? separator : ""), options.bracketSpacing ? line$h : softline$e, rightBrace, printOptionalToken$3(path), printTypeAnnotation$2(path, options, print)];
47138   } // If we inline the object as first argument of the parent, we don't want
47139   // to create another group so that the object breaks before the return
47140   // type
47141
47142
47143   if (path.match(node => node.type === "ObjectPattern" && !node.decorators, (node, name, number) => shouldHugFunctionParameters(node) && (name === "params" || name === "parameters" || name === "this" || name === "rest") && number === 0) || path.match(shouldHugType, (node, name) => name === "typeAnnotation", (node, name) => name === "typeAnnotation", (node, name, number) => shouldHugFunctionParameters(node) && (name === "params" || name === "parameters" || name === "this" || name === "rest") && number === 0) || // Assignment printing logic (printAssignment) is responsible
47144   // for adding a group if needed
47145   !shouldBreak && path.match(node => node.type === "ObjectPattern", node => node.type === "AssignmentExpression" || node.type === "VariableDeclarator")) {
47146     return content;
47147   }
47148
47149   return group$i(content, {
47150     shouldBreak
47151   });
47152 }
47153
47154 var object$1 = {
47155   printObject: printObject$3
47156 };
47157
47158 /** @typedef {import("../../document").Doc} Doc */
47159
47160
47161 const assert$1 = require$$0__default$3["default"];
47162 const {
47163   printDanglingComments: printDanglingComments$3
47164 } = comments$4;
47165 const {
47166   printString: printString$2,
47167   printNumber: printNumber$2
47168 } = util$8;
47169 const {
47170   builders: {
47171     hardline: hardline$l,
47172     softline: softline$d,
47173     group: group$h,
47174     indent: indent$c
47175   }
47176 } = require$$7$3;
47177 const {
47178   getParentExportDeclaration,
47179   isFunctionNotation,
47180   isGetterOrSetter,
47181   rawText: rawText$1,
47182   shouldPrintComma: shouldPrintComma$2
47183 } = utils$5;
47184 const {
47185   locStart: locStart$j,
47186   locEnd: locEnd$i
47187 } = loc$6;
47188 const {
47189   printClass: printClass$1
47190 } = _class;
47191 const {
47192   printOpaqueType,
47193   printTypeAlias: printTypeAlias$1,
47194   printIntersectionType: printIntersectionType$1,
47195   printUnionType: printUnionType$1,
47196   printFunctionType: printFunctionType$1,
47197   printTupleType: printTupleType$1,
47198   printIndexedAccessType: printIndexedAccessType$1
47199 } = typeAnnotation;
47200 const {
47201   printInterface: printInterface$1
47202 } = _interface;
47203 const {
47204   printTypeParameter: printTypeParameter$1,
47205   printTypeParameters: printTypeParameters$1
47206 } = typeParameters;
47207 const {
47208   printExportDeclaration: printExportDeclaration$1,
47209   printExportAllDeclaration: printExportAllDeclaration$1
47210 } = module$1;
47211 const {
47212   printArrayItems: printArrayItems$1
47213 } = array;
47214 const {
47215   printObject: printObject$2
47216 } = object$1;
47217 const {
47218   printPropertyKey: printPropertyKey$1
47219 } = property;
47220 const {
47221   printOptionalToken: printOptionalToken$2,
47222   printTypeAnnotation: printTypeAnnotation$1,
47223   printRestSpread: printRestSpread$1
47224 } = misc$1;
47225
47226 function printFlow$1(path, options, print) {
47227   const node = path.getValue();
47228   const semi = options.semi ? ";" : "";
47229   /** @type{Doc[]} */
47230
47231   const parts = [];
47232
47233   switch (node.type) {
47234     case "DeclareClass":
47235       return printFlowDeclaration(path, printClass$1(path, options, print));
47236
47237     case "DeclareFunction":
47238       return printFlowDeclaration(path, ["function ", print("id"), node.predicate ? " " : "", print("predicate"), semi]);
47239
47240     case "DeclareModule":
47241       return printFlowDeclaration(path, ["module ", print("id"), " ", print("body")]);
47242
47243     case "DeclareModuleExports":
47244       return printFlowDeclaration(path, ["module.exports", ": ", print("typeAnnotation"), semi]);
47245
47246     case "DeclareVariable":
47247       return printFlowDeclaration(path, ["var ", print("id"), semi]);
47248
47249     case "DeclareOpaqueType":
47250       return printFlowDeclaration(path, printOpaqueType(path, options, print));
47251
47252     case "DeclareInterface":
47253       return printFlowDeclaration(path, printInterface$1(path, options, print));
47254
47255     case "DeclareTypeAlias":
47256       return printFlowDeclaration(path, printTypeAlias$1(path, options, print));
47257
47258     case "DeclareExportDeclaration":
47259       return printFlowDeclaration(path, printExportDeclaration$1(path, options, print));
47260
47261     case "DeclareExportAllDeclaration":
47262       return printFlowDeclaration(path, printExportAllDeclaration$1(path, options, print));
47263
47264     case "OpaqueType":
47265       return printOpaqueType(path, options, print);
47266
47267     case "TypeAlias":
47268       return printTypeAlias$1(path, options, print);
47269
47270     case "IntersectionTypeAnnotation":
47271       return printIntersectionType$1(path, options, print);
47272
47273     case "UnionTypeAnnotation":
47274       return printUnionType$1(path, options, print);
47275
47276     case "FunctionTypeAnnotation":
47277       return printFunctionType$1(path, options, print);
47278
47279     case "TupleTypeAnnotation":
47280       return printTupleType$1(path, options, print);
47281
47282     case "GenericTypeAnnotation":
47283       return [print("id"), printTypeParameters$1(path, options, print, "typeParameters")];
47284
47285     case "IndexedAccessType":
47286     case "OptionalIndexedAccessType":
47287       return printIndexedAccessType$1(path, options, print);
47288     // Type Annotations for Facebook Flow, typically stripped out or
47289     // transformed away before printing.
47290
47291     case "TypeAnnotation":
47292       return print("typeAnnotation");
47293
47294     case "TypeParameter":
47295       return printTypeParameter$1(path, options, print);
47296
47297     case "TypeofTypeAnnotation":
47298       return ["typeof ", print("argument")];
47299
47300     case "ExistsTypeAnnotation":
47301       return "*";
47302
47303     case "EmptyTypeAnnotation":
47304       return "empty";
47305
47306     case "MixedTypeAnnotation":
47307       return "mixed";
47308
47309     case "ArrayTypeAnnotation":
47310       return [print("elementType"), "[]"];
47311
47312     case "BooleanLiteralTypeAnnotation":
47313       return String(node.value);
47314
47315     case "EnumDeclaration":
47316       return ["enum ", print("id"), " ", print("body")];
47317
47318     case "EnumBooleanBody":
47319     case "EnumNumberBody":
47320     case "EnumStringBody":
47321     case "EnumSymbolBody":
47322       {
47323         if (node.type === "EnumSymbolBody" || node.explicitType) {
47324           let type = null;
47325
47326           switch (node.type) {
47327             case "EnumBooleanBody":
47328               type = "boolean";
47329               break;
47330
47331             case "EnumNumberBody":
47332               type = "number";
47333               break;
47334
47335             case "EnumStringBody":
47336               type = "string";
47337               break;
47338
47339             case "EnumSymbolBody":
47340               type = "symbol";
47341               break;
47342           }
47343
47344           parts.push("of ", type, " ");
47345         }
47346
47347         if (node.members.length === 0 && !node.hasUnknownMembers) {
47348           parts.push(group$h(["{", printDanglingComments$3(path, options), softline$d, "}"]));
47349         } else {
47350           const members = node.members.length > 0 ? [hardline$l, printArrayItems$1(path, options, "members", print), node.hasUnknownMembers || shouldPrintComma$2(options) ? "," : ""] : [];
47351           parts.push(group$h(["{", indent$c([...members, ...(node.hasUnknownMembers ? [hardline$l, "..."] : [])]), printDanglingComments$3(path, options,
47352           /* sameIndent */
47353           true), hardline$l, "}"]));
47354         }
47355
47356         return parts;
47357       }
47358
47359     case "EnumBooleanMember":
47360     case "EnumNumberMember":
47361     case "EnumStringMember":
47362       return [print("id"), " = ", typeof node.init === "object" ? print("init") : String(node.init)];
47363
47364     case "EnumDefaultedMember":
47365       return print("id");
47366
47367     case "FunctionTypeParam":
47368       {
47369         const name = node.name ? print("name") : path.getParentNode().this === node ? "this" : "";
47370         return [name, printOptionalToken$2(path), name ? ": " : "", print("typeAnnotation")];
47371       }
47372
47373     case "InterfaceDeclaration":
47374     case "InterfaceTypeAnnotation":
47375       return printInterface$1(path, options, print);
47376
47377     case "ClassImplements":
47378     case "InterfaceExtends":
47379       return [print("id"), print("typeParameters")];
47380
47381     case "NullableTypeAnnotation":
47382       return ["?", print("typeAnnotation")];
47383
47384     case "Variance":
47385       {
47386         const {
47387           kind
47388         } = node;
47389         assert$1.ok(kind === "plus" || kind === "minus");
47390         return kind === "plus" ? "+" : "-";
47391       }
47392
47393     case "ObjectTypeCallProperty":
47394       if (node.static) {
47395         parts.push("static ");
47396       }
47397
47398       parts.push(print("value"));
47399       return parts;
47400
47401     case "ObjectTypeIndexer":
47402       {
47403         return [node.variance ? print("variance") : "", "[", print("id"), node.id ? ": " : "", print("key"), "]: ", print("value")];
47404       }
47405
47406     case "ObjectTypeProperty":
47407       {
47408         let modifier = "";
47409
47410         if (node.proto) {
47411           modifier = "proto ";
47412         } else if (node.static) {
47413           modifier = "static ";
47414         }
47415
47416         return [modifier, isGetterOrSetter(node) ? node.kind + " " : "", node.variance ? print("variance") : "", printPropertyKey$1(path, options, print), printOptionalToken$2(path), isFunctionNotation(node) ? "" : ": ", print("value")];
47417       }
47418
47419     case "ObjectTypeAnnotation":
47420       return printObject$2(path, options, print);
47421
47422     case "ObjectTypeInternalSlot":
47423       return [node.static ? "static " : "", "[[", print("id"), "]]", printOptionalToken$2(path), node.method ? "" : ": ", print("value")];
47424     // Same as `RestElement`
47425
47426     case "ObjectTypeSpreadProperty":
47427       return printRestSpread$1(path, options, print);
47428
47429     case "QualifiedTypeIdentifier":
47430       return [print("qualification"), ".", print("id")];
47431
47432     case "StringLiteralTypeAnnotation":
47433       return printString$2(rawText$1(node), options);
47434
47435     case "NumberLiteralTypeAnnotation":
47436       assert$1.strictEqual(typeof node.value, "number");
47437     // fall through
47438
47439     case "BigIntLiteralTypeAnnotation":
47440       if (node.extra) {
47441         return printNumber$2(node.extra.raw);
47442       }
47443
47444       return printNumber$2(node.raw);
47445
47446     case "TypeCastExpression":
47447       {
47448         return ["(", print("expression"), printTypeAnnotation$1(path, options, print), ")"];
47449       }
47450
47451     case "TypeParameterDeclaration":
47452     case "TypeParameterInstantiation":
47453       {
47454         const printed = printTypeParameters$1(path, options, print, "params");
47455
47456         if (options.parser === "flow") {
47457           const start = locStart$j(node);
47458           const end = locEnd$i(node);
47459           const commentStartIndex = options.originalText.lastIndexOf("/*", start);
47460           const commentEndIndex = options.originalText.indexOf("*/", end);
47461
47462           if (commentStartIndex !== -1 && commentEndIndex !== -1) {
47463             const comment = options.originalText.slice(commentStartIndex + 2, commentEndIndex).trim();
47464
47465             if (comment.startsWith("::") && !comment.includes("/*") && !comment.includes("*/")) {
47466               return ["/*:: ", printed, " */"];
47467             }
47468           }
47469         }
47470
47471         return printed;
47472       }
47473
47474     case "InferredPredicate":
47475       return "%checks";
47476     // Unhandled types below. If encountered, nodes of these types should
47477     // be either left alone or desugared into AST types that are fully
47478     // supported by the pretty-printer.
47479
47480     case "DeclaredPredicate":
47481       return ["%checks(", print("value"), ")"];
47482
47483     case "AnyTypeAnnotation":
47484       return "any";
47485
47486     case "BooleanTypeAnnotation":
47487       return "boolean";
47488
47489     case "BigIntTypeAnnotation":
47490       return "bigint";
47491
47492     case "NullLiteralTypeAnnotation":
47493       return "null";
47494
47495     case "NumberTypeAnnotation":
47496       return "number";
47497
47498     case "SymbolTypeAnnotation":
47499       return "symbol";
47500
47501     case "StringTypeAnnotation":
47502       return "string";
47503
47504     case "VoidTypeAnnotation":
47505       return "void";
47506
47507     case "ThisTypeAnnotation":
47508       return "this";
47509     // These types are unprintable because they serve as abstract
47510     // supertypes for other (printable) types.
47511
47512     case "Node":
47513     case "Printable":
47514     case "SourceLocation":
47515     case "Position":
47516     case "Statement":
47517     case "Function":
47518     case "Pattern":
47519     case "Expression":
47520     case "Declaration":
47521     case "Specifier":
47522     case "NamedSpecifier":
47523     case "Comment":
47524     case "MemberTypeAnnotation": // Flow
47525
47526     case "Type":
47527       /* istanbul ignore next */
47528       throw new Error("unprintable type: " + JSON.stringify(node.type));
47529   }
47530 }
47531
47532 function printFlowDeclaration(path, printed) {
47533   const parentExportDecl = getParentExportDeclaration(path);
47534
47535   if (parentExportDecl) {
47536     assert$1.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
47537     return printed;
47538   } // If the parent node has type DeclareExportDeclaration, then it
47539   // will be responsible for printing the "declare" token. Otherwise
47540   // it needs to be printed with this non-exported declaration node.
47541
47542
47543   return ["declare ", printed];
47544 }
47545
47546 var flow = {
47547   printFlow: printFlow$1
47548 };
47549
47550 const {
47551   hasNewlineInRange: hasNewlineInRange$1
47552 } = util$8;
47553 const {
47554   isJsxNode: isJsxNode$1,
47555   isBlockComment: isBlockComment$2,
47556   getComments,
47557   isCallExpression: isCallExpression$2,
47558   isMemberExpression: isMemberExpression$2
47559 } = utils$5;
47560 const {
47561   locStart: locStart$i,
47562   locEnd: locEnd$h
47563 } = loc$6;
47564 const {
47565   builders: {
47566     line: line$g,
47567     softline: softline$c,
47568     group: group$g,
47569     indent: indent$b,
47570     align: align$2,
47571     ifBreak: ifBreak$a,
47572     dedent: dedent$3,
47573     breakParent: breakParent$6
47574   }
47575 } = require$$7$3;
47576 /**
47577  * @typedef {import("../../document").Doc} Doc
47578  * @typedef {import("../../common/ast-path")} AstPath
47579  *
47580  * @typedef {any} Options - Prettier options (TBD ...)
47581  */
47582 // If we have nested conditional expressions, we want to print them in JSX mode
47583 // if there's at least one JSXElement somewhere in the tree.
47584 //
47585 // A conditional expression chain like this should be printed in normal mode,
47586 // because there aren't JSXElements anywhere in it:
47587 //
47588 // isA ? "A" : isB ? "B" : isC ? "C" : "Unknown";
47589 //
47590 // But a conditional expression chain like this should be printed in JSX mode,
47591 // because there is a JSXElement in the last ConditionalExpression:
47592 //
47593 // isA ? "A" : isB ? "B" : isC ? "C" : <span className="warning">Unknown</span>;
47594 //
47595 // This type of ConditionalExpression chain is structured like this in the AST:
47596 //
47597 // ConditionalExpression {
47598 //   test: ...,
47599 //   consequent: ...,
47600 //   alternate: ConditionalExpression {
47601 //     test: ...,
47602 //     consequent: ...,
47603 //     alternate: ConditionalExpression {
47604 //       test: ...,
47605 //       consequent: ...,
47606 //       alternate: ...,
47607 //     }
47608 //   }
47609 // }
47610
47611 function conditionalExpressionChainContainsJsx(node) {
47612   // Given this code:
47613   //
47614   // // Using a ConditionalExpression as the consequent is uncommon, but should
47615   // // be handled.
47616   // A ? B : C ? D : E ? F ? G : H : I
47617   //
47618   // which has this AST:
47619   //
47620   // ConditionalExpression {
47621   //   test: Identifier(A),
47622   //   consequent: Identifier(B),
47623   //   alternate: ConditionalExpression {
47624   //     test: Identifier(C),
47625   //     consequent: Identifier(D),
47626   //     alternate: ConditionalExpression {
47627   //       test: Identifier(E),
47628   //       consequent: ConditionalExpression {
47629   //         test: Identifier(F),
47630   //         consequent: Identifier(G),
47631   //         alternate: Identifier(H),
47632   //       },
47633   //       alternate: Identifier(I),
47634   //     }
47635   //   }
47636   // }
47637   //
47638   // We don't care about whether each node was the test, consequent, or alternate
47639   // We are only checking if there's any JSXElements inside.
47640   const conditionalExpressions = [node];
47641
47642   for (let index = 0; index < conditionalExpressions.length; index++) {
47643     const conditionalExpression = conditionalExpressions[index];
47644
47645     for (const property of ["test", "consequent", "alternate"]) {
47646       const node = conditionalExpression[property];
47647
47648       if (isJsxNode$1(node)) {
47649         return true;
47650       }
47651
47652       if (node.type === "ConditionalExpression") {
47653         conditionalExpressions.push(node);
47654       }
47655     }
47656   }
47657
47658   return false;
47659 }
47660
47661 function printTernaryTest(path, options, print) {
47662   const node = path.getValue();
47663   const isConditionalExpression = node.type === "ConditionalExpression";
47664   const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
47665   const parent = path.getParentNode();
47666   const printed = isConditionalExpression ? print("test") : [print("checkType"), " ", "extends", " ", print("extendsType")];
47667   /**
47668    *     a
47669    *       ? b
47670    *       : multiline
47671    *         test
47672    *         node
47673    *       ^^ align(2)
47674    *       ? d
47675    *       : e
47676    */
47677
47678   if (parent.type === node.type && parent[alternateNodePropertyName] === node) {
47679     return align$2(2, printed);
47680   }
47681
47682   return printed;
47683 }
47684
47685 const ancestorNameMap = new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"]]);
47686
47687 function shouldExtraIndentForConditionalExpression(path) {
47688   const node = path.getValue();
47689
47690   if (node.type !== "ConditionalExpression") {
47691     return false;
47692   }
47693
47694   let parent;
47695   let child = node;
47696
47697   for (let ancestorCount = 0; !parent; ancestorCount++) {
47698     const node = path.getParentNode(ancestorCount);
47699
47700     if (isCallExpression$2(node) && node.callee === child || isMemberExpression$2(node) && node.object === child || node.type === "TSNonNullExpression" && node.expression === child) {
47701       child = node;
47702       continue;
47703     } // Reached chain root
47704
47705
47706     if (node.type === "NewExpression" && node.callee === child || node.type === "TSAsExpression" && node.expression === child) {
47707       parent = path.getParentNode(ancestorCount + 1);
47708       child = node;
47709     } else {
47710       parent = node;
47711     }
47712   } // Do not add indent to direct `ConditionalExpression`
47713
47714
47715   if (child === node) {
47716     return false;
47717   }
47718
47719   return parent[ancestorNameMap.get(parent.type)] === child;
47720 }
47721 /**
47722  * The following is the shared logic for
47723  * ternary operators, namely ConditionalExpression
47724  * and TSConditionalType
47725  * @param {AstPath} path - The path to the ConditionalExpression/TSConditionalType node.
47726  * @param {Options} options - Prettier options
47727  * @param {Function} print - Print function to call recursively
47728  * @returns {Doc}
47729  */
47730
47731
47732 function printTernary$2(path, options, print) {
47733   const node = path.getValue();
47734   const isConditionalExpression = node.type === "ConditionalExpression";
47735   const consequentNodePropertyName = isConditionalExpression ? "consequent" : "trueType";
47736   const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
47737   const testNodePropertyNames = isConditionalExpression ? ["test"] : ["checkType", "extendsType"];
47738   const consequentNode = node[consequentNodePropertyName];
47739   const alternateNode = node[alternateNodePropertyName];
47740   const parts = []; // We print a ConditionalExpression in either "JSX mode" or "normal mode".
47741   // See `tests/format/jsx/conditional-expression.js` for more info.
47742
47743   let jsxMode = false;
47744   const parent = path.getParentNode();
47745   const isParentTest = parent.type === node.type && testNodePropertyNames.some(prop => parent[prop] === node);
47746   let forceNoIndent = parent.type === node.type && !isParentTest; // Find the outermost non-ConditionalExpression parent, and the outermost
47747   // ConditionalExpression parent. We'll use these to determine if we should
47748   // print in JSX mode.
47749
47750   let currentParent;
47751   let previousParent;
47752   let i = 0;
47753
47754   do {
47755     previousParent = currentParent || node;
47756     currentParent = path.getParentNode(i);
47757     i++;
47758   } while (currentParent && currentParent.type === node.type && testNodePropertyNames.every(prop => currentParent[prop] !== previousParent));
47759
47760   const firstNonConditionalParent = currentParent || parent;
47761   const lastConditionalParent = previousParent;
47762
47763   if (isConditionalExpression && (isJsxNode$1(node[testNodePropertyNames[0]]) || isJsxNode$1(consequentNode) || isJsxNode$1(alternateNode) || conditionalExpressionChainContainsJsx(lastConditionalParent))) {
47764     jsxMode = true;
47765     forceNoIndent = true; // Even though they don't need parens, we wrap (almost) everything in
47766     // parens when using ?: within JSX, because the parens are analogous to
47767     // curly braces in an if statement.
47768
47769     const wrap = doc => [ifBreak$a("("), indent$b([softline$c, doc]), softline$c, ifBreak$a(")")]; // The only things we don't wrap are:
47770     // * Nested conditional expressions in alternates
47771     // * null
47772     // * undefined
47773
47774
47775     const isNil = node => node.type === "NullLiteral" || node.type === "Literal" && node.value === null || node.type === "Identifier" && node.name === "undefined";
47776
47777     parts.push(" ? ", isNil(consequentNode) ? print(consequentNodePropertyName) : wrap(print(consequentNodePropertyName)), " : ", alternateNode.type === node.type || isNil(alternateNode) ? print(alternateNodePropertyName) : wrap(print(alternateNodePropertyName)));
47778   } else {
47779     // normal mode
47780     const part = [line$g, "? ", consequentNode.type === node.type ? ifBreak$a("", "(") : "", align$2(2, print(consequentNodePropertyName)), consequentNode.type === node.type ? ifBreak$a("", ")") : "", line$g, ": ", alternateNode.type === node.type ? print(alternateNodePropertyName) : align$2(2, print(alternateNodePropertyName))];
47781     parts.push(parent.type !== node.type || parent[alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent$3(indent$b(part)) : align$2(Math.max(0, options.tabWidth - 2), part));
47782   } // We want a whole chain of ConditionalExpressions to all
47783   // break if any of them break. That means we should only group around the
47784   // outer-most ConditionalExpression.
47785
47786
47787   const comments = [...testNodePropertyNames.map(propertyName => getComments(node[propertyName])), getComments(consequentNode), getComments(alternateNode)].flat();
47788   const shouldBreak = comments.some(comment => isBlockComment$2(comment) && hasNewlineInRange$1(options.originalText, locStart$i(comment), locEnd$h(comment)));
47789
47790   const maybeGroup = doc => parent === firstNonConditionalParent ? group$g(doc, {
47791     shouldBreak
47792   }) : shouldBreak ? [doc, breakParent$6] : doc; // Break the closing paren to keep the chain right after it:
47793   // (a
47794   //   ? b
47795   //   : c
47796   // ).call()
47797
47798
47799   const breakClosingParen = !jsxMode && (isMemberExpression$2(parent) || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
47800   const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
47801   const result = maybeGroup([printTernaryTest(path, options, print), forceNoIndent ? parts : indent$b(parts), isConditionalExpression && breakClosingParen && !shouldExtraIndent ? softline$c : ""]);
47802   return isParentTest || shouldExtraIndent ? group$g([indent$b([softline$c, result]), softline$c]) : result;
47803 }
47804
47805 var ternary = {
47806   printTernary: printTernary$2
47807 };
47808
47809 const {
47810   builders: {
47811     hardline: hardline$k
47812   }
47813 } = require$$7$3;
47814 const pathNeedsParens$1 = needsParens_1;
47815 const {
47816   getLeftSidePathName,
47817   hasNakedLeftSide,
47818   isJsxNode,
47819   isTheOnlyJsxElementInMarkdown: isTheOnlyJsxElementInMarkdown$1,
47820   hasComment: hasComment$2,
47821   CommentCheckFlags: CommentCheckFlags$2,
47822   isNextLineEmpty: isNextLineEmpty$6
47823 } = utils$5;
47824 const {
47825   shouldPrintParamsWithoutParens
47826 } = _function;
47827 /**
47828  * @typedef {import("../../document").Doc} Doc
47829  * @typedef {import("../../common/ast-path")} AstPath
47830  */
47831
47832 function printStatementSequence(path, options, print, property) {
47833   const node = path.getValue();
47834   const parts = [];
47835   const isClassBody = node.type === "ClassBody";
47836   const lastStatement = getLastStatement(node[property]);
47837   path.each((path, index, statements) => {
47838     const node = path.getValue(); // Skip printing EmptyStatement nodes to avoid leaving stray
47839     // semicolons lying around.
47840
47841     if (node.type === "EmptyStatement") {
47842       return;
47843     }
47844
47845     const printed = print(); // in no-semi mode, prepend statement with semicolon if it might break ASI
47846     // don't prepend the only JSX element in a program with semicolon
47847
47848     if (!options.semi && !isClassBody && !isTheOnlyJsxElementInMarkdown$1(options, path) && statementNeedsASIProtection(path, options)) {
47849       if (hasComment$2(node, CommentCheckFlags$2.Leading)) {
47850         parts.push(print([], {
47851           needsSemi: true
47852         }));
47853       } else {
47854         parts.push(";", printed);
47855       }
47856     } else {
47857       parts.push(printed);
47858     }
47859
47860     if (!options.semi && isClassBody && isClassProperty(node) && // `ClassBody` don't allow `EmptyStatement`,
47861     // so we can use `statements` to get next node
47862     shouldPrintSemicolonAfterClassProperty(node, statements[index + 1])) {
47863       parts.push(";");
47864     }
47865
47866     if (node !== lastStatement) {
47867       parts.push(hardline$k);
47868
47869       if (isNextLineEmpty$6(node, options)) {
47870         parts.push(hardline$k);
47871       }
47872     }
47873   }, property);
47874   return parts;
47875 }
47876
47877 function getLastStatement(statements) {
47878   for (let i = statements.length - 1; i >= 0; i--) {
47879     const statement = statements[i];
47880
47881     if (statement.type !== "EmptyStatement") {
47882       return statement;
47883     }
47884   }
47885 }
47886
47887 function statementNeedsASIProtection(path, options) {
47888   const node = path.getNode();
47889
47890   if (node.type !== "ExpressionStatement") {
47891     return false;
47892   }
47893
47894   return path.call(childPath => expressionNeedsASIProtection(childPath, options), "expression");
47895 }
47896
47897 function expressionNeedsASIProtection(path, options) {
47898   const node = path.getValue();
47899
47900   switch (node.type) {
47901     case "ParenthesizedExpression":
47902     case "TypeCastExpression":
47903     case "ArrayExpression":
47904     case "ArrayPattern":
47905     case "TemplateLiteral":
47906     case "TemplateElement":
47907     case "RegExpLiteral":
47908       return true;
47909
47910     case "ArrowFunctionExpression":
47911       {
47912         if (!shouldPrintParamsWithoutParens(path, options)) {
47913           return true;
47914         }
47915
47916         break;
47917       }
47918
47919     case "UnaryExpression":
47920       {
47921         const {
47922           prefix,
47923           operator
47924         } = node;
47925
47926         if (prefix && (operator === "+" || operator === "-")) {
47927           return true;
47928         }
47929
47930         break;
47931       }
47932
47933     case "BindExpression":
47934       {
47935         if (!node.object) {
47936           return true;
47937         }
47938
47939         break;
47940       }
47941
47942     case "Literal":
47943       {
47944         if (node.regex) {
47945           return true;
47946         }
47947
47948         break;
47949       }
47950
47951     default:
47952       {
47953         if (isJsxNode(node)) {
47954           return true;
47955         }
47956       }
47957   }
47958
47959   if (pathNeedsParens$1(path, options)) {
47960     return true;
47961   }
47962
47963   if (!hasNakedLeftSide(node)) {
47964     return false;
47965   }
47966
47967   return path.call(childPath => expressionNeedsASIProtection(childPath, options), ...getLeftSidePathName(path, node));
47968 }
47969
47970 function printBody$1(path, options, print) {
47971   return printStatementSequence(path, options, print, "body");
47972 }
47973
47974 function printSwitchCaseConsequent$1(path, options, print) {
47975   return printStatementSequence(path, options, print, "consequent");
47976 }
47977
47978 const isClassProperty = ({
47979   type
47980 }) => type === "ClassProperty" || type === "PropertyDefinition" || type === "ClassPrivateProperty";
47981 /**
47982  * @returns {boolean}
47983  */
47984
47985
47986 function shouldPrintSemicolonAfterClassProperty(node, nextNode) {
47987   const name = node.key && node.key.name; // this isn't actually possible yet with most parsers available today
47988   // so isn't properly tested yet.
47989
47990   if ((name === "static" || name === "get" || name === "set") && !node.value && !node.typeAnnotation) {
47991     return true;
47992   }
47993
47994   if (!nextNode) {
47995     return false;
47996   }
47997
47998   if (nextNode.static || nextNode.accessibility // TypeScript
47999   ) {
48000     return false;
48001   }
48002
48003   if (!nextNode.computed) {
48004     const name = nextNode.key && nextNode.key.name;
48005
48006     if (name === "in" || name === "instanceof") {
48007       return true;
48008     }
48009   } // Flow variance sigil +/- requires semi if there's no
48010   // "declare" or "static" keyword before it.
48011
48012
48013   if (isClassProperty(nextNode) && nextNode.variance && !nextNode.static && !nextNode.declare) {
48014     return true;
48015   }
48016
48017   switch (nextNode.type) {
48018     case "ClassProperty":
48019     case "PropertyDefinition":
48020     case "TSAbstractPropertyDefinition":
48021       return nextNode.computed;
48022
48023     case "MethodDefinition": // Flow
48024
48025     case "TSAbstractMethodDefinition": // TypeScript
48026
48027     case "ClassMethod":
48028     case "ClassPrivateMethod":
48029       {
48030         // Babel
48031         const isAsync = nextNode.value ? nextNode.value.async : nextNode.async;
48032
48033         if (isAsync || nextNode.kind === "get" || nextNode.kind === "set") {
48034           return false;
48035         }
48036
48037         const isGenerator = nextNode.value ? nextNode.value.generator : nextNode.generator;
48038
48039         if (nextNode.computed || isGenerator) {
48040           return true;
48041         }
48042
48043         return false;
48044       }
48045
48046     case "TSIndexSignature":
48047       return true;
48048   }
48049   /* istanbul ignore next */
48050
48051
48052   return false;
48053 }
48054
48055 var statement = {
48056   printBody: printBody$1,
48057   printSwitchCaseConsequent: printSwitchCaseConsequent$1
48058 };
48059
48060 const {
48061   printDanglingComments: printDanglingComments$2
48062 } = comments$4;
48063 const {
48064   isNonEmptyArray: isNonEmptyArray$7
48065 } = util$8;
48066 const {
48067   builders: {
48068     hardline: hardline$j,
48069     indent: indent$a
48070   }
48071 } = require$$7$3;
48072 const {
48073   hasComment: hasComment$1,
48074   CommentCheckFlags: CommentCheckFlags$1,
48075   isNextLineEmpty: isNextLineEmpty$5
48076 } = utils$5;
48077 const {
48078   printHardlineAfterHeritage
48079 } = _class;
48080 const {
48081   printBody
48082 } = statement;
48083 /** @typedef {import("../../document").Doc} Doc */
48084
48085 function printBlock$4(path, options, print) {
48086   const node = path.getValue();
48087   const parts = [];
48088
48089   if (node.type === "StaticBlock") {
48090     parts.push("static ");
48091   }
48092
48093   if (node.type === "ClassBody" && isNonEmptyArray$7(node.body)) {
48094     const parent = path.getParentNode();
48095     parts.push(printHardlineAfterHeritage(parent));
48096   }
48097
48098   parts.push("{");
48099   const printed = printBlockBody$1(path, options, print);
48100
48101   if (printed) {
48102     parts.push(indent$a([hardline$j, printed]), hardline$j);
48103   } else {
48104     const parent = path.getParentNode();
48105     const parentParent = path.getParentNode(1);
48106
48107     if (!(parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ObjectMethod" || parent.type === "ClassMethod" || parent.type === "ClassPrivateMethod" || parent.type === "ForStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement" || parent.type === "DoExpression" || parent.type === "CatchClause" && !parentParent.finalizer || parent.type === "TSModuleDeclaration" || parent.type === "TSDeclareFunction" || node.type === "StaticBlock" || node.type === "ClassBody")) {
48108       parts.push(hardline$j);
48109     }
48110   }
48111
48112   parts.push("}");
48113   return parts;
48114 }
48115
48116 function printBlockBody$1(path, options, print) {
48117   const node = path.getValue();
48118   const nodeHasDirectives = isNonEmptyArray$7(node.directives);
48119   const nodeHasBody = node.body.some(node => node.type !== "EmptyStatement");
48120   const nodeHasComment = hasComment$1(node, CommentCheckFlags$1.Dangling);
48121
48122   if (!nodeHasDirectives && !nodeHasBody && !nodeHasComment) {
48123     return "";
48124   }
48125
48126   const parts = []; // Babel 6
48127
48128   if (nodeHasDirectives) {
48129     path.each((childPath, index, directives) => {
48130       parts.push(print());
48131
48132       if (index < directives.length - 1 || nodeHasBody || nodeHasComment) {
48133         parts.push(hardline$j);
48134
48135         if (isNextLineEmpty$5(childPath.getValue(), options)) {
48136           parts.push(hardline$j);
48137         }
48138       }
48139     }, "directives");
48140   }
48141
48142   if (nodeHasBody) {
48143     parts.push(printBody(path, options, print));
48144   }
48145
48146   if (nodeHasComment) {
48147     parts.push(printDanglingComments$2(path, options,
48148     /* sameIndent */
48149     true));
48150   }
48151
48152   if (node.type === "Program") {
48153     const parent = path.getParentNode();
48154
48155     if (!parent || parent.type !== "ModuleExpression") {
48156       parts.push(hardline$j);
48157     }
48158   }
48159
48160   return parts;
48161 }
48162
48163 var block$1 = {
48164   printBlock: printBlock$4,
48165   printBlockBody: printBlockBody$1
48166 };
48167
48168 const {
48169   printDanglingComments: printDanglingComments$1
48170 } = comments$4;
48171 const {
48172   hasNewlineInRange
48173 } = util$8;
48174 const {
48175   builders: {
48176     join: join$e,
48177     line: line$f,
48178     hardline: hardline$i,
48179     softline: softline$b,
48180     group: group$f,
48181     indent: indent$9,
48182     conditionalGroup: conditionalGroup$1,
48183     ifBreak: ifBreak$9
48184   }
48185 } = require$$7$3;
48186 const {
48187   isLiteral,
48188   getTypeScriptMappedTypeModifier,
48189   shouldPrintComma: shouldPrintComma$1,
48190   isCallExpression: isCallExpression$1,
48191   isMemberExpression: isMemberExpression$1
48192 } = utils$5;
48193 const {
48194   locStart: locStart$h,
48195   locEnd: locEnd$g
48196 } = loc$6;
48197 const {
48198   printOptionalToken: printOptionalToken$1,
48199   printTypeScriptModifiers
48200 } = misc$1;
48201 const {
48202   printTernary: printTernary$1
48203 } = ternary;
48204 const {
48205   printFunctionParameters,
48206   shouldGroupFunctionParameters
48207 } = functionParameters;
48208 const {
48209   printTemplateLiteral: printTemplateLiteral$1
48210 } = templateLiteral;
48211 const {
48212   printArrayItems
48213 } = array;
48214 const {
48215   printObject: printObject$1
48216 } = object$1;
48217 const {
48218   printClassProperty: printClassProperty$1,
48219   printClassMethod: printClassMethod$1
48220 } = _class;
48221 const {
48222   printTypeParameter,
48223   printTypeParameters
48224 } = typeParameters;
48225 const {
48226   printPropertyKey
48227 } = property;
48228 const {
48229   printFunction: printFunction$1,
48230   printMethodInternal
48231 } = _function;
48232 const {
48233   printInterface
48234 } = _interface;
48235 const {
48236   printBlock: printBlock$3
48237 } = block$1;
48238 const {
48239   printTypeAlias,
48240   printIntersectionType,
48241   printUnionType,
48242   printFunctionType,
48243   printTupleType,
48244   printIndexedAccessType
48245 } = typeAnnotation;
48246
48247 function printTypescript$1(path, options, print) {
48248   const node = path.getValue(); // TypeScript nodes always starts with `TS`
48249
48250   if (!node.type.startsWith("TS")) {
48251     return;
48252   }
48253
48254   if (node.type.endsWith("Keyword")) {
48255     return node.type.slice(2, -7).toLowerCase();
48256   }
48257
48258   const semi = options.semi ? ";" : "";
48259   const parts = [];
48260
48261   switch (node.type) {
48262     case "TSThisType":
48263       return "this";
48264
48265     case "TSTypeAssertion":
48266       {
48267         const shouldBreakAfterCast = !(node.expression.type === "ArrayExpression" || node.expression.type === "ObjectExpression");
48268         const castGroup = group$f(["<", indent$9([softline$b, print("typeAnnotation")]), softline$b, ">"]);
48269         const exprContents = [ifBreak$9("("), indent$9([softline$b, print("expression")]), softline$b, ifBreak$9(")")];
48270
48271         if (shouldBreakAfterCast) {
48272           return conditionalGroup$1([[castGroup, print("expression")], [castGroup, group$f(exprContents, {
48273             shouldBreak: true
48274           })], [castGroup, print("expression")]]);
48275         }
48276
48277         return group$f([castGroup, print("expression")]);
48278       }
48279
48280     case "TSDeclareFunction":
48281       return printFunction$1(path, print, options);
48282
48283     case "TSExportAssignment":
48284       return ["export = ", print("expression"), semi];
48285
48286     case "TSModuleBlock":
48287       return printBlock$3(path, options, print);
48288
48289     case "TSInterfaceBody":
48290     case "TSTypeLiteral":
48291       return printObject$1(path, options, print);
48292
48293     case "TSTypeAliasDeclaration":
48294       return printTypeAlias(path, options, print);
48295
48296     case "TSQualifiedName":
48297       return join$e(".", [print("left"), print("right")]);
48298
48299     case "TSAbstractMethodDefinition":
48300     case "TSDeclareMethod":
48301       return printClassMethod$1(path, options, print);
48302
48303     case "TSAbstractPropertyDefinition":
48304       return printClassProperty$1(path, options, print);
48305
48306     case "TSInterfaceHeritage":
48307     case "TSExpressionWithTypeArguments":
48308       // Babel AST
48309       parts.push(print("expression"));
48310
48311       if (node.typeParameters) {
48312         parts.push(print("typeParameters"));
48313       }
48314
48315       return parts;
48316
48317     case "TSTemplateLiteralType":
48318       return printTemplateLiteral$1(path, print, options);
48319
48320     case "TSNamedTupleMember":
48321       return [print("label"), node.optional ? "?" : "", ": ", print("elementType")];
48322
48323     case "TSRestType":
48324       return ["...", print("typeAnnotation")];
48325
48326     case "TSOptionalType":
48327       return [print("typeAnnotation"), "?"];
48328
48329     case "TSInterfaceDeclaration":
48330       return printInterface(path, options, print);
48331
48332     case "TSClassImplements":
48333       return [print("expression"), print("typeParameters")];
48334
48335     case "TSTypeParameterDeclaration":
48336     case "TSTypeParameterInstantiation":
48337       return printTypeParameters(path, options, print, "params");
48338
48339     case "TSTypeParameter":
48340       return printTypeParameter(path, options, print);
48341
48342     case "TSAsExpression":
48343       {
48344         parts.push(print("expression"), " as ", print("typeAnnotation"));
48345         const parent = path.getParentNode();
48346
48347         if (isCallExpression$1(parent) && parent.callee === node || isMemberExpression$1(parent) && parent.object === node) {
48348           return group$f([indent$9([softline$b, ...parts]), softline$b]);
48349         }
48350
48351         return parts;
48352       }
48353
48354     case "TSArrayType":
48355       return [print("elementType"), "[]"];
48356
48357     case "TSPropertySignature":
48358       {
48359         if (node.readonly) {
48360           parts.push("readonly ");
48361         }
48362
48363         parts.push(printPropertyKey(path, options, print), printOptionalToken$1(path));
48364
48365         if (node.typeAnnotation) {
48366           parts.push(": ", print("typeAnnotation"));
48367         } // This isn't valid semantically, but it's in the AST so we can print it.
48368
48369
48370         if (node.initializer) {
48371           parts.push(" = ", print("initializer"));
48372         }
48373
48374         return parts;
48375       }
48376
48377     case "TSParameterProperty":
48378       if (node.accessibility) {
48379         parts.push(node.accessibility + " ");
48380       }
48381
48382       if (node.export) {
48383         parts.push("export ");
48384       }
48385
48386       if (node.static) {
48387         parts.push("static ");
48388       }
48389
48390       if (node.override) {
48391         parts.push("override ");
48392       }
48393
48394       if (node.readonly) {
48395         parts.push("readonly ");
48396       }
48397
48398       parts.push(print("parameter"));
48399       return parts;
48400
48401     case "TSTypeQuery":
48402       return ["typeof ", print("exprName")];
48403
48404     case "TSIndexSignature":
48405       {
48406         const parent = path.getParentNode(); // The typescript parser accepts multiple parameters here. If you're
48407         // using them, it makes sense to have a trailing comma. But if you
48408         // aren't, this is more like a computed property name than an array.
48409         // So we leave off the trailing comma when there's just one parameter.
48410
48411         const trailingComma = node.parameters.length > 1 ? ifBreak$9(shouldPrintComma$1(options) ? "," : "") : "";
48412         const parametersGroup = group$f([indent$9([softline$b, join$e([", ", softline$b], path.map(print, "parameters"))]), trailingComma, softline$b]);
48413         return [node.export ? "export " : "", node.accessibility ? [node.accessibility, " "] : "", node.static ? "static " : "", node.readonly ? "readonly " : "", node.declare ? "declare " : "", "[", node.parameters ? parametersGroup : "", node.typeAnnotation ? "]: " : "]", node.typeAnnotation ? print("typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""];
48414       }
48415
48416     case "TSTypePredicate":
48417       return [node.asserts ? "asserts " : "", print("parameterName"), node.typeAnnotation ? [" is ", print("typeAnnotation")] : ""];
48418
48419     case "TSNonNullExpression":
48420       return [print("expression"), "!"];
48421
48422     case "TSImportType":
48423       return [!node.isTypeOf ? "" : "typeof ", "import(", print(node.parameter ? "parameter" : "argument"), ")", !node.qualifier ? "" : [".", print("qualifier")], printTypeParameters(path, options, print, "typeParameters")];
48424
48425     case "TSLiteralType":
48426       return print("literal");
48427
48428     case "TSIndexedAccessType":
48429       return printIndexedAccessType(path, options, print);
48430
48431     case "TSConstructSignatureDeclaration":
48432     case "TSCallSignatureDeclaration":
48433     case "TSConstructorType":
48434       {
48435         if (node.type === "TSConstructorType" && node.abstract) {
48436           parts.push("abstract ");
48437         }
48438
48439         if (node.type !== "TSCallSignatureDeclaration") {
48440           parts.push("new ");
48441         }
48442
48443         parts.push(group$f(printFunctionParameters(path, print, options,
48444         /* expandArg */
48445         false,
48446         /* printTypeParams */
48447         true)));
48448
48449         if (node.returnType || node.typeAnnotation) {
48450           const isType = node.type === "TSConstructorType";
48451           parts.push(isType ? " => " : ": ", print("returnType"), print("typeAnnotation"));
48452         }
48453
48454         return parts;
48455       }
48456
48457     case "TSTypeOperator":
48458       return [node.operator, " ", print("typeAnnotation")];
48459
48460     case "TSMappedType":
48461       {
48462         const shouldBreak = hasNewlineInRange(options.originalText, locStart$h(node), locEnd$g(node));
48463         return group$f(["{", indent$9([options.bracketSpacing ? line$f : softline$b, node.readonly ? [getTypeScriptMappedTypeModifier(node.readonly, "readonly"), " "] : "", printTypeScriptModifiers(path, options, print), print("typeParameter"), node.optional ? getTypeScriptMappedTypeModifier(node.optional, "?") : "", node.typeAnnotation ? ": " : "", print("typeAnnotation"), ifBreak$9(semi)]), printDanglingComments$1(path, options,
48464         /* sameIndent */
48465         true), options.bracketSpacing ? line$f : softline$b, "}"], {
48466           shouldBreak
48467         });
48468       }
48469
48470     case "TSMethodSignature":
48471       {
48472         const kind = node.kind && node.kind !== "method" ? `${node.kind} ` : "";
48473         parts.push(node.accessibility ? [node.accessibility, " "] : "", kind, node.export ? "export " : "", node.static ? "static " : "", node.readonly ? "readonly " : "", // "abstract" and "declare" are supported by only "babel-ts"
48474         // https://github.com/prettier/prettier/issues/9760
48475         node.abstract ? "abstract " : "", node.declare ? "declare " : "", node.computed ? "[" : "", print("key"), node.computed ? "]" : "", printOptionalToken$1(path));
48476         const parametersDoc = printFunctionParameters(path, print, options,
48477         /* expandArg */
48478         false,
48479         /* printTypeParams */
48480         true);
48481         const returnTypePropertyName = node.returnType ? "returnType" : "typeAnnotation";
48482         const returnTypeNode = node[returnTypePropertyName];
48483         const returnTypeDoc = returnTypeNode ? print(returnTypePropertyName) : "";
48484         const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
48485         parts.push(shouldGroupParameters ? group$f(parametersDoc) : parametersDoc);
48486
48487         if (returnTypeNode) {
48488           parts.push(": ", group$f(returnTypeDoc));
48489         }
48490
48491         return group$f(parts);
48492       }
48493
48494     case "TSNamespaceExportDeclaration":
48495       parts.push("export as namespace ", print("id"));
48496
48497       if (options.semi) {
48498         parts.push(";");
48499       }
48500
48501       return group$f(parts);
48502
48503     case "TSEnumDeclaration":
48504       if (node.declare) {
48505         parts.push("declare ");
48506       }
48507
48508       if (node.modifiers) {
48509         parts.push(printTypeScriptModifiers(path, options, print));
48510       }
48511
48512       if (node.const) {
48513         parts.push("const ");
48514       }
48515
48516       parts.push("enum ", print("id"), " ");
48517
48518       if (node.members.length === 0) {
48519         parts.push(group$f(["{", printDanglingComments$1(path, options), softline$b, "}"]));
48520       } else {
48521         parts.push(group$f(["{", indent$9([hardline$i, printArrayItems(path, options, "members", print), shouldPrintComma$1(options, "es5") ? "," : ""]), printDanglingComments$1(path, options,
48522         /* sameIndent */
48523         true), hardline$i, "}"]));
48524       }
48525
48526       return parts;
48527
48528     case "TSEnumMember":
48529       parts.push(print("id"));
48530
48531       if (node.initializer) {
48532         parts.push(" = ", print("initializer"));
48533       }
48534
48535       return parts;
48536
48537     case "TSImportEqualsDeclaration":
48538       if (node.isExport) {
48539         parts.push("export ");
48540       }
48541
48542       parts.push("import ");
48543
48544       if (node.importKind && node.importKind !== "value") {
48545         parts.push(node.importKind, " ");
48546       }
48547
48548       parts.push(print("id"), " = ", print("moduleReference"));
48549
48550       if (options.semi) {
48551         parts.push(";");
48552       }
48553
48554       return group$f(parts);
48555
48556     case "TSExternalModuleReference":
48557       return ["require(", print("expression"), ")"];
48558
48559     case "TSModuleDeclaration":
48560       {
48561         const parent = path.getParentNode();
48562         const isExternalModule = isLiteral(node.id);
48563         const parentIsDeclaration = parent.type === "TSModuleDeclaration";
48564         const bodyIsDeclaration = node.body && node.body.type === "TSModuleDeclaration";
48565
48566         if (parentIsDeclaration) {
48567           parts.push(".");
48568         } else {
48569           if (node.declare) {
48570             parts.push("declare ");
48571           }
48572
48573           parts.push(printTypeScriptModifiers(path, options, print));
48574           const textBetweenNodeAndItsId = options.originalText.slice(locStart$h(node), locStart$h(node.id)); // Global declaration looks like this:
48575           // (declare)? global { ... }
48576
48577           const isGlobalDeclaration = node.id.type === "Identifier" && node.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
48578
48579           if (!isGlobalDeclaration) {
48580             parts.push(isExternalModule || /(?:^|\s)module(?:\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
48581           }
48582         }
48583
48584         parts.push(print("id"));
48585
48586         if (bodyIsDeclaration) {
48587           parts.push(print("body"));
48588         } else if (node.body) {
48589           parts.push(" ", group$f(print("body")));
48590         } else {
48591           parts.push(semi);
48592         }
48593
48594         return parts;
48595       }
48596
48597     case "TSConditionalType":
48598       return printTernary$1(path, options, print);
48599
48600     case "TSInferType":
48601       return ["infer", " ", print("typeParameter")];
48602
48603     case "TSIntersectionType":
48604       return printIntersectionType(path, options, print);
48605
48606     case "TSUnionType":
48607       return printUnionType(path, options, print);
48608
48609     case "TSFunctionType":
48610       return printFunctionType(path, options, print);
48611
48612     case "TSTupleType":
48613       return printTupleType(path, options, print);
48614
48615     case "TSTypeReference":
48616       return [print("typeName"), printTypeParameters(path, options, print, "typeParameters")];
48617
48618     case "TSTypeAnnotation":
48619       return print("typeAnnotation");
48620
48621     case "TSEmptyBodyFunctionExpression":
48622       return printMethodInternal(path, options, print);
48623     // These are not valid TypeScript. Printing them just for the sake of error recovery.
48624
48625     case "TSJSDocAllType":
48626       return "*";
48627
48628     case "TSJSDocUnknownType":
48629       return "?";
48630
48631     case "TSJSDocNullableType":
48632       return ["?", print("typeAnnotation")];
48633
48634     case "TSJSDocNonNullableType":
48635       return ["!", print("typeAnnotation")];
48636
48637     default:
48638       /* istanbul ignore next */
48639       throw new Error(`Unknown TypeScript node type: ${JSON.stringify(node.type)}.`);
48640   }
48641 }
48642
48643 var typescript = {
48644   printTypescript: printTypescript$1
48645 };
48646
48647 const {
48648   hasNewline: hasNewline$2
48649 } = util$8;
48650 const {
48651   builders: {
48652     join: join$d,
48653     hardline: hardline$h
48654   },
48655   utils: {
48656     replaceTextEndOfLine: replaceTextEndOfLine$a
48657   }
48658 } = require$$7$3;
48659 const {
48660   isLineComment: isLineComment$1,
48661   isBlockComment: isBlockComment$1
48662 } = utils$5;
48663 const {
48664   locStart: locStart$g,
48665   locEnd: locEnd$f
48666 } = loc$6;
48667
48668 function printComment$2(commentPath, options) {
48669   const comment = commentPath.getValue();
48670
48671   if (isLineComment$1(comment)) {
48672     // Supports `//`, `#!`, `<!--`, and `-->`
48673     return options.originalText.slice(locStart$g(comment), locEnd$f(comment)).trimEnd();
48674   }
48675
48676   if (isBlockComment$1(comment)) {
48677     if (isIndentableBlockComment(comment)) {
48678       const printed = printIndentableBlockComment(comment); // We need to prevent an edge case of a previous trailing comment
48679       // printed as a `lineSuffix` which causes the comments to be
48680       // interleaved. See https://github.com/prettier/prettier/issues/4412
48681
48682       if (comment.trailing && !hasNewline$2(options.originalText, locStart$g(comment), {
48683         backwards: true
48684       })) {
48685         return [hardline$h, printed];
48686       }
48687
48688       return printed;
48689     }
48690
48691     const commentEnd = locEnd$f(comment);
48692     const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
48693     return ["/*", replaceTextEndOfLine$a(comment.value), isInsideFlowComment ? "*-/" : "*/"];
48694   }
48695   /* istanbul ignore next */
48696
48697
48698   throw new Error("Not a comment: " + JSON.stringify(comment));
48699 }
48700
48701 function isIndentableBlockComment(comment) {
48702   // If the comment has multiple lines and every line starts with a star
48703   // we can fix the indentation of each line. The stars in the `/*` and
48704   // `*/` delimiters are not included in the comment value, so add them
48705   // back first.
48706   const lines = `*${comment.value}*`.split("\n");
48707   return lines.length > 1 && lines.every(line => line.trim()[0] === "*");
48708 }
48709
48710 function printIndentableBlockComment(comment) {
48711   const lines = comment.value.split("\n");
48712   return ["/*", join$d(hardline$h, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"];
48713 }
48714
48715 var comment = {
48716   printComment: printComment$2
48717 };
48718
48719 const {
48720   printString: printString$1,
48721   printNumber: printNumber$1
48722 } = util$8;
48723
48724 function printLiteral$1(path, options
48725 /*, print*/
48726 ) {
48727   const node = path.getNode();
48728
48729   switch (node.type) {
48730     case "RegExpLiteral":
48731       // Babel 6 Literal split
48732       return printRegex(node);
48733
48734     case "BigIntLiteral":
48735       // babel: node.extra.raw, flow: node.bigint
48736       return printBigInt(node.bigint || node.extra.raw);
48737
48738     case "NumericLiteral":
48739       // Babel 6 Literal split
48740       return printNumber$1(node.extra.raw);
48741
48742     case "StringLiteral":
48743       // Babel 6 Literal split
48744       return printString$1(node.extra.raw, options);
48745
48746     case "NullLiteral":
48747       // Babel 6 Literal split
48748       return "null";
48749
48750     case "BooleanLiteral":
48751       // Babel 6 Literal split
48752       return String(node.value);
48753
48754     case "DecimalLiteral":
48755       return printNumber$1(node.value) + "m";
48756
48757     case "Literal":
48758       {
48759         if (node.regex) {
48760           return printRegex(node.regex);
48761         }
48762
48763         if (node.bigint) {
48764           return printBigInt(node.raw);
48765         }
48766
48767         if (node.decimal) {
48768           return printNumber$1(node.decimal) + "m";
48769         }
48770
48771         const {
48772           value
48773         } = node;
48774
48775         if (typeof value === "number") {
48776           return printNumber$1(node.raw);
48777         }
48778
48779         if (typeof value === "string") {
48780           return printString$1(node.raw, options);
48781         }
48782
48783         return String(value);
48784       }
48785   }
48786 }
48787
48788 function printBigInt(raw) {
48789   return raw.toLowerCase();
48790 }
48791
48792 function printRegex({
48793   pattern,
48794   flags
48795 }) {
48796   flags = [...flags].sort().join("");
48797   return `/${pattern}/${flags}`;
48798 }
48799
48800 var literal = {
48801   printLiteral: printLiteral$1
48802 };
48803
48804 /** @typedef {import("../document").Doc} Doc */
48805 // TODO(azz): anything that imports from main shouldn't be in a `language-*` dir.
48806
48807
48808 const {
48809   printDanglingComments
48810 } = comments$4;
48811 const {
48812   hasNewline: hasNewline$1
48813 } = util$8;
48814 const {
48815   builders: {
48816     join: join$c,
48817     line: line$e,
48818     hardline: hardline$g,
48819     softline: softline$a,
48820     group: group$e,
48821     indent: indent$8
48822   },
48823   utils: {
48824     replaceTextEndOfLine: replaceTextEndOfLine$9
48825   }
48826 } = require$$7$3;
48827 const embed$9 = embed_1$4;
48828 const clean$b = clean_1$4;
48829 const {
48830   insertPragma: insertPragma$9
48831 } = pragma$5;
48832 const handleComments = comments;
48833 const pathNeedsParens = needsParens_1;
48834 const preprocess$7 = printPreprocess$3;
48835 const {
48836   hasFlowShorthandAnnotationComment,
48837   hasComment,
48838   CommentCheckFlags,
48839   isTheOnlyJsxElementInMarkdown,
48840   isBlockComment,
48841   isLineComment,
48842   isNextLineEmpty: isNextLineEmpty$4,
48843   needsHardlineAfterDanglingComment,
48844   rawText,
48845   hasIgnoreComment,
48846   isCallExpression,
48847   isMemberExpression
48848 } = utils$5;
48849 const {
48850   locStart: locStart$f,
48851   locEnd: locEnd$e
48852 } = loc$6;
48853 const {
48854   printHtmlBinding,
48855   isVueEventBindingExpression: isVueEventBindingExpression$2
48856 } = htmlBinding;
48857 const {
48858   printAngular
48859 } = angular;
48860 const {
48861   printJsx,
48862   hasJsxIgnoreComment
48863 } = jsx;
48864 const {
48865   printFlow
48866 } = flow;
48867 const {
48868   printTypescript
48869 } = typescript;
48870 const {
48871   printOptionalToken,
48872   printBindExpressionCallee,
48873   printTypeAnnotation,
48874   adjustClause,
48875   printRestSpread
48876 } = misc$1;
48877 const {
48878   printImportDeclaration,
48879   printExportDeclaration,
48880   printExportAllDeclaration,
48881   printModuleSpecifier
48882 } = module$1;
48883 const {
48884   printTernary
48885 } = ternary;
48886 const {
48887   printTemplateLiteral
48888 } = templateLiteral;
48889 const {
48890   printArray
48891 } = array;
48892 const {
48893   printObject
48894 } = object$1;
48895 const {
48896   printClass,
48897   printClassMethod,
48898   printClassProperty
48899 } = _class;
48900 const {
48901   printProperty
48902 } = property;
48903 const {
48904   printFunction,
48905   printArrowFunction,
48906   printMethod,
48907   printReturnStatement,
48908   printThrowStatement
48909 } = _function;
48910 const {
48911   printCallExpression
48912 } = callExpression;
48913 const {
48914   printVariableDeclarator,
48915   printAssignmentExpression
48916 } = assignment;
48917 const {
48918   printBinaryishExpression
48919 } = binaryish;
48920 const {
48921   printSwitchCaseConsequent
48922 } = statement;
48923 const {
48924   printMemberExpression
48925 } = member;
48926 const {
48927   printBlock: printBlock$2,
48928   printBlockBody
48929 } = block$1;
48930 const {
48931   printComment: printComment$1
48932 } = comment;
48933 const {
48934   printLiteral
48935 } = literal;
48936 const {
48937   printDecorators
48938 } = decorators;
48939
48940 function genericPrint$6(path, options, print, args) {
48941   const printed = printPathNoParens(path, options, print, args);
48942
48943   if (!printed) {
48944     return "";
48945   }
48946
48947   const node = path.getValue();
48948   const {
48949     type
48950   } = node; // Their decorators are handled themselves, and they can't have parentheses
48951
48952   if (type === "ClassMethod" || type === "ClassPrivateMethod" || type === "ClassProperty" || type === "PropertyDefinition" || type === "TSAbstractPropertyDefinition" || type === "ClassPrivateProperty" || type === "MethodDefinition" || type === "TSAbstractMethodDefinition" || type === "TSDeclareMethod") {
48953     return printed;
48954   }
48955
48956   const printedDecorators = printDecorators(path, options, print); // Nodes with decorators can't have parentheses and don't need leading semicolons
48957
48958   if (printedDecorators) {
48959     return group$e([...printedDecorators, printed]);
48960   }
48961
48962   const needsParens = pathNeedsParens(path, options);
48963
48964   if (!needsParens) {
48965     return args && args.needsSemi ? [";", printed] : printed;
48966   }
48967
48968   const parts = [args && args.needsSemi ? ";(" : "(", printed];
48969
48970   if (hasFlowShorthandAnnotationComment(node)) {
48971     const [comment] = node.trailingComments;
48972     parts.push(" /*", comment.value.trimStart(), "*/");
48973     comment.printed = true;
48974   }
48975
48976   parts.push(")");
48977   return parts;
48978 }
48979
48980 function printPathNoParens(path, options, print, args) {
48981   const node = path.getValue();
48982   const semi = options.semi ? ";" : "";
48983
48984   if (!node) {
48985     return "";
48986   }
48987
48988   if (typeof node === "string") {
48989     return node;
48990   }
48991
48992   for (const printer of [printLiteral, printHtmlBinding, printAngular, printJsx, printFlow, printTypescript]) {
48993     const printed = printer(path, options, print);
48994
48995     if (typeof printed !== "undefined") {
48996       return printed;
48997     }
48998   }
48999   /** @type{Doc[]} */
49000
49001
49002   let parts = [];
49003
49004   switch (node.type) {
49005     case "JsExpressionRoot":
49006       return print("node");
49007
49008     case "JsonRoot":
49009       return [print("node"), hardline$g];
49010
49011     case "File":
49012       // Print @babel/parser's InterpreterDirective here so that
49013       // leading comments on the `Program` node get printed after the hashbang.
49014       if (node.program && node.program.interpreter) {
49015         parts.push(print(["program", "interpreter"]));
49016       }
49017
49018       parts.push(print("program"));
49019       return parts;
49020
49021     case "Program":
49022       return printBlockBody(path, options, print);
49023     // Babel extension.
49024
49025     case "EmptyStatement":
49026       return "";
49027
49028     case "ExpressionStatement":
49029       // Detect Flow and TypeScript directives
49030       if (node.directive) {
49031         return [printDirective(node.expression, options), semi];
49032       }
49033
49034       if (options.parser === "__vue_event_binding") {
49035         const parent = path.getParentNode();
49036
49037         if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === node) {
49038           return [print("expression"), isVueEventBindingExpression$2(node.expression) ? ";" : ""];
49039         }
49040       } // Do not append semicolon after the only JSX element in a program
49041
49042
49043       return [print("expression"), isTheOnlyJsxElementInMarkdown(options, path) ? "" : semi];
49044     // Babel non-standard node. Used for Closure-style type casts. See postprocess.js.
49045
49046     case "ParenthesizedExpression":
49047       {
49048         const shouldHug = !hasComment(node.expression) && (node.expression.type === "ObjectExpression" || node.expression.type === "ArrayExpression");
49049
49050         if (shouldHug) {
49051           return ["(", print("expression"), ")"];
49052         }
49053
49054         return group$e(["(", indent$8([softline$a, print("expression")]), softline$a, ")"]);
49055       }
49056
49057     case "AssignmentExpression":
49058       return printAssignmentExpression(path, options, print);
49059
49060     case "VariableDeclarator":
49061       return printVariableDeclarator(path, options, print);
49062
49063     case "BinaryExpression":
49064     case "LogicalExpression":
49065       return printBinaryishExpression(path, options, print);
49066
49067     case "AssignmentPattern":
49068       return [print("left"), " = ", print("right")];
49069
49070     case "OptionalMemberExpression":
49071     case "MemberExpression":
49072       {
49073         return printMemberExpression(path, options, print);
49074       }
49075
49076     case "MetaProperty":
49077       return [print("meta"), ".", print("property")];
49078
49079     case "BindExpression":
49080       if (node.object) {
49081         parts.push(print("object"));
49082       }
49083
49084       parts.push(group$e(indent$8([softline$a, printBindExpressionCallee(path, options, print)])));
49085       return parts;
49086
49087     case "Identifier":
49088       {
49089         return [node.name, printOptionalToken(path), printTypeAnnotation(path, options, print)];
49090       }
49091
49092     case "V8IntrinsicIdentifier":
49093       return ["%", node.name];
49094
49095     case "SpreadElement":
49096     case "SpreadElementPattern":
49097     case "SpreadProperty":
49098     case "SpreadPropertyPattern":
49099     case "RestElement":
49100       return printRestSpread(path, options, print);
49101
49102     case "FunctionDeclaration":
49103     case "FunctionExpression":
49104       return printFunction(path, print, options, args);
49105
49106     case "ArrowFunctionExpression":
49107       return printArrowFunction(path, options, print, args);
49108
49109     case "YieldExpression":
49110       parts.push("yield");
49111
49112       if (node.delegate) {
49113         parts.push("*");
49114       }
49115
49116       if (node.argument) {
49117         parts.push(" ", print("argument"));
49118       }
49119
49120       return parts;
49121
49122     case "AwaitExpression":
49123       {
49124         parts.push("await");
49125
49126         if (node.argument) {
49127           parts.push(" ", print("argument"));
49128           const parent = path.getParentNode();
49129
49130           if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
49131             parts = [indent$8([softline$a, ...parts]), softline$a];
49132             const parentAwaitOrBlock = path.findAncestor(node => node.type === "AwaitExpression" || node.type === "BlockStatement");
49133
49134             if (!parentAwaitOrBlock || parentAwaitOrBlock.type !== "AwaitExpression") {
49135               return group$e(parts);
49136             }
49137           }
49138         }
49139
49140         return parts;
49141       }
49142
49143     case "ExportDefaultDeclaration":
49144     case "ExportNamedDeclaration":
49145       return printExportDeclaration(path, options, print);
49146
49147     case "ExportAllDeclaration":
49148       return printExportAllDeclaration(path, options, print);
49149
49150     case "ImportDeclaration":
49151       return printImportDeclaration(path, options, print);
49152
49153     case "ImportSpecifier":
49154     case "ExportSpecifier":
49155     case "ImportNamespaceSpecifier":
49156     case "ExportNamespaceSpecifier":
49157     case "ImportDefaultSpecifier":
49158     case "ExportDefaultSpecifier":
49159       return printModuleSpecifier(path, options, print);
49160
49161     case "ImportAttribute":
49162       return [print("key"), ": ", print("value")];
49163
49164     case "Import":
49165       return "import";
49166
49167     case "BlockStatement":
49168     case "StaticBlock":
49169     case "ClassBody":
49170       return printBlock$2(path, options, print);
49171
49172     case "ThrowStatement":
49173       return printThrowStatement(path, options, print);
49174
49175     case "ReturnStatement":
49176       return printReturnStatement(path, options, print);
49177
49178     case "NewExpression":
49179     case "ImportExpression":
49180     case "OptionalCallExpression":
49181     case "CallExpression":
49182       return printCallExpression(path, options, print);
49183
49184     case "ObjectExpression":
49185     case "ObjectPattern":
49186     case "RecordExpression":
49187       return printObject(path, options, print);
49188     // Babel 6
49189
49190     case "ObjectProperty": // Non-standard AST node type.
49191
49192     case "Property":
49193       if (node.method || node.kind === "get" || node.kind === "set") {
49194         return printMethod(path, options, print);
49195       }
49196
49197       return printProperty(path, options, print);
49198
49199     case "ObjectMethod":
49200       return printMethod(path, options, print);
49201
49202     case "Decorator":
49203       return ["@", print("expression")];
49204
49205     case "ArrayExpression":
49206     case "ArrayPattern":
49207     case "TupleExpression":
49208       return printArray(path, options, print);
49209
49210     case "SequenceExpression":
49211       {
49212         const parent = path.getParentNode(0);
49213
49214         if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
49215           // For ExpressionStatements and for-loop heads, which are among
49216           // the few places a SequenceExpression appears unparenthesized, we want
49217           // to indent expressions after the first.
49218           const parts = [];
49219           path.each((expressionPath, index) => {
49220             if (index === 0) {
49221               parts.push(print());
49222             } else {
49223               parts.push(",", indent$8([line$e, print()]));
49224             }
49225           }, "expressions");
49226           return group$e(parts);
49227         }
49228
49229         return group$e(join$c([",", line$e], path.map(print, "expressions")));
49230       }
49231
49232     case "ThisExpression":
49233       return "this";
49234
49235     case "Super":
49236       return "super";
49237
49238     case "Directive":
49239       return [print("value"), semi];
49240     // Babel 6
49241
49242     case "DirectiveLiteral":
49243       return printDirective(node, options);
49244
49245     case "UnaryExpression":
49246       parts.push(node.operator);
49247
49248       if (/[a-z]$/.test(node.operator)) {
49249         parts.push(" ");
49250       }
49251
49252       if (hasComment(node.argument)) {
49253         parts.push(group$e(["(", indent$8([softline$a, print("argument")]), softline$a, ")"]));
49254       } else {
49255         parts.push(print("argument"));
49256       }
49257
49258       return parts;
49259
49260     case "UpdateExpression":
49261       parts.push(print("argument"), node.operator);
49262
49263       if (node.prefix) {
49264         parts.reverse();
49265       }
49266
49267       return parts;
49268
49269     case "ConditionalExpression":
49270       return printTernary(path, options, print);
49271
49272     case "VariableDeclaration":
49273       {
49274         const printed = path.map(print, "declarations"); // We generally want to terminate all variable declarations with a
49275         // semicolon, except when they in the () part of for loops.
49276
49277         const parentNode = path.getParentNode();
49278         const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
49279         const hasValue = node.declarations.some(decl => decl.init);
49280         let firstVariable;
49281
49282         if (printed.length === 1 && !hasComment(node.declarations[0])) {
49283           firstVariable = printed[0];
49284         } else if (printed.length > 0) {
49285           // Indent first var to comply with eslint one-var rule
49286           firstVariable = indent$8(printed[0]);
49287         }
49288
49289         parts = [node.declare ? "declare " : "", node.kind, firstVariable ? [" ", firstVariable] : "", indent$8(printed.slice(1).map(p => [",", hasValue && !isParentForLoop ? hardline$g : line$e, p]))];
49290
49291         if (!(isParentForLoop && parentNode.body !== node)) {
49292           parts.push(semi);
49293         }
49294
49295         return group$e(parts);
49296       }
49297
49298     case "WithStatement":
49299       return group$e(["with (", print("object"), ")", adjustClause(node.body, print("body"))]);
49300
49301     case "IfStatement":
49302       {
49303         const con = adjustClause(node.consequent, print("consequent"));
49304         const opening = group$e(["if (", group$e([indent$8([softline$a, print("test")]), softline$a]), ")", con]);
49305         parts.push(opening);
49306
49307         if (node.alternate) {
49308           const commentOnOwnLine = hasComment(node.consequent, CommentCheckFlags.Trailing | CommentCheckFlags.Line) || needsHardlineAfterDanglingComment(node);
49309           const elseOnSameLine = node.consequent.type === "BlockStatement" && !commentOnOwnLine;
49310           parts.push(elseOnSameLine ? " " : hardline$g);
49311
49312           if (hasComment(node, CommentCheckFlags.Dangling)) {
49313             parts.push(printDanglingComments(path, options, true), commentOnOwnLine ? hardline$g : " ");
49314           }
49315
49316           parts.push("else", group$e(adjustClause(node.alternate, print("alternate"), node.alternate.type === "IfStatement")));
49317         }
49318
49319         return parts;
49320       }
49321
49322     case "ForStatement":
49323       {
49324         const body = adjustClause(node.body, print("body")); // We want to keep dangling comments above the loop to stay consistent.
49325         // Any comment positioned between the for statement and the parentheses
49326         // is going to be printed before the statement.
49327
49328         const dangling = printDanglingComments(path, options,
49329         /* sameLine */
49330         true);
49331         const printedComments = dangling ? [dangling, softline$a] : "";
49332
49333         if (!node.init && !node.test && !node.update) {
49334           return [printedComments, group$e(["for (;;)", body])];
49335         }
49336
49337         return [printedComments, group$e(["for (", group$e([indent$8([softline$a, print("init"), ";", line$e, print("test"), ";", line$e, print("update")]), softline$a]), ")", body])];
49338       }
49339
49340     case "WhileStatement":
49341       return group$e(["while (", group$e([indent$8([softline$a, print("test")]), softline$a]), ")", adjustClause(node.body, print("body"))]);
49342
49343     case "ForInStatement":
49344       return group$e(["for (", print("left"), " in ", print("right"), ")", adjustClause(node.body, print("body"))]);
49345
49346     case "ForOfStatement":
49347       return group$e(["for", node.await ? " await" : "", " (", print("left"), " of ", print("right"), ")", adjustClause(node.body, print("body"))]);
49348
49349     case "DoWhileStatement":
49350       {
49351         const clause = adjustClause(node.body, print("body"));
49352         const doBody = group$e(["do", clause]);
49353         parts = [doBody];
49354
49355         if (node.body.type === "BlockStatement") {
49356           parts.push(" ");
49357         } else {
49358           parts.push(hardline$g);
49359         }
49360
49361         parts.push("while (", group$e([indent$8([softline$a, print("test")]), softline$a]), ")", semi);
49362         return parts;
49363       }
49364
49365     case "DoExpression":
49366       return [node.async ? "async " : "", "do ", print("body")];
49367
49368     case "BreakStatement":
49369       parts.push("break");
49370
49371       if (node.label) {
49372         parts.push(" ", print("label"));
49373       }
49374
49375       parts.push(semi);
49376       return parts;
49377
49378     case "ContinueStatement":
49379       parts.push("continue");
49380
49381       if (node.label) {
49382         parts.push(" ", print("label"));
49383       }
49384
49385       parts.push(semi);
49386       return parts;
49387
49388     case "LabeledStatement":
49389       if (node.body.type === "EmptyStatement") {
49390         return [print("label"), ":;"];
49391       }
49392
49393       return [print("label"), ": ", print("body")];
49394
49395     case "TryStatement":
49396       return ["try ", print("block"), node.handler ? [" ", print("handler")] : "", node.finalizer ? [" finally ", print("finalizer")] : ""];
49397
49398     case "CatchClause":
49399       if (node.param) {
49400         const parameterHasComments = hasComment(node.param, comment => !isBlockComment(comment) || comment.leading && hasNewline$1(options.originalText, locEnd$e(comment)) || comment.trailing && hasNewline$1(options.originalText, locStart$f(comment), {
49401           backwards: true
49402         }));
49403         const param = print("param");
49404         return ["catch ", parameterHasComments ? ["(", indent$8([softline$a, param]), softline$a, ") "] : ["(", param, ") "], print("body")];
49405       }
49406
49407       return ["catch ", print("body")];
49408     // Note: ignoring n.lexical because it has no printing consequences.
49409
49410     case "SwitchStatement":
49411       return [group$e(["switch (", indent$8([softline$a, print("discriminant")]), softline$a, ")"]), " {", node.cases.length > 0 ? indent$8([hardline$g, join$c(hardline$g, path.map((casePath, index, cases) => {
49412         const caseNode = casePath.getValue();
49413         return [print(), index !== cases.length - 1 && isNextLineEmpty$4(caseNode, options) ? hardline$g : ""];
49414       }, "cases"))]) : "", hardline$g, "}"];
49415
49416     case "SwitchCase":
49417       {
49418         if (node.test) {
49419           parts.push("case ", print("test"), ":");
49420         } else {
49421           parts.push("default:");
49422         }
49423
49424         const consequent = node.consequent.filter(node => node.type !== "EmptyStatement");
49425
49426         if (consequent.length > 0) {
49427           const cons = printSwitchCaseConsequent(path, options, print);
49428           parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? [" ", cons] : indent$8([hardline$g, cons]));
49429         }
49430
49431         return parts;
49432       }
49433     // JSX extensions below.
49434
49435     case "DebuggerStatement":
49436       return ["debugger", semi];
49437
49438     case "ClassDeclaration":
49439     case "ClassExpression":
49440       return printClass(path, options, print);
49441
49442     case "ClassMethod":
49443     case "ClassPrivateMethod":
49444     case "MethodDefinition":
49445       return printClassMethod(path, options, print);
49446
49447     case "ClassProperty":
49448     case "PropertyDefinition":
49449     case "ClassPrivateProperty":
49450       return printClassProperty(path, options, print);
49451
49452     case "TemplateElement":
49453       return replaceTextEndOfLine$9(node.value.raw);
49454
49455     case "TemplateLiteral":
49456       return printTemplateLiteral(path, print, options);
49457
49458     case "TaggedTemplateExpression":
49459       return [print("tag"), print("typeParameters"), print("quasi")];
49460
49461     case "PrivateIdentifier":
49462       return ["#", print("name")];
49463
49464     case "PrivateName":
49465       return ["#", print("id")];
49466
49467     case "InterpreterDirective":
49468       parts.push("#!", node.value, hardline$g);
49469
49470       if (isNextLineEmpty$4(node, options)) {
49471         parts.push(hardline$g);
49472       }
49473
49474       return parts;
49475     // For hack-style pipeline
49476
49477     case "TopicReference":
49478       return "%";
49479
49480     case "ArgumentPlaceholder":
49481       return "?";
49482
49483     case "ModuleExpression":
49484       {
49485         parts.push("module {");
49486         const printed = print("body");
49487
49488         if (printed) {
49489           parts.push(indent$8([hardline$g, printed]), hardline$g);
49490         }
49491
49492         parts.push("}");
49493         return parts;
49494       }
49495
49496     default:
49497       /* istanbul ignore next */
49498       throw new Error("unknown type: " + JSON.stringify(node.type));
49499   }
49500 }
49501
49502 function printDirective(node, options) {
49503   const raw = rawText(node);
49504   const rawContent = raw.slice(1, -1); // Check for the alternate quote, to determine if we're allowed to swap
49505   // the quotes on a DirectiveLiteral.
49506
49507   if (rawContent.includes('"') || rawContent.includes("'")) {
49508     return raw;
49509   }
49510
49511   const enclosingQuote = options.singleQuote ? "'" : '"'; // Directives are exact code unit sequences, which means that you can't
49512   // change the escape sequences they use.
49513   // See https://github.com/prettier/prettier/issues/1555
49514   // and https://tc39.github.io/ecma262/#directive-prologue
49515
49516   return enclosingQuote + rawContent + enclosingQuote;
49517 }
49518
49519 function canAttachComment$1(node) {
49520   return node.type && !isBlockComment(node) && !isLineComment(node) && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && // `babel-ts` don't have similar node for `class Foo { bar() /* bat */; }`
49521   node.type !== "TSEmptyBodyFunctionExpression";
49522 }
49523
49524 var printerEstree = {
49525   preprocess: preprocess$7,
49526   print: genericPrint$6,
49527   embed: embed$9,
49528   insertPragma: insertPragma$9,
49529   massageAstNode: clean$b,
49530
49531   hasPrettierIgnore(path) {
49532     return hasIgnoreComment(path) || hasJsxIgnoreComment(path);
49533   },
49534
49535   willPrintOwnComments: handleComments.willPrintOwnComments,
49536   canAttachComment: canAttachComment$1,
49537   printComment: printComment$1,
49538   isBlockComment,
49539   handleComments: {
49540     // TODO: Make this as default behavior
49541     avoidAstMutation: true,
49542     ownLine: handleComments.handleOwnLineComment,
49543     endOfLine: handleComments.handleEndOfLineComment,
49544     remaining: handleComments.handleRemainingComment
49545   },
49546   getCommentChildNodes: handleComments.getCommentChildNodes
49547 };
49548
49549 const {
49550   builders: {
49551     hardline: hardline$f,
49552     indent: indent$7,
49553     join: join$b
49554   }
49555 } = require$$7$3;
49556 const preprocess$6 = printPreprocess$3;
49557
49558 function genericPrint$5(path, options, print) {
49559   const node = path.getValue();
49560
49561   switch (node.type) {
49562     case "JsonRoot":
49563       return [print("node"), hardline$f];
49564
49565     case "ArrayExpression":
49566       {
49567         if (node.elements.length === 0) {
49568           return "[]";
49569         }
49570
49571         const printed = path.map(() => path.getValue() === null ? "null" : print(), "elements");
49572         return ["[", indent$7([hardline$f, join$b([",", hardline$f], printed)]), hardline$f, "]"];
49573       }
49574
49575     case "ObjectExpression":
49576       return node.properties.length === 0 ? "{}" : ["{", indent$7([hardline$f, join$b([",", hardline$f], path.map(print, "properties"))]), hardline$f, "}"];
49577
49578     case "ObjectProperty":
49579       return [print("key"), ": ", print("value")];
49580
49581     case "UnaryExpression":
49582       return [node.operator === "+" ? "" : node.operator, print("argument")];
49583
49584     case "NullLiteral":
49585       return "null";
49586
49587     case "BooleanLiteral":
49588       return node.value ? "true" : "false";
49589
49590     case "StringLiteral":
49591     case "NumericLiteral":
49592       return JSON.stringify(node.value);
49593
49594     case "Identifier":
49595       {
49596         const parent = path.getParentNode();
49597
49598         if (parent && parent.type === "ObjectProperty" && parent.key === node) {
49599           return JSON.stringify(node.name);
49600         }
49601
49602         return node.name;
49603       }
49604
49605     case "TemplateLiteral":
49606       // There is only one `TemplateElement`
49607       return print(["quasis", 0]);
49608
49609     case "TemplateElement":
49610       return JSON.stringify(node.value.cooked);
49611
49612     default:
49613       /* istanbul ignore next */
49614       throw new Error("unknown type: " + JSON.stringify(node.type));
49615   }
49616 }
49617
49618 const ignoredProperties$3 = new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
49619
49620 function clean$a(node, newNode
49621 /*, parent*/
49622 ) {
49623   const {
49624     type
49625   } = node; // We print quoted key
49626
49627   if (type === "ObjectProperty" && node.key.type === "Identifier") {
49628     newNode.key = {
49629       type: "StringLiteral",
49630       value: node.key.name
49631     };
49632     return;
49633   }
49634
49635   if (type === "UnaryExpression" && node.operator === "+") {
49636     return newNode.argument;
49637   } // We print holes in array as `null`
49638
49639
49640   if (type === "ArrayExpression") {
49641     for (const [index, element] of node.elements.entries()) {
49642       if (element === null) {
49643         newNode.elements.splice(index, 0, {
49644           type: "NullLiteral"
49645         });
49646       }
49647     }
49648
49649     return;
49650   } // We print `TemplateLiteral` as string
49651
49652
49653   if (type === "TemplateLiteral") {
49654     return {
49655       type: "StringLiteral",
49656       value: node.quasis[0].value.cooked
49657     };
49658   }
49659 }
49660
49661 clean$a.ignoredProperties = ignoredProperties$3;
49662 var printerEstreeJson = {
49663   preprocess: preprocess$6,
49664   print: genericPrint$5,
49665   massageAstNode: clean$a
49666 };
49667
49668 const CATEGORY_COMMON = "Common"; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
49669
49670 var commonOptions$6 = {
49671   bracketSpacing: {
49672     since: "0.0.0",
49673     category: CATEGORY_COMMON,
49674     type: "boolean",
49675     default: true,
49676     description: "Print spaces between brackets.",
49677     oppositeDescription: "Do not print spaces between brackets."
49678   },
49679   singleQuote: {
49680     since: "0.0.0",
49681     category: CATEGORY_COMMON,
49682     type: "boolean",
49683     default: false,
49684     description: "Use single quotes instead of double quotes."
49685   },
49686   proseWrap: {
49687     since: "1.8.2",
49688     category: CATEGORY_COMMON,
49689     type: "choice",
49690     default: [{
49691       since: "1.8.2",
49692       value: true
49693     }, {
49694       since: "1.9.0",
49695       value: "preserve"
49696     }],
49697     description: "How to wrap prose.",
49698     choices: [{
49699       since: "1.9.0",
49700       value: "always",
49701       description: "Wrap prose if it exceeds the print width."
49702     }, {
49703       since: "1.9.0",
49704       value: "never",
49705       description: "Do not wrap prose."
49706     }, {
49707       since: "1.9.0",
49708       value: "preserve",
49709       description: "Wrap prose as-is."
49710     }]
49711   },
49712   bracketSameLine: {
49713     since: "2.4.0",
49714     category: CATEGORY_COMMON,
49715     type: "boolean",
49716     default: false,
49717     description: "Put > of opening tags on the last line instead of on a new line."
49718   }
49719 };
49720
49721 const commonOptions$5 = commonOptions$6;
49722 const CATEGORY_JAVASCRIPT = "JavaScript"; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
49723
49724 var options$b = {
49725   arrowParens: {
49726     since: "1.9.0",
49727     category: CATEGORY_JAVASCRIPT,
49728     type: "choice",
49729     default: [{
49730       since: "1.9.0",
49731       value: "avoid"
49732     }, {
49733       since: "2.0.0",
49734       value: "always"
49735     }],
49736     description: "Include parentheses around a sole arrow function parameter.",
49737     choices: [{
49738       value: "always",
49739       description: "Always include parens. Example: `(x) => x`"
49740     }, {
49741       value: "avoid",
49742       description: "Omit parens when possible. Example: `x => x`"
49743     }]
49744   },
49745   bracketSameLine: commonOptions$5.bracketSameLine,
49746   bracketSpacing: commonOptions$5.bracketSpacing,
49747   jsxBracketSameLine: {
49748     since: "0.17.0",
49749     category: CATEGORY_JAVASCRIPT,
49750     type: "boolean",
49751     description: "Put > on the last line instead of at a new line.",
49752     deprecated: "2.4.0"
49753   },
49754   semi: {
49755     since: "1.0.0",
49756     category: CATEGORY_JAVASCRIPT,
49757     type: "boolean",
49758     default: true,
49759     description: "Print semicolons.",
49760     oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
49761   },
49762   singleQuote: commonOptions$5.singleQuote,
49763   jsxSingleQuote: {
49764     since: "1.15.0",
49765     category: CATEGORY_JAVASCRIPT,
49766     type: "boolean",
49767     default: false,
49768     description: "Use single quotes in JSX."
49769   },
49770   quoteProps: {
49771     since: "1.17.0",
49772     category: CATEGORY_JAVASCRIPT,
49773     type: "choice",
49774     default: "as-needed",
49775     description: "Change when properties in objects are quoted.",
49776     choices: [{
49777       value: "as-needed",
49778       description: "Only add quotes around object properties where required."
49779     }, {
49780       value: "consistent",
49781       description: "If at least one property in an object requires quotes, quote all properties."
49782     }, {
49783       value: "preserve",
49784       description: "Respect the input use of quotes in object properties."
49785     }]
49786   },
49787   trailingComma: {
49788     since: "0.0.0",
49789     category: CATEGORY_JAVASCRIPT,
49790     type: "choice",
49791     default: [{
49792       since: "0.0.0",
49793       value: false
49794     }, {
49795       since: "0.19.0",
49796       value: "none"
49797     }, {
49798       since: "2.0.0",
49799       value: "es5"
49800     }],
49801     description: "Print trailing commas wherever possible when multi-line.",
49802     choices: [{
49803       value: "es5",
49804       description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
49805     }, {
49806       value: "none",
49807       description: "No trailing commas."
49808     }, {
49809       value: "all",
49810       description: "Trailing commas wherever possible (including function arguments)."
49811     }]
49812   }
49813 };
49814
49815 var require$$0$2 = require("./parser-babel.js");
49816
49817 var require$$1$1 = require("./parser-flow.js");
49818
49819 var require$$2$1 = require("./parser-typescript.js");
49820
49821 var require$$3$1 = require("./parser-angular.js");
49822
49823 var require$$4$6 = require("./parser-espree.js");
49824
49825 var require$$5$3 = require("./parser-meriyah.js");
49826
49827 var parsers$d = {
49828   // JS - Babel
49829   get babel() {
49830     return require$$0$2.parsers.babel;
49831   },
49832
49833   get "babel-flow"() {
49834     return require$$0$2.parsers["babel-flow"];
49835   },
49836
49837   get "babel-ts"() {
49838     return require$$0$2.parsers["babel-ts"];
49839   },
49840
49841   get json() {
49842     return require$$0$2.parsers.json;
49843   },
49844
49845   get json5() {
49846     return require$$0$2.parsers.json5;
49847   },
49848
49849   get "json-stringify"() {
49850     return require$$0$2.parsers["json-stringify"];
49851   },
49852
49853   get __js_expression() {
49854     return require$$0$2.parsers.__js_expression;
49855   },
49856
49857   get __vue_expression() {
49858     return require$$0$2.parsers.__vue_expression;
49859   },
49860
49861   get __vue_event_binding() {
49862     return require$$0$2.parsers.__vue_event_binding;
49863   },
49864
49865   // JS - Flow
49866   get flow() {
49867     return require$$1$1.parsers.flow;
49868   },
49869
49870   // JS - TypeScript
49871   get typescript() {
49872     return require$$2$1.parsers.typescript;
49873   },
49874
49875   // JS - Angular Action
49876   get __ng_action() {
49877     return require$$3$1.parsers.__ng_action;
49878   },
49879
49880   // JS - Angular Binding
49881   get __ng_binding() {
49882     return require$$3$1.parsers.__ng_binding;
49883   },
49884
49885   // JS - Angular Interpolation
49886   get __ng_interpolation() {
49887     return require$$3$1.parsers.__ng_interpolation;
49888   },
49889
49890   // JS - Angular Directive
49891   get __ng_directive() {
49892     return require$$3$1.parsers.__ng_directive;
49893   },
49894
49895   // JS - espree
49896   get espree() {
49897     return require$$4$6.parsers.espree;
49898   },
49899
49900   // JS - meriyah
49901   get meriyah() {
49902     return require$$5$3.parsers.meriyah;
49903   },
49904
49905   // JS - Babel Estree
49906   get __babel_estree() {
49907     return require$$0$2.parsers.__babel_estree;
49908   }
49909
49910 };
49911
49912 var name$f = "JavaScript";
49913 var type$f = "programming";
49914 var tmScope$f = "source.js";
49915 var aceMode$f = "javascript";
49916 var codemirrorMode$b = "javascript";
49917 var codemirrorMimeType$b = "text/javascript";
49918 var color$a = "#f1e05a";
49919 var aliases$6 = [
49920         "js",
49921         "node"
49922 ];
49923 var extensions$f = [
49924         ".js",
49925         "._js",
49926         ".bones",
49927         ".cjs",
49928         ".es",
49929         ".es6",
49930         ".frag",
49931         ".gs",
49932         ".jake",
49933         ".jsb",
49934         ".jscad",
49935         ".jsfl",
49936         ".jsm",
49937         ".jss",
49938         ".jsx",
49939         ".mjs",
49940         ".njs",
49941         ".pac",
49942         ".sjs",
49943         ".ssjs",
49944         ".xsjs",
49945         ".xsjslib"
49946 ];
49947 var filenames$4 = [
49948         "Jakefile"
49949 ];
49950 var interpreters$1 = [
49951         "chakra",
49952         "d8",
49953         "gjs",
49954         "js",
49955         "node",
49956         "nodejs",
49957         "qjs",
49958         "rhino",
49959         "v8",
49960         "v8-shell"
49961 ];
49962 var languageId$f = 183;
49963 var require$$5$2 = {
49964         name: name$f,
49965         type: type$f,
49966         tmScope: tmScope$f,
49967         aceMode: aceMode$f,
49968         codemirrorMode: codemirrorMode$b,
49969         codemirrorMimeType: codemirrorMimeType$b,
49970         color: color$a,
49971         aliases: aliases$6,
49972         extensions: extensions$f,
49973         filenames: filenames$4,
49974         interpreters: interpreters$1,
49975         languageId: languageId$f
49976 };
49977
49978 var name$e = "TypeScript";
49979 var type$e = "programming";
49980 var color$9 = "#2b7489";
49981 var aliases$5 = [
49982         "ts"
49983 ];
49984 var interpreters = [
49985         "deno",
49986         "ts-node"
49987 ];
49988 var extensions$e = [
49989         ".ts"
49990 ];
49991 var tmScope$e = "source.ts";
49992 var aceMode$e = "typescript";
49993 var codemirrorMode$a = "javascript";
49994 var codemirrorMimeType$a = "application/typescript";
49995 var languageId$e = 378;
49996 var require$$6$1 = {
49997         name: name$e,
49998         type: type$e,
49999         color: color$9,
50000         aliases: aliases$5,
50001         interpreters: interpreters,
50002         extensions: extensions$e,
50003         tmScope: tmScope$e,
50004         aceMode: aceMode$e,
50005         codemirrorMode: codemirrorMode$a,
50006         codemirrorMimeType: codemirrorMimeType$a,
50007         languageId: languageId$e
50008 };
50009
50010 var name$d = "TSX";
50011 var type$d = "programming";
50012 var group$d = "TypeScript";
50013 var extensions$d = [
50014         ".tsx"
50015 ];
50016 var tmScope$d = "source.tsx";
50017 var aceMode$d = "javascript";
50018 var codemirrorMode$9 = "jsx";
50019 var codemirrorMimeType$9 = "text/jsx";
50020 var languageId$d = 94901924;
50021 var require$$7$1 = {
50022         name: name$d,
50023         type: type$d,
50024         group: group$d,
50025         extensions: extensions$d,
50026         tmScope: tmScope$d,
50027         aceMode: aceMode$d,
50028         codemirrorMode: codemirrorMode$9,
50029         codemirrorMimeType: codemirrorMimeType$9,
50030         languageId: languageId$d
50031 };
50032
50033 var name$c = "JSON";
50034 var type$c = "data";
50035 var tmScope$c = "source.json";
50036 var aceMode$c = "json";
50037 var codemirrorMode$8 = "javascript";
50038 var codemirrorMimeType$8 = "application/json";
50039 var extensions$c = [
50040         ".json",
50041         ".avsc",
50042         ".geojson",
50043         ".gltf",
50044         ".har",
50045         ".ice",
50046         ".JSON-tmLanguage",
50047         ".jsonl",
50048         ".mcmeta",
50049         ".tfstate",
50050         ".tfstate.backup",
50051         ".topojson",
50052         ".webapp",
50053         ".webmanifest",
50054         ".yy",
50055         ".yyp"
50056 ];
50057 var filenames$3 = [
50058         ".arcconfig",
50059         ".htmlhintrc",
50060         ".imgbotconfig",
50061         ".tern-config",
50062         ".tern-project",
50063         ".watchmanconfig",
50064         "Pipfile.lock",
50065         "composer.lock",
50066         "mcmod.info"
50067 ];
50068 var languageId$c = 174;
50069 var require$$8 = {
50070         name: name$c,
50071         type: type$c,
50072         tmScope: tmScope$c,
50073         aceMode: aceMode$c,
50074         codemirrorMode: codemirrorMode$8,
50075         codemirrorMimeType: codemirrorMimeType$8,
50076         extensions: extensions$c,
50077         filenames: filenames$3,
50078         languageId: languageId$c
50079 };
50080
50081 var name$b = "JSON with Comments";
50082 var type$b = "data";
50083 var group$c = "JSON";
50084 var tmScope$b = "source.js";
50085 var aceMode$b = "javascript";
50086 var codemirrorMode$7 = "javascript";
50087 var codemirrorMimeType$7 = "text/javascript";
50088 var aliases$4 = [
50089         "jsonc"
50090 ];
50091 var extensions$b = [
50092         ".jsonc",
50093         ".sublime-build",
50094         ".sublime-commands",
50095         ".sublime-completions",
50096         ".sublime-keymap",
50097         ".sublime-macro",
50098         ".sublime-menu",
50099         ".sublime-mousemap",
50100         ".sublime-project",
50101         ".sublime-settings",
50102         ".sublime-theme",
50103         ".sublime-workspace",
50104         ".sublime_metrics",
50105         ".sublime_session"
50106 ];
50107 var filenames$2 = [
50108         ".babelrc",
50109         ".eslintrc.json",
50110         ".jscsrc",
50111         ".jshintrc",
50112         ".jslintrc",
50113         "api-extractor.json",
50114         "devcontainer.json",
50115         "jsconfig.json",
50116         "language-configuration.json",
50117         "tsconfig.json",
50118         "tslint.json"
50119 ];
50120 var languageId$b = 423;
50121 var require$$9 = {
50122         name: name$b,
50123         type: type$b,
50124         group: group$c,
50125         tmScope: tmScope$b,
50126         aceMode: aceMode$b,
50127         codemirrorMode: codemirrorMode$7,
50128         codemirrorMimeType: codemirrorMimeType$7,
50129         aliases: aliases$4,
50130         extensions: extensions$b,
50131         filenames: filenames$2,
50132         languageId: languageId$b
50133 };
50134
50135 var name$a = "JSON5";
50136 var type$a = "data";
50137 var extensions$a = [
50138         ".json5"
50139 ];
50140 var tmScope$a = "source.js";
50141 var aceMode$a = "javascript";
50142 var codemirrorMode$6 = "javascript";
50143 var codemirrorMimeType$6 = "application/json";
50144 var languageId$a = 175;
50145 var require$$10 = {
50146         name: name$a,
50147         type: type$a,
50148         extensions: extensions$a,
50149         tmScope: tmScope$a,
50150         aceMode: aceMode$a,
50151         codemirrorMode: codemirrorMode$6,
50152         codemirrorMimeType: codemirrorMimeType$6,
50153         languageId: languageId$a
50154 };
50155
50156 const createLanguage$6 = createLanguage$7;
50157 const estreePrinter = printerEstree;
50158 const estreeJsonPrinter = printerEstreeJson;
50159 const options$a = options$b;
50160 const parsers$c = parsers$d;
50161 const languages$7 = [createLanguage$6(require$$5$2, data => ({
50162   since: "0.0.0",
50163   parsers: ["babel", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"],
50164   vscodeLanguageIds: ["javascript", "mongo"],
50165   interpreters: [...data.interpreters, // https://github.com/google/zx
50166   "zx"],
50167   extensions: [...data.extensions.filter(extension => extension !== ".jsx"), // WeiXin Script (Weixin Mini Programs)
50168   // https://developers.weixin.qq.com/miniprogram/en/dev/framework/view/wxs/
50169   ".wxs"]
50170 })), createLanguage$6(require$$5$2, () => ({
50171   name: "Flow",
50172   since: "0.0.0",
50173   parsers: ["flow", "babel-flow"],
50174   vscodeLanguageIds: ["javascript"],
50175   aliases: [],
50176   filenames: [],
50177   extensions: [".js.flow"]
50178 })), createLanguage$6(require$$5$2, () => ({
50179   name: "JSX",
50180   since: "0.0.0",
50181   parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"],
50182   vscodeLanguageIds: ["javascriptreact"],
50183   aliases: undefined,
50184   filenames: undefined,
50185   extensions: [".jsx"],
50186   group: "JavaScript",
50187   interpreters: undefined,
50188   tmScope: "source.js.jsx",
50189   aceMode: "javascript",
50190   codemirrorMode: "jsx",
50191   codemirrorMimeType: "text/jsx",
50192   color: undefined
50193 })), createLanguage$6(require$$6$1, data => ({
50194   since: "1.4.0",
50195   parsers: ["typescript", "babel-ts"],
50196   vscodeLanguageIds: ["typescript"],
50197   extensions: [...data.extensions, ".mts", ".cts"]
50198 })), createLanguage$6(require$$7$1, () => ({
50199   since: "1.4.0",
50200   parsers: ["typescript", "babel-ts"],
50201   vscodeLanguageIds: ["typescriptreact"]
50202 })), createLanguage$6(require$$8, () => ({
50203   name: "JSON.stringify",
50204   since: "1.13.0",
50205   parsers: ["json-stringify"],
50206   vscodeLanguageIds: ["json"],
50207   extensions: [],
50208   // .json file defaults to json instead of json-stringify
50209   filenames: ["package.json", "package-lock.json", "composer.json"]
50210 })), createLanguage$6(require$$8, data => ({
50211   since: "1.5.0",
50212   parsers: ["json"],
50213   vscodeLanguageIds: ["json"],
50214   extensions: data.extensions.filter(extension => extension !== ".jsonl")
50215 })), createLanguage$6(require$$9, data => ({
50216   since: "1.5.0",
50217   parsers: ["json"],
50218   vscodeLanguageIds: ["jsonc"],
50219   filenames: [...data.filenames, ".eslintrc"]
50220 })), createLanguage$6(require$$10, () => ({
50221   since: "1.13.0",
50222   parsers: ["json5"],
50223   vscodeLanguageIds: ["json5"]
50224 }))];
50225 const printers$5 = {
50226   estree: estreePrinter,
50227   "estree-json": estreeJsonPrinter
50228 };
50229 var languageJs = {
50230   languages: languages$7,
50231   options: options$a,
50232   printers: printers$5,
50233   parsers: parsers$c
50234 };
50235
50236 const {
50237   isFrontMatterNode: isFrontMatterNode$4
50238 } = util$8;
50239 const getLast$9 = getLast_1;
50240 const ignoredProperties$2 = new Set(["raw", // front-matter
50241 "raws", "sourceIndex", "source", "before", "after", "trailingComma"]);
50242
50243 function clean$9(ast, newObj, parent) {
50244   if (isFrontMatterNode$4(ast) && ast.lang === "yaml") {
50245     delete newObj.value;
50246   }
50247
50248   if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length > 0) {
50249     // --insert-pragma
50250     // first non-front-matter comment
50251     if (parent.nodes[0] === ast || isFrontMatterNode$4(parent.nodes[0]) && parent.nodes[1] === ast) {
50252       /**
50253        * something
50254        *
50255        * @format
50256        */
50257       delete newObj.text; // standalone pragma
50258
50259       if (/^\*\s*@(?:format|prettier)\s*$/.test(ast.text)) {
50260         return null;
50261       }
50262     } // Last comment is not parsed, when omitting semicolon, #8675
50263
50264
50265     if (parent.type === "css-root" && getLast$9(parent.nodes) === ast) {
50266       return null;
50267     }
50268   }
50269
50270   if (ast.type === "value-root") {
50271     delete newObj.text;
50272   }
50273
50274   if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
50275     delete newObj.value;
50276   }
50277
50278   if (ast.type === "css-rule") {
50279     delete newObj.params;
50280   }
50281
50282   if (ast.type === "selector-combinator") {
50283     newObj.value = newObj.value.replace(/\s+/g, " ");
50284   }
50285
50286   if (ast.type === "media-feature") {
50287     newObj.value = newObj.value.replace(/ /g, "");
50288   }
50289
50290   if (ast.type === "value-word" && (ast.isColor && ast.isHex || ["initial", "inherit", "unset", "revert"].includes(newObj.value.replace().toLowerCase())) || ast.type === "media-feature" || ast.type === "selector-root-invalid" || ast.type === "selector-pseudo") {
50291     newObj.value = newObj.value.toLowerCase();
50292   }
50293
50294   if (ast.type === "css-decl") {
50295     newObj.prop = newObj.prop.toLowerCase();
50296   }
50297
50298   if (ast.type === "css-atrule" || ast.type === "css-import") {
50299     newObj.name = newObj.name.toLowerCase();
50300   }
50301
50302   if (ast.type === "value-number") {
50303     newObj.unit = newObj.unit.toLowerCase();
50304   }
50305
50306   if ((ast.type === "media-feature" || ast.type === "media-keyword" || ast.type === "media-type" || ast.type === "media-unknown" || ast.type === "media-url" || ast.type === "media-value" || ast.type === "selector-attribute" || ast.type === "selector-string" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "value-string") && newObj.value) {
50307     newObj.value = cleanCSSStrings(newObj.value);
50308   }
50309
50310   if (ast.type === "selector-attribute") {
50311     newObj.attribute = newObj.attribute.trim();
50312
50313     if (newObj.namespace) {
50314       if (typeof newObj.namespace === "string") {
50315         newObj.namespace = newObj.namespace.trim();
50316
50317         if (newObj.namespace.length === 0) {
50318           newObj.namespace = true;
50319         }
50320       }
50321     }
50322
50323     if (newObj.value) {
50324       newObj.value = newObj.value.trim().replace(/^["']|["']$/g, "");
50325       delete newObj.quoted;
50326     }
50327   }
50328
50329   if ((ast.type === "media-value" || ast.type === "media-type" || ast.type === "value-number" || ast.type === "selector-root-invalid" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "selector-tag") && newObj.value) {
50330     newObj.value = newObj.value.replace(/([\d+.Ee-]+)([A-Za-z]*)/g, (match, numStr, unit) => {
50331       const num = Number(numStr);
50332       return Number.isNaN(num) ? match : num + unit.toLowerCase();
50333     });
50334   }
50335
50336   if (ast.type === "selector-tag") {
50337     const lowercasedValue = ast.value.toLowerCase();
50338
50339     if (["from", "to"].includes(lowercasedValue)) {
50340       newObj.value = lowercasedValue;
50341     }
50342   } // Workaround when `postcss-values-parser` parse `not`, `and` or `or` keywords as `value-func`
50343
50344
50345   if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
50346     delete newObj.value;
50347   } // Workaround for SCSS nested properties
50348
50349
50350   if (ast.type === "selector-unknown") {
50351     delete newObj.value;
50352   }
50353 }
50354
50355 clean$9.ignoredProperties = ignoredProperties$2;
50356
50357 function cleanCSSStrings(value) {
50358   return value.replace(/'/g, '"').replace(/\\([^\dA-Fa-f])/g, "$1");
50359 }
50360
50361 var clean_1$3 = clean$9;
50362
50363 const {
50364   builders: {
50365     hardline: hardline$e,
50366     markAsRoot: markAsRoot$3
50367   }
50368 } = require$$7$3;
50369
50370 function print$1(node, textToDoc) {
50371   if (node.lang === "yaml") {
50372     const value = node.value.trim();
50373     const doc = value ? textToDoc(value, {
50374       parser: "yaml"
50375     }, {
50376       stripTrailingHardline: true
50377     }) : "";
50378     return markAsRoot$3([node.startDelimiter, hardline$e, doc, doc ? hardline$e : "", node.endDelimiter]);
50379   }
50380 }
50381
50382 var print_1 = print$1;
50383
50384 const {
50385   builders: {
50386     hardline: hardline$d
50387   }
50388 } = require$$7$3;
50389 const printFrontMatter$2 = print_1;
50390
50391 function embed$8(path, print, textToDoc
50392 /*, options */
50393 ) {
50394   const node = path.getValue();
50395
50396   if (node.type === "front-matter") {
50397     const doc = printFrontMatter$2(node, textToDoc);
50398     return doc ? [doc, hardline$d] : "";
50399   }
50400 }
50401
50402 var embed_1$3 = embed$8;
50403
50404 const frontMatterRegex = new RegExp("^(?<startDelimiter>-{3}|\\+{3})" + // trailing spaces after delimiters are allowed
50405 "(?<language>[^\\n]*)" + "\\n(?:|(?<value>.*?)\\n)" + // In some markdown processors such as pandoc,
50406 // "..." can be used as the end delimiter for YAML front-matter.
50407 // Adding `\.{3}` make the regex matches `+++\n...`, but we'll exclude it later
50408 "(?<endDelimiter>\\k<startDelimiter>|\\.{3})" + "[^\\S\\n]*(?:\\n|$)", "s");
50409
50410 function parse(text) {
50411   const match = text.match(frontMatterRegex);
50412
50413   if (!match) {
50414     return {
50415       content: text
50416     };
50417   }
50418
50419   const {
50420     startDelimiter,
50421     language,
50422     value = "",
50423     endDelimiter
50424   } = match.groups;
50425   let lang = language.trim() || "yaml";
50426
50427   if (startDelimiter === "+++") {
50428     lang = "toml";
50429   } // Only allow yaml to parse with a different end delimiter
50430
50431
50432   if (lang !== "yaml" && startDelimiter !== endDelimiter) {
50433     return {
50434       content: text
50435     };
50436   }
50437
50438   const [raw] = match;
50439   const frontMatter = {
50440     type: "front-matter",
50441     lang,
50442     value,
50443     startDelimiter,
50444     endDelimiter,
50445     raw: raw.replace(/\n$/, "")
50446   };
50447   return {
50448     frontMatter,
50449     content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
50450   };
50451 }
50452
50453 var parse_1 = parse;
50454
50455 const jsPragma = pragma$5;
50456 const parseFrontMatter$1 = parse_1;
50457
50458 function hasPragma$3(text) {
50459   return jsPragma.hasPragma(parseFrontMatter$1(text).content);
50460 }
50461
50462 function insertPragma$8(text) {
50463   const {
50464     frontMatter,
50465     content
50466   } = parseFrontMatter$1(text);
50467   return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content);
50468 }
50469
50470 var pragma$4 = {
50471   hasPragma: hasPragma$3,
50472   insertPragma: insertPragma$8
50473 };
50474
50475 const {
50476   isNonEmptyArray: isNonEmptyArray$6
50477 } = util$8;
50478 const colorAdjusterFunctions = new Set(["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"]);
50479 const moduleRuleNames = new Set(["import", "use", "forward"]);
50480
50481 function getAncestorCounter$1(path, typeOrTypes) {
50482   const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
50483   let counter = -1;
50484   let ancestorNode;
50485
50486   while (ancestorNode = path.getParentNode(++counter)) {
50487     if (types.includes(ancestorNode.type)) {
50488       return counter;
50489     }
50490   }
50491
50492   return -1;
50493 }
50494
50495 function getAncestorNode$2(path, typeOrTypes) {
50496   const counter = getAncestorCounter$1(path, typeOrTypes);
50497   return counter === -1 ? null : path.getParentNode(counter);
50498 }
50499
50500 function getPropOfDeclNode$1(path) {
50501   const declAncestorNode = getAncestorNode$2(path, "css-decl");
50502   return declAncestorNode && declAncestorNode.prop && declAncestorNode.prop.toLowerCase();
50503 }
50504
50505 function hasSCSSInterpolation(groupList) {
50506   if (isNonEmptyArray$6(groupList)) {
50507     for (let i = groupList.length - 1; i > 0; i--) {
50508       // If we find `#{`, return true.
50509       if (groupList[i].type === "word" && groupList[i].value === "{" && groupList[i - 1].type === "word" && groupList[i - 1].value.endsWith("#")) {
50510         return true;
50511       }
50512     }
50513   }
50514
50515   return false;
50516 }
50517
50518 function hasStringOrFunction(groupList) {
50519   if (isNonEmptyArray$6(groupList)) {
50520     for (let i = 0; i < groupList.length; i++) {
50521       if (groupList[i].type === "string" || groupList[i].type === "func") {
50522         return true;
50523       }
50524     }
50525   }
50526
50527   return false;
50528 }
50529
50530 function isSCSS$1(parser, text) {
50531   const hasExplicitParserChoice = parser === "less" || parser === "scss";
50532   const IS_POSSIBLY_SCSS = /(?:\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
50533   return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
50534 }
50535
50536 function isSCSSVariable(node) {
50537   return Boolean(node && node.type === "word" && node.value.startsWith("$"));
50538 }
50539
50540 function isWideKeywords$1(value) {
50541   return ["initial", "inherit", "unset", "revert"].includes(value.toLowerCase());
50542 }
50543
50544 function isKeyframeAtRuleKeywords$1(path, value) {
50545   const atRuleAncestorNode = getAncestorNode$2(path, "css-atrule");
50546   return atRuleAncestorNode && atRuleAncestorNode.name && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
50547 }
50548
50549 function maybeToLowerCase$1(value) {
50550   return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
50551 }
50552
50553 function insideValueFunctionNode$1(path, functionName) {
50554   const funcAncestorNode = getAncestorNode$2(path, "value-func");
50555   return funcAncestorNode && funcAncestorNode.value && funcAncestorNode.value.toLowerCase() === functionName;
50556 }
50557
50558 function insideICSSRuleNode$1(path) {
50559   const ruleAncestorNode = getAncestorNode$2(path, "css-rule");
50560   return ruleAncestorNode && ruleAncestorNode.raws && ruleAncestorNode.raws.selector && (ruleAncestorNode.raws.selector.startsWith(":import") || ruleAncestorNode.raws.selector.startsWith(":export"));
50561 }
50562
50563 function insideAtRuleNode$1(path, atRuleNameOrAtRuleNames) {
50564   const atRuleNames = Array.isArray(atRuleNameOrAtRuleNames) ? atRuleNameOrAtRuleNames : [atRuleNameOrAtRuleNames];
50565   const atRuleAncestorNode = getAncestorNode$2(path, "css-atrule");
50566   return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
50567 }
50568
50569 function insideURLFunctionInImportAtRuleNode$1(path) {
50570   const node = path.getValue();
50571   const atRuleAncestorNode = getAncestorNode$2(path, "css-atrule");
50572   return atRuleAncestorNode && atRuleAncestorNode.name === "import" && node.groups[0].value === "url" && node.groups.length === 2;
50573 }
50574
50575 function isURLFunctionNode$1(node) {
50576   return node.type === "value-func" && node.value.toLowerCase() === "url";
50577 }
50578
50579 function isLastNode$1(path, node) {
50580   const parentNode = path.getParentNode();
50581   /* istanbul ignore next */
50582
50583   if (!parentNode) {
50584     return false;
50585   }
50586
50587   const {
50588     nodes
50589   } = parentNode;
50590   return nodes && nodes.indexOf(node) === nodes.length - 1;
50591 }
50592
50593 function isDetachedRulesetDeclarationNode$1(node) {
50594   // If a Less file ends up being parsed with the SCSS parser, Less
50595   // variable declarations will be parsed as atrules with names ending
50596   // with a colon, so keep the original case then.
50597
50598   /* istanbul ignore next */
50599   if (!node.selector) {
50600     return false;
50601   }
50602
50603   return typeof node.selector === "string" && /^@.+:.*$/.test(node.selector) || node.selector.value && /^@.+:.*$/.test(node.selector.value);
50604 }
50605
50606 function isForKeywordNode$1(node) {
50607   return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
50608 }
50609
50610 function isIfElseKeywordNode$1(node) {
50611   return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
50612 }
50613
50614 function isEachKeywordNode$1(node) {
50615   return node.type === "value-word" && node.value === "in";
50616 }
50617
50618 function isMultiplicationNode$1(node) {
50619   return node.type === "value-operator" && node.value === "*";
50620 }
50621
50622 function isDivisionNode$1(node) {
50623   return node.type === "value-operator" && node.value === "/";
50624 }
50625
50626 function isAdditionNode$1(node) {
50627   return node.type === "value-operator" && node.value === "+";
50628 }
50629
50630 function isSubtractionNode$1(node) {
50631   return node.type === "value-operator" && node.value === "-";
50632 }
50633
50634 function isModuloNode(node) {
50635   return node.type === "value-operator" && node.value === "%";
50636 }
50637
50638 function isMathOperatorNode$1(node) {
50639   return isMultiplicationNode$1(node) || isDivisionNode$1(node) || isAdditionNode$1(node) || isSubtractionNode$1(node) || isModuloNode(node);
50640 }
50641
50642 function isEqualityOperatorNode$1(node) {
50643   return node.type === "value-word" && ["==", "!="].includes(node.value);
50644 }
50645
50646 function isRelationalOperatorNode$1(node) {
50647   return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
50648 }
50649
50650 function isSCSSControlDirectiveNode$1(node) {
50651   return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
50652 }
50653
50654 function isSCSSNestedPropertyNode(node) {
50655   /* istanbul ignore next */
50656   if (!node.selector) {
50657     return false;
50658   }
50659
50660   return node.selector.replace(/\/\*.*?\*\//, "").replace(/\/\/.*?\n/, "").trim().endsWith(":");
50661 }
50662
50663 function isDetachedRulesetCallNode$1(node) {
50664   return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params);
50665 }
50666
50667 function isTemplatePlaceholderNode$1(node) {
50668   return node.name.startsWith("prettier-placeholder");
50669 }
50670
50671 function isTemplatePropNode$1(node) {
50672   return node.prop.startsWith("@prettier-placeholder");
50673 }
50674
50675 function isPostcssSimpleVarNode$1(currentNode, nextNode) {
50676   return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before;
50677 }
50678
50679 function hasComposesNode$1(node) {
50680   return node.value && node.value.type === "value-root" && node.value.group && node.value.group.type === "value-value" && node.prop.toLowerCase() === "composes";
50681 }
50682
50683 function hasParensAroundNode$1(node) {
50684   return node.value && node.value.group && node.value.group.group && node.value.group.group.type === "value-paren_group" && node.value.group.group.open !== null && node.value.group.group.close !== null;
50685 }
50686
50687 function hasEmptyRawBefore$1(node) {
50688   return node.raws && node.raws.before === "";
50689 }
50690
50691 function isKeyValuePairNode$1(node) {
50692   return node.type === "value-comma_group" && node.groups && node.groups[1] && node.groups[1].type === "value-colon";
50693 }
50694
50695 function isKeyValuePairInParenGroupNode(node) {
50696   return node.type === "value-paren_group" && node.groups && node.groups[0] && isKeyValuePairNode$1(node.groups[0]);
50697 }
50698
50699 function isSCSSMapItemNode$1(path) {
50700   const node = path.getValue(); // Ignore empty item (i.e. `$key: ()`)
50701
50702   if (node.groups.length === 0) {
50703     return false;
50704   }
50705
50706   const parentParentNode = path.getParentNode(1); // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`)
50707
50708   if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
50709     return false;
50710   }
50711
50712   const declNode = getAncestorNode$2(path, "css-decl"); // SCSS map declaration (i.e. `$map: (key: value, other-key: other-value)`)
50713
50714   if (declNode && declNode.prop && declNode.prop.startsWith("$")) {
50715     return true;
50716   } // List as value of key inside SCSS map (i.e. `$map: (key: (value other-value other-other-value))`)
50717
50718
50719   if (isKeyValuePairInParenGroupNode(parentParentNode)) {
50720     return true;
50721   } // SCSS Map is argument of function (i.e. `func((key: value, other-key: other-value))`)
50722
50723
50724   if (parentParentNode.type === "value-func") {
50725     return true;
50726   }
50727
50728   return false;
50729 }
50730
50731 function isInlineValueCommentNode$1(node) {
50732   return node.type === "value-comment" && node.inline;
50733 }
50734
50735 function isHashNode$1(node) {
50736   return node.type === "value-word" && node.value === "#";
50737 }
50738
50739 function isLeftCurlyBraceNode$1(node) {
50740   return node.type === "value-word" && node.value === "{";
50741 }
50742
50743 function isRightCurlyBraceNode$1(node) {
50744   return node.type === "value-word" && node.value === "}";
50745 }
50746
50747 function isWordNode$1(node) {
50748   return ["value-word", "value-atword"].includes(node.type);
50749 }
50750
50751 function isColonNode$1(node) {
50752   return node && node.type === "value-colon";
50753 }
50754
50755 function isKeyInValuePairNode$1(node, parentNode) {
50756   if (!isKeyValuePairNode$1(parentNode)) {
50757     return false;
50758   }
50759
50760   const {
50761     groups
50762   } = parentNode;
50763   const index = groups.indexOf(node);
50764
50765   if (index === -1) {
50766     return false;
50767   }
50768
50769   return isColonNode$1(groups[index + 1]);
50770 }
50771
50772 function isMediaAndSupportsKeywords$1(node) {
50773   return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
50774 }
50775
50776 function isColorAdjusterFuncNode$1(node) {
50777   if (node.type !== "value-func") {
50778     return false;
50779   }
50780
50781   return colorAdjusterFunctions.has(node.value.toLowerCase());
50782 } // TODO: only check `less` when we don't use `less` to parse `css`
50783
50784
50785 function isLessParser$1(options) {
50786   return options.parser === "css" || options.parser === "less";
50787 }
50788
50789 function lastLineHasInlineComment$1(text) {
50790   return /\/\//.test(text.split(/[\n\r]/).pop());
50791 }
50792
50793 function stringifyNode(node) {
50794   if (node.groups) {
50795     const open = node.open && node.open.value ? node.open.value : "";
50796     const groups = node.groups.reduce((previousValue, currentValue, index) => previousValue + stringifyNode(currentValue) + (node.groups[0].type === "comma_group" && index !== node.groups.length - 1 ? "," : ""), "");
50797     const close = node.close && node.close.value ? node.close.value : "";
50798     return open + groups + close;
50799   }
50800
50801   const before = node.raws && node.raws.before ? node.raws.before : "";
50802   const quote = node.raws && node.raws.quote ? node.raws.quote : "";
50803   const atword = node.type === "atword" ? "@" : "";
50804   const value = node.value ? node.value : "";
50805   const unit = node.unit ? node.unit : "";
50806   const group = node.group ? stringifyNode(node.group) : "";
50807   const after = node.raws && node.raws.after ? node.raws.after : "";
50808   return before + quote + atword + value + quote + unit + group + after;
50809 }
50810
50811 function isAtWordPlaceholderNode$1(node) {
50812   return node && node.type === "value-atword" && node.value.startsWith("prettier-placeholder-");
50813 }
50814
50815 function isModuleRuleName(name) {
50816   return moduleRuleNames.has(name);
50817 }
50818
50819 function isConfigurationNode$1(node, parentNode) {
50820   if (!node.open || node.open.value !== "(" || !node.close || node.close.value !== ")" || node.groups.some(group => group.type !== "value-comma_group")) {
50821     return false;
50822   }
50823
50824   if (parentNode.type === "value-comma_group") {
50825     const prevIdx = parentNode.groups.indexOf(node) - 1;
50826     const maybeWithNode = parentNode.groups[prevIdx];
50827
50828     if (maybeWithNode && maybeWithNode.type === "value-word" && maybeWithNode.value === "with") {
50829       return true;
50830     }
50831   }
50832
50833   return false;
50834 }
50835
50836 function isParenGroupNode$1(node) {
50837   return node.type === "value-paren_group" && node.open && node.open.value === "(" && node.close && node.close.value === ")";
50838 }
50839
50840 var utils$4 = {
50841   getAncestorCounter: getAncestorCounter$1,
50842   getAncestorNode: getAncestorNode$2,
50843   getPropOfDeclNode: getPropOfDeclNode$1,
50844   hasSCSSInterpolation,
50845   hasStringOrFunction,
50846   maybeToLowerCase: maybeToLowerCase$1,
50847   insideValueFunctionNode: insideValueFunctionNode$1,
50848   insideICSSRuleNode: insideICSSRuleNode$1,
50849   insideAtRuleNode: insideAtRuleNode$1,
50850   insideURLFunctionInImportAtRuleNode: insideURLFunctionInImportAtRuleNode$1,
50851   isKeyframeAtRuleKeywords: isKeyframeAtRuleKeywords$1,
50852   isWideKeywords: isWideKeywords$1,
50853   isSCSS: isSCSS$1,
50854   isSCSSVariable,
50855   isLastNode: isLastNode$1,
50856   isLessParser: isLessParser$1,
50857   isSCSSControlDirectiveNode: isSCSSControlDirectiveNode$1,
50858   isDetachedRulesetDeclarationNode: isDetachedRulesetDeclarationNode$1,
50859   isRelationalOperatorNode: isRelationalOperatorNode$1,
50860   isEqualityOperatorNode: isEqualityOperatorNode$1,
50861   isMultiplicationNode: isMultiplicationNode$1,
50862   isDivisionNode: isDivisionNode$1,
50863   isAdditionNode: isAdditionNode$1,
50864   isSubtractionNode: isSubtractionNode$1,
50865   isModuloNode,
50866   isMathOperatorNode: isMathOperatorNode$1,
50867   isEachKeywordNode: isEachKeywordNode$1,
50868   isForKeywordNode: isForKeywordNode$1,
50869   isURLFunctionNode: isURLFunctionNode$1,
50870   isIfElseKeywordNode: isIfElseKeywordNode$1,
50871   hasComposesNode: hasComposesNode$1,
50872   hasParensAroundNode: hasParensAroundNode$1,
50873   hasEmptyRawBefore: hasEmptyRawBefore$1,
50874   isSCSSNestedPropertyNode,
50875   isDetachedRulesetCallNode: isDetachedRulesetCallNode$1,
50876   isTemplatePlaceholderNode: isTemplatePlaceholderNode$1,
50877   isTemplatePropNode: isTemplatePropNode$1,
50878   isPostcssSimpleVarNode: isPostcssSimpleVarNode$1,
50879   isKeyValuePairNode: isKeyValuePairNode$1,
50880   isKeyValuePairInParenGroupNode,
50881   isKeyInValuePairNode: isKeyInValuePairNode$1,
50882   isSCSSMapItemNode: isSCSSMapItemNode$1,
50883   isInlineValueCommentNode: isInlineValueCommentNode$1,
50884   isHashNode: isHashNode$1,
50885   isLeftCurlyBraceNode: isLeftCurlyBraceNode$1,
50886   isRightCurlyBraceNode: isRightCurlyBraceNode$1,
50887   isWordNode: isWordNode$1,
50888   isColonNode: isColonNode$1,
50889   isMediaAndSupportsKeywords: isMediaAndSupportsKeywords$1,
50890   isColorAdjusterFuncNode: isColorAdjusterFuncNode$1,
50891   lastLineHasInlineComment: lastLineHasInlineComment$1,
50892   stringifyNode,
50893   isAtWordPlaceholderNode: isAtWordPlaceholderNode$1,
50894   isModuleRuleName,
50895   isConfigurationNode: isConfigurationNode$1,
50896   isParenGroupNode: isParenGroupNode$1
50897 };
50898
50899 var lineColumnToIndex$1 = function (lineColumn, text) {
50900   let index = 0;
50901
50902   for (let i = 0; i < lineColumn.line - 1; ++i) {
50903     index = text.indexOf("\n", index) + 1;
50904   }
50905
50906   return index + lineColumn.column;
50907 };
50908
50909 const lineColumnToIndex = lineColumnToIndex$1;
50910 const {
50911   getLast: getLast$8,
50912   skipEverythingButNewLine
50913 } = util$8;
50914
50915 function calculateLocStart(node, text) {
50916   // value-* nodes have this
50917   if (typeof node.sourceIndex === "number") {
50918     return node.sourceIndex;
50919   }
50920
50921   return node.source ? lineColumnToIndex(node.source.start, text) - 1 : null;
50922 }
50923
50924 function calculateLocEnd(node, text) {
50925   if (node.type === "css-comment" && node.inline) {
50926     return skipEverythingButNewLine(text, node.source.startOffset);
50927   }
50928
50929   const endNode = node.nodes && getLast$8(node.nodes);
50930
50931   if (endNode && node.source && !node.source.end) {
50932     node = endNode;
50933   }
50934
50935   if (node.source && node.source.end) {
50936     return lineColumnToIndex(node.source.end, text);
50937   }
50938
50939   return null;
50940 }
50941
50942 function calculateLoc(node, text) {
50943   if (node.source) {
50944     node.source.startOffset = calculateLocStart(node, text);
50945     node.source.endOffset = calculateLocEnd(node, text);
50946   }
50947
50948   for (const key in node) {
50949     const child = node[key];
50950
50951     if (key === "source" || !child || typeof child !== "object") {
50952       continue;
50953     }
50954
50955     if (child.type === "value-root" || child.type === "value-unknown") {
50956       calculateValueNodeLoc(child, getValueRootOffset(node), child.text || child.value);
50957     } else {
50958       calculateLoc(child, text);
50959     }
50960   }
50961 }
50962
50963 function calculateValueNodeLoc(node, rootOffset, text) {
50964   if (node.source) {
50965     node.source.startOffset = calculateLocStart(node, text) + rootOffset;
50966     node.source.endOffset = calculateLocEnd(node, text) + rootOffset;
50967   }
50968
50969   for (const key in node) {
50970     const child = node[key];
50971
50972     if (key === "source" || !child || typeof child !== "object") {
50973       continue;
50974     }
50975
50976     calculateValueNodeLoc(child, rootOffset, text);
50977   }
50978 }
50979
50980 function getValueRootOffset(node) {
50981   let result = node.source.startOffset;
50982
50983   if (typeof node.prop === "string") {
50984     result += node.prop.length;
50985   }
50986
50987   if (node.type === "css-atrule" && typeof node.name === "string") {
50988     result += 1 + node.name.length + node.raws.afterName.match(/^\s*:?\s*/)[0].length;
50989   }
50990
50991   if (node.type !== "css-atrule" && node.raws && typeof node.raws.between === "string") {
50992     result += node.raws.between.length;
50993   }
50994
50995   return result;
50996 }
50997 /**
50998  * Workaround for a bug: quotes and asterisks in inline comments corrupt loc data of subsequent nodes.
50999  * This function replaces the quotes and asterisks with spaces. Later, when the comments are printed,
51000  * their content is extracted from the original text.
51001  * - https://github.com/prettier/prettier/issues/7780
51002  * - https://github.com/shellscape/postcss-less/issues/145
51003  * - https://github.com/prettier/prettier/issues/8130
51004  * @param text {string}
51005  */
51006
51007
51008 function replaceQuotesInInlineComments(text) {
51009   /** @typedef { 'initial' | 'single-quotes' | 'double-quotes' | 'url' | 'comment-block' | 'comment-inline' } State */
51010
51011   /** @type {State} */
51012   let state = "initial";
51013   /** @type {State} */
51014
51015   let stateToReturnFromQuotes = "initial";
51016   let inlineCommentStartIndex;
51017   let inlineCommentContainsQuotes = false;
51018   const inlineCommentsToReplace = [];
51019
51020   for (let i = 0; i < text.length; i++) {
51021     const c = text[i];
51022
51023     switch (state) {
51024       case "initial":
51025         if (c === "'") {
51026           state = "single-quotes";
51027           continue;
51028         }
51029
51030         if (c === '"') {
51031           state = "double-quotes";
51032           continue;
51033         }
51034
51035         if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
51036           state = "url";
51037           i += 3;
51038           continue;
51039         }
51040
51041         if (c === "*" && text[i - 1] === "/") {
51042           state = "comment-block";
51043           continue;
51044         }
51045
51046         if (c === "/" && text[i - 1] === "/") {
51047           state = "comment-inline";
51048           inlineCommentStartIndex = i - 1;
51049           continue;
51050         }
51051
51052         continue;
51053
51054       case "single-quotes":
51055         if (c === "'" && text[i - 1] !== "\\") {
51056           state = stateToReturnFromQuotes;
51057           stateToReturnFromQuotes = "initial";
51058         }
51059
51060         if (c === "\n" || c === "\r") {
51061           return text; // invalid input
51062         }
51063
51064         continue;
51065
51066       case "double-quotes":
51067         if (c === '"' && text[i - 1] !== "\\") {
51068           state = stateToReturnFromQuotes;
51069           stateToReturnFromQuotes = "initial";
51070         }
51071
51072         if (c === "\n" || c === "\r") {
51073           return text; // invalid input
51074         }
51075
51076         continue;
51077
51078       case "url":
51079         if (c === ")") {
51080           state = "initial";
51081         }
51082
51083         if (c === "\n" || c === "\r") {
51084           return text; // invalid input
51085         }
51086
51087         if (c === "'") {
51088           state = "single-quotes";
51089           stateToReturnFromQuotes = "url";
51090           continue;
51091         }
51092
51093         if (c === '"') {
51094           state = "double-quotes";
51095           stateToReturnFromQuotes = "url";
51096           continue;
51097         }
51098
51099         continue;
51100
51101       case "comment-block":
51102         if (c === "/" && text[i - 1] === "*") {
51103           state = "initial";
51104         }
51105
51106         continue;
51107
51108       case "comment-inline":
51109         if (c === '"' || c === "'" || c === "*") {
51110           inlineCommentContainsQuotes = true;
51111         }
51112
51113         if (c === "\n" || c === "\r") {
51114           if (inlineCommentContainsQuotes) {
51115             inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
51116           }
51117
51118           state = "initial";
51119           inlineCommentContainsQuotes = false;
51120         }
51121
51122         continue;
51123     }
51124   }
51125
51126   for (const [start, end] of inlineCommentsToReplace) {
51127     text = text.slice(0, start) + text.slice(start, end).replace(/["'*]/g, " ") + text.slice(end);
51128   }
51129
51130   return text;
51131 }
51132
51133 function locStart$e(node) {
51134   return node.source.startOffset;
51135 }
51136
51137 function locEnd$d(node) {
51138   return node.source.endOffset;
51139 }
51140
51141 var loc$5 = {
51142   locStart: locStart$e,
51143   locEnd: locEnd$d,
51144   calculateLoc,
51145   replaceQuotesInInlineComments
51146 };
51147
51148 const getLast$7 = getLast_1;
51149 const {
51150   printNumber,
51151   printString,
51152   hasNewline,
51153   isFrontMatterNode: isFrontMatterNode$3,
51154   isNextLineEmpty: isNextLineEmpty$3,
51155   isNonEmptyArray: isNonEmptyArray$5
51156 } = util$8;
51157 const {
51158   builders: {
51159     join: join$a,
51160     line: line$d,
51161     hardline: hardline$c,
51162     softline: softline$9,
51163     group: group$b,
51164     fill: fill$6,
51165     indent: indent$6,
51166     dedent: dedent$2,
51167     ifBreak: ifBreak$8,
51168     breakParent: breakParent$5
51169   },
51170   utils: {
51171     removeLines,
51172     getDocParts: getDocParts$5
51173   }
51174 } = require$$7$3;
51175 const clean$8 = clean_1$3;
51176 const embed$7 = embed_1$3;
51177 const {
51178   insertPragma: insertPragma$7
51179 } = pragma$4;
51180 const {
51181   getAncestorNode: getAncestorNode$1,
51182   getPropOfDeclNode,
51183   maybeToLowerCase,
51184   insideValueFunctionNode,
51185   insideICSSRuleNode,
51186   insideAtRuleNode,
51187   insideURLFunctionInImportAtRuleNode,
51188   isKeyframeAtRuleKeywords,
51189   isWideKeywords,
51190   isSCSS,
51191   isLastNode,
51192   isLessParser,
51193   isSCSSControlDirectiveNode,
51194   isDetachedRulesetDeclarationNode,
51195   isRelationalOperatorNode,
51196   isEqualityOperatorNode,
51197   isMultiplicationNode,
51198   isDivisionNode,
51199   isAdditionNode,
51200   isSubtractionNode,
51201   isMathOperatorNode,
51202   isEachKeywordNode,
51203   isForKeywordNode,
51204   isURLFunctionNode,
51205   isIfElseKeywordNode,
51206   hasComposesNode,
51207   hasParensAroundNode,
51208   hasEmptyRawBefore,
51209   isKeyValuePairNode,
51210   isKeyInValuePairNode,
51211   isDetachedRulesetCallNode,
51212   isTemplatePlaceholderNode,
51213   isTemplatePropNode,
51214   isPostcssSimpleVarNode,
51215   isSCSSMapItemNode,
51216   isInlineValueCommentNode,
51217   isHashNode,
51218   isLeftCurlyBraceNode,
51219   isRightCurlyBraceNode,
51220   isWordNode,
51221   isColonNode,
51222   isMediaAndSupportsKeywords,
51223   isColorAdjusterFuncNode,
51224   lastLineHasInlineComment,
51225   isAtWordPlaceholderNode,
51226   isConfigurationNode,
51227   isParenGroupNode
51228 } = utils$4;
51229 const {
51230   locStart: locStart$d,
51231   locEnd: locEnd$c
51232 } = loc$5;
51233
51234 function shouldPrintComma(options) {
51235   return options.trailingComma === "es5" || options.trailingComma === "all";
51236 }
51237
51238 function genericPrint$4(path, options, print) {
51239   const node = path.getValue();
51240   /* istanbul ignore if */
51241
51242   if (!node) {
51243     return "";
51244   }
51245
51246   if (typeof node === "string") {
51247     return node;
51248   }
51249
51250   switch (node.type) {
51251     case "front-matter":
51252       return [node.raw, hardline$c];
51253
51254     case "css-root":
51255       {
51256         const nodes = printNodeSequence(path, options, print);
51257         const after = node.raws.after.trim();
51258         return [nodes, after ? ` ${after}` : "", getDocParts$5(nodes).length > 0 ? hardline$c : ""];
51259       }
51260
51261     case "css-comment":
51262       {
51263         const isInlineComment = node.inline || node.raws.inline;
51264         const text = options.originalText.slice(locStart$d(node), locEnd$c(node));
51265         return isInlineComment ? text.trimEnd() : text;
51266       }
51267
51268     case "css-rule":
51269       {
51270         return [print("selector"), node.important ? " !important" : "", node.nodes ? [node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment(node.selector.value) ? line$d : " ", "{", node.nodes.length > 0 ? indent$6([hardline$c, printNodeSequence(path, options, print)]) : "", hardline$c, "}", isDetachedRulesetDeclarationNode(node) ? ";" : ""] : ";"];
51271       }
51272
51273     case "css-decl":
51274       {
51275         const parentNode = path.getParentNode();
51276         const {
51277           between: rawBetween
51278         } = node.raws;
51279         const trimmedBetween = rawBetween.trim();
51280         const isColon = trimmedBetween === ":";
51281         let value = hasComposesNode(node) ? removeLines(print("value")) : print("value");
51282
51283         if (!isColon && lastLineHasInlineComment(trimmedBetween)) {
51284           value = indent$6([hardline$c, dedent$2(value)]);
51285         }
51286
51287         return [node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode(path) ? node.prop : maybeToLowerCase(node.prop), trimmedBetween.startsWith("//") ? " " : "", trimmedBetween, node.extend ? "" : " ", isLessParser(options) && node.extend && node.selector ? ["extend(", print("selector"), ")"] : "", value, node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? [" {", indent$6([softline$9, printNodeSequence(path, options, print)]), softline$9, "}"] : isTemplatePropNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd$c(node) - 1] !== ";" ? "" : options.__isHTMLStyleAttribute && isLastNode(path, node) ? ifBreak$8(";") : ";"];
51288       }
51289
51290     case "css-atrule":
51291       {
51292         const parentNode = path.getParentNode();
51293         const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd$c(node) - 1] !== ";";
51294
51295         if (isLessParser(options)) {
51296           if (node.mixin) {
51297             return [print("selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
51298           }
51299
51300           if (node.function) {
51301             return [node.name, print("params"), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
51302           }
51303
51304           if (node.variable) {
51305             return ["@", node.name, ": ", node.value ? print("value") : "", node.raws.between.trim() ? node.raws.between.trim() + " " : "", node.nodes ? ["{", indent$6([node.nodes.length > 0 ? softline$9 : "", printNodeSequence(path, options, print)]), softline$9, "}"] : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
51306           }
51307         }
51308
51309         return ["@", // If a Less file ends up being parsed with the SCSS parser, Less
51310         // variable declarations will be parsed as at-rules with names ending
51311         // with a colon, so keep the original case then.
51312         isDetachedRulesetCallNode(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase(node.name), node.params ? [isDetachedRulesetCallNode(node) ? "" : isTemplatePlaceholderNode(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? [hardline$c, hardline$c] : /^\s*\n/.test(node.raws.afterName) ? hardline$c : " " : " ", print("params")] : "", node.selector ? indent$6([" ", print("selector")]) : "", node.value ? group$b([" ", print("value"), isSCSSControlDirectiveNode(node) ? hasParensAroundNode(node) ? " " : line$d : ""]) : node.name === "else" ? " " : "", node.nodes ? [isSCSSControlDirectiveNode(node) ? "" : node.selector && !node.selector.nodes && typeof node.selector.value === "string" && lastLineHasInlineComment(node.selector.value) || !node.selector && typeof node.params === "string" && lastLineHasInlineComment(node.params) ? line$d : " ", "{", indent$6([node.nodes.length > 0 ? softline$9 : "", printNodeSequence(path, options, print)]), softline$9, "}"] : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
51313       }
51314     // postcss-media-query-parser
51315
51316     case "media-query-list":
51317       {
51318         const parts = [];
51319         path.each(childPath => {
51320           const node = childPath.getValue();
51321
51322           if (node.type === "media-query" && node.value === "") {
51323             return;
51324           }
51325
51326           parts.push(print());
51327         }, "nodes");
51328         return group$b(indent$6(join$a(line$d, parts)));
51329       }
51330
51331     case "media-query":
51332       {
51333         return [join$a(" ", path.map(print, "nodes")), isLastNode(path, node) ? "" : ","];
51334       }
51335
51336     case "media-type":
51337       {
51338         return adjustNumbers(adjustStrings(node.value, options));
51339       }
51340
51341     case "media-feature-expression":
51342       {
51343         if (!node.nodes) {
51344           return node.value;
51345         }
51346
51347         return ["(", ...path.map(print, "nodes"), ")"];
51348       }
51349
51350     case "media-feature":
51351       {
51352         return maybeToLowerCase(adjustStrings(node.value.replace(/ +/g, " "), options));
51353       }
51354
51355     case "media-colon":
51356       {
51357         return [node.value, " "];
51358       }
51359
51360     case "media-value":
51361       {
51362         return adjustNumbers(adjustStrings(node.value, options));
51363       }
51364
51365     case "media-keyword":
51366       {
51367         return adjustStrings(node.value, options);
51368       }
51369
51370     case "media-url":
51371       {
51372         return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/g, ")"), options);
51373       }
51374
51375     case "media-unknown":
51376       {
51377         return node.value;
51378       }
51379     // postcss-selector-parser
51380
51381     case "selector-root":
51382       {
51383         return group$b([insideAtRuleNode(path, "custom-selector") ? [getAncestorNode$1(path, "css-atrule").customSelector, line$d] : "", join$a([",", insideAtRuleNode(path, ["extend", "custom-selector", "nest"]) ? line$d : hardline$c], path.map(print, "nodes"))]);
51384       }
51385
51386     case "selector-selector":
51387       {
51388         return group$b(indent$6(path.map(print, "nodes")));
51389       }
51390
51391     case "selector-comment":
51392       {
51393         return node.value;
51394       }
51395
51396     case "selector-string":
51397       {
51398         return adjustStrings(node.value, options);
51399       }
51400
51401     case "selector-tag":
51402       {
51403         const parentNode = path.getParentNode();
51404         const index = parentNode && parentNode.nodes.indexOf(node);
51405         const prevNode = index && parentNode.nodes[index - 1];
51406         return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isKeyframeAtRuleKeywords(path, node.value) ? node.value.toLowerCase() : node.value)];
51407       }
51408
51409     case "selector-id":
51410       {
51411         return ["#", node.value];
51412       }
51413
51414     case "selector-class":
51415       {
51416         return [".", adjustNumbers(adjustStrings(node.value, options))];
51417       }
51418
51419     case "selector-attribute":
51420       {
51421         return ["[", node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.attribute.trim(), node.operator ? node.operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"];
51422       }
51423
51424     case "selector-combinator":
51425       {
51426         if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
51427           const parentNode = path.getParentNode();
51428           const leading = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line$d;
51429           return [leading, node.value, isLastNode(path, node) ? "" : " "];
51430         }
51431
51432         const leading = node.value.trim().startsWith("(") ? line$d : "";
51433         const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line$d;
51434         return [leading, value];
51435       }
51436
51437     case "selector-universal":
51438       {
51439         return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.value];
51440       }
51441
51442     case "selector-pseudo":
51443       {
51444         return [maybeToLowerCase(node.value), isNonEmptyArray$5(node.nodes) ? ["(", join$a(", ", path.map(print, "nodes")), ")"] : ""];
51445       }
51446
51447     case "selector-nesting":
51448       {
51449         return node.value;
51450       }
51451
51452     case "selector-unknown":
51453       {
51454         const ruleAncestorNode = getAncestorNode$1(path, "css-rule"); // Nested SCSS property
51455
51456         if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
51457           return adjustNumbers(adjustStrings(maybeToLowerCase(node.value), options));
51458         } // originalText has to be used for Less, see replaceQuotesInInlineComments in loc.js
51459
51460
51461         const parentNode = path.getParentNode();
51462
51463         if (parentNode.raws && parentNode.raws.selector) {
51464           const start = locStart$d(parentNode);
51465           const end = start + parentNode.raws.selector.length;
51466           return options.originalText.slice(start, end).trim();
51467         } // Same reason above
51468
51469
51470         const grandParent = path.getParentNode(1);
51471
51472         if (parentNode.type === "value-paren_group" && grandParent && grandParent.type === "value-func" && grandParent.value === "selector") {
51473           const start = locStart$d(parentNode.open) + 1;
51474           const end = locEnd$c(parentNode.close) - 1;
51475           const selector = options.originalText.slice(start, end).trim();
51476           return lastLineHasInlineComment(selector) ? [breakParent$5, selector] : selector;
51477         }
51478
51479         return node.value;
51480       }
51481     // postcss-values-parser
51482
51483     case "value-value":
51484     case "value-root":
51485       {
51486         return print("group");
51487       }
51488
51489     case "value-comment":
51490       {
51491         return options.originalText.slice(locStart$d(node), locEnd$c(node));
51492       }
51493
51494     case "value-comma_group":
51495       {
51496         const parentNode = path.getParentNode();
51497         const parentParentNode = path.getParentNode(1);
51498         const declAncestorProp = getPropOfDeclNode(path);
51499         const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
51500         const atRuleAncestorNode = getAncestorNode$1(path, "css-atrule");
51501         const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode);
51502         const hasInlineComment = node.groups.some(node => isInlineValueCommentNode(node));
51503         const printed = path.map(print, "groups");
51504         const parts = [];
51505         const insideURLFunction = insideValueFunctionNode(path, "url");
51506         let insideSCSSInterpolationInString = false;
51507         let didBreak = false;
51508
51509         for (let i = 0; i < node.groups.length; ++i) {
51510           parts.push(printed[i]);
51511           const iPrevNode = node.groups[i - 1];
51512           const iNode = node.groups[i];
51513           const iNextNode = node.groups[i + 1];
51514           const iNextNextNode = node.groups[i + 2];
51515
51516           if (insideURLFunction) {
51517             if (iNextNode && isAdditionNode(iNextNode) || isAdditionNode(iNode)) {
51518               parts.push(" ");
51519             }
51520
51521             continue;
51522           } // Ignore SCSS @forward wildcard suffix
51523
51524
51525           if (insideAtRuleNode(path, "forward") && iNode.type === "value-word" && iNode.value && iPrevNode !== undefined && iPrevNode.type === "value-word" && iPrevNode.value === "as" && iNextNode.type === "value-operator" && iNextNode.value === "*") {
51526             continue;
51527           } // Ignore after latest node (i.e. before semicolon)
51528
51529
51530           if (!iNextNode) {
51531             continue;
51532           } // styled.div` background: var(--${one}); `
51533
51534
51535           if (iNode.type === "value-word" && iNode.value.endsWith("-") && isAtWordPlaceholderNode(iNextNode)) {
51536             continue;
51537           } // Ignore spaces before/after string interpolation (i.e. `"#{my-fn("_")}"`)
51538
51539
51540           const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
51541           const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
51542
51543           if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
51544             insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
51545             continue;
51546           }
51547
51548           if (insideSCSSInterpolationInString) {
51549             continue;
51550           } // Ignore colon (i.e. `:`)
51551
51552
51553           if (isColonNode(iNode) || isColonNode(iNextNode)) {
51554             continue;
51555           } // Ignore `@` in Less (i.e. `@@var;`)
51556
51557
51558           if (iNode.type === "value-atword" && iNode.value === "") {
51559             continue;
51560           } // Ignore `~` in Less (i.e. `content: ~"^//* some horrible but needed css hack";`)
51561
51562
51563           if (iNode.value === "~") {
51564             continue;
51565           } // Ignore escape `\`
51566
51567
51568           if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
51569             continue;
51570           } // Ignore escaped `/`
51571
51572
51573           if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
51574             continue;
51575           } // Ignore `\` (i.e. `$variable: \@small;`)
51576
51577
51578           if (iNode.value === "\\") {
51579             continue;
51580           } // Ignore `$$` (i.e. `background-color: $$(style)Color;`)
51581
51582
51583           if (isPostcssSimpleVarNode(iNode, iNextNode)) {
51584             continue;
51585           } // Ignore spaces after `#` and after `{` and before `}` in SCSS interpolation (i.e. `#{variable}`)
51586
51587
51588           if (isHashNode(iNode) || isLeftCurlyBraceNode(iNode) || isRightCurlyBraceNode(iNextNode) || isLeftCurlyBraceNode(iNextNode) && hasEmptyRawBefore(iNextNode) || isRightCurlyBraceNode(iNode) && hasEmptyRawBefore(iNextNode)) {
51589             continue;
51590           } // Ignore css variables and interpolation in SCSS (i.e. `--#{$var}`)
51591
51592
51593           if (iNode.value === "--" && isHashNode(iNextNode)) {
51594             continue;
51595           } // Formatting math operations
51596
51597
51598           const isMathOperator = isMathOperatorNode(iNode);
51599           const isNextMathOperator = isMathOperatorNode(iNextNode); // Print spaces before and after math operators beside SCSS interpolation as is
51600           // (i.e. `#{$var}+5`, `#{$var} +5`, `#{$var}+ 5`, `#{$var} + 5`)
51601           // (i.e. `5+#{$var}`, `5 +#{$var}`, `5+ #{$var}`, `5 + #{$var}`)
51602
51603           if ((isMathOperator && isHashNode(iNextNode) || isNextMathOperator && isRightCurlyBraceNode(iNode)) && hasEmptyRawBefore(iNextNode)) {
51604             continue;
51605           } // absolute paths are only parsed as one token if they are part of url(/abs/path) call
51606           // but if you have custom -fb-url(/abs/path/) then it is parsed as "division /" and rest
51607           // of the path. We don't want to put a space after that first division in this case.
51608
51609
51610           if (!iPrevNode && isDivisionNode(iNode)) {
51611             continue;
51612           } // Print spaces before and after addition and subtraction math operators as is in `calc` function
51613           // due to the fact that it is not valid syntax
51614           // (i.e. `calc(1px+1px)`, `calc(1px+ 1px)`, `calc(1px +1px)`, `calc(1px + 1px)`)
51615
51616
51617           if (insideValueFunctionNode(path, "calc") && (isAdditionNode(iNode) || isAdditionNode(iNextNode) || isSubtractionNode(iNode) || isSubtractionNode(iNextNode)) && hasEmptyRawBefore(iNextNode)) {
51618             continue;
51619           } // Print spaces after `+` and `-` in color adjuster functions as is (e.g. `color(red l(+ 20%))`)
51620           // Adjusters with signed numbers (e.g. `color(red l(+20%))`) output as-is.
51621
51622
51623           const isColorAdjusterNode = (isAdditionNode(iNode) || isSubtractionNode(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode(parentParentNode) && !hasEmptyRawBefore(iNextNode);
51624           const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode(iNextNextNode) || iNode.type === "value-func" || isWordNode(iNode);
51625           const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode(iPrevNode); // Formatting `/`, `+`, `-` sign
51626
51627           if (!(isMultiplicationNode(iNextNode) || isMultiplicationNode(iNode)) && !insideValueFunctionNode(path, "calc") && !isColorAdjusterNode && (isDivisionNode(iNextNode) && !requireSpaceBeforeOperator || isDivisionNode(iNode) && !requireSpaceAfterOperator || isAdditionNode(iNextNode) && !requireSpaceBeforeOperator || isAdditionNode(iNode) && !requireSpaceAfterOperator || isSubtractionNode(iNextNode) || isSubtractionNode(iNode)) && (hasEmptyRawBefore(iNextNode) || isMathOperator && (!iPrevNode || iPrevNode && isMathOperatorNode(iPrevNode)))) {
51628             continue;
51629           } // Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
51630
51631
51632           if (isInlineValueCommentNode(iNode)) {
51633             if (parentNode.type === "value-paren_group") {
51634               parts.push(dedent$2(hardline$c));
51635               continue;
51636             }
51637
51638             parts.push(hardline$c);
51639             continue;
51640           } // Handle keywords in SCSS control directive
51641
51642
51643           if (isControlDirective && (isEqualityOperatorNode(iNextNode) || isRelationalOperatorNode(iNextNode) || isIfElseKeywordNode(iNextNode) || isEachKeywordNode(iNode) || isForKeywordNode(iNode))) {
51644             parts.push(" ");
51645             continue;
51646           } // At-rule `namespace` should be in one line
51647
51648
51649           if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
51650             parts.push(" ");
51651             continue;
51652           } // Formatting `grid` property
51653
51654
51655           if (isGridValue) {
51656             if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
51657               parts.push(hardline$c);
51658               didBreak = true;
51659             } else {
51660               parts.push(" ");
51661             }
51662
51663             continue;
51664           } // Add `space` before next math operation
51665           // Note: `grip` property have `/` delimiter and it is not math operation, so
51666           // `grid` property handles above
51667
51668
51669           if (isNextMathOperator) {
51670             parts.push(" ");
51671             continue;
51672           } // allow function(returns-list($list)...)
51673
51674
51675           if (iNextNode && iNextNode.value === "...") {
51676             continue;
51677           }
51678
51679           if (isAtWordPlaceholderNode(iNode) && isAtWordPlaceholderNode(iNextNode) && locEnd$c(iNode) === locStart$d(iNextNode)) {
51680             continue;
51681           }
51682
51683           if (isAtWordPlaceholderNode(iNode) && isParenGroupNode(iNextNode) && locEnd$c(iNode) === locStart$d(iNextNode.open)) {
51684             parts.push(softline$9);
51685             continue;
51686           }
51687
51688           if (iNode.value === "with" && isParenGroupNode(iNextNode)) {
51689             parts.push(" ");
51690             continue;
51691           } // Be default all values go through `line`
51692
51693
51694           parts.push(line$d);
51695         }
51696
51697         if (hasInlineComment) {
51698           parts.push(breakParent$5);
51699         }
51700
51701         if (didBreak) {
51702           parts.unshift(hardline$c);
51703         }
51704
51705         if (isControlDirective) {
51706           return group$b(indent$6(parts));
51707         } // Indent is not needed for import url when url is very long
51708         // and node has two groups
51709         // when type is value-comma_group
51710         // example @import url("verylongurl") projection,tv
51711
51712
51713         if (insideURLFunctionInImportAtRuleNode(path)) {
51714           return group$b(fill$6(parts));
51715         }
51716
51717         return group$b(indent$6(fill$6(parts)));
51718       }
51719
51720     case "value-paren_group":
51721       {
51722         const parentNode = path.getParentNode();
51723
51724         if (parentNode && isURLFunctionNode(parentNode) && (node.groups.length === 1 || node.groups.length > 0 && node.groups[0].type === "value-comma_group" && node.groups[0].groups.length > 0 && node.groups[0].groups[0].type === "value-word" && node.groups[0].groups[0].value.startsWith("data:"))) {
51725           return [node.open ? print("open") : "", join$a(",", path.map(print, "groups")), node.close ? print("close") : ""];
51726         }
51727
51728         if (!node.open) {
51729           const printed = path.map(print, "groups");
51730           const res = [];
51731
51732           for (let i = 0; i < printed.length; i++) {
51733             if (i !== 0) {
51734               res.push([",", line$d]);
51735             }
51736
51737             res.push(printed[i]);
51738           }
51739
51740           return group$b(indent$6(fill$6(res)));
51741         }
51742
51743         const isSCSSMapItem = isSCSSMapItemNode(path);
51744         const lastItem = getLast$7(node.groups);
51745         const isLastItemComment = lastItem && lastItem.type === "value-comment";
51746         const isKey = isKeyInValuePairNode(node, parentNode);
51747         const isConfiguration = isConfigurationNode(node, parentNode);
51748         const shouldBreak = isConfiguration || isSCSSMapItem && !isKey;
51749         const shouldDedent = isConfiguration || isKey;
51750         const printed = group$b([node.open ? print("open") : "", indent$6([softline$9, join$a([",", line$d], path.map(childPath => {
51751           const node = childPath.getValue();
51752           const printed = print(); // Key/Value pair in open paren already indented
51753
51754           if (isKeyValuePairNode(node) && node.type === "value-comma_group" && node.groups && node.groups[0].type !== "value-paren_group" && node.groups[2] && node.groups[2].type === "value-paren_group") {
51755             const parts = getDocParts$5(printed.contents.contents);
51756             parts[1] = group$b(parts[1]);
51757             return group$b(dedent$2(printed));
51758           }
51759
51760           return printed;
51761         }, "groups"))]), ifBreak$8(!isLastItemComment && isSCSS(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline$9, node.close ? print("close") : ""], {
51762           shouldBreak
51763         });
51764         return shouldDedent ? dedent$2(printed) : printed;
51765       }
51766
51767     case "value-func":
51768       {
51769         return [node.value, insideAtRuleNode(path, "supports") && isMediaAndSupportsKeywords(node) ? " " : "", print("group")];
51770       }
51771
51772     case "value-paren":
51773       {
51774         return node.value;
51775       }
51776
51777     case "value-number":
51778       {
51779         return [printCssNumber(node.value), maybeToLowerCase(node.unit)];
51780       }
51781
51782     case "value-operator":
51783       {
51784         return node.value;
51785       }
51786
51787     case "value-word":
51788       {
51789         if (node.isColor && node.isHex || isWideKeywords(node.value)) {
51790           return node.value.toLowerCase();
51791         }
51792
51793         return node.value;
51794       }
51795
51796     case "value-colon":
51797       {
51798         const parentNode = path.getParentNode();
51799         const index = parentNode && parentNode.groups.indexOf(node);
51800         const prevNode = index && parentNode.groups[index - 1];
51801         return [node.value, // Don't add spaces on escaped colon `:`, e.g: grid-template-rows: [row-1-00\:00] auto;
51802         prevNode && typeof prevNode.value === "string" && getLast$7(prevNode.value) === "\\" || // Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`)
51803         insideValueFunctionNode(path, "url") ? "" : line$d];
51804       }
51805     // TODO: confirm this code is dead
51806
51807     /* istanbul ignore next */
51808
51809     case "value-comma":
51810       {
51811         return [node.value, " "];
51812       }
51813
51814     case "value-string":
51815       {
51816         return printString(node.raws.quote + node.value + node.raws.quote, options);
51817       }
51818
51819     case "value-atword":
51820       {
51821         return ["@", node.value];
51822       }
51823
51824     case "value-unicode-range":
51825       {
51826         return node.value;
51827       }
51828
51829     case "value-unknown":
51830       {
51831         return node.value;
51832       }
51833
51834     default:
51835       /* istanbul ignore next */
51836       throw new Error(`Unknown postcss type ${JSON.stringify(node.type)}`);
51837   }
51838 }
51839
51840 function printNodeSequence(path, options, print) {
51841   const parts = [];
51842   path.each((pathChild, i, nodes) => {
51843     const prevNode = nodes[i - 1];
51844
51845     if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
51846       const childNode = pathChild.getValue();
51847       parts.push(options.originalText.slice(locStart$d(childNode), locEnd$c(childNode)));
51848     } else {
51849       parts.push(print());
51850     }
51851
51852     if (i !== nodes.length - 1) {
51853       if (nodes[i + 1].type === "css-comment" && !hasNewline(options.originalText, locStart$d(nodes[i + 1]), {
51854         backwards: true
51855       }) && !isFrontMatterNode$3(nodes[i]) || nodes[i + 1].type === "css-atrule" && nodes[i + 1].name === "else" && nodes[i].type !== "css-comment") {
51856         parts.push(" ");
51857       } else {
51858         parts.push(options.__isHTMLStyleAttribute ? line$d : hardline$c);
51859
51860         if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), locEnd$c) && !isFrontMatterNode$3(nodes[i])) {
51861           parts.push(hardline$c);
51862         }
51863       }
51864     }
51865   }, "nodes");
51866   return parts;
51867 }
51868
51869 const STRING_REGEX = /(["'])(?:(?!\1)[^\\]|\\.)*\1/gs;
51870 const NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g;
51871 const STANDARD_UNIT_REGEX = /[A-Za-z]+/g;
51872 const WORD_PART_REGEX = /[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g;
51873 const ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX.source + "|" + `(${WORD_PART_REGEX.source})?` + `(${NUMBER_REGEX.source})` + `(${STANDARD_UNIT_REGEX.source})?`, "g");
51874
51875 function adjustStrings(value, options) {
51876   return value.replace(STRING_REGEX, match => printString(match, options));
51877 }
51878
51879 function quoteAttributeValue(value, options) {
51880   const quote = options.singleQuote ? "'" : '"';
51881   return value.includes('"') || value.includes("'") ? value : quote + value + quote;
51882 }
51883
51884 function adjustNumbers(value) {
51885   return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase(unit || "") : match);
51886 }
51887
51888 function printCssNumber(rawNumber) {
51889   return printNumber(rawNumber) // Remove trailing `.0`.
51890   .replace(/\.0(?=$|e)/, "");
51891 }
51892
51893 var printerPostcss = {
51894   print: genericPrint$4,
51895   embed: embed$7,
51896   insertPragma: insertPragma$7,
51897   massageAstNode: clean$8
51898 };
51899
51900 const commonOptions$4 = commonOptions$6; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
51901
51902 var options$9 = {
51903   singleQuote: commonOptions$4.singleQuote
51904 };
51905
51906 var parsers$b = {
51907   // TODO: switch these to just `postcss` and use `language` instead.
51908   get css() {
51909     return require("./parser-postcss.js").parsers.css;
51910   },
51911
51912   get less() {
51913     return require("./parser-postcss.js").parsers.less;
51914   },
51915
51916   get scss() {
51917     return require("./parser-postcss.js").parsers.scss;
51918   }
51919
51920 };
51921
51922 var name$9 = "CSS";
51923 var type$9 = "markup";
51924 var tmScope$9 = "source.css";
51925 var aceMode$9 = "css";
51926 var codemirrorMode$5 = "css";
51927 var codemirrorMimeType$5 = "text/css";
51928 var color$8 = "#563d7c";
51929 var extensions$9 = [
51930         ".css"
51931 ];
51932 var languageId$9 = 50;
51933 var require$$4$5 = {
51934         name: name$9,
51935         type: type$9,
51936         tmScope: tmScope$9,
51937         aceMode: aceMode$9,
51938         codemirrorMode: codemirrorMode$5,
51939         codemirrorMimeType: codemirrorMimeType$5,
51940         color: color$8,
51941         extensions: extensions$9,
51942         languageId: languageId$9
51943 };
51944
51945 var name$8 = "PostCSS";
51946 var type$8 = "markup";
51947 var tmScope$8 = "source.postcss";
51948 var group$a = "CSS";
51949 var extensions$8 = [
51950         ".pcss",
51951         ".postcss"
51952 ];
51953 var aceMode$8 = "text";
51954 var languageId$8 = 262764437;
51955 var require$$5$1 = {
51956         name: name$8,
51957         type: type$8,
51958         tmScope: tmScope$8,
51959         group: group$a,
51960         extensions: extensions$8,
51961         aceMode: aceMode$8,
51962         languageId: languageId$8
51963 };
51964
51965 var name$7 = "Less";
51966 var type$7 = "markup";
51967 var color$7 = "#1d365d";
51968 var extensions$7 = [
51969         ".less"
51970 ];
51971 var tmScope$7 = "source.css.less";
51972 var aceMode$7 = "less";
51973 var codemirrorMode$4 = "css";
51974 var codemirrorMimeType$4 = "text/css";
51975 var languageId$7 = 198;
51976 var require$$6 = {
51977         name: name$7,
51978         type: type$7,
51979         color: color$7,
51980         extensions: extensions$7,
51981         tmScope: tmScope$7,
51982         aceMode: aceMode$7,
51983         codemirrorMode: codemirrorMode$4,
51984         codemirrorMimeType: codemirrorMimeType$4,
51985         languageId: languageId$7
51986 };
51987
51988 var name$6 = "SCSS";
51989 var type$6 = "markup";
51990 var color$6 = "#c6538c";
51991 var tmScope$6 = "source.css.scss";
51992 var aceMode$6 = "scss";
51993 var codemirrorMode$3 = "css";
51994 var codemirrorMimeType$3 = "text/x-scss";
51995 var extensions$6 = [
51996         ".scss"
51997 ];
51998 var languageId$6 = 329;
51999 var require$$7 = {
52000         name: name$6,
52001         type: type$6,
52002         color: color$6,
52003         tmScope: tmScope$6,
52004         aceMode: aceMode$6,
52005         codemirrorMode: codemirrorMode$3,
52006         codemirrorMimeType: codemirrorMimeType$3,
52007         extensions: extensions$6,
52008         languageId: languageId$6
52009 };
52010
52011 const createLanguage$5 = createLanguage$7;
52012 const printer$5 = printerPostcss;
52013 const options$8 = options$9;
52014 const parsers$a = parsers$b;
52015 const languages$6 = [createLanguage$5(require$$4$5, data => ({
52016   since: "1.4.0",
52017   parsers: ["css"],
52018   vscodeLanguageIds: ["css"],
52019   extensions: [...data.extensions, // `WeiXin Style Sheets`(Weixin Mini Programs)
52020   // https://developers.weixin.qq.com/miniprogram/en/dev/framework/view/wxs/
52021   ".wxss"]
52022 })), createLanguage$5(require$$5$1, () => ({
52023   since: "1.4.0",
52024   parsers: ["css"],
52025   vscodeLanguageIds: ["postcss"]
52026 })), createLanguage$5(require$$6, () => ({
52027   since: "1.4.0",
52028   parsers: ["less"],
52029   vscodeLanguageIds: ["less"]
52030 })), createLanguage$5(require$$7, () => ({
52031   since: "1.4.0",
52032   parsers: ["scss"],
52033   vscodeLanguageIds: ["scss"]
52034 }))];
52035 const printers$4 = {
52036   postcss: printer$5
52037 };
52038 var languageCss = {
52039   languages: languages$6,
52040   options: options$8,
52041   printers: printers$4,
52042   parsers: parsers$a
52043 };
52044
52045 function locStart$c(node) {
52046   return node.loc.start.offset;
52047 }
52048
52049 function locEnd$b(node) {
52050   return node.loc.end.offset;
52051 }
52052
52053 var loc$4 = {
52054   locStart: locStart$c,
52055   locEnd: locEnd$b
52056 };
52057
52058 function clean$7(ast, newNode
52059 /*, parent*/
52060 ) {
52061   // (Glimmer/HTML) ignore TextNode
52062   if (ast.type === "TextNode") {
52063     const trimmed = ast.chars.trim();
52064
52065     if (!trimmed) {
52066       return null;
52067     }
52068
52069     newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " ");
52070   } // `class` is reformatted
52071
52072
52073   if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") {
52074     delete newNode.value;
52075   }
52076 }
52077
52078 clean$7.ignoredProperties = new Set(["loc", "selfClosing"]);
52079 var clean_1$2 = clean$7;
52080
52081 var require$$0$1 = [
52082         "area",
52083         "base",
52084         "basefont",
52085         "bgsound",
52086         "br",
52087         "col",
52088         "command",
52089         "embed",
52090         "frame",
52091         "hr",
52092         "image",
52093         "img",
52094         "input",
52095         "isindex",
52096         "keygen",
52097         "link",
52098         "menuitem",
52099         "meta",
52100         "nextid",
52101         "param",
52102         "source",
52103         "track",
52104         "wbr"
52105 ];
52106
52107 const htmlVoidElements = require$$0$1;
52108 const getLast$6 = getLast_1;
52109
52110 function isLastNodeOfSiblings$1(path) {
52111   const node = path.getValue();
52112   const parentNode = path.getParentNode(0);
52113
52114   if (isParentOfSomeType$1(path, ["ElementNode"]) && getLast$6(parentNode.children) === node) {
52115     return true;
52116   }
52117
52118   if (isParentOfSomeType$1(path, ["Block"]) && getLast$6(parentNode.body) === node) {
52119     return true;
52120   }
52121
52122   return false;
52123 }
52124
52125 function isUppercase(string) {
52126   return string.toUpperCase() === string;
52127 }
52128
52129 function isGlimmerComponent(node) {
52130   return isNodeOfSomeType$1(node, ["ElementNode"]) && typeof node.tag === "string" && (isUppercase(node.tag[0]) || node.tag.includes("."));
52131 }
52132
52133 const voidTags = new Set(htmlVoidElements);
52134
52135 function isVoid$1(node) {
52136   return isGlimmerComponent(node) && node.children.every(node => isWhitespaceNode$1(node)) || voidTags.has(node.tag);
52137 }
52138
52139 function isWhitespaceNode$1(node) {
52140   return isNodeOfSomeType$1(node, ["TextNode"]) && !/\S/.test(node.chars);
52141 }
52142
52143 function isNodeOfSomeType$1(node, types) {
52144   return node && types.includes(node.type);
52145 }
52146
52147 function isParentOfSomeType$1(path, types) {
52148   const parentNode = path.getParentNode(0);
52149   return isNodeOfSomeType$1(parentNode, types);
52150 }
52151
52152 function isPreviousNodeOfSomeType$1(path, types) {
52153   const previousNode = getPreviousNode$1(path);
52154   return isNodeOfSomeType$1(previousNode, types);
52155 }
52156
52157 function isNextNodeOfSomeType$1(path, types) {
52158   const nextNode = getNextNode$1(path);
52159   return isNodeOfSomeType$1(nextNode, types);
52160 }
52161
52162 function getSiblingNode(path, offset) {
52163   const node = path.getValue();
52164   const parentNode = path.getParentNode(0) || {};
52165   const children = parentNode.children || parentNode.body || parentNode.parts || [];
52166   const index = children.indexOf(node);
52167   return index !== -1 && children[index + offset];
52168 }
52169
52170 function getPreviousNode$1(path, lookBack = 1) {
52171   return getSiblingNode(path, -lookBack);
52172 }
52173
52174 function getNextNode$1(path) {
52175   return getSiblingNode(path, 1);
52176 }
52177
52178 function isPrettierIgnoreNode(node) {
52179   return isNodeOfSomeType$1(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
52180 }
52181
52182 function hasPrettierIgnore$8(path) {
52183   const node = path.getValue();
52184   const previousPreviousNode = getPreviousNode$1(path, 2);
52185   return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
52186 }
52187
52188 var utils$3 = {
52189   getNextNode: getNextNode$1,
52190   getPreviousNode: getPreviousNode$1,
52191   hasPrettierIgnore: hasPrettierIgnore$8,
52192   isLastNodeOfSiblings: isLastNodeOfSiblings$1,
52193   isNextNodeOfSomeType: isNextNodeOfSomeType$1,
52194   isNodeOfSomeType: isNodeOfSomeType$1,
52195   isParentOfSomeType: isParentOfSomeType$1,
52196   isPreviousNodeOfSomeType: isPreviousNodeOfSomeType$1,
52197   isVoid: isVoid$1,
52198   isWhitespaceNode: isWhitespaceNode$1
52199 };
52200
52201 const {
52202   builders: {
52203     dedent: dedent$1,
52204     fill: fill$5,
52205     group: group$9,
52206     hardline: hardline$b,
52207     ifBreak: ifBreak$7,
52208     indent: indent$5,
52209     join: join$9,
52210     line: line$c,
52211     softline: softline$8
52212   },
52213   utils: {
52214     getDocParts: getDocParts$4,
52215     replaceTextEndOfLine: replaceTextEndOfLine$8
52216   }
52217 } = require$$7$3;
52218 const {
52219   getPreferredQuote,
52220   isNonEmptyArray: isNonEmptyArray$4
52221 } = util$8;
52222 const {
52223   locStart: locStart$b,
52224   locEnd: locEnd$a
52225 } = loc$4;
52226 const clean$6 = clean_1$2;
52227 const {
52228   getNextNode,
52229   getPreviousNode,
52230   hasPrettierIgnore: hasPrettierIgnore$7,
52231   isLastNodeOfSiblings,
52232   isNextNodeOfSomeType,
52233   isNodeOfSomeType,
52234   isParentOfSomeType,
52235   isPreviousNodeOfSomeType,
52236   isVoid,
52237   isWhitespaceNode
52238 } = utils$3;
52239 const NEWLINES_TO_PRESERVE_MAX = 2; // Formatter based on @glimmerjs/syntax's built-in test formatter:
52240 // https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/generation/print.ts
52241
52242 function print(path, options, print) {
52243   const node = path.getValue();
52244   /* istanbul ignore if*/
52245
52246   if (!node) {
52247     return "";
52248   }
52249
52250   if (hasPrettierIgnore$7(path)) {
52251     return options.originalText.slice(locStart$b(node), locEnd$a(node));
52252   }
52253
52254   const favoriteQuote = options.singleQuote ? "'" : '"';
52255
52256   switch (node.type) {
52257     case "Block":
52258     case "Program":
52259     case "Template":
52260       {
52261         return group$9(path.map(print, "body"));
52262       }
52263
52264     case "ElementNode":
52265       {
52266         const startingTag = group$9(printStartingTag(path, print));
52267         const escapeNextElementNode = options.htmlWhitespaceSensitivity === "ignore" && isNextNodeOfSomeType(path, ["ElementNode"]) ? softline$8 : "";
52268
52269         if (isVoid(node)) {
52270           return [startingTag, escapeNextElementNode];
52271         }
52272
52273         const endingTag = ["</", node.tag, ">"];
52274
52275         if (node.children.length === 0) {
52276           return [startingTag, indent$5(endingTag), escapeNextElementNode];
52277         }
52278
52279         if (options.htmlWhitespaceSensitivity === "ignore") {
52280           return [startingTag, indent$5(printChildren$5(path, options, print)), hardline$b, indent$5(endingTag), escapeNextElementNode];
52281         }
52282
52283         return [startingTag, indent$5(group$9(printChildren$5(path, options, print))), indent$5(endingTag), escapeNextElementNode];
52284       }
52285
52286     case "BlockStatement":
52287       {
52288         const pp = path.getParentNode(1);
52289         const isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === node && pp.inverse.body[0].path.parts[0] === "if";
52290
52291         if (isElseIf) {
52292           return [printElseIfBlock(path, print), printProgram(path, print, options), printInverse(path, print, options)];
52293         }
52294
52295         return [printOpenBlock(path, print), group$9([printProgram(path, print, options), printInverse(path, print, options), printCloseBlock(path, print, options)])];
52296       }
52297
52298     case "ElementModifierStatement":
52299       {
52300         return group$9(["{{", printPathAndParams(path, print), "}}"]);
52301       }
52302
52303     case "MustacheStatement":
52304       {
52305         return group$9([printOpeningMustache(node), printPathAndParams(path, print), printClosingMustache(node)]);
52306       }
52307
52308     case "SubExpression":
52309       {
52310         return group$9(["(", printSubExpressionPathAndParams(path, print), softline$8, ")"]);
52311       }
52312
52313     case "AttrNode":
52314       {
52315         const isText = node.value.type === "TextNode";
52316         const isEmptyText = isText && node.value.chars === ""; // If the text is empty and the value's loc start and end offsets are the
52317         // same, there is no value for this AttrNode and it should be printed
52318         // without the `=""`. Example: `<img data-test>` -> `<img data-test>`
52319
52320         if (isEmptyText && locStart$b(node.value) === locEnd$a(node.value)) {
52321           return node.name;
52322         } // Let's assume quotes inside the content of text nodes are already
52323         // properly escaped with entities, otherwise the parse wouldn't have parsed them.
52324
52325
52326         const quote = isText ? getPreferredQuote(node.value.chars, favoriteQuote).quote : node.value.type === "ConcatStatement" ? getPreferredQuote(node.value.parts.filter(part => part.type === "TextNode").map(part => part.chars).join(""), favoriteQuote).quote : "";
52327         const valueDoc = print("value");
52328         return [node.name, "=", quote, node.name === "class" && quote ? group$9(indent$5(valueDoc)) : valueDoc, quote];
52329       }
52330
52331     case "ConcatStatement":
52332       {
52333         return path.map(print, "parts");
52334       }
52335
52336     case "Hash":
52337       {
52338         return join$9(line$c, path.map(print, "pairs"));
52339       }
52340
52341     case "HashPair":
52342       {
52343         return [node.key, "=", print("value")];
52344       }
52345
52346     case "TextNode":
52347       {
52348         /* if `{{my-component}}` (or any text containing "{{")
52349          * makes it to the TextNode, it means it was escaped,
52350          * so let's print it escaped, ie.; `\{{my-component}}` */
52351         let text = node.chars.replace(/{{/g, "\\{{");
52352         const attrName = getCurrentAttributeName(path);
52353
52354         if (attrName) {
52355           // TODO: format style and srcset attributes
52356           if (attrName === "class") {
52357             const formattedClasses = text.trim().split(/\s+/).join(" ");
52358             let leadingSpace = false;
52359             let trailingSpace = false;
52360
52361             if (isParentOfSomeType(path, ["ConcatStatement"])) {
52362               if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(text)) {
52363                 leadingSpace = true;
52364               }
52365
52366               if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(text) && formattedClasses !== "") {
52367                 trailingSpace = true;
52368               }
52369             }
52370
52371             return [leadingSpace ? line$c : "", formattedClasses, trailingSpace ? line$c : ""];
52372           }
52373
52374           return replaceTextEndOfLine$8(text);
52375         }
52376
52377         const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
52378         const isWhitespaceOnly = whitespacesOnlyRE.test(text);
52379         const isFirstElement = !getPreviousNode(path);
52380         const isLastElement = !getNextNode(path);
52381
52382         if (options.htmlWhitespaceSensitivity !== "ignore") {
52383           // https://infra.spec.whatwg.org/#ascii-whitespace
52384           const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
52385           const trailingWhitespacesRE = /[\t\n\f\r ]*$/; // let's remove the file's final newline
52386           // https://github.com/ember-cli/ember-new-output/blob/1a04c67ddd02ccb35e0ff41bb5cbce34b31173ef/.editorconfig#L16
52387
52388           const shouldTrimTrailingNewlines = isLastElement && isParentOfSomeType(path, ["Template"]);
52389           const shouldTrimLeadingNewlines = isFirstElement && isParentOfSomeType(path, ["Template"]);
52390
52391           if (isWhitespaceOnly) {
52392             if (shouldTrimLeadingNewlines || shouldTrimTrailingNewlines) {
52393               return "";
52394             }
52395
52396             let breaks = [line$c];
52397             const newlines = countNewLines(text);
52398
52399             if (newlines) {
52400               breaks = generateHardlines(newlines);
52401             }
52402
52403             if (isLastNodeOfSiblings(path)) {
52404               breaks = breaks.map(newline => dedent$1(newline));
52405             }
52406
52407             return breaks;
52408           }
52409
52410           const [lead] = text.match(leadingWhitespacesRE);
52411           const [tail] = text.match(trailingWhitespacesRE);
52412           let leadBreaks = [];
52413
52414           if (lead) {
52415             leadBreaks = [line$c];
52416             const leadingNewlines = countNewLines(lead);
52417
52418             if (leadingNewlines) {
52419               leadBreaks = generateHardlines(leadingNewlines);
52420             }
52421
52422             text = text.replace(leadingWhitespacesRE, "");
52423           }
52424
52425           let trailBreaks = [];
52426
52427           if (tail) {
52428             if (!shouldTrimTrailingNewlines) {
52429               trailBreaks = [line$c];
52430               const trailingNewlines = countNewLines(tail);
52431
52432               if (trailingNewlines) {
52433                 trailBreaks = generateHardlines(trailingNewlines);
52434               }
52435
52436               if (isLastNodeOfSiblings(path)) {
52437                 trailBreaks = trailBreaks.map(hardline => dedent$1(hardline));
52438               }
52439             }
52440
52441             text = text.replace(trailingWhitespacesRE, "");
52442           }
52443
52444           return [...leadBreaks, fill$5(getTextValueParts$3(text)), ...trailBreaks];
52445         }
52446
52447         const lineBreaksCount = countNewLines(text);
52448         let leadingLineBreaksCount = countLeadingNewLines(text);
52449         let trailingLineBreaksCount = countTrailingNewLines(text);
52450
52451         if ((isFirstElement || isLastElement) && isWhitespaceOnly && isParentOfSomeType(path, ["Block", "ElementNode", "Template"])) {
52452           return "";
52453         }
52454
52455         if (isWhitespaceOnly && lineBreaksCount) {
52456           leadingLineBreaksCount = Math.min(lineBreaksCount, NEWLINES_TO_PRESERVE_MAX);
52457           trailingLineBreaksCount = 0;
52458         } else {
52459           if (isNextNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
52460             trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
52461           }
52462
52463           if (isPreviousNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
52464             leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
52465           }
52466         }
52467
52468         let leadingSpace = "";
52469         let trailingSpace = "";
52470
52471         if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType(path, ["MustacheStatement"])) {
52472           trailingSpace = " ";
52473         }
52474
52475         if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
52476           leadingSpace = " ";
52477         }
52478
52479         if (isFirstElement) {
52480           leadingLineBreaksCount = 0;
52481           leadingSpace = "";
52482         }
52483
52484         if (isLastElement) {
52485           trailingLineBreaksCount = 0;
52486           trailingSpace = "";
52487         }
52488
52489         text = text.replace(/^[\t\n\f\r ]+/g, leadingSpace).replace(/[\t\n\f\r ]+$/, trailingSpace);
52490         return [...generateHardlines(leadingLineBreaksCount), fill$5(getTextValueParts$3(text)), ...generateHardlines(trailingLineBreaksCount)];
52491       }
52492
52493     case "MustacheCommentStatement":
52494       {
52495         const start = locStart$b(node);
52496         const end = locEnd$a(node); // Starts with `{{~`
52497
52498         const isLeftWhiteSpaceSensitive = options.originalText.charAt(start + 2) === "~"; // Ends with `{{~`
52499
52500         const isRightWhitespaceSensitive = options.originalText.charAt(end - 3) === "~";
52501         const dashes = node.value.includes("}}") ? "--" : "";
52502         return ["{{", isLeftWhiteSpaceSensitive ? "~" : "", "!", dashes, node.value, dashes, isRightWhitespaceSensitive ? "~" : "", "}}"];
52503       }
52504
52505     case "PathExpression":
52506       {
52507         return node.original;
52508       }
52509
52510     case "BooleanLiteral":
52511       {
52512         return String(node.value);
52513       }
52514
52515     case "CommentStatement":
52516       {
52517         return ["<!--", node.value, "-->"];
52518       }
52519
52520     case "StringLiteral":
52521       {
52522         if (needsOppositeQuote(path)) {
52523           const printFavoriteQuote = !options.singleQuote ? "'" : '"';
52524           return printStringLiteral(node.value, printFavoriteQuote);
52525         }
52526
52527         return printStringLiteral(node.value, favoriteQuote);
52528       }
52529
52530     case "NumberLiteral":
52531       {
52532         return String(node.value);
52533       }
52534
52535     case "UndefinedLiteral":
52536       {
52537         return "undefined";
52538       }
52539
52540     case "NullLiteral":
52541       {
52542         return "null";
52543       }
52544
52545     /* istanbul ignore next */
52546
52547     default:
52548       throw new Error("unknown glimmer type: " + JSON.stringify(node.type));
52549   }
52550 }
52551 /* ElementNode print helpers */
52552
52553
52554 function sortByLoc(a, b) {
52555   return locStart$b(a) - locStart$b(b);
52556 }
52557
52558 function printStartingTag(path, print) {
52559   const node = path.getValue();
52560   const types = ["attributes", "modifiers", "comments"].filter(property => isNonEmptyArray$4(node[property]));
52561   const attributes = types.flatMap(type => node[type]).sort(sortByLoc);
52562
52563   for (const attributeType of types) {
52564     path.each(attributePath => {
52565       const index = attributes.indexOf(attributePath.getValue());
52566       attributes.splice(index, 1, [line$c, print()]);
52567     }, attributeType);
52568   }
52569
52570   if (isNonEmptyArray$4(node.blockParams)) {
52571     attributes.push(line$c, printBlockParams(node));
52572   }
52573
52574   return ["<", node.tag, indent$5(attributes), printStartingTagEndMarker(node)];
52575 }
52576
52577 function printChildren$5(path, options, print) {
52578   const node = path.getValue();
52579   const isEmpty = node.children.every(node => isWhitespaceNode(node));
52580
52581   if (options.htmlWhitespaceSensitivity === "ignore" && isEmpty) {
52582     return "";
52583   }
52584
52585   return path.map((childPath, childIndex) => {
52586     const printedChild = print();
52587
52588     if (childIndex === 0 && options.htmlWhitespaceSensitivity === "ignore") {
52589       return [softline$8, printedChild];
52590     }
52591
52592     return printedChild;
52593   }, "children");
52594 }
52595
52596 function printStartingTagEndMarker(node) {
52597   if (isVoid(node)) {
52598     return ifBreak$7([softline$8, "/>"], [" />", softline$8]);
52599   }
52600
52601   return ifBreak$7([softline$8, ">"], ">");
52602 }
52603 /* MustacheStatement print helpers */
52604
52605
52606 function printOpeningMustache(node) {
52607   const mustache = node.escaped === false ? "{{{" : "{{";
52608   const strip = node.strip && node.strip.open ? "~" : "";
52609   return [mustache, strip];
52610 }
52611
52612 function printClosingMustache(node) {
52613   const mustache = node.escaped === false ? "}}}" : "}}";
52614   const strip = node.strip && node.strip.close ? "~" : "";
52615   return [strip, mustache];
52616 }
52617 /* BlockStatement print helpers */
52618
52619
52620 function printOpeningBlockOpeningMustache(node) {
52621   const opening = printOpeningMustache(node);
52622   const strip = node.openStrip.open ? "~" : "";
52623   return [opening, strip, "#"];
52624 }
52625
52626 function printOpeningBlockClosingMustache(node) {
52627   const closing = printClosingMustache(node);
52628   const strip = node.openStrip.close ? "~" : "";
52629   return [strip, closing];
52630 }
52631
52632 function printClosingBlockOpeningMustache(node) {
52633   const opening = printOpeningMustache(node);
52634   const strip = node.closeStrip.open ? "~" : "";
52635   return [opening, strip, "/"];
52636 }
52637
52638 function printClosingBlockClosingMustache(node) {
52639   const closing = printClosingMustache(node);
52640   const strip = node.closeStrip.close ? "~" : "";
52641   return [strip, closing];
52642 }
52643
52644 function printInverseBlockOpeningMustache(node) {
52645   const opening = printOpeningMustache(node);
52646   const strip = node.inverseStrip.open ? "~" : "";
52647   return [opening, strip];
52648 }
52649
52650 function printInverseBlockClosingMustache(node) {
52651   const closing = printClosingMustache(node);
52652   const strip = node.inverseStrip.close ? "~" : "";
52653   return [strip, closing];
52654 }
52655
52656 function printOpenBlock(path, print) {
52657   const node = path.getValue();
52658   const openingMustache = printOpeningBlockOpeningMustache(node);
52659   const closingMustache = printOpeningBlockClosingMustache(node);
52660   const attributes = [printPath(path, print)];
52661   const params = printParams(path, print);
52662
52663   if (params) {
52664     attributes.push(line$c, params);
52665   }
52666
52667   if (isNonEmptyArray$4(node.program.blockParams)) {
52668     const block = printBlockParams(node.program);
52669     attributes.push(line$c, block);
52670   }
52671
52672   return group$9([openingMustache, indent$5(attributes), softline$8, closingMustache]);
52673 }
52674
52675 function printElseBlock(node, options) {
52676   return [options.htmlWhitespaceSensitivity === "ignore" ? hardline$b : "", printInverseBlockOpeningMustache(node), "else", printInverseBlockClosingMustache(node)];
52677 }
52678
52679 function printElseIfBlock(path, print) {
52680   const parentNode = path.getParentNode(1);
52681   return [printInverseBlockOpeningMustache(parentNode), "else if ", printParams(path, print), printInverseBlockClosingMustache(parentNode)];
52682 }
52683
52684 function printCloseBlock(path, print, options) {
52685   const node = path.getValue();
52686
52687   if (options.htmlWhitespaceSensitivity === "ignore") {
52688     const escape = blockStatementHasOnlyWhitespaceInProgram(node) ? softline$8 : hardline$b;
52689     return [escape, printClosingBlockOpeningMustache(node), print("path"), printClosingBlockClosingMustache(node)];
52690   }
52691
52692   return [printClosingBlockOpeningMustache(node), print("path"), printClosingBlockClosingMustache(node)];
52693 }
52694
52695 function blockStatementHasOnlyWhitespaceInProgram(node) {
52696   return isNodeOfSomeType(node, ["BlockStatement"]) && node.program.body.every(node => isWhitespaceNode(node));
52697 }
52698
52699 function blockStatementHasElseIf(node) {
52700   return blockStatementHasElse(node) && node.inverse.body.length === 1 && isNodeOfSomeType(node.inverse.body[0], ["BlockStatement"]) && node.inverse.body[0].path.parts[0] === "if";
52701 }
52702
52703 function blockStatementHasElse(node) {
52704   return isNodeOfSomeType(node, ["BlockStatement"]) && node.inverse;
52705 }
52706
52707 function printProgram(path, print, options) {
52708   const node = path.getValue();
52709
52710   if (blockStatementHasOnlyWhitespaceInProgram(node)) {
52711     return "";
52712   }
52713
52714   const program = print("program");
52715
52716   if (options.htmlWhitespaceSensitivity === "ignore") {
52717     return indent$5([hardline$b, program]);
52718   }
52719
52720   return indent$5(program);
52721 }
52722
52723 function printInverse(path, print, options) {
52724   const node = path.getValue();
52725   const inverse = print("inverse");
52726   const printed = options.htmlWhitespaceSensitivity === "ignore" ? [hardline$b, inverse] : inverse;
52727
52728   if (blockStatementHasElseIf(node)) {
52729     return printed;
52730   }
52731
52732   if (blockStatementHasElse(node)) {
52733     return [printElseBlock(node, options), indent$5(printed)];
52734   }
52735
52736   return "";
52737 }
52738 /* TextNode print helpers */
52739
52740
52741 function getTextValueParts$3(value) {
52742   return getDocParts$4(join$9(line$c, splitByHtmlWhitespace$1(value)));
52743 }
52744
52745 function splitByHtmlWhitespace$1(string) {
52746   return string.split(/[\t\n\f\r ]+/);
52747 }
52748
52749 function getCurrentAttributeName(path) {
52750   for (let depth = 0; depth < 2; depth++) {
52751     const parentNode = path.getParentNode(depth);
52752
52753     if (parentNode && parentNode.type === "AttrNode") {
52754       return parentNode.name.toLowerCase();
52755     }
52756   }
52757 }
52758
52759 function countNewLines(string) {
52760   /* istanbul ignore next */
52761   string = typeof string === "string" ? string : "";
52762   return string.split("\n").length - 1;
52763 }
52764
52765 function countLeadingNewLines(string) {
52766   /* istanbul ignore next */
52767   string = typeof string === "string" ? string : "";
52768   const newLines = (string.match(/^([^\S\n\r]*[\n\r])+/g) || [])[0] || "";
52769   return countNewLines(newLines);
52770 }
52771
52772 function countTrailingNewLines(string) {
52773   /* istanbul ignore next */
52774   string = typeof string === "string" ? string : "";
52775   const newLines = (string.match(/([\n\r][^\S\n\r]*)+$/g) || [])[0] || "";
52776   return countNewLines(newLines);
52777 }
52778
52779 function generateHardlines(number = 0) {
52780   return Array.from({
52781     length: Math.min(number, NEWLINES_TO_PRESERVE_MAX)
52782   }).fill(hardline$b);
52783 }
52784 /* StringLiteral print helpers */
52785
52786 /** @typedef {import("../common/util").Quote} Quote */
52787
52788 /**
52789  * Prints a string literal with the correct surrounding quotes based on
52790  * `options.singleQuote` and the number of escaped quotes contained in
52791  * the string literal. This function is the glimmer equivalent of `printString`
52792  * in `common/util`, but has differences because of the way escaped characters
52793  * are treated in hbs string literals.
52794  * @param {string} stringLiteral - the string literal value
52795  * @param {Quote} favoriteQuote - the user's preferred quote: `'` or `"`
52796  */
52797
52798
52799 function printStringLiteral(stringLiteral, favoriteQuote) {
52800   const {
52801     quote,
52802     regex
52803   } = getPreferredQuote(stringLiteral, favoriteQuote);
52804   return [quote, stringLiteral.replace(regex, `\\${quote}`), quote];
52805 }
52806
52807 function needsOppositeQuote(path) {
52808   let index = 0;
52809   let parentNode = path.getParentNode(index);
52810
52811   while (parentNode && isNodeOfSomeType(parentNode, ["SubExpression"])) {
52812     index++;
52813     parentNode = path.getParentNode(index);
52814   }
52815
52816   if (parentNode && isNodeOfSomeType(path.getParentNode(index + 1), ["ConcatStatement"]) && isNodeOfSomeType(path.getParentNode(index + 2), ["AttrNode"])) {
52817     return true;
52818   }
52819
52820   return false;
52821 }
52822 /* SubExpression print helpers */
52823
52824
52825 function printSubExpressionPathAndParams(path, print) {
52826   const p = printPath(path, print);
52827   const params = printParams(path, print);
52828
52829   if (!params) {
52830     return p;
52831   }
52832
52833   return indent$5([p, line$c, group$9(params)]);
52834 }
52835 /* misc. print helpers */
52836
52837
52838 function printPathAndParams(path, print) {
52839   const p = printPath(path, print);
52840   const params = printParams(path, print);
52841
52842   if (!params) {
52843     return p;
52844   }
52845
52846   return [indent$5([p, line$c, params]), softline$8];
52847 }
52848
52849 function printPath(path, print) {
52850   return print("path");
52851 }
52852
52853 function printParams(path, print) {
52854   const node = path.getValue();
52855   const parts = [];
52856
52857   if (node.params.length > 0) {
52858     const params = path.map(print, "params");
52859     parts.push(...params);
52860   }
52861
52862   if (node.hash && node.hash.pairs.length > 0) {
52863     const hash = print("hash");
52864     parts.push(hash);
52865   }
52866
52867   if (parts.length === 0) {
52868     return "";
52869   }
52870
52871   return join$9(line$c, parts);
52872 }
52873
52874 function printBlockParams(node) {
52875   return ["as |", node.blockParams.join(" "), "|"];
52876 }
52877
52878 var printerGlimmer = {
52879   print,
52880   massageAstNode: clean$6
52881 };
52882
52883 var parsers$9 = {
52884   get glimmer() {
52885     return require("./parser-glimmer.js").parsers.glimmer;
52886   }
52887
52888 };
52889
52890 var name$5 = "Handlebars";
52891 var type$5 = "markup";
52892 var color$5 = "#f7931e";
52893 var aliases$3 = [
52894         "hbs",
52895         "htmlbars"
52896 ];
52897 var extensions$5 = [
52898         ".handlebars",
52899         ".hbs"
52900 ];
52901 var tmScope$5 = "text.html.handlebars";
52902 var aceMode$5 = "handlebars";
52903 var languageId$5 = 155;
52904 var require$$3 = {
52905         name: name$5,
52906         type: type$5,
52907         color: color$5,
52908         aliases: aliases$3,
52909         extensions: extensions$5,
52910         tmScope: tmScope$5,
52911         aceMode: aceMode$5,
52912         languageId: languageId$5
52913 };
52914
52915 const createLanguage$4 = createLanguage$7;
52916 const printer$4 = printerGlimmer;
52917 const parsers$8 = parsers$9;
52918 const languages$5 = [createLanguage$4(require$$3, () => ({
52919   since: "2.3.0",
52920   parsers: ["glimmer"],
52921   vscodeLanguageIds: ["handlebars"]
52922 }))];
52923 const printers$3 = {
52924   glimmer: printer$4
52925 };
52926 var languageHandlebars = {
52927   languages: languages$5,
52928   printers: printers$3,
52929   parsers: parsers$8
52930 };
52931
52932 function hasPragma$2(text) {
52933   return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(text);
52934 }
52935
52936 function insertPragma$6(text) {
52937   return "# @format\n\n" + text;
52938 }
52939
52940 var pragma$3 = {
52941   hasPragma: hasPragma$2,
52942   insertPragma: insertPragma$6
52943 };
52944
52945 function locStart$a(node) {
52946   if (typeof node.start === "number") {
52947     return node.start;
52948   }
52949
52950   return node.loc && node.loc.start;
52951 }
52952
52953 function locEnd$9(node) {
52954   if (typeof node.end === "number") {
52955     return node.end;
52956   }
52957
52958   return node.loc && node.loc.end;
52959 }
52960
52961 var loc$3 = {
52962   locStart: locStart$a,
52963   locEnd: locEnd$9
52964 };
52965
52966 const {
52967   builders: {
52968     join: join$8,
52969     hardline: hardline$a,
52970     line: line$b,
52971     softline: softline$7,
52972     group: group$8,
52973     indent: indent$4,
52974     ifBreak: ifBreak$6
52975   }
52976 } = require$$7$3;
52977 const {
52978   isNextLineEmpty: isNextLineEmpty$2,
52979   isNonEmptyArray: isNonEmptyArray$3
52980 } = util$8;
52981 const {
52982   insertPragma: insertPragma$5
52983 } = pragma$3;
52984 const {
52985   locStart: locStart$9,
52986   locEnd: locEnd$8
52987 } = loc$3;
52988
52989 function genericPrint$3(path, options, print) {
52990   const node = path.getValue();
52991
52992   if (!node) {
52993     return "";
52994   }
52995
52996   if (typeof node === "string") {
52997     return node;
52998   }
52999
53000   switch (node.kind) {
53001     case "Document":
53002       {
53003         const parts = [];
53004         path.each((pathChild, index, definitions) => {
53005           parts.push(print());
53006
53007           if (index !== definitions.length - 1) {
53008             parts.push(hardline$a);
53009
53010             if (isNextLineEmpty$2(options.originalText, pathChild.getValue(), locEnd$8)) {
53011               parts.push(hardline$a);
53012             }
53013           }
53014         }, "definitions");
53015         return [...parts, hardline$a];
53016       }
53017
53018     case "OperationDefinition":
53019       {
53020         const hasOperation = options.originalText[locStart$9(node)] !== "{";
53021         const hasName = Boolean(node.name);
53022         return [hasOperation ? node.operation : "", hasOperation && hasName ? [" ", print("name")] : "", hasOperation && !hasName && isNonEmptyArray$3(node.variableDefinitions) ? " " : "", isNonEmptyArray$3(node.variableDefinitions) ? group$8(["(", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.map(print, "variableDefinitions"))]), softline$7, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? !hasOperation && !hasName ? "" : " " : "", print("selectionSet")];
53023       }
53024
53025     case "FragmentDefinition":
53026       {
53027         return ["fragment ", print("name"), isNonEmptyArray$3(node.variableDefinitions) ? group$8(["(", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.map(print, "variableDefinitions"))]), softline$7, ")"]) : "", " on ", print("typeCondition"), printDirectives(path, print, node), " ", print("selectionSet")];
53028       }
53029
53030     case "SelectionSet":
53031       {
53032         return ["{", indent$4([hardline$a, join$8(hardline$a, path.call(selectionsPath => printSequence(selectionsPath, options, print), "selections"))]), hardline$a, "}"];
53033       }
53034
53035     case "Field":
53036       {
53037         return group$8([node.alias ? [print("alias"), ": "] : "", print("name"), node.arguments.length > 0 ? group$8(["(", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.call(argsPath => printSequence(argsPath, options, print), "arguments"))]), softline$7, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? " " : "", print("selectionSet")]);
53038       }
53039
53040     case "Name":
53041       {
53042         return node.value;
53043       }
53044
53045     case "StringValue":
53046       {
53047         if (node.block) {
53048           return ['"""', hardline$a, join$8(hardline$a, node.value.replace(/"""/g, "\\$&").split("\n")), hardline$a, '"""'];
53049         }
53050
53051         return ['"', node.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"'];
53052       }
53053
53054     case "IntValue":
53055     case "FloatValue":
53056     case "EnumValue":
53057       {
53058         return node.value;
53059       }
53060
53061     case "BooleanValue":
53062       {
53063         return node.value ? "true" : "false";
53064       }
53065
53066     case "NullValue":
53067       {
53068         return "null";
53069       }
53070
53071     case "Variable":
53072       {
53073         return ["$", print("name")];
53074       }
53075
53076     case "ListValue":
53077       {
53078         return group$8(["[", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.map(print, "values"))]), softline$7, "]"]);
53079       }
53080
53081     case "ObjectValue":
53082       {
53083         return group$8(["{", options.bracketSpacing && node.fields.length > 0 ? " " : "", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.map(print, "fields"))]), softline$7, ifBreak$6("", options.bracketSpacing && node.fields.length > 0 ? " " : ""), "}"]);
53084       }
53085
53086     case "ObjectField":
53087     case "Argument":
53088       {
53089         return [print("name"), ": ", print("value")];
53090       }
53091
53092     case "Directive":
53093       {
53094         return ["@", print("name"), node.arguments.length > 0 ? group$8(["(", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.call(argsPath => printSequence(argsPath, options, print), "arguments"))]), softline$7, ")"]) : ""];
53095       }
53096
53097     case "NamedType":
53098       {
53099         return print("name");
53100       }
53101
53102     case "VariableDefinition":
53103       {
53104         return [print("variable"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
53105       }
53106
53107     case "ObjectTypeExtension":
53108     case "ObjectTypeDefinition":
53109       {
53110         return [print("description"), node.description ? hardline$a : "", node.kind === "ObjectTypeExtension" ? "extend " : "", "type ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent$4([hardline$a, join$8(hardline$a, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))]), hardline$a, "}"] : ""];
53111       }
53112
53113     case "FieldDefinition":
53114       {
53115         return [print("description"), node.description ? hardline$a : "", print("name"), node.arguments.length > 0 ? group$8(["(", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.call(argsPath => printSequence(argsPath, options, print), "arguments"))]), softline$7, ")"]) : "", ": ", print("type"), printDirectives(path, print, node)];
53116       }
53117
53118     case "DirectiveDefinition":
53119       {
53120         return [print("description"), node.description ? hardline$a : "", "directive ", "@", print("name"), node.arguments.length > 0 ? group$8(["(", indent$4([softline$7, join$8([ifBreak$6("", ", "), softline$7], path.call(argsPath => printSequence(argsPath, options, print), "arguments"))]), softline$7, ")"]) : "", node.repeatable ? " repeatable" : "", " on ", join$8(" | ", path.map(print, "locations"))];
53121       }
53122
53123     case "EnumTypeExtension":
53124     case "EnumTypeDefinition":
53125       {
53126         return [print("description"), node.description ? hardline$a : "", node.kind === "EnumTypeExtension" ? "extend " : "", "enum ", print("name"), printDirectives(path, print, node), node.values.length > 0 ? [" {", indent$4([hardline$a, join$8(hardline$a, path.call(valuesPath => printSequence(valuesPath, options, print), "values"))]), hardline$a, "}"] : ""];
53127       }
53128
53129     case "EnumValueDefinition":
53130       {
53131         return [print("description"), node.description ? hardline$a : "", print("name"), printDirectives(path, print, node)];
53132       }
53133
53134     case "InputValueDefinition":
53135       {
53136         return [print("description"), node.description ? node.description.block ? hardline$a : line$b : "", print("name"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
53137       }
53138
53139     case "InputObjectTypeExtension":
53140     case "InputObjectTypeDefinition":
53141       {
53142         return [print("description"), node.description ? hardline$a : "", node.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", print("name"), printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent$4([hardline$a, join$8(hardline$a, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))]), hardline$a, "}"] : ""];
53143       }
53144
53145     case "SchemaDefinition":
53146       {
53147         return ["schema", printDirectives(path, print, node), " {", node.operationTypes.length > 0 ? indent$4([hardline$a, join$8(hardline$a, path.call(opsPath => printSequence(opsPath, options, print), "operationTypes"))]) : "", hardline$a, "}"];
53148       }
53149
53150     case "OperationTypeDefinition":
53151       {
53152         return [print("operation"), ": ", print("type")];
53153       }
53154
53155     case "InterfaceTypeExtension":
53156     case "InterfaceTypeDefinition":
53157       {
53158         return [print("description"), node.description ? hardline$a : "", node.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent$4([hardline$a, join$8(hardline$a, path.call(fieldsPath => printSequence(fieldsPath, options, print), "fields"))]), hardline$a, "}"] : ""];
53159       }
53160
53161     case "FragmentSpread":
53162       {
53163         return ["...", print("name"), printDirectives(path, print, node)];
53164       }
53165
53166     case "InlineFragment":
53167       {
53168         return ["...", node.typeCondition ? [" on ", print("typeCondition")] : "", printDirectives(path, print, node), " ", print("selectionSet")];
53169       }
53170
53171     case "UnionTypeExtension":
53172     case "UnionTypeDefinition":
53173       {
53174         return group$8([print("description"), node.description ? hardline$a : "", group$8([node.kind === "UnionTypeExtension" ? "extend " : "", "union ", print("name"), printDirectives(path, print, node), node.types.length > 0 ? [" =", ifBreak$6("", " "), indent$4([ifBreak$6([line$b, "  "]), join$8([line$b, "| "], path.map(print, "types"))])] : ""])]);
53175       }
53176
53177     case "ScalarTypeExtension":
53178     case "ScalarTypeDefinition":
53179       {
53180         return [print("description"), node.description ? hardline$a : "", node.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", print("name"), printDirectives(path, print, node)];
53181       }
53182
53183     case "NonNullType":
53184       {
53185         return [print("type"), "!"];
53186       }
53187
53188     case "ListType":
53189       {
53190         return ["[", print("type"), "]"];
53191       }
53192
53193     default:
53194       /* istanbul ignore next */
53195       throw new Error("unknown graphql type: " + JSON.stringify(node.kind));
53196   }
53197 }
53198
53199 function printDirectives(path, print, node) {
53200   if (node.directives.length === 0) {
53201     return "";
53202   }
53203
53204   const printed = join$8(line$b, path.map(print, "directives"));
53205
53206   if (node.kind === "FragmentDefinition" || node.kind === "OperationDefinition") {
53207     return group$8([line$b, printed]);
53208   }
53209
53210   return [" ", group$8(indent$4([softline$7, printed]))];
53211 }
53212
53213 function printSequence(sequencePath, options, print) {
53214   const count = sequencePath.getValue().length;
53215   return sequencePath.map((path, i) => {
53216     const printed = print();
53217
53218     if (isNextLineEmpty$2(options.originalText, path.getValue(), locEnd$8) && i < count - 1) {
53219       return [printed, hardline$a];
53220     }
53221
53222     return printed;
53223   });
53224 }
53225
53226 function canAttachComment(node) {
53227   return node.kind && node.kind !== "Comment";
53228 }
53229
53230 function printComment(commentPath) {
53231   const comment = commentPath.getValue();
53232
53233   if (comment.kind === "Comment") {
53234     return "#" + comment.value.trimEnd();
53235   }
53236   /* istanbul ignore next */
53237
53238
53239   throw new Error("Not a comment: " + JSON.stringify(comment));
53240 }
53241
53242 function printInterfaces(path, options, print) {
53243   const node = path.getNode();
53244   const parts = [];
53245   const {
53246     interfaces
53247   } = node;
53248   const printed = path.map(node => print(node), "interfaces");
53249
53250   for (let index = 0; index < interfaces.length; index++) {
53251     const interfaceNode = interfaces[index];
53252     parts.push(printed[index]);
53253     const nextInterfaceNode = interfaces[index + 1];
53254
53255     if (nextInterfaceNode) {
53256       const textBetween = options.originalText.slice(interfaceNode.loc.end, nextInterfaceNode.loc.start);
53257       const hasComment = textBetween.includes("#");
53258       const separator = textBetween.replace(/#.*/g, "").trim();
53259       parts.push(separator === "," ? "," : " &", hasComment ? line$b : " ");
53260     }
53261   }
53262
53263   return parts;
53264 }
53265
53266 function
53267   /*node, newNode , parent*/
53268 clean$5() {}
53269
53270 clean$5.ignoredProperties = new Set(["loc", "comments"]);
53271
53272 function hasPrettierIgnore$6(path) {
53273   const node = path.getValue();
53274   return node && Array.isArray(node.comments) && node.comments.some(comment => comment.value.trim() === "prettier-ignore");
53275 }
53276
53277 var printerGraphql = {
53278   print: genericPrint$3,
53279   massageAstNode: clean$5,
53280   hasPrettierIgnore: hasPrettierIgnore$6,
53281   insertPragma: insertPragma$5,
53282   printComment,
53283   canAttachComment
53284 };
53285
53286 const commonOptions$3 = commonOptions$6; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
53287
53288 var options$7 = {
53289   bracketSpacing: commonOptions$3.bracketSpacing
53290 };
53291
53292 var parsers$7 = {
53293   get graphql() {
53294     return require("./parser-graphql.js").parsers.graphql;
53295   }
53296
53297 };
53298
53299 var name$4 = "GraphQL";
53300 var type$4 = "data";
53301 var color$4 = "#e10098";
53302 var extensions$4 = [
53303         ".graphql",
53304         ".gql",
53305         ".graphqls"
53306 ];
53307 var tmScope$4 = "source.graphql";
53308 var aceMode$4 = "text";
53309 var languageId$4 = 139;
53310 var require$$4$4 = {
53311         name: name$4,
53312         type: type$4,
53313         color: color$4,
53314         extensions: extensions$4,
53315         tmScope: tmScope$4,
53316         aceMode: aceMode$4,
53317         languageId: languageId$4
53318 };
53319
53320 const createLanguage$3 = createLanguage$7;
53321 const printer$3 = printerGraphql;
53322 const options$6 = options$7;
53323 const parsers$6 = parsers$7;
53324 const languages$4 = [createLanguage$3(require$$4$4, () => ({
53325   since: "1.5.0",
53326   parsers: ["graphql"],
53327   vscodeLanguageIds: ["graphql"]
53328 }))];
53329 const printers$2 = {
53330   graphql: printer$3
53331 };
53332 var languageGraphql = {
53333   languages: languages$4,
53334   options: options$6,
53335   printers: printers$2,
53336   parsers: parsers$6
53337 };
53338
53339 function locStart$8(node) {
53340   return node.position.start.offset;
53341 }
53342
53343 function locEnd$7(node) {
53344   return node.position.end.offset;
53345 }
53346
53347 var loc$2 = {
53348   locStart: locStart$8,
53349   locEnd: locEnd$7
53350 };
53351
53352 var require$$2 = {
53353   "cjkPattern": "(?:[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303f\\u3041-\\u3096\\u3099-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u3191\\u3196-\\u31ba\\u31c0-\\u31e3\\u31f0-\\u321e\\u322a-\\u3247\\u3260-\\u327e\\u328a-\\u32b0\\u32c0-\\u32cb\\u32d0-\\u3370\\u337b-\\u337f\\u33e0-\\u33fe\\u3400-\\u4db5\\u4e00-\\u9fef\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufe10-\\ufe1f\\ufe30-\\ufe6f\\uff00-\\uffef]|[\\ud840-\\ud868\\ud86a-\\ud86c\\ud86f-\\ud872\\ud874-\\ud879][\\udc00-\\udfff]|\\ud82c[\\udc00-\\udd1e\\udd50-\\udd52\\udd64-\\udd67]|\\ud83c[\\ude00\\ude50-\\ude51]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d\\udc20-\\udfff]|\\ud873[\\udc00-\\udea1\\udeb0-\\udfff]|\\ud87a[\\udc00-\\udfe0]|\\ud87e[\\udc00-\\ude1d])(?:[\\ufe00-\\ufe0f]|\\udb40[\\udd00-\\uddef])?",
53354   "kPattern": "[\\u1100-\\u11ff\\u3001-\\u3003\\u3008-\\u3011\\u3013-\\u301f\\u302e-\\u3030\\u3037\\u30fb\\u3131-\\u318e\\u3200-\\u321e\\u3260-\\u327e\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\ufe45-\\ufe46\\uff61-\\uff65\\uffa0-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]",
53355   "punctuationPattern": "[\\u0021-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e\\u00a1\\u00a7\\u00ab\\u00b6-\\u00b7\\u00bb\\u00bf\\u037e\\u0387\\u055a-\\u055f\\u0589-\\u058a\\u05be\\u05c0\\u05c3\\u05c6\\u05f3-\\u05f4\\u0609-\\u060a\\u060c-\\u060d\\u061b\\u061e-\\u061f\\u066a-\\u066d\\u06d4\\u0700-\\u070d\\u07f7-\\u07f9\\u0830-\\u083e\\u085e\\u0964-\\u0965\\u0970\\u09fd\\u0a76\\u0af0\\u0c77\\u0c84\\u0df4\\u0e4f\\u0e5a-\\u0e5b\\u0f04-\\u0f12\\u0f14\\u0f3a-\\u0f3d\\u0f85\\u0fd0-\\u0fd4\\u0fd9-\\u0fda\\u104a-\\u104f\\u10fb\\u1360-\\u1368\\u1400\\u166e\\u169b-\\u169c\\u16eb-\\u16ed\\u1735-\\u1736\\u17d4-\\u17d6\\u17d8-\\u17da\\u1800-\\u180a\\u1944-\\u1945\\u1a1e-\\u1a1f\\u1aa0-\\u1aa6\\u1aa8-\\u1aad\\u1b5a-\\u1b60\\u1bfc-\\u1bff\\u1c3b-\\u1c3f\\u1c7e-\\u1c7f\\u1cc0-\\u1cc7\\u1cd3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205e\\u207d-\\u207e\\u208d-\\u208e\\u2308-\\u230b\\u2329-\\u232a\\u2768-\\u2775\\u27c5-\\u27c6\\u27e6-\\u27ef\\u2983-\\u2998\\u29d8-\\u29db\\u29fc-\\u29fd\\u2cf9-\\u2cfc\\u2cfe-\\u2cff\\u2d70\\u2e00-\\u2e2e\\u2e30-\\u2e4f\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301f\\u3030\\u303d\\u30a0\\u30fb\\ua4fe-\\ua4ff\\ua60d-\\ua60f\\ua673\\ua67e\\ua6f2-\\ua6f7\\ua874-\\ua877\\ua8ce-\\ua8cf\\ua8f8-\\ua8fa\\ua8fc\\ua92e-\\ua92f\\ua95f\\ua9c1-\\ua9cd\\ua9de-\\ua9df\\uaa5c-\\uaa5f\\uaade-\\uaadf\\uaaf0-\\uaaf1\\uabeb\\ufd3e-\\ufd3f\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe61\\ufe63\\ufe68\\ufe6a-\\ufe6b\\uff01-\\uff03\\uff05-\\uff0a\\uff0c-\\uff0f\\uff1a-\\uff1b\\uff1f-\\uff20\\uff3b-\\uff3d\\uff3f\\uff5b\\uff5d\\uff5f-\\uff65]|\\ud800[\\udd00-\\udd02\\udf9f\\udfd0]|\\ud801[\\udd6f]|\\ud802[\\udc57\\udd1f\\udd3f\\ude50-\\ude58\\ude7f\\udef0-\\udef6\\udf39-\\udf3f\\udf99-\\udf9c]|\\ud803[\\udf55-\\udf59]|\\ud804[\\udc47-\\udc4d\\udcbb-\\udcbc\\udcbe-\\udcc1\\udd40-\\udd43\\udd74-\\udd75\\uddc5-\\uddc8\\uddcd\\udddb\\udddd-\\udddf\\ude38-\\ude3d\\udea9]|\\ud805[\\udc4b-\\udc4f\\udc5b\\udc5d\\udcc6\\uddc1-\\uddd7\\ude41-\\ude43\\ude60-\\ude6c\\udf3c-\\udf3e]|\\ud806[\\udc3b\\udde2\\ude3f-\\ude46\\ude9a-\\ude9c\\ude9e-\\udea2]|\\ud807[\\udc41-\\udc45\\udc70-\\udc71\\udef7-\\udef8\\udfff]|\\ud809[\\udc70-\\udc74]|\\ud81a[\\ude6e-\\ude6f\\udef5\\udf37-\\udf3b\\udf44]|\\ud81b[\\ude97-\\ude9a\\udfe2]|\\ud82f[\\udc9f]|\\ud836[\\ude87-\\ude8b]|\\ud83a[\\udd5e-\\udd5f]"
53356 };
53357
53358 const {
53359   getLast: getLast$5
53360 } = util$8;
53361 const {
53362   locStart: locStart$7,
53363   locEnd: locEnd$6
53364 } = loc$2;
53365 const {
53366   cjkPattern,
53367   kPattern,
53368   punctuationPattern: punctuationPattern$1
53369 } = require$$2;
53370 const INLINE_NODE_TYPES$1 = ["liquidNode", "inlineCode", "emphasis", "esComment", "strong", "delete", "wikiLink", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
53371 const INLINE_NODE_WRAPPER_TYPES$1 = [...INLINE_NODE_TYPES$1, "tableCell", "paragraph", "heading"];
53372 const kRegex = new RegExp(kPattern);
53373 const punctuationRegex = new RegExp(punctuationPattern$1);
53374 /**
53375  * split text into whitespaces and words
53376  * @param {string} text
53377  */
53378
53379 function splitText$2(text, options) {
53380   const KIND_NON_CJK = "non-cjk";
53381   const KIND_CJ_LETTER = "cj-letter";
53382   const KIND_K_LETTER = "k-letter";
53383   const KIND_CJK_PUNCTUATION = "cjk-punctuation";
53384   /** @type {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>} */
53385
53386   const nodes = [];
53387   const tokens = (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})\n(${cjkPattern})`, "g"), "$1$2")).split(/([\t\n ]+)/);
53388
53389   for (const [index, token] of tokens.entries()) {
53390     // whitespace
53391     if (index % 2 === 1) {
53392       nodes.push({
53393         type: "whitespace",
53394         value: /\n/.test(token) ? "\n" : " "
53395       });
53396       continue;
53397     } // word separated by whitespace
53398
53399
53400     if ((index === 0 || index === tokens.length - 1) && token === "") {
53401       continue;
53402     }
53403
53404     const innerTokens = token.split(new RegExp(`(${cjkPattern})`));
53405
53406     for (const [innerIndex, innerToken] of innerTokens.entries()) {
53407       if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
53408         continue;
53409       } // non-CJK word
53410
53411
53412       if (innerIndex % 2 === 0) {
53413         if (innerToken !== "") {
53414           appendNode({
53415             type: "word",
53416             value: innerToken,
53417             kind: KIND_NON_CJK,
53418             hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
53419             hasTrailingPunctuation: punctuationRegex.test(getLast$5(innerToken))
53420           });
53421         }
53422
53423         continue;
53424       } // CJK character
53425
53426
53427       appendNode(punctuationRegex.test(innerToken) ? {
53428         type: "word",
53429         value: innerToken,
53430         kind: KIND_CJK_PUNCTUATION,
53431         hasLeadingPunctuation: true,
53432         hasTrailingPunctuation: true
53433       } : {
53434         type: "word",
53435         value: innerToken,
53436         kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
53437         hasLeadingPunctuation: false,
53438         hasTrailingPunctuation: false
53439       });
53440     }
53441   }
53442
53443   return nodes;
53444
53445   function appendNode(node) {
53446     const lastNode = getLast$5(nodes);
53447
53448     if (lastNode && lastNode.type === "word") {
53449       if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) {
53450         nodes.push({
53451           type: "whitespace",
53452           value: " "
53453         });
53454       } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && // disallow leading/trailing full-width whitespace
53455       ![lastNode.value, node.value].some(value => /\u3000/.test(value))) {
53456         nodes.push({
53457           type: "whitespace",
53458           value: ""
53459         });
53460       }
53461     }
53462
53463     nodes.push(node);
53464
53465     function isBetween(kind1, kind2) {
53466       return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
53467     }
53468   }
53469 }
53470
53471 function getOrderedListItemInfo$1(orderListItem, originalText) {
53472   const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
53473   return {
53474     numberText,
53475     marker,
53476     leadingSpaces
53477   };
53478 }
53479
53480 function hasGitDiffFriendlyOrderedList$1(node, options) {
53481   if (!node.ordered) {
53482     return false;
53483   }
53484
53485   if (node.children.length < 2) {
53486     return false;
53487   }
53488
53489   const firstNumber = Number(getOrderedListItemInfo$1(node.children[0], options.originalText).numberText);
53490   const secondNumber = Number(getOrderedListItemInfo$1(node.children[1], options.originalText).numberText);
53491
53492   if (firstNumber === 0 && node.children.length > 2) {
53493     const thirdNumber = Number(getOrderedListItemInfo$1(node.children[2], options.originalText).numberText);
53494     return secondNumber === 1 && thirdNumber === 1;
53495   }
53496
53497   return secondNumber === 1;
53498 } // The final new line should not include in value
53499 // https://github.com/remarkjs/remark/issues/512
53500
53501
53502 function getFencedCodeBlockValue$2(node, originalText) {
53503   const {
53504     value
53505   } = node;
53506
53507   if (node.position.end.offset === originalText.length && value.endsWith("\n") && // Code block has no end mark
53508   originalText.endsWith("\n")) {
53509     return value.slice(0, -1);
53510   }
53511
53512   return value;
53513 }
53514
53515 function mapAst$1(ast, handler) {
53516   return function preorder(node, index, parentStack) {
53517     const newNode = Object.assign({}, handler(node, index, parentStack));
53518
53519     if (newNode.children) {
53520       newNode.children = newNode.children.map((child, index) => preorder(child, index, [newNode, ...parentStack]));
53521     }
53522
53523     return newNode;
53524   }(ast, null, []);
53525 }
53526
53527 function isAutolink$1(node) {
53528   if (!node || node.type !== "link" || node.children.length !== 1) {
53529     return false;
53530   }
53531
53532   const child = node.children[0];
53533   return child && locStart$7(node) === locStart$7(child) && locEnd$6(node) === locEnd$6(child);
53534 }
53535
53536 var utils$2 = {
53537   mapAst: mapAst$1,
53538   splitText: splitText$2,
53539   punctuationPattern: punctuationPattern$1,
53540   getFencedCodeBlockValue: getFencedCodeBlockValue$2,
53541   getOrderedListItemInfo: getOrderedListItemInfo$1,
53542   hasGitDiffFriendlyOrderedList: hasGitDiffFriendlyOrderedList$1,
53543   INLINE_NODE_TYPES: INLINE_NODE_TYPES$1,
53544   INLINE_NODE_WRAPPER_TYPES: INLINE_NODE_WRAPPER_TYPES$1,
53545   isAutolink: isAutolink$1
53546 };
53547
53548 const {
53549   inferParserByLanguage: inferParserByLanguage$1,
53550   getMaxContinuousCount: getMaxContinuousCount$1
53551 } = util$8;
53552 const {
53553   builders: {
53554     hardline: hardline$9,
53555     markAsRoot: markAsRoot$2
53556   },
53557   utils: {
53558     replaceEndOfLine
53559   }
53560 } = require$$7$3;
53561 const printFrontMatter$1 = print_1;
53562 const {
53563   getFencedCodeBlockValue: getFencedCodeBlockValue$1
53564 } = utils$2;
53565
53566 function embed$6(path, print, textToDoc, options) {
53567   const node = path.getValue();
53568
53569   if (node.type === "code" && node.lang !== null) {
53570     const parser = inferParserByLanguage$1(node.lang, options);
53571
53572     if (parser) {
53573       const styleUnit = options.__inJsTemplate ? "~" : "`";
53574       const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount$1(node.value, styleUnit) + 1));
53575       const newOptions = {
53576         parser
53577       };
53578
53579       if (node.lang === "tsx") {
53580         newOptions.filepath = "dummy.tsx";
53581       }
53582
53583       const doc = textToDoc(getFencedCodeBlockValue$1(node, options.originalText), newOptions, {
53584         stripTrailingHardline: true
53585       });
53586       return markAsRoot$2([style, node.lang, node.meta ? " " + node.meta : "", hardline$9, replaceEndOfLine(doc), hardline$9, style]);
53587     }
53588   }
53589
53590   switch (node.type) {
53591     case "front-matter":
53592       return printFrontMatter$1(node, textToDoc);
53593     // MDX
53594
53595     case "importExport":
53596       return [textToDoc(node.value, {
53597         parser: "babel"
53598       }, {
53599         stripTrailingHardline: true
53600       }), hardline$9];
53601
53602     case "jsx":
53603       return textToDoc(`<$>${node.value}</$>`, {
53604         parser: "__js_expression",
53605         rootMarker: "mdx"
53606       }, {
53607         stripTrailingHardline: true
53608       });
53609   }
53610
53611   return null;
53612 }
53613
53614 var embed_1$2 = embed$6;
53615
53616 const parseFrontMatter = parse_1;
53617 const pragmas = ["format", "prettier"];
53618
53619 function startWithPragma$1(text) {
53620   const pragma = `@(${pragmas.join("|")})`;
53621   const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*}`, `<!--.*\r?\n[\\s\\S]*(^|\n)[^\\S\n]*${pragma}[^\\S\n]*($|\n)[\\s\\S]*\n.*-->`].join("|"), "m");
53622   const matched = text.match(regex);
53623   return matched && matched.index === 0;
53624 }
53625
53626 var pragma$2 = {
53627   startWithPragma: startWithPragma$1,
53628   hasPragma: text => startWithPragma$1(parseFrontMatter(text).content.trimStart()),
53629   insertPragma: text => {
53630     const extracted = parseFrontMatter(text);
53631     const pragma = `<!-- @${pragmas[0]} -->`;
53632     return extracted.frontMatter ? `${extracted.frontMatter.raw}\n\n${pragma}\n\n${extracted.content}` : `${pragma}\n\n${extracted.content}`;
53633   }
53634 };
53635
53636 const getLast$4 = getLast_1;
53637 const {
53638   getOrderedListItemInfo,
53639   mapAst,
53640   splitText: splitText$1
53641 } = utils$2; // 0x0 ~ 0x10ffff
53642
53643 const isSingleCharRegex = /^.$/su;
53644
53645 function preprocess$5(ast, options) {
53646   ast = restoreUnescapedCharacter(ast, options);
53647   ast = mergeContinuousTexts(ast);
53648   ast = transformInlineCode(ast);
53649   ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
53650   ast = markAlignedList(ast, options);
53651   ast = splitTextIntoSentences(ast, options);
53652   ast = transformImportExport(ast);
53653   ast = mergeContinuousImportExport(ast);
53654   return ast;
53655 }
53656
53657 function transformImportExport(ast) {
53658   return mapAst(ast, node => {
53659     if (node.type !== "import" && node.type !== "export") {
53660       return node;
53661     }
53662
53663     return Object.assign(Object.assign({}, node), {}, {
53664       type: "importExport"
53665     });
53666   });
53667 }
53668
53669 function transformInlineCode(ast) {
53670   return mapAst(ast, node => {
53671     if (node.type !== "inlineCode") {
53672       return node;
53673     }
53674
53675     return Object.assign(Object.assign({}, node), {}, {
53676       value: node.value.replace(/\s+/g, " ")
53677     });
53678   });
53679 }
53680
53681 function restoreUnescapedCharacter(ast, options) {
53682   return mapAst(ast, node => node.type !== "text" || node.value === "*" || node.value === "_" || // handle these cases in printer
53683   !isSingleCharRegex.test(node.value) || node.position.end.offset - node.position.start.offset === node.value.length ? node : Object.assign(Object.assign({}, node), {}, {
53684     value: options.originalText.slice(node.position.start.offset, node.position.end.offset)
53685   }));
53686 }
53687
53688 function mergeContinuousImportExport(ast) {
53689   return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
53690     type: "importExport",
53691     value: prevNode.value + "\n\n" + node.value,
53692     position: {
53693       start: prevNode.position.start,
53694       end: node.position.end
53695     }
53696   }));
53697 }
53698
53699 function mergeChildren(ast, shouldMerge, mergeNode) {
53700   return mapAst(ast, node => {
53701     if (!node.children) {
53702       return node;
53703     }
53704
53705     const children = node.children.reduce((current, child) => {
53706       const lastChild = getLast$4(current);
53707
53708       if (lastChild && shouldMerge(lastChild, child)) {
53709         current.splice(-1, 1, mergeNode(lastChild, child));
53710       } else {
53711         current.push(child);
53712       }
53713
53714       return current;
53715     }, []);
53716     return Object.assign(Object.assign({}, node), {}, {
53717       children
53718     });
53719   });
53720 }
53721
53722 function mergeContinuousTexts(ast) {
53723   return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
53724     type: "text",
53725     value: prevNode.value + node.value,
53726     position: {
53727       start: prevNode.position.start,
53728       end: node.position.end
53729     }
53730   }));
53731 }
53732
53733 function splitTextIntoSentences(ast, options) {
53734   return mapAst(ast, (node, index, [parentNode]) => {
53735     if (node.type !== "text") {
53736       return node;
53737     }
53738
53739     let {
53740       value
53741     } = node;
53742
53743     if (parentNode.type === "paragraph") {
53744       if (index === 0) {
53745         value = value.trimStart();
53746       }
53747
53748       if (index === parentNode.children.length - 1) {
53749         value = value.trimEnd();
53750       }
53751     }
53752
53753     return {
53754       type: "sentence",
53755       position: node.position,
53756       children: splitText$1(value, options)
53757     };
53758   });
53759 }
53760
53761 function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
53762   return mapAst(ast, (node, index, parentStack) => {
53763     if (node.type === "code") {
53764       // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it
53765       const isIndented = /^\n?(?: {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
53766       node.isIndented = isIndented;
53767
53768       if (isIndented) {
53769         for (let i = 0; i < parentStack.length; i++) {
53770           const parent = parentStack[i]; // no need to check checked items
53771
53772           if (parent.hasIndentedCodeblock) {
53773             break;
53774           }
53775
53776           if (parent.type === "list") {
53777             parent.hasIndentedCodeblock = true;
53778           }
53779         }
53780       }
53781     }
53782
53783     return node;
53784   });
53785 }
53786
53787 function markAlignedList(ast, options) {
53788   return mapAst(ast, (node, index, parentStack) => {
53789     if (node.type === "list" && node.children.length > 0) {
53790       // if one of its parents is not aligned, it's not possible to be aligned in sub-lists
53791       for (let i = 0; i < parentStack.length; i++) {
53792         const parent = parentStack[i];
53793
53794         if (parent.type === "list" && !parent.isAligned) {
53795           node.isAligned = false;
53796           return node;
53797         }
53798       }
53799
53800       node.isAligned = isAligned(node);
53801     }
53802
53803     return node;
53804   });
53805
53806   function getListItemStart(listItem) {
53807     return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
53808   }
53809
53810   function isAligned(list) {
53811     if (!list.ordered) {
53812       /**
53813        * - 123
53814        * - 123
53815        */
53816       return true;
53817     }
53818
53819     const [firstItem, secondItem] = list.children;
53820     const firstInfo = getOrderedListItemInfo(firstItem, options.originalText);
53821
53822     if (firstInfo.leadingSpaces.length > 1) {
53823       /**
53824        * 1.   123
53825        *
53826        * 1.   123
53827        * 1. 123
53828        */
53829       return true;
53830     }
53831
53832     const firstStart = getListItemStart(firstItem);
53833
53834     if (firstStart === -1) {
53835       /**
53836        * 1.
53837        *
53838        * 1.
53839        * 1.
53840        */
53841       return false;
53842     }
53843
53844     if (list.children.length === 1) {
53845       /**
53846        * aligned:
53847        *
53848        * 11. 123
53849        *
53850        * not aligned:
53851        *
53852        * 1. 123
53853        */
53854       return firstStart % options.tabWidth === 0;
53855     }
53856
53857     const secondStart = getListItemStart(secondItem);
53858
53859     if (firstStart !== secondStart) {
53860       /**
53861        * 11. 123
53862        * 1. 123
53863        *
53864        * 1. 123
53865        * 11. 123
53866        */
53867       return false;
53868     }
53869
53870     if (firstStart % options.tabWidth === 0) {
53871       /**
53872        * 11. 123
53873        * 12. 123
53874        */
53875       return true;
53876     }
53877     /**
53878      * aligned:
53879      *
53880      * 11. 123
53881      * 1.  123
53882      *
53883      * not aligned:
53884      *
53885      * 1. 123
53886      * 2. 123
53887      */
53888
53889
53890     const secondInfo = getOrderedListItemInfo(secondItem, options.originalText);
53891     return secondInfo.leadingSpaces.length > 1;
53892   }
53893 }
53894
53895 var printPreprocess$2 = preprocess$5;
53896
53897 const {
53898   isFrontMatterNode: isFrontMatterNode$2
53899 } = util$8;
53900 const {
53901   startWithPragma
53902 } = pragma$2;
53903 const ignoredProperties$1 = new Set(["position", "raw" // front-matter
53904 ]);
53905
53906 function clean$4(ast, newObj, parent) {
53907   // for codeblock
53908   if (ast.type === "front-matter" || ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
53909     delete newObj.value;
53910   }
53911
53912   if (ast.type === "list") {
53913     delete newObj.isAligned;
53914   }
53915
53916   if (ast.type === "list" || ast.type === "listItem") {
53917     delete newObj.spread;
53918     delete newObj.loose;
53919   } // texts can be splitted or merged
53920
53921
53922   if (ast.type === "text") {
53923     return null;
53924   }
53925
53926   if (ast.type === "inlineCode") {
53927     newObj.value = ast.value.replace(/[\t\n ]+/g, " ");
53928   }
53929
53930   if (ast.type === "wikiLink") {
53931     newObj.value = ast.value.trim().replace(/[\t\n]+/g, " ");
53932   }
53933
53934   if (ast.type === "definition" || ast.type === "linkReference") {
53935     newObj.label = ast.label.trim().replace(/[\t\n ]+/g, " ").toLowerCase();
53936   }
53937
53938   if ((ast.type === "definition" || ast.type === "link" || ast.type === "image") && ast.title) {
53939     newObj.title = ast.title.replace(/\\(["')])/g, "$1");
53940   } // for insert pragma
53941
53942
53943   if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || isFrontMatterNode$2(parent.children[0]) && parent.children[1] === ast) && ast.type === "html" && startWithPragma(ast.value)) {
53944     return null;
53945   }
53946 }
53947
53948 clean$4.ignoredProperties = ignoredProperties$1;
53949 var clean_1$1 = clean$4;
53950
53951 const {
53952   getLast: getLast$3,
53953   getMinNotPresentContinuousCount,
53954   getMaxContinuousCount,
53955   getStringWidth,
53956   isNonEmptyArray: isNonEmptyArray$2
53957 } = util$8;
53958 const {
53959   builders: {
53960     breakParent: breakParent$4,
53961     join: join$7,
53962     line: line$a,
53963     literalline: literalline$3,
53964     markAsRoot: markAsRoot$1,
53965     hardline: hardline$8,
53966     softline: softline$6,
53967     ifBreak: ifBreak$5,
53968     fill: fill$4,
53969     align: align$1,
53970     indent: indent$3,
53971     group: group$7,
53972     hardlineWithoutBreakParent
53973   },
53974   utils: {
53975     normalizeDoc,
53976     replaceTextEndOfLine: replaceTextEndOfLine$7
53977   },
53978   printer: {
53979     printDocToString
53980   }
53981 } = require$$7$3;
53982 const embed$5 = embed_1$2;
53983 const {
53984   insertPragma: insertPragma$4
53985 } = pragma$2;
53986 const {
53987   locStart: locStart$6,
53988   locEnd: locEnd$5
53989 } = loc$2;
53990 const preprocess$4 = printPreprocess$2;
53991 const clean$3 = clean_1$1;
53992 const {
53993   getFencedCodeBlockValue,
53994   hasGitDiffFriendlyOrderedList,
53995   splitText,
53996   punctuationPattern,
53997   INLINE_NODE_TYPES,
53998   INLINE_NODE_WRAPPER_TYPES,
53999   isAutolink
54000 } = utils$2;
54001 /**
54002  * @typedef {import("../document").Doc} Doc
54003  */
54004
54005 const TRAILING_HARDLINE_NODES = new Set(["importExport"]);
54006 const SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link", "wikiLink"];
54007 const SIBLING_NODE_TYPES = new Set(["listItem", "definition", "footnoteDefinition"]);
54008
54009 function genericPrint$2(path, options, print) {
54010   const node = path.getValue();
54011
54012   if (shouldRemainTheSameContent(path)) {
54013     return splitText(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(node => node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options));
54014   }
54015
54016   switch (node.type) {
54017     case "front-matter":
54018       return options.originalText.slice(node.position.start.offset, node.position.end.offset);
54019
54020     case "root":
54021       if (node.children.length === 0) {
54022         return "";
54023       }
54024
54025       return [normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.has(getLastDescendantNode$2(node).type) ? hardline$8 : ""];
54026
54027     case "paragraph":
54028       return printChildren$4(path, options, print, {
54029         postprocessor: fill$4
54030       });
54031
54032     case "sentence":
54033       return printChildren$4(path, options, print);
54034
54035     case "word":
54036       {
54037         let escapedValue = node.value.replace(/\*/g, "\\$&") // escape all `*`
54038         .replace(new RegExp([`(^|${punctuationPattern})(_+)`, `(_+)(${punctuationPattern}|$)`].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? `${text1}${underscore1}` : `${underscore2}${text2}`).replace(/_/g, "\\_")); // escape all `_` except concating with non-punctuation, e.g. `1_2_3` is not considered emphasis
54039
54040         const isFirstSentence = (node, name, index) => node.type === "sentence" && index === 0;
54041
54042         const isLastChildAutolink = (node, name, index) => isAutolink(node.children[index - 1]);
54043
54044         if (escapedValue !== node.value && (path.match(undefined, isFirstSentence, isLastChildAutolink) || path.match(undefined, isFirstSentence, (node, name, index) => node.type === "emphasis" && index === 0, isLastChildAutolink))) {
54045           // backslash is parsed as part of autolinks, so we need to remove it
54046           escapedValue = escapedValue.replace(/^(\\?[*_])+/, prefix => prefix.replace(/\\/g, ""));
54047         }
54048
54049         return escapedValue;
54050       }
54051
54052     case "whitespace":
54053       {
54054         const parentNode = path.getParentNode();
54055         const index = parentNode.children.indexOf(node);
54056         const nextNode = parentNode.children[index + 1];
54057         const proseWrap = // leading char that may cause different syntax
54058         nextNode && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(nextNode.value) ? "never" : options.proseWrap;
54059         return printLine(path, node.value, {
54060           proseWrap
54061         });
54062       }
54063
54064     case "emphasis":
54065       {
54066         let style;
54067
54068         if (isAutolink(node.children[0])) {
54069           style = options.originalText[node.position.start.offset];
54070         } else {
54071           const parentNode = path.getParentNode();
54072           const index = parentNode.children.indexOf(node);
54073           const prevNode = parentNode.children[index - 1];
54074           const nextNode = parentNode.children[index + 1];
54075           const hasPrevOrNextWord = // `1*2*3` is considered emphasis but `1_2_3` is not
54076           prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && getLast$3(prevNode.children).type === "word" && !getLast$3(prevNode.children).hasTrailingPunctuation || nextNode && nextNode.type === "sentence" && nextNode.children.length > 0 && nextNode.children[0].type === "word" && !nextNode.children[0].hasLeadingPunctuation;
54077           style = hasPrevOrNextWord || getAncestorNode(path, "emphasis") ? "*" : "_";
54078         }
54079
54080         return [style, printChildren$4(path, options, print), style];
54081       }
54082
54083     case "strong":
54084       return ["**", printChildren$4(path, options, print), "**"];
54085
54086     case "delete":
54087       return ["~~", printChildren$4(path, options, print), "~~"];
54088
54089     case "inlineCode":
54090       {
54091         const backtickCount = getMinNotPresentContinuousCount(node.value, "`");
54092         const style = "`".repeat(backtickCount || 1);
54093         const gap = backtickCount && !/^\s/.test(node.value) ? " " : "";
54094         return [style, gap, node.value, gap, style];
54095       }
54096
54097     case "wikiLink":
54098       {
54099         let contents = "";
54100
54101         if (options.proseWrap === "preserve") {
54102           contents = node.value;
54103         } else {
54104           contents = node.value.replace(/[\t\n]+/g, " ");
54105         }
54106
54107         return ["[[", contents, "]]"];
54108       }
54109
54110     case "link":
54111       switch (options.originalText[node.position.start.offset]) {
54112         case "<":
54113           {
54114             const mailto = "mailto:";
54115             const url = // <hello@example.com> is parsed as { url: "mailto:hello@example.com" }
54116             node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url;
54117             return ["<", url, ">"];
54118           }
54119
54120         case "[":
54121           return ["[", printChildren$4(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
54122
54123         default:
54124           return options.originalText.slice(node.position.start.offset, node.position.end.offset);
54125       }
54126
54127     case "image":
54128       return ["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
54129
54130     case "blockquote":
54131       return ["> ", align$1("> ", printChildren$4(path, options, print))];
54132
54133     case "heading":
54134       return ["#".repeat(node.depth) + " ", printChildren$4(path, options, print)];
54135
54136     case "code":
54137       {
54138         if (node.isIndented) {
54139           // indented code block
54140           const alignment = " ".repeat(4);
54141           return align$1(alignment, [alignment, ...replaceTextEndOfLine$7(node.value, hardline$8)]);
54142         } // fenced code block
54143
54144
54145         const styleUnit = options.__inJsTemplate ? "~" : "`";
54146         const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
54147         return [style, node.lang || "", node.meta ? " " + node.meta : "", hardline$8, ...replaceTextEndOfLine$7(getFencedCodeBlockValue(node, options.originalText), hardline$8), hardline$8, style];
54148       }
54149
54150     case "html":
54151       {
54152         const parentNode = path.getParentNode();
54153         const value = parentNode.type === "root" && getLast$3(parentNode.children) === node ? node.value.trimEnd() : node.value;
54154         const isHtmlComment = /^<!--.*-->$/s.test(value);
54155         return replaceTextEndOfLine$7(value, // @ts-expect-error
54156         isHtmlComment ? hardline$8 : markAsRoot$1(literalline$3));
54157       }
54158
54159     case "list":
54160       {
54161         const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
54162         const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(node, options);
54163         return printChildren$4(path, options, print, {
54164           processor: (childPath, index) => {
54165             const prefix = getPrefix();
54166             const childNode = childPath.getValue();
54167
54168             if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
54169               return [prefix, printListItem(childPath, options, print, prefix)];
54170             }
54171
54172             return [prefix, align$1(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))];
54173
54174             function getPrefix() {
54175               const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
54176               return node.isAligned ||
54177               /* workaround for https://github.com/remarkjs/remark/issues/315 */
54178               node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
54179             }
54180           }
54181         });
54182       }
54183
54184     case "thematicBreak":
54185       {
54186         const counter = getAncestorCounter(path, "list");
54187
54188         if (counter === -1) {
54189           return "---";
54190         }
54191
54192         const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
54193         return nthSiblingIndex % 2 === 0 ? "***" : "---";
54194       }
54195
54196     case "linkReference":
54197       return ["[", printChildren$4(path, options, print), "]", node.referenceType === "full" ? ["[", node.identifier, "]"] : node.referenceType === "collapsed" ? "[]" : ""];
54198
54199     case "imageReference":
54200       switch (node.referenceType) {
54201         case "full":
54202           return ["![", node.alt || "", "][", node.identifier, "]"];
54203
54204         default:
54205           return ["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""];
54206       }
54207
54208     case "definition":
54209       {
54210         const lineOrSpace = options.proseWrap === "always" ? line$a : " ";
54211         return group$7(["[", node.identifier, "]:", indent$3([lineOrSpace, printUrl(node.url), node.title === null ? "" : [lineOrSpace, printTitle(node.title, options, false)]])]);
54212       }
54213     // `footnote` requires `.use(footnotes, {inlineNotes: true})`, we are not using this option
54214     // https://github.com/remarkjs/remark-footnotes#optionsinlinenotes
54215
54216     /* istanbul ignore next */
54217
54218     case "footnote":
54219       return ["[^", printChildren$4(path, options, print), "]"];
54220
54221     case "footnoteReference":
54222       return ["[^", node.identifier, "]"];
54223
54224     case "footnoteDefinition":
54225       {
54226         const nextNode = path.getParentNode().children[path.getName() + 1];
54227         const shouldInlineFootnote = node.children.length === 1 && node.children[0].type === "paragraph" && (options.proseWrap === "never" || options.proseWrap === "preserve" && node.children[0].position.start.line === node.children[0].position.end.line);
54228         return ["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren$4(path, options, print) : group$7([align$1(" ".repeat(4), printChildren$4(path, options, print, {
54229           processor: (childPath, index) => index === 0 ? group$7([softline$6, print()]) : print()
54230         })), nextNode && nextNode.type === "footnoteDefinition" ? softline$6 : ""])];
54231       }
54232
54233     case "table":
54234       return printTable(path, options, print);
54235
54236     case "tableCell":
54237       return printChildren$4(path, options, print);
54238
54239     case "break":
54240       return /\s/.test(options.originalText[node.position.start.offset]) ? ["  ", markAsRoot$1(literalline$3)] : ["\\", hardline$8];
54241
54242     case "liquidNode":
54243       return replaceTextEndOfLine$7(node.value, hardline$8);
54244     // MDX
54245     // fallback to the original text if multiparser failed
54246     // or `embeddedLanguageFormatting: "off"`
54247
54248     case "importExport":
54249       return [node.value, hardline$8];
54250
54251     case "esComment":
54252       return ["{/* ", node.value, " */}"];
54253
54254     case "jsx":
54255       return node.value;
54256
54257     case "math":
54258       return ["$$", hardline$8, node.value ? [...replaceTextEndOfLine$7(node.value, hardline$8), hardline$8] : "", "$$"];
54259
54260     case "inlineMath":
54261       {
54262         // remark-math trims content but we don't want to remove whitespaces
54263         // since it's very possible that it's recognized as math accidentally
54264         return options.originalText.slice(locStart$6(node), locEnd$5(node));
54265       }
54266
54267     case "tableRow": // handled in "table"
54268
54269     case "listItem": // handled in "list"
54270
54271     default:
54272       /* istanbul ignore next */
54273       throw new Error(`Unknown markdown type ${JSON.stringify(node.type)}`);
54274   }
54275 }
54276
54277 function printListItem(path, options, print, listPrefix) {
54278   const node = path.getValue();
54279   const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
54280   return [prefix, printChildren$4(path, options, print, {
54281     processor: (childPath, index) => {
54282       if (index === 0 && childPath.getValue().type !== "list") {
54283         return align$1(" ".repeat(prefix.length), print());
54284       }
54285
54286       const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
54287       );
54288       return [alignment, align$1(alignment, print())];
54289     }
54290   })];
54291 }
54292
54293 function alignListPrefix(prefix, options) {
54294   const additionalSpaces = getAdditionalSpaces();
54295   return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented code block
54296   );
54297
54298   function getAdditionalSpaces() {
54299     const restSpaces = prefix.length % options.tabWidth;
54300     return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
54301   }
54302 }
54303
54304 function getNthListSiblingIndex(node, parentNode) {
54305   return getNthSiblingIndex(node, parentNode, siblingNode => siblingNode.ordered === node.ordered);
54306 }
54307
54308 function getNthSiblingIndex(node, parentNode, condition) {
54309   let index = -1;
54310
54311   for (const childNode of parentNode.children) {
54312     if (childNode.type === node.type && condition(childNode)) {
54313       index++;
54314     } else {
54315       index = -1;
54316     }
54317
54318     if (childNode === node) {
54319       return index;
54320     }
54321   }
54322 }
54323
54324 function getAncestorCounter(path, typeOrTypes) {
54325   const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
54326   let counter = -1;
54327   let ancestorNode;
54328
54329   while (ancestorNode = path.getParentNode(++counter)) {
54330     if (types.includes(ancestorNode.type)) {
54331       return counter;
54332     }
54333   }
54334
54335   return -1;
54336 }
54337
54338 function getAncestorNode(path, typeOrTypes) {
54339   const counter = getAncestorCounter(path, typeOrTypes);
54340   return counter === -1 ? null : path.getParentNode(counter);
54341 }
54342
54343 function printLine(path, value, options) {
54344   if (options.proseWrap === "preserve" && value === "\n") {
54345     return hardline$8;
54346   }
54347
54348   const isBreakable = options.proseWrap === "always" && !getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
54349   return value !== "" ? isBreakable ? line$a : " " : isBreakable ? softline$6 : "";
54350 }
54351
54352 function printTable(path, options, print) {
54353   const node = path.getValue();
54354   const columnMaxWidths = []; // { [rowIndex: number]: { [columnIndex: number]: {text: string, width: number} } }
54355
54356   const contents = path.map(rowPath => rowPath.map((cellPath, columnIndex) => {
54357     const text = printDocToString(print(), options).formatted;
54358     const width = getStringWidth(text);
54359     columnMaxWidths[columnIndex] = Math.max(columnMaxWidths[columnIndex] || 3, // minimum width = 3 (---, :--, :-:, --:)
54360     width);
54361     return {
54362       text,
54363       width
54364     };
54365   }, "children"), "children");
54366   const alignedTable = printTableContents(
54367   /* isCompact */
54368   false);
54369
54370   if (options.proseWrap !== "never") {
54371     return [breakParent$4, alignedTable];
54372   } // Only if the --prose-wrap never is set and it exceeds the print width.
54373
54374
54375   const compactTable = printTableContents(
54376   /* isCompact */
54377   true);
54378   return [breakParent$4, group$7(ifBreak$5(compactTable, alignedTable))];
54379
54380   function printTableContents(isCompact) {
54381     /** @type{Doc[]} */
54382     const parts = [printRow(contents[0], isCompact), printAlign(isCompact)];
54383
54384     if (contents.length > 1) {
54385       parts.push(join$7(hardlineWithoutBreakParent, contents.slice(1).map(rowContents => printRow(rowContents, isCompact))));
54386     }
54387
54388     return join$7(hardlineWithoutBreakParent, parts);
54389   }
54390
54391   function printAlign(isCompact) {
54392     const align = columnMaxWidths.map((width, index) => {
54393       const align = node.align[index];
54394       const first = align === "center" || align === "left" ? ":" : "-";
54395       const last = align === "center" || align === "right" ? ":" : "-";
54396       const middle = isCompact ? "-" : "-".repeat(width - 2);
54397       return `${first}${middle}${last}`;
54398     });
54399     return `| ${align.join(" | ")} |`;
54400   }
54401
54402   function printRow(rowContents, isCompact) {
54403     const columns = rowContents.map(({
54404       text,
54405       width
54406     }, columnIndex) => {
54407       if (isCompact) {
54408         return text;
54409       }
54410
54411       const spaces = columnMaxWidths[columnIndex] - width;
54412       const align = node.align[columnIndex];
54413       let before = 0;
54414
54415       if (align === "right") {
54416         before = spaces;
54417       } else if (align === "center") {
54418         before = Math.floor(spaces / 2);
54419       }
54420
54421       const after = spaces - before;
54422       return `${" ".repeat(before)}${text}${" ".repeat(after)}`;
54423     });
54424     return `| ${columns.join(" | ")} |`;
54425   }
54426 }
54427
54428 function printRoot(path, options, print) {
54429   /** @typedef {{ index: number, offset: number }} IgnorePosition */
54430
54431   /** @type {Array<{start: IgnorePosition, end: IgnorePosition}>} */
54432   const ignoreRanges = [];
54433   /** @type {IgnorePosition | null} */
54434
54435   let ignoreStart = null;
54436   const {
54437     children
54438   } = path.getValue();
54439
54440   for (const [index, childNode] of children.entries()) {
54441     switch (isPrettierIgnore$2(childNode)) {
54442       case "start":
54443         if (ignoreStart === null) {
54444           ignoreStart = {
54445             index,
54446             offset: childNode.position.end.offset
54447           };
54448         }
54449
54450         break;
54451
54452       case "end":
54453         if (ignoreStart !== null) {
54454           ignoreRanges.push({
54455             start: ignoreStart,
54456             end: {
54457               index,
54458               offset: childNode.position.start.offset
54459             }
54460           });
54461           ignoreStart = null;
54462         }
54463
54464         break;
54465     }
54466   }
54467
54468   return printChildren$4(path, options, print, {
54469     processor: (childPath, index) => {
54470       if (ignoreRanges.length > 0) {
54471         const ignoreRange = ignoreRanges[0];
54472
54473         if (index === ignoreRange.start.index) {
54474           return [children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value];
54475         }
54476
54477         if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
54478           return false;
54479         }
54480
54481         if (index === ignoreRange.end.index) {
54482           ignoreRanges.shift();
54483           return false;
54484         }
54485       }
54486
54487       return print();
54488     }
54489   });
54490 }
54491
54492 function printChildren$4(path, options, print, events = {}) {
54493   const {
54494     postprocessor
54495   } = events;
54496
54497   const processor = events.processor || (() => print());
54498
54499   const node = path.getValue();
54500   const parts = [];
54501   let lastChildNode;
54502   path.each((childPath, index) => {
54503     const childNode = childPath.getValue();
54504     const result = processor(childPath, index);
54505
54506     if (result !== false) {
54507       const data = {
54508         parts,
54509         prevNode: lastChildNode,
54510         parentNode: node,
54511         options
54512       };
54513
54514       if (shouldPrePrintHardline(childNode, data)) {
54515         parts.push(hardline$8); // Can't find a case to pass `shouldPrePrintTripleHardline`
54516
54517         /* istanbul ignore next */
54518
54519         if (lastChildNode && TRAILING_HARDLINE_NODES.has(lastChildNode.type)) {
54520           if (shouldPrePrintTripleHardline(childNode, data)) {
54521             parts.push(hardline$8);
54522           }
54523         } else {
54524           if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
54525             parts.push(hardline$8);
54526           }
54527
54528           if (shouldPrePrintTripleHardline(childNode, data)) {
54529             parts.push(hardline$8);
54530           }
54531         }
54532       }
54533
54534       parts.push(result);
54535       lastChildNode = childNode;
54536     }
54537   }, "children");
54538   return postprocessor ? postprocessor(parts) : parts;
54539 }
54540
54541 function getLastDescendantNode$2(node) {
54542   let current = node;
54543
54544   while (isNonEmptyArray$2(current.children)) {
54545     current = getLast$3(current.children);
54546   }
54547
54548   return current;
54549 }
54550 /** @return {false | 'next' | 'start' | 'end'} */
54551
54552
54553 function isPrettierIgnore$2(node) {
54554   let match;
54555
54556   if (node.type === "html") {
54557     match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
54558   } else {
54559     let comment;
54560
54561     if (node.type === "esComment") {
54562       comment = node;
54563     } else if (node.type === "paragraph" && node.children.length === 1 && node.children[0].type === "esComment") {
54564       comment = node.children[0];
54565     }
54566
54567     if (comment) {
54568       match = comment.value.match(/^prettier-ignore(?:-(start|end))?$/);
54569     }
54570   }
54571
54572   return match ? match[1] ? match[1] : "next" : false;
54573 }
54574
54575 function shouldPrePrintHardline(node, data) {
54576   const isFirstNode = data.parts.length === 0;
54577   const isInlineNode = INLINE_NODE_TYPES.includes(node.type);
54578   const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES.includes(data.parentNode.type);
54579   return !isFirstNode && !isInlineNode && !isInlineHTML;
54580 }
54581
54582 function shouldPrePrintDoubleHardline(node, data) {
54583   const isSequence = (data.prevNode && data.prevNode.type) === node.type;
54584   const isSiblingNode = isSequence && SIBLING_NODE_TYPES.has(node.type);
54585   const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
54586   const isPrevNodeLooseListItem = data.prevNode && data.prevNode.type === "listItem" && data.prevNode.loose;
54587   const isPrevNodePrettierIgnore = isPrettierIgnore$2(data.prevNode) === "next";
54588   const isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && data.prevNode && data.prevNode.type === "html" && data.prevNode.position.end.line + 1 === node.position.start.line;
54589   const isHtmlDirectAfterListItem = node.type === "html" && data.parentNode.type === "listItem" && data.prevNode && data.prevNode.type === "paragraph" && data.prevNode.position.end.line + 1 === node.position.start.line;
54590   return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
54591 }
54592
54593 function shouldPrePrintTripleHardline(node, data) {
54594   const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
54595   const isIndentedCode = node.type === "code" && node.isIndented;
54596   return isPrevNodeList && isIndentedCode;
54597 }
54598
54599 function shouldRemainTheSameContent(path) {
54600   const ancestorNode = getAncestorNode(path, ["linkReference", "imageReference"]);
54601   return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
54602 }
54603 /**
54604  * @param {string} url
54605  * @param {string[] | string} [dangerousCharOrChars]
54606  * @returns {string}
54607  */
54608
54609
54610 function printUrl(url, dangerousCharOrChars = []) {
54611   const dangerousChars = [" ", ...(Array.isArray(dangerousCharOrChars) ? dangerousCharOrChars : [dangerousCharOrChars])];
54612   return new RegExp(dangerousChars.map(x => `\\${x}`).join("|")).test(url) ? `<${url}>` : url;
54613 }
54614
54615 function printTitle(title, options, printSpace = true) {
54616   if (!title) {
54617     return "";
54618   }
54619
54620   if (printSpace) {
54621     return " " + printTitle(title, options, false);
54622   } // title is escaped after `remark-parse` v7
54623
54624
54625   title = title.replace(/\\(["')])/g, "$1");
54626
54627   if (title.includes('"') && title.includes("'") && !title.includes(")")) {
54628     return `(${title})`; // avoid escaped quotes
54629   } // faster than using RegExps: https://jsperf.com/performance-of-match-vs-split
54630
54631
54632   const singleCount = title.split("'").length - 1;
54633   const doubleCount = title.split('"').length - 1;
54634   const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
54635   title = title.replace(/\\/, "\\\\");
54636   title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1");
54637   return `${quote}${title}${quote}`;
54638 }
54639
54640 function clamp(value, min, max) {
54641   return value < min ? min : value > max ? max : value;
54642 }
54643
54644 function hasPrettierIgnore$5(path) {
54645   const index = Number(path.getName());
54646
54647   if (index === 0) {
54648     return false;
54649   }
54650
54651   const prevNode = path.getParentNode().children[index - 1];
54652   return isPrettierIgnore$2(prevNode) === "next";
54653 }
54654
54655 var printerMarkdown = {
54656   preprocess: preprocess$4,
54657   print: genericPrint$2,
54658   embed: embed$5,
54659   massageAstNode: clean$3,
54660   hasPrettierIgnore: hasPrettierIgnore$5,
54661   insertPragma: insertPragma$4
54662 };
54663
54664 const commonOptions$2 = commonOptions$6; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
54665
54666 var options$5 = {
54667   proseWrap: commonOptions$2.proseWrap,
54668   singleQuote: commonOptions$2.singleQuote
54669 };
54670
54671 var parsers$5 = {
54672   /* istanbul ignore next */
54673   get remark() {
54674     return require("./parser-markdown.js").parsers.remark;
54675   },
54676
54677   get markdown() {
54678     return require("./parser-markdown.js").parsers.remark;
54679   },
54680
54681   get mdx() {
54682     return require("./parser-markdown.js").parsers.mdx;
54683   }
54684
54685 };
54686
54687 var name$3 = "Markdown";
54688 var type$3 = "prose";
54689 var color$3 = "#083fa1";
54690 var aliases$2 = [
54691         "pandoc"
54692 ];
54693 var aceMode$3 = "markdown";
54694 var codemirrorMode$2 = "gfm";
54695 var codemirrorMimeType$2 = "text/x-gfm";
54696 var wrap = true;
54697 var extensions$3 = [
54698         ".md",
54699         ".markdown",
54700         ".mdown",
54701         ".mdwn",
54702         ".mdx",
54703         ".mkd",
54704         ".mkdn",
54705         ".mkdown",
54706         ".ronn",
54707         ".scd",
54708         ".workbook"
54709 ];
54710 var filenames$1 = [
54711         "contents.lr"
54712 ];
54713 var tmScope$3 = "source.gfm";
54714 var languageId$3 = 222;
54715 var require$$4$3 = {
54716         name: name$3,
54717         type: type$3,
54718         color: color$3,
54719         aliases: aliases$2,
54720         aceMode: aceMode$3,
54721         codemirrorMode: codemirrorMode$2,
54722         codemirrorMimeType: codemirrorMimeType$2,
54723         wrap: wrap,
54724         extensions: extensions$3,
54725         filenames: filenames$1,
54726         tmScope: tmScope$3,
54727         languageId: languageId$3
54728 };
54729
54730 const createLanguage$2 = createLanguage$7;
54731 const printer$2 = printerMarkdown;
54732 const options$4 = options$5;
54733 const parsers$4 = parsers$5;
54734 const languages$3 = [createLanguage$2(require$$4$3, data => ({
54735   since: "1.8.0",
54736   parsers: ["markdown"],
54737   vscodeLanguageIds: ["markdown"],
54738   filenames: [...data.filenames, "README"],
54739   extensions: data.extensions.filter(extension => extension !== ".mdx")
54740 })), createLanguage$2(require$$4$3, () => ({
54741   name: "MDX",
54742   since: "1.15.0",
54743   parsers: ["mdx"],
54744   vscodeLanguageIds: ["mdx"],
54745   filenames: [],
54746   extensions: [".mdx"]
54747 }))];
54748 const printers$1 = {
54749   mdast: printer$2
54750 };
54751 var languageMarkdown = {
54752   languages: languages$3,
54753   options: options$4,
54754   printers: printers$1,
54755   parsers: parsers$4
54756 };
54757
54758 const {
54759   isFrontMatterNode: isFrontMatterNode$1
54760 } = util$8;
54761 const ignoredProperties = new Set(["sourceSpan", "startSourceSpan", "endSourceSpan", "nameSpan", "valueSpan"]);
54762
54763 function clean$2(ast, newNode) {
54764   if (ast.type === "text" || ast.type === "comment") {
54765     return null;
54766   } // may be formatted by multiparser
54767
54768
54769   if (isFrontMatterNode$1(ast) || ast.type === "yaml" || ast.type === "toml") {
54770     return null;
54771   }
54772
54773   if (ast.type === "attribute") {
54774     delete newNode.value;
54775   }
54776
54777   if (ast.type === "docType") {
54778     delete newNode.value;
54779   }
54780 }
54781
54782 clean$2.ignoredProperties = ignoredProperties;
54783 var clean_1 = clean$2;
54784
54785 var require$$0 = [
54786         "a",
54787         "abbr",
54788         "acronym",
54789         "address",
54790         "applet",
54791         "area",
54792         "article",
54793         "aside",
54794         "audio",
54795         "b",
54796         "base",
54797         "basefont",
54798         "bdi",
54799         "bdo",
54800         "bgsound",
54801         "big",
54802         "blink",
54803         "blockquote",
54804         "body",
54805         "br",
54806         "button",
54807         "canvas",
54808         "caption",
54809         "center",
54810         "cite",
54811         "code",
54812         "col",
54813         "colgroup",
54814         "command",
54815         "content",
54816         "data",
54817         "datalist",
54818         "dd",
54819         "del",
54820         "details",
54821         "dfn",
54822         "dialog",
54823         "dir",
54824         "div",
54825         "dl",
54826         "dt",
54827         "element",
54828         "em",
54829         "embed",
54830         "fieldset",
54831         "figcaption",
54832         "figure",
54833         "font",
54834         "footer",
54835         "form",
54836         "frame",
54837         "frameset",
54838         "h1",
54839         "h2",
54840         "h3",
54841         "h4",
54842         "h5",
54843         "h6",
54844         "head",
54845         "header",
54846         "hgroup",
54847         "hr",
54848         "html",
54849         "i",
54850         "iframe",
54851         "image",
54852         "img",
54853         "input",
54854         "ins",
54855         "isindex",
54856         "kbd",
54857         "keygen",
54858         "label",
54859         "legend",
54860         "li",
54861         "link",
54862         "listing",
54863         "main",
54864         "map",
54865         "mark",
54866         "marquee",
54867         "math",
54868         "menu",
54869         "menuitem",
54870         "meta",
54871         "meter",
54872         "multicol",
54873         "nav",
54874         "nextid",
54875         "nobr",
54876         "noembed",
54877         "noframes",
54878         "noscript",
54879         "object",
54880         "ol",
54881         "optgroup",
54882         "option",
54883         "output",
54884         "p",
54885         "param",
54886         "picture",
54887         "plaintext",
54888         "pre",
54889         "progress",
54890         "q",
54891         "rb",
54892         "rbc",
54893         "rp",
54894         "rt",
54895         "rtc",
54896         "ruby",
54897         "s",
54898         "samp",
54899         "script",
54900         "section",
54901         "select",
54902         "shadow",
54903         "slot",
54904         "small",
54905         "source",
54906         "spacer",
54907         "span",
54908         "strike",
54909         "strong",
54910         "style",
54911         "sub",
54912         "summary",
54913         "sup",
54914         "svg",
54915         "table",
54916         "tbody",
54917         "td",
54918         "template",
54919         "textarea",
54920         "tfoot",
54921         "th",
54922         "thead",
54923         "time",
54924         "title",
54925         "tr",
54926         "track",
54927         "tt",
54928         "u",
54929         "ul",
54930         "var",
54931         "video",
54932         "wbr",
54933         "xmp"
54934 ];
54935
54936 var a = [
54937         "accesskey",
54938         "charset",
54939         "coords",
54940         "download",
54941         "href",
54942         "hreflang",
54943         "name",
54944         "ping",
54945         "referrerpolicy",
54946         "rel",
54947         "rev",
54948         "shape",
54949         "tabindex",
54950         "target",
54951         "type"
54952 ];
54953 var abbr = [
54954         "title"
54955 ];
54956 var applet = [
54957         "align",
54958         "alt",
54959         "archive",
54960         "code",
54961         "codebase",
54962         "height",
54963         "hspace",
54964         "name",
54965         "object",
54966         "vspace",
54967         "width"
54968 ];
54969 var area = [
54970         "accesskey",
54971         "alt",
54972         "coords",
54973         "download",
54974         "href",
54975         "hreflang",
54976         "nohref",
54977         "ping",
54978         "referrerpolicy",
54979         "rel",
54980         "shape",
54981         "tabindex",
54982         "target",
54983         "type"
54984 ];
54985 var audio = [
54986         "autoplay",
54987         "controls",
54988         "crossorigin",
54989         "loop",
54990         "muted",
54991         "preload",
54992         "src"
54993 ];
54994 var base = [
54995         "href",
54996         "target"
54997 ];
54998 var basefont = [
54999         "color",
55000         "face",
55001         "size"
55002 ];
55003 var bdo = [
55004         "dir"
55005 ];
55006 var blockquote = [
55007         "cite"
55008 ];
55009 var body = [
55010         "alink",
55011         "background",
55012         "bgcolor",
55013         "link",
55014         "text",
55015         "vlink"
55016 ];
55017 var br = [
55018         "clear"
55019 ];
55020 var button = [
55021         "accesskey",
55022         "autofocus",
55023         "disabled",
55024         "form",
55025         "formaction",
55026         "formenctype",
55027         "formmethod",
55028         "formnovalidate",
55029         "formtarget",
55030         "name",
55031         "tabindex",
55032         "type",
55033         "value"
55034 ];
55035 var canvas = [
55036         "height",
55037         "width"
55038 ];
55039 var caption = [
55040         "align"
55041 ];
55042 var col = [
55043         "align",
55044         "char",
55045         "charoff",
55046         "span",
55047         "valign",
55048         "width"
55049 ];
55050 var colgroup = [
55051         "align",
55052         "char",
55053         "charoff",
55054         "span",
55055         "valign",
55056         "width"
55057 ];
55058 var data = [
55059         "value"
55060 ];
55061 var del = [
55062         "cite",
55063         "datetime"
55064 ];
55065 var details = [
55066         "open"
55067 ];
55068 var dfn = [
55069         "title"
55070 ];
55071 var dialog = [
55072         "open"
55073 ];
55074 var dir = [
55075         "compact"
55076 ];
55077 var div = [
55078         "align"
55079 ];
55080 var dl = [
55081         "compact"
55082 ];
55083 var embed$4 = [
55084         "height",
55085         "src",
55086         "type",
55087         "width"
55088 ];
55089 var fieldset = [
55090         "disabled",
55091         "form",
55092         "name"
55093 ];
55094 var font = [
55095         "color",
55096         "face",
55097         "size"
55098 ];
55099 var form = [
55100         "accept",
55101         "accept-charset",
55102         "action",
55103         "autocomplete",
55104         "enctype",
55105         "method",
55106         "name",
55107         "novalidate",
55108         "target"
55109 ];
55110 var frame = [
55111         "frameborder",
55112         "longdesc",
55113         "marginheight",
55114         "marginwidth",
55115         "name",
55116         "noresize",
55117         "scrolling",
55118         "src"
55119 ];
55120 var frameset = [
55121         "cols",
55122         "rows"
55123 ];
55124 var h1 = [
55125         "align"
55126 ];
55127 var h2 = [
55128         "align"
55129 ];
55130 var h3 = [
55131         "align"
55132 ];
55133 var h4 = [
55134         "align"
55135 ];
55136 var h5 = [
55137         "align"
55138 ];
55139 var h6 = [
55140         "align"
55141 ];
55142 var head = [
55143         "profile"
55144 ];
55145 var hr = [
55146         "align",
55147         "noshade",
55148         "size",
55149         "width"
55150 ];
55151 var html = [
55152         "manifest",
55153         "version"
55154 ];
55155 var iframe = [
55156         "align",
55157         "allow",
55158         "allowfullscreen",
55159         "allowpaymentrequest",
55160         "allowusermedia",
55161         "frameborder",
55162         "height",
55163         "loading",
55164         "longdesc",
55165         "marginheight",
55166         "marginwidth",
55167         "name",
55168         "referrerpolicy",
55169         "sandbox",
55170         "scrolling",
55171         "src",
55172         "srcdoc",
55173         "width"
55174 ];
55175 var img = [
55176         "align",
55177         "alt",
55178         "border",
55179         "crossorigin",
55180         "decoding",
55181         "height",
55182         "hspace",
55183         "ismap",
55184         "loading",
55185         "longdesc",
55186         "name",
55187         "referrerpolicy",
55188         "sizes",
55189         "src",
55190         "srcset",
55191         "usemap",
55192         "vspace",
55193         "width"
55194 ];
55195 var input = [
55196         "accept",
55197         "accesskey",
55198         "align",
55199         "alt",
55200         "autocomplete",
55201         "autofocus",
55202         "checked",
55203         "dirname",
55204         "disabled",
55205         "form",
55206         "formaction",
55207         "formenctype",
55208         "formmethod",
55209         "formnovalidate",
55210         "formtarget",
55211         "height",
55212         "ismap",
55213         "list",
55214         "max",
55215         "maxlength",
55216         "min",
55217         "minlength",
55218         "multiple",
55219         "name",
55220         "pattern",
55221         "placeholder",
55222         "readonly",
55223         "required",
55224         "size",
55225         "src",
55226         "step",
55227         "tabindex",
55228         "title",
55229         "type",
55230         "usemap",
55231         "value",
55232         "width"
55233 ];
55234 var ins = [
55235         "cite",
55236         "datetime"
55237 ];
55238 var isindex = [
55239         "prompt"
55240 ];
55241 var label = [
55242         "accesskey",
55243         "for",
55244         "form"
55245 ];
55246 var legend = [
55247         "accesskey",
55248         "align"
55249 ];
55250 var li = [
55251         "type",
55252         "value"
55253 ];
55254 var link = [
55255         "as",
55256         "charset",
55257         "color",
55258         "crossorigin",
55259         "disabled",
55260         "href",
55261         "hreflang",
55262         "imagesizes",
55263         "imagesrcset",
55264         "integrity",
55265         "media",
55266         "nonce",
55267         "referrerpolicy",
55268         "rel",
55269         "rev",
55270         "sizes",
55271         "target",
55272         "title",
55273         "type"
55274 ];
55275 var map = [
55276         "name"
55277 ];
55278 var menu = [
55279         "compact"
55280 ];
55281 var meta = [
55282         "charset",
55283         "content",
55284         "http-equiv",
55285         "name",
55286         "scheme"
55287 ];
55288 var meter = [
55289         "high",
55290         "low",
55291         "max",
55292         "min",
55293         "optimum",
55294         "value"
55295 ];
55296 var object = [
55297         "align",
55298         "archive",
55299         "border",
55300         "classid",
55301         "codebase",
55302         "codetype",
55303         "data",
55304         "declare",
55305         "form",
55306         "height",
55307         "hspace",
55308         "name",
55309         "standby",
55310         "tabindex",
55311         "type",
55312         "typemustmatch",
55313         "usemap",
55314         "vspace",
55315         "width"
55316 ];
55317 var ol = [
55318         "compact",
55319         "reversed",
55320         "start",
55321         "type"
55322 ];
55323 var optgroup = [
55324         "disabled",
55325         "label"
55326 ];
55327 var option = [
55328         "disabled",
55329         "label",
55330         "selected",
55331         "value"
55332 ];
55333 var output = [
55334         "for",
55335         "form",
55336         "name"
55337 ];
55338 var p = [
55339         "align"
55340 ];
55341 var param = [
55342         "name",
55343         "type",
55344         "value",
55345         "valuetype"
55346 ];
55347 var pre = [
55348         "width"
55349 ];
55350 var progress = [
55351         "max",
55352         "value"
55353 ];
55354 var q = [
55355         "cite"
55356 ];
55357 var script = [
55358         "async",
55359         "charset",
55360         "crossorigin",
55361         "defer",
55362         "integrity",
55363         "language",
55364         "nomodule",
55365         "nonce",
55366         "referrerpolicy",
55367         "src",
55368         "type"
55369 ];
55370 var select = [
55371         "autocomplete",
55372         "autofocus",
55373         "disabled",
55374         "form",
55375         "multiple",
55376         "name",
55377         "required",
55378         "size",
55379         "tabindex"
55380 ];
55381 var slot = [
55382         "name"
55383 ];
55384 var source = [
55385         "media",
55386         "sizes",
55387         "src",
55388         "srcset",
55389         "type"
55390 ];
55391 var style = [
55392         "media",
55393         "nonce",
55394         "title",
55395         "type"
55396 ];
55397 var table = [
55398         "align",
55399         "bgcolor",
55400         "border",
55401         "cellpadding",
55402         "cellspacing",
55403         "frame",
55404         "rules",
55405         "summary",
55406         "width"
55407 ];
55408 var tbody = [
55409         "align",
55410         "char",
55411         "charoff",
55412         "valign"
55413 ];
55414 var td = [
55415         "abbr",
55416         "align",
55417         "axis",
55418         "bgcolor",
55419         "char",
55420         "charoff",
55421         "colspan",
55422         "headers",
55423         "height",
55424         "nowrap",
55425         "rowspan",
55426         "scope",
55427         "valign",
55428         "width"
55429 ];
55430 var textarea = [
55431         "accesskey",
55432         "autocomplete",
55433         "autofocus",
55434         "cols",
55435         "dirname",
55436         "disabled",
55437         "form",
55438         "maxlength",
55439         "minlength",
55440         "name",
55441         "placeholder",
55442         "readonly",
55443         "required",
55444         "rows",
55445         "tabindex",
55446         "wrap"
55447 ];
55448 var tfoot = [
55449         "align",
55450         "char",
55451         "charoff",
55452         "valign"
55453 ];
55454 var th = [
55455         "abbr",
55456         "align",
55457         "axis",
55458         "bgcolor",
55459         "char",
55460         "charoff",
55461         "colspan",
55462         "headers",
55463         "height",
55464         "nowrap",
55465         "rowspan",
55466         "scope",
55467         "valign",
55468         "width"
55469 ];
55470 var thead = [
55471         "align",
55472         "char",
55473         "charoff",
55474         "valign"
55475 ];
55476 var time = [
55477         "datetime"
55478 ];
55479 var tr = [
55480         "align",
55481         "bgcolor",
55482         "char",
55483         "charoff",
55484         "valign"
55485 ];
55486 var track = [
55487         "default",
55488         "kind",
55489         "label",
55490         "src",
55491         "srclang"
55492 ];
55493 var ul = [
55494         "compact",
55495         "type"
55496 ];
55497 var video = [
55498         "autoplay",
55499         "controls",
55500         "crossorigin",
55501         "height",
55502         "loop",
55503         "muted",
55504         "playsinline",
55505         "poster",
55506         "preload",
55507         "src",
55508         "width"
55509 ];
55510 var require$$1 = {
55511         "*": [
55512         "accesskey",
55513         "autocapitalize",
55514         "autofocus",
55515         "class",
55516         "contenteditable",
55517         "dir",
55518         "draggable",
55519         "enterkeyhint",
55520         "hidden",
55521         "id",
55522         "inputmode",
55523         "is",
55524         "itemid",
55525         "itemprop",
55526         "itemref",
55527         "itemscope",
55528         "itemtype",
55529         "lang",
55530         "nonce",
55531         "slot",
55532         "spellcheck",
55533         "style",
55534         "tabindex",
55535         "title",
55536         "translate"
55537 ],
55538         a: a,
55539         abbr: abbr,
55540         applet: applet,
55541         area: area,
55542         audio: audio,
55543         base: base,
55544         basefont: basefont,
55545         bdo: bdo,
55546         blockquote: blockquote,
55547         body: body,
55548         br: br,
55549         button: button,
55550         canvas: canvas,
55551         caption: caption,
55552         col: col,
55553         colgroup: colgroup,
55554         data: data,
55555         del: del,
55556         details: details,
55557         dfn: dfn,
55558         dialog: dialog,
55559         dir: dir,
55560         div: div,
55561         dl: dl,
55562         embed: embed$4,
55563         fieldset: fieldset,
55564         font: font,
55565         form: form,
55566         frame: frame,
55567         frameset: frameset,
55568         h1: h1,
55569         h2: h2,
55570         h3: h3,
55571         h4: h4,
55572         h5: h5,
55573         h6: h6,
55574         head: head,
55575         hr: hr,
55576         html: html,
55577         iframe: iframe,
55578         img: img,
55579         input: input,
55580         ins: ins,
55581         isindex: isindex,
55582         label: label,
55583         legend: legend,
55584         li: li,
55585         link: link,
55586         map: map,
55587         menu: menu,
55588         meta: meta,
55589         meter: meter,
55590         object: object,
55591         ol: ol,
55592         optgroup: optgroup,
55593         option: option,
55594         output: output,
55595         p: p,
55596         param: param,
55597         pre: pre,
55598         progress: progress,
55599         q: q,
55600         script: script,
55601         select: select,
55602         slot: slot,
55603         source: source,
55604         style: style,
55605         table: table,
55606         tbody: tbody,
55607         td: td,
55608         textarea: textarea,
55609         tfoot: tfoot,
55610         th: th,
55611         thead: thead,
55612         time: time,
55613         tr: tr,
55614         track: track,
55615         ul: ul,
55616         video: video
55617 };
55618
55619 var require$$4$2 = {
55620   "CSS_DISPLAY_TAGS": {
55621     "area": "none",
55622     "base": "none",
55623     "basefont": "none",
55624     "datalist": "none",
55625     "head": "none",
55626     "link": "none",
55627     "meta": "none",
55628     "noembed": "none",
55629     "noframes": "none",
55630     "param": "block",
55631     "rp": "none",
55632     "script": "block",
55633     "source": "block",
55634     "style": "none",
55635     "template": "inline",
55636     "track": "block",
55637     "title": "none",
55638     "html": "block",
55639     "body": "block",
55640     "address": "block",
55641     "blockquote": "block",
55642     "center": "block",
55643     "div": "block",
55644     "figure": "block",
55645     "figcaption": "block",
55646     "footer": "block",
55647     "form": "block",
55648     "header": "block",
55649     "hr": "block",
55650     "legend": "block",
55651     "listing": "block",
55652     "main": "block",
55653     "p": "block",
55654     "plaintext": "block",
55655     "pre": "block",
55656     "xmp": "block",
55657     "slot": "contents",
55658     "ruby": "ruby",
55659     "rt": "ruby-text",
55660     "article": "block",
55661     "aside": "block",
55662     "h1": "block",
55663     "h2": "block",
55664     "h3": "block",
55665     "h4": "block",
55666     "h5": "block",
55667     "h6": "block",
55668     "hgroup": "block",
55669     "nav": "block",
55670     "section": "block",
55671     "dir": "block",
55672     "dd": "block",
55673     "dl": "block",
55674     "dt": "block",
55675     "ol": "block",
55676     "ul": "block",
55677     "li": "list-item",
55678     "table": "table",
55679     "caption": "table-caption",
55680     "colgroup": "table-column-group",
55681     "col": "table-column",
55682     "thead": "table-header-group",
55683     "tbody": "table-row-group",
55684     "tfoot": "table-footer-group",
55685     "tr": "table-row",
55686     "td": "table-cell",
55687     "th": "table-cell",
55688     "fieldset": "block",
55689     "button": "inline-block",
55690     "details": "block",
55691     "summary": "block",
55692     "dialog": "block",
55693     "meter": "inline-block",
55694     "progress": "inline-block",
55695     "object": "inline-block",
55696     "video": "inline-block",
55697     "audio": "inline-block",
55698     "select": "inline-block",
55699     "option": "block",
55700     "optgroup": "block"
55701   },
55702   "CSS_DISPLAY_DEFAULT": "inline",
55703   "CSS_WHITE_SPACE_TAGS": {
55704     "listing": "pre",
55705     "plaintext": "pre",
55706     "pre": "pre",
55707     "xmp": "pre",
55708     "nobr": "nowrap",
55709     "table": "initial",
55710     "textarea": "pre-wrap"
55711   },
55712   "CSS_WHITE_SPACE_DEFAULT": "normal"
55713 };
55714
55715 /**
55716  * @typedef {import("../common/ast-path")} AstPath
55717  */
55718
55719
55720 const htmlTagNames = require$$0;
55721 const htmlElementAttributes = require$$1;
55722 const {
55723   inferParserByLanguage,
55724   isFrontMatterNode
55725 } = util$8;
55726 const {
55727   builders: {
55728     line: line$9,
55729     hardline: hardline$7,
55730     join: join$6
55731   },
55732   utils: {
55733     getDocParts: getDocParts$3,
55734     replaceTextEndOfLine: replaceTextEndOfLine$6
55735   }
55736 } = require$$7$3;
55737 const {
55738   CSS_DISPLAY_TAGS,
55739   CSS_DISPLAY_DEFAULT,
55740   CSS_WHITE_SPACE_TAGS,
55741   CSS_WHITE_SPACE_DEFAULT
55742 } = require$$4$2;
55743 const HTML_TAGS = arrayToMap(htmlTagNames);
55744 const HTML_ELEMENT_ATTRIBUTES = mapObject(htmlElementAttributes, arrayToMap); // https://infra.spec.whatwg.org/#ascii-whitespace
55745
55746 const HTML_WHITESPACE = new Set(["\t", "\n", "\f", "\r", " "]);
55747
55748 const htmlTrimStart = string => string.replace(/^[\t\n\f\r ]+/, "");
55749
55750 const htmlTrimEnd = string => string.replace(/[\t\n\f\r ]+$/, "");
55751
55752 const htmlTrim$1 = string => htmlTrimStart(htmlTrimEnd(string));
55753
55754 const htmlTrimLeadingBlankLines = string => string.replace(/^[\t\f\r ]*?\n/g, "");
55755
55756 const htmlTrimPreserveIndentation$1 = string => htmlTrimLeadingBlankLines(htmlTrimEnd(string));
55757
55758 const splitByHtmlWhitespace = string => string.split(/[\t\n\f\r ]+/);
55759
55760 const getLeadingHtmlWhitespace = string => string.match(/^[\t\n\f\r ]*/)[0];
55761
55762 const getLeadingAndTrailingHtmlWhitespace$1 = string => {
55763   const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)(.*?)([\t\n\f\r ]*)$/s);
55764   return {
55765     leadingWhitespace,
55766     trailingWhitespace,
55767     text
55768   };
55769 };
55770
55771 const hasHtmlWhitespace$1 = string => /[\t\n\f\r ]/.test(string);
55772
55773 function arrayToMap(array) {
55774   const map = Object.create(null);
55775
55776   for (const value of array) {
55777     map[value] = true;
55778   }
55779
55780   return map;
55781 }
55782
55783 function mapObject(object, fn) {
55784   const newObject = Object.create(null);
55785
55786   for (const [key, value] of Object.entries(object)) {
55787     newObject[key] = fn(value, key);
55788   }
55789
55790   return newObject;
55791 }
55792
55793 function shouldPreserveContent$2(node, options) {
55794   // unterminated node in ie conditional comment
55795   // e.g. <!--[if lt IE 9]><html><![endif]-->
55796   if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
55797     return true;
55798   } // incomplete html in ie conditional comment
55799   // e.g. <!--[if lt IE 9]></div><![endif]-->
55800
55801
55802   if (node.type === "ieConditionalComment" && !node.complete) {
55803     return true;
55804   } // TODO: handle non-text children in <pre>
55805
55806
55807   if (isPreLikeNode$1(node) && node.children.some(child => child.type !== "text" && child.type !== "interpolation")) {
55808     return true;
55809   }
55810
55811   if (isVueNonHtmlBlock$1(node, options) && !isScriptLikeTag$2(node) && node.type !== "interpolation") {
55812     return true;
55813   }
55814
55815   return false;
55816 }
55817
55818 function hasPrettierIgnore$4(node) {
55819   /* istanbul ignore next */
55820   if (node.type === "attribute") {
55821     return false;
55822   }
55823   /* istanbul ignore next */
55824
55825
55826   if (!node.parent) {
55827     return false;
55828   }
55829
55830   if (typeof node.index !== "number" || node.index === 0) {
55831     return false;
55832   }
55833
55834   const prevNode = node.parent.children[node.index - 1];
55835   return isPrettierIgnore$1(prevNode);
55836 }
55837
55838 function isPrettierIgnore$1(node) {
55839   return node.type === "comment" && node.value.trim() === "prettier-ignore";
55840 }
55841 /** there's no opening/closing tag or it's considered not breakable */
55842
55843
55844 function isTextLikeNode$2(node) {
55845   return node.type === "text" || node.type === "comment";
55846 }
55847
55848 function isScriptLikeTag$2(node) {
55849   return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
55850 }
55851
55852 function canHaveInterpolation$1(node) {
55853   return node.children && !isScriptLikeTag$2(node);
55854 }
55855
55856 function isWhitespaceSensitiveNode$1(node) {
55857   return isScriptLikeTag$2(node) || node.type === "interpolation" || isIndentationSensitiveNode$1(node);
55858 }
55859
55860 function isIndentationSensitiveNode$1(node) {
55861   return getNodeCssStyleWhiteSpace(node).startsWith("pre");
55862 }
55863
55864 function isLeadingSpaceSensitiveNode$1(node, options) {
55865   const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
55866
55867   if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
55868     return node.type === "interpolation";
55869   }
55870
55871   return isLeadingSpaceSensitive;
55872
55873   function _isLeadingSpaceSensitiveNode() {
55874     if (isFrontMatterNode(node)) {
55875       return false;
55876     }
55877
55878     if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
55879       return true;
55880     }
55881
55882     if (!node.parent || node.parent.cssDisplay === "none") {
55883       return false;
55884     }
55885
55886     if (isPreLikeNode$1(node.parent)) {
55887       return true;
55888     }
55889
55890     if (!node.prev && (node.parent.type === "root" || isPreLikeNode$1(node) && node.parent || isScriptLikeTag$2(node.parent) || isVueCustomBlock$1(node.parent, options) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
55891       return false;
55892     }
55893
55894     if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
55895       return false;
55896     }
55897
55898     return true;
55899   }
55900 }
55901
55902 function isTrailingSpaceSensitiveNode$1(node, options) {
55903   if (isFrontMatterNode(node)) {
55904     return false;
55905   }
55906
55907   if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
55908     return true;
55909   }
55910
55911   if (!node.parent || node.parent.cssDisplay === "none") {
55912     return false;
55913   }
55914
55915   if (isPreLikeNode$1(node.parent)) {
55916     return true;
55917   }
55918
55919   if (!node.next && (node.parent.type === "root" || isPreLikeNode$1(node) && node.parent || isScriptLikeTag$2(node.parent) || isVueCustomBlock$1(node.parent, options) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
55920     return false;
55921   }
55922
55923   if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
55924     return false;
55925   }
55926
55927   return true;
55928 }
55929
55930 function isDanglingSpaceSensitiveNode$1(node) {
55931   return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag$2(node);
55932 }
55933
55934 function forceNextEmptyLine$1(node) {
55935   return isFrontMatterNode(node) || node.next && node.sourceSpan.end && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
55936 }
55937 /** firstChild leadingSpaces and lastChild trailingSpaces */
55938
55939
55940 function forceBreakContent$1(node) {
55941   return forceBreakChildren$1(node) || node.type === "element" && node.children.length > 0 && (["body", "script", "style"].includes(node.name) || node.children.some(child => hasNonTextChild(child))) || node.firstChild && node.firstChild === node.lastChild && node.firstChild.type !== "text" && hasLeadingLineBreak(node.firstChild) && (!node.lastChild.isTrailingSpaceSensitive || hasTrailingLineBreak(node.lastChild));
55942 }
55943 /** spaces between children */
55944
55945
55946 function forceBreakChildren$1(node) {
55947   return node.type === "element" && node.children.length > 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
55948 }
55949
55950 function preferHardlineAsLeadingSpaces$1(node) {
55951   return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
55952 }
55953
55954 function preferHardlineAsTrailingSpaces(node) {
55955   return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
55956 }
55957
55958 function hasSurroundingLineBreak(node) {
55959   return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
55960 }
55961
55962 function hasLeadingLineBreak(node) {
55963   return node.hasLeadingSpaces && (node.prev ? node.prev.sourceSpan.end.line < node.sourceSpan.start.line : node.parent.type === "root" || node.parent.startSourceSpan.end.line < node.sourceSpan.start.line);
55964 }
55965
55966 function hasTrailingLineBreak(node) {
55967   return node.hasTrailingSpaces && (node.next ? node.next.sourceSpan.start.line > node.sourceSpan.end.line : node.parent.type === "root" || node.parent.endSourceSpan && node.parent.endSourceSpan.start.line > node.sourceSpan.end.line);
55968 }
55969
55970 function preferHardlineAsSurroundingSpaces(node) {
55971   switch (node.type) {
55972     case "ieConditionalComment":
55973     case "comment":
55974     case "directive":
55975       return true;
55976
55977     case "element":
55978       return ["script", "select"].includes(node.name);
55979   }
55980
55981   return false;
55982 }
55983
55984 function getLastDescendant$1(node) {
55985   return node.lastChild ? getLastDescendant$1(node.lastChild) : node;
55986 }
55987
55988 function hasNonTextChild(node) {
55989   return node.children && node.children.some(child => child.type !== "text");
55990 }
55991
55992 function _inferScriptParser(node) {
55993   const {
55994     type,
55995     lang
55996   } = node.attrMap;
55997
55998   if (type === "module" || type === "text/javascript" || type === "text/babel" || type === "application/javascript" || lang === "jsx") {
55999     return "babel";
56000   }
56001
56002   if (type === "application/x-typescript" || lang === "ts" || lang === "tsx") {
56003     return "typescript";
56004   }
56005
56006   if (type === "text/markdown") {
56007     return "markdown";
56008   }
56009
56010   if (type === "text/html") {
56011     return "html";
56012   }
56013
56014   if (type && (type.endsWith("json") || type.endsWith("importmap"))) {
56015     return "json";
56016   }
56017
56018   if (type === "text/x-handlebars-template") {
56019     return "glimmer";
56020   }
56021 }
56022
56023 function inferStyleParser(node) {
56024   const {
56025     lang
56026   } = node.attrMap;
56027
56028   if (!lang || lang === "postcss" || lang === "css") {
56029     return "css";
56030   }
56031
56032   if (lang === "scss") {
56033     return "scss";
56034   }
56035
56036   if (lang === "less") {
56037     return "less";
56038   }
56039 }
56040
56041 function inferScriptParser$1(node, options) {
56042   if (node.name === "script" && !node.attrMap.src) {
56043     if (!node.attrMap.lang && !node.attrMap.type) {
56044       return "babel";
56045     }
56046
56047     return _inferScriptParser(node);
56048   }
56049
56050   if (node.name === "style") {
56051     return inferStyleParser(node);
56052   }
56053
56054   if (options && isVueNonHtmlBlock$1(node, options)) {
56055     return _inferScriptParser(node) || !("src" in node.attrMap) && inferParserByLanguage(node.attrMap.lang, options);
56056   }
56057 }
56058
56059 function isBlockLikeCssDisplay(cssDisplay) {
56060   return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
56061 }
56062
56063 function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
56064   return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
56065 }
56066
56067 function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
56068   return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
56069 }
56070
56071 function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
56072   return !isBlockLikeCssDisplay(cssDisplay);
56073 }
56074
56075 function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
56076   return !isBlockLikeCssDisplay(cssDisplay);
56077 }
56078
56079 function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
56080   return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
56081 }
56082
56083 function isPreLikeNode$1(node) {
56084   return getNodeCssStyleWhiteSpace(node).startsWith("pre");
56085 }
56086 /**
56087  * @param {AstPath} path
56088  * @param {(any) => boolean} predicate
56089  */
56090
56091
56092 function countParents$1(path, predicate) {
56093   let counter = 0;
56094
56095   for (let i = path.stack.length - 1; i >= 0; i--) {
56096     const value = path.stack[i];
56097
56098     if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
56099       counter++;
56100     }
56101   }
56102
56103   return counter;
56104 }
56105
56106 function hasParent(node, fn) {
56107   let current = node;
56108
56109   while (current) {
56110     if (fn(current)) {
56111       return true;
56112     }
56113
56114     current = current.parent;
56115   }
56116
56117   return false;
56118 }
56119
56120 function getNodeCssStyleDisplay$1(node, options) {
56121   if (node.prev && node.prev.type === "comment") {
56122     // <!-- display: block -->
56123     const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
56124
56125     if (match) {
56126       return match[1];
56127     }
56128   }
56129
56130   let isInSvgForeignObject = false;
56131
56132   if (node.type === "element" && node.namespace === "svg") {
56133     if (hasParent(node, parent => parent.fullName === "svg:foreignObject")) {
56134       isInSvgForeignObject = true;
56135     } else {
56136       return node.name === "svg" ? "inline-block" : "block";
56137     }
56138   }
56139
56140   switch (options.htmlWhitespaceSensitivity) {
56141     case "strict":
56142       return "inline";
56143
56144     case "ignore":
56145       return "block";
56146
56147     default:
56148       {
56149         // See https://github.com/prettier/prettier/issues/8151
56150         if (options.parser === "vue" && node.parent && node.parent.type === "root") {
56151           return "block";
56152         }
56153
56154         return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
56155       }
56156   }
56157 }
56158
56159 function isUnknownNamespace(node) {
56160   return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
56161 }
56162
56163 function getNodeCssStyleWhiteSpace(node) {
56164   return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
56165 }
56166
56167 function getMinIndentation(text) {
56168   let minIndentation = Number.POSITIVE_INFINITY;
56169
56170   for (const lineText of text.split("\n")) {
56171     if (lineText.length === 0) {
56172       continue;
56173     }
56174
56175     if (!HTML_WHITESPACE.has(lineText[0])) {
56176       return 0;
56177     }
56178
56179     const indentation = getLeadingHtmlWhitespace(lineText).length;
56180
56181     if (lineText.length === indentation) {
56182       continue;
56183     }
56184
56185     if (indentation < minIndentation) {
56186       minIndentation = indentation;
56187     }
56188   }
56189
56190   return minIndentation === Number.POSITIVE_INFINITY ? 0 : minIndentation;
56191 }
56192
56193 function dedentString$1(text, minIndent = getMinIndentation(text)) {
56194   return minIndent === 0 ? text : text.split("\n").map(lineText => lineText.slice(minIndent)).join("\n");
56195 }
56196
56197 function countChars$1(text, char) {
56198   let counter = 0;
56199
56200   for (let i = 0; i < text.length; i++) {
56201     if (text[i] === char) {
56202       counter++;
56203     }
56204   }
56205
56206   return counter;
56207 }
56208
56209 function unescapeQuoteEntities$2(text) {
56210   return text.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
56211 } // top-level elements (excluding <template>, <style> and <script>) in Vue SFC are considered custom block
56212 // See https://vue-loader.vuejs.org/spec.html for detail
56213
56214
56215 const vueRootElementsSet = new Set(["template", "style", "script"]);
56216
56217 function isVueCustomBlock$1(node, options) {
56218   return isVueSfcBlock(node, options) && !vueRootElementsSet.has(node.fullName);
56219 }
56220
56221 function isVueSfcBlock(node, options) {
56222   return options.parser === "vue" && node.type === "element" && node.parent.type === "root" && node.fullName.toLowerCase() !== "html";
56223 }
56224
56225 function isVueNonHtmlBlock$1(node, options) {
56226   return isVueSfcBlock(node, options) && (isVueCustomBlock$1(node, options) || node.attrMap.lang && node.attrMap.lang !== "html");
56227 }
56228
56229 function isVueSlotAttribute$1(attribute) {
56230   const attributeName = attribute.fullName;
56231   return attributeName.charAt(0) === "#" || attributeName === "slot-scope" || attributeName === "v-slot" || attributeName.startsWith("v-slot:");
56232 }
56233
56234 function isVueSfcBindingsAttribute$1(attribute, options) {
56235   const element = attribute.parent;
56236
56237   if (!isVueSfcBlock(element, options)) {
56238     return false;
56239   }
56240
56241   const tagName = element.fullName;
56242   const attributeName = attribute.fullName;
56243   return (// https://github.com/vuejs/rfcs/blob/sfc-improvements/active-rfcs/0000-sfc-script-setup.md
56244     tagName === "script" && attributeName === "setup" || // https://github.com/vuejs/rfcs/blob/sfc-improvements/active-rfcs/0000-sfc-style-variables.md
56245     tagName === "style" && attributeName === "vars"
56246   );
56247 }
56248
56249 function getTextValueParts$2(node, value = node.value) {
56250   return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceTextEndOfLine$6(value) : replaceTextEndOfLine$6(dedentString$1(htmlTrimPreserveIndentation$1(value)), hardline$7) : getDocParts$3(join$6(line$9, splitByHtmlWhitespace(value)));
56251 }
56252
56253 var utils$1 = {
56254   HTML_ELEMENT_ATTRIBUTES,
56255   HTML_TAGS,
56256   htmlTrim: htmlTrim$1,
56257   htmlTrimPreserveIndentation: htmlTrimPreserveIndentation$1,
56258   hasHtmlWhitespace: hasHtmlWhitespace$1,
56259   getLeadingAndTrailingHtmlWhitespace: getLeadingAndTrailingHtmlWhitespace$1,
56260   canHaveInterpolation: canHaveInterpolation$1,
56261   countChars: countChars$1,
56262   countParents: countParents$1,
56263   dedentString: dedentString$1,
56264   forceBreakChildren: forceBreakChildren$1,
56265   forceBreakContent: forceBreakContent$1,
56266   forceNextEmptyLine: forceNextEmptyLine$1,
56267   getLastDescendant: getLastDescendant$1,
56268   getNodeCssStyleDisplay: getNodeCssStyleDisplay$1,
56269   getNodeCssStyleWhiteSpace,
56270   hasPrettierIgnore: hasPrettierIgnore$4,
56271   inferScriptParser: inferScriptParser$1,
56272   isVueCustomBlock: isVueCustomBlock$1,
56273   isVueNonHtmlBlock: isVueNonHtmlBlock$1,
56274   isVueSlotAttribute: isVueSlotAttribute$1,
56275   isVueSfcBindingsAttribute: isVueSfcBindingsAttribute$1,
56276   isDanglingSpaceSensitiveNode: isDanglingSpaceSensitiveNode$1,
56277   isIndentationSensitiveNode: isIndentationSensitiveNode$1,
56278   isLeadingSpaceSensitiveNode: isLeadingSpaceSensitiveNode$1,
56279   isPreLikeNode: isPreLikeNode$1,
56280   isScriptLikeTag: isScriptLikeTag$2,
56281   isTextLikeNode: isTextLikeNode$2,
56282   isTrailingSpaceSensitiveNode: isTrailingSpaceSensitiveNode$1,
56283   isWhitespaceSensitiveNode: isWhitespaceSensitiveNode$1,
56284   isUnknownNamespace,
56285   preferHardlineAsLeadingSpaces: preferHardlineAsLeadingSpaces$1,
56286   preferHardlineAsTrailingSpaces,
56287   shouldPreserveContent: shouldPreserveContent$2,
56288   unescapeQuoteEntities: unescapeQuoteEntities$2,
56289   getTextValueParts: getTextValueParts$2
56290 };
56291
56292 var parse_util = {};
56293
56294 var chars = {};
56295
56296 (function (exports) {
56297   /**
56298    * @license
56299    * Copyright Google Inc. All Rights Reserved.
56300    *
56301    * Use of this source code is governed by an MIT-style license that can be
56302    * found in the LICENSE file at https://angular.io/license
56303    */
56304
56305   Object.defineProperty(exports, "__esModule", {
56306     value: true
56307   });
56308   exports.$EOF = 0;
56309   exports.$BSPACE = 8;
56310   exports.$TAB = 9;
56311   exports.$LF = 10;
56312   exports.$VTAB = 11;
56313   exports.$FF = 12;
56314   exports.$CR = 13;
56315   exports.$SPACE = 32;
56316   exports.$BANG = 33;
56317   exports.$DQ = 34;
56318   exports.$HASH = 35;
56319   exports.$$ = 36;
56320   exports.$PERCENT = 37;
56321   exports.$AMPERSAND = 38;
56322   exports.$SQ = 39;
56323   exports.$LPAREN = 40;
56324   exports.$RPAREN = 41;
56325   exports.$STAR = 42;
56326   exports.$PLUS = 43;
56327   exports.$COMMA = 44;
56328   exports.$MINUS = 45;
56329   exports.$PERIOD = 46;
56330   exports.$SLASH = 47;
56331   exports.$COLON = 58;
56332   exports.$SEMICOLON = 59;
56333   exports.$LT = 60;
56334   exports.$EQ = 61;
56335   exports.$GT = 62;
56336   exports.$QUESTION = 63;
56337   exports.$0 = 48;
56338   exports.$7 = 55;
56339   exports.$9 = 57;
56340   exports.$A = 65;
56341   exports.$E = 69;
56342   exports.$F = 70;
56343   exports.$X = 88;
56344   exports.$Z = 90;
56345   exports.$LBRACKET = 91;
56346   exports.$BACKSLASH = 92;
56347   exports.$RBRACKET = 93;
56348   exports.$CARET = 94;
56349   exports.$_ = 95;
56350   exports.$a = 97;
56351   exports.$b = 98;
56352   exports.$e = 101;
56353   exports.$f = 102;
56354   exports.$n = 110;
56355   exports.$r = 114;
56356   exports.$t = 116;
56357   exports.$u = 117;
56358   exports.$v = 118;
56359   exports.$x = 120;
56360   exports.$z = 122;
56361   exports.$LBRACE = 123;
56362   exports.$BAR = 124;
56363   exports.$RBRACE = 125;
56364   exports.$NBSP = 160;
56365   exports.$PIPE = 124;
56366   exports.$TILDA = 126;
56367   exports.$AT = 64;
56368   exports.$BT = 96;
56369
56370   function isWhitespace(code) {
56371     return code >= exports.$TAB && code <= exports.$SPACE || code == exports.$NBSP;
56372   }
56373
56374   exports.isWhitespace = isWhitespace;
56375
56376   function isDigit(code) {
56377     return exports.$0 <= code && code <= exports.$9;
56378   }
56379
56380   exports.isDigit = isDigit;
56381
56382   function isAsciiLetter(code) {
56383     return code >= exports.$a && code <= exports.$z || code >= exports.$A && code <= exports.$Z;
56384   }
56385
56386   exports.isAsciiLetter = isAsciiLetter;
56387
56388   function isAsciiHexDigit(code) {
56389     return code >= exports.$a && code <= exports.$f || code >= exports.$A && code <= exports.$F || isDigit(code);
56390   }
56391
56392   exports.isAsciiHexDigit = isAsciiHexDigit;
56393
56394   function isNewLine(code) {
56395     return code === exports.$LF || code === exports.$CR;
56396   }
56397
56398   exports.isNewLine = isNewLine;
56399
56400   function isOctalDigit(code) {
56401     return exports.$0 <= code && code <= exports.$7;
56402   }
56403
56404   exports.isOctalDigit = isOctalDigit;
56405 })(chars);
56406
56407 var compile_metadata = {};
56408
56409 var static_symbol = {};
56410
56411 /**
56412  * @license
56413  * Copyright Google Inc. All Rights Reserved.
56414  *
56415  * Use of this source code is governed by an MIT-style license that can be
56416  * found in the LICENSE file at https://angular.io/license
56417  */
56418
56419
56420 Object.defineProperty(static_symbol, "__esModule", {
56421   value: true
56422 });
56423 /**
56424  * A token representing the a reference to a static type.
56425  *
56426  * This token is unique for a filePath and name and can be used as a hash table key.
56427  */
56428
56429 class StaticSymbol {
56430   constructor(filePath, name, members) {
56431     this.filePath = filePath;
56432     this.name = name;
56433     this.members = members;
56434   }
56435
56436   assertNoMembers() {
56437     if (this.members.length) {
56438       throw new Error(`Illegal state: symbol without members expected, but got ${JSON.stringify(this)}.`);
56439     }
56440   }
56441
56442 }
56443
56444 static_symbol.StaticSymbol = StaticSymbol;
56445 /**
56446  * A cache of static symbol used by the StaticReflector to return the same symbol for the
56447  * same symbol values.
56448  */
56449
56450 class StaticSymbolCache {
56451   constructor() {
56452     this.cache = new Map();
56453   }
56454
56455   get(declarationFile, name, members) {
56456     members = members || [];
56457     const memberSuffix = members.length ? `.${members.join('.')}` : '';
56458     const key = `"${declarationFile}".${name}${memberSuffix}`;
56459     let result = this.cache.get(key);
56460
56461     if (!result) {
56462       result = new StaticSymbol(declarationFile, name, members);
56463       this.cache.set(key, result);
56464     }
56465
56466     return result;
56467   }
56468
56469 }
56470
56471 static_symbol.StaticSymbolCache = StaticSymbolCache;
56472
56473 var util = {};
56474
56475 /**
56476  * @license
56477  * Copyright Google Inc. All Rights Reserved.
56478  *
56479  * Use of this source code is governed by an MIT-style license that can be
56480  * found in the LICENSE file at https://angular.io/license
56481  */
56482
56483
56484 Object.defineProperty(util, "__esModule", {
56485   value: true
56486 });
56487 const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
56488
56489 function dashCaseToCamelCase(input) {
56490   return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
56491 }
56492
56493 util.dashCaseToCamelCase = dashCaseToCamelCase;
56494
56495 function splitAtColon(input, defaultValues) {
56496   return _splitAt(input, ':', defaultValues);
56497 }
56498
56499 util.splitAtColon = splitAtColon;
56500
56501 function splitAtPeriod(input, defaultValues) {
56502   return _splitAt(input, '.', defaultValues);
56503 }
56504
56505 util.splitAtPeriod = splitAtPeriod;
56506
56507 function _splitAt(input, character, defaultValues) {
56508   const characterIndex = input.indexOf(character);
56509   if (characterIndex == -1) return defaultValues;
56510   return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
56511 }
56512
56513 function visitValue(value, visitor, context) {
56514   if (Array.isArray(value)) {
56515     return visitor.visitArray(value, context);
56516   }
56517
56518   if (isStrictStringMap(value)) {
56519     return visitor.visitStringMap(value, context);
56520   }
56521
56522   if (value == null || typeof value == 'string' || typeof value == 'number' || typeof value == 'boolean') {
56523     return visitor.visitPrimitive(value, context);
56524   }
56525
56526   return visitor.visitOther(value, context);
56527 }
56528
56529 util.visitValue = visitValue;
56530
56531 function isDefined(val) {
56532   return val !== null && val !== undefined;
56533 }
56534
56535 util.isDefined = isDefined;
56536
56537 function noUndefined(val) {
56538   return val === undefined ? null : val;
56539 }
56540
56541 util.noUndefined = noUndefined;
56542
56543 class ValueTransformer {
56544   visitArray(arr, context) {
56545     return arr.map(value => visitValue(value, this, context));
56546   }
56547
56548   visitStringMap(map, context) {
56549     const result = {};
56550     Object.keys(map).forEach(key => {
56551       result[key] = visitValue(map[key], this, context);
56552     });
56553     return result;
56554   }
56555
56556   visitPrimitive(value, context) {
56557     return value;
56558   }
56559
56560   visitOther(value, context) {
56561     return value;
56562   }
56563
56564 }
56565
56566 util.ValueTransformer = ValueTransformer;
56567 util.SyncAsync = {
56568   assertSync: value => {
56569     if (isPromise(value)) {
56570       throw new Error(`Illegal state: value cannot be a promise`);
56571     }
56572
56573     return value;
56574   },
56575   then: (value, cb) => {
56576     return isPromise(value) ? value.then(cb) : cb(value);
56577   },
56578   all: syncAsyncValues => {
56579     return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
56580   }
56581 };
56582
56583 function error(msg) {
56584   throw new Error(`Internal Error: ${msg}`);
56585 }
56586
56587 util.error = error;
56588
56589 function syntaxError(msg, parseErrors) {
56590   const error = Error(msg);
56591   error[ERROR_SYNTAX_ERROR] = true;
56592   if (parseErrors) error[ERROR_PARSE_ERRORS] = parseErrors;
56593   return error;
56594 }
56595
56596 util.syntaxError = syntaxError;
56597 const ERROR_SYNTAX_ERROR = 'ngSyntaxError';
56598 const ERROR_PARSE_ERRORS = 'ngParseErrors';
56599
56600 function isSyntaxError(error) {
56601   return error[ERROR_SYNTAX_ERROR];
56602 }
56603
56604 util.isSyntaxError = isSyntaxError;
56605
56606 function getParseErrors(error) {
56607   return error[ERROR_PARSE_ERRORS] || [];
56608 }
56609
56610 util.getParseErrors = getParseErrors; // Escape characters that have a special meaning in Regular Expressions
56611
56612 function escapeRegExp(s) {
56613   return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
56614 }
56615
56616 util.escapeRegExp = escapeRegExp;
56617 const STRING_MAP_PROTO = Object.getPrototypeOf({});
56618
56619 function isStrictStringMap(obj) {
56620   return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
56621 }
56622
56623 function utf8Encode(str) {
56624   let encoded = '';
56625
56626   for (let index = 0; index < str.length; index++) {
56627     let codePoint = str.charCodeAt(index); // decode surrogate
56628     // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
56629
56630     if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > index + 1) {
56631       const low = str.charCodeAt(index + 1);
56632
56633       if (low >= 0xdc00 && low <= 0xdfff) {
56634         index++;
56635         codePoint = (codePoint - 0xd800 << 10) + low - 0xdc00 + 0x10000;
56636       }
56637     }
56638
56639     if (codePoint <= 0x7f) {
56640       encoded += String.fromCharCode(codePoint);
56641     } else if (codePoint <= 0x7ff) {
56642       encoded += String.fromCharCode(codePoint >> 6 & 0x1F | 0xc0, codePoint & 0x3f | 0x80);
56643     } else if (codePoint <= 0xffff) {
56644       encoded += String.fromCharCode(codePoint >> 12 | 0xe0, codePoint >> 6 & 0x3f | 0x80, codePoint & 0x3f | 0x80);
56645     } else if (codePoint <= 0x1fffff) {
56646       encoded += String.fromCharCode(codePoint >> 18 & 0x07 | 0xf0, codePoint >> 12 & 0x3f | 0x80, codePoint >> 6 & 0x3f | 0x80, codePoint & 0x3f | 0x80);
56647     }
56648   }
56649
56650   return encoded;
56651 }
56652
56653 util.utf8Encode = utf8Encode;
56654
56655 function stringify(token) {
56656   if (typeof token === 'string') {
56657     return token;
56658   }
56659
56660   if (token instanceof Array) {
56661     return '[' + token.map(stringify).join(', ') + ']';
56662   }
56663
56664   if (token == null) {
56665     return '' + token;
56666   }
56667
56668   if (token.overriddenName) {
56669     return `${token.overriddenName}`;
56670   }
56671
56672   if (token.name) {
56673     return `${token.name}`;
56674   }
56675
56676   if (!token.toString) {
56677     return 'object';
56678   } // WARNING: do not try to `JSON.stringify(token)` here
56679   // see https://github.com/angular/angular/issues/23440
56680
56681
56682   const res = token.toString();
56683
56684   if (res == null) {
56685     return '' + res;
56686   }
56687
56688   const newLineIndex = res.indexOf('\n');
56689   return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
56690 }
56691
56692 util.stringify = stringify;
56693 /**
56694  * Lazily retrieves the reference value from a forwardRef.
56695  */
56696
56697 function resolveForwardRef(type) {
56698   if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
56699     return type();
56700   } else {
56701     return type;
56702   }
56703 }
56704
56705 util.resolveForwardRef = resolveForwardRef;
56706 /**
56707  * Determine if the argument is shaped like a Promise
56708  */
56709
56710 function isPromise(obj) {
56711   // allow any Promise/A+ compliant thenable.
56712   // It's up to the caller to ensure that obj.then conforms to the spec
56713   return !!obj && typeof obj.then === 'function';
56714 }
56715
56716 util.isPromise = isPromise;
56717
56718 class Version {
56719   constructor(full) {
56720     this.full = full;
56721     const splits = full.split('.');
56722     this.major = splits[0];
56723     this.minor = splits[1];
56724     this.patch = splits.slice(2).join('.');
56725   }
56726
56727 }
56728
56729 util.Version = Version;
56730
56731 const __window = typeof window !== 'undefined' && window;
56732
56733 const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self;
56734
56735 const __global = typeof global$1 !== 'undefined' && global$1; // Check __global first, because in Node tests both __global and __window may be defined and _global
56736 // should be __global in that case.
56737
56738
56739 const _global = __global || __window || __self;
56740
56741 var global$1 = util.global = _global;
56742
56743 (function (exports) {
56744   /**
56745    * @license
56746    * Copyright Google Inc. All Rights Reserved.
56747    *
56748    * Use of this source code is governed by an MIT-style license that can be
56749    * found in the LICENSE file at https://angular.io/license
56750    */
56751
56752   Object.defineProperty(exports, "__esModule", {
56753     value: true
56754   });
56755   const static_symbol_1 = static_symbol;
56756   const util_1 = util; // group 0: "[prop] or (event) or @trigger"
56757   // group 1: "prop" from "[prop]"
56758   // group 2: "event" from "(event)"
56759   // group 3: "@trigger" from "@trigger"
56760
56761   const HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
56762
56763   function sanitizeIdentifier(name) {
56764     return name.replace(/\W/g, '_');
56765   }
56766
56767   exports.sanitizeIdentifier = sanitizeIdentifier;
56768   let _anonymousTypeIndex = 0;
56769
56770   function identifierName(compileIdentifier) {
56771     if (!compileIdentifier || !compileIdentifier.reference) {
56772       return null;
56773     }
56774
56775     const ref = compileIdentifier.reference;
56776
56777     if (ref instanceof static_symbol_1.StaticSymbol) {
56778       return ref.name;
56779     }
56780
56781     if (ref['__anonymousType']) {
56782       return ref['__anonymousType'];
56783     }
56784
56785     let identifier = util_1.stringify(ref);
56786
56787     if (identifier.indexOf('(') >= 0) {
56788       // case: anonymous functions!
56789       identifier = `anonymous_${_anonymousTypeIndex++}`;
56790       ref['__anonymousType'] = identifier;
56791     } else {
56792       identifier = sanitizeIdentifier(identifier);
56793     }
56794
56795     return identifier;
56796   }
56797
56798   exports.identifierName = identifierName;
56799
56800   function identifierModuleUrl(compileIdentifier) {
56801     const ref = compileIdentifier.reference;
56802
56803     if (ref instanceof static_symbol_1.StaticSymbol) {
56804       return ref.filePath;
56805     } // Runtime type
56806
56807
56808     return `./${util_1.stringify(ref)}`;
56809   }
56810
56811   exports.identifierModuleUrl = identifierModuleUrl;
56812
56813   function viewClassName(compType, embeddedTemplateIndex) {
56814     return `View_${identifierName({
56815       reference: compType
56816     })}_${embeddedTemplateIndex}`;
56817   }
56818
56819   exports.viewClassName = viewClassName;
56820
56821   function rendererTypeName(compType) {
56822     return `RenderType_${identifierName({
56823       reference: compType
56824     })}`;
56825   }
56826
56827   exports.rendererTypeName = rendererTypeName;
56828
56829   function hostViewClassName(compType) {
56830     return `HostView_${identifierName({
56831       reference: compType
56832     })}`;
56833   }
56834
56835   exports.hostViewClassName = hostViewClassName;
56836
56837   function componentFactoryName(compType) {
56838     return `${identifierName({
56839       reference: compType
56840     })}NgFactory`;
56841   }
56842
56843   exports.componentFactoryName = componentFactoryName;
56844   var CompileSummaryKind;
56845
56846   (function (CompileSummaryKind) {
56847     CompileSummaryKind[CompileSummaryKind["Pipe"] = 0] = "Pipe";
56848     CompileSummaryKind[CompileSummaryKind["Directive"] = 1] = "Directive";
56849     CompileSummaryKind[CompileSummaryKind["NgModule"] = 2] = "NgModule";
56850     CompileSummaryKind[CompileSummaryKind["Injectable"] = 3] = "Injectable";
56851   })(CompileSummaryKind = exports.CompileSummaryKind || (exports.CompileSummaryKind = {}));
56852
56853   function tokenName(token) {
56854     return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
56855   }
56856
56857   exports.tokenName = tokenName;
56858
56859   function tokenReference(token) {
56860     if (token.identifier != null) {
56861       return token.identifier.reference;
56862     } else {
56863       return token.value;
56864     }
56865   }
56866
56867   exports.tokenReference = tokenReference;
56868   /**
56869    * Metadata about a stylesheet
56870    */
56871
56872   class CompileStylesheetMetadata {
56873     constructor({
56874       moduleUrl,
56875       styles,
56876       styleUrls
56877     } = {}) {
56878       this.moduleUrl = moduleUrl || null;
56879       this.styles = _normalizeArray(styles);
56880       this.styleUrls = _normalizeArray(styleUrls);
56881     }
56882
56883   }
56884
56885   exports.CompileStylesheetMetadata = CompileStylesheetMetadata;
56886   /**
56887    * Metadata regarding compilation of a template.
56888    */
56889
56890   class CompileTemplateMetadata {
56891     constructor({
56892       encapsulation,
56893       template,
56894       templateUrl,
56895       htmlAst,
56896       styles,
56897       styleUrls,
56898       externalStylesheets,
56899       animations,
56900       ngContentSelectors,
56901       interpolation,
56902       isInline,
56903       preserveWhitespaces
56904     }) {
56905       this.encapsulation = encapsulation;
56906       this.template = template;
56907       this.templateUrl = templateUrl;
56908       this.htmlAst = htmlAst;
56909       this.styles = _normalizeArray(styles);
56910       this.styleUrls = _normalizeArray(styleUrls);
56911       this.externalStylesheets = _normalizeArray(externalStylesheets);
56912       this.animations = animations ? flatten(animations) : [];
56913       this.ngContentSelectors = ngContentSelectors || [];
56914
56915       if (interpolation && interpolation.length != 2) {
56916         throw new Error(`'interpolation' should have a start and an end symbol.`);
56917       }
56918
56919       this.interpolation = interpolation;
56920       this.isInline = isInline;
56921       this.preserveWhitespaces = preserveWhitespaces;
56922     }
56923
56924     toSummary() {
56925       return {
56926         ngContentSelectors: this.ngContentSelectors,
56927         encapsulation: this.encapsulation,
56928         styles: this.styles,
56929         animations: this.animations
56930       };
56931     }
56932
56933   }
56934
56935   exports.CompileTemplateMetadata = CompileTemplateMetadata;
56936   /**
56937    * Metadata regarding compilation of a directive.
56938    */
56939
56940   class CompileDirectiveMetadata {
56941     static create({
56942       isHost,
56943       type,
56944       isComponent,
56945       selector,
56946       exportAs,
56947       changeDetection,
56948       inputs,
56949       outputs,
56950       host,
56951       providers,
56952       viewProviders,
56953       queries,
56954       guards,
56955       viewQueries,
56956       entryComponents,
56957       template,
56958       componentViewType,
56959       rendererType,
56960       componentFactory
56961     }) {
56962       const hostListeners = {};
56963       const hostProperties = {};
56964       const hostAttributes = {};
56965
56966       if (host != null) {
56967         Object.keys(host).forEach(key => {
56968           const value = host[key];
56969           const matches = key.match(HOST_REG_EXP);
56970
56971           if (matches === null) {
56972             hostAttributes[key] = value;
56973           } else if (matches[1] != null) {
56974             hostProperties[matches[1]] = value;
56975           } else if (matches[2] != null) {
56976             hostListeners[matches[2]] = value;
56977           }
56978         });
56979       }
56980
56981       const inputsMap = {};
56982
56983       if (inputs != null) {
56984         inputs.forEach(bindConfig => {
56985           // canonical syntax: `dirProp: elProp`
56986           // if there is no `:`, use dirProp = elProp
56987           const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
56988           inputsMap[parts[0]] = parts[1];
56989         });
56990       }
56991
56992       const outputsMap = {};
56993
56994       if (outputs != null) {
56995         outputs.forEach(bindConfig => {
56996           // canonical syntax: `dirProp: elProp`
56997           // if there is no `:`, use dirProp = elProp
56998           const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
56999           outputsMap[parts[0]] = parts[1];
57000         });
57001       }
57002
57003       return new CompileDirectiveMetadata({
57004         isHost,
57005         type,
57006         isComponent: !!isComponent,
57007         selector,
57008         exportAs,
57009         changeDetection,
57010         inputs: inputsMap,
57011         outputs: outputsMap,
57012         hostListeners,
57013         hostProperties,
57014         hostAttributes,
57015         providers,
57016         viewProviders,
57017         queries,
57018         guards,
57019         viewQueries,
57020         entryComponents,
57021         template,
57022         componentViewType,
57023         rendererType,
57024         componentFactory
57025       });
57026     }
57027
57028     constructor({
57029       isHost,
57030       type,
57031       isComponent,
57032       selector,
57033       exportAs,
57034       changeDetection,
57035       inputs,
57036       outputs,
57037       hostListeners,
57038       hostProperties,
57039       hostAttributes,
57040       providers,
57041       viewProviders,
57042       queries,
57043       guards,
57044       viewQueries,
57045       entryComponents,
57046       template,
57047       componentViewType,
57048       rendererType,
57049       componentFactory
57050     }) {
57051       this.isHost = !!isHost;
57052       this.type = type;
57053       this.isComponent = isComponent;
57054       this.selector = selector;
57055       this.exportAs = exportAs;
57056       this.changeDetection = changeDetection;
57057       this.inputs = inputs;
57058       this.outputs = outputs;
57059       this.hostListeners = hostListeners;
57060       this.hostProperties = hostProperties;
57061       this.hostAttributes = hostAttributes;
57062       this.providers = _normalizeArray(providers);
57063       this.viewProviders = _normalizeArray(viewProviders);
57064       this.queries = _normalizeArray(queries);
57065       this.guards = guards;
57066       this.viewQueries = _normalizeArray(viewQueries);
57067       this.entryComponents = _normalizeArray(entryComponents);
57068       this.template = template;
57069       this.componentViewType = componentViewType;
57070       this.rendererType = rendererType;
57071       this.componentFactory = componentFactory;
57072     }
57073
57074     toSummary() {
57075       return {
57076         summaryKind: CompileSummaryKind.Directive,
57077         type: this.type,
57078         isComponent: this.isComponent,
57079         selector: this.selector,
57080         exportAs: this.exportAs,
57081         inputs: this.inputs,
57082         outputs: this.outputs,
57083         hostListeners: this.hostListeners,
57084         hostProperties: this.hostProperties,
57085         hostAttributes: this.hostAttributes,
57086         providers: this.providers,
57087         viewProviders: this.viewProviders,
57088         queries: this.queries,
57089         guards: this.guards,
57090         viewQueries: this.viewQueries,
57091         entryComponents: this.entryComponents,
57092         changeDetection: this.changeDetection,
57093         template: this.template && this.template.toSummary(),
57094         componentViewType: this.componentViewType,
57095         rendererType: this.rendererType,
57096         componentFactory: this.componentFactory
57097       };
57098     }
57099
57100   }
57101
57102   exports.CompileDirectiveMetadata = CompileDirectiveMetadata;
57103
57104   class CompilePipeMetadata {
57105     constructor({
57106       type,
57107       name,
57108       pure
57109     }) {
57110       this.type = type;
57111       this.name = name;
57112       this.pure = !!pure;
57113     }
57114
57115     toSummary() {
57116       return {
57117         summaryKind: CompileSummaryKind.Pipe,
57118         type: this.type,
57119         name: this.name,
57120         pure: this.pure
57121       };
57122     }
57123
57124   }
57125
57126   exports.CompilePipeMetadata = CompilePipeMetadata;
57127
57128   class CompileShallowModuleMetadata {}
57129
57130   exports.CompileShallowModuleMetadata = CompileShallowModuleMetadata;
57131   /**
57132    * Metadata regarding compilation of a module.
57133    */
57134
57135   class CompileNgModuleMetadata {
57136     constructor({
57137       type,
57138       providers,
57139       declaredDirectives,
57140       exportedDirectives,
57141       declaredPipes,
57142       exportedPipes,
57143       entryComponents,
57144       bootstrapComponents,
57145       importedModules,
57146       exportedModules,
57147       schemas,
57148       transitiveModule,
57149       id
57150     }) {
57151       this.type = type || null;
57152       this.declaredDirectives = _normalizeArray(declaredDirectives);
57153       this.exportedDirectives = _normalizeArray(exportedDirectives);
57154       this.declaredPipes = _normalizeArray(declaredPipes);
57155       this.exportedPipes = _normalizeArray(exportedPipes);
57156       this.providers = _normalizeArray(providers);
57157       this.entryComponents = _normalizeArray(entryComponents);
57158       this.bootstrapComponents = _normalizeArray(bootstrapComponents);
57159       this.importedModules = _normalizeArray(importedModules);
57160       this.exportedModules = _normalizeArray(exportedModules);
57161       this.schemas = _normalizeArray(schemas);
57162       this.id = id || null;
57163       this.transitiveModule = transitiveModule || null;
57164     }
57165
57166     toSummary() {
57167       const module = this.transitiveModule;
57168       return {
57169         summaryKind: CompileSummaryKind.NgModule,
57170         type: this.type,
57171         entryComponents: module.entryComponents,
57172         providers: module.providers,
57173         modules: module.modules,
57174         exportedDirectives: module.exportedDirectives,
57175         exportedPipes: module.exportedPipes
57176       };
57177     }
57178
57179   }
57180
57181   exports.CompileNgModuleMetadata = CompileNgModuleMetadata;
57182
57183   class TransitiveCompileNgModuleMetadata {
57184     constructor() {
57185       this.directivesSet = new Set();
57186       this.directives = [];
57187       this.exportedDirectivesSet = new Set();
57188       this.exportedDirectives = [];
57189       this.pipesSet = new Set();
57190       this.pipes = [];
57191       this.exportedPipesSet = new Set();
57192       this.exportedPipes = [];
57193       this.modulesSet = new Set();
57194       this.modules = [];
57195       this.entryComponentsSet = new Set();
57196       this.entryComponents = [];
57197       this.providers = [];
57198     }
57199
57200     addProvider(provider, module) {
57201       this.providers.push({
57202         provider: provider,
57203         module: module
57204       });
57205     }
57206
57207     addDirective(id) {
57208       if (!this.directivesSet.has(id.reference)) {
57209         this.directivesSet.add(id.reference);
57210         this.directives.push(id);
57211       }
57212     }
57213
57214     addExportedDirective(id) {
57215       if (!this.exportedDirectivesSet.has(id.reference)) {
57216         this.exportedDirectivesSet.add(id.reference);
57217         this.exportedDirectives.push(id);
57218       }
57219     }
57220
57221     addPipe(id) {
57222       if (!this.pipesSet.has(id.reference)) {
57223         this.pipesSet.add(id.reference);
57224         this.pipes.push(id);
57225       }
57226     }
57227
57228     addExportedPipe(id) {
57229       if (!this.exportedPipesSet.has(id.reference)) {
57230         this.exportedPipesSet.add(id.reference);
57231         this.exportedPipes.push(id);
57232       }
57233     }
57234
57235     addModule(id) {
57236       if (!this.modulesSet.has(id.reference)) {
57237         this.modulesSet.add(id.reference);
57238         this.modules.push(id);
57239       }
57240     }
57241
57242     addEntryComponent(ec) {
57243       if (!this.entryComponentsSet.has(ec.componentType)) {
57244         this.entryComponentsSet.add(ec.componentType);
57245         this.entryComponents.push(ec);
57246       }
57247     }
57248
57249   }
57250
57251   exports.TransitiveCompileNgModuleMetadata = TransitiveCompileNgModuleMetadata;
57252
57253   function _normalizeArray(obj) {
57254     return obj || [];
57255   }
57256
57257   class ProviderMeta {
57258     constructor(token, {
57259       useClass,
57260       useValue,
57261       useExisting,
57262       useFactory,
57263       deps,
57264       multi
57265     }) {
57266       this.token = token;
57267       this.useClass = useClass || null;
57268       this.useValue = useValue;
57269       this.useExisting = useExisting;
57270       this.useFactory = useFactory || null;
57271       this.dependencies = deps || null;
57272       this.multi = !!multi;
57273     }
57274
57275   }
57276
57277   exports.ProviderMeta = ProviderMeta;
57278
57279   function flatten(list) {
57280     return list.reduce((flat, item) => {
57281       const flatItem = Array.isArray(item) ? flatten(item) : item;
57282       return flat.concat(flatItem);
57283     }, []);
57284   }
57285
57286   exports.flatten = flatten;
57287
57288   function jitSourceUrl(url) {
57289     // Note: We need 3 "/" so that ng shows up as a separate domain
57290     // in the chrome dev tools.
57291     return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
57292   }
57293
57294   function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
57295     let url;
57296
57297     if (templateMeta.isInline) {
57298       if (compMeta.type.reference instanceof static_symbol_1.StaticSymbol) {
57299         // Note: a .ts file might contain multiple components with inline templates,
57300         // so we need to give them unique urls, as these will be used for sourcemaps.
57301         url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
57302       } else {
57303         url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
57304       }
57305     } else {
57306       url = templateMeta.templateUrl;
57307     }
57308
57309     return compMeta.type.reference instanceof static_symbol_1.StaticSymbol ? url : jitSourceUrl(url);
57310   }
57311
57312   exports.templateSourceUrl = templateSourceUrl;
57313
57314   function sharedStylesheetJitUrl(meta, id) {
57315     const pathParts = meta.moduleUrl.split(/\/\\/g);
57316     const baseName = pathParts[pathParts.length - 1];
57317     return jitSourceUrl(`css/${id}${baseName}.ngstyle.js`);
57318   }
57319
57320   exports.sharedStylesheetJitUrl = sharedStylesheetJitUrl;
57321
57322   function ngModuleJitUrl(moduleMeta) {
57323     return jitSourceUrl(`${identifierName(moduleMeta.type)}/module.ngfactory.js`);
57324   }
57325
57326   exports.ngModuleJitUrl = ngModuleJitUrl;
57327
57328   function templateJitUrl(ngModuleType, compMeta) {
57329     return jitSourceUrl(`${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.ngfactory.js`);
57330   }
57331
57332   exports.templateJitUrl = templateJitUrl;
57333 })(compile_metadata);
57334
57335 (function (exports) {
57336
57337   Object.defineProperty(exports, "__esModule", {
57338     value: true
57339   });
57340   /**
57341    * @license
57342    * Copyright Google Inc. All Rights Reserved.
57343    *
57344    * Use of this source code is governed by an MIT-style license that can be
57345    * found in the LICENSE file at https://angular.io/license
57346    */
57347
57348   const chars$1 = chars;
57349   const compile_metadata_1 = compile_metadata;
57350
57351   class ParseLocation {
57352     constructor(file, offset, line, col) {
57353       this.file = file;
57354       this.offset = offset;
57355       this.line = line;
57356       this.col = col;
57357     }
57358
57359     toString() {
57360       return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
57361     }
57362
57363     moveBy(delta) {
57364       const source = this.file.content;
57365       const len = source.length;
57366       let offset = this.offset;
57367       let line = this.line;
57368       let col = this.col;
57369
57370       while (offset > 0 && delta < 0) {
57371         offset--;
57372         delta++;
57373         const ch = source.charCodeAt(offset);
57374
57375         if (ch == chars$1.$LF) {
57376           line--;
57377           const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode(chars$1.$LF));
57378           col = priorLine > 0 ? offset - priorLine : offset;
57379         } else {
57380           col--;
57381         }
57382       }
57383
57384       while (offset < len && delta > 0) {
57385         const ch = source.charCodeAt(offset);
57386         offset++;
57387         delta--;
57388
57389         if (ch == chars$1.$LF) {
57390           line++;
57391           col = 0;
57392         } else {
57393           col++;
57394         }
57395       }
57396
57397       return new ParseLocation(this.file, offset, line, col);
57398     } // Return the source around the location
57399     // Up to `maxChars` or `maxLines` on each side of the location
57400
57401
57402     getContext(maxChars, maxLines) {
57403       const content = this.file.content;
57404       let startOffset = this.offset;
57405
57406       if (startOffset != null) {
57407         if (startOffset > content.length - 1) {
57408           startOffset = content.length - 1;
57409         }
57410
57411         let endOffset = startOffset;
57412         let ctxChars = 0;
57413         let ctxLines = 0;
57414
57415         while (ctxChars < maxChars && startOffset > 0) {
57416           startOffset--;
57417           ctxChars++;
57418
57419           if (content[startOffset] == '\n') {
57420             if (++ctxLines == maxLines) {
57421               break;
57422             }
57423           }
57424         }
57425
57426         ctxChars = 0;
57427         ctxLines = 0;
57428
57429         while (ctxChars < maxChars && endOffset < content.length - 1) {
57430           endOffset++;
57431           ctxChars++;
57432
57433           if (content[endOffset] == '\n') {
57434             if (++ctxLines == maxLines) {
57435               break;
57436             }
57437           }
57438         }
57439
57440         return {
57441           before: content.substring(startOffset, this.offset),
57442           after: content.substring(this.offset, endOffset + 1)
57443         };
57444       }
57445
57446       return null;
57447     }
57448
57449   }
57450
57451   exports.ParseLocation = ParseLocation;
57452
57453   class ParseSourceFile {
57454     constructor(content, url) {
57455       this.content = content;
57456       this.url = url;
57457     }
57458
57459   }
57460
57461   exports.ParseSourceFile = ParseSourceFile;
57462
57463   class ParseSourceSpan {
57464     constructor(start, end, details = null) {
57465       this.start = start;
57466       this.end = end;
57467       this.details = details;
57468     }
57469
57470     toString() {
57471       return this.start.file.content.substring(this.start.offset, this.end.offset);
57472     }
57473
57474   }
57475
57476   exports.ParseSourceSpan = ParseSourceSpan;
57477   exports.EMPTY_PARSE_LOCATION = new ParseLocation(new ParseSourceFile('', ''), 0, 0, 0);
57478   exports.EMPTY_SOURCE_SPAN = new ParseSourceSpan(exports.EMPTY_PARSE_LOCATION, exports.EMPTY_PARSE_LOCATION);
57479   var ParseErrorLevel;
57480
57481   (function (ParseErrorLevel) {
57482     ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
57483     ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
57484   })(ParseErrorLevel = exports.ParseErrorLevel || (exports.ParseErrorLevel = {}));
57485
57486   class ParseError {
57487     constructor(span, msg, level = ParseErrorLevel.ERROR) {
57488       this.span = span;
57489       this.msg = msg;
57490       this.level = level;
57491     }
57492
57493     contextualMessage() {
57494       const ctx = this.span.start.getContext(100, 3);
57495       return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg;
57496     }
57497
57498     toString() {
57499       const details = this.span.details ? `, ${this.span.details}` : '';
57500       return `${this.contextualMessage()}: ${this.span.start}${details}`;
57501     }
57502
57503   }
57504
57505   exports.ParseError = ParseError;
57506
57507   function typeSourceSpan(kind, type) {
57508     const moduleUrl = compile_metadata_1.identifierModuleUrl(type);
57509     const sourceFileName = moduleUrl != null ? `in ${kind} ${compile_metadata_1.identifierName(type)} in ${moduleUrl}` : `in ${kind} ${compile_metadata_1.identifierName(type)}`;
57510     const sourceFile = new ParseSourceFile('', sourceFileName);
57511     return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
57512   }
57513
57514   exports.typeSourceSpan = typeSourceSpan;
57515   /**
57516    * Generates Source Span object for a given R3 Type for JIT mode.
57517    *
57518    * @param kind Component or Directive.
57519    * @param typeName name of the Component or Directive.
57520    * @param sourceUrl reference to Component or Directive source.
57521    * @returns instance of ParseSourceSpan that represent a given Component or Directive.
57522    */
57523
57524   function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
57525     const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
57526     const sourceFile = new ParseSourceFile('', sourceFileName);
57527     return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
57528   }
57529
57530   exports.r3JitTypeSourceSpan = r3JitTypeSourceSpan;
57531 })(parse_util);
57532
57533 const {
57534   ParseSourceSpan
57535 } = parse_util;
57536 const getLast$2 = getLast_1;
57537 const {
57538   htmlTrim,
57539   getLeadingAndTrailingHtmlWhitespace,
57540   hasHtmlWhitespace,
57541   canHaveInterpolation,
57542   getNodeCssStyleDisplay,
57543   isDanglingSpaceSensitiveNode,
57544   isIndentationSensitiveNode,
57545   isLeadingSpaceSensitiveNode,
57546   isTrailingSpaceSensitiveNode,
57547   isWhitespaceSensitiveNode
57548 } = utils$1;
57549 const PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIeConditonalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText];
57550
57551 function preprocess$3(ast, options) {
57552   const res = ast.map(node => node);
57553
57554   for (const fn of PREPROCESS_PIPELINE) {
57555     fn(res, options);
57556   }
57557
57558   return res;
57559 }
57560
57561 function removeIgnorableFirstLf(ast
57562 /*, options */
57563 ) {
57564   ast.walk(node => {
57565     if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length > 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
57566       const [text, ...rest] = node.children;
57567       node.setChildren(text.value.length === 1 ? rest : [text.clone({
57568         value: text.value.slice(1)
57569       }), ...rest]);
57570     }
57571   });
57572 }
57573
57574 function mergeIeConditonalStartEndCommentIntoElementOpeningTag(ast
57575 /*, options */
57576 ) {
57577   /**
57578    *     <!--[if ...]><!--><target><!--<![endif]-->
57579    */
57580   const isTarget = node => node.type === "element" && node.prev && node.prev.type === "ieConditionalStartComment" && node.prev.sourceSpan.end.offset === node.startSourceSpan.start.offset && node.firstChild && node.firstChild.type === "ieConditionalEndComment" && node.firstChild.sourceSpan.start.offset === node.startSourceSpan.end.offset;
57581
57582   ast.walk(node => {
57583     if (node.children) {
57584       const isTargetResults = node.children.map(isTarget);
57585
57586       if (isTargetResults.some(Boolean)) {
57587         const newChildren = [];
57588
57589         for (let i = 0; i < node.children.length; i++) {
57590           const child = node.children[i];
57591
57592           if (isTargetResults[i + 1]) {
57593             // ieConditionalStartComment
57594             continue;
57595           }
57596
57597           if (isTargetResults[i]) {
57598             const ieConditionalStartComment = child.prev;
57599             const ieConditionalEndComment = child.firstChild;
57600             const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
57601             const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
57602             newChildren.push(child.clone({
57603               condition: ieConditionalStartComment.condition,
57604               sourceSpan,
57605               startSourceSpan,
57606               children: child.children.slice(1)
57607             }));
57608             continue;
57609           }
57610
57611           newChildren.push(child);
57612         }
57613
57614         node.setChildren(newChildren);
57615       }
57616     }
57617   });
57618 }
57619
57620 function mergeNodeIntoText(ast, shouldMerge, getValue) {
57621   ast.walk(node => {
57622     if (node.children) {
57623       const shouldMergeResults = node.children.map(shouldMerge);
57624
57625       if (shouldMergeResults.some(Boolean)) {
57626         const newChildren = [];
57627
57628         for (let i = 0; i < node.children.length; i++) {
57629           const child = node.children[i];
57630
57631           if (child.type !== "text" && !shouldMergeResults[i]) {
57632             newChildren.push(child);
57633             continue;
57634           }
57635
57636           const newChild = child.type === "text" ? child : child.clone({
57637             type: "text",
57638             value: getValue(child)
57639           });
57640
57641           if (newChildren.length === 0 || getLast$2(newChildren).type !== "text") {
57642             newChildren.push(newChild);
57643             continue;
57644           }
57645
57646           const lastChild = newChildren.pop();
57647           newChildren.push(lastChild.clone({
57648             value: lastChild.value + newChild.value,
57649             sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, newChild.sourceSpan.end)
57650           }));
57651         }
57652
57653         node.setChildren(newChildren);
57654       }
57655     }
57656   });
57657 }
57658
57659 function mergeCdataIntoText(ast
57660 /*, options */
57661 ) {
57662   return mergeNodeIntoText(ast, node => node.type === "cdata", node => `<![CDATA[${node.value}]]>`);
57663 }
57664
57665 function mergeSimpleElementIntoText(ast
57666 /*, options */
57667 ) {
57668   const isSimpleElement = node => node.type === "element" && node.attrs.length === 0 && node.children.length === 1 && node.firstChild.type === "text" && !hasHtmlWhitespace(node.children[0].value) && !node.firstChild.hasLeadingSpaces && !node.firstChild.hasTrailingSpaces && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces && node.prev && node.prev.type === "text" && node.next && node.next.type === "text";
57669
57670   ast.walk(node => {
57671     if (node.children) {
57672       const isSimpleElementResults = node.children.map(isSimpleElement);
57673
57674       if (isSimpleElementResults.some(Boolean)) {
57675         const newChildren = [];
57676
57677         for (let i = 0; i < node.children.length; i++) {
57678           const child = node.children[i];
57679
57680           if (isSimpleElementResults[i]) {
57681             const lastChild = newChildren.pop();
57682             const nextChild = node.children[++i];
57683             const {
57684               isTrailingSpaceSensitive,
57685               hasTrailingSpaces
57686             } = nextChild;
57687             newChildren.push(lastChild.clone({
57688               value: lastChild.value + `<${child.rawName}>` + child.firstChild.value + `</${child.rawName}>` + nextChild.value,
57689               sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, nextChild.sourceSpan.end),
57690               isTrailingSpaceSensitive,
57691               hasTrailingSpaces
57692             }));
57693           } else {
57694             newChildren.push(child);
57695           }
57696         }
57697
57698         node.setChildren(newChildren);
57699       }
57700     }
57701   });
57702 }
57703
57704 function extractInterpolation(ast, options) {
57705   if (options.parser === "html") {
57706     return;
57707   }
57708
57709   const interpolationRegex = /{{(.+?)}}/s;
57710   ast.walk(node => {
57711     if (!canHaveInterpolation(node)) {
57712       return;
57713     }
57714
57715     const newChildren = [];
57716
57717     for (const child of node.children) {
57718       if (child.type !== "text") {
57719         newChildren.push(child);
57720         continue;
57721       }
57722
57723       let startSourceSpan = child.sourceSpan.start;
57724       let endSourceSpan = null;
57725       const components = child.value.split(interpolationRegex);
57726
57727       for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
57728         const value = components[i];
57729
57730         if (i % 2 === 0) {
57731           endSourceSpan = startSourceSpan.moveBy(value.length);
57732
57733           if (value.length > 0) {
57734             newChildren.push({
57735               type: "text",
57736               value,
57737               sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
57738             });
57739           }
57740
57741           continue;
57742         }
57743
57744         endSourceSpan = startSourceSpan.moveBy(value.length + 4); // `{{` + `}}`
57745
57746         newChildren.push({
57747           type: "interpolation",
57748           sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
57749           children: value.length === 0 ? [] : [{
57750             type: "text",
57751             value,
57752             sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
57753           }]
57754         });
57755       }
57756     }
57757
57758     node.setChildren(newChildren);
57759   });
57760 }
57761 /**
57762  * - add `hasLeadingSpaces` field
57763  * - add `hasTrailingSpaces` field
57764  * - add `hasDanglingSpaces` field for parent nodes
57765  * - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes
57766  * - remove insensitive whitespaces
57767  */
57768
57769
57770 const WHITESPACE_NODE = {
57771   type: "whitespace"
57772 };
57773
57774 function extractWhitespaces(ast
57775 /*, options*/
57776 ) {
57777   ast.walk(node => {
57778     if (!node.children) {
57779       return;
57780     }
57781
57782     if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && htmlTrim(node.children[0].value).length === 0) {
57783       node.hasDanglingSpaces = node.children.length > 0;
57784       node.children = [];
57785       return;
57786     }
57787
57788     const isWhitespaceSensitive = isWhitespaceSensitiveNode(node);
57789     const isIndentationSensitive = isIndentationSensitiveNode(node);
57790     node.setChildren(node.children // extract whitespace nodes
57791     .flatMap(child => {
57792       if (child.type !== "text" || isWhitespaceSensitive) {
57793         return child;
57794       }
57795
57796       const localChildren = [];
57797       const {
57798         leadingWhitespace,
57799         text,
57800         trailingWhitespace
57801       } = getLeadingAndTrailingHtmlWhitespace(child.value);
57802
57803       if (leadingWhitespace) {
57804         localChildren.push(WHITESPACE_NODE);
57805       }
57806
57807       if (text) {
57808         localChildren.push({
57809           type: "text",
57810           value: text,
57811           sourceSpan: new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingWhitespace.length), child.sourceSpan.end.moveBy(-trailingWhitespace.length))
57812         });
57813       }
57814
57815       if (trailingWhitespace) {
57816         localChildren.push(WHITESPACE_NODE);
57817       }
57818
57819       return localChildren;
57820     }) // set hasLeadingSpaces/hasTrailingSpaces
57821     .map((child, index, children) => {
57822       if (child === WHITESPACE_NODE) {
57823         return;
57824       }
57825
57826       return Object.assign(Object.assign({}, child), {}, {
57827         hasLeadingSpaces: children[index - 1] === WHITESPACE_NODE,
57828         hasTrailingSpaces: children[index + 1] === WHITESPACE_NODE
57829       });
57830     }) // filter whitespace nodes
57831     .filter(Boolean));
57832     node.isWhitespaceSensitive = isWhitespaceSensitive;
57833     node.isIndentationSensitive = isIndentationSensitive;
57834   });
57835 }
57836
57837 function addIsSelfClosing(ast
57838 /*, options */
57839 ) {
57840   ast.walk(node => Object.assign(node, {
57841     isSelfClosing: !node.children || node.type === "element" && (node.tagDefinition.isVoid || // self-closing
57842     node.startSourceSpan === node.endSourceSpan)
57843   }));
57844 }
57845
57846 function addHasHtmComponentClosingTag(ast, options) {
57847   ast.walk(node => node.type !== "element" ? node : Object.assign(node, {
57848     hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset))
57849   }));
57850 }
57851
57852 function addCssDisplay(ast, options) {
57853   ast.walk(node => Object.assign(node, {
57854     cssDisplay: getNodeCssStyleDisplay(node, options)
57855   }));
57856 }
57857 /**
57858  * - add `isLeadingSpaceSensitive` field
57859  * - add `isTrailingSpaceSensitive` field
57860  * - add `isDanglingSpaceSensitive` field for parent nodes
57861  */
57862
57863
57864 function addIsSpaceSensitive(ast, options) {
57865   ast.walk(node => {
57866     if (!node.children) {
57867       return;
57868     }
57869
57870     if (node.children.length === 0) {
57871       node.isDanglingSpaceSensitive = isDanglingSpaceSensitiveNode(node);
57872       return;
57873     }
57874
57875     node.setChildren(node.children.map(child => Object.assign(Object.assign({}, child), {}, {
57876       isLeadingSpaceSensitive: isLeadingSpaceSensitiveNode(child, options),
57877       isTrailingSpaceSensitive: isTrailingSpaceSensitiveNode(child, options)
57878     })).map((child, index, children) => Object.assign(Object.assign({}, child), {}, {
57879       isLeadingSpaceSensitive: index === 0 ? child.isLeadingSpaceSensitive : children[index - 1].isTrailingSpaceSensitive && child.isLeadingSpaceSensitive,
57880       isTrailingSpaceSensitive: index === children.length - 1 ? child.isTrailingSpaceSensitive : children[index + 1].isLeadingSpaceSensitive && child.isTrailingSpaceSensitive
57881     })));
57882   });
57883 }
57884
57885 var printPreprocess$1 = preprocess$3;
57886
57887 function hasPragma$1(text) {
57888   return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(text);
57889 }
57890
57891 function insertPragma$3(text) {
57892   return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
57893 }
57894
57895 var pragma$1 = {
57896   hasPragma: hasPragma$1,
57897   insertPragma: insertPragma$3
57898 };
57899
57900 function locStart$5(node) {
57901   return node.sourceSpan.start.offset;
57902 }
57903
57904 function locEnd$4(node) {
57905   return node.sourceSpan.end.offset;
57906 }
57907
57908 var loc$1 = {
57909   locStart: locStart$5,
57910   locEnd: locEnd$4
57911 };
57912
57913 /**
57914  * @typedef {import("../../document").Doc} Doc
57915  */
57916
57917
57918 const assert = require$$0__default$3["default"];
57919 const {
57920   isNonEmptyArray: isNonEmptyArray$1
57921 } = util$8;
57922 const {
57923   builders: {
57924     indent: indent$2,
57925     join: join$5,
57926     line: line$8,
57927     softline: softline$5
57928   },
57929   utils: {
57930     replaceTextEndOfLine: replaceTextEndOfLine$5
57931   }
57932 } = require$$7$3;
57933 const {
57934   locStart: locStart$4,
57935   locEnd: locEnd$3
57936 } = loc$1;
57937 const {
57938   isTextLikeNode: isTextLikeNode$1,
57939   getLastDescendant,
57940   isPreLikeNode,
57941   hasPrettierIgnore: hasPrettierIgnore$3,
57942   shouldPreserveContent: shouldPreserveContent$1
57943 } = utils$1;
57944
57945 function printClosingTag$2(node, options) {
57946   return [node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd$1(node, options)];
57947 }
57948
57949 function printClosingTagStart(node, options) {
57950   return node.lastChild && needsToBorrowParentClosingTagStartMarker$2(node.lastChild) ? "" : [printClosingTagPrefix(node, options), printClosingTagStartMarker$1(node, options)];
57951 }
57952
57953 function printClosingTagEnd$1(node, options) {
57954   return (node.next ? needsToBorrowPrevClosingTagEndMarker$3(node.next) : needsToBorrowLastChildClosingTagEndMarker$2(node.parent)) ? "" : [printClosingTagEndMarker$2(node, options), printClosingTagSuffix$4(node, options)];
57955 }
57956
57957 function printClosingTagPrefix(node, options) {
57958   return needsToBorrowLastChildClosingTagEndMarker$2(node) ? printClosingTagEndMarker$2(node.lastChild, options) : "";
57959 }
57960
57961 function printClosingTagSuffix$4(node, options) {
57962   return needsToBorrowParentClosingTagStartMarker$2(node) ? printClosingTagStartMarker$1(node.parent, options) : needsToBorrowNextOpeningTagStartMarker$1(node) ? printOpeningTagStartMarker$1(node.next) : "";
57963 }
57964
57965 function printClosingTagStartMarker$1(node, options) {
57966   assert(!node.isSelfClosing);
57967   /* istanbul ignore next */
57968
57969   if (shouldNotPrintClosingTag(node, options)) {
57970     return "";
57971   }
57972
57973   switch (node.type) {
57974     case "ieConditionalComment":
57975       return "<!";
57976
57977     case "element":
57978       if (node.hasHtmComponentClosingTag) {
57979         return "<//";
57980       }
57981
57982     // fall through
57983
57984     default:
57985       return `</${node.rawName}`;
57986   }
57987 }
57988
57989 function printClosingTagEndMarker$2(node, options) {
57990   if (shouldNotPrintClosingTag(node, options)) {
57991     return "";
57992   }
57993
57994   switch (node.type) {
57995     case "ieConditionalComment":
57996     case "ieConditionalEndComment":
57997       return "[endif]-->";
57998
57999     case "ieConditionalStartComment":
58000       return "]><!-->";
58001
58002     case "interpolation":
58003       return "}}";
58004
58005     case "element":
58006       if (node.isSelfClosing) {
58007         return "/>";
58008       }
58009
58010     // fall through
58011
58012     default:
58013       return ">";
58014   }
58015 }
58016
58017 function shouldNotPrintClosingTag(node, options) {
58018   return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore$3(node) || shouldPreserveContent$1(node.parent, options));
58019 }
58020
58021 function needsToBorrowPrevClosingTagEndMarker$3(node) {
58022   /**
58023    *     <p></p
58024    *     >123
58025    *     ^
58026    *
58027    *     <p></p
58028    *     ><a
58029    *     ^
58030    */
58031   return node.prev && node.prev.type !== "docType" && !isTextLikeNode$1(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
58032 }
58033
58034 function needsToBorrowLastChildClosingTagEndMarker$2(node) {
58035   /**
58036    *     <p
58037    *       ><a></a
58038    *       ></p
58039    *       ^
58040    *     >
58041    */
58042   return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode$1(getLastDescendant(node.lastChild)) && !isPreLikeNode(node);
58043 }
58044
58045 function needsToBorrowParentClosingTagStartMarker$2(node) {
58046   /**
58047    *     <p>
58048    *       123</p
58049    *          ^^^
58050    *     >
58051    *
58052    *         123</b
58053    *       ></a
58054    *        ^^^
58055    *     >
58056    */
58057   return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode$1(getLastDescendant(node));
58058 }
58059
58060 function needsToBorrowNextOpeningTagStartMarker$1(node) {
58061   /**
58062    *     123<p
58063    *        ^^
58064    *     >
58065    */
58066   return node.next && !isTextLikeNode$1(node.next) && isTextLikeNode$1(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
58067 }
58068
58069 function getPrettierIgnoreAttributeCommentData(value) {
58070   const match = value.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/s);
58071
58072   if (!match) {
58073     return false;
58074   }
58075
58076   if (!match[1]) {
58077     return true;
58078   }
58079
58080   return match[1].split(/\s+/);
58081 }
58082
58083 function needsToBorrowParentOpeningTagEndMarker$1(node) {
58084   /**
58085    *     <p
58086    *       >123
58087    *       ^
58088    *
58089    *     <p
58090    *       ><a
58091    *       ^
58092    */
58093   return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
58094 }
58095
58096 function printAttributes(path, options, print) {
58097   const node = path.getValue();
58098
58099   if (!isNonEmptyArray$1(node.attrs)) {
58100     return node.isSelfClosing ?
58101     /**
58102      *     <br />
58103      *        ^
58104      */
58105     " " : "";
58106   }
58107
58108   const ignoreAttributeData = node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData(node.prev.value);
58109   const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? attribute => ignoreAttributeData.includes(attribute.rawName) : () => false;
58110   const printedAttributes = path.map(attributePath => {
58111     const attribute = attributePath.getValue();
58112     return hasPrettierIgnoreAttribute(attribute) ? replaceTextEndOfLine$5(options.originalText.slice(locStart$4(attribute), locEnd$3(attribute))) : print();
58113   }, "attrs");
58114   const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
58115   /** @type {Doc[]} */
58116
58117   const parts = [indent$2([forceNotToBreakAttrContent ? " " : line$8, join$5(line$8, printedAttributes)])];
58118
58119   if (
58120   /**
58121    *     123<a
58122    *       attr
58123    *           ~
58124    *       >456
58125    */
58126   node.firstChild && needsToBorrowParentOpeningTagEndMarker$1(node.firstChild) ||
58127   /**
58128    *     <span
58129    *       >123<meta
58130    *                ~
58131    *     /></span>
58132    */
58133   node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker$2(node.parent) || forceNotToBreakAttrContent) {
58134     parts.push(node.isSelfClosing ? " " : "");
58135   } else {
58136     parts.push(options.bracketSameLine ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? line$8 : softline$5);
58137   }
58138
58139   return parts;
58140 }
58141
58142 function printOpeningTagEnd(node) {
58143   return node.firstChild && needsToBorrowParentOpeningTagEndMarker$1(node.firstChild) ? "" : printOpeningTagEndMarker$1(node);
58144 }
58145
58146 function printOpeningTag$2(path, options, print) {
58147   const node = path.getValue();
58148   return [printOpeningTagStart$1(node, options), printAttributes(path, options, print), node.isSelfClosing ? "" : printOpeningTagEnd(node)];
58149 }
58150
58151 function printOpeningTagStart$1(node, options) {
58152   return node.prev && needsToBorrowNextOpeningTagStartMarker$1(node.prev) ? "" : [printOpeningTagPrefix$4(node, options), printOpeningTagStartMarker$1(node)];
58153 }
58154
58155 function printOpeningTagPrefix$4(node, options) {
58156   return needsToBorrowParentOpeningTagEndMarker$1(node) ? printOpeningTagEndMarker$1(node.parent) : needsToBorrowPrevClosingTagEndMarker$3(node) ? printClosingTagEndMarker$2(node.prev, options) : "";
58157 }
58158
58159 function printOpeningTagStartMarker$1(node) {
58160   switch (node.type) {
58161     case "ieConditionalComment":
58162     case "ieConditionalStartComment":
58163       return `<!--[if ${node.condition}`;
58164
58165     case "ieConditionalEndComment":
58166       return "<!--<!";
58167
58168     case "interpolation":
58169       return "{{";
58170
58171     case "docType":
58172       return "<!DOCTYPE";
58173
58174     case "element":
58175       if (node.condition) {
58176         return `<!--[if ${node.condition}]><!--><${node.rawName}`;
58177       }
58178
58179     // fall through
58180
58181     default:
58182       return `<${node.rawName}`;
58183   }
58184 }
58185
58186 function printOpeningTagEndMarker$1(node) {
58187   assert(!node.isSelfClosing);
58188
58189   switch (node.type) {
58190     case "ieConditionalComment":
58191       return "]>";
58192
58193     case "element":
58194       if (node.condition) {
58195         return "><!--<![endif]-->";
58196       }
58197
58198     // fall through
58199
58200     default:
58201       return ">";
58202   }
58203 }
58204
58205 var tag = {
58206   printClosingTag: printClosingTag$2,
58207   printClosingTagStart,
58208   printClosingTagStartMarker: printClosingTagStartMarker$1,
58209   printClosingTagEndMarker: printClosingTagEndMarker$2,
58210   printClosingTagSuffix: printClosingTagSuffix$4,
58211   printClosingTagEnd: printClosingTagEnd$1,
58212   needsToBorrowLastChildClosingTagEndMarker: needsToBorrowLastChildClosingTagEndMarker$2,
58213   needsToBorrowParentClosingTagStartMarker: needsToBorrowParentClosingTagStartMarker$2,
58214   needsToBorrowPrevClosingTagEndMarker: needsToBorrowPrevClosingTagEndMarker$3,
58215   printOpeningTag: printOpeningTag$2,
58216   printOpeningTagStart: printOpeningTagStart$1,
58217   printOpeningTagPrefix: printOpeningTagPrefix$4,
58218   printOpeningTagStartMarker: printOpeningTagStartMarker$1,
58219   printOpeningTagEndMarker: printOpeningTagEndMarker$1,
58220   needsToBorrowNextOpeningTagStartMarker: needsToBorrowNextOpeningTagStartMarker$1,
58221   needsToBorrowParentOpeningTagEndMarker: needsToBorrowParentOpeningTagEndMarker$1
58222 };
58223
58224 var parseSrcset$1 = {exports: {}};
58225
58226 /**
58227  * Srcset Parser
58228  *
58229  * By Alex Bell |  MIT License
58230  *
58231  * JS Parser for the string value that appears in markup <img srcset="here">
58232  *
58233  * @returns Array [{url: _, d: _, w: _, h:_}, ...]
58234  *
58235  * Based super duper closely on the reference algorithm at:
58236  * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute
58237  *
58238  * Most comments are copied in directly from the spec
58239  * (except for comments in parens).
58240  */
58241
58242 (function (module) {
58243   (function (root, factory) {
58244     if (module.exports) {
58245       // Node. Does not work with strict CommonJS, but
58246       // only CommonJS-like environments that support module.exports,
58247       // like Node.
58248       module.exports = factory();
58249     } else {
58250       // Browser globals (root is window)
58251       root.parseSrcset = factory();
58252     }
58253   })(this, function () {
58254     // 1. Let input be the value passed to this algorithm.
58255     return function (input, options) {
58256       var logger = options && options.logger || console; // UTILITY FUNCTIONS
58257       // Manual is faster than RegEx
58258       // http://bjorn.tipling.com/state-and-regular-expressions-in-javascript
58259       // http://jsperf.com/whitespace-character/5
58260
58261       function isSpace(c) {
58262         return c === "\u0020" || // space
58263         c === "\u0009" || // horizontal tab
58264         c === "\u000A" || // new line
58265         c === "\u000C" || // form feed
58266         c === "\u000D"; // carriage return
58267       }
58268
58269       function collectCharacters(regEx) {
58270         var chars,
58271             match = regEx.exec(input.substring(pos));
58272
58273         if (match) {
58274           chars = match[0];
58275           pos += chars.length;
58276           return chars;
58277         }
58278       }
58279
58280       var inputLength = input.length,
58281           // (Don't use \s, to avoid matching non-breaking space)
58282       regexLeadingSpaces = /^[ \t\n\r\u000c]+/,
58283           regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/,
58284           regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/,
58285           regexTrailingCommas = /[,]+$/,
58286           regexNonNegativeInteger = /^\d+$/,
58287           // ( Positive or negative or unsigned integers or decimals, without or without exponents.
58288       // Must include at least one digit.
58289       // According to spec tests any decimal point must be followed by a digit.
58290       // No leading plus sign is allowed.)
58291       // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number
58292       regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,
58293           url,
58294           descriptors,
58295           currentDescriptor,
58296           state,
58297           c,
58298           // 2. Let position be a pointer into input, initially pointing at the start
58299       //    of the string.
58300       pos = 0,
58301           // 3. Let candidates be an initially empty source set.
58302       candidates = []; // 4. Splitting loop: Collect a sequence of characters that are space
58303       //    characters or U+002C COMMA characters. If any U+002C COMMA characters
58304       //    were collected, that is a parse error.
58305
58306       while (true) {
58307         collectCharacters(regexLeadingCommasOrSpaces); // 5. If position is past the end of input, return candidates and abort these steps.
58308
58309         if (pos >= inputLength) {
58310           return candidates; // (we're done, this is the sole return path)
58311         } // 6. Collect a sequence of characters that are not space characters,
58312         //    and let that be url.
58313
58314
58315         url = collectCharacters(regexLeadingNotSpaces); // 7. Let descriptors be a new empty list.
58316
58317         descriptors = []; // 8. If url ends with a U+002C COMMA character (,), follow these substeps:
58318         //              (1). Remove all trailing U+002C COMMA characters from url. If this removed
58319         //         more than one character, that is a parse error.
58320
58321         if (url.slice(-1) === ",") {
58322           url = url.replace(regexTrailingCommas, ""); // (Jump ahead to step 9 to skip tokenization and just push the candidate).
58323
58324           parseDescriptors(); //        Otherwise, follow these substeps:
58325         } else {
58326           tokenize();
58327         } // (close else of step 8)
58328         // 16. Return to the step labeled splitting loop.
58329
58330       } // (Close of big while loop.)
58331
58332       /**
58333        * Tokenizes descriptor properties prior to parsing
58334        * Returns undefined.
58335        */
58336
58337
58338       function tokenize() {
58339         // 8.1. Descriptor tokeniser: Skip whitespace
58340         collectCharacters(regexLeadingSpaces); // 8.2. Let current descriptor be the empty string.
58341
58342         currentDescriptor = ""; // 8.3. Let state be in descriptor.
58343
58344         state = "in descriptor";
58345
58346         while (true) {
58347           // 8.4. Let c be the character at position.
58348           c = input.charAt(pos); //  Do the following depending on the value of state.
58349           //  For the purpose of this step, "EOF" is a special character representing
58350           //  that position is past the end of input.
58351           // In descriptor
58352
58353           if (state === "in descriptor") {
58354             // Do the following, depending on the value of c:
58355             // Space character
58356             // If current descriptor is not empty, append current descriptor to
58357             // descriptors and let current descriptor be the empty string.
58358             // Set state to after descriptor.
58359             if (isSpace(c)) {
58360               if (currentDescriptor) {
58361                 descriptors.push(currentDescriptor);
58362                 currentDescriptor = "";
58363                 state = "after descriptor";
58364               } // U+002C COMMA (,)
58365               // Advance position to the next character in input. If current descriptor
58366               // is not empty, append current descriptor to descriptors. Jump to the step
58367               // labeled descriptor parser.
58368
58369             } else if (c === ",") {
58370               pos += 1;
58371
58372               if (currentDescriptor) {
58373                 descriptors.push(currentDescriptor);
58374               }
58375
58376               parseDescriptors();
58377               return; // U+0028 LEFT PARENTHESIS (()
58378               // Append c to current descriptor. Set state to in parens.
58379             } else if (c === "\u0028") {
58380               currentDescriptor = currentDescriptor + c;
58381               state = "in parens"; // EOF
58382               // If current descriptor is not empty, append current descriptor to
58383               // descriptors. Jump to the step labeled descriptor parser.
58384             } else if (c === "") {
58385               if (currentDescriptor) {
58386                 descriptors.push(currentDescriptor);
58387               }
58388
58389               parseDescriptors();
58390               return; // Anything else
58391               // Append c to current descriptor.
58392             } else {
58393               currentDescriptor = currentDescriptor + c;
58394             } // (end "in descriptor"
58395             // In parens
58396
58397           } else if (state === "in parens") {
58398             // U+0029 RIGHT PARENTHESIS ())
58399             // Append c to current descriptor. Set state to in descriptor.
58400             if (c === ")") {
58401               currentDescriptor = currentDescriptor + c;
58402               state = "in descriptor"; // EOF
58403               // Append current descriptor to descriptors. Jump to the step labeled
58404               // descriptor parser.
58405             } else if (c === "") {
58406               descriptors.push(currentDescriptor);
58407               parseDescriptors();
58408               return; // Anything else
58409               // Append c to current descriptor.
58410             } else {
58411               currentDescriptor = currentDescriptor + c;
58412             } // After descriptor
58413
58414           } else if (state === "after descriptor") {
58415             // Do the following, depending on the value of c:
58416             // Space character: Stay in this state.
58417             if (isSpace(c)) ; else if (c === "") {
58418               parseDescriptors();
58419               return; // Anything else
58420               // Set state to in descriptor. Set position to the previous character in input.
58421             } else {
58422               state = "in descriptor";
58423               pos -= 1;
58424             }
58425           } // Advance position to the next character in input.
58426
58427
58428           pos += 1; // Repeat this step.
58429         } // (close while true loop)
58430
58431       }
58432       /**
58433        * Adds descriptor properties to a candidate, pushes to the candidates array
58434        * @return undefined
58435        */
58436       // Declared outside of the while loop so that it's only created once.
58437
58438
58439       function parseDescriptors() {
58440         // 9. Descriptor parser: Let error be no.
58441         var pError = false,
58442             // 10. Let width be absent.
58443         // 11. Let density be absent.
58444         // 12. Let future-compat-h be absent. (We're implementing it now as h)
58445         w,
58446             d,
58447             h,
58448             i,
58449             candidate = {},
58450             desc,
58451             lastChar,
58452             value,
58453             intVal,
58454             floatVal; // 13. For each descriptor in descriptors, run the appropriate set of steps
58455         // from the following list:
58456
58457         for (i = 0; i < descriptors.length; i++) {
58458           desc = descriptors[i];
58459           lastChar = desc[desc.length - 1];
58460           value = desc.substring(0, desc.length - 1);
58461           intVal = parseInt(value, 10);
58462           floatVal = parseFloat(value); // If the descriptor consists of a valid non-negative integer followed by
58463           // a U+0077 LATIN SMALL LETTER W character
58464
58465           if (regexNonNegativeInteger.test(value) && lastChar === "w") {
58466             // If width and density are not both absent, then let error be yes.
58467             if (w || d) {
58468               pError = true;
58469             } // Apply the rules for parsing non-negative integers to the descriptor.
58470             // If the result is zero, let error be yes.
58471             // Otherwise, let width be the result.
58472
58473
58474             if (intVal === 0) {
58475               pError = true;
58476             } else {
58477               w = intVal;
58478             } // If the descriptor consists of a valid floating-point number followed by
58479             // a U+0078 LATIN SMALL LETTER X character
58480
58481           } else if (regexFloatingPoint.test(value) && lastChar === "x") {
58482             // If width, density and future-compat-h are not all absent, then let error
58483             // be yes.
58484             if (w || d || h) {
58485               pError = true;
58486             } // Apply the rules for parsing floating-point number values to the descriptor.
58487             // If the result is less than zero, let error be yes. Otherwise, let density
58488             // be the result.
58489
58490
58491             if (floatVal < 0) {
58492               pError = true;
58493             } else {
58494               d = floatVal;
58495             } // If the descriptor consists of a valid non-negative integer followed by
58496             // a U+0068 LATIN SMALL LETTER H character
58497
58498           } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
58499             // If height and density are not both absent, then let error be yes.
58500             if (h || d) {
58501               pError = true;
58502             } // Apply the rules for parsing non-negative integers to the descriptor.
58503             // If the result is zero, let error be yes. Otherwise, let future-compat-h
58504             // be the result.
58505
58506
58507             if (intVal === 0) {
58508               pError = true;
58509             } else {
58510               h = intVal;
58511             } // Anything else, Let error be yes.
58512
58513           } else {
58514             pError = true;
58515           }
58516         } // (close step 13 for loop)
58517         // 15. If error is still no, then append a new image source to candidates whose
58518         // URL is url, associated with a width width if not absent and a pixel
58519         // density density if not absent. Otherwise, there is a parse error.
58520
58521
58522         if (!pError) {
58523           candidate.url = url;
58524
58525           if (w) {
58526             candidate.w = w;
58527           }
58528
58529           if (d) {
58530             candidate.d = d;
58531           }
58532
58533           if (h) {
58534             candidate.h = h;
58535           }
58536
58537           candidates.push(candidate);
58538         } else if (logger && logger.error) {
58539           logger.error("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
58540         }
58541       } // (close parseDescriptors fn)
58542
58543     };
58544   });
58545 })(parseSrcset$1);
58546
58547 const parseSrcset = parseSrcset$1.exports;
58548 const {
58549   builders: {
58550     ifBreak: ifBreak$4,
58551     join: join$4,
58552     line: line$7
58553   }
58554 } = require$$7$3;
58555
58556 function printImgSrcset$1(value) {
58557   const srcset = parseSrcset(value, {
58558     logger: {
58559       error(message) {
58560         throw new Error(message);
58561       }
58562
58563     }
58564   });
58565   const hasW = srcset.some(({
58566     w
58567   }) => w);
58568   const hasH = srcset.some(({
58569     h
58570   }) => h);
58571   const hasX = srcset.some(({
58572     d
58573   }) => d);
58574
58575   if (hasW + hasH + hasX > 1) {
58576     throw new Error("Mixed descriptor in srcset is not supported");
58577   }
58578
58579   const key = hasW ? "w" : hasH ? "h" : "d";
58580   const unit = hasW ? "w" : hasH ? "h" : "x";
58581
58582   const getMax = values => Math.max(...values);
58583
58584   const urls = srcset.map(src => src.url);
58585   const maxUrlLength = getMax(urls.map(url => url.length));
58586   const descriptors = srcset.map(src => src[key]).map(descriptor => descriptor ? descriptor.toString() : "");
58587   const descriptorLeftLengths = descriptors.map(descriptor => {
58588     const index = descriptor.indexOf(".");
58589     return index === -1 ? descriptor.length : index;
58590   });
58591   const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
58592   return join$4([",", line$7], urls.map((url, index) => {
58593     const parts = [url];
58594     const descriptor = descriptors[index];
58595
58596     if (descriptor) {
58597       const urlPadding = maxUrlLength - url.length + 1;
58598       const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
58599       const alignment = " ".repeat(urlPadding + descriptorPadding);
58600       parts.push(ifBreak$4(alignment, " "), descriptor + unit);
58601     }
58602
58603     return parts;
58604   }));
58605 }
58606
58607 function printClassNames$1(value) {
58608   return value.trim().split(/\s+/).join(" ");
58609 }
58610
58611 var syntaxAttribute = {
58612   printImgSrcset: printImgSrcset$1,
58613   printClassNames: printClassNames$1
58614 };
58615
58616 const {
58617   builders: {
58618     group: group$6
58619   }
58620 } = require$$7$3;
58621 /**
58622  *     v-for="... in ..."
58623  *     v-for="... of ..."
58624  *     v-for="(..., ...) in ..."
58625  *     v-for="(..., ...) of ..."
58626  */
58627
58628 function printVueFor$1(value, textToDoc) {
58629   const {
58630     left,
58631     operator,
58632     right
58633   } = parseVueFor(value);
58634   return [group$6(textToDoc(`function _(${left}) {}`, {
58635     parser: "babel",
58636     __isVueForBindingLeft: true
58637   })), " ", operator, " ", textToDoc(right, {
58638     parser: "__js_expression"
58639   }, {
58640     stripTrailingHardline: true
58641   })];
58642 } // modified from https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/parser/index.js#L370-L387
58643
58644
58645 function parseVueFor(value) {
58646   const forAliasRE = /(.*?)\s+(in|of)\s+(.*)/s;
58647   const forIteratorRE = /,([^,\]}]*)(?:,([^,\]}]*))?$/;
58648   const stripParensRE = /^\(|\)$/g;
58649   const inMatch = value.match(forAliasRE);
58650
58651   if (!inMatch) {
58652     return;
58653   }
58654
58655   const res = {};
58656   res.for = inMatch[3].trim();
58657   const alias = inMatch[1].trim().replace(stripParensRE, "");
58658   const iteratorMatch = alias.match(forIteratorRE);
58659
58660   if (iteratorMatch) {
58661     res.alias = alias.replace(forIteratorRE, "");
58662     res.iterator1 = iteratorMatch[1].trim();
58663
58664     if (iteratorMatch[2]) {
58665       res.iterator2 = iteratorMatch[2].trim();
58666     }
58667   } else {
58668     res.alias = alias;
58669   }
58670
58671   return {
58672     left: `${[res.alias, res.iterator1, res.iterator2].filter(Boolean).join(",")}`,
58673     operator: inMatch[2],
58674     right: res.for
58675   };
58676 }
58677
58678 function printVueBindings$1(value, textToDoc) {
58679   return textToDoc(`function _(${value}) {}`, {
58680     parser: "babel",
58681     __isVueBindings: true
58682   });
58683 }
58684
58685 function isVueEventBindingExpression$1(eventBindingValue) {
58686   // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
58687   // arrow function or anonymous function
58688   const fnExpRE = /^(?:[\w$]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
58689
58690   const simplePathRE = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/; // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
58691
58692   const value = eventBindingValue.trim();
58693   return fnExpRE.test(value) || simplePathRE.test(value);
58694 }
58695
58696 var syntaxVue = {
58697   isVueEventBindingExpression: isVueEventBindingExpression$1,
58698   printVueFor: printVueFor$1,
58699   printVueBindings: printVueBindings$1
58700 };
58701
58702 const {
58703   needsToBorrowParentClosingTagStartMarker: needsToBorrowParentClosingTagStartMarker$1,
58704   printClosingTagStartMarker,
58705   needsToBorrowLastChildClosingTagEndMarker: needsToBorrowLastChildClosingTagEndMarker$1,
58706   printClosingTagEndMarker: printClosingTagEndMarker$1,
58707   needsToBorrowParentOpeningTagEndMarker,
58708   printOpeningTagEndMarker
58709 } = tag;
58710
58711 function getNodeContent$2(node, options) {
58712   let start = node.startSourceSpan.end.offset;
58713
58714   if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild)) {
58715     start -= printOpeningTagEndMarker(node).length;
58716   }
58717
58718   let end = node.endSourceSpan.start.offset;
58719
58720   if (node.lastChild && needsToBorrowParentClosingTagStartMarker$1(node.lastChild)) {
58721     end += printClosingTagStartMarker(node, options).length;
58722   } else if (needsToBorrowLastChildClosingTagEndMarker$1(node)) {
58723     end -= printClosingTagEndMarker$1(node.lastChild, options).length;
58724   }
58725
58726   return options.originalText.slice(start, end);
58727 }
58728
58729 var getNodeContent_1 = getNodeContent$2;
58730
58731 const {
58732   builders: {
58733     breakParent: breakParent$3,
58734     group: group$5,
58735     hardline: hardline$6,
58736     indent: indent$1,
58737     line: line$6,
58738     fill: fill$3,
58739     softline: softline$4
58740   },
58741   utils: {
58742     mapDoc,
58743     replaceTextEndOfLine: replaceTextEndOfLine$4
58744   }
58745 } = require$$7$3;
58746 const printFrontMatter = print_1;
58747 const {
58748   printClosingTag: printClosingTag$1,
58749   printClosingTagSuffix: printClosingTagSuffix$3,
58750   needsToBorrowPrevClosingTagEndMarker: needsToBorrowPrevClosingTagEndMarker$2,
58751   printOpeningTagPrefix: printOpeningTagPrefix$3,
58752   printOpeningTag: printOpeningTag$1
58753 } = tag;
58754 const {
58755   printImgSrcset,
58756   printClassNames
58757 } = syntaxAttribute;
58758 const {
58759   printVueFor,
58760   printVueBindings,
58761   isVueEventBindingExpression
58762 } = syntaxVue;
58763 const {
58764   isScriptLikeTag: isScriptLikeTag$1,
58765   isVueNonHtmlBlock,
58766   inferScriptParser,
58767   htmlTrimPreserveIndentation,
58768   dedentString,
58769   unescapeQuoteEntities: unescapeQuoteEntities$1,
58770   isVueSlotAttribute,
58771   isVueSfcBindingsAttribute,
58772   getTextValueParts: getTextValueParts$1
58773 } = utils$1;
58774 const getNodeContent$1 = getNodeContent_1;
58775
58776 function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
58777   const isKeyMatched = patterns => new RegExp(patterns.join("|")).test(node.fullName);
58778
58779   const getValue = () => unescapeQuoteEntities$1(node.value);
58780
58781   let shouldHug = false;
58782
58783   const __onHtmlBindingRoot = (root, options) => {
58784     const rootNode = root.type === "NGRoot" ? root.node.type === "NGMicrosyntax" && root.node.body.length === 1 && root.node.body[0].type === "NGMicrosyntaxExpression" ? root.node.body[0].expression : root.node : root.type === "JsExpressionRoot" ? root.node : root;
58785
58786     if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
58787       shouldHug = true;
58788     }
58789   };
58790
58791   const printHug = doc => group$5(doc);
58792
58793   const printExpand = (doc, canHaveTrailingWhitespace = true) => group$5([indent$1([softline$4, doc]), canHaveTrailingWhitespace ? softline$4 : ""]);
58794
58795   const printMaybeHug = doc => shouldHug ? printHug(doc) : printExpand(doc);
58796
58797   const attributeTextToDoc = (code, opts) => originalTextToDoc(code, Object.assign({
58798     __onHtmlBindingRoot,
58799     __embeddedInHtml: true
58800   }, opts), {
58801     stripTrailingHardline: true
58802   });
58803
58804   if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
58805     return printExpand(printImgSrcset(getValue()));
58806   }
58807
58808   if (node.fullName === "class" && !options.parentParser) {
58809     const value = getValue();
58810
58811     if (!value.includes("{{")) {
58812       return printClassNames(value);
58813     }
58814   }
58815
58816   if (node.fullName === "style" && !options.parentParser) {
58817     const value = getValue();
58818
58819     if (!value.includes("{{")) {
58820       return printExpand(attributeTextToDoc(value, {
58821         parser: "css",
58822         __isHTMLStyleAttribute: true
58823       }));
58824     }
58825   }
58826
58827   if (options.parser === "vue") {
58828     if (node.fullName === "v-for") {
58829       return printVueFor(getValue(), attributeTextToDoc);
58830     }
58831
58832     if (isVueSlotAttribute(node) || isVueSfcBindingsAttribute(node, options)) {
58833       return printVueBindings(getValue(), attributeTextToDoc);
58834     }
58835     /**
58836      *     @click="jsStatement"
58837      *     @click="jsExpression"
58838      *     v-on:click="jsStatement"
58839      *     v-on:click="jsExpression"
58840      */
58841
58842
58843     const vueEventBindingPatterns = ["^@", "^v-on:"];
58844     /**
58845      *     :class="vueExpression"
58846      *     v-bind:id="vueExpression"
58847      */
58848
58849     const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
58850     /**
58851      *     v-if="jsExpression"
58852      */
58853
58854     const jsExpressionBindingPatterns = ["^v-"];
58855
58856     if (isKeyMatched(vueEventBindingPatterns)) {
58857       const value = getValue();
58858       return printMaybeHug(attributeTextToDoc(value, {
58859         parser: isVueEventBindingExpression(value) ? "__js_expression" : "__vue_event_binding"
58860       }));
58861     }
58862
58863     if (isKeyMatched(vueExpressionBindingPatterns)) {
58864       return printMaybeHug(attributeTextToDoc(getValue(), {
58865         parser: "__vue_expression"
58866       }));
58867     }
58868
58869     if (isKeyMatched(jsExpressionBindingPatterns)) {
58870       return printMaybeHug(attributeTextToDoc(getValue(), {
58871         parser: "__js_expression"
58872       }));
58873     }
58874   }
58875
58876   if (options.parser === "angular") {
58877     const ngTextToDoc = (code, opts) => // angular does not allow trailing comma
58878     attributeTextToDoc(code, Object.assign(Object.assign({}, opts), {}, {
58879       trailingComma: "none"
58880     }));
58881     /**
58882      *     *directive="angularDirective"
58883      */
58884
58885
58886     const ngDirectiveBindingPatterns = ["^\\*"];
58887     /**
58888      *     (click)="angularStatement"
58889      *     on-click="angularStatement"
58890      */
58891
58892     const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
58893     /**
58894      *     [target]="angularExpression"
58895      *     bind-target="angularExpression"
58896      *     [(target)]="angularExpression"
58897      *     bindon-target="angularExpression"
58898      */
58899
58900     const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", // Unofficial rudimentary support for some of the most used directives of AngularJS 1.x
58901     "^ng-(if|show|hide|class|style)$"];
58902     /**
58903      *     i18n="longDescription"
58904      *     i18n-attr="longDescription"
58905      */
58906
58907     const ngI18nPatterns = ["^i18n(-.+)?$"];
58908
58909     if (isKeyMatched(ngStatementBindingPatterns)) {
58910       return printMaybeHug(ngTextToDoc(getValue(), {
58911         parser: "__ng_action"
58912       }));
58913     }
58914
58915     if (isKeyMatched(ngExpressionBindingPatterns)) {
58916       return printMaybeHug(ngTextToDoc(getValue(), {
58917         parser: "__ng_binding"
58918       }));
58919     }
58920
58921     if (isKeyMatched(ngI18nPatterns)) {
58922       const value = getValue().trim();
58923       return printExpand(fill$3(getTextValueParts$1(node, value)), !value.includes("@@"));
58924     }
58925
58926     if (isKeyMatched(ngDirectiveBindingPatterns)) {
58927       return printMaybeHug(ngTextToDoc(getValue(), {
58928         parser: "__ng_directive"
58929       }));
58930     }
58931
58932     const interpolationRegex = /{{(.+?)}}/s;
58933     const value = getValue();
58934
58935     if (interpolationRegex.test(value)) {
58936       const parts = [];
58937
58938       for (const [index, part] of value.split(interpolationRegex).entries()) {
58939         if (index % 2 === 0) {
58940           parts.push(replaceTextEndOfLine$4(part));
58941         } else {
58942           try {
58943             parts.push(group$5(["{{", indent$1([line$6, ngTextToDoc(part, {
58944               parser: "__ng_interpolation",
58945               __isInHtmlInterpolation: true // to avoid unexpected `}}`
58946
58947             })]), line$6, "}}"]));
58948           } catch {
58949             parts.push("{{", replaceTextEndOfLine$4(part), "}}");
58950           }
58951         }
58952       }
58953
58954       return group$5(parts);
58955     }
58956   }
58957
58958   return null;
58959 }
58960
58961 function embed$3(path, print, textToDoc, options) {
58962   const node = path.getValue();
58963
58964   switch (node.type) {
58965     case "element":
58966       {
58967         if (isScriptLikeTag$1(node) || node.type === "interpolation") {
58968           // Fall through to "text"
58969           return;
58970         }
58971
58972         if (!node.isSelfClosing && isVueNonHtmlBlock(node, options)) {
58973           const parser = inferScriptParser(node, options);
58974
58975           if (!parser) {
58976             return;
58977           }
58978
58979           const content = getNodeContent$1(node, options);
58980           let isEmpty = /^\s*$/.test(content);
58981           let doc = "";
58982
58983           if (!isEmpty) {
58984             doc = textToDoc(htmlTrimPreserveIndentation(content), {
58985               parser,
58986               __embeddedInHtml: true
58987             }, {
58988               stripTrailingHardline: true
58989             });
58990             isEmpty = doc === "";
58991           }
58992
58993           return [printOpeningTagPrefix$3(node, options), group$5(printOpeningTag$1(path, options, print)), isEmpty ? "" : hardline$6, doc, isEmpty ? "" : hardline$6, printClosingTag$1(node, options), printClosingTagSuffix$3(node, options)];
58994         }
58995
58996         break;
58997       }
58998
58999     case "text":
59000       {
59001         if (isScriptLikeTag$1(node.parent)) {
59002           const parser = inferScriptParser(node.parent);
59003
59004           if (parser) {
59005             const value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
59006             const textToDocOptions = {
59007               parser,
59008               __embeddedInHtml: true
59009             };
59010
59011             if (options.parser === "html" && parser === "babel") {
59012               let sourceType = "script";
59013               const {
59014                 attrMap
59015               } = node.parent;
59016
59017               if (attrMap && (attrMap.type === "module" || attrMap.type === "text/babel" && attrMap["data-type"] === "module")) {
59018                 sourceType = "module";
59019               }
59020
59021               textToDocOptions.__babelSourceType = sourceType;
59022             }
59023
59024             return [breakParent$3, printOpeningTagPrefix$3(node, options), textToDoc(value, textToDocOptions, {
59025               stripTrailingHardline: true
59026             }), printClosingTagSuffix$3(node, options)];
59027           }
59028         } else if (node.parent.type === "interpolation") {
59029           const textToDocOptions = {
59030             __isInHtmlInterpolation: true,
59031             // to avoid unexpected `}}`
59032             __embeddedInHtml: true
59033           };
59034
59035           if (options.parser === "angular") {
59036             textToDocOptions.parser = "__ng_interpolation";
59037             textToDocOptions.trailingComma = "none";
59038           } else if (options.parser === "vue") {
59039             textToDocOptions.parser = "__vue_expression";
59040           } else {
59041             textToDocOptions.parser = "__js_expression";
59042           }
59043
59044           return [indent$1([line$6, textToDoc(node.value, textToDocOptions, {
59045             stripTrailingHardline: true
59046           })]), node.parent.next && needsToBorrowPrevClosingTagEndMarker$2(node.parent.next) ? " " : line$6];
59047         }
59048
59049         break;
59050       }
59051
59052     case "attribute":
59053       {
59054         if (!node.value) {
59055           break;
59056         } // lit-html: html`<my-element obj=${obj}></my-element>`
59057
59058
59059         if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
59060           return [node.rawName, "=", node.value];
59061         } // lwc: html`<my-element data-for={value}></my-element>`
59062
59063
59064         if (options.parser === "lwc") {
59065           const interpolationRegex = /^{.*}$/s;
59066
59067           if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
59068             return [node.rawName, "=", node.value];
59069           }
59070         }
59071
59072         const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => // strictly prefer single quote to avoid unnecessary html entity escape
59073         textToDoc(code, Object.assign({
59074           __isInHtmlAttribute: true,
59075           __embeddedInHtml: true
59076         }, opts), {
59077           stripTrailingHardline: true
59078         }), options);
59079
59080         if (embeddedAttributeValueDoc) {
59081           return [node.rawName, '="', group$5(mapDoc(embeddedAttributeValueDoc, doc => typeof doc === "string" ? doc.replace(/"/g, "&quot;") : doc)), '"'];
59082         }
59083
59084         break;
59085       }
59086
59087     case "front-matter":
59088       return printFrontMatter(node, textToDoc);
59089   }
59090 }
59091
59092 var embed_1$1 = embed$3;
59093
59094 const {
59095   builders: {
59096     breakParent: breakParent$2,
59097     group: group$4,
59098     ifBreak: ifBreak$3,
59099     line: line$5,
59100     softline: softline$3,
59101     hardline: hardline$5
59102   },
59103   utils: {
59104     replaceTextEndOfLine: replaceTextEndOfLine$3
59105   }
59106 } = require$$7$3;
59107 const {
59108   locStart: locStart$3,
59109   locEnd: locEnd$2
59110 } = loc$1;
59111 const {
59112   forceBreakChildren,
59113   forceNextEmptyLine,
59114   isTextLikeNode,
59115   hasPrettierIgnore: hasPrettierIgnore$2,
59116   preferHardlineAsLeadingSpaces
59117 } = utils$1;
59118 const {
59119   printOpeningTagPrefix: printOpeningTagPrefix$2,
59120   needsToBorrowNextOpeningTagStartMarker,
59121   printOpeningTagStartMarker,
59122   needsToBorrowPrevClosingTagEndMarker: needsToBorrowPrevClosingTagEndMarker$1,
59123   printClosingTagEndMarker,
59124   printClosingTagSuffix: printClosingTagSuffix$2,
59125   needsToBorrowParentClosingTagStartMarker
59126 } = tag;
59127
59128 function printChild(childPath, options, print) {
59129   const child = childPath.getValue();
59130
59131   if (hasPrettierIgnore$2(child)) {
59132     return [printOpeningTagPrefix$2(child, options), ...replaceTextEndOfLine$3(options.originalText.slice(locStart$3(child) + (child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev) ? printOpeningTagStartMarker(child).length : 0), locEnd$2(child) - (child.next && needsToBorrowPrevClosingTagEndMarker$1(child.next) ? printClosingTagEndMarker(child, options).length : 0))), printClosingTagSuffix$2(child, options)];
59133   }
59134
59135   return print();
59136 }
59137
59138 function printBetweenLine(prevNode, nextNode) {
59139   return isTextLikeNode(prevNode) && isTextLikeNode(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces(nextNode) ? hardline$5 : line$5 : "" : preferHardlineAsLeadingSpaces(nextNode) ? hardline$5 : softline$3 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (hasPrettierIgnore$2(nextNode) ||
59140   /**
59141    *     123<a
59142    *          ~
59143    *       ><b>
59144    */
59145   nextNode.firstChild ||
59146   /**
59147    *     123<!--
59148    *            ~
59149    *     -->
59150    */
59151   nextNode.isSelfClosing ||
59152   /**
59153    *     123<span
59154    *             ~
59155    *       attr
59156    */
59157   nextNode.type === "element" && nextNode.attrs.length > 0) ||
59158   /**
59159    *     <img
59160    *       src="long"
59161    *                 ~
59162    *     />123
59163    */
59164   prevNode.type === "element" && prevNode.isSelfClosing && needsToBorrowPrevClosingTagEndMarker$1(nextNode) ? "" : !nextNode.isLeadingSpaceSensitive || preferHardlineAsLeadingSpaces(nextNode) ||
59165   /**
59166    *       Want to write us a letter? Use our<a
59167    *         ><b><a>mailing address</a></b></a
59168    *                                          ~
59169    *       >.
59170    */
59171   needsToBorrowPrevClosingTagEndMarker$1(nextNode) && prevNode.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild) && prevNode.lastChild.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild.lastChild) ? hardline$5 : nextNode.hasLeadingSpaces ? line$5 : softline$3;
59172 }
59173
59174 function printChildren$3(path, options, print) {
59175   const node = path.getValue();
59176
59177   if (forceBreakChildren(node)) {
59178     return [breakParent$2, ...path.map(childPath => {
59179       const childNode = childPath.getValue();
59180       const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
59181       return [!prevBetweenLine ? "" : [prevBetweenLine, forceNextEmptyLine(childNode.prev) ? hardline$5 : ""], printChild(childPath, options, print)];
59182     }, "children")];
59183   }
59184
59185   const groupIds = node.children.map(() => Symbol(""));
59186   return path.map((childPath, childIndex) => {
59187     const childNode = childPath.getValue();
59188
59189     if (isTextLikeNode(childNode)) {
59190       if (childNode.prev && isTextLikeNode(childNode.prev)) {
59191         const prevBetweenLine = printBetweenLine(childNode.prev, childNode);
59192
59193         if (prevBetweenLine) {
59194           if (forceNextEmptyLine(childNode.prev)) {
59195             return [hardline$5, hardline$5, printChild(childPath, options, print)];
59196           }
59197
59198           return [prevBetweenLine, printChild(childPath, options, print)];
59199         }
59200       }
59201
59202       return printChild(childPath, options, print);
59203     }
59204
59205     const prevParts = [];
59206     const leadingParts = [];
59207     const trailingParts = [];
59208     const nextParts = [];
59209     const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
59210     const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
59211
59212     if (prevBetweenLine) {
59213       if (forceNextEmptyLine(childNode.prev)) {
59214         prevParts.push(hardline$5, hardline$5);
59215       } else if (prevBetweenLine === hardline$5) {
59216         prevParts.push(hardline$5);
59217       } else {
59218         if (isTextLikeNode(childNode.prev)) {
59219           leadingParts.push(prevBetweenLine);
59220         } else {
59221           leadingParts.push(ifBreak$3("", softline$3, {
59222             groupId: groupIds[childIndex - 1]
59223           }));
59224         }
59225       }
59226     }
59227
59228     if (nextBetweenLine) {
59229       if (forceNextEmptyLine(childNode)) {
59230         if (isTextLikeNode(childNode.next)) {
59231           nextParts.push(hardline$5, hardline$5);
59232         }
59233       } else if (nextBetweenLine === hardline$5) {
59234         if (isTextLikeNode(childNode.next)) {
59235           nextParts.push(hardline$5);
59236         }
59237       } else {
59238         trailingParts.push(nextBetweenLine);
59239       }
59240     }
59241
59242     return [...prevParts, group$4([...leadingParts, group$4([printChild(childPath, options, print), ...trailingParts], {
59243       id: groupIds[childIndex]
59244     })]), ...nextParts];
59245   }, "children");
59246 }
59247
59248 var children = {
59249   printChildren: printChildren$3
59250 };
59251
59252 const {
59253   builders: {
59254     breakParent: breakParent$1,
59255     dedentToRoot: dedentToRoot$1,
59256     group: group$3,
59257     ifBreak: ifBreak$2,
59258     indentIfBreak,
59259     indent,
59260     line: line$4,
59261     softline: softline$2
59262   },
59263   utils: {
59264     replaceTextEndOfLine: replaceTextEndOfLine$2
59265   }
59266 } = require$$7$3;
59267 const getNodeContent = getNodeContent_1;
59268 const {
59269   shouldPreserveContent,
59270   isScriptLikeTag,
59271   isVueCustomBlock,
59272   countParents,
59273   forceBreakContent
59274 } = utils$1;
59275 const {
59276   printOpeningTagPrefix: printOpeningTagPrefix$1,
59277   printOpeningTag,
59278   printClosingTagSuffix: printClosingTagSuffix$1,
59279   printClosingTag,
59280   needsToBorrowPrevClosingTagEndMarker,
59281   needsToBorrowLastChildClosingTagEndMarker
59282 } = tag;
59283 const {
59284   printChildren: printChildren$2
59285 } = children;
59286
59287 function printElement$1(path, options, print) {
59288   const node = path.getValue();
59289
59290   if (shouldPreserveContent(node, options)) {
59291     return [printOpeningTagPrefix$1(node, options), group$3(printOpeningTag(path, options, print)), ...replaceTextEndOfLine$2(getNodeContent(node, options)), ...printClosingTag(node, options), printClosingTagSuffix$1(node, options)];
59292   }
59293   /**
59294    * do not break:
59295    *
59296    *     <div>{{
59297    *         ~
59298    *       interpolation
59299    *     }}</div>
59300    *            ~
59301    *
59302    * exception: break if the opening tag breaks
59303    *
59304    *     <div
59305    *       long
59306    *           ~
59307    *       >{{
59308    *         interpolation
59309    *       }}</div
59310    *              ~
59311    *     >
59312    */
59313
59314
59315   const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
59316   const attrGroupId = Symbol("element-attr-group-id");
59317
59318   const printTag = doc => group$3([group$3(printOpeningTag(path, options, print), {
59319     id: attrGroupId
59320   }), doc, printClosingTag(node, options)]);
59321
59322   const printChildrenDoc = childrenDoc => {
59323     if (shouldHugContent) {
59324       return indentIfBreak(childrenDoc, {
59325         groupId: attrGroupId
59326       });
59327     }
59328
59329     if ((isScriptLikeTag(node) || isVueCustomBlock(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle) {
59330       return childrenDoc;
59331     }
59332
59333     return indent(childrenDoc);
59334   };
59335
59336   const printLineBeforeChildren = () => {
59337     if (shouldHugContent) {
59338       return ifBreak$2(softline$2, "", {
59339         groupId: attrGroupId
59340       });
59341     }
59342
59343     if (node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive) {
59344       return line$4;
59345     }
59346
59347     if (node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) {
59348       return dedentToRoot$1(softline$2);
59349     }
59350
59351     return softline$2;
59352   };
59353
59354   const printLineAfterChildren = () => {
59355     const needsToBorrow = node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent);
59356
59357     if (needsToBorrow) {
59358       if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
59359         return " ";
59360       }
59361
59362       return "";
59363     }
59364
59365     if (shouldHugContent) {
59366       return ifBreak$2(softline$2, "", {
59367         groupId: attrGroupId
59368       });
59369     }
59370
59371     if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
59372       return line$4;
59373     }
59374
59375     if ((node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp(`\\n[\\t ]{${options.tabWidth * countParents(path, node => node.parent && node.parent.type !== "root")}}$`).test(node.lastChild.value)) {
59376       return "";
59377     }
59378
59379     return softline$2;
59380   };
59381
59382   if (node.children.length === 0) {
59383     return printTag(node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$4 : "");
59384   }
59385
59386   return printTag([forceBreakContent(node) ? breakParent$1 : "", printChildrenDoc([printLineBeforeChildren(), printChildren$2(path, options, print)]), printLineAfterChildren()]);
59387 }
59388
59389 var element = {
59390   printElement: printElement$1
59391 };
59392
59393 /**
59394  * @typedef {import("../document").Doc} Doc
59395  */
59396
59397
59398 const {
59399   builders: {
59400     fill: fill$2,
59401     group: group$2,
59402     hardline: hardline$4,
59403     literalline: literalline$2
59404   },
59405   utils: {
59406     cleanDoc,
59407     getDocParts: getDocParts$2,
59408     isConcat,
59409     replaceTextEndOfLine: replaceTextEndOfLine$1
59410   }
59411 } = require$$7$3;
59412 const clean$1 = clean_1;
59413 const {
59414   countChars,
59415   unescapeQuoteEntities,
59416   getTextValueParts
59417 } = utils$1;
59418 const preprocess$2 = printPreprocess$1;
59419 const {
59420   insertPragma: insertPragma$2
59421 } = pragma$1;
59422 const {
59423   locStart: locStart$2,
59424   locEnd: locEnd$1
59425 } = loc$1;
59426 const embed$2 = embed_1$1;
59427 const {
59428   printClosingTagSuffix,
59429   printClosingTagEnd,
59430   printOpeningTagPrefix,
59431   printOpeningTagStart
59432 } = tag;
59433 const {
59434   printElement
59435 } = element;
59436 const {
59437   printChildren: printChildren$1
59438 } = children;
59439
59440 function genericPrint$1(path, options, print) {
59441   const node = path.getValue();
59442
59443   switch (node.type) {
59444     case "front-matter":
59445       return replaceTextEndOfLine$1(node.raw);
59446
59447     case "root":
59448       if (options.__onHtmlRoot) {
59449         options.__onHtmlRoot(node);
59450       } // use original concat to not break stripTrailingHardline
59451
59452
59453       return [group$2(printChildren$1(path, options, print)), hardline$4];
59454
59455     case "element":
59456     case "ieConditionalComment":
59457       {
59458         return printElement(path, options, print);
59459       }
59460
59461     case "ieConditionalStartComment":
59462     case "ieConditionalEndComment":
59463       return [printOpeningTagStart(node), printClosingTagEnd(node)];
59464
59465     case "interpolation":
59466       return [printOpeningTagStart(node, options), ...path.map(print, "children"), printClosingTagEnd(node, options)];
59467
59468     case "text":
59469       {
59470         if (node.parent.type === "interpolation") {
59471           // replace the trailing literalline with hardline for better readability
59472           const trailingNewlineRegex = /\n[^\S\n]*?$/;
59473           const hasTrailingNewline = trailingNewlineRegex.test(node.value);
59474           const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
59475           return [...replaceTextEndOfLine$1(value), hasTrailingNewline ? hardline$4 : ""];
59476         }
59477
59478         const printed = cleanDoc([printOpeningTagPrefix(node, options), ...getTextValueParts(node), printClosingTagSuffix(node, options)]);
59479
59480         if (isConcat(printed) || printed.type === "fill") {
59481           return fill$2(getDocParts$2(printed));
59482         }
59483         /* istanbul ignore next */
59484
59485
59486         return printed;
59487       }
59488
59489     case "docType":
59490       return [group$2([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")]), printClosingTagEnd(node, options)];
59491
59492     case "comment":
59493       {
59494         return [printOpeningTagPrefix(node, options), ...replaceTextEndOfLine$1(options.originalText.slice(locStart$2(node), locEnd$1(node)), literalline$2), printClosingTagSuffix(node, options)];
59495       }
59496
59497     case "attribute":
59498       {
59499         if (node.value === null) {
59500           return node.rawName;
59501         }
59502
59503         const value = unescapeQuoteEntities(node.value);
59504         const singleQuoteCount = countChars(value, "'");
59505         const doubleQuoteCount = countChars(value, '"');
59506         const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
59507         return [node.rawName, "=", quote, ...replaceTextEndOfLine$1(quote === '"' ? value.replace(/"/g, "&quot;") : value.replace(/'/g, "&apos;")), quote];
59508       }
59509
59510     default:
59511       /* istanbul ignore next */
59512       throw new Error(`Unexpected node type ${node.type}`);
59513   }
59514 }
59515
59516 var printerHtml = {
59517   preprocess: preprocess$2,
59518   print: genericPrint$1,
59519   insertPragma: insertPragma$2,
59520   massageAstNode: clean$1,
59521   embed: embed$2
59522 };
59523
59524 const commonOptions$1 = commonOptions$6;
59525 const CATEGORY_HTML = "HTML"; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
59526
59527 var options$3 = {
59528   bracketSameLine: commonOptions$1.bracketSameLine,
59529   htmlWhitespaceSensitivity: {
59530     since: "1.15.0",
59531     category: CATEGORY_HTML,
59532     type: "choice",
59533     default: "css",
59534     description: "How to handle whitespaces in HTML.",
59535     choices: [{
59536       value: "css",
59537       description: "Respect the default value of CSS display property."
59538     }, {
59539       value: "strict",
59540       description: "Whitespaces are considered sensitive."
59541     }, {
59542       value: "ignore",
59543       description: "Whitespaces are considered insensitive."
59544     }]
59545   },
59546   vueIndentScriptAndStyle: {
59547     since: "1.19.0",
59548     category: CATEGORY_HTML,
59549     type: "boolean",
59550     default: false,
59551     description: "Indent script and style tags in Vue files."
59552   }
59553 };
59554
59555 var parsers$3 = {
59556   // HTML
59557   get html() {
59558     return require("./parser-html.js").parsers.html;
59559   },
59560
59561   // Vue
59562   get vue() {
59563     return require("./parser-html.js").parsers.vue;
59564   },
59565
59566   // Angular
59567   get angular() {
59568     return require("./parser-html.js").parsers.angular;
59569   },
59570
59571   // Lightning Web Components
59572   get lwc() {
59573     return require("./parser-html.js").parsers.lwc;
59574   }
59575
59576 };
59577
59578 var name$2 = "HTML";
59579 var type$2 = "markup";
59580 var tmScope$2 = "text.html.basic";
59581 var aceMode$2 = "html";
59582 var codemirrorMode$1 = "htmlmixed";
59583 var codemirrorMimeType$1 = "text/html";
59584 var color$2 = "#e34c26";
59585 var aliases$1 = [
59586         "xhtml"
59587 ];
59588 var extensions$2 = [
59589         ".html",
59590         ".htm",
59591         ".html.hl",
59592         ".inc",
59593         ".xht",
59594         ".xhtml"
59595 ];
59596 var languageId$2 = 146;
59597 var require$$4$1 = {
59598         name: name$2,
59599         type: type$2,
59600         tmScope: tmScope$2,
59601         aceMode: aceMode$2,
59602         codemirrorMode: codemirrorMode$1,
59603         codemirrorMimeType: codemirrorMimeType$1,
59604         color: color$2,
59605         aliases: aliases$1,
59606         extensions: extensions$2,
59607         languageId: languageId$2
59608 };
59609
59610 var name$1 = "Vue";
59611 var type$1 = "markup";
59612 var color$1 = "#41b883";
59613 var extensions$1 = [
59614         ".vue"
59615 ];
59616 var tmScope$1 = "text.html.vue";
59617 var aceMode$1 = "html";
59618 var languageId$1 = 391;
59619 var require$$5 = {
59620         name: name$1,
59621         type: type$1,
59622         color: color$1,
59623         extensions: extensions$1,
59624         tmScope: tmScope$1,
59625         aceMode: aceMode$1,
59626         languageId: languageId$1
59627 };
59628
59629 const createLanguage$1 = createLanguage$7;
59630 const printer$1 = printerHtml;
59631 const options$2 = options$3;
59632 const parsers$2 = parsers$3;
59633 const languages$2 = [createLanguage$1(require$$4$1, () => ({
59634   name: "Angular",
59635   since: "1.15.0",
59636   parsers: ["angular"],
59637   vscodeLanguageIds: ["html"],
59638   extensions: [".component.html"],
59639   filenames: []
59640 })), createLanguage$1(require$$4$1, data => ({
59641   since: "1.15.0",
59642   parsers: ["html"],
59643   vscodeLanguageIds: ["html"],
59644   extensions: [...data.extensions, ".mjml" // MJML is considered XML in Linguist but it should be formatted as HTML
59645   ]
59646 })), createLanguage$1(require$$4$1, () => ({
59647   name: "Lightning Web Components",
59648   since: "1.17.0",
59649   parsers: ["lwc"],
59650   vscodeLanguageIds: ["html"],
59651   extensions: [],
59652   filenames: []
59653 })), createLanguage$1(require$$5, () => ({
59654   since: "1.10.0",
59655   parsers: ["vue"],
59656   vscodeLanguageIds: ["vue"]
59657 }))];
59658 const printers = {
59659   html: printer$1
59660 };
59661 var languageHtml = {
59662   languages: languages$2,
59663   printers,
59664   options: options$2,
59665   parsers: parsers$2
59666 };
59667
59668 function isPragma$1(text) {
59669   return /^\s*@(?:prettier|format)\s*$/.test(text);
59670 }
59671
59672 function hasPragma(text) {
59673   return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(text);
59674 }
59675
59676 function insertPragma$1(text) {
59677   return `# @format\n\n${text}`;
59678 }
59679
59680 var pragma = {
59681   isPragma: isPragma$1,
59682   hasPragma,
59683   insertPragma: insertPragma$1
59684 };
59685
59686 function locStart$1(node) {
59687   return node.position.start.offset;
59688 }
59689
59690 function locEnd(node) {
59691   return node.position.end.offset;
59692 }
59693
59694 var loc = {
59695   locStart: locStart$1,
59696   locEnd
59697 };
59698
59699 function embed$1(path, print, textToDoc, options) {
59700   const node = path.getValue(); // Try to format `.prettierrc` and `.stylelintrc` as `json` first
59701
59702   if (node.type === "root" && options.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint)rc$/.test(options.filepath)) {
59703     return textToDoc(options.originalText, Object.assign(Object.assign({}, options), {}, {
59704       parser: "json"
59705     }));
59706   }
59707 }
59708
59709 var embed_1 = embed$1;
59710
59711 const {
59712   getLast: getLast$1,
59713   isNonEmptyArray
59714 } = util$8;
59715
59716 function getAncestorCount$1(path, filter) {
59717   let counter = 0;
59718   const pathStackLength = path.stack.length - 1;
59719
59720   for (let i = 0; i < pathStackLength; i++) {
59721     const value = path.stack[i];
59722
59723     if (isNode$4(value) && filter(value)) {
59724       counter++;
59725     }
59726   }
59727
59728   return counter;
59729 }
59730 /**
59731  * @param {any} value
59732  * @param {string[]=} types
59733  */
59734
59735
59736 function isNode$4(value, types) {
59737   return value && typeof value.type === "string" && (!types || types.includes(value.type));
59738 }
59739
59740 function mapNode$1(node, callback, parent) {
59741   return callback("children" in node ? Object.assign(Object.assign({}, node), {}, {
59742     children: node.children.map(childNode => mapNode$1(childNode, callback, node))
59743   }) : node, parent);
59744 }
59745
59746 function defineShortcut$1(x, key, getter) {
59747   Object.defineProperty(x, key, {
59748     get: getter,
59749     enumerable: false
59750   });
59751 }
59752
59753 function isNextLineEmpty$1(node, text) {
59754   let newlineCount = 0;
59755   const textLength = text.length;
59756
59757   for (let i = node.position.end.offset - 1; i < textLength; i++) {
59758     const char = text[i];
59759
59760     if (char === "\n") {
59761       newlineCount++;
59762     }
59763
59764     if (newlineCount === 1 && /\S/.test(char)) {
59765       return false;
59766     }
59767
59768     if (newlineCount === 2) {
59769       return true;
59770     }
59771   }
59772
59773   return false;
59774 }
59775
59776 function isLastDescendantNode$2(path) {
59777   const node = path.getValue();
59778
59779   switch (node.type) {
59780     case "tag":
59781     case "anchor":
59782     case "comment":
59783       return false;
59784   }
59785
59786   const pathStackLength = path.stack.length;
59787
59788   for (let i = 1; i < pathStackLength; i++) {
59789     const item = path.stack[i];
59790     const parentItem = path.stack[i - 1];
59791
59792     if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
59793       return false;
59794     }
59795   }
59796
59797   return true;
59798 }
59799
59800 function getLastDescendantNode$1(node) {
59801   return isNonEmptyArray(node.children) ? getLastDescendantNode$1(getLast$1(node.children)) : node;
59802 }
59803
59804 function isPrettierIgnore(comment) {
59805   return comment.value.trim() === "prettier-ignore";
59806 }
59807
59808 function hasPrettierIgnore$1(path) {
59809   const node = path.getValue();
59810
59811   if (node.type === "documentBody") {
59812     const document = path.getParentNode();
59813     return hasEndComments$4(document.head) && isPrettierIgnore(getLast$1(document.head.endComments));
59814   }
59815
59816   return hasLeadingComments$2(node) && isPrettierIgnore(getLast$1(node.leadingComments));
59817 }
59818
59819 function isEmptyNode$2(node) {
59820   return !isNonEmptyArray(node.children) && !hasComments(node);
59821 }
59822
59823 function hasComments(node) {
59824   return hasLeadingComments$2(node) || hasMiddleComments$2(node) || hasIndicatorComment$1(node) || hasTrailingComment$2(node) || hasEndComments$4(node);
59825 }
59826
59827 function hasLeadingComments$2(node) {
59828   return node && isNonEmptyArray(node.leadingComments);
59829 }
59830
59831 function hasMiddleComments$2(node) {
59832   return node && isNonEmptyArray(node.middleComments);
59833 }
59834
59835 function hasIndicatorComment$1(node) {
59836   return node && node.indicatorComment;
59837 }
59838
59839 function hasTrailingComment$2(node) {
59840   return node && node.trailingComment;
59841 }
59842
59843 function hasEndComments$4(node) {
59844   return node && isNonEmptyArray(node.endComments);
59845 }
59846 /**
59847  * " a   b c   d e   f " -> [" a   b", "c   d", "e   f "]
59848  */
59849
59850
59851 function splitWithSingleSpace(text) {
59852   const parts = [];
59853   let lastPart;
59854
59855   for (const part of text.split(/( +)/)) {
59856     /* istanbul ignore else */
59857     if (part !== " ") {
59858       if (lastPart === " ") {
59859         parts.push(part);
59860       } else {
59861         parts.push((parts.pop() || "") + part);
59862       }
59863     } else if (lastPart === undefined) {
59864       parts.unshift("");
59865     }
59866
59867     lastPart = part;
59868   }
59869   /* istanbul ignore next */
59870
59871
59872   if (lastPart === " ") {
59873     parts.push((parts.pop() || "") + " ");
59874   }
59875
59876   if (parts[0] === "") {
59877     parts.shift();
59878     parts.unshift(" " + (parts.shift() || ""));
59879   }
59880
59881   return parts;
59882 }
59883
59884 function getFlowScalarLineContents$1(nodeType, content, options) {
59885   const rawLineContents = content.split("\n").map((lineContent, index, lineContents) => index === 0 && index === lineContents.length - 1 ? lineContent : index !== 0 && index !== lineContents.length - 1 ? lineContent.trim() : index === 0 ? lineContent.trimEnd() : lineContent.trimStart());
59886
59887   if (options.proseWrap === "preserve") {
59888     return rawLineContents.map(lineContent => lineContent.length === 0 ? [] : [lineContent]);
59889   }
59890
59891   return rawLineContents.map(lineContent => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length > 0 && lineContentWords.length > 0 && !( // trailing backslash in quoteDouble should be preserved
59892   nodeType === "quoteDouble" && getLast$1(getLast$1(reduced)).endsWith("\\")) ? [...reduced.slice(0, -1), [...getLast$1(reduced), ...lineContentWords]] : [...reduced, lineContentWords], []).map(lineContentWords => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords);
59893 }
59894
59895 function getBlockValueLineContents$1(node, {
59896   parentIndent,
59897   isLastDescendant,
59898   options
59899 }) {
59900   const content = node.position.start.line === node.position.end.line ? "" : options.originalText.slice(node.position.start.offset, node.position.end.offset) // exclude open line `>` or `|`
59901   .match(/^[^\n]*?\n(.*)$/s)[1];
59902   const leadingSpaceCount = node.indent === null ? (match => match ? match[1].length : Number.POSITIVE_INFINITY)(content.match(/^( *)\S/m)) : node.indent - 1 + parentIndent;
59903   const rawLineContents = content.split("\n").map(lineContent => lineContent.slice(leadingSpaceCount));
59904
59905   if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
59906     return removeUnnecessaryTrailingNewlines(rawLineContents.map(lineContent => lineContent.length === 0 ? [] : [lineContent]));
59907   }
59908
59909   return removeUnnecessaryTrailingNewlines(rawLineContents.map(lineContent => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length > 0 && lineContentWords.length > 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$1(reduced)) ? [...reduced.slice(0, -1), [...getLast$1(reduced), ...lineContentWords]] : [...reduced, lineContentWords], []).map(lineContentWords => lineContentWords.reduce((reduced, word) => // disallow trailing spaces
59910   reduced.length > 0 && /\s$/.test(getLast$1(reduced)) ? [...reduced.slice(0, -1), getLast$1(reduced) + " " + word] : [...reduced, word], [])).map(lineContentWords => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords));
59911
59912   function removeUnnecessaryTrailingNewlines(lineContents) {
59913     if (node.chomping === "keep") {
59914       return getLast$1(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
59915     }
59916
59917     let trailingNewlineCount = 0;
59918
59919     for (let i = lineContents.length - 1; i >= 0; i--) {
59920       if (lineContents[i].length === 0) {
59921         trailingNewlineCount++;
59922       } else {
59923         break;
59924       }
59925     }
59926
59927     return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? // next empty line
59928     lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
59929   }
59930 }
59931
59932 function isInlineNode$2(node) {
59933   /* istanbul ignore next */
59934   if (!node) {
59935     return true;
59936   }
59937
59938   switch (node.type) {
59939     case "plain":
59940     case "quoteDouble":
59941     case "quoteSingle":
59942     case "alias":
59943     case "flowMapping":
59944     case "flowSequence":
59945       return true;
59946
59947     default:
59948       return false;
59949   }
59950 }
59951
59952 var utils = {
59953   getLast: getLast$1,
59954   getAncestorCount: getAncestorCount$1,
59955   isNode: isNode$4,
59956   isEmptyNode: isEmptyNode$2,
59957   isInlineNode: isInlineNode$2,
59958   mapNode: mapNode$1,
59959   defineShortcut: defineShortcut$1,
59960   isNextLineEmpty: isNextLineEmpty$1,
59961   isLastDescendantNode: isLastDescendantNode$2,
59962   getBlockValueLineContents: getBlockValueLineContents$1,
59963   getFlowScalarLineContents: getFlowScalarLineContents$1,
59964   getLastDescendantNode: getLastDescendantNode$1,
59965   hasPrettierIgnore: hasPrettierIgnore$1,
59966   hasLeadingComments: hasLeadingComments$2,
59967   hasMiddleComments: hasMiddleComments$2,
59968   hasIndicatorComment: hasIndicatorComment$1,
59969   hasTrailingComment: hasTrailingComment$2,
59970   hasEndComments: hasEndComments$4
59971 };
59972
59973 const {
59974   defineShortcut,
59975   mapNode
59976 } = utils;
59977
59978 function preprocess$1(ast) {
59979   return mapNode(ast, defineShortcuts);
59980 }
59981
59982 function defineShortcuts(node) {
59983   switch (node.type) {
59984     case "document":
59985       defineShortcut(node, "head", () => node.children[0]);
59986       defineShortcut(node, "body", () => node.children[1]);
59987       break;
59988
59989     case "documentBody":
59990     case "sequenceItem":
59991     case "flowSequenceItem":
59992     case "mappingKey":
59993     case "mappingValue":
59994       defineShortcut(node, "content", () => node.children[0]);
59995       break;
59996
59997     case "mappingItem":
59998     case "flowMappingItem":
59999       defineShortcut(node, "key", () => node.children[0]);
60000       defineShortcut(node, "value", () => node.children[1]);
60001       break;
60002   }
60003
60004   return node;
60005 }
60006
60007 var printPreprocess = preprocess$1;
60008
60009 const {
60010   builders: {
60011     softline: softline$1,
60012     align
60013   }
60014 } = require$$7$3;
60015 const {
60016   hasEndComments: hasEndComments$3,
60017   isNextLineEmpty,
60018   isNode: isNode$3
60019 } = utils;
60020 const printedEmptyLineCache = new WeakMap();
60021
60022 function printNextEmptyLine$2(path, originalText) {
60023   const node = path.getValue();
60024   const root = path.stack[0];
60025   let isNextEmptyLinePrintedSet;
60026
60027   if (printedEmptyLineCache.has(root)) {
60028     isNextEmptyLinePrintedSet = printedEmptyLineCache.get(root);
60029   } else {
60030     isNextEmptyLinePrintedSet = new Set();
60031     printedEmptyLineCache.set(root, isNextEmptyLinePrintedSet);
60032   }
60033
60034   if (!isNextEmptyLinePrintedSet.has(node.position.end.line)) {
60035     isNextEmptyLinePrintedSet.add(node.position.end.line);
60036
60037     if (isNextLineEmpty(node, originalText) && !shouldPrintEndComments$1(path.getParentNode())) {
60038       return softline$1;
60039     }
60040   }
60041
60042   return "";
60043 }
60044
60045 function shouldPrintEndComments$1(node) {
60046   return hasEndComments$3(node) && !isNode$3(node, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
60047 }
60048
60049 function alignWithSpaces$4(width, doc) {
60050   return align(" ".repeat(width), doc);
60051 }
60052
60053 var misc = {
60054   alignWithSpaces: alignWithSpaces$4,
60055   shouldPrintEndComments: shouldPrintEndComments$1,
60056   printNextEmptyLine: printNextEmptyLine$2
60057 };
60058
60059 const {
60060   builders: {
60061     ifBreak: ifBreak$1,
60062     line: line$3,
60063     softline,
60064     hardline: hardline$3,
60065     join: join$3
60066   }
60067 } = require$$7$3;
60068 const {
60069   isEmptyNode: isEmptyNode$1,
60070   getLast,
60071   hasEndComments: hasEndComments$2
60072 } = utils;
60073 const {
60074   printNextEmptyLine: printNextEmptyLine$1,
60075   alignWithSpaces: alignWithSpaces$3
60076 } = misc;
60077
60078 function printFlowMapping$1(path, print, options) {
60079   const node = path.getValue();
60080   const isMapping = node.type === "flowMapping";
60081   const openMarker = isMapping ? "{" : "[";
60082   const closeMarker = isMapping ? "}" : "]";
60083   /** @type {softline | line} */
60084
60085   let bracketSpacing = softline;
60086
60087   if (isMapping && node.children.length > 0 && options.bracketSpacing) {
60088     bracketSpacing = line$3;
60089   }
60090
60091   const lastItem = getLast(node.children);
60092   const isLastItemEmptyMappingItem = lastItem && lastItem.type === "flowMappingItem" && isEmptyNode$1(lastItem.key) && isEmptyNode$1(lastItem.value);
60093   return [openMarker, alignWithSpaces$3(options.tabWidth, [bracketSpacing, printChildren(path, print, options), options.trailingComma === "none" ? "" : ifBreak$1(","), hasEndComments$2(node) ? [hardline$3, join$3(hardline$3, path.map(print, "endComments"))] : ""]), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker];
60094 }
60095
60096 function printChildren(path, print, options) {
60097   const node = path.getValue();
60098   const parts = path.map((childPath, index) => [print(), index === node.children.length - 1 ? "" : [",", line$3, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine$1(childPath, options.originalText) : ""]], "children");
60099   return parts;
60100 }
60101
60102 var flowMappingSequence = {
60103   printFlowMapping: printFlowMapping$1,
60104   // Alias
60105   printFlowSequence: printFlowMapping$1
60106 };
60107
60108 /** @typedef {import("../../document").Doc} Doc */
60109
60110
60111 const {
60112   builders: {
60113     conditionalGroup,
60114     group: group$1,
60115     hardline: hardline$2,
60116     ifBreak,
60117     join: join$2,
60118     line: line$2
60119   }
60120 } = require$$7$3;
60121 const {
60122   hasLeadingComments: hasLeadingComments$1,
60123   hasMiddleComments: hasMiddleComments$1,
60124   hasTrailingComment: hasTrailingComment$1,
60125   hasEndComments: hasEndComments$1,
60126   isNode: isNode$2,
60127   isEmptyNode,
60128   isInlineNode: isInlineNode$1
60129 } = utils;
60130 const {
60131   alignWithSpaces: alignWithSpaces$2
60132 } = misc;
60133
60134 function printMappingItem$1(node, parentNode, path, print, options) {
60135   const {
60136     key,
60137     value
60138   } = node;
60139   const isEmptyMappingKey = isEmptyNode(key);
60140   const isEmptyMappingValue = isEmptyNode(value);
60141
60142   if (isEmptyMappingKey && isEmptyMappingValue) {
60143     return ": ";
60144   }
60145
60146   const printedKey = print("key");
60147   const spaceBeforeColon = needsSpaceInFrontOfMappingValue(node) ? " " : "";
60148
60149   if (isEmptyMappingValue) {
60150     if (node.type === "flowMappingItem" && parentNode.type === "flowMapping") {
60151       return printedKey;
60152     }
60153
60154     if (node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasTrailingComment$1(key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set")) {
60155       return [printedKey, spaceBeforeColon, ":"];
60156     }
60157
60158     return ["? ", alignWithSpaces$2(2, printedKey)];
60159   }
60160
60161   const printedValue = print("value");
60162
60163   if (isEmptyMappingKey) {
60164     return [": ", alignWithSpaces$2(2, printedValue)];
60165   } // force explicit Key
60166
60167
60168   if (hasLeadingComments$1(value) || !isInlineNode$1(key.content)) {
60169     return ["? ", alignWithSpaces$2(2, printedKey), hardline$2, join$2("", path.map(print, "value", "leadingComments").map(comment => [comment, hardline$2])), ": ", alignWithSpaces$2(2, printedValue)];
60170   } // force singleline
60171
60172
60173   if (isSingleLineNode(key.content) && !hasLeadingComments$1(key.content) && !hasMiddleComments$1(key.content) && !hasTrailingComment$1(key.content) && !hasEndComments$1(key) && !hasLeadingComments$1(value.content) && !hasMiddleComments$1(value.content) && !hasEndComments$1(value) && isAbsolutelyPrintedAsSingleLineNode(value.content, options)) {
60174     return [printedKey, spaceBeforeColon, ": ", printedValue];
60175   }
60176
60177   const groupId = Symbol("mappingKey");
60178   const groupedKey = group$1([ifBreak("? "), group$1(alignWithSpaces$2(2, printedKey), {
60179     id: groupId
60180   })]); // Construct both explicit and implicit mapping values.
60181
60182   const explicitMappingValue = [hardline$2, ": ", alignWithSpaces$2(2, printedValue)];
60183   /** @type {Doc[]} */
60184   // In the implicit case, it's convenient to treat everything from the key's colon
60185   // as part of the mapping value
60186
60187   const implicitMappingValueParts = [spaceBeforeColon, ":"];
60188
60189   if (hasLeadingComments$1(value.content) || hasEndComments$1(value) && value.content && !isNode$2(value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$1(key.content) && isInlineNode$1(value.content) || isNode$2(value.content, ["mapping", "sequence"]) && value.content.tag === null && value.content.anchor === null) {
60190     implicitMappingValueParts.push(hardline$2);
60191   } else if (value.content) {
60192     implicitMappingValueParts.push(line$2);
60193   }
60194
60195   implicitMappingValueParts.push(printedValue);
60196   const implicitMappingValue = alignWithSpaces$2(options.tabWidth, implicitMappingValueParts); // If a key is definitely single-line, forcibly use implicit style to avoid edge cases (very long
60197   // keys) that would otherwise trigger explicit style as if it was multiline.
60198   // In those cases, explicit style makes the line even longer and causes confusion.
60199
60200   if (isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasLeadingComments$1(key.content) && !hasMiddleComments$1(key.content) && !hasEndComments$1(key)) {
60201     return conditionalGroup([[printedKey, implicitMappingValue]]);
60202   } // Use explicit mapping syntax if the key breaks, implicit otherwise
60203
60204
60205   return conditionalGroup([[groupedKey, ifBreak(explicitMappingValue, implicitMappingValue, {
60206     groupId
60207   })]]);
60208 }
60209
60210 function isAbsolutelyPrintedAsSingleLineNode(node, options) {
60211   if (!node) {
60212     return true;
60213   }
60214
60215   switch (node.type) {
60216     case "plain":
60217     case "quoteSingle":
60218     case "quoteDouble":
60219       break;
60220
60221     case "alias":
60222       return true;
60223
60224     default:
60225       return false;
60226   }
60227
60228   if (options.proseWrap === "preserve") {
60229     return node.position.start.line === node.position.end.line;
60230   }
60231
60232   if ( // backslash-newline
60233   /\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
60234     return false;
60235   }
60236
60237   switch (options.proseWrap) {
60238     case "never":
60239       return !node.value.includes("\n");
60240
60241     case "always":
60242       return !/[\n ]/.test(node.value);
60243     // istanbul ignore next
60244
60245     default:
60246       return false;
60247   }
60248 }
60249
60250 function needsSpaceInFrontOfMappingValue(node) {
60251   return node.key.content && node.key.content.type === "alias";
60252 }
60253
60254 function isSingleLineNode(node) {
60255   /* istanbul ignore next */
60256   if (!node) {
60257     return true;
60258   }
60259
60260   switch (node.type) {
60261     case "plain":
60262     case "quoteDouble":
60263     case "quoteSingle":
60264       return node.position.start.line === node.position.end.line;
60265
60266     case "alias":
60267       return true;
60268
60269     default:
60270       return false;
60271   }
60272 }
60273
60274 var mappingItem = printMappingItem$1;
60275
60276 /** @typedef {import("../../document").Doc} Doc */
60277
60278
60279 const {
60280   builders: {
60281     dedent,
60282     dedentToRoot,
60283     fill: fill$1,
60284     hardline: hardline$1,
60285     join: join$1,
60286     line: line$1,
60287     literalline: literalline$1,
60288     markAsRoot
60289   },
60290   utils: {
60291     getDocParts: getDocParts$1
60292   }
60293 } = require$$7$3;
60294 const {
60295   getAncestorCount,
60296   getBlockValueLineContents,
60297   hasIndicatorComment,
60298   isLastDescendantNode: isLastDescendantNode$1,
60299   isNode: isNode$1
60300 } = utils;
60301 const {
60302   alignWithSpaces: alignWithSpaces$1
60303 } = misc;
60304
60305 function printBlock$1(path, print, options) {
60306   const node = path.getValue();
60307   const parentIndent = getAncestorCount(path, ancestorNode => isNode$1(ancestorNode, ["sequence", "mapping"]));
60308   const isLastDescendant = isLastDescendantNode$1(path);
60309   /** @type {Doc[]} */
60310
60311   const parts = [node.type === "blockFolded" ? ">" : "|"];
60312
60313   if (node.indent !== null) {
60314     parts.push(node.indent.toString());
60315   }
60316
60317   if (node.chomping !== "clip") {
60318     parts.push(node.chomping === "keep" ? "+" : "-");
60319   }
60320
60321   if (hasIndicatorComment(node)) {
60322     parts.push(" ", print("indicatorComment"));
60323   }
60324
60325   const lineContents = getBlockValueLineContents(node, {
60326     parentIndent,
60327     isLastDescendant,
60328     options
60329   });
60330   /** @type {Doc[]} */
60331
60332   const contentsParts = [];
60333
60334   for (const [index, lineWords] of lineContents.entries()) {
60335     if (index === 0) {
60336       contentsParts.push(hardline$1);
60337     }
60338
60339     contentsParts.push(fill$1(getDocParts$1(join$1(line$1, lineWords))));
60340
60341     if (index !== lineContents.length - 1) {
60342       contentsParts.push(lineWords.length === 0 ? hardline$1 : markAsRoot(literalline$1));
60343     } else if (node.chomping === "keep" && isLastDescendant) {
60344       contentsParts.push(dedentToRoot(lineWords.length === 0 ? hardline$1 : literalline$1));
60345     }
60346   }
60347
60348   if (node.indent === null) {
60349     parts.push(dedent(alignWithSpaces$1(options.tabWidth, contentsParts)));
60350   } else {
60351     parts.push(dedentToRoot(alignWithSpaces$1(node.indent - 1 + parentIndent, contentsParts)));
60352   }
60353
60354   return parts;
60355 }
60356
60357 var block = printBlock$1;
60358
60359 /** @typedef {import("../document").Doc} Doc */
60360
60361
60362 const {
60363   builders: {
60364     breakParent,
60365     fill,
60366     group,
60367     hardline,
60368     join,
60369     line,
60370     lineSuffix,
60371     literalline
60372   },
60373   utils: {
60374     getDocParts,
60375     replaceTextEndOfLine
60376   }
60377 } = require$$7$3;
60378 const {
60379   isPreviousLineEmpty
60380 } = util$8;
60381 const {
60382   insertPragma,
60383   isPragma
60384 } = pragma;
60385 const {
60386   locStart
60387 } = loc;
60388 const embed = embed_1;
60389 const {
60390   getFlowScalarLineContents,
60391   getLastDescendantNode,
60392   hasLeadingComments,
60393   hasMiddleComments,
60394   hasTrailingComment,
60395   hasEndComments,
60396   hasPrettierIgnore,
60397   isLastDescendantNode,
60398   isNode,
60399   isInlineNode
60400 } = utils;
60401 const preprocess = printPreprocess;
60402 const {
60403   alignWithSpaces,
60404   printNextEmptyLine,
60405   shouldPrintEndComments
60406 } = misc;
60407 const {
60408   printFlowMapping,
60409   printFlowSequence
60410 } = flowMappingSequence;
60411 const printMappingItem = mappingItem;
60412 const printBlock = block;
60413
60414 function genericPrint(path, options, print) {
60415   const node = path.getValue();
60416   /** @type {Doc[]} */
60417
60418   const parts = [];
60419
60420   if (node.type !== "mappingValue" && hasLeadingComments(node)) {
60421     parts.push([join(hardline, path.map(print, "leadingComments")), hardline]);
60422   }
60423
60424   const {
60425     tag,
60426     anchor
60427   } = node;
60428
60429   if (tag) {
60430     parts.push(print("tag"));
60431   }
60432
60433   if (tag && anchor) {
60434     parts.push(" ");
60435   }
60436
60437   if (anchor) {
60438     parts.push(print("anchor"));
60439   }
60440   /** @type {Doc} */
60441
60442
60443   let nextEmptyLine = "";
60444
60445   if (isNode(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path)) {
60446     nextEmptyLine = printNextEmptyLine(path, options.originalText);
60447   }
60448
60449   if (tag || anchor) {
60450     if (isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node)) {
60451       parts.push(hardline);
60452     } else {
60453       parts.push(" ");
60454     }
60455   }
60456
60457   if (hasMiddleComments(node)) {
60458     parts.push([node.middleComments.length === 1 ? "" : hardline, join(hardline, path.map(print, "middleComments")), hardline]);
60459   }
60460
60461   const parentNode = path.getParentNode();
60462
60463   if (hasPrettierIgnore(path)) {
60464     parts.push(replaceTextEndOfLine(options.originalText.slice(node.position.start.offset, node.position.end.offset).trimEnd(), literalline));
60465   } else {
60466     parts.push(group(printNode(node, parentNode, path, options, print)));
60467   }
60468
60469   if (hasTrailingComment(node) && !isNode(node, ["document", "documentHead"])) {
60470     parts.push(lineSuffix([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent, print("trailingComment")]));
60471   }
60472
60473   if (shouldPrintEndComments(node)) {
60474     parts.push(alignWithSpaces(node.type === "sequenceItem" ? 2 : 0, [hardline, join(hardline, path.map(path => [isPreviousLineEmpty(options.originalText, path.getValue(), locStart) ? hardline : "", print()], "endComments"))]));
60475   }
60476
60477   parts.push(nextEmptyLine);
60478   return parts;
60479 }
60480
60481 function printNode(node, parentNode, path, options, print) {
60482   switch (node.type) {
60483     case "root":
60484       {
60485         const {
60486           children
60487         } = node;
60488         const parts = [];
60489         path.each((childPath, index) => {
60490           const document = children[index];
60491           const nextDocument = children[index + 1];
60492
60493           if (index !== 0) {
60494             parts.push(hardline);
60495           }
60496
60497           parts.push(print());
60498
60499           if (shouldPrintDocumentEndMarker(document, nextDocument)) {
60500             parts.push(hardline, "...");
60501
60502             if (hasTrailingComment(document)) {
60503               parts.push(" ", print("trailingComment"));
60504             }
60505           } else if (nextDocument && !hasTrailingComment(nextDocument.head)) {
60506             parts.push(hardline, "---");
60507           }
60508         }, "children");
60509         const lastDescendantNode = getLastDescendantNode(node);
60510
60511         if (!isNode(lastDescendantNode, ["blockLiteral", "blockFolded"]) || lastDescendantNode.chomping !== "keep") {
60512           parts.push(hardline);
60513         }
60514
60515         return parts;
60516       }
60517
60518     case "document":
60519       {
60520         const nextDocument = parentNode.children[path.getName() + 1];
60521         const parts = [];
60522
60523         if (shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head") {
60524           if (node.head.children.length > 0 || node.head.endComments.length > 0) {
60525             parts.push(print("head"));
60526           }
60527
60528           if (hasTrailingComment(node.head)) {
60529             parts.push(["---", " ", print(["head", "trailingComment"])]);
60530           } else {
60531             parts.push("---");
60532           }
60533         }
60534
60535         if (shouldPrintDocumentBody(node)) {
60536           parts.push(print("body"));
60537         }
60538
60539         return join(hardline, parts);
60540       }
60541
60542     case "documentHead":
60543       return join(hardline, [...path.map(print, "children"), ...path.map(print, "endComments")]);
60544
60545     case "documentBody":
60546       {
60547         const {
60548           children,
60549           endComments
60550         } = node;
60551         /** @type {Doc} */
60552
60553         let separator = "";
60554
60555         if (children.length > 0 && endComments.length > 0) {
60556           const lastDescendantNode = getLastDescendantNode(node); // there's already a newline printed at the end of blockValue (chomping=keep, lastDescendant=true)
60557
60558           if (isNode(lastDescendantNode, ["blockFolded", "blockLiteral"])) {
60559             // an extra newline for better readability
60560             if (lastDescendantNode.chomping !== "keep") {
60561               separator = [hardline, hardline];
60562             }
60563           } else {
60564             separator = hardline;
60565           }
60566         }
60567
60568         return [join(hardline, path.map(print, "children")), separator, join(hardline, path.map(print, "endComments"))];
60569       }
60570
60571     case "directive":
60572       return ["%", join(" ", [node.name, ...node.parameters])];
60573
60574     case "comment":
60575       return ["#", node.value];
60576
60577     case "alias":
60578       return ["*", node.value];
60579
60580     case "tag":
60581       return options.originalText.slice(node.position.start.offset, node.position.end.offset);
60582
60583     case "anchor":
60584       return ["&", node.value];
60585
60586     case "plain":
60587       return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
60588
60589     case "quoteDouble":
60590     case "quoteSingle":
60591       {
60592         const singleQuote = "'";
60593         const doubleQuote = '"';
60594         const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
60595
60596         if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
60597           // only quoteDouble can use escape chars
60598           // and quoteSingle do not need to escape backslashes
60599           const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
60600           return [originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote];
60601         }
60602
60603         if (raw.includes(doubleQuote)) {
60604           return [singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw // double quote needs to be escaped by backslash in quoteDouble
60605           .replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote];
60606         }
60607
60608         if (raw.includes(singleQuote)) {
60609           return [doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? // single quote needs to be escaped by 2 single quotes in quoteSingle
60610           raw.replace(/''/g, singleQuote) : raw, options), doubleQuote];
60611         }
60612
60613         const quote = options.singleQuote ? singleQuote : doubleQuote;
60614         return [quote, printFlowScalarContent(node.type, raw, options), quote];
60615       }
60616
60617     case "blockFolded":
60618     case "blockLiteral":
60619       {
60620         return printBlock(path, print, options);
60621       }
60622
60623     case "mapping":
60624     case "sequence":
60625       return join(hardline, path.map(print, "children"));
60626
60627     case "sequenceItem":
60628       return ["- ", alignWithSpaces(2, !node.content ? "" : print("content"))];
60629
60630     case "mappingKey":
60631     case "mappingValue":
60632       return !node.content ? "" : print("content");
60633
60634     case "mappingItem":
60635     case "flowMappingItem":
60636       {
60637         return printMappingItem(node, parentNode, path, print, options);
60638       }
60639
60640     case "flowMapping":
60641       return printFlowMapping(path, print, options);
60642
60643     case "flowSequence":
60644       return printFlowSequence(path, print, options);
60645
60646     case "flowSequenceItem":
60647       return print("content");
60648     // istanbul ignore next
60649
60650     default:
60651       throw new Error(`Unexpected node type ${node.type}`);
60652   }
60653 }
60654
60655 function shouldPrintDocumentBody(document) {
60656   return document.body.children.length > 0 || hasEndComments(document.body);
60657 }
60658
60659 function shouldPrintDocumentEndMarker(document, nextDocument) {
60660   return (
60661     /**
60662      *... # trailingComment
60663      */
60664     hasTrailingComment(document) || nextDocument && (
60665     /**
60666      * ...
60667      * %DIRECTIVE
60668      * ---
60669      */
60670     nextDocument.head.children.length > 0 ||
60671     /**
60672      * ...
60673      * # endComment
60674      * ---
60675      */
60676     hasEndComments(nextDocument.head))
60677   );
60678 }
60679
60680 function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
60681   if (
60682   /**
60683    * ---
60684    * preserve the first document head end marker
60685    */
60686   root.children[0] === document && /---(?:\s|$)/.test(options.originalText.slice(locStart(document), locStart(document) + 4)) ||
60687   /**
60688    * %DIRECTIVE
60689    * ---
60690    */
60691   document.head.children.length > 0 ||
60692   /**
60693    * # end comment
60694    * ---
60695    */
60696   hasEndComments(document.head) ||
60697   /**
60698    * --- # trailing comment
60699    */
60700   hasTrailingComment(document.head)) {
60701     return "head";
60702   }
60703
60704   if (shouldPrintDocumentEndMarker(document, nextDocument)) {
60705     return false;
60706   }
60707
60708   return nextDocument ? "root" : false;
60709 }
60710
60711 function printFlowScalarContent(nodeType, content, options) {
60712   const lineContents = getFlowScalarLineContents(nodeType, content, options);
60713   return join(hardline, lineContents.map(lineContentWords => fill(getDocParts(join(line, lineContentWords)))));
60714 }
60715
60716 function clean(node, newNode
60717 /*, parent */
60718 ) {
60719   if (isNode(newNode)) {
60720     delete newNode.position;
60721
60722     switch (newNode.type) {
60723       case "comment":
60724         // insert pragma
60725         if (isPragma(newNode.value)) {
60726           return null;
60727         }
60728
60729         break;
60730
60731       case "quoteDouble":
60732       case "quoteSingle":
60733         newNode.type = "quote";
60734         break;
60735     }
60736   }
60737 }
60738
60739 var printerYaml = {
60740   preprocess,
60741   embed,
60742   print: genericPrint,
60743   massageAstNode: clean,
60744   insertPragma
60745 };
60746
60747 const commonOptions = commonOptions$6; // format based on https://github.com/prettier/prettier/blob/main/src/main/core-options.js
60748
60749 var options$1 = {
60750   bracketSpacing: commonOptions.bracketSpacing,
60751   singleQuote: commonOptions.singleQuote,
60752   proseWrap: commonOptions.proseWrap
60753 };
60754
60755 var parsers$1 = {
60756   get yaml() {
60757     return require("./parser-yaml.js").parsers.yaml;
60758   }
60759
60760 };
60761
60762 var name = "YAML";
60763 var type = "data";
60764 var color = "#cb171e";
60765 var tmScope = "source.yaml";
60766 var aliases = [
60767         "yml"
60768 ];
60769 var extensions = [
60770         ".yml",
60771         ".mir",
60772         ".reek",
60773         ".rviz",
60774         ".sublime-syntax",
60775         ".syntax",
60776         ".yaml",
60777         ".yaml-tmlanguage",
60778         ".yaml.sed",
60779         ".yml.mysql"
60780 ];
60781 var filenames = [
60782         ".clang-format",
60783         ".clang-tidy",
60784         ".gemrc",
60785         "glide.lock",
60786         "yarn.lock"
60787 ];
60788 var aceMode = "yaml";
60789 var codemirrorMode = "yaml";
60790 var codemirrorMimeType = "text/x-yaml";
60791 var languageId = 407;
60792 var require$$4 = {
60793         name: name,
60794         type: type,
60795         color: color,
60796         tmScope: tmScope,
60797         aliases: aliases,
60798         extensions: extensions,
60799         filenames: filenames,
60800         aceMode: aceMode,
60801         codemirrorMode: codemirrorMode,
60802         codemirrorMimeType: codemirrorMimeType,
60803         languageId: languageId
60804 };
60805
60806 const createLanguage = createLanguage$7;
60807 const printer = printerYaml;
60808 const options = options$1;
60809 const parsers = parsers$1;
60810 const languages$1 = [createLanguage(require$$4, data => ({
60811   since: "1.14.0",
60812   parsers: ["yaml"],
60813   vscodeLanguageIds: ["yaml", "ansible", "home-assistant"],
60814   // yarn.lock is not YAML: https://github.com/yarnpkg/yarn/issues/5629
60815   filenames: [...data.filenames.filter(filename => filename !== "yarn.lock"), ".prettierrc", ".stylelintrc"]
60816 }))];
60817 var languageYaml = {
60818   languages: languages$1,
60819   printers: {
60820     yaml: printer
60821   },
60822   options,
60823   parsers
60824 };
60825
60826 var languages = [// JS
60827 languageJs, // CSS
60828 languageCss, // Handlebars
60829 languageHandlebars, // GraphQL
60830 languageGraphql, // Markdown
60831 languageMarkdown, // HTML
60832 languageHtml, // YAML
60833 languageYaml];
60834
60835 const fs = require$$0__default["default"];
60836 const path = require$$0__default$2["default"];
60837 const uniqBy = uniqBy_1;
60838 const partition = partition_1;
60839 const globby = globby$2.exports;
60840 const mem = dist$1;
60841 const internalPlugins = languages;
60842 const thirdParty = require$$7$2;
60843 const resolve = resolve_1;
60844 const memoizedLoad = mem(load, {
60845   cacheKey: JSON.stringify
60846 });
60847 const memoizedSearch = mem(findPluginsInNodeModules);
60848
60849 const clearCache = () => {
60850   mem.clear(memoizedLoad);
60851   mem.clear(memoizedSearch);
60852 };
60853
60854 function load(plugins, pluginSearchDirs) {
60855   if (!plugins) {
60856     plugins = [];
60857   }
60858
60859   if (!pluginSearchDirs) {
60860     pluginSearchDirs = [];
60861   } // unless pluginSearchDirs are provided, auto-load plugins from node_modules that are parent to Prettier
60862
60863
60864   if (pluginSearchDirs.length === 0) {
60865     const autoLoadDir = thirdParty.findParentDir(__dirname, "node_modules");
60866
60867     if (autoLoadDir) {
60868       pluginSearchDirs = [autoLoadDir];
60869     }
60870   }
60871
60872   const [externalPluginNames, externalPluginInstances] = partition(plugins, plugin => typeof plugin === "string");
60873   const externalManualLoadPluginInfos = externalPluginNames.map(pluginName => {
60874     let requirePath;
60875
60876     try {
60877       // try local files
60878       requirePath = resolve(path.resolve(process.cwd(), pluginName));
60879     } catch {
60880       // try node modules
60881       requirePath = resolve(pluginName, {
60882         paths: [process.cwd()]
60883       });
60884     }
60885
60886     return {
60887       name: pluginName,
60888       requirePath
60889     };
60890   });
60891   const externalAutoLoadPluginInfos = pluginSearchDirs.flatMap(pluginSearchDir => {
60892     const resolvedPluginSearchDir = path.resolve(process.cwd(), pluginSearchDir);
60893     const nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules"); // In some fringe cases (ex: files "mounted" as virtual directories), the
60894     // isDirectory(resolvedPluginSearchDir) check might be false even though
60895     // the node_modules actually exists.
60896
60897     if (!isDirectory(nodeModulesDir) && !isDirectory(resolvedPluginSearchDir)) {
60898       throw new Error(`${pluginSearchDir} does not exist or is not a directory`);
60899     }
60900
60901     return memoizedSearch(nodeModulesDir).map(pluginName => ({
60902       name: pluginName,
60903       requirePath: resolve(pluginName, {
60904         paths: [resolvedPluginSearchDir]
60905       })
60906     }));
60907   });
60908   const externalPlugins = [...uniqBy([...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos], "requirePath").map(externalPluginInfo => Object.assign({
60909     name: externalPluginInfo.name
60910   }, require(externalPluginInfo.requirePath))), ...externalPluginInstances];
60911   return [...internalPlugins, ...externalPlugins];
60912 }
60913
60914 function findPluginsInNodeModules(nodeModulesDir) {
60915   const pluginPackageJsonPaths = globby.sync(["prettier-plugin-*/package.json", "@*/prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
60916     cwd: nodeModulesDir,
60917     expandDirectories: false
60918   });
60919   return pluginPackageJsonPaths.map(path.dirname);
60920 }
60921
60922 function isDirectory(dir) {
60923   try {
60924     return fs.statSync(dir).isDirectory();
60925   } catch {
60926     return false;
60927   }
60928 }
60929
60930 var loadPlugins = {
60931   loadPlugins: memoizedLoad,
60932   clearCache
60933 };
60934
60935 const {
60936   version
60937 } = require$$0$5;
60938 const core = core$2;
60939 const {
60940   getSupportInfo
60941 } = support;
60942 const getFileInfo = getFileInfo_1;
60943 const sharedUtil = utilShared;
60944 const plugins = loadPlugins;
60945 const config = resolveConfig_1;
60946 const doc = require$$7$3;
60947
60948 function _withPlugins(fn, optsArgIdx = 1 // Usually `opts` is the 2nd argument
60949 ) {
60950   return (...args) => {
60951     const opts = args[optsArgIdx] || {};
60952     args[optsArgIdx] = Object.assign(Object.assign({}, opts), {}, {
60953       plugins: plugins.loadPlugins(opts.plugins, opts.pluginSearchDirs)
60954     });
60955     return fn(...args);
60956   };
60957 }
60958
60959 function withPlugins(fn, optsArgIdx) {
60960   const resultingFn = _withPlugins(fn, optsArgIdx);
60961
60962   if (fn.sync) {
60963     // @ts-expect-error
60964     resultingFn.sync = _withPlugins(fn.sync, optsArgIdx);
60965   }
60966
60967   return resultingFn;
60968 }
60969
60970 const formatWithCursor = withPlugins(core.formatWithCursor);
60971 var src = {
60972   formatWithCursor,
60973
60974   format(text, opts) {
60975     return formatWithCursor(text, opts).formatted;
60976   },
60977
60978   check(text, opts) {
60979     const {
60980       formatted
60981     } = formatWithCursor(text, opts);
60982     return formatted === text;
60983   },
60984
60985   doc,
60986   resolveConfig: config.resolveConfig,
60987   resolveConfigFile: config.resolveConfigFile,
60988
60989   clearConfigCache() {
60990     config.clearCache();
60991     plugins.clearCache();
60992   },
60993
60994   /** @type {typeof getFileInfo} */
60995   getFileInfo: withPlugins(getFileInfo),
60996
60997   /** @type {typeof getSupportInfo} */
60998   getSupportInfo: withPlugins(getSupportInfo, 0),
60999   version,
61000   util: sharedUtil,
61001   // Internal shared
61002   __internal: {
61003     errors: errors,
61004     coreOptions: coreOptions$1,
61005     createIgnorer: createIgnorer_1,
61006     optionsModule: options$d,
61007     optionsNormalizer: optionsNormalizer,
61008     utils: {
61009       arrayify: arrayify$1
61010     }
61011   },
61012
61013   /* istanbul ignore next */
61014   __debug: {
61015     parse: withPlugins(core.parse),
61016     formatAST: withPlugins(core.formatAST),
61017     formatDoc: withPlugins(core.formatDoc),
61018     printToDoc: withPlugins(core.printToDoc),
61019     printDocToString: withPlugins(core.printDocToString)
61020   }
61021 };
61022
61023 module.exports = src;