.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / prettier-stylelint / node_modules / prettier / standalone.js
1 (function (global, factory) {
2   typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3   typeof define === 'function' && define.amd ? define(factory) :
4   (global = global || self, global.prettier = factory());
5 }(this, (function () { 'use strict';
6
7   var name = "prettier";
8   var version = "1.19.1";
9   var description = "Prettier is an opinionated code formatter";
10   var bin = {
11         prettier: "./bin/prettier.js"
12   };
13   var repository = "prettier/prettier";
14   var homepage = "https://prettier.io";
15   var author = "James Long";
16   var license = "MIT";
17   var main = "./index.js";
18   var engines = {
19         node: ">=8"
20   };
21   var dependencies = {
22         "@angular/compiler": "8.2.13",
23         "@babel/code-frame": "7.5.5",
24         "@babel/parser": "7.7.3",
25         "@glimmer/syntax": "0.41.0",
26         "@iarna/toml": "2.2.3",
27         "@typescript-eslint/typescript-estree": "2.6.1",
28         "angular-estree-parser": "1.1.5",
29         "angular-html-parser": "1.3.0",
30         camelcase: "5.3.1",
31         chalk: "2.4.2",
32         "cjk-regex": "2.0.0",
33         cosmiconfig: "5.2.1",
34         dashify: "2.0.0",
35         dedent: "0.7.0",
36         diff: "4.0.1",
37         editorconfig: "0.15.3",
38         "editorconfig-to-prettier": "0.1.1",
39         "escape-string-regexp": "1.0.5",
40         esutils: "2.0.3",
41         "find-parent-dir": "0.3.0",
42         "find-project-root": "1.1.1",
43         "flow-parser": "0.111.3",
44         "get-stream": "4.1.0",
45         globby: "6.1.0",
46         graphql: "14.5.8",
47         "html-element-attributes": "2.2.0",
48         "html-styles": "1.0.0",
49         "html-tag-names": "1.1.4",
50         ignore: "4.0.6",
51         "is-ci": "2.0.0",
52         "jest-docblock": "24.9.0",
53         "json-stable-stringify": "1.0.1",
54         leven: "3.1.0",
55         "lines-and-columns": "1.1.6",
56         "linguist-languages": "7.6.0",
57         "lodash.uniqby": "4.7.0",
58         mem: "5.1.1",
59         minimatch: "3.0.4",
60         minimist: "1.2.0",
61         "n-readlines": "1.0.0",
62         "normalize-path": "3.0.0",
63         "parse-srcset": "ikatyang/parse-srcset#54eb9c1cb21db5c62b4d0e275d7249516df6f0ee",
64         "postcss-less": "2.0.0",
65         "postcss-media-query-parser": "0.2.3",
66         "postcss-scss": "2.0.0",
67         "postcss-selector-parser": "2.2.3",
68         "postcss-values-parser": "1.5.0",
69         "regexp-util": "1.2.2",
70         "remark-math": "1.0.6",
71         "remark-parse": "5.0.0",
72         resolve: "1.12.0",
73         semver: "6.3.0",
74         "string-width": "4.1.0",
75         typescript: "3.7.2",
76         "unicode-regex": "3.0.0",
77         unified: "8.4.1",
78         vnopts: "1.0.2",
79         "yaml-unist-parser": "1.1.1"
80   };
81   var devDependencies = {
82         "@babel/core": "7.7.2",
83         "@babel/preset-env": "7.7.1",
84         "@rollup/plugin-alias": "2.2.0",
85         "@rollup/plugin-replace": "2.2.1",
86         "babel-loader": "8.0.6",
87         benchmark: "2.1.4",
88         "builtin-modules": "3.1.0",
89         codecov: "3.6.1",
90         "cross-env": "6.0.3",
91         eslint: "6.6.0",
92         "eslint-config-prettier": "6.5.0",
93         "eslint-formatter-friendly": "7.0.0",
94         "eslint-plugin-import": "2.18.2",
95         "eslint-plugin-prettier": "3.1.1",
96         "eslint-plugin-react": "7.16.0",
97         execa: "3.2.0",
98         jest: "23.3.0",
99         "jest-junit": "9.0.0",
100         "jest-snapshot-serializer-ansi": "1.0.0",
101         "jest-snapshot-serializer-raw": "1.1.0",
102         "jest-watch-typeahead": "0.4.0",
103         mkdirp: "0.5.1",
104         prettier: "1.19.0",
105         prettylint: "1.0.0",
106         rimraf: "3.0.0",
107         rollup: "1.26.3",
108         "rollup-plugin-babel": "4.3.3",
109         "rollup-plugin-commonjs": "10.1.0",
110         "rollup-plugin-json": "4.0.0",
111         "rollup-plugin-node-globals": "1.4.0",
112         "rollup-plugin-node-resolve": "5.2.0",
113         "rollup-plugin-terser": "5.1.2",
114         shelljs: "0.8.3",
115         "snapshot-diff": "0.4.0",
116         "strip-ansi": "5.2.0",
117         "synchronous-promise": "2.0.10",
118         tempy: "0.2.1",
119         "terser-webpack-plugin": "2.2.1",
120         webpack: "4.41.2"
121   };
122   var scripts = {
123         prepublishOnly: "echo \"Error: must publish from dist/\" && exit 1",
124         "prepare-release": "yarn && yarn build && yarn test:dist",
125         test: "jest",
126         "test:dist": "node ./scripts/test-dist.js",
127         "test-integration": "jest tests_integration",
128         "perf-repeat": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
129         "perf-repeat-inspect": "yarn && yarn build && cross-env NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --debug-repeat ${PERF_REPEAT:-1000} --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
130         "perf-benchmark": "yarn && yarn build && cross-env NODE_ENV=production node ./dist/bin-prettier.js --debug-benchmark --loglevel debug ${PERF_FILE:-./index.js} > /dev/null",
131         "check-types": "tsc",
132         lint: "cross-env EFF_NO_LINK_RULES=true eslint . --format friendly",
133         "lint-docs": "prettylint {.,docs,website,website/blog}/*.md",
134         "lint-dist": "eslint --no-eslintrc --no-ignore --env=browser \"dist/!(bin-prettier|index|third-party).js\"",
135         build: "node --max-old-space-size=3072 ./scripts/build/build.js",
136         "build-docs": "node ./scripts/build-docs.js",
137         "check-deps": "node ./scripts/check-deps.js",
138         spellcheck: "npx -p cspell@4.0.31 cspell {bin,scripts,src}/**/*.js {docs,website/blog,changelog_unreleased}/**/*.md"
139   };
140   var _package = {
141         name: name,
142         version: version,
143         description: description,
144         bin: bin,
145         repository: repository,
146         homepage: homepage,
147         author: author,
148         license: license,
149         main: main,
150         engines: engines,
151         dependencies: dependencies,
152         devDependencies: devDependencies,
153         scripts: scripts
154   };
155
156   var _package$1 = /*#__PURE__*/Object.freeze({
157     __proto__: null,
158     name: name,
159     version: version,
160     description: description,
161     bin: bin,
162     repository: repository,
163     homepage: homepage,
164     author: author,
165     license: license,
166     main: main,
167     engines: engines,
168     dependencies: dependencies,
169     devDependencies: devDependencies,
170     scripts: scripts,
171     'default': _package
172   });
173
174   function _typeof(obj) {
175     if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
176       _typeof = function (obj) {
177         return typeof obj;
178       };
179     } else {
180       _typeof = function (obj) {
181         return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
182       };
183     }
184
185     return _typeof(obj);
186   }
187
188   function _classCallCheck(instance, Constructor) {
189     if (!(instance instanceof Constructor)) {
190       throw new TypeError("Cannot call a class as a function");
191     }
192   }
193
194   function _defineProperties(target, props) {
195     for (var i = 0; i < props.length; i++) {
196       var descriptor = props[i];
197       descriptor.enumerable = descriptor.enumerable || false;
198       descriptor.configurable = true;
199       if ("value" in descriptor) descriptor.writable = true;
200       Object.defineProperty(target, descriptor.key, descriptor);
201     }
202   }
203
204   function _createClass(Constructor, protoProps, staticProps) {
205     if (protoProps) _defineProperties(Constructor.prototype, protoProps);
206     if (staticProps) _defineProperties(Constructor, staticProps);
207     return Constructor;
208   }
209
210   function _defineProperty(obj, key, value) {
211     if (key in obj) {
212       Object.defineProperty(obj, key, {
213         value: value,
214         enumerable: true,
215         configurable: true,
216         writable: true
217       });
218     } else {
219       obj[key] = value;
220     }
221
222     return obj;
223   }
224
225   function _inherits(subClass, superClass) {
226     if (typeof superClass !== "function" && superClass !== null) {
227       throw new TypeError("Super expression must either be null or a function");
228     }
229
230     subClass.prototype = Object.create(superClass && superClass.prototype, {
231       constructor: {
232         value: subClass,
233         writable: true,
234         configurable: true
235       }
236     });
237     if (superClass) _setPrototypeOf(subClass, superClass);
238   }
239
240   function _getPrototypeOf(o) {
241     _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
242       return o.__proto__ || Object.getPrototypeOf(o);
243     };
244     return _getPrototypeOf(o);
245   }
246
247   function _setPrototypeOf(o, p) {
248     _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
249       o.__proto__ = p;
250       return o;
251     };
252
253     return _setPrototypeOf(o, p);
254   }
255
256   function isNativeReflectConstruct() {
257     if (typeof Reflect === "undefined" || !Reflect.construct) return false;
258     if (Reflect.construct.sham) return false;
259     if (typeof Proxy === "function") return true;
260
261     try {
262       Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
263       return true;
264     } catch (e) {
265       return false;
266     }
267   }
268
269   function _construct(Parent, args, Class) {
270     if (isNativeReflectConstruct()) {
271       _construct = Reflect.construct;
272     } else {
273       _construct = function _construct(Parent, args, Class) {
274         var a = [null];
275         a.push.apply(a, args);
276         var Constructor = Function.bind.apply(Parent, a);
277         var instance = new Constructor();
278         if (Class) _setPrototypeOf(instance, Class.prototype);
279         return instance;
280       };
281     }
282
283     return _construct.apply(null, arguments);
284   }
285
286   function _isNativeFunction(fn) {
287     return Function.toString.call(fn).indexOf("[native code]") !== -1;
288   }
289
290   function _wrapNativeSuper(Class) {
291     var _cache = typeof Map === "function" ? new Map() : undefined;
292
293     _wrapNativeSuper = function _wrapNativeSuper(Class) {
294       if (Class === null || !_isNativeFunction(Class)) return Class;
295
296       if (typeof Class !== "function") {
297         throw new TypeError("Super expression must either be null or a function");
298       }
299
300       if (typeof _cache !== "undefined") {
301         if (_cache.has(Class)) return _cache.get(Class);
302
303         _cache.set(Class, Wrapper);
304       }
305
306       function Wrapper() {
307         return _construct(Class, arguments, _getPrototypeOf(this).constructor);
308       }
309
310       Wrapper.prototype = Object.create(Class.prototype, {
311         constructor: {
312           value: Wrapper,
313           enumerable: false,
314           writable: true,
315           configurable: true
316         }
317       });
318       return _setPrototypeOf(Wrapper, Class);
319     };
320
321     return _wrapNativeSuper(Class);
322   }
323
324   function _assertThisInitialized(self) {
325     if (self === void 0) {
326       throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
327     }
328
329     return self;
330   }
331
332   function _possibleConstructorReturn(self, call) {
333     if (call && (typeof call === "object" || typeof call === "function")) {
334       return call;
335     }
336
337     return _assertThisInitialized(self);
338   }
339
340   function _superPropBase(object, property) {
341     while (!Object.prototype.hasOwnProperty.call(object, property)) {
342       object = _getPrototypeOf(object);
343       if (object === null) break;
344     }
345
346     return object;
347   }
348
349   function _get(target, property, receiver) {
350     if (typeof Reflect !== "undefined" && Reflect.get) {
351       _get = Reflect.get;
352     } else {
353       _get = function _get(target, property, receiver) {
354         var base = _superPropBase(target, property);
355
356         if (!base) return;
357         var desc = Object.getOwnPropertyDescriptor(base, property);
358
359         if (desc.get) {
360           return desc.get.call(receiver);
361         }
362
363         return desc.value;
364       };
365     }
366
367     return _get(target, property, receiver || target);
368   }
369
370   function _taggedTemplateLiteral(strings, raw) {
371     if (!raw) {
372       raw = strings.slice(0);
373     }
374
375     return Object.freeze(Object.defineProperties(strings, {
376       raw: {
377         value: Object.freeze(raw)
378       }
379     }));
380   }
381
382   function _slicedToArray(arr, i) {
383     return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
384   }
385
386   function _toConsumableArray(arr) {
387     return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
388   }
389
390   function _arrayWithoutHoles(arr) {
391     if (Array.isArray(arr)) {
392       for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
393
394       return arr2;
395     }
396   }
397
398   function _arrayWithHoles(arr) {
399     if (Array.isArray(arr)) return arr;
400   }
401
402   function _iterableToArray(iter) {
403     if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
404   }
405
406   function _iterableToArrayLimit(arr, i) {
407     if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
408       return;
409     }
410
411     var _arr = [];
412     var _n = true;
413     var _d = false;
414     var _e = undefined;
415
416     try {
417       for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
418         _arr.push(_s.value);
419
420         if (i && _arr.length === i) break;
421       }
422     } catch (err) {
423       _d = true;
424       _e = err;
425     } finally {
426       try {
427         if (!_n && _i["return"] != null) _i["return"]();
428       } finally {
429         if (_d) throw _e;
430       }
431     }
432
433     return _arr;
434   }
435
436   function _nonIterableSpread() {
437     throw new TypeError("Invalid attempt to spread non-iterable instance");
438   }
439
440   function _nonIterableRest() {
441     throw new TypeError("Invalid attempt to destructure non-iterable instance");
442   }
443
444   function Diff() {}
445
446   Diff.prototype = {
447     diff: function diff(oldString, newString) {
448       var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
449       var callback = options.callback;
450
451       if (typeof options === 'function') {
452         callback = options;
453         options = {};
454       }
455
456       this.options = options;
457       var self = this;
458
459       function done(value) {
460         if (callback) {
461           setTimeout(function () {
462             callback(undefined, value);
463           }, 0);
464           return true;
465         } else {
466           return value;
467         }
468       } // Allow subclasses to massage the input prior to running
469
470
471       oldString = this.castInput(oldString);
472       newString = this.castInput(newString);
473       oldString = this.removeEmpty(this.tokenize(oldString));
474       newString = this.removeEmpty(this.tokenize(newString));
475       var newLen = newString.length,
476           oldLen = oldString.length;
477       var editLength = 1;
478       var maxEditLength = newLen + oldLen;
479       var bestPath = [{
480         newPos: -1,
481         components: []
482       }]; // Seed editLength = 0, i.e. the content starts with the same values
483
484       var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
485
486       if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
487         // Identity per the equality and tokenizer
488         return done([{
489           value: this.join(newString),
490           count: newString.length
491         }]);
492       } // Main worker method. checks all permutations of a given edit length for acceptance.
493
494
495       function execEditLength() {
496         for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
497           var basePath = void 0;
498
499           var addPath = bestPath[diagonalPath - 1],
500               removePath = bestPath[diagonalPath + 1],
501               _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
502
503           if (addPath) {
504             // No one else is going to attempt to use this value, clear it
505             bestPath[diagonalPath - 1] = undefined;
506           }
507
508           var canAdd = addPath && addPath.newPos + 1 < newLen,
509               canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
510
511           if (!canAdd && !canRemove) {
512             // If this path is a terminal then prune
513             bestPath[diagonalPath] = undefined;
514             continue;
515           } // Select the diagonal that we want to branch from. We select the prior
516           // path whose position in the new string is the farthest from the origin
517           // and does not pass the bounds of the diff graph
518
519
520           if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
521             basePath = clonePath(removePath);
522             self.pushComponent(basePath.components, undefined, true);
523           } else {
524             basePath = addPath; // No need to clone, we've pulled it from the list
525
526             basePath.newPos++;
527             self.pushComponent(basePath.components, true, undefined);
528           }
529
530           _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
531
532           if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
533             return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
534           } else {
535             // Otherwise track this path as a potential candidate and continue.
536             bestPath[diagonalPath] = basePath;
537           }
538         }
539
540         editLength++;
541       } // Performs the length of edit iteration. Is a bit fugly as this has to support the
542       // sync and async mode which is never fun. Loops over execEditLength until a value
543       // is produced.
544
545
546       if (callback) {
547         (function exec() {
548           setTimeout(function () {
549             // This should not happen, but we want to be safe.
550
551             /* istanbul ignore next */
552             if (editLength > maxEditLength) {
553               return callback();
554             }
555
556             if (!execEditLength()) {
557               exec();
558             }
559           }, 0);
560         })();
561       } else {
562         while (editLength <= maxEditLength) {
563           var ret = execEditLength();
564
565           if (ret) {
566             return ret;
567           }
568         }
569       }
570     },
571     pushComponent: function pushComponent(components, added, removed) {
572       var last = components[components.length - 1];
573
574       if (last && last.added === added && last.removed === removed) {
575         // We need to clone here as the component clone operation is just
576         // as shallow array clone
577         components[components.length - 1] = {
578           count: last.count + 1,
579           added: added,
580           removed: removed
581         };
582       } else {
583         components.push({
584           count: 1,
585           added: added,
586           removed: removed
587         });
588       }
589     },
590     extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
591       var newLen = newString.length,
592           oldLen = oldString.length,
593           newPos = basePath.newPos,
594           oldPos = newPos - diagonalPath,
595           commonCount = 0;
596
597       while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
598         newPos++;
599         oldPos++;
600         commonCount++;
601       }
602
603       if (commonCount) {
604         basePath.components.push({
605           count: commonCount
606         });
607       }
608
609       basePath.newPos = newPos;
610       return oldPos;
611     },
612     equals: function equals(left, right) {
613       if (this.options.comparator) {
614         return this.options.comparator(left, right);
615       } else {
616         return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
617       }
618     },
619     removeEmpty: function removeEmpty(array) {
620       var ret = [];
621
622       for (var i = 0; i < array.length; i++) {
623         if (array[i]) {
624           ret.push(array[i]);
625         }
626       }
627
628       return ret;
629     },
630     castInput: function castInput(value) {
631       return value;
632     },
633     tokenize: function tokenize(value) {
634       return value.split('');
635     },
636     join: function join(chars) {
637       return chars.join('');
638     }
639   };
640
641   function buildValues(diff, components, newString, oldString, useLongestToken) {
642     var componentPos = 0,
643         componentLen = components.length,
644         newPos = 0,
645         oldPos = 0;
646
647     for (; componentPos < componentLen; componentPos++) {
648       var component = components[componentPos];
649
650       if (!component.removed) {
651         if (!component.added && useLongestToken) {
652           var value = newString.slice(newPos, newPos + component.count);
653           value = value.map(function (value, i) {
654             var oldValue = oldString[oldPos + i];
655             return oldValue.length > value.length ? oldValue : value;
656           });
657           component.value = diff.join(value);
658         } else {
659           component.value = diff.join(newString.slice(newPos, newPos + component.count));
660         }
661
662         newPos += component.count; // Common case
663
664         if (!component.added) {
665           oldPos += component.count;
666         }
667       } else {
668         component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
669         oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
670         // The diffing algorithm is tied to add then remove output and this is the simplest
671         // route to get the desired output with minimal overhead.
672
673         if (componentPos && components[componentPos - 1].added) {
674           var tmp = components[componentPos - 1];
675           components[componentPos - 1] = components[componentPos];
676           components[componentPos] = tmp;
677         }
678       }
679     } // Special case handle for when one terminal is ignored (i.e. whitespace).
680     // For this case we merge the terminal into the prior string and drop the change.
681     // This is only available for string mode.
682
683
684     var lastComponent = components[componentLen - 1];
685
686     if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
687       components[componentLen - 2].value += lastComponent.value;
688       components.pop();
689     }
690
691     return components;
692   }
693
694   function clonePath(path) {
695     return {
696       newPos: path.newPos,
697       components: path.components.slice(0)
698     };
699   }
700
701   var characterDiff = new Diff();
702
703   function diffChars(oldStr, newStr, options) {
704     return characterDiff.diff(oldStr, newStr, options);
705   }
706
707   function generateOptions(options, defaults) {
708     if (typeof options === 'function') {
709       defaults.callback = options;
710     } else if (options) {
711       for (var name in options) {
712         /* istanbul ignore else */
713         if (options.hasOwnProperty(name)) {
714           defaults[name] = options[name];
715         }
716       }
717     }
718
719     return defaults;
720   } //
721   // Ranges and exceptions:
722   // Latin-1 Supplement, 0080–00FF
723   //  - U+00D7  × Multiplication sign
724   //  - U+00F7  ÷ Division sign
725   // Latin Extended-A, 0100–017F
726   // Latin Extended-B, 0180–024F
727   // IPA Extensions, 0250–02AF
728   // Spacing Modifier Letters, 02B0–02FF
729   //  - U+02C7  ˇ &#711;  Caron
730   //  - U+02D8  ˘ &#728;  Breve
731   //  - U+02D9  ˙ &#729;  Dot Above
732   //  - U+02DA  ˚ &#730;  Ring Above
733   //  - U+02DB  ˛ &#731;  Ogonek
734   //  - U+02DC  ˜ &#732;  Small Tilde
735   //  - U+02DD  ˝ &#733;  Double Acute Accent
736   // Latin Extended Additional, 1E00–1EFF
737
738
739   var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
740   var reWhitespace = /\S/;
741   var wordDiff = new Diff();
742
743   wordDiff.equals = function (left, right) {
744     if (this.options.ignoreCase) {
745       left = left.toLowerCase();
746       right = right.toLowerCase();
747     }
748
749     return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
750   };
751
752   wordDiff.tokenize = function (value) {
753     var tokens = value.split(/(\s+|[()[\]{}'"]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
754
755     for (var i = 0; i < tokens.length - 1; i++) {
756       // If we have an empty string in the next field and we have only word chars before and after, merge
757       if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
758         tokens[i] += tokens[i + 2];
759         tokens.splice(i + 1, 2);
760         i--;
761       }
762     }
763
764     return tokens;
765   };
766
767   function diffWords(oldStr, newStr, options) {
768     options = generateOptions(options, {
769       ignoreWhitespace: true
770     });
771     return wordDiff.diff(oldStr, newStr, options);
772   }
773
774   function diffWordsWithSpace(oldStr, newStr, options) {
775     return wordDiff.diff(oldStr, newStr, options);
776   }
777
778   var lineDiff = new Diff();
779
780   lineDiff.tokenize = function (value) {
781     var retLines = [],
782         linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
783
784     if (!linesAndNewlines[linesAndNewlines.length - 1]) {
785       linesAndNewlines.pop();
786     } // Merge the content and line separators into single tokens
787
788
789     for (var i = 0; i < linesAndNewlines.length; i++) {
790       var line = linesAndNewlines[i];
791
792       if (i % 2 && !this.options.newlineIsToken) {
793         retLines[retLines.length - 1] += line;
794       } else {
795         if (this.options.ignoreWhitespace) {
796           line = line.trim();
797         }
798
799         retLines.push(line);
800       }
801     }
802
803     return retLines;
804   };
805
806   function diffLines(oldStr, newStr, callback) {
807     return lineDiff.diff(oldStr, newStr, callback);
808   }
809
810   function diffTrimmedLines(oldStr, newStr, callback) {
811     var options = generateOptions(callback, {
812       ignoreWhitespace: true
813     });
814     return lineDiff.diff(oldStr, newStr, options);
815   }
816
817   var sentenceDiff = new Diff();
818
819   sentenceDiff.tokenize = function (value) {
820     return value.split(/(\S.+?[.!?])(?=\s+|$)/);
821   };
822
823   function diffSentences(oldStr, newStr, callback) {
824     return sentenceDiff.diff(oldStr, newStr, callback);
825   }
826
827   var cssDiff = new Diff();
828
829   cssDiff.tokenize = function (value) {
830     return value.split(/([{}:;,]|\s+)/);
831   };
832
833   function diffCss(oldStr, newStr, callback) {
834     return cssDiff.diff(oldStr, newStr, callback);
835   }
836
837   function _typeof$1(obj) {
838     if (typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol") {
839       _typeof$1 = function _typeof$1(obj) {
840         return _typeof(obj);
841       };
842     } else {
843       _typeof$1 = function _typeof$1(obj) {
844         return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
845       };
846     }
847
848     return _typeof$1(obj);
849   }
850
851   function _toConsumableArray$1(arr) {
852     return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
853   }
854
855   function _arrayWithoutHoles$1(arr) {
856     if (Array.isArray(arr)) {
857       for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
858         arr2[i] = arr[i];
859       }
860
861       return arr2;
862     }
863   }
864
865   function _iterableToArray$1(iter) {
866     if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
867   }
868
869   function _nonIterableSpread$1() {
870     throw new TypeError("Invalid attempt to spread non-iterable instance");
871   }
872
873   var objectPrototypeToString = Object.prototype.toString;
874   var jsonDiff = new Diff(); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
875   // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
876
877   jsonDiff.useLongestToken = true;
878   jsonDiff.tokenize = lineDiff.tokenize;
879
880   jsonDiff.castInput = function (value) {
881     var _this$options = this.options,
882         undefinedReplacement = _this$options.undefinedReplacement,
883         _this$options$stringi = _this$options.stringifyReplacer,
884         stringifyReplacer = _this$options$stringi === void 0 ? function (k, v) {
885       return typeof v === 'undefined' ? undefinedReplacement : v;
886     } : _this$options$stringi;
887     return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, '  ');
888   };
889
890   jsonDiff.equals = function (left, right) {
891     return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
892   };
893
894   function diffJson(oldObj, newObj, options) {
895     return jsonDiff.diff(oldObj, newObj, options);
896   } // This function handles the presence of circular references by bailing out when encountering an
897   // object that is already on the "stack" of items being processed. Accepts an optional replacer
898
899
900   function canonicalize(obj, stack, replacementStack, replacer, key) {
901     stack = stack || [];
902     replacementStack = replacementStack || [];
903
904     if (replacer) {
905       obj = replacer(key, obj);
906     }
907
908     var i;
909
910     for (i = 0; i < stack.length; i += 1) {
911       if (stack[i] === obj) {
912         return replacementStack[i];
913       }
914     }
915
916     var canonicalizedObj;
917
918     if ('[object Array]' === objectPrototypeToString.call(obj)) {
919       stack.push(obj);
920       canonicalizedObj = new Array(obj.length);
921       replacementStack.push(canonicalizedObj);
922
923       for (i = 0; i < obj.length; i += 1) {
924         canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
925       }
926
927       stack.pop();
928       replacementStack.pop();
929       return canonicalizedObj;
930     }
931
932     if (obj && obj.toJSON) {
933       obj = obj.toJSON();
934     }
935
936     if (_typeof$1(obj) === 'object' && obj !== null) {
937       stack.push(obj);
938       canonicalizedObj = {};
939       replacementStack.push(canonicalizedObj);
940
941       var sortedKeys = [],
942           _key;
943
944       for (_key in obj) {
945         /* istanbul ignore else */
946         if (obj.hasOwnProperty(_key)) {
947           sortedKeys.push(_key);
948         }
949       }
950
951       sortedKeys.sort();
952
953       for (i = 0; i < sortedKeys.length; i += 1) {
954         _key = sortedKeys[i];
955         canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
956       }
957
958       stack.pop();
959       replacementStack.pop();
960     } else {
961       canonicalizedObj = obj;
962     }
963
964     return canonicalizedObj;
965   }
966
967   var arrayDiff = new Diff();
968
969   arrayDiff.tokenize = function (value) {
970     return value.slice();
971   };
972
973   arrayDiff.join = arrayDiff.removeEmpty = function (value) {
974     return value;
975   };
976
977   function diffArrays(oldArr, newArr, callback) {
978     return arrayDiff.diff(oldArr, newArr, callback);
979   }
980
981   function parsePatch(uniDiff) {
982     var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
983     var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
984         delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
985         list = [],
986         i = 0;
987
988     function parseIndex() {
989       var index = {};
990       list.push(index); // Parse diff metadata
991
992       while (i < diffstr.length) {
993         var line = diffstr[i]; // File header found, end parsing diff metadata
994
995         if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
996           break;
997         } // Diff index
998
999
1000         var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
1001
1002         if (header) {
1003           index.index = header[1];
1004         }
1005
1006         i++;
1007       } // Parse file headers if they are defined. Unified diff requires them, but
1008       // there's no technical issues to have an isolated hunk without file header
1009
1010
1011       parseFileHeader(index);
1012       parseFileHeader(index); // Parse hunks
1013
1014       index.hunks = [];
1015
1016       while (i < diffstr.length) {
1017         var _line = diffstr[i];
1018
1019         if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
1020           break;
1021         } else if (/^@@/.test(_line)) {
1022           index.hunks.push(parseHunk());
1023         } else if (_line && options.strict) {
1024           // Ignore unexpected content unless in strict mode
1025           throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
1026         } else {
1027           i++;
1028         }
1029       }
1030     } // Parses the --- and +++ headers, if none are found, no lines
1031     // are consumed.
1032
1033
1034     function parseFileHeader(index) {
1035       var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
1036
1037       if (fileHeader) {
1038         var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
1039         var data = fileHeader[2].split('\t', 2);
1040         var fileName = data[0].replace(/\\\\/g, '\\');
1041
1042         if (/^".*"$/.test(fileName)) {
1043           fileName = fileName.substr(1, fileName.length - 2);
1044         }
1045
1046         index[keyPrefix + 'FileName'] = fileName;
1047         index[keyPrefix + 'Header'] = (data[1] || '').trim();
1048         i++;
1049       }
1050     } // Parses a hunk
1051     // This assumes that we are at the start of a hunk.
1052
1053
1054     function parseHunk() {
1055       var chunkHeaderIndex = i,
1056           chunkHeaderLine = diffstr[i++],
1057           chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
1058       var hunk = {
1059         oldStart: +chunkHeader[1],
1060         oldLines: +chunkHeader[2] || 1,
1061         newStart: +chunkHeader[3],
1062         newLines: +chunkHeader[4] || 1,
1063         lines: [],
1064         linedelimiters: []
1065       };
1066       var addCount = 0,
1067           removeCount = 0;
1068
1069       for (; i < diffstr.length; i++) {
1070         // Lines starting with '---' could be mistaken for the "remove line" operation
1071         // But they could be the header for the next file. Therefore prune such cases out.
1072         if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
1073           break;
1074         }
1075
1076         var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
1077
1078         if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
1079           hunk.lines.push(diffstr[i]);
1080           hunk.linedelimiters.push(delimiters[i] || '\n');
1081
1082           if (operation === '+') {
1083             addCount++;
1084           } else if (operation === '-') {
1085             removeCount++;
1086           } else if (operation === ' ') {
1087             addCount++;
1088             removeCount++;
1089           }
1090         } else {
1091           break;
1092         }
1093       } // Handle the empty block count case
1094
1095
1096       if (!addCount && hunk.newLines === 1) {
1097         hunk.newLines = 0;
1098       }
1099
1100       if (!removeCount && hunk.oldLines === 1) {
1101         hunk.oldLines = 0;
1102       } // Perform optional sanity checking
1103
1104
1105       if (options.strict) {
1106         if (addCount !== hunk.newLines) {
1107           throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
1108         }
1109
1110         if (removeCount !== hunk.oldLines) {
1111           throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
1112         }
1113       }
1114
1115       return hunk;
1116     }
1117
1118     while (i < diffstr.length) {
1119       parseIndex();
1120     }
1121
1122     return list;
1123   } // Iterator that traverses in the range of [min, max], stepping
1124   // by distance from a given start position. I.e. for [0, 4], with
1125   // start of 2, this will iterate 2, 3, 1, 4, 0.
1126
1127
1128   function distanceIterator(start, minLine, maxLine) {
1129     var wantForward = true,
1130         backwardExhausted = false,
1131         forwardExhausted = false,
1132         localOffset = 1;
1133     return function iterator() {
1134       if (wantForward && !forwardExhausted) {
1135         if (backwardExhausted) {
1136           localOffset++;
1137         } else {
1138           wantForward = false;
1139         } // Check if trying to fit beyond text length, and if not, check it fits
1140         // after offset location (or desired location on first iteration)
1141
1142
1143         if (start + localOffset <= maxLine) {
1144           return localOffset;
1145         }
1146
1147         forwardExhausted = true;
1148       }
1149
1150       if (!backwardExhausted) {
1151         if (!forwardExhausted) {
1152           wantForward = true;
1153         } // Check if trying to fit before text beginning, and if not, check it fits
1154         // before offset location
1155
1156
1157         if (minLine <= start - localOffset) {
1158           return -localOffset++;
1159         }
1160
1161         backwardExhausted = true;
1162         return iterator();
1163       } // We tried to fit hunk before text beginning and beyond text length, then
1164       // hunk can't fit on the text. Return undefined
1165
1166     };
1167   }
1168
1169   function applyPatch(source, uniDiff) {
1170     var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1171
1172     if (typeof uniDiff === 'string') {
1173       uniDiff = parsePatch(uniDiff);
1174     }
1175
1176     if (Array.isArray(uniDiff)) {
1177       if (uniDiff.length > 1) {
1178         throw new Error('applyPatch only works with a single input.');
1179       }
1180
1181       uniDiff = uniDiff[0];
1182     } // Apply the diff to the input
1183
1184
1185     var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
1186         delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
1187         hunks = uniDiff.hunks,
1188         compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) {
1189       return line === patchContent;
1190     },
1191         errorCount = 0,
1192         fuzzFactor = options.fuzzFactor || 0,
1193         minLine = 0,
1194         offset = 0,
1195         removeEOFNL,
1196         addEOFNL;
1197     /**
1198      * Checks if the hunk exactly fits on the provided location
1199      */
1200
1201
1202     function hunkFits(hunk, toPos) {
1203       for (var j = 0; j < hunk.lines.length; j++) {
1204         var line = hunk.lines[j],
1205             operation = line.length > 0 ? line[0] : ' ',
1206             content = line.length > 0 ? line.substr(1) : line;
1207
1208         if (operation === ' ' || operation === '-') {
1209           // Context sanity check
1210           if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
1211             errorCount++;
1212
1213             if (errorCount > fuzzFactor) {
1214               return false;
1215             }
1216           }
1217
1218           toPos++;
1219         }
1220       }
1221
1222       return true;
1223     } // Search best fit offsets for each hunk based on the previous ones
1224
1225
1226     for (var i = 0; i < hunks.length; i++) {
1227       var hunk = hunks[i],
1228           maxLine = lines.length - hunk.oldLines,
1229           localOffset = 0,
1230           toPos = offset + hunk.oldStart - 1;
1231       var iterator = distanceIterator(toPos, minLine, maxLine);
1232
1233       for (; localOffset !== undefined; localOffset = iterator()) {
1234         if (hunkFits(hunk, toPos + localOffset)) {
1235           hunk.offset = offset += localOffset;
1236           break;
1237         }
1238       }
1239
1240       if (localOffset === undefined) {
1241         return false;
1242       } // Set lower text limit to end of the current hunk, so next ones don't try
1243       // to fit over already patched text
1244
1245
1246       minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
1247     } // Apply patch hunks
1248
1249
1250     var diffOffset = 0;
1251
1252     for (var _i = 0; _i < hunks.length; _i++) {
1253       var _hunk = hunks[_i],
1254           _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
1255
1256       diffOffset += _hunk.newLines - _hunk.oldLines;
1257
1258       if (_toPos < 0) {
1259         // Creating a new file
1260         _toPos = 0;
1261       }
1262
1263       for (var j = 0; j < _hunk.lines.length; j++) {
1264         var line = _hunk.lines[j],
1265             operation = line.length > 0 ? line[0] : ' ',
1266             content = line.length > 0 ? line.substr(1) : line,
1267             delimiter = _hunk.linedelimiters[j];
1268
1269         if (operation === ' ') {
1270           _toPos++;
1271         } else if (operation === '-') {
1272           lines.splice(_toPos, 1);
1273           delimiters.splice(_toPos, 1);
1274           /* istanbul ignore else */
1275         } else if (operation === '+') {
1276           lines.splice(_toPos, 0, content);
1277           delimiters.splice(_toPos, 0, delimiter);
1278           _toPos++;
1279         } else if (operation === '\\') {
1280           var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
1281
1282           if (previousOperation === '+') {
1283             removeEOFNL = true;
1284           } else if (previousOperation === '-') {
1285             addEOFNL = true;
1286           }
1287         }
1288       }
1289     } // Handle EOFNL insertion/removal
1290
1291
1292     if (removeEOFNL) {
1293       while (!lines[lines.length - 1]) {
1294         lines.pop();
1295         delimiters.pop();
1296       }
1297     } else if (addEOFNL) {
1298       lines.push('');
1299       delimiters.push('\n');
1300     }
1301
1302     for (var _k = 0; _k < lines.length - 1; _k++) {
1303       lines[_k] = lines[_k] + delimiters[_k];
1304     }
1305
1306     return lines.join('');
1307   } // Wrapper that supports multiple file patches via callbacks.
1308
1309
1310   function applyPatches(uniDiff, options) {
1311     if (typeof uniDiff === 'string') {
1312       uniDiff = parsePatch(uniDiff);
1313     }
1314
1315     var currentIndex = 0;
1316
1317     function processIndex() {
1318       var index = uniDiff[currentIndex++];
1319
1320       if (!index) {
1321         return options.complete();
1322       }
1323
1324       options.loadFile(index, function (err, data) {
1325         if (err) {
1326           return options.complete(err);
1327         }
1328
1329         var updatedContent = applyPatch(data, index, options);
1330         options.patched(index, updatedContent, function (err) {
1331           if (err) {
1332             return options.complete(err);
1333           }
1334
1335           processIndex();
1336         });
1337       });
1338     }
1339
1340     processIndex();
1341   }
1342
1343   function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
1344     if (!options) {
1345       options = {};
1346     }
1347
1348     if (typeof options.context === 'undefined') {
1349       options.context = 4;
1350     }
1351
1352     var diff = diffLines(oldStr, newStr, options);
1353     diff.push({
1354       value: '',
1355       lines: []
1356     }); // Append an empty value to make cleanup easier
1357
1358     function contextLines(lines) {
1359       return lines.map(function (entry) {
1360         return ' ' + entry;
1361       });
1362     }
1363
1364     var hunks = [];
1365     var oldRangeStart = 0,
1366         newRangeStart = 0,
1367         curRange = [],
1368         oldLine = 1,
1369         newLine = 1;
1370
1371     var _loop = function _loop(i) {
1372       var current = diff[i],
1373           lines = current.lines || current.value.replace(/\n$/, '').split('\n');
1374       current.lines = lines;
1375
1376       if (current.added || current.removed) {
1377         var _curRange; // If we have previous context, start with that
1378
1379
1380         if (!oldRangeStart) {
1381           var prev = diff[i - 1];
1382           oldRangeStart = oldLine;
1383           newRangeStart = newLine;
1384
1385           if (prev) {
1386             curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
1387             oldRangeStart -= curRange.length;
1388             newRangeStart -= curRange.length;
1389           }
1390         } // Output our changes
1391
1392
1393         (_curRange = curRange).push.apply(_curRange, _toConsumableArray$1(lines.map(function (entry) {
1394           return (current.added ? '+' : '-') + entry;
1395         }))); // Track the updated file position
1396
1397
1398         if (current.added) {
1399           newLine += lines.length;
1400         } else {
1401           oldLine += lines.length;
1402         }
1403       } else {
1404         // Identical context lines. Track line changes
1405         if (oldRangeStart) {
1406           // Close out any changes that have been output (or join overlapping)
1407           if (lines.length <= options.context * 2 && i < diff.length - 2) {
1408             var _curRange2; // Overlapping
1409
1410
1411             (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray$1(contextLines(lines)));
1412           } else {
1413             var _curRange3; // end the range and output
1414
1415
1416             var contextSize = Math.min(lines.length, options.context);
1417
1418             (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray$1(contextLines(lines.slice(0, contextSize))));
1419
1420             var hunk = {
1421               oldStart: oldRangeStart,
1422               oldLines: oldLine - oldRangeStart + contextSize,
1423               newStart: newRangeStart,
1424               newLines: newLine - newRangeStart + contextSize,
1425               lines: curRange
1426             };
1427
1428             if (i >= diff.length - 2 && lines.length <= options.context) {
1429               // EOF is inside this hunk
1430               var oldEOFNewline = /\n$/.test(oldStr);
1431               var newEOFNewline = /\n$/.test(newStr);
1432               var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
1433
1434               if (!oldEOFNewline && noNlBeforeAdds) {
1435                 // special case: old has no eol and no trailing context; no-nl can end up before adds
1436                 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
1437               }
1438
1439               if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
1440                 curRange.push('\\ No newline at end of file');
1441               }
1442             }
1443
1444             hunks.push(hunk);
1445             oldRangeStart = 0;
1446             newRangeStart = 0;
1447             curRange = [];
1448           }
1449         }
1450
1451         oldLine += lines.length;
1452         newLine += lines.length;
1453       }
1454     };
1455
1456     for (var i = 0; i < diff.length; i++) {
1457       _loop(i);
1458     }
1459
1460     return {
1461       oldFileName: oldFileName,
1462       newFileName: newFileName,
1463       oldHeader: oldHeader,
1464       newHeader: newHeader,
1465       hunks: hunks
1466     };
1467   }
1468
1469   function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
1470     var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
1471     var ret = [];
1472
1473     if (oldFileName == newFileName) {
1474       ret.push('Index: ' + oldFileName);
1475     }
1476
1477     ret.push('===================================================================');
1478     ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
1479     ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
1480
1481     for (var i = 0; i < diff.hunks.length; i++) {
1482       var hunk = diff.hunks[i];
1483       ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
1484       ret.push.apply(ret, hunk.lines);
1485     }
1486
1487     return ret.join('\n') + '\n';
1488   }
1489
1490   function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
1491     return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
1492   }
1493
1494   function arrayEqual(a, b) {
1495     if (a.length !== b.length) {
1496       return false;
1497     }
1498
1499     return arrayStartsWith(a, b);
1500   }
1501
1502   function arrayStartsWith(array, start) {
1503     if (start.length > array.length) {
1504       return false;
1505     }
1506
1507     for (var i = 0; i < start.length; i++) {
1508       if (start[i] !== array[i]) {
1509         return false;
1510       }
1511     }
1512
1513     return true;
1514   }
1515
1516   function calcLineCount(hunk) {
1517     var _calcOldNewLineCount = calcOldNewLineCount(hunk.lines),
1518         oldLines = _calcOldNewLineCount.oldLines,
1519         newLines = _calcOldNewLineCount.newLines;
1520
1521     if (oldLines !== undefined) {
1522       hunk.oldLines = oldLines;
1523     } else {
1524       delete hunk.oldLines;
1525     }
1526
1527     if (newLines !== undefined) {
1528       hunk.newLines = newLines;
1529     } else {
1530       delete hunk.newLines;
1531     }
1532   }
1533
1534   function merge(mine, theirs, base) {
1535     mine = loadPatch(mine, base);
1536     theirs = loadPatch(theirs, base);
1537     var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning.
1538     // Leaving sanity checks on this to the API consumer that may know more about the
1539     // meaning in their own context.
1540
1541     if (mine.index || theirs.index) {
1542       ret.index = mine.index || theirs.index;
1543     }
1544
1545     if (mine.newFileName || theirs.newFileName) {
1546       if (!fileNameChanged(mine)) {
1547         // No header or no change in ours, use theirs (and ours if theirs does not exist)
1548         ret.oldFileName = theirs.oldFileName || mine.oldFileName;
1549         ret.newFileName = theirs.newFileName || mine.newFileName;
1550         ret.oldHeader = theirs.oldHeader || mine.oldHeader;
1551         ret.newHeader = theirs.newHeader || mine.newHeader;
1552       } else if (!fileNameChanged(theirs)) {
1553         // No header or no change in theirs, use ours
1554         ret.oldFileName = mine.oldFileName;
1555         ret.newFileName = mine.newFileName;
1556         ret.oldHeader = mine.oldHeader;
1557         ret.newHeader = mine.newHeader;
1558       } else {
1559         // Both changed... figure it out
1560         ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
1561         ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
1562         ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
1563         ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
1564       }
1565     }
1566
1567     ret.hunks = [];
1568     var mineIndex = 0,
1569         theirsIndex = 0,
1570         mineOffset = 0,
1571         theirsOffset = 0;
1572
1573     while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
1574       var mineCurrent = mine.hunks[mineIndex] || {
1575         oldStart: Infinity
1576       },
1577           theirsCurrent = theirs.hunks[theirsIndex] || {
1578         oldStart: Infinity
1579       };
1580
1581       if (hunkBefore(mineCurrent, theirsCurrent)) {
1582         // This patch does not overlap with any of the others, yay.
1583         ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
1584         mineIndex++;
1585         theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
1586       } else if (hunkBefore(theirsCurrent, mineCurrent)) {
1587         // This patch does not overlap with any of the others, yay.
1588         ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
1589         theirsIndex++;
1590         mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
1591       } else {
1592         // Overlap, merge as best we can
1593         var mergedHunk = {
1594           oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
1595           oldLines: 0,
1596           newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
1597           newLines: 0,
1598           lines: []
1599         };
1600         mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
1601         theirsIndex++;
1602         mineIndex++;
1603         ret.hunks.push(mergedHunk);
1604       }
1605     }
1606
1607     return ret;
1608   }
1609
1610   function loadPatch(param, base) {
1611     if (typeof param === 'string') {
1612       if (/^@@/m.test(param) || /^Index:/m.test(param)) {
1613         return parsePatch(param)[0];
1614       }
1615
1616       if (!base) {
1617         throw new Error('Must provide a base reference or pass in a patch');
1618       }
1619
1620       return structuredPatch(undefined, undefined, base, param);
1621     }
1622
1623     return param;
1624   }
1625
1626   function fileNameChanged(patch) {
1627     return patch.newFileName && patch.newFileName !== patch.oldFileName;
1628   }
1629
1630   function selectField(index, mine, theirs) {
1631     if (mine === theirs) {
1632       return mine;
1633     } else {
1634       index.conflict = true;
1635       return {
1636         mine: mine,
1637         theirs: theirs
1638       };
1639     }
1640   }
1641
1642   function hunkBefore(test, check) {
1643     return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
1644   }
1645
1646   function cloneHunk(hunk, offset) {
1647     return {
1648       oldStart: hunk.oldStart,
1649       oldLines: hunk.oldLines,
1650       newStart: hunk.newStart + offset,
1651       newLines: hunk.newLines,
1652       lines: hunk.lines
1653     };
1654   }
1655
1656   function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
1657     // This will generally result in a conflicted hunk, but there are cases where the context
1658     // is the only overlap where we can successfully merge the content here.
1659     var mine = {
1660       offset: mineOffset,
1661       lines: mineLines,
1662       index: 0
1663     },
1664         their = {
1665       offset: theirOffset,
1666       lines: theirLines,
1667       index: 0
1668     }; // Handle any leading content
1669
1670     insertLeading(hunk, mine, their);
1671     insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each.
1672
1673     while (mine.index < mine.lines.length && their.index < their.lines.length) {
1674       var mineCurrent = mine.lines[mine.index],
1675           theirCurrent = their.lines[their.index];
1676
1677       if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
1678         // Both modified ...
1679         mutualChange(hunk, mine, their);
1680       } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
1681         var _hunk$lines; // Mine inserted
1682
1683
1684         (_hunk$lines = hunk.lines).push.apply(_hunk$lines, _toConsumableArray$1(collectChange(mine)));
1685       } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
1686         var _hunk$lines2; // Theirs inserted
1687
1688
1689         (_hunk$lines2 = hunk.lines).push.apply(_hunk$lines2, _toConsumableArray$1(collectChange(their)));
1690       } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
1691         // Mine removed or edited
1692         removal(hunk, mine, their);
1693       } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
1694         // Their removed or edited
1695         removal(hunk, their, mine, true);
1696       } else if (mineCurrent === theirCurrent) {
1697         // Context identity
1698         hunk.lines.push(mineCurrent);
1699         mine.index++;
1700         their.index++;
1701       } else {
1702         // Context mismatch
1703         conflict(hunk, collectChange(mine), collectChange(their));
1704       }
1705     } // Now push anything that may be remaining
1706
1707
1708     insertTrailing(hunk, mine);
1709     insertTrailing(hunk, their);
1710     calcLineCount(hunk);
1711   }
1712
1713   function mutualChange(hunk, mine, their) {
1714     var myChanges = collectChange(mine),
1715         theirChanges = collectChange(their);
1716
1717     if (allRemoves(myChanges) && allRemoves(theirChanges)) {
1718       // Special case for remove changes that are supersets of one another
1719       if (arrayStartsWith(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
1720         var _hunk$lines3;
1721
1722         (_hunk$lines3 = hunk.lines).push.apply(_hunk$lines3, _toConsumableArray$1(myChanges));
1723
1724         return;
1725       } else if (arrayStartsWith(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
1726         var _hunk$lines4;
1727
1728         (_hunk$lines4 = hunk.lines).push.apply(_hunk$lines4, _toConsumableArray$1(theirChanges));
1729
1730         return;
1731       }
1732     } else if (arrayEqual(myChanges, theirChanges)) {
1733       var _hunk$lines5;
1734
1735       (_hunk$lines5 = hunk.lines).push.apply(_hunk$lines5, _toConsumableArray$1(myChanges));
1736
1737       return;
1738     }
1739
1740     conflict(hunk, myChanges, theirChanges);
1741   }
1742
1743   function removal(hunk, mine, their, swap) {
1744     var myChanges = collectChange(mine),
1745         theirChanges = collectContext(their, myChanges);
1746
1747     if (theirChanges.merged) {
1748       var _hunk$lines6;
1749
1750       (_hunk$lines6 = hunk.lines).push.apply(_hunk$lines6, _toConsumableArray$1(theirChanges.merged));
1751     } else {
1752       conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
1753     }
1754   }
1755
1756   function conflict(hunk, mine, their) {
1757     hunk.conflict = true;
1758     hunk.lines.push({
1759       conflict: true,
1760       mine: mine,
1761       theirs: their
1762     });
1763   }
1764
1765   function insertLeading(hunk, insert, their) {
1766     while (insert.offset < their.offset && insert.index < insert.lines.length) {
1767       var line = insert.lines[insert.index++];
1768       hunk.lines.push(line);
1769       insert.offset++;
1770     }
1771   }
1772
1773   function insertTrailing(hunk, insert) {
1774     while (insert.index < insert.lines.length) {
1775       var line = insert.lines[insert.index++];
1776       hunk.lines.push(line);
1777     }
1778   }
1779
1780   function collectChange(state) {
1781     var ret = [],
1782         operation = state.lines[state.index][0];
1783
1784     while (state.index < state.lines.length) {
1785       var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
1786
1787       if (operation === '-' && line[0] === '+') {
1788         operation = '+';
1789       }
1790
1791       if (operation === line[0]) {
1792         ret.push(line);
1793         state.index++;
1794       } else {
1795         break;
1796       }
1797     }
1798
1799     return ret;
1800   }
1801
1802   function collectContext(state, matchChanges) {
1803     var changes = [],
1804         merged = [],
1805         matchIndex = 0,
1806         contextChanges = false,
1807         conflicted = false;
1808
1809     while (matchIndex < matchChanges.length && state.index < state.lines.length) {
1810       var change = state.lines[state.index],
1811           match = matchChanges[matchIndex]; // Once we've hit our add, then we are done
1812
1813       if (match[0] === '+') {
1814         break;
1815       }
1816
1817       contextChanges = contextChanges || change[0] !== ' ';
1818       merged.push(match);
1819       matchIndex++; // Consume any additions in the other block as a conflict to attempt
1820       // to pull in the remaining context after this
1821
1822       if (change[0] === '+') {
1823         conflicted = true;
1824
1825         while (change[0] === '+') {
1826           changes.push(change);
1827           change = state.lines[++state.index];
1828         }
1829       }
1830
1831       if (match.substr(1) === change.substr(1)) {
1832         changes.push(change);
1833         state.index++;
1834       } else {
1835         conflicted = true;
1836       }
1837     }
1838
1839     if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
1840       conflicted = true;
1841     }
1842
1843     if (conflicted) {
1844       return changes;
1845     }
1846
1847     while (matchIndex < matchChanges.length) {
1848       merged.push(matchChanges[matchIndex++]);
1849     }
1850
1851     return {
1852       merged: merged,
1853       changes: changes
1854     };
1855   }
1856
1857   function allRemoves(changes) {
1858     return changes.reduce(function (prev, change) {
1859       return prev && change[0] === '-';
1860     }, true);
1861   }
1862
1863   function skipRemoveSuperset(state, removeChanges, delta) {
1864     for (var i = 0; i < delta; i++) {
1865       var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
1866
1867       if (state.lines[state.index + i] !== ' ' + changeContent) {
1868         return false;
1869       }
1870     }
1871
1872     state.index += delta;
1873     return true;
1874   }
1875
1876   function calcOldNewLineCount(lines) {
1877     var oldLines = 0;
1878     var newLines = 0;
1879     lines.forEach(function (line) {
1880       if (typeof line !== 'string') {
1881         var myCount = calcOldNewLineCount(line.mine);
1882         var theirCount = calcOldNewLineCount(line.theirs);
1883
1884         if (oldLines !== undefined) {
1885           if (myCount.oldLines === theirCount.oldLines) {
1886             oldLines += myCount.oldLines;
1887           } else {
1888             oldLines = undefined;
1889           }
1890         }
1891
1892         if (newLines !== undefined) {
1893           if (myCount.newLines === theirCount.newLines) {
1894             newLines += myCount.newLines;
1895           } else {
1896             newLines = undefined;
1897           }
1898         }
1899       } else {
1900         if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
1901           newLines++;
1902         }
1903
1904         if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
1905           oldLines++;
1906         }
1907       }
1908     });
1909     return {
1910       oldLines: oldLines,
1911       newLines: newLines
1912     };
1913   } // See: http://code.google.com/p/google-diff-match-patch/wiki/API
1914
1915
1916   function convertChangesToDMP(changes) {
1917     var ret = [],
1918         change,
1919         operation;
1920
1921     for (var i = 0; i < changes.length; i++) {
1922       change = changes[i];
1923
1924       if (change.added) {
1925         operation = 1;
1926       } else if (change.removed) {
1927         operation = -1;
1928       } else {
1929         operation = 0;
1930       }
1931
1932       ret.push([operation, change.value]);
1933     }
1934
1935     return ret;
1936   }
1937
1938   function convertChangesToXML(changes) {
1939     var ret = [];
1940
1941     for (var i = 0; i < changes.length; i++) {
1942       var change = changes[i];
1943
1944       if (change.added) {
1945         ret.push('<ins>');
1946       } else if (change.removed) {
1947         ret.push('<del>');
1948       }
1949
1950       ret.push(escapeHTML(change.value));
1951
1952       if (change.added) {
1953         ret.push('</ins>');
1954       } else if (change.removed) {
1955         ret.push('</del>');
1956       }
1957     }
1958
1959     return ret.join('');
1960   }
1961
1962   function escapeHTML(s) {
1963     var n = s;
1964     n = n.replace(/&/g, '&amp;');
1965     n = n.replace(/</g, '&lt;');
1966     n = n.replace(/>/g, '&gt;');
1967     n = n.replace(/"/g, '&quot;');
1968     return n;
1969   }
1970
1971   var index_es6 = /*#__PURE__*/Object.freeze({
1972     __proto__: null,
1973     Diff: Diff,
1974     diffChars: diffChars,
1975     diffWords: diffWords,
1976     diffWordsWithSpace: diffWordsWithSpace,
1977     diffLines: diffLines,
1978     diffTrimmedLines: diffTrimmedLines,
1979     diffSentences: diffSentences,
1980     diffCss: diffCss,
1981     diffJson: diffJson,
1982     diffArrays: diffArrays,
1983     structuredPatch: structuredPatch,
1984     createTwoFilesPatch: createTwoFilesPatch,
1985     createPatch: createPatch,
1986     applyPatch: applyPatch,
1987     applyPatches: applyPatches,
1988     parsePatch: parsePatch,
1989     merge: merge,
1990     convertChangesToDMP: convertChangesToDMP,
1991     convertChangesToXML: convertChangesToXML,
1992     canonicalize: canonicalize
1993   });
1994
1995   var _shim_fs = {};
1996
1997   var _shim_fs$1 = /*#__PURE__*/Object.freeze({
1998     __proto__: null,
1999     'default': _shim_fs
2000   });
2001
2002   /*!
2003    * normalize-path <https://github.com/jonschlinkert/normalize-path>
2004    *
2005    * Copyright (c) 2014-2018, Jon Schlinkert.
2006    * Released under the MIT License.
2007    */
2008   var normalizePath = function normalizePath(path, stripTrailing) {
2009     if (typeof path !== 'string') {
2010       throw new TypeError('expected path to be a string');
2011     }
2012
2013     if (path === '\\' || path === '/') return '/';
2014     var len = path.length;
2015     if (len <= 1) return path; // ensure that win32 namespaces has two leading slashes, so that the path is
2016     // handled properly by the win32 version of path.parse() after being normalized
2017     // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
2018
2019     var prefix = '';
2020
2021     if (len > 4 && path[3] === '\\') {
2022       var ch = path[2];
2023
2024       if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
2025         path = path.slice(2);
2026         prefix = '//';
2027       }
2028     }
2029
2030     var segs = path.split(/[/\\]+/);
2031
2032     if (stripTrailing !== false && segs[segs.length - 1] === '') {
2033       segs.pop();
2034     }
2035
2036     return prefix + segs.join('/');
2037   };
2038
2039   var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
2040
2041   var lookup = [];
2042   var revLookup = [];
2043   var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
2044   var inited = false;
2045
2046   function init() {
2047     inited = true;
2048     var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
2049
2050     for (var i = 0, len = code.length; i < len; ++i) {
2051       lookup[i] = code[i];
2052       revLookup[code.charCodeAt(i)] = i;
2053     }
2054
2055     revLookup['-'.charCodeAt(0)] = 62;
2056     revLookup['_'.charCodeAt(0)] = 63;
2057   }
2058
2059   function toByteArray(b64) {
2060     if (!inited) {
2061       init();
2062     }
2063
2064     var i, j, l, tmp, placeHolders, arr;
2065     var len = b64.length;
2066
2067     if (len % 4 > 0) {
2068       throw new Error('Invalid string. Length must be a multiple of 4');
2069     } // the number of equal signs (place holders)
2070     // if there are two placeholders, than the two characters before it
2071     // represent one byte
2072     // if there is only one, then the three characters before it represent 2 bytes
2073     // this is just a cheap hack to not do indexOf twice
2074
2075
2076     placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; // base64 is 4/3 + up to two characters of the original data
2077
2078     arr = new Arr(len * 3 / 4 - placeHolders); // if there are placeholders, only get up to the last complete 4 chars
2079
2080     l = placeHolders > 0 ? len - 4 : len;
2081     var L = 0;
2082
2083     for (i = 0, j = 0; i < l; i += 4, j += 3) {
2084       tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
2085       arr[L++] = tmp >> 16 & 0xFF;
2086       arr[L++] = tmp >> 8 & 0xFF;
2087       arr[L++] = tmp & 0xFF;
2088     }
2089
2090     if (placeHolders === 2) {
2091       tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
2092       arr[L++] = tmp & 0xFF;
2093     } else if (placeHolders === 1) {
2094       tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
2095       arr[L++] = tmp >> 8 & 0xFF;
2096       arr[L++] = tmp & 0xFF;
2097     }
2098
2099     return arr;
2100   }
2101
2102   function tripletToBase64(num) {
2103     return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F];
2104   }
2105
2106   function encodeChunk(uint8, start, end) {
2107     var tmp;
2108     var output = [];
2109
2110     for (var i = start; i < end; i += 3) {
2111       tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2];
2112       output.push(tripletToBase64(tmp));
2113     }
2114
2115     return output.join('');
2116   }
2117
2118   function fromByteArray(uint8) {
2119     if (!inited) {
2120       init();
2121     }
2122
2123     var tmp;
2124     var len = uint8.length;
2125     var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
2126
2127     var output = '';
2128     var parts = [];
2129     var maxChunkLength = 16383; // must be multiple of 3
2130     // go through the array every three bytes, we'll deal with trailing stuff later
2131
2132     for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
2133       parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
2134     } // pad the end with zeros, but make sure to not forget the extra bytes
2135
2136
2137     if (extraBytes === 1) {
2138       tmp = uint8[len - 1];
2139       output += lookup[tmp >> 2];
2140       output += lookup[tmp << 4 & 0x3F];
2141       output += '==';
2142     } else if (extraBytes === 2) {
2143       tmp = (uint8[len - 2] << 8) + uint8[len - 1];
2144       output += lookup[tmp >> 10];
2145       output += lookup[tmp >> 4 & 0x3F];
2146       output += lookup[tmp << 2 & 0x3F];
2147       output += '=';
2148     }
2149
2150     parts.push(output);
2151     return parts.join('');
2152   }
2153
2154   function read(buffer, offset, isLE, mLen, nBytes) {
2155     var e, m;
2156     var eLen = nBytes * 8 - mLen - 1;
2157     var eMax = (1 << eLen) - 1;
2158     var eBias = eMax >> 1;
2159     var nBits = -7;
2160     var i = isLE ? nBytes - 1 : 0;
2161     var d = isLE ? -1 : 1;
2162     var s = buffer[offset + i];
2163     i += d;
2164     e = s & (1 << -nBits) - 1;
2165     s >>= -nBits;
2166     nBits += eLen;
2167
2168     for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
2169
2170     m = e & (1 << -nBits) - 1;
2171     e >>= -nBits;
2172     nBits += mLen;
2173
2174     for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
2175
2176     if (e === 0) {
2177       e = 1 - eBias;
2178     } else if (e === eMax) {
2179       return m ? NaN : (s ? -1 : 1) * Infinity;
2180     } else {
2181       m = m + Math.pow(2, mLen);
2182       e = e - eBias;
2183     }
2184
2185     return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
2186   }
2187   function write(buffer, value, offset, isLE, mLen, nBytes) {
2188     var e, m, c;
2189     var eLen = nBytes * 8 - mLen - 1;
2190     var eMax = (1 << eLen) - 1;
2191     var eBias = eMax >> 1;
2192     var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
2193     var i = isLE ? 0 : nBytes - 1;
2194     var d = isLE ? 1 : -1;
2195     var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
2196     value = Math.abs(value);
2197
2198     if (isNaN(value) || value === Infinity) {
2199       m = isNaN(value) ? 1 : 0;
2200       e = eMax;
2201     } else {
2202       e = Math.floor(Math.log(value) / Math.LN2);
2203
2204       if (value * (c = Math.pow(2, -e)) < 1) {
2205         e--;
2206         c *= 2;
2207       }
2208
2209       if (e + eBias >= 1) {
2210         value += rt / c;
2211       } else {
2212         value += rt * Math.pow(2, 1 - eBias);
2213       }
2214
2215       if (value * c >= 2) {
2216         e++;
2217         c /= 2;
2218       }
2219
2220       if (e + eBias >= eMax) {
2221         m = 0;
2222         e = eMax;
2223       } else if (e + eBias >= 1) {
2224         m = (value * c - 1) * Math.pow(2, mLen);
2225         e = e + eBias;
2226       } else {
2227         m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
2228         e = 0;
2229       }
2230     }
2231
2232     for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
2233
2234     e = e << mLen | m;
2235     eLen += mLen;
2236
2237     for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
2238
2239     buffer[offset + i - d] |= s * 128;
2240   }
2241
2242   var toString = {}.toString;
2243   var isArray = Array.isArray || function (arr) {
2244     return toString.call(arr) == '[object Array]';
2245   };
2246
2247   var INSPECT_MAX_BYTES = 50;
2248   /**
2249    * If `Buffer.TYPED_ARRAY_SUPPORT`:
2250    *   === true    Use Uint8Array implementation (fastest)
2251    *   === false   Use Object implementation (most compatible, even IE6)
2252    *
2253    * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
2254    * Opera 11.6+, iOS 4.2+.
2255    *
2256    * Due to various browser bugs, sometimes the Object implementation will be used even
2257    * when the browser supports typed arrays.
2258    *
2259    * Note:
2260    *
2261    *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
2262    *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
2263    *
2264    *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
2265    *
2266    *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
2267    *     incorrect length in some situations.
2268
2269    * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
2270    * get the Object implementation, which is slower but behaves correctly.
2271    */
2272
2273   Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined ? global$1.TYPED_ARRAY_SUPPORT : true;
2274
2275   function kMaxLength() {
2276     return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff;
2277   }
2278
2279   function createBuffer(that, length) {
2280     if (kMaxLength() < length) {
2281       throw new RangeError('Invalid typed array length');
2282     }
2283
2284     if (Buffer.TYPED_ARRAY_SUPPORT) {
2285       // Return an augmented `Uint8Array` instance, for best performance
2286       that = new Uint8Array(length);
2287       that.__proto__ = Buffer.prototype;
2288     } else {
2289       // Fallback: Return an object instance of the Buffer class
2290       if (that === null) {
2291         that = new Buffer(length);
2292       }
2293
2294       that.length = length;
2295     }
2296
2297     return that;
2298   }
2299   /**
2300    * The Buffer constructor returns instances of `Uint8Array` that have their
2301    * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
2302    * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
2303    * and the `Uint8Array` methods. Square bracket notation works as expected -- it
2304    * returns a single octet.
2305    *
2306    * The `Uint8Array` prototype remains unmodified.
2307    */
2308
2309
2310   function Buffer(arg, encodingOrOffset, length) {
2311     if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
2312       return new Buffer(arg, encodingOrOffset, length);
2313     } // Common case.
2314
2315
2316     if (typeof arg === 'number') {
2317       if (typeof encodingOrOffset === 'string') {
2318         throw new Error('If encoding is specified then the first argument must be a string');
2319       }
2320
2321       return allocUnsafe(this, arg);
2322     }
2323
2324     return from(this, arg, encodingOrOffset, length);
2325   }
2326   Buffer.poolSize = 8192; // not used by this implementation
2327   // TODO: Legacy, not needed anymore. Remove in next major version.
2328
2329   Buffer._augment = function (arr) {
2330     arr.__proto__ = Buffer.prototype;
2331     return arr;
2332   };
2333
2334   function from(that, value, encodingOrOffset, length) {
2335     if (typeof value === 'number') {
2336       throw new TypeError('"value" argument must not be a number');
2337     }
2338
2339     if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
2340       return fromArrayBuffer(that, value, encodingOrOffset, length);
2341     }
2342
2343     if (typeof value === 'string') {
2344       return fromString(that, value, encodingOrOffset);
2345     }
2346
2347     return fromObject(that, value);
2348   }
2349   /**
2350    * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
2351    * if value is a number.
2352    * Buffer.from(str[, encoding])
2353    * Buffer.from(array)
2354    * Buffer.from(buffer)
2355    * Buffer.from(arrayBuffer[, byteOffset[, length]])
2356    **/
2357
2358
2359   Buffer.from = function (value, encodingOrOffset, length) {
2360     return from(null, value, encodingOrOffset, length);
2361   };
2362
2363   if (Buffer.TYPED_ARRAY_SUPPORT) {
2364     Buffer.prototype.__proto__ = Uint8Array.prototype;
2365     Buffer.__proto__ = Uint8Array;
2366   }
2367
2368   function assertSize(size) {
2369     if (typeof size !== 'number') {
2370       throw new TypeError('"size" argument must be a number');
2371     } else if (size < 0) {
2372       throw new RangeError('"size" argument must not be negative');
2373     }
2374   }
2375
2376   function alloc(that, size, fill, encoding) {
2377     assertSize(size);
2378
2379     if (size <= 0) {
2380       return createBuffer(that, size);
2381     }
2382
2383     if (fill !== undefined) {
2384       // Only pay attention to encoding if it's a string. This
2385       // prevents accidentally sending in a number that would
2386       // be interpretted as a start offset.
2387       return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill);
2388     }
2389
2390     return createBuffer(that, size);
2391   }
2392   /**
2393    * Creates a new filled Buffer instance.
2394    * alloc(size[, fill[, encoding]])
2395    **/
2396
2397
2398   Buffer.alloc = function (size, fill, encoding) {
2399     return alloc(null, size, fill, encoding);
2400   };
2401
2402   function allocUnsafe(that, size) {
2403     assertSize(size);
2404     that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
2405
2406     if (!Buffer.TYPED_ARRAY_SUPPORT) {
2407       for (var i = 0; i < size; ++i) {
2408         that[i] = 0;
2409       }
2410     }
2411
2412     return that;
2413   }
2414   /**
2415    * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
2416    * */
2417
2418
2419   Buffer.allocUnsafe = function (size) {
2420     return allocUnsafe(null, size);
2421   };
2422   /**
2423    * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
2424    */
2425
2426
2427   Buffer.allocUnsafeSlow = function (size) {
2428     return allocUnsafe(null, size);
2429   };
2430
2431   function fromString(that, string, encoding) {
2432     if (typeof encoding !== 'string' || encoding === '') {
2433       encoding = 'utf8';
2434     }
2435
2436     if (!Buffer.isEncoding(encoding)) {
2437       throw new TypeError('"encoding" must be a valid string encoding');
2438     }
2439
2440     var length = byteLength(string, encoding) | 0;
2441     that = createBuffer(that, length);
2442     var actual = that.write(string, encoding);
2443
2444     if (actual !== length) {
2445       // Writing a hex string, for example, that contains invalid characters will
2446       // cause everything after the first invalid character to be ignored. (e.g.
2447       // 'abxxcd' will be treated as 'ab')
2448       that = that.slice(0, actual);
2449     }
2450
2451     return that;
2452   }
2453
2454   function fromArrayLike(that, array) {
2455     var length = array.length < 0 ? 0 : checked(array.length) | 0;
2456     that = createBuffer(that, length);
2457
2458     for (var i = 0; i < length; i += 1) {
2459       that[i] = array[i] & 255;
2460     }
2461
2462     return that;
2463   }
2464
2465   function fromArrayBuffer(that, array, byteOffset, length) {
2466     array.byteLength; // this throws if `array` is not a valid ArrayBuffer
2467
2468     if (byteOffset < 0 || array.byteLength < byteOffset) {
2469       throw new RangeError('\'offset\' is out of bounds');
2470     }
2471
2472     if (array.byteLength < byteOffset + (length || 0)) {
2473       throw new RangeError('\'length\' is out of bounds');
2474     }
2475
2476     if (byteOffset === undefined && length === undefined) {
2477       array = new Uint8Array(array);
2478     } else if (length === undefined) {
2479       array = new Uint8Array(array, byteOffset);
2480     } else {
2481       array = new Uint8Array(array, byteOffset, length);
2482     }
2483
2484     if (Buffer.TYPED_ARRAY_SUPPORT) {
2485       // Return an augmented `Uint8Array` instance, for best performance
2486       that = array;
2487       that.__proto__ = Buffer.prototype;
2488     } else {
2489       // Fallback: Return an object instance of the Buffer class
2490       that = fromArrayLike(that, array);
2491     }
2492
2493     return that;
2494   }
2495
2496   function fromObject(that, obj) {
2497     if (internalIsBuffer(obj)) {
2498       var len = checked(obj.length) | 0;
2499       that = createBuffer(that, len);
2500
2501       if (that.length === 0) {
2502         return that;
2503       }
2504
2505       obj.copy(that, 0, 0, len);
2506       return that;
2507     }
2508
2509     if (obj) {
2510       if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) {
2511         if (typeof obj.length !== 'number' || isnan(obj.length)) {
2512           return createBuffer(that, 0);
2513         }
2514
2515         return fromArrayLike(that, obj);
2516       }
2517
2518       if (obj.type === 'Buffer' && isArray(obj.data)) {
2519         return fromArrayLike(that, obj.data);
2520       }
2521     }
2522
2523     throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.');
2524   }
2525
2526   function checked(length) {
2527     // Note: cannot use `length < kMaxLength()` here because that fails when
2528     // length is NaN (which is otherwise coerced to zero.)
2529     if (length >= kMaxLength()) {
2530       throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes');
2531     }
2532
2533     return length | 0;
2534   }
2535   Buffer.isBuffer = isBuffer;
2536
2537   function internalIsBuffer(b) {
2538     return !!(b != null && b._isBuffer);
2539   }
2540
2541   Buffer.compare = function compare(a, b) {
2542     if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
2543       throw new TypeError('Arguments must be Buffers');
2544     }
2545
2546     if (a === b) return 0;
2547     var x = a.length;
2548     var y = b.length;
2549
2550     for (var i = 0, len = Math.min(x, y); i < len; ++i) {
2551       if (a[i] !== b[i]) {
2552         x = a[i];
2553         y = b[i];
2554         break;
2555       }
2556     }
2557
2558     if (x < y) return -1;
2559     if (y < x) return 1;
2560     return 0;
2561   };
2562
2563   Buffer.isEncoding = function isEncoding(encoding) {
2564     switch (String(encoding).toLowerCase()) {
2565       case 'hex':
2566       case 'utf8':
2567       case 'utf-8':
2568       case 'ascii':
2569       case 'latin1':
2570       case 'binary':
2571       case 'base64':
2572       case 'ucs2':
2573       case 'ucs-2':
2574       case 'utf16le':
2575       case 'utf-16le':
2576         return true;
2577
2578       default:
2579         return false;
2580     }
2581   };
2582
2583   Buffer.concat = function concat(list, length) {
2584     if (!isArray(list)) {
2585       throw new TypeError('"list" argument must be an Array of Buffers');
2586     }
2587
2588     if (list.length === 0) {
2589       return Buffer.alloc(0);
2590     }
2591
2592     var i;
2593
2594     if (length === undefined) {
2595       length = 0;
2596
2597       for (i = 0; i < list.length; ++i) {
2598         length += list[i].length;
2599       }
2600     }
2601
2602     var buffer = Buffer.allocUnsafe(length);
2603     var pos = 0;
2604
2605     for (i = 0; i < list.length; ++i) {
2606       var buf = list[i];
2607
2608       if (!internalIsBuffer(buf)) {
2609         throw new TypeError('"list" argument must be an Array of Buffers');
2610       }
2611
2612       buf.copy(buffer, pos);
2613       pos += buf.length;
2614     }
2615
2616     return buffer;
2617   };
2618
2619   function byteLength(string, encoding) {
2620     if (internalIsBuffer(string)) {
2621       return string.length;
2622     }
2623
2624     if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
2625       return string.byteLength;
2626     }
2627
2628     if (typeof string !== 'string') {
2629       string = '' + string;
2630     }
2631
2632     var len = string.length;
2633     if (len === 0) return 0; // Use a for loop to avoid recursion
2634
2635     var loweredCase = false;
2636
2637     for (;;) {
2638       switch (encoding) {
2639         case 'ascii':
2640         case 'latin1':
2641         case 'binary':
2642           return len;
2643
2644         case 'utf8':
2645         case 'utf-8':
2646         case undefined:
2647           return utf8ToBytes(string).length;
2648
2649         case 'ucs2':
2650         case 'ucs-2':
2651         case 'utf16le':
2652         case 'utf-16le':
2653           return len * 2;
2654
2655         case 'hex':
2656           return len >>> 1;
2657
2658         case 'base64':
2659           return base64ToBytes(string).length;
2660
2661         default:
2662           if (loweredCase) return utf8ToBytes(string).length; // assume utf8
2663
2664           encoding = ('' + encoding).toLowerCase();
2665           loweredCase = true;
2666       }
2667     }
2668   }
2669
2670   Buffer.byteLength = byteLength;
2671
2672   function slowToString(encoding, start, end) {
2673     var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
2674     // property of a typed array.
2675     // This behaves neither like String nor Uint8Array in that we set start/end
2676     // to their upper/lower bounds if the value passed is out of range.
2677     // undefined is handled specially as per ECMA-262 6th Edition,
2678     // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
2679
2680     if (start === undefined || start < 0) {
2681       start = 0;
2682     } // Return early if start > this.length. Done here to prevent potential uint32
2683     // coercion fail below.
2684
2685
2686     if (start > this.length) {
2687       return '';
2688     }
2689
2690     if (end === undefined || end > this.length) {
2691       end = this.length;
2692     }
2693
2694     if (end <= 0) {
2695       return '';
2696     } // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
2697
2698
2699     end >>>= 0;
2700     start >>>= 0;
2701
2702     if (end <= start) {
2703       return '';
2704     }
2705
2706     if (!encoding) encoding = 'utf8';
2707
2708     while (true) {
2709       switch (encoding) {
2710         case 'hex':
2711           return hexSlice(this, start, end);
2712
2713         case 'utf8':
2714         case 'utf-8':
2715           return utf8Slice(this, start, end);
2716
2717         case 'ascii':
2718           return asciiSlice(this, start, end);
2719
2720         case 'latin1':
2721         case 'binary':
2722           return latin1Slice(this, start, end);
2723
2724         case 'base64':
2725           return base64Slice(this, start, end);
2726
2727         case 'ucs2':
2728         case 'ucs-2':
2729         case 'utf16le':
2730         case 'utf-16le':
2731           return utf16leSlice(this, start, end);
2732
2733         default:
2734           if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
2735           encoding = (encoding + '').toLowerCase();
2736           loweredCase = true;
2737       }
2738     }
2739   } // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
2740   // Buffer instances.
2741
2742
2743   Buffer.prototype._isBuffer = true;
2744
2745   function swap(b, n, m) {
2746     var i = b[n];
2747     b[n] = b[m];
2748     b[m] = i;
2749   }
2750
2751   Buffer.prototype.swap16 = function swap16() {
2752     var len = this.length;
2753
2754     if (len % 2 !== 0) {
2755       throw new RangeError('Buffer size must be a multiple of 16-bits');
2756     }
2757
2758     for (var i = 0; i < len; i += 2) {
2759       swap(this, i, i + 1);
2760     }
2761
2762     return this;
2763   };
2764
2765   Buffer.prototype.swap32 = function swap32() {
2766     var len = this.length;
2767
2768     if (len % 4 !== 0) {
2769       throw new RangeError('Buffer size must be a multiple of 32-bits');
2770     }
2771
2772     for (var i = 0; i < len; i += 4) {
2773       swap(this, i, i + 3);
2774       swap(this, i + 1, i + 2);
2775     }
2776
2777     return this;
2778   };
2779
2780   Buffer.prototype.swap64 = function swap64() {
2781     var len = this.length;
2782
2783     if (len % 8 !== 0) {
2784       throw new RangeError('Buffer size must be a multiple of 64-bits');
2785     }
2786
2787     for (var i = 0; i < len; i += 8) {
2788       swap(this, i, i + 7);
2789       swap(this, i + 1, i + 6);
2790       swap(this, i + 2, i + 5);
2791       swap(this, i + 3, i + 4);
2792     }
2793
2794     return this;
2795   };
2796
2797   Buffer.prototype.toString = function toString() {
2798     var length = this.length | 0;
2799     if (length === 0) return '';
2800     if (arguments.length === 0) return utf8Slice(this, 0, length);
2801     return slowToString.apply(this, arguments);
2802   };
2803
2804   Buffer.prototype.equals = function equals(b) {
2805     if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer');
2806     if (this === b) return true;
2807     return Buffer.compare(this, b) === 0;
2808   };
2809
2810   Buffer.prototype.inspect = function inspect() {
2811     var str = '';
2812     var max = INSPECT_MAX_BYTES;
2813
2814     if (this.length > 0) {
2815       str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
2816       if (this.length > max) str += ' ... ';
2817     }
2818
2819     return '<Buffer ' + str + '>';
2820   };
2821
2822   Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
2823     if (!internalIsBuffer(target)) {
2824       throw new TypeError('Argument must be a Buffer');
2825     }
2826
2827     if (start === undefined) {
2828       start = 0;
2829     }
2830
2831     if (end === undefined) {
2832       end = target ? target.length : 0;
2833     }
2834
2835     if (thisStart === undefined) {
2836       thisStart = 0;
2837     }
2838
2839     if (thisEnd === undefined) {
2840       thisEnd = this.length;
2841     }
2842
2843     if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
2844       throw new RangeError('out of range index');
2845     }
2846
2847     if (thisStart >= thisEnd && start >= end) {
2848       return 0;
2849     }
2850
2851     if (thisStart >= thisEnd) {
2852       return -1;
2853     }
2854
2855     if (start >= end) {
2856       return 1;
2857     }
2858
2859     start >>>= 0;
2860     end >>>= 0;
2861     thisStart >>>= 0;
2862     thisEnd >>>= 0;
2863     if (this === target) return 0;
2864     var x = thisEnd - thisStart;
2865     var y = end - start;
2866     var len = Math.min(x, y);
2867     var thisCopy = this.slice(thisStart, thisEnd);
2868     var targetCopy = target.slice(start, end);
2869
2870     for (var i = 0; i < len; ++i) {
2871       if (thisCopy[i] !== targetCopy[i]) {
2872         x = thisCopy[i];
2873         y = targetCopy[i];
2874         break;
2875       }
2876     }
2877
2878     if (x < y) return -1;
2879     if (y < x) return 1;
2880     return 0;
2881   }; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
2882   // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
2883   //
2884   // Arguments:
2885   // - buffer - a Buffer to search
2886   // - val - a string, Buffer, or number
2887   // - byteOffset - an index into `buffer`; will be clamped to an int32
2888   // - encoding - an optional encoding, relevant is val is a string
2889   // - dir - true for indexOf, false for lastIndexOf
2890
2891
2892   function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
2893     // Empty buffer means no match
2894     if (buffer.length === 0) return -1; // Normalize byteOffset
2895
2896     if (typeof byteOffset === 'string') {
2897       encoding = byteOffset;
2898       byteOffset = 0;
2899     } else if (byteOffset > 0x7fffffff) {
2900       byteOffset = 0x7fffffff;
2901     } else if (byteOffset < -0x80000000) {
2902       byteOffset = -0x80000000;
2903     }
2904
2905     byteOffset = +byteOffset; // Coerce to Number.
2906
2907     if (isNaN(byteOffset)) {
2908       // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
2909       byteOffset = dir ? 0 : buffer.length - 1;
2910     } // Normalize byteOffset: negative offsets start from the end of the buffer
2911
2912
2913     if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
2914
2915     if (byteOffset >= buffer.length) {
2916       if (dir) return -1;else byteOffset = buffer.length - 1;
2917     } else if (byteOffset < 0) {
2918       if (dir) byteOffset = 0;else return -1;
2919     } // Normalize val
2920
2921
2922     if (typeof val === 'string') {
2923       val = Buffer.from(val, encoding);
2924     } // Finally, search either indexOf (if dir is true) or lastIndexOf
2925
2926
2927     if (internalIsBuffer(val)) {
2928       // Special case: looking for empty string/buffer always fails
2929       if (val.length === 0) {
2930         return -1;
2931       }
2932
2933       return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
2934     } else if (typeof val === 'number') {
2935       val = val & 0xFF; // Search for a byte value [0-255]
2936
2937       if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') {
2938         if (dir) {
2939           return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
2940         } else {
2941           return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
2942         }
2943       }
2944
2945       return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
2946     }
2947
2948     throw new TypeError('val must be string, number or Buffer');
2949   }
2950
2951   function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
2952     var indexSize = 1;
2953     var arrLength = arr.length;
2954     var valLength = val.length;
2955
2956     if (encoding !== undefined) {
2957       encoding = String(encoding).toLowerCase();
2958
2959       if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') {
2960         if (arr.length < 2 || val.length < 2) {
2961           return -1;
2962         }
2963
2964         indexSize = 2;
2965         arrLength /= 2;
2966         valLength /= 2;
2967         byteOffset /= 2;
2968       }
2969     }
2970
2971     function read(buf, i) {
2972       if (indexSize === 1) {
2973         return buf[i];
2974       } else {
2975         return buf.readUInt16BE(i * indexSize);
2976       }
2977     }
2978
2979     var i;
2980
2981     if (dir) {
2982       var foundIndex = -1;
2983
2984       for (i = byteOffset; i < arrLength; i++) {
2985         if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
2986           if (foundIndex === -1) foundIndex = i;
2987           if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
2988         } else {
2989           if (foundIndex !== -1) i -= i - foundIndex;
2990           foundIndex = -1;
2991         }
2992       }
2993     } else {
2994       if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
2995
2996       for (i = byteOffset; i >= 0; i--) {
2997         var found = true;
2998
2999         for (var j = 0; j < valLength; j++) {
3000           if (read(arr, i + j) !== read(val, j)) {
3001             found = false;
3002             break;
3003           }
3004         }
3005
3006         if (found) return i;
3007       }
3008     }
3009
3010     return -1;
3011   }
3012
3013   Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
3014     return this.indexOf(val, byteOffset, encoding) !== -1;
3015   };
3016
3017   Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
3018     return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
3019   };
3020
3021   Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
3022     return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
3023   };
3024
3025   function hexWrite(buf, string, offset, length) {
3026     offset = Number(offset) || 0;
3027     var remaining = buf.length - offset;
3028
3029     if (!length) {
3030       length = remaining;
3031     } else {
3032       length = Number(length);
3033
3034       if (length > remaining) {
3035         length = remaining;
3036       }
3037     } // must be an even number of digits
3038
3039
3040     var strLen = string.length;
3041     if (strLen % 2 !== 0) throw new TypeError('Invalid hex string');
3042
3043     if (length > strLen / 2) {
3044       length = strLen / 2;
3045     }
3046
3047     for (var i = 0; i < length; ++i) {
3048       var parsed = parseInt(string.substr(i * 2, 2), 16);
3049       if (isNaN(parsed)) return i;
3050       buf[offset + i] = parsed;
3051     }
3052
3053     return i;
3054   }
3055
3056   function utf8Write(buf, string, offset, length) {
3057     return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
3058   }
3059
3060   function asciiWrite(buf, string, offset, length) {
3061     return blitBuffer(asciiToBytes(string), buf, offset, length);
3062   }
3063
3064   function latin1Write(buf, string, offset, length) {
3065     return asciiWrite(buf, string, offset, length);
3066   }
3067
3068   function base64Write(buf, string, offset, length) {
3069     return blitBuffer(base64ToBytes(string), buf, offset, length);
3070   }
3071
3072   function ucs2Write(buf, string, offset, length) {
3073     return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
3074   }
3075
3076   Buffer.prototype.write = function write(string, offset, length, encoding) {
3077     // Buffer#write(string)
3078     if (offset === undefined) {
3079       encoding = 'utf8';
3080       length = this.length;
3081       offset = 0; // Buffer#write(string, encoding)
3082     } else if (length === undefined && typeof offset === 'string') {
3083       encoding = offset;
3084       length = this.length;
3085       offset = 0; // Buffer#write(string, offset[, length][, encoding])
3086     } else if (isFinite(offset)) {
3087       offset = offset | 0;
3088
3089       if (isFinite(length)) {
3090         length = length | 0;
3091         if (encoding === undefined) encoding = 'utf8';
3092       } else {
3093         encoding = length;
3094         length = undefined;
3095       } // legacy write(string, encoding, offset, length) - remove in v0.13
3096
3097     } else {
3098       throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');
3099     }
3100
3101     var remaining = this.length - offset;
3102     if (length === undefined || length > remaining) length = remaining;
3103
3104     if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
3105       throw new RangeError('Attempt to write outside buffer bounds');
3106     }
3107
3108     if (!encoding) encoding = 'utf8';
3109     var loweredCase = false;
3110
3111     for (;;) {
3112       switch (encoding) {
3113         case 'hex':
3114           return hexWrite(this, string, offset, length);
3115
3116         case 'utf8':
3117         case 'utf-8':
3118           return utf8Write(this, string, offset, length);
3119
3120         case 'ascii':
3121           return asciiWrite(this, string, offset, length);
3122
3123         case 'latin1':
3124         case 'binary':
3125           return latin1Write(this, string, offset, length);
3126
3127         case 'base64':
3128           // Warning: maxLength not taken into account in base64Write
3129           return base64Write(this, string, offset, length);
3130
3131         case 'ucs2':
3132         case 'ucs-2':
3133         case 'utf16le':
3134         case 'utf-16le':
3135           return ucs2Write(this, string, offset, length);
3136
3137         default:
3138           if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding);
3139           encoding = ('' + encoding).toLowerCase();
3140           loweredCase = true;
3141       }
3142     }
3143   };
3144
3145   Buffer.prototype.toJSON = function toJSON() {
3146     return {
3147       type: 'Buffer',
3148       data: Array.prototype.slice.call(this._arr || this, 0)
3149     };
3150   };
3151
3152   function base64Slice(buf, start, end) {
3153     if (start === 0 && end === buf.length) {
3154       return fromByteArray(buf);
3155     } else {
3156       return fromByteArray(buf.slice(start, end));
3157     }
3158   }
3159
3160   function utf8Slice(buf, start, end) {
3161     end = Math.min(buf.length, end);
3162     var res = [];
3163     var i = start;
3164
3165     while (i < end) {
3166       var firstByte = buf[i];
3167       var codePoint = null;
3168       var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1;
3169
3170       if (i + bytesPerSequence <= end) {
3171         var secondByte, thirdByte, fourthByte, tempCodePoint;
3172
3173         switch (bytesPerSequence) {
3174           case 1:
3175             if (firstByte < 0x80) {
3176               codePoint = firstByte;
3177             }
3178
3179             break;
3180
3181           case 2:
3182             secondByte = buf[i + 1];
3183
3184             if ((secondByte & 0xC0) === 0x80) {
3185               tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F;
3186
3187               if (tempCodePoint > 0x7F) {
3188                 codePoint = tempCodePoint;
3189               }
3190             }
3191
3192             break;
3193
3194           case 3:
3195             secondByte = buf[i + 1];
3196             thirdByte = buf[i + 2];
3197
3198             if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
3199               tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F;
3200
3201               if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
3202                 codePoint = tempCodePoint;
3203               }
3204             }
3205
3206             break;
3207
3208           case 4:
3209             secondByte = buf[i + 1];
3210             thirdByte = buf[i + 2];
3211             fourthByte = buf[i + 3];
3212
3213             if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
3214               tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F;
3215
3216               if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
3217                 codePoint = tempCodePoint;
3218               }
3219             }
3220
3221         }
3222       }
3223
3224       if (codePoint === null) {
3225         // we did not generate a valid codePoint so insert a
3226         // replacement char (U+FFFD) and advance only 1 byte
3227         codePoint = 0xFFFD;
3228         bytesPerSequence = 1;
3229       } else if (codePoint > 0xFFFF) {
3230         // encode to utf16 (surrogate pair dance)
3231         codePoint -= 0x10000;
3232         res.push(codePoint >>> 10 & 0x3FF | 0xD800);
3233         codePoint = 0xDC00 | codePoint & 0x3FF;
3234       }
3235
3236       res.push(codePoint);
3237       i += bytesPerSequence;
3238     }
3239
3240     return decodeCodePointsArray(res);
3241   } // Based on http://stackoverflow.com/a/22747272/680742, the browser with
3242   // the lowest limit is Chrome, with 0x10000 args.
3243   // We go 1 magnitude less, for safety
3244
3245
3246   var MAX_ARGUMENTS_LENGTH = 0x1000;
3247
3248   function decodeCodePointsArray(codePoints) {
3249     var len = codePoints.length;
3250
3251     if (len <= MAX_ARGUMENTS_LENGTH) {
3252       return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
3253     } // Decode in chunks to avoid "call stack size exceeded".
3254
3255
3256     var res = '';
3257     var i = 0;
3258
3259     while (i < len) {
3260       res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
3261     }
3262
3263     return res;
3264   }
3265
3266   function asciiSlice(buf, start, end) {
3267     var ret = '';
3268     end = Math.min(buf.length, end);
3269
3270     for (var i = start; i < end; ++i) {
3271       ret += String.fromCharCode(buf[i] & 0x7F);
3272     }
3273
3274     return ret;
3275   }
3276
3277   function latin1Slice(buf, start, end) {
3278     var ret = '';
3279     end = Math.min(buf.length, end);
3280
3281     for (var i = start; i < end; ++i) {
3282       ret += String.fromCharCode(buf[i]);
3283     }
3284
3285     return ret;
3286   }
3287
3288   function hexSlice(buf, start, end) {
3289     var len = buf.length;
3290     if (!start || start < 0) start = 0;
3291     if (!end || end < 0 || end > len) end = len;
3292     var out = '';
3293
3294     for (var i = start; i < end; ++i) {
3295       out += toHex(buf[i]);
3296     }
3297
3298     return out;
3299   }
3300
3301   function utf16leSlice(buf, start, end) {
3302     var bytes = buf.slice(start, end);
3303     var res = '';
3304
3305     for (var i = 0; i < bytes.length; i += 2) {
3306       res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
3307     }
3308
3309     return res;
3310   }
3311
3312   Buffer.prototype.slice = function slice(start, end) {
3313     var len = this.length;
3314     start = ~~start;
3315     end = end === undefined ? len : ~~end;
3316
3317     if (start < 0) {
3318       start += len;
3319       if (start < 0) start = 0;
3320     } else if (start > len) {
3321       start = len;
3322     }
3323
3324     if (end < 0) {
3325       end += len;
3326       if (end < 0) end = 0;
3327     } else if (end > len) {
3328       end = len;
3329     }
3330
3331     if (end < start) end = start;
3332     var newBuf;
3333
3334     if (Buffer.TYPED_ARRAY_SUPPORT) {
3335       newBuf = this.subarray(start, end);
3336       newBuf.__proto__ = Buffer.prototype;
3337     } else {
3338       var sliceLen = end - start;
3339       newBuf = new Buffer(sliceLen, undefined);
3340
3341       for (var i = 0; i < sliceLen; ++i) {
3342         newBuf[i] = this[i + start];
3343       }
3344     }
3345
3346     return newBuf;
3347   };
3348   /*
3349    * Need to make sure that buffer isn't trying to write out of bounds.
3350    */
3351
3352
3353   function checkOffset(offset, ext, length) {
3354     if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint');
3355     if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length');
3356   }
3357
3358   Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
3359     offset = offset | 0;
3360     byteLength = byteLength | 0;
3361     if (!noAssert) checkOffset(offset, byteLength, this.length);
3362     var val = this[offset];
3363     var mul = 1;
3364     var i = 0;
3365
3366     while (++i < byteLength && (mul *= 0x100)) {
3367       val += this[offset + i] * mul;
3368     }
3369
3370     return val;
3371   };
3372
3373   Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
3374     offset = offset | 0;
3375     byteLength = byteLength | 0;
3376
3377     if (!noAssert) {
3378       checkOffset(offset, byteLength, this.length);
3379     }
3380
3381     var val = this[offset + --byteLength];
3382     var mul = 1;
3383
3384     while (byteLength > 0 && (mul *= 0x100)) {
3385       val += this[offset + --byteLength] * mul;
3386     }
3387
3388     return val;
3389   };
3390
3391   Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
3392     if (!noAssert) checkOffset(offset, 1, this.length);
3393     return this[offset];
3394   };
3395
3396   Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
3397     if (!noAssert) checkOffset(offset, 2, this.length);
3398     return this[offset] | this[offset + 1] << 8;
3399   };
3400
3401   Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
3402     if (!noAssert) checkOffset(offset, 2, this.length);
3403     return this[offset] << 8 | this[offset + 1];
3404   };
3405
3406   Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
3407     if (!noAssert) checkOffset(offset, 4, this.length);
3408     return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000;
3409   };
3410
3411   Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
3412     if (!noAssert) checkOffset(offset, 4, this.length);
3413     return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
3414   };
3415
3416   Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
3417     offset = offset | 0;
3418     byteLength = byteLength | 0;
3419     if (!noAssert) checkOffset(offset, byteLength, this.length);
3420     var val = this[offset];
3421     var mul = 1;
3422     var i = 0;
3423
3424     while (++i < byteLength && (mul *= 0x100)) {
3425       val += this[offset + i] * mul;
3426     }
3427
3428     mul *= 0x80;
3429     if (val >= mul) val -= Math.pow(2, 8 * byteLength);
3430     return val;
3431   };
3432
3433   Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
3434     offset = offset | 0;
3435     byteLength = byteLength | 0;
3436     if (!noAssert) checkOffset(offset, byteLength, this.length);
3437     var i = byteLength;
3438     var mul = 1;
3439     var val = this[offset + --i];
3440
3441     while (i > 0 && (mul *= 0x100)) {
3442       val += this[offset + --i] * mul;
3443     }
3444
3445     mul *= 0x80;
3446     if (val >= mul) val -= Math.pow(2, 8 * byteLength);
3447     return val;
3448   };
3449
3450   Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
3451     if (!noAssert) checkOffset(offset, 1, this.length);
3452     if (!(this[offset] & 0x80)) return this[offset];
3453     return (0xff - this[offset] + 1) * -1;
3454   };
3455
3456   Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
3457     if (!noAssert) checkOffset(offset, 2, this.length);
3458     var val = this[offset] | this[offset + 1] << 8;
3459     return val & 0x8000 ? val | 0xFFFF0000 : val;
3460   };
3461
3462   Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
3463     if (!noAssert) checkOffset(offset, 2, this.length);
3464     var val = this[offset + 1] | this[offset] << 8;
3465     return val & 0x8000 ? val | 0xFFFF0000 : val;
3466   };
3467
3468   Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
3469     if (!noAssert) checkOffset(offset, 4, this.length);
3470     return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
3471   };
3472
3473   Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
3474     if (!noAssert) checkOffset(offset, 4, this.length);
3475     return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
3476   };
3477
3478   Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
3479     if (!noAssert) checkOffset(offset, 4, this.length);
3480     return read(this, offset, true, 23, 4);
3481   };
3482
3483   Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
3484     if (!noAssert) checkOffset(offset, 4, this.length);
3485     return read(this, offset, false, 23, 4);
3486   };
3487
3488   Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
3489     if (!noAssert) checkOffset(offset, 8, this.length);
3490     return read(this, offset, true, 52, 8);
3491   };
3492
3493   Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
3494     if (!noAssert) checkOffset(offset, 8, this.length);
3495     return read(this, offset, false, 52, 8);
3496   };
3497
3498   function checkInt(buf, value, offset, ext, max, min) {
3499     if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
3500     if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
3501     if (offset + ext > buf.length) throw new RangeError('Index out of range');
3502   }
3503
3504   Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
3505     value = +value;
3506     offset = offset | 0;
3507     byteLength = byteLength | 0;
3508
3509     if (!noAssert) {
3510       var maxBytes = Math.pow(2, 8 * byteLength) - 1;
3511       checkInt(this, value, offset, byteLength, maxBytes, 0);
3512     }
3513
3514     var mul = 1;
3515     var i = 0;
3516     this[offset] = value & 0xFF;
3517
3518     while (++i < byteLength && (mul *= 0x100)) {
3519       this[offset + i] = value / mul & 0xFF;
3520     }
3521
3522     return offset + byteLength;
3523   };
3524
3525   Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
3526     value = +value;
3527     offset = offset | 0;
3528     byteLength = byteLength | 0;
3529
3530     if (!noAssert) {
3531       var maxBytes = Math.pow(2, 8 * byteLength) - 1;
3532       checkInt(this, value, offset, byteLength, maxBytes, 0);
3533     }
3534
3535     var i = byteLength - 1;
3536     var mul = 1;
3537     this[offset + i] = value & 0xFF;
3538
3539     while (--i >= 0 && (mul *= 0x100)) {
3540       this[offset + i] = value / mul & 0xFF;
3541     }
3542
3543     return offset + byteLength;
3544   };
3545
3546   Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
3547     value = +value;
3548     offset = offset | 0;
3549     if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
3550     if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
3551     this[offset] = value & 0xff;
3552     return offset + 1;
3553   };
3554
3555   function objectWriteUInt16(buf, value, offset, littleEndian) {
3556     if (value < 0) value = 0xffff + value + 1;
3557
3558     for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
3559       buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8;
3560     }
3561   }
3562
3563   Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
3564     value = +value;
3565     offset = offset | 0;
3566     if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
3567
3568     if (Buffer.TYPED_ARRAY_SUPPORT) {
3569       this[offset] = value & 0xff;
3570       this[offset + 1] = value >>> 8;
3571     } else {
3572       objectWriteUInt16(this, value, offset, true);
3573     }
3574
3575     return offset + 2;
3576   };
3577
3578   Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
3579     value = +value;
3580     offset = offset | 0;
3581     if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
3582
3583     if (Buffer.TYPED_ARRAY_SUPPORT) {
3584       this[offset] = value >>> 8;
3585       this[offset + 1] = value & 0xff;
3586     } else {
3587       objectWriteUInt16(this, value, offset, false);
3588     }
3589
3590     return offset + 2;
3591   };
3592
3593   function objectWriteUInt32(buf, value, offset, littleEndian) {
3594     if (value < 0) value = 0xffffffff + value + 1;
3595
3596     for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
3597       buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff;
3598     }
3599   }
3600
3601   Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
3602     value = +value;
3603     offset = offset | 0;
3604     if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
3605
3606     if (Buffer.TYPED_ARRAY_SUPPORT) {
3607       this[offset + 3] = value >>> 24;
3608       this[offset + 2] = value >>> 16;
3609       this[offset + 1] = value >>> 8;
3610       this[offset] = value & 0xff;
3611     } else {
3612       objectWriteUInt32(this, value, offset, true);
3613     }
3614
3615     return offset + 4;
3616   };
3617
3618   Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
3619     value = +value;
3620     offset = offset | 0;
3621     if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
3622
3623     if (Buffer.TYPED_ARRAY_SUPPORT) {
3624       this[offset] = value >>> 24;
3625       this[offset + 1] = value >>> 16;
3626       this[offset + 2] = value >>> 8;
3627       this[offset + 3] = value & 0xff;
3628     } else {
3629       objectWriteUInt32(this, value, offset, false);
3630     }
3631
3632     return offset + 4;
3633   };
3634
3635   Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
3636     value = +value;
3637     offset = offset | 0;
3638
3639     if (!noAssert) {
3640       var limit = Math.pow(2, 8 * byteLength - 1);
3641       checkInt(this, value, offset, byteLength, limit - 1, -limit);
3642     }
3643
3644     var i = 0;
3645     var mul = 1;
3646     var sub = 0;
3647     this[offset] = value & 0xFF;
3648
3649     while (++i < byteLength && (mul *= 0x100)) {
3650       if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
3651         sub = 1;
3652       }
3653
3654       this[offset + i] = (value / mul >> 0) - sub & 0xFF;
3655     }
3656
3657     return offset + byteLength;
3658   };
3659
3660   Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
3661     value = +value;
3662     offset = offset | 0;
3663
3664     if (!noAssert) {
3665       var limit = Math.pow(2, 8 * byteLength - 1);
3666       checkInt(this, value, offset, byteLength, limit - 1, -limit);
3667     }
3668
3669     var i = byteLength - 1;
3670     var mul = 1;
3671     var sub = 0;
3672     this[offset + i] = value & 0xFF;
3673
3674     while (--i >= 0 && (mul *= 0x100)) {
3675       if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
3676         sub = 1;
3677       }
3678
3679       this[offset + i] = (value / mul >> 0) - sub & 0xFF;
3680     }
3681
3682     return offset + byteLength;
3683   };
3684
3685   Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
3686     value = +value;
3687     offset = offset | 0;
3688     if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
3689     if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
3690     if (value < 0) value = 0xff + value + 1;
3691     this[offset] = value & 0xff;
3692     return offset + 1;
3693   };
3694
3695   Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
3696     value = +value;
3697     offset = offset | 0;
3698     if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
3699
3700     if (Buffer.TYPED_ARRAY_SUPPORT) {
3701       this[offset] = value & 0xff;
3702       this[offset + 1] = value >>> 8;
3703     } else {
3704       objectWriteUInt16(this, value, offset, true);
3705     }
3706
3707     return offset + 2;
3708   };
3709
3710   Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
3711     value = +value;
3712     offset = offset | 0;
3713     if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
3714
3715     if (Buffer.TYPED_ARRAY_SUPPORT) {
3716       this[offset] = value >>> 8;
3717       this[offset + 1] = value & 0xff;
3718     } else {
3719       objectWriteUInt16(this, value, offset, false);
3720     }
3721
3722     return offset + 2;
3723   };
3724
3725   Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
3726     value = +value;
3727     offset = offset | 0;
3728     if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
3729
3730     if (Buffer.TYPED_ARRAY_SUPPORT) {
3731       this[offset] = value & 0xff;
3732       this[offset + 1] = value >>> 8;
3733       this[offset + 2] = value >>> 16;
3734       this[offset + 3] = value >>> 24;
3735     } else {
3736       objectWriteUInt32(this, value, offset, true);
3737     }
3738
3739     return offset + 4;
3740   };
3741
3742   Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
3743     value = +value;
3744     offset = offset | 0;
3745     if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
3746     if (value < 0) value = 0xffffffff + value + 1;
3747
3748     if (Buffer.TYPED_ARRAY_SUPPORT) {
3749       this[offset] = value >>> 24;
3750       this[offset + 1] = value >>> 16;
3751       this[offset + 2] = value >>> 8;
3752       this[offset + 3] = value & 0xff;
3753     } else {
3754       objectWriteUInt32(this, value, offset, false);
3755     }
3756
3757     return offset + 4;
3758   };
3759
3760   function checkIEEE754(buf, value, offset, ext, max, min) {
3761     if (offset + ext > buf.length) throw new RangeError('Index out of range');
3762     if (offset < 0) throw new RangeError('Index out of range');
3763   }
3764
3765   function writeFloat(buf, value, offset, littleEndian, noAssert) {
3766     if (!noAssert) {
3767       checkIEEE754(buf, value, offset, 4);
3768     }
3769
3770     write(buf, value, offset, littleEndian, 23, 4);
3771     return offset + 4;
3772   }
3773
3774   Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
3775     return writeFloat(this, value, offset, true, noAssert);
3776   };
3777
3778   Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
3779     return writeFloat(this, value, offset, false, noAssert);
3780   };
3781
3782   function writeDouble(buf, value, offset, littleEndian, noAssert) {
3783     if (!noAssert) {
3784       checkIEEE754(buf, value, offset, 8);
3785     }
3786
3787     write(buf, value, offset, littleEndian, 52, 8);
3788     return offset + 8;
3789   }
3790
3791   Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
3792     return writeDouble(this, value, offset, true, noAssert);
3793   };
3794
3795   Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
3796     return writeDouble(this, value, offset, false, noAssert);
3797   }; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
3798
3799
3800   Buffer.prototype.copy = function copy(target, targetStart, start, end) {
3801     if (!start) start = 0;
3802     if (!end && end !== 0) end = this.length;
3803     if (targetStart >= target.length) targetStart = target.length;
3804     if (!targetStart) targetStart = 0;
3805     if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done
3806
3807     if (end === start) return 0;
3808     if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions
3809
3810     if (targetStart < 0) {
3811       throw new RangeError('targetStart out of bounds');
3812     }
3813
3814     if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds');
3815     if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob?
3816
3817     if (end > this.length) end = this.length;
3818
3819     if (target.length - targetStart < end - start) {
3820       end = target.length - targetStart + start;
3821     }
3822
3823     var len = end - start;
3824     var i;
3825
3826     if (this === target && start < targetStart && targetStart < end) {
3827       // descending copy from end
3828       for (i = len - 1; i >= 0; --i) {
3829         target[i + targetStart] = this[i + start];
3830       }
3831     } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
3832       // ascending copy from start
3833       for (i = 0; i < len; ++i) {
3834         target[i + targetStart] = this[i + start];
3835       }
3836     } else {
3837       Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
3838     }
3839
3840     return len;
3841   }; // Usage:
3842   //    buffer.fill(number[, offset[, end]])
3843   //    buffer.fill(buffer[, offset[, end]])
3844   //    buffer.fill(string[, offset[, end]][, encoding])
3845
3846
3847   Buffer.prototype.fill = function fill(val, start, end, encoding) {
3848     // Handle string cases:
3849     if (typeof val === 'string') {
3850       if (typeof start === 'string') {
3851         encoding = start;
3852         start = 0;
3853         end = this.length;
3854       } else if (typeof end === 'string') {
3855         encoding = end;
3856         end = this.length;
3857       }
3858
3859       if (val.length === 1) {
3860         var code = val.charCodeAt(0);
3861
3862         if (code < 256) {
3863           val = code;
3864         }
3865       }
3866
3867       if (encoding !== undefined && typeof encoding !== 'string') {
3868         throw new TypeError('encoding must be a string');
3869       }
3870
3871       if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
3872         throw new TypeError('Unknown encoding: ' + encoding);
3873       }
3874     } else if (typeof val === 'number') {
3875       val = val & 255;
3876     } // Invalid ranges are not set to a default, so can range check early.
3877
3878
3879     if (start < 0 || this.length < start || this.length < end) {
3880       throw new RangeError('Out of range index');
3881     }
3882
3883     if (end <= start) {
3884       return this;
3885     }
3886
3887     start = start >>> 0;
3888     end = end === undefined ? this.length : end >>> 0;
3889     if (!val) val = 0;
3890     var i;
3891
3892     if (typeof val === 'number') {
3893       for (i = start; i < end; ++i) {
3894         this[i] = val;
3895       }
3896     } else {
3897       var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString());
3898       var len = bytes.length;
3899
3900       for (i = 0; i < end - start; ++i) {
3901         this[i + start] = bytes[i % len];
3902       }
3903     }
3904
3905     return this;
3906   }; // HELPER FUNCTIONS
3907   // ================
3908
3909
3910   var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
3911
3912   function base64clean(str) {
3913     // Node strips out invalid characters like \n and \t from the string, base64-js does not
3914     str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to ''
3915
3916     if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
3917
3918     while (str.length % 4 !== 0) {
3919       str = str + '=';
3920     }
3921
3922     return str;
3923   }
3924
3925   function stringtrim(str) {
3926     if (str.trim) return str.trim();
3927     return str.replace(/^\s+|\s+$/g, '');
3928   }
3929
3930   function toHex(n) {
3931     if (n < 16) return '0' + n.toString(16);
3932     return n.toString(16);
3933   }
3934
3935   function utf8ToBytes(string, units) {
3936     units = units || Infinity;
3937     var codePoint;
3938     var length = string.length;
3939     var leadSurrogate = null;
3940     var bytes = [];
3941
3942     for (var i = 0; i < length; ++i) {
3943       codePoint = string.charCodeAt(i); // is surrogate component
3944
3945       if (codePoint > 0xD7FF && codePoint < 0xE000) {
3946         // last char was a lead
3947         if (!leadSurrogate) {
3948           // no lead yet
3949           if (codePoint > 0xDBFF) {
3950             // unexpected trail
3951             if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3952             continue;
3953           } else if (i + 1 === length) {
3954             // unpaired lead
3955             if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3956             continue;
3957           } // valid lead
3958
3959
3960           leadSurrogate = codePoint;
3961           continue;
3962         } // 2 leads in a row
3963
3964
3965         if (codePoint < 0xDC00) {
3966           if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3967           leadSurrogate = codePoint;
3968           continue;
3969         } // valid surrogate pair
3970
3971
3972         codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
3973       } else if (leadSurrogate) {
3974         // valid bmp char, but last char was a lead
3975         if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
3976       }
3977
3978       leadSurrogate = null; // encode utf8
3979
3980       if (codePoint < 0x80) {
3981         if ((units -= 1) < 0) break;
3982         bytes.push(codePoint);
3983       } else if (codePoint < 0x800) {
3984         if ((units -= 2) < 0) break;
3985         bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80);
3986       } else if (codePoint < 0x10000) {
3987         if ((units -= 3) < 0) break;
3988         bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
3989       } else if (codePoint < 0x110000) {
3990         if ((units -= 4) < 0) break;
3991         bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80);
3992       } else {
3993         throw new Error('Invalid code point');
3994       }
3995     }
3996
3997     return bytes;
3998   }
3999
4000   function asciiToBytes(str) {
4001     var byteArray = [];
4002
4003     for (var i = 0; i < str.length; ++i) {
4004       // Node's code seems to be doing this and not & 0x7F..
4005       byteArray.push(str.charCodeAt(i) & 0xFF);
4006     }
4007
4008     return byteArray;
4009   }
4010
4011   function utf16leToBytes(str, units) {
4012     var c, hi, lo;
4013     var byteArray = [];
4014
4015     for (var i = 0; i < str.length; ++i) {
4016       if ((units -= 2) < 0) break;
4017       c = str.charCodeAt(i);
4018       hi = c >> 8;
4019       lo = c % 256;
4020       byteArray.push(lo);
4021       byteArray.push(hi);
4022     }
4023
4024     return byteArray;
4025   }
4026
4027   function base64ToBytes(str) {
4028     return toByteArray(base64clean(str));
4029   }
4030
4031   function blitBuffer(src, dst, offset, length) {
4032     for (var i = 0; i < length; ++i) {
4033       if (i + offset >= dst.length || i >= src.length) break;
4034       dst[i + offset] = src[i];
4035     }
4036
4037     return i;
4038   }
4039
4040   function isnan(val) {
4041     return val !== val; // eslint-disable-line no-self-compare
4042   } // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
4043   // The _isBuffer check is for Safari 5-7 support, because it's missing
4044   // Object.prototype.constructor. Remove this eventually
4045
4046
4047   function isBuffer(obj) {
4048     return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj));
4049   }
4050
4051   function isFastBuffer(obj) {
4052     return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
4053   } // For Node v0.10 support. Remove this eventually.
4054
4055
4056   function isSlowBuffer(obj) {
4057     return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0));
4058   }
4059
4060   var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4061
4062   function unwrapExports (x) {
4063         return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
4064   }
4065
4066   function createCommonjsModule(fn, module) {
4067         return module = { exports: {} }, fn(module, module.exports), module.exports;
4068   }
4069
4070   function getCjsExportFromNamespace (n) {
4071         return n && n['default'] || n;
4072   }
4073
4074   var fs = getCjsExportFromNamespace(_shim_fs$1);
4075
4076   /**
4077    * @class
4078    */
4079
4080
4081   var LineByLine =
4082   /*#__PURE__*/
4083   function () {
4084     function LineByLine(file, options) {
4085       _classCallCheck(this, LineByLine);
4086
4087       options = options || {};
4088       if (!options.readChunk) options.readChunk = 1024;
4089
4090       if (!options.newLineCharacter) {
4091         options.newLineCharacter = 0x0a; //linux line ending
4092       } else {
4093         options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
4094       }
4095
4096       if (typeof file === 'number') {
4097         this.fd = file;
4098       } else {
4099         this.fd = fs.openSync(file, 'r');
4100       }
4101
4102       this.options = options;
4103       this.newLineCharacter = options.newLineCharacter;
4104       this.reset();
4105     }
4106
4107     _createClass(LineByLine, [{
4108       key: "_searchInBuffer",
4109       value: function _searchInBuffer(buffer, hexNeedle) {
4110         var found = -1;
4111
4112         for (var i = 0; i <= buffer.length; i++) {
4113           var b_byte = buffer[i];
4114
4115           if (b_byte === hexNeedle) {
4116             found = i;
4117             break;
4118           }
4119         }
4120
4121         return found;
4122       }
4123     }, {
4124       key: "reset",
4125       value: function reset() {
4126         this.eofReached = false;
4127         this.linesCache = [];
4128         this.fdPosition = 0;
4129       }
4130     }, {
4131       key: "close",
4132       value: function close() {
4133         fs.closeSync(this.fd);
4134         this.fd = null;
4135       }
4136     }, {
4137       key: "_extractLines",
4138       value: function _extractLines(buffer) {
4139         var line;
4140         var lines = [];
4141         var bufferPosition = 0;
4142         var lastNewLineBufferPosition = 0;
4143
4144         while (true) {
4145           var bufferPositionValue = buffer[bufferPosition++];
4146
4147           if (bufferPositionValue === this.newLineCharacter) {
4148             line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
4149             lines.push(line);
4150             lastNewLineBufferPosition = bufferPosition;
4151           } else if (!bufferPositionValue) {
4152             break;
4153           }
4154         }
4155
4156         var leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
4157
4158         if (leftovers.length) {
4159           lines.push(leftovers);
4160         }
4161
4162         return lines;
4163       }
4164     }, {
4165       key: "_readChunk",
4166       value: function _readChunk(lineLeftovers) {
4167         var totalBytesRead = 0;
4168         var bytesRead;
4169         var buffers = [];
4170
4171         do {
4172           var readBuffer = new Buffer(this.options.readChunk);
4173           bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
4174           totalBytesRead = totalBytesRead + bytesRead;
4175           this.fdPosition = this.fdPosition + bytesRead;
4176           buffers.push(readBuffer);
4177         } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
4178
4179         var bufferData = Buffer.concat(buffers);
4180
4181         if (bytesRead < this.options.readChunk) {
4182           this.eofReached = true;
4183           bufferData = bufferData.slice(0, totalBytesRead);
4184         }
4185
4186         if (totalBytesRead) {
4187           this.linesCache = this._extractLines(bufferData);
4188
4189           if (lineLeftovers) {
4190             this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
4191           }
4192         }
4193
4194         return totalBytesRead;
4195       }
4196     }, {
4197       key: "next",
4198       value: function next() {
4199         if (!this.fd) return false;
4200         var line = false;
4201
4202         if (this.eofReached && this.linesCache.length === 0) {
4203           return line;
4204         }
4205
4206         var bytesRead;
4207
4208         if (!this.linesCache.length) {
4209           bytesRead = this._readChunk();
4210         }
4211
4212         if (this.linesCache.length) {
4213           line = this.linesCache.shift();
4214           var lastLineCharacter = line[line.length - 1];
4215
4216           if (lastLineCharacter !== 0x0a) {
4217             bytesRead = this._readChunk(line);
4218
4219             if (bytesRead) {
4220               line = this.linesCache.shift();
4221             }
4222           }
4223         }
4224
4225         if (this.eofReached && this.linesCache.length === 0) {
4226           this.close();
4227         }
4228
4229         if (line && line[line.length - 1] === this.newLineCharacter) {
4230           line = line.slice(0, line.length - 1);
4231         }
4232
4233         return line;
4234       }
4235     }]);
4236
4237     return LineByLine;
4238   }();
4239
4240   var readlines = LineByLine;
4241
4242   var ConfigError =
4243   /*#__PURE__*/
4244   function (_Error) {
4245     _inherits(ConfigError, _Error);
4246
4247     function ConfigError() {
4248       _classCallCheck(this, ConfigError);
4249
4250       return _possibleConstructorReturn(this, _getPrototypeOf(ConfigError).apply(this, arguments));
4251     }
4252
4253     return ConfigError;
4254   }(_wrapNativeSuper(Error));
4255
4256   var DebugError =
4257   /*#__PURE__*/
4258   function (_Error2) {
4259     _inherits(DebugError, _Error2);
4260
4261     function DebugError() {
4262       _classCallCheck(this, DebugError);
4263
4264       return _possibleConstructorReturn(this, _getPrototypeOf(DebugError).apply(this, arguments));
4265     }
4266
4267     return DebugError;
4268   }(_wrapNativeSuper(Error));
4269
4270   var UndefinedParserError =
4271   /*#__PURE__*/
4272   function (_Error3) {
4273     _inherits(UndefinedParserError, _Error3);
4274
4275     function UndefinedParserError() {
4276       _classCallCheck(this, UndefinedParserError);
4277
4278       return _possibleConstructorReturn(this, _getPrototypeOf(UndefinedParserError).apply(this, arguments));
4279     }
4280
4281     return UndefinedParserError;
4282   }(_wrapNativeSuper(Error));
4283
4284   var errors = {
4285     ConfigError: ConfigError,
4286     DebugError: DebugError,
4287     UndefinedParserError: UndefinedParserError
4288   };
4289
4290   // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
4291
4292   function defaultSetTimout() {
4293     throw new Error('setTimeout has not been defined');
4294   }
4295
4296   function defaultClearTimeout() {
4297     throw new Error('clearTimeout has not been defined');
4298   }
4299
4300   var cachedSetTimeout = defaultSetTimout;
4301   var cachedClearTimeout = defaultClearTimeout;
4302
4303   if (typeof global$1.setTimeout === 'function') {
4304     cachedSetTimeout = setTimeout;
4305   }
4306
4307   if (typeof global$1.clearTimeout === 'function') {
4308     cachedClearTimeout = clearTimeout;
4309   }
4310
4311   function runTimeout(fun) {
4312     if (cachedSetTimeout === setTimeout) {
4313       //normal enviroments in sane situations
4314       return setTimeout(fun, 0);
4315     } // if setTimeout wasn't available but was latter defined
4316
4317
4318     if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
4319       cachedSetTimeout = setTimeout;
4320       return setTimeout(fun, 0);
4321     }
4322
4323     try {
4324       // when when somebody has screwed with setTimeout but no I.E. maddness
4325       return cachedSetTimeout(fun, 0);
4326     } catch (e) {
4327       try {
4328         // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
4329         return cachedSetTimeout.call(null, fun, 0);
4330       } catch (e) {
4331         // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
4332         return cachedSetTimeout.call(this, fun, 0);
4333       }
4334     }
4335   }
4336
4337   function runClearTimeout(marker) {
4338     if (cachedClearTimeout === clearTimeout) {
4339       //normal enviroments in sane situations
4340       return clearTimeout(marker);
4341     } // if clearTimeout wasn't available but was latter defined
4342
4343
4344     if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
4345       cachedClearTimeout = clearTimeout;
4346       return clearTimeout(marker);
4347     }
4348
4349     try {
4350       // when when somebody has screwed with setTimeout but no I.E. maddness
4351       return cachedClearTimeout(marker);
4352     } catch (e) {
4353       try {
4354         // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
4355         return cachedClearTimeout.call(null, marker);
4356       } catch (e) {
4357         // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
4358         // Some versions of I.E. have different rules for clearTimeout vs setTimeout
4359         return cachedClearTimeout.call(this, marker);
4360       }
4361     }
4362   }
4363
4364   var queue = [];
4365   var draining = false;
4366   var currentQueue;
4367   var queueIndex = -1;
4368
4369   function cleanUpNextTick() {
4370     if (!draining || !currentQueue) {
4371       return;
4372     }
4373
4374     draining = false;
4375
4376     if (currentQueue.length) {
4377       queue = currentQueue.concat(queue);
4378     } else {
4379       queueIndex = -1;
4380     }
4381
4382     if (queue.length) {
4383       drainQueue();
4384     }
4385   }
4386
4387   function drainQueue() {
4388     if (draining) {
4389       return;
4390     }
4391
4392     var timeout = runTimeout(cleanUpNextTick);
4393     draining = true;
4394     var len = queue.length;
4395
4396     while (len) {
4397       currentQueue = queue;
4398       queue = [];
4399
4400       while (++queueIndex < len) {
4401         if (currentQueue) {
4402           currentQueue[queueIndex].run();
4403         }
4404       }
4405
4406       queueIndex = -1;
4407       len = queue.length;
4408     }
4409
4410     currentQueue = null;
4411     draining = false;
4412     runClearTimeout(timeout);
4413   }
4414
4415   function nextTick(fun) {
4416     var args = new Array(arguments.length - 1);
4417
4418     if (arguments.length > 1) {
4419       for (var i = 1; i < arguments.length; i++) {
4420         args[i - 1] = arguments[i];
4421       }
4422     }
4423
4424     queue.push(new Item(fun, args));
4425
4426     if (queue.length === 1 && !draining) {
4427       runTimeout(drainQueue);
4428     }
4429   } // v8 likes predictible objects
4430
4431   function Item(fun, array) {
4432     this.fun = fun;
4433     this.array = array;
4434   }
4435
4436   Item.prototype.run = function () {
4437     this.fun.apply(null, this.array);
4438   };
4439
4440   var title = 'browser';
4441   var platform = 'browser';
4442   var browser = true;
4443   var env = {};
4444   var argv = [];
4445   var version$1 = ''; // empty string to avoid regexp issues
4446
4447   var versions = {};
4448   var release = {};
4449   var config = {};
4450
4451   function noop() {}
4452
4453   var on = noop;
4454   var addListener = noop;
4455   var once = noop;
4456   var off = noop;
4457   var removeListener = noop;
4458   var removeAllListeners = noop;
4459   var emit = noop;
4460   function binding(name) {
4461     throw new Error('process.binding is not supported');
4462   }
4463   function cwd() {
4464     return '/';
4465   }
4466   function chdir(dir) {
4467     throw new Error('process.chdir is not supported');
4468   }
4469   function umask() {
4470     return 0;
4471   } // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
4472
4473   var performance = global$1.performance || {};
4474
4475   var performanceNow = performance.now || performance.mozNow || performance.msNow || performance.oNow || performance.webkitNow || function () {
4476     return new Date().getTime();
4477   }; // generate timestamp or delta
4478   // see http://nodejs.org/api/process.html#process_process_hrtime
4479
4480
4481   function hrtime(previousTimestamp) {
4482     var clocktime = performanceNow.call(performance) * 1e-3;
4483     var seconds = Math.floor(clocktime);
4484     var nanoseconds = Math.floor(clocktime % 1 * 1e9);
4485
4486     if (previousTimestamp) {
4487       seconds = seconds - previousTimestamp[0];
4488       nanoseconds = nanoseconds - previousTimestamp[1];
4489
4490       if (nanoseconds < 0) {
4491         seconds--;
4492         nanoseconds += 1e9;
4493       }
4494     }
4495
4496     return [seconds, nanoseconds];
4497   }
4498   var startTime = new Date();
4499   function uptime() {
4500     var currentTime = new Date();
4501     var dif = currentTime - startTime;
4502     return dif / 1000;
4503   }
4504   var process = {
4505     nextTick: nextTick,
4506     title: title,
4507     browser: browser,
4508     env: env,
4509     argv: argv,
4510     version: version$1,
4511     versions: versions,
4512     on: on,
4513     addListener: addListener,
4514     once: once,
4515     off: off,
4516     removeListener: removeListener,
4517     removeAllListeners: removeAllListeners,
4518     emit: emit,
4519     binding: binding,
4520     cwd: cwd,
4521     chdir: chdir,
4522     umask: umask,
4523     hrtime: hrtime,
4524     platform: platform,
4525     release: release,
4526     config: config,
4527     uptime: uptime
4528   };
4529
4530   var semver = createCommonjsModule(function (module, exports) {
4531     exports = module.exports = SemVer;
4532     var debug;
4533     /* istanbul ignore next */
4534
4535     if (_typeof(process) === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
4536       debug = function debug() {
4537         var args = Array.prototype.slice.call(arguments, 0);
4538         args.unshift('SEMVER');
4539         console.log.apply(console, args);
4540       };
4541     } else {
4542       debug = function debug() {};
4543     } // Note: this is the semver.org version of the spec that it implements
4544     // Not necessarily the package version of this code.
4545
4546
4547     exports.SEMVER_SPEC_VERSION = '2.0.0';
4548     var MAX_LENGTH = 256;
4549     var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
4550     /* istanbul ignore next */
4551     9007199254740991; // Max safe segment length for coercion.
4552
4553     var MAX_SAFE_COMPONENT_LENGTH = 16; // The actual regexps go on exports.re
4554
4555     var re = exports.re = [];
4556     var src = exports.src = [];
4557     var t = exports.tokens = {};
4558     var R = 0;
4559
4560     function tok(n) {
4561       t[n] = R++;
4562     } // The following Regular Expressions can be used for tokenizing,
4563     // validating, and parsing SemVer version strings.
4564     // ## Numeric Identifier
4565     // A single `0`, or a non-zero digit followed by zero or more digits.
4566
4567
4568     tok('NUMERICIDENTIFIER');
4569     src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*';
4570     tok('NUMERICIDENTIFIERLOOSE');
4571     src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'; // ## Non-numeric Identifier
4572     // Zero or more digits, followed by a letter or hyphen, and then zero or
4573     // more letters, digits, or hyphens.
4574
4575     tok('NONNUMERICIDENTIFIER');
4576     src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; // ## Main Version
4577     // Three dot-separated numeric identifiers.
4578
4579     tok('MAINVERSION');
4580     src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')';
4581     tok('MAINVERSIONLOOSE');
4582     src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'; // ## Pre-release Version Identifier
4583     // A numeric identifier, or a non-numeric identifier.
4584
4585     tok('PRERELEASEIDENTIFIER');
4586     src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')';
4587     tok('PRERELEASEIDENTIFIERLOOSE');
4588     src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')'; // ## Pre-release Version
4589     // Hyphen, followed by one or more dot-separated pre-release version
4590     // identifiers.
4591
4592     tok('PRERELEASE');
4593     src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))';
4594     tok('PRERELEASELOOSE');
4595     src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'; // ## Build Metadata Identifier
4596     // Any combination of digits, letters, or hyphens.
4597
4598     tok('BUILDIDENTIFIER');
4599     src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; // ## Build Metadata
4600     // Plus sign, followed by one or more period-separated build metadata
4601     // identifiers.
4602
4603     tok('BUILD');
4604     src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'; // ## Full Version String
4605     // A main version, followed optionally by a pre-release version and
4606     // build metadata.
4607     // Note that the only major, minor, patch, and pre-release sections of
4608     // the version string are capturing groups.  The build metadata is not a
4609     // capturing group, because it should not ever be used in version
4610     // comparison.
4611
4612     tok('FULL');
4613     tok('FULLPLAIN');
4614     src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?';
4615     src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'; // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
4616     // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
4617     // common in the npm registry.
4618
4619     tok('LOOSEPLAIN');
4620     src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?';
4621     tok('LOOSE');
4622     src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$';
4623     tok('GTLT');
4624     src[t.GTLT] = '((?:<|>)?=?)'; // Something like "2.*" or "1.2.x".
4625     // Note that "x.x" is a valid xRange identifer, meaning "any version"
4626     // Only the first item is strictly required.
4627
4628     tok('XRANGEIDENTIFIERLOOSE');
4629     src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*';
4630     tok('XRANGEIDENTIFIER');
4631     src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*';
4632     tok('XRANGEPLAIN');
4633     src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?';
4634     tok('XRANGEPLAINLOOSE');
4635     src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?';
4636     tok('XRANGE');
4637     src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$';
4638     tok('XRANGELOOSE');
4639     src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'; // Coercion.
4640     // Extract anything that could conceivably be a part of a valid semver
4641
4642     tok('COERCE');
4643     src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])';
4644     tok('COERCERTL');
4645     re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g'); // Tilde ranges.
4646     // Meaning is "reasonably at or greater than"
4647
4648     tok('LONETILDE');
4649     src[t.LONETILDE] = '(?:~>?)';
4650     tok('TILDETRIM');
4651     src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+';
4652     re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g');
4653     var tildeTrimReplace = '$1~';
4654     tok('TILDE');
4655     src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$';
4656     tok('TILDELOOSE');
4657     src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'; // Caret ranges.
4658     // Meaning is "at least and backwards compatible with"
4659
4660     tok('LONECARET');
4661     src[t.LONECARET] = '(?:\\^)';
4662     tok('CARETTRIM');
4663     src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+';
4664     re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g');
4665     var caretTrimReplace = '$1^';
4666     tok('CARET');
4667     src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$';
4668     tok('CARETLOOSE');
4669     src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'; // A simple gt/lt/eq thing, or just "" to indicate "any version"
4670
4671     tok('COMPARATORLOOSE');
4672     src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$';
4673     tok('COMPARATOR');
4674     src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'; // An expression to strip any whitespace between the gtlt and the thing
4675     // it modifies, so that `> 1.2.3` ==> `>1.2.3`
4676
4677     tok('COMPARATORTRIM');
4678     src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'; // this one has to use the /g flag
4679
4680     re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g');
4681     var comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4`
4682     // Note that these all use the loose form, because they'll be
4683     // checked against either the strict or loose comparator form
4684     // later.
4685
4686     tok('HYPHENRANGE');
4687     src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$';
4688     tok('HYPHENRANGELOOSE');
4689     src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$'; // Star ranges basically just allow anything at all.
4690
4691     tok('STAR');
4692     src[t.STAR] = '(<|>)?=?\\s*\\*'; // Compile to actual regexp objects.
4693     // All are flag-free, unless they were created above with a flag.
4694
4695     for (var i = 0; i < R; i++) {
4696       debug(i, src[i]);
4697
4698       if (!re[i]) {
4699         re[i] = new RegExp(src[i]);
4700       }
4701     }
4702
4703     exports.parse = parse;
4704
4705     function parse(version, options) {
4706       if (!options || _typeof(options) !== 'object') {
4707         options = {
4708           loose: !!options,
4709           includePrerelease: false
4710         };
4711       }
4712
4713       if (version instanceof SemVer) {
4714         return version;
4715       }
4716
4717       if (typeof version !== 'string') {
4718         return null;
4719       }
4720
4721       if (version.length > MAX_LENGTH) {
4722         return null;
4723       }
4724
4725       var r = options.loose ? re[t.LOOSE] : re[t.FULL];
4726
4727       if (!r.test(version)) {
4728         return null;
4729       }
4730
4731       try {
4732         return new SemVer(version, options);
4733       } catch (er) {
4734         return null;
4735       }
4736     }
4737
4738     exports.valid = valid;
4739
4740     function valid(version, options) {
4741       var v = parse(version, options);
4742       return v ? v.version : null;
4743     }
4744
4745     exports.clean = clean;
4746
4747     function clean(version, options) {
4748       var s = parse(version.trim().replace(/^[=v]+/, ''), options);
4749       return s ? s.version : null;
4750     }
4751
4752     exports.SemVer = SemVer;
4753
4754     function SemVer(version, options) {
4755       if (!options || _typeof(options) !== 'object') {
4756         options = {
4757           loose: !!options,
4758           includePrerelease: false
4759         };
4760       }
4761
4762       if (version instanceof SemVer) {
4763         if (version.loose === options.loose) {
4764           return version;
4765         } else {
4766           version = version.version;
4767         }
4768       } else if (typeof version !== 'string') {
4769         throw new TypeError('Invalid Version: ' + version);
4770       }
4771
4772       if (version.length > MAX_LENGTH) {
4773         throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters');
4774       }
4775
4776       if (!(this instanceof SemVer)) {
4777         return new SemVer(version, options);
4778       }
4779
4780       debug('SemVer', version, options);
4781       this.options = options;
4782       this.loose = !!options.loose;
4783       var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
4784
4785       if (!m) {
4786         throw new TypeError('Invalid Version: ' + version);
4787       }
4788
4789       this.raw = version; // these are actually numbers
4790
4791       this.major = +m[1];
4792       this.minor = +m[2];
4793       this.patch = +m[3];
4794
4795       if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
4796         throw new TypeError('Invalid major version');
4797       }
4798
4799       if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
4800         throw new TypeError('Invalid minor version');
4801       }
4802
4803       if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
4804         throw new TypeError('Invalid patch version');
4805       } // numberify any prerelease numeric ids
4806
4807
4808       if (!m[4]) {
4809         this.prerelease = [];
4810       } else {
4811         this.prerelease = m[4].split('.').map(function (id) {
4812           if (/^[0-9]+$/.test(id)) {
4813             var num = +id;
4814
4815             if (num >= 0 && num < MAX_SAFE_INTEGER) {
4816               return num;
4817             }
4818           }
4819
4820           return id;
4821         });
4822       }
4823
4824       this.build = m[5] ? m[5].split('.') : [];
4825       this.format();
4826     }
4827
4828     SemVer.prototype.format = function () {
4829       this.version = this.major + '.' + this.minor + '.' + this.patch;
4830
4831       if (this.prerelease.length) {
4832         this.version += '-' + this.prerelease.join('.');
4833       }
4834
4835       return this.version;
4836     };
4837
4838     SemVer.prototype.toString = function () {
4839       return this.version;
4840     };
4841
4842     SemVer.prototype.compare = function (other) {
4843       debug('SemVer.compare', this.version, this.options, other);
4844
4845       if (!(other instanceof SemVer)) {
4846         other = new SemVer(other, this.options);
4847       }
4848
4849       return this.compareMain(other) || this.comparePre(other);
4850     };
4851
4852     SemVer.prototype.compareMain = function (other) {
4853       if (!(other instanceof SemVer)) {
4854         other = new SemVer(other, this.options);
4855       }
4856
4857       return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
4858     };
4859
4860     SemVer.prototype.comparePre = function (other) {
4861       if (!(other instanceof SemVer)) {
4862         other = new SemVer(other, this.options);
4863       } // NOT having a prerelease is > having one
4864
4865
4866       if (this.prerelease.length && !other.prerelease.length) {
4867         return -1;
4868       } else if (!this.prerelease.length && other.prerelease.length) {
4869         return 1;
4870       } else if (!this.prerelease.length && !other.prerelease.length) {
4871         return 0;
4872       }
4873
4874       var i = 0;
4875
4876       do {
4877         var a = this.prerelease[i];
4878         var b = other.prerelease[i];
4879         debug('prerelease compare', i, a, b);
4880
4881         if (a === undefined && b === undefined) {
4882           return 0;
4883         } else if (b === undefined) {
4884           return 1;
4885         } else if (a === undefined) {
4886           return -1;
4887         } else if (a === b) {
4888           continue;
4889         } else {
4890           return compareIdentifiers(a, b);
4891         }
4892       } while (++i);
4893     };
4894
4895     SemVer.prototype.compareBuild = function (other) {
4896       if (!(other instanceof SemVer)) {
4897         other = new SemVer(other, this.options);
4898       }
4899
4900       var i = 0;
4901
4902       do {
4903         var a = this.build[i];
4904         var b = other.build[i];
4905         debug('prerelease compare', i, a, b);
4906
4907         if (a === undefined && b === undefined) {
4908           return 0;
4909         } else if (b === undefined) {
4910           return 1;
4911         } else if (a === undefined) {
4912           return -1;
4913         } else if (a === b) {
4914           continue;
4915         } else {
4916           return compareIdentifiers(a, b);
4917         }
4918       } while (++i);
4919     }; // preminor will bump the version up to the next minor release, and immediately
4920     // down to pre-release. premajor and prepatch work the same way.
4921
4922
4923     SemVer.prototype.inc = function (release, identifier) {
4924       switch (release) {
4925         case 'premajor':
4926           this.prerelease.length = 0;
4927           this.patch = 0;
4928           this.minor = 0;
4929           this.major++;
4930           this.inc('pre', identifier);
4931           break;
4932
4933         case 'preminor':
4934           this.prerelease.length = 0;
4935           this.patch = 0;
4936           this.minor++;
4937           this.inc('pre', identifier);
4938           break;
4939
4940         case 'prepatch':
4941           // If this is already a prerelease, it will bump to the next version
4942           // drop any prereleases that might already exist, since they are not
4943           // relevant at this point.
4944           this.prerelease.length = 0;
4945           this.inc('patch', identifier);
4946           this.inc('pre', identifier);
4947           break;
4948         // If the input is a non-prerelease version, this acts the same as
4949         // prepatch.
4950
4951         case 'prerelease':
4952           if (this.prerelease.length === 0) {
4953             this.inc('patch', identifier);
4954           }
4955
4956           this.inc('pre', identifier);
4957           break;
4958
4959         case 'major':
4960           // If this is a pre-major version, bump up to the same major version.
4961           // Otherwise increment major.
4962           // 1.0.0-5 bumps to 1.0.0
4963           // 1.1.0 bumps to 2.0.0
4964           if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
4965             this.major++;
4966           }
4967
4968           this.minor = 0;
4969           this.patch = 0;
4970           this.prerelease = [];
4971           break;
4972
4973         case 'minor':
4974           // If this is a pre-minor version, bump up to the same minor version.
4975           // Otherwise increment minor.
4976           // 1.2.0-5 bumps to 1.2.0
4977           // 1.2.1 bumps to 1.3.0
4978           if (this.patch !== 0 || this.prerelease.length === 0) {
4979             this.minor++;
4980           }
4981
4982           this.patch = 0;
4983           this.prerelease = [];
4984           break;
4985
4986         case 'patch':
4987           // If this is not a pre-release version, it will increment the patch.
4988           // If it is a pre-release it will bump up to the same patch version.
4989           // 1.2.0-5 patches to 1.2.0
4990           // 1.2.0 patches to 1.2.1
4991           if (this.prerelease.length === 0) {
4992             this.patch++;
4993           }
4994
4995           this.prerelease = [];
4996           break;
4997         // This probably shouldn't be used publicly.
4998         // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction.
4999
5000         case 'pre':
5001           if (this.prerelease.length === 0) {
5002             this.prerelease = [0];
5003           } else {
5004             var i = this.prerelease.length;
5005
5006             while (--i >= 0) {
5007               if (typeof this.prerelease[i] === 'number') {
5008                 this.prerelease[i]++;
5009                 i = -2;
5010               }
5011             }
5012
5013             if (i === -1) {
5014               // didn't increment anything
5015               this.prerelease.push(0);
5016             }
5017           }
5018
5019           if (identifier) {
5020             // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
5021             // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
5022             if (this.prerelease[0] === identifier) {
5023               if (isNaN(this.prerelease[1])) {
5024                 this.prerelease = [identifier, 0];
5025               }
5026             } else {
5027               this.prerelease = [identifier, 0];
5028             }
5029           }
5030
5031           break;
5032
5033         default:
5034           throw new Error('invalid increment argument: ' + release);
5035       }
5036
5037       this.format();
5038       this.raw = this.version;
5039       return this;
5040     };
5041
5042     exports.inc = inc;
5043
5044     function inc(version, release, loose, identifier) {
5045       if (typeof loose === 'string') {
5046         identifier = loose;
5047         loose = undefined;
5048       }
5049
5050       try {
5051         return new SemVer(version, loose).inc(release, identifier).version;
5052       } catch (er) {
5053         return null;
5054       }
5055     }
5056
5057     exports.diff = diff;
5058
5059     function diff(version1, version2) {
5060       if (eq(version1, version2)) {
5061         return null;
5062       } else {
5063         var v1 = parse(version1);
5064         var v2 = parse(version2);
5065         var prefix = '';
5066
5067         if (v1.prerelease.length || v2.prerelease.length) {
5068           prefix = 'pre';
5069           var defaultResult = 'prerelease';
5070         }
5071
5072         for (var key in v1) {
5073           if (key === 'major' || key === 'minor' || key === 'patch') {
5074             if (v1[key] !== v2[key]) {
5075               return prefix + key;
5076             }
5077           }
5078         }
5079
5080         return defaultResult; // may be undefined
5081       }
5082     }
5083
5084     exports.compareIdentifiers = compareIdentifiers;
5085     var numeric = /^[0-9]+$/;
5086
5087     function compareIdentifiers(a, b) {
5088       var anum = numeric.test(a);
5089       var bnum = numeric.test(b);
5090
5091       if (anum && bnum) {
5092         a = +a;
5093         b = +b;
5094       }
5095
5096       return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
5097     }
5098
5099     exports.rcompareIdentifiers = rcompareIdentifiers;
5100
5101     function rcompareIdentifiers(a, b) {
5102       return compareIdentifiers(b, a);
5103     }
5104
5105     exports.major = major;
5106
5107     function major(a, loose) {
5108       return new SemVer(a, loose).major;
5109     }
5110
5111     exports.minor = minor;
5112
5113     function minor(a, loose) {
5114       return new SemVer(a, loose).minor;
5115     }
5116
5117     exports.patch = patch;
5118
5119     function patch(a, loose) {
5120       return new SemVer(a, loose).patch;
5121     }
5122
5123     exports.compare = compare;
5124
5125     function compare(a, b, loose) {
5126       return new SemVer(a, loose).compare(new SemVer(b, loose));
5127     }
5128
5129     exports.compareLoose = compareLoose;
5130
5131     function compareLoose(a, b) {
5132       return compare(a, b, true);
5133     }
5134
5135     exports.compareBuild = compareBuild;
5136
5137     function compareBuild(a, b, loose) {
5138       var versionA = new SemVer(a, loose);
5139       var versionB = new SemVer(b, loose);
5140       return versionA.compare(versionB) || versionA.compareBuild(versionB);
5141     }
5142
5143     exports.rcompare = rcompare;
5144
5145     function rcompare(a, b, loose) {
5146       return compare(b, a, loose);
5147     }
5148
5149     exports.sort = sort;
5150
5151     function sort(list, loose) {
5152       return list.sort(function (a, b) {
5153         return exports.compareBuild(a, b, loose);
5154       });
5155     }
5156
5157     exports.rsort = rsort;
5158
5159     function rsort(list, loose) {
5160       return list.sort(function (a, b) {
5161         return exports.compareBuild(b, a, loose);
5162       });
5163     }
5164
5165     exports.gt = gt;
5166
5167     function gt(a, b, loose) {
5168       return compare(a, b, loose) > 0;
5169     }
5170
5171     exports.lt = lt;
5172
5173     function lt(a, b, loose) {
5174       return compare(a, b, loose) < 0;
5175     }
5176
5177     exports.eq = eq;
5178
5179     function eq(a, b, loose) {
5180       return compare(a, b, loose) === 0;
5181     }
5182
5183     exports.neq = neq;
5184
5185     function neq(a, b, loose) {
5186       return compare(a, b, loose) !== 0;
5187     }
5188
5189     exports.gte = gte;
5190
5191     function gte(a, b, loose) {
5192       return compare(a, b, loose) >= 0;
5193     }
5194
5195     exports.lte = lte;
5196
5197     function lte(a, b, loose) {
5198       return compare(a, b, loose) <= 0;
5199     }
5200
5201     exports.cmp = cmp;
5202
5203     function cmp(a, op, b, loose) {
5204       switch (op) {
5205         case '===':
5206           if (_typeof(a) === 'object') a = a.version;
5207           if (_typeof(b) === 'object') b = b.version;
5208           return a === b;
5209
5210         case '!==':
5211           if (_typeof(a) === 'object') a = a.version;
5212           if (_typeof(b) === 'object') b = b.version;
5213           return a !== b;
5214
5215         case '':
5216         case '=':
5217         case '==':
5218           return eq(a, b, loose);
5219
5220         case '!=':
5221           return neq(a, b, loose);
5222
5223         case '>':
5224           return gt(a, b, loose);
5225
5226         case '>=':
5227           return gte(a, b, loose);
5228
5229         case '<':
5230           return lt(a, b, loose);
5231
5232         case '<=':
5233           return lte(a, b, loose);
5234
5235         default:
5236           throw new TypeError('Invalid operator: ' + op);
5237       }
5238     }
5239
5240     exports.Comparator = Comparator;
5241
5242     function Comparator(comp, options) {
5243       if (!options || _typeof(options) !== 'object') {
5244         options = {
5245           loose: !!options,
5246           includePrerelease: false
5247         };
5248       }
5249
5250       if (comp instanceof Comparator) {
5251         if (comp.loose === !!options.loose) {
5252           return comp;
5253         } else {
5254           comp = comp.value;
5255         }
5256       }
5257
5258       if (!(this instanceof Comparator)) {
5259         return new Comparator(comp, options);
5260       }
5261
5262       debug('comparator', comp, options);
5263       this.options = options;
5264       this.loose = !!options.loose;
5265       this.parse(comp);
5266
5267       if (this.semver === ANY) {
5268         this.value = '';
5269       } else {
5270         this.value = this.operator + this.semver.version;
5271       }
5272
5273       debug('comp', this);
5274     }
5275
5276     var ANY = {};
5277
5278     Comparator.prototype.parse = function (comp) {
5279       var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
5280       var m = comp.match(r);
5281
5282       if (!m) {
5283         throw new TypeError('Invalid comparator: ' + comp);
5284       }
5285
5286       this.operator = m[1] !== undefined ? m[1] : '';
5287
5288       if (this.operator === '=') {
5289         this.operator = '';
5290       } // if it literally is just '>' or '' then allow anything.
5291
5292
5293       if (!m[2]) {
5294         this.semver = ANY;
5295       } else {
5296         this.semver = new SemVer(m[2], this.options.loose);
5297       }
5298     };
5299
5300     Comparator.prototype.toString = function () {
5301       return this.value;
5302     };
5303
5304     Comparator.prototype.test = function (version) {
5305       debug('Comparator.test', version, this.options.loose);
5306
5307       if (this.semver === ANY || version === ANY) {
5308         return true;
5309       }
5310
5311       if (typeof version === 'string') {
5312         try {
5313           version = new SemVer(version, this.options);
5314         } catch (er) {
5315           return false;
5316         }
5317       }
5318
5319       return cmp(version, this.operator, this.semver, this.options);
5320     };
5321
5322     Comparator.prototype.intersects = function (comp, options) {
5323       if (!(comp instanceof Comparator)) {
5324         throw new TypeError('a Comparator is required');
5325       }
5326
5327       if (!options || _typeof(options) !== 'object') {
5328         options = {
5329           loose: !!options,
5330           includePrerelease: false
5331         };
5332       }
5333
5334       var rangeTmp;
5335
5336       if (this.operator === '') {
5337         if (this.value === '') {
5338           return true;
5339         }
5340
5341         rangeTmp = new Range(comp.value, options);
5342         return satisfies(this.value, rangeTmp, options);
5343       } else if (comp.operator === '') {
5344         if (comp.value === '') {
5345           return true;
5346         }
5347
5348         rangeTmp = new Range(this.value, options);
5349         return satisfies(comp.semver, rangeTmp, options);
5350       }
5351
5352       var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>');
5353       var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<');
5354       var sameSemVer = this.semver.version === comp.semver.version;
5355       var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<=');
5356       var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<');
5357       var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>');
5358       return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
5359     };
5360
5361     exports.Range = Range;
5362
5363     function Range(range, options) {
5364       if (!options || _typeof(options) !== 'object') {
5365         options = {
5366           loose: !!options,
5367           includePrerelease: false
5368         };
5369       }
5370
5371       if (range instanceof Range) {
5372         if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
5373           return range;
5374         } else {
5375           return new Range(range.raw, options);
5376         }
5377       }
5378
5379       if (range instanceof Comparator) {
5380         return new Range(range.value, options);
5381       }
5382
5383       if (!(this instanceof Range)) {
5384         return new Range(range, options);
5385       }
5386
5387       this.options = options;
5388       this.loose = !!options.loose;
5389       this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or ||
5390
5391       this.raw = range;
5392       this.set = range.split(/\s*\|\|\s*/).map(function (range) {
5393         return this.parseRange(range.trim());
5394       }, this).filter(function (c) {
5395         // throw out any that are not relevant for whatever reason
5396         return c.length;
5397       });
5398
5399       if (!this.set.length) {
5400         throw new TypeError('Invalid SemVer Range: ' + range);
5401       }
5402
5403       this.format();
5404     }
5405
5406     Range.prototype.format = function () {
5407       this.range = this.set.map(function (comps) {
5408         return comps.join(' ').trim();
5409       }).join('||').trim();
5410       return this.range;
5411     };
5412
5413     Range.prototype.toString = function () {
5414       return this.range;
5415     };
5416
5417     Range.prototype.parseRange = function (range) {
5418       var loose = this.options.loose;
5419       range = range.trim(); // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
5420
5421       var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
5422       range = range.replace(hr, hyphenReplace);
5423       debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
5424
5425       range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
5426       debug('comparator trim', range, re[t.COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3`
5427
5428       range = range.replace(re[t.TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3`
5429
5430       range = range.replace(re[t.CARETTRIM], caretTrimReplace); // normalize spaces
5431
5432       range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and
5433       // ready to be split into comparators.
5434
5435       var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
5436       var set = range.split(' ').map(function (comp) {
5437         return parseComparator(comp, this.options);
5438       }, this).join(' ').split(/\s+/);
5439
5440       if (this.options.loose) {
5441         // in loose mode, throw out any that are not valid comparators
5442         set = set.filter(function (comp) {
5443           return !!comp.match(compRe);
5444         });
5445       }
5446
5447       set = set.map(function (comp) {
5448         return new Comparator(comp, this.options);
5449       }, this);
5450       return set;
5451     };
5452
5453     Range.prototype.intersects = function (range, options) {
5454       if (!(range instanceof Range)) {
5455         throw new TypeError('a Range is required');
5456       }
5457
5458       return this.set.some(function (thisComparators) {
5459         return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) {
5460           return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) {
5461             return rangeComparators.every(function (rangeComparator) {
5462               return thisComparator.intersects(rangeComparator, options);
5463             });
5464           });
5465         });
5466       });
5467     }; // take a set of comparators and determine whether there
5468     // exists a version which can satisfy it
5469
5470
5471     function isSatisfiable(comparators, options) {
5472       var result = true;
5473       var remainingComparators = comparators.slice();
5474       var testComparator = remainingComparators.pop();
5475
5476       while (result && remainingComparators.length) {
5477         result = remainingComparators.every(function (otherComparator) {
5478           return testComparator.intersects(otherComparator, options);
5479         });
5480         testComparator = remainingComparators.pop();
5481       }
5482
5483       return result;
5484     } // Mostly just for testing and legacy API reasons
5485
5486
5487     exports.toComparators = toComparators;
5488
5489     function toComparators(range, options) {
5490       return new Range(range, options).set.map(function (comp) {
5491         return comp.map(function (c) {
5492           return c.value;
5493         }).join(' ').trim().split(' ');
5494       });
5495     } // comprised of xranges, tildes, stars, and gtlt's at this point.
5496     // already replaced the hyphen ranges
5497     // turn into a set of JUST comparators.
5498
5499
5500     function parseComparator(comp, options) {
5501       debug('comp', comp, options);
5502       comp = replaceCarets(comp, options);
5503       debug('caret', comp);
5504       comp = replaceTildes(comp, options);
5505       debug('tildes', comp);
5506       comp = replaceXRanges(comp, options);
5507       debug('xrange', comp);
5508       comp = replaceStars(comp, options);
5509       debug('stars', comp);
5510       return comp;
5511     }
5512
5513     function isX(id) {
5514       return !id || id.toLowerCase() === 'x' || id === '*';
5515     } // ~, ~> --> * (any, kinda silly)
5516     // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0
5517     // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0
5518     // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
5519     // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
5520     // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
5521
5522
5523     function replaceTildes(comp, options) {
5524       return comp.trim().split(/\s+/).map(function (comp) {
5525         return replaceTilde(comp, options);
5526       }).join(' ');
5527     }
5528
5529     function replaceTilde(comp, options) {
5530       var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
5531       return comp.replace(r, function (_, M, m, p, pr) {
5532         debug('tilde', comp, _, M, m, p, pr);
5533         var ret;
5534
5535         if (isX(M)) {
5536           ret = '';
5537         } else if (isX(m)) {
5538           ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
5539         } else if (isX(p)) {
5540           // ~1.2 == >=1.2.0 <1.3.0
5541           ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
5542         } else if (pr) {
5543           debug('replaceTilde pr', pr);
5544           ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
5545         } else {
5546           // ~1.2.3 == >=1.2.3 <1.3.0
5547           ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
5548         }
5549
5550         debug('tilde return', ret);
5551         return ret;
5552       });
5553     } // ^ --> * (any, kinda silly)
5554     // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0
5555     // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0
5556     // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
5557     // ^1.2.3 --> >=1.2.3 <2.0.0
5558     // ^1.2.0 --> >=1.2.0 <2.0.0
5559
5560
5561     function replaceCarets(comp, options) {
5562       return comp.trim().split(/\s+/).map(function (comp) {
5563         return replaceCaret(comp, options);
5564       }).join(' ');
5565     }
5566
5567     function replaceCaret(comp, options) {
5568       debug('caret', comp, options);
5569       var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
5570       return comp.replace(r, function (_, M, m, p, pr) {
5571         debug('caret', comp, _, M, m, p, pr);
5572         var ret;
5573
5574         if (isX(M)) {
5575           ret = '';
5576         } else if (isX(m)) {
5577           ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0';
5578         } else if (isX(p)) {
5579           if (M === '0') {
5580             ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0';
5581           } else {
5582             ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0';
5583           }
5584         } else if (pr) {
5585           debug('replaceCaret pr', pr);
5586
5587           if (M === '0') {
5588             if (m === '0') {
5589               ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1);
5590             } else {
5591               ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0';
5592             }
5593           } else {
5594             ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0';
5595           }
5596         } else {
5597           debug('no pr');
5598
5599           if (M === '0') {
5600             if (m === '0') {
5601               ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1);
5602             } else {
5603               ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0';
5604             }
5605           } else {
5606             ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0';
5607           }
5608         }
5609
5610         debug('caret return', ret);
5611         return ret;
5612       });
5613     }
5614
5615     function replaceXRanges(comp, options) {
5616       debug('replaceXRanges', comp, options);
5617       return comp.split(/\s+/).map(function (comp) {
5618         return replaceXRange(comp, options);
5619       }).join(' ');
5620     }
5621
5622     function replaceXRange(comp, options) {
5623       comp = comp.trim();
5624       var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
5625       return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
5626         debug('xRange', comp, ret, gtlt, M, m, p, pr);
5627         var xM = isX(M);
5628         var xm = xM || isX(m);
5629         var xp = xm || isX(p);
5630         var anyX = xp;
5631
5632         if (gtlt === '=' && anyX) {
5633           gtlt = '';
5634         } // if we're including prereleases in the match, then we need
5635         // to fix this to -0, the lowest possible prerelease value
5636
5637
5638         pr = options.includePrerelease ? '-0' : '';
5639
5640         if (xM) {
5641           if (gtlt === '>' || gtlt === '<') {
5642             // nothing is allowed
5643             ret = '<0.0.0-0';
5644           } else {
5645             // nothing is forbidden
5646             ret = '*';
5647           }
5648         } else if (gtlt && anyX) {
5649           // we know patch is an x, because we have any x at all.
5650           // replace X with 0
5651           if (xm) {
5652             m = 0;
5653           }
5654
5655           p = 0;
5656
5657           if (gtlt === '>') {
5658             // >1 => >=2.0.0
5659             // >1.2 => >=1.3.0
5660             // >1.2.3 => >= 1.2.4
5661             gtlt = '>=';
5662
5663             if (xm) {
5664               M = +M + 1;
5665               m = 0;
5666               p = 0;
5667             } else {
5668               m = +m + 1;
5669               p = 0;
5670             }
5671           } else if (gtlt === '<=') {
5672             // <=0.7.x is actually <0.8.0, since any 0.7.x should
5673             // pass.  Similarly, <=7.x is actually <8.0.0, etc.
5674             gtlt = '<';
5675
5676             if (xm) {
5677               M = +M + 1;
5678             } else {
5679               m = +m + 1;
5680             }
5681           }
5682
5683           ret = gtlt + M + '.' + m + '.' + p + pr;
5684         } else if (xm) {
5685           ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr;
5686         } else if (xp) {
5687           ret = '>=' + M + '.' + m + '.0' + pr + ' <' + M + '.' + (+m + 1) + '.0' + pr;
5688         }
5689
5690         debug('xRange return', ret);
5691         return ret;
5692       });
5693     } // Because * is AND-ed with everything else in the comparator,
5694     // and '' means "any version", just remove the *s entirely.
5695
5696
5697     function replaceStars(comp, options) {
5698       debug('replaceStars', comp, options); // Looseness is ignored here.  star is always as loose as it gets!
5699
5700       return comp.trim().replace(re[t.STAR], '');
5701     } // This function is passed to string.replace(re[t.HYPHENRANGE])
5702     // M, m, patch, prerelease, build
5703     // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
5704     // 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do
5705     // 1.2 - 3.4 => >=1.2.0 <3.5.0
5706
5707
5708     function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) {
5709       if (isX(fM)) {
5710         from = '';
5711       } else if (isX(fm)) {
5712         from = '>=' + fM + '.0.0';
5713       } else if (isX(fp)) {
5714         from = '>=' + fM + '.' + fm + '.0';
5715       } else {
5716         from = '>=' + from;
5717       }
5718
5719       if (isX(tM)) {
5720         to = '';
5721       } else if (isX(tm)) {
5722         to = '<' + (+tM + 1) + '.0.0';
5723       } else if (isX(tp)) {
5724         to = '<' + tM + '.' + (+tm + 1) + '.0';
5725       } else if (tpr) {
5726         to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr;
5727       } else {
5728         to = '<=' + to;
5729       }
5730
5731       return (from + ' ' + to).trim();
5732     } // if ANY of the sets match ALL of its comparators, then pass
5733
5734
5735     Range.prototype.test = function (version) {
5736       if (!version) {
5737         return false;
5738       }
5739
5740       if (typeof version === 'string') {
5741         try {
5742           version = new SemVer(version, this.options);
5743         } catch (er) {
5744           return false;
5745         }
5746       }
5747
5748       for (var i = 0; i < this.set.length; i++) {
5749         if (testSet(this.set[i], version, this.options)) {
5750           return true;
5751         }
5752       }
5753
5754       return false;
5755     };
5756
5757     function testSet(set, version, options) {
5758       for (var i = 0; i < set.length; i++) {
5759         if (!set[i].test(version)) {
5760           return false;
5761         }
5762       }
5763
5764       if (version.prerelease.length && !options.includePrerelease) {
5765         // Find the set of versions that are allowed to have prereleases
5766         // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
5767         // That should allow `1.2.3-pr.2` to pass.
5768         // However, `1.2.4-alpha.notready` should NOT be allowed,
5769         // even though it's within the range set by the comparators.
5770         for (i = 0; i < set.length; i++) {
5771           debug(set[i].semver);
5772
5773           if (set[i].semver === ANY) {
5774             continue;
5775           }
5776
5777           if (set[i].semver.prerelease.length > 0) {
5778             var allowed = set[i].semver;
5779
5780             if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
5781               return true;
5782             }
5783           }
5784         } // Version has a -pre, but it's not one of the ones we like.
5785
5786
5787         return false;
5788       }
5789
5790       return true;
5791     }
5792
5793     exports.satisfies = satisfies;
5794
5795     function satisfies(version, range, options) {
5796       try {
5797         range = new Range(range, options);
5798       } catch (er) {
5799         return false;
5800       }
5801
5802       return range.test(version);
5803     }
5804
5805     exports.maxSatisfying = maxSatisfying;
5806
5807     function maxSatisfying(versions, range, options) {
5808       var max = null;
5809       var maxSV = null;
5810
5811       try {
5812         var rangeObj = new Range(range, options);
5813       } catch (er) {
5814         return null;
5815       }
5816
5817       versions.forEach(function (v) {
5818         if (rangeObj.test(v)) {
5819           // satisfies(v, range, options)
5820           if (!max || maxSV.compare(v) === -1) {
5821             // compare(max, v, true)
5822             max = v;
5823             maxSV = new SemVer(max, options);
5824           }
5825         }
5826       });
5827       return max;
5828     }
5829
5830     exports.minSatisfying = minSatisfying;
5831
5832     function minSatisfying(versions, range, options) {
5833       var min = null;
5834       var minSV = null;
5835
5836       try {
5837         var rangeObj = new Range(range, options);
5838       } catch (er) {
5839         return null;
5840       }
5841
5842       versions.forEach(function (v) {
5843         if (rangeObj.test(v)) {
5844           // satisfies(v, range, options)
5845           if (!min || minSV.compare(v) === 1) {
5846             // compare(min, v, true)
5847             min = v;
5848             minSV = new SemVer(min, options);
5849           }
5850         }
5851       });
5852       return min;
5853     }
5854
5855     exports.minVersion = minVersion;
5856
5857     function minVersion(range, loose) {
5858       range = new Range(range, loose);
5859       var minver = new SemVer('0.0.0');
5860
5861       if (range.test(minver)) {
5862         return minver;
5863       }
5864
5865       minver = new SemVer('0.0.0-0');
5866
5867       if (range.test(minver)) {
5868         return minver;
5869       }
5870
5871       minver = null;
5872
5873       for (var i = 0; i < range.set.length; ++i) {
5874         var comparators = range.set[i];
5875         comparators.forEach(function (comparator) {
5876           // Clone to avoid manipulating the comparator's semver object.
5877           var compver = new SemVer(comparator.semver.version);
5878
5879           switch (comparator.operator) {
5880             case '>':
5881               if (compver.prerelease.length === 0) {
5882                 compver.patch++;
5883               } else {
5884                 compver.prerelease.push(0);
5885               }
5886
5887               compver.raw = compver.format();
5888
5889             /* fallthrough */
5890
5891             case '':
5892             case '>=':
5893               if (!minver || gt(minver, compver)) {
5894                 minver = compver;
5895               }
5896
5897               break;
5898
5899             case '<':
5900             case '<=':
5901               /* Ignore maximum versions */
5902               break;
5903
5904             /* istanbul ignore next */
5905
5906             default:
5907               throw new Error('Unexpected operation: ' + comparator.operator);
5908           }
5909         });
5910       }
5911
5912       if (minver && range.test(minver)) {
5913         return minver;
5914       }
5915
5916       return null;
5917     }
5918
5919     exports.validRange = validRange;
5920
5921     function validRange(range, options) {
5922       try {
5923         // Return '*' instead of '' so that truthiness works.
5924         // This will throw if it's invalid anyway
5925         return new Range(range, options).range || '*';
5926       } catch (er) {
5927         return null;
5928       }
5929     } // Determine if version is less than all the versions possible in the range
5930
5931
5932     exports.ltr = ltr;
5933
5934     function ltr(version, range, options) {
5935       return outside(version, range, '<', options);
5936     } // Determine if version is greater than all the versions possible in the range.
5937
5938
5939     exports.gtr = gtr;
5940
5941     function gtr(version, range, options) {
5942       return outside(version, range, '>', options);
5943     }
5944
5945     exports.outside = outside;
5946
5947     function outside(version, range, hilo, options) {
5948       version = new SemVer(version, options);
5949       range = new Range(range, options);
5950       var gtfn, ltefn, ltfn, comp, ecomp;
5951
5952       switch (hilo) {
5953         case '>':
5954           gtfn = gt;
5955           ltefn = lte;
5956           ltfn = lt;
5957           comp = '>';
5958           ecomp = '>=';
5959           break;
5960
5961         case '<':
5962           gtfn = lt;
5963           ltefn = gte;
5964           ltfn = gt;
5965           comp = '<';
5966           ecomp = '<=';
5967           break;
5968
5969         default:
5970           throw new TypeError('Must provide a hilo val of "<" or ">"');
5971       } // If it satisifes the range it is not outside
5972
5973
5974       if (satisfies(version, range, options)) {
5975         return false;
5976       } // From now on, variable terms are as if we're in "gtr" mode.
5977       // but note that everything is flipped for the "ltr" function.
5978
5979
5980       for (var i = 0; i < range.set.length; ++i) {
5981         var comparators = range.set[i];
5982         var high = null;
5983         var low = null;
5984         comparators.forEach(function (comparator) {
5985           if (comparator.semver === ANY) {
5986             comparator = new Comparator('>=0.0.0');
5987           }
5988
5989           high = high || comparator;
5990           low = low || comparator;
5991
5992           if (gtfn(comparator.semver, high.semver, options)) {
5993             high = comparator;
5994           } else if (ltfn(comparator.semver, low.semver, options)) {
5995             low = comparator;
5996           }
5997         }); // If the edge version comparator has a operator then our version
5998         // isn't outside it
5999
6000         if (high.operator === comp || high.operator === ecomp) {
6001           return false;
6002         } // If the lowest version comparator has an operator and our version
6003         // is less than it then it isn't higher than the range
6004
6005
6006         if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
6007           return false;
6008         } else if (low.operator === ecomp && ltfn(version, low.semver)) {
6009           return false;
6010         }
6011       }
6012
6013       return true;
6014     }
6015
6016     exports.prerelease = prerelease;
6017
6018     function prerelease(version, options) {
6019       var parsed = parse(version, options);
6020       return parsed && parsed.prerelease.length ? parsed.prerelease : null;
6021     }
6022
6023     exports.intersects = intersects;
6024
6025     function intersects(r1, r2, options) {
6026       r1 = new Range(r1, options);
6027       r2 = new Range(r2, options);
6028       return r1.intersects(r2);
6029     }
6030
6031     exports.coerce = coerce;
6032
6033     function coerce(version, options) {
6034       if (version instanceof SemVer) {
6035         return version;
6036       }
6037
6038       if (typeof version === 'number') {
6039         version = String(version);
6040       }
6041
6042       if (typeof version !== 'string') {
6043         return null;
6044       }
6045
6046       options = options || {};
6047       var match = null;
6048
6049       if (!options.rtl) {
6050         match = version.match(re[t.COERCE]);
6051       } else {
6052         // Find the right-most coercible string that does not share
6053         // a terminus with a more left-ward coercible string.
6054         // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
6055         //
6056         // Walk through the string checking with a /g regexp
6057         // Manually set the index so as to pick up overlapping matches.
6058         // Stop when we get a match that ends at the string end, since no
6059         // coercible string can be more right-ward without the same terminus.
6060         var next;
6061
6062         while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
6063           if (!match || next.index + next[0].length !== match.index + match[0].length) {
6064             match = next;
6065           }
6066
6067           re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
6068         } // leave it in a clean state
6069
6070
6071         re[t.COERCERTL].lastIndex = -1;
6072       }
6073
6074       if (match === null) {
6075         return null;
6076       }
6077
6078       return parse(match[2] + '.' + (match[3] || '0') + '.' + (match[4] || '0'), options);
6079     }
6080   });
6081   var semver_1 = semver.SEMVER_SPEC_VERSION;
6082   var semver_2 = semver.re;
6083   var semver_3 = semver.src;
6084   var semver_4 = semver.tokens;
6085   var semver_5 = semver.parse;
6086   var semver_6 = semver.valid;
6087   var semver_7 = semver.clean;
6088   var semver_8 = semver.SemVer;
6089   var semver_9 = semver.inc;
6090   var semver_10 = semver.diff;
6091   var semver_11 = semver.compareIdentifiers;
6092   var semver_12 = semver.rcompareIdentifiers;
6093   var semver_13 = semver.major;
6094   var semver_14 = semver.minor;
6095   var semver_15 = semver.patch;
6096   var semver_16 = semver.compare;
6097   var semver_17 = semver.compareLoose;
6098   var semver_18 = semver.compareBuild;
6099   var semver_19 = semver.rcompare;
6100   var semver_20 = semver.sort;
6101   var semver_21 = semver.rsort;
6102   var semver_22 = semver.gt;
6103   var semver_23 = semver.lt;
6104   var semver_24 = semver.eq;
6105   var semver_25 = semver.neq;
6106   var semver_26 = semver.gte;
6107   var semver_27 = semver.lte;
6108   var semver_28 = semver.cmp;
6109   var semver_29 = semver.Comparator;
6110   var semver_30 = semver.Range;
6111   var semver_31 = semver.toComparators;
6112   var semver_32 = semver.satisfies;
6113   var semver_33 = semver.maxSatisfying;
6114   var semver_34 = semver.minSatisfying;
6115   var semver_35 = semver.minVersion;
6116   var semver_36 = semver.validRange;
6117   var semver_37 = semver.ltr;
6118   var semver_38 = semver.gtr;
6119   var semver_39 = semver.outside;
6120   var semver_40 = semver.prerelease;
6121   var semver_41 = semver.intersects;
6122   var semver_42 = semver.coerce;
6123
6124   var arrayify = function arrayify(object, keyName) {
6125     return Object.keys(object).reduce(function (array, key) {
6126       return array.concat(Object.assign(_defineProperty({}, keyName, key), object[key]));
6127     }, []);
6128   };
6129
6130   var dedent_1 = createCommonjsModule(function (module) {
6131
6132     function dedent(strings) {
6133       var raw = void 0;
6134
6135       if (typeof strings === "string") {
6136         // dedent can be used as a plain function
6137         raw = [strings];
6138       } else {
6139         raw = strings.raw;
6140       } // first, perform interpolation
6141
6142
6143       var result = "";
6144
6145       for (var i = 0; i < raw.length; i++) {
6146         result += raw[i]. // join lines when there is a suppressed newline
6147         replace(/\\\n[ \t]*/g, ""). // handle escaped backticks
6148         replace(/\\`/g, "`");
6149
6150         if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
6151           result += arguments.length <= i + 1 ? undefined : arguments[i + 1];
6152         }
6153       } // now strip indentation
6154
6155
6156       var lines = result.split("\n");
6157       var mindent = null;
6158       lines.forEach(function (l) {
6159         var m = l.match(/^(\s+)\S+/);
6160
6161         if (m) {
6162           var indent = m[1].length;
6163
6164           if (!mindent) {
6165             // this is the first indented line
6166             mindent = indent;
6167           } else {
6168             mindent = Math.min(mindent, indent);
6169           }
6170         }
6171       });
6172
6173       if (mindent !== null) {
6174         result = lines.map(function (l) {
6175           return l[0] === " " ? l.slice(mindent) : l;
6176         }).join("\n");
6177       } // dedent eats leading and trailing whitespace too
6178
6179
6180       result = result.trim(); // handle escaped newlines at the end to ensure they don't get stripped too
6181
6182       return result.replace(/\\n/g, "\n");
6183     }
6184
6185     {
6186       module.exports = dedent;
6187     }
6188   });
6189
6190   function _templateObject6() {
6191     var data = _taggedTemplateLiteral(["\n      Require either '@prettier' or '@format' to be present in the file's first docblock comment\n      in order for it to be formatted.\n    "]);
6192
6193     _templateObject6 = function _templateObject6() {
6194       return data;
6195     };
6196
6197     return data;
6198   }
6199
6200   function _templateObject5() {
6201     var data = _taggedTemplateLiteral(["\n      Format code starting at a given character offset.\n      The range will extend backwards to the start of the first line containing the selected statement.\n      This option cannot be used with --cursor-offset.\n    "]);
6202
6203     _templateObject5 = function _templateObject5() {
6204       return data;
6205     };
6206
6207     return data;
6208   }
6209
6210   function _templateObject4() {
6211     var data = _taggedTemplateLiteral(["\n      Format code ending at a given character offset (exclusive).\n      The range will extend forwards to the end of the selected statement.\n      This option cannot be used with --cursor-offset.\n    "]);
6212
6213     _templateObject4 = function _templateObject4() {
6214       return data;
6215     };
6216
6217     return data;
6218   }
6219
6220   function _templateObject3() {
6221     var data = _taggedTemplateLiteral(["\n      Custom directory that contains prettier plugins in node_modules subdirectory.\n      Overrides default behavior when plugins are searched relatively to the location of Prettier.\n      Multiple values are accepted.\n    "]);
6222
6223     _templateObject3 = function _templateObject3() {
6224       return data;
6225     };
6226
6227     return data;
6228   }
6229
6230   function _templateObject2() {
6231     var data = _taggedTemplateLiteral(["\n          Maintain existing\n          (mixed values within one file are normalised by looking at what's used after the first line)\n        "]);
6232
6233     _templateObject2 = function _templateObject2() {
6234       return data;
6235     };
6236
6237     return data;
6238   }
6239
6240   function _templateObject() {
6241     var data = _taggedTemplateLiteral(["\n      Print (to stderr) where a cursor at the given position would move to after formatting.\n      This option cannot be used with --range-start and --range-end.\n    "]);
6242
6243     _templateObject = function _templateObject() {
6244       return data;
6245     };
6246
6247     return data;
6248   }
6249
6250   var CATEGORY_CONFIG = "Config";
6251   var CATEGORY_EDITOR = "Editor";
6252   var CATEGORY_FORMAT = "Format";
6253   var CATEGORY_OTHER = "Other";
6254   var CATEGORY_OUTPUT = "Output";
6255   var CATEGORY_GLOBAL = "Global";
6256   var CATEGORY_SPECIAL = "Special";
6257   /**
6258    * @typedef {Object} OptionInfo
6259    * @property {string} [since] - available since version
6260    * @property {string} category
6261    * @property {'int' | 'boolean' | 'choice' | 'path'} type
6262    * @property {boolean} [array] - indicate it's an array of the specified type
6263    * @property {OptionValueInfo} [default]
6264    * @property {OptionRangeInfo} [range] - for type int
6265    * @property {string} description
6266    * @property {string} [deprecated] - deprecated since version
6267    * @property {OptionRedirectInfo} [redirect] - redirect deprecated option
6268    * @property {(value: any) => boolean} [exception]
6269    * @property {OptionChoiceInfo[]} [choices] - for type choice
6270    * @property {string} [cliName]
6271    * @property {string} [cliCategory]
6272    * @property {string} [cliDescription]
6273    *
6274    * @typedef {number | boolean | string} OptionValue
6275    * @typedef {OptionValue | [{ value: OptionValue[] }] | Array<{ since: string, value: OptionValue}>} OptionValueInfo
6276    *
6277    * @typedef {Object} OptionRedirectInfo
6278    * @property {string} option
6279    * @property {OptionValue} value
6280    *
6281    * @typedef {Object} OptionRangeInfo
6282    * @property {number} start - recommended range start
6283    * @property {number} end - recommended range end
6284    * @property {number} step - recommended range step
6285    *
6286    * @typedef {Object} OptionChoiceInfo
6287    * @property {boolean | string} value - boolean for the option that is originally boolean type
6288    * @property {string} description
6289    * @property {string} [since] - undefined if available since the first version of the option
6290    * @property {string} [deprecated] - deprecated since version
6291    * @property {OptionValueInfo} [redirect] - redirect deprecated value
6292    */
6293
6294   /** @type {{ [name: string]: OptionInfo }} */
6295
6296   var options = {
6297     cursorOffset: {
6298       since: "1.4.0",
6299       category: CATEGORY_SPECIAL,
6300       type: "int",
6301       default: -1,
6302       range: {
6303         start: -1,
6304         end: Infinity,
6305         step: 1
6306       },
6307       description: dedent_1(_templateObject()),
6308       cliCategory: CATEGORY_EDITOR
6309     },
6310     endOfLine: {
6311       since: "1.15.0",
6312       category: CATEGORY_GLOBAL,
6313       type: "choice",
6314       default: "auto",
6315       description: "Which end of line characters to apply.",
6316       choices: [{
6317         value: "auto",
6318         description: dedent_1(_templateObject2())
6319       }, {
6320         value: "lf",
6321         description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
6322       }, {
6323         value: "crlf",
6324         description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
6325       }, {
6326         value: "cr",
6327         description: "Carriage Return character only (\\r), used very rarely"
6328       }]
6329     },
6330     filepath: {
6331       since: "1.4.0",
6332       category: CATEGORY_SPECIAL,
6333       type: "path",
6334       description: "Specify the input filepath. This will be used to do parser inference.",
6335       cliName: "stdin-filepath",
6336       cliCategory: CATEGORY_OTHER,
6337       cliDescription: "Path to the file to pretend that stdin comes from."
6338     },
6339     insertPragma: {
6340       since: "1.8.0",
6341       category: CATEGORY_SPECIAL,
6342       type: "boolean",
6343       default: false,
6344       description: "Insert @format pragma into file's first docblock comment.",
6345       cliCategory: CATEGORY_OTHER
6346     },
6347     parser: {
6348       since: "0.0.10",
6349       category: CATEGORY_GLOBAL,
6350       type: "choice",
6351       default: [{
6352         since: "0.0.10",
6353         value: "babylon"
6354       }, {
6355         since: "1.13.0",
6356         value: undefined
6357       }],
6358       description: "Which parser to use.",
6359       exception: function exception(value) {
6360         return typeof value === "string" || typeof value === "function";
6361       },
6362       choices: [{
6363         value: "flow",
6364         description: "Flow"
6365       }, {
6366         value: "babylon",
6367         description: "JavaScript",
6368         deprecated: "1.16.0",
6369         redirect: "babel"
6370       }, {
6371         value: "babel",
6372         since: "1.16.0",
6373         description: "JavaScript"
6374       }, {
6375         value: "babel-flow",
6376         since: "1.16.0",
6377         description: "Flow"
6378       }, {
6379         value: "typescript",
6380         since: "1.4.0",
6381         description: "TypeScript"
6382       }, {
6383         value: "css",
6384         since: "1.7.1",
6385         description: "CSS"
6386       }, {
6387         value: "postcss",
6388         since: "1.4.0",
6389         description: "CSS/Less/SCSS",
6390         deprecated: "1.7.1",
6391         redirect: "css"
6392       }, {
6393         value: "less",
6394         since: "1.7.1",
6395         description: "Less"
6396       }, {
6397         value: "scss",
6398         since: "1.7.1",
6399         description: "SCSS"
6400       }, {
6401         value: "json",
6402         since: "1.5.0",
6403         description: "JSON"
6404       }, {
6405         value: "json5",
6406         since: "1.13.0",
6407         description: "JSON5"
6408       }, {
6409         value: "json-stringify",
6410         since: "1.13.0",
6411         description: "JSON.stringify"
6412       }, {
6413         value: "graphql",
6414         since: "1.5.0",
6415         description: "GraphQL"
6416       }, {
6417         value: "markdown",
6418         since: "1.8.0",
6419         description: "Markdown"
6420       }, {
6421         value: "mdx",
6422         since: "1.15.0",
6423         description: "MDX"
6424       }, {
6425         value: "vue",
6426         since: "1.10.0",
6427         description: "Vue"
6428       }, {
6429         value: "yaml",
6430         since: "1.14.0",
6431         description: "YAML"
6432       }, {
6433         value: "glimmer",
6434         since: null,
6435         description: "Handlebars"
6436       }, {
6437         value: "html",
6438         since: "1.15.0",
6439         description: "HTML"
6440       }, {
6441         value: "angular",
6442         since: "1.15.0",
6443         description: "Angular"
6444       }, {
6445         value: "lwc",
6446         since: "1.17.0",
6447         description: "Lightning Web Components"
6448       }]
6449     },
6450     plugins: {
6451       since: "1.10.0",
6452       type: "path",
6453       array: true,
6454       default: [{
6455         value: []
6456       }],
6457       category: CATEGORY_GLOBAL,
6458       description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
6459       exception: function exception(value) {
6460         return typeof value === "string" || _typeof(value) === "object";
6461       },
6462       cliName: "plugin",
6463       cliCategory: CATEGORY_CONFIG
6464     },
6465     pluginSearchDirs: {
6466       since: "1.13.0",
6467       type: "path",
6468       array: true,
6469       default: [{
6470         value: []
6471       }],
6472       category: CATEGORY_GLOBAL,
6473       description: dedent_1(_templateObject3()),
6474       exception: function exception(value) {
6475         return typeof value === "string" || _typeof(value) === "object";
6476       },
6477       cliName: "plugin-search-dir",
6478       cliCategory: CATEGORY_CONFIG
6479     },
6480     printWidth: {
6481       since: "0.0.0",
6482       category: CATEGORY_GLOBAL,
6483       type: "int",
6484       default: 80,
6485       description: "The line length where Prettier will try wrap.",
6486       range: {
6487         start: 0,
6488         end: Infinity,
6489         step: 1
6490       }
6491     },
6492     rangeEnd: {
6493       since: "1.4.0",
6494       category: CATEGORY_SPECIAL,
6495       type: "int",
6496       default: Infinity,
6497       range: {
6498         start: 0,
6499         end: Infinity,
6500         step: 1
6501       },
6502       description: dedent_1(_templateObject4()),
6503       cliCategory: CATEGORY_EDITOR
6504     },
6505     rangeStart: {
6506       since: "1.4.0",
6507       category: CATEGORY_SPECIAL,
6508       type: "int",
6509       default: 0,
6510       range: {
6511         start: 0,
6512         end: Infinity,
6513         step: 1
6514       },
6515       description: dedent_1(_templateObject5()),
6516       cliCategory: CATEGORY_EDITOR
6517     },
6518     requirePragma: {
6519       since: "1.7.0",
6520       category: CATEGORY_SPECIAL,
6521       type: "boolean",
6522       default: false,
6523       description: dedent_1(_templateObject6()),
6524       cliCategory: CATEGORY_OTHER
6525     },
6526     tabWidth: {
6527       type: "int",
6528       category: CATEGORY_GLOBAL,
6529       default: 2,
6530       description: "Number of spaces per indentation level.",
6531       range: {
6532         start: 0,
6533         end: Infinity,
6534         step: 1
6535       }
6536     },
6537     useFlowParser: {
6538       since: "0.0.0",
6539       category: CATEGORY_GLOBAL,
6540       type: "boolean",
6541       default: [{
6542         since: "0.0.0",
6543         value: false
6544       }, {
6545         since: "1.15.0",
6546         value: undefined
6547       }],
6548       deprecated: "0.0.10",
6549       description: "Use flow parser.",
6550       redirect: {
6551         option: "parser",
6552         value: "flow"
6553       },
6554       cliName: "flow-parser"
6555     },
6556     useTabs: {
6557       since: "1.0.0",
6558       category: CATEGORY_GLOBAL,
6559       type: "boolean",
6560       default: false,
6561       description: "Indent with tabs instead of spaces."
6562     }
6563   };
6564   var coreOptions = {
6565     CATEGORY_CONFIG: CATEGORY_CONFIG,
6566     CATEGORY_EDITOR: CATEGORY_EDITOR,
6567     CATEGORY_FORMAT: CATEGORY_FORMAT,
6568     CATEGORY_OTHER: CATEGORY_OTHER,
6569     CATEGORY_OUTPUT: CATEGORY_OUTPUT,
6570     CATEGORY_GLOBAL: CATEGORY_GLOBAL,
6571     CATEGORY_SPECIAL: CATEGORY_SPECIAL,
6572     options: options
6573   };
6574
6575   var require$$0 = getCjsExportFromNamespace(_package$1);
6576
6577   var currentVersion = require$$0.version;
6578   var coreOptions$1 = coreOptions.options;
6579
6580   function getSupportInfo(version, opts) {
6581     opts = Object.assign({
6582       plugins: [],
6583       showUnreleased: false,
6584       showDeprecated: false,
6585       showInternal: false
6586     }, opts);
6587
6588     if (!version) {
6589       // pre-release version is smaller than the normal version in semver,
6590       // we need to treat it as the normal one so as to test new features.
6591       version = currentVersion.split("-", 1)[0];
6592     }
6593
6594     var plugins = opts.plugins;
6595     var options = arrayify(Object.assign(plugins.reduce(function (currentOptions, plugin) {
6596       return Object.assign(currentOptions, plugin.options);
6597     }, {}), coreOptions$1), "name").sort(function (a, b) {
6598       return a.name === b.name ? 0 : a.name < b.name ? -1 : 1;
6599     }).filter(filterSince).filter(filterDeprecated).map(mapDeprecated).map(mapInternal).map(function (option) {
6600       var newOption = Object.assign({}, option);
6601
6602       if (Array.isArray(newOption.default)) {
6603         newOption.default = newOption.default.length === 1 ? newOption.default[0].value : newOption.default.filter(filterSince).sort(function (info1, info2) {
6604           return semver.compare(info2.since, info1.since);
6605         })[0].value;
6606       }
6607
6608       if (Array.isArray(newOption.choices)) {
6609         newOption.choices = newOption.choices.filter(filterSince).filter(filterDeprecated).map(mapDeprecated);
6610       }
6611
6612       return newOption;
6613     }).map(function (option) {
6614       var filteredPlugins = plugins.filter(function (plugin) {
6615         return plugin.defaultOptions && plugin.defaultOptions[option.name] !== undefined;
6616       });
6617       var pluginDefaults = filteredPlugins.reduce(function (reduced, plugin) {
6618         reduced[plugin.name] = plugin.defaultOptions[option.name];
6619         return reduced;
6620       }, {});
6621       return Object.assign(option, {
6622         pluginDefaults: pluginDefaults
6623       });
6624     });
6625     var usePostCssParser = semver.lt(version, "1.7.1");
6626     var useBabylonParser = semver.lt(version, "1.16.0");
6627     var languages = plugins.reduce(function (all, plugin) {
6628       return all.concat(plugin.languages || []);
6629     }, []).filter(filterSince).map(function (language) {
6630       // Prevent breaking changes
6631       if (language.name === "Markdown") {
6632         return Object.assign({}, language, {
6633           parsers: ["markdown"]
6634         });
6635       }
6636
6637       if (language.name === "TypeScript") {
6638         return Object.assign({}, language, {
6639           parsers: ["typescript"]
6640         });
6641       } // "babylon" was renamed to "babel" in 1.16.0
6642
6643
6644       if (useBabylonParser && language.parsers.indexOf("babel") !== -1) {
6645         return Object.assign({}, language, {
6646           parsers: language.parsers.map(function (parser) {
6647             return parser === "babel" ? "babylon" : parser;
6648           })
6649         });
6650       }
6651
6652       if (usePostCssParser && (language.name === "CSS" || language.group === "CSS")) {
6653         return Object.assign({}, language, {
6654           parsers: ["postcss"]
6655         });
6656       }
6657
6658       return language;
6659     });
6660     return {
6661       languages: languages,
6662       options: options
6663     };
6664
6665     function filterSince(object) {
6666       return opts.showUnreleased || !("since" in object) || object.since && semver.gte(version, object.since);
6667     }
6668
6669     function filterDeprecated(object) {
6670       return opts.showDeprecated || !("deprecated" in object) || object.deprecated && semver.lt(version, object.deprecated);
6671     }
6672
6673     function mapDeprecated(object) {
6674       if (!object.deprecated || opts.showDeprecated) {
6675         return object;
6676       }
6677
6678       var newObject = Object.assign({}, object);
6679       delete newObject.deprecated;
6680       delete newObject.redirect;
6681       return newObject;
6682     }
6683
6684     function mapInternal(object) {
6685       if (opts.showInternal) {
6686         return object;
6687       }
6688
6689       var newObject = Object.assign({}, object);
6690       delete newObject.cliName;
6691       delete newObject.cliCategory;
6692       delete newObject.cliDescription;
6693       return newObject;
6694     }
6695   }
6696
6697   var support = {
6698     getSupportInfo: getSupportInfo
6699   };
6700
6701   /*! *****************************************************************************
6702   Copyright (c) Microsoft Corporation. All rights reserved.
6703   Licensed under the Apache License, Version 2.0 (the "License"); you may not use
6704   this file except in compliance with the License. You may obtain a copy of the
6705   License at http://www.apache.org/licenses/LICENSE-2.0
6706
6707   THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
6708   KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
6709   WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
6710   MERCHANTABLITY OR NON-INFRINGEMENT.
6711
6712   See the Apache Version 2.0 License for specific language governing permissions
6713   and limitations under the License.
6714   ***************************************************************************** */
6715
6716   /* global Reflect, Promise */
6717   var _extendStatics = function extendStatics(d, b) {
6718     _extendStatics = Object.setPrototypeOf || {
6719       __proto__: []
6720     } instanceof Array && function (d, b) {
6721       d.__proto__ = b;
6722     } || function (d, b) {
6723       for (var p in b) {
6724         if (b.hasOwnProperty(p)) d[p] = b[p];
6725       }
6726     };
6727
6728     return _extendStatics(d, b);
6729   };
6730
6731   function __extends(d, b) {
6732     _extendStatics(d, b);
6733
6734     function __() {
6735       this.constructor = d;
6736     }
6737
6738     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6739   }
6740
6741   var _assign = function __assign() {
6742     _assign = Object.assign || function __assign(t) {
6743       for (var s, i = 1, n = arguments.length; i < n; i++) {
6744         s = arguments[i];
6745
6746         for (var p in s) {
6747           if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
6748         }
6749       }
6750
6751       return t;
6752     };
6753
6754     return _assign.apply(this, arguments);
6755   };
6756   function __rest(s, e) {
6757     var t = {};
6758
6759     for (var p in s) {
6760       if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6761     }
6762
6763     if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6764       if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6765     }
6766     return t;
6767   }
6768   function __decorate(decorators, target, key, desc) {
6769     var c = arguments.length,
6770         r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
6771         d;
6772     if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
6773       if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6774     }
6775     return c > 3 && r && Object.defineProperty(target, key, r), r;
6776   }
6777   function __param(paramIndex, decorator) {
6778     return function (target, key) {
6779       decorator(target, key, paramIndex);
6780     };
6781   }
6782   function __metadata(metadataKey, metadataValue) {
6783     if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
6784   }
6785   function __awaiter(thisArg, _arguments, P, generator) {
6786     return new (P || (P = Promise))(function (resolve, reject) {
6787       function fulfilled(value) {
6788         try {
6789           step(generator.next(value));
6790         } catch (e) {
6791           reject(e);
6792         }
6793       }
6794
6795       function rejected(value) {
6796         try {
6797           step(generator["throw"](value));
6798         } catch (e) {
6799           reject(e);
6800         }
6801       }
6802
6803       function step(result) {
6804         result.done ? resolve(result.value) : new P(function (resolve) {
6805           resolve(result.value);
6806         }).then(fulfilled, rejected);
6807       }
6808
6809       step((generator = generator.apply(thisArg, _arguments || [])).next());
6810     });
6811   }
6812   function __generator(thisArg, body) {
6813     var _ = {
6814       label: 0,
6815       sent: function sent() {
6816         if (t[0] & 1) throw t[1];
6817         return t[1];
6818       },
6819       trys: [],
6820       ops: []
6821     },
6822         f,
6823         y,
6824         t,
6825         g;
6826     return g = {
6827       next: verb(0),
6828       "throw": verb(1),
6829       "return": verb(2)
6830     }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
6831       return this;
6832     }), g;
6833
6834     function verb(n) {
6835       return function (v) {
6836         return step([n, v]);
6837       };
6838     }
6839
6840     function step(op) {
6841       if (f) throw new TypeError("Generator is already executing.");
6842
6843       while (_) {
6844         try {
6845           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;
6846           if (y = 0, t) op = [op[0] & 2, t.value];
6847
6848           switch (op[0]) {
6849             case 0:
6850             case 1:
6851               t = op;
6852               break;
6853
6854             case 4:
6855               _.label++;
6856               return {
6857                 value: op[1],
6858                 done: false
6859               };
6860
6861             case 5:
6862               _.label++;
6863               y = op[1];
6864               op = [0];
6865               continue;
6866
6867             case 7:
6868               op = _.ops.pop();
6869
6870               _.trys.pop();
6871
6872               continue;
6873
6874             default:
6875               if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
6876                 _ = 0;
6877                 continue;
6878               }
6879
6880               if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
6881                 _.label = op[1];
6882                 break;
6883               }
6884
6885               if (op[0] === 6 && _.label < t[1]) {
6886                 _.label = t[1];
6887                 t = op;
6888                 break;
6889               }
6890
6891               if (t && _.label < t[2]) {
6892                 _.label = t[2];
6893
6894                 _.ops.push(op);
6895
6896                 break;
6897               }
6898
6899               if (t[2]) _.ops.pop();
6900
6901               _.trys.pop();
6902
6903               continue;
6904           }
6905
6906           op = body.call(thisArg, _);
6907         } catch (e) {
6908           op = [6, e];
6909           y = 0;
6910         } finally {
6911           f = t = 0;
6912         }
6913       }
6914
6915       if (op[0] & 5) throw op[1];
6916       return {
6917         value: op[0] ? op[1] : void 0,
6918         done: true
6919       };
6920     }
6921   }
6922   function __exportStar(m, exports) {
6923     for (var p in m) {
6924       if (!exports.hasOwnProperty(p)) exports[p] = m[p];
6925     }
6926   }
6927   function __values(o) {
6928     var m = typeof Symbol === "function" && o[Symbol.iterator],
6929         i = 0;
6930     if (m) return m.call(o);
6931     return {
6932       next: function next() {
6933         if (o && i >= o.length) o = void 0;
6934         return {
6935           value: o && o[i++],
6936           done: !o
6937         };
6938       }
6939     };
6940   }
6941   function __read(o, n) {
6942     var m = typeof Symbol === "function" && o[Symbol.iterator];
6943     if (!m) return o;
6944     var i = m.call(o),
6945         r,
6946         ar = [],
6947         e;
6948
6949     try {
6950       while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
6951         ar.push(r.value);
6952       }
6953     } catch (error) {
6954       e = {
6955         error: error
6956       };
6957     } finally {
6958       try {
6959         if (r && !r.done && (m = i["return"])) m.call(i);
6960       } finally {
6961         if (e) throw e.error;
6962       }
6963     }
6964
6965     return ar;
6966   }
6967   function __spread() {
6968     for (var ar = [], i = 0; i < arguments.length; i++) {
6969       ar = ar.concat(__read(arguments[i]));
6970     }
6971
6972     return ar;
6973   }
6974   function __spreadArrays() {
6975     for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
6976       s += arguments[i].length;
6977     }
6978
6979     for (var r = Array(s), k = 0, i = 0; i < il; i++) {
6980       for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
6981         r[k] = a[j];
6982       }
6983     }
6984
6985     return r;
6986   }
6987   function __await(v) {
6988     return this instanceof __await ? (this.v = v, this) : new __await(v);
6989   }
6990   function __asyncGenerator(thisArg, _arguments, generator) {
6991     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
6992     var g = generator.apply(thisArg, _arguments || []),
6993         i,
6994         q = [];
6995     return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () {
6996       return this;
6997     }, i;
6998
6999     function verb(n) {
7000       if (g[n]) i[n] = function (v) {
7001         return new Promise(function (a, b) {
7002           q.push([n, v, a, b]) > 1 || resume(n, v);
7003         });
7004       };
7005     }
7006
7007     function resume(n, v) {
7008       try {
7009         step(g[n](v));
7010       } catch (e) {
7011         settle(q[0][3], e);
7012       }
7013     }
7014
7015     function step(r) {
7016       r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
7017     }
7018
7019     function fulfill(value) {
7020       resume("next", value);
7021     }
7022
7023     function reject(value) {
7024       resume("throw", value);
7025     }
7026
7027     function settle(f, v) {
7028       if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
7029     }
7030   }
7031   function __asyncDelegator(o) {
7032     var i, p;
7033     return i = {}, verb("next"), verb("throw", function (e) {
7034       throw e;
7035     }), verb("return"), i[Symbol.iterator] = function () {
7036       return this;
7037     }, i;
7038
7039     function verb(n, f) {
7040       i[n] = o[n] ? function (v) {
7041         return (p = !p) ? {
7042           value: __await(o[n](v)),
7043           done: n === "return"
7044         } : f ? f(v) : v;
7045       } : f;
7046     }
7047   }
7048   function __asyncValues(o) {
7049     if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
7050     var m = o[Symbol.asyncIterator],
7051         i;
7052     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 () {
7053       return this;
7054     }, i);
7055
7056     function verb(n) {
7057       i[n] = o[n] && function (v) {
7058         return new Promise(function (resolve, reject) {
7059           v = o[n](v), settle(resolve, reject, v.done, v.value);
7060         });
7061       };
7062     }
7063
7064     function settle(resolve, reject, d, v) {
7065       Promise.resolve(v).then(function (v) {
7066         resolve({
7067           value: v,
7068           done: d
7069         });
7070       }, reject);
7071     }
7072   }
7073   function __makeTemplateObject(cooked, raw) {
7074     if (Object.defineProperty) {
7075       Object.defineProperty(cooked, "raw", {
7076         value: raw
7077       });
7078     } else {
7079       cooked.raw = raw;
7080     }
7081
7082     return cooked;
7083   }
7084   function __importStar(mod) {
7085     if (mod && mod.__esModule) return mod;
7086     var result = {};
7087     if (mod != null) for (var k in mod) {
7088       if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
7089     }
7090     result.default = mod;
7091     return result;
7092   }
7093   function __importDefault(mod) {
7094     return mod && mod.__esModule ? mod : {
7095       default: mod
7096     };
7097   }
7098
7099   var tslib_es6 = /*#__PURE__*/Object.freeze({
7100     __proto__: null,
7101     __extends: __extends,
7102     get __assign () { return _assign; },
7103     __rest: __rest,
7104     __decorate: __decorate,
7105     __param: __param,
7106     __metadata: __metadata,
7107     __awaiter: __awaiter,
7108     __generator: __generator,
7109     __exportStar: __exportStar,
7110     __values: __values,
7111     __read: __read,
7112     __spread: __spread,
7113     __spreadArrays: __spreadArrays,
7114     __await: __await,
7115     __asyncGenerator: __asyncGenerator,
7116     __asyncDelegator: __asyncDelegator,
7117     __asyncValues: __asyncValues,
7118     __makeTemplateObject: __makeTemplateObject,
7119     __importStar: __importStar,
7120     __importDefault: __importDefault
7121   });
7122
7123   var api = createCommonjsModule(function (module, exports) {
7124
7125     Object.defineProperty(exports, "__esModule", {
7126       value: true
7127     });
7128     exports.apiDescriptor = {
7129       key: function key(_key) {
7130         return /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(_key) ? _key : JSON.stringify(_key);
7131       },
7132       value: function value(_value) {
7133         if (_value === null || _typeof(_value) !== 'object') {
7134           return JSON.stringify(_value);
7135         }
7136
7137         if (Array.isArray(_value)) {
7138           return "[".concat(_value.map(function (subValue) {
7139             return exports.apiDescriptor.value(subValue);
7140           }).join(', '), "]");
7141         }
7142
7143         var keys = Object.keys(_value);
7144         return keys.length === 0 ? '{}' : "{ ".concat(keys.map(function (key) {
7145           return "".concat(exports.apiDescriptor.key(key), ": ").concat(exports.apiDescriptor.value(_value[key]));
7146         }).join(', '), " }");
7147       },
7148       pair: function pair(_ref) {
7149         var key = _ref.key,
7150             value = _ref.value;
7151         return exports.apiDescriptor.value(_defineProperty({}, key, value));
7152       }
7153     };
7154   });
7155   unwrapExports(api);
7156   var api_1 = api.apiDescriptor;
7157
7158   var tslib_1 = getCjsExportFromNamespace(tslib_es6);
7159
7160   var descriptors = createCommonjsModule(function (module, exports) {
7161
7162     Object.defineProperty(exports, "__esModule", {
7163       value: true
7164     });
7165
7166     tslib_1.__exportStar(api, exports);
7167   });
7168   unwrapExports(descriptors);
7169
7170   var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
7171
7172   var escapeStringRegexp = function escapeStringRegexp(str) {
7173     if (typeof str !== 'string') {
7174       throw new TypeError('Expected a string');
7175     }
7176
7177     return str.replace(matchOperatorsRe, '\\$&');
7178   };
7179
7180   var colorName = {
7181     "aliceblue": [240, 248, 255],
7182     "antiquewhite": [250, 235, 215],
7183     "aqua": [0, 255, 255],
7184     "aquamarine": [127, 255, 212],
7185     "azure": [240, 255, 255],
7186     "beige": [245, 245, 220],
7187     "bisque": [255, 228, 196],
7188     "black": [0, 0, 0],
7189     "blanchedalmond": [255, 235, 205],
7190     "blue": [0, 0, 255],
7191     "blueviolet": [138, 43, 226],
7192     "brown": [165, 42, 42],
7193     "burlywood": [222, 184, 135],
7194     "cadetblue": [95, 158, 160],
7195     "chartreuse": [127, 255, 0],
7196     "chocolate": [210, 105, 30],
7197     "coral": [255, 127, 80],
7198     "cornflowerblue": [100, 149, 237],
7199     "cornsilk": [255, 248, 220],
7200     "crimson": [220, 20, 60],
7201     "cyan": [0, 255, 255],
7202     "darkblue": [0, 0, 139],
7203     "darkcyan": [0, 139, 139],
7204     "darkgoldenrod": [184, 134, 11],
7205     "darkgray": [169, 169, 169],
7206     "darkgreen": [0, 100, 0],
7207     "darkgrey": [169, 169, 169],
7208     "darkkhaki": [189, 183, 107],
7209     "darkmagenta": [139, 0, 139],
7210     "darkolivegreen": [85, 107, 47],
7211     "darkorange": [255, 140, 0],
7212     "darkorchid": [153, 50, 204],
7213     "darkred": [139, 0, 0],
7214     "darksalmon": [233, 150, 122],
7215     "darkseagreen": [143, 188, 143],
7216     "darkslateblue": [72, 61, 139],
7217     "darkslategray": [47, 79, 79],
7218     "darkslategrey": [47, 79, 79],
7219     "darkturquoise": [0, 206, 209],
7220     "darkviolet": [148, 0, 211],
7221     "deeppink": [255, 20, 147],
7222     "deepskyblue": [0, 191, 255],
7223     "dimgray": [105, 105, 105],
7224     "dimgrey": [105, 105, 105],
7225     "dodgerblue": [30, 144, 255],
7226     "firebrick": [178, 34, 34],
7227     "floralwhite": [255, 250, 240],
7228     "forestgreen": [34, 139, 34],
7229     "fuchsia": [255, 0, 255],
7230     "gainsboro": [220, 220, 220],
7231     "ghostwhite": [248, 248, 255],
7232     "gold": [255, 215, 0],
7233     "goldenrod": [218, 165, 32],
7234     "gray": [128, 128, 128],
7235     "green": [0, 128, 0],
7236     "greenyellow": [173, 255, 47],
7237     "grey": [128, 128, 128],
7238     "honeydew": [240, 255, 240],
7239     "hotpink": [255, 105, 180],
7240     "indianred": [205, 92, 92],
7241     "indigo": [75, 0, 130],
7242     "ivory": [255, 255, 240],
7243     "khaki": [240, 230, 140],
7244     "lavender": [230, 230, 250],
7245     "lavenderblush": [255, 240, 245],
7246     "lawngreen": [124, 252, 0],
7247     "lemonchiffon": [255, 250, 205],
7248     "lightblue": [173, 216, 230],
7249     "lightcoral": [240, 128, 128],
7250     "lightcyan": [224, 255, 255],
7251     "lightgoldenrodyellow": [250, 250, 210],
7252     "lightgray": [211, 211, 211],
7253     "lightgreen": [144, 238, 144],
7254     "lightgrey": [211, 211, 211],
7255     "lightpink": [255, 182, 193],
7256     "lightsalmon": [255, 160, 122],
7257     "lightseagreen": [32, 178, 170],
7258     "lightskyblue": [135, 206, 250],
7259     "lightslategray": [119, 136, 153],
7260     "lightslategrey": [119, 136, 153],
7261     "lightsteelblue": [176, 196, 222],
7262     "lightyellow": [255, 255, 224],
7263     "lime": [0, 255, 0],
7264     "limegreen": [50, 205, 50],
7265     "linen": [250, 240, 230],
7266     "magenta": [255, 0, 255],
7267     "maroon": [128, 0, 0],
7268     "mediumaquamarine": [102, 205, 170],
7269     "mediumblue": [0, 0, 205],
7270     "mediumorchid": [186, 85, 211],
7271     "mediumpurple": [147, 112, 219],
7272     "mediumseagreen": [60, 179, 113],
7273     "mediumslateblue": [123, 104, 238],
7274     "mediumspringgreen": [0, 250, 154],
7275     "mediumturquoise": [72, 209, 204],
7276     "mediumvioletred": [199, 21, 133],
7277     "midnightblue": [25, 25, 112],
7278     "mintcream": [245, 255, 250],
7279     "mistyrose": [255, 228, 225],
7280     "moccasin": [255, 228, 181],
7281     "navajowhite": [255, 222, 173],
7282     "navy": [0, 0, 128],
7283     "oldlace": [253, 245, 230],
7284     "olive": [128, 128, 0],
7285     "olivedrab": [107, 142, 35],
7286     "orange": [255, 165, 0],
7287     "orangered": [255, 69, 0],
7288     "orchid": [218, 112, 214],
7289     "palegoldenrod": [238, 232, 170],
7290     "palegreen": [152, 251, 152],
7291     "paleturquoise": [175, 238, 238],
7292     "palevioletred": [219, 112, 147],
7293     "papayawhip": [255, 239, 213],
7294     "peachpuff": [255, 218, 185],
7295     "peru": [205, 133, 63],
7296     "pink": [255, 192, 203],
7297     "plum": [221, 160, 221],
7298     "powderblue": [176, 224, 230],
7299     "purple": [128, 0, 128],
7300     "rebeccapurple": [102, 51, 153],
7301     "red": [255, 0, 0],
7302     "rosybrown": [188, 143, 143],
7303     "royalblue": [65, 105, 225],
7304     "saddlebrown": [139, 69, 19],
7305     "salmon": [250, 128, 114],
7306     "sandybrown": [244, 164, 96],
7307     "seagreen": [46, 139, 87],
7308     "seashell": [255, 245, 238],
7309     "sienna": [160, 82, 45],
7310     "silver": [192, 192, 192],
7311     "skyblue": [135, 206, 235],
7312     "slateblue": [106, 90, 205],
7313     "slategray": [112, 128, 144],
7314     "slategrey": [112, 128, 144],
7315     "snow": [255, 250, 250],
7316     "springgreen": [0, 255, 127],
7317     "steelblue": [70, 130, 180],
7318     "tan": [210, 180, 140],
7319     "teal": [0, 128, 128],
7320     "thistle": [216, 191, 216],
7321     "tomato": [255, 99, 71],
7322     "turquoise": [64, 224, 208],
7323     "violet": [238, 130, 238],
7324     "wheat": [245, 222, 179],
7325     "white": [255, 255, 255],
7326     "whitesmoke": [245, 245, 245],
7327     "yellow": [255, 255, 0],
7328     "yellowgreen": [154, 205, 50]
7329   };
7330
7331   var conversions = createCommonjsModule(function (module) {
7332     /* MIT license */
7333     // NOTE: conversions should only return primitive values (i.e. arrays, or
7334     //       values that give correct `typeof` results).
7335     //       do not use box values types (i.e. Number(), String(), etc.)
7336     var reverseKeywords = {};
7337
7338     for (var key in colorName) {
7339       if (colorName.hasOwnProperty(key)) {
7340         reverseKeywords[colorName[key]] = key;
7341       }
7342     }
7343
7344     var convert = module.exports = {
7345       rgb: {
7346         channels: 3,
7347         labels: 'rgb'
7348       },
7349       hsl: {
7350         channels: 3,
7351         labels: 'hsl'
7352       },
7353       hsv: {
7354         channels: 3,
7355         labels: 'hsv'
7356       },
7357       hwb: {
7358         channels: 3,
7359         labels: 'hwb'
7360       },
7361       cmyk: {
7362         channels: 4,
7363         labels: 'cmyk'
7364       },
7365       xyz: {
7366         channels: 3,
7367         labels: 'xyz'
7368       },
7369       lab: {
7370         channels: 3,
7371         labels: 'lab'
7372       },
7373       lch: {
7374         channels: 3,
7375         labels: 'lch'
7376       },
7377       hex: {
7378         channels: 1,
7379         labels: ['hex']
7380       },
7381       keyword: {
7382         channels: 1,
7383         labels: ['keyword']
7384       },
7385       ansi16: {
7386         channels: 1,
7387         labels: ['ansi16']
7388       },
7389       ansi256: {
7390         channels: 1,
7391         labels: ['ansi256']
7392       },
7393       hcg: {
7394         channels: 3,
7395         labels: ['h', 'c', 'g']
7396       },
7397       apple: {
7398         channels: 3,
7399         labels: ['r16', 'g16', 'b16']
7400       },
7401       gray: {
7402         channels: 1,
7403         labels: ['gray']
7404       }
7405     }; // hide .channels and .labels properties
7406
7407     for (var model in convert) {
7408       if (convert.hasOwnProperty(model)) {
7409         if (!('channels' in convert[model])) {
7410           throw new Error('missing channels property: ' + model);
7411         }
7412
7413         if (!('labels' in convert[model])) {
7414           throw new Error('missing channel labels property: ' + model);
7415         }
7416
7417         if (convert[model].labels.length !== convert[model].channels) {
7418           throw new Error('channel and label counts mismatch: ' + model);
7419         }
7420
7421         var channels = convert[model].channels;
7422         var labels = convert[model].labels;
7423         delete convert[model].channels;
7424         delete convert[model].labels;
7425         Object.defineProperty(convert[model], 'channels', {
7426           value: channels
7427         });
7428         Object.defineProperty(convert[model], 'labels', {
7429           value: labels
7430         });
7431       }
7432     }
7433
7434     convert.rgb.hsl = function (rgb) {
7435       var r = rgb[0] / 255;
7436       var g = rgb[1] / 255;
7437       var b = rgb[2] / 255;
7438       var min = Math.min(r, g, b);
7439       var max = Math.max(r, g, b);
7440       var delta = max - min;
7441       var h;
7442       var s;
7443       var l;
7444
7445       if (max === min) {
7446         h = 0;
7447       } else if (r === max) {
7448         h = (g - b) / delta;
7449       } else if (g === max) {
7450         h = 2 + (b - r) / delta;
7451       } else if (b === max) {
7452         h = 4 + (r - g) / delta;
7453       }
7454
7455       h = Math.min(h * 60, 360);
7456
7457       if (h < 0) {
7458         h += 360;
7459       }
7460
7461       l = (min + max) / 2;
7462
7463       if (max === min) {
7464         s = 0;
7465       } else if (l <= 0.5) {
7466         s = delta / (max + min);
7467       } else {
7468         s = delta / (2 - max - min);
7469       }
7470
7471       return [h, s * 100, l * 100];
7472     };
7473
7474     convert.rgb.hsv = function (rgb) {
7475       var r = rgb[0];
7476       var g = rgb[1];
7477       var b = rgb[2];
7478       var min = Math.min(r, g, b);
7479       var max = Math.max(r, g, b);
7480       var delta = max - min;
7481       var h;
7482       var s;
7483       var v;
7484
7485       if (max === 0) {
7486         s = 0;
7487       } else {
7488         s = delta / max * 1000 / 10;
7489       }
7490
7491       if (max === min) {
7492         h = 0;
7493       } else if (r === max) {
7494         h = (g - b) / delta;
7495       } else if (g === max) {
7496         h = 2 + (b - r) / delta;
7497       } else if (b === max) {
7498         h = 4 + (r - g) / delta;
7499       }
7500
7501       h = Math.min(h * 60, 360);
7502
7503       if (h < 0) {
7504         h += 360;
7505       }
7506
7507       v = max / 255 * 1000 / 10;
7508       return [h, s, v];
7509     };
7510
7511     convert.rgb.hwb = function (rgb) {
7512       var r = rgb[0];
7513       var g = rgb[1];
7514       var b = rgb[2];
7515       var h = convert.rgb.hsl(rgb)[0];
7516       var w = 1 / 255 * Math.min(r, Math.min(g, b));
7517       b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
7518       return [h, w * 100, b * 100];
7519     };
7520
7521     convert.rgb.cmyk = function (rgb) {
7522       var r = rgb[0] / 255;
7523       var g = rgb[1] / 255;
7524       var b = rgb[2] / 255;
7525       var c;
7526       var m;
7527       var y;
7528       var k;
7529       k = Math.min(1 - r, 1 - g, 1 - b);
7530       c = (1 - r - k) / (1 - k) || 0;
7531       m = (1 - g - k) / (1 - k) || 0;
7532       y = (1 - b - k) / (1 - k) || 0;
7533       return [c * 100, m * 100, y * 100, k * 100];
7534     };
7535     /**
7536      * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
7537      * */
7538
7539
7540     function comparativeDistance(x, y) {
7541       return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
7542     }
7543
7544     convert.rgb.keyword = function (rgb) {
7545       var reversed = reverseKeywords[rgb];
7546
7547       if (reversed) {
7548         return reversed;
7549       }
7550
7551       var currentClosestDistance = Infinity;
7552       var currentClosestKeyword;
7553
7554       for (var keyword in colorName) {
7555         if (colorName.hasOwnProperty(keyword)) {
7556           var value = colorName[keyword]; // Compute comparative distance
7557
7558           var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
7559
7560           if (distance < currentClosestDistance) {
7561             currentClosestDistance = distance;
7562             currentClosestKeyword = keyword;
7563           }
7564         }
7565       }
7566
7567       return currentClosestKeyword;
7568     };
7569
7570     convert.keyword.rgb = function (keyword) {
7571       return colorName[keyword];
7572     };
7573
7574     convert.rgb.xyz = function (rgb) {
7575       var r = rgb[0] / 255;
7576       var g = rgb[1] / 255;
7577       var b = rgb[2] / 255; // assume sRGB
7578
7579       r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
7580       g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
7581       b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
7582       var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
7583       var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
7584       var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
7585       return [x * 100, y * 100, z * 100];
7586     };
7587
7588     convert.rgb.lab = function (rgb) {
7589       var xyz = convert.rgb.xyz(rgb);
7590       var x = xyz[0];
7591       var y = xyz[1];
7592       var z = xyz[2];
7593       var l;
7594       var a;
7595       var b;
7596       x /= 95.047;
7597       y /= 100;
7598       z /= 108.883;
7599       x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
7600       y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
7601       z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
7602       l = 116 * y - 16;
7603       a = 500 * (x - y);
7604       b = 200 * (y - z);
7605       return [l, a, b];
7606     };
7607
7608     convert.hsl.rgb = function (hsl) {
7609       var h = hsl[0] / 360;
7610       var s = hsl[1] / 100;
7611       var l = hsl[2] / 100;
7612       var t1;
7613       var t2;
7614       var t3;
7615       var rgb;
7616       var val;
7617
7618       if (s === 0) {
7619         val = l * 255;
7620         return [val, val, val];
7621       }
7622
7623       if (l < 0.5) {
7624         t2 = l * (1 + s);
7625       } else {
7626         t2 = l + s - l * s;
7627       }
7628
7629       t1 = 2 * l - t2;
7630       rgb = [0, 0, 0];
7631
7632       for (var i = 0; i < 3; i++) {
7633         t3 = h + 1 / 3 * -(i - 1);
7634
7635         if (t3 < 0) {
7636           t3++;
7637         }
7638
7639         if (t3 > 1) {
7640           t3--;
7641         }
7642
7643         if (6 * t3 < 1) {
7644           val = t1 + (t2 - t1) * 6 * t3;
7645         } else if (2 * t3 < 1) {
7646           val = t2;
7647         } else if (3 * t3 < 2) {
7648           val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
7649         } else {
7650           val = t1;
7651         }
7652
7653         rgb[i] = val * 255;
7654       }
7655
7656       return rgb;
7657     };
7658
7659     convert.hsl.hsv = function (hsl) {
7660       var h = hsl[0];
7661       var s = hsl[1] / 100;
7662       var l = hsl[2] / 100;
7663       var smin = s;
7664       var lmin = Math.max(l, 0.01);
7665       var sv;
7666       var v;
7667       l *= 2;
7668       s *= l <= 1 ? l : 2 - l;
7669       smin *= lmin <= 1 ? lmin : 2 - lmin;
7670       v = (l + s) / 2;
7671       sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
7672       return [h, sv * 100, v * 100];
7673     };
7674
7675     convert.hsv.rgb = function (hsv) {
7676       var h = hsv[0] / 60;
7677       var s = hsv[1] / 100;
7678       var v = hsv[2] / 100;
7679       var hi = Math.floor(h) % 6;
7680       var f = h - Math.floor(h);
7681       var p = 255 * v * (1 - s);
7682       var q = 255 * v * (1 - s * f);
7683       var t = 255 * v * (1 - s * (1 - f));
7684       v *= 255;
7685
7686       switch (hi) {
7687         case 0:
7688           return [v, t, p];
7689
7690         case 1:
7691           return [q, v, p];
7692
7693         case 2:
7694           return [p, v, t];
7695
7696         case 3:
7697           return [p, q, v];
7698
7699         case 4:
7700           return [t, p, v];
7701
7702         case 5:
7703           return [v, p, q];
7704       }
7705     };
7706
7707     convert.hsv.hsl = function (hsv) {
7708       var h = hsv[0];
7709       var s = hsv[1] / 100;
7710       var v = hsv[2] / 100;
7711       var vmin = Math.max(v, 0.01);
7712       var lmin;
7713       var sl;
7714       var l;
7715       l = (2 - s) * v;
7716       lmin = (2 - s) * vmin;
7717       sl = s * vmin;
7718       sl /= lmin <= 1 ? lmin : 2 - lmin;
7719       sl = sl || 0;
7720       l /= 2;
7721       return [h, sl * 100, l * 100];
7722     }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
7723
7724
7725     convert.hwb.rgb = function (hwb) {
7726       var h = hwb[0] / 360;
7727       var wh = hwb[1] / 100;
7728       var bl = hwb[2] / 100;
7729       var ratio = wh + bl;
7730       var i;
7731       var v;
7732       var f;
7733       var n; // wh + bl cant be > 1
7734
7735       if (ratio > 1) {
7736         wh /= ratio;
7737         bl /= ratio;
7738       }
7739
7740       i = Math.floor(6 * h);
7741       v = 1 - bl;
7742       f = 6 * h - i;
7743
7744       if ((i & 0x01) !== 0) {
7745         f = 1 - f;
7746       }
7747
7748       n = wh + f * (v - wh); // linear interpolation
7749
7750       var r;
7751       var g;
7752       var b;
7753
7754       switch (i) {
7755         default:
7756         case 6:
7757         case 0:
7758           r = v;
7759           g = n;
7760           b = wh;
7761           break;
7762
7763         case 1:
7764           r = n;
7765           g = v;
7766           b = wh;
7767           break;
7768
7769         case 2:
7770           r = wh;
7771           g = v;
7772           b = n;
7773           break;
7774
7775         case 3:
7776           r = wh;
7777           g = n;
7778           b = v;
7779           break;
7780
7781         case 4:
7782           r = n;
7783           g = wh;
7784           b = v;
7785           break;
7786
7787         case 5:
7788           r = v;
7789           g = wh;
7790           b = n;
7791           break;
7792       }
7793
7794       return [r * 255, g * 255, b * 255];
7795     };
7796
7797     convert.cmyk.rgb = function (cmyk) {
7798       var c = cmyk[0] / 100;
7799       var m = cmyk[1] / 100;
7800       var y = cmyk[2] / 100;
7801       var k = cmyk[3] / 100;
7802       var r;
7803       var g;
7804       var b;
7805       r = 1 - Math.min(1, c * (1 - k) + k);
7806       g = 1 - Math.min(1, m * (1 - k) + k);
7807       b = 1 - Math.min(1, y * (1 - k) + k);
7808       return [r * 255, g * 255, b * 255];
7809     };
7810
7811     convert.xyz.rgb = function (xyz) {
7812       var x = xyz[0] / 100;
7813       var y = xyz[1] / 100;
7814       var z = xyz[2] / 100;
7815       var r;
7816       var g;
7817       var b;
7818       r = x * 3.2406 + y * -1.5372 + z * -0.4986;
7819       g = x * -0.9689 + y * 1.8758 + z * 0.0415;
7820       b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB
7821
7822       r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
7823       g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
7824       b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;
7825       r = Math.min(Math.max(0, r), 1);
7826       g = Math.min(Math.max(0, g), 1);
7827       b = Math.min(Math.max(0, b), 1);
7828       return [r * 255, g * 255, b * 255];
7829     };
7830
7831     convert.xyz.lab = function (xyz) {
7832       var x = xyz[0];
7833       var y = xyz[1];
7834       var z = xyz[2];
7835       var l;
7836       var a;
7837       var b;
7838       x /= 95.047;
7839       y /= 100;
7840       z /= 108.883;
7841       x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
7842       y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
7843       z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
7844       l = 116 * y - 16;
7845       a = 500 * (x - y);
7846       b = 200 * (y - z);
7847       return [l, a, b];
7848     };
7849
7850     convert.lab.xyz = function (lab) {
7851       var l = lab[0];
7852       var a = lab[1];
7853       var b = lab[2];
7854       var x;
7855       var y;
7856       var z;
7857       y = (l + 16) / 116;
7858       x = a / 500 + y;
7859       z = y - b / 200;
7860       var y2 = Math.pow(y, 3);
7861       var x2 = Math.pow(x, 3);
7862       var z2 = Math.pow(z, 3);
7863       y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
7864       x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
7865       z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
7866       x *= 95.047;
7867       y *= 100;
7868       z *= 108.883;
7869       return [x, y, z];
7870     };
7871
7872     convert.lab.lch = function (lab) {
7873       var l = lab[0];
7874       var a = lab[1];
7875       var b = lab[2];
7876       var hr;
7877       var h;
7878       var c;
7879       hr = Math.atan2(b, a);
7880       h = hr * 360 / 2 / Math.PI;
7881
7882       if (h < 0) {
7883         h += 360;
7884       }
7885
7886       c = Math.sqrt(a * a + b * b);
7887       return [l, c, h];
7888     };
7889
7890     convert.lch.lab = function (lch) {
7891       var l = lch[0];
7892       var c = lch[1];
7893       var h = lch[2];
7894       var a;
7895       var b;
7896       var hr;
7897       hr = h / 360 * 2 * Math.PI;
7898       a = c * Math.cos(hr);
7899       b = c * Math.sin(hr);
7900       return [l, a, b];
7901     };
7902
7903     convert.rgb.ansi16 = function (args) {
7904       var r = args[0];
7905       var g = args[1];
7906       var b = args[2];
7907       var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
7908
7909       value = Math.round(value / 50);
7910
7911       if (value === 0) {
7912         return 30;
7913       }
7914
7915       var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
7916
7917       if (value === 2) {
7918         ansi += 60;
7919       }
7920
7921       return ansi;
7922     };
7923
7924     convert.hsv.ansi16 = function (args) {
7925       // optimization here; we already know the value and don't need to get
7926       // it converted for us.
7927       return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
7928     };
7929
7930     convert.rgb.ansi256 = function (args) {
7931       var r = args[0];
7932       var g = args[1];
7933       var b = args[2]; // we use the extended greyscale palette here, with the exception of
7934       // black and white. normal palette only has 4 greyscale shades.
7935
7936       if (r === g && g === b) {
7937         if (r < 8) {
7938           return 16;
7939         }
7940
7941         if (r > 248) {
7942           return 231;
7943         }
7944
7945         return Math.round((r - 8) / 247 * 24) + 232;
7946       }
7947
7948       var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
7949       return ansi;
7950     };
7951
7952     convert.ansi16.rgb = function (args) {
7953       var color = args % 10; // handle greyscale
7954
7955       if (color === 0 || color === 7) {
7956         if (args > 50) {
7957           color += 3.5;
7958         }
7959
7960         color = color / 10.5 * 255;
7961         return [color, color, color];
7962       }
7963
7964       var mult = (~~(args > 50) + 1) * 0.5;
7965       var r = (color & 1) * mult * 255;
7966       var g = (color >> 1 & 1) * mult * 255;
7967       var b = (color >> 2 & 1) * mult * 255;
7968       return [r, g, b];
7969     };
7970
7971     convert.ansi256.rgb = function (args) {
7972       // handle greyscale
7973       if (args >= 232) {
7974         var c = (args - 232) * 10 + 8;
7975         return [c, c, c];
7976       }
7977
7978       args -= 16;
7979       var rem;
7980       var r = Math.floor(args / 36) / 5 * 255;
7981       var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
7982       var b = rem % 6 / 5 * 255;
7983       return [r, g, b];
7984     };
7985
7986     convert.rgb.hex = function (args) {
7987       var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
7988       var string = integer.toString(16).toUpperCase();
7989       return '000000'.substring(string.length) + string;
7990     };
7991
7992     convert.hex.rgb = function (args) {
7993       var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
7994
7995       if (!match) {
7996         return [0, 0, 0];
7997       }
7998
7999       var colorString = match[0];
8000
8001       if (match[0].length === 3) {
8002         colorString = colorString.split('').map(function (char) {
8003           return char + char;
8004         }).join('');
8005       }
8006
8007       var integer = parseInt(colorString, 16);
8008       var r = integer >> 16 & 0xFF;
8009       var g = integer >> 8 & 0xFF;
8010       var b = integer & 0xFF;
8011       return [r, g, b];
8012     };
8013
8014     convert.rgb.hcg = function (rgb) {
8015       var r = rgb[0] / 255;
8016       var g = rgb[1] / 255;
8017       var b = rgb[2] / 255;
8018       var max = Math.max(Math.max(r, g), b);
8019       var min = Math.min(Math.min(r, g), b);
8020       var chroma = max - min;
8021       var grayscale;
8022       var hue;
8023
8024       if (chroma < 1) {
8025         grayscale = min / (1 - chroma);
8026       } else {
8027         grayscale = 0;
8028       }
8029
8030       if (chroma <= 0) {
8031         hue = 0;
8032       } else if (max === r) {
8033         hue = (g - b) / chroma % 6;
8034       } else if (max === g) {
8035         hue = 2 + (b - r) / chroma;
8036       } else {
8037         hue = 4 + (r - g) / chroma + 4;
8038       }
8039
8040       hue /= 6;
8041       hue %= 1;
8042       return [hue * 360, chroma * 100, grayscale * 100];
8043     };
8044
8045     convert.hsl.hcg = function (hsl) {
8046       var s = hsl[1] / 100;
8047       var l = hsl[2] / 100;
8048       var c = 1;
8049       var f = 0;
8050
8051       if (l < 0.5) {
8052         c = 2.0 * s * l;
8053       } else {
8054         c = 2.0 * s * (1.0 - l);
8055       }
8056
8057       if (c < 1.0) {
8058         f = (l - 0.5 * c) / (1.0 - c);
8059       }
8060
8061       return [hsl[0], c * 100, f * 100];
8062     };
8063
8064     convert.hsv.hcg = function (hsv) {
8065       var s = hsv[1] / 100;
8066       var v = hsv[2] / 100;
8067       var c = s * v;
8068       var f = 0;
8069
8070       if (c < 1.0) {
8071         f = (v - c) / (1 - c);
8072       }
8073
8074       return [hsv[0], c * 100, f * 100];
8075     };
8076
8077     convert.hcg.rgb = function (hcg) {
8078       var h = hcg[0] / 360;
8079       var c = hcg[1] / 100;
8080       var g = hcg[2] / 100;
8081
8082       if (c === 0.0) {
8083         return [g * 255, g * 255, g * 255];
8084       }
8085
8086       var pure = [0, 0, 0];
8087       var hi = h % 1 * 6;
8088       var v = hi % 1;
8089       var w = 1 - v;
8090       var mg = 0;
8091
8092       switch (Math.floor(hi)) {
8093         case 0:
8094           pure[0] = 1;
8095           pure[1] = v;
8096           pure[2] = 0;
8097           break;
8098
8099         case 1:
8100           pure[0] = w;
8101           pure[1] = 1;
8102           pure[2] = 0;
8103           break;
8104
8105         case 2:
8106           pure[0] = 0;
8107           pure[1] = 1;
8108           pure[2] = v;
8109           break;
8110
8111         case 3:
8112           pure[0] = 0;
8113           pure[1] = w;
8114           pure[2] = 1;
8115           break;
8116
8117         case 4:
8118           pure[0] = v;
8119           pure[1] = 0;
8120           pure[2] = 1;
8121           break;
8122
8123         default:
8124           pure[0] = 1;
8125           pure[1] = 0;
8126           pure[2] = w;
8127       }
8128
8129       mg = (1.0 - c) * g;
8130       return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
8131     };
8132
8133     convert.hcg.hsv = function (hcg) {
8134       var c = hcg[1] / 100;
8135       var g = hcg[2] / 100;
8136       var v = c + g * (1.0 - c);
8137       var f = 0;
8138
8139       if (v > 0.0) {
8140         f = c / v;
8141       }
8142
8143       return [hcg[0], f * 100, v * 100];
8144     };
8145
8146     convert.hcg.hsl = function (hcg) {
8147       var c = hcg[1] / 100;
8148       var g = hcg[2] / 100;
8149       var l = g * (1.0 - c) + 0.5 * c;
8150       var s = 0;
8151
8152       if (l > 0.0 && l < 0.5) {
8153         s = c / (2 * l);
8154       } else if (l >= 0.5 && l < 1.0) {
8155         s = c / (2 * (1 - l));
8156       }
8157
8158       return [hcg[0], s * 100, l * 100];
8159     };
8160
8161     convert.hcg.hwb = function (hcg) {
8162       var c = hcg[1] / 100;
8163       var g = hcg[2] / 100;
8164       var v = c + g * (1.0 - c);
8165       return [hcg[0], (v - c) * 100, (1 - v) * 100];
8166     };
8167
8168     convert.hwb.hcg = function (hwb) {
8169       var w = hwb[1] / 100;
8170       var b = hwb[2] / 100;
8171       var v = 1 - b;
8172       var c = v - w;
8173       var g = 0;
8174
8175       if (c < 1) {
8176         g = (v - c) / (1 - c);
8177       }
8178
8179       return [hwb[0], c * 100, g * 100];
8180     };
8181
8182     convert.apple.rgb = function (apple) {
8183       return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
8184     };
8185
8186     convert.rgb.apple = function (rgb) {
8187       return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
8188     };
8189
8190     convert.gray.rgb = function (args) {
8191       return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
8192     };
8193
8194     convert.gray.hsl = convert.gray.hsv = function (args) {
8195       return [0, 0, args[0]];
8196     };
8197
8198     convert.gray.hwb = function (gray) {
8199       return [0, 100, gray[0]];
8200     };
8201
8202     convert.gray.cmyk = function (gray) {
8203       return [0, 0, 0, gray[0]];
8204     };
8205
8206     convert.gray.lab = function (gray) {
8207       return [gray[0], 0, 0];
8208     };
8209
8210     convert.gray.hex = function (gray) {
8211       var val = Math.round(gray[0] / 100 * 255) & 0xFF;
8212       var integer = (val << 16) + (val << 8) + val;
8213       var string = integer.toString(16).toUpperCase();
8214       return '000000'.substring(string.length) + string;
8215     };
8216
8217     convert.rgb.gray = function (rgb) {
8218       var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
8219       return [val / 255 * 100];
8220     };
8221   });
8222   var conversions_1 = conversions.rgb;
8223   var conversions_2 = conversions.hsl;
8224   var conversions_3 = conversions.hsv;
8225   var conversions_4 = conversions.hwb;
8226   var conversions_5 = conversions.cmyk;
8227   var conversions_6 = conversions.xyz;
8228   var conversions_7 = conversions.lab;
8229   var conversions_8 = conversions.lch;
8230   var conversions_9 = conversions.hex;
8231   var conversions_10 = conversions.keyword;
8232   var conversions_11 = conversions.ansi16;
8233   var conversions_12 = conversions.ansi256;
8234   var conversions_13 = conversions.hcg;
8235   var conversions_14 = conversions.apple;
8236   var conversions_15 = conversions.gray;
8237
8238   /*
8239         this function routes a model to all other models.
8240
8241         all functions that are routed have a property `.conversion` attached
8242         to the returned synthetic function. This property is an array
8243         of strings, each with the steps in between the 'from' and 'to'
8244         color models (inclusive).
8245
8246         conversions that are not possible simply are not included.
8247   */
8248   // https://jsperf.com/object-keys-vs-for-in-with-closure/3
8249
8250   var models = Object.keys(conversions);
8251
8252   function buildGraph() {
8253     var graph = {};
8254
8255     for (var len = models.length, i = 0; i < len; i++) {
8256       graph[models[i]] = {
8257         // http://jsperf.com/1-vs-infinity
8258         // micro-opt, but this is simple.
8259         distance: -1,
8260         parent: null
8261       };
8262     }
8263
8264     return graph;
8265   } // https://en.wikipedia.org/wiki/Breadth-first_search
8266
8267
8268   function deriveBFS(fromModel) {
8269     var graph = buildGraph();
8270     var queue = [fromModel]; // unshift -> queue -> pop
8271
8272     graph[fromModel].distance = 0;
8273
8274     while (queue.length) {
8275       var current = queue.pop();
8276       var adjacents = Object.keys(conversions[current]);
8277
8278       for (var len = adjacents.length, i = 0; i < len; i++) {
8279         var adjacent = adjacents[i];
8280         var node = graph[adjacent];
8281
8282         if (node.distance === -1) {
8283           node.distance = graph[current].distance + 1;
8284           node.parent = current;
8285           queue.unshift(adjacent);
8286         }
8287       }
8288     }
8289
8290     return graph;
8291   }
8292
8293   function link(from, to) {
8294     return function (args) {
8295       return to(from(args));
8296     };
8297   }
8298
8299   function wrapConversion(toModel, graph) {
8300     var path = [graph[toModel].parent, toModel];
8301     var fn = conversions[graph[toModel].parent][toModel];
8302     var cur = graph[toModel].parent;
8303
8304     while (graph[cur].parent) {
8305       path.unshift(graph[cur].parent);
8306       fn = link(conversions[graph[cur].parent][cur], fn);
8307       cur = graph[cur].parent;
8308     }
8309
8310     fn.conversion = path;
8311     return fn;
8312   }
8313
8314   var route = function route(fromModel) {
8315     var graph = deriveBFS(fromModel);
8316     var conversion = {};
8317     var models = Object.keys(graph);
8318
8319     for (var len = models.length, i = 0; i < len; i++) {
8320       var toModel = models[i];
8321       var node = graph[toModel];
8322
8323       if (node.parent === null) {
8324         // no possible conversion, or this node is the source model.
8325         continue;
8326       }
8327
8328       conversion[toModel] = wrapConversion(toModel, graph);
8329     }
8330
8331     return conversion;
8332   };
8333
8334   var convert = {};
8335   var models$1 = Object.keys(conversions);
8336
8337   function wrapRaw(fn) {
8338     var wrappedFn = function wrappedFn(args) {
8339       if (args === undefined || args === null) {
8340         return args;
8341       }
8342
8343       if (arguments.length > 1) {
8344         args = Array.prototype.slice.call(arguments);
8345       }
8346
8347       return fn(args);
8348     }; // preserve .conversion property if there is one
8349
8350
8351     if ('conversion' in fn) {
8352       wrappedFn.conversion = fn.conversion;
8353     }
8354
8355     return wrappedFn;
8356   }
8357
8358   function wrapRounded(fn) {
8359     var wrappedFn = function wrappedFn(args) {
8360       if (args === undefined || args === null) {
8361         return args;
8362       }
8363
8364       if (arguments.length > 1) {
8365         args = Array.prototype.slice.call(arguments);
8366       }
8367
8368       var result = fn(args); // we're assuming the result is an array here.
8369       // see notice in conversions.js; don't use box types
8370       // in conversion functions.
8371
8372       if (_typeof(result) === 'object') {
8373         for (var len = result.length, i = 0; i < len; i++) {
8374           result[i] = Math.round(result[i]);
8375         }
8376       }
8377
8378       return result;
8379     }; // preserve .conversion property if there is one
8380
8381
8382     if ('conversion' in fn) {
8383       wrappedFn.conversion = fn.conversion;
8384     }
8385
8386     return wrappedFn;
8387   }
8388
8389   models$1.forEach(function (fromModel) {
8390     convert[fromModel] = {};
8391     Object.defineProperty(convert[fromModel], 'channels', {
8392       value: conversions[fromModel].channels
8393     });
8394     Object.defineProperty(convert[fromModel], 'labels', {
8395       value: conversions[fromModel].labels
8396     });
8397     var routes = route(fromModel);
8398     var routeModels = Object.keys(routes);
8399     routeModels.forEach(function (toModel) {
8400       var fn = routes[toModel];
8401       convert[fromModel][toModel] = wrapRounded(fn);
8402       convert[fromModel][toModel].raw = wrapRaw(fn);
8403     });
8404   });
8405   var colorConvert = convert;
8406
8407   var ansiStyles = createCommonjsModule(function (module) {
8408
8409     var wrapAnsi16 = function wrapAnsi16(fn, offset) {
8410       return function () {
8411         var code = fn.apply(colorConvert, arguments);
8412         return "\x1B[".concat(code + offset, "m");
8413       };
8414     };
8415
8416     var wrapAnsi256 = function wrapAnsi256(fn, offset) {
8417       return function () {
8418         var code = fn.apply(colorConvert, arguments);
8419         return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
8420       };
8421     };
8422
8423     var wrapAnsi16m = function wrapAnsi16m(fn, offset) {
8424       return function () {
8425         var rgb = fn.apply(colorConvert, arguments);
8426         return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
8427       };
8428     };
8429
8430     function assembleStyles() {
8431       var codes = new Map();
8432       var styles = {
8433         modifier: {
8434           reset: [0, 0],
8435           // 21 isn't widely supported and 22 does the same thing
8436           bold: [1, 22],
8437           dim: [2, 22],
8438           italic: [3, 23],
8439           underline: [4, 24],
8440           inverse: [7, 27],
8441           hidden: [8, 28],
8442           strikethrough: [9, 29]
8443         },
8444         color: {
8445           black: [30, 39],
8446           red: [31, 39],
8447           green: [32, 39],
8448           yellow: [33, 39],
8449           blue: [34, 39],
8450           magenta: [35, 39],
8451           cyan: [36, 39],
8452           white: [37, 39],
8453           gray: [90, 39],
8454           // Bright color
8455           redBright: [91, 39],
8456           greenBright: [92, 39],
8457           yellowBright: [93, 39],
8458           blueBright: [94, 39],
8459           magentaBright: [95, 39],
8460           cyanBright: [96, 39],
8461           whiteBright: [97, 39]
8462         },
8463         bgColor: {
8464           bgBlack: [40, 49],
8465           bgRed: [41, 49],
8466           bgGreen: [42, 49],
8467           bgYellow: [43, 49],
8468           bgBlue: [44, 49],
8469           bgMagenta: [45, 49],
8470           bgCyan: [46, 49],
8471           bgWhite: [47, 49],
8472           // Bright color
8473           bgBlackBright: [100, 49],
8474           bgRedBright: [101, 49],
8475           bgGreenBright: [102, 49],
8476           bgYellowBright: [103, 49],
8477           bgBlueBright: [104, 49],
8478           bgMagentaBright: [105, 49],
8479           bgCyanBright: [106, 49],
8480           bgWhiteBright: [107, 49]
8481         }
8482       }; // Fix humans
8483
8484       styles.color.grey = styles.color.gray;
8485
8486       for (var _i = 0, _Object$keys = Object.keys(styles); _i < _Object$keys.length; _i++) {
8487         var groupName = _Object$keys[_i];
8488         var group = styles[groupName];
8489
8490         for (var _i3 = 0, _Object$keys3 = Object.keys(group); _i3 < _Object$keys3.length; _i3++) {
8491           var styleName = _Object$keys3[_i3];
8492           var style = group[styleName];
8493           styles[styleName] = {
8494             open: "\x1B[".concat(style[0], "m"),
8495             close: "\x1B[".concat(style[1], "m")
8496           };
8497           group[styleName] = styles[styleName];
8498           codes.set(style[0], style[1]);
8499         }
8500
8501         Object.defineProperty(styles, groupName, {
8502           value: group,
8503           enumerable: false
8504         });
8505         Object.defineProperty(styles, 'codes', {
8506           value: codes,
8507           enumerable: false
8508         });
8509       }
8510
8511       var ansi2ansi = function ansi2ansi(n) {
8512         return n;
8513       };
8514
8515       var rgb2rgb = function rgb2rgb(r, g, b) {
8516         return [r, g, b];
8517       };
8518
8519       styles.color.close = "\x1B[39m";
8520       styles.bgColor.close = "\x1B[49m";
8521       styles.color.ansi = {
8522         ansi: wrapAnsi16(ansi2ansi, 0)
8523       };
8524       styles.color.ansi256 = {
8525         ansi256: wrapAnsi256(ansi2ansi, 0)
8526       };
8527       styles.color.ansi16m = {
8528         rgb: wrapAnsi16m(rgb2rgb, 0)
8529       };
8530       styles.bgColor.ansi = {
8531         ansi: wrapAnsi16(ansi2ansi, 10)
8532       };
8533       styles.bgColor.ansi256 = {
8534         ansi256: wrapAnsi256(ansi2ansi, 10)
8535       };
8536       styles.bgColor.ansi16m = {
8537         rgb: wrapAnsi16m(rgb2rgb, 10)
8538       };
8539
8540       for (var _i2 = 0, _Object$keys2 = Object.keys(colorConvert); _i2 < _Object$keys2.length; _i2++) {
8541         var key = _Object$keys2[_i2];
8542
8543         if (_typeof(colorConvert[key]) !== 'object') {
8544           continue;
8545         }
8546
8547         var suite = colorConvert[key];
8548
8549         if (key === 'ansi16') {
8550           key = 'ansi';
8551         }
8552
8553         if ('ansi16' in suite) {
8554           styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
8555           styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
8556         }
8557
8558         if ('ansi256' in suite) {
8559           styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
8560           styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
8561         }
8562
8563         if ('rgb' in suite) {
8564           styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
8565           styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
8566         }
8567       }
8568
8569       return styles;
8570     } // Make the export immutable
8571
8572
8573     Object.defineProperty(module, 'exports', {
8574       enumerable: true,
8575       get: assembleStyles
8576     });
8577   });
8578
8579   var require$$0$1 = {
8580     EOL: "\n"
8581   };
8582
8583   var hasFlag = function hasFlag(flag, argv) {
8584     argv = argv || process.argv;
8585     var prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
8586     var pos = argv.indexOf(prefix + flag);
8587     var terminatorPos = argv.indexOf('--');
8588     return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
8589   };
8590
8591   var env$1 = process.env;
8592   var forceColor;
8593
8594   if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
8595     forceColor = false;
8596   } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
8597     forceColor = true;
8598   }
8599
8600   if ('FORCE_COLOR' in env$1) {
8601     forceColor = env$1.FORCE_COLOR.length === 0 || parseInt(env$1.FORCE_COLOR, 10) !== 0;
8602   }
8603
8604   function translateLevel(level) {
8605     if (level === 0) {
8606       return false;
8607     }
8608
8609     return {
8610       level: level,
8611       hasBasic: true,
8612       has256: level >= 2,
8613       has16m: level >= 3
8614     };
8615   }
8616
8617   function supportsColor(stream) {
8618     if (forceColor === false) {
8619       return 0;
8620     }
8621
8622     if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
8623       return 3;
8624     }
8625
8626     if (hasFlag('color=256')) {
8627       return 2;
8628     }
8629
8630     if (stream && !stream.isTTY && forceColor !== true) {
8631       return 0;
8632     }
8633
8634     var min = forceColor ? 1 : 0;
8635
8636     if (process.platform === 'win32') {
8637       // Node.js 7.5.0 is the first version of Node.js to include a patch to
8638       // libuv that enables 256 color output on Windows. Anything earlier and it
8639       // won't work. However, here we target Node.js 8 at minimum as it is an LTS
8640       // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
8641       // release that supports 256 colors. Windows 10 build 14931 is the first release
8642       // that supports 16m/TrueColor.
8643       var osRelease = require$$0$1.release().split('.');
8644
8645       if (Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
8646         return Number(osRelease[2]) >= 14931 ? 3 : 2;
8647       }
8648
8649       return 1;
8650     }
8651
8652     if ('CI' in env$1) {
8653       if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function (sign) {
8654         return sign in env$1;
8655       }) || env$1.CI_NAME === 'codeship') {
8656         return 1;
8657       }
8658
8659       return min;
8660     }
8661
8662     if ('TEAMCITY_VERSION' in env$1) {
8663       return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
8664     }
8665
8666     if (env$1.COLORTERM === 'truecolor') {
8667       return 3;
8668     }
8669
8670     if ('TERM_PROGRAM' in env$1) {
8671       var version = parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
8672
8673       switch (env$1.TERM_PROGRAM) {
8674         case 'iTerm.app':
8675           return version >= 3 ? 3 : 2;
8676
8677         case 'Apple_Terminal':
8678           return 2;
8679         // No default
8680       }
8681     }
8682
8683     if (/-256(color)?$/i.test(env$1.TERM)) {
8684       return 2;
8685     }
8686
8687     if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
8688       return 1;
8689     }
8690
8691     if ('COLORTERM' in env$1) {
8692       return 1;
8693     }
8694
8695     if (env$1.TERM === 'dumb') {
8696       return min;
8697     }
8698
8699     return min;
8700   }
8701
8702   function getSupportLevel(stream) {
8703     var level = supportsColor(stream);
8704     return translateLevel(level);
8705   }
8706
8707   var supportsColor_1 = {
8708     supportsColor: getSupportLevel,
8709     stdout: getSupportLevel(process.stdout),
8710     stderr: getSupportLevel(process.stderr)
8711   };
8712
8713   var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
8714   var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
8715   var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
8716   var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
8717   var ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', "\x1B"], ['a', "\x07"]]);
8718
8719   function unescape(c) {
8720     if (c[0] === 'u' && c.length === 5 || c[0] === 'x' && c.length === 3) {
8721       return String.fromCharCode(parseInt(c.slice(1), 16));
8722     }
8723
8724     return ESCAPES.get(c) || c;
8725   }
8726
8727   function parseArguments(name, args) {
8728     var results = [];
8729     var chunks = args.trim().split(/\s*,\s*/g);
8730     var matches;
8731     var _iteratorNormalCompletion = true;
8732     var _didIteratorError = false;
8733     var _iteratorError = undefined;
8734
8735     try {
8736       for (var _iterator = chunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
8737         var chunk = _step.value;
8738
8739         if (!isNaN(chunk)) {
8740           results.push(Number(chunk));
8741         } else if (matches = chunk.match(STRING_REGEX)) {
8742           results.push(matches[2].replace(ESCAPE_REGEX, function (m, escape, chr) {
8743             return escape ? unescape(escape) : chr;
8744           }));
8745         } else {
8746           throw new Error("Invalid Chalk template style argument: ".concat(chunk, " (in style '").concat(name, "')"));
8747         }
8748       }
8749     } catch (err) {
8750       _didIteratorError = true;
8751       _iteratorError = err;
8752     } finally {
8753       try {
8754         if (!_iteratorNormalCompletion && _iterator.return != null) {
8755           _iterator.return();
8756         }
8757       } finally {
8758         if (_didIteratorError) {
8759           throw _iteratorError;
8760         }
8761       }
8762     }
8763
8764     return results;
8765   }
8766
8767   function parseStyle(style) {
8768     STYLE_REGEX.lastIndex = 0;
8769     var results = [];
8770     var matches;
8771
8772     while ((matches = STYLE_REGEX.exec(style)) !== null) {
8773       var name = matches[1];
8774
8775       if (matches[2]) {
8776         var args = parseArguments(name, matches[2]);
8777         results.push([name].concat(args));
8778       } else {
8779         results.push([name]);
8780       }
8781     }
8782
8783     return results;
8784   }
8785
8786   function buildStyle(chalk, styles) {
8787     var enabled = {};
8788     var _iteratorNormalCompletion2 = true;
8789     var _didIteratorError2 = false;
8790     var _iteratorError2 = undefined;
8791
8792     try {
8793       for (var _iterator2 = styles[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
8794         var layer = _step2.value;
8795         var _iteratorNormalCompletion3 = true;
8796         var _didIteratorError3 = false;
8797         var _iteratorError3 = undefined;
8798
8799         try {
8800           for (var _iterator3 = layer.styles[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
8801             var style = _step3.value;
8802             enabled[style[0]] = layer.inverse ? null : style.slice(1);
8803           }
8804         } catch (err) {
8805           _didIteratorError3 = true;
8806           _iteratorError3 = err;
8807         } finally {
8808           try {
8809             if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
8810               _iterator3.return();
8811             }
8812           } finally {
8813             if (_didIteratorError3) {
8814               throw _iteratorError3;
8815             }
8816           }
8817         }
8818       }
8819     } catch (err) {
8820       _didIteratorError2 = true;
8821       _iteratorError2 = err;
8822     } finally {
8823       try {
8824         if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
8825           _iterator2.return();
8826         }
8827       } finally {
8828         if (_didIteratorError2) {
8829           throw _iteratorError2;
8830         }
8831       }
8832     }
8833
8834     var current = chalk;
8835
8836     for (var _i = 0, _Object$keys = Object.keys(enabled); _i < _Object$keys.length; _i++) {
8837       var styleName = _Object$keys[_i];
8838
8839       if (Array.isArray(enabled[styleName])) {
8840         if (!(styleName in current)) {
8841           throw new Error("Unknown Chalk style: ".concat(styleName));
8842         }
8843
8844         if (enabled[styleName].length > 0) {
8845           current = current[styleName].apply(current, enabled[styleName]);
8846         } else {
8847           current = current[styleName];
8848         }
8849       }
8850     }
8851
8852     return current;
8853   }
8854
8855   var templates = function templates(chalk, tmp) {
8856     var styles = [];
8857     var chunks = [];
8858     var chunk = []; // eslint-disable-next-line max-params
8859
8860     tmp.replace(TEMPLATE_REGEX, function (m, escapeChar, inverse, style, close, chr) {
8861       if (escapeChar) {
8862         chunk.push(unescape(escapeChar));
8863       } else if (style) {
8864         var str = chunk.join('');
8865         chunk = [];
8866         chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
8867         styles.push({
8868           inverse: inverse,
8869           styles: parseStyle(style)
8870         });
8871       } else if (close) {
8872         if (styles.length === 0) {
8873           throw new Error('Found extraneous } in Chalk template literal');
8874         }
8875
8876         chunks.push(buildStyle(chalk, styles)(chunk.join('')));
8877         chunk = [];
8878         styles.pop();
8879       } else {
8880         chunk.push(chr);
8881       }
8882     });
8883     chunks.push(chunk.join(''));
8884
8885     if (styles.length > 0) {
8886       var errMsg = "Chalk template literal is missing ".concat(styles.length, " closing bracket").concat(styles.length === 1 ? '' : 's', " (`}`)");
8887       throw new Error(errMsg);
8888     }
8889
8890     return chunks.join('');
8891   };
8892
8893   var chalk = createCommonjsModule(function (module) {
8894
8895     var stdoutColor = supportsColor_1.stdout;
8896     var isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); // `supportsColor.level` → `ansiStyles.color[name]` mapping
8897
8898     var levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m']; // `color-convert` models to exclude from the Chalk API due to conflicts and such
8899
8900     var skipModels = new Set(['gray']);
8901     var styles = Object.create(null);
8902
8903     function applyOptions(obj, options) {
8904       options = options || {}; // Detect level if not set manually
8905
8906       var scLevel = stdoutColor ? stdoutColor.level : 0;
8907       obj.level = options.level === undefined ? scLevel : options.level;
8908       obj.enabled = 'enabled' in options ? options.enabled : obj.level > 0;
8909     }
8910
8911     function Chalk(options) {
8912       // We check for this.template here since calling `chalk.constructor()`
8913       // by itself will have a `this` of a previously constructed chalk object
8914       if (!this || !(this instanceof Chalk) || this.template) {
8915         var _chalk = {};
8916         applyOptions(_chalk, options);
8917
8918         _chalk.template = function () {
8919           var args = [].slice.call(arguments);
8920           return chalkTag.apply(null, [_chalk.template].concat(args));
8921         };
8922
8923         Object.setPrototypeOf(_chalk, Chalk.prototype);
8924         Object.setPrototypeOf(_chalk.template, _chalk);
8925         _chalk.template.constructor = Chalk;
8926         return _chalk.template;
8927       }
8928
8929       applyOptions(this, options);
8930     } // Use bright blue on Windows as the normal blue color is illegible
8931
8932
8933     if (isSimpleWindowsTerm) {
8934       ansiStyles.blue.open = "\x1B[94m";
8935     }
8936
8937     var _loop = function _loop() {
8938       var key = _Object$keys[_i];
8939       ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
8940       styles[key] = {
8941         get: function get() {
8942           var codes = ansiStyles[key];
8943           return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
8944         }
8945       };
8946     };
8947
8948     for (var _i = 0, _Object$keys = Object.keys(ansiStyles); _i < _Object$keys.length; _i++) {
8949       _loop();
8950     }
8951
8952     styles.visible = {
8953       get: function get() {
8954         return build.call(this, this._styles || [], true, 'visible');
8955       }
8956     };
8957     ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
8958
8959     var _loop2 = function _loop2() {
8960       var model = _Object$keys2[_i2];
8961
8962       if (skipModels.has(model)) {
8963         return "continue";
8964       }
8965
8966       styles[model] = {
8967         get: function get() {
8968           var level = this.level;
8969           return function () {
8970             var open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
8971             var codes = {
8972               open: open,
8973               close: ansiStyles.color.close,
8974               closeRe: ansiStyles.color.closeRe
8975             };
8976             return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
8977           };
8978         }
8979       };
8980     };
8981
8982     for (var _i2 = 0, _Object$keys2 = Object.keys(ansiStyles.color.ansi); _i2 < _Object$keys2.length; _i2++) {
8983       var _ret = _loop2();
8984
8985       if (_ret === "continue") continue;
8986     }
8987
8988     ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
8989
8990     var _loop3 = function _loop3() {
8991       var model = _Object$keys3[_i3];
8992
8993       if (skipModels.has(model)) {
8994         return "continue";
8995       }
8996
8997       var bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
8998       styles[bgModel] = {
8999         get: function get() {
9000           var level = this.level;
9001           return function () {
9002             var open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
9003             var codes = {
9004               open: open,
9005               close: ansiStyles.bgColor.close,
9006               closeRe: ansiStyles.bgColor.closeRe
9007             };
9008             return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
9009           };
9010         }
9011       };
9012     };
9013
9014     for (var _i3 = 0, _Object$keys3 = Object.keys(ansiStyles.bgColor.ansi); _i3 < _Object$keys3.length; _i3++) {
9015       var _ret2 = _loop3();
9016
9017       if (_ret2 === "continue") continue;
9018     }
9019
9020     var proto = Object.defineProperties(function () {}, styles);
9021
9022     function build(_styles, _empty, key) {
9023       var builder = function builder() {
9024         return applyStyle.apply(builder, arguments);
9025       };
9026
9027       builder._styles = _styles;
9028       builder._empty = _empty;
9029       var self = this;
9030       Object.defineProperty(builder, 'level', {
9031         enumerable: true,
9032         get: function get() {
9033           return self.level;
9034         },
9035         set: function set(level) {
9036           self.level = level;
9037         }
9038       });
9039       Object.defineProperty(builder, 'enabled', {
9040         enumerable: true,
9041         get: function get() {
9042           return self.enabled;
9043         },
9044         set: function set(enabled) {
9045           self.enabled = enabled;
9046         }
9047       }); // See below for fix regarding invisible grey/dim combination on Windows
9048
9049       builder.hasGrey = this.hasGrey || key === 'gray' || key === 'grey'; // `__proto__` is used because we must return a function, but there is
9050       // no way to create a function with a different prototype
9051
9052       builder.__proto__ = proto; // eslint-disable-line no-proto
9053
9054       return builder;
9055     }
9056
9057     function applyStyle() {
9058       // Support varags, but simply cast to string in case there's only one arg
9059       var args = arguments;
9060       var argsLen = args.length;
9061       var str = String(arguments[0]);
9062
9063       if (argsLen === 0) {
9064         return '';
9065       }
9066
9067       if (argsLen > 1) {
9068         // Don't slice `arguments`, it prevents V8 optimizations
9069         for (var a = 1; a < argsLen; a++) {
9070           str += ' ' + args[a];
9071         }
9072       }
9073
9074       if (!this.enabled || this.level <= 0 || !str) {
9075         return this._empty ? '' : str;
9076       } // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
9077       // see https://github.com/chalk/chalk/issues/58
9078       // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
9079
9080
9081       var originalDim = ansiStyles.dim.open;
9082
9083       if (isSimpleWindowsTerm && this.hasGrey) {
9084         ansiStyles.dim.open = '';
9085       }
9086
9087       var _iteratorNormalCompletion = true;
9088       var _didIteratorError = false;
9089       var _iteratorError = undefined;
9090
9091       try {
9092         for (var _iterator = this._styles.slice().reverse()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9093           var code = _step.value;
9094           // Replace any instances already present with a re-opening code
9095           // otherwise only the part of the string until said closing code
9096           // will be colored, and the rest will simply be 'plain'.
9097           str = code.open + str.replace(code.closeRe, code.open) + code.close; // Close the styling before a linebreak and reopen
9098           // after next line to fix a bleed issue on macOS
9099           // https://github.com/chalk/chalk/pull/92
9100
9101           str = str.replace(/\r?\n/g, "".concat(code.close, "$&").concat(code.open));
9102         } // Reset the original `dim` if we changed it to work around the Windows dimmed gray issue
9103
9104       } catch (err) {
9105         _didIteratorError = true;
9106         _iteratorError = err;
9107       } finally {
9108         try {
9109           if (!_iteratorNormalCompletion && _iterator.return != null) {
9110             _iterator.return();
9111           }
9112         } finally {
9113           if (_didIteratorError) {
9114             throw _iteratorError;
9115           }
9116         }
9117       }
9118
9119       ansiStyles.dim.open = originalDim;
9120       return str;
9121     }
9122
9123     function chalkTag(chalk, strings) {
9124       if (!Array.isArray(strings)) {
9125         // If chalk() was called by itself or with a string,
9126         // return the string itself as a string.
9127         return [].slice.call(arguments, 1).join(' ');
9128       }
9129
9130       var args = [].slice.call(arguments, 2);
9131       var parts = [strings.raw[0]];
9132
9133       for (var i = 1; i < strings.length; i++) {
9134         parts.push(String(args[i - 1]).replace(/[{}\\]/g, '\\$&'));
9135         parts.push(String(strings.raw[i]));
9136       }
9137
9138       return templates(chalk, parts.join(''));
9139     }
9140
9141     Object.defineProperties(Chalk.prototype, styles);
9142     module.exports = Chalk(); // eslint-disable-line new-cap
9143
9144     module.exports.supportsColor = stdoutColor;
9145     module.exports.default = module.exports; // For TypeScript
9146   });
9147   var chalk_1 = chalk.supportsColor;
9148
9149   var common = createCommonjsModule(function (module, exports) {
9150
9151     Object.defineProperty(exports, "__esModule", {
9152       value: true
9153     });
9154
9155     exports.commonDeprecatedHandler = function (keyOrPair, redirectTo, _ref) {
9156       var descriptor = _ref.descriptor;
9157       var messages = ["".concat(chalk.default.yellow(typeof keyOrPair === 'string' ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair)), " is deprecated")];
9158
9159       if (redirectTo) {
9160         messages.push("we now treat it as ".concat(chalk.default.blue(typeof redirectTo === 'string' ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))));
9161       }
9162
9163       return messages.join('; ') + '.';
9164     };
9165   });
9166   unwrapExports(common);
9167   var common_1 = common.commonDeprecatedHandler;
9168
9169   var deprecated = createCommonjsModule(function (module, exports) {
9170
9171     Object.defineProperty(exports, "__esModule", {
9172       value: true
9173     });
9174
9175     tslib_1.__exportStar(common, exports);
9176   });
9177   unwrapExports(deprecated);
9178
9179   var common$1 = createCommonjsModule(function (module, exports) {
9180
9181     Object.defineProperty(exports, "__esModule", {
9182       value: true
9183     });
9184
9185     exports.commonInvalidHandler = function (key, value, utils) {
9186       return ["Invalid ".concat(chalk.default.red(utils.descriptor.key(key)), " value."), "Expected ".concat(chalk.default.blue(utils.schemas[key].expected(utils)), ","), "but received ".concat(chalk.default.red(utils.descriptor.value(value)), ".")].join(' ');
9187     };
9188   });
9189   unwrapExports(common$1);
9190   var common_1$1 = common$1.commonInvalidHandler;
9191
9192   var invalid = createCommonjsModule(function (module, exports) {
9193
9194     Object.defineProperty(exports, "__esModule", {
9195       value: true
9196     });
9197
9198     tslib_1.__exportStar(common$1, exports);
9199   });
9200   unwrapExports(invalid);
9201
9202   /* eslint-disable no-nested-ternary */
9203
9204   var arr = [];
9205   var charCodeCache = [];
9206
9207   var leven = function leven(a, b) {
9208     if (a === b) {
9209       return 0;
9210     }
9211
9212     var swap = a; // Swapping the strings if `a` is longer than `b` so we know which one is the
9213     // shortest & which one is the longest
9214
9215     if (a.length > b.length) {
9216       a = b;
9217       b = swap;
9218     }
9219
9220     var aLen = a.length;
9221     var bLen = b.length;
9222
9223     if (aLen === 0) {
9224       return bLen;
9225     }
9226
9227     if (bLen === 0) {
9228       return aLen;
9229     } // Performing suffix trimming:
9230     // We can linearly drop suffix common to both strings since they
9231     // don't increase distance at all
9232     // Note: `~-` is the bitwise way to perform a `- 1` operation
9233
9234
9235     while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
9236       aLen--;
9237       bLen--;
9238     }
9239
9240     if (aLen === 0) {
9241       return bLen;
9242     } // Performing prefix trimming
9243     // We can linearly drop prefix common to both strings since they
9244     // don't increase distance at all
9245
9246
9247     var start = 0;
9248
9249     while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
9250       start++;
9251     }
9252
9253     aLen -= start;
9254     bLen -= start;
9255
9256     if (aLen === 0) {
9257       return bLen;
9258     }
9259
9260     var bCharCode;
9261     var ret;
9262     var tmp;
9263     var tmp2;
9264     var i = 0;
9265     var j = 0;
9266
9267     while (i < aLen) {
9268       charCodeCache[start + i] = a.charCodeAt(start + i);
9269       arr[i] = ++i;
9270     }
9271
9272     while (j < bLen) {
9273       bCharCode = b.charCodeAt(start + j);
9274       tmp = j++;
9275       ret = j;
9276
9277       for (i = 0; i < aLen; i++) {
9278         tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
9279         tmp = arr[i];
9280         ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
9281       }
9282     }
9283
9284     return ret;
9285   };
9286
9287   var leven_1 = createCommonjsModule(function (module, exports) {
9288
9289     Object.defineProperty(exports, "__esModule", {
9290       value: true
9291     });
9292
9293     exports.levenUnknownHandler = function (key, value, _ref) {
9294       var descriptor = _ref.descriptor,
9295           logger = _ref.logger,
9296           schemas = _ref.schemas;
9297       var messages = ["Ignored unknown option ".concat(chalk.default.yellow(descriptor.pair({
9298         key: key,
9299         value: value
9300       })), ".")];
9301       var suggestion = Object.keys(schemas).sort().find(function (knownKey) {
9302         return leven(key, knownKey) < 3;
9303       });
9304
9305       if (suggestion) {
9306         messages.push("Did you mean ".concat(chalk.default.blue(descriptor.key(suggestion)), "?"));
9307       }
9308
9309       logger.warn(messages.join(' '));
9310     };
9311   });
9312   unwrapExports(leven_1);
9313   var leven_2 = leven_1.levenUnknownHandler;
9314
9315   var unknown = createCommonjsModule(function (module, exports) {
9316
9317     Object.defineProperty(exports, "__esModule", {
9318       value: true
9319     });
9320
9321     tslib_1.__exportStar(leven_1, exports);
9322   });
9323   unwrapExports(unknown);
9324
9325   var handlers = createCommonjsModule(function (module, exports) {
9326
9327     Object.defineProperty(exports, "__esModule", {
9328       value: true
9329     });
9330
9331     tslib_1.__exportStar(deprecated, exports);
9332
9333     tslib_1.__exportStar(invalid, exports);
9334
9335     tslib_1.__exportStar(unknown, exports);
9336   });
9337   unwrapExports(handlers);
9338
9339   var schema = createCommonjsModule(function (module, exports) {
9340
9341     Object.defineProperty(exports, "__esModule", {
9342       value: true
9343     });
9344     var HANDLER_KEYS = ['default', 'expected', 'validate', 'deprecated', 'forward', 'redirect', 'overlap', 'preprocess', 'postprocess'];
9345
9346     function createSchema(SchemaConstructor, parameters) {
9347       var schema = new SchemaConstructor(parameters);
9348       var subSchema = Object.create(schema);
9349       var _iteratorNormalCompletion = true;
9350       var _didIteratorError = false;
9351       var _iteratorError = undefined;
9352
9353       try {
9354         for (var _iterator = HANDLER_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9355           var handlerKey = _step.value;
9356
9357           if (handlerKey in parameters) {
9358             subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
9359           }
9360         }
9361       } catch (err) {
9362         _didIteratorError = true;
9363         _iteratorError = err;
9364       } finally {
9365         try {
9366           if (!_iteratorNormalCompletion && _iterator.return != null) {
9367             _iterator.return();
9368           }
9369         } finally {
9370           if (_didIteratorError) {
9371             throw _iteratorError;
9372           }
9373         }
9374       }
9375
9376       return subSchema;
9377     }
9378
9379     exports.createSchema = createSchema;
9380
9381     var Schema =
9382     /*#__PURE__*/
9383     function () {
9384       function Schema(parameters) {
9385         _classCallCheck(this, Schema);
9386
9387         this.name = parameters.name;
9388       }
9389
9390       _createClass(Schema, [{
9391         key: "default",
9392         value: function _default(_utils) {
9393           return undefined;
9394         } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
9395
9396       }, {
9397         key: "expected",
9398         value: function expected(_utils) {
9399           return 'nothing';
9400         } // istanbul ignore next: this is actually an abstract method but we need a placeholder to get `function.length`
9401
9402       }, {
9403         key: "validate",
9404         value: function validate(_value, _utils) {
9405           return false;
9406         }
9407       }, {
9408         key: "deprecated",
9409         value: function deprecated(_value, _utils) {
9410           return false;
9411         }
9412       }, {
9413         key: "forward",
9414         value: function forward(_value, _utils) {
9415           return undefined;
9416         }
9417       }, {
9418         key: "redirect",
9419         value: function redirect(_value, _utils) {
9420           return undefined;
9421         }
9422       }, {
9423         key: "overlap",
9424         value: function overlap(currentValue, _newValue, _utils) {
9425           return currentValue;
9426         }
9427       }, {
9428         key: "preprocess",
9429         value: function preprocess(value, _utils) {
9430           return value;
9431         }
9432       }, {
9433         key: "postprocess",
9434         value: function postprocess(value, _utils) {
9435           return value;
9436         }
9437       }], [{
9438         key: "create",
9439         value: function create(parameters) {
9440           // @ts-ignore: https://github.com/Microsoft/TypeScript/issues/5863
9441           return createSchema(this, parameters);
9442         }
9443       }]);
9444
9445       return Schema;
9446     }();
9447
9448     exports.Schema = Schema;
9449
9450     function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
9451       return typeof handler === 'function' ? function () {
9452         for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9453           args[_key] = arguments[_key];
9454         }
9455
9456         return handler.apply(void 0, _toConsumableArray(args.slice(0, handlerArgumentsLength - 1)).concat([superSchema], _toConsumableArray(args.slice(handlerArgumentsLength - 1))));
9457       } : function () {
9458         return handler;
9459       };
9460     }
9461   });
9462   unwrapExports(schema);
9463   var schema_1 = schema.createSchema;
9464   var schema_2 = schema.Schema;
9465
9466   var alias = createCommonjsModule(function (module, exports) {
9467
9468     Object.defineProperty(exports, "__esModule", {
9469       value: true
9470     });
9471
9472     var AliasSchema =
9473     /*#__PURE__*/
9474     function (_schema_1$Schema) {
9475       _inherits(AliasSchema, _schema_1$Schema);
9476
9477       function AliasSchema(parameters) {
9478         var _this;
9479
9480         _classCallCheck(this, AliasSchema);
9481
9482         _this = _possibleConstructorReturn(this, _getPrototypeOf(AliasSchema).call(this, parameters));
9483         _this._sourceName = parameters.sourceName;
9484         return _this;
9485       }
9486
9487       _createClass(AliasSchema, [{
9488         key: "expected",
9489         value: function expected(utils) {
9490           return utils.schemas[this._sourceName].expected(utils);
9491         }
9492       }, {
9493         key: "validate",
9494         value: function validate(value, utils) {
9495           return utils.schemas[this._sourceName].validate(value, utils);
9496         }
9497       }, {
9498         key: "redirect",
9499         value: function redirect(_value, _utils) {
9500           return this._sourceName;
9501         }
9502       }]);
9503
9504       return AliasSchema;
9505     }(schema.Schema);
9506
9507     exports.AliasSchema = AliasSchema;
9508   });
9509   unwrapExports(alias);
9510   var alias_1 = alias.AliasSchema;
9511
9512   var any = createCommonjsModule(function (module, exports) {
9513
9514     Object.defineProperty(exports, "__esModule", {
9515       value: true
9516     });
9517
9518     var AnySchema =
9519     /*#__PURE__*/
9520     function (_schema_1$Schema) {
9521       _inherits(AnySchema, _schema_1$Schema);
9522
9523       function AnySchema() {
9524         _classCallCheck(this, AnySchema);
9525
9526         return _possibleConstructorReturn(this, _getPrototypeOf(AnySchema).apply(this, arguments));
9527       }
9528
9529       _createClass(AnySchema, [{
9530         key: "expected",
9531         value: function expected() {
9532           return 'anything';
9533         }
9534       }, {
9535         key: "validate",
9536         value: function validate() {
9537           return true;
9538         }
9539       }]);
9540
9541       return AnySchema;
9542     }(schema.Schema);
9543
9544     exports.AnySchema = AnySchema;
9545   });
9546   unwrapExports(any);
9547   var any_1 = any.AnySchema;
9548
9549   var array = createCommonjsModule(function (module, exports) {
9550
9551     Object.defineProperty(exports, "__esModule", {
9552       value: true
9553     });
9554
9555     var ArraySchema =
9556     /*#__PURE__*/
9557     function (_schema_1$Schema) {
9558       _inherits(ArraySchema, _schema_1$Schema);
9559
9560       function ArraySchema(_a) {
9561         var _this;
9562
9563         _classCallCheck(this, ArraySchema);
9564
9565         var valueSchema = _a.valueSchema,
9566             _a$name = _a.name,
9567             name = _a$name === void 0 ? valueSchema.name : _a$name,
9568             handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
9569
9570         _this = _possibleConstructorReturn(this, _getPrototypeOf(ArraySchema).call(this, Object.assign({}, handlers, {
9571           name: name
9572         })));
9573         _this._valueSchema = valueSchema;
9574         return _this;
9575       }
9576
9577       _createClass(ArraySchema, [{
9578         key: "expected",
9579         value: function expected(utils) {
9580           return "an array of ".concat(this._valueSchema.expected(utils));
9581         }
9582       }, {
9583         key: "validate",
9584         value: function validate(value, utils) {
9585           if (!Array.isArray(value)) {
9586             return false;
9587           }
9588
9589           var invalidValues = [];
9590           var _iteratorNormalCompletion = true;
9591           var _didIteratorError = false;
9592           var _iteratorError = undefined;
9593
9594           try {
9595             for (var _iterator = value[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9596               var subValue = _step.value;
9597               var subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
9598
9599               if (subValidateResult !== true) {
9600                 invalidValues.push(subValidateResult.value);
9601               }
9602             }
9603           } catch (err) {
9604             _didIteratorError = true;
9605             _iteratorError = err;
9606           } finally {
9607             try {
9608               if (!_iteratorNormalCompletion && _iterator.return != null) {
9609                 _iterator.return();
9610               }
9611             } finally {
9612               if (_didIteratorError) {
9613                 throw _iteratorError;
9614               }
9615             }
9616           }
9617
9618           return invalidValues.length === 0 ? true : {
9619             value: invalidValues
9620           };
9621         }
9622       }, {
9623         key: "deprecated",
9624         value: function deprecated(value, utils) {
9625           var deprecatedResult = [];
9626           var _iteratorNormalCompletion2 = true;
9627           var _didIteratorError2 = false;
9628           var _iteratorError2 = undefined;
9629
9630           try {
9631             for (var _iterator2 = value[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
9632               var subValue = _step2.value;
9633               var subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
9634
9635               if (subDeprecatedResult !== false) {
9636                 deprecatedResult.push.apply(deprecatedResult, _toConsumableArray(subDeprecatedResult.map(function (_ref) {
9637                   var deprecatedValue = _ref.value;
9638                   return {
9639                     value: [deprecatedValue]
9640                   };
9641                 })));
9642               }
9643             }
9644           } catch (err) {
9645             _didIteratorError2 = true;
9646             _iteratorError2 = err;
9647           } finally {
9648             try {
9649               if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
9650                 _iterator2.return();
9651               }
9652             } finally {
9653               if (_didIteratorError2) {
9654                 throw _iteratorError2;
9655               }
9656             }
9657           }
9658
9659           return deprecatedResult;
9660         }
9661       }, {
9662         key: "forward",
9663         value: function forward(value, utils) {
9664           var forwardResult = [];
9665           var _iteratorNormalCompletion3 = true;
9666           var _didIteratorError3 = false;
9667           var _iteratorError3 = undefined;
9668
9669           try {
9670             for (var _iterator3 = value[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
9671               var subValue = _step3.value;
9672               var subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
9673               forwardResult.push.apply(forwardResult, _toConsumableArray(subForwardResult.map(wrapTransferResult)));
9674             }
9675           } catch (err) {
9676             _didIteratorError3 = true;
9677             _iteratorError3 = err;
9678           } finally {
9679             try {
9680               if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
9681                 _iterator3.return();
9682               }
9683             } finally {
9684               if (_didIteratorError3) {
9685                 throw _iteratorError3;
9686               }
9687             }
9688           }
9689
9690           return forwardResult;
9691         }
9692       }, {
9693         key: "redirect",
9694         value: function redirect(value, utils) {
9695           var remain = [];
9696           var redirect = [];
9697           var _iteratorNormalCompletion4 = true;
9698           var _didIteratorError4 = false;
9699           var _iteratorError4 = undefined;
9700
9701           try {
9702             for (var _iterator4 = value[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
9703               var subValue = _step4.value;
9704               var subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
9705
9706               if ('remain' in subRedirectResult) {
9707                 remain.push(subRedirectResult.remain);
9708               }
9709
9710               redirect.push.apply(redirect, _toConsumableArray(subRedirectResult.redirect.map(wrapTransferResult)));
9711             }
9712           } catch (err) {
9713             _didIteratorError4 = true;
9714             _iteratorError4 = err;
9715           } finally {
9716             try {
9717               if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
9718                 _iterator4.return();
9719               }
9720             } finally {
9721               if (_didIteratorError4) {
9722                 throw _iteratorError4;
9723               }
9724             }
9725           }
9726
9727           return remain.length === 0 ? {
9728             redirect: redirect
9729           } : {
9730             redirect: redirect,
9731             remain: remain
9732           };
9733         }
9734       }, {
9735         key: "overlap",
9736         value: function overlap(currentValue, newValue) {
9737           return currentValue.concat(newValue);
9738         }
9739       }]);
9740
9741       return ArraySchema;
9742     }(schema.Schema);
9743
9744     exports.ArraySchema = ArraySchema;
9745
9746     function wrapTransferResult(_ref2) {
9747       var from = _ref2.from,
9748           to = _ref2.to;
9749       return {
9750         from: [from],
9751         to: to
9752       };
9753     }
9754   });
9755   unwrapExports(array);
9756   var array_1 = array.ArraySchema;
9757
9758   var boolean_1 = createCommonjsModule(function (module, exports) {
9759
9760     Object.defineProperty(exports, "__esModule", {
9761       value: true
9762     });
9763
9764     var BooleanSchema =
9765     /*#__PURE__*/
9766     function (_schema_1$Schema) {
9767       _inherits(BooleanSchema, _schema_1$Schema);
9768
9769       function BooleanSchema() {
9770         _classCallCheck(this, BooleanSchema);
9771
9772         return _possibleConstructorReturn(this, _getPrototypeOf(BooleanSchema).apply(this, arguments));
9773       }
9774
9775       _createClass(BooleanSchema, [{
9776         key: "expected",
9777         value: function expected() {
9778           return 'true or false';
9779         }
9780       }, {
9781         key: "validate",
9782         value: function validate(value) {
9783           return typeof value === 'boolean';
9784         }
9785       }]);
9786
9787       return BooleanSchema;
9788     }(schema.Schema);
9789
9790     exports.BooleanSchema = BooleanSchema;
9791   });
9792   unwrapExports(boolean_1);
9793   var boolean_2 = boolean_1.BooleanSchema;
9794
9795   var utils = createCommonjsModule(function (module, exports) {
9796
9797     Object.defineProperty(exports, "__esModule", {
9798       value: true
9799     });
9800
9801     function recordFromArray(array, mainKey) {
9802       var record = Object.create(null);
9803       var _iteratorNormalCompletion = true;
9804       var _didIteratorError = false;
9805       var _iteratorError = undefined;
9806
9807       try {
9808         for (var _iterator = array[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
9809           var value = _step.value;
9810           var key = value[mainKey]; // istanbul ignore next
9811
9812           if (record[key]) {
9813             throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
9814           } // @ts-ignore
9815
9816
9817           record[key] = value;
9818         }
9819       } catch (err) {
9820         _didIteratorError = true;
9821         _iteratorError = err;
9822       } finally {
9823         try {
9824           if (!_iteratorNormalCompletion && _iterator.return != null) {
9825             _iterator.return();
9826           }
9827         } finally {
9828           if (_didIteratorError) {
9829             throw _iteratorError;
9830           }
9831         }
9832       }
9833
9834       return record;
9835     }
9836
9837     exports.recordFromArray = recordFromArray;
9838
9839     function mapFromArray(array, mainKey) {
9840       var map = new Map();
9841       var _iteratorNormalCompletion2 = true;
9842       var _didIteratorError2 = false;
9843       var _iteratorError2 = undefined;
9844
9845       try {
9846         for (var _iterator2 = array[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
9847           var value = _step2.value;
9848           var key = value[mainKey]; // istanbul ignore next
9849
9850           if (map.has(key)) {
9851             throw new Error("Duplicate ".concat(mainKey, " ").concat(JSON.stringify(key)));
9852           }
9853
9854           map.set(key, value);
9855         }
9856       } catch (err) {
9857         _didIteratorError2 = true;
9858         _iteratorError2 = err;
9859       } finally {
9860         try {
9861           if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
9862             _iterator2.return();
9863           }
9864         } finally {
9865           if (_didIteratorError2) {
9866             throw _iteratorError2;
9867           }
9868         }
9869       }
9870
9871       return map;
9872     }
9873
9874     exports.mapFromArray = mapFromArray;
9875
9876     function createAutoChecklist() {
9877       var map = Object.create(null);
9878       return function (id) {
9879         var idString = JSON.stringify(id);
9880
9881         if (map[idString]) {
9882           return true;
9883         }
9884
9885         map[idString] = true;
9886         return false;
9887       };
9888     }
9889
9890     exports.createAutoChecklist = createAutoChecklist;
9891
9892     function partition(array, predicate) {
9893       var trueArray = [];
9894       var falseArray = [];
9895       var _iteratorNormalCompletion3 = true;
9896       var _didIteratorError3 = false;
9897       var _iteratorError3 = undefined;
9898
9899       try {
9900         for (var _iterator3 = array[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
9901           var value = _step3.value;
9902
9903           if (predicate(value)) {
9904             trueArray.push(value);
9905           } else {
9906             falseArray.push(value);
9907           }
9908         }
9909       } catch (err) {
9910         _didIteratorError3 = true;
9911         _iteratorError3 = err;
9912       } finally {
9913         try {
9914           if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
9915             _iterator3.return();
9916           }
9917         } finally {
9918           if (_didIteratorError3) {
9919             throw _iteratorError3;
9920           }
9921         }
9922       }
9923
9924       return [trueArray, falseArray];
9925     }
9926
9927     exports.partition = partition;
9928
9929     function isInt(value) {
9930       return value === Math.floor(value);
9931     }
9932
9933     exports.isInt = isInt;
9934
9935     function comparePrimitive(a, b) {
9936       if (a === b) {
9937         return 0;
9938       }
9939
9940       var typeofA = _typeof(a);
9941
9942       var typeofB = _typeof(b);
9943
9944       var orders = ['undefined', 'object', 'boolean', 'number', 'string'];
9945
9946       if (typeofA !== typeofB) {
9947         return orders.indexOf(typeofA) - orders.indexOf(typeofB);
9948       }
9949
9950       if (typeofA !== 'string') {
9951         return Number(a) - Number(b);
9952       }
9953
9954       return a.localeCompare(b);
9955     }
9956
9957     exports.comparePrimitive = comparePrimitive;
9958
9959     function normalizeDefaultResult(result) {
9960       return result === undefined ? {} : result;
9961     }
9962
9963     exports.normalizeDefaultResult = normalizeDefaultResult;
9964
9965     function normalizeValidateResult(result, value) {
9966       return result === true ? true : result === false ? {
9967         value: value
9968       } : result;
9969     }
9970
9971     exports.normalizeValidateResult = normalizeValidateResult;
9972
9973     function normalizeDeprecatedResult(result, value) {
9974       var doNotNormalizeTrue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
9975       return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
9976         value: value
9977       }] : 'value' in result ? [result] : result.length === 0 ? false : result;
9978     }
9979
9980     exports.normalizeDeprecatedResult = normalizeDeprecatedResult;
9981
9982     function normalizeTransferResult(result, value) {
9983       return typeof result === 'string' || 'key' in result ? {
9984         from: value,
9985         to: result
9986       } : 'from' in result ? {
9987         from: result.from,
9988         to: result.to
9989       } : {
9990         from: value,
9991         to: result.to
9992       };
9993     }
9994
9995     exports.normalizeTransferResult = normalizeTransferResult;
9996
9997     function normalizeForwardResult(result, value) {
9998       return result === undefined ? [] : Array.isArray(result) ? result.map(function (transferResult) {
9999         return normalizeTransferResult(transferResult, value);
10000       }) : [normalizeTransferResult(result, value)];
10001     }
10002
10003     exports.normalizeForwardResult = normalizeForwardResult;
10004
10005     function normalizeRedirectResult(result, value) {
10006       var redirect = normalizeForwardResult(_typeof(result) === 'object' && 'redirect' in result ? result.redirect : result, value);
10007       return redirect.length === 0 ? {
10008         remain: value,
10009         redirect: redirect
10010       } : _typeof(result) === 'object' && 'remain' in result ? {
10011         remain: result.remain,
10012         redirect: redirect
10013       } : {
10014         redirect: redirect
10015       };
10016     }
10017
10018     exports.normalizeRedirectResult = normalizeRedirectResult;
10019   });
10020   unwrapExports(utils);
10021   var utils_1 = utils.recordFromArray;
10022   var utils_2 = utils.mapFromArray;
10023   var utils_3 = utils.createAutoChecklist;
10024   var utils_4 = utils.partition;
10025   var utils_5 = utils.isInt;
10026   var utils_6 = utils.comparePrimitive;
10027   var utils_7 = utils.normalizeDefaultResult;
10028   var utils_8 = utils.normalizeValidateResult;
10029   var utils_9 = utils.normalizeDeprecatedResult;
10030   var utils_10 = utils.normalizeTransferResult;
10031   var utils_11 = utils.normalizeForwardResult;
10032   var utils_12 = utils.normalizeRedirectResult;
10033
10034   var choice = createCommonjsModule(function (module, exports) {
10035
10036     Object.defineProperty(exports, "__esModule", {
10037       value: true
10038     });
10039
10040     var ChoiceSchema =
10041     /*#__PURE__*/
10042     function (_schema_1$Schema) {
10043       _inherits(ChoiceSchema, _schema_1$Schema);
10044
10045       function ChoiceSchema(parameters) {
10046         var _this;
10047
10048         _classCallCheck(this, ChoiceSchema);
10049
10050         _this = _possibleConstructorReturn(this, _getPrototypeOf(ChoiceSchema).call(this, parameters));
10051         _this._choices = utils.mapFromArray(parameters.choices.map(function (choice) {
10052           return choice && _typeof(choice) === 'object' ? choice : {
10053             value: choice
10054           };
10055         }), 'value');
10056         return _this;
10057       }
10058
10059       _createClass(ChoiceSchema, [{
10060         key: "expected",
10061         value: function expected(_ref) {
10062           var _this2 = this;
10063
10064           var descriptor = _ref.descriptor;
10065           var choiceValues = Array.from(this._choices.keys()).map(function (value) {
10066             return _this2._choices.get(value);
10067           }).filter(function (choiceInfo) {
10068             return !choiceInfo.deprecated;
10069           }).map(function (choiceInfo) {
10070             return choiceInfo.value;
10071           }).sort(utils.comparePrimitive).map(descriptor.value);
10072           var head = choiceValues.slice(0, -2);
10073           var tail = choiceValues.slice(-2);
10074           return head.concat(tail.join(' or ')).join(', ');
10075         }
10076       }, {
10077         key: "validate",
10078         value: function validate(value) {
10079           return this._choices.has(value);
10080         }
10081       }, {
10082         key: "deprecated",
10083         value: function deprecated(value) {
10084           var choiceInfo = this._choices.get(value);
10085
10086           return choiceInfo && choiceInfo.deprecated ? {
10087             value: value
10088           } : false;
10089         }
10090       }, {
10091         key: "forward",
10092         value: function forward(value) {
10093           var choiceInfo = this._choices.get(value);
10094
10095           return choiceInfo ? choiceInfo.forward : undefined;
10096         }
10097       }, {
10098         key: "redirect",
10099         value: function redirect(value) {
10100           var choiceInfo = this._choices.get(value);
10101
10102           return choiceInfo ? choiceInfo.redirect : undefined;
10103         }
10104       }]);
10105
10106       return ChoiceSchema;
10107     }(schema.Schema);
10108
10109     exports.ChoiceSchema = ChoiceSchema;
10110   });
10111   unwrapExports(choice);
10112   var choice_1 = choice.ChoiceSchema;
10113
10114   var number = createCommonjsModule(function (module, exports) {
10115
10116     Object.defineProperty(exports, "__esModule", {
10117       value: true
10118     });
10119
10120     var NumberSchema =
10121     /*#__PURE__*/
10122     function (_schema_1$Schema) {
10123       _inherits(NumberSchema, _schema_1$Schema);
10124
10125       function NumberSchema() {
10126         _classCallCheck(this, NumberSchema);
10127
10128         return _possibleConstructorReturn(this, _getPrototypeOf(NumberSchema).apply(this, arguments));
10129       }
10130
10131       _createClass(NumberSchema, [{
10132         key: "expected",
10133         value: function expected() {
10134           return 'a number';
10135         }
10136       }, {
10137         key: "validate",
10138         value: function validate(value, _utils) {
10139           return typeof value === 'number';
10140         }
10141       }]);
10142
10143       return NumberSchema;
10144     }(schema.Schema);
10145
10146     exports.NumberSchema = NumberSchema;
10147   });
10148   unwrapExports(number);
10149   var number_1 = number.NumberSchema;
10150
10151   var integer = createCommonjsModule(function (module, exports) {
10152
10153     Object.defineProperty(exports, "__esModule", {
10154       value: true
10155     });
10156
10157     var IntegerSchema =
10158     /*#__PURE__*/
10159     function (_number_1$NumberSchem) {
10160       _inherits(IntegerSchema, _number_1$NumberSchem);
10161
10162       function IntegerSchema() {
10163         _classCallCheck(this, IntegerSchema);
10164
10165         return _possibleConstructorReturn(this, _getPrototypeOf(IntegerSchema).apply(this, arguments));
10166       }
10167
10168       _createClass(IntegerSchema, [{
10169         key: "expected",
10170         value: function expected() {
10171           return 'an integer';
10172         }
10173       }, {
10174         key: "validate",
10175         value: function validate(value, utils$1) {
10176           return utils$1.normalizeValidateResult(_get(_getPrototypeOf(IntegerSchema.prototype), "validate", this).call(this, value, utils$1), value) === true && utils.isInt(value);
10177         }
10178       }]);
10179
10180       return IntegerSchema;
10181     }(number.NumberSchema);
10182
10183     exports.IntegerSchema = IntegerSchema;
10184   });
10185   unwrapExports(integer);
10186   var integer_1 = integer.IntegerSchema;
10187
10188   var string = createCommonjsModule(function (module, exports) {
10189
10190     Object.defineProperty(exports, "__esModule", {
10191       value: true
10192     });
10193
10194     var StringSchema =
10195     /*#__PURE__*/
10196     function (_schema_1$Schema) {
10197       _inherits(StringSchema, _schema_1$Schema);
10198
10199       function StringSchema() {
10200         _classCallCheck(this, StringSchema);
10201
10202         return _possibleConstructorReturn(this, _getPrototypeOf(StringSchema).apply(this, arguments));
10203       }
10204
10205       _createClass(StringSchema, [{
10206         key: "expected",
10207         value: function expected() {
10208           return 'a string';
10209         }
10210       }, {
10211         key: "validate",
10212         value: function validate(value) {
10213           return typeof value === 'string';
10214         }
10215       }]);
10216
10217       return StringSchema;
10218     }(schema.Schema);
10219
10220     exports.StringSchema = StringSchema;
10221   });
10222   unwrapExports(string);
10223   var string_1 = string.StringSchema;
10224
10225   var schemas = createCommonjsModule(function (module, exports) {
10226
10227     Object.defineProperty(exports, "__esModule", {
10228       value: true
10229     });
10230
10231     tslib_1.__exportStar(alias, exports);
10232
10233     tslib_1.__exportStar(any, exports);
10234
10235     tslib_1.__exportStar(array, exports);
10236
10237     tslib_1.__exportStar(boolean_1, exports);
10238
10239     tslib_1.__exportStar(choice, exports);
10240
10241     tslib_1.__exportStar(integer, exports);
10242
10243     tslib_1.__exportStar(number, exports);
10244
10245     tslib_1.__exportStar(string, exports);
10246   });
10247   unwrapExports(schemas);
10248
10249   var defaults = createCommonjsModule(function (module, exports) {
10250
10251     Object.defineProperty(exports, "__esModule", {
10252       value: true
10253     });
10254     exports.defaultDescriptor = api.apiDescriptor;
10255     exports.defaultUnknownHandler = leven_1.levenUnknownHandler;
10256     exports.defaultInvalidHandler = invalid.commonInvalidHandler;
10257     exports.defaultDeprecatedHandler = common.commonDeprecatedHandler;
10258   });
10259   unwrapExports(defaults);
10260   var defaults_1 = defaults.defaultDescriptor;
10261   var defaults_2 = defaults.defaultUnknownHandler;
10262   var defaults_3 = defaults.defaultInvalidHandler;
10263   var defaults_4 = defaults.defaultDeprecatedHandler;
10264
10265   var normalize = createCommonjsModule(function (module, exports) {
10266
10267     Object.defineProperty(exports, "__esModule", {
10268       value: true
10269     });
10270
10271     exports.normalize = function (options, schemas, opts) {
10272       return new Normalizer(schemas, opts).normalize(options);
10273     };
10274
10275     var Normalizer =
10276     /*#__PURE__*/
10277     function () {
10278       function Normalizer(schemas, opts) {
10279         _classCallCheck(this, Normalizer);
10280
10281         // istanbul ignore next
10282         var _ref = opts || {},
10283             _ref$logger = _ref.logger,
10284             logger = _ref$logger === void 0 ? console : _ref$logger,
10285             _ref$descriptor = _ref.descriptor,
10286             descriptor = _ref$descriptor === void 0 ? defaults.defaultDescriptor : _ref$descriptor,
10287             _ref$unknown = _ref.unknown,
10288             unknown = _ref$unknown === void 0 ? defaults.defaultUnknownHandler : _ref$unknown,
10289             _ref$invalid = _ref.invalid,
10290             invalid = _ref$invalid === void 0 ? defaults.defaultInvalidHandler : _ref$invalid,
10291             _ref$deprecated = _ref.deprecated,
10292             deprecated = _ref$deprecated === void 0 ? defaults.defaultDeprecatedHandler : _ref$deprecated;
10293
10294         this._utils = {
10295           descriptor: descriptor,
10296           logger:
10297           /* istanbul ignore next */
10298           logger || {
10299             warn: function warn() {}
10300           },
10301           schemas: utils.recordFromArray(schemas, 'name'),
10302           normalizeDefaultResult: utils.normalizeDefaultResult,
10303           normalizeDeprecatedResult: utils.normalizeDeprecatedResult,
10304           normalizeForwardResult: utils.normalizeForwardResult,
10305           normalizeRedirectResult: utils.normalizeRedirectResult,
10306           normalizeValidateResult: utils.normalizeValidateResult
10307         };
10308         this._unknownHandler = unknown;
10309         this._invalidHandler = invalid;
10310         this._deprecatedHandler = deprecated;
10311         this.cleanHistory();
10312       }
10313
10314       _createClass(Normalizer, [{
10315         key: "cleanHistory",
10316         value: function cleanHistory() {
10317           this._hasDeprecationWarned = utils.createAutoChecklist();
10318         }
10319       }, {
10320         key: "normalize",
10321         value: function normalize(options) {
10322           var _this = this;
10323
10324           var normalized = {};
10325           var restOptionsArray = [options];
10326
10327           var applyNormalization = function applyNormalization() {
10328             while (restOptionsArray.length !== 0) {
10329               var currentOptions = restOptionsArray.shift();
10330
10331               var transferredOptionsArray = _this._applyNormalization(currentOptions, normalized);
10332
10333               restOptionsArray.push.apply(restOptionsArray, _toConsumableArray(transferredOptionsArray));
10334             }
10335           };
10336
10337           applyNormalization();
10338
10339           for (var _i = 0, _Object$keys = Object.keys(this._utils.schemas); _i < _Object$keys.length; _i++) {
10340             var key = _Object$keys[_i];
10341             var schema = this._utils.schemas[key];
10342
10343             if (!(key in normalized)) {
10344               var defaultResult = utils.normalizeDefaultResult(schema.default(this._utils));
10345
10346               if ('value' in defaultResult) {
10347                 restOptionsArray.push(_defineProperty({}, key, defaultResult.value));
10348               }
10349             }
10350           }
10351
10352           applyNormalization();
10353
10354           for (var _i2 = 0, _Object$keys2 = Object.keys(this._utils.schemas); _i2 < _Object$keys2.length; _i2++) {
10355             var _key = _Object$keys2[_i2];
10356             var _schema = this._utils.schemas[_key];
10357
10358             if (_key in normalized) {
10359               normalized[_key] = _schema.postprocess(normalized[_key], this._utils);
10360             }
10361           }
10362
10363           return normalized;
10364         }
10365       }, {
10366         key: "_applyNormalization",
10367         value: function _applyNormalization(options, normalized) {
10368           var _this2 = this;
10369
10370           var transferredOptionsArray = [];
10371
10372           var _utils_1$partition = utils.partition(Object.keys(options), function (key) {
10373             return key in _this2._utils.schemas;
10374           }),
10375               _utils_1$partition2 = _slicedToArray(_utils_1$partition, 2),
10376               knownOptionNames = _utils_1$partition2[0],
10377               unknownOptionNames = _utils_1$partition2[1];
10378
10379           var _iteratorNormalCompletion = true;
10380           var _didIteratorError = false;
10381           var _iteratorError = undefined;
10382
10383           try {
10384             var _loop = function _loop() {
10385               var key = _step.value;
10386               var schema = _this2._utils.schemas[key];
10387               var value = schema.preprocess(options[key], _this2._utils);
10388               var validateResult = utils.normalizeValidateResult(schema.validate(value, _this2._utils), value);
10389
10390               if (validateResult !== true) {
10391                 var invalidValue = validateResult.value;
10392
10393                 var errorMessageOrError = _this2._invalidHandler(key, invalidValue, _this2._utils);
10394
10395                 throw typeof errorMessageOrError === 'string' ? new Error(errorMessageOrError) :
10396                 /* istanbul ignore next*/
10397                 errorMessageOrError;
10398               }
10399
10400               var appendTransferredOptions = function appendTransferredOptions(_ref2) {
10401                 var from = _ref2.from,
10402                     to = _ref2.to;
10403                 transferredOptionsArray.push(typeof to === 'string' ? _defineProperty({}, to, from) : _defineProperty({}, to.key, to.value));
10404               };
10405
10406               var warnDeprecated = function warnDeprecated(_ref5) {
10407                 var currentValue = _ref5.value,
10408                     redirectTo = _ref5.redirectTo;
10409                 var deprecatedResult = utils.normalizeDeprecatedResult(schema.deprecated(currentValue, _this2._utils), value,
10410                 /* doNotNormalizeTrue */
10411                 true);
10412
10413                 if (deprecatedResult === false) {
10414                   return;
10415                 }
10416
10417                 if (deprecatedResult === true) {
10418                   if (!_this2._hasDeprecationWarned(key)) {
10419                     _this2._utils.logger.warn(_this2._deprecatedHandler(key, redirectTo, _this2._utils));
10420                   }
10421                 } else {
10422                   var _iteratorNormalCompletion3 = true;
10423                   var _didIteratorError3 = false;
10424                   var _iteratorError3 = undefined;
10425
10426                   try {
10427                     for (var _iterator3 = deprecatedResult[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
10428                       var deprecatedValue = _step3.value.value;
10429                       var pair = {
10430                         key: key,
10431                         value: deprecatedValue
10432                       };
10433
10434                       if (!_this2._hasDeprecationWarned(pair)) {
10435                         var redirectToPair = typeof redirectTo === 'string' ? {
10436                           key: redirectTo,
10437                           value: deprecatedValue
10438                         } : redirectTo;
10439
10440                         _this2._utils.logger.warn(_this2._deprecatedHandler(pair, redirectToPair, _this2._utils));
10441                       }
10442                     }
10443                   } catch (err) {
10444                     _didIteratorError3 = true;
10445                     _iteratorError3 = err;
10446                   } finally {
10447                     try {
10448                       if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
10449                         _iterator3.return();
10450                       }
10451                     } finally {
10452                       if (_didIteratorError3) {
10453                         throw _iteratorError3;
10454                       }
10455                     }
10456                   }
10457                 }
10458               };
10459
10460               var forwardResult = utils.normalizeForwardResult(schema.forward(value, _this2._utils), value);
10461               forwardResult.forEach(appendTransferredOptions);
10462               var redirectResult = utils.normalizeRedirectResult(schema.redirect(value, _this2._utils), value);
10463               redirectResult.redirect.forEach(appendTransferredOptions);
10464
10465               if ('remain' in redirectResult) {
10466                 var remainingValue = redirectResult.remain;
10467                 normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, _this2._utils) : remainingValue;
10468                 warnDeprecated({
10469                   value: remainingValue
10470                 });
10471               }
10472
10473               var _iteratorNormalCompletion4 = true;
10474               var _didIteratorError4 = false;
10475               var _iteratorError4 = undefined;
10476
10477               try {
10478                 for (var _iterator4 = redirectResult.redirect[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
10479                   var _step4$value = _step4.value,
10480                       from = _step4$value.from,
10481                       to = _step4$value.to;
10482                   warnDeprecated({
10483                     value: from,
10484                     redirectTo: to
10485                   });
10486                 }
10487               } catch (err) {
10488                 _didIteratorError4 = true;
10489                 _iteratorError4 = err;
10490               } finally {
10491                 try {
10492                   if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
10493                     _iterator4.return();
10494                   }
10495                 } finally {
10496                   if (_didIteratorError4) {
10497                     throw _iteratorError4;
10498                   }
10499                 }
10500               }
10501             };
10502
10503             for (var _iterator = knownOptionNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
10504               _loop();
10505             }
10506           } catch (err) {
10507             _didIteratorError = true;
10508             _iteratorError = err;
10509           } finally {
10510             try {
10511               if (!_iteratorNormalCompletion && _iterator.return != null) {
10512                 _iterator.return();
10513               }
10514             } finally {
10515               if (_didIteratorError) {
10516                 throw _iteratorError;
10517               }
10518             }
10519           }
10520
10521           var _iteratorNormalCompletion2 = true;
10522           var _didIteratorError2 = false;
10523           var _iteratorError2 = undefined;
10524
10525           try {
10526             for (var _iterator2 = unknownOptionNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
10527               var key = _step2.value;
10528               var value = options[key];
10529
10530               var unknownResult = this._unknownHandler(key, value, this._utils);
10531
10532               if (unknownResult) {
10533                 for (var _i3 = 0, _Object$keys3 = Object.keys(unknownResult); _i3 < _Object$keys3.length; _i3++) {
10534                   var unknownKey = _Object$keys3[_i3];
10535
10536                   var unknownOption = _defineProperty({}, unknownKey, unknownResult[unknownKey]);
10537
10538                   if (unknownKey in this._utils.schemas) {
10539                     transferredOptionsArray.push(unknownOption);
10540                   } else {
10541                     Object.assign(normalized, unknownOption);
10542                   }
10543                 }
10544               }
10545             }
10546           } catch (err) {
10547             _didIteratorError2 = true;
10548             _iteratorError2 = err;
10549           } finally {
10550             try {
10551               if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
10552                 _iterator2.return();
10553               }
10554             } finally {
10555               if (_didIteratorError2) {
10556                 throw _iteratorError2;
10557               }
10558             }
10559           }
10560
10561           return transferredOptionsArray;
10562         }
10563       }]);
10564
10565       return Normalizer;
10566     }();
10567
10568     exports.Normalizer = Normalizer;
10569   });
10570   unwrapExports(normalize);
10571   var normalize_1 = normalize.normalize;
10572   var normalize_2 = normalize.Normalizer;
10573
10574   var lib = createCommonjsModule(function (module, exports) {
10575
10576     Object.defineProperty(exports, "__esModule", {
10577       value: true
10578     });
10579
10580     tslib_1.__exportStar(descriptors, exports);
10581
10582     tslib_1.__exportStar(handlers, exports);
10583
10584     tslib_1.__exportStar(schemas, exports);
10585
10586     tslib_1.__exportStar(normalize, exports);
10587
10588     tslib_1.__exportStar(schema, exports);
10589   });
10590   unwrapExports(lib);
10591
10592   var array$1 = [];
10593   var charCodeCache$1 = [];
10594
10595   var leven$1 = function leven(left, right) {
10596     if (left === right) {
10597       return 0;
10598     }
10599
10600     var swap = left; // Swapping the strings if `a` is longer than `b` so we know which one is the
10601     // shortest & which one is the longest
10602
10603     if (left.length > right.length) {
10604       left = right;
10605       right = swap;
10606     }
10607
10608     var leftLength = left.length;
10609     var rightLength = right.length; // Performing suffix trimming:
10610     // We can linearly drop suffix common to both strings since they
10611     // don't increase distance at all
10612     // Note: `~-` is the bitwise way to perform a `- 1` operation
10613
10614     while (leftLength > 0 && left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength)) {
10615       leftLength--;
10616       rightLength--;
10617     } // Performing prefix trimming
10618     // We can linearly drop prefix common to both strings since they
10619     // don't increase distance at all
10620
10621
10622     var start = 0;
10623
10624     while (start < leftLength && left.charCodeAt(start) === right.charCodeAt(start)) {
10625       start++;
10626     }
10627
10628     leftLength -= start;
10629     rightLength -= start;
10630
10631     if (leftLength === 0) {
10632       return rightLength;
10633     }
10634
10635     var bCharCode;
10636     var result;
10637     var temp;
10638     var temp2;
10639     var i = 0;
10640     var j = 0;
10641
10642     while (i < leftLength) {
10643       charCodeCache$1[i] = left.charCodeAt(start + i);
10644       array$1[i] = ++i;
10645     }
10646
10647     while (j < rightLength) {
10648       bCharCode = right.charCodeAt(start + j);
10649       temp = j++;
10650       result = j;
10651
10652       for (i = 0; i < leftLength; i++) {
10653         temp2 = bCharCode === charCodeCache$1[i] ? temp : temp + 1;
10654         temp = array$1[i]; // eslint-disable-next-line no-multi-assign
10655
10656         result = array$1[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
10657       }
10658     }
10659
10660     return result;
10661   };
10662
10663   var leven_1$1 = leven$1; // TODO: Remove this for the next major release
10664
10665   var default_1 = leven$1;
10666   leven_1$1.default = default_1;
10667
10668   var cliDescriptor = {
10669     key: function key(_key) {
10670       return _key.length === 1 ? "-".concat(_key) : "--".concat(_key);
10671     },
10672     value: function value(_value) {
10673       return lib.apiDescriptor.value(_value);
10674     },
10675     pair: function pair(_ref) {
10676       var key = _ref.key,
10677           value = _ref.value;
10678       return value === false ? "--no-".concat(key) : value === true ? cliDescriptor.key(key) : value === "" ? "".concat(cliDescriptor.key(key), " without an argument") : "".concat(cliDescriptor.key(key), "=").concat(value);
10679     }
10680   };
10681
10682   var FlagSchema =
10683   /*#__PURE__*/
10684   function (_vnopts$ChoiceSchema) {
10685     _inherits(FlagSchema, _vnopts$ChoiceSchema);
10686
10687     function FlagSchema(_ref2) {
10688       var _this;
10689
10690       var name = _ref2.name,
10691           flags = _ref2.flags;
10692
10693       _classCallCheck(this, FlagSchema);
10694
10695       _this = _possibleConstructorReturn(this, _getPrototypeOf(FlagSchema).call(this, {
10696         name: name,
10697         choices: flags
10698       }));
10699       _this._flags = flags.slice().sort();
10700       return _this;
10701     }
10702
10703     _createClass(FlagSchema, [{
10704       key: "preprocess",
10705       value: function preprocess(value, utils) {
10706         if (typeof value === "string" && value.length !== 0 && this._flags.indexOf(value) === -1) {
10707           var suggestion = this._flags.find(function (flag) {
10708             return leven_1$1(flag, value) < 3;
10709           });
10710
10711           if (suggestion) {
10712             utils.logger.warn(["Unknown flag ".concat(chalk.yellow(utils.descriptor.value(value)), ","), "did you mean ".concat(chalk.blue(utils.descriptor.value(suggestion)), "?")].join(" "));
10713             return suggestion;
10714           }
10715         }
10716
10717         return value;
10718       }
10719     }, {
10720       key: "expected",
10721       value: function expected() {
10722         return "a flag";
10723       }
10724     }]);
10725
10726     return FlagSchema;
10727   }(lib.ChoiceSchema);
10728
10729   var hasDeprecationWarned;
10730
10731   function normalizeOptions(options, optionInfos) {
10732     var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
10733         logger = _ref3.logger,
10734         _ref3$isCLI = _ref3.isCLI,
10735         isCLI = _ref3$isCLI === void 0 ? false : _ref3$isCLI,
10736         _ref3$passThrough = _ref3.passThrough,
10737         passThrough = _ref3$passThrough === void 0 ? false : _ref3$passThrough;
10738
10739     var unknown = !passThrough ? lib.levenUnknownHandler : Array.isArray(passThrough) ? function (key, value) {
10740       return passThrough.indexOf(key) === -1 ? undefined : _defineProperty({}, key, value);
10741     } : function (key, value) {
10742       return _defineProperty({}, key, value);
10743     };
10744     var descriptor = isCLI ? cliDescriptor : lib.apiDescriptor;
10745     var schemas = optionInfosToSchemas(optionInfos, {
10746       isCLI: isCLI
10747     });
10748     var normalizer = new lib.Normalizer(schemas, {
10749       logger: logger,
10750       unknown: unknown,
10751       descriptor: descriptor
10752     });
10753     var shouldSuppressDuplicateDeprecationWarnings = logger !== false;
10754
10755     if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
10756       normalizer._hasDeprecationWarned = hasDeprecationWarned;
10757     }
10758
10759     var normalized = normalizer.normalize(options);
10760
10761     if (shouldSuppressDuplicateDeprecationWarnings) {
10762       hasDeprecationWarned = normalizer._hasDeprecationWarned;
10763     }
10764
10765     return normalized;
10766   }
10767
10768   function optionInfosToSchemas(optionInfos, _ref6) {
10769     var isCLI = _ref6.isCLI;
10770     var schemas = [];
10771
10772     if (isCLI) {
10773       schemas.push(lib.AnySchema.create({
10774         name: "_"
10775       }));
10776     }
10777
10778     var _iteratorNormalCompletion = true;
10779     var _didIteratorError = false;
10780     var _iteratorError = undefined;
10781
10782     try {
10783       for (var _iterator = optionInfos[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
10784         var optionInfo = _step.value;
10785         schemas.push(optionInfoToSchema(optionInfo, {
10786           isCLI: isCLI,
10787           optionInfos: optionInfos
10788         }));
10789
10790         if (optionInfo.alias && isCLI) {
10791           schemas.push(lib.AliasSchema.create({
10792             name: optionInfo.alias,
10793             sourceName: optionInfo.name
10794           }));
10795         }
10796       }
10797     } catch (err) {
10798       _didIteratorError = true;
10799       _iteratorError = err;
10800     } finally {
10801       try {
10802         if (!_iteratorNormalCompletion && _iterator.return != null) {
10803           _iterator.return();
10804         }
10805       } finally {
10806         if (_didIteratorError) {
10807           throw _iteratorError;
10808         }
10809       }
10810     }
10811
10812     return schemas;
10813   }
10814
10815   function optionInfoToSchema(optionInfo, _ref7) {
10816     var isCLI = _ref7.isCLI,
10817         optionInfos = _ref7.optionInfos;
10818     var SchemaConstructor;
10819     var parameters = {
10820       name: optionInfo.name
10821     };
10822     var handlers = {};
10823
10824     switch (optionInfo.type) {
10825       case "int":
10826         SchemaConstructor = lib.IntegerSchema;
10827
10828         if (isCLI) {
10829           parameters.preprocess = function (value) {
10830             return Number(value);
10831           };
10832         }
10833
10834         break;
10835
10836       case "string":
10837         SchemaConstructor = lib.StringSchema;
10838         break;
10839
10840       case "choice":
10841         SchemaConstructor = lib.ChoiceSchema;
10842         parameters.choices = optionInfo.choices.map(function (choiceInfo) {
10843           return _typeof(choiceInfo) === "object" && choiceInfo.redirect ? Object.assign({}, choiceInfo, {
10844             redirect: {
10845               to: {
10846                 key: optionInfo.name,
10847                 value: choiceInfo.redirect
10848               }
10849             }
10850           }) : choiceInfo;
10851         });
10852         break;
10853
10854       case "boolean":
10855         SchemaConstructor = lib.BooleanSchema;
10856         break;
10857
10858       case "flag":
10859         SchemaConstructor = FlagSchema;
10860         parameters.flags = optionInfos.map(function (optionInfo) {
10861           return [].concat(optionInfo.alias || [], optionInfo.description ? optionInfo.name : [], optionInfo.oppositeDescription ? "no-".concat(optionInfo.name) : []);
10862         }).reduce(function (a, b) {
10863           return a.concat(b);
10864         }, []);
10865         break;
10866
10867       case "path":
10868         SchemaConstructor = lib.StringSchema;
10869         break;
10870
10871       default:
10872         throw new Error("Unexpected type ".concat(optionInfo.type));
10873     }
10874
10875     if (optionInfo.exception) {
10876       parameters.validate = function (value, schema, utils) {
10877         return optionInfo.exception(value) || schema.validate(value, utils);
10878       };
10879     } else {
10880       parameters.validate = function (value, schema, utils) {
10881         return value === undefined || schema.validate(value, utils);
10882       };
10883     }
10884
10885     if (optionInfo.redirect) {
10886       handlers.redirect = function (value) {
10887         return !value ? undefined : {
10888           to: {
10889             key: optionInfo.redirect.option,
10890             value: optionInfo.redirect.value
10891           }
10892         };
10893       };
10894     }
10895
10896     if (optionInfo.deprecated) {
10897       handlers.deprecated = true;
10898     } // allow CLI overriding, e.g., prettier package.json --tab-width 1 --tab-width 2
10899
10900
10901     if (isCLI && !optionInfo.array) {
10902       var originalPreprocess = parameters.preprocess || function (x) {
10903         return x;
10904       };
10905
10906       parameters.preprocess = function (value, schema, utils) {
10907         return schema.preprocess(originalPreprocess(Array.isArray(value) ? value[value.length - 1] : value), utils);
10908       };
10909     }
10910
10911     return optionInfo.array ? lib.ArraySchema.create(Object.assign(isCLI ? {
10912       preprocess: function preprocess(v) {
10913         return [].concat(v);
10914       }
10915     } : {}, handlers, {
10916       valueSchema: SchemaConstructor.create(parameters)
10917     })) : SchemaConstructor.create(Object.assign({}, parameters, handlers));
10918   }
10919
10920   function normalizeApiOptions(options, optionInfos, opts) {
10921     return normalizeOptions(options, optionInfos, opts);
10922   }
10923
10924   function normalizeCliOptions(options, optionInfos, opts) {
10925     return normalizeOptions(options, optionInfos, Object.assign({
10926       isCLI: true
10927     }, opts));
10928   }
10929
10930   var optionsNormalizer = {
10931     normalizeApiOptions: normalizeApiOptions,
10932     normalizeCliOptions: normalizeCliOptions
10933   };
10934
10935   var getLast = function getLast(arr) {
10936     return arr.length > 0 ? arr[arr.length - 1] : null;
10937   };
10938
10939   function locStart(node, opts) {
10940     opts = opts || {}; // Handle nodes with decorators. They should start at the first decorator
10941
10942     if (!opts.ignoreDecorators && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0) {
10943       return locStart(node.declaration.decorators[0]);
10944     }
10945
10946     if (!opts.ignoreDecorators && node.decorators && node.decorators.length > 0) {
10947       return locStart(node.decorators[0]);
10948     }
10949
10950     if (node.__location) {
10951       return node.__location.startOffset;
10952     }
10953
10954     if (node.range) {
10955       return node.range[0];
10956     }
10957
10958     if (typeof node.start === "number") {
10959       return node.start;
10960     }
10961
10962     if (node.loc) {
10963       return node.loc.start;
10964     }
10965
10966     return null;
10967   }
10968
10969   function locEnd(node) {
10970     var endNode = node.nodes && getLast(node.nodes);
10971
10972     if (endNode && node.source && !node.source.end) {
10973       node = endNode;
10974     }
10975
10976     if (node.__location) {
10977       return node.__location.endOffset;
10978     }
10979
10980     var loc = node.range ? node.range[1] : typeof node.end === "number" ? node.end : null;
10981
10982     if (node.typeAnnotation) {
10983       return Math.max(loc, locEnd(node.typeAnnotation));
10984     }
10985
10986     if (node.loc && !loc) {
10987       return node.loc.end;
10988     }
10989
10990     return loc;
10991   }
10992
10993   var loc = {
10994     locStart: locStart,
10995     locEnd: locEnd
10996   };
10997
10998   var jsTokens = createCommonjsModule(function (module, exports) {
10999     // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
11000     // License: MIT. (See LICENSE.)
11001     Object.defineProperty(exports, "__esModule", {
11002       value: true
11003     }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
11004     // (run `npm run build`).
11005
11006     exports.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;
11007
11008     exports.matchToToken = function (match) {
11009       var token = {
11010         type: "invalid",
11011         value: match[0],
11012         closed: undefined
11013       };
11014       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";
11015       return token;
11016     };
11017   });
11018   unwrapExports(jsTokens);
11019   var jsTokens_1 = jsTokens.matchToToken;
11020
11021   var ast = createCommonjsModule(function (module) {
11022     /*
11023       Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
11024     
11025       Redistribution and use in source and binary forms, with or without
11026       modification, are permitted provided that the following conditions are met:
11027     
11028         * Redistributions of source code must retain the above copyright
11029           notice, this list of conditions and the following disclaimer.
11030         * Redistributions in binary form must reproduce the above copyright
11031           notice, this list of conditions and the following disclaimer in the
11032           documentation and/or other materials provided with the distribution.
11033     
11034       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
11035       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11036       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11037       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11038       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11039       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11040       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11041       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11042       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11043       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11044     */
11045     (function () {
11046
11047       function isExpression(node) {
11048         if (node == null) {
11049           return false;
11050         }
11051
11052         switch (node.type) {
11053           case 'ArrayExpression':
11054           case 'AssignmentExpression':
11055           case 'BinaryExpression':
11056           case 'CallExpression':
11057           case 'ConditionalExpression':
11058           case 'FunctionExpression':
11059           case 'Identifier':
11060           case 'Literal':
11061           case 'LogicalExpression':
11062           case 'MemberExpression':
11063           case 'NewExpression':
11064           case 'ObjectExpression':
11065           case 'SequenceExpression':
11066           case 'ThisExpression':
11067           case 'UnaryExpression':
11068           case 'UpdateExpression':
11069             return true;
11070         }
11071
11072         return false;
11073       }
11074
11075       function isIterationStatement(node) {
11076         if (node == null) {
11077           return false;
11078         }
11079
11080         switch (node.type) {
11081           case 'DoWhileStatement':
11082           case 'ForInStatement':
11083           case 'ForStatement':
11084           case 'WhileStatement':
11085             return true;
11086         }
11087
11088         return false;
11089       }
11090
11091       function isStatement(node) {
11092         if (node == null) {
11093           return false;
11094         }
11095
11096         switch (node.type) {
11097           case 'BlockStatement':
11098           case 'BreakStatement':
11099           case 'ContinueStatement':
11100           case 'DebuggerStatement':
11101           case 'DoWhileStatement':
11102           case 'EmptyStatement':
11103           case 'ExpressionStatement':
11104           case 'ForInStatement':
11105           case 'ForStatement':
11106           case 'IfStatement':
11107           case 'LabeledStatement':
11108           case 'ReturnStatement':
11109           case 'SwitchStatement':
11110           case 'ThrowStatement':
11111           case 'TryStatement':
11112           case 'VariableDeclaration':
11113           case 'WhileStatement':
11114           case 'WithStatement':
11115             return true;
11116         }
11117
11118         return false;
11119       }
11120
11121       function isSourceElement(node) {
11122         return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
11123       }
11124
11125       function trailingStatement(node) {
11126         switch (node.type) {
11127           case 'IfStatement':
11128             if (node.alternate != null) {
11129               return node.alternate;
11130             }
11131
11132             return node.consequent;
11133
11134           case 'LabeledStatement':
11135           case 'ForStatement':
11136           case 'ForInStatement':
11137           case 'WhileStatement':
11138           case 'WithStatement':
11139             return node.body;
11140         }
11141
11142         return null;
11143       }
11144
11145       function isProblematicIfStatement(node) {
11146         var current;
11147
11148         if (node.type !== 'IfStatement') {
11149           return false;
11150         }
11151
11152         if (node.alternate == null) {
11153           return false;
11154         }
11155
11156         current = node.consequent;
11157
11158         do {
11159           if (current.type === 'IfStatement') {
11160             if (current.alternate == null) {
11161               return true;
11162             }
11163           }
11164
11165           current = trailingStatement(current);
11166         } while (current);
11167
11168         return false;
11169       }
11170
11171       module.exports = {
11172         isExpression: isExpression,
11173         isStatement: isStatement,
11174         isIterationStatement: isIterationStatement,
11175         isSourceElement: isSourceElement,
11176         isProblematicIfStatement: isProblematicIfStatement,
11177         trailingStatement: trailingStatement
11178       };
11179     })();
11180     /* vim: set sw=4 ts=4 et tw=80 : */
11181
11182   });
11183   var ast_1 = ast.isExpression;
11184   var ast_2 = ast.isStatement;
11185   var ast_3 = ast.isIterationStatement;
11186   var ast_4 = ast.isSourceElement;
11187   var ast_5 = ast.isProblematicIfStatement;
11188   var ast_6 = ast.trailingStatement;
11189
11190   var code = createCommonjsModule(function (module) {
11191     /*
11192       Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
11193       Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
11194     
11195       Redistribution and use in source and binary forms, with or without
11196       modification, are permitted provided that the following conditions are met:
11197     
11198         * Redistributions of source code must retain the above copyright
11199           notice, this list of conditions and the following disclaimer.
11200         * Redistributions in binary form must reproduce the above copyright
11201           notice, this list of conditions and the following disclaimer in the
11202           documentation and/or other materials provided with the distribution.
11203     
11204       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11205       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11206       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11207       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11208       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11209       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11210       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11211       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11212       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11213       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11214     */
11215     (function () {
11216
11217       var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
11218
11219       ES5Regex = {
11220         // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierStart:
11221         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]/,
11222         // ECMAScript 5.1/Unicode v9.0.0 NonAsciiIdentifierPart:
11223         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]/
11224       };
11225       ES6Regex = {
11226         // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierStart:
11227         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]/,
11228         // ECMAScript 6/Unicode v9.0.0 NonAsciiIdentifierPart:
11229         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]/
11230       };
11231
11232       function isDecimalDigit(ch) {
11233         return 0x30 <= ch && ch <= 0x39; // 0..9
11234       }
11235
11236       function isHexDigit(ch) {
11237         return 0x30 <= ch && ch <= 0x39 || // 0..9
11238         0x61 <= ch && ch <= 0x66 || // a..f
11239         0x41 <= ch && ch <= 0x46; // A..F
11240       }
11241
11242       function isOctalDigit(ch) {
11243         return ch >= 0x30 && ch <= 0x37; // 0..7
11244       } // 7.2 White Space
11245
11246
11247       NON_ASCII_WHITESPACES = [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
11248
11249       function isWhiteSpace(ch) {
11250         return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
11251       } // 7.3 Line Terminators
11252
11253
11254       function isLineTerminator(ch) {
11255         return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
11256       } // 7.6 Identifier Names and Identifiers
11257
11258
11259       function fromCodePoint(cp) {
11260         if (cp <= 0xFFFF) {
11261           return String.fromCharCode(cp);
11262         }
11263
11264         var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
11265         var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
11266         return cu1 + cu2;
11267       }
11268
11269       IDENTIFIER_START = new Array(0x80);
11270
11271       for (ch = 0; ch < 0x80; ++ch) {
11272         IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
11273         ch >= 0x41 && ch <= 0x5A || // A..Z
11274         ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
11275       }
11276
11277       IDENTIFIER_PART = new Array(0x80);
11278
11279       for (ch = 0; ch < 0x80; ++ch) {
11280         IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
11281         ch >= 0x41 && ch <= 0x5A || // A..Z
11282         ch >= 0x30 && ch <= 0x39 || // 0..9
11283         ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
11284       }
11285
11286       function isIdentifierStartES5(ch) {
11287         return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
11288       }
11289
11290       function isIdentifierPartES5(ch) {
11291         return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
11292       }
11293
11294       function isIdentifierStartES6(ch) {
11295         return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
11296       }
11297
11298       function isIdentifierPartES6(ch) {
11299         return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
11300       }
11301
11302       module.exports = {
11303         isDecimalDigit: isDecimalDigit,
11304         isHexDigit: isHexDigit,
11305         isOctalDigit: isOctalDigit,
11306         isWhiteSpace: isWhiteSpace,
11307         isLineTerminator: isLineTerminator,
11308         isIdentifierStartES5: isIdentifierStartES5,
11309         isIdentifierPartES5: isIdentifierPartES5,
11310         isIdentifierStartES6: isIdentifierStartES6,
11311         isIdentifierPartES6: isIdentifierPartES6
11312       };
11313     })();
11314     /* vim: set sw=4 ts=4 et tw=80 : */
11315
11316   });
11317   var code_1 = code.isDecimalDigit;
11318   var code_2 = code.isHexDigit;
11319   var code_3 = code.isOctalDigit;
11320   var code_4 = code.isWhiteSpace;
11321   var code_5 = code.isLineTerminator;
11322   var code_6 = code.isIdentifierStartES5;
11323   var code_7 = code.isIdentifierPartES5;
11324   var code_8 = code.isIdentifierStartES6;
11325   var code_9 = code.isIdentifierPartES6;
11326
11327   var keyword = createCommonjsModule(function (module) {
11328     /*
11329       Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
11330     
11331       Redistribution and use in source and binary forms, with or without
11332       modification, are permitted provided that the following conditions are met:
11333     
11334         * Redistributions of source code must retain the above copyright
11335           notice, this list of conditions and the following disclaimer.
11336         * Redistributions in binary form must reproduce the above copyright
11337           notice, this list of conditions and the following disclaimer in the
11338           documentation and/or other materials provided with the distribution.
11339     
11340       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11341       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11342       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11343       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11344       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11345       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11346       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11347       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11348       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11349       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11350     */
11351     (function () {
11352
11353       var code$1 = code;
11354
11355       function isStrictModeReservedWordES6(id) {
11356         switch (id) {
11357           case 'implements':
11358           case 'interface':
11359           case 'package':
11360           case 'private':
11361           case 'protected':
11362           case 'public':
11363           case 'static':
11364           case 'let':
11365             return true;
11366
11367           default:
11368             return false;
11369         }
11370       }
11371
11372       function isKeywordES5(id, strict) {
11373         // yield should not be treated as keyword under non-strict mode.
11374         if (!strict && id === 'yield') {
11375           return false;
11376         }
11377
11378         return isKeywordES6(id, strict);
11379       }
11380
11381       function isKeywordES6(id, strict) {
11382         if (strict && isStrictModeReservedWordES6(id)) {
11383           return true;
11384         }
11385
11386         switch (id.length) {
11387           case 2:
11388             return id === 'if' || id === 'in' || id === 'do';
11389
11390           case 3:
11391             return id === 'var' || id === 'for' || id === 'new' || id === 'try';
11392
11393           case 4:
11394             return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
11395
11396           case 5:
11397             return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
11398
11399           case 6:
11400             return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
11401
11402           case 7:
11403             return id === 'default' || id === 'finally' || id === 'extends';
11404
11405           case 8:
11406             return id === 'function' || id === 'continue' || id === 'debugger';
11407
11408           case 10:
11409             return id === 'instanceof';
11410
11411           default:
11412             return false;
11413         }
11414       }
11415
11416       function isReservedWordES5(id, strict) {
11417         return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
11418       }
11419
11420       function isReservedWordES6(id, strict) {
11421         return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
11422       }
11423
11424       function isRestrictedWord(id) {
11425         return id === 'eval' || id === 'arguments';
11426       }
11427
11428       function isIdentifierNameES5(id) {
11429         var i, iz, ch;
11430
11431         if (id.length === 0) {
11432           return false;
11433         }
11434
11435         ch = id.charCodeAt(0);
11436
11437         if (!code$1.isIdentifierStartES5(ch)) {
11438           return false;
11439         }
11440
11441         for (i = 1, iz = id.length; i < iz; ++i) {
11442           ch = id.charCodeAt(i);
11443
11444           if (!code$1.isIdentifierPartES5(ch)) {
11445             return false;
11446           }
11447         }
11448
11449         return true;
11450       }
11451
11452       function decodeUtf16(lead, trail) {
11453         return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
11454       }
11455
11456       function isIdentifierNameES6(id) {
11457         var i, iz, ch, lowCh, check;
11458
11459         if (id.length === 0) {
11460           return false;
11461         }
11462
11463         check = code$1.isIdentifierStartES6;
11464
11465         for (i = 0, iz = id.length; i < iz; ++i) {
11466           ch = id.charCodeAt(i);
11467
11468           if (0xD800 <= ch && ch <= 0xDBFF) {
11469             ++i;
11470
11471             if (i >= iz) {
11472               return false;
11473             }
11474
11475             lowCh = id.charCodeAt(i);
11476
11477             if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
11478               return false;
11479             }
11480
11481             ch = decodeUtf16(ch, lowCh);
11482           }
11483
11484           if (!check(ch)) {
11485             return false;
11486           }
11487
11488           check = code$1.isIdentifierPartES6;
11489         }
11490
11491         return true;
11492       }
11493
11494       function isIdentifierES5(id, strict) {
11495         return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
11496       }
11497
11498       function isIdentifierES6(id, strict) {
11499         return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
11500       }
11501
11502       module.exports = {
11503         isKeywordES5: isKeywordES5,
11504         isKeywordES6: isKeywordES6,
11505         isReservedWordES5: isReservedWordES5,
11506         isReservedWordES6: isReservedWordES6,
11507         isRestrictedWord: isRestrictedWord,
11508         isIdentifierNameES5: isIdentifierNameES5,
11509         isIdentifierNameES6: isIdentifierNameES6,
11510         isIdentifierES5: isIdentifierES5,
11511         isIdentifierES6: isIdentifierES6
11512       };
11513     })();
11514     /* vim: set sw=4 ts=4 et tw=80 : */
11515
11516   });
11517   var keyword_1 = keyword.isKeywordES5;
11518   var keyword_2 = keyword.isKeywordES6;
11519   var keyword_3 = keyword.isReservedWordES5;
11520   var keyword_4 = keyword.isReservedWordES6;
11521   var keyword_5 = keyword.isRestrictedWord;
11522   var keyword_6 = keyword.isIdentifierNameES5;
11523   var keyword_7 = keyword.isIdentifierNameES6;
11524   var keyword_8 = keyword.isIdentifierES5;
11525   var keyword_9 = keyword.isIdentifierES6;
11526
11527   var utils$1 = createCommonjsModule(function (module, exports) {
11528     /*
11529       Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
11530     
11531       Redistribution and use in source and binary forms, with or without
11532       modification, are permitted provided that the following conditions are met:
11533     
11534         * Redistributions of source code must retain the above copyright
11535           notice, this list of conditions and the following disclaimer.
11536         * Redistributions in binary form must reproduce the above copyright
11537           notice, this list of conditions and the following disclaimer in the
11538           documentation and/or other materials provided with the distribution.
11539     
11540       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11541       AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11542       IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11543       ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
11544       DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11545       (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
11546       LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
11547       ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
11548       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
11549       THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11550     */
11551     (function () {
11552
11553       exports.ast = ast;
11554       exports.code = code;
11555       exports.keyword = keyword;
11556     })();
11557     /* vim: set sw=4 ts=4 et tw=80 : */
11558
11559   });
11560   var utils_1$1 = utils$1.ast;
11561   var utils_2$1 = utils$1.code;
11562   var utils_3$1 = utils$1.keyword;
11563
11564   var lib$1 = createCommonjsModule(function (module, exports) {
11565
11566     Object.defineProperty(exports, "__esModule", {
11567       value: true
11568     });
11569     exports.shouldHighlight = shouldHighlight;
11570     exports.getChalk = getChalk;
11571     exports.default = highlight;
11572
11573     function _jsTokens() {
11574       var data = _interopRequireWildcard(jsTokens);
11575
11576       _jsTokens = function _jsTokens() {
11577         return data;
11578       };
11579
11580       return data;
11581     }
11582
11583     function _esutils() {
11584       var data = _interopRequireDefault(utils$1);
11585
11586       _esutils = function _esutils() {
11587         return data;
11588       };
11589
11590       return data;
11591     }
11592
11593     function _chalk() {
11594       var data = _interopRequireDefault(chalk);
11595
11596       _chalk = function _chalk() {
11597         return data;
11598       };
11599
11600       return data;
11601     }
11602
11603     function _interopRequireDefault(obj) {
11604       return obj && obj.__esModule ? obj : {
11605         default: obj
11606       };
11607     }
11608
11609     function _interopRequireWildcard(obj) {
11610       if (obj && obj.__esModule) {
11611         return obj;
11612       } else {
11613         var newObj = {};
11614
11615         if (obj != null) {
11616           for (var key in obj) {
11617             if (Object.prototype.hasOwnProperty.call(obj, key)) {
11618               var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
11619
11620               if (desc.get || desc.set) {
11621                 Object.defineProperty(newObj, key, desc);
11622               } else {
11623                 newObj[key] = obj[key];
11624               }
11625             }
11626           }
11627         }
11628
11629         newObj.default = obj;
11630         return newObj;
11631       }
11632     }
11633
11634     function getDefs(chalk) {
11635       return {
11636         keyword: chalk.cyan,
11637         capitalized: chalk.yellow,
11638         jsx_tag: chalk.yellow,
11639         punctuator: chalk.yellow,
11640         number: chalk.magenta,
11641         string: chalk.green,
11642         regex: chalk.magenta,
11643         comment: chalk.grey,
11644         invalid: chalk.white.bgRed.bold
11645       };
11646     }
11647
11648     var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
11649     var JSX_TAG = /^[a-z][\w-]*$/i;
11650     var BRACKET = /^[()[\]{}]$/;
11651
11652     function getTokenType(match) {
11653       var _match$slice = match.slice(-2),
11654           _match$slice2 = _slicedToArray(_match$slice, 2),
11655           offset = _match$slice2[0],
11656           text = _match$slice2[1];
11657
11658       var token = (0, _jsTokens().matchToToken)(match);
11659
11660       if (token.type === "name") {
11661         if (_esutils().default.keyword.isReservedWordES6(token.value)) {
11662           return "keyword";
11663         }
11664
11665         if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
11666           return "jsx_tag";
11667         }
11668
11669         if (token.value[0] !== token.value[0].toLowerCase()) {
11670           return "capitalized";
11671         }
11672       }
11673
11674       if (token.type === "punctuator" && BRACKET.test(token.value)) {
11675         return "bracket";
11676       }
11677
11678       if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
11679         return "punctuator";
11680       }
11681
11682       return token.type;
11683     }
11684
11685     function highlightTokens(defs, text) {
11686       return text.replace(_jsTokens().default, function () {
11687         for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11688           args[_key] = arguments[_key];
11689         }
11690
11691         var type = getTokenType(args);
11692         var colorize = defs[type];
11693
11694         if (colorize) {
11695           return args[0].split(NEWLINE).map(function (str) {
11696             return colorize(str);
11697           }).join("\n");
11698         } else {
11699           return args[0];
11700         }
11701       });
11702     }
11703
11704     function shouldHighlight(options) {
11705       return _chalk().default.supportsColor || options.forceColor;
11706     }
11707
11708     function getChalk(options) {
11709       var chalk = _chalk().default;
11710
11711       if (options.forceColor) {
11712         chalk = new (_chalk().default.constructor)({
11713           enabled: true,
11714           level: 1
11715         });
11716       }
11717
11718       return chalk;
11719     }
11720
11721     function highlight(code) {
11722       var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
11723
11724       if (shouldHighlight(options)) {
11725         var chalk = getChalk(options);
11726         var defs = getDefs(chalk);
11727         return highlightTokens(defs, code);
11728       } else {
11729         return code;
11730       }
11731     }
11732   });
11733   unwrapExports(lib$1);
11734   var lib_1 = lib$1.shouldHighlight;
11735   var lib_2 = lib$1.getChalk;
11736
11737   var lib$2 = createCommonjsModule(function (module, exports) {
11738
11739     Object.defineProperty(exports, "__esModule", {
11740       value: true
11741     });
11742     exports.codeFrameColumns = codeFrameColumns;
11743     exports.default = _default;
11744
11745     function _highlight() {
11746       var data = _interopRequireWildcard(lib$1);
11747
11748       _highlight = function _highlight() {
11749         return data;
11750       };
11751
11752       return data;
11753     }
11754
11755     function _interopRequireWildcard(obj) {
11756       if (obj && obj.__esModule) {
11757         return obj;
11758       } else {
11759         var newObj = {};
11760
11761         if (obj != null) {
11762           for (var key in obj) {
11763             if (Object.prototype.hasOwnProperty.call(obj, key)) {
11764               var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
11765
11766               if (desc.get || desc.set) {
11767                 Object.defineProperty(newObj, key, desc);
11768               } else {
11769                 newObj[key] = obj[key];
11770               }
11771             }
11772           }
11773         }
11774
11775         newObj.default = obj;
11776         return newObj;
11777       }
11778     }
11779
11780     var deprecationWarningShown = false;
11781
11782     function getDefs(chalk) {
11783       return {
11784         gutter: chalk.grey,
11785         marker: chalk.red.bold,
11786         message: chalk.red.bold
11787       };
11788     }
11789
11790     var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
11791
11792     function getMarkerLines(loc, source, opts) {
11793       var startLoc = Object.assign({
11794         column: 0,
11795         line: -1
11796       }, loc.start);
11797       var endLoc = Object.assign({}, startLoc, loc.end);
11798
11799       var _ref = opts || {},
11800           _ref$linesAbove = _ref.linesAbove,
11801           linesAbove = _ref$linesAbove === void 0 ? 2 : _ref$linesAbove,
11802           _ref$linesBelow = _ref.linesBelow,
11803           linesBelow = _ref$linesBelow === void 0 ? 3 : _ref$linesBelow;
11804
11805       var startLine = startLoc.line;
11806       var startColumn = startLoc.column;
11807       var endLine = endLoc.line;
11808       var endColumn = endLoc.column;
11809       var start = Math.max(startLine - (linesAbove + 1), 0);
11810       var end = Math.min(source.length, endLine + linesBelow);
11811
11812       if (startLine === -1) {
11813         start = 0;
11814       }
11815
11816       if (endLine === -1) {
11817         end = source.length;
11818       }
11819
11820       var lineDiff = endLine - startLine;
11821       var markerLines = {};
11822
11823       if (lineDiff) {
11824         for (var i = 0; i <= lineDiff; i++) {
11825           var lineNumber = i + startLine;
11826
11827           if (!startColumn) {
11828             markerLines[lineNumber] = true;
11829           } else if (i === 0) {
11830             var sourceLength = source[lineNumber - 1].length;
11831             markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
11832           } else if (i === lineDiff) {
11833             markerLines[lineNumber] = [0, endColumn];
11834           } else {
11835             var _sourceLength = source[lineNumber - i].length;
11836             markerLines[lineNumber] = [0, _sourceLength];
11837           }
11838         }
11839       } else {
11840         if (startColumn === endColumn) {
11841           if (startColumn) {
11842             markerLines[startLine] = [startColumn, 0];
11843           } else {
11844             markerLines[startLine] = true;
11845           }
11846         } else {
11847           markerLines[startLine] = [startColumn, endColumn - startColumn];
11848         }
11849       }
11850
11851       return {
11852         start: start,
11853         end: end,
11854         markerLines: markerLines
11855       };
11856     }
11857
11858     function codeFrameColumns(rawLines, loc) {
11859       var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
11860       var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
11861       var chalk = (0, _highlight().getChalk)(opts);
11862       var defs = getDefs(chalk);
11863
11864       var maybeHighlight = function maybeHighlight(chalkFn, string) {
11865         return highlighted ? chalkFn(string) : string;
11866       };
11867
11868       var lines = rawLines.split(NEWLINE);
11869
11870       var _getMarkerLines = getMarkerLines(loc, lines, opts),
11871           start = _getMarkerLines.start,
11872           end = _getMarkerLines.end,
11873           markerLines = _getMarkerLines.markerLines;
11874
11875       var hasColumns = loc.start && typeof loc.start.column === "number";
11876       var numberMaxWidth = String(end).length;
11877       var highlightedLines = highlighted ? (0, _highlight().default)(rawLines, opts) : rawLines;
11878       var frame = highlightedLines.split(NEWLINE).slice(start, end).map(function (line, index) {
11879         var number = start + 1 + index;
11880         var paddedNumber = " ".concat(number).slice(-numberMaxWidth);
11881         var gutter = " ".concat(paddedNumber, " | ");
11882         var hasMarker = markerLines[number];
11883         var lastMarkerLine = !markerLines[number + 1];
11884
11885         if (hasMarker) {
11886           var markerLine = "";
11887
11888           if (Array.isArray(hasMarker)) {
11889             var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
11890             var numberOfMarkers = hasMarker[1] || 1;
11891             markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
11892
11893             if (lastMarkerLine && opts.message) {
11894               markerLine += " " + maybeHighlight(defs.message, opts.message);
11895             }
11896           }
11897
11898           return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
11899         } else {
11900           return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
11901         }
11902       }).join("\n");
11903
11904       if (opts.message && !hasColumns) {
11905         frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
11906       }
11907
11908       if (highlighted) {
11909         return chalk.reset(frame);
11910       } else {
11911         return frame;
11912       }
11913     }
11914
11915     function _default(rawLines, lineNumber, colNumber) {
11916       var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
11917
11918       if (!deprecationWarningShown) {
11919         deprecationWarningShown = true;
11920         var message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
11921
11922         if (process.emitWarning) {
11923           process.emitWarning(message, "DeprecationWarning");
11924         } else {
11925           var deprecationError = new Error(message);
11926           deprecationError.name = "DeprecationWarning";
11927           console.warn(new Error(message));
11928         }
11929       }
11930
11931       colNumber = Math.max(colNumber, 0);
11932       var location = {
11933         start: {
11934           column: colNumber,
11935           line: lineNumber
11936         }
11937       };
11938       return codeFrameColumns(rawLines, location, opts);
11939     }
11940   });
11941   unwrapExports(lib$2);
11942   var lib_1$1 = lib$2.codeFrameColumns;
11943
11944   var ConfigError$1 = errors.ConfigError;
11945   var locStart$1 = loc.locStart,
11946       locEnd$1 = loc.locEnd; // Use defineProperties()/getOwnPropertyDescriptor() to prevent
11947   // triggering the parsers getters.
11948
11949   var ownNames = Object.getOwnPropertyNames;
11950   var ownDescriptor = Object.getOwnPropertyDescriptor;
11951
11952   function getParsers(options) {
11953     var parsers = {};
11954     var _iteratorNormalCompletion = true;
11955     var _didIteratorError = false;
11956     var _iteratorError = undefined;
11957
11958     try {
11959       for (var _iterator = options.plugins[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
11960         var plugin = _step.value;
11961
11962         if (!plugin.parsers) {
11963           continue;
11964         }
11965
11966         var _iteratorNormalCompletion2 = true;
11967         var _didIteratorError2 = false;
11968         var _iteratorError2 = undefined;
11969
11970         try {
11971           for (var _iterator2 = ownNames(plugin.parsers)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
11972             var name = _step2.value;
11973             Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
11974           }
11975         } catch (err) {
11976           _didIteratorError2 = true;
11977           _iteratorError2 = err;
11978         } finally {
11979           try {
11980             if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
11981               _iterator2.return();
11982             }
11983           } finally {
11984             if (_didIteratorError2) {
11985               throw _iteratorError2;
11986             }
11987           }
11988         }
11989       }
11990     } catch (err) {
11991       _didIteratorError = true;
11992       _iteratorError = err;
11993     } finally {
11994       try {
11995         if (!_iteratorNormalCompletion && _iterator.return != null) {
11996           _iterator.return();
11997         }
11998       } finally {
11999         if (_didIteratorError) {
12000           throw _iteratorError;
12001         }
12002       }
12003     }
12004
12005     return parsers;
12006   }
12007
12008   function resolveParser(opts, parsers) {
12009     parsers = parsers || getParsers(opts);
12010
12011     if (typeof opts.parser === "function") {
12012       // Custom parser API always works with JavaScript.
12013       return {
12014         parse: opts.parser,
12015         astFormat: "estree",
12016         locStart: locStart$1,
12017         locEnd: locEnd$1
12018       };
12019     }
12020
12021     if (typeof opts.parser === "string") {
12022       if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
12023         return parsers[opts.parser];
12024       }
12025       /* istanbul ignore next */
12026
12027
12028       {
12029         throw new ConfigError$1("Couldn't resolve parser \"".concat(opts.parser, "\". Parsers must be explicitly added to the standalone bundle."));
12030       }
12031     }
12032   }
12033
12034   function parse(text, opts) {
12035     var parsers = getParsers(opts); // Create a new object {parserName: parseFn}. Uses defineProperty() to only call
12036     // the parsers getters when actually calling the parser `parse` function.
12037
12038     var parsersForCustomParserApi = Object.keys(parsers).reduce(function (object, parserName) {
12039       return Object.defineProperty(object, parserName, {
12040         enumerable: true,
12041         get: function get() {
12042           return parsers[parserName].parse;
12043         }
12044       });
12045     }, {});
12046     var parser = resolveParser(opts, parsers);
12047
12048     try {
12049       if (parser.preprocess) {
12050         text = parser.preprocess(text, opts);
12051       }
12052
12053       return {
12054         text: text,
12055         ast: parser.parse(text, parsersForCustomParserApi, opts)
12056       };
12057     } catch (error) {
12058       var loc = error.loc;
12059
12060       if (loc) {
12061         var codeFrame = lib$2;
12062         error.codeFrame = codeFrame.codeFrameColumns(text, loc, {
12063           highlightCode: true
12064         });
12065         error.message += "\n" + error.codeFrame;
12066         throw error;
12067       }
12068       /* istanbul ignore next */
12069
12070
12071       throw error.stack;
12072     }
12073   }
12074
12075   var parser = {
12076     parse: parse,
12077     resolveParser: resolveParser
12078   };
12079
12080   var UndefinedParserError$1 = errors.UndefinedParserError;
12081   var getSupportInfo$1 = support.getSupportInfo;
12082   var resolveParser$1 = parser.resolveParser;
12083   var hiddenDefaults = {
12084     astFormat: "estree",
12085     printer: {},
12086     originalText: undefined,
12087     locStart: null,
12088     locEnd: null
12089   }; // Copy options and fill in default values.
12090
12091   function normalize$1(options, opts) {
12092     opts = opts || {};
12093     var rawOptions = Object.assign({}, options);
12094     var supportOptions = getSupportInfo$1(null, {
12095       plugins: options.plugins,
12096       showUnreleased: true,
12097       showDeprecated: true
12098     }).options;
12099     var defaults = supportOptions.reduce(function (reduced, optionInfo) {
12100       return optionInfo.default !== undefined ? Object.assign(reduced, _defineProperty({}, optionInfo.name, optionInfo.default)) : reduced;
12101     }, Object.assign({}, hiddenDefaults));
12102
12103     if (!rawOptions.parser) {
12104       if (!rawOptions.filepath) {
12105         var logger = opts.logger || console;
12106         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.");
12107         rawOptions.parser = "babel";
12108       } else {
12109         rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
12110
12111         if (!rawOptions.parser) {
12112           throw new UndefinedParserError$1("No parser could be inferred for file: ".concat(rawOptions.filepath));
12113         }
12114       }
12115     }
12116
12117     var parser = resolveParser$1(optionsNormalizer.normalizeApiOptions(rawOptions, [supportOptions.find(function (x) {
12118       return x.name === "parser";
12119     })], {
12120       passThrough: true,
12121       logger: false
12122     }));
12123     rawOptions.astFormat = parser.astFormat;
12124     rawOptions.locEnd = parser.locEnd;
12125     rawOptions.locStart = parser.locStart;
12126     var plugin = getPlugin(rawOptions);
12127     rawOptions.printer = plugin.printers[rawOptions.astFormat];
12128     var pluginDefaults = supportOptions.filter(function (optionInfo) {
12129       return optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== undefined;
12130     }).reduce(function (reduced, optionInfo) {
12131       return Object.assign(reduced, _defineProperty({}, optionInfo.name, optionInfo.pluginDefaults[plugin.name]));
12132     }, {});
12133     var mixedDefaults = Object.assign({}, defaults, pluginDefaults);
12134     Object.keys(mixedDefaults).forEach(function (k) {
12135       if (rawOptions[k] == null) {
12136         rawOptions[k] = mixedDefaults[k];
12137       }
12138     });
12139
12140     if (rawOptions.parser === "json") {
12141       rawOptions.trailingComma = "none";
12142     }
12143
12144     return optionsNormalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
12145       passThrough: Object.keys(hiddenDefaults)
12146     }, opts));
12147   }
12148
12149   function getPlugin(options) {
12150     var astFormat = options.astFormat;
12151
12152     if (!astFormat) {
12153       throw new Error("getPlugin() requires astFormat to be set");
12154     }
12155
12156     var printerPlugin = options.plugins.find(function (plugin) {
12157       return plugin.printers && plugin.printers[astFormat];
12158     });
12159
12160     if (!printerPlugin) {
12161       throw new Error("Couldn't find plugin for AST format \"".concat(astFormat, "\""));
12162     }
12163
12164     return printerPlugin;
12165   }
12166
12167   function getInterpreter(filepath) {
12168     if (typeof filepath !== "string") {
12169       return "";
12170     }
12171
12172     var fd;
12173
12174     try {
12175       fd = fs.openSync(filepath, "r");
12176     } catch (err) {
12177       return "";
12178     }
12179
12180     try {
12181       var liner = new readlines(fd);
12182       var firstLine = liner.next().toString("utf8"); // #!/bin/env node, #!/usr/bin/env node
12183
12184       var m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
12185
12186       if (m1) {
12187         return m1[1];
12188       } // #!/bin/node, #!/usr/bin/node, #!/usr/local/bin/node
12189
12190
12191       var m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
12192
12193       if (m2) {
12194         return m2[1];
12195       }
12196
12197       return "";
12198     } catch (err) {
12199       // There are some weird cases where paths are missing, causing Jest
12200       // failures. It's unclear what these correspond to in the real world.
12201       return "";
12202     } finally {
12203       try {
12204         // There are some weird cases where paths are missing, causing Jest
12205         // failures. It's unclear what these correspond to in the real world.
12206         fs.closeSync(fd);
12207       } catch (err) {// nop
12208       }
12209     }
12210   }
12211
12212   function inferParser(filepath, plugins) {
12213     var filepathParts = normalizePath(filepath).split("/");
12214     var filename = filepathParts[filepathParts.length - 1].toLowerCase(); // If the file has no extension, we can try to infer the language from the
12215     // interpreter in the shebang line, if any; but since this requires FS access,
12216     // do it last.
12217
12218     var language = getSupportInfo$1(null, {
12219       plugins: plugins
12220     }).languages.find(function (language) {
12221       return language.since !== null && (language.extensions && language.extensions.some(function (extension) {
12222         return filename.endsWith(extension);
12223       }) || language.filenames && language.filenames.find(function (name) {
12224         return name.toLowerCase() === filename;
12225       }) || filename.indexOf(".") === -1 && language.interpreters && language.interpreters.indexOf(getInterpreter(filepath)) !== -1);
12226     });
12227     return language && language.parsers[0];
12228   }
12229
12230   var options$1 = {
12231     normalize: normalize$1,
12232     hiddenDefaults: hiddenDefaults,
12233     inferParser: inferParser
12234   };
12235
12236   function massageAST(ast, options, parent) {
12237     if (Array.isArray(ast)) {
12238       return ast.map(function (e) {
12239         return massageAST(e, options, parent);
12240       }).filter(function (e) {
12241         return e;
12242       });
12243     }
12244
12245     if (!ast || _typeof(ast) !== "object") {
12246       return ast;
12247     }
12248
12249     var newObj = {};
12250
12251     for (var _i = 0, _Object$keys = Object.keys(ast); _i < _Object$keys.length; _i++) {
12252       var key = _Object$keys[_i];
12253
12254       if (typeof ast[key] !== "function") {
12255         newObj[key] = massageAST(ast[key], options, ast);
12256       }
12257     }
12258
12259     if (options.printer.massageAstNode) {
12260       var result = options.printer.massageAstNode(ast, newObj, parent);
12261
12262       if (result === null) {
12263         return undefined;
12264       }
12265
12266       if (result) {
12267         return result;
12268       }
12269     }
12270
12271     return newObj;
12272   }
12273
12274   var massageAst = massageAST;
12275
12276   function assert() {}
12277
12278   assert.ok = function () {};
12279
12280   assert.strictEqual = function () {};
12281
12282   /**
12283    * @param {Doc[]} parts
12284    * @returns Doc
12285    */
12286
12287
12288   function concat(parts) {
12289     // access the internals of a document directly.
12290     // if(parts.length === 1) {
12291     //   // If it's a single document, no need to concat it.
12292     //   return parts[0];
12293     // }
12294
12295
12296     return {
12297       type: "concat",
12298       parts: parts
12299     };
12300   }
12301   /**
12302    * @param {Doc} contents
12303    * @returns Doc
12304    */
12305
12306
12307   function indent(contents) {
12308
12309     return {
12310       type: "indent",
12311       contents: contents
12312     };
12313   }
12314   /**
12315    * @param {number} n
12316    * @param {Doc} contents
12317    * @returns Doc
12318    */
12319
12320
12321   function align(n, contents) {
12322
12323     return {
12324       type: "align",
12325       contents: contents,
12326       n: n
12327     };
12328   }
12329   /**
12330    * @param {Doc} contents
12331    * @param {object} [opts] - TBD ???
12332    * @returns Doc
12333    */
12334
12335
12336   function group(contents, opts) {
12337     opts = opts || {};
12338
12339     return {
12340       type: "group",
12341       id: opts.id,
12342       contents: contents,
12343       break: !!opts.shouldBreak,
12344       expandedStates: opts.expandedStates
12345     };
12346   }
12347   /**
12348    * @param {Doc} contents
12349    * @returns Doc
12350    */
12351
12352
12353   function dedentToRoot(contents) {
12354     return align(-Infinity, contents);
12355   }
12356   /**
12357    * @param {Doc} contents
12358    * @returns Doc
12359    */
12360
12361
12362   function markAsRoot(contents) {
12363     // @ts-ignore - TBD ???:
12364     return align({
12365       type: "root"
12366     }, contents);
12367   }
12368   /**
12369    * @param {Doc} contents
12370    * @returns Doc
12371    */
12372
12373
12374   function dedent(contents) {
12375     return align(-1, contents);
12376   }
12377   /**
12378    * @param {Doc[]} states
12379    * @param {object} [opts] - TBD ???
12380    * @returns Doc
12381    */
12382
12383
12384   function conditionalGroup(states, opts) {
12385     return group(states[0], Object.assign(opts || {}, {
12386       expandedStates: states
12387     }));
12388   }
12389   /**
12390    * @param {Doc[]} parts
12391    * @returns Doc
12392    */
12393
12394
12395   function fill(parts) {
12396
12397     return {
12398       type: "fill",
12399       parts: parts
12400     };
12401   }
12402   /**
12403    * @param {Doc} [breakContents]
12404    * @param {Doc} [flatContents]
12405    * @param {object} [opts] - TBD ???
12406    * @returns Doc
12407    */
12408
12409
12410   function ifBreak(breakContents, flatContents, opts) {
12411     opts = opts || {};
12412
12413     return {
12414       type: "if-break",
12415       breakContents: breakContents,
12416       flatContents: flatContents,
12417       groupId: opts.groupId
12418     };
12419   }
12420   /**
12421    * @param {Doc} contents
12422    * @returns Doc
12423    */
12424
12425
12426   function lineSuffix(contents) {
12427
12428     return {
12429       type: "line-suffix",
12430       contents: contents
12431     };
12432   }
12433
12434   var lineSuffixBoundary = {
12435     type: "line-suffix-boundary"
12436   };
12437   var breakParent = {
12438     type: "break-parent"
12439   };
12440   var trim = {
12441     type: "trim"
12442   };
12443   var line = {
12444     type: "line"
12445   };
12446   var softline = {
12447     type: "line",
12448     soft: true
12449   };
12450   var hardline = concat([{
12451     type: "line",
12452     hard: true
12453   }, breakParent]);
12454   var literalline = concat([{
12455     type: "line",
12456     hard: true,
12457     literal: true
12458   }, breakParent]);
12459   var cursor = {
12460     type: "cursor",
12461     placeholder: Symbol("cursor")
12462   };
12463   /**
12464    * @param {Doc} sep
12465    * @param {Doc[]} arr
12466    * @returns Doc
12467    */
12468
12469   function join(sep, arr) {
12470     var res = [];
12471
12472     for (var i = 0; i < arr.length; i++) {
12473       if (i !== 0) {
12474         res.push(sep);
12475       }
12476
12477       res.push(arr[i]);
12478     }
12479
12480     return concat(res);
12481   }
12482   /**
12483    * @param {Doc} doc
12484    * @param {number} size
12485    * @param {number} tabWidth
12486    */
12487
12488
12489   function addAlignmentToDoc(doc, size, tabWidth) {
12490     var aligned = doc;
12491
12492     if (size > 0) {
12493       // Use indent to add tabs for all the levels of tabs we need
12494       for (var i = 0; i < Math.floor(size / tabWidth); ++i) {
12495         aligned = indent(aligned);
12496       } // Use align for all the spaces that are needed
12497
12498
12499       aligned = align(size % tabWidth, aligned); // size is absolute from 0 and not relative to the current
12500       // indentation, so we use -Infinity to reset the indentation to 0
12501
12502       aligned = align(-Infinity, aligned);
12503     }
12504
12505     return aligned;
12506   }
12507
12508   var docBuilders = {
12509     concat: concat,
12510     join: join,
12511     line: line,
12512     softline: softline,
12513     hardline: hardline,
12514     literalline: literalline,
12515     group: group,
12516     conditionalGroup: conditionalGroup,
12517     fill: fill,
12518     lineSuffix: lineSuffix,
12519     lineSuffixBoundary: lineSuffixBoundary,
12520     cursor: cursor,
12521     breakParent: breakParent,
12522     ifBreak: ifBreak,
12523     trim: trim,
12524     indent: indent,
12525     align: align,
12526     addAlignmentToDoc: addAlignmentToDoc,
12527     markAsRoot: markAsRoot,
12528     dedentToRoot: dedentToRoot,
12529     dedent: dedent
12530   };
12531
12532   var ansiRegex = function ansiRegex(options) {
12533     options = Object.assign({
12534       onlyFirst: false
12535     }, options);
12536     var pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
12537     return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
12538   };
12539
12540   var stripAnsi = function stripAnsi(string) {
12541     return typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
12542   };
12543
12544   var stripAnsi_1 = stripAnsi;
12545   var default_1$1 = stripAnsi;
12546   stripAnsi_1.default = default_1$1;
12547
12548   /* eslint-disable yoda */
12549
12550   var isFullwidthCodePoint = function isFullwidthCodePoint(codePoint) {
12551     if (Number.isNaN(codePoint)) {
12552       return false;
12553     } // Code points are derived from:
12554     // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
12555
12556
12557     if (codePoint >= 0x1100 && (codePoint <= 0x115F || // Hangul Jamo
12558     codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
12559     codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
12560     // CJK Radicals Supplement .. Enclosed CJK Letters and Months
12561     0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F || // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
12562     0x3250 <= codePoint && codePoint <= 0x4DBF || // CJK Unified Ideographs .. Yi Radicals
12563     0x4E00 <= codePoint && codePoint <= 0xA4C6 || // Hangul Jamo Extended-A
12564     0xA960 <= codePoint && codePoint <= 0xA97C || // Hangul Syllables
12565     0xAC00 <= codePoint && codePoint <= 0xD7A3 || // CJK Compatibility Ideographs
12566     0xF900 <= codePoint && codePoint <= 0xFAFF || // Vertical Forms
12567     0xFE10 <= codePoint && codePoint <= 0xFE19 || // CJK Compatibility Forms .. Small Form Variants
12568     0xFE30 <= codePoint && codePoint <= 0xFE6B || // Halfwidth and Fullwidth Forms
12569     0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6 || // Kana Supplement
12570     0x1B000 <= codePoint && codePoint <= 0x1B001 || // Enclosed Ideographic Supplement
12571     0x1F200 <= codePoint && codePoint <= 0x1F251 || // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
12572     0x20000 <= codePoint && codePoint <= 0x3FFFD)) {
12573       return true;
12574     }
12575
12576     return false;
12577   };
12578
12579   var isFullwidthCodePoint_1 = isFullwidthCodePoint;
12580   var default_1$2 = isFullwidthCodePoint;
12581   isFullwidthCodePoint_1.default = default_1$2;
12582
12583   var emojiRegex = function emojiRegex() {
12584     // https://mths.be/emoji
12585     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;
12586   };
12587
12588   var stringWidth = function stringWidth(string) {
12589     string = string.replace(emojiRegex(), '  ');
12590
12591     if (typeof string !== 'string' || string.length === 0) {
12592       return 0;
12593     }
12594
12595     string = stripAnsi_1(string);
12596     var width = 0;
12597
12598     for (var i = 0; i < string.length; i++) {
12599       var code = string.codePointAt(i); // Ignore control characters
12600
12601       if (code <= 0x1F || code >= 0x7F && code <= 0x9F) {
12602         continue;
12603       } // Ignore combining characters
12604
12605
12606       if (code >= 0x300 && code <= 0x36F) {
12607         continue;
12608       } // Surrogates
12609
12610
12611       if (code > 0xFFFF) {
12612         i++;
12613       }
12614
12615       width += isFullwidthCodePoint_1(code) ? 2 : 1;
12616     }
12617
12618     return width;
12619   };
12620
12621   var stringWidth_1 = stringWidth; // TODO: remove this in the next major version
12622
12623   var default_1$3 = stringWidth;
12624   stringWidth_1.default = default_1$3;
12625
12626   var notAsciiRegex = /[^\x20-\x7F]/;
12627
12628   function isExportDeclaration(node) {
12629     if (node) {
12630       switch (node.type) {
12631         case "ExportDefaultDeclaration":
12632         case "ExportDefaultSpecifier":
12633         case "DeclareExportDeclaration":
12634         case "ExportNamedDeclaration":
12635         case "ExportAllDeclaration":
12636           return true;
12637       }
12638     }
12639
12640     return false;
12641   }
12642
12643   function getParentExportDeclaration(path) {
12644     var parentNode = path.getParentNode();
12645
12646     if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
12647       return parentNode;
12648     }
12649
12650     return null;
12651   }
12652
12653   function getPenultimate(arr) {
12654     if (arr.length > 1) {
12655       return arr[arr.length - 2];
12656     }
12657
12658     return null;
12659   }
12660   /**
12661    * @typedef {{backwards?: boolean}} SkipOptions
12662    */
12663
12664   /**
12665    * @param {string | RegExp} chars
12666    * @returns {(text: string, index: number | false, opts?: SkipOptions) => number | false}
12667    */
12668
12669
12670   function skip(chars) {
12671     return function (text, index, opts) {
12672       var backwards = opts && opts.backwards; // Allow `skip` functions to be threaded together without having
12673       // to check for failures (did someone say monads?).
12674
12675       if (index === false) {
12676         return false;
12677       }
12678
12679       var length = text.length;
12680       var cursor = index;
12681
12682       while (cursor >= 0 && cursor < length) {
12683         var c = text.charAt(cursor);
12684
12685         if (chars instanceof RegExp) {
12686           if (!chars.test(c)) {
12687             return cursor;
12688           }
12689         } else if (chars.indexOf(c) === -1) {
12690           return cursor;
12691         }
12692
12693         backwards ? cursor-- : cursor++;
12694       }
12695
12696       if (cursor === -1 || cursor === length) {
12697         // If we reached the beginning or end of the file, return the
12698         // out-of-bounds cursor. It's up to the caller to handle this
12699         // correctly. We don't want to indicate `false` though if it
12700         // actually skipped valid characters.
12701         return cursor;
12702       }
12703
12704       return false;
12705     };
12706   }
12707   /**
12708    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
12709    */
12710
12711
12712   var skipWhitespace = skip(/\s/);
12713   /**
12714    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
12715    */
12716
12717   var skipSpaces = skip(" \t");
12718   /**
12719    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
12720    */
12721
12722   var skipToLineEnd = skip(",; \t");
12723   /**
12724    * @type {(text: string, index: number | false, opts?: SkipOptions) => number | false}
12725    */
12726
12727   var skipEverythingButNewLine = skip(/[^\r\n]/);
12728   /**
12729    * @param {string} text
12730    * @param {number | false} index
12731    * @returns {number | false}
12732    */
12733
12734   function skipInlineComment(text, index) {
12735     if (index === false) {
12736       return false;
12737     }
12738
12739     if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
12740       for (var i = index + 2; i < text.length; ++i) {
12741         if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
12742           return i + 2;
12743         }
12744       }
12745     }
12746
12747     return index;
12748   }
12749   /**
12750    * @param {string} text
12751    * @param {number | false} index
12752    * @returns {number | false}
12753    */
12754
12755
12756   function skipTrailingComment(text, index) {
12757     if (index === false) {
12758       return false;
12759     }
12760
12761     if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
12762       return skipEverythingButNewLine(text, index);
12763     }
12764
12765     return index;
12766   } // This one doesn't use the above helper function because it wants to
12767   // test \r\n in order and `skip` doesn't support ordering and we only
12768   // want to skip one newline. It's simple to implement.
12769
12770   /**
12771    * @param {string} text
12772    * @param {number | false} index
12773    * @param {SkipOptions=} opts
12774    * @returns {number | false}
12775    */
12776
12777
12778   function skipNewline(text, index, opts) {
12779     var backwards = opts && opts.backwards;
12780
12781     if (index === false) {
12782       return false;
12783     }
12784
12785     var atIndex = text.charAt(index);
12786
12787     if (backwards) {
12788       if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
12789         return index - 2;
12790       }
12791
12792       if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
12793         return index - 1;
12794       }
12795     } else {
12796       if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
12797         return index + 2;
12798       }
12799
12800       if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
12801         return index + 1;
12802       }
12803     }
12804
12805     return index;
12806   }
12807   /**
12808    * @param {string} text
12809    * @param {number} index
12810    * @param {SkipOptions=} opts
12811    * @returns {boolean}
12812    */
12813
12814
12815   function hasNewline(text, index, opts) {
12816     opts = opts || {};
12817     var idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
12818     var idx2 = skipNewline(text, idx, opts);
12819     return idx !== idx2;
12820   }
12821   /**
12822    * @param {string} text
12823    * @param {number} start
12824    * @param {number} end
12825    * @returns {boolean}
12826    */
12827
12828
12829   function hasNewlineInRange(text, start, end) {
12830     for (var i = start; i < end; ++i) {
12831       if (text.charAt(i) === "\n") {
12832         return true;
12833       }
12834     }
12835
12836     return false;
12837   } // Note: this function doesn't ignore leading comments unlike isNextLineEmpty
12838
12839   /**
12840    * @template N
12841    * @param {string} text
12842    * @param {N} node
12843    * @param {(node: N) => number} locStart
12844    */
12845
12846
12847   function isPreviousLineEmpty(text, node, locStart) {
12848     /** @type {number | false} */
12849     var idx = locStart(node) - 1;
12850     idx = skipSpaces(text, idx, {
12851       backwards: true
12852     });
12853     idx = skipNewline(text, idx, {
12854       backwards: true
12855     });
12856     idx = skipSpaces(text, idx, {
12857       backwards: true
12858     });
12859     var idx2 = skipNewline(text, idx, {
12860       backwards: true
12861     });
12862     return idx !== idx2;
12863   }
12864   /**
12865    * @param {string} text
12866    * @param {number} index
12867    * @returns {boolean}
12868    */
12869
12870
12871   function isNextLineEmptyAfterIndex(text, index) {
12872     /** @type {number | false} */
12873     var oldIdx = null;
12874     /** @type {number | false} */
12875
12876     var idx = index;
12877
12878     while (idx !== oldIdx) {
12879       // We need to skip all the potential trailing inline comments
12880       oldIdx = idx;
12881       idx = skipToLineEnd(text, idx);
12882       idx = skipInlineComment(text, idx);
12883       idx = skipSpaces(text, idx);
12884     }
12885
12886     idx = skipTrailingComment(text, idx);
12887     idx = skipNewline(text, idx);
12888     return idx !== false && hasNewline(text, idx);
12889   }
12890   /**
12891    * @template N
12892    * @param {string} text
12893    * @param {N} node
12894    * @param {(node: N) => number} locEnd
12895    * @returns {boolean}
12896    */
12897
12898
12899   function isNextLineEmpty(text, node, locEnd) {
12900     return isNextLineEmptyAfterIndex(text, locEnd(node));
12901   }
12902   /**
12903    * @param {string} text
12904    * @param {number} idx
12905    * @returns {number | false}
12906    */
12907
12908
12909   function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
12910     /** @type {number | false} */
12911     var oldIdx = null;
12912     /** @type {number | false} */
12913
12914     var nextIdx = idx;
12915
12916     while (nextIdx !== oldIdx) {
12917       oldIdx = nextIdx;
12918       nextIdx = skipSpaces(text, nextIdx);
12919       nextIdx = skipInlineComment(text, nextIdx);
12920       nextIdx = skipTrailingComment(text, nextIdx);
12921       nextIdx = skipNewline(text, nextIdx);
12922     }
12923
12924     return nextIdx;
12925   }
12926   /**
12927    * @template N
12928    * @param {string} text
12929    * @param {N} node
12930    * @param {(node: N) => number} locEnd
12931    * @returns {number | false}
12932    */
12933
12934
12935   function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
12936     return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
12937   }
12938   /**
12939    * @template N
12940    * @param {string} text
12941    * @param {N} node
12942    * @param {(node: N) => number} locEnd
12943    * @returns {string}
12944    */
12945
12946
12947   function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
12948     return text.charAt( // @ts-ignore => TBD: can return false, should we define a fallback?
12949     getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
12950   }
12951   /**
12952    * @param {string} text
12953    * @param {number} index
12954    * @param {SkipOptions=} opts
12955    * @returns {boolean}
12956    */
12957
12958
12959   function hasSpaces(text, index, opts) {
12960     opts = opts || {};
12961     var idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
12962     return idx !== index;
12963   }
12964   /**
12965    * @param {{range?: [number, number], start?: number}} node
12966    * @param {number} index
12967    */
12968
12969
12970   function setLocStart(node, index) {
12971     if (node.range) {
12972       node.range[0] = index;
12973     } else {
12974       node.start = index;
12975     }
12976   }
12977   /**
12978    * @param {{range?: [number, number], end?: number}} node
12979    * @param {number} index
12980    */
12981
12982
12983   function setLocEnd(node, index) {
12984     if (node.range) {
12985       node.range[1] = index;
12986     } else {
12987       node.end = index;
12988     }
12989   }
12990
12991   var PRECEDENCE = {};
12992   [["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].forEach(function (tier, i) {
12993     tier.forEach(function (op) {
12994       PRECEDENCE[op] = i;
12995     });
12996   });
12997
12998   function getPrecedence(op) {
12999     return PRECEDENCE[op];
13000   }
13001
13002   var equalityOperators = {
13003     "==": true,
13004     "!=": true,
13005     "===": true,
13006     "!==": true
13007   };
13008   var multiplicativeOperators = {
13009     "*": true,
13010     "/": true,
13011     "%": true
13012   };
13013   var bitshiftOperators = {
13014     ">>": true,
13015     ">>>": true,
13016     "<<": true
13017   };
13018
13019   function shouldFlatten(parentOp, nodeOp) {
13020     if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
13021       return false;
13022     } // ** is right-associative
13023     // x ** y ** z --> x ** (y ** z)
13024
13025
13026     if (parentOp === "**") {
13027       return false;
13028     } // x == y == z --> (x == y) == z
13029
13030
13031     if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
13032       return false;
13033     } // x * y % z --> (x * y) % z
13034
13035
13036     if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
13037       return false;
13038     } // x * y / z --> (x * y) / z
13039     // x / y * z --> (x / y) * z
13040
13041
13042     if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
13043       return false;
13044     } // x << y << z --> (x << y) << z
13045
13046
13047     if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
13048       return false;
13049     }
13050
13051     return true;
13052   }
13053
13054   function isBitwiseOperator(operator) {
13055     return !!bitshiftOperators[operator] || operator === "|" || operator === "^" || operator === "&";
13056   } // Tests if an expression starts with `{`, or (if forbidFunctionClassAndDoExpr
13057   // holds) `function`, `class`, or `do {}`. Will be overzealous if there's
13058   // already necessary grouping parentheses.
13059
13060
13061   function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
13062     node = getLeftMost(node);
13063
13064     switch (node.type) {
13065       case "FunctionExpression":
13066       case "ClassExpression":
13067       case "DoExpression":
13068         return forbidFunctionClassAndDoExpr;
13069
13070       case "ObjectExpression":
13071         return true;
13072
13073       case "MemberExpression":
13074       case "OptionalMemberExpression":
13075         return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
13076
13077       case "TaggedTemplateExpression":
13078         if (node.tag.type === "FunctionExpression") {
13079           // IIFEs are always already parenthesized
13080           return false;
13081         }
13082
13083         return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
13084
13085       case "CallExpression":
13086       case "OptionalCallExpression":
13087         if (node.callee.type === "FunctionExpression") {
13088           // IIFEs are always already parenthesized
13089           return false;
13090         }
13091
13092         return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
13093
13094       case "ConditionalExpression":
13095         return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
13096
13097       case "UpdateExpression":
13098         return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
13099
13100       case "BindExpression":
13101         return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
13102
13103       case "SequenceExpression":
13104         return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
13105
13106       case "TSAsExpression":
13107         return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
13108
13109       default:
13110         return false;
13111     }
13112   }
13113
13114   function getLeftMost(node) {
13115     if (node.left) {
13116       return getLeftMost(node.left);
13117     }
13118
13119     return node;
13120   }
13121   /**
13122    * @param {string} value
13123    * @param {number} tabWidth
13124    * @param {number=} startIndex
13125    * @returns {number}
13126    */
13127
13128
13129   function getAlignmentSize(value, tabWidth, startIndex) {
13130     startIndex = startIndex || 0;
13131     var size = 0;
13132
13133     for (var i = startIndex; i < value.length; ++i) {
13134       if (value[i] === "\t") {
13135         // Tabs behave in a way that they are aligned to the nearest
13136         // multiple of tabWidth:
13137         // 0 -> 4, 1 -> 4, 2 -> 4, 3 -> 4
13138         // 4 -> 8, 5 -> 8, 6 -> 8, 7 -> 8 ...
13139         size = size + tabWidth - size % tabWidth;
13140       } else {
13141         size++;
13142       }
13143     }
13144
13145     return size;
13146   }
13147   /**
13148    * @param {string} value
13149    * @param {number} tabWidth
13150    * @returns {number}
13151    */
13152
13153
13154   function getIndentSize(value, tabWidth) {
13155     var lastNewlineIndex = value.lastIndexOf("\n");
13156
13157     if (lastNewlineIndex === -1) {
13158       return 0;
13159     }
13160
13161     return getAlignmentSize( // All the leading whitespaces
13162     value.slice(lastNewlineIndex + 1).match(/^[ \t]*/)[0], tabWidth);
13163   }
13164   /**
13165    * @typedef {'"' | "'"} Quote
13166    */
13167
13168   /**
13169    *
13170    * @param {string} raw
13171    * @param {Quote} preferredQuote
13172    * @returns {Quote}
13173    */
13174
13175
13176   function getPreferredQuote(raw, preferredQuote) {
13177     // `rawContent` is the string exactly like it appeared in the input source
13178     // code, without its enclosing quotes.
13179     var rawContent = raw.slice(1, -1);
13180     /** @type {{ quote: '"', regex: RegExp }} */
13181
13182     var double = {
13183       quote: '"',
13184       regex: /"/g
13185     };
13186     /** @type {{ quote: "'", regex: RegExp }} */
13187
13188     var single = {
13189       quote: "'",
13190       regex: /'/g
13191     };
13192     var preferred = preferredQuote === "'" ? single : double;
13193     var alternate = preferred === single ? double : single;
13194     var result = preferred.quote; // If `rawContent` contains at least one of the quote preferred for enclosing
13195     // the string, we might want to enclose with the alternate quote instead, to
13196     // minimize the number of escaped quotes.
13197
13198     if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
13199       var numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
13200       var numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
13201       result = numPreferredQuotes > numAlternateQuotes ? alternate.quote : preferred.quote;
13202     }
13203
13204     return result;
13205   }
13206
13207   function printString(raw, options, isDirectiveLiteral) {
13208     // `rawContent` is the string exactly like it appeared in the input source
13209     // code, without its enclosing quotes.
13210     var rawContent = raw.slice(1, -1); // Check for the alternate quote, to determine if we're allowed to swap
13211     // the quotes on a DirectiveLiteral.
13212
13213     var canChangeDirectiveQuotes = !rawContent.includes('"') && !rawContent.includes("'");
13214     /** @type {Quote} */
13215
13216     var enclosingQuote = options.parser === "json" ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(raw, options.singleQuote ? "'" : '"'); // Directives are exact code unit sequences, which means that you can't
13217     // change the escape sequences they use.
13218     // See https://github.com/prettier/prettier/issues/1555
13219     // and https://tc39.github.io/ecma262/#directive-prologue
13220
13221     if (isDirectiveLiteral) {
13222       if (canChangeDirectiveQuotes) {
13223         return enclosingQuote + rawContent + enclosingQuote;
13224       }
13225
13226       return raw;
13227     } // It might sound unnecessary to use `makeString` even if the string already
13228     // is enclosed with `enclosingQuote`, but it isn't. The string could contain
13229     // unnecessary escapes (such as in `"\'"`). Always using `makeString` makes
13230     // sure that we consistently output the minimum amount of escaped quotes.
13231
13232
13233     return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.embeddedInHtml));
13234   }
13235   /**
13236    * @param {string} rawContent
13237    * @param {Quote} enclosingQuote
13238    * @param {boolean=} unescapeUnnecessaryEscapes
13239    * @returns {string}
13240    */
13241
13242
13243   function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
13244     var otherQuote = enclosingQuote === '"' ? "'" : '"'; // Matches _any_ escape and unescaped quotes (both single and double).
13245
13246     var regex = /\\([\s\S])|(['"])/g; // Escape and unescape single and double quotes as needed to be able to
13247     // enclose `rawContent` with `enclosingQuote`.
13248
13249     var newContent = rawContent.replace(regex, function (match, escaped, quote) {
13250       // If we matched an escape, and the escaped character is a quote of the
13251       // other type than we intend to enclose the string with, there's no need for
13252       // it to be escaped, so return it _without_ the backslash.
13253       if (escaped === otherQuote) {
13254         return escaped;
13255       } // If we matched an unescaped quote and it is of the _same_ type as we
13256       // intend to enclose the string with, it must be escaped, so return it with
13257       // a backslash.
13258
13259
13260       if (quote === enclosingQuote) {
13261         return "\\" + quote;
13262       }
13263
13264       if (quote) {
13265         return quote;
13266       } // Unescape any unnecessarily escaped character.
13267       // Adapted from https://github.com/eslint/eslint/blob/de0b4ad7bd820ade41b1f606008bea68683dc11a/lib/rules/no-useless-escape.js#L27
13268
13269
13270       return unescapeUnnecessaryEscapes && /^[^\\nrvtbfux\r\n\u2028\u2029"'0-7]$/.test(escaped) ? escaped : "\\" + escaped;
13271     });
13272     return enclosingQuote + newContent + enclosingQuote;
13273   }
13274
13275   function printNumber(rawNumber) {
13276     return rawNumber.toLowerCase() // Remove unnecessary plus and zeroes from scientific notation.
13277     .replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3") // Remove unnecessary scientific notation (1e0).
13278     .replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1") // Make sure numbers always start with a digit.
13279     .replace(/^([+-])?\./, "$10.") // Remove extraneous trailing decimal zeroes.
13280     .replace(/(\.\d+?)0+(?=e|$)/, "$1") // Remove trailing dot.
13281     .replace(/\.(?=e|$)/, "");
13282   }
13283   /**
13284    * @param {string} str
13285    * @param {string} target
13286    * @returns {number}
13287    */
13288
13289
13290   function getMaxContinuousCount(str, target) {
13291     var results = str.match(new RegExp("(".concat(escapeStringRegexp(target), ")+"), "g"));
13292
13293     if (results === null) {
13294       return 0;
13295     }
13296
13297     return results.reduce(function (maxCount, result) {
13298       return Math.max(maxCount, result.length / target.length);
13299     }, 0);
13300   }
13301
13302   function getMinNotPresentContinuousCount(str, target) {
13303     var matches = str.match(new RegExp("(".concat(escapeStringRegexp(target), ")+"), "g"));
13304
13305     if (matches === null) {
13306       return 0;
13307     }
13308
13309     var countPresent = new Map();
13310     var max = 0;
13311     var _iteratorNormalCompletion = true;
13312     var _didIteratorError = false;
13313     var _iteratorError = undefined;
13314
13315     try {
13316       for (var _iterator = matches[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
13317         var match = _step.value;
13318         var count = match.length / target.length;
13319         countPresent.set(count, true);
13320
13321         if (count > max) {
13322           max = count;
13323         }
13324       }
13325     } catch (err) {
13326       _didIteratorError = true;
13327       _iteratorError = err;
13328     } finally {
13329       try {
13330         if (!_iteratorNormalCompletion && _iterator.return != null) {
13331           _iterator.return();
13332         }
13333       } finally {
13334         if (_didIteratorError) {
13335           throw _iteratorError;
13336         }
13337       }
13338     }
13339
13340     for (var i = 1; i < max; i++) {
13341       if (!countPresent.get(i)) {
13342         return i;
13343       }
13344     }
13345
13346     return max + 1;
13347   }
13348   /**
13349    * @param {string} text
13350    * @returns {number}
13351    */
13352
13353
13354   function getStringWidth(text) {
13355     if (!text) {
13356       return 0;
13357     } // shortcut to avoid needless string `RegExp`s, replacements, and allocations within `string-width`
13358
13359
13360     if (!notAsciiRegex.test(text)) {
13361       return text.length;
13362     }
13363
13364     return stringWidth_1(text);
13365   }
13366
13367   function hasIgnoreComment(path) {
13368     var node = path.getValue();
13369     return hasNodeIgnoreComment(node);
13370   }
13371
13372   function hasNodeIgnoreComment(node) {
13373     return node && node.comments && node.comments.length > 0 && node.comments.some(function (comment) {
13374       return comment.value.trim() === "prettier-ignore";
13375     });
13376   }
13377
13378   function matchAncestorTypes(path, types, index) {
13379     index = index || 0;
13380     types = types.slice();
13381
13382     while (types.length) {
13383       var parent = path.getParentNode(index);
13384       var type = types.shift();
13385
13386       if (!parent || parent.type !== type) {
13387         return false;
13388       }
13389
13390       index++;
13391     }
13392
13393     return true;
13394   }
13395
13396   function addCommentHelper(node, comment) {
13397     var comments = node.comments || (node.comments = []);
13398     comments.push(comment);
13399     comment.printed = false; // For some reason, TypeScript parses `// x` inside of JSXText as a comment
13400     // We already "print" it via the raw text, we don't need to re-print it as a
13401     // comment
13402
13403     if (node.type === "JSXText") {
13404       comment.printed = true;
13405     }
13406   }
13407
13408   function addLeadingComment(node, comment) {
13409     comment.leading = true;
13410     comment.trailing = false;
13411     addCommentHelper(node, comment);
13412   }
13413
13414   function addDanglingComment(node, comment) {
13415     comment.leading = false;
13416     comment.trailing = false;
13417     addCommentHelper(node, comment);
13418   }
13419
13420   function addTrailingComment(node, comment) {
13421     comment.leading = false;
13422     comment.trailing = true;
13423     addCommentHelper(node, comment);
13424   }
13425
13426   function isWithinParentArrayProperty(path, propertyName) {
13427     var node = path.getValue();
13428     var parent = path.getParentNode();
13429
13430     if (parent == null) {
13431       return false;
13432     }
13433
13434     if (!Array.isArray(parent[propertyName])) {
13435       return false;
13436     }
13437
13438     var key = path.getName();
13439     return parent[propertyName][key] === node;
13440   }
13441
13442   function replaceEndOfLineWith(text, replacement) {
13443     var parts = [];
13444     var _iteratorNormalCompletion2 = true;
13445     var _didIteratorError2 = false;
13446     var _iteratorError2 = undefined;
13447
13448     try {
13449       for (var _iterator2 = text.split("\n")[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
13450         var part = _step2.value;
13451
13452         if (parts.length !== 0) {
13453           parts.push(replacement);
13454         }
13455
13456         parts.push(part);
13457       }
13458     } catch (err) {
13459       _didIteratorError2 = true;
13460       _iteratorError2 = err;
13461     } finally {
13462       try {
13463         if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
13464           _iterator2.return();
13465         }
13466       } finally {
13467         if (_didIteratorError2) {
13468           throw _iteratorError2;
13469         }
13470       }
13471     }
13472
13473     return parts;
13474   }
13475
13476   var util = {
13477     replaceEndOfLineWith: replaceEndOfLineWith,
13478     getStringWidth: getStringWidth,
13479     getMaxContinuousCount: getMaxContinuousCount,
13480     getMinNotPresentContinuousCount: getMinNotPresentContinuousCount,
13481     getPrecedence: getPrecedence,
13482     shouldFlatten: shouldFlatten,
13483     isBitwiseOperator: isBitwiseOperator,
13484     isExportDeclaration: isExportDeclaration,
13485     getParentExportDeclaration: getParentExportDeclaration,
13486     getPenultimate: getPenultimate,
13487     getLast: getLast,
13488     getNextNonSpaceNonCommentCharacterIndexWithStartIndex: getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
13489     getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex,
13490     getNextNonSpaceNonCommentCharacter: getNextNonSpaceNonCommentCharacter,
13491     skip: skip,
13492     skipWhitespace: skipWhitespace,
13493     skipSpaces: skipSpaces,
13494     skipToLineEnd: skipToLineEnd,
13495     skipEverythingButNewLine: skipEverythingButNewLine,
13496     skipInlineComment: skipInlineComment,
13497     skipTrailingComment: skipTrailingComment,
13498     skipNewline: skipNewline,
13499     isNextLineEmptyAfterIndex: isNextLineEmptyAfterIndex,
13500     isNextLineEmpty: isNextLineEmpty,
13501     isPreviousLineEmpty: isPreviousLineEmpty,
13502     hasNewline: hasNewline,
13503     hasNewlineInRange: hasNewlineInRange,
13504     hasSpaces: hasSpaces,
13505     setLocStart: setLocStart,
13506     setLocEnd: setLocEnd,
13507     startsWithNoLookaheadToken: startsWithNoLookaheadToken,
13508     getAlignmentSize: getAlignmentSize,
13509     getIndentSize: getIndentSize,
13510     getPreferredQuote: getPreferredQuote,
13511     printString: printString,
13512     printNumber: printNumber,
13513     hasIgnoreComment: hasIgnoreComment,
13514     hasNodeIgnoreComment: hasNodeIgnoreComment,
13515     makeString: makeString,
13516     matchAncestorTypes: matchAncestorTypes,
13517     addLeadingComment: addLeadingComment,
13518     addDanglingComment: addDanglingComment,
13519     addTrailingComment: addTrailingComment,
13520     isWithinParentArrayProperty: isWithinParentArrayProperty
13521   };
13522
13523   function guessEndOfLine(text) {
13524     var index = text.indexOf("\r");
13525
13526     if (index >= 0) {
13527       return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
13528     }
13529
13530     return "lf";
13531   }
13532
13533   function convertEndOfLineToChars(value) {
13534     switch (value) {
13535       case "cr":
13536         return "\r";
13537
13538       case "crlf":
13539         return "\r\n";
13540
13541       default:
13542         return "\n";
13543     }
13544   }
13545
13546   var endOfLine = {
13547     guessEndOfLine: guessEndOfLine,
13548     convertEndOfLineToChars: convertEndOfLineToChars
13549   };
13550
13551   var getStringWidth$1 = util.getStringWidth;
13552   var convertEndOfLineToChars$1 = endOfLine.convertEndOfLineToChars;
13553   var concat$1 = docBuilders.concat,
13554       fill$1 = docBuilders.fill,
13555       cursor$1 = docBuilders.cursor;
13556   /** @type {Record<symbol, typeof MODE_BREAK | typeof MODE_FLAT>} */
13557
13558   var groupModeMap;
13559   var MODE_BREAK = 1;
13560   var MODE_FLAT = 2;
13561
13562   function rootIndent() {
13563     return {
13564       value: "",
13565       length: 0,
13566       queue: []
13567     };
13568   }
13569
13570   function makeIndent(ind, options) {
13571     return generateInd(ind, {
13572       type: "indent"
13573     }, options);
13574   }
13575
13576   function makeAlign(ind, n, options) {
13577     return n === -Infinity ? ind.root || rootIndent() : n < 0 ? generateInd(ind, {
13578       type: "dedent"
13579     }, options) : !n ? ind : n.type === "root" ? Object.assign({}, ind, {
13580       root: ind
13581     }) : typeof n === "string" ? generateInd(ind, {
13582       type: "stringAlign",
13583       n: n
13584     }, options) : generateInd(ind, {
13585       type: "numberAlign",
13586       n: n
13587     }, options);
13588   }
13589
13590   function generateInd(ind, newPart, options) {
13591     var queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : ind.queue.concat(newPart);
13592     var value = "";
13593     var length = 0;
13594     var lastTabs = 0;
13595     var lastSpaces = 0;
13596     var _iteratorNormalCompletion = true;
13597     var _didIteratorError = false;
13598     var _iteratorError = undefined;
13599
13600     try {
13601       for (var _iterator = queue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
13602         var part = _step.value;
13603
13604         switch (part.type) {
13605           case "indent":
13606             flush();
13607
13608             if (options.useTabs) {
13609               addTabs(1);
13610             } else {
13611               addSpaces(options.tabWidth);
13612             }
13613
13614             break;
13615
13616           case "stringAlign":
13617             flush();
13618             value += part.n;
13619             length += part.n.length;
13620             break;
13621
13622           case "numberAlign":
13623             lastTabs += 1;
13624             lastSpaces += part.n;
13625             break;
13626
13627           /* istanbul ignore next */
13628
13629           default:
13630             throw new Error("Unexpected type '".concat(part.type, "'"));
13631         }
13632       }
13633     } catch (err) {
13634       _didIteratorError = true;
13635       _iteratorError = err;
13636     } finally {
13637       try {
13638         if (!_iteratorNormalCompletion && _iterator.return != null) {
13639           _iterator.return();
13640         }
13641       } finally {
13642         if (_didIteratorError) {
13643           throw _iteratorError;
13644         }
13645       }
13646     }
13647
13648     flushSpaces();
13649     return Object.assign({}, ind, {
13650       value: value,
13651       length: length,
13652       queue: queue
13653     });
13654
13655     function addTabs(count) {
13656       value += "\t".repeat(count);
13657       length += options.tabWidth * count;
13658     }
13659
13660     function addSpaces(count) {
13661       value += " ".repeat(count);
13662       length += count;
13663     }
13664
13665     function flush() {
13666       if (options.useTabs) {
13667         flushTabs();
13668       } else {
13669         flushSpaces();
13670       }
13671     }
13672
13673     function flushTabs() {
13674       if (lastTabs > 0) {
13675         addTabs(lastTabs);
13676       }
13677
13678       resetLast();
13679     }
13680
13681     function flushSpaces() {
13682       if (lastSpaces > 0) {
13683         addSpaces(lastSpaces);
13684       }
13685
13686       resetLast();
13687     }
13688
13689     function resetLast() {
13690       lastTabs = 0;
13691       lastSpaces = 0;
13692     }
13693   }
13694
13695   function trim$1(out) {
13696     if (out.length === 0) {
13697       return 0;
13698     }
13699
13700     var trimCount = 0; // Trim whitespace at the end of line
13701
13702     while (out.length > 0 && typeof out[out.length - 1] === "string" && out[out.length - 1].match(/^[ \t]*$/)) {
13703       trimCount += out.pop().length;
13704     }
13705
13706     if (out.length && typeof out[out.length - 1] === "string") {
13707       var trimmed = out[out.length - 1].replace(/[ \t]*$/, "");
13708       trimCount += out[out.length - 1].length - trimmed.length;
13709       out[out.length - 1] = trimmed;
13710     }
13711
13712     return trimCount;
13713   }
13714
13715   function fits(next, restCommands, width, options, mustBeFlat) {
13716     var restIdx = restCommands.length;
13717     var cmds = [next]; // `out` is only used for width counting because `trim` requires to look
13718     // backwards for space characters.
13719
13720     var out = [];
13721
13722     while (width >= 0) {
13723       if (cmds.length === 0) {
13724         if (restIdx === 0) {
13725           return true;
13726         }
13727
13728         cmds.push(restCommands[restIdx - 1]);
13729         restIdx--;
13730         continue;
13731       }
13732
13733       var x = cmds.pop();
13734       var ind = x[0];
13735       var mode = x[1];
13736       var doc = x[2];
13737
13738       if (typeof doc === "string") {
13739         out.push(doc);
13740         width -= getStringWidth$1(doc);
13741       } else {
13742         switch (doc.type) {
13743           case "concat":
13744             for (var i = doc.parts.length - 1; i >= 0; i--) {
13745               cmds.push([ind, mode, doc.parts[i]]);
13746             }
13747
13748             break;
13749
13750           case "indent":
13751             cmds.push([makeIndent(ind, options), mode, doc.contents]);
13752             break;
13753
13754           case "align":
13755             cmds.push([makeAlign(ind, doc.n, options), mode, doc.contents]);
13756             break;
13757
13758           case "trim":
13759             width += trim$1(out);
13760             break;
13761
13762           case "group":
13763             if (mustBeFlat && doc.break) {
13764               return false;
13765             }
13766
13767             cmds.push([ind, doc.break ? MODE_BREAK : mode, doc.contents]);
13768
13769             if (doc.id) {
13770               groupModeMap[doc.id] = cmds[cmds.length - 1][1];
13771             }
13772
13773             break;
13774
13775           case "fill":
13776             for (var _i = doc.parts.length - 1; _i >= 0; _i--) {
13777               cmds.push([ind, mode, doc.parts[_i]]);
13778             }
13779
13780             break;
13781
13782           case "if-break":
13783             {
13784               var groupMode = doc.groupId ? groupModeMap[doc.groupId] : mode;
13785
13786               if (groupMode === MODE_BREAK) {
13787                 if (doc.breakContents) {
13788                   cmds.push([ind, mode, doc.breakContents]);
13789                 }
13790               }
13791
13792               if (groupMode === MODE_FLAT) {
13793                 if (doc.flatContents) {
13794                   cmds.push([ind, mode, doc.flatContents]);
13795                 }
13796               }
13797
13798               break;
13799             }
13800
13801           case "line":
13802             switch (mode) {
13803               // fallthrough
13804               case MODE_FLAT:
13805                 if (!doc.hard) {
13806                   if (!doc.soft) {
13807                     out.push(" ");
13808                     width -= 1;
13809                   }
13810
13811                   break;
13812                 }
13813
13814                 return true;
13815
13816               case MODE_BREAK:
13817                 return true;
13818             }
13819
13820             break;
13821         }
13822       }
13823     }
13824
13825     return false;
13826   }
13827
13828   function printDocToString(doc, options) {
13829     groupModeMap = {};
13830     var width = options.printWidth;
13831     var newLine = convertEndOfLineToChars$1(options.endOfLine);
13832     var pos = 0; // cmds is basically a stack. We've turned a recursive call into a
13833     // while loop which is much faster. The while loop below adds new
13834     // cmds to the array instead of recursively calling `print`.
13835
13836     var cmds = [[rootIndent(), MODE_BREAK, doc]];
13837     var out = [];
13838     var shouldRemeasure = false;
13839     var lineSuffix = [];
13840
13841     while (cmds.length !== 0) {
13842       var x = cmds.pop();
13843       var ind = x[0];
13844       var mode = x[1];
13845       var _doc = x[2];
13846
13847       if (typeof _doc === "string") {
13848         out.push(_doc);
13849         pos += getStringWidth$1(_doc);
13850       } else {
13851         switch (_doc.type) {
13852           case "cursor":
13853             out.push(cursor$1.placeholder);
13854             break;
13855
13856           case "concat":
13857             for (var i = _doc.parts.length - 1; i >= 0; i--) {
13858               cmds.push([ind, mode, _doc.parts[i]]);
13859             }
13860
13861             break;
13862
13863           case "indent":
13864             cmds.push([makeIndent(ind, options), mode, _doc.contents]);
13865             break;
13866
13867           case "align":
13868             cmds.push([makeAlign(ind, _doc.n, options), mode, _doc.contents]);
13869             break;
13870
13871           case "trim":
13872             pos -= trim$1(out);
13873             break;
13874
13875           case "group":
13876             switch (mode) {
13877               case MODE_FLAT:
13878                 if (!shouldRemeasure) {
13879                   cmds.push([ind, _doc.break ? MODE_BREAK : MODE_FLAT, _doc.contents]);
13880                   break;
13881                 }
13882
13883               // fallthrough
13884
13885               case MODE_BREAK:
13886                 {
13887                   shouldRemeasure = false;
13888                   var next = [ind, MODE_FLAT, _doc.contents];
13889                   var rem = width - pos;
13890
13891                   if (!_doc.break && fits(next, cmds, rem, options)) {
13892                     cmds.push(next);
13893                   } else {
13894                     // Expanded states are a rare case where a document
13895                     // can manually provide multiple representations of
13896                     // itself. It provides an array of documents
13897                     // going from the least expanded (most flattened)
13898                     // representation first to the most expanded. If a
13899                     // group has these, we need to manually go through
13900                     // these states and find the first one that fits.
13901                     if (_doc.expandedStates) {
13902                       var mostExpanded = _doc.expandedStates[_doc.expandedStates.length - 1];
13903
13904                       if (_doc.break) {
13905                         cmds.push([ind, MODE_BREAK, mostExpanded]);
13906                         break;
13907                       } else {
13908                         for (var _i2 = 1; _i2 < _doc.expandedStates.length + 1; _i2++) {
13909                           if (_i2 >= _doc.expandedStates.length) {
13910                             cmds.push([ind, MODE_BREAK, mostExpanded]);
13911                             break;
13912                           } else {
13913                             var state = _doc.expandedStates[_i2];
13914                             var cmd = [ind, MODE_FLAT, state];
13915
13916                             if (fits(cmd, cmds, rem, options)) {
13917                               cmds.push(cmd);
13918                               break;
13919                             }
13920                           }
13921                         }
13922                       }
13923                     } else {
13924                       cmds.push([ind, MODE_BREAK, _doc.contents]);
13925                     }
13926                   }
13927
13928                   break;
13929                 }
13930             }
13931
13932             if (_doc.id) {
13933               groupModeMap[_doc.id] = cmds[cmds.length - 1][1];
13934             }
13935
13936             break;
13937           // Fills each line with as much code as possible before moving to a new
13938           // line with the same indentation.
13939           //
13940           // Expects doc.parts to be an array of alternating content and
13941           // whitespace. The whitespace contains the linebreaks.
13942           //
13943           // For example:
13944           //   ["I", line, "love", line, "monkeys"]
13945           // or
13946           //   [{ type: group, ... }, softline, { type: group, ... }]
13947           //
13948           // It uses this parts structure to handle three main layout cases:
13949           // * The first two content items fit on the same line without
13950           //   breaking
13951           //   -> output the first content item and the whitespace "flat".
13952           // * Only the first content item fits on the line without breaking
13953           //   -> output the first content item "flat" and the whitespace with
13954           //   "break".
13955           // * Neither content item fits on the line without breaking
13956           //   -> output the first content item and the whitespace with "break".
13957
13958           case "fill":
13959             {
13960               var _rem = width - pos;
13961
13962               var parts = _doc.parts;
13963
13964               if (parts.length === 0) {
13965                 break;
13966               }
13967
13968               var content = parts[0];
13969               var contentFlatCmd = [ind, MODE_FLAT, content];
13970               var contentBreakCmd = [ind, MODE_BREAK, content];
13971               var contentFits = fits(contentFlatCmd, [], _rem, options, true);
13972
13973               if (parts.length === 1) {
13974                 if (contentFits) {
13975                   cmds.push(contentFlatCmd);
13976                 } else {
13977                   cmds.push(contentBreakCmd);
13978                 }
13979
13980                 break;
13981               }
13982
13983               var whitespace = parts[1];
13984               var whitespaceFlatCmd = [ind, MODE_FLAT, whitespace];
13985               var whitespaceBreakCmd = [ind, MODE_BREAK, whitespace];
13986
13987               if (parts.length === 2) {
13988                 if (contentFits) {
13989                   cmds.push(whitespaceFlatCmd);
13990                   cmds.push(contentFlatCmd);
13991                 } else {
13992                   cmds.push(whitespaceBreakCmd);
13993                   cmds.push(contentBreakCmd);
13994                 }
13995
13996                 break;
13997               } // At this point we've handled the first pair (context, separator)
13998               // and will create a new fill doc for the rest of the content.
13999               // Ideally we wouldn't mutate the array here but coping all the
14000               // elements to a new array would make this algorithm quadratic,
14001               // which is unusable for large arrays (e.g. large texts in JSX).
14002
14003
14004               parts.splice(0, 2);
14005               var remainingCmd = [ind, mode, fill$1(parts)];
14006               var secondContent = parts[0];
14007               var firstAndSecondContentFlatCmd = [ind, MODE_FLAT, concat$1([content, whitespace, secondContent])];
14008               var firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], _rem, options, true);
14009
14010               if (firstAndSecondContentFits) {
14011                 cmds.push(remainingCmd);
14012                 cmds.push(whitespaceFlatCmd);
14013                 cmds.push(contentFlatCmd);
14014               } else if (contentFits) {
14015                 cmds.push(remainingCmd);
14016                 cmds.push(whitespaceBreakCmd);
14017                 cmds.push(contentFlatCmd);
14018               } else {
14019                 cmds.push(remainingCmd);
14020                 cmds.push(whitespaceBreakCmd);
14021                 cmds.push(contentBreakCmd);
14022               }
14023
14024               break;
14025             }
14026
14027           case "if-break":
14028             {
14029               var groupMode = _doc.groupId ? groupModeMap[_doc.groupId] : mode;
14030
14031               if (groupMode === MODE_BREAK) {
14032                 if (_doc.breakContents) {
14033                   cmds.push([ind, mode, _doc.breakContents]);
14034                 }
14035               }
14036
14037               if (groupMode === MODE_FLAT) {
14038                 if (_doc.flatContents) {
14039                   cmds.push([ind, mode, _doc.flatContents]);
14040                 }
14041               }
14042
14043               break;
14044             }
14045
14046           case "line-suffix":
14047             lineSuffix.push([ind, mode, _doc.contents]);
14048             break;
14049
14050           case "line-suffix-boundary":
14051             if (lineSuffix.length > 0) {
14052               cmds.push([ind, mode, {
14053                 type: "line",
14054                 hard: true
14055               }]);
14056             }
14057
14058             break;
14059
14060           case "line":
14061             switch (mode) {
14062               case MODE_FLAT:
14063                 if (!_doc.hard) {
14064                   if (!_doc.soft) {
14065                     out.push(" ");
14066                     pos += 1;
14067                   }
14068
14069                   break;
14070                 } else {
14071                   // This line was forced into the output even if we
14072                   // were in flattened mode, so we need to tell the next
14073                   // group that no matter what, it needs to remeasure
14074                   // because the previous measurement didn't accurately
14075                   // capture the entire expression (this is necessary
14076                   // for nested groups)
14077                   shouldRemeasure = true;
14078                 }
14079
14080               // fallthrough
14081
14082               case MODE_BREAK:
14083                 if (lineSuffix.length) {
14084                   cmds.push([ind, mode, _doc]);
14085                   [].push.apply(cmds, lineSuffix.reverse());
14086                   lineSuffix = [];
14087                   break;
14088                 }
14089
14090                 if (_doc.literal) {
14091                   if (ind.root) {
14092                     out.push(newLine, ind.root.value);
14093                     pos = ind.root.length;
14094                   } else {
14095                     out.push(newLine);
14096                     pos = 0;
14097                   }
14098                 } else {
14099                   pos -= trim$1(out);
14100                   out.push(newLine + ind.value);
14101                   pos = ind.length;
14102                 }
14103
14104                 break;
14105             }
14106
14107             break;
14108         }
14109       }
14110     }
14111
14112     var cursorPlaceholderIndex = out.indexOf(cursor$1.placeholder);
14113
14114     if (cursorPlaceholderIndex !== -1) {
14115       var otherCursorPlaceholderIndex = out.indexOf(cursor$1.placeholder, cursorPlaceholderIndex + 1);
14116       var beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
14117       var aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
14118       var afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
14119       return {
14120         formatted: beforeCursor + aroundCursor + afterCursor,
14121         cursorNodeStart: beforeCursor.length,
14122         cursorNodeText: aroundCursor
14123       };
14124     }
14125
14126     return {
14127       formatted: out.join("")
14128     };
14129   }
14130
14131   var docPrinter = {
14132     printDocToString: printDocToString
14133   };
14134
14135   var traverseDocOnExitStackMarker = {};
14136
14137   function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) {
14138     var docsStack = [doc];
14139
14140     while (docsStack.length !== 0) {
14141       var _doc = docsStack.pop();
14142
14143       if (_doc === traverseDocOnExitStackMarker) {
14144         onExit(docsStack.pop());
14145         continue;
14146       }
14147
14148       var shouldRecurse = true;
14149
14150       if (onEnter) {
14151         if (onEnter(_doc) === false) {
14152           shouldRecurse = false;
14153         }
14154       }
14155
14156       if (onExit) {
14157         docsStack.push(_doc);
14158         docsStack.push(traverseDocOnExitStackMarker);
14159       }
14160
14161       if (shouldRecurse) {
14162         // When there are multiple parts to process,
14163         // the parts need to be pushed onto the stack in reverse order,
14164         // so that they are processed in the original order
14165         // when the stack is popped.
14166         if (_doc.type === "concat" || _doc.type === "fill") {
14167           for (var ic = _doc.parts.length, i = ic - 1; i >= 0; --i) {
14168             docsStack.push(_doc.parts[i]);
14169           }
14170         } else if (_doc.type === "if-break") {
14171           if (_doc.flatContents) {
14172             docsStack.push(_doc.flatContents);
14173           }
14174
14175           if (_doc.breakContents) {
14176             docsStack.push(_doc.breakContents);
14177           }
14178         } else if (_doc.type === "group" && _doc.expandedStates) {
14179           if (shouldTraverseConditionalGroups) {
14180             for (var _ic = _doc.expandedStates.length, _i = _ic - 1; _i >= 0; --_i) {
14181               docsStack.push(_doc.expandedStates[_i]);
14182             }
14183           } else {
14184             docsStack.push(_doc.contents);
14185           }
14186         } else if (_doc.contents) {
14187           docsStack.push(_doc.contents);
14188         }
14189       }
14190     }
14191   }
14192
14193   function mapDoc(doc, cb) {
14194     if (doc.type === "concat" || doc.type === "fill") {
14195       var parts = doc.parts.map(function (part) {
14196         return mapDoc(part, cb);
14197       });
14198       return cb(Object.assign({}, doc, {
14199         parts: parts
14200       }));
14201     } else if (doc.type === "if-break") {
14202       var breakContents = doc.breakContents && mapDoc(doc.breakContents, cb);
14203       var flatContents = doc.flatContents && mapDoc(doc.flatContents, cb);
14204       return cb(Object.assign({}, doc, {
14205         breakContents: breakContents,
14206         flatContents: flatContents
14207       }));
14208     } else if (doc.contents) {
14209       var contents = mapDoc(doc.contents, cb);
14210       return cb(Object.assign({}, doc, {
14211         contents: contents
14212       }));
14213     }
14214
14215     return cb(doc);
14216   }
14217
14218   function findInDoc(doc, fn, defaultValue) {
14219     var result = defaultValue;
14220     var hasStopped = false;
14221
14222     function findInDocOnEnterFn(doc) {
14223       var maybeResult = fn(doc);
14224
14225       if (maybeResult !== undefined) {
14226         hasStopped = true;
14227         result = maybeResult;
14228       }
14229
14230       if (hasStopped) {
14231         return false;
14232       }
14233     }
14234
14235     traverseDoc(doc, findInDocOnEnterFn);
14236     return result;
14237   }
14238
14239   function isEmpty(n) {
14240     return typeof n === "string" && n.length === 0;
14241   }
14242
14243   function isLineNextFn(doc) {
14244     if (typeof doc === "string") {
14245       return false;
14246     }
14247
14248     if (doc.type === "line") {
14249       return true;
14250     }
14251   }
14252
14253   function isLineNext(doc) {
14254     return findInDoc(doc, isLineNextFn, false);
14255   }
14256
14257   function willBreakFn(doc) {
14258     if (doc.type === "group" && doc.break) {
14259       return true;
14260     }
14261
14262     if (doc.type === "line" && doc.hard) {
14263       return true;
14264     }
14265
14266     if (doc.type === "break-parent") {
14267       return true;
14268     }
14269   }
14270
14271   function willBreak(doc) {
14272     return findInDoc(doc, willBreakFn, false);
14273   }
14274
14275   function breakParentGroup(groupStack) {
14276     if (groupStack.length > 0) {
14277       var parentGroup = groupStack[groupStack.length - 1]; // Breaks are not propagated through conditional groups because
14278       // the user is expected to manually handle what breaks.
14279
14280       if (!parentGroup.expandedStates) {
14281         parentGroup.break = true;
14282       }
14283     }
14284
14285     return null;
14286   }
14287
14288   function propagateBreaks(doc) {
14289     var alreadyVisitedSet = new Set();
14290     var groupStack = [];
14291
14292     function propagateBreaksOnEnterFn(doc) {
14293       if (doc.type === "break-parent") {
14294         breakParentGroup(groupStack);
14295       }
14296
14297       if (doc.type === "group") {
14298         groupStack.push(doc);
14299
14300         if (alreadyVisitedSet.has(doc)) {
14301           return false;
14302         }
14303
14304         alreadyVisitedSet.add(doc);
14305       }
14306     }
14307
14308     function propagateBreaksOnExitFn(doc) {
14309       if (doc.type === "group") {
14310         var group = groupStack.pop();
14311
14312         if (group.break) {
14313           breakParentGroup(groupStack);
14314         }
14315       }
14316     }
14317
14318     traverseDoc(doc, propagateBreaksOnEnterFn, propagateBreaksOnExitFn,
14319     /* shouldTraverseConditionalGroups */
14320     true);
14321   }
14322
14323   function removeLinesFn(doc) {
14324     // Force this doc into flat mode by statically converting all
14325     // lines into spaces (or soft lines into nothing). Hard lines
14326     // should still output because there's too great of a chance
14327     // of breaking existing assumptions otherwise.
14328     if (doc.type === "line" && !doc.hard) {
14329       return doc.soft ? "" : " ";
14330     } else if (doc.type === "if-break") {
14331       return doc.flatContents || "";
14332     }
14333
14334     return doc;
14335   }
14336
14337   function removeLines(doc) {
14338     return mapDoc(doc, removeLinesFn);
14339   }
14340
14341   function stripTrailingHardline(doc) {
14342     // HACK remove ending hardline, original PR: #1984
14343     if (doc.type === "concat" && doc.parts.length !== 0) {
14344       var lastPart = doc.parts[doc.parts.length - 1];
14345
14346       if (lastPart.type === "concat") {
14347         if (lastPart.parts.length === 2 && lastPart.parts[0].hard && lastPart.parts[1].type === "break-parent") {
14348           return {
14349             type: "concat",
14350             parts: doc.parts.slice(0, -1)
14351           };
14352         }
14353
14354         return {
14355           type: "concat",
14356           parts: doc.parts.slice(0, -1).concat(stripTrailingHardline(lastPart))
14357         };
14358       }
14359     }
14360
14361     return doc;
14362   }
14363
14364   var docUtils = {
14365     isEmpty: isEmpty,
14366     willBreak: willBreak,
14367     isLineNext: isLineNext,
14368     traverseDoc: traverseDoc,
14369     findInDoc: findInDoc,
14370     mapDoc: mapDoc,
14371     propagateBreaks: propagateBreaks,
14372     removeLines: removeLines,
14373     stripTrailingHardline: stripTrailingHardline
14374   };
14375
14376   function flattenDoc(doc) {
14377     if (doc.type === "concat") {
14378       var res = [];
14379
14380       for (var i = 0; i < doc.parts.length; ++i) {
14381         var doc2 = doc.parts[i];
14382
14383         if (typeof doc2 !== "string" && doc2.type === "concat") {
14384           [].push.apply(res, flattenDoc(doc2).parts);
14385         } else {
14386           var flattened = flattenDoc(doc2);
14387
14388           if (flattened !== "") {
14389             res.push(flattened);
14390           }
14391         }
14392       }
14393
14394       return Object.assign({}, doc, {
14395         parts: res
14396       });
14397     } else if (doc.type === "if-break") {
14398       return Object.assign({}, doc, {
14399         breakContents: doc.breakContents != null ? flattenDoc(doc.breakContents) : null,
14400         flatContents: doc.flatContents != null ? flattenDoc(doc.flatContents) : null
14401       });
14402     } else if (doc.type === "group") {
14403       return Object.assign({}, doc, {
14404         contents: flattenDoc(doc.contents),
14405         expandedStates: doc.expandedStates ? doc.expandedStates.map(flattenDoc) : doc.expandedStates
14406       });
14407     } else if (doc.contents) {
14408       return Object.assign({}, doc, {
14409         contents: flattenDoc(doc.contents)
14410       });
14411     }
14412
14413     return doc;
14414   }
14415
14416   function printDoc(doc) {
14417     if (typeof doc === "string") {
14418       return JSON.stringify(doc);
14419     }
14420
14421     if (doc.type === "line") {
14422       if (doc.literal) {
14423         return "literalline";
14424       }
14425
14426       if (doc.hard) {
14427         return "hardline";
14428       }
14429
14430       if (doc.soft) {
14431         return "softline";
14432       }
14433
14434       return "line";
14435     }
14436
14437     if (doc.type === "break-parent") {
14438       return "breakParent";
14439     }
14440
14441     if (doc.type === "trim") {
14442       return "trim";
14443     }
14444
14445     if (doc.type === "concat") {
14446       return "[" + doc.parts.map(printDoc).join(", ") + "]";
14447     }
14448
14449     if (doc.type === "indent") {
14450       return "indent(" + printDoc(doc.contents) + ")";
14451     }
14452
14453     if (doc.type === "align") {
14454       return doc.n === -Infinity ? "dedentToRoot(" + printDoc(doc.contents) + ")" : doc.n < 0 ? "dedent(" + printDoc(doc.contents) + ")" : doc.n.type === "root" ? "markAsRoot(" + printDoc(doc.contents) + ")" : "align(" + JSON.stringify(doc.n) + ", " + printDoc(doc.contents) + ")";
14455     }
14456
14457     if (doc.type === "if-break") {
14458       return "ifBreak(" + printDoc(doc.breakContents) + (doc.flatContents ? ", " + printDoc(doc.flatContents) : "") + ")";
14459     }
14460
14461     if (doc.type === "group") {
14462       if (doc.expandedStates) {
14463         return "conditionalGroup(" + "[" + doc.expandedStates.map(printDoc).join(",") + "])";
14464       }
14465
14466       return (doc.break ? "wrappedGroup" : "group") + "(" + printDoc(doc.contents) + ")";
14467     }
14468
14469     if (doc.type === "fill") {
14470       return "fill" + "(" + doc.parts.map(printDoc).join(", ") + ")";
14471     }
14472
14473     if (doc.type === "line-suffix") {
14474       return "lineSuffix(" + printDoc(doc.contents) + ")";
14475     }
14476
14477     if (doc.type === "line-suffix-boundary") {
14478       return "lineSuffixBoundary";
14479     }
14480
14481     throw new Error("Unknown doc type " + doc.type);
14482   }
14483
14484   var docDebug = {
14485     printDocToDebug: function printDocToDebug(doc) {
14486       return printDoc(flattenDoc(doc));
14487     }
14488   };
14489
14490   var doc = {
14491     builders: docBuilders,
14492     printer: docPrinter,
14493     utils: docUtils,
14494     debug: docDebug
14495   };
14496
14497   var mapDoc$1 = doc.utils.mapDoc;
14498
14499   function isNextLineEmpty$1(text, node, options) {
14500     return util.isNextLineEmpty(text, node, options.locEnd);
14501   }
14502
14503   function isPreviousLineEmpty$1(text, node, options) {
14504     return util.isPreviousLineEmpty(text, node, options.locStart);
14505   }
14506
14507   function getNextNonSpaceNonCommentCharacterIndex$1(text, node, options) {
14508     return util.getNextNonSpaceNonCommentCharacterIndex(text, node, options.locEnd);
14509   }
14510
14511   var utilShared = {
14512     getMaxContinuousCount: util.getMaxContinuousCount,
14513     getStringWidth: util.getStringWidth,
14514     getAlignmentSize: util.getAlignmentSize,
14515     getIndentSize: util.getIndentSize,
14516     skip: util.skip,
14517     skipWhitespace: util.skipWhitespace,
14518     skipSpaces: util.skipSpaces,
14519     skipNewline: util.skipNewline,
14520     skipToLineEnd: util.skipToLineEnd,
14521     skipEverythingButNewLine: util.skipEverythingButNewLine,
14522     skipInlineComment: util.skipInlineComment,
14523     skipTrailingComment: util.skipTrailingComment,
14524     hasNewline: util.hasNewline,
14525     hasNewlineInRange: util.hasNewlineInRange,
14526     hasSpaces: util.hasSpaces,
14527     isNextLineEmpty: isNextLineEmpty$1,
14528     isNextLineEmptyAfterIndex: util.isNextLineEmptyAfterIndex,
14529     isPreviousLineEmpty: isPreviousLineEmpty$1,
14530     getNextNonSpaceNonCommentCharacterIndex: getNextNonSpaceNonCommentCharacterIndex$1,
14531     mapDoc: mapDoc$1,
14532     // TODO: remove in 2.0, we already exposed it in docUtils
14533     makeString: util.makeString,
14534     addLeadingComment: util.addLeadingComment,
14535     addDanglingComment: util.addDanglingComment,
14536     addTrailingComment: util.addTrailingComment
14537   };
14538
14539   var _require$$0$builders = doc.builders,
14540       concat$2 = _require$$0$builders.concat,
14541       hardline$1 = _require$$0$builders.hardline,
14542       breakParent$1 = _require$$0$builders.breakParent,
14543       indent$1 = _require$$0$builders.indent,
14544       lineSuffix$1 = _require$$0$builders.lineSuffix,
14545       join$1 = _require$$0$builders.join,
14546       cursor$2 = _require$$0$builders.cursor;
14547   var hasNewline$1 = util.hasNewline,
14548       skipNewline$1 = util.skipNewline,
14549       isPreviousLineEmpty$2 = util.isPreviousLineEmpty;
14550   var addLeadingComment$1 = utilShared.addLeadingComment,
14551       addDanglingComment$1 = utilShared.addDanglingComment,
14552       addTrailingComment$1 = utilShared.addTrailingComment;
14553   var childNodesCacheKey = Symbol("child-nodes");
14554
14555   function getSortedChildNodes(node, options, resultArray) {
14556     if (!node) {
14557       return;
14558     }
14559
14560     var printer = options.printer,
14561         locStart = options.locStart,
14562         locEnd = options.locEnd;
14563
14564     if (resultArray) {
14565       if (node && printer.canAttachComment && printer.canAttachComment(node)) {
14566         // This reverse insertion sort almost always takes constant
14567         // time because we almost always (maybe always?) append the
14568         // nodes in order anyway.
14569         var i;
14570
14571         for (i = resultArray.length - 1; i >= 0; --i) {
14572           if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
14573             break;
14574           }
14575         }
14576
14577         resultArray.splice(i + 1, 0, node);
14578         return;
14579       }
14580     } else if (node[childNodesCacheKey]) {
14581       return node[childNodesCacheKey];
14582     }
14583
14584     var childNodes;
14585
14586     if (printer.getCommentChildNodes) {
14587       childNodes = printer.getCommentChildNodes(node);
14588     } else if (node && _typeof(node) === "object") {
14589       childNodes = Object.keys(node).filter(function (n) {
14590         return n !== "enclosingNode" && n !== "precedingNode" && n !== "followingNode";
14591       }).map(function (n) {
14592         return node[n];
14593       });
14594     }
14595
14596     if (!childNodes) {
14597       return;
14598     }
14599
14600     if (!resultArray) {
14601       Object.defineProperty(node, childNodesCacheKey, {
14602         value: resultArray = [],
14603         enumerable: false
14604       });
14605     }
14606
14607     childNodes.forEach(function (childNode) {
14608       getSortedChildNodes(childNode, options, resultArray);
14609     });
14610     return resultArray;
14611   } // As efficiently as possible, decorate the comment object with
14612   // .precedingNode, .enclosingNode, and/or .followingNode properties, at
14613   // least one of which is guaranteed to be defined.
14614
14615
14616   function decorateComment(node, comment, options) {
14617     var locStart = options.locStart,
14618         locEnd = options.locEnd;
14619     var childNodes = getSortedChildNodes(node, options);
14620     var precedingNode;
14621     var followingNode; // Time to dust off the old binary search robes and wizard hat.
14622
14623     var left = 0;
14624     var right = childNodes.length;
14625
14626     while (left < right) {
14627       var middle = left + right >> 1;
14628       var child = childNodes[middle];
14629
14630       if (locStart(child) - locStart(comment) <= 0 && locEnd(comment) - locEnd(child) <= 0) {
14631         // The comment is completely contained by this child node.
14632         comment.enclosingNode = child;
14633         decorateComment(child, comment, options);
14634         return; // Abandon the binary search at this level.
14635       }
14636
14637       if (locEnd(child) - locStart(comment) <= 0) {
14638         // This child node falls completely before the comment.
14639         // Because we will never consider this node or any nodes
14640         // before it again, this node must be the closest preceding
14641         // node we have encountered so far.
14642         precedingNode = child;
14643         left = middle + 1;
14644         continue;
14645       }
14646
14647       if (locEnd(comment) - locStart(child) <= 0) {
14648         // This child node falls completely after the comment.
14649         // Because we will never consider this node or any nodes after
14650         // it again, this node must be the closest following node we
14651         // have encountered so far.
14652         followingNode = child;
14653         right = middle;
14654         continue;
14655       }
14656       /* istanbul ignore next */
14657
14658
14659       throw new Error("Comment location overlaps with node location");
14660     } // We don't want comments inside of different expressions inside of the same
14661     // template literal to move to another expression.
14662
14663
14664     if (comment.enclosingNode && comment.enclosingNode.type === "TemplateLiteral") {
14665       var quasis = comment.enclosingNode.quasis;
14666       var commentIndex = findExpressionIndexForComment(quasis, comment, options);
14667
14668       if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
14669         precedingNode = null;
14670       }
14671
14672       if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
14673         followingNode = null;
14674       }
14675     }
14676
14677     if (precedingNode) {
14678       comment.precedingNode = precedingNode;
14679     }
14680
14681     if (followingNode) {
14682       comment.followingNode = followingNode;
14683     }
14684   }
14685
14686   function attach(comments, ast, text, options) {
14687     if (!Array.isArray(comments)) {
14688       return;
14689     }
14690
14691     var tiesToBreak = [];
14692     var locStart = options.locStart,
14693         locEnd = options.locEnd;
14694     comments.forEach(function (comment, i) {
14695       if (options.parser === "json" || options.parser === "json5" || options.parser === "__js_expression" || options.parser === "__vue_expression") {
14696         if (locStart(comment) - locStart(ast) <= 0) {
14697           addLeadingComment$1(ast, comment);
14698           return;
14699         }
14700
14701         if (locEnd(comment) - locEnd(ast) >= 0) {
14702           addTrailingComment$1(ast, comment);
14703           return;
14704         }
14705       }
14706
14707       decorateComment(ast, comment, options);
14708       var precedingNode = comment.precedingNode,
14709           enclosingNode = comment.enclosingNode,
14710           followingNode = comment.followingNode;
14711       var pluginHandleOwnLineComment = options.printer.handleComments && options.printer.handleComments.ownLine ? options.printer.handleComments.ownLine : function () {
14712         return false;
14713       };
14714       var pluginHandleEndOfLineComment = options.printer.handleComments && options.printer.handleComments.endOfLine ? options.printer.handleComments.endOfLine : function () {
14715         return false;
14716       };
14717       var pluginHandleRemainingComment = options.printer.handleComments && options.printer.handleComments.remaining ? options.printer.handleComments.remaining : function () {
14718         return false;
14719       };
14720       var isLastComment = comments.length - 1 === i;
14721
14722       if (hasNewline$1(text, locStart(comment), {
14723         backwards: true
14724       })) {
14725         // If a comment exists on its own line, prefer a leading comment.
14726         // We also need to check if it's the first line of the file.
14727         if (pluginHandleOwnLineComment(comment, text, options, ast, isLastComment)) ; else if (followingNode) {
14728           // Always a leading comment.
14729           addLeadingComment$1(followingNode, comment);
14730         } else if (precedingNode) {
14731           addTrailingComment$1(precedingNode, comment);
14732         } else if (enclosingNode) {
14733           addDanglingComment$1(enclosingNode, comment);
14734         } else {
14735           // There are no nodes, let's attach it to the root of the ast
14736
14737           /* istanbul ignore next */
14738           addDanglingComment$1(ast, comment);
14739         }
14740       } else if (hasNewline$1(text, locEnd(comment))) {
14741         if (pluginHandleEndOfLineComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode) {
14742           // There is content before this comment on the same line, but
14743           // none after it, so prefer a trailing comment of the previous node.
14744           addTrailingComment$1(precedingNode, comment);
14745         } else if (followingNode) {
14746           addLeadingComment$1(followingNode, comment);
14747         } else if (enclosingNode) {
14748           addDanglingComment$1(enclosingNode, comment);
14749         } else {
14750           // There are no nodes, let's attach it to the root of the ast
14751
14752           /* istanbul ignore next */
14753           addDanglingComment$1(ast, comment);
14754         }
14755       } else {
14756         if (pluginHandleRemainingComment(comment, text, options, ast, isLastComment)) ; else if (precedingNode && followingNode) {
14757           // Otherwise, text exists both before and after the comment on
14758           // the same line. If there is both a preceding and following
14759           // node, use a tie-breaking algorithm to determine if it should
14760           // be attached to the next or previous node. In the last case,
14761           // simply attach the right node;
14762           var tieCount = tiesToBreak.length;
14763
14764           if (tieCount > 0) {
14765             var lastTie = tiesToBreak[tieCount - 1];
14766
14767             if (lastTie.followingNode !== comment.followingNode) {
14768               breakTies(tiesToBreak, text, options);
14769             }
14770           }
14771
14772           tiesToBreak.push(comment);
14773         } else if (precedingNode) {
14774           addTrailingComment$1(precedingNode, comment);
14775         } else if (followingNode) {
14776           addLeadingComment$1(followingNode, comment);
14777         } else if (enclosingNode) {
14778           addDanglingComment$1(enclosingNode, comment);
14779         } else {
14780           // There are no nodes, let's attach it to the root of the ast
14781
14782           /* istanbul ignore next */
14783           addDanglingComment$1(ast, comment);
14784         }
14785       }
14786     });
14787     breakTies(tiesToBreak, text, options);
14788     comments.forEach(function (comment) {
14789       // These node references were useful for breaking ties, but we
14790       // don't need them anymore, and they create cycles in the AST that
14791       // may lead to infinite recursion if we don't delete them here.
14792       delete comment.precedingNode;
14793       delete comment.enclosingNode;
14794       delete comment.followingNode;
14795     });
14796   }
14797
14798   function breakTies(tiesToBreak, text, options) {
14799     var tieCount = tiesToBreak.length;
14800
14801     if (tieCount === 0) {
14802       return;
14803     }
14804
14805     var _tiesToBreak$ = tiesToBreak[0],
14806         precedingNode = _tiesToBreak$.precedingNode,
14807         followingNode = _tiesToBreak$.followingNode;
14808     var gapEndPos = options.locStart(followingNode); // Iterate backwards through tiesToBreak, examining the gaps
14809     // between the tied comments. In order to qualify as leading, a
14810     // comment must be separated from followingNode by an unbroken series of
14811     // gaps (or other comments). Gaps should only contain whitespace or open
14812     // parentheses.
14813
14814     var indexOfFirstLeadingComment;
14815
14816     for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
14817       var comment = tiesToBreak[indexOfFirstLeadingComment - 1];
14818       assert.strictEqual(comment.precedingNode, precedingNode);
14819       assert.strictEqual(comment.followingNode, followingNode);
14820       var gap = text.slice(options.locEnd(comment), gapEndPos);
14821
14822       if (/^[\s(]*$/.test(gap)) {
14823         gapEndPos = options.locStart(comment);
14824       } else {
14825         // The gap string contained something other than whitespace or open
14826         // parentheses.
14827         break;
14828       }
14829     }
14830
14831     tiesToBreak.forEach(function (comment, i) {
14832       if (i < indexOfFirstLeadingComment) {
14833         addTrailingComment$1(precedingNode, comment);
14834       } else {
14835         addLeadingComment$1(followingNode, comment);
14836       }
14837     });
14838     tiesToBreak.length = 0;
14839   }
14840
14841   function printComment(commentPath, options) {
14842     var comment = commentPath.getValue();
14843     comment.printed = true;
14844     return options.printer.printComment(commentPath, options);
14845   }
14846
14847   function findExpressionIndexForComment(quasis, comment, options) {
14848     var startPos = options.locStart(comment) - 1;
14849
14850     for (var i = 1; i < quasis.length; ++i) {
14851       if (startPos < getQuasiRange(quasis[i]).start) {
14852         return i - 1;
14853       }
14854     } // We haven't found it, it probably means that some of the locations are off.
14855     // Let's just return the first one.
14856
14857     /* istanbul ignore next */
14858
14859
14860     return 0;
14861   }
14862
14863   function getQuasiRange(expr) {
14864     if (expr.start !== undefined) {
14865       // Babel
14866       return {
14867         start: expr.start,
14868         end: expr.end
14869       };
14870     } // Flow
14871
14872
14873     return {
14874       start: expr.range[0],
14875       end: expr.range[1]
14876     };
14877   }
14878
14879   function printLeadingComment(commentPath, print, options) {
14880     var comment = commentPath.getValue();
14881     var contents = printComment(commentPath, options);
14882
14883     if (!contents) {
14884       return "";
14885     }
14886
14887     var isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // Leading block comments should see if they need to stay on the
14888     // same line or not.
14889
14890     if (isBlock) {
14891       return concat$2([contents, hasNewline$1(options.originalText, options.locEnd(comment)) ? hardline$1 : " "]);
14892     }
14893
14894     return concat$2([contents, hardline$1]);
14895   }
14896
14897   function printTrailingComment(commentPath, print, options) {
14898     var comment = commentPath.getValue();
14899     var contents = printComment(commentPath, options);
14900
14901     if (!contents) {
14902       return "";
14903     }
14904
14905     var isBlock = options.printer.isBlockComment && options.printer.isBlockComment(comment); // We don't want the line to break
14906     // when the parentParentNode is a ClassDeclaration/-Expression
14907     // And the parentNode is in the superClass property
14908
14909     var parentNode = commentPath.getNode(1);
14910     var parentParentNode = commentPath.getNode(2);
14911     var isParentSuperClass = parentParentNode && (parentParentNode.type === "ClassDeclaration" || parentParentNode.type === "ClassExpression") && parentParentNode.superClass === parentNode;
14912
14913     if (hasNewline$1(options.originalText, options.locStart(comment), {
14914       backwards: true
14915     })) {
14916       // This allows comments at the end of nested structures:
14917       // {
14918       //   x: 1,
14919       //   y: 2
14920       //   // A comment
14921       // }
14922       // Those kinds of comments are almost always leading comments, but
14923       // here it doesn't go "outside" the block and turns it into a
14924       // trailing comment for `2`. We can simulate the above by checking
14925       // if this a comment on its own line; normal trailing comments are
14926       // always at the end of another expression.
14927       var isLineBeforeEmpty = isPreviousLineEmpty$2(options.originalText, comment, options.locStart);
14928       return lineSuffix$1(concat$2([hardline$1, isLineBeforeEmpty ? hardline$1 : "", contents]));
14929     } else if (isBlock || isParentSuperClass) {
14930       // Trailing block comments never need a newline
14931       return concat$2([" ", contents]);
14932     }
14933
14934     return concat$2([lineSuffix$1(concat$2([" ", contents])), !isBlock ? breakParent$1 : ""]);
14935   }
14936
14937   function printDanglingComments(path, options, sameIndent, filter) {
14938     var parts = [];
14939     var node = path.getValue();
14940
14941     if (!node || !node.comments) {
14942       return "";
14943     }
14944
14945     path.each(function (commentPath) {
14946       var comment = commentPath.getValue();
14947
14948       if (comment && !comment.leading && !comment.trailing && (!filter || filter(comment))) {
14949         parts.push(printComment(commentPath, options));
14950       }
14951     }, "comments");
14952
14953     if (parts.length === 0) {
14954       return "";
14955     }
14956
14957     if (sameIndent) {
14958       return join$1(hardline$1, parts);
14959     }
14960
14961     return indent$1(concat$2([hardline$1, join$1(hardline$1, parts)]));
14962   }
14963
14964   function prependCursorPlaceholder(path, options, printed) {
14965     if (path.getNode() === options.cursorNode && path.getValue()) {
14966       return concat$2([cursor$2, printed, cursor$2]);
14967     }
14968
14969     return printed;
14970   }
14971
14972   function printComments(path, print, options, needsSemi) {
14973     var value = path.getValue();
14974     var printed = print(path);
14975     var comments = value && value.comments;
14976
14977     if (!comments || comments.length === 0) {
14978       return prependCursorPlaceholder(path, options, printed);
14979     }
14980
14981     var leadingParts = [];
14982     var trailingParts = [needsSemi ? ";" : "", printed];
14983     path.each(function (commentPath) {
14984       var comment = commentPath.getValue();
14985       var leading = comment.leading,
14986           trailing = comment.trailing;
14987
14988       if (leading) {
14989         var contents = printLeadingComment(commentPath, print, options);
14990
14991         if (!contents) {
14992           return;
14993         }
14994
14995         leadingParts.push(contents);
14996         var text = options.originalText;
14997         var index = skipNewline$1(text, options.locEnd(comment));
14998
14999         if (index !== false && hasNewline$1(text, index)) {
15000           leadingParts.push(hardline$1);
15001         }
15002       } else if (trailing) {
15003         trailingParts.push(printTrailingComment(commentPath, print, options));
15004       }
15005     }, "comments");
15006     return prependCursorPlaceholder(path, options, concat$2(leadingParts.concat(trailingParts)));
15007   }
15008
15009   var comments = {
15010     attach: attach,
15011     printComments: printComments,
15012     printDanglingComments: printDanglingComments,
15013     getSortedChildNodes: getSortedChildNodes
15014   };
15015
15016   function FastPath(value) {
15017     assert.ok(this instanceof FastPath);
15018     this.stack = [value];
15019   } // The name of the current property is always the penultimate element of
15020   // this.stack, and always a String.
15021
15022
15023   FastPath.prototype.getName = function getName() {
15024     var s = this.stack;
15025     var len = s.length;
15026
15027     if (len > 1) {
15028       return s[len - 2];
15029     } // Since the name is always a string, null is a safe sentinel value to
15030     // return if we do not know the name of the (root) value.
15031
15032     /* istanbul ignore next */
15033
15034
15035     return null;
15036   }; // The value of the current property is always the final element of
15037   // this.stack.
15038
15039
15040   FastPath.prototype.getValue = function getValue() {
15041     var s = this.stack;
15042     return s[s.length - 1];
15043   };
15044
15045   function getNodeHelper(path, count) {
15046     var stackIndex = getNodeStackIndexHelper(path.stack, count);
15047     return stackIndex === -1 ? null : path.stack[stackIndex];
15048   }
15049
15050   function getNodeStackIndexHelper(stack, count) {
15051     for (var i = stack.length - 1; i >= 0; i -= 2) {
15052       var value = stack[i];
15053
15054       if (value && !Array.isArray(value) && --count < 0) {
15055         return i;
15056       }
15057     }
15058
15059     return -1;
15060   }
15061
15062   FastPath.prototype.getNode = function getNode(count) {
15063     return getNodeHelper(this, ~~count);
15064   };
15065
15066   FastPath.prototype.getParentNode = function getParentNode(count) {
15067     return getNodeHelper(this, ~~count + 1);
15068   }; // Temporarily push properties named by string arguments given after the
15069   // callback function onto this.stack, then call the callback with a
15070   // reference to this (modified) FastPath object. Note that the stack will
15071   // be restored to its original state after the callback is finished, so it
15072   // is probably a mistake to retain a reference to the path.
15073
15074
15075   FastPath.prototype.call = function call(callback
15076   /*, name1, name2, ... */
15077   ) {
15078     var s = this.stack;
15079     var origLen = s.length;
15080     var value = s[origLen - 1];
15081     var argc = arguments.length;
15082
15083     for (var i = 1; i < argc; ++i) {
15084       var name = arguments[i];
15085       value = value[name];
15086       s.push(name, value);
15087     }
15088
15089     var result = callback(this);
15090     s.length = origLen;
15091     return result;
15092   };
15093
15094   FastPath.prototype.callParent = function callParent(callback, count) {
15095     var stackIndex = getNodeStackIndexHelper(this.stack, ~~count + 1);
15096     var parentValues = this.stack.splice(stackIndex + 1);
15097     var result = callback(this);
15098     Array.prototype.push.apply(this.stack, parentValues);
15099     return result;
15100   }; // Similar to FastPath.prototype.call, except that the value obtained by
15101   // accessing this.getValue()[name1][name2]... should be array-like. The
15102   // callback will be called with a reference to this path object for each
15103   // element of the array.
15104
15105
15106   FastPath.prototype.each = function each(callback
15107   /*, name1, name2, ... */
15108   ) {
15109     var s = this.stack;
15110     var origLen = s.length;
15111     var value = s[origLen - 1];
15112     var argc = arguments.length;
15113
15114     for (var i = 1; i < argc; ++i) {
15115       var name = arguments[i];
15116       value = value[name];
15117       s.push(name, value);
15118     }
15119
15120     for (var _i = 0; _i < value.length; ++_i) {
15121       if (_i in value) {
15122         s.push(_i, value[_i]); // If the callback needs to know the value of i, call
15123         // path.getName(), assuming path is the parameter name.
15124
15125         callback(this);
15126         s.length -= 2;
15127       }
15128     }
15129
15130     s.length = origLen;
15131   }; // Similar to FastPath.prototype.each, except that the results of the
15132   // callback function invocations are stored in an array and returned at
15133   // the end of the iteration.
15134
15135
15136   FastPath.prototype.map = function map(callback
15137   /*, name1, name2, ... */
15138   ) {
15139     var s = this.stack;
15140     var origLen = s.length;
15141     var value = s[origLen - 1];
15142     var argc = arguments.length;
15143
15144     for (var i = 1; i < argc; ++i) {
15145       var name = arguments[i];
15146       value = value[name];
15147       s.push(name, value);
15148     }
15149
15150     var result = new Array(value.length);
15151
15152     for (var _i2 = 0; _i2 < value.length; ++_i2) {
15153       if (_i2 in value) {
15154         s.push(_i2, value[_i2]);
15155         result[_i2] = callback(this, _i2);
15156         s.length -= 2;
15157       }
15158     }
15159
15160     s.length = origLen;
15161     return result;
15162   };
15163
15164   var fastPath = FastPath;
15165
15166   var normalize$2 = options$1.normalize;
15167
15168   function printSubtree(path, print, options, printAstToDoc) {
15169     if (options.printer.embed) {
15170       return options.printer.embed(path, print, function (text, partialNextOptions) {
15171         return textToDoc(text, partialNextOptions, options, printAstToDoc);
15172       }, options);
15173     }
15174   }
15175
15176   function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc) {
15177     var nextOptions = normalize$2(Object.assign({}, parentOptions, partialNextOptions, {
15178       parentParser: parentOptions.parser,
15179       embeddedInHtml: !!(parentOptions.embeddedInHtml || parentOptions.parser === "html" || parentOptions.parser === "vue" || parentOptions.parser === "angular" || parentOptions.parser === "lwc"),
15180       originalText: text
15181     }), {
15182       passThrough: true
15183     });
15184     var result = parser.parse(text, nextOptions);
15185     var ast = result.ast;
15186     text = result.text;
15187     var astComments = ast.comments;
15188     delete ast.comments;
15189     comments.attach(astComments, ast, text, nextOptions);
15190     return printAstToDoc(ast, nextOptions);
15191   }
15192
15193   var multiparser = {
15194     printSubtree: printSubtree
15195   };
15196
15197   var doc$1 = doc;
15198   var docBuilders$1 = doc$1.builders;
15199   var concat$3 = docBuilders$1.concat;
15200   var hardline$2 = docBuilders$1.hardline;
15201   var addAlignmentToDoc$1 = docBuilders$1.addAlignmentToDoc;
15202   var docUtils$1 = doc$1.utils;
15203   /**
15204    * Takes an abstract syntax tree (AST) and recursively converts it to a
15205    * document (series of printing primitives).
15206    *
15207    * This is done by descending down the AST recursively. The recursion
15208    * involves two functions that call each other:
15209    *
15210    * 1. printGenerically(), which is defined as an inner function here.
15211    *    It basically takes care of node caching.
15212    * 2. callPluginPrintFunction(), which checks for some options, and
15213    *    ultimately calls the print() function provided by the plugin.
15214    *
15215    * The plugin function will call printGenerically() again for child nodes
15216    * of the current node, which will do its housekeeping, then call the
15217    * plugin function again, and so on.
15218    *
15219    * All the while, these functions pass a "path" variable around, which
15220    * is a stack-like data structure (FastPath) that maintains the current
15221    * state of the recursion. It is called "path", because it represents
15222    * the path to the current node through the Abstract Syntax Tree.
15223    */
15224
15225   function printAstToDoc(ast, options) {
15226     var alignmentSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
15227     var printer = options.printer;
15228
15229     if (printer.preprocess) {
15230       ast = printer.preprocess(ast, options);
15231     }
15232
15233     var cache = new Map();
15234
15235     function printGenerically(path, args) {
15236       var node = path.getValue();
15237       var shouldCache = node && _typeof(node) === "object" && args === undefined;
15238
15239       if (shouldCache && cache.has(node)) {
15240         return cache.get(node);
15241       } // We let JSXElement print its comments itself because it adds () around
15242       // UnionTypeAnnotation has to align the child without the comments
15243
15244
15245       var res;
15246
15247       if (printer.willPrintOwnComments && printer.willPrintOwnComments(path, options)) {
15248         res = callPluginPrintFunction(path, options, printGenerically, args);
15249       } else {
15250         // printComments will call the plugin print function and check for
15251         // comments to print
15252         res = comments.printComments(path, function (p) {
15253           return callPluginPrintFunction(p, options, printGenerically, args);
15254         }, options, args && args.needsSemi);
15255       }
15256
15257       if (shouldCache) {
15258         cache.set(node, res);
15259       }
15260
15261       return res;
15262     }
15263
15264     var doc = printGenerically(new fastPath(ast));
15265
15266     if (alignmentSize > 0) {
15267       // Add a hardline to make the indents take effect
15268       // It should be removed in index.js format()
15269       doc = addAlignmentToDoc$1(concat$3([hardline$2, doc]), alignmentSize, options.tabWidth);
15270     }
15271
15272     docUtils$1.propagateBreaks(doc);
15273     return doc;
15274   }
15275
15276   function callPluginPrintFunction(path, options, printPath, args) {
15277     assert.ok(path instanceof fastPath);
15278     var node = path.getValue();
15279     var printer = options.printer; // Escape hatch
15280
15281     if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
15282       return options.originalText.slice(options.locStart(node), options.locEnd(node));
15283     }
15284
15285     if (node) {
15286       try {
15287         // Potentially switch to a different parser
15288         var sub = multiparser.printSubtree(path, printPath, options, printAstToDoc);
15289
15290         if (sub) {
15291           return sub;
15292         }
15293       } catch (error) {
15294         /* istanbul ignore if */
15295         if (commonjsGlobal.PRETTIER_DEBUG) {
15296           throw error;
15297         } // Continue with current parser
15298
15299       }
15300     }
15301
15302     return printer.print(path, options, printPath, args);
15303   }
15304
15305   var astToDoc = printAstToDoc;
15306
15307   function findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts) {
15308     var resultStartNode = startNodeAndParents.node;
15309     var resultEndNode = endNodeAndParents.node;
15310
15311     if (resultStartNode === resultEndNode) {
15312       return {
15313         startNode: resultStartNode,
15314         endNode: resultEndNode
15315       };
15316     }
15317
15318     var _iteratorNormalCompletion = true;
15319     var _didIteratorError = false;
15320     var _iteratorError = undefined;
15321
15322     try {
15323       for (var _iterator = endNodeAndParents.parentNodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
15324         var endParent = _step.value;
15325
15326         if (endParent.type !== "Program" && endParent.type !== "File" && opts.locStart(endParent) >= opts.locStart(startNodeAndParents.node)) {
15327           resultEndNode = endParent;
15328         } else {
15329           break;
15330         }
15331       }
15332     } catch (err) {
15333       _didIteratorError = true;
15334       _iteratorError = err;
15335     } finally {
15336       try {
15337         if (!_iteratorNormalCompletion && _iterator.return != null) {
15338           _iterator.return();
15339         }
15340       } finally {
15341         if (_didIteratorError) {
15342           throw _iteratorError;
15343         }
15344       }
15345     }
15346
15347     var _iteratorNormalCompletion2 = true;
15348     var _didIteratorError2 = false;
15349     var _iteratorError2 = undefined;
15350
15351     try {
15352       for (var _iterator2 = startNodeAndParents.parentNodes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
15353         var startParent = _step2.value;
15354
15355         if (startParent.type !== "Program" && startParent.type !== "File" && opts.locEnd(startParent) <= opts.locEnd(endNodeAndParents.node)) {
15356           resultStartNode = startParent;
15357         } else {
15358           break;
15359         }
15360       }
15361     } catch (err) {
15362       _didIteratorError2 = true;
15363       _iteratorError2 = err;
15364     } finally {
15365       try {
15366         if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
15367           _iterator2.return();
15368         }
15369       } finally {
15370         if (_didIteratorError2) {
15371           throw _iteratorError2;
15372         }
15373       }
15374     }
15375
15376     return {
15377       startNode: resultStartNode,
15378       endNode: resultEndNode
15379     };
15380   }
15381
15382   function findNodeAtOffset(node, offset, options, predicate, parentNodes) {
15383     predicate = predicate || function () {
15384       return true;
15385     };
15386
15387     parentNodes = parentNodes || [];
15388     var start = options.locStart(node, options.locStart);
15389     var end = options.locEnd(node, options.locEnd);
15390
15391     if (start <= offset && offset <= end) {
15392       var _iteratorNormalCompletion3 = true;
15393       var _didIteratorError3 = false;
15394       var _iteratorError3 = undefined;
15395
15396       try {
15397         for (var _iterator3 = comments.getSortedChildNodes(node, options)[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
15398           var childNode = _step3.value;
15399           var childResult = findNodeAtOffset(childNode, offset, options, predicate, [node].concat(parentNodes));
15400
15401           if (childResult) {
15402             return childResult;
15403           }
15404         }
15405       } catch (err) {
15406         _didIteratorError3 = true;
15407         _iteratorError3 = err;
15408       } finally {
15409         try {
15410           if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
15411             _iterator3.return();
15412           }
15413         } finally {
15414           if (_didIteratorError3) {
15415             throw _iteratorError3;
15416           }
15417         }
15418       }
15419
15420       if (predicate(node)) {
15421         return {
15422           node: node,
15423           parentNodes: parentNodes
15424         };
15425       }
15426     }
15427   } // See https://www.ecma-international.org/ecma-262/5.1/#sec-A.5
15428
15429
15430   function isSourceElement(opts, node) {
15431     if (node == null) {
15432       return false;
15433     } // JS and JS like to avoid repetitions
15434
15435
15436     var jsSourceElements = ["FunctionDeclaration", "BlockStatement", "BreakStatement", "ContinueStatement", "DebuggerStatement", "DoWhileStatement", "EmptyStatement", "ExpressionStatement", "ForInStatement", "ForStatement", "IfStatement", "LabeledStatement", "ReturnStatement", "SwitchStatement", "ThrowStatement", "TryStatement", "VariableDeclaration", "WhileStatement", "WithStatement", "ClassDeclaration", // ES 2015
15437     "ImportDeclaration", // Module
15438     "ExportDefaultDeclaration", // Module
15439     "ExportNamedDeclaration", // Module
15440     "ExportAllDeclaration", // Module
15441     "TypeAlias", // Flow
15442     "InterfaceDeclaration", // Flow, TypeScript
15443     "TypeAliasDeclaration", // TypeScript
15444     "ExportAssignment", // TypeScript
15445     "ExportDeclaration" // TypeScript
15446     ];
15447     var jsonSourceElements = ["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral"];
15448     var graphqlSourceElements = ["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"];
15449
15450     switch (opts.parser) {
15451       case "flow":
15452       case "babel":
15453       case "typescript":
15454         return jsSourceElements.indexOf(node.type) > -1;
15455
15456       case "json":
15457         return jsonSourceElements.indexOf(node.type) > -1;
15458
15459       case "graphql":
15460         return graphqlSourceElements.indexOf(node.kind) > -1;
15461
15462       case "vue":
15463         return node.tag !== "root";
15464     }
15465
15466     return false;
15467   }
15468
15469   function calculateRange(text, opts, ast) {
15470     // Contract the range so that it has non-whitespace characters at its endpoints.
15471     // This ensures we can format a range that doesn't end on a node.
15472     var rangeStringOrig = text.slice(opts.rangeStart, opts.rangeEnd);
15473     var startNonWhitespace = Math.max(opts.rangeStart + rangeStringOrig.search(/\S/), opts.rangeStart);
15474     var endNonWhitespace;
15475
15476     for (endNonWhitespace = opts.rangeEnd; endNonWhitespace > opts.rangeStart; --endNonWhitespace) {
15477       if (text[endNonWhitespace - 1].match(/\S/)) {
15478         break;
15479       }
15480     }
15481
15482     var startNodeAndParents = findNodeAtOffset(ast, startNonWhitespace, opts, function (node) {
15483       return isSourceElement(opts, node);
15484     });
15485     var endNodeAndParents = findNodeAtOffset(ast, endNonWhitespace, opts, function (node) {
15486       return isSourceElement(opts, node);
15487     });
15488
15489     if (!startNodeAndParents || !endNodeAndParents) {
15490       return {
15491         rangeStart: 0,
15492         rangeEnd: 0
15493       };
15494     }
15495
15496     var siblingAncestors = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts);
15497     var startNode = siblingAncestors.startNode,
15498         endNode = siblingAncestors.endNode;
15499     var rangeStart = Math.min(opts.locStart(startNode, opts.locStart), opts.locStart(endNode, opts.locStart));
15500     var rangeEnd = Math.max(opts.locEnd(startNode, opts.locEnd), opts.locEnd(endNode, opts.locEnd));
15501     return {
15502       rangeStart: rangeStart,
15503       rangeEnd: rangeEnd
15504     };
15505   }
15506
15507   var rangeUtil = {
15508     calculateRange: calculateRange,
15509     findNodeAtOffset: findNodeAtOffset
15510   };
15511
15512   var diff = getCjsExportFromNamespace(index_es6);
15513
15514   var normalizeOptions$1 = options$1.normalize;
15515   var guessEndOfLine$1 = endOfLine.guessEndOfLine,
15516       convertEndOfLineToChars$2 = endOfLine.convertEndOfLineToChars;
15517   var mapDoc$2 = doc.utils.mapDoc,
15518       _printDocToString = doc.printer.printDocToString,
15519       printDocToDebug = doc.debug.printDocToDebug;
15520   var UTF8BOM = 0xfeff;
15521   var CURSOR = Symbol("cursor");
15522   var PLACEHOLDERS = {
15523     cursorOffset: "<<<PRETTIER_CURSOR>>>",
15524     rangeStart: "<<<PRETTIER_RANGE_START>>>",
15525     rangeEnd: "<<<PRETTIER_RANGE_END>>>"
15526   };
15527
15528   function ensureAllCommentsPrinted(astComments) {
15529     if (!astComments) {
15530       return;
15531     }
15532
15533     for (var i = 0; i < astComments.length; ++i) {
15534       if (astComments[i].value.trim() === "prettier-ignore") {
15535         // If there's a prettier-ignore, we're not printing that sub-tree so we
15536         // don't know if the comments was printed or not.
15537         return;
15538       }
15539     }
15540
15541     astComments.forEach(function (comment) {
15542       if (!comment.printed) {
15543         throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
15544       }
15545
15546       delete comment.printed;
15547     });
15548   }
15549
15550   function attachComments(text, ast, opts) {
15551     var astComments = ast.comments;
15552
15553     if (astComments) {
15554       delete ast.comments;
15555       comments.attach(astComments, ast, text, opts);
15556     }
15557
15558     ast.tokens = [];
15559     opts.originalText = opts.parser === "yaml" ? text : text.trimRight();
15560     return astComments;
15561   }
15562
15563   function coreFormat(text, opts, addAlignmentSize) {
15564     if (!text || !text.trim().length) {
15565       return {
15566         formatted: "",
15567         cursorOffset: 0
15568       };
15569     }
15570
15571     addAlignmentSize = addAlignmentSize || 0;
15572     var parsed = parser.parse(text, opts);
15573     var ast = parsed.ast;
15574     text = parsed.text;
15575
15576     if (opts.cursorOffset >= 0) {
15577       var nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
15578
15579       if (nodeResult && nodeResult.node) {
15580         opts.cursorNode = nodeResult.node;
15581       }
15582     }
15583
15584     var astComments = attachComments(text, ast, opts);
15585     var doc = astToDoc(ast, opts, addAlignmentSize);
15586     var eol = convertEndOfLineToChars$2(opts.endOfLine);
15587
15588     var result = _printDocToString(opts.endOfLine === "lf" ? doc : mapDoc$2(doc, function (currentDoc) {
15589       return typeof currentDoc === "string" && currentDoc.indexOf("\n") !== -1 ? currentDoc.replace(/\n/g, eol) : currentDoc;
15590     }), opts);
15591
15592     ensureAllCommentsPrinted(astComments); // Remove extra leading indentation as well as the added indentation after last newline
15593
15594     if (addAlignmentSize > 0) {
15595       var trimmed = result.formatted.trim();
15596
15597       if (result.cursorNodeStart !== undefined) {
15598         result.cursorNodeStart -= result.formatted.indexOf(trimmed);
15599       }
15600
15601       result.formatted = trimmed + convertEndOfLineToChars$2(opts.endOfLine);
15602     }
15603
15604     if (opts.cursorOffset >= 0) {
15605       var oldCursorNodeStart;
15606       var oldCursorNodeText;
15607       var cursorOffsetRelativeToOldCursorNode;
15608       var newCursorNodeStart;
15609       var newCursorNodeText;
15610
15611       if (opts.cursorNode && result.cursorNodeText) {
15612         oldCursorNodeStart = opts.locStart(opts.cursorNode);
15613         oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
15614         cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
15615         newCursorNodeStart = result.cursorNodeStart;
15616         newCursorNodeText = result.cursorNodeText;
15617       } else {
15618         oldCursorNodeStart = 0;
15619         oldCursorNodeText = text;
15620         cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
15621         newCursorNodeStart = 0;
15622         newCursorNodeText = result.formatted;
15623       }
15624
15625       if (oldCursorNodeText === newCursorNodeText) {
15626         return {
15627           formatted: result.formatted,
15628           cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode
15629         };
15630       } // diff old and new cursor node texts, with a special cursor
15631       // symbol inserted to find out where it moves to
15632
15633
15634       var oldCursorNodeCharArray = oldCursorNodeText.split("");
15635       oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
15636       var newCursorNodeCharArray = newCursorNodeText.split("");
15637       var cursorNodeDiff = diff.diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
15638       var cursorOffset = newCursorNodeStart;
15639       var _iteratorNormalCompletion = true;
15640       var _didIteratorError = false;
15641       var _iteratorError = undefined;
15642
15643       try {
15644         for (var _iterator = cursorNodeDiff[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
15645           var entry = _step.value;
15646
15647           if (entry.removed) {
15648             if (entry.value.indexOf(CURSOR) > -1) {
15649               break;
15650             }
15651           } else {
15652             cursorOffset += entry.count;
15653           }
15654         }
15655       } catch (err) {
15656         _didIteratorError = true;
15657         _iteratorError = err;
15658       } finally {
15659         try {
15660           if (!_iteratorNormalCompletion && _iterator.return != null) {
15661             _iterator.return();
15662           }
15663         } finally {
15664           if (_didIteratorError) {
15665             throw _iteratorError;
15666           }
15667         }
15668       }
15669
15670       return {
15671         formatted: result.formatted,
15672         cursorOffset: cursorOffset
15673       };
15674     }
15675
15676     return {
15677       formatted: result.formatted
15678     };
15679   }
15680
15681   function formatRange(text, opts) {
15682     var parsed = parser.parse(text, opts);
15683     var ast = parsed.ast;
15684     text = parsed.text;
15685     var range = rangeUtil.calculateRange(text, opts, ast);
15686     var rangeStart = range.rangeStart;
15687     var rangeEnd = range.rangeEnd;
15688     var rangeString = text.slice(rangeStart, rangeEnd); // Try to extend the range backwards to the beginning of the line.
15689     // This is so we can detect indentation correctly and restore it.
15690     // Use `Math.min` since `lastIndexOf` returns 0 when `rangeStart` is 0
15691
15692     var rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
15693     var indentString = text.slice(rangeStart2, rangeStart);
15694     var alignmentSize = util.getAlignmentSize(indentString, opts.tabWidth);
15695     var rangeResult = coreFormat(rangeString, Object.assign({}, opts, {
15696       rangeStart: 0,
15697       rangeEnd: Infinity,
15698       // track the cursor offset only if it's within our range
15699       cursorOffset: opts.cursorOffset >= rangeStart && opts.cursorOffset < rangeEnd ? opts.cursorOffset - rangeStart : -1
15700     }), alignmentSize); // Since the range contracts to avoid trailing whitespace,
15701     // we need to remove the newline that was inserted by the `format` call.
15702
15703     var rangeTrimmed = rangeResult.formatted.trimRight();
15704     var rangeLeft = text.slice(0, rangeStart);
15705     var rangeRight = text.slice(rangeEnd);
15706     var cursorOffset = opts.cursorOffset;
15707
15708     if (opts.cursorOffset >= rangeEnd) {
15709       // handle the case where the cursor was past the end of the range
15710       cursorOffset = opts.cursorOffset - rangeEnd + (rangeStart + rangeTrimmed.length);
15711     } else if (rangeResult.cursorOffset !== undefined) {
15712       // handle the case where the cursor was in the range
15713       cursorOffset = rangeResult.cursorOffset + rangeStart;
15714     } // keep the cursor as it was if it was before the start of the range
15715
15716
15717     var formatted;
15718
15719     if (opts.endOfLine === "lf") {
15720       formatted = rangeLeft + rangeTrimmed + rangeRight;
15721     } else {
15722       var eol = convertEndOfLineToChars$2(opts.endOfLine);
15723
15724       if (cursorOffset >= 0) {
15725         var parts = [rangeLeft, rangeTrimmed, rangeRight];
15726         var partIndex = 0;
15727         var partOffset = cursorOffset;
15728
15729         while (partIndex < parts.length) {
15730           var part = parts[partIndex];
15731
15732           if (partOffset < part.length) {
15733             parts[partIndex] = parts[partIndex].slice(0, partOffset) + PLACEHOLDERS.cursorOffset + parts[partIndex].slice(partOffset);
15734             break;
15735           }
15736
15737           partIndex++;
15738           partOffset -= part.length;
15739         }
15740
15741         var newRangeLeft = parts[0],
15742             newRangeTrimmed = parts[1],
15743             newRangeRight = parts[2];
15744         formatted = (newRangeLeft.replace(/\n/g, eol) + newRangeTrimmed + newRangeRight.replace(/\n/g, eol)).replace(PLACEHOLDERS.cursorOffset, function (_, index) {
15745           cursorOffset = index;
15746           return "";
15747         });
15748       } else {
15749         formatted = rangeLeft.replace(/\n/g, eol) + rangeTrimmed + rangeRight.replace(/\n/g, eol);
15750       }
15751     }
15752
15753     return {
15754       formatted: formatted,
15755       cursorOffset: cursorOffset
15756     };
15757   }
15758
15759   function format(text, opts) {
15760     var selectedParser = parser.resolveParser(opts);
15761     var hasPragma = !selectedParser.hasPragma || selectedParser.hasPragma(text);
15762
15763     if (opts.requirePragma && !hasPragma) {
15764       return {
15765         formatted: text
15766       };
15767     }
15768
15769     if (opts.endOfLine === "auto") {
15770       opts.endOfLine = guessEndOfLine$1(text);
15771     }
15772
15773     var hasCursor = opts.cursorOffset >= 0;
15774     var hasRangeStart = opts.rangeStart > 0;
15775     var hasRangeEnd = opts.rangeEnd < text.length; // get rid of CR/CRLF parsing
15776
15777     if (text.indexOf("\r") !== -1) {
15778       var offsetKeys = [hasCursor && "cursorOffset", hasRangeStart && "rangeStart", hasRangeEnd && "rangeEnd"].filter(Boolean).sort(function (aKey, bKey) {
15779         return opts[aKey] - opts[bKey];
15780       });
15781
15782       for (var i = offsetKeys.length - 1; i >= 0; i--) {
15783         var key = offsetKeys[i];
15784         text = text.slice(0, opts[key]) + PLACEHOLDERS[key] + text.slice(opts[key]);
15785       }
15786
15787       text = text.replace(/\r\n?/g, "\n");
15788
15789       var _loop = function _loop(_i) {
15790         var key = offsetKeys[_i];
15791         text = text.replace(PLACEHOLDERS[key], function (_, index) {
15792           opts[key] = index;
15793           return "";
15794         });
15795       };
15796
15797       for (var _i = 0; _i < offsetKeys.length; _i++) {
15798         _loop(_i);
15799       }
15800     }
15801
15802     var hasUnicodeBOM = text.charCodeAt(0) === UTF8BOM;
15803
15804     if (hasUnicodeBOM) {
15805       text = text.substring(1);
15806
15807       if (hasCursor) {
15808         opts.cursorOffset++;
15809       }
15810
15811       if (hasRangeStart) {
15812         opts.rangeStart++;
15813       }
15814
15815       if (hasRangeEnd) {
15816         opts.rangeEnd++;
15817       }
15818     }
15819
15820     if (!hasCursor) {
15821       opts.cursorOffset = -1;
15822     }
15823
15824     if (opts.rangeStart < 0) {
15825       opts.rangeStart = 0;
15826     }
15827
15828     if (opts.rangeEnd > text.length) {
15829       opts.rangeEnd = text.length;
15830     }
15831
15832     var result = hasRangeStart || hasRangeEnd ? formatRange(text, opts) : coreFormat(opts.insertPragma && opts.printer.insertPragma && !hasPragma ? opts.printer.insertPragma(text) : text, opts);
15833
15834     if (hasUnicodeBOM) {
15835       result.formatted = String.fromCharCode(UTF8BOM) + result.formatted;
15836
15837       if (hasCursor) {
15838         result.cursorOffset++;
15839       }
15840     }
15841
15842     return result;
15843   }
15844
15845   var core = {
15846     formatWithCursor: function formatWithCursor(text, opts) {
15847       opts = normalizeOptions$1(opts);
15848       return format(text, opts);
15849     },
15850     parse: function parse(text, opts, massage) {
15851       opts = normalizeOptions$1(opts);
15852
15853       if (text.indexOf("\r") !== -1) {
15854         text = text.replace(/\r\n?/g, "\n");
15855       }
15856
15857       var parsed = parser.parse(text, opts);
15858
15859       if (massage) {
15860         parsed.ast = massageAst(parsed.ast, opts);
15861       }
15862
15863       return parsed;
15864     },
15865     formatAST: function formatAST(ast, opts) {
15866       opts = normalizeOptions$1(opts);
15867       var doc = astToDoc(ast, opts);
15868       return _printDocToString(doc, opts);
15869     },
15870     // Doesn't handle shebang for now
15871     formatDoc: function formatDoc(doc, opts) {
15872       var debug = printDocToDebug(doc);
15873       opts = normalizeOptions$1(Object.assign({}, opts, {
15874         parser: "babel"
15875       }));
15876       return format(debug, opts).formatted;
15877     },
15878     printToDoc: function printToDoc(text, opts) {
15879       opts = normalizeOptions$1(opts);
15880       var parsed = parser.parse(text, opts);
15881       var ast = parsed.ast;
15882       text = parsed.text;
15883       attachComments(text, ast, opts);
15884       return astToDoc(ast, opts);
15885     },
15886     printDocToString: function printDocToString(doc, opts) {
15887       return _printDocToString(doc, normalizeOptions$1(opts));
15888     }
15889   };
15890
15891   var index = [
15892         "a",
15893         "abbr",
15894         "acronym",
15895         "address",
15896         "applet",
15897         "area",
15898         "article",
15899         "aside",
15900         "audio",
15901         "b",
15902         "base",
15903         "basefont",
15904         "bdi",
15905         "bdo",
15906         "bgsound",
15907         "big",
15908         "blink",
15909         "blockquote",
15910         "body",
15911         "br",
15912         "button",
15913         "canvas",
15914         "caption",
15915         "center",
15916         "cite",
15917         "code",
15918         "col",
15919         "colgroup",
15920         "command",
15921         "content",
15922         "data",
15923         "datalist",
15924         "dd",
15925         "del",
15926         "details",
15927         "dfn",
15928         "dialog",
15929         "dir",
15930         "div",
15931         "dl",
15932         "dt",
15933         "element",
15934         "em",
15935         "embed",
15936         "fieldset",
15937         "figcaption",
15938         "figure",
15939         "font",
15940         "footer",
15941         "form",
15942         "frame",
15943         "frameset",
15944         "h1",
15945         "h2",
15946         "h3",
15947         "h4",
15948         "h5",
15949         "h6",
15950         "head",
15951         "header",
15952         "hgroup",
15953         "hr",
15954         "html",
15955         "i",
15956         "iframe",
15957         "image",
15958         "img",
15959         "input",
15960         "ins",
15961         "isindex",
15962         "kbd",
15963         "keygen",
15964         "label",
15965         "legend",
15966         "li",
15967         "link",
15968         "listing",
15969         "main",
15970         "map",
15971         "mark",
15972         "marquee",
15973         "math",
15974         "menu",
15975         "menuitem",
15976         "meta",
15977         "meter",
15978         "multicol",
15979         "nav",
15980         "nextid",
15981         "nobr",
15982         "noembed",
15983         "noframes",
15984         "noscript",
15985         "object",
15986         "ol",
15987         "optgroup",
15988         "option",
15989         "output",
15990         "p",
15991         "param",
15992         "picture",
15993         "plaintext",
15994         "pre",
15995         "progress",
15996         "q",
15997         "rb",
15998         "rbc",
15999         "rp",
16000         "rt",
16001         "rtc",
16002         "ruby",
16003         "s",
16004         "samp",
16005         "script",
16006         "section",
16007         "select",
16008         "shadow",
16009         "slot",
16010         "small",
16011         "source",
16012         "spacer",
16013         "span",
16014         "strike",
16015         "strong",
16016         "style",
16017         "sub",
16018         "summary",
16019         "sup",
16020         "svg",
16021         "table",
16022         "tbody",
16023         "td",
16024         "template",
16025         "textarea",
16026         "tfoot",
16027         "th",
16028         "thead",
16029         "time",
16030         "title",
16031         "tr",
16032         "track",
16033         "tt",
16034         "u",
16035         "ul",
16036         "var",
16037         "video",
16038         "wbr",
16039         "xmp"
16040   ];
16041
16042   var htmlTagNames = /*#__PURE__*/Object.freeze({
16043     __proto__: null,
16044     'default': index
16045   });
16046
16047   var htmlTagNames$1 = getCjsExportFromNamespace(htmlTagNames);
16048
16049   function clean(ast, newObj, parent) {
16050     ["raw", // front-matter
16051     "raws", "sourceIndex", "source", "before", "after", "trailingComma"].forEach(function (name) {
16052       delete newObj[name];
16053     });
16054
16055     if (ast.type === "yaml") {
16056       delete newObj.value;
16057     } // --insert-pragma
16058
16059
16060     if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length !== 0 && ( // first non-front-matter comment
16061     parent.nodes[0] === ast || (parent.nodes[0].type === "yaml" || parent.nodes[0].type === "toml") && parent.nodes[1] === ast)) {
16062       /**
16063        * something
16064        *
16065        * @format
16066        */
16067       delete newObj.text; // standalone pragma
16068
16069       if (/^\*\s*@(format|prettier)\s*$/.test(ast.text)) {
16070         return null;
16071       }
16072     }
16073
16074     if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
16075       delete newObj.value;
16076     }
16077
16078     if (ast.type === "css-rule") {
16079       delete newObj.params;
16080     }
16081
16082     if (ast.type === "selector-combinator") {
16083       newObj.value = newObj.value.replace(/\s+/g, " ");
16084     }
16085
16086     if (ast.type === "media-feature") {
16087       newObj.value = newObj.value.replace(/ /g, "");
16088     }
16089
16090     if (ast.type === "value-word" && (ast.isColor && ast.isHex || ["initial", "inherit", "unset", "revert"].indexOf(newObj.value.replace().toLowerCase()) !== -1) || ast.type === "media-feature" || ast.type === "selector-root-invalid" || ast.type === "selector-pseudo") {
16091       newObj.value = newObj.value.toLowerCase();
16092     }
16093
16094     if (ast.type === "css-decl") {
16095       newObj.prop = newObj.prop.toLowerCase();
16096     }
16097
16098     if (ast.type === "css-atrule" || ast.type === "css-import") {
16099       newObj.name = newObj.name.toLowerCase();
16100     }
16101
16102     if (ast.type === "value-number") {
16103       newObj.unit = newObj.unit.toLowerCase();
16104     }
16105
16106     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) {
16107       newObj.value = cleanCSSStrings(newObj.value);
16108     }
16109
16110     if (ast.type === "selector-attribute") {
16111       newObj.attribute = newObj.attribute.trim();
16112
16113       if (newObj.namespace) {
16114         if (typeof newObj.namespace === "string") {
16115           newObj.namespace = newObj.namespace.trim();
16116
16117           if (newObj.namespace.length === 0) {
16118             newObj.namespace = true;
16119           }
16120         }
16121       }
16122
16123       if (newObj.value) {
16124         newObj.value = newObj.value.trim().replace(/^['"]|['"]$/g, "");
16125         delete newObj.quoted;
16126       }
16127     }
16128
16129     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) {
16130       newObj.value = newObj.value.replace(/([\d.eE+-]+)([a-zA-Z]*)/g, function (match, numStr, unit) {
16131         var num = Number(numStr);
16132         return isNaN(num) ? match : num + unit.toLowerCase();
16133       });
16134     }
16135
16136     if (ast.type === "selector-tag") {
16137       var lowercasedValue = ast.value.toLowerCase();
16138
16139       if (htmlTagNames$1.indexOf(lowercasedValue) !== -1) {
16140         newObj.value = lowercasedValue;
16141       }
16142
16143       if (["from", "to"].indexOf(lowercasedValue) !== -1) {
16144         newObj.value = lowercasedValue;
16145       }
16146     } // Workaround when `postcss-values-parser` parse `not`, `and` or `or` keywords as `value-func`
16147
16148
16149     if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
16150       delete newObj.value;
16151     } // Workaround for SCSS nested properties
16152
16153
16154     if (ast.type === "selector-unknown") {
16155       delete newObj.value;
16156     }
16157   }
16158
16159   function cleanCSSStrings(value) {
16160     return value.replace(/'/g, '"').replace(/\\([^a-fA-F\d])/g, "$1");
16161   }
16162
16163   var clean_1 = clean;
16164
16165   var _require$$0$builders$1 = doc.builders,
16166       hardline$3 = _require$$0$builders$1.hardline,
16167       literalline$1 = _require$$0$builders$1.literalline,
16168       concat$4 = _require$$0$builders$1.concat,
16169       markAsRoot$1 = _require$$0$builders$1.markAsRoot,
16170       mapDoc$3 = doc.utils.mapDoc;
16171
16172   function embed(path, print, textToDoc
16173   /*, options */
16174   ) {
16175     var node = path.getValue();
16176
16177     if (node.type === "yaml") {
16178       return markAsRoot$1(concat$4(["---", hardline$3, node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
16179         parser: "yaml"
16180       })) : "", "---", hardline$3]));
16181     }
16182
16183     return null;
16184
16185     function replaceNewlinesWithLiterallines(doc) {
16186       return mapDoc$3(doc, function (currentDoc) {
16187         return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$4(currentDoc.split(/(\n)/g).map(function (v, i) {
16188           return i % 2 === 0 ? v : literalline$1;
16189         })) : currentDoc;
16190       });
16191     }
16192   }
16193
16194   var embed_1 = embed;
16195
16196   var detectNewline = createCommonjsModule(function (module) {
16197
16198     module.exports = function (str) {
16199       if (typeof str !== 'string') {
16200         throw new TypeError('Expected a string');
16201       }
16202
16203       var newlines = str.match(/(?:\r?\n)/g) || [];
16204
16205       if (newlines.length === 0) {
16206         return null;
16207       }
16208
16209       var crlf = newlines.filter(function (el) {
16210         return el === '\r\n';
16211       }).length;
16212       var lf = newlines.length - crlf;
16213       return crlf > lf ? '\r\n' : '\n';
16214     };
16215
16216     module.exports.graceful = function (str) {
16217       return module.exports(str) || '\n';
16218     };
16219   });
16220   var detectNewline_1 = detectNewline.graceful;
16221
16222   var build = createCommonjsModule(function (module, exports) {
16223
16224     Object.defineProperty(exports, '__esModule', {
16225       value: true
16226     });
16227     exports.extract = extract;
16228     exports.strip = strip;
16229     exports.parse = parse;
16230     exports.parseWithComments = parseWithComments;
16231     exports.print = print;
16232
16233     function _os() {
16234       var data = require$$0$1;
16235
16236       _os = function _os() {
16237         return data;
16238       };
16239
16240       return data;
16241     }
16242
16243     function _detectNewline() {
16244       var data = _interopRequireDefault(detectNewline);
16245
16246       _detectNewline = function _detectNewline() {
16247         return data;
16248       };
16249
16250       return data;
16251     }
16252
16253     function _interopRequireDefault(obj) {
16254       return obj && obj.__esModule ? obj : {
16255         default: obj
16256       };
16257     }
16258     /**
16259      * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
16260      *
16261      * This source code is licensed under the MIT license found in the
16262      * LICENSE file in the root directory of this source tree.
16263      */
16264
16265
16266     var commentEndRe = /\*\/$/;
16267     var commentStartRe = /^\/\*\*/;
16268     var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
16269     var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
16270     var ltrimNewlineRe = /^(\r?\n)+/;
16271     var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
16272     var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
16273     var stringStartRe = /(\r?\n|^) *\* ?/g;
16274
16275     function extract(contents) {
16276       var match = contents.match(docblockRe);
16277       return match ? match[0].trimLeft() : '';
16278     }
16279
16280     function strip(contents) {
16281       var match = contents.match(docblockRe);
16282       return match && match[0] ? contents.substring(match[0].length) : contents;
16283     }
16284
16285     function parse(docblock) {
16286       return parseWithComments(docblock).pragmas;
16287     }
16288
16289     function parseWithComments(docblock) {
16290       var line = (0, _detectNewline().default)(docblock) || _os().EOL;
16291
16292       docblock = docblock.replace(commentStartRe, '').replace(commentEndRe, '').replace(stringStartRe, '$1'); // Normalize multi-line directives
16293
16294       var prev = '';
16295
16296       while (prev !== docblock) {
16297         prev = docblock;
16298         docblock = docblock.replace(multilineRe, "".concat(line, "$1 $2").concat(line));
16299       }
16300
16301       docblock = docblock.replace(ltrimNewlineRe, '').trimRight();
16302       var result = Object.create(null);
16303       var comments = docblock.replace(propertyRe, '').replace(ltrimNewlineRe, '').trimRight();
16304       var match;
16305
16306       while (match = propertyRe.exec(docblock)) {
16307         // strip linecomments from pragmas
16308         var nextPragma = match[2].replace(lineCommentRe, '');
16309
16310         if (typeof result[match[1]] === 'string' || Array.isArray(result[match[1]])) {
16311           result[match[1]] = [].concat(result[match[1]], nextPragma);
16312         } else {
16313           result[match[1]] = nextPragma;
16314         }
16315       }
16316
16317       return {
16318         comments: comments,
16319         pragmas: result
16320       };
16321     }
16322
16323     function print(_ref) {
16324       var _ref$comments = _ref.comments,
16325           comments = _ref$comments === void 0 ? '' : _ref$comments,
16326           _ref$pragmas = _ref.pragmas,
16327           pragmas = _ref$pragmas === void 0 ? {} : _ref$pragmas;
16328
16329       var line = (0, _detectNewline().default)(comments) || _os().EOL;
16330
16331       var head = '/**';
16332       var start = ' *';
16333       var tail = ' */';
16334       var keys = Object.keys(pragmas);
16335       var printedObject = keys.map(function (key) {
16336         return printKeyValues(key, pragmas[key]);
16337       }).reduce(function (arr, next) {
16338         return arr.concat(next);
16339       }, []).map(function (keyValue) {
16340         return start + ' ' + keyValue + line;
16341       }).join('');
16342
16343       if (!comments) {
16344         if (keys.length === 0) {
16345           return '';
16346         }
16347
16348         if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
16349           var value = pragmas[keys[0]];
16350           return "".concat(head, " ").concat(printKeyValues(keys[0], value)[0]).concat(tail);
16351         }
16352       }
16353
16354       var printedComments = comments.split(line).map(function (textLine) {
16355         return "".concat(start, " ").concat(textLine);
16356       }).join(line) + line;
16357       return head + line + (comments ? printedComments : '') + (comments && keys.length ? start + line : '') + printedObject + tail;
16358     }
16359
16360     function printKeyValues(key, valueOrArray) {
16361       return [].concat(valueOrArray).map(function (value) {
16362         return "@".concat(key, " ").concat(value).trim();
16363       });
16364     }
16365   });
16366   unwrapExports(build);
16367   var build_1 = build.extract;
16368   var build_2 = build.strip;
16369   var build_3 = build.parse;
16370   var build_4 = build.parseWithComments;
16371   var build_5 = build.print;
16372
16373   function hasPragma(text) {
16374     var pragmas = Object.keys(build.parse(build.extract(text)));
16375     return pragmas.indexOf("prettier") !== -1 || pragmas.indexOf("format") !== -1;
16376   }
16377
16378   function insertPragma(text) {
16379     var parsedDocblock = build.parseWithComments(build.extract(text));
16380     var pragmas = Object.assign({
16381       format: ""
16382     }, parsedDocblock.pragmas);
16383     var newDocblock = build.print({
16384       pragmas: pragmas,
16385       comments: parsedDocblock.comments.replace(/^(\s+?\r?\n)+/, "") // remove leading newlines
16386
16387     }).replace(/(\r\n|\r)/g, "\n"); // normalise newlines (mitigate use of os.EOL by jest-docblock)
16388
16389     var strippedText = build.strip(text);
16390     var separatingNewlines = strippedText.startsWith("\n") ? "\n" : "\n\n";
16391     return newDocblock + separatingNewlines + strippedText;
16392   }
16393
16394   var pragma = {
16395     hasPragma: hasPragma,
16396     insertPragma: insertPragma
16397   };
16398
16399   var DELIMITER_MAP = {
16400     "---": "yaml",
16401     "+++": "toml"
16402   };
16403
16404   function parse$1(text) {
16405     var delimiterRegex = Object.keys(DELIMITER_MAP).map(escapeStringRegexp).join("|");
16406     var match = text.match( // trailing spaces after delimiters are allowed
16407     new RegExp("^(".concat(delimiterRegex, ")[^\\n\\S]*\\n(?:([\\s\\S]*?)\\n)?\\1[^\\n\\S]*(\\n|$)")));
16408
16409     if (match === null) {
16410       return {
16411         frontMatter: null,
16412         content: text
16413       };
16414     }
16415
16416     var raw = match[0].replace(/\n$/, "");
16417     var delimiter = match[1];
16418     var value = match[2];
16419     return {
16420       frontMatter: {
16421         type: DELIMITER_MAP[delimiter],
16422         value: value,
16423         raw: raw
16424       },
16425       content: match[0].replace(/[^\n]/g, " ") + text.slice(match[0].length)
16426     };
16427   }
16428
16429   var frontMatter = parse$1;
16430
16431   function hasPragma$1(text) {
16432     return pragma.hasPragma(frontMatter(text).content);
16433   }
16434
16435   function insertPragma$1(text) {
16436     var _parseFrontMatter = frontMatter(text),
16437         frontMatter$1 = _parseFrontMatter.frontMatter,
16438         content = _parseFrontMatter.content;
16439
16440     return (frontMatter$1 ? frontMatter$1.raw + "\n\n" : "") + pragma.insertPragma(content);
16441   }
16442
16443   var pragma$1 = {
16444     hasPragma: hasPragma$1,
16445     insertPragma: insertPragma$1
16446   };
16447
16448   var colorAdjusterFunctions = ["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"];
16449
16450   function getAncestorCounter(path, typeOrTypes) {
16451     var types = [].concat(typeOrTypes);
16452     var counter = -1;
16453     var ancestorNode;
16454
16455     while (ancestorNode = path.getParentNode(++counter)) {
16456       if (types.indexOf(ancestorNode.type) !== -1) {
16457         return counter;
16458       }
16459     }
16460
16461     return -1;
16462   }
16463
16464   function getAncestorNode(path, typeOrTypes) {
16465     var counter = getAncestorCounter(path, typeOrTypes);
16466     return counter === -1 ? null : path.getParentNode(counter);
16467   }
16468
16469   function getPropOfDeclNode(path) {
16470     var declAncestorNode = getAncestorNode(path, "css-decl");
16471     return declAncestorNode && declAncestorNode.prop && declAncestorNode.prop.toLowerCase();
16472   }
16473
16474   function isSCSS(parser, text) {
16475     var hasExplicitParserChoice = parser === "less" || parser === "scss";
16476     var IS_POSSIBLY_SCSS = /(\w\s*: [^}:]+|#){|@import[^\n]+(url|,)/;
16477     return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
16478   }
16479
16480   function isWideKeywords(value) {
16481     return ["initial", "inherit", "unset", "revert"].indexOf(value.toLowerCase()) !== -1;
16482   }
16483
16484   function isKeyframeAtRuleKeywords(path, value) {
16485     var atRuleAncestorNode = getAncestorNode(path, "css-atrule");
16486     return atRuleAncestorNode && atRuleAncestorNode.name && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].indexOf(value.toLowerCase()) !== -1;
16487   }
16488
16489   function maybeToLowerCase(value) {
16490     return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
16491   }
16492
16493   function insideValueFunctionNode(path, functionName) {
16494     var funcAncestorNode = getAncestorNode(path, "value-func");
16495     return funcAncestorNode && funcAncestorNode.value && funcAncestorNode.value.toLowerCase() === functionName;
16496   }
16497
16498   function insideICSSRuleNode(path) {
16499     var ruleAncestorNode = getAncestorNode(path, "css-rule");
16500     return ruleAncestorNode && ruleAncestorNode.raws && ruleAncestorNode.raws.selector && (ruleAncestorNode.raws.selector.startsWith(":import") || ruleAncestorNode.raws.selector.startsWith(":export"));
16501   }
16502
16503   function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
16504     var atRuleNames = [].concat(atRuleNameOrAtRuleNames);
16505     var atRuleAncestorNode = getAncestorNode(path, "css-atrule");
16506     return atRuleAncestorNode && atRuleNames.indexOf(atRuleAncestorNode.name.toLowerCase()) !== -1;
16507   }
16508
16509   function insideURLFunctionInImportAtRuleNode(path) {
16510     var node = path.getValue();
16511     var atRuleAncestorNode = getAncestorNode(path, "css-atrule");
16512     return atRuleAncestorNode && atRuleAncestorNode.name === "import" && node.groups[0].value === "url" && node.groups.length === 2;
16513   }
16514
16515   function isURLFunctionNode(node) {
16516     return node.type === "value-func" && node.value.toLowerCase() === "url";
16517   }
16518
16519   function isLastNode(path, node) {
16520     var parentNode = path.getParentNode();
16521
16522     if (!parentNode) {
16523       return false;
16524     }
16525
16526     var nodes = parentNode.nodes;
16527     return nodes && nodes.indexOf(node) === nodes.length - 1;
16528   }
16529
16530   function isHTMLTag(value) {
16531     return htmlTagNames$1.indexOf(value.toLowerCase()) !== -1;
16532   }
16533
16534   function isDetachedRulesetDeclarationNode(node) {
16535     // If a Less file ends up being parsed with the SCSS parser, Less
16536     // variable declarations will be parsed as atrules with names ending
16537     // with a colon, so keep the original case then.
16538     if (!node.selector) {
16539       return false;
16540     }
16541
16542     return typeof node.selector === "string" && /^@.+:.*$/.test(node.selector) || node.selector.value && /^@.+:.*$/.test(node.selector.value);
16543   }
16544
16545   function isForKeywordNode(node) {
16546     return node.type === "value-word" && ["from", "through", "end"].indexOf(node.value) !== -1;
16547   }
16548
16549   function isIfElseKeywordNode(node) {
16550     return node.type === "value-word" && ["and", "or", "not"].indexOf(node.value) !== -1;
16551   }
16552
16553   function isEachKeywordNode(node) {
16554     return node.type === "value-word" && node.value === "in";
16555   }
16556
16557   function isMultiplicationNode(node) {
16558     return node.type === "value-operator" && node.value === "*";
16559   }
16560
16561   function isDivisionNode(node) {
16562     return node.type === "value-operator" && node.value === "/";
16563   }
16564
16565   function isAdditionNode(node) {
16566     return node.type === "value-operator" && node.value === "+";
16567   }
16568
16569   function isSubtractionNode(node) {
16570     return node.type === "value-operator" && node.value === "-";
16571   }
16572
16573   function isModuloNode(node) {
16574     return node.type === "value-operator" && node.value === "%";
16575   }
16576
16577   function isMathOperatorNode(node) {
16578     return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
16579   }
16580
16581   function isEqualityOperatorNode(node) {
16582     return node.type === "value-word" && ["==", "!="].indexOf(node.value) !== -1;
16583   }
16584
16585   function isRelationalOperatorNode(node) {
16586     return node.type === "value-word" && ["<", ">", "<=", ">="].indexOf(node.value) !== -1;
16587   }
16588
16589   function isSCSSControlDirectiveNode(node) {
16590     return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].indexOf(node.name) !== -1;
16591   }
16592
16593   function isSCSSNestedPropertyNode(node) {
16594     if (!node.selector) {
16595       return false;
16596     }
16597
16598     return node.selector.replace(/\/\*.*?\*\//, "").replace(/\/\/.*?\n/, "").trim().endsWith(":");
16599   }
16600
16601   function isDetachedRulesetCallNode(node) {
16602     return node.raws && node.raws.params && /^\(\s*\)$/.test(node.raws.params);
16603   }
16604
16605   function isTemplatePlaceholderNode(node) {
16606     return node.name.startsWith("prettier-placeholder");
16607   }
16608
16609   function isTemplatePropNode(node) {
16610     return node.prop.startsWith("@prettier-placeholder");
16611   }
16612
16613   function isPostcssSimpleVarNode(currentNode, nextNode) {
16614     return currentNode.value === "$$" && currentNode.type === "value-func" && nextNode && nextNode.type === "value-word" && !nextNode.raws.before;
16615   }
16616
16617   function hasComposesNode(node) {
16618     return node.value && node.value.type === "value-root" && node.value.group && node.value.group.type === "value-value" && node.prop.toLowerCase() === "composes";
16619   }
16620
16621   function hasParensAroundNode(node) {
16622     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;
16623   }
16624
16625   function hasEmptyRawBefore(node) {
16626     return node.raws && node.raws.before === "";
16627   }
16628
16629   function isKeyValuePairNode(node) {
16630     return node.type === "value-comma_group" && node.groups && node.groups[1] && node.groups[1].type === "value-colon";
16631   }
16632
16633   function isKeyValuePairInParenGroupNode(node) {
16634     return node.type === "value-paren_group" && node.groups && node.groups[0] && isKeyValuePairNode(node.groups[0]);
16635   }
16636
16637   function isSCSSMapItemNode(path) {
16638     var node = path.getValue(); // Ignore empty item (i.e. `$key: ()`)
16639
16640     if (node.groups.length === 0) {
16641       return false;
16642     }
16643
16644     var parentParentNode = path.getParentNode(1); // Check open parens contain key/value pair (i.e. `(key: value)` and `(key: (value, other-value)`)
16645
16646     if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
16647       return false;
16648     }
16649
16650     var declNode = getAncestorNode(path, "css-decl"); // SCSS map declaration (i.e. `$map: (key: value, other-key: other-value)`)
16651
16652     if (declNode && declNode.prop && declNode.prop.startsWith("$")) {
16653       return true;
16654     } // List as value of key inside SCSS map (i.e. `$map: (key: (value other-value other-other-value))`)
16655
16656
16657     if (isKeyValuePairInParenGroupNode(parentParentNode)) {
16658       return true;
16659     } // SCSS Map is argument of function (i.e. `func((key: value, other-key: other-value))`)
16660
16661
16662     if (parentParentNode.type === "value-func") {
16663       return true;
16664     }
16665
16666     return false;
16667   }
16668
16669   function isInlineValueCommentNode(node) {
16670     return node.type === "value-comment" && node.inline;
16671   }
16672
16673   function isHashNode(node) {
16674     return node.type === "value-word" && node.value === "#";
16675   }
16676
16677   function isLeftCurlyBraceNode(node) {
16678     return node.type === "value-word" && node.value === "{";
16679   }
16680
16681   function isRightCurlyBraceNode(node) {
16682     return node.type === "value-word" && node.value === "}";
16683   }
16684
16685   function isWordNode(node) {
16686     return ["value-word", "value-atword"].indexOf(node.type) !== -1;
16687   }
16688
16689   function isColonNode(node) {
16690     return node.type === "value-colon";
16691   }
16692
16693   function isMediaAndSupportsKeywords(node) {
16694     return node.value && ["not", "and", "or"].indexOf(node.value.toLowerCase()) !== -1;
16695   }
16696
16697   function isColorAdjusterFuncNode(node) {
16698     if (node.type !== "value-func") {
16699       return false;
16700     }
16701
16702     return colorAdjusterFunctions.indexOf(node.value.toLowerCase()) !== -1;
16703   }
16704
16705   var utils$2 = {
16706     getAncestorCounter: getAncestorCounter,
16707     getAncestorNode: getAncestorNode,
16708     getPropOfDeclNode: getPropOfDeclNode,
16709     maybeToLowerCase: maybeToLowerCase,
16710     insideValueFunctionNode: insideValueFunctionNode,
16711     insideICSSRuleNode: insideICSSRuleNode,
16712     insideAtRuleNode: insideAtRuleNode,
16713     insideURLFunctionInImportAtRuleNode: insideURLFunctionInImportAtRuleNode,
16714     isKeyframeAtRuleKeywords: isKeyframeAtRuleKeywords,
16715     isHTMLTag: isHTMLTag,
16716     isWideKeywords: isWideKeywords,
16717     isSCSS: isSCSS,
16718     isLastNode: isLastNode,
16719     isSCSSControlDirectiveNode: isSCSSControlDirectiveNode,
16720     isDetachedRulesetDeclarationNode: isDetachedRulesetDeclarationNode,
16721     isRelationalOperatorNode: isRelationalOperatorNode,
16722     isEqualityOperatorNode: isEqualityOperatorNode,
16723     isMultiplicationNode: isMultiplicationNode,
16724     isDivisionNode: isDivisionNode,
16725     isAdditionNode: isAdditionNode,
16726     isSubtractionNode: isSubtractionNode,
16727     isModuloNode: isModuloNode,
16728     isMathOperatorNode: isMathOperatorNode,
16729     isEachKeywordNode: isEachKeywordNode,
16730     isForKeywordNode: isForKeywordNode,
16731     isURLFunctionNode: isURLFunctionNode,
16732     isIfElseKeywordNode: isIfElseKeywordNode,
16733     hasComposesNode: hasComposesNode,
16734     hasParensAroundNode: hasParensAroundNode,
16735     hasEmptyRawBefore: hasEmptyRawBefore,
16736     isSCSSNestedPropertyNode: isSCSSNestedPropertyNode,
16737     isDetachedRulesetCallNode: isDetachedRulesetCallNode,
16738     isTemplatePlaceholderNode: isTemplatePlaceholderNode,
16739     isTemplatePropNode: isTemplatePropNode,
16740     isPostcssSimpleVarNode: isPostcssSimpleVarNode,
16741     isKeyValuePairNode: isKeyValuePairNode,
16742     isKeyValuePairInParenGroupNode: isKeyValuePairInParenGroupNode,
16743     isSCSSMapItemNode: isSCSSMapItemNode,
16744     isInlineValueCommentNode: isInlineValueCommentNode,
16745     isHashNode: isHashNode,
16746     isLeftCurlyBraceNode: isLeftCurlyBraceNode,
16747     isRightCurlyBraceNode: isRightCurlyBraceNode,
16748     isWordNode: isWordNode,
16749     isColonNode: isColonNode,
16750     isMediaAndSupportsKeywords: isMediaAndSupportsKeywords,
16751     isColorAdjusterFuncNode: isColorAdjusterFuncNode
16752   };
16753
16754   var insertPragma$2 = pragma$1.insertPragma;
16755   var printNumber$1 = util.printNumber,
16756       printString$1 = util.printString,
16757       hasIgnoreComment$1 = util.hasIgnoreComment,
16758       hasNewline$2 = util.hasNewline;
16759   var isNextLineEmpty$2 = utilShared.isNextLineEmpty;
16760   var _require$$3$builders = doc.builders,
16761       concat$5 = _require$$3$builders.concat,
16762       join$2 = _require$$3$builders.join,
16763       line$1 = _require$$3$builders.line,
16764       hardline$4 = _require$$3$builders.hardline,
16765       softline$1 = _require$$3$builders.softline,
16766       group$1 = _require$$3$builders.group,
16767       fill$2 = _require$$3$builders.fill,
16768       indent$2 = _require$$3$builders.indent,
16769       dedent$1 = _require$$3$builders.dedent,
16770       ifBreak$1 = _require$$3$builders.ifBreak,
16771       removeLines$1 = doc.utils.removeLines;
16772   var getAncestorNode$1 = utils$2.getAncestorNode,
16773       getPropOfDeclNode$1 = utils$2.getPropOfDeclNode,
16774       maybeToLowerCase$1 = utils$2.maybeToLowerCase,
16775       insideValueFunctionNode$1 = utils$2.insideValueFunctionNode,
16776       insideICSSRuleNode$1 = utils$2.insideICSSRuleNode,
16777       insideAtRuleNode$1 = utils$2.insideAtRuleNode,
16778       insideURLFunctionInImportAtRuleNode$1 = utils$2.insideURLFunctionInImportAtRuleNode,
16779       isKeyframeAtRuleKeywords$1 = utils$2.isKeyframeAtRuleKeywords,
16780       isHTMLTag$1 = utils$2.isHTMLTag,
16781       isWideKeywords$1 = utils$2.isWideKeywords,
16782       isSCSS$1 = utils$2.isSCSS,
16783       isLastNode$1 = utils$2.isLastNode,
16784       isSCSSControlDirectiveNode$1 = utils$2.isSCSSControlDirectiveNode,
16785       isDetachedRulesetDeclarationNode$1 = utils$2.isDetachedRulesetDeclarationNode,
16786       isRelationalOperatorNode$1 = utils$2.isRelationalOperatorNode,
16787       isEqualityOperatorNode$1 = utils$2.isEqualityOperatorNode,
16788       isMultiplicationNode$1 = utils$2.isMultiplicationNode,
16789       isDivisionNode$1 = utils$2.isDivisionNode,
16790       isAdditionNode$1 = utils$2.isAdditionNode,
16791       isSubtractionNode$1 = utils$2.isSubtractionNode,
16792       isMathOperatorNode$1 = utils$2.isMathOperatorNode,
16793       isEachKeywordNode$1 = utils$2.isEachKeywordNode,
16794       isForKeywordNode$1 = utils$2.isForKeywordNode,
16795       isURLFunctionNode$1 = utils$2.isURLFunctionNode,
16796       isIfElseKeywordNode$1 = utils$2.isIfElseKeywordNode,
16797       hasComposesNode$1 = utils$2.hasComposesNode,
16798       hasParensAroundNode$1 = utils$2.hasParensAroundNode,
16799       hasEmptyRawBefore$1 = utils$2.hasEmptyRawBefore,
16800       isKeyValuePairNode$1 = utils$2.isKeyValuePairNode,
16801       isDetachedRulesetCallNode$1 = utils$2.isDetachedRulesetCallNode,
16802       isTemplatePlaceholderNode$1 = utils$2.isTemplatePlaceholderNode,
16803       isTemplatePropNode$1 = utils$2.isTemplatePropNode,
16804       isPostcssSimpleVarNode$1 = utils$2.isPostcssSimpleVarNode,
16805       isSCSSMapItemNode$1 = utils$2.isSCSSMapItemNode,
16806       isInlineValueCommentNode$1 = utils$2.isInlineValueCommentNode,
16807       isHashNode$1 = utils$2.isHashNode,
16808       isLeftCurlyBraceNode$1 = utils$2.isLeftCurlyBraceNode,
16809       isRightCurlyBraceNode$1 = utils$2.isRightCurlyBraceNode,
16810       isWordNode$1 = utils$2.isWordNode,
16811       isColonNode$1 = utils$2.isColonNode,
16812       isMediaAndSupportsKeywords$1 = utils$2.isMediaAndSupportsKeywords,
16813       isColorAdjusterFuncNode$1 = utils$2.isColorAdjusterFuncNode;
16814
16815   function shouldPrintComma(options) {
16816     switch (options.trailingComma) {
16817       case "all":
16818       case "es5":
16819         return true;
16820
16821       case "none":
16822       default:
16823         return false;
16824     }
16825   }
16826
16827   function genericPrint(path, options, print) {
16828     var node = path.getValue();
16829     /* istanbul ignore if */
16830
16831     if (!node) {
16832       return "";
16833     }
16834
16835     if (typeof node === "string") {
16836       return node;
16837     }
16838
16839     switch (node.type) {
16840       case "yaml":
16841       case "toml":
16842         return concat$5([node.raw, hardline$4]);
16843
16844       case "css-root":
16845         {
16846           var nodes = printNodeSequence(path, options, print);
16847
16848           if (nodes.parts.length) {
16849             return concat$5([nodes, hardline$4]);
16850           }
16851
16852           return nodes;
16853         }
16854
16855       case "css-comment":
16856         {
16857           if (node.raws.content) {
16858             return node.raws.content;
16859           }
16860
16861           var text = options.originalText.slice(options.locStart(node), options.locEnd(node));
16862           var rawText = node.raws.text || node.text; // Workaround a bug where the location is off.
16863           // https://github.com/postcss/postcss-scss/issues/63
16864
16865           if (text.indexOf(rawText) === -1) {
16866             if (node.raws.inline) {
16867               return concat$5(["// ", rawText]);
16868             }
16869
16870             return concat$5(["/* ", rawText, " */"]);
16871           }
16872
16873           return text;
16874         }
16875
16876       case "css-rule":
16877         {
16878           return concat$5([path.call(print, "selector"), node.important ? " !important" : "", node.nodes ? concat$5([" {", node.nodes.length > 0 ? indent$2(concat$5([hardline$4, printNodeSequence(path, options, print)])) : "", hardline$4, "}", isDetachedRulesetDeclarationNode$1(node) ? ";" : ""]) : ";"]);
16879         }
16880
16881       case "css-decl":
16882         {
16883           var parentNode = path.getParentNode();
16884           return concat$5([node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode$1(path) ? node.prop : maybeToLowerCase$1(node.prop), node.raws.between.trim() === ":" ? ":" : node.raws.between.trim(), node.extend ? "" : " ", hasComposesNode$1(node) ? removeLines$1(path.call(print, "value")) : path.call(print, "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 ? concat$5([" {", indent$2(concat$5([softline$1, printNodeSequence(path, options, print)])), softline$1, "}"]) : isTemplatePropNode$1(node) && !parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";" ? "" : ";"]);
16885         }
16886
16887       case "css-atrule":
16888         {
16889           var _parentNode = path.getParentNode();
16890
16891           return concat$5(["@", // If a Less file ends up being parsed with the SCSS parser, Less
16892           // variable declarations will be parsed as at-rules with names ending
16893           // with a colon, so keep the original case then.
16894           isDetachedRulesetCallNode$1(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase$1(node.name), node.params ? concat$5([isDetachedRulesetCallNode$1(node) ? "" : isTemplatePlaceholderNode$1(node) && /^\s*\n/.test(node.raws.afterName) ? /^\s*\n\s*\n/.test(node.raws.afterName) ? concat$5([hardline$4, hardline$4]) : hardline$4 : " ", path.call(print, "params")]) : "", node.selector ? indent$2(concat$5([" ", path.call(print, "selector")])) : "", node.value ? group$1(concat$5([" ", path.call(print, "value"), isSCSSControlDirectiveNode$1(node) ? hasParensAroundNode$1(node) ? " " : line$1 : ""])) : node.name === "else" ? " " : "", node.nodes ? concat$5([isSCSSControlDirectiveNode$1(node) ? "" : " ", "{", indent$2(concat$5([node.nodes.length > 0 ? softline$1 : "", printNodeSequence(path, options, print)])), softline$1, "}"]) : isTemplatePlaceholderNode$1(node) && !_parentNode.raws.semicolon && options.originalText[options.locEnd(node) - 1] !== ";" ? "" : ";"]);
16895         }
16896       // postcss-media-query-parser
16897
16898       case "media-query-list":
16899         {
16900           var parts = [];
16901           path.each(function (childPath) {
16902             var node = childPath.getValue();
16903
16904             if (node.type === "media-query" && node.value === "") {
16905               return;
16906             }
16907
16908             parts.push(childPath.call(print));
16909           }, "nodes");
16910           return group$1(indent$2(join$2(line$1, parts)));
16911         }
16912
16913       case "media-query":
16914         {
16915           return concat$5([join$2(" ", path.map(print, "nodes")), isLastNode$1(path, node) ? "" : ","]);
16916         }
16917
16918       case "media-type":
16919         {
16920           return adjustNumbers(adjustStrings(node.value, options));
16921         }
16922
16923       case "media-feature-expression":
16924         {
16925           if (!node.nodes) {
16926             return node.value;
16927           }
16928
16929           return concat$5(["(", concat$5(path.map(print, "nodes")), ")"]);
16930         }
16931
16932       case "media-feature":
16933         {
16934           return maybeToLowerCase$1(adjustStrings(node.value.replace(/ +/g, " "), options));
16935         }
16936
16937       case "media-colon":
16938         {
16939           return concat$5([node.value, " "]);
16940         }
16941
16942       case "media-value":
16943         {
16944           return adjustNumbers(adjustStrings(node.value, options));
16945         }
16946
16947       case "media-keyword":
16948         {
16949           return adjustStrings(node.value, options);
16950         }
16951
16952       case "media-url":
16953         {
16954           return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/gi, ")"), options);
16955         }
16956
16957       case "media-unknown":
16958         {
16959           return node.value;
16960         }
16961       // postcss-selector-parser
16962
16963       case "selector-root":
16964         {
16965           return group$1(concat$5([insideAtRuleNode$1(path, "custom-selector") ? concat$5([getAncestorNode$1(path, "css-atrule").customSelector, line$1]) : "", join$2(concat$5([",", insideAtRuleNode$1(path, ["extend", "custom-selector", "nest"]) ? line$1 : hardline$4]), path.map(print, "nodes"))]));
16966         }
16967
16968       case "selector-selector":
16969         {
16970           return group$1(indent$2(concat$5(path.map(print, "nodes"))));
16971         }
16972
16973       case "selector-comment":
16974         {
16975           return node.value;
16976         }
16977
16978       case "selector-string":
16979         {
16980           return adjustStrings(node.value, options);
16981         }
16982
16983       case "selector-tag":
16984         {
16985           var _parentNode2 = path.getParentNode();
16986
16987           var index = _parentNode2 && _parentNode2.nodes.indexOf(node);
16988
16989           var prevNode = index && _parentNode2.nodes[index - 1];
16990           return concat$5([node.namespace ? concat$5([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isHTMLTag$1(node.value) || isKeyframeAtRuleKeywords$1(path, node.value) ? node.value.toLowerCase() : node.value)]);
16991         }
16992
16993       case "selector-id":
16994         {
16995           return concat$5(["#", node.value]);
16996         }
16997
16998       case "selector-class":
16999         {
17000           return concat$5([".", adjustNumbers(adjustStrings(node.value, options))]);
17001         }
17002
17003       case "selector-attribute":
17004         {
17005           return concat$5(["[", node.namespace ? concat$5([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" : "", "]"]);
17006         }
17007
17008       case "selector-combinator":
17009         {
17010           if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
17011             var _parentNode3 = path.getParentNode();
17012
17013             var _leading = _parentNode3.type === "selector-selector" && _parentNode3.nodes[0] === node ? "" : line$1;
17014
17015             return concat$5([_leading, node.value, isLastNode$1(path, node) ? "" : " "]);
17016           }
17017
17018           var leading = node.value.trim().startsWith("(") ? line$1 : "";
17019           var value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line$1;
17020           return concat$5([leading, value]);
17021         }
17022
17023       case "selector-universal":
17024         {
17025           return concat$5([node.namespace ? concat$5([node.namespace === true ? "" : node.namespace.trim(), "|"]) : "", node.value]);
17026         }
17027
17028       case "selector-pseudo":
17029         {
17030           return concat$5([maybeToLowerCase$1(node.value), node.nodes && node.nodes.length > 0 ? concat$5(["(", join$2(", ", path.map(print, "nodes")), ")"]) : ""]);
17031         }
17032
17033       case "selector-nesting":
17034         {
17035           return node.value;
17036         }
17037
17038       case "selector-unknown":
17039         {
17040           var ruleAncestorNode = getAncestorNode$1(path, "css-rule"); // Nested SCSS property
17041
17042           if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
17043             return adjustNumbers(adjustStrings(maybeToLowerCase$1(node.value), options));
17044           }
17045
17046           return node.value;
17047         }
17048       // postcss-values-parser
17049
17050       case "value-value":
17051       case "value-root":
17052         {
17053           return path.call(print, "group");
17054         }
17055
17056       case "value-comment":
17057         {
17058           return concat$5([node.inline ? "//" : "/*", node.value, node.inline ? "" : "*/"]);
17059         }
17060
17061       case "value-comma_group":
17062         {
17063           var _parentNode4 = path.getParentNode();
17064
17065           var parentParentNode = path.getParentNode(1);
17066           var declAncestorProp = getPropOfDeclNode$1(path);
17067           var isGridValue = declAncestorProp && _parentNode4.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
17068           var atRuleAncestorNode = getAncestorNode$1(path, "css-atrule");
17069           var isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode$1(atRuleAncestorNode);
17070           var printed = path.map(print, "groups");
17071           var _parts = [];
17072           var insideURLFunction = insideValueFunctionNode$1(path, "url");
17073           var insideSCSSInterpolationInString = false;
17074           var didBreak = false;
17075
17076           for (var i = 0; i < node.groups.length; ++i) {
17077             _parts.push(printed[i]); // Ignore value inside `url()`
17078
17079
17080             if (insideURLFunction) {
17081               continue;
17082             }
17083
17084             var iPrevNode = node.groups[i - 1];
17085             var iNode = node.groups[i];
17086             var iNextNode = node.groups[i + 1];
17087             var iNextNextNode = node.groups[i + 2]; // Ignore after latest node (i.e. before semicolon)
17088
17089             if (!iNextNode) {
17090               continue;
17091             } // Ignore spaces before/after string interpolation (i.e. `"#{my-fn("_")}"`)
17092
17093
17094             var isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
17095             var isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
17096
17097             if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
17098               insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
17099               continue;
17100             }
17101
17102             if (insideSCSSInterpolationInString) {
17103               continue;
17104             } // Ignore colon (i.e. `:`)
17105
17106
17107             if (isColonNode$1(iNode) || isColonNode$1(iNextNode)) {
17108               continue;
17109             } // Ignore `@` in Less (i.e. `@@var;`)
17110
17111
17112             if (iNode.type === "value-atword" && iNode.value === "") {
17113               continue;
17114             } // Ignore `~` in Less (i.e. `content: ~"^//* some horrible but needed css hack";`)
17115
17116
17117             if (iNode.value === "~") {
17118               continue;
17119             } // Ignore escape `\`
17120
17121
17122             if (iNode.value && iNode.value.indexOf("\\") !== -1 && iNextNode && iNextNode.type !== "value-comment") {
17123               continue;
17124             } // Ignore escaped `/`
17125
17126
17127             if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
17128               continue;
17129             } // Ignore `\` (i.e. `$variable: \@small;`)
17130
17131
17132             if (iNode.value === "\\") {
17133               continue;
17134             } // Ignore `$$` (i.e. `background-color: $$(style)Color;`)
17135
17136
17137             if (isPostcssSimpleVarNode$1(iNode, iNextNode)) {
17138               continue;
17139             } // Ignore spaces after `#` and after `{` and before `}` in SCSS interpolation (i.e. `#{variable}`)
17140
17141
17142             if (isHashNode$1(iNode) || isLeftCurlyBraceNode$1(iNode) || isRightCurlyBraceNode$1(iNextNode) || isLeftCurlyBraceNode$1(iNextNode) && hasEmptyRawBefore$1(iNextNode) || isRightCurlyBraceNode$1(iNode) && hasEmptyRawBefore$1(iNextNode)) {
17143               continue;
17144             } // Ignore css variables and interpolation in SCSS (i.e. `--#{$var}`)
17145
17146
17147             if (iNode.value === "--" && isHashNode$1(iNextNode)) {
17148               continue;
17149             } // Formatting math operations
17150
17151
17152             var isMathOperator = isMathOperatorNode$1(iNode);
17153             var isNextMathOperator = isMathOperatorNode$1(iNextNode); // Print spaces before and after math operators beside SCSS interpolation as is
17154             // (i.e. `#{$var}+5`, `#{$var} +5`, `#{$var}+ 5`, `#{$var} + 5`)
17155             // (i.e. `5+#{$var}`, `5 +#{$var}`, `5+ #{$var}`, `5 + #{$var}`)
17156
17157             if ((isMathOperator && isHashNode$1(iNextNode) || isNextMathOperator && isRightCurlyBraceNode$1(iNode)) && hasEmptyRawBefore$1(iNextNode)) {
17158               continue;
17159             } // Print spaces before and after addition and subtraction math operators as is in `calc` function
17160             // due to the fact that it is not valid syntax
17161             // (i.e. `calc(1px+1px)`, `calc(1px+ 1px)`, `calc(1px +1px)`, `calc(1px + 1px)`)
17162
17163
17164             if (insideValueFunctionNode$1(path, "calc") && (isAdditionNode$1(iNode) || isAdditionNode$1(iNextNode) || isSubtractionNode$1(iNode) || isSubtractionNode$1(iNextNode)) && hasEmptyRawBefore$1(iNextNode)) {
17165               continue;
17166             } // Print spaces after `+` and `-` in color adjuster functions as is (e.g. `color(red l(+ 20%))`)
17167             // Adjusters with signed numbers (e.g. `color(red l(+20%))`) output as-is.
17168
17169
17170             var isColorAdjusterNode = (isAdditionNode$1(iNode) || isSubtractionNode$1(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode$1(parentParentNode) && !hasEmptyRawBefore$1(iNextNode);
17171             var requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode$1(iNextNextNode) || iNode.type === "value-func" || isWordNode$1(iNode);
17172             var requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode$1(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode$1(iPrevNode); // Formatting `/`, `+`, `-` sign
17173
17174             if (!(isMultiplicationNode$1(iNextNode) || isMultiplicationNode$1(iNode)) && !insideValueFunctionNode$1(path, "calc") && !isColorAdjusterNode && (isDivisionNode$1(iNextNode) && !requireSpaceBeforeOperator || isDivisionNode$1(iNode) && !requireSpaceAfterOperator || isAdditionNode$1(iNextNode) && !requireSpaceBeforeOperator || isAdditionNode$1(iNode) && !requireSpaceAfterOperator || isSubtractionNode$1(iNextNode) || isSubtractionNode$1(iNode)) && (hasEmptyRawBefore$1(iNextNode) || isMathOperator && (!iPrevNode || iPrevNode && isMathOperatorNode$1(iPrevNode)))) {
17175               continue;
17176             } // Add `hardline` after inline comment (i.e. `// comment\n foo: bar;`)
17177
17178
17179             if (isInlineValueCommentNode$1(iNode)) {
17180               _parts.push(hardline$4);
17181
17182               continue;
17183             } // Handle keywords in SCSS control directive
17184
17185
17186             if (isControlDirective && (isEqualityOperatorNode$1(iNextNode) || isRelationalOperatorNode$1(iNextNode) || isIfElseKeywordNode$1(iNextNode) || isEachKeywordNode$1(iNode) || isForKeywordNode$1(iNode))) {
17187               _parts.push(" ");
17188
17189               continue;
17190             } // At-rule `namespace` should be in one line
17191
17192
17193             if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
17194               _parts.push(" ");
17195
17196               continue;
17197             } // Formatting `grid` property
17198
17199
17200             if (isGridValue) {
17201               if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
17202                 _parts.push(hardline$4);
17203
17204                 didBreak = true;
17205               } else {
17206                 _parts.push(" ");
17207               }
17208
17209               continue;
17210             } // Add `space` before next math operation
17211             // Note: `grip` property have `/` delimiter and it is not math operation, so
17212             // `grid` property handles above
17213
17214
17215             if (isNextMathOperator) {
17216               _parts.push(" ");
17217
17218               continue;
17219             } // Be default all values go through `line`
17220
17221
17222             _parts.push(line$1);
17223           }
17224
17225           if (didBreak) {
17226             _parts.unshift(hardline$4);
17227           }
17228
17229           if (isControlDirective) {
17230             return group$1(indent$2(concat$5(_parts)));
17231           } // Indent is not needed for import url when url is very long
17232           // and node has two groups
17233           // when type is value-comma_group
17234           // example @import url("verylongurl") projection,tv
17235
17236
17237           if (insideURLFunctionInImportAtRuleNode$1(path)) {
17238             return group$1(fill$2(_parts));
17239           }
17240
17241           return group$1(indent$2(fill$2(_parts)));
17242         }
17243
17244       case "value-paren_group":
17245         {
17246           var _parentNode5 = path.getParentNode();
17247
17248           if (_parentNode5 && isURLFunctionNode$1(_parentNode5) && (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:"))) {
17249             return concat$5([node.open ? path.call(print, "open") : "", join$2(",", path.map(print, "groups")), node.close ? path.call(print, "close") : ""]);
17250           }
17251
17252           if (!node.open) {
17253             var _printed = path.map(print, "groups");
17254
17255             var res = [];
17256
17257             for (var _i = 0; _i < _printed.length; _i++) {
17258               if (_i !== 0) {
17259                 res.push(concat$5([",", line$1]));
17260               }
17261
17262               res.push(_printed[_i]);
17263             }
17264
17265             return group$1(indent$2(fill$2(res)));
17266           }
17267
17268           var isSCSSMapItem = isSCSSMapItemNode$1(path);
17269           return group$1(concat$5([node.open ? path.call(print, "open") : "", indent$2(concat$5([softline$1, join$2(concat$5([",", line$1]), path.map(function (childPath) {
17270             var node = childPath.getValue();
17271             var printed = print(childPath); // Key/Value pair in open paren already indented
17272
17273             if (isKeyValuePairNode$1(node) && node.type === "value-comma_group" && node.groups && node.groups[2] && node.groups[2].type === "value-paren_group") {
17274               printed.contents.contents.parts[1] = group$1(printed.contents.contents.parts[1]);
17275               return group$1(dedent$1(printed));
17276             }
17277
17278             return printed;
17279           }, "groups"))])), ifBreak$1(isSCSS$1(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline$1, node.close ? path.call(print, "close") : ""]), {
17280             shouldBreak: isSCSSMapItem
17281           });
17282         }
17283
17284       case "value-func":
17285         {
17286           return concat$5([node.value, insideAtRuleNode$1(path, "supports") && isMediaAndSupportsKeywords$1(node) ? " " : "", path.call(print, "group")]);
17287         }
17288
17289       case "value-paren":
17290         {
17291           return node.value;
17292         }
17293
17294       case "value-number":
17295         {
17296           return concat$5([printCssNumber(node.value), maybeToLowerCase$1(node.unit)]);
17297         }
17298
17299       case "value-operator":
17300         {
17301           return node.value;
17302         }
17303
17304       case "value-word":
17305         {
17306           if (node.isColor && node.isHex || isWideKeywords$1(node.value)) {
17307             return node.value.toLowerCase();
17308           }
17309
17310           return node.value;
17311         }
17312
17313       case "value-colon":
17314         {
17315           return concat$5([node.value, // Don't add spaces on `:` in `url` function (i.e. `url(fbglyph: cross-outline, fig-white)`)
17316           insideValueFunctionNode$1(path, "url") ? "" : line$1]);
17317         }
17318
17319       case "value-comma":
17320         {
17321           return concat$5([node.value, " "]);
17322         }
17323
17324       case "value-string":
17325         {
17326           return printString$1(node.raws.quote + node.value + node.raws.quote, options);
17327         }
17328
17329       case "value-atword":
17330         {
17331           return concat$5(["@", node.value]);
17332         }
17333
17334       case "value-unicode-range":
17335         {
17336           return node.value;
17337         }
17338
17339       case "value-unknown":
17340         {
17341           return node.value;
17342         }
17343
17344       default:
17345         /* istanbul ignore next */
17346         throw new Error("Unknown postcss type ".concat(JSON.stringify(node.type)));
17347     }
17348   }
17349
17350   function printNodeSequence(path, options, print) {
17351     var node = path.getValue();
17352     var parts = [];
17353     var i = 0;
17354     path.map(function (pathChild) {
17355       var prevNode = node.nodes[i - 1];
17356
17357       if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
17358         var childNode = pathChild.getValue();
17359         parts.push(options.originalText.slice(options.locStart(childNode), options.locEnd(childNode)));
17360       } else {
17361         parts.push(pathChild.call(print));
17362       }
17363
17364       if (i !== node.nodes.length - 1) {
17365         if (node.nodes[i + 1].type === "css-comment" && !hasNewline$2(options.originalText, options.locStart(node.nodes[i + 1]), {
17366           backwards: true
17367         }) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml" || node.nodes[i + 1].type === "css-atrule" && node.nodes[i + 1].name === "else" && node.nodes[i].type !== "css-comment") {
17368           parts.push(" ");
17369         } else {
17370           parts.push(hardline$4);
17371
17372           if (isNextLineEmpty$2(options.originalText, pathChild.getValue(), options) && node.nodes[i].type !== "yaml" && node.nodes[i].type !== "toml") {
17373             parts.push(hardline$4);
17374           }
17375         }
17376       }
17377
17378       i++;
17379     }, "nodes");
17380     return concat$5(parts);
17381   }
17382
17383   var STRING_REGEX$1 = /(['"])(?:(?!\1)[^\\]|\\[\s\S])*\1/g;
17384   var NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g;
17385   var STANDARD_UNIT_REGEX = /[a-zA-Z]+/g;
17386   var WORD_PART_REGEX = /[$@]?[a-zA-Z_\u0080-\uFFFF][\w\-\u0080-\uFFFF]*/g;
17387   var ADJUST_NUMBERS_REGEX = RegExp(STRING_REGEX$1.source + "|" + "(".concat(WORD_PART_REGEX.source, ")?") + "(".concat(NUMBER_REGEX.source, ")") + "(".concat(STANDARD_UNIT_REGEX.source, ")?"), "g");
17388
17389   function adjustStrings(value, options) {
17390     return value.replace(STRING_REGEX$1, function (match) {
17391       return printString$1(match, options);
17392     });
17393   }
17394
17395   function quoteAttributeValue(value, options) {
17396     var quote = options.singleQuote ? "'" : '"';
17397     return value.includes('"') || value.includes("'") ? value : quote + value + quote;
17398   }
17399
17400   function adjustNumbers(value) {
17401     return value.replace(ADJUST_NUMBERS_REGEX, function (match, quote, wordPart, number, unit) {
17402       return !wordPart && number ? (wordPart || "") + printCssNumber(number) + maybeToLowerCase$1(unit || "") : match;
17403     });
17404   }
17405
17406   function printCssNumber(rawNumber) {
17407     return printNumber$1(rawNumber) // Remove trailing `.0`.
17408     .replace(/\.0(?=$|e)/, "");
17409   }
17410
17411   var printerPostcss = {
17412     print: genericPrint,
17413     embed: embed_1,
17414     insertPragma: insertPragma$2,
17415     hasPrettierIgnore: hasIgnoreComment$1,
17416     massageAstNode: clean_1
17417   };
17418
17419   var CATEGORY_COMMON = "Common"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
17420
17421   var commonOptions = {
17422     bracketSpacing: {
17423       since: "0.0.0",
17424       category: CATEGORY_COMMON,
17425       type: "boolean",
17426       default: true,
17427       description: "Print spaces between brackets.",
17428       oppositeDescription: "Do not print spaces between brackets."
17429     },
17430     singleQuote: {
17431       since: "0.0.0",
17432       category: CATEGORY_COMMON,
17433       type: "boolean",
17434       default: false,
17435       description: "Use single quotes instead of double quotes."
17436     },
17437     proseWrap: {
17438       since: "1.8.2",
17439       category: CATEGORY_COMMON,
17440       type: "choice",
17441       default: [{
17442         since: "1.8.2",
17443         value: true
17444       }, {
17445         since: "1.9.0",
17446         value: "preserve"
17447       }],
17448       description: "How to wrap prose.",
17449       choices: [{
17450         since: "1.9.0",
17451         value: "always",
17452         description: "Wrap prose if it exceeds the print width."
17453       }, {
17454         since: "1.9.0",
17455         value: "never",
17456         description: "Do not wrap prose."
17457       }, {
17458         since: "1.9.0",
17459         value: "preserve",
17460         description: "Wrap prose as-is."
17461       }, {
17462         value: false,
17463         deprecated: "1.9.0",
17464         redirect: "never"
17465       }, {
17466         value: true,
17467         deprecated: "1.9.0",
17468         redirect: "always"
17469       }]
17470     }
17471   };
17472
17473   var options$2 = {
17474     singleQuote: commonOptions.singleQuote
17475   };
17476
17477   var createLanguage = function createLanguage(linguistData, transform) {
17478     var language = {};
17479
17480     for (var key in linguistData) {
17481       var newKey = key === "languageId" ? "linguistLanguageId" : key;
17482       language[newKey] = linguistData[key];
17483     }
17484
17485     return transform(language);
17486   };
17487
17488   var name$1 = "CSS";
17489   var type = "markup";
17490   var tmScope = "source.css";
17491   var aceMode = "css";
17492   var codemirrorMode = "css";
17493   var codemirrorMimeType = "text/css";
17494   var color = "#563d7c";
17495   var extensions = [
17496         ".css"
17497   ];
17498   var languageId = 50;
17499   var CSS = {
17500         name: name$1,
17501         type: type,
17502         tmScope: tmScope,
17503         aceMode: aceMode,
17504         codemirrorMode: codemirrorMode,
17505         codemirrorMimeType: codemirrorMimeType,
17506         color: color,
17507         extensions: extensions,
17508         languageId: languageId
17509   };
17510
17511   var CSS$1 = /*#__PURE__*/Object.freeze({
17512     __proto__: null,
17513     name: name$1,
17514     type: type,
17515     tmScope: tmScope,
17516     aceMode: aceMode,
17517     codemirrorMode: codemirrorMode,
17518     codemirrorMimeType: codemirrorMimeType,
17519     color: color,
17520     extensions: extensions,
17521     languageId: languageId,
17522     'default': CSS
17523   });
17524
17525   var name$2 = "PostCSS";
17526   var type$1 = "markup";
17527   var tmScope$1 = "source.postcss";
17528   var group$2 = "CSS";
17529   var extensions$1 = [
17530         ".pcss"
17531   ];
17532   var aceMode$1 = "text";
17533   var languageId$1 = 262764437;
17534   var PostCSS = {
17535         name: name$2,
17536         type: type$1,
17537         tmScope: tmScope$1,
17538         group: group$2,
17539         extensions: extensions$1,
17540         aceMode: aceMode$1,
17541         languageId: languageId$1
17542   };
17543
17544   var PostCSS$1 = /*#__PURE__*/Object.freeze({
17545     __proto__: null,
17546     name: name$2,
17547     type: type$1,
17548     tmScope: tmScope$1,
17549     group: group$2,
17550     extensions: extensions$1,
17551     aceMode: aceMode$1,
17552     languageId: languageId$1,
17553     'default': PostCSS
17554   });
17555
17556   var name$3 = "Less";
17557   var type$2 = "markup";
17558   var group$3 = "CSS";
17559   var extensions$2 = [
17560         ".less"
17561   ];
17562   var tmScope$2 = "source.css.less";
17563   var aceMode$2 = "less";
17564   var codemirrorMode$1 = "css";
17565   var codemirrorMimeType$1 = "text/css";
17566   var languageId$2 = 198;
17567   var Less = {
17568         name: name$3,
17569         type: type$2,
17570         group: group$3,
17571         extensions: extensions$2,
17572         tmScope: tmScope$2,
17573         aceMode: aceMode$2,
17574         codemirrorMode: codemirrorMode$1,
17575         codemirrorMimeType: codemirrorMimeType$1,
17576         languageId: languageId$2
17577   };
17578
17579   var Less$1 = /*#__PURE__*/Object.freeze({
17580     __proto__: null,
17581     name: name$3,
17582     type: type$2,
17583     group: group$3,
17584     extensions: extensions$2,
17585     tmScope: tmScope$2,
17586     aceMode: aceMode$2,
17587     codemirrorMode: codemirrorMode$1,
17588     codemirrorMimeType: codemirrorMimeType$1,
17589     languageId: languageId$2,
17590     'default': Less
17591   });
17592
17593   var name$4 = "SCSS";
17594   var type$3 = "markup";
17595   var tmScope$3 = "source.css.scss";
17596   var group$4 = "CSS";
17597   var aceMode$3 = "scss";
17598   var codemirrorMode$2 = "css";
17599   var codemirrorMimeType$2 = "text/x-scss";
17600   var extensions$3 = [
17601         ".scss"
17602   ];
17603   var languageId$3 = 329;
17604   var SCSS = {
17605         name: name$4,
17606         type: type$3,
17607         tmScope: tmScope$3,
17608         group: group$4,
17609         aceMode: aceMode$3,
17610         codemirrorMode: codemirrorMode$2,
17611         codemirrorMimeType: codemirrorMimeType$2,
17612         extensions: extensions$3,
17613         languageId: languageId$3
17614   };
17615
17616   var SCSS$1 = /*#__PURE__*/Object.freeze({
17617     __proto__: null,
17618     name: name$4,
17619     type: type$3,
17620     tmScope: tmScope$3,
17621     group: group$4,
17622     aceMode: aceMode$3,
17623     codemirrorMode: codemirrorMode$2,
17624     codemirrorMimeType: codemirrorMimeType$2,
17625     extensions: extensions$3,
17626     languageId: languageId$3,
17627     'default': SCSS
17628   });
17629
17630   var require$$0$2 = getCjsExportFromNamespace(CSS$1);
17631
17632   var require$$1 = getCjsExportFromNamespace(PostCSS$1);
17633
17634   var require$$2 = getCjsExportFromNamespace(Less$1);
17635
17636   var require$$3 = getCjsExportFromNamespace(SCSS$1);
17637
17638   var languages = [createLanguage(require$$0$2, function (data) {
17639     return Object.assign(data, {
17640       since: "1.4.0",
17641       parsers: ["css"],
17642       vscodeLanguageIds: ["css"]
17643     });
17644   }), createLanguage(require$$1, function (data) {
17645     return Object.assign(data, {
17646       since: "1.4.0",
17647       parsers: ["css"],
17648       vscodeLanguageIds: ["postcss"],
17649       extensions: data.extensions.concat(".postcss")
17650     });
17651   }), createLanguage(require$$2, function (data) {
17652     return Object.assign(data, {
17653       since: "1.4.0",
17654       parsers: ["less"],
17655       vscodeLanguageIds: ["less"]
17656     });
17657   }), createLanguage(require$$3, function (data) {
17658     return Object.assign(data, {
17659       since: "1.4.0",
17660       parsers: ["scss"],
17661       vscodeLanguageIds: ["scss"]
17662     });
17663   })];
17664   var printers = {
17665     postcss: printerPostcss
17666   };
17667   var languageCss = {
17668     languages: languages,
17669     options: options$2,
17670     printers: printers
17671   };
17672
17673   function hasPragma$2(text) {
17674     return /^\s*#[^\n\S]*@(format|prettier)\s*(\n|$)/.test(text);
17675   }
17676
17677   function insertPragma$3(text) {
17678     return "# @format\n\n" + text;
17679   }
17680
17681   var pragma$2 = {
17682     hasPragma: hasPragma$2,
17683     insertPragma: insertPragma$3
17684   };
17685
17686   var _require$$0$builders$2 = doc.builders,
17687       concat$6 = _require$$0$builders$2.concat,
17688       join$3 = _require$$0$builders$2.join,
17689       hardline$5 = _require$$0$builders$2.hardline,
17690       line$2 = _require$$0$builders$2.line,
17691       softline$2 = _require$$0$builders$2.softline,
17692       group$5 = _require$$0$builders$2.group,
17693       indent$3 = _require$$0$builders$2.indent,
17694       ifBreak$2 = _require$$0$builders$2.ifBreak;
17695   var hasIgnoreComment$2 = util.hasIgnoreComment;
17696   var isNextLineEmpty$3 = utilShared.isNextLineEmpty;
17697   var insertPragma$4 = pragma$2.insertPragma;
17698
17699   function genericPrint$1(path, options, print) {
17700     var n = path.getValue();
17701
17702     if (!n) {
17703       return "";
17704     }
17705
17706     if (typeof n === "string") {
17707       return n;
17708     }
17709
17710     switch (n.kind) {
17711       case "Document":
17712         {
17713           var parts = [];
17714           path.map(function (pathChild, index) {
17715             parts.push(concat$6([pathChild.call(print)]));
17716
17717             if (index !== n.definitions.length - 1) {
17718               parts.push(hardline$5);
17719
17720               if (isNextLineEmpty$3(options.originalText, pathChild.getValue(), options)) {
17721                 parts.push(hardline$5);
17722               }
17723             }
17724           }, "definitions");
17725           return concat$6([concat$6(parts), hardline$5]);
17726         }
17727
17728       case "OperationDefinition":
17729         {
17730           var hasOperation = options.originalText[options.locStart(n)] !== "{";
17731           var hasName = !!n.name;
17732           return concat$6([hasOperation ? n.operation : "", hasOperation && hasName ? concat$6([" ", path.call(print, "name")]) : "", n.variableDefinitions && n.variableDefinitions.length ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "variableDefinitions"))])), softline$2, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? !hasOperation && !hasName ? "" : " " : "", path.call(print, "selectionSet")]);
17733         }
17734
17735       case "FragmentDefinition":
17736         {
17737           return concat$6(["fragment ", path.call(print, "name"), n.variableDefinitions && n.variableDefinitions.length ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "variableDefinitions"))])), softline$2, ")"])) : "", " on ", path.call(print, "typeCondition"), printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
17738         }
17739
17740       case "SelectionSet":
17741         {
17742           return concat$6(["{", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(function (selectionsPath) {
17743             return printSequence(selectionsPath, options, print);
17744           }, "selections"))])), hardline$5, "}"]);
17745         }
17746
17747       case "Field":
17748         {
17749           return group$5(concat$6([n.alias ? concat$6([path.call(print, "alias"), ": "]) : "", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(function (argsPath) {
17750             return printSequence(argsPath, options, print);
17751           }, "arguments"))])), softline$2, ")"])) : "", printDirectives(path, print, n), n.selectionSet ? " " : "", path.call(print, "selectionSet")]));
17752         }
17753
17754       case "Name":
17755         {
17756           return n.value;
17757         }
17758
17759       case "StringValue":
17760         {
17761           if (n.block) {
17762             return concat$6(['"""', hardline$5, join$3(hardline$5, n.value.replace(/"""/g, "\\$&").split("\n")), hardline$5, '"""']);
17763           }
17764
17765           return concat$6(['"', n.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"']);
17766         }
17767
17768       case "IntValue":
17769       case "FloatValue":
17770       case "EnumValue":
17771         {
17772           return n.value;
17773         }
17774
17775       case "BooleanValue":
17776         {
17777           return n.value ? "true" : "false";
17778         }
17779
17780       case "NullValue":
17781         {
17782           return "null";
17783         }
17784
17785       case "Variable":
17786         {
17787           return concat$6(["$", path.call(print, "name")]);
17788         }
17789
17790       case "ListValue":
17791         {
17792           return group$5(concat$6(["[", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "values"))])), softline$2, "]"]));
17793         }
17794
17795       case "ObjectValue":
17796         {
17797           return group$5(concat$6(["{", options.bracketSpacing && n.fields.length > 0 ? " " : "", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.map(print, "fields"))])), softline$2, ifBreak$2("", options.bracketSpacing && n.fields.length > 0 ? " " : ""), "}"]));
17798         }
17799
17800       case "ObjectField":
17801       case "Argument":
17802         {
17803           return concat$6([path.call(print, "name"), ": ", path.call(print, "value")]);
17804         }
17805
17806       case "Directive":
17807         {
17808           return concat$6(["@", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(function (argsPath) {
17809             return printSequence(argsPath, options, print);
17810           }, "arguments"))])), softline$2, ")"])) : ""]);
17811         }
17812
17813       case "NamedType":
17814         {
17815           return path.call(print, "name");
17816         }
17817
17818       case "VariableDefinition":
17819         {
17820           return concat$6([path.call(print, "variable"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
17821         }
17822
17823       case "TypeExtensionDefinition":
17824         {
17825           return concat$6(["extend ", path.call(print, "definition")]);
17826         }
17827
17828       case "ObjectTypeExtension":
17829       case "ObjectTypeDefinition":
17830         {
17831           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "ObjectTypeExtension" ? "extend " : "", "type ", path.call(print, "name"), n.interfaces.length > 0 ? concat$6([" implements ", join$3(determineInterfaceSeparator(options.originalText.substr(options.locStart(n), options.locEnd(n))), path.map(print, "interfaces"))]) : "", printDirectives(path, print, n), n.fields.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(function (fieldsPath) {
17832             return printSequence(fieldsPath, options, print);
17833           }, "fields"))])), hardline$5, "}"]) : ""]);
17834         }
17835
17836       case "FieldDefinition":
17837         {
17838           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(function (argsPath) {
17839             return printSequence(argsPath, options, print);
17840           }, "arguments"))])), softline$2, ")"])) : "", ": ", path.call(print, "type"), printDirectives(path, print, n)]);
17841         }
17842
17843       case "DirectiveDefinition":
17844         {
17845           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", "directive ", "@", path.call(print, "name"), n.arguments.length > 0 ? group$5(concat$6(["(", indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", ", "), softline$2]), path.call(function (argsPath) {
17846             return printSequence(argsPath, options, print);
17847           }, "arguments"))])), softline$2, ")"])) : "", concat$6([" on ", join$3(" | ", path.map(print, "locations"))])]);
17848         }
17849
17850       case "EnumTypeExtension":
17851       case "EnumTypeDefinition":
17852         {
17853           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "EnumTypeExtension" ? "extend " : "", "enum ", path.call(print, "name"), printDirectives(path, print, n), n.values.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(function (valuesPath) {
17854             return printSequence(valuesPath, options, print);
17855           }, "values"))])), hardline$5, "}"]) : ""]);
17856         }
17857
17858       case "EnumValueDefinition":
17859         {
17860           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", path.call(print, "name"), printDirectives(path, print, n)]);
17861         }
17862
17863       case "InputValueDefinition":
17864         {
17865           return concat$6([path.call(print, "description"), n.description ? n.description.block ? hardline$5 : line$2 : "", path.call(print, "name"), ": ", path.call(print, "type"), n.defaultValue ? concat$6([" = ", path.call(print, "defaultValue")]) : "", printDirectives(path, print, n)]);
17866         }
17867
17868       case "InputObjectTypeExtension":
17869       case "InputObjectTypeDefinition":
17870         {
17871           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(function (fieldsPath) {
17872             return printSequence(fieldsPath, options, print);
17873           }, "fields"))])), hardline$5, "}"]) : ""]);
17874         }
17875
17876       case "SchemaDefinition":
17877         {
17878           return concat$6(["schema", printDirectives(path, print, n), " {", n.operationTypes.length > 0 ? indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(function (opsPath) {
17879             return printSequence(opsPath, options, print);
17880           }, "operationTypes"))])) : "", hardline$5, "}"]);
17881         }
17882
17883       case "OperationTypeDefinition":
17884         {
17885           return concat$6([path.call(print, "operation"), ": ", path.call(print, "type")]);
17886         }
17887
17888       case "InterfaceTypeExtension":
17889       case "InterfaceTypeDefinition":
17890         {
17891           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", path.call(print, "name"), printDirectives(path, print, n), n.fields.length > 0 ? concat$6([" {", indent$3(concat$6([hardline$5, join$3(hardline$5, path.call(function (fieldsPath) {
17892             return printSequence(fieldsPath, options, print);
17893           }, "fields"))])), hardline$5, "}"]) : ""]);
17894         }
17895
17896       case "FragmentSpread":
17897         {
17898           return concat$6(["...", path.call(print, "name"), printDirectives(path, print, n)]);
17899         }
17900
17901       case "InlineFragment":
17902         {
17903           return concat$6(["...", n.typeCondition ? concat$6([" on ", path.call(print, "typeCondition")]) : "", printDirectives(path, print, n), " ", path.call(print, "selectionSet")]);
17904         }
17905
17906       case "UnionTypeExtension":
17907       case "UnionTypeDefinition":
17908         {
17909           return group$5(concat$6([path.call(print, "description"), n.description ? hardline$5 : "", group$5(concat$6([n.kind === "UnionTypeExtension" ? "extend " : "", "union ", path.call(print, "name"), printDirectives(path, print, n), n.types.length > 0 ? concat$6([" =", ifBreak$2("", " "), indent$3(concat$6([ifBreak$2(concat$6([line$2, "  "])), join$3(concat$6([line$2, "| "]), path.map(print, "types"))]))]) : ""]))]));
17910         }
17911
17912       case "ScalarTypeExtension":
17913       case "ScalarTypeDefinition":
17914         {
17915           return concat$6([path.call(print, "description"), n.description ? hardline$5 : "", n.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", path.call(print, "name"), printDirectives(path, print, n)]);
17916         }
17917
17918       case "NonNullType":
17919         {
17920           return concat$6([path.call(print, "type"), "!"]);
17921         }
17922
17923       case "ListType":
17924         {
17925           return concat$6(["[", path.call(print, "type"), "]"]);
17926         }
17927
17928       default:
17929         /* istanbul ignore next */
17930         throw new Error("unknown graphql type: " + JSON.stringify(n.kind));
17931     }
17932   }
17933
17934   function printDirectives(path, print, n) {
17935     if (n.directives.length === 0) {
17936       return "";
17937     }
17938
17939     return concat$6([" ", group$5(indent$3(concat$6([softline$2, join$3(concat$6([ifBreak$2("", " "), softline$2]), path.map(print, "directives"))])))]);
17940   }
17941
17942   function printSequence(sequencePath, options, print) {
17943     var count = sequencePath.getValue().length;
17944     return sequencePath.map(function (path, i) {
17945       var printed = print(path);
17946
17947       if (isNextLineEmpty$3(options.originalText, path.getValue(), options) && i < count - 1) {
17948         return concat$6([printed, hardline$5]);
17949       }
17950
17951       return printed;
17952     });
17953   }
17954
17955   function canAttachComment(node) {
17956     return node.kind && node.kind !== "Comment";
17957   }
17958
17959   function printComment$1(commentPath) {
17960     var comment = commentPath.getValue();
17961
17962     if (comment.kind === "Comment") {
17963       return "#" + comment.value.trimRight();
17964     }
17965
17966     throw new Error("Not a comment: " + JSON.stringify(comment));
17967   }
17968
17969   function determineInterfaceSeparator(originalSource) {
17970     var start = originalSource.indexOf("implements");
17971
17972     if (start === -1) {
17973       throw new Error("Must implement interfaces: " + originalSource);
17974     }
17975
17976     var end = originalSource.indexOf("{");
17977
17978     if (end === -1) {
17979       end = originalSource.length;
17980     }
17981
17982     return originalSource.substr(start, end).includes("&") ? " & " : ", ";
17983   }
17984
17985   function clean$1(node, newNode
17986   /*, parent*/
17987   ) {
17988     delete newNode.loc;
17989     delete newNode.comments;
17990   }
17991
17992   var printerGraphql = {
17993     print: genericPrint$1,
17994     massageAstNode: clean$1,
17995     hasPrettierIgnore: hasIgnoreComment$2,
17996     insertPragma: insertPragma$4,
17997     printComment: printComment$1,
17998     canAttachComment: canAttachComment
17999   };
18000
18001   var options$3 = {
18002     bracketSpacing: commonOptions.bracketSpacing
18003   };
18004
18005   var name$5 = "GraphQL";
18006   var type$4 = "data";
18007   var extensions$4 = [
18008         ".graphql",
18009         ".gql",
18010         ".graphqls"
18011   ];
18012   var tmScope$4 = "source.graphql";
18013   var aceMode$4 = "text";
18014   var languageId$4 = 139;
18015   var GraphQL = {
18016         name: name$5,
18017         type: type$4,
18018         extensions: extensions$4,
18019         tmScope: tmScope$4,
18020         aceMode: aceMode$4,
18021         languageId: languageId$4
18022   };
18023
18024   var GraphQL$1 = /*#__PURE__*/Object.freeze({
18025     __proto__: null,
18026     name: name$5,
18027     type: type$4,
18028     extensions: extensions$4,
18029     tmScope: tmScope$4,
18030     aceMode: aceMode$4,
18031     languageId: languageId$4,
18032     'default': GraphQL
18033   });
18034
18035   var require$$0$3 = getCjsExportFromNamespace(GraphQL$1);
18036
18037   var languages$1 = [createLanguage(require$$0$3, function (data) {
18038     return Object.assign(data, {
18039       since: "1.5.0",
18040       parsers: ["graphql"],
18041       vscodeLanguageIds: ["graphql"]
18042     });
18043   })];
18044   var printers$1 = {
18045     graphql: printerGraphql
18046   };
18047   var languageGraphql = {
18048     languages: languages$1,
18049     options: options$3,
18050     printers: printers$1
18051   };
18052
18053   var _require$$0$builders$3 = doc.builders,
18054       concat$7 = _require$$0$builders$3.concat,
18055       join$4 = _require$$0$builders$3.join,
18056       softline$3 = _require$$0$builders$3.softline,
18057       hardline$6 = _require$$0$builders$3.hardline,
18058       line$3 = _require$$0$builders$3.line,
18059       group$6 = _require$$0$builders$3.group,
18060       indent$4 = _require$$0$builders$3.indent,
18061       ifBreak$3 = _require$$0$builders$3.ifBreak; // http://w3c.github.io/html/single-page.html#void-elements
18062
18063   var voidTags = ["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]; // Formatter based on @glimmerjs/syntax's built-in test formatter:
18064   // https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/syntax/lib/generation/print.ts
18065
18066   function printChildren(path, options, print) {
18067     return concat$7(path.map(function (childPath, childIndex) {
18068       var childNode = path.getValue();
18069       var isFirstNode = childIndex === 0;
18070       var isLastNode = childIndex == path.getParentNode(0).children.length - 1;
18071       var isLastNodeInMultiNodeList = isLastNode && !isFirstNode;
18072       var isWhitespace = isWhitespaceNode(childNode);
18073
18074       if (isWhitespace && isLastNodeInMultiNodeList) {
18075         return print(childPath, options, print);
18076       } else if (isFirstNode) {
18077         return concat$7([softline$3, print(childPath, options, print)]);
18078       }
18079
18080       return print(childPath, options, print);
18081     }, "children"));
18082   }
18083
18084   function print(path, options, print) {
18085     var n = path.getValue();
18086     /* istanbul ignore if*/
18087
18088     if (!n) {
18089       return "";
18090     }
18091
18092     switch (n.type) {
18093       case "Block":
18094       case "Program":
18095       case "Template":
18096         {
18097           return group$6(concat$7(path.map(print, "body").filter(function (text) {
18098             return text !== "";
18099           })));
18100         }
18101
18102       case "ElementNode":
18103         {
18104           var tagFirstChar = n.tag[0];
18105           var isLocal = n.tag.indexOf(".") !== -1;
18106           var isGlimmerComponent = tagFirstChar.toUpperCase() === tagFirstChar || isLocal;
18107           var hasChildren = n.children.length > 0;
18108           var hasNonWhitespaceChildren = n.children.some(function (n) {
18109             return !isWhitespaceNode(n);
18110           });
18111           var isVoid = isGlimmerComponent && (!hasChildren || !hasNonWhitespaceChildren) || voidTags.indexOf(n.tag) !== -1;
18112           var closeTagForNoBreak = isVoid ? concat$7([" />", softline$3]) : ">";
18113           var closeTagForBreak = isVoid ? "/>" : ">";
18114
18115           var _getParams = function _getParams(path, print) {
18116             return indent$4(concat$7([n.attributes.length ? line$3 : "", join$4(line$3, path.map(print, "attributes")), n.modifiers.length ? line$3 : "", join$4(line$3, path.map(print, "modifiers")), n.comments.length ? line$3 : "", join$4(line$3, path.map(print, "comments"))]));
18117           };
18118
18119           var nextNode = getNextNode(path);
18120           return concat$7([group$6(concat$7(["<", n.tag, _getParams(path, print), n.blockParams.length ? " as |".concat(n.blockParams.join(" "), "|") : "", ifBreak$3(softline$3, ""), ifBreak$3(closeTagForBreak, closeTagForNoBreak)])), !isVoid ? group$6(concat$7([hasNonWhitespaceChildren ? indent$4(printChildren(path, options, print)) : "", ifBreak$3(hasChildren ? hardline$6 : "", ""), concat$7(["</", n.tag, ">"])])) : "", nextNode && nextNode.type === "ElementNode" ? hardline$6 : ""]);
18121         }
18122
18123       case "BlockStatement":
18124         {
18125           var pp = path.getParentNode(1);
18126           var isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === n && pp.inverse.body[0].path.parts[0] === "if";
18127           var hasElseIf = n.inverse && n.inverse.body.length === 1 && n.inverse.body[0].type === "BlockStatement" && n.inverse.body[0].path.parts[0] === "if";
18128           var indentElse = hasElseIf ? function (a) {
18129             return a;
18130           } : indent$4;
18131
18132           if (n.inverse) {
18133             return concat$7([isElseIf ? concat$7(["{{else ", printPathParams(path, print), "}}"]) : printOpenBlock(path, print), indent$4(concat$7([hardline$6, path.call(print, "program")])), n.inverse && !hasElseIf ? concat$7([hardline$6, "{{else}}"]) : "", n.inverse ? indentElse(concat$7([hardline$6, path.call(print, "inverse")])) : "", isElseIf ? "" : concat$7([hardline$6, printCloseBlock(path, print)])]);
18134           } else if (isElseIf) {
18135             return concat$7([concat$7(["{{else ", printPathParams(path, print), "}}"]), indent$4(concat$7([hardline$6, path.call(print, "program")]))]);
18136           }
18137
18138           var _hasNonWhitespaceChildren = n.program.body.some(function (n) {
18139             return !isWhitespaceNode(n);
18140           });
18141
18142           return concat$7([printOpenBlock(path, print), group$6(concat$7([indent$4(concat$7([softline$3, path.call(print, "program")])), _hasNonWhitespaceChildren ? hardline$6 : softline$3, printCloseBlock(path, print)]))]);
18143         }
18144
18145       case "ElementModifierStatement":
18146       case "MustacheStatement":
18147         {
18148           var _pp = path.getParentNode(1);
18149
18150           var isConcat = _pp && _pp.type === "ConcatStatement";
18151           return group$6(concat$7([n.escaped === false ? "{{{" : "{{", printPathParams(path, print, {
18152             group: false
18153           }), isConcat ? "" : softline$3, n.escaped === false ? "}}}" : "}}"]));
18154         }
18155
18156       case "SubExpression":
18157         {
18158           var params = getParams(path, print);
18159           var printedParams = params.length > 0 ? indent$4(concat$7([line$3, group$6(join$4(line$3, params))])) : "";
18160           return group$6(concat$7(["(", printPath(path, print), printedParams, softline$3, ")"]));
18161         }
18162
18163       case "AttrNode":
18164         {
18165           var isText = n.value.type === "TextNode";
18166
18167           if (isText && n.value.loc.start.column === n.value.loc.end.column) {
18168             return concat$7([n.name]);
18169           }
18170
18171           var value = path.call(print, "value");
18172           var quotedValue = isText ? printStringLiteral(value.parts.join(), options) : value;
18173           return concat$7([n.name, "=", quotedValue]);
18174         }
18175
18176       case "ConcatStatement":
18177         {
18178           return concat$7(['"', group$6(indent$4(join$4(softline$3, path.map(function (partPath) {
18179             return print(partPath);
18180           }, "parts").filter(function (a) {
18181             return a !== "";
18182           })))), '"']);
18183         }
18184
18185       case "Hash":
18186         {
18187           return concat$7([join$4(line$3, path.map(print, "pairs"))]);
18188         }
18189
18190       case "HashPair":
18191         {
18192           return concat$7([n.key, "=", path.call(print, "value")]);
18193         }
18194
18195       case "TextNode":
18196         {
18197           var maxLineBreaksToPreserve = 2;
18198           var isFirstElement = !getPreviousNode(path);
18199           var isLastElement = !getNextNode(path);
18200           var isWhitespaceOnly = !/\S/.test(n.chars);
18201           var lineBreaksCount = countNewLines(n.chars);
18202           var hasBlockParent = path.getParentNode(0).type === "Block";
18203           var hasElementParent = path.getParentNode(0).type === "ElementNode";
18204           var hasTemplateParent = path.getParentNode(0).type === "Template";
18205           var leadingLineBreaksCount = countLeadingNewLines(n.chars);
18206           var trailingLineBreaksCount = countTrailingNewLines(n.chars);
18207
18208           if ((isFirstElement || isLastElement) && isWhitespaceOnly && (hasBlockParent || hasElementParent || hasTemplateParent)) {
18209             return "";
18210           }
18211
18212           if (isWhitespaceOnly && lineBreaksCount) {
18213             leadingLineBreaksCount = Math.min(lineBreaksCount, maxLineBreaksToPreserve);
18214             trailingLineBreaksCount = 0;
18215           } else {
18216             if (isNextNodeOfType(path, "ElementNode") || isNextNodeOfType(path, "BlockStatement")) {
18217               trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
18218             }
18219
18220             if (isPreviousNodeOfSomeType(path, ["ElementNode"]) || isPreviousNodeOfSomeType(path, ["BlockStatement"])) {
18221               leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
18222             }
18223           }
18224
18225           var leadingSpace = "";
18226           var trailingSpace = ""; // preserve a space inside of an attribute node where whitespace present,
18227           // when next to mustache statement.
18228
18229           var inAttrNode = path.stack.indexOf("attributes") >= 0;
18230
18231           if (inAttrNode) {
18232             var parentNode = path.getParentNode(0);
18233
18234             var _isConcat = parentNode.type === "ConcatStatement";
18235
18236             if (_isConcat) {
18237               var parts = parentNode.parts;
18238               var partIndex = parts.indexOf(n);
18239
18240               if (partIndex > 0) {
18241                 var partType = parts[partIndex - 1].type;
18242                 var isMustache = partType === "MustacheStatement";
18243
18244                 if (isMustache) {
18245                   leadingSpace = " ";
18246                 }
18247               }
18248
18249               if (partIndex < parts.length - 1) {
18250                 var _partType = parts[partIndex + 1].type;
18251
18252                 var _isMustache = _partType === "MustacheStatement";
18253
18254                 if (_isMustache) {
18255                   trailingSpace = " ";
18256                 }
18257               }
18258             }
18259           } else {
18260             if (trailingLineBreaksCount === 0 && isNextNodeOfType(path, "MustacheStatement")) {
18261               trailingSpace = " ";
18262             }
18263
18264             if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
18265               leadingSpace = " ";
18266             }
18267
18268             if (isFirstElement) {
18269               leadingLineBreaksCount = 0;
18270               leadingSpace = "";
18271             }
18272
18273             if (isLastElement) {
18274               trailingLineBreaksCount = 0;
18275               trailingSpace = "";
18276             }
18277           }
18278
18279           return concat$7([].concat(_toConsumableArray(generateHardlines(leadingLineBreaksCount, maxLineBreaksToPreserve)), [n.chars.replace(/^[\s ]+/g, leadingSpace).replace(/[\s ]+$/, trailingSpace)], _toConsumableArray(generateHardlines(trailingLineBreaksCount, maxLineBreaksToPreserve))).filter(Boolean));
18280         }
18281
18282       case "MustacheCommentStatement":
18283         {
18284           var dashes = n.value.indexOf("}}") > -1 ? "--" : "";
18285           return concat$7(["{{!", dashes, n.value, dashes, "}}"]);
18286         }
18287
18288       case "PathExpression":
18289         {
18290           return n.original;
18291         }
18292
18293       case "BooleanLiteral":
18294         {
18295           return String(n.value);
18296         }
18297
18298       case "CommentStatement":
18299         {
18300           return concat$7(["<!--", n.value, "-->"]);
18301         }
18302
18303       case "StringLiteral":
18304         {
18305           return printStringLiteral(n.value, options);
18306         }
18307
18308       case "NumberLiteral":
18309         {
18310           return String(n.value);
18311         }
18312
18313       case "UndefinedLiteral":
18314         {
18315           return "undefined";
18316         }
18317
18318       case "NullLiteral":
18319         {
18320           return "null";
18321         }
18322
18323       /* istanbul ignore next */
18324
18325       default:
18326         throw new Error("unknown glimmer type: " + JSON.stringify(n.type));
18327     }
18328   }
18329   /**
18330    * Prints a string literal with the correct surrounding quotes based on
18331    * `options.singleQuote` and the number of escaped quotes contained in
18332    * the string literal. This function is the glimmer equivalent of `printString`
18333    * in `common/util`, but has differences because of the way escaped characters
18334    * are treated in hbs string literals.
18335    * @param {string} stringLiteral - the string literal value
18336    * @param {object} options - the prettier options object
18337    */
18338
18339
18340   function printStringLiteral(stringLiteral, options) {
18341     var double = {
18342       quote: '"',
18343       regex: /"/g
18344     };
18345     var single = {
18346       quote: "'",
18347       regex: /'/g
18348     };
18349     var preferred = options.singleQuote ? single : double;
18350     var alternate = preferred === single ? double : single;
18351     var shouldUseAlternateQuote = false; // If `stringLiteral` contains at least one of the quote preferred for
18352     // enclosing the string, we might want to enclose with the alternate quote
18353     // instead, to minimize the number of escaped quotes.
18354
18355     if (stringLiteral.includes(preferred.quote) || stringLiteral.includes(alternate.quote)) {
18356       var numPreferredQuotes = (stringLiteral.match(preferred.regex) || []).length;
18357       var numAlternateQuotes = (stringLiteral.match(alternate.regex) || []).length;
18358       shouldUseAlternateQuote = numPreferredQuotes > numAlternateQuotes;
18359     }
18360
18361     var enclosingQuote = shouldUseAlternateQuote ? alternate : preferred;
18362     var escapedStringLiteral = stringLiteral.replace(enclosingQuote.regex, "\\".concat(enclosingQuote.quote));
18363     return "".concat(enclosingQuote.quote).concat(escapedStringLiteral).concat(enclosingQuote.quote);
18364   }
18365
18366   function printPath(path, print) {
18367     return path.call(print, "path");
18368   }
18369
18370   function getParams(path, print) {
18371     var node = path.getValue();
18372     var parts = [];
18373
18374     if (node.params.length > 0) {
18375       parts = parts.concat(path.map(print, "params"));
18376     }
18377
18378     if (node.hash && node.hash.pairs.length > 0) {
18379       parts.push(path.call(print, "hash"));
18380     }
18381
18382     return parts;
18383   }
18384
18385   function printPathParams(path, print, options) {
18386     var parts = [];
18387     options = Object.assign({
18388       group: true
18389     }, options || {});
18390     parts.push(printPath(path, print));
18391     parts = parts.concat(getParams(path, print));
18392
18393     if (!options.group) {
18394       return indent$4(join$4(line$3, parts));
18395     }
18396
18397     return indent$4(group$6(join$4(line$3, parts)));
18398   }
18399
18400   function printBlockParams(path) {
18401     var block = path.getValue();
18402
18403     if (!block.program || !block.program.blockParams.length) {
18404       return "";
18405     }
18406
18407     return concat$7([" as |", block.program.blockParams.join(" "), "|"]);
18408   }
18409
18410   function printOpenBlock(path, print) {
18411     return group$6(concat$7(["{{#", printPathParams(path, print), printBlockParams(path), softline$3, "}}"]));
18412   }
18413
18414   function printCloseBlock(path, print) {
18415     return concat$7(["{{/", path.call(print, "path"), "}}"]);
18416   }
18417
18418   function isWhitespaceNode(node) {
18419     return node.type === "TextNode" && !/\S/.test(node.chars);
18420   }
18421
18422   function getPreviousNode(path) {
18423     var node = path.getValue();
18424     var parentNode = path.getParentNode(0);
18425     var children = parentNode.children || parentNode.body;
18426
18427     if (children) {
18428       var nodeIndex = children.indexOf(node);
18429
18430       if (nodeIndex > 0) {
18431         var previousNode = children[nodeIndex - 1];
18432         return previousNode;
18433       }
18434     }
18435   }
18436
18437   function getNextNode(path) {
18438     var node = path.getValue();
18439     var parentNode = path.getParentNode(0);
18440     var children = parentNode.children || parentNode.body;
18441
18442     if (children) {
18443       var nodeIndex = children.indexOf(node);
18444
18445       if (nodeIndex < children.length) {
18446         var nextNode = children[nodeIndex + 1];
18447         return nextNode;
18448       }
18449     }
18450   }
18451
18452   function isPreviousNodeOfSomeType(path, types) {
18453     var previousNode = getPreviousNode(path);
18454
18455     if (previousNode) {
18456       return types.some(function (type) {
18457         return previousNode.type === type;
18458       });
18459     }
18460
18461     return false;
18462   }
18463
18464   function isNextNodeOfType(path, type) {
18465     var nextNode = getNextNode(path);
18466     return nextNode && nextNode.type === type;
18467   }
18468
18469   function clean$2(ast, newObj) {
18470     delete newObj.loc;
18471     delete newObj.selfClosing; // (Glimmer/HTML) ignore TextNode whitespace
18472
18473     if (ast.type === "TextNode") {
18474       if (ast.chars.replace(/\s+/, "") === "") {
18475         return null;
18476       }
18477
18478       newObj.chars = ast.chars.replace(/^\s+/, "").replace(/\s+$/, "");
18479     }
18480   }
18481
18482   function countNewLines(string) {
18483     /* istanbul ignore next */
18484     string = typeof string === "string" ? string : "";
18485     return string.split("\n").length - 1;
18486   }
18487
18488   function countLeadingNewLines(string) {
18489     /* istanbul ignore next */
18490     string = typeof string === "string" ? string : "";
18491     var newLines = (string.match(/^([^\S\r\n]*[\r\n])+/g) || [])[0] || "";
18492     return countNewLines(newLines);
18493   }
18494
18495   function countTrailingNewLines(string) {
18496     /* istanbul ignore next */
18497     string = typeof string === "string" ? string : "";
18498     var newLines = (string.match(/([\r\n][^\S\r\n]*)+$/g) || [])[0] || "";
18499     return countNewLines(newLines);
18500   }
18501
18502   function generateHardlines() {
18503     var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
18504     var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
18505     return new Array(Math.min(number, max)).fill(hardline$6);
18506   }
18507
18508   var printerGlimmer = {
18509     print: print,
18510     massageAstNode: clean$2
18511   };
18512
18513   var name$6 = "Handlebars";
18514   var type$5 = "markup";
18515   var group$7 = "HTML";
18516   var aliases = [
18517         "hbs",
18518         "htmlbars"
18519   ];
18520   var extensions$5 = [
18521         ".handlebars",
18522         ".hbs"
18523   ];
18524   var tmScope$5 = "text.html.handlebars";
18525   var aceMode$5 = "handlebars";
18526   var languageId$5 = 155;
18527   var Handlebars = {
18528         name: name$6,
18529         type: type$5,
18530         group: group$7,
18531         aliases: aliases,
18532         extensions: extensions$5,
18533         tmScope: tmScope$5,
18534         aceMode: aceMode$5,
18535         languageId: languageId$5
18536   };
18537
18538   var Handlebars$1 = /*#__PURE__*/Object.freeze({
18539     __proto__: null,
18540     name: name$6,
18541     type: type$5,
18542     group: group$7,
18543     aliases: aliases,
18544     extensions: extensions$5,
18545     tmScope: tmScope$5,
18546     aceMode: aceMode$5,
18547     languageId: languageId$5,
18548     'default': Handlebars
18549   });
18550
18551   var require$$0$4 = getCjsExportFromNamespace(Handlebars$1);
18552
18553   var languages$2 = [createLanguage(require$$0$4, function (data) {
18554     return Object.assign(data, {
18555       since: null,
18556       // unreleased
18557       parsers: ["glimmer"],
18558       vscodeLanguageIds: ["handlebars"]
18559     });
18560   })];
18561   var printers$2 = {
18562     glimmer: printerGlimmer
18563   };
18564   var languageHandlebars = {
18565     languages: languages$2,
18566     printers: printers$2
18567   };
18568
18569   var clean$3 = function clean(ast, newNode) {
18570     delete newNode.sourceSpan;
18571     delete newNode.startSourceSpan;
18572     delete newNode.endSourceSpan;
18573     delete newNode.nameSpan;
18574     delete newNode.valueSpan;
18575
18576     if (ast.type === "text" || ast.type === "comment") {
18577       return null;
18578     } // may be formatted by multiparser
18579
18580
18581     if (ast.type === "yaml" || ast.type === "toml") {
18582       return null;
18583     }
18584
18585     if (ast.type === "attribute") {
18586       delete newNode.value;
18587     }
18588
18589     if (ast.type === "docType") {
18590       delete newNode.value;
18591     }
18592   };
18593
18594   var json = {
18595     "CSS_DISPLAY_TAGS": {
18596       "area": "none",
18597       "base": "none",
18598       "basefont": "none",
18599       "datalist": "none",
18600       "head": "none",
18601       "link": "none",
18602       "meta": "none",
18603       "noembed": "none",
18604       "noframes": "none",
18605       "param": "none",
18606       "rp": "none",
18607       "script": "block",
18608       "source": "block",
18609       "style": "none",
18610       "template": "inline",
18611       "track": "block",
18612       "title": "none",
18613       "html": "block",
18614       "body": "block",
18615       "address": "block",
18616       "blockquote": "block",
18617       "center": "block",
18618       "div": "block",
18619       "figure": "block",
18620       "figcaption": "block",
18621       "footer": "block",
18622       "form": "block",
18623       "header": "block",
18624       "hr": "block",
18625       "legend": "block",
18626       "listing": "block",
18627       "main": "block",
18628       "p": "block",
18629       "plaintext": "block",
18630       "pre": "block",
18631       "xmp": "block",
18632       "slot": "contents",
18633       "ruby": "ruby",
18634       "rt": "ruby-text",
18635       "article": "block",
18636       "aside": "block",
18637       "h1": "block",
18638       "h2": "block",
18639       "h3": "block",
18640       "h4": "block",
18641       "h5": "block",
18642       "h6": "block",
18643       "hgroup": "block",
18644       "nav": "block",
18645       "section": "block",
18646       "dir": "block",
18647       "dd": "block",
18648       "dl": "block",
18649       "dt": "block",
18650       "ol": "block",
18651       "ul": "block",
18652       "li": "list-item",
18653       "table": "table",
18654       "caption": "table-caption",
18655       "colgroup": "table-column-group",
18656       "col": "table-column",
18657       "thead": "table-header-group",
18658       "tbody": "table-row-group",
18659       "tfoot": "table-footer-group",
18660       "tr": "table-row",
18661       "td": "table-cell",
18662       "th": "table-cell",
18663       "fieldset": "block",
18664       "button": "inline-block",
18665       "video": "inline-block",
18666       "audio": "inline-block"
18667     },
18668     "CSS_DISPLAY_DEFAULT": "inline",
18669     "CSS_WHITE_SPACE_TAGS": {
18670       "listing": "pre",
18671       "plaintext": "pre",
18672       "pre": "pre",
18673       "xmp": "pre",
18674       "nobr": "nowrap",
18675       "table": "initial",
18676       "textarea": "pre-wrap"
18677     },
18678     "CSS_WHITE_SPACE_DEFAULT": "normal"
18679   };
18680
18681   var a = [
18682         "accesskey",
18683         "charset",
18684         "coords",
18685         "download",
18686         "href",
18687         "hreflang",
18688         "name",
18689         "ping",
18690         "referrerpolicy",
18691         "rel",
18692         "rev",
18693         "shape",
18694         "tabindex",
18695         "target",
18696         "type"
18697   ];
18698   var abbr = [
18699         "title"
18700   ];
18701   var applet = [
18702         "align",
18703         "alt",
18704         "archive",
18705         "code",
18706         "codebase",
18707         "height",
18708         "hspace",
18709         "name",
18710         "object",
18711         "vspace",
18712         "width"
18713   ];
18714   var area = [
18715         "accesskey",
18716         "alt",
18717         "coords",
18718         "download",
18719         "href",
18720         "hreflang",
18721         "nohref",
18722         "ping",
18723         "referrerpolicy",
18724         "rel",
18725         "shape",
18726         "tabindex",
18727         "target",
18728         "type"
18729   ];
18730   var audio = [
18731         "autoplay",
18732         "controls",
18733         "crossorigin",
18734         "loop",
18735         "muted",
18736         "preload",
18737         "src"
18738   ];
18739   var base = [
18740         "href",
18741         "target"
18742   ];
18743   var basefont = [
18744         "color",
18745         "face",
18746         "size"
18747   ];
18748   var bdo = [
18749         "dir"
18750   ];
18751   var blockquote = [
18752         "cite"
18753   ];
18754   var body = [
18755         "alink",
18756         "background",
18757         "bgcolor",
18758         "link",
18759         "text",
18760         "vlink"
18761   ];
18762   var br = [
18763         "clear"
18764   ];
18765   var button = [
18766         "accesskey",
18767         "autofocus",
18768         "disabled",
18769         "form",
18770         "formaction",
18771         "formenctype",
18772         "formmethod",
18773         "formnovalidate",
18774         "formtarget",
18775         "name",
18776         "tabindex",
18777         "type",
18778         "value"
18779   ];
18780   var canvas = [
18781         "height",
18782         "width"
18783   ];
18784   var caption = [
18785         "align"
18786   ];
18787   var col = [
18788         "align",
18789         "char",
18790         "charoff",
18791         "span",
18792         "valign",
18793         "width"
18794   ];
18795   var colgroup = [
18796         "align",
18797         "char",
18798         "charoff",
18799         "span",
18800         "valign",
18801         "width"
18802   ];
18803   var data = [
18804         "value"
18805   ];
18806   var del = [
18807         "cite",
18808         "datetime"
18809   ];
18810   var details = [
18811         "open"
18812   ];
18813   var dfn = [
18814         "title"
18815   ];
18816   var dialog = [
18817         "open"
18818   ];
18819   var dir = [
18820         "compact"
18821   ];
18822   var div = [
18823         "align"
18824   ];
18825   var dl = [
18826         "compact"
18827   ];
18828   var embed$1 = [
18829         "height",
18830         "src",
18831         "type",
18832         "width"
18833   ];
18834   var fieldset = [
18835         "disabled",
18836         "form",
18837         "name"
18838   ];
18839   var font = [
18840         "color",
18841         "face",
18842         "size"
18843   ];
18844   var form = [
18845         "accept",
18846         "accept-charset",
18847         "action",
18848         "autocomplete",
18849         "enctype",
18850         "method",
18851         "name",
18852         "novalidate",
18853         "target"
18854   ];
18855   var frame = [
18856         "frameborder",
18857         "longdesc",
18858         "marginheight",
18859         "marginwidth",
18860         "name",
18861         "noresize",
18862         "scrolling",
18863         "src"
18864   ];
18865   var frameset = [
18866         "cols",
18867         "rows"
18868   ];
18869   var h1 = [
18870         "align"
18871   ];
18872   var h2 = [
18873         "align"
18874   ];
18875   var h3 = [
18876         "align"
18877   ];
18878   var h4 = [
18879         "align"
18880   ];
18881   var h5 = [
18882         "align"
18883   ];
18884   var h6 = [
18885         "align"
18886   ];
18887   var head = [
18888         "profile"
18889   ];
18890   var hr = [
18891         "align",
18892         "noshade",
18893         "size",
18894         "width"
18895   ];
18896   var html = [
18897         "manifest",
18898         "version"
18899   ];
18900   var iframe = [
18901         "align",
18902         "allow",
18903         "allowfullscreen",
18904         "allowpaymentrequest",
18905         "allowusermedia",
18906         "frameborder",
18907         "height",
18908         "longdesc",
18909         "marginheight",
18910         "marginwidth",
18911         "name",
18912         "referrerpolicy",
18913         "sandbox",
18914         "scrolling",
18915         "src",
18916         "srcdoc",
18917         "width"
18918   ];
18919   var img = [
18920         "align",
18921         "alt",
18922         "border",
18923         "crossorigin",
18924         "decoding",
18925         "height",
18926         "hspace",
18927         "ismap",
18928         "longdesc",
18929         "name",
18930         "referrerpolicy",
18931         "sizes",
18932         "src",
18933         "srcset",
18934         "usemap",
18935         "vspace",
18936         "width"
18937   ];
18938   var input = [
18939         "accept",
18940         "accesskey",
18941         "align",
18942         "alt",
18943         "autocomplete",
18944         "autofocus",
18945         "checked",
18946         "dirname",
18947         "disabled",
18948         "form",
18949         "formaction",
18950         "formenctype",
18951         "formmethod",
18952         "formnovalidate",
18953         "formtarget",
18954         "height",
18955         "ismap",
18956         "list",
18957         "max",
18958         "maxlength",
18959         "min",
18960         "minlength",
18961         "multiple",
18962         "name",
18963         "pattern",
18964         "placeholder",
18965         "readonly",
18966         "required",
18967         "size",
18968         "src",
18969         "step",
18970         "tabindex",
18971         "title",
18972         "type",
18973         "usemap",
18974         "value",
18975         "width"
18976   ];
18977   var ins = [
18978         "cite",
18979         "datetime"
18980   ];
18981   var isindex = [
18982         "prompt"
18983   ];
18984   var label = [
18985         "accesskey",
18986         "for",
18987         "form"
18988   ];
18989   var legend = [
18990         "accesskey",
18991         "align"
18992   ];
18993   var li = [
18994         "type",
18995         "value"
18996   ];
18997   var link$1 = [
18998         "as",
18999         "charset",
19000         "color",
19001         "crossorigin",
19002         "href",
19003         "hreflang",
19004         "imagesizes",
19005         "imagesrcset",
19006         "integrity",
19007         "media",
19008         "nonce",
19009         "referrerpolicy",
19010         "rel",
19011         "rev",
19012         "sizes",
19013         "target",
19014         "title",
19015         "type"
19016   ];
19017   var map = [
19018         "name"
19019   ];
19020   var menu = [
19021         "compact"
19022   ];
19023   var meta = [
19024         "charset",
19025         "content",
19026         "http-equiv",
19027         "name",
19028         "scheme"
19029   ];
19030   var meter = [
19031         "high",
19032         "low",
19033         "max",
19034         "min",
19035         "optimum",
19036         "value"
19037   ];
19038   var object = [
19039         "align",
19040         "archive",
19041         "border",
19042         "classid",
19043         "codebase",
19044         "codetype",
19045         "data",
19046         "declare",
19047         "form",
19048         "height",
19049         "hspace",
19050         "name",
19051         "standby",
19052         "tabindex",
19053         "type",
19054         "typemustmatch",
19055         "usemap",
19056         "vspace",
19057         "width"
19058   ];
19059   var ol = [
19060         "compact",
19061         "reversed",
19062         "start",
19063         "type"
19064   ];
19065   var optgroup = [
19066         "disabled",
19067         "label"
19068   ];
19069   var option = [
19070         "disabled",
19071         "label",
19072         "selected",
19073         "value"
19074   ];
19075   var output = [
19076         "for",
19077         "form",
19078         "name"
19079   ];
19080   var p = [
19081         "align"
19082   ];
19083   var param = [
19084         "name",
19085         "type",
19086         "value",
19087         "valuetype"
19088   ];
19089   var pre = [
19090         "width"
19091   ];
19092   var progress = [
19093         "max",
19094         "value"
19095   ];
19096   var q = [
19097         "cite"
19098   ];
19099   var script = [
19100         "async",
19101         "charset",
19102         "crossorigin",
19103         "defer",
19104         "integrity",
19105         "language",
19106         "nomodule",
19107         "nonce",
19108         "referrerpolicy",
19109         "src",
19110         "type"
19111   ];
19112   var select = [
19113         "autocomplete",
19114         "autofocus",
19115         "disabled",
19116         "form",
19117         "multiple",
19118         "name",
19119         "required",
19120         "size",
19121         "tabindex"
19122   ];
19123   var slot = [
19124         "name"
19125   ];
19126   var source = [
19127         "media",
19128         "sizes",
19129         "src",
19130         "srcset",
19131         "type"
19132   ];
19133   var style = [
19134         "media",
19135         "nonce",
19136         "title",
19137         "type"
19138   ];
19139   var table = [
19140         "align",
19141         "bgcolor",
19142         "border",
19143         "cellpadding",
19144         "cellspacing",
19145         "frame",
19146         "rules",
19147         "summary",
19148         "width"
19149   ];
19150   var tbody = [
19151         "align",
19152         "char",
19153         "charoff",
19154         "valign"
19155   ];
19156   var td = [
19157         "abbr",
19158         "align",
19159         "axis",
19160         "bgcolor",
19161         "char",
19162         "charoff",
19163         "colspan",
19164         "headers",
19165         "height",
19166         "nowrap",
19167         "rowspan",
19168         "scope",
19169         "valign",
19170         "width"
19171   ];
19172   var textarea = [
19173         "accesskey",
19174         "autocomplete",
19175         "autofocus",
19176         "cols",
19177         "dirname",
19178         "disabled",
19179         "form",
19180         "maxlength",
19181         "minlength",
19182         "name",
19183         "placeholder",
19184         "readonly",
19185         "required",
19186         "rows",
19187         "tabindex",
19188         "wrap"
19189   ];
19190   var tfoot = [
19191         "align",
19192         "char",
19193         "charoff",
19194         "valign"
19195   ];
19196   var th = [
19197         "abbr",
19198         "align",
19199         "axis",
19200         "bgcolor",
19201         "char",
19202         "charoff",
19203         "colspan",
19204         "headers",
19205         "height",
19206         "nowrap",
19207         "rowspan",
19208         "scope",
19209         "valign",
19210         "width"
19211   ];
19212   var thead = [
19213         "align",
19214         "char",
19215         "charoff",
19216         "valign"
19217   ];
19218   var time = [
19219         "datetime"
19220   ];
19221   var tr = [
19222         "align",
19223         "bgcolor",
19224         "char",
19225         "charoff",
19226         "valign"
19227   ];
19228   var track = [
19229         "default",
19230         "kind",
19231         "label",
19232         "src",
19233         "srclang"
19234   ];
19235   var ul = [
19236         "compact",
19237         "type"
19238   ];
19239   var video = [
19240         "autoplay",
19241         "controls",
19242         "crossorigin",
19243         "height",
19244         "loop",
19245         "muted",
19246         "playsinline",
19247         "poster",
19248         "preload",
19249         "src",
19250         "width"
19251   ];
19252   var index$1 = {
19253         "*": [
19254         "accesskey",
19255         "autocapitalize",
19256         "autofocus",
19257         "class",
19258         "contenteditable",
19259         "dir",
19260         "draggable",
19261         "enterkeyhint",
19262         "hidden",
19263         "id",
19264         "inputmode",
19265         "is",
19266         "itemid",
19267         "itemprop",
19268         "itemref",
19269         "itemscope",
19270         "itemtype",
19271         "lang",
19272         "nonce",
19273         "slot",
19274         "spellcheck",
19275         "style",
19276         "tabindex",
19277         "title",
19278         "translate"
19279   ],
19280         a: a,
19281         abbr: abbr,
19282         applet: applet,
19283         area: area,
19284         audio: audio,
19285         base: base,
19286         basefont: basefont,
19287         bdo: bdo,
19288         blockquote: blockquote,
19289         body: body,
19290         br: br,
19291         button: button,
19292         canvas: canvas,
19293         caption: caption,
19294         col: col,
19295         colgroup: colgroup,
19296         data: data,
19297         del: del,
19298         details: details,
19299         dfn: dfn,
19300         dialog: dialog,
19301         dir: dir,
19302         div: div,
19303         dl: dl,
19304         embed: embed$1,
19305         fieldset: fieldset,
19306         font: font,
19307         form: form,
19308         frame: frame,
19309         frameset: frameset,
19310         h1: h1,
19311         h2: h2,
19312         h3: h3,
19313         h4: h4,
19314         h5: h5,
19315         h6: h6,
19316         head: head,
19317         hr: hr,
19318         html: html,
19319         iframe: iframe,
19320         img: img,
19321         input: input,
19322         ins: ins,
19323         isindex: isindex,
19324         label: label,
19325         legend: legend,
19326         li: li,
19327         link: link$1,
19328         map: map,
19329         menu: menu,
19330         meta: meta,
19331         meter: meter,
19332         object: object,
19333         ol: ol,
19334         optgroup: optgroup,
19335         option: option,
19336         output: output,
19337         p: p,
19338         param: param,
19339         pre: pre,
19340         progress: progress,
19341         q: q,
19342         script: script,
19343         select: select,
19344         slot: slot,
19345         source: source,
19346         style: style,
19347         table: table,
19348         tbody: tbody,
19349         td: td,
19350         textarea: textarea,
19351         tfoot: tfoot,
19352         th: th,
19353         thead: thead,
19354         time: time,
19355         tr: tr,
19356         track: track,
19357         ul: ul,
19358         video: video
19359   };
19360
19361   var htmlElementAttributes = /*#__PURE__*/Object.freeze({
19362     __proto__: null,
19363     a: a,
19364     abbr: abbr,
19365     applet: applet,
19366     area: area,
19367     audio: audio,
19368     base: base,
19369     basefont: basefont,
19370     bdo: bdo,
19371     blockquote: blockquote,
19372     body: body,
19373     br: br,
19374     button: button,
19375     canvas: canvas,
19376     caption: caption,
19377     col: col,
19378     colgroup: colgroup,
19379     data: data,
19380     del: del,
19381     details: details,
19382     dfn: dfn,
19383     dialog: dialog,
19384     dir: dir,
19385     div: div,
19386     dl: dl,
19387     embed: embed$1,
19388     fieldset: fieldset,
19389     font: font,
19390     form: form,
19391     frame: frame,
19392     frameset: frameset,
19393     h1: h1,
19394     h2: h2,
19395     h3: h3,
19396     h4: h4,
19397     h5: h5,
19398     h6: h6,
19399     head: head,
19400     hr: hr,
19401     html: html,
19402     iframe: iframe,
19403     img: img,
19404     input: input,
19405     ins: ins,
19406     isindex: isindex,
19407     label: label,
19408     legend: legend,
19409     li: li,
19410     link: link$1,
19411     map: map,
19412     menu: menu,
19413     meta: meta,
19414     meter: meter,
19415     object: object,
19416     ol: ol,
19417     optgroup: optgroup,
19418     option: option,
19419     output: output,
19420     p: p,
19421     param: param,
19422     pre: pre,
19423     progress: progress,
19424     q: q,
19425     script: script,
19426     select: select,
19427     slot: slot,
19428     source: source,
19429     style: style,
19430     table: table,
19431     tbody: tbody,
19432     td: td,
19433     textarea: textarea,
19434     tfoot: tfoot,
19435     th: th,
19436     thead: thead,
19437     time: time,
19438     tr: tr,
19439     track: track,
19440     ul: ul,
19441     video: video,
19442     'default': index$1
19443   });
19444
19445   var htmlElementAttributes$1 = getCjsExportFromNamespace(htmlElementAttributes);
19446
19447   var CSS_DISPLAY_TAGS = json.CSS_DISPLAY_TAGS,
19448       CSS_DISPLAY_DEFAULT = json.CSS_DISPLAY_DEFAULT,
19449       CSS_WHITE_SPACE_TAGS = json.CSS_WHITE_SPACE_TAGS,
19450       CSS_WHITE_SPACE_DEFAULT = json.CSS_WHITE_SPACE_DEFAULT;
19451   var HTML_TAGS = arrayToMap(htmlTagNames$1);
19452   var HTML_ELEMENT_ATTRIBUTES = mapObject(htmlElementAttributes$1, arrayToMap);
19453
19454   function arrayToMap(array) {
19455     var map = Object.create(null);
19456     var _iteratorNormalCompletion = true;
19457     var _didIteratorError = false;
19458     var _iteratorError = undefined;
19459
19460     try {
19461       for (var _iterator = array[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
19462         var value = _step.value;
19463         map[value] = true;
19464       }
19465     } catch (err) {
19466       _didIteratorError = true;
19467       _iteratorError = err;
19468     } finally {
19469       try {
19470         if (!_iteratorNormalCompletion && _iterator.return != null) {
19471           _iterator.return();
19472         }
19473       } finally {
19474         if (_didIteratorError) {
19475           throw _iteratorError;
19476         }
19477       }
19478     }
19479
19480     return map;
19481   }
19482
19483   function mapObject(object, fn) {
19484     var newObject = Object.create(null);
19485
19486     for (var _i = 0, _Object$keys = Object.keys(object); _i < _Object$keys.length; _i++) {
19487       var key = _Object$keys[_i];
19488       newObject[key] = fn(object[key], key);
19489     }
19490
19491     return newObject;
19492   }
19493
19494   function shouldPreserveContent(node, options) {
19495     if (node.type === "element" && node.fullName === "template" && node.attrMap.lang && node.attrMap.lang !== "html") {
19496       return true;
19497     } // unterminated node in ie conditional comment
19498     // e.g. <!--[if lt IE 9]><html><![endif]-->
19499
19500
19501     if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
19502       return true;
19503     } // incomplete html in ie conditional comment
19504     // e.g. <!--[if lt IE 9]></div><![endif]-->
19505
19506
19507     if (node.type === "ieConditionalComment" && !node.complete) {
19508       return true;
19509     } // top-level elements (excluding <template>, <style> and <script>) in Vue SFC are considered custom block
19510     // custom blocks can be written in other languages so we should preserve them to not break the code
19511
19512
19513     if (options.parser === "vue" && node.type === "element" && node.parent.type === "root" && ["template", "style", "script", // vue parser can be used for vue dom template as well, so we should still format top-level <html>
19514     "html"].indexOf(node.fullName) === -1) {
19515       return true;
19516     } // TODO: handle non-text children in <pre>
19517
19518
19519     if (isPreLikeNode(node) && node.children.some(function (child) {
19520       return child.type !== "text" && child.type !== "interpolation";
19521     })) {
19522       return true;
19523     }
19524
19525     return false;
19526   }
19527
19528   function hasPrettierIgnore(node) {
19529     if (node.type === "attribute" || isTextLikeNode(node)) {
19530       return false;
19531     }
19532
19533     if (!node.parent) {
19534       return false;
19535     }
19536
19537     if (typeof node.index !== "number" || node.index === 0) {
19538       return false;
19539     }
19540
19541     var prevNode = node.parent.children[node.index - 1];
19542     return isPrettierIgnore(prevNode);
19543   }
19544
19545   function isPrettierIgnore(node) {
19546     return node.type === "comment" && node.value.trim() === "prettier-ignore";
19547   }
19548
19549   function getPrettierIgnoreAttributeCommentData(value) {
19550     var match = value.trim().match(/^prettier-ignore-attribute(?:\s+([^]+))?$/);
19551
19552     if (!match) {
19553       return false;
19554     }
19555
19556     if (!match[1]) {
19557       return true;
19558     }
19559
19560     return match[1].split(/\s+/);
19561   }
19562   /** there's no opening/closing tag or it's considered not breakable */
19563
19564
19565   function isTextLikeNode(node) {
19566     return node.type === "text" || node.type === "comment";
19567   }
19568
19569   function isScriptLikeTag(node) {
19570     return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style");
19571   }
19572
19573   function isFrontMatterNode(node) {
19574     return node.type === "yaml" || node.type === "toml";
19575   }
19576
19577   function canHaveInterpolation(node) {
19578     return node.children && !isScriptLikeTag(node);
19579   }
19580
19581   function isWhitespaceSensitiveNode(node) {
19582     return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
19583   }
19584
19585   function isIndentationSensitiveNode(node) {
19586     return getNodeCssStyleWhiteSpace(node).startsWith("pre");
19587   }
19588
19589   function isLeadingSpaceSensitiveNode(node) {
19590     var isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
19591
19592     if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
19593       return node.type === "interpolation";
19594     }
19595
19596     return isLeadingSpaceSensitive;
19597
19598     function _isLeadingSpaceSensitiveNode() {
19599       if (isFrontMatterNode(node)) {
19600         return false;
19601       }
19602
19603       if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
19604         return true;
19605       }
19606
19607       if (!node.parent || node.parent.cssDisplay === "none") {
19608         return false;
19609       }
19610
19611       if (isPreLikeNode(node.parent)) {
19612         return true;
19613       }
19614
19615       if (!node.prev && (node.parent.type === "root" || isScriptLikeTag(node.parent) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
19616         return false;
19617       }
19618
19619       if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
19620         return false;
19621       }
19622
19623       return true;
19624     }
19625   }
19626
19627   function isTrailingSpaceSensitiveNode(node) {
19628     if (isFrontMatterNode(node)) {
19629       return false;
19630     }
19631
19632     if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
19633       return true;
19634     }
19635
19636     if (!node.parent || node.parent.cssDisplay === "none") {
19637       return false;
19638     }
19639
19640     if (isPreLikeNode(node.parent)) {
19641       return true;
19642     }
19643
19644     if (!node.next && (node.parent.type === "root" || isScriptLikeTag(node.parent) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
19645       return false;
19646     }
19647
19648     if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
19649       return false;
19650     }
19651
19652     return true;
19653   }
19654
19655   function isDanglingSpaceSensitiveNode(node) {
19656     return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
19657   }
19658
19659   function forceNextEmptyLine(node) {
19660     return isFrontMatterNode(node) || node.next && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
19661   }
19662   /** firstChild leadingSpaces and lastChild trailingSpaces */
19663
19664
19665   function forceBreakContent(node) {
19666     return forceBreakChildren(node) || node.type === "element" && node.children.length !== 0 && (["body", "script", "style"].indexOf(node.name) !== -1 || node.children.some(function (child) {
19667       return hasNonTextChild(child);
19668     })) || node.firstChild && node.firstChild === node.lastChild && hasLeadingLineBreak(node.firstChild) && (!node.lastChild.isTrailingSpaceSensitive || hasTrailingLineBreak(node.lastChild));
19669   }
19670   /** spaces between children */
19671
19672
19673   function forceBreakChildren(node) {
19674     return node.type === "element" && node.children.length !== 0 && (["html", "head", "ul", "ol", "select"].indexOf(node.name) !== -1 || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
19675   }
19676
19677   function preferHardlineAsLeadingSpaces(node) {
19678     return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
19679   }
19680
19681   function preferHardlineAsTrailingSpaces(node) {
19682     return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
19683   }
19684
19685   function hasSurroundingLineBreak(node) {
19686     return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
19687   }
19688
19689   function hasLeadingLineBreak(node) {
19690     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);
19691   }
19692
19693   function hasTrailingLineBreak(node) {
19694     return node.hasTrailingSpaces && (node.next ? node.next.sourceSpan.start.line > node.sourceSpan.end.line : node.parent.type === "root" || node.parent.endSourceSpan.start.line > node.sourceSpan.end.line);
19695   }
19696
19697   function preferHardlineAsSurroundingSpaces(node) {
19698     switch (node.type) {
19699       case "ieConditionalComment":
19700       case "comment":
19701       case "directive":
19702         return true;
19703
19704       case "element":
19705         return ["script", "select"].indexOf(node.name) !== -1;
19706     }
19707
19708     return false;
19709   }
19710
19711   function getLastDescendant(node) {
19712     return node.lastChild ? getLastDescendant(node.lastChild) : node;
19713   }
19714
19715   function hasNonTextChild(node) {
19716     return node.children && node.children.some(function (child) {
19717       return child.type !== "text";
19718     });
19719   }
19720
19721   function inferScriptParser(node) {
19722     if (node.name === "script" && !node.attrMap.src) {
19723       if (!node.attrMap.lang && !node.attrMap.type || node.attrMap.type === "module" || node.attrMap.type === "text/javascript" || node.attrMap.type === "text/babel" || node.attrMap.type === "application/javascript") {
19724         return "babel";
19725       }
19726
19727       if (node.attrMap.type === "application/x-typescript" || node.attrMap.lang === "ts" || node.attrMap.lang === "tsx") {
19728         return "typescript";
19729       }
19730
19731       if (node.attrMap.type === "text/markdown") {
19732         return "markdown";
19733       }
19734
19735       if (node.attrMap.type.endsWith("json") || node.attrMap.type.endsWith("importmap")) {
19736         return "json";
19737       }
19738     }
19739
19740     if (node.name === "style") {
19741       if (!node.attrMap.lang || node.attrMap.lang === "postcss" || node.attrMap.lang === "css") {
19742         return "css";
19743       }
19744
19745       if (node.attrMap.lang === "scss") {
19746         return "scss";
19747       }
19748
19749       if (node.attrMap.lang === "less") {
19750         return "less";
19751       }
19752     }
19753
19754     return null;
19755   }
19756
19757   function isBlockLikeCssDisplay(cssDisplay) {
19758     return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
19759   }
19760
19761   function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
19762     return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
19763   }
19764
19765   function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
19766     return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
19767   }
19768
19769   function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
19770     return !isBlockLikeCssDisplay(cssDisplay);
19771   }
19772
19773   function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
19774     return !isBlockLikeCssDisplay(cssDisplay);
19775   }
19776
19777   function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
19778     return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
19779   }
19780
19781   function isPreLikeNode(node) {
19782     return getNodeCssStyleWhiteSpace(node).startsWith("pre");
19783   }
19784
19785   function countParents(path) {
19786     var predicate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
19787       return true;
19788     };
19789     var counter = 0;
19790
19791     for (var i = path.stack.length - 1; i >= 0; i--) {
19792       var value = path.stack[i];
19793
19794       if (value && _typeof(value) === "object" && !Array.isArray(value) && predicate(value)) {
19795         counter++;
19796       }
19797     }
19798
19799     return counter;
19800   }
19801
19802   function hasParent(node, fn) {
19803     var current = node;
19804
19805     while (current) {
19806       if (fn(current)) {
19807         return true;
19808       }
19809
19810       current = current.parent;
19811     }
19812
19813     return false;
19814   }
19815
19816   function getNodeCssStyleDisplay(node, options) {
19817     if (node.prev && node.prev.type === "comment") {
19818       // <!-- display: block -->
19819       var match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
19820
19821       if (match) {
19822         return match[1];
19823       }
19824     }
19825
19826     var isInSvgForeignObject = false;
19827
19828     if (node.type === "element" && node.namespace === "svg") {
19829       if (hasParent(node, function (parent) {
19830         return parent.fullName === "svg:foreignObject";
19831       })) {
19832         isInSvgForeignObject = true;
19833       } else {
19834         return node.name === "svg" ? "inline-block" : "block";
19835       }
19836     }
19837
19838     switch (options.htmlWhitespaceSensitivity) {
19839       case "strict":
19840         return "inline";
19841
19842       case "ignore":
19843         return "block";
19844
19845       default:
19846         return node.type === "element" && (!node.namespace || isInSvgForeignObject) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
19847     }
19848   }
19849
19850   function getNodeCssStyleWhiteSpace(node) {
19851     return node.type === "element" && !node.namespace && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
19852   }
19853
19854   function getMinIndentation(text) {
19855     var minIndentation = Infinity;
19856     var _iteratorNormalCompletion2 = true;
19857     var _didIteratorError2 = false;
19858     var _iteratorError2 = undefined;
19859
19860     try {
19861       for (var _iterator2 = text.split("\n")[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
19862         var lineText = _step2.value;
19863
19864         if (lineText.length === 0) {
19865           continue;
19866         }
19867
19868         if (/\S/.test(lineText[0])) {
19869           return 0;
19870         }
19871
19872         var indentation = lineText.match(/^\s*/)[0].length;
19873
19874         if (lineText.length === indentation) {
19875           continue;
19876         }
19877
19878         if (indentation < minIndentation) {
19879           minIndentation = indentation;
19880         }
19881       }
19882     } catch (err) {
19883       _didIteratorError2 = true;
19884       _iteratorError2 = err;
19885     } finally {
19886       try {
19887         if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
19888           _iterator2.return();
19889         }
19890       } finally {
19891         if (_didIteratorError2) {
19892           throw _iteratorError2;
19893         }
19894       }
19895     }
19896
19897     return minIndentation === Infinity ? 0 : minIndentation;
19898   }
19899
19900   function dedentString(text) {
19901     var minIndent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getMinIndentation(text);
19902     return minIndent === 0 ? text : text.split("\n").map(function (lineText) {
19903       return lineText.slice(minIndent);
19904     }).join("\n");
19905   }
19906
19907   function normalizeParts(parts) {
19908     var newParts = [];
19909     var restParts = parts.slice();
19910
19911     while (restParts.length !== 0) {
19912       var part = restParts.shift();
19913
19914       if (!part) {
19915         continue;
19916       }
19917
19918       if (part.type === "concat") {
19919         Array.prototype.unshift.apply(restParts, part.parts);
19920         continue;
19921       }
19922
19923       if (newParts.length !== 0 && typeof newParts[newParts.length - 1] === "string" && typeof part === "string") {
19924         newParts.push(newParts.pop() + part);
19925         continue;
19926       }
19927
19928       newParts.push(part);
19929     }
19930
19931     return newParts;
19932   }
19933
19934   function identity(x) {
19935     return x;
19936   }
19937
19938   function shouldNotPrintClosingTag(node, options) {
19939     return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore(node) || shouldPreserveContent(node.parent, options));
19940   }
19941
19942   function countChars(text, char) {
19943     var counter = 0;
19944
19945     for (var i = 0; i < text.length; i++) {
19946       if (text[i] === char) {
19947         counter++;
19948       }
19949     }
19950
19951     return counter;
19952   }
19953
19954   function unescapeQuoteEntities(text) {
19955     return text.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
19956   }
19957
19958   var utils$3 = {
19959     HTML_ELEMENT_ATTRIBUTES: HTML_ELEMENT_ATTRIBUTES,
19960     HTML_TAGS: HTML_TAGS,
19961     canHaveInterpolation: canHaveInterpolation,
19962     countChars: countChars,
19963     countParents: countParents,
19964     dedentString: dedentString,
19965     forceBreakChildren: forceBreakChildren,
19966     forceBreakContent: forceBreakContent,
19967     forceNextEmptyLine: forceNextEmptyLine,
19968     getLastDescendant: getLastDescendant,
19969     getNodeCssStyleDisplay: getNodeCssStyleDisplay,
19970     getNodeCssStyleWhiteSpace: getNodeCssStyleWhiteSpace,
19971     getPrettierIgnoreAttributeCommentData: getPrettierIgnoreAttributeCommentData,
19972     hasPrettierIgnore: hasPrettierIgnore,
19973     identity: identity,
19974     inferScriptParser: inferScriptParser,
19975     isDanglingSpaceSensitiveNode: isDanglingSpaceSensitiveNode,
19976     isFrontMatterNode: isFrontMatterNode,
19977     isIndentationSensitiveNode: isIndentationSensitiveNode,
19978     isLeadingSpaceSensitiveNode: isLeadingSpaceSensitiveNode,
19979     isPreLikeNode: isPreLikeNode,
19980     isScriptLikeTag: isScriptLikeTag,
19981     isTextLikeNode: isTextLikeNode,
19982     isTrailingSpaceSensitiveNode: isTrailingSpaceSensitiveNode,
19983     isWhitespaceSensitiveNode: isWhitespaceSensitiveNode,
19984     normalizeParts: normalizeParts,
19985     preferHardlineAsLeadingSpaces: preferHardlineAsLeadingSpaces,
19986     preferHardlineAsTrailingSpaces: preferHardlineAsTrailingSpaces,
19987     shouldNotPrintClosingTag: shouldNotPrintClosingTag,
19988     shouldPreserveContent: shouldPreserveContent,
19989     unescapeQuoteEntities: unescapeQuoteEntities
19990   };
19991
19992   var canHaveInterpolation$1 = utils$3.canHaveInterpolation,
19993       getNodeCssStyleDisplay$1 = utils$3.getNodeCssStyleDisplay,
19994       isDanglingSpaceSensitiveNode$1 = utils$3.isDanglingSpaceSensitiveNode,
19995       isIndentationSensitiveNode$1 = utils$3.isIndentationSensitiveNode,
19996       isLeadingSpaceSensitiveNode$1 = utils$3.isLeadingSpaceSensitiveNode,
19997       isTrailingSpaceSensitiveNode$1 = utils$3.isTrailingSpaceSensitiveNode,
19998       isWhitespaceSensitiveNode$1 = utils$3.isWhitespaceSensitiveNode;
19999   var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIeConditonalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText];
20000
20001   function preprocess(ast, options) {
20002     var _iteratorNormalCompletion = true;
20003     var _didIteratorError = false;
20004     var _iteratorError = undefined;
20005
20006     try {
20007       for (var _iterator = PREPROCESS_PIPELINE[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
20008         var fn = _step.value;
20009         ast = fn(ast, options);
20010       }
20011     } catch (err) {
20012       _didIteratorError = true;
20013       _iteratorError = err;
20014     } finally {
20015       try {
20016         if (!_iteratorNormalCompletion && _iterator.return != null) {
20017           _iterator.return();
20018         }
20019       } finally {
20020         if (_didIteratorError) {
20021           throw _iteratorError;
20022         }
20023       }
20024     }
20025
20026     return ast;
20027   }
20028
20029   function removeIgnorableFirstLf(ast
20030   /*, options */
20031   ) {
20032     return ast.map(function (node) {
20033       if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length !== 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
20034         var text = node.children[0];
20035         return node.clone({
20036           children: text.value.length === 1 ? node.children.slice(1) : [].concat(text.clone({
20037             value: text.value.slice(1)
20038           }), node.children.slice(1))
20039         });
20040       }
20041
20042       return node;
20043     });
20044   }
20045
20046   function mergeIeConditonalStartEndCommentIntoElementOpeningTag(ast
20047   /*, options */
20048   ) {
20049     /**
20050      *     <!--[if ...]><!--><target><!--<![endif]-->
20051      */
20052     var isTarget = function isTarget(node) {
20053       return 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;
20054     };
20055
20056     return ast.map(function (node) {
20057       if (node.children) {
20058         var isTargetResults = node.children.map(isTarget);
20059
20060         if (isTargetResults.some(Boolean)) {
20061           var newChildren = [];
20062
20063           for (var i = 0; i < node.children.length; i++) {
20064             var child = node.children[i];
20065
20066             if (isTargetResults[i + 1]) {
20067               // ieConditionalStartComment
20068               continue;
20069             }
20070
20071             if (isTargetResults[i]) {
20072               var ieConditionalStartComment = child.prev;
20073               var ieConditionalEndComment = child.firstChild;
20074               var ParseSourceSpan = child.sourceSpan.constructor;
20075               var startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
20076               var sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
20077               newChildren.push(child.clone({
20078                 condition: ieConditionalStartComment.condition,
20079                 sourceSpan: sourceSpan,
20080                 startSourceSpan: startSourceSpan,
20081                 children: child.children.slice(1)
20082               }));
20083               continue;
20084             }
20085
20086             newChildren.push(child);
20087           }
20088
20089           return node.clone({
20090             children: newChildren
20091           });
20092         }
20093       }
20094
20095       return node;
20096     });
20097   }
20098
20099   function mergeNodeIntoText(ast, shouldMerge, getValue) {
20100     return ast.map(function (node) {
20101       if (node.children) {
20102         var shouldMergeResults = node.children.map(shouldMerge);
20103
20104         if (shouldMergeResults.some(Boolean)) {
20105           var newChildren = [];
20106
20107           for (var i = 0; i < node.children.length; i++) {
20108             var child = node.children[i];
20109
20110             if (child.type !== "text" && !shouldMergeResults[i]) {
20111               newChildren.push(child);
20112               continue;
20113             }
20114
20115             var newChild = child.type === "text" ? child : child.clone({
20116               type: "text",
20117               value: getValue(child)
20118             });
20119
20120             if (newChildren.length === 0 || newChildren[newChildren.length - 1].type !== "text") {
20121               newChildren.push(newChild);
20122               continue;
20123             }
20124
20125             var lastChild = newChildren.pop();
20126             var ParseSourceSpan = lastChild.sourceSpan.constructor;
20127             newChildren.push(lastChild.clone({
20128               value: lastChild.value + newChild.value,
20129               sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, newChild.sourceSpan.end)
20130             }));
20131           }
20132
20133           return node.clone({
20134             children: newChildren
20135           });
20136         }
20137       }
20138
20139       return node;
20140     });
20141   }
20142
20143   function mergeCdataIntoText(ast
20144   /*, options */
20145   ) {
20146     return mergeNodeIntoText(ast, function (node) {
20147       return node.type === "cdata";
20148     }, function (node) {
20149       return "<![CDATA[".concat(node.value, "]]>");
20150     });
20151   }
20152
20153   function mergeSimpleElementIntoText(ast
20154   /*, options */
20155   ) {
20156     var isSimpleElement = function isSimpleElement(node) {
20157       return node.type === "element" && node.attrs.length === 0 && node.children.length === 1 && node.firstChild.type === "text" && // \xA0: non-breaking whitespace
20158       !/[^\S\xA0]/.test(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";
20159     };
20160
20161     return ast.map(function (node) {
20162       if (node.children) {
20163         var isSimpleElementResults = node.children.map(isSimpleElement);
20164
20165         if (isSimpleElementResults.some(Boolean)) {
20166           var newChildren = [];
20167
20168           for (var i = 0; i < node.children.length; i++) {
20169             var child = node.children[i];
20170
20171             if (isSimpleElementResults[i]) {
20172               var lastChild = newChildren.pop();
20173               var nextChild = node.children[++i];
20174               var ParseSourceSpan = node.sourceSpan.constructor;
20175               var isTrailingSpaceSensitive = nextChild.isTrailingSpaceSensitive,
20176                   hasTrailingSpaces = nextChild.hasTrailingSpaces;
20177               newChildren.push(lastChild.clone({
20178                 value: lastChild.value + "<".concat(child.rawName, ">") + child.firstChild.value + "</".concat(child.rawName, ">") + nextChild.value,
20179                 sourceSpan: new ParseSourceSpan(lastChild.sourceSpan.start, nextChild.sourceSpan.end),
20180                 isTrailingSpaceSensitive: isTrailingSpaceSensitive,
20181                 hasTrailingSpaces: hasTrailingSpaces
20182               }));
20183             } else {
20184               newChildren.push(child);
20185             }
20186           }
20187
20188           return node.clone({
20189             children: newChildren
20190           });
20191         }
20192       }
20193
20194       return node;
20195     });
20196   }
20197
20198   function extractInterpolation(ast, options) {
20199     if (options.parser === "html") {
20200       return ast;
20201     }
20202
20203     var interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
20204     return ast.map(function (node) {
20205       if (!canHaveInterpolation$1(node)) {
20206         return node;
20207       }
20208
20209       var newChildren = [];
20210       var _iteratorNormalCompletion2 = true;
20211       var _didIteratorError2 = false;
20212       var _iteratorError2 = undefined;
20213
20214       try {
20215         for (var _iterator2 = node.children[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
20216           var child = _step2.value;
20217
20218           if (child.type !== "text") {
20219             newChildren.push(child);
20220             continue;
20221           }
20222
20223           var ParseSourceSpan = child.sourceSpan.constructor;
20224           var startSourceSpan = child.sourceSpan.start;
20225           var endSourceSpan = null;
20226           var components = child.value.split(interpolationRegex);
20227
20228           for (var i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
20229             var value = components[i];
20230
20231             if (i % 2 === 0) {
20232               endSourceSpan = startSourceSpan.moveBy(value.length);
20233
20234               if (value.length !== 0) {
20235                 newChildren.push({
20236                   type: "text",
20237                   value: value,
20238                   sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
20239                 });
20240               }
20241
20242               continue;
20243             }
20244
20245             endSourceSpan = startSourceSpan.moveBy(value.length + 4); // `{{` + `}}`
20246
20247             newChildren.push({
20248               type: "interpolation",
20249               sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
20250               children: value.length === 0 ? [] : [{
20251                 type: "text",
20252                 value: value,
20253                 sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
20254               }]
20255             });
20256           }
20257         }
20258       } catch (err) {
20259         _didIteratorError2 = true;
20260         _iteratorError2 = err;
20261       } finally {
20262         try {
20263           if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
20264             _iterator2.return();
20265           }
20266         } finally {
20267           if (_didIteratorError2) {
20268             throw _iteratorError2;
20269           }
20270         }
20271       }
20272
20273       return node.clone({
20274         children: newChildren
20275       });
20276     });
20277   }
20278   /**
20279    * - add `hasLeadingSpaces` field
20280    * - add `hasTrailingSpaces` field
20281    * - add `hasDanglingSpaces` field for parent nodes
20282    * - add `isWhitespaceSensitive`, `isIndentationSensitive` field for text nodes
20283    * - remove insensitive whitespaces
20284    */
20285
20286
20287   function extractWhitespaces(ast
20288   /*, options*/
20289   ) {
20290     var TYPE_WHITESPACE = "whitespace";
20291     return ast.map(function (node) {
20292       if (!node.children) {
20293         return node;
20294       }
20295
20296       if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && node.children[0].value.trim().length === 0) {
20297         return node.clone({
20298           children: [],
20299           hasDanglingSpaces: node.children.length !== 0
20300         });
20301       }
20302
20303       var isWhitespaceSensitive = isWhitespaceSensitiveNode$1(node);
20304       var isIndentationSensitive = isIndentationSensitiveNode$1(node);
20305       return node.clone({
20306         isWhitespaceSensitive: isWhitespaceSensitive,
20307         isIndentationSensitive: isIndentationSensitive,
20308         children: node.children // extract whitespace nodes
20309         .reduce(function (newChildren, child) {
20310           if (child.type !== "text" || isWhitespaceSensitive) {
20311             return newChildren.concat(child);
20312           }
20313
20314           var localChildren = [];
20315
20316           var _child$value$match = child.value.match(/^(\s*)([\s\S]*?)(\s*)$/),
20317               _child$value$match2 = _slicedToArray(_child$value$match, 4),
20318               leadingSpaces = _child$value$match2[1],
20319               text = _child$value$match2[2],
20320               trailingSpaces = _child$value$match2[3];
20321
20322           if (leadingSpaces) {
20323             localChildren.push({
20324               type: TYPE_WHITESPACE
20325             });
20326           }
20327
20328           var ParseSourceSpan = child.sourceSpan.constructor;
20329
20330           if (text) {
20331             localChildren.push({
20332               type: "text",
20333               value: text,
20334               sourceSpan: new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingSpaces.length), child.sourceSpan.end.moveBy(-trailingSpaces.length))
20335             });
20336           }
20337
20338           if (trailingSpaces) {
20339             localChildren.push({
20340               type: TYPE_WHITESPACE
20341             });
20342           }
20343
20344           return newChildren.concat(localChildren);
20345         }, []) // set hasLeadingSpaces/hasTrailingSpaces and filter whitespace nodes
20346         .reduce(function (newChildren, child, i, children) {
20347           if (child.type === TYPE_WHITESPACE) {
20348             return newChildren;
20349           }
20350
20351           var hasLeadingSpaces = i !== 0 && children[i - 1].type === TYPE_WHITESPACE;
20352           var hasTrailingSpaces = i !== children.length - 1 && children[i + 1].type === TYPE_WHITESPACE;
20353           return newChildren.concat(Object.assign({}, child, {
20354             hasLeadingSpaces: hasLeadingSpaces,
20355             hasTrailingSpaces: hasTrailingSpaces
20356           }));
20357         }, [])
20358       });
20359     });
20360   }
20361
20362   function addIsSelfClosing(ast
20363   /*, options */
20364   ) {
20365     return ast.map(function (node) {
20366       return Object.assign(node, {
20367         isSelfClosing: !node.children || node.type === "element" && (node.tagDefinition.isVoid || // self-closing
20368         node.startSourceSpan === node.endSourceSpan)
20369       });
20370     });
20371   }
20372
20373   function addHasHtmComponentClosingTag(ast, options) {
20374     return ast.map(function (node) {
20375       return node.type !== "element" ? node : Object.assign(node, {
20376         hasHtmComponentClosingTag: node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset))
20377       });
20378     });
20379   }
20380
20381   function addCssDisplay(ast, options) {
20382     return ast.map(function (node) {
20383       return Object.assign(node, {
20384         cssDisplay: getNodeCssStyleDisplay$1(node, options)
20385       });
20386     });
20387   }
20388   /**
20389    * - add `isLeadingSpaceSensitive` field
20390    * - add `isTrailingSpaceSensitive` field
20391    * - add `isDanglingSpaceSensitive` field for parent nodes
20392    */
20393
20394
20395   function addIsSpaceSensitive(ast
20396   /*, options */
20397   ) {
20398     return ast.map(function (node) {
20399       if (!node.children) {
20400         return node;
20401       }
20402
20403       if (node.children.length === 0) {
20404         return node.clone({
20405           isDanglingSpaceSensitive: isDanglingSpaceSensitiveNode$1(node)
20406         });
20407       }
20408
20409       return node.clone({
20410         children: node.children.map(function (child) {
20411           return Object.assign({}, child, {
20412             isLeadingSpaceSensitive: isLeadingSpaceSensitiveNode$1(child),
20413             isTrailingSpaceSensitive: isTrailingSpaceSensitiveNode$1(child)
20414           });
20415         }).map(function (child, index, children) {
20416           return Object.assign({}, child, {
20417             isLeadingSpaceSensitive: index === 0 ? child.isLeadingSpaceSensitive : children[index - 1].isTrailingSpaceSensitive && child.isLeadingSpaceSensitive,
20418             isTrailingSpaceSensitive: index === children.length - 1 ? child.isTrailingSpaceSensitive : children[index + 1].isLeadingSpaceSensitive && child.isTrailingSpaceSensitive
20419           });
20420         })
20421       });
20422     });
20423   }
20424
20425   var preprocess_1 = preprocess;
20426
20427   function hasPragma$3(text) {
20428     return /^\s*<!--\s*@(format|prettier)\s*-->/.test(text);
20429   }
20430
20431   function insertPragma$5(text) {
20432     return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
20433   }
20434
20435   var pragma$3 = {
20436     hasPragma: hasPragma$3,
20437     insertPragma: insertPragma$5
20438   };
20439
20440   var _require$$0$builders$4 = doc.builders,
20441       concat$8 = _require$$0$builders$4.concat,
20442       group$8 = _require$$0$builders$4.group;
20443   /**
20444    *     v-for="... in ..."
20445    *     v-for="... of ..."
20446    *     v-for="(..., ...) in ..."
20447    *     v-for="(..., ...) of ..."
20448    */
20449
20450   function printVueFor(value, textToDoc) {
20451     var _parseVueFor = parseVueFor(value),
20452         left = _parseVueFor.left,
20453         operator = _parseVueFor.operator,
20454         right = _parseVueFor.right;
20455
20456     return concat$8([group$8(textToDoc("function _(".concat(left, ") {}"), {
20457       parser: "babel",
20458       __isVueForBindingLeft: true
20459     })), " ", operator, " ", textToDoc(right, {
20460       parser: "__js_expression"
20461     })]);
20462   } // modified from https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/parser/index.js#L370-L387
20463
20464
20465   function parseVueFor(value) {
20466     var forAliasRE = /([^]*?)\s+(in|of)\s+([^]*)/;
20467     var forIteratorRE = /,([^,}\]]*)(?:,([^,}\]]*))?$/;
20468     var stripParensRE = /^\(|\)$/g;
20469     var inMatch = value.match(forAliasRE);
20470
20471     if (!inMatch) {
20472       return;
20473     }
20474
20475     var res = {};
20476     res.for = inMatch[3].trim();
20477     var alias = inMatch[1].trim().replace(stripParensRE, "");
20478     var iteratorMatch = alias.match(forIteratorRE);
20479
20480     if (iteratorMatch) {
20481       res.alias = alias.replace(forIteratorRE, "");
20482       res.iterator1 = iteratorMatch[1].trim();
20483
20484       if (iteratorMatch[2]) {
20485         res.iterator2 = iteratorMatch[2].trim();
20486       }
20487     } else {
20488       res.alias = alias;
20489     }
20490
20491     return {
20492       left: "".concat([res.alias, res.iterator1, res.iterator2].filter(Boolean).join(",")),
20493       operator: inMatch[2],
20494       right: res.for
20495     };
20496   }
20497
20498   function printVueSlotScope(value, textToDoc) {
20499     return textToDoc("function _(".concat(value, ") {}"), {
20500       parser: "babel",
20501       __isVueSlotScope: true
20502     });
20503   }
20504
20505   function isVueEventBindingExpression(eventBindingValue) {
20506     // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/codegen/events.js#L3-L4
20507     // arrow function or anonymous function
20508     var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/; // simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
20509
20510     var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; // https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
20511
20512     var value = eventBindingValue.trim();
20513     return fnExpRE.test(value) || simplePathRE.test(value);
20514   }
20515
20516   var syntaxVue = {
20517     isVueEventBindingExpression: isVueEventBindingExpression,
20518     printVueFor: printVueFor,
20519     printVueSlotScope: printVueSlotScope
20520   };
20521
20522   var parseSrcset = createCommonjsModule(function (module) {
20523     /**
20524      * Srcset Parser
20525      *
20526      * By Alex Bell |  MIT License
20527      *
20528      * JS Parser for the string value that appears in markup <img srcset="here">
20529      *
20530      * @returns Array [{url: _, d: _, w: _, h:_}, ...]
20531      *
20532      * Based super duper closely on the reference algorithm at:
20533      * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute
20534      *
20535      * Most comments are copied in directly from the spec
20536      * (except for comments in parens).
20537      */
20538     (function (root, factory) {
20539       if ( module.exports) {
20540         // Node. Does not work with strict CommonJS, but
20541         // only CommonJS-like environments that support module.exports,
20542         // like Node.
20543         module.exports = factory();
20544       } else {
20545         // Browser globals (root is window)
20546         root.parseSrcset = factory();
20547       }
20548     })(commonjsGlobal, function () {
20549       // 1. Let input be the value passed to this algorithm.
20550       return function (input, options) {
20551         var logger = options && options.logger || console; // UTILITY FUNCTIONS
20552         // Manual is faster than RegEx
20553         // http://bjorn.tipling.com/state-and-regular-expressions-in-javascript
20554         // http://jsperf.com/whitespace-character/5
20555
20556         function isSpace(c) {
20557           return c === " " || // space
20558           c === "\t" || // horizontal tab
20559           c === "\n" || // new line
20560           c === "\f" || // form feed
20561           c === "\r"; // carriage return
20562         }
20563
20564         function collectCharacters(regEx) {
20565           var chars,
20566               match = regEx.exec(input.substring(pos));
20567
20568           if (match) {
20569             chars = match[0];
20570             pos += chars.length;
20571             return chars;
20572           }
20573         }
20574
20575         var inputLength = input.length,
20576             // (Don't use \s, to avoid matching non-breaking space)
20577         regexLeadingSpaces = /^[ \t\n\r\u000c]+/,
20578             regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/,
20579             regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/,
20580             regexTrailingCommas = /[,]+$/,
20581             regexNonNegativeInteger = /^\d+$/,
20582             // ( Positive or negative or unsigned integers or decimals, without or without exponents.
20583         // Must include at least one digit.
20584         // According to spec tests any decimal point must be followed by a digit.
20585         // No leading plus sign is allowed.)
20586         // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number
20587         regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,
20588             url,
20589             descriptors,
20590             currentDescriptor,
20591             state,
20592             c,
20593             // 2. Let position be a pointer into input, initially pointing at the start
20594         //    of the string.
20595         pos = 0,
20596             // 3. Let candidates be an initially empty source set.
20597         candidates = []; // 4. Splitting loop: Collect a sequence of characters that are space
20598         //    characters or U+002C COMMA characters. If any U+002C COMMA characters
20599         //    were collected, that is a parse error.
20600
20601         while (true) {
20602           collectCharacters(regexLeadingCommasOrSpaces); // 5. If position is past the end of input, return candidates and abort these steps.
20603
20604           if (pos >= inputLength) {
20605             return candidates; // (we're done, this is the sole return path)
20606           } // 6. Collect a sequence of characters that are not space characters,
20607           //    and let that be url.
20608
20609
20610           url = collectCharacters(regexLeadingNotSpaces); // 7. Let descriptors be a new empty list.
20611
20612           descriptors = []; // 8. If url ends with a U+002C COMMA character (,), follow these substeps:
20613           //            (1). Remove all trailing U+002C COMMA characters from url. If this removed
20614           //         more than one character, that is a parse error.
20615
20616           if (url.slice(-1) === ",") {
20617             url = url.replace(regexTrailingCommas, ""); // (Jump ahead to step 9 to skip tokenization and just push the candidate).
20618
20619             parseDescriptors(); //      Otherwise, follow these substeps:
20620           } else {
20621             tokenize();
20622           } // (close else of step 8)
20623           // 16. Return to the step labeled splitting loop.
20624
20625         } // (Close of big while loop.)
20626
20627         /**
20628          * Tokenizes descriptor properties prior to parsing
20629          * Returns undefined.
20630          */
20631
20632
20633         function tokenize() {
20634           // 8.1. Descriptor tokeniser: Skip whitespace
20635           collectCharacters(regexLeadingSpaces); // 8.2. Let current descriptor be the empty string.
20636
20637           currentDescriptor = ""; // 8.3. Let state be in descriptor.
20638
20639           state = "in descriptor";
20640
20641           while (true) {
20642             // 8.4. Let c be the character at position.
20643             c = input.charAt(pos); //  Do the following depending on the value of state.
20644             //  For the purpose of this step, "EOF" is a special character representing
20645             //  that position is past the end of input.
20646             // In descriptor
20647
20648             if (state === "in descriptor") {
20649               // Do the following, depending on the value of c:
20650               // Space character
20651               // If current descriptor is not empty, append current descriptor to
20652               // descriptors and let current descriptor be the empty string.
20653               // Set state to after descriptor.
20654               if (isSpace(c)) {
20655                 if (currentDescriptor) {
20656                   descriptors.push(currentDescriptor);
20657                   currentDescriptor = "";
20658                   state = "after descriptor";
20659                 } // U+002C COMMA (,)
20660                 // Advance position to the next character in input. If current descriptor
20661                 // is not empty, append current descriptor to descriptors. Jump to the step
20662                 // labeled descriptor parser.
20663
20664               } else if (c === ",") {
20665                 pos += 1;
20666
20667                 if (currentDescriptor) {
20668                   descriptors.push(currentDescriptor);
20669                 }
20670
20671                 parseDescriptors();
20672                 return; // U+0028 LEFT PARENTHESIS (()
20673                 // Append c to current descriptor. Set state to in parens.
20674               } else if (c === "(") {
20675                 currentDescriptor = currentDescriptor + c;
20676                 state = "in parens"; // EOF
20677                 // If current descriptor is not empty, append current descriptor to
20678                 // descriptors. Jump to the step labeled descriptor parser.
20679               } else if (c === "") {
20680                 if (currentDescriptor) {
20681                   descriptors.push(currentDescriptor);
20682                 }
20683
20684                 parseDescriptors();
20685                 return; // Anything else
20686                 // Append c to current descriptor.
20687               } else {
20688                 currentDescriptor = currentDescriptor + c;
20689               } // (end "in descriptor"
20690               // In parens
20691
20692             } else if (state === "in parens") {
20693               // U+0029 RIGHT PARENTHESIS ())
20694               // Append c to current descriptor. Set state to in descriptor.
20695               if (c === ")") {
20696                 currentDescriptor = currentDescriptor + c;
20697                 state = "in descriptor"; // EOF
20698                 // Append current descriptor to descriptors. Jump to the step labeled
20699                 // descriptor parser.
20700               } else if (c === "") {
20701                 descriptors.push(currentDescriptor);
20702                 parseDescriptors();
20703                 return; // Anything else
20704                 // Append c to current descriptor.
20705               } else {
20706                 currentDescriptor = currentDescriptor + c;
20707               } // After descriptor
20708
20709             } else if (state === "after descriptor") {
20710               // Do the following, depending on the value of c:
20711               // Space character: Stay in this state.
20712               if (isSpace(c)) ; else if (c === "") {
20713                 parseDescriptors();
20714                 return; // Anything else
20715                 // Set state to in descriptor. Set position to the previous character in input.
20716               } else {
20717                 state = "in descriptor";
20718                 pos -= 1;
20719               }
20720             } // Advance position to the next character in input.
20721
20722
20723             pos += 1; // Repeat this step.
20724           } // (close while true loop)
20725
20726         }
20727         /**
20728          * Adds descriptor properties to a candidate, pushes to the candidates array
20729          * @return undefined
20730          */
20731         // Declared outside of the while loop so that it's only created once.
20732
20733
20734         function parseDescriptors() {
20735           // 9. Descriptor parser: Let error be no.
20736           var pError = false,
20737               // 10. Let width be absent.
20738           // 11. Let density be absent.
20739           // 12. Let future-compat-h be absent. (We're implementing it now as h)
20740           w,
20741               d,
20742               h,
20743               i,
20744               candidate = {},
20745               desc,
20746               lastChar,
20747               value,
20748               intVal,
20749               floatVal; // 13. For each descriptor in descriptors, run the appropriate set of steps
20750           // from the following list:
20751
20752           for (i = 0; i < descriptors.length; i++) {
20753             desc = descriptors[i];
20754             lastChar = desc[desc.length - 1];
20755             value = desc.substring(0, desc.length - 1);
20756             intVal = parseInt(value, 10);
20757             floatVal = parseFloat(value); // If the descriptor consists of a valid non-negative integer followed by
20758             // a U+0077 LATIN SMALL LETTER W character
20759
20760             if (regexNonNegativeInteger.test(value) && lastChar === "w") {
20761               // If width and density are not both absent, then let error be yes.
20762               if (w || d) {
20763                 pError = true;
20764               } // Apply the rules for parsing non-negative integers to the descriptor.
20765               // If the result is zero, let error be yes.
20766               // Otherwise, let width be the result.
20767
20768
20769               if (intVal === 0) {
20770                 pError = true;
20771               } else {
20772                 w = intVal;
20773               } // If the descriptor consists of a valid floating-point number followed by
20774               // a U+0078 LATIN SMALL LETTER X character
20775
20776             } else if (regexFloatingPoint.test(value) && lastChar === "x") {
20777               // If width, density and future-compat-h are not all absent, then let error
20778               // be yes.
20779               if (w || d || h) {
20780                 pError = true;
20781               } // Apply the rules for parsing floating-point number values to the descriptor.
20782               // If the result is less than zero, let error be yes. Otherwise, let density
20783               // be the result.
20784
20785
20786               if (floatVal < 0) {
20787                 pError = true;
20788               } else {
20789                 d = floatVal;
20790               } // If the descriptor consists of a valid non-negative integer followed by
20791               // a U+0068 LATIN SMALL LETTER H character
20792
20793             } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
20794               // If height and density are not both absent, then let error be yes.
20795               if (h || d) {
20796                 pError = true;
20797               } // Apply the rules for parsing non-negative integers to the descriptor.
20798               // If the result is zero, let error be yes. Otherwise, let future-compat-h
20799               // be the result.
20800
20801
20802               if (intVal === 0) {
20803                 pError = true;
20804               } else {
20805                 h = intVal;
20806               } // Anything else, Let error be yes.
20807
20808             } else {
20809               pError = true;
20810             }
20811           } // (close step 13 for loop)
20812           // 15. If error is still no, then append a new image source to candidates whose
20813           // URL is url, associated with a width width if not absent and a pixel
20814           // density density if not absent. Otherwise, there is a parse error.
20815
20816
20817           if (!pError) {
20818             candidate.url = url;
20819
20820             if (w) {
20821               candidate.w = w;
20822             }
20823
20824             if (d) {
20825               candidate.d = d;
20826             }
20827
20828             if (h) {
20829               candidate.h = h;
20830             }
20831
20832             candidates.push(candidate);
20833           } else if (logger && logger.error) {
20834             logger.error("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
20835           }
20836         } // (close parseDescriptors fn)
20837
20838       };
20839     });
20840   });
20841
20842   var _require$$0$builders$5 = doc.builders,
20843       concat$9 = _require$$0$builders$5.concat,
20844       ifBreak$4 = _require$$0$builders$5.ifBreak,
20845       join$5 = _require$$0$builders$5.join,
20846       line$4 = _require$$0$builders$5.line;
20847
20848   function printImgSrcset(value) {
20849     var srcset = parseSrcset(value, {
20850       logger: {
20851         error: function error(message) {
20852           throw new Error(message);
20853         }
20854       }
20855     });
20856     var hasW = srcset.some(function (src) {
20857       return src.w;
20858     });
20859     var hasH = srcset.some(function (src) {
20860       return src.h;
20861     });
20862     var hasX = srcset.some(function (src) {
20863       return src.d;
20864     });
20865
20866     if (hasW + hasH + hasX !== 1) {
20867       throw new Error("Mixed descriptor in srcset is not supported");
20868     }
20869
20870     var key = hasW ? "w" : hasH ? "h" : "d";
20871     var unit = hasW ? "w" : hasH ? "h" : "x";
20872
20873     var getMax = function getMax(values) {
20874       return Math.max.apply(Math, values);
20875     };
20876
20877     var urls = srcset.map(function (src) {
20878       return src.url;
20879     });
20880     var maxUrlLength = getMax(urls.map(function (url) {
20881       return url.length;
20882     }));
20883     var descriptors = srcset.map(function (src) {
20884       return src[key];
20885     }).map(function (descriptor) {
20886       return descriptor ? descriptor.toString() : "";
20887     });
20888     var descriptorLeftLengths = descriptors.map(function (descriptor) {
20889       var index = descriptor.indexOf(".");
20890       return index === -1 ? descriptor.length : index;
20891     });
20892     var maxDescriptorLeftLength = getMax(descriptorLeftLengths);
20893     return join$5(concat$9([",", line$4]), urls.map(function (url, index) {
20894       var parts = [url];
20895       var descriptor = descriptors[index];
20896
20897       if (descriptor) {
20898         var urlPadding = maxUrlLength - url.length + 1;
20899         var descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
20900         var alignment = " ".repeat(urlPadding + descriptorPadding);
20901         parts.push(ifBreak$4(alignment, " "), descriptor + unit);
20902       }
20903
20904       return concat$9(parts);
20905     }));
20906   }
20907
20908   var syntaxAttribute = {
20909     printImgSrcset: printImgSrcset
20910   };
20911
20912   var builders = doc.builders,
20913       _require$$0$utils = doc.utils,
20914       stripTrailingHardline$1 = _require$$0$utils.stripTrailingHardline,
20915       mapDoc$4 = _require$$0$utils.mapDoc;
20916   var breakParent$2 = builders.breakParent,
20917       dedentToRoot$1 = builders.dedentToRoot,
20918       fill$3 = builders.fill,
20919       group$9 = builders.group,
20920       hardline$7 = builders.hardline,
20921       ifBreak$5 = builders.ifBreak,
20922       indent$5 = builders.indent,
20923       join$6 = builders.join,
20924       line$5 = builders.line,
20925       literalline$2 = builders.literalline,
20926       markAsRoot$2 = builders.markAsRoot,
20927       softline$4 = builders.softline;
20928   var countChars$1 = utils$3.countChars,
20929       countParents$1 = utils$3.countParents,
20930       dedentString$1 = utils$3.dedentString,
20931       forceBreakChildren$1 = utils$3.forceBreakChildren,
20932       forceBreakContent$1 = utils$3.forceBreakContent,
20933       forceNextEmptyLine$1 = utils$3.forceNextEmptyLine,
20934       getLastDescendant$1 = utils$3.getLastDescendant,
20935       getPrettierIgnoreAttributeCommentData$1 = utils$3.getPrettierIgnoreAttributeCommentData,
20936       hasPrettierIgnore$1 = utils$3.hasPrettierIgnore,
20937       inferScriptParser$1 = utils$3.inferScriptParser,
20938       isScriptLikeTag$1 = utils$3.isScriptLikeTag,
20939       isTextLikeNode$1 = utils$3.isTextLikeNode,
20940       normalizeParts$1 = utils$3.normalizeParts,
20941       preferHardlineAsLeadingSpaces$1 = utils$3.preferHardlineAsLeadingSpaces,
20942       shouldNotPrintClosingTag$1 = utils$3.shouldNotPrintClosingTag,
20943       shouldPreserveContent$1 = utils$3.shouldPreserveContent,
20944       unescapeQuoteEntities$1 = utils$3.unescapeQuoteEntities;
20945   var replaceEndOfLineWith$1 = util.replaceEndOfLineWith;
20946   var insertPragma$6 = pragma$3.insertPragma;
20947   var printVueFor$1 = syntaxVue.printVueFor,
20948       printVueSlotScope$1 = syntaxVue.printVueSlotScope,
20949       isVueEventBindingExpression$1 = syntaxVue.isVueEventBindingExpression;
20950   var printImgSrcset$1 = syntaxAttribute.printImgSrcset;
20951
20952   function concat$a(parts) {
20953     var newParts = normalizeParts$1(parts);
20954     return newParts.length === 0 ? "" : newParts.length === 1 ? newParts[0] : builders.concat(newParts);
20955   }
20956
20957   function embed$2(path, print, textToDoc, options) {
20958     var node = path.getValue();
20959
20960     switch (node.type) {
20961       case "text":
20962         {
20963           if (isScriptLikeTag$1(node.parent)) {
20964             var parser = inferScriptParser$1(node.parent);
20965
20966             if (parser) {
20967               var value = parser === "markdown" ? dedentString$1(node.value.replace(/^[^\S\n]*?\n/, "")) : node.value;
20968               return builders.concat([concat$a([breakParent$2, printOpeningTagPrefix(node, options), stripTrailingHardline$1(textToDoc(value, {
20969                 parser: parser
20970               })), printClosingTagSuffix(node, options)])]);
20971             }
20972           } else if (node.parent.type === "interpolation") {
20973             return concat$a([indent$5(concat$a([line$5, textToDoc(node.value, Object.assign({
20974               __isInHtmlInterpolation: true // to avoid unexpected `}}`
20975
20976             }, options.parser === "angular" ? {
20977               parser: "__ng_interpolation",
20978               trailingComma: "none"
20979             } : options.parser === "vue" ? {
20980               parser: "__vue_expression"
20981             } : {
20982               parser: "__js_expression"
20983             }))])), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line$5]);
20984           }
20985
20986           break;
20987         }
20988
20989       case "attribute":
20990         {
20991           if (!node.value) {
20992             break;
20993           } // lit-html: html`<my-element obj=${obj}></my-element>`
20994
20995
20996           if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
20997             return concat$a([node.rawName, "=", node.value]);
20998           } // lwc: html`<my-element data-for={value}></my-element>`
20999
21000
21001           if (options.parser === "lwc") {
21002             var interpolationRegex = /^\{[\s\S]*\}$/;
21003
21004             if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
21005               return concat$a([node.rawName, "=", node.value]);
21006             }
21007           }
21008
21009           var embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, function (code, opts) {
21010             return (// strictly prefer single quote to avoid unnecessary html entity escape
21011               textToDoc(code, Object.assign({
21012                 __isInHtmlAttribute: true
21013               }, opts))
21014             );
21015           }, options);
21016
21017           if (embeddedAttributeValueDoc) {
21018             return concat$a([node.rawName, '="', group$9(mapDoc$4(embeddedAttributeValueDoc, function (doc) {
21019               return typeof doc === "string" ? doc.replace(/"/g, "&quot;") : doc;
21020             })), '"']);
21021           }
21022
21023           break;
21024         }
21025
21026       case "yaml":
21027         return markAsRoot$2(concat$a(["---", hardline$7, node.value.trim().length === 0 ? "" : textToDoc(node.value, {
21028           parser: "yaml"
21029         }), "---"]));
21030     }
21031   }
21032
21033   function genericPrint$2(path, options, print) {
21034     var node = path.getValue();
21035
21036     switch (node.type) {
21037       case "root":
21038         // use original concat to not break stripTrailingHardline
21039         return builders.concat([group$9(printChildren$1(path, options, print)), hardline$7]);
21040
21041       case "element":
21042       case "ieConditionalComment":
21043         {
21044           /**
21045            * do not break:
21046            *
21047            *     <div>{{
21048            *         ~
21049            *       interpolation
21050            *     }}</div>
21051            *            ~
21052            *
21053            * exception: break if the opening tag breaks
21054            *
21055            *     <div
21056            *       long
21057            *           ~
21058            *       >{{
21059            *         interpolation
21060            *       }}</div
21061            *              ~
21062            *     >
21063            */
21064           var shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
21065           var attrGroupId = Symbol("element-attr-group-id");
21066           return concat$a([group$9(concat$a([group$9(printOpeningTag(path, options, print), {
21067             id: attrGroupId
21068           }), node.children.length === 0 ? node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line$5 : "" : concat$a([forceBreakContent$1(node) ? breakParent$2 : "", function (childrenDoc) {
21069             return shouldHugContent ? ifBreak$5(indent$5(childrenDoc), childrenDoc, {
21070               groupId: attrGroupId
21071             }) : isScriptLikeTag$1(node) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle ? childrenDoc : indent$5(childrenDoc);
21072           }(concat$a([shouldHugContent ? ifBreak$5(softline$4, "", {
21073             groupId: attrGroupId
21074           }) : node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive ? line$5 : node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive ? dedentToRoot$1(softline$4) : softline$4, printChildren$1(path, options, print)])), (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? " " : "" : shouldHugContent ? ifBreak$5(softline$4, "", {
21075             groupId: attrGroupId
21076           }) : node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive ? line$5 : (node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp("\\n\\s{".concat(options.tabWidth * countParents$1(path, function (n) {
21077             return n.parent && n.parent.type !== "root";
21078           }), "}$")).test(node.lastChild.value) ?
21079           /**
21080            *     <div>
21081            *       <pre>
21082            *         something
21083            *       </pre>
21084            *            ~
21085            *     </div>
21086            */
21087           "" : softline$4])])), printClosingTag(node, options)]);
21088         }
21089
21090       case "ieConditionalStartComment":
21091       case "ieConditionalEndComment":
21092         return concat$a([printOpeningTagStart(node), printClosingTagEnd(node)]);
21093
21094       case "interpolation":
21095         return concat$a([printOpeningTagStart(node, options), concat$a(path.map(print, "children")), printClosingTagEnd(node, options)]);
21096
21097       case "text":
21098         {
21099           if (node.parent.type === "interpolation") {
21100             // replace the trailing literalline with hardline for better readability
21101             var trailingNewlineRegex = /\n[^\S\n]*?$/;
21102             var hasTrailingNewline = trailingNewlineRegex.test(node.value);
21103             var value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
21104             return concat$a([concat$a(replaceEndOfLineWith$1(value, literalline$2)), hasTrailingNewline ? hardline$7 : ""]);
21105           }
21106
21107           return fill$3(normalizeParts$1([].concat(printOpeningTagPrefix(node, options), getTextValueParts(node), printClosingTagSuffix(node, options))));
21108         }
21109
21110       case "docType":
21111         return concat$a([group$9(concat$a([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")])), printClosingTagEnd(node, options)]);
21112
21113       case "comment":
21114         {
21115           return concat$a([printOpeningTagPrefix(node, options), concat$a(replaceEndOfLineWith$1(options.originalText.slice(options.locStart(node), options.locEnd(node)), literalline$2)), printClosingTagSuffix(node, options)]);
21116         }
21117
21118       case "attribute":
21119         {
21120           if (node.value === null) {
21121             return node.rawName;
21122           }
21123
21124           var _value = unescapeQuoteEntities$1(node.value);
21125
21126           var singleQuoteCount = countChars$1(_value, "'");
21127           var doubleQuoteCount = countChars$1(_value, '"');
21128           var quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
21129           return concat$a([node.rawName, concat$a(["=", quote, concat$a(replaceEndOfLineWith$1(quote === '"' ? _value.replace(/"/g, "&quot;") : _value.replace(/'/g, "&apos;"), literalline$2)), quote])]);
21130         }
21131
21132       case "yaml":
21133       case "toml":
21134         return concat$a(replaceEndOfLineWith$1(node.raw, literalline$2));
21135
21136       default:
21137         throw new Error("Unexpected node type ".concat(node.type));
21138     }
21139   }
21140
21141   function printChildren$1(path, options, print) {
21142     var node = path.getValue();
21143
21144     if (forceBreakChildren$1(node)) {
21145       return concat$a([breakParent$2, concat$a(path.map(function (childPath) {
21146         var childNode = childPath.getValue();
21147         var prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
21148         return concat$a([!prevBetweenLine ? "" : concat$a([prevBetweenLine, forceNextEmptyLine$1(childNode.prev) ? hardline$7 : ""]), printChild(childPath)]);
21149       }, "children"))]);
21150     }
21151
21152     var groupIds = node.children.map(function () {
21153       return Symbol("");
21154     });
21155     return concat$a(path.map(function (childPath, childIndex) {
21156       var childNode = childPath.getValue();
21157
21158       if (isTextLikeNode$1(childNode)) {
21159         if (childNode.prev && isTextLikeNode$1(childNode.prev)) {
21160           var _prevBetweenLine = printBetweenLine(childNode.prev, childNode);
21161
21162           if (_prevBetweenLine) {
21163             if (forceNextEmptyLine$1(childNode.prev)) {
21164               return concat$a([hardline$7, hardline$7, printChild(childPath)]);
21165             }
21166
21167             return concat$a([_prevBetweenLine, printChild(childPath)]);
21168           }
21169         }
21170
21171         return printChild(childPath);
21172       }
21173
21174       var prevParts = [];
21175       var leadingParts = [];
21176       var trailingParts = [];
21177       var nextParts = [];
21178       var prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
21179       var nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
21180
21181       if (prevBetweenLine) {
21182         if (forceNextEmptyLine$1(childNode.prev)) {
21183           prevParts.push(hardline$7, hardline$7);
21184         } else if (prevBetweenLine === hardline$7) {
21185           prevParts.push(hardline$7);
21186         } else {
21187           if (isTextLikeNode$1(childNode.prev)) {
21188             leadingParts.push(prevBetweenLine);
21189           } else {
21190             leadingParts.push(ifBreak$5("", softline$4, {
21191               groupId: groupIds[childIndex - 1]
21192             }));
21193           }
21194         }
21195       }
21196
21197       if (nextBetweenLine) {
21198         if (forceNextEmptyLine$1(childNode)) {
21199           if (isTextLikeNode$1(childNode.next)) {
21200             nextParts.push(hardline$7, hardline$7);
21201           }
21202         } else if (nextBetweenLine === hardline$7) {
21203           if (isTextLikeNode$1(childNode.next)) {
21204             nextParts.push(hardline$7);
21205           }
21206         } else {
21207           trailingParts.push(nextBetweenLine);
21208         }
21209       }
21210
21211       return concat$a([].concat(prevParts, group$9(concat$a([concat$a(leadingParts), group$9(concat$a([printChild(childPath), concat$a(trailingParts)]), {
21212         id: groupIds[childIndex]
21213       })])), nextParts));
21214     }, "children"));
21215
21216     function printChild(childPath) {
21217       var child = childPath.getValue();
21218
21219       if (hasPrettierIgnore$1(child)) {
21220         return concat$a([].concat(printOpeningTagPrefix(child, options), replaceEndOfLineWith$1(options.originalText.slice(options.locStart(child) + (child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev) ? printOpeningTagStartMarker(child).length : 0), options.locEnd(child) - (child.next && needsToBorrowPrevClosingTagEndMarker(child.next) ? printClosingTagEndMarker(child, options).length : 0)), literalline$2), printClosingTagSuffix(child, options)));
21221       }
21222
21223       if (shouldPreserveContent$1(child, options)) {
21224         return concat$a([].concat(printOpeningTagPrefix(child, options), group$9(printOpeningTag(childPath, options, print)), replaceEndOfLineWith$1(options.originalText.slice(child.startSourceSpan.end.offset + (child.firstChild && needsToBorrowParentOpeningTagEndMarker(child.firstChild) ? -printOpeningTagEndMarker(child).length : 0), child.endSourceSpan.start.offset + (child.lastChild && needsToBorrowParentClosingTagStartMarker(child.lastChild) ? printClosingTagStartMarker(child, options).length : needsToBorrowLastChildClosingTagEndMarker(child) ? -printClosingTagEndMarker(child.lastChild, options).length : 0)), literalline$2), printClosingTag(child, options), printClosingTagSuffix(child, options)));
21225       }
21226
21227       return print(childPath);
21228     }
21229
21230     function printBetweenLine(prevNode, nextNode) {
21231       return isTextLikeNode$1(prevNode) && isTextLikeNode$1(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : line$5 : "" : preferHardlineAsLeadingSpaces$1(nextNode) ? hardline$7 : softline$4 : needsToBorrowNextOpeningTagStartMarker(prevNode) && (
21232       /**
21233        *     123<a
21234        *          ~
21235        *       ><b>
21236        */
21237       nextNode.firstChild ||
21238       /**
21239        *     123<!--
21240        *            ~
21241        *     -->
21242        */
21243       nextNode.isSelfClosing ||
21244       /**
21245        *     123<span
21246        *             ~
21247        *       attr
21248        */
21249       nextNode.type === "element" && nextNode.attrs.length !== 0) ||
21250       /**
21251        *     <img
21252        *       src="long"
21253        *                 ~
21254        *     />123
21255        */
21256       prevNode.type === "element" && prevNode.isSelfClosing && needsToBorrowPrevClosingTagEndMarker(nextNode) ? "" : !nextNode.isLeadingSpaceSensitive || preferHardlineAsLeadingSpaces$1(nextNode) ||
21257       /**
21258        *       Want to write us a letter? Use our<a
21259        *         ><b><a>mailing address</a></b></a
21260        *                                          ~
21261        *       >.
21262        */
21263       needsToBorrowPrevClosingTagEndMarker(nextNode) && prevNode.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild) && prevNode.lastChild.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild.lastChild) ? hardline$7 : nextNode.hasLeadingSpaces ? line$5 : softline$4;
21264     }
21265   }
21266
21267   function printOpeningTag(path, options, print) {
21268     var node = path.getValue();
21269     var forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
21270     return concat$a([printOpeningTagStart(node, options), !node.attrs || node.attrs.length === 0 ? node.isSelfClosing ?
21271     /**
21272      *     <br />
21273      *        ^
21274      */
21275     " " : "" : concat$a([indent$5(concat$a([forceNotToBreakAttrContent ? " " : line$5, join$6(line$5, function (ignoreAttributeData) {
21276       var hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? function () {
21277         return ignoreAttributeData;
21278       } : Array.isArray(ignoreAttributeData) ? function (attr) {
21279         return ignoreAttributeData.indexOf(attr.rawName) !== -1;
21280       } : function () {
21281         return false;
21282       };
21283       return path.map(function (attrPath) {
21284         var attr = attrPath.getValue();
21285         return hasPrettierIgnoreAttribute(attr) ? concat$a(replaceEndOfLineWith$1(options.originalText.slice(options.locStart(attr), options.locEnd(attr)), literalline$2)) : print(attrPath);
21286       }, "attrs");
21287     }(node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData$1(node.prev.value)))])),
21288     /**
21289      *     123<a
21290      *       attr
21291      *           ~
21292      *       >456
21293      */
21294     node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ||
21295     /**
21296      *     <span
21297      *       >123<meta
21298      *                ~
21299      *     /></span>
21300      */
21301     node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) ? "" : node.isSelfClosing ? forceNotToBreakAttrContent ? " " : line$5 : forceNotToBreakAttrContent ? "" : softline$4]), node.isSelfClosing ? "" : printOpeningTagEnd(node)]);
21302   }
21303
21304   function printOpeningTagStart(node, options) {
21305     return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : concat$a([printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)]);
21306   }
21307
21308   function printOpeningTagEnd(node) {
21309     return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
21310   }
21311
21312   function printClosingTag(node, options) {
21313     return concat$a([node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)]);
21314   }
21315
21316   function printClosingTagStart(node, options) {
21317     return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : concat$a([printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)]);
21318   }
21319
21320   function printClosingTagEnd(node, options) {
21321     return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : concat$a([printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)]);
21322   }
21323
21324   function needsToBorrowNextOpeningTagStartMarker(node) {
21325     /**
21326      *     123<p
21327      *        ^^
21328      *     >
21329      */
21330     return node.next && !isTextLikeNode$1(node.next) && isTextLikeNode$1(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
21331   }
21332
21333   function needsToBorrowParentOpeningTagEndMarker(node) {
21334     /**
21335      *     <p
21336      *       >123
21337      *       ^
21338      *
21339      *     <p
21340      *       ><a
21341      *       ^
21342      */
21343     return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
21344   }
21345
21346   function needsToBorrowPrevClosingTagEndMarker(node) {
21347     /**
21348      *     <p></p
21349      *     >123
21350      *     ^
21351      *
21352      *     <p></p
21353      *     ><a
21354      *     ^
21355      */
21356     return node.prev && !isTextLikeNode$1(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
21357   }
21358
21359   function needsToBorrowLastChildClosingTagEndMarker(node) {
21360     /**
21361      *     <p
21362      *       ><a></a
21363      *       ></p
21364      *       ^
21365      *     >
21366      */
21367     return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode$1(getLastDescendant$1(node.lastChild));
21368   }
21369
21370   function needsToBorrowParentClosingTagStartMarker(node) {
21371     /**
21372      *     <p>
21373      *       123</p
21374      *          ^^^
21375      *     >
21376      *
21377      *         123</b
21378      *       ></a
21379      *        ^^^
21380      *     >
21381      */
21382     return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode$1(getLastDescendant$1(node));
21383   }
21384
21385   function printOpeningTagPrefix(node, options) {
21386     return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
21387   }
21388
21389   function printClosingTagPrefix(node, options) {
21390     return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
21391   }
21392
21393   function printClosingTagSuffix(node, options) {
21394     return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
21395   }
21396
21397   function printOpeningTagStartMarker(node) {
21398     switch (node.type) {
21399       case "ieConditionalComment":
21400       case "ieConditionalStartComment":
21401         return "<!--[if ".concat(node.condition);
21402
21403       case "ieConditionalEndComment":
21404         return "<!--<!";
21405
21406       case "interpolation":
21407         return "{{";
21408
21409       case "docType":
21410         return "<!DOCTYPE";
21411
21412       case "element":
21413         if (node.condition) {
21414           return "<!--[if ".concat(node.condition, "]><!--><").concat(node.rawName);
21415         }
21416
21417       // fall through
21418
21419       default:
21420         return "<".concat(node.rawName);
21421     }
21422   }
21423
21424   function printOpeningTagEndMarker(node) {
21425     assert(!node.isSelfClosing);
21426
21427     switch (node.type) {
21428       case "ieConditionalComment":
21429         return "]>";
21430
21431       case "element":
21432         if (node.condition) {
21433           return "><!--<![endif]-->";
21434         }
21435
21436       // fall through
21437
21438       default:
21439         return ">";
21440     }
21441   }
21442
21443   function printClosingTagStartMarker(node, options) {
21444     assert(!node.isSelfClosing);
21445
21446     if (shouldNotPrintClosingTag$1(node, options)) {
21447       return "";
21448     }
21449
21450     switch (node.type) {
21451       case "ieConditionalComment":
21452         return "<!";
21453
21454       case "element":
21455         if (node.hasHtmComponentClosingTag) {
21456           return "<//";
21457         }
21458
21459       // fall through
21460
21461       default:
21462         return "</".concat(node.rawName);
21463     }
21464   }
21465
21466   function printClosingTagEndMarker(node, options) {
21467     if (shouldNotPrintClosingTag$1(node, options)) {
21468       return "";
21469     }
21470
21471     switch (node.type) {
21472       case "ieConditionalComment":
21473       case "ieConditionalEndComment":
21474         return "[endif]-->";
21475
21476       case "ieConditionalStartComment":
21477         return "]><!-->";
21478
21479       case "interpolation":
21480         return "}}";
21481
21482       case "element":
21483         if (node.isSelfClosing) {
21484           return "/>";
21485         }
21486
21487       // fall through
21488
21489       default:
21490         return ">";
21491     }
21492   }
21493
21494   function getTextValueParts(node) {
21495     var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.value;
21496     return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceEndOfLineWith$1(value, literalline$2) : replaceEndOfLineWith$1(dedentString$1(value.replace(/^\s*?\n|\n\s*?$/g, "")), hardline$7) : // https://infra.spec.whatwg.org/#ascii-whitespace
21497     join$6(line$5, value.split(/[\t\n\f\r ]+/)).parts;
21498   }
21499
21500   function printEmbeddedAttributeValue(node, originalTextToDoc, options) {
21501     var isKeyMatched = function isKeyMatched(patterns) {
21502       return new RegExp(patterns.join("|")).test(node.fullName);
21503     };
21504
21505     var getValue = function getValue() {
21506       return unescapeQuoteEntities$1(node.value);
21507     };
21508
21509     var shouldHug = false;
21510
21511     var __onHtmlBindingRoot = function __onHtmlBindingRoot(root) {
21512       var 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;
21513
21514       if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression")) {
21515         shouldHug = true;
21516       }
21517     };
21518
21519     var printHug = function printHug(doc) {
21520       return group$9(doc);
21521     };
21522
21523     var printExpand = function printExpand(doc) {
21524       return group$9(concat$a([indent$5(concat$a([softline$4, doc])), softline$4]));
21525     };
21526
21527     var printMaybeHug = function printMaybeHug(doc) {
21528       return shouldHug ? printHug(doc) : printExpand(doc);
21529     };
21530
21531     var textToDoc = function textToDoc(code, opts) {
21532       return originalTextToDoc(code, Object.assign({
21533         __onHtmlBindingRoot: __onHtmlBindingRoot
21534       }, opts));
21535     };
21536
21537     if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
21538       return printExpand(printImgSrcset$1(getValue()));
21539     }
21540
21541     if (options.parser === "vue") {
21542       if (node.fullName === "v-for") {
21543         return printVueFor$1(getValue(), textToDoc);
21544       }
21545
21546       if (node.fullName === "slot-scope") {
21547         return printVueSlotScope$1(getValue(), textToDoc);
21548       }
21549       /**
21550        *     @click="jsStatement"
21551        *     @click="jsExpression"
21552        *     v-on:click="jsStatement"
21553        *     v-on:click="jsExpression"
21554        */
21555
21556
21557       var vueEventBindingPatterns = ["^@", "^v-on:"];
21558       /**
21559        *     :class="vueExpression"
21560        *     v-bind:id="vueExpression"
21561        */
21562
21563       var vueExpressionBindingPatterns = ["^:", "^v-bind:"];
21564       /**
21565        *     v-if="jsExpression"
21566        */
21567
21568       var jsExpressionBindingPatterns = ["^v-"];
21569
21570       if (isKeyMatched(vueEventBindingPatterns)) {
21571         var value = getValue();
21572         return printMaybeHug(isVueEventBindingExpression$1(value) ? textToDoc(value, {
21573           parser: "__js_expression"
21574         }) : stripTrailingHardline$1(textToDoc(value, {
21575           parser: "__vue_event_binding"
21576         })));
21577       }
21578
21579       if (isKeyMatched(vueExpressionBindingPatterns)) {
21580         return printMaybeHug(textToDoc(getValue(), {
21581           parser: "__vue_expression"
21582         }));
21583       }
21584
21585       if (isKeyMatched(jsExpressionBindingPatterns)) {
21586         return printMaybeHug(textToDoc(getValue(), {
21587           parser: "__js_expression"
21588         }));
21589       }
21590     }
21591
21592     if (options.parser === "angular") {
21593       var ngTextToDoc = function ngTextToDoc(code, opts) {
21594         return (// angular does not allow trailing comma
21595           textToDoc(code, Object.assign({
21596             trailingComma: "none"
21597           }, opts))
21598         );
21599       };
21600       /**
21601        *     *directive="angularDirective"
21602        */
21603
21604
21605       var ngDirectiveBindingPatterns = ["^\\*"];
21606       /**
21607        *     (click)="angularStatement"
21608        *     on-click="angularStatement"
21609        */
21610
21611       var ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
21612       /**
21613        *     [target]="angularExpression"
21614        *     bind-target="angularExpression"
21615        *     [(target)]="angularExpression"
21616        *     bindon-target="angularExpression"
21617        */
21618
21619       var ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-"];
21620       /**
21621        *     i18n="longDescription"
21622        *     i18n-attr="longDescription"
21623        */
21624
21625       var ngI18nPatterns = ["^i18n(-.+)?$"];
21626
21627       if (isKeyMatched(ngStatementBindingPatterns)) {
21628         return printMaybeHug(ngTextToDoc(getValue(), {
21629           parser: "__ng_action"
21630         }));
21631       }
21632
21633       if (isKeyMatched(ngExpressionBindingPatterns)) {
21634         return printMaybeHug(ngTextToDoc(getValue(), {
21635           parser: "__ng_binding"
21636         }));
21637       }
21638
21639       if (isKeyMatched(ngI18nPatterns)) {
21640         return printExpand(fill$3(getTextValueParts(node, getValue())));
21641       }
21642
21643       if (isKeyMatched(ngDirectiveBindingPatterns)) {
21644         return printMaybeHug(ngTextToDoc(getValue(), {
21645           parser: "__ng_directive"
21646         }));
21647       }
21648
21649       var interpolationRegex = /\{\{([\s\S]+?)\}\}/g;
21650
21651       var _value2 = getValue();
21652
21653       if (interpolationRegex.test(_value2)) {
21654         var parts = [];
21655
21656         _value2.split(interpolationRegex).forEach(function (part, index) {
21657           if (index % 2 === 0) {
21658             parts.push(concat$a(replaceEndOfLineWith$1(part, literalline$2)));
21659           } else {
21660             try {
21661               parts.push(group$9(concat$a(["{{", indent$5(concat$a([line$5, ngTextToDoc(part, {
21662                 parser: "__ng_interpolation",
21663                 __isInHtmlInterpolation: true // to avoid unexpected `}}`
21664
21665               })])), line$5, "}}"])));
21666             } catch (e) {
21667               parts.push("{{", concat$a(replaceEndOfLineWith$1(part, literalline$2)), "}}");
21668             }
21669           }
21670         });
21671
21672         return group$9(concat$a(parts));
21673       }
21674     }
21675
21676     return null;
21677   }
21678
21679   var printerHtml = {
21680     preprocess: preprocess_1,
21681     print: genericPrint$2,
21682     insertPragma: insertPragma$6,
21683     massageAstNode: clean$3,
21684     embed: embed$2
21685   };
21686
21687   var CATEGORY_HTML = "HTML"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
21688
21689   var options$4 = {
21690     htmlWhitespaceSensitivity: {
21691       since: "1.15.0",
21692       category: CATEGORY_HTML,
21693       type: "choice",
21694       default: "css",
21695       description: "How to handle whitespaces in HTML.",
21696       choices: [{
21697         value: "css",
21698         description: "Respect the default value of CSS display property."
21699       }, {
21700         value: "strict",
21701         description: "Whitespaces are considered sensitive."
21702       }, {
21703         value: "ignore",
21704         description: "Whitespaces are considered insensitive."
21705       }]
21706     },
21707     vueIndentScriptAndStyle: {
21708       since: "1.19.0",
21709       category: CATEGORY_HTML,
21710       type: "boolean",
21711       default: false,
21712       description: "Indent script and style tags in Vue files."
21713     }
21714   };
21715
21716   var name$7 = "HTML";
21717   var type$6 = "markup";
21718   var tmScope$6 = "text.html.basic";
21719   var aceMode$6 = "html";
21720   var codemirrorMode$3 = "htmlmixed";
21721   var codemirrorMimeType$3 = "text/html";
21722   var color$1 = "#e34c26";
21723   var aliases$1 = [
21724         "xhtml"
21725   ];
21726   var extensions$6 = [
21727         ".html",
21728         ".htm",
21729         ".html.hl",
21730         ".inc",
21731         ".st",
21732         ".xht",
21733         ".xhtml"
21734   ];
21735   var languageId$6 = 146;
21736   var HTML = {
21737         name: name$7,
21738         type: type$6,
21739         tmScope: tmScope$6,
21740         aceMode: aceMode$6,
21741         codemirrorMode: codemirrorMode$3,
21742         codemirrorMimeType: codemirrorMimeType$3,
21743         color: color$1,
21744         aliases: aliases$1,
21745         extensions: extensions$6,
21746         languageId: languageId$6
21747   };
21748
21749   var HTML$1 = /*#__PURE__*/Object.freeze({
21750     __proto__: null,
21751     name: name$7,
21752     type: type$6,
21753     tmScope: tmScope$6,
21754     aceMode: aceMode$6,
21755     codemirrorMode: codemirrorMode$3,
21756     codemirrorMimeType: codemirrorMimeType$3,
21757     color: color$1,
21758     aliases: aliases$1,
21759     extensions: extensions$6,
21760     languageId: languageId$6,
21761     'default': HTML
21762   });
21763
21764   var name$8 = "Vue";
21765   var type$7 = "markup";
21766   var color$2 = "#2c3e50";
21767   var extensions$7 = [
21768         ".vue"
21769   ];
21770   var tmScope$7 = "text.html.vue";
21771   var aceMode$7 = "html";
21772   var languageId$7 = 391;
21773   var Vue = {
21774         name: name$8,
21775         type: type$7,
21776         color: color$2,
21777         extensions: extensions$7,
21778         tmScope: tmScope$7,
21779         aceMode: aceMode$7,
21780         languageId: languageId$7
21781   };
21782
21783   var Vue$1 = /*#__PURE__*/Object.freeze({
21784     __proto__: null,
21785     name: name$8,
21786     type: type$7,
21787     color: color$2,
21788     extensions: extensions$7,
21789     tmScope: tmScope$7,
21790     aceMode: aceMode$7,
21791     languageId: languageId$7,
21792     'default': Vue
21793   });
21794
21795   var require$$0$5 = getCjsExportFromNamespace(HTML$1);
21796
21797   var require$$1$1 = getCjsExportFromNamespace(Vue$1);
21798
21799   var languages$3 = [createLanguage(require$$0$5, function (data) {
21800     return Object.assign(data, {
21801       name: "Angular",
21802       since: "1.15.0",
21803       parsers: ["angular"],
21804       vscodeLanguageIds: ["html"],
21805       extensions: [".component.html"],
21806       filenames: []
21807     });
21808   }), createLanguage(require$$0$5, function (data) {
21809     return Object.assign(data, {
21810       since: "1.15.0",
21811       parsers: ["html"],
21812       vscodeLanguageIds: ["html"],
21813       extensions: data.extensions.concat([".mjml" // MJML is considered XML in Linguist but it should be formatted as HTML
21814       ])
21815     });
21816   }), createLanguage(require$$0$5, function (data) {
21817     return Object.assign(data, {
21818       name: "Lightning Web Components",
21819       since: "1.17.0",
21820       parsers: ["lwc"],
21821       vscodeLanguageIds: ["html"],
21822       extensions: [],
21823       filenames: []
21824     });
21825   }), createLanguage(require$$1$1, function (data) {
21826     return Object.assign(data, {
21827       since: "1.10.0",
21828       parsers: ["vue"],
21829       vscodeLanguageIds: ["vue"]
21830     });
21831   })];
21832   var printers$3 = {
21833     html: printerHtml
21834   };
21835   var languageHtml = {
21836     languages: languages$3,
21837     printers: printers$3,
21838     options: options$4
21839   };
21840
21841   var addLeadingComment$2 = utilShared.addLeadingComment,
21842       addTrailingComment$2 = utilShared.addTrailingComment,
21843       addDanglingComment$2 = utilShared.addDanglingComment;
21844
21845   function handleOwnLineComment(comment, text, options, ast, isLastComment) {
21846     var precedingNode = comment.precedingNode,
21847         enclosingNode = comment.enclosingNode,
21848         followingNode = comment.followingNode;
21849
21850     if (handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleMemberExpressionComments(enclosingNode, followingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleImportSpecifierComments(enclosingNode, comment) || handleForComments(enclosingNode, precedingNode, comment) || handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) || handleAssignmentPatternComments(enclosingNode, comment) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options)) {
21851       return true;
21852     }
21853
21854     return false;
21855   }
21856
21857   function handleEndOfLineComment(comment, text, options, ast, isLastComment) {
21858     var precedingNode = comment.precedingNode,
21859         enclosingNode = comment.enclosingNode,
21860         followingNode = comment.followingNode;
21861
21862     if (handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) || handleImportSpecifierComments(enclosingNode, comment) || handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) || handleClassComments(enclosingNode, precedingNode, followingNode, comment) || handleLabeledStatementComments(enclosingNode, comment) || handleCallExpressionComments(precedingNode, enclosingNode, comment) || handlePropertyComments(enclosingNode, comment) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleTypeAliasComments(enclosingNode, followingNode, comment) || handleVariableDeclaratorComments(enclosingNode, followingNode, comment)) {
21863       return true;
21864     }
21865
21866     return false;
21867   }
21868
21869   function handleRemainingComment(comment, text, options, ast, isLastComment) {
21870     var precedingNode = comment.precedingNode,
21871         enclosingNode = comment.enclosingNode,
21872         followingNode = comment.followingNode;
21873
21874     if (handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) || handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) || handleCommentInEmptyParens(text, enclosingNode, comment, options) || handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) || handleOnlyComments(enclosingNode, ast, comment, isLastComment) || handleCommentAfterArrowParams(text, enclosingNode, comment, options) || handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) || handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) || handleBreakAndContinueStatementComments(enclosingNode, comment)) {
21875       return true;
21876     }
21877
21878     return false;
21879   }
21880
21881   function addBlockStatementFirstComment(node, comment) {
21882     var body = node.body.filter(function (n) {
21883       return n.type !== "EmptyStatement";
21884     });
21885
21886     if (body.length === 0) {
21887       addDanglingComment$2(node, comment);
21888     } else {
21889       addLeadingComment$2(body[0], comment);
21890     }
21891   }
21892
21893   function addBlockOrNotComment(node, comment) {
21894     if (node.type === "BlockStatement") {
21895       addBlockStatementFirstComment(node, comment);
21896     } else {
21897       addLeadingComment$2(node, comment);
21898     }
21899   } // There are often comments before the else clause of if statements like
21900   //
21901   //   if (1) { ... }
21902   //   // comment
21903   //   else { ... }
21904   //
21905   // They are being attached as leading comments of the BlockExpression which
21906   // is not well printed. What we want is to instead move the comment inside
21907   // of the block and make it leadingComment of the first element of the block
21908   // or dangling comment of the block if there is nothing inside
21909   //
21910   //   if (1) { ... }
21911   //   else {
21912   //     // comment
21913   //     ...
21914   //   }
21915
21916
21917   function handleIfStatementComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
21918     if (!enclosingNode || enclosingNode.type !== "IfStatement" || !followingNode) {
21919       return false;
21920     } // We unfortunately have no way using the AST or location of nodes to know
21921     // if the comment is positioned before the condition parenthesis:
21922     //   if (a /* comment */) {}
21923     // The only workaround I found is to look at the next character to see if
21924     // it is a ).
21925
21926
21927     var nextCharacter = util.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
21928
21929     if (nextCharacter === ")") {
21930       addTrailingComment$2(precedingNode, comment);
21931       return true;
21932     } // Comments before `else`:
21933     // - treat as trailing comments of the consequent, if it's a BlockStatement
21934     // - treat as a dangling comment otherwise
21935
21936
21937     if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
21938       if (precedingNode.type === "BlockStatement") {
21939         addTrailingComment$2(precedingNode, comment);
21940       } else {
21941         addDanglingComment$2(enclosingNode, comment);
21942       }
21943
21944       return true;
21945     }
21946
21947     if (followingNode.type === "BlockStatement") {
21948       addBlockStatementFirstComment(followingNode, comment);
21949       return true;
21950     }
21951
21952     if (followingNode.type === "IfStatement") {
21953       addBlockOrNotComment(followingNode.consequent, comment);
21954       return true;
21955     } // For comments positioned after the condition parenthesis in an if statement
21956     // before the consequent without brackets on, such as
21957     // if (a) /* comment */ true,
21958     // we look at the next character to see if the following node
21959     // is the consequent for the if statement
21960
21961
21962     if (enclosingNode.consequent === followingNode) {
21963       addLeadingComment$2(followingNode, comment);
21964       return true;
21965     }
21966
21967     return false;
21968   }
21969
21970   function handleWhileComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
21971     if (!enclosingNode || enclosingNode.type !== "WhileStatement" || !followingNode) {
21972       return false;
21973     } // We unfortunately have no way using the AST or location of nodes to know
21974     // if the comment is positioned before the condition parenthesis:
21975     //   while (a /* comment */) {}
21976     // The only workaround I found is to look at the next character to see if
21977     // it is a ).
21978
21979
21980     var nextCharacter = util.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd);
21981
21982     if (nextCharacter === ")") {
21983       addTrailingComment$2(precedingNode, comment);
21984       return true;
21985     }
21986
21987     if (followingNode.type === "BlockStatement") {
21988       addBlockStatementFirstComment(followingNode, comment);
21989       return true;
21990     }
21991
21992     return false;
21993   } // Same as IfStatement but for TryStatement
21994
21995
21996   function handleTryStatementComments(enclosingNode, precedingNode, followingNode, comment) {
21997     if (!enclosingNode || enclosingNode.type !== "TryStatement" && enclosingNode.type !== "CatchClause" || !followingNode) {
21998       return false;
21999     }
22000
22001     if (enclosingNode.type === "CatchClause" && precedingNode) {
22002       addTrailingComment$2(precedingNode, comment);
22003       return true;
22004     }
22005
22006     if (followingNode.type === "BlockStatement") {
22007       addBlockStatementFirstComment(followingNode, comment);
22008       return true;
22009     }
22010
22011     if (followingNode.type === "TryStatement") {
22012       addBlockOrNotComment(followingNode.finalizer, comment);
22013       return true;
22014     }
22015
22016     if (followingNode.type === "CatchClause") {
22017       addBlockOrNotComment(followingNode.body, comment);
22018       return true;
22019     }
22020
22021     return false;
22022   }
22023
22024   function handleMemberExpressionComments(enclosingNode, followingNode, comment) {
22025     if (enclosingNode && (enclosingNode.type === "MemberExpression" || enclosingNode.type === "OptionalMemberExpression") && followingNode && followingNode.type === "Identifier") {
22026       addLeadingComment$2(enclosingNode, comment);
22027       return true;
22028     }
22029
22030     return false;
22031   }
22032
22033   function handleConditionalExpressionComments(enclosingNode, precedingNode, followingNode, comment, text, options) {
22034     var isSameLineAsPrecedingNode = precedingNode && !util.hasNewlineInRange(text, options.locEnd(precedingNode), options.locStart(comment));
22035
22036     if ((!precedingNode || !isSameLineAsPrecedingNode) && enclosingNode && enclosingNode.type === "ConditionalExpression" && followingNode) {
22037       addLeadingComment$2(followingNode, comment);
22038       return true;
22039     }
22040
22041     return false;
22042   }
22043
22044   function handleObjectPropertyAssignment(enclosingNode, precedingNode, comment) {
22045     if (enclosingNode && (enclosingNode.type === "ObjectProperty" || enclosingNode.type === "Property") && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
22046       addTrailingComment$2(enclosingNode.value.left, comment);
22047       return true;
22048     }
22049
22050     return false;
22051   }
22052
22053   function handleClassComments(enclosingNode, precedingNode, followingNode, comment) {
22054     if (enclosingNode && (enclosingNode.type === "ClassDeclaration" || enclosingNode.type === "ClassExpression") && enclosingNode.decorators && enclosingNode.decorators.length > 0 && !(followingNode && followingNode.type === "Decorator")) {
22055       if (!enclosingNode.decorators || enclosingNode.decorators.length === 0) {
22056         addLeadingComment$2(enclosingNode, comment);
22057       } else {
22058         addTrailingComment$2(enclosingNode.decorators[enclosingNode.decorators.length - 1], comment);
22059       }
22060
22061       return true;
22062     }
22063
22064     return false;
22065   }
22066
22067   function handleMethodNameComments(text, enclosingNode, precedingNode, comment, options) {
22068     // This is only needed for estree parsers (flow, typescript) to attach
22069     // after a method name:
22070     // obj = { fn /*comment*/() {} };
22071     if (enclosingNode && precedingNode && (enclosingNode.type === "Property" || enclosingNode.type === "MethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && // special Property case: { key: /*comment*/(value) };
22072     // comment should be attached to value instead of key
22073     util.getNextNonSpaceNonCommentCharacter(text, precedingNode, options.locEnd) !== ":") {
22074       addTrailingComment$2(precedingNode, comment);
22075       return true;
22076     } // Print comments between decorators and class methods as a trailing comment
22077     // on the decorator node instead of the method node
22078
22079
22080     if (precedingNode && enclosingNode && precedingNode.type === "Decorator" && (enclosingNode.type === "ClassMethod" || enclosingNode.type === "ClassProperty" || enclosingNode.type === "TSAbstractClassProperty" || enclosingNode.type === "TSAbstractMethodDefinition" || enclosingNode.type === "MethodDefinition")) {
22081       addTrailingComment$2(precedingNode, comment);
22082       return true;
22083     }
22084
22085     return false;
22086   }
22087
22088   function handleFunctionNameComments(text, enclosingNode, precedingNode, comment, options) {
22089     if (util.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== "(") {
22090       return false;
22091     }
22092
22093     if (precedingNode && enclosingNode && (enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "MethodDefinition" || enclosingNode.type === "ObjectMethod")) {
22094       addTrailingComment$2(precedingNode, comment);
22095       return true;
22096     }
22097
22098     return false;
22099   }
22100
22101   function handleCommentAfterArrowParams(text, enclosingNode, comment, options) {
22102     if (!(enclosingNode && enclosingNode.type === "ArrowFunctionExpression")) {
22103       return false;
22104     }
22105
22106     var index = utilShared.getNextNonSpaceNonCommentCharacterIndex(text, comment, options);
22107
22108     if (text.substr(index, 2) === "=>") {
22109       addDanglingComment$2(enclosingNode, comment);
22110       return true;
22111     }
22112
22113     return false;
22114   }
22115
22116   function handleCommentInEmptyParens(text, enclosingNode, comment, options) {
22117     if (util.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) !== ")") {
22118       return false;
22119     } // Only add dangling comments to fix the case when no params are present,
22120     // i.e. a function without any argument.
22121
22122
22123     if (enclosingNode && ((enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "ArrowFunctionExpression" || enclosingNode.type === "ClassMethod" || enclosingNode.type === "ObjectMethod") && enclosingNode.params.length === 0 || (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression" || enclosingNode.type === "NewExpression") && enclosingNode.arguments.length === 0)) {
22124       addDanglingComment$2(enclosingNode, comment);
22125       return true;
22126     }
22127
22128     if (enclosingNode && enclosingNode.type === "MethodDefinition" && enclosingNode.value.params.length === 0) {
22129       addDanglingComment$2(enclosingNode.value, comment);
22130       return true;
22131     }
22132
22133     return false;
22134   }
22135
22136   function handleLastFunctionArgComments(text, precedingNode, enclosingNode, followingNode, comment, options) {
22137     // Type definitions functions
22138     if (precedingNode && precedingNode.type === "FunctionTypeParam" && enclosingNode && enclosingNode.type === "FunctionTypeAnnotation" && followingNode && followingNode.type !== "FunctionTypeParam") {
22139       addTrailingComment$2(precedingNode, comment);
22140       return true;
22141     } // Real functions
22142
22143
22144     if (precedingNode && (precedingNode.type === "Identifier" || precedingNode.type === "AssignmentPattern") && enclosingNode && (enclosingNode.type === "ArrowFunctionExpression" || enclosingNode.type === "FunctionExpression" || enclosingNode.type === "FunctionDeclaration" || enclosingNode.type === "ObjectMethod" || enclosingNode.type === "ClassMethod") && util.getNextNonSpaceNonCommentCharacter(text, comment, options.locEnd) === ")") {
22145       addTrailingComment$2(precedingNode, comment);
22146       return true;
22147     }
22148
22149     if (enclosingNode && enclosingNode.type === "FunctionDeclaration" && followingNode && followingNode.type === "BlockStatement") {
22150       var functionParamRightParenIndex = function () {
22151         if (enclosingNode.params.length !== 0) {
22152           return util.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(util.getLast(enclosingNode.params)));
22153         }
22154
22155         var functionParamLeftParenIndex = util.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, options.locEnd(enclosingNode.id));
22156         return util.getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
22157       }();
22158
22159       if (options.locStart(comment) > functionParamRightParenIndex) {
22160         addBlockStatementFirstComment(followingNode, comment);
22161         return true;
22162       }
22163     }
22164
22165     return false;
22166   }
22167
22168   function handleImportSpecifierComments(enclosingNode, comment) {
22169     if (enclosingNode && enclosingNode.type === "ImportSpecifier") {
22170       addLeadingComment$2(enclosingNode, comment);
22171       return true;
22172     }
22173
22174     return false;
22175   }
22176
22177   function handleLabeledStatementComments(enclosingNode, comment) {
22178     if (enclosingNode && enclosingNode.type === "LabeledStatement") {
22179       addLeadingComment$2(enclosingNode, comment);
22180       return true;
22181     }
22182
22183     return false;
22184   }
22185
22186   function handleBreakAndContinueStatementComments(enclosingNode, comment) {
22187     if (enclosingNode && (enclosingNode.type === "ContinueStatement" || enclosingNode.type === "BreakStatement") && !enclosingNode.label) {
22188       addTrailingComment$2(enclosingNode, comment);
22189       return true;
22190     }
22191
22192     return false;
22193   }
22194
22195   function handleCallExpressionComments(precedingNode, enclosingNode, comment) {
22196     if (enclosingNode && (enclosingNode.type === "CallExpression" || enclosingNode.type === "OptionalCallExpression") && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
22197       addLeadingComment$2(enclosingNode.arguments[0], comment);
22198       return true;
22199     }
22200
22201     return false;
22202   }
22203
22204   function handleUnionTypeComments(precedingNode, enclosingNode, followingNode, comment) {
22205     if (enclosingNode && (enclosingNode.type === "UnionTypeAnnotation" || enclosingNode.type === "TSUnionType")) {
22206       addTrailingComment$2(precedingNode, comment);
22207       return true;
22208     }
22209
22210     return false;
22211   }
22212
22213   function handlePropertyComments(enclosingNode, comment) {
22214     if (enclosingNode && (enclosingNode.type === "Property" || enclosingNode.type === "ObjectProperty")) {
22215       addLeadingComment$2(enclosingNode, comment);
22216       return true;
22217     }
22218
22219     return false;
22220   }
22221
22222   function handleOnlyComments(enclosingNode, ast, comment, isLastComment) {
22223     // With Flow the enclosingNode is undefined so use the AST instead.
22224     if (ast && ast.body && ast.body.length === 0) {
22225       if (isLastComment) {
22226         addDanglingComment$2(ast, comment);
22227       } else {
22228         addLeadingComment$2(ast, comment);
22229       }
22230
22231       return true;
22232     } else if (enclosingNode && enclosingNode.type === "Program" && enclosingNode.body.length === 0 && enclosingNode.directives && enclosingNode.directives.length === 0) {
22233       if (isLastComment) {
22234         addDanglingComment$2(enclosingNode, comment);
22235       } else {
22236         addLeadingComment$2(enclosingNode, comment);
22237       }
22238
22239       return true;
22240     }
22241
22242     return false;
22243   }
22244
22245   function handleForComments(enclosingNode, precedingNode, comment) {
22246     if (enclosingNode && (enclosingNode.type === "ForInStatement" || enclosingNode.type === "ForOfStatement")) {
22247       addLeadingComment$2(enclosingNode, comment);
22248       return true;
22249     }
22250
22251     return false;
22252   }
22253
22254   function handleImportDeclarationComments(text, enclosingNode, precedingNode, comment, options) {
22255     if (precedingNode && precedingNode.type === "ImportSpecifier" && enclosingNode && enclosingNode.type === "ImportDeclaration" && util.hasNewline(text, options.locEnd(comment))) {
22256       addTrailingComment$2(precedingNode, comment);
22257       return true;
22258     }
22259
22260     return false;
22261   }
22262
22263   function handleAssignmentPatternComments(enclosingNode, comment) {
22264     if (enclosingNode && enclosingNode.type === "AssignmentPattern") {
22265       addLeadingComment$2(enclosingNode, comment);
22266       return true;
22267     }
22268
22269     return false;
22270   }
22271
22272   function handleTypeAliasComments(enclosingNode, followingNode, comment) {
22273     if (enclosingNode && enclosingNode.type === "TypeAlias") {
22274       addLeadingComment$2(enclosingNode, comment);
22275       return true;
22276     }
22277
22278     return false;
22279   }
22280
22281   function handleVariableDeclaratorComments(enclosingNode, followingNode, comment) {
22282     if (enclosingNode && (enclosingNode.type === "VariableDeclarator" || enclosingNode.type === "AssignmentExpression") && followingNode && (followingNode.type === "ObjectExpression" || followingNode.type === "ArrayExpression" || followingNode.type === "TemplateLiteral" || followingNode.type === "TaggedTemplateExpression")) {
22283       addLeadingComment$2(followingNode, comment);
22284       return true;
22285     }
22286
22287     return false;
22288   }
22289
22290   function handleTSMappedTypeComments(text, enclosingNode, precedingNode, followingNode, comment) {
22291     if (!enclosingNode || enclosingNode.type !== "TSMappedType") {
22292       return false;
22293     }
22294
22295     if (followingNode && followingNode.type === "TSTypeParameter" && followingNode.name) {
22296       addLeadingComment$2(followingNode.name, comment);
22297       return true;
22298     }
22299
22300     if (precedingNode && precedingNode.type === "TSTypeParameter" && precedingNode.constraint) {
22301       addTrailingComment$2(precedingNode.constraint, comment);
22302       return true;
22303     }
22304
22305     return false;
22306   }
22307
22308   function isBlockComment(comment) {
22309     return comment.type === "Block" || comment.type === "CommentBlock";
22310   }
22311
22312   function hasLeadingComment(node) {
22313     var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
22314       return true;
22315     };
22316
22317     if (node.leadingComments) {
22318       return node.leadingComments.some(fn);
22319     }
22320
22321     if (node.comments) {
22322       return node.comments.some(function (comment) {
22323         return comment.leading && fn(comment);
22324       });
22325     }
22326
22327     return false;
22328   }
22329
22330   var comments$1 = {
22331     handleOwnLineComment: handleOwnLineComment,
22332     handleEndOfLineComment: handleEndOfLineComment,
22333     handleRemainingComment: handleRemainingComment,
22334     hasLeadingComment: hasLeadingComment,
22335     isBlockComment: isBlockComment
22336   };
22337
22338   var isBlockComment$1 = comments$1.isBlockComment,
22339       hasLeadingComment$1 = comments$1.hasLeadingComment;
22340   var _require$$1$builders = doc.builders,
22341       indent$6 = _require$$1$builders.indent,
22342       join$7 = _require$$1$builders.join,
22343       hardline$8 = _require$$1$builders.hardline,
22344       softline$5 = _require$$1$builders.softline,
22345       literalline$3 = _require$$1$builders.literalline,
22346       concat$b = _require$$1$builders.concat,
22347       group$a = _require$$1$builders.group,
22348       dedentToRoot$2 = _require$$1$builders.dedentToRoot,
22349       _require$$1$utils = doc.utils,
22350       mapDoc$5 = _require$$1$utils.mapDoc,
22351       stripTrailingHardline$2 = _require$$1$utils.stripTrailingHardline;
22352
22353   function embed$3(path, print, textToDoc, options) {
22354     var node = path.getValue();
22355     var parent = path.getParentNode();
22356     var parentParent = path.getParentNode(1);
22357
22358     switch (node.type) {
22359       case "TemplateLiteral":
22360         {
22361           var isCss = [isStyledJsx, isStyledComponents, isCssProp, isAngularComponentStyles].some(function (isIt) {
22362             return isIt(path);
22363           });
22364
22365           if (isCss) {
22366             // Get full template literal with expressions replaced by placeholders
22367             var rawQuasis = node.quasis.map(function (q) {
22368               return q.value.raw;
22369             });
22370             var placeholderID = 0;
22371             var text = rawQuasis.reduce(function (prevVal, currVal, idx) {
22372               return idx == 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal;
22373             }, "");
22374             var doc = textToDoc(text, {
22375               parser: "css"
22376             });
22377             return transformCssDoc(doc, path, print);
22378           }
22379           /*
22380            * react-relay and graphql-tag
22381            * graphql`...`
22382            * graphql.experimental`...`
22383            * gql`...`
22384            *
22385            * This intentionally excludes Relay Classic tags, as Prettier does not
22386            * support Relay Classic formatting.
22387            */
22388
22389
22390           if (isGraphQL(path)) {
22391             var expressionDocs = node.expressions ? path.map(print, "expressions") : [];
22392             var numQuasis = node.quasis.length;
22393
22394             if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
22395               return "``";
22396             }
22397
22398             var parts = [];
22399
22400             for (var i = 0; i < numQuasis; i++) {
22401               var templateElement = node.quasis[i];
22402               var isFirst = i === 0;
22403               var isLast = i === numQuasis - 1;
22404               var _text = templateElement.value.cooked; // Bail out if any of the quasis have an invalid escape sequence
22405               // (which would make the `cooked` value be `null` or `undefined`)
22406
22407               if (typeof _text !== "string") {
22408                 return null;
22409               }
22410
22411               var lines = _text.split("\n");
22412
22413               var numLines = lines.length;
22414               var expressionDoc = expressionDocs[i];
22415               var startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
22416               var endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
22417               var commentsAndWhitespaceOnly = lines.every(function (line) {
22418                 return /^\s*(?:#[^\r\n]*)?$/.test(line);
22419               }); // Bail out if an interpolation occurs within a comment.
22420
22421               if (!isLast && /#[^\r\n]*$/.test(lines[numLines - 1])) {
22422                 return null;
22423               }
22424
22425               var _doc = null;
22426
22427               if (commentsAndWhitespaceOnly) {
22428                 _doc = printGraphqlComments(lines);
22429               } else {
22430                 _doc = stripTrailingHardline$2(textToDoc(_text, {
22431                   parser: "graphql"
22432                 }));
22433               }
22434
22435               if (_doc) {
22436                 _doc = escapeTemplateCharacters(_doc, false);
22437
22438                 if (!isFirst && startsWithBlankLine) {
22439                   parts.push("");
22440                 }
22441
22442                 parts.push(_doc);
22443
22444                 if (!isLast && endsWithBlankLine) {
22445                   parts.push("");
22446                 }
22447               } else if (!isFirst && !isLast && startsWithBlankLine) {
22448                 parts.push("");
22449               }
22450
22451               if (expressionDoc) {
22452                 parts.push(concat$b(["${", expressionDoc, "}"]));
22453               }
22454             }
22455
22456             return concat$b(["`", indent$6(concat$b([hardline$8, join$7(hardline$8, parts)])), hardline$8, "`"]);
22457           }
22458
22459           var htmlParser = isHtml(path) ? "html" : isAngularComponentTemplate(path) ? "angular" : undefined;
22460
22461           if (htmlParser) {
22462             return printHtmlTemplateLiteral(path, print, textToDoc, htmlParser, options.embeddedInHtml);
22463           }
22464
22465           break;
22466         }
22467
22468       case "TemplateElement":
22469         {
22470           /**
22471            * md`...`
22472            * markdown`...`
22473            */
22474           if (parentParent && parentParent.type === "TaggedTemplateExpression" && parent.quasis.length === 1 && parentParent.tag.type === "Identifier" && (parentParent.tag.name === "md" || parentParent.tag.name === "markdown")) {
22475             var _text2 = parent.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, function (_, backslashes) {
22476               return "\\".repeat(backslashes.length / 2) + "`";
22477             });
22478
22479             var indentation = getIndentation(_text2);
22480             var hasIndent = indentation !== "";
22481             return concat$b([hasIndent ? indent$6(concat$b([softline$5, printMarkdown(_text2.replace(new RegExp("^".concat(indentation), "gm"), ""))])) : concat$b([literalline$3, dedentToRoot$2(printMarkdown(_text2))]), softline$5]);
22482           }
22483
22484           break;
22485         }
22486     }
22487
22488     function printMarkdown(text) {
22489       var doc = textToDoc(text, {
22490         parser: "markdown",
22491         __inJsTemplate: true
22492       });
22493       return stripTrailingHardline$2(escapeTemplateCharacters(doc, true));
22494     }
22495   }
22496
22497   function getIndentation(str) {
22498     var firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
22499     return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
22500   }
22501
22502   function uncook(cookedValue) {
22503     return cookedValue.replace(/([\\`]|\$\{)/g, "\\$1");
22504   }
22505
22506   function escapeTemplateCharacters(doc, raw) {
22507     return mapDoc$5(doc, function (currentDoc) {
22508       if (!currentDoc.parts) {
22509         return currentDoc;
22510       }
22511
22512       var parts = [];
22513       currentDoc.parts.forEach(function (part) {
22514         if (typeof part === "string") {
22515           parts.push(raw ? part.replace(/(\\*)`/g, "$1$1\\`") : uncook(part));
22516         } else {
22517           parts.push(part);
22518         }
22519       });
22520       return Object.assign({}, currentDoc, {
22521         parts: parts
22522       });
22523     });
22524   }
22525
22526   function transformCssDoc(quasisDoc, path, print) {
22527     var parentNode = path.getValue();
22528     var isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
22529
22530     if (isEmpty) {
22531       return "``";
22532     }
22533
22534     var expressionDocs = parentNode.expressions ? path.map(print, "expressions") : [];
22535     var newDoc = replacePlaceholders(quasisDoc, expressionDocs);
22536     /* istanbul ignore if */
22537
22538     if (!newDoc) {
22539       throw new Error("Couldn't insert all the expressions");
22540     }
22541
22542     return concat$b(["`", indent$6(concat$b([hardline$8, stripTrailingHardline$2(newDoc)])), softline$5, "`"]);
22543   } // Search all the placeholders in the quasisDoc tree
22544   // and replace them with the expression docs one by one
22545   // returns a new doc with all the placeholders replaced,
22546   // or null if it couldn't replace any expression
22547
22548
22549   function replacePlaceholders(quasisDoc, expressionDocs) {
22550     if (!expressionDocs || !expressionDocs.length) {
22551       return quasisDoc;
22552     }
22553
22554     var expressions = expressionDocs.slice();
22555     var replaceCounter = 0;
22556     var newDoc = mapDoc$5(quasisDoc, function (doc) {
22557       if (!doc || !doc.parts || !doc.parts.length) {
22558         return doc;
22559       }
22560
22561       var parts = doc.parts;
22562       var atIndex = parts.indexOf("@");
22563       var placeholderIndex = atIndex + 1;
22564
22565       if (atIndex > -1 && typeof parts[placeholderIndex] === "string" && parts[placeholderIndex].startsWith("prettier-placeholder")) {
22566         // If placeholder is split, join it
22567         var at = parts[atIndex];
22568         var placeholder = parts[placeholderIndex];
22569         var rest = parts.slice(placeholderIndex + 1);
22570         parts = parts.slice(0, atIndex).concat([at + placeholder]).concat(rest);
22571       }
22572
22573       var atPlaceholderIndex = parts.findIndex(function (part) {
22574         return typeof part === "string" && part.startsWith("@prettier-placeholder");
22575       });
22576
22577       if (atPlaceholderIndex > -1) {
22578         var _placeholder = parts[atPlaceholderIndex];
22579
22580         var _rest = parts.slice(atPlaceholderIndex + 1);
22581
22582         var placeholderMatch = _placeholder.match(/@prettier-placeholder-(.+)-id([\s\S]*)/);
22583
22584         var placeholderID = placeholderMatch[1]; // When the expression has a suffix appended, like:
22585         // animation: linear ${time}s ease-out;
22586
22587         var suffix = placeholderMatch[2];
22588         var expression = expressions[placeholderID];
22589         replaceCounter++;
22590         parts = parts.slice(0, atPlaceholderIndex).concat(["${", expression, "}" + suffix]).concat(_rest);
22591       }
22592
22593       return Object.assign({}, doc, {
22594         parts: parts
22595       });
22596     });
22597     return expressions.length === replaceCounter ? newDoc : null;
22598   }
22599
22600   function printGraphqlComments(lines) {
22601     var parts = [];
22602     var seenComment = false;
22603     lines.map(function (textLine) {
22604       return textLine.trim();
22605     }).forEach(function (textLine, i, array) {
22606       // Lines are either whitespace only, or a comment (with potential whitespace
22607       // around it). Drop whitespace-only lines.
22608       if (textLine === "") {
22609         return;
22610       }
22611
22612       if (array[i - 1] === "" && seenComment) {
22613         // If a non-first comment is preceded by a blank (whitespace only) line,
22614         // add in a blank line.
22615         parts.push(concat$b([hardline$8, textLine]));
22616       } else {
22617         parts.push(textLine);
22618       }
22619
22620       seenComment = true;
22621     }); // If `lines` was whitespace only, return `null`.
22622
22623     return parts.length === 0 ? null : join$7(hardline$8, parts);
22624   }
22625   /**
22626    * Template literal in these contexts:
22627    * <style jsx>{`div{color:red}`}</style>
22628    * css``
22629    * css.global``
22630    * css.resolve``
22631    */
22632
22633
22634   function isStyledJsx(path) {
22635     var node = path.getValue();
22636     var parent = path.getParentNode();
22637     var parentParent = path.getParentNode(1);
22638     return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some(function (attribute) {
22639       return attribute.name.name === "jsx";
22640     }) || 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");
22641   }
22642   /**
22643    * Angular Components can have:
22644    * - Inline HTML template
22645    * - Inline CSS styles
22646    *
22647    * ...which are both within template literals somewhere
22648    * inside of the Component decorator factory.
22649    *
22650    * E.g.
22651    * @Component({
22652    *  template: `<div>...</div>`,
22653    *  styles: [`h1 { color: blue; }`]
22654    * })
22655    */
22656
22657
22658   function isAngularComponentStyles(path) {
22659     return isPathMatch(path, [function (node) {
22660       return node.type === "TemplateLiteral";
22661     }, function (node, name) {
22662       return node.type === "ArrayExpression" && name === "elements";
22663     }, function (node, name) {
22664       return node.type === "Property" && node.key.type === "Identifier" && node.key.name === "styles" && name === "value";
22665     }].concat(getAngularComponentObjectExpressionPredicates()));
22666   }
22667
22668   function isAngularComponentTemplate(path) {
22669     return isPathMatch(path, [function (node) {
22670       return node.type === "TemplateLiteral";
22671     }, function (node, name) {
22672       return node.type === "Property" && node.key.type === "Identifier" && node.key.name === "template" && name === "value";
22673     }].concat(getAngularComponentObjectExpressionPredicates()));
22674   }
22675
22676   function getAngularComponentObjectExpressionPredicates() {
22677     return [function (node, name) {
22678       return node.type === "ObjectExpression" && name === "properties";
22679     }, function (node, name) {
22680       return node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "Component" && name === "arguments";
22681     }, function (node, name) {
22682       return node.type === "Decorator" && name === "expression";
22683     }];
22684   }
22685   /**
22686    * styled-components template literals
22687    */
22688
22689
22690   function isStyledComponents(path) {
22691     var parent = path.getParentNode();
22692
22693     if (!parent || parent.type !== "TaggedTemplateExpression") {
22694       return false;
22695     }
22696
22697     var tag = parent.tag;
22698
22699     switch (tag.type) {
22700       case "MemberExpression":
22701         return (// styled.foo``
22702           isStyledIdentifier(tag.object) || // Component.extend``
22703           isStyledExtend(tag)
22704         );
22705
22706       case "CallExpression":
22707         return (// styled(Component)``
22708           isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && ( // styled.foo.attrs({})``
22709           isStyledIdentifier(tag.callee.object.object) || // Component.extend.attrs({})``
22710           isStyledExtend(tag.callee.object)) || // styled(Component).attrs({})``
22711           tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee))
22712         );
22713
22714       case "Identifier":
22715         // css``
22716         return tag.name === "css";
22717
22718       default:
22719         return false;
22720     }
22721   }
22722   /**
22723    * JSX element with CSS prop
22724    */
22725
22726
22727   function isCssProp(path) {
22728     var parent = path.getParentNode();
22729     var parentParent = path.getParentNode(1);
22730     return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
22731   }
22732
22733   function isStyledIdentifier(node) {
22734     return node.type === "Identifier" && node.name === "styled";
22735   }
22736
22737   function isStyledExtend(node) {
22738     return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
22739   }
22740   /*
22741    * react-relay and graphql-tag
22742    * graphql`...`
22743    * graphql.experimental`...`
22744    * gql`...`
22745    * GraphQL comment block
22746    *
22747    * This intentionally excludes Relay Classic tags, as Prettier does not
22748    * support Relay Classic formatting.
22749    */
22750
22751
22752   function isGraphQL(path) {
22753     var node = path.getValue();
22754     var parent = path.getParentNode();
22755     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");
22756   }
22757
22758   function hasLanguageComment(node, languageName) {
22759     // This checks for a leading comment that is exactly `/* GraphQL */`
22760     // In order to be in line with other implementations of this comment tag
22761     // we will not trim the comment value and we will expect exactly one space on
22762     // either side of the GraphQL string
22763     // Also see ./clean.js
22764     return hasLeadingComment$1(node, function (comment) {
22765       return isBlockComment$1(comment) && comment.value === " ".concat(languageName, " ");
22766     });
22767   }
22768
22769   function isPathMatch(path, predicateStack) {
22770     var stack = path.stack.slice();
22771     var name = null;
22772     var node = stack.pop();
22773     var _iteratorNormalCompletion = true;
22774     var _didIteratorError = false;
22775     var _iteratorError = undefined;
22776
22777     try {
22778       for (var _iterator = predicateStack[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
22779         var predicate = _step.value;
22780
22781         if (node === undefined) {
22782           return false;
22783         } // skip index/array
22784
22785
22786         if (typeof name === "number") {
22787           name = stack.pop();
22788           node = stack.pop();
22789         }
22790
22791         if (!predicate(node, name)) {
22792           return false;
22793         }
22794
22795         name = stack.pop();
22796         node = stack.pop();
22797       }
22798     } catch (err) {
22799       _didIteratorError = true;
22800       _iteratorError = err;
22801     } finally {
22802       try {
22803         if (!_iteratorNormalCompletion && _iterator.return != null) {
22804           _iterator.return();
22805         }
22806       } finally {
22807         if (_didIteratorError) {
22808           throw _iteratorError;
22809         }
22810       }
22811     }
22812
22813     return true;
22814   }
22815   /**
22816    *     - html`...`
22817    *     - HTML comment block
22818    */
22819
22820
22821   function isHtml(path) {
22822     var node = path.getValue();
22823     return hasLanguageComment(node, "HTML") || isPathMatch(path, [function (node) {
22824       return node.type === "TemplateLiteral";
22825     }, function (node, name) {
22826       return node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi";
22827     }]);
22828   } // The counter is needed to distinguish nested embeds.
22829
22830
22831   var htmlTemplateLiteralCounter = 0;
22832
22833   function printHtmlTemplateLiteral(path, print, textToDoc, parser, escapeClosingScriptTag) {
22834     var node = path.getValue();
22835     var counter = htmlTemplateLiteralCounter;
22836     htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
22837
22838     var composePlaceholder = function composePlaceholder(index) {
22839       return "PRETTIER_HTML_PLACEHOLDER_".concat(index, "_").concat(counter, "_IN_JS");
22840     };
22841
22842     var text = node.quasis.map(function (quasi, index, quasis) {
22843       return index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index);
22844     }).join("");
22845     var expressionDocs = path.map(print, "expressions");
22846
22847     if (expressionDocs.length === 0 && text.trim().length === 0) {
22848       return "``";
22849     }
22850
22851     var placeholderRegex = RegExp(composePlaceholder("(\\d+)"), "g");
22852     var contentDoc = mapDoc$5(stripTrailingHardline$2(textToDoc(text, {
22853       parser: parser
22854     })), function (doc) {
22855       if (typeof doc !== "string") {
22856         return doc;
22857       }
22858
22859       var parts = [];
22860       var components = doc.split(placeholderRegex);
22861
22862       for (var i = 0; i < components.length; i++) {
22863         var component = components[i];
22864
22865         if (i % 2 === 0) {
22866           if (component) {
22867             component = uncook(component);
22868
22869             if (escapeClosingScriptTag) {
22870               component = component.replace(/<\/(script)\b/gi, "<\\/$1");
22871             }
22872
22873             parts.push(component);
22874           }
22875
22876           continue;
22877         }
22878
22879         var placeholderIndex = +component;
22880         parts.push(concat$b(["${", group$a(expressionDocs[placeholderIndex]), "}"]));
22881       }
22882
22883       return concat$b(parts);
22884     });
22885     return group$a(concat$b(["`", indent$6(concat$b([hardline$8, group$a(contentDoc)])), softline$5, "`"]));
22886   }
22887
22888   var embed_1$1 = embed$3;
22889
22890   function clean$4(ast, newObj, parent) {
22891     ["range", "raw", "comments", "leadingComments", "trailingComments", "extra", "start", "end", "flags", "errors"].forEach(function (name) {
22892       delete newObj[name];
22893     });
22894
22895     if (ast.type === "BigIntLiteral") {
22896       newObj.value = newObj.value.toLowerCase();
22897     } // We remove extra `;` and add them when needed
22898
22899
22900     if (ast.type === "EmptyStatement") {
22901       return null;
22902     } // We move text around, including whitespaces and add {" "}
22903
22904
22905     if (ast.type === "JSXText") {
22906       return null;
22907     }
22908
22909     if (ast.type === "JSXExpressionContainer" && ast.expression.type === "Literal" && ast.expression.value === " ") {
22910       return null;
22911     } // We remove unneeded parens around same-operator LogicalExpressions
22912
22913
22914     if (isUnbalancedLogicalTree(newObj)) {
22915       return rebalanceLogicalTree(newObj);
22916     } // (TypeScript) Ignore `static` in `constructor(static p) {}`
22917     // and `export` in `constructor(export p) {}`
22918
22919
22920     if (ast.type === "TSParameterProperty" && ast.accessibility === null && !ast.readonly) {
22921       return {
22922         type: "Identifier",
22923         name: ast.parameter.name,
22924         typeAnnotation: newObj.parameter.typeAnnotation,
22925         decorators: newObj.decorators
22926       };
22927     } // (TypeScript) ignore empty `specifiers` array
22928
22929
22930     if (ast.type === "TSNamespaceExportDeclaration" && ast.specifiers && ast.specifiers.length === 0) {
22931       delete newObj.specifiers;
22932     } // We convert <div></div> to <div />
22933
22934
22935     if (ast.type === "JSXOpeningElement") {
22936       delete newObj.selfClosing;
22937     }
22938
22939     if (ast.type === "JSXElement") {
22940       delete newObj.closingElement;
22941     } // We change {'key': value} into {key: value}
22942
22943
22944     if ((ast.type === "Property" || ast.type === "ObjectProperty" || ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && _typeof(ast.key) === "object" && ast.key && (ast.key.type === "Literal" || ast.key.type === "StringLiteral" || ast.key.type === "Identifier")) {
22945       delete newObj.key;
22946     }
22947
22948     if (ast.type === "OptionalMemberExpression" && ast.optional === false) {
22949       newObj.type = "MemberExpression";
22950       delete newObj.optional;
22951     } // Remove raw and cooked values from TemplateElement when it's CSS
22952     // styled-jsx
22953
22954
22955     if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some(function (attr) {
22956       return attr.name.name === "jsx";
22957     })) {
22958       var templateLiterals = newObj.children.filter(function (child) {
22959         return child.type === "JSXExpressionContainer" && child.expression.type === "TemplateLiteral";
22960       }).map(function (container) {
22961         return container.expression;
22962       });
22963       var quasis = templateLiterals.reduce(function (quasis, templateLiteral) {
22964         return quasis.concat(templateLiteral.quasis);
22965       }, []);
22966       quasis.forEach(function (q) {
22967         return delete q.value;
22968       });
22969     } // CSS template literals in css prop
22970
22971
22972     if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
22973       newObj.value.expression.quasis.forEach(function (q) {
22974         return delete q.value;
22975       });
22976     } // Angular Components: Inline HTML template and Inline CSS styles
22977
22978
22979     var expression = ast.expression || ast.callee;
22980
22981     if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
22982       var astProps = ast.expression.arguments[0].properties;
22983       newObj.expression.arguments[0].properties.forEach(function (prop, index) {
22984         var templateLiteral = null;
22985
22986         switch (astProps[index].key.name) {
22987           case "styles":
22988             if (prop.value.type === "ArrayExpression") {
22989               templateLiteral = prop.value.elements[0];
22990             }
22991
22992             break;
22993
22994           case "template":
22995             if (prop.value.type === "TemplateLiteral") {
22996               templateLiteral = prop.value;
22997             }
22998
22999             break;
23000         }
23001
23002         if (templateLiteral) {
23003           templateLiteral.quasis.forEach(function (q) {
23004             return delete q.value;
23005           });
23006         }
23007       });
23008     } // styled-components, graphql, markdown
23009
23010
23011     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")) {
23012       newObj.quasi.quasis.forEach(function (quasi) {
23013         return delete quasi.value;
23014       });
23015     }
23016
23017     if (ast.type === "TemplateLiteral") {
23018       // This checks for a leading comment that is exactly `/* GraphQL */`
23019       // In order to be in line with other implementations of this comment tag
23020       // we will not trim the comment value and we will expect exactly one space on
23021       // either side of the GraphQL string
23022       // Also see ./embed.js
23023       var hasLanguageComment = ast.leadingComments && ast.leadingComments.some(function (comment) {
23024         return comment.type === "CommentBlock" && ["GraphQL", "HTML"].some(function (languageName) {
23025           return comment.value === " ".concat(languageName, " ");
23026         });
23027       });
23028
23029       if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql") {
23030         newObj.quasis.forEach(function (quasi) {
23031           return delete quasi.value;
23032         });
23033       }
23034     }
23035   }
23036
23037   function isUnbalancedLogicalTree(newObj) {
23038     return newObj.type === "LogicalExpression" && newObj.right.type === "LogicalExpression" && newObj.operator === newObj.right.operator;
23039   }
23040
23041   function rebalanceLogicalTree(newObj) {
23042     if (isUnbalancedLogicalTree(newObj)) {
23043       return rebalanceLogicalTree({
23044         type: "LogicalExpression",
23045         operator: newObj.operator,
23046         left: rebalanceLogicalTree({
23047           type: "LogicalExpression",
23048           operator: newObj.operator,
23049           left: newObj.left,
23050           right: newObj.right.left,
23051           loc: {}
23052         }),
23053         right: newObj.right.right,
23054         loc: {}
23055       });
23056     }
23057
23058     return newObj;
23059   }
23060
23061   var clean_1$1 = clean$4;
23062
23063   var getLast$1 = util.getLast,
23064       hasNewline$3 = util.hasNewline,
23065       hasNewlineInRange$1 = util.hasNewlineInRange,
23066       hasIgnoreComment$3 = util.hasIgnoreComment,
23067       hasNodeIgnoreComment$1 = util.hasNodeIgnoreComment,
23068       skipWhitespace$1 = util.skipWhitespace;
23069   var isIdentifierName = utils$1.keyword.isIdentifierNameES5; // We match any whitespace except line terminators because
23070   // Flow annotation comments cannot be split across lines. For example:
23071   //
23072   // (this /*
23073   // : any */).foo = 5;
23074   //
23075   // is not picked up by Flow (see https://github.com/facebook/flow/issues/7050), so
23076   // removing the newline would create a type annotation that the user did not intend
23077   // to create.
23078
23079   var NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
23080   var FLOW_SHORTHAND_ANNOTATION = new RegExp("^".concat(NON_LINE_TERMINATING_WHITE_SPACE, "*:"));
23081   var FLOW_ANNOTATION = new RegExp("^".concat(NON_LINE_TERMINATING_WHITE_SPACE, "*::"));
23082
23083   function hasFlowShorthandAnnotationComment(node) {
23084     // https://flow.org/en/docs/types/comments/
23085     // Syntax example: const r = new (window.Request /*: Class<Request> */)("");
23086     return node.extra && node.extra.parenthesized && node.trailingComments && node.trailingComments[0].value.match(FLOW_SHORTHAND_ANNOTATION);
23087   }
23088
23089   function hasFlowAnnotationComment(comments) {
23090     return comments && comments[0].value.match(FLOW_ANNOTATION);
23091   }
23092
23093   function hasNode(node, fn) {
23094     if (!node || _typeof(node) !== "object") {
23095       return false;
23096     }
23097
23098     if (Array.isArray(node)) {
23099       return node.some(function (value) {
23100         return hasNode(value, fn);
23101       });
23102     }
23103
23104     var result = fn(node);
23105     return typeof result === "boolean" ? result : Object.keys(node).some(function (key) {
23106       return hasNode(node[key], fn);
23107     });
23108   }
23109
23110   function hasNakedLeftSide(node) {
23111     return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || node.type === "CallExpression" || node.type === "OptionalCallExpression" || node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSAsExpression" || node.type === "TSNonNullExpression";
23112   }
23113
23114   function getLeftSide(node) {
23115     if (node.expressions) {
23116       return node.expressions[0];
23117     }
23118
23119     return node.left || node.test || node.callee || node.object || node.tag || node.argument || node.expression;
23120   }
23121
23122   function getLeftSidePathName(path, node) {
23123     if (node.expressions) {
23124       return ["expressions", 0];
23125     }
23126
23127     if (node.left) {
23128       return ["left"];
23129     }
23130
23131     if (node.test) {
23132       return ["test"];
23133     }
23134
23135     if (node.object) {
23136       return ["object"];
23137     }
23138
23139     if (node.callee) {
23140       return ["callee"];
23141     }
23142
23143     if (node.tag) {
23144       return ["tag"];
23145     }
23146
23147     if (node.argument) {
23148       return ["argument"];
23149     }
23150
23151     if (node.expression) {
23152       return ["expression"];
23153     }
23154
23155     throw new Error("Unexpected node has no left side", node);
23156   }
23157
23158   function isLiteral(node) {
23159     return node.type === "BooleanLiteral" || node.type === "DirectiveLiteral" || node.type === "Literal" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "TemplateLiteral" || node.type === "TSTypeLiteral" || node.type === "JSXText";
23160   }
23161
23162   function isNumericLiteral(node) {
23163     return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
23164   }
23165
23166   function isStringLiteral(node) {
23167     return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
23168   }
23169
23170   function isObjectType(n) {
23171     return n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral";
23172   }
23173
23174   function isFunctionOrArrowExpression(node) {
23175     return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
23176   }
23177
23178   function isFunctionOrArrowExpressionWithBody(node) {
23179     return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
23180   }
23181
23182   function isTemplateLiteral(node) {
23183     return node.type === "TemplateLiteral";
23184   } // `inject` is used in AngularJS 1.x, `async` in Angular 2+
23185   // example: https://docs.angularjs.org/guide/unit-testing#using-beforeall-
23186
23187
23188   function isAngularTestWrapper(node) {
23189     return (node.type === "CallExpression" || node.type === "OptionalCallExpression") && node.callee.type === "Identifier" && (node.callee.name === "async" || node.callee.name === "inject" || node.callee.name === "fakeAsync");
23190   }
23191
23192   function isJSXNode(node) {
23193     return node.type === "JSXElement" || node.type === "JSXFragment";
23194   }
23195
23196   function isTheOnlyJSXElementInMarkdown(options, path) {
23197     if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
23198       return false;
23199     }
23200
23201     var node = path.getNode();
23202
23203     if (!node.expression || !isJSXNode(node.expression)) {
23204       return false;
23205     }
23206
23207     var parent = path.getParentNode();
23208     return parent.type === "Program" && parent.body.length == 1;
23209   } // Detect an expression node representing `{" "}`
23210
23211
23212   function isJSXWhitespaceExpression(node) {
23213     return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !node.expression.comments;
23214   }
23215
23216   function isMemberExpressionChain(node) {
23217     if (node.type !== "MemberExpression" && node.type !== "OptionalMemberExpression") {
23218       return false;
23219     }
23220
23221     if (node.object.type === "Identifier") {
23222       return true;
23223     }
23224
23225     return isMemberExpressionChain(node.object);
23226   }
23227
23228   function isGetterOrSetter(node) {
23229     return node.kind === "get" || node.kind === "set";
23230   }
23231
23232   function sameLocStart(nodeA, nodeB, options) {
23233     return options.locStart(nodeA) === options.locStart(nodeB);
23234   } // TODO: This is a bad hack and we need a better way to distinguish between
23235   // arrow functions and otherwise
23236
23237
23238   function isFunctionNotation(node, options) {
23239     return isGetterOrSetter(node) || sameLocStart(node, node.value, options);
23240   } // Hack to differentiate between the following two which have the same ast
23241   // type T = { method: () => void };
23242   // type T = { method(): void };
23243
23244
23245   function isObjectTypePropertyAFunction(node, options) {
23246     return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node, options);
23247   } // Hack to differentiate between the following two which have the same ast
23248   // declare function f(a): void;
23249   // var f: (a) => void;
23250
23251
23252   function isTypeAnnotationAFunction(node, options) {
23253     return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !sameLocStart(node, node.typeAnnotation, options);
23254   }
23255
23256   function isBinaryish(node) {
23257     return node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression";
23258   }
23259
23260   function isMemberish(node) {
23261     return node.type === "MemberExpression" || node.type === "OptionalMemberExpression" || node.type === "BindExpression" && node.object;
23262   }
23263
23264   function isSimpleFlowType(node) {
23265     var flowTypeAnnotations = ["AnyTypeAnnotation", "NullLiteralTypeAnnotation", "GenericTypeAnnotation", "ThisTypeAnnotation", "NumberTypeAnnotation", "VoidTypeAnnotation", "EmptyTypeAnnotation", "MixedTypeAnnotation", "BooleanTypeAnnotation", "BooleanLiteralTypeAnnotation", "StringTypeAnnotation"];
23266     return node && flowTypeAnnotations.indexOf(node.type) !== -1 && !(node.type === "GenericTypeAnnotation" && node.typeParameters);
23267   }
23268
23269   var unitTestRe = /^(skip|[fx]?(it|describe|test))$/;
23270
23271   function isSkipOrOnlyBlock(node) {
23272     return (node.callee.type === "MemberExpression" || node.callee.type === "OptionalMemberExpression") && 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");
23273   }
23274
23275   function isUnitTestSetUp(n) {
23276     var unitTestSetUpRe = /^(before|after)(Each|All)$/;
23277     return n.callee.type === "Identifier" && unitTestSetUpRe.test(n.callee.name) && n.arguments.length === 1;
23278   } // eg; `describe("some string", (done) => {})`
23279
23280
23281   function isTestCall(n, parent) {
23282     if (n.type !== "CallExpression") {
23283       return false;
23284     }
23285
23286     if (n.arguments.length === 1) {
23287       if (isAngularTestWrapper(n) && parent && isTestCall(parent)) {
23288         return isFunctionOrArrowExpression(n.arguments[0]);
23289       }
23290
23291       if (isUnitTestSetUp(n)) {
23292         return isAngularTestWrapper(n.arguments[0]);
23293       }
23294     } else if (n.arguments.length === 2 || n.arguments.length === 3) {
23295       if ((n.callee.type === "Identifier" && unitTestRe.test(n.callee.name) || isSkipOrOnlyBlock(n)) && (isTemplateLiteral(n.arguments[0]) || isStringLiteral(n.arguments[0]))) {
23296         // it("name", () => { ... }, 2500)
23297         if (n.arguments[2] && !isNumericLiteral(n.arguments[2])) {
23298           return false;
23299         }
23300
23301         return (n.arguments.length === 2 ? isFunctionOrArrowExpression(n.arguments[1]) : isFunctionOrArrowExpressionWithBody(n.arguments[1]) && n.arguments[1].params.length <= 1) || isAngularTestWrapper(n.arguments[1]);
23302       }
23303     }
23304
23305     return false;
23306   }
23307
23308   function hasLeadingComment$2(node) {
23309     return node.comments && node.comments.some(function (comment) {
23310       return comment.leading;
23311     });
23312   }
23313
23314   function hasTrailingComment(node) {
23315     return node.comments && node.comments.some(function (comment) {
23316       return comment.trailing;
23317     });
23318   }
23319
23320   function isCallOrOptionalCallExpression(node) {
23321     return node.type === "CallExpression" || node.type === "OptionalCallExpression";
23322   }
23323
23324   function hasDanglingComments(node) {
23325     return node.comments && node.comments.some(function (comment) {
23326       return !comment.leading && !comment.trailing;
23327     });
23328   }
23329   /** identify if an angular expression seems to have side effects */
23330
23331
23332   function hasNgSideEffect(path) {
23333     return hasNode(path.getValue(), function (node) {
23334       switch (node.type) {
23335         case undefined:
23336           return false;
23337
23338         case "CallExpression":
23339         case "OptionalCallExpression":
23340         case "AssignmentExpression":
23341           return true;
23342       }
23343     });
23344   }
23345
23346   function isNgForOf(node, index, parentNode) {
23347     return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
23348   }
23349   /** @param node {import("estree").TemplateLiteral} */
23350
23351
23352   function isSimpleTemplateLiteral(node) {
23353     if (node.expressions.length === 0) {
23354       return false;
23355     }
23356
23357     return node.expressions.every(function (expr) {
23358       // Disallow comments since printDocToString can't print them here
23359       if (expr.comments) {
23360         return false;
23361       } // Allow `x` and `this`
23362
23363
23364       if (expr.type === "Identifier" || expr.type === "ThisExpression") {
23365         return true;
23366       } // Allow `a.b.c`, `a.b[c]`, and `this.x.y`
23367
23368
23369       if (expr.type === "MemberExpression" || expr.type === "OptionalMemberExpression") {
23370         var head = expr;
23371
23372         while (head.type === "MemberExpression" || head.type === "OptionalMemberExpression") {
23373           if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
23374             return false;
23375           }
23376
23377           head = head.object;
23378
23379           if (head.comments) {
23380             return false;
23381           }
23382         }
23383
23384         if (head.type === "Identifier" || head.type === "ThisExpression") {
23385           return true;
23386         }
23387
23388         return false;
23389       }
23390
23391       return false;
23392     });
23393   }
23394
23395   function getFlowVariance(path) {
23396     if (!path.variance) {
23397       return null;
23398     } // Babel 7.0 currently uses variance node type, and flow should
23399     // follow suit soon:
23400     // https://github.com/babel/babel/issues/4722
23401
23402
23403     var variance = path.variance.kind || path.variance;
23404
23405     switch (variance) {
23406       case "plus":
23407         return "+";
23408
23409       case "minus":
23410         return "-";
23411
23412       default:
23413         /* istanbul ignore next */
23414         return variance;
23415     }
23416   }
23417
23418   function classPropMayCauseASIProblems(path) {
23419     var node = path.getNode();
23420
23421     if (node.type !== "ClassProperty") {
23422       return false;
23423     }
23424
23425     var name = node.key && node.key.name; // this isn't actually possible yet with most parsers available today
23426     // so isn't properly tested yet.
23427
23428     if ((name === "static" || name === "get" || name === "set") && !node.value && !node.typeAnnotation) {
23429       return true;
23430     }
23431   }
23432
23433   function classChildNeedsASIProtection(node) {
23434     if (!node) {
23435       return;
23436     }
23437
23438     if (node.static || node.accessibility // TypeScript
23439     ) {
23440         return false;
23441       }
23442
23443     if (!node.computed) {
23444       var name = node.key && node.key.name;
23445
23446       if (name === "in" || name === "instanceof") {
23447         return true;
23448       }
23449     }
23450
23451     switch (node.type) {
23452       case "ClassProperty":
23453       case "TSAbstractClassProperty":
23454         return node.computed;
23455
23456       case "MethodDefinition": // Flow
23457
23458       case "TSAbstractMethodDefinition": // TypeScript
23459
23460       case "ClassMethod":
23461       case "ClassPrivateMethod":
23462         {
23463           // Babel
23464           var isAsync = node.value ? node.value.async : node.async;
23465           var isGenerator = node.value ? node.value.generator : node.generator;
23466
23467           if (isAsync || node.kind === "get" || node.kind === "set") {
23468             return false;
23469           }
23470
23471           if (node.computed || isGenerator) {
23472             return true;
23473           }
23474
23475           return false;
23476         }
23477
23478       case "TSIndexSignature":
23479         return true;
23480
23481       default:
23482         /* istanbul ignore next */
23483         return false;
23484     }
23485   }
23486
23487   function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
23488     if (tokenNode === "+") {
23489       return "+" + keyword;
23490     } else if (tokenNode === "-") {
23491       return "-" + keyword;
23492     }
23493
23494     return keyword;
23495   }
23496
23497   function hasNewlineBetweenOrAfterDecorators(node, options) {
23498     return hasNewlineInRange$1(options.originalText, options.locStart(node.decorators[0]), options.locEnd(getLast$1(node.decorators))) || hasNewline$3(options.originalText, options.locEnd(getLast$1(node.decorators)));
23499   } // Only space, newline, carriage return, and tab are treated as whitespace
23500   // inside JSX.
23501
23502
23503   var jsxWhitespaceChars = " \n\r\t";
23504   var matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
23505   var containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]"); // Meaningful if it contains non-whitespace characters,
23506   // or it contains whitespace without a new line.
23507
23508   function isMeaningfulJSXText(node) {
23509     return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
23510   }
23511
23512   function hasJsxIgnoreComment(path) {
23513     var node = path.getValue();
23514     var parent = path.getParentNode();
23515
23516     if (!parent || !node || !isJSXNode(node) || !isJSXNode(parent)) {
23517       return false;
23518     } // Lookup the previous sibling, ignoring any empty JSXText elements
23519
23520
23521     var index = parent.children.indexOf(node);
23522     var prevSibling = null;
23523
23524     for (var i = index; i > 0; i--) {
23525       var candidate = parent.children[i - 1];
23526
23527       if (candidate.type === "JSXText" && !isMeaningfulJSXText(candidate)) {
23528         continue;
23529       }
23530
23531       prevSibling = candidate;
23532       break;
23533     }
23534
23535     return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && prevSibling.expression.comments && prevSibling.expression.comments.find(function (comment) {
23536       return comment.value.trim() === "prettier-ignore";
23537     });
23538   }
23539
23540   function isEmptyJSXElement(node) {
23541     if (node.children.length === 0) {
23542       return true;
23543     }
23544
23545     if (node.children.length > 1) {
23546       return false;
23547     } // if there is one text child and does not contain any meaningful text
23548     // we can treat the element as empty.
23549
23550
23551     var child = node.children[0];
23552     return isLiteral(child) && !isMeaningfulJSXText(child);
23553   }
23554
23555   function hasPrettierIgnore$2(path) {
23556     return hasIgnoreComment$3(path) || hasJsxIgnoreComment(path);
23557   }
23558
23559   function isLastStatement(path) {
23560     var parent = path.getParentNode();
23561
23562     if (!parent) {
23563       return true;
23564     }
23565
23566     var node = path.getValue();
23567     var body = (parent.body || parent.consequent).filter(function (stmt) {
23568       return stmt.type !== "EmptyStatement";
23569     });
23570     return body && body[body.length - 1] === node;
23571   }
23572
23573   function isFlowAnnotationComment(text, typeAnnotation, options) {
23574     var start = options.locStart(typeAnnotation);
23575     var end = skipWhitespace$1(text, options.locEnd(typeAnnotation));
23576     return text.substr(start, 2) === "/*" && text.substr(end, 2) === "*/";
23577   }
23578
23579   function hasLeadingOwnLineComment(text, node, options) {
23580     if (isJSXNode(node)) {
23581       return hasNodeIgnoreComment$1(node);
23582     }
23583
23584     var res = node.comments && node.comments.some(function (comment) {
23585       return comment.leading && hasNewline$3(text, options.locEnd(comment));
23586     });
23587     return res;
23588   } // This recurses the return argument, looking for the first token
23589   // (the leftmost leaf node) and, if it (or its parents) has any
23590   // leadingComments, returns true (so it can be wrapped in parens).
23591
23592
23593   function returnArgumentHasLeadingComment(options, argument) {
23594     if (hasLeadingOwnLineComment(options.originalText, argument, options)) {
23595       return true;
23596     }
23597
23598     if (hasNakedLeftSide(argument)) {
23599       var leftMost = argument;
23600       var newLeftMost;
23601
23602       while (newLeftMost = getLeftSide(leftMost)) {
23603         leftMost = newLeftMost;
23604
23605         if (hasLeadingOwnLineComment(options.originalText, leftMost, options)) {
23606           return true;
23607         }
23608       }
23609     }
23610
23611     return false;
23612   }
23613
23614   function isStringPropSafeToCoerceToIdentifier(node, options) {
23615     return isStringLiteral(node.key) && isIdentifierName(node.key.value) && options.parser !== "json" && !(options.parser === "typescript" && node.type === "ClassProperty");
23616   }
23617
23618   function isJestEachTemplateLiteral(node, parentNode) {
23619     /**
23620      * describe.each`table`(name, fn)
23621      * describe.only.each`table`(name, fn)
23622      * describe.skip.each`table`(name, fn)
23623      * test.each`table`(name, fn)
23624      * test.only.each`table`(name, fn)
23625      * test.skip.each`table`(name, fn)
23626      *
23627      * Ref: https://github.com/facebook/jest/pull/6102
23628      */
23629     var jestEachTriggerRegex = /^[xf]?(describe|it|test)$/;
23630     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));
23631   }
23632
23633   function templateLiteralHasNewLines(template) {
23634     return template.quasis.some(function (quasi) {
23635       return quasi.value.raw.includes("\n");
23636     });
23637   }
23638
23639   function isTemplateOnItsOwnLine(n, text, options) {
23640     return (n.type === "TemplateLiteral" && templateLiteralHasNewLines(n) || n.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(n.quasi)) && !hasNewline$3(text, options.locStart(n), {
23641       backwards: true
23642     });
23643   }
23644
23645   function needsHardlineAfterDanglingComment(node) {
23646     if (!node.comments) {
23647       return false;
23648     }
23649
23650     var lastDanglingComment = getLast$1(node.comments.filter(function (comment) {
23651       return !comment.leading && !comment.trailing;
23652     }));
23653     return lastDanglingComment && !comments$1.isBlockComment(lastDanglingComment);
23654   } // If we have nested conditional expressions, we want to print them in JSX mode
23655   // if there's at least one JSXElement somewhere in the tree.
23656   //
23657   // A conditional expression chain like this should be printed in normal mode,
23658   // because there aren't JSXElements anywhere in it:
23659   //
23660   // isA ? "A" : isB ? "B" : isC ? "C" : "Unknown";
23661   //
23662   // But a conditional expression chain like this should be printed in JSX mode,
23663   // because there is a JSXElement in the last ConditionalExpression:
23664   //
23665   // isA ? "A" : isB ? "B" : isC ? "C" : <span className="warning">Unknown</span>;
23666   //
23667   // This type of ConditionalExpression chain is structured like this in the AST:
23668   //
23669   // ConditionalExpression {
23670   //   test: ...,
23671   //   consequent: ...,
23672   //   alternate: ConditionalExpression {
23673   //     test: ...,
23674   //     consequent: ...,
23675   //     alternate: ConditionalExpression {
23676   //       test: ...,
23677   //       consequent: ...,
23678   //       alternate: ...,
23679   //     }
23680   //   }
23681   // }
23682   //
23683   // We want to traverse over that shape and convert it into a flat structure so
23684   // that we can find if there's a JSXElement somewhere inside.
23685
23686
23687   function getConditionalChainContents(node) {
23688     // Given this code:
23689     //
23690     // // Using a ConditionalExpression as the consequent is uncommon, but should
23691     // // be handled.
23692     // A ? B : C ? D : E ? F ? G : H : I
23693     //
23694     // which has this AST:
23695     //
23696     // ConditionalExpression {
23697     //   test: Identifier(A),
23698     //   consequent: Identifier(B),
23699     //   alternate: ConditionalExpression {
23700     //     test: Identifier(C),
23701     //     consequent: Identifier(D),
23702     //     alternate: ConditionalExpression {
23703     //       test: Identifier(E),
23704     //       consequent: ConditionalExpression {
23705     //         test: Identifier(F),
23706     //         consequent: Identifier(G),
23707     //         alternate: Identifier(H),
23708     //       },
23709     //       alternate: Identifier(I),
23710     //     }
23711     //   }
23712     // }
23713     //
23714     // we should return this Array:
23715     //
23716     // [
23717     //   Identifier(A),
23718     //   Identifier(B),
23719     //   Identifier(C),
23720     //   Identifier(D),
23721     //   Identifier(E),
23722     //   Identifier(F),
23723     //   Identifier(G),
23724     //   Identifier(H),
23725     //   Identifier(I)
23726     // ];
23727     //
23728     // This loses the information about whether each node was the test,
23729     // consequent, or alternate, but we don't care about that here- we are only
23730     // flattening this structure to find if there's any JSXElements inside.
23731     var nonConditionalExpressions = [];
23732
23733     function recurse(node) {
23734       if (node.type === "ConditionalExpression") {
23735         recurse(node.test);
23736         recurse(node.consequent);
23737         recurse(node.alternate);
23738       } else {
23739         nonConditionalExpressions.push(node);
23740       }
23741     }
23742
23743     recurse(node);
23744     return nonConditionalExpressions;
23745   }
23746
23747   function conditionalExpressionChainContainsJSX(node) {
23748     return Boolean(getConditionalChainContents(node).find(isJSXNode));
23749   } // Logic to check for args with multiple anonymous functions. For instance,
23750   // the following call should be split on multiple lines for readability:
23751   // source.pipe(map((x) => x + x), filter((x) => x % 2 === 0))
23752
23753
23754   function isFunctionCompositionArgs(args) {
23755     if (args.length <= 1) {
23756       return false;
23757     }
23758
23759     var count = 0;
23760     var _iteratorNormalCompletion = true;
23761     var _didIteratorError = false;
23762     var _iteratorError = undefined;
23763
23764     try {
23765       for (var _iterator = args[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
23766         var arg = _step.value;
23767
23768         if (isFunctionOrArrowExpression(arg)) {
23769           count += 1;
23770
23771           if (count > 1) {
23772             return true;
23773           }
23774         } else if (isCallOrOptionalCallExpression(arg)) {
23775           var _iteratorNormalCompletion2 = true;
23776           var _didIteratorError2 = false;
23777           var _iteratorError2 = undefined;
23778
23779           try {
23780             for (var _iterator2 = arg.arguments[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
23781               var childArg = _step2.value;
23782
23783               if (isFunctionOrArrowExpression(childArg)) {
23784                 return true;
23785               }
23786             }
23787           } catch (err) {
23788             _didIteratorError2 = true;
23789             _iteratorError2 = err;
23790           } finally {
23791             try {
23792               if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
23793                 _iterator2.return();
23794               }
23795             } finally {
23796               if (_didIteratorError2) {
23797                 throw _iteratorError2;
23798               }
23799             }
23800           }
23801         }
23802       }
23803     } catch (err) {
23804       _didIteratorError = true;
23805       _iteratorError = err;
23806     } finally {
23807       try {
23808         if (!_iteratorNormalCompletion && _iterator.return != null) {
23809           _iterator.return();
23810         }
23811       } finally {
23812         if (_didIteratorError) {
23813           throw _iteratorError;
23814         }
23815       }
23816     }
23817
23818     return false;
23819   } // Logic to determine if a call is a “long curried function call”.
23820   // See https://github.com/prettier/prettier/issues/1420.
23821   //
23822   // `connect(a, b, c)(d)`
23823   // In the above call expression, the second call is the parent node and the
23824   // first call is the current node.
23825
23826
23827   function isLongCurriedCallExpression(path) {
23828     var node = path.getValue();
23829     var parent = path.getParentNode();
23830     return isCallOrOptionalCallExpression(node) && isCallOrOptionalCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
23831   }
23832
23833   function rawText(node) {
23834     return node.extra ? node.extra.raw : node.raw;
23835   }
23836
23837   function identity$1(x) {
23838     return x;
23839   }
23840
23841   function isTSXFile(options) {
23842     return options.filepath && /\.tsx$/i.test(options.filepath);
23843   }
23844
23845   var utils$4 = {
23846     classChildNeedsASIProtection: classChildNeedsASIProtection,
23847     classPropMayCauseASIProblems: classPropMayCauseASIProblems,
23848     conditionalExpressionChainContainsJSX: conditionalExpressionChainContainsJSX,
23849     getFlowVariance: getFlowVariance,
23850     getLeftSidePathName: getLeftSidePathName,
23851     getTypeScriptMappedTypeModifier: getTypeScriptMappedTypeModifier,
23852     hasDanglingComments: hasDanglingComments,
23853     hasFlowAnnotationComment: hasFlowAnnotationComment,
23854     hasFlowShorthandAnnotationComment: hasFlowShorthandAnnotationComment,
23855     hasLeadingComment: hasLeadingComment$2,
23856     hasLeadingOwnLineComment: hasLeadingOwnLineComment,
23857     hasNakedLeftSide: hasNakedLeftSide,
23858     hasNewlineBetweenOrAfterDecorators: hasNewlineBetweenOrAfterDecorators,
23859     hasNgSideEffect: hasNgSideEffect,
23860     hasNode: hasNode,
23861     hasPrettierIgnore: hasPrettierIgnore$2,
23862     hasTrailingComment: hasTrailingComment,
23863     identity: identity$1,
23864     isBinaryish: isBinaryish,
23865     isCallOrOptionalCallExpression: isCallOrOptionalCallExpression,
23866     isEmptyJSXElement: isEmptyJSXElement,
23867     isFlowAnnotationComment: isFlowAnnotationComment,
23868     isFunctionCompositionArgs: isFunctionCompositionArgs,
23869     isFunctionNotation: isFunctionNotation,
23870     isFunctionOrArrowExpression: isFunctionOrArrowExpression,
23871     isGetterOrSetter: isGetterOrSetter,
23872     isJestEachTemplateLiteral: isJestEachTemplateLiteral,
23873     isJSXNode: isJSXNode,
23874     isJSXWhitespaceExpression: isJSXWhitespaceExpression,
23875     isLastStatement: isLastStatement,
23876     isLiteral: isLiteral,
23877     isLongCurriedCallExpression: isLongCurriedCallExpression,
23878     isMeaningfulJSXText: isMeaningfulJSXText,
23879     isMemberExpressionChain: isMemberExpressionChain,
23880     isMemberish: isMemberish,
23881     isNgForOf: isNgForOf,
23882     isNumericLiteral: isNumericLiteral,
23883     isObjectType: isObjectType,
23884     isObjectTypePropertyAFunction: isObjectTypePropertyAFunction,
23885     isSimpleFlowType: isSimpleFlowType,
23886     isSimpleTemplateLiteral: isSimpleTemplateLiteral,
23887     isStringLiteral: isStringLiteral,
23888     isStringPropSafeToCoerceToIdentifier: isStringPropSafeToCoerceToIdentifier,
23889     isTemplateOnItsOwnLine: isTemplateOnItsOwnLine,
23890     isTestCall: isTestCall,
23891     isTheOnlyJSXElementInMarkdown: isTheOnlyJSXElementInMarkdown,
23892     isTSXFile: isTSXFile,
23893     isTypeAnnotationAFunction: isTypeAnnotationAFunction,
23894     matchJsxWhitespaceRegex: matchJsxWhitespaceRegex,
23895     needsHardlineAfterDanglingComment: needsHardlineAfterDanglingComment,
23896     rawText: rawText,
23897     returnArgumentHasLeadingComment: returnArgumentHasLeadingComment
23898   };
23899
23900   var getLeftSidePathName$1 = utils$4.getLeftSidePathName,
23901       hasFlowShorthandAnnotationComment$1 = utils$4.hasFlowShorthandAnnotationComment,
23902       hasNakedLeftSide$1 = utils$4.hasNakedLeftSide,
23903       hasNode$1 = utils$4.hasNode;
23904
23905   function hasClosureCompilerTypeCastComment(text, path) {
23906     // https://github.com/google/closure-compiler/wiki/Annotating-Types#type-casts
23907     // Syntax example: var x = /** @type {string} */ (fruit);
23908     var n = path.getValue();
23909     return isParenthesized(n) && (hasTypeCastComment(n) || hasAncestorTypeCastComment(0)); // for sub-item: /** @type {array} */ (numberOrString).map(x => x);
23910
23911     function hasAncestorTypeCastComment(index) {
23912       var ancestor = path.getParentNode(index);
23913       return ancestor && !isParenthesized(ancestor) ? hasTypeCastComment(ancestor) || hasAncestorTypeCastComment(index + 1) : false;
23914     }
23915
23916     function hasTypeCastComment(node) {
23917       return node.comments && node.comments.some(function (comment) {
23918         return comment.leading && comments$1.isBlockComment(comment) && isTypeCastComment(comment.value);
23919       });
23920     }
23921
23922     function isParenthesized(node) {
23923       // Closure typecast comments only really make sense when _not_ using
23924       // typescript or flow parsers, so we take advantage of the babel parser's
23925       // parenthesized expressions.
23926       return node.extra && node.extra.parenthesized;
23927     }
23928
23929     function isTypeCastComment(comment) {
23930       var cleaned = comment.trim().split("\n").map(function (line) {
23931         return line.replace(/^[\s*]+/, "");
23932       }).join(" ").trim();
23933
23934       if (!/^@type\s*\{[^]+\}$/.test(cleaned)) {
23935         return false;
23936       }
23937
23938       var isCompletelyClosed = false;
23939       var unpairedBracketCount = 0;
23940       var _iteratorNormalCompletion = true;
23941       var _didIteratorError = false;
23942       var _iteratorError = undefined;
23943
23944       try {
23945         for (var _iterator = cleaned[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
23946           var char = _step.value;
23947
23948           if (char === "{") {
23949             if (isCompletelyClosed) {
23950               return false;
23951             }
23952
23953             unpairedBracketCount++;
23954           } else if (char === "}") {
23955             if (unpairedBracketCount === 0) {
23956               return false;
23957             }
23958
23959             unpairedBracketCount--;
23960
23961             if (unpairedBracketCount === 0) {
23962               isCompletelyClosed = true;
23963             }
23964           }
23965         }
23966       } catch (err) {
23967         _didIteratorError = true;
23968         _iteratorError = err;
23969       } finally {
23970         try {
23971           if (!_iteratorNormalCompletion && _iterator.return != null) {
23972             _iterator.return();
23973           }
23974         } finally {
23975           if (_didIteratorError) {
23976             throw _iteratorError;
23977           }
23978         }
23979       }
23980
23981       return unpairedBracketCount === 0;
23982     }
23983   }
23984
23985   function needsParens(path, options) {
23986     var parent = path.getParentNode();
23987
23988     if (!parent) {
23989       return false;
23990     }
23991
23992     var name = path.getName();
23993     var node = path.getNode(); // If the value of this path is some child of a Node and not a Node
23994     // itself, then it doesn't need parentheses. Only Node objects (in
23995     // fact, only Expression nodes) need parentheses.
23996
23997     if (path.getValue() !== node) {
23998       return false;
23999     } // to avoid unexpected `}}` in HTML interpolations
24000
24001
24002     if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
24003       return true;
24004     } // Only statements don't need parentheses.
24005
24006
24007     if (isStatement(node)) {
24008       return false;
24009     } // Closure compiler requires that type casted expressions to be surrounded by
24010     // parentheses.
24011
24012
24013     if (hasClosureCompilerTypeCastComment(options.originalText, path)) {
24014       return true;
24015     }
24016
24017     if ( // Preserve parens if we have a Flow annotation comment, unless we're using the Flow
24018     // parser. The Flow parser turns Flow comments into type annotation nodes in its
24019     // AST, which we handle separately.
24020     options.parser !== "flow" && hasFlowShorthandAnnotationComment$1(path.getValue())) {
24021       return true;
24022     } // Identifiers never need parentheses.
24023
24024
24025     if (node.type === "Identifier") {
24026       // ...unless those identifiers are embed placeholders. They might be substituted by complex
24027       // expressions, so the parens around them should not be dropped. Example (JS-in-HTML-in-JS):
24028       //     let tpl = html`<script> f((${expr}) / 2); </script>`;
24029       // If the inner JS formatter removes the parens, the expression might change its meaning:
24030       //     f((a + b) / 2)  vs  f(a + b / 2)
24031       if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
24032         return true;
24033       }
24034
24035       return false;
24036     }
24037
24038     if (parent.type === "ParenthesizedExpression") {
24039       return false;
24040     } // Add parens around the extends clause of a class. It is needed for almost
24041     // all expressions.
24042
24043
24044     if ((parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node && (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")) {
24045       return true;
24046     } // `export default function` or `export default class` can't be followed by
24047     // anything after. So an expression like `export default (function(){}).toString()`
24048     // needs to be followed by a parentheses
24049
24050
24051     if (parent.type === "ExportDefaultDeclaration") {
24052       return shouldWrapFunctionForExportDefault(path, options);
24053     }
24054
24055     if (parent.type === "Decorator" && parent.expression === node) {
24056       var hasCallExpression = false;
24057       var hasMemberExpression = false;
24058       var current = node;
24059
24060       while (current) {
24061         switch (current.type) {
24062           case "MemberExpression":
24063             hasMemberExpression = true;
24064             current = current.object;
24065             break;
24066
24067           case "CallExpression":
24068             if (
24069             /** @(x().y) */
24070             hasMemberExpression ||
24071             /** @(x().y()) */
24072             hasCallExpression) {
24073               return true;
24074             }
24075
24076             hasCallExpression = true;
24077             current = current.callee;
24078             break;
24079
24080           case "Identifier":
24081             return false;
24082
24083           default:
24084             return true;
24085         }
24086       }
24087
24088       return true;
24089     }
24090
24091     if (parent.type === "ArrowFunctionExpression" && parent.body === node && node.type !== "SequenceExpression" && // these have parens added anyway
24092     util.startsWithNoLookaheadToken(node,
24093     /* forbidFunctionClassAndDoExpr */
24094     false) || parent.type === "ExpressionStatement" && util.startsWithNoLookaheadToken(node,
24095     /* forbidFunctionClassAndDoExpr */
24096     true)) {
24097       return true;
24098     }
24099
24100     switch (node.type) {
24101       case "SpreadElement":
24102       case "SpreadProperty":
24103         return parent.type === "MemberExpression" && name === "object" && parent.object === node;
24104
24105       case "UpdateExpression":
24106         if (parent.type === "UnaryExpression") {
24107           return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
24108         }
24109
24110       // else fallthrough
24111
24112       case "UnaryExpression":
24113         switch (parent.type) {
24114           case "UnaryExpression":
24115             return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
24116
24117           case "BindExpression":
24118             return true;
24119
24120           case "MemberExpression":
24121           case "OptionalMemberExpression":
24122             return name === "object";
24123
24124           case "TaggedTemplateExpression":
24125             return true;
24126
24127           case "NewExpression":
24128           case "CallExpression":
24129           case "OptionalCallExpression":
24130             return name === "callee";
24131
24132           case "BinaryExpression":
24133             return parent.operator === "**" && name === "left";
24134
24135           case "TSNonNullExpression":
24136             return true;
24137
24138           default:
24139             return false;
24140         }
24141
24142       case "BinaryExpression":
24143         {
24144           if (parent.type === "UpdateExpression") {
24145             return true;
24146           }
24147
24148           var isLeftOfAForStatement = function isLeftOfAForStatement(node) {
24149             var i = 0;
24150
24151             while (node) {
24152               var _parent = path.getParentNode(i++);
24153
24154               if (!_parent) {
24155                 return false;
24156               }
24157
24158               if (_parent.type === "ForStatement" && _parent.init === node) {
24159                 return true;
24160               }
24161
24162               node = _parent;
24163             }
24164
24165             return false;
24166           };
24167
24168           if (node.operator === "in" && isLeftOfAForStatement(node)) {
24169             return true;
24170           }
24171         }
24172       // fallthrough
24173
24174       case "TSTypeAssertion":
24175       case "TSAsExpression":
24176       case "LogicalExpression":
24177         switch (parent.type) {
24178           case "ConditionalExpression":
24179             return node.type === "TSAsExpression";
24180
24181           case "CallExpression":
24182           case "NewExpression":
24183           case "OptionalCallExpression":
24184             return name === "callee";
24185
24186           case "ClassExpression":
24187           case "ClassDeclaration":
24188             return name === "superClass" && parent.superClass === node;
24189
24190           case "TSTypeAssertion":
24191           case "TaggedTemplateExpression":
24192           case "UnaryExpression":
24193           case "JSXSpreadAttribute":
24194           case "SpreadElement":
24195           case "SpreadProperty":
24196           case "BindExpression":
24197           case "AwaitExpression":
24198           case "TSAsExpression":
24199           case "TSNonNullExpression":
24200           case "UpdateExpression":
24201             return true;
24202
24203           case "MemberExpression":
24204           case "OptionalMemberExpression":
24205             return name === "object";
24206
24207           case "AssignmentExpression":
24208             return parent.left === node && (node.type === "TSTypeAssertion" || node.type === "TSAsExpression");
24209
24210           case "LogicalExpression":
24211             if (node.type === "LogicalExpression") {
24212               return parent.operator !== node.operator;
24213             }
24214
24215           // else fallthrough
24216
24217           case "BinaryExpression":
24218             {
24219               if (!node.operator && node.type !== "TSTypeAssertion") {
24220                 return true;
24221               }
24222
24223               var po = parent.operator;
24224               var pp = util.getPrecedence(po);
24225               var no = node.operator;
24226               var np = util.getPrecedence(no);
24227
24228               if (pp > np) {
24229                 return true;
24230               }
24231
24232               if (pp === np && name === "right") {
24233                 assert.strictEqual(parent.right, node);
24234                 return true;
24235               }
24236
24237               if (pp === np && !util.shouldFlatten(po, no)) {
24238                 return true;
24239               }
24240
24241               if (pp < np && no === "%") {
24242                 return po === "+" || po === "-";
24243               } // Add parenthesis when working with bitwise operators
24244               // It's not strictly needed but helps with code understanding
24245
24246
24247               if (util.isBitwiseOperator(po)) {
24248                 return true;
24249               }
24250
24251               return false;
24252             }
24253
24254           default:
24255             return false;
24256         }
24257
24258       case "SequenceExpression":
24259         switch (parent.type) {
24260           case "ReturnStatement":
24261             return false;
24262
24263           case "ForStatement":
24264             // Although parentheses wouldn't hurt around sequence
24265             // expressions in the head of for loops, traditional style
24266             // dictates that e.g. i++, j++ should not be wrapped with
24267             // parentheses.
24268             return false;
24269
24270           case "ExpressionStatement":
24271             return name !== "expression";
24272
24273           case "ArrowFunctionExpression":
24274             // We do need parentheses, but SequenceExpressions are handled
24275             // specially when printing bodies of arrow functions.
24276             return name !== "body";
24277
24278           default:
24279             // Otherwise err on the side of overparenthesization, adding
24280             // explicit exceptions above if this proves overzealous.
24281             return true;
24282         }
24283
24284       case "YieldExpression":
24285         if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || parent.type === "TSAsExpression" || parent.type === "TSNonNullExpression") {
24286           return true;
24287         }
24288
24289       // else fallthrough
24290
24291       case "AwaitExpression":
24292         switch (parent.type) {
24293           case "TaggedTemplateExpression":
24294           case "UnaryExpression":
24295           case "BinaryExpression":
24296           case "LogicalExpression":
24297           case "SpreadElement":
24298           case "SpreadProperty":
24299           case "TSAsExpression":
24300           case "TSNonNullExpression":
24301           case "BindExpression":
24302             return true;
24303
24304           case "MemberExpression":
24305           case "OptionalMemberExpression":
24306             return name === "object";
24307
24308           case "NewExpression":
24309           case "CallExpression":
24310           case "OptionalCallExpression":
24311             return name === "callee";
24312
24313           case "ConditionalExpression":
24314             return parent.test === node;
24315
24316           default:
24317             return false;
24318         }
24319
24320       case "TSConditionalType":
24321         if (parent.type === "TSConditionalType" && node === parent.extendsType) {
24322           return true;
24323         }
24324
24325       // fallthrough
24326
24327       case "TSFunctionType":
24328       case "TSConstructorType":
24329         if (parent.type === "TSConditionalType" && node === parent.checkType) {
24330           return true;
24331         }
24332
24333       // fallthrough
24334
24335       case "TSUnionType":
24336       case "TSIntersectionType":
24337         if (parent.type === "TSUnionType" || parent.type === "TSIntersectionType") {
24338           return true;
24339         }
24340
24341       // fallthrough
24342
24343       case "TSTypeOperator":
24344       case "TSInferType":
24345         return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || parent.type === "TSIndexedAccessType" && node === parent.objectType || parent.type === "TSTypeOperator";
24346
24347       case "ArrayTypeAnnotation":
24348         return parent.type === "NullableTypeAnnotation";
24349
24350       case "IntersectionTypeAnnotation":
24351       case "UnionTypeAnnotation":
24352         return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation";
24353
24354       case "NullableTypeAnnotation":
24355         return parent.type === "ArrayTypeAnnotation";
24356
24357       case "FunctionTypeAnnotation":
24358         {
24359           var ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
24360           return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || // We should check ancestor's parent to know whether the parentheses
24361           // are really needed, but since ??T doesn't make sense this check
24362           // will almost never be true.
24363           ancestor.type === "NullableTypeAnnotation";
24364         }
24365
24366       case "StringLiteral":
24367       case "NumericLiteral":
24368       case "Literal":
24369         if (typeof node.value === "string" && parent.type === "ExpressionStatement" && ( // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2
24370         // See corresponding workaround in printer.js case: "Literal"
24371         options.parser !== "typescript" && !parent.directive || options.parser === "typescript" && options.originalText.substr(options.locStart(node) - 1, 1) === "(")) {
24372           // To avoid becoming a directive
24373           var grandParent = path.getParentNode(1);
24374           return grandParent.type === "Program" || grandParent.type === "BlockStatement";
24375         }
24376
24377         return parent.type === "MemberExpression" && typeof node.value === "number" && name === "object" && parent.object === node;
24378
24379       case "AssignmentExpression":
24380         {
24381           var _grandParent = path.getParentNode(1);
24382
24383           if (parent.type === "ArrowFunctionExpression" && parent.body === node) {
24384             return true;
24385           } else if (parent.type === "ClassProperty" && parent.key === node && parent.computed) {
24386             return false;
24387           } else if (parent.type === "TSPropertySignature" && parent.name === node) {
24388             return false;
24389           } else if (parent.type === "ForStatement" && (parent.init === node || parent.update === node)) {
24390             return false;
24391           } else if (parent.type === "ExpressionStatement") {
24392             return node.left.type === "ObjectPattern";
24393           } else if (parent.type === "TSPropertySignature" && parent.key === node) {
24394             return false;
24395           } else if (parent.type === "AssignmentExpression") {
24396             return false;
24397           } else if (parent.type === "SequenceExpression" && _grandParent && _grandParent.type === "ForStatement" && (_grandParent.init === parent || _grandParent.update === parent)) {
24398             return false;
24399           } else if (parent.type === "Property" && parent.value === node) {
24400             return false;
24401           } else if (parent.type === "NGChainedExpression") {
24402             return false;
24403           }
24404
24405           return true;
24406         }
24407
24408       case "ConditionalExpression":
24409         switch (parent.type) {
24410           case "TaggedTemplateExpression":
24411           case "UnaryExpression":
24412           case "SpreadElement":
24413           case "SpreadProperty":
24414           case "BinaryExpression":
24415           case "LogicalExpression":
24416           case "NGPipeExpression":
24417           case "ExportDefaultDeclaration":
24418           case "AwaitExpression":
24419           case "JSXSpreadAttribute":
24420           case "TSTypeAssertion":
24421           case "TypeCastExpression":
24422           case "TSAsExpression":
24423           case "TSNonNullExpression":
24424             return true;
24425
24426           case "NewExpression":
24427           case "CallExpression":
24428           case "OptionalCallExpression":
24429             return name === "callee";
24430
24431           case "ConditionalExpression":
24432             return name === "test" && parent.test === node;
24433
24434           case "MemberExpression":
24435           case "OptionalMemberExpression":
24436             return name === "object";
24437
24438           default:
24439             return false;
24440         }
24441
24442       case "FunctionExpression":
24443         switch (parent.type) {
24444           case "NewExpression":
24445           case "CallExpression":
24446           case "OptionalCallExpression":
24447             // Not always necessary, but it's clearer to the reader if IIFEs are wrapped in parentheses.
24448             // Is necessary if it is `expression` of `ExpressionStatement`.
24449             return name === "callee";
24450
24451           case "TaggedTemplateExpression":
24452             return true;
24453           // This is basically a kind of IIFE.
24454
24455           default:
24456             return false;
24457         }
24458
24459       case "ArrowFunctionExpression":
24460         switch (parent.type) {
24461           case "NewExpression":
24462           case "CallExpression":
24463           case "OptionalCallExpression":
24464             return name === "callee";
24465
24466           case "MemberExpression":
24467           case "OptionalMemberExpression":
24468             return name === "object";
24469
24470           case "TSAsExpression":
24471           case "BindExpression":
24472           case "TaggedTemplateExpression":
24473           case "UnaryExpression":
24474           case "LogicalExpression":
24475           case "BinaryExpression":
24476           case "AwaitExpression":
24477           case "TSTypeAssertion":
24478             return true;
24479
24480           case "ConditionalExpression":
24481             return name === "test";
24482
24483           default:
24484             return false;
24485         }
24486
24487       case "ClassExpression":
24488         switch (parent.type) {
24489           case "NewExpression":
24490             return name === "callee" && parent.callee === node;
24491
24492           default:
24493             return false;
24494         }
24495
24496       case "OptionalMemberExpression":
24497       case "OptionalCallExpression":
24498         if ((parent.type === "MemberExpression" && name === "object" || parent.type === "CallExpression" && name === "callee") && // workaround for https://github.com/facebook/flow/issues/8159
24499         !(options.parser === "flow" && parent.range[0] === node.range[0])) {
24500           return true;
24501         }
24502
24503       // fallthrough
24504
24505       case "CallExpression":
24506       case "MemberExpression":
24507       case "TaggedTemplateExpression":
24508       case "TSNonNullExpression":
24509         if ((parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee") {
24510           var object = node;
24511
24512           while (object) {
24513             switch (object.type) {
24514               case "CallExpression":
24515               case "OptionalCallExpression":
24516                 return true;
24517
24518               case "MemberExpression":
24519               case "OptionalMemberExpression":
24520               case "BindExpression":
24521                 object = object.object;
24522                 break;
24523               // tagged templates are basically member expressions from a grammar perspective
24524               // see https://tc39.github.io/ecma262/#prod-MemberExpression
24525
24526               case "TaggedTemplateExpression":
24527                 object = object.tag;
24528                 break;
24529
24530               case "TSNonNullExpression":
24531                 object = object.expression;
24532                 break;
24533
24534               default:
24535                 return false;
24536             }
24537           }
24538         }
24539
24540         return false;
24541
24542       case "BindExpression":
24543         return (parent.type === "BindExpression" || parent.type === "NewExpression") && name === "callee" || (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression") && name === "object";
24544
24545       case "NGPipeExpression":
24546         if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" || parent.type === "ArrayExpression" || (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && parent.arguments[name] === node || parent.type === "NGPipeExpression" && name === "right" || parent.type === "MemberExpression" && name === "property" || parent.type === "AssignmentExpression") {
24547           return false;
24548         }
24549
24550         return true;
24551
24552       case "JSXFragment":
24553       case "JSXElement":
24554         return name === "callee" || parent.type !== "ArrayExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "AssignmentExpression" && parent.type !== "AssignmentPattern" && parent.type !== "BinaryExpression" && parent.type !== "CallExpression" && parent.type !== "ConditionalExpression" && parent.type !== "ExpressionStatement" && parent.type !== "JsExpressionRoot" && parent.type !== "JSXAttribute" && parent.type !== "JSXElement" && parent.type !== "JSXExpressionContainer" && parent.type !== "JSXFragment" && parent.type !== "LogicalExpression" && parent.type !== "ObjectProperty" && parent.type !== "OptionalCallExpression" && parent.type !== "Property" && parent.type !== "ReturnStatement" && parent.type !== "TypeCastExpression" && parent.type !== "VariableDeclarator";
24555
24556       case "TypeAnnotation":
24557         return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
24558     }
24559
24560     return false;
24561   }
24562
24563   function isStatement(node) {
24564     return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || 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 === "ForAwaitStatement" || 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";
24565   }
24566
24567   function includesFunctionTypeInObjectType(node) {
24568     return hasNode$1(node, function (n1) {
24569       return n1.type === "ObjectTypeAnnotation" && hasNode$1(n1, function (n2) {
24570         return n2.type === "FunctionTypeAnnotation" || undefined;
24571       }) || undefined;
24572     });
24573   }
24574
24575   function endsWithRightBracket(node) {
24576     switch (node.type) {
24577       case "ObjectExpression":
24578         return true;
24579
24580       default:
24581         return false;
24582     }
24583   }
24584
24585   function isFollowedByRightBracket(path) {
24586     var node = path.getValue();
24587     var parent = path.getParentNode();
24588     var name = path.getName();
24589
24590     switch (parent.type) {
24591       case "NGPipeExpression":
24592         if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
24593           return path.callParent(isFollowedByRightBracket);
24594         }
24595
24596         break;
24597
24598       case "ObjectProperty":
24599         if (name === "value") {
24600           var parentParent = path.getParentNode(1);
24601           return parentParent.properties[parentParent.properties.length - 1] === parent;
24602         }
24603
24604         break;
24605
24606       case "BinaryExpression":
24607       case "LogicalExpression":
24608         if (name === "right") {
24609           return path.callParent(isFollowedByRightBracket);
24610         }
24611
24612         break;
24613
24614       case "ConditionalExpression":
24615         if (name === "alternate") {
24616           return path.callParent(isFollowedByRightBracket);
24617         }
24618
24619         break;
24620
24621       case "UnaryExpression":
24622         if (parent.prefix) {
24623           return path.callParent(isFollowedByRightBracket);
24624         }
24625
24626         break;
24627     }
24628
24629     return false;
24630   }
24631
24632   function shouldWrapFunctionForExportDefault(path, options) {
24633     var node = path.getValue();
24634     var parent = path.getParentNode();
24635
24636     if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
24637       return parent.type === "ExportDefaultDeclaration" || // in some cases the function is already wrapped
24638       // (e.g. `export default (function() {})();`)
24639       // in this case we don't need to add extra parens
24640       !needsParens(path, options);
24641     }
24642
24643     if (!hasNakedLeftSide$1(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
24644       return false;
24645     }
24646
24647     return path.call.apply(path, [function (childPath) {
24648       return shouldWrapFunctionForExportDefault(childPath, options);
24649     }].concat(getLeftSidePathName$1(path, node)));
24650   }
24651
24652   var needsParens_1 = needsParens;
24653
24654   var _require$$0$builders$6 = doc.builders,
24655       concat$c = _require$$0$builders$6.concat,
24656       join$8 = _require$$0$builders$6.join,
24657       line$6 = _require$$0$builders$6.line;
24658
24659   function printHtmlBinding(path, options, print) {
24660     var node = path.getValue();
24661
24662     if (options.__onHtmlBindingRoot && path.getName() === null) {
24663       options.__onHtmlBindingRoot(node);
24664     }
24665
24666     if (node.type !== "File") {
24667       return;
24668     }
24669
24670     if (options.__isVueForBindingLeft) {
24671       return path.call(function (functionDeclarationPath) {
24672         var _functionDeclarationP = functionDeclarationPath.getValue(),
24673             params = _functionDeclarationP.params;
24674
24675         return concat$c([params.length > 1 ? "(" : "", join$8(concat$c([",", line$6]), functionDeclarationPath.map(print, "params")), params.length > 1 ? ")" : ""]);
24676       }, "program", "body", 0);
24677     }
24678
24679     if (options.__isVueSlotScope) {
24680       return path.call(function (functionDeclarationPath) {
24681         return join$8(concat$c([",", line$6]), functionDeclarationPath.map(print, "params"));
24682       }, "program", "body", 0);
24683     }
24684   } // based on https://github.com/prettier/prettier/blob/master/src/language-html/syntax-vue.js isVueEventBindingExpression()
24685
24686
24687   function isVueEventBindingExpression$2(node) {
24688     switch (node.type) {
24689       case "MemberExpression":
24690         switch (node.property.type) {
24691           case "Identifier":
24692           case "NumericLiteral":
24693           case "StringLiteral":
24694             return isVueEventBindingExpression$2(node.object);
24695         }
24696
24697         return false;
24698
24699       case "Identifier":
24700         return true;
24701
24702       default:
24703         return false;
24704     }
24705   }
24706
24707   var htmlBinding = {
24708     isVueEventBindingExpression: isVueEventBindingExpression$2,
24709     printHtmlBinding: printHtmlBinding
24710   };
24711
24712   function preprocess$1(ast, options) {
24713     switch (options.parser) {
24714       case "json":
24715       case "json5":
24716       case "json-stringify":
24717       case "__js_expression":
24718       case "__vue_expression":
24719         return Object.assign({}, ast, {
24720           type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
24721           node: ast,
24722           comments: []
24723         });
24724
24725       default:
24726         return ast;
24727     }
24728   }
24729
24730   var preprocess_1$1 = preprocess$1;
24731
24732   var getParentExportDeclaration$1 = util.getParentExportDeclaration,
24733       isExportDeclaration$1 = util.isExportDeclaration,
24734       shouldFlatten$1 = util.shouldFlatten,
24735       getNextNonSpaceNonCommentCharacter$1 = util.getNextNonSpaceNonCommentCharacter,
24736       hasNewline$4 = util.hasNewline,
24737       hasNewlineInRange$2 = util.hasNewlineInRange,
24738       getLast$2 = util.getLast,
24739       getStringWidth$2 = util.getStringWidth,
24740       printString$2 = util.printString,
24741       printNumber$2 = util.printNumber,
24742       hasIgnoreComment$4 = util.hasIgnoreComment,
24743       hasNodeIgnoreComment$2 = util.hasNodeIgnoreComment,
24744       getPenultimate$1 = util.getPenultimate,
24745       startsWithNoLookaheadToken$1 = util.startsWithNoLookaheadToken,
24746       getIndentSize$1 = util.getIndentSize,
24747       matchAncestorTypes$1 = util.matchAncestorTypes,
24748       getPreferredQuote$1 = util.getPreferredQuote;
24749   var isNextLineEmpty$4 = utilShared.isNextLineEmpty,
24750       isNextLineEmptyAfterIndex$1 = utilShared.isNextLineEmptyAfterIndex,
24751       getNextNonSpaceNonCommentCharacterIndex$2 = utilShared.getNextNonSpaceNonCommentCharacterIndex;
24752   var insertPragma$7 = pragma.insertPragma;
24753   var printHtmlBinding$1 = htmlBinding.printHtmlBinding,
24754       isVueEventBindingExpression$3 = htmlBinding.isVueEventBindingExpression;
24755   var classChildNeedsASIProtection$1 = utils$4.classChildNeedsASIProtection,
24756       classPropMayCauseASIProblems$1 = utils$4.classPropMayCauseASIProblems,
24757       conditionalExpressionChainContainsJSX$1 = utils$4.conditionalExpressionChainContainsJSX,
24758       getFlowVariance$1 = utils$4.getFlowVariance,
24759       getLeftSidePathName$2 = utils$4.getLeftSidePathName,
24760       getTypeScriptMappedTypeModifier$1 = utils$4.getTypeScriptMappedTypeModifier,
24761       hasDanglingComments$1 = utils$4.hasDanglingComments,
24762       hasFlowAnnotationComment$1 = utils$4.hasFlowAnnotationComment,
24763       hasFlowShorthandAnnotationComment$2 = utils$4.hasFlowShorthandAnnotationComment,
24764       hasLeadingComment$3 = utils$4.hasLeadingComment,
24765       hasLeadingOwnLineComment$1 = utils$4.hasLeadingOwnLineComment,
24766       hasNakedLeftSide$2 = utils$4.hasNakedLeftSide,
24767       hasNewlineBetweenOrAfterDecorators$1 = utils$4.hasNewlineBetweenOrAfterDecorators,
24768       hasNgSideEffect$1 = utils$4.hasNgSideEffect,
24769       hasPrettierIgnore$3 = utils$4.hasPrettierIgnore,
24770       hasTrailingComment$1 = utils$4.hasTrailingComment,
24771       identity$2 = utils$4.identity,
24772       isBinaryish$1 = utils$4.isBinaryish,
24773       isCallOrOptionalCallExpression$1 = utils$4.isCallOrOptionalCallExpression,
24774       isEmptyJSXElement$1 = utils$4.isEmptyJSXElement,
24775       isFlowAnnotationComment$1 = utils$4.isFlowAnnotationComment,
24776       isFunctionCompositionArgs$1 = utils$4.isFunctionCompositionArgs,
24777       isFunctionNotation$1 = utils$4.isFunctionNotation,
24778       isFunctionOrArrowExpression$1 = utils$4.isFunctionOrArrowExpression,
24779       isGetterOrSetter$1 = utils$4.isGetterOrSetter,
24780       isJestEachTemplateLiteral$1 = utils$4.isJestEachTemplateLiteral,
24781       isJSXNode$1 = utils$4.isJSXNode,
24782       isJSXWhitespaceExpression$1 = utils$4.isJSXWhitespaceExpression,
24783       isLastStatement$1 = utils$4.isLastStatement,
24784       isLiteral$1 = utils$4.isLiteral,
24785       isLongCurriedCallExpression$1 = utils$4.isLongCurriedCallExpression,
24786       isMeaningfulJSXText$1 = utils$4.isMeaningfulJSXText,
24787       isMemberExpressionChain$1 = utils$4.isMemberExpressionChain,
24788       isMemberish$1 = utils$4.isMemberish,
24789       isNgForOf$1 = utils$4.isNgForOf,
24790       isNumericLiteral$1 = utils$4.isNumericLiteral,
24791       isObjectType$1 = utils$4.isObjectType,
24792       isObjectTypePropertyAFunction$1 = utils$4.isObjectTypePropertyAFunction,
24793       isSimpleFlowType$1 = utils$4.isSimpleFlowType,
24794       isSimpleTemplateLiteral$1 = utils$4.isSimpleTemplateLiteral,
24795       isStringLiteral$1 = utils$4.isStringLiteral,
24796       isStringPropSafeToCoerceToIdentifier$1 = utils$4.isStringPropSafeToCoerceToIdentifier,
24797       isTemplateOnItsOwnLine$1 = utils$4.isTemplateOnItsOwnLine,
24798       isTestCall$1 = utils$4.isTestCall,
24799       isTheOnlyJSXElementInMarkdown$1 = utils$4.isTheOnlyJSXElementInMarkdown,
24800       isTSXFile$1 = utils$4.isTSXFile,
24801       isTypeAnnotationAFunction$1 = utils$4.isTypeAnnotationAFunction,
24802       matchJsxWhitespaceRegex$1 = utils$4.matchJsxWhitespaceRegex,
24803       needsHardlineAfterDanglingComment$1 = utils$4.needsHardlineAfterDanglingComment,
24804       rawText$1 = utils$4.rawText,
24805       returnArgumentHasLeadingComment$1 = utils$4.returnArgumentHasLeadingComment;
24806   var needsQuoteProps = new WeakMap();
24807   var _require$$5$builders = doc.builders,
24808       concat$d = _require$$5$builders.concat,
24809       join$9 = _require$$5$builders.join,
24810       line$7 = _require$$5$builders.line,
24811       hardline$9 = _require$$5$builders.hardline,
24812       softline$6 = _require$$5$builders.softline,
24813       literalline$4 = _require$$5$builders.literalline,
24814       group$b = _require$$5$builders.group,
24815       indent$7 = _require$$5$builders.indent,
24816       align$1 = _require$$5$builders.align,
24817       conditionalGroup$1 = _require$$5$builders.conditionalGroup,
24818       fill$4 = _require$$5$builders.fill,
24819       ifBreak$6 = _require$$5$builders.ifBreak,
24820       breakParent$3 = _require$$5$builders.breakParent,
24821       lineSuffixBoundary$1 = _require$$5$builders.lineSuffixBoundary,
24822       addAlignmentToDoc$2 = _require$$5$builders.addAlignmentToDoc,
24823       dedent$2 = _require$$5$builders.dedent,
24824       _require$$5$utils = doc.utils,
24825       willBreak$1 = _require$$5$utils.willBreak,
24826       isLineNext$1 = _require$$5$utils.isLineNext,
24827       isEmpty$1 = _require$$5$utils.isEmpty,
24828       removeLines$2 = _require$$5$utils.removeLines,
24829       printDocToString$1 = doc.printer.printDocToString;
24830   var uid = 0;
24831
24832   function shouldPrintComma$1(options, level) {
24833     level = level || "es5";
24834
24835     switch (options.trailingComma) {
24836       case "all":
24837         if (level === "all") {
24838           return true;
24839         }
24840
24841       // fallthrough
24842
24843       case "es5":
24844         if (level === "es5") {
24845           return true;
24846         }
24847
24848       // fallthrough
24849
24850       case "none":
24851       default:
24852         return false;
24853     }
24854   }
24855
24856   function genericPrint$3(path, options, printPath, args) {
24857     var node = path.getValue();
24858     var needsParens = false;
24859     var linesWithoutParens = printPathNoParens(path, options, printPath, args);
24860
24861     if (!node || isEmpty$1(linesWithoutParens)) {
24862       return linesWithoutParens;
24863     }
24864
24865     var parentExportDecl = getParentExportDeclaration$1(path);
24866     var decorators = [];
24867
24868     if (node.type === "ClassMethod" || node.type === "ClassPrivateMethod" || node.type === "ClassProperty" || node.type === "TSAbstractClassProperty" || node.type === "ClassPrivateProperty" || node.type === "MethodDefinition" || node.type === "TSAbstractMethodDefinition") ; else if (node.decorators && node.decorators.length > 0 && // If the parent node is an export declaration and the decorator
24869     // was written before the export, the export will be responsible
24870     // for printing the decorators.
24871     !(parentExportDecl && options.locStart(parentExportDecl, {
24872       ignoreDecorators: true
24873     }) > options.locStart(node.decorators[0]))) {
24874       var shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators$1(node, options);
24875       var separator = shouldBreak ? hardline$9 : line$7;
24876       path.each(function (decoratorPath) {
24877         var decorator = decoratorPath.getValue();
24878
24879         if (decorator.expression) {
24880           decorator = decorator.expression;
24881         } else {
24882           decorator = decorator.callee;
24883         }
24884
24885         decorators.push(printPath(decoratorPath), separator);
24886       }, "decorators");
24887
24888       if (parentExportDecl) {
24889         decorators.unshift(hardline$9);
24890       }
24891     } else if (isExportDeclaration$1(node) && node.declaration && node.declaration.decorators && node.declaration.decorators.length > 0 && // Only print decorators here if they were written before the export,
24892     // otherwise they are printed by the node.declaration
24893     options.locStart(node, {
24894       ignoreDecorators: true
24895     }) > options.locStart(node.declaration.decorators[0])) {
24896       // Export declarations are responsible for printing any decorators
24897       // that logically apply to node.declaration.
24898       path.each(function (decoratorPath) {
24899         var decorator = decoratorPath.getValue();
24900         var prefix = decorator.type === "Decorator" ? "" : "@";
24901         decorators.push(prefix, printPath(decoratorPath), hardline$9);
24902       }, "declaration", "decorators");
24903     } else {
24904       // Nodes with decorators can't have parentheses, so we can avoid
24905       // computing pathNeedsParens() except in this case.
24906       needsParens = needsParens_1(path, options);
24907     }
24908
24909     var parts = [];
24910
24911     if (needsParens) {
24912       parts.unshift("(");
24913     }
24914
24915     parts.push(linesWithoutParens);
24916
24917     if (needsParens) {
24918       var _node = path.getValue();
24919
24920       if (hasFlowShorthandAnnotationComment$2(_node)) {
24921         parts.push(" /*");
24922         parts.push(_node.trailingComments[0].value.trimLeft());
24923         parts.push("*/");
24924         _node.trailingComments[0].printed = true;
24925       }
24926
24927       parts.push(")");
24928     }
24929
24930     if (decorators.length > 0) {
24931       return group$b(concat$d(decorators.concat(parts)));
24932     }
24933
24934     return concat$d(parts);
24935   }
24936
24937   function printDecorators(path, options, print) {
24938     var node = path.getValue();
24939     return group$b(concat$d([join$9(line$7, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators$1(node, options) ? hardline$9 : line$7]));
24940   }
24941   /**
24942    * The following is the shared logic for
24943    * ternary operators, namely ConditionalExpression
24944    * and TSConditionalType
24945    * @typedef {Object} OperatorOptions
24946    * @property {() => Array<string | Doc>} beforeParts - Parts to print before the `?`.
24947    * @property {(breakClosingParen: boolean) => Array<string | Doc>} afterParts - Parts to print after the conditional expression.
24948    * @property {boolean} shouldCheckJsx - Whether to check for and print in JSX mode.
24949    * @property {string} conditionalNodeType - The type of the conditional expression node, ie "ConditionalExpression" or "TSConditionalType".
24950    * @property {string} consequentNodePropertyName - The property at which the consequent node can be found on the main node, eg "consequent".
24951    * @property {string} alternateNodePropertyName - The property at which the alternate node can be found on the main node, eg "alternate".
24952    * @property {string} testNodePropertyName - The property at which the test node can be found on the main node, eg "test".
24953    * @property {boolean} breakNested - Whether to break all nested ternaries when one breaks.
24954    * @param {FastPath} path - The path to the ConditionalExpression/TSConditionalType node.
24955    * @param {Options} options - Prettier options
24956    * @param {Function} print - Print function to call recursively
24957    * @param {OperatorOptions} operatorOptions
24958    * @returns Doc
24959    */
24960
24961
24962   function printTernaryOperator(path, options, print, operatorOptions) {
24963     var node = path.getValue();
24964     var testNode = node[operatorOptions.testNodePropertyName];
24965     var consequentNode = node[operatorOptions.consequentNodePropertyName];
24966     var alternateNode = node[operatorOptions.alternateNodePropertyName];
24967     var parts = []; // We print a ConditionalExpression in either "JSX mode" or "normal mode".
24968     // See tests/jsx/conditional-expression.js for more info.
24969
24970     var jsxMode = false;
24971     var parent = path.getParentNode();
24972     var forceNoIndent = parent.type === operatorOptions.conditionalNodeType; // Find the outermost non-ConditionalExpression parent, and the outermost
24973     // ConditionalExpression parent. We'll use these to determine if we should
24974     // print in JSX mode.
24975
24976     var currentParent;
24977     var previousParent;
24978     var i = 0;
24979
24980     do {
24981       previousParent = currentParent || node;
24982       currentParent = path.getParentNode(i);
24983       i++;
24984     } while (currentParent && currentParent.type === operatorOptions.conditionalNodeType);
24985
24986     var firstNonConditionalParent = currentParent || parent;
24987     var lastConditionalParent = previousParent;
24988
24989     if (operatorOptions.shouldCheckJsx && (isJSXNode$1(testNode) || isJSXNode$1(consequentNode) || isJSXNode$1(alternateNode) || conditionalExpressionChainContainsJSX$1(lastConditionalParent))) {
24990       jsxMode = true;
24991       forceNoIndent = true; // Even though they don't need parens, we wrap (almost) everything in
24992       // parens when using ?: within JSX, because the parens are analogous to
24993       // curly braces in an if statement.
24994
24995       var wrap = function wrap(doc) {
24996         return concat$d([ifBreak$6("(", ""), indent$7(concat$d([softline$6, doc])), softline$6, ifBreak$6(")", "")]);
24997       }; // The only things we don't wrap are:
24998       // * Nested conditional expressions in alternates
24999       // * null
25000
25001
25002       var isNull = function isNull(node) {
25003         return node.type === "NullLiteral" || node.type === "Literal" && node.value === null;
25004       };
25005
25006       parts.push(" ? ", isNull(consequentNode) ? path.call(print, operatorOptions.consequentNodePropertyName) : wrap(path.call(print, operatorOptions.consequentNodePropertyName)), " : ", alternateNode.type === operatorOptions.conditionalNodeType || isNull(alternateNode) ? path.call(print, operatorOptions.alternateNodePropertyName) : wrap(path.call(print, operatorOptions.alternateNodePropertyName)));
25007     } else {
25008       // normal mode
25009       var part = concat$d([line$7, "? ", consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$6("", "(") : "", align$1(2, path.call(print, operatorOptions.consequentNodePropertyName)), consequentNode.type === operatorOptions.conditionalNodeType ? ifBreak$6("", ")") : "", line$7, ": ", alternateNode.type === operatorOptions.conditionalNodeType ? path.call(print, operatorOptions.alternateNodePropertyName) : align$1(2, path.call(print, operatorOptions.alternateNodePropertyName))]);
25010       parts.push(parent.type !== operatorOptions.conditionalNodeType || parent[operatorOptions.alternateNodePropertyName] === node ? part : options.useTabs ? dedent$2(indent$7(part)) : align$1(Math.max(0, options.tabWidth - 2), part));
25011     } // We want a whole chain of ConditionalExpressions to all
25012     // break if any of them break. That means we should only group around the
25013     // outer-most ConditionalExpression.
25014
25015
25016     var maybeGroup = function maybeGroup(doc) {
25017       return operatorOptions.breakNested ? parent === firstNonConditionalParent ? group$b(doc) : doc : group$b(doc);
25018     }; // Break the closing paren to keep the chain right after it:
25019     // (a
25020     //   ? b
25021     //   : c
25022     // ).call()
25023
25024
25025     var breakClosingParen = !jsxMode && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression" || parent.type === "NGPipeExpression" && parent.left === node && operatorOptions.breakNested) && !parent.computed;
25026     return maybeGroup(concat$d([].concat(function (testDoc) {
25027       return (
25028         /**
25029          *     a
25030          *       ? b
25031          *       : multiline
25032          *         test
25033          *         node
25034          *       ^^ align(2)
25035          *       ? d
25036          *       : e
25037          */
25038         parent.type === operatorOptions.conditionalNodeType && parent[operatorOptions.alternateNodePropertyName] === node ? align$1(2, testDoc) : testDoc
25039       );
25040     }(concat$d(operatorOptions.beforeParts())), forceNoIndent ? concat$d(parts) : indent$7(concat$d(parts)), operatorOptions.afterParts(breakClosingParen))));
25041   }
25042
25043   function printPathNoParens(path, options, print, args) {
25044     var n = path.getValue();
25045     var semi = options.semi ? ";" : "";
25046
25047     if (!n) {
25048       return "";
25049     }
25050
25051     if (typeof n === "string") {
25052       return n;
25053     }
25054
25055     var htmlBinding = printHtmlBinding$1(path, options, print);
25056
25057     if (htmlBinding) {
25058       return htmlBinding;
25059     }
25060
25061     var parts = [];
25062
25063     switch (n.type) {
25064       case "JsExpressionRoot":
25065         return path.call(print, "node");
25066
25067       case "JsonRoot":
25068         return concat$d([path.call(print, "node"), hardline$9]);
25069
25070       case "File":
25071         // Print @babel/parser's InterpreterDirective here so that
25072         // leading comments on the `Program` node get printed after the hashbang.
25073         if (n.program && n.program.interpreter) {
25074           parts.push(path.call(function (programPath) {
25075             return programPath.call(print, "interpreter");
25076           }, "program"));
25077         }
25078
25079         parts.push(path.call(print, "program"));
25080         return concat$d(parts);
25081
25082       case "Program":
25083         // Babel 6
25084         if (n.directives) {
25085           path.each(function (childPath) {
25086             parts.push(print(childPath), semi, hardline$9);
25087
25088             if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options)) {
25089               parts.push(hardline$9);
25090             }
25091           }, "directives");
25092         }
25093
25094         parts.push(path.call(function (bodyPath) {
25095           return printStatementSequence(bodyPath, options, print);
25096         }, "body"));
25097         parts.push(comments.printDanglingComments(path, options,
25098         /* sameIndent */
25099         true)); // Only force a trailing newline if there were any contents.
25100
25101         if (n.body.length || n.comments) {
25102           parts.push(hardline$9);
25103         }
25104
25105         return concat$d(parts);
25106       // Babel extension.
25107
25108       case "EmptyStatement":
25109         return "";
25110
25111       case "ExpressionStatement":
25112         // Detect Flow-parsed directives
25113         if (n.directive) {
25114           return concat$d([nodeStr(n.expression, options, true), semi]);
25115         }
25116
25117         if (options.parser === "__vue_event_binding") {
25118           var parent = path.getParentNode();
25119
25120           if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === n) {
25121             return concat$d([path.call(print, "expression"), isVueEventBindingExpression$3(n.expression) ? ";" : ""]);
25122           }
25123         } // Do not append semicolon after the only JSX element in a program
25124
25125
25126         return concat$d([path.call(print, "expression"), isTheOnlyJSXElementInMarkdown$1(options, path) ? "" : semi]);
25127       // Babel extension.
25128
25129       case "ParenthesizedExpression":
25130         return concat$d(["(", path.call(print, "expression"), ")"]);
25131
25132       case "AssignmentExpression":
25133         return printAssignment(n.left, path.call(print, "left"), concat$d([" ", n.operator]), n.right, path.call(print, "right"), options);
25134
25135       case "BinaryExpression":
25136       case "LogicalExpression":
25137       case "NGPipeExpression":
25138         {
25139           var _parent = path.getParentNode();
25140
25141           var parentParent = path.getParentNode(1);
25142           var isInsideParenthesis = n !== _parent.body && (_parent.type === "IfStatement" || _parent.type === "WhileStatement" || _parent.type === "SwitchStatement" || _parent.type === "DoWhileStatement");
25143
25144           var _parts = printBinaryishExpressions(path, print, options,
25145           /* isNested */
25146           false, isInsideParenthesis); //   if (
25147           //     this.hasPlugin("dynamicImports") && this.lookahead().type === tt.parenLeft
25148           //   ) {
25149           //
25150           // looks super weird, we want to break the children if the parent breaks
25151           //
25152           //   if (
25153           //     this.hasPlugin("dynamicImports") &&
25154           //     this.lookahead().type === tt.parenLeft
25155           //   ) {
25156
25157
25158           if (isInsideParenthesis) {
25159             return concat$d(_parts);
25160           } // Break between the parens in
25161           // unaries or in a member or specific call expression, i.e.
25162           //
25163           //   (
25164           //     a &&
25165           //     b &&
25166           //     c
25167           //   ).call()
25168
25169
25170           if ((_parent.type === "CallExpression" || _parent.type === "OptionalCallExpression") && _parent.callee === n || _parent.type === "UnaryExpression" || (_parent.type === "MemberExpression" || _parent.type === "OptionalMemberExpression") && !_parent.computed) {
25171             return group$b(concat$d([indent$7(concat$d([softline$6, concat$d(_parts)])), softline$6]));
25172           } // Avoid indenting sub-expressions in some cases where the first sub-expression is already
25173           // indented accordingly. We should indent sub-expressions where the first case isn't indented.
25174
25175
25176           var shouldNotIndent = _parent.type === "ReturnStatement" || _parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || n.type !== "NGPipeExpression" && (_parent.type === "NGRoot" && options.parser === "__ng_binding" || _parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || n === _parent.body && _parent.type === "ArrowFunctionExpression" || n !== _parent.body && _parent.type === "ForStatement" || _parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "CallExpression" && parentParent.type !== "OptionalCallExpression";
25177           var shouldIndentIfInlining = _parent.type === "AssignmentExpression" || _parent.type === "VariableDeclarator" || _parent.type === "ClassProperty" || _parent.type === "TSAbstractClassProperty" || _parent.type === "ClassPrivateProperty" || _parent.type === "ObjectProperty" || _parent.type === "Property";
25178           var samePrecedenceSubExpression = isBinaryish$1(n.left) && shouldFlatten$1(n.operator, n.left.operator);
25179
25180           if (shouldNotIndent || shouldInlineLogicalExpression(n) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(n) && shouldIndentIfInlining) {
25181             return group$b(concat$d(_parts));
25182           }
25183
25184           if (_parts.length === 0) {
25185             return "";
25186           } // If the right part is a JSX node, we include it in a separate group to
25187           // prevent it breaking the whole chain, so we can print the expression like:
25188           //
25189           //   foo && bar && (
25190           //     <Foo>
25191           //       <Bar />
25192           //     </Foo>
25193           //   )
25194
25195
25196           var hasJSX = isJSXNode$1(n.right);
25197           var rest = concat$d(hasJSX ? _parts.slice(1, -1) : _parts.slice(1));
25198           var groupId = Symbol("logicalChain-" + ++uid);
25199           var chain = group$b(concat$d([// Don't include the initial expression in the indentation
25200           // level. The first item is guaranteed to be the first
25201           // left-most expression.
25202           _parts.length > 0 ? _parts[0] : "", indent$7(rest)]), {
25203             id: groupId
25204           });
25205
25206           if (!hasJSX) {
25207             return chain;
25208           }
25209
25210           var jsxPart = getLast$2(_parts);
25211           return group$b(concat$d([chain, ifBreak$6(indent$7(jsxPart), jsxPart, {
25212             groupId: groupId
25213           })]));
25214         }
25215
25216       case "AssignmentPattern":
25217         return concat$d([path.call(print, "left"), " = ", path.call(print, "right")]);
25218
25219       case "TSTypeAssertion":
25220         {
25221           var shouldBreakAfterCast = !(n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression");
25222           var castGroup = group$b(concat$d(["<", indent$7(concat$d([softline$6, path.call(print, "typeAnnotation")])), softline$6, ">"]));
25223           var exprContents = concat$d([ifBreak$6("("), indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, ifBreak$6(")")]);
25224
25225           if (shouldBreakAfterCast) {
25226             return conditionalGroup$1([concat$d([castGroup, path.call(print, "expression")]), concat$d([castGroup, group$b(exprContents, {
25227               shouldBreak: true
25228             })]), concat$d([castGroup, path.call(print, "expression")])]);
25229           }
25230
25231           return group$b(concat$d([castGroup, path.call(print, "expression")]));
25232         }
25233
25234       case "OptionalMemberExpression":
25235       case "MemberExpression":
25236         {
25237           var _parent2 = path.getParentNode();
25238
25239           var firstNonMemberParent;
25240           var i = 0;
25241
25242           do {
25243             firstNonMemberParent = path.getParentNode(i);
25244             i++;
25245           } while (firstNonMemberParent && (firstNonMemberParent.type === "MemberExpression" || firstNonMemberParent.type === "OptionalMemberExpression" || firstNonMemberParent.type === "TSNonNullExpression"));
25246
25247           var shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "VariableDeclarator" && firstNonMemberParent.id.type !== "Identifier" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || n.computed || n.object.type === "Identifier" && n.property.type === "Identifier" && _parent2.type !== "MemberExpression" && _parent2.type !== "OptionalMemberExpression";
25248           return concat$d([path.call(print, "object"), shouldInline ? printMemberLookup(path, options, print) : group$b(indent$7(concat$d([softline$6, printMemberLookup(path, options, print)])))]);
25249         }
25250
25251       case "MetaProperty":
25252         return concat$d([path.call(print, "meta"), ".", path.call(print, "property")]);
25253
25254       case "BindExpression":
25255         if (n.object) {
25256           parts.push(path.call(print, "object"));
25257         }
25258
25259         parts.push(group$b(indent$7(concat$d([softline$6, printBindExpressionCallee(path, options, print)]))));
25260         return concat$d(parts);
25261
25262       case "Identifier":
25263         {
25264           return concat$d([n.name, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
25265         }
25266
25267       case "V8IntrinsicIdentifier":
25268         return concat$d(["%", n.name]);
25269
25270       case "SpreadElement":
25271       case "SpreadElementPattern":
25272       case "RestProperty":
25273       case "SpreadProperty":
25274       case "SpreadPropertyPattern":
25275       case "RestElement":
25276       case "ObjectTypeSpreadProperty":
25277         return concat$d(["...", path.call(print, "argument"), printTypeAnnotation(path, options, print)]);
25278
25279       case "FunctionDeclaration":
25280       case "FunctionExpression":
25281         parts.push(printFunctionDeclaration(path, print, options));
25282
25283         if (!n.body) {
25284           parts.push(semi);
25285         }
25286
25287         return concat$d(parts);
25288
25289       case "ArrowFunctionExpression":
25290         {
25291           if (n.async) {
25292             parts.push("async ");
25293           }
25294
25295           if (shouldPrintParamsWithoutParens(path, options)) {
25296             parts.push(path.call(print, "params", 0));
25297           } else {
25298             parts.push(group$b(concat$d([printFunctionParams(path, print, options,
25299             /* expandLast */
25300             args && (args.expandLastArg || args.expandFirstArg),
25301             /* printTypeParams */
25302             true), printReturnType(path, print, options)])));
25303           }
25304
25305           var dangling = comments.printDanglingComments(path, options,
25306           /* sameIndent */
25307           true, function (comment) {
25308             var nextCharacter = getNextNonSpaceNonCommentCharacterIndex$2(options.originalText, comment, options);
25309             return options.originalText.substr(nextCharacter, 2) === "=>";
25310           });
25311
25312           if (dangling) {
25313             parts.push(" ", dangling);
25314           }
25315
25316           parts.push(" =>");
25317           var body = path.call(function (bodyPath) {
25318             return print(bodyPath, args);
25319           }, "body"); // We want to always keep these types of nodes on the same line
25320           // as the arrow.
25321
25322           if (!hasLeadingOwnLineComment$1(options.originalText, n.body, options) && (n.body.type === "ArrayExpression" || n.body.type === "ObjectExpression" || n.body.type === "BlockStatement" || isJSXNode$1(n.body) || isTemplateOnItsOwnLine$1(n.body, options.originalText, options) || n.body.type === "ArrowFunctionExpression" || n.body.type === "DoExpression")) {
25323             return group$b(concat$d([concat$d(parts), " ", body]));
25324           } // We handle sequence expressions as the body of arrows specially,
25325           // so that the required parentheses end up on their own lines.
25326
25327
25328           if (n.body.type === "SequenceExpression") {
25329             return group$b(concat$d([concat$d(parts), group$b(concat$d([" (", indent$7(concat$d([softline$6, body])), softline$6, ")"]))]));
25330           } // if the arrow function is expanded as last argument, we are adding a
25331           // level of indentation and need to add a softline to align the closing )
25332           // with the opening (, or if it's inside a JSXExpression (e.g. an attribute)
25333           // we should align the expression's closing } with the line with the opening {.
25334
25335
25336           var shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !(n.comments && n.comments.length);
25337           var printTrailingComma = args && args.expandLastArg && shouldPrintComma$1(options, "all"); // In order to avoid confusion between
25338           // a => a ? a : a
25339           // a <= a ? a : a
25340
25341           var shouldAddParens = n.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken$1(n.body,
25342           /* forbidFunctionAndClass */
25343           false);
25344           return group$b(concat$d([concat$d(parts), group$b(concat$d([indent$7(concat$d([line$7, shouldAddParens ? ifBreak$6("", "(") : "", body, shouldAddParens ? ifBreak$6("", ")") : ""])), shouldAddSoftLine ? concat$d([ifBreak$6(printTrailingComma ? "," : ""), softline$6]) : ""]))]));
25345         }
25346
25347       case "YieldExpression":
25348         parts.push("yield");
25349
25350         if (n.delegate) {
25351           parts.push("*");
25352         }
25353
25354         if (n.argument) {
25355           parts.push(" ", path.call(print, "argument"));
25356         }
25357
25358         return concat$d(parts);
25359
25360       case "AwaitExpression":
25361         {
25362           parts.push("await ", path.call(print, "argument"));
25363
25364           var _parent3 = path.getParentNode();
25365
25366           if ((_parent3.type === "CallExpression" || _parent3.type === "OptionalCallExpression") && _parent3.callee === n || (_parent3.type === "MemberExpression" || _parent3.type === "OptionalMemberExpression") && _parent3.object === n) {
25367             return group$b(concat$d([indent$7(concat$d([softline$6, concat$d(parts)])), softline$6]));
25368           }
25369
25370           return concat$d(parts);
25371         }
25372
25373       case "ImportSpecifier":
25374         if (n.importKind) {
25375           parts.push(path.call(print, "importKind"), " ");
25376         }
25377
25378         parts.push(path.call(print, "imported"));
25379
25380         if (n.local && n.local.name !== n.imported.name) {
25381           parts.push(" as ", path.call(print, "local"));
25382         }
25383
25384         return concat$d(parts);
25385
25386       case "ExportSpecifier":
25387         parts.push(path.call(print, "local"));
25388
25389         if (n.exported && n.exported.name !== n.local.name) {
25390           parts.push(" as ", path.call(print, "exported"));
25391         }
25392
25393         return concat$d(parts);
25394
25395       case "ImportNamespaceSpecifier":
25396         parts.push("* as ");
25397         parts.push(path.call(print, "local"));
25398         return concat$d(parts);
25399
25400       case "ImportDefaultSpecifier":
25401         return path.call(print, "local");
25402
25403       case "TSExportAssignment":
25404         return concat$d(["export = ", path.call(print, "expression"), semi]);
25405
25406       case "ExportDefaultDeclaration":
25407       case "ExportNamedDeclaration":
25408         return printExportDeclaration(path, options, print);
25409
25410       case "ExportAllDeclaration":
25411         parts.push("export ");
25412
25413         if (n.exportKind === "type") {
25414           parts.push("type ");
25415         }
25416
25417         parts.push("* from ", path.call(print, "source"), semi);
25418         return concat$d(parts);
25419
25420       case "ExportNamespaceSpecifier":
25421       case "ExportDefaultSpecifier":
25422         return path.call(print, "exported");
25423
25424       case "ImportDeclaration":
25425         {
25426           parts.push("import ");
25427
25428           if (n.importKind && n.importKind !== "value") {
25429             parts.push(n.importKind + " ");
25430           }
25431
25432           var standalones = [];
25433           var grouped = [];
25434
25435           if (n.specifiers && n.specifiers.length > 0) {
25436             path.each(function (specifierPath) {
25437               var value = specifierPath.getValue();
25438
25439               if (value.type === "ImportDefaultSpecifier" || value.type === "ImportNamespaceSpecifier") {
25440                 standalones.push(print(specifierPath));
25441               } else {
25442                 grouped.push(print(specifierPath));
25443               }
25444             }, "specifiers");
25445
25446             if (standalones.length > 0) {
25447               parts.push(join$9(", ", standalones));
25448             }
25449
25450             if (standalones.length > 0 && grouped.length > 0) {
25451               parts.push(", ");
25452             }
25453
25454             if (grouped.length === 1 && standalones.length === 0 && n.specifiers && !n.specifiers.some(function (node) {
25455               return node.comments;
25456             })) {
25457               parts.push(concat$d(["{", options.bracketSpacing ? " " : "", concat$d(grouped), options.bracketSpacing ? " " : "", "}"]));
25458             } else if (grouped.length >= 1) {
25459               parts.push(group$b(concat$d(["{", indent$7(concat$d([options.bracketSpacing ? line$7 : softline$6, join$9(concat$d([",", line$7]), grouped)])), ifBreak$6(shouldPrintComma$1(options) ? "," : ""), options.bracketSpacing ? line$7 : softline$6, "}"])));
25460             }
25461
25462             parts.push(" from ");
25463           } else if (n.importKind && n.importKind === "type" || // import {} from 'x'
25464           /{\s*}/.test(options.originalText.slice(options.locStart(n), options.locStart(n.source)))) {
25465             parts.push("{} from ");
25466           }
25467
25468           parts.push(path.call(print, "source"), semi);
25469           return concat$d(parts);
25470         }
25471
25472       case "Import":
25473         return "import";
25474
25475       case "TSModuleBlock":
25476       case "BlockStatement":
25477         {
25478           var naked = path.call(function (bodyPath) {
25479             return printStatementSequence(bodyPath, options, print);
25480           }, "body");
25481           var hasContent = n.body.find(function (node) {
25482             return node.type !== "EmptyStatement";
25483           });
25484           var hasDirectives = n.directives && n.directives.length > 0;
25485
25486           var _parent4 = path.getParentNode();
25487
25488           var _parentParent = path.getParentNode(1);
25489
25490           if (!hasContent && !hasDirectives && !hasDanglingComments$1(n) && (_parent4.type === "ArrowFunctionExpression" || _parent4.type === "FunctionExpression" || _parent4.type === "FunctionDeclaration" || _parent4.type === "ObjectMethod" || _parent4.type === "ClassMethod" || _parent4.type === "ClassPrivateMethod" || _parent4.type === "ForStatement" || _parent4.type === "WhileStatement" || _parent4.type === "DoWhileStatement" || _parent4.type === "DoExpression" || _parent4.type === "CatchClause" && !_parentParent.finalizer || _parent4.type === "TSModuleDeclaration")) {
25491             return "{}";
25492           }
25493
25494           parts.push("{"); // Babel 6
25495
25496           if (hasDirectives) {
25497             path.each(function (childPath) {
25498               parts.push(indent$7(concat$d([hardline$9, print(childPath), semi])));
25499
25500               if (isNextLineEmpty$4(options.originalText, childPath.getValue(), options)) {
25501                 parts.push(hardline$9);
25502               }
25503             }, "directives");
25504           }
25505
25506           if (hasContent) {
25507             parts.push(indent$7(concat$d([hardline$9, naked])));
25508           }
25509
25510           parts.push(comments.printDanglingComments(path, options));
25511           parts.push(hardline$9, "}");
25512           return concat$d(parts);
25513         }
25514
25515       case "ReturnStatement":
25516         parts.push("return");
25517
25518         if (n.argument) {
25519           if (returnArgumentHasLeadingComment$1(options, n.argument)) {
25520             parts.push(concat$d([" (", indent$7(concat$d([hardline$9, path.call(print, "argument")])), hardline$9, ")"]));
25521           } else if (n.argument.type === "LogicalExpression" || n.argument.type === "BinaryExpression" || n.argument.type === "SequenceExpression") {
25522             parts.push(group$b(concat$d([ifBreak$6(" (", " "), indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ifBreak$6(")")])));
25523           } else {
25524             parts.push(" ", path.call(print, "argument"));
25525           }
25526         }
25527
25528         if (hasDanglingComments$1(n)) {
25529           parts.push(" ", comments.printDanglingComments(path, options,
25530           /* sameIndent */
25531           true));
25532         }
25533
25534         parts.push(semi);
25535         return concat$d(parts);
25536
25537       case "NewExpression":
25538       case "OptionalCallExpression":
25539       case "CallExpression":
25540         {
25541           var isNew = n.type === "NewExpression";
25542           var optional = printOptionalToken(path);
25543
25544           if ( // We want to keep CommonJS- and AMD-style require calls, and AMD-style
25545           // define calls, as a unit.
25546           // e.g. `define(["some/lib", (lib) => {`
25547           !isNew && n.callee.type === "Identifier" && (n.callee.name === "require" || n.callee.name === "define") || // Template literals as single arguments
25548           n.arguments.length === 1 && isTemplateOnItsOwnLine$1(n.arguments[0], options.originalText, options) || // Keep test declarations on a single line
25549           // e.g. `it('long name', () => {`
25550           !isNew && isTestCall$1(n, path.getParentNode())) {
25551             return concat$d([isNew ? "new " : "", path.call(print, "callee"), optional, printFunctionTypeParameters(path, options, print), concat$d(["(", join$9(", ", path.map(print, "arguments")), ")"])]);
25552           } // Inline Flow annotation comments following Identifiers in Call nodes need to
25553           // stay with the Identifier. For example:
25554           //
25555           // foo /*:: <SomeGeneric> */(bar);
25556           //
25557           // Here, we ensure that such comments stay between the Identifier and the Callee.
25558
25559
25560           var isIdentifierWithFlowAnnotation = n.callee.type === "Identifier" && hasFlowAnnotationComment$1(n.callee.trailingComments);
25561
25562           if (isIdentifierWithFlowAnnotation) {
25563             n.callee.trailingComments[0].printed = true;
25564           } // We detect calls on member lookups and possibly print them in a
25565           // special chain format. See `printMemberChain` for more info.
25566
25567
25568           if (!isNew && isMemberish$1(n.callee)) {
25569             return printMemberChain(path, options, print);
25570           }
25571
25572           var contents = concat$d([isNew ? "new " : "", path.call(print, "callee"), optional, isIdentifierWithFlowAnnotation ? "/*:: ".concat(n.callee.trailingComments[0].value.substring(2).trim(), " */") : "", printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]); // We group here when the callee is itself a call expression.
25573           // See `isLongCurriedCallExpression` for more info.
25574
25575           if (isCallOrOptionalCallExpression$1(n.callee)) {
25576             return group$b(contents);
25577           }
25578
25579           return contents;
25580         }
25581
25582       case "TSInterfaceDeclaration":
25583         if (n.declare) {
25584           parts.push("declare ");
25585         }
25586
25587         parts.push(n.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print), "interface ", path.call(print, "id"), n.typeParameters ? path.call(print, "typeParameters") : "", " ");
25588
25589         if (n.extends && n.extends.length) {
25590           parts.push(group$b(indent$7(concat$d([softline$6, "extends ", (n.extends.length === 1 ? identity$2 : indent$7)(join$9(concat$d([",", line$7]), path.map(print, "extends"))), " "]))));
25591         }
25592
25593         parts.push(path.call(print, "body"));
25594         return concat$d(parts);
25595
25596       case "ObjectTypeInternalSlot":
25597         return concat$d([n.static ? "static " : "", "[[", path.call(print, "id"), "]]", printOptionalToken(path), n.method ? "" : ": ", path.call(print, "value")]);
25598
25599       case "ObjectExpression":
25600       case "ObjectPattern":
25601       case "ObjectTypeAnnotation":
25602       case "TSInterfaceBody":
25603       case "TSTypeLiteral":
25604         {
25605           var propertiesField;
25606
25607           if (n.type === "TSTypeLiteral") {
25608             propertiesField = "members";
25609           } else if (n.type === "TSInterfaceBody") {
25610             propertiesField = "body";
25611           } else {
25612             propertiesField = "properties";
25613           }
25614
25615           var isTypeAnnotation = n.type === "ObjectTypeAnnotation";
25616           var fields = [];
25617
25618           if (isTypeAnnotation) {
25619             fields.push("indexers", "callProperties", "internalSlots");
25620           }
25621
25622           fields.push(propertiesField);
25623           var firstProperty = fields.map(function (field) {
25624             return n[field][0];
25625           }).sort(function (a, b) {
25626             return options.locStart(a) - options.locStart(b);
25627           })[0];
25628
25629           var _parent5 = path.getParentNode(0);
25630
25631           var isFlowInterfaceLikeBody = isTypeAnnotation && _parent5 && (_parent5.type === "InterfaceDeclaration" || _parent5.type === "DeclareInterface" || _parent5.type === "DeclareClass") && path.getName() === "body";
25632           var shouldBreak = n.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || n.type === "ObjectPattern" && _parent5.type !== "FunctionDeclaration" && _parent5.type !== "FunctionExpression" && _parent5.type !== "ArrowFunctionExpression" && _parent5.type !== "ObjectMethod" && _parent5.type !== "ClassMethod" && _parent5.type !== "ClassPrivateMethod" && _parent5.type !== "AssignmentPattern" && _parent5.type !== "CatchClause" && n.properties.some(function (property) {
25633             return property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern");
25634           }) || n.type !== "ObjectPattern" && firstProperty && hasNewlineInRange$2(options.originalText, options.locStart(n), options.locStart(firstProperty));
25635           var separator = isFlowInterfaceLikeBody ? ";" : n.type === "TSInterfaceBody" || n.type === "TSTypeLiteral" ? ifBreak$6(semi, ";") : ",";
25636           var leftBrace = n.exact ? "{|" : "{";
25637           var rightBrace = n.exact ? "|}" : "}"; // Unfortunately, things are grouped together in the ast can be
25638           // interleaved in the source code. So we need to reorder them before
25639           // printing them.
25640
25641           var propsAndLoc = [];
25642           fields.forEach(function (field) {
25643             path.each(function (childPath) {
25644               var node = childPath.getValue();
25645               propsAndLoc.push({
25646                 node: node,
25647                 printed: print(childPath),
25648                 loc: options.locStart(node)
25649               });
25650             }, field);
25651           });
25652           var separatorParts = [];
25653           var props = propsAndLoc.sort(function (a, b) {
25654             return a.loc - b.loc;
25655           }).map(function (prop) {
25656             var result = concat$d(separatorParts.concat(group$b(prop.printed)));
25657             separatorParts = [separator, line$7];
25658
25659             if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasNodeIgnoreComment$2(prop.node)) {
25660               separatorParts.shift();
25661             }
25662
25663             if (isNextLineEmpty$4(options.originalText, prop.node, options)) {
25664               separatorParts.push(hardline$9);
25665             }
25666
25667             return result;
25668           });
25669
25670           if (n.inexact) {
25671             props.push(concat$d(separatorParts.concat(group$b("..."))));
25672           }
25673
25674           var lastElem = getLast$2(n[propertiesField]);
25675           var canHaveTrailingSeparator = !(lastElem && (lastElem.type === "RestProperty" || lastElem.type === "RestElement" || hasNodeIgnoreComment$2(lastElem) || n.inexact));
25676           var content;
25677
25678           if (props.length === 0) {
25679             if (!hasDanglingComments$1(n)) {
25680               return concat$d([leftBrace, rightBrace, printTypeAnnotation(path, options, print)]);
25681             }
25682
25683             content = group$b(concat$d([leftBrace, comments.printDanglingComments(path, options), softline$6, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]));
25684           } else {
25685             content = concat$d([leftBrace, indent$7(concat$d([options.bracketSpacing ? line$7 : softline$6, concat$d(props)])), ifBreak$6(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma$1(options)) ? separator : ""), concat$d([options.bracketSpacing ? line$7 : softline$6, rightBrace]), printOptionalToken(path), printTypeAnnotation(path, options, print)]);
25686           } // If we inline the object as first argument of the parent, we don't want
25687           // to create another group so that the object breaks before the return
25688           // type
25689
25690
25691           var parentParentParent = path.getParentNode(2);
25692
25693           if (n.type === "ObjectPattern" && _parent5 && shouldHugArguments(_parent5) && !n.decorators && _parent5.params[0] === n || shouldHugType(n) && parentParentParent && shouldHugArguments(parentParentParent) && parentParentParent.params[0].typeAnnotation && parentParentParent.params[0].typeAnnotation.typeAnnotation === n) {
25694             return content;
25695           }
25696
25697           return group$b(content, {
25698             shouldBreak: shouldBreak
25699           });
25700         }
25701       // Babel 6
25702
25703       case "ObjectProperty": // Non-standard AST node type.
25704
25705       case "Property":
25706         if (n.method || n.kind === "get" || n.kind === "set") {
25707           return printMethod(path, options, print);
25708         }
25709
25710         if (n.shorthand) {
25711           parts.push(path.call(print, "value"));
25712         } else {
25713           parts.push(printAssignment(n.key, printPropertyKey(path, options, print), ":", n.value, path.call(print, "value"), options));
25714         }
25715
25716         return concat$d(parts);
25717       // Babel 6
25718
25719       case "ClassMethod":
25720       case "ClassPrivateMethod":
25721       case "MethodDefinition":
25722       case "TSAbstractMethodDefinition":
25723         if (n.decorators && n.decorators.length !== 0) {
25724           parts.push(printDecorators(path, options, print));
25725         }
25726
25727         if (n.accessibility) {
25728           parts.push(n.accessibility + " ");
25729         }
25730
25731         if (n.static) {
25732           parts.push("static ");
25733         }
25734
25735         if (n.type === "TSAbstractMethodDefinition") {
25736           parts.push("abstract ");
25737         }
25738
25739         parts.push(printMethod(path, options, print));
25740         return concat$d(parts);
25741
25742       case "ObjectMethod":
25743         return printMethod(path, options, print);
25744
25745       case "Decorator":
25746         return concat$d(["@", path.call(print, "expression"), path.call(print, "callee")]);
25747
25748       case "ArrayExpression":
25749       case "ArrayPattern":
25750         if (n.elements.length === 0) {
25751           if (!hasDanglingComments$1(n)) {
25752             parts.push("[]");
25753           } else {
25754             parts.push(group$b(concat$d(["[", comments.printDanglingComments(path, options), softline$6, "]"])));
25755           }
25756         } else {
25757           var _lastElem = getLast$2(n.elements);
25758
25759           var canHaveTrailingComma = !(_lastElem && _lastElem.type === "RestElement"); // JavaScript allows you to have empty elements in an array which
25760           // changes its length based on the number of commas. The algorithm
25761           // is that if the last argument is null, we need to force insert
25762           // a comma to ensure JavaScript recognizes it.
25763           //   [,].length === 1
25764           //   [1,].length === 1
25765           //   [1,,].length === 2
25766           //
25767           // Note that getLast returns null if the array is empty, but
25768           // we already check for an empty array just above so we are safe
25769
25770           var needsForcedTrailingComma = canHaveTrailingComma && _lastElem === null;
25771
25772           var _shouldBreak = n.elements.length > 1 && n.elements.every(function (element, i, elements) {
25773             var elementType = element && element.type;
25774
25775             if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
25776               return false;
25777             }
25778
25779             var nextElement = elements[i + 1];
25780
25781             if (nextElement && elementType !== nextElement.type) {
25782               return false;
25783             }
25784
25785             var itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
25786             return element[itemsKey] && element[itemsKey].length > 1;
25787           });
25788
25789           parts.push(group$b(concat$d(["[", indent$7(concat$d([softline$6, printArrayItems(path, options, "elements", print)])), needsForcedTrailingComma ? "," : "", ifBreak$6(canHaveTrailingComma && !needsForcedTrailingComma && shouldPrintComma$1(options) ? "," : ""), comments.printDanglingComments(path, options,
25790           /* sameIndent */
25791           true), softline$6, "]"]), {
25792             shouldBreak: _shouldBreak
25793           }));
25794         }
25795
25796         parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
25797         return concat$d(parts);
25798
25799       case "SequenceExpression":
25800         {
25801           var _parent6 = path.getParentNode(0);
25802
25803           if (_parent6.type === "ExpressionStatement" || _parent6.type === "ForStatement") {
25804             // For ExpressionStatements and for-loop heads, which are among
25805             // the few places a SequenceExpression appears unparenthesized, we want
25806             // to indent expressions after the first.
25807             var _parts2 = [];
25808             path.each(function (p) {
25809               if (p.getName() === 0) {
25810                 _parts2.push(print(p));
25811               } else {
25812                 _parts2.push(",", indent$7(concat$d([line$7, print(p)])));
25813               }
25814             }, "expressions");
25815             return group$b(concat$d(_parts2));
25816           }
25817
25818           return group$b(concat$d([join$9(concat$d([",", line$7]), path.map(print, "expressions"))]));
25819         }
25820
25821       case "ThisExpression":
25822         return "this";
25823
25824       case "Super":
25825         return "super";
25826
25827       case "NullLiteral":
25828         // Babel 6 Literal split
25829         return "null";
25830
25831       case "RegExpLiteral":
25832         // Babel 6 Literal split
25833         return printRegex(n);
25834
25835       case "NumericLiteral":
25836         // Babel 6 Literal split
25837         return printNumber$2(n.extra.raw);
25838
25839       case "BigIntLiteral":
25840         // babel: n.extra.raw, typescript: n.raw, flow: n.bigint
25841         return (n.bigint || (n.extra ? n.extra.raw : n.raw)).toLowerCase();
25842
25843       case "BooleanLiteral": // Babel 6 Literal split
25844
25845       case "StringLiteral": // Babel 6 Literal split
25846
25847       case "Literal":
25848         {
25849           if (n.regex) {
25850             return printRegex(n.regex);
25851           }
25852
25853           if (typeof n.value === "number") {
25854             return printNumber$2(n.raw);
25855           }
25856
25857           if (typeof n.value !== "string") {
25858             return "" + n.value;
25859           } // TypeScript workaround for https://github.com/JamesHenry/typescript-estree/issues/2
25860           // See corresponding workaround in needs-parens.js
25861
25862
25863           var grandParent = path.getParentNode(1);
25864           var isTypeScriptDirective = options.parser === "typescript" && typeof n.value === "string" && grandParent && (grandParent.type === "Program" || grandParent.type === "BlockStatement");
25865           return nodeStr(n, options, isTypeScriptDirective);
25866         }
25867
25868       case "Directive":
25869         return path.call(print, "value");
25870       // Babel 6
25871
25872       case "DirectiveLiteral":
25873         return nodeStr(n, options);
25874
25875       case "UnaryExpression":
25876         parts.push(n.operator);
25877
25878         if (/[a-z]$/.test(n.operator)) {
25879           parts.push(" ");
25880         }
25881
25882         if (n.argument.comments && n.argument.comments.length > 0) {
25883           parts.push(group$b(concat$d(["(", indent$7(concat$d([softline$6, path.call(print, "argument")])), softline$6, ")"])));
25884         } else {
25885           parts.push(path.call(print, "argument"));
25886         }
25887
25888         return concat$d(parts);
25889
25890       case "UpdateExpression":
25891         parts.push(path.call(print, "argument"), n.operator);
25892
25893         if (n.prefix) {
25894           parts.reverse();
25895         }
25896
25897         return concat$d(parts);
25898
25899       case "ConditionalExpression":
25900         return printTernaryOperator(path, options, print, {
25901           beforeParts: function beforeParts() {
25902             return [path.call(print, "test")];
25903           },
25904           afterParts: function afterParts(breakClosingParen) {
25905             return [breakClosingParen ? softline$6 : ""];
25906           },
25907           shouldCheckJsx: true,
25908           conditionalNodeType: "ConditionalExpression",
25909           consequentNodePropertyName: "consequent",
25910           alternateNodePropertyName: "alternate",
25911           testNodePropertyName: "test",
25912           breakNested: true
25913         });
25914
25915       case "VariableDeclaration":
25916         {
25917           var printed = path.map(function (childPath) {
25918             return print(childPath);
25919           }, "declarations"); // We generally want to terminate all variable declarations with a
25920           // semicolon, except when they in the () part of for loops.
25921
25922           var parentNode = path.getParentNode();
25923           var isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement" || parentNode.type === "ForAwaitStatement";
25924           var hasValue = n.declarations.some(function (decl) {
25925             return decl.init;
25926           });
25927           var firstVariable;
25928
25929           if (printed.length === 1 && !n.declarations[0].comments) {
25930             firstVariable = printed[0];
25931           } else if (printed.length > 0) {
25932             // Indent first var to comply with eslint one-var rule
25933             firstVariable = indent$7(printed[0]);
25934           }
25935
25936           parts = [n.declare ? "declare " : "", n.kind, firstVariable ? concat$d([" ", firstVariable]) : "", indent$7(concat$d(printed.slice(1).map(function (p) {
25937             return concat$d([",", hasValue && !isParentForLoop ? hardline$9 : line$7, p]);
25938           })))];
25939
25940           if (!(isParentForLoop && parentNode.body !== n)) {
25941             parts.push(semi);
25942           }
25943
25944           return group$b(concat$d(parts));
25945         }
25946
25947       case "TSTypeAliasDeclaration":
25948         {
25949           if (n.declare) {
25950             parts.push("declare ");
25951           }
25952
25953           var _printed = printAssignmentRight(n.id, n.typeAnnotation, n.typeAnnotation && path.call(print, "typeAnnotation"), options);
25954
25955           parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", _printed, semi);
25956           return group$b(concat$d(parts));
25957         }
25958
25959       case "VariableDeclarator":
25960         return printAssignment(n.id, path.call(print, "id"), " =", n.init, n.init && path.call(print, "init"), options);
25961
25962       case "WithStatement":
25963         return group$b(concat$d(["with (", path.call(print, "object"), ")", adjustClause(n.body, path.call(print, "body"))]));
25964
25965       case "IfStatement":
25966         {
25967           var con = adjustClause(n.consequent, path.call(print, "consequent"));
25968           var opening = group$b(concat$d(["if (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", con]));
25969           parts.push(opening);
25970
25971           if (n.alternate) {
25972             var commentOnOwnLine = hasTrailingComment$1(n.consequent) && n.consequent.comments.some(function (comment) {
25973               return comment.trailing && !comments$1.isBlockComment(comment);
25974             }) || needsHardlineAfterDanglingComment$1(n);
25975             var elseOnSameLine = n.consequent.type === "BlockStatement" && !commentOnOwnLine;
25976             parts.push(elseOnSameLine ? " " : hardline$9);
25977
25978             if (hasDanglingComments$1(n)) {
25979               parts.push(comments.printDanglingComments(path, options, true), commentOnOwnLine ? hardline$9 : " ");
25980             }
25981
25982             parts.push("else", group$b(adjustClause(n.alternate, path.call(print, "alternate"), n.alternate.type === "IfStatement")));
25983           }
25984
25985           return concat$d(parts);
25986         }
25987
25988       case "ForStatement":
25989         {
25990           var _body = adjustClause(n.body, path.call(print, "body")); // We want to keep dangling comments above the loop to stay consistent.
25991           // Any comment positioned between the for statement and the parentheses
25992           // is going to be printed before the statement.
25993
25994
25995           var _dangling = comments.printDanglingComments(path, options,
25996           /* sameLine */
25997           true);
25998
25999           var printedComments = _dangling ? concat$d([_dangling, softline$6]) : "";
26000
26001           if (!n.init && !n.test && !n.update) {
26002             return concat$d([printedComments, group$b(concat$d(["for (;;)", _body]))]);
26003           }
26004
26005           return concat$d([printedComments, group$b(concat$d(["for (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "init"), ";", line$7, path.call(print, "test"), ";", line$7, path.call(print, "update")])), softline$6])), ")", _body]))]);
26006         }
26007
26008       case "WhileStatement":
26009         return group$b(concat$d(["while (", group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", adjustClause(n.body, path.call(print, "body"))]));
26010
26011       case "ForInStatement":
26012         // Note: esprima can't actually parse "for each (".
26013         return group$b(concat$d([n.each ? "for each (" : "for (", path.call(print, "left"), " in ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
26014
26015       case "ForOfStatement":
26016       case "ForAwaitStatement":
26017         {
26018           // Babel 7 removed ForAwaitStatement in favor of ForOfStatement
26019           // with `"await": true`:
26020           // https://github.com/estree/estree/pull/138
26021           var isAwait = n.type === "ForAwaitStatement" || n.await;
26022           return group$b(concat$d(["for", isAwait ? " await" : "", " (", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(n.body, path.call(print, "body"))]));
26023         }
26024
26025       case "DoWhileStatement":
26026         {
26027           var clause = adjustClause(n.body, path.call(print, "body"));
26028           var doBody = group$b(concat$d(["do", clause]));
26029           parts = [doBody];
26030
26031           if (n.body.type === "BlockStatement") {
26032             parts.push(" ");
26033           } else {
26034             parts.push(hardline$9);
26035           }
26036
26037           parts.push("while (");
26038           parts.push(group$b(concat$d([indent$7(concat$d([softline$6, path.call(print, "test")])), softline$6])), ")", semi);
26039           return concat$d(parts);
26040         }
26041
26042       case "DoExpression":
26043         return concat$d(["do ", path.call(print, "body")]);
26044
26045       case "BreakStatement":
26046         parts.push("break");
26047
26048         if (n.label) {
26049           parts.push(" ", path.call(print, "label"));
26050         }
26051
26052         parts.push(semi);
26053         return concat$d(parts);
26054
26055       case "ContinueStatement":
26056         parts.push("continue");
26057
26058         if (n.label) {
26059           parts.push(" ", path.call(print, "label"));
26060         }
26061
26062         parts.push(semi);
26063         return concat$d(parts);
26064
26065       case "LabeledStatement":
26066         if (n.body.type === "EmptyStatement") {
26067           return concat$d([path.call(print, "label"), ":;"]);
26068         }
26069
26070         return concat$d([path.call(print, "label"), ": ", path.call(print, "body")]);
26071
26072       case "TryStatement":
26073         return concat$d(["try ", path.call(print, "block"), n.handler ? concat$d([" ", path.call(print, "handler")]) : "", n.finalizer ? concat$d([" finally ", path.call(print, "finalizer")]) : ""]);
26074
26075       case "CatchClause":
26076         if (n.param) {
26077           var hasComments = n.param.comments && n.param.comments.some(function (comment) {
26078             return !comments$1.isBlockComment(comment) || comment.leading && hasNewline$4(options.originalText, options.locEnd(comment)) || comment.trailing && hasNewline$4(options.originalText, options.locStart(comment), {
26079               backwards: true
26080             });
26081           });
26082           var param = path.call(print, "param");
26083           return concat$d(["catch ", hasComments ? concat$d(["(", indent$7(concat$d([softline$6, param])), softline$6, ") "]) : concat$d(["(", param, ") "]), path.call(print, "body")]);
26084         }
26085
26086         return concat$d(["catch ", path.call(print, "body")]);
26087
26088       case "ThrowStatement":
26089         return concat$d(["throw ", path.call(print, "argument"), semi]);
26090       // Note: ignoring n.lexical because it has no printing consequences.
26091
26092       case "SwitchStatement":
26093         return concat$d([group$b(concat$d(["switch (", indent$7(concat$d([softline$6, path.call(print, "discriminant")])), softline$6, ")"])), " {", n.cases.length > 0 ? indent$7(concat$d([hardline$9, join$9(hardline$9, path.map(function (casePath) {
26094           var caseNode = casePath.getValue();
26095           return concat$d([casePath.call(print), n.cases.indexOf(caseNode) !== n.cases.length - 1 && isNextLineEmpty$4(options.originalText, caseNode, options) ? hardline$9 : ""]);
26096         }, "cases"))])) : "", hardline$9, "}"]);
26097
26098       case "SwitchCase":
26099         {
26100           if (n.test) {
26101             parts.push("case ", path.call(print, "test"), ":");
26102           } else {
26103             parts.push("default:");
26104           }
26105
26106           var consequent = n.consequent.filter(function (node) {
26107             return node.type !== "EmptyStatement";
26108           });
26109
26110           if (consequent.length > 0) {
26111             var cons = path.call(function (consequentPath) {
26112               return printStatementSequence(consequentPath, options, print);
26113             }, "consequent");
26114             parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? concat$d([" ", cons]) : indent$7(concat$d([hardline$9, cons])));
26115           }
26116
26117           return concat$d(parts);
26118         }
26119       // JSX extensions below.
26120
26121       case "DebuggerStatement":
26122         return concat$d(["debugger", semi]);
26123
26124       case "JSXAttribute":
26125         parts.push(path.call(print, "name"));
26126
26127         if (n.value) {
26128           var res;
26129
26130           if (isStringLiteral$1(n.value)) {
26131             var raw = rawText$1(n.value); // Unescape all quotes so we get an accurate preferred quote
26132
26133             var final = raw.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
26134             var quote = getPreferredQuote$1(final, options.jsxSingleQuote ? "'" : '"');
26135
26136             var _escape = quote === "'" ? "&apos;" : "&quot;";
26137
26138             final = final.slice(1, -1).replace(new RegExp(quote, "g"), _escape);
26139             res = concat$d([quote, final, quote]);
26140           } else {
26141             res = path.call(print, "value");
26142           }
26143
26144           parts.push("=", res);
26145         }
26146
26147         return concat$d(parts);
26148
26149       case "JSXIdentifier":
26150         return "" + n.name;
26151
26152       case "JSXNamespacedName":
26153         return join$9(":", [path.call(print, "namespace"), path.call(print, "name")]);
26154
26155       case "JSXMemberExpression":
26156         return join$9(".", [path.call(print, "object"), path.call(print, "property")]);
26157
26158       case "TSQualifiedName":
26159         return join$9(".", [path.call(print, "left"), path.call(print, "right")]);
26160
26161       case "JSXSpreadAttribute":
26162       case "JSXSpreadChild":
26163         {
26164           return concat$d(["{", path.call(function (p) {
26165             var printed = concat$d(["...", print(p)]);
26166             var n = p.getValue();
26167
26168             if (!n.comments || !n.comments.length) {
26169               return printed;
26170             }
26171
26172             return concat$d([indent$7(concat$d([softline$6, comments.printComments(p, function () {
26173               return printed;
26174             }, options)])), softline$6]);
26175           }, n.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"]);
26176         }
26177
26178       case "JSXExpressionContainer":
26179         {
26180           var _parent7 = path.getParentNode(0);
26181
26182           var preventInline = _parent7.type === "JSXAttribute" && n.expression.comments && n.expression.comments.length > 0;
26183
26184           var _shouldInline = !preventInline && (n.expression.type === "ArrayExpression" || n.expression.type === "ObjectExpression" || n.expression.type === "ArrowFunctionExpression" || n.expression.type === "CallExpression" || n.expression.type === "OptionalCallExpression" || n.expression.type === "FunctionExpression" || n.expression.type === "JSXEmptyExpression" || n.expression.type === "TemplateLiteral" || n.expression.type === "TaggedTemplateExpression" || n.expression.type === "DoExpression" || isJSXNode$1(_parent7) && (n.expression.type === "ConditionalExpression" || isBinaryish$1(n.expression)));
26185
26186           if (_shouldInline) {
26187             return group$b(concat$d(["{", path.call(print, "expression"), lineSuffixBoundary$1, "}"]));
26188           }
26189
26190           return group$b(concat$d(["{", indent$7(concat$d([softline$6, path.call(print, "expression")])), softline$6, lineSuffixBoundary$1, "}"]));
26191         }
26192
26193       case "JSXFragment":
26194       case "JSXElement":
26195         {
26196           var elem = comments.printComments(path, function () {
26197             return printJSXElement(path, options, print);
26198           }, options);
26199           return maybeWrapJSXElementInParens(path, elem, options);
26200         }
26201
26202       case "JSXOpeningElement":
26203         {
26204           var _n = path.getValue();
26205
26206           var nameHasComments = _n.name && _n.name.comments && _n.name.comments.length > 0 || _n.typeParameters && _n.typeParameters.comments && _n.typeParameters.comments.length > 0; // Don't break self-closing elements with no attributes and no comments
26207
26208           if (_n.selfClosing && !_n.attributes.length && !nameHasComments) {
26209             return concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), " />"]);
26210           } // don't break up opening elements with a single long text attribute
26211
26212
26213           if (_n.attributes && _n.attributes.length === 1 && _n.attributes[0].value && isStringLiteral$1(_n.attributes[0].value) && !_n.attributes[0].value.value.includes("\n") && // We should break for the following cases:
26214           // <div
26215           //   // comment
26216           //   attr="value"
26217           // >
26218           // <div
26219           //   attr="value"
26220           //   // comment
26221           // >
26222           !nameHasComments && (!_n.attributes[0].comments || !_n.attributes[0].comments.length)) {
26223             return group$b(concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), " ", concat$d(path.map(print, "attributes")), _n.selfClosing ? " />" : ">"]));
26224           }
26225
26226           var lastAttrHasTrailingComments = _n.attributes.length && hasTrailingComment$1(getLast$2(_n.attributes));
26227           var bracketSameLine = // Simple tags (no attributes and no comment in tag name) should be
26228           // kept unbroken regardless of `jsxBracketSameLine`
26229           !_n.attributes.length && !nameHasComments || options.jsxBracketSameLine && ( // We should print the bracket in a new line for the following cases:
26230           // <div
26231           //   // comment
26232           // >
26233           // <div
26234           //   attr // comment
26235           // >
26236           !nameHasComments || _n.attributes.length) && !lastAttrHasTrailingComments; // We should print the opening element expanded if any prop value is a
26237           // string literal with newlines
26238
26239           var _shouldBreak2 = _n.attributes && _n.attributes.some(function (attr) {
26240             return attr.value && isStringLiteral$1(attr.value) && attr.value.value.includes("\n");
26241           });
26242
26243           return group$b(concat$d(["<", path.call(print, "name"), path.call(print, "typeParameters"), concat$d([indent$7(concat$d(path.map(function (attr) {
26244             return concat$d([line$7, print(attr)]);
26245           }, "attributes"))), _n.selfClosing ? line$7 : bracketSameLine ? ">" : softline$6]), _n.selfClosing ? "/>" : bracketSameLine ? "" : ">"]), {
26246             shouldBreak: _shouldBreak2
26247           });
26248         }
26249
26250       case "JSXClosingElement":
26251         return concat$d(["</", path.call(print, "name"), ">"]);
26252
26253       case "JSXOpeningFragment":
26254       case "JSXClosingFragment":
26255         {
26256           var hasComment = n.comments && n.comments.length;
26257           var hasOwnLineComment = hasComment && !n.comments.every(comments$1.isBlockComment);
26258           var isOpeningFragment = n.type === "JSXOpeningFragment";
26259           return concat$d([isOpeningFragment ? "<" : "</", indent$7(concat$d([hasOwnLineComment ? hardline$9 : hasComment && !isOpeningFragment ? " " : "", comments.printDanglingComments(path, options, true)])), hasOwnLineComment ? hardline$9 : "", ">"]);
26260         }
26261
26262       case "JSXText":
26263         /* istanbul ignore next */
26264         throw new Error("JSXTest should be handled by JSXElement");
26265
26266       case "JSXEmptyExpression":
26267         {
26268           var requiresHardline = n.comments && !n.comments.every(comments$1.isBlockComment);
26269           return concat$d([comments.printDanglingComments(path, options,
26270           /* sameIndent */
26271           !requiresHardline), requiresHardline ? hardline$9 : ""]);
26272         }
26273
26274       case "ClassBody":
26275         if (!n.comments && n.body.length === 0) {
26276           return "{}";
26277         }
26278
26279         return concat$d(["{", n.body.length > 0 ? indent$7(concat$d([hardline$9, path.call(function (bodyPath) {
26280           return printStatementSequence(bodyPath, options, print);
26281         }, "body")])) : comments.printDanglingComments(path, options), hardline$9, "}"]);
26282
26283       case "ClassProperty":
26284       case "TSAbstractClassProperty":
26285       case "ClassPrivateProperty":
26286         {
26287           if (n.decorators && n.decorators.length !== 0) {
26288             parts.push(printDecorators(path, options, print));
26289           }
26290
26291           if (n.accessibility) {
26292             parts.push(n.accessibility + " ");
26293           }
26294
26295           if (n.declare) {
26296             parts.push("declare ");
26297           }
26298
26299           if (n.static) {
26300             parts.push("static ");
26301           }
26302
26303           if (n.type === "TSAbstractClassProperty") {
26304             parts.push("abstract ");
26305           }
26306
26307           if (n.readonly) {
26308             parts.push("readonly ");
26309           }
26310
26311           var variance = getFlowVariance$1(n);
26312
26313           if (variance) {
26314             parts.push(variance);
26315           }
26316
26317           parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printTypeAnnotation(path, options, print));
26318
26319           if (n.value) {
26320             parts.push(" =", printAssignmentRight(n.key, n.value, path.call(print, "value"), options));
26321           }
26322
26323           parts.push(semi);
26324           return group$b(concat$d(parts));
26325         }
26326
26327       case "ClassDeclaration":
26328       case "ClassExpression":
26329         if (n.declare) {
26330           parts.push("declare ");
26331         }
26332
26333         parts.push(concat$d(printClass(path, options, print)));
26334         return concat$d(parts);
26335
26336       case "TSInterfaceHeritage":
26337         parts.push(path.call(print, "expression"));
26338
26339         if (n.typeParameters) {
26340           parts.push(path.call(print, "typeParameters"));
26341         }
26342
26343         return concat$d(parts);
26344
26345       case "TemplateElement":
26346         return join$9(literalline$4, n.value.raw.split(/\r?\n/g));
26347
26348       case "TemplateLiteral":
26349         {
26350           var expressions = path.map(print, "expressions");
26351
26352           var _parentNode = path.getParentNode();
26353
26354           if (isJestEachTemplateLiteral$1(n, _parentNode)) {
26355             var _printed2 = printJestEachTemplateLiteral(n, expressions, options);
26356
26357             if (_printed2) {
26358               return _printed2;
26359             }
26360           }
26361
26362           var isSimple = isSimpleTemplateLiteral$1(n);
26363
26364           if (isSimple) {
26365             expressions = expressions.map(function (doc) {
26366               return printDocToString$1(doc, Object.assign({}, options, {
26367                 printWidth: Infinity
26368               })).formatted;
26369             });
26370           }
26371
26372           parts.push(lineSuffixBoundary$1, "`");
26373           path.each(function (childPath) {
26374             var i = childPath.getName();
26375             parts.push(print(childPath));
26376
26377             if (i < expressions.length) {
26378               // For a template literal of the following form:
26379               //   `someQuery {
26380               //     ${call({
26381               //       a,
26382               //       b,
26383               //     })}
26384               //   }`
26385               // the expression is on its own line (there is a \n in the previous
26386               // quasi literal), therefore we want to indent the JavaScript
26387               // expression inside at the beginning of ${ instead of the beginning
26388               // of the `.
26389               var tabWidth = options.tabWidth;
26390               var quasi = childPath.getValue();
26391               var indentSize = getIndentSize$1(quasi.value.raw, tabWidth);
26392               var _printed3 = expressions[i];
26393
26394               if (!isSimple) {
26395                 // Breaks at the template element boundaries (${ and }) are preferred to breaking
26396                 // in the middle of a MemberExpression
26397                 if (n.expressions[i].comments && n.expressions[i].comments.length || n.expressions[i].type === "MemberExpression" || n.expressions[i].type === "OptionalMemberExpression" || n.expressions[i].type === "ConditionalExpression") {
26398                   _printed3 = concat$d([indent$7(concat$d([softline$6, _printed3])), softline$6]);
26399                 }
26400               }
26401
26402               var aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align$1(-Infinity, _printed3) : addAlignmentToDoc$2(_printed3, indentSize, tabWidth);
26403               parts.push(group$b(concat$d(["${", aligned, lineSuffixBoundary$1, "}"])));
26404             }
26405           }, "quasis");
26406           parts.push("`");
26407           return concat$d(parts);
26408         }
26409       // These types are unprintable because they serve as abstract
26410       // supertypes for other (printable) types.
26411
26412       case "TaggedTemplateExpression":
26413         return concat$d([path.call(print, "tag"), path.call(print, "typeParameters"), path.call(print, "quasi")]);
26414
26415       case "Node":
26416       case "Printable":
26417       case "SourceLocation":
26418       case "Position":
26419       case "Statement":
26420       case "Function":
26421       case "Pattern":
26422       case "Expression":
26423       case "Declaration":
26424       case "Specifier":
26425       case "NamedSpecifier":
26426       case "Comment":
26427       case "MemberTypeAnnotation": // Flow
26428
26429       case "Type":
26430         /* istanbul ignore next */
26431         throw new Error("unprintable type: " + JSON.stringify(n.type));
26432       // Type Annotations for Facebook Flow, typically stripped out or
26433       // transformed away before printing.
26434
26435       case "TypeAnnotation":
26436       case "TSTypeAnnotation":
26437         if (n.typeAnnotation) {
26438           return path.call(print, "typeAnnotation");
26439         }
26440         /* istanbul ignore next */
26441
26442
26443         return "";
26444
26445       case "TSTupleType":
26446       case "TupleTypeAnnotation":
26447         {
26448           var typesField = n.type === "TSTupleType" ? "elementTypes" : "types";
26449           return group$b(concat$d(["[", indent$7(concat$d([softline$6, printArrayItems(path, options, typesField, print)])), ifBreak$6(shouldPrintComma$1(options, "all") ? "," : ""), comments.printDanglingComments(path, options,
26450           /* sameIndent */
26451           true), softline$6, "]"]));
26452         }
26453
26454       case "ExistsTypeAnnotation":
26455         return "*";
26456
26457       case "EmptyTypeAnnotation":
26458         return "empty";
26459
26460       case "AnyTypeAnnotation":
26461         return "any";
26462
26463       case "MixedTypeAnnotation":
26464         return "mixed";
26465
26466       case "ArrayTypeAnnotation":
26467         return concat$d([path.call(print, "elementType"), "[]"]);
26468
26469       case "BooleanTypeAnnotation":
26470         return "boolean";
26471
26472       case "BooleanLiteralTypeAnnotation":
26473         return "" + n.value;
26474
26475       case "DeclareClass":
26476         return printFlowDeclaration(path, printClass(path, options, print));
26477
26478       case "TSDeclareFunction":
26479         // For TypeScript the TSDeclareFunction node shares the AST
26480         // structure with FunctionDeclaration
26481         return concat$d([n.declare ? "declare " : "", printFunctionDeclaration(path, print, options), semi]);
26482
26483       case "DeclareFunction":
26484         return printFlowDeclaration(path, ["function ", path.call(print, "id"), n.predicate ? " " : "", path.call(print, "predicate"), semi]);
26485
26486       case "DeclareModule":
26487         return printFlowDeclaration(path, ["module ", path.call(print, "id"), " ", path.call(print, "body")]);
26488
26489       case "DeclareModuleExports":
26490         return printFlowDeclaration(path, ["module.exports", ": ", path.call(print, "typeAnnotation"), semi]);
26491
26492       case "DeclareVariable":
26493         return printFlowDeclaration(path, ["var ", path.call(print, "id"), semi]);
26494
26495       case "DeclareExportAllDeclaration":
26496         return concat$d(["declare export * from ", path.call(print, "source")]);
26497
26498       case "DeclareExportDeclaration":
26499         return concat$d(["declare ", printExportDeclaration(path, options, print)]);
26500
26501       case "DeclareOpaqueType":
26502       case "OpaqueType":
26503         {
26504           parts.push("opaque type ", path.call(print, "id"), path.call(print, "typeParameters"));
26505
26506           if (n.supertype) {
26507             parts.push(": ", path.call(print, "supertype"));
26508           }
26509
26510           if (n.impltype) {
26511             parts.push(" = ", path.call(print, "impltype"));
26512           }
26513
26514           parts.push(semi);
26515
26516           if (n.type === "DeclareOpaqueType") {
26517             return printFlowDeclaration(path, parts);
26518           }
26519
26520           return concat$d(parts);
26521         }
26522
26523       case "EnumDeclaration":
26524         return concat$d(["enum ", path.call(print, "id"), " ", path.call(print, "body")]);
26525
26526       case "EnumBooleanBody":
26527       case "EnumNumberBody":
26528       case "EnumStringBody":
26529       case "EnumSymbolBody":
26530         {
26531           if (n.type === "EnumSymbolBody" || n.explicitType) {
26532             var type = null;
26533
26534             switch (n.type) {
26535               case "EnumBooleanBody":
26536                 type = "boolean";
26537                 break;
26538
26539               case "EnumNumberBody":
26540                 type = "number";
26541                 break;
26542
26543               case "EnumStringBody":
26544                 type = "string";
26545                 break;
26546
26547               case "EnumSymbolBody":
26548                 type = "symbol";
26549                 break;
26550             }
26551
26552             parts.push("of ", type, " ");
26553           }
26554
26555           if (n.members.length === 0) {
26556             parts.push(group$b(concat$d(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
26557           } else {
26558             parts.push(group$b(concat$d(["{", indent$7(concat$d([hardline$9, printArrayItems(path, options, "members", print), shouldPrintComma$1(options) ? "," : ""])), comments.printDanglingComments(path, options,
26559             /* sameIndent */
26560             true), hardline$9, "}"])));
26561           }
26562
26563           return concat$d(parts);
26564         }
26565
26566       case "EnumBooleanMember":
26567       case "EnumNumberMember":
26568       case "EnumStringMember":
26569         return concat$d([path.call(print, "id"), " = ", _typeof(n.init) === "object" ? path.call(print, "init") : String(n.init)]);
26570
26571       case "EnumDefaultedMember":
26572         return path.call(print, "id");
26573
26574       case "FunctionTypeAnnotation":
26575       case "TSFunctionType":
26576         {
26577           // FunctionTypeAnnotation is ambiguous:
26578           // declare function foo(a: B): void; OR
26579           // var A: (a: B) => void;
26580           var _parent8 = path.getParentNode(0);
26581
26582           var _parentParent2 = path.getParentNode(1);
26583
26584           var _parentParentParent = path.getParentNode(2);
26585
26586           var isArrowFunctionTypeAnnotation = n.type === "TSFunctionType" || !((_parent8.type === "ObjectTypeProperty" || _parent8.type === "ObjectTypeInternalSlot") && !getFlowVariance$1(_parent8) && !_parent8.optional && options.locStart(_parent8) === options.locStart(n) || _parent8.type === "ObjectTypeCallProperty" || _parentParentParent && _parentParentParent.type === "DeclareFunction");
26587           var needsColon = isArrowFunctionTypeAnnotation && (_parent8.type === "TypeAnnotation" || _parent8.type === "TSTypeAnnotation"); // Sadly we can't put it inside of FastPath::needsColon because we are
26588           // printing ":" as part of the expression and it would put parenthesis
26589           // around :(
26590
26591           var needsParens = needsColon && isArrowFunctionTypeAnnotation && (_parent8.type === "TypeAnnotation" || _parent8.type === "TSTypeAnnotation") && _parentParent2.type === "ArrowFunctionExpression";
26592
26593           if (isObjectTypePropertyAFunction$1(_parent8, options)) {
26594             isArrowFunctionTypeAnnotation = true;
26595             needsColon = true;
26596           }
26597
26598           if (needsParens) {
26599             parts.push("(");
26600           }
26601
26602           parts.push(printFunctionParams(path, print, options,
26603           /* expandArg */
26604           false,
26605           /* printTypeParams */
26606           true)); // The returnType is not wrapped in a TypeAnnotation, so the colon
26607           // needs to be added separately.
26608
26609           if (n.returnType || n.predicate || n.typeAnnotation) {
26610             parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path.call(print, "returnType"), path.call(print, "predicate"), path.call(print, "typeAnnotation"));
26611           }
26612
26613           if (needsParens) {
26614             parts.push(")");
26615           }
26616
26617           return group$b(concat$d(parts));
26618         }
26619
26620       case "TSRestType":
26621         return concat$d(["...", path.call(print, "typeAnnotation")]);
26622
26623       case "TSOptionalType":
26624         return concat$d([path.call(print, "typeAnnotation"), "?"]);
26625
26626       case "FunctionTypeParam":
26627         return concat$d([path.call(print, "name"), printOptionalToken(path), n.name ? ": " : "", path.call(print, "typeAnnotation")]);
26628
26629       case "GenericTypeAnnotation":
26630         return concat$d([path.call(print, "id"), path.call(print, "typeParameters")]);
26631
26632       case "DeclareInterface":
26633       case "InterfaceDeclaration":
26634       case "InterfaceTypeAnnotation":
26635         {
26636           if (n.type === "DeclareInterface" || n.declare) {
26637             parts.push("declare ");
26638           }
26639
26640           parts.push("interface");
26641
26642           if (n.type === "DeclareInterface" || n.type === "InterfaceDeclaration") {
26643             parts.push(" ", path.call(print, "id"), path.call(print, "typeParameters"));
26644           }
26645
26646           if (n["extends"].length > 0) {
26647             parts.push(group$b(indent$7(concat$d([line$7, "extends ", (n.extends.length === 1 ? identity$2 : indent$7)(join$9(concat$d([",", line$7]), path.map(print, "extends")))]))));
26648           }
26649
26650           parts.push(" ", path.call(print, "body"));
26651           return group$b(concat$d(parts));
26652         }
26653
26654       case "ClassImplements":
26655       case "InterfaceExtends":
26656         return concat$d([path.call(print, "id"), path.call(print, "typeParameters")]);
26657
26658       case "TSClassImplements":
26659         return concat$d([path.call(print, "expression"), path.call(print, "typeParameters")]);
26660
26661       case "TSIntersectionType":
26662       case "IntersectionTypeAnnotation":
26663         {
26664           var types = path.map(print, "types");
26665           var result = [];
26666           var wasIndented = false;
26667
26668           for (var _i = 0; _i < types.length; ++_i) {
26669             if (_i === 0) {
26670               result.push(types[_i]);
26671             } else if (isObjectType$1(n.types[_i - 1]) && isObjectType$1(n.types[_i])) {
26672               // If both are objects, don't indent
26673               result.push(concat$d([" & ", wasIndented ? indent$7(types[_i]) : types[_i]]));
26674             } else if (!isObjectType$1(n.types[_i - 1]) && !isObjectType$1(n.types[_i])) {
26675               // If no object is involved, go to the next line if it breaks
26676               result.push(indent$7(concat$d([" &", line$7, types[_i]])));
26677             } else {
26678               // If you go from object to non-object or vis-versa, then inline it
26679               if (_i > 1) {
26680                 wasIndented = true;
26681               }
26682
26683               result.push(" & ", _i > 1 ? indent$7(types[_i]) : types[_i]);
26684             }
26685           }
26686
26687           return group$b(concat$d(result));
26688         }
26689
26690       case "TSUnionType":
26691       case "UnionTypeAnnotation":
26692         {
26693           // single-line variation
26694           // A | B | C
26695           // multi-line variation
26696           // | A
26697           // | B
26698           // | C
26699           var _parent9 = path.getParentNode(); // If there's a leading comment, the parent is doing the indentation
26700
26701
26702           var shouldIndent = _parent9.type !== "TypeParameterInstantiation" && _parent9.type !== "TSTypeParameterInstantiation" && _parent9.type !== "GenericTypeAnnotation" && _parent9.type !== "TSTypeReference" && _parent9.type !== "TSTypeAssertion" && _parent9.type !== "TupleTypeAnnotation" && _parent9.type !== "TSTupleType" && !(_parent9.type === "FunctionTypeParam" && !_parent9.name) && !((_parent9.type === "TypeAlias" || _parent9.type === "VariableDeclarator" || _parent9.type === "TSTypeAliasDeclaration") && hasLeadingOwnLineComment$1(options.originalText, n, options)); // {
26703           //   a: string
26704           // } | null | void
26705           // should be inlined and not be printed in the multi-line variant
26706
26707           var shouldHug = shouldHugType(n); // We want to align the children but without its comment, so it looks like
26708           // | child1
26709           // // comment
26710           // | child2
26711
26712           var _printed4 = path.map(function (typePath) {
26713             var printedType = typePath.call(print);
26714
26715             if (!shouldHug) {
26716               printedType = align$1(2, printedType);
26717             }
26718
26719             return comments.printComments(typePath, function () {
26720               return printedType;
26721             }, options);
26722           }, "types");
26723
26724           if (shouldHug) {
26725             return join$9(" | ", _printed4);
26726           }
26727
26728           var shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment$1(options.originalText, n, options);
26729           var code = concat$d([ifBreak$6(concat$d([shouldAddStartLine ? line$7 : "", "| "])), join$9(concat$d([line$7, "| "]), _printed4)]);
26730
26731           if (needsParens_1(path, options)) {
26732             return group$b(concat$d([indent$7(code), softline$6]));
26733           }
26734
26735           if (_parent9.type === "TupleTypeAnnotation" && _parent9.types.length > 1 || _parent9.type === "TSTupleType" && _parent9.elementTypes.length > 1) {
26736             return group$b(concat$d([indent$7(concat$d([ifBreak$6(concat$d(["(", softline$6])), code])), softline$6, ifBreak$6(")")]));
26737           }
26738
26739           return group$b(shouldIndent ? indent$7(code) : code);
26740         }
26741
26742       case "NullableTypeAnnotation":
26743         return concat$d(["?", path.call(print, "typeAnnotation")]);
26744
26745       case "TSNullKeyword":
26746       case "NullLiteralTypeAnnotation":
26747         return "null";
26748
26749       case "ThisTypeAnnotation":
26750         return "this";
26751
26752       case "NumberTypeAnnotation":
26753         return "number";
26754
26755       case "ObjectTypeCallProperty":
26756         if (n.static) {
26757           parts.push("static ");
26758         }
26759
26760         parts.push(path.call(print, "value"));
26761         return concat$d(parts);
26762
26763       case "ObjectTypeIndexer":
26764         {
26765           var _variance = getFlowVariance$1(n);
26766
26767           return concat$d([_variance || "", "[", path.call(print, "id"), n.id ? ": " : "", path.call(print, "key"), "]: ", path.call(print, "value")]);
26768         }
26769
26770       case "ObjectTypeProperty":
26771         {
26772           var _variance2 = getFlowVariance$1(n);
26773
26774           var modifier = "";
26775
26776           if (n.proto) {
26777             modifier = "proto ";
26778           } else if (n.static) {
26779             modifier = "static ";
26780           }
26781
26782           return concat$d([modifier, isGetterOrSetter$1(n) ? n.kind + " " : "", _variance2 || "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation$1(n, options) ? "" : ": ", path.call(print, "value")]);
26783         }
26784
26785       case "QualifiedTypeIdentifier":
26786         return concat$d([path.call(print, "qualification"), ".", path.call(print, "id")]);
26787
26788       case "StringLiteralTypeAnnotation":
26789         return nodeStr(n, options);
26790
26791       case "NumberLiteralTypeAnnotation":
26792         assert.strictEqual(_typeof(n.value), "number");
26793
26794         if (n.extra != null) {
26795           return printNumber$2(n.extra.raw);
26796         }
26797
26798         return printNumber$2(n.raw);
26799
26800       case "StringTypeAnnotation":
26801         return "string";
26802
26803       case "DeclareTypeAlias":
26804       case "TypeAlias":
26805         {
26806           if (n.type === "DeclareTypeAlias" || n.declare) {
26807             parts.push("declare ");
26808           }
26809
26810           var _printed5 = printAssignmentRight(n.id, n.right, path.call(print, "right"), options);
26811
26812           parts.push("type ", path.call(print, "id"), path.call(print, "typeParameters"), " =", _printed5, semi);
26813           return group$b(concat$d(parts));
26814         }
26815
26816       case "TypeCastExpression":
26817         {
26818           var value = path.getValue(); // Flow supports a comment syntax for specifying type annotations: https://flow.org/en/docs/types/comments/.
26819           // Unfortunately, its parser doesn't differentiate between comment annotations and regular
26820           // annotations when producing an AST. So to preserve parentheses around type casts that use
26821           // the comment syntax, we need to hackily read the source itself to see if the code contains
26822           // a type annotation comment.
26823           //
26824           // Note that we're able to use the normal whitespace regex here because the Flow parser has
26825           // already deemed this AST node to be a type cast. Only the Babel parser needs the
26826           // non-line-break whitespace regex, which is why hasFlowShorthandAnnotationComment() is
26827           // implemented differently.
26828
26829           var commentSyntax = value && value.typeAnnotation && value.typeAnnotation.range && options.originalText.substring(value.typeAnnotation.range[0]).match(/^\/\*\s*:/);
26830           return concat$d(["(", path.call(print, "expression"), commentSyntax ? " /*" : "", ": ", path.call(print, "typeAnnotation"), commentSyntax ? " */" : "", ")"]);
26831         }
26832
26833       case "TypeParameterDeclaration":
26834       case "TypeParameterInstantiation":
26835         {
26836           var _value = path.getValue();
26837
26838           var commentStart = _value.range ? options.originalText.substring(0, _value.range[0]).lastIndexOf("/*") : -1; // As noted in the TypeCastExpression comments above, we're able to use a normal whitespace regex here
26839           // because we know for sure that this is a type definition.
26840
26841           var _commentSyntax = commentStart >= 0 && options.originalText.substring(commentStart).match(/^\/\*\s*::/);
26842
26843           if (_commentSyntax) {
26844             return concat$d(["/*:: ", printTypeParameters(path, options, print, "params"), " */"]);
26845           }
26846
26847           return printTypeParameters(path, options, print, "params");
26848         }
26849
26850       case "TSTypeParameterDeclaration":
26851       case "TSTypeParameterInstantiation":
26852         return printTypeParameters(path, options, print, "params");
26853
26854       case "TSTypeParameter":
26855       case "TypeParameter":
26856         {
26857           var _parent10 = path.getParentNode();
26858
26859           if (_parent10.type === "TSMappedType") {
26860             parts.push("[", path.call(print, "name"));
26861
26862             if (n.constraint) {
26863               parts.push(" in ", path.call(print, "constraint"));
26864             }
26865
26866             parts.push("]");
26867             return concat$d(parts);
26868           }
26869
26870           var _variance3 = getFlowVariance$1(n);
26871
26872           if (_variance3) {
26873             parts.push(_variance3);
26874           }
26875
26876           parts.push(path.call(print, "name"));
26877
26878           if (n.bound) {
26879             parts.push(": ");
26880             parts.push(path.call(print, "bound"));
26881           }
26882
26883           if (n.constraint) {
26884             parts.push(" extends ", path.call(print, "constraint"));
26885           }
26886
26887           if (n["default"]) {
26888             parts.push(" = ", path.call(print, "default"));
26889           } // Keep comma if the file extension is .tsx and
26890           // has one type parameter that isn't extend with any types.
26891           // Because, otherwise formatted result will be invalid as tsx.
26892
26893
26894           var _grandParent = path.getNode(2);
26895
26896           if (_parent10.params && _parent10.params.length === 1 && isTSXFile$1(options) && !n.constraint && _grandParent.type === "ArrowFunctionExpression") {
26897             parts.push(",");
26898           }
26899
26900           return concat$d(parts);
26901         }
26902
26903       case "TypeofTypeAnnotation":
26904         return concat$d(["typeof ", path.call(print, "argument")]);
26905
26906       case "VoidTypeAnnotation":
26907         return "void";
26908
26909       case "InferredPredicate":
26910         return "%checks";
26911       // Unhandled types below. If encountered, nodes of these types should
26912       // be either left alone or desugared into AST types that are fully
26913       // supported by the pretty-printer.
26914
26915       case "DeclaredPredicate":
26916         return concat$d(["%checks(", path.call(print, "value"), ")"]);
26917
26918       case "TSAbstractKeyword":
26919         return "abstract";
26920
26921       case "TSAnyKeyword":
26922         return "any";
26923
26924       case "TSAsyncKeyword":
26925         return "async";
26926
26927       case "TSBooleanKeyword":
26928         return "boolean";
26929
26930       case "TSBigIntKeyword":
26931         return "bigint";
26932
26933       case "TSConstKeyword":
26934         return "const";
26935
26936       case "TSDeclareKeyword":
26937         return "declare";
26938
26939       case "TSExportKeyword":
26940         return "export";
26941
26942       case "TSNeverKeyword":
26943         return "never";
26944
26945       case "TSNumberKeyword":
26946         return "number";
26947
26948       case "TSObjectKeyword":
26949         return "object";
26950
26951       case "TSProtectedKeyword":
26952         return "protected";
26953
26954       case "TSPrivateKeyword":
26955         return "private";
26956
26957       case "TSPublicKeyword":
26958         return "public";
26959
26960       case "TSReadonlyKeyword":
26961         return "readonly";
26962
26963       case "TSSymbolKeyword":
26964         return "symbol";
26965
26966       case "TSStaticKeyword":
26967         return "static";
26968
26969       case "TSStringKeyword":
26970         return "string";
26971
26972       case "TSUndefinedKeyword":
26973         return "undefined";
26974
26975       case "TSUnknownKeyword":
26976         return "unknown";
26977
26978       case "TSVoidKeyword":
26979         return "void";
26980
26981       case "TSAsExpression":
26982         return concat$d([path.call(print, "expression"), " as ", path.call(print, "typeAnnotation")]);
26983
26984       case "TSArrayType":
26985         return concat$d([path.call(print, "elementType"), "[]"]);
26986
26987       case "TSPropertySignature":
26988         {
26989           if (n.export) {
26990             parts.push("export ");
26991           }
26992
26993           if (n.accessibility) {
26994             parts.push(n.accessibility + " ");
26995           }
26996
26997           if (n.static) {
26998             parts.push("static ");
26999           }
27000
27001           if (n.readonly) {
27002             parts.push("readonly ");
27003           }
27004
27005           parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
27006
27007           if (n.typeAnnotation) {
27008             parts.push(": ");
27009             parts.push(path.call(print, "typeAnnotation"));
27010           } // This isn't valid semantically, but it's in the AST so we can print it.
27011
27012
27013           if (n.initializer) {
27014             parts.push(" = ", path.call(print, "initializer"));
27015           }
27016
27017           return concat$d(parts);
27018         }
27019
27020       case "TSParameterProperty":
27021         if (n.accessibility) {
27022           parts.push(n.accessibility + " ");
27023         }
27024
27025         if (n.export) {
27026           parts.push("export ");
27027         }
27028
27029         if (n.static) {
27030           parts.push("static ");
27031         }
27032
27033         if (n.readonly) {
27034           parts.push("readonly ");
27035         }
27036
27037         parts.push(path.call(print, "parameter"));
27038         return concat$d(parts);
27039
27040       case "TSTypeReference":
27041         return concat$d([path.call(print, "typeName"), printTypeParameters(path, options, print, "typeParameters")]);
27042
27043       case "TSTypeQuery":
27044         return concat$d(["typeof ", path.call(print, "exprName")]);
27045
27046       case "TSIndexSignature":
27047         {
27048           var _parent11 = path.getParentNode();
27049
27050           return concat$d([n.export ? "export " : "", n.accessibility ? concat$d([n.accessibility, " "]) : "", n.static ? "static " : "", n.readonly ? "readonly " : "", "[", n.parameters ? concat$d(path.map(print, "parameters")) : "", "]: ", path.call(print, "typeAnnotation"), _parent11.type === "ClassBody" ? semi : ""]);
27051         }
27052
27053       case "TSTypePredicate":
27054         return concat$d([n.asserts ? "asserts " : "", path.call(print, "parameterName"), n.typeAnnotation ? concat$d([" is ", path.call(print, "typeAnnotation")]) : ""]);
27055
27056       case "TSNonNullExpression":
27057         return concat$d([path.call(print, "expression"), "!"]);
27058
27059       case "TSThisType":
27060         return "this";
27061
27062       case "TSImportType":
27063         return concat$d([!n.isTypeOf ? "" : "typeof ", "import(", path.call(print, "parameter"), ")", !n.qualifier ? "" : concat$d([".", path.call(print, "qualifier")]), printTypeParameters(path, options, print, "typeParameters")]);
27064
27065       case "TSLiteralType":
27066         return path.call(print, "literal");
27067
27068       case "TSIndexedAccessType":
27069         return concat$d([path.call(print, "objectType"), "[", path.call(print, "indexType"), "]"]);
27070
27071       case "TSConstructSignatureDeclaration":
27072       case "TSCallSignatureDeclaration":
27073       case "TSConstructorType":
27074         {
27075           if (n.type !== "TSCallSignatureDeclaration") {
27076             parts.push("new ");
27077           }
27078
27079           parts.push(group$b(printFunctionParams(path, print, options,
27080           /* expandArg */
27081           false,
27082           /* printTypeParams */
27083           true)));
27084
27085           if (n.returnType) {
27086             var isType = n.type === "TSConstructorType";
27087             parts.push(isType ? " => " : ": ", path.call(print, "returnType"));
27088           }
27089
27090           return concat$d(parts);
27091         }
27092
27093       case "TSTypeOperator":
27094         return concat$d([n.operator, " ", path.call(print, "typeAnnotation")]);
27095
27096       case "TSMappedType":
27097         {
27098           var _shouldBreak3 = hasNewlineInRange$2(options.originalText, options.locStart(n), options.locEnd(n));
27099
27100           return group$b(concat$d(["{", indent$7(concat$d([options.bracketSpacing ? line$7 : softline$6, n.readonly ? concat$d([getTypeScriptMappedTypeModifier$1(n.readonly, "readonly"), " "]) : "", printTypeScriptModifiers(path, options, print), path.call(print, "typeParameter"), n.optional ? getTypeScriptMappedTypeModifier$1(n.optional, "?") : "", ": ", path.call(print, "typeAnnotation"), ifBreak$6(semi, "")])), comments.printDanglingComments(path, options,
27101           /* sameIndent */
27102           true), options.bracketSpacing ? line$7 : softline$6, "}"]), {
27103             shouldBreak: _shouldBreak3
27104           });
27105         }
27106
27107       case "TSMethodSignature":
27108         parts.push(n.accessibility ? concat$d([n.accessibility, " "]) : "", n.export ? "export " : "", n.static ? "static " : "", n.readonly ? "readonly " : "", n.computed ? "[" : "", path.call(print, "key"), n.computed ? "]" : "", printOptionalToken(path), printFunctionParams(path, print, options,
27109         /* expandArg */
27110         false,
27111         /* printTypeParams */
27112         true));
27113
27114         if (n.returnType) {
27115           parts.push(": ", path.call(print, "returnType"));
27116         }
27117
27118         return group$b(concat$d(parts));
27119
27120       case "TSNamespaceExportDeclaration":
27121         parts.push("export as namespace ", path.call(print, "id"));
27122
27123         if (options.semi) {
27124           parts.push(";");
27125         }
27126
27127         return group$b(concat$d(parts));
27128
27129       case "TSEnumDeclaration":
27130         if (n.declare) {
27131           parts.push("declare ");
27132         }
27133
27134         if (n.modifiers) {
27135           parts.push(printTypeScriptModifiers(path, options, print));
27136         }
27137
27138         if (n.const) {
27139           parts.push("const ");
27140         }
27141
27142         parts.push("enum ", path.call(print, "id"), " ");
27143
27144         if (n.members.length === 0) {
27145           parts.push(group$b(concat$d(["{", comments.printDanglingComments(path, options), softline$6, "}"])));
27146         } else {
27147           parts.push(group$b(concat$d(["{", indent$7(concat$d([hardline$9, printArrayItems(path, options, "members", print), shouldPrintComma$1(options, "es5") ? "," : ""])), comments.printDanglingComments(path, options,
27148           /* sameIndent */
27149           true), hardline$9, "}"])));
27150         }
27151
27152         return concat$d(parts);
27153
27154       case "TSEnumMember":
27155         parts.push(path.call(print, "id"));
27156
27157         if (n.initializer) {
27158           parts.push(" = ", path.call(print, "initializer"));
27159         }
27160
27161         return concat$d(parts);
27162
27163       case "TSImportEqualsDeclaration":
27164         if (n.isExport) {
27165           parts.push("export ");
27166         }
27167
27168         parts.push("import ", path.call(print, "id"), " = ", path.call(print, "moduleReference"));
27169
27170         if (options.semi) {
27171           parts.push(";");
27172         }
27173
27174         return group$b(concat$d(parts));
27175
27176       case "TSExternalModuleReference":
27177         return concat$d(["require(", path.call(print, "expression"), ")"]);
27178
27179       case "TSModuleDeclaration":
27180         {
27181           var _parent12 = path.getParentNode();
27182
27183           var isExternalModule = isLiteral$1(n.id);
27184           var parentIsDeclaration = _parent12.type === "TSModuleDeclaration";
27185           var bodyIsDeclaration = n.body && n.body.type === "TSModuleDeclaration";
27186
27187           if (parentIsDeclaration) {
27188             parts.push(".");
27189           } else {
27190             if (n.declare) {
27191               parts.push("declare ");
27192             }
27193
27194             parts.push(printTypeScriptModifiers(path, options, print));
27195             var textBetweenNodeAndItsId = options.originalText.slice(options.locStart(n), options.locStart(n.id)); // Global declaration looks like this:
27196             // (declare)? global { ... }
27197
27198             var isGlobalDeclaration = n.id.type === "Identifier" && n.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
27199
27200             if (!isGlobalDeclaration) {
27201               parts.push(isExternalModule || /(^|\s)module(\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
27202             }
27203           }
27204
27205           parts.push(path.call(print, "id"));
27206
27207           if (bodyIsDeclaration) {
27208             parts.push(path.call(print, "body"));
27209           } else if (n.body) {
27210             parts.push(" ", group$b(path.call(print, "body")));
27211           } else {
27212             parts.push(semi);
27213           }
27214
27215           return concat$d(parts);
27216         }
27217
27218       case "PrivateName":
27219         return concat$d(["#", path.call(print, "id")]);
27220
27221       case "TSConditionalType":
27222         return printTernaryOperator(path, options, print, {
27223           beforeParts: function beforeParts() {
27224             return [path.call(print, "checkType"), " ", "extends", " ", path.call(print, "extendsType")];
27225           },
27226           afterParts: function afterParts() {
27227             return [];
27228           },
27229           shouldCheckJsx: false,
27230           conditionalNodeType: "TSConditionalType",
27231           consequentNodePropertyName: "trueType",
27232           alternateNodePropertyName: "falseType",
27233           testNodePropertyName: "checkType",
27234           breakNested: true
27235         });
27236
27237       case "TSInferType":
27238         return concat$d(["infer", " ", path.call(print, "typeParameter")]);
27239
27240       case "InterpreterDirective":
27241         parts.push("#!", n.value, hardline$9);
27242
27243         if (isNextLineEmpty$4(options.originalText, n, options)) {
27244           parts.push(hardline$9);
27245         }
27246
27247         return concat$d(parts);
27248
27249       case "NGRoot":
27250         return concat$d([].concat(path.call(print, "node"), !n.node.comments || n.node.comments.length === 0 ? [] : concat$d([" //", n.node.comments[0].value.trimRight()])));
27251
27252       case "NGChainedExpression":
27253         return group$b(join$9(concat$d([";", line$7]), path.map(function (childPath) {
27254           return hasNgSideEffect$1(childPath) ? print(childPath) : concat$d(["(", print(childPath), ")"]);
27255         }, "expressions")));
27256
27257       case "NGEmptyExpression":
27258         return "";
27259
27260       case "NGQuotedExpression":
27261         return concat$d([n.prefix, ":", n.value]);
27262
27263       case "NGMicrosyntax":
27264         return concat$d(path.map(function (childPath, index) {
27265           return concat$d([index === 0 ? "" : isNgForOf$1(childPath.getValue(), index, n) ? " " : concat$d([";", line$7]), print(childPath)]);
27266         }, "body"));
27267
27268       case "NGMicrosyntaxKey":
27269         return /^[a-z_$][a-z0-9_$]*(-[a-z_$][a-z0-9_$])*$/i.test(n.name) ? n.name : JSON.stringify(n.name);
27270
27271       case "NGMicrosyntaxExpression":
27272         return concat$d([path.call(print, "expression"), n.alias === null ? "" : concat$d([" as ", path.call(print, "alias")])]);
27273
27274       case "NGMicrosyntaxKeyedExpression":
27275         {
27276           var index = path.getName();
27277
27278           var _parentNode2 = path.getParentNode();
27279
27280           var shouldNotPrintColon = isNgForOf$1(n, index, _parentNode2) || (index === 1 && (n.key.name === "then" || n.key.name === "else") || index === 2 && n.key.name === "else" && _parentNode2.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && _parentNode2.body[index - 1].key.name === "then") && _parentNode2.body[0].type === "NGMicrosyntaxExpression";
27281           return concat$d([path.call(print, "key"), shouldNotPrintColon ? " " : ": ", path.call(print, "expression")]);
27282         }
27283
27284       case "NGMicrosyntaxLet":
27285         return concat$d(["let ", path.call(print, "key"), n.value === null ? "" : concat$d([" = ", path.call(print, "value")])]);
27286
27287       case "NGMicrosyntaxAs":
27288         return concat$d([path.call(print, "key"), " as ", path.call(print, "alias")]);
27289
27290       case "ArgumentPlaceholder":
27291         return "?";
27292
27293       default:
27294         /* istanbul ignore next */
27295         throw new Error("unknown type: " + JSON.stringify(n.type));
27296     }
27297   }
27298
27299   function printStatementSequence(path, options, print) {
27300     var printed = [];
27301     var bodyNode = path.getNode();
27302     var isClass = bodyNode.type === "ClassBody";
27303     path.map(function (stmtPath, i) {
27304       var stmt = stmtPath.getValue(); // Just in case the AST has been modified to contain falsy
27305       // "statements," it's safer simply to skip them.
27306
27307       /* istanbul ignore if */
27308
27309       if (!stmt) {
27310         return;
27311       } // Skip printing EmptyStatement nodes to avoid leaving stray
27312       // semicolons lying around.
27313
27314
27315       if (stmt.type === "EmptyStatement") {
27316         return;
27317       }
27318
27319       var stmtPrinted = print(stmtPath);
27320       var text = options.originalText;
27321       var parts = []; // in no-semi mode, prepend statement with semicolon if it might break ASI
27322       // don't prepend the only JSX element in a program with semicolon
27323
27324       if (!options.semi && !isClass && !isTheOnlyJSXElementInMarkdown$1(options, stmtPath) && stmtNeedsASIProtection(stmtPath, options)) {
27325         if (stmt.comments && stmt.comments.some(function (comment) {
27326           return comment.leading;
27327         })) {
27328           parts.push(print(stmtPath, {
27329             needsSemi: true
27330           }));
27331         } else {
27332           parts.push(";", stmtPrinted);
27333         }
27334       } else {
27335         parts.push(stmtPrinted);
27336       }
27337
27338       if (!options.semi && isClass) {
27339         if (classPropMayCauseASIProblems$1(stmtPath)) {
27340           parts.push(";");
27341         } else if (stmt.type === "ClassProperty") {
27342           var nextChild = bodyNode.body[i + 1];
27343
27344           if (classChildNeedsASIProtection$1(nextChild)) {
27345             parts.push(";");
27346           }
27347         }
27348       }
27349
27350       if (isNextLineEmpty$4(text, stmt, options) && !isLastStatement$1(stmtPath)) {
27351         parts.push(hardline$9);
27352       }
27353
27354       printed.push(concat$d(parts));
27355     });
27356     return join$9(hardline$9, printed);
27357   }
27358
27359   function printPropertyKey(path, options, print) {
27360     var node = path.getNode();
27361
27362     if (node.computed) {
27363       return concat$d(["[", path.call(print, "key"), "]"]);
27364     }
27365
27366     var parent = path.getParentNode();
27367     var key = node.key;
27368
27369     if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
27370       var objectHasStringProp = (parent.properties || parent.body || parent.members).some(function (prop) {
27371         return !prop.computed && prop.key && isStringLiteral$1(prop.key) && !isStringPropSafeToCoerceToIdentifier$1(prop, options);
27372       });
27373       needsQuoteProps.set(parent, objectHasStringProp);
27374     }
27375
27376     if (key.type === "Identifier" && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
27377       // a -> "a"
27378       var prop = printString$2(JSON.stringify(key.name), options);
27379       return path.call(function (keyPath) {
27380         return comments.printComments(keyPath, function () {
27381           return prop;
27382         }, options);
27383       }, "key");
27384     }
27385
27386     if (isStringPropSafeToCoerceToIdentifier$1(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
27387       // 'a' -> a
27388       return path.call(function (keyPath) {
27389         return comments.printComments(keyPath, function () {
27390           return key.value;
27391         }, options);
27392       }, "key");
27393     }
27394
27395     return path.call(print, "key");
27396   }
27397
27398   function printMethod(path, options, print) {
27399     var node = path.getNode();
27400     var kind = node.kind;
27401     var value = node.value || node;
27402     var parts = [];
27403
27404     if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
27405       if (value.async) {
27406         parts.push("async ");
27407       }
27408
27409       if (value.generator) {
27410         parts.push("*");
27411       }
27412     } else {
27413       assert.ok(kind === "get" || kind === "set");
27414       parts.push(kind, " ");
27415     }
27416
27417     parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "", node === value ? printMethodInternal(path, options, print) : path.call(function (path) {
27418       return printMethodInternal(path, options, print);
27419     }, "value"));
27420     return concat$d(parts);
27421   }
27422
27423   function printMethodInternal(path, options, print) {
27424     var parts = [printFunctionTypeParameters(path, options, print), group$b(concat$d([printFunctionParams(path, print, options), printReturnType(path, print, options)]))];
27425
27426     if (path.getNode().body) {
27427       parts.push(" ", path.call(print, "body"));
27428     } else {
27429       parts.push(options.semi ? ";" : "");
27430     }
27431
27432     return concat$d(parts);
27433   }
27434
27435   function couldGroupArg(arg) {
27436     return arg.type === "ObjectExpression" && (arg.properties.length > 0 || arg.comments) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || arg.comments) || 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
27437     // https://github.com/prettier/prettier/issues/4070
27438     // export class Thing implements OtherThing {
27439     //   do: (type: Type) => Provider<Prop> = memoize(
27440     //     (type: ObjectType): Provider<Opts> => {}
27441     //   );
27442     // }
27443     // https://github.com/prettier/prettier/issues/6099
27444     // app.get("/", (req, res): void => {
27445     //   res.send("Hello World!");
27446     // });
27447     !arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference") && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || arg.body.type === "CallExpression" || arg.body.type === "OptionalCallExpression" || arg.body.type === "ConditionalExpression" || isJSXNode$1(arg.body));
27448   }
27449
27450   function shouldGroupLastArg(args) {
27451     var lastArg = getLast$2(args);
27452     var penultimateArg = getPenultimate$1(args);
27453     return !hasLeadingComment$3(lastArg) && !hasTrailingComment$1(lastArg) && couldGroupArg(lastArg) && ( // If the last two arguments are of the same type,
27454     // disable last element expansion.
27455     !penultimateArg || penultimateArg.type !== lastArg.type);
27456   }
27457
27458   function shouldGroupFirstArg(args) {
27459     if (args.length !== 2) {
27460       return false;
27461     }
27462
27463     var firstArg = args[0];
27464     var secondArg = args[1];
27465     return (!firstArg.comments || !firstArg.comments.length) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
27466   }
27467
27468   function printJestEachTemplateLiteral(node, expressions, options) {
27469     /**
27470      * a    | b    | expected
27471      * ${1} | ${1} | ${2}
27472      * ${1} | ${2} | ${3}
27473      * ${2} | ${1} | ${3}
27474      */
27475     var headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
27476
27477     if (headerNames.length > 1 || headerNames.some(function (headerName) {
27478       return headerName.length !== 0;
27479     })) {
27480       var parts = [];
27481       var stringifiedExpressions = expressions.map(function (doc) {
27482         return "${" + printDocToString$1(doc, Object.assign({}, options, {
27483           printWidth: Infinity,
27484           endOfLine: "lf"
27485         })).formatted + "}";
27486       });
27487       var tableBody = [{
27488         hasLineBreak: false,
27489         cells: []
27490       }];
27491
27492       for (var i = 1; i < node.quasis.length; i++) {
27493         var row = tableBody[tableBody.length - 1];
27494         var correspondingExpression = stringifiedExpressions[i - 1];
27495         row.cells.push(correspondingExpression);
27496
27497         if (correspondingExpression.indexOf("\n") !== -1) {
27498           row.hasLineBreak = true;
27499         }
27500
27501         if (node.quasis[i].value.raw.indexOf("\n") !== -1) {
27502           tableBody.push({
27503             hasLineBreak: false,
27504             cells: []
27505           });
27506         }
27507       }
27508
27509       var maxColumnCount = tableBody.reduce(function (maxColumnCount, row) {
27510         return Math.max(maxColumnCount, row.cells.length);
27511       }, headerNames.length);
27512       var maxColumnWidths = Array.from(new Array(maxColumnCount), function () {
27513         return 0;
27514       });
27515       var table = [{
27516         cells: headerNames
27517       }].concat(tableBody.filter(function (row) {
27518         return row.cells.length !== 0;
27519       }));
27520       table.filter(function (row) {
27521         return !row.hasLineBreak;
27522       }).forEach(function (row) {
27523         row.cells.forEach(function (cell, index) {
27524           maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth$2(cell));
27525         });
27526       });
27527       parts.push(lineSuffixBoundary$1, "`", indent$7(concat$d([hardline$9, join$9(hardline$9, table.map(function (row) {
27528         return join$9(" | ", row.cells.map(function (cell, index) {
27529           return row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth$2(cell));
27530         }));
27531       }))])), hardline$9, "`");
27532       return concat$d(parts);
27533     }
27534   }
27535
27536   function printArgumentsList(path, options, print) {
27537     var node = path.getValue();
27538     var args = node.arguments;
27539
27540     if (args.length === 0) {
27541       return concat$d(["(", comments.printDanglingComments(path, options,
27542       /* sameIndent */
27543       true), ")"]);
27544     } // useEffect(() => { ... }, [foo, bar, baz])
27545
27546
27547     if (args.length === 2 && args[0].type === "ArrowFunctionExpression" && args[0].params.length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.find(function (arg) {
27548       return arg.comments;
27549     })) {
27550       return concat$d(["(", path.call(print, "arguments", 0), ", ", path.call(print, "arguments", 1), ")"]);
27551     } // func(
27552     //   ({
27553     //     a,
27554     //     b
27555     //   }) => {}
27556     // );
27557
27558
27559     function shouldBreakForArrowFunctionInArguments(arg, argPath) {
27560       if (!arg || arg.type !== "ArrowFunctionExpression" || !arg.body || arg.body.type !== "BlockStatement" || !arg.params || arg.params.length < 1) {
27561         return false;
27562       }
27563
27564       var shouldBreak = false;
27565       argPath.each(function (paramPath) {
27566         var printed = concat$d([print(paramPath)]);
27567         shouldBreak = shouldBreak || willBreak$1(printed);
27568       }, "params");
27569       return shouldBreak;
27570     }
27571
27572     var anyArgEmptyLine = false;
27573     var shouldBreakForArrowFunction = false;
27574     var hasEmptyLineFollowingFirstArg = false;
27575     var lastArgIndex = args.length - 1;
27576     var printedArguments = path.map(function (argPath, index) {
27577       var arg = argPath.getNode();
27578       var parts = [print(argPath)];
27579
27580       if (index === lastArgIndex) ; else if (isNextLineEmpty$4(options.originalText, arg, options)) {
27581         if (index === 0) {
27582           hasEmptyLineFollowingFirstArg = true;
27583         }
27584
27585         anyArgEmptyLine = true;
27586         parts.push(",", hardline$9, hardline$9);
27587       } else {
27588         parts.push(",", line$7);
27589       }
27590
27591       shouldBreakForArrowFunction = shouldBreakForArrowFunctionInArguments(arg, argPath);
27592       return concat$d(parts);
27593     }, "arguments");
27594     var maybeTrailingComma = // Dynamic imports cannot have trailing commas
27595     !(node.callee && node.callee.type === "Import") && shouldPrintComma$1(options, "all") ? "," : "";
27596
27597     function allArgsBrokenOut() {
27598       return group$b(concat$d(["(", indent$7(concat$d([line$7, concat$d(printedArguments)])), maybeTrailingComma, line$7, ")"]), {
27599         shouldBreak: true
27600       });
27601     }
27602
27603     if (isFunctionCompositionArgs$1(args)) {
27604       return allArgsBrokenOut();
27605     }
27606
27607     var shouldGroupFirst = shouldGroupFirstArg(args);
27608     var shouldGroupLast = shouldGroupLastArg(args);
27609
27610     if (shouldGroupFirst || shouldGroupLast) {
27611       var shouldBreak = (shouldGroupFirst ? printedArguments.slice(1).some(willBreak$1) : printedArguments.slice(0, -1).some(willBreak$1)) || anyArgEmptyLine || shouldBreakForArrowFunction; // We want to print the last argument with a special flag
27612
27613       var printedExpanded;
27614       var i = 0;
27615       path.each(function (argPath) {
27616         if (shouldGroupFirst && i === 0) {
27617           printedExpanded = [concat$d([argPath.call(function (p) {
27618             return print(p, {
27619               expandFirstArg: true
27620             });
27621           }), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline$9 : line$7, hasEmptyLineFollowingFirstArg ? hardline$9 : ""])].concat(printedArguments.slice(1));
27622         }
27623
27624         if (shouldGroupLast && i === args.length - 1) {
27625           printedExpanded = printedArguments.slice(0, -1).concat(argPath.call(function (p) {
27626             return print(p, {
27627               expandLastArg: true
27628             });
27629           }));
27630         }
27631
27632         i++;
27633       }, "arguments");
27634       var somePrintedArgumentsWillBreak = printedArguments.some(willBreak$1);
27635       var simpleConcat = concat$d(["(", concat$d(printedExpanded), ")"]);
27636       return concat$d([somePrintedArgumentsWillBreak ? breakParent$3 : "", conditionalGroup$1([!somePrintedArgumentsWillBreak && !node.typeArguments && !node.typeParameters ? simpleConcat : ifBreak$6(allArgsBrokenOut(), simpleConcat), shouldGroupFirst ? concat$d(["(", group$b(printedExpanded[0], {
27637         shouldBreak: true
27638       }), concat$d(printedExpanded.slice(1)), ")"]) : concat$d(["(", concat$d(printedArguments.slice(0, -1)), group$b(getLast$2(printedExpanded), {
27639         shouldBreak: true
27640       }), ")"]), allArgsBrokenOut()], {
27641         shouldBreak: shouldBreak
27642       })]);
27643     }
27644
27645     var contents = concat$d(["(", indent$7(concat$d([softline$6, concat$d(printedArguments)])), ifBreak$6(maybeTrailingComma), softline$6, ")"]);
27646
27647     if (isLongCurriedCallExpression$1(path)) {
27648       // By not wrapping the arguments in a group, the printer prioritizes
27649       // breaking up these arguments rather than the args of the parent call.
27650       return contents;
27651     }
27652
27653     return group$b(contents, {
27654       shouldBreak: printedArguments.some(willBreak$1) || anyArgEmptyLine
27655     });
27656   }
27657
27658   function printTypeAnnotation(path, options, print) {
27659     var node = path.getValue();
27660
27661     if (!node.typeAnnotation) {
27662       return "";
27663     }
27664
27665     var parentNode = path.getParentNode();
27666     var isDefinite = node.definite || parentNode && parentNode.type === "VariableDeclarator" && parentNode.definite;
27667     var isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
27668
27669     if (isFlowAnnotationComment$1(options.originalText, node.typeAnnotation, options)) {
27670       return concat$d([" /*: ", path.call(print, "typeAnnotation"), " */"]);
27671     }
27672
27673     return concat$d([isFunctionDeclarationIdentifier ? "" : isDefinite ? "!: " : ": ", path.call(print, "typeAnnotation")]);
27674   }
27675
27676   function printFunctionTypeParameters(path, options, print) {
27677     var fun = path.getValue();
27678
27679     if (fun.typeArguments) {
27680       return path.call(print, "typeArguments");
27681     }
27682
27683     if (fun.typeParameters) {
27684       return path.call(print, "typeParameters");
27685     }
27686
27687     return "";
27688   }
27689
27690   function printFunctionParams(path, print, options, expandArg, printTypeParams) {
27691     var fun = path.getValue();
27692     var parent = path.getParentNode();
27693     var paramsField = fun.parameters ? "parameters" : "params";
27694     var isParametersInTestCall = isTestCall$1(parent);
27695     var shouldHugParameters = shouldHugArguments(fun);
27696     var shouldExpandParameters = expandArg && !(fun[paramsField] && fun[paramsField].some(function (n) {
27697       return n.comments;
27698     }));
27699     var typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
27700     var printed = [];
27701
27702     if (fun[paramsField]) {
27703       var lastArgIndex = fun[paramsField].length - 1;
27704       printed = path.map(function (childPath, index) {
27705         var parts = [];
27706         var param = childPath.getValue();
27707         parts.push(print(childPath));
27708
27709         if (index === lastArgIndex) {
27710           if (fun.rest) {
27711             parts.push(",", line$7);
27712           }
27713         } else if (isParametersInTestCall || shouldHugParameters || shouldExpandParameters) {
27714           parts.push(", ");
27715         } else if (isNextLineEmpty$4(options.originalText, param, options)) {
27716           parts.push(",", hardline$9, hardline$9);
27717         } else {
27718           parts.push(",", line$7);
27719         }
27720
27721         return concat$d(parts);
27722       }, paramsField);
27723     }
27724
27725     if (fun.rest) {
27726       printed.push(concat$d(["...", path.call(print, "rest")]));
27727     }
27728
27729     if (printed.length === 0) {
27730       return concat$d([typeParams, "(", comments.printDanglingComments(path, options,
27731       /* sameIndent */
27732       true, function (comment) {
27733         return getNextNonSpaceNonCommentCharacter$1(options.originalText, comment, options.locEnd) === ")";
27734       }), ")"]);
27735     }
27736
27737     var lastParam = getLast$2(fun[paramsField]); // If the parent is a call with the first/last argument expansion and this is the
27738     // params of the first/last argument, we don't want the arguments to break and instead
27739     // want the whole expression to be on a new line.
27740     //
27741     // Good:                 Bad:
27742     //   verylongcall(         verylongcall((
27743     //     (a, b) => {           a,
27744     //     }                     b,
27745     //   })                    ) => {
27746     //                         })
27747
27748     if (shouldExpandParameters) {
27749       return group$b(concat$d([removeLines$2(typeParams), "(", concat$d(printed.map(removeLines$2)), ")"]));
27750     } // Single object destructuring should hug
27751     //
27752     // function({
27753     //   a,
27754     //   b,
27755     //   c
27756     // }) {}
27757
27758
27759     var hasNotParameterDecorator = fun[paramsField].every(function (param) {
27760       return !param.decorators;
27761     });
27762
27763     if (shouldHugParameters && hasNotParameterDecorator) {
27764       return concat$d([typeParams, "(", concat$d(printed), ")"]);
27765     } // don't break in specs, eg; `it("should maintain parens around done even when long", (done) => {})`
27766
27767
27768     if (isParametersInTestCall) {
27769       return concat$d([typeParams, "(", concat$d(printed), ")"]);
27770     }
27771
27772     var isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction$1(parent, options) || isTypeAnnotationAFunction$1(parent, options) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === fun) && fun[paramsField].length === 1 && fun[paramsField][0].name === null && fun[paramsField][0].typeAnnotation && fun.typeParameters === null && isSimpleFlowType$1(fun[paramsField][0].typeAnnotation) && !fun.rest;
27773
27774     if (isFlowShorthandWithOneArg) {
27775       if (options.arrowParens === "always") {
27776         return concat$d(["(", concat$d(printed), ")"]);
27777       }
27778
27779       return concat$d(printed);
27780     }
27781
27782     var canHaveTrailingComma = !(lastParam && lastParam.type === "RestElement") && !fun.rest;
27783     return concat$d([typeParams, "(", indent$7(concat$d([softline$6, concat$d(printed)])), ifBreak$6(canHaveTrailingComma && shouldPrintComma$1(options, "all") ? "," : ""), softline$6, ")"]);
27784   }
27785
27786   function shouldPrintParamsWithoutParens(path, options) {
27787     if (options.arrowParens === "always") {
27788       return false;
27789     }
27790
27791     if (options.arrowParens === "avoid") {
27792       var node = path.getValue();
27793       return canPrintParamsWithoutParens(node);
27794     } // Fallback default; should be unreachable
27795
27796
27797     return false;
27798   }
27799
27800   function canPrintParamsWithoutParens(node) {
27801     return node.params.length === 1 && !node.rest && !node.typeParameters && !hasDanglingComments$1(node) && node.params[0].type === "Identifier" && !node.params[0].typeAnnotation && !node.params[0].comments && !node.params[0].optional && !node.predicate && !node.returnType;
27802   }
27803
27804   function printFunctionDeclaration(path, print, options) {
27805     var n = path.getValue();
27806     var parts = [];
27807
27808     if (n.async) {
27809       parts.push("async ");
27810     }
27811
27812     parts.push("function");
27813
27814     if (n.generator) {
27815       parts.push("*");
27816     }
27817
27818     if (n.id) {
27819       parts.push(" ", path.call(print, "id"));
27820     }
27821
27822     parts.push(printFunctionTypeParameters(path, options, print), group$b(concat$d([printFunctionParams(path, print, options), printReturnType(path, print, options)])), n.body ? " " : "", path.call(print, "body"));
27823     return concat$d(parts);
27824   }
27825
27826   function printReturnType(path, print, options) {
27827     var n = path.getValue();
27828     var returnType = path.call(print, "returnType");
27829
27830     if (n.returnType && isFlowAnnotationComment$1(options.originalText, n.returnType, options)) {
27831       return concat$d([" /*: ", returnType, " */"]);
27832     }
27833
27834     var parts = [returnType]; // prepend colon to TypeScript type annotation
27835
27836     if (n.returnType && n.returnType.typeAnnotation) {
27837       parts.unshift(": ");
27838     }
27839
27840     if (n.predicate) {
27841       // The return type will already add the colon, but otherwise we
27842       // need to do it ourselves
27843       parts.push(n.returnType ? " " : ": ", path.call(print, "predicate"));
27844     }
27845
27846     return concat$d(parts);
27847   }
27848
27849   function printExportDeclaration(path, options, print) {
27850     var decl = path.getValue();
27851     var semi = options.semi ? ";" : "";
27852     var parts = ["export "];
27853     var isDefault = decl["default"] || decl.type === "ExportDefaultDeclaration";
27854
27855     if (isDefault) {
27856       parts.push("default ");
27857     }
27858
27859     parts.push(comments.printDanglingComments(path, options,
27860     /* sameIndent */
27861     true));
27862
27863     if (needsHardlineAfterDanglingComment$1(decl)) {
27864       parts.push(hardline$9);
27865     }
27866
27867     if (decl.declaration) {
27868       parts.push(path.call(print, "declaration"));
27869
27870       if (isDefault && decl.declaration.type !== "ClassDeclaration" && decl.declaration.type !== "FunctionDeclaration" && decl.declaration.type !== "TSInterfaceDeclaration" && decl.declaration.type !== "DeclareClass" && decl.declaration.type !== "DeclareFunction" && decl.declaration.type !== "TSDeclareFunction") {
27871         parts.push(semi);
27872       }
27873     } else {
27874       if (decl.specifiers && decl.specifiers.length > 0) {
27875         var specifiers = [];
27876         var defaultSpecifiers = [];
27877         var namespaceSpecifiers = [];
27878         path.each(function (specifierPath) {
27879           var specifierType = path.getValue().type;
27880
27881           if (specifierType === "ExportSpecifier") {
27882             specifiers.push(print(specifierPath));
27883           } else if (specifierType === "ExportDefaultSpecifier") {
27884             defaultSpecifiers.push(print(specifierPath));
27885           } else if (specifierType === "ExportNamespaceSpecifier") {
27886             namespaceSpecifiers.push(concat$d(["* as ", print(specifierPath)]));
27887           }
27888         }, "specifiers");
27889         var isNamespaceFollowed = namespaceSpecifiers.length !== 0 && specifiers.length !== 0;
27890         var isDefaultFollowed = defaultSpecifiers.length !== 0 && (namespaceSpecifiers.length !== 0 || specifiers.length !== 0);
27891         var canBreak = specifiers.length > 1 || defaultSpecifiers.length > 0 || decl.specifiers && decl.specifiers.some(function (node) {
27892           return node.comments;
27893         });
27894         var printed = "";
27895
27896         if (specifiers.length !== 0) {
27897           if (canBreak) {
27898             printed = group$b(concat$d(["{", indent$7(concat$d([options.bracketSpacing ? line$7 : softline$6, join$9(concat$d([",", line$7]), specifiers)])), ifBreak$6(shouldPrintComma$1(options) ? "," : ""), options.bracketSpacing ? line$7 : softline$6, "}"]));
27899           } else {
27900             printed = concat$d(["{", options.bracketSpacing ? " " : "", concat$d(specifiers), options.bracketSpacing ? " " : "", "}"]);
27901           }
27902         }
27903
27904         parts.push(decl.exportKind === "type" ? "type " : "", concat$d(defaultSpecifiers), concat$d([isDefaultFollowed ? ", " : ""]), concat$d(namespaceSpecifiers), concat$d([isNamespaceFollowed ? ", " : ""]), printed);
27905       } else {
27906         parts.push("{}");
27907       }
27908
27909       if (decl.source) {
27910         parts.push(" from ", path.call(print, "source"));
27911       }
27912
27913       parts.push(semi);
27914     }
27915
27916     return concat$d(parts);
27917   }
27918
27919   function printFlowDeclaration(path, parts) {
27920     var parentExportDecl = getParentExportDeclaration$1(path);
27921
27922     if (parentExportDecl) {
27923       assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
27924     } else {
27925       // If the parent node has type DeclareExportDeclaration, then it
27926       // will be responsible for printing the "declare" token. Otherwise
27927       // it needs to be printed with this non-exported declaration node.
27928       parts.unshift("declare ");
27929     }
27930
27931     return concat$d(parts);
27932   }
27933
27934   function printTypeScriptModifiers(path, options, print) {
27935     var n = path.getValue();
27936
27937     if (!n.modifiers || !n.modifiers.length) {
27938       return "";
27939     }
27940
27941     return concat$d([join$9(" ", path.map(print, "modifiers")), " "]);
27942   }
27943
27944   function printTypeParameters(path, options, print, paramsKey) {
27945     var n = path.getValue();
27946
27947     if (!n[paramsKey]) {
27948       return "";
27949     } // for TypeParameterDeclaration typeParameters is a single node
27950
27951
27952     if (!Array.isArray(n[paramsKey])) {
27953       return path.call(print, paramsKey);
27954     }
27955
27956     var grandparent = path.getNode(2);
27957     var greatGreatGrandParent = path.getNode(4);
27958     var isParameterInTestCall = grandparent != null && isTestCall$1(grandparent);
27959     var shouldInline = isParameterInTestCall || n[paramsKey].length === 0 || n[paramsKey].length === 1 && (shouldHugType(n[paramsKey][0]) || n[paramsKey][0].type === "GenericTypeAnnotation" && shouldHugType(n[paramsKey][0].id) || n[paramsKey][0].type === "TSTypeReference" && shouldHugType(n[paramsKey][0].typeName) || n[paramsKey][0].type === "NullableTypeAnnotation" || // See https://github.com/prettier/prettier/pull/6467 for the context.
27960     greatGreatGrandParent && greatGreatGrandParent.type === "VariableDeclarator" && grandparent && grandparent.type === "TSTypeAnnotation" && n[paramsKey][0].type !== "TSUnionType" && n[paramsKey][0].type !== "UnionTypeAnnotation" && n[paramsKey][0].type !== "TSConditionalType" && n[paramsKey][0].type !== "TSMappedType");
27961
27962     if (shouldInline) {
27963       return concat$d(["<", join$9(", ", path.map(print, paramsKey)), ">"]);
27964     }
27965
27966     return group$b(concat$d(["<", indent$7(concat$d([softline$6, join$9(concat$d([",", line$7]), path.map(print, paramsKey))])), ifBreak$6(options.parser !== "typescript" && shouldPrintComma$1(options, "all") ? "," : ""), softline$6, ">"]));
27967   }
27968
27969   function printClass(path, options, print) {
27970     var n = path.getValue();
27971     var parts = [];
27972
27973     if (n.abstract) {
27974       parts.push("abstract ");
27975     }
27976
27977     parts.push("class");
27978
27979     if (n.id) {
27980       parts.push(" ", path.call(print, "id"));
27981     }
27982
27983     parts.push(path.call(print, "typeParameters"));
27984     var partsGroup = [];
27985
27986     if (n.superClass) {
27987       var printed = concat$d(["extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters")]); // Keep old behaviour of extends in same line
27988       // If there is only on extends and there are not comments
27989
27990       if ((!n.implements || n.implements.length === 0) && (!n.superClass.comments || n.superClass.comments.length === 0)) {
27991         parts.push(concat$d([" ", path.call(function (superClass) {
27992           return comments.printComments(superClass, function () {
27993             return printed;
27994           }, options);
27995         }, "superClass")]));
27996       } else {
27997         partsGroup.push(group$b(concat$d([line$7, path.call(function (superClass) {
27998           return comments.printComments(superClass, function () {
27999             return printed;
28000           }, options);
28001         }, "superClass")])));
28002       }
28003     } else if (n.extends && n.extends.length > 0) {
28004       parts.push(" extends ", join$9(", ", path.map(print, "extends")));
28005     }
28006
28007     if (n["mixins"] && n["mixins"].length > 0) {
28008       partsGroup.push(line$7, "mixins ", group$b(indent$7(join$9(concat$d([",", line$7]), path.map(print, "mixins")))));
28009     }
28010
28011     if (n["implements"] && n["implements"].length > 0) {
28012       partsGroup.push(line$7, "implements", group$b(indent$7(concat$d([line$7, join$9(concat$d([",", line$7]), path.map(print, "implements"))]))));
28013     }
28014
28015     if (partsGroup.length > 0) {
28016       parts.push(group$b(indent$7(concat$d(partsGroup))));
28017     }
28018
28019     if (n.body && n.body.comments && hasLeadingOwnLineComment$1(options.originalText, n.body, options)) {
28020       parts.push(hardline$9);
28021     } else {
28022       parts.push(" ");
28023     }
28024
28025     parts.push(path.call(print, "body"));
28026     return parts;
28027   }
28028
28029   function printOptionalToken(path) {
28030     var node = path.getValue();
28031
28032     if (!node.optional || // It's an optional computed method parsed by typescript-estree.
28033     // "?" is printed in `printMethod`.
28034     node.type === "Identifier" && node === path.getParentNode().key) {
28035       return "";
28036     }
28037
28038     if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
28039       return "?.";
28040     }
28041
28042     return "?";
28043   }
28044
28045   function printMemberLookup(path, options, print) {
28046     var property = path.call(print, "property");
28047     var n = path.getValue();
28048     var optional = printOptionalToken(path);
28049
28050     if (!n.computed) {
28051       return concat$d([optional, ".", property]);
28052     }
28053
28054     if (!n.property || isNumericLiteral$1(n.property)) {
28055       return concat$d([optional, "[", property, "]"]);
28056     }
28057
28058     return group$b(concat$d([optional, "[", indent$7(concat$d([softline$6, property])), softline$6, "]"]));
28059   }
28060
28061   function printBindExpressionCallee(path, options, print) {
28062     return concat$d(["::", path.call(print, "callee")]);
28063   } // We detect calls on member expressions specially to format a
28064   // common pattern better. The pattern we are looking for is this:
28065   //
28066   // arr
28067   //   .map(x => x + 1)
28068   //   .filter(x => x > 10)
28069   //   .some(x => x % 2)
28070   //
28071   // The way it is structured in the AST is via a nested sequence of
28072   // MemberExpression and CallExpression. We need to traverse the AST
28073   // and make groups out of it to print it in the desired way.
28074
28075
28076   function printMemberChain(path, options, print) {
28077     // The first phase is to linearize the AST by traversing it down.
28078     //
28079     //   a().b()
28080     // has the following AST structure:
28081     //   CallExpression(MemberExpression(CallExpression(Identifier)))
28082     // and we transform it into
28083     //   [Identifier, CallExpression, MemberExpression, CallExpression]
28084     var printedNodes = []; // Here we try to retain one typed empty line after each call expression or
28085     // the first group whether it is in parentheses or not
28086
28087     function shouldInsertEmptyLineAfter(node) {
28088       var originalText = options.originalText;
28089       var nextCharIndex = getNextNonSpaceNonCommentCharacterIndex$2(originalText, node, options);
28090       var nextChar = originalText.charAt(nextCharIndex); // if it is cut off by a parenthesis, we only account for one typed empty
28091       // line after that parenthesis
28092
28093       if (nextChar == ")") {
28094         return isNextLineEmptyAfterIndex$1(originalText, nextCharIndex + 1, options);
28095       }
28096
28097       return isNextLineEmpty$4(originalText, node, options);
28098     }
28099
28100     function rec(path) {
28101       var node = path.getValue();
28102
28103       if ((node.type === "CallExpression" || node.type === "OptionalCallExpression") && (isMemberish$1(node.callee) || node.callee.type === "CallExpression" || node.callee.type === "OptionalCallExpression")) {
28104         printedNodes.unshift({
28105           node: node,
28106           printed: concat$d([comments.printComments(path, function () {
28107             return concat$d([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)]);
28108           }, options), shouldInsertEmptyLineAfter(node) ? hardline$9 : ""])
28109         });
28110         path.call(function (callee) {
28111           return rec(callee);
28112         }, "callee");
28113       } else if (isMemberish$1(node)) {
28114         printedNodes.unshift({
28115           node: node,
28116           needsParens: needsParens_1(path, options),
28117           printed: comments.printComments(path, function () {
28118             return node.type === "OptionalMemberExpression" || node.type === "MemberExpression" ? printMemberLookup(path, options, print) : printBindExpressionCallee(path, options, print);
28119           }, options)
28120         });
28121         path.call(function (object) {
28122           return rec(object);
28123         }, "object");
28124       } else if (node.type === "TSNonNullExpression") {
28125         printedNodes.unshift({
28126           node: node,
28127           printed: comments.printComments(path, function () {
28128             return "!";
28129           }, options)
28130         });
28131         path.call(function (expression) {
28132           return rec(expression);
28133         }, "expression");
28134       } else {
28135         printedNodes.unshift({
28136           node: node,
28137           printed: path.call(print)
28138         });
28139       }
28140     } // Note: the comments of the root node have already been printed, so we
28141     // need to extract this first call without printing them as they would
28142     // if handled inside of the recursive call.
28143
28144
28145     var node = path.getValue();
28146     printedNodes.unshift({
28147       node: node,
28148       printed: concat$d([printOptionalToken(path), printFunctionTypeParameters(path, options, print), printArgumentsList(path, options, print)])
28149     });
28150     path.call(function (callee) {
28151       return rec(callee);
28152     }, "callee"); // Once we have a linear list of printed nodes, we want to create groups out
28153     // of it.
28154     //
28155     //   a().b.c().d().e
28156     // will be grouped as
28157     //   [
28158     //     [Identifier, CallExpression],
28159     //     [MemberExpression, MemberExpression, CallExpression],
28160     //     [MemberExpression, CallExpression],
28161     //     [MemberExpression],
28162     //   ]
28163     // so that we can print it as
28164     //   a()
28165     //     .b.c()
28166     //     .d()
28167     //     .e
28168     // The first group is the first node followed by
28169     //   - as many CallExpression as possible
28170     //       < fn()()() >.something()
28171     //   - as many array accessors as possible
28172     //       < fn()[0][1][2] >.something()
28173     //   - then, as many MemberExpression as possible but the last one
28174     //       < this.items >.something()
28175
28176     var groups = [];
28177     var currentGroup = [printedNodes[0]];
28178     var i = 1;
28179
28180     for (; i < printedNodes.length; ++i) {
28181       if (printedNodes[i].node.type === "TSNonNullExpression" || printedNodes[i].node.type === "OptionalCallExpression" || printedNodes[i].node.type === "CallExpression" || (printedNodes[i].node.type === "MemberExpression" || printedNodes[i].node.type === "OptionalMemberExpression") && printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) {
28182         currentGroup.push(printedNodes[i]);
28183       } else {
28184         break;
28185       }
28186     }
28187
28188     if (printedNodes[0].node.type !== "CallExpression" && printedNodes[0].node.type !== "OptionalCallExpression") {
28189       for (; i + 1 < printedNodes.length; ++i) {
28190         if (isMemberish$1(printedNodes[i].node) && isMemberish$1(printedNodes[i + 1].node)) {
28191           currentGroup.push(printedNodes[i]);
28192         } else {
28193           break;
28194         }
28195       }
28196     }
28197
28198     groups.push(currentGroup);
28199     currentGroup = []; // Then, each following group is a sequence of MemberExpression followed by
28200     // a sequence of CallExpression. To compute it, we keep adding things to the
28201     // group until we has seen a CallExpression in the past and reach a
28202     // MemberExpression
28203
28204     var hasSeenCallExpression = false;
28205
28206     for (; i < printedNodes.length; ++i) {
28207       if (hasSeenCallExpression && isMemberish$1(printedNodes[i].node)) {
28208         // [0] should be appended at the end of the group instead of the
28209         // beginning of the next one
28210         if (printedNodes[i].node.computed && isNumericLiteral$1(printedNodes[i].node.property)) {
28211           currentGroup.push(printedNodes[i]);
28212           continue;
28213         }
28214
28215         groups.push(currentGroup);
28216         currentGroup = [];
28217         hasSeenCallExpression = false;
28218       }
28219
28220       if (printedNodes[i].node.type === "CallExpression" || printedNodes[i].node.type === "OptionalCallExpression") {
28221         hasSeenCallExpression = true;
28222       }
28223
28224       currentGroup.push(printedNodes[i]);
28225
28226       if (printedNodes[i].node.comments && printedNodes[i].node.comments.some(function (comment) {
28227         return comment.trailing;
28228       })) {
28229         groups.push(currentGroup);
28230         currentGroup = [];
28231         hasSeenCallExpression = false;
28232       }
28233     }
28234
28235     if (currentGroup.length > 0) {
28236       groups.push(currentGroup);
28237     } // There are cases like Object.keys(), Observable.of(), _.values() where
28238     // they are the subject of all the chained calls and therefore should
28239     // be kept on the same line:
28240     //
28241     //   Object.keys(items)
28242     //     .filter(x => x)
28243     //     .map(x => x)
28244     //
28245     // In order to detect those cases, we use an heuristic: if the first
28246     // node is an identifier with the name starting with a capital
28247     // letter or just a sequence of _$. The rationale is that they are
28248     // likely to be factories.
28249
28250
28251     function isFactory(name) {
28252       return /^[A-Z]|^[_$]+$/.test(name);
28253     } // In case the Identifier is shorter than tab width, we can keep the
28254     // first call in a single line, if it's an ExpressionStatement.
28255     //
28256     //   d3.scaleLinear()
28257     //     .domain([0, 100])
28258     //     .range([0, width]);
28259     //
28260
28261
28262     function isShort(name) {
28263       return name.length <= options.tabWidth;
28264     }
28265
28266     function shouldNotWrap(groups) {
28267       var parent = path.getParentNode();
28268       var isExpression = parent && parent.type === "ExpressionStatement";
28269       var hasComputed = groups[1].length && groups[1][0].node.computed;
28270
28271       if (groups[0].length === 1) {
28272         var firstNode = groups[0][0].node;
28273         return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpression && isShort(firstNode.name) || hasComputed);
28274       }
28275
28276       var lastNode = getLast$2(groups[0]).node;
28277       return (lastNode.type === "MemberExpression" || lastNode.type === "OptionalMemberExpression") && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
28278     }
28279
28280     var shouldMerge = groups.length >= 2 && !groups[1][0].node.comments && shouldNotWrap(groups);
28281
28282     function printGroup(printedGroup) {
28283       var printed = printedGroup.map(function (tuple) {
28284         return tuple.printed;
28285       }); // Checks if the last node (i.e. the parent node) needs parens and print
28286       // accordingly
28287
28288       if (printedGroup.length > 0 && printedGroup[printedGroup.length - 1].needsParens) {
28289         return concat$d(["("].concat(_toConsumableArray(printed), [")"]));
28290       }
28291
28292       return concat$d(printed);
28293     }
28294
28295     function printIndentedGroup(groups) {
28296       if (groups.length === 0) {
28297         return "";
28298       }
28299
28300       return indent$7(group$b(concat$d([hardline$9, join$9(hardline$9, groups.map(printGroup))])));
28301     }
28302
28303     var printedGroups = groups.map(printGroup);
28304     var oneLine = concat$d(printedGroups);
28305     var cutoff = shouldMerge ? 3 : 2;
28306     var flatGroups = groups.slice(0, cutoff).reduce(function (res, group) {
28307       return res.concat(group);
28308     }, []);
28309     var hasComment = flatGroups.slice(1, -1).some(function (node) {
28310       return hasLeadingComment$3(node.node);
28311     }) || flatGroups.slice(0, -1).some(function (node) {
28312       return hasTrailingComment$1(node.node);
28313     }) || groups[cutoff] && hasLeadingComment$3(groups[cutoff][0].node); // If we only have a single `.`, we shouldn't do anything fancy and just
28314     // render everything concatenated together.
28315
28316     if (groups.length <= cutoff && !hasComment) {
28317       if (isLongCurriedCallExpression$1(path)) {
28318         return oneLine;
28319       }
28320
28321       return group$b(oneLine);
28322     } // Find out the last node in the first group and check if it has an
28323     // empty line after
28324
28325
28326     var lastNodeBeforeIndent = getLast$2(shouldMerge ? groups.slice(1, 2)[0] : groups[0]).node;
28327     var shouldHaveEmptyLineBeforeIndent = lastNodeBeforeIndent.type !== "CallExpression" && lastNodeBeforeIndent.type !== "OptionalCallExpression" && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
28328     var expanded = concat$d([printGroup(groups[0]), shouldMerge ? concat$d(groups.slice(1, 2).map(printGroup)) : "", shouldHaveEmptyLineBeforeIndent ? hardline$9 : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))]);
28329     var callExpressions = printedNodes.map(function (_ref) {
28330       var node = _ref.node;
28331       return node;
28332     }).filter(isCallOrOptionalCallExpression$1); // We don't want to print in one line if there's:
28333     //  * A comment.
28334     //  * 3 or more chained calls.
28335     //  * Any group but the last one has a hard line.
28336     // If the last group is a function it's okay to inline if it fits.
28337
28338     if (hasComment || callExpressions.length >= 3 || printedGroups.slice(0, -1).some(willBreak$1) ||
28339     /**
28340      *     scopes.filter(scope => scope.value !== '').map((scope, i) => {
28341      *       // multi line content
28342      *     })
28343      */
28344     function (lastGroupDoc, lastGroupNode) {
28345       return isCallOrOptionalCallExpression$1(lastGroupNode) && willBreak$1(lastGroupDoc);
28346     }(getLast$2(printedGroups), getLast$2(getLast$2(groups)).node) && callExpressions.slice(0, -1).some(function (n) {
28347       return n.arguments.some(isFunctionOrArrowExpression$1);
28348     })) {
28349       return group$b(expanded);
28350     }
28351
28352     return concat$d([// We only need to check `oneLine` because if `expanded` is chosen
28353     // that means that the parent group has already been broken
28354     // naturally
28355     willBreak$1(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent$3 : "", conditionalGroup$1([oneLine, expanded])]);
28356   }
28357
28358   function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
28359     if (isFacebookTranslationTag) {
28360       return "";
28361     }
28362
28363     if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
28364       return child.length === 1 ? softline$6 : hardline$9;
28365     }
28366
28367     return softline$6;
28368   }
28369
28370   function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
28371     if (isFacebookTranslationTag) {
28372       return hardline$9;
28373     }
28374
28375     if (child.length === 1) {
28376       return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline$9 : softline$6;
28377     }
28378
28379     return hardline$9;
28380   } // JSX Children are strange, mostly for two reasons:
28381   // 1. JSX reads newlines into string values, instead of skipping them like JS
28382   // 2. up to one whitespace between elements within a line is significant,
28383   //    but not between lines.
28384   //
28385   // Leading, trailing, and lone whitespace all need to
28386   // turn themselves into the rather ugly `{' '}` when breaking.
28387   //
28388   // We print JSX using the `fill` doc primitive.
28389   // This requires that we give it an array of alternating
28390   // content and whitespace elements.
28391   // To ensure this we add dummy `""` content elements as needed.
28392
28393
28394   function printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
28395     var n = path.getValue();
28396     var children = []; // using `map` instead of `each` because it provides `i`
28397
28398     path.map(function (childPath, i) {
28399       var child = childPath.getValue();
28400
28401       if (isLiteral$1(child)) {
28402         var text = rawText$1(child); // Contains a non-whitespace character
28403
28404         if (isMeaningfulJSXText$1(child)) {
28405           var words = text.split(matchJsxWhitespaceRegex$1); // Starts with whitespace
28406
28407           if (words[0] === "") {
28408             children.push("");
28409             words.shift();
28410
28411             if (/\n/.test(words[0])) {
28412               var next = n.children[i + 1];
28413               children.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
28414             } else {
28415               children.push(jsxWhitespace);
28416             }
28417
28418             words.shift();
28419           }
28420
28421           var endWhitespace; // Ends with whitespace
28422
28423           if (getLast$2(words) === "") {
28424             words.pop();
28425             endWhitespace = words.pop();
28426           } // This was whitespace only without a new line.
28427
28428
28429           if (words.length === 0) {
28430             return;
28431           }
28432
28433           words.forEach(function (word, i) {
28434             if (i % 2 === 1) {
28435               children.push(line$7);
28436             } else {
28437               children.push(word);
28438             }
28439           });
28440
28441           if (endWhitespace !== undefined) {
28442             if (/\n/.test(endWhitespace)) {
28443               var _next = n.children[i + 1];
28444               children.push(separatorWithWhitespace(isFacebookTranslationTag, getLast$2(children), child, _next));
28445             } else {
28446               children.push(jsxWhitespace);
28447             }
28448           } else {
28449             var _next2 = n.children[i + 1];
28450             children.push(separatorNoWhitespace(isFacebookTranslationTag, getLast$2(children), child, _next2));
28451           }
28452         } else if (/\n/.test(text)) {
28453           // Keep (up to one) blank line between tags/expressions/text.
28454           // Note: We don't keep blank lines between text elements.
28455           if (text.match(/\n/g).length > 1) {
28456             children.push("");
28457             children.push(hardline$9);
28458           }
28459         } else {
28460           children.push("");
28461           children.push(jsxWhitespace);
28462         }
28463       } else {
28464         var printedChild = print(childPath);
28465         children.push(printedChild);
28466         var _next3 = n.children[i + 1];
28467
28468         var directlyFollowedByMeaningfulText = _next3 && isMeaningfulJSXText$1(_next3);
28469
28470         if (directlyFollowedByMeaningfulText) {
28471           var firstWord = rawText$1(_next3).trim().split(matchJsxWhitespaceRegex$1)[0];
28472           children.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, _next3));
28473         } else {
28474           children.push(hardline$9);
28475         }
28476       }
28477     }, "children");
28478     return children;
28479   } // JSX expands children from the inside-out, instead of the outside-in.
28480   // This is both to break children before attributes,
28481   // and to ensure that when children break, their parents do as well.
28482   //
28483   // Any element that is written without any newlines and fits on a single line
28484   // is left that way.
28485   // Not only that, any user-written-line containing multiple JSX siblings
28486   // should also be kept on one line if possible,
28487   // so each user-written-line is wrapped in its own group.
28488   //
28489   // Elements that contain newlines or don't fit on a single line (recursively)
28490   // are fully-split, using hardline and shouldBreak: true.
28491   //
28492   // To support that case properly, all leading and trailing spaces
28493   // are stripped from the list of children, and replaced with a single hardline.
28494
28495
28496   function printJSXElement(path, options, print) {
28497     var n = path.getValue();
28498
28499     if (n.type === "JSXElement" && isEmptyJSXElement$1(n)) {
28500       return concat$d([path.call(print, "openingElement"), path.call(print, "closingElement")]);
28501     }
28502
28503     var openingLines = n.type === "JSXElement" ? path.call(print, "openingElement") : path.call(print, "openingFragment");
28504     var closingLines = n.type === "JSXElement" ? path.call(print, "closingElement") : path.call(print, "closingFragment");
28505
28506     if (n.children.length === 1 && n.children[0].type === "JSXExpressionContainer" && (n.children[0].expression.type === "TemplateLiteral" || n.children[0].expression.type === "TaggedTemplateExpression")) {
28507       return concat$d([openingLines, concat$d(path.map(print, "children")), closingLines]);
28508     } // Convert `{" "}` to text nodes containing a space.
28509     // This makes it easy to turn them into `jsxWhitespace` which
28510     // can then print as either a space or `{" "}` when breaking.
28511
28512
28513     n.children = n.children.map(function (child) {
28514       if (isJSXWhitespaceExpression$1(child)) {
28515         return {
28516           type: "JSXText",
28517           value: " ",
28518           raw: " "
28519         };
28520       }
28521
28522       return child;
28523     });
28524     var containsTag = n.children.filter(isJSXNode$1).length > 0;
28525     var containsMultipleExpressions = n.children.filter(function (child) {
28526       return child.type === "JSXExpressionContainer";
28527     }).length > 1;
28528     var containsMultipleAttributes = n.type === "JSXElement" && n.openingElement.attributes.length > 1; // Record any breaks. Should never go from true to false, only false to true.
28529
28530     var forcedBreak = willBreak$1(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
28531     var rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
28532     var jsxWhitespace = ifBreak$6(concat$d([rawJsxWhitespace, softline$6]), " ");
28533     var isFacebookTranslationTag = n.openingElement && n.openingElement.name && n.openingElement.name.name === "fbt";
28534     var children = printJSXChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
28535     var containsText = n.children.filter(function (child) {
28536       return isMeaningfulJSXText$1(child);
28537     }).length > 0; // We can end up we multiple whitespace elements with empty string
28538     // content between them.
28539     // We need to remove empty whitespace and softlines before JSX whitespace
28540     // to get the correct output.
28541
28542     for (var i = children.length - 2; i >= 0; i--) {
28543       var isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
28544       var isPairOfHardlines = children[i] === hardline$9 && children[i + 1] === "" && children[i + 2] === hardline$9;
28545       var isLineFollowedByJSXWhitespace = (children[i] === softline$6 || children[i] === hardline$9) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
28546       var isJSXWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline$6 || children[i + 2] === hardline$9);
28547       var isDoubleJSXWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
28548       var isPairOfHardOrSoftLines = children[i] === softline$6 && children[i + 1] === "" && children[i + 2] === hardline$9 || children[i] === hardline$9 && children[i + 1] === "" && children[i + 2] === softline$6;
28549
28550       if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJSXWhitespace || isDoubleJSXWhitespace || isPairOfHardOrSoftLines) {
28551         children.splice(i, 2);
28552       } else if (isJSXWhitespaceFollowedByLine) {
28553         children.splice(i + 1, 2);
28554       }
28555     } // Trim trailing lines (or empty strings)
28556
28557
28558     while (children.length && (isLineNext$1(getLast$2(children)) || isEmpty$1(getLast$2(children)))) {
28559       children.pop();
28560     } // Trim leading lines (or empty strings)
28561
28562
28563     while (children.length && (isLineNext$1(children[0]) || isEmpty$1(children[0])) && (isLineNext$1(children[1]) || isEmpty$1(children[1]))) {
28564       children.shift();
28565       children.shift();
28566     } // Tweak how we format children if outputting this element over multiple lines.
28567     // Also detect whether we will force this element to output over multiple lines.
28568
28569
28570     var multilineChildren = [];
28571     children.forEach(function (child, i) {
28572       // There are a number of situations where we need to ensure we display
28573       // whitespace as `{" "}` when outputting this element over multiple lines.
28574       if (child === jsxWhitespace) {
28575         if (i === 1 && children[i - 1] === "") {
28576           if (children.length === 2) {
28577             // Solitary whitespace
28578             multilineChildren.push(rawJsxWhitespace);
28579             return;
28580           } // Leading whitespace
28581
28582
28583           multilineChildren.push(concat$d([rawJsxWhitespace, hardline$9]));
28584           return;
28585         } else if (i === children.length - 1) {
28586           // Trailing whitespace
28587           multilineChildren.push(rawJsxWhitespace);
28588           return;
28589         } else if (children[i - 1] === "" && children[i - 2] === hardline$9) {
28590           // Whitespace after line break
28591           multilineChildren.push(rawJsxWhitespace);
28592           return;
28593         }
28594       }
28595
28596       multilineChildren.push(child);
28597
28598       if (willBreak$1(child)) {
28599         forcedBreak = true;
28600       }
28601     }); // If there is text we use `fill` to fit as much onto each line as possible.
28602     // When there is no text (just tags and expressions) we use `group`
28603     // to output each on a separate line.
28604
28605     var content = containsText ? fill$4(multilineChildren) : group$b(concat$d(multilineChildren), {
28606       shouldBreak: true
28607     });
28608     var multiLineElem = group$b(concat$d([openingLines, indent$7(concat$d([hardline$9, content])), hardline$9, closingLines]));
28609
28610     if (forcedBreak) {
28611       return multiLineElem;
28612     }
28613
28614     return conditionalGroup$1([group$b(concat$d([openingLines, concat$d(children), closingLines])), multiLineElem]);
28615   }
28616
28617   function maybeWrapJSXElementInParens(path, elem, options) {
28618     var parent = path.getParentNode();
28619
28620     if (!parent) {
28621       return elem;
28622     }
28623
28624     var NO_WRAP_PARENTS = {
28625       ArrayExpression: true,
28626       JSXAttribute: true,
28627       JSXElement: true,
28628       JSXExpressionContainer: true,
28629       JSXFragment: true,
28630       ExpressionStatement: true,
28631       CallExpression: true,
28632       OptionalCallExpression: true,
28633       ConditionalExpression: true,
28634       JsExpressionRoot: true
28635     };
28636
28637     if (NO_WRAP_PARENTS[parent.type]) {
28638       return elem;
28639     }
28640
28641     var shouldBreak = matchAncestorTypes$1(path, ["ArrowFunctionExpression", "CallExpression", "JSXExpressionContainer"]) || matchAncestorTypes$1(path, ["ArrowFunctionExpression", "OptionalCallExpression", "JSXExpressionContainer"]);
28642     var needsParens = needsParens_1(path, options);
28643     return group$b(concat$d([needsParens ? "" : ifBreak$6("("), indent$7(concat$d([softline$6, elem])), softline$6, needsParens ? "" : ifBreak$6(")")]), {
28644       shouldBreak: shouldBreak
28645     });
28646   }
28647
28648   function shouldInlineLogicalExpression(node) {
28649     if (node.type !== "LogicalExpression") {
28650       return false;
28651     }
28652
28653     if (node.right.type === "ObjectExpression" && node.right.properties.length !== 0) {
28654       return true;
28655     }
28656
28657     if (node.right.type === "ArrayExpression" && node.right.elements.length !== 0) {
28658       return true;
28659     }
28660
28661     if (isJSXNode$1(node.right)) {
28662       return true;
28663     }
28664
28665     return false;
28666   } // For binary expressions to be consistent, we need to group
28667   // subsequent operators with the same precedence level under a single
28668   // group. Otherwise they will be nested such that some of them break
28669   // onto new lines but not all. Operators with the same precedence
28670   // level should either all break or not. Because we group them by
28671   // precedence level and the AST is structured based on precedence
28672   // level, things are naturally broken up correctly, i.e. `&&` is
28673   // broken before `+`.
28674
28675
28676   function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
28677     var parts = [];
28678     var node = path.getValue(); // We treat BinaryExpression and LogicalExpression nodes the same.
28679
28680     if (isBinaryish$1(node)) {
28681       // Put all operators with the same precedence level in the same
28682       // group. The reason we only need to do this with the `left`
28683       // expression is because given an expression like `1 + 2 - 3`, it
28684       // is always parsed like `((1 + 2) - 3)`, meaning the `left` side
28685       // is where the rest of the expression will exist. Binary
28686       // expressions on the right side mean they have a difference
28687       // precedence level and should be treated as a separate group, so
28688       // print them normally. (This doesn't hold for the `**` operator,
28689       // which is unique in that it is right-associative.)
28690       if (shouldFlatten$1(node.operator, node.left.operator)) {
28691         // Flatten them out by recursively calling this function.
28692         parts = parts.concat(path.call(function (left) {
28693           return printBinaryishExpressions(left, print, options,
28694           /* isNested */
28695           true, isInsideParenthesis);
28696         }, "left"));
28697       } else {
28698         parts.push(path.call(print, "left"));
28699       }
28700
28701       var shouldInline = shouldInlineLogicalExpression(node);
28702       var lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment$1(options.originalText, node.right, options);
28703       var operator = node.type === "NGPipeExpression" ? "|" : node.operator;
28704       var rightSuffix = node.type === "NGPipeExpression" && node.arguments.length !== 0 ? group$b(indent$7(concat$d([softline$6, ": ", join$9(concat$d([softline$6, ":", ifBreak$6(" ")]), path.map(print, "arguments").map(function (arg) {
28705         return align$1(2, group$b(arg));
28706       }))]))) : "";
28707       var right = shouldInline ? concat$d([operator, " ", path.call(print, "right"), rightSuffix]) : concat$d([lineBeforeOperator ? softline$6 : "", operator, lineBeforeOperator ? " " : line$7, path.call(print, "right"), rightSuffix]); // If there's only a single binary expression, we want to create a group
28708       // in order to avoid having a small right part like -1 be on its own line.
28709
28710       var parent = path.getParentNode();
28711       var shouldGroup = !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
28712       parts.push(" ", shouldGroup ? group$b(right) : right); // The root comments are already printed, but we need to manually print
28713       // the other ones since we don't call the normal print on BinaryExpression,
28714       // only for the left and right parts
28715
28716       if (isNested && node.comments) {
28717         parts = comments.printComments(path, function () {
28718           return concat$d(parts);
28719         }, options);
28720       }
28721     } else {
28722       // Our stopping case. Simply print the node normally.
28723       parts.push(path.call(print));
28724     }
28725
28726     return parts;
28727   }
28728
28729   function printAssignmentRight(leftNode, rightNode, printedRight, options) {
28730     if (hasLeadingOwnLineComment$1(options.originalText, rightNode, options)) {
28731       return indent$7(concat$d([hardline$9, printedRight]));
28732     }
28733
28734     var canBreak = isBinaryish$1(rightNode) && !shouldInlineLogicalExpression(rightNode) || rightNode.type === "ConditionalExpression" && isBinaryish$1(rightNode.test) && !shouldInlineLogicalExpression(rightNode.test) || rightNode.type === "StringLiteralTypeAnnotation" || rightNode.type === "ClassExpression" && rightNode.decorators && rightNode.decorators.length || (leftNode.type === "Identifier" || isStringLiteral$1(leftNode) || leftNode.type === "MemberExpression") && (isStringLiteral$1(rightNode) || isMemberExpressionChain$1(rightNode)) && // do not put values on a separate line from the key in json
28735     options.parser !== "json" && options.parser !== "json5" || rightNode.type === "SequenceExpression";
28736
28737     if (canBreak) {
28738       return group$b(indent$7(concat$d([line$7, printedRight])));
28739     }
28740
28741     return concat$d([" ", printedRight]);
28742   }
28743
28744   function printAssignment(leftNode, printedLeft, operator, rightNode, printedRight, options) {
28745     if (!rightNode) {
28746       return printedLeft;
28747     }
28748
28749     var printed = printAssignmentRight(leftNode, rightNode, printedRight, options);
28750     return group$b(concat$d([printedLeft, operator, printed]));
28751   }
28752
28753   function adjustClause(node, clause, forceSpace) {
28754     if (node.type === "EmptyStatement") {
28755       return ";";
28756     }
28757
28758     if (node.type === "BlockStatement" || forceSpace) {
28759       return concat$d([" ", clause]);
28760     }
28761
28762     return indent$7(concat$d([line$7, clause]));
28763   }
28764
28765   function nodeStr(node, options, isFlowOrTypeScriptDirectiveLiteral) {
28766     var raw = rawText$1(node);
28767     var isDirectiveLiteral = isFlowOrTypeScriptDirectiveLiteral || node.type === "DirectiveLiteral";
28768     return printString$2(raw, options, isDirectiveLiteral);
28769   }
28770
28771   function printRegex(node) {
28772     var flags = node.flags.split("").sort().join("");
28773     return "/".concat(node.pattern, "/").concat(flags);
28774   }
28775
28776   function exprNeedsASIProtection(path, options) {
28777     var node = path.getValue();
28778     var maybeASIProblem = needsParens_1(path, options) || node.type === "ParenthesizedExpression" || node.type === "TypeCastExpression" || node.type === "ArrowFunctionExpression" && !shouldPrintParamsWithoutParens(path, options) || node.type === "ArrayExpression" || node.type === "ArrayPattern" || node.type === "UnaryExpression" && node.prefix && (node.operator === "+" || node.operator === "-") || node.type === "TemplateLiteral" || node.type === "TemplateElement" || isJSXNode$1(node) || node.type === "BindExpression" && !node.object || node.type === "RegExpLiteral" || node.type === "Literal" && node.pattern || node.type === "Literal" && node.regex;
28779
28780     if (maybeASIProblem) {
28781       return true;
28782     }
28783
28784     if (!hasNakedLeftSide$2(node)) {
28785       return false;
28786     }
28787
28788     return path.call.apply(path, [function (childPath) {
28789       return exprNeedsASIProtection(childPath, options);
28790     }].concat(getLeftSidePathName$2(path, node)));
28791   }
28792
28793   function stmtNeedsASIProtection(path, options) {
28794     var node = path.getNode();
28795
28796     if (node.type !== "ExpressionStatement") {
28797       return false;
28798     }
28799
28800     return path.call(function (childPath) {
28801       return exprNeedsASIProtection(childPath, options);
28802     }, "expression");
28803   }
28804
28805   function shouldHugType(node) {
28806     if (isSimpleFlowType$1(node) || isObjectType$1(node)) {
28807       return true;
28808     }
28809
28810     if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
28811       var voidCount = node.types.filter(function (n) {
28812         return n.type === "VoidTypeAnnotation" || n.type === "TSVoidKeyword" || n.type === "NullLiteralTypeAnnotation" || n.type === "TSNullKeyword";
28813       }).length;
28814       var objectCount = node.types.filter(function (n) {
28815         return n.type === "ObjectTypeAnnotation" || n.type === "TSTypeLiteral" || // This is a bit aggressive but captures Array<{x}>
28816         n.type === "GenericTypeAnnotation" || n.type === "TSTypeReference";
28817       }).length;
28818
28819       if (node.types.length - 1 === voidCount && objectCount > 0) {
28820         return true;
28821       }
28822     }
28823
28824     return false;
28825   }
28826
28827   function shouldHugArguments(fun) {
28828     return fun && fun.params && fun.params.length === 1 && !fun.params[0].comments && (fun.params[0].type === "ObjectPattern" || fun.params[0].type === "ArrayPattern" || fun.params[0].type === "Identifier" && fun.params[0].typeAnnotation && (fun.params[0].typeAnnotation.type === "TypeAnnotation" || fun.params[0].typeAnnotation.type === "TSTypeAnnotation") && isObjectType$1(fun.params[0].typeAnnotation.typeAnnotation) || fun.params[0].type === "FunctionTypeParam" && isObjectType$1(fun.params[0].typeAnnotation) || fun.params[0].type === "AssignmentPattern" && (fun.params[0].left.type === "ObjectPattern" || fun.params[0].left.type === "ArrayPattern") && (fun.params[0].right.type === "Identifier" || fun.params[0].right.type === "ObjectExpression" && fun.params[0].right.properties.length === 0 || fun.params[0].right.type === "ArrayExpression" && fun.params[0].right.elements.length === 0)) && !fun.rest;
28829   }
28830
28831   function printArrayItems(path, options, printPath, print) {
28832     var printedElements = [];
28833     var separatorParts = [];
28834     path.each(function (childPath) {
28835       printedElements.push(concat$d(separatorParts));
28836       printedElements.push(group$b(print(childPath)));
28837       separatorParts = [",", line$7];
28838
28839       if (childPath.getValue() && isNextLineEmpty$4(options.originalText, childPath.getValue(), options)) {
28840         separatorParts.push(softline$6);
28841       }
28842     }, printPath);
28843     return concat$d(printedElements);
28844   }
28845
28846   function willPrintOwnComments(path
28847   /*, options */
28848   ) {
28849     var node = path.getValue();
28850     var parent = path.getParentNode();
28851     return (node && (isJSXNode$1(node) || hasFlowShorthandAnnotationComment$2(node) || parent && (parent.type === "CallExpression" || parent.type === "OptionalCallExpression") && (hasFlowAnnotationComment$1(node.leadingComments) || hasFlowAnnotationComment$1(node.trailingComments))) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && !hasIgnoreComment$4(path);
28852   }
28853
28854   function canAttachComment$1(node) {
28855     return node.type && node.type !== "CommentBlock" && node.type !== "CommentLine" && node.type !== "Line" && node.type !== "Block" && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import";
28856   }
28857
28858   function printComment$2(commentPath, options) {
28859     var comment = commentPath.getValue();
28860
28861     switch (comment.type) {
28862       case "CommentBlock":
28863       case "Block":
28864         {
28865           if (isIndentableBlockComment(comment)) {
28866             var printed = printIndentableBlockComment(comment); // We need to prevent an edge case of a previous trailing comment
28867             // printed as a `lineSuffix` which causes the comments to be
28868             // interleaved. See https://github.com/prettier/prettier/issues/4412
28869
28870             if (comment.trailing && !hasNewline$4(options.originalText, options.locStart(comment), {
28871               backwards: true
28872             })) {
28873               return concat$d([hardline$9, printed]);
28874             }
28875
28876             return printed;
28877           }
28878
28879           var isInsideFlowComment = options.originalText.substr(options.locEnd(comment) - 3, 3) === "*-/";
28880           return "/*" + comment.value + (isInsideFlowComment ? "*-/" : "*/");
28881         }
28882
28883       case "CommentLine":
28884       case "Line":
28885         // Print shebangs with the proper comment characters
28886         if (options.originalText.slice(options.locStart(comment)).startsWith("#!")) {
28887           return "#!" + comment.value.trimRight();
28888         }
28889
28890         return "//" + comment.value.trimRight();
28891
28892       default:
28893         throw new Error("Not a comment: " + JSON.stringify(comment));
28894     }
28895   }
28896
28897   function isIndentableBlockComment(comment) {
28898     // If the comment has multiple lines and every line starts with a star
28899     // we can fix the indentation of each line. The stars in the `/*` and
28900     // `*/` delimiters are not included in the comment value, so add them
28901     // back first.
28902     var lines = "*".concat(comment.value, "*").split("\n");
28903     return lines.length > 1 && lines.every(function (line) {
28904       return line.trim()[0] === "*";
28905     });
28906   }
28907
28908   function printIndentableBlockComment(comment) {
28909     var lines = comment.value.split("\n");
28910     return concat$d(["/*", join$9(hardline$9, lines.map(function (line, index) {
28911       return index === 0 ? line.trimRight() : " " + (index < lines.length - 1 ? line.trim() : line.trimLeft());
28912     })), "*/"]);
28913   }
28914
28915   var printerEstree = {
28916     preprocess: preprocess_1$1,
28917     print: genericPrint$3,
28918     embed: embed_1$1,
28919     insertPragma: insertPragma$7,
28920     massageAstNode: clean_1$1,
28921     hasPrettierIgnore: hasPrettierIgnore$3,
28922     willPrintOwnComments: willPrintOwnComments,
28923     canAttachComment: canAttachComment$1,
28924     printComment: printComment$2,
28925     isBlockComment: comments$1.isBlockComment,
28926     handleComments: {
28927       ownLine: comments$1.handleOwnLineComment,
28928       endOfLine: comments$1.handleEndOfLineComment,
28929       remaining: comments$1.handleRemainingComment
28930     }
28931   };
28932
28933   var _require$$0$builders$7 = doc.builders,
28934       concat$e = _require$$0$builders$7.concat,
28935       hardline$a = _require$$0$builders$7.hardline,
28936       indent$8 = _require$$0$builders$7.indent,
28937       join$a = _require$$0$builders$7.join;
28938
28939   function genericPrint$4(path, options, print) {
28940     var node = path.getValue();
28941
28942     switch (node.type) {
28943       case "JsonRoot":
28944         return concat$e([path.call(print, "node"), hardline$a]);
28945
28946       case "ArrayExpression":
28947         return node.elements.length === 0 ? "[]" : concat$e(["[", indent$8(concat$e([hardline$a, join$a(concat$e([",", hardline$a]), path.map(print, "elements"))])), hardline$a, "]"]);
28948
28949       case "ObjectExpression":
28950         return node.properties.length === 0 ? "{}" : concat$e(["{", indent$8(concat$e([hardline$a, join$a(concat$e([",", hardline$a]), path.map(print, "properties"))])), hardline$a, "}"]);
28951
28952       case "ObjectProperty":
28953         return concat$e([path.call(print, "key"), ": ", path.call(print, "value")]);
28954
28955       case "UnaryExpression":
28956         return concat$e([node.operator === "+" ? "" : node.operator, path.call(print, "argument")]);
28957
28958       case "NullLiteral":
28959         return "null";
28960
28961       case "BooleanLiteral":
28962         return node.value ? "true" : "false";
28963
28964       case "StringLiteral":
28965       case "NumericLiteral":
28966         return JSON.stringify(node.value);
28967
28968       case "Identifier":
28969         return JSON.stringify(node.name);
28970
28971       default:
28972         /* istanbul ignore next */
28973         throw new Error("unknown type: " + JSON.stringify(node.type));
28974     }
28975   }
28976
28977   function clean$5(node, newNode
28978   /*, parent*/
28979   ) {
28980     delete newNode.start;
28981     delete newNode.end;
28982     delete newNode.extra;
28983     delete newNode.loc;
28984     delete newNode.comments;
28985     delete newNode.errors;
28986
28987     if (node.type === "Identifier") {
28988       return {
28989         type: "StringLiteral",
28990         value: node.name
28991       };
28992     }
28993
28994     if (node.type === "UnaryExpression" && node.operator === "+") {
28995       return newNode.argument;
28996     }
28997   }
28998
28999   var printerEstreeJson = {
29000     preprocess: preprocess_1$1,
29001     print: genericPrint$4,
29002     massageAstNode: clean$5
29003   };
29004
29005   var CATEGORY_JAVASCRIPT = "JavaScript"; // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js
29006
29007   var options$5 = {
29008     arrowParens: {
29009       since: "1.9.0",
29010       category: CATEGORY_JAVASCRIPT,
29011       type: "choice",
29012       default: "avoid",
29013       description: "Include parentheses around a sole arrow function parameter.",
29014       choices: [{
29015         value: "avoid",
29016         description: "Omit parens when possible. Example: `x => x`"
29017       }, {
29018         value: "always",
29019         description: "Always include parens. Example: `(x) => x`"
29020       }]
29021     },
29022     bracketSpacing: commonOptions.bracketSpacing,
29023     jsxBracketSameLine: {
29024       since: "0.17.0",
29025       category: CATEGORY_JAVASCRIPT,
29026       type: "boolean",
29027       default: false,
29028       description: "Put > on the last line instead of at a new line."
29029     },
29030     semi: {
29031       since: "1.0.0",
29032       category: CATEGORY_JAVASCRIPT,
29033       type: "boolean",
29034       default: true,
29035       description: "Print semicolons.",
29036       oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
29037     },
29038     singleQuote: commonOptions.singleQuote,
29039     jsxSingleQuote: {
29040       since: "1.15.0",
29041       category: CATEGORY_JAVASCRIPT,
29042       type: "boolean",
29043       default: false,
29044       description: "Use single quotes in JSX."
29045     },
29046     quoteProps: {
29047       since: "1.17.0",
29048       category: CATEGORY_JAVASCRIPT,
29049       type: "choice",
29050       default: "as-needed",
29051       description: "Change when properties in objects are quoted.",
29052       choices: [{
29053         value: "as-needed",
29054         description: "Only add quotes around object properties where required."
29055       }, {
29056         value: "consistent",
29057         description: "If at least one property in an object requires quotes, quote all properties."
29058       }, {
29059         value: "preserve",
29060         description: "Respect the input use of quotes in object properties."
29061       }]
29062     },
29063     trailingComma: {
29064       since: "0.0.0",
29065       category: CATEGORY_JAVASCRIPT,
29066       type: "choice",
29067       default: [{
29068         since: "0.0.0",
29069         value: false
29070       }, {
29071         since: "0.19.0",
29072         value: "none"
29073       }],
29074       description: "Print trailing commas wherever possible when multi-line.",
29075       choices: [{
29076         value: "none",
29077         description: "No trailing commas."
29078       }, {
29079         value: "es5",
29080         description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
29081       }, {
29082         value: "all",
29083         description: "Trailing commas wherever possible (including function arguments)."
29084       }, {
29085         value: true,
29086         deprecated: "0.19.0",
29087         redirect: "es5"
29088       }, {
29089         value: false,
29090         deprecated: "0.19.0",
29091         redirect: "none"
29092       }]
29093     }
29094   };
29095
29096   var name$9 = "JavaScript";
29097   var type$8 = "programming";
29098   var tmScope$8 = "source.js";
29099   var aceMode$8 = "javascript";
29100   var codemirrorMode$4 = "javascript";
29101   var codemirrorMimeType$4 = "text/javascript";
29102   var color$3 = "#f1e05a";
29103   var aliases$2 = [
29104         "js",
29105         "node"
29106   ];
29107   var extensions$8 = [
29108         ".js",
29109         "._js",
29110         ".bones",
29111         ".es",
29112         ".es6",
29113         ".frag",
29114         ".gs",
29115         ".jake",
29116         ".jsb",
29117         ".jscad",
29118         ".jsfl",
29119         ".jsm",
29120         ".jss",
29121         ".mjs",
29122         ".njs",
29123         ".pac",
29124         ".sjs",
29125         ".ssjs",
29126         ".xsjs",
29127         ".xsjslib"
29128   ];
29129   var filenames = [
29130         "Jakefile"
29131   ];
29132   var interpreters = [
29133         "chakra",
29134         "d8",
29135         "js",
29136         "node",
29137         "rhino",
29138         "v8",
29139         "v8-shell"
29140   ];
29141   var languageId$8 = 183;
29142   var JavaScript = {
29143         name: name$9,
29144         type: type$8,
29145         tmScope: tmScope$8,
29146         aceMode: aceMode$8,
29147         codemirrorMode: codemirrorMode$4,
29148         codemirrorMimeType: codemirrorMimeType$4,
29149         color: color$3,
29150         aliases: aliases$2,
29151         extensions: extensions$8,
29152         filenames: filenames,
29153         interpreters: interpreters,
29154         languageId: languageId$8
29155   };
29156
29157   var JavaScript$1 = /*#__PURE__*/Object.freeze({
29158     __proto__: null,
29159     name: name$9,
29160     type: type$8,
29161     tmScope: tmScope$8,
29162     aceMode: aceMode$8,
29163     codemirrorMode: codemirrorMode$4,
29164     codemirrorMimeType: codemirrorMimeType$4,
29165     color: color$3,
29166     aliases: aliases$2,
29167     extensions: extensions$8,
29168     filenames: filenames,
29169     interpreters: interpreters,
29170     languageId: languageId$8,
29171     'default': JavaScript
29172   });
29173
29174   var name$a = "JSX";
29175   var type$9 = "programming";
29176   var group$c = "JavaScript";
29177   var extensions$9 = [
29178         ".jsx"
29179   ];
29180   var tmScope$9 = "source.js.jsx";
29181   var aceMode$9 = "javascript";
29182   var codemirrorMode$5 = "jsx";
29183   var codemirrorMimeType$5 = "text/jsx";
29184   var languageId$9 = 178;
29185   var JSX = {
29186         name: name$a,
29187         type: type$9,
29188         group: group$c,
29189         extensions: extensions$9,
29190         tmScope: tmScope$9,
29191         aceMode: aceMode$9,
29192         codemirrorMode: codemirrorMode$5,
29193         codemirrorMimeType: codemirrorMimeType$5,
29194         languageId: languageId$9
29195   };
29196
29197   var JSX$1 = /*#__PURE__*/Object.freeze({
29198     __proto__: null,
29199     name: name$a,
29200     type: type$9,
29201     group: group$c,
29202     extensions: extensions$9,
29203     tmScope: tmScope$9,
29204     aceMode: aceMode$9,
29205     codemirrorMode: codemirrorMode$5,
29206     codemirrorMimeType: codemirrorMimeType$5,
29207     languageId: languageId$9,
29208     'default': JSX
29209   });
29210
29211   var name$b = "TypeScript";
29212   var type$a = "programming";
29213   var color$4 = "#2b7489";
29214   var aliases$3 = [
29215         "ts"
29216   ];
29217   var interpreters$1 = [
29218         "deno",
29219         "ts-node"
29220   ];
29221   var extensions$a = [
29222         ".ts"
29223   ];
29224   var tmScope$a = "source.ts";
29225   var aceMode$a = "typescript";
29226   var codemirrorMode$6 = "javascript";
29227   var codemirrorMimeType$6 = "application/typescript";
29228   var languageId$a = 378;
29229   var TypeScript = {
29230         name: name$b,
29231         type: type$a,
29232         color: color$4,
29233         aliases: aliases$3,
29234         interpreters: interpreters$1,
29235         extensions: extensions$a,
29236         tmScope: tmScope$a,
29237         aceMode: aceMode$a,
29238         codemirrorMode: codemirrorMode$6,
29239         codemirrorMimeType: codemirrorMimeType$6,
29240         languageId: languageId$a
29241   };
29242
29243   var TypeScript$1 = /*#__PURE__*/Object.freeze({
29244     __proto__: null,
29245     name: name$b,
29246     type: type$a,
29247     color: color$4,
29248     aliases: aliases$3,
29249     interpreters: interpreters$1,
29250     extensions: extensions$a,
29251     tmScope: tmScope$a,
29252     aceMode: aceMode$a,
29253     codemirrorMode: codemirrorMode$6,
29254     codemirrorMimeType: codemirrorMimeType$6,
29255     languageId: languageId$a,
29256     'default': TypeScript
29257   });
29258
29259   var name$c = "TSX";
29260   var type$b = "programming";
29261   var group$d = "TypeScript";
29262   var extensions$b = [
29263         ".tsx"
29264   ];
29265   var tmScope$b = "source.tsx";
29266   var aceMode$b = "javascript";
29267   var codemirrorMode$7 = "jsx";
29268   var codemirrorMimeType$7 = "text/jsx";
29269   var languageId$b = 94901924;
29270   var TSX = {
29271         name: name$c,
29272         type: type$b,
29273         group: group$d,
29274         extensions: extensions$b,
29275         tmScope: tmScope$b,
29276         aceMode: aceMode$b,
29277         codemirrorMode: codemirrorMode$7,
29278         codemirrorMimeType: codemirrorMimeType$7,
29279         languageId: languageId$b
29280   };
29281
29282   var TSX$1 = /*#__PURE__*/Object.freeze({
29283     __proto__: null,
29284     name: name$c,
29285     type: type$b,
29286     group: group$d,
29287     extensions: extensions$b,
29288     tmScope: tmScope$b,
29289     aceMode: aceMode$b,
29290     codemirrorMode: codemirrorMode$7,
29291     codemirrorMimeType: codemirrorMimeType$7,
29292     languageId: languageId$b,
29293     'default': TSX
29294   });
29295
29296   var name$d = "JSON";
29297   var type$c = "data";
29298   var tmScope$c = "source.json";
29299   var aceMode$c = "json";
29300   var codemirrorMode$8 = "javascript";
29301   var codemirrorMimeType$8 = "application/json";
29302   var searchable = false;
29303   var extensions$c = [
29304         ".json",
29305         ".avsc",
29306         ".geojson",
29307         ".gltf",
29308         ".har",
29309         ".ice",
29310         ".JSON-tmLanguage",
29311         ".jsonl",
29312         ".mcmeta",
29313         ".tfstate",
29314         ".tfstate.backup",
29315         ".topojson",
29316         ".webapp",
29317         ".webmanifest",
29318         ".yy",
29319         ".yyp"
29320   ];
29321   var filenames$1 = [
29322         ".arcconfig",
29323         ".htmlhintrc",
29324         ".tern-config",
29325         ".tern-project",
29326         ".watchmanconfig",
29327         "composer.lock",
29328         "mcmod.info"
29329   ];
29330   var languageId$c = 174;
29331   var _JSON = {
29332         name: name$d,
29333         type: type$c,
29334         tmScope: tmScope$c,
29335         aceMode: aceMode$c,
29336         codemirrorMode: codemirrorMode$8,
29337         codemirrorMimeType: codemirrorMimeType$8,
29338         searchable: searchable,
29339         extensions: extensions$c,
29340         filenames: filenames$1,
29341         languageId: languageId$c
29342   };
29343
29344   var _JSON$1 = /*#__PURE__*/Object.freeze({
29345     __proto__: null,
29346     name: name$d,
29347     type: type$c,
29348     tmScope: tmScope$c,
29349     aceMode: aceMode$c,
29350     codemirrorMode: codemirrorMode$8,
29351     codemirrorMimeType: codemirrorMimeType$8,
29352     searchable: searchable,
29353     extensions: extensions$c,
29354     filenames: filenames$1,
29355     languageId: languageId$c,
29356     'default': _JSON
29357   });
29358
29359   var name$e = "JSON with Comments";
29360   var type$d = "data";
29361   var group$e = "JSON";
29362   var tmScope$d = "source.js";
29363   var aceMode$d = "javascript";
29364   var codemirrorMode$9 = "javascript";
29365   var codemirrorMimeType$9 = "text/javascript";
29366   var aliases$4 = [
29367         "jsonc"
29368   ];
29369   var extensions$d = [
29370         ".sublime-build",
29371         ".sublime-commands",
29372         ".sublime-completions",
29373         ".sublime-keymap",
29374         ".sublime-macro",
29375         ".sublime-menu",
29376         ".sublime-mousemap",
29377         ".sublime-project",
29378         ".sublime-settings",
29379         ".sublime-theme",
29380         ".sublime-workspace",
29381         ".sublime_metrics",
29382         ".sublime_session"
29383   ];
29384   var filenames$2 = [
29385         ".babelrc",
29386         ".eslintrc.json",
29387         ".jscsrc",
29388         ".jshintrc",
29389         ".jslintrc",
29390         "jsconfig.json",
29391         "language-configuration.json",
29392         "tsconfig.json"
29393   ];
29394   var languageId$d = 423;
29395   var JSON_with_Comments = {
29396         name: name$e,
29397         type: type$d,
29398         group: group$e,
29399         tmScope: tmScope$d,
29400         aceMode: aceMode$d,
29401         codemirrorMode: codemirrorMode$9,
29402         codemirrorMimeType: codemirrorMimeType$9,
29403         aliases: aliases$4,
29404         extensions: extensions$d,
29405         filenames: filenames$2,
29406         languageId: languageId$d
29407   };
29408
29409   var JSON_with_Comments$1 = /*#__PURE__*/Object.freeze({
29410     __proto__: null,
29411     name: name$e,
29412     type: type$d,
29413     group: group$e,
29414     tmScope: tmScope$d,
29415     aceMode: aceMode$d,
29416     codemirrorMode: codemirrorMode$9,
29417     codemirrorMimeType: codemirrorMimeType$9,
29418     aliases: aliases$4,
29419     extensions: extensions$d,
29420     filenames: filenames$2,
29421     languageId: languageId$d,
29422     'default': JSON_with_Comments
29423   });
29424
29425   var name$f = "JSON5";
29426   var type$e = "data";
29427   var extensions$e = [
29428         ".json5"
29429   ];
29430   var tmScope$e = "source.js";
29431   var aceMode$e = "javascript";
29432   var codemirrorMode$a = "javascript";
29433   var codemirrorMimeType$a = "application/json";
29434   var languageId$e = 175;
29435   var JSON5 = {
29436         name: name$f,
29437         type: type$e,
29438         extensions: extensions$e,
29439         tmScope: tmScope$e,
29440         aceMode: aceMode$e,
29441         codemirrorMode: codemirrorMode$a,
29442         codemirrorMimeType: codemirrorMimeType$a,
29443         languageId: languageId$e
29444   };
29445
29446   var JSON5$1 = /*#__PURE__*/Object.freeze({
29447     __proto__: null,
29448     name: name$f,
29449     type: type$e,
29450     extensions: extensions$e,
29451     tmScope: tmScope$e,
29452     aceMode: aceMode$e,
29453     codemirrorMode: codemirrorMode$a,
29454     codemirrorMimeType: codemirrorMimeType$a,
29455     languageId: languageId$e,
29456     'default': JSON5
29457   });
29458
29459   var require$$0$6 = getCjsExportFromNamespace(JavaScript$1);
29460
29461   var require$$1$2 = getCjsExportFromNamespace(JSX$1);
29462
29463   var require$$2$1 = getCjsExportFromNamespace(TypeScript$1);
29464
29465   var require$$3$1 = getCjsExportFromNamespace(TSX$1);
29466
29467   var require$$4 = getCjsExportFromNamespace(_JSON$1);
29468
29469   var require$$5 = getCjsExportFromNamespace(JSON_with_Comments$1);
29470
29471   var require$$6 = getCjsExportFromNamespace(JSON5$1);
29472
29473   var languages$4 = [createLanguage(require$$0$6, function (data) {
29474     return Object.assign(data, {
29475       since: "0.0.0",
29476       parsers: ["babel", "flow"],
29477       vscodeLanguageIds: ["javascript", "mongo"],
29478       interpreters: data.interpreters.concat(["nodejs"])
29479     });
29480   }), createLanguage(require$$0$6, function (data) {
29481     return Object.assign(data, {
29482       name: "Flow",
29483       since: "0.0.0",
29484       parsers: ["babel", "flow"],
29485       vscodeLanguageIds: ["javascript"],
29486       aliases: [],
29487       filenames: [],
29488       extensions: [".js.flow"]
29489     });
29490   }), createLanguage(require$$1$2, function (data) {
29491     return Object.assign(data, {
29492       since: "0.0.0",
29493       parsers: ["babel", "flow"],
29494       vscodeLanguageIds: ["javascriptreact"]
29495     });
29496   }), createLanguage(require$$2$1, function (data) {
29497     return Object.assign(data, {
29498       since: "1.4.0",
29499       parsers: ["typescript"],
29500       vscodeLanguageIds: ["typescript"]
29501     });
29502   }), createLanguage(require$$3$1, function (data) {
29503     return Object.assign(data, {
29504       since: "1.4.0",
29505       parsers: ["typescript"],
29506       vscodeLanguageIds: ["typescriptreact"]
29507     });
29508   }), createLanguage(require$$4, function (data) {
29509     return Object.assign(data, {
29510       name: "JSON.stringify",
29511       since: "1.13.0",
29512       parsers: ["json-stringify"],
29513       vscodeLanguageIds: ["json"],
29514       extensions: [],
29515       // .json file defaults to json instead of json-stringify
29516       filenames: ["package.json", "package-lock.json", "composer.json"]
29517     });
29518   }), createLanguage(require$$4, function (data) {
29519     return Object.assign(data, {
29520       since: "1.5.0",
29521       parsers: ["json"],
29522       vscodeLanguageIds: ["json"],
29523       filenames: data.filenames.concat([".prettierrc"])
29524     });
29525   }), createLanguage(require$$5, function (data) {
29526     return Object.assign(data, {
29527       since: "1.5.0",
29528       parsers: ["json"],
29529       vscodeLanguageIds: ["jsonc"],
29530       filenames: data.filenames.concat([".eslintrc"])
29531     });
29532   }), createLanguage(require$$6, function (data) {
29533     return Object.assign(data, {
29534       since: "1.13.0",
29535       parsers: ["json5"],
29536       vscodeLanguageIds: ["json5"]
29537     });
29538   })];
29539   var printers$4 = {
29540     estree: printerEstree,
29541     "estree-json": printerEstreeJson
29542   };
29543   var languageJs = {
29544     languages: languages$4,
29545     options: options$5,
29546     printers: printers$4
29547   };
29548
29549   var json$1 = {
29550     "cjkPattern": "[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u3000-\\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]",
29551     "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]",
29552     "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]"
29553   };
29554
29555   var cjkPattern = json$1.cjkPattern,
29556       kPattern = json$1.kPattern,
29557       punctuationPattern = json$1.punctuationPattern;
29558   var getLast$3 = util.getLast;
29559   var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "strong", "delete", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
29560   var INLINE_NODE_WRAPPER_TYPES = INLINE_NODE_TYPES.concat(["tableCell", "paragraph", "heading"]);
29561   var kRegex = new RegExp(kPattern);
29562   var punctuationRegex = new RegExp(punctuationPattern);
29563   /**
29564    * split text into whitespaces and words
29565    * @param {string} text
29566    * @return {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>}
29567    */
29568
29569   function splitText(text, options) {
29570     var KIND_NON_CJK = "non-cjk";
29571     var KIND_CJ_LETTER = "cj-letter";
29572     var KIND_K_LETTER = "k-letter";
29573     var KIND_CJK_PUNCTUATION = "cjk-punctuation";
29574     var nodes = [];
29575     (options.proseWrap === "preserve" ? text : text.replace(new RegExp("(".concat(cjkPattern, ")\n(").concat(cjkPattern, ")"), "g"), "$1$2")).split(/([ \t\n]+)/).forEach(function (token, index, tokens) {
29576       // whitespace
29577       if (index % 2 === 1) {
29578         nodes.push({
29579           type: "whitespace",
29580           value: /\n/.test(token) ? "\n" : " "
29581         });
29582         return;
29583       } // word separated by whitespace
29584
29585
29586       if ((index === 0 || index === tokens.length - 1) && token === "") {
29587         return;
29588       }
29589
29590       token.split(new RegExp("(".concat(cjkPattern, ")"))).forEach(function (innerToken, innerIndex, innerTokens) {
29591         if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
29592           return;
29593         } // non-CJK word
29594
29595
29596         if (innerIndex % 2 === 0) {
29597           if (innerToken !== "") {
29598             appendNode({
29599               type: "word",
29600               value: innerToken,
29601               kind: KIND_NON_CJK,
29602               hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
29603               hasTrailingPunctuation: punctuationRegex.test(getLast$3(innerToken))
29604             });
29605           }
29606
29607           return;
29608         } // CJK character
29609
29610
29611         appendNode(punctuationRegex.test(innerToken) ? {
29612           type: "word",
29613           value: innerToken,
29614           kind: KIND_CJK_PUNCTUATION,
29615           hasLeadingPunctuation: true,
29616           hasTrailingPunctuation: true
29617         } : {
29618           type: "word",
29619           value: innerToken,
29620           kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
29621           hasLeadingPunctuation: false,
29622           hasTrailingPunctuation: false
29623         });
29624       });
29625     });
29626     return nodes;
29627
29628     function appendNode(node) {
29629       var lastNode = getLast$3(nodes);
29630
29631       if (lastNode && lastNode.type === "word") {
29632         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) {
29633           nodes.push({
29634             type: "whitespace",
29635             value: " "
29636           });
29637         } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && // disallow leading/trailing full-width whitespace
29638         ![lastNode.value, node.value].some(function (value) {
29639           return /\u3000/.test(value);
29640         })) {
29641           nodes.push({
29642             type: "whitespace",
29643             value: ""
29644           });
29645         }
29646       }
29647
29648       nodes.push(node);
29649
29650       function isBetween(kind1, kind2) {
29651         return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
29652       }
29653     }
29654   }
29655
29656   function getOrderedListItemInfo(orderListItem, originalText) {
29657     var _originalText$slice$m = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/),
29658         _originalText$slice$m2 = _slicedToArray(_originalText$slice$m, 4),
29659         numberText = _originalText$slice$m2[1],
29660         marker = _originalText$slice$m2[2],
29661         leadingSpaces = _originalText$slice$m2[3];
29662
29663     return {
29664       numberText: numberText,
29665       marker: marker,
29666       leadingSpaces: leadingSpaces
29667     };
29668   } // workaround for https://github.com/remarkjs/remark/issues/351
29669   // leading and trailing newlines are stripped by remark
29670
29671
29672   function getFencedCodeBlockValue(node, originalText) {
29673     var text = originalText.slice(node.position.start.offset, node.position.end.offset);
29674     var leadingSpaceCount = text.match(/^\s*/)[0].length;
29675     var replaceRegex = new RegExp("^\\s{0,".concat(leadingSpaceCount, "}"));
29676     var lineContents = text.split("\n");
29677     var markerStyle = text[leadingSpaceCount]; // ` or ~
29678
29679     var marker = text.slice(leadingSpaceCount).match(new RegExp("^[".concat(markerStyle, "]+")))[0]; // https://spec.commonmark.org/0.28/#example-104: Closing fences may be indented by 0-3 spaces
29680     // https://spec.commonmark.org/0.28/#example-93: The closing code fence must be at least as long as the opening fence
29681
29682     var hasEndMarker = new RegExp("^\\s{0,3}".concat(marker)).test(lineContents[lineContents.length - 1].slice(getIndent(lineContents.length - 1)));
29683     return lineContents.slice(1, hasEndMarker ? -1 : undefined).map(function (x, i) {
29684       return x.slice(getIndent(i + 1)).replace(replaceRegex, "");
29685     }).join("\n");
29686
29687     function getIndent(lineIndex) {
29688       return node.position.indent[lineIndex - 1] - 1;
29689     }
29690   }
29691
29692   function mapAst(ast, handler) {
29693     return function preorder(node, index, parentStack) {
29694       parentStack = parentStack || [];
29695       var newNode = handler(node, index, parentStack);
29696
29697       if (Array.isArray(newNode)) {
29698         return newNode;
29699       }
29700
29701       newNode = Object.assign({}, newNode);
29702
29703       if (newNode.children) {
29704         newNode.children = newNode.children.reduce(function (nodes, child, index) {
29705           var newNodes = preorder(child, index, [newNode].concat(parentStack));
29706
29707           if (!Array.isArray(newNodes)) {
29708             newNodes = [newNodes];
29709           }
29710
29711           nodes.push.apply(nodes, newNodes);
29712           return nodes;
29713         }, []);
29714       }
29715
29716       return newNode;
29717     }(ast, null, null);
29718   }
29719
29720   var utils$5 = {
29721     mapAst: mapAst,
29722     splitText: splitText,
29723     punctuationPattern: punctuationPattern,
29724     getFencedCodeBlockValue: getFencedCodeBlockValue,
29725     getOrderedListItemInfo: getOrderedListItemInfo,
29726     INLINE_NODE_TYPES: INLINE_NODE_TYPES,
29727     INLINE_NODE_WRAPPER_TYPES: INLINE_NODE_WRAPPER_TYPES
29728   };
29729
29730   var _require$$0$builders$8 = doc.builders,
29731       hardline$b = _require$$0$builders$8.hardline,
29732       literalline$5 = _require$$0$builders$8.literalline,
29733       concat$f = _require$$0$builders$8.concat,
29734       markAsRoot$3 = _require$$0$builders$8.markAsRoot,
29735       mapDoc$6 = doc.utils.mapDoc;
29736   var getFencedCodeBlockValue$1 = utils$5.getFencedCodeBlockValue;
29737
29738   function embed$4(path, print, textToDoc, options) {
29739     var node = path.getValue();
29740
29741     if (node.type === "code" && node.lang !== null) {
29742       // only look for the first string so as to support [markdown-preview-enhanced](https://shd101wyy.github.io/markdown-preview-enhanced/#/code-chunk)
29743       var langMatch = node.lang.match(/^[A-Za-z0-9_-]+/);
29744       var lang = langMatch ? langMatch[0] : "";
29745       var parser = getParserName(lang);
29746
29747       if (parser) {
29748         var styleUnit = options.__inJsTemplate ? "~" : "`";
29749         var style = styleUnit.repeat(Math.max(3, util.getMaxContinuousCount(node.value, styleUnit) + 1));
29750         var doc = textToDoc(getFencedCodeBlockValue$1(node, options.originalText), {
29751           parser: parser
29752         });
29753         return markAsRoot$3(concat$f([style, node.lang, hardline$b, replaceNewlinesWithLiterallines(doc), style]));
29754       }
29755     }
29756
29757     if (node.type === "yaml") {
29758       return markAsRoot$3(concat$f(["---", hardline$b, node.value && node.value.trim() ? replaceNewlinesWithLiterallines(textToDoc(node.value, {
29759         parser: "yaml"
29760       })) : "", "---"]));
29761     } // MDX
29762
29763
29764     switch (node.type) {
29765       case "importExport":
29766         return textToDoc(node.value, {
29767           parser: "babel"
29768         });
29769
29770       case "jsx":
29771         return textToDoc(node.value, {
29772           parser: "__js_expression"
29773         });
29774     }
29775
29776     return null;
29777
29778     function getParserName(lang) {
29779       var supportInfo = support.getSupportInfo(null, {
29780         plugins: options.plugins
29781       });
29782       var language = supportInfo.languages.find(function (language) {
29783         return language.name.toLowerCase() === lang || language.aliases && language.aliases.indexOf(lang) !== -1 || language.extensions && language.extensions.find(function (ext) {
29784           return ext.substring(1) === lang;
29785         });
29786       });
29787
29788       if (language) {
29789         return language.parsers[0];
29790       }
29791
29792       return null;
29793     }
29794
29795     function replaceNewlinesWithLiterallines(doc) {
29796       return mapDoc$6(doc, function (currentDoc) {
29797         return typeof currentDoc === "string" && currentDoc.includes("\n") ? concat$f(currentDoc.split(/(\n)/g).map(function (v, i) {
29798           return i % 2 === 0 ? v : literalline$5;
29799         })) : currentDoc;
29800       });
29801     }
29802   }
29803
29804   var embed_1$2 = embed$4;
29805
29806   var pragmas = ["format", "prettier"];
29807
29808   function startWithPragma(text) {
29809     var pragma = "@(".concat(pragmas.join("|"), ")");
29810     var regex = new RegExp(["<!--\\s*".concat(pragma, "\\s*-->"), "<!--.*\r?\n[\\s\\S]*(^|\n)[^\\S\n]*".concat(pragma, "[^\\S\n]*($|\n)[\\s\\S]*\n.*-->")].join("|"), "m");
29811     var matched = text.match(regex);
29812     return matched && matched.index === 0;
29813   }
29814
29815   var pragma$4 = {
29816     startWithPragma: startWithPragma,
29817     hasPragma: function hasPragma(text) {
29818       return startWithPragma(frontMatter(text).content.trimLeft());
29819     },
29820     insertPragma: function insertPragma(text) {
29821       var extracted = frontMatter(text);
29822       var pragma = "<!-- @".concat(pragmas[0], " -->");
29823       return extracted.frontMatter ? "".concat(extracted.frontMatter.raw, "\n\n").concat(pragma, "\n\n").concat(extracted.content) : "".concat(pragma, "\n\n").concat(extracted.content);
29824     }
29825   };
29826
29827   var getOrderedListItemInfo$1 = utils$5.getOrderedListItemInfo,
29828       mapAst$1 = utils$5.mapAst,
29829       splitText$1 = utils$5.splitText; // 0x0 ~ 0x10ffff
29830   // eslint-disable-next-line no-control-regex
29831
29832   var isSingleCharRegex = /^([\u0000-\uffff]|[\ud800-\udbff][\udc00-\udfff])$/;
29833
29834   function preprocess$2(ast, options) {
29835     ast = restoreUnescapedCharacter(ast, options);
29836     ast = mergeContinuousTexts(ast);
29837     ast = transformInlineCode(ast);
29838     ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
29839     ast = markAlignedList(ast, options);
29840     ast = splitTextIntoSentences(ast, options);
29841     ast = transformImportExport(ast);
29842     ast = mergeContinuousImportExport(ast);
29843     return ast;
29844   }
29845
29846   function transformImportExport(ast) {
29847     return mapAst$1(ast, function (node) {
29848       if (node.type !== "import" && node.type !== "export") {
29849         return node;
29850       }
29851
29852       return Object.assign({}, node, {
29853         type: "importExport"
29854       });
29855     });
29856   }
29857
29858   function transformInlineCode(ast) {
29859     return mapAst$1(ast, function (node) {
29860       if (node.type !== "inlineCode") {
29861         return node;
29862       }
29863
29864       return Object.assign({}, node, {
29865         value: node.value.replace(/\s+/g, " ")
29866       });
29867     });
29868   }
29869
29870   function restoreUnescapedCharacter(ast, options) {
29871     return mapAst$1(ast, function (node) {
29872       return node.type !== "text" ? node : Object.assign({}, node, {
29873         value: node.value !== "*" && node.value !== "_" && node.value !== "$" && // handle these cases in printer
29874         isSingleCharRegex.test(node.value) && node.position.end.offset - node.position.start.offset !== node.value.length ? options.originalText.slice(node.position.start.offset, node.position.end.offset) : node.value
29875       });
29876     });
29877   }
29878
29879   function mergeContinuousImportExport(ast) {
29880     return mergeChildren(ast, function (prevNode, node) {
29881       return prevNode.type === "importExport" && node.type === "importExport";
29882     }, function (prevNode, node) {
29883       return {
29884         type: "importExport",
29885         value: prevNode.value + "\n\n" + node.value,
29886         position: {
29887           start: prevNode.position.start,
29888           end: node.position.end
29889         }
29890       };
29891     });
29892   }
29893
29894   function mergeChildren(ast, shouldMerge, mergeNode) {
29895     return mapAst$1(ast, function (node) {
29896       if (!node.children) {
29897         return node;
29898       }
29899
29900       var children = node.children.reduce(function (current, child) {
29901         var lastChild = current[current.length - 1];
29902
29903         if (lastChild && shouldMerge(lastChild, child)) {
29904           current.splice(-1, 1, mergeNode(lastChild, child));
29905         } else {
29906           current.push(child);
29907         }
29908
29909         return current;
29910       }, []);
29911       return Object.assign({}, node, {
29912         children: children
29913       });
29914     });
29915   }
29916
29917   function mergeContinuousTexts(ast) {
29918     return mergeChildren(ast, function (prevNode, node) {
29919       return prevNode.type === "text" && node.type === "text";
29920     }, function (prevNode, node) {
29921       return {
29922         type: "text",
29923         value: prevNode.value + node.value,
29924         position: {
29925           start: prevNode.position.start,
29926           end: node.position.end
29927         }
29928       };
29929     });
29930   }
29931
29932   function splitTextIntoSentences(ast, options) {
29933     return mapAst$1(ast, function (node, index, _ref) {
29934       var _ref2 = _slicedToArray(_ref, 1),
29935           parentNode = _ref2[0];
29936
29937       if (node.type !== "text") {
29938         return node;
29939       }
29940
29941       var value = node.value;
29942
29943       if (parentNode.type === "paragraph") {
29944         if (index === 0) {
29945           value = value.trimLeft();
29946         }
29947
29948         if (index === parentNode.children.length - 1) {
29949           value = value.trimRight();
29950         }
29951       }
29952
29953       return {
29954         type: "sentence",
29955         position: node.position,
29956         children: splitText$1(value, options)
29957       };
29958     });
29959   }
29960
29961   function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
29962     return mapAst$1(ast, function (node, index, parentStack) {
29963       if (node.type === "code") {
29964         // the first char may point to `\n`, e.g. `\n\t\tbar`, just ignore it
29965         var isIndented = /^\n?( {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
29966         node.isIndented = isIndented;
29967
29968         if (isIndented) {
29969           for (var i = 0; i < parentStack.length; i++) {
29970             var parent = parentStack[i]; // no need to check checked items
29971
29972             if (parent.hasIndentedCodeblock) {
29973               break;
29974             }
29975
29976             if (parent.type === "list") {
29977               parent.hasIndentedCodeblock = true;
29978             }
29979           }
29980         }
29981       }
29982
29983       return node;
29984     });
29985   }
29986
29987   function markAlignedList(ast, options) {
29988     return mapAst$1(ast, function (node, index, parentStack) {
29989       if (node.type === "list" && node.children.length !== 0) {
29990         // if one of its parents is not aligned, it's not possible to be aligned in sub-lists
29991         for (var i = 0; i < parentStack.length; i++) {
29992           var parent = parentStack[i];
29993
29994           if (parent.type === "list" && !parent.isAligned) {
29995             node.isAligned = false;
29996             return node;
29997           }
29998         }
29999
30000         node.isAligned = isAligned(node);
30001       }
30002
30003       return node;
30004     });
30005
30006     function getListItemStart(listItem) {
30007       return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
30008     }
30009
30010     function isAligned(list) {
30011       if (!list.ordered) {
30012         /**
30013          * - 123
30014          * - 123
30015          */
30016         return true;
30017       }
30018
30019       var _list$children = _slicedToArray(list.children, 2),
30020           firstItem = _list$children[0],
30021           secondItem = _list$children[1];
30022
30023       var firstInfo = getOrderedListItemInfo$1(firstItem, options.originalText);
30024
30025       if (firstInfo.leadingSpaces.length > 1) {
30026         /**
30027          * 1.   123
30028          *
30029          * 1.   123
30030          * 1. 123
30031          */
30032         return true;
30033       }
30034
30035       var firstStart = getListItemStart(firstItem);
30036
30037       if (firstStart === -1) {
30038         /**
30039          * 1.
30040          *
30041          * 1.
30042          * 1.
30043          */
30044         return false;
30045       }
30046
30047       if (list.children.length === 1) {
30048         /**
30049          * aligned:
30050          *
30051          * 11. 123
30052          *
30053          * not aligned:
30054          *
30055          * 1. 123
30056          */
30057         return firstStart % options.tabWidth === 0;
30058       }
30059
30060       var secondStart = getListItemStart(secondItem);
30061
30062       if (firstStart !== secondStart) {
30063         /**
30064          * 11. 123
30065          * 1. 123
30066          *
30067          * 1. 123
30068          * 11. 123
30069          */
30070         return false;
30071       }
30072
30073       if (firstStart % options.tabWidth === 0) {
30074         /**
30075          * 11. 123
30076          * 12. 123
30077          */
30078         return true;
30079       }
30080       /**
30081        * aligned:
30082        *
30083        * 11. 123
30084        * 1.  123
30085        *
30086        * not aligned:
30087        *
30088        * 1. 123
30089        * 2. 123
30090        */
30091
30092
30093       var secondInfo = getOrderedListItemInfo$1(secondItem, options.originalText);
30094       return secondInfo.leadingSpaces.length > 1;
30095     }
30096   }
30097
30098   var preprocess_1$2 = preprocess$2;
30099
30100   var _require$$0$builders$9 = doc.builders,
30101       breakParent$4 = _require$$0$builders$9.breakParent,
30102       concat$g = _require$$0$builders$9.concat,
30103       join$b = _require$$0$builders$9.join,
30104       line$8 = _require$$0$builders$9.line,
30105       literalline$6 = _require$$0$builders$9.literalline,
30106       markAsRoot$4 = _require$$0$builders$9.markAsRoot,
30107       hardline$c = _require$$0$builders$9.hardline,
30108       softline$7 = _require$$0$builders$9.softline,
30109       ifBreak$7 = _require$$0$builders$9.ifBreak,
30110       fill$5 = _require$$0$builders$9.fill,
30111       align$2 = _require$$0$builders$9.align,
30112       indent$9 = _require$$0$builders$9.indent,
30113       group$f = _require$$0$builders$9.group,
30114       mapDoc$7 = doc.utils.mapDoc,
30115       printDocToString$2 = doc.printer.printDocToString;
30116   var getFencedCodeBlockValue$2 = utils$5.getFencedCodeBlockValue,
30117       getOrderedListItemInfo$2 = utils$5.getOrderedListItemInfo,
30118       splitText$2 = utils$5.splitText,
30119       punctuationPattern$1 = utils$5.punctuationPattern,
30120       INLINE_NODE_TYPES$1 = utils$5.INLINE_NODE_TYPES,
30121       INLINE_NODE_WRAPPER_TYPES$1 = utils$5.INLINE_NODE_WRAPPER_TYPES;
30122   var replaceEndOfLineWith$2 = util.replaceEndOfLineWith;
30123   var TRAILING_HARDLINE_NODES = ["importExport"];
30124   var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link"];
30125   var SIBLING_NODE_TYPES = ["listItem", "definition", "footnoteDefinition", "jsx"];
30126
30127   function genericPrint$5(path, options, print) {
30128     var node = path.getValue();
30129
30130     if (shouldRemainTheSameContent(path)) {
30131       return concat$g(splitText$2(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map(function (node) {
30132         return node.type === "word" ? node.value : node.value === "" ? "" : printLine(path, node.value, options);
30133       }));
30134     }
30135
30136     switch (node.type) {
30137       case "root":
30138         if (node.children.length === 0) {
30139           return "";
30140         }
30141
30142         return concat$g([normalizeDoc(printRoot(path, options, print)), TRAILING_HARDLINE_NODES.indexOf(getLastDescendantNode(node).type) === -1 ? hardline$c : ""]);
30143
30144       case "paragraph":
30145         return printChildren$2(path, options, print, {
30146           postprocessor: fill$5
30147         });
30148
30149       case "sentence":
30150         return printChildren$2(path, options, print);
30151
30152       case "word":
30153         return node.value.replace(/[*$]/g, "\\$&") // escape all `*` and `$` (math)
30154         .replace(new RegExp(["(^|".concat(punctuationPattern$1, ")(_+)"), "(_+)(".concat(punctuationPattern$1, "|$)")].join("|"), "g"), function (_, text1, underscore1, underscore2, text2) {
30155           return (underscore1 ? "".concat(text1).concat(underscore1) : "".concat(underscore2).concat(text2)).replace(/_/g, "\\_");
30156         });
30157       // escape all `_` except concating with non-punctuation, e.g. `1_2_3` is not considered emphasis
30158
30159       case "whitespace":
30160         {
30161           var parentNode = path.getParentNode();
30162           var index = parentNode.children.indexOf(node);
30163           var nextNode = parentNode.children[index + 1];
30164           var proseWrap = // leading char that may cause different syntax
30165           nextNode && /^>|^([-+*]|#{1,6}|[0-9]+[.)])$/.test(nextNode.value) ? "never" : options.proseWrap;
30166           return printLine(path, node.value, {
30167             proseWrap: proseWrap
30168           });
30169         }
30170
30171       case "emphasis":
30172         {
30173           var _parentNode = path.getParentNode();
30174
30175           var _index = _parentNode.children.indexOf(node);
30176
30177           var prevNode = _parentNode.children[_index - 1];
30178           var _nextNode = _parentNode.children[_index + 1];
30179           var hasPrevOrNextWord = // `1*2*3` is considered emphasis but `1_2_3` is not
30180           prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && util.getLast(prevNode.children).type === "word" && !util.getLast(prevNode.children).hasTrailingPunctuation || _nextNode && _nextNode.type === "sentence" && _nextNode.children.length > 0 && _nextNode.children[0].type === "word" && !_nextNode.children[0].hasLeadingPunctuation;
30181           var style = hasPrevOrNextWord || getAncestorNode$2(path, "emphasis") ? "*" : "_";
30182           return concat$g([style, printChildren$2(path, options, print), style]);
30183         }
30184
30185       case "strong":
30186         return concat$g(["**", printChildren$2(path, options, print), "**"]);
30187
30188       case "delete":
30189         return concat$g(["~~", printChildren$2(path, options, print), "~~"]);
30190
30191       case "inlineCode":
30192         {
30193           var backtickCount = util.getMinNotPresentContinuousCount(node.value, "`");
30194
30195           var _style = "`".repeat(backtickCount || 1);
30196
30197           var gap = backtickCount ? " " : "";
30198           return concat$g([_style, gap, node.value, gap, _style]);
30199         }
30200
30201       case "link":
30202         switch (options.originalText[node.position.start.offset]) {
30203           case "<":
30204             {
30205               var mailto = "mailto:";
30206               var url = // <hello@example.com> is parsed as { url: "mailto:hello@example.com" }
30207               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;
30208               return concat$g(["<", url, ">"]);
30209             }
30210
30211           case "[":
30212             return concat$g(["[", printChildren$2(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
30213
30214           default:
30215             return options.originalText.slice(node.position.start.offset, node.position.end.offset);
30216         }
30217
30218       case "image":
30219         return concat$g(["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"]);
30220
30221       case "blockquote":
30222         return concat$g(["> ", align$2("> ", printChildren$2(path, options, print))]);
30223
30224       case "heading":
30225         return concat$g(["#".repeat(node.depth) + " ", printChildren$2(path, options, print)]);
30226
30227       case "code":
30228         {
30229           if (node.isIndented) {
30230             // indented code block
30231             var alignment = " ".repeat(4);
30232             return align$2(alignment, concat$g([alignment, concat$g(replaceEndOfLineWith$2(node.value, hardline$c))]));
30233           } // fenced code block
30234
30235
30236           var styleUnit = options.__inJsTemplate ? "~" : "`";
30237
30238           var _style2 = styleUnit.repeat(Math.max(3, util.getMaxContinuousCount(node.value, styleUnit) + 1));
30239
30240           return concat$g([_style2, node.lang || "", hardline$c, concat$g(replaceEndOfLineWith$2(getFencedCodeBlockValue$2(node, options.originalText), hardline$c)), hardline$c, _style2]);
30241         }
30242
30243       case "yaml":
30244       case "toml":
30245         return options.originalText.slice(node.position.start.offset, node.position.end.offset);
30246
30247       case "html":
30248         {
30249           var _parentNode2 = path.getParentNode();
30250
30251           var value = _parentNode2.type === "root" && util.getLast(_parentNode2.children) === node ? node.value.trimRight() : node.value;
30252           var isHtmlComment = /^<!--[\s\S]*-->$/.test(value);
30253           return concat$g(replaceEndOfLineWith$2(value, isHtmlComment ? hardline$c : markAsRoot$4(literalline$6)));
30254         }
30255
30256       case "list":
30257         {
30258           var nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
30259           var isGitDiffFriendlyOrderedList = node.ordered && node.children.length > 1 && +getOrderedListItemInfo$2(node.children[1], options.originalText).numberText === 1;
30260           return printChildren$2(path, options, print, {
30261             processor: function processor(childPath, index) {
30262               var prefix = getPrefix();
30263               return concat$g([prefix, align$2(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))]);
30264
30265               function getPrefix() {
30266                 var rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
30267                 return node.isAligned ||
30268                 /* workaround for https://github.com/remarkjs/remark/issues/315 */
30269                 node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
30270               }
30271             }
30272           });
30273         }
30274
30275       case "thematicBreak":
30276         {
30277           var counter = getAncestorCounter$1(path, "list");
30278
30279           if (counter === -1) {
30280             return "---";
30281           }
30282
30283           var _nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
30284
30285           return _nthSiblingIndex % 2 === 0 ? "***" : "---";
30286         }
30287
30288       case "linkReference":
30289         return concat$g(["[", printChildren$2(path, options, print), "]", node.referenceType === "full" ? concat$g(["[", node.identifier, "]"]) : node.referenceType === "collapsed" ? "[]" : ""]);
30290
30291       case "imageReference":
30292         switch (node.referenceType) {
30293           case "full":
30294             return concat$g(["![", node.alt || "", "][", node.identifier, "]"]);
30295
30296           default:
30297             return concat$g(["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""]);
30298         }
30299
30300       case "definition":
30301         {
30302           var lineOrSpace = options.proseWrap === "always" ? line$8 : " ";
30303           return group$f(concat$g([concat$g(["[", node.identifier, "]:"]), indent$9(concat$g([lineOrSpace, printUrl(node.url), node.title === null ? "" : concat$g([lineOrSpace, printTitle(node.title, options, false)])]))]));
30304         }
30305
30306       case "footnote":
30307         return concat$g(["[^", printChildren$2(path, options, print), "]"]);
30308
30309       case "footnoteReference":
30310         return concat$g(["[^", node.identifier, "]"]);
30311
30312       case "footnoteDefinition":
30313         {
30314           var _nextNode2 = path.getParentNode().children[path.getName() + 1];
30315           var 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);
30316           return concat$g(["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren$2(path, options, print) : group$f(concat$g([align$2(" ".repeat(options.tabWidth), printChildren$2(path, options, print, {
30317             processor: function processor(childPath, index) {
30318               return index === 0 ? group$f(concat$g([softline$7, softline$7, childPath.call(print)])) : childPath.call(print);
30319             }
30320           })), _nextNode2 && _nextNode2.type === "footnoteDefinition" ? softline$7 : ""]))]);
30321         }
30322
30323       case "table":
30324         return printTable(path, options, print);
30325
30326       case "tableCell":
30327         return printChildren$2(path, options, print);
30328
30329       case "break":
30330         return /\s/.test(options.originalText[node.position.start.offset]) ? concat$g(["  ", markAsRoot$4(literalline$6)]) : concat$g(["\\", hardline$c]);
30331
30332       case "liquidNode":
30333         return concat$g(replaceEndOfLineWith$2(node.value, hardline$c));
30334       // MDX
30335
30336       case "importExport":
30337       case "jsx":
30338         return node.value;
30339       // fallback to the original text if multiparser failed
30340
30341       case "math":
30342         return concat$g(["$$", hardline$c, node.value ? concat$g([concat$g(replaceEndOfLineWith$2(node.value, hardline$c)), hardline$c]) : "", "$$"]);
30343
30344       case "inlineMath":
30345         {
30346           // remark-math trims content but we don't want to remove whitespaces
30347           // since it's very possible that it's recognized as math accidentally
30348           return options.originalText.slice(options.locStart(node), options.locEnd(node));
30349         }
30350
30351       case "tableRow": // handled in "table"
30352
30353       case "listItem": // handled in "list"
30354
30355       default:
30356         throw new Error("Unknown markdown type ".concat(JSON.stringify(node.type)));
30357     }
30358   }
30359
30360   function printListItem(path, options, print, listPrefix) {
30361     var node = path.getValue();
30362     var prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
30363     return concat$g([prefix, printChildren$2(path, options, print, {
30364       processor: function processor(childPath, index) {
30365         if (index === 0 && childPath.getValue().type !== "list") {
30366           return align$2(" ".repeat(prefix.length), childPath.call(print));
30367         }
30368
30369         var alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3) // 4+ will cause indented code block
30370         );
30371         return concat$g([alignment, align$2(alignment, childPath.call(print))]);
30372       }
30373     })]);
30374   }
30375
30376   function alignListPrefix(prefix, options) {
30377     var additionalSpaces = getAdditionalSpaces();
30378     return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces // 4+ will cause indented code block
30379     );
30380
30381     function getAdditionalSpaces() {
30382       var restSpaces = prefix.length % options.tabWidth;
30383       return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
30384     }
30385   }
30386
30387   function getNthListSiblingIndex(node, parentNode) {
30388     return getNthSiblingIndex(node, parentNode, function (siblingNode) {
30389       return siblingNode.ordered === node.ordered;
30390     });
30391   }
30392
30393   function getNthSiblingIndex(node, parentNode, condition) {
30394     condition = condition || function () {
30395       return true;
30396     };
30397
30398     var index = -1;
30399     var _iteratorNormalCompletion = true;
30400     var _didIteratorError = false;
30401     var _iteratorError = undefined;
30402
30403     try {
30404       for (var _iterator = parentNode.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
30405         var childNode = _step.value;
30406
30407         if (childNode.type === node.type && condition(childNode)) {
30408           index++;
30409         } else {
30410           index = -1;
30411         }
30412
30413         if (childNode === node) {
30414           return index;
30415         }
30416       }
30417     } catch (err) {
30418       _didIteratorError = true;
30419       _iteratorError = err;
30420     } finally {
30421       try {
30422         if (!_iteratorNormalCompletion && _iterator.return != null) {
30423           _iterator.return();
30424         }
30425       } finally {
30426         if (_didIteratorError) {
30427           throw _iteratorError;
30428         }
30429       }
30430     }
30431   }
30432
30433   function getAncestorCounter$1(path, typeOrTypes) {
30434     var types = [].concat(typeOrTypes);
30435     var counter = -1;
30436     var ancestorNode;
30437
30438     while (ancestorNode = path.getParentNode(++counter)) {
30439       if (types.indexOf(ancestorNode.type) !== -1) {
30440         return counter;
30441       }
30442     }
30443
30444     return -1;
30445   }
30446
30447   function getAncestorNode$2(path, typeOrTypes) {
30448     var counter = getAncestorCounter$1(path, typeOrTypes);
30449     return counter === -1 ? null : path.getParentNode(counter);
30450   }
30451
30452   function printLine(path, value, options) {
30453     if (options.proseWrap === "preserve" && value === "\n") {
30454       return hardline$c;
30455     }
30456
30457     var isBreakable = options.proseWrap === "always" && !getAncestorNode$2(path, SINGLE_LINE_NODE_TYPES);
30458     return value !== "" ? isBreakable ? line$8 : " " : isBreakable ? softline$7 : "";
30459   }
30460
30461   function printTable(path, options, print) {
30462     var hardlineWithoutBreakParent = hardline$c.parts[0];
30463     var node = path.getValue();
30464     var contents = []; // { [rowIndex: number]: { [columnIndex: number]: string } }
30465
30466     path.map(function (rowPath) {
30467       var rowContents = [];
30468       rowPath.map(function (cellPath) {
30469         rowContents.push(printDocToString$2(cellPath.call(print), options).formatted);
30470       }, "children");
30471       contents.push(rowContents);
30472     }, "children"); // Get the width of each column
30473
30474     var columnMaxWidths = contents.reduce(function (currentWidths, rowContents) {
30475       return currentWidths.map(function (width, columnIndex) {
30476         return Math.max(width, util.getStringWidth(rowContents[columnIndex]));
30477       });
30478     }, contents[0].map(function () {
30479       return 3;
30480     }) // minimum width = 3 (---, :--, :-:, --:)
30481     );
30482     var alignedTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0]), printSeparator(), join$b(hardlineWithoutBreakParent, contents.slice(1).map(function (rowContents) {
30483       return printRow(rowContents);
30484     }))]);
30485
30486     if (options.proseWrap !== "never") {
30487       return concat$g([breakParent$4, alignedTable]);
30488     } // Only if the --prose-wrap never is set and it exceeds the print width.
30489
30490
30491     var compactTable = join$b(hardlineWithoutBreakParent, [printRow(contents[0],
30492     /* isCompact */
30493     true), printSeparator(
30494     /* isCompact */
30495     true), join$b(hardlineWithoutBreakParent, contents.slice(1).map(function (rowContents) {
30496       return printRow(rowContents,
30497       /* isCompact */
30498       true);
30499     }))]);
30500     return concat$g([breakParent$4, group$f(ifBreak$7(compactTable, alignedTable))]);
30501
30502     function printSeparator(isCompact) {
30503       return concat$g(["| ", join$b(" | ", columnMaxWidths.map(function (width, index) {
30504         var spaces = isCompact ? 3 : width;
30505
30506         switch (node.align[index]) {
30507           case "left":
30508             return ":" + "-".repeat(spaces - 1);
30509
30510           case "right":
30511             return "-".repeat(spaces - 1) + ":";
30512
30513           case "center":
30514             return ":" + "-".repeat(spaces - 2) + ":";
30515
30516           default:
30517             return "-".repeat(spaces);
30518         }
30519       })), " |"]);
30520     }
30521
30522     function printRow(rowContents, isCompact) {
30523       return concat$g(["| ", join$b(" | ", isCompact ? rowContents : rowContents.map(function (rowContent, columnIndex) {
30524         switch (node.align[columnIndex]) {
30525           case "right":
30526             return alignRight(rowContent, columnMaxWidths[columnIndex]);
30527
30528           case "center":
30529             return alignCenter(rowContent, columnMaxWidths[columnIndex]);
30530
30531           default:
30532             return alignLeft(rowContent, columnMaxWidths[columnIndex]);
30533         }
30534       })), " |"]);
30535     }
30536
30537     function alignLeft(text, width) {
30538       var spaces = width - util.getStringWidth(text);
30539       return concat$g([text, " ".repeat(spaces)]);
30540     }
30541
30542     function alignRight(text, width) {
30543       var spaces = width - util.getStringWidth(text);
30544       return concat$g([" ".repeat(spaces), text]);
30545     }
30546
30547     function alignCenter(text, width) {
30548       var spaces = width - util.getStringWidth(text);
30549       var left = Math.floor(spaces / 2);
30550       var right = spaces - left;
30551       return concat$g([" ".repeat(left), text, " ".repeat(right)]);
30552     }
30553   }
30554
30555   function printRoot(path, options, print) {
30556     /** @typedef {{ index: number, offset: number }} IgnorePosition */
30557
30558     /** @type {Array<{start: IgnorePosition, end: IgnorePosition}>} */
30559     var ignoreRanges = [];
30560     /** @type {IgnorePosition | null} */
30561
30562     var ignoreStart = null;
30563     var children = path.getValue().children;
30564     children.forEach(function (childNode, index) {
30565       switch (isPrettierIgnore$1(childNode)) {
30566         case "start":
30567           if (ignoreStart === null) {
30568             ignoreStart = {
30569               index: index,
30570               offset: childNode.position.end.offset
30571             };
30572           }
30573
30574           break;
30575
30576         case "end":
30577           if (ignoreStart !== null) {
30578             ignoreRanges.push({
30579               start: ignoreStart,
30580               end: {
30581                 index: index,
30582                 offset: childNode.position.start.offset
30583               }
30584             });
30585             ignoreStart = null;
30586           }
30587
30588           break;
30589       }
30590     });
30591     return printChildren$2(path, options, print, {
30592       processor: function processor(childPath, index) {
30593         if (ignoreRanges.length !== 0) {
30594           var ignoreRange = ignoreRanges[0];
30595
30596           if (index === ignoreRange.start.index) {
30597             return concat$g([children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value]);
30598           }
30599
30600           if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
30601             return false;
30602           }
30603
30604           if (index === ignoreRange.end.index) {
30605             ignoreRanges.shift();
30606             return false;
30607           }
30608         }
30609
30610         return childPath.call(print);
30611       }
30612     });
30613   }
30614
30615   function printChildren$2(path, options, print, events) {
30616     events = events || {};
30617     var postprocessor = events.postprocessor || concat$g;
30618
30619     var processor = events.processor || function (childPath) {
30620       return childPath.call(print);
30621     };
30622
30623     var node = path.getValue();
30624     var parts = [];
30625     var lastChildNode;
30626     path.map(function (childPath, index) {
30627       var childNode = childPath.getValue();
30628       var result = processor(childPath, index);
30629
30630       if (result !== false) {
30631         var data = {
30632           parts: parts,
30633           prevNode: lastChildNode,
30634           parentNode: node,
30635           options: options
30636         };
30637
30638         if (!shouldNotPrePrintHardline(childNode, data)) {
30639           parts.push(hardline$c);
30640
30641           if (lastChildNode && TRAILING_HARDLINE_NODES.indexOf(lastChildNode.type) !== -1) {
30642             if (shouldPrePrintTripleHardline(childNode, data)) {
30643               parts.push(hardline$c);
30644             }
30645           } else {
30646             if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
30647               parts.push(hardline$c);
30648             }
30649
30650             if (shouldPrePrintTripleHardline(childNode, data)) {
30651               parts.push(hardline$c);
30652             }
30653           }
30654         }
30655
30656         parts.push(result);
30657         lastChildNode = childNode;
30658       }
30659     }, "children");
30660     return postprocessor(parts);
30661   }
30662
30663   function getLastDescendantNode(node) {
30664     var current = node;
30665
30666     while (current.children && current.children.length !== 0) {
30667       current = current.children[current.children.length - 1];
30668     }
30669
30670     return current;
30671   }
30672   /** @return {false | 'next' | 'start' | 'end'} */
30673
30674
30675   function isPrettierIgnore$1(node) {
30676     if (node.type !== "html") {
30677       return false;
30678     }
30679
30680     var match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
30681     return match === null ? false : match[1] ? match[1] : "next";
30682   }
30683
30684   function isInlineNode(node) {
30685     return node && INLINE_NODE_TYPES$1.indexOf(node.type) !== -1;
30686   }
30687
30688   function isEndsWithHardLine(node) {
30689     return node && /\n+$/.test(node.value);
30690   }
30691
30692   function last(nodes) {
30693     return nodes && nodes[nodes.length - 1];
30694   }
30695
30696   function shouldNotPrePrintHardline(node, _ref) {
30697     var parentNode = _ref.parentNode,
30698         parts = _ref.parts,
30699         prevNode = _ref.prevNode;
30700     var isFirstNode = parts.length === 0;
30701     var isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES$1.indexOf(parentNode.type) !== -1;
30702     var isAfterHardlineNode = prevNode && (isEndsWithHardLine(prevNode) || isEndsWithHardLine(last(prevNode.children)));
30703     return isFirstNode || isInlineNode(node) || isInlineHTML || isAfterHardlineNode;
30704   }
30705
30706   function shouldPrePrintDoubleHardline(node, _ref2) {
30707     var parentNode = _ref2.parentNode,
30708         prevNode = _ref2.prevNode;
30709     var prevNodeType = prevNode && prevNode.type;
30710     var nodeType = node.type;
30711     var isSequence = prevNodeType === nodeType;
30712     var isSiblingNode = isSequence && SIBLING_NODE_TYPES.indexOf(nodeType) !== -1;
30713     var isInTightListItem = parentNode.type === "listItem" && !parentNode.loose;
30714     var isPrevNodeLooseListItem = prevNodeType === "listItem" && prevNode.loose;
30715     var isPrevNodePrettierIgnore = isPrettierIgnore$1(prevNode) === "next";
30716     var isBlockHtmlWithoutBlankLineBetweenPrevHtml = nodeType === "html" && prevNodeType === "html" && prevNode.position.end.line + 1 === node.position.start.line;
30717     var isJsxInlineSibling = prevNodeType === "jsx" && isInlineNode(node) || nodeType === "jsx" && isInlineNode(prevNode);
30718     return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isJsxInlineSibling);
30719   }
30720
30721   function shouldPrePrintTripleHardline(node, data) {
30722     var isPrevNodeList = data.prevNode && data.prevNode.type === "list";
30723     var isIndentedCode = node.type === "code" && node.isIndented;
30724     return isPrevNodeList && isIndentedCode;
30725   }
30726
30727   function shouldRemainTheSameContent(path) {
30728     var ancestorNode = getAncestorNode$2(path, ["linkReference", "imageReference"]);
30729     return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
30730   }
30731
30732   function normalizeDoc(doc) {
30733     return mapDoc$7(doc, function (currentDoc) {
30734       if (!currentDoc.parts) {
30735         return currentDoc;
30736       }
30737
30738       if (currentDoc.type === "concat" && currentDoc.parts.length === 1) {
30739         return currentDoc.parts[0];
30740       }
30741
30742       var parts = [];
30743       currentDoc.parts.forEach(function (part) {
30744         if (part.type === "concat") {
30745           parts.push.apply(parts, part.parts);
30746         } else if (part !== "") {
30747           parts.push(part);
30748         }
30749       });
30750       return Object.assign({}, currentDoc, {
30751         parts: normalizeParts$2(parts)
30752       });
30753     });
30754   }
30755
30756   function printUrl(url, dangerousCharOrChars) {
30757     var dangerousChars = [" "].concat(dangerousCharOrChars || []);
30758     return new RegExp(dangerousChars.map(function (x) {
30759       return "\\".concat(x);
30760     }).join("|")).test(url) ? "<".concat(url, ">") : url;
30761   }
30762
30763   function printTitle(title, options, printSpace) {
30764     if (printSpace == null) {
30765       printSpace = true;
30766     }
30767
30768     if (!title) {
30769       return "";
30770     }
30771
30772     if (printSpace) {
30773       return " " + printTitle(title, options, false);
30774     }
30775
30776     if (title.includes('"') && title.includes("'") && !title.includes(")")) {
30777       return "(".concat(title, ")"); // avoid escaped quotes
30778     } // faster than using RegExps: https://jsperf.com/performance-of-match-vs-split
30779
30780
30781     var singleCount = title.split("'").length - 1;
30782     var doubleCount = title.split('"').length - 1;
30783     var quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
30784     title = title.replace(new RegExp("(".concat(quote, ")"), "g"), "\\$1");
30785     return "".concat(quote).concat(title).concat(quote);
30786   }
30787
30788   function normalizeParts$2(parts) {
30789     return parts.reduce(function (current, part) {
30790       var lastPart = util.getLast(current);
30791
30792       if (typeof lastPart === "string" && typeof part === "string") {
30793         current.splice(-1, 1, lastPart + part);
30794       } else {
30795         current.push(part);
30796       }
30797
30798       return current;
30799     }, []);
30800   }
30801
30802   function clamp(value, min, max) {
30803     return value < min ? min : value > max ? max : value;
30804   }
30805
30806   function clean$6(ast, newObj, parent) {
30807     delete newObj.position;
30808     delete newObj.raw; // front-matter
30809     // for codeblock
30810
30811     if (ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
30812       delete newObj.value;
30813     }
30814
30815     if (ast.type === "list") {
30816       delete newObj.isAligned;
30817     } // texts can be splitted or merged
30818
30819
30820     if (ast.type === "text") {
30821       return null;
30822     }
30823
30824     if (ast.type === "inlineCode") {
30825       newObj.value = ast.value.replace(/[ \t\n]+/g, " ");
30826     } // for insert pragma
30827
30828
30829     if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || (parent.children[0].type === "yaml" || parent.children[0].type === "toml") && parent.children[1] === ast) && ast.type === "html" && pragma$4.startWithPragma(ast.value)) {
30830       return null;
30831     }
30832   }
30833
30834   function hasPrettierIgnore$4(path) {
30835     var index = +path.getName();
30836
30837     if (index === 0) {
30838       return false;
30839     }
30840
30841     var prevNode = path.getParentNode().children[index - 1];
30842     return isPrettierIgnore$1(prevNode) === "next";
30843   }
30844
30845   var printerMarkdown = {
30846     preprocess: preprocess_1$2,
30847     print: genericPrint$5,
30848     embed: embed_1$2,
30849     massageAstNode: clean$6,
30850     hasPrettierIgnore: hasPrettierIgnore$4,
30851     insertPragma: pragma$4.insertPragma
30852   };
30853
30854   var options$6 = {
30855     proseWrap: commonOptions.proseWrap,
30856     singleQuote: commonOptions.singleQuote
30857   };
30858
30859   var name$g = "Markdown";
30860   var type$f = "prose";
30861   var aliases$5 = [
30862         "pandoc"
30863   ];
30864   var aceMode$f = "markdown";
30865   var codemirrorMode$b = "gfm";
30866   var codemirrorMimeType$b = "text/x-gfm";
30867   var wrap = true;
30868   var extensions$f = [
30869         ".md",
30870         ".markdown",
30871         ".mdown",
30872         ".mdwn",
30873         ".mdx",
30874         ".mkd",
30875         ".mkdn",
30876         ".mkdown",
30877         ".ronn",
30878         ".workbook"
30879   ];
30880   var filenames$3 = [
30881         "contents.lr"
30882   ];
30883   var tmScope$f = "source.gfm";
30884   var languageId$f = 222;
30885   var Markdown = {
30886         name: name$g,
30887         type: type$f,
30888         aliases: aliases$5,
30889         aceMode: aceMode$f,
30890         codemirrorMode: codemirrorMode$b,
30891         codemirrorMimeType: codemirrorMimeType$b,
30892         wrap: wrap,
30893         extensions: extensions$f,
30894         filenames: filenames$3,
30895         tmScope: tmScope$f,
30896         languageId: languageId$f
30897   };
30898
30899   var Markdown$1 = /*#__PURE__*/Object.freeze({
30900     __proto__: null,
30901     name: name$g,
30902     type: type$f,
30903     aliases: aliases$5,
30904     aceMode: aceMode$f,
30905     codemirrorMode: codemirrorMode$b,
30906     codemirrorMimeType: codemirrorMimeType$b,
30907     wrap: wrap,
30908     extensions: extensions$f,
30909     filenames: filenames$3,
30910     tmScope: tmScope$f,
30911     languageId: languageId$f,
30912     'default': Markdown
30913   });
30914
30915   var require$$0$7 = getCjsExportFromNamespace(Markdown$1);
30916
30917   var languages$5 = [createLanguage(require$$0$7, function (data) {
30918     return Object.assign(data, {
30919       since: "1.8.0",
30920       parsers: ["remark"],
30921       vscodeLanguageIds: ["markdown"],
30922       filenames: data.filenames.concat(["README"]),
30923       extensions: data.extensions.filter(function (extension) {
30924         return extension !== ".mdx";
30925       })
30926     });
30927   }), createLanguage(require$$0$7, function (data) {
30928     return Object.assign(data, {
30929       name: "MDX",
30930       since: "1.15.0",
30931       parsers: ["mdx"],
30932       vscodeLanguageIds: ["mdx"],
30933       filenames: [],
30934       extensions: [".mdx"]
30935     });
30936   })];
30937   var printers$5 = {
30938     mdast: printerMarkdown
30939   };
30940   var languageMarkdown = {
30941     languages: languages$5,
30942     options: options$6,
30943     printers: printers$5
30944   };
30945
30946   function isPragma(text) {
30947     return /^\s*@(prettier|format)\s*$/.test(text);
30948   }
30949
30950   function hasPragma$4(text) {
30951     return /^\s*#[^\n\S]*@(prettier|format)\s*?(\n|$)/.test(text);
30952   }
30953
30954   function insertPragma$8(text) {
30955     return "# @format\n\n".concat(text);
30956   }
30957
30958   var pragma$5 = {
30959     isPragma: isPragma,
30960     hasPragma: hasPragma$4,
30961     insertPragma: insertPragma$8
30962   };
30963
30964   var getLast$4 = util.getLast;
30965
30966   function getAncestorCount(path, filter) {
30967     var counter = 0;
30968     var pathStackLength = path.stack.length - 1;
30969
30970     for (var i = 0; i < pathStackLength; i++) {
30971       var value = path.stack[i];
30972
30973       if (isNode(value) && filter(value)) {
30974         counter++;
30975       }
30976     }
30977
30978     return counter;
30979   }
30980   /**
30981    * @param {any} value
30982    * @param {string[]=} types
30983    */
30984
30985
30986   function isNode(value, types) {
30987     return value && typeof value.type === "string" && (!types || types.indexOf(value.type) !== -1);
30988   }
30989
30990   function mapNode(node, callback, parent) {
30991     return callback("children" in node ? Object.assign({}, node, {
30992       children: node.children.map(function (childNode) {
30993         return mapNode(childNode, callback, node);
30994       })
30995     }) : node, parent);
30996   }
30997
30998   function defineShortcut(x, key, getter) {
30999     Object.defineProperty(x, key, {
31000       get: getter,
31001       enumerable: false
31002     });
31003   }
31004
31005   function isNextLineEmpty$5(node, text) {
31006     var newlineCount = 0;
31007     var textLength = text.length;
31008
31009     for (var i = node.position.end.offset - 1; i < textLength; i++) {
31010       var char = text[i];
31011
31012       if (char === "\n") {
31013         newlineCount++;
31014       }
31015
31016       if (newlineCount === 1 && /\S/.test(char)) {
31017         return false;
31018       }
31019
31020       if (newlineCount === 2) {
31021         return true;
31022       }
31023     }
31024
31025     return false;
31026   }
31027
31028   function isLastDescendantNode(path) {
31029     var node = path.getValue();
31030
31031     switch (node.type) {
31032       case "tag":
31033       case "anchor":
31034       case "comment":
31035         return false;
31036     }
31037
31038     var pathStackLength = path.stack.length;
31039
31040     for (var i = 1; i < pathStackLength; i++) {
31041       var item = path.stack[i];
31042       var parentItem = path.stack[i - 1];
31043
31044       if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
31045         return false;
31046       }
31047     }
31048
31049     return true;
31050   }
31051
31052   function getLastDescendantNode$1(node) {
31053     return "children" in node && node.children.length !== 0 ? getLastDescendantNode$1(getLast$4(node.children)) : node;
31054   }
31055
31056   function isPrettierIgnore$2(comment) {
31057     return comment.value.trim() === "prettier-ignore";
31058   }
31059
31060   function hasPrettierIgnore$5(path) {
31061     var node = path.getValue();
31062
31063     if (node.type === "documentBody") {
31064       var document = path.getParentNode();
31065       return hasEndComments(document.head) && isPrettierIgnore$2(getLast$4(document.head.endComments));
31066     }
31067
31068     return hasLeadingComments(node) && isPrettierIgnore$2(getLast$4(node.leadingComments));
31069   }
31070
31071   function isEmptyNode(node) {
31072     return (!node.children || node.children.length === 0) && !hasComments(node);
31073   }
31074
31075   function hasComments(node) {
31076     return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment$2(node) || hasEndComments(node);
31077   }
31078
31079   function hasLeadingComments(node) {
31080     return node && node.leadingComments && node.leadingComments.length !== 0;
31081   }
31082
31083   function hasMiddleComments(node) {
31084     return node && node.middleComments && node.middleComments.length !== 0;
31085   }
31086
31087   function hasIndicatorComment(node) {
31088     return node && node.indicatorComment;
31089   }
31090
31091   function hasTrailingComment$2(node) {
31092     return node && node.trailingComment;
31093   }
31094
31095   function hasEndComments(node) {
31096     return node && node.endComments && node.endComments.length !== 0;
31097   }
31098   /**
31099    * " a   b c   d e   f " -> [" a   b", "c   d", "e   f "]
31100    */
31101
31102
31103   function splitWithSingleSpace(text) {
31104     var parts = [];
31105     var lastPart = undefined;
31106     var _iteratorNormalCompletion = true;
31107     var _didIteratorError = false;
31108     var _iteratorError = undefined;
31109
31110     try {
31111       for (var _iterator = text.split(/( +)/g)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
31112         var part = _step.value;
31113
31114         if (part !== " ") {
31115           if (lastPart === " ") {
31116             parts.push(part);
31117           } else {
31118             parts.push((parts.pop() || "") + part);
31119           }
31120         } else if (lastPart === undefined) {
31121           parts.unshift("");
31122         }
31123
31124         lastPart = part;
31125       }
31126     } catch (err) {
31127       _didIteratorError = true;
31128       _iteratorError = err;
31129     } finally {
31130       try {
31131         if (!_iteratorNormalCompletion && _iterator.return != null) {
31132           _iterator.return();
31133         }
31134       } finally {
31135         if (_didIteratorError) {
31136           throw _iteratorError;
31137         }
31138       }
31139     }
31140
31141     if (lastPart === " ") {
31142       parts.push((parts.pop() || "") + " ");
31143     }
31144
31145     if (parts[0] === "") {
31146       parts.shift();
31147       parts.unshift(" " + (parts.shift() || ""));
31148     }
31149
31150     return parts;
31151   }
31152
31153   function getFlowScalarLineContents(nodeType, content, options) {
31154     var rawLineContents = content.split("\n").map(function (lineContent, index, lineContents) {
31155       return index === 0 && index === lineContents.length - 1 ? lineContent : index !== 0 && index !== lineContents.length - 1 ? lineContent.trim() : index === 0 ? lineContent.trimRight() : lineContent.trimLeft();
31156     });
31157
31158     if (options.proseWrap === "preserve") {
31159       return rawLineContents.map(function (lineContent) {
31160         return lineContent.length === 0 ? [] : [lineContent];
31161       });
31162     }
31163
31164     return rawLineContents.map(function (lineContent) {
31165       return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
31166     }).reduce(function (reduced, lineContentWords, index) {
31167       return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !( // trailing backslash in quoteDouble should be preserved
31168       nodeType === "quoteDouble" && getLast$4(getLast$4(reduced)).endsWith("\\")) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
31169     }, []).map(function (lineContentWords) {
31170       return options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords;
31171     });
31172   }
31173
31174   function getBlockValueLineContents(node, _ref) {
31175     var parentIndent = _ref.parentIndent,
31176         isLastDescendant = _ref.isLastDescendant,
31177         options = _ref.options;
31178     var content = node.position.start.line === node.position.end.line ? "" : options.originalText.slice(node.position.start.offset, node.position.end.offset) // exclude open line `>` or `|`
31179     .match(/^[^\n]*?\n([\s\S]*)$/)[1];
31180     var leadingSpaceCount = node.indent === null ? function (match) {
31181       return match ? match[1].length : Infinity;
31182     }(content.match(/^( *)\S/m)) : node.indent - 1 + parentIndent;
31183     var rawLineContents = content.split("\n").map(function (lineContent) {
31184       return lineContent.slice(leadingSpaceCount);
31185     });
31186
31187     if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
31188       return removeUnnecessaryTrailingNewlines(rawLineContents.map(function (lineContent) {
31189         return lineContent.length === 0 ? [] : [lineContent];
31190       }));
31191     }
31192
31193     return removeUnnecessaryTrailingNewlines(rawLineContents.map(function (lineContent) {
31194       return lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent);
31195     }).reduce(function (reduced, lineContentWords, index) {
31196       return index !== 0 && rawLineContents[index - 1].length !== 0 && lineContentWords.length !== 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast$4(reduced)) ? reduced.concat([reduced.pop().concat(lineContentWords)]) : reduced.concat([lineContentWords]);
31197     }, []).map(function (lineContentWords) {
31198       return lineContentWords.reduce(function (reduced, word) {
31199         return (// disallow trailing spaces
31200           reduced.length !== 0 && /\s$/.test(getLast$4(reduced)) ? reduced.concat(reduced.pop() + " " + word) : reduced.concat(word)
31201         );
31202       }, []);
31203     }).map(function (lineContentWords) {
31204       return options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords;
31205     }));
31206
31207     function removeUnnecessaryTrailingNewlines(lineContents) {
31208       if (node.chomping === "keep") {
31209         return getLast$4(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
31210       }
31211
31212       var trailingNewlineCount = 0;
31213
31214       for (var i = lineContents.length - 1; i >= 0; i--) {
31215         if (lineContents[i].length === 0) {
31216           trailingNewlineCount++;
31217         } else {
31218           break;
31219         }
31220       }
31221
31222       return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? // next empty line
31223       lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
31224     }
31225   }
31226
31227   var utils$6 = {
31228     getLast: getLast$4,
31229     getAncestorCount: getAncestorCount,
31230     isNode: isNode,
31231     isEmptyNode: isEmptyNode,
31232     mapNode: mapNode,
31233     defineShortcut: defineShortcut,
31234     isNextLineEmpty: isNextLineEmpty$5,
31235     isLastDescendantNode: isLastDescendantNode,
31236     getBlockValueLineContents: getBlockValueLineContents,
31237     getFlowScalarLineContents: getFlowScalarLineContents,
31238     getLastDescendantNode: getLastDescendantNode$1,
31239     hasPrettierIgnore: hasPrettierIgnore$5,
31240     hasLeadingComments: hasLeadingComments,
31241     hasMiddleComments: hasMiddleComments,
31242     hasIndicatorComment: hasIndicatorComment,
31243     hasTrailingComment: hasTrailingComment$2,
31244     hasEndComments: hasEndComments
31245   };
31246
31247   var insertPragma$9 = pragma$5.insertPragma,
31248       isPragma$1 = pragma$5.isPragma;
31249   var getAncestorCount$1 = utils$6.getAncestorCount,
31250       getBlockValueLineContents$1 = utils$6.getBlockValueLineContents,
31251       getFlowScalarLineContents$1 = utils$6.getFlowScalarLineContents,
31252       getLast$5 = utils$6.getLast,
31253       getLastDescendantNode$2 = utils$6.getLastDescendantNode,
31254       hasLeadingComments$1 = utils$6.hasLeadingComments,
31255       hasMiddleComments$1 = utils$6.hasMiddleComments,
31256       hasIndicatorComment$1 = utils$6.hasIndicatorComment,
31257       hasTrailingComment$3 = utils$6.hasTrailingComment,
31258       hasEndComments$1 = utils$6.hasEndComments,
31259       hasPrettierIgnore$6 = utils$6.hasPrettierIgnore,
31260       isLastDescendantNode$1 = utils$6.isLastDescendantNode,
31261       isNextLineEmpty$6 = utils$6.isNextLineEmpty,
31262       isNode$1 = utils$6.isNode,
31263       isEmptyNode$1 = utils$6.isEmptyNode,
31264       defineShortcut$1 = utils$6.defineShortcut,
31265       mapNode$1 = utils$6.mapNode;
31266   var docBuilders$2 = doc.builders;
31267   var conditionalGroup$2 = docBuilders$2.conditionalGroup,
31268       breakParent$5 = docBuilders$2.breakParent,
31269       concat$h = docBuilders$2.concat,
31270       dedent$3 = docBuilders$2.dedent,
31271       dedentToRoot$3 = docBuilders$2.dedentToRoot,
31272       fill$6 = docBuilders$2.fill,
31273       group$g = docBuilders$2.group,
31274       hardline$d = docBuilders$2.hardline,
31275       ifBreak$8 = docBuilders$2.ifBreak,
31276       join$c = docBuilders$2.join,
31277       line$9 = docBuilders$2.line,
31278       lineSuffix$2 = docBuilders$2.lineSuffix,
31279       literalline$7 = docBuilders$2.literalline,
31280       markAsRoot$5 = docBuilders$2.markAsRoot,
31281       softline$8 = docBuilders$2.softline;
31282   var replaceEndOfLineWith$3 = util.replaceEndOfLineWith;
31283
31284   function preprocess$3(ast) {
31285     return mapNode$1(ast, defineShortcuts);
31286   }
31287
31288   function defineShortcuts(node) {
31289     switch (node.type) {
31290       case "document":
31291         defineShortcut$1(node, "head", function () {
31292           return node.children[0];
31293         });
31294         defineShortcut$1(node, "body", function () {
31295           return node.children[1];
31296         });
31297         break;
31298
31299       case "documentBody":
31300       case "sequenceItem":
31301       case "flowSequenceItem":
31302       case "mappingKey":
31303       case "mappingValue":
31304         defineShortcut$1(node, "content", function () {
31305           return node.children[0];
31306         });
31307         break;
31308
31309       case "mappingItem":
31310       case "flowMappingItem":
31311         defineShortcut$1(node, "key", function () {
31312           return node.children[0];
31313         });
31314         defineShortcut$1(node, "value", function () {
31315           return node.children[1];
31316         });
31317         break;
31318     }
31319
31320     return node;
31321   }
31322
31323   function genericPrint$6(path, options, print) {
31324     var node = path.getValue();
31325     var parentNode = path.getParentNode();
31326     var tag = !node.tag ? "" : path.call(print, "tag");
31327     var anchor = !node.anchor ? "" : path.call(print, "anchor");
31328     var nextEmptyLine = isNode$1(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode$1(path) ? printNextEmptyLine(path, options.originalText) : "";
31329     return concat$h([node.type !== "mappingValue" && hasLeadingComments$1(node) ? concat$h([join$c(hardline$d, path.map(print, "leadingComments")), hardline$d]) : "", tag, tag && anchor ? " " : "", anchor, tag || anchor ? isNode$1(node, ["sequence", "mapping"]) && !hasMiddleComments$1(node) ? hardline$d : " " : "", hasMiddleComments$1(node) ? concat$h([node.middleComments.length === 1 ? "" : hardline$d, join$c(hardline$d, path.map(print, "middleComments")), hardline$d]) : "", hasPrettierIgnore$6(path) ? concat$h(replaceEndOfLineWith$3(options.originalText.slice(node.position.start.offset, node.position.end.offset), literalline$7)) : group$g(_print(node, parentNode, path, options, print)), hasTrailingComment$3(node) && !isNode$1(node, ["document", "documentHead"]) ? lineSuffix$2(concat$h([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode$1(node) ? "" : breakParent$5, path.call(print, "trailingComment")])) : "", nextEmptyLine, hasEndComments$1(node) && !isNode$1(node, ["documentHead", "documentBody"]) ? align$3(node.type === "sequenceItem" ? 2 : 0, concat$h([hardline$d, join$c(hardline$d, path.map(print, "endComments"))])) : ""]);
31330   }
31331
31332   function _print(node, parentNode, path, options, print) {
31333     switch (node.type) {
31334       case "root":
31335         return concat$h([join$c(hardline$d, path.map(function (childPath, index) {
31336           var document = node.children[index];
31337           var nextDocument = node.children[index + 1];
31338           return concat$h([print(childPath), shouldPrintDocumentEndMarker(document, nextDocument) ? concat$h([hardline$d, "...", hasTrailingComment$3(document) ? concat$h([" ", path.call(print, "trailingComment")]) : ""]) : !nextDocument || hasTrailingComment$3(nextDocument.head) ? "" : concat$h([hardline$d, "---"])]);
31339         }, "children")), node.children.length === 0 || function (lastDescendantNode) {
31340           return isNode$1(lastDescendantNode, ["blockLiteral", "blockFolded"]) && lastDescendantNode.chomping === "keep";
31341         }(getLastDescendantNode$2(node)) ? "" : hardline$d]);
31342
31343       case "document":
31344         {
31345           var nextDocument = parentNode.children[path.getName() + 1];
31346           return join$c(hardline$d, [shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head" ? join$c(hardline$d, [node.head.children.length === 0 && node.head.endComments.length === 0 ? "" : path.call(print, "head"), concat$h(["---", hasTrailingComment$3(node.head) ? concat$h([" ", path.call(print, "head", "trailingComment")]) : ""])].filter(Boolean)) : "", shouldPrintDocumentBody(node) ? path.call(print, "body") : ""].filter(Boolean));
31347         }
31348
31349       case "documentHead":
31350         return join$c(hardline$d, [].concat(path.map(print, "children"), path.map(print, "endComments")));
31351
31352       case "documentBody":
31353         {
31354           var children = join$c(hardline$d, path.map(print, "children")).parts;
31355           var endComments = join$c(hardline$d, path.map(print, "endComments")).parts;
31356           var separator = children.length === 0 || endComments.length === 0 ? "" : function (lastDescendantNode) {
31357             return isNode$1(lastDescendantNode, ["blockFolded", "blockLiteral"]) ? lastDescendantNode.chomping === "keep" ? // there's already a newline printed at the end of blockValue (chomping=keep, lastDescendant=true)
31358             "" : // an extra newline for better readability
31359             concat$h([hardline$d, hardline$d]) : hardline$d;
31360           }(getLastDescendantNode$2(node));
31361           return concat$h([].concat(children, separator, endComments));
31362         }
31363
31364       case "directive":
31365         return concat$h(["%", join$c(" ", [node.name].concat(node.parameters))]);
31366
31367       case "comment":
31368         return concat$h(["#", node.value]);
31369
31370       case "alias":
31371         return concat$h(["*", node.value]);
31372
31373       case "tag":
31374         return options.originalText.slice(node.position.start.offset, node.position.end.offset);
31375
31376       case "anchor":
31377         return concat$h(["&", node.value]);
31378
31379       case "plain":
31380         return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
31381
31382       case "quoteDouble":
31383       case "quoteSingle":
31384         {
31385           var singleQuote = "'";
31386           var doubleQuote = '"';
31387           var raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
31388
31389           if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
31390             // only quoteDouble can use escape chars
31391             // and quoteSingle do not need to escape backslashes
31392             var originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
31393             return concat$h([originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote]);
31394           } else if (raw.includes(doubleQuote)) {
31395             return concat$h([singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw // double quote needs to be escaped by backslash in quoteDouble
31396             .replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote]);
31397           }
31398
31399           if (raw.includes(singleQuote)) {
31400             return concat$h([doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? // single quote needs to be escaped by 2 single quotes in quoteSingle
31401             raw.replace(/''/g, singleQuote) : raw, options), doubleQuote]);
31402           }
31403
31404           var quote = options.singleQuote ? singleQuote : doubleQuote;
31405           return concat$h([quote, printFlowScalarContent(node.type, raw, options), quote]);
31406         }
31407
31408       case "blockFolded":
31409       case "blockLiteral":
31410         {
31411           var parentIndent = getAncestorCount$1(path, function (ancestorNode) {
31412             return isNode$1(ancestorNode, ["sequence", "mapping"]);
31413           });
31414           var isLastDescendant = isLastDescendantNode$1(path);
31415           return concat$h([node.type === "blockFolded" ? ">" : "|", node.indent === null ? "" : node.indent.toString(), node.chomping === "clip" ? "" : node.chomping === "keep" ? "+" : "-", hasIndicatorComment$1(node) ? concat$h([" ", path.call(print, "indicatorComment")]) : "", (node.indent === null ? dedent$3 : dedentToRoot$3)(align$3(node.indent === null ? options.tabWidth : node.indent - 1 + parentIndent, concat$h(getBlockValueLineContents$1(node, {
31416             parentIndent: parentIndent,
31417             isLastDescendant: isLastDescendant,
31418             options: options
31419           }).reduce(function (reduced, lineWords, index, lineContents) {
31420             return reduced.concat(index === 0 ? hardline$d : "", fill$6(join$c(line$9, lineWords).parts), index !== lineContents.length - 1 ? lineWords.length === 0 ? hardline$d : markAsRoot$5(literalline$7) : node.chomping === "keep" && isLastDescendant ? lineWords.length === 0 ? dedentToRoot$3(hardline$d) : dedentToRoot$3(literalline$7) : "");
31421           }, []))))]);
31422         }
31423
31424       case "sequence":
31425         return join$c(hardline$d, path.map(print, "children"));
31426
31427       case "sequenceItem":
31428         return concat$h(["- ", align$3(2, !node.content ? "" : path.call(print, "content"))]);
31429
31430       case "mappingKey":
31431         return !node.content ? "" : path.call(print, "content");
31432
31433       case "mappingValue":
31434         return !node.content ? "" : path.call(print, "content");
31435
31436       case "mapping":
31437         return join$c(hardline$d, path.map(print, "children"));
31438
31439       case "mappingItem":
31440       case "flowMappingItem":
31441         {
31442           var isEmptyMappingKey = isEmptyNode$1(node.key);
31443           var isEmptyMappingValue = isEmptyNode$1(node.value);
31444
31445           if (isEmptyMappingKey && isEmptyMappingValue) {
31446             return concat$h([": "]);
31447           }
31448
31449           var key = path.call(print, "key");
31450           var value = path.call(print, "value");
31451
31452           if (isEmptyMappingValue) {
31453             return node.type === "flowMappingItem" && parentNode.type === "flowMapping" ? key : node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(node.key.content, options) && !hasTrailingComment$3(node.key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set") ? concat$h([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ":"]) : concat$h(["? ", align$3(2, key)]);
31454           }
31455
31456           if (isEmptyMappingKey) {
31457             return concat$h([": ", align$3(2, value)]);
31458           }
31459
31460           var groupId = Symbol("mappingKey");
31461           var forceExplicitKey = hasLeadingComments$1(node.value) || !isInlineNode$1(node.key.content);
31462           return forceExplicitKey ? concat$h(["? ", align$3(2, key), hardline$d, join$c("", path.map(print, "value", "leadingComments").map(function (comment) {
31463             return concat$h([comment, hardline$d]);
31464           })), ": ", align$3(2, value)]) : // force singleline
31465           isSingleLineNode(node.key.content) && !hasLeadingComments$1(node.key.content) && !hasMiddleComments$1(node.key.content) && !hasTrailingComment$3(node.key.content) && !hasEndComments$1(node.key) && !hasLeadingComments$1(node.value.content) && !hasMiddleComments$1(node.value.content) && !hasEndComments$1(node.value) && isAbsolutelyPrintedAsSingleLineNode(node.value.content, options) ? concat$h([key, needsSpaceInFrontOfMappingValue(node) ? " " : "", ": ", value]) : conditionalGroup$2([concat$h([group$g(concat$h([ifBreak$8("? "), group$g(align$3(2, key), {
31466             id: groupId
31467           })])), ifBreak$8(concat$h([hardline$d, ": ", align$3(2, value)]), indent(concat$h([needsSpaceInFrontOfMappingValue(node) ? " " : "", ":", hasLeadingComments$1(node.value.content) || hasEndComments$1(node.value) && node.value.content && !isNode$1(node.value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment$3(node.key.content) && isInlineNode$1(node.value.content) || isNode$1(node.value.content, ["mapping", "sequence"]) && node.value.content.tag === null && node.value.content.anchor === null ? hardline$d : !node.value.content ? "" : line$9, value])), {
31468             groupId: groupId
31469           })])]);
31470         }
31471
31472       case "flowMapping":
31473       case "flowSequence":
31474         {
31475           var openMarker = node.type === "flowMapping" ? "{" : "[";
31476           var closeMarker = node.type === "flowMapping" ? "}" : "]";
31477           var bracketSpacing = node.type === "flowMapping" && node.children.length !== 0 && options.bracketSpacing ? line$9 : softline$8;
31478
31479           var isLastItemEmptyMappingItem = node.children.length !== 0 && function (lastItem) {
31480             return lastItem.type === "flowMappingItem" && isEmptyNode$1(lastItem.key) && isEmptyNode$1(lastItem.value);
31481           }(getLast$5(node.children));
31482
31483           return concat$h([openMarker, indent(concat$h([bracketSpacing, concat$h(path.map(function (childPath, index) {
31484             return concat$h([print(childPath), index === node.children.length - 1 ? "" : concat$h([",", line$9, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""])]);
31485           }, "children")), ifBreak$8(",", "")])), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker]);
31486         }
31487
31488       case "flowSequenceItem":
31489         return path.call(print, "content");
31490       // istanbul ignore next
31491
31492       default:
31493         throw new Error("Unexpected node type ".concat(node.type));
31494     }
31495
31496     function indent(doc) {
31497       return docBuilders$2.align(" ".repeat(options.tabWidth), doc);
31498     }
31499   }
31500
31501   function align$3(n, doc) {
31502     return typeof n === "number" && n > 0 ? docBuilders$2.align(" ".repeat(n), doc) : docBuilders$2.align(n, doc);
31503   }
31504
31505   function isInlineNode$1(node) {
31506     if (!node) {
31507       return true;
31508     }
31509
31510     switch (node.type) {
31511       case "plain":
31512       case "quoteDouble":
31513       case "quoteSingle":
31514       case "alias":
31515       case "flowMapping":
31516       case "flowSequence":
31517         return true;
31518
31519       default:
31520         return false;
31521     }
31522   }
31523
31524   function isSingleLineNode(node) {
31525     if (!node) {
31526       return true;
31527     }
31528
31529     switch (node.type) {
31530       case "plain":
31531       case "quoteDouble":
31532       case "quoteSingle":
31533         return node.position.start.line === node.position.end.line;
31534
31535       case "alias":
31536         return true;
31537
31538       default:
31539         return false;
31540     }
31541   }
31542
31543   function shouldPrintDocumentBody(document) {
31544     return document.body.children.length !== 0 || hasEndComments$1(document.body);
31545   }
31546
31547   function shouldPrintDocumentEndMarker(document, nextDocument) {
31548     return (
31549       /**
31550        *... # trailingComment
31551        */
31552       hasTrailingComment$3(document) || nextDocument && (
31553       /**
31554        * ...
31555        * %DIRECTIVE
31556        * ---
31557        */
31558       nextDocument.head.children.length !== 0 ||
31559       /**
31560        * ...
31561        * # endComment
31562        * ---
31563        */
31564       hasEndComments$1(nextDocument.head))
31565     );
31566   }
31567
31568   function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
31569     if (
31570     /**
31571      * ---
31572      * preserve the first document head end marker
31573      */
31574     root.children[0] === document && /---(\s|$)/.test(options.originalText.slice(options.locStart(document), options.locStart(document) + 4)) ||
31575     /**
31576      * %DIRECTIVE
31577      * ---
31578      */
31579     document.head.children.length !== 0 ||
31580     /**
31581      * # end comment
31582      * ---
31583      */
31584     hasEndComments$1(document.head) ||
31585     /**
31586      * --- # trailing comment
31587      */
31588     hasTrailingComment$3(document.head)) {
31589       return "head";
31590     }
31591
31592     if (shouldPrintDocumentEndMarker(document, nextDocument)) {
31593       return false;
31594     }
31595
31596     return nextDocument ? "root" : false;
31597   }
31598
31599   function isAbsolutelyPrintedAsSingleLineNode(node, options) {
31600     if (!node) {
31601       return true;
31602     }
31603
31604     switch (node.type) {
31605       case "plain":
31606       case "quoteSingle":
31607       case "quoteDouble":
31608         break;
31609
31610       case "alias":
31611         return true;
31612
31613       default:
31614         return false;
31615     }
31616
31617     if (options.proseWrap === "preserve") {
31618       return node.position.start.line === node.position.end.line;
31619     }
31620
31621     if ( // backslash-newline
31622     /\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
31623       return false;
31624     }
31625
31626     switch (options.proseWrap) {
31627       case "never":
31628         return node.value.indexOf("\n") === -1;
31629
31630       case "always":
31631         return !/[\n ]/.test(node.value);
31632       // istanbul ignore next
31633
31634       default:
31635         return false;
31636     }
31637   }
31638
31639   function needsSpaceInFrontOfMappingValue(node) {
31640     return node.key.content && node.key.content.type === "alias";
31641   }
31642
31643   function printNextEmptyLine(path, originalText) {
31644     var node = path.getValue();
31645     var root = path.stack[0];
31646     root.isNextEmptyLinePrintedChecklist = root.isNextEmptyLinePrintedChecklist || [];
31647
31648     if (!root.isNextEmptyLinePrintedChecklist[node.position.end.line]) {
31649       if (isNextLineEmpty$6(node, originalText)) {
31650         root.isNextEmptyLinePrintedChecklist[node.position.end.line] = true;
31651         return softline$8;
31652       }
31653     }
31654
31655     return "";
31656   }
31657
31658   function printFlowScalarContent(nodeType, content, options) {
31659     var lineContents = getFlowScalarLineContents$1(nodeType, content, options);
31660     return join$c(hardline$d, lineContents.map(function (lineContentWords) {
31661       return fill$6(join$c(line$9, lineContentWords).parts);
31662     }));
31663   }
31664
31665   function clean$7(node, newNode
31666   /*, parent */
31667   ) {
31668     if (isNode$1(newNode)) {
31669       delete newNode.position;
31670
31671       switch (newNode.type) {
31672         case "comment":
31673           // insert pragma
31674           if (isPragma$1(newNode.value)) {
31675             return null;
31676           }
31677
31678           break;
31679
31680         case "quoteDouble":
31681         case "quoteSingle":
31682           newNode.type = "quote";
31683           break;
31684       }
31685     }
31686   }
31687
31688   var printerYaml = {
31689     preprocess: preprocess$3,
31690     print: genericPrint$6,
31691     massageAstNode: clean$7,
31692     insertPragma: insertPragma$9
31693   };
31694
31695   var options$7 = {
31696     bracketSpacing: commonOptions.bracketSpacing,
31697     singleQuote: commonOptions.singleQuote,
31698     proseWrap: commonOptions.proseWrap
31699   };
31700
31701   var name$h = "YAML";
31702   var type$g = "data";
31703   var tmScope$g = "source.yaml";
31704   var aliases$6 = [
31705         "yml"
31706   ];
31707   var extensions$g = [
31708         ".yml",
31709         ".mir",
31710         ".reek",
31711         ".rviz",
31712         ".sublime-syntax",
31713         ".syntax",
31714         ".yaml",
31715         ".yaml-tmlanguage",
31716         ".yml.mysql"
31717   ];
31718   var filenames$4 = [
31719         ".clang-format",
31720         ".clang-tidy",
31721         ".gemrc",
31722         "glide.lock"
31723   ];
31724   var aceMode$g = "yaml";
31725   var codemirrorMode$c = "yaml";
31726   var codemirrorMimeType$c = "text/x-yaml";
31727   var languageId$g = 407;
31728   var YAML = {
31729         name: name$h,
31730         type: type$g,
31731         tmScope: tmScope$g,
31732         aliases: aliases$6,
31733         extensions: extensions$g,
31734         filenames: filenames$4,
31735         aceMode: aceMode$g,
31736         codemirrorMode: codemirrorMode$c,
31737         codemirrorMimeType: codemirrorMimeType$c,
31738         languageId: languageId$g
31739   };
31740
31741   var YAML$1 = /*#__PURE__*/Object.freeze({
31742     __proto__: null,
31743     name: name$h,
31744     type: type$g,
31745     tmScope: tmScope$g,
31746     aliases: aliases$6,
31747     extensions: extensions$g,
31748     filenames: filenames$4,
31749     aceMode: aceMode$g,
31750     codemirrorMode: codemirrorMode$c,
31751     codemirrorMimeType: codemirrorMimeType$c,
31752     languageId: languageId$g,
31753     'default': YAML
31754   });
31755
31756   var require$$0$8 = getCjsExportFromNamespace(YAML$1);
31757
31758   var languages$6 = [createLanguage(require$$0$8, function (data) {
31759     return Object.assign(data, {
31760       since: "1.14.0",
31761       parsers: ["yaml"],
31762       vscodeLanguageIds: ["yaml"]
31763     });
31764   })];
31765   var languageYaml = {
31766     languages: languages$6,
31767     printers: {
31768       yaml: printerYaml
31769     },
31770     options: options$7
31771   };
31772
31773   var version$2 = require$$0.version;
31774   var getSupportInfo$2 = support.getSupportInfo;
31775   var internalPlugins = [languageCss, languageGraphql, languageHandlebars, languageHtml, languageJs, languageMarkdown, languageYaml];
31776
31777   var isArray$1 = Array.isArray || function (arr) {
31778     return Object.prototype.toString.call(arr) === "[object Array]";
31779   }; // Luckily `opts` is always the 2nd argument
31780
31781
31782   function withPlugins(fn) {
31783     return function () {
31784       var args = Array.from(arguments);
31785       var plugins = args[1] && args[1].plugins || [];
31786
31787       if (!isArray$1(plugins)) {
31788         plugins = Object.values(plugins);
31789       }
31790
31791       args[1] = Object.assign({}, args[1], {
31792         plugins: internalPlugins.concat(plugins)
31793       });
31794       return fn.apply(null, args);
31795     };
31796   }
31797
31798   var formatWithCursor = withPlugins(core.formatWithCursor);
31799   var standalone = {
31800     formatWithCursor: formatWithCursor,
31801     format: function format(text, opts) {
31802       return formatWithCursor(text, opts).formatted;
31803     },
31804     check: function check(text, opts) {
31805       var formatted = formatWithCursor(text, opts).formatted;
31806       return formatted === text;
31807     },
31808     doc: doc,
31809     getSupportInfo: withPlugins(getSupportInfo$2),
31810     version: version$2,
31811     util: utilShared,
31812     __debug: {
31813       parse: withPlugins(core.parse),
31814       formatAST: withPlugins(core.formatAST),
31815       formatDoc: withPlugins(core.formatDoc),
31816       printToDoc: withPlugins(core.printToDoc),
31817       printDocToString: withPlugins(core.printDocToString)
31818     }
31819   };
31820
31821   var standalone$1 = standalone;
31822
31823   return standalone$1;
31824
31825 })));