4 var require$$0$2 = require('path');
5 var require$$0$5 = require('fs');
6 var require$$0$1 = require('os');
7 var require$$1 = require('tty');
8 var require$$0$3 = require('util');
9 var require$$0$4 = require('stream');
10 var require$$0$6 = require('events');
11 var require$$0$7 = require('readline');
13 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15 var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
16 var require$$0__default$4 = /*#__PURE__*/_interopDefaultLegacy(require$$0$5);
17 var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
18 var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
19 var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$3);
20 var require$$0__default$3 = /*#__PURE__*/_interopDefaultLegacy(require$$0$4);
21 var require$$0__default$5 = /*#__PURE__*/_interopDefaultLegacy(require$$0$6);
22 var require$$0__default$6 = /*#__PURE__*/_interopDefaultLegacy(require$$0$7);
24 var require$$0 = require("./package.json");
26 var semverCompare$1 = function cmp(a, b) {
27 var pa = a.split('.');
28 var pb = b.split('.');
30 for (var i = 0; i < 3; i++) {
31 var na = Number(pa[i]);
32 var nb = Number(pb[i]);
33 if (na > nb) return 1;
34 if (nb > na) return -1;
35 if (!isNaN(na) && isNaN(nb)) return 1;
36 if (isNaN(na) && !isNaN(nb)) return -1;
42 var semverCompare = semverCompare$1;
44 var pleaseUpgradeNode = function pleaseUpgradeNode(pkg, opts) {
45 var opts = opts || {};
46 var requiredVersion = pkg.engines.node.replace('>=', '');
47 var currentVersion = process.version.replace('v', '');
49 if (semverCompare(currentVersion, requiredVersion) === -1) {
51 console.error(opts.message(requiredVersion));
53 console.error(pkg.name + ' requires at least version ' + requiredVersion + ' of Node, please upgrade');
56 if (opts.hasOwnProperty('exitCode')) {
57 process.exit(opts.exitCode);
64 var check = function (it) {
65 return it && it.Math == Math && it;
68 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
70 // eslint-disable-next-line es/no-global-this -- safe
71 check(typeof globalThis == 'object' && globalThis) ||
72 check(typeof window == 'object' && window) ||
73 // eslint-disable-next-line no-restricted-globals -- safe
74 check(typeof self == 'object' && self) ||
75 check(typeof global$r == 'object' && global$r) ||
76 // eslint-disable-next-line no-new-func -- fallback
77 (function () { return this; })() || Function('return this')();
79 var objectGetOwnPropertyDescriptor = {};
81 var fails$8 = function (exec) {
89 var fails$7 = fails$8;
91 // Detect IE8's incomplete defineProperty implementation
92 var descriptors = !fails$7(function () {
93 // eslint-disable-next-line es/no-object-defineproperty -- required for testing
94 return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
97 var call$7 = Function.prototype.call;
99 var functionCall = call$7.bind ? call$7.bind(call$7) : function () {
100 return call$7.apply(call$7, arguments);
103 var objectPropertyIsEnumerable = {};
105 var $propertyIsEnumerable = {}.propertyIsEnumerable;
106 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
107 var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
109 // Nashorn ~ JDK8 bug
110 var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
112 // `Object.prototype.propertyIsEnumerable` method implementation
113 // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
114 objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
115 var descriptor = getOwnPropertyDescriptor$1(this, V);
116 return !!descriptor && descriptor.enumerable;
117 } : $propertyIsEnumerable;
119 var createPropertyDescriptor$3 = function (bitmap, value) {
121 enumerable: !(bitmap & 1),
122 configurable: !(bitmap & 2),
123 writable: !(bitmap & 4),
128 var FunctionPrototype$1 = Function.prototype;
129 var bind$3 = FunctionPrototype$1.bind;
130 var call$6 = FunctionPrototype$1.call;
131 var callBind = bind$3 && bind$3.bind(call$6);
133 var functionUncurryThis = bind$3 ? function (fn) {
134 return fn && callBind(call$6, fn);
136 return fn && function () {
137 return call$6.apply(fn, arguments);
141 var uncurryThis$c = functionUncurryThis;
143 var toString$5 = uncurryThis$c({}.toString);
144 var stringSlice = uncurryThis$c(''.slice);
146 var classofRaw$1 = function (it) {
147 return stringSlice(toString$5(it), 8, -1);
150 var global$q = global$r;
151 var uncurryThis$b = functionUncurryThis;
152 var fails$6 = fails$8;
153 var classof$5 = classofRaw$1;
155 var Object$4 = global$q.Object;
156 var split = uncurryThis$b(''.split);
158 // fallback for non-array-like ES3 and non-enumerable old V8 strings
159 var indexedObject = fails$6(function () {
160 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
161 // eslint-disable-next-line no-prototype-builtins -- safe
162 return !Object$4('z').propertyIsEnumerable(0);
164 return classof$5(it) == 'String' ? split(it, '') : Object$4(it);
167 var global$p = global$r;
169 var TypeError$a = global$p.TypeError;
171 // `RequireObjectCoercible` abstract operation
172 // https://tc39.es/ecma262/#sec-requireobjectcoercible
173 var requireObjectCoercible$2 = function (it) {
174 if (it == undefined) throw TypeError$a("Can't call method on " + it);
178 // toObject with fallback for non-array-like ES3 strings
179 var IndexedObject = indexedObject;
180 var requireObjectCoercible$1 = requireObjectCoercible$2;
182 var toIndexedObject$4 = function (it) {
183 return IndexedObject(requireObjectCoercible$1(it));
186 // `IsCallable` abstract operation
187 // https://tc39.es/ecma262/#sec-iscallable
188 var isCallable$b = function (argument) {
189 return typeof argument == 'function';
192 var isCallable$a = isCallable$b;
194 var isObject$d = function (it) {
195 return typeof it == 'object' ? it !== null : isCallable$a(it);
198 var global$o = global$r;
199 var isCallable$9 = isCallable$b;
201 var aFunction = function (argument) {
202 return isCallable$9(argument) ? argument : undefined;
205 var getBuiltIn$5 = function (namespace, method) {
206 return arguments.length < 2 ? aFunction(global$o[namespace]) : global$o[namespace] && global$o[namespace][method];
209 var uncurryThis$a = functionUncurryThis;
211 var objectIsPrototypeOf = uncurryThis$a({}.isPrototypeOf);
213 var getBuiltIn$4 = getBuiltIn$5;
215 var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
217 var global$n = global$r;
218 var userAgent$2 = engineUserAgent;
220 var process$1 = global$n.process;
221 var Deno = global$n.Deno;
222 var versions = process$1 && process$1.versions || Deno && Deno.version;
223 var v8 = versions && versions.v8;
227 match = v8.split('.');
228 // in old Chrome, versions of V8 isn't V8 = Chrome / 10
229 // but their correct versions are not interesting for us
230 version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
233 // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
234 // so check `userAgent` even if `.v8` exists, but 0
235 if (!version && userAgent$2) {
236 match = userAgent$2.match(/Edge\/(\d+)/);
237 if (!match || match[1] >= 74) {
238 match = userAgent$2.match(/Chrome\/(\d+)/);
239 if (match) version = +match[1];
243 var engineV8Version = version;
245 /* eslint-disable es/no-symbol -- required for testing */
247 var V8_VERSION = engineV8Version;
248 var fails$5 = fails$8;
250 // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
251 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails$5(function () {
252 var symbol = Symbol();
253 // Chrome 38 Symbol has incorrect toString conversion
254 // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
255 return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
256 // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
257 !Symbol.sham && V8_VERSION && V8_VERSION < 41;
260 /* eslint-disable es/no-symbol -- required for testing */
262 var NATIVE_SYMBOL$1 = nativeSymbol;
264 var useSymbolAsUid = NATIVE_SYMBOL$1
266 && typeof Symbol.iterator == 'symbol';
268 var global$m = global$r;
269 var getBuiltIn$3 = getBuiltIn$5;
270 var isCallable$8 = isCallable$b;
271 var isPrototypeOf$1 = objectIsPrototypeOf;
272 var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
274 var Object$3 = global$m.Object;
276 var isSymbol$6 = USE_SYMBOL_AS_UID$1 ? function (it) {
277 return typeof it == 'symbol';
279 var $Symbol = getBuiltIn$3('Symbol');
280 return isCallable$8($Symbol) && isPrototypeOf$1($Symbol.prototype, Object$3(it));
283 var global$l = global$r;
285 var String$3 = global$l.String;
287 var tryToString$3 = function (argument) {
289 return String$3(argument);
295 var global$k = global$r;
296 var isCallable$7 = isCallable$b;
297 var tryToString$2 = tryToString$3;
299 var TypeError$9 = global$k.TypeError;
301 // `Assert: IsCallable(argument) is true`
302 var aCallable$5 = function (argument) {
303 if (isCallable$7(argument)) return argument;
304 throw TypeError$9(tryToString$2(argument) + ' is not a function');
307 var aCallable$4 = aCallable$5;
309 // `GetMethod` abstract operation
310 // https://tc39.es/ecma262/#sec-getmethod
311 var getMethod$3 = function (V, P) {
313 return func == null ? undefined : aCallable$4(func);
316 var global$j = global$r;
317 var call$5 = functionCall;
318 var isCallable$6 = isCallable$b;
319 var isObject$c = isObject$d;
321 var TypeError$8 = global$j.TypeError;
323 // `OrdinaryToPrimitive` abstract operation
324 // https://tc39.es/ecma262/#sec-ordinarytoprimitive
325 var ordinaryToPrimitive$1 = function (input, pref) {
327 if (pref === 'string' && isCallable$6(fn = input.toString) && !isObject$c(val = call$5(fn, input))) return val;
328 if (isCallable$6(fn = input.valueOf) && !isObject$c(val = call$5(fn, input))) return val;
329 if (pref !== 'string' && isCallable$6(fn = input.toString) && !isObject$c(val = call$5(fn, input))) return val;
330 throw TypeError$8("Can't convert object to primitive value");
333 var shared$3 = {exports: {}};
335 var global$i = global$r;
337 // eslint-disable-next-line es/no-object-defineproperty -- safe
338 var defineProperty$3 = Object.defineProperty;
340 var setGlobal$3 = function (key, value) {
342 defineProperty$3(global$i, key, { value: value, configurable: true, writable: true });
344 global$i[key] = value;
348 var global$h = global$r;
349 var setGlobal$2 = setGlobal$3;
351 var SHARED = '__core-js_shared__';
352 var store$3 = global$h[SHARED] || setGlobal$2(SHARED, {});
354 var sharedStore = store$3;
356 var store$2 = sharedStore;
358 (shared$3.exports = function (key, value) {
359 return store$2[key] || (store$2[key] = value !== undefined ? value : {});
360 })('versions', []).push({
363 copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
366 var global$g = global$r;
367 var requireObjectCoercible = requireObjectCoercible$2;
369 var Object$2 = global$g.Object;
371 // `ToObject` abstract operation
372 // https://tc39.es/ecma262/#sec-toobject
373 var toObject$4 = function (argument) {
374 return Object$2(requireObjectCoercible(argument));
377 var uncurryThis$9 = functionUncurryThis;
378 var toObject$3 = toObject$4;
380 var hasOwnProperty$b = uncurryThis$9({}.hasOwnProperty);
382 // `HasOwnProperty` abstract operation
383 // https://tc39.es/ecma262/#sec-hasownproperty
384 var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
385 return hasOwnProperty$b(toObject$3(it), key);
388 var uncurryThis$8 = functionUncurryThis;
391 var postfix = Math.random();
392 var toString$4 = uncurryThis$8(1.0.toString);
394 var uid$2 = function (key) {
395 return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36);
398 var global$f = global$r;
399 var shared$2 = shared$3.exports;
400 var hasOwn$6 = hasOwnProperty_1;
402 var NATIVE_SYMBOL = nativeSymbol;
403 var USE_SYMBOL_AS_UID = useSymbolAsUid;
405 var WellKnownSymbolsStore = shared$2('wks');
406 var Symbol$7 = global$f.Symbol;
407 var symbolFor = Symbol$7 && Symbol$7['for'];
408 var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$7 : Symbol$7 && Symbol$7.withoutSetter || uid$1;
410 var wellKnownSymbol$7 = function (name) {
411 if (!hasOwn$6(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
412 var description = 'Symbol.' + name;
413 if (NATIVE_SYMBOL && hasOwn$6(Symbol$7, name)) {
414 WellKnownSymbolsStore[name] = Symbol$7[name];
415 } else if (USE_SYMBOL_AS_UID && symbolFor) {
416 WellKnownSymbolsStore[name] = symbolFor(description);
418 WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
420 } return WellKnownSymbolsStore[name];
423 var global$e = global$r;
424 var call$4 = functionCall;
425 var isObject$b = isObject$d;
426 var isSymbol$5 = isSymbol$6;
427 var getMethod$2 = getMethod$3;
428 var ordinaryToPrimitive = ordinaryToPrimitive$1;
429 var wellKnownSymbol$6 = wellKnownSymbol$7;
431 var TypeError$7 = global$e.TypeError;
432 var TO_PRIMITIVE = wellKnownSymbol$6('toPrimitive');
434 // `ToPrimitive` abstract operation
435 // https://tc39.es/ecma262/#sec-toprimitive
436 var toPrimitive$1 = function (input, pref) {
437 if (!isObject$b(input) || isSymbol$5(input)) return input;
438 var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
441 if (pref === undefined) pref = 'default';
442 result = call$4(exoticToPrim, input, pref);
443 if (!isObject$b(result) || isSymbol$5(result)) return result;
444 throw TypeError$7("Can't convert object to primitive value");
446 if (pref === undefined) pref = 'number';
447 return ordinaryToPrimitive(input, pref);
450 var toPrimitive = toPrimitive$1;
451 var isSymbol$4 = isSymbol$6;
453 // `ToPropertyKey` abstract operation
454 // https://tc39.es/ecma262/#sec-topropertykey
455 var toPropertyKey$3 = function (argument) {
456 var key = toPrimitive(argument, 'string');
457 return isSymbol$4(key) ? key : key + '';
460 var global$d = global$r;
461 var isObject$a = isObject$d;
463 var document$1 = global$d.document;
464 // typeof document.createElement is 'object' in old IE
465 var EXISTS$1 = isObject$a(document$1) && isObject$a(document$1.createElement);
467 var documentCreateElement$1 = function (it) {
468 return EXISTS$1 ? document$1.createElement(it) : {};
471 var DESCRIPTORS$5 = descriptors;
472 var fails$4 = fails$8;
473 var createElement = documentCreateElement$1;
475 // Thank's IE8 for his funny defineProperty
476 var ie8DomDefine = !DESCRIPTORS$5 && !fails$4(function () {
477 // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
478 return Object.defineProperty(createElement('div'), 'a', {
479 get: function () { return 7; }
483 var DESCRIPTORS$4 = descriptors;
484 var call$3 = functionCall;
485 var propertyIsEnumerableModule = objectPropertyIsEnumerable;
486 var createPropertyDescriptor$2 = createPropertyDescriptor$3;
487 var toIndexedObject$3 = toIndexedObject$4;
488 var toPropertyKey$2 = toPropertyKey$3;
489 var hasOwn$5 = hasOwnProperty_1;
490 var IE8_DOM_DEFINE$1 = ie8DomDefine;
492 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
493 var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
495 // `Object.getOwnPropertyDescriptor` method
496 // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
497 objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
498 O = toIndexedObject$3(O);
499 P = toPropertyKey$2(P);
500 if (IE8_DOM_DEFINE$1) try {
501 return $getOwnPropertyDescriptor(O, P);
502 } catch (error) { /* empty */ }
503 if (hasOwn$5(O, P)) return createPropertyDescriptor$2(!call$3(propertyIsEnumerableModule.f, O, P), O[P]);
506 var objectDefineProperty = {};
508 var global$c = global$r;
509 var isObject$9 = isObject$d;
511 var String$2 = global$c.String;
512 var TypeError$6 = global$c.TypeError;
514 // `Assert: Type(argument) is Object`
515 var anObject$7 = function (argument) {
516 if (isObject$9(argument)) return argument;
517 throw TypeError$6(String$2(argument) + ' is not an object');
520 var global$b = global$r;
521 var DESCRIPTORS$3 = descriptors;
522 var IE8_DOM_DEFINE = ie8DomDefine;
523 var anObject$6 = anObject$7;
524 var toPropertyKey$1 = toPropertyKey$3;
526 var TypeError$5 = global$b.TypeError;
527 // eslint-disable-next-line es/no-object-defineproperty -- safe
528 var $defineProperty = Object.defineProperty;
530 // `Object.defineProperty` method
531 // https://tc39.es/ecma262/#sec-object.defineproperty
532 objectDefineProperty.f = DESCRIPTORS$3 ? $defineProperty : function defineProperty(O, P, Attributes) {
534 P = toPropertyKey$1(P);
535 anObject$6(Attributes);
536 if (IE8_DOM_DEFINE) try {
537 return $defineProperty(O, P, Attributes);
538 } catch (error) { /* empty */ }
539 if ('get' in Attributes || 'set' in Attributes) throw TypeError$5('Accessors not supported');
540 if ('value' in Attributes) O[P] = Attributes.value;
544 var DESCRIPTORS$2 = descriptors;
545 var definePropertyModule$4 = objectDefineProperty;
546 var createPropertyDescriptor$1 = createPropertyDescriptor$3;
548 var createNonEnumerableProperty$3 = DESCRIPTORS$2 ? function (object, key, value) {
549 return definePropertyModule$4.f(object, key, createPropertyDescriptor$1(1, value));
550 } : function (object, key, value) {
555 var redefine$1 = {exports: {}};
557 var uncurryThis$7 = functionUncurryThis;
558 var isCallable$5 = isCallable$b;
559 var store$1 = sharedStore;
561 var functionToString = uncurryThis$7(Function.toString);
563 // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
564 if (!isCallable$5(store$1.inspectSource)) {
565 store$1.inspectSource = function (it) {
566 return functionToString(it);
570 var inspectSource$3 = store$1.inspectSource;
572 var global$a = global$r;
573 var isCallable$4 = isCallable$b;
574 var inspectSource$2 = inspectSource$3;
576 var WeakMap$4 = global$a.WeakMap;
578 var nativeWeakMap = isCallable$4(WeakMap$4) && /native code/.test(inspectSource$2(WeakMap$4));
580 var shared$1 = shared$3.exports;
583 var keys$4 = shared$1('keys');
585 var sharedKey$2 = function (key) {
586 return keys$4[key] || (keys$4[key] = uid(key));
589 var hiddenKeys$4 = {};
591 var NATIVE_WEAK_MAP = nativeWeakMap;
592 var global$9 = global$r;
593 var uncurryThis$6 = functionUncurryThis;
594 var isObject$8 = isObject$d;
595 var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
596 var hasOwn$4 = hasOwnProperty_1;
597 var shared = sharedStore;
598 var sharedKey$1 = sharedKey$2;
599 var hiddenKeys$3 = hiddenKeys$4;
601 var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
602 var TypeError$4 = global$9.TypeError;
603 var WeakMap$3 = global$9.WeakMap;
606 var enforce = function (it) {
607 return has(it) ? get$2(it) : set(it, {});
610 var getterFor = function (TYPE) {
611 return function (it) {
613 if (!isObject$8(it) || (state = get$2(it)).type !== TYPE) {
614 throw TypeError$4('Incompatible receiver, ' + TYPE + ' required');
619 if (NATIVE_WEAK_MAP || shared.state) {
620 var store = shared.state || (shared.state = new WeakMap$3());
621 var wmget = uncurryThis$6(store.get);
622 var wmhas = uncurryThis$6(store.has);
623 var wmset = uncurryThis$6(store.set);
624 set = function (it, metadata) {
625 if (wmhas(store, it)) throw new TypeError$4(OBJECT_ALREADY_INITIALIZED);
626 metadata.facade = it;
627 wmset(store, it, metadata);
630 get$2 = function (it) {
631 return wmget(store, it) || {};
633 has = function (it) {
634 return wmhas(store, it);
637 var STATE = sharedKey$1('state');
638 hiddenKeys$3[STATE] = true;
639 set = function (it, metadata) {
640 if (hasOwn$4(it, STATE)) throw new TypeError$4(OBJECT_ALREADY_INITIALIZED);
641 metadata.facade = it;
642 createNonEnumerableProperty$2(it, STATE, metadata);
645 get$2 = function (it) {
646 return hasOwn$4(it, STATE) ? it[STATE] : {};
648 has = function (it) {
649 return hasOwn$4(it, STATE);
653 var internalState = {
661 var DESCRIPTORS$1 = descriptors;
662 var hasOwn$3 = hasOwnProperty_1;
664 var FunctionPrototype = Function.prototype;
665 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
666 var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
668 var EXISTS = hasOwn$3(FunctionPrototype, 'name');
669 // additional protection from minified / mangled / dropped function names
670 var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
671 var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
676 CONFIGURABLE: CONFIGURABLE
679 var global$8 = global$r;
680 var isCallable$3 = isCallable$b;
681 var hasOwn$2 = hasOwnProperty_1;
682 var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
683 var setGlobal$1 = setGlobal$3;
684 var inspectSource$1 = inspectSource$3;
685 var InternalStateModule = internalState;
686 var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
688 var getInternalState = InternalStateModule.get;
689 var enforceInternalState = InternalStateModule.enforce;
690 var TEMPLATE = String(String).split('String');
692 (redefine$1.exports = function (O, key, value, options) {
693 var unsafe = options ? !!options.unsafe : false;
694 var simple = options ? !!options.enumerable : false;
695 var noTargetGet = options ? !!options.noTargetGet : false;
696 var name = options && options.name !== undefined ? options.name : key;
698 if (isCallable$3(value)) {
699 if (String(name).slice(0, 7) === 'Symbol(') {
700 name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
702 if (!hasOwn$2(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
703 createNonEnumerableProperty$1(value, 'name', name);
705 state = enforceInternalState(value);
707 state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
710 if (O === global$8) {
711 if (simple) O[key] = value;
712 else setGlobal$1(key, value);
714 } else if (!unsafe) {
716 } else if (!noTargetGet && O[key]) {
719 if (simple) O[key] = value;
720 else createNonEnumerableProperty$1(O, key, value);
721 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
722 })(Function.prototype, 'toString', function toString() {
723 return isCallable$3(this) && getInternalState(this).source || inspectSource$1(this);
726 var objectGetOwnPropertyNames = {};
728 var ceil = Math.ceil;
729 var floor$1 = Math.floor;
731 // `ToIntegerOrInfinity` abstract operation
732 // https://tc39.es/ecma262/#sec-tointegerorinfinity
733 var toIntegerOrInfinity$3 = function (argument) {
734 var number = +argument;
735 // eslint-disable-next-line no-self-compare -- safe
736 return number !== number || number === 0 ? 0 : (number > 0 ? floor$1 : ceil)(number);
739 var toIntegerOrInfinity$2 = toIntegerOrInfinity$3;
742 var min$1 = Math.min;
744 // Helper for a popular repeating case of the spec:
745 // Let integer be ? ToInteger(index).
746 // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
747 var toAbsoluteIndex$1 = function (index, length) {
748 var integer = toIntegerOrInfinity$2(index);
749 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
752 var toIntegerOrInfinity$1 = toIntegerOrInfinity$3;
756 // `ToLength` abstract operation
757 // https://tc39.es/ecma262/#sec-tolength
758 var toLength$1 = function (argument) {
759 return argument > 0 ? min(toIntegerOrInfinity$1(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
762 var toLength = toLength$1;
764 // `LengthOfArrayLike` abstract operation
765 // https://tc39.es/ecma262/#sec-lengthofarraylike
766 var lengthOfArrayLike$6 = function (obj) {
767 return toLength(obj.length);
770 var toIndexedObject$2 = toIndexedObject$4;
771 var toAbsoluteIndex = toAbsoluteIndex$1;
772 var lengthOfArrayLike$5 = lengthOfArrayLike$6;
774 // `Array.prototype.{ indexOf, includes }` methods implementation
775 var createMethod = function (IS_INCLUDES) {
776 return function ($this, el, fromIndex) {
777 var O = toIndexedObject$2($this);
778 var length = lengthOfArrayLike$5(O);
779 var index = toAbsoluteIndex(fromIndex, length);
781 // Array#includes uses SameValueZero equality algorithm
782 // eslint-disable-next-line no-self-compare -- NaN check
783 if (IS_INCLUDES && el != el) while (length > index) {
785 // eslint-disable-next-line no-self-compare -- NaN check
786 if (value != value) return true;
787 // Array#indexOf ignores holes, Array#includes - not
788 } else for (;length > index; index++) {
789 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
790 } return !IS_INCLUDES && -1;
794 var arrayIncludes = {
795 // `Array.prototype.includes` method
796 // https://tc39.es/ecma262/#sec-array.prototype.includes
797 includes: createMethod(true),
798 // `Array.prototype.indexOf` method
799 // https://tc39.es/ecma262/#sec-array.prototype.indexof
800 indexOf: createMethod(false)
803 var uncurryThis$5 = functionUncurryThis;
804 var hasOwn$1 = hasOwnProperty_1;
805 var toIndexedObject$1 = toIndexedObject$4;
806 var indexOf = arrayIncludes.indexOf;
807 var hiddenKeys$2 = hiddenKeys$4;
809 var push$1 = uncurryThis$5([].push);
811 var objectKeysInternal = function (object, names) {
812 var O = toIndexedObject$1(object);
816 for (key in O) !hasOwn$1(hiddenKeys$2, key) && hasOwn$1(O, key) && push$1(result, key);
817 // Don't enum bug & hidden keys
818 while (names.length > i) if (hasOwn$1(O, key = names[i++])) {
819 ~indexOf(result, key) || push$1(result, key);
824 // IE8- don't enum bug keys
825 var enumBugKeys$3 = [
829 'propertyIsEnumerable',
835 var internalObjectKeys$1 = objectKeysInternal;
836 var enumBugKeys$2 = enumBugKeys$3;
838 var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
840 // `Object.getOwnPropertyNames` method
841 // https://tc39.es/ecma262/#sec-object.getownpropertynames
842 // eslint-disable-next-line es/no-object-getownpropertynames -- safe
843 objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
844 return internalObjectKeys$1(O, hiddenKeys$1);
847 var objectGetOwnPropertySymbols = {};
849 // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
850 objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
852 var getBuiltIn$2 = getBuiltIn$5;
853 var uncurryThis$4 = functionUncurryThis;
854 var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
855 var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
856 var anObject$5 = anObject$7;
858 var concat = uncurryThis$4([].concat);
860 // all object keys, includes non-enumerable and symbols
861 var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
862 var keys = getOwnPropertyNamesModule.f(anObject$5(it));
863 var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
864 return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
867 var hasOwn = hasOwnProperty_1;
868 var ownKeys = ownKeys$1;
869 var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
870 var definePropertyModule$3 = objectDefineProperty;
872 var copyConstructorProperties$1 = function (target, source) {
873 var keys = ownKeys(source);
874 var defineProperty = definePropertyModule$3.f;
875 var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
876 for (var i = 0; i < keys.length; i++) {
878 if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
882 var fails$3 = fails$8;
883 var isCallable$2 = isCallable$b;
885 var replacement = /#|\.prototype\./;
887 var isForced$1 = function (feature, detection) {
888 var value = data[normalize(feature)];
889 return value == POLYFILL ? true
890 : value == NATIVE ? false
891 : isCallable$2(detection) ? fails$3(detection)
895 var normalize = isForced$1.normalize = function (string) {
896 return String(string).replace(replacement, '.').toLowerCase();
899 var data = isForced$1.data = {};
900 var NATIVE = isForced$1.NATIVE = 'N';
901 var POLYFILL = isForced$1.POLYFILL = 'P';
903 var isForced_1 = isForced$1;
905 var global$7 = global$r;
906 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
907 var createNonEnumerableProperty = createNonEnumerableProperty$3;
908 var redefine = redefine$1.exports;
909 var setGlobal = setGlobal$3;
910 var copyConstructorProperties = copyConstructorProperties$1;
911 var isForced = isForced_1;
914 options.target - name of the target object
915 options.global - target is the global object
916 options.stat - export as static methods of target
917 options.proto - export as prototype methods of target
918 options.real - real prototype method for the `pure` version
919 options.forced - export even if the native feature is available
920 options.bind - bind methods to the target, required for the `pure` version
921 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
922 options.unsafe - use the simple assignment of property instead of delete + defineProperty
923 options.sham - add a flag to not completely full polyfills
924 options.enumerable - export as enumerable property
925 options.noTargetGet - prevent calling a getter on target
926 options.name - the .name of the function if it does not match the key
928 var _export = function (options, source) {
929 var TARGET = options.target;
930 var GLOBAL = options.global;
931 var STATIC = options.stat;
932 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
936 target = global$7[TARGET] || setGlobal(TARGET, {});
938 target = (global$7[TARGET] || {}).prototype;
940 if (target) for (key in source) {
941 sourceProperty = source[key];
942 if (options.noTargetGet) {
943 descriptor = getOwnPropertyDescriptor(target, key);
944 targetProperty = descriptor && descriptor.value;
945 } else targetProperty = target[key];
946 FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
947 // contained in target
948 if (!FORCED && targetProperty !== undefined) {
949 if (typeof sourceProperty == typeof targetProperty) continue;
950 copyConstructorProperties(sourceProperty, targetProperty);
952 // add a flag to not completely full polyfills
953 if (options.sham || (targetProperty && targetProperty.sham)) {
954 createNonEnumerableProperty(sourceProperty, 'sham', true);
957 redefine(target, key, sourceProperty, options);
961 var wellKnownSymbol$5 = wellKnownSymbol$7;
963 var TO_STRING_TAG$1 = wellKnownSymbol$5('toStringTag');
966 test$1[TO_STRING_TAG$1] = 'z';
968 var toStringTagSupport = String(test$1) === '[object z]';
970 var global$6 = global$r;
971 var TO_STRING_TAG_SUPPORT = toStringTagSupport;
972 var isCallable$1 = isCallable$b;
973 var classofRaw = classofRaw$1;
974 var wellKnownSymbol$4 = wellKnownSymbol$7;
976 var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
977 var Object$1 = global$6.Object;
980 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
982 // fallback for IE11 Script Access Denied error
983 var tryGet = function (it, key) {
986 } catch (error) { /* empty */ }
989 // getting tag from ES6+ `Object.prototype.toString`
990 var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
992 return it === undefined ? 'Undefined' : it === null ? 'Null'
993 // @@toStringTag case
994 : typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG)) == 'string' ? tag
996 : CORRECT_ARGUMENTS ? classofRaw(O)
997 // ES3 arguments fallback
998 : (result = classofRaw(O)) == 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1001 var global$5 = global$r;
1002 var classof$3 = classof$4;
1004 var String$1 = global$5.String;
1006 var toString$3 = function (argument) {
1007 if (classof$3(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1008 return String$1(argument);
1011 var uncurryThis$3 = functionUncurryThis;
1013 var arraySlice$1 = uncurryThis$3([].slice);
1015 var arraySlice = arraySlice$1;
1017 var floor = Math.floor;
1019 var mergeSort = function (array, comparefn) {
1020 var length = array.length;
1021 var middle = floor(length / 2);
1022 return length < 8 ? insertionSort(array, comparefn) : merge$3(
1024 mergeSort(arraySlice(array, 0, middle), comparefn),
1025 mergeSort(arraySlice(array, middle), comparefn),
1030 var insertionSort = function (array, comparefn) {
1031 var length = array.length;
1035 while (i < length) {
1038 while (j && comparefn(array[j - 1], element) > 0) {
1039 array[j] = array[--j];
1041 if (j !== i++) array[j] = element;
1045 var merge$3 = function (array, left, right, comparefn) {
1046 var llength = left.length;
1047 var rlength = right.length;
1051 while (lindex < llength || rindex < rlength) {
1052 array[lindex + rindex] = (lindex < llength && rindex < rlength)
1053 ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
1054 : lindex < llength ? left[lindex++] : right[rindex++];
1058 var arraySort = mergeSort;
1060 var fails$2 = fails$8;
1062 var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1063 var method = [][METHOD_NAME];
1064 return !!method && fails$2(function () {
1065 // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
1066 method.call(null, argument || function () { throw 1; }, 1);
1070 var userAgent$1 = engineUserAgent;
1072 var firefox = userAgent$1.match(/firefox\/(\d+)/i);
1074 var engineFfVersion = !!firefox && +firefox[1];
1076 var UA = engineUserAgent;
1078 var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
1080 var userAgent = engineUserAgent;
1082 var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
1084 var engineWebkitVersion = !!webkit && +webkit[1];
1087 var uncurryThis$2 = functionUncurryThis;
1088 var aCallable$3 = aCallable$5;
1089 var toObject$2 = toObject$4;
1090 var lengthOfArrayLike$4 = lengthOfArrayLike$6;
1091 var toString$2 = toString$3;
1092 var fails$1 = fails$8;
1093 var internalSort = arraySort;
1094 var arrayMethodIsStrict = arrayMethodIsStrict$1;
1095 var FF = engineFfVersion;
1096 var IE_OR_EDGE = engineIsIeOrEdge;
1097 var V8 = engineV8Version;
1098 var WEBKIT = engineWebkitVersion;
1101 var un$Sort = uncurryThis$2(test.sort);
1102 var push = uncurryThis$2(test.push);
1105 var FAILS_ON_UNDEFINED = fails$1(function () {
1106 test.sort(undefined);
1109 var FAILS_ON_NULL = fails$1(function () {
1113 var STRICT_METHOD = arrayMethodIsStrict('sort');
1115 var STABLE_SORT = !fails$1(function () {
1116 // feature detection can be too slow, so check engines versions
1117 if (V8) return V8 < 70;
1118 if (FF && FF > 3) return;
1119 if (IE_OR_EDGE) return true;
1120 if (WEBKIT) return WEBKIT < 603;
1123 var code, chr, value, index;
1125 // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
1126 for (code = 65; code < 76; code++) {
1127 chr = String.fromCharCode(code);
1130 case 66: case 69: case 70: case 72: value = 3; break;
1131 case 68: case 71: value = 4; break;
1135 for (index = 0; index < 47; index++) {
1136 test.push({ k: chr + index, v: value });
1140 test.sort(function (a, b) { return b.v - a.v; });
1142 for (index = 0; index < test.length; index++) {
1143 chr = test[index].k.charAt(0);
1144 if (result.charAt(result.length - 1) !== chr) result += chr;
1147 return result !== 'DGBEFHACIJK';
1150 var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
1152 var getSortCompare = function (comparefn) {
1153 return function (x, y) {
1154 if (y === undefined) return -1;
1155 if (x === undefined) return 1;
1156 if (comparefn !== undefined) return +comparefn(x, y) || 0;
1157 return toString$2(x) > toString$2(y) ? 1 : -1;
1161 // `Array.prototype.sort` method
1162 // https://tc39.es/ecma262/#sec-array.prototype.sort
1163 $$3({ target: 'Array', proto: true, forced: FORCED }, {
1164 sort: function sort(comparefn) {
1165 if (comparefn !== undefined) aCallable$3(comparefn);
1167 var array = toObject$2(this);
1169 if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
1172 var arrayLength = lengthOfArrayLike$4(array);
1173 var itemsLength, index;
1175 for (index = 0; index < arrayLength; index++) {
1176 if (index in array) push(items, array[index]);
1179 internalSort(items, getSortCompare(comparefn));
1181 itemsLength = items.length;
1184 while (index < itemsLength) array[index] = items[index++];
1185 while (index < arrayLength) delete array[index++];
1191 var fastJsonStableStringify = function (data, opts) {
1192 if (!opts) opts = {};
1193 if (typeof opts === 'function') opts = {
1196 var cycles = typeof opts.cycles === 'boolean' ? opts.cycles : false;
1198 var cmp = opts.cmp && function (f) {
1199 return function (node) {
1200 return function (a, b) {
1209 return f(aobj, bobj);
1215 return function stringify(node) {
1216 if (node && node.toJSON && typeof node.toJSON === 'function') {
1217 node = node.toJSON();
1220 if (node === undefined) return;
1221 if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';
1222 if (typeof node !== 'object') return JSON.stringify(node);
1225 if (Array.isArray(node)) {
1228 for (i = 0; i < node.length; i++) {
1230 out += stringify(node[i]) || 'null';
1236 if (node === null) return 'null';
1238 if (seen.indexOf(node) !== -1) {
1239 if (cycles) return JSON.stringify('__cycle__');
1240 throw new TypeError('Converting circular structure to JSON');
1243 var seenIndex = seen.push(node) - 1;
1244 var keys = Object.keys(node).sort(cmp && cmp(node));
1247 for (i = 0; i < keys.length; i++) {
1249 var value = stringify(node[key]);
1250 if (!value) continue;
1251 if (out) out += ',';
1252 out += JSON.stringify(key) + ':' + value;
1255 seen.splice(seenIndex, 1);
1256 return '{' + out + '}';
1260 var require$$3 = require("./index.js");
1262 var ansiStyles$1 = {exports: {}};
1265 "aliceblue": [240, 248, 255],
1266 "antiquewhite": [250, 235, 215],
1267 "aqua": [0, 255, 255],
1268 "aquamarine": [127, 255, 212],
1269 "azure": [240, 255, 255],
1270 "beige": [245, 245, 220],
1271 "bisque": [255, 228, 196],
1273 "blanchedalmond": [255, 235, 205],
1274 "blue": [0, 0, 255],
1275 "blueviolet": [138, 43, 226],
1276 "brown": [165, 42, 42],
1277 "burlywood": [222, 184, 135],
1278 "cadetblue": [95, 158, 160],
1279 "chartreuse": [127, 255, 0],
1280 "chocolate": [210, 105, 30],
1281 "coral": [255, 127, 80],
1282 "cornflowerblue": [100, 149, 237],
1283 "cornsilk": [255, 248, 220],
1284 "crimson": [220, 20, 60],
1285 "cyan": [0, 255, 255],
1286 "darkblue": [0, 0, 139],
1287 "darkcyan": [0, 139, 139],
1288 "darkgoldenrod": [184, 134, 11],
1289 "darkgray": [169, 169, 169],
1290 "darkgreen": [0, 100, 0],
1291 "darkgrey": [169, 169, 169],
1292 "darkkhaki": [189, 183, 107],
1293 "darkmagenta": [139, 0, 139],
1294 "darkolivegreen": [85, 107, 47],
1295 "darkorange": [255, 140, 0],
1296 "darkorchid": [153, 50, 204],
1297 "darkred": [139, 0, 0],
1298 "darksalmon": [233, 150, 122],
1299 "darkseagreen": [143, 188, 143],
1300 "darkslateblue": [72, 61, 139],
1301 "darkslategray": [47, 79, 79],
1302 "darkslategrey": [47, 79, 79],
1303 "darkturquoise": [0, 206, 209],
1304 "darkviolet": [148, 0, 211],
1305 "deeppink": [255, 20, 147],
1306 "deepskyblue": [0, 191, 255],
1307 "dimgray": [105, 105, 105],
1308 "dimgrey": [105, 105, 105],
1309 "dodgerblue": [30, 144, 255],
1310 "firebrick": [178, 34, 34],
1311 "floralwhite": [255, 250, 240],
1312 "forestgreen": [34, 139, 34],
1313 "fuchsia": [255, 0, 255],
1314 "gainsboro": [220, 220, 220],
1315 "ghostwhite": [248, 248, 255],
1316 "gold": [255, 215, 0],
1317 "goldenrod": [218, 165, 32],
1318 "gray": [128, 128, 128],
1319 "green": [0, 128, 0],
1320 "greenyellow": [173, 255, 47],
1321 "grey": [128, 128, 128],
1322 "honeydew": [240, 255, 240],
1323 "hotpink": [255, 105, 180],
1324 "indianred": [205, 92, 92],
1325 "indigo": [75, 0, 130],
1326 "ivory": [255, 255, 240],
1327 "khaki": [240, 230, 140],
1328 "lavender": [230, 230, 250],
1329 "lavenderblush": [255, 240, 245],
1330 "lawngreen": [124, 252, 0],
1331 "lemonchiffon": [255, 250, 205],
1332 "lightblue": [173, 216, 230],
1333 "lightcoral": [240, 128, 128],
1334 "lightcyan": [224, 255, 255],
1335 "lightgoldenrodyellow": [250, 250, 210],
1336 "lightgray": [211, 211, 211],
1337 "lightgreen": [144, 238, 144],
1338 "lightgrey": [211, 211, 211],
1339 "lightpink": [255, 182, 193],
1340 "lightsalmon": [255, 160, 122],
1341 "lightseagreen": [32, 178, 170],
1342 "lightskyblue": [135, 206, 250],
1343 "lightslategray": [119, 136, 153],
1344 "lightslategrey": [119, 136, 153],
1345 "lightsteelblue": [176, 196, 222],
1346 "lightyellow": [255, 255, 224],
1347 "lime": [0, 255, 0],
1348 "limegreen": [50, 205, 50],
1349 "linen": [250, 240, 230],
1350 "magenta": [255, 0, 255],
1351 "maroon": [128, 0, 0],
1352 "mediumaquamarine": [102, 205, 170],
1353 "mediumblue": [0, 0, 205],
1354 "mediumorchid": [186, 85, 211],
1355 "mediumpurple": [147, 112, 219],
1356 "mediumseagreen": [60, 179, 113],
1357 "mediumslateblue": [123, 104, 238],
1358 "mediumspringgreen": [0, 250, 154],
1359 "mediumturquoise": [72, 209, 204],
1360 "mediumvioletred": [199, 21, 133],
1361 "midnightblue": [25, 25, 112],
1362 "mintcream": [245, 255, 250],
1363 "mistyrose": [255, 228, 225],
1364 "moccasin": [255, 228, 181],
1365 "navajowhite": [255, 222, 173],
1366 "navy": [0, 0, 128],
1367 "oldlace": [253, 245, 230],
1368 "olive": [128, 128, 0],
1369 "olivedrab": [107, 142, 35],
1370 "orange": [255, 165, 0],
1371 "orangered": [255, 69, 0],
1372 "orchid": [218, 112, 214],
1373 "palegoldenrod": [238, 232, 170],
1374 "palegreen": [152, 251, 152],
1375 "paleturquoise": [175, 238, 238],
1376 "palevioletred": [219, 112, 147],
1377 "papayawhip": [255, 239, 213],
1378 "peachpuff": [255, 218, 185],
1379 "peru": [205, 133, 63],
1380 "pink": [255, 192, 203],
1381 "plum": [221, 160, 221],
1382 "powderblue": [176, 224, 230],
1383 "purple": [128, 0, 128],
1384 "rebeccapurple": [102, 51, 153],
1386 "rosybrown": [188, 143, 143],
1387 "royalblue": [65, 105, 225],
1388 "saddlebrown": [139, 69, 19],
1389 "salmon": [250, 128, 114],
1390 "sandybrown": [244, 164, 96],
1391 "seagreen": [46, 139, 87],
1392 "seashell": [255, 245, 238],
1393 "sienna": [160, 82, 45],
1394 "silver": [192, 192, 192],
1395 "skyblue": [135, 206, 235],
1396 "slateblue": [106, 90, 205],
1397 "slategray": [112, 128, 144],
1398 "slategrey": [112, 128, 144],
1399 "snow": [255, 250, 250],
1400 "springgreen": [0, 255, 127],
1401 "steelblue": [70, 130, 180],
1402 "tan": [210, 180, 140],
1403 "teal": [0, 128, 128],
1404 "thistle": [216, 191, 216],
1405 "tomato": [255, 99, 71],
1406 "turquoise": [64, 224, 208],
1407 "violet": [238, 130, 238],
1408 "wheat": [245, 222, 179],
1409 "white": [255, 255, 255],
1410 "whitesmoke": [245, 245, 245],
1411 "yellow": [255, 255, 0],
1412 "yellowgreen": [154, 205, 50]
1416 /* eslint-disable no-mixed-operators */
1418 const cssKeywords = colorName; // NOTE: conversions should only return primitive values (i.e. arrays, or
1419 // values that give correct `typeof` results).
1420 // do not use box values types (i.e. Number(), String(), etc.)
1422 const reverseKeywords = {};
1424 for (const key of Object.keys(cssKeywords)) {
1425 reverseKeywords[cssKeywords[key]] = key;
1479 labels: ['h', 'c', 'g']
1483 labels: ['r16', 'g16', 'b16']
1490 var conversions$2 = convert$1; // Hide .channels and .labels properties
1492 for (const model of Object.keys(convert$1)) {
1493 if (!('channels' in convert$1[model])) {
1494 throw new Error('missing channels property: ' + model);
1497 if (!('labels' in convert$1[model])) {
1498 throw new Error('missing channel labels property: ' + model);
1501 if (convert$1[model].labels.length !== convert$1[model].channels) {
1502 throw new Error('channel and label counts mismatch: ' + model);
1508 } = convert$1[model];
1509 delete convert$1[model].channels;
1510 delete convert$1[model].labels;
1511 Object.defineProperty(convert$1[model], 'channels', {
1514 Object.defineProperty(convert$1[model], 'labels', {
1519 convert$1.rgb.hsl = function (rgb) {
1520 const r = rgb[0] / 255;
1521 const g = rgb[1] / 255;
1522 const b = rgb[2] / 255;
1523 const min = Math.min(r, g, b);
1524 const max = Math.max(r, g, b);
1525 const delta = max - min;
1531 } else if (r === max) {
1532 h = (g - b) / delta;
1533 } else if (g === max) {
1534 h = 2 + (b - r) / delta;
1535 } else if (b === max) {
1536 h = 4 + (r - g) / delta;
1539 h = Math.min(h * 60, 360);
1545 const l = (min + max) / 2;
1549 } else if (l <= 0.5) {
1550 s = delta / (max + min);
1552 s = delta / (2 - max - min);
1555 return [h, s * 100, l * 100];
1558 convert$1.rgb.hsv = function (rgb) {
1564 const r = rgb[0] / 255;
1565 const g = rgb[1] / 255;
1566 const b = rgb[2] / 255;
1567 const v = Math.max(r, g, b);
1568 const diff = v - Math.min(r, g, b);
1570 const diffc = function (c) {
1571 return (v - c) / 6 / diff + 1 / 2;
1585 } else if (g === v) {
1586 h = 1 / 3 + rdif - bdif;
1587 } else if (b === v) {
1588 h = 2 / 3 + gdif - rdif;
1598 return [h * 360, s * 100, v * 100];
1601 convert$1.rgb.hwb = function (rgb) {
1605 const h = convert$1.rgb.hsl(rgb)[0];
1606 const w = 1 / 255 * Math.min(r, Math.min(g, b));
1607 b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
1608 return [h, w * 100, b * 100];
1611 convert$1.rgb.cmyk = function (rgb) {
1612 const r = rgb[0] / 255;
1613 const g = rgb[1] / 255;
1614 const b = rgb[2] / 255;
1615 const k = Math.min(1 - r, 1 - g, 1 - b);
1616 const c = (1 - r - k) / (1 - k) || 0;
1617 const m = (1 - g - k) / (1 - k) || 0;
1618 const y = (1 - b - k) / (1 - k) || 0;
1619 return [c * 100, m * 100, y * 100, k * 100];
1622 function comparativeDistance(x, y) {
1624 See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
1626 return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
1629 convert$1.rgb.keyword = function (rgb) {
1630 const reversed = reverseKeywords[rgb];
1636 let currentClosestDistance = Infinity;
1637 let currentClosestKeyword;
1639 for (const keyword of Object.keys(cssKeywords)) {
1640 const value = cssKeywords[keyword]; // Compute comparative distance
1642 const distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
1644 if (distance < currentClosestDistance) {
1645 currentClosestDistance = distance;
1646 currentClosestKeyword = keyword;
1650 return currentClosestKeyword;
1653 convert$1.keyword.rgb = function (keyword) {
1654 return cssKeywords[keyword];
1657 convert$1.rgb.xyz = function (rgb) {
1658 let r = rgb[0] / 255;
1659 let g = rgb[1] / 255;
1660 let b = rgb[2] / 255; // Assume sRGB
1662 r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
1663 g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
1664 b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
1665 const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
1666 const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
1667 const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
1668 return [x * 100, y * 100, z * 100];
1671 convert$1.rgb.lab = function (rgb) {
1672 const xyz = convert$1.rgb.xyz(rgb);
1679 x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
1680 y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
1681 z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
1682 const l = 116 * y - 16;
1683 const a = 500 * (x - y);
1684 const b = 200 * (y - z);
1688 convert$1.hsl.rgb = function (hsl) {
1689 const h = hsl[0] / 360;
1690 const s = hsl[1] / 100;
1691 const l = hsl[2] / 100;
1698 return [val, val, val];
1707 const t1 = 2 * l - t2;
1708 const rgb = [0, 0, 0];
1710 for (let i = 0; i < 3; i++) {
1711 t3 = h + 1 / 3 * -(i - 1);
1722 val = t1 + (t2 - t1) * 6 * t3;
1723 } else if (2 * t3 < 1) {
1725 } else if (3 * t3 < 2) {
1726 val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
1737 convert$1.hsl.hsv = function (hsl) {
1739 let s = hsl[1] / 100;
1740 let l = hsl[2] / 100;
1742 const lmin = Math.max(l, 0.01);
1744 s *= l <= 1 ? l : 2 - l;
1745 smin *= lmin <= 1 ? lmin : 2 - lmin;
1746 const v = (l + s) / 2;
1747 const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
1748 return [h, sv * 100, v * 100];
1751 convert$1.hsv.rgb = function (hsv) {
1752 const h = hsv[0] / 60;
1753 const s = hsv[1] / 100;
1754 let v = hsv[2] / 100;
1755 const hi = Math.floor(h) % 6;
1756 const f = h - Math.floor(h);
1757 const p = 255 * v * (1 - s);
1758 const q = 255 * v * (1 - s * f);
1759 const t = 255 * v * (1 - s * (1 - f));
1783 convert$1.hsv.hsl = function (hsv) {
1785 const s = hsv[1] / 100;
1786 const v = hsv[2] / 100;
1787 const vmin = Math.max(v, 0.01);
1791 const lmin = (2 - s) * vmin;
1793 sl /= lmin <= 1 ? lmin : 2 - lmin;
1796 return [h, sl * 100, l * 100];
1797 }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
1800 convert$1.hwb.rgb = function (hwb) {
1801 const h = hwb[0] / 360;
1802 let wh = hwb[1] / 100;
1803 let bl = hwb[2] / 100;
1804 const ratio = wh + bl;
1805 let f; // Wh + bl cant be > 1
1812 const i = Math.floor(6 * h);
1816 if ((i & 0x01) !== 0) {
1820 const n = wh + f * (v - wh); // Linear interpolation
1825 /* eslint-disable max-statements-per-line,no-multi-spaces */
1866 /* eslint-enable max-statements-per-line,no-multi-spaces */
1869 return [r * 255, g * 255, b * 255];
1872 convert$1.cmyk.rgb = function (cmyk) {
1873 const c = cmyk[0] / 100;
1874 const m = cmyk[1] / 100;
1875 const y = cmyk[2] / 100;
1876 const k = cmyk[3] / 100;
1877 const r = 1 - Math.min(1, c * (1 - k) + k);
1878 const g = 1 - Math.min(1, m * (1 - k) + k);
1879 const b = 1 - Math.min(1, y * (1 - k) + k);
1880 return [r * 255, g * 255, b * 255];
1883 convert$1.xyz.rgb = function (xyz) {
1884 const x = xyz[0] / 100;
1885 const y = xyz[1] / 100;
1886 const z = xyz[2] / 100;
1890 r = x * 3.2406 + y * -1.5372 + z * -0.4986;
1891 g = x * -0.9689 + y * 1.8758 + z * 0.0415;
1892 b = x * 0.0557 + y * -0.2040 + z * 1.0570; // Assume sRGB
1894 r = r > 0.0031308 ? 1.055 * r ** (1.0 / 2.4) - 0.055 : r * 12.92;
1895 g = g > 0.0031308 ? 1.055 * g ** (1.0 / 2.4) - 0.055 : g * 12.92;
1896 b = b > 0.0031308 ? 1.055 * b ** (1.0 / 2.4) - 0.055 : b * 12.92;
1897 r = Math.min(Math.max(0, r), 1);
1898 g = Math.min(Math.max(0, g), 1);
1899 b = Math.min(Math.max(0, b), 1);
1900 return [r * 255, g * 255, b * 255];
1903 convert$1.xyz.lab = function (xyz) {
1910 x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
1911 y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
1912 z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
1913 const l = 116 * y - 16;
1914 const a = 500 * (x - y);
1915 const b = 200 * (y - z);
1919 convert$1.lab.xyz = function (lab) {
1932 y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
1933 x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
1934 z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
1941 convert$1.lab.lch = function (lab) {
1946 const hr = Math.atan2(b, a);
1947 h = hr * 360 / 2 / Math.PI;
1953 const c = Math.sqrt(a * a + b * b);
1957 convert$1.lch.lab = function (lch) {
1961 const hr = h / 360 * 2 * Math.PI;
1962 const a = c * Math.cos(hr);
1963 const b = c * Math.sin(hr);
1967 convert$1.rgb.ansi16 = function (args, saturation = null) {
1968 const [r, g, b] = args;
1969 let value = saturation === null ? convert$1.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
1971 value = Math.round(value / 50);
1977 let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
1986 convert$1.hsv.ansi16 = function (args) {
1987 // Optimization here; we already know the value and don't need to get
1988 // it converted for us.
1989 return convert$1.rgb.ansi16(convert$1.hsv.rgb(args), args[2]);
1992 convert$1.rgb.ansi256 = function (args) {
1995 const b = args[2]; // We use the extended greyscale palette here, with the exception of
1996 // black and white. normal palette only has 4 greyscale shades.
1998 if (r === g && g === b) {
2007 return Math.round((r - 8) / 247 * 24) + 232;
2010 const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
2014 convert$1.ansi16.rgb = function (args) {
2015 let color = args % 10; // Handle greyscale
2017 if (color === 0 || color === 7) {
2022 color = color / 10.5 * 255;
2023 return [color, color, color];
2026 const mult = (~~(args > 50) + 1) * 0.5;
2027 const r = (color & 1) * mult * 255;
2028 const g = (color >> 1 & 1) * mult * 255;
2029 const b = (color >> 2 & 1) * mult * 255;
2033 convert$1.ansi256.rgb = function (args) {
2036 const c = (args - 232) * 10 + 8;
2042 const r = Math.floor(args / 36) / 5 * 255;
2043 const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
2044 const b = rem % 6 / 5 * 255;
2048 convert$1.rgb.hex = function (args) {
2049 const integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
2050 const string = integer.toString(16).toUpperCase();
2051 return '000000'.substring(string.length) + string;
2054 convert$1.hex.rgb = function (args) {
2055 const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
2061 let colorString = match[0];
2063 if (match[0].length === 3) {
2064 colorString = colorString.split('').map(char => {
2069 const integer = parseInt(colorString, 16);
2070 const r = integer >> 16 & 0xFF;
2071 const g = integer >> 8 & 0xFF;
2072 const b = integer & 0xFF;
2076 convert$1.rgb.hcg = function (rgb) {
2077 const r = rgb[0] / 255;
2078 const g = rgb[1] / 255;
2079 const b = rgb[2] / 255;
2080 const max = Math.max(Math.max(r, g), b);
2081 const min = Math.min(Math.min(r, g), b);
2082 const chroma = max - min;
2087 grayscale = min / (1 - chroma);
2094 } else if (max === r) {
2095 hue = (g - b) / chroma % 6;
2096 } else if (max === g) {
2097 hue = 2 + (b - r) / chroma;
2099 hue = 4 + (r - g) / chroma;
2104 return [hue * 360, chroma * 100, grayscale * 100];
2107 convert$1.hsl.hcg = function (hsl) {
2108 const s = hsl[1] / 100;
2109 const l = hsl[2] / 100;
2110 const c = l < 0.5 ? 2.0 * s * l : 2.0 * s * (1.0 - l);
2114 f = (l - 0.5 * c) / (1.0 - c);
2117 return [hsl[0], c * 100, f * 100];
2120 convert$1.hsv.hcg = function (hsv) {
2121 const s = hsv[1] / 100;
2122 const v = hsv[2] / 100;
2127 f = (v - c) / (1 - c);
2130 return [hsv[0], c * 100, f * 100];
2133 convert$1.hcg.rgb = function (hcg) {
2134 const h = hcg[0] / 360;
2135 const c = hcg[1] / 100;
2136 const g = hcg[2] / 100;
2139 return [g * 255, g * 255, g * 255];
2142 const pure = [0, 0, 0];
2143 const hi = h % 1 * 6;
2147 /* eslint-disable max-statements-per-line */
2149 switch (Math.floor(hi)) {
2185 /* eslint-enable max-statements-per-line */
2189 return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
2192 convert$1.hcg.hsv = function (hcg) {
2193 const c = hcg[1] / 100;
2194 const g = hcg[2] / 100;
2195 const v = c + g * (1.0 - c);
2202 return [hcg[0], f * 100, v * 100];
2205 convert$1.hcg.hsl = function (hcg) {
2206 const c = hcg[1] / 100;
2207 const g = hcg[2] / 100;
2208 const l = g * (1.0 - c) + 0.5 * c;
2211 if (l > 0.0 && l < 0.5) {
2213 } else if (l >= 0.5 && l < 1.0) {
2214 s = c / (2 * (1 - l));
2217 return [hcg[0], s * 100, l * 100];
2220 convert$1.hcg.hwb = function (hcg) {
2221 const c = hcg[1] / 100;
2222 const g = hcg[2] / 100;
2223 const v = c + g * (1.0 - c);
2224 return [hcg[0], (v - c) * 100, (1 - v) * 100];
2227 convert$1.hwb.hcg = function (hwb) {
2228 const w = hwb[1] / 100;
2229 const b = hwb[2] / 100;
2235 g = (v - c) / (1 - c);
2238 return [hwb[0], c * 100, g * 100];
2241 convert$1.apple.rgb = function (apple) {
2242 return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
2245 convert$1.rgb.apple = function (rgb) {
2246 return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
2249 convert$1.gray.rgb = function (args) {
2250 return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
2253 convert$1.gray.hsl = function (args) {
2254 return [0, 0, args[0]];
2257 convert$1.gray.hsv = convert$1.gray.hsl;
2259 convert$1.gray.hwb = function (gray) {
2260 return [0, 100, gray[0]];
2263 convert$1.gray.cmyk = function (gray) {
2264 return [0, 0, 0, gray[0]];
2267 convert$1.gray.lab = function (gray) {
2268 return [gray[0], 0, 0];
2271 convert$1.gray.hex = function (gray) {
2272 const val = Math.round(gray[0] / 100 * 255) & 0xFF;
2273 const integer = (val << 16) + (val << 8) + val;
2274 const string = integer.toString(16).toUpperCase();
2275 return '000000'.substring(string.length) + string;
2278 convert$1.rgb.gray = function (rgb) {
2279 const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
2280 return [val / 255 * 100];
2283 const conversions$1 = conversions$2;
2285 This function routes a model to all other models.
2287 all functions that are routed have a property `.conversion` attached
2288 to the returned synthetic function. This property is an array
2289 of strings, each with the steps in between the 'from' and 'to'
2290 color models (inclusive).
2292 conversions that are not possible simply are not included.
2295 function buildGraph() {
2296 const graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
2298 const models = Object.keys(conversions$1);
2300 for (let len = models.length, i = 0; i < len; i++) {
2301 graph[models[i]] = {
2302 // http://jsperf.com/1-vs-infinity
2303 // micro-opt, but this is simple.
2310 } // https://en.wikipedia.org/wiki/Breadth-first_search
2313 function deriveBFS(fromModel) {
2314 const graph = buildGraph();
2315 const queue = [fromModel]; // Unshift -> queue -> pop
2317 graph[fromModel].distance = 0;
2319 while (queue.length) {
2320 const current = queue.pop();
2321 const adjacents = Object.keys(conversions$1[current]);
2323 for (let len = adjacents.length, i = 0; i < len; i++) {
2324 const adjacent = adjacents[i];
2325 const node = graph[adjacent];
2327 if (node.distance === -1) {
2328 node.distance = graph[current].distance + 1;
2329 node.parent = current;
2330 queue.unshift(adjacent);
2338 function link(from, to) {
2339 return function (args) {
2340 return to(from(args));
2344 function wrapConversion(toModel, graph) {
2345 const path = [graph[toModel].parent, toModel];
2346 let fn = conversions$1[graph[toModel].parent][toModel];
2347 let cur = graph[toModel].parent;
2349 while (graph[cur].parent) {
2350 path.unshift(graph[cur].parent);
2351 fn = link(conversions$1[graph[cur].parent][cur], fn);
2352 cur = graph[cur].parent;
2355 fn.conversion = path;
2359 var route$1 = function (fromModel) {
2360 const graph = deriveBFS(fromModel);
2361 const conversion = {};
2362 const models = Object.keys(graph);
2364 for (let len = models.length, i = 0; i < len; i++) {
2365 const toModel = models[i];
2366 const node = graph[toModel];
2368 if (node.parent === null) {
2369 // No possible conversion, or this node is the source model.
2373 conversion[toModel] = wrapConversion(toModel, graph);
2379 const conversions = conversions$2;
2380 const route = route$1;
2382 const models = Object.keys(conversions);
2384 function wrapRaw(fn) {
2385 const wrappedFn = function (...args) {
2386 const arg0 = args[0];
2388 if (arg0 === undefined || arg0 === null) {
2392 if (arg0.length > 1) {
2397 }; // Preserve .conversion property if there is one
2400 if ('conversion' in fn) {
2401 wrappedFn.conversion = fn.conversion;
2407 function wrapRounded(fn) {
2408 const wrappedFn = function (...args) {
2409 const arg0 = args[0];
2411 if (arg0 === undefined || arg0 === null) {
2415 if (arg0.length > 1) {
2419 const result = fn(args); // We're assuming the result is an array here.
2420 // see notice in conversions.js; don't use box types
2421 // in conversion functions.
2423 if (typeof result === 'object') {
2424 for (let len = result.length, i = 0; i < len; i++) {
2425 result[i] = Math.round(result[i]);
2430 }; // Preserve .conversion property if there is one
2433 if ('conversion' in fn) {
2434 wrappedFn.conversion = fn.conversion;
2440 models.forEach(fromModel => {
2441 convert[fromModel] = {};
2442 Object.defineProperty(convert[fromModel], 'channels', {
2443 value: conversions[fromModel].channels
2445 Object.defineProperty(convert[fromModel], 'labels', {
2446 value: conversions[fromModel].labels
2448 const routes = route(fromModel);
2449 const routeModels = Object.keys(routes);
2450 routeModels.forEach(toModel => {
2451 const fn = routes[toModel];
2452 convert[fromModel][toModel] = wrapRounded(fn);
2453 convert[fromModel][toModel].raw = wrapRaw(fn);
2456 var colorConvert = convert;
2458 (function (module) {
2460 const wrapAnsi16 = (fn, offset) => (...args) => {
2461 const code = fn(...args);
2462 return `\u001B[${code + offset}m`;
2465 const wrapAnsi256 = (fn, offset) => (...args) => {
2466 const code = fn(...args);
2467 return `\u001B[${38 + offset};5;${code}m`;
2470 const wrapAnsi16m = (fn, offset) => (...args) => {
2471 const rgb = fn(...args);
2472 return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
2475 const ansi2ansi = n => n;
2477 const rgb2rgb = (r, g, b) => [r, g, b];
2479 const setLazyProperty = (object, property, get) => {
2480 Object.defineProperty(object, property, {
2482 const value = get();
2483 Object.defineProperty(object, property, {
2494 /** @type {typeof import('color-convert')} */
2499 const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
2500 if (colorConvert$1 === undefined) {
2501 colorConvert$1 = colorConvert;
2504 const offset = isBackground ? 10 : 0;
2507 for (const [sourceSpace, suite] of Object.entries(colorConvert$1)) {
2508 const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
2510 if (sourceSpace === targetSpace) {
2511 styles[name] = wrap(identity, offset);
2512 } else if (typeof suite === 'object') {
2513 styles[name] = wrap(suite[targetSpace], offset);
2520 function assembleStyles() {
2521 const codes = new Map();
2525 // 21 isn't widely supported and 22 does the same thing
2532 strikethrough: [9, 29]
2544 blackBright: [90, 39],
2545 redBright: [91, 39],
2546 greenBright: [92, 39],
2547 yellowBright: [93, 39],
2548 blueBright: [94, 39],
2549 magentaBright: [95, 39],
2550 cyanBright: [96, 39],
2551 whiteBright: [97, 39]
2559 bgMagenta: [45, 49],
2563 bgBlackBright: [100, 49],
2564 bgRedBright: [101, 49],
2565 bgGreenBright: [102, 49],
2566 bgYellowBright: [103, 49],
2567 bgBlueBright: [104, 49],
2568 bgMagentaBright: [105, 49],
2569 bgCyanBright: [106, 49],
2570 bgWhiteBright: [107, 49]
2572 }; // Alias bright black as gray (and grey)
2574 styles.color.gray = styles.color.blackBright;
2575 styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
2576 styles.color.grey = styles.color.blackBright;
2577 styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
2579 for (const [groupName, group] of Object.entries(styles)) {
2580 for (const [styleName, style] of Object.entries(group)) {
2581 styles[styleName] = {
2582 open: `\u001B[${style[0]}m`,
2583 close: `\u001B[${style[1]}m`
2585 group[styleName] = styles[styleName];
2586 codes.set(style[0], style[1]);
2589 Object.defineProperty(styles, groupName, {
2595 Object.defineProperty(styles, 'codes', {
2599 styles.color.close = '\u001B[39m';
2600 styles.bgColor.close = '\u001B[49m';
2601 setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
2602 setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
2603 setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
2604 setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
2605 setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
2606 setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
2608 } // Make the export immutable
2611 Object.defineProperty(module, 'exports', {
2617 var hasFlag$1 = (flag, argv = process.argv) => {
2618 const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2619 const position = argv.indexOf(prefix + flag);
2620 const terminatorPosition = argv.indexOf('--');
2621 return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2624 const os = require$$0__default["default"];
2625 const tty = require$$1__default["default"];
2626 const hasFlag = hasFlag$1;
2632 if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
2634 } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
2638 if ('FORCE_COLOR' in env) {
2639 if (env.FORCE_COLOR === 'true') {
2641 } else if (env.FORCE_COLOR === 'false') {
2644 forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
2648 function translateLevel(level) {
2661 function supportsColor(haveStream, streamIsTTY) {
2662 if (forceColor === 0) {
2666 if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
2670 if (hasFlag('color=256')) {
2674 if (haveStream && !streamIsTTY && forceColor === undefined) {
2678 const min = forceColor || 0;
2680 if (env.TERM === 'dumb') {
2684 if (process.platform === 'win32') {
2685 // Windows 10 build 10586 is the first Windows release that supports 256 colors.
2686 // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
2687 const osRelease = os.release().split('.');
2689 if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
2690 return Number(osRelease[2]) >= 14931 ? 3 : 2;
2697 if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2704 if ('TEAMCITY_VERSION' in env) {
2705 return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2708 if (env.COLORTERM === 'truecolor') {
2712 if ('TERM_PROGRAM' in env) {
2713 const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2715 switch (env.TERM_PROGRAM) {
2717 return version >= 3 ? 3 : 2;
2719 case 'Apple_Terminal':
2725 if (/-256(color)?$/i.test(env.TERM)) {
2729 if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2733 if ('COLORTERM' in env) {
2740 function getSupportLevel(stream) {
2741 const level = supportsColor(stream, stream && stream.isTTY);
2742 return translateLevel(level);
2745 var supportsColor_1 = {
2746 supportsColor: getSupportLevel,
2747 stdout: translateLevel(supportsColor(true, tty.isatty(1))),
2748 stderr: translateLevel(supportsColor(true, tty.isatty(2)))
2751 const stringReplaceAll$1 = (string, substring, replacer) => {
2752 let index = string.indexOf(substring);
2758 const substringLength = substring.length;
2760 let returnValue = '';
2763 returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
2764 endIndex = index + substringLength;
2765 index = string.indexOf(substring, endIndex);
2766 } while (index !== -1);
2768 returnValue += string.substr(endIndex);
2772 const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
2774 let returnValue = '';
2777 const gotCR = string[index - 1] === '\r';
2778 returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
2779 endIndex = index + 1;
2780 index = string.indexOf('\n', endIndex);
2781 } while (index !== -1);
2783 returnValue += string.substr(endIndex);
2788 stringReplaceAll: stringReplaceAll$1,
2789 stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
2792 const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
2793 const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
2794 const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
2795 const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
2796 const ESCAPES = new Map([['n', '\n'], ['r', '\r'], ['t', '\t'], ['b', '\b'], ['f', '\f'], ['v', '\v'], ['0', '\0'], ['\\', '\\'], ['e', '\u001B'], ['a', '\u0007']]);
2798 function unescape(c) {
2799 const u = c[0] === 'u';
2800 const bracket = c[1] === '{';
2802 if (u && !bracket && c.length === 5 || c[0] === 'x' && c.length === 3) {
2803 return String.fromCharCode(parseInt(c.slice(1), 16));
2807 return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
2810 return ESCAPES.get(c) || c;
2813 function parseArguments(name, arguments_) {
2815 const chunks = arguments_.trim().split(/\s*,\s*/g);
2818 for (const chunk of chunks) {
2819 const number = Number(chunk);
2821 if (!Number.isNaN(number)) {
2822 results.push(number);
2823 } else if (matches = chunk.match(STRING_REGEX)) {
2824 results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
2826 throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
2833 function parseStyle(style) {
2834 STYLE_REGEX.lastIndex = 0;
2838 while ((matches = STYLE_REGEX.exec(style)) !== null) {
2839 const name = matches[1];
2842 const args = parseArguments(name, matches[2]);
2843 results.push([name].concat(args));
2845 results.push([name]);
2852 function buildStyle(chalk, styles) {
2855 for (const layer of styles) {
2856 for (const style of layer.styles) {
2857 enabled[style[0]] = layer.inverse ? null : style.slice(1);
2861 let current = chalk;
2863 for (const [styleName, styles] of Object.entries(enabled)) {
2864 if (!Array.isArray(styles)) {
2868 if (!(styleName in current)) {
2869 throw new Error(`Unknown Chalk style: ${styleName}`);
2872 current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
2878 var templates = (chalk, temporary) => {
2881 let chunk = []; // eslint-disable-next-line max-params
2883 temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
2884 if (escapeCharacter) {
2885 chunk.push(unescape(escapeCharacter));
2887 const string = chunk.join('');
2889 chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
2892 styles: parseStyle(style)
2895 if (styles.length === 0) {
2896 throw new Error('Found extraneous } in Chalk template literal');
2899 chunks.push(buildStyle(chalk, styles)(chunk.join('')));
2903 chunk.push(character);
2906 chunks.push(chunk.join(''));
2908 if (styles.length > 0) {
2909 const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
2910 throw new Error(errMessage);
2913 return chunks.join('');
2916 const ansiStyles = ansiStyles$1.exports;
2918 stdout: stdoutColor,
2920 } = supportsColor_1;
2923 stringEncaseCRLFWithFirstIndex
2927 } = Array; // `supportsColor.level` → `ansiStyles.color[name]` mapping
2929 const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
2930 const styles = Object.create(null);
2932 const applyOptions = (object, options = {}) => {
2933 if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
2934 throw new Error('The `level` option should be an integer from 0 to 3');
2935 } // Detect level if not set manually
2938 const colorLevel = stdoutColor ? stdoutColor.level : 0;
2939 object.level = options.level === undefined ? colorLevel : options.level;
2943 constructor(options) {
2944 // eslint-disable-next-line no-constructor-return
2945 return chalkFactory(options);
2950 const chalkFactory = options => {
2952 applyOptions(chalk, options);
2954 chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
2956 Object.setPrototypeOf(chalk, Chalk.prototype);
2957 Object.setPrototypeOf(chalk.template, chalk);
2959 chalk.template.constructor = () => {
2960 throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
2963 chalk.template.Instance = ChalkClass;
2964 return chalk.template;
2967 function Chalk(options) {
2968 return chalkFactory(options);
2971 for (const [styleName, style] of Object.entries(ansiStyles)) {
2972 styles[styleName] = {
2974 const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
2975 Object.defineProperty(this, styleName, {
2986 const builder = createBuilder(this, this._styler, true);
2987 Object.defineProperty(this, 'visible', {
2994 const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
2996 for (const model of usedModels) {
3002 return function (...arguments_) {
3003 const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
3004 return createBuilder(this, styler, this._isEmpty);
3011 for (const model of usedModels) {
3012 const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
3018 return function (...arguments_) {
3019 const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
3020 return createBuilder(this, styler, this._isEmpty);
3027 const proto = Object.defineProperties(() => {}, Object.assign(Object.assign({}, styles), {}, {
3032 return this._generator.level;
3036 this._generator.level = level;
3042 const createStyler = (open, close, parent) => {
3046 if (parent === undefined) {
3050 openAll = parent.openAll + open;
3051 closeAll = close + parent.closeAll;
3063 const createBuilder = (self, _styler, _isEmpty) => {
3064 const builder = (...arguments_) => {
3065 if (isArray$e(arguments_[0]) && isArray$e(arguments_[0].raw)) {
3066 // Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
3067 return applyStyle(builder, chalkTag(builder, ...arguments_));
3068 } // Single argument is hot path, implicit coercion is faster than anything
3069 // eslint-disable-next-line no-implicit-coercion
3072 return applyStyle(builder, arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' '));
3073 }; // We alter the prototype because we must return a function, but there is
3074 // no way to create a function with a different prototype
3077 Object.setPrototypeOf(builder, proto);
3078 builder._generator = self;
3079 builder._styler = _styler;
3080 builder._isEmpty = _isEmpty;
3084 const applyStyle = (self, string) => {
3085 if (self.level <= 0 || !string) {
3086 return self._isEmpty ? '' : string;
3089 let styler = self._styler;
3091 if (styler === undefined) {
3100 if (string.indexOf('\u001B') !== -1) {
3101 while (styler !== undefined) {
3102 // Replace any instances already present with a re-opening code
3103 // otherwise only the part of the string until said closing code
3104 // will be colored, and the rest will simply be 'plain'.
3105 string = stringReplaceAll(string, styler.close, styler.open);
3106 styler = styler.parent;
3108 } // We can move both next actions out of loop, because remaining actions in loop won't have
3109 // any/visible effect on parts we add here. Close the styling before a linebreak and reopen
3110 // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
3113 const lfIndex = string.indexOf('\n');
3115 if (lfIndex !== -1) {
3116 string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
3119 return openAll + string + closeAll;
3124 const chalkTag = (chalk, ...strings) => {
3125 const [firstString] = strings;
3127 if (!isArray$e(firstString) || !isArray$e(firstString.raw)) {
3128 // If chalk() was called by itself or with a string,
3129 // return the string itself as a string.
3130 return strings.join(' ');
3133 const arguments_ = strings.slice(1);
3134 const parts = [firstString.raw[0]];
3136 for (let i = 1; i < firstString.length; i++) {
3137 parts.push(String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), String(firstString.raw[i]));
3140 if (template === undefined) {
3141 template = templates;
3144 return template(chalk, parts.join(''));
3147 Object.defineProperties(Chalk.prototype, styles);
3148 const chalk$2 = Chalk(); // eslint-disable-line new-cap
3150 chalk$2.supportsColor = stdoutColor;
3151 chalk$2.stderr = Chalk({
3152 level: stderrColor ? stderrColor.level : 0
3153 }); // eslint-disable-line new-cap
3155 chalk$2.stderr.supportsColor = stderrColor;
3156 var source = chalk$2;
3158 var require$$4 = require("./third-party.js");
3160 var prettierInternal = require$$3.__internal;
3162 var classof$2 = classofRaw$1;
3164 // `IsArray` abstract operation
3165 // https://tc39.es/ecma262/#sec-isarray
3166 // eslint-disable-next-line es/no-array-isarray -- safe
3167 var isArray$d = Array.isArray || function isArray(argument) {
3168 return classof$2(argument) == 'Array';
3171 var uncurryThis$1 = functionUncurryThis;
3172 var aCallable$2 = aCallable$5;
3174 var bind$2 = uncurryThis$1(uncurryThis$1.bind);
3176 // optional / simple context binding
3177 var functionBindContext = function (fn, that) {
3179 return that === undefined ? fn : bind$2 ? bind$2(fn, that) : function (/* ...args */) {
3180 return fn.apply(that, arguments);
3184 var global$4 = global$r;
3185 var isArray$c = isArray$d;
3186 var lengthOfArrayLike$3 = lengthOfArrayLike$6;
3187 var bind$1 = functionBindContext;
3189 var TypeError$3 = global$4.TypeError;
3191 // `FlattenIntoArray` abstract operation
3192 // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
3193 var flattenIntoArray$2 = function (target, original, source, sourceLen, start, depth, mapper, thisArg) {
3194 var targetIndex = start;
3195 var sourceIndex = 0;
3196 var mapFn = mapper ? bind$1(mapper, thisArg) : false;
3197 var element, elementLen;
3199 while (sourceIndex < sourceLen) {
3200 if (sourceIndex in source) {
3201 element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
3203 if (depth > 0 && isArray$c(element)) {
3204 elementLen = lengthOfArrayLike$3(element);
3205 targetIndex = flattenIntoArray$2(target, original, element, elementLen, targetIndex, depth - 1) - 1;
3207 if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError$3('Exceed the acceptable array length');
3208 target[targetIndex] = element;
3218 var flattenIntoArray_1 = flattenIntoArray$2;
3220 var uncurryThis = functionUncurryThis;
3221 var fails = fails$8;
3222 var isCallable = isCallable$b;
3223 var classof$1 = classof$4;
3224 var getBuiltIn$1 = getBuiltIn$5;
3225 var inspectSource = inspectSource$3;
3227 var noop$1 = function () { /* empty */ };
3229 var construct = getBuiltIn$1('Reflect', 'construct');
3230 var constructorRegExp = /^\s*(?:class|function)\b/;
3231 var exec = uncurryThis(constructorRegExp.exec);
3232 var INCORRECT_TO_STRING = !constructorRegExp.exec(noop$1);
3234 var isConstructorModern = function (argument) {
3235 if (!isCallable(argument)) return false;
3237 construct(noop$1, empty, argument);
3244 var isConstructorLegacy = function (argument) {
3245 if (!isCallable(argument)) return false;
3246 switch (classof$1(argument)) {
3247 case 'AsyncFunction':
3248 case 'GeneratorFunction':
3249 case 'AsyncGeneratorFunction': return false;
3250 // we can't check .prototype since constructors produced by .bind haven't it
3251 } return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
3254 // `IsConstructor` abstract operation
3255 // https://tc39.es/ecma262/#sec-isconstructor
3256 var isConstructor$1 = !construct || fails(function () {
3258 return isConstructorModern(isConstructorModern.call)
3259 || !isConstructorModern(Object)
3260 || !isConstructorModern(function () { called = true; })
3262 }) ? isConstructorLegacy : isConstructorModern;
3264 var global$3 = global$r;
3265 var isArray$b = isArray$d;
3266 var isConstructor = isConstructor$1;
3267 var isObject$7 = isObject$d;
3268 var wellKnownSymbol$3 = wellKnownSymbol$7;
3270 var SPECIES = wellKnownSymbol$3('species');
3271 var Array$1 = global$3.Array;
3273 // a part of `ArraySpeciesCreate` abstract operation
3274 // https://tc39.es/ecma262/#sec-arrayspeciescreate
3275 var arraySpeciesConstructor$1 = function (originalArray) {
3277 if (isArray$b(originalArray)) {
3278 C = originalArray.constructor;
3279 // cross-realm fallback
3280 if (isConstructor(C) && (C === Array$1 || isArray$b(C.prototype))) C = undefined;
3281 else if (isObject$7(C)) {
3283 if (C === null) C = undefined;
3285 } return C === undefined ? Array$1 : C;
3288 var arraySpeciesConstructor = arraySpeciesConstructor$1;
3290 // `ArraySpeciesCreate` abstract operation
3291 // https://tc39.es/ecma262/#sec-arrayspeciescreate
3292 var arraySpeciesCreate$2 = function (originalArray, length) {
3293 return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
3297 var flattenIntoArray$1 = flattenIntoArray_1;
3298 var aCallable$1 = aCallable$5;
3299 var toObject$1 = toObject$4;
3300 var lengthOfArrayLike$2 = lengthOfArrayLike$6;
3301 var arraySpeciesCreate$1 = arraySpeciesCreate$2;
3303 // `Array.prototype.flatMap` method
3304 // https://tc39.es/ecma262/#sec-array.prototype.flatmap
3305 $$2({ target: 'Array', proto: true }, {
3306 flatMap: function flatMap(callbackfn /* , thisArg */) {
3307 var O = toObject$1(this);
3308 var sourceLen = lengthOfArrayLike$2(O);
3310 aCallable$1(callbackfn);
3311 A = arraySpeciesCreate$1(O, 0);
3312 A.length = flattenIntoArray$1(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
3323 Object.defineProperty(array$3, "__esModule", {
3326 array$3.splitWhen = array$3.flatten = void 0;
3328 function flatten$2(items) {
3329 return items.reduce((collection, item) => [].concat(collection, item), []);
3332 array$3.flatten = flatten$2;
3334 function splitWhen(items, predicate) {
3335 const result = [[]];
3338 for (const item of items) {
3339 if (predicate(item)) {
3341 result[groupIndex] = [];
3343 result[groupIndex].push(item);
3350 array$3.splitWhen = splitWhen;
3354 Object.defineProperty(errno$1, "__esModule", {
3357 errno$1.isEnoentCodeError = void 0;
3359 function isEnoentCodeError(error) {
3360 return error.code === 'ENOENT';
3363 errno$1.isEnoentCodeError = isEnoentCodeError;
3367 Object.defineProperty(fs$9, "__esModule", {
3370 fs$9.createDirentFromStats = void 0;
3372 class DirentFromStats$1 {
3373 constructor(name, stats) {
3375 this.isBlockDevice = stats.isBlockDevice.bind(stats);
3376 this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
3377 this.isDirectory = stats.isDirectory.bind(stats);
3378 this.isFIFO = stats.isFIFO.bind(stats);
3379 this.isFile = stats.isFile.bind(stats);
3380 this.isSocket = stats.isSocket.bind(stats);
3381 this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
3386 function createDirentFromStats$1(name, stats) {
3387 return new DirentFromStats$1(name, stats);
3390 fs$9.createDirentFromStats = createDirentFromStats$1;
3394 Object.defineProperty(path$c, "__esModule", {
3397 path$c.removeLeadingDotSegment = path$c.escape = path$c.makeAbsolute = path$c.unixify = void 0;
3398 const path$b = require$$0__default$1["default"];
3399 const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
3401 const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
3403 * Designed to work only with simple paths: `dir\\file`.
3406 function unixify(filepath) {
3407 return filepath.replace(/\\/g, '/');
3410 path$c.unixify = unixify;
3412 function makeAbsolute(cwd, filepath) {
3413 return path$b.resolve(cwd, filepath);
3416 path$c.makeAbsolute = makeAbsolute;
3418 function escape(pattern) {
3419 return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
3422 path$c.escape = escape;
3424 function removeLeadingDotSegment(entry) {
3425 // We do not use `startsWith` because this is 10x slower than current implementation for some cases.
3426 // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
3427 if (entry.charAt(0) === '.') {
3428 const secondCharactery = entry.charAt(1);
3430 if (secondCharactery === '/' || secondCharactery === '\\') {
3431 return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
3438 path$c.removeLeadingDotSegment = removeLeadingDotSegment;
3443 * is-extglob <https://github.com/jonschlinkert/is-extglob>
3445 * Copyright (c) 2014-2016, Jon Schlinkert.
3446 * Licensed under the MIT License.
3449 var isExtglob$1 = function isExtglob(str) {
3450 if (typeof str !== 'string' || str === '') {
3456 while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
3457 if (match[2]) return true;
3458 str = str.slice(match.index + match[0].length);
3465 * is-glob <https://github.com/jonschlinkert/is-glob>
3467 * Copyright (c) 2014-2017, Jon Schlinkert.
3468 * Released under the MIT License.
3470 var isExtglob = isExtglob$1;
3477 var strictCheck = function (str) {
3478 if (str[0] === '!') {
3484 var closeSquareIndex = -2;
3485 var closeCurlyIndex = -2;
3486 var closeParenIndex = -2;
3487 var backSlashIndex = -2;
3489 while (index < str.length) {
3490 if (str[index] === '*') {
3494 if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) {
3498 if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') {
3499 if (closeSquareIndex < index) {
3500 closeSquareIndex = str.indexOf(']', index);
3503 if (closeSquareIndex > index) {
3504 if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
3508 backSlashIndex = str.indexOf('\\', index);
3510 if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
3516 if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') {
3517 closeCurlyIndex = str.indexOf('}', index);
3519 if (closeCurlyIndex > index) {
3520 backSlashIndex = str.indexOf('\\', index);
3522 if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
3528 if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') {
3529 closeParenIndex = str.indexOf(')', index);
3531 if (closeParenIndex > index) {
3532 backSlashIndex = str.indexOf('\\', index);
3534 if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
3540 if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') {
3541 if (pipeIndex < index) {
3542 pipeIndex = str.indexOf('|', index);
3545 if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') {
3546 closeParenIndex = str.indexOf(')', pipeIndex);
3548 if (closeParenIndex > pipeIndex) {
3549 backSlashIndex = str.indexOf('\\', pipeIndex);
3551 if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
3558 if (str[index] === '\\') {
3559 var open = str[index + 1];
3561 var close = chars[open];
3564 var n = str.indexOf(close, index);
3571 if (str[index] === '!') {
3582 var relaxedCheck = function (str) {
3583 if (str[0] === '!') {
3589 while (index < str.length) {
3590 if (/[*?{}()[\]]/.test(str[index])) {
3594 if (str[index] === '\\') {
3595 var open = str[index + 1];
3597 var close = chars[open];
3600 var n = str.indexOf(close, index);
3607 if (str[index] === '!') {
3618 var isGlob$1 = function isGlob(str, options) {
3619 if (typeof str !== 'string' || str === '') {
3623 if (isExtglob(str)) {
3627 var check = strictCheck; // optionally relax check
3629 if (options && options.strict === false) {
3630 check = relaxedCheck;
3636 var isGlob = isGlob$1;
3637 var pathPosixDirname = require$$0__default$1["default"].posix.dirname;
3638 var isWin32 = require$$0__default["default"].platform() === 'win32';
3640 var backslash = /\\/g;
3641 var enclosure = /[\{\[].*[\}\]]$/;
3642 var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
3643 var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
3645 * @param {string} str
3646 * @param {Object} opts
3647 * @param {boolean} [opts.flipBackslashes=true]
3651 var globParent$1 = function globParent(str, opts) {
3652 var options = Object.assign({
3653 flipBackslashes: true
3654 }, opts); // flip windows path separators
3656 if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
3657 str = str.replace(backslash, slash);
3658 } // special case for strings ending in enclosure containing path separator
3661 if (enclosure.test(str)) {
3663 } // preserves full path in case of trailing path separator
3666 str += 'a'; // remove path parts that are globby
3669 str = pathPosixDirname(str);
3670 } while (isGlob(str) || globby.test(str)); // remove escape chars and return result
3673 return str.replace(escaped, '$1');
3678 (function (exports) {
3680 exports.isInteger = num => {
3681 if (typeof num === 'number') {
3682 return Number.isInteger(num);
3685 if (typeof num === 'string' && num.trim() !== '') {
3686 return Number.isInteger(Number(num));
3692 * Find a node of the given type
3696 exports.find = (node, type) => node.nodes.find(node => node.type === type);
3698 * Find a node of the given type
3702 exports.exceedsLimit = (min, max, step = 1, limit) => {
3703 if (limit === false) return false;
3704 if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
3705 return (Number(max) - Number(min)) / Number(step) >= limit;
3708 * Escape the given node with '\\' before node.value
3712 exports.escapeNode = (block, n = 0, type) => {
3713 let node = block.nodes[n];
3716 if (type && node.type === type || node.type === 'open' || node.type === 'close') {
3717 if (node.escaped !== true) {
3718 node.value = '\\' + node.value;
3719 node.escaped = true;
3724 * Returns true if the given brace node should be enclosed in literal braces
3728 exports.encloseBrace = node => {
3729 if (node.type !== 'brace') return false;
3731 if (node.commas >> 0 + node.ranges >> 0 === 0) {
3732 node.invalid = true;
3739 * Returns true if a brace node is invalid.
3743 exports.isInvalidBrace = block => {
3744 if (block.type !== 'brace') return false;
3745 if (block.invalid === true || block.dollar) return true;
3747 if (block.commas >> 0 + block.ranges >> 0 === 0) {
3748 block.invalid = true;
3752 if (block.open !== true || block.close !== true) {
3753 block.invalid = true;
3760 * Returns true if a node is an open or close node
3764 exports.isOpenOrClose = node => {
3765 if (node.type === 'open' || node.type === 'close') {
3769 return node.open === true || node.close === true;
3772 * Reduce an array of text nodes.
3776 exports.reduce = nodes => nodes.reduce((acc, node) => {
3777 if (node.type === 'text') acc.push(node.value);
3778 if (node.type === 'range') node.type = 'text';
3786 exports.flatten = (...args) => {
3789 const flat = arr => {
3790 for (let i = 0; i < arr.length; i++) {
3792 Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele);
3803 const utils$i = utils$j;
3805 var stringify$6 = (ast, options = {}) => {
3806 let stringify = (node, parent = {}) => {
3807 let invalidBlock = options.escapeInvalid && utils$i.isInvalidBrace(parent);
3808 let invalidNode = node.invalid === true && options.escapeInvalid === true;
3812 if ((invalidBlock || invalidNode) && utils$i.isOpenOrClose(node)) {
3813 return '\\' + node.value;
3824 for (let child of node.nodes) {
3825 output += stringify(child);
3832 return stringify(ast);
3836 * is-number <https://github.com/jonschlinkert/is-number>
3838 * Copyright (c) 2014-present, Jon Schlinkert.
3839 * Released under the MIT License.
3842 var isNumber$3 = function (num) {
3843 if (typeof num === 'number') {
3844 return num - num === 0;
3847 if (typeof num === 'string' && num.trim() !== '') {
3848 return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
3854 const isNumber$2 = isNumber$3;
3856 const toRegexRange$1 = (min, max, options) => {
3857 if (isNumber$2(min) === false) {
3858 throw new TypeError('toRegexRange: expected the first argument to be a number');
3861 if (max === void 0 || min === max) {
3865 if (isNumber$2(max) === false) {
3866 throw new TypeError('toRegexRange: expected the second argument to be a number.');
3869 let opts = Object.assign({
3873 if (typeof opts.strictZeros === 'boolean') {
3874 opts.relaxZeros = opts.strictZeros === false;
3877 let relax = String(opts.relaxZeros);
3878 let shorthand = String(opts.shorthand);
3879 let capture = String(opts.capture);
3880 let wrap = String(opts.wrap);
3881 let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap;
3883 if (toRegexRange$1.cache.hasOwnProperty(cacheKey)) {
3884 return toRegexRange$1.cache[cacheKey].result;
3887 let a = Math.min(min, max);
3888 let b = Math.max(min, max);
3890 if (Math.abs(a - b) === 1) {
3891 let result = min + '|' + max;
3894 return `(${result})`;
3897 if (opts.wrap === false) {
3901 return `(?:${result})`;
3904 let isPadded = hasPadding(min) || hasPadding(max);
3915 state.isPadded = isPadded;
3916 state.maxLen = String(state.max).length;
3920 let newMin = b < 0 ? Math.abs(b) : 1;
3921 negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
3926 positives = splitToPatterns(a, b, state, opts);
3929 state.negatives = negatives;
3930 state.positives = positives;
3931 state.result = collatePatterns(negatives, positives);
3933 if (opts.capture === true) {
3934 state.result = `(${state.result})`;
3935 } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
3936 state.result = `(?:${state.result})`;
3939 toRegexRange$1.cache[cacheKey] = state;
3940 return state.result;
3943 function collatePatterns(neg, pos, options) {
3944 let onlyNegative = filterPatterns(neg, pos, '-', false) || [];
3945 let onlyPositive = filterPatterns(pos, neg, '', false) || [];
3946 let intersected = filterPatterns(neg, pos, '-?', true) || [];
3947 let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
3948 return subpatterns.join('|');
3951 function splitToRanges(min, max) {
3954 let stop = countNines(min, nines);
3955 let stops = new Set([max]);
3957 while (min <= stop && stop <= max) {
3960 stop = countNines(min, nines);
3963 stop = countZeros(max + 1, zeros) - 1;
3965 while (min < stop && stop <= max) {
3968 stop = countZeros(max + 1, zeros) - 1;
3972 stops.sort(compare);
3976 * Convert a range to a regex pattern
3977 * @param {Number} `start`
3978 * @param {Number} `stop`
3983 function rangeToPattern(start, stop, options) {
3984 if (start === stop) {
3992 let zipped = zip(start, stop);
3993 let digits = zipped.length;
3997 for (let i = 0; i < digits; i++) {
3998 let [startDigit, stopDigit] = zipped[i];
4000 if (startDigit === stopDigit) {
4001 pattern += startDigit;
4002 } else if (startDigit !== '0' || stopDigit !== '9') {
4003 pattern += toCharacterClass(startDigit, stopDigit);
4010 pattern += options.shorthand === true ? '\\d' : '[0-9]';
4020 function splitToPatterns(min, max, tok, options) {
4021 let ranges = splitToRanges(min, max);
4026 for (let i = 0; i < ranges.length; i++) {
4027 let max = ranges[i];
4028 let obj = rangeToPattern(String(start), String(max), options);
4031 if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
4032 if (prev.count.length > 1) {
4036 prev.count.push(obj.count[0]);
4037 prev.string = prev.pattern + toQuantifier(prev.count);
4043 zeros = padZeros(max, tok, options);
4046 obj.string = zeros + obj.pattern + toQuantifier(obj.count);
4055 function filterPatterns(arr, comparison, prefix, intersection, options) {
4058 for (let ele of arr) {
4061 } = ele; // only push if _both_ are negative...
4063 if (!intersection && !contains(comparison, 'string', string)) {
4064 result.push(prefix + string);
4065 } // or _both_ are positive
4068 if (intersection && contains(comparison, 'string', string)) {
4069 result.push(prefix + string);
4080 function zip(a, b) {
4083 for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
4088 function compare(a, b) {
4089 return a > b ? 1 : b > a ? -1 : 0;
4092 function contains(arr, key, val) {
4093 return arr.some(ele => ele[key] === val);
4096 function countNines(min, len) {
4097 return Number(String(min).slice(0, -len) + '9'.repeat(len));
4100 function countZeros(integer, zeros) {
4101 return integer - integer % Math.pow(10, zeros);
4104 function toQuantifier(digits) {
4105 let [start = 0, stop = ''] = digits;
4107 if (stop || start > 1) {
4108 return `{${start + (stop ? ',' + stop : '')}}`;
4114 function toCharacterClass(a, b, options) {
4115 return `[${a}${b - a === 1 ? '' : '-'}${b}]`;
4118 function hasPadding(str) {
4119 return /^-?(0+)\d/.test(str);
4122 function padZeros(value, tok, options) {
4123 if (!tok.isPadded) {
4127 let diff = Math.abs(tok.maxLen - String(value).length);
4128 let relax = options.relaxZeros !== false;
4135 return relax ? '0?' : '0';
4138 return relax ? '0{0,2}' : '00';
4142 return relax ? `0{0,${diff}}` : `0{${diff}}`;
4151 toRegexRange$1.cache = {};
4153 toRegexRange$1.clearCache = () => toRegexRange$1.cache = {};
4155 * Expose `toRegexRange`
4159 var toRegexRange_1 = toRegexRange$1;
4161 const util$1 = require$$0__default$2["default"];
4162 const toRegexRange = toRegexRange_1;
4164 const isObject$6 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
4166 const transform = toNumber => {
4167 return value => toNumber === true ? Number(value) : String(value);
4170 const isValidValue = value => {
4171 return typeof value === 'number' || typeof value === 'string' && value !== '';
4174 const isNumber$1 = num => Number.isInteger(+num);
4176 const zeros = input => {
4177 let value = `${input}`;
4179 if (value[0] === '-') value = value.slice(1);
4180 if (value === '0') return false;
4182 while (value[++index] === '0');
4187 const stringify$5 = (start, end, options) => {
4188 if (typeof start === 'string' || typeof end === 'string') {
4192 return options.stringify === true;
4195 const pad = (input, maxLength, toNumber) => {
4196 if (maxLength > 0) {
4197 let dash = input[0] === '-' ? '-' : '';
4198 if (dash) input = input.slice(1);
4199 input = dash + input.padStart(dash ? maxLength - 1 : maxLength, '0');
4202 if (toNumber === false) {
4203 return String(input);
4209 const toMaxLen = (input, maxLength) => {
4210 let negative = input[0] === '-' ? '-' : '';
4213 input = input.slice(1);
4217 while (input.length < maxLength) input = '0' + input;
4219 return negative ? '-' + input : input;
4222 const toSequence = (parts, options) => {
4223 parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
4224 parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
4225 let prefix = options.capture ? '' : '?:';
4230 if (parts.positives.length) {
4231 positives = parts.positives.join('|');
4234 if (parts.negatives.length) {
4235 negatives = `-(${prefix}${parts.negatives.join('|')})`;
4238 if (positives && negatives) {
4239 result = `${positives}|${negatives}`;
4241 result = positives || negatives;
4245 return `(${prefix}${result})`;
4251 const toRange = (a, b, isNumbers, options) => {
4253 return toRegexRange(a, b, Object.assign({
4258 let start = String.fromCharCode(a);
4259 if (a === b) return start;
4260 let stop = String.fromCharCode(b);
4261 return `[${start}-${stop}]`;
4264 const toRegex = (start, end, options) => {
4265 if (Array.isArray(start)) {
4266 let wrap = options.wrap === true;
4267 let prefix = options.capture ? '' : '?:';
4268 return wrap ? `(${prefix}${start.join('|')})` : start.join('|');
4271 return toRegexRange(start, end, options);
4274 const rangeError = (...args) => {
4275 return new RangeError('Invalid range arguments: ' + util$1.inspect(...args));
4278 const invalidRange = (start, end, options) => {
4279 if (options.strictRanges === true) throw rangeError([start, end]);
4283 const invalidStep = (step, options) => {
4284 if (options.strictRanges === true) {
4285 throw new TypeError(`Expected step "${step}" to be a number`);
4291 const fillNumbers = (start, end, step = 1, options = {}) => {
4292 let a = Number(start);
4293 let b = Number(end);
4295 if (!Number.isInteger(a) || !Number.isInteger(b)) {
4296 if (options.strictRanges === true) throw rangeError([start, end]);
4298 } // fix negative zero
4303 let descending = a > b;
4304 let startString = String(start);
4305 let endString = String(end);
4306 let stepString = String(step);
4307 step = Math.max(Math.abs(step), 1);
4308 let padded = zeros(startString) || zeros(endString) || zeros(stepString);
4309 let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
4310 let toNumber = padded === false && stringify$5(start, end, options) === false;
4311 let format = options.transform || transform(toNumber);
4313 if (options.toRegex && step === 1) {
4314 return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
4322 let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num));
4327 while (descending ? a >= b : a <= b) {
4328 if (options.toRegex === true && step > 1) {
4331 range.push(pad(format(a, index), maxLen, toNumber));
4334 a = descending ? a - step : a + step;
4338 if (options.toRegex === true) {
4339 return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
4347 const fillLetters = (start, end, step = 1, options = {}) => {
4348 if (!isNumber$1(start) && start.length > 1 || !isNumber$1(end) && end.length > 1) {
4349 return invalidRange(start, end, options);
4352 let format = options.transform || (val => String.fromCharCode(val));
4354 let a = `${start}`.charCodeAt(0);
4355 let b = `${end}`.charCodeAt(0);
4356 let descending = a > b;
4357 let min = Math.min(a, b);
4358 let max = Math.max(a, b);
4360 if (options.toRegex && step === 1) {
4361 return toRange(min, max, false, options);
4367 while (descending ? a >= b : a <= b) {
4368 range.push(format(a, index));
4369 a = descending ? a - step : a + step;
4373 if (options.toRegex === true) {
4374 return toRegex(range, null, {
4383 const fill$2 = (start, end, step, options = {}) => {
4384 if (end == null && isValidValue(start)) {
4388 if (!isValidValue(start) || !isValidValue(end)) {
4389 return invalidRange(start, end, options);
4392 if (typeof step === 'function') {
4393 return fill$2(start, end, 1, {
4398 if (isObject$6(step)) {
4399 return fill$2(start, end, 0, step);
4402 let opts = Object.assign({}, options);
4403 if (opts.capture === true) opts.wrap = true;
4404 step = step || opts.step || 1;
4406 if (!isNumber$1(step)) {
4407 if (step != null && !isObject$6(step)) return invalidStep(step, opts);
4408 return fill$2(start, end, 1, step);
4411 if (isNumber$1(start) && isNumber$1(end)) {
4412 return fillNumbers(start, end, step, opts);
4415 return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
4418 var fillRange = fill$2;
4420 const fill$1 = fillRange;
4421 const utils$h = utils$j;
4423 const compile$1 = (ast, options = {}) => {
4424 let walk = (node, parent = {}) => {
4425 let invalidBlock = utils$h.isInvalidBrace(parent);
4426 let invalidNode = node.invalid === true && options.escapeInvalid === true;
4427 let invalid = invalidBlock === true || invalidNode === true;
4428 let prefix = options.escapeInvalid === true ? '\\' : '';
4431 if (node.isOpen === true) {
4432 return prefix + node.value;
4435 if (node.isClose === true) {
4436 return prefix + node.value;
4439 if (node.type === 'open') {
4440 return invalid ? prefix + node.value : '(';
4443 if (node.type === 'close') {
4444 return invalid ? prefix + node.value : ')';
4447 if (node.type === 'comma') {
4448 return node.prev.type === 'comma' ? '' : invalid ? node.value : '|';
4455 if (node.nodes && node.ranges > 0) {
4456 let args = utils$h.reduce(node.nodes);
4457 let range = fill$1(...args, Object.assign(Object.assign({}, options), {}, {
4462 if (range.length !== 0) {
4463 return args.length > 1 && range.length > 1 ? `(${range})` : range;
4468 for (let child of node.nodes) {
4469 output += walk(child, node);
4479 var compile_1 = compile$1;
4481 const fill = fillRange;
4482 const stringify$4 = stringify$6;
4483 const utils$g = utils$j;
4485 const append = (queue = '', stash = '', enclose = false) => {
4487 queue = [].concat(queue);
4488 stash = [].concat(stash);
4489 if (!stash.length) return queue;
4491 if (!queue.length) {
4492 return enclose ? utils$g.flatten(stash).map(ele => `{${ele}}`) : stash;
4495 for (let item of queue) {
4496 if (Array.isArray(item)) {
4497 for (let value of item) {
4498 result.push(append(value, stash, enclose));
4501 for (let ele of stash) {
4502 if (enclose === true && typeof ele === 'string') ele = `{${ele}}`;
4503 result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
4508 return utils$g.flatten(result);
4511 const expand$1 = (ast, options = {}) => {
4512 let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit;
4514 let walk = (node, parent = {}) => {
4517 let q = parent.queue;
4519 while (p.type !== 'brace' && p.type !== 'root' && p.parent) {
4524 if (node.invalid || node.dollar) {
4525 q.push(append(q.pop(), stringify$4(node, options)));
4529 if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) {
4530 q.push(append(q.pop(), ['{}']));
4534 if (node.nodes && node.ranges > 0) {
4535 let args = utils$g.reduce(node.nodes);
4537 if (utils$g.exceedsLimit(...args, options.step, rangeLimit)) {
4538 throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
4541 let range = fill(...args, options);
4543 if (range.length === 0) {
4544 range = stringify$4(node, options);
4547 q.push(append(q.pop(), range));
4552 let enclose = utils$g.encloseBrace(node);
4553 let queue = node.queue;
4556 while (block.type !== 'brace' && block.type !== 'root' && block.parent) {
4557 block = block.parent;
4558 queue = block.queue;
4561 for (let i = 0; i < node.nodes.length; i++) {
4562 let child = node.nodes[i];
4564 if (child.type === 'comma' && node.type === 'brace') {
4565 if (i === 1) queue.push('');
4570 if (child.type === 'close') {
4571 q.push(append(q.pop(), queue, enclose));
4575 if (child.value && child.type !== 'open') {
4576 queue.push(append(queue.pop(), child.value));
4588 return utils$g.flatten(walk(ast));
4591 var expand_1 = expand$1;
4594 MAX_LENGTH: 1024 * 64,
4603 CHAR_UPPERCASE_A: 'A',
4606 CHAR_LOWERCASE_A: 'a',
4609 CHAR_UPPERCASE_Z: 'Z',
4612 CHAR_LOWERCASE_Z: 'z',
4615 CHAR_LEFT_PARENTHESES: '(',
4618 CHAR_RIGHT_PARENTHESES: ')',
4624 // Non-alphabetic chars.
4625 CHAR_AMPERSAND: '&',
4631 CHAR_BACKSLASH: '\\',
4637 CHAR_CARRIAGE_RETURN: '\r',
4640 CHAR_CIRCUMFLEX_ACCENT: '^',
4655 CHAR_DOUBLE_QUOTE: '"',
4661 CHAR_EXCLAMATION_MARK: '!',
4664 CHAR_FORM_FEED: '\f',
4667 CHAR_FORWARD_SLASH: '/',
4673 CHAR_HYPHEN_MINUS: '-',
4676 CHAR_LEFT_ANGLE_BRACKET: '<',
4679 CHAR_LEFT_CURLY_BRACE: '{',
4682 CHAR_LEFT_SQUARE_BRACKET: '[',
4685 CHAR_LINE_FEED: '\n',
4688 CHAR_NO_BREAK_SPACE: '\u00A0',
4697 CHAR_QUESTION_MARK: '?',
4700 CHAR_RIGHT_ANGLE_BRACKET: '>',
4703 CHAR_RIGHT_CURLY_BRACE: '}',
4706 CHAR_RIGHT_SQUARE_BRACKET: ']',
4709 CHAR_SEMICOLON: ';',
4712 CHAR_SINGLE_QUOTE: '\'',
4721 CHAR_UNDERSCORE: '_',
4724 CHAR_VERTICAL_LINE: '|',
4727 CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF'
4732 const stringify$3 = stringify$6;
4738 MAX_LENGTH: MAX_LENGTH$1,
4745 CHAR_COMMA: CHAR_COMMA$1,
4748 CHAR_DOT: CHAR_DOT$1,
4751 CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1,
4754 CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1,
4757 CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1,
4760 CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1,
4763 CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1,
4766 CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1,
4775 CHAR_NO_BREAK_SPACE,
4776 CHAR_ZERO_WIDTH_NOBREAK_SPACE
4782 const parse$4 = (input, options = {}) => {
4783 if (typeof input !== 'string') {
4784 throw new TypeError('Expected a string');
4787 let opts = options || {};
4788 let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
4790 if (input.length > max) {
4791 throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
4803 let length = input.length;
4811 const advance = () => input[index++];
4813 const push = node => {
4814 if (node.type === 'text' && prev.type === 'dot') {
4818 if (prev && prev.type === 'text' && node.type === 'text') {
4819 prev.value += node.value;
4823 block.nodes.push(node);
4824 node.parent = block;
4834 while (index < length) {
4835 block = stack[stack.length - 1];
4841 if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
4849 if (value === CHAR_BACKSLASH) {
4852 value: (options.keepEscaping ? value : '') + advance()
4857 * Right square bracket (literal): ']'
4861 if (value === CHAR_RIGHT_SQUARE_BRACKET$1) {
4869 * Left square bracket: '['
4873 if (value === CHAR_LEFT_SQUARE_BRACKET$1) {
4877 while (index < length && (next = advance())) {
4880 if (next === CHAR_LEFT_SQUARE_BRACKET$1) {
4885 if (next === CHAR_BACKSLASH) {
4890 if (next === CHAR_RIGHT_SQUARE_BRACKET$1) {
4893 if (brackets === 0) {
4910 if (value === CHAR_LEFT_PARENTHESES$1) {
4923 if (value === CHAR_RIGHT_PARENTHESES$1) {
4924 if (block.type !== 'paren') {
4932 block = stack.pop();
4937 block = stack[stack.length - 1];
4945 if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
4949 if (options.keepQuotes !== true) {
4953 while (index < length && (next = advance())) {
4954 if (next === CHAR_BACKSLASH) {
4955 value += next + advance();
4959 if (next === open) {
4960 if (options.keepQuotes === true) value += next;
4974 * Left curly brace: '{'
4978 if (value === CHAR_LEFT_CURLY_BRACE$1) {
4980 let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true;
4991 block = push(brace);
5000 * Right curly brace: '}'
5004 if (value === CHAR_RIGHT_CURLY_BRACE$1) {
5005 if (block.type !== 'brace') {
5014 block = stack.pop();
5021 block = stack[stack.length - 1];
5029 if (value === CHAR_COMMA$1 && depth > 0) {
5030 if (block.ranges > 0) {
5032 let open = block.nodes.shift();
5033 block.nodes = [open, {
5035 value: stringify$3(block)
5051 if (value === CHAR_DOT$1 && depth > 0 && block.commas === 0) {
5052 let siblings = block.nodes;
5054 if (depth === 0 || siblings.length === 0) {
5062 if (prev.type === 'dot') {
5064 prev.value += value;
5065 prev.type = 'range';
5067 if (block.nodes.length !== 3 && block.nodes.length !== 5) {
5068 block.invalid = true;
5079 if (prev.type === 'range') {
5081 let before = siblings[siblings.length - 1];
5082 before.value += prev.value + value;
5103 } // Mark imbalanced braces and brackets as invalid
5107 block = stack.pop();
5109 if (block.type !== 'root') {
5110 block.nodes.forEach(node => {
5112 if (node.type === 'open') node.isOpen = true;
5113 if (node.type === 'close') node.isClose = true;
5114 if (!node.nodes) node.type = 'text';
5115 node.invalid = true;
5117 }); // get the location of the block on parent.nodes (block's siblings)
5119 let parent = stack[stack.length - 1];
5120 let index = parent.nodes.indexOf(block); // replace the (invalid) block with it's nodes
5122 parent.nodes.splice(index, 1, ...block.nodes);
5124 } while (stack.length > 0);
5132 var parse_1$1 = parse$4;
5134 const stringify$2 = stringify$6;
5135 const compile = compile_1;
5136 const expand = expand_1;
5137 const parse$3 = parse_1$1;
5139 * Expand the given pattern or create a regex-compatible string.
5142 * const braces = require('braces');
5143 * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
5144 * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
5146 * @param {String} `str`
5147 * @param {Object} `options`
5152 const braces$1 = (input, options = {}) => {
5155 if (Array.isArray(input)) {
5156 for (let pattern of input) {
5157 let result = braces$1.create(pattern, options);
5159 if (Array.isArray(result)) {
5160 output.push(...result);
5162 output.push(result);
5166 output = [].concat(braces$1.create(input, options));
5169 if (options && options.expand === true && options.nodupes === true) {
5170 output = [...new Set(output)];
5176 * Parse the given `str` with the given `options`.
5179 * // braces.parse(pattern, [, options]);
5180 * const ast = braces.parse('a/{b,c}/d');
5183 * @param {String} pattern Brace pattern to parse
5184 * @param {Object} options
5185 * @return {Object} Returns an AST
5190 braces$1.parse = (input, options = {}) => parse$3(input, options);
5192 * Creates a braces string from an AST, or an AST node.
5195 * const braces = require('braces');
5196 * let ast = braces.parse('foo/{a,b}/bar');
5197 * console.log(stringify(ast.nodes[2])); //=> '{a,b}'
5199 * @param {String} `input` Brace pattern or AST.
5200 * @param {Object} `options`
5201 * @return {Array} Returns an array of expanded values.
5206 braces$1.stringify = (input, options = {}) => {
5207 if (typeof input === 'string') {
5208 return stringify$2(braces$1.parse(input, options), options);
5211 return stringify$2(input, options);
5214 * Compiles a brace pattern into a regex-compatible, optimized string.
5215 * This method is called by the main [braces](#braces) function by default.
5218 * const braces = require('braces');
5219 * console.log(braces.compile('a/{b,c}/d'));
5220 * //=> ['a/(b|c)/d']
5222 * @param {String} `input` Brace pattern or AST.
5223 * @param {Object} `options`
5224 * @return {Array} Returns an array of expanded values.
5229 braces$1.compile = (input, options = {}) => {
5230 if (typeof input === 'string') {
5231 input = braces$1.parse(input, options);
5234 return compile(input, options);
5237 * Expands a brace pattern into an array. This method is called by the
5238 * main [braces](#braces) function when `options.expand` is true. Before
5239 * using this method it's recommended that you read the [performance notes](#performance))
5240 * and advantages of using [.compile](#compile) instead.
5243 * const braces = require('braces');
5244 * console.log(braces.expand('a/{b,c}/d'));
5245 * //=> ['a/b/d', 'a/c/d'];
5247 * @param {String} `pattern` Brace pattern
5248 * @param {Object} `options`
5249 * @return {Array} Returns an array of expanded values.
5254 braces$1.expand = (input, options = {}) => {
5255 if (typeof input === 'string') {
5256 input = braces$1.parse(input, options);
5259 let result = expand(input, options); // filter out empty strings if specified
5261 if (options.noempty === true) {
5262 result = result.filter(Boolean);
5263 } // filter out duplicates if specified
5266 if (options.nodupes === true) {
5267 result = [...new Set(result)];
5273 * Processes a brace pattern and returns either an expanded array
5274 * (if `options.expand` is true), a highly optimized regex-compatible string.
5275 * This method is called by the main [braces](#braces) function.
5278 * const braces = require('braces');
5279 * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
5280 * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
5282 * @param {String} `pattern` Brace pattern
5283 * @param {Object} `options`
5284 * @return {Array} Returns an array of expanded values.
5289 braces$1.create = (input, options = {}) => {
5290 if (input === '' || input.length < 3) {
5294 return options.expand !== true ? braces$1.compile(input, options) : braces$1.expand(input, options);
5301 var braces_1 = braces$1;
5305 const path$a = require$$0__default$1["default"];
5306 const WIN_SLASH = '\\\\/';
5307 const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
5312 const DOT_LITERAL = '\\.';
5313 const PLUS_LITERAL = '\\+';
5314 const QMARK_LITERAL = '\\?';
5315 const SLASH_LITERAL = '\\/';
5316 const ONE_CHAR = '(?=.)';
5317 const QMARK = '[^/]';
5318 const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
5319 const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
5320 const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
5321 const NO_DOT = `(?!${DOT_LITERAL})`;
5322 const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
5323 const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
5324 const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
5325 const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
5326 const STAR = `${QMARK}*?`;
5327 const POSIX_CHARS = {
5345 * Windows glob regex
5348 const WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
5349 SLASH_LITERAL: `[${WIN_SLASH}]`,
5350 QMARK: WIN_NO_SLASH,
5351 STAR: `${WIN_NO_SLASH}*?`,
5352 DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
5353 NO_DOT: `(?!${DOT_LITERAL})`,
5354 NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
5355 NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
5356 NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
5357 QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
5358 START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
5359 END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
5362 * POSIX Bracket Regex
5365 const POSIX_REGEX_SOURCE$1 = {
5368 ascii: '\\x00-\\x7F',
5370 cntrl: '\\x00-\\x1F\\x7F',
5372 graph: '\\x21-\\x7E',
5374 print: '\\x20-\\x7E ',
5375 punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
5376 space: ' \\t\\r\\n\\v\\f',
5382 MAX_LENGTH: 1024 * 64,
5383 POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
5384 // regular expressions
5385 REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
5386 REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
5387 REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
5388 REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
5389 REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
5390 REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
5391 // Replace globs with equivalent patterns to reduce parsing time.
5405 CHAR_UPPERCASE_A: 65,
5408 CHAR_LOWERCASE_A: 97,
5411 CHAR_UPPERCASE_Z: 90,
5414 CHAR_LOWERCASE_Z: 122,
5417 CHAR_LEFT_PARENTHESES: 40,
5420 CHAR_RIGHT_PARENTHESES: 41,
5426 // Non-alphabetic chars.
5433 CHAR_BACKWARD_SLASH: 92,
5436 CHAR_CARRIAGE_RETURN: 13,
5439 CHAR_CIRCUMFLEX_ACCENT: 94,
5451 CHAR_DOUBLE_QUOTE: 34,
5457 CHAR_EXCLAMATION_MARK: 33,
5463 CHAR_FORWARD_SLASH: 47,
5466 CHAR_GRAVE_ACCENT: 96,
5472 CHAR_HYPHEN_MINUS: 45,
5475 CHAR_LEFT_ANGLE_BRACKET: 60,
5478 CHAR_LEFT_CURLY_BRACE: 123,
5481 CHAR_LEFT_SQUARE_BRACKET: 91,
5487 CHAR_NO_BREAK_SPACE: 160,
5496 CHAR_QUESTION_MARK: 63,
5499 CHAR_RIGHT_ANGLE_BRACKET: 62,
5502 CHAR_RIGHT_CURLY_BRACE: 125,
5505 CHAR_RIGHT_SQUARE_BRACKET: 93,
5511 CHAR_SINGLE_QUOTE: 39,
5520 CHAR_UNDERSCORE: 95,
5523 CHAR_VERTICAL_LINE: 124,
5526 CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
5532 * Create EXTGLOB_CHARS
5534 extglobChars(chars) {
5539 close: `))${chars.STAR})`
5568 return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
5573 (function (exports) {
5575 const path = require$$0__default$1["default"];
5576 const win32 = process.platform === 'win32';
5579 REGEX_REMOVE_BACKSLASH,
5580 REGEX_SPECIAL_CHARS,
5581 REGEX_SPECIAL_CHARS_GLOBAL
5584 exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
5586 exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
5588 exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
5590 exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
5592 exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
5594 exports.removeBackslashes = str => {
5595 return str.replace(REGEX_REMOVE_BACKSLASH, match => {
5596 return match === '\\' ? '' : match;
5600 exports.supportsLookbehinds = () => {
5601 const segs = process.version.slice(1).split('.').map(Number);
5603 if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
5610 exports.isWindows = options => {
5611 if (options && typeof options.windows === 'boolean') {
5612 return options.windows;
5615 return win32 === true || path.sep === '\\';
5618 exports.escapeLast = (input, char, lastIdx) => {
5619 const idx = input.lastIndexOf(char, lastIdx);
5620 if (idx === -1) return input;
5621 if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
5622 return `${input.slice(0, idx)}\\${input.slice(idx)}`;
5625 exports.removePrefix = (input, state = {}) => {
5628 if (output.startsWith('./')) {
5629 output = output.slice(2);
5630 state.prefix = './';
5636 exports.wrapOutput = (input, state = {}, options = {}) => {
5637 const prepend = options.contains ? '' : '^';
5638 const append = options.contains ? '' : '$';
5639 let output = `${prepend}(?:${input})${append}`;
5641 if (state.negated === true) {
5642 output = `(?:^(?!${output}).*$)`;
5649 const utils$e = utils$f;
5657 CHAR_BACKWARD_SLASH,
5666 CHAR_EXCLAMATION_MARK,
5672 CHAR_LEFT_CURLY_BRACE,
5675 CHAR_LEFT_PARENTHESES,
5678 CHAR_LEFT_SQUARE_BRACKET,
5687 CHAR_RIGHT_CURLY_BRACE,
5690 CHAR_RIGHT_PARENTHESES,
5693 CHAR_RIGHT_SQUARE_BRACKET
5698 const isPathSeparator = code => {
5699 return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
5702 const depth = token => {
5703 if (token.isPrefix !== true) {
5704 token.depth = token.isGlobstar ? Infinity : 1;
5708 * Quickly scans a glob pattern and returns an object with a handful of
5709 * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
5710 * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
5711 * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
5714 * const pm = require('picomatch');
5715 * console.log(pm.scan('foo/bar/*.js'));
5716 * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
5718 * @param {String} `str`
5719 * @param {Object} `options`
5720 * @return {Object} Returns an object with tokens and regex source string.
5725 const scan$1 = (input, options) => {
5726 const opts = options || {};
5727 const length = input.length - 1;
5728 const scanToEnd = opts.parts === true || opts.scanToEnd === true;
5736 let isBrace = false;
5737 let isBracket = false;
5739 let isExtglob = false;
5740 let isGlobstar = false;
5741 let braceEscaped = false;
5742 let backslashes = false;
5743 let negated = false;
5744 let negatedExtglob = false;
5745 let finished = false;
5755 const eos = () => index >= length;
5757 const peek = () => str.charCodeAt(index + 1);
5759 const advance = () => {
5761 return str.charCodeAt(++index);
5764 while (index < length) {
5768 if (code === CHAR_BACKWARD_SLASH) {
5769 backslashes = token.backslashes = true;
5772 if (code === CHAR_LEFT_CURLY_BRACE) {
5773 braceEscaped = true;
5779 if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
5782 while (eos() !== true && (code = advance())) {
5783 if (code === CHAR_BACKWARD_SLASH) {
5784 backslashes = token.backslashes = true;
5789 if (code === CHAR_LEFT_CURLY_BRACE) {
5794 if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
5795 isBrace = token.isBrace = true;
5796 isGlob = token.isGlob = true;
5799 if (scanToEnd === true) {
5806 if (braceEscaped !== true && code === CHAR_COMMA) {
5807 isBrace = token.isBrace = true;
5808 isGlob = token.isGlob = true;
5811 if (scanToEnd === true) {
5818 if (code === CHAR_RIGHT_CURLY_BRACE) {
5822 braceEscaped = false;
5823 isBrace = token.isBrace = true;
5830 if (scanToEnd === true) {
5837 if (code === CHAR_FORWARD_SLASH) {
5838 slashes.push(index);
5845 if (finished === true) continue;
5847 if (prev === CHAR_DOT && index === start + 1) {
5852 lastIndex = index + 1;
5856 if (opts.noext !== true) {
5857 const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
5859 if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
5860 isGlob = token.isGlob = true;
5861 isExtglob = token.isExtglob = true;
5864 if (code === CHAR_EXCLAMATION_MARK && index === start) {
5865 negatedExtglob = true;
5868 if (scanToEnd === true) {
5869 while (eos() !== true && (code = advance())) {
5870 if (code === CHAR_BACKWARD_SLASH) {
5871 backslashes = token.backslashes = true;
5876 if (code === CHAR_RIGHT_PARENTHESES) {
5877 isGlob = token.isGlob = true;
5890 if (code === CHAR_ASTERISK) {
5891 if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
5892 isGlob = token.isGlob = true;
5895 if (scanToEnd === true) {
5902 if (code === CHAR_QUESTION_MARK) {
5903 isGlob = token.isGlob = true;
5906 if (scanToEnd === true) {
5913 if (code === CHAR_LEFT_SQUARE_BRACKET) {
5914 while (eos() !== true && (next = advance())) {
5915 if (next === CHAR_BACKWARD_SLASH) {
5916 backslashes = token.backslashes = true;
5921 if (next === CHAR_RIGHT_SQUARE_BRACKET) {
5922 isBracket = token.isBracket = true;
5923 isGlob = token.isGlob = true;
5929 if (scanToEnd === true) {
5936 if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
5937 negated = token.negated = true;
5942 if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
5943 isGlob = token.isGlob = true;
5945 if (scanToEnd === true) {
5946 while (eos() !== true && (code = advance())) {
5947 if (code === CHAR_LEFT_PARENTHESES) {
5948 backslashes = token.backslashes = true;
5953 if (code === CHAR_RIGHT_PARENTHESES) {
5965 if (isGlob === true) {
5968 if (scanToEnd === true) {
5976 if (opts.noext === true) {
5986 prefix = str.slice(0, start);
5987 str = str.slice(start);
5991 if (base && isGlob === true && lastIndex > 0) {
5992 base = str.slice(0, lastIndex);
5993 glob = str.slice(lastIndex);
5994 } else if (isGlob === true) {
6001 if (base && base !== '' && base !== '/' && base !== str) {
6002 if (isPathSeparator(base.charCodeAt(base.length - 1))) {
6003 base = base.slice(0, -1);
6007 if (opts.unescape === true) {
6008 if (glob) glob = utils$e.removeBackslashes(glob);
6010 if (base && backslashes === true) {
6011 base = utils$e.removeBackslashes(base);
6030 if (opts.tokens === true) {
6033 if (!isPathSeparator(code)) {
6037 state.tokens = tokens;
6040 if (opts.parts === true || opts.tokens === true) {
6043 for (let idx = 0; idx < slashes.length; idx++) {
6044 const n = prevIndex ? prevIndex + 1 : start;
6045 const i = slashes[idx];
6046 const value = input.slice(n, i);
6049 if (idx === 0 && start !== 0) {
6050 tokens[idx].isPrefix = true;
6051 tokens[idx].value = prefix;
6053 tokens[idx].value = value;
6057 state.maxDepth += tokens[idx].depth;
6060 if (idx !== 0 || value !== '') {
6067 if (prevIndex && prevIndex + 1 < input.length) {
6068 const value = input.slice(prevIndex + 1);
6072 tokens[tokens.length - 1].value = value;
6073 depth(tokens[tokens.length - 1]);
6074 state.maxDepth += tokens[tokens.length - 1].depth;
6078 state.slashes = slashes;
6079 state.parts = parts;
6085 var scan_1 = scan$1;
6087 const constants$2 = constants$3;
6088 const utils$d = utils$f;
6096 REGEX_NON_SPECIAL_CHARS,
6097 REGEX_SPECIAL_CHARS_BACKREF,
6104 const expandRange = (args, options) => {
6105 if (typeof options.expandRange === 'function') {
6106 return options.expandRange(...args, options);
6110 const value = `[${args.join('-')}]`;
6113 /* eslint-disable-next-line no-new */
6116 return args.map(v => utils$d.escapeRegex(v)).join('..');
6122 * Create the message for a syntax error
6126 const syntaxError = (type, char) => {
6127 return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
6130 * Parse the given input string.
6131 * @param {String} input
6132 * @param {Object} options
6137 const parse$2 = (input, options) => {
6138 if (typeof input !== 'string') {
6139 throw new TypeError('Expected a string');
6142 input = REPLACEMENTS[input] || input;
6143 const opts = Object.assign({}, options);
6144 const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
6145 let len = input.length;
6148 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
6154 output: opts.prepend || ''
6156 const tokens = [bos];
6157 const capture = opts.capture ? '' : '?:';
6158 const win32 = utils$d.isWindows(options); // create constants based on platform, for windows or posix
6160 const PLATFORM_CHARS = constants$2.globChars(win32);
6161 const EXTGLOB_CHARS = constants$2.extglobChars(PLATFORM_CHARS);
6177 const globstar = opts => {
6178 return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
6181 const nodot = opts.dot ? '' : NO_DOT;
6182 const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
6183 let star = opts.bash === true ? globstar(opts) : STAR;
6187 } // minimatch options support
6190 if (typeof opts.noext === 'boolean') {
6191 opts.noextglob = opts.noext;
6198 dot: opts.dot === true,
6211 input = utils$d.removePrefix(input, state);
6213 const extglobs = [];
6219 * Tokenizing helpers
6222 const eos = () => state.index === len - 1;
6224 const peek = state.peek = (n = 1) => input[state.index + n];
6226 const advance = state.advance = () => input[++state.index] || '';
6228 const remaining = () => input.slice(state.index + 1);
6230 const consume = (value = '', num = 0) => {
6231 state.consumed += value;
6235 const append = token => {
6236 state.output += token.output != null ? token.output : token.value;
6237 consume(token.value);
6240 const negate = () => {
6243 while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
6249 if (count % 2 === 0) {
6253 state.negated = true;
6258 const increment = type => {
6263 const decrement = type => {
6268 * Push tokens onto the tokens array. This helper speeds up
6269 * tokenizing by 1) helping us avoid backtracking as much as possible,
6270 * and 2) helping us avoid creating extra tokens when consecutive
6271 * characters are plain text. This improves performance and simplifies
6276 const push = tok => {
6277 if (prev.type === 'globstar') {
6278 const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
6279 const isExtglob = tok.extglob === true || extglobs.length && (tok.type === 'pipe' || tok.type === 'paren');
6281 if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
6282 state.output = state.output.slice(0, -prev.output.length);
6286 state.output += prev.output;
6290 if (extglobs.length && tok.type !== 'paren') {
6291 extglobs[extglobs.length - 1].inner += tok.value;
6294 if (tok.value || tok.output) append(tok);
6296 if (prev && prev.type === 'text' && tok.type === 'text') {
6297 prev.value += tok.value;
6298 prev.output = (prev.output || '') + tok.value;
6307 const extglobOpen = (type, value) => {
6308 const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value]), {}, {
6313 token.parens = state.parens;
6314 token.output = state.output;
6315 const output = (opts.capture ? '(' : '') + token.open;
6316 increment('parens');
6320 output: state.output ? '' : ONE_CHAR
6328 extglobs.push(token);
6331 const extglobClose = token => {
6332 let output = token.close + (opts.capture ? ')' : '');
6335 if (token.type === 'negate') {
6336 let extglobStar = star;
6338 if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
6339 extglobStar = globstar(opts);
6342 if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
6343 output = token.close = `)$))${extglobStar}`;
6346 if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
6347 output = token.close = `)${rest})${extglobStar})`;
6350 if (token.prev.type === 'bos') {
6351 state.negatedExtglob = true;
6361 decrement('parens');
6368 if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
6369 let backslashes = false;
6370 let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
6371 if (first === '\\') {
6376 if (first === '?') {
6378 return esc + first + (rest ? QMARK.repeat(rest.length) : '');
6382 return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
6385 return QMARK.repeat(chars.length);
6388 if (first === '.') {
6389 return DOT_LITERAL.repeat(chars.length);
6392 if (first === '*') {
6394 return esc + first + (rest ? star : '');
6400 return esc ? m : `\\${m}`;
6403 if (backslashes === true) {
6404 if (opts.unescape === true) {
6405 output = output.replace(/\\/g, '');
6407 output = output.replace(/\\+/g, m => {
6408 return m.length % 2 === 0 ? '\\\\' : m ? '\\' : '';
6413 if (output === input && opts.contains === true) {
6414 state.output = input;
6418 state.output = utils$d.wrapOutput(output, state, options);
6422 * Tokenize input until we reach end-of-string
6429 if (value === '\u0000') {
6433 * Escaped characters
6437 if (value === '\\') {
6438 const next = peek();
6440 if (next === '/' && opts.bash !== true) {
6444 if (next === '.' || next === ';') {
6455 } // collapse slashes to reduce potential for exploits
6458 const match = /^\\+/.exec(remaining());
6461 if (match && match[0].length > 2) {
6462 slashes = match[0].length;
6463 state.index += slashes;
6465 if (slashes % 2 !== 0) {
6470 if (opts.unescape === true) {
6476 if (state.brackets === 0) {
6485 * If we're inside a regex character class, continue
6486 * until we reach the closing bracket.
6490 if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
6491 if (opts.posix !== false && value === ':') {
6492 const inner = prev.value.slice(1);
6494 if (inner.includes('[')) {
6497 if (inner.includes(':')) {
6498 const idx = prev.value.lastIndexOf('[');
6499 const pre = prev.value.slice(0, idx);
6500 const rest = prev.value.slice(idx + 2);
6501 const posix = POSIX_REGEX_SOURCE[rest];
6504 prev.value = pre + posix;
6505 state.backtrack = true;
6508 if (!bos.output && tokens.indexOf(prev) === 1) {
6509 bos.output = ONE_CHAR;
6518 if (value === '[' && peek() !== ':' || value === '-' && peek() === ']') {
6519 value = `\\${value}`;
6522 if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
6523 value = `\\${value}`;
6526 if (opts.posix === true && value === '!' && prev.value === '[') {
6530 prev.value += value;
6537 * If we're inside a quoted string, continue
6538 * until we reach the closing double quote.
6542 if (state.quotes === 1 && value !== '"') {
6543 value = utils$d.escapeRegex(value);
6544 prev.value += value;
6555 if (value === '"') {
6556 state.quotes = state.quotes === 1 ? 0 : 1;
6558 if (opts.keepQuotes === true) {
6572 if (value === '(') {
6573 increment('parens');
6581 if (value === ')') {
6582 if (state.parens === 0 && opts.strictBrackets === true) {
6583 throw new SyntaxError(syntaxError('opening', '('));
6586 const extglob = extglobs[extglobs.length - 1];
6588 if (extglob && state.parens === extglob.parens + 1) {
6589 extglobClose(extglobs.pop());
6596 output: state.parens ? ')' : '\\)'
6598 decrement('parens');
6606 if (value === '[') {
6607 if (opts.nobracket === true || !remaining().includes(']')) {
6608 if (opts.nobracket !== true && opts.strictBrackets === true) {
6609 throw new SyntaxError(syntaxError('closing', ']'));
6612 value = `\\${value}`;
6614 increment('brackets');
6624 if (value === ']') {
6625 if (opts.nobracket === true || prev && prev.type === 'bracket' && prev.value.length === 1) {
6629 output: `\\${value}`
6634 if (state.brackets === 0) {
6635 if (opts.strictBrackets === true) {
6636 throw new SyntaxError(syntaxError('opening', '['));
6642 output: `\\${value}`
6647 decrement('brackets');
6648 const prevValue = prev.value.slice(1);
6650 if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
6651 value = `/${value}`;
6654 prev.value += value;
6657 }); // when literal brackets are explicitly disabled
6658 // assume we should match with a regex character class
6660 if (opts.literalBrackets === false || utils$d.hasRegexChars(prevValue)) {
6664 const escaped = utils$d.escapeRegex(prev.value);
6665 state.output = state.output.slice(0, -prev.value.length); // when literal brackets are explicitly enabled
6666 // assume we should escape the brackets to match literal characters
6668 if (opts.literalBrackets === true) {
6669 state.output += escaped;
6670 prev.value = escaped;
6672 } // when the user specifies nothing, try to match both
6675 prev.value = `(${capture}${escaped}|${prev.value})`;
6676 state.output += prev.value;
6684 if (value === '{' && opts.nobrace !== true) {
6685 increment('braces');
6690 outputIndex: state.output.length,
6691 tokensIndex: state.tokens.length
6698 if (value === '}') {
6699 const brace = braces[braces.length - 1];
6701 if (opts.nobrace === true || !brace) {
6712 if (brace.dots === true) {
6713 const arr = tokens.slice();
6716 for (let i = arr.length - 1; i >= 0; i--) {
6719 if (arr[i].type === 'brace') {
6723 if (arr[i].type !== 'dots') {
6724 range.unshift(arr[i].value);
6728 output = expandRange(range, opts);
6729 state.backtrack = true;
6732 if (brace.comma !== true && brace.dots !== true) {
6733 const out = state.output.slice(0, brace.outputIndex);
6734 const toks = state.tokens.slice(brace.tokensIndex);
6735 brace.value = brace.output = '\\{';
6736 value = output = '\\}';
6739 for (const t of toks) {
6740 state.output += t.output || t.value;
6749 decrement('braces');
6758 if (value === '|') {
6759 if (extglobs.length > 0) {
6760 extglobs[extglobs.length - 1].conditions++;
6774 if (value === ',') {
6776 const brace = braces[braces.length - 1];
6778 if (brace && stack[stack.length - 1] === 'braces') {
6795 if (value === '/') {
6796 // if the beginning of the glob is "./", advance the start
6797 // to the current index, and don't add the "./" characters
6798 // to the state. This greatly simplifies lookbehinds when
6799 // checking for BOS characters like "!" and "." (not "./")
6800 if (prev.type === 'dot' && state.index === state.start + 1) {
6801 state.start = state.index + 1;
6802 state.consumed = '';
6805 prev = bos; // reset "prev" to the first token
6813 output: SLASH_LITERAL
6822 if (value === '.') {
6823 if (state.braces > 0 && prev.type === 'dot') {
6824 if (prev.value === '.') prev.output = DOT_LITERAL;
6825 const brace = braces[braces.length - 1];
6827 prev.output += value;
6828 prev.value += value;
6833 if (state.braces + state.parens === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
6854 if (value === '?') {
6855 const isGroup = prev && prev.value === '(';
6857 if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
6858 extglobOpen('qmark', value);
6862 if (prev && prev.type === 'paren') {
6863 const next = peek();
6866 if (next === '<' && !utils$d.supportsLookbehinds()) {
6867 throw new Error('Node.js v10 or higher is required for regex lookbehinds');
6870 if (prev.value === '(' && !/[!=<:]/.test(next) || next === '<' && !/<([!=]|\w+>)/.test(remaining())) {
6871 output = `\\${value}`;
6882 if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
6886 output: QMARK_NO_DOT
6903 if (value === '!') {
6904 if (opts.noextglob !== true && peek() === '(') {
6905 if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
6906 extglobOpen('negate', value);
6911 if (opts.nonegate !== true && state.index === 0) {
6921 if (value === '+') {
6922 if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
6923 extglobOpen('plus', value);
6927 if (prev && prev.value === '(' || opts.regex === false) {
6931 output: PLUS_LITERAL
6936 if (prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace') || state.parens > 0) {
6955 if (value === '@') {
6956 if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
6977 if (value !== '*') {
6978 if (value === '$' || value === '^') {
6979 value = `\\${value}`;
6982 const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
6986 state.index += match[0].length;
7000 if (prev && (prev.type === 'globstar' || prev.star === true)) {
7003 prev.value += value;
7005 state.backtrack = true;
7006 state.globstar = true;
7011 let rest = remaining();
7013 if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
7014 extglobOpen('star', value);
7018 if (prev.type === 'star') {
7019 if (opts.noglobstar === true) {
7024 const prior = prev.prev;
7025 const before = prior.prev;
7026 const isStart = prior.type === 'slash' || prior.type === 'bos';
7027 const afterStar = before && (before.type === 'star' || before.type === 'globstar');
7029 if (opts.bash === true && (!isStart || rest[0] && rest[0] !== '/')) {
7038 const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
7039 const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
7041 if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
7048 } // strip consecutive `/**/`
7051 while (rest.slice(0, 3) === '/**') {
7052 const after = input[state.index + 4];
7054 if (after && after !== '/') {
7058 rest = rest.slice(3);
7062 if (prior.type === 'bos' && eos()) {
7063 prev.type = 'globstar';
7064 prev.value += value;
7065 prev.output = globstar(opts);
7066 state.output = prev.output;
7067 state.globstar = true;
7072 if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
7073 state.output = state.output.slice(0, -(prior.output + prev.output).length);
7074 prior.output = `(?:${prior.output}`;
7075 prev.type = 'globstar';
7076 prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
7077 prev.value += value;
7078 state.globstar = true;
7079 state.output += prior.output + prev.output;
7084 if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
7085 const end = rest[1] !== void 0 ? '|$' : '';
7086 state.output = state.output.slice(0, -(prior.output + prev.output).length);
7087 prior.output = `(?:${prior.output}`;
7088 prev.type = 'globstar';
7089 prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
7090 prev.value += value;
7091 state.output += prior.output + prev.output;
7092 state.globstar = true;
7093 consume(value + advance());
7102 if (prior.type === 'bos' && rest[0] === '/') {
7103 prev.type = 'globstar';
7104 prev.value += value;
7105 prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
7106 state.output = prev.output;
7107 state.globstar = true;
7108 consume(value + advance());
7115 } // remove single star from output
7118 state.output = state.output.slice(0, -prev.output.length); // reset previous token to globstar
7120 prev.type = 'globstar';
7121 prev.output = globstar(opts);
7122 prev.value += value; // reset output with globstar
7124 state.output += prev.output;
7125 state.globstar = true;
7136 if (opts.bash === true) {
7137 token.output = '.*?';
7139 if (prev.type === 'bos' || prev.type === 'slash') {
7140 token.output = nodot + token.output;
7147 if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
7148 token.output = value;
7153 if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
7154 if (prev.type === 'dot') {
7155 state.output += NO_DOT_SLASH;
7156 prev.output += NO_DOT_SLASH;
7157 } else if (opts.dot === true) {
7158 state.output += NO_DOTS_SLASH;
7159 prev.output += NO_DOTS_SLASH;
7161 state.output += nodot;
7162 prev.output += nodot;
7165 if (peek() !== '*') {
7166 state.output += ONE_CHAR;
7167 prev.output += ONE_CHAR;
7174 while (state.brackets > 0) {
7175 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
7176 state.output = utils$d.escapeLast(state.output, '[');
7177 decrement('brackets');
7180 while (state.parens > 0) {
7181 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
7182 state.output = utils$d.escapeLast(state.output, '(');
7183 decrement('parens');
7186 while (state.braces > 0) {
7187 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
7188 state.output = utils$d.escapeLast(state.output, '{');
7189 decrement('braces');
7192 if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
7194 type: 'maybe_slash',
7196 output: `${SLASH_LITERAL}?`
7198 } // rebuild the output if we had to backtrack at any point
7201 if (state.backtrack === true) {
7204 for (const token of state.tokens) {
7205 state.output += token.output != null ? token.output : token.value;
7208 state.output += token.suffix;
7216 * Fast paths for creating regular expressions for common glob patterns.
7217 * This can significantly speed up processing and has very little downside
7218 * impact when none of the fast paths match.
7222 parse$2.fastpaths = (input, options) => {
7223 const opts = Object.assign({}, options);
7224 const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
7225 const len = input.length;
7228 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
7231 input = REPLACEMENTS[input] || input;
7232 const win32 = utils$d.isWindows(options); // create constants based on platform, for windows or posix
7244 } = constants$2.globChars(win32);
7245 const nodot = opts.dot ? NO_DOTS : NO_DOT;
7246 const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
7247 const capture = opts.capture ? '' : '?:';
7252 let star = opts.bash === true ? '.*?' : STAR;
7258 const globstar = opts => {
7259 if (opts.noglobstar === true) return star;
7260 return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
7263 const create = str => {
7266 return `${nodot}${ONE_CHAR}${star}`;
7269 return `${DOT_LITERAL}${ONE_CHAR}${star}`;
7272 return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
7275 return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
7278 return nodot + globstar(opts);
7281 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
7284 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
7287 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
7291 const match = /^(.*?)\.(\w+)$/.exec(str);
7293 const source = create(match[1]);
7294 if (!source) return;
7295 return source + DOT_LITERAL + match[2];
7300 const output = utils$d.removePrefix(input, state);
7301 let source = create(output);
7303 if (source && opts.strictSlashes !== true) {
7304 source += `${SLASH_LITERAL}?`;
7310 var parse_1 = parse$2;
7312 const path$9 = require$$0__default$1["default"];
7313 const scan = scan_1;
7314 const parse$1 = parse_1;
7315 const utils$c = utils$f;
7316 const constants$1 = constants$3;
7318 const isObject$5 = val => val && typeof val === 'object' && !Array.isArray(val);
7320 * Creates a matcher function from one or more glob patterns. The
7321 * returned function takes a string to match as its first argument,
7322 * and returns true if the string is a match. The returned matcher
7323 * function also takes a boolean as the second argument that, when true,
7324 * returns an object with additional information.
7327 * const picomatch = require('picomatch');
7328 * // picomatch(glob[, options]);
7330 * const isMatch = picomatch('*.!(*a)');
7331 * console.log(isMatch('a.a')); //=> false
7332 * console.log(isMatch('a.b')); //=> true
7335 * @param {String|Array} `globs` One or more glob patterns.
7336 * @param {Object=} `options`
7337 * @return {Function=} Returns a matcher function.
7342 const picomatch$2 = (glob, options, returnState = false) => {
7343 if (Array.isArray(glob)) {
7344 const fns = glob.map(input => picomatch$2(input, options, returnState));
7346 const arrayMatcher = str => {
7347 for (const isMatch of fns) {
7348 const state = isMatch(str);
7349 if (state) return state;
7355 return arrayMatcher;
7358 const isState = isObject$5(glob) && glob.tokens && glob.input;
7360 if (glob === '' || typeof glob !== 'string' && !isState) {
7361 throw new TypeError('Expected pattern to be a non-empty string');
7364 const opts = options || {};
7365 const posix = utils$c.isWindows(options);
7366 const regex = isState ? picomatch$2.compileRe(glob, options) : picomatch$2.makeRe(glob, options, false, true);
7367 const state = regex.state;
7370 let isIgnored = () => false;
7373 const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
7378 isIgnored = picomatch$2(opts.ignore, ignoreOpts, returnState);
7381 const matcher = (input, returnObject = false) => {
7386 } = picomatch$2.test(input, regex, options, {
7401 if (typeof opts.onResult === 'function') {
7402 opts.onResult(result);
7405 if (isMatch === false) {
7406 result.isMatch = false;
7407 return returnObject ? result : false;
7410 if (isIgnored(input)) {
7411 if (typeof opts.onIgnore === 'function') {
7412 opts.onIgnore(result);
7415 result.isMatch = false;
7416 return returnObject ? result : false;
7419 if (typeof opts.onMatch === 'function') {
7420 opts.onMatch(result);
7423 return returnObject ? result : true;
7427 matcher.state = state;
7433 * Test `input` with the given `regex`. This is used by the main
7434 * `picomatch()` function to test the input string.
7437 * const picomatch = require('picomatch');
7438 * // picomatch.test(input, regex[, options]);
7440 * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
7441 * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
7443 * @param {String} `input` String to test.
7444 * @param {RegExp} `regex`
7445 * @return {Object} Returns an object with matching info.
7450 picomatch$2.test = (input, regex, options, {
7454 if (typeof input !== 'string') {
7455 throw new TypeError('Expected input to be a string');
7465 const opts = options || {};
7466 const format = opts.format || (posix ? utils$c.toPosixSlashes : null);
7467 let match = input === glob;
7468 let output = match && format ? format(input) : input;
7470 if (match === false) {
7471 output = format ? format(input) : input;
7472 match = output === glob;
7475 if (match === false || opts.capture === true) {
7476 if (opts.matchBase === true || opts.basename === true) {
7477 match = picomatch$2.matchBase(input, regex, options, posix);
7479 match = regex.exec(output);
7484 isMatch: Boolean(match),
7490 * Match the basename of a filepath.
7493 * const picomatch = require('picomatch');
7494 * // picomatch.matchBase(input, glob[, options]);
7495 * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
7497 * @param {String} `input` String to test.
7498 * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
7504 picomatch$2.matchBase = (input, glob, options, posix = utils$c.isWindows(options)) => {
7505 const regex = glob instanceof RegExp ? glob : picomatch$2.makeRe(glob, options);
7506 return regex.test(path$9.basename(input));
7509 * Returns true if **any** of the given glob `patterns` match the specified `string`.
7512 * const picomatch = require('picomatch');
7513 * // picomatch.isMatch(string, patterns[, options]);
7515 * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
7516 * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
7518 * @param {String|Array} str The string to test.
7519 * @param {String|Array} patterns One or more glob patterns to use for matching.
7520 * @param {Object} [options] See available [options](#options).
7521 * @return {Boolean} Returns true if any patterns match `str`
7526 picomatch$2.isMatch = (str, patterns, options) => picomatch$2(patterns, options)(str);
7528 * Parse a glob pattern to create the source string for a regular
7532 * const picomatch = require('picomatch');
7533 * const result = picomatch.parse(pattern[, options]);
7535 * @param {String} `pattern`
7536 * @param {Object} `options`
7537 * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
7542 picomatch$2.parse = (pattern, options) => {
7543 if (Array.isArray(pattern)) return pattern.map(p => picomatch$2.parse(p, options));
7544 return parse$1(pattern, Object.assign(Object.assign({}, options), {}, {
7549 * Scan a glob pattern to separate the pattern into segments.
7552 * const picomatch = require('picomatch');
7553 * // picomatch.scan(input[, options]);
7555 * const result = picomatch.scan('!./foo/*.js');
7556 * console.log(result);
7558 * input: '!./foo/*.js',
7566 * isGlobstar: false,
7569 * @param {String} `input` Glob pattern to scan.
7570 * @param {Object} `options`
7571 * @return {Object} Returns an object with
7576 picomatch$2.scan = (input, options) => scan(input, options);
7578 * Compile a regular expression from the `state` object returned by the
7579 * [parse()](#parse) method.
7581 * @param {Object} `state`
7582 * @param {Object} `options`
7583 * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
7584 * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
7590 picomatch$2.compileRe = (state, options, returnOutput = false, returnState = false) => {
7591 if (returnOutput === true) {
7592 return state.output;
7595 const opts = options || {};
7596 const prepend = opts.contains ? '' : '^';
7597 const append = opts.contains ? '' : '$';
7598 let source = `${prepend}(?:${state.output})${append}`;
7600 if (state && state.negated === true) {
7601 source = `^(?!${source}).*$`;
7604 const regex = picomatch$2.toRegex(source, options);
7606 if (returnState === true) {
7607 regex.state = state;
7613 * Create a regular expression from a parsed glob pattern.
7616 * const picomatch = require('picomatch');
7617 * const state = picomatch.parse('*.js');
7618 * // picomatch.compileRe(state[, options]);
7620 * console.log(picomatch.compileRe(state));
7621 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
7623 * @param {String} `state` The object returned from the `.parse` method.
7624 * @param {Object} `options`
7625 * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
7626 * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
7627 * @return {RegExp} Returns a regex created from the given pattern.
7632 picomatch$2.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
7633 if (!input || typeof input !== 'string') {
7634 throw new TypeError('Expected a non-empty string');
7642 if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
7643 parsed.output = parse$1.fastpaths(input, options);
7646 if (!parsed.output) {
7647 parsed = parse$1(input, options);
7650 return picomatch$2.compileRe(parsed, options, returnOutput, returnState);
7653 * Create a regular expression from the given regex source string.
7656 * const picomatch = require('picomatch');
7657 * // picomatch.toRegex(source[, options]);
7659 * const { output } = picomatch.parse('*.js');
7660 * console.log(picomatch.toRegex(output));
7661 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
7663 * @param {String} `source` Regular expression source string.
7664 * @param {Object} `options`
7670 picomatch$2.toRegex = (source, options) => {
7672 const opts = options || {};
7673 return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
7675 if (options && options.debug === true) throw err;
7680 * Picomatch constants.
7685 picomatch$2.constants = constants$1;
7687 * Expose "picomatch"
7690 var picomatch_1 = picomatch$2;
7692 var picomatch$1 = picomatch_1;
7694 const util = require$$0__default$2["default"];
7695 const braces = braces_1;
7696 const picomatch = picomatch$1;
7697 const utils$b = utils$f;
7699 const isEmptyString = val => val === '' || val === './';
7701 * Returns an array of strings that match one or more glob patterns.
7704 * const mm = require('micromatch');
7705 * // mm(list, patterns[, options]);
7707 * console.log(mm(['a.js', 'a.txt'], ['*.js']));
7710 * @param {String|Array<string>} `list` List of strings to match.
7711 * @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
7712 * @param {Object} `options` See available [options](#options)
7713 * @return {Array} Returns an array of matches
7719 const micromatch$1 = (list, patterns, options) => {
7720 patterns = [].concat(patterns);
7721 list = [].concat(list);
7722 let omit = new Set();
7723 let keep = new Set();
7724 let items = new Set();
7727 let onResult = state => {
7728 items.add(state.output);
7730 if (options && options.onResult) {
7731 options.onResult(state);
7735 for (let i = 0; i < patterns.length; i++) {
7736 let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
7739 let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
7740 if (negated) negatives++;
7742 for (let item of list) {
7743 let matched = isMatch(item, true);
7744 let match = negated ? !matched.isMatch : matched.isMatch;
7745 if (!match) continue;
7748 omit.add(matched.output);
7750 omit.delete(matched.output);
7751 keep.add(matched.output);
7756 let result = negatives === patterns.length ? [...items] : [...keep];
7757 let matches = result.filter(item => !omit.has(item));
7759 if (options && matches.length === 0) {
7760 if (options.failglob === true) {
7761 throw new Error(`No matches found for "${patterns.join(', ')}"`);
7764 if (options.nonull === true || options.nullglob === true) {
7765 return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns;
7772 * Backwards compatibility
7776 micromatch$1.match = micromatch$1;
7778 * Returns a matcher function from the given glob `pattern` and `options`.
7779 * The returned function takes a string to match as its only argument and returns
7780 * true if the string is a match.
7783 * const mm = require('micromatch');
7784 * // mm.matcher(pattern[, options]);
7786 * const isMatch = mm.matcher('*.!(*a)');
7787 * console.log(isMatch('a.a')); //=> false
7788 * console.log(isMatch('a.b')); //=> true
7790 * @param {String} `pattern` Glob pattern
7791 * @param {Object} `options`
7792 * @return {Function} Returns a matcher function.
7796 micromatch$1.matcher = (pattern, options) => picomatch(pattern, options);
7798 * Returns true if **any** of the given glob `patterns` match the specified `string`.
7801 * const mm = require('micromatch');
7802 * // mm.isMatch(string, patterns[, options]);
7804 * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
7805 * console.log(mm.isMatch('a.a', 'b.*')); //=> false
7807 * @param {String} `str` The string to test.
7808 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
7809 * @param {Object} `[options]` See available [options](#options).
7810 * @return {Boolean} Returns true if any patterns match `str`
7815 micromatch$1.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
7817 * Backwards compatibility
7821 micromatch$1.any = micromatch$1.isMatch;
7823 * Returns a list of strings that _**do not match any**_ of the given `patterns`.
7826 * const mm = require('micromatch');
7827 * // mm.not(list, patterns[, options]);
7829 * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
7830 * //=> ['b.b', 'c.c']
7832 * @param {Array} `list` Array of strings to match.
7833 * @param {String|Array} `patterns` One or more glob pattern to use for matching.
7834 * @param {Object} `options` See available [options](#options) for changing how matches are performed
7835 * @return {Array} Returns an array of strings that **do not match** the given patterns.
7839 micromatch$1.not = (list, patterns, options = {}) => {
7840 patterns = [].concat(patterns).map(String);
7841 let result = new Set();
7844 let onResult = state => {
7845 if (options.onResult) options.onResult(state);
7846 items.push(state.output);
7849 let matches = micromatch$1(list, patterns, Object.assign(Object.assign({}, options), {}, {
7853 for (let item of items) {
7854 if (!matches.includes(item)) {
7862 * Returns true if the given `string` contains the given pattern. Similar
7863 * to [.isMatch](#isMatch) but the pattern can match any part of the string.
7866 * var mm = require('micromatch');
7867 * // mm.contains(string, pattern[, options]);
7869 * console.log(mm.contains('aa/bb/cc', '*b'));
7871 * console.log(mm.contains('aa/bb/cc', '*d'));
7874 * @param {String} `str` The string to match.
7875 * @param {String|Array} `patterns` Glob pattern to use for matching.
7876 * @param {Object} `options` See available [options](#options) for changing how matches are performed
7877 * @return {Boolean} Returns true if any of the patterns matches any part of `str`.
7882 micromatch$1.contains = (str, pattern, options) => {
7883 if (typeof str !== 'string') {
7884 throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
7887 if (Array.isArray(pattern)) {
7888 return pattern.some(p => micromatch$1.contains(str, p, options));
7891 if (typeof pattern === 'string') {
7892 if (isEmptyString(str) || isEmptyString(pattern)) {
7896 if (str.includes(pattern) || str.startsWith('./') && str.slice(2).includes(pattern)) {
7901 return micromatch$1.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
7906 * Filter the keys of the given object with the given `glob` pattern
7907 * and `options`. Does not attempt to match nested keys. If you need this feature,
7908 * use [glob-object][] instead.
7911 * const mm = require('micromatch');
7912 * // mm.matchKeys(object, patterns[, options]);
7914 * const obj = { aa: 'a', ab: 'b', ac: 'c' };
7915 * console.log(mm.matchKeys(obj, '*b'));
7918 * @param {Object} `object` The object with keys to filter.
7919 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
7920 * @param {Object} `options` See available [options](#options) for changing how matches are performed
7921 * @return {Object} Returns an object with only keys that match the given patterns.
7926 micromatch$1.matchKeys = (obj, patterns, options) => {
7927 if (!utils$b.isObject(obj)) {
7928 throw new TypeError('Expected the first argument to be an object');
7931 let keys = micromatch$1(Object.keys(obj), patterns, options);
7934 for (let key of keys) res[key] = obj[key];
7939 * Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
7942 * const mm = require('micromatch');
7943 * // mm.some(list, patterns[, options]);
7945 * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
7947 * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
7950 * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
7951 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
7952 * @param {Object} `options` See available [options](#options) for changing how matches are performed
7953 * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
7958 micromatch$1.some = (list, patterns, options) => {
7959 let items = [].concat(list);
7961 for (let pattern of [].concat(patterns)) {
7962 let isMatch = picomatch(String(pattern), options);
7964 if (items.some(item => isMatch(item))) {
7972 * Returns true if every string in the given `list` matches
7973 * any of the given glob `patterns`.
7976 * const mm = require('micromatch');
7977 * // mm.every(list, patterns[, options]);
7979 * console.log(mm.every('foo.js', ['foo.js']));
7981 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
7983 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
7985 * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
7988 * @param {String|Array} `list` The string or array of strings to test.
7989 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
7990 * @param {Object} `options` See available [options](#options) for changing how matches are performed
7991 * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
7996 micromatch$1.every = (list, patterns, options) => {
7997 let items = [].concat(list);
7999 for (let pattern of [].concat(patterns)) {
8000 let isMatch = picomatch(String(pattern), options);
8002 if (!items.every(item => isMatch(item))) {
8010 * Returns true if **all** of the given `patterns` match
8011 * the specified string.
8014 * const mm = require('micromatch');
8015 * // mm.all(string, patterns[, options]);
8017 * console.log(mm.all('foo.js', ['foo.js']));
8020 * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
8023 * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
8026 * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
8029 * @param {String|Array} `str` The string to test.
8030 * @param {String|Array} `patterns` One or more glob patterns to use for matching.
8031 * @param {Object} `options` See available [options](#options) for changing how matches are performed
8032 * @return {Boolean} Returns true if any patterns match `str`
8037 micromatch$1.all = (str, patterns, options) => {
8038 if (typeof str !== 'string') {
8039 throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
8042 return [].concat(patterns).every(p => picomatch(p, options)(str));
8045 * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
8048 * const mm = require('micromatch');
8049 * // mm.capture(pattern, string[, options]);
8051 * console.log(mm.capture('test/*.js', 'test/foo.js'));
8053 * console.log(mm.capture('test/*.js', 'foo/bar.css'));
8056 * @param {String} `glob` Glob pattern to use for matching.
8057 * @param {String} `input` String to match
8058 * @param {Object} `options` See available [options](#options) for changing how matches are performed
8059 * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
8064 micromatch$1.capture = (glob, input, options) => {
8065 let posix = utils$b.isWindows(options);
8066 let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
8069 let match = regex.exec(posix ? utils$b.toPosixSlashes(input) : input);
8072 return match.slice(1).map(v => v === void 0 ? '' : v);
8076 * Create a regular expression from the given glob `pattern`.
8079 * const mm = require('micromatch');
8080 * // mm.makeRe(pattern[, options]);
8082 * console.log(mm.makeRe('*.js'));
8083 * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
8085 * @param {String} `pattern` A glob pattern to convert to regex.
8086 * @param {Object} `options`
8087 * @return {RegExp} Returns a regex created from the given pattern.
8092 micromatch$1.makeRe = (...args) => picomatch.makeRe(...args);
8094 * Scan a glob pattern to separate the pattern into segments. Used
8095 * by the [split](#split) method.
8098 * const mm = require('micromatch');
8099 * const state = mm.scan(pattern[, options]);
8101 * @param {String} `pattern`
8102 * @param {Object} `options`
8103 * @return {Object} Returns an object with
8108 micromatch$1.scan = (...args) => picomatch.scan(...args);
8110 * Parse a glob pattern to create the source string for a regular
8114 * const mm = require('micromatch');
8115 * const state = mm(pattern[, options]);
8117 * @param {String} `glob`
8118 * @param {Object} `options`
8119 * @return {Object} Returns an object with useful properties and output to be used as regex source string.
8124 micromatch$1.parse = (patterns, options) => {
8127 for (let pattern of [].concat(patterns || [])) {
8128 for (let str of braces(String(pattern), options)) {
8129 res.push(picomatch.parse(str, options));
8136 * Process the given brace `pattern`.
8139 * const { braces } = require('micromatch');
8140 * console.log(braces('foo/{a,b,c}/bar'));
8141 * //=> [ 'foo/(a|b|c)/bar' ]
8143 * console.log(braces('foo/{a,b,c}/bar', { expand: true }));
8144 * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
8146 * @param {String} `pattern` String with brace pattern to process.
8147 * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
8153 micromatch$1.braces = (pattern, options) => {
8154 if (typeof pattern !== 'string') throw new TypeError('Expected a string');
8156 if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
8160 return braces(pattern, options);
8167 micromatch$1.braceExpand = (pattern, options) => {
8168 if (typeof pattern !== 'string') throw new TypeError('Expected a string');
8169 return micromatch$1.braces(pattern, Object.assign(Object.assign({}, options), {}, {
8178 var micromatch_1 = micromatch$1;
8180 Object.defineProperty(pattern$1, "__esModule", {
8183 pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
8184 const path$8 = require$$0__default$1["default"];
8185 const globParent = globParent$1;
8186 const micromatch = micromatch_1;
8187 const GLOBSTAR = '**';
8188 const ESCAPE_SYMBOL = '\\';
8189 const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
8190 const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/;
8191 const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/;
8192 const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/;
8193 const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/;
8195 function isStaticPattern(pattern, options = {}) {
8196 return !isDynamicPattern(pattern, options);
8199 pattern$1.isStaticPattern = isStaticPattern;
8201 function isDynamicPattern(pattern, options = {}) {
8203 * A special case with an empty string is necessary for matching patterns that start with a forward slash.
8204 * An empty string cannot be a dynamic pattern.
8205 * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
8207 if (pattern === '') {
8211 * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
8212 * filepath directly (without read directory).
8216 if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
8220 if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
8224 if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
8228 if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) {
8235 pattern$1.isDynamicPattern = isDynamicPattern;
8237 function convertToPositivePattern(pattern) {
8238 return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
8241 pattern$1.convertToPositivePattern = convertToPositivePattern;
8243 function convertToNegativePattern(pattern) {
8244 return '!' + pattern;
8247 pattern$1.convertToNegativePattern = convertToNegativePattern;
8249 function isNegativePattern(pattern) {
8250 return pattern.startsWith('!') && pattern[1] !== '(';
8253 pattern$1.isNegativePattern = isNegativePattern;
8255 function isPositivePattern(pattern) {
8256 return !isNegativePattern(pattern);
8259 pattern$1.isPositivePattern = isPositivePattern;
8261 function getNegativePatterns(patterns) {
8262 return patterns.filter(isNegativePattern);
8265 pattern$1.getNegativePatterns = getNegativePatterns;
8267 function getPositivePatterns$1(patterns) {
8268 return patterns.filter(isPositivePattern);
8271 pattern$1.getPositivePatterns = getPositivePatterns$1;
8273 * Returns patterns that can be applied inside the current directory.
8276 * // ['./*', '*', 'a/*']
8277 * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8280 function getPatternsInsideCurrentDirectory(patterns) {
8281 return patterns.filter(pattern => !isPatternRelatedToParentDirectory(pattern));
8284 pattern$1.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
8286 * Returns patterns to be expanded relative to (outside) the current directory.
8289 * // ['../*', './../*']
8290 * getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
8293 function getPatternsOutsideCurrentDirectory(patterns) {
8294 return patterns.filter(isPatternRelatedToParentDirectory);
8297 pattern$1.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
8299 function isPatternRelatedToParentDirectory(pattern) {
8300 return pattern.startsWith('..') || pattern.startsWith('./..');
8303 pattern$1.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
8305 function getBaseDirectory(pattern) {
8306 return globParent(pattern, {
8307 flipBackslashes: false
8311 pattern$1.getBaseDirectory = getBaseDirectory;
8313 function hasGlobStar(pattern) {
8314 return pattern.includes(GLOBSTAR);
8317 pattern$1.hasGlobStar = hasGlobStar;
8319 function endsWithSlashGlobStar(pattern) {
8320 return pattern.endsWith('/' + GLOBSTAR);
8323 pattern$1.endsWithSlashGlobStar = endsWithSlashGlobStar;
8325 function isAffectDepthOfReadingPattern(pattern) {
8326 const basename = path$8.basename(pattern);
8327 return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
8330 pattern$1.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
8332 function expandPatternsWithBraceExpansion(patterns) {
8333 return patterns.reduce((collection, pattern) => {
8334 return collection.concat(expandBraceExpansion(pattern));
8338 pattern$1.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
8340 function expandBraceExpansion(pattern) {
8341 return micromatch.braces(pattern, {
8347 pattern$1.expandBraceExpansion = expandBraceExpansion;
8349 function getPatternParts(pattern, options) {
8352 } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
8356 * The scan method returns an empty array in some cases.
8357 * See micromatch/picomatch#58 for more details.
8360 if (parts.length === 0) {
8364 * The scan method does not return an empty part for the pattern with a forward slash.
8365 * This is another part of micromatch/picomatch#58.
8369 if (parts[0].startsWith('/')) {
8370 parts[0] = parts[0].slice(1);
8377 pattern$1.getPatternParts = getPatternParts;
8379 function makeRe(pattern, options) {
8380 return micromatch.makeRe(pattern, options);
8383 pattern$1.makeRe = makeRe;
8385 function convertPatternsToRe(patterns, options) {
8386 return patterns.map(pattern => makeRe(pattern, options));
8389 pattern$1.convertPatternsToRe = convertPatternsToRe;
8391 function matchAny(entry, patternsRe) {
8392 return patternsRe.some(patternRe => patternRe.test(entry));
8395 pattern$1.matchAny = matchAny;
8401 * https://github.com/teambition/merge2
8403 * Copyright (c) 2014-2020 Teambition
8404 * Licensed under the MIT license.
8408 const Stream = require$$0__default$3["default"];
8409 const PassThrough = Stream.PassThrough;
8410 const slice = Array.prototype.slice;
8411 var merge2_1 = merge2$1;
8413 function merge2$1() {
8414 const streamsQueue = [];
8415 const args = slice.call(arguments);
8416 let merging = false;
8417 let options = args[args.length - 1];
8419 if (options && !Array.isArray(options) && options.pipe == null) {
8425 const doEnd = options.end !== false;
8426 const doPipeError = options.pipeError === true;
8428 if (options.objectMode == null) {
8429 options.objectMode = true;
8432 if (options.highWaterMark == null) {
8433 options.highWaterMark = 64 * 1024;
8436 const mergedStream = PassThrough(options);
8438 function addStream() {
8439 for (let i = 0, len = arguments.length; i < len; i++) {
8440 streamsQueue.push(pauseStreams(arguments[i], options));
8447 function mergeStream() {
8453 let streams = streamsQueue.shift();
8456 process.nextTick(endStream);
8460 if (!Array.isArray(streams)) {
8461 streams = [streams];
8464 let pipesCount = streams.length + 1;
8467 if (--pipesCount > 0) {
8475 function pipe(stream) {
8477 stream.removeListener('merge2UnpipeEnd', onend);
8478 stream.removeListener('end', onend);
8481 stream.removeListener('error', onerror);
8487 function onerror(err) {
8488 mergedStream.emit('error', err);
8489 } // skip ended stream
8492 if (stream._readableState.endEmitted) {
8496 stream.on('merge2UnpipeEnd', onend);
8497 stream.on('end', onend);
8500 stream.on('error', onerror);
8503 stream.pipe(mergedStream, {
8505 }); // compatible for old stream
8510 for (let i = 0; i < streams.length; i++) {
8517 function endStream() {
8518 merging = false; // emit 'queueDrain' when all streams merged.
8520 mergedStream.emit('queueDrain');
8527 mergedStream.setMaxListeners(0);
8528 mergedStream.add = addStream;
8529 mergedStream.on('unpipe', function (stream) {
8530 stream.emit('merge2UnpipeEnd');
8534 addStream.apply(null, args);
8537 return mergedStream;
8538 } // check and pause streams for pipe.
8541 function pauseStreams(streams, options) {
8542 if (!Array.isArray(streams)) {
8543 // Backwards-compat with old-style streams
8544 if (!streams._readableState && streams.pipe) {
8545 streams = streams.pipe(PassThrough(options));
8548 if (!streams._readableState || !streams.pause || !streams.pipe) {
8549 throw new Error('Only readable stream can be merged.');
8554 for (let i = 0, len = streams.length; i < len; i++) {
8555 streams[i] = pauseStreams(streams[i], options);
8562 Object.defineProperty(stream$4, "__esModule", {
8565 stream$4.merge = void 0;
8566 const merge2 = merge2_1;
8568 function merge$2(streams) {
8569 const mergedStream = merge2(streams);
8570 streams.forEach(stream => {
8571 stream.once('error', error => mergedStream.emit('error', error));
8573 mergedStream.once('close', () => propagateCloseEventToSources(streams));
8574 mergedStream.once('end', () => propagateCloseEventToSources(streams));
8575 return mergedStream;
8578 stream$4.merge = merge$2;
8580 function propagateCloseEventToSources(streams) {
8581 streams.forEach(stream => stream.emit('close'));
8586 Object.defineProperty(string$1, "__esModule", {
8589 string$1.isEmpty = string$1.isString = void 0;
8591 function isString(input) {
8592 return typeof input === 'string';
8595 string$1.isString = isString;
8597 function isEmpty(input) {
8598 return input === '';
8601 string$1.isEmpty = isEmpty;
8603 Object.defineProperty(utils$k, "__esModule", {
8606 utils$k.string = utils$k.stream = utils$k.pattern = utils$k.path = utils$k.fs = utils$k.errno = utils$k.array = void 0;
8607 const array$2 = array$3;
8608 utils$k.array = array$2;
8609 const errno = errno$1;
8610 utils$k.errno = errno;
8613 const path$7 = path$c;
8614 utils$k.path = path$7;
8615 const pattern = pattern$1;
8616 utils$k.pattern = pattern;
8617 const stream$3 = stream$4;
8618 utils$k.stream = stream$3;
8619 const string = string$1;
8620 utils$k.string = string;
8622 Object.defineProperty(tasks, "__esModule", {
8625 tasks.convertPatternGroupToTask = tasks.convertPatternGroupsToTasks = tasks.groupPatternsByBaseDirectory = tasks.getNegativePatternsAsPositive = tasks.getPositivePatterns = tasks.convertPatternsToTasks = tasks.generate = void 0;
8626 const utils$a = utils$k;
8628 function generate(patterns, settings) {
8629 const positivePatterns = getPositivePatterns(patterns);
8630 const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
8631 const staticPatterns = positivePatterns.filter(pattern => utils$a.pattern.isStaticPattern(pattern, settings));
8632 const dynamicPatterns = positivePatterns.filter(pattern => utils$a.pattern.isDynamicPattern(pattern, settings));
8633 const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns,
8636 const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns,
8639 return staticTasks.concat(dynamicTasks);
8642 tasks.generate = generate;
8644 * Returns tasks grouped by basic pattern directories.
8646 * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
8647 * This is necessary because directory traversal starts at the base directory and goes deeper.
8650 function convertPatternsToTasks(positive, negative, dynamic) {
8652 const patternsOutsideCurrentDirectory = utils$a.pattern.getPatternsOutsideCurrentDirectory(positive);
8653 const patternsInsideCurrentDirectory = utils$a.pattern.getPatternsInsideCurrentDirectory(positive);
8654 const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
8655 const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
8656 tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
8658 * For the sake of reducing future accesses to the file system, we merge all tasks within the current directory
8659 * into a global task, if at least one pattern refers to the root (`.`). In this case, the global task covers the rest.
8662 if ('.' in insideCurrentDirectoryGroup) {
8663 tasks.push(convertPatternGroupToTask('.', patternsInsideCurrentDirectory, negative, dynamic));
8665 tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
8671 tasks.convertPatternsToTasks = convertPatternsToTasks;
8673 function getPositivePatterns(patterns) {
8674 return utils$a.pattern.getPositivePatterns(patterns);
8677 tasks.getPositivePatterns = getPositivePatterns;
8679 function getNegativePatternsAsPositive(patterns, ignore) {
8680 const negative = utils$a.pattern.getNegativePatterns(patterns).concat(ignore);
8681 const positive = negative.map(utils$a.pattern.convertToPositivePattern);
8685 tasks.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
8687 function groupPatternsByBaseDirectory(patterns) {
8689 return patterns.reduce((collection, pattern) => {
8690 const base = utils$a.pattern.getBaseDirectory(pattern);
8692 if (base in collection) {
8693 collection[base].push(pattern);
8695 collection[base] = [pattern];
8702 tasks.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
8704 function convertPatternGroupsToTasks(positive, negative, dynamic) {
8705 return Object.keys(positive).map(base => {
8706 return convertPatternGroupToTask(base, positive[base], negative, dynamic);
8710 tasks.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
8712 function convertPatternGroupToTask(base, positive, negative, dynamic) {
8718 patterns: [].concat(positive, negative.map(utils$a.pattern.convertToNegativePattern))
8722 tasks.convertPatternGroupToTask = convertPatternGroupToTask;
8732 Object.defineProperty(async$5, "__esModule", {
8735 async$5.read = void 0;
8737 function read$3(path, settings, callback) {
8738 settings.fs.lstat(path, (lstatError, lstat) => {
8739 if (lstatError !== null) {
8740 callFailureCallback$2(callback, lstatError);
8744 if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
8745 callSuccessCallback$2(callback, lstat);
8749 settings.fs.stat(path, (statError, stat) => {
8750 if (statError !== null) {
8751 if (settings.throwErrorOnBrokenSymbolicLink) {
8752 callFailureCallback$2(callback, statError);
8756 callSuccessCallback$2(callback, lstat);
8760 if (settings.markSymbolicLink) {
8761 stat.isSymbolicLink = () => true;
8764 callSuccessCallback$2(callback, stat);
8769 async$5.read = read$3;
8771 function callFailureCallback$2(callback, error) {
8775 function callSuccessCallback$2(callback, result) {
8776 callback(null, result);
8781 Object.defineProperty(sync$7, "__esModule", {
8784 sync$7.read = void 0;
8786 function read$2(path, settings) {
8787 const lstat = settings.fs.lstatSync(path);
8789 if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
8794 const stat = settings.fs.statSync(path);
8796 if (settings.markSymbolicLink) {
8797 stat.isSymbolicLink = () => true;
8802 if (!settings.throwErrorOnBrokenSymbolicLink) {
8810 sync$7.read = read$2;
8812 var settings$3 = {};
8816 (function (exports) {
8818 Object.defineProperty(exports, "__esModule", {
8821 exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
8822 const fs = require$$0__default$4["default"];
8823 exports.FILE_SYSTEM_ADAPTER = {
8826 lstatSync: fs.lstatSync,
8827 statSync: fs.statSync
8830 function createFileSystemAdapter(fsMethods) {
8831 if (fsMethods === undefined) {
8832 return exports.FILE_SYSTEM_ADAPTER;
8835 return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
8838 exports.createFileSystemAdapter = createFileSystemAdapter;
8841 Object.defineProperty(settings$3, "__esModule", {
8847 constructor(_options = {}) {
8848 this._options = _options;
8849 this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
8850 this.fs = fs$6.createFileSystemAdapter(this._options.fs);
8851 this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
8852 this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
8855 _getValue(option, value) {
8856 return option !== null && option !== void 0 ? option : value;
8861 settings$3.default = Settings$2;
8863 Object.defineProperty(out$3, "__esModule", {
8866 out$3.statSync = out$3.stat = out$3.Settings = void 0;
8867 const async$4 = async$5;
8868 const sync$6 = sync$7;
8869 const settings_1$3 = settings$3;
8870 out$3.Settings = settings_1$3.default;
8872 function stat(path, optionsOrSettingsOrCallback, callback) {
8873 if (typeof optionsOrSettingsOrCallback === 'function') {
8874 async$4.read(path, getSettings$2(), optionsOrSettingsOrCallback);
8878 async$4.read(path, getSettings$2(optionsOrSettingsOrCallback), callback);
8883 function statSync(path, optionsOrSettings) {
8884 const settings = getSettings$2(optionsOrSettings);
8885 return sync$6.read(path, settings);
8888 out$3.statSync = statSync;
8890 function getSettings$2(settingsOrOptions = {}) {
8891 if (settingsOrOptions instanceof settings_1$3.default) {
8892 return settingsOrOptions;
8895 return new settings_1$3.default(settingsOrOptions);
8908 /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
8910 var queueMicrotask_1 = typeof queueMicrotask === 'function' ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global) // reuse resolved promise, and allocate it lazily
8911 : cb => (promise || (promise = Promise.resolve())).then(cb).catch(err => setTimeout(() => {
8915 /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
8916 var runParallel_1 = runParallel;
8917 const queueMicrotask$1 = queueMicrotask_1;
8919 function runParallel(tasks, cb) {
8920 let results, pending, keys;
8923 if (Array.isArray(tasks)) {
8925 pending = tasks.length;
8927 keys = Object.keys(tasks);
8929 pending = keys.length;
8932 function done(err) {
8934 if (cb) cb(err, results);
8938 if (isSync) queueMicrotask$1(end);else end();
8941 function each(i, err, result) {
8942 results[i] = result;
8944 if (--pending === 0 || err) {
8954 keys.forEach(function (key) {
8955 tasks[key](function (err, result) {
8956 each(key, err, result);
8961 tasks.forEach(function (task, i) {
8962 task(function (err, result) {
8963 each(i, err, result);
8973 Object.defineProperty(constants, "__esModule", {
8976 constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
8977 const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
8979 if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
8980 throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
8983 const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
8984 const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
8985 const SUPPORTED_MAJOR_VERSION = 10;
8986 const SUPPORTED_MINOR_VERSION = 10;
8987 const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
8988 const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
8990 * IS `true` for Node.js 10.10 and greater.
8993 constants.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
8999 Object.defineProperty(fs$5, "__esModule", {
9002 fs$5.createDirentFromStats = void 0;
9004 class DirentFromStats {
9005 constructor(name, stats) {
9007 this.isBlockDevice = stats.isBlockDevice.bind(stats);
9008 this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
9009 this.isDirectory = stats.isDirectory.bind(stats);
9010 this.isFIFO = stats.isFIFO.bind(stats);
9011 this.isFile = stats.isFile.bind(stats);
9012 this.isSocket = stats.isSocket.bind(stats);
9013 this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
9018 function createDirentFromStats(name, stats) {
9019 return new DirentFromStats(name, stats);
9022 fs$5.createDirentFromStats = createDirentFromStats;
9024 Object.defineProperty(utils$9, "__esModule", {
9027 utils$9.fs = void 0;
9033 Object.defineProperty(common$6, "__esModule", {
9036 common$6.joinPathSegments = void 0;
9038 function joinPathSegments$1(a, b, separator) {
9040 * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
9042 if (a.endsWith(separator)) {
9046 return a + separator + b;
9049 common$6.joinPathSegments = joinPathSegments$1;
9051 Object.defineProperty(async$1, "__esModule", {
9054 async$1.readdir = async$1.readdirWithFileTypes = async$1.read = void 0;
9055 const fsStat$5 = out$3;
9056 const rpl = runParallel_1;
9057 const constants_1$1 = constants;
9058 const utils$8 = utils$9;
9059 const common$5 = common$6;
9061 function read$1(directory, settings, callback) {
9062 if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
9063 readdirWithFileTypes$1(directory, settings, callback);
9067 readdir$1(directory, settings, callback);
9070 async$1.read = read$1;
9072 function readdirWithFileTypes$1(directory, settings, callback) {
9073 settings.fs.readdir(directory, {
9075 }, (readdirError, dirents) => {
9076 if (readdirError !== null) {
9077 callFailureCallback$1(callback, readdirError);
9081 const entries = dirents.map(dirent => ({
9084 path: common$5.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
9087 if (!settings.followSymbolicLinks) {
9088 callSuccessCallback$1(callback, entries);
9092 const tasks = entries.map(entry => makeRplTaskEntry(entry, settings));
9093 rpl(tasks, (rplError, rplEntries) => {
9094 if (rplError !== null) {
9095 callFailureCallback$1(callback, rplError);
9099 callSuccessCallback$1(callback, rplEntries);
9104 async$1.readdirWithFileTypes = readdirWithFileTypes$1;
9106 function makeRplTaskEntry(entry, settings) {
9108 if (!entry.dirent.isSymbolicLink()) {
9113 settings.fs.stat(entry.path, (statError, stats) => {
9114 if (statError !== null) {
9115 if (settings.throwErrorOnBrokenSymbolicLink) {
9124 entry.dirent = utils$8.fs.createDirentFromStats(entry.name, stats);
9130 function readdir$1(directory, settings, callback) {
9131 settings.fs.readdir(directory, (readdirError, names) => {
9132 if (readdirError !== null) {
9133 callFailureCallback$1(callback, readdirError);
9137 const tasks = names.map(name => {
9138 const path = common$5.joinPathSegments(directory, name, settings.pathSegmentSeparator);
9140 fsStat$5.stat(path, settings.fsStatSettings, (error, stats) => {
9141 if (error !== null) {
9149 dirent: utils$8.fs.createDirentFromStats(name, stats)
9152 if (settings.stats) {
9153 entry.stats = stats;
9160 rpl(tasks, (rplError, entries) => {
9161 if (rplError !== null) {
9162 callFailureCallback$1(callback, rplError);
9166 callSuccessCallback$1(callback, entries);
9171 async$1.readdir = readdir$1;
9173 function callFailureCallback$1(callback, error) {
9177 function callSuccessCallback$1(callback, result) {
9178 callback(null, result);
9183 Object.defineProperty(sync$5, "__esModule", {
9186 sync$5.readdir = sync$5.readdirWithFileTypes = sync$5.read = void 0;
9187 const fsStat$4 = out$3;
9188 const constants_1 = constants;
9189 const utils$7 = utils$9;
9190 const common$4 = common$6;
9192 function read(directory, settings) {
9193 if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
9194 return readdirWithFileTypes(directory, settings);
9197 return readdir(directory, settings);
9202 function readdirWithFileTypes(directory, settings) {
9203 const dirents = settings.fs.readdirSync(directory, {
9206 return dirents.map(dirent => {
9210 path: common$4.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
9213 if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
9215 const stats = settings.fs.statSync(entry.path);
9216 entry.dirent = utils$7.fs.createDirentFromStats(entry.name, stats);
9218 if (settings.throwErrorOnBrokenSymbolicLink) {
9228 sync$5.readdirWithFileTypes = readdirWithFileTypes;
9230 function readdir(directory, settings) {
9231 const names = settings.fs.readdirSync(directory);
9232 return names.map(name => {
9233 const entryPath = common$4.joinPathSegments(directory, name, settings.pathSegmentSeparator);
9234 const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
9238 dirent: utils$7.fs.createDirentFromStats(name, stats)
9241 if (settings.stats) {
9242 entry.stats = stats;
9249 sync$5.readdir = readdir;
9251 var settings$2 = {};
9255 (function (exports) {
9257 Object.defineProperty(exports, "__esModule", {
9260 exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
9261 const fs = require$$0__default$4["default"];
9262 exports.FILE_SYSTEM_ADAPTER = {
9265 lstatSync: fs.lstatSync,
9266 statSync: fs.statSync,
9267 readdir: fs.readdir,
9268 readdirSync: fs.readdirSync
9271 function createFileSystemAdapter(fsMethods) {
9272 if (fsMethods === undefined) {
9273 return exports.FILE_SYSTEM_ADAPTER;
9276 return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
9279 exports.createFileSystemAdapter = createFileSystemAdapter;
9282 Object.defineProperty(settings$2, "__esModule", {
9285 const path$6 = require$$0__default$1["default"];
9286 const fsStat$3 = out$3;
9290 constructor(_options = {}) {
9291 this._options = _options;
9292 this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
9293 this.fs = fs$2.createFileSystemAdapter(this._options.fs);
9294 this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$6.sep);
9295 this.stats = this._getValue(this._options.stats, false);
9296 this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
9297 this.fsStatSettings = new fsStat$3.Settings({
9298 followSymbolicLink: this.followSymbolicLinks,
9300 throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
9304 _getValue(option, value) {
9305 return option !== null && option !== void 0 ? option : value;
9310 settings$2.default = Settings$1;
9312 Object.defineProperty(out$1, "__esModule", {
9315 out$1.Settings = out$1.scandirSync = out$1.scandir = void 0;
9316 const async = async$1;
9317 const sync$4 = sync$5;
9318 const settings_1$2 = settings$2;
9319 out$1.Settings = settings_1$2.default;
9321 function scandir(path, optionsOrSettingsOrCallback, callback) {
9322 if (typeof optionsOrSettingsOrCallback === 'function') {
9323 async.read(path, getSettings$1(), optionsOrSettingsOrCallback);
9327 async.read(path, getSettings$1(optionsOrSettingsOrCallback), callback);
9330 out$1.scandir = scandir;
9332 function scandirSync(path, optionsOrSettings) {
9333 const settings = getSettings$1(optionsOrSettings);
9334 return sync$4.read(path, settings);
9337 out$1.scandirSync = scandirSync;
9339 function getSettings$1(settingsOrOptions = {}) {
9340 if (settingsOrOptions instanceof settings_1$2.default) {
9341 return settingsOrOptions;
9344 return new settings_1$2.default(settingsOrOptions);
9347 var queue = {exports: {}};
9349 function reusify$1(Constructor) {
9350 var head = new Constructor();
9357 head = current.next;
9359 head = new Constructor();
9363 current.next = null;
9367 function release(obj) {
9378 var reusify_1 = reusify$1;
9380 /* eslint-disable no-var */
9383 var reusify = reusify_1;
9385 function fastqueue(context, worker, concurrency) {
9386 if (typeof context === 'function') {
9387 concurrency = worker;
9392 if (concurrency < 1) {
9393 throw new Error('fastqueue concurrency must be greater than 1');
9396 var cache = reusify(Task);
9397 var queueHead = null;
9398 var queueTail = null;
9400 var errorHandler = null;
9407 concurrency: concurrency,
9416 killAndDrain: killAndDrain,
9421 function running() {
9430 var current = queueHead;
9434 current = current.next;
9441 function getQueue() {
9442 var current = queueHead;
9446 tasks.push(current.value);
9447 current = current.next;
9454 if (!self.paused) return;
9455 self.paused = false;
9457 for (var i = 0; i < self.concurrency; i++) {
9464 return _running === 0 && self.length() === 0;
9467 function push(value, done) {
9468 var current = cache.get();
9469 current.context = context;
9470 current.release = release;
9471 current.value = value;
9472 current.callback = done || noop;
9473 current.errorHandler = errorHandler;
9475 if (_running === self.concurrency || self.paused) {
9477 queueTail.next = current;
9478 queueTail = current;
9480 queueHead = current;
9481 queueTail = current;
9486 worker.call(context, current.value, current.worked);
9490 function unshift(value, done) {
9491 var current = cache.get();
9492 current.context = context;
9493 current.release = release;
9494 current.value = value;
9495 current.callback = done || noop;
9497 if (_running === self.concurrency || self.paused) {
9499 current.next = queueHead;
9500 queueHead = current;
9502 queueHead = current;
9503 queueTail = current;
9508 worker.call(context, current.value, current.worked);
9512 function release(holder) {
9514 cache.release(holder);
9517 var next = queueHead;
9521 if (queueTail === queueHead) {
9525 queueHead = next.next;
9527 worker.call(context, next.value, next.worked);
9529 if (queueTail === null) {
9535 } else if (--_running === 0) {
9546 function killAndDrain() {
9553 function error(handler) {
9554 errorHandler = handler;
9562 this.callback = noop;
9564 this.release = noop;
9565 this.context = null;
9566 this.errorHandler = null;
9569 this.worked = function worked(err, result) {
9570 var callback = self.callback;
9571 var errorHandler = self.errorHandler;
9572 var val = self.value;
9574 self.callback = noop;
9576 if (self.errorHandler) {
9577 errorHandler(err, val);
9580 callback.call(self.context, err, result);
9585 function queueAsPromised(context, worker, concurrency) {
9586 if (typeof context === 'function') {
9587 concurrency = worker;
9592 function asyncWrapper(arg, cb) {
9593 worker.call(this, arg).then(function (res) {
9598 var queue = fastqueue(context, asyncWrapper, concurrency);
9599 var pushCb = queue.push;
9600 var unshiftCb = queue.unshift;
9602 queue.unshift = unshift;
9603 queue.drained = drained;
9606 function push(value) {
9607 var p = new Promise(function (resolve, reject) {
9608 pushCb(value, function (err, result) {
9616 }); // Let's fork the promise chain to
9617 // make the error bubble up to the user but
9618 // not lead to a unhandledRejection
9624 function unshift(value) {
9625 var p = new Promise(function (resolve, reject) {
9626 unshiftCb(value, function (err, result) {
9634 }); // Let's fork the promise chain to
9635 // make the error bubble up to the user but
9636 // not lead to a unhandledRejection
9642 function drained() {
9643 var previousDrain = queue.drain;
9644 var p = new Promise(function (resolve) {
9645 queue.drain = function () {
9654 queue.exports = fastqueue;
9655 queue.exports.promise = queueAsPromised;
9659 Object.defineProperty(common$3, "__esModule", {
9662 common$3.joinPathSegments = common$3.replacePathSegmentSeparator = common$3.isAppliedFilter = common$3.isFatalError = void 0;
9664 function isFatalError(settings, error) {
9665 if (settings.errorFilter === null) {
9669 return !settings.errorFilter(error);
9672 common$3.isFatalError = isFatalError;
9674 function isAppliedFilter(filter, value) {
9675 return filter === null || filter(value);
9678 common$3.isAppliedFilter = isAppliedFilter;
9680 function replacePathSegmentSeparator(filepath, separator) {
9681 return filepath.split(/[/\\]/).join(separator);
9684 common$3.replacePathSegmentSeparator = replacePathSegmentSeparator;
9686 function joinPathSegments(a, b, separator) {
9691 * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
9695 if (a.endsWith(separator)) {
9699 return a + separator + b;
9702 common$3.joinPathSegments = joinPathSegments;
9706 Object.defineProperty(reader$1, "__esModule", {
9709 const common$2 = common$3;
9712 constructor(_root, _settings) {
9714 this._settings = _settings;
9715 this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
9720 reader$1.default = Reader$1;
9722 Object.defineProperty(async$2, "__esModule", {
9725 const events_1 = require$$0__default$5["default"];
9726 const fsScandir$2 = out$1;
9727 const fastq = queue.exports;
9728 const common$1 = common$3;
9729 const reader_1$3 = reader$1;
9731 class AsyncReader extends reader_1$3.default {
9732 constructor(_root, _settings) {
9733 super(_root, _settings);
9734 this._settings = _settings;
9735 this._scandir = fsScandir$2.scandir;
9736 this._emitter = new events_1.EventEmitter();
9737 this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
9738 this._isFatalError = false;
9739 this._isDestroyed = false;
9741 this._queue.drain = () => {
9742 if (!this._isFatalError) {
9743 this._emitter.emit('end');
9749 this._isFatalError = false;
9750 this._isDestroyed = false;
9751 setImmediate(() => {
9752 this._pushToQueue(this._root, this._settings.basePath);
9754 return this._emitter;
9758 return this._isDestroyed;
9762 if (this._isDestroyed) {
9763 throw new Error('The reader is already destroyed');
9766 this._isDestroyed = true;
9768 this._queue.killAndDrain();
9772 this._emitter.on('entry', callback);
9776 this._emitter.once('error', callback);
9780 this._emitter.once('end', callback);
9783 _pushToQueue(directory, base) {
9789 this._queue.push(queueItem, error => {
9790 if (error !== null) {
9791 this._handleError(error);
9796 _worker(item, done) {
9797 this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
9798 if (error !== null) {
9799 done(error, undefined);
9803 for (const entry of entries) {
9804 this._handleEntry(entry, item.base);
9807 done(null, undefined);
9811 _handleError(error) {
9812 if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) {
9816 this._isFatalError = true;
9817 this._isDestroyed = true;
9819 this._emitter.emit('error', error);
9822 _handleEntry(entry, base) {
9823 if (this._isDestroyed || this._isFatalError) {
9827 const fullpath = entry.path;
9829 if (base !== undefined) {
9830 entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
9833 if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) {
9834 this._emitEntry(entry);
9837 if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) {
9838 this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
9843 this._emitter.emit('entry', entry);
9848 async$2.default = AsyncReader;
9850 Object.defineProperty(async$3, "__esModule", {
9853 const async_1$3 = async$2;
9855 class AsyncProvider {
9856 constructor(_root, _settings) {
9858 this._settings = _settings;
9859 this._reader = new async_1$3.default(this._root, this._settings);
9864 this._reader.onError(error => {
9865 callFailureCallback(callback, error);
9868 this._reader.onEntry(entry => {
9869 this._storage.push(entry);
9872 this._reader.onEnd(() => {
9873 callSuccessCallback(callback, this._storage);
9876 this._reader.read();
9881 async$3.default = AsyncProvider;
9883 function callFailureCallback(callback, error) {
9887 function callSuccessCallback(callback, entries) {
9888 callback(null, entries);
9893 Object.defineProperty(stream$1, "__esModule", {
9896 const stream_1$5 = require$$0__default$3["default"];
9897 const async_1$2 = async$2;
9899 class StreamProvider {
9900 constructor(_root, _settings) {
9902 this._settings = _settings;
9903 this._reader = new async_1$2.default(this._root, this._settings);
9904 this._stream = new stream_1$5.Readable({
9908 if (!this._reader.isDestroyed) {
9909 this._reader.destroy();
9916 this._reader.onError(error => {
9917 this._stream.emit('error', error);
9920 this._reader.onEntry(entry => {
9921 this._stream.push(entry);
9924 this._reader.onEnd(() => {
9925 this._stream.push(null);
9928 this._reader.read();
9930 return this._stream;
9935 stream$1.default = StreamProvider;
9941 Object.defineProperty(sync$2, "__esModule", {
9944 const fsScandir$1 = out$1;
9945 const common = common$3;
9946 const reader_1$2 = reader$1;
9948 class SyncReader extends reader_1$2.default {
9950 super(...arguments);
9951 this._scandir = fsScandir$1.scandirSync;
9953 this._queue = new Set();
9957 this._pushToQueue(this._root, this._settings.basePath);
9959 this._handleQueue();
9961 return this._storage;
9964 _pushToQueue(directory, base) {
9972 for (const item of this._queue.values()) {
9973 this._handleDirectory(item.directory, item.base);
9977 _handleDirectory(directory, base) {
9979 const entries = this._scandir(directory, this._settings.fsScandirSettings);
9981 for (const entry of entries) {
9982 this._handleEntry(entry, base);
9985 this._handleError(error);
9989 _handleError(error) {
9990 if (!common.isFatalError(this._settings, error)) {
9997 _handleEntry(entry, base) {
9998 const fullpath = entry.path;
10000 if (base !== undefined) {
10001 entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
10004 if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
10005 this._pushToStorage(entry);
10008 if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
10009 this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
10013 _pushToStorage(entry) {
10014 this._storage.push(entry);
10019 sync$2.default = SyncReader;
10021 Object.defineProperty(sync$3, "__esModule", {
10024 const sync_1$3 = sync$2;
10026 class SyncProvider {
10027 constructor(_root, _settings) {
10028 this._root = _root;
10029 this._settings = _settings;
10030 this._reader = new sync_1$3.default(this._root, this._settings);
10034 return this._reader.read();
10039 sync$3.default = SyncProvider;
10041 var settings$1 = {};
10043 Object.defineProperty(settings$1, "__esModule", {
10046 const path$5 = require$$0__default$1["default"];
10047 const fsScandir = out$1;
10050 constructor(_options = {}) {
10051 this._options = _options;
10052 this.basePath = this._getValue(this._options.basePath, undefined);
10053 this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
10054 this.deepFilter = this._getValue(this._options.deepFilter, null);
10055 this.entryFilter = this._getValue(this._options.entryFilter, null);
10056 this.errorFilter = this._getValue(this._options.errorFilter, null);
10057 this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$5.sep);
10058 this.fsScandirSettings = new fsScandir.Settings({
10059 followSymbolicLinks: this._options.followSymbolicLinks,
10060 fs: this._options.fs,
10061 pathSegmentSeparator: this._options.pathSegmentSeparator,
10062 stats: this._options.stats,
10063 throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
10067 _getValue(option, value) {
10068 return option !== null && option !== void 0 ? option : value;
10073 settings$1.default = Settings;
10075 Object.defineProperty(out$2, "__esModule", {
10078 out$2.Settings = out$2.walkStream = out$2.walkSync = out$2.walk = void 0;
10079 const async_1$1 = async$3;
10080 const stream_1$4 = stream$1;
10081 const sync_1$2 = sync$3;
10082 const settings_1$1 = settings$1;
10083 out$2.Settings = settings_1$1.default;
10085 function walk(directory, optionsOrSettingsOrCallback, callback) {
10086 if (typeof optionsOrSettingsOrCallback === 'function') {
10087 new async_1$1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
10091 new async_1$1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
10096 function walkSync(directory, optionsOrSettings) {
10097 const settings = getSettings(optionsOrSettings);
10098 const provider = new sync_1$2.default(directory, settings);
10099 return provider.read();
10102 out$2.walkSync = walkSync;
10104 function walkStream(directory, optionsOrSettings) {
10105 const settings = getSettings(optionsOrSettings);
10106 const provider = new stream_1$4.default(directory, settings);
10107 return provider.read();
10110 out$2.walkStream = walkStream;
10112 function getSettings(settingsOrOptions = {}) {
10113 if (settingsOrOptions instanceof settings_1$1.default) {
10114 return settingsOrOptions;
10117 return new settings_1$1.default(settingsOrOptions);
10122 Object.defineProperty(reader, "__esModule", {
10125 const path$4 = require$$0__default$1["default"];
10126 const fsStat$2 = out$3;
10127 const utils$6 = utils$k;
10130 constructor(_settings) {
10131 this._settings = _settings;
10132 this._fsStatSettings = new fsStat$2.Settings({
10133 followSymbolicLink: this._settings.followSymbolicLinks,
10134 fs: this._settings.fs,
10135 throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
10139 _getFullEntryPath(filepath) {
10140 return path$4.resolve(this._settings.cwd, filepath);
10143 _makeEntry(stats, pattern) {
10147 dirent: utils$6.fs.createDirentFromStats(pattern, stats)
10150 if (this._settings.stats) {
10151 entry.stats = stats;
10157 _isFatalError(error) {
10158 return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
10163 reader.default = Reader;
10165 Object.defineProperty(stream$2, "__esModule", {
10168 const stream_1$3 = require$$0__default$3["default"];
10169 const fsStat$1 = out$3;
10170 const fsWalk$1 = out$2;
10171 const reader_1$1 = reader;
10173 class ReaderStream extends reader_1$1.default {
10175 super(...arguments);
10176 this._walkStream = fsWalk$1.walkStream;
10177 this._stat = fsStat$1.stat;
10180 dynamic(root, options) {
10181 return this._walkStream(root, options);
10184 static(patterns, options) {
10185 const filepaths = patterns.map(this._getFullEntryPath, this);
10186 const stream = new stream_1$3.PassThrough({
10190 stream._write = (index, _enc, done) => {
10191 return this._getEntry(filepaths[index], patterns[index], options).then(entry => {
10192 if (entry !== null && options.entryFilter(entry)) {
10193 stream.push(entry);
10196 if (index === filepaths.length - 1) {
10204 for (let i = 0; i < filepaths.length; i++) {
10211 _getEntry(filepath, pattern, options) {
10212 return this._getStat(filepath).then(stats => this._makeEntry(stats, pattern)).catch(error => {
10213 if (options.errorFilter(error)) {
10221 _getStat(filepath) {
10222 return new Promise((resolve, reject) => {
10223 this._stat(filepath, this._fsStatSettings, (error, stats) => {
10224 return error === null ? resolve(stats) : reject(error);
10231 stream$2.default = ReaderStream;
10241 Object.defineProperty(matcher, "__esModule", {
10244 const utils$5 = utils$k;
10247 constructor(_patterns, _settings, _micromatchOptions) {
10248 this._patterns = _patterns;
10249 this._settings = _settings;
10250 this._micromatchOptions = _micromatchOptions;
10251 this._storage = [];
10253 this._fillStorage();
10258 * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level).
10259 * So, before expand patterns with brace expansion into separated patterns.
10261 const patterns = utils$5.pattern.expandPatternsWithBraceExpansion(this._patterns);
10263 for (const pattern of patterns) {
10264 const segments = this._getPatternSegments(pattern);
10266 const sections = this._splitSegmentsIntoSections(segments);
10268 this._storage.push({
10269 complete: sections.length <= 1,
10277 _getPatternSegments(pattern) {
10278 const parts = utils$5.pattern.getPatternParts(pattern, this._micromatchOptions);
10279 return parts.map(part => {
10280 const dynamic = utils$5.pattern.isDynamicPattern(part, this._settings);
10292 patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
10297 _splitSegmentsIntoSections(segments) {
10298 return utils$5.array.splitWhen(segments, segment => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
10303 matcher.default = Matcher;
10305 Object.defineProperty(partial, "__esModule", {
10308 const matcher_1 = matcher;
10310 class PartialMatcher extends matcher_1.default {
10312 const parts = filepath.split('/');
10313 const levels = parts.length;
10315 const patterns = this._storage.filter(info => !info.complete || info.segments.length > levels);
10317 for (const pattern of patterns) {
10318 const section = pattern.sections[0];
10320 * In this case, the pattern has a globstar and we must read all directories unconditionally,
10321 * but only if the level has reached the end of the first group.
10323 * fixtures/{a,b}/**
10324 * ^ true/false ^ always true
10327 if (!pattern.complete && levels > section.length) {
10331 const match = parts.every((part, index) => {
10332 const segment = pattern.segments[index];
10334 if (segment.dynamic && segment.patternRe.test(part)) {
10338 if (!segment.dynamic && segment.pattern === part) {
10355 partial.default = PartialMatcher;
10357 Object.defineProperty(deep, "__esModule", {
10360 const utils$4 = utils$k;
10361 const partial_1 = partial;
10364 constructor(_settings, _micromatchOptions) {
10365 this._settings = _settings;
10366 this._micromatchOptions = _micromatchOptions;
10369 getFilter(basePath, positive, negative) {
10370 const matcher = this._getMatcher(positive);
10372 const negativeRe = this._getNegativePatternsRe(negative);
10374 return entry => this._filter(basePath, entry, matcher, negativeRe);
10377 _getMatcher(patterns) {
10378 return new partial_1.default(patterns, this._settings, this._micromatchOptions);
10381 _getNegativePatternsRe(patterns) {
10382 const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
10383 return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
10386 _filter(basePath, entry, matcher, negativeRe) {
10387 if (this._isSkippedByDeep(basePath, entry.path)) {
10391 if (this._isSkippedSymbolicLink(entry)) {
10395 const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
10397 if (this._isSkippedByPositivePatterns(filepath, matcher)) {
10401 return this._isSkippedByNegativePatterns(filepath, negativeRe);
10404 _isSkippedByDeep(basePath, entryPath) {
10406 * Avoid unnecessary depth calculations when it doesn't matter.
10408 if (this._settings.deep === Infinity) {
10412 return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
10415 _getEntryLevel(basePath, entryPath) {
10416 const entryPathDepth = entryPath.split('/').length;
10418 if (basePath === '') {
10419 return entryPathDepth;
10422 const basePathDepth = basePath.split('/').length;
10423 return entryPathDepth - basePathDepth;
10426 _isSkippedSymbolicLink(entry) {
10427 return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
10430 _isSkippedByPositivePatterns(entryPath, matcher) {
10431 return !this._settings.baseNameMatch && !matcher.match(entryPath);
10434 _isSkippedByNegativePatterns(entryPath, patternsRe) {
10435 return !utils$4.pattern.matchAny(entryPath, patternsRe);
10440 deep.default = DeepFilter;
10444 Object.defineProperty(entry$1, "__esModule", {
10447 const utils$3 = utils$k;
10449 class EntryFilter {
10450 constructor(_settings, _micromatchOptions) {
10451 this._settings = _settings;
10452 this._micromatchOptions = _micromatchOptions;
10453 this.index = new Map();
10456 getFilter(positive, negative) {
10457 const positiveRe = utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions);
10458 const negativeRe = utils$3.pattern.convertPatternsToRe(negative, this._micromatchOptions);
10459 return entry => this._filter(entry, positiveRe, negativeRe);
10462 _filter(entry, positiveRe, negativeRe) {
10463 if (this._settings.unique && this._isDuplicateEntry(entry)) {
10467 if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
10471 if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
10475 const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
10476 const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
10478 if (this._settings.unique && isMatched) {
10479 this._createIndexRecord(entry);
10485 _isDuplicateEntry(entry) {
10486 return this.index.has(entry.path);
10489 _createIndexRecord(entry) {
10490 this.index.set(entry.path, undefined);
10493 _onlyFileFilter(entry) {
10494 return this._settings.onlyFiles && !entry.dirent.isFile();
10497 _onlyDirectoryFilter(entry) {
10498 return this._settings.onlyDirectories && !entry.dirent.isDirectory();
10501 _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
10502 if (!this._settings.absolute) {
10506 const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, entryPath);
10507 return utils$3.pattern.matchAny(fullpath, patternsRe);
10510 _isMatchToPatterns(entryPath, patternsRe) {
10511 const filepath = utils$3.path.removeLeadingDotSegment(entryPath);
10512 return utils$3.pattern.matchAny(filepath, patternsRe);
10517 entry$1.default = EntryFilter;
10521 Object.defineProperty(error, "__esModule", {
10524 const utils$2 = utils$k;
10526 class ErrorFilter {
10527 constructor(_settings) {
10528 this._settings = _settings;
10532 return error => this._isNonFatalError(error);
10535 _isNonFatalError(error) {
10536 return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
10541 error.default = ErrorFilter;
10545 Object.defineProperty(entry, "__esModule", {
10548 const utils$1 = utils$k;
10550 class EntryTransformer {
10551 constructor(_settings) {
10552 this._settings = _settings;
10556 return entry => this._transform(entry);
10559 _transform(entry) {
10560 let filepath = entry.path;
10562 if (this._settings.absolute) {
10563 filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
10564 filepath = utils$1.path.unixify(filepath);
10567 if (this._settings.markDirectories && entry.dirent.isDirectory()) {
10571 if (!this._settings.objectMode) {
10575 return Object.assign(Object.assign({}, entry), {
10582 entry.default = EntryTransformer;
10584 Object.defineProperty(provider, "__esModule", {
10587 const path$3 = require$$0__default$1["default"];
10588 const deep_1 = deep;
10589 const entry_1 = entry$1;
10590 const error_1 = error;
10591 const entry_2 = entry;
10594 constructor(_settings) {
10595 this._settings = _settings;
10596 this.errorFilter = new error_1.default(this._settings);
10597 this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
10598 this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
10599 this.entryTransformer = new entry_2.default(this._settings);
10602 _getRootDirectory(task) {
10603 return path$3.resolve(this._settings.cwd, task.base);
10606 _getReaderOptions(task) {
10607 const basePath = task.base === '.' ? '' : task.base;
10610 pathSegmentSeparator: '/',
10611 concurrency: this._settings.concurrency,
10612 deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
10613 entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
10614 errorFilter: this.errorFilter.getFilter(),
10615 followSymbolicLinks: this._settings.followSymbolicLinks,
10616 fs: this._settings.fs,
10617 stats: this._settings.stats,
10618 throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
10619 transform: this.entryTransformer.getTransformer()
10623 _getMicromatchOptions() {
10625 dot: this._settings.dot,
10626 matchBase: this._settings.baseNameMatch,
10627 nobrace: !this._settings.braceExpansion,
10628 nocase: !this._settings.caseSensitiveMatch,
10629 noext: !this._settings.extglob,
10630 noglobstar: !this._settings.globstar,
10632 strictSlashes: false
10638 provider.default = Provider;
10640 Object.defineProperty(async$6, "__esModule", {
10643 const stream_1$2 = stream$2;
10644 const provider_1$2 = provider;
10646 class ProviderAsync extends provider_1$2.default {
10648 super(...arguments);
10649 this._reader = new stream_1$2.default(this._settings);
10653 const root = this._getRootDirectory(task);
10655 const options = this._getReaderOptions(task);
10657 const entries = [];
10658 return new Promise((resolve, reject) => {
10659 const stream = this.api(root, task, options);
10660 stream.once('error', reject);
10661 stream.on('data', entry => entries.push(options.transform(entry)));
10662 stream.once('end', () => resolve(entries));
10666 api(root, task, options) {
10667 if (task.dynamic) {
10668 return this._reader.dynamic(root, options);
10671 return this._reader.static(task.patterns, options);
10676 async$6.default = ProviderAsync;
10680 Object.defineProperty(stream, "__esModule", {
10683 const stream_1$1 = require$$0__default$3["default"];
10684 const stream_2 = stream$2;
10685 const provider_1$1 = provider;
10687 class ProviderStream extends provider_1$1.default {
10689 super(...arguments);
10690 this._reader = new stream_2.default(this._settings);
10694 const root = this._getRootDirectory(task);
10696 const options = this._getReaderOptions(task);
10698 const source = this.api(root, task, options);
10699 const destination = new stream_1$1.Readable({
10703 source.once('error', error => destination.emit('error', error)).on('data', entry => destination.emit('data', options.transform(entry))).once('end', () => destination.emit('end'));
10704 destination.once('close', () => source.destroy());
10705 return destination;
10708 api(root, task, options) {
10709 if (task.dynamic) {
10710 return this._reader.dynamic(root, options);
10713 return this._reader.static(task.patterns, options);
10718 stream.default = ProviderStream;
10724 Object.defineProperty(sync, "__esModule", {
10727 const fsStat = out$3;
10728 const fsWalk = out$2;
10729 const reader_1 = reader;
10731 class ReaderSync extends reader_1.default {
10733 super(...arguments);
10734 this._walkSync = fsWalk.walkSync;
10735 this._statSync = fsStat.statSync;
10738 dynamic(root, options) {
10739 return this._walkSync(root, options);
10742 static(patterns, options) {
10743 const entries = [];
10745 for (const pattern of patterns) {
10746 const filepath = this._getFullEntryPath(pattern);
10748 const entry = this._getEntry(filepath, pattern, options);
10750 if (entry === null || !options.entryFilter(entry)) {
10754 entries.push(entry);
10760 _getEntry(filepath, pattern, options) {
10762 const stats = this._getStat(filepath);
10764 return this._makeEntry(stats, pattern);
10766 if (options.errorFilter(error)) {
10774 _getStat(filepath) {
10775 return this._statSync(filepath, this._fsStatSettings);
10780 sync.default = ReaderSync;
10782 Object.defineProperty(sync$1, "__esModule", {
10785 const sync_1$1 = sync;
10786 const provider_1 = provider;
10788 class ProviderSync extends provider_1.default {
10790 super(...arguments);
10791 this._reader = new sync_1$1.default(this._settings);
10795 const root = this._getRootDirectory(task);
10797 const options = this._getReaderOptions(task);
10799 const entries = this.api(root, task, options);
10800 return entries.map(options.transform);
10803 api(root, task, options) {
10804 if (task.dynamic) {
10805 return this._reader.dynamic(root, options);
10808 return this._reader.static(task.patterns, options);
10813 sync$1.default = ProviderSync;
10817 (function (exports) {
10819 Object.defineProperty(exports, "__esModule", {
10822 exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
10823 const fs = require$$0__default$4["default"];
10824 const os = require$$0__default["default"];
10826 * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
10827 * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
10830 const CPU_COUNT = Math.max(os.cpus().length, 1);
10831 exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
10833 lstatSync: fs.lstatSync,
10835 statSync: fs.statSync,
10836 readdir: fs.readdir,
10837 readdirSync: fs.readdirSync
10841 constructor(_options = {}) {
10842 this._options = _options;
10843 this.absolute = this._getValue(this._options.absolute, false);
10844 this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
10845 this.braceExpansion = this._getValue(this._options.braceExpansion, true);
10846 this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
10847 this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
10848 this.cwd = this._getValue(this._options.cwd, process.cwd());
10849 this.deep = this._getValue(this._options.deep, Infinity);
10850 this.dot = this._getValue(this._options.dot, false);
10851 this.extglob = this._getValue(this._options.extglob, true);
10852 this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
10853 this.fs = this._getFileSystemMethods(this._options.fs);
10854 this.globstar = this._getValue(this._options.globstar, true);
10855 this.ignore = this._getValue(this._options.ignore, []);
10856 this.markDirectories = this._getValue(this._options.markDirectories, false);
10857 this.objectMode = this._getValue(this._options.objectMode, false);
10858 this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
10859 this.onlyFiles = this._getValue(this._options.onlyFiles, true);
10860 this.stats = this._getValue(this._options.stats, false);
10861 this.suppressErrors = this._getValue(this._options.suppressErrors, false);
10862 this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
10863 this.unique = this._getValue(this._options.unique, true);
10865 if (this.onlyDirectories) {
10866 this.onlyFiles = false;
10870 this.objectMode = true;
10874 _getValue(option, value) {
10875 return option === undefined ? value : option;
10878 _getFileSystemMethods(methods = {}) {
10879 return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
10884 exports.default = Settings;
10887 const taskManager = tasks;
10888 const async_1 = async$6;
10889 const stream_1 = stream;
10890 const sync_1 = sync$1;
10891 const settings_1 = settings;
10892 const utils = utils$k;
10894 async function FastGlob(source, options) {
10895 assertPatternsInput(source);
10896 const works = getWorks(source, async_1.default, options);
10897 const result = await Promise.all(works);
10898 return utils.array.flatten(result);
10899 } // https://github.com/typescript-eslint/typescript-eslint/issues/60
10900 // eslint-disable-next-line no-redeclare
10903 (function (FastGlob) {
10904 function sync(source, options) {
10905 assertPatternsInput(source);
10906 const works = getWorks(source, sync_1.default, options);
10907 return utils.array.flatten(works);
10910 FastGlob.sync = sync;
10912 function stream(source, options) {
10913 assertPatternsInput(source);
10914 const works = getWorks(source, stream_1.default, options);
10916 * The stream returned by the provider cannot work with an asynchronous iterator.
10917 * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
10918 * This affects performance (+25%). I don't see best solution right now.
10921 return utils.stream.merge(works);
10924 FastGlob.stream = stream;
10926 function generateTasks(source, options) {
10927 assertPatternsInput(source);
10928 const patterns = [].concat(source);
10929 const settings = new settings_1.default(options);
10930 return taskManager.generate(patterns, settings);
10933 FastGlob.generateTasks = generateTasks;
10935 function isDynamicPattern(source, options) {
10936 assertPatternsInput(source);
10937 const settings = new settings_1.default(options);
10938 return utils.pattern.isDynamicPattern(source, settings);
10941 FastGlob.isDynamicPattern = isDynamicPattern;
10943 function escapePath(source) {
10944 assertPatternsInput(source);
10945 return utils.path.escape(source);
10948 FastGlob.escapePath = escapePath;
10949 })(FastGlob || (FastGlob = {}));
10951 function getWorks(source, _Provider, options) {
10952 const patterns = [].concat(source);
10953 const settings = new settings_1.default(options);
10954 const tasks = taskManager.generate(patterns, settings);
10955 const provider = new _Provider(settings);
10956 return tasks.map(provider.read, provider);
10959 function assertPatternsInput(input) {
10960 const source = [].concat(input);
10961 const isValidSource = source.every(item => utils.string.isString(item) && !utils.string.isEmpty(item));
10963 if (!isValidSource) {
10964 throw new TypeError('Patterns must be a string (non empty) or an array of strings');
10968 var out = FastGlob;
10970 const path$2 = require$$0__default$1["default"];
10973 } = require$$0__default$4["default"];
10974 const fastGlob = out;
10975 /** @typedef {import('./context').Context} Context */
10978 * @param {Context} context
10981 async function* expandPatterns$1(context) {
10982 const cwd = process.cwd();
10983 const seen = new Set();
10984 let noResults = true;
10986 for await (const pathOrError of expandPatternsInternal(context)) {
10989 if (typeof pathOrError !== "string") {
10994 const relativePath = path$2.relative(cwd, pathOrError); // filter out duplicates
10996 if (seen.has(relativePath)) {
11000 seen.add(relativePath);
11001 yield relativePath;
11004 if (noResults && context.argv["error-on-unmatched-pattern"] !== false) {
11005 // If there was no files and no other errors, let's yield a general error.
11007 error: `No matching files. Patterns: ${context.filePatterns.join(" ")}`
11012 * @param {Context} context
11016 async function* expandPatternsInternal(context) {
11017 // Ignores files in version control systems directories and `node_modules`
11018 const silentlyIgnoredDirs = [".git", ".svn", ".hg"];
11020 if (context.argv["with-node-modules"] !== true) {
11021 silentlyIgnoredDirs.push("node_modules");
11024 const globOptions = {
11026 ignore: silentlyIgnoredDirs.map(dir => "**/" + dir)
11028 let supportedFilesGlob;
11029 const cwd = process.cwd();
11030 /** @type {Array<{ type: 'file' | 'dir' | 'glob'; glob: string; input: string; }>} */
11032 const entries = [];
11034 for (const pattern of context.filePatterns) {
11035 const absolutePath = path$2.resolve(cwd, pattern);
11037 if (containsIgnoredPathSegment(absolutePath, cwd, silentlyIgnoredDirs)) {
11041 const stat = await statSafe(absolutePath);
11044 if (stat.isFile()) {
11047 glob: escapePathForGlob(fixWindowsSlashes$1(pattern)),
11050 } else if (stat.isDirectory()) {
11052 1. Remove trailing `/`, `fast-glob` can't find files for `src//*.js` pattern
11053 2. Cleanup dirname, when glob `src/../*.js` pattern with `fast-glob`,
11054 it returns files like 'src/../index.js'
11056 const relativePath = path$2.relative(cwd, absolutePath) || ".";
11059 glob: escapePathForGlob(fixWindowsSlashes$1(relativePath)) + "/" + getSupportedFilesGlob(),
11063 } else if (pattern[0] === "!") {
11064 // convert negative patterns to `ignore` entries
11065 globOptions.ignore.push(fixWindowsSlashes$1(pattern.slice(1)));
11069 glob: fixWindowsSlashes$1(pattern),
11083 result = await fastGlob(glob, globOptions);
11087 /* istanbul ignore next */
11089 error: `${errorMessages.globError[type]}: ${input}\n${message}`
11091 /* istanbul ignore next */
11096 if (result.length === 0) {
11097 if (context.argv["error-on-unmatched-pattern"] !== false) {
11099 error: `${errorMessages.emptyResults[type]}: "${input}".`
11103 yield* sortPaths(result);
11107 function getSupportedFilesGlob() {
11108 if (!supportedFilesGlob) {
11109 const extensions = context.languages.flatMap(lang => lang.extensions || []);
11110 const filenames = context.languages.flatMap(lang => lang.filenames || []);
11111 supportedFilesGlob = `**/{${[...extensions.map(ext => "*" + (ext[0] === "." ? ext : "." + ext)), ...filenames]}}`;
11114 return supportedFilesGlob;
11118 const errorMessages = {
11120 file: "Unable to resolve file",
11121 dir: "Unable to expand directory",
11122 glob: "Unable to expand glob pattern"
11125 file: "Explicitly specified file was ignored due to negative glob patterns",
11126 dir: "No supported files were found in the directory",
11127 glob: "No files matching the pattern were found"
11131 * @param {string} absolutePath
11132 * @param {string} cwd
11133 * @param {string[]} ignoredDirectories
11136 function containsIgnoredPathSegment(absolutePath, cwd, ignoredDirectories) {
11137 return path$2.relative(cwd, absolutePath).split(path$2.sep).some(dir => ignoredDirectories.includes(dir));
11140 * @param {string[]} paths
11144 function sortPaths(paths) {
11145 return paths.sort((a, b) => a.localeCompare(b));
11148 * Get stats of a given path.
11149 * @param {string} filePath The path to target file.
11150 * @returns {Promise<import('fs').Stats | undefined>} The stats.
11154 async function statSafe(filePath) {
11156 return await fs$1.stat(filePath);
11158 /* istanbul ignore next */
11159 if (error.code !== "ENOENT") {
11165 * This function should be replaced with `fastGlob.escapePath` when these issues are fixed:
11166 * - https://github.com/mrmlnc/fast-glob/issues/261
11167 * - https://github.com/mrmlnc/fast-glob/issues/262
11168 * @param {string} path
11172 function escapePathForGlob(path) {
11173 return fastGlob.escapePath(path.replace(/\\/g, "\0") // Workaround for fast-glob#262 (part 1)
11174 ).replace(/\\!/g, "@(!)") // Workaround for fast-glob#261
11175 .replace(/\0/g, "@(\\\\)"); // Workaround for fast-glob#262 (part 2)
11178 const isWindows = path$2.sep === "\\";
11180 * Using backslashes in globs is probably not okay, but not accepting
11181 * backslashes as path separators on Windows is even more not okay.
11182 * https://github.com/prettier/prettier/pull/6776#discussion_r380723717
11183 * https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows
11184 * @param {string} pattern
11187 function fixWindowsSlashes$1(pattern) {
11188 return isWindows ? pattern.replace(/\\/g, "/") : pattern;
11191 var expandPatterns_1 = {
11192 expandPatterns: expandPatterns$1,
11193 fixWindowsSlashes: fixWindowsSlashes$1
11196 var iterators = {};
11198 var wellKnownSymbol$2 = wellKnownSymbol$7;
11199 var Iterators$1 = iterators;
11201 var ITERATOR$1 = wellKnownSymbol$2('iterator');
11202 var ArrayPrototype$1 = Array.prototype;
11204 // check on default Array iterator
11205 var isArrayIteratorMethod$1 = function (it) {
11206 return it !== undefined && (Iterators$1.Array === it || ArrayPrototype$1[ITERATOR$1] === it);
11209 var classof = classof$4;
11210 var getMethod$1 = getMethod$3;
11211 var Iterators = iterators;
11212 var wellKnownSymbol$1 = wellKnownSymbol$7;
11214 var ITERATOR = wellKnownSymbol$1('iterator');
11216 var getIteratorMethod$2 = function (it) {
11217 if (it != undefined) return getMethod$1(it, ITERATOR)
11218 || getMethod$1(it, '@@iterator')
11219 || Iterators[classof(it)];
11222 var global$2 = global$r;
11223 var call$2 = functionCall;
11224 var aCallable = aCallable$5;
11225 var anObject$4 = anObject$7;
11226 var tryToString$1 = tryToString$3;
11227 var getIteratorMethod$1 = getIteratorMethod$2;
11229 var TypeError$2 = global$2.TypeError;
11231 var getIterator$1 = function (argument, usingIterator) {
11232 var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
11233 if (aCallable(iteratorMethod)) return anObject$4(call$2(iteratorMethod, argument));
11234 throw TypeError$2(tryToString$1(argument) + ' is not iterable');
11237 var call$1 = functionCall;
11238 var anObject$3 = anObject$7;
11239 var getMethod = getMethod$3;
11241 var iteratorClose$1 = function (iterator, kind, value) {
11242 var innerResult, innerError;
11243 anObject$3(iterator);
11245 innerResult = getMethod(iterator, 'return');
11246 if (!innerResult) {
11247 if (kind === 'throw') throw value;
11250 innerResult = call$1(innerResult, iterator);
11253 innerResult = error;
11255 if (kind === 'throw') throw value;
11256 if (innerError) throw innerResult;
11257 anObject$3(innerResult);
11261 var global$1 = global$r;
11262 var bind = functionBindContext;
11263 var call = functionCall;
11264 var anObject$2 = anObject$7;
11265 var tryToString = tryToString$3;
11266 var isArrayIteratorMethod = isArrayIteratorMethod$1;
11267 var lengthOfArrayLike$1 = lengthOfArrayLike$6;
11268 var isPrototypeOf = objectIsPrototypeOf;
11269 var getIterator = getIterator$1;
11270 var getIteratorMethod = getIteratorMethod$2;
11271 var iteratorClose = iteratorClose$1;
11273 var TypeError$1 = global$1.TypeError;
11275 var Result = function (stopped, result) {
11276 this.stopped = stopped;
11277 this.result = result;
11280 var ResultPrototype = Result.prototype;
11282 var iterate$1 = function (iterable, unboundFunction, options) {
11283 var that = options && options.that;
11284 var AS_ENTRIES = !!(options && options.AS_ENTRIES);
11285 var IS_ITERATOR = !!(options && options.IS_ITERATOR);
11286 var INTERRUPTED = !!(options && options.INTERRUPTED);
11287 var fn = bind(unboundFunction, that);
11288 var iterator, iterFn, index, length, result, next, step;
11290 var stop = function (condition) {
11291 if (iterator) iteratorClose(iterator, 'normal', condition);
11292 return new Result(true, condition);
11295 var callFn = function (value) {
11298 return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
11299 } return INTERRUPTED ? fn(value, stop) : fn(value);
11303 iterator = iterable;
11305 iterFn = getIteratorMethod(iterable);
11306 if (!iterFn) throw TypeError$1(tryToString(iterable) + ' is not iterable');
11307 // optimisation for array iterators
11308 if (isArrayIteratorMethod(iterFn)) {
11309 for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
11310 result = callFn(iterable[index]);
11311 if (result && isPrototypeOf(ResultPrototype, result)) return result;
11312 } return new Result(false);
11314 iterator = getIterator(iterable, iterFn);
11317 next = iterator.next;
11318 while (!(step = call(next, iterator)).done) {
11320 result = callFn(step.value);
11322 iteratorClose(iterator, 'throw', error);
11324 if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
11325 } return new Result(false);
11328 var toPropertyKey = toPropertyKey$3;
11329 var definePropertyModule$2 = objectDefineProperty;
11330 var createPropertyDescriptor = createPropertyDescriptor$3;
11332 var createProperty$1 = function (object, key, value) {
11333 var propertyKey = toPropertyKey(key);
11334 if (propertyKey in object) definePropertyModule$2.f(object, propertyKey, createPropertyDescriptor(0, value));
11335 else object[propertyKey] = value;
11339 var iterate = iterate$1;
11340 var createProperty = createProperty$1;
11342 // `Object.fromEntries` method
11343 // https://github.com/tc39/proposal-object-from-entries
11344 $$1({ target: 'Object', stat: true }, {
11345 fromEntries: function fromEntries(iterable) {
11347 iterate(iterable, function (k, v) {
11348 createProperty(obj, k, v);
11349 }, { AS_ENTRIES: true });
11355 * dashify <https://github.com/jonschlinkert/dashify>
11357 * Copyright (c) 2015-2017, Jon Schlinkert.
11358 * Released under the MIT License.
11361 var dashify$2 = (str, options) => {
11362 if (typeof str !== 'string') throw new TypeError('expected a string');
11363 return str.trim().replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\W/g, m => /[À-ž]/.test(m) ? m : '-').replace(/^-+|-+$/g, '').replace(/-{2,}/g, m => options && options.condense ? '-' : m).toLowerCase();
11366 var minimist$3 = function (args, opts) {
11367 if (!opts) opts = {};
11374 if (typeof opts['unknown'] === 'function') {
11375 flags.unknownFn = opts['unknown'];
11378 if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
11379 flags.allBools = true;
11381 [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
11382 flags.bools[key] = true;
11387 Object.keys(opts.alias || {}).forEach(function (key) {
11388 aliases[key] = [].concat(opts.alias[key]);
11389 aliases[key].forEach(function (x) {
11390 aliases[x] = [key].concat(aliases[key].filter(function (y) {
11395 [].concat(opts.string).filter(Boolean).forEach(function (key) {
11396 flags.strings[key] = true;
11398 if (aliases[key]) {
11399 flags.strings[aliases[key]] = true;
11402 var defaults = opts['default'] || {};
11406 Object.keys(flags.bools).forEach(function (key) {
11407 setArg(key, defaults[key] === undefined ? false : defaults[key]);
11411 if (args.indexOf('--') !== -1) {
11412 notFlags = args.slice(args.indexOf('--') + 1);
11413 args = args.slice(0, args.indexOf('--'));
11416 function argDefined(key, arg) {
11417 return flags.allBools && /^--[^=]+$/.test(arg) || flags.strings[key] || flags.bools[key] || aliases[key];
11420 function setArg(key, val, arg) {
11421 if (arg && flags.unknownFn && !argDefined(key, arg)) {
11422 if (flags.unknownFn(arg) === false) return;
11425 var value = !flags.strings[key] && isNumber(val) ? Number(val) : val;
11426 setKey(argv, key.split('.'), value);
11427 (aliases[key] || []).forEach(function (x) {
11428 setKey(argv, x.split('.'), value);
11432 function setKey(obj, keys, value) {
11435 for (var i = 0; i < keys.length - 1; i++) {
11437 if (key === '__proto__') return;
11438 if (o[key] === undefined) o[key] = {};
11439 if (o[key] === Object.prototype || o[key] === Number.prototype || o[key] === String.prototype) o[key] = {};
11440 if (o[key] === Array.prototype) o[key] = [];
11444 var key = keys[keys.length - 1];
11445 if (key === '__proto__') return;
11446 if (o === Object.prototype || o === Number.prototype || o === String.prototype) o = {};
11447 if (o === Array.prototype) o = [];
11449 if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
11451 } else if (Array.isArray(o[key])) {
11452 o[key].push(value);
11454 o[key] = [o[key], value];
11458 function aliasIsBoolean(key) {
11459 return aliases[key].some(function (x) {
11460 return flags.bools[x];
11464 for (var i = 0; i < args.length; i++) {
11467 if (/^--.+=/.test(arg)) {
11468 // Using [\s\S] instead of . because js doesn't support the
11469 // 'dotall' regex modifier. See:
11470 // http://stackoverflow.com/a/1068308/13216
11471 var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
11475 if (flags.bools[key]) {
11476 value = value !== 'false';
11479 setArg(key, value, arg);
11480 } else if (/^--no-.+/.test(arg)) {
11481 var key = arg.match(/^--no-(.+)/)[1];
11482 setArg(key, false, arg);
11483 } else if (/^--.+/.test(arg)) {
11484 var key = arg.match(/^--(.+)/)[1];
11485 var next = args[i + 1];
11487 if (next !== undefined && !/^-/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
11488 setArg(key, next, arg);
11490 } else if (/^(true|false)$/.test(next)) {
11491 setArg(key, next === 'true', arg);
11494 setArg(key, flags.strings[key] ? '' : true, arg);
11496 } else if (/^-[^-]+/.test(arg)) {
11497 var letters = arg.slice(1, -1).split('');
11498 var broken = false;
11500 for (var j = 0; j < letters.length; j++) {
11501 var next = arg.slice(j + 2);
11503 if (next === '-') {
11504 setArg(letters[j], next, arg);
11508 if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
11509 setArg(letters[j], next.split('=')[1], arg);
11514 if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
11515 setArg(letters[j], next, arg);
11520 if (letters[j + 1] && letters[j + 1].match(/\W/)) {
11521 setArg(letters[j], arg.slice(j + 2), arg);
11525 setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
11529 var key = arg.slice(-1)[0];
11531 if (!broken && key !== '-') {
11532 if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
11533 setArg(key, args[i + 1], arg);
11535 } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
11536 setArg(key, args[i + 1] === 'true', arg);
11539 setArg(key, flags.strings[key] ? '' : true, arg);
11543 if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
11544 argv._.push(flags.strings['_'] || !isNumber(arg) ? arg : Number(arg));
11547 if (opts.stopEarly) {
11548 argv._.push.apply(argv._, args.slice(i + 1));
11555 Object.keys(defaults).forEach(function (key) {
11556 if (!hasKey(argv, key.split('.'))) {
11557 setKey(argv, key.split('.'), defaults[key]);
11558 (aliases[key] || []).forEach(function (x) {
11559 setKey(argv, x.split('.'), defaults[key]);
11565 argv['--'] = new Array();
11566 notFlags.forEach(function (key) {
11567 argv['--'].push(key);
11570 notFlags.forEach(function (key) {
11578 function hasKey(obj, keys) {
11580 keys.slice(0, -1).forEach(function (key) {
11583 var key = keys[keys.length - 1];
11587 function isNumber(x) {
11588 if (typeof x === 'number') return true;
11589 if (/^0x[0-9a-f]+$/i.test(x)) return true;
11590 return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
11593 const minimist$2 = minimist$3;
11594 const PLACEHOLDER = null;
11596 * unspecified boolean flag without default value is parsed as `undefined` instead of `false`
11599 var minimist_1 = function (args, options) {
11600 const boolean = options.boolean || [];
11601 const defaults = options.default || {};
11602 const booleanWithoutDefault = boolean.filter(key => !(key in defaults));
11603 const newDefaults = Object.assign(Object.assign({}, defaults), Object.fromEntries(booleanWithoutDefault.map(key => [key, PLACEHOLDER])));
11604 const parsed = minimist$2(args, Object.assign(Object.assign({}, options), {}, {
11605 default: newDefaults
11607 return Object.fromEntries(Object.entries(parsed).filter(([, value]) => value !== PLACEHOLDER));
11611 * A specialized version of `baseAggregator` for arrays.
11614 * @param {Array} [array] The array to iterate over.
11615 * @param {Function} setter The function to set `accumulator` values.
11616 * @param {Function} iteratee The iteratee to transform keys.
11617 * @param {Object} accumulator The initial aggregated object.
11618 * @returns {Function} Returns `accumulator`.
11621 function arrayAggregator$1(array, setter, iteratee, accumulator) {
11623 length = array == null ? 0 : array.length;
11625 while (++index < length) {
11626 var value = array[index];
11627 setter(accumulator, value, iteratee(value), array);
11630 return accumulator;
11633 var _arrayAggregator = arrayAggregator$1;
11636 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
11639 * @param {boolean} [fromRight] Specify iterating from right to left.
11640 * @returns {Function} Returns the new base function.
11643 function createBaseFor$1(fromRight) {
11644 return function (object, iteratee, keysFunc) {
11646 iterable = Object(object),
11647 props = keysFunc(object),
11648 length = props.length;
11651 var key = props[fromRight ? length : ++index];
11653 if (iteratee(iterable[key], key, iterable) === false) {
11662 var _createBaseFor = createBaseFor$1;
11664 var createBaseFor = _createBaseFor;
11666 * The base implementation of `baseForOwn` which iterates over `object`
11667 * properties returned by `keysFunc` and invokes `iteratee` for each property.
11668 * Iteratee functions may exit iteration early by explicitly returning `false`.
11671 * @param {Object} object The object to iterate over.
11672 * @param {Function} iteratee The function invoked per iteration.
11673 * @param {Function} keysFunc The function to get the keys of `object`.
11674 * @returns {Object} Returns `object`.
11677 var baseFor$1 = createBaseFor();
11678 var _baseFor = baseFor$1;
11681 * The base implementation of `_.times` without support for iteratee shorthands
11682 * or max array length checks.
11685 * @param {number} n The number of times to invoke `iteratee`.
11686 * @param {Function} iteratee The function invoked per iteration.
11687 * @returns {Array} Returns the array of results.
11690 function baseTimes$1(n, iteratee) {
11694 while (++index < n) {
11695 result[index] = iteratee(index);
11701 var _baseTimes = baseTimes$1;
11703 /** Detect free variable `global` from Node.js. */
11704 var freeGlobal$1 = typeof global == 'object' && global && global.Object === Object && global;
11705 var _freeGlobal = freeGlobal$1;
11707 var freeGlobal = _freeGlobal;
11708 /** Detect free variable `self`. */
11710 var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
11711 /** Used as a reference to the global object. */
11713 var root$8 = freeGlobal || freeSelf || Function('return this')();
11714 var _root = root$8;
11716 var root$7 = _root;
11717 /** Built-in value references. */
11719 var Symbol$6 = root$7.Symbol;
11720 var _Symbol = Symbol$6;
11722 var Symbol$5 = _Symbol;
11723 /** Used for built-in method references. */
11725 var objectProto$d = Object.prototype;
11726 /** Used to check objects for own properties. */
11728 var hasOwnProperty$a = objectProto$d.hasOwnProperty;
11730 * Used to resolve the
11731 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
11735 var nativeObjectToString$1 = objectProto$d.toString;
11736 /** Built-in value references. */
11738 var symToStringTag$1 = Symbol$5 ? Symbol$5.toStringTag : undefined;
11740 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
11743 * @param {*} value The value to query.
11744 * @returns {string} Returns the raw `toStringTag`.
11747 function getRawTag$1(value) {
11748 var isOwn = hasOwnProperty$a.call(value, symToStringTag$1),
11749 tag = value[symToStringTag$1];
11752 value[symToStringTag$1] = undefined;
11753 var unmasked = true;
11756 var result = nativeObjectToString$1.call(value);
11760 value[symToStringTag$1] = tag;
11762 delete value[symToStringTag$1];
11769 var _getRawTag = getRawTag$1;
11771 /** Used for built-in method references. */
11772 var objectProto$c = Object.prototype;
11774 * Used to resolve the
11775 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
11779 var nativeObjectToString = objectProto$c.toString;
11781 * Converts `value` to a string using `Object.prototype.toString`.
11784 * @param {*} value The value to convert.
11785 * @returns {string} Returns the converted string.
11788 function objectToString$1(value) {
11789 return nativeObjectToString.call(value);
11792 var _objectToString = objectToString$1;
11794 var Symbol$4 = _Symbol,
11795 getRawTag = _getRawTag,
11796 objectToString = _objectToString;
11797 /** `Object#toString` result references. */
11799 var nullTag = '[object Null]',
11800 undefinedTag = '[object Undefined]';
11801 /** Built-in value references. */
11803 var symToStringTag = Symbol$4 ? Symbol$4.toStringTag : undefined;
11805 * The base implementation of `getTag` without fallbacks for buggy environments.
11808 * @param {*} value The value to query.
11809 * @returns {string} Returns the `toStringTag`.
11812 function baseGetTag$5(value) {
11813 if (value == null) {
11814 return value === undefined ? undefinedTag : nullTag;
11817 return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
11820 var _baseGetTag = baseGetTag$5;
11823 * Checks if `value` is object-like. A value is object-like if it's not `null`
11824 * and has a `typeof` result of "object".
11830 * @param {*} value The value to check.
11831 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
11834 * _.isObjectLike({});
11837 * _.isObjectLike([1, 2, 3]);
11840 * _.isObjectLike(_.noop);
11843 * _.isObjectLike(null);
11847 function isObjectLike$5(value) {
11848 return value != null && typeof value == 'object';
11851 var isObjectLike_1 = isObjectLike$5;
11853 var baseGetTag$4 = _baseGetTag,
11854 isObjectLike$4 = isObjectLike_1;
11855 /** `Object#toString` result references. */
11857 var argsTag$2 = '[object Arguments]';
11859 * The base implementation of `_.isArguments`.
11862 * @param {*} value The value to check.
11863 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
11866 function baseIsArguments$1(value) {
11867 return isObjectLike$4(value) && baseGetTag$4(value) == argsTag$2;
11870 var _baseIsArguments = baseIsArguments$1;
11872 var baseIsArguments = _baseIsArguments,
11873 isObjectLike$3 = isObjectLike_1;
11874 /** Used for built-in method references. */
11876 var objectProto$b = Object.prototype;
11877 /** Used to check objects for own properties. */
11879 var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
11880 /** Built-in value references. */
11882 var propertyIsEnumerable$1 = objectProto$b.propertyIsEnumerable;
11884 * Checks if `value` is likely an `arguments` object.
11890 * @param {*} value The value to check.
11891 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
11895 * _.isArguments(function() { return arguments; }());
11898 * _.isArguments([1, 2, 3]);
11902 var isArguments$3 = baseIsArguments(function () {
11904 }()) ? baseIsArguments : function (value) {
11905 return isObjectLike$3(value) && hasOwnProperty$9.call(value, 'callee') && !propertyIsEnumerable$1.call(value, 'callee');
11907 var isArguments_1 = isArguments$3;
11910 * Checks if `value` is classified as an `Array` object.
11916 * @param {*} value The value to check.
11917 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
11920 * _.isArray([1, 2, 3]);
11923 * _.isArray(document.body.children);
11926 * _.isArray('abc');
11929 * _.isArray(_.noop);
11932 var isArray$a = Array.isArray;
11933 var isArray_1 = isArray$a;
11935 var isBuffer$2 = {exports: {}};
11938 * This method returns `false`.
11944 * @returns {boolean} Returns `false`.
11947 * _.times(2, _.stubFalse);
11948 * // => [false, false]
11951 function stubFalse() {
11955 var stubFalse_1 = stubFalse;
11957 (function (module, exports) {
11959 stubFalse = stubFalse_1;
11960 /** Detect free variable `exports`. */
11962 var freeExports = exports && !exports.nodeType && exports;
11963 /** Detect free variable `module`. */
11965 var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
11966 /** Detect the popular CommonJS extension `module.exports`. */
11968 var moduleExports = freeModule && freeModule.exports === freeExports;
11969 /** Built-in value references. */
11971 var Buffer = moduleExports ? root.Buffer : undefined;
11972 /* Built-in method references for those with the same name as other `lodash` methods. */
11974 var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
11976 * Checks if `value` is a buffer.
11982 * @param {*} value The value to check.
11983 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
11986 * _.isBuffer(new Buffer(2));
11989 * _.isBuffer(new Uint8Array(2));
11993 var isBuffer = nativeIsBuffer || stubFalse;
11994 module.exports = isBuffer;
11995 })(isBuffer$2, isBuffer$2.exports);
11997 /** Used as references for various `Number` constants. */
11998 var MAX_SAFE_INTEGER$1 = 9007199254740991;
11999 /** Used to detect unsigned integer values. */
12001 var reIsUint = /^(?:0|[1-9]\d*)$/;
12003 * Checks if `value` is a valid array-like index.
12006 * @param {*} value The value to check.
12007 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
12008 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
12011 function isIndex$3(value, length) {
12012 var type = typeof value;
12013 length = length == null ? MAX_SAFE_INTEGER$1 : length;
12014 return !!length && (type == 'number' || type != 'symbol' && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
12017 var _isIndex = isIndex$3;
12019 /** Used as references for various `Number` constants. */
12020 var MAX_SAFE_INTEGER = 9007199254740991;
12022 * Checks if `value` is a valid array-like length.
12024 * **Note:** This method is loosely based on
12025 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
12031 * @param {*} value The value to check.
12032 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
12038 * _.isLength(Number.MIN_VALUE);
12041 * _.isLength(Infinity);
12048 function isLength$3(value) {
12049 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
12052 var isLength_1 = isLength$3;
12054 var baseGetTag$3 = _baseGetTag,
12055 isLength$2 = isLength_1,
12056 isObjectLike$2 = isObjectLike_1;
12057 /** `Object#toString` result references. */
12059 var argsTag$1 = '[object Arguments]',
12060 arrayTag$1 = '[object Array]',
12061 boolTag$1 = '[object Boolean]',
12062 dateTag$1 = '[object Date]',
12063 errorTag$1 = '[object Error]',
12064 funcTag$1 = '[object Function]',
12065 mapTag$2 = '[object Map]',
12066 numberTag$1 = '[object Number]',
12067 objectTag$2 = '[object Object]',
12068 regexpTag$1 = '[object RegExp]',
12069 setTag$2 = '[object Set]',
12070 stringTag$1 = '[object String]',
12071 weakMapTag$1 = '[object WeakMap]';
12072 var arrayBufferTag$1 = '[object ArrayBuffer]',
12073 dataViewTag$2 = '[object DataView]',
12074 float32Tag = '[object Float32Array]',
12075 float64Tag = '[object Float64Array]',
12076 int8Tag = '[object Int8Array]',
12077 int16Tag = '[object Int16Array]',
12078 int32Tag = '[object Int32Array]',
12079 uint8Tag = '[object Uint8Array]',
12080 uint8ClampedTag = '[object Uint8ClampedArray]',
12081 uint16Tag = '[object Uint16Array]',
12082 uint32Tag = '[object Uint32Array]';
12083 /** Used to identify `toStringTag` values of typed arrays. */
12085 var typedArrayTags = {};
12086 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
12087 typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
12089 * The base implementation of `_.isTypedArray` without Node.js optimizations.
12092 * @param {*} value The value to check.
12093 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
12096 function baseIsTypedArray$1(value) {
12097 return isObjectLike$2(value) && isLength$2(value.length) && !!typedArrayTags[baseGetTag$3(value)];
12100 var _baseIsTypedArray = baseIsTypedArray$1;
12103 * The base implementation of `_.unary` without support for storing metadata.
12106 * @param {Function} func The function to cap arguments for.
12107 * @returns {Function} Returns the new capped function.
12110 function baseUnary$1(func) {
12111 return function (value) {
12112 return func(value);
12116 var _baseUnary = baseUnary$1;
12118 var _nodeUtil = {exports: {}};
12120 (function (module, exports) {
12121 var freeGlobal = _freeGlobal;
12122 /** Detect free variable `exports`. */
12124 var freeExports = exports && !exports.nodeType && exports;
12125 /** Detect free variable `module`. */
12127 var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
12128 /** Detect the popular CommonJS extension `module.exports`. */
12130 var moduleExports = freeModule && freeModule.exports === freeExports;
12131 /** Detect free variable `process` from Node.js. */
12133 var freeProcess = moduleExports && freeGlobal.process;
12134 /** Used to access faster Node.js helpers. */
12136 var nodeUtil = function () {
12138 // Use `util.types` for Node.js 10+.
12139 var types = freeModule && freeModule.require && freeModule.require('util').types;
12143 } // Legacy `process.binding('util')` for Node.js < 10.
12146 return freeProcess && freeProcess.binding && freeProcess.binding('util');
12150 module.exports = nodeUtil;
12151 })(_nodeUtil, _nodeUtil.exports);
12153 var baseIsTypedArray = _baseIsTypedArray,
12154 baseUnary = _baseUnary,
12155 nodeUtil = _nodeUtil.exports;
12156 /* Node.js helper references. */
12158 var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
12160 * Checks if `value` is classified as a typed array.
12166 * @param {*} value The value to check.
12167 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
12170 * _.isTypedArray(new Uint8Array);
12173 * _.isTypedArray([]);
12177 var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
12178 var isTypedArray_1 = isTypedArray$2;
12180 var baseTimes = _baseTimes,
12181 isArguments$2 = isArguments_1,
12182 isArray$9 = isArray_1,
12183 isBuffer$1 = isBuffer$2.exports,
12184 isIndex$2 = _isIndex,
12185 isTypedArray$1 = isTypedArray_1;
12186 /** Used for built-in method references. */
12188 var objectProto$a = Object.prototype;
12189 /** Used to check objects for own properties. */
12191 var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
12193 * Creates an array of the enumerable property names of the array-like `value`.
12196 * @param {*} value The value to query.
12197 * @param {boolean} inherited Specify returning inherited property names.
12198 * @returns {Array} Returns the array of property names.
12201 function arrayLikeKeys$1(value, inherited) {
12202 var isArr = isArray$9(value),
12203 isArg = !isArr && isArguments$2(value),
12204 isBuff = !isArr && !isArg && isBuffer$1(value),
12205 isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
12206 skipIndexes = isArr || isArg || isBuff || isType,
12207 result = skipIndexes ? baseTimes(value.length, String) : [],
12208 length = result.length;
12210 for (var key in value) {
12211 if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode.
12212 key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers.
12213 isBuff && (key == 'offset' || key == 'parent') || // PhantomJS 2 has enumerable non-index properties on typed arrays.
12214 isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties.
12215 isIndex$2(key, length)))) {
12223 var _arrayLikeKeys = arrayLikeKeys$1;
12225 /** Used for built-in method references. */
12226 var objectProto$9 = Object.prototype;
12228 * Checks if `value` is likely a prototype object.
12231 * @param {*} value The value to check.
12232 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
12235 function isPrototype$1(value) {
12236 var Ctor = value && value.constructor,
12237 proto = typeof Ctor == 'function' && Ctor.prototype || objectProto$9;
12238 return value === proto;
12241 var _isPrototype = isPrototype$1;
12244 * Creates a unary function that invokes `func` with its argument transformed.
12247 * @param {Function} func The function to wrap.
12248 * @param {Function} transform The argument transform.
12249 * @returns {Function} Returns the new function.
12252 function overArg$1(func, transform) {
12253 return function (arg) {
12254 return func(transform(arg));
12258 var _overArg = overArg$1;
12260 var overArg = _overArg;
12261 /* Built-in method references for those with the same name as other `lodash` methods. */
12263 var nativeKeys$1 = overArg(Object.keys, Object);
12264 var _nativeKeys = nativeKeys$1;
12266 var isPrototype = _isPrototype,
12267 nativeKeys = _nativeKeys;
12268 /** Used for built-in method references. */
12270 var objectProto$8 = Object.prototype;
12271 /** Used to check objects for own properties. */
12273 var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
12275 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
12278 * @param {Object} object The object to query.
12279 * @returns {Array} Returns the array of property names.
12282 function baseKeys$1(object) {
12283 if (!isPrototype(object)) {
12284 return nativeKeys(object);
12289 for (var key in Object(object)) {
12290 if (hasOwnProperty$7.call(object, key) && key != 'constructor') {
12298 var _baseKeys = baseKeys$1;
12301 * Checks if `value` is the
12302 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
12303 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
12309 * @param {*} value The value to check.
12310 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
12316 * _.isObject([1, 2, 3]);
12319 * _.isObject(_.noop);
12322 * _.isObject(null);
12326 function isObject$4(value) {
12327 var type = typeof value;
12328 return value != null && (type == 'object' || type == 'function');
12331 var isObject_1 = isObject$4;
12333 var baseGetTag$2 = _baseGetTag,
12334 isObject$3 = isObject_1;
12335 /** `Object#toString` result references. */
12337 var asyncTag = '[object AsyncFunction]',
12338 funcTag = '[object Function]',
12339 genTag = '[object GeneratorFunction]',
12340 proxyTag = '[object Proxy]';
12342 * Checks if `value` is classified as a `Function` object.
12348 * @param {*} value The value to check.
12349 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
12355 * _.isFunction(/abc/);
12359 function isFunction$2(value) {
12360 if (!isObject$3(value)) {
12362 } // The use of `Object#toString` avoids issues with the `typeof` operator
12363 // in Safari 9 which returns 'object' for typed arrays and other constructors.
12366 var tag = baseGetTag$2(value);
12367 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
12370 var isFunction_1 = isFunction$2;
12372 var isFunction$1 = isFunction_1,
12373 isLength$1 = isLength_1;
12375 * Checks if `value` is array-like. A value is considered array-like if it's
12376 * not a function and has a `value.length` that's an integer greater than or
12377 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
12383 * @param {*} value The value to check.
12384 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
12387 * _.isArrayLike([1, 2, 3]);
12390 * _.isArrayLike(document.body.children);
12393 * _.isArrayLike('abc');
12396 * _.isArrayLike(_.noop);
12400 function isArrayLike$2(value) {
12401 return value != null && isLength$1(value.length) && !isFunction$1(value);
12404 var isArrayLike_1 = isArrayLike$2;
12406 var arrayLikeKeys = _arrayLikeKeys,
12407 baseKeys = _baseKeys,
12408 isArrayLike$1 = isArrayLike_1;
12410 * Creates an array of the own enumerable property names of `object`.
12412 * **Note:** Non-object values are coerced to objects. See the
12413 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
12414 * for more details.
12420 * @param {Object} object The object to query.
12421 * @returns {Array} Returns the array of property names.
12429 * Foo.prototype.c = 3;
12432 * // => ['a', 'b'] (iteration order is not guaranteed)
12438 function keys$3(object) {
12439 return isArrayLike$1(object) ? arrayLikeKeys(object) : baseKeys(object);
12442 var keys_1 = keys$3;
12444 var baseFor = _baseFor,
12447 * The base implementation of `_.forOwn` without support for iteratee shorthands.
12450 * @param {Object} object The object to iterate over.
12451 * @param {Function} iteratee The function invoked per iteration.
12452 * @returns {Object} Returns `object`.
12455 function baseForOwn$1(object, iteratee) {
12456 return object && baseFor(object, iteratee, keys$2);
12459 var _baseForOwn = baseForOwn$1;
12461 var isArrayLike = isArrayLike_1;
12463 * Creates a `baseEach` or `baseEachRight` function.
12466 * @param {Function} eachFunc The function to iterate over a collection.
12467 * @param {boolean} [fromRight] Specify iterating from right to left.
12468 * @returns {Function} Returns the new base function.
12471 function createBaseEach$1(eachFunc, fromRight) {
12472 return function (collection, iteratee) {
12473 if (collection == null) {
12477 if (!isArrayLike(collection)) {
12478 return eachFunc(collection, iteratee);
12481 var length = collection.length,
12482 index = fromRight ? length : -1,
12483 iterable = Object(collection);
12485 while (fromRight ? index-- : ++index < length) {
12486 if (iteratee(iterable[index], index, iterable) === false) {
12495 var _createBaseEach = createBaseEach$1;
12497 var baseForOwn = _baseForOwn,
12498 createBaseEach = _createBaseEach;
12500 * The base implementation of `_.forEach` without support for iteratee shorthands.
12503 * @param {Array|Object} collection The collection to iterate over.
12504 * @param {Function} iteratee The function invoked per iteration.
12505 * @returns {Array|Object} Returns `collection`.
12508 var baseEach$1 = createBaseEach(baseForOwn);
12509 var _baseEach = baseEach$1;
12511 var baseEach = _baseEach;
12513 * Aggregates elements of `collection` on `accumulator` with keys transformed
12514 * by `iteratee` and values set by `setter`.
12517 * @param {Array|Object} collection The collection to iterate over.
12518 * @param {Function} setter The function to set `accumulator` values.
12519 * @param {Function} iteratee The iteratee to transform keys.
12520 * @param {Object} accumulator The initial aggregated object.
12521 * @returns {Function} Returns `accumulator`.
12524 function baseAggregator$1(collection, setter, iteratee, accumulator) {
12525 baseEach(collection, function (value, key, collection) {
12526 setter(accumulator, value, iteratee(value), collection);
12528 return accumulator;
12531 var _baseAggregator = baseAggregator$1;
12534 * Removes all key-value entries from the list cache.
12538 * @memberOf ListCache
12541 function listCacheClear$1() {
12542 this.__data__ = [];
12546 var _listCacheClear = listCacheClear$1;
12550 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
12551 * comparison between two values to determine if they are equivalent.
12557 * @param {*} value The value to compare.
12558 * @param {*} other The other value to compare.
12559 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12562 * var object = { 'a': 1 };
12563 * var other = { 'a': 1 };
12565 * _.eq(object, object);
12568 * _.eq(object, other);
12574 * _.eq('a', Object('a'));
12581 function eq$3(value, other) {
12582 return value === other || value !== value && other !== other;
12589 * Gets the index at which the `key` is found in `array` of key-value pairs.
12592 * @param {Array} array The array to inspect.
12593 * @param {*} key The key to search for.
12594 * @returns {number} Returns the index of the matched value, else `-1`.
12597 function assocIndexOf$4(array, key) {
12598 var length = array.length;
12601 if (eq$2(array[length][0], key)) {
12609 var _assocIndexOf = assocIndexOf$4;
12611 var assocIndexOf$3 = _assocIndexOf;
12612 /** Used for built-in method references. */
12614 var arrayProto = Array.prototype;
12615 /** Built-in value references. */
12617 var splice = arrayProto.splice;
12619 * Removes `key` and its value from the list cache.
12623 * @memberOf ListCache
12624 * @param {string} key The key of the value to remove.
12625 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
12628 function listCacheDelete$1(key) {
12629 var data = this.__data__,
12630 index = assocIndexOf$3(data, key);
12636 var lastIndex = data.length - 1;
12638 if (index == lastIndex) {
12641 splice.call(data, index, 1);
12648 var _listCacheDelete = listCacheDelete$1;
12650 var assocIndexOf$2 = _assocIndexOf;
12652 * Gets the list cache value for `key`.
12656 * @memberOf ListCache
12657 * @param {string} key The key of the value to get.
12658 * @returns {*} Returns the entry value.
12661 function listCacheGet$1(key) {
12662 var data = this.__data__,
12663 index = assocIndexOf$2(data, key);
12664 return index < 0 ? undefined : data[index][1];
12667 var _listCacheGet = listCacheGet$1;
12669 var assocIndexOf$1 = _assocIndexOf;
12671 * Checks if a list cache value for `key` exists.
12675 * @memberOf ListCache
12676 * @param {string} key The key of the entry to check.
12677 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
12680 function listCacheHas$1(key) {
12681 return assocIndexOf$1(this.__data__, key) > -1;
12684 var _listCacheHas = listCacheHas$1;
12686 var assocIndexOf = _assocIndexOf;
12688 * Sets the list cache `key` to `value`.
12692 * @memberOf ListCache
12693 * @param {string} key The key of the value to set.
12694 * @param {*} value The value to set.
12695 * @returns {Object} Returns the list cache instance.
12698 function listCacheSet$1(key, value) {
12699 var data = this.__data__,
12700 index = assocIndexOf(data, key);
12704 data.push([key, value]);
12706 data[index][1] = value;
12712 var _listCacheSet = listCacheSet$1;
12714 var listCacheClear = _listCacheClear,
12715 listCacheDelete = _listCacheDelete,
12716 listCacheGet = _listCacheGet,
12717 listCacheHas = _listCacheHas,
12718 listCacheSet = _listCacheSet;
12720 * Creates an list cache object.
12724 * @param {Array} [entries] The key-value pairs to cache.
12727 function ListCache$4(entries) {
12729 length = entries == null ? 0 : entries.length;
12732 while (++index < length) {
12733 var entry = entries[index];
12734 this.set(entry[0], entry[1]);
12736 } // Add methods to `ListCache`.
12739 ListCache$4.prototype.clear = listCacheClear;
12740 ListCache$4.prototype['delete'] = listCacheDelete;
12741 ListCache$4.prototype.get = listCacheGet;
12742 ListCache$4.prototype.has = listCacheHas;
12743 ListCache$4.prototype.set = listCacheSet;
12744 var _ListCache = ListCache$4;
12746 var ListCache$3 = _ListCache;
12748 * Removes all key-value entries from the stack.
12755 function stackClear$1() {
12756 this.__data__ = new ListCache$3();
12760 var _stackClear = stackClear$1;
12763 * Removes `key` and its value from the stack.
12768 * @param {string} key The key of the value to remove.
12769 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
12772 function stackDelete$1(key) {
12773 var data = this.__data__,
12774 result = data['delete'](key);
12775 this.size = data.size;
12779 var _stackDelete = stackDelete$1;
12782 * Gets the stack value for `key`.
12787 * @param {string} key The key of the value to get.
12788 * @returns {*} Returns the entry value.
12791 function stackGet$1(key) {
12792 return this.__data__.get(key);
12795 var _stackGet = stackGet$1;
12798 * Checks if a stack value for `key` exists.
12803 * @param {string} key The key of the entry to check.
12804 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
12807 function stackHas$1(key) {
12808 return this.__data__.has(key);
12811 var _stackHas = stackHas$1;
12813 var root$6 = _root;
12814 /** Used to detect overreaching core-js shims. */
12816 var coreJsData$1 = root$6['__core-js_shared__'];
12817 var _coreJsData = coreJsData$1;
12819 var coreJsData = _coreJsData;
12820 /** Used to detect methods masquerading as native. */
12822 var maskSrcKey = function () {
12823 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
12824 return uid ? 'Symbol(src)_1.' + uid : '';
12827 * Checks if `func` has its source masked.
12830 * @param {Function} func The function to check.
12831 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
12835 function isMasked$1(func) {
12836 return !!maskSrcKey && maskSrcKey in func;
12839 var _isMasked = isMasked$1;
12841 /** Used for built-in method references. */
12842 var funcProto$1 = Function.prototype;
12843 /** Used to resolve the decompiled source of functions. */
12845 var funcToString$1 = funcProto$1.toString;
12847 * Converts `func` to its source code.
12850 * @param {Function} func The function to convert.
12851 * @returns {string} Returns the source code.
12854 function toSource$2(func) {
12855 if (func != null) {
12857 return funcToString$1.call(func);
12868 var _toSource = toSource$2;
12870 var isFunction = isFunction_1,
12871 isMasked = _isMasked,
12872 isObject$2 = isObject_1,
12873 toSource$1 = _toSource;
12875 * Used to match `RegExp`
12876 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
12879 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
12880 /** Used to detect host constructors (Safari). */
12882 var reIsHostCtor = /^\[object .+?Constructor\]$/;
12883 /** Used for built-in method references. */
12885 var funcProto = Function.prototype,
12886 objectProto$7 = Object.prototype;
12887 /** Used to resolve the decompiled source of functions. */
12889 var funcToString = funcProto.toString;
12890 /** Used to check objects for own properties. */
12892 var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
12893 /** Used to detect if a method is native. */
12895 var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty$6).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
12897 * The base implementation of `_.isNative` without bad shim checks.
12900 * @param {*} value The value to check.
12901 * @returns {boolean} Returns `true` if `value` is a native function,
12905 function baseIsNative$1(value) {
12906 if (!isObject$2(value) || isMasked(value)) {
12910 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
12911 return pattern.test(toSource$1(value));
12914 var _baseIsNative = baseIsNative$1;
12917 * Gets the value at `key` of `object`.
12920 * @param {Object} [object] The object to query.
12921 * @param {string} key The key of the property to get.
12922 * @returns {*} Returns the property value.
12925 function getValue$1(object, key) {
12926 return object == null ? undefined : object[key];
12929 var _getValue = getValue$1;
12931 var baseIsNative = _baseIsNative,
12932 getValue = _getValue;
12934 * Gets the native function at `key` of `object`.
12937 * @param {Object} object The object to query.
12938 * @param {string} key The key of the method to get.
12939 * @returns {*} Returns the function if it's native, else `undefined`.
12942 function getNative$7(object, key) {
12943 var value = getValue(object, key);
12944 return baseIsNative(value) ? value : undefined;
12947 var _getNative = getNative$7;
12949 var getNative$6 = _getNative,
12951 /* Built-in method references that are verified to be native. */
12953 var Map$4 = getNative$6(root$5, 'Map');
12956 var getNative$5 = _getNative;
12957 /* Built-in method references that are verified to be native. */
12959 var nativeCreate$4 = getNative$5(Object, 'create');
12960 var _nativeCreate = nativeCreate$4;
12962 var nativeCreate$3 = _nativeCreate;
12964 * Removes all key-value entries from the hash.
12971 function hashClear$1() {
12972 this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
12976 var _hashClear = hashClear$1;
12979 * Removes `key` and its value from the hash.
12984 * @param {Object} hash The hash to modify.
12985 * @param {string} key The key of the value to remove.
12986 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
12989 function hashDelete$1(key) {
12990 var result = this.has(key) && delete this.__data__[key];
12991 this.size -= result ? 1 : 0;
12995 var _hashDelete = hashDelete$1;
12997 var nativeCreate$2 = _nativeCreate;
12998 /** Used to stand-in for `undefined` hash values. */
13000 var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
13001 /** Used for built-in method references. */
13003 var objectProto$6 = Object.prototype;
13004 /** Used to check objects for own properties. */
13006 var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
13008 * Gets the hash value for `key`.
13013 * @param {string} key The key of the value to get.
13014 * @returns {*} Returns the entry value.
13017 function hashGet$1(key) {
13018 var data = this.__data__;
13020 if (nativeCreate$2) {
13021 var result = data[key];
13022 return result === HASH_UNDEFINED$2 ? undefined : result;
13025 return hasOwnProperty$5.call(data, key) ? data[key] : undefined;
13028 var _hashGet = hashGet$1;
13030 var nativeCreate$1 = _nativeCreate;
13031 /** Used for built-in method references. */
13033 var objectProto$5 = Object.prototype;
13034 /** Used to check objects for own properties. */
13036 var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
13038 * Checks if a hash value for `key` exists.
13043 * @param {string} key The key of the entry to check.
13044 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
13047 function hashHas$1(key) {
13048 var data = this.__data__;
13049 return nativeCreate$1 ? data[key] !== undefined : hasOwnProperty$4.call(data, key);
13052 var _hashHas = hashHas$1;
13054 var nativeCreate = _nativeCreate;
13055 /** Used to stand-in for `undefined` hash values. */
13057 var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
13059 * Sets the hash `key` to `value`.
13064 * @param {string} key The key of the value to set.
13065 * @param {*} value The value to set.
13066 * @returns {Object} Returns the hash instance.
13069 function hashSet$1(key, value) {
13070 var data = this.__data__;
13071 this.size += this.has(key) ? 0 : 1;
13072 data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED$1 : value;
13076 var _hashSet = hashSet$1;
13078 var hashClear = _hashClear,
13079 hashDelete = _hashDelete,
13080 hashGet = _hashGet,
13081 hashHas = _hashHas,
13082 hashSet = _hashSet;
13084 * Creates a hash object.
13088 * @param {Array} [entries] The key-value pairs to cache.
13091 function Hash$1(entries) {
13093 length = entries == null ? 0 : entries.length;
13096 while (++index < length) {
13097 var entry = entries[index];
13098 this.set(entry[0], entry[1]);
13100 } // Add methods to `Hash`.
13103 Hash$1.prototype.clear = hashClear;
13104 Hash$1.prototype['delete'] = hashDelete;
13105 Hash$1.prototype.get = hashGet;
13106 Hash$1.prototype.has = hashHas;
13107 Hash$1.prototype.set = hashSet;
13108 var _Hash = Hash$1;
13111 ListCache$2 = _ListCache,
13114 * Removes all key-value entries from the map.
13118 * @memberOf MapCache
13121 function mapCacheClear$1() {
13124 'hash': new Hash(),
13125 'map': new (Map$3 || ListCache$2)(),
13126 'string': new Hash()
13130 var _mapCacheClear = mapCacheClear$1;
13133 * Checks if `value` is suitable for use as unique object key.
13136 * @param {*} value The value to check.
13137 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
13140 function isKeyable$1(value) {
13141 var type = typeof value;
13142 return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
13145 var _isKeyable = isKeyable$1;
13147 var isKeyable = _isKeyable;
13149 * Gets the data for `map`.
13152 * @param {Object} map The map to query.
13153 * @param {string} key The reference key.
13154 * @returns {*} Returns the map data.
13157 function getMapData$4(map, key) {
13158 var data = map.__data__;
13159 return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
13162 var _getMapData = getMapData$4;
13164 var getMapData$3 = _getMapData;
13166 * Removes `key` and its value from the map.
13170 * @memberOf MapCache
13171 * @param {string} key The key of the value to remove.
13172 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
13175 function mapCacheDelete$1(key) {
13176 var result = getMapData$3(this, key)['delete'](key);
13177 this.size -= result ? 1 : 0;
13181 var _mapCacheDelete = mapCacheDelete$1;
13183 var getMapData$2 = _getMapData;
13185 * Gets the map value for `key`.
13189 * @memberOf MapCache
13190 * @param {string} key The key of the value to get.
13191 * @returns {*} Returns the entry value.
13194 function mapCacheGet$1(key) {
13195 return getMapData$2(this, key).get(key);
13198 var _mapCacheGet = mapCacheGet$1;
13200 var getMapData$1 = _getMapData;
13202 * Checks if a map value for `key` exists.
13206 * @memberOf MapCache
13207 * @param {string} key The key of the entry to check.
13208 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
13211 function mapCacheHas$1(key) {
13212 return getMapData$1(this, key).has(key);
13215 var _mapCacheHas = mapCacheHas$1;
13217 var getMapData = _getMapData;
13219 * Sets the map `key` to `value`.
13223 * @memberOf MapCache
13224 * @param {string} key The key of the value to set.
13225 * @param {*} value The value to set.
13226 * @returns {Object} Returns the map cache instance.
13229 function mapCacheSet$1(key, value) {
13230 var data = getMapData(this, key),
13232 data.set(key, value);
13233 this.size += data.size == size ? 0 : 1;
13237 var _mapCacheSet = mapCacheSet$1;
13239 var mapCacheClear = _mapCacheClear,
13240 mapCacheDelete = _mapCacheDelete,
13241 mapCacheGet = _mapCacheGet,
13242 mapCacheHas = _mapCacheHas,
13243 mapCacheSet = _mapCacheSet;
13245 * Creates a map cache object to store key-value pairs.
13249 * @param {Array} [entries] The key-value pairs to cache.
13252 function MapCache$3(entries) {
13254 length = entries == null ? 0 : entries.length;
13257 while (++index < length) {
13258 var entry = entries[index];
13259 this.set(entry[0], entry[1]);
13261 } // Add methods to `MapCache`.
13264 MapCache$3.prototype.clear = mapCacheClear;
13265 MapCache$3.prototype['delete'] = mapCacheDelete;
13266 MapCache$3.prototype.get = mapCacheGet;
13267 MapCache$3.prototype.has = mapCacheHas;
13268 MapCache$3.prototype.set = mapCacheSet;
13269 var _MapCache = MapCache$3;
13271 var ListCache$1 = _ListCache,
13273 MapCache$2 = _MapCache;
13274 /** Used as the size to enable large array optimizations. */
13276 var LARGE_ARRAY_SIZE = 200;
13278 * Sets the stack `key` to `value`.
13283 * @param {string} key The key of the value to set.
13284 * @param {*} value The value to set.
13285 * @returns {Object} Returns the stack cache instance.
13288 function stackSet$1(key, value) {
13289 var data = this.__data__;
13291 if (data instanceof ListCache$1) {
13292 var pairs = data.__data__;
13294 if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
13295 pairs.push([key, value]);
13296 this.size = ++data.size;
13300 data = this.__data__ = new MapCache$2(pairs);
13303 data.set(key, value);
13304 this.size = data.size;
13308 var _stackSet = stackSet$1;
13310 var ListCache = _ListCache,
13311 stackClear = _stackClear,
13312 stackDelete = _stackDelete,
13313 stackGet = _stackGet,
13314 stackHas = _stackHas,
13315 stackSet = _stackSet;
13317 * Creates a stack cache object to store key-value pairs.
13321 * @param {Array} [entries] The key-value pairs to cache.
13324 function Stack$2(entries) {
13325 var data = this.__data__ = new ListCache(entries);
13326 this.size = data.size;
13327 } // Add methods to `Stack`.
13330 Stack$2.prototype.clear = stackClear;
13331 Stack$2.prototype['delete'] = stackDelete;
13332 Stack$2.prototype.get = stackGet;
13333 Stack$2.prototype.has = stackHas;
13334 Stack$2.prototype.set = stackSet;
13335 var _Stack = Stack$2;
13337 /** Used to stand-in for `undefined` hash values. */
13338 var HASH_UNDEFINED = '__lodash_hash_undefined__';
13340 * Adds `value` to the array cache.
13344 * @memberOf SetCache
13346 * @param {*} value The value to cache.
13347 * @returns {Object} Returns the cache instance.
13350 function setCacheAdd$1(value) {
13351 this.__data__.set(value, HASH_UNDEFINED);
13356 var _setCacheAdd = setCacheAdd$1;
13359 * Checks if `value` is in the array cache.
13363 * @memberOf SetCache
13364 * @param {*} value The value to search for.
13365 * @returns {number} Returns `true` if `value` is found, else `false`.
13368 function setCacheHas$1(value) {
13369 return this.__data__.has(value);
13372 var _setCacheHas = setCacheHas$1;
13374 var MapCache$1 = _MapCache,
13375 setCacheAdd = _setCacheAdd,
13376 setCacheHas = _setCacheHas;
13379 * Creates an array cache object to store unique values.
13383 * @param {Array} [values] The values to cache.
13386 function SetCache$1(values) {
13388 length = values == null ? 0 : values.length;
13389 this.__data__ = new MapCache$1();
13391 while (++index < length) {
13392 this.add(values[index]);
13394 } // Add methods to `SetCache`.
13397 SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
13398 SetCache$1.prototype.has = setCacheHas;
13399 var _SetCache = SetCache$1;
13402 * A specialized version of `_.some` for arrays without support for iteratee
13406 * @param {Array} [array] The array to iterate over.
13407 * @param {Function} predicate The function invoked per iteration.
13408 * @returns {boolean} Returns `true` if any element passes the predicate check,
13412 function arraySome$1(array, predicate) {
13414 length = array == null ? 0 : array.length;
13416 while (++index < length) {
13417 if (predicate(array[index], index, array)) {
13425 var _arraySome = arraySome$1;
13428 * Checks if a `cache` value for `key` exists.
13431 * @param {Object} cache The cache to query.
13432 * @param {string} key The key of the entry to check.
13433 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
13436 function cacheHas$1(cache, key) {
13437 return cache.has(key);
13440 var _cacheHas = cacheHas$1;
13442 var SetCache = _SetCache,
13443 arraySome = _arraySome,
13444 cacheHas = _cacheHas;
13445 /** Used to compose bitmasks for value comparisons. */
13447 var COMPARE_PARTIAL_FLAG$5 = 1,
13448 COMPARE_UNORDERED_FLAG$3 = 2;
13450 * A specialized version of `baseIsEqualDeep` for arrays with support for
13451 * partial deep comparisons.
13454 * @param {Array} array The array to compare.
13455 * @param {Array} other The other array to compare.
13456 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
13457 * @param {Function} customizer The function to customize comparisons.
13458 * @param {Function} equalFunc The function to determine equivalents of values.
13459 * @param {Object} stack Tracks traversed `array` and `other` objects.
13460 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
13463 function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
13464 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
13465 arrLength = array.length,
13466 othLength = other.length;
13468 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
13470 } // Check that cyclic values are equal.
13473 var arrStacked = stack.get(array);
13474 var othStacked = stack.get(other);
13476 if (arrStacked && othStacked) {
13477 return arrStacked == other && othStacked == array;
13482 seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : undefined;
13483 stack.set(array, other);
13484 stack.set(other, array); // Ignore non-index properties.
13486 while (++index < arrLength) {
13487 var arrValue = array[index],
13488 othValue = other[index];
13491 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
13494 if (compared !== undefined) {
13501 } // Recursively compare arrays (susceptible to call stack limits).
13505 if (!arraySome(other, function (othValue, othIndex) {
13506 if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
13507 return seen.push(othIndex);
13513 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
13519 stack['delete'](array);
13520 stack['delete'](other);
13524 var _equalArrays = equalArrays$2;
13526 var root$4 = _root;
13527 /** Built-in value references. */
13529 var Uint8Array$1 = root$4.Uint8Array;
13530 var _Uint8Array = Uint8Array$1;
13533 * Converts `map` to its key-value pairs.
13536 * @param {Object} map The map to convert.
13537 * @returns {Array} Returns the key-value pairs.
13540 function mapToArray$1(map) {
13542 result = Array(map.size);
13543 map.forEach(function (value, key) {
13544 result[++index] = [key, value];
13549 var _mapToArray = mapToArray$1;
13552 * Converts `set` to an array of its values.
13555 * @param {Object} set The set to convert.
13556 * @returns {Array} Returns the values.
13559 function setToArray$1(set) {
13561 result = Array(set.size);
13562 set.forEach(function (value) {
13563 result[++index] = value;
13568 var _setToArray = setToArray$1;
13570 var Symbol$3 = _Symbol,
13571 Uint8Array = _Uint8Array,
13573 equalArrays$1 = _equalArrays,
13574 mapToArray = _mapToArray,
13575 setToArray = _setToArray;
13576 /** Used to compose bitmasks for value comparisons. */
13578 var COMPARE_PARTIAL_FLAG$4 = 1,
13579 COMPARE_UNORDERED_FLAG$2 = 2;
13580 /** `Object#toString` result references. */
13582 var boolTag = '[object Boolean]',
13583 dateTag = '[object Date]',
13584 errorTag = '[object Error]',
13585 mapTag$1 = '[object Map]',
13586 numberTag = '[object Number]',
13587 regexpTag = '[object RegExp]',
13588 setTag$1 = '[object Set]',
13589 stringTag = '[object String]',
13590 symbolTag$1 = '[object Symbol]';
13591 var arrayBufferTag = '[object ArrayBuffer]',
13592 dataViewTag$1 = '[object DataView]';
13593 /** Used to convert symbols to primitives and strings. */
13595 var symbolProto$1 = Symbol$3 ? Symbol$3.prototype : undefined,
13596 symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
13598 * A specialized version of `baseIsEqualDeep` for comparing objects of
13599 * the same `toStringTag`.
13601 * **Note:** This function only supports comparing values with tags of
13602 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
13605 * @param {Object} object The object to compare.
13606 * @param {Object} other The other object to compare.
13607 * @param {string} tag The `toStringTag` of the objects to compare.
13608 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
13609 * @param {Function} customizer The function to customize comparisons.
13610 * @param {Function} equalFunc The function to determine equivalents of values.
13611 * @param {Object} stack Tracks traversed `object` and `other` objects.
13612 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
13615 function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack) {
13617 case dataViewTag$1:
13618 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
13622 object = object.buffer;
13623 other = other.buffer;
13625 case arrayBufferTag:
13626 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
13635 // Coerce booleans to `1` or `0` and dates to milliseconds.
13636 // Invalid dates are coerced to `NaN`.
13637 return eq$1(+object, +other);
13640 return object.name == other.name && object.message == other.message;
13644 // Coerce regexes to strings and treat strings, primitives and objects,
13645 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
13646 // for more details.
13647 return object == other + '';
13650 var convert = mapToArray;
13653 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
13654 convert || (convert = setToArray);
13656 if (object.size != other.size && !isPartial) {
13658 } // Assume cyclic values are equal.
13661 var stacked = stack.get(object);
13664 return stacked == other;
13667 bitmask |= COMPARE_UNORDERED_FLAG$2; // Recursively compare objects (susceptible to call stack limits).
13669 stack.set(object, other);
13670 var result = equalArrays$1(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
13671 stack['delete'](object);
13675 if (symbolValueOf) {
13676 return symbolValueOf.call(object) == symbolValueOf.call(other);
13684 var _equalByTag = equalByTag$1;
13687 * Appends the elements of `values` to `array`.
13690 * @param {Array} array The array to modify.
13691 * @param {Array} values The values to append.
13692 * @returns {Array} Returns `array`.
13695 function arrayPush$2(array, values) {
13697 length = values.length,
13698 offset = array.length;
13700 while (++index < length) {
13701 array[offset + index] = values[index];
13707 var _arrayPush = arrayPush$2;
13709 var arrayPush$1 = _arrayPush,
13710 isArray$8 = isArray_1;
13712 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
13713 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
13714 * symbols of `object`.
13717 * @param {Object} object The object to query.
13718 * @param {Function} keysFunc The function to get the keys of `object`.
13719 * @param {Function} symbolsFunc The function to get the symbols of `object`.
13720 * @returns {Array} Returns the array of property names and symbols.
13723 function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
13724 var result = keysFunc(object);
13725 return isArray$8(object) ? result : arrayPush$1(result, symbolsFunc(object));
13728 var _baseGetAllKeys = baseGetAllKeys$1;
13731 * A specialized version of `_.filter` for arrays without support for
13732 * iteratee shorthands.
13735 * @param {Array} [array] The array to iterate over.
13736 * @param {Function} predicate The function invoked per iteration.
13737 * @returns {Array} Returns the new filtered array.
13740 function arrayFilter$1(array, predicate) {
13742 length = array == null ? 0 : array.length,
13746 while (++index < length) {
13747 var value = array[index];
13749 if (predicate(value, index, array)) {
13750 result[resIndex++] = value;
13757 var _arrayFilter = arrayFilter$1;
13760 * This method returns a new empty array.
13766 * @returns {Array} Returns the new empty array.
13769 * var arrays = _.times(2, _.stubArray);
13771 * console.log(arrays);
13774 * console.log(arrays[0] === arrays[1]);
13778 function stubArray$1() {
13782 var stubArray_1 = stubArray$1;
13784 var arrayFilter = _arrayFilter,
13785 stubArray = stubArray_1;
13786 /** Used for built-in method references. */
13788 var objectProto$4 = Object.prototype;
13789 /** Built-in value references. */
13791 var propertyIsEnumerable = objectProto$4.propertyIsEnumerable;
13792 /* Built-in method references for those with the same name as other `lodash` methods. */
13794 var nativeGetSymbols = Object.getOwnPropertySymbols;
13796 * Creates an array of the own enumerable symbols of `object`.
13799 * @param {Object} object The object to query.
13800 * @returns {Array} Returns the array of symbols.
13803 var getSymbols$1 = !nativeGetSymbols ? stubArray : function (object) {
13804 if (object == null) {
13808 object = Object(object);
13809 return arrayFilter(nativeGetSymbols(object), function (symbol) {
13810 return propertyIsEnumerable.call(object, symbol);
13813 var _getSymbols = getSymbols$1;
13815 var baseGetAllKeys = _baseGetAllKeys,
13816 getSymbols = _getSymbols,
13819 * Creates an array of own enumerable property names and symbols of `object`.
13822 * @param {Object} object The object to query.
13823 * @returns {Array} Returns the array of property names and symbols.
13826 function getAllKeys$1(object) {
13827 return baseGetAllKeys(object, keys$1, getSymbols);
13830 var _getAllKeys = getAllKeys$1;
13832 var getAllKeys = _getAllKeys;
13833 /** Used to compose bitmasks for value comparisons. */
13835 var COMPARE_PARTIAL_FLAG$3 = 1;
13836 /** Used for built-in method references. */
13838 var objectProto$3 = Object.prototype;
13839 /** Used to check objects for own properties. */
13841 var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
13843 * A specialized version of `baseIsEqualDeep` for objects with support for
13844 * partial deep comparisons.
13847 * @param {Object} object The object to compare.
13848 * @param {Object} other The other object to compare.
13849 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
13850 * @param {Function} customizer The function to customize comparisons.
13851 * @param {Function} equalFunc The function to determine equivalents of values.
13852 * @param {Object} stack Tracks traversed `object` and `other` objects.
13853 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
13856 function equalObjects$1(object, other, bitmask, customizer, equalFunc, stack) {
13857 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
13858 objProps = getAllKeys(object),
13859 objLength = objProps.length,
13860 othProps = getAllKeys(other),
13861 othLength = othProps.length;
13863 if (objLength != othLength && !isPartial) {
13867 var index = objLength;
13870 var key = objProps[index];
13872 if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {
13875 } // Check that cyclic values are equal.
13878 var objStacked = stack.get(object);
13879 var othStacked = stack.get(other);
13881 if (objStacked && othStacked) {
13882 return objStacked == other && othStacked == object;
13886 stack.set(object, other);
13887 stack.set(other, object);
13888 var skipCtor = isPartial;
13890 while (++index < objLength) {
13891 key = objProps[index];
13892 var objValue = object[key],
13893 othValue = other[key];
13896 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
13897 } // Recursively compare objects (susceptible to call stack limits).
13900 if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
13905 skipCtor || (skipCtor = key == 'constructor');
13908 if (result && !skipCtor) {
13909 var objCtor = object.constructor,
13910 othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal.
13912 if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
13917 stack['delete'](object);
13918 stack['delete'](other);
13922 var _equalObjects = equalObjects$1;
13924 var getNative$4 = _getNative,
13926 /* Built-in method references that are verified to be native. */
13928 var DataView$1 = getNative$4(root$3, 'DataView');
13929 var _DataView = DataView$1;
13931 var getNative$3 = _getNative,
13933 /* Built-in method references that are verified to be native. */
13935 var Promise$2 = getNative$3(root$2, 'Promise');
13936 var _Promise = Promise$2;
13938 var getNative$2 = _getNative,
13940 /* Built-in method references that are verified to be native. */
13942 var Set$2 = getNative$2(root$1, 'Set');
13945 var getNative$1 = _getNative,
13947 /* Built-in method references that are verified to be native. */
13949 var WeakMap$2 = getNative$1(root, 'WeakMap');
13950 var _WeakMap = WeakMap$2;
13952 var DataView = _DataView,
13954 Promise$1 = _Promise,
13956 WeakMap$1 = _WeakMap,
13957 baseGetTag$1 = _baseGetTag,
13958 toSource = _toSource;
13959 /** `Object#toString` result references. */
13961 var mapTag = '[object Map]',
13962 objectTag$1 = '[object Object]',
13963 promiseTag = '[object Promise]',
13964 setTag = '[object Set]',
13965 weakMapTag = '[object WeakMap]';
13966 var dataViewTag = '[object DataView]';
13967 /** Used to detect maps, sets, and weakmaps. */
13969 var dataViewCtorString = toSource(DataView),
13970 mapCtorString = toSource(Map$1),
13971 promiseCtorString = toSource(Promise$1),
13972 setCtorString = toSource(Set$1),
13973 weakMapCtorString = toSource(WeakMap$1);
13975 * Gets the `toStringTag` of `value`.
13978 * @param {*} value The value to query.
13979 * @returns {string} Returns the `toStringTag`.
13982 var getTag$1 = baseGetTag$1; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
13984 if (DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag$1(new Map$1()) != mapTag || Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag || Set$1 && getTag$1(new Set$1()) != setTag || WeakMap$1 && getTag$1(new WeakMap$1()) != weakMapTag) {
13985 getTag$1 = function (value) {
13986 var result = baseGetTag$1(value),
13987 Ctor = result == objectTag$1 ? value.constructor : undefined,
13988 ctorString = Ctor ? toSource(Ctor) : '';
13991 switch (ctorString) {
13992 case dataViewCtorString:
13993 return dataViewTag;
13995 case mapCtorString:
13998 case promiseCtorString:
14001 case setCtorString:
14004 case weakMapCtorString:
14013 var _getTag = getTag$1;
14015 var Stack$1 = _Stack,
14016 equalArrays = _equalArrays,
14017 equalByTag = _equalByTag,
14018 equalObjects = _equalObjects,
14020 isArray$7 = isArray_1,
14021 isBuffer = isBuffer$2.exports,
14022 isTypedArray = isTypedArray_1;
14023 /** Used to compose bitmasks for value comparisons. */
14025 var COMPARE_PARTIAL_FLAG$2 = 1;
14026 /** `Object#toString` result references. */
14028 var argsTag = '[object Arguments]',
14029 arrayTag = '[object Array]',
14030 objectTag = '[object Object]';
14031 /** Used for built-in method references. */
14033 var objectProto$2 = Object.prototype;
14034 /** Used to check objects for own properties. */
14036 var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
14038 * A specialized version of `baseIsEqual` for arrays and objects which performs
14039 * deep comparisons and tracks traversed objects enabling objects with circular
14040 * references to be compared.
14043 * @param {Object} object The object to compare.
14044 * @param {Object} other The other object to compare.
14045 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
14046 * @param {Function} customizer The function to customize comparisons.
14047 * @param {Function} equalFunc The function to determine equivalents of values.
14048 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
14049 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
14052 function baseIsEqualDeep$1(object, other, bitmask, customizer, equalFunc, stack) {
14053 var objIsArr = isArray$7(object),
14054 othIsArr = isArray$7(other),
14055 objTag = objIsArr ? arrayTag : getTag(object),
14056 othTag = othIsArr ? arrayTag : getTag(other);
14057 objTag = objTag == argsTag ? objectTag : objTag;
14058 othTag = othTag == argsTag ? objectTag : othTag;
14059 var objIsObj = objTag == objectTag,
14060 othIsObj = othTag == objectTag,
14061 isSameTag = objTag == othTag;
14063 if (isSameTag && isBuffer(object)) {
14064 if (!isBuffer(other)) {
14072 if (isSameTag && !objIsObj) {
14073 stack || (stack = new Stack$1());
14074 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
14077 if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
14078 var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, '__wrapped__'),
14079 othIsWrapped = othIsObj && hasOwnProperty$2.call(other, '__wrapped__');
14081 if (objIsWrapped || othIsWrapped) {
14082 var objUnwrapped = objIsWrapped ? object.value() : object,
14083 othUnwrapped = othIsWrapped ? other.value() : other;
14084 stack || (stack = new Stack$1());
14085 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
14093 stack || (stack = new Stack$1());
14094 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
14097 var _baseIsEqualDeep = baseIsEqualDeep$1;
14099 var baseIsEqualDeep = _baseIsEqualDeep,
14100 isObjectLike$1 = isObjectLike_1;
14102 * The base implementation of `_.isEqual` which supports partial comparisons
14103 * and tracks traversed objects.
14106 * @param {*} value The value to compare.
14107 * @param {*} other The other value to compare.
14108 * @param {boolean} bitmask The bitmask flags.
14109 * 1 - Unordered comparison
14110 * 2 - Partial comparison
14111 * @param {Function} [customizer] The function to customize comparisons.
14112 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
14113 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
14116 function baseIsEqual$2(value, other, bitmask, customizer, stack) {
14117 if (value === other) {
14121 if (value == null || other == null || !isObjectLike$1(value) && !isObjectLike$1(other)) {
14122 return value !== value && other !== other;
14125 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$2, stack);
14128 var _baseIsEqual = baseIsEqual$2;
14130 var Stack = _Stack,
14131 baseIsEqual$1 = _baseIsEqual;
14132 /** Used to compose bitmasks for value comparisons. */
14134 var COMPARE_PARTIAL_FLAG$1 = 1,
14135 COMPARE_UNORDERED_FLAG$1 = 2;
14137 * The base implementation of `_.isMatch` without support for iteratee shorthands.
14140 * @param {Object} object The object to inspect.
14141 * @param {Object} source The object of property values to match.
14142 * @param {Array} matchData The property names, values, and compare flags to match.
14143 * @param {Function} [customizer] The function to customize comparisons.
14144 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
14147 function baseIsMatch$1(object, source, matchData, customizer) {
14148 var index = matchData.length,
14150 noCustomizer = !customizer;
14152 if (object == null) {
14156 object = Object(object);
14159 var data = matchData[index];
14161 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
14166 while (++index < length) {
14167 data = matchData[index];
14169 objValue = object[key],
14170 srcValue = data[1];
14172 if (noCustomizer && data[2]) {
14173 if (objValue === undefined && !(key in object)) {
14177 var stack = new Stack();
14180 var result = customizer(objValue, srcValue, key, object, source, stack);
14183 if (!(result === undefined ? baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
14192 var _baseIsMatch = baseIsMatch$1;
14194 var isObject$1 = isObject_1;
14196 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
14199 * @param {*} value The value to check.
14200 * @returns {boolean} Returns `true` if `value` if suitable for strict
14201 * equality comparisons, else `false`.
14204 function isStrictComparable$2(value) {
14205 return value === value && !isObject$1(value);
14208 var _isStrictComparable = isStrictComparable$2;
14210 var isStrictComparable$1 = _isStrictComparable,
14213 * Gets the property names, values, and compare flags of `object`.
14216 * @param {Object} object The object to query.
14217 * @returns {Array} Returns the match data of `object`.
14220 function getMatchData$1(object) {
14221 var result = keys(object),
14222 length = result.length;
14225 var key = result[length],
14226 value = object[key];
14227 result[length] = [key, value, isStrictComparable$1(value)];
14233 var _getMatchData = getMatchData$1;
14236 * A specialized version of `matchesProperty` for source values suitable
14237 * for strict equality comparisons, i.e. `===`.
14240 * @param {string} key The key of the property to get.
14241 * @param {*} srcValue The value to match.
14242 * @returns {Function} Returns the new spec function.
14245 function matchesStrictComparable$2(key, srcValue) {
14246 return function (object) {
14247 if (object == null) {
14251 return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
14255 var _matchesStrictComparable = matchesStrictComparable$2;
14257 var baseIsMatch = _baseIsMatch,
14258 getMatchData = _getMatchData,
14259 matchesStrictComparable$1 = _matchesStrictComparable;
14261 * The base implementation of `_.matches` which doesn't clone `source`.
14264 * @param {Object} source The object of property values to match.
14265 * @returns {Function} Returns the new spec function.
14268 function baseMatches$1(source) {
14269 var matchData = getMatchData(source);
14271 if (matchData.length == 1 && matchData[0][2]) {
14272 return matchesStrictComparable$1(matchData[0][0], matchData[0][1]);
14275 return function (object) {
14276 return object === source || baseIsMatch(object, source, matchData);
14280 var _baseMatches = baseMatches$1;
14282 var baseGetTag = _baseGetTag,
14283 isObjectLike = isObjectLike_1;
14284 /** `Object#toString` result references. */
14286 var symbolTag = '[object Symbol]';
14288 * Checks if `value` is classified as a `Symbol` primitive or object.
14294 * @param {*} value The value to check.
14295 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
14298 * _.isSymbol(Symbol.iterator);
14301 * _.isSymbol('abc');
14305 function isSymbol$3(value) {
14306 return typeof value == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
14309 var isSymbol_1 = isSymbol$3;
14311 var isArray$6 = isArray_1,
14312 isSymbol$2 = isSymbol_1;
14313 /** Used to match property names within property paths. */
14315 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
14316 reIsPlainProp = /^\w*$/;
14318 * Checks if `value` is a property name and not a property path.
14321 * @param {*} value The value to check.
14322 * @param {Object} [object] The object to query keys on.
14323 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
14326 function isKey$3(value, object) {
14327 if (isArray$6(value)) {
14331 var type = typeof value;
14333 if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol$2(value)) {
14337 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
14340 var _isKey = isKey$3;
14342 var MapCache = _MapCache;
14343 /** Error message constants. */
14345 var FUNC_ERROR_TEXT = 'Expected a function';
14347 * Creates a function that memoizes the result of `func`. If `resolver` is
14348 * provided, it determines the cache key for storing the result based on the
14349 * arguments provided to the memoized function. By default, the first argument
14350 * provided to the memoized function is used as the map cache key. The `func`
14351 * is invoked with the `this` binding of the memoized function.
14353 * **Note:** The cache is exposed as the `cache` property on the memoized
14354 * function. Its creation may be customized by replacing the `_.memoize.Cache`
14355 * constructor with one whose instances implement the
14356 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
14357 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
14362 * @category Function
14363 * @param {Function} func The function to have its output memoized.
14364 * @param {Function} [resolver] The function to resolve the cache key.
14365 * @returns {Function} Returns the new memoized function.
14368 * var object = { 'a': 1, 'b': 2 };
14369 * var other = { 'c': 3, 'd': 4 };
14371 * var values = _.memoize(_.values);
14382 * // Modify the result cache.
14383 * values.cache.set(object, ['a', 'b']);
14387 * // Replace `_.memoize.Cache`.
14388 * _.memoize.Cache = WeakMap;
14391 function memoize$1(func, resolver) {
14392 if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {
14393 throw new TypeError(FUNC_ERROR_TEXT);
14396 var memoized = function () {
14397 var args = arguments,
14398 key = resolver ? resolver.apply(this, args) : args[0],
14399 cache = memoized.cache;
14401 if (cache.has(key)) {
14402 return cache.get(key);
14405 var result = func.apply(this, args);
14406 memoized.cache = cache.set(key, result) || cache;
14410 memoized.cache = new (memoize$1.Cache || MapCache)();
14412 } // Expose `MapCache`.
14415 memoize$1.Cache = MapCache;
14416 var memoize_1 = memoize$1;
14418 var memoize = memoize_1;
14419 /** Used as the maximum memoize cache size. */
14421 var MAX_MEMOIZE_SIZE = 500;
14423 * A specialized version of `_.memoize` which clears the memoized function's
14424 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
14427 * @param {Function} func The function to have its output memoized.
14428 * @returns {Function} Returns the new memoized function.
14431 function memoizeCapped$1(func) {
14432 var result = memoize(func, function (key) {
14433 if (cache.size === MAX_MEMOIZE_SIZE) {
14439 var cache = result.cache;
14443 var _memoizeCapped = memoizeCapped$1;
14445 var memoizeCapped = _memoizeCapped;
14446 /** Used to match property names within property paths. */
14448 var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
14449 /** Used to match backslashes in property paths. */
14451 var reEscapeChar = /\\(\\)?/g;
14453 * Converts `string` to a property path array.
14456 * @param {string} string The string to convert.
14457 * @returns {Array} Returns the property path array.
14460 var stringToPath$1 = memoizeCapped(function (string) {
14463 if (string.charCodeAt(0) === 46
14469 string.replace(rePropName, function (match, number, quote, subString) {
14470 result.push(quote ? subString.replace(reEscapeChar, '$1') : number || match);
14474 var _stringToPath = stringToPath$1;
14477 * A specialized version of `_.map` for arrays without support for iteratee
14481 * @param {Array} [array] The array to iterate over.
14482 * @param {Function} iteratee The function invoked per iteration.
14483 * @returns {Array} Returns the new mapped array.
14486 function arrayMap$1(array, iteratee) {
14488 length = array == null ? 0 : array.length,
14489 result = Array(length);
14491 while (++index < length) {
14492 result[index] = iteratee(array[index], index, array);
14498 var _arrayMap = arrayMap$1;
14500 var Symbol$2 = _Symbol,
14501 arrayMap = _arrayMap,
14502 isArray$5 = isArray_1,
14503 isSymbol$1 = isSymbol_1;
14504 /** Used as references for various `Number` constants. */
14506 var INFINITY$1 = 1 / 0;
14507 /** Used to convert symbols to primitives and strings. */
14509 var symbolProto = Symbol$2 ? Symbol$2.prototype : undefined,
14510 symbolToString = symbolProto ? symbolProto.toString : undefined;
14512 * The base implementation of `_.toString` which doesn't convert nullish
14513 * values to empty strings.
14516 * @param {*} value The value to process.
14517 * @returns {string} Returns the string.
14520 function baseToString$1(value) {
14521 // Exit early for strings to avoid a performance hit in some environments.
14522 if (typeof value == 'string') {
14526 if (isArray$5(value)) {
14527 // Recursively convert values (susceptible to call stack limits).
14528 return arrayMap(value, baseToString$1) + '';
14531 if (isSymbol$1(value)) {
14532 return symbolToString ? symbolToString.call(value) : '';
14535 var result = value + '';
14536 return result == '0' && 1 / value == -INFINITY$1 ? '-0' : result;
14539 var _baseToString = baseToString$1;
14541 var baseToString = _baseToString;
14543 * Converts `value` to a string. An empty string is returned for `null`
14544 * and `undefined` values. The sign of `-0` is preserved.
14550 * @param {*} value The value to convert.
14551 * @returns {string} Returns the converted string.
14554 * _.toString(null);
14560 * _.toString([1, 2, 3]);
14564 function toString$1(value) {
14565 return value == null ? '' : baseToString(value);
14568 var toString_1 = toString$1;
14570 var isArray$4 = isArray_1,
14572 stringToPath = _stringToPath,
14573 toString = toString_1;
14575 * Casts `value` to a path array if it's not one.
14578 * @param {*} value The value to inspect.
14579 * @param {Object} [object] The object to query keys on.
14580 * @returns {Array} Returns the cast property path array.
14583 function castPath$4(value, object) {
14584 if (isArray$4(value)) {
14588 return isKey$2(value, object) ? [value] : stringToPath(toString(value));
14591 var _castPath = castPath$4;
14593 var isSymbol = isSymbol_1;
14594 /** Used as references for various `Number` constants. */
14596 var INFINITY = 1 / 0;
14598 * Converts `value` to a string key if it's not a string or symbol.
14601 * @param {*} value The value to inspect.
14602 * @returns {string|symbol} Returns the key.
14605 function toKey$5(value) {
14606 if (typeof value == 'string' || isSymbol(value)) {
14610 var result = value + '';
14611 return result == '0' && 1 / value == -INFINITY ? '-0' : result;
14614 var _toKey = toKey$5;
14616 var castPath$3 = _castPath,
14619 * The base implementation of `_.get` without support for default values.
14622 * @param {Object} object The object to query.
14623 * @param {Array|string} path The path of the property to get.
14624 * @returns {*} Returns the resolved value.
14627 function baseGet$3(object, path) {
14628 path = castPath$3(path, object);
14630 length = path.length;
14632 while (object != null && index < length) {
14633 object = object[toKey$4(path[index++])];
14636 return index && index == length ? object : undefined;
14639 var _baseGet = baseGet$3;
14641 var baseGet$2 = _baseGet;
14643 * Gets the value at `path` of `object`. If the resolved value is
14644 * `undefined`, the `defaultValue` is returned in its place.
14650 * @param {Object} object The object to query.
14651 * @param {Array|string} path The path of the property to get.
14652 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
14653 * @returns {*} Returns the resolved value.
14656 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
14658 * _.get(object, 'a[0].b.c');
14661 * _.get(object, ['a', '0', 'b', 'c']);
14664 * _.get(object, 'a.b.c', 'default');
14668 function get$1(object, path, defaultValue) {
14669 var result = object == null ? undefined : baseGet$2(object, path);
14670 return result === undefined ? defaultValue : result;
14676 * The base implementation of `_.hasIn` without support for deep paths.
14679 * @param {Object} [object] The object to query.
14680 * @param {Array|string} key The key to check.
14681 * @returns {boolean} Returns `true` if `key` exists, else `false`.
14684 function baseHasIn$1(object, key) {
14685 return object != null && key in Object(object);
14688 var _baseHasIn = baseHasIn$1;
14690 var castPath$2 = _castPath,
14691 isArguments$1 = isArguments_1,
14692 isArray$3 = isArray_1,
14693 isIndex$1 = _isIndex,
14694 isLength = isLength_1,
14697 * Checks if `path` exists on `object`.
14700 * @param {Object} object The object to query.
14701 * @param {Array|string} path The path to check.
14702 * @param {Function} hasFunc The function to check properties.
14703 * @returns {boolean} Returns `true` if `path` exists, else `false`.
14706 function hasPath$1(object, path, hasFunc) {
14707 path = castPath$2(path, object);
14709 length = path.length,
14712 while (++index < length) {
14713 var key = toKey$3(path[index]);
14715 if (!(result = object != null && hasFunc(object, key))) {
14719 object = object[key];
14722 if (result || ++index != length) {
14726 length = object == null ? 0 : object.length;
14727 return !!length && isLength(length) && isIndex$1(key, length) && (isArray$3(object) || isArguments$1(object));
14730 var _hasPath = hasPath$1;
14732 var baseHasIn = _baseHasIn,
14733 hasPath = _hasPath;
14735 * Checks if `path` is a direct or inherited property of `object`.
14741 * @param {Object} object The object to query.
14742 * @param {Array|string} path The path to check.
14743 * @returns {boolean} Returns `true` if `path` exists, else `false`.
14746 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
14748 * _.hasIn(object, 'a');
14751 * _.hasIn(object, 'a.b');
14754 * _.hasIn(object, ['a', 'b']);
14757 * _.hasIn(object, 'b');
14761 function hasIn$2(object, path) {
14762 return object != null && hasPath(object, path, baseHasIn);
14765 var hasIn_1 = hasIn$2;
14767 var baseIsEqual = _baseIsEqual,
14771 isStrictComparable = _isStrictComparable,
14772 matchesStrictComparable = _matchesStrictComparable,
14774 /** Used to compose bitmasks for value comparisons. */
14776 var COMPARE_PARTIAL_FLAG = 1,
14777 COMPARE_UNORDERED_FLAG = 2;
14779 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
14782 * @param {string} path The path of the property to get.
14783 * @param {*} srcValue The value to match.
14784 * @returns {Function} Returns the new spec function.
14787 function baseMatchesProperty$1(path, srcValue) {
14788 if (isKey$1(path) && isStrictComparable(srcValue)) {
14789 return matchesStrictComparable(toKey$2(path), srcValue);
14792 return function (object) {
14793 var objValue = get(object, path);
14794 return objValue === undefined && objValue === srcValue ? hasIn$1(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
14798 var _baseMatchesProperty = baseMatchesProperty$1;
14801 * This method returns the first argument it receives.
14807 * @param {*} value Any value.
14808 * @returns {*} Returns `value`.
14811 * var object = { 'a': 1 };
14813 * console.log(_.identity(object) === object);
14817 function identity$2(value) {
14821 var identity_1 = identity$2;
14824 * The base implementation of `_.property` without support for deep paths.
14827 * @param {string} key The key of the property to get.
14828 * @returns {Function} Returns the new accessor function.
14831 function baseProperty$1(key) {
14832 return function (object) {
14833 return object == null ? undefined : object[key];
14837 var _baseProperty = baseProperty$1;
14839 var baseGet$1 = _baseGet;
14841 * A specialized version of `baseProperty` which supports deep paths.
14844 * @param {Array|string} path The path of the property to get.
14845 * @returns {Function} Returns the new accessor function.
14848 function basePropertyDeep$1(path) {
14849 return function (object) {
14850 return baseGet$1(object, path);
14854 var _basePropertyDeep = basePropertyDeep$1;
14856 var baseProperty = _baseProperty,
14857 basePropertyDeep = _basePropertyDeep,
14861 * Creates a function that returns the value at `path` of a given object.
14867 * @param {Array|string} path The path of the property to get.
14868 * @returns {Function} Returns the new accessor function.
14872 * { 'a': { 'b': 2 } },
14873 * { 'a': { 'b': 1 } }
14876 * _.map(objects, _.property('a.b'));
14879 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
14883 function property$1(path) {
14884 return isKey(path) ? baseProperty(toKey$1(path)) : basePropertyDeep(path);
14887 var property_1 = property$1;
14889 var baseMatches = _baseMatches,
14890 baseMatchesProperty = _baseMatchesProperty,
14891 identity$1 = identity_1,
14892 isArray$2 = isArray_1,
14893 property = property_1;
14895 * The base implementation of `_.iteratee`.
14898 * @param {*} [value=_.identity] The value to convert to an iteratee.
14899 * @returns {Function} Returns the iteratee.
14902 function baseIteratee$1(value) {
14903 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
14904 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
14905 if (typeof value == 'function') {
14909 if (value == null) {
14913 if (typeof value == 'object') {
14914 return isArray$2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
14917 return property(value);
14920 var _baseIteratee = baseIteratee$1;
14922 var arrayAggregator = _arrayAggregator,
14923 baseAggregator = _baseAggregator,
14924 baseIteratee = _baseIteratee,
14925 isArray$1 = isArray_1;
14927 * Creates a function like `_.groupBy`.
14930 * @param {Function} setter The function to set accumulator values.
14931 * @param {Function} [initializer] The accumulator object initializer.
14932 * @returns {Function} Returns the new aggregator function.
14935 function createAggregator$2(setter, initializer) {
14936 return function (collection, iteratee) {
14937 var func = isArray$1(collection) ? arrayAggregator : baseAggregator,
14938 accumulator = initializer ? initializer() : {};
14939 return func(collection, setter, baseIteratee(iteratee), accumulator);
14943 var _createAggregator = createAggregator$2;
14945 var createAggregator$1 = _createAggregator;
14947 * Creates an array of elements split into two groups, the first of which
14948 * contains elements `predicate` returns truthy for, the second of which
14949 * contains elements `predicate` returns falsey for. The predicate is
14950 * invoked with one argument: (value).
14955 * @category Collection
14956 * @param {Array|Object} collection The collection to iterate over.
14957 * @param {Function} [predicate=_.identity] The function invoked per iteration.
14958 * @returns {Array} Returns the array of grouped elements.
14962 * { 'user': 'barney', 'age': 36, 'active': false },
14963 * { 'user': 'fred', 'age': 40, 'active': true },
14964 * { 'user': 'pebbles', 'age': 1, 'active': false }
14967 * _.partition(users, function(o) { return o.active; });
14968 * // => objects for [['fred'], ['barney', 'pebbles']]
14970 * // The `_.matches` iteratee shorthand.
14971 * _.partition(users, { 'age': 1, 'active': false });
14972 * // => objects for [['pebbles'], ['barney', 'fred']]
14974 * // The `_.matchesProperty` iteratee shorthand.
14975 * _.partition(users, ['active', false]);
14976 * // => objects for [['barney', 'pebbles'], ['fred']]
14978 * // The `_.property` iteratee shorthand.
14979 * _.partition(users, 'active');
14980 * // => objects for [['fred'], ['barney', 'pebbles']]
14983 var partition$1 = createAggregator$1(function (result, value, key) {
14984 result[key ? 0 : 1].push(value);
14988 var partition_1 = partition$1;
14990 const partition = partition_1;
14992 var createMinimistOptions$2 = function createMinimistOptions(detailedOptions) {
14993 const [boolean, string] = partition(detailedOptions, ({
14995 }) => type === "boolean").map(detailedOptions => detailedOptions.flatMap(({
14998 }) => alias ? [name, alias] : [name]));
14999 const defaults = Object.fromEntries(detailedOptions.filter(option => !option.deprecated && (!option.forwardToApi || option.name === "plugin" || option.name === "plugin-search-dir") && option.default !== undefined).map(option => [option.name, option.default]));
15001 // we use vnopts' AliasSchema to handle aliases for better error messages
15009 const dashify$1 = dashify$2; // eslint-disable-next-line no-restricted-modules
15011 const prettier$5 = require$$3;
15012 const minimist$1 = minimist_1;
15015 } = prettierInternal;
15016 const createMinimistOptions$1 = createMinimistOptions$2;
15018 function getOptions(argv, detailedOptions) {
15019 return Object.fromEntries(detailedOptions.filter(({
15021 }) => forwardToApi).map(({
15024 }) => [forwardToApi, argv[name]]));
15027 function cliifyOptions(object, apiDetailedOptionMap) {
15028 return Object.fromEntries(Object.entries(object || {}).map(([key, value]) => {
15029 const apiOption = apiDetailedOptionMap[key];
15030 const cliKey = apiOption ? apiOption.name : key;
15031 return [dashify$1(cliKey), value];
15035 function createApiDetailedOptionMap(detailedOptions) {
15036 return Object.fromEntries(detailedOptions.filter(option => option.forwardToApi && option.forwardToApi !== option.name).map(option => [option.forwardToApi, option]));
15039 function parseArgsToOptions(context, overrideDefaults) {
15040 const minimistOptions = createMinimistOptions$1(context.detailedOptions);
15041 const apiDetailedOptionMap = createApiDetailedOptionMap(context.detailedOptions);
15042 return getOptions(optionsNormalizer.normalizeCliOptions(minimist$1(context.rawArguments, {
15043 string: minimistOptions.string,
15044 boolean: minimistOptions.boolean,
15045 default: cliifyOptions(overrideDefaults, apiDetailedOptionMap)
15046 }), context.detailedOptions, {
15048 }), context.detailedOptions);
15051 async function getOptionsOrDie(context, filePath) {
15053 if (context.argv.config === false) {
15054 context.logger.debug("'--no-config' option found, skip loading config file.");
15058 context.logger.debug(context.argv.config ? `load config file from '${context.argv.config}'` : `resolve config from '${filePath}'`);
15059 const options = await prettier$5.resolveConfig(filePath, {
15060 editorconfig: context.argv.editorconfig,
15061 config: context.argv.config
15063 context.logger.debug("loaded options `" + JSON.stringify(options) + "`");
15066 context.logger.error(`Invalid configuration file \`${filePath}\`: ` + error.message);
15071 function applyConfigPrecedence(context, options) {
15073 switch (context.argv["config-precedence"]) {
15074 case "cli-override":
15075 return parseArgsToOptions(context, options);
15077 case "file-override":
15078 return Object.assign(Object.assign({}, parseArgsToOptions(context)), options);
15080 case "prefer-file":
15081 return options || parseArgsToOptions(context);
15084 /* istanbul ignore next */
15085 context.logger.error(error.toString());
15086 /* istanbul ignore next */
15092 async function getOptionsForFile$1(context, filepath) {
15093 const options = await getOptionsOrDie(context, filepath);
15094 const hasPlugins = options && options.plugins;
15097 context.pushContextPlugins(options.plugins);
15100 const appliedOptions = Object.assign({
15102 }, applyConfigPrecedence(context, options && optionsNormalizer.normalizeApiOptions(options, context.supportOptions, {
15103 logger: context.logger
15105 context.logger.debug(`applied config-precedence (${context.argv["config-precedence"]}): ` + `${JSON.stringify(appliedOptions)}`);
15108 context.popContextPlugins();
15111 return appliedOptions;
15115 getOptionsForFile: getOptionsForFile$1,
15116 createMinimistOptions: createMinimistOptions$1
15121 } = require$$4; // Some CI pipelines incorrectly report process.stdout.isTTY status,
15122 // which causes unwanted lines in the output. An additional check for isCI() helps.
15123 // See https://github.com/prettier/prettier/issues/5801
15125 var isTty = function isTTY() {
15126 return process.stdout.isTTY && !isCI();
15133 /*istanbul ignore start*/
15135 (function (exports) {
15137 Object.defineProperty(exports, "__esModule", {
15140 exports["default"] = Diff;
15141 /*istanbul ignore end*/
15146 /*istanbul ignore start*/
15148 /*istanbul ignore end*/
15149 diff: function diff(oldString, newString) {
15150 /*istanbul ignore start*/
15152 /*istanbul ignore end*/
15153 options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
15154 var callback = options.callback;
15156 if (typeof options === 'function') {
15157 callback = options;
15161 this.options = options;
15164 function done(value) {
15166 setTimeout(function () {
15167 callback(undefined, value);
15173 } // Allow subclasses to massage the input prior to running
15176 oldString = this.castInput(oldString);
15177 newString = this.castInput(newString);
15178 oldString = this.removeEmpty(this.tokenize(oldString));
15179 newString = this.removeEmpty(this.tokenize(newString));
15180 var newLen = newString.length,
15181 oldLen = oldString.length;
15182 var editLength = 1;
15183 var maxEditLength = newLen + oldLen;
15187 }]; // Seed editLength = 0, i.e. the content starts with the same values
15189 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
15191 if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
15192 // Identity per the equality and tokenizer
15194 value: this.join(newString),
15195 count: newString.length
15197 } // Main worker method. checks all permutations of a given edit length for acceptance.
15200 function execEditLength() {
15201 for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
15203 /*istanbul ignore start*/
15205 /*istanbul ignore end*/
15208 var addPath = bestPath[diagonalPath - 1],
15209 removePath = bestPath[diagonalPath + 1],
15210 _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
15213 // No one else is going to attempt to use this value, clear it
15214 bestPath[diagonalPath - 1] = undefined;
15217 var canAdd = addPath && addPath.newPos + 1 < newLen,
15218 canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
15220 if (!canAdd && !canRemove) {
15221 // If this path is a terminal then prune
15222 bestPath[diagonalPath] = undefined;
15224 } // Select the diagonal that we want to branch from. We select the prior
15225 // path whose position in the new string is the farthest from the origin
15226 // and does not pass the bounds of the diff graph
15229 if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
15230 basePath = clonePath(removePath);
15231 self.pushComponent(basePath.components, undefined, true);
15233 basePath = addPath; // No need to clone, we've pulled it from the list
15236 self.pushComponent(basePath.components, true, undefined);
15239 _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); // If we have hit the end of both strings, then we are done
15241 if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
15242 return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
15244 // Otherwise track this path as a potential candidate and continue.
15245 bestPath[diagonalPath] = basePath;
15250 } // Performs the length of edit iteration. Is a bit fugly as this has to support the
15251 // sync and async mode which is never fun. Loops over execEditLength until a value
15257 setTimeout(function () {
15258 // This should not happen, but we want to be safe.
15260 /* istanbul ignore next */
15261 if (editLength > maxEditLength) {
15265 if (!execEditLength()) {
15271 while (editLength <= maxEditLength) {
15272 var ret = execEditLength();
15281 /*istanbul ignore start*/
15283 /*istanbul ignore end*/
15284 pushComponent: function pushComponent(components, added, removed) {
15285 var last = components[components.length - 1];
15287 if (last && last.added === added && last.removed === removed) {
15288 // We need to clone here as the component clone operation is just
15289 // as shallow array clone
15290 components[components.length - 1] = {
15291 count: last.count + 1,
15304 /*istanbul ignore start*/
15306 /*istanbul ignore end*/
15307 extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
15308 var newLen = newString.length,
15309 oldLen = oldString.length,
15310 newPos = basePath.newPos,
15311 oldPos = newPos - diagonalPath,
15314 while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
15321 basePath.components.push({
15326 basePath.newPos = newPos;
15330 /*istanbul ignore start*/
15332 /*istanbul ignore end*/
15333 equals: function equals(left, right) {
15334 if (this.options.comparator) {
15335 return this.options.comparator(left, right);
15337 return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
15341 /*istanbul ignore start*/
15343 /*istanbul ignore end*/
15344 removeEmpty: function removeEmpty(array) {
15347 for (var i = 0; i < array.length; i++) {
15349 ret.push(array[i]);
15356 /*istanbul ignore start*/
15358 /*istanbul ignore end*/
15359 castInput: function castInput(value) {
15363 /*istanbul ignore start*/
15365 /*istanbul ignore end*/
15366 tokenize: function tokenize(value) {
15367 return value.split('');
15370 /*istanbul ignore start*/
15372 /*istanbul ignore end*/
15373 join: function join(chars) {
15374 return chars.join('');
15378 function buildValues(diff, components, newString, oldString, useLongestToken) {
15379 var componentPos = 0,
15380 componentLen = components.length,
15384 for (; componentPos < componentLen; componentPos++) {
15385 var component = components[componentPos];
15387 if (!component.removed) {
15388 if (!component.added && useLongestToken) {
15389 var value = newString.slice(newPos, newPos + component.count);
15390 value = value.map(function (value, i) {
15391 var oldValue = oldString[oldPos + i];
15392 return oldValue.length > value.length ? oldValue : value;
15394 component.value = diff.join(value);
15396 component.value = diff.join(newString.slice(newPos, newPos + component.count));
15399 newPos += component.count; // Common case
15401 if (!component.added) {
15402 oldPos += component.count;
15405 component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
15406 oldPos += component.count; // Reverse add and remove so removes are output first to match common convention
15407 // The diffing algorithm is tied to add then remove output and this is the simplest
15408 // route to get the desired output with minimal overhead.
15410 if (componentPos && components[componentPos - 1].added) {
15411 var tmp = components[componentPos - 1];
15412 components[componentPos - 1] = components[componentPos];
15413 components[componentPos] = tmp;
15416 } // Special case handle for when one terminal is ignored (i.e. whitespace).
15417 // For this case we merge the terminal into the prior string and drop the change.
15418 // This is only available for string mode.
15421 var lastComponent = components[componentLen - 1];
15423 if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
15424 components[componentLen - 2].value += lastComponent.value;
15431 function clonePath(path) {
15433 newPos: path.newPos,
15434 components: path.components.slice(0)
15439 var character = {};
15441 /*istanbul ignore start*/
15443 Object.defineProperty(character, "__esModule", {
15446 character.diffChars = diffChars;
15447 character.characterDiff = void 0;
15448 /*istanbul ignore end*/
15451 /*istanbul ignore start*/
15452 _base$6 = _interopRequireDefault$7(base)
15453 /*istanbul ignore end*/
15455 /*istanbul ignore start*/
15458 function _interopRequireDefault$7(obj) {
15459 return obj && obj.__esModule ? obj : {
15463 /*istanbul ignore end*/
15466 var characterDiff = new
15467 /*istanbul ignore start*/
15469 /*istanbul ignore end*/
15471 /*istanbul ignore start*/
15473 /*istanbul ignore end*/
15475 /*istanbul ignore start*/
15477 character.characterDiff = characterDiff;
15478 /*istanbul ignore end*/
15480 function diffChars(oldStr, newStr, options) {
15481 return characterDiff.diff(oldStr, newStr, options);
15488 /*istanbul ignore start*/
15490 Object.defineProperty(params, "__esModule", {
15493 params.generateOptions = generateOptions;
15494 /*istanbul ignore end*/
15496 function generateOptions(options, defaults) {
15497 if (typeof options === 'function') {
15498 defaults.callback = options;
15499 } else if (options) {
15500 for (var name in options) {
15501 /* istanbul ignore else */
15502 if (options.hasOwnProperty(name)) {
15503 defaults[name] = options[name];
15511 /*istanbul ignore start*/
15513 Object.defineProperty(word, "__esModule", {
15516 word.diffWords = diffWords;
15517 word.diffWordsWithSpace = diffWordsWithSpace;
15518 word.wordDiff = void 0;
15519 /*istanbul ignore end*/
15522 /*istanbul ignore start*/
15523 _base$5 = _interopRequireDefault$6(base)
15524 /*istanbul ignore end*/
15528 /*istanbul ignore start*/
15530 /*istanbul ignore end*/
15532 /*istanbul ignore start*/
15534 function _interopRequireDefault$6(obj) {
15535 return obj && obj.__esModule ? obj : {
15539 /*istanbul ignore end*/
15540 // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
15542 // Ranges and exceptions:
15543 // Latin-1 Supplement, 0080–00FF
15544 // - U+00D7 × Multiplication sign
15545 // - U+00F7 ÷ Division sign
15546 // Latin Extended-A, 0100–017F
15547 // Latin Extended-B, 0180–024F
15548 // IPA Extensions, 0250–02AF
15549 // Spacing Modifier Letters, 02B0–02FF
15550 // - U+02C7 ˇ ˇ Caron
15551 // - U+02D8 ˘ ˘ Breve
15552 // - U+02D9 ˙ ˙ Dot Above
15553 // - U+02DA ˚ ˚ Ring Above
15554 // - U+02DB ˛ ˛ Ogonek
15555 // - U+02DC ˜ ˜ Small Tilde
15556 // - U+02DD ˝ ˝ Double Acute Accent
15557 // Latin Extended Additional, 1E00–1EFF
15560 var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
15561 var reWhitespace = /\S/;
15563 /*istanbul ignore start*/
15565 /*istanbul ignore end*/
15567 /*istanbul ignore start*/
15569 /*istanbul ignore end*/
15571 /*istanbul ignore start*/
15573 word.wordDiff = wordDiff;
15574 /*istanbul ignore end*/
15576 wordDiff.equals = function (left, right) {
15577 if (this.options.ignoreCase) {
15578 left = left.toLowerCase();
15579 right = right.toLowerCase();
15582 return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
15585 wordDiff.tokenize = function (value) {
15586 // All whitespace symbols except newline group into one token, each newline - in separate token
15587 var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
15589 for (var i = 0; i < tokens.length - 1; i++) {
15590 // If we have an empty string in the next field and we have only word chars before and after, merge
15591 if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
15592 tokens[i] += tokens[i + 2];
15593 tokens.splice(i + 1, 2);
15601 function diffWords(oldStr, newStr, options) {
15603 /*istanbul ignore start*/
15604 (/*istanbul ignore end*/
15606 /*istanbul ignore start*/
15608 /*istanbul ignore end*/
15610 /*istanbul ignore start*/
15612 /*istanbul ignore end*/
15614 ignoreWhitespace: true
15616 return wordDiff.diff(oldStr, newStr, options);
15619 function diffWordsWithSpace(oldStr, newStr, options) {
15620 return wordDiff.diff(oldStr, newStr, options);
15625 /*istanbul ignore start*/
15627 Object.defineProperty(line, "__esModule", {
15630 line.diffLines = diffLines;
15631 line.diffTrimmedLines = diffTrimmedLines;
15632 line.lineDiff = void 0;
15633 /*istanbul ignore end*/
15636 /*istanbul ignore start*/
15637 _base$4 = _interopRequireDefault$5(base)
15638 /*istanbul ignore end*/
15642 /*istanbul ignore start*/
15644 /*istanbul ignore end*/
15646 /*istanbul ignore start*/
15648 function _interopRequireDefault$5(obj) {
15649 return obj && obj.__esModule ? obj : {
15653 /*istanbul ignore end*/
15657 /*istanbul ignore start*/
15659 /*istanbul ignore end*/
15661 /*istanbul ignore start*/
15663 /*istanbul ignore end*/
15665 /*istanbul ignore start*/
15667 line.lineDiff = lineDiff;
15668 /*istanbul ignore end*/
15670 lineDiff.tokenize = function (value) {
15672 linesAndNewlines = value.split(/(\n|\r\n)/); // Ignore the final empty token that occurs if the string ends with a new line
15674 if (!linesAndNewlines[linesAndNewlines.length - 1]) {
15675 linesAndNewlines.pop();
15676 } // Merge the content and line separators into single tokens
15679 for (var i = 0; i < linesAndNewlines.length; i++) {
15680 var line = linesAndNewlines[i];
15682 if (i % 2 && !this.options.newlineIsToken) {
15683 retLines[retLines.length - 1] += line;
15685 if (this.options.ignoreWhitespace) {
15686 line = line.trim();
15689 retLines.push(line);
15696 function diffLines(oldStr, newStr, callback) {
15697 return lineDiff.diff(oldStr, newStr, callback);
15700 function diffTrimmedLines(oldStr, newStr, callback) {
15702 /*istanbul ignore start*/
15703 (/*istanbul ignore end*/
15705 /*istanbul ignore start*/
15707 /*istanbul ignore end*/
15709 /*istanbul ignore start*/
15711 /*istanbul ignore end*/
15713 ignoreWhitespace: true
15715 return lineDiff.diff(oldStr, newStr, options);
15720 /*istanbul ignore start*/
15722 Object.defineProperty(sentence, "__esModule", {
15725 sentence.diffSentences = diffSentences;
15726 sentence.sentenceDiff = void 0;
15727 /*istanbul ignore end*/
15730 /*istanbul ignore start*/
15731 _base$3 = _interopRequireDefault$4(base)
15732 /*istanbul ignore end*/
15734 /*istanbul ignore start*/
15737 function _interopRequireDefault$4(obj) {
15738 return obj && obj.__esModule ? obj : {
15742 /*istanbul ignore end*/
15745 var sentenceDiff = new
15746 /*istanbul ignore start*/
15748 /*istanbul ignore end*/
15750 /*istanbul ignore start*/
15752 /*istanbul ignore end*/
15754 /*istanbul ignore start*/
15756 sentence.sentenceDiff = sentenceDiff;
15757 /*istanbul ignore end*/
15759 sentenceDiff.tokenize = function (value) {
15760 return value.split(/(\S.+?[.!?])(?=\s+|$)/);
15763 function diffSentences(oldStr, newStr, callback) {
15764 return sentenceDiff.diff(oldStr, newStr, callback);
15769 /*istanbul ignore start*/
15771 Object.defineProperty(css, "__esModule", {
15774 css.diffCss = diffCss;
15775 css.cssDiff = void 0;
15776 /*istanbul ignore end*/
15779 /*istanbul ignore start*/
15780 _base$2 = _interopRequireDefault$3(base)
15781 /*istanbul ignore end*/
15783 /*istanbul ignore start*/
15786 function _interopRequireDefault$3(obj) {
15787 return obj && obj.__esModule ? obj : {
15791 /*istanbul ignore end*/
15795 /*istanbul ignore start*/
15797 /*istanbul ignore end*/
15799 /*istanbul ignore start*/
15801 /*istanbul ignore end*/
15803 /*istanbul ignore start*/
15805 css.cssDiff = cssDiff;
15806 /*istanbul ignore end*/
15808 cssDiff.tokenize = function (value) {
15809 return value.split(/([{}:;,]|\s+)/);
15812 function diffCss(oldStr, newStr, callback) {
15813 return cssDiff.diff(oldStr, newStr, callback);
15818 Object.defineProperty(json, "__esModule", {
15821 json.diffJson = diffJson;
15822 json.canonicalize = canonicalize;
15823 json.jsonDiff = void 0;
15824 /*istanbul ignore end*/
15827 /*istanbul ignore start*/
15828 _base$1 = _interopRequireDefault$2(base)
15829 /*istanbul ignore end*/
15833 /*istanbul ignore start*/
15835 /*istanbul ignore end*/
15837 /*istanbul ignore start*/
15839 function _interopRequireDefault$2(obj) {
15840 return obj && obj.__esModule ? obj : {
15845 function _typeof(obj) {
15846 "@babel/helpers - typeof";
15848 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
15849 _typeof = function _typeof(obj) {
15853 _typeof = function _typeof(obj) {
15854 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15858 return _typeof(obj);
15860 /*istanbul ignore end*/
15863 var objectPrototypeToString = Object.prototype.toString;
15865 /*istanbul ignore start*/
15867 /*istanbul ignore end*/
15869 /*istanbul ignore start*/
15871 /*istanbul ignore end*/
15872 ](); // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
15873 // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
15875 /*istanbul ignore start*/
15877 json.jsonDiff = jsonDiff;
15878 /*istanbul ignore end*/
15880 jsonDiff.useLongestToken = true;
15881 jsonDiff.tokenize =
15882 /*istanbul ignore start*/
15884 /*istanbul ignore end*/
15886 /*istanbul ignore start*/
15888 /*istanbul ignore end*/
15891 jsonDiff.castInput = function (value) {
15892 /*istanbul ignore start*/
15893 var _this$options =
15894 /*istanbul ignore end*/
15896 undefinedReplacement = _this$options.undefinedReplacement,
15897 _this$options$stringi = _this$options.stringifyReplacer,
15898 stringifyReplacer = _this$options$stringi === void 0 ? function (k, v)
15899 /*istanbul ignore start*/
15902 /*istanbul ignore end*/
15903 typeof v === 'undefined' ? undefinedReplacement : v
15905 } : _this$options$stringi;
15906 return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
15909 jsonDiff.equals = function (left, right) {
15911 /*istanbul ignore start*/
15913 /*istanbul ignore end*/
15915 /*istanbul ignore start*/
15917 /*istanbul ignore end*/
15918 ].prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
15922 function diffJson(oldObj, newObj, options) {
15923 return jsonDiff.diff(oldObj, newObj, options);
15924 } // This function handles the presence of circular references by bailing out when encountering an
15925 // object that is already on the "stack" of items being processed. Accepts an optional replacer
15928 function canonicalize(obj, stack, replacementStack, replacer, key) {
15929 stack = stack || [];
15930 replacementStack = replacementStack || [];
15933 obj = replacer(key, obj);
15938 for (i = 0; i < stack.length; i += 1) {
15939 if (stack[i] === obj) {
15940 return replacementStack[i];
15944 var canonicalizedObj;
15946 if ('[object Array]' === objectPrototypeToString.call(obj)) {
15948 canonicalizedObj = new Array(obj.length);
15949 replacementStack.push(canonicalizedObj);
15951 for (i = 0; i < obj.length; i += 1) {
15952 canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
15956 replacementStack.pop();
15957 return canonicalizedObj;
15960 if (obj && obj.toJSON) {
15961 obj = obj.toJSON();
15965 /*istanbul ignore start*/
15967 /*istanbul ignore end*/
15968 obj) === 'object' && obj !== null) {
15970 canonicalizedObj = {};
15971 replacementStack.push(canonicalizedObj);
15973 var sortedKeys = [],
15976 for (_key in obj) {
15977 /* istanbul ignore else */
15978 if (obj.hasOwnProperty(_key)) {
15979 sortedKeys.push(_key);
15985 for (i = 0; i < sortedKeys.length; i += 1) {
15986 _key = sortedKeys[i];
15987 canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
15991 replacementStack.pop();
15993 canonicalizedObj = obj;
15996 return canonicalizedObj;
16001 /*istanbul ignore start*/
16003 Object.defineProperty(array$1, "__esModule", {
16006 array$1.diffArrays = diffArrays;
16007 array$1.arrayDiff = void 0;
16008 /*istanbul ignore end*/
16011 /*istanbul ignore start*/
16012 _base = _interopRequireDefault$1(base)
16013 /*istanbul ignore end*/
16015 /*istanbul ignore start*/
16018 function _interopRequireDefault$1(obj) {
16019 return obj && obj.__esModule ? obj : {
16023 /*istanbul ignore end*/
16026 var arrayDiff = new
16027 /*istanbul ignore start*/
16029 /*istanbul ignore end*/
16031 /*istanbul ignore start*/
16033 /*istanbul ignore end*/
16035 /*istanbul ignore start*/
16037 array$1.arrayDiff = arrayDiff;
16038 /*istanbul ignore end*/
16040 arrayDiff.tokenize = function (value) {
16041 return value.slice();
16044 arrayDiff.join = arrayDiff.removeEmpty = function (value) {
16048 function diffArrays(oldArr, newArr, callback) {
16049 return arrayDiff.diff(oldArr, newArr, callback);
16056 /*istanbul ignore start*/
16058 Object.defineProperty(parse, "__esModule", {
16061 parse.parsePatch = parsePatch;
16062 /*istanbul ignore end*/
16064 function parsePatch(uniDiff) {
16065 /*istanbul ignore start*/
16067 /*istanbul ignore end*/
16068 options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16069 var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
16070 delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
16074 function parseIndex() {
16076 list.push(index); // Parse diff metadata
16078 while (i < diffstr.length) {
16079 var line = diffstr[i]; // File header found, end parsing diff metadata
16081 if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
16086 var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
16089 index.index = header[1];
16093 } // Parse file headers if they are defined. Unified diff requires them, but
16094 // there's no technical issues to have an isolated hunk without file header
16097 parseFileHeader(index);
16098 parseFileHeader(index); // Parse hunks
16102 while (i < diffstr.length) {
16103 var _line = diffstr[i];
16105 if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
16107 } else if (/^@@/.test(_line)) {
16108 index.hunks.push(parseHunk());
16109 } else if (_line && options.strict) {
16110 // Ignore unexpected content unless in strict mode
16111 throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
16116 } // Parses the --- and +++ headers, if none are found, no lines
16120 function parseFileHeader(index) {
16121 var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
16124 var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
16125 var data = fileHeader[2].split('\t', 2);
16126 var fileName = data[0].replace(/\\\\/g, '\\');
16128 if (/^".*"$/.test(fileName)) {
16129 fileName = fileName.substr(1, fileName.length - 2);
16132 index[keyPrefix + 'FileName'] = fileName;
16133 index[keyPrefix + 'Header'] = (data[1] || '').trim();
16137 // This assumes that we are at the start of a hunk.
16140 function parseHunk() {
16141 var chunkHeaderIndex = i,
16142 chunkHeaderLine = diffstr[i++],
16143 chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
16145 oldStart: +chunkHeader[1],
16146 oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
16147 newStart: +chunkHeader[3],
16148 newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
16151 }; // Unified Diff Format quirk: If the chunk size is 0,
16152 // the first number is one lower than one would expect.
16153 // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
16155 if (hunk.oldLines === 0) {
16156 hunk.oldStart += 1;
16159 if (hunk.newLines === 0) {
16160 hunk.newStart += 1;
16166 for (; i < diffstr.length; i++) {
16167 // Lines starting with '---' could be mistaken for the "remove line" operation
16168 // But they could be the header for the next file. Therefore prune such cases out.
16169 if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
16173 var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
16175 if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
16176 hunk.lines.push(diffstr[i]);
16177 hunk.linedelimiters.push(delimiters[i] || '\n');
16179 if (operation === '+') {
16181 } else if (operation === '-') {
16183 } else if (operation === ' ') {
16190 } // Handle the empty block count case
16193 if (!addCount && hunk.newLines === 1) {
16197 if (!removeCount && hunk.oldLines === 1) {
16199 } // Perform optional sanity checking
16202 if (options.strict) {
16203 if (addCount !== hunk.newLines) {
16204 throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
16207 if (removeCount !== hunk.oldLines) {
16208 throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
16215 while (i < diffstr.length) {
16222 var distanceIterator = {};
16224 /*istanbul ignore start*/
16226 (function (exports) {
16228 Object.defineProperty(exports, "__esModule", {
16231 exports["default"] = _default;
16232 /*istanbul ignore end*/
16233 // Iterator that traverses in the range of [min, max], stepping
16234 // by distance from a given start position. I.e. for [0, 4], with
16235 // start of 2, this will iterate 2, 3, 1, 4, 0.
16238 /*istanbul ignore start*/
16240 /*istanbul ignore end*/
16241 (start, minLine, maxLine) {
16242 var wantForward = true,
16243 backwardExhausted = false,
16244 forwardExhausted = false,
16246 return function iterator() {
16247 if (wantForward && !forwardExhausted) {
16248 if (backwardExhausted) {
16251 wantForward = false;
16252 } // Check if trying to fit beyond text length, and if not, check it fits
16253 // after offset location (or desired location on first iteration)
16256 if (start + localOffset <= maxLine) {
16257 return localOffset;
16260 forwardExhausted = true;
16263 if (!backwardExhausted) {
16264 if (!forwardExhausted) {
16265 wantForward = true;
16266 } // Check if trying to fit before text beginning, and if not, check it fits
16267 // before offset location
16270 if (minLine <= start - localOffset) {
16271 return -localOffset++;
16274 backwardExhausted = true;
16276 } // We tried to fit hunk before text beginning and beyond text length, then
16277 // hunk can't fit on the text. Return undefined
16281 })(distanceIterator);
16283 /*istanbul ignore start*/
16285 Object.defineProperty(apply$2, "__esModule", {
16288 apply$2.applyPatch = applyPatch;
16289 apply$2.applyPatches = applyPatches;
16290 /*istanbul ignore end*/
16293 /*istanbul ignore start*/
16295 /*istanbul ignore end*/
16299 /*istanbul ignore start*/
16300 _distanceIterator = _interopRequireDefault(distanceIterator)
16301 /*istanbul ignore end*/
16303 /*istanbul ignore start*/
16306 function _interopRequireDefault(obj) {
16307 return obj && obj.__esModule ? obj : {
16311 /*istanbul ignore end*/
16314 function applyPatch(source, uniDiff) {
16315 /*istanbul ignore start*/
16317 /*istanbul ignore end*/
16318 options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
16320 if (typeof uniDiff === 'string') {
16322 /*istanbul ignore start*/
16323 (/*istanbul ignore end*/
16325 /*istanbul ignore start*/
16327 /*istanbul ignore end*/
16329 /*istanbul ignore start*/
16331 /*istanbul ignore end*/
16335 if (Array.isArray(uniDiff)) {
16336 if (uniDiff.length > 1) {
16337 throw new Error('applyPatch only works with a single input.');
16340 uniDiff = uniDiff[0];
16341 } // Apply the diff to the input
16344 var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
16345 delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
16346 hunks = uniDiff.hunks,
16347 compareLine = options.compareLine || function (lineNumber, line, operation, patchContent)
16348 /*istanbul ignore start*/
16351 /*istanbul ignore end*/
16352 line === patchContent
16356 fuzzFactor = options.fuzzFactor || 0,
16362 * Checks if the hunk exactly fits on the provided location
16366 function hunkFits(hunk, toPos) {
16367 for (var j = 0; j < hunk.lines.length; j++) {
16368 var line = hunk.lines[j],
16369 operation = line.length > 0 ? line[0] : ' ',
16370 content = line.length > 0 ? line.substr(1) : line;
16372 if (operation === ' ' || operation === '-') {
16373 // Context sanity check
16374 if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
16377 if (errorCount > fuzzFactor) {
16387 } // Search best fit offsets for each hunk based on the previous ones
16390 for (var i = 0; i < hunks.length; i++) {
16391 var hunk = hunks[i],
16392 maxLine = lines.length - hunk.oldLines,
16394 toPos = offset + hunk.oldStart - 1;
16396 /*istanbul ignore start*/
16397 (/*istanbul ignore end*/
16399 /*istanbul ignore start*/
16400 0, _distanceIterator
16401 /*istanbul ignore end*/
16403 /*istanbul ignore start*/
16405 /*istanbul ignore end*/
16406 ])(toPos, minLine, maxLine);
16408 for (; localOffset !== undefined; localOffset = iterator()) {
16409 if (hunkFits(hunk, toPos + localOffset)) {
16410 hunk.offset = offset += localOffset;
16415 if (localOffset === undefined) {
16417 } // Set lower text limit to end of the current hunk, so next ones don't try
16418 // to fit over already patched text
16421 minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
16422 } // Apply patch hunks
16425 var diffOffset = 0;
16427 for (var _i = 0; _i < hunks.length; _i++) {
16428 var _hunk = hunks[_i],
16429 _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
16431 diffOffset += _hunk.newLines - _hunk.oldLines;
16433 for (var j = 0; j < _hunk.lines.length; j++) {
16434 var line = _hunk.lines[j],
16435 operation = line.length > 0 ? line[0] : ' ',
16436 content = line.length > 0 ? line.substr(1) : line,
16437 delimiter = _hunk.linedelimiters[j];
16439 if (operation === ' ') {
16441 } else if (operation === '-') {
16442 lines.splice(_toPos, 1);
16443 delimiters.splice(_toPos, 1);
16444 /* istanbul ignore else */
16445 } else if (operation === '+') {
16446 lines.splice(_toPos, 0, content);
16447 delimiters.splice(_toPos, 0, delimiter);
16449 } else if (operation === '\\') {
16450 var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
16452 if (previousOperation === '+') {
16453 removeEOFNL = true;
16454 } else if (previousOperation === '-') {
16459 } // Handle EOFNL insertion/removal
16463 while (!lines[lines.length - 1]) {
16467 } else if (addEOFNL) {
16469 delimiters.push('\n');
16472 for (var _k = 0; _k < lines.length - 1; _k++) {
16473 lines[_k] = lines[_k] + delimiters[_k];
16476 return lines.join('');
16477 } // Wrapper that supports multiple file patches via callbacks.
16480 function applyPatches(uniDiff, options) {
16481 if (typeof uniDiff === 'string') {
16483 /*istanbul ignore start*/
16484 (/*istanbul ignore end*/
16486 /*istanbul ignore start*/
16488 /*istanbul ignore end*/
16490 /*istanbul ignore start*/
16492 /*istanbul ignore end*/
16496 var currentIndex = 0;
16498 function processIndex() {
16499 var index = uniDiff[currentIndex++];
16502 return options.complete();
16505 options.loadFile(index, function (err, data) {
16507 return options.complete(err);
16510 var updatedContent = applyPatch(data, index, options);
16511 options.patched(index, updatedContent, function (err) {
16513 return options.complete(err);
16528 /*istanbul ignore start*/
16530 Object.defineProperty(create$1, "__esModule", {
16533 create$1.structuredPatch = structuredPatch;
16534 create$1.formatPatch = formatPatch;
16535 create$1.createTwoFilesPatch = createTwoFilesPatch;
16536 create$1.createPatch = createPatch;
16537 /*istanbul ignore end*/
16540 /*istanbul ignore start*/
16542 /*istanbul ignore end*/
16544 /*istanbul ignore start*/
16546 function _toConsumableArray$1(arr) {
16547 return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
16550 function _nonIterableSpread$1() {
16551 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16554 function _unsupportedIterableToArray$1(o, minLen) {
16556 if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
16557 var n = Object.prototype.toString.call(o).slice(8, -1);
16558 if (n === "Object" && o.constructor) n = o.constructor.name;
16559 if (n === "Map" || n === "Set") return Array.from(o);
16560 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
16563 function _iterableToArray$1(iter) {
16564 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
16567 function _arrayWithoutHoles$1(arr) {
16568 if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
16571 function _arrayLikeToArray$1(arr, len) {
16572 if (len == null || len > arr.length) len = arr.length;
16574 for (var i = 0, arr2 = new Array(len); i < len; i++) {
16580 /*istanbul ignore end*/
16583 function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
16588 if (typeof options.context === 'undefined') {
16589 options.context = 4;
16593 /*istanbul ignore start*/
16594 (/*istanbul ignore end*/
16596 /*istanbul ignore start*/
16598 /*istanbul ignore end*/
16600 /*istanbul ignore start*/
16602 /*istanbul ignore end*/
16603 )(oldStr, newStr, options);
16607 }); // Append an empty value to make cleanup easier
16609 function contextLines(lines) {
16610 return lines.map(function (entry) {
16611 return ' ' + entry;
16616 var oldRangeStart = 0,
16621 /*istanbul ignore start*/
16623 var _loop = function _loop(
16624 /*istanbul ignore end*/
16626 var current = diff[i],
16627 lines = current.lines || current.value.replace(/\n$/, '').split('\n');
16628 current.lines = lines;
16630 if (current.added || current.removed) {
16631 /*istanbul ignore start*/
16633 /*istanbul ignore end*/
16634 // If we have previous context, start with that
16637 if (!oldRangeStart) {
16638 var prev = diff[i - 1];
16639 oldRangeStart = oldLine;
16640 newRangeStart = newLine;
16643 curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
16644 oldRangeStart -= curRange.length;
16645 newRangeStart -= curRange.length;
16647 } // Output our changes
16649 /*istanbul ignore start*/
16651 /*istanbul ignore end*/
16653 /*istanbul ignore start*/
16657 /*istanbul ignore end*/
16658 curRange).push.apply(
16659 /*istanbul ignore start*/
16661 /*istanbul ignore end*/
16663 /*istanbul ignore start*/
16664 _toConsumableArray$1(
16665 /*istanbul ignore end*/
16666 lines.map(function (entry) {
16667 return (current.added ? '+' : '-') + entry;
16668 }))); // Track the updated file position
16671 if (current.added) {
16672 newLine += lines.length;
16674 oldLine += lines.length;
16677 // Identical context lines. Track line changes
16678 if (oldRangeStart) {
16679 // Close out any changes that have been output (or join overlapping)
16680 if (lines.length <= options.context * 2 && i < diff.length - 2) {
16681 /*istanbul ignore start*/
16683 /*istanbul ignore end*/
16686 /*istanbul ignore start*/
16688 /*istanbul ignore end*/
16690 /*istanbul ignore start*/
16694 /*istanbul ignore end*/
16695 curRange).push.apply(
16696 /*istanbul ignore start*/
16698 /*istanbul ignore end*/
16700 /*istanbul ignore start*/
16701 _toConsumableArray$1(
16702 /*istanbul ignore end*/
16703 contextLines(lines)));
16705 /*istanbul ignore start*/
16707 /*istanbul ignore end*/
16708 // end the range and output
16711 var contextSize = Math.min(lines.length, options.context);
16712 /*istanbul ignore start*/
16714 /*istanbul ignore end*/
16716 /*istanbul ignore start*/
16719 /*istanbul ignore end*/
16720 curRange).push.apply(
16721 /*istanbul ignore start*/
16723 /*istanbul ignore end*/
16725 /*istanbul ignore start*/
16726 _toConsumableArray$1(
16727 /*istanbul ignore end*/
16728 contextLines(lines.slice(0, contextSize))));
16731 oldStart: oldRangeStart,
16732 oldLines: oldLine - oldRangeStart + contextSize,
16733 newStart: newRangeStart,
16734 newLines: newLine - newRangeStart + contextSize,
16738 if (i >= diff.length - 2 && lines.length <= options.context) {
16739 // EOF is inside this hunk
16740 var oldEOFNewline = /\n$/.test(oldStr);
16741 var newEOFNewline = /\n$/.test(newStr);
16742 var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
16744 if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
16745 // special case: old has no eol and no trailing context; no-nl can end up before adds
16746 // however, if the old file is empty, do not output the no-nl line
16747 curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
16750 if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
16751 curRange.push('\\ No newline at end of file');
16762 oldLine += lines.length;
16763 newLine += lines.length;
16767 for (var i = 0; i < diff.length; i++) {
16768 /*istanbul ignore start*/
16770 /*istanbul ignore end*/
16775 oldFileName: oldFileName,
16776 newFileName: newFileName,
16777 oldHeader: oldHeader,
16778 newHeader: newHeader,
16783 function formatPatch(diff) {
16786 if (diff.oldFileName == diff.newFileName) {
16787 ret.push('Index: ' + diff.oldFileName);
16790 ret.push('===================================================================');
16791 ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
16792 ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
16794 for (var i = 0; i < diff.hunks.length; i++) {
16795 var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
16796 // the first number is one lower than one would expect.
16797 // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
16799 if (hunk.oldLines === 0) {
16800 hunk.oldStart -= 1;
16803 if (hunk.newLines === 0) {
16804 hunk.newStart -= 1;
16807 ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
16808 ret.push.apply(ret, hunk.lines);
16811 return ret.join('\n') + '\n';
16814 function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
16815 return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
16818 function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
16819 return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
16824 /*istanbul ignore start*/
16826 Object.defineProperty(array, "__esModule", {
16829 array.arrayEqual = arrayEqual;
16830 array.arrayStartsWith = arrayStartsWith;
16831 /*istanbul ignore end*/
16833 function arrayEqual(a, b) {
16834 if (a.length !== b.length) {
16838 return arrayStartsWith(a, b);
16841 function arrayStartsWith(array, start) {
16842 if (start.length > array.length) {
16846 for (var i = 0; i < start.length; i++) {
16847 if (start[i] !== array[i]) {
16855 /*istanbul ignore start*/
16857 Object.defineProperty(merge$1, "__esModule", {
16860 merge$1.calcLineCount = calcLineCount;
16861 merge$1.merge = merge;
16862 /*istanbul ignore end*/
16865 /*istanbul ignore start*/
16867 /*istanbul ignore end*/
16870 /*istanbul ignore start*/
16872 /*istanbul ignore end*/
16875 /*istanbul ignore start*/
16877 /*istanbul ignore end*/
16879 /*istanbul ignore start*/
16881 function _toConsumableArray(arr) {
16882 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
16885 function _nonIterableSpread() {
16886 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16889 function _unsupportedIterableToArray(o, minLen) {
16891 if (typeof o === "string") return _arrayLikeToArray(o, minLen);
16892 var n = Object.prototype.toString.call(o).slice(8, -1);
16893 if (n === "Object" && o.constructor) n = o.constructor.name;
16894 if (n === "Map" || n === "Set") return Array.from(o);
16895 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
16898 function _iterableToArray(iter) {
16899 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
16902 function _arrayWithoutHoles(arr) {
16903 if (Array.isArray(arr)) return _arrayLikeToArray(arr);
16906 function _arrayLikeToArray(arr, len) {
16907 if (len == null || len > arr.length) len = arr.length;
16909 for (var i = 0, arr2 = new Array(len); i < len; i++) {
16915 /*istanbul ignore end*/
16918 function calcLineCount(hunk) {
16919 /*istanbul ignore start*/
16920 var _calcOldNewLineCount =
16921 /*istanbul ignore end*/
16922 calcOldNewLineCount(hunk.lines),
16923 oldLines = _calcOldNewLineCount.oldLines,
16924 newLines = _calcOldNewLineCount.newLines;
16926 if (oldLines !== undefined) {
16927 hunk.oldLines = oldLines;
16929 delete hunk.oldLines;
16932 if (newLines !== undefined) {
16933 hunk.newLines = newLines;
16935 delete hunk.newLines;
16939 function merge(mine, theirs, base) {
16940 mine = loadPatch(mine, base);
16941 theirs = loadPatch(theirs, base);
16942 var ret = {}; // For index we just let it pass through as it doesn't have any necessary meaning.
16943 // Leaving sanity checks on this to the API consumer that may know more about the
16944 // meaning in their own context.
16946 if (mine.index || theirs.index) {
16947 ret.index = mine.index || theirs.index;
16950 if (mine.newFileName || theirs.newFileName) {
16951 if (!fileNameChanged(mine)) {
16952 // No header or no change in ours, use theirs (and ours if theirs does not exist)
16953 ret.oldFileName = theirs.oldFileName || mine.oldFileName;
16954 ret.newFileName = theirs.newFileName || mine.newFileName;
16955 ret.oldHeader = theirs.oldHeader || mine.oldHeader;
16956 ret.newHeader = theirs.newHeader || mine.newHeader;
16957 } else if (!fileNameChanged(theirs)) {
16958 // No header or no change in theirs, use ours
16959 ret.oldFileName = mine.oldFileName;
16960 ret.newFileName = mine.newFileName;
16961 ret.oldHeader = mine.oldHeader;
16962 ret.newHeader = mine.newHeader;
16964 // Both changed... figure it out
16965 ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
16966 ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
16967 ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
16968 ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
16978 while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
16979 var mineCurrent = mine.hunks[mineIndex] || {
16982 theirsCurrent = theirs.hunks[theirsIndex] || {
16986 if (hunkBefore(mineCurrent, theirsCurrent)) {
16987 // This patch does not overlap with any of the others, yay.
16988 ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
16990 theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
16991 } else if (hunkBefore(theirsCurrent, mineCurrent)) {
16992 // This patch does not overlap with any of the others, yay.
16993 ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
16995 mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
16997 // Overlap, merge as best we can
16999 oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
17001 newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
17005 mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
17008 ret.hunks.push(mergedHunk);
17015 function loadPatch(param, base) {
17016 if (typeof param === 'string') {
17017 if (/^@@/m.test(param) || /^Index:/m.test(param)) {
17019 /*istanbul ignore start*/
17020 (/*istanbul ignore end*/
17022 /*istanbul ignore start*/
17024 /*istanbul ignore end*/
17026 /*istanbul ignore start*/
17028 /*istanbul ignore end*/
17034 throw new Error('Must provide a base reference or pass in a patch');
17038 /*istanbul ignore start*/
17039 (/*istanbul ignore end*/
17041 /*istanbul ignore start*/
17043 /*istanbul ignore end*/
17045 /*istanbul ignore start*/
17047 /*istanbul ignore end*/
17048 )(undefined, undefined, base, param)
17055 function fileNameChanged(patch) {
17056 return patch.newFileName && patch.newFileName !== patch.oldFileName;
17059 function selectField(index, mine, theirs) {
17060 if (mine === theirs) {
17063 index.conflict = true;
17071 function hunkBefore(test, check) {
17072 return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
17075 function cloneHunk(hunk, offset) {
17077 oldStart: hunk.oldStart,
17078 oldLines: hunk.oldLines,
17079 newStart: hunk.newStart + offset,
17080 newLines: hunk.newLines,
17085 function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
17086 // This will generally result in a conflicted hunk, but there are cases where the context
17087 // is the only overlap where we can successfully merge the content here.
17089 offset: mineOffset,
17094 offset: theirOffset,
17097 }; // Handle any leading content
17099 insertLeading(hunk, mine, their);
17100 insertLeading(hunk, their, mine); // Now in the overlap content. Scan through and select the best changes from each.
17102 while (mine.index < mine.lines.length && their.index < their.lines.length) {
17103 var mineCurrent = mine.lines[mine.index],
17104 theirCurrent = their.lines[their.index];
17106 if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
17107 // Both modified ...
17108 mutualChange(hunk, mine, their);
17109 } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
17110 /*istanbul ignore start*/
17112 /*istanbul ignore end*/
17115 /*istanbul ignore start*/
17117 /*istanbul ignore end*/
17119 /*istanbul ignore start*/
17123 /*istanbul ignore end*/
17124 hunk.lines).push.apply(
17125 /*istanbul ignore start*/
17127 /*istanbul ignore end*/
17129 /*istanbul ignore start*/
17130 _toConsumableArray(
17131 /*istanbul ignore end*/
17132 collectChange(mine)));
17133 } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
17134 /*istanbul ignore start*/
17136 /*istanbul ignore end*/
17139 /*istanbul ignore start*/
17141 /*istanbul ignore end*/
17143 /*istanbul ignore start*/
17147 /*istanbul ignore end*/
17148 hunk.lines).push.apply(
17149 /*istanbul ignore start*/
17151 /*istanbul ignore end*/
17153 /*istanbul ignore start*/
17154 _toConsumableArray(
17155 /*istanbul ignore end*/
17156 collectChange(their)));
17157 } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
17158 // Mine removed or edited
17159 removal(hunk, mine, their);
17160 } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
17161 // Their removed or edited
17162 removal(hunk, their, mine, true);
17163 } else if (mineCurrent === theirCurrent) {
17164 // Context identity
17165 hunk.lines.push(mineCurrent);
17169 // Context mismatch
17170 conflict(hunk, collectChange(mine), collectChange(their));
17172 } // Now push anything that may be remaining
17175 insertTrailing(hunk, mine);
17176 insertTrailing(hunk, their);
17177 calcLineCount(hunk);
17180 function mutualChange(hunk, mine, their) {
17181 var myChanges = collectChange(mine),
17182 theirChanges = collectChange(their);
17184 if (allRemoves(myChanges) && allRemoves(theirChanges)) {
17185 // Special case for remove changes that are supersets of one another
17187 /*istanbul ignore start*/
17188 (/*istanbul ignore end*/
17190 /*istanbul ignore start*/
17192 /*istanbul ignore end*/
17194 /*istanbul ignore start*/
17196 /*istanbul ignore end*/
17197 )(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
17198 /*istanbul ignore start*/
17200 /*istanbul ignore end*/
17202 /*istanbul ignore start*/
17204 /*istanbul ignore end*/
17206 /*istanbul ignore start*/
17210 /*istanbul ignore end*/
17211 hunk.lines).push.apply(
17212 /*istanbul ignore start*/
17214 /*istanbul ignore end*/
17216 /*istanbul ignore start*/
17217 _toConsumableArray(
17218 /*istanbul ignore end*/
17223 /*istanbul ignore start*/
17224 (/*istanbul ignore end*/
17226 /*istanbul ignore start*/
17228 /*istanbul ignore end*/
17230 /*istanbul ignore start*/
17232 /*istanbul ignore end*/
17233 )(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
17234 /*istanbul ignore start*/
17236 /*istanbul ignore end*/
17238 /*istanbul ignore start*/
17240 /*istanbul ignore end*/
17242 /*istanbul ignore start*/
17246 /*istanbul ignore end*/
17247 hunk.lines).push.apply(
17248 /*istanbul ignore start*/
17250 /*istanbul ignore end*/
17252 /*istanbul ignore start*/
17253 _toConsumableArray(
17254 /*istanbul ignore end*/
17260 /*istanbul ignore start*/
17261 (/*istanbul ignore end*/
17263 /*istanbul ignore start*/
17265 /*istanbul ignore end*/
17267 /*istanbul ignore start*/
17269 /*istanbul ignore end*/
17270 )(myChanges, theirChanges)) {
17271 /*istanbul ignore start*/
17273 /*istanbul ignore end*/
17275 /*istanbul ignore start*/
17277 /*istanbul ignore end*/
17279 /*istanbul ignore start*/
17283 /*istanbul ignore end*/
17284 hunk.lines).push.apply(
17285 /*istanbul ignore start*/
17287 /*istanbul ignore end*/
17289 /*istanbul ignore start*/
17290 _toConsumableArray(
17291 /*istanbul ignore end*/
17297 conflict(hunk, myChanges, theirChanges);
17300 function removal(hunk, mine, their, swap) {
17301 var myChanges = collectChange(mine),
17302 theirChanges = collectContext(their, myChanges);
17304 if (theirChanges.merged) {
17305 /*istanbul ignore start*/
17307 /*istanbul ignore end*/
17309 /*istanbul ignore start*/
17311 /*istanbul ignore end*/
17313 /*istanbul ignore start*/
17317 /*istanbul ignore end*/
17318 hunk.lines).push.apply(
17319 /*istanbul ignore start*/
17321 /*istanbul ignore end*/
17323 /*istanbul ignore start*/
17324 _toConsumableArray(
17325 /*istanbul ignore end*/
17326 theirChanges.merged));
17328 conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
17332 function conflict(hunk, mine, their) {
17333 hunk.conflict = true;
17341 function insertLeading(hunk, insert, their) {
17342 while (insert.offset < their.offset && insert.index < insert.lines.length) {
17343 var line = insert.lines[insert.index++];
17344 hunk.lines.push(line);
17349 function insertTrailing(hunk, insert) {
17350 while (insert.index < insert.lines.length) {
17351 var line = insert.lines[insert.index++];
17352 hunk.lines.push(line);
17356 function collectChange(state) {
17358 operation = state.lines[state.index][0];
17360 while (state.index < state.lines.length) {
17361 var line = state.lines[state.index]; // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
17363 if (operation === '-' && line[0] === '+') {
17367 if (operation === line[0]) {
17378 function collectContext(state, matchChanges) {
17382 contextChanges = false,
17383 conflicted = false;
17385 while (matchIndex < matchChanges.length && state.index < state.lines.length) {
17386 var change = state.lines[state.index],
17387 match = matchChanges[matchIndex]; // Once we've hit our add, then we are done
17389 if (match[0] === '+') {
17393 contextChanges = contextChanges || change[0] !== ' ';
17394 merged.push(match);
17395 matchIndex++; // Consume any additions in the other block as a conflict to attempt
17396 // to pull in the remaining context after this
17398 if (change[0] === '+') {
17401 while (change[0] === '+') {
17402 changes.push(change);
17403 change = state.lines[++state.index];
17407 if (match.substr(1) === change.substr(1)) {
17408 changes.push(change);
17415 if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
17423 while (matchIndex < matchChanges.length) {
17424 merged.push(matchChanges[matchIndex++]);
17433 function allRemoves(changes) {
17434 return changes.reduce(function (prev, change) {
17435 return prev && change[0] === '-';
17439 function skipRemoveSuperset(state, removeChanges, delta) {
17440 for (var i = 0; i < delta; i++) {
17441 var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
17443 if (state.lines[state.index + i] !== ' ' + changeContent) {
17448 state.index += delta;
17452 function calcOldNewLineCount(lines) {
17455 lines.forEach(function (line) {
17456 if (typeof line !== 'string') {
17457 var myCount = calcOldNewLineCount(line.mine);
17458 var theirCount = calcOldNewLineCount(line.theirs);
17460 if (oldLines !== undefined) {
17461 if (myCount.oldLines === theirCount.oldLines) {
17462 oldLines += myCount.oldLines;
17464 oldLines = undefined;
17468 if (newLines !== undefined) {
17469 if (myCount.newLines === theirCount.newLines) {
17470 newLines += myCount.newLines;
17472 newLines = undefined;
17476 if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
17480 if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
17486 oldLines: oldLines,
17493 /*istanbul ignore start*/
17495 Object.defineProperty(dmp, "__esModule", {
17498 dmp.convertChangesToDMP = convertChangesToDMP;
17499 /*istanbul ignore end*/
17500 // See: http://code.google.com/p/google-diff-match-patch/wiki/API
17502 function convertChangesToDMP(changes) {
17507 for (var i = 0; i < changes.length; i++) {
17508 change = changes[i];
17510 if (change.added) {
17512 } else if (change.removed) {
17518 ret.push([operation, change.value]);
17526 /*istanbul ignore start*/
17528 Object.defineProperty(xml, "__esModule", {
17531 xml.convertChangesToXML = convertChangesToXML;
17532 /*istanbul ignore end*/
17534 function convertChangesToXML(changes) {
17537 for (var i = 0; i < changes.length; i++) {
17538 var change = changes[i];
17540 if (change.added) {
17542 } else if (change.removed) {
17546 ret.push(escapeHTML(change.value));
17548 if (change.added) {
17549 ret.push('</ins>');
17550 } else if (change.removed) {
17551 ret.push('</del>');
17555 return ret.join('');
17558 function escapeHTML(s) {
17560 n = n.replace(/&/g, '&');
17561 n = n.replace(/</g, '<');
17562 n = n.replace(/>/g, '>');
17563 n = n.replace(/"/g, '"');
17567 /*istanbul ignore start*/
17569 (function (exports) {
17571 Object.defineProperty(exports, "__esModule", {
17574 Object.defineProperty(exports, "Diff", {
17576 get: function get() {
17577 return _base["default"];
17580 Object.defineProperty(exports, "diffChars", {
17582 get: function get() {
17583 return _character.diffChars;
17586 Object.defineProperty(exports, "diffWords", {
17588 get: function get() {
17589 return _word.diffWords;
17592 Object.defineProperty(exports, "diffWordsWithSpace", {
17594 get: function get() {
17595 return _word.diffWordsWithSpace;
17598 Object.defineProperty(exports, "diffLines", {
17600 get: function get() {
17601 return _line.diffLines;
17604 Object.defineProperty(exports, "diffTrimmedLines", {
17606 get: function get() {
17607 return _line.diffTrimmedLines;
17610 Object.defineProperty(exports, "diffSentences", {
17612 get: function get() {
17613 return _sentence.diffSentences;
17616 Object.defineProperty(exports, "diffCss", {
17618 get: function get() {
17619 return _css.diffCss;
17622 Object.defineProperty(exports, "diffJson", {
17624 get: function get() {
17625 return _json.diffJson;
17628 Object.defineProperty(exports, "canonicalize", {
17630 get: function get() {
17631 return _json.canonicalize;
17634 Object.defineProperty(exports, "diffArrays", {
17636 get: function get() {
17637 return _array.diffArrays;
17640 Object.defineProperty(exports, "applyPatch", {
17642 get: function get() {
17643 return _apply.applyPatch;
17646 Object.defineProperty(exports, "applyPatches", {
17648 get: function get() {
17649 return _apply.applyPatches;
17652 Object.defineProperty(exports, "parsePatch", {
17654 get: function get() {
17655 return _parse.parsePatch;
17658 Object.defineProperty(exports, "merge", {
17660 get: function get() {
17661 return _merge.merge;
17664 Object.defineProperty(exports, "structuredPatch", {
17666 get: function get() {
17667 return _create.structuredPatch;
17670 Object.defineProperty(exports, "createTwoFilesPatch", {
17672 get: function get() {
17673 return _create.createTwoFilesPatch;
17676 Object.defineProperty(exports, "createPatch", {
17678 get: function get() {
17679 return _create.createPatch;
17682 Object.defineProperty(exports, "convertChangesToDMP", {
17684 get: function get() {
17685 return _dmp.convertChangesToDMP;
17688 Object.defineProperty(exports, "convertChangesToXML", {
17690 get: function get() {
17691 return _xml.convertChangesToXML;
17694 /*istanbul ignore end*/
17697 /*istanbul ignore start*/
17698 _base = _interopRequireDefault(base)
17699 /*istanbul ignore end*/
17703 /*istanbul ignore start*/
17704 _character = character
17705 /*istanbul ignore end*/
17708 /*istanbul ignore start*/
17710 /*istanbul ignore end*/
17713 /*istanbul ignore start*/
17715 /*istanbul ignore end*/
17718 /*istanbul ignore start*/
17719 _sentence = sentence
17720 /*istanbul ignore end*/
17723 /*istanbul ignore start*/
17725 /*istanbul ignore end*/
17728 /*istanbul ignore start*/
17730 /*istanbul ignore end*/
17733 /*istanbul ignore start*/
17735 /*istanbul ignore end*/
17738 /*istanbul ignore start*/
17740 /*istanbul ignore end*/
17743 /*istanbul ignore start*/
17745 /*istanbul ignore end*/
17748 /*istanbul ignore start*/
17750 /*istanbul ignore end*/
17753 /*istanbul ignore start*/
17755 /*istanbul ignore end*/
17758 /*istanbul ignore start*/
17760 /*istanbul ignore end*/
17763 /*istanbul ignore start*/
17765 /*istanbul ignore end*/
17767 /*istanbul ignore start*/
17769 function _interopRequireDefault(obj) {
17770 return obj && obj.__esModule ? obj : {
17774 /*istanbul ignore end*/
17780 } = require$$0__default$4["default"];
17781 const path$1 = require$$0__default$1["default"];
17782 const chalk$1 = source; // eslint-disable-next-line no-restricted-modules
17784 const prettier$4 = require$$3; // eslint-disable-next-line no-restricted-modules
17792 } = prettierInternal;
17796 } = expandPatterns_1;
17800 const isTTY = isTty;
17802 function diff(a, b) {
17803 return lib$1.createTwoFilesPatch("", "", a, b, "", "", {
17808 function handleError(context, filename, error, printedFilename) {
17809 if (error instanceof errors.UndefinedParserError) {
17810 // Can't test on CI, `isTTY()` is always false, see ./is-tty.js
17812 /* istanbul ignore next */
17813 if ((context.argv.write || context.argv["ignore-unknown"]) && printedFilename) {
17814 printedFilename.clear();
17817 if (context.argv["ignore-unknown"]) {
17821 if (!context.argv.check && !context.argv["list-different"]) {
17822 process.exitCode = 2;
17825 context.logger.error(error.message);
17829 if (context.argv.write) {
17830 // Add newline to split errors from filename line.
17831 process.stdout.write("\n");
17834 const isParseError = Boolean(error && error.loc);
17835 const isValidationError = /^Invalid \S+ value\./.test(error && error.message);
17837 if (isParseError) {
17838 // `invalid.js: SyntaxError: Unexpected token (1:1)`.
17839 context.logger.error(`${filename}: ${String(error)}`);
17840 } else if (isValidationError || error instanceof errors.ConfigError) {
17841 // `Invalid printWidth value. Expected an integer, but received 0.5.`
17842 context.logger.error(error.message); // If validation fails for one file, it will fail for all of them.
17845 } else if (error instanceof errors.DebugError) {
17846 // `invalid.js: Some debug error message`
17847 context.logger.error(`${filename}: ${error.message}`);
17849 // `invalid.js: Error: Some unexpected error\n[stack trace]`
17851 /* istanbul ignore next */
17852 context.logger.error(filename + ": " + (error.stack || error));
17853 } // Don't exit the process if one file failed
17856 process.exitCode = 2;
17859 function writeOutput(context, result, options) {
17860 // Don't use `console.log` here since it adds an extra newline at the end.
17861 process.stdout.write(context.argv["debug-check"] ? result.filepath : result.formatted);
17863 if (options && options.cursorOffset >= 0) {
17864 process.stderr.write(result.cursorOffset + "\n");
17868 function listDifferent(context, input, options, filename) {
17869 if (!context.argv.check && !context.argv["list-different"]) {
17874 if (!options.filepath && !options.parser) {
17875 throw new errors.UndefinedParserError("No parser and no file path given, couldn't infer a parser.");
17878 if (!prettier$4.check(input, options)) {
17879 if (!context.argv.write) {
17880 context.logger.log(filename);
17881 process.exitCode = 1;
17885 context.logger.error(error.message);
17891 function format$1(context, input, opt) {
17892 if (!opt.parser && !opt.filepath) {
17893 throw new errors.UndefinedParserError("No parser and no file path given, couldn't infer a parser.");
17896 if (context.argv["debug-print-doc"]) {
17897 const doc = prettier$4.__debug.printToDoc(input, opt);
17900 formatted: prettier$4.__debug.formatDoc(doc) + "\n"
17904 if (context.argv["debug-print-comments"]) {
17906 formatted: prettier$4.format(JSON.stringify(prettier$4.formatWithCursor(input, opt).comments || []), {
17912 if (context.argv["debug-print-ast"]) {
17915 } = prettier$4.__debug.parse(input, opt);
17918 formatted: JSON.stringify(ast)
17922 if (context.argv["debug-check"]) {
17923 const pp = prettier$4.format(input, opt);
17924 const pppp = prettier$4.format(pp, opt);
17927 throw new errors.DebugError("prettier(input) !== prettier(prettier(input))\n" + diff(pp, pppp));
17929 const stringify = obj => JSON.stringify(obj, null, 2);
17931 const ast = stringify(prettier$4.__debug.parse(input, opt,
17934 const past = stringify(prettier$4.__debug.parse(pp, opt,
17937 /* istanbul ignore next */
17939 if (ast !== past) {
17940 const MAX_AST_SIZE = 2097152; // 2MB
17942 const astDiff = ast.length > MAX_AST_SIZE || past.length > MAX_AST_SIZE ? "AST diff too large to render" : diff(ast, past);
17943 throw new errors.DebugError("ast(input) !== ast(prettier(input))\n" + astDiff + "\n" + diff(input, pp));
17949 filepath: opt.filepath || "(stdin)\n"
17952 /* istanbul ignore next */
17955 if (context.argv["debug-benchmark"]) {
17959 // eslint-disable-next-line import/no-extraneous-dependencies
17960 benchmark = require("benchmark");
17962 context.logger.debug("'--debug-benchmark' requires the 'benchmark' package to be installed.");
17966 context.logger.debug("'--debug-benchmark' option found, measuring formatWithCursor with 'benchmark' module.");
17967 const suite = new benchmark.Suite();
17968 suite.add("format", () => {
17969 prettier$4.formatWithCursor(input, opt);
17970 }).on("cycle", event => {
17972 benchmark: String(event.target),
17973 hz: event.target.hz,
17974 ms: event.target.times.cycle * 1000
17976 context.logger.debug("'--debug-benchmark' measurements for formatWithCursor: " + JSON.stringify(results, null, 2));
17980 } else if (context.argv["debug-repeat"] > 0) {
17981 const repeat = context.argv["debug-repeat"];
17982 context.logger.debug("'--debug-repeat' option found, running formatWithCursor " + repeat + " times.");
17985 for (let i = 0; i < repeat; ++i) {
17986 // should be using `performance.now()`, but only `Date` is cross-platform enough
17987 const startMs = Date.now();
17988 prettier$4.formatWithCursor(input, opt);
17989 totalMs += Date.now() - startMs;
17992 const averageMs = totalMs / repeat;
17995 hz: 1000 / averageMs,
17998 context.logger.debug("'--debug-repeat' measurements for formatWithCursor: " + JSON.stringify(results, null, 2));
18001 return prettier$4.formatWithCursor(input, opt);
18004 async function createIgnorerFromContextOrDie(context) {
18006 return await createIgnorer(context.argv["ignore-path"], context.argv["with-node-modules"]);
18008 context.logger.error(e.message);
18013 async function formatStdin$1(context) {
18014 const filepath = context.argv["stdin-filepath"] ? path$1.resolve(process.cwd(), context.argv["stdin-filepath"]) : process.cwd();
18015 const ignorer = await createIgnorerFromContextOrDie(context); // If there's an ignore-path set, the filename must be relative to the
18016 // ignore path, not the current working directory.
18018 const relativeFilepath = context.argv["ignore-path"] ? path$1.relative(path$1.dirname(context.argv["ignore-path"]), filepath) : path$1.relative(process.cwd(), filepath);
18021 const input = await getStdin();
18023 if (relativeFilepath && ignorer.ignores(fixWindowsSlashes(relativeFilepath))) {
18024 writeOutput(context, {
18030 const options = await getOptionsForFile(context, filepath);
18032 if (listDifferent(context, input, options, "(stdin)")) {
18036 writeOutput(context, format$1(context, input, options), options);
18038 handleError(context, relativeFilepath || "stdin", error);
18042 async function formatFiles$1(context) {
18043 // The ignorer will be used to filter file paths after the glob is checked,
18044 // before any files are actually written
18045 const ignorer = await createIgnorerFromContextOrDie(context);
18046 let numberOfUnformattedFilesFound = 0;
18048 if (context.argv.check) {
18049 context.logger.log("Checking formatting...");
18052 for await (const pathOrError of expandPatterns(context)) {
18053 if (typeof pathOrError === "object") {
18054 context.logger.error(pathOrError.error); // Don't exit, but set the exit code to 2
18056 process.exitCode = 2;
18060 const filename = pathOrError; // If there's an ignore-path set, the filename must be relative to the
18061 // ignore path, not the current working directory.
18063 const ignoreFilename = context.argv["ignore-path"] ? path$1.relative(path$1.dirname(context.argv["ignore-path"]), filename) : filename;
18064 const fileIgnored = ignorer.ignores(fixWindowsSlashes(ignoreFilename));
18066 if (fileIgnored && (context.argv["debug-check"] || context.argv.write || context.argv.check || context.argv["list-different"])) {
18070 const options = Object.assign(Object.assign({}, await getOptionsForFile(context, filename)), {}, {
18073 let printedFilename;
18076 printedFilename = context.logger.log(filename, {
18085 input = await fs.readFile(filename, "utf8");
18087 // Add newline to split errors from filename line.
18089 /* istanbul ignore next */
18090 context.logger.log("");
18091 /* istanbul ignore next */
18093 context.logger.error(`Unable to read file: ${filename}\n${error.message}`); // Don't exit the process if one file failed
18095 /* istanbul ignore next */
18097 process.exitCode = 2;
18098 /* istanbul ignore next */
18104 writeOutput(context, {
18110 const start = Date.now();
18115 result = format$1(context, input, options);
18116 output = result.formatted;
18118 handleError(context, filename, error, printedFilename);
18122 const isDifferent = output !== input;
18124 if (printedFilename) {
18125 // Remove previously printed filename to log it with duration.
18126 printedFilename.clear();
18129 if (context.argv.write) {
18130 // Don't write the file if it won't change in order not to invalidate
18131 // mtime based caches.
18133 if (!context.argv.check && !context.argv["list-different"]) {
18134 context.logger.log(`${filename} ${Date.now() - start}ms`);
18138 await fs.writeFile(filename, output, "utf8");
18140 /* istanbul ignore next */
18141 context.logger.error(`Unable to write file: ${filename}\n${error.message}`); // Don't exit the process if one file failed
18143 /* istanbul ignore next */
18145 process.exitCode = 2;
18147 } else if (!context.argv.check && !context.argv["list-different"]) {
18148 context.logger.log(`${chalk$1.grey(filename)} ${Date.now() - start}ms`);
18150 } else if (context.argv["debug-check"]) {
18151 /* istanbul ignore else */
18152 if (result.filepath) {
18153 context.logger.log(result.filepath);
18155 process.exitCode = 2;
18157 } else if (!context.argv.check && !context.argv["list-different"]) {
18158 writeOutput(context, result, options);
18162 if (context.argv.check) {
18163 context.logger.warn(filename);
18164 } else if (context.argv["list-different"]) {
18165 context.logger.log(filename);
18168 numberOfUnformattedFilesFound += 1;
18170 } // Print check summary based on expected exit code
18173 if (context.argv.check) {
18174 if (numberOfUnformattedFilesFound === 0) {
18175 context.logger.log("All matched files use Prettier code style!");
18177 context.logger.warn(context.argv.write ? "Code style issues fixed in the above file(s)." : "Code style issues found in the above file(s). Forgot to run Prettier?");
18179 } // Ensure non-zero exitCode when using --check/list-different is not combined with --write
18182 if ((context.argv.check || context.argv["list-different"]) && numberOfUnformattedFilesFound > 0 && !process.exitCode && !context.argv.write) {
18183 process.exitCode = 1;
18189 formatStdin: formatStdin$1,
18190 formatFiles: formatFiles$1
18193 var getNative = _getNative;
18195 var defineProperty$2 = function () {
18197 var func = getNative(Object, 'defineProperty');
18203 var _defineProperty = defineProperty$2;
18205 var defineProperty$1 = _defineProperty;
18207 * The base implementation of `assignValue` and `assignMergeValue` without
18211 * @param {Object} object The object to modify.
18212 * @param {string} key The key of the property to assign.
18213 * @param {*} value The value to assign.
18216 function baseAssignValue$2(object, key, value) {
18217 if (key == '__proto__' && defineProperty$1) {
18218 defineProperty$1(object, key, {
18219 'configurable': true,
18220 'enumerable': true,
18225 object[key] = value;
18229 var _baseAssignValue = baseAssignValue$2;
18231 var baseAssignValue$1 = _baseAssignValue,
18233 /** Used for built-in method references. */
18235 var objectProto$1 = Object.prototype;
18236 /** Used to check objects for own properties. */
18238 var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
18240 * Assigns `value` to `key` of `object` if the existing value is not equivalent
18241 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
18242 * for equality comparisons.
18245 * @param {Object} object The object to modify.
18246 * @param {string} key The key of the property to assign.
18247 * @param {*} value The value to assign.
18250 function assignValue$1(object, key, value) {
18251 var objValue = object[key];
18253 if (!(hasOwnProperty$1.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
18254 baseAssignValue$1(object, key, value);
18258 var _assignValue = assignValue$1;
18260 var assignValue = _assignValue,
18261 castPath$1 = _castPath,
18262 isIndex = _isIndex,
18263 isObject = isObject_1,
18266 * The base implementation of `_.set`.
18269 * @param {Object} object The object to modify.
18270 * @param {Array|string} path The path of the property to set.
18271 * @param {*} value The value to set.
18272 * @param {Function} [customizer] The function to customize path creation.
18273 * @returns {Object} Returns `object`.
18276 function baseSet$1(object, path, value, customizer) {
18277 if (!isObject(object)) {
18281 path = castPath$1(path, object);
18283 length = path.length,
18284 lastIndex = length - 1,
18287 while (nested != null && ++index < length) {
18288 var key = toKey(path[index]),
18291 if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
18295 if (index != lastIndex) {
18296 var objValue = nested[key];
18297 newValue = customizer ? customizer(objValue, key, nested) : undefined;
18299 if (newValue === undefined) {
18300 newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
18304 assignValue(nested, key, newValue);
18305 nested = nested[key];
18311 var _baseSet = baseSet$1;
18313 var baseGet = _baseGet,
18314 baseSet = _baseSet,
18315 castPath = _castPath;
18317 * The base implementation of `_.pickBy` without support for iteratee shorthands.
18320 * @param {Object} object The source object.
18321 * @param {string[]} paths The property paths to pick.
18322 * @param {Function} predicate The function invoked per property.
18323 * @returns {Object} Returns the new object.
18326 function basePickBy$1(object, paths, predicate) {
18328 length = paths.length,
18331 while (++index < length) {
18332 var path = paths[index],
18333 value = baseGet(object, path);
18335 if (predicate(value, path)) {
18336 baseSet(result, castPath(path, object), value);
18343 var _basePickBy = basePickBy$1;
18345 var basePickBy = _basePickBy,
18348 * The base implementation of `_.pick` without support for individual
18349 * property identifiers.
18352 * @param {Object} object The source object.
18353 * @param {string[]} paths The property paths to pick.
18354 * @returns {Object} Returns the new object.
18357 function basePick$1(object, paths) {
18358 return basePickBy(object, paths, function (value, path) {
18359 return hasIn(object, path);
18363 var _basePick = basePick$1;
18365 var Symbol$1 = _Symbol,
18366 isArguments = isArguments_1,
18367 isArray = isArray_1;
18368 /** Built-in value references. */
18370 var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
18372 * Checks if `value` is a flattenable `arguments` object or array.
18375 * @param {*} value The value to check.
18376 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
18379 function isFlattenable$1(value) {
18380 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
18383 var _isFlattenable = isFlattenable$1;
18385 var arrayPush = _arrayPush,
18386 isFlattenable = _isFlattenable;
18388 * The base implementation of `_.flatten` with support for restricting flattening.
18391 * @param {Array} array The array to flatten.
18392 * @param {number} depth The maximum recursion depth.
18393 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
18394 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
18395 * @param {Array} [result=[]] The initial result value.
18396 * @returns {Array} Returns the new flattened array.
18399 function baseFlatten$1(array, depth, predicate, isStrict, result) {
18401 length = array.length;
18402 predicate || (predicate = isFlattenable);
18403 result || (result = []);
18405 while (++index < length) {
18406 var value = array[index];
18408 if (depth > 0 && predicate(value)) {
18410 // Recursively flatten arrays (susceptible to call stack limits).
18411 baseFlatten$1(value, depth - 1, predicate, isStrict, result);
18413 arrayPush(result, value);
18415 } else if (!isStrict) {
18416 result[result.length] = value;
18423 var _baseFlatten = baseFlatten$1;
18425 var baseFlatten = _baseFlatten;
18427 * Flattens `array` a single level deep.
18433 * @param {Array} array The array to flatten.
18434 * @returns {Array} Returns the new flattened array.
18437 * _.flatten([1, [2, [3, [4]], 5]]);
18438 * // => [1, 2, [3, [4]], 5]
18441 function flatten$1(array) {
18442 var length = array == null ? 0 : array.length;
18443 return length ? baseFlatten(array, 1) : [];
18446 var flatten_1 = flatten$1;
18449 * A faster alternative to `Function#apply`, this function invokes `func`
18450 * with the `this` binding of `thisArg` and the arguments of `args`.
18453 * @param {Function} func The function to invoke.
18454 * @param {*} thisArg The `this` binding of `func`.
18455 * @param {Array} args The arguments to invoke `func` with.
18456 * @returns {*} Returns the result of `func`.
18459 function apply$1(func, thisArg, args) {
18460 switch (args.length) {
18462 return func.call(thisArg);
18465 return func.call(thisArg, args[0]);
18468 return func.call(thisArg, args[0], args[1]);
18471 return func.call(thisArg, args[0], args[1], args[2]);
18474 return func.apply(thisArg, args);
18477 var _apply = apply$1;
18479 var apply = _apply;
18480 /* Built-in method references for those with the same name as other `lodash` methods. */
18482 var nativeMax = Math.max;
18484 * A specialized version of `baseRest` which transforms the rest array.
18487 * @param {Function} func The function to apply a rest parameter to.
18488 * @param {number} [start=func.length-1] The start position of the rest parameter.
18489 * @param {Function} transform The rest array transform.
18490 * @returns {Function} Returns the new function.
18493 function overRest$1(func, start, transform) {
18494 start = nativeMax(start === undefined ? func.length - 1 : start, 0);
18495 return function () {
18496 var args = arguments,
18498 length = nativeMax(args.length - start, 0),
18499 array = Array(length);
18501 while (++index < length) {
18502 array[index] = args[start + index];
18506 var otherArgs = Array(start + 1);
18508 while (++index < start) {
18509 otherArgs[index] = args[index];
18512 otherArgs[start] = transform(array);
18513 return apply(func, this, otherArgs);
18517 var _overRest = overRest$1;
18520 * Creates a function that returns `value`.
18526 * @param {*} value The value to return from the new function.
18527 * @returns {Function} Returns the new constant function.
18530 * var objects = _.times(2, _.constant({ 'a': 1 }));
18532 * console.log(objects);
18533 * // => [{ 'a': 1 }, { 'a': 1 }]
18535 * console.log(objects[0] === objects[1]);
18539 function constant$4(value) {
18540 return function () {
18545 var constant_1 = constant$4;
18547 var constant$3 = constant_1,
18548 defineProperty = _defineProperty,
18549 identity = identity_1;
18551 * The base implementation of `setToString` without support for hot loop shorting.
18554 * @param {Function} func The function to modify.
18555 * @param {Function} string The `toString` result.
18556 * @returns {Function} Returns `func`.
18559 var baseSetToString$1 = !defineProperty ? identity : function (func, string) {
18560 return defineProperty(func, 'toString', {
18561 'configurable': true,
18562 'enumerable': false,
18563 'value': constant$3(string),
18567 var _baseSetToString = baseSetToString$1;
18569 /** Used to detect hot functions by number of calls within a span of milliseconds. */
18570 var HOT_COUNT = 800,
18572 /* Built-in method references for those with the same name as other `lodash` methods. */
18574 var nativeNow = Date.now;
18576 * Creates a function that'll short out and invoke `identity` instead
18577 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
18581 * @param {Function} func The function to restrict.
18582 * @returns {Function} Returns the new shortable function.
18585 function shortOut$1(func) {
18588 return function () {
18589 var stamp = nativeNow(),
18590 remaining = HOT_SPAN - (stamp - lastCalled);
18591 lastCalled = stamp;
18593 if (remaining > 0) {
18594 if (++count >= HOT_COUNT) {
18595 return arguments[0];
18601 return func.apply(undefined, arguments);
18605 var _shortOut = shortOut$1;
18607 var baseSetToString = _baseSetToString,
18608 shortOut = _shortOut;
18610 * Sets the `toString` method of `func` to return `string`.
18613 * @param {Function} func The function to modify.
18614 * @param {Function} string The `toString` result.
18615 * @returns {Function} Returns `func`.
18618 var setToString$1 = shortOut(baseSetToString);
18619 var _setToString = setToString$1;
18621 var flatten = flatten_1,
18622 overRest = _overRest,
18623 setToString = _setToString;
18625 * A specialized version of `baseRest` which flattens the rest array.
18628 * @param {Function} func The function to apply a rest parameter to.
18629 * @returns {Function} Returns the new function.
18632 function flatRest$1(func) {
18633 return setToString(overRest(func, undefined, flatten), func + '');
18636 var _flatRest = flatRest$1;
18638 var basePick = _basePick,
18639 flatRest = _flatRest;
18641 * Creates an object composed of the picked `object` properties.
18647 * @param {Object} object The source object.
18648 * @param {...(string|string[])} [paths] The property paths to pick.
18649 * @returns {Object} Returns the new object.
18652 * var object = { 'a': 1, 'b': '2', 'c': 3 };
18654 * _.pick(object, ['a', 'c']);
18655 * // => { 'a': 1, 'c': 3 }
18658 var pick$1 = flatRest(function (object, paths) {
18659 return object == null ? {} : basePick(object, paths);
18661 var pick_1 = pick$1;
18663 var lib = {exports: {}};
18665 (function (module, exports) {
18667 Object.defineProperty(exports, "__esModule", {
18670 exports.outdent = void 0; // In the absence of a WeakSet or WeakMap implementation, don't break, but don't cache either.
18675 for (var _i = 0; _i < arguments.length; _i++) {
18676 args[_i] = arguments[_i];
18680 function createWeakMap() {
18681 if (typeof WeakMap !== "undefined") {
18682 return new WeakMap();
18684 return fakeSetOrMap();
18688 * Creates and returns a no-op implementation of a WeakMap / WeakSet that never stores anything.
18692 function fakeSetOrMap() {
18698 has: function (k) {
18702 } // Safe hasOwnProperty
18705 var hop = Object.prototype.hasOwnProperty;
18707 var has = function (obj, prop) {
18708 return hop.call(obj, prop);
18709 }; // Copy all own enumerable properties from source to target
18712 function extend(target, source) {
18713 for (var prop in source) {
18714 if (has(source, prop)) {
18715 target[prop] = source[prop];
18722 var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
18723 var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
18724 var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
18725 var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
18726 var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
18728 function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
18729 // If first interpolated value is a reference to outdent,
18730 // determine indentation level from the indentation of the interpolated value.
18731 var indentationLevel = 0;
18732 var match = strings[0].match(reDetectIndentation);
18735 indentationLevel = match[1].length;
18738 var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
18739 var reMatchIndent = new RegExp(reSource, "g");
18741 if (firstInterpolatedValueSetsIndentationLevel) {
18742 strings = strings.slice(1);
18745 var newline = options.newline,
18746 trimLeadingNewline = options.trimLeadingNewline,
18747 trimTrailingNewline = options.trimTrailingNewline;
18748 var normalizeNewlines = typeof newline === "string";
18749 var l = strings.length;
18750 var outdentedStrings = strings.map(function (v, i) {
18751 // Remove leading indentation from all lines
18752 v = v.replace(reMatchIndent, "$1"); // Trim a leading newline from the first string
18754 if (i === 0 && trimLeadingNewline) {
18755 v = v.replace(reLeadingNewline, "");
18756 } // Trim a trailing newline from the last string
18759 if (i === l - 1 && trimTrailingNewline) {
18760 v = v.replace(reTrailingNewline, "");
18761 } // Normalize newlines
18764 if (normalizeNewlines) {
18765 v = v.replace(/\r\n|\n|\r/g, function (_) {
18772 return outdentedStrings;
18775 function concatStringsAndValues(strings, values) {
18778 for (var i = 0, l = strings.length; i < l; i++) {
18789 function isTemplateStringsArray(v) {
18790 return has(v, "raw") && has(v, "length");
18793 * It is assumed that opts will not change. If this is a problem, clone your options object and pass the clone to
18796 * @return {outdent}
18800 function createInstance(options) {
18801 /** Cache of pre-processed template literal arrays */
18802 var arrayAutoIndentCache = createWeakMap();
18804 * Cache of pre-processed template literal arrays, where first interpolated value is a reference to outdent,
18805 * before interpolated values are injected.
18808 var arrayFirstInterpSetsIndentCache = createWeakMap();
18810 function outdent(stringsOrOptions) {
18813 for (var _i = 1; _i < arguments.length; _i++) {
18814 values[_i - 1] = arguments[_i];
18816 /* tslint:enable:no-shadowed-variable */
18819 if (isTemplateStringsArray(stringsOrOptions)) {
18820 var strings = stringsOrOptions; // Is first interpolated value a reference to outdent, alone on its own line, without any preceding non-whitespace?
18822 var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]); // Perform outdentation
18824 var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
18825 var renderedArray = cache.get(strings);
18827 if (!renderedArray) {
18828 renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
18829 cache.set(strings, renderedArray);
18831 /** If no interpolated values, skip concatenation step */
18834 if (values.length === 0) {
18835 return renderedArray[0];
18837 /** Concatenate string literals with interpolated values */
18840 var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
18843 // Create and return a new instance of outdent with the given options
18844 return createInstance(extend(extend({}, options), stringsOrOptions || {}));
18848 var fullOutdent = extend(outdent, {
18849 string: function (str) {
18850 return _outdentArray([str], false, options)[0];
18853 return fullOutdent;
18856 var defaultOutdent = createInstance({
18857 trimLeadingNewline: true,
18858 trimTrailingNewline: true
18860 exports.outdent = defaultOutdent; // Named exports. Simple and preferred.
18861 // import outdent from 'outdent';
18863 exports.default = defaultOutdent;
18866 // In webpack harmony-modules environments, module.exports is read-only,
18867 // so we fail gracefully.
18869 module.exports = defaultOutdent;
18870 Object.defineProperty(defaultOutdent, "__esModule", {
18873 defaultOutdent.default = defaultOutdent;
18874 defaultOutdent.outdent = defaultOutdent;
18877 })(lib, lib.exports);
18883 coreOptions: coreOptions$1
18884 } = prettierInternal;
18885 const categoryOrder = [coreOptions$1.CATEGORY_OUTPUT, coreOptions$1.CATEGORY_FORMAT, coreOptions$1.CATEGORY_CONFIG, coreOptions$1.CATEGORY_EDITOR, coreOptions$1.CATEGORY_OTHER];
18889 * // The type of the option. For 'choice', see also `choices` below.
18890 * // When passing a type other than the ones listed below, the option is
18891 * // treated as taking any string as argument, and `--option <${type}>` will
18892 * // be displayed in --help.
18893 * type: "boolean" | "choice" | "int" | string;
18895 * // Default value to be passed to the minimist option `default`.
18898 * // Alias name to be passed to the minimist option `alias`.
18901 * // For grouping options by category in --help.
18902 * category?: string;
18904 * // Description to be displayed in --help. If omitted, the option won't be
18905 * // shown at all in --help (but see also `oppositeDescription` below).
18906 * description?: string;
18908 * // Description for `--no-${name}` to be displayed in --help. If omitted,
18909 * // `--no-${name}` won't be shown.
18910 * oppositeDescription?: string;
18912 * // Indicate if this option is simply passed to the API.
18913 * // true: use camelified name as the API option name.
18914 * // string: use this value as the API option name.
18915 * forwardToApi?: boolean | string;
18917 * // Indicate that a CLI flag should be an array when forwarded to the API.
18920 * // Specify available choices for validation. They will also be displayed
18921 * // in --help as <a|b|c>.
18922 * // Use an object instead of a string if a choice is deprecated and should
18923 * // be treated as `redirect` instead, or if you'd like to add description for
18927 * | { value: string, description?: string, deprecated?: boolean, redirect?: string }
18930 * // If the option has a value that is an exception to the regular value
18931 * // constraints, indicate that value here (or use a function for more
18933 * exception?: ((value: any) => boolean);
18935 * // Indicate that the option is deprecated. Use a string to add an extra
18936 * // message to --help for the option, for example to suggest a replacement
18938 * deprecated?: true | string;
18942 * Note: The options below are sorted alphabetically.
18948 category: coreOptions$1.CATEGORY_OUTPUT,
18950 description: outdent`
18951 Check if the given files are formatted, print a human-friendly summary
18952 message and paths to unformatted files (see also --list-different).
18956 // The supports-color package (a sub sub dependency) looks directly at
18957 // `process.argv` for `--no-color` and such-like options. The reason it is
18958 // listed here is to avoid "Ignored unknown option: --no-color" warnings.
18959 // See https://github.com/chalk/supports-color/#info for more information.
18962 description: "Colorize error messages.",
18963 oppositeDescription: "Do not colorize error messages."
18967 category: coreOptions$1.CATEGORY_CONFIG,
18968 description: "Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).",
18969 oppositeDescription: "Do not look for a configuration file.",
18970 exception: value => value === false
18972 "config-precedence": {
18974 category: coreOptions$1.CATEGORY_CONFIG,
18975 default: "cli-override",
18977 value: "cli-override",
18978 description: "CLI options take precedence over config file"
18980 value: "file-override",
18981 description: "Config file take precedence over CLI options"
18983 value: "prefer-file",
18984 description: outdent`
18985 If a config file is found will evaluate it and ignore other CLI options.
18986 If no config file is found CLI options will evaluate as normal.
18989 description: "Define in which order config files and CLI options should be evaluated."
18991 "debug-benchmark": {
18992 // Run the formatting benchmarks. Requires 'benchmark' module to be installed.
18996 // Run the formatting once again on the formatted output, throw if different.
18999 "debug-print-doc": {
19002 "debug-print-comments": {
19005 "debug-print-ast": {
19009 // Repeat the formatting a few times and measure the average duration.
19015 category: coreOptions$1.CATEGORY_CONFIG,
19016 description: "Take .editorconfig into account when parsing configuration.",
19017 oppositeDescription: "Don't take .editorconfig into account when parsing configuration.",
19020 "error-on-unmatched-pattern": {
19022 oppositeDescription: "Prevent errors when pattern is unmatched."
19024 "find-config-path": {
19026 category: coreOptions$1.CATEGORY_CONFIG,
19027 description: "Find and print the path to a configuration file for the given input file."
19031 description: outdent`
19032 Extract the following info (as JSON) for a given file path. Reported fields:
19033 * ignored (boolean) - true if file path is filtered by --ignore-path
19034 * inferredParser (string | null) - name of parser inferred from file path
19040 description: outdent`
19041 Show CLI usage, or details about the given flag.
19042 Example: --help write
19044 exception: value => value === ""
19048 category: coreOptions$1.CATEGORY_CONFIG,
19049 default: ".prettierignore",
19050 description: "Path to a file with patterns describing files to ignore."
19052 "ignore-unknown": {
19055 description: "Ignore unknown files."
19057 "list-different": {
19059 category: coreOptions$1.CATEGORY_OUTPUT,
19061 description: "Print the names of files that are different from Prettier's formatting (see also --check)."
19065 description: "What level of logs to report.",
19067 choices: ["silent", "error", "warn", "log", "debug"]
19071 description: "Print support information as JSON."
19076 description: "Print Prettier version."
19078 "with-node-modules": {
19080 category: coreOptions$1.CATEGORY_CONFIG,
19081 description: "Process files inside 'node_modules' directory."
19086 category: coreOptions$1.CATEGORY_OUTPUT,
19087 description: "Edit files in-place. (Beware!)"
19090 const usageSummary = outdent`
19091 Usage: prettier [options] [file/dir/glob ...]
19093 By default, output is written to stdout.
19094 Stdin is read if it is piped to Prettier and no files are given.
19102 const dashify = dashify$2;
19105 } = prettierInternal;
19107 function normalizeDetailedOption(name, option) {
19108 return Object.assign(Object.assign({
19109 category: coreOptions.CATEGORY_OTHER
19111 choices: option.choices && option.choices.map(choice => {
19112 const newChoice = Object.assign({
19115 }, typeof choice === "object" ? choice : {
19118 /* istanbul ignore next */
19120 if (newChoice.value === true) {
19121 newChoice.value = ""; // backward compatibility for original boolean option
19129 function normalizeDetailedOptionMap$2(detailedOptionMap) {
19130 return Object.fromEntries(Object.entries(detailedOptionMap).sort(([leftName], [rightName]) => leftName.localeCompare(rightName)).map(([name, option]) => [name, normalizeDetailedOption(name, option)]));
19133 function createDetailedOptionMap$2(supportOptions) {
19134 return Object.fromEntries(supportOptions.map(option => {
19135 const newOption = Object.assign(Object.assign({}, option), {}, {
19136 name: option.cliName || dashify(option.name),
19137 description: option.cliDescription || option.description,
19138 category: option.cliCategory || coreOptions.CATEGORY_FORMAT,
19139 forwardToApi: option.name
19141 /* istanbul ignore next */
19143 if (option.deprecated) {
19144 delete newOption.forwardToApi;
19145 delete newOption.description;
19146 delete newOption.oppositeDescription;
19147 newOption.deprecated = true;
19150 return [newOption.name, newOption];
19155 normalizeDetailedOptionMap: normalizeDetailedOptionMap$2,
19156 createDetailedOptionMap: createDetailedOptionMap$2
19159 const pick = pick_1; // eslint-disable-next-line no-restricted-modules
19161 const prettier$3 = require$$3;
19164 optionsNormalizer: {
19165 normalizeCliOptions
19170 } = prettierInternal;
19171 const minimist = minimist_1;
19172 const constant$1 = constant$2;
19174 createDetailedOptionMap: createDetailedOptionMap$1,
19175 normalizeDetailedOptionMap: normalizeDetailedOptionMap$1
19177 const createMinimistOptions = createMinimistOptions$2;
19179 * @typedef {Object} Context
19181 * @property {string[]} rawArguments
19183 * @property {string[]} filePatterns
19184 * @property {any[]} supportOptions
19185 * @property detailedOptions
19186 * @property detailedOptionMap
19187 * @property apiDefaultOptions
19188 * @property languages
19189 * @property {Partial<Context>[]} stack
19190 * @property pushContextPlugins
19191 * @property popContextPlugins
19199 this.rawArguments = rawArguments;
19200 this.logger = logger;
19204 "plugin-search-dir": pluginSearchDirs
19205 } = parseArgvWithoutPlugins$1(rawArguments, logger, ["plugin", "plugin-search-dir"]);
19206 this.pushContextPlugins(plugins, pluginSearchDirs);
19207 const argv = parseArgv(rawArguments, this.detailedOptions, logger);
19209 this.filePatterns = argv._.map(file => String(file));
19212 * @param {string[]} plugins
19213 * @param {string[]=} pluginSearchDirs
19217 pushContextPlugins(plugins, pluginSearchDirs) {
19218 this.stack.push(pick(this, ["supportOptions", "detailedOptions", "detailedOptionMap", "apiDefaultOptions", "languages"]));
19219 Object.assign(this, getContextOptions(plugins, pluginSearchDirs));
19222 popContextPlugins() {
19223 Object.assign(this, this.stack.pop());
19228 function getContextOptions(plugins, pluginSearchDirs) {
19230 options: supportOptions,
19232 } = prettier$3.getSupportInfo({
19233 showDeprecated: true,
19234 showUnreleased: true,
19235 showInternal: true,
19239 const detailedOptionMap = normalizeDetailedOptionMap$1(Object.assign(Object.assign({}, createDetailedOptionMap$1(supportOptions)), constant$1.options));
19240 const detailedOptions = arrayify(detailedOptionMap, "name");
19241 const apiDefaultOptions = Object.assign(Object.assign({}, optionsModule.hiddenDefaults), Object.fromEntries(supportOptions.filter(({
19243 }) => !deprecated).map(option => [option.name, option.default])));
19253 function parseArgv(rawArguments, detailedOptions, logger, keys) {
19254 const minimistOptions = createMinimistOptions(detailedOptions);
19255 let argv = minimist(rawArguments, minimistOptions);
19258 detailedOptions = detailedOptions.filter(option => keys.includes(option.name));
19259 argv = pick(argv, keys);
19262 return normalizeCliOptions(argv, detailedOptions, {
19267 const detailedOptionsWithoutPlugins = getContextOptions().detailedOptions;
19269 function parseArgvWithoutPlugins$1(rawArguments, logger, keys) {
19270 return parseArgv(rawArguments, detailedOptionsWithoutPlugins, logger, typeof keys === "string" ? [keys] : keys);
19274 Context: Context$1,
19275 parseArgvWithoutPlugins: parseArgvWithoutPlugins$1
19279 var flattenIntoArray = flattenIntoArray_1;
19280 var toObject = toObject$4;
19281 var lengthOfArrayLike = lengthOfArrayLike$6;
19282 var toIntegerOrInfinity = toIntegerOrInfinity$3;
19283 var arraySpeciesCreate = arraySpeciesCreate$2;
19285 // `Array.prototype.flat` method
19286 // https://tc39.es/ecma262/#sec-array.prototype.flat
19287 $({ target: 'Array', proto: true }, {
19288 flat: function flat(/* depthArg = 1 */) {
19289 var depthArg = arguments.length ? arguments[0] : undefined;
19290 var O = toObject(this);
19291 var sourceLen = lengthOfArrayLike(O);
19292 var A = arraySpeciesCreate(O, 0);
19293 A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));
19298 var internalObjectKeys = objectKeysInternal;
19299 var enumBugKeys$1 = enumBugKeys$3;
19301 // `Object.keys` method
19302 // https://tc39.es/ecma262/#sec-object.keys
19303 // eslint-disable-next-line es/no-object-keys -- safe
19304 var objectKeys$1 = Object.keys || function keys(O) {
19305 return internalObjectKeys(O, enumBugKeys$1);
19308 var DESCRIPTORS = descriptors;
19309 var definePropertyModule$1 = objectDefineProperty;
19310 var anObject$1 = anObject$7;
19311 var toIndexedObject = toIndexedObject$4;
19312 var objectKeys = objectKeys$1;
19314 // `Object.defineProperties` method
19315 // https://tc39.es/ecma262/#sec-object.defineproperties
19316 // eslint-disable-next-line es/no-object-defineproperties -- safe
19317 var objectDefineProperties = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
19319 var props = toIndexedObject(Properties);
19320 var keys = objectKeys(Properties);
19321 var length = keys.length;
19324 while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]);
19328 var getBuiltIn = getBuiltIn$5;
19330 var html$1 = getBuiltIn('document', 'documentElement');
19332 /* global ActiveXObject -- old IE, WSH */
19334 var anObject = anObject$7;
19335 var defineProperties = objectDefineProperties;
19336 var enumBugKeys = enumBugKeys$3;
19337 var hiddenKeys = hiddenKeys$4;
19339 var documentCreateElement = documentCreateElement$1;
19340 var sharedKey = sharedKey$2;
19344 var PROTOTYPE = 'prototype';
19345 var SCRIPT = 'script';
19346 var IE_PROTO = sharedKey('IE_PROTO');
19348 var EmptyConstructor = function () { /* empty */ };
19350 var scriptTag = function (content) {
19351 return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
19354 // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
19355 var NullProtoObjectViaActiveX = function (activeXDocument) {
19356 activeXDocument.write(scriptTag(''));
19357 activeXDocument.close();
19358 var temp = activeXDocument.parentWindow.Object;
19359 activeXDocument = null; // avoid memory leak
19363 // Create object with fake `null` prototype: use iframe Object with cleared prototype
19364 var NullProtoObjectViaIFrame = function () {
19365 // Thrash, waste and sodomy: IE GC bug
19366 var iframe = documentCreateElement('iframe');
19367 var JS = 'java' + SCRIPT + ':';
19368 var iframeDocument;
19369 iframe.style.display = 'none';
19370 html.appendChild(iframe);
19371 // https://github.com/zloirock/core-js/issues/475
19372 iframe.src = String(JS);
19373 iframeDocument = iframe.contentWindow.document;
19374 iframeDocument.open();
19375 iframeDocument.write(scriptTag('document.F=Object'));
19376 iframeDocument.close();
19377 return iframeDocument.F;
19380 // Check for document.domain and active x support
19381 // No need to use active x approach when document.domain is not set
19382 // see https://github.com/es-shims/es5-shim/issues/150
19383 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
19385 var activeXDocument;
19386 var NullProtoObject = function () {
19388 activeXDocument = new ActiveXObject('htmlfile');
19389 } catch (error) { /* ignore */ }
19390 NullProtoObject = typeof document != 'undefined'
19391 ? document.domain && activeXDocument
19392 ? NullProtoObjectViaActiveX(activeXDocument) // old IE
19393 : NullProtoObjectViaIFrame()
19394 : NullProtoObjectViaActiveX(activeXDocument); // WSH
19395 var length = enumBugKeys.length;
19396 while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
19397 return NullProtoObject();
19400 hiddenKeys[IE_PROTO] = true;
19402 // `Object.create` method
19403 // https://tc39.es/ecma262/#sec-object.create
19404 var objectCreate = Object.create || function create(O, Properties) {
19407 EmptyConstructor[PROTOTYPE] = anObject(O);
19408 result = new EmptyConstructor();
19409 EmptyConstructor[PROTOTYPE] = null;
19410 // add "__proto__" for Object.getPrototypeOf polyfill
19411 result[IE_PROTO] = O;
19412 } else result = NullProtoObject();
19413 return Properties === undefined ? result : defineProperties(result, Properties);
19416 var wellKnownSymbol = wellKnownSymbol$7;
19417 var create = objectCreate;
19418 var definePropertyModule = objectDefineProperty;
19420 var UNSCOPABLES = wellKnownSymbol('unscopables');
19421 var ArrayPrototype = Array.prototype;
19423 // Array.prototype[@@unscopables]
19424 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
19425 if (ArrayPrototype[UNSCOPABLES] == undefined) {
19426 definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
19427 configurable: true,
19428 value: create(null)
19432 // add a key to Array.prototype[@@unscopables]
19433 var addToUnscopables$1 = function (key) {
19434 ArrayPrototype[UNSCOPABLES][key] = true;
19437 // this method was added to unscopables after implementation
19438 // in popular engines, so it's moved to a separate module
19439 var addToUnscopables = addToUnscopables$1;
19441 // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
19442 addToUnscopables('flat');
19444 var baseAssignValue = _baseAssignValue,
19445 createAggregator = _createAggregator;
19446 /** Used for built-in method references. */
19448 var objectProto = Object.prototype;
19449 /** Used to check objects for own properties. */
19451 var hasOwnProperty = objectProto.hasOwnProperty;
19453 * Creates an object composed of keys generated from the results of running
19454 * each element of `collection` thru `iteratee`. The order of grouped values
19455 * is determined by the order they occur in `collection`. The corresponding
19456 * value of each key is an array of elements responsible for generating the
19457 * key. The iteratee is invoked with one argument: (value).
19462 * @category Collection
19463 * @param {Array|Object} collection The collection to iterate over.
19464 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
19465 * @returns {Object} Returns the composed aggregate object.
19468 * _.groupBy([6.1, 4.2, 6.3], Math.floor);
19469 * // => { '4': [4.2], '6': [6.1, 6.3] }
19471 * // The `_.property` iteratee shorthand.
19472 * _.groupBy(['one', 'two', 'three'], 'length');
19473 * // => { '3': ['one', 'two'], '5': ['three'] }
19476 var groupBy$1 = createAggregator(function (result, value, key) {
19477 if (hasOwnProperty.call(result, key)) {
19478 result[key].push(value);
19480 baseAssignValue(result, key, [value]);
19483 var groupBy_1 = groupBy$1;
19485 var camelcase = {exports: {}};
19487 const UPPERCASE = /[\p{Lu}]/u;
19488 const LOWERCASE = /[\p{Ll}]/u;
19489 const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
19490 const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
19491 const SEPARATORS = /[_.\- ]+/;
19492 const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);
19493 const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
19494 const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu');
19496 const preserveCamelCase = (string, locale) => {
19497 let isLastCharLower = false;
19498 let isLastCharUpper = false;
19499 let isLastLastCharUpper = false;
19501 for (let i = 0; i < string.length; i++) {
19502 const character = string[i];
19504 if (isLastCharLower && UPPERCASE.test(character)) {
19505 string = string.slice(0, i) + '-' + string.slice(i);
19506 isLastCharLower = false;
19507 isLastLastCharUpper = isLastCharUpper;
19508 isLastCharUpper = true;
19510 } else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
19511 string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
19512 isLastLastCharUpper = isLastCharUpper;
19513 isLastCharUpper = false;
19514 isLastCharLower = true;
19516 isLastCharLower = character.toLocaleLowerCase(locale) === character && character.toLocaleUpperCase(locale) !== character;
19517 isLastLastCharUpper = isLastCharUpper;
19518 isLastCharUpper = character.toLocaleUpperCase(locale) === character && character.toLocaleLowerCase(locale) !== character;
19525 const preserveConsecutiveUppercase = input => {
19526 LEADING_CAPITAL.lastIndex = 0;
19527 return input.replace(LEADING_CAPITAL, m1 => m1.toLowerCase());
19530 const postProcess = (input, options) => {
19531 SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
19532 NUMBERS_AND_IDENTIFIER.lastIndex = 0;
19533 return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => identifier.toLocaleUpperCase(options.locale)).replace(NUMBERS_AND_IDENTIFIER, m => m.toLocaleUpperCase(options.locale));
19536 const camelCase$1 = (input, options) => {
19537 if (!(typeof input === 'string' || Array.isArray(input))) {
19538 throw new TypeError('Expected the input to be `string | string[]`');
19541 options = Object.assign({
19543 preserveConsecutiveUppercase: false
19546 if (Array.isArray(input)) {
19547 input = input.map(x => x.trim()).filter(x => x.length).join('-');
19549 input = input.trim();
19552 if (input.length === 0) {
19556 if (input.length === 1) {
19557 return options.pascalCase ? input.toLocaleUpperCase(options.locale) : input.toLocaleLowerCase(options.locale);
19560 const hasUpperCase = input !== input.toLocaleLowerCase(options.locale);
19562 if (hasUpperCase) {
19563 input = preserveCamelCase(input, options.locale);
19566 input = input.replace(LEADING_SEPARATORS, '');
19568 if (options.preserveConsecutiveUppercase) {
19569 input = preserveConsecutiveUppercase(input);
19571 input = input.toLocaleLowerCase();
19574 if (options.pascalCase) {
19575 input = input.charAt(0).toLocaleUpperCase(options.locale) + input.slice(1);
19578 return postProcess(input, options);
19581 camelcase.exports = camelCase$1; // TODO: Remove this for the next major release
19583 camelcase.exports.default = camelCase$1;
19585 const groupBy = groupBy_1;
19586 const camelCase = camelcase.exports;
19587 const constant = constant$2;
19588 const OPTION_USAGE_THRESHOLD = 25;
19589 const CHOICE_USAGE_MARGIN = 3;
19590 const CHOICE_USAGE_INDENTATION = 2;
19592 function indent(str, spaces) {
19593 return str.replace(/^/gm, " ".repeat(spaces));
19596 function createDefaultValueDisplay(value) {
19597 return Array.isArray(value) ? `[${value.map(createDefaultValueDisplay).join(", ")}]` : value;
19600 function getOptionDefaultValue(context, optionName) {
19602 if (!(optionName in context.detailedOptionMap)) {
19606 const option = context.detailedOptionMap[optionName];
19608 if (option.default !== undefined) {
19609 return option.default;
19612 const optionCamelName = camelCase(optionName);
19614 if (optionCamelName in context.apiDefaultOptions) {
19615 return context.apiDefaultOptions[optionCamelName];
19619 function createOptionUsageHeader(option) {
19620 const name = `--${option.name}`;
19621 const alias = option.alias ? `-${option.alias},` : null;
19622 const type = createOptionUsageType(option);
19623 return [alias, name, type].filter(Boolean).join(" ");
19626 function createOptionUsageRow(header, content, threshold) {
19627 const separator = header.length >= threshold ? `\n${" ".repeat(threshold)}` : " ".repeat(threshold - header.length);
19628 const description = content.replace(/\n/g, `\n${" ".repeat(threshold)}`);
19629 return `${header}${separator}${description}`;
19632 function createOptionUsageType(option) {
19633 switch (option.type) {
19638 return `<${option.choices.filter(choice => !choice.deprecated && choice.since !== null).map(choice => choice.value).join("|")}>`;
19641 return `<${option.type}>`;
19645 function createChoiceUsages(choices, margin, indentation) {
19646 const activeChoices = choices.filter(choice => !choice.deprecated && choice.since !== null);
19647 const threshold = Math.max(0, ...activeChoices.map(choice => choice.value.length)) + margin;
19648 return activeChoices.map(choice => indent(createOptionUsageRow(choice.value, choice.description, threshold), indentation));
19651 function createOptionUsage(context, option, threshold) {
19652 const header = createOptionUsageHeader(option);
19653 const optionDefaultValue = getOptionDefaultValue(context, option.name);
19654 return createOptionUsageRow(header, `${option.description}${optionDefaultValue === undefined ? "" : `\nDefaults to ${createDefaultValueDisplay(optionDefaultValue)}.`}`, threshold);
19657 function getOptionsWithOpposites(options) {
19658 // Add --no-foo after --foo.
19659 const optionsWithOpposites = options.map(option => [option.description ? option : null, option.oppositeDescription ? Object.assign(Object.assign({}, option), {}, {
19660 name: `no-${option.name}`,
19662 description: option.oppositeDescription
19664 return optionsWithOpposites.flat().filter(Boolean);
19667 function createUsage$1(context) {
19668 const options = getOptionsWithOpposites(context.detailedOptions).filter( // remove unnecessary option (e.g. `semi`, `color`, etc.), which is only used for --help <flag>
19669 option => !(option.type === "boolean" && option.oppositeDescription && !option.name.startsWith("no-")));
19670 const groupedOptions = groupBy(options, option => option.category);
19671 const firstCategories = constant.categoryOrder.slice(0, -1);
19672 const lastCategories = constant.categoryOrder.slice(-1);
19673 const restCategories = Object.keys(groupedOptions).filter(category => !constant.categoryOrder.includes(category));
19674 const allCategories = [...firstCategories, ...restCategories, ...lastCategories];
19675 const optionsUsage = allCategories.map(category => {
19676 const categoryOptions = groupedOptions[category].map(option => createOptionUsage(context, option, OPTION_USAGE_THRESHOLD)).join("\n");
19677 return `${category} options:\n\n${indent(categoryOptions, 2)}`;
19679 return [constant.usageSummary, ...optionsUsage, ""].join("\n\n");
19682 function createDetailedUsage$1(context, flag) {
19683 const option = getOptionsWithOpposites(context.detailedOptions).find(option => option.name === flag || option.alias === flag);
19684 const header = createOptionUsageHeader(option);
19685 const description = `\n\n${indent(option.description, 2)}`;
19686 const choices = option.type !== "choice" ? "" : `\n\nValid options:\n\n${createChoiceUsages(option.choices, CHOICE_USAGE_MARGIN, CHOICE_USAGE_INDENTATION).join("\n")}`;
19687 const optionDefaultValue = getOptionDefaultValue(context, option.name);
19688 const defaults = optionDefaultValue !== undefined ? `\n\nDefault: ${createDefaultValueDisplay(optionDefaultValue)}` : "";
19689 const pluginDefaults = option.pluginDefaults && Object.keys(option.pluginDefaults).length > 0 ? `\nPlugin defaults:${Object.entries(option.pluginDefaults).map(([key, value]) => `\n* ${key}: ${createDefaultValueDisplay(value)}`)}` : "";
19690 return `${header}${description}${choices}${defaults}${pluginDefaults}`;
19694 createUsage: createUsage$1,
19695 createDetailedUsage: createDetailedUsage$1
19698 var ansiRegex$1 = ({
19701 const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
19702 return new RegExp(pattern, onlyFirst ? undefined : 'g');
19705 const ansiRegex = ansiRegex$1;
19707 var stripAnsi$1 = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
19709 var wcwidth$2 = {exports: {}};
19711 var clone$1 = {exports: {}};
19713 (function (module) {
19714 var clone = function () {
19716 * Clones (copies) an Object using deep copying.
19718 * This function supports circular references by default, but if you are certain
19719 * there are no circular references in your object, you can save some CPU time
19720 * by calling clone(obj, false).
19722 * Caution: if `circular` is false and `parent` contains circular references,
19723 * your program may enter an infinite loop and crash.
19725 * @param `parent` - the object to be cloned
19726 * @param `circular` - set to true if the object to be cloned may contain
19727 * circular references. (optional - true by default)
19728 * @param `depth` - set to a number if the object is only to be cloned to
19729 * a particular depth. (optional - defaults to Infinity)
19730 * @param `prototype` - sets the prototype to be used when cloning an object.
19731 * (optional - defaults to parent prototype).
19734 function clone(parent, circular, depth, prototype) {
19736 if (typeof circular === 'object') {
19737 depth = circular.depth;
19738 prototype = circular.prototype;
19739 circular = circular.circular;
19740 } // maintain two arrays for circular references, where corresponding parents
19741 // and children have the same index
19744 var allParents = [];
19745 var allChildren = [];
19746 var useBuffer = typeof Buffer != 'undefined';
19747 if (typeof circular == 'undefined') circular = true;
19748 if (typeof depth == 'undefined') depth = Infinity; // recurse this function so we don't reset allParents and allChildren
19750 function _clone(parent, depth) {
19751 // cloning null always returns null
19752 if (parent === null) return null;
19753 if (depth == 0) return parent;
19757 if (typeof parent != 'object') {
19761 if (clone.__isArray(parent)) {
19763 } else if (clone.__isRegExp(parent)) {
19764 child = new RegExp(parent.source, __getRegExpFlags(parent));
19765 if (parent.lastIndex) child.lastIndex = parent.lastIndex;
19766 } else if (clone.__isDate(parent)) {
19767 child = new Date(parent.getTime());
19768 } else if (useBuffer && Buffer.isBuffer(parent)) {
19769 if (Buffer.allocUnsafe) {
19770 // Node.js >= 4.5.0
19771 child = Buffer.allocUnsafe(parent.length);
19773 // Older Node.js versions
19774 child = new Buffer(parent.length);
19777 parent.copy(child);
19780 if (typeof prototype == 'undefined') {
19781 proto = Object.getPrototypeOf(parent);
19782 child = Object.create(proto);
19784 child = Object.create(prototype);
19790 var index = allParents.indexOf(parent);
19793 return allChildren[index];
19796 allParents.push(parent);
19797 allChildren.push(child);
19800 for (var i in parent) {
19804 attrs = Object.getOwnPropertyDescriptor(proto, i);
19807 if (attrs && attrs.set == null) {
19811 child[i] = _clone(parent[i], depth - 1);
19817 return _clone(parent, depth);
19820 * Simple flat clone using prototype, accepts only objects, usefull for property
19821 * override on FLAT configuration object (no nested props).
19823 * USE WITH CAUTION! This may not behave as you wish if you do not know how this
19828 clone.clonePrototype = function clonePrototype(parent) {
19829 if (parent === null) return null;
19831 var c = function () {};
19833 c.prototype = parent;
19835 }; // private utility functions
19838 function __objToStr(o) {
19839 return Object.prototype.toString.call(o);
19841 clone.__objToStr = __objToStr;
19843 function __isDate(o) {
19844 return typeof o === 'object' && __objToStr(o) === '[object Date]';
19846 clone.__isDate = __isDate;
19848 function __isArray(o) {
19849 return typeof o === 'object' && __objToStr(o) === '[object Array]';
19851 clone.__isArray = __isArray;
19853 function __isRegExp(o) {
19854 return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
19856 clone.__isRegExp = __isRegExp;
19858 function __getRegExpFlags(re) {
19860 if (re.global) flags += 'g';
19861 if (re.ignoreCase) flags += 'i';
19862 if (re.multiline) flags += 'm';
19865 clone.__getRegExpFlags = __getRegExpFlags;
19869 if (module.exports) {
19870 module.exports = clone;
19874 var clone = clone$1.exports;
19876 var defaults$1 = function (options, defaults) {
19877 options = options || {};
19878 Object.keys(defaults).forEach(function (key) {
19879 if (typeof options[key] === 'undefined') {
19880 options[key] = clone(defaults[key]);
19886 var combining$1 = [[0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489], [0x0591, 0x05BD], [0x05BF, 0x05BF], [0x05C1, 0x05C2], [0x05C4, 0x05C5], [0x05C7, 0x05C7], [0x0600, 0x0603], [0x0610, 0x0615], [0x064B, 0x065E], [0x0670, 0x0670], [0x06D6, 0x06E4], [0x06E7, 0x06E8], [0x06EA, 0x06ED], [0x070F, 0x070F], [0x0711, 0x0711], [0x0730, 0x074A], [0x07A6, 0x07B0], [0x07EB, 0x07F3], [0x0901, 0x0902], [0x093C, 0x093C], [0x0941, 0x0948], [0x094D, 0x094D], [0x0951, 0x0954], [0x0962, 0x0963], [0x0981, 0x0981], [0x09BC, 0x09BC], [0x09C1, 0x09C4], [0x09CD, 0x09CD], [0x09E2, 0x09E3], [0x0A01, 0x0A02], [0x0A3C, 0x0A3C], [0x0A41, 0x0A42], [0x0A47, 0x0A48], [0x0A4B, 0x0A4D], [0x0A70, 0x0A71], [0x0A81, 0x0A82], [0x0ABC, 0x0ABC], [0x0AC1, 0x0AC5], [0x0AC7, 0x0AC8], [0x0ACD, 0x0ACD], [0x0AE2, 0x0AE3], [0x0B01, 0x0B01], [0x0B3C, 0x0B3C], [0x0B3F, 0x0B3F], [0x0B41, 0x0B43], [0x0B4D, 0x0B4D], [0x0B56, 0x0B56], [0x0B82, 0x0B82], [0x0BC0, 0x0BC0], [0x0BCD, 0x0BCD], [0x0C3E, 0x0C40], [0x0C46, 0x0C48], [0x0C4A, 0x0C4D], [0x0C55, 0x0C56], [0x0CBC, 0x0CBC], [0x0CBF, 0x0CBF], [0x0CC6, 0x0CC6], [0x0CCC, 0x0CCD], [0x0CE2, 0x0CE3], [0x0D41, 0x0D43], [0x0D4D, 0x0D4D], [0x0DCA, 0x0DCA], [0x0DD2, 0x0DD4], [0x0DD6, 0x0DD6], [0x0E31, 0x0E31], [0x0E34, 0x0E3A], [0x0E47, 0x0E4E], [0x0EB1, 0x0EB1], [0x0EB4, 0x0EB9], [0x0EBB, 0x0EBC], [0x0EC8, 0x0ECD], [0x0F18, 0x0F19], [0x0F35, 0x0F35], [0x0F37, 0x0F37], [0x0F39, 0x0F39], [0x0F71, 0x0F7E], [0x0F80, 0x0F84], [0x0F86, 0x0F87], [0x0F90, 0x0F97], [0x0F99, 0x0FBC], [0x0FC6, 0x0FC6], [0x102D, 0x1030], [0x1032, 0x1032], [0x1036, 0x1037], [0x1039, 0x1039], [0x1058, 0x1059], [0x1160, 0x11FF], [0x135F, 0x135F], [0x1712, 0x1714], [0x1732, 0x1734], [0x1752, 0x1753], [0x1772, 0x1773], [0x17B4, 0x17B5], [0x17B7, 0x17BD], [0x17C6, 0x17C6], [0x17C9, 0x17D3], [0x17DD, 0x17DD], [0x180B, 0x180D], [0x18A9, 0x18A9], [0x1920, 0x1922], [0x1927, 0x1928], [0x1932, 0x1932], [0x1939, 0x193B], [0x1A17, 0x1A18], [0x1B00, 0x1B03], [0x1B34, 0x1B34], [0x1B36, 0x1B3A], [0x1B3C, 0x1B3C], [0x1B42, 0x1B42], [0x1B6B, 0x1B73], [0x1DC0, 0x1DCA], [0x1DFE, 0x1DFF], [0x200B, 0x200F], [0x202A, 0x202E], [0x2060, 0x2063], [0x206A, 0x206F], [0x20D0, 0x20EF], [0x302A, 0x302F], [0x3099, 0x309A], [0xA806, 0xA806], [0xA80B, 0xA80B], [0xA825, 0xA826], [0xFB1E, 0xFB1E], [0xFE00, 0xFE0F], [0xFE20, 0xFE23], [0xFEFF, 0xFEFF], [0xFFF9, 0xFFFB], [0x10A01, 0x10A03], [0x10A05, 0x10A06], [0x10A0C, 0x10A0F], [0x10A38, 0x10A3A], [0x10A3F, 0x10A3F], [0x1D167, 0x1D169], [0x1D173, 0x1D182], [0x1D185, 0x1D18B], [0x1D1AA, 0x1D1AD], [0x1D242, 0x1D244], [0xE0001, 0xE0001], [0xE0020, 0xE007F], [0xE0100, 0xE01EF]];
19888 var defaults = defaults$1;
19889 var combining = combining$1;
19895 wcwidth$2.exports = function wcwidth(str) {
19896 return wcswidth(str, DEFAULTS);
19899 wcwidth$2.exports.config = function (opts) {
19900 opts = defaults(opts || {}, DEFAULTS);
19901 return function wcwidth(str) {
19902 return wcswidth(str, opts);
19906 * The following functions define the column width of an ISO 10646
19907 * character as follows:
19908 * - The null character (U+0000) has a column width of 0.
19909 * - Other C0/C1 control characters and DEL will lead to a return value
19911 * - Non-spacing and enclosing combining characters (general category
19912 * code Mn or Me in the
19913 * Unicode database) have a column width of 0.
19914 * - SOFT HYPHEN (U+00AD) has a column width of 1.
19915 * - Other format characters (general category code Cf in the Unicode
19916 * database) and ZERO WIDTH
19917 * SPACE (U+200B) have a column width of 0.
19918 * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF)
19919 * have a column width of 0.
19920 * - Spacing characters in the East Asian Wide (W) or East Asian
19921 * Full-width (F) category as
19922 * defined in Unicode Technical Report #11 have a column width of 2.
19923 * - All remaining characters (including all printable ISO 8859-1 and
19924 * WGL4 characters, Unicode control characters, etc.) have a column
19926 * This implementation assumes that characters are encoded in ISO 10646.
19930 function wcswidth(str, opts) {
19931 if (typeof str !== 'string') return wcwidth$1(str, opts);
19934 for (var i = 0; i < str.length; i++) {
19935 var n = wcwidth$1(str.charCodeAt(i), opts);
19936 if (n < 0) return -1;
19943 function wcwidth$1(ucs, opts) {
19944 // test for 8-bit control characters
19945 if (ucs === 0) return opts.nul;
19946 if (ucs < 32 || ucs >= 0x7f && ucs < 0xa0) return opts.control; // binary search in table of non-spacing characters
19948 if (bisearch(ucs)) return 0; // if we arrive here, ucs is not a combining or C0/C1 control character
19950 return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || // Hangul Jamo init. consonants
19951 ucs == 0x2329 || ucs == 0x232a || ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f || // CJK ... Yi
19952 ucs >= 0xac00 && ucs <= 0xd7a3 || // Hangul Syllables
19953 ucs >= 0xf900 && ucs <= 0xfaff || // CJK Compatibility Ideographs
19954 ucs >= 0xfe10 && ucs <= 0xfe19 || // Vertical forms
19955 ucs >= 0xfe30 && ucs <= 0xfe6f || // CJK Compatibility Forms
19956 ucs >= 0xff00 && ucs <= 0xff60 || // Fullwidth Forms
19957 ucs >= 0xffe0 && ucs <= 0xffe6 || ucs >= 0x20000 && ucs <= 0x2fffd || ucs >= 0x30000 && ucs <= 0x3fffd));
19960 function bisearch(ucs) {
19962 var max = combining.length - 1;
19964 if (ucs < combining[0][0] || ucs > combining[max][1]) return false;
19966 while (max >= min) {
19967 mid = Math.floor((min + max) / 2);
19968 if (ucs > combining[mid][1]) min = mid + 1;else if (ucs < combining[mid][0]) max = mid - 1;else return true;
19974 const readline = require$$0__default$6["default"];
19975 const chalk = source;
19976 const stripAnsi = stripAnsi$1;
19977 const wcwidth = wcwidth$2.exports;
19979 const countLines = (stream, text) => {
19980 const columns = stream.columns || 80;
19983 for (const line of stripAnsi(text).split("\n")) {
19984 lineCount += Math.max(1, Math.ceil(wcwidth(line) / columns));
19990 const clear = (stream, text) => () => {
19991 const lineCount = countLines(stream, text);
19993 for (let line = 0; line < lineCount; line++) {
19995 readline.moveCursor(stream, 0, -1);
19998 readline.clearLine(stream, 0);
19999 readline.cursorTo(stream, 0);
20003 const emptyLogResult = {
20008 function createLogger$1(logLevel = "log") {
20011 warn: createLogFunc("warn", "yellow"),
20012 error: createLogFunc("error", "red"),
20013 debug: createLogFunc("debug", "blue"),
20014 log: createLogFunc("log")
20017 function createLogFunc(loggerName, color) {
20018 if (!shouldLog(loggerName)) {
20019 return () => emptyLogResult;
20022 const prefix = color ? `[${chalk[color](loggerName)}] ` : "";
20023 const stream = process[loggerName === "log" ? "stdout" : "stderr"];
20024 return (message, options) => {
20025 options = Object.assign({
20029 message = message.replace(/^/gm, prefix) + (options.newline ? "\n" : "");
20030 stream.write(message);
20032 if (options.clearable) {
20034 clear: clear(stream, message)
20040 function shouldLog(loggerName) {
20041 switch (logLevel) {
20046 if (loggerName === "debug") {
20053 if (loggerName === "log") {
20060 if (loggerName === "warn") {
20067 return loggerName === "error";
20073 createLogger: createLogger$1
20076 const path = require$$0__default$1["default"];
20077 const stringify$1 = fastJsonStableStringify; // eslint-disable-next-line no-restricted-modules
20079 const prettier$2 = require$$3;
20087 parseArgvWithoutPlugins
20090 normalizeDetailedOptionMap,
20091 createDetailedOptionMap
20094 createDetailedUsage,
20101 async function logResolvedConfigPathOrDie(context) {
20102 const file = context.argv["find-config-path"];
20103 const configFile = await prettier$2.resolveConfigFile(file);
20106 context.logger.log(path.relative(process.cwd(), configFile));
20108 throw new Error(`Can not find configure file for "${file}"`);
20112 async function logFileInfoOrDie(context) {
20114 ignorePath: context.argv["ignore-path"],
20115 withNodeModules: context.argv["with-node-modules"],
20116 plugins: context.argv.plugin,
20117 pluginSearchDirs: context.argv["plugin-search-dir"],
20118 resolveConfig: context.argv.config !== false
20120 context.logger.log(prettier$2.format(stringify$1(await prettier$2.getFileInfo(context.argv["file-info"], options)), {
20127 createDetailedOptionMap,
20128 createDetailedUsage,
20133 logResolvedConfigPathOrDie,
20135 normalizeDetailedOptionMap,
20136 parseArgvWithoutPlugins,
20140 const packageJson = require$$0;
20141 pleaseUpgradeNode(packageJson); // eslint-disable-next-line import/order
20143 const stringify = fastJsonStableStringify; // eslint-disable-next-line no-restricted-modules
20145 const prettier$1 = require$$3;
20146 const core = core$1;
20148 async function run(rawArguments) {
20149 // Create a default level logger, so we can log errors during `logLevel` parsing
20150 let logger = core.createLogger();
20153 const logLevel = core.parseArgvWithoutPlugins(rawArguments, logger, "loglevel").loglevel;
20155 if (logLevel !== logger.logLevel) {
20156 logger = core.createLogger(logLevel);
20159 await main(rawArguments, logger);
20161 logger.error(error.message);
20162 process.exitCode = 1;
20166 async function main(rawArguments, logger) {
20167 const context = new core.Context({
20171 logger.debug(`normalized argv: ${JSON.stringify(context.argv)}`);
20173 if (context.argv.check && context.argv["list-different"]) {
20174 throw new Error("Cannot use --check and --list-different together.");
20177 if (context.argv.write && context.argv["debug-check"]) {
20178 throw new Error("Cannot use --write and --debug-check together.");
20181 if (context.argv["find-config-path"] && context.filePatterns.length > 0) {
20182 throw new Error("Cannot use --find-config-path with multiple files");
20185 if (context.argv["file-info"] && context.filePatterns.length > 0) {
20186 throw new Error("Cannot use --file-info with multiple files");
20189 if (context.argv.version) {
20190 logger.log(prettier$1.version);
20194 if (context.argv.help !== undefined) {
20195 logger.log(typeof context.argv.help === "string" && context.argv.help !== "" ? core.createDetailedUsage(context, context.argv.help) : core.createUsage(context));
20199 if (context.argv["support-info"]) {
20200 logger.log(prettier$1.format(stringify(prettier$1.getSupportInfo()), {
20206 const hasFilePatterns = context.filePatterns.length > 0;
20207 const useStdin = !hasFilePatterns && (!process.stdin.isTTY || context.argv["stdin-filepath"]);
20209 if (context.argv["find-config-path"]) {
20210 await core.logResolvedConfigPathOrDie(context);
20211 } else if (context.argv["file-info"]) {
20212 await core.logFileInfoOrDie(context);
20213 } else if (useStdin) {
20214 await core.formatStdin(context);
20215 } else if (hasFilePatterns) {
20216 await core.formatFiles(context);
20218 logger.log(core.createUsage(context));
20219 process.exitCode = 1;
20227 var prettier = cli.run(process.argv.slice(2));
20229 module.exports = prettier;