1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __defProps = Object.defineProperties;
4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5 var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6 var __getOwnPropNames = Object.getOwnPropertyNames;
7 var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8 var __getProtoOf = Object.getPrototypeOf;
9 var __hasOwnProp = Object.prototype.hasOwnProperty;
10 var __propIsEnum = Object.prototype.propertyIsEnumerable;
11 var __defNormalProp = (obj2, key, value) => key in obj2 ? __defProp(obj2, key, { enumerable: true, configurable: true, writable: true, value }) : obj2[key] = value;
12 var __spreadValues = (a, b) => {
13 for (var prop in b || (b = {}))
14 if (__hasOwnProp.call(b, prop))
15 __defNormalProp(a, prop, b[prop]);
16 if (__getOwnPropSymbols)
17 for (var prop of __getOwnPropSymbols(b)) {
18 if (__propIsEnum.call(b, prop))
19 __defNormalProp(a, prop, b[prop]);
23 var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24 var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25 var __esm = (fn, res) => function __init() {
26 return fn && (res = (0, fn[Object.keys(fn)[0]])(fn = 0)), res;
28 var __commonJS = (cb, mod) => function __require() {
29 return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
31 var __export = (target, all) => {
32 __markAsModule(target);
34 __defProp(target, name, { get: all[name], enumerable: true });
36 var __reExport = (target, module2, desc) => {
37 if (module2 && typeof module2 === "object" || typeof module2 === "function") {
38 for (let key of __getOwnPropNames(module2))
39 if (!__hasOwnProp.call(target, key) && key !== "default")
40 __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
44 var __toModule = (module2) => {
45 return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
48 // node_modules/vscode-jsonrpc/lib/common/ral.js
49 var require_ral = __commonJS({
50 "node_modules/vscode-jsonrpc/lib/common/ral.js"(exports2) {
52 Object.defineProperty(exports2, "__esModule", { value: true });
55 if (_ral === void 0) {
56 throw new Error(`No runtime abstraction layer installed`);
61 function install2(ral) {
63 throw new Error(`No runtime abstraction layer provided`);
67 RAL2.install = install2;
68 })(RAL || (RAL = {}));
69 exports2.default = RAL;
73 // node_modules/vscode-jsonrpc/lib/common/disposable.js
74 var require_disposable = __commonJS({
75 "node_modules/vscode-jsonrpc/lib/common/disposable.js"(exports2) {
77 Object.defineProperty(exports2, "__esModule", { value: true });
78 exports2.Disposable = void 0;
80 (function(Disposable4) {
81 function create(func) {
86 Disposable4.create = create;
87 })(Disposable3 = exports2.Disposable || (exports2.Disposable = {}));
91 // node_modules/vscode-jsonrpc/lib/common/messageBuffer.js
92 var require_messageBuffer = __commonJS({
93 "node_modules/vscode-jsonrpc/lib/common/messageBuffer.js"(exports2) {
95 Object.defineProperty(exports2, "__esModule", { value: true });
96 exports2.AbstractMessageBuffer = void 0;
100 var AbstractMessageBuffer = class {
101 constructor(encoding = "utf-8") {
102 this._encoding = encoding;
104 this._totalLength = 0;
107 return this._encoding;
110 const toAppend = typeof chunk === "string" ? this.fromString(chunk, this._encoding) : chunk;
111 this._chunks.push(toAppend);
112 this._totalLength += toAppend.byteLength;
115 if (this._chunks.length === 0) {
121 let chunkBytesRead = 0;
123 while (chunkIndex < this._chunks.length) {
124 const chunk = this._chunks[chunkIndex];
127 while (offset < chunk.length) {
128 const value = chunk[offset];
160 chunkBytesRead += chunk.byteLength;
166 const buffer = this._read(chunkBytesRead + offset);
167 const result = new Map();
168 const headers = this.toString(buffer, "ascii").split(CRLF);
169 if (headers.length < 2) {
172 for (let i = 0; i < headers.length - 2; i++) {
173 const header = headers[i];
174 const index = header.indexOf(":");
176 throw new Error("Message header must separate key and value using :");
178 const key = header.substr(0, index);
179 const value = header.substr(index + 1).trim();
180 result.set(key, value);
184 tryReadBody(length) {
185 if (this._totalLength < length) {
188 return this._read(length);
190 get numberOfBytes() {
191 return this._totalLength;
194 if (byteCount === 0) {
195 return this.emptyBuffer();
197 if (byteCount > this._totalLength) {
198 throw new Error(`Cannot read so many bytes!`);
200 if (this._chunks[0].byteLength === byteCount) {
201 const chunk = this._chunks[0];
202 this._chunks.shift();
203 this._totalLength -= byteCount;
204 return this.asNative(chunk);
206 if (this._chunks[0].byteLength > byteCount) {
207 const chunk = this._chunks[0];
208 const result2 = this.asNative(chunk, byteCount);
209 this._chunks[0] = chunk.slice(byteCount);
210 this._totalLength -= byteCount;
213 const result = this.allocNative(byteCount);
214 let resultOffset = 0;
216 while (byteCount > 0) {
217 const chunk = this._chunks[chunkIndex];
218 if (chunk.byteLength > byteCount) {
219 const chunkPart = chunk.slice(0, byteCount);
220 result.set(chunkPart, resultOffset);
221 resultOffset += byteCount;
222 this._chunks[chunkIndex] = chunk.slice(byteCount);
223 this._totalLength -= byteCount;
224 byteCount -= byteCount;
226 result.set(chunk, resultOffset);
227 resultOffset += chunk.byteLength;
228 this._chunks.shift();
229 this._totalLength -= chunk.byteLength;
230 byteCount -= chunk.byteLength;
236 exports2.AbstractMessageBuffer = AbstractMessageBuffer;
240 // node_modules/vscode-jsonrpc/lib/node/ril.js
241 var require_ril = __commonJS({
242 "node_modules/vscode-jsonrpc/lib/node/ril.js"(exports2) {
244 Object.defineProperty(exports2, "__esModule", { value: true });
245 var ral_1 = require_ral();
246 var util_1 = require("util");
247 var disposable_1 = require_disposable();
248 var messageBuffer_1 = require_messageBuffer();
249 var MessageBuffer = class extends messageBuffer_1.AbstractMessageBuffer {
250 constructor(encoding = "utf-8") {
254 return MessageBuffer.emptyBuffer;
256 fromString(value, encoding) {
257 return Buffer.from(value, encoding);
259 toString(value, encoding) {
260 if (value instanceof Buffer) {
261 return value.toString(encoding);
263 return new util_1.TextDecoder(encoding).decode(value);
266 asNative(buffer, length) {
267 if (length === void 0) {
268 return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
270 return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
273 allocNative(length) {
274 return Buffer.allocUnsafe(length);
277 MessageBuffer.emptyBuffer = Buffer.allocUnsafe(0);
278 var ReadableStreamWrapper = class {
279 constructor(stream) {
280 this.stream = stream;
283 this.stream.on("close", listener);
284 return disposable_1.Disposable.create(() => this.stream.off("close", listener));
287 this.stream.on("error", listener);
288 return disposable_1.Disposable.create(() => this.stream.off("error", listener));
291 this.stream.on("end", listener);
292 return disposable_1.Disposable.create(() => this.stream.off("end", listener));
295 this.stream.on("data", listener);
296 return disposable_1.Disposable.create(() => this.stream.off("data", listener));
299 var WritableStreamWrapper = class {
300 constructor(stream) {
301 this.stream = stream;
304 this.stream.on("close", listener);
305 return disposable_1.Disposable.create(() => this.stream.off("close", listener));
308 this.stream.on("error", listener);
309 return disposable_1.Disposable.create(() => this.stream.off("error", listener));
312 this.stream.on("end", listener);
313 return disposable_1.Disposable.create(() => this.stream.off("end", listener));
315 write(data, encoding) {
316 return new Promise((resolve, reject) => {
317 const callback = (error) => {
318 if (error === void 0 || error === null) {
324 if (typeof data === "string") {
325 this.stream.write(data, encoding, callback);
327 this.stream.write(data, callback);
335 var _ril = Object.freeze({
336 messageBuffer: Object.freeze({
337 create: (encoding) => new MessageBuffer(encoding)
339 applicationJson: Object.freeze({
340 encoder: Object.freeze({
341 name: "application/json",
342 encode: (msg, options) => {
344 return Promise.resolve(Buffer.from(JSON.stringify(msg, void 0, 0), options.charset));
346 return Promise.reject(err);
350 decoder: Object.freeze({
351 name: "application/json",
352 decode: (buffer, options) => {
354 if (buffer instanceof Buffer) {
355 return Promise.resolve(JSON.parse(buffer.toString(options.charset)));
357 return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer)));
360 return Promise.reject(err);
365 stream: Object.freeze({
366 asReadableStream: (stream) => new ReadableStreamWrapper(stream),
367 asWritableStream: (stream) => new WritableStreamWrapper(stream)
370 timer: Object.freeze({
371 setTimeout(callback, ms, ...args) {
372 return setTimeout(callback, ms, ...args);
374 clearTimeout(handle) {
375 clearTimeout(handle);
377 setImmediate(callback, ...args) {
378 return setImmediate(callback, ...args);
380 clearImmediate(handle) {
381 clearImmediate(handle);
389 function install2() {
390 ral_1.default.install(_ril);
392 RIL2.install = install2;
393 })(RIL || (RIL = {}));
394 exports2.default = RIL;
398 // node_modules/vscode-jsonrpc/lib/common/is.js
399 var require_is = __commonJS({
400 "node_modules/vscode-jsonrpc/lib/common/is.js"(exports2) {
402 Object.defineProperty(exports2, "__esModule", { value: true });
403 exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
404 function boolean(value) {
405 return value === true || value === false;
407 exports2.boolean = boolean;
408 function string(value) {
409 return typeof value === "string" || value instanceof String;
411 exports2.string = string;
412 function number(value) {
413 return typeof value === "number" || value instanceof Number;
415 exports2.number = number;
416 function error(value) {
417 return value instanceof Error;
419 exports2.error = error;
420 function func(value) {
421 return typeof value === "function";
423 exports2.func = func;
424 function array(value) {
425 return Array.isArray(value);
427 exports2.array = array;
428 function stringArray(value) {
429 return array(value) && value.every((elem) => string(elem));
431 exports2.stringArray = stringArray;
435 // node_modules/vscode-jsonrpc/lib/common/messages.js
436 var require_messages = __commonJS({
437 "node_modules/vscode-jsonrpc/lib/common/messages.js"(exports2) {
439 Object.defineProperty(exports2, "__esModule", { value: true });
440 exports2.isResponseMessage = exports2.isNotificationMessage = exports2.isRequestMessage = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType = exports2.RequestType0 = exports2.AbstractMessageSignature = exports2.ParameterStructures = exports2.ResponseError = exports2.ErrorCodes = void 0;
441 var is = require_is();
443 (function(ErrorCodes2) {
444 ErrorCodes2.ParseError = -32700;
445 ErrorCodes2.InvalidRequest = -32600;
446 ErrorCodes2.MethodNotFound = -32601;
447 ErrorCodes2.InvalidParams = -32602;
448 ErrorCodes2.InternalError = -32603;
449 ErrorCodes2.jsonrpcReservedErrorRangeStart = -32099;
450 ErrorCodes2.serverErrorStart = ErrorCodes2.jsonrpcReservedErrorRangeStart;
451 ErrorCodes2.MessageWriteError = -32099;
452 ErrorCodes2.MessageReadError = -32098;
453 ErrorCodes2.ServerNotInitialized = -32002;
454 ErrorCodes2.UnknownErrorCode = -32001;
455 ErrorCodes2.jsonrpcReservedErrorRangeEnd = -32e3;
456 ErrorCodes2.serverErrorEnd = ErrorCodes2.jsonrpcReservedErrorRangeEnd;
457 })(ErrorCodes = exports2.ErrorCodes || (exports2.ErrorCodes = {}));
458 var ResponseError = class extends Error {
459 constructor(code, message, data) {
461 this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;
463 Object.setPrototypeOf(this, ResponseError.prototype);
468 message: this.message,
473 exports2.ResponseError = ResponseError;
474 var ParameterStructures = class {
479 return value === ParameterStructures.auto || value === ParameterStructures.byName || value === ParameterStructures.byPosition;
485 exports2.ParameterStructures = ParameterStructures;
486 ParameterStructures.auto = new ParameterStructures("auto");
487 ParameterStructures.byPosition = new ParameterStructures("byPosition");
488 ParameterStructures.byName = new ParameterStructures("byName");
489 var AbstractMessageSignature = class {
490 constructor(method, numberOfParams) {
491 this.method = method;
492 this.numberOfParams = numberOfParams;
494 get parameterStructures() {
495 return ParameterStructures.auto;
498 exports2.AbstractMessageSignature = AbstractMessageSignature;
499 var RequestType02 = class extends AbstractMessageSignature {
500 constructor(method) {
504 exports2.RequestType0 = RequestType02;
505 var RequestType3 = class extends AbstractMessageSignature {
506 constructor(method, _parameterStructures = ParameterStructures.auto) {
508 this._parameterStructures = _parameterStructures;
510 get parameterStructures() {
511 return this._parameterStructures;
514 exports2.RequestType = RequestType3;
515 var RequestType1 = class extends AbstractMessageSignature {
516 constructor(method, _parameterStructures = ParameterStructures.auto) {
518 this._parameterStructures = _parameterStructures;
520 get parameterStructures() {
521 return this._parameterStructures;
524 exports2.RequestType1 = RequestType1;
525 var RequestType22 = class extends AbstractMessageSignature {
526 constructor(method) {
530 exports2.RequestType2 = RequestType22;
531 var RequestType32 = class extends AbstractMessageSignature {
532 constructor(method) {
536 exports2.RequestType3 = RequestType32;
537 var RequestType4 = class extends AbstractMessageSignature {
538 constructor(method) {
542 exports2.RequestType4 = RequestType4;
543 var RequestType5 = class extends AbstractMessageSignature {
544 constructor(method) {
548 exports2.RequestType5 = RequestType5;
549 var RequestType6 = class extends AbstractMessageSignature {
550 constructor(method) {
554 exports2.RequestType6 = RequestType6;
555 var RequestType7 = class extends AbstractMessageSignature {
556 constructor(method) {
560 exports2.RequestType7 = RequestType7;
561 var RequestType8 = class extends AbstractMessageSignature {
562 constructor(method) {
566 exports2.RequestType8 = RequestType8;
567 var RequestType9 = class extends AbstractMessageSignature {
568 constructor(method) {
572 exports2.RequestType9 = RequestType9;
573 var NotificationType2 = class extends AbstractMessageSignature {
574 constructor(method, _parameterStructures = ParameterStructures.auto) {
576 this._parameterStructures = _parameterStructures;
578 get parameterStructures() {
579 return this._parameterStructures;
582 exports2.NotificationType = NotificationType2;
583 var NotificationType0 = class extends AbstractMessageSignature {
584 constructor(method) {
588 exports2.NotificationType0 = NotificationType0;
589 var NotificationType1 = class extends AbstractMessageSignature {
590 constructor(method, _parameterStructures = ParameterStructures.auto) {
592 this._parameterStructures = _parameterStructures;
594 get parameterStructures() {
595 return this._parameterStructures;
598 exports2.NotificationType1 = NotificationType1;
599 var NotificationType22 = class extends AbstractMessageSignature {
600 constructor(method) {
604 exports2.NotificationType2 = NotificationType22;
605 var NotificationType3 = class extends AbstractMessageSignature {
606 constructor(method) {
610 exports2.NotificationType3 = NotificationType3;
611 var NotificationType4 = class extends AbstractMessageSignature {
612 constructor(method) {
616 exports2.NotificationType4 = NotificationType4;
617 var NotificationType5 = class extends AbstractMessageSignature {
618 constructor(method) {
622 exports2.NotificationType5 = NotificationType5;
623 var NotificationType6 = class extends AbstractMessageSignature {
624 constructor(method) {
628 exports2.NotificationType6 = NotificationType6;
629 var NotificationType7 = class extends AbstractMessageSignature {
630 constructor(method) {
634 exports2.NotificationType7 = NotificationType7;
635 var NotificationType8 = class extends AbstractMessageSignature {
636 constructor(method) {
640 exports2.NotificationType8 = NotificationType8;
641 var NotificationType9 = class extends AbstractMessageSignature {
642 constructor(method) {
646 exports2.NotificationType9 = NotificationType9;
647 function isRequestMessage(message) {
648 const candidate = message;
649 return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));
651 exports2.isRequestMessage = isRequestMessage;
652 function isNotificationMessage(message) {
653 const candidate = message;
654 return candidate && is.string(candidate.method) && message.id === void 0;
656 exports2.isNotificationMessage = isNotificationMessage;
657 function isResponseMessage(message) {
658 const candidate = message;
659 return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);
661 exports2.isResponseMessage = isResponseMessage;
665 // node_modules/vscode-jsonrpc/lib/common/events.js
666 var require_events = __commonJS({
667 "node_modules/vscode-jsonrpc/lib/common/events.js"(exports2) {
669 Object.defineProperty(exports2, "__esModule", { value: true });
670 exports2.Emitter = exports2.Event = void 0;
671 var ral_1 = require_ral();
674 const _disposable = { dispose() {
676 Event3.None = function() {
679 })(Event2 = exports2.Event || (exports2.Event = {}));
680 var CallbackList = class {
681 add(callback, context = null, bucket) {
682 if (!this._callbacks) {
683 this._callbacks = [];
686 this._callbacks.push(callback);
687 this._contexts.push(context);
688 if (Array.isArray(bucket)) {
689 bucket.push({ dispose: () => this.remove(callback, context) });
692 remove(callback, context = null) {
693 if (!this._callbacks) {
696 let foundCallbackWithDifferentContext = false;
697 for (let i = 0, len = this._callbacks.length; i < len; i++) {
698 if (this._callbacks[i] === callback) {
699 if (this._contexts[i] === context) {
700 this._callbacks.splice(i, 1);
701 this._contexts.splice(i, 1);
704 foundCallbackWithDifferentContext = true;
708 if (foundCallbackWithDifferentContext) {
709 throw new Error("When adding a listener with a context, you should remove it with the same context");
713 if (!this._callbacks) {
716 const ret2 = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);
717 for (let i = 0, len = callbacks.length; i < len; i++) {
719 ret2.push(callbacks[i].apply(contexts[i], args));
721 ral_1.default().console.error(e);
727 return !this._callbacks || this._callbacks.length === 0;
730 this._callbacks = void 0;
731 this._contexts = void 0;
734 var Emitter2 = class {
735 constructor(_options) {
736 this._options = _options;
740 this._event = (listener, thisArgs, disposables) => {
741 if (!this._callbacks) {
742 this._callbacks = new CallbackList();
744 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
745 this._options.onFirstListenerAdd(this);
747 this._callbacks.add(listener, thisArgs);
750 if (!this._callbacks) {
753 this._callbacks.remove(listener, thisArgs);
754 result.dispose = Emitter2._noop;
755 if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
756 this._options.onLastListenerRemove(this);
760 if (Array.isArray(disposables)) {
761 disposables.push(result);
769 if (this._callbacks) {
770 this._callbacks.invoke.call(this._callbacks, event);
774 if (this._callbacks) {
775 this._callbacks.dispose();
776 this._callbacks = void 0;
780 exports2.Emitter = Emitter2;
781 Emitter2._noop = function() {
786 // node_modules/vscode-jsonrpc/lib/common/cancellation.js
787 var require_cancellation = __commonJS({
788 "node_modules/vscode-jsonrpc/lib/common/cancellation.js"(exports2) {
790 Object.defineProperty(exports2, "__esModule", { value: true });
791 exports2.CancellationTokenSource = exports2.CancellationToken = void 0;
792 var ral_1 = require_ral();
793 var Is2 = require_is();
794 var events_1 = require_events();
795 var CancellationToken;
796 (function(CancellationToken2) {
797 CancellationToken2.None = Object.freeze({
798 isCancellationRequested: false,
799 onCancellationRequested: events_1.Event.None
801 CancellationToken2.Cancelled = Object.freeze({
802 isCancellationRequested: true,
803 onCancellationRequested: events_1.Event.None
806 const candidate = value;
807 return candidate && (candidate === CancellationToken2.None || candidate === CancellationToken2.Cancelled || Is2.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested);
809 CancellationToken2.is = is;
810 })(CancellationToken = exports2.CancellationToken || (exports2.CancellationToken = {}));
811 var shortcutEvent = Object.freeze(function(callback, context) {
812 const handle = ral_1.default().timer.setTimeout(callback.bind(context), 0);
814 ral_1.default().timer.clearTimeout(handle);
817 var MutableToken = class {
819 this._isCancelled = false;
822 if (!this._isCancelled) {
823 this._isCancelled = true;
825 this._emitter.fire(void 0);
830 get isCancellationRequested() {
831 return this._isCancelled;
833 get onCancellationRequested() {
834 if (this._isCancelled) {
835 return shortcutEvent;
837 if (!this._emitter) {
838 this._emitter = new events_1.Emitter();
840 return this._emitter.event;
844 this._emitter.dispose();
845 this._emitter = void 0;
849 var CancellationTokenSource = class {
852 this._token = new MutableToken();
858 this._token = CancellationToken.Cancelled;
860 this._token.cancel();
865 this._token = CancellationToken.None;
866 } else if (this._token instanceof MutableToken) {
867 this._token.dispose();
871 exports2.CancellationTokenSource = CancellationTokenSource;
875 // node_modules/vscode-jsonrpc/lib/common/messageReader.js
876 var require_messageReader = __commonJS({
877 "node_modules/vscode-jsonrpc/lib/common/messageReader.js"(exports2) {
879 Object.defineProperty(exports2, "__esModule", { value: true });
880 exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = void 0;
881 var ral_1 = require_ral();
882 var Is2 = require_is();
883 var events_1 = require_events();
885 (function(MessageReader2) {
887 let candidate = value;
888 return candidate && Is2.func(candidate.listen) && Is2.func(candidate.dispose) && Is2.func(candidate.onError) && Is2.func(candidate.onClose) && Is2.func(candidate.onPartialMessage);
890 MessageReader2.is = is;
891 })(MessageReader = exports2.MessageReader || (exports2.MessageReader = {}));
892 var AbstractMessageReader = class {
894 this.errorEmitter = new events_1.Emitter();
895 this.closeEmitter = new events_1.Emitter();
896 this.partialMessageEmitter = new events_1.Emitter();
899 this.errorEmitter.dispose();
900 this.closeEmitter.dispose();
903 return this.errorEmitter.event;
906 this.errorEmitter.fire(this.asError(error));
909 return this.closeEmitter.event;
912 this.closeEmitter.fire(void 0);
914 get onPartialMessage() {
915 return this.partialMessageEmitter.event;
917 firePartialMessage(info) {
918 this.partialMessageEmitter.fire(info);
921 if (error instanceof Error) {
924 return new Error(`Reader received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`);
928 exports2.AbstractMessageReader = AbstractMessageReader;
929 var ResolvedMessageReaderOptions;
930 (function(ResolvedMessageReaderOptions2) {
931 function fromOptions(options) {
936 const contentDecoders = new Map();
937 let contentTypeDecoder;
938 const contentTypeDecoders = new Map();
939 if (options === void 0 || typeof options === "string") {
940 charset = options !== null && options !== void 0 ? options : "utf-8";
942 charset = (_a = options.charset) !== null && _a !== void 0 ? _a : "utf-8";
943 if (options.contentDecoder !== void 0) {
944 contentDecoder = options.contentDecoder;
945 contentDecoders.set(contentDecoder.name, contentDecoder);
947 if (options.contentDecoders !== void 0) {
948 for (const decoder of options.contentDecoders) {
949 contentDecoders.set(decoder.name, decoder);
952 if (options.contentTypeDecoder !== void 0) {
953 contentTypeDecoder = options.contentTypeDecoder;
954 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
956 if (options.contentTypeDecoders !== void 0) {
957 for (const decoder of options.contentTypeDecoders) {
958 contentTypeDecoders.set(decoder.name, decoder);
962 if (contentTypeDecoder === void 0) {
963 contentTypeDecoder = ral_1.default().applicationJson.decoder;
964 contentTypeDecoders.set(contentTypeDecoder.name, contentTypeDecoder);
966 return { charset, contentDecoder, contentDecoders, contentTypeDecoder, contentTypeDecoders };
968 ResolvedMessageReaderOptions2.fromOptions = fromOptions;
969 })(ResolvedMessageReaderOptions || (ResolvedMessageReaderOptions = {}));
970 var ReadableStreamMessageReader = class extends AbstractMessageReader {
971 constructor(readable, options) {
973 this.readable = readable;
974 this.options = ResolvedMessageReaderOptions.fromOptions(options);
975 this.buffer = ral_1.default().messageBuffer.create(this.options.charset);
976 this._partialMessageTimeout = 1e4;
977 this.nextMessageLength = -1;
978 this.messageToken = 0;
980 set partialMessageTimeout(timeout) {
981 this._partialMessageTimeout = timeout;
983 get partialMessageTimeout() {
984 return this._partialMessageTimeout;
987 this.nextMessageLength = -1;
988 this.messageToken = 0;
989 this.partialMessageTimer = void 0;
990 this.callback = callback;
991 const result = this.readable.onData((data) => {
994 this.readable.onError((error) => this.fireError(error));
995 this.readable.onClose(() => this.fireClose());
999 this.buffer.append(data);
1001 if (this.nextMessageLength === -1) {
1002 const headers = this.buffer.tryReadHeaders();
1006 const contentLength = headers.get("Content-Length");
1007 if (!contentLength) {
1008 throw new Error("Header must provide a Content-Length property.");
1010 const length = parseInt(contentLength);
1011 if (isNaN(length)) {
1012 throw new Error("Content-Length value must be a number.");
1014 this.nextMessageLength = length;
1016 const body = this.buffer.tryReadBody(this.nextMessageLength);
1017 if (body === void 0) {
1018 this.setPartialMessageTimer();
1021 this.clearPartialMessageTimer();
1022 this.nextMessageLength = -1;
1024 if (this.options.contentDecoder !== void 0) {
1025 p = this.options.contentDecoder.decode(body);
1027 p = Promise.resolve(body);
1030 this.options.contentTypeDecoder.decode(value, this.options).then((msg) => {
1033 this.fireError(error);
1036 this.fireError(error);
1040 clearPartialMessageTimer() {
1041 if (this.partialMessageTimer) {
1042 ral_1.default().timer.clearTimeout(this.partialMessageTimer);
1043 this.partialMessageTimer = void 0;
1046 setPartialMessageTimer() {
1047 this.clearPartialMessageTimer();
1048 if (this._partialMessageTimeout <= 0) {
1051 this.partialMessageTimer = ral_1.default().timer.setTimeout((token, timeout) => {
1052 this.partialMessageTimer = void 0;
1053 if (token === this.messageToken) {
1054 this.firePartialMessage({ messageToken: token, waitingTime: timeout });
1055 this.setPartialMessageTimer();
1057 }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);
1060 exports2.ReadableStreamMessageReader = ReadableStreamMessageReader;
1064 // node_modules/vscode-jsonrpc/lib/common/semaphore.js
1065 var require_semaphore = __commonJS({
1066 "node_modules/vscode-jsonrpc/lib/common/semaphore.js"(exports2) {
1068 Object.defineProperty(exports2, "__esModule", { value: true });
1069 exports2.Semaphore = void 0;
1070 var ral_1 = require_ral();
1071 var Semaphore = class {
1072 constructor(capacity = 1) {
1073 if (capacity <= 0) {
1074 throw new Error("Capacity must be greater than 0");
1076 this._capacity = capacity;
1081 return new Promise((resolve, reject) => {
1082 this._waiting.push({ thunk, resolve, reject });
1087 return this._active;
1090 if (this._waiting.length === 0 || this._active === this._capacity) {
1093 ral_1.default().timer.setImmediate(() => this.doRunNext());
1096 if (this._waiting.length === 0 || this._active === this._capacity) {
1099 const next = this._waiting.shift();
1101 if (this._active > this._capacity) {
1102 throw new Error(`To many thunks active`);
1105 const result = next.thunk();
1106 if (result instanceof Promise) {
1107 result.then((value) => {
1109 next.resolve(value);
1118 next.resolve(result);
1128 exports2.Semaphore = Semaphore;
1132 // node_modules/vscode-jsonrpc/lib/common/messageWriter.js
1133 var require_messageWriter = __commonJS({
1134 "node_modules/vscode-jsonrpc/lib/common/messageWriter.js"(exports2) {
1136 Object.defineProperty(exports2, "__esModule", { value: true });
1137 exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = void 0;
1138 var ral_1 = require_ral();
1139 var Is2 = require_is();
1140 var semaphore_1 = require_semaphore();
1141 var events_1 = require_events();
1142 var ContentLength = "Content-Length: ";
1145 (function(MessageWriter2) {
1146 function is(value) {
1147 let candidate = value;
1148 return candidate && Is2.func(candidate.dispose) && Is2.func(candidate.onClose) && Is2.func(candidate.onError) && Is2.func(candidate.write);
1150 MessageWriter2.is = is;
1151 })(MessageWriter = exports2.MessageWriter || (exports2.MessageWriter = {}));
1152 var AbstractMessageWriter = class {
1154 this.errorEmitter = new events_1.Emitter();
1155 this.closeEmitter = new events_1.Emitter();
1158 this.errorEmitter.dispose();
1159 this.closeEmitter.dispose();
1162 return this.errorEmitter.event;
1164 fireError(error, message, count) {
1165 this.errorEmitter.fire([this.asError(error), message, count]);
1168 return this.closeEmitter.event;
1171 this.closeEmitter.fire(void 0);
1174 if (error instanceof Error) {
1177 return new Error(`Writer received error. Reason: ${Is2.string(error.message) ? error.message : "unknown"}`);
1181 exports2.AbstractMessageWriter = AbstractMessageWriter;
1182 var ResolvedMessageWriterOptions;
1183 (function(ResolvedMessageWriterOptions2) {
1184 function fromOptions(options) {
1186 if (options === void 0 || typeof options === "string") {
1187 return { charset: options !== null && options !== void 0 ? options : "utf-8", contentTypeEncoder: ral_1.default().applicationJson.encoder };
1189 return { charset: (_a = options.charset) !== null && _a !== void 0 ? _a : "utf-8", contentEncoder: options.contentEncoder, contentTypeEncoder: (_b = options.contentTypeEncoder) !== null && _b !== void 0 ? _b : ral_1.default().applicationJson.encoder };
1192 ResolvedMessageWriterOptions2.fromOptions = fromOptions;
1193 })(ResolvedMessageWriterOptions || (ResolvedMessageWriterOptions = {}));
1194 var WriteableStreamMessageWriter = class extends AbstractMessageWriter {
1195 constructor(writable, options) {
1197 this.writable = writable;
1198 this.options = ResolvedMessageWriterOptions.fromOptions(options);
1199 this.errorCount = 0;
1200 this.writeSemaphore = new semaphore_1.Semaphore(1);
1201 this.writable.onError((error) => this.fireError(error));
1202 this.writable.onClose(() => this.fireClose());
1205 return this.writeSemaphore.lock(async () => {
1206 const payload = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
1207 if (this.options.contentEncoder !== void 0) {
1208 return this.options.contentEncoder.encode(buffer);
1213 return payload.then((buffer) => {
1215 headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
1217 return this.doWrite(msg, headers, buffer);
1219 this.fireError(error);
1224 async doWrite(msg, headers, data) {
1226 await this.writable.write(headers.join(""), "ascii");
1227 return this.writable.write(data);
1229 this.handleError(error, msg);
1230 return Promise.reject(error);
1233 handleError(error, msg) {
1235 this.fireError(error, msg, this.errorCount);
1238 this.writable.end();
1241 exports2.WriteableStreamMessageWriter = WriteableStreamMessageWriter;
1245 // node_modules/vscode-jsonrpc/lib/common/linkedMap.js
1246 var require_linkedMap = __commonJS({
1247 "node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) {
1249 Object.defineProperty(exports2, "__esModule", { value: true });
1250 exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0;
1255 Touch2.AsOld = Touch2.First;
1257 Touch2.AsNew = Touch2.Last;
1258 })(Touch = exports2.Touch || (exports2.Touch = {}));
1259 var LinkedMap = class {
1261 this[Symbol.toStringTag] = "LinkedMap";
1262 this._map = new Map();
1263 this._head = void 0;
1264 this._tail = void 0;
1270 this._head = void 0;
1271 this._tail = void 0;
1276 return !this._head && !this._tail;
1283 return (_a = this._head) === null || _a === void 0 ? void 0 : _a.value;
1287 return (_a = this._tail) === null || _a === void 0 ? void 0 : _a.value;
1290 return this._map.has(key);
1292 get(key, touch = Touch.None) {
1293 const item = this._map.get(key);
1297 if (touch !== Touch.None) {
1298 this.touch(item, touch);
1302 set(key, value, touch = Touch.None) {
1303 let item = this._map.get(key);
1306 if (touch !== Touch.None) {
1307 this.touch(item, touch);
1310 item = { key, value, next: void 0, previous: void 0 };
1313 this.addItemLast(item);
1316 this.addItemFirst(item);
1319 this.addItemLast(item);
1322 this.addItemLast(item);
1325 this._map.set(key, item);
1331 return !!this.remove(key);
1334 const item = this._map.get(key);
1338 this._map.delete(key);
1339 this.removeItem(item);
1344 if (!this._head && !this._tail) {
1347 if (!this._head || !this._tail) {
1348 throw new Error("Invalid list");
1350 const item = this._head;
1351 this._map.delete(item.key);
1352 this.removeItem(item);
1356 forEach(callbackfn, thisArg) {
1357 const state = this._state;
1358 let current = this._head;
1361 callbackfn.bind(thisArg)(current.value, current.key, this);
1363 callbackfn(current.value, current.key, this);
1365 if (this._state !== state) {
1366 throw new Error(`LinkedMap got modified during iteration.`);
1368 current = current.next;
1373 const state = this._state;
1374 let current = this._head;
1376 [Symbol.iterator]() {
1380 if (map._state !== state) {
1381 throw new Error(`LinkedMap got modified during iteration.`);
1384 const result = { value: current.key, done: false };
1385 current = current.next;
1388 return { value: void 0, done: true };
1396 const state = this._state;
1397 let current = this._head;
1399 [Symbol.iterator]() {
1403 if (map._state !== state) {
1404 throw new Error(`LinkedMap got modified during iteration.`);
1407 const result = { value: current.value, done: false };
1408 current = current.next;
1411 return { value: void 0, done: true };
1419 const state = this._state;
1420 let current = this._head;
1422 [Symbol.iterator]() {
1426 if (map._state !== state) {
1427 throw new Error(`LinkedMap got modified during iteration.`);
1430 const result = { value: [current.key, current.value], done: false };
1431 current = current.next;
1434 return { value: void 0, done: true };
1440 [Symbol.iterator]() {
1441 return this.entries();
1444 if (newSize >= this.size) {
1447 if (newSize === 0) {
1451 let current = this._head;
1452 let currentSize = this.size;
1453 while (current && currentSize > newSize) {
1454 this._map.delete(current.key);
1455 current = current.next;
1458 this._head = current;
1459 this._size = currentSize;
1461 current.previous = void 0;
1465 addItemFirst(item) {
1466 if (!this._head && !this._tail) {
1468 } else if (!this._head) {
1469 throw new Error("Invalid list");
1471 item.next = this._head;
1472 this._head.previous = item;
1478 if (!this._head && !this._tail) {
1480 } else if (!this._tail) {
1481 throw new Error("Invalid list");
1483 item.previous = this._tail;
1484 this._tail.next = item;
1490 if (item === this._head && item === this._tail) {
1491 this._head = void 0;
1492 this._tail = void 0;
1493 } else if (item === this._head) {
1495 throw new Error("Invalid list");
1497 item.next.previous = void 0;
1498 this._head = item.next;
1499 } else if (item === this._tail) {
1500 if (!item.previous) {
1501 throw new Error("Invalid list");
1503 item.previous.next = void 0;
1504 this._tail = item.previous;
1506 const next = item.next;
1507 const previous = item.previous;
1508 if (!next || !previous) {
1509 throw new Error("Invalid list");
1511 next.previous = previous;
1512 previous.next = next;
1515 item.previous = void 0;
1518 touch(item, touch) {
1519 if (!this._head || !this._tail) {
1520 throw new Error("Invalid list");
1522 if (touch !== Touch.First && touch !== Touch.Last) {
1525 if (touch === Touch.First) {
1526 if (item === this._head) {
1529 const next = item.next;
1530 const previous = item.previous;
1531 if (item === this._tail) {
1532 previous.next = void 0;
1533 this._tail = previous;
1535 next.previous = previous;
1536 previous.next = next;
1538 item.previous = void 0;
1539 item.next = this._head;
1540 this._head.previous = item;
1543 } else if (touch === Touch.Last) {
1544 if (item === this._tail) {
1547 const next = item.next;
1548 const previous = item.previous;
1549 if (item === this._head) {
1550 next.previous = void 0;
1553 next.previous = previous;
1554 previous.next = next;
1557 item.previous = this._tail;
1558 this._tail.next = item;
1565 this.forEach((value, key) => {
1566 data.push([key, value]);
1572 for (const [key, value] of data) {
1573 this.set(key, value);
1577 exports2.LinkedMap = LinkedMap;
1578 var LRUCache = class extends LinkedMap {
1579 constructor(limit, ratio = 1) {
1581 this._limit = limit;
1582 this._ratio = Math.min(Math.max(0, ratio), 1);
1588 this._limit = limit;
1595 this._ratio = Math.min(Math.max(0, ratio), 1);
1598 get(key, touch = Touch.AsNew) {
1599 return super.get(key, touch);
1602 return super.get(key, Touch.None);
1605 super.set(key, value, Touch.Last);
1610 if (this.size > this._limit) {
1611 this.trimOld(Math.round(this._limit * this._ratio));
1615 exports2.LRUCache = LRUCache;
1619 // node_modules/vscode-jsonrpc/lib/common/connection.js
1620 var require_connection = __commonJS({
1621 "node_modules/vscode-jsonrpc/lib/common/connection.js"(exports2) {
1623 Object.defineProperty(exports2, "__esModule", { value: true });
1624 exports2.createMessageConnection = exports2.ConnectionOptions = exports2.CancellationStrategy = exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.NullLogger = exports2.ProgressType = void 0;
1625 var ral_1 = require_ral();
1626 var Is2 = require_is();
1627 var messages_1 = require_messages();
1628 var linkedMap_1 = require_linkedMap();
1629 var events_1 = require_events();
1630 var cancellation_1 = require_cancellation();
1631 var CancelNotification;
1632 (function(CancelNotification2) {
1633 CancelNotification2.type = new messages_1.NotificationType("$/cancelRequest");
1634 })(CancelNotification || (CancelNotification = {}));
1635 var ProgressNotification;
1636 (function(ProgressNotification2) {
1637 ProgressNotification2.type = new messages_1.NotificationType("$/progress");
1638 })(ProgressNotification || (ProgressNotification = {}));
1639 var ProgressType = class {
1643 exports2.ProgressType = ProgressType;
1644 var StarRequestHandler;
1645 (function(StarRequestHandler2) {
1646 function is(value) {
1647 return Is2.func(value);
1649 StarRequestHandler2.is = is;
1650 })(StarRequestHandler || (StarRequestHandler = {}));
1651 exports2.NullLogger = Object.freeze({
1663 Trace2[Trace2["Off"] = 0] = "Off";
1664 Trace2[Trace2["Messages"] = 1] = "Messages";
1665 Trace2[Trace2["Verbose"] = 2] = "Verbose";
1666 })(Trace = exports2.Trace || (exports2.Trace = {}));
1668 function fromString(value) {
1669 if (!Is2.string(value)) {
1672 value = value.toLowerCase();
1677 return Trace2.Messages;
1679 return Trace2.Verbose;
1684 Trace2.fromString = fromString;
1685 function toString(value) {
1689 case Trace2.Messages:
1691 case Trace2.Verbose:
1697 Trace2.toString = toString;
1698 })(Trace = exports2.Trace || (exports2.Trace = {}));
1700 (function(TraceFormat2) {
1701 TraceFormat2["Text"] = "text";
1702 TraceFormat2["JSON"] = "json";
1703 })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {}));
1704 (function(TraceFormat2) {
1705 function fromString(value) {
1706 value = value.toLowerCase();
1707 if (value === "json") {
1708 return TraceFormat2.JSON;
1710 return TraceFormat2.Text;
1713 TraceFormat2.fromString = fromString;
1714 })(TraceFormat = exports2.TraceFormat || (exports2.TraceFormat = {}));
1715 var SetTraceNotification;
1716 (function(SetTraceNotification2) {
1717 SetTraceNotification2.type = new messages_1.NotificationType("$/setTrace");
1718 })(SetTraceNotification = exports2.SetTraceNotification || (exports2.SetTraceNotification = {}));
1719 var LogTraceNotification;
1720 (function(LogTraceNotification2) {
1721 LogTraceNotification2.type = new messages_1.NotificationType("$/logTrace");
1722 })(LogTraceNotification = exports2.LogTraceNotification || (exports2.LogTraceNotification = {}));
1723 var ConnectionErrors;
1724 (function(ConnectionErrors2) {
1725 ConnectionErrors2[ConnectionErrors2["Closed"] = 1] = "Closed";
1726 ConnectionErrors2[ConnectionErrors2["Disposed"] = 2] = "Disposed";
1727 ConnectionErrors2[ConnectionErrors2["AlreadyListening"] = 3] = "AlreadyListening";
1728 })(ConnectionErrors = exports2.ConnectionErrors || (exports2.ConnectionErrors = {}));
1729 var ConnectionError = class extends Error {
1730 constructor(code, message) {
1733 Object.setPrototypeOf(this, ConnectionError.prototype);
1736 exports2.ConnectionError = ConnectionError;
1737 var ConnectionStrategy;
1738 (function(ConnectionStrategy2) {
1739 function is(value) {
1740 const candidate = value;
1741 return candidate && Is2.func(candidate.cancelUndispatched);
1743 ConnectionStrategy2.is = is;
1744 })(ConnectionStrategy = exports2.ConnectionStrategy || (exports2.ConnectionStrategy = {}));
1745 var CancellationReceiverStrategy;
1746 (function(CancellationReceiverStrategy2) {
1747 CancellationReceiverStrategy2.Message = Object.freeze({
1748 createCancellationTokenSource(_) {
1749 return new cancellation_1.CancellationTokenSource();
1752 function is(value) {
1753 const candidate = value;
1754 return candidate && Is2.func(candidate.createCancellationTokenSource);
1756 CancellationReceiverStrategy2.is = is;
1757 })(CancellationReceiverStrategy = exports2.CancellationReceiverStrategy || (exports2.CancellationReceiverStrategy = {}));
1758 var CancellationSenderStrategy;
1759 (function(CancellationSenderStrategy2) {
1760 CancellationSenderStrategy2.Message = Object.freeze({
1761 sendCancellation(conn, id) {
1762 conn.sendNotification(CancelNotification.type, { id });
1767 function is(value) {
1768 const candidate = value;
1769 return candidate && Is2.func(candidate.sendCancellation) && Is2.func(candidate.cleanup);
1771 CancellationSenderStrategy2.is = is;
1772 })(CancellationSenderStrategy = exports2.CancellationSenderStrategy || (exports2.CancellationSenderStrategy = {}));
1773 var CancellationStrategy;
1774 (function(CancellationStrategy2) {
1775 CancellationStrategy2.Message = Object.freeze({
1776 receiver: CancellationReceiverStrategy.Message,
1777 sender: CancellationSenderStrategy.Message
1779 function is(value) {
1780 const candidate = value;
1781 return candidate && CancellationReceiverStrategy.is(candidate.receiver) && CancellationSenderStrategy.is(candidate.sender);
1783 CancellationStrategy2.is = is;
1784 })(CancellationStrategy = exports2.CancellationStrategy || (exports2.CancellationStrategy = {}));
1785 var ConnectionOptions;
1786 (function(ConnectionOptions2) {
1787 function is(value) {
1788 const candidate = value;
1789 return candidate && (CancellationStrategy.is(candidate.cancellationStrategy) || ConnectionStrategy.is(candidate.connectionStrategy));
1791 ConnectionOptions2.is = is;
1792 })(ConnectionOptions = exports2.ConnectionOptions || (exports2.ConnectionOptions = {}));
1793 var ConnectionState;
1794 (function(ConnectionState2) {
1795 ConnectionState2[ConnectionState2["New"] = 1] = "New";
1796 ConnectionState2[ConnectionState2["Listening"] = 2] = "Listening";
1797 ConnectionState2[ConnectionState2["Closed"] = 3] = "Closed";
1798 ConnectionState2[ConnectionState2["Disposed"] = 4] = "Disposed";
1799 })(ConnectionState || (ConnectionState = {}));
1800 function createMessageConnection(messageReader, messageWriter, _logger, options) {
1801 const logger = _logger !== void 0 ? _logger : exports2.NullLogger;
1802 let sequenceNumber = 0;
1803 let notificationSquenceNumber = 0;
1804 let unknownResponseSquenceNumber = 0;
1805 const version = "2.0";
1806 let starRequestHandler = void 0;
1807 const requestHandlers = Object.create(null);
1808 let starNotificationHandler = void 0;
1809 const notificationHandlers = Object.create(null);
1810 const progressHandlers = new Map();
1812 let messageQueue = new linkedMap_1.LinkedMap();
1813 let responsePromises = Object.create(null);
1814 let requestTokens = Object.create(null);
1815 let trace = Trace.Off;
1816 let traceFormat = TraceFormat.Text;
1818 let state = ConnectionState.New;
1819 const errorEmitter = new events_1.Emitter();
1820 const closeEmitter = new events_1.Emitter();
1821 const unhandledNotificationEmitter = new events_1.Emitter();
1822 const unhandledProgressEmitter = new events_1.Emitter();
1823 const disposeEmitter = new events_1.Emitter();
1824 const cancellationStrategy = options && options.cancellationStrategy ? options.cancellationStrategy : CancellationStrategy.Message;
1825 function createRequestQueueKey(id) {
1827 throw new Error(`Can't send requests with id null since the response can't be correlated.`);
1829 return "req-" + id.toString();
1831 function createResponseQueueKey(id) {
1833 return "res-unknown-" + (++unknownResponseSquenceNumber).toString();
1835 return "res-" + id.toString();
1838 function createNotificationQueueKey() {
1839 return "not-" + (++notificationSquenceNumber).toString();
1841 function addMessageToQueue(queue, message) {
1842 if (messages_1.isRequestMessage(message)) {
1843 queue.set(createRequestQueueKey(message.id), message);
1844 } else if (messages_1.isResponseMessage(message)) {
1845 queue.set(createResponseQueueKey(message.id), message);
1847 queue.set(createNotificationQueueKey(), message);
1850 function cancelUndispatched(_message) {
1853 function isListening() {
1854 return state === ConnectionState.Listening;
1856 function isClosed() {
1857 return state === ConnectionState.Closed;
1859 function isDisposed() {
1860 return state === ConnectionState.Disposed;
1862 function closeHandler() {
1863 if (state === ConnectionState.New || state === ConnectionState.Listening) {
1864 state = ConnectionState.Closed;
1865 closeEmitter.fire(void 0);
1868 function readErrorHandler(error) {
1869 errorEmitter.fire([error, void 0, void 0]);
1871 function writeErrorHandler(data) {
1872 errorEmitter.fire(data);
1874 messageReader.onClose(closeHandler);
1875 messageReader.onError(readErrorHandler);
1876 messageWriter.onClose(closeHandler);
1877 messageWriter.onError(writeErrorHandler);
1878 function triggerMessageQueue() {
1879 if (timer || messageQueue.size === 0) {
1882 timer = ral_1.default().timer.setImmediate(() => {
1884 processMessageQueue();
1887 function processMessageQueue() {
1888 if (messageQueue.size === 0) {
1891 const message = messageQueue.shift();
1893 if (messages_1.isRequestMessage(message)) {
1894 handleRequest(message);
1895 } else if (messages_1.isNotificationMessage(message)) {
1896 handleNotification(message);
1897 } else if (messages_1.isResponseMessage(message)) {
1898 handleResponse(message);
1900 handleInvalidMessage(message);
1903 triggerMessageQueue();
1906 const callback = (message) => {
1908 if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {
1909 const key = createRequestQueueKey(message.params.id);
1910 const toCancel = messageQueue.get(key);
1911 if (messages_1.isRequestMessage(toCancel)) {
1912 const strategy = options === null || options === void 0 ? void 0 : options.connectionStrategy;
1913 const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);
1914 if (response && (response.error !== void 0 || response.result !== void 0)) {
1915 messageQueue.delete(key);
1916 response.id = toCancel.id;
1917 traceSendingResponse(response, message.method, Date.now());
1918 messageWriter.write(response);
1923 addMessageToQueue(messageQueue, message);
1925 triggerMessageQueue();
1928 function handleRequest(requestMessage) {
1932 function reply(resultOrError, method, startTime2) {
1935 id: requestMessage.id
1937 if (resultOrError instanceof messages_1.ResponseError) {
1938 message.error = resultOrError.toJson();
1940 message.result = resultOrError === void 0 ? null : resultOrError;
1942 traceSendingResponse(message, method, startTime2);
1943 messageWriter.write(message);
1945 function replyError(error, method, startTime2) {
1948 id: requestMessage.id,
1949 error: error.toJson()
1951 traceSendingResponse(message, method, startTime2);
1952 messageWriter.write(message);
1954 function replySuccess(result, method, startTime2) {
1955 if (result === void 0) {
1960 id: requestMessage.id,
1963 traceSendingResponse(message, method, startTime2);
1964 messageWriter.write(message);
1966 traceReceivedRequest(requestMessage);
1967 const element = requestHandlers[requestMessage.method];
1971 type = element.type;
1972 requestHandler = element.handler;
1974 const startTime = Date.now();
1975 if (requestHandler || starRequestHandler) {
1976 const tokenKey = String(requestMessage.id);
1977 const cancellationSource = cancellationStrategy.receiver.createCancellationTokenSource(tokenKey);
1978 requestTokens[tokenKey] = cancellationSource;
1981 if (requestHandler) {
1982 if (requestMessage.params === void 0) {
1983 if (type !== void 0 && type.numberOfParams !== 0) {
1984 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines ${type.numberOfParams} params but recevied none.`), requestMessage.method, startTime);
1987 handlerResult = requestHandler(cancellationSource.token);
1988 } else if (Array.isArray(requestMessage.params)) {
1989 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byName) {
1990 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by name but received parameters by position`), requestMessage.method, startTime);
1993 handlerResult = requestHandler(...requestMessage.params, cancellationSource.token);
1995 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
1996 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InvalidParams, `Request ${requestMessage.method} defines parameters by position but received parameters by name`), requestMessage.method, startTime);
1999 handlerResult = requestHandler(requestMessage.params, cancellationSource.token);
2001 } else if (starRequestHandler) {
2002 handlerResult = starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);
2004 const promise = handlerResult;
2005 if (!handlerResult) {
2006 delete requestTokens[tokenKey];
2007 replySuccess(handlerResult, requestMessage.method, startTime);
2008 } else if (promise.then) {
2009 promise.then((resultOrError) => {
2010 delete requestTokens[tokenKey];
2011 reply(resultOrError, requestMessage.method, startTime);
2013 delete requestTokens[tokenKey];
2014 if (error instanceof messages_1.ResponseError) {
2015 replyError(error, requestMessage.method, startTime);
2016 } else if (error && Is2.string(error.message)) {
2017 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2019 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2023 delete requestTokens[tokenKey];
2024 reply(handlerResult, requestMessage.method, startTime);
2027 delete requestTokens[tokenKey];
2028 if (error instanceof messages_1.ResponseError) {
2029 reply(error, requestMessage.method, startTime);
2030 } else if (error && Is2.string(error.message)) {
2031 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);
2033 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);
2037 replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);
2040 function handleResponse(responseMessage) {
2044 if (responseMessage.id === null) {
2045 if (responseMessage.error) {
2046 logger.error(`Received response message without id: Error is:
2047 ${JSON.stringify(responseMessage.error, void 0, 4)}`);
2049 logger.error(`Received response message without id. No further error information provided.`);
2052 const key = String(responseMessage.id);
2053 const responsePromise = responsePromises[key];
2054 traceReceivedResponse(responseMessage, responsePromise);
2055 if (responsePromise) {
2056 delete responsePromises[key];
2058 if (responseMessage.error) {
2059 const error = responseMessage.error;
2060 responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));
2061 } else if (responseMessage.result !== void 0) {
2062 responsePromise.resolve(responseMessage.result);
2064 throw new Error("Should never happen.");
2067 if (error.message) {
2068 logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);
2070 logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);
2076 function handleNotification(message) {
2081 let notificationHandler;
2082 if (message.method === CancelNotification.type.method) {
2083 notificationHandler = (params) => {
2084 const id = params.id;
2085 const source = requestTokens[String(id)];
2091 const element = notificationHandlers[message.method];
2093 notificationHandler = element.handler;
2094 type = element.type;
2097 if (notificationHandler || starNotificationHandler) {
2099 traceReceivedNotification(message);
2100 if (notificationHandler) {
2101 if (message.params === void 0) {
2102 if (type !== void 0) {
2103 if (type.numberOfParams !== 0 && type.parameterStructures !== messages_1.ParameterStructures.byName) {
2104 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but recevied none.`);
2107 notificationHandler();
2108 } else if (Array.isArray(message.params)) {
2109 if (type !== void 0) {
2110 if (type.parameterStructures === messages_1.ParameterStructures.byName) {
2111 logger.error(`Notification ${message.method} defines parameters by name but received parameters by position`);
2113 if (type.numberOfParams !== message.params.length) {
2114 logger.error(`Notification ${message.method} defines ${type.numberOfParams} params but received ${message.params.length} argumennts`);
2117 notificationHandler(...message.params);
2119 if (type !== void 0 && type.parameterStructures === messages_1.ParameterStructures.byPosition) {
2120 logger.error(`Notification ${message.method} defines parameters by position but received parameters by name`);
2122 notificationHandler(message.params);
2124 } else if (starNotificationHandler) {
2125 starNotificationHandler(message.method, message.params);
2128 if (error.message) {
2129 logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);
2131 logger.error(`Notification handler '${message.method}' failed unexpectedly.`);
2135 unhandledNotificationEmitter.fire(message);
2138 function handleInvalidMessage(message) {
2140 logger.error("Received empty message.");
2143 logger.error(`Received message which is neither a response nor a notification message:
2144 ${JSON.stringify(message, null, 4)}`);
2145 const responseMessage = message;
2146 if (Is2.string(responseMessage.id) || Is2.number(responseMessage.id)) {
2147 const key = String(responseMessage.id);
2148 const responseHandler = responsePromises[key];
2149 if (responseHandler) {
2150 responseHandler.reject(new Error("The received response has neither a result nor an error property."));
2154 function traceSendingRequest(message) {
2155 if (trace === Trace.Off || !tracer) {
2158 if (traceFormat === TraceFormat.Text) {
2160 if (trace === Trace.Verbose && message.params) {
2161 data = `Params: ${JSON.stringify(message.params, null, 4)}
2165 tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);
2167 logLSPMessage("send-request", message);
2170 function traceSendingNotification(message) {
2171 if (trace === Trace.Off || !tracer) {
2174 if (traceFormat === TraceFormat.Text) {
2176 if (trace === Trace.Verbose) {
2177 if (message.params) {
2178 data = `Params: ${JSON.stringify(message.params, null, 4)}
2182 data = "No parameters provided.\n\n";
2185 tracer.log(`Sending notification '${message.method}'.`, data);
2187 logLSPMessage("send-notification", message);
2190 function traceSendingResponse(message, method, startTime) {
2191 if (trace === Trace.Off || !tracer) {
2194 if (traceFormat === TraceFormat.Text) {
2196 if (trace === Trace.Verbose) {
2197 if (message.error && message.error.data) {
2198 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
2202 if (message.result) {
2203 data = `Result: ${JSON.stringify(message.result, null, 4)}
2206 } else if (message.error === void 0) {
2207 data = "No result returned.\n\n";
2211 tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);
2213 logLSPMessage("send-response", message);
2216 function traceReceivedRequest(message) {
2217 if (trace === Trace.Off || !tracer) {
2220 if (traceFormat === TraceFormat.Text) {
2222 if (trace === Trace.Verbose && message.params) {
2223 data = `Params: ${JSON.stringify(message.params, null, 4)}
2227 tracer.log(`Received request '${message.method} - (${message.id})'.`, data);
2229 logLSPMessage("receive-request", message);
2232 function traceReceivedNotification(message) {
2233 if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {
2236 if (traceFormat === TraceFormat.Text) {
2238 if (trace === Trace.Verbose) {
2239 if (message.params) {
2240 data = `Params: ${JSON.stringify(message.params, null, 4)}
2244 data = "No parameters provided.\n\n";
2247 tracer.log(`Received notification '${message.method}'.`, data);
2249 logLSPMessage("receive-notification", message);
2252 function traceReceivedResponse(message, responsePromise) {
2253 if (trace === Trace.Off || !tracer) {
2256 if (traceFormat === TraceFormat.Text) {
2258 if (trace === Trace.Verbose) {
2259 if (message.error && message.error.data) {
2260 data = `Error data: ${JSON.stringify(message.error.data, null, 4)}
2264 if (message.result) {
2265 data = `Result: ${JSON.stringify(message.result, null, 4)}
2268 } else if (message.error === void 0) {
2269 data = "No result returned.\n\n";
2273 if (responsePromise) {
2274 const error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : "";
2275 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);
2277 tracer.log(`Received response ${message.id} without active response promise.`, data);
2280 logLSPMessage("receive-response", message);
2283 function logLSPMessage(type, message) {
2284 if (!tracer || trace === Trace.Off) {
2287 const lspMessage = {
2291 timestamp: Date.now()
2293 tracer.log(lspMessage);
2295 function throwIfClosedOrDisposed() {
2297 throw new ConnectionError(ConnectionErrors.Closed, "Connection is closed.");
2300 throw new ConnectionError(ConnectionErrors.Disposed, "Connection is disposed.");
2303 function throwIfListening() {
2304 if (isListening()) {
2305 throw new ConnectionError(ConnectionErrors.AlreadyListening, "Connection is already listening");
2308 function throwIfNotListening() {
2309 if (!isListening()) {
2310 throw new Error("Call listen() first.");
2313 function undefinedToNull(param) {
2314 if (param === void 0) {
2320 function nullToUndefined(param) {
2321 if (param === null) {
2327 function isNamedParam(param) {
2328 return param !== void 0 && param !== null && !Array.isArray(param) && typeof param === "object";
2330 function computeSingleParam(parameterStructures, param) {
2331 switch (parameterStructures) {
2332 case messages_1.ParameterStructures.auto:
2333 if (isNamedParam(param)) {
2334 return nullToUndefined(param);
2336 return [undefinedToNull(param)];
2339 case messages_1.ParameterStructures.byName:
2340 if (!isNamedParam(param)) {
2341 throw new Error(`Recevied parameters by name but param is not an object literal.`);
2343 return nullToUndefined(param);
2344 case messages_1.ParameterStructures.byPosition:
2345 return [undefinedToNull(param)];
2347 throw new Error(`Unknown parameter structure ${parameterStructures.toString()}`);
2350 function computeMessageParams(type, params) {
2352 const numberOfParams = type.numberOfParams;
2353 switch (numberOfParams) {
2358 result = computeSingleParam(type.parameterStructures, params[0]);
2362 for (let i = 0; i < params.length && i < numberOfParams; i++) {
2363 result.push(undefinedToNull(params[i]));
2365 if (params.length < numberOfParams) {
2366 for (let i = params.length; i < numberOfParams; i++) {
2374 const connection = {
2375 sendNotification: (type, ...args) => {
2376 throwIfClosedOrDisposed();
2379 if (Is2.string(type)) {
2381 const first = args[0];
2383 let parameterStructures = messages_1.ParameterStructures.auto;
2384 if (messages_1.ParameterStructures.is(first)) {
2386 parameterStructures = first;
2388 let paramEnd = args.length;
2389 const numberOfParams = paramEnd - paramStart;
2390 switch (numberOfParams) {
2392 messageParams = void 0;
2395 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2398 if (parameterStructures === messages_1.ParameterStructures.byName) {
2399 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' notification parameter structure.`);
2401 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value));
2405 const params = args;
2406 method = type.method;
2407 messageParams = computeMessageParams(type, params);
2409 const notificationMessage = {
2412 params: messageParams
2414 traceSendingNotification(notificationMessage);
2415 messageWriter.write(notificationMessage);
2417 onNotification: (type, handler) => {
2418 throwIfClosedOrDisposed();
2420 if (Is2.func(type)) {
2421 starNotificationHandler = type;
2422 } else if (handler) {
2423 if (Is2.string(type)) {
2425 notificationHandlers[type] = { type: void 0, handler };
2427 method = type.method;
2428 notificationHandlers[type.method] = { type, handler };
2433 if (method !== void 0) {
2434 delete notificationHandlers[method];
2436 starNotificationHandler = void 0;
2441 onProgress: (_type, token, handler) => {
2442 if (progressHandlers.has(token)) {
2443 throw new Error(`Progress handler for token ${token} already registered`);
2445 progressHandlers.set(token, handler);
2448 progressHandlers.delete(token);
2452 sendProgress: (_type, token, value) => {
2453 connection.sendNotification(ProgressNotification.type, { token, value });
2455 onUnhandledProgress: unhandledProgressEmitter.event,
2456 sendRequest: (type, ...args) => {
2457 throwIfClosedOrDisposed();
2458 throwIfNotListening();
2462 if (Is2.string(type)) {
2464 const first = args[0];
2465 const last = args[args.length - 1];
2467 let parameterStructures = messages_1.ParameterStructures.auto;
2468 if (messages_1.ParameterStructures.is(first)) {
2470 parameterStructures = first;
2472 let paramEnd = args.length;
2473 if (cancellation_1.CancellationToken.is(last)) {
2474 paramEnd = paramEnd - 1;
2477 const numberOfParams = paramEnd - paramStart;
2478 switch (numberOfParams) {
2480 messageParams = void 0;
2483 messageParams = computeSingleParam(parameterStructures, args[paramStart]);
2486 if (parameterStructures === messages_1.ParameterStructures.byName) {
2487 throw new Error(`Recevied ${numberOfParams} parameters for 'by Name' request parameter structure.`);
2489 messageParams = args.slice(paramStart, paramEnd).map((value) => undefinedToNull(value));
2493 const params = args;
2494 method = type.method;
2495 messageParams = computeMessageParams(type, params);
2496 const numberOfParams = type.numberOfParams;
2497 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : void 0;
2499 const id = sequenceNumber++;
2502 disposable = token.onCancellationRequested(() => {
2503 cancellationStrategy.sender.sendCancellation(connection, id);
2506 const result = new Promise((resolve, reject) => {
2507 const requestMessage = {
2511 params: messageParams
2513 const resolveWithCleanup = (r) => {
2515 cancellationStrategy.sender.cleanup(id);
2516 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2518 const rejectWithCleanup = (r) => {
2520 cancellationStrategy.sender.cleanup(id);
2521 disposable === null || disposable === void 0 ? void 0 : disposable.dispose();
2523 let responsePromise = { method, timerStart: Date.now(), resolve: resolveWithCleanup, reject: rejectWithCleanup };
2524 traceSendingRequest(requestMessage);
2526 messageWriter.write(requestMessage);
2528 responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : "Unknown reason"));
2529 responsePromise = null;
2531 if (responsePromise) {
2532 responsePromises[String(id)] = responsePromise;
2537 onRequest: (type, handler) => {
2538 throwIfClosedOrDisposed();
2540 if (StarRequestHandler.is(type)) {
2542 starRequestHandler = type;
2543 } else if (Is2.string(type)) {
2545 if (handler !== void 0) {
2547 requestHandlers[type] = { handler, type: void 0 };
2550 if (handler !== void 0) {
2551 method = type.method;
2552 requestHandlers[type.method] = { type, handler };
2557 if (method === null) {
2560 if (method !== void 0) {
2561 delete requestHandlers[method];
2563 starRequestHandler = void 0;
2568 trace: (_value, _tracer, sendNotificationOrTraceOptions) => {
2569 let _sendNotification = false;
2570 let _traceFormat = TraceFormat.Text;
2571 if (sendNotificationOrTraceOptions !== void 0) {
2572 if (Is2.boolean(sendNotificationOrTraceOptions)) {
2573 _sendNotification = sendNotificationOrTraceOptions;
2575 _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;
2576 _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;
2580 traceFormat = _traceFormat;
2581 if (trace === Trace.Off) {
2586 if (_sendNotification && !isClosed() && !isDisposed()) {
2587 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });
2590 onError: errorEmitter.event,
2591 onClose: closeEmitter.event,
2592 onUnhandledNotification: unhandledNotificationEmitter.event,
2593 onDispose: disposeEmitter.event,
2595 messageWriter.end();
2601 state = ConnectionState.Disposed;
2602 disposeEmitter.fire(void 0);
2603 const error = new Error("Connection got disposed.");
2604 Object.keys(responsePromises).forEach((key) => {
2605 responsePromises[key].reject(error);
2607 responsePromises = Object.create(null);
2608 requestTokens = Object.create(null);
2609 messageQueue = new linkedMap_1.LinkedMap();
2610 if (Is2.func(messageWriter.dispose)) {
2611 messageWriter.dispose();
2613 if (Is2.func(messageReader.dispose)) {
2614 messageReader.dispose();
2618 throwIfClosedOrDisposed();
2620 state = ConnectionState.Listening;
2621 messageReader.listen(callback);
2624 ral_1.default().console.log("inspect");
2627 connection.onNotification(LogTraceNotification.type, (params) => {
2628 if (trace === Trace.Off || !tracer) {
2631 tracer.log(params.message, trace === Trace.Verbose ? params.verbose : void 0);
2633 connection.onNotification(ProgressNotification.type, (params) => {
2634 const handler = progressHandlers.get(params.token);
2636 handler(params.value);
2638 unhandledProgressEmitter.fire(params);
2643 exports2.createMessageConnection = createMessageConnection;
2647 // node_modules/vscode-jsonrpc/lib/common/api.js
2648 var require_api = __commonJS({
2649 "node_modules/vscode-jsonrpc/lib/common/api.js"(exports2) {
2651 Object.defineProperty(exports2, "__esModule", { value: true });
2652 exports2.CancellationSenderStrategy = exports2.CancellationReceiverStrategy = exports2.ConnectionError = exports2.ConnectionErrors = exports2.LogTraceNotification = exports2.SetTraceNotification = exports2.TraceFormat = exports2.Trace = exports2.ProgressType = exports2.createMessageConnection = exports2.NullLogger = exports2.ConnectionOptions = exports2.ConnectionStrategy = exports2.WriteableStreamMessageWriter = exports2.AbstractMessageWriter = exports2.MessageWriter = exports2.ReadableStreamMessageReader = exports2.AbstractMessageReader = exports2.MessageReader = exports2.CancellationToken = exports2.CancellationTokenSource = exports2.Emitter = exports2.Event = exports2.Disposable = exports2.ParameterStructures = exports2.NotificationType9 = exports2.NotificationType8 = exports2.NotificationType7 = exports2.NotificationType6 = exports2.NotificationType5 = exports2.NotificationType4 = exports2.NotificationType3 = exports2.NotificationType2 = exports2.NotificationType1 = exports2.NotificationType0 = exports2.NotificationType = exports2.ErrorCodes = exports2.ResponseError = exports2.RequestType9 = exports2.RequestType8 = exports2.RequestType7 = exports2.RequestType6 = exports2.RequestType5 = exports2.RequestType4 = exports2.RequestType3 = exports2.RequestType2 = exports2.RequestType1 = exports2.RequestType0 = exports2.RequestType = exports2.RAL = void 0;
2653 exports2.CancellationStrategy = void 0;
2654 var messages_1 = require_messages();
2655 Object.defineProperty(exports2, "RequestType", { enumerable: true, get: function() {
2656 return messages_1.RequestType;
2658 Object.defineProperty(exports2, "RequestType0", { enumerable: true, get: function() {
2659 return messages_1.RequestType0;
2661 Object.defineProperty(exports2, "RequestType1", { enumerable: true, get: function() {
2662 return messages_1.RequestType1;
2664 Object.defineProperty(exports2, "RequestType2", { enumerable: true, get: function() {
2665 return messages_1.RequestType2;
2667 Object.defineProperty(exports2, "RequestType3", { enumerable: true, get: function() {
2668 return messages_1.RequestType3;
2670 Object.defineProperty(exports2, "RequestType4", { enumerable: true, get: function() {
2671 return messages_1.RequestType4;
2673 Object.defineProperty(exports2, "RequestType5", { enumerable: true, get: function() {
2674 return messages_1.RequestType5;
2676 Object.defineProperty(exports2, "RequestType6", { enumerable: true, get: function() {
2677 return messages_1.RequestType6;
2679 Object.defineProperty(exports2, "RequestType7", { enumerable: true, get: function() {
2680 return messages_1.RequestType7;
2682 Object.defineProperty(exports2, "RequestType8", { enumerable: true, get: function() {
2683 return messages_1.RequestType8;
2685 Object.defineProperty(exports2, "RequestType9", { enumerable: true, get: function() {
2686 return messages_1.RequestType9;
2688 Object.defineProperty(exports2, "ResponseError", { enumerable: true, get: function() {
2689 return messages_1.ResponseError;
2691 Object.defineProperty(exports2, "ErrorCodes", { enumerable: true, get: function() {
2692 return messages_1.ErrorCodes;
2694 Object.defineProperty(exports2, "NotificationType", { enumerable: true, get: function() {
2695 return messages_1.NotificationType;
2697 Object.defineProperty(exports2, "NotificationType0", { enumerable: true, get: function() {
2698 return messages_1.NotificationType0;
2700 Object.defineProperty(exports2, "NotificationType1", { enumerable: true, get: function() {
2701 return messages_1.NotificationType1;
2703 Object.defineProperty(exports2, "NotificationType2", { enumerable: true, get: function() {
2704 return messages_1.NotificationType2;
2706 Object.defineProperty(exports2, "NotificationType3", { enumerable: true, get: function() {
2707 return messages_1.NotificationType3;
2709 Object.defineProperty(exports2, "NotificationType4", { enumerable: true, get: function() {
2710 return messages_1.NotificationType4;
2712 Object.defineProperty(exports2, "NotificationType5", { enumerable: true, get: function() {
2713 return messages_1.NotificationType5;
2715 Object.defineProperty(exports2, "NotificationType6", { enumerable: true, get: function() {
2716 return messages_1.NotificationType6;
2718 Object.defineProperty(exports2, "NotificationType7", { enumerable: true, get: function() {
2719 return messages_1.NotificationType7;
2721 Object.defineProperty(exports2, "NotificationType8", { enumerable: true, get: function() {
2722 return messages_1.NotificationType8;
2724 Object.defineProperty(exports2, "NotificationType9", { enumerable: true, get: function() {
2725 return messages_1.NotificationType9;
2727 Object.defineProperty(exports2, "ParameterStructures", { enumerable: true, get: function() {
2728 return messages_1.ParameterStructures;
2730 var disposable_1 = require_disposable();
2731 Object.defineProperty(exports2, "Disposable", { enumerable: true, get: function() {
2732 return disposable_1.Disposable;
2734 var events_1 = require_events();
2735 Object.defineProperty(exports2, "Event", { enumerable: true, get: function() {
2736 return events_1.Event;
2738 Object.defineProperty(exports2, "Emitter", { enumerable: true, get: function() {
2739 return events_1.Emitter;
2741 var cancellation_1 = require_cancellation();
2742 Object.defineProperty(exports2, "CancellationTokenSource", { enumerable: true, get: function() {
2743 return cancellation_1.CancellationTokenSource;
2745 Object.defineProperty(exports2, "CancellationToken", { enumerable: true, get: function() {
2746 return cancellation_1.CancellationToken;
2748 var messageReader_1 = require_messageReader();
2749 Object.defineProperty(exports2, "MessageReader", { enumerable: true, get: function() {
2750 return messageReader_1.MessageReader;
2752 Object.defineProperty(exports2, "AbstractMessageReader", { enumerable: true, get: function() {
2753 return messageReader_1.AbstractMessageReader;
2755 Object.defineProperty(exports2, "ReadableStreamMessageReader", { enumerable: true, get: function() {
2756 return messageReader_1.ReadableStreamMessageReader;
2758 var messageWriter_1 = require_messageWriter();
2759 Object.defineProperty(exports2, "MessageWriter", { enumerable: true, get: function() {
2760 return messageWriter_1.MessageWriter;
2762 Object.defineProperty(exports2, "AbstractMessageWriter", { enumerable: true, get: function() {
2763 return messageWriter_1.AbstractMessageWriter;
2765 Object.defineProperty(exports2, "WriteableStreamMessageWriter", { enumerable: true, get: function() {
2766 return messageWriter_1.WriteableStreamMessageWriter;
2768 var connection_1 = require_connection();
2769 Object.defineProperty(exports2, "ConnectionStrategy", { enumerable: true, get: function() {
2770 return connection_1.ConnectionStrategy;
2772 Object.defineProperty(exports2, "ConnectionOptions", { enumerable: true, get: function() {
2773 return connection_1.ConnectionOptions;
2775 Object.defineProperty(exports2, "NullLogger", { enumerable: true, get: function() {
2776 return connection_1.NullLogger;
2778 Object.defineProperty(exports2, "createMessageConnection", { enumerable: true, get: function() {
2779 return connection_1.createMessageConnection;
2781 Object.defineProperty(exports2, "ProgressType", { enumerable: true, get: function() {
2782 return connection_1.ProgressType;
2784 Object.defineProperty(exports2, "Trace", { enumerable: true, get: function() {
2785 return connection_1.Trace;
2787 Object.defineProperty(exports2, "TraceFormat", { enumerable: true, get: function() {
2788 return connection_1.TraceFormat;
2790 Object.defineProperty(exports2, "SetTraceNotification", { enumerable: true, get: function() {
2791 return connection_1.SetTraceNotification;
2793 Object.defineProperty(exports2, "LogTraceNotification", { enumerable: true, get: function() {
2794 return connection_1.LogTraceNotification;
2796 Object.defineProperty(exports2, "ConnectionErrors", { enumerable: true, get: function() {
2797 return connection_1.ConnectionErrors;
2799 Object.defineProperty(exports2, "ConnectionError", { enumerable: true, get: function() {
2800 return connection_1.ConnectionError;
2802 Object.defineProperty(exports2, "CancellationReceiverStrategy", { enumerable: true, get: function() {
2803 return connection_1.CancellationReceiverStrategy;
2805 Object.defineProperty(exports2, "CancellationSenderStrategy", { enumerable: true, get: function() {
2806 return connection_1.CancellationSenderStrategy;
2808 Object.defineProperty(exports2, "CancellationStrategy", { enumerable: true, get: function() {
2809 return connection_1.CancellationStrategy;
2811 var ral_1 = require_ral();
2812 exports2.RAL = ral_1.default;
2816 // node_modules/vscode-jsonrpc/lib/node/main.js
2817 var require_main = __commonJS({
2818 "node_modules/vscode-jsonrpc/lib/node/main.js"(exports2) {
2820 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
2823 Object.defineProperty(o, k2, { enumerable: true, get: function() {
2826 } : function(o, m, k, k2) {
2831 var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
2833 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
2834 __createBinding(exports3, m, p);
2836 Object.defineProperty(exports2, "__esModule", { value: true });
2837 exports2.createMessageConnection = exports2.createServerSocketTransport = exports2.createClientSocketTransport = exports2.createServerPipeTransport = exports2.createClientPipeTransport = exports2.generateRandomPipeName = exports2.StreamMessageWriter = exports2.StreamMessageReader = exports2.SocketMessageWriter = exports2.SocketMessageReader = exports2.IPCMessageWriter = exports2.IPCMessageReader = void 0;
2838 var ril_1 = require_ril();
2839 ril_1.default.install();
2840 var api_1 = require_api();
2841 var path2 = require("path");
2842 var os = require("os");
2843 var crypto_1 = require("crypto");
2844 var net_1 = require("net");
2845 __exportStar(require_api(), exports2);
2846 var IPCMessageReader = class extends api_1.AbstractMessageReader {
2847 constructor(process2) {
2849 this.process = process2;
2850 let eventEmitter = this.process;
2851 eventEmitter.on("error", (error) => this.fireError(error));
2852 eventEmitter.on("close", () => this.fireClose());
2855 this.process.on("message", callback);
2856 return api_1.Disposable.create(() => this.process.off("message", callback));
2859 exports2.IPCMessageReader = IPCMessageReader;
2860 var IPCMessageWriter = class extends api_1.AbstractMessageWriter {
2861 constructor(process2) {
2863 this.process = process2;
2864 this.errorCount = 0;
2865 let eventEmitter = this.process;
2866 eventEmitter.on("error", (error) => this.fireError(error));
2867 eventEmitter.on("close", () => this.fireClose);
2871 if (typeof this.process.send === "function") {
2872 this.process.send(msg, void 0, void 0, (error) => {
2875 this.handleError(error, msg);
2877 this.errorCount = 0;
2881 return Promise.resolve();
2883 this.handleError(error, msg);
2884 return Promise.reject(error);
2887 handleError(error, msg) {
2889 this.fireError(error, msg, this.errorCount);
2894 exports2.IPCMessageWriter = IPCMessageWriter;
2895 var SocketMessageReader = class extends api_1.ReadableStreamMessageReader {
2896 constructor(socket, encoding = "utf-8") {
2897 super(ril_1.default().stream.asReadableStream(socket), encoding);
2900 exports2.SocketMessageReader = SocketMessageReader;
2901 var SocketMessageWriter = class extends api_1.WriteableStreamMessageWriter {
2902 constructor(socket, options) {
2903 super(ril_1.default().stream.asWritableStream(socket), options);
2904 this.socket = socket;
2908 this.socket.destroy();
2911 exports2.SocketMessageWriter = SocketMessageWriter;
2912 var StreamMessageReader = class extends api_1.ReadableStreamMessageReader {
2913 constructor(readble, encoding) {
2914 super(ril_1.default().stream.asReadableStream(readble), encoding);
2917 exports2.StreamMessageReader = StreamMessageReader;
2918 var StreamMessageWriter = class extends api_1.WriteableStreamMessageWriter {
2919 constructor(writable, options) {
2920 super(ril_1.default().stream.asWritableStream(writable), options);
2923 exports2.StreamMessageWriter = StreamMessageWriter;
2924 var XDG_RUNTIME_DIR = process.env["XDG_RUNTIME_DIR"];
2925 var safeIpcPathLengths = new Map([
2929 function generateRandomPipeName() {
2930 const randomSuffix = crypto_1.randomBytes(21).toString("hex");
2931 if (process.platform === "win32") {
2932 return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;
2935 if (XDG_RUNTIME_DIR) {
2936 result = path2.join(XDG_RUNTIME_DIR, `vscode-ipc-${randomSuffix}.sock`);
2938 result = path2.join(os.tmpdir(), `vscode-${randomSuffix}.sock`);
2940 const limit = safeIpcPathLengths.get(process.platform);
2941 if (limit !== void 0 && result.length >= limit) {
2942 ril_1.default().console.warn(`WARNING: IPC handle "${result}" is longer than ${limit} characters.`);
2946 exports2.generateRandomPipeName = generateRandomPipeName;
2947 function createClientPipeTransport(pipeName, encoding = "utf-8") {
2949 const connected = new Promise((resolve, _reject) => {
2950 connectResolve = resolve;
2952 return new Promise((resolve, reject) => {
2953 let server = net_1.createServer((socket) => {
2956 new SocketMessageReader(socket, encoding),
2957 new SocketMessageWriter(socket, encoding)
2960 server.on("error", reject);
2961 server.listen(pipeName, () => {
2962 server.removeListener("error", reject);
2964 onConnected: () => {
2971 exports2.createClientPipeTransport = createClientPipeTransport;
2972 function createServerPipeTransport(pipeName, encoding = "utf-8") {
2973 const socket = net_1.createConnection(pipeName);
2975 new SocketMessageReader(socket, encoding),
2976 new SocketMessageWriter(socket, encoding)
2979 exports2.createServerPipeTransport = createServerPipeTransport;
2980 function createClientSocketTransport(port, encoding = "utf-8") {
2982 const connected = new Promise((resolve, _reject) => {
2983 connectResolve = resolve;
2985 return new Promise((resolve, reject) => {
2986 const server = net_1.createServer((socket) => {
2989 new SocketMessageReader(socket, encoding),
2990 new SocketMessageWriter(socket, encoding)
2993 server.on("error", reject);
2994 server.listen(port, "127.0.0.1", () => {
2995 server.removeListener("error", reject);
2997 onConnected: () => {
3004 exports2.createClientSocketTransport = createClientSocketTransport;
3005 function createServerSocketTransport(port, encoding = "utf-8") {
3006 const socket = net_1.createConnection(port, "127.0.0.1");
3008 new SocketMessageReader(socket, encoding),
3009 new SocketMessageWriter(socket, encoding)
3012 exports2.createServerSocketTransport = createServerSocketTransport;
3013 function isReadableStream(value) {
3014 const candidate = value;
3015 return candidate.read !== void 0 && candidate.addListener !== void 0;
3017 function isWritableStream(value) {
3018 const candidate = value;
3019 return candidate.write !== void 0 && candidate.addListener !== void 0;
3021 function createMessageConnection(input, output, logger, options) {
3023 logger = api_1.NullLogger;
3025 const reader = isReadableStream(input) ? new StreamMessageReader(input) : input;
3026 const writer = isWritableStream(output) ? new StreamMessageWriter(output) : output;
3027 if (api_1.ConnectionStrategy.is(options)) {
3028 options = { connectionStrategy: options };
3030 return api_1.createMessageConnection(reader, writer, logger, options);
3032 exports2.createMessageConnection = createMessageConnection;
3036 // node_modules/vscode-jsonrpc/node.js
3037 var require_node = __commonJS({
3038 "node_modules/vscode-jsonrpc/node.js"(exports2, module2) {
3040 module2.exports = require_main();
3044 // node_modules/vscode-languageserver-types/lib/esm/main.js
3045 var main_exports = {};
3046 __export(main_exports, {
3047 AnnotatedTextEdit: () => AnnotatedTextEdit,
3048 ChangeAnnotation: () => ChangeAnnotation,
3049 ChangeAnnotationIdentifier: () => ChangeAnnotationIdentifier,
3050 CodeAction: () => CodeAction,
3051 CodeActionContext: () => CodeActionContext,
3052 CodeActionKind: () => CodeActionKind,
3053 CodeDescription: () => CodeDescription,
3054 CodeLens: () => CodeLens,
3056 ColorInformation: () => ColorInformation,
3057 ColorPresentation: () => ColorPresentation,
3058 Command: () => Command,
3059 CompletionItem: () => CompletionItem,
3060 CompletionItemKind: () => CompletionItemKind,
3061 CompletionItemTag: () => CompletionItemTag,
3062 CompletionList: () => CompletionList,
3063 CreateFile: () => CreateFile,
3064 DeleteFile: () => DeleteFile,
3065 Diagnostic: () => Diagnostic,
3066 DiagnosticRelatedInformation: () => DiagnosticRelatedInformation,
3067 DiagnosticSeverity: () => DiagnosticSeverity,
3068 DiagnosticTag: () => DiagnosticTag,
3069 DocumentHighlight: () => DocumentHighlight,
3070 DocumentHighlightKind: () => DocumentHighlightKind,
3071 DocumentLink: () => DocumentLink,
3072 DocumentSymbol: () => DocumentSymbol,
3074 FoldingRange: () => FoldingRange,
3075 FoldingRangeKind: () => FoldingRangeKind,
3076 FormattingOptions: () => FormattingOptions,
3078 InsertReplaceEdit: () => InsertReplaceEdit,
3079 InsertTextFormat: () => InsertTextFormat,
3080 InsertTextMode: () => InsertTextMode,
3081 Location: () => Location,
3082 LocationLink: () => LocationLink,
3083 MarkedString: () => MarkedString,
3084 MarkupContent: () => MarkupContent,
3085 MarkupKind: () => MarkupKind,
3086 OptionalVersionedTextDocumentIdentifier: () => OptionalVersionedTextDocumentIdentifier,
3087 ParameterInformation: () => ParameterInformation,
3088 Position: () => Position,
3090 RenameFile: () => RenameFile,
3091 SelectionRange: () => SelectionRange,
3092 SignatureInformation: () => SignatureInformation,
3093 SymbolInformation: () => SymbolInformation,
3094 SymbolKind: () => SymbolKind,
3095 SymbolTag: () => SymbolTag,
3096 TextDocument: () => TextDocument,
3097 TextDocumentEdit: () => TextDocumentEdit,
3098 TextDocumentIdentifier: () => TextDocumentIdentifier2,
3099 TextDocumentItem: () => TextDocumentItem,
3100 TextEdit: () => TextEdit,
3101 VersionedTextDocumentIdentifier: () => VersionedTextDocumentIdentifier,
3102 WorkspaceChange: () => WorkspaceChange,
3103 WorkspaceEdit: () => WorkspaceEdit,
3104 integer: () => integer,
3105 uinteger: () => uinteger
3107 var integer, uinteger, Position, Range, Location, LocationLink, Color, ColorInformation, ColorPresentation, FoldingRangeKind, FoldingRange, DiagnosticRelatedInformation, DiagnosticSeverity, DiagnosticTag, CodeDescription, Diagnostic, Command, TextEdit, ChangeAnnotation, ChangeAnnotationIdentifier, AnnotatedTextEdit, TextDocumentEdit, CreateFile, RenameFile, DeleteFile, WorkspaceEdit, TextEditChangeImpl, ChangeAnnotations, WorkspaceChange, TextDocumentIdentifier2, VersionedTextDocumentIdentifier, OptionalVersionedTextDocumentIdentifier, TextDocumentItem, MarkupKind, MarkupContent, CompletionItemKind, InsertTextFormat, CompletionItemTag, InsertReplaceEdit, InsertTextMode, CompletionItem, CompletionList, MarkedString, Hover, ParameterInformation, SignatureInformation, DocumentHighlightKind, DocumentHighlight, SymbolKind, SymbolTag, SymbolInformation, DocumentSymbol, CodeActionKind, CodeActionContext, CodeAction, CodeLens, FormattingOptions, DocumentLink, SelectionRange, EOL, TextDocument, FullTextDocument, Is;
3108 var init_main = __esm({
3109 "node_modules/vscode-languageserver-types/lib/esm/main.js"() {
3111 (function(integer2) {
3112 integer2.MIN_VALUE = -2147483648;
3113 integer2.MAX_VALUE = 2147483647;
3114 })(integer || (integer = {}));
3115 (function(uinteger2) {
3116 uinteger2.MIN_VALUE = 0;
3117 uinteger2.MAX_VALUE = 2147483647;
3118 })(uinteger || (uinteger = {}));
3119 (function(Position2) {
3120 function create(line, character) {
3121 if (line === Number.MAX_VALUE) {
3122 line = uinteger.MAX_VALUE;
3124 if (character === Number.MAX_VALUE) {
3125 character = uinteger.MAX_VALUE;
3127 return { line, character };
3129 Position2.create = create;
3130 function is(value) {
3131 var candidate = value;
3132 return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);
3135 })(Position || (Position = {}));
3137 function create(one, two, three, four) {
3138 if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {
3139 return { start: Position.create(one, two), end: Position.create(three, four) };
3140 } else if (Position.is(one) && Position.is(two)) {
3141 return { start: one, end: two };
3143 throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");
3146 Range5.create = create;
3147 function is(value) {
3148 var candidate = value;
3149 return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);
3152 })(Range || (Range = {}));
3153 (function(Location2) {
3154 function create(uri, range) {
3155 return { uri, range };
3157 Location2.create = create;
3158 function is(value) {
3159 var candidate = value;
3160 return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));
3163 })(Location || (Location = {}));
3164 (function(LocationLink2) {
3165 function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {
3166 return { targetUri, targetRange, targetSelectionRange, originSelectionRange };
3168 LocationLink2.create = create;
3169 function is(value) {
3170 var candidate = value;
3171 return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri) && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange)) && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));
3173 LocationLink2.is = is;
3174 })(LocationLink || (LocationLink = {}));
3176 function create(red, green, blue, alpha) {
3184 Color2.create = create;
3185 function is(value) {
3186 var candidate = value;
3187 return Is.numberRange(candidate.red, 0, 1) && Is.numberRange(candidate.green, 0, 1) && Is.numberRange(candidate.blue, 0, 1) && Is.numberRange(candidate.alpha, 0, 1);
3190 })(Color || (Color = {}));
3191 (function(ColorInformation2) {
3192 function create(range, color) {
3198 ColorInformation2.create = create;
3199 function is(value) {
3200 var candidate = value;
3201 return Range.is(candidate.range) && Color.is(candidate.color);
3203 ColorInformation2.is = is;
3204 })(ColorInformation || (ColorInformation = {}));
3205 (function(ColorPresentation2) {
3206 function create(label, textEdit, additionalTextEdits) {
3213 ColorPresentation2.create = create;
3214 function is(value) {
3215 var candidate = value;
3216 return Is.string(candidate.label) && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate)) && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));
3218 ColorPresentation2.is = is;
3219 })(ColorPresentation || (ColorPresentation = {}));
3220 (function(FoldingRangeKind2) {
3221 FoldingRangeKind2["Comment"] = "comment";
3222 FoldingRangeKind2["Imports"] = "imports";
3223 FoldingRangeKind2["Region"] = "region";
3224 })(FoldingRangeKind || (FoldingRangeKind = {}));
3225 (function(FoldingRange2) {
3226 function create(startLine, endLine, startCharacter, endCharacter, kind) {
3231 if (Is.defined(startCharacter)) {
3232 result.startCharacter = startCharacter;
3234 if (Is.defined(endCharacter)) {
3235 result.endCharacter = endCharacter;
3237 if (Is.defined(kind)) {
3242 FoldingRange2.create = create;
3243 function is(value) {
3244 var candidate = value;
3245 return Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine) && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter)) && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter)) && (Is.undefined(candidate.kind) || Is.string(candidate.kind));
3247 FoldingRange2.is = is;
3248 })(FoldingRange || (FoldingRange = {}));
3249 (function(DiagnosticRelatedInformation2) {
3250 function create(location, message) {
3256 DiagnosticRelatedInformation2.create = create;
3257 function is(value) {
3258 var candidate = value;
3259 return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);
3261 DiagnosticRelatedInformation2.is = is;
3262 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));
3263 (function(DiagnosticSeverity2) {
3264 DiagnosticSeverity2.Error = 1;
3265 DiagnosticSeverity2.Warning = 2;
3266 DiagnosticSeverity2.Information = 3;
3267 DiagnosticSeverity2.Hint = 4;
3268 })(DiagnosticSeverity || (DiagnosticSeverity = {}));
3269 (function(DiagnosticTag2) {
3270 DiagnosticTag2.Unnecessary = 1;
3271 DiagnosticTag2.Deprecated = 2;
3272 })(DiagnosticTag || (DiagnosticTag = {}));
3273 (function(CodeDescription2) {
3274 function is(value) {
3275 var candidate = value;
3276 return candidate !== void 0 && candidate !== null && Is.string(candidate.href);
3278 CodeDescription2.is = is;
3279 })(CodeDescription || (CodeDescription = {}));
3280 (function(Diagnostic2) {
3281 function create(range, message, severity, code, source, relatedInformation) {
3282 var result = { range, message };
3283 if (Is.defined(severity)) {
3284 result.severity = severity;
3286 if (Is.defined(code)) {
3289 if (Is.defined(source)) {
3290 result.source = source;
3292 if (Is.defined(relatedInformation)) {
3293 result.relatedInformation = relatedInformation;
3297 Diagnostic2.create = create;
3298 function is(value) {
3300 var candidate = value;
3301 return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
3303 Diagnostic2.is = is;
3304 })(Diagnostic || (Diagnostic = {}));
3305 (function(Command2) {
3306 function create(title, command) {
3308 for (var _i = 2; _i < arguments.length; _i++) {
3309 args[_i - 2] = arguments[_i];
3311 var result = { title, command };
3312 if (Is.defined(args) && args.length > 0) {
3313 result.arguments = args;
3317 Command2.create = create;
3318 function is(value) {
3319 var candidate = value;
3320 return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);
3323 })(Command || (Command = {}));
3324 (function(TextEdit2) {
3325 function replace(range, newText) {
3326 return { range, newText };
3328 TextEdit2.replace = replace;
3329 function insert(position, newText) {
3330 return { range: { start: position, end: position }, newText };
3332 TextEdit2.insert = insert;
3333 function del(range) {
3334 return { range, newText: "" };
3336 TextEdit2.del = del;
3337 function is(value) {
3338 var candidate = value;
3339 return Is.objectLiteral(candidate) && Is.string(candidate.newText) && Range.is(candidate.range);
3342 })(TextEdit || (TextEdit = {}));
3343 (function(ChangeAnnotation2) {
3344 function create(label, needsConfirmation, description) {
3345 var result = { label };
3346 if (needsConfirmation !== void 0) {
3347 result.needsConfirmation = needsConfirmation;
3349 if (description !== void 0) {
3350 result.description = description;
3354 ChangeAnnotation2.create = create;
3355 function is(value) {
3356 var candidate = value;
3357 return candidate !== void 0 && Is.objectLiteral(candidate) && Is.string(candidate.label) && (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === void 0) && (Is.string(candidate.description) || candidate.description === void 0);
3359 ChangeAnnotation2.is = is;
3360 })(ChangeAnnotation || (ChangeAnnotation = {}));
3361 (function(ChangeAnnotationIdentifier2) {
3362 function is(value) {
3363 var candidate = value;
3364 return typeof candidate === "string";
3366 ChangeAnnotationIdentifier2.is = is;
3367 })(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));
3368 (function(AnnotatedTextEdit2) {
3369 function replace(range, newText, annotation) {
3370 return { range, newText, annotationId: annotation };
3372 AnnotatedTextEdit2.replace = replace;
3373 function insert(position, newText, annotation) {
3374 return { range: { start: position, end: position }, newText, annotationId: annotation };
3376 AnnotatedTextEdit2.insert = insert;
3377 function del(range, annotation) {
3378 return { range, newText: "", annotationId: annotation };
3380 AnnotatedTextEdit2.del = del;
3381 function is(value) {
3382 var candidate = value;
3383 return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));
3385 AnnotatedTextEdit2.is = is;
3386 })(AnnotatedTextEdit || (AnnotatedTextEdit = {}));
3387 (function(TextDocumentEdit2) {
3388 function create(textDocument, edits) {
3389 return { textDocument, edits };
3391 TextDocumentEdit2.create = create;
3392 function is(value) {
3393 var candidate = value;
3394 return Is.defined(candidate) && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument) && Array.isArray(candidate.edits);
3396 TextDocumentEdit2.is = is;
3397 })(TextDocumentEdit || (TextDocumentEdit = {}));
3398 (function(CreateFile2) {
3399 function create(uri, options, annotation) {
3404 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3405 result.options = options;
3407 if (annotation !== void 0) {
3408 result.annotationId = annotation;
3412 CreateFile2.create = create;
3413 function is(value) {
3414 var candidate = value;
3415 return candidate && candidate.kind === "create" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3417 CreateFile2.is = is;
3418 })(CreateFile || (CreateFile = {}));
3419 (function(RenameFile2) {
3420 function create(oldUri, newUri, options, annotation) {
3426 if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {
3427 result.options = options;
3429 if (annotation !== void 0) {
3430 result.annotationId = annotation;
3434 RenameFile2.create = create;
3435 function is(value) {
3436 var candidate = value;
3437 return candidate && candidate.kind === "rename" && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === void 0 || (candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3439 RenameFile2.is = is;
3440 })(RenameFile || (RenameFile = {}));
3441 (function(DeleteFile2) {
3442 function create(uri, options, annotation) {
3447 if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {
3448 result.options = options;
3450 if (annotation !== void 0) {
3451 result.annotationId = annotation;
3455 DeleteFile2.create = create;
3456 function is(value) {
3457 var candidate = value;
3458 return candidate && candidate.kind === "delete" && Is.string(candidate.uri) && (candidate.options === void 0 || (candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))) && (candidate.annotationId === void 0 || ChangeAnnotationIdentifier.is(candidate.annotationId));
3460 DeleteFile2.is = is;
3461 })(DeleteFile || (DeleteFile = {}));
3462 (function(WorkspaceEdit2) {
3463 function is(value) {
3464 var candidate = value;
3465 return candidate && (candidate.changes !== void 0 || candidate.documentChanges !== void 0) && (candidate.documentChanges === void 0 || candidate.documentChanges.every(function(change) {
3466 if (Is.string(change.kind)) {
3467 return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);
3469 return TextDocumentEdit.is(change);
3473 WorkspaceEdit2.is = is;
3474 })(WorkspaceEdit || (WorkspaceEdit = {}));
3475 TextEditChangeImpl = function() {
3476 function TextEditChangeImpl2(edits, changeAnnotations) {
3478 this.changeAnnotations = changeAnnotations;
3480 TextEditChangeImpl2.prototype.insert = function(position, newText, annotation) {
3483 if (annotation === void 0) {
3484 edit = TextEdit.insert(position, newText);
3485 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3487 edit = AnnotatedTextEdit.insert(position, newText, annotation);
3489 this.assertChangeAnnotations(this.changeAnnotations);
3490 id = this.changeAnnotations.manage(annotation);
3491 edit = AnnotatedTextEdit.insert(position, newText, id);
3493 this.edits.push(edit);
3494 if (id !== void 0) {
3498 TextEditChangeImpl2.prototype.replace = function(range, newText, annotation) {
3501 if (annotation === void 0) {
3502 edit = TextEdit.replace(range, newText);
3503 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3505 edit = AnnotatedTextEdit.replace(range, newText, annotation);
3507 this.assertChangeAnnotations(this.changeAnnotations);
3508 id = this.changeAnnotations.manage(annotation);
3509 edit = AnnotatedTextEdit.replace(range, newText, id);
3511 this.edits.push(edit);
3512 if (id !== void 0) {
3516 TextEditChangeImpl2.prototype.delete = function(range, annotation) {
3519 if (annotation === void 0) {
3520 edit = TextEdit.del(range);
3521 } else if (ChangeAnnotationIdentifier.is(annotation)) {
3523 edit = AnnotatedTextEdit.del(range, annotation);
3525 this.assertChangeAnnotations(this.changeAnnotations);
3526 id = this.changeAnnotations.manage(annotation);
3527 edit = AnnotatedTextEdit.del(range, id);
3529 this.edits.push(edit);
3530 if (id !== void 0) {
3534 TextEditChangeImpl2.prototype.add = function(edit) {
3535 this.edits.push(edit);
3537 TextEditChangeImpl2.prototype.all = function() {
3540 TextEditChangeImpl2.prototype.clear = function() {
3541 this.edits.splice(0, this.edits.length);
3543 TextEditChangeImpl2.prototype.assertChangeAnnotations = function(value) {
3544 if (value === void 0) {
3545 throw new Error("Text edit change is not configured to manage change annotations.");
3548 return TextEditChangeImpl2;
3550 ChangeAnnotations = function() {
3551 function ChangeAnnotations2(annotations) {
3552 this._annotations = annotations === void 0 ? Object.create(null) : annotations;
3556 ChangeAnnotations2.prototype.all = function() {
3557 return this._annotations;
3559 Object.defineProperty(ChangeAnnotations2.prototype, "size", {
3566 ChangeAnnotations2.prototype.manage = function(idOrAnnotation, annotation) {
3568 if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {
3569 id = idOrAnnotation;
3572 annotation = idOrAnnotation;
3574 if (this._annotations[id] !== void 0) {
3575 throw new Error("Id " + id + " is already in use.");
3577 if (annotation === void 0) {
3578 throw new Error("No annotation provided for id " + id);
3580 this._annotations[id] = annotation;
3584 ChangeAnnotations2.prototype.nextId = function() {
3586 return this._counter.toString();
3588 return ChangeAnnotations2;
3590 WorkspaceChange = function() {
3591 function WorkspaceChange2(workspaceEdit) {
3593 this._textEditChanges = Object.create(null);
3594 if (workspaceEdit !== void 0) {
3595 this._workspaceEdit = workspaceEdit;
3596 if (workspaceEdit.documentChanges) {
3597 this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);
3598 workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3599 workspaceEdit.documentChanges.forEach(function(change) {
3600 if (TextDocumentEdit.is(change)) {
3601 var textEditChange = new TextEditChangeImpl(change.edits, _this._changeAnnotations);
3602 _this._textEditChanges[change.textDocument.uri] = textEditChange;
3605 } else if (workspaceEdit.changes) {
3606 Object.keys(workspaceEdit.changes).forEach(function(key) {
3607 var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);
3608 _this._textEditChanges[key] = textEditChange;
3612 this._workspaceEdit = {};
3615 Object.defineProperty(WorkspaceChange2.prototype, "edit", {
3617 this.initDocumentChanges();
3618 if (this._changeAnnotations !== void 0) {
3619 if (this._changeAnnotations.size === 0) {
3620 this._workspaceEdit.changeAnnotations = void 0;
3622 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3625 return this._workspaceEdit;
3630 WorkspaceChange2.prototype.getTextEditChange = function(key) {
3631 if (OptionalVersionedTextDocumentIdentifier.is(key)) {
3632 this.initDocumentChanges();
3633 if (this._workspaceEdit.documentChanges === void 0) {
3634 throw new Error("Workspace edit is not configured for document changes.");
3636 var textDocument = { uri: key.uri, version: key.version };
3637 var result = this._textEditChanges[textDocument.uri];
3640 var textDocumentEdit = {
3644 this._workspaceEdit.documentChanges.push(textDocumentEdit);
3645 result = new TextEditChangeImpl(edits, this._changeAnnotations);
3646 this._textEditChanges[textDocument.uri] = result;
3651 if (this._workspaceEdit.changes === void 0) {
3652 throw new Error("Workspace edit is not configured for normal text edit changes.");
3654 var result = this._textEditChanges[key];
3657 this._workspaceEdit.changes[key] = edits;
3658 result = new TextEditChangeImpl(edits);
3659 this._textEditChanges[key] = result;
3664 WorkspaceChange2.prototype.initDocumentChanges = function() {
3665 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
3666 this._changeAnnotations = new ChangeAnnotations();
3667 this._workspaceEdit.documentChanges = [];
3668 this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();
3671 WorkspaceChange2.prototype.initChanges = function() {
3672 if (this._workspaceEdit.documentChanges === void 0 && this._workspaceEdit.changes === void 0) {
3673 this._workspaceEdit.changes = Object.create(null);
3676 WorkspaceChange2.prototype.createFile = function(uri, optionsOrAnnotation, options) {
3677 this.initDocumentChanges();
3678 if (this._workspaceEdit.documentChanges === void 0) {
3679 throw new Error("Workspace edit is not configured for document changes.");
3682 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3683 annotation = optionsOrAnnotation;
3685 options = optionsOrAnnotation;
3689 if (annotation === void 0) {
3690 operation = CreateFile.create(uri, options);
3692 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3693 operation = CreateFile.create(uri, options, id);
3695 this._workspaceEdit.documentChanges.push(operation);
3696 if (id !== void 0) {
3700 WorkspaceChange2.prototype.renameFile = function(oldUri, newUri, optionsOrAnnotation, options) {
3701 this.initDocumentChanges();
3702 if (this._workspaceEdit.documentChanges === void 0) {
3703 throw new Error("Workspace edit is not configured for document changes.");
3706 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3707 annotation = optionsOrAnnotation;
3709 options = optionsOrAnnotation;
3713 if (annotation === void 0) {
3714 operation = RenameFile.create(oldUri, newUri, options);
3716 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3717 operation = RenameFile.create(oldUri, newUri, options, id);
3719 this._workspaceEdit.documentChanges.push(operation);
3720 if (id !== void 0) {
3724 WorkspaceChange2.prototype.deleteFile = function(uri, optionsOrAnnotation, options) {
3725 this.initDocumentChanges();
3726 if (this._workspaceEdit.documentChanges === void 0) {
3727 throw new Error("Workspace edit is not configured for document changes.");
3730 if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {
3731 annotation = optionsOrAnnotation;
3733 options = optionsOrAnnotation;
3737 if (annotation === void 0) {
3738 operation = DeleteFile.create(uri, options);
3740 id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);
3741 operation = DeleteFile.create(uri, options, id);
3743 this._workspaceEdit.documentChanges.push(operation);
3744 if (id !== void 0) {
3748 return WorkspaceChange2;
3750 (function(TextDocumentIdentifier4) {
3751 function create(uri) {
3754 TextDocumentIdentifier4.create = create;
3755 function is(value) {
3756 var candidate = value;
3757 return Is.defined(candidate) && Is.string(candidate.uri);
3759 TextDocumentIdentifier4.is = is;
3760 })(TextDocumentIdentifier2 || (TextDocumentIdentifier2 = {}));
3761 (function(VersionedTextDocumentIdentifier3) {
3762 function create(uri, version) {
3763 return { uri, version };
3765 VersionedTextDocumentIdentifier3.create = create;
3766 function is(value) {
3767 var candidate = value;
3768 return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);
3770 VersionedTextDocumentIdentifier3.is = is;
3771 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));
3772 (function(OptionalVersionedTextDocumentIdentifier2) {
3773 function create(uri, version) {
3774 return { uri, version };
3776 OptionalVersionedTextDocumentIdentifier2.create = create;
3777 function is(value) {
3778 var candidate = value;
3779 return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));
3781 OptionalVersionedTextDocumentIdentifier2.is = is;
3782 })(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));
3783 (function(TextDocumentItem2) {
3784 function create(uri, languageId, version, text) {
3785 return { uri, languageId, version, text };
3787 TextDocumentItem2.create = create;
3788 function is(value) {
3789 var candidate = value;
3790 return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);
3792 TextDocumentItem2.is = is;
3793 })(TextDocumentItem || (TextDocumentItem = {}));
3794 (function(MarkupKind2) {
3795 MarkupKind2.PlainText = "plaintext";
3796 MarkupKind2.Markdown = "markdown";
3797 })(MarkupKind || (MarkupKind = {}));
3798 (function(MarkupKind2) {
3799 function is(value) {
3800 var candidate = value;
3801 return candidate === MarkupKind2.PlainText || candidate === MarkupKind2.Markdown;
3803 MarkupKind2.is = is;
3804 })(MarkupKind || (MarkupKind = {}));
3805 (function(MarkupContent2) {
3806 function is(value) {
3807 var candidate = value;
3808 return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);
3810 MarkupContent2.is = is;
3811 })(MarkupContent || (MarkupContent = {}));
3812 (function(CompletionItemKind3) {
3813 CompletionItemKind3.Text = 1;
3814 CompletionItemKind3.Method = 2;
3815 CompletionItemKind3.Function = 3;
3816 CompletionItemKind3.Constructor = 4;
3817 CompletionItemKind3.Field = 5;
3818 CompletionItemKind3.Variable = 6;
3819 CompletionItemKind3.Class = 7;
3820 CompletionItemKind3.Interface = 8;
3821 CompletionItemKind3.Module = 9;
3822 CompletionItemKind3.Property = 10;
3823 CompletionItemKind3.Unit = 11;
3824 CompletionItemKind3.Value = 12;
3825 CompletionItemKind3.Enum = 13;
3826 CompletionItemKind3.Keyword = 14;
3827 CompletionItemKind3.Snippet = 15;
3828 CompletionItemKind3.Color = 16;
3829 CompletionItemKind3.File = 17;
3830 CompletionItemKind3.Reference = 18;
3831 CompletionItemKind3.Folder = 19;
3832 CompletionItemKind3.EnumMember = 20;
3833 CompletionItemKind3.Constant = 21;
3834 CompletionItemKind3.Struct = 22;
3835 CompletionItemKind3.Event = 23;
3836 CompletionItemKind3.Operator = 24;
3837 CompletionItemKind3.TypeParameter = 25;
3838 })(CompletionItemKind || (CompletionItemKind = {}));
3839 (function(InsertTextFormat3) {
3840 InsertTextFormat3.PlainText = 1;
3841 InsertTextFormat3.Snippet = 2;
3842 })(InsertTextFormat || (InsertTextFormat = {}));
3843 (function(CompletionItemTag2) {
3844 CompletionItemTag2.Deprecated = 1;
3845 })(CompletionItemTag || (CompletionItemTag = {}));
3846 (function(InsertReplaceEdit2) {
3847 function create(newText, insert, replace) {
3848 return { newText, insert, replace };
3850 InsertReplaceEdit2.create = create;
3851 function is(value) {
3852 var candidate = value;
3853 return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);
3855 InsertReplaceEdit2.is = is;
3856 })(InsertReplaceEdit || (InsertReplaceEdit = {}));
3857 (function(InsertTextMode2) {
3858 InsertTextMode2.asIs = 1;
3859 InsertTextMode2.adjustIndentation = 2;
3860 })(InsertTextMode || (InsertTextMode = {}));
3861 (function(CompletionItem2) {
3862 function create(label) {
3865 CompletionItem2.create = create;
3866 })(CompletionItem || (CompletionItem = {}));
3867 (function(CompletionList2) {
3868 function create(items, isIncomplete) {
3869 return { items: items ? items : [], isIncomplete: !!isIncomplete };
3871 CompletionList2.create = create;
3872 })(CompletionList || (CompletionList = {}));
3873 (function(MarkedString2) {
3874 function fromPlainText(plainText) {
3875 return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&");
3877 MarkedString2.fromPlainText = fromPlainText;
3878 function is(value) {
3879 var candidate = value;
3880 return Is.string(candidate) || Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value);
3882 MarkedString2.is = is;
3883 })(MarkedString || (MarkedString = {}));
3885 function is(value) {
3886 var candidate = value;
3887 return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) || MarkedString.is(candidate.contents) || Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));
3890 })(Hover || (Hover = {}));
3891 (function(ParameterInformation2) {
3892 function create(label, documentation) {
3893 return documentation ? { label, documentation } : { label };
3895 ParameterInformation2.create = create;
3896 })(ParameterInformation || (ParameterInformation = {}));
3897 (function(SignatureInformation2) {
3898 function create(label, documentation) {
3899 var parameters = [];
3900 for (var _i = 2; _i < arguments.length; _i++) {
3901 parameters[_i - 2] = arguments[_i];
3903 var result = { label };
3904 if (Is.defined(documentation)) {
3905 result.documentation = documentation;
3907 if (Is.defined(parameters)) {
3908 result.parameters = parameters;
3910 result.parameters = [];
3914 SignatureInformation2.create = create;
3915 })(SignatureInformation || (SignatureInformation = {}));
3916 (function(DocumentHighlightKind2) {
3917 DocumentHighlightKind2.Text = 1;
3918 DocumentHighlightKind2.Read = 2;
3919 DocumentHighlightKind2.Write = 3;
3920 })(DocumentHighlightKind || (DocumentHighlightKind = {}));
3921 (function(DocumentHighlight2) {
3922 function create(range, kind) {
3923 var result = { range };
3924 if (Is.number(kind)) {
3929 DocumentHighlight2.create = create;
3930 })(DocumentHighlight || (DocumentHighlight = {}));
3931 (function(SymbolKind2) {
3932 SymbolKind2.File = 1;
3933 SymbolKind2.Module = 2;
3934 SymbolKind2.Namespace = 3;
3935 SymbolKind2.Package = 4;
3936 SymbolKind2.Class = 5;
3937 SymbolKind2.Method = 6;
3938 SymbolKind2.Property = 7;
3939 SymbolKind2.Field = 8;
3940 SymbolKind2.Constructor = 9;
3941 SymbolKind2.Enum = 10;
3942 SymbolKind2.Interface = 11;
3943 SymbolKind2.Function = 12;
3944 SymbolKind2.Variable = 13;
3945 SymbolKind2.Constant = 14;
3946 SymbolKind2.String = 15;
3947 SymbolKind2.Number = 16;
3948 SymbolKind2.Boolean = 17;
3949 SymbolKind2.Array = 18;
3950 SymbolKind2.Object = 19;
3951 SymbolKind2.Key = 20;
3952 SymbolKind2.Null = 21;
3953 SymbolKind2.EnumMember = 22;
3954 SymbolKind2.Struct = 23;
3955 SymbolKind2.Event = 24;
3956 SymbolKind2.Operator = 25;
3957 SymbolKind2.TypeParameter = 26;
3958 })(SymbolKind || (SymbolKind = {}));
3959 (function(SymbolTag2) {
3960 SymbolTag2.Deprecated = 1;
3961 })(SymbolTag || (SymbolTag = {}));
3962 (function(SymbolInformation2) {
3963 function create(name, kind, range, uri, containerName) {
3967 location: { uri, range }
3969 if (containerName) {
3970 result.containerName = containerName;
3974 SymbolInformation2.create = create;
3975 })(SymbolInformation || (SymbolInformation = {}));
3976 (function(DocumentSymbol2) {
3977 function create(name, detail, kind, range, selectionRange, children) {
3985 if (children !== void 0) {
3986 result.children = children;
3990 DocumentSymbol2.create = create;
3991 function is(value) {
3992 var candidate = value;
3993 return candidate && Is.string(candidate.name) && Is.number(candidate.kind) && Range.is(candidate.range) && Range.is(candidate.selectionRange) && (candidate.detail === void 0 || Is.string(candidate.detail)) && (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) && (candidate.children === void 0 || Array.isArray(candidate.children)) && (candidate.tags === void 0 || Array.isArray(candidate.tags));
3995 DocumentSymbol2.is = is;
3996 })(DocumentSymbol || (DocumentSymbol = {}));
3997 (function(CodeActionKind2) {
3998 CodeActionKind2.Empty = "";
3999 CodeActionKind2.QuickFix = "quickfix";
4000 CodeActionKind2.Refactor = "refactor";
4001 CodeActionKind2.RefactorExtract = "refactor.extract";
4002 CodeActionKind2.RefactorInline = "refactor.inline";
4003 CodeActionKind2.RefactorRewrite = "refactor.rewrite";
4004 CodeActionKind2.Source = "source";
4005 CodeActionKind2.SourceOrganizeImports = "source.organizeImports";
4006 CodeActionKind2.SourceFixAll = "source.fixAll";
4007 })(CodeActionKind || (CodeActionKind = {}));
4008 (function(CodeActionContext2) {
4009 function create(diagnostics, only) {
4010 var result = { diagnostics };
4011 if (only !== void 0 && only !== null) {
4016 CodeActionContext2.create = create;
4017 function is(value) {
4018 var candidate = value;
4019 return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));
4021 CodeActionContext2.is = is;
4022 })(CodeActionContext || (CodeActionContext = {}));
4023 (function(CodeAction2) {
4024 function create(title, kindOrCommandOrEdit, kind) {
4025 var result = { title };
4026 var checkKind = true;
4027 if (typeof kindOrCommandOrEdit === "string") {
4029 result.kind = kindOrCommandOrEdit;
4030 } else if (Command.is(kindOrCommandOrEdit)) {
4031 result.command = kindOrCommandOrEdit;
4033 result.edit = kindOrCommandOrEdit;
4035 if (checkKind && kind !== void 0) {
4040 CodeAction2.create = create;
4041 function is(value) {
4042 var candidate = value;
4043 return candidate && Is.string(candidate.title) && (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) && (candidate.kind === void 0 || Is.string(candidate.kind)) && (candidate.edit !== void 0 || candidate.command !== void 0) && (candidate.command === void 0 || Command.is(candidate.command)) && (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) && (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));
4045 CodeAction2.is = is;
4046 })(CodeAction || (CodeAction = {}));
4047 (function(CodeLens2) {
4048 function create(range, data) {
4049 var result = { range };
4050 if (Is.defined(data)) {
4055 CodeLens2.create = create;
4056 function is(value) {
4057 var candidate = value;
4058 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));
4061 })(CodeLens || (CodeLens = {}));
4062 (function(FormattingOptions2) {
4063 function create(tabSize, insertSpaces) {
4064 return { tabSize, insertSpaces };
4066 FormattingOptions2.create = create;
4067 function is(value) {
4068 var candidate = value;
4069 return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);
4071 FormattingOptions2.is = is;
4072 })(FormattingOptions || (FormattingOptions = {}));
4073 (function(DocumentLink2) {
4074 function create(range, target, data) {
4075 return { range, target, data };
4077 DocumentLink2.create = create;
4078 function is(value) {
4079 var candidate = value;
4080 return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));
4082 DocumentLink2.is = is;
4083 })(DocumentLink || (DocumentLink = {}));
4084 (function(SelectionRange2) {
4085 function create(range, parent) {
4086 return { range, parent };
4088 SelectionRange2.create = create;
4089 function is(value) {
4090 var candidate = value;
4091 return candidate !== void 0 && Range.is(candidate.range) && (candidate.parent === void 0 || SelectionRange2.is(candidate.parent));
4093 SelectionRange2.is = is;
4094 })(SelectionRange || (SelectionRange = {}));
4095 EOL = ["\n", "\r\n", "\r"];
4096 (function(TextDocument2) {
4097 function create(uri, languageId, version, content) {
4098 return new FullTextDocument(uri, languageId, version, content);
4100 TextDocument2.create = create;
4101 function is(value) {
4102 var candidate = value;
4103 return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount) && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;
4105 TextDocument2.is = is;
4106 function applyEdits(document2, edits) {
4107 var text = document2.getText();
4108 var sortedEdits = mergeSort(edits, function(a, b) {
4109 var diff = a.range.start.line - b.range.start.line;
4111 return a.range.start.character - b.range.start.character;
4115 var lastModifiedOffset = text.length;
4116 for (var i = sortedEdits.length - 1; i >= 0; i--) {
4117 var e = sortedEdits[i];
4118 var startOffset = document2.offsetAt(e.range.start);
4119 var endOffset = document2.offsetAt(e.range.end);
4120 if (endOffset <= lastModifiedOffset) {
4121 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);
4123 throw new Error("Overlapping edit");
4125 lastModifiedOffset = startOffset;
4129 TextDocument2.applyEdits = applyEdits;
4130 function mergeSort(data, compare) {
4131 if (data.length <= 1) {
4134 var p = data.length / 2 | 0;
4135 var left = data.slice(0, p);
4136 var right = data.slice(p);
4137 mergeSort(left, compare);
4138 mergeSort(right, compare);
4142 while (leftIdx < left.length && rightIdx < right.length) {
4143 var ret2 = compare(left[leftIdx], right[rightIdx]);
4145 data[i++] = left[leftIdx++];
4147 data[i++] = right[rightIdx++];
4150 while (leftIdx < left.length) {
4151 data[i++] = left[leftIdx++];
4153 while (rightIdx < right.length) {
4154 data[i++] = right[rightIdx++];
4158 })(TextDocument || (TextDocument = {}));
4159 FullTextDocument = function() {
4160 function FullTextDocument2(uri, languageId, version, content) {
4162 this._languageId = languageId;
4163 this._version = version;
4164 this._content = content;
4165 this._lineOffsets = void 0;
4167 Object.defineProperty(FullTextDocument2.prototype, "uri", {
4174 Object.defineProperty(FullTextDocument2.prototype, "languageId", {
4176 return this._languageId;
4181 Object.defineProperty(FullTextDocument2.prototype, "version", {
4183 return this._version;
4188 FullTextDocument2.prototype.getText = function(range) {
4190 var start = this.offsetAt(range.start);
4191 var end = this.offsetAt(range.end);
4192 return this._content.substring(start, end);
4194 return this._content;
4196 FullTextDocument2.prototype.update = function(event, version) {
4197 this._content = event.text;
4198 this._version = version;
4199 this._lineOffsets = void 0;
4201 FullTextDocument2.prototype.getLineOffsets = function() {
4202 if (this._lineOffsets === void 0) {
4203 var lineOffsets = [];
4204 var text = this._content;
4205 var isLineStart = true;
4206 for (var i = 0; i < text.length; i++) {
4208 lineOffsets.push(i);
4209 isLineStart = false;
4211 var ch = text.charAt(i);
4212 isLineStart = ch === "\r" || ch === "\n";
4213 if (ch === "\r" && i + 1 < text.length && text.charAt(i + 1) === "\n") {
4217 if (isLineStart && text.length > 0) {
4218 lineOffsets.push(text.length);
4220 this._lineOffsets = lineOffsets;
4222 return this._lineOffsets;
4224 FullTextDocument2.prototype.positionAt = function(offset) {
4225 offset = Math.max(Math.min(offset, this._content.length), 0);
4226 var lineOffsets = this.getLineOffsets();
4227 var low = 0, high = lineOffsets.length;
4229 return Position.create(0, offset);
4231 while (low < high) {
4232 var mid = Math.floor((low + high) / 2);
4233 if (lineOffsets[mid] > offset) {
4240 return Position.create(line, offset - lineOffsets[line]);
4242 FullTextDocument2.prototype.offsetAt = function(position) {
4243 var lineOffsets = this.getLineOffsets();
4244 if (position.line >= lineOffsets.length) {
4245 return this._content.length;
4246 } else if (position.line < 0) {
4249 var lineOffset = lineOffsets[position.line];
4250 var nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this._content.length;
4251 return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);
4253 Object.defineProperty(FullTextDocument2.prototype, "lineCount", {
4255 return this.getLineOffsets().length;
4260 return FullTextDocument2;
4263 var toString = Object.prototype.toString;
4264 function defined(value) {
4265 return typeof value !== "undefined";
4267 Is2.defined = defined;
4268 function undefined2(value) {
4269 return typeof value === "undefined";
4271 Is2.undefined = undefined2;
4272 function boolean(value) {
4273 return value === true || value === false;
4275 Is2.boolean = boolean;
4276 function string(value) {
4277 return toString.call(value) === "[object String]";
4279 Is2.string = string;
4280 function number(value) {
4281 return toString.call(value) === "[object Number]";
4283 Is2.number = number;
4284 function numberRange(value, min, max) {
4285 return toString.call(value) === "[object Number]" && min <= value && value <= max;
4287 Is2.numberRange = numberRange;
4288 function integer2(value) {
4289 return toString.call(value) === "[object Number]" && -2147483648 <= value && value <= 2147483647;
4291 Is2.integer = integer2;
4292 function uinteger2(value) {
4293 return toString.call(value) === "[object Number]" && 0 <= value && value <= 2147483647;
4295 Is2.uinteger = uinteger2;
4296 function func(value) {
4297 return toString.call(value) === "[object Function]";
4300 function objectLiteral(value) {
4301 return value !== null && typeof value === "object";
4303 Is2.objectLiteral = objectLiteral;
4304 function typedArray(value, check) {
4305 return Array.isArray(value) && value.every(check);
4307 Is2.typedArray = typedArray;
4308 })(Is || (Is = {}));
4312 // node_modules/vscode-languageserver-protocol/lib/common/messages.js
4313 var require_messages2 = __commonJS({
4314 "node_modules/vscode-languageserver-protocol/lib/common/messages.js"(exports2) {
4316 Object.defineProperty(exports2, "__esModule", { value: true });
4317 exports2.ProtocolNotificationType = exports2.ProtocolNotificationType0 = exports2.ProtocolRequestType = exports2.ProtocolRequestType0 = exports2.RegistrationType = void 0;
4318 var vscode_jsonrpc_1 = require_main();
4319 var RegistrationType = class {
4320 constructor(method) {
4321 this.method = method;
4324 exports2.RegistrationType = RegistrationType;
4325 var ProtocolRequestType0 = class extends vscode_jsonrpc_1.RequestType0 {
4326 constructor(method) {
4330 exports2.ProtocolRequestType0 = ProtocolRequestType0;
4331 var ProtocolRequestType = class extends vscode_jsonrpc_1.RequestType {
4332 constructor(method) {
4333 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
4336 exports2.ProtocolRequestType = ProtocolRequestType;
4337 var ProtocolNotificationType0 = class extends vscode_jsonrpc_1.NotificationType0 {
4338 constructor(method) {
4342 exports2.ProtocolNotificationType0 = ProtocolNotificationType0;
4343 var ProtocolNotificationType = class extends vscode_jsonrpc_1.NotificationType {
4344 constructor(method) {
4345 super(method, vscode_jsonrpc_1.ParameterStructures.byName);
4348 exports2.ProtocolNotificationType = ProtocolNotificationType;
4352 // node_modules/vscode-languageserver-protocol/lib/common/utils/is.js
4353 var require_is2 = __commonJS({
4354 "node_modules/vscode-languageserver-protocol/lib/common/utils/is.js"(exports2) {
4356 Object.defineProperty(exports2, "__esModule", { value: true });
4357 exports2.objectLiteral = exports2.typedArray = exports2.stringArray = exports2.array = exports2.func = exports2.error = exports2.number = exports2.string = exports2.boolean = void 0;
4358 function boolean(value) {
4359 return value === true || value === false;
4361 exports2.boolean = boolean;
4362 function string(value) {
4363 return typeof value === "string" || value instanceof String;
4365 exports2.string = string;
4366 function number(value) {
4367 return typeof value === "number" || value instanceof Number;
4369 exports2.number = number;
4370 function error(value) {
4371 return value instanceof Error;
4373 exports2.error = error;
4374 function func(value) {
4375 return typeof value === "function";
4377 exports2.func = func;
4378 function array(value) {
4379 return Array.isArray(value);
4381 exports2.array = array;
4382 function stringArray(value) {
4383 return array(value) && value.every((elem) => string(elem));
4385 exports2.stringArray = stringArray;
4386 function typedArray(value, check) {
4387 return Array.isArray(value) && value.every(check);
4389 exports2.typedArray = typedArray;
4390 function objectLiteral(value) {
4391 return value !== null && typeof value === "object";
4393 exports2.objectLiteral = objectLiteral;
4397 // node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js
4398 var require_protocol_implementation = __commonJS({
4399 "node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js"(exports2) {
4401 Object.defineProperty(exports2, "__esModule", { value: true });
4402 exports2.ImplementationRequest = void 0;
4403 var messages_1 = require_messages2();
4404 var ImplementationRequest;
4405 (function(ImplementationRequest2) {
4406 ImplementationRequest2.method = "textDocument/implementation";
4407 ImplementationRequest2.type = new messages_1.ProtocolRequestType(ImplementationRequest2.method);
4408 })(ImplementationRequest = exports2.ImplementationRequest || (exports2.ImplementationRequest = {}));
4412 // node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js
4413 var require_protocol_typeDefinition = __commonJS({
4414 "node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js"(exports2) {
4416 Object.defineProperty(exports2, "__esModule", { value: true });
4417 exports2.TypeDefinitionRequest = void 0;
4418 var messages_1 = require_messages2();
4419 var TypeDefinitionRequest;
4420 (function(TypeDefinitionRequest2) {
4421 TypeDefinitionRequest2.method = "textDocument/typeDefinition";
4422 TypeDefinitionRequest2.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest2.method);
4423 })(TypeDefinitionRequest = exports2.TypeDefinitionRequest || (exports2.TypeDefinitionRequest = {}));
4427 // node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js
4428 var require_protocol_workspaceFolders = __commonJS({
4429 "node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolders.js"(exports2) {
4431 Object.defineProperty(exports2, "__esModule", { value: true });
4432 exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = void 0;
4433 var messages_1 = require_messages2();
4434 var WorkspaceFoldersRequest;
4435 (function(WorkspaceFoldersRequest2) {
4436 WorkspaceFoldersRequest2.type = new messages_1.ProtocolRequestType0("workspace/workspaceFolders");
4437 })(WorkspaceFoldersRequest = exports2.WorkspaceFoldersRequest || (exports2.WorkspaceFoldersRequest = {}));
4438 var DidChangeWorkspaceFoldersNotification;
4439 (function(DidChangeWorkspaceFoldersNotification2) {
4440 DidChangeWorkspaceFoldersNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWorkspaceFolders");
4441 })(DidChangeWorkspaceFoldersNotification = exports2.DidChangeWorkspaceFoldersNotification || (exports2.DidChangeWorkspaceFoldersNotification = {}));
4445 // node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js
4446 var require_protocol_configuration = __commonJS({
4447 "node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js"(exports2) {
4449 Object.defineProperty(exports2, "__esModule", { value: true });
4450 exports2.ConfigurationRequest = void 0;
4451 var messages_1 = require_messages2();
4452 var ConfigurationRequest;
4453 (function(ConfigurationRequest2) {
4454 ConfigurationRequest2.type = new messages_1.ProtocolRequestType("workspace/configuration");
4455 })(ConfigurationRequest = exports2.ConfigurationRequest || (exports2.ConfigurationRequest = {}));
4459 // node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js
4460 var require_protocol_colorProvider = __commonJS({
4461 "node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js"(exports2) {
4463 Object.defineProperty(exports2, "__esModule", { value: true });
4464 exports2.ColorPresentationRequest = exports2.DocumentColorRequest = void 0;
4465 var messages_1 = require_messages2();
4466 var DocumentColorRequest;
4467 (function(DocumentColorRequest2) {
4468 DocumentColorRequest2.method = "textDocument/documentColor";
4469 DocumentColorRequest2.type = new messages_1.ProtocolRequestType(DocumentColorRequest2.method);
4470 })(DocumentColorRequest = exports2.DocumentColorRequest || (exports2.DocumentColorRequest = {}));
4471 var ColorPresentationRequest;
4472 (function(ColorPresentationRequest2) {
4473 ColorPresentationRequest2.type = new messages_1.ProtocolRequestType("textDocument/colorPresentation");
4474 })(ColorPresentationRequest = exports2.ColorPresentationRequest || (exports2.ColorPresentationRequest = {}));
4478 // node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js
4479 var require_protocol_foldingRange = __commonJS({
4480 "node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js"(exports2) {
4482 Object.defineProperty(exports2, "__esModule", { value: true });
4483 exports2.FoldingRangeRequest = exports2.FoldingRangeKind = void 0;
4484 var messages_1 = require_messages2();
4485 var FoldingRangeKind2;
4486 (function(FoldingRangeKind3) {
4487 FoldingRangeKind3["Comment"] = "comment";
4488 FoldingRangeKind3["Imports"] = "imports";
4489 FoldingRangeKind3["Region"] = "region";
4490 })(FoldingRangeKind2 = exports2.FoldingRangeKind || (exports2.FoldingRangeKind = {}));
4491 var FoldingRangeRequest;
4492 (function(FoldingRangeRequest2) {
4493 FoldingRangeRequest2.method = "textDocument/foldingRange";
4494 FoldingRangeRequest2.type = new messages_1.ProtocolRequestType(FoldingRangeRequest2.method);
4495 })(FoldingRangeRequest = exports2.FoldingRangeRequest || (exports2.FoldingRangeRequest = {}));
4499 // node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js
4500 var require_protocol_declaration = __commonJS({
4501 "node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js"(exports2) {
4503 Object.defineProperty(exports2, "__esModule", { value: true });
4504 exports2.DeclarationRequest = void 0;
4505 var messages_1 = require_messages2();
4506 var DeclarationRequest;
4507 (function(DeclarationRequest2) {
4508 DeclarationRequest2.method = "textDocument/declaration";
4509 DeclarationRequest2.type = new messages_1.ProtocolRequestType(DeclarationRequest2.method);
4510 })(DeclarationRequest = exports2.DeclarationRequest || (exports2.DeclarationRequest = {}));
4514 // node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js
4515 var require_protocol_selectionRange = __commonJS({
4516 "node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js"(exports2) {
4518 Object.defineProperty(exports2, "__esModule", { value: true });
4519 exports2.SelectionRangeRequest = void 0;
4520 var messages_1 = require_messages2();
4521 var SelectionRangeRequest;
4522 (function(SelectionRangeRequest2) {
4523 SelectionRangeRequest2.method = "textDocument/selectionRange";
4524 SelectionRangeRequest2.type = new messages_1.ProtocolRequestType(SelectionRangeRequest2.method);
4525 })(SelectionRangeRequest = exports2.SelectionRangeRequest || (exports2.SelectionRangeRequest = {}));
4529 // node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js
4530 var require_protocol_progress = __commonJS({
4531 "node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js"(exports2) {
4533 Object.defineProperty(exports2, "__esModule", { value: true });
4534 exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = void 0;
4535 var vscode_jsonrpc_1 = require_main();
4536 var messages_1 = require_messages2();
4537 var WorkDoneProgress;
4538 (function(WorkDoneProgress2) {
4539 WorkDoneProgress2.type = new vscode_jsonrpc_1.ProgressType();
4540 function is(value) {
4541 return value === WorkDoneProgress2.type;
4543 WorkDoneProgress2.is = is;
4544 })(WorkDoneProgress = exports2.WorkDoneProgress || (exports2.WorkDoneProgress = {}));
4545 var WorkDoneProgressCreateRequest;
4546 (function(WorkDoneProgressCreateRequest2) {
4547 WorkDoneProgressCreateRequest2.type = new messages_1.ProtocolRequestType("window/workDoneProgress/create");
4548 })(WorkDoneProgressCreateRequest = exports2.WorkDoneProgressCreateRequest || (exports2.WorkDoneProgressCreateRequest = {}));
4549 var WorkDoneProgressCancelNotification;
4550 (function(WorkDoneProgressCancelNotification2) {
4551 WorkDoneProgressCancelNotification2.type = new messages_1.ProtocolNotificationType("window/workDoneProgress/cancel");
4552 })(WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCancelNotification || (exports2.WorkDoneProgressCancelNotification = {}));
4556 // node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js
4557 var require_protocol_callHierarchy = __commonJS({
4558 "node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js"(exports2) {
4560 Object.defineProperty(exports2, "__esModule", { value: true });
4561 exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.CallHierarchyPrepareRequest = void 0;
4562 var messages_1 = require_messages2();
4563 var CallHierarchyPrepareRequest;
4564 (function(CallHierarchyPrepareRequest2) {
4565 CallHierarchyPrepareRequest2.method = "textDocument/prepareCallHierarchy";
4566 CallHierarchyPrepareRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest2.method);
4567 })(CallHierarchyPrepareRequest = exports2.CallHierarchyPrepareRequest || (exports2.CallHierarchyPrepareRequest = {}));
4568 var CallHierarchyIncomingCallsRequest;
4569 (function(CallHierarchyIncomingCallsRequest2) {
4570 CallHierarchyIncomingCallsRequest2.method = "callHierarchy/incomingCalls";
4571 CallHierarchyIncomingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest2.method);
4572 })(CallHierarchyIncomingCallsRequest = exports2.CallHierarchyIncomingCallsRequest || (exports2.CallHierarchyIncomingCallsRequest = {}));
4573 var CallHierarchyOutgoingCallsRequest;
4574 (function(CallHierarchyOutgoingCallsRequest2) {
4575 CallHierarchyOutgoingCallsRequest2.method = "callHierarchy/outgoingCalls";
4576 CallHierarchyOutgoingCallsRequest2.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest2.method);
4577 })(CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyOutgoingCallsRequest || (exports2.CallHierarchyOutgoingCallsRequest = {}));
4581 // node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js
4582 var require_protocol_semanticTokens = __commonJS({
4583 "node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js"(exports2) {
4585 Object.defineProperty(exports2, "__esModule", { value: true });
4586 exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.SemanticTokensRegistrationType = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = void 0;
4587 var messages_1 = require_messages2();
4588 var SemanticTokenTypes;
4589 (function(SemanticTokenTypes2) {
4590 SemanticTokenTypes2["namespace"] = "namespace";
4591 SemanticTokenTypes2["type"] = "type";
4592 SemanticTokenTypes2["class"] = "class";
4593 SemanticTokenTypes2["enum"] = "enum";
4594 SemanticTokenTypes2["interface"] = "interface";
4595 SemanticTokenTypes2["struct"] = "struct";
4596 SemanticTokenTypes2["typeParameter"] = "typeParameter";
4597 SemanticTokenTypes2["parameter"] = "parameter";
4598 SemanticTokenTypes2["variable"] = "variable";
4599 SemanticTokenTypes2["property"] = "property";
4600 SemanticTokenTypes2["enumMember"] = "enumMember";
4601 SemanticTokenTypes2["event"] = "event";
4602 SemanticTokenTypes2["function"] = "function";
4603 SemanticTokenTypes2["method"] = "method";
4604 SemanticTokenTypes2["macro"] = "macro";
4605 SemanticTokenTypes2["keyword"] = "keyword";
4606 SemanticTokenTypes2["modifier"] = "modifier";
4607 SemanticTokenTypes2["comment"] = "comment";
4608 SemanticTokenTypes2["string"] = "string";
4609 SemanticTokenTypes2["number"] = "number";
4610 SemanticTokenTypes2["regexp"] = "regexp";
4611 SemanticTokenTypes2["operator"] = "operator";
4612 })(SemanticTokenTypes = exports2.SemanticTokenTypes || (exports2.SemanticTokenTypes = {}));
4613 var SemanticTokenModifiers;
4614 (function(SemanticTokenModifiers2) {
4615 SemanticTokenModifiers2["declaration"] = "declaration";
4616 SemanticTokenModifiers2["definition"] = "definition";
4617 SemanticTokenModifiers2["readonly"] = "readonly";
4618 SemanticTokenModifiers2["static"] = "static";
4619 SemanticTokenModifiers2["deprecated"] = "deprecated";
4620 SemanticTokenModifiers2["abstract"] = "abstract";
4621 SemanticTokenModifiers2["async"] = "async";
4622 SemanticTokenModifiers2["modification"] = "modification";
4623 SemanticTokenModifiers2["documentation"] = "documentation";
4624 SemanticTokenModifiers2["defaultLibrary"] = "defaultLibrary";
4625 })(SemanticTokenModifiers = exports2.SemanticTokenModifiers || (exports2.SemanticTokenModifiers = {}));
4627 (function(SemanticTokens2) {
4628 function is(value) {
4629 const candidate = value;
4630 return candidate !== void 0 && (candidate.resultId === void 0 || typeof candidate.resultId === "string") && Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === "number");
4632 SemanticTokens2.is = is;
4633 })(SemanticTokens = exports2.SemanticTokens || (exports2.SemanticTokens = {}));
4635 (function(TokenFormat2) {
4636 TokenFormat2.Relative = "relative";
4637 })(TokenFormat = exports2.TokenFormat || (exports2.TokenFormat = {}));
4638 var SemanticTokensRegistrationType;
4639 (function(SemanticTokensRegistrationType2) {
4640 SemanticTokensRegistrationType2.method = "textDocument/semanticTokens";
4641 SemanticTokensRegistrationType2.type = new messages_1.RegistrationType(SemanticTokensRegistrationType2.method);
4642 })(SemanticTokensRegistrationType = exports2.SemanticTokensRegistrationType || (exports2.SemanticTokensRegistrationType = {}));
4643 var SemanticTokensRequest;
4644 (function(SemanticTokensRequest2) {
4645 SemanticTokensRequest2.method = "textDocument/semanticTokens/full";
4646 SemanticTokensRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRequest2.method);
4647 })(SemanticTokensRequest = exports2.SemanticTokensRequest || (exports2.SemanticTokensRequest = {}));
4648 var SemanticTokensDeltaRequest;
4649 (function(SemanticTokensDeltaRequest2) {
4650 SemanticTokensDeltaRequest2.method = "textDocument/semanticTokens/full/delta";
4651 SemanticTokensDeltaRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensDeltaRequest2.method);
4652 })(SemanticTokensDeltaRequest = exports2.SemanticTokensDeltaRequest || (exports2.SemanticTokensDeltaRequest = {}));
4653 var SemanticTokensRangeRequest;
4654 (function(SemanticTokensRangeRequest2) {
4655 SemanticTokensRangeRequest2.method = "textDocument/semanticTokens/range";
4656 SemanticTokensRangeRequest2.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest2.method);
4657 })(SemanticTokensRangeRequest = exports2.SemanticTokensRangeRequest || (exports2.SemanticTokensRangeRequest = {}));
4658 var SemanticTokensRefreshRequest;
4659 (function(SemanticTokensRefreshRequest2) {
4660 SemanticTokensRefreshRequest2.method = `workspace/semanticTokens/refresh`;
4661 SemanticTokensRefreshRequest2.type = new messages_1.ProtocolRequestType0(SemanticTokensRefreshRequest2.method);
4662 })(SemanticTokensRefreshRequest = exports2.SemanticTokensRefreshRequest || (exports2.SemanticTokensRefreshRequest = {}));
4666 // node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js
4667 var require_protocol_showDocument = __commonJS({
4668 "node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js"(exports2) {
4670 Object.defineProperty(exports2, "__esModule", { value: true });
4671 exports2.ShowDocumentRequest = void 0;
4672 var messages_1 = require_messages2();
4673 var ShowDocumentRequest;
4674 (function(ShowDocumentRequest2) {
4675 ShowDocumentRequest2.method = "window/showDocument";
4676 ShowDocumentRequest2.type = new messages_1.ProtocolRequestType(ShowDocumentRequest2.method);
4677 })(ShowDocumentRequest = exports2.ShowDocumentRequest || (exports2.ShowDocumentRequest = {}));
4681 // node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js
4682 var require_protocol_linkedEditingRange = __commonJS({
4683 "node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js"(exports2) {
4685 Object.defineProperty(exports2, "__esModule", { value: true });
4686 exports2.LinkedEditingRangeRequest = void 0;
4687 var messages_1 = require_messages2();
4688 var LinkedEditingRangeRequest;
4689 (function(LinkedEditingRangeRequest2) {
4690 LinkedEditingRangeRequest2.method = "textDocument/linkedEditingRange";
4691 LinkedEditingRangeRequest2.type = new messages_1.ProtocolRequestType(LinkedEditingRangeRequest2.method);
4692 })(LinkedEditingRangeRequest = exports2.LinkedEditingRangeRequest || (exports2.LinkedEditingRangeRequest = {}));
4696 // node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js
4697 var require_protocol_fileOperations = __commonJS({
4698 "node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js"(exports2) {
4700 Object.defineProperty(exports2, "__esModule", { value: true });
4701 exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.DidRenameFilesNotification = exports2.WillRenameFilesRequest = exports2.DidCreateFilesNotification = exports2.WillCreateFilesRequest = exports2.FileOperationPatternKind = void 0;
4702 var messages_1 = require_messages2();
4703 var FileOperationPatternKind;
4704 (function(FileOperationPatternKind2) {
4705 FileOperationPatternKind2.file = "file";
4706 FileOperationPatternKind2.folder = "folder";
4707 })(FileOperationPatternKind = exports2.FileOperationPatternKind || (exports2.FileOperationPatternKind = {}));
4708 var WillCreateFilesRequest;
4709 (function(WillCreateFilesRequest2) {
4710 WillCreateFilesRequest2.method = "workspace/willCreateFiles";
4711 WillCreateFilesRequest2.type = new messages_1.ProtocolRequestType(WillCreateFilesRequest2.method);
4712 })(WillCreateFilesRequest = exports2.WillCreateFilesRequest || (exports2.WillCreateFilesRequest = {}));
4713 var DidCreateFilesNotification;
4714 (function(DidCreateFilesNotification2) {
4715 DidCreateFilesNotification2.method = "workspace/didCreateFiles";
4716 DidCreateFilesNotification2.type = new messages_1.ProtocolNotificationType(DidCreateFilesNotification2.method);
4717 })(DidCreateFilesNotification = exports2.DidCreateFilesNotification || (exports2.DidCreateFilesNotification = {}));
4718 var WillRenameFilesRequest;
4719 (function(WillRenameFilesRequest2) {
4720 WillRenameFilesRequest2.method = "workspace/willRenameFiles";
4721 WillRenameFilesRequest2.type = new messages_1.ProtocolRequestType(WillRenameFilesRequest2.method);
4722 })(WillRenameFilesRequest = exports2.WillRenameFilesRequest || (exports2.WillRenameFilesRequest = {}));
4723 var DidRenameFilesNotification;
4724 (function(DidRenameFilesNotification2) {
4725 DidRenameFilesNotification2.method = "workspace/didRenameFiles";
4726 DidRenameFilesNotification2.type = new messages_1.ProtocolNotificationType(DidRenameFilesNotification2.method);
4727 })(DidRenameFilesNotification = exports2.DidRenameFilesNotification || (exports2.DidRenameFilesNotification = {}));
4728 var DidDeleteFilesNotification;
4729 (function(DidDeleteFilesNotification2) {
4730 DidDeleteFilesNotification2.method = "workspace/didDeleteFiles";
4731 DidDeleteFilesNotification2.type = new messages_1.ProtocolNotificationType(DidDeleteFilesNotification2.method);
4732 })(DidDeleteFilesNotification = exports2.DidDeleteFilesNotification || (exports2.DidDeleteFilesNotification = {}));
4733 var WillDeleteFilesRequest;
4734 (function(WillDeleteFilesRequest2) {
4735 WillDeleteFilesRequest2.method = "workspace/willDeleteFiles";
4736 WillDeleteFilesRequest2.type = new messages_1.ProtocolRequestType(WillDeleteFilesRequest2.method);
4737 })(WillDeleteFilesRequest = exports2.WillDeleteFilesRequest || (exports2.WillDeleteFilesRequest = {}));
4741 // node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js
4742 var require_protocol_moniker = __commonJS({
4743 "node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js"(exports2) {
4745 Object.defineProperty(exports2, "__esModule", { value: true });
4746 exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = void 0;
4747 var messages_1 = require_messages2();
4748 var UniquenessLevel;
4749 (function(UniquenessLevel2) {
4750 UniquenessLevel2["document"] = "document";
4751 UniquenessLevel2["project"] = "project";
4752 UniquenessLevel2["group"] = "group";
4753 UniquenessLevel2["scheme"] = "scheme";
4754 UniquenessLevel2["global"] = "global";
4755 })(UniquenessLevel = exports2.UniquenessLevel || (exports2.UniquenessLevel = {}));
4757 (function(MonikerKind2) {
4758 MonikerKind2["import"] = "import";
4759 MonikerKind2["export"] = "export";
4760 MonikerKind2["local"] = "local";
4761 })(MonikerKind = exports2.MonikerKind || (exports2.MonikerKind = {}));
4763 (function(MonikerRequest2) {
4764 MonikerRequest2.method = "textDocument/moniker";
4765 MonikerRequest2.type = new messages_1.ProtocolRequestType(MonikerRequest2.method);
4766 })(MonikerRequest = exports2.MonikerRequest || (exports2.MonikerRequest = {}));
4770 // node_modules/vscode-languageserver-protocol/lib/common/protocol.js
4771 var require_protocol = __commonJS({
4772 "node_modules/vscode-languageserver-protocol/lib/common/protocol.js"(exports2) {
4774 Object.defineProperty(exports2, "__esModule", { value: true });
4775 exports2.DocumentLinkRequest = exports2.CodeLensRefreshRequest = exports2.CodeLensResolveRequest = exports2.CodeLensRequest = exports2.WorkspaceSymbolRequest = exports2.CodeActionResolveRequest = exports2.CodeActionRequest = exports2.DocumentSymbolRequest = exports2.DocumentHighlightRequest = exports2.ReferencesRequest = exports2.DefinitionRequest = exports2.SignatureHelpRequest = exports2.SignatureHelpTriggerKind = exports2.HoverRequest = exports2.CompletionResolveRequest = exports2.CompletionRequest = exports2.CompletionTriggerKind = exports2.PublishDiagnosticsNotification = exports2.WatchKind = exports2.FileChangeType = exports2.DidChangeWatchedFilesNotification = exports2.WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentNotification = exports2.TextDocumentSaveReason = exports2.DidSaveTextDocumentNotification = exports2.DidCloseTextDocumentNotification = exports2.DidChangeTextDocumentNotification = exports2.TextDocumentContentChangeEvent = exports2.DidOpenTextDocumentNotification = exports2.TextDocumentSyncKind = exports2.TelemetryEventNotification = exports2.LogMessageNotification = exports2.ShowMessageRequest = exports2.ShowMessageNotification = exports2.MessageType = exports2.DidChangeConfigurationNotification = exports2.ExitNotification = exports2.ShutdownRequest = exports2.InitializedNotification = exports2.InitializeError = exports2.InitializeRequest = exports2.WorkDoneProgressOptions = exports2.TextDocumentRegistrationOptions = exports2.StaticRegistrationOptions = exports2.FailureHandlingKind = exports2.ResourceOperationKind = exports2.UnregistrationRequest = exports2.RegistrationRequest = exports2.DocumentSelector = exports2.DocumentFilter = void 0;
4776 exports2.MonikerRequest = exports2.MonikerKind = exports2.UniquenessLevel = exports2.WillDeleteFilesRequest = exports2.DidDeleteFilesNotification = exports2.WillRenameFilesRequest = exports2.DidRenameFilesNotification = exports2.WillCreateFilesRequest = exports2.DidCreateFilesNotification = exports2.FileOperationPatternKind = exports2.LinkedEditingRangeRequest = exports2.ShowDocumentRequest = exports2.SemanticTokensRegistrationType = exports2.SemanticTokensRefreshRequest = exports2.SemanticTokensRangeRequest = exports2.SemanticTokensDeltaRequest = exports2.SemanticTokensRequest = exports2.TokenFormat = exports2.SemanticTokens = exports2.SemanticTokenModifiers = exports2.SemanticTokenTypes = exports2.CallHierarchyPrepareRequest = exports2.CallHierarchyOutgoingCallsRequest = exports2.CallHierarchyIncomingCallsRequest = exports2.WorkDoneProgressCancelNotification = exports2.WorkDoneProgressCreateRequest = exports2.WorkDoneProgress = exports2.SelectionRangeRequest = exports2.DeclarationRequest = exports2.FoldingRangeRequest = exports2.ColorPresentationRequest = exports2.DocumentColorRequest = exports2.ConfigurationRequest = exports2.DidChangeWorkspaceFoldersNotification = exports2.WorkspaceFoldersRequest = exports2.TypeDefinitionRequest = exports2.ImplementationRequest = exports2.ApplyWorkspaceEditRequest = exports2.ExecuteCommandRequest = exports2.PrepareRenameRequest = exports2.RenameRequest = exports2.PrepareSupportDefaultBehavior = exports2.DocumentOnTypeFormattingRequest = exports2.DocumentRangeFormattingRequest = exports2.DocumentFormattingRequest = exports2.DocumentLinkResolveRequest = void 0;
4777 var Is2 = require_is2();
4778 var messages_1 = require_messages2();
4779 var protocol_implementation_1 = require_protocol_implementation();
4780 Object.defineProperty(exports2, "ImplementationRequest", { enumerable: true, get: function() {
4781 return protocol_implementation_1.ImplementationRequest;
4783 var protocol_typeDefinition_1 = require_protocol_typeDefinition();
4784 Object.defineProperty(exports2, "TypeDefinitionRequest", { enumerable: true, get: function() {
4785 return protocol_typeDefinition_1.TypeDefinitionRequest;
4787 var protocol_workspaceFolders_1 = require_protocol_workspaceFolders();
4788 Object.defineProperty(exports2, "WorkspaceFoldersRequest", { enumerable: true, get: function() {
4789 return protocol_workspaceFolders_1.WorkspaceFoldersRequest;
4791 Object.defineProperty(exports2, "DidChangeWorkspaceFoldersNotification", { enumerable: true, get: function() {
4792 return protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;
4794 var protocol_configuration_1 = require_protocol_configuration();
4795 Object.defineProperty(exports2, "ConfigurationRequest", { enumerable: true, get: function() {
4796 return protocol_configuration_1.ConfigurationRequest;
4798 var protocol_colorProvider_1 = require_protocol_colorProvider();
4799 Object.defineProperty(exports2, "DocumentColorRequest", { enumerable: true, get: function() {
4800 return protocol_colorProvider_1.DocumentColorRequest;
4802 Object.defineProperty(exports2, "ColorPresentationRequest", { enumerable: true, get: function() {
4803 return protocol_colorProvider_1.ColorPresentationRequest;
4805 var protocol_foldingRange_1 = require_protocol_foldingRange();
4806 Object.defineProperty(exports2, "FoldingRangeRequest", { enumerable: true, get: function() {
4807 return protocol_foldingRange_1.FoldingRangeRequest;
4809 var protocol_declaration_1 = require_protocol_declaration();
4810 Object.defineProperty(exports2, "DeclarationRequest", { enumerable: true, get: function() {
4811 return protocol_declaration_1.DeclarationRequest;
4813 var protocol_selectionRange_1 = require_protocol_selectionRange();
4814 Object.defineProperty(exports2, "SelectionRangeRequest", { enumerable: true, get: function() {
4815 return protocol_selectionRange_1.SelectionRangeRequest;
4817 var protocol_progress_1 = require_protocol_progress();
4818 Object.defineProperty(exports2, "WorkDoneProgress", { enumerable: true, get: function() {
4819 return protocol_progress_1.WorkDoneProgress;
4821 Object.defineProperty(exports2, "WorkDoneProgressCreateRequest", { enumerable: true, get: function() {
4822 return protocol_progress_1.WorkDoneProgressCreateRequest;
4824 Object.defineProperty(exports2, "WorkDoneProgressCancelNotification", { enumerable: true, get: function() {
4825 return protocol_progress_1.WorkDoneProgressCancelNotification;
4827 var protocol_callHierarchy_1 = require_protocol_callHierarchy();
4828 Object.defineProperty(exports2, "CallHierarchyIncomingCallsRequest", { enumerable: true, get: function() {
4829 return protocol_callHierarchy_1.CallHierarchyIncomingCallsRequest;
4831 Object.defineProperty(exports2, "CallHierarchyOutgoingCallsRequest", { enumerable: true, get: function() {
4832 return protocol_callHierarchy_1.CallHierarchyOutgoingCallsRequest;
4834 Object.defineProperty(exports2, "CallHierarchyPrepareRequest", { enumerable: true, get: function() {
4835 return protocol_callHierarchy_1.CallHierarchyPrepareRequest;
4837 var protocol_semanticTokens_1 = require_protocol_semanticTokens();
4838 Object.defineProperty(exports2, "SemanticTokenTypes", { enumerable: true, get: function() {
4839 return protocol_semanticTokens_1.SemanticTokenTypes;
4841 Object.defineProperty(exports2, "SemanticTokenModifiers", { enumerable: true, get: function() {
4842 return protocol_semanticTokens_1.SemanticTokenModifiers;
4844 Object.defineProperty(exports2, "SemanticTokens", { enumerable: true, get: function() {
4845 return protocol_semanticTokens_1.SemanticTokens;
4847 Object.defineProperty(exports2, "TokenFormat", { enumerable: true, get: function() {
4848 return protocol_semanticTokens_1.TokenFormat;
4850 Object.defineProperty(exports2, "SemanticTokensRequest", { enumerable: true, get: function() {
4851 return protocol_semanticTokens_1.SemanticTokensRequest;
4853 Object.defineProperty(exports2, "SemanticTokensDeltaRequest", { enumerable: true, get: function() {
4854 return protocol_semanticTokens_1.SemanticTokensDeltaRequest;
4856 Object.defineProperty(exports2, "SemanticTokensRangeRequest", { enumerable: true, get: function() {
4857 return protocol_semanticTokens_1.SemanticTokensRangeRequest;
4859 Object.defineProperty(exports2, "SemanticTokensRefreshRequest", { enumerable: true, get: function() {
4860 return protocol_semanticTokens_1.SemanticTokensRefreshRequest;
4862 Object.defineProperty(exports2, "SemanticTokensRegistrationType", { enumerable: true, get: function() {
4863 return protocol_semanticTokens_1.SemanticTokensRegistrationType;
4865 var protocol_showDocument_1 = require_protocol_showDocument();
4866 Object.defineProperty(exports2, "ShowDocumentRequest", { enumerable: true, get: function() {
4867 return protocol_showDocument_1.ShowDocumentRequest;
4869 var protocol_linkedEditingRange_1 = require_protocol_linkedEditingRange();
4870 Object.defineProperty(exports2, "LinkedEditingRangeRequest", { enumerable: true, get: function() {
4871 return protocol_linkedEditingRange_1.LinkedEditingRangeRequest;
4873 var protocol_fileOperations_1 = require_protocol_fileOperations();
4874 Object.defineProperty(exports2, "FileOperationPatternKind", { enumerable: true, get: function() {
4875 return protocol_fileOperations_1.FileOperationPatternKind;
4877 Object.defineProperty(exports2, "DidCreateFilesNotification", { enumerable: true, get: function() {
4878 return protocol_fileOperations_1.DidCreateFilesNotification;
4880 Object.defineProperty(exports2, "WillCreateFilesRequest", { enumerable: true, get: function() {
4881 return protocol_fileOperations_1.WillCreateFilesRequest;
4883 Object.defineProperty(exports2, "DidRenameFilesNotification", { enumerable: true, get: function() {
4884 return protocol_fileOperations_1.DidRenameFilesNotification;
4886 Object.defineProperty(exports2, "WillRenameFilesRequest", { enumerable: true, get: function() {
4887 return protocol_fileOperations_1.WillRenameFilesRequest;
4889 Object.defineProperty(exports2, "DidDeleteFilesNotification", { enumerable: true, get: function() {
4890 return protocol_fileOperations_1.DidDeleteFilesNotification;
4892 Object.defineProperty(exports2, "WillDeleteFilesRequest", { enumerable: true, get: function() {
4893 return protocol_fileOperations_1.WillDeleteFilesRequest;
4895 var protocol_moniker_1 = require_protocol_moniker();
4896 Object.defineProperty(exports2, "UniquenessLevel", { enumerable: true, get: function() {
4897 return protocol_moniker_1.UniquenessLevel;
4899 Object.defineProperty(exports2, "MonikerKind", { enumerable: true, get: function() {
4900 return protocol_moniker_1.MonikerKind;
4902 Object.defineProperty(exports2, "MonikerRequest", { enumerable: true, get: function() {
4903 return protocol_moniker_1.MonikerRequest;
4906 (function(DocumentFilter2) {
4907 function is(value) {
4908 const candidate = value;
4909 return Is2.string(candidate.language) || Is2.string(candidate.scheme) || Is2.string(candidate.pattern);
4911 DocumentFilter2.is = is;
4912 })(DocumentFilter = exports2.DocumentFilter || (exports2.DocumentFilter = {}));
4913 var DocumentSelector;
4914 (function(DocumentSelector2) {
4915 function is(value) {
4916 if (!Array.isArray(value)) {
4919 for (let elem of value) {
4920 if (!Is2.string(elem) && !DocumentFilter.is(elem)) {
4926 DocumentSelector2.is = is;
4927 })(DocumentSelector = exports2.DocumentSelector || (exports2.DocumentSelector = {}));
4928 var RegistrationRequest;
4929 (function(RegistrationRequest2) {
4930 RegistrationRequest2.type = new messages_1.ProtocolRequestType("client/registerCapability");
4931 })(RegistrationRequest = exports2.RegistrationRequest || (exports2.RegistrationRequest = {}));
4932 var UnregistrationRequest;
4933 (function(UnregistrationRequest2) {
4934 UnregistrationRequest2.type = new messages_1.ProtocolRequestType("client/unregisterCapability");
4935 })(UnregistrationRequest = exports2.UnregistrationRequest || (exports2.UnregistrationRequest = {}));
4936 var ResourceOperationKind;
4937 (function(ResourceOperationKind2) {
4938 ResourceOperationKind2.Create = "create";
4939 ResourceOperationKind2.Rename = "rename";
4940 ResourceOperationKind2.Delete = "delete";
4941 })(ResourceOperationKind = exports2.ResourceOperationKind || (exports2.ResourceOperationKind = {}));
4942 var FailureHandlingKind;
4943 (function(FailureHandlingKind2) {
4944 FailureHandlingKind2.Abort = "abort";
4945 FailureHandlingKind2.Transactional = "transactional";
4946 FailureHandlingKind2.TextOnlyTransactional = "textOnlyTransactional";
4947 FailureHandlingKind2.Undo = "undo";
4948 })(FailureHandlingKind = exports2.FailureHandlingKind || (exports2.FailureHandlingKind = {}));
4949 var StaticRegistrationOptions;
4950 (function(StaticRegistrationOptions2) {
4951 function hasId(value) {
4952 const candidate = value;
4953 return candidate && Is2.string(candidate.id) && candidate.id.length > 0;
4955 StaticRegistrationOptions2.hasId = hasId;
4956 })(StaticRegistrationOptions = exports2.StaticRegistrationOptions || (exports2.StaticRegistrationOptions = {}));
4957 var TextDocumentRegistrationOptions;
4958 (function(TextDocumentRegistrationOptions2) {
4959 function is(value) {
4960 const candidate = value;
4961 return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));
4963 TextDocumentRegistrationOptions2.is = is;
4964 })(TextDocumentRegistrationOptions = exports2.TextDocumentRegistrationOptions || (exports2.TextDocumentRegistrationOptions = {}));
4965 var WorkDoneProgressOptions;
4966 (function(WorkDoneProgressOptions2) {
4967 function is(value) {
4968 const candidate = value;
4969 return Is2.objectLiteral(candidate) && (candidate.workDoneProgress === void 0 || Is2.boolean(candidate.workDoneProgress));
4971 WorkDoneProgressOptions2.is = is;
4972 function hasWorkDoneProgress(value) {
4973 const candidate = value;
4974 return candidate && Is2.boolean(candidate.workDoneProgress);
4976 WorkDoneProgressOptions2.hasWorkDoneProgress = hasWorkDoneProgress;
4977 })(WorkDoneProgressOptions = exports2.WorkDoneProgressOptions || (exports2.WorkDoneProgressOptions = {}));
4978 var InitializeRequest;
4979 (function(InitializeRequest2) {
4980 InitializeRequest2.type = new messages_1.ProtocolRequestType("initialize");
4981 })(InitializeRequest = exports2.InitializeRequest || (exports2.InitializeRequest = {}));
4982 var InitializeError;
4983 (function(InitializeError2) {
4984 InitializeError2.unknownProtocolVersion = 1;
4985 })(InitializeError = exports2.InitializeError || (exports2.InitializeError = {}));
4986 var InitializedNotification;
4987 (function(InitializedNotification2) {
4988 InitializedNotification2.type = new messages_1.ProtocolNotificationType("initialized");
4989 })(InitializedNotification = exports2.InitializedNotification || (exports2.InitializedNotification = {}));
4990 var ShutdownRequest;
4991 (function(ShutdownRequest2) {
4992 ShutdownRequest2.type = new messages_1.ProtocolRequestType0("shutdown");
4993 })(ShutdownRequest = exports2.ShutdownRequest || (exports2.ShutdownRequest = {}));
4994 var ExitNotification;
4995 (function(ExitNotification2) {
4996 ExitNotification2.type = new messages_1.ProtocolNotificationType0("exit");
4997 })(ExitNotification = exports2.ExitNotification || (exports2.ExitNotification = {}));
4998 var DidChangeConfigurationNotification;
4999 (function(DidChangeConfigurationNotification2) {
5000 DidChangeConfigurationNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeConfiguration");
5001 })(DidChangeConfigurationNotification = exports2.DidChangeConfigurationNotification || (exports2.DidChangeConfigurationNotification = {}));
5003 (function(MessageType2) {
5004 MessageType2.Error = 1;
5005 MessageType2.Warning = 2;
5006 MessageType2.Info = 3;
5007 MessageType2.Log = 4;
5008 })(MessageType = exports2.MessageType || (exports2.MessageType = {}));
5009 var ShowMessageNotification;
5010 (function(ShowMessageNotification2) {
5011 ShowMessageNotification2.type = new messages_1.ProtocolNotificationType("window/showMessage");
5012 })(ShowMessageNotification = exports2.ShowMessageNotification || (exports2.ShowMessageNotification = {}));
5013 var ShowMessageRequest;
5014 (function(ShowMessageRequest2) {
5015 ShowMessageRequest2.type = new messages_1.ProtocolRequestType("window/showMessageRequest");
5016 })(ShowMessageRequest = exports2.ShowMessageRequest || (exports2.ShowMessageRequest = {}));
5017 var LogMessageNotification;
5018 (function(LogMessageNotification2) {
5019 LogMessageNotification2.type = new messages_1.ProtocolNotificationType("window/logMessage");
5020 })(LogMessageNotification = exports2.LogMessageNotification || (exports2.LogMessageNotification = {}));
5021 var TelemetryEventNotification;
5022 (function(TelemetryEventNotification2) {
5023 TelemetryEventNotification2.type = new messages_1.ProtocolNotificationType("telemetry/event");
5024 })(TelemetryEventNotification = exports2.TelemetryEventNotification || (exports2.TelemetryEventNotification = {}));
5025 var TextDocumentSyncKind;
5026 (function(TextDocumentSyncKind2) {
5027 TextDocumentSyncKind2.None = 0;
5028 TextDocumentSyncKind2.Full = 1;
5029 TextDocumentSyncKind2.Incremental = 2;
5030 })(TextDocumentSyncKind = exports2.TextDocumentSyncKind || (exports2.TextDocumentSyncKind = {}));
5031 var DidOpenTextDocumentNotification;
5032 (function(DidOpenTextDocumentNotification2) {
5033 DidOpenTextDocumentNotification2.method = "textDocument/didOpen";
5034 DidOpenTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification2.method);
5035 })(DidOpenTextDocumentNotification = exports2.DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = {}));
5036 var TextDocumentContentChangeEvent;
5037 (function(TextDocumentContentChangeEvent2) {
5038 function isIncremental(event) {
5039 let candidate = event;
5040 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
5042 TextDocumentContentChangeEvent2.isIncremental = isIncremental;
5043 function isFull(event) {
5044 let candidate = event;
5045 return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
5047 TextDocumentContentChangeEvent2.isFull = isFull;
5048 })(TextDocumentContentChangeEvent = exports2.TextDocumentContentChangeEvent || (exports2.TextDocumentContentChangeEvent = {}));
5049 var DidChangeTextDocumentNotification;
5050 (function(DidChangeTextDocumentNotification2) {
5051 DidChangeTextDocumentNotification2.method = "textDocument/didChange";
5052 DidChangeTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification2.method);
5053 })(DidChangeTextDocumentNotification = exports2.DidChangeTextDocumentNotification || (exports2.DidChangeTextDocumentNotification = {}));
5054 var DidCloseTextDocumentNotification;
5055 (function(DidCloseTextDocumentNotification2) {
5056 DidCloseTextDocumentNotification2.method = "textDocument/didClose";
5057 DidCloseTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification2.method);
5058 })(DidCloseTextDocumentNotification = exports2.DidCloseTextDocumentNotification || (exports2.DidCloseTextDocumentNotification = {}));
5059 var DidSaveTextDocumentNotification;
5060 (function(DidSaveTextDocumentNotification2) {
5061 DidSaveTextDocumentNotification2.method = "textDocument/didSave";
5062 DidSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification2.method);
5063 })(DidSaveTextDocumentNotification = exports2.DidSaveTextDocumentNotification || (exports2.DidSaveTextDocumentNotification = {}));
5064 var TextDocumentSaveReason;
5065 (function(TextDocumentSaveReason2) {
5066 TextDocumentSaveReason2.Manual = 1;
5067 TextDocumentSaveReason2.AfterDelay = 2;
5068 TextDocumentSaveReason2.FocusOut = 3;
5069 })(TextDocumentSaveReason = exports2.TextDocumentSaveReason || (exports2.TextDocumentSaveReason = {}));
5070 var WillSaveTextDocumentNotification;
5071 (function(WillSaveTextDocumentNotification2) {
5072 WillSaveTextDocumentNotification2.method = "textDocument/willSave";
5073 WillSaveTextDocumentNotification2.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification2.method);
5074 })(WillSaveTextDocumentNotification = exports2.WillSaveTextDocumentNotification || (exports2.WillSaveTextDocumentNotification = {}));
5075 var WillSaveTextDocumentWaitUntilRequest;
5076 (function(WillSaveTextDocumentWaitUntilRequest2) {
5077 WillSaveTextDocumentWaitUntilRequest2.method = "textDocument/willSaveWaitUntil";
5078 WillSaveTextDocumentWaitUntilRequest2.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest2.method);
5079 })(WillSaveTextDocumentWaitUntilRequest = exports2.WillSaveTextDocumentWaitUntilRequest || (exports2.WillSaveTextDocumentWaitUntilRequest = {}));
5080 var DidChangeWatchedFilesNotification;
5081 (function(DidChangeWatchedFilesNotification2) {
5082 DidChangeWatchedFilesNotification2.type = new messages_1.ProtocolNotificationType("workspace/didChangeWatchedFiles");
5083 })(DidChangeWatchedFilesNotification = exports2.DidChangeWatchedFilesNotification || (exports2.DidChangeWatchedFilesNotification = {}));
5085 (function(FileChangeType2) {
5086 FileChangeType2.Created = 1;
5087 FileChangeType2.Changed = 2;
5088 FileChangeType2.Deleted = 3;
5089 })(FileChangeType = exports2.FileChangeType || (exports2.FileChangeType = {}));
5091 (function(WatchKind2) {
5092 WatchKind2.Create = 1;
5093 WatchKind2.Change = 2;
5094 WatchKind2.Delete = 4;
5095 })(WatchKind = exports2.WatchKind || (exports2.WatchKind = {}));
5096 var PublishDiagnosticsNotification;
5097 (function(PublishDiagnosticsNotification2) {
5098 PublishDiagnosticsNotification2.type = new messages_1.ProtocolNotificationType("textDocument/publishDiagnostics");
5099 })(PublishDiagnosticsNotification = exports2.PublishDiagnosticsNotification || (exports2.PublishDiagnosticsNotification = {}));
5100 var CompletionTriggerKind;
5101 (function(CompletionTriggerKind2) {
5102 CompletionTriggerKind2.Invoked = 1;
5103 CompletionTriggerKind2.TriggerCharacter = 2;
5104 CompletionTriggerKind2.TriggerForIncompleteCompletions = 3;
5105 })(CompletionTriggerKind = exports2.CompletionTriggerKind || (exports2.CompletionTriggerKind = {}));
5106 var CompletionRequest;
5107 (function(CompletionRequest2) {
5108 CompletionRequest2.method = "textDocument/completion";
5109 CompletionRequest2.type = new messages_1.ProtocolRequestType(CompletionRequest2.method);
5110 })(CompletionRequest = exports2.CompletionRequest || (exports2.CompletionRequest = {}));
5111 var CompletionResolveRequest;
5112 (function(CompletionResolveRequest2) {
5113 CompletionResolveRequest2.method = "completionItem/resolve";
5114 CompletionResolveRequest2.type = new messages_1.ProtocolRequestType(CompletionResolveRequest2.method);
5115 })(CompletionResolveRequest = exports2.CompletionResolveRequest || (exports2.CompletionResolveRequest = {}));
5117 (function(HoverRequest2) {
5118 HoverRequest2.method = "textDocument/hover";
5119 HoverRequest2.type = new messages_1.ProtocolRequestType(HoverRequest2.method);
5120 })(HoverRequest = exports2.HoverRequest || (exports2.HoverRequest = {}));
5121 var SignatureHelpTriggerKind;
5122 (function(SignatureHelpTriggerKind2) {
5123 SignatureHelpTriggerKind2.Invoked = 1;
5124 SignatureHelpTriggerKind2.TriggerCharacter = 2;
5125 SignatureHelpTriggerKind2.ContentChange = 3;
5126 })(SignatureHelpTriggerKind = exports2.SignatureHelpTriggerKind || (exports2.SignatureHelpTriggerKind = {}));
5127 var SignatureHelpRequest;
5128 (function(SignatureHelpRequest2) {
5129 SignatureHelpRequest2.method = "textDocument/signatureHelp";
5130 SignatureHelpRequest2.type = new messages_1.ProtocolRequestType(SignatureHelpRequest2.method);
5131 })(SignatureHelpRequest = exports2.SignatureHelpRequest || (exports2.SignatureHelpRequest = {}));
5132 var DefinitionRequest;
5133 (function(DefinitionRequest2) {
5134 DefinitionRequest2.method = "textDocument/definition";
5135 DefinitionRequest2.type = new messages_1.ProtocolRequestType(DefinitionRequest2.method);
5136 })(DefinitionRequest = exports2.DefinitionRequest || (exports2.DefinitionRequest = {}));
5137 var ReferencesRequest;
5138 (function(ReferencesRequest2) {
5139 ReferencesRequest2.method = "textDocument/references";
5140 ReferencesRequest2.type = new messages_1.ProtocolRequestType(ReferencesRequest2.method);
5141 })(ReferencesRequest = exports2.ReferencesRequest || (exports2.ReferencesRequest = {}));
5142 var DocumentHighlightRequest;
5143 (function(DocumentHighlightRequest2) {
5144 DocumentHighlightRequest2.method = "textDocument/documentHighlight";
5145 DocumentHighlightRequest2.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest2.method);
5146 })(DocumentHighlightRequest = exports2.DocumentHighlightRequest || (exports2.DocumentHighlightRequest = {}));
5147 var DocumentSymbolRequest;
5148 (function(DocumentSymbolRequest2) {
5149 DocumentSymbolRequest2.method = "textDocument/documentSymbol";
5150 DocumentSymbolRequest2.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest2.method);
5151 })(DocumentSymbolRequest = exports2.DocumentSymbolRequest || (exports2.DocumentSymbolRequest = {}));
5152 var CodeActionRequest;
5153 (function(CodeActionRequest2) {
5154 CodeActionRequest2.method = "textDocument/codeAction";
5155 CodeActionRequest2.type = new messages_1.ProtocolRequestType(CodeActionRequest2.method);
5156 })(CodeActionRequest = exports2.CodeActionRequest || (exports2.CodeActionRequest = {}));
5157 var CodeActionResolveRequest;
5158 (function(CodeActionResolveRequest2) {
5159 CodeActionResolveRequest2.method = "codeAction/resolve";
5160 CodeActionResolveRequest2.type = new messages_1.ProtocolRequestType(CodeActionResolveRequest2.method);
5161 })(CodeActionResolveRequest = exports2.CodeActionResolveRequest || (exports2.CodeActionResolveRequest = {}));
5162 var WorkspaceSymbolRequest;
5163 (function(WorkspaceSymbolRequest2) {
5164 WorkspaceSymbolRequest2.method = "workspace/symbol";
5165 WorkspaceSymbolRequest2.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest2.method);
5166 })(WorkspaceSymbolRequest = exports2.WorkspaceSymbolRequest || (exports2.WorkspaceSymbolRequest = {}));
5167 var CodeLensRequest;
5168 (function(CodeLensRequest2) {
5169 CodeLensRequest2.method = "textDocument/codeLens";
5170 CodeLensRequest2.type = new messages_1.ProtocolRequestType(CodeLensRequest2.method);
5171 })(CodeLensRequest = exports2.CodeLensRequest || (exports2.CodeLensRequest = {}));
5172 var CodeLensResolveRequest;
5173 (function(CodeLensResolveRequest2) {
5174 CodeLensResolveRequest2.method = "codeLens/resolve";
5175 CodeLensResolveRequest2.type = new messages_1.ProtocolRequestType(CodeLensResolveRequest2.method);
5176 })(CodeLensResolveRequest = exports2.CodeLensResolveRequest || (exports2.CodeLensResolveRequest = {}));
5177 var CodeLensRefreshRequest;
5178 (function(CodeLensRefreshRequest2) {
5179 CodeLensRefreshRequest2.method = `workspace/codeLens/refresh`;
5180 CodeLensRefreshRequest2.type = new messages_1.ProtocolRequestType0(CodeLensRefreshRequest2.method);
5181 })(CodeLensRefreshRequest = exports2.CodeLensRefreshRequest || (exports2.CodeLensRefreshRequest = {}));
5182 var DocumentLinkRequest;
5183 (function(DocumentLinkRequest2) {
5184 DocumentLinkRequest2.method = "textDocument/documentLink";
5185 DocumentLinkRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkRequest2.method);
5186 })(DocumentLinkRequest = exports2.DocumentLinkRequest || (exports2.DocumentLinkRequest = {}));
5187 var DocumentLinkResolveRequest;
5188 (function(DocumentLinkResolveRequest2) {
5189 DocumentLinkResolveRequest2.method = "documentLink/resolve";
5190 DocumentLinkResolveRequest2.type = new messages_1.ProtocolRequestType(DocumentLinkResolveRequest2.method);
5191 })(DocumentLinkResolveRequest = exports2.DocumentLinkResolveRequest || (exports2.DocumentLinkResolveRequest = {}));
5192 var DocumentFormattingRequest;
5193 (function(DocumentFormattingRequest2) {
5194 DocumentFormattingRequest2.method = "textDocument/formatting";
5195 DocumentFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest2.method);
5196 })(DocumentFormattingRequest = exports2.DocumentFormattingRequest || (exports2.DocumentFormattingRequest = {}));
5197 var DocumentRangeFormattingRequest;
5198 (function(DocumentRangeFormattingRequest2) {
5199 DocumentRangeFormattingRequest2.method = "textDocument/rangeFormatting";
5200 DocumentRangeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest2.method);
5201 })(DocumentRangeFormattingRequest = exports2.DocumentRangeFormattingRequest || (exports2.DocumentRangeFormattingRequest = {}));
5202 var DocumentOnTypeFormattingRequest;
5203 (function(DocumentOnTypeFormattingRequest2) {
5204 DocumentOnTypeFormattingRequest2.method = "textDocument/onTypeFormatting";
5205 DocumentOnTypeFormattingRequest2.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest2.method);
5206 })(DocumentOnTypeFormattingRequest = exports2.DocumentOnTypeFormattingRequest || (exports2.DocumentOnTypeFormattingRequest = {}));
5207 var PrepareSupportDefaultBehavior;
5208 (function(PrepareSupportDefaultBehavior2) {
5209 PrepareSupportDefaultBehavior2.Identifier = 1;
5210 })(PrepareSupportDefaultBehavior = exports2.PrepareSupportDefaultBehavior || (exports2.PrepareSupportDefaultBehavior = {}));
5212 (function(RenameRequest2) {
5213 RenameRequest2.method = "textDocument/rename";
5214 RenameRequest2.type = new messages_1.ProtocolRequestType(RenameRequest2.method);
5215 })(RenameRequest = exports2.RenameRequest || (exports2.RenameRequest = {}));
5216 var PrepareRenameRequest;
5217 (function(PrepareRenameRequest2) {
5218 PrepareRenameRequest2.method = "textDocument/prepareRename";
5219 PrepareRenameRequest2.type = new messages_1.ProtocolRequestType(PrepareRenameRequest2.method);
5220 })(PrepareRenameRequest = exports2.PrepareRenameRequest || (exports2.PrepareRenameRequest = {}));
5221 var ExecuteCommandRequest;
5222 (function(ExecuteCommandRequest2) {
5223 ExecuteCommandRequest2.type = new messages_1.ProtocolRequestType("workspace/executeCommand");
5224 })(ExecuteCommandRequest = exports2.ExecuteCommandRequest || (exports2.ExecuteCommandRequest = {}));
5225 var ApplyWorkspaceEditRequest;
5226 (function(ApplyWorkspaceEditRequest2) {
5227 ApplyWorkspaceEditRequest2.type = new messages_1.ProtocolRequestType("workspace/applyEdit");
5228 })(ApplyWorkspaceEditRequest = exports2.ApplyWorkspaceEditRequest || (exports2.ApplyWorkspaceEditRequest = {}));
5232 // node_modules/vscode-languageserver-protocol/lib/common/connection.js
5233 var require_connection2 = __commonJS({
5234 "node_modules/vscode-languageserver-protocol/lib/common/connection.js"(exports2) {
5236 Object.defineProperty(exports2, "__esModule", { value: true });
5237 exports2.createProtocolConnection = void 0;
5238 var vscode_jsonrpc_1 = require_main();
5239 function createProtocolConnection(input, output, logger, options) {
5240 if (vscode_jsonrpc_1.ConnectionStrategy.is(options)) {
5241 options = { connectionStrategy: options };
5243 return vscode_jsonrpc_1.createMessageConnection(input, output, logger, options);
5245 exports2.createProtocolConnection = createProtocolConnection;
5249 // node_modules/vscode-languageserver-protocol/lib/common/api.js
5250 var require_api2 = __commonJS({
5251 "node_modules/vscode-languageserver-protocol/lib/common/api.js"(exports2) {
5253 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
5256 Object.defineProperty(o, k2, { enumerable: true, get: function() {
5259 } : function(o, m, k, k2) {
5264 var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
5266 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
5267 __createBinding(exports3, m, p);
5269 Object.defineProperty(exports2, "__esModule", { value: true });
5270 exports2.LSPErrorCodes = exports2.createProtocolConnection = void 0;
5271 __exportStar(require_main(), exports2);
5272 __exportStar((init_main(), main_exports), exports2);
5273 __exportStar(require_messages2(), exports2);
5274 __exportStar(require_protocol(), exports2);
5275 var connection_1 = require_connection2();
5276 Object.defineProperty(exports2, "createProtocolConnection", { enumerable: true, get: function() {
5277 return connection_1.createProtocolConnection;
5280 (function(LSPErrorCodes2) {
5281 LSPErrorCodes2.lspReservedErrorRangeStart = -32899;
5282 LSPErrorCodes2.ContentModified = -32801;
5283 LSPErrorCodes2.RequestCancelled = -32800;
5284 LSPErrorCodes2.lspReservedErrorRangeEnd = -32800;
5285 })(LSPErrorCodes = exports2.LSPErrorCodes || (exports2.LSPErrorCodes = {}));
5289 // node_modules/vscode-languageserver-protocol/lib/node/main.js
5290 var require_main2 = __commonJS({
5291 "node_modules/vscode-languageserver-protocol/lib/node/main.js"(exports2) {
5293 var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
5296 Object.defineProperty(o, k2, { enumerable: true, get: function() {
5299 } : function(o, m, k, k2) {
5304 var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
5306 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
5307 __createBinding(exports3, m, p);
5309 Object.defineProperty(exports2, "__esModule", { value: true });
5310 exports2.createProtocolConnection = void 0;
5311 var node_1 = require_node();
5312 __exportStar(require_node(), exports2);
5313 __exportStar(require_api2(), exports2);
5314 function createProtocolConnection(input, output, logger, options) {
5315 return node_1.createMessageConnection(input, output, logger, options);
5317 exports2.createProtocolConnection = createProtocolConnection;
5321 // node_modules/event-target-shim/dist/event-target-shim.js
5322 var require_event_target_shim = __commonJS({
5323 "node_modules/event-target-shim/dist/event-target-shim.js"(exports2, module2) {
5325 Object.defineProperty(exports2, "__esModule", { value: true });
5326 var privateData = new WeakMap();
5327 var wrappers = new WeakMap();
5328 function pd(event) {
5329 const retv = privateData.get(event);
5330 console.assert(retv != null, "'this' is expected an Event object, but got", event);
5333 function setCancelFlag(data) {
5334 if (data.passiveListener != null) {
5335 if (typeof console !== "undefined" && typeof console.error === "function") {
5336 console.error("Unable to preventDefault inside passive event listener invocation.", data.passiveListener);
5340 if (!data.event.cancelable) {
5343 data.canceled = true;
5344 if (typeof data.event.preventDefault === "function") {
5345 data.event.preventDefault();
5348 function Event2(eventTarget, event) {
5349 privateData.set(this, {
5353 currentTarget: eventTarget,
5356 immediateStopped: false,
5357 passiveListener: null,
5358 timeStamp: event.timeStamp || Date.now()
5360 Object.defineProperty(this, "isTrusted", { value: false, enumerable: true });
5361 const keys = Object.keys(event);
5362 for (let i = 0; i < keys.length; ++i) {
5363 const key = keys[i];
5364 if (!(key in this)) {
5365 Object.defineProperty(this, key, defineRedirectDescriptor(key));
5369 Event2.prototype = {
5371 return pd(this).event.type;
5374 return pd(this).eventTarget;
5376 get currentTarget() {
5377 return pd(this).currentTarget;
5380 const currentTarget = pd(this).currentTarget;
5381 if (currentTarget == null) {
5384 return [currentTarget];
5389 get CAPTURING_PHASE() {
5395 get BUBBLING_PHASE() {
5399 return pd(this).eventPhase;
5402 const data = pd(this);
5403 data.stopped = true;
5404 if (typeof data.event.stopPropagation === "function") {
5405 data.event.stopPropagation();
5408 stopImmediatePropagation() {
5409 const data = pd(this);
5410 data.stopped = true;
5411 data.immediateStopped = true;
5412 if (typeof data.event.stopImmediatePropagation === "function") {
5413 data.event.stopImmediatePropagation();
5417 return Boolean(pd(this).event.bubbles);
5420 return Boolean(pd(this).event.cancelable);
5423 setCancelFlag(pd(this));
5425 get defaultPrevented() {
5426 return pd(this).canceled;
5429 return Boolean(pd(this).event.composed);
5432 return pd(this).timeStamp;
5435 return pd(this).eventTarget;
5437 get cancelBubble() {
5438 return pd(this).stopped;
5440 set cancelBubble(value) {
5444 const data = pd(this);
5445 data.stopped = true;
5446 if (typeof data.event.cancelBubble === "boolean") {
5447 data.event.cancelBubble = true;
5451 return !pd(this).canceled;
5453 set returnValue(value) {
5455 setCancelFlag(pd(this));
5461 Object.defineProperty(Event2.prototype, "constructor", {
5466 if (typeof window !== "undefined" && typeof window.Event !== "undefined") {
5467 Object.setPrototypeOf(Event2.prototype, window.Event.prototype);
5468 wrappers.set(window.Event.prototype, Event2);
5470 function defineRedirectDescriptor(key) {
5473 return pd(this).event[key];
5476 pd(this).event[key] = value;
5482 function defineCallDescriptor(key) {
5485 const event = pd(this).event;
5486 return event[key].apply(event, arguments);
5492 function defineWrapper(BaseEvent, proto) {
5493 const keys = Object.keys(proto);
5494 if (keys.length === 0) {
5497 function CustomEvent2(eventTarget, event) {
5498 BaseEvent.call(this, eventTarget, event);
5500 CustomEvent2.prototype = Object.create(BaseEvent.prototype, {
5501 constructor: { value: CustomEvent2, configurable: true, writable: true }
5503 for (let i = 0; i < keys.length; ++i) {
5504 const key = keys[i];
5505 if (!(key in BaseEvent.prototype)) {
5506 const descriptor = Object.getOwnPropertyDescriptor(proto, key);
5507 const isFunc = typeof descriptor.value === "function";
5508 Object.defineProperty(CustomEvent2.prototype, key, isFunc ? defineCallDescriptor(key) : defineRedirectDescriptor(key));
5511 return CustomEvent2;
5513 function getWrapper(proto) {
5514 if (proto == null || proto === Object.prototype) {
5517 let wrapper = wrappers.get(proto);
5518 if (wrapper == null) {
5519 wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto);
5520 wrappers.set(proto, wrapper);
5524 function wrapEvent(eventTarget, event) {
5525 const Wrapper = getWrapper(Object.getPrototypeOf(event));
5526 return new Wrapper(eventTarget, event);
5528 function isStopped(event) {
5529 return pd(event).immediateStopped;
5531 function setEventPhase(event, eventPhase) {
5532 pd(event).eventPhase = eventPhase;
5534 function setCurrentTarget(event, currentTarget) {
5535 pd(event).currentTarget = currentTarget;
5537 function setPassiveListener(event, passiveListener) {
5538 pd(event).passiveListener = passiveListener;
5540 var listenersMap = new WeakMap();
5544 function isObject2(x) {
5545 return x !== null && typeof x === "object";
5547 function getListeners(eventTarget) {
5548 const listeners = listenersMap.get(eventTarget);
5549 if (listeners == null) {
5550 throw new TypeError("'this' is expected an EventTarget object, but got another value.");
5554 function defineEventAttributeDescriptor(eventName) {
5557 const listeners = getListeners(this);
5558 let node = listeners.get(eventName);
5559 while (node != null) {
5560 if (node.listenerType === ATTRIBUTE) {
5561 return node.listener;
5568 if (typeof listener !== "function" && !isObject2(listener)) {
5571 const listeners = getListeners(this);
5573 let node = listeners.get(eventName);
5574 while (node != null) {
5575 if (node.listenerType === ATTRIBUTE) {
5576 if (prev !== null) {
5577 prev.next = node.next;
5578 } else if (node.next !== null) {
5579 listeners.set(eventName, node.next);
5581 listeners.delete(eventName);
5588 if (listener !== null) {
5591 listenerType: ATTRIBUTE,
5596 if (prev === null) {
5597 listeners.set(eventName, newNode);
5599 prev.next = newNode;
5607 function defineEventAttribute(eventTargetPrototype, eventName) {
5608 Object.defineProperty(eventTargetPrototype, `on${eventName}`, defineEventAttributeDescriptor(eventName));
5610 function defineCustomEventTarget(eventNames) {
5611 function CustomEventTarget() {
5612 EventTarget.call(this);
5614 CustomEventTarget.prototype = Object.create(EventTarget.prototype, {
5616 value: CustomEventTarget,
5621 for (let i = 0; i < eventNames.length; ++i) {
5622 defineEventAttribute(CustomEventTarget.prototype, eventNames[i]);
5624 return CustomEventTarget;
5626 function EventTarget() {
5627 if (this instanceof EventTarget) {
5628 listenersMap.set(this, new Map());
5631 if (arguments.length === 1 && Array.isArray(arguments[0])) {
5632 return defineCustomEventTarget(arguments[0]);
5634 if (arguments.length > 0) {
5635 const types = new Array(arguments.length);
5636 for (let i = 0; i < arguments.length; ++i) {
5637 types[i] = arguments[i];
5639 return defineCustomEventTarget(types);
5641 throw new TypeError("Cannot call a class as a function");
5643 EventTarget.prototype = {
5644 addEventListener(eventName, listener, options) {
5645 if (listener == null) {
5648 if (typeof listener !== "function" && !isObject2(listener)) {
5649 throw new TypeError("'listener' should be a function or an object.");
5651 const listeners = getListeners(this);
5652 const optionsIsObj = isObject2(options);
5653 const capture = optionsIsObj ? Boolean(options.capture) : Boolean(options);
5654 const listenerType = capture ? CAPTURE : BUBBLE;
5658 passive: optionsIsObj && Boolean(options.passive),
5659 once: optionsIsObj && Boolean(options.once),
5662 let node = listeners.get(eventName);
5663 if (node === void 0) {
5664 listeners.set(eventName, newNode);
5668 while (node != null) {
5669 if (node.listener === listener && node.listenerType === listenerType) {
5675 prev.next = newNode;
5677 removeEventListener(eventName, listener, options) {
5678 if (listener == null) {
5681 const listeners = getListeners(this);
5682 const capture = isObject2(options) ? Boolean(options.capture) : Boolean(options);
5683 const listenerType = capture ? CAPTURE : BUBBLE;
5685 let node = listeners.get(eventName);
5686 while (node != null) {
5687 if (node.listener === listener && node.listenerType === listenerType) {
5688 if (prev !== null) {
5689 prev.next = node.next;
5690 } else if (node.next !== null) {
5691 listeners.set(eventName, node.next);
5693 listeners.delete(eventName);
5701 dispatchEvent(event) {
5702 if (event == null || typeof event.type !== "string") {
5703 throw new TypeError('"event.type" should be a string.');
5705 const listeners = getListeners(this);
5706 const eventName = event.type;
5707 let node = listeners.get(eventName);
5711 const wrappedEvent = wrapEvent(this, event);
5713 while (node != null) {
5715 if (prev !== null) {
5716 prev.next = node.next;
5717 } else if (node.next !== null) {
5718 listeners.set(eventName, node.next);
5720 listeners.delete(eventName);
5725 setPassiveListener(wrappedEvent, node.passive ? node.listener : null);
5726 if (typeof node.listener === "function") {
5728 node.listener.call(this, wrappedEvent);
5730 if (typeof console !== "undefined" && typeof console.error === "function") {
5734 } else if (node.listenerType !== ATTRIBUTE && typeof node.listener.handleEvent === "function") {
5735 node.listener.handleEvent(wrappedEvent);
5737 if (isStopped(wrappedEvent)) {
5742 setPassiveListener(wrappedEvent, null);
5743 setEventPhase(wrappedEvent, 0);
5744 setCurrentTarget(wrappedEvent, null);
5745 return !wrappedEvent.defaultPrevented;
5748 Object.defineProperty(EventTarget.prototype, "constructor", {
5753 if (typeof window !== "undefined" && typeof window.EventTarget !== "undefined") {
5754 Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype);
5756 exports2.defineEventAttribute = defineEventAttribute;
5757 exports2.EventTarget = EventTarget;
5758 exports2.default = EventTarget;
5759 module2.exports = EventTarget;
5760 module2.exports.EventTarget = module2.exports["default"] = EventTarget;
5761 module2.exports.defineEventAttribute = defineEventAttribute;
5765 // node_modules/abort-controller/dist/abort-controller.js
5766 var require_abort_controller = __commonJS({
5767 "node_modules/abort-controller/dist/abort-controller.js"(exports2, module2) {
5769 Object.defineProperty(exports2, "__esModule", { value: true });
5770 var eventTargetShim = require_event_target_shim();
5771 var AbortSignal = class extends eventTargetShim.EventTarget {
5774 throw new TypeError("AbortSignal cannot be constructed directly");
5777 const aborted = abortedFlags.get(this);
5778 if (typeof aborted !== "boolean") {
5779 throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`);
5784 eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort");
5785 function createAbortSignal() {
5786 const signal = Object.create(AbortSignal.prototype);
5787 eventTargetShim.EventTarget.call(signal);
5788 abortedFlags.set(signal, false);
5791 function abortSignal(signal) {
5792 if (abortedFlags.get(signal) !== false) {
5795 abortedFlags.set(signal, true);
5796 signal.dispatchEvent({ type: "abort" });
5798 var abortedFlags = new WeakMap();
5799 Object.defineProperties(AbortSignal.prototype, {
5800 aborted: { enumerable: true }
5802 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
5803 Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, {
5805 value: "AbortSignal"
5808 var AbortController = class {
5810 signals.set(this, createAbortSignal());
5813 return getSignal(this);
5816 abortSignal(getSignal(this));
5819 var signals = new WeakMap();
5820 function getSignal(controller) {
5821 const signal = signals.get(controller);
5822 if (signal == null) {
5823 throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`);
5827 Object.defineProperties(AbortController.prototype, {
5828 signal: { enumerable: true },
5829 abort: { enumerable: true }
5831 if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") {
5832 Object.defineProperty(AbortController.prototype, Symbol.toStringTag, {
5834 value: "AbortController"
5837 exports2.AbortController = AbortController;
5838 exports2.AbortSignal = AbortSignal;
5839 exports2.default = AbortController;
5840 module2.exports = AbortController;
5841 module2.exports.AbortController = module2.exports["default"] = AbortController;
5842 module2.exports.AbortSignal = AbortSignal;
5846 // node_modules/node-fetch/lib/index.mjs
5847 var lib_exports = {};
5848 __export(lib_exports, {
5849 FetchError: () => FetchError,
5850 Headers: () => Headers,
5851 Request: () => Request,
5852 Response: () => Response,
5853 default: () => lib_default
5855 function FetchError(message, type, systemError) {
5856 Error.call(this, message);
5857 this.message = message;
5860 this.code = this.errno = systemError.code;
5862 Error.captureStackTrace(this, this.constructor);
5864 function Body(body) {
5866 var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
5867 let size = _ref$size === void 0 ? 0 : _ref$size;
5868 var _ref$timeout = _ref.timeout;
5869 let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
5872 } else if (isURLSearchParams(body)) {
5873 body = Buffer.from(body.toString());
5874 } else if (isBlob(body))
5876 else if (Buffer.isBuffer(body))
5878 else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
5879 body = Buffer.from(body);
5880 } else if (ArrayBuffer.isView(body)) {
5881 body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
5882 } else if (body instanceof import_stream.default)
5885 body = Buffer.from(String(body));
5893 this.timeout = timeout;
5894 if (body instanceof import_stream.default) {
5895 body.on("error", function(err) {
5896 const error = err.name === "AbortError" ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, "system", err);
5897 _this[INTERNALS].error = error;
5901 function consumeBody() {
5903 if (this[INTERNALS].disturbed) {
5904 return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`));
5906 this[INTERNALS].disturbed = true;
5907 if (this[INTERNALS].error) {
5908 return Body.Promise.reject(this[INTERNALS].error);
5910 let body = this.body;
5911 if (body === null) {
5912 return Body.Promise.resolve(Buffer.alloc(0));
5915 body = body.stream();
5917 if (Buffer.isBuffer(body)) {
5918 return Body.Promise.resolve(body);
5920 if (!(body instanceof import_stream.default)) {
5921 return Body.Promise.resolve(Buffer.alloc(0));
5926 return new Body.Promise(function(resolve, reject) {
5928 if (_this4.timeout) {
5929 resTimeout = setTimeout(function() {
5931 reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, "body-timeout"));
5934 body.on("error", function(err) {
5935 if (err.name === "AbortError") {
5939 reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, "system", err));
5942 body.on("data", function(chunk) {
5943 if (abort || chunk === null) {
5946 if (_this4.size && accumBytes + chunk.length > _this4.size) {
5948 reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, "max-size"));
5951 accumBytes += chunk.length;
5954 body.on("end", function() {
5958 clearTimeout(resTimeout);
5960 resolve(Buffer.concat(accum, accumBytes));
5962 reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, "system", err));
5967 function convertBody(buffer, headers) {
5968 if (typeof convert !== "function") {
5969 throw new Error("The package `encoding` must be installed to use the textConverted() function");
5971 const ct = headers.get("content-type");
5972 let charset = "utf-8";
5975 res = /charset=([^;]*)/i.exec(ct);
5977 str = buffer.slice(0, 1024).toString();
5979 res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str);
5982 res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
5984 res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
5990 res = /charset=(.*)/i.exec(res.pop());
5994 res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str);
5997 charset = res.pop();
5998 if (charset === "gb2312" || charset === "gbk") {
5999 charset = "gb18030";
6002 return convert(buffer, "UTF-8", charset).toString();
6004 function isURLSearchParams(obj2) {
6005 if (typeof obj2 !== "object" || typeof obj2.append !== "function" || typeof obj2.delete !== "function" || typeof obj2.get !== "function" || typeof obj2.getAll !== "function" || typeof obj2.has !== "function" || typeof obj2.set !== "function") {
6008 return obj2.constructor.name === "URLSearchParams" || Object.prototype.toString.call(obj2) === "[object URLSearchParams]" || typeof obj2.sort === "function";
6010 function isBlob(obj2) {
6011 return typeof obj2 === "object" && typeof obj2.arrayBuffer === "function" && typeof obj2.type === "string" && typeof obj2.stream === "function" && typeof obj2.constructor === "function" && typeof obj2.constructor.name === "string" && /^(Blob|File)$/.test(obj2.constructor.name) && /^(Blob|File)$/.test(obj2[Symbol.toStringTag]);
6013 function clone(instance) {
6015 let body = instance.body;
6016 if (instance.bodyUsed) {
6017 throw new Error("cannot clone body after it is used");
6019 if (body instanceof import_stream.default && typeof body.getBoundary !== "function") {
6020 p1 = new PassThrough();
6021 p2 = new PassThrough();
6024 instance[INTERNALS].body = p1;
6029 function extractContentType(body) {
6030 if (body === null) {
6032 } else if (typeof body === "string") {
6033 return "text/plain;charset=UTF-8";
6034 } else if (isURLSearchParams(body)) {
6035 return "application/x-www-form-urlencoded;charset=UTF-8";
6036 } else if (isBlob(body)) {
6037 return body.type || null;
6038 } else if (Buffer.isBuffer(body)) {
6040 } else if (Object.prototype.toString.call(body) === "[object ArrayBuffer]") {
6042 } else if (ArrayBuffer.isView(body)) {
6044 } else if (typeof body.getBoundary === "function") {
6045 return `multipart/form-data;boundary=${body.getBoundary()}`;
6046 } else if (body instanceof import_stream.default) {
6049 return "text/plain;charset=UTF-8";
6052 function getTotalBytes(instance) {
6053 const body = instance.body;
6054 if (body === null) {
6056 } else if (isBlob(body)) {
6058 } else if (Buffer.isBuffer(body)) {
6060 } else if (body && typeof body.getLengthSync === "function") {
6061 if (body._lengthRetrievers && body._lengthRetrievers.length == 0 || body.hasKnownLength && body.hasKnownLength()) {
6062 return body.getLengthSync();
6069 function writeToStream(dest, instance) {
6070 const body = instance.body;
6071 if (body === null) {
6073 } else if (isBlob(body)) {
6074 body.stream().pipe(dest);
6075 } else if (Buffer.isBuffer(body)) {
6082 function validateName(name) {
6084 if (invalidTokenRegex.test(name) || name === "") {
6085 throw new TypeError(`${name} is not a legal HTTP header name`);
6088 function validateValue(value) {
6090 if (invalidHeaderCharRegex.test(value)) {
6091 throw new TypeError(`${value} is not a legal HTTP header value`);
6094 function find(map, name) {
6095 name = name.toLowerCase();
6096 for (const key in map) {
6097 if (key.toLowerCase() === name) {
6103 function getHeaders(headers) {
6104 let kind = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "key+value";
6105 const keys = Object.keys(headers[MAP]).sort();
6106 return keys.map(kind === "key" ? function(k) {
6107 return k.toLowerCase();
6108 } : kind === "value" ? function(k) {
6109 return headers[MAP][k].join(", ");
6111 return [k.toLowerCase(), headers[MAP][k].join(", ")];
6114 function createHeadersIterator(target, kind) {
6115 const iterator = Object.create(HeadersIteratorPrototype);
6116 iterator[INTERNAL] = {
6123 function exportNodeCompatibleHeaders(headers) {
6124 const obj2 = Object.assign({ __proto__: null }, headers[MAP]);
6125 const hostHeaderKey = find(headers[MAP], "Host");
6126 if (hostHeaderKey !== void 0) {
6127 obj2[hostHeaderKey] = obj2[hostHeaderKey][0];
6131 function createHeadersLenient(obj2) {
6132 const headers = new Headers();
6133 for (const name of Object.keys(obj2)) {
6134 if (invalidTokenRegex.test(name)) {
6137 if (Array.isArray(obj2[name])) {
6138 for (const val of obj2[name]) {
6139 if (invalidHeaderCharRegex.test(val)) {
6142 if (headers[MAP][name] === void 0) {
6143 headers[MAP][name] = [val];
6145 headers[MAP][name].push(val);
6148 } else if (!invalidHeaderCharRegex.test(obj2[name])) {
6149 headers[MAP][name] = [obj2[name]];
6154 function isRequest(input) {
6155 return typeof input === "object" && typeof input[INTERNALS$2] === "object";
6157 function isAbortSignal(signal) {
6158 const proto = signal && typeof signal === "object" && Object.getPrototypeOf(signal);
6159 return !!(proto && proto.constructor.name === "AbortSignal");
6161 function getNodeRequestOptions(request) {
6162 const parsedURL = request[INTERNALS$2].parsedURL;
6163 const headers = new Headers(request[INTERNALS$2].headers);
6164 if (!headers.has("Accept")) {
6165 headers.set("Accept", "*/*");
6167 if (!parsedURL.protocol || !parsedURL.hostname) {
6168 throw new TypeError("Only absolute URLs are supported");
6170 if (!/^https?:$/.test(parsedURL.protocol)) {
6171 throw new TypeError("Only HTTP(S) protocols are supported");
6173 if (request.signal && request.body instanceof import_stream.default.Readable && !streamDestructionSupported) {
6174 throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");
6176 let contentLengthValue = null;
6177 if (request.body == null && /^(POST|PUT)$/i.test(request.method)) {
6178 contentLengthValue = "0";
6180 if (request.body != null) {
6181 const totalBytes = getTotalBytes(request);
6182 if (typeof totalBytes === "number") {
6183 contentLengthValue = String(totalBytes);
6186 if (contentLengthValue) {
6187 headers.set("Content-Length", contentLengthValue);
6189 if (!headers.has("User-Agent")) {
6190 headers.set("User-Agent", "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)");
6192 if (request.compress && !headers.has("Accept-Encoding")) {
6193 headers.set("Accept-Encoding", "gzip,deflate");
6195 let agent = request.agent;
6196 if (typeof agent === "function") {
6197 agent = agent(parsedURL);
6199 if (!headers.has("Connection") && !agent) {
6200 headers.set("Connection", "close");
6202 return Object.assign({}, parsedURL, {
6203 method: request.method,
6204 headers: exportNodeCompatibleHeaders(headers),
6208 function AbortError(message) {
6209 Error.call(this, message);
6210 this.type = "aborted";
6211 this.message = message;
6212 Error.captureStackTrace(this, this.constructor);
6214 function fetch(url, opts) {
6215 if (!fetch.Promise) {
6216 throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
6218 Body.Promise = fetch.Promise;
6219 return new fetch.Promise(function(resolve, reject) {
6220 const request = new Request(url, opts);
6221 const options = getNodeRequestOptions(request);
6222 const send = (options.protocol === "https:" ? import_https.default : import_http.default).request;
6223 const signal = request.signal;
6224 let response = null;
6225 const abort = function abort2() {
6226 let error = new AbortError("The user aborted a request.");
6228 if (request.body && request.body instanceof import_stream.default.Readable) {
6229 request.body.destroy(error);
6231 if (!response || !response.body)
6233 response.body.emit("error", error);
6235 if (signal && signal.aborted) {
6239 const abortAndFinalize = function abortAndFinalize2() {
6243 const req = send(options);
6246 signal.addEventListener("abort", abortAndFinalize);
6248 function finalize() {
6251 signal.removeEventListener("abort", abortAndFinalize);
6252 clearTimeout(reqTimeout);
6254 if (request.timeout) {
6255 req.once("socket", function(socket) {
6256 reqTimeout = setTimeout(function() {
6257 reject(new FetchError(`network timeout at: ${request.url}`, "request-timeout"));
6259 }, request.timeout);
6262 req.on("error", function(err) {
6263 reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, "system", err));
6266 req.on("response", function(res) {
6267 clearTimeout(reqTimeout);
6268 const headers = createHeadersLenient(res.headers);
6269 if (fetch.isRedirect(res.statusCode)) {
6270 const location = headers.get("Location");
6271 const locationURL = location === null ? null : resolve_url(request.url, location);
6272 switch (request.redirect) {
6274 reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
6278 if (locationURL !== null) {
6280 headers.set("Location", locationURL);
6287 if (locationURL === null) {
6290 if (request.counter >= request.follow) {
6291 reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
6295 const requestOpts = {
6296 headers: new Headers(request.headers),
6297 follow: request.follow,
6298 counter: request.counter + 1,
6299 agent: request.agent,
6300 compress: request.compress,
6301 method: request.method,
6303 signal: request.signal,
6304 timeout: request.timeout,
6307 if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
6308 reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
6312 if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === "POST") {
6313 requestOpts.method = "GET";
6314 requestOpts.body = void 0;
6315 requestOpts.headers.delete("content-length");
6317 resolve(fetch(new Request(locationURL, requestOpts)));
6322 res.once("end", function() {
6324 signal.removeEventListener("abort", abortAndFinalize);
6326 let body = res.pipe(new PassThrough$1());
6327 const response_options = {
6329 status: res.statusCode,
6330 statusText: res.statusMessage,
6333 timeout: request.timeout,
6334 counter: request.counter
6336 const codings = headers.get("Content-Encoding");
6337 if (!request.compress || request.method === "HEAD" || codings === null || res.statusCode === 204 || res.statusCode === 304) {
6338 response = new Response(body, response_options);
6342 const zlibOptions = {
6343 flush: import_zlib.default.Z_SYNC_FLUSH,
6344 finishFlush: import_zlib.default.Z_SYNC_FLUSH
6346 if (codings == "gzip" || codings == "x-gzip") {
6347 body = body.pipe(import_zlib.default.createGunzip(zlibOptions));
6348 response = new Response(body, response_options);
6352 if (codings == "deflate" || codings == "x-deflate") {
6353 const raw = res.pipe(new PassThrough$1());
6354 raw.once("data", function(chunk) {
6355 if ((chunk[0] & 15) === 8) {
6356 body = body.pipe(import_zlib.default.createInflate());
6358 body = body.pipe(import_zlib.default.createInflateRaw());
6360 response = new Response(body, response_options);
6365 if (codings == "br" && typeof import_zlib.default.createBrotliDecompress === "function") {
6366 body = body.pipe(import_zlib.default.createBrotliDecompress());
6367 response = new Response(body, response_options);
6371 response = new Response(body, response_options);
6374 writeToStream(req, request);
6377 var import_stream, import_http, import_url, import_https, import_zlib, Readable, BUFFER, TYPE, Blob, convert, INTERNALS, PassThrough, invalidTokenRegex, invalidHeaderCharRegex, MAP, Headers, INTERNAL, HeadersIteratorPrototype, INTERNALS$1, STATUS_CODES, Response, INTERNALS$2, parse_url, format_url, streamDestructionSupported, Request, PassThrough$1, resolve_url, lib_default;
6378 var init_lib = __esm({
6379 "node_modules/node-fetch/lib/index.mjs"() {
6380 import_stream = __toModule(require("stream"));
6381 import_http = __toModule(require("http"));
6382 import_url = __toModule(require("url"));
6383 import_https = __toModule(require("https"));
6384 import_zlib = __toModule(require("zlib"));
6385 Readable = import_stream.default.Readable;
6386 BUFFER = Symbol("buffer");
6387 TYPE = Symbol("type");
6391 const blobParts = arguments[0];
6392 const options = arguments[1];
6396 const a = blobParts;
6397 const length = Number(a.length);
6398 for (let i = 0; i < length; i++) {
6399 const element = a[i];
6401 if (element instanceof Buffer) {
6403 } else if (ArrayBuffer.isView(element)) {
6404 buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
6405 } else if (element instanceof ArrayBuffer) {
6406 buffer = Buffer.from(element);
6407 } else if (element instanceof Blob) {
6408 buffer = element[BUFFER];
6410 buffer = Buffer.from(typeof element === "string" ? element : String(element));
6412 size += buffer.length;
6413 buffers.push(buffer);
6416 this[BUFFER] = Buffer.concat(buffers);
6417 let type = options && options.type !== void 0 && String(options.type).toLowerCase();
6418 if (type && !/[^\u0020-\u007E]/.test(type)) {
6423 return this[BUFFER].length;
6429 return Promise.resolve(this[BUFFER].toString());
6432 const buf = this[BUFFER];
6433 const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
6434 return Promise.resolve(ab);
6437 const readable = new Readable();
6438 readable._read = function() {
6440 readable.push(this[BUFFER]);
6441 readable.push(null);
6445 return "[object Blob]";
6448 const size = this.size;
6449 const start = arguments[0];
6450 const end = arguments[1];
6451 let relativeStart, relativeEnd;
6452 if (start === void 0) {
6454 } else if (start < 0) {
6455 relativeStart = Math.max(size + start, 0);
6457 relativeStart = Math.min(start, size);
6459 if (end === void 0) {
6461 } else if (end < 0) {
6462 relativeEnd = Math.max(size + end, 0);
6464 relativeEnd = Math.min(end, size);
6466 const span = Math.max(relativeEnd - relativeStart, 0);
6467 const buffer = this[BUFFER];
6468 const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
6469 const blob = new Blob([], { type: arguments[2] });
6470 blob[BUFFER] = slicedBuffer;
6474 Object.defineProperties(Blob.prototype, {
6475 size: { enumerable: true },
6476 type: { enumerable: true },
6477 slice: { enumerable: true }
6479 Object.defineProperty(Blob.prototype, Symbol.toStringTag, {
6485 FetchError.prototype = Object.create(Error.prototype);
6486 FetchError.prototype.constructor = FetchError;
6487 FetchError.prototype.name = "FetchError";
6489 convert = require("encoding").convert;
6492 INTERNALS = Symbol("Body internals");
6493 PassThrough = import_stream.default.PassThrough;
6496 return this[INTERNALS].body;
6499 return this[INTERNALS].disturbed;
6502 return consumeBody.call(this).then(function(buf) {
6503 return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
6507 let ct = this.headers && this.headers.get("content-type") || "";
6508 return consumeBody.call(this).then(function(buf) {
6509 return Object.assign(new Blob([], {
6510 type: ct.toLowerCase()
6518 return consumeBody.call(this).then(function(buffer) {
6520 return JSON.parse(buffer.toString());
6522 return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, "invalid-json"));
6527 return consumeBody.call(this).then(function(buffer) {
6528 return buffer.toString();
6532 return consumeBody.call(this);
6536 return consumeBody.call(this).then(function(buffer) {
6537 return convertBody(buffer, _this3.headers);
6541 Object.defineProperties(Body.prototype, {
6542 body: { enumerable: true },
6543 bodyUsed: { enumerable: true },
6544 arrayBuffer: { enumerable: true },
6545 blob: { enumerable: true },
6546 json: { enumerable: true },
6547 text: { enumerable: true }
6549 Body.mixIn = function(proto) {
6550 for (const name of Object.getOwnPropertyNames(Body.prototype)) {
6551 if (!(name in proto)) {
6552 const desc = Object.getOwnPropertyDescriptor(Body.prototype, name);
6553 Object.defineProperty(proto, name, desc);
6557 Body.Promise = global.Promise;
6558 invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/;
6559 invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/;
6560 MAP = Symbol("map");
6563 let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
6564 this[MAP] = Object.create(null);
6565 if (init instanceof Headers) {
6566 const rawHeaders = init.raw();
6567 const headerNames = Object.keys(rawHeaders);
6568 for (const headerName of headerNames) {
6569 for (const value of rawHeaders[headerName]) {
6570 this.append(headerName, value);
6577 else if (typeof init === "object") {
6578 const method = init[Symbol.iterator];
6579 if (method != null) {
6580 if (typeof method !== "function") {
6581 throw new TypeError("Header pairs must be iterable");
6584 for (const pair of init) {
6585 if (typeof pair !== "object" || typeof pair[Symbol.iterator] !== "function") {
6586 throw new TypeError("Each header pair must be iterable");
6588 pairs.push(Array.from(pair));
6590 for (const pair of pairs) {
6591 if (pair.length !== 2) {
6592 throw new TypeError("Each header pair must be a name/value tuple");
6594 this.append(pair[0], pair[1]);
6597 for (const key of Object.keys(init)) {
6598 const value = init[key];
6599 this.append(key, value);
6603 throw new TypeError("Provided initializer must be an object");
6609 const key = find(this[MAP], name);
6610 if (key === void 0) {
6613 return this[MAP][key].join(", ");
6616 let thisArg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : void 0;
6617 let pairs = getHeaders(this);
6619 while (i < pairs.length) {
6620 var _pairs$i = pairs[i];
6621 const name = _pairs$i[0], value = _pairs$i[1];
6622 callback.call(thisArg, value, name, this);
6623 pairs = getHeaders(this);
6631 validateValue(value);
6632 const key = find(this[MAP], name);
6633 this[MAP][key !== void 0 ? key : name] = [value];
6635 append(name, value) {
6639 validateValue(value);
6640 const key = find(this[MAP], name);
6641 if (key !== void 0) {
6642 this[MAP][key].push(value);
6644 this[MAP][name] = [value];
6650 return find(this[MAP], name) !== void 0;
6655 const key = find(this[MAP], name);
6656 if (key !== void 0) {
6657 delete this[MAP][key];
6664 return createHeadersIterator(this, "key");
6667 return createHeadersIterator(this, "value");
6669 [Symbol.iterator]() {
6670 return createHeadersIterator(this, "key+value");
6673 Headers.prototype.entries = Headers.prototype[Symbol.iterator];
6674 Object.defineProperty(Headers.prototype, Symbol.toStringTag, {
6680 Object.defineProperties(Headers.prototype, {
6681 get: { enumerable: true },
6682 forEach: { enumerable: true },
6683 set: { enumerable: true },
6684 append: { enumerable: true },
6685 has: { enumerable: true },
6686 delete: { enumerable: true },
6687 keys: { enumerable: true },
6688 values: { enumerable: true },
6689 entries: { enumerable: true }
6691 INTERNAL = Symbol("internal");
6692 HeadersIteratorPrototype = Object.setPrototypeOf({
6694 if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) {
6695 throw new TypeError("Value of `this` is not a HeadersIterator");
6697 var _INTERNAL = this[INTERNAL];
6698 const target = _INTERNAL.target, kind = _INTERNAL.kind, index = _INTERNAL.index;
6699 const values = getHeaders(target, kind);
6700 const len = values.length;
6707 this[INTERNAL].index = index + 1;
6709 value: values[index],
6713 }, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));
6714 Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, {
6715 value: "HeadersIterator",
6720 INTERNALS$1 = Symbol("Response internals");
6721 STATUS_CODES = import_http.default.STATUS_CODES;
6724 let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
6725 let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6726 Body.call(this, body, opts);
6727 const status = opts.status || 200;
6728 const headers = new Headers(opts.headers);
6729 if (body != null && !headers.has("Content-Type")) {
6730 const contentType = extractContentType(body);
6732 headers.append("Content-Type", contentType);
6735 this[INTERNALS$1] = {
6738 statusText: opts.statusText || STATUS_CODES[status],
6740 counter: opts.counter
6744 return this[INTERNALS$1].url || "";
6747 return this[INTERNALS$1].status;
6750 return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300;
6753 return this[INTERNALS$1].counter > 0;
6756 return this[INTERNALS$1].statusText;
6759 return this[INTERNALS$1].headers;
6762 return new Response(clone(this), {
6764 status: this.status,
6765 statusText: this.statusText,
6766 headers: this.headers,
6768 redirected: this.redirected
6772 Body.mixIn(Response.prototype);
6773 Object.defineProperties(Response.prototype, {
6774 url: { enumerable: true },
6775 status: { enumerable: true },
6776 ok: { enumerable: true },
6777 redirected: { enumerable: true },
6778 statusText: { enumerable: true },
6779 headers: { enumerable: true },
6780 clone: { enumerable: true }
6782 Object.defineProperty(Response.prototype, Symbol.toStringTag, {
6788 INTERNALS$2 = Symbol("Request internals");
6789 parse_url = import_url.default.parse;
6790 format_url = import_url.default.format;
6791 streamDestructionSupported = "destroy" in import_stream.default.Readable.prototype;
6793 constructor(input) {
6794 let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
6796 if (!isRequest(input)) {
6797 if (input && input.href) {
6798 parsedURL = parse_url(input.href);
6800 parsedURL = parse_url(`${input}`);
6804 parsedURL = parse_url(input.url);
6806 let method = init.method || input.method || "GET";
6807 method = method.toUpperCase();
6808 if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
6809 throw new TypeError("Request with GET/HEAD method cannot have body");
6811 let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
6812 Body.call(this, inputBody, {
6813 timeout: init.timeout || input.timeout || 0,
6814 size: init.size || input.size || 0
6816 const headers = new Headers(init.headers || input.headers || {});
6817 if (inputBody != null && !headers.has("Content-Type")) {
6818 const contentType = extractContentType(inputBody);
6820 headers.append("Content-Type", contentType);
6823 let signal = isRequest(input) ? input.signal : null;
6824 if ("signal" in init)
6825 signal = init.signal;
6826 if (signal != null && !isAbortSignal(signal)) {
6827 throw new TypeError("Expected signal to be an instanceof AbortSignal");
6829 this[INTERNALS$2] = {
6831 redirect: init.redirect || input.redirect || "follow",
6836 this.follow = init.follow !== void 0 ? init.follow : input.follow !== void 0 ? input.follow : 20;
6837 this.compress = init.compress !== void 0 ? init.compress : input.compress !== void 0 ? input.compress : true;
6838 this.counter = init.counter || input.counter || 0;
6839 this.agent = init.agent || input.agent;
6842 return this[INTERNALS$2].method;
6845 return format_url(this[INTERNALS$2].parsedURL);
6848 return this[INTERNALS$2].headers;
6851 return this[INTERNALS$2].redirect;
6854 return this[INTERNALS$2].signal;
6857 return new Request(this);
6860 Body.mixIn(Request.prototype);
6861 Object.defineProperty(Request.prototype, Symbol.toStringTag, {
6867 Object.defineProperties(Request.prototype, {
6868 method: { enumerable: true },
6869 url: { enumerable: true },
6870 headers: { enumerable: true },
6871 redirect: { enumerable: true },
6872 clone: { enumerable: true },
6873 signal: { enumerable: true }
6875 AbortError.prototype = Object.create(Error.prototype);
6876 AbortError.prototype.constructor = AbortError;
6877 AbortError.prototype.name = "AbortError";
6878 PassThrough$1 = import_stream.default.PassThrough;
6879 resolve_url = import_url.default.resolve;
6880 fetch.isRedirect = function(code) {
6881 return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
6883 fetch.Promise = global.Promise;
6884 lib_default = fetch;
6888 // node_modules/picomatch/lib/constants.js
6889 var require_constants = __commonJS({
6890 "node_modules/picomatch/lib/constants.js"(exports2, module2) {
6892 var path2 = require("path");
6893 var WIN_SLASH = "\\\\/";
6894 var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
6895 var DOT_LITERAL = "\\.";
6896 var PLUS_LITERAL = "\\+";
6897 var QMARK_LITERAL = "\\?";
6898 var SLASH_LITERAL = "\\/";
6899 var ONE_CHAR = "(?=.)";
6901 var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
6902 var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
6903 var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
6904 var NO_DOT = `(?!${DOT_LITERAL})`;
6905 var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
6906 var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
6907 var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
6908 var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
6909 var STAR = `${QMARK}*?`;
6927 var WINDOWS_CHARS = __spreadProps(__spreadValues({}, POSIX_CHARS), {
6928 SLASH_LITERAL: `[${WIN_SLASH}]`,
6929 QMARK: WIN_NO_SLASH,
6930 STAR: `${WIN_NO_SLASH}*?`,
6931 DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
6932 NO_DOT: `(?!${DOT_LITERAL})`,
6933 NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
6934 NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
6935 NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
6936 QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
6937 START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
6938 END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
6940 var POSIX_REGEX_SOURCE = {
6943 ascii: "\\x00-\\x7F",
6945 cntrl: "\\x00-\\x1F\\x7F",
6947 graph: "\\x21-\\x7E",
6949 print: "\\x20-\\x7E ",
6950 punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
6951 space: " \\t\\r\\n\\v\\f",
6957 MAX_LENGTH: 1024 * 64,
6959 REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
6960 REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
6961 REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
6962 REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
6963 REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
6964 REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
6972 CHAR_UPPERCASE_A: 65,
6973 CHAR_LOWERCASE_A: 97,
6974 CHAR_UPPERCASE_Z: 90,
6975 CHAR_LOWERCASE_Z: 122,
6976 CHAR_LEFT_PARENTHESES: 40,
6977 CHAR_RIGHT_PARENTHESES: 41,
6981 CHAR_BACKWARD_SLASH: 92,
6982 CHAR_CARRIAGE_RETURN: 13,
6983 CHAR_CIRCUMFLEX_ACCENT: 94,
6987 CHAR_DOUBLE_QUOTE: 34,
6989 CHAR_EXCLAMATION_MARK: 33,
6991 CHAR_FORWARD_SLASH: 47,
6992 CHAR_GRAVE_ACCENT: 96,
6994 CHAR_HYPHEN_MINUS: 45,
6995 CHAR_LEFT_ANGLE_BRACKET: 60,
6996 CHAR_LEFT_CURLY_BRACE: 123,
6997 CHAR_LEFT_SQUARE_BRACKET: 91,
6999 CHAR_NO_BREAK_SPACE: 160,
7002 CHAR_QUESTION_MARK: 63,
7003 CHAR_RIGHT_ANGLE_BRACKET: 62,
7004 CHAR_RIGHT_CURLY_BRACE: 125,
7005 CHAR_RIGHT_SQUARE_BRACKET: 93,
7007 CHAR_SINGLE_QUOTE: 39,
7010 CHAR_UNDERSCORE: 95,
7011 CHAR_VERTICAL_LINE: 124,
7012 CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
7014 extglobChars(chars) {
7016 "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
7017 "?": { type: "qmark", open: "(?:", close: ")?" },
7018 "+": { type: "plus", open: "(?:", close: ")+" },
7019 "*": { type: "star", open: "(?:", close: ")*" },
7020 "@": { type: "at", open: "(?:", close: ")" }
7024 return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
7030 // node_modules/picomatch/lib/utils.js
7031 var require_utils = __commonJS({
7032 "node_modules/picomatch/lib/utils.js"(exports2) {
7034 var path2 = require("path");
7035 var win32 = process.platform === "win32";
7038 REGEX_REMOVE_BACKSLASH,
7039 REGEX_SPECIAL_CHARS,
7040 REGEX_SPECIAL_CHARS_GLOBAL
7041 } = require_constants();
7042 exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
7043 exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
7044 exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
7045 exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
7046 exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
7047 exports2.removeBackslashes = (str) => {
7048 return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
7049 return match === "\\" ? "" : match;
7052 exports2.supportsLookbehinds = () => {
7053 const segs = process.version.slice(1).split(".").map(Number);
7054 if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
7059 exports2.isWindows = (options) => {
7060 if (options && typeof options.windows === "boolean") {
7061 return options.windows;
7063 return win32 === true || path2.sep === "\\";
7065 exports2.escapeLast = (input, char, lastIdx) => {
7066 const idx = input.lastIndexOf(char, lastIdx);
7069 if (input[idx - 1] === "\\")
7070 return exports2.escapeLast(input, char, idx - 1);
7071 return `${input.slice(0, idx)}\\${input.slice(idx)}`;
7073 exports2.removePrefix = (input, state = {}) => {
7075 if (output.startsWith("./")) {
7076 output = output.slice(2);
7077 state.prefix = "./";
7081 exports2.wrapOutput = (input, state = {}, options = {}) => {
7082 const prepend = options.contains ? "" : "^";
7083 const append = options.contains ? "" : "$";
7084 let output = `${prepend}(?:${input})${append}`;
7085 if (state.negated === true) {
7086 output = `(?:^(?!${output}).*$)`;
7093 // node_modules/picomatch/lib/scan.js
7094 var require_scan = __commonJS({
7095 "node_modules/picomatch/lib/scan.js"(exports2, module2) {
7097 var utils = require_utils();
7101 CHAR_BACKWARD_SLASH,
7104 CHAR_EXCLAMATION_MARK,
7106 CHAR_LEFT_CURLY_BRACE,
7107 CHAR_LEFT_PARENTHESES,
7108 CHAR_LEFT_SQUARE_BRACKET,
7111 CHAR_RIGHT_CURLY_BRACE,
7112 CHAR_RIGHT_PARENTHESES,
7113 CHAR_RIGHT_SQUARE_BRACKET
7114 } = require_constants();
7115 var isPathSeparator = (code) => {
7116 return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
7118 var depth = (token) => {
7119 if (token.isPrefix !== true) {
7120 token.depth = token.isGlobstar ? Infinity : 1;
7123 var scan = (input, options) => {
7124 const opts = options || {};
7125 const length = input.length - 1;
7126 const scanToEnd = opts.parts === true || opts.scanToEnd === true;
7134 let isBrace = false;
7135 let isBracket = false;
7137 let isExtglob = false;
7138 let isGlobstar = false;
7139 let braceEscaped = false;
7140 let backslashes = false;
7141 let negated = false;
7142 let negatedExtglob = false;
7143 let finished = false;
7147 let token = { value: "", depth: 0, isGlob: false };
7148 const eos = () => index >= length;
7149 const peek = () => str.charCodeAt(index + 1);
7150 const advance = () => {
7152 return str.charCodeAt(++index);
7154 while (index < length) {
7157 if (code === CHAR_BACKWARD_SLASH) {
7158 backslashes = token.backslashes = true;
7160 if (code === CHAR_LEFT_CURLY_BRACE) {
7161 braceEscaped = true;
7165 if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
7167 while (eos() !== true && (code = advance())) {
7168 if (code === CHAR_BACKWARD_SLASH) {
7169 backslashes = token.backslashes = true;
7173 if (code === CHAR_LEFT_CURLY_BRACE) {
7177 if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
7178 isBrace = token.isBrace = true;
7179 isGlob = token.isGlob = true;
7181 if (scanToEnd === true) {
7186 if (braceEscaped !== true && code === CHAR_COMMA) {
7187 isBrace = token.isBrace = true;
7188 isGlob = token.isGlob = true;
7190 if (scanToEnd === true) {
7195 if (code === CHAR_RIGHT_CURLY_BRACE) {
7198 braceEscaped = false;
7199 isBrace = token.isBrace = true;
7205 if (scanToEnd === true) {
7210 if (code === CHAR_FORWARD_SLASH) {
7211 slashes.push(index);
7213 token = { value: "", depth: 0, isGlob: false };
7214 if (finished === true)
7216 if (prev === CHAR_DOT && index === start + 1) {
7220 lastIndex = index + 1;
7223 if (opts.noext !== true) {
7224 const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
7225 if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
7226 isGlob = token.isGlob = true;
7227 isExtglob = token.isExtglob = true;
7229 if (code === CHAR_EXCLAMATION_MARK && index === start) {
7230 negatedExtglob = true;
7232 if (scanToEnd === true) {
7233 while (eos() !== true && (code = advance())) {
7234 if (code === CHAR_BACKWARD_SLASH) {
7235 backslashes = token.backslashes = true;
7239 if (code === CHAR_RIGHT_PARENTHESES) {
7240 isGlob = token.isGlob = true;
7250 if (code === CHAR_ASTERISK) {
7251 if (prev === CHAR_ASTERISK)
7252 isGlobstar = token.isGlobstar = true;
7253 isGlob = token.isGlob = true;
7255 if (scanToEnd === true) {
7260 if (code === CHAR_QUESTION_MARK) {
7261 isGlob = token.isGlob = true;
7263 if (scanToEnd === true) {
7268 if (code === CHAR_LEFT_SQUARE_BRACKET) {
7269 while (eos() !== true && (next = advance())) {
7270 if (next === CHAR_BACKWARD_SLASH) {
7271 backslashes = token.backslashes = true;
7275 if (next === CHAR_RIGHT_SQUARE_BRACKET) {
7276 isBracket = token.isBracket = true;
7277 isGlob = token.isGlob = true;
7282 if (scanToEnd === true) {
7287 if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
7288 negated = token.negated = true;
7292 if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
7293 isGlob = token.isGlob = true;
7294 if (scanToEnd === true) {
7295 while (eos() !== true && (code = advance())) {
7296 if (code === CHAR_LEFT_PARENTHESES) {
7297 backslashes = token.backslashes = true;
7301 if (code === CHAR_RIGHT_PARENTHESES) {
7310 if (isGlob === true) {
7312 if (scanToEnd === true) {
7318 if (opts.noext === true) {
7326 prefix = str.slice(0, start);
7327 str = str.slice(start);
7330 if (base && isGlob === true && lastIndex > 0) {
7331 base = str.slice(0, lastIndex);
7332 glob = str.slice(lastIndex);
7333 } else if (isGlob === true) {
7339 if (base && base !== "" && base !== "/" && base !== str) {
7340 if (isPathSeparator(base.charCodeAt(base.length - 1))) {
7341 base = base.slice(0, -1);
7344 if (opts.unescape === true) {
7346 glob = utils.removeBackslashes(glob);
7347 if (base && backslashes === true) {
7348 base = utils.removeBackslashes(base);
7365 if (opts.tokens === true) {
7367 if (!isPathSeparator(code)) {
7370 state.tokens = tokens;
7372 if (opts.parts === true || opts.tokens === true) {
7374 for (let idx = 0; idx < slashes.length; idx++) {
7375 const n = prevIndex ? prevIndex + 1 : start;
7376 const i = slashes[idx];
7377 const value = input.slice(n, i);
7379 if (idx === 0 && start !== 0) {
7380 tokens[idx].isPrefix = true;
7381 tokens[idx].value = prefix;
7383 tokens[idx].value = value;
7386 state.maxDepth += tokens[idx].depth;
7388 if (idx !== 0 || value !== "") {
7393 if (prevIndex && prevIndex + 1 < input.length) {
7394 const value = input.slice(prevIndex + 1);
7397 tokens[tokens.length - 1].value = value;
7398 depth(tokens[tokens.length - 1]);
7399 state.maxDepth += tokens[tokens.length - 1].depth;
7402 state.slashes = slashes;
7403 state.parts = parts;
7407 module2.exports = scan;
7411 // node_modules/picomatch/lib/parse.js
7412 var require_parse = __commonJS({
7413 "node_modules/picomatch/lib/parse.js"(exports2, module2) {
7415 var constants = require_constants();
7416 var utils = require_utils();
7420 REGEX_NON_SPECIAL_CHARS,
7421 REGEX_SPECIAL_CHARS_BACKREF,
7424 var expandRange = (args, options) => {
7425 if (typeof options.expandRange === "function") {
7426 return options.expandRange(...args, options);
7429 const value = `[${args.join("-")}]`;
7433 return args.map((v) => utils.escapeRegex(v)).join("..");
7437 var syntaxError = (type, char) => {
7438 return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
7440 var parse = (input, options) => {
7441 if (typeof input !== "string") {
7442 throw new TypeError("Expected a string");
7444 input = REPLACEMENTS[input] || input;
7445 const opts = __spreadValues({}, options);
7446 const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
7447 let len = input.length;
7449 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
7451 const bos = { type: "bos", value: "", output: opts.prepend || "" };
7452 const tokens = [bos];
7453 const capture = opts.capture ? "" : "?:";
7454 const win32 = utils.isWindows(options);
7455 const PLATFORM_CHARS = constants.globChars(win32);
7456 const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
7471 const globstar = (opts2) => {
7472 return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
7474 const nodot = opts.dot ? "" : NO_DOT;
7475 const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
7476 let star = opts.bash === true ? globstar(opts) : STAR;
7480 if (typeof opts.noext === "boolean") {
7481 opts.noextglob = opts.noext;
7487 dot: opts.dot === true,
7500 input = utils.removePrefix(input, state);
7502 const extglobs = [];
7507 const eos = () => state.index === len - 1;
7508 const peek = state.peek = (n = 1) => input[state.index + n];
7509 const advance = state.advance = () => input[++state.index] || "";
7510 const remaining = () => input.slice(state.index + 1);
7511 const consume = (value2 = "", num = 0) => {
7512 state.consumed += value2;
7515 const append = (token) => {
7516 state.output += token.output != null ? token.output : token.value;
7517 consume(token.value);
7519 const negate = () => {
7521 while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
7526 if (count % 2 === 0) {
7529 state.negated = true;
7533 const increment = (type) => {
7537 const decrement = (type) => {
7541 const push = (tok) => {
7542 if (prev.type === "globstar") {
7543 const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
7544 const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
7545 if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
7546 state.output = state.output.slice(0, -prev.output.length);
7550 state.output += prev.output;
7553 if (extglobs.length && tok.type !== "paren") {
7554 extglobs[extglobs.length - 1].inner += tok.value;
7556 if (tok.value || tok.output)
7558 if (prev && prev.type === "text" && tok.type === "text") {
7559 prev.value += tok.value;
7560 prev.output = (prev.output || "") + tok.value;
7567 const extglobOpen = (type, value2) => {
7568 const token = __spreadProps(__spreadValues({}, EXTGLOB_CHARS[value2]), { conditions: 1, inner: "" });
7570 token.parens = state.parens;
7571 token.output = state.output;
7572 const output = (opts.capture ? "(" : "") + token.open;
7573 increment("parens");
7574 push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
7575 push({ type: "paren", extglob: true, value: advance(), output });
7576 extglobs.push(token);
7578 const extglobClose = (token) => {
7579 let output = token.close + (opts.capture ? ")" : "");
7581 if (token.type === "negate") {
7582 let extglobStar = star;
7583 if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
7584 extglobStar = globstar(opts);
7586 if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
7587 output = token.close = `)$))${extglobStar}`;
7589 if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
7590 output = token.close = `)${rest})${extglobStar})`;
7592 if (token.prev.type === "bos") {
7593 state.negatedExtglob = true;
7596 push({ type: "paren", extglob: true, value, output });
7597 decrement("parens");
7599 if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
7600 let backslashes = false;
7601 let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
7602 if (first === "\\") {
7606 if (first === "?") {
7608 return esc + first + (rest ? QMARK.repeat(rest.length) : "");
7611 return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
7613 return QMARK.repeat(chars.length);
7615 if (first === ".") {
7616 return DOT_LITERAL.repeat(chars.length);
7618 if (first === "*") {
7620 return esc + first + (rest ? star : "");
7624 return esc ? m : `\\${m}`;
7626 if (backslashes === true) {
7627 if (opts.unescape === true) {
7628 output = output.replace(/\\/g, "");
7630 output = output.replace(/\\+/g, (m) => {
7631 return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
7635 if (output === input && opts.contains === true) {
7636 state.output = input;
7639 state.output = utils.wrapOutput(output, state, options);
7644 if (value === "\0") {
7647 if (value === "\\") {
7648 const next = peek();
7649 if (next === "/" && opts.bash !== true) {
7652 if (next === "." || next === ";") {
7657 push({ type: "text", value });
7660 const match = /^\\+/.exec(remaining());
7662 if (match && match[0].length > 2) {
7663 slashes = match[0].length;
7664 state.index += slashes;
7665 if (slashes % 2 !== 0) {
7669 if (opts.unescape === true) {
7674 if (state.brackets === 0) {
7675 push({ type: "text", value });
7679 if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
7680 if (opts.posix !== false && value === ":") {
7681 const inner = prev.value.slice(1);
7682 if (inner.includes("[")) {
7684 if (inner.includes(":")) {
7685 const idx = prev.value.lastIndexOf("[");
7686 const pre = prev.value.slice(0, idx);
7687 const rest2 = prev.value.slice(idx + 2);
7688 const posix = POSIX_REGEX_SOURCE[rest2];
7690 prev.value = pre + posix;
7691 state.backtrack = true;
7693 if (!bos.output && tokens.indexOf(prev) === 1) {
7694 bos.output = ONE_CHAR;
7701 if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
7702 value = `\\${value}`;
7704 if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
7705 value = `\\${value}`;
7707 if (opts.posix === true && value === "!" && prev.value === "[") {
7710 prev.value += value;
7714 if (state.quotes === 1 && value !== '"') {
7715 value = utils.escapeRegex(value);
7716 prev.value += value;
7720 if (value === '"') {
7721 state.quotes = state.quotes === 1 ? 0 : 1;
7722 if (opts.keepQuotes === true) {
7723 push({ type: "text", value });
7727 if (value === "(") {
7728 increment("parens");
7729 push({ type: "paren", value });
7732 if (value === ")") {
7733 if (state.parens === 0 && opts.strictBrackets === true) {
7734 throw new SyntaxError(syntaxError("opening", "("));
7736 const extglob = extglobs[extglobs.length - 1];
7737 if (extglob && state.parens === extglob.parens + 1) {
7738 extglobClose(extglobs.pop());
7741 push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
7742 decrement("parens");
7745 if (value === "[") {
7746 if (opts.nobracket === true || !remaining().includes("]")) {
7747 if (opts.nobracket !== true && opts.strictBrackets === true) {
7748 throw new SyntaxError(syntaxError("closing", "]"));
7750 value = `\\${value}`;
7752 increment("brackets");
7754 push({ type: "bracket", value });
7757 if (value === "]") {
7758 if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
7759 push({ type: "text", value, output: `\\${value}` });
7762 if (state.brackets === 0) {
7763 if (opts.strictBrackets === true) {
7764 throw new SyntaxError(syntaxError("opening", "["));
7766 push({ type: "text", value, output: `\\${value}` });
7769 decrement("brackets");
7770 const prevValue = prev.value.slice(1);
7771 if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
7772 value = `/${value}`;
7774 prev.value += value;
7776 if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
7779 const escaped = utils.escapeRegex(prev.value);
7780 state.output = state.output.slice(0, -prev.value.length);
7781 if (opts.literalBrackets === true) {
7782 state.output += escaped;
7783 prev.value = escaped;
7786 prev.value = `(${capture}${escaped}|${prev.value})`;
7787 state.output += prev.value;
7790 if (value === "{" && opts.nobrace !== true) {
7791 increment("braces");
7796 outputIndex: state.output.length,
7797 tokensIndex: state.tokens.length
7803 if (value === "}") {
7804 const brace = braces[braces.length - 1];
7805 if (opts.nobrace === true || !brace) {
7806 push({ type: "text", value, output: value });
7810 if (brace.dots === true) {
7811 const arr = tokens.slice();
7813 for (let i = arr.length - 1; i >= 0; i--) {
7815 if (arr[i].type === "brace") {
7818 if (arr[i].type !== "dots") {
7819 range.unshift(arr[i].value);
7822 output = expandRange(range, opts);
7823 state.backtrack = true;
7825 if (brace.comma !== true && brace.dots !== true) {
7826 const out = state.output.slice(0, brace.outputIndex);
7827 const toks = state.tokens.slice(brace.tokensIndex);
7828 brace.value = brace.output = "\\{";
7829 value = output = "\\}";
7831 for (const t of toks) {
7832 state.output += t.output || t.value;
7835 push({ type: "brace", value, output });
7836 decrement("braces");
7840 if (value === "|") {
7841 if (extglobs.length > 0) {
7842 extglobs[extglobs.length - 1].conditions++;
7844 push({ type: "text", value });
7847 if (value === ",") {
7849 const brace = braces[braces.length - 1];
7850 if (brace && stack[stack.length - 1] === "braces") {
7854 push({ type: "comma", value, output });
7857 if (value === "/") {
7858 if (prev.type === "dot" && state.index === state.start + 1) {
7859 state.start = state.index + 1;
7860 state.consumed = "";
7866 push({ type: "slash", value, output: SLASH_LITERAL });
7869 if (value === ".") {
7870 if (state.braces > 0 && prev.type === "dot") {
7871 if (prev.value === ".")
7872 prev.output = DOT_LITERAL;
7873 const brace = braces[braces.length - 1];
7875 prev.output += value;
7876 prev.value += value;
7880 if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
7881 push({ type: "text", value, output: DOT_LITERAL });
7884 push({ type: "dot", value, output: DOT_LITERAL });
7887 if (value === "?") {
7888 const isGroup = prev && prev.value === "(";
7889 if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7890 extglobOpen("qmark", value);
7893 if (prev && prev.type === "paren") {
7894 const next = peek();
7896 if (next === "<" && !utils.supportsLookbehinds()) {
7897 throw new Error("Node.js v10 or higher is required for regex lookbehinds");
7899 if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
7900 output = `\\${value}`;
7902 push({ type: "text", value, output });
7905 if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
7906 push({ type: "qmark", value, output: QMARK_NO_DOT });
7909 push({ type: "qmark", value, output: QMARK });
7912 if (value === "!") {
7913 if (opts.noextglob !== true && peek() === "(") {
7914 if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
7915 extglobOpen("negate", value);
7919 if (opts.nonegate !== true && state.index === 0) {
7924 if (value === "+") {
7925 if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7926 extglobOpen("plus", value);
7929 if (prev && prev.value === "(" || opts.regex === false) {
7930 push({ type: "plus", value, output: PLUS_LITERAL });
7933 if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
7934 push({ type: "plus", value });
7937 push({ type: "plus", value: PLUS_LITERAL });
7940 if (value === "@") {
7941 if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
7942 push({ type: "at", extglob: true, value, output: "" });
7945 push({ type: "text", value });
7948 if (value !== "*") {
7949 if (value === "$" || value === "^") {
7950 value = `\\${value}`;
7952 const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
7955 state.index += match[0].length;
7957 push({ type: "text", value });
7960 if (prev && (prev.type === "globstar" || prev.star === true)) {
7963 prev.value += value;
7965 state.backtrack = true;
7966 state.globstar = true;
7970 let rest = remaining();
7971 if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
7972 extglobOpen("star", value);
7975 if (prev.type === "star") {
7976 if (opts.noglobstar === true) {
7980 const prior = prev.prev;
7981 const before = prior.prev;
7982 const isStart = prior.type === "slash" || prior.type === "bos";
7983 const afterStar = before && (before.type === "star" || before.type === "globstar");
7984 if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
7985 push({ type: "star", value, output: "" });
7988 const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
7989 const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
7990 if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
7991 push({ type: "star", value, output: "" });
7994 while (rest.slice(0, 3) === "/**") {
7995 const after = input[state.index + 4];
7996 if (after && after !== "/") {
7999 rest = rest.slice(3);
8002 if (prior.type === "bos" && eos()) {
8003 prev.type = "globstar";
8004 prev.value += value;
8005 prev.output = globstar(opts);
8006 state.output = prev.output;
8007 state.globstar = true;
8011 if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
8012 state.output = state.output.slice(0, -(prior.output + prev.output).length);
8013 prior.output = `(?:${prior.output}`;
8014 prev.type = "globstar";
8015 prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
8016 prev.value += value;
8017 state.globstar = true;
8018 state.output += prior.output + prev.output;
8022 if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
8023 const end = rest[1] !== void 0 ? "|$" : "";
8024 state.output = state.output.slice(0, -(prior.output + prev.output).length);
8025 prior.output = `(?:${prior.output}`;
8026 prev.type = "globstar";
8027 prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
8028 prev.value += value;
8029 state.output += prior.output + prev.output;
8030 state.globstar = true;
8031 consume(value + advance());
8032 push({ type: "slash", value: "/", output: "" });
8035 if (prior.type === "bos" && rest[0] === "/") {
8036 prev.type = "globstar";
8037 prev.value += value;
8038 prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
8039 state.output = prev.output;
8040 state.globstar = true;
8041 consume(value + advance());
8042 push({ type: "slash", value: "/", output: "" });
8045 state.output = state.output.slice(0, -prev.output.length);
8046 prev.type = "globstar";
8047 prev.output = globstar(opts);
8048 prev.value += value;
8049 state.output += prev.output;
8050 state.globstar = true;
8054 const token = { type: "star", value, output: star };
8055 if (opts.bash === true) {
8056 token.output = ".*?";
8057 if (prev.type === "bos" || prev.type === "slash") {
8058 token.output = nodot + token.output;
8063 if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
8064 token.output = value;
8068 if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
8069 if (prev.type === "dot") {
8070 state.output += NO_DOT_SLASH;
8071 prev.output += NO_DOT_SLASH;
8072 } else if (opts.dot === true) {
8073 state.output += NO_DOTS_SLASH;
8074 prev.output += NO_DOTS_SLASH;
8076 state.output += nodot;
8077 prev.output += nodot;
8079 if (peek() !== "*") {
8080 state.output += ONE_CHAR;
8081 prev.output += ONE_CHAR;
8086 while (state.brackets > 0) {
8087 if (opts.strictBrackets === true)
8088 throw new SyntaxError(syntaxError("closing", "]"));
8089 state.output = utils.escapeLast(state.output, "[");
8090 decrement("brackets");
8092 while (state.parens > 0) {
8093 if (opts.strictBrackets === true)
8094 throw new SyntaxError(syntaxError("closing", ")"));
8095 state.output = utils.escapeLast(state.output, "(");
8096 decrement("parens");
8098 while (state.braces > 0) {
8099 if (opts.strictBrackets === true)
8100 throw new SyntaxError(syntaxError("closing", "}"));
8101 state.output = utils.escapeLast(state.output, "{");
8102 decrement("braces");
8104 if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
8105 push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
8107 if (state.backtrack === true) {
8109 for (const token of state.tokens) {
8110 state.output += token.output != null ? token.output : token.value;
8112 state.output += token.suffix;
8118 parse.fastpaths = (input, options) => {
8119 const opts = __spreadValues({}, options);
8120 const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
8121 const len = input.length;
8123 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
8125 input = REPLACEMENTS[input] || input;
8126 const win32 = utils.isWindows(options);
8137 } = constants.globChars(win32);
8138 const nodot = opts.dot ? NO_DOTS : NO_DOT;
8139 const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
8140 const capture = opts.capture ? "" : "?:";
8141 const state = { negated: false, prefix: "" };
8142 let star = opts.bash === true ? ".*?" : STAR;
8146 const globstar = (opts2) => {
8147 if (opts2.noglobstar === true)
8149 return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
8151 const create = (str) => {
8154 return `${nodot}${ONE_CHAR}${star}`;
8156 return `${DOT_LITERAL}${ONE_CHAR}${star}`;
8158 return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
8160 return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
8162 return nodot + globstar(opts);
8164 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
8166 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
8168 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
8170 const match = /^(.*?)\.(\w+)$/.exec(str);
8173 const source2 = create(match[1]);
8176 return source2 + DOT_LITERAL + match[2];
8180 const output = utils.removePrefix(input, state);
8181 let source = create(output);
8182 if (source && opts.strictSlashes !== true) {
8183 source += `${SLASH_LITERAL}?`;
8187 module2.exports = parse;
8191 // node_modules/picomatch/lib/picomatch.js
8192 var require_picomatch = __commonJS({
8193 "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
8195 var path2 = require("path");
8196 var scan = require_scan();
8197 var parse = require_parse();
8198 var utils = require_utils();
8199 var constants = require_constants();
8200 var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
8201 var picomatch = (glob, options, returnState = false) => {
8202 if (Array.isArray(glob)) {
8203 const fns = glob.map((input) => picomatch(input, options, returnState));
8204 const arrayMatcher = (str) => {
8205 for (const isMatch of fns) {
8206 const state2 = isMatch(str);
8212 return arrayMatcher;
8214 const isState = isObject2(glob) && glob.tokens && glob.input;
8215 if (glob === "" || typeof glob !== "string" && !isState) {
8216 throw new TypeError("Expected pattern to be a non-empty string");
8218 const opts = options || {};
8219 const posix = utils.isWindows(options);
8220 const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
8221 const state = regex.state;
8223 let isIgnored = () => false;
8225 const ignoreOpts = __spreadProps(__spreadValues({}, options), { ignore: null, onMatch: null, onResult: null });
8226 isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
8228 const matcher = (input, returnObject = false) => {
8229 const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
8230 const result = { glob, state, regex, posix, input, output, match, isMatch };
8231 if (typeof opts.onResult === "function") {
8232 opts.onResult(result);
8234 if (isMatch === false) {
8235 result.isMatch = false;
8236 return returnObject ? result : false;
8238 if (isIgnored(input)) {
8239 if (typeof opts.onIgnore === "function") {
8240 opts.onIgnore(result);
8242 result.isMatch = false;
8243 return returnObject ? result : false;
8245 if (typeof opts.onMatch === "function") {
8246 opts.onMatch(result);
8248 return returnObject ? result : true;
8251 matcher.state = state;
8255 picomatch.test = (input, regex, options, { glob, posix } = {}) => {
8256 if (typeof input !== "string") {
8257 throw new TypeError("Expected input to be a string");
8260 return { isMatch: false, output: "" };
8262 const opts = options || {};
8263 const format2 = opts.format || (posix ? utils.toPosixSlashes : null);
8264 let match = input === glob;
8265 let output = match && format2 ? format2(input) : input;
8266 if (match === false) {
8267 output = format2 ? format2(input) : input;
8268 match = output === glob;
8270 if (match === false || opts.capture === true) {
8271 if (opts.matchBase === true || opts.basename === true) {
8272 match = picomatch.matchBase(input, regex, options, posix);
8274 match = regex.exec(output);
8277 return { isMatch: Boolean(match), match, output };
8279 picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
8280 const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
8281 return regex.test(path2.basename(input));
8283 picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
8284 picomatch.parse = (pattern, options) => {
8285 if (Array.isArray(pattern))
8286 return pattern.map((p) => picomatch.parse(p, options));
8287 return parse(pattern, __spreadProps(__spreadValues({}, options), { fastpaths: false }));
8289 picomatch.scan = (input, options) => scan(input, options);
8290 picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
8291 if (returnOutput === true) {
8292 return state.output;
8294 const opts = options || {};
8295 const prepend = opts.contains ? "" : "^";
8296 const append = opts.contains ? "" : "$";
8297 let source = `${prepend}(?:${state.output})${append}`;
8298 if (state && state.negated === true) {
8299 source = `^(?!${source}).*$`;
8301 const regex = picomatch.toRegex(source, options);
8302 if (returnState === true) {
8303 regex.state = state;
8307 picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
8308 if (!input || typeof input !== "string") {
8309 throw new TypeError("Expected a non-empty string");
8311 let parsed = { negated: false, fastpaths: true };
8312 if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
8313 parsed.output = parse.fastpaths(input, options);
8315 if (!parsed.output) {
8316 parsed = parse(input, options);
8318 return picomatch.compileRe(parsed, options, returnOutput, returnState);
8320 picomatch.toRegex = (source, options) => {
8322 const opts = options || {};
8323 return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
8325 if (options && options.debug === true)
8330 picomatch.constants = constants;
8331 module2.exports = picomatch;
8335 // node_modules/picomatch/index.js
8336 var require_picomatch2 = __commonJS({
8337 "node_modules/picomatch/index.js"(exports2, module2) {
8339 module2.exports = require_picomatch();
8343 // node_modules/readdirp/index.js
8344 var require_readdirp = __commonJS({
8345 "node_modules/readdirp/index.js"(exports2, module2) {
8347 var fs2 = require("fs");
8348 var { Readable: Readable2 } = require("stream");
8349 var sysPath = require("path");
8350 var { promisify } = require("util");
8351 var picomatch = require_picomatch2();
8352 var readdir = promisify(fs2.readdir);
8353 var stat = promisify(fs2.stat);
8354 var lstat = promisify(fs2.lstat);
8355 var realpath = promisify(fs2.realpath);
8357 var NORMAL_FLOW_ERRORS = new Set(["ENOENT", "EPERM", "EACCES", "ELOOP"]);
8358 var FILE_TYPE = "files";
8359 var DIR_TYPE = "directories";
8360 var FILE_DIR_TYPE = "files_directories";
8361 var EVERYTHING_TYPE = "all";
8362 var ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
8363 var isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
8364 var normalizeFilter = (filter) => {
8365 if (filter === void 0)
8367 if (typeof filter === "function")
8369 if (typeof filter === "string") {
8370 const glob = picomatch(filter.trim());
8371 return (entry) => glob(entry.basename);
8373 if (Array.isArray(filter)) {
8374 const positive = [];
8375 const negative = [];
8376 for (const item of filter) {
8377 const trimmed = item.trim();
8378 if (trimmed.charAt(0) === BANG) {
8379 negative.push(picomatch(trimmed.slice(1)));
8381 positive.push(picomatch(trimmed));
8384 if (negative.length > 0) {
8385 if (positive.length > 0) {
8386 return (entry) => positive.some((f) => f(entry.basename)) && !negative.some((f) => f(entry.basename));
8388 return (entry) => !negative.some((f) => f(entry.basename));
8390 return (entry) => positive.some((f) => f(entry.basename));
8393 var ReaddirpStream = class extends Readable2 {
8394 static get defaultOptions() {
8397 fileFilter: (path2) => true,
8398 directoryFilter: (path2) => true,
8405 constructor(options = {}) {
8409 highWaterMark: options.highWaterMark || 4096
8411 const opts = __spreadValues(__spreadValues({}, ReaddirpStream.defaultOptions), options);
8412 const { root, type } = opts;
8413 this._fileFilter = normalizeFilter(opts.fileFilter);
8414 this._directoryFilter = normalizeFilter(opts.directoryFilter);
8415 const statMethod = opts.lstat ? lstat : stat;
8416 if (process.platform === "win32" && stat.length === 3) {
8417 this._stat = (path2) => statMethod(path2, { bigint: true });
8419 this._stat = statMethod;
8421 this._maxDepth = opts.depth;
8422 this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
8423 this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
8424 this._wantsEverything = type === EVERYTHING_TYPE;
8425 this._root = sysPath.resolve(root);
8426 this._isDirent = "Dirent" in fs2 && !opts.alwaysStat;
8427 this._statsProp = this._isDirent ? "dirent" : "stats";
8428 this._rdOptions = { encoding: "utf8", withFileTypes: this._isDirent };
8429 this.parents = [this._exploreDir(root, 1)];
8430 this.reading = false;
8431 this.parent = void 0;
8433 async _read(batch) {
8436 this.reading = true;
8438 while (!this.destroyed && batch > 0) {
8439 const { path: path2, depth, files = [] } = this.parent || {};
8440 if (files.length > 0) {
8441 const slice = files.splice(0, batch).map((dirent) => this._formatEntry(dirent, path2));
8442 for (const entry of await Promise.all(slice)) {
8445 const entryType = await this._getEntryType(entry);
8446 if (entryType === "directory" && this._directoryFilter(entry)) {
8447 if (depth <= this._maxDepth) {
8448 this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
8450 if (this._wantsDir) {
8454 } else if ((entryType === "file" || this._includeAsFile(entry)) && this._fileFilter(entry)) {
8455 if (this._wantsFile) {
8462 const parent = this.parents.pop();
8467 this.parent = await parent;
8473 this.destroy(error);
8475 this.reading = false;
8478 async _exploreDir(path2, depth) {
8481 files = await readdir(path2, this._rdOptions);
8483 this._onError(error);
8485 return { files, depth, path: path2 };
8487 async _formatEntry(dirent, path2) {
8490 const basename2 = this._isDirent ? dirent.name : dirent;
8491 const fullPath = sysPath.resolve(sysPath.join(path2, basename2));
8492 entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename: basename2 };
8493 entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
8500 if (isNormalFlowError(err) && !this.destroyed) {
8501 this.emit("warn", err);
8506 async _getEntryType(entry) {
8507 const stats = entry && entry[this._statsProp];
8511 if (stats.isFile()) {
8514 if (stats.isDirectory()) {
8517 if (stats && stats.isSymbolicLink()) {
8519 const entryRealPath = await realpath(entry.fullPath);
8520 const entryRealPathStats = await lstat(entryRealPath);
8521 if (entryRealPathStats.isFile()) {
8524 if (entryRealPathStats.isDirectory()) {
8528 this._onError(error);
8532 _includeAsFile(entry) {
8533 const stats = entry && entry[this._statsProp];
8534 return stats && this._wantsEverything && !stats.isDirectory();
8537 var readdirp = (root, options = {}) => {
8538 let type = options.entryType || options.type;
8539 if (type === "both")
8540 type = FILE_DIR_TYPE;
8542 options.type = type;
8544 throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");
8545 } else if (typeof root !== "string") {
8546 throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");
8547 } else if (type && !ALL_TYPES.includes(type)) {
8548 throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(", ")}`);
8550 options.root = root;
8551 return new ReaddirpStream(options);
8553 var readdirpPromise = (root, options = {}) => {
8554 return new Promise((resolve, reject) => {
8556 readdirp(root, options).on("data", (entry) => files.push(entry)).on("end", () => resolve(files)).on("error", (error) => reject(error));
8559 readdirp.promise = readdirpPromise;
8560 readdirp.ReaddirpStream = ReaddirpStream;
8561 readdirp.default = readdirp;
8562 module2.exports = readdirp;
8566 // node_modules/fs.realpath/old.js
8567 var require_old = __commonJS({
8568 "node_modules/fs.realpath/old.js"(exports2) {
8569 var pathModule = require("path");
8570 var isWindows = process.platform === "win32";
8571 var fs2 = require("fs");
8572 var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
8573 function rethrow() {
8576 var backtrace = new Error();
8577 callback = debugCallback;
8579 callback = missingCallback;
8581 function debugCallback(err) {
8583 backtrace.message = err.message;
8585 missingCallback(err);
8588 function missingCallback(err) {
8590 if (process.throwDeprecation)
8592 else if (!process.noDeprecation) {
8593 var msg = "fs: missing callback " + (err.stack || err.message);
8594 if (process.traceDeprecation)
8602 function maybeCallback(cb) {
8603 return typeof cb === "function" ? cb : rethrow();
8605 var normalize = pathModule.normalize;
8607 nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
8609 nextPartRe = /(.*?)(?:[\/]+|$)/g;
8613 splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
8615 splitRootRe = /^[\/]*/;
8618 exports2.realpathSync = function realpathSync(p, cache) {
8619 p = pathModule.resolve(p);
8620 if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
8623 var original = p, seenLinks = {}, knownHard = {};
8630 var m = splitRootRe.exec(p);
8635 if (isWindows && !knownHard[base]) {
8636 fs2.lstatSync(base);
8637 knownHard[base] = true;
8640 while (pos < p.length) {
8641 nextPartRe.lastIndex = pos;
8642 var result = nextPartRe.exec(p);
8644 current += result[0];
8645 base = previous + result[1];
8646 pos = nextPartRe.lastIndex;
8647 if (knownHard[base] || cache && cache[base] === base) {
8651 if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
8652 resolvedLink = cache[base];
8654 var stat = fs2.lstatSync(base);
8655 if (!stat.isSymbolicLink()) {
8656 knownHard[base] = true;
8661 var linkTarget = null;
8663 var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
8664 if (seenLinks.hasOwnProperty(id)) {
8665 linkTarget = seenLinks[id];
8668 if (linkTarget === null) {
8670 linkTarget = fs2.readlinkSync(base);
8672 resolvedLink = pathModule.resolve(previous, linkTarget);
8674 cache[base] = resolvedLink;
8676 seenLinks[id] = linkTarget;
8678 p = pathModule.resolve(resolvedLink, p.slice(pos));
8682 cache[original] = p;
8685 exports2.realpath = function realpath(p, cache, cb) {
8686 if (typeof cb !== "function") {
8687 cb = maybeCallback(cache);
8690 p = pathModule.resolve(p);
8691 if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
8692 return process.nextTick(cb.bind(null, null, cache[p]));
8694 var original = p, seenLinks = {}, knownHard = {};
8701 var m = splitRootRe.exec(p);
8706 if (isWindows && !knownHard[base]) {
8707 fs2.lstat(base, function(err) {
8710 knownHard[base] = true;
8714 process.nextTick(LOOP);
8718 if (pos >= p.length) {
8720 cache[original] = p;
8723 nextPartRe.lastIndex = pos;
8724 var result = nextPartRe.exec(p);
8726 current += result[0];
8727 base = previous + result[1];
8728 pos = nextPartRe.lastIndex;
8729 if (knownHard[base] || cache && cache[base] === base) {
8730 return process.nextTick(LOOP);
8732 if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
8733 return gotResolvedLink(cache[base]);
8735 return fs2.lstat(base, gotStat);
8737 function gotStat(err, stat) {
8740 if (!stat.isSymbolicLink()) {
8741 knownHard[base] = true;
8744 return process.nextTick(LOOP);
8747 var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
8748 if (seenLinks.hasOwnProperty(id)) {
8749 return gotTarget(null, seenLinks[id], base);
8752 fs2.stat(base, function(err2) {
8755 fs2.readlink(base, function(err3, target) {
8757 seenLinks[id] = target;
8758 gotTarget(err3, target);
8762 function gotTarget(err, target, base2) {
8765 var resolvedLink = pathModule.resolve(previous, target);
8767 cache[base2] = resolvedLink;
8768 gotResolvedLink(resolvedLink);
8770 function gotResolvedLink(resolvedLink) {
8771 p = pathModule.resolve(resolvedLink, p.slice(pos));
8778 // node_modules/fs.realpath/index.js
8779 var require_fs = __commonJS({
8780 "node_modules/fs.realpath/index.js"(exports2, module2) {
8781 module2.exports = realpath;
8782 realpath.realpath = realpath;
8783 realpath.sync = realpathSync;
8784 realpath.realpathSync = realpathSync;
8785 realpath.monkeypatch = monkeypatch;
8786 realpath.unmonkeypatch = unmonkeypatch;
8787 var fs2 = require("fs");
8788 var origRealpath = fs2.realpath;
8789 var origRealpathSync = fs2.realpathSync;
8790 var version = process.version;
8791 var ok = /^v[0-5]\./.test(version);
8792 var old = require_old();
8793 function newError(er) {
8794 return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
8796 function realpath(p, cache, cb) {
8798 return origRealpath(p, cache, cb);
8800 if (typeof cache === "function") {
8804 origRealpath(p, cache, function(er, result) {
8806 old.realpath(p, cache, cb);
8812 function realpathSync(p, cache) {
8814 return origRealpathSync(p, cache);
8817 return origRealpathSync(p, cache);
8820 return old.realpathSync(p, cache);
8826 function monkeypatch() {
8827 fs2.realpath = realpath;
8828 fs2.realpathSync = realpathSync;
8830 function unmonkeypatch() {
8831 fs2.realpath = origRealpath;
8832 fs2.realpathSync = origRealpathSync;
8837 // node_modules/concat-map/index.js
8838 var require_concat_map = __commonJS({
8839 "node_modules/concat-map/index.js"(exports2, module2) {
8840 module2.exports = function(xs, fn) {
8842 for (var i = 0; i < xs.length; i++) {
8843 var x = fn(xs[i], i);
8845 res.push.apply(res, x);
8851 var isArray = Array.isArray || function(xs) {
8852 return Object.prototype.toString.call(xs) === "[object Array]";
8857 // node_modules/balanced-match/index.js
8858 var require_balanced_match = __commonJS({
8859 "node_modules/balanced-match/index.js"(exports2, module2) {
8861 module2.exports = balanced;
8862 function balanced(a, b, str) {
8863 if (a instanceof RegExp)
8864 a = maybeMatch(a, str);
8865 if (b instanceof RegExp)
8866 b = maybeMatch(b, str);
8867 var r = range(a, b, str);
8871 pre: str.slice(0, r[0]),
8872 body: str.slice(r[0] + a.length, r[1]),
8873 post: str.slice(r[1] + b.length)
8876 function maybeMatch(reg, str) {
8877 var m = str.match(reg);
8878 return m ? m[0] : null;
8880 balanced.range = range;
8881 function range(a, b, str) {
8882 var begs, beg, left, right, result;
8883 var ai = str.indexOf(a);
8884 var bi = str.indexOf(b, ai + 1);
8886 if (ai >= 0 && bi > 0) {
8889 while (i >= 0 && !result) {
8892 ai = str.indexOf(a, i + 1);
8893 } else if (begs.length == 1) {
8894 result = [begs.pop(), bi];
8901 bi = str.indexOf(b, i + 1);
8903 i = ai < bi && ai >= 0 ? ai : bi;
8906 result = [left, right];
8914 // node_modules/brace-expansion/index.js
8915 var require_brace_expansion = __commonJS({
8916 "node_modules/brace-expansion/index.js"(exports2, module2) {
8917 var concatMap = require_concat_map();
8918 var balanced = require_balanced_match();
8919 module2.exports = expandTop;
8920 var escSlash = "\0SLASH" + Math.random() + "\0";
8921 var escOpen = "\0OPEN" + Math.random() + "\0";
8922 var escClose = "\0CLOSE" + Math.random() + "\0";
8923 var escComma = "\0COMMA" + Math.random() + "\0";
8924 var escPeriod = "\0PERIOD" + Math.random() + "\0";
8925 function numeric(str) {
8926 return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
8928 function escapeBraces(str) {
8929 return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
8931 function unescapeBraces(str) {
8932 return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
8934 function parseCommaParts(str) {
8938 var m = balanced("{", "}", str);
8940 return str.split(",");
8944 var p = pre.split(",");
8945 p[p.length - 1] += "{" + body + "}";
8946 var postParts = parseCommaParts(post);
8948 p[p.length - 1] += postParts.shift();
8949 p.push.apply(p, postParts);
8951 parts.push.apply(parts, p);
8954 function expandTop(str) {
8957 if (str.substr(0, 2) === "{}") {
8958 str = "\\{\\}" + str.substr(2);
8960 return expand(escapeBraces(str), true).map(unescapeBraces);
8962 function embrace(str) {
8963 return "{" + str + "}";
8965 function isPadded(el) {
8966 return /^-?0\d/.test(el);
8968 function lte(i, y) {
8971 function gte(i, y) {
8974 function expand(str, isTop) {
8975 var expansions = [];
8976 var m = balanced("{", "}", str);
8977 if (!m || /\$$/.test(m.pre))
8979 var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
8980 var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
8981 var isSequence = isNumericSequence || isAlphaSequence;
8982 var isOptions = m.body.indexOf(",") >= 0;
8983 if (!isSequence && !isOptions) {
8984 if (m.post.match(/,.*\}/)) {
8985 str = m.pre + "{" + m.body + escClose + m.post;
8992 n = m.body.split(/\.\./);
8994 n = parseCommaParts(m.body);
8995 if (n.length === 1) {
8996 n = expand(n[0], false).map(embrace);
8997 if (n.length === 1) {
8998 var post = m.post.length ? expand(m.post, false) : [""];
8999 return post.map(function(p) {
9000 return m.pre + n[0] + p;
9006 var post = m.post.length ? expand(m.post, false) : [""];
9009 var x = numeric(n[0]);
9010 var y = numeric(n[1]);
9011 var width = Math.max(n[0].length, n[1].length);
9012 var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
9014 var reverse = y < x;
9019 var pad = n.some(isPadded);
9021 for (var i = x; test(i, y); i += incr) {
9023 if (isAlphaSequence) {
9024 c = String.fromCharCode(i);
9030 var need = width - c.length;
9032 var z = new Array(need + 1).join("0");
9034 c = "-" + z + c.slice(1);
9043 N = concatMap(n, function(el) {
9044 return expand(el, false);
9047 for (var j = 0; j < N.length; j++) {
9048 for (var k = 0; k < post.length; k++) {
9049 var expansion = pre + N[j] + post[k];
9050 if (!isTop || isSequence || expansion)
9051 expansions.push(expansion);
9059 // node_modules/minimatch/minimatch.js
9060 var require_minimatch = __commonJS({
9061 "node_modules/minimatch/minimatch.js"(exports2, module2) {
9062 module2.exports = minimatch;
9063 minimatch.Minimatch = Minimatch;
9064 var path2 = { sep: "/" };
9066 path2 = require("path");
9069 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
9070 var expand = require_brace_expansion();
9072 "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
9073 "?": { open: "(?:", close: ")?" },
9074 "+": { open: "(?:", close: ")+" },
9075 "*": { open: "(?:", close: ")*" },
9076 "@": { open: "(?:", close: ")" }
9079 var star = qmark + "*?";
9080 var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
9081 var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
9082 var reSpecials = charSet("().*{}+?[]^$\\!");
9083 function charSet(s) {
9084 return s.split("").reduce(function(set, c) {
9089 var slashSplit = /\/+/;
9090 minimatch.filter = filter;
9091 function filter(pattern, options) {
9092 options = options || {};
9093 return function(p, i, list) {
9094 return minimatch(p, pattern, options);
9097 function ext(a, b) {
9101 Object.keys(b).forEach(function(k) {
9104 Object.keys(a).forEach(function(k) {
9109 minimatch.defaults = function(def) {
9110 if (!def || !Object.keys(def).length)
9112 var orig = minimatch;
9113 var m = function minimatch2(p, pattern, options) {
9114 return orig.minimatch(p, pattern, ext(def, options));
9116 m.Minimatch = function Minimatch2(pattern, options) {
9117 return new orig.Minimatch(pattern, ext(def, options));
9121 Minimatch.defaults = function(def) {
9122 if (!def || !Object.keys(def).length)
9124 return minimatch.defaults(def).Minimatch;
9126 function minimatch(p, pattern, options) {
9127 if (typeof pattern !== "string") {
9128 throw new TypeError("glob pattern string required");
9132 if (!options.nocomment && pattern.charAt(0) === "#") {
9135 if (pattern.trim() === "")
9137 return new Minimatch(pattern, options).match(p);
9139 function Minimatch(pattern, options) {
9140 if (!(this instanceof Minimatch)) {
9141 return new Minimatch(pattern, options);
9143 if (typeof pattern !== "string") {
9144 throw new TypeError("glob pattern string required");
9148 pattern = pattern.trim();
9149 if (path2.sep !== "/") {
9150 pattern = pattern.split(path2.sep).join("/");
9152 this.options = options;
9154 this.pattern = pattern;
9156 this.negate = false;
9157 this.comment = false;
9161 Minimatch.prototype.debug = function() {
9163 Minimatch.prototype.make = make;
9167 var pattern = this.pattern;
9168 var options = this.options;
9169 if (!options.nocomment && pattern.charAt(0) === "#") {
9170 this.comment = true;
9178 var set = this.globSet = this.braceExpand();
9180 this.debug = console.error;
9181 this.debug(this.pattern, set);
9182 set = this.globParts = set.map(function(s) {
9183 return s.split(slashSplit);
9185 this.debug(this.pattern, set);
9186 set = set.map(function(s, si, set2) {
9187 return s.map(this.parse, this);
9189 this.debug(this.pattern, set);
9190 set = set.filter(function(s) {
9191 return s.indexOf(false) === -1;
9193 this.debug(this.pattern, set);
9196 Minimatch.prototype.parseNegate = parseNegate;
9197 function parseNegate() {
9198 var pattern = this.pattern;
9200 var options = this.options;
9201 var negateOffset = 0;
9202 if (options.nonegate)
9204 for (var i = 0, l2 = pattern.length; i < l2 && pattern.charAt(i) === "!"; i++) {
9209 this.pattern = pattern.substr(negateOffset);
9210 this.negate = negate;
9212 minimatch.braceExpand = function(pattern, options) {
9213 return braceExpand(pattern, options);
9215 Minimatch.prototype.braceExpand = braceExpand;
9216 function braceExpand(pattern, options) {
9218 if (this instanceof Minimatch) {
9219 options = this.options;
9224 pattern = typeof pattern === "undefined" ? this.pattern : pattern;
9225 if (typeof pattern === "undefined") {
9226 throw new TypeError("undefined pattern");
9228 if (options.nobrace || !pattern.match(/\{.*\}/)) {
9231 return expand(pattern);
9233 Minimatch.prototype.parse = parse;
9235 function parse(pattern, isSub) {
9236 if (pattern.length > 1024 * 64) {
9237 throw new TypeError("pattern is too long");
9239 var options = this.options;
9240 if (!options.noglobstar && pattern === "**")
9245 var hasMagic = !!options.nocase;
9246 var escaping = false;
9247 var patternListStack = [];
9248 var negativeLists = [];
9250 var inClass = false;
9251 var reClassStart = -1;
9252 var classStart = -1;
9253 var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
9255 function clearStateChar() {
9257 switch (stateChar) {
9267 re += "\\" + stateChar;
9270 self2.debug("clearStateChar %j %j", stateChar, re);
9274 for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
9275 this.debug("%s %s %s %j", pattern, i, re, c);
9276 if (escaping && reSpecials[c]) {
9293 this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
9295 this.debug(" in class");
9296 if (c === "!" && i === classStart + 1)
9301 self2.debug("call clearStateChar %j", stateChar);
9316 patternListStack.push({
9320 open: plTypes[stateChar].open,
9321 close: plTypes[stateChar].close
9323 re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
9324 this.debug("plType %j %j", stateChar, re);
9328 if (inClass || !patternListStack.length) {
9334 var pl = patternListStack.pop();
9336 if (pl.type === "!") {
9337 negativeLists.push(pl);
9339 pl.reEnd = re.length;
9342 if (inClass || !patternListStack.length || escaping) {
9358 reClassStart = re.length;
9362 if (i === classStart + 1 || !inClass) {
9368 var cs = pattern.substring(classStart + 1, i);
9370 RegExp("[" + cs + "]");
9372 var sp = this.parse(cs, SUBPARSE);
9373 re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
9374 hasMagic = hasMagic || sp[1];
9387 } else if (reSpecials[c] && !(c === "^" && inClass)) {
9394 cs = pattern.substr(classStart + 1);
9395 sp = this.parse(cs, SUBPARSE);
9396 re = re.substr(0, reClassStart) + "\\[" + sp[0];
9397 hasMagic = hasMagic || sp[1];
9399 for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
9400 var tail = re.slice(pl.reStart + pl.open.length);
9401 this.debug("setting tail", re, pl);
9402 tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
9406 return $1 + $1 + $2 + "|";
9408 this.debug("tail=%j\n %s", tail, tail, pl, re);
9409 var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
9411 re = re.slice(0, pl.reStart) + t + "\\(" + tail;
9417 var addPatternStart = false;
9418 switch (re.charAt(0)) {
9422 addPatternStart = true;
9424 for (var n = negativeLists.length - 1; n > -1; n--) {
9425 var nl = negativeLists[n];
9426 var nlBefore = re.slice(0, nl.reStart);
9427 var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
9428 var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
9429 var nlAfter = re.slice(nl.reEnd);
9431 var openParensBefore = nlBefore.split("(").length - 1;
9432 var cleanAfter = nlAfter;
9433 for (i = 0; i < openParensBefore; i++) {
9434 cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
9436 nlAfter = cleanAfter;
9438 if (nlAfter === "" && isSub !== SUBPARSE) {
9441 var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
9444 if (re !== "" && hasMagic) {
9447 if (addPatternStart) {
9448 re = patternStart + re;
9450 if (isSub === SUBPARSE) {
9451 return [re, hasMagic];
9454 return globUnescape(pattern);
9456 var flags = options.nocase ? "i" : "";
9458 var regExp = new RegExp("^" + re + "$", flags);
9460 return new RegExp("$.");
9462 regExp._glob = pattern;
9466 minimatch.makeRe = function(pattern, options) {
9467 return new Minimatch(pattern, options || {}).makeRe();
9469 Minimatch.prototype.makeRe = makeRe;
9471 if (this.regexp || this.regexp === false)
9475 this.regexp = false;
9478 var options = this.options;
9479 var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
9480 var flags = options.nocase ? "i" : "";
9481 var re = set.map(function(pattern) {
9482 return pattern.map(function(p) {
9483 return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
9486 re = "^(?:" + re + ")$";
9488 re = "^(?!" + re + ").*$";
9490 this.regexp = new RegExp(re, flags);
9492 this.regexp = false;
9496 minimatch.match = function(list, pattern, options) {
9497 options = options || {};
9498 var mm = new Minimatch(pattern, options);
9499 list = list.filter(function(f) {
9502 if (mm.options.nonull && !list.length) {
9507 Minimatch.prototype.match = match;
9508 function match(f, partial) {
9509 this.debug("match", f, this.pattern);
9514 if (f === "/" && partial)
9516 var options = this.options;
9517 if (path2.sep !== "/") {
9518 f = f.split(path2.sep).join("/");
9520 f = f.split(slashSplit);
9521 this.debug(this.pattern, "split", f);
9523 this.debug(this.pattern, "set", set);
9526 for (i = f.length - 1; i >= 0; i--) {
9531 for (i = 0; i < set.length; i++) {
9532 var pattern = set[i];
9534 if (options.matchBase && pattern.length === 1) {
9537 var hit = this.matchOne(file, pattern, partial);
9539 if (options.flipNegate)
9541 return !this.negate;
9544 if (options.flipNegate)
9548 Minimatch.prototype.matchOne = function(file, pattern, partial) {
9549 var options = this.options;
9550 this.debug("matchOne", { "this": this, file, pattern });
9551 this.debug("matchOne", file.length, pattern.length);
9552 for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
9553 this.debug("matchOne loop");
9554 var p = pattern[pi];
9556 this.debug(pattern, p, f);
9559 if (p === GLOBSTAR) {
9560 this.debug("GLOBSTAR", [pattern, p, f]);
9564 this.debug("** at the end");
9565 for (; fi < fl; fi++) {
9566 if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
9572 var swallowee = file[fr];
9573 this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
9574 if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
9575 this.debug("globstar found match!", fr, fl, swallowee);
9578 if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
9579 this.debug("dot detected!", file, fr, pattern, pr);
9582 this.debug("globstar swallow a segment, and continue");
9587 this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
9594 if (typeof p === "string") {
9595 if (options.nocase) {
9596 hit = f.toLowerCase() === p.toLowerCase();
9600 this.debug("string match", p, f, hit);
9603 this.debug("pattern match", p, f, hit);
9608 if (fi === fl && pi === pl) {
9610 } else if (fi === fl) {
9612 } else if (pi === pl) {
9613 var emptyFileEnd = fi === fl - 1 && file[fi] === "";
9614 return emptyFileEnd;
9616 throw new Error("wtf?");
9618 function globUnescape(s) {
9619 return s.replace(/\\(.)/g, "$1");
9621 function regExpEscape(s) {
9622 return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
9627 // node_modules/inherits/inherits_browser.js
9628 var require_inherits_browser = __commonJS({
9629 "node_modules/inherits/inherits_browser.js"(exports2, module2) {
9630 if (typeof Object.create === "function") {
9631 module2.exports = function inherits2(ctor, superCtor) {
9633 ctor.super_ = superCtor;
9634 ctor.prototype = Object.create(superCtor.prototype, {
9645 module2.exports = function inherits2(ctor, superCtor) {
9647 ctor.super_ = superCtor;
9648 var TempCtor = function() {
9650 TempCtor.prototype = superCtor.prototype;
9651 ctor.prototype = new TempCtor();
9652 ctor.prototype.constructor = ctor;
9659 // node_modules/inherits/inherits.js
9660 var require_inherits = __commonJS({
9661 "node_modules/inherits/inherits.js"(exports2, module2) {
9663 util = require("util");
9664 if (typeof util.inherits !== "function")
9666 module2.exports = util.inherits;
9668 module2.exports = require_inherits_browser();
9674 // node_modules/path-is-absolute/index.js
9675 var require_path_is_absolute = __commonJS({
9676 "node_modules/path-is-absolute/index.js"(exports2, module2) {
9678 function posix(path2) {
9679 return path2.charAt(0) === "/";
9681 function win32(path2) {
9682 var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
9683 var result = splitDeviceRe.exec(path2);
9684 var device = result[1] || "";
9685 var isUnc = Boolean(device && device.charAt(1) !== ":");
9686 return Boolean(result[2] || isUnc);
9688 module2.exports = process.platform === "win32" ? win32 : posix;
9689 module2.exports.posix = posix;
9690 module2.exports.win32 = win32;
9694 // node_modules/glob/common.js
9695 var require_common = __commonJS({
9696 "node_modules/glob/common.js"(exports2) {
9697 exports2.alphasort = alphasort;
9698 exports2.alphasorti = alphasorti;
9699 exports2.setopts = setopts;
9700 exports2.ownProp = ownProp;
9701 exports2.makeAbs = makeAbs;
9702 exports2.finish = finish;
9703 exports2.mark = mark;
9704 exports2.isIgnored = isIgnored;
9705 exports2.childrenIgnored = childrenIgnored;
9706 function ownProp(obj2, field) {
9707 return Object.prototype.hasOwnProperty.call(obj2, field);
9709 var path2 = require("path");
9710 var minimatch = require_minimatch();
9711 var isAbsolute = require_path_is_absolute();
9712 var Minimatch = minimatch.Minimatch;
9713 function alphasorti(a, b) {
9714 return a.toLowerCase().localeCompare(b.toLowerCase());
9716 function alphasort(a, b) {
9717 return a.localeCompare(b);
9719 function setupIgnores(self2, options) {
9720 self2.ignore = options.ignore || [];
9721 if (!Array.isArray(self2.ignore))
9722 self2.ignore = [self2.ignore];
9723 if (self2.ignore.length) {
9724 self2.ignore = self2.ignore.map(ignoreMap);
9727 function ignoreMap(pattern) {
9728 var gmatcher = null;
9729 if (pattern.slice(-3) === "/**") {
9730 var gpattern = pattern.replace(/(\/\*\*)+$/, "");
9731 gmatcher = new Minimatch(gpattern, { dot: true });
9734 matcher: new Minimatch(pattern, { dot: true }),
9738 function setopts(self2, pattern, options) {
9741 if (options.matchBase && pattern.indexOf("/") === -1) {
9742 if (options.noglobstar) {
9743 throw new Error("base matching requires globstar");
9745 pattern = "**/" + pattern;
9747 self2.silent = !!options.silent;
9748 self2.pattern = pattern;
9749 self2.strict = options.strict !== false;
9750 self2.realpath = !!options.realpath;
9751 self2.realpathCache = options.realpathCache || Object.create(null);
9752 self2.follow = !!options.follow;
9753 self2.dot = !!options.dot;
9754 self2.mark = !!options.mark;
9755 self2.nodir = !!options.nodir;
9758 self2.sync = !!options.sync;
9759 self2.nounique = !!options.nounique;
9760 self2.nonull = !!options.nonull;
9761 self2.nosort = !!options.nosort;
9762 self2.nocase = !!options.nocase;
9763 self2.stat = !!options.stat;
9764 self2.noprocess = !!options.noprocess;
9765 self2.absolute = !!options.absolute;
9766 self2.maxLength = options.maxLength || Infinity;
9767 self2.cache = options.cache || Object.create(null);
9768 self2.statCache = options.statCache || Object.create(null);
9769 self2.symlinks = options.symlinks || Object.create(null);
9770 setupIgnores(self2, options);
9771 self2.changedCwd = false;
9772 var cwd = process.cwd();
9773 if (!ownProp(options, "cwd"))
9776 self2.cwd = path2.resolve(options.cwd);
9777 self2.changedCwd = self2.cwd !== cwd;
9779 self2.root = options.root || path2.resolve(self2.cwd, "/");
9780 self2.root = path2.resolve(self2.root);
9781 if (process.platform === "win32")
9782 self2.root = self2.root.replace(/\\/g, "/");
9783 self2.cwdAbs = isAbsolute(self2.cwd) ? self2.cwd : makeAbs(self2, self2.cwd);
9784 if (process.platform === "win32")
9785 self2.cwdAbs = self2.cwdAbs.replace(/\\/g, "/");
9786 self2.nomount = !!options.nomount;
9787 options.nonegate = true;
9788 options.nocomment = true;
9789 self2.minimatch = new Minimatch(pattern, options);
9790 self2.options = self2.minimatch.options;
9792 function finish(self2) {
9793 var nou = self2.nounique;
9794 var all = nou ? [] : Object.create(null);
9795 for (var i = 0, l2 = self2.matches.length; i < l2; i++) {
9796 var matches = self2.matches[i];
9797 if (!matches || Object.keys(matches).length === 0) {
9799 var literal = self2.minimatch.globSet[i];
9803 all[literal] = true;
9806 var m = Object.keys(matches);
9808 all.push.apply(all, m);
9810 m.forEach(function(m2) {
9816 all = Object.keys(all);
9818 all = all.sort(self2.nocase ? alphasorti : alphasort);
9820 for (var i = 0; i < all.length; i++) {
9821 all[i] = self2._mark(all[i]);
9824 all = all.filter(function(e) {
9825 var notDir = !/\/$/.test(e);
9826 var c = self2.cache[e] || self2.cache[makeAbs(self2, e)];
9828 notDir = c !== "DIR" && !Array.isArray(c);
9833 if (self2.ignore.length)
9834 all = all.filter(function(m2) {
9835 return !isIgnored(self2, m2);
9839 function mark(self2, p) {
9840 var abs = makeAbs(self2, p);
9841 var c = self2.cache[abs];
9844 var isDir = c === "DIR" || Array.isArray(c);
9845 var slash = p.slice(-1) === "/";
9846 if (isDir && !slash)
9848 else if (!isDir && slash)
9851 var mabs = makeAbs(self2, m);
9852 self2.statCache[mabs] = self2.statCache[abs];
9853 self2.cache[mabs] = self2.cache[abs];
9858 function makeAbs(self2, f) {
9860 if (f.charAt(0) === "/") {
9861 abs = path2.join(self2.root, f);
9862 } else if (isAbsolute(f) || f === "") {
9864 } else if (self2.changedCwd) {
9865 abs = path2.resolve(self2.cwd, f);
9867 abs = path2.resolve(f);
9869 if (process.platform === "win32")
9870 abs = abs.replace(/\\/g, "/");
9873 function isIgnored(self2, path3) {
9874 if (!self2.ignore.length)
9876 return self2.ignore.some(function(item) {
9877 return item.matcher.match(path3) || !!(item.gmatcher && item.gmatcher.match(path3));
9880 function childrenIgnored(self2, path3) {
9881 if (!self2.ignore.length)
9883 return self2.ignore.some(function(item) {
9884 return !!(item.gmatcher && item.gmatcher.match(path3));
9890 // node_modules/glob/sync.js
9891 var require_sync = __commonJS({
9892 "node_modules/glob/sync.js"(exports2, module2) {
9893 module2.exports = globSync;
9894 globSync.GlobSync = GlobSync;
9895 var fs2 = require("fs");
9896 var rp = require_fs();
9897 var minimatch = require_minimatch();
9898 var Minimatch = minimatch.Minimatch;
9899 var Glob = require_glob().Glob;
9900 var util = require("util");
9901 var path2 = require("path");
9902 var assert = require("assert");
9903 var isAbsolute = require_path_is_absolute();
9904 var common2 = require_common();
9905 var alphasort = common2.alphasort;
9906 var alphasorti = common2.alphasorti;
9907 var setopts = common2.setopts;
9908 var ownProp = common2.ownProp;
9909 var childrenIgnored = common2.childrenIgnored;
9910 var isIgnored = common2.isIgnored;
9911 function globSync(pattern, options) {
9912 if (typeof options === "function" || arguments.length === 3)
9913 throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
9914 return new GlobSync(pattern, options).found;
9916 function GlobSync(pattern, options) {
9918 throw new Error("must provide pattern");
9919 if (typeof options === "function" || arguments.length === 3)
9920 throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
9921 if (!(this instanceof GlobSync))
9922 return new GlobSync(pattern, options);
9923 setopts(this, pattern, options);
9926 var n = this.minimatch.set.length;
9927 this.matches = new Array(n);
9928 for (var i = 0; i < n; i++) {
9929 this._process(this.minimatch.set[i], i, false);
9933 GlobSync.prototype._finish = function() {
9934 assert(this instanceof GlobSync);
9935 if (this.realpath) {
9937 this.matches.forEach(function(matchset, index) {
9938 var set = self2.matches[index] = Object.create(null);
9939 for (var p in matchset) {
9941 p = self2._makeAbs(p);
9942 var real = rp.realpathSync(p, self2.realpathCache);
9945 if (er.syscall === "stat")
9946 set[self2._makeAbs(p)] = true;
9953 common2.finish(this);
9955 GlobSync.prototype._process = function(pattern, index, inGlobStar) {
9956 assert(this instanceof GlobSync);
9958 while (typeof pattern[n] === "string") {
9963 case pattern.length:
9964 this._processSimple(pattern.join("/"), index);
9970 prefix = pattern.slice(0, n).join("/");
9973 var remain = pattern.slice(n);
9975 if (prefix === null)
9977 else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
9978 if (!prefix || !isAbsolute(prefix))
9979 prefix = "/" + prefix;
9983 var abs = this._makeAbs(read);
9984 if (childrenIgnored(this, read))
9986 var isGlobStar = remain[0] === minimatch.GLOBSTAR;
9988 this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
9990 this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
9992 GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
9993 var entries = this._readdir(abs, inGlobStar);
9997 var negate = !!this.minimatch.negate;
9998 var rawGlob = pn._glob;
9999 var dotOk = this.dot || rawGlob.charAt(0) === ".";
10000 var matchedEntries = [];
10001 for (var i = 0; i < entries.length; i++) {
10002 var e = entries[i];
10003 if (e.charAt(0) !== "." || dotOk) {
10005 if (negate && !prefix) {
10011 matchedEntries.push(e);
10014 var len = matchedEntries.length;
10017 if (remain.length === 1 && !this.mark && !this.stat) {
10018 if (!this.matches[index])
10019 this.matches[index] = Object.create(null);
10020 for (var i = 0; i < len; i++) {
10021 var e = matchedEntries[i];
10023 if (prefix.slice(-1) !== "/")
10024 e = prefix + "/" + e;
10028 if (e.charAt(0) === "/" && !this.nomount) {
10029 e = path2.join(this.root, e);
10031 this._emitMatch(index, e);
10036 for (var i = 0; i < len; i++) {
10037 var e = matchedEntries[i];
10040 newPattern = [prefix, e];
10043 this._process(newPattern.concat(remain), index, inGlobStar);
10046 GlobSync.prototype._emitMatch = function(index, e) {
10047 if (isIgnored(this, e))
10049 var abs = this._makeAbs(e);
10052 if (this.absolute) {
10055 if (this.matches[index][e])
10058 var c = this.cache[abs];
10059 if (c === "DIR" || Array.isArray(c))
10062 this.matches[index][e] = true;
10066 GlobSync.prototype._readdirInGlobStar = function(abs) {
10068 return this._readdir(abs, false);
10073 lstat = fs2.lstatSync(abs);
10075 if (er.code === "ENOENT") {
10079 var isSym = lstat && lstat.isSymbolicLink();
10080 this.symlinks[abs] = isSym;
10081 if (!isSym && lstat && !lstat.isDirectory())
10082 this.cache[abs] = "FILE";
10084 entries = this._readdir(abs, false);
10087 GlobSync.prototype._readdir = function(abs, inGlobStar) {
10089 if (inGlobStar && !ownProp(this.symlinks, abs))
10090 return this._readdirInGlobStar(abs);
10091 if (ownProp(this.cache, abs)) {
10092 var c = this.cache[abs];
10093 if (!c || c === "FILE")
10095 if (Array.isArray(c))
10099 return this._readdirEntries(abs, fs2.readdirSync(abs));
10101 this._readdirError(abs, er);
10105 GlobSync.prototype._readdirEntries = function(abs, entries) {
10106 if (!this.mark && !this.stat) {
10107 for (var i = 0; i < entries.length; i++) {
10108 var e = entries[i];
10113 this.cache[e] = true;
10116 this.cache[abs] = entries;
10119 GlobSync.prototype._readdirError = function(f, er) {
10123 var abs = this._makeAbs(f);
10124 this.cache[abs] = "FILE";
10125 if (abs === this.cwdAbs) {
10126 var error = new Error(er.code + " invalid cwd " + this.cwd);
10127 error.path = this.cwd;
10128 error.code = er.code;
10134 case "ENAMETOOLONG":
10136 this.cache[this._makeAbs(f)] = false;
10139 this.cache[this._makeAbs(f)] = false;
10143 console.error("glob error", er);
10147 GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
10148 var entries = this._readdir(abs, inGlobStar);
10151 var remainWithoutGlobStar = remain.slice(1);
10152 var gspref = prefix ? [prefix] : [];
10153 var noGlobStar = gspref.concat(remainWithoutGlobStar);
10154 this._process(noGlobStar, index, false);
10155 var len = entries.length;
10156 var isSym = this.symlinks[abs];
10157 if (isSym && inGlobStar)
10159 for (var i = 0; i < len; i++) {
10160 var e = entries[i];
10161 if (e.charAt(0) === "." && !this.dot)
10163 var instead = gspref.concat(entries[i], remainWithoutGlobStar);
10164 this._process(instead, index, true);
10165 var below = gspref.concat(entries[i], remain);
10166 this._process(below, index, true);
10169 GlobSync.prototype._processSimple = function(prefix, index) {
10170 var exists = this._stat(prefix);
10171 if (!this.matches[index])
10172 this.matches[index] = Object.create(null);
10175 if (prefix && isAbsolute(prefix) && !this.nomount) {
10176 var trail = /[\/\\]$/.test(prefix);
10177 if (prefix.charAt(0) === "/") {
10178 prefix = path2.join(this.root, prefix);
10180 prefix = path2.resolve(this.root, prefix);
10185 if (process.platform === "win32")
10186 prefix = prefix.replace(/\\/g, "/");
10187 this._emitMatch(index, prefix);
10189 GlobSync.prototype._stat = function(f) {
10190 var abs = this._makeAbs(f);
10191 var needDir = f.slice(-1) === "/";
10192 if (f.length > this.maxLength)
10194 if (!this.stat && ownProp(this.cache, abs)) {
10195 var c = this.cache[abs];
10196 if (Array.isArray(c))
10198 if (!needDir || c === "DIR")
10200 if (needDir && c === "FILE")
10204 var stat = this.statCache[abs];
10208 lstat = fs2.lstatSync(abs);
10210 if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
10211 this.statCache[abs] = false;
10215 if (lstat && lstat.isSymbolicLink()) {
10217 stat = fs2.statSync(abs);
10225 this.statCache[abs] = stat;
10228 c = stat.isDirectory() ? "DIR" : "FILE";
10229 this.cache[abs] = this.cache[abs] || c;
10230 if (needDir && c === "FILE")
10234 GlobSync.prototype._mark = function(p) {
10235 return common2.mark(this, p);
10237 GlobSync.prototype._makeAbs = function(f) {
10238 return common2.makeAbs(this, f);
10243 // node_modules/wrappy/wrappy.js
10244 var require_wrappy = __commonJS({
10245 "node_modules/wrappy/wrappy.js"(exports2, module2) {
10246 module2.exports = wrappy;
10247 function wrappy(fn, cb) {
10249 return wrappy(fn)(cb);
10250 if (typeof fn !== "function")
10251 throw new TypeError("need wrapper function");
10252 Object.keys(fn).forEach(function(k) {
10253 wrapper[k] = fn[k];
10256 function wrapper() {
10257 var args = new Array(arguments.length);
10258 for (var i = 0; i < args.length; i++) {
10259 args[i] = arguments[i];
10261 var ret2 = fn.apply(this, args);
10262 var cb2 = args[args.length - 1];
10263 if (typeof ret2 === "function" && ret2 !== cb2) {
10264 Object.keys(cb2).forEach(function(k) {
10274 // node_modules/once/once.js
10275 var require_once = __commonJS({
10276 "node_modules/once/once.js"(exports2, module2) {
10277 var wrappy = require_wrappy();
10278 module2.exports = wrappy(once);
10279 module2.exports.strict = wrappy(onceStrict);
10280 once.proto = once(function() {
10281 Object.defineProperty(Function.prototype, "once", {
10282 value: function() {
10287 Object.defineProperty(Function.prototype, "onceStrict", {
10288 value: function() {
10289 return onceStrict(this);
10294 function once(fn) {
10295 var f = function() {
10299 return f.value = fn.apply(this, arguments);
10304 function onceStrict(fn) {
10305 var f = function() {
10307 throw new Error(f.onceError);
10309 return f.value = fn.apply(this, arguments);
10311 var name = fn.name || "Function wrapped with `once`";
10312 f.onceError = name + " shouldn't be called more than once";
10319 // node_modules/inflight/inflight.js
10320 var require_inflight = __commonJS({
10321 "node_modules/inflight/inflight.js"(exports2, module2) {
10322 var wrappy = require_wrappy();
10323 var reqs = Object.create(null);
10324 var once = require_once();
10325 module2.exports = wrappy(inflight);
10326 function inflight(key, cb) {
10328 reqs[key].push(cb);
10332 return makeres(key);
10335 function makeres(key) {
10336 return once(function RES() {
10337 var cbs = reqs[key];
10338 var len = cbs.length;
10339 var args = slice(arguments);
10341 for (var i = 0; i < len; i++) {
10342 cbs[i].apply(null, args);
10345 if (cbs.length > len) {
10346 cbs.splice(0, len);
10347 process.nextTick(function() {
10348 RES.apply(null, args);
10356 function slice(args) {
10357 var length = args.length;
10359 for (var i = 0; i < length; i++)
10360 array[i] = args[i];
10366 // node_modules/glob/glob.js
10367 var require_glob = __commonJS({
10368 "node_modules/glob/glob.js"(exports2, module2) {
10369 module2.exports = glob;
10370 var fs2 = require("fs");
10371 var rp = require_fs();
10372 var minimatch = require_minimatch();
10373 var Minimatch = minimatch.Minimatch;
10374 var inherits2 = require_inherits();
10375 var EE = require("events").EventEmitter;
10376 var path2 = require("path");
10377 var assert = require("assert");
10378 var isAbsolute = require_path_is_absolute();
10379 var globSync = require_sync();
10380 var common2 = require_common();
10381 var alphasort = common2.alphasort;
10382 var alphasorti = common2.alphasorti;
10383 var setopts = common2.setopts;
10384 var ownProp = common2.ownProp;
10385 var inflight = require_inflight();
10386 var util = require("util");
10387 var childrenIgnored = common2.childrenIgnored;
10388 var isIgnored = common2.isIgnored;
10389 var once = require_once();
10390 function glob(pattern, options, cb) {
10391 if (typeof options === "function")
10392 cb = options, options = {};
10395 if (options.sync) {
10397 throw new TypeError("callback provided to sync glob");
10398 return globSync(pattern, options);
10400 return new Glob(pattern, options, cb);
10402 glob.sync = globSync;
10403 var GlobSync = glob.GlobSync = globSync.GlobSync;
10405 function extend(origin, add) {
10406 if (add === null || typeof add !== "object") {
10409 var keys = Object.keys(add);
10410 var i = keys.length;
10412 origin[keys[i]] = add[keys[i]];
10416 glob.hasMagic = function(pattern, options_) {
10417 var options = extend({}, options_);
10418 options.noprocess = true;
10419 var g = new Glob(pattern, options);
10420 var set = g.minimatch.set;
10423 if (set.length > 1)
10425 for (var j = 0; j < set[0].length; j++) {
10426 if (typeof set[0][j] !== "string")
10432 inherits2(Glob, EE);
10433 function Glob(pattern, options, cb) {
10434 if (typeof options === "function") {
10438 if (options && options.sync) {
10440 throw new TypeError("callback provided to sync glob");
10441 return new GlobSync(pattern, options);
10443 if (!(this instanceof Glob))
10444 return new Glob(pattern, options, cb);
10445 setopts(this, pattern, options);
10446 this._didRealPath = false;
10447 var n = this.minimatch.set.length;
10448 this.matches = new Array(n);
10449 if (typeof cb === "function") {
10451 this.on("error", cb);
10452 this.on("end", function(matches) {
10457 this._processing = 0;
10458 this._emitQueue = [];
10459 this._processQueue = [];
10460 this.paused = false;
10461 if (this.noprocess)
10466 for (var i = 0; i < n; i++) {
10467 this._process(this.minimatch.set[i], i, false, done);
10471 --self2._processing;
10472 if (self2._processing <= 0) {
10474 process.nextTick(function() {
10483 Glob.prototype._finish = function() {
10484 assert(this instanceof Glob);
10487 if (this.realpath && !this._didRealpath)
10488 return this._realpath();
10489 common2.finish(this);
10490 this.emit("end", this.found);
10492 Glob.prototype._realpath = function() {
10493 if (this._didRealpath)
10495 this._didRealpath = true;
10496 var n = this.matches.length;
10498 return this._finish();
10500 for (var i = 0; i < this.matches.length; i++)
10501 this._realpathSet(i, next);
10507 Glob.prototype._realpathSet = function(index, cb) {
10508 var matchset = this.matches[index];
10511 var found = Object.keys(matchset);
10513 var n = found.length;
10516 var set = this.matches[index] = Object.create(null);
10517 found.forEach(function(p, i) {
10518 p = self2._makeAbs(p);
10519 rp.realpath(p, self2.realpathCache, function(er, real) {
10522 else if (er.syscall === "stat")
10525 self2.emit("error", er);
10527 self2.matches[index] = set;
10533 Glob.prototype._mark = function(p) {
10534 return common2.mark(this, p);
10536 Glob.prototype._makeAbs = function(f) {
10537 return common2.makeAbs(this, f);
10539 Glob.prototype.abort = function() {
10540 this.aborted = true;
10541 this.emit("abort");
10543 Glob.prototype.pause = function() {
10544 if (!this.paused) {
10545 this.paused = true;
10546 this.emit("pause");
10549 Glob.prototype.resume = function() {
10551 this.emit("resume");
10552 this.paused = false;
10553 if (this._emitQueue.length) {
10554 var eq = this._emitQueue.slice(0);
10555 this._emitQueue.length = 0;
10556 for (var i = 0; i < eq.length; i++) {
10558 this._emitMatch(e[0], e[1]);
10561 if (this._processQueue.length) {
10562 var pq = this._processQueue.slice(0);
10563 this._processQueue.length = 0;
10564 for (var i = 0; i < pq.length; i++) {
10566 this._processing--;
10567 this._process(p[0], p[1], p[2], p[3]);
10572 Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
10573 assert(this instanceof Glob);
10574 assert(typeof cb === "function");
10577 this._processing++;
10579 this._processQueue.push([pattern, index, inGlobStar, cb]);
10583 while (typeof pattern[n] === "string") {
10588 case pattern.length:
10589 this._processSimple(pattern.join("/"), index, cb);
10595 prefix = pattern.slice(0, n).join("/");
10598 var remain = pattern.slice(n);
10600 if (prefix === null)
10602 else if (isAbsolute(prefix) || isAbsolute(pattern.join("/"))) {
10603 if (!prefix || !isAbsolute(prefix))
10604 prefix = "/" + prefix;
10608 var abs = this._makeAbs(read);
10609 if (childrenIgnored(this, read))
10611 var isGlobStar = remain[0] === minimatch.GLOBSTAR;
10613 this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
10615 this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
10617 Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
10619 this._readdir(abs, inGlobStar, function(er, entries) {
10620 return self2._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
10623 Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
10626 var pn = remain[0];
10627 var negate = !!this.minimatch.negate;
10628 var rawGlob = pn._glob;
10629 var dotOk = this.dot || rawGlob.charAt(0) === ".";
10630 var matchedEntries = [];
10631 for (var i = 0; i < entries.length; i++) {
10632 var e = entries[i];
10633 if (e.charAt(0) !== "." || dotOk) {
10635 if (negate && !prefix) {
10641 matchedEntries.push(e);
10644 var len = matchedEntries.length;
10647 if (remain.length === 1 && !this.mark && !this.stat) {
10648 if (!this.matches[index])
10649 this.matches[index] = Object.create(null);
10650 for (var i = 0; i < len; i++) {
10651 var e = matchedEntries[i];
10653 if (prefix !== "/")
10654 e = prefix + "/" + e;
10658 if (e.charAt(0) === "/" && !this.nomount) {
10659 e = path2.join(this.root, e);
10661 this._emitMatch(index, e);
10666 for (var i = 0; i < len; i++) {
10667 var e = matchedEntries[i];
10670 if (prefix !== "/")
10671 e = prefix + "/" + e;
10675 this._process([e].concat(remain), index, inGlobStar, cb);
10679 Glob.prototype._emitMatch = function(index, e) {
10682 if (isIgnored(this, e))
10685 this._emitQueue.push([index, e]);
10688 var abs = isAbsolute(e) ? e : this._makeAbs(e);
10693 if (this.matches[index][e])
10696 var c = this.cache[abs];
10697 if (c === "DIR" || Array.isArray(c))
10700 this.matches[index][e] = true;
10701 var st = this.statCache[abs];
10703 this.emit("stat", e, st);
10704 this.emit("match", e);
10706 Glob.prototype._readdirInGlobStar = function(abs, cb) {
10710 return this._readdir(abs, false, cb);
10711 var lstatkey = "lstat\0" + abs;
10713 var lstatcb = inflight(lstatkey, lstatcb_);
10715 fs2.lstat(abs, lstatcb);
10716 function lstatcb_(er, lstat) {
10717 if (er && er.code === "ENOENT")
10719 var isSym = lstat && lstat.isSymbolicLink();
10720 self2.symlinks[abs] = isSym;
10721 if (!isSym && lstat && !lstat.isDirectory()) {
10722 self2.cache[abs] = "FILE";
10725 self2._readdir(abs, false, cb);
10728 Glob.prototype._readdir = function(abs, inGlobStar, cb) {
10731 cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
10734 if (inGlobStar && !ownProp(this.symlinks, abs))
10735 return this._readdirInGlobStar(abs, cb);
10736 if (ownProp(this.cache, abs)) {
10737 var c = this.cache[abs];
10738 if (!c || c === "FILE")
10740 if (Array.isArray(c))
10741 return cb(null, c);
10744 fs2.readdir(abs, readdirCb(this, abs, cb));
10746 function readdirCb(self2, abs, cb) {
10747 return function(er, entries) {
10749 self2._readdirError(abs, er, cb);
10751 self2._readdirEntries(abs, entries, cb);
10754 Glob.prototype._readdirEntries = function(abs, entries, cb) {
10757 if (!this.mark && !this.stat) {
10758 for (var i = 0; i < entries.length; i++) {
10759 var e = entries[i];
10764 this.cache[e] = true;
10767 this.cache[abs] = entries;
10768 return cb(null, entries);
10770 Glob.prototype._readdirError = function(f, er, cb) {
10776 var abs = this._makeAbs(f);
10777 this.cache[abs] = "FILE";
10778 if (abs === this.cwdAbs) {
10779 var error = new Error(er.code + " invalid cwd " + this.cwd);
10780 error.path = this.cwd;
10781 error.code = er.code;
10782 this.emit("error", error);
10788 case "ENAMETOOLONG":
10790 this.cache[this._makeAbs(f)] = false;
10793 this.cache[this._makeAbs(f)] = false;
10795 this.emit("error", er);
10799 console.error("glob error", er);
10804 Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
10806 this._readdir(abs, inGlobStar, function(er, entries) {
10807 self2._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
10810 Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
10813 var remainWithoutGlobStar = remain.slice(1);
10814 var gspref = prefix ? [prefix] : [];
10815 var noGlobStar = gspref.concat(remainWithoutGlobStar);
10816 this._process(noGlobStar, index, false, cb);
10817 var isSym = this.symlinks[abs];
10818 var len = entries.length;
10819 if (isSym && inGlobStar)
10821 for (var i = 0; i < len; i++) {
10822 var e = entries[i];
10823 if (e.charAt(0) === "." && !this.dot)
10825 var instead = gspref.concat(entries[i], remainWithoutGlobStar);
10826 this._process(instead, index, true, cb);
10827 var below = gspref.concat(entries[i], remain);
10828 this._process(below, index, true, cb);
10832 Glob.prototype._processSimple = function(prefix, index, cb) {
10834 this._stat(prefix, function(er, exists) {
10835 self2._processSimple2(prefix, index, er, exists, cb);
10838 Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
10839 if (!this.matches[index])
10840 this.matches[index] = Object.create(null);
10843 if (prefix && isAbsolute(prefix) && !this.nomount) {
10844 var trail = /[\/\\]$/.test(prefix);
10845 if (prefix.charAt(0) === "/") {
10846 prefix = path2.join(this.root, prefix);
10848 prefix = path2.resolve(this.root, prefix);
10853 if (process.platform === "win32")
10854 prefix = prefix.replace(/\\/g, "/");
10855 this._emitMatch(index, prefix);
10858 Glob.prototype._stat = function(f, cb) {
10859 var abs = this._makeAbs(f);
10860 var needDir = f.slice(-1) === "/";
10861 if (f.length > this.maxLength)
10863 if (!this.stat && ownProp(this.cache, abs)) {
10864 var c = this.cache[abs];
10865 if (Array.isArray(c))
10867 if (!needDir || c === "DIR")
10868 return cb(null, c);
10869 if (needDir && c === "FILE")
10873 var stat = this.statCache[abs];
10874 if (stat !== void 0) {
10875 if (stat === false)
10876 return cb(null, stat);
10878 var type = stat.isDirectory() ? "DIR" : "FILE";
10879 if (needDir && type === "FILE")
10882 return cb(null, type, stat);
10886 var statcb = inflight("stat\0" + abs, lstatcb_);
10888 fs2.lstat(abs, statcb);
10889 function lstatcb_(er, lstat) {
10890 if (lstat && lstat.isSymbolicLink()) {
10891 return fs2.stat(abs, function(er2, stat2) {
10893 self2._stat2(f, abs, null, lstat, cb);
10895 self2._stat2(f, abs, er2, stat2, cb);
10898 self2._stat2(f, abs, er, lstat, cb);
10902 Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
10903 if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
10904 this.statCache[abs] = false;
10907 var needDir = f.slice(-1) === "/";
10908 this.statCache[abs] = stat;
10909 if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
10910 return cb(null, false, stat);
10913 c = stat.isDirectory() ? "DIR" : "FILE";
10914 this.cache[abs] = this.cache[abs] || c;
10915 if (needDir && c === "FILE")
10917 return cb(null, c, stat);
10922 // node_modules/rimraf/rimraf.js
10923 var require_rimraf = __commonJS({
10924 "node_modules/rimraf/rimraf.js"(exports2, module2) {
10925 var assert = require("assert");
10926 var path2 = require("path");
10927 var fs2 = require("fs");
10930 glob = require_glob();
10933 var defaultGlobOpts = {
10938 var isWindows = process.platform === "win32";
10939 var defaults = (options) => {
10948 methods.forEach((m) => {
10949 options[m] = options[m] || fs2[m];
10951 options[m] = options[m] || fs2[m];
10953 options.maxBusyTries = options.maxBusyTries || 3;
10954 options.emfileWait = options.emfileWait || 1e3;
10955 if (options.glob === false) {
10956 options.disableGlob = true;
10958 if (options.disableGlob !== true && glob === void 0) {
10959 throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
10961 options.disableGlob = options.disableGlob || false;
10962 options.glob = options.glob || defaultGlobOpts;
10964 var rimraf = (p, options, cb) => {
10965 if (typeof options === "function") {
10969 assert(p, "rimraf: missing path");
10970 assert.equal(typeof p, "string", "rimraf: path should be a string");
10971 assert.equal(typeof cb, "function", "rimraf: callback function required");
10972 assert(options, "rimraf: invalid options argument provided");
10973 assert.equal(typeof options, "object", "rimraf: options should be object");
10976 let errState = null;
10978 const next = (er) => {
10979 errState = errState || er;
10983 const afterGlob = (er, results2) => {
10986 n = results2.length;
10989 results2.forEach((p2) => {
10990 const CB = (er2) => {
10992 if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
10994 return setTimeout(() => rimraf_(p2, options, CB), busyTries * 100);
10996 if (er2.code === "EMFILE" && timeout < options.emfileWait) {
10997 return setTimeout(() => rimraf_(p2, options, CB), timeout++);
10999 if (er2.code === "ENOENT")
11005 rimraf_(p2, options, CB);
11008 if (options.disableGlob || !glob.hasMagic(p))
11009 return afterGlob(null, [p]);
11010 options.lstat(p, (er, stat) => {
11012 return afterGlob(null, [p]);
11013 glob(p, options.glob, afterGlob);
11016 var rimraf_ = (p, options, cb) => {
11019 assert(typeof cb === "function");
11020 options.lstat(p, (er, st) => {
11021 if (er && er.code === "ENOENT")
11023 if (er && er.code === "EPERM" && isWindows)
11024 fixWinEPERM(p, options, er, cb);
11025 if (st && st.isDirectory())
11026 return rmdir(p, options, er, cb);
11027 options.unlink(p, (er2) => {
11029 if (er2.code === "ENOENT")
11031 if (er2.code === "EPERM")
11032 return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
11033 if (er2.code === "EISDIR")
11034 return rmdir(p, options, er2, cb);
11040 var fixWinEPERM = (p, options, er, cb) => {
11043 assert(typeof cb === "function");
11044 options.chmod(p, 438, (er2) => {
11046 cb(er2.code === "ENOENT" ? null : er);
11048 options.stat(p, (er3, stats) => {
11050 cb(er3.code === "ENOENT" ? null : er);
11051 else if (stats.isDirectory())
11052 rmdir(p, options, er, cb);
11054 options.unlink(p, cb);
11058 var fixWinEPERMSync = (p, options, er) => {
11062 options.chmodSync(p, 438);
11064 if (er2.code === "ENOENT")
11071 stats = options.statSync(p);
11073 if (er3.code === "ENOENT")
11078 if (stats.isDirectory())
11079 rmdirSync(p, options, er);
11081 options.unlinkSync(p);
11083 var rmdir = (p, options, originalEr, cb) => {
11086 assert(typeof cb === "function");
11087 options.rmdir(p, (er) => {
11088 if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
11089 rmkids(p, options, cb);
11090 else if (er && er.code === "ENOTDIR")
11096 var rmkids = (p, options, cb) => {
11099 assert(typeof cb === "function");
11100 options.readdir(p, (er, files) => {
11103 let n = files.length;
11105 return options.rmdir(p, cb);
11107 files.forEach((f) => {
11108 rimraf(path2.join(p, f), options, (er2) => {
11112 return cb(errState = er2);
11114 options.rmdir(p, cb);
11119 var rimrafSync = (p, options) => {
11120 options = options || {};
11122 assert(p, "rimraf: missing path");
11123 assert.equal(typeof p, "string", "rimraf: path should be a string");
11124 assert(options, "rimraf: missing options");
11125 assert.equal(typeof options, "object", "rimraf: options should be object");
11127 if (options.disableGlob || !glob.hasMagic(p)) {
11131 options.lstatSync(p);
11134 results2 = glob.sync(p, options.glob);
11137 if (!results2.length)
11139 for (let i = 0; i < results2.length; i++) {
11140 const p2 = results2[i];
11143 st = options.lstatSync(p2);
11145 if (er.code === "ENOENT")
11147 if (er.code === "EPERM" && isWindows)
11148 fixWinEPERMSync(p2, options, er);
11151 if (st && st.isDirectory())
11152 rmdirSync(p2, options, null);
11154 options.unlinkSync(p2);
11156 if (er.code === "ENOENT")
11158 if (er.code === "EPERM")
11159 return isWindows ? fixWinEPERMSync(p2, options, er) : rmdirSync(p2, options, er);
11160 if (er.code !== "EISDIR")
11162 rmdirSync(p2, options, er);
11166 var rmdirSync = (p, options, originalEr) => {
11170 options.rmdirSync(p);
11172 if (er.code === "ENOENT")
11174 if (er.code === "ENOTDIR")
11176 if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
11177 rmkidsSync(p, options);
11180 var rmkidsSync = (p, options) => {
11183 options.readdirSync(p).forEach((f) => rimrafSync(path2.join(p, f), options));
11184 const retries = isWindows ? 100 : 1;
11189 const ret2 = options.rmdirSync(p, options);
11193 if (++i < retries && threw)
11198 module2.exports = rimraf;
11199 rimraf.sync = rimrafSync;
11203 // node_modules/semver/internal/constants.js
11204 var require_constants2 = __commonJS({
11205 "node_modules/semver/internal/constants.js"(exports2, module2) {
11206 var SEMVER_SPEC_VERSION = "2.0.0";
11207 var MAX_LENGTH = 256;
11208 var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
11209 var MAX_SAFE_COMPONENT_LENGTH = 16;
11210 module2.exports = {
11211 SEMVER_SPEC_VERSION,
11214 MAX_SAFE_COMPONENT_LENGTH
11219 // node_modules/semver/internal/debug.js
11220 var require_debug = __commonJS({
11221 "node_modules/semver/internal/debug.js"(exports2, module2) {
11222 var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
11224 module2.exports = debug;
11228 // node_modules/semver/internal/re.js
11229 var require_re = __commonJS({
11230 "node_modules/semver/internal/re.js"(exports2, module2) {
11231 var { MAX_SAFE_COMPONENT_LENGTH } = require_constants2();
11232 var debug = require_debug();
11233 exports2 = module2.exports = {};
11234 var re = exports2.re = [];
11235 var src = exports2.src = [];
11236 var t = exports2.t = {};
11238 var createToken = (name, value, isGlobal) => {
11240 debug(index, value);
11242 src[index] = value;
11243 re[index] = new RegExp(value, isGlobal ? "g" : void 0);
11245 createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
11246 createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
11247 createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
11248 createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
11249 createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
11250 createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
11251 createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
11252 createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
11253 createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
11254 createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
11255 createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
11256 createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
11257 createToken("FULL", `^${src[t.FULLPLAIN]}$`);
11258 createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
11259 createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
11260 createToken("GTLT", "((?:<|>)?=?)");
11261 createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
11262 createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
11263 createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
11264 createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
11265 createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
11266 createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
11267 createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
11268 createToken("COERCERTL", src[t.COERCE], true);
11269 createToken("LONETILDE", "(?:~>?)");
11270 createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
11271 exports2.tildeTrimReplace = "$1~";
11272 createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
11273 createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
11274 createToken("LONECARET", "(?:\\^)");
11275 createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
11276 exports2.caretTrimReplace = "$1^";
11277 createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
11278 createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
11279 createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
11280 createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
11281 createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
11282 exports2.comparatorTrimReplace = "$1$2$3";
11283 createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
11284 createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
11285 createToken("STAR", "(<|>)?=?\\s*\\*");
11286 createToken("GTE0", "^\\s*>=\\s*0.0.0\\s*$");
11287 createToken("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$");
11291 // node_modules/semver/internal/parse-options.js
11292 var require_parse_options = __commonJS({
11293 "node_modules/semver/internal/parse-options.js"(exports2, module2) {
11294 var opts = ["includePrerelease", "loose", "rtl"];
11295 var parseOptions = (options) => !options ? {} : typeof options !== "object" ? { loose: true } : opts.filter((k) => options[k]).reduce((options2, k) => {
11296 options2[k] = true;
11299 module2.exports = parseOptions;
11303 // node_modules/semver/internal/identifiers.js
11304 var require_identifiers = __commonJS({
11305 "node_modules/semver/internal/identifiers.js"(exports2, module2) {
11306 var numeric = /^[0-9]+$/;
11307 var compareIdentifiers = (a, b) => {
11308 const anum = numeric.test(a);
11309 const bnum = numeric.test(b);
11310 if (anum && bnum) {
11314 return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
11316 var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
11317 module2.exports = {
11318 compareIdentifiers,
11319 rcompareIdentifiers
11324 // node_modules/semver/classes/semver.js
11325 var require_semver = __commonJS({
11326 "node_modules/semver/classes/semver.js"(exports2, module2) {
11327 var debug = require_debug();
11328 var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants2();
11329 var { re, t } = require_re();
11330 var parseOptions = require_parse_options();
11331 var { compareIdentifiers } = require_identifiers();
11332 var SemVer = class {
11333 constructor(version, options) {
11334 options = parseOptions(options);
11335 if (version instanceof SemVer) {
11336 if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
11339 version = version.version;
11341 } else if (typeof version !== "string") {
11342 throw new TypeError(`Invalid Version: ${version}`);
11344 if (version.length > MAX_LENGTH) {
11345 throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
11347 debug("SemVer", version, options);
11348 this.options = options;
11349 this.loose = !!options.loose;
11350 this.includePrerelease = !!options.includePrerelease;
11351 const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
11353 throw new TypeError(`Invalid Version: ${version}`);
11355 this.raw = version;
11356 this.major = +m[1];
11357 this.minor = +m[2];
11358 this.patch = +m[3];
11359 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
11360 throw new TypeError("Invalid major version");
11362 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
11363 throw new TypeError("Invalid minor version");
11365 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
11366 throw new TypeError("Invalid patch version");
11369 this.prerelease = [];
11371 this.prerelease = m[4].split(".").map((id) => {
11372 if (/^[0-9]+$/.test(id)) {
11374 if (num >= 0 && num < MAX_SAFE_INTEGER) {
11381 this.build = m[5] ? m[5].split(".") : [];
11385 this.version = `${this.major}.${this.minor}.${this.patch}`;
11386 if (this.prerelease.length) {
11387 this.version += `-${this.prerelease.join(".")}`;
11389 return this.version;
11392 return this.version;
11395 debug("SemVer.compare", this.version, this.options, other);
11396 if (!(other instanceof SemVer)) {
11397 if (typeof other === "string" && other === this.version) {
11400 other = new SemVer(other, this.options);
11402 if (other.version === this.version) {
11405 return this.compareMain(other) || this.comparePre(other);
11407 compareMain(other) {
11408 if (!(other instanceof SemVer)) {
11409 other = new SemVer(other, this.options);
11411 return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
11413 comparePre(other) {
11414 if (!(other instanceof SemVer)) {
11415 other = new SemVer(other, this.options);
11417 if (this.prerelease.length && !other.prerelease.length) {
11419 } else if (!this.prerelease.length && other.prerelease.length) {
11421 } else if (!this.prerelease.length && !other.prerelease.length) {
11426 const a = this.prerelease[i];
11427 const b = other.prerelease[i];
11428 debug("prerelease compare", i, a, b);
11429 if (a === void 0 && b === void 0) {
11431 } else if (b === void 0) {
11433 } else if (a === void 0) {
11435 } else if (a === b) {
11438 return compareIdentifiers(a, b);
11442 compareBuild(other) {
11443 if (!(other instanceof SemVer)) {
11444 other = new SemVer(other, this.options);
11448 const a = this.build[i];
11449 const b = other.build[i];
11450 debug("prerelease compare", i, a, b);
11451 if (a === void 0 && b === void 0) {
11453 } else if (b === void 0) {
11455 } else if (a === void 0) {
11457 } else if (a === b) {
11460 return compareIdentifiers(a, b);
11464 inc(release, identifier) {
11467 this.prerelease.length = 0;
11471 this.inc("pre", identifier);
11474 this.prerelease.length = 0;
11477 this.inc("pre", identifier);
11480 this.prerelease.length = 0;
11481 this.inc("patch", identifier);
11482 this.inc("pre", identifier);
11485 if (this.prerelease.length === 0) {
11486 this.inc("patch", identifier);
11488 this.inc("pre", identifier);
11491 if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
11496 this.prerelease = [];
11499 if (this.patch !== 0 || this.prerelease.length === 0) {
11503 this.prerelease = [];
11506 if (this.prerelease.length === 0) {
11509 this.prerelease = [];
11512 if (this.prerelease.length === 0) {
11513 this.prerelease = [0];
11515 let i = this.prerelease.length;
11517 if (typeof this.prerelease[i] === "number") {
11518 this.prerelease[i]++;
11523 this.prerelease.push(0);
11527 if (this.prerelease[0] === identifier) {
11528 if (isNaN(this.prerelease[1])) {
11529 this.prerelease = [identifier, 0];
11532 this.prerelease = [identifier, 0];
11537 throw new Error(`invalid increment argument: ${release}`);
11540 this.raw = this.version;
11544 module2.exports = SemVer;
11548 // node_modules/semver/functions/parse.js
11549 var require_parse2 = __commonJS({
11550 "node_modules/semver/functions/parse.js"(exports2, module2) {
11551 var { MAX_LENGTH } = require_constants2();
11552 var { re, t } = require_re();
11553 var SemVer = require_semver();
11554 var parseOptions = require_parse_options();
11555 var parse = (version, options) => {
11556 options = parseOptions(options);
11557 if (version instanceof SemVer) {
11560 if (typeof version !== "string") {
11563 if (version.length > MAX_LENGTH) {
11566 const r = options.loose ? re[t.LOOSE] : re[t.FULL];
11567 if (!r.test(version)) {
11571 return new SemVer(version, options);
11576 module2.exports = parse;
11580 // node_modules/semver/functions/valid.js
11581 var require_valid = __commonJS({
11582 "node_modules/semver/functions/valid.js"(exports2, module2) {
11583 var parse = require_parse2();
11584 var valid = (version, options) => {
11585 const v = parse(version, options);
11586 return v ? v.version : null;
11588 module2.exports = valid;
11592 // node_modules/semver/functions/clean.js
11593 var require_clean = __commonJS({
11594 "node_modules/semver/functions/clean.js"(exports2, module2) {
11595 var parse = require_parse2();
11596 var clean = (version, options) => {
11597 const s = parse(version.trim().replace(/^[=v]+/, ""), options);
11598 return s ? s.version : null;
11600 module2.exports = clean;
11604 // node_modules/semver/functions/inc.js
11605 var require_inc = __commonJS({
11606 "node_modules/semver/functions/inc.js"(exports2, module2) {
11607 var SemVer = require_semver();
11608 var inc = (version, release, options, identifier) => {
11609 if (typeof options === "string") {
11610 identifier = options;
11614 return new SemVer(version, options).inc(release, identifier).version;
11619 module2.exports = inc;
11623 // node_modules/semver/functions/compare.js
11624 var require_compare = __commonJS({
11625 "node_modules/semver/functions/compare.js"(exports2, module2) {
11626 var SemVer = require_semver();
11627 var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
11628 module2.exports = compare;
11632 // node_modules/semver/functions/eq.js
11633 var require_eq = __commonJS({
11634 "node_modules/semver/functions/eq.js"(exports2, module2) {
11635 var compare = require_compare();
11636 var eq = (a, b, loose) => compare(a, b, loose) === 0;
11637 module2.exports = eq;
11641 // node_modules/semver/functions/diff.js
11642 var require_diff = __commonJS({
11643 "node_modules/semver/functions/diff.js"(exports2, module2) {
11644 var parse = require_parse2();
11645 var eq = require_eq();
11646 var diff = (version1, version2) => {
11647 if (eq(version1, version2)) {
11650 const v1 = parse(version1);
11651 const v2 = parse(version2);
11652 const hasPre = v1.prerelease.length || v2.prerelease.length;
11653 const prefix = hasPre ? "pre" : "";
11654 const defaultResult = hasPre ? "prerelease" : "";
11655 for (const key in v1) {
11656 if (key === "major" || key === "minor" || key === "patch") {
11657 if (v1[key] !== v2[key]) {
11658 return prefix + key;
11662 return defaultResult;
11665 module2.exports = diff;
11669 // node_modules/semver/functions/major.js
11670 var require_major = __commonJS({
11671 "node_modules/semver/functions/major.js"(exports2, module2) {
11672 var SemVer = require_semver();
11673 var major = (a, loose) => new SemVer(a, loose).major;
11674 module2.exports = major;
11678 // node_modules/semver/functions/minor.js
11679 var require_minor = __commonJS({
11680 "node_modules/semver/functions/minor.js"(exports2, module2) {
11681 var SemVer = require_semver();
11682 var minor = (a, loose) => new SemVer(a, loose).minor;
11683 module2.exports = minor;
11687 // node_modules/semver/functions/patch.js
11688 var require_patch = __commonJS({
11689 "node_modules/semver/functions/patch.js"(exports2, module2) {
11690 var SemVer = require_semver();
11691 var patch = (a, loose) => new SemVer(a, loose).patch;
11692 module2.exports = patch;
11696 // node_modules/semver/functions/prerelease.js
11697 var require_prerelease = __commonJS({
11698 "node_modules/semver/functions/prerelease.js"(exports2, module2) {
11699 var parse = require_parse2();
11700 var prerelease = (version, options) => {
11701 const parsed = parse(version, options);
11702 return parsed && parsed.prerelease.length ? parsed.prerelease : null;
11704 module2.exports = prerelease;
11708 // node_modules/semver/functions/rcompare.js
11709 var require_rcompare = __commonJS({
11710 "node_modules/semver/functions/rcompare.js"(exports2, module2) {
11711 var compare = require_compare();
11712 var rcompare = (a, b, loose) => compare(b, a, loose);
11713 module2.exports = rcompare;
11717 // node_modules/semver/functions/compare-loose.js
11718 var require_compare_loose = __commonJS({
11719 "node_modules/semver/functions/compare-loose.js"(exports2, module2) {
11720 var compare = require_compare();
11721 var compareLoose = (a, b) => compare(a, b, true);
11722 module2.exports = compareLoose;
11726 // node_modules/semver/functions/compare-build.js
11727 var require_compare_build = __commonJS({
11728 "node_modules/semver/functions/compare-build.js"(exports2, module2) {
11729 var SemVer = require_semver();
11730 var compareBuild = (a, b, loose) => {
11731 const versionA = new SemVer(a, loose);
11732 const versionB = new SemVer(b, loose);
11733 return versionA.compare(versionB) || versionA.compareBuild(versionB);
11735 module2.exports = compareBuild;
11739 // node_modules/semver/functions/sort.js
11740 var require_sort = __commonJS({
11741 "node_modules/semver/functions/sort.js"(exports2, module2) {
11742 var compareBuild = require_compare_build();
11743 var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
11744 module2.exports = sort;
11748 // node_modules/semver/functions/rsort.js
11749 var require_rsort = __commonJS({
11750 "node_modules/semver/functions/rsort.js"(exports2, module2) {
11751 var compareBuild = require_compare_build();
11752 var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
11753 module2.exports = rsort;
11757 // node_modules/semver/functions/gt.js
11758 var require_gt = __commonJS({
11759 "node_modules/semver/functions/gt.js"(exports2, module2) {
11760 var compare = require_compare();
11761 var gt = (a, b, loose) => compare(a, b, loose) > 0;
11762 module2.exports = gt;
11766 // node_modules/semver/functions/lt.js
11767 var require_lt = __commonJS({
11768 "node_modules/semver/functions/lt.js"(exports2, module2) {
11769 var compare = require_compare();
11770 var lt = (a, b, loose) => compare(a, b, loose) < 0;
11771 module2.exports = lt;
11775 // node_modules/semver/functions/neq.js
11776 var require_neq = __commonJS({
11777 "node_modules/semver/functions/neq.js"(exports2, module2) {
11778 var compare = require_compare();
11779 var neq = (a, b, loose) => compare(a, b, loose) !== 0;
11780 module2.exports = neq;
11784 // node_modules/semver/functions/gte.js
11785 var require_gte = __commonJS({
11786 "node_modules/semver/functions/gte.js"(exports2, module2) {
11787 var compare = require_compare();
11788 var gte = (a, b, loose) => compare(a, b, loose) >= 0;
11789 module2.exports = gte;
11793 // node_modules/semver/functions/lte.js
11794 var require_lte = __commonJS({
11795 "node_modules/semver/functions/lte.js"(exports2, module2) {
11796 var compare = require_compare();
11797 var lte = (a, b, loose) => compare(a, b, loose) <= 0;
11798 module2.exports = lte;
11802 // node_modules/semver/functions/cmp.js
11803 var require_cmp = __commonJS({
11804 "node_modules/semver/functions/cmp.js"(exports2, module2) {
11805 var eq = require_eq();
11806 var neq = require_neq();
11807 var gt = require_gt();
11808 var gte = require_gte();
11809 var lt = require_lt();
11810 var lte = require_lte();
11811 var cmp = (a, op, b, loose) => {
11814 if (typeof a === "object")
11816 if (typeof b === "object")
11820 if (typeof a === "object")
11822 if (typeof b === "object")
11828 return eq(a, b, loose);
11830 return neq(a, b, loose);
11832 return gt(a, b, loose);
11834 return gte(a, b, loose);
11836 return lt(a, b, loose);
11838 return lte(a, b, loose);
11840 throw new TypeError(`Invalid operator: ${op}`);
11843 module2.exports = cmp;
11847 // node_modules/semver/functions/coerce.js
11848 var require_coerce = __commonJS({
11849 "node_modules/semver/functions/coerce.js"(exports2, module2) {
11850 var SemVer = require_semver();
11851 var parse = require_parse2();
11852 var { re, t } = require_re();
11853 var coerce = (version, options) => {
11854 if (version instanceof SemVer) {
11857 if (typeof version === "number") {
11858 version = String(version);
11860 if (typeof version !== "string") {
11863 options = options || {};
11865 if (!options.rtl) {
11866 match = version.match(re[t.COERCE]);
11869 while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
11870 if (!match || next.index + next[0].length !== match.index + match[0].length) {
11873 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
11875 re[t.COERCERTL].lastIndex = -1;
11877 if (match === null)
11879 return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
11881 module2.exports = coerce;
11885 // node_modules/yallist/iterator.js
11886 var require_iterator = __commonJS({
11887 "node_modules/yallist/iterator.js"(exports2, module2) {
11889 module2.exports = function(Yallist) {
11890 Yallist.prototype[Symbol.iterator] = function* () {
11891 for (let walker = this.head; walker; walker = walker.next) {
11892 yield walker.value;
11899 // node_modules/yallist/yallist.js
11900 var require_yallist = __commonJS({
11901 "node_modules/yallist/yallist.js"(exports2, module2) {
11903 module2.exports = Yallist;
11904 Yallist.Node = Node;
11905 Yallist.create = Yallist;
11906 function Yallist(list) {
11908 if (!(self2 instanceof Yallist)) {
11909 self2 = new Yallist();
11914 if (list && typeof list.forEach === "function") {
11915 list.forEach(function(item) {
11918 } else if (arguments.length > 0) {
11919 for (var i = 0, l2 = arguments.length; i < l2; i++) {
11920 self2.push(arguments[i]);
11925 Yallist.prototype.removeNode = function(node) {
11926 if (node.list !== this) {
11927 throw new Error("removing node which does not belong to this list");
11929 var next = node.next;
11930 var prev = node.prev;
11937 if (node === this.head) {
11940 if (node === this.tail) {
11943 node.list.length--;
11949 Yallist.prototype.unshiftNode = function(node) {
11950 if (node === this.head) {
11954 node.list.removeNode(node);
11956 var head = this.head;
11968 Yallist.prototype.pushNode = function(node) {
11969 if (node === this.tail) {
11973 node.list.removeNode(node);
11975 var tail = this.tail;
11987 Yallist.prototype.push = function() {
11988 for (var i = 0, l2 = arguments.length; i < l2; i++) {
11989 push(this, arguments[i]);
11991 return this.length;
11993 Yallist.prototype.unshift = function() {
11994 for (var i = 0, l2 = arguments.length; i < l2; i++) {
11995 unshift(this, arguments[i]);
11997 return this.length;
11999 Yallist.prototype.pop = function() {
12003 var res = this.tail.value;
12004 this.tail = this.tail.prev;
12006 this.tail.next = null;
12013 Yallist.prototype.shift = function() {
12017 var res = this.head.value;
12018 this.head = this.head.next;
12020 this.head.prev = null;
12027 Yallist.prototype.forEach = function(fn, thisp) {
12028 thisp = thisp || this;
12029 for (var walker = this.head, i = 0; walker !== null; i++) {
12030 fn.call(thisp, walker.value, i, this);
12031 walker = walker.next;
12034 Yallist.prototype.forEachReverse = function(fn, thisp) {
12035 thisp = thisp || this;
12036 for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
12037 fn.call(thisp, walker.value, i, this);
12038 walker = walker.prev;
12041 Yallist.prototype.get = function(n) {
12042 for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
12043 walker = walker.next;
12045 if (i === n && walker !== null) {
12046 return walker.value;
12049 Yallist.prototype.getReverse = function(n) {
12050 for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
12051 walker = walker.prev;
12053 if (i === n && walker !== null) {
12054 return walker.value;
12057 Yallist.prototype.map = function(fn, thisp) {
12058 thisp = thisp || this;
12059 var res = new Yallist();
12060 for (var walker = this.head; walker !== null; ) {
12061 res.push(fn.call(thisp, walker.value, this));
12062 walker = walker.next;
12066 Yallist.prototype.mapReverse = function(fn, thisp) {
12067 thisp = thisp || this;
12068 var res = new Yallist();
12069 for (var walker = this.tail; walker !== null; ) {
12070 res.push(fn.call(thisp, walker.value, this));
12071 walker = walker.prev;
12075 Yallist.prototype.reduce = function(fn, initial) {
12077 var walker = this.head;
12078 if (arguments.length > 1) {
12080 } else if (this.head) {
12081 walker = this.head.next;
12082 acc = this.head.value;
12084 throw new TypeError("Reduce of empty list with no initial value");
12086 for (var i = 0; walker !== null; i++) {
12087 acc = fn(acc, walker.value, i);
12088 walker = walker.next;
12092 Yallist.prototype.reduceReverse = function(fn, initial) {
12094 var walker = this.tail;
12095 if (arguments.length > 1) {
12097 } else if (this.tail) {
12098 walker = this.tail.prev;
12099 acc = this.tail.value;
12101 throw new TypeError("Reduce of empty list with no initial value");
12103 for (var i = this.length - 1; walker !== null; i--) {
12104 acc = fn(acc, walker.value, i);
12105 walker = walker.prev;
12109 Yallist.prototype.toArray = function() {
12110 var arr = new Array(this.length);
12111 for (var i = 0, walker = this.head; walker !== null; i++) {
12112 arr[i] = walker.value;
12113 walker = walker.next;
12117 Yallist.prototype.toArrayReverse = function() {
12118 var arr = new Array(this.length);
12119 for (var i = 0, walker = this.tail; walker !== null; i++) {
12120 arr[i] = walker.value;
12121 walker = walker.prev;
12125 Yallist.prototype.slice = function(from, to) {
12126 to = to || this.length;
12132 from += this.length;
12134 var ret2 = new Yallist();
12135 if (to < from || to < 0) {
12141 if (to > this.length) {
12144 for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
12145 walker = walker.next;
12147 for (; walker !== null && i < to; i++, walker = walker.next) {
12148 ret2.push(walker.value);
12152 Yallist.prototype.sliceReverse = function(from, to) {
12153 to = to || this.length;
12159 from += this.length;
12161 var ret2 = new Yallist();
12162 if (to < from || to < 0) {
12168 if (to > this.length) {
12171 for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
12172 walker = walker.prev;
12174 for (; walker !== null && i > from; i--, walker = walker.prev) {
12175 ret2.push(walker.value);
12179 Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
12180 if (start > this.length) {
12181 start = this.length - 1;
12184 start = this.length + start;
12186 for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
12187 walker = walker.next;
12190 for (var i = 0; walker && i < deleteCount; i++) {
12191 ret2.push(walker.value);
12192 walker = this.removeNode(walker);
12194 if (walker === null) {
12195 walker = this.tail;
12197 if (walker !== this.head && walker !== this.tail) {
12198 walker = walker.prev;
12200 for (var i = 0; i < nodes.length; i++) {
12201 walker = insert(this, walker, nodes[i]);
12205 Yallist.prototype.reverse = function() {
12206 var head = this.head;
12207 var tail = this.tail;
12208 for (var walker = head; walker !== null; walker = walker.prev) {
12209 var p = walker.prev;
12210 walker.prev = walker.next;
12217 function insert(self2, node, value) {
12218 var inserted = node === self2.head ? new Node(value, null, node, self2) : new Node(value, node, node.next, self2);
12219 if (inserted.next === null) {
12220 self2.tail = inserted;
12222 if (inserted.prev === null) {
12223 self2.head = inserted;
12228 function push(self2, item) {
12229 self2.tail = new Node(item, self2.tail, null, self2);
12231 self2.head = self2.tail;
12235 function unshift(self2, item) {
12236 self2.head = new Node(item, null, self2.head, self2);
12238 self2.tail = self2.head;
12242 function Node(value, prev, next, list) {
12243 if (!(this instanceof Node)) {
12244 return new Node(value, prev, next, list);
12247 this.value = value;
12262 require_iterator()(Yallist);
12268 // node_modules/lru-cache/index.js
12269 var require_lru_cache = __commonJS({
12270 "node_modules/lru-cache/index.js"(exports2, module2) {
12272 var Yallist = require_yallist();
12273 var MAX = Symbol("max");
12274 var LENGTH = Symbol("length");
12275 var LENGTH_CALCULATOR = Symbol("lengthCalculator");
12276 var ALLOW_STALE = Symbol("allowStale");
12277 var MAX_AGE = Symbol("maxAge");
12278 var DISPOSE = Symbol("dispose");
12279 var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
12280 var LRU_LIST = Symbol("lruList");
12281 var CACHE = Symbol("cache");
12282 var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
12283 var naiveLength = () => 1;
12284 var LRUCache = class {
12285 constructor(options) {
12286 if (typeof options === "number")
12287 options = { max: options };
12290 if (options.max && (typeof options.max !== "number" || options.max < 0))
12291 throw new TypeError("max must be a non-negative number");
12292 const max = this[MAX] = options.max || Infinity;
12293 const lc = options.length || naiveLength;
12294 this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
12295 this[ALLOW_STALE] = options.stale || false;
12296 if (options.maxAge && typeof options.maxAge !== "number")
12297 throw new TypeError("maxAge must be a number");
12298 this[MAX_AGE] = options.maxAge || 0;
12299 this[DISPOSE] = options.dispose;
12300 this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
12301 this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
12305 if (typeof mL !== "number" || mL < 0)
12306 throw new TypeError("max must be a non-negative number");
12307 this[MAX] = mL || Infinity;
12313 set allowStale(allowStale) {
12314 this[ALLOW_STALE] = !!allowStale;
12317 return this[ALLOW_STALE];
12320 if (typeof mA !== "number")
12321 throw new TypeError("maxAge must be a non-negative number");
12322 this[MAX_AGE] = mA;
12326 return this[MAX_AGE];
12328 set lengthCalculator(lC) {
12329 if (typeof lC !== "function")
12331 if (lC !== this[LENGTH_CALCULATOR]) {
12332 this[LENGTH_CALCULATOR] = lC;
12334 this[LRU_LIST].forEach((hit) => {
12335 hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
12336 this[LENGTH] += hit.length;
12341 get lengthCalculator() {
12342 return this[LENGTH_CALCULATOR];
12345 return this[LENGTH];
12348 return this[LRU_LIST].length;
12350 rforEach(fn, thisp) {
12351 thisp = thisp || this;
12352 for (let walker = this[LRU_LIST].tail; walker !== null; ) {
12353 const prev = walker.prev;
12354 forEachStep(this, fn, walker, thisp);
12358 forEach(fn, thisp) {
12359 thisp = thisp || this;
12360 for (let walker = this[LRU_LIST].head; walker !== null; ) {
12361 const next = walker.next;
12362 forEachStep(this, fn, walker, thisp);
12367 return this[LRU_LIST].toArray().map((k) => k.key);
12370 return this[LRU_LIST].toArray().map((k) => k.value);
12373 if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
12374 this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
12376 this[CACHE] = new Map();
12377 this[LRU_LIST] = new Yallist();
12381 return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
12384 e: hit.now + (hit.maxAge || 0)
12385 }).toArray().filter((h) => h);
12388 return this[LRU_LIST];
12390 set(key, value, maxAge) {
12391 maxAge = maxAge || this[MAX_AGE];
12392 if (maxAge && typeof maxAge !== "number")
12393 throw new TypeError("maxAge must be a number");
12394 const now = maxAge ? Date.now() : 0;
12395 const len = this[LENGTH_CALCULATOR](value, key);
12396 if (this[CACHE].has(key)) {
12397 if (len > this[MAX]) {
12398 del(this, this[CACHE].get(key));
12401 const node = this[CACHE].get(key);
12402 const item = node.value;
12403 if (this[DISPOSE]) {
12404 if (!this[NO_DISPOSE_ON_SET])
12405 this[DISPOSE](key, item.value);
12408 item.maxAge = maxAge;
12409 item.value = value;
12410 this[LENGTH] += len - item.length;
12416 const hit = new Entry(key, value, len, now, maxAge);
12417 if (hit.length > this[MAX]) {
12419 this[DISPOSE](key, value);
12422 this[LENGTH] += hit.length;
12423 this[LRU_LIST].unshift(hit);
12424 this[CACHE].set(key, this[LRU_LIST].head);
12429 if (!this[CACHE].has(key))
12431 const hit = this[CACHE].get(key).value;
12432 return !isStale(this, hit);
12435 return get(this, key, true);
12438 return get(this, key, false);
12441 const node = this[LRU_LIST].tail;
12448 del(this, this[CACHE].get(key));
12452 const now = Date.now();
12453 for (let l2 = arr.length - 1; l2 >= 0; l2--) {
12454 const hit = arr[l2];
12455 const expiresAt = hit.e || 0;
12456 if (expiresAt === 0)
12457 this.set(hit.k, hit.v);
12459 const maxAge = expiresAt - now;
12461 this.set(hit.k, hit.v, maxAge);
12467 this[CACHE].forEach((value, key) => get(this, key, false));
12470 var get = (self2, key, doUse) => {
12471 const node = self2[CACHE].get(key);
12473 const hit = node.value;
12474 if (isStale(self2, hit)) {
12476 if (!self2[ALLOW_STALE])
12480 if (self2[UPDATE_AGE_ON_GET])
12481 node.value.now = Date.now();
12482 self2[LRU_LIST].unshiftNode(node);
12488 var isStale = (self2, hit) => {
12489 if (!hit || !hit.maxAge && !self2[MAX_AGE])
12491 const diff = Date.now() - hit.now;
12492 return hit.maxAge ? diff > hit.maxAge : self2[MAX_AGE] && diff > self2[MAX_AGE];
12494 var trim = (self2) => {
12495 if (self2[LENGTH] > self2[MAX]) {
12496 for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
12497 const prev = walker.prev;
12498 del(self2, walker);
12503 var del = (self2, node) => {
12505 const hit = node.value;
12506 if (self2[DISPOSE])
12507 self2[DISPOSE](hit.key, hit.value);
12508 self2[LENGTH] -= hit.length;
12509 self2[CACHE].delete(hit.key);
12510 self2[LRU_LIST].removeNode(node);
12513 var Entry = class {
12514 constructor(key, value, length, now, maxAge) {
12516 this.value = value;
12517 this.length = length;
12519 this.maxAge = maxAge || 0;
12522 var forEachStep = (self2, fn, node, thisp) => {
12523 let hit = node.value;
12524 if (isStale(self2, hit)) {
12526 if (!self2[ALLOW_STALE])
12530 fn.call(thisp, hit.value, hit.key, self2);
12532 module2.exports = LRUCache;
12536 // node_modules/semver/classes/range.js
12537 var require_range = __commonJS({
12538 "node_modules/semver/classes/range.js"(exports2, module2) {
12539 var Range5 = class {
12540 constructor(range, options) {
12541 options = parseOptions(options);
12542 if (range instanceof Range5) {
12543 if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
12546 return new Range5(range.raw, options);
12549 if (range instanceof Comparator) {
12550 this.raw = range.value;
12551 this.set = [[range]];
12555 this.options = options;
12556 this.loose = !!options.loose;
12557 this.includePrerelease = !!options.includePrerelease;
12559 this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length);
12560 if (!this.set.length) {
12561 throw new TypeError(`Invalid SemVer Range: ${range}`);
12563 if (this.set.length > 1) {
12564 const first = this.set[0];
12565 this.set = this.set.filter((c) => !isNullSet(c[0]));
12566 if (this.set.length === 0)
12567 this.set = [first];
12568 else if (this.set.length > 1) {
12569 for (const c of this.set) {
12570 if (c.length === 1 && isAny(c[0])) {
12580 this.range = this.set.map((comps) => {
12581 return comps.join(" ").trim();
12582 }).join("||").trim();
12588 parseRange(range) {
12589 range = range.trim();
12590 const memoOpts = Object.keys(this.options).join(",");
12591 const memoKey = `parseRange:${memoOpts}:${range}`;
12592 const cached = cache.get(memoKey);
12595 const loose = this.options.loose;
12596 const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
12597 range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
12598 debug("hyphen replace", range);
12599 range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
12600 debug("comparator trim", range, re[t.COMPARATORTRIM]);
12601 range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
12602 range = range.replace(re[t.CARETTRIM], caretTrimReplace);
12603 range = range.split(/\s+/).join(" ");
12604 const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
12605 const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options));
12606 const l2 = rangeList.length;
12607 const rangeMap = new Map();
12608 for (const comp of rangeList) {
12609 if (isNullSet(comp))
12611 rangeMap.set(comp.value, comp);
12613 if (rangeMap.size > 1 && rangeMap.has(""))
12614 rangeMap.delete("");
12615 const result = [...rangeMap.values()];
12616 cache.set(memoKey, result);
12619 intersects(range, options) {
12620 if (!(range instanceof Range5)) {
12621 throw new TypeError("a Range is required");
12623 return this.set.some((thisComparators) => {
12624 return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
12625 return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
12626 return rangeComparators.every((rangeComparator) => {
12627 return thisComparator.intersects(rangeComparator, options);
12637 if (typeof version === "string") {
12639 version = new SemVer(version, this.options);
12644 for (let i = 0; i < this.set.length; i++) {
12645 if (testSet(this.set[i], version, this.options)) {
12652 module2.exports = Range5;
12653 var LRU = require_lru_cache();
12654 var cache = new LRU({ max: 1e3 });
12655 var parseOptions = require_parse_options();
12656 var Comparator = require_comparator();
12657 var debug = require_debug();
12658 var SemVer = require_semver();
12662 comparatorTrimReplace,
12666 var isNullSet = (c) => c.value === "<0.0.0-0";
12667 var isAny = (c) => c.value === "";
12668 var isSatisfiable = (comparators, options) => {
12670 const remainingComparators = comparators.slice();
12671 let testComparator = remainingComparators.pop();
12672 while (result && remainingComparators.length) {
12673 result = remainingComparators.every((otherComparator) => {
12674 return testComparator.intersects(otherComparator, options);
12676 testComparator = remainingComparators.pop();
12680 var parseComparator = (comp, options) => {
12681 debug("comp", comp, options);
12682 comp = replaceCarets(comp, options);
12683 debug("caret", comp);
12684 comp = replaceTildes(comp, options);
12685 debug("tildes", comp);
12686 comp = replaceXRanges(comp, options);
12687 debug("xrange", comp);
12688 comp = replaceStars(comp, options);
12689 debug("stars", comp);
12692 var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
12693 var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
12694 return replaceTilde(comp2, options);
12696 var replaceTilde = (comp, options) => {
12697 const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
12698 return comp.replace(r, (_, M, m, p, pr) => {
12699 debug("tilde", comp, _, M, m, p, pr);
12703 } else if (isX(m)) {
12704 ret2 = `>=${M}.0.0 <${+M + 1}.0.0-0`;
12705 } else if (isX(p)) {
12706 ret2 = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
12708 debug("replaceTilde pr", pr);
12709 ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
12711 ret2 = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
12713 debug("tilde return", ret2);
12717 var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
12718 return replaceCaret(comp2, options);
12720 var replaceCaret = (comp, options) => {
12721 debug("caret", comp, options);
12722 const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
12723 const z = options.includePrerelease ? "-0" : "";
12724 return comp.replace(r, (_, M, m, p, pr) => {
12725 debug("caret", comp, _, M, m, p, pr);
12729 } else if (isX(m)) {
12730 ret2 = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
12731 } else if (isX(p)) {
12733 ret2 = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
12735 ret2 = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
12738 debug("replaceCaret pr", pr);
12741 ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
12743 ret2 = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
12746 ret2 = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
12752 ret2 = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
12754 ret2 = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
12757 ret2 = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
12760 debug("caret return", ret2);
12764 var replaceXRanges = (comp, options) => {
12765 debug("replaceXRanges", comp, options);
12766 return comp.split(/\s+/).map((comp2) => {
12767 return replaceXRange(comp2, options);
12770 var replaceXRange = (comp, options) => {
12771 comp = comp.trim();
12772 const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
12773 return comp.replace(r, (ret2, gtlt, M, m, p, pr) => {
12774 debug("xRange", comp, ret2, gtlt, M, m, p, pr);
12776 const xm = xM || isX(m);
12777 const xp = xm || isX(p);
12779 if (gtlt === "=" && anyX) {
12782 pr = options.includePrerelease ? "-0" : "";
12784 if (gtlt === ">" || gtlt === "<") {
12789 } else if (gtlt && anyX) {
12794 if (gtlt === ">") {
12804 } else if (gtlt === "<=") {
12814 ret2 = `${gtlt + M}.${m}.${p}${pr}`;
12816 ret2 = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
12818 ret2 = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
12820 debug("xRange return", ret2);
12824 var replaceStars = (comp, options) => {
12825 debug("replaceStars", comp, options);
12826 return comp.trim().replace(re[t.STAR], "");
12828 var replaceGTE0 = (comp, options) => {
12829 debug("replaceGTE0", comp, options);
12830 return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
12832 var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
12835 } else if (isX(fm)) {
12836 from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
12837 } else if (isX(fp)) {
12838 from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
12840 from = `>=${from}`;
12842 from = `>=${from}${incPr ? "-0" : ""}`;
12846 } else if (isX(tm)) {
12847 to = `<${+tM + 1}.0.0-0`;
12848 } else if (isX(tp)) {
12849 to = `<${tM}.${+tm + 1}.0-0`;
12851 to = `<=${tM}.${tm}.${tp}-${tpr}`;
12852 } else if (incPr) {
12853 to = `<${tM}.${tm}.${+tp + 1}-0`;
12857 return `${from} ${to}`.trim();
12859 var testSet = (set, version, options) => {
12860 for (let i = 0; i < set.length; i++) {
12861 if (!set[i].test(version)) {
12865 if (version.prerelease.length && !options.includePrerelease) {
12866 for (let i = 0; i < set.length; i++) {
12867 debug(set[i].semver);
12868 if (set[i].semver === Comparator.ANY) {
12871 if (set[i].semver.prerelease.length > 0) {
12872 const allowed = set[i].semver;
12873 if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
12885 // node_modules/semver/classes/comparator.js
12886 var require_comparator = __commonJS({
12887 "node_modules/semver/classes/comparator.js"(exports2, module2) {
12888 var ANY = Symbol("SemVer ANY");
12889 var Comparator = class {
12893 constructor(comp, options) {
12894 options = parseOptions(options);
12895 if (comp instanceof Comparator) {
12896 if (comp.loose === !!options.loose) {
12902 debug("comparator", comp, options);
12903 this.options = options;
12904 this.loose = !!options.loose;
12906 if (this.semver === ANY) {
12909 this.value = this.operator + this.semver.version;
12911 debug("comp", this);
12914 const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
12915 const m = comp.match(r);
12917 throw new TypeError(`Invalid comparator: ${comp}`);
12919 this.operator = m[1] !== void 0 ? m[1] : "";
12920 if (this.operator === "=") {
12921 this.operator = "";
12926 this.semver = new SemVer(m[2], this.options.loose);
12933 debug("Comparator.test", version, this.options.loose);
12934 if (this.semver === ANY || version === ANY) {
12937 if (typeof version === "string") {
12939 version = new SemVer(version, this.options);
12944 return cmp(version, this.operator, this.semver, this.options);
12946 intersects(comp, options) {
12947 if (!(comp instanceof Comparator)) {
12948 throw new TypeError("a Comparator is required");
12950 if (!options || typeof options !== "object") {
12953 includePrerelease: false
12956 if (this.operator === "") {
12957 if (this.value === "") {
12960 return new Range5(comp.value, options).test(this.value);
12961 } else if (comp.operator === "") {
12962 if (comp.value === "") {
12965 return new Range5(this.value, options).test(comp.semver);
12967 const sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
12968 const sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
12969 const sameSemVer = this.semver.version === comp.semver.version;
12970 const differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
12971 const oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<");
12972 const oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">");
12973 return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
12976 module2.exports = Comparator;
12977 var parseOptions = require_parse_options();
12978 var { re, t } = require_re();
12979 var cmp = require_cmp();
12980 var debug = require_debug();
12981 var SemVer = require_semver();
12982 var Range5 = require_range();
12986 // node_modules/semver/functions/satisfies.js
12987 var require_satisfies = __commonJS({
12988 "node_modules/semver/functions/satisfies.js"(exports2, module2) {
12989 var Range5 = require_range();
12990 var satisfies = (version, range, options) => {
12992 range = new Range5(range, options);
12996 return range.test(version);
12998 module2.exports = satisfies;
13002 // node_modules/semver/ranges/to-comparators.js
13003 var require_to_comparators = __commonJS({
13004 "node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
13005 var Range5 = require_range();
13006 var toComparators = (range, options) => new Range5(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
13007 module2.exports = toComparators;
13011 // node_modules/semver/ranges/max-satisfying.js
13012 var require_max_satisfying = __commonJS({
13013 "node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
13014 var SemVer = require_semver();
13015 var Range5 = require_range();
13016 var maxSatisfying = (versions, range, options) => {
13019 let rangeObj = null;
13021 rangeObj = new Range5(range, options);
13025 versions.forEach((v) => {
13026 if (rangeObj.test(v)) {
13027 if (!max || maxSV.compare(v) === -1) {
13029 maxSV = new SemVer(max, options);
13035 module2.exports = maxSatisfying;
13039 // node_modules/semver/ranges/min-satisfying.js
13040 var require_min_satisfying = __commonJS({
13041 "node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
13042 var SemVer = require_semver();
13043 var Range5 = require_range();
13044 var minSatisfying = (versions, range, options) => {
13047 let rangeObj = null;
13049 rangeObj = new Range5(range, options);
13053 versions.forEach((v) => {
13054 if (rangeObj.test(v)) {
13055 if (!min || minSV.compare(v) === 1) {
13057 minSV = new SemVer(min, options);
13063 module2.exports = minSatisfying;
13067 // node_modules/semver/ranges/min-version.js
13068 var require_min_version = __commonJS({
13069 "node_modules/semver/ranges/min-version.js"(exports2, module2) {
13070 var SemVer = require_semver();
13071 var Range5 = require_range();
13072 var gt = require_gt();
13073 var minVersion = (range, loose) => {
13074 range = new Range5(range, loose);
13075 let minver = new SemVer("0.0.0");
13076 if (range.test(minver)) {
13079 minver = new SemVer("0.0.0-0");
13080 if (range.test(minver)) {
13084 for (let i = 0; i < range.set.length; ++i) {
13085 const comparators = range.set[i];
13087 comparators.forEach((comparator) => {
13088 const compver = new SemVer(comparator.semver.version);
13089 switch (comparator.operator) {
13091 if (compver.prerelease.length === 0) {
13094 compver.prerelease.push(0);
13096 compver.raw = compver.format();
13099 if (!setMin || gt(compver, setMin)) {
13107 throw new Error(`Unexpected operation: ${comparator.operator}`);
13110 if (setMin && (!minver || gt(minver, setMin)))
13113 if (minver && range.test(minver)) {
13118 module2.exports = minVersion;
13122 // node_modules/semver/ranges/valid.js
13123 var require_valid2 = __commonJS({
13124 "node_modules/semver/ranges/valid.js"(exports2, module2) {
13125 var Range5 = require_range();
13126 var validRange = (range, options) => {
13128 return new Range5(range, options).range || "*";
13133 module2.exports = validRange;
13137 // node_modules/semver/ranges/outside.js
13138 var require_outside = __commonJS({
13139 "node_modules/semver/ranges/outside.js"(exports2, module2) {
13140 var SemVer = require_semver();
13141 var Comparator = require_comparator();
13142 var { ANY } = Comparator;
13143 var Range5 = require_range();
13144 var satisfies = require_satisfies();
13145 var gt = require_gt();
13146 var lt = require_lt();
13147 var lte = require_lte();
13148 var gte = require_gte();
13149 var outside = (version, range, hilo, options) => {
13150 version = new SemVer(version, options);
13151 range = new Range5(range, options);
13152 let gtfn, ltefn, ltfn, comp, ecomp;
13169 throw new TypeError('Must provide a hilo val of "<" or ">"');
13171 if (satisfies(version, range, options)) {
13174 for (let i = 0; i < range.set.length; ++i) {
13175 const comparators = range.set[i];
13178 comparators.forEach((comparator) => {
13179 if (comparator.semver === ANY) {
13180 comparator = new Comparator(">=0.0.0");
13182 high = high || comparator;
13183 low = low || comparator;
13184 if (gtfn(comparator.semver, high.semver, options)) {
13186 } else if (ltfn(comparator.semver, low.semver, options)) {
13190 if (high.operator === comp || high.operator === ecomp) {
13193 if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
13195 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
13201 module2.exports = outside;
13205 // node_modules/semver/ranges/gtr.js
13206 var require_gtr = __commonJS({
13207 "node_modules/semver/ranges/gtr.js"(exports2, module2) {
13208 var outside = require_outside();
13209 var gtr = (version, range, options) => outside(version, range, ">", options);
13210 module2.exports = gtr;
13214 // node_modules/semver/ranges/ltr.js
13215 var require_ltr = __commonJS({
13216 "node_modules/semver/ranges/ltr.js"(exports2, module2) {
13217 var outside = require_outside();
13218 var ltr = (version, range, options) => outside(version, range, "<", options);
13219 module2.exports = ltr;
13223 // node_modules/semver/ranges/intersects.js
13224 var require_intersects = __commonJS({
13225 "node_modules/semver/ranges/intersects.js"(exports2, module2) {
13226 var Range5 = require_range();
13227 var intersects = (r1, r2, options) => {
13228 r1 = new Range5(r1, options);
13229 r2 = new Range5(r2, options);
13230 return r1.intersects(r2);
13232 module2.exports = intersects;
13236 // node_modules/semver/ranges/simplify.js
13237 var require_simplify = __commonJS({
13238 "node_modules/semver/ranges/simplify.js"(exports2, module2) {
13239 var satisfies = require_satisfies();
13240 var compare = require_compare();
13241 module2.exports = (versions, range, options) => {
13245 const v = versions.sort((a, b) => compare(a, b, options));
13246 for (const version of v) {
13247 const included = satisfies(version, range, options);
13254 set.push([min, prev]);
13261 set.push([min, null]);
13263 for (const [min2, max] of set) {
13266 else if (!max && min2 === v[0])
13269 ranges.push(`>=${min2}`);
13270 else if (min2 === v[0])
13271 ranges.push(`<=${max}`);
13273 ranges.push(`${min2} - ${max}`);
13275 const simplified = ranges.join(" || ");
13276 const original = typeof range.raw === "string" ? range.raw : String(range);
13277 return simplified.length < original.length ? simplified : range;
13282 // node_modules/semver/ranges/subset.js
13283 var require_subset = __commonJS({
13284 "node_modules/semver/ranges/subset.js"(exports2, module2) {
13285 var Range5 = require_range();
13286 var Comparator = require_comparator();
13287 var { ANY } = Comparator;
13288 var satisfies = require_satisfies();
13289 var compare = require_compare();
13290 var subset = (sub, dom, options = {}) => {
13293 sub = new Range5(sub, options);
13294 dom = new Range5(dom, options);
13295 let sawNonNull = false;
13297 for (const simpleSub of sub.set) {
13298 for (const simpleDom of dom.set) {
13299 const isSub = simpleSubset(simpleSub, simpleDom, options);
13300 sawNonNull = sawNonNull || isSub !== null;
13309 var simpleSubset = (sub, dom, options) => {
13312 if (sub.length === 1 && sub[0].semver === ANY) {
13313 if (dom.length === 1 && dom[0].semver === ANY)
13315 else if (options.includePrerelease)
13316 sub = [new Comparator(">=0.0.0-0")];
13318 sub = [new Comparator(">=0.0.0")];
13320 if (dom.length === 1 && dom[0].semver === ANY) {
13321 if (options.includePrerelease)
13324 dom = [new Comparator(">=0.0.0")];
13326 const eqSet = new Set();
13328 for (const c of sub) {
13329 if (c.operator === ">" || c.operator === ">=")
13330 gt = higherGT(gt, c, options);
13331 else if (c.operator === "<" || c.operator === "<=")
13332 lt = lowerLT(lt, c, options);
13334 eqSet.add(c.semver);
13336 if (eqSet.size > 1)
13340 gtltComp = compare(gt.semver, lt.semver, options);
13343 else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
13346 for (const eq of eqSet) {
13347 if (gt && !satisfies(eq, String(gt), options))
13349 if (lt && !satisfies(eq, String(lt), options))
13351 for (const c of dom) {
13352 if (!satisfies(eq, String(c), options))
13358 let hasDomLT, hasDomGT;
13359 let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
13360 let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
13361 if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
13362 needDomLTPre = false;
13364 for (const c of dom) {
13365 hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
13366 hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
13368 if (needDomGTPre) {
13369 if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
13370 needDomGTPre = false;
13373 if (c.operator === ">" || c.operator === ">=") {
13374 higher = higherGT(gt, c, options);
13375 if (higher === c && higher !== gt)
13377 } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options))
13381 if (needDomLTPre) {
13382 if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
13383 needDomLTPre = false;
13386 if (c.operator === "<" || c.operator === "<=") {
13387 lower = lowerLT(lt, c, options);
13388 if (lower === c && lower !== lt)
13390 } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options))
13393 if (!c.operator && (lt || gt) && gtltComp !== 0)
13396 if (gt && hasDomLT && !lt && gtltComp !== 0)
13398 if (lt && hasDomGT && !gt && gtltComp !== 0)
13400 if (needDomGTPre || needDomLTPre)
13404 var higherGT = (a, b, options) => {
13407 const comp = compare(a.semver, b.semver, options);
13408 return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
13410 var lowerLT = (a, b, options) => {
13413 const comp = compare(a.semver, b.semver, options);
13414 return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
13416 module2.exports = subset;
13420 // node_modules/semver/index.js
13421 var require_semver2 = __commonJS({
13422 "node_modules/semver/index.js"(exports2, module2) {
13423 var internalRe = require_re();
13424 module2.exports = {
13426 src: internalRe.src,
13427 tokens: internalRe.t,
13428 SEMVER_SPEC_VERSION: require_constants2().SEMVER_SPEC_VERSION,
13429 SemVer: require_semver(),
13430 compareIdentifiers: require_identifiers().compareIdentifiers,
13431 rcompareIdentifiers: require_identifiers().rcompareIdentifiers,
13432 parse: require_parse2(),
13433 valid: require_valid(),
13434 clean: require_clean(),
13435 inc: require_inc(),
13436 diff: require_diff(),
13437 major: require_major(),
13438 minor: require_minor(),
13439 patch: require_patch(),
13440 prerelease: require_prerelease(),
13441 compare: require_compare(),
13442 rcompare: require_rcompare(),
13443 compareLoose: require_compare_loose(),
13444 compareBuild: require_compare_build(),
13445 sort: require_sort(),
13446 rsort: require_rsort(),
13450 neq: require_neq(),
13451 gte: require_gte(),
13452 lte: require_lte(),
13453 cmp: require_cmp(),
13454 coerce: require_coerce(),
13455 Comparator: require_comparator(),
13456 Range: require_range(),
13457 satisfies: require_satisfies(),
13458 toComparators: require_to_comparators(),
13459 maxSatisfying: require_max_satisfying(),
13460 minSatisfying: require_min_satisfying(),
13461 minVersion: require_min_version(),
13462 validRange: require_valid2(),
13463 outside: require_outside(),
13464 gtr: require_gtr(),
13465 ltr: require_ltr(),
13466 intersects: require_intersects(),
13467 simplifyRange: require_simplify(),
13468 subset: require_subset()
13473 // node_modules/listenercount/index.js
13474 var require_listenercount = __commonJS({
13475 "node_modules/listenercount/index.js"(exports2, module2) {
13477 var listenerCount = require("events").listenerCount;
13478 listenerCount = listenerCount || function(ee, event) {
13479 var listeners = ee && ee._events && ee._events[event];
13480 if (Array.isArray(listeners)) {
13481 return listeners.length;
13482 } else if (typeof listeners === "function") {
13488 module2.exports = listenerCount;
13492 // node_modules/buffer-indexof-polyfill/index.js
13493 var require_buffer_indexof_polyfill = __commonJS({
13494 "node_modules/buffer-indexof-polyfill/index.js"() {
13496 if (!Buffer.prototype.indexOf) {
13497 Buffer.prototype.indexOf = function(value, offset) {
13498 offset = offset || 0;
13499 if (typeof value === "string" || value instanceof String) {
13500 value = new Buffer(value);
13501 } else if (typeof value === "number" || value instanceof Number) {
13502 value = new Buffer([value]);
13504 var len = value.length;
13505 for (var i = offset; i <= this.length - len; i++) {
13506 var mismatch = false;
13507 for (var j = 0; j < len; j++) {
13508 if (this[i + j] != value[j]) {
13520 function bufferLastIndexOf(value, offset) {
13521 if (typeof value === "string" || value instanceof String) {
13522 value = new Buffer(value);
13523 } else if (typeof value === "number" || value instanceof Number) {
13524 value = new Buffer([value]);
13526 var len = value.length;
13527 offset = offset || this.length - len;
13528 for (var i = offset; i >= 0; i--) {
13529 var mismatch = false;
13530 for (var j = 0; j < len; j++) {
13531 if (this[i + j] != value[j]) {
13542 if (Buffer.prototype.lastIndexOf) {
13543 if (new Buffer("ABC").lastIndexOf("ABC") === -1)
13544 Buffer.prototype.lastIndexOf = bufferLastIndexOf;
13546 Buffer.prototype.lastIndexOf = bufferLastIndexOf;
13551 // node_modules/setimmediate/setImmediate.js
13552 var require_setImmediate = __commonJS({
13553 "node_modules/setimmediate/setImmediate.js"(exports2) {
13554 (function(global2, undefined2) {
13556 if (global2.setImmediate) {
13559 var nextHandle = 1;
13560 var tasksByHandle = {};
13561 var currentlyRunningATask = false;
13562 var doc = global2.document;
13563 var registerImmediate;
13564 function setImmediate2(callback) {
13565 if (typeof callback !== "function") {
13566 callback = new Function("" + callback);
13568 var args = new Array(arguments.length - 1);
13569 for (var i = 0; i < args.length; i++) {
13570 args[i] = arguments[i + 1];
13572 var task = { callback, args };
13573 tasksByHandle[nextHandle] = task;
13574 registerImmediate(nextHandle);
13575 return nextHandle++;
13577 function clearImmediate2(handle) {
13578 delete tasksByHandle[handle];
13580 function run(task) {
13581 var callback = task.callback;
13582 var args = task.args;
13583 switch (args.length) {
13591 callback(args[0], args[1]);
13594 callback(args[0], args[1], args[2]);
13597 callback.apply(undefined2, args);
13601 function runIfPresent(handle) {
13602 if (currentlyRunningATask) {
13603 setTimeout(runIfPresent, 0, handle);
13605 var task = tasksByHandle[handle];
13607 currentlyRunningATask = true;
13611 clearImmediate2(handle);
13612 currentlyRunningATask = false;
13617 function installNextTickImplementation() {
13618 registerImmediate = function(handle) {
13619 process.nextTick(function() {
13620 runIfPresent(handle);
13624 function canUsePostMessage() {
13625 if (global2.postMessage && !global2.importScripts) {
13626 var postMessageIsAsynchronous = true;
13627 var oldOnMessage = global2.onmessage;
13628 global2.onmessage = function() {
13629 postMessageIsAsynchronous = false;
13631 global2.postMessage("", "*");
13632 global2.onmessage = oldOnMessage;
13633 return postMessageIsAsynchronous;
13636 function installPostMessageImplementation() {
13637 var messagePrefix = "setImmediate$" + Math.random() + "$";
13638 var onGlobalMessage = function(event) {
13639 if (event.source === global2 && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
13640 runIfPresent(+event.data.slice(messagePrefix.length));
13643 if (global2.addEventListener) {
13644 global2.addEventListener("message", onGlobalMessage, false);
13646 global2.attachEvent("onmessage", onGlobalMessage);
13648 registerImmediate = function(handle) {
13649 global2.postMessage(messagePrefix + handle, "*");
13652 function installMessageChannelImplementation() {
13653 var channel = new MessageChannel();
13654 channel.port1.onmessage = function(event) {
13655 var handle = event.data;
13656 runIfPresent(handle);
13658 registerImmediate = function(handle) {
13659 channel.port2.postMessage(handle);
13662 function installReadyStateChangeImplementation() {
13663 var html = doc.documentElement;
13664 registerImmediate = function(handle) {
13665 var script = doc.createElement("script");
13666 script.onreadystatechange = function() {
13667 runIfPresent(handle);
13668 script.onreadystatechange = null;
13669 html.removeChild(script);
13672 html.appendChild(script);
13675 function installSetTimeoutImplementation() {
13676 registerImmediate = function(handle) {
13677 setTimeout(runIfPresent, 0, handle);
13680 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global2);
13681 attachTo = attachTo && attachTo.setTimeout ? attachTo : global2;
13682 if ({}.toString.call(global2.process) === "[object process]") {
13683 installNextTickImplementation();
13684 } else if (canUsePostMessage()) {
13685 installPostMessageImplementation();
13686 } else if (global2.MessageChannel) {
13687 installMessageChannelImplementation();
13688 } else if (doc && "onreadystatechange" in doc.createElement("script")) {
13689 installReadyStateChangeImplementation();
13691 installSetTimeoutImplementation();
13693 attachTo.setImmediate = setImmediate2;
13694 attachTo.clearImmediate = clearImmediate2;
13695 })(typeof self === "undefined" ? typeof global === "undefined" ? exports2 : global : self);
13699 // node_modules/traverse/index.js
13700 var require_traverse = __commonJS({
13701 "node_modules/traverse/index.js"(exports2, module2) {
13702 module2.exports = Traverse;
13703 function Traverse(obj2) {
13704 if (!(this instanceof Traverse))
13705 return new Traverse(obj2);
13708 Traverse.prototype.get = function(ps) {
13709 var node = this.value;
13710 for (var i = 0; i < ps.length; i++) {
13712 if (!Object.hasOwnProperty.call(node, key)) {
13720 Traverse.prototype.set = function(ps, value) {
13721 var node = this.value;
13722 for (var i = 0; i < ps.length - 1; i++) {
13724 if (!Object.hasOwnProperty.call(node, key))
13728 node[ps[i]] = value;
13731 Traverse.prototype.map = function(cb) {
13732 return walk(this.value, cb, true);
13734 Traverse.prototype.forEach = function(cb) {
13735 this.value = walk(this.value, cb, false);
13738 Traverse.prototype.reduce = function(cb, init) {
13739 var skip = arguments.length === 1;
13740 var acc = skip ? this.value : init;
13741 this.forEach(function(x) {
13742 if (!this.isRoot || !skip) {
13743 acc = cb.call(this, acc, x);
13748 Traverse.prototype.deepEqual = function(obj2) {
13749 if (arguments.length !== 1) {
13750 throw new Error("deepEqual requires exactly one object to compare against");
13754 this.forEach(function(y) {
13755 var notEqual = function() {
13759 if (!this.isRoot) {
13760 if (typeof node !== "object")
13762 node = node[this.key];
13765 this.post(function() {
13768 var toS = function(o) {
13769 return Object.prototype.toString.call(o);
13771 if (this.circular) {
13772 if (Traverse(obj2).get(this.circular.path) !== x)
13774 } else if (typeof x !== typeof y) {
13776 } else if (x === null || y === null || x === void 0 || y === void 0) {
13779 } else if (x.__proto__ !== y.__proto__) {
13781 } else if (x === y) {
13782 } else if (typeof x === "function") {
13783 if (x instanceof RegExp) {
13784 if (x.toString() != y.toString())
13786 } else if (x !== y)
13788 } else if (typeof x === "object") {
13789 if (toS(y) === "[object Arguments]" || toS(x) === "[object Arguments]") {
13790 if (toS(x) !== toS(y)) {
13793 } else if (x instanceof Date || y instanceof Date) {
13794 if (!(x instanceof Date) || !(y instanceof Date) || x.getTime() !== y.getTime()) {
13798 var kx = Object.keys(x);
13799 var ky = Object.keys(y);
13800 if (kx.length !== ky.length)
13802 for (var i = 0; i < kx.length; i++) {
13804 if (!Object.hasOwnProperty.call(y, k)) {
13813 Traverse.prototype.paths = function() {
13815 this.forEach(function(x) {
13816 acc.push(this.path);
13820 Traverse.prototype.nodes = function() {
13822 this.forEach(function(x) {
13823 acc.push(this.node);
13827 Traverse.prototype.clone = function() {
13828 var parents = [], nodes = [];
13829 return function clone2(src) {
13830 for (var i = 0; i < parents.length; i++) {
13831 if (parents[i] === src) {
13835 if (typeof src === "object" && src !== null) {
13836 var dst = copy(src);
13839 Object.keys(src).forEach(function(key) {
13840 dst[key] = clone2(src[key]);
13850 function walk(root, cb, immutable) {
13854 return function walker(node_) {
13855 var node = immutable ? copy(node_) : node_;
13856 var modifiers = {};
13860 path: [].concat(path2),
13861 parent: parents.slice(-1)[0],
13862 key: path2.slice(-1)[0],
13863 isRoot: path2.length === 0,
13864 level: path2.length,
13866 update: function(x) {
13867 if (!state.isRoot) {
13868 state.parent.node[state.key] = x;
13872 "delete": function() {
13873 delete state.parent.node[state.key];
13875 remove: function() {
13876 if (Array.isArray(state.parent.node)) {
13877 state.parent.node.splice(state.key, 1);
13879 delete state.parent.node[state.key];
13882 before: function(f) {
13883 modifiers.before = f;
13885 after: function(f) {
13886 modifiers.after = f;
13891 post: function(f) {
13892 modifiers.post = f;
13900 if (typeof node === "object" && node !== null) {
13901 state.isLeaf = Object.keys(node).length == 0;
13902 for (var i = 0; i < parents.length; i++) {
13903 if (parents[i].node_ === node_) {
13904 state.circular = parents[i];
13909 state.isLeaf = true;
13911 state.notLeaf = !state.isLeaf;
13912 state.notRoot = !state.isRoot;
13913 var ret2 = cb.call(state, state.node);
13914 if (ret2 !== void 0 && state.update)
13915 state.update(ret2);
13916 if (modifiers.before)
13917 modifiers.before.call(state, state.node);
13918 if (typeof state.node == "object" && state.node !== null && !state.circular) {
13919 parents.push(state);
13920 var keys = Object.keys(state.node);
13921 keys.forEach(function(key, i2) {
13924 modifiers.pre.call(state, state.node[key], key);
13925 var child = walker(state.node[key]);
13926 if (immutable && Object.hasOwnProperty.call(state.node, key)) {
13927 state.node[key] = child.node;
13929 child.isLast = i2 == keys.length - 1;
13930 child.isFirst = i2 == 0;
13931 if (modifiers.post)
13932 modifiers.post.call(state, child);
13937 if (modifiers.after)
13938 modifiers.after.call(state, state.node);
13942 Object.keys(Traverse.prototype).forEach(function(key) {
13943 Traverse[key] = function(obj2) {
13944 var args = [].slice.call(arguments, 1);
13945 var t = Traverse(obj2);
13946 return t[key].apply(t, args);
13949 function copy(src) {
13950 if (typeof src === "object" && src !== null) {
13952 if (Array.isArray(src)) {
13954 } else if (src instanceof Date) {
13955 dst = new Date(src);
13956 } else if (src instanceof Boolean) {
13957 dst = new Boolean(src);
13958 } else if (src instanceof Number) {
13959 dst = new Number(src);
13960 } else if (src instanceof String) {
13961 dst = new String(src);
13963 dst = Object.create(Object.getPrototypeOf(src));
13965 Object.keys(src).forEach(function(key) {
13966 dst[key] = src[key];
13975 // node_modules/chainsaw/index.js
13976 var require_chainsaw = __commonJS({
13977 "node_modules/chainsaw/index.js"(exports2, module2) {
13978 var Traverse = require_traverse();
13979 var EventEmitter = require("events").EventEmitter;
13980 module2.exports = Chainsaw;
13981 function Chainsaw(builder) {
13982 var saw = Chainsaw.saw(builder, {});
13983 var r = builder.call(saw.handlers, saw);
13987 return saw.chain();
13989 Chainsaw.light = function ChainsawLight(builder) {
13990 var saw = Chainsaw.saw(builder, {});
13991 var r = builder.call(saw.handlers, saw);
13994 return saw.chain();
13996 Chainsaw.saw = function(builder, handlers) {
13997 var saw = new EventEmitter();
13998 saw.handlers = handlers;
14000 saw.chain = function() {
14001 var ch = Traverse(saw.handlers).map(function(node) {
14004 var ps = this.path;
14005 if (typeof node === "function") {
14006 this.update(function() {
14009 args: [].slice.call(arguments)
14015 process.nextTick(function() {
14021 saw.pop = function() {
14022 return saw.actions.shift();
14024 saw.next = function() {
14025 var action = saw.pop();
14028 } else if (!action.trap) {
14029 var node = saw.handlers;
14030 action.path.forEach(function(key) {
14033 node.apply(saw.handlers, action.args);
14036 saw.nest = function(cb) {
14037 var args = [].slice.call(arguments, 1);
14038 var autonext = true;
14039 if (typeof cb === "boolean") {
14043 var s = Chainsaw.saw(builder, {});
14044 var r = builder.call(s.handlers, s);
14047 if (typeof saw.step !== "undefined") {
14050 cb.apply(s.chain(), args);
14051 if (autonext !== false)
14052 s.on("end", saw.next);
14054 saw.record = function() {
14055 upgradeChainsaw(saw);
14057 ["trap", "down", "jump"].forEach(function(method) {
14058 saw[method] = function() {
14059 throw new Error("To use the trap, down and jump features, please call record() first to start recording actions.");
14064 function upgradeChainsaw(saw) {
14066 saw.pop = function() {
14067 return saw.actions[saw.step++];
14069 saw.trap = function(name, cb) {
14070 var ps = Array.isArray(name) ? name : [name];
14078 saw.down = function(name) {
14079 var ps = (Array.isArray(name) ? name : [name]).join("/");
14080 var i = saw.actions.slice(saw.step).map(function(x) {
14081 if (x.trap && x.step <= saw.step)
14083 return x.path.join("/") == ps;
14088 saw.step = saw.actions.length;
14089 var act = saw.actions[saw.step - 1];
14090 if (act && act.trap) {
14091 saw.step = act.step;
14096 saw.jump = function(step) {
14104 // node_modules/buffers/index.js
14105 var require_buffers = __commonJS({
14106 "node_modules/buffers/index.js"(exports2, module2) {
14107 module2.exports = Buffers;
14108 function Buffers(bufs) {
14109 if (!(this instanceof Buffers))
14110 return new Buffers(bufs);
14111 this.buffers = bufs || [];
14112 this.length = this.buffers.reduce(function(size, buf) {
14113 return size + buf.length;
14116 Buffers.prototype.push = function() {
14117 for (var i = 0; i < arguments.length; i++) {
14118 if (!Buffer.isBuffer(arguments[i])) {
14119 throw new TypeError("Tried to push a non-buffer");
14122 for (var i = 0; i < arguments.length; i++) {
14123 var buf = arguments[i];
14124 this.buffers.push(buf);
14125 this.length += buf.length;
14127 return this.length;
14129 Buffers.prototype.unshift = function() {
14130 for (var i = 0; i < arguments.length; i++) {
14131 if (!Buffer.isBuffer(arguments[i])) {
14132 throw new TypeError("Tried to unshift a non-buffer");
14135 for (var i = 0; i < arguments.length; i++) {
14136 var buf = arguments[i];
14137 this.buffers.unshift(buf);
14138 this.length += buf.length;
14140 return this.length;
14142 Buffers.prototype.copy = function(dst, dStart, start, end) {
14143 return this.slice(start, end).copy(dst, dStart, 0, end - start);
14145 Buffers.prototype.splice = function(i, howMany) {
14146 var buffers = this.buffers;
14147 var index = i >= 0 ? i : this.length - i;
14148 var reps = [].slice.call(arguments, 2);
14149 if (howMany === void 0) {
14150 howMany = this.length - index;
14151 } else if (howMany > this.length - index) {
14152 howMany = this.length - index;
14154 for (var i = 0; i < reps.length; i++) {
14155 this.length += reps[i].length;
14157 var removed = new Buffers();
14159 var startBytes = 0;
14160 for (var ii = 0; ii < buffers.length && startBytes + buffers[ii].length < index; ii++) {
14161 startBytes += buffers[ii].length;
14163 if (index - startBytes > 0) {
14164 var start = index - startBytes;
14165 if (start + howMany < buffers[ii].length) {
14166 removed.push(buffers[ii].slice(start, start + howMany));
14167 var orig = buffers[ii];
14168 var buf0 = new Buffer(start);
14169 for (var i = 0; i < start; i++) {
14172 var buf1 = new Buffer(orig.length - start - howMany);
14173 for (var i = start + howMany; i < orig.length; i++) {
14174 buf1[i - howMany - start] = orig[i];
14176 if (reps.length > 0) {
14177 var reps_ = reps.slice();
14178 reps_.unshift(buf0);
14180 buffers.splice.apply(buffers, [ii, 1].concat(reps_));
14181 ii += reps_.length;
14184 buffers.splice(ii, 1, buf0, buf1);
14188 removed.push(buffers[ii].slice(start));
14189 buffers[ii] = buffers[ii].slice(0, start);
14193 if (reps.length > 0) {
14194 buffers.splice.apply(buffers, [ii, 0].concat(reps));
14197 while (removed.length < howMany) {
14198 var buf = buffers[ii];
14199 var len = buf.length;
14200 var take = Math.min(len, howMany - removed.length);
14201 if (take === len) {
14203 buffers.splice(ii, 1);
14205 removed.push(buf.slice(0, take));
14206 buffers[ii] = buffers[ii].slice(take);
14209 this.length -= removed.length;
14212 Buffers.prototype.slice = function(i, j) {
14213 var buffers = this.buffers;
14218 if (j > this.length)
14220 var startBytes = 0;
14221 for (var si = 0; si < buffers.length && startBytes + buffers[si].length <= i; si++) {
14222 startBytes += buffers[si].length;
14224 var target = new Buffer(j - i);
14226 for (var ii = si; ti < j - i && ii < buffers.length; ii++) {
14227 var len = buffers[ii].length;
14228 var start = ti === 0 ? i - startBytes : 0;
14229 var end = ti + len >= j - i ? Math.min(start + (j - i) - ti, len) : len;
14230 buffers[ii].copy(target, ti, start, end);
14235 Buffers.prototype.pos = function(i) {
14236 if (i < 0 || i >= this.length)
14237 throw new Error("oob");
14238 var l2 = i, bi = 0, bu = null;
14240 bu = this.buffers[bi];
14241 if (l2 < bu.length) {
14242 return { buf: bi, offset: l2 };
14249 Buffers.prototype.get = function get(i) {
14250 var pos = this.pos(i);
14251 return this.buffers[pos.buf].get(pos.offset);
14253 Buffers.prototype.set = function set(i, b) {
14254 var pos = this.pos(i);
14255 return this.buffers[pos.buf].set(pos.offset, b);
14257 Buffers.prototype.indexOf = function(needle, offset) {
14258 if (typeof needle === "string") {
14259 needle = new Buffer(needle);
14260 } else if (needle instanceof Buffer) {
14262 throw new Error("Invalid type for a search string");
14264 if (!needle.length) {
14267 if (!this.length) {
14270 var i = 0, j = 0, match = 0, mstart, pos = 0;
14272 var p = this.pos(offset);
14278 while (j >= this.buffers[i].length) {
14281 if (i >= this.buffers.length) {
14285 var char = this.buffers[i][j];
14286 if (char == needle[match]) {
14295 if (match == needle.length) {
14298 } else if (match != 0) {
14308 Buffers.prototype.toBuffer = function() {
14309 return this.slice();
14311 Buffers.prototype.toString = function(encoding, start, end) {
14312 return this.slice(start, end).toString(encoding);
14317 // node_modules/binary/lib/vars.js
14318 var require_vars = __commonJS({
14319 "node_modules/binary/lib/vars.js"(exports2, module2) {
14320 module2.exports = function(store) {
14321 function getset(name, value) {
14322 var node = vars.store;
14323 var keys = name.split(".");
14324 keys.slice(0, -1).forEach(function(k) {
14325 if (node[k] === void 0)
14329 var key = keys[keys.length - 1];
14330 if (arguments.length == 1) {
14333 return node[key] = value;
14337 get: function(name) {
14338 return getset(name);
14340 set: function(name, value) {
14341 return getset(name, value);
14350 // node_modules/binary/index.js
14351 var require_binary = __commonJS({
14352 "node_modules/binary/index.js"(exports2, module2) {
14353 var Chainsaw = require_chainsaw();
14354 var EventEmitter = require("events").EventEmitter;
14355 var Buffers = require_buffers();
14356 var Vars = require_vars();
14357 var Stream2 = require("stream").Stream;
14358 exports2 = module2.exports = function(bufOrEm, eventName) {
14359 if (Buffer.isBuffer(bufOrEm)) {
14360 return exports2.parse(bufOrEm);
14362 var s = exports2.stream();
14363 if (bufOrEm && bufOrEm.pipe) {
14365 } else if (bufOrEm) {
14366 bufOrEm.on(eventName || "data", function(buf) {
14369 bufOrEm.on("end", function() {
14375 exports2.stream = function(input) {
14377 return exports2.apply(null, arguments);
14378 var pending = null;
14379 function getBytes(bytes, cb, skip) {
14383 cb: function(buf) {
14391 function dispatch() {
14397 if (typeof pending === "function") {
14400 var bytes = offset + pending.bytes;
14401 if (buffers.length >= bytes) {
14403 if (offset == null) {
14404 buf = buffers.splice(0, bytes);
14405 if (!pending.skip) {
14409 if (!pending.skip) {
14410 buf = buffers.slice(offset, bytes);
14414 if (pending.skip) {
14422 function builder(saw) {
14427 var self2 = words(function(bytes, cb) {
14428 return function(name) {
14429 getBytes(bytes, function(buf) {
14430 vars.set(name, cb(buf));
14435 self2.tap = function(cb) {
14436 saw.nest(cb, vars.store);
14438 self2.into = function(key, cb) {
14439 if (!vars.get(key))
14442 vars = Vars(parent.get(key));
14443 saw.nest(function() {
14444 cb.apply(this, arguments);
14445 this.tap(function() {
14450 self2.flush = function() {
14454 self2.loop = function(cb) {
14456 saw.nest(false, function loop() {
14457 this.vars = vars.store;
14458 cb.call(this, function() {
14462 this.tap(function() {
14470 self2.buffer = function(name, bytes) {
14471 if (typeof bytes === "string") {
14472 bytes = vars.get(bytes);
14474 getBytes(bytes, function(buf) {
14475 vars.set(name, buf);
14479 self2.skip = function(bytes) {
14480 if (typeof bytes === "string") {
14481 bytes = vars.get(bytes);
14483 getBytes(bytes, function() {
14487 self2.scan = function find2(name, search) {
14488 if (typeof search === "string") {
14489 search = new Buffer(search);
14490 } else if (!Buffer.isBuffer(search)) {
14491 throw new Error("search must be a Buffer or a string");
14494 pending = function() {
14495 var pos = buffers.indexOf(search, offset + taken);
14496 var i = pos - offset - taken;
14499 if (offset != null) {
14500 vars.set(name, buffers.slice(offset, offset + taken + i));
14501 offset += taken + i + search.length;
14503 vars.set(name, buffers.slice(0, taken + i));
14504 buffers.splice(0, taken + i + search.length);
14509 i = Math.max(buffers.length - search.length - offset - taken, 0);
14515 self2.peek = function(cb) {
14517 saw.nest(function() {
14518 cb.call(this, vars.store);
14519 this.tap(function() {
14527 var stream = Chainsaw.light(builder);
14528 stream.writable = true;
14529 var buffers = Buffers();
14530 stream.write = function(buf) {
14535 var done = false, caughtEnd = false;
14536 stream.end = function() {
14539 stream.pipe = Stream2.prototype.pipe;
14540 Object.getOwnPropertyNames(EventEmitter.prototype).forEach(function(name) {
14541 stream[name] = EventEmitter.prototype[name];
14545 exports2.parse = function parse(buffer) {
14546 var self2 = words(function(bytes, cb) {
14547 return function(name) {
14548 if (offset + bytes <= buffer.length) {
14549 var buf = buffer.slice(offset, offset + bytes);
14551 vars.set(name, cb(buf));
14553 vars.set(name, null);
14560 self2.vars = vars.store;
14561 self2.tap = function(cb) {
14562 cb.call(self2, vars.store);
14565 self2.into = function(key, cb) {
14566 if (!vars.get(key)) {
14570 vars = Vars(parent.get(key));
14571 cb.call(self2, vars.store);
14575 self2.loop = function(cb) {
14577 var ender = function() {
14580 while (end === false) {
14581 cb.call(self2, ender, vars.store);
14585 self2.buffer = function(name, size) {
14586 if (typeof size === "string") {
14587 size = vars.get(size);
14589 var buf = buffer.slice(offset, Math.min(buffer.length, offset + size));
14591 vars.set(name, buf);
14594 self2.skip = function(bytes) {
14595 if (typeof bytes === "string") {
14596 bytes = vars.get(bytes);
14601 self2.scan = function(name, search) {
14602 if (typeof search === "string") {
14603 search = new Buffer(search);
14604 } else if (!Buffer.isBuffer(search)) {
14605 throw new Error("search must be a Buffer or a string");
14607 vars.set(name, null);
14608 for (var i = 0; i + offset <= buffer.length - search.length + 1; i++) {
14609 for (var j = 0; j < search.length && buffer[offset + i + j] === search[j]; j++)
14611 if (j === search.length)
14614 vars.set(name, buffer.slice(offset, offset + i));
14615 offset += i + search.length;
14618 self2.peek = function(cb) {
14620 cb.call(self2, vars.store);
14624 self2.flush = function() {
14628 self2.eof = function() {
14629 return offset >= buffer.length;
14633 function decodeLEu(bytes) {
14635 for (var i = 0; i < bytes.length; i++) {
14636 acc += Math.pow(256, i) * bytes[i];
14640 function decodeBEu(bytes) {
14642 for (var i = 0; i < bytes.length; i++) {
14643 acc += Math.pow(256, bytes.length - i - 1) * bytes[i];
14647 function decodeBEs(bytes) {
14648 var val = decodeBEu(bytes);
14649 if ((bytes[0] & 128) == 128) {
14650 val -= Math.pow(256, bytes.length);
14654 function decodeLEs(bytes) {
14655 var val = decodeLEu(bytes);
14656 if ((bytes[bytes.length - 1] & 128) == 128) {
14657 val -= Math.pow(256, bytes.length);
14661 function words(decode) {
14663 [1, 2, 4, 8].forEach(function(bytes) {
14664 var bits = bytes * 8;
14665 self2["word" + bits + "le"] = self2["word" + bits + "lu"] = decode(bytes, decodeLEu);
14666 self2["word" + bits + "ls"] = decode(bytes, decodeLEs);
14667 self2["word" + bits + "be"] = self2["word" + bits + "bu"] = decode(bytes, decodeBEu);
14668 self2["word" + bits + "bs"] = decode(bytes, decodeBEs);
14670 self2.word8 = self2.word8u = self2.word8be;
14671 self2.word8s = self2.word8bs;
14677 // node_modules/bluebird/js/release/es5.js
14678 var require_es5 = __commonJS({
14679 "node_modules/bluebird/js/release/es5.js"(exports2, module2) {
14680 var isES5 = function() {
14682 return this === void 0;
14685 module2.exports = {
14686 freeze: Object.freeze,
14687 defineProperty: Object.defineProperty,
14688 getDescriptor: Object.getOwnPropertyDescriptor,
14690 names: Object.getOwnPropertyNames,
14691 getPrototypeOf: Object.getPrototypeOf,
14692 isArray: Array.isArray,
14694 propertyIsWritable: function(obj2, prop) {
14695 var descriptor = Object.getOwnPropertyDescriptor(obj2, prop);
14696 return !!(!descriptor || descriptor.writable || descriptor.set);
14700 has = {}.hasOwnProperty;
14702 proto = {}.constructor.prototype;
14703 ObjectKeys = function(o) {
14705 for (var key in o) {
14706 if (has.call(o, key)) {
14712 ObjectGetDescriptor = function(o, key) {
14713 return { value: o[key] };
14715 ObjectDefineProperty = function(o, key, desc) {
14716 o[key] = desc.value;
14719 ObjectFreeze = function(obj2) {
14722 ObjectGetPrototypeOf = function(obj2) {
14724 return Object(obj2).constructor.prototype;
14729 ArrayIsArray = function(obj2) {
14731 return str.call(obj2) === "[object Array]";
14736 module2.exports = {
14737 isArray: ArrayIsArray,
14740 defineProperty: ObjectDefineProperty,
14741 getDescriptor: ObjectGetDescriptor,
14742 freeze: ObjectFreeze,
14743 getPrototypeOf: ObjectGetPrototypeOf,
14745 propertyIsWritable: function() {
14754 var ObjectGetDescriptor;
14755 var ObjectDefineProperty;
14757 var ObjectGetPrototypeOf;
14762 // node_modules/bluebird/js/release/util.js
14763 var require_util = __commonJS({
14764 "node_modules/bluebird/js/release/util.js"(exports, module) {
14766 var es5 = require_es5();
14767 var canEvaluate = typeof navigator == "undefined";
14768 var errorObj = { e: {} };
14769 var tryCatchTarget;
14770 var globalObject = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : exports !== void 0 ? exports : null;
14771 function tryCatcher() {
14773 var target = tryCatchTarget;
14774 tryCatchTarget = null;
14775 return target.apply(this, arguments);
14781 function tryCatch(fn) {
14782 tryCatchTarget = fn;
14785 var inherits = function(Child, Parent) {
14786 var hasProp = {}.hasOwnProperty;
14788 this.constructor = Child;
14789 this.constructor$ = Parent;
14790 for (var propertyName in Parent.prototype) {
14791 if (hasProp.call(Parent.prototype, propertyName) && propertyName.charAt(propertyName.length - 1) !== "$") {
14792 this[propertyName + "$"] = Parent.prototype[propertyName];
14796 T.prototype = Parent.prototype;
14797 Child.prototype = new T();
14798 return Child.prototype;
14800 function isPrimitive(val) {
14801 return val == null || val === true || val === false || typeof val === "string" || typeof val === "number";
14803 function isObject(value) {
14804 return typeof value === "function" || typeof value === "object" && value !== null;
14806 function maybeWrapAsError(maybeError) {
14807 if (!isPrimitive(maybeError))
14809 return new Error(safeToString(maybeError));
14811 function withAppended(target, appendee) {
14812 var len = target.length;
14813 var ret2 = new Array(len + 1);
14815 for (i = 0; i < len; ++i) {
14816 ret2[i] = target[i];
14818 ret2[i] = appendee;
14821 function getDataPropertyOrDefault(obj2, key, defaultValue) {
14823 var desc = Object.getOwnPropertyDescriptor(obj2, key);
14824 if (desc != null) {
14825 return desc.get == null && desc.set == null ? desc.value : defaultValue;
14828 return {}.hasOwnProperty.call(obj2, key) ? obj2[key] : void 0;
14831 function notEnumerableProp(obj2, name, value) {
14832 if (isPrimitive(obj2))
14836 configurable: true,
14840 es5.defineProperty(obj2, name, descriptor);
14843 function thrower(r) {
14846 var inheritedDataKeys = function() {
14847 var excludedPrototypes = [
14852 var isExcludedProto = function(val) {
14853 for (var i = 0; i < excludedPrototypes.length; ++i) {
14854 if (excludedPrototypes[i] === val) {
14861 var getKeys = Object.getOwnPropertyNames;
14862 return function(obj2) {
14864 var visitedKeys = Object.create(null);
14865 while (obj2 != null && !isExcludedProto(obj2)) {
14868 keys = getKeys(obj2);
14872 for (var i = 0; i < keys.length; ++i) {
14874 if (visitedKeys[key])
14876 visitedKeys[key] = true;
14877 var desc = Object.getOwnPropertyDescriptor(obj2, key);
14878 if (desc != null && desc.get == null && desc.set == null) {
14882 obj2 = es5.getPrototypeOf(obj2);
14887 var hasProp = {}.hasOwnProperty;
14888 return function(obj2) {
14889 if (isExcludedProto(obj2))
14893 for (var key in obj2) {
14894 if (hasProp.call(obj2, key)) {
14897 for (var i = 0; i < excludedPrototypes.length; ++i) {
14898 if (hasProp.call(excludedPrototypes[i], key)) {
14899 continue enumeration;
14909 var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
14910 function isClass(fn) {
14912 if (typeof fn === "function") {
14913 var keys = es5.names(fn.prototype);
14914 var hasMethods = es5.isES5 && keys.length > 1;
14915 var hasMethodsOtherThanConstructor = keys.length > 0 && !(keys.length === 1 && keys[0] === "constructor");
14916 var hasThisAssignmentAndStaticMethods = thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
14917 if (hasMethods || hasMethodsOtherThanConstructor || hasThisAssignmentAndStaticMethods) {
14926 function toFastProperties(obj) {
14927 function FakeConstructor() {
14929 FakeConstructor.prototype = obj;
14932 new FakeConstructor();
14936 var rident = /^[a-z$_][a-z$_0-9]*$/i;
14937 function isIdentifier(str) {
14938 return rident.test(str);
14940 function filledRange(count, prefix, suffix) {
14941 var ret2 = new Array(count);
14942 for (var i = 0; i < count; ++i) {
14943 ret2[i] = prefix + i + suffix;
14947 function safeToString(obj2) {
14951 return "[no string representation]";
14954 function isError(obj2) {
14955 return obj2 !== null && typeof obj2 === "object" && typeof obj2.message === "string" && typeof obj2.name === "string";
14957 function markAsOriginatingFromRejection(e) {
14959 notEnumerableProp(e, "isOperational", true);
14963 function originatesFromRejection(e) {
14966 return e instanceof Error["__BluebirdErrorTypes__"].OperationalError || e["isOperational"] === true;
14968 function canAttachTrace(obj2) {
14969 return isError(obj2) && es5.propertyIsWritable(obj2, "stack");
14971 var ensureErrorObject = function() {
14972 if (!("stack" in new Error())) {
14973 return function(value) {
14974 if (canAttachTrace(value))
14977 throw new Error(safeToString(value));
14983 return function(value) {
14984 if (canAttachTrace(value))
14986 return new Error(safeToString(value));
14990 function classString(obj2) {
14991 return {}.toString.call(obj2);
14993 function copyDescriptors(from, to, filter) {
14994 var keys = es5.names(from);
14995 for (var i = 0; i < keys.length; ++i) {
14999 es5.defineProperty(to, key, es5.getDescriptor(from, key));
15005 var asArray = function(v) {
15006 if (es5.isArray(v)) {
15011 if (typeof Symbol !== "undefined" && Symbol.iterator) {
15012 ArrayFrom = typeof Array.from === "function" ? function(v) {
15013 return Array.from(v);
15016 var it = v[Symbol.iterator]();
15018 while (!(itResult = it.next()).done) {
15019 ret2.push(itResult.value);
15023 asArray = function(v) {
15024 if (es5.isArray(v)) {
15026 } else if (v != null && typeof v[Symbol.iterator] === "function") {
15027 return ArrayFrom(v);
15033 var isNode = typeof process !== "undefined" && classString(process).toLowerCase() === "[object process]";
15034 var hasEnvVariables = typeof process !== "undefined" && typeof process.env !== "undefined";
15035 function env(key) {
15036 return hasEnvVariables ? process.env[key] : void 0;
15038 function getNativePromise() {
15039 if (typeof Promise === "function") {
15041 var promise = new Promise(function() {
15043 if ({}.toString.call(promise) === "[object Promise]") {
15050 function domainBind(self2, cb) {
15051 return self2.bind(cb);
15057 getDataPropertyOrDefault,
15059 isArray: es5.isArray,
15073 toString: safeToString,
15076 originatesFromRejection,
15077 markAsOriginatingFromRejection,
15080 hasDevTools: typeof chrome !== "undefined" && chrome && typeof chrome.loadTimes === "function",
15084 global: globalObject,
15088 ret.isRecentNode = ret.isNode && function() {
15089 var version = process.versions.node.split(".").map(Number);
15090 return version[0] === 0 && version[1] > 10 || version[0] > 0;
15093 ret.toFastProperties(process);
15097 ret.lastLineError = e;
15099 module.exports = ret;
15103 // node_modules/bluebird/js/release/schedule.js
15104 var require_schedule = __commonJS({
15105 "node_modules/bluebird/js/release/schedule.js"(exports2, module2) {
15107 var util = require_util();
15109 var noAsyncScheduler = function() {
15110 throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n");
15112 var NativePromise = util.getNativePromise();
15113 if (util.isNode && typeof MutationObserver === "undefined") {
15114 GlobalSetImmediate = global.setImmediate;
15115 ProcessNextTick = process.nextTick;
15116 schedule = util.isRecentNode ? function(fn) {
15117 GlobalSetImmediate.call(global, fn);
15119 ProcessNextTick.call(process, fn);
15121 } else if (typeof NativePromise === "function" && typeof NativePromise.resolve === "function") {
15122 nativePromise = NativePromise.resolve();
15123 schedule = function(fn) {
15124 nativePromise.then(fn);
15126 } else if (typeof MutationObserver !== "undefined" && !(typeof window !== "undefined" && window.navigator && (window.navigator.standalone || window.cordova))) {
15127 schedule = function() {
15128 var div = document.createElement("div");
15129 var opts = { attributes: true };
15130 var toggleScheduled = false;
15131 var div2 = document.createElement("div");
15132 var o2 = new MutationObserver(function() {
15133 div.classList.toggle("foo");
15134 toggleScheduled = false;
15136 o2.observe(div2, opts);
15137 var scheduleToggle = function() {
15138 if (toggleScheduled)
15140 toggleScheduled = true;
15141 div2.classList.toggle("foo");
15143 return function schedule2(fn) {
15144 var o = new MutationObserver(function() {
15148 o.observe(div, opts);
15152 } else if (typeof setImmediate !== "undefined") {
15153 schedule = function(fn) {
15156 } else if (typeof setTimeout !== "undefined") {
15157 schedule = function(fn) {
15161 schedule = noAsyncScheduler;
15163 var GlobalSetImmediate;
15164 var ProcessNextTick;
15166 module2.exports = schedule;
15170 // node_modules/bluebird/js/release/queue.js
15171 var require_queue = __commonJS({
15172 "node_modules/bluebird/js/release/queue.js"(exports2, module2) {
15174 function arrayMove(src, srcIndex, dst, dstIndex, len) {
15175 for (var j = 0; j < len; ++j) {
15176 dst[j + dstIndex] = src[j + srcIndex];
15177 src[j + srcIndex] = void 0;
15180 function Queue(capacity) {
15181 this._capacity = capacity;
15185 Queue.prototype._willBeOverCapacity = function(size) {
15186 return this._capacity < size;
15188 Queue.prototype._pushOne = function(arg) {
15189 var length = this.length();
15190 this._checkCapacity(length + 1);
15191 var i = this._front + length & this._capacity - 1;
15193 this._length = length + 1;
15195 Queue.prototype.push = function(fn, receiver, arg) {
15196 var length = this.length() + 3;
15197 if (this._willBeOverCapacity(length)) {
15199 this._pushOne(receiver);
15200 this._pushOne(arg);
15203 var j = this._front + length - 3;
15204 this._checkCapacity(length);
15205 var wrapMask = this._capacity - 1;
15206 this[j + 0 & wrapMask] = fn;
15207 this[j + 1 & wrapMask] = receiver;
15208 this[j + 2 & wrapMask] = arg;
15209 this._length = length;
15211 Queue.prototype.shift = function() {
15212 var front = this._front, ret2 = this[front];
15213 this[front] = void 0;
15214 this._front = front + 1 & this._capacity - 1;
15218 Queue.prototype.length = function() {
15219 return this._length;
15221 Queue.prototype._checkCapacity = function(size) {
15222 if (this._capacity < size) {
15223 this._resizeTo(this._capacity << 1);
15226 Queue.prototype._resizeTo = function(capacity) {
15227 var oldCapacity = this._capacity;
15228 this._capacity = capacity;
15229 var front = this._front;
15230 var length = this._length;
15231 var moveItemsCount = front + length & oldCapacity - 1;
15232 arrayMove(this, 0, this, oldCapacity, moveItemsCount);
15234 module2.exports = Queue;
15238 // node_modules/bluebird/js/release/async.js
15239 var require_async = __commonJS({
15240 "node_modules/bluebird/js/release/async.js"(exports2, module2) {
15242 var firstLineError;
15246 firstLineError = e;
15248 var schedule = require_schedule();
15249 var Queue = require_queue();
15250 var util = require_util();
15252 this._customScheduler = false;
15253 this._isTickUsed = false;
15254 this._lateQueue = new Queue(16);
15255 this._normalQueue = new Queue(16);
15256 this._haveDrainedQueues = false;
15257 this._trampolineEnabled = true;
15259 this.drainQueues = function() {
15260 self2._drainQueues();
15262 this._schedule = schedule;
15264 Async.prototype.setScheduler = function(fn) {
15265 var prev = this._schedule;
15266 this._schedule = fn;
15267 this._customScheduler = true;
15270 Async.prototype.hasCustomScheduler = function() {
15271 return this._customScheduler;
15273 Async.prototype.enableTrampoline = function() {
15274 this._trampolineEnabled = true;
15276 Async.prototype.disableTrampolineIfNecessary = function() {
15277 if (util.hasDevTools) {
15278 this._trampolineEnabled = false;
15281 Async.prototype.haveItemsQueued = function() {
15282 return this._isTickUsed || this._haveDrainedQueues;
15284 Async.prototype.fatalError = function(e, isNode2) {
15286 process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) + "\n");
15289 this.throwLater(e);
15292 Async.prototype.throwLater = function(fn, arg) {
15293 if (arguments.length === 1) {
15299 if (typeof setTimeout !== "undefined") {
15300 setTimeout(function() {
15305 this._schedule(function() {
15309 throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n");
15312 function AsyncInvokeLater(fn, receiver, arg) {
15313 this._lateQueue.push(fn, receiver, arg);
15316 function AsyncInvoke(fn, receiver, arg) {
15317 this._normalQueue.push(fn, receiver, arg);
15320 function AsyncSettlePromises(promise) {
15321 this._normalQueue._pushOne(promise);
15324 if (!util.hasDevTools) {
15325 Async.prototype.invokeLater = AsyncInvokeLater;
15326 Async.prototype.invoke = AsyncInvoke;
15327 Async.prototype.settlePromises = AsyncSettlePromises;
15329 Async.prototype.invokeLater = function(fn, receiver, arg) {
15330 if (this._trampolineEnabled) {
15331 AsyncInvokeLater.call(this, fn, receiver, arg);
15333 this._schedule(function() {
15334 setTimeout(function() {
15335 fn.call(receiver, arg);
15340 Async.prototype.invoke = function(fn, receiver, arg) {
15341 if (this._trampolineEnabled) {
15342 AsyncInvoke.call(this, fn, receiver, arg);
15344 this._schedule(function() {
15345 fn.call(receiver, arg);
15349 Async.prototype.settlePromises = function(promise) {
15350 if (this._trampolineEnabled) {
15351 AsyncSettlePromises.call(this, promise);
15353 this._schedule(function() {
15354 promise._settlePromises();
15359 Async.prototype._drainQueue = function(queue) {
15360 while (queue.length() > 0) {
15361 var fn = queue.shift();
15362 if (typeof fn !== "function") {
15363 fn._settlePromises();
15366 var receiver = queue.shift();
15367 var arg = queue.shift();
15368 fn.call(receiver, arg);
15371 Async.prototype._drainQueues = function() {
15372 this._drainQueue(this._normalQueue);
15374 this._haveDrainedQueues = true;
15375 this._drainQueue(this._lateQueue);
15377 Async.prototype._queueTick = function() {
15378 if (!this._isTickUsed) {
15379 this._isTickUsed = true;
15380 this._schedule(this.drainQueues);
15383 Async.prototype._reset = function() {
15384 this._isTickUsed = false;
15386 module2.exports = Async;
15387 module2.exports.firstLineError = firstLineError;
15391 // node_modules/bluebird/js/release/errors.js
15392 var require_errors = __commonJS({
15393 "node_modules/bluebird/js/release/errors.js"(exports2, module2) {
15395 var es52 = require_es5();
15396 var Objectfreeze = es52.freeze;
15397 var util = require_util();
15398 var inherits2 = util.inherits;
15399 var notEnumerableProp2 = util.notEnumerableProp;
15400 function subError(nameProperty, defaultMessage) {
15401 function SubError(message) {
15402 if (!(this instanceof SubError))
15403 return new SubError(message);
15404 notEnumerableProp2(this, "message", typeof message === "string" ? message : defaultMessage);
15405 notEnumerableProp2(this, "name", nameProperty);
15406 if (Error.captureStackTrace) {
15407 Error.captureStackTrace(this, this.constructor);
15412 inherits2(SubError, Error);
15417 var Warning = subError("Warning", "warning");
15418 var CancellationError = subError("CancellationError", "cancellation error");
15419 var TimeoutError = subError("TimeoutError", "timeout error");
15420 var AggregateError = subError("AggregateError", "aggregate error");
15422 _TypeError = TypeError;
15423 _RangeError = RangeError;
15425 _TypeError = subError("TypeError", "type error");
15426 _RangeError = subError("RangeError", "range error");
15428 var methods = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");
15429 for (i = 0; i < methods.length; ++i) {
15430 if (typeof Array.prototype[methods[i]] === "function") {
15431 AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
15435 es52.defineProperty(AggregateError.prototype, "length", {
15437 configurable: false,
15441 AggregateError.prototype["isOperational"] = true;
15443 AggregateError.prototype.toString = function() {
15444 var indent = Array(level * 4 + 1).join(" ");
15445 var ret2 = "\n" + indent + "AggregateError of:\n";
15447 indent = Array(level * 4 + 1).join(" ");
15448 for (var i2 = 0; i2 < this.length; ++i2) {
15449 var str = this[i2] === this ? "[Circular AggregateError]" : this[i2] + "";
15450 var lines = str.split("\n");
15451 for (var j = 0; j < lines.length; ++j) {
15452 lines[j] = indent + lines[j];
15454 str = lines.join("\n");
15455 ret2 += str + "\n";
15460 function OperationalError(message) {
15461 if (!(this instanceof OperationalError))
15462 return new OperationalError(message);
15463 notEnumerableProp2(this, "name", "OperationalError");
15464 notEnumerableProp2(this, "message", message);
15465 this.cause = message;
15466 this["isOperational"] = true;
15467 if (message instanceof Error) {
15468 notEnumerableProp2(this, "message", message.message);
15469 notEnumerableProp2(this, "stack", message.stack);
15470 } else if (Error.captureStackTrace) {
15471 Error.captureStackTrace(this, this.constructor);
15474 inherits2(OperationalError, Error);
15475 var errorTypes = Error["__BluebirdErrorTypes__"];
15477 errorTypes = Objectfreeze({
15481 RejectionError: OperationalError,
15484 es52.defineProperty(Error, "__BluebirdErrorTypes__", {
15488 configurable: false
15491 module2.exports = {
15493 TypeError: _TypeError,
15494 RangeError: _RangeError,
15495 CancellationError: errorTypes.CancellationError,
15496 OperationalError: errorTypes.OperationalError,
15497 TimeoutError: errorTypes.TimeoutError,
15498 AggregateError: errorTypes.AggregateError,
15504 // node_modules/bluebird/js/release/thenables.js
15505 var require_thenables = __commonJS({
15506 "node_modules/bluebird/js/release/thenables.js"(exports2, module2) {
15508 module2.exports = function(Promise2, INTERNAL2) {
15509 var util = require_util();
15510 var errorObj2 = util.errorObj;
15511 var isObject2 = util.isObject;
15512 function tryConvertToPromise(obj2, context) {
15513 if (isObject2(obj2)) {
15514 if (obj2 instanceof Promise2)
15516 var then = getThen(obj2);
15517 if (then === errorObj2) {
15519 context._pushContext();
15520 var ret2 = Promise2.reject(then.e);
15522 context._popContext();
15524 } else if (typeof then === "function") {
15525 if (isAnyBluebirdPromise(obj2)) {
15526 var ret2 = new Promise2(INTERNAL2);
15527 obj2._then(ret2._fulfill, ret2._reject, void 0, ret2, null);
15530 return doThenable(obj2, then, context);
15535 function doGetThen(obj2) {
15538 function getThen(obj2) {
15540 return doGetThen(obj2);
15546 var hasProp = {}.hasOwnProperty;
15547 function isAnyBluebirdPromise(obj2) {
15549 return hasProp.call(obj2, "_promise0");
15554 function doThenable(x, then, context) {
15555 var promise = new Promise2(INTERNAL2);
15556 var ret2 = promise;
15558 context._pushContext();
15559 promise._captureStackTrace();
15561 context._popContext();
15562 var synchronous = true;
15563 var result = util.tryCatch(then).call(x, resolve, reject);
15564 synchronous = false;
15565 if (promise && result === errorObj2) {
15566 promise._rejectCallback(result.e, true, true);
15569 function resolve(value) {
15572 promise._resolveCallback(value);
15575 function reject(reason) {
15578 promise._rejectCallback(reason, synchronous, true);
15583 return tryConvertToPromise;
15588 // node_modules/bluebird/js/release/promise_array.js
15589 var require_promise_array = __commonJS({
15590 "node_modules/bluebird/js/release/promise_array.js"(exports2, module2) {
15592 module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection, Proxyable) {
15593 var util = require_util();
15594 var isArray = util.isArray;
15595 function toResolutionValue(val) {
15603 function PromiseArray(values) {
15604 var promise = this._promise = new Promise2(INTERNAL2);
15605 if (values instanceof Promise2) {
15606 promise._propagateFrom(values, 3);
15608 promise._setOnCancel(this);
15609 this._values = values;
15611 this._totalResolved = 0;
15612 this._init(void 0, -2);
15614 util.inherits(PromiseArray, Proxyable);
15615 PromiseArray.prototype.length = function() {
15616 return this._length;
15618 PromiseArray.prototype.promise = function() {
15619 return this._promise;
15621 PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
15622 var values = tryConvertToPromise(this._values, this._promise);
15623 if (values instanceof Promise2) {
15624 values = values._target();
15625 var bitField = values._bitField;
15627 this._values = values;
15628 if ((bitField & 50397184) === 0) {
15629 this._promise._setAsyncGuaranteed();
15630 return values._then(init, this._reject, void 0, this, resolveValueIfEmpty);
15631 } else if ((bitField & 33554432) !== 0) {
15632 values = values._value();
15633 } else if ((bitField & 16777216) !== 0) {
15634 return this._reject(values._reason());
15636 return this._cancel();
15639 values = util.asArray(values);
15640 if (values === null) {
15641 var err = apiRejection("expecting an array or an iterable object but got " + util.classString(values)).reason();
15642 this._promise._rejectCallback(err, false);
15645 if (values.length === 0) {
15646 if (resolveValueIfEmpty === -5) {
15647 this._resolveEmptyArray();
15649 this._resolve(toResolutionValue(resolveValueIfEmpty));
15653 this._iterate(values);
15655 PromiseArray.prototype._iterate = function(values) {
15656 var len = this.getActualLength(values.length);
15657 this._length = len;
15658 this._values = this.shouldCopyValues() ? new Array(len) : this._values;
15659 var result = this._promise;
15660 var isResolved = false;
15661 var bitField = null;
15662 for (var i = 0; i < len; ++i) {
15663 var maybePromise = tryConvertToPromise(values[i], result);
15664 if (maybePromise instanceof Promise2) {
15665 maybePromise = maybePromise._target();
15666 bitField = maybePromise._bitField;
15671 if (bitField !== null) {
15672 maybePromise.suppressUnhandledRejections();
15674 } else if (bitField !== null) {
15675 if ((bitField & 50397184) === 0) {
15676 maybePromise._proxy(this, i);
15677 this._values[i] = maybePromise;
15678 } else if ((bitField & 33554432) !== 0) {
15679 isResolved = this._promiseFulfilled(maybePromise._value(), i);
15680 } else if ((bitField & 16777216) !== 0) {
15681 isResolved = this._promiseRejected(maybePromise._reason(), i);
15683 isResolved = this._promiseCancelled(i);
15686 isResolved = this._promiseFulfilled(maybePromise, i);
15690 result._setAsyncGuaranteed();
15692 PromiseArray.prototype._isResolved = function() {
15693 return this._values === null;
15695 PromiseArray.prototype._resolve = function(value) {
15696 this._values = null;
15697 this._promise._fulfill(value);
15699 PromiseArray.prototype._cancel = function() {
15700 if (this._isResolved() || !this._promise._isCancellable())
15702 this._values = null;
15703 this._promise._cancel();
15705 PromiseArray.prototype._reject = function(reason) {
15706 this._values = null;
15707 this._promise._rejectCallback(reason, false);
15709 PromiseArray.prototype._promiseFulfilled = function(value, index) {
15710 this._values[index] = value;
15711 var totalResolved = ++this._totalResolved;
15712 if (totalResolved >= this._length) {
15713 this._resolve(this._values);
15718 PromiseArray.prototype._promiseCancelled = function() {
15722 PromiseArray.prototype._promiseRejected = function(reason) {
15723 this._totalResolved++;
15724 this._reject(reason);
15727 PromiseArray.prototype._resultCancelled = function() {
15728 if (this._isResolved())
15730 var values = this._values;
15732 if (values instanceof Promise2) {
15735 for (var i = 0; i < values.length; ++i) {
15736 if (values[i] instanceof Promise2) {
15737 values[i].cancel();
15742 PromiseArray.prototype.shouldCopyValues = function() {
15745 PromiseArray.prototype.getActualLength = function(len) {
15748 return PromiseArray;
15753 // node_modules/bluebird/js/release/context.js
15754 var require_context = __commonJS({
15755 "node_modules/bluebird/js/release/context.js"(exports2, module2) {
15757 module2.exports = function(Promise2) {
15758 var longStackTraces = false;
15759 var contextStack = [];
15760 Promise2.prototype._promiseCreated = function() {
15762 Promise2.prototype._pushContext = function() {
15764 Promise2.prototype._popContext = function() {
15767 Promise2._peekContext = Promise2.prototype._peekContext = function() {
15769 function Context() {
15770 this._trace = new Context.CapturedTrace(peekContext());
15772 Context.prototype._pushContext = function() {
15773 if (this._trace !== void 0) {
15774 this._trace._promiseCreated = null;
15775 contextStack.push(this._trace);
15778 Context.prototype._popContext = function() {
15779 if (this._trace !== void 0) {
15780 var trace = contextStack.pop();
15781 var ret2 = trace._promiseCreated;
15782 trace._promiseCreated = null;
15787 function createContext() {
15788 if (longStackTraces)
15789 return new Context();
15791 function peekContext() {
15792 var lastIndex = contextStack.length - 1;
15793 if (lastIndex >= 0) {
15794 return contextStack[lastIndex];
15798 Context.CapturedTrace = null;
15799 Context.create = createContext;
15800 Context.deactivateLongStackTraces = function() {
15802 Context.activateLongStackTraces = function() {
15803 var Promise_pushContext = Promise2.prototype._pushContext;
15804 var Promise_popContext = Promise2.prototype._popContext;
15805 var Promise_PeekContext = Promise2._peekContext;
15806 var Promise_peekContext = Promise2.prototype._peekContext;
15807 var Promise_promiseCreated = Promise2.prototype._promiseCreated;
15808 Context.deactivateLongStackTraces = function() {
15809 Promise2.prototype._pushContext = Promise_pushContext;
15810 Promise2.prototype._popContext = Promise_popContext;
15811 Promise2._peekContext = Promise_PeekContext;
15812 Promise2.prototype._peekContext = Promise_peekContext;
15813 Promise2.prototype._promiseCreated = Promise_promiseCreated;
15814 longStackTraces = false;
15816 longStackTraces = true;
15817 Promise2.prototype._pushContext = Context.prototype._pushContext;
15818 Promise2.prototype._popContext = Context.prototype._popContext;
15819 Promise2._peekContext = Promise2.prototype._peekContext = peekContext;
15820 Promise2.prototype._promiseCreated = function() {
15821 var ctx = this._peekContext();
15822 if (ctx && ctx._promiseCreated == null)
15823 ctx._promiseCreated = this;
15831 // node_modules/bluebird/js/release/debuggability.js
15832 var require_debuggability = __commonJS({
15833 "node_modules/bluebird/js/release/debuggability.js"(exports2, module2) {
15835 module2.exports = function(Promise2, Context) {
15836 var getDomain = Promise2._getDomain;
15837 var async = Promise2._async;
15838 var Warning = require_errors().Warning;
15839 var util = require_util();
15840 var canAttachTrace2 = util.canAttachTrace;
15841 var unhandledRejectionHandled;
15842 var possiblyUnhandledRejection;
15843 var bluebirdFramePattern = /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
15844 var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
15845 var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
15846 var stackFramePattern = null;
15847 var formatStack = null;
15848 var indentStackFrames = false;
15850 var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 && (util.env("BLUEBIRD_DEBUG") || util.env("NODE_ENV") === "development"));
15851 var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 && (debugging || util.env("BLUEBIRD_WARNINGS")));
15852 var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 && (debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
15853 var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 && (warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
15854 Promise2.prototype.suppressUnhandledRejections = function() {
15855 var target = this._target();
15856 target._bitField = target._bitField & ~1048576 | 524288;
15858 Promise2.prototype._ensurePossibleRejectionHandled = function() {
15859 if ((this._bitField & 524288) !== 0)
15861 this._setRejectionIsUnhandled();
15862 async.invokeLater(this._notifyUnhandledRejection, this, void 0);
15864 Promise2.prototype._notifyUnhandledRejectionIsHandled = function() {
15865 fireRejectionEvent("rejectionHandled", unhandledRejectionHandled, void 0, this);
15867 Promise2.prototype._setReturnedNonUndefined = function() {
15868 this._bitField = this._bitField | 268435456;
15870 Promise2.prototype._returnedNonUndefined = function() {
15871 return (this._bitField & 268435456) !== 0;
15873 Promise2.prototype._notifyUnhandledRejection = function() {
15874 if (this._isRejectionUnhandled()) {
15875 var reason = this._settledValue();
15876 this._setUnhandledRejectionIsNotified();
15877 fireRejectionEvent("unhandledRejection", possiblyUnhandledRejection, reason, this);
15880 Promise2.prototype._setUnhandledRejectionIsNotified = function() {
15881 this._bitField = this._bitField | 262144;
15883 Promise2.prototype._unsetUnhandledRejectionIsNotified = function() {
15884 this._bitField = this._bitField & ~262144;
15886 Promise2.prototype._isUnhandledRejectionNotified = function() {
15887 return (this._bitField & 262144) > 0;
15889 Promise2.prototype._setRejectionIsUnhandled = function() {
15890 this._bitField = this._bitField | 1048576;
15892 Promise2.prototype._unsetRejectionIsUnhandled = function() {
15893 this._bitField = this._bitField & ~1048576;
15894 if (this._isUnhandledRejectionNotified()) {
15895 this._unsetUnhandledRejectionIsNotified();
15896 this._notifyUnhandledRejectionIsHandled();
15899 Promise2.prototype._isRejectionUnhandled = function() {
15900 return (this._bitField & 1048576) > 0;
15902 Promise2.prototype._warn = function(message, shouldUseOwnTrace, promise) {
15903 return warn(message, shouldUseOwnTrace, promise || this);
15905 Promise2.onPossiblyUnhandledRejection = function(fn) {
15906 var domain = getDomain();
15907 possiblyUnhandledRejection = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0;
15909 Promise2.onUnhandledRejectionHandled = function(fn) {
15910 var domain = getDomain();
15911 unhandledRejectionHandled = typeof fn === "function" ? domain === null ? fn : util.domainBind(domain, fn) : void 0;
15913 var disableLongStackTraces = function() {
15915 Promise2.longStackTraces = function() {
15916 if (async.haveItemsQueued() && !config.longStackTraces) {
15917 throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");
15919 if (!config.longStackTraces && longStackTracesIsSupported()) {
15920 var Promise_captureStackTrace = Promise2.prototype._captureStackTrace;
15921 var Promise_attachExtraTrace = Promise2.prototype._attachExtraTrace;
15922 config.longStackTraces = true;
15923 disableLongStackTraces = function() {
15924 if (async.haveItemsQueued() && !config.longStackTraces) {
15925 throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");
15927 Promise2.prototype._captureStackTrace = Promise_captureStackTrace;
15928 Promise2.prototype._attachExtraTrace = Promise_attachExtraTrace;
15929 Context.deactivateLongStackTraces();
15930 async.enableTrampoline();
15931 config.longStackTraces = false;
15933 Promise2.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
15934 Promise2.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
15935 Context.activateLongStackTraces();
15936 async.disableTrampolineIfNecessary();
15939 Promise2.hasLongStackTraces = function() {
15940 return config.longStackTraces && longStackTracesIsSupported();
15942 var fireDomEvent = function() {
15944 if (typeof CustomEvent === "function") {
15945 var event = new CustomEvent("CustomEvent");
15946 util.global.dispatchEvent(event);
15947 return function(name, event2) {
15948 var domEvent = new CustomEvent(name.toLowerCase(), {
15952 return !util.global.dispatchEvent(domEvent);
15954 } else if (typeof Event === "function") {
15955 var event = new Event("CustomEvent");
15956 util.global.dispatchEvent(event);
15957 return function(name, event2) {
15958 var domEvent = new Event(name.toLowerCase(), {
15961 domEvent.detail = event2;
15962 return !util.global.dispatchEvent(domEvent);
15965 var event = document.createEvent("CustomEvent");
15966 event.initCustomEvent("testingtheevent", false, true, {});
15967 util.global.dispatchEvent(event);
15968 return function(name, event2) {
15969 var domEvent = document.createEvent("CustomEvent");
15970 domEvent.initCustomEvent(name.toLowerCase(), false, true, event2);
15971 return !util.global.dispatchEvent(domEvent);
15976 return function() {
15980 var fireGlobalEvent = function() {
15982 return function() {
15983 return process.emit.apply(process, arguments);
15986 if (!util.global) {
15987 return function() {
15991 return function(name) {
15992 var methodName = "on" + name.toLowerCase();
15993 var method = util.global[methodName];
15996 method.apply(util.global, [].slice.call(arguments, 1));
16001 function generatePromiseLifecycleEventObject(name, promise) {
16002 return { promise };
16004 var eventToObjectGenerator = {
16005 promiseCreated: generatePromiseLifecycleEventObject,
16006 promiseFulfilled: generatePromiseLifecycleEventObject,
16007 promiseRejected: generatePromiseLifecycleEventObject,
16008 promiseResolved: generatePromiseLifecycleEventObject,
16009 promiseCancelled: generatePromiseLifecycleEventObject,
16010 promiseChained: function(name, promise, child) {
16011 return { promise, child };
16013 warning: function(name, warning) {
16014 return { warning };
16016 unhandledRejection: function(name, reason, promise) {
16017 return { reason, promise };
16019 rejectionHandled: generatePromiseLifecycleEventObject
16021 var activeFireEvent = function(name) {
16022 var globalEventFired = false;
16024 globalEventFired = fireGlobalEvent.apply(null, arguments);
16026 async.throwLater(e);
16027 globalEventFired = true;
16029 var domEventFired = false;
16031 domEventFired = fireDomEvent(name, eventToObjectGenerator[name].apply(null, arguments));
16033 async.throwLater(e);
16034 domEventFired = true;
16036 return domEventFired || globalEventFired;
16038 Promise2.config = function(opts) {
16039 opts = Object(opts);
16040 if ("longStackTraces" in opts) {
16041 if (opts.longStackTraces) {
16042 Promise2.longStackTraces();
16043 } else if (!opts.longStackTraces && Promise2.hasLongStackTraces()) {
16044 disableLongStackTraces();
16047 if ("warnings" in opts) {
16048 var warningsOption = opts.warnings;
16049 config.warnings = !!warningsOption;
16050 wForgottenReturn = config.warnings;
16051 if (util.isObject(warningsOption)) {
16052 if ("wForgottenReturn" in warningsOption) {
16053 wForgottenReturn = !!warningsOption.wForgottenReturn;
16057 if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
16058 if (async.haveItemsQueued()) {
16059 throw new Error("cannot enable cancellation after promises are in use");
16061 Promise2.prototype._clearCancellationData = cancellationClearCancellationData;
16062 Promise2.prototype._propagateFrom = cancellationPropagateFrom;
16063 Promise2.prototype._onCancel = cancellationOnCancel;
16064 Promise2.prototype._setOnCancel = cancellationSetOnCancel;
16065 Promise2.prototype._attachCancellationCallback = cancellationAttachCancellationCallback;
16066 Promise2.prototype._execute = cancellationExecute;
16067 propagateFromFunction = cancellationPropagateFrom;
16068 config.cancellation = true;
16070 if ("monitoring" in opts) {
16071 if (opts.monitoring && !config.monitoring) {
16072 config.monitoring = true;
16073 Promise2.prototype._fireEvent = activeFireEvent;
16074 } else if (!opts.monitoring && config.monitoring) {
16075 config.monitoring = false;
16076 Promise2.prototype._fireEvent = defaultFireEvent;
16081 function defaultFireEvent() {
16084 Promise2.prototype._fireEvent = defaultFireEvent;
16085 Promise2.prototype._execute = function(executor, resolve, reject) {
16087 executor(resolve, reject);
16092 Promise2.prototype._onCancel = function() {
16094 Promise2.prototype._setOnCancel = function(handler) {
16097 Promise2.prototype._attachCancellationCallback = function(onCancel) {
16100 Promise2.prototype._captureStackTrace = function() {
16102 Promise2.prototype._attachExtraTrace = function() {
16104 Promise2.prototype._clearCancellationData = function() {
16106 Promise2.prototype._propagateFrom = function(parent, flags) {
16110 function cancellationExecute(executor, resolve, reject) {
16111 var promise = this;
16113 executor(resolve, reject, function(onCancel) {
16114 if (typeof onCancel !== "function") {
16115 throw new TypeError("onCancel must be a function, got: " + util.toString(onCancel));
16117 promise._attachCancellationCallback(onCancel);
16123 function cancellationAttachCancellationCallback(onCancel) {
16124 if (!this._isCancellable())
16126 var previousOnCancel = this._onCancel();
16127 if (previousOnCancel !== void 0) {
16128 if (util.isArray(previousOnCancel)) {
16129 previousOnCancel.push(onCancel);
16131 this._setOnCancel([previousOnCancel, onCancel]);
16134 this._setOnCancel(onCancel);
16137 function cancellationOnCancel() {
16138 return this._onCancelField;
16140 function cancellationSetOnCancel(onCancel) {
16141 this._onCancelField = onCancel;
16143 function cancellationClearCancellationData() {
16144 this._cancellationParent = void 0;
16145 this._onCancelField = void 0;
16147 function cancellationPropagateFrom(parent, flags) {
16148 if ((flags & 1) !== 0) {
16149 this._cancellationParent = parent;
16150 var branchesRemainingToCancel = parent._branchesRemainingToCancel;
16151 if (branchesRemainingToCancel === void 0) {
16152 branchesRemainingToCancel = 0;
16154 parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
16156 if ((flags & 2) !== 0 && parent._isBound()) {
16157 this._setBoundTo(parent._boundTo);
16160 function bindingPropagateFrom(parent, flags) {
16161 if ((flags & 2) !== 0 && parent._isBound()) {
16162 this._setBoundTo(parent._boundTo);
16165 var propagateFromFunction = bindingPropagateFrom;
16166 function boundValueFunction() {
16167 var ret2 = this._boundTo;
16168 if (ret2 !== void 0) {
16169 if (ret2 instanceof Promise2) {
16170 if (ret2.isFulfilled()) {
16171 return ret2.value();
16179 function longStackTracesCaptureStackTrace() {
16180 this._trace = new CapturedTrace(this._peekContext());
16182 function longStackTracesAttachExtraTrace(error, ignoreSelf) {
16183 if (canAttachTrace2(error)) {
16184 var trace = this._trace;
16185 if (trace !== void 0) {
16187 trace = trace._parent;
16189 if (trace !== void 0) {
16190 trace.attachExtraTrace(error);
16191 } else if (!error.__stackCleaned__) {
16192 var parsed = parseStackAndMessage(error);
16193 util.notEnumerableProp(error, "stack", parsed.message + "\n" + parsed.stack.join("\n"));
16194 util.notEnumerableProp(error, "__stackCleaned__", true);
16198 function checkForgottenReturns(returnValue, promiseCreated, name, promise, parent) {
16199 if (returnValue === void 0 && promiseCreated !== null && wForgottenReturn) {
16200 if (parent !== void 0 && parent._returnedNonUndefined())
16202 if ((promise._bitField & 65535) === 0)
16206 var handlerLine = "";
16207 var creatorLine = "";
16208 if (promiseCreated._trace) {
16209 var traceLines = promiseCreated._trace.stack.split("\n");
16210 var stack = cleanStack(traceLines);
16211 for (var i = stack.length - 1; i >= 0; --i) {
16212 var line = stack[i];
16213 if (!nodeFramePattern.test(line)) {
16214 var lineMatches = line.match(parseLinePattern);
16216 handlerLine = "at " + lineMatches[1] + ":" + lineMatches[2] + ":" + lineMatches[3] + " ";
16221 if (stack.length > 0) {
16222 var firstUserLine = stack[0];
16223 for (var i = 0; i < traceLines.length; ++i) {
16224 if (traceLines[i] === firstUserLine) {
16226 creatorLine = "\n" + traceLines[i - 1];
16233 var msg = "a promise was created in a " + name + "handler " + handlerLine + "but was not returned from it, see http://goo.gl/rRqMUw" + creatorLine;
16234 promise._warn(msg, true, promiseCreated);
16237 function deprecated(name, replacement) {
16238 var message = name + " is deprecated and will be removed in a future version.";
16240 message += " Use " + replacement + " instead.";
16241 return warn(message);
16243 function warn(message, shouldUseOwnTrace, promise) {
16244 if (!config.warnings)
16246 var warning = new Warning(message);
16248 if (shouldUseOwnTrace) {
16249 promise._attachExtraTrace(warning);
16250 } else if (config.longStackTraces && (ctx = Promise2._peekContext())) {
16251 ctx.attachExtraTrace(warning);
16253 var parsed = parseStackAndMessage(warning);
16254 warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
16256 if (!activeFireEvent("warning", warning)) {
16257 formatAndLogError(warning, "", true);
16260 function reconstructStack(message, stacks) {
16261 for (var i = 0; i < stacks.length - 1; ++i) {
16262 stacks[i].push("From previous event:");
16263 stacks[i] = stacks[i].join("\n");
16265 if (i < stacks.length) {
16266 stacks[i] = stacks[i].join("\n");
16268 return message + "\n" + stacks.join("\n");
16270 function removeDuplicateOrEmptyJumps(stacks) {
16271 for (var i = 0; i < stacks.length; ++i) {
16272 if (stacks[i].length === 0 || i + 1 < stacks.length && stacks[i][0] === stacks[i + 1][0]) {
16273 stacks.splice(i, 1);
16278 function removeCommonRoots(stacks) {
16279 var current = stacks[0];
16280 for (var i = 1; i < stacks.length; ++i) {
16281 var prev = stacks[i];
16282 var currentLastIndex = current.length - 1;
16283 var currentLastLine = current[currentLastIndex];
16284 var commonRootMeetPoint = -1;
16285 for (var j = prev.length - 1; j >= 0; --j) {
16286 if (prev[j] === currentLastLine) {
16287 commonRootMeetPoint = j;
16291 for (var j = commonRootMeetPoint; j >= 0; --j) {
16292 var line = prev[j];
16293 if (current[currentLastIndex] === line) {
16295 currentLastIndex--;
16303 function cleanStack(stack) {
16305 for (var i = 0; i < stack.length; ++i) {
16306 var line = stack[i];
16307 var isTraceLine = line === " (No stack trace)" || stackFramePattern.test(line);
16308 var isInternalFrame = isTraceLine && shouldIgnore(line);
16309 if (isTraceLine && !isInternalFrame) {
16310 if (indentStackFrames && line.charAt(0) !== " ") {
16318 function stackFramesAsArray(error) {
16319 var stack = error.stack.replace(/\s+$/g, "").split("\n");
16320 for (var i = 0; i < stack.length; ++i) {
16321 var line = stack[i];
16322 if (line === " (No stack trace)" || stackFramePattern.test(line)) {
16326 if (i > 0 && error.name != "SyntaxError") {
16327 stack = stack.slice(i);
16331 function parseStackAndMessage(error) {
16332 var stack = error.stack;
16333 var message = error.toString();
16334 stack = typeof stack === "string" && stack.length > 0 ? stackFramesAsArray(error) : [" (No stack trace)"];
16337 stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
16340 function formatAndLogError(error, title, isSoft) {
16341 if (typeof console !== "undefined") {
16343 if (util.isObject(error)) {
16344 var stack = error.stack;
16345 message = title + formatStack(stack, error);
16347 message = title + String(error);
16349 if (typeof printWarning === "function") {
16350 printWarning(message, isSoft);
16351 } else if (typeof console.log === "function" || typeof console.log === "object") {
16352 console.log(message);
16356 function fireRejectionEvent(name, localHandler, reason, promise) {
16357 var localEventFired = false;
16359 if (typeof localHandler === "function") {
16360 localEventFired = true;
16361 if (name === "rejectionHandled") {
16362 localHandler(promise);
16364 localHandler(reason, promise);
16368 async.throwLater(e);
16370 if (name === "unhandledRejection") {
16371 if (!activeFireEvent(name, reason, promise) && !localEventFired) {
16372 formatAndLogError(reason, "Unhandled rejection ");
16375 activeFireEvent(name, promise);
16378 function formatNonError(obj2) {
16380 if (typeof obj2 === "function") {
16381 str = "[function " + (obj2.name || "anonymous") + "]";
16383 str = obj2 && typeof obj2.toString === "function" ? obj2.toString() : util.toString(obj2);
16384 var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
16385 if (ruselessToString.test(str)) {
16387 var newStr = JSON.stringify(obj2);
16392 if (str.length === 0) {
16393 str = "(empty array)";
16396 return "(<" + snip(str) + ">, no stack trace)";
16398 function snip(str) {
16400 if (str.length < maxChars) {
16403 return str.substr(0, maxChars - 3) + "...";
16405 function longStackTracesIsSupported() {
16406 return typeof captureStackTrace === "function";
16408 var shouldIgnore = function() {
16411 var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
16412 function parseLineInfo(line) {
16413 var matches = line.match(parseLineInfoRegex);
16416 fileName: matches[1],
16417 line: parseInt(matches[2], 10)
16421 function setBounds(firstLineError, lastLineError) {
16422 if (!longStackTracesIsSupported())
16424 var firstStackLines = firstLineError.stack.split("\n");
16425 var lastStackLines = lastLineError.stack.split("\n");
16426 var firstIndex = -1;
16427 var lastIndex = -1;
16430 for (var i = 0; i < firstStackLines.length; ++i) {
16431 var result = parseLineInfo(firstStackLines[i]);
16433 firstFileName = result.fileName;
16434 firstIndex = result.line;
16438 for (var i = 0; i < lastStackLines.length; ++i) {
16439 var result = parseLineInfo(lastStackLines[i]);
16441 lastFileName = result.fileName;
16442 lastIndex = result.line;
16446 if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || firstFileName !== lastFileName || firstIndex >= lastIndex) {
16449 shouldIgnore = function(line) {
16450 if (bluebirdFramePattern.test(line))
16452 var info = parseLineInfo(line);
16454 if (info.fileName === firstFileName && (firstIndex <= info.line && info.line <= lastIndex)) {
16461 function CapturedTrace(parent) {
16462 this._parent = parent;
16463 this._promisesCreated = 0;
16464 var length = this._length = 1 + (parent === void 0 ? 0 : parent._length);
16465 captureStackTrace(this, CapturedTrace);
16469 util.inherits(CapturedTrace, Error);
16470 Context.CapturedTrace = CapturedTrace;
16471 CapturedTrace.prototype.uncycle = function() {
16472 var length = this._length;
16476 var stackToIndex = {};
16477 for (var i = 0, node = this; node !== void 0; ++i) {
16479 node = node._parent;
16481 length = this._length = i;
16482 for (var i = length - 1; i >= 0; --i) {
16483 var stack = nodes[i].stack;
16484 if (stackToIndex[stack] === void 0) {
16485 stackToIndex[stack] = i;
16488 for (var i = 0; i < length; ++i) {
16489 var currentStack = nodes[i].stack;
16490 var index = stackToIndex[currentStack];
16491 if (index !== void 0 && index !== i) {
16493 nodes[index - 1]._parent = void 0;
16494 nodes[index - 1]._length = 1;
16496 nodes[i]._parent = void 0;
16497 nodes[i]._length = 1;
16498 var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
16499 if (index < length - 1) {
16500 cycleEdgeNode._parent = nodes[index + 1];
16501 cycleEdgeNode._parent.uncycle();
16502 cycleEdgeNode._length = cycleEdgeNode._parent._length + 1;
16504 cycleEdgeNode._parent = void 0;
16505 cycleEdgeNode._length = 1;
16507 var currentChildLength = cycleEdgeNode._length + 1;
16508 for (var j = i - 2; j >= 0; --j) {
16509 nodes[j]._length = currentChildLength;
16510 currentChildLength++;
16516 CapturedTrace.prototype.attachExtraTrace = function(error) {
16517 if (error.__stackCleaned__)
16520 var parsed = parseStackAndMessage(error);
16521 var message = parsed.message;
16522 var stacks = [parsed.stack];
16524 while (trace !== void 0) {
16525 stacks.push(cleanStack(trace.stack.split("\n")));
16526 trace = trace._parent;
16528 removeCommonRoots(stacks);
16529 removeDuplicateOrEmptyJumps(stacks);
16530 util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
16531 util.notEnumerableProp(error, "__stackCleaned__", true);
16533 var captureStackTrace = function stackDetection() {
16534 var v8stackFramePattern = /^\s*at\s*/;
16535 var v8stackFormatter = function(stack, error) {
16536 if (typeof stack === "string")
16538 if (error.name !== void 0 && error.message !== void 0) {
16539 return error.toString();
16541 return formatNonError(error);
16543 if (typeof Error.stackTraceLimit === "number" && typeof Error.captureStackTrace === "function") {
16544 Error.stackTraceLimit += 6;
16545 stackFramePattern = v8stackFramePattern;
16546 formatStack = v8stackFormatter;
16547 var captureStackTrace2 = Error.captureStackTrace;
16548 shouldIgnore = function(line) {
16549 return bluebirdFramePattern.test(line);
16551 return function(receiver, ignoreUntil) {
16552 Error.stackTraceLimit += 6;
16553 captureStackTrace2(receiver, ignoreUntil);
16554 Error.stackTraceLimit -= 6;
16557 var err = new Error();
16558 if (typeof err.stack === "string" && err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
16559 stackFramePattern = /@/;
16560 formatStack = v8stackFormatter;
16561 indentStackFrames = true;
16562 return function captureStackTrace3(o) {
16563 o.stack = new Error().stack;
16566 var hasStackAfterThrow;
16570 hasStackAfterThrow = "stack" in e;
16572 if (!("stack" in err) && hasStackAfterThrow && typeof Error.stackTraceLimit === "number") {
16573 stackFramePattern = v8stackFramePattern;
16574 formatStack = v8stackFormatter;
16575 return function captureStackTrace3(o) {
16576 Error.stackTraceLimit += 6;
16582 Error.stackTraceLimit -= 6;
16585 formatStack = function(stack, error) {
16586 if (typeof stack === "string")
16588 if ((typeof error === "object" || typeof error === "function") && error.name !== void 0 && error.message !== void 0) {
16589 return error.toString();
16591 return formatNonError(error);
16595 if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
16596 printWarning = function(message) {
16597 console.warn(message);
16599 if (util.isNode && process.stderr.isTTY) {
16600 printWarning = function(message, isSoft) {
16601 var color = isSoft ? "
\e[33m" : "
\e[31m";
16602 console.warn(color + message + "
\e[0m\n");
16604 } else if (!util.isNode && typeof new Error().stack === "string") {
16605 printWarning = function(message, isSoft) {
16606 console.warn("%c" + message, isSoft ? "color: darkorange" : "color: red");
16612 longStackTraces: false,
16613 cancellation: false,
16616 if (longStackTraces)
16617 Promise2.longStackTraces();
16619 longStackTraces: function() {
16620 return config.longStackTraces;
16622 warnings: function() {
16623 return config.warnings;
16625 cancellation: function() {
16626 return config.cancellation;
16628 monitoring: function() {
16629 return config.monitoring;
16631 propagateFromFunction: function() {
16632 return propagateFromFunction;
16634 boundValueFunction: function() {
16635 return boundValueFunction;
16637 checkForgottenReturns,
16649 // node_modules/bluebird/js/release/finally.js
16650 var require_finally = __commonJS({
16651 "node_modules/bluebird/js/release/finally.js"(exports2, module2) {
16653 module2.exports = function(Promise2, tryConvertToPromise) {
16654 var util = require_util();
16655 var CancellationError = Promise2.CancellationError;
16656 var errorObj2 = util.errorObj;
16657 function PassThroughHandlerContext(promise, type, handler) {
16658 this.promise = promise;
16660 this.handler = handler;
16661 this.called = false;
16662 this.cancelPromise = null;
16664 PassThroughHandlerContext.prototype.isFinallyHandler = function() {
16665 return this.type === 0;
16667 function FinallyHandlerCancelReaction(finallyHandler2) {
16668 this.finallyHandler = finallyHandler2;
16670 FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
16671 checkCancel(this.finallyHandler);
16673 function checkCancel(ctx, reason) {
16674 if (ctx.cancelPromise != null) {
16675 if (arguments.length > 1) {
16676 ctx.cancelPromise._reject(reason);
16678 ctx.cancelPromise._cancel();
16680 ctx.cancelPromise = null;
16685 function succeed() {
16686 return finallyHandler.call(this, this.promise._target()._settledValue());
16688 function fail(reason) {
16689 if (checkCancel(this, reason))
16691 errorObj2.e = reason;
16694 function finallyHandler(reasonOrValue) {
16695 var promise = this.promise;
16696 var handler = this.handler;
16697 if (!this.called) {
16698 this.called = true;
16699 var ret2 = this.isFinallyHandler() ? handler.call(promise._boundValue()) : handler.call(promise._boundValue(), reasonOrValue);
16700 if (ret2 !== void 0) {
16701 promise._setReturnedNonUndefined();
16702 var maybePromise = tryConvertToPromise(ret2, promise);
16703 if (maybePromise instanceof Promise2) {
16704 if (this.cancelPromise != null) {
16705 if (maybePromise._isCancelled()) {
16706 var reason = new CancellationError("late cancellation observer");
16707 promise._attachExtraTrace(reason);
16708 errorObj2.e = reason;
16710 } else if (maybePromise.isPending()) {
16711 maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this));
16714 return maybePromise._then(succeed, fail, void 0, this, void 0);
16718 if (promise.isRejected()) {
16720 errorObj2.e = reasonOrValue;
16724 return reasonOrValue;
16727 Promise2.prototype._passThrough = function(handler, type, success, fail2) {
16728 if (typeof handler !== "function")
16729 return this.then();
16730 return this._then(success, fail2, void 0, new PassThroughHandlerContext(this, type, handler), void 0);
16732 Promise2.prototype.lastly = Promise2.prototype["finally"] = function(handler) {
16733 return this._passThrough(handler, 0, finallyHandler, finallyHandler);
16735 Promise2.prototype.tap = function(handler) {
16736 return this._passThrough(handler, 1, finallyHandler);
16738 return PassThroughHandlerContext;
16743 // node_modules/bluebird/js/release/catch_filter.js
16744 var require_catch_filter = __commonJS({
16745 "node_modules/bluebird/js/release/catch_filter.js"(exports2, module2) {
16747 module2.exports = function(NEXT_FILTER) {
16748 var util = require_util();
16749 var getKeys = require_es5().keys;
16750 var tryCatch2 = util.tryCatch;
16751 var errorObj2 = util.errorObj;
16752 function catchFilter(instances, cb, promise) {
16753 return function(e) {
16754 var boundTo = promise._boundValue();
16756 for (var i = 0; i < instances.length; ++i) {
16757 var item = instances[i];
16758 if (item === Error || item != null && item.prototype instanceof Error) {
16759 if (e instanceof item) {
16760 return tryCatch2(cb).call(boundTo, e);
16762 } else if (typeof item === "function") {
16763 var matchesPredicate = tryCatch2(item).call(boundTo, e);
16764 if (matchesPredicate === errorObj2) {
16765 return matchesPredicate;
16766 } else if (matchesPredicate) {
16767 return tryCatch2(cb).call(boundTo, e);
16769 } else if (util.isObject(e)) {
16770 var keys = getKeys(item);
16771 for (var j = 0; j < keys.length; ++j) {
16773 if (item[key] != e[key]) {
16774 continue predicateLoop;
16777 return tryCatch2(cb).call(boundTo, e);
16780 return NEXT_FILTER;
16783 return catchFilter;
16788 // node_modules/bluebird/js/release/nodeback.js
16789 var require_nodeback = __commonJS({
16790 "node_modules/bluebird/js/release/nodeback.js"(exports2, module2) {
16792 var util = require_util();
16793 var maybeWrapAsError2 = util.maybeWrapAsError;
16794 var errors = require_errors();
16795 var OperationalError = errors.OperationalError;
16796 var es52 = require_es5();
16797 function isUntypedError(obj2) {
16798 return obj2 instanceof Error && es52.getPrototypeOf(obj2) === Error.prototype;
16800 var rErrorKey = /^(?:name|message|stack|cause)$/;
16801 function wrapAsOperationalError(obj2) {
16803 if (isUntypedError(obj2)) {
16804 ret2 = new OperationalError(obj2);
16805 ret2.name = obj2.name;
16806 ret2.message = obj2.message;
16807 ret2.stack = obj2.stack;
16808 var keys = es52.keys(obj2);
16809 for (var i = 0; i < keys.length; ++i) {
16811 if (!rErrorKey.test(key)) {
16812 ret2[key] = obj2[key];
16817 util.markAsOriginatingFromRejection(obj2);
16820 function nodebackForPromise(promise, multiArgs) {
16821 return function(err, value) {
16822 if (promise === null)
16825 var wrapped = wrapAsOperationalError(maybeWrapAsError2(err));
16826 promise._attachExtraTrace(wrapped);
16827 promise._reject(wrapped);
16828 } else if (!multiArgs) {
16829 promise._fulfill(value);
16831 var $_len = arguments.length;
16832 var args = new Array(Math.max($_len - 1, 0));
16833 for (var $_i = 1; $_i < $_len; ++$_i) {
16834 args[$_i - 1] = arguments[$_i];
16837 promise._fulfill(args);
16842 module2.exports = nodebackForPromise;
16846 // node_modules/bluebird/js/release/method.js
16847 var require_method = __commonJS({
16848 "node_modules/bluebird/js/release/method.js"(exports2, module2) {
16850 module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection, debug) {
16851 var util = require_util();
16852 var tryCatch2 = util.tryCatch;
16853 Promise2.method = function(fn) {
16854 if (typeof fn !== "function") {
16855 throw new Promise2.TypeError("expecting a function but got " + util.classString(fn));
16857 return function() {
16858 var ret2 = new Promise2(INTERNAL2);
16859 ret2._captureStackTrace();
16860 ret2._pushContext();
16861 var value = tryCatch2(fn).apply(this, arguments);
16862 var promiseCreated = ret2._popContext();
16863 debug.checkForgottenReturns(value, promiseCreated, "Promise.method", ret2);
16864 ret2._resolveFromSyncValue(value);
16868 Promise2.attempt = Promise2["try"] = function(fn) {
16869 if (typeof fn !== "function") {
16870 return apiRejection("expecting a function but got " + util.classString(fn));
16872 var ret2 = new Promise2(INTERNAL2);
16873 ret2._captureStackTrace();
16874 ret2._pushContext();
16876 if (arguments.length > 1) {
16877 debug.deprecated("calling Promise.try with more than 1 argument");
16878 var arg = arguments[1];
16879 var ctx = arguments[2];
16880 value = util.isArray(arg) ? tryCatch2(fn).apply(ctx, arg) : tryCatch2(fn).call(ctx, arg);
16882 value = tryCatch2(fn)();
16884 var promiseCreated = ret2._popContext();
16885 debug.checkForgottenReturns(value, promiseCreated, "Promise.try", ret2);
16886 ret2._resolveFromSyncValue(value);
16889 Promise2.prototype._resolveFromSyncValue = function(value) {
16890 if (value === util.errorObj) {
16891 this._rejectCallback(value.e, false);
16893 this._resolveCallback(value, true);
16900 // node_modules/bluebird/js/release/bind.js
16901 var require_bind = __commonJS({
16902 "node_modules/bluebird/js/release/bind.js"(exports2, module2) {
16904 module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, debug) {
16905 var calledBind = false;
16906 var rejectThis = function(_, e) {
16909 var targetRejected = function(e, context) {
16910 context.promiseRejectionQueued = true;
16911 context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
16913 var bindingResolved = function(thisArg, context) {
16914 if ((this._bitField & 50397184) === 0) {
16915 this._resolveCallback(context.target);
16918 var bindingRejected = function(e, context) {
16919 if (!context.promiseRejectionQueued)
16922 Promise2.prototype.bind = function(thisArg) {
16925 Promise2.prototype._propagateFrom = debug.propagateFromFunction();
16926 Promise2.prototype._boundValue = debug.boundValueFunction();
16928 var maybePromise = tryConvertToPromise(thisArg);
16929 var ret2 = new Promise2(INTERNAL2);
16930 ret2._propagateFrom(this, 1);
16931 var target = this._target();
16932 ret2._setBoundTo(maybePromise);
16933 if (maybePromise instanceof Promise2) {
16935 promiseRejectionQueued: false,
16938 bindingPromise: maybePromise
16940 target._then(INTERNAL2, targetRejected, void 0, ret2, context);
16941 maybePromise._then(bindingResolved, bindingRejected, void 0, ret2, context);
16942 ret2._setOnCancel(maybePromise);
16944 ret2._resolveCallback(target);
16948 Promise2.prototype._setBoundTo = function(obj2) {
16949 if (obj2 !== void 0) {
16950 this._bitField = this._bitField | 2097152;
16951 this._boundTo = obj2;
16953 this._bitField = this._bitField & ~2097152;
16956 Promise2.prototype._isBound = function() {
16957 return (this._bitField & 2097152) === 2097152;
16959 Promise2.bind = function(thisArg, value) {
16960 return Promise2.resolve(value).bind(thisArg);
16966 // node_modules/bluebird/js/release/cancel.js
16967 var require_cancel = __commonJS({
16968 "node_modules/bluebird/js/release/cancel.js"(exports2, module2) {
16970 module2.exports = function(Promise2, PromiseArray, apiRejection, debug) {
16971 var util = require_util();
16972 var tryCatch2 = util.tryCatch;
16973 var errorObj2 = util.errorObj;
16974 var async = Promise2._async;
16975 Promise2.prototype["break"] = Promise2.prototype.cancel = function() {
16976 if (!debug.cancellation())
16977 return this._warn("cancellation is disabled");
16978 var promise = this;
16979 var child = promise;
16980 while (promise._isCancellable()) {
16981 if (!promise._cancelBy(child)) {
16982 if (child._isFollowing()) {
16983 child._followee().cancel();
16985 child._cancelBranched();
16989 var parent = promise._cancellationParent;
16990 if (parent == null || !parent._isCancellable()) {
16991 if (promise._isFollowing()) {
16992 promise._followee().cancel();
16994 promise._cancelBranched();
16998 if (promise._isFollowing())
16999 promise._followee().cancel();
17000 promise._setWillBeCancelled();
17006 Promise2.prototype._branchHasCancelled = function() {
17007 this._branchesRemainingToCancel--;
17009 Promise2.prototype._enoughBranchesHaveCancelled = function() {
17010 return this._branchesRemainingToCancel === void 0 || this._branchesRemainingToCancel <= 0;
17012 Promise2.prototype._cancelBy = function(canceller) {
17013 if (canceller === this) {
17014 this._branchesRemainingToCancel = 0;
17015 this._invokeOnCancel();
17018 this._branchHasCancelled();
17019 if (this._enoughBranchesHaveCancelled()) {
17020 this._invokeOnCancel();
17026 Promise2.prototype._cancelBranched = function() {
17027 if (this._enoughBranchesHaveCancelled()) {
17031 Promise2.prototype._cancel = function() {
17032 if (!this._isCancellable())
17034 this._setCancelled();
17035 async.invoke(this._cancelPromises, this, void 0);
17037 Promise2.prototype._cancelPromises = function() {
17038 if (this._length() > 0)
17039 this._settlePromises();
17041 Promise2.prototype._unsetOnCancel = function() {
17042 this._onCancelField = void 0;
17044 Promise2.prototype._isCancellable = function() {
17045 return this.isPending() && !this._isCancelled();
17047 Promise2.prototype.isCancellable = function() {
17048 return this.isPending() && !this.isCancelled();
17050 Promise2.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
17051 if (util.isArray(onCancelCallback)) {
17052 for (var i = 0; i < onCancelCallback.length; ++i) {
17053 this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
17055 } else if (onCancelCallback !== void 0) {
17056 if (typeof onCancelCallback === "function") {
17057 if (!internalOnly) {
17058 var e = tryCatch2(onCancelCallback).call(this._boundValue());
17059 if (e === errorObj2) {
17060 this._attachExtraTrace(e.e);
17061 async.throwLater(e.e);
17065 onCancelCallback._resultCancelled(this);
17069 Promise2.prototype._invokeOnCancel = function() {
17070 var onCancelCallback = this._onCancel();
17071 this._unsetOnCancel();
17072 async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
17074 Promise2.prototype._invokeInternalOnCancel = function() {
17075 if (this._isCancellable()) {
17076 this._doInvokeOnCancel(this._onCancel(), true);
17077 this._unsetOnCancel();
17080 Promise2.prototype._resultCancelled = function() {
17087 // node_modules/bluebird/js/release/direct_resolve.js
17088 var require_direct_resolve = __commonJS({
17089 "node_modules/bluebird/js/release/direct_resolve.js"(exports2, module2) {
17091 module2.exports = function(Promise2) {
17092 function returner() {
17095 function thrower2() {
17098 Promise2.prototype["return"] = Promise2.prototype.thenReturn = function(value) {
17099 if (value instanceof Promise2)
17100 value.suppressUnhandledRejections();
17101 return this._then(returner, void 0, void 0, { value }, void 0);
17103 Promise2.prototype["throw"] = Promise2.prototype.thenThrow = function(reason) {
17104 return this._then(thrower2, void 0, void 0, { reason }, void 0);
17106 Promise2.prototype.catchThrow = function(reason) {
17107 if (arguments.length <= 1) {
17108 return this._then(void 0, thrower2, void 0, { reason }, void 0);
17110 var _reason = arguments[1];
17111 var handler = function() {
17114 return this.caught(reason, handler);
17117 Promise2.prototype.catchReturn = function(value) {
17118 if (arguments.length <= 1) {
17119 if (value instanceof Promise2)
17120 value.suppressUnhandledRejections();
17121 return this._then(void 0, returner, void 0, { value }, void 0);
17123 var _value = arguments[1];
17124 if (_value instanceof Promise2)
17125 _value.suppressUnhandledRejections();
17126 var handler = function() {
17129 return this.caught(value, handler);
17136 // node_modules/bluebird/js/release/synchronous_inspection.js
17137 var require_synchronous_inspection = __commonJS({
17138 "node_modules/bluebird/js/release/synchronous_inspection.js"(exports2, module2) {
17140 module2.exports = function(Promise2) {
17141 function PromiseInspection(promise) {
17142 if (promise !== void 0) {
17143 promise = promise._target();
17144 this._bitField = promise._bitField;
17145 this._settledValueField = promise._isFateSealed() ? promise._settledValue() : void 0;
17147 this._bitField = 0;
17148 this._settledValueField = void 0;
17151 PromiseInspection.prototype._settledValue = function() {
17152 return this._settledValueField;
17154 var value = PromiseInspection.prototype.value = function() {
17155 if (!this.isFulfilled()) {
17156 throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");
17158 return this._settledValue();
17160 var reason = PromiseInspection.prototype.error = PromiseInspection.prototype.reason = function() {
17161 if (!this.isRejected()) {
17162 throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");
17164 return this._settledValue();
17166 var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
17167 return (this._bitField & 33554432) !== 0;
17169 var isRejected = PromiseInspection.prototype.isRejected = function() {
17170 return (this._bitField & 16777216) !== 0;
17172 var isPending = PromiseInspection.prototype.isPending = function() {
17173 return (this._bitField & 50397184) === 0;
17175 var isResolved = PromiseInspection.prototype.isResolved = function() {
17176 return (this._bitField & 50331648) !== 0;
17178 PromiseInspection.prototype.isCancelled = function() {
17179 return (this._bitField & 8454144) !== 0;
17181 Promise2.prototype.__isCancelled = function() {
17182 return (this._bitField & 65536) === 65536;
17184 Promise2.prototype._isCancelled = function() {
17185 return this._target().__isCancelled();
17187 Promise2.prototype.isCancelled = function() {
17188 return (this._target()._bitField & 8454144) !== 0;
17190 Promise2.prototype.isPending = function() {
17191 return isPending.call(this._target());
17193 Promise2.prototype.isRejected = function() {
17194 return isRejected.call(this._target());
17196 Promise2.prototype.isFulfilled = function() {
17197 return isFulfilled.call(this._target());
17199 Promise2.prototype.isResolved = function() {
17200 return isResolved.call(this._target());
17202 Promise2.prototype.value = function() {
17203 return value.call(this._target());
17205 Promise2.prototype.reason = function() {
17206 var target = this._target();
17207 target._unsetRejectionIsUnhandled();
17208 return reason.call(target);
17210 Promise2.prototype._value = function() {
17211 return this._settledValue();
17213 Promise2.prototype._reason = function() {
17214 this._unsetRejectionIsUnhandled();
17215 return this._settledValue();
17217 Promise2.PromiseInspection = PromiseInspection;
17222 // node_modules/bluebird/js/release/join.js
17223 var require_join = __commonJS({
17224 "node_modules/bluebird/js/release/join.js"(exports2, module2) {
17226 module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, INTERNAL2, async, getDomain) {
17227 var util = require_util();
17228 var canEvaluate2 = util.canEvaluate;
17229 var tryCatch2 = util.tryCatch;
17230 var errorObj2 = util.errorObj;
17233 if (canEvaluate2) {
17234 var thenCallback = function(i2) {
17235 return new Function("value", "holder", " \n 'use strict'; \n holder.pIndex = value; \n holder.checkFulfillment(this); \n ".replace(/Index/g, i2));
17237 var promiseSetter = function(i2) {
17238 return new Function("promise", "holder", " \n 'use strict'; \n holder.pIndex = promise; \n ".replace(/Index/g, i2));
17240 var generateHolderClass = function(total) {
17241 var props = new Array(total);
17242 for (var i2 = 0; i2 < props.length; ++i2) {
17243 props[i2] = "this.p" + (i2 + 1);
17245 var assignment = props.join(" = ") + " = null;";
17246 var cancellationCode = "var promise;\n" + props.map(function(prop) {
17247 return " \n promise = " + prop + "; \n if (promise instanceof Promise) { \n promise.cancel(); \n } \n ";
17249 var passedArguments = props.join(", ");
17250 var name = "Holder$" + total;
17251 var code = "return function(tryCatch, errorObj, Promise, async) { \n 'use strict'; \n function [TheName](fn) { \n [TheProperties] \n this.fn = fn; \n this.asyncNeeded = true; \n this.now = 0; \n } \n \n [TheName].prototype._callFunction = function(promise) { \n promise._pushContext(); \n var ret = tryCatch(this.fn)([ThePassedArguments]); \n promise._popContext(); \n if (ret === errorObj) { \n promise._rejectCallback(ret.e, false); \n } else { \n promise._resolveCallback(ret); \n } \n }; \n \n [TheName].prototype.checkFulfillment = function(promise) { \n var now = ++this.now; \n if (now === [TheTotal]) { \n if (this.asyncNeeded) { \n async.invoke(this._callFunction, this, promise); \n } else { \n this._callFunction(promise); \n } \n \n } \n }; \n \n [TheName].prototype._resultCancelled = function() { \n [CancellationCode] \n }; \n \n return [TheName]; \n }(tryCatch, errorObj, Promise, async); \n ";
17252 code = code.replace(/\[TheName\]/g, name).replace(/\[TheTotal\]/g, total).replace(/\[ThePassedArguments\]/g, passedArguments).replace(/\[TheProperties\]/g, assignment).replace(/\[CancellationCode\]/g, cancellationCode);
17253 return new Function("tryCatch", "errorObj", "Promise", "async", code)(tryCatch2, errorObj2, Promise2, async);
17255 var holderClasses = [];
17256 var thenCallbacks = [];
17257 var promiseSetters = [];
17258 for (var i = 0; i < 8; ++i) {
17259 holderClasses.push(generateHolderClass(i + 1));
17260 thenCallbacks.push(thenCallback(i + 1));
17261 promiseSetters.push(promiseSetter(i + 1));
17263 reject = function(reason) {
17264 this._reject(reason);
17268 Promise2.join = function() {
17269 var last = arguments.length - 1;
17271 if (last > 0 && typeof arguments[last] === "function") {
17272 fn = arguments[last];
17274 if (last <= 8 && canEvaluate2) {
17275 var ret2 = new Promise2(INTERNAL2);
17276 ret2._captureStackTrace();
17277 var HolderClass = holderClasses[last - 1];
17278 var holder = new HolderClass(fn);
17279 var callbacks = thenCallbacks;
17280 for (var i2 = 0; i2 < last; ++i2) {
17281 var maybePromise = tryConvertToPromise(arguments[i2], ret2);
17282 if (maybePromise instanceof Promise2) {
17283 maybePromise = maybePromise._target();
17284 var bitField = maybePromise._bitField;
17286 if ((bitField & 50397184) === 0) {
17287 maybePromise._then(callbacks[i2], reject, void 0, ret2, holder);
17288 promiseSetters[i2](maybePromise, holder);
17289 holder.asyncNeeded = false;
17290 } else if ((bitField & 33554432) !== 0) {
17291 callbacks[i2].call(ret2, maybePromise._value(), holder);
17292 } else if ((bitField & 16777216) !== 0) {
17293 ret2._reject(maybePromise._reason());
17298 callbacks[i2].call(ret2, maybePromise, holder);
17301 if (!ret2._isFateSealed()) {
17302 if (holder.asyncNeeded) {
17303 var domain = getDomain();
17304 if (domain !== null) {
17305 holder.fn = util.domainBind(domain, holder.fn);
17308 ret2._setAsyncGuaranteed();
17309 ret2._setOnCancel(holder);
17315 var $_len = arguments.length;
17316 var args = new Array($_len);
17317 for (var $_i = 0; $_i < $_len; ++$_i) {
17318 args[$_i] = arguments[$_i];
17323 var ret2 = new PromiseArray(args).promise();
17324 return fn !== void 0 ? ret2.spread(fn) : ret2;
17330 // node_modules/bluebird/js/release/map.js
17331 var require_map = __commonJS({
17332 "node_modules/bluebird/js/release/map.js"(exports2, module2) {
17334 module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug) {
17335 var getDomain = Promise2._getDomain;
17336 var util = require_util();
17337 var tryCatch2 = util.tryCatch;
17338 var errorObj2 = util.errorObj;
17339 var async = Promise2._async;
17340 function MappingPromiseArray(promises, fn, limit, _filter) {
17341 this.constructor$(promises);
17342 this._promise._captureStackTrace();
17343 var domain = getDomain();
17344 this._callback = domain === null ? fn : util.domainBind(domain, fn);
17345 this._preservedValues = _filter === INTERNAL2 ? new Array(this.length()) : null;
17346 this._limit = limit;
17347 this._inFlight = 0;
17349 async.invoke(this._asyncInit, this, void 0);
17351 util.inherits(MappingPromiseArray, PromiseArray);
17352 MappingPromiseArray.prototype._asyncInit = function() {
17353 this._init$(void 0, -2);
17355 MappingPromiseArray.prototype._init = function() {
17357 MappingPromiseArray.prototype._promiseFulfilled = function(value, index) {
17358 var values = this._values;
17359 var length = this.length();
17360 var preservedValues = this._preservedValues;
17361 var limit = this._limit;
17363 index = index * -1 - 1;
17364 values[index] = value;
17367 this._drainQueue();
17368 if (this._isResolved())
17372 if (limit >= 1 && this._inFlight >= limit) {
17373 values[index] = value;
17374 this._queue.push(index);
17377 if (preservedValues !== null)
17378 preservedValues[index] = value;
17379 var promise = this._promise;
17380 var callback = this._callback;
17381 var receiver = promise._boundValue();
17382 promise._pushContext();
17383 var ret2 = tryCatch2(callback).call(receiver, value, index, length);
17384 var promiseCreated = promise._popContext();
17385 debug.checkForgottenReturns(ret2, promiseCreated, preservedValues !== null ? "Promise.filter" : "Promise.map", promise);
17386 if (ret2 === errorObj2) {
17387 this._reject(ret2.e);
17390 var maybePromise = tryConvertToPromise(ret2, this._promise);
17391 if (maybePromise instanceof Promise2) {
17392 maybePromise = maybePromise._target();
17393 var bitField = maybePromise._bitField;
17395 if ((bitField & 50397184) === 0) {
17398 values[index] = maybePromise;
17399 maybePromise._proxy(this, (index + 1) * -1);
17401 } else if ((bitField & 33554432) !== 0) {
17402 ret2 = maybePromise._value();
17403 } else if ((bitField & 16777216) !== 0) {
17404 this._reject(maybePromise._reason());
17411 values[index] = ret2;
17413 var totalResolved = ++this._totalResolved;
17414 if (totalResolved >= length) {
17415 if (preservedValues !== null) {
17416 this._filter(values, preservedValues);
17418 this._resolve(values);
17424 MappingPromiseArray.prototype._drainQueue = function() {
17425 var queue = this._queue;
17426 var limit = this._limit;
17427 var values = this._values;
17428 while (queue.length > 0 && this._inFlight < limit) {
17429 if (this._isResolved())
17431 var index = queue.pop();
17432 this._promiseFulfilled(values[index], index);
17435 MappingPromiseArray.prototype._filter = function(booleans, values) {
17436 var len = values.length;
17437 var ret2 = new Array(len);
17439 for (var i = 0; i < len; ++i) {
17441 ret2[j++] = values[i];
17444 this._resolve(ret2);
17446 MappingPromiseArray.prototype.preservedValues = function() {
17447 return this._preservedValues;
17449 function map(promises, fn, options, _filter) {
17450 if (typeof fn !== "function") {
17451 return apiRejection("expecting a function but got " + util.classString(fn));
17454 if (options !== void 0) {
17455 if (typeof options === "object" && options !== null) {
17456 if (typeof options.concurrency !== "number") {
17457 return Promise2.reject(new TypeError("'concurrency' must be a number but it is " + util.classString(options.concurrency)));
17459 limit = options.concurrency;
17461 return Promise2.reject(new TypeError("options argument must be an object but it is " + util.classString(options)));
17464 limit = typeof limit === "number" && isFinite(limit) && limit >= 1 ? limit : 0;
17465 return new MappingPromiseArray(promises, fn, limit, _filter).promise();
17467 Promise2.prototype.map = function(fn, options) {
17468 return map(this, fn, options, null);
17470 Promise2.map = function(promises, fn, options, _filter) {
17471 return map(promises, fn, options, _filter);
17477 // node_modules/bluebird/js/release/call_get.js
17478 var require_call_get = __commonJS({
17479 "node_modules/bluebird/js/release/call_get.js"(exports2, module2) {
17481 var cr = Object.create;
17483 callerCache = cr(null);
17484 getterCache = cr(null);
17485 callerCache[" size"] = getterCache[" size"] = 0;
17489 module2.exports = function(Promise2) {
17490 var util = require_util();
17491 var canEvaluate2 = util.canEvaluate;
17492 var isIdentifier2 = util.isIdentifier;
17493 var getMethodCaller;
17496 var makeMethodCaller = function(methodName) {
17497 return new Function("ensureMethod", " \n return function(obj) { \n 'use strict' \n var len = this.length; \n ensureMethod(obj, 'methodName'); \n switch(len) { \n case 1: return obj.methodName(this[0]); \n case 2: return obj.methodName(this[0], this[1]); \n case 3: return obj.methodName(this[0], this[1], this[2]); \n case 0: return obj.methodName(); \n default: \n return obj.methodName.apply(obj, this); \n } \n }; \n ".replace(/methodName/g, methodName))(ensureMethod);
17499 var makeGetter = function(propertyName) {
17500 return new Function("obj", " \n 'use strict'; \n return obj.propertyName; \n ".replace("propertyName", propertyName));
17502 var getCompiled = function(name, compiler, cache) {
17503 var ret2 = cache[name];
17504 if (typeof ret2 !== "function") {
17505 if (!isIdentifier2(name)) {
17508 ret2 = compiler(name);
17509 cache[name] = ret2;
17511 if (cache[" size"] > 512) {
17512 var keys = Object.keys(cache);
17513 for (var i = 0; i < 256; ++i)
17514 delete cache[keys[i]];
17515 cache[" size"] = keys.length - 256;
17520 getMethodCaller = function(name) {
17521 return getCompiled(name, makeMethodCaller, callerCache);
17523 getGetter = function(name) {
17524 return getCompiled(name, makeGetter, getterCache);
17527 function ensureMethod(obj2, methodName) {
17530 fn = obj2[methodName];
17531 if (typeof fn !== "function") {
17532 var message = "Object " + util.classString(obj2) + " has no method '" + util.toString(methodName) + "'";
17533 throw new Promise2.TypeError(message);
17537 function caller(obj2) {
17538 var methodName = this.pop();
17539 var fn = ensureMethod(obj2, methodName);
17540 return fn.apply(obj2, this);
17542 Promise2.prototype.call = function(methodName) {
17543 var $_len = arguments.length;
17544 var args = new Array(Math.max($_len - 1, 0));
17545 for (var $_i = 1; $_i < $_len; ++$_i) {
17546 args[$_i - 1] = arguments[$_i];
17550 if (canEvaluate2) {
17551 var maybeCaller = getMethodCaller(methodName);
17552 if (maybeCaller !== null) {
17553 return this._then(maybeCaller, void 0, void 0, args, void 0);
17557 args.push(methodName);
17558 return this._then(caller, void 0, void 0, args, void 0);
17560 function namedGetter(obj2) {
17563 function indexedGetter(obj2) {
17566 index = Math.max(0, index + obj2.length);
17567 return obj2[index];
17569 Promise2.prototype.get = function(propertyName) {
17570 var isIndex = typeof propertyName === "number";
17573 if (canEvaluate2) {
17574 var maybeGetter = getGetter(propertyName);
17575 getter = maybeGetter !== null ? maybeGetter : namedGetter;
17577 getter = namedGetter;
17580 getter = indexedGetter;
17582 return this._then(getter, void 0, void 0, propertyName, void 0);
17588 // node_modules/bluebird/js/release/using.js
17589 var require_using = __commonJS({
17590 "node_modules/bluebird/js/release/using.js"(exports2, module2) {
17592 module2.exports = function(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL2, debug) {
17593 var util = require_util();
17594 var TypeError2 = require_errors().TypeError;
17595 var inherits2 = require_util().inherits;
17596 var errorObj2 = util.errorObj;
17597 var tryCatch2 = util.tryCatch;
17599 function thrower2(e) {
17600 setTimeout(function() {
17604 function castPreservingDisposable(thenable) {
17605 var maybePromise = tryConvertToPromise(thenable);
17606 if (maybePromise !== thenable && typeof thenable._isDisposable === "function" && typeof thenable._getDisposer === "function" && thenable._isDisposable()) {
17607 maybePromise._setDisposable(thenable._getDisposer());
17609 return maybePromise;
17611 function dispose(resources, inspection) {
17613 var len = resources.length;
17614 var ret2 = new Promise2(INTERNAL2);
17615 function iterator() {
17617 return ret2._fulfill();
17618 var maybePromise = castPreservingDisposable(resources[i++]);
17619 if (maybePromise instanceof Promise2 && maybePromise._isDisposable()) {
17621 maybePromise = tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection), resources.promise);
17623 return thrower2(e);
17625 if (maybePromise instanceof Promise2) {
17626 return maybePromise._then(iterator, thrower2, null, null, null);
17634 function Disposer(data, promise, context) {
17636 this._promise = promise;
17637 this._context = context;
17639 Disposer.prototype.data = function() {
17642 Disposer.prototype.promise = function() {
17643 return this._promise;
17645 Disposer.prototype.resource = function() {
17646 if (this.promise().isFulfilled()) {
17647 return this.promise().value();
17651 Disposer.prototype.tryDispose = function(inspection) {
17652 var resource = this.resource();
17653 var context = this._context;
17654 if (context !== void 0)
17655 context._pushContext();
17656 var ret2 = resource !== NULL ? this.doDispose(resource, inspection) : null;
17657 if (context !== void 0)
17658 context._popContext();
17659 this._promise._unsetDisposable();
17663 Disposer.isDisposer = function(d) {
17664 return d != null && typeof d.resource === "function" && typeof d.tryDispose === "function";
17666 function FunctionDisposer(fn, promise, context) {
17667 this.constructor$(fn, promise, context);
17669 inherits2(FunctionDisposer, Disposer);
17670 FunctionDisposer.prototype.doDispose = function(resource, inspection) {
17671 var fn = this.data();
17672 return fn.call(resource, resource, inspection);
17674 function maybeUnwrapDisposer(value) {
17675 if (Disposer.isDisposer(value)) {
17676 this.resources[this.index]._setDisposable(value);
17677 return value.promise();
17681 function ResourceList(length) {
17682 this.length = length;
17683 this.promise = null;
17684 this[length - 1] = null;
17686 ResourceList.prototype._resultCancelled = function() {
17687 var len = this.length;
17688 for (var i = 0; i < len; ++i) {
17689 var item = this[i];
17690 if (item instanceof Promise2) {
17695 Promise2.using = function() {
17696 var len = arguments.length;
17698 return apiRejection("you must pass at least 2 arguments to Promise.using");
17699 var fn = arguments[len - 1];
17700 if (typeof fn !== "function") {
17701 return apiRejection("expecting a function but got " + util.classString(fn));
17704 var spreadArgs = true;
17705 if (len === 2 && Array.isArray(arguments[0])) {
17706 input = arguments[0];
17707 len = input.length;
17708 spreadArgs = false;
17713 var resources = new ResourceList(len);
17714 for (var i = 0; i < len; ++i) {
17715 var resource = input[i];
17716 if (Disposer.isDisposer(resource)) {
17717 var disposer = resource;
17718 resource = resource.promise();
17719 resource._setDisposable(disposer);
17721 var maybePromise = tryConvertToPromise(resource);
17722 if (maybePromise instanceof Promise2) {
17723 resource = maybePromise._then(maybeUnwrapDisposer, null, null, {
17729 resources[i] = resource;
17731 var reflectedResources = new Array(resources.length);
17732 for (var i = 0; i < reflectedResources.length; ++i) {
17733 reflectedResources[i] = Promise2.resolve(resources[i]).reflect();
17735 var resultPromise = Promise2.all(reflectedResources).then(function(inspections) {
17736 for (var i2 = 0; i2 < inspections.length; ++i2) {
17737 var inspection = inspections[i2];
17738 if (inspection.isRejected()) {
17739 errorObj2.e = inspection.error();
17741 } else if (!inspection.isFulfilled()) {
17742 resultPromise.cancel();
17745 inspections[i2] = inspection.value();
17747 promise._pushContext();
17748 fn = tryCatch2(fn);
17749 var ret2 = spreadArgs ? fn.apply(void 0, inspections) : fn(inspections);
17750 var promiseCreated = promise._popContext();
17751 debug.checkForgottenReturns(ret2, promiseCreated, "Promise.using", promise);
17754 var promise = resultPromise.lastly(function() {
17755 var inspection = new Promise2.PromiseInspection(resultPromise);
17756 return dispose(resources, inspection);
17758 resources.promise = promise;
17759 promise._setOnCancel(resources);
17762 Promise2.prototype._setDisposable = function(disposer) {
17763 this._bitField = this._bitField | 131072;
17764 this._disposer = disposer;
17766 Promise2.prototype._isDisposable = function() {
17767 return (this._bitField & 131072) > 0;
17769 Promise2.prototype._getDisposer = function() {
17770 return this._disposer;
17772 Promise2.prototype._unsetDisposable = function() {
17773 this._bitField = this._bitField & ~131072;
17774 this._disposer = void 0;
17776 Promise2.prototype.disposer = function(fn) {
17777 if (typeof fn === "function") {
17778 return new FunctionDisposer(fn, this, createContext());
17780 throw new TypeError2();
17786 // node_modules/bluebird/js/release/timers.js
17787 var require_timers = __commonJS({
17788 "node_modules/bluebird/js/release/timers.js"(exports2, module2) {
17790 module2.exports = function(Promise2, INTERNAL2, debug) {
17791 var util = require_util();
17792 var TimeoutError = Promise2.TimeoutError;
17793 function HandleWrapper(handle) {
17794 this.handle = handle;
17796 HandleWrapper.prototype._resultCancelled = function() {
17797 clearTimeout(this.handle);
17799 var afterValue = function(value) {
17800 return delay(+this).thenReturn(value);
17802 var delay = Promise2.delay = function(ms, value) {
17805 if (value !== void 0) {
17806 ret2 = Promise2.resolve(value)._then(afterValue, null, null, ms, void 0);
17807 if (debug.cancellation() && value instanceof Promise2) {
17808 ret2._setOnCancel(value);
17811 ret2 = new Promise2(INTERNAL2);
17812 handle = setTimeout(function() {
17815 if (debug.cancellation()) {
17816 ret2._setOnCancel(new HandleWrapper(handle));
17818 ret2._captureStackTrace();
17820 ret2._setAsyncGuaranteed();
17823 Promise2.prototype.delay = function(ms) {
17824 return delay(ms, this);
17826 var afterTimeout = function(promise, message, parent) {
17828 if (typeof message !== "string") {
17829 if (message instanceof Error) {
17832 err = new TimeoutError("operation timed out");
17835 err = new TimeoutError(message);
17837 util.markAsOriginatingFromRejection(err);
17838 promise._attachExtraTrace(err);
17839 promise._reject(err);
17840 if (parent != null) {
17844 function successClear(value) {
17845 clearTimeout(this.handle);
17848 function failureClear(reason) {
17849 clearTimeout(this.handle);
17852 Promise2.prototype.timeout = function(ms, message) {
17855 var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
17856 if (ret2.isPending()) {
17857 afterTimeout(ret2, message, parent);
17860 if (debug.cancellation()) {
17861 parent = this.then();
17862 ret2 = parent._then(successClear, failureClear, void 0, handleWrapper, void 0);
17863 ret2._setOnCancel(handleWrapper);
17865 ret2 = this._then(successClear, failureClear, void 0, handleWrapper, void 0);
17873 // node_modules/bluebird/js/release/generators.js
17874 var require_generators = __commonJS({
17875 "node_modules/bluebird/js/release/generators.js"(exports2, module2) {
17877 module2.exports = function(Promise2, apiRejection, INTERNAL2, tryConvertToPromise, Proxyable, debug) {
17878 var errors = require_errors();
17879 var TypeError2 = errors.TypeError;
17880 var util = require_util();
17881 var errorObj2 = util.errorObj;
17882 var tryCatch2 = util.tryCatch;
17883 var yieldHandlers = [];
17884 function promiseFromYieldHandler(value, yieldHandlers2, traceParent) {
17885 for (var i = 0; i < yieldHandlers2.length; ++i) {
17886 traceParent._pushContext();
17887 var result = tryCatch2(yieldHandlers2[i])(value);
17888 traceParent._popContext();
17889 if (result === errorObj2) {
17890 traceParent._pushContext();
17891 var ret2 = Promise2.reject(errorObj2.e);
17892 traceParent._popContext();
17895 var maybePromise = tryConvertToPromise(result, traceParent);
17896 if (maybePromise instanceof Promise2)
17897 return maybePromise;
17901 function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
17902 if (debug.cancellation()) {
17903 var internal = new Promise2(INTERNAL2);
17904 var _finallyPromise = this._finallyPromise = new Promise2(INTERNAL2);
17905 this._promise = internal.lastly(function() {
17906 return _finallyPromise;
17908 internal._captureStackTrace();
17909 internal._setOnCancel(this);
17911 var promise = this._promise = new Promise2(INTERNAL2);
17912 promise._captureStackTrace();
17914 this._stack = stack;
17915 this._generatorFunction = generatorFunction;
17916 this._receiver = receiver;
17917 this._generator = void 0;
17918 this._yieldHandlers = typeof yieldHandler === "function" ? [yieldHandler].concat(yieldHandlers) : yieldHandlers;
17919 this._yieldedPromise = null;
17920 this._cancellationPhase = false;
17922 util.inherits(PromiseSpawn, Proxyable);
17923 PromiseSpawn.prototype._isResolved = function() {
17924 return this._promise === null;
17926 PromiseSpawn.prototype._cleanup = function() {
17927 this._promise = this._generator = null;
17928 if (debug.cancellation() && this._finallyPromise !== null) {
17929 this._finallyPromise._fulfill();
17930 this._finallyPromise = null;
17933 PromiseSpawn.prototype._promiseCancelled = function() {
17934 if (this._isResolved())
17936 var implementsReturn = typeof this._generator["return"] !== "undefined";
17938 if (!implementsReturn) {
17939 var reason = new Promise2.CancellationError("generator .return() sentinel");
17940 Promise2.coroutine.returnSentinel = reason;
17941 this._promise._attachExtraTrace(reason);
17942 this._promise._pushContext();
17943 result = tryCatch2(this._generator["throw"]).call(this._generator, reason);
17944 this._promise._popContext();
17946 this._promise._pushContext();
17947 result = tryCatch2(this._generator["return"]).call(this._generator, void 0);
17948 this._promise._popContext();
17950 this._cancellationPhase = true;
17951 this._yieldedPromise = null;
17952 this._continue(result);
17954 PromiseSpawn.prototype._promiseFulfilled = function(value) {
17955 this._yieldedPromise = null;
17956 this._promise._pushContext();
17957 var result = tryCatch2(this._generator.next).call(this._generator, value);
17958 this._promise._popContext();
17959 this._continue(result);
17961 PromiseSpawn.prototype._promiseRejected = function(reason) {
17962 this._yieldedPromise = null;
17963 this._promise._attachExtraTrace(reason);
17964 this._promise._pushContext();
17965 var result = tryCatch2(this._generator["throw"]).call(this._generator, reason);
17966 this._promise._popContext();
17967 this._continue(result);
17969 PromiseSpawn.prototype._resultCancelled = function() {
17970 if (this._yieldedPromise instanceof Promise2) {
17971 var promise = this._yieldedPromise;
17972 this._yieldedPromise = null;
17976 PromiseSpawn.prototype.promise = function() {
17977 return this._promise;
17979 PromiseSpawn.prototype._run = function() {
17980 this._generator = this._generatorFunction.call(this._receiver);
17981 this._receiver = this._generatorFunction = void 0;
17982 this._promiseFulfilled(void 0);
17984 PromiseSpawn.prototype._continue = function(result) {
17985 var promise = this._promise;
17986 if (result === errorObj2) {
17988 if (this._cancellationPhase) {
17989 return promise.cancel();
17991 return promise._rejectCallback(result.e, false);
17994 var value = result.value;
17995 if (result.done === true) {
17997 if (this._cancellationPhase) {
17998 return promise.cancel();
18000 return promise._resolveCallback(value);
18003 var maybePromise = tryConvertToPromise(value, this._promise);
18004 if (!(maybePromise instanceof Promise2)) {
18005 maybePromise = promiseFromYieldHandler(maybePromise, this._yieldHandlers, this._promise);
18006 if (maybePromise === null) {
18007 this._promiseRejected(new TypeError2("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s", value) + "From coroutine:\n" + this._stack.split("\n").slice(1, -7).join("\n")));
18011 maybePromise = maybePromise._target();
18012 var bitField = maybePromise._bitField;
18014 if ((bitField & 50397184) === 0) {
18015 this._yieldedPromise = maybePromise;
18016 maybePromise._proxy(this, null);
18017 } else if ((bitField & 33554432) !== 0) {
18018 Promise2._async.invoke(this._promiseFulfilled, this, maybePromise._value());
18019 } else if ((bitField & 16777216) !== 0) {
18020 Promise2._async.invoke(this._promiseRejected, this, maybePromise._reason());
18022 this._promiseCancelled();
18026 Promise2.coroutine = function(generatorFunction, options) {
18027 if (typeof generatorFunction !== "function") {
18028 throw new TypeError2("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
18030 var yieldHandler = Object(options).yieldHandler;
18031 var PromiseSpawn$ = PromiseSpawn;
18032 var stack = new Error().stack;
18033 return function() {
18034 var generator = generatorFunction.apply(this, arguments);
18035 var spawn = new PromiseSpawn$(void 0, void 0, yieldHandler, stack);
18036 var ret2 = spawn.promise();
18037 spawn._generator = generator;
18038 spawn._promiseFulfilled(void 0);
18042 Promise2.coroutine.addYieldHandler = function(fn) {
18043 if (typeof fn !== "function") {
18044 throw new TypeError2("expecting a function but got " + util.classString(fn));
18046 yieldHandlers.push(fn);
18048 Promise2.spawn = function(generatorFunction) {
18049 debug.deprecated("Promise.spawn()", "Promise.coroutine()");
18050 if (typeof generatorFunction !== "function") {
18051 return apiRejection("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");
18053 var spawn = new PromiseSpawn(generatorFunction, this);
18054 var ret2 = spawn.promise();
18055 spawn._run(Promise2.spawn);
18062 // node_modules/bluebird/js/release/nodeify.js
18063 var require_nodeify = __commonJS({
18064 "node_modules/bluebird/js/release/nodeify.js"(exports2, module2) {
18066 module2.exports = function(Promise2) {
18067 var util = require_util();
18068 var async = Promise2._async;
18069 var tryCatch2 = util.tryCatch;
18070 var errorObj2 = util.errorObj;
18071 function spreadAdapter(val, nodeback) {
18072 var promise = this;
18073 if (!util.isArray(val))
18074 return successAdapter.call(promise, val, nodeback);
18075 var ret2 = tryCatch2(nodeback).apply(promise._boundValue(), [null].concat(val));
18076 if (ret2 === errorObj2) {
18077 async.throwLater(ret2.e);
18080 function successAdapter(val, nodeback) {
18081 var promise = this;
18082 var receiver = promise._boundValue();
18083 var ret2 = val === void 0 ? tryCatch2(nodeback).call(receiver, null) : tryCatch2(nodeback).call(receiver, null, val);
18084 if (ret2 === errorObj2) {
18085 async.throwLater(ret2.e);
18088 function errorAdapter(reason, nodeback) {
18089 var promise = this;
18091 var newReason = new Error(reason + "");
18092 newReason.cause = reason;
18093 reason = newReason;
18095 var ret2 = tryCatch2(nodeback).call(promise._boundValue(), reason);
18096 if (ret2 === errorObj2) {
18097 async.throwLater(ret2.e);
18100 Promise2.prototype.asCallback = Promise2.prototype.nodeify = function(nodeback, options) {
18101 if (typeof nodeback == "function") {
18102 var adapter = successAdapter;
18103 if (options !== void 0 && Object(options).spread) {
18104 adapter = spreadAdapter;
18106 this._then(adapter, errorAdapter, void 0, this, nodeback);
18114 // node_modules/bluebird/js/release/promisify.js
18115 var require_promisify = __commonJS({
18116 "node_modules/bluebird/js/release/promisify.js"(exports2, module2) {
18118 module2.exports = function(Promise2, INTERNAL2) {
18120 var util = require_util();
18121 var nodebackForPromise = require_nodeback();
18122 var withAppended2 = util.withAppended;
18123 var maybeWrapAsError2 = util.maybeWrapAsError;
18124 var canEvaluate2 = util.canEvaluate;
18125 var TypeError2 = require_errors().TypeError;
18126 var defaultSuffix = "Async";
18127 var defaultPromisified = { __isPromisified__: true };
18128 var noCopyProps = [
18136 "__isPromisified__"
18138 var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
18139 var defaultFilter = function(name) {
18140 return util.isIdentifier(name) && name.charAt(0) !== "_" && name !== "constructor";
18142 function propsFilter(key) {
18143 return !noCopyPropsPattern.test(key);
18145 function isPromisified(fn) {
18147 return fn.__isPromisified__ === true;
18152 function hasPromisified(obj2, key, suffix) {
18153 var val = util.getDataPropertyOrDefault(obj2, key + suffix, defaultPromisified);
18154 return val ? isPromisified(val) : false;
18156 function checkValid(ret2, suffix, suffixRegexp) {
18157 for (var i = 0; i < ret2.length; i += 2) {
18159 if (suffixRegexp.test(key)) {
18160 var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
18161 for (var j = 0; j < ret2.length; j += 2) {
18162 if (ret2[j] === keyWithoutAsyncSuffix) {
18163 throw new TypeError2("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s", suffix));
18169 function promisifiableMethods(obj2, suffix, suffixRegexp, filter) {
18170 var keys = util.inheritedDataKeys(obj2);
18172 for (var i = 0; i < keys.length; ++i) {
18174 var value = obj2[key];
18175 var passesDefaultFilter = filter === defaultFilter ? true : defaultFilter(key, value, obj2);
18176 if (typeof value === "function" && !isPromisified(value) && !hasPromisified(obj2, key, suffix) && filter(key, value, obj2, passesDefaultFilter)) {
18177 ret2.push(key, value);
18180 checkValid(ret2, suffix, suffixRegexp);
18183 var escapeIdentRegex = function(str) {
18184 return str.replace(/([$])/, "\\$");
18186 var makeNodePromisifiedEval;
18188 var switchCaseArgumentOrder = function(likelyArgumentCount) {
18189 var ret2 = [likelyArgumentCount];
18190 var min = Math.max(0, likelyArgumentCount - 1 - 3);
18191 for (var i = likelyArgumentCount - 1; i >= min; --i) {
18194 for (var i = likelyArgumentCount + 1; i <= 3; ++i) {
18199 var argumentSequence = function(argumentCount) {
18200 return util.filledRange(argumentCount, "_arg", "");
18202 var parameterDeclaration = function(parameterCount2) {
18203 return util.filledRange(Math.max(parameterCount2, 3), "_arg", "");
18205 var parameterCount = function(fn) {
18206 if (typeof fn.length === "number") {
18207 return Math.max(Math.min(fn.length, 1023 + 1), 0);
18211 makeNodePromisifiedEval = function(callback, receiver, originalName, fn, _, multiArgs) {
18212 var newParameterCount = Math.max(0, parameterCount(fn) - 1);
18213 var argumentOrder = switchCaseArgumentOrder(newParameterCount);
18214 var shouldProxyThis = typeof callback === "string" || receiver === THIS;
18215 function generateCallForArgumentCount(count) {
18216 var args = argumentSequence(count).join(", ");
18217 var comma = count > 0 ? ", " : "";
18219 if (shouldProxyThis) {
18220 ret2 = "ret = callback.call(this, {{args}}, nodeback); break;\n";
18222 ret2 = receiver === void 0 ? "ret = callback({{args}}, nodeback); break;\n" : "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
18224 return ret2.replace("{{args}}", args).replace(", ", comma);
18226 function generateArgumentSwitchCase() {
18228 for (var i = 0; i < argumentOrder.length; ++i) {
18229 ret2 += "case " + argumentOrder[i] + ":" + generateCallForArgumentCount(argumentOrder[i]);
18231 ret2 += " \n default: \n var args = new Array(len + 1); \n var i = 0; \n for (var i = 0; i < len; ++i) { \n args[i] = arguments[i]; \n } \n args[i] = nodeback; \n [CodeForCall] \n break; \n ".replace("[CodeForCall]", shouldProxyThis ? "ret = callback.apply(this, args);\n" : "ret = callback.apply(receiver, args);\n");
18234 var getFunctionCode = typeof callback === "string" ? "this != null ? this['" + callback + "'] : fn" : "fn";
18235 var body = "'use strict'; \n var ret = function (Parameters) { \n 'use strict'; \n var len = arguments.length; \n var promise = new Promise(INTERNAL); \n promise._captureStackTrace(); \n var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n var ret; \n var callback = tryCatch([GetFunctionCode]); \n switch(len) { \n [CodeForSwitchCase] \n } \n if (ret === errorObj) { \n promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n } \n if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n return promise; \n }; \n notEnumerableProp(ret, '__isPromisified__', true); \n return ret; \n ".replace("[CodeForSwitchCase]", generateArgumentSwitchCase()).replace("[GetFunctionCode]", getFunctionCode);
18236 body = body.replace("Parameters", parameterDeclaration(newParameterCount));
18237 return new Function("Promise", "fn", "receiver", "withAppended", "maybeWrapAsError", "nodebackForPromise", "tryCatch", "errorObj", "notEnumerableProp", "INTERNAL", body)(Promise2, fn, receiver, withAppended2, maybeWrapAsError2, nodebackForPromise, util.tryCatch, util.errorObj, util.notEnumerableProp, INTERNAL2);
18240 function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
18241 var defaultThis = function() {
18244 var method = callback;
18245 if (typeof method === "string") {
18248 function promisified() {
18249 var _receiver = receiver;
18250 if (receiver === THIS)
18252 var promise = new Promise2(INTERNAL2);
18253 promise._captureStackTrace();
18254 var cb = typeof method === "string" && this !== defaultThis ? this[method] : callback;
18255 var fn2 = nodebackForPromise(promise, multiArgs);
18257 cb.apply(_receiver, withAppended2(arguments, fn2));
18259 promise._rejectCallback(maybeWrapAsError2(e), true, true);
18261 if (!promise._isFateSealed())
18262 promise._setAsyncGuaranteed();
18265 util.notEnumerableProp(promisified, "__isPromisified__", true);
18266 return promisified;
18268 var makeNodePromisified = canEvaluate2 ? makeNodePromisifiedEval : makeNodePromisifiedClosure;
18269 function promisifyAll(obj2, suffix, filter, promisifier, multiArgs) {
18270 var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
18271 var methods = promisifiableMethods(obj2, suffix, suffixRegexp, filter);
18272 for (var i = 0, len = methods.length; i < len; i += 2) {
18273 var key = methods[i];
18274 var fn = methods[i + 1];
18275 var promisifiedKey = key + suffix;
18276 if (promisifier === makeNodePromisified) {
18277 obj2[promisifiedKey] = makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
18279 var promisified = promisifier(fn, function() {
18280 return makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
18282 util.notEnumerableProp(promisified, "__isPromisified__", true);
18283 obj2[promisifiedKey] = promisified;
18286 util.toFastProperties(obj2);
18289 function promisify(callback, receiver, multiArgs) {
18290 return makeNodePromisified(callback, receiver, void 0, callback, null, multiArgs);
18292 Promise2.promisify = function(fn, options) {
18293 if (typeof fn !== "function") {
18294 throw new TypeError2("expecting a function but got " + util.classString(fn));
18296 if (isPromisified(fn)) {
18299 options = Object(options);
18300 var receiver = options.context === void 0 ? THIS : options.context;
18301 var multiArgs = !!options.multiArgs;
18302 var ret2 = promisify(fn, receiver, multiArgs);
18303 util.copyDescriptors(fn, ret2, propsFilter);
18306 Promise2.promisifyAll = function(target, options) {
18307 if (typeof target !== "function" && typeof target !== "object") {
18308 throw new TypeError2("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");
18310 options = Object(options);
18311 var multiArgs = !!options.multiArgs;
18312 var suffix = options.suffix;
18313 if (typeof suffix !== "string")
18314 suffix = defaultSuffix;
18315 var filter = options.filter;
18316 if (typeof filter !== "function")
18317 filter = defaultFilter;
18318 var promisifier = options.promisifier;
18319 if (typeof promisifier !== "function")
18320 promisifier = makeNodePromisified;
18321 if (!util.isIdentifier(suffix)) {
18322 throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");
18324 var keys = util.inheritedDataKeys(target);
18325 for (var i = 0; i < keys.length; ++i) {
18326 var value = target[keys[i]];
18327 if (keys[i] !== "constructor" && util.isClass(value)) {
18328 promisifyAll(value.prototype, suffix, filter, promisifier, multiArgs);
18329 promisifyAll(value, suffix, filter, promisifier, multiArgs);
18332 return promisifyAll(target, suffix, filter, promisifier, multiArgs);
18338 // node_modules/bluebird/js/release/props.js
18339 var require_props = __commonJS({
18340 "node_modules/bluebird/js/release/props.js"(exports2, module2) {
18342 module2.exports = function(Promise2, PromiseArray, tryConvertToPromise, apiRejection) {
18343 var util = require_util();
18344 var isObject2 = util.isObject;
18345 var es52 = require_es5();
18347 if (typeof Map === "function")
18349 var mapToEntries = function() {
18352 function extractEntry(value, key) {
18353 this[index] = value;
18354 this[index + size] = key;
18357 return function mapToEntries2(map) {
18360 var ret2 = new Array(map.size * 2);
18361 map.forEach(extractEntry, ret2);
18365 var entriesToMap = function(entries) {
18366 var ret2 = new Es6Map();
18367 var length = entries.length / 2 | 0;
18368 for (var i = 0; i < length; ++i) {
18369 var key = entries[length + i];
18370 var value = entries[i];
18371 ret2.set(key, value);
18375 function PropertiesPromiseArray(obj2) {
18378 if (Es6Map !== void 0 && obj2 instanceof Es6Map) {
18379 entries = mapToEntries(obj2);
18382 var keys = es52.keys(obj2);
18383 var len = keys.length;
18384 entries = new Array(len * 2);
18385 for (var i = 0; i < len; ++i) {
18387 entries[i] = obj2[key];
18388 entries[i + len] = key;
18391 this.constructor$(entries);
18392 this._isMap = isMap;
18393 this._init$(void 0, -3);
18395 util.inherits(PropertiesPromiseArray, PromiseArray);
18396 PropertiesPromiseArray.prototype._init = function() {
18398 PropertiesPromiseArray.prototype._promiseFulfilled = function(value, index) {
18399 this._values[index] = value;
18400 var totalResolved = ++this._totalResolved;
18401 if (totalResolved >= this._length) {
18404 val = entriesToMap(this._values);
18407 var keyOffset = this.length();
18408 for (var i = 0, len = this.length(); i < len; ++i) {
18409 val[this._values[i + keyOffset]] = this._values[i];
18412 this._resolve(val);
18417 PropertiesPromiseArray.prototype.shouldCopyValues = function() {
18420 PropertiesPromiseArray.prototype.getActualLength = function(len) {
18423 function props(promises) {
18425 var castValue = tryConvertToPromise(promises);
18426 if (!isObject2(castValue)) {
18427 return apiRejection("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n");
18428 } else if (castValue instanceof Promise2) {
18429 ret2 = castValue._then(Promise2.props, void 0, void 0, void 0, void 0);
18431 ret2 = new PropertiesPromiseArray(castValue).promise();
18433 if (castValue instanceof Promise2) {
18434 ret2._propagateFrom(castValue, 2);
18438 Promise2.prototype.props = function() {
18439 return props(this);
18441 Promise2.props = function(promises) {
18442 return props(promises);
18448 // node_modules/bluebird/js/release/race.js
18449 var require_race = __commonJS({
18450 "node_modules/bluebird/js/release/race.js"(exports2, module2) {
18452 module2.exports = function(Promise2, INTERNAL2, tryConvertToPromise, apiRejection) {
18453 var util = require_util();
18454 var raceLater = function(promise) {
18455 return promise.then(function(array) {
18456 return race(array, promise);
18459 function race(promises, parent) {
18460 var maybePromise = tryConvertToPromise(promises);
18461 if (maybePromise instanceof Promise2) {
18462 return raceLater(maybePromise);
18464 promises = util.asArray(promises);
18465 if (promises === null)
18466 return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
18468 var ret2 = new Promise2(INTERNAL2);
18469 if (parent !== void 0) {
18470 ret2._propagateFrom(parent, 3);
18472 var fulfill = ret2._fulfill;
18473 var reject = ret2._reject;
18474 for (var i = 0, len = promises.length; i < len; ++i) {
18475 var val = promises[i];
18476 if (val === void 0 && !(i in promises)) {
18479 Promise2.cast(val)._then(fulfill, reject, void 0, ret2, null);
18483 Promise2.race = function(promises) {
18484 return race(promises, void 0);
18486 Promise2.prototype.race = function() {
18487 return race(this, void 0);
18493 // node_modules/bluebird/js/release/reduce.js
18494 var require_reduce = __commonJS({
18495 "node_modules/bluebird/js/release/reduce.js"(exports2, module2) {
18497 module2.exports = function(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug) {
18498 var getDomain = Promise2._getDomain;
18499 var util = require_util();
18500 var tryCatch2 = util.tryCatch;
18501 function ReductionPromiseArray(promises, fn, initialValue, _each) {
18502 this.constructor$(promises);
18503 var domain = getDomain();
18504 this._fn = domain === null ? fn : util.domainBind(domain, fn);
18505 if (initialValue !== void 0) {
18506 initialValue = Promise2.resolve(initialValue);
18507 initialValue._attachCancellationCallback(this);
18509 this._initialValue = initialValue;
18510 this._currentCancellable = null;
18511 if (_each === INTERNAL2) {
18512 this._eachValues = Array(this._length);
18513 } else if (_each === 0) {
18514 this._eachValues = null;
18516 this._eachValues = void 0;
18518 this._promise._captureStackTrace();
18519 this._init$(void 0, -5);
18521 util.inherits(ReductionPromiseArray, PromiseArray);
18522 ReductionPromiseArray.prototype._gotAccum = function(accum) {
18523 if (this._eachValues !== void 0 && this._eachValues !== null && accum !== INTERNAL2) {
18524 this._eachValues.push(accum);
18527 ReductionPromiseArray.prototype._eachComplete = function(value) {
18528 if (this._eachValues !== null) {
18529 this._eachValues.push(value);
18531 return this._eachValues;
18533 ReductionPromiseArray.prototype._init = function() {
18535 ReductionPromiseArray.prototype._resolveEmptyArray = function() {
18536 this._resolve(this._eachValues !== void 0 ? this._eachValues : this._initialValue);
18538 ReductionPromiseArray.prototype.shouldCopyValues = function() {
18541 ReductionPromiseArray.prototype._resolve = function(value) {
18542 this._promise._resolveCallback(value);
18543 this._values = null;
18545 ReductionPromiseArray.prototype._resultCancelled = function(sender) {
18546 if (sender === this._initialValue)
18547 return this._cancel();
18548 if (this._isResolved())
18550 this._resultCancelled$();
18551 if (this._currentCancellable instanceof Promise2) {
18552 this._currentCancellable.cancel();
18554 if (this._initialValue instanceof Promise2) {
18555 this._initialValue.cancel();
18558 ReductionPromiseArray.prototype._iterate = function(values) {
18559 this._values = values;
18562 var length = values.length;
18563 if (this._initialValue !== void 0) {
18564 value = this._initialValue;
18567 value = Promise2.resolve(values[0]);
18570 this._currentCancellable = value;
18571 if (!value.isRejected()) {
18572 for (; i < length; ++i) {
18580 value = value._then(gotAccum, void 0, void 0, ctx, void 0);
18583 if (this._eachValues !== void 0) {
18584 value = value._then(this._eachComplete, void 0, void 0, this, void 0);
18586 value._then(completed, completed, void 0, value, this);
18588 Promise2.prototype.reduce = function(fn, initialValue) {
18589 return reduce(this, fn, initialValue, null);
18591 Promise2.reduce = function(promises, fn, initialValue, _each) {
18592 return reduce(promises, fn, initialValue, _each);
18594 function completed(valueOrReason, array) {
18595 if (this.isFulfilled()) {
18596 array._resolve(valueOrReason);
18598 array._reject(valueOrReason);
18601 function reduce(promises, fn, initialValue, _each) {
18602 if (typeof fn !== "function") {
18603 return apiRejection("expecting a function but got " + util.classString(fn));
18605 var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
18606 return array.promise();
18608 function gotAccum(accum) {
18609 this.accum = accum;
18610 this.array._gotAccum(accum);
18611 var value = tryConvertToPromise(this.value, this.array._promise);
18612 if (value instanceof Promise2) {
18613 this.array._currentCancellable = value;
18614 return value._then(gotValue, void 0, void 0, this, void 0);
18616 return gotValue.call(this, value);
18619 function gotValue(value) {
18620 var array = this.array;
18621 var promise = array._promise;
18622 var fn = tryCatch2(array._fn);
18623 promise._pushContext();
18625 if (array._eachValues !== void 0) {
18626 ret2 = fn.call(promise._boundValue(), value, this.index, this.length);
18628 ret2 = fn.call(promise._boundValue(), this.accum, value, this.index, this.length);
18630 if (ret2 instanceof Promise2) {
18631 array._currentCancellable = ret2;
18633 var promiseCreated = promise._popContext();
18634 debug.checkForgottenReturns(ret2, promiseCreated, array._eachValues !== void 0 ? "Promise.each" : "Promise.reduce", promise);
18641 // node_modules/bluebird/js/release/settle.js
18642 var require_settle = __commonJS({
18643 "node_modules/bluebird/js/release/settle.js"(exports2, module2) {
18645 module2.exports = function(Promise2, PromiseArray, debug) {
18646 var PromiseInspection = Promise2.PromiseInspection;
18647 var util = require_util();
18648 function SettledPromiseArray(values) {
18649 this.constructor$(values);
18651 util.inherits(SettledPromiseArray, PromiseArray);
18652 SettledPromiseArray.prototype._promiseResolved = function(index, inspection) {
18653 this._values[index] = inspection;
18654 var totalResolved = ++this._totalResolved;
18655 if (totalResolved >= this._length) {
18656 this._resolve(this._values);
18661 SettledPromiseArray.prototype._promiseFulfilled = function(value, index) {
18662 var ret2 = new PromiseInspection();
18663 ret2._bitField = 33554432;
18664 ret2._settledValueField = value;
18665 return this._promiseResolved(index, ret2);
18667 SettledPromiseArray.prototype._promiseRejected = function(reason, index) {
18668 var ret2 = new PromiseInspection();
18669 ret2._bitField = 16777216;
18670 ret2._settledValueField = reason;
18671 return this._promiseResolved(index, ret2);
18673 Promise2.settle = function(promises) {
18674 debug.deprecated(".settle()", ".reflect()");
18675 return new SettledPromiseArray(promises).promise();
18677 Promise2.prototype.settle = function() {
18678 return Promise2.settle(this);
18684 // node_modules/bluebird/js/release/some.js
18685 var require_some = __commonJS({
18686 "node_modules/bluebird/js/release/some.js"(exports2, module2) {
18688 module2.exports = function(Promise2, PromiseArray, apiRejection) {
18689 var util = require_util();
18690 var RangeError2 = require_errors().RangeError;
18691 var AggregateError = require_errors().AggregateError;
18692 var isArray = util.isArray;
18693 var CANCELLATION = {};
18694 function SomePromiseArray(values) {
18695 this.constructor$(values);
18697 this._unwrap = false;
18698 this._initialized = false;
18700 util.inherits(SomePromiseArray, PromiseArray);
18701 SomePromiseArray.prototype._init = function() {
18702 if (!this._initialized) {
18705 if (this._howMany === 0) {
18709 this._init$(void 0, -5);
18710 var isArrayResolved = isArray(this._values);
18711 if (!this._isResolved() && isArrayResolved && this._howMany > this._canPossiblyFulfill()) {
18712 this._reject(this._getRangeError(this.length()));
18715 SomePromiseArray.prototype.init = function() {
18716 this._initialized = true;
18719 SomePromiseArray.prototype.setUnwrap = function() {
18720 this._unwrap = true;
18722 SomePromiseArray.prototype.howMany = function() {
18723 return this._howMany;
18725 SomePromiseArray.prototype.setHowMany = function(count) {
18726 this._howMany = count;
18728 SomePromiseArray.prototype._promiseFulfilled = function(value) {
18729 this._addFulfilled(value);
18730 if (this._fulfilled() === this.howMany()) {
18731 this._values.length = this.howMany();
18732 if (this.howMany() === 1 && this._unwrap) {
18733 this._resolve(this._values[0]);
18735 this._resolve(this._values);
18741 SomePromiseArray.prototype._promiseRejected = function(reason) {
18742 this._addRejected(reason);
18743 return this._checkOutcome();
18745 SomePromiseArray.prototype._promiseCancelled = function() {
18746 if (this._values instanceof Promise2 || this._values == null) {
18747 return this._cancel();
18749 this._addRejected(CANCELLATION);
18750 return this._checkOutcome();
18752 SomePromiseArray.prototype._checkOutcome = function() {
18753 if (this.howMany() > this._canPossiblyFulfill()) {
18754 var e = new AggregateError();
18755 for (var i = this.length(); i < this._values.length; ++i) {
18756 if (this._values[i] !== CANCELLATION) {
18757 e.push(this._values[i]);
18760 if (e.length > 0) {
18769 SomePromiseArray.prototype._fulfilled = function() {
18770 return this._totalResolved;
18772 SomePromiseArray.prototype._rejected = function() {
18773 return this._values.length - this.length();
18775 SomePromiseArray.prototype._addRejected = function(reason) {
18776 this._values.push(reason);
18778 SomePromiseArray.prototype._addFulfilled = function(value) {
18779 this._values[this._totalResolved++] = value;
18781 SomePromiseArray.prototype._canPossiblyFulfill = function() {
18782 return this.length() - this._rejected();
18784 SomePromiseArray.prototype._getRangeError = function(count) {
18785 var message = "Input array must contain at least " + this._howMany + " items but contains only " + count + " items";
18786 return new RangeError2(message);
18788 SomePromiseArray.prototype._resolveEmptyArray = function() {
18789 this._reject(this._getRangeError(0));
18791 function some(promises, howMany) {
18792 if ((howMany | 0) !== howMany || howMany < 0) {
18793 return apiRejection("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");
18795 var ret2 = new SomePromiseArray(promises);
18796 var promise = ret2.promise();
18797 ret2.setHowMany(howMany);
18801 Promise2.some = function(promises, howMany) {
18802 return some(promises, howMany);
18804 Promise2.prototype.some = function(howMany) {
18805 return some(this, howMany);
18807 Promise2._SomePromiseArray = SomePromiseArray;
18812 // node_modules/bluebird/js/release/filter.js
18813 var require_filter = __commonJS({
18814 "node_modules/bluebird/js/release/filter.js"(exports2, module2) {
18816 module2.exports = function(Promise2, INTERNAL2) {
18817 var PromiseMap = Promise2.map;
18818 Promise2.prototype.filter = function(fn, options) {
18819 return PromiseMap(this, fn, options, INTERNAL2);
18821 Promise2.filter = function(promises, fn, options) {
18822 return PromiseMap(promises, fn, options, INTERNAL2);
18828 // node_modules/bluebird/js/release/each.js
18829 var require_each = __commonJS({
18830 "node_modules/bluebird/js/release/each.js"(exports2, module2) {
18832 module2.exports = function(Promise2, INTERNAL2) {
18833 var PromiseReduce = Promise2.reduce;
18834 var PromiseAll = Promise2.all;
18835 function promiseAllThis() {
18836 return PromiseAll(this);
18838 function PromiseMapSeries(promises, fn) {
18839 return PromiseReduce(promises, fn, INTERNAL2, INTERNAL2);
18841 Promise2.prototype.each = function(fn) {
18842 return PromiseReduce(this, fn, INTERNAL2, 0)._then(promiseAllThis, void 0, void 0, this, void 0);
18844 Promise2.prototype.mapSeries = function(fn) {
18845 return PromiseReduce(this, fn, INTERNAL2, INTERNAL2);
18847 Promise2.each = function(promises, fn) {
18848 return PromiseReduce(promises, fn, INTERNAL2, 0)._then(promiseAllThis, void 0, void 0, promises, void 0);
18850 Promise2.mapSeries = PromiseMapSeries;
18855 // node_modules/bluebird/js/release/any.js
18856 var require_any = __commonJS({
18857 "node_modules/bluebird/js/release/any.js"(exports2, module2) {
18859 module2.exports = function(Promise2) {
18860 var SomePromiseArray = Promise2._SomePromiseArray;
18861 function any(promises) {
18862 var ret2 = new SomePromiseArray(promises);
18863 var promise = ret2.promise();
18864 ret2.setHowMany(1);
18869 Promise2.any = function(promises) {
18870 return any(promises);
18872 Promise2.prototype.any = function() {
18879 // node_modules/bluebird/js/release/promise.js
18880 var require_promise = __commonJS({
18881 "node_modules/bluebird/js/release/promise.js"(exports2, module2) {
18883 module2.exports = function() {
18884 var makeSelfResolutionError = function() {
18885 return new TypeError2("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n");
18887 var reflectHandler = function() {
18888 return new Promise2.PromiseInspection(this._target());
18890 var apiRejection = function(msg) {
18891 return Promise2.reject(new TypeError2(msg));
18893 function Proxyable() {
18895 var UNDEFINED_BINDING = {};
18896 var util = require_util();
18899 getDomain = function() {
18900 var ret2 = process.domain;
18901 if (ret2 === void 0)
18906 getDomain = function() {
18910 util.notEnumerableProp(Promise2, "_getDomain", getDomain);
18911 var es52 = require_es5();
18912 var Async = require_async();
18913 var async = new Async();
18914 es52.defineProperty(Promise2, "_async", { value: async });
18915 var errors = require_errors();
18916 var TypeError2 = Promise2.TypeError = errors.TypeError;
18917 Promise2.RangeError = errors.RangeError;
18918 var CancellationError = Promise2.CancellationError = errors.CancellationError;
18919 Promise2.TimeoutError = errors.TimeoutError;
18920 Promise2.OperationalError = errors.OperationalError;
18921 Promise2.RejectionError = errors.OperationalError;
18922 Promise2.AggregateError = errors.AggregateError;
18923 var INTERNAL2 = function() {
18926 var NEXT_FILTER = {};
18927 var tryConvertToPromise = require_thenables()(Promise2, INTERNAL2);
18928 var PromiseArray = require_promise_array()(Promise2, INTERNAL2, tryConvertToPromise, apiRejection, Proxyable);
18929 var Context = require_context()(Promise2);
18930 var createContext = Context.create;
18931 var debug = require_debuggability()(Promise2, Context);
18932 var CapturedTrace = debug.CapturedTrace;
18933 var PassThroughHandlerContext = require_finally()(Promise2, tryConvertToPromise);
18934 var catchFilter = require_catch_filter()(NEXT_FILTER);
18935 var nodebackForPromise = require_nodeback();
18936 var errorObj2 = util.errorObj;
18937 var tryCatch2 = util.tryCatch;
18938 function check(self2, executor) {
18939 if (typeof executor !== "function") {
18940 throw new TypeError2("expecting a function but got " + util.classString(executor));
18942 if (self2.constructor !== Promise2) {
18943 throw new TypeError2("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");
18946 function Promise2(executor) {
18947 this._bitField = 0;
18948 this._fulfillmentHandler0 = void 0;
18949 this._rejectionHandler0 = void 0;
18950 this._promise0 = void 0;
18951 this._receiver0 = void 0;
18952 if (executor !== INTERNAL2) {
18953 check(this, executor);
18954 this._resolveFromExecutor(executor);
18956 this._promiseCreated();
18957 this._fireEvent("promiseCreated", this);
18959 Promise2.prototype.toString = function() {
18960 return "[object Promise]";
18962 Promise2.prototype.caught = Promise2.prototype["catch"] = function(fn) {
18963 var len = arguments.length;
18965 var catchInstances = new Array(len - 1), j = 0, i;
18966 for (i = 0; i < len - 1; ++i) {
18967 var item = arguments[i];
18968 if (util.isObject(item)) {
18969 catchInstances[j++] = item;
18971 return apiRejection("expecting an object but got A catch statement predicate " + util.classString(item));
18974 catchInstances.length = j;
18976 return this.then(void 0, catchFilter(catchInstances, fn, this));
18978 return this.then(void 0, fn);
18980 Promise2.prototype.reflect = function() {
18981 return this._then(reflectHandler, reflectHandler, void 0, this, void 0);
18983 Promise2.prototype.then = function(didFulfill, didReject) {
18984 if (debug.warnings() && arguments.length > 0 && typeof didFulfill !== "function" && typeof didReject !== "function") {
18985 var msg = ".then() only accepts functions but was passed: " + util.classString(didFulfill);
18986 if (arguments.length > 1) {
18987 msg += ", " + util.classString(didReject);
18991 return this._then(didFulfill, didReject, void 0, void 0, void 0);
18993 Promise2.prototype.done = function(didFulfill, didReject) {
18994 var promise = this._then(didFulfill, didReject, void 0, void 0, void 0);
18995 promise._setIsFinal();
18997 Promise2.prototype.spread = function(fn) {
18998 if (typeof fn !== "function") {
18999 return apiRejection("expecting a function but got " + util.classString(fn));
19001 return this.all()._then(fn, void 0, void 0, APPLY, void 0);
19003 Promise2.prototype.toJSON = function() {
19005 isFulfilled: false,
19007 fulfillmentValue: void 0,
19008 rejectionReason: void 0
19010 if (this.isFulfilled()) {
19011 ret2.fulfillmentValue = this.value();
19012 ret2.isFulfilled = true;
19013 } else if (this.isRejected()) {
19014 ret2.rejectionReason = this.reason();
19015 ret2.isRejected = true;
19019 Promise2.prototype.all = function() {
19020 if (arguments.length > 0) {
19021 this._warn(".all() was passed arguments but it does not take any");
19023 return new PromiseArray(this).promise();
19025 Promise2.prototype.error = function(fn) {
19026 return this.caught(util.originatesFromRejection, fn);
19028 Promise2.getNewLibraryCopy = module2.exports;
19029 Promise2.is = function(val) {
19030 return val instanceof Promise2;
19032 Promise2.fromNode = Promise2.fromCallback = function(fn) {
19033 var ret2 = new Promise2(INTERNAL2);
19034 ret2._captureStackTrace();
19035 var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs : false;
19036 var result = tryCatch2(fn)(nodebackForPromise(ret2, multiArgs));
19037 if (result === errorObj2) {
19038 ret2._rejectCallback(result.e, true);
19040 if (!ret2._isFateSealed())
19041 ret2._setAsyncGuaranteed();
19044 Promise2.all = function(promises) {
19045 return new PromiseArray(promises).promise();
19047 Promise2.cast = function(obj2) {
19048 var ret2 = tryConvertToPromise(obj2);
19049 if (!(ret2 instanceof Promise2)) {
19050 ret2 = new Promise2(INTERNAL2);
19051 ret2._captureStackTrace();
19052 ret2._setFulfilled();
19053 ret2._rejectionHandler0 = obj2;
19057 Promise2.resolve = Promise2.fulfilled = Promise2.cast;
19058 Promise2.reject = Promise2.rejected = function(reason) {
19059 var ret2 = new Promise2(INTERNAL2);
19060 ret2._captureStackTrace();
19061 ret2._rejectCallback(reason, true);
19064 Promise2.setScheduler = function(fn) {
19065 if (typeof fn !== "function") {
19066 throw new TypeError2("expecting a function but got " + util.classString(fn));
19068 return async.setScheduler(fn);
19070 Promise2.prototype._then = function(didFulfill, didReject, _, receiver, internalData) {
19071 var haveInternalData = internalData !== void 0;
19072 var promise = haveInternalData ? internalData : new Promise2(INTERNAL2);
19073 var target = this._target();
19074 var bitField = target._bitField;
19075 if (!haveInternalData) {
19076 promise._propagateFrom(this, 3);
19077 promise._captureStackTrace();
19078 if (receiver === void 0 && (this._bitField & 2097152) !== 0) {
19079 if (!((bitField & 50397184) === 0)) {
19080 receiver = this._boundValue();
19082 receiver = target === this ? void 0 : this._boundTo;
19085 this._fireEvent("promiseChained", this, promise);
19087 var domain = getDomain();
19088 if (!((bitField & 50397184) === 0)) {
19089 var handler, value, settler = target._settlePromiseCtx;
19090 if ((bitField & 33554432) !== 0) {
19091 value = target._rejectionHandler0;
19092 handler = didFulfill;
19093 } else if ((bitField & 16777216) !== 0) {
19094 value = target._fulfillmentHandler0;
19095 handler = didReject;
19096 target._unsetRejectionIsUnhandled();
19098 settler = target._settlePromiseLateCancellationObserver;
19099 value = new CancellationError("late cancellation observer");
19100 target._attachExtraTrace(value);
19101 handler = didReject;
19103 async.invoke(settler, target, {
19104 handler: domain === null ? handler : typeof handler === "function" && util.domainBind(domain, handler),
19110 target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
19114 Promise2.prototype._length = function() {
19115 return this._bitField & 65535;
19117 Promise2.prototype._isFateSealed = function() {
19118 return (this._bitField & 117506048) !== 0;
19120 Promise2.prototype._isFollowing = function() {
19121 return (this._bitField & 67108864) === 67108864;
19123 Promise2.prototype._setLength = function(len) {
19124 this._bitField = this._bitField & -65536 | len & 65535;
19126 Promise2.prototype._setFulfilled = function() {
19127 this._bitField = this._bitField | 33554432;
19128 this._fireEvent("promiseFulfilled", this);
19130 Promise2.prototype._setRejected = function() {
19131 this._bitField = this._bitField | 16777216;
19132 this._fireEvent("promiseRejected", this);
19134 Promise2.prototype._setFollowing = function() {
19135 this._bitField = this._bitField | 67108864;
19136 this._fireEvent("promiseResolved", this);
19138 Promise2.prototype._setIsFinal = function() {
19139 this._bitField = this._bitField | 4194304;
19141 Promise2.prototype._isFinal = function() {
19142 return (this._bitField & 4194304) > 0;
19144 Promise2.prototype._unsetCancelled = function() {
19145 this._bitField = this._bitField & ~65536;
19147 Promise2.prototype._setCancelled = function() {
19148 this._bitField = this._bitField | 65536;
19149 this._fireEvent("promiseCancelled", this);
19151 Promise2.prototype._setWillBeCancelled = function() {
19152 this._bitField = this._bitField | 8388608;
19154 Promise2.prototype._setAsyncGuaranteed = function() {
19155 if (async.hasCustomScheduler())
19157 this._bitField = this._bitField | 134217728;
19159 Promise2.prototype._receiverAt = function(index) {
19160 var ret2 = index === 0 ? this._receiver0 : this[index * 4 - 4 + 3];
19161 if (ret2 === UNDEFINED_BINDING) {
19163 } else if (ret2 === void 0 && this._isBound()) {
19164 return this._boundValue();
19168 Promise2.prototype._promiseAt = function(index) {
19169 return this[index * 4 - 4 + 2];
19171 Promise2.prototype._fulfillmentHandlerAt = function(index) {
19172 return this[index * 4 - 4 + 0];
19174 Promise2.prototype._rejectionHandlerAt = function(index) {
19175 return this[index * 4 - 4 + 1];
19177 Promise2.prototype._boundValue = function() {
19179 Promise2.prototype._migrateCallback0 = function(follower) {
19180 var bitField = follower._bitField;
19181 var fulfill = follower._fulfillmentHandler0;
19182 var reject = follower._rejectionHandler0;
19183 var promise = follower._promise0;
19184 var receiver = follower._receiverAt(0);
19185 if (receiver === void 0)
19186 receiver = UNDEFINED_BINDING;
19187 this._addCallbacks(fulfill, reject, promise, receiver, null);
19189 Promise2.prototype._migrateCallbackAt = function(follower, index) {
19190 var fulfill = follower._fulfillmentHandlerAt(index);
19191 var reject = follower._rejectionHandlerAt(index);
19192 var promise = follower._promiseAt(index);
19193 var receiver = follower._receiverAt(index);
19194 if (receiver === void 0)
19195 receiver = UNDEFINED_BINDING;
19196 this._addCallbacks(fulfill, reject, promise, receiver, null);
19198 Promise2.prototype._addCallbacks = function(fulfill, reject, promise, receiver, domain) {
19199 var index = this._length();
19200 if (index >= 65535 - 4) {
19202 this._setLength(0);
19205 this._promise0 = promise;
19206 this._receiver0 = receiver;
19207 if (typeof fulfill === "function") {
19208 this._fulfillmentHandler0 = domain === null ? fulfill : util.domainBind(domain, fulfill);
19210 if (typeof reject === "function") {
19211 this._rejectionHandler0 = domain === null ? reject : util.domainBind(domain, reject);
19214 var base = index * 4 - 4;
19215 this[base + 2] = promise;
19216 this[base + 3] = receiver;
19217 if (typeof fulfill === "function") {
19218 this[base + 0] = domain === null ? fulfill : util.domainBind(domain, fulfill);
19220 if (typeof reject === "function") {
19221 this[base + 1] = domain === null ? reject : util.domainBind(domain, reject);
19224 this._setLength(index + 1);
19227 Promise2.prototype._proxy = function(proxyable, arg) {
19228 this._addCallbacks(void 0, void 0, arg, proxyable, null);
19230 Promise2.prototype._resolveCallback = function(value, shouldBind) {
19231 if ((this._bitField & 117506048) !== 0)
19233 if (value === this)
19234 return this._rejectCallback(makeSelfResolutionError(), false);
19235 var maybePromise = tryConvertToPromise(value, this);
19236 if (!(maybePromise instanceof Promise2))
19237 return this._fulfill(value);
19239 this._propagateFrom(maybePromise, 2);
19240 var promise = maybePromise._target();
19241 if (promise === this) {
19242 this._reject(makeSelfResolutionError());
19245 var bitField = promise._bitField;
19246 if ((bitField & 50397184) === 0) {
19247 var len = this._length();
19249 promise._migrateCallback0(this);
19250 for (var i = 1; i < len; ++i) {
19251 promise._migrateCallbackAt(this, i);
19253 this._setFollowing();
19254 this._setLength(0);
19255 this._setFollowee(promise);
19256 } else if ((bitField & 33554432) !== 0) {
19257 this._fulfill(promise._value());
19258 } else if ((bitField & 16777216) !== 0) {
19259 this._reject(promise._reason());
19261 var reason = new CancellationError("late cancellation observer");
19262 promise._attachExtraTrace(reason);
19263 this._reject(reason);
19266 Promise2.prototype._rejectCallback = function(reason, synchronous, ignoreNonErrorWarnings) {
19267 var trace = util.ensureErrorObject(reason);
19268 var hasStack = trace === reason;
19269 if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
19270 var message = "a promise was rejected with a non-error: " + util.classString(reason);
19271 this._warn(message, true);
19273 this._attachExtraTrace(trace, synchronous ? hasStack : false);
19274 this._reject(reason);
19276 Promise2.prototype._resolveFromExecutor = function(executor) {
19277 var promise = this;
19278 this._captureStackTrace();
19279 this._pushContext();
19280 var synchronous = true;
19281 var r = this._execute(executor, function(value) {
19282 promise._resolveCallback(value);
19283 }, function(reason) {
19284 promise._rejectCallback(reason, synchronous);
19286 synchronous = false;
19287 this._popContext();
19288 if (r !== void 0) {
19289 promise._rejectCallback(r, true);
19292 Promise2.prototype._settlePromiseFromHandler = function(handler, receiver, value, promise) {
19293 var bitField = promise._bitField;
19294 if ((bitField & 65536) !== 0)
19296 promise._pushContext();
19298 if (receiver === APPLY) {
19299 if (!value || typeof value.length !== "number") {
19301 x.e = new TypeError2("cannot .spread() a non-array: " + util.classString(value));
19303 x = tryCatch2(handler).apply(this._boundValue(), value);
19306 x = tryCatch2(handler).call(receiver, value);
19308 var promiseCreated = promise._popContext();
19309 bitField = promise._bitField;
19310 if ((bitField & 65536) !== 0)
19312 if (x === NEXT_FILTER) {
19313 promise._reject(value);
19314 } else if (x === errorObj2) {
19315 promise._rejectCallback(x.e, false);
19317 debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
19318 promise._resolveCallback(x);
19321 Promise2.prototype._target = function() {
19323 while (ret2._isFollowing())
19324 ret2 = ret2._followee();
19327 Promise2.prototype._followee = function() {
19328 return this._rejectionHandler0;
19330 Promise2.prototype._setFollowee = function(promise) {
19331 this._rejectionHandler0 = promise;
19333 Promise2.prototype._settlePromise = function(promise, handler, receiver, value) {
19334 var isPromise = promise instanceof Promise2;
19335 var bitField = this._bitField;
19336 var asyncGuaranteed = (bitField & 134217728) !== 0;
19337 if ((bitField & 65536) !== 0) {
19339 promise._invokeInternalOnCancel();
19340 if (receiver instanceof PassThroughHandlerContext && receiver.isFinallyHandler()) {
19341 receiver.cancelPromise = promise;
19342 if (tryCatch2(handler).call(receiver, value) === errorObj2) {
19343 promise._reject(errorObj2.e);
19345 } else if (handler === reflectHandler) {
19346 promise._fulfill(reflectHandler.call(receiver));
19347 } else if (receiver instanceof Proxyable) {
19348 receiver._promiseCancelled(promise);
19349 } else if (isPromise || promise instanceof PromiseArray) {
19354 } else if (typeof handler === "function") {
19356 handler.call(receiver, value, promise);
19358 if (asyncGuaranteed)
19359 promise._setAsyncGuaranteed();
19360 this._settlePromiseFromHandler(handler, receiver, value, promise);
19362 } else if (receiver instanceof Proxyable) {
19363 if (!receiver._isResolved()) {
19364 if ((bitField & 33554432) !== 0) {
19365 receiver._promiseFulfilled(value, promise);
19367 receiver._promiseRejected(value, promise);
19370 } else if (isPromise) {
19371 if (asyncGuaranteed)
19372 promise._setAsyncGuaranteed();
19373 if ((bitField & 33554432) !== 0) {
19374 promise._fulfill(value);
19376 promise._reject(value);
19380 Promise2.prototype._settlePromiseLateCancellationObserver = function(ctx) {
19381 var handler = ctx.handler;
19382 var promise = ctx.promise;
19383 var receiver = ctx.receiver;
19384 var value = ctx.value;
19385 if (typeof handler === "function") {
19386 if (!(promise instanceof Promise2)) {
19387 handler.call(receiver, value, promise);
19389 this._settlePromiseFromHandler(handler, receiver, value, promise);
19391 } else if (promise instanceof Promise2) {
19392 promise._reject(value);
19395 Promise2.prototype._settlePromiseCtx = function(ctx) {
19396 this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
19398 Promise2.prototype._settlePromise0 = function(handler, value, bitField) {
19399 var promise = this._promise0;
19400 var receiver = this._receiverAt(0);
19401 this._promise0 = void 0;
19402 this._receiver0 = void 0;
19403 this._settlePromise(promise, handler, receiver, value);
19405 Promise2.prototype._clearCallbackDataAtIndex = function(index) {
19406 var base = index * 4 - 4;
19407 this[base + 2] = this[base + 3] = this[base + 0] = this[base + 1] = void 0;
19409 Promise2.prototype._fulfill = function(value) {
19410 var bitField = this._bitField;
19411 if ((bitField & 117506048) >>> 16)
19413 if (value === this) {
19414 var err = makeSelfResolutionError();
19415 this._attachExtraTrace(err);
19416 return this._reject(err);
19418 this._setFulfilled();
19419 this._rejectionHandler0 = value;
19420 if ((bitField & 65535) > 0) {
19421 if ((bitField & 134217728) !== 0) {
19422 this._settlePromises();
19424 async.settlePromises(this);
19428 Promise2.prototype._reject = function(reason) {
19429 var bitField = this._bitField;
19430 if ((bitField & 117506048) >>> 16)
19432 this._setRejected();
19433 this._fulfillmentHandler0 = reason;
19434 if (this._isFinal()) {
19435 return async.fatalError(reason, util.isNode);
19437 if ((bitField & 65535) > 0) {
19438 async.settlePromises(this);
19440 this._ensurePossibleRejectionHandled();
19443 Promise2.prototype._fulfillPromises = function(len, value) {
19444 for (var i = 1; i < len; i++) {
19445 var handler = this._fulfillmentHandlerAt(i);
19446 var promise = this._promiseAt(i);
19447 var receiver = this._receiverAt(i);
19448 this._clearCallbackDataAtIndex(i);
19449 this._settlePromise(promise, handler, receiver, value);
19452 Promise2.prototype._rejectPromises = function(len, reason) {
19453 for (var i = 1; i < len; i++) {
19454 var handler = this._rejectionHandlerAt(i);
19455 var promise = this._promiseAt(i);
19456 var receiver = this._receiverAt(i);
19457 this._clearCallbackDataAtIndex(i);
19458 this._settlePromise(promise, handler, receiver, reason);
19461 Promise2.prototype._settlePromises = function() {
19462 var bitField = this._bitField;
19463 var len = bitField & 65535;
19465 if ((bitField & 16842752) !== 0) {
19466 var reason = this._fulfillmentHandler0;
19467 this._settlePromise0(this._rejectionHandler0, reason, bitField);
19468 this._rejectPromises(len, reason);
19470 var value = this._rejectionHandler0;
19471 this._settlePromise0(this._fulfillmentHandler0, value, bitField);
19472 this._fulfillPromises(len, value);
19474 this._setLength(0);
19476 this._clearCancellationData();
19478 Promise2.prototype._settledValue = function() {
19479 var bitField = this._bitField;
19480 if ((bitField & 33554432) !== 0) {
19481 return this._rejectionHandler0;
19482 } else if ((bitField & 16777216) !== 0) {
19483 return this._fulfillmentHandler0;
19486 function deferResolve(v) {
19487 this.promise._resolveCallback(v);
19489 function deferReject(v) {
19490 this.promise._rejectCallback(v, false);
19492 Promise2.defer = Promise2.pending = function() {
19493 debug.deprecated("Promise.defer", "new Promise");
19494 var promise = new Promise2(INTERNAL2);
19497 resolve: deferResolve,
19498 reject: deferReject
19501 util.notEnumerableProp(Promise2, "_makeSelfResolutionError", makeSelfResolutionError);
19502 require_method()(Promise2, INTERNAL2, tryConvertToPromise, apiRejection, debug);
19503 require_bind()(Promise2, INTERNAL2, tryConvertToPromise, debug);
19504 require_cancel()(Promise2, PromiseArray, apiRejection, debug);
19505 require_direct_resolve()(Promise2);
19506 require_synchronous_inspection()(Promise2);
19507 require_join()(Promise2, PromiseArray, tryConvertToPromise, INTERNAL2, async, getDomain);
19508 Promise2.Promise = Promise2;
19509 Promise2.version = "3.4.7";
19510 require_map()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug);
19511 require_call_get()(Promise2);
19512 require_using()(Promise2, apiRejection, tryConvertToPromise, createContext, INTERNAL2, debug);
19513 require_timers()(Promise2, INTERNAL2, debug);
19514 require_generators()(Promise2, apiRejection, INTERNAL2, tryConvertToPromise, Proxyable, debug);
19515 require_nodeify()(Promise2);
19516 require_promisify()(Promise2, INTERNAL2);
19517 require_props()(Promise2, PromiseArray, tryConvertToPromise, apiRejection);
19518 require_race()(Promise2, INTERNAL2, tryConvertToPromise, apiRejection);
19519 require_reduce()(Promise2, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL2, debug);
19520 require_settle()(Promise2, PromiseArray, debug);
19521 require_some()(Promise2, PromiseArray, apiRejection);
19522 require_filter()(Promise2, INTERNAL2);
19523 require_each()(Promise2, INTERNAL2);
19524 require_any()(Promise2);
19525 util.toFastProperties(Promise2);
19526 util.toFastProperties(Promise2.prototype);
19527 function fillTypes(value) {
19528 var p = new Promise2(INTERNAL2);
19529 p._fulfillmentHandler0 = value;
19530 p._rejectionHandler0 = value;
19531 p._promise0 = value;
19532 p._receiver0 = value;
19534 fillTypes({ a: 1 });
19535 fillTypes({ b: 2 });
19536 fillTypes({ c: 3 });
19538 fillTypes(function() {
19542 fillTypes(new Promise2(INTERNAL2));
19543 debug.setBounds(Async.firstLineError, util.lastLineError);
19549 // node_modules/bluebird/js/release/bluebird.js
19550 var require_bluebird = __commonJS({
19551 "node_modules/bluebird/js/release/bluebird.js"(exports2, module2) {
19554 if (typeof Promise !== "undefined")
19556 function noConflict() {
19558 if (Promise === bluebird)
19564 var bluebird = require_promise()();
19565 bluebird.noConflict = noConflict;
19566 module2.exports = bluebird;
19570 // node_modules/unzipper/lib/Buffer.js
19571 var require_Buffer = __commonJS({
19572 "node_modules/unzipper/lib/Buffer.js"(exports2, module2) {
19573 var Buffer2 = require("buffer").Buffer;
19574 if (Buffer2.from === void 0) {
19575 Buffer2.from = function(a, b, c) {
19576 return new Buffer2(a, b, c);
19578 Buffer2.alloc = Buffer2.from;
19580 module2.exports = Buffer2;
19584 // node_modules/process-nextick-args/index.js
19585 var require_process_nextick_args = __commonJS({
19586 "node_modules/process-nextick-args/index.js"(exports2, module2) {
19588 if (typeof process === "undefined" || !process.version || process.version.indexOf("v0.") === 0 || process.version.indexOf("v1.") === 0 && process.version.indexOf("v1.8.") !== 0) {
19589 module2.exports = { nextTick };
19591 module2.exports = process;
19593 function nextTick(fn, arg1, arg2, arg3) {
19594 if (typeof fn !== "function") {
19595 throw new TypeError('"callback" argument must be a function');
19597 var len = arguments.length;
19602 return process.nextTick(fn);
19604 return process.nextTick(function afterTickOne() {
19605 fn.call(null, arg1);
19608 return process.nextTick(function afterTickTwo() {
19609 fn.call(null, arg1, arg2);
19612 return process.nextTick(function afterTickThree() {
19613 fn.call(null, arg1, arg2, arg3);
19616 args = new Array(len - 1);
19618 while (i < args.length) {
19619 args[i++] = arguments[i];
19621 return process.nextTick(function afterTick() {
19622 fn.apply(null, args);
19629 // node_modules/isarray/index.js
19630 var require_isarray = __commonJS({
19631 "node_modules/isarray/index.js"(exports2, module2) {
19632 var toString = {}.toString;
19633 module2.exports = Array.isArray || function(arr) {
19634 return toString.call(arr) == "[object Array]";
19639 // node_modules/readable-stream/lib/internal/streams/stream.js
19640 var require_stream = __commonJS({
19641 "node_modules/readable-stream/lib/internal/streams/stream.js"(exports2, module2) {
19642 module2.exports = require("stream");
19646 // node_modules/safe-buffer/index.js
19647 var require_safe_buffer = __commonJS({
19648 "node_modules/safe-buffer/index.js"(exports2, module2) {
19649 var buffer = require("buffer");
19650 var Buffer2 = buffer.Buffer;
19651 function copyProps(src, dst) {
19652 for (var key in src) {
19653 dst[key] = src[key];
19656 if (Buffer2.from && Buffer2.alloc && Buffer2.allocUnsafe && Buffer2.allocUnsafeSlow) {
19657 module2.exports = buffer;
19659 copyProps(buffer, exports2);
19660 exports2.Buffer = SafeBuffer;
19662 function SafeBuffer(arg, encodingOrOffset, length) {
19663 return Buffer2(arg, encodingOrOffset, length);
19665 copyProps(Buffer2, SafeBuffer);
19666 SafeBuffer.from = function(arg, encodingOrOffset, length) {
19667 if (typeof arg === "number") {
19668 throw new TypeError("Argument must not be a number");
19670 return Buffer2(arg, encodingOrOffset, length);
19672 SafeBuffer.alloc = function(size, fill, encoding) {
19673 if (typeof size !== "number") {
19674 throw new TypeError("Argument must be a number");
19676 var buf = Buffer2(size);
19677 if (fill !== void 0) {
19678 if (typeof encoding === "string") {
19679 buf.fill(fill, encoding);
19688 SafeBuffer.allocUnsafe = function(size) {
19689 if (typeof size !== "number") {
19690 throw new TypeError("Argument must be a number");
19692 return Buffer2(size);
19694 SafeBuffer.allocUnsafeSlow = function(size) {
19695 if (typeof size !== "number") {
19696 throw new TypeError("Argument must be a number");
19698 return buffer.SlowBuffer(size);
19703 // node_modules/core-util-is/lib/util.js
19704 var require_util2 = __commonJS({
19705 "node_modules/core-util-is/lib/util.js"(exports2) {
19706 function isArray(arg) {
19707 if (Array.isArray) {
19708 return Array.isArray(arg);
19710 return objectToString(arg) === "[object Array]";
19712 exports2.isArray = isArray;
19713 function isBoolean(arg) {
19714 return typeof arg === "boolean";
19716 exports2.isBoolean = isBoolean;
19717 function isNull(arg) {
19718 return arg === null;
19720 exports2.isNull = isNull;
19721 function isNullOrUndefined(arg) {
19722 return arg == null;
19724 exports2.isNullOrUndefined = isNullOrUndefined;
19725 function isNumber(arg) {
19726 return typeof arg === "number";
19728 exports2.isNumber = isNumber;
19729 function isString(arg) {
19730 return typeof arg === "string";
19732 exports2.isString = isString;
19733 function isSymbol(arg) {
19734 return typeof arg === "symbol";
19736 exports2.isSymbol = isSymbol;
19737 function isUndefined(arg) {
19738 return arg === void 0;
19740 exports2.isUndefined = isUndefined;
19741 function isRegExp(re) {
19742 return objectToString(re) === "[object RegExp]";
19744 exports2.isRegExp = isRegExp;
19745 function isObject2(arg) {
19746 return typeof arg === "object" && arg !== null;
19748 exports2.isObject = isObject2;
19749 function isDate(d) {
19750 return objectToString(d) === "[object Date]";
19752 exports2.isDate = isDate;
19753 function isError2(e) {
19754 return objectToString(e) === "[object Error]" || e instanceof Error;
19756 exports2.isError = isError2;
19757 function isFunction(arg) {
19758 return typeof arg === "function";
19760 exports2.isFunction = isFunction;
19761 function isPrimitive2(arg) {
19762 return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined";
19764 exports2.isPrimitive = isPrimitive2;
19765 exports2.isBuffer = Buffer.isBuffer;
19766 function objectToString(o) {
19767 return Object.prototype.toString.call(o);
19772 // node_modules/readable-stream/lib/internal/streams/BufferList.js
19773 var require_BufferList = __commonJS({
19774 "node_modules/readable-stream/lib/internal/streams/BufferList.js"(exports2, module2) {
19776 function _classCallCheck(instance, Constructor) {
19777 if (!(instance instanceof Constructor)) {
19778 throw new TypeError("Cannot call a class as a function");
19781 var Buffer2 = require_safe_buffer().Buffer;
19782 var util = require("util");
19783 function copyBuffer(src, target, offset) {
19784 src.copy(target, offset);
19786 module2.exports = function() {
19787 function BufferList() {
19788 _classCallCheck(this, BufferList);
19793 BufferList.prototype.push = function push(v) {
19794 var entry = { data: v, next: null };
19795 if (this.length > 0)
19796 this.tail.next = entry;
19802 BufferList.prototype.unshift = function unshift(v) {
19803 var entry = { data: v, next: this.head };
19804 if (this.length === 0)
19809 BufferList.prototype.shift = function shift() {
19810 if (this.length === 0)
19812 var ret2 = this.head.data;
19813 if (this.length === 1)
19814 this.head = this.tail = null;
19816 this.head = this.head.next;
19820 BufferList.prototype.clear = function clear() {
19821 this.head = this.tail = null;
19824 BufferList.prototype.join = function join2(s) {
19825 if (this.length === 0)
19828 var ret2 = "" + p.data;
19829 while (p = p.next) {
19830 ret2 += s + p.data;
19834 BufferList.prototype.concat = function concat(n) {
19835 if (this.length === 0)
19836 return Buffer2.alloc(0);
19837 if (this.length === 1)
19838 return this.head.data;
19839 var ret2 = Buffer2.allocUnsafe(n >>> 0);
19843 copyBuffer(p.data, ret2, i);
19844 i += p.data.length;
19851 if (util && util.inspect && util.inspect.custom) {
19852 module2.exports.prototype[util.inspect.custom] = function() {
19853 var obj2 = util.inspect({ length: this.length });
19854 return this.constructor.name + " " + obj2;
19860 // node_modules/readable-stream/lib/internal/streams/destroy.js
19861 var require_destroy = __commonJS({
19862 "node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) {
19864 var pna = require_process_nextick_args();
19865 function destroy(err, cb) {
19867 var readableDestroyed = this._readableState && this._readableState.destroyed;
19868 var writableDestroyed = this._writableState && this._writableState.destroyed;
19869 if (readableDestroyed || writableDestroyed) {
19872 } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
19873 pna.nextTick(emitErrorNT, this, err);
19877 if (this._readableState) {
19878 this._readableState.destroyed = true;
19880 if (this._writableState) {
19881 this._writableState.destroyed = true;
19883 this._destroy(err || null, function(err2) {
19885 pna.nextTick(emitErrorNT, _this, err2);
19886 if (_this._writableState) {
19887 _this._writableState.errorEmitted = true;
19895 function undestroy() {
19896 if (this._readableState) {
19897 this._readableState.destroyed = false;
19898 this._readableState.reading = false;
19899 this._readableState.ended = false;
19900 this._readableState.endEmitted = false;
19902 if (this._writableState) {
19903 this._writableState.destroyed = false;
19904 this._writableState.ended = false;
19905 this._writableState.ending = false;
19906 this._writableState.finished = false;
19907 this._writableState.errorEmitted = false;
19910 function emitErrorNT(self2, err) {
19911 self2.emit("error", err);
19913 module2.exports = {
19920 // node_modules/util-deprecate/node.js
19921 var require_node2 = __commonJS({
19922 "node_modules/util-deprecate/node.js"(exports2, module2) {
19923 module2.exports = require("util").deprecate;
19927 // node_modules/readable-stream/lib/_stream_writable.js
19928 var require_stream_writable = __commonJS({
19929 "node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
19931 var pna = require_process_nextick_args();
19932 module2.exports = Writable;
19933 function CorkedRequest(state) {
19937 this.finish = function() {
19938 onCorkedFinish(_this, state);
19941 var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
19943 Writable.WritableState = WritableState;
19944 var util = Object.create(require_util2());
19945 util.inherits = require_inherits();
19946 var internalUtil = {
19947 deprecate: require_node2()
19949 var Stream2 = require_stream();
19950 var Buffer2 = require_safe_buffer().Buffer;
19951 var OurUint8Array = global.Uint8Array || function() {
19953 function _uint8ArrayToBuffer(chunk) {
19954 return Buffer2.from(chunk);
19956 function _isUint8Array(obj2) {
19957 return Buffer2.isBuffer(obj2) || obj2 instanceof OurUint8Array;
19959 var destroyImpl = require_destroy();
19960 util.inherits(Writable, Stream2);
19963 function WritableState(options, stream) {
19964 Duplex = Duplex || require_stream_duplex();
19965 options = options || {};
19966 var isDuplex = stream instanceof Duplex;
19967 this.objectMode = !!options.objectMode;
19969 this.objectMode = this.objectMode || !!options.writableObjectMode;
19970 var hwm = options.highWaterMark;
19971 var writableHwm = options.writableHighWaterMark;
19972 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
19973 if (hwm || hwm === 0)
19974 this.highWaterMark = hwm;
19975 else if (isDuplex && (writableHwm || writableHwm === 0))
19976 this.highWaterMark = writableHwm;
19978 this.highWaterMark = defaultHwm;
19979 this.highWaterMark = Math.floor(this.highWaterMark);
19980 this.finalCalled = false;
19981 this.needDrain = false;
19982 this.ending = false;
19983 this.ended = false;
19984 this.finished = false;
19985 this.destroyed = false;
19986 var noDecode = options.decodeStrings === false;
19987 this.decodeStrings = !noDecode;
19988 this.defaultEncoding = options.defaultEncoding || "utf8";
19990 this.writing = false;
19993 this.bufferProcessing = false;
19994 this.onwrite = function(er) {
19995 onwrite(stream, er);
19997 this.writecb = null;
19999 this.bufferedRequest = null;
20000 this.lastBufferedRequest = null;
20001 this.pendingcb = 0;
20002 this.prefinished = false;
20003 this.errorEmitted = false;
20004 this.bufferedRequestCount = 0;
20005 this.corkedRequestsFree = new CorkedRequest(this);
20007 WritableState.prototype.getBuffer = function getBuffer() {
20008 var current = this.bufferedRequest;
20012 current = current.next;
20018 Object.defineProperty(WritableState.prototype, "buffer", {
20019 get: internalUtil.deprecate(function() {
20020 return this.getBuffer();
20021 }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
20026 var realHasInstance;
20027 if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
20028 realHasInstance = Function.prototype[Symbol.hasInstance];
20029 Object.defineProperty(Writable, Symbol.hasInstance, {
20030 value: function(object) {
20031 if (realHasInstance.call(this, object))
20033 if (this !== Writable)
20035 return object && object._writableState instanceof WritableState;
20039 realHasInstance = function(object) {
20040 return object instanceof this;
20043 function Writable(options) {
20044 Duplex = Duplex || require_stream_duplex();
20045 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
20046 return new Writable(options);
20048 this._writableState = new WritableState(options, this);
20049 this.writable = true;
20051 if (typeof options.write === "function")
20052 this._write = options.write;
20053 if (typeof options.writev === "function")
20054 this._writev = options.writev;
20055 if (typeof options.destroy === "function")
20056 this._destroy = options.destroy;
20057 if (typeof options.final === "function")
20058 this._final = options.final;
20060 Stream2.call(this);
20062 Writable.prototype.pipe = function() {
20063 this.emit("error", new Error("Cannot pipe, not readable"));
20065 function writeAfterEnd(stream, cb) {
20066 var er = new Error("write after end");
20067 stream.emit("error", er);
20068 pna.nextTick(cb, er);
20070 function validChunk(stream, state, chunk, cb) {
20073 if (chunk === null) {
20074 er = new TypeError("May not write null values to stream");
20075 } else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
20076 er = new TypeError("Invalid non-string/buffer chunk");
20079 stream.emit("error", er);
20080 pna.nextTick(cb, er);
20085 Writable.prototype.write = function(chunk, encoding, cb) {
20086 var state = this._writableState;
20088 var isBuf = !state.objectMode && _isUint8Array(chunk);
20089 if (isBuf && !Buffer2.isBuffer(chunk)) {
20090 chunk = _uint8ArrayToBuffer(chunk);
20092 if (typeof encoding === "function") {
20097 encoding = "buffer";
20098 else if (!encoding)
20099 encoding = state.defaultEncoding;
20100 if (typeof cb !== "function")
20103 writeAfterEnd(this, cb);
20104 else if (isBuf || validChunk(this, state, chunk, cb)) {
20106 ret2 = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
20110 Writable.prototype.cork = function() {
20111 var state = this._writableState;
20114 Writable.prototype.uncork = function() {
20115 var state = this._writableState;
20116 if (state.corked) {
20118 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest)
20119 clearBuffer(this, state);
20122 Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
20123 if (typeof encoding === "string")
20124 encoding = encoding.toLowerCase();
20125 if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1))
20126 throw new TypeError("Unknown encoding: " + encoding);
20127 this._writableState.defaultEncoding = encoding;
20130 function decodeChunk(state, chunk, encoding) {
20131 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") {
20132 chunk = Buffer2.from(chunk, encoding);
20136 Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
20139 return this._writableState.highWaterMark;
20142 function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
20144 var newChunk = decodeChunk(state, chunk, encoding);
20145 if (chunk !== newChunk) {
20147 encoding = "buffer";
20151 var len = state.objectMode ? 1 : chunk.length;
20152 state.length += len;
20153 var ret2 = state.length < state.highWaterMark;
20155 state.needDrain = true;
20156 if (state.writing || state.corked) {
20157 var last = state.lastBufferedRequest;
20158 state.lastBufferedRequest = {
20166 last.next = state.lastBufferedRequest;
20168 state.bufferedRequest = state.lastBufferedRequest;
20170 state.bufferedRequestCount += 1;
20172 doWrite(stream, state, false, len, chunk, encoding, cb);
20176 function doWrite(stream, state, writev, len, chunk, encoding, cb) {
20177 state.writelen = len;
20178 state.writecb = cb;
20179 state.writing = true;
20182 stream._writev(chunk, state.onwrite);
20184 stream._write(chunk, encoding, state.onwrite);
20185 state.sync = false;
20187 function onwriteError(stream, state, sync, er, cb) {
20190 pna.nextTick(cb, er);
20191 pna.nextTick(finishMaybe, stream, state);
20192 stream._writableState.errorEmitted = true;
20193 stream.emit("error", er);
20196 stream._writableState.errorEmitted = true;
20197 stream.emit("error", er);
20198 finishMaybe(stream, state);
20201 function onwriteStateUpdate(state) {
20202 state.writing = false;
20203 state.writecb = null;
20204 state.length -= state.writelen;
20205 state.writelen = 0;
20207 function onwrite(stream, er) {
20208 var state = stream._writableState;
20209 var sync = state.sync;
20210 var cb = state.writecb;
20211 onwriteStateUpdate(state);
20213 onwriteError(stream, state, sync, er, cb);
20215 var finished = needFinish(state);
20216 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
20217 clearBuffer(stream, state);
20220 asyncWrite(afterWrite, stream, state, finished, cb);
20222 afterWrite(stream, state, finished, cb);
20226 function afterWrite(stream, state, finished, cb) {
20228 onwriteDrain(stream, state);
20231 finishMaybe(stream, state);
20233 function onwriteDrain(stream, state) {
20234 if (state.length === 0 && state.needDrain) {
20235 state.needDrain = false;
20236 stream.emit("drain");
20239 function clearBuffer(stream, state) {
20240 state.bufferProcessing = true;
20241 var entry = state.bufferedRequest;
20242 if (stream._writev && entry && entry.next) {
20243 var l2 = state.bufferedRequestCount;
20244 var buffer = new Array(l2);
20245 var holder = state.corkedRequestsFree;
20246 holder.entry = entry;
20248 var allBuffers = true;
20250 buffer[count] = entry;
20252 allBuffers = false;
20253 entry = entry.next;
20256 buffer.allBuffers = allBuffers;
20257 doWrite(stream, state, true, state.length, buffer, "", holder.finish);
20259 state.lastBufferedRequest = null;
20261 state.corkedRequestsFree = holder.next;
20262 holder.next = null;
20264 state.corkedRequestsFree = new CorkedRequest(state);
20266 state.bufferedRequestCount = 0;
20269 var chunk = entry.chunk;
20270 var encoding = entry.encoding;
20271 var cb = entry.callback;
20272 var len = state.objectMode ? 1 : chunk.length;
20273 doWrite(stream, state, false, len, chunk, encoding, cb);
20274 entry = entry.next;
20275 state.bufferedRequestCount--;
20276 if (state.writing) {
20280 if (entry === null)
20281 state.lastBufferedRequest = null;
20283 state.bufferedRequest = entry;
20284 state.bufferProcessing = false;
20286 Writable.prototype._write = function(chunk, encoding, cb) {
20287 cb(new Error("_write() is not implemented"));
20289 Writable.prototype._writev = null;
20290 Writable.prototype.end = function(chunk, encoding, cb) {
20291 var state = this._writableState;
20292 if (typeof chunk === "function") {
20296 } else if (typeof encoding === "function") {
20300 if (chunk !== null && chunk !== void 0)
20301 this.write(chunk, encoding);
20302 if (state.corked) {
20306 if (!state.ending && !state.finished)
20307 endWritable(this, state, cb);
20309 function needFinish(state) {
20310 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
20312 function callFinal(stream, state) {
20313 stream._final(function(err) {
20316 stream.emit("error", err);
20318 state.prefinished = true;
20319 stream.emit("prefinish");
20320 finishMaybe(stream, state);
20323 function prefinish(stream, state) {
20324 if (!state.prefinished && !state.finalCalled) {
20325 if (typeof stream._final === "function") {
20327 state.finalCalled = true;
20328 pna.nextTick(callFinal, stream, state);
20330 state.prefinished = true;
20331 stream.emit("prefinish");
20335 function finishMaybe(stream, state) {
20336 var need = needFinish(state);
20338 prefinish(stream, state);
20339 if (state.pendingcb === 0) {
20340 state.finished = true;
20341 stream.emit("finish");
20346 function endWritable(stream, state, cb) {
20347 state.ending = true;
20348 finishMaybe(stream, state);
20350 if (state.finished)
20353 stream.once("finish", cb);
20355 state.ended = true;
20356 stream.writable = false;
20358 function onCorkedFinish(corkReq, state, err) {
20359 var entry = corkReq.entry;
20360 corkReq.entry = null;
20362 var cb = entry.callback;
20365 entry = entry.next;
20367 if (state.corkedRequestsFree) {
20368 state.corkedRequestsFree.next = corkReq;
20370 state.corkedRequestsFree = corkReq;
20373 Object.defineProperty(Writable.prototype, "destroyed", {
20375 if (this._writableState === void 0) {
20378 return this._writableState.destroyed;
20380 set: function(value) {
20381 if (!this._writableState) {
20384 this._writableState.destroyed = value;
20387 Writable.prototype.destroy = destroyImpl.destroy;
20388 Writable.prototype._undestroy = destroyImpl.undestroy;
20389 Writable.prototype._destroy = function(err, cb) {
20396 // node_modules/readable-stream/lib/_stream_duplex.js
20397 var require_stream_duplex = __commonJS({
20398 "node_modules/readable-stream/lib/_stream_duplex.js"(exports2, module2) {
20400 var pna = require_process_nextick_args();
20401 var objectKeys = Object.keys || function(obj2) {
20403 for (var key in obj2) {
20408 module2.exports = Duplex;
20409 var util = Object.create(require_util2());
20410 util.inherits = require_inherits();
20411 var Readable2 = require_stream_readable();
20412 var Writable = require_stream_writable();
20413 util.inherits(Duplex, Readable2);
20415 keys = objectKeys(Writable.prototype);
20416 for (v = 0; v < keys.length; v++) {
20418 if (!Duplex.prototype[method])
20419 Duplex.prototype[method] = Writable.prototype[method];
20425 function Duplex(options) {
20426 if (!(this instanceof Duplex))
20427 return new Duplex(options);
20428 Readable2.call(this, options);
20429 Writable.call(this, options);
20430 if (options && options.readable === false)
20431 this.readable = false;
20432 if (options && options.writable === false)
20433 this.writable = false;
20434 this.allowHalfOpen = true;
20435 if (options && options.allowHalfOpen === false)
20436 this.allowHalfOpen = false;
20437 this.once("end", onend);
20439 Object.defineProperty(Duplex.prototype, "writableHighWaterMark", {
20442 return this._writableState.highWaterMark;
20446 if (this.allowHalfOpen || this._writableState.ended)
20448 pna.nextTick(onEndNT, this);
20450 function onEndNT(self2) {
20453 Object.defineProperty(Duplex.prototype, "destroyed", {
20455 if (this._readableState === void 0 || this._writableState === void 0) {
20458 return this._readableState.destroyed && this._writableState.destroyed;
20460 set: function(value) {
20461 if (this._readableState === void 0 || this._writableState === void 0) {
20464 this._readableState.destroyed = value;
20465 this._writableState.destroyed = value;
20468 Duplex.prototype._destroy = function(err, cb) {
20471 pna.nextTick(cb, err);
20476 // node_modules/readable-stream/lib/_stream_readable.js
20477 var require_stream_readable = __commonJS({
20478 "node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
20480 var pna = require_process_nextick_args();
20481 module2.exports = Readable2;
20482 var isArray = require_isarray();
20484 Readable2.ReadableState = ReadableState;
20485 var EE = require("events").EventEmitter;
20486 var EElistenerCount = function(emitter, type) {
20487 return emitter.listeners(type).length;
20489 var Stream2 = require_stream();
20490 var Buffer2 = require_safe_buffer().Buffer;
20491 var OurUint8Array = global.Uint8Array || function() {
20493 function _uint8ArrayToBuffer(chunk) {
20494 return Buffer2.from(chunk);
20496 function _isUint8Array(obj2) {
20497 return Buffer2.isBuffer(obj2) || obj2 instanceof OurUint8Array;
20499 var util = Object.create(require_util2());
20500 util.inherits = require_inherits();
20501 var debugUtil = require("util");
20502 var debug = void 0;
20503 if (debugUtil && debugUtil.debuglog) {
20504 debug = debugUtil.debuglog("stream");
20506 debug = function() {
20509 var BufferList = require_BufferList();
20510 var destroyImpl = require_destroy();
20512 util.inherits(Readable2, Stream2);
20513 var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
20514 function prependListener(emitter, event, fn) {
20515 if (typeof emitter.prependListener === "function")
20516 return emitter.prependListener(event, fn);
20517 if (!emitter._events || !emitter._events[event])
20518 emitter.on(event, fn);
20519 else if (isArray(emitter._events[event]))
20520 emitter._events[event].unshift(fn);
20522 emitter._events[event] = [fn, emitter._events[event]];
20524 function ReadableState(options, stream) {
20525 Duplex = Duplex || require_stream_duplex();
20526 options = options || {};
20527 var isDuplex = stream instanceof Duplex;
20528 this.objectMode = !!options.objectMode;
20530 this.objectMode = this.objectMode || !!options.readableObjectMode;
20531 var hwm = options.highWaterMark;
20532 var readableHwm = options.readableHighWaterMark;
20533 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
20534 if (hwm || hwm === 0)
20535 this.highWaterMark = hwm;
20536 else if (isDuplex && (readableHwm || readableHwm === 0))
20537 this.highWaterMark = readableHwm;
20539 this.highWaterMark = defaultHwm;
20540 this.highWaterMark = Math.floor(this.highWaterMark);
20541 this.buffer = new BufferList();
20544 this.pipesCount = 0;
20545 this.flowing = null;
20546 this.ended = false;
20547 this.endEmitted = false;
20548 this.reading = false;
20550 this.needReadable = false;
20551 this.emittedReadable = false;
20552 this.readableListening = false;
20553 this.resumeScheduled = false;
20554 this.destroyed = false;
20555 this.defaultEncoding = options.defaultEncoding || "utf8";
20556 this.awaitDrain = 0;
20557 this.readingMore = false;
20558 this.decoder = null;
20559 this.encoding = null;
20560 if (options.encoding) {
20561 if (!StringDecoder)
20562 StringDecoder = require("string_decoder/").StringDecoder;
20563 this.decoder = new StringDecoder(options.encoding);
20564 this.encoding = options.encoding;
20567 function Readable2(options) {
20568 Duplex = Duplex || require_stream_duplex();
20569 if (!(this instanceof Readable2))
20570 return new Readable2(options);
20571 this._readableState = new ReadableState(options, this);
20572 this.readable = true;
20574 if (typeof options.read === "function")
20575 this._read = options.read;
20576 if (typeof options.destroy === "function")
20577 this._destroy = options.destroy;
20579 Stream2.call(this);
20581 Object.defineProperty(Readable2.prototype, "destroyed", {
20583 if (this._readableState === void 0) {
20586 return this._readableState.destroyed;
20588 set: function(value) {
20589 if (!this._readableState) {
20592 this._readableState.destroyed = value;
20595 Readable2.prototype.destroy = destroyImpl.destroy;
20596 Readable2.prototype._undestroy = destroyImpl.undestroy;
20597 Readable2.prototype._destroy = function(err, cb) {
20601 Readable2.prototype.push = function(chunk, encoding) {
20602 var state = this._readableState;
20603 var skipChunkCheck;
20604 if (!state.objectMode) {
20605 if (typeof chunk === "string") {
20606 encoding = encoding || state.defaultEncoding;
20607 if (encoding !== state.encoding) {
20608 chunk = Buffer2.from(chunk, encoding);
20611 skipChunkCheck = true;
20614 skipChunkCheck = true;
20616 return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
20618 Readable2.prototype.unshift = function(chunk) {
20619 return readableAddChunk(this, chunk, null, true, false);
20621 function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
20622 var state = stream._readableState;
20623 if (chunk === null) {
20624 state.reading = false;
20625 onEofChunk(stream, state);
20628 if (!skipChunkCheck)
20629 er = chunkInvalid(state, chunk);
20631 stream.emit("error", er);
20632 } else if (state.objectMode || chunk && chunk.length > 0) {
20633 if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) {
20634 chunk = _uint8ArrayToBuffer(chunk);
20637 if (state.endEmitted)
20638 stream.emit("error", new Error("stream.unshift() after end event"));
20640 addChunk(stream, state, chunk, true);
20641 } else if (state.ended) {
20642 stream.emit("error", new Error("stream.push() after EOF"));
20644 state.reading = false;
20645 if (state.decoder && !encoding) {
20646 chunk = state.decoder.write(chunk);
20647 if (state.objectMode || chunk.length !== 0)
20648 addChunk(stream, state, chunk, false);
20650 maybeReadMore(stream, state);
20652 addChunk(stream, state, chunk, false);
20655 } else if (!addToFront) {
20656 state.reading = false;
20659 return needMoreData(state);
20661 function addChunk(stream, state, chunk, addToFront) {
20662 if (state.flowing && state.length === 0 && !state.sync) {
20663 stream.emit("data", chunk);
20666 state.length += state.objectMode ? 1 : chunk.length;
20668 state.buffer.unshift(chunk);
20670 state.buffer.push(chunk);
20671 if (state.needReadable)
20672 emitReadable(stream);
20674 maybeReadMore(stream, state);
20676 function chunkInvalid(state, chunk) {
20678 if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) {
20679 er = new TypeError("Invalid non-string/buffer chunk");
20683 function needMoreData(state) {
20684 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
20686 Readable2.prototype.isPaused = function() {
20687 return this._readableState.flowing === false;
20689 Readable2.prototype.setEncoding = function(enc) {
20690 if (!StringDecoder)
20691 StringDecoder = require("string_decoder/").StringDecoder;
20692 this._readableState.decoder = new StringDecoder(enc);
20693 this._readableState.encoding = enc;
20696 var MAX_HWM = 8388608;
20697 function computeNewHighWaterMark(n) {
20698 if (n >= MAX_HWM) {
20711 function howMuchToRead(n, state) {
20712 if (n <= 0 || state.length === 0 && state.ended)
20714 if (state.objectMode)
20717 if (state.flowing && state.length)
20718 return state.buffer.head.data.length;
20720 return state.length;
20722 if (n > state.highWaterMark)
20723 state.highWaterMark = computeNewHighWaterMark(n);
20724 if (n <= state.length)
20726 if (!state.ended) {
20727 state.needReadable = true;
20730 return state.length;
20732 Readable2.prototype.read = function(n) {
20734 n = parseInt(n, 10);
20735 var state = this._readableState;
20738 state.emittedReadable = false;
20739 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
20740 debug("read: emitReadable", state.length, state.ended);
20741 if (state.length === 0 && state.ended)
20744 emitReadable(this);
20747 n = howMuchToRead(n, state);
20748 if (n === 0 && state.ended) {
20749 if (state.length === 0)
20753 var doRead = state.needReadable;
20754 debug("need readable", doRead);
20755 if (state.length === 0 || state.length - n < state.highWaterMark) {
20757 debug("length less than watermark", doRead);
20759 if (state.ended || state.reading) {
20761 debug("reading or ended", doRead);
20762 } else if (doRead) {
20764 state.reading = true;
20766 if (state.length === 0)
20767 state.needReadable = true;
20768 this._read(state.highWaterMark);
20769 state.sync = false;
20770 if (!state.reading)
20771 n = howMuchToRead(nOrig, state);
20775 ret2 = fromList(n, state);
20778 if (ret2 === null) {
20779 state.needReadable = true;
20784 if (state.length === 0) {
20786 state.needReadable = true;
20787 if (nOrig !== n && state.ended)
20791 this.emit("data", ret2);
20794 function onEofChunk(stream, state) {
20797 if (state.decoder) {
20798 var chunk = state.decoder.end();
20799 if (chunk && chunk.length) {
20800 state.buffer.push(chunk);
20801 state.length += state.objectMode ? 1 : chunk.length;
20804 state.ended = true;
20805 emitReadable(stream);
20807 function emitReadable(stream) {
20808 var state = stream._readableState;
20809 state.needReadable = false;
20810 if (!state.emittedReadable) {
20811 debug("emitReadable", state.flowing);
20812 state.emittedReadable = true;
20814 pna.nextTick(emitReadable_, stream);
20816 emitReadable_(stream);
20819 function emitReadable_(stream) {
20820 debug("emit readable");
20821 stream.emit("readable");
20824 function maybeReadMore(stream, state) {
20825 if (!state.readingMore) {
20826 state.readingMore = true;
20827 pna.nextTick(maybeReadMore_, stream, state);
20830 function maybeReadMore_(stream, state) {
20831 var len = state.length;
20832 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
20833 debug("maybeReadMore read 0");
20835 if (len === state.length)
20838 len = state.length;
20840 state.readingMore = false;
20842 Readable2.prototype._read = function(n) {
20843 this.emit("error", new Error("_read() is not implemented"));
20845 Readable2.prototype.pipe = function(dest, pipeOpts) {
20847 var state = this._readableState;
20848 switch (state.pipesCount) {
20850 state.pipes = dest;
20853 state.pipes = [state.pipes, dest];
20856 state.pipes.push(dest);
20859 state.pipesCount += 1;
20860 debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
20861 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
20862 var endFn = doEnd ? onend : unpipe;
20863 if (state.endEmitted)
20864 pna.nextTick(endFn);
20866 src.once("end", endFn);
20867 dest.on("unpipe", onunpipe);
20868 function onunpipe(readable, unpipeInfo) {
20870 if (readable === src) {
20871 if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
20872 unpipeInfo.hasUnpiped = true;
20881 var ondrain = pipeOnDrain(src);
20882 dest.on("drain", ondrain);
20883 var cleanedUp = false;
20884 function cleanup() {
20886 dest.removeListener("close", onclose);
20887 dest.removeListener("finish", onfinish);
20888 dest.removeListener("drain", ondrain);
20889 dest.removeListener("error", onerror);
20890 dest.removeListener("unpipe", onunpipe);
20891 src.removeListener("end", onend);
20892 src.removeListener("end", unpipe);
20893 src.removeListener("data", ondata);
20895 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain))
20898 var increasedAwaitDrain = false;
20899 src.on("data", ondata);
20900 function ondata(chunk) {
20902 increasedAwaitDrain = false;
20903 var ret2 = dest.write(chunk);
20904 if (ret2 === false && !increasedAwaitDrain) {
20905 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
20906 debug("false write response, pause", src._readableState.awaitDrain);
20907 src._readableState.awaitDrain++;
20908 increasedAwaitDrain = true;
20913 function onerror(er) {
20914 debug("onerror", er);
20916 dest.removeListener("error", onerror);
20917 if (EElistenerCount(dest, "error") === 0)
20918 dest.emit("error", er);
20920 prependListener(dest, "error", onerror);
20921 function onclose() {
20922 dest.removeListener("finish", onfinish);
20925 dest.once("close", onclose);
20926 function onfinish() {
20928 dest.removeListener("close", onclose);
20931 dest.once("finish", onfinish);
20932 function unpipe() {
20936 dest.emit("pipe", src);
20937 if (!state.flowing) {
20938 debug("pipe resume");
20943 function pipeOnDrain(src) {
20944 return function() {
20945 var state = src._readableState;
20946 debug("pipeOnDrain", state.awaitDrain);
20947 if (state.awaitDrain)
20948 state.awaitDrain--;
20949 if (state.awaitDrain === 0 && EElistenerCount(src, "data")) {
20950 state.flowing = true;
20955 Readable2.prototype.unpipe = function(dest) {
20956 var state = this._readableState;
20957 var unpipeInfo = { hasUnpiped: false };
20958 if (state.pipesCount === 0)
20960 if (state.pipesCount === 1) {
20961 if (dest && dest !== state.pipes)
20964 dest = state.pipes;
20965 state.pipes = null;
20966 state.pipesCount = 0;
20967 state.flowing = false;
20969 dest.emit("unpipe", this, unpipeInfo);
20973 var dests = state.pipes;
20974 var len = state.pipesCount;
20975 state.pipes = null;
20976 state.pipesCount = 0;
20977 state.flowing = false;
20978 for (var i = 0; i < len; i++) {
20979 dests[i].emit("unpipe", this, unpipeInfo);
20983 var index = indexOf(state.pipes, dest);
20986 state.pipes.splice(index, 1);
20987 state.pipesCount -= 1;
20988 if (state.pipesCount === 1)
20989 state.pipes = state.pipes[0];
20990 dest.emit("unpipe", this, unpipeInfo);
20993 Readable2.prototype.on = function(ev, fn) {
20994 var res = Stream2.prototype.on.call(this, ev, fn);
20995 if (ev === "data") {
20996 if (this._readableState.flowing !== false)
20998 } else if (ev === "readable") {
20999 var state = this._readableState;
21000 if (!state.endEmitted && !state.readableListening) {
21001 state.readableListening = state.needReadable = true;
21002 state.emittedReadable = false;
21003 if (!state.reading) {
21004 pna.nextTick(nReadingNextTick, this);
21005 } else if (state.length) {
21006 emitReadable(this);
21012 Readable2.prototype.addListener = Readable2.prototype.on;
21013 function nReadingNextTick(self2) {
21014 debug("readable nexttick read 0");
21017 Readable2.prototype.resume = function() {
21018 var state = this._readableState;
21019 if (!state.flowing) {
21021 state.flowing = true;
21022 resume(this, state);
21026 function resume(stream, state) {
21027 if (!state.resumeScheduled) {
21028 state.resumeScheduled = true;
21029 pna.nextTick(resume_, stream, state);
21032 function resume_(stream, state) {
21033 if (!state.reading) {
21034 debug("resume read 0");
21037 state.resumeScheduled = false;
21038 state.awaitDrain = 0;
21039 stream.emit("resume");
21041 if (state.flowing && !state.reading)
21044 Readable2.prototype.pause = function() {
21045 debug("call pause flowing=%j", this._readableState.flowing);
21046 if (this._readableState.flowing !== false) {
21048 this._readableState.flowing = false;
21049 this.emit("pause");
21053 function flow(stream) {
21054 var state = stream._readableState;
21055 debug("flow", state.flowing);
21056 while (state.flowing && stream.read() !== null) {
21059 Readable2.prototype.wrap = function(stream) {
21061 var state = this._readableState;
21062 var paused = false;
21063 stream.on("end", function() {
21064 debug("wrapped end");
21065 if (state.decoder && !state.ended) {
21066 var chunk = state.decoder.end();
21067 if (chunk && chunk.length)
21072 stream.on("data", function(chunk) {
21073 debug("wrapped data");
21075 chunk = state.decoder.write(chunk);
21076 if (state.objectMode && (chunk === null || chunk === void 0))
21078 else if (!state.objectMode && (!chunk || !chunk.length))
21080 var ret2 = _this.push(chunk);
21086 for (var i in stream) {
21087 if (this[i] === void 0 && typeof stream[i] === "function") {
21088 this[i] = function(method) {
21089 return function() {
21090 return stream[method].apply(stream, arguments);
21095 for (var n = 0; n < kProxyEvents.length; n++) {
21096 stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
21098 this._read = function(n2) {
21099 debug("wrapped _read", n2);
21107 Object.defineProperty(Readable2.prototype, "readableHighWaterMark", {
21110 return this._readableState.highWaterMark;
21113 Readable2._fromList = fromList;
21114 function fromList(n, state) {
21115 if (state.length === 0)
21118 if (state.objectMode)
21119 ret2 = state.buffer.shift();
21120 else if (!n || n >= state.length) {
21122 ret2 = state.buffer.join("");
21123 else if (state.buffer.length === 1)
21124 ret2 = state.buffer.head.data;
21126 ret2 = state.buffer.concat(state.length);
21127 state.buffer.clear();
21129 ret2 = fromListPartial(n, state.buffer, state.decoder);
21133 function fromListPartial(n, list, hasStrings) {
21135 if (n < list.head.data.length) {
21136 ret2 = list.head.data.slice(0, n);
21137 list.head.data = list.head.data.slice(n);
21138 } else if (n === list.head.data.length) {
21139 ret2 = list.shift();
21141 ret2 = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
21145 function copyFromBufferString(n, list) {
21150 while (p = p.next) {
21152 var nb = n > str.length ? str.length : n;
21153 if (nb === str.length)
21156 ret2 += str.slice(0, n);
21159 if (nb === str.length) {
21162 list.head = p.next;
21164 list.head = list.tail = null;
21167 p.data = str.slice(nb);
21176 function copyFromBuffer(n, list) {
21177 var ret2 = Buffer2.allocUnsafe(n);
21181 n -= p.data.length;
21182 while (p = p.next) {
21184 var nb = n > buf.length ? buf.length : n;
21185 buf.copy(ret2, ret2.length - n, 0, nb);
21188 if (nb === buf.length) {
21191 list.head = p.next;
21193 list.head = list.tail = null;
21196 p.data = buf.slice(nb);
21205 function endReadable(stream) {
21206 var state = stream._readableState;
21207 if (state.length > 0)
21208 throw new Error('"endReadable()" called on non-empty stream');
21209 if (!state.endEmitted) {
21210 state.ended = true;
21211 pna.nextTick(endReadableNT, state, stream);
21214 function endReadableNT(state, stream) {
21215 if (!state.endEmitted && state.length === 0) {
21216 state.endEmitted = true;
21217 stream.readable = false;
21218 stream.emit("end");
21221 function indexOf(xs, x) {
21222 for (var i = 0, l2 = xs.length; i < l2; i++) {
21231 // node_modules/readable-stream/lib/_stream_transform.js
21232 var require_stream_transform = __commonJS({
21233 "node_modules/readable-stream/lib/_stream_transform.js"(exports2, module2) {
21235 module2.exports = Transform;
21236 var Duplex = require_stream_duplex();
21237 var util = Object.create(require_util2());
21238 util.inherits = require_inherits();
21239 util.inherits(Transform, Duplex);
21240 function afterTransform(er, data) {
21241 var ts = this._transformState;
21242 ts.transforming = false;
21243 var cb = ts.writecb;
21245 return this.emit("error", new Error("write callback called multiple times"));
21247 ts.writechunk = null;
21252 var rs = this._readableState;
21253 rs.reading = false;
21254 if (rs.needReadable || rs.length < rs.highWaterMark) {
21255 this._read(rs.highWaterMark);
21258 function Transform(options) {
21259 if (!(this instanceof Transform))
21260 return new Transform(options);
21261 Duplex.call(this, options);
21262 this._transformState = {
21263 afterTransform: afterTransform.bind(this),
21264 needTransform: false,
21265 transforming: false,
21268 writeencoding: null
21270 this._readableState.needReadable = true;
21271 this._readableState.sync = false;
21273 if (typeof options.transform === "function")
21274 this._transform = options.transform;
21275 if (typeof options.flush === "function")
21276 this._flush = options.flush;
21278 this.on("prefinish", prefinish);
21280 function prefinish() {
21282 if (typeof this._flush === "function") {
21283 this._flush(function(er, data) {
21284 done(_this, er, data);
21287 done(this, null, null);
21290 Transform.prototype.push = function(chunk, encoding) {
21291 this._transformState.needTransform = false;
21292 return Duplex.prototype.push.call(this, chunk, encoding);
21294 Transform.prototype._transform = function(chunk, encoding, cb) {
21295 throw new Error("_transform() is not implemented");
21297 Transform.prototype._write = function(chunk, encoding, cb) {
21298 var ts = this._transformState;
21300 ts.writechunk = chunk;
21301 ts.writeencoding = encoding;
21302 if (!ts.transforming) {
21303 var rs = this._readableState;
21304 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark)
21305 this._read(rs.highWaterMark);
21308 Transform.prototype._read = function(n) {
21309 var ts = this._transformState;
21310 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
21311 ts.transforming = true;
21312 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
21314 ts.needTransform = true;
21317 Transform.prototype._destroy = function(err, cb) {
21319 Duplex.prototype._destroy.call(this, err, function(err2) {
21321 _this2.emit("close");
21324 function done(stream, er, data) {
21326 return stream.emit("error", er);
21329 if (stream._writableState.length)
21330 throw new Error("Calling transform done when ws.length != 0");
21331 if (stream._transformState.transforming)
21332 throw new Error("Calling transform done when still transforming");
21333 return stream.push(null);
21338 // node_modules/readable-stream/lib/_stream_passthrough.js
21339 var require_stream_passthrough = __commonJS({
21340 "node_modules/readable-stream/lib/_stream_passthrough.js"(exports2, module2) {
21342 module2.exports = PassThrough2;
21343 var Transform = require_stream_transform();
21344 var util = Object.create(require_util2());
21345 util.inherits = require_inherits();
21346 util.inherits(PassThrough2, Transform);
21347 function PassThrough2(options) {
21348 if (!(this instanceof PassThrough2))
21349 return new PassThrough2(options);
21350 Transform.call(this, options);
21352 PassThrough2.prototype._transform = function(chunk, encoding, cb) {
21358 // node_modules/readable-stream/readable.js
21359 var require_readable = __commonJS({
21360 "node_modules/readable-stream/readable.js"(exports2, module2) {
21361 var Stream2 = require("stream");
21362 if (process.env.READABLE_STREAM === "disable" && Stream2) {
21363 module2.exports = Stream2;
21364 exports2 = module2.exports = Stream2.Readable;
21365 exports2.Readable = Stream2.Readable;
21366 exports2.Writable = Stream2.Writable;
21367 exports2.Duplex = Stream2.Duplex;
21368 exports2.Transform = Stream2.Transform;
21369 exports2.PassThrough = Stream2.PassThrough;
21370 exports2.Stream = Stream2;
21372 exports2 = module2.exports = require_stream_readable();
21373 exports2.Stream = Stream2 || exports2;
21374 exports2.Readable = exports2;
21375 exports2.Writable = require_stream_writable();
21376 exports2.Duplex = require_stream_duplex();
21377 exports2.Transform = require_stream_transform();
21378 exports2.PassThrough = require_stream_passthrough();
21383 // node_modules/unzipper/lib/PullStream.js
21384 var require_PullStream = __commonJS({
21385 "node_modules/unzipper/lib/PullStream.js"(exports2, module2) {
21386 var Stream2 = require("stream");
21387 var Promise2 = require_bluebird();
21388 var util = require("util");
21389 var Buffer2 = require_Buffer();
21390 var strFunction = "function";
21391 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
21392 Stream2 = require_readable();
21393 function PullStream() {
21394 if (!(this instanceof PullStream))
21395 return new PullStream();
21396 Stream2.Duplex.call(this, { decodeStrings: false, objectMode: true });
21397 this.buffer = Buffer2.from("");
21399 self2.on("finish", function() {
21400 self2.finished = true;
21401 self2.emit("chunk", false);
21404 util.inherits(PullStream, Stream2.Duplex);
21405 PullStream.prototype._write = function(chunk, e, cb) {
21406 this.buffer = Buffer2.concat([this.buffer, chunk]);
21408 this.emit("chunk");
21410 PullStream.prototype.stream = function(eof, includeEof) {
21411 var p = Stream2.PassThrough();
21412 var done, self2 = this;
21414 if (typeof self2.cb === strFunction) {
21415 var callback = self2.cb;
21422 if (self2.buffer && self2.buffer.length) {
21423 if (typeof eof === "number") {
21424 packet = self2.buffer.slice(0, eof);
21425 self2.buffer = self2.buffer.slice(eof);
21426 eof -= packet.length;
21429 var match = self2.buffer.indexOf(eof);
21430 if (match !== -1) {
21431 self2.match = match;
21433 match = match + eof.length;
21434 packet = self2.buffer.slice(0, match);
21435 self2.buffer = self2.buffer.slice(match);
21438 var len = self2.buffer.length - eof.length;
21442 packet = self2.buffer.slice(0, len);
21443 self2.buffer = self2.buffer.slice(len);
21448 p.write(packet, function() {
21449 if (self2.buffer.length === 0 || eof.length && self2.buffer.length <= eof.length)
21454 if (self2.finished && !this.__ended) {
21455 self2.removeListener("chunk", pull);
21456 self2.emit("error", new Error("FILE_ENDED"));
21457 this.__ended = true;
21461 self2.removeListener("chunk", pull);
21465 self2.on("chunk", pull);
21469 PullStream.prototype.pull = function(eof, includeEof) {
21471 return Promise2.resolve("");
21472 if (!isNaN(eof) && this.buffer.length > eof) {
21473 var data = this.buffer.slice(0, eof);
21474 this.buffer = this.buffer.slice(eof);
21475 return Promise2.resolve(data);
21477 var buffer = Buffer2.from(""), self2 = this;
21478 var concatStream = Stream2.Transform();
21479 concatStream._transform = function(d, e, cb) {
21480 buffer = Buffer2.concat([buffer, d]);
21484 var pullStreamRejectHandler;
21485 return new Promise2(function(resolve, reject) {
21486 rejectHandler = reject;
21487 pullStreamRejectHandler = function(e) {
21488 self2.__emittedError = e;
21491 if (self2.finished)
21492 return reject(new Error("FILE_ENDED"));
21493 self2.once("error", pullStreamRejectHandler);
21494 self2.stream(eof, includeEof).on("error", reject).pipe(concatStream).on("finish", function() {
21496 }).on("error", reject);
21497 }).finally(function() {
21498 self2.removeListener("error", rejectHandler);
21499 self2.removeListener("error", pullStreamRejectHandler);
21502 PullStream.prototype._read = function() {
21504 module2.exports = PullStream;
21508 // node_modules/unzipper/lib/NoopStream.js
21509 var require_NoopStream = __commonJS({
21510 "node_modules/unzipper/lib/NoopStream.js"(exports2, module2) {
21511 var Stream2 = require("stream");
21512 var util = require("util");
21513 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
21514 Stream2 = require_readable();
21515 function NoopStream() {
21516 if (!(this instanceof NoopStream)) {
21517 return new NoopStream();
21519 Stream2.Transform.call(this);
21521 util.inherits(NoopStream, Stream2.Transform);
21522 NoopStream.prototype._transform = function(d, e, cb) {
21525 module2.exports = NoopStream;
21529 // node_modules/unzipper/lib/BufferStream.js
21530 var require_BufferStream = __commonJS({
21531 "node_modules/unzipper/lib/BufferStream.js"(exports2, module2) {
21532 var Promise2 = require_bluebird();
21533 var Stream2 = require("stream");
21534 var Buffer2 = require_Buffer();
21535 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
21536 Stream2 = require_readable();
21537 module2.exports = function(entry) {
21538 return new Promise2(function(resolve, reject) {
21540 var bufferStream = Stream2.Transform().on("finish", function() {
21541 resolve(Buffer2.concat(chunks));
21542 }).on("error", reject);
21543 bufferStream._transform = function(d, e, cb) {
21547 entry.on("error", reject).pipe(bufferStream);
21553 // node_modules/unzipper/lib/parseExtraField.js
21554 var require_parseExtraField = __commonJS({
21555 "node_modules/unzipper/lib/parseExtraField.js"(exports2, module2) {
21556 var binary = require_binary();
21557 module2.exports = function(extraField, vars) {
21559 while (!extra && extraField && extraField.length) {
21560 var candidateExtra = binary.parse(extraField).word16lu("signature").word16lu("partsize").word64lu("uncompressedSize").word64lu("compressedSize").word64lu("offset").word64lu("disknum").vars;
21561 if (candidateExtra.signature === 1) {
21562 extra = candidateExtra;
21564 extraField = extraField.slice(candidateExtra.partsize + 4);
21567 extra = extra || {};
21568 if (vars.compressedSize === 4294967295)
21569 vars.compressedSize = extra.compressedSize;
21570 if (vars.uncompressedSize === 4294967295)
21571 vars.uncompressedSize = extra.uncompressedSize;
21572 if (vars.offsetToLocalFileHeader === 4294967295)
21573 vars.offsetToLocalFileHeader = extra.offset;
21579 // node_modules/unzipper/lib/parseDateTime.js
21580 var require_parseDateTime = __commonJS({
21581 "node_modules/unzipper/lib/parseDateTime.js"(exports2, module2) {
21582 module2.exports = function parseDateTime(date, time) {
21583 const day = date & 31;
21584 const month = date >> 5 & 15;
21585 const year = (date >> 9 & 127) + 1980;
21586 const seconds = time ? (time & 31) * 2 : 0;
21587 const minutes = time ? time >> 5 & 63 : 0;
21588 const hours = time ? time >> 11 : 0;
21589 return new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
21594 // node_modules/unzipper/lib/parse.js
21595 var require_parse3 = __commonJS({
21596 "node_modules/unzipper/lib/parse.js"(exports2, module2) {
21597 var util = require("util");
21598 var zlib2 = require("zlib");
21599 var Stream2 = require("stream");
21600 var binary = require_binary();
21601 var Promise2 = require_bluebird();
21602 var PullStream = require_PullStream();
21603 var NoopStream = require_NoopStream();
21604 var BufferStream = require_BufferStream();
21605 var parseExtraField = require_parseExtraField();
21606 var Buffer2 = require_Buffer();
21607 var parseDateTime = require_parseDateTime();
21608 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
21609 Stream2 = require_readable();
21610 var endDirectorySignature = Buffer2.alloc(4);
21611 endDirectorySignature.writeUInt32LE(101010256, 0);
21612 function Parse(opts) {
21613 if (!(this instanceof Parse)) {
21614 return new Parse(opts);
21617 self2._opts = opts || { verbose: false };
21618 PullStream.call(self2, self2._opts);
21619 self2.on("finish", function() {
21620 self2.emit("close");
21622 self2._readRecord().catch(function(e) {
21623 if (!self2.__emittedError || self2.__emittedError !== e)
21624 self2.emit("error", e);
21627 util.inherits(Parse, PullStream);
21628 Parse.prototype._readRecord = function() {
21630 return self2.pull(4).then(function(data) {
21631 if (data.length === 0)
21633 var signature = data.readUInt32LE(0);
21634 if (signature === 875721283) {
21635 return self2._readCrxHeader();
21637 if (signature === 67324752) {
21638 return self2._readFile();
21639 } else if (signature === 33639248) {
21640 self2.__ended = true;
21641 return self2._readCentralDirectoryFileHeader();
21642 } else if (signature === 101010256) {
21643 return self2._readEndOfCentralDirectoryRecord();
21644 } else if (self2.__ended) {
21645 return self2.pull(endDirectorySignature).then(function() {
21646 return self2._readEndOfCentralDirectoryRecord();
21649 self2.emit("error", new Error("invalid signature: 0x" + signature.toString(16)));
21652 Parse.prototype._readCrxHeader = function() {
21654 return self2.pull(12).then(function(data) {
21655 self2.crxHeader = binary.parse(data).word32lu("version").word32lu("pubKeyLength").word32lu("signatureLength").vars;
21656 return self2.pull(self2.crxHeader.pubKeyLength + self2.crxHeader.signatureLength);
21657 }).then(function(data) {
21658 self2.crxHeader.publicKey = data.slice(0, self2.crxHeader.pubKeyLength);
21659 self2.crxHeader.signature = data.slice(self2.crxHeader.pubKeyLength);
21660 self2.emit("crx-header", self2.crxHeader);
21661 return self2._readRecord();
21664 Parse.prototype._readFile = function() {
21666 return self2.pull(26).then(function(data) {
21667 var vars = binary.parse(data).word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;
21668 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
21669 if (self2.crxHeader)
21670 vars.crxHeader = self2.crxHeader;
21671 return self2.pull(vars.fileNameLength).then(function(fileNameBuffer) {
21672 var fileName = fileNameBuffer.toString("utf8");
21673 var entry = Stream2.PassThrough();
21674 var __autodraining = false;
21675 entry.autodrain = function() {
21676 __autodraining = true;
21677 var draining = entry.pipe(NoopStream());
21678 draining.promise = function() {
21679 return new Promise2(function(resolve, reject) {
21680 draining.on("finish", resolve);
21681 draining.on("error", reject);
21686 entry.buffer = function() {
21687 return BufferStream(entry);
21689 entry.path = fileName;
21691 entry.props.path = fileName;
21692 entry.props.pathBuffer = fileNameBuffer;
21693 entry.props.flags = {
21694 "isUnicode": vars.flags & 17
21696 entry.type = vars.uncompressedSize === 0 && /[\/\\]$/.test(fileName) ? "Directory" : "File";
21697 if (self2._opts.verbose) {
21698 if (entry.type === "Directory") {
21699 console.log(" creating:", fileName);
21700 } else if (entry.type === "File") {
21701 if (vars.compressionMethod === 0) {
21702 console.log(" extracting:", fileName);
21704 console.log(" inflating:", fileName);
21708 return self2.pull(vars.extraFieldLength).then(function(extraField) {
21709 var extra = parseExtraField(extraField, vars);
21711 entry.extra = extra;
21712 if (self2._opts.forceStream) {
21715 self2.emit("entry", entry);
21716 if (self2._readableState.pipesCount || self2._readableState.pipes && self2._readableState.pipes.length)
21719 if (self2._opts.verbose)
21721 filename: fileName,
21725 var fileSizeKnown = !(vars.flags & 8) || vars.compressedSize > 0, eof;
21726 entry.__autodraining = __autodraining;
21727 var inflater = vars.compressionMethod && !__autodraining ? zlib2.createInflateRaw() : Stream2.PassThrough();
21728 if (fileSizeKnown) {
21729 entry.size = vars.uncompressedSize;
21730 eof = vars.compressedSize;
21732 eof = Buffer2.alloc(4);
21733 eof.writeUInt32LE(134695760, 0);
21735 return new Promise2(function(resolve, reject) {
21736 self2.stream(eof).pipe(inflater).on("error", function(err) {
21737 self2.emit("error", err);
21738 }).pipe(entry).on("finish", function() {
21739 return fileSizeKnown ? self2._readRecord().then(resolve).catch(reject) : self2._processDataDescriptor(entry).then(resolve).catch(reject);
21746 Parse.prototype._processDataDescriptor = function(entry) {
21748 return self2.pull(16).then(function(data) {
21749 var vars = binary.parse(data).word32lu("dataDescriptorSignature").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").vars;
21750 entry.size = vars.uncompressedSize;
21751 return self2._readRecord();
21754 Parse.prototype._readCentralDirectoryFileHeader = function() {
21756 return self2.pull(42).then(function(data) {
21757 var vars = binary.parse(data).word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;
21758 return self2.pull(vars.fileNameLength).then(function(fileName) {
21759 vars.fileName = fileName.toString("utf8");
21760 return self2.pull(vars.extraFieldLength);
21761 }).then(function(extraField) {
21762 return self2.pull(vars.fileCommentLength);
21763 }).then(function(fileComment) {
21764 return self2._readRecord();
21768 Parse.prototype._readEndOfCentralDirectoryRecord = function() {
21770 return self2.pull(18).then(function(data) {
21771 var vars = binary.parse(data).word16lu("diskNumber").word16lu("diskStart").word16lu("numberOfRecordsOnDisk").word16lu("numberOfRecords").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;
21772 return self2.pull(vars.commentLength).then(function(comment) {
21773 comment = comment.toString("utf8");
21779 Parse.prototype.promise = function() {
21781 return new Promise2(function(resolve, reject) {
21782 self2.on("finish", resolve);
21783 self2.on("error", reject);
21786 module2.exports = Parse;
21790 // node_modules/duplexer2/index.js
21791 var require_duplexer2 = __commonJS({
21792 "node_modules/duplexer2/index.js"(exports2, module2) {
21794 var stream = require_readable();
21795 function DuplexWrapper(options, writable, readable) {
21796 if (typeof readable === "undefined") {
21797 readable = writable;
21798 writable = options;
21801 stream.Duplex.call(this, options);
21802 if (typeof readable.read !== "function") {
21803 readable = new stream.Readable(options).wrap(readable);
21805 this._writable = writable;
21806 this._readable = readable;
21807 this._waiting = false;
21809 writable.once("finish", function() {
21812 this.once("finish", function() {
21815 readable.on("readable", function() {
21816 if (self2._waiting) {
21817 self2._waiting = false;
21821 readable.once("end", function() {
21824 if (!options || typeof options.bubbleErrors === "undefined" || options.bubbleErrors) {
21825 writable.on("error", function(err) {
21826 self2.emit("error", err);
21828 readable.on("error", function(err) {
21829 self2.emit("error", err);
21833 DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, { constructor: { value: DuplexWrapper } });
21834 DuplexWrapper.prototype._write = function _write(input, encoding, done) {
21835 this._writable.write(input, encoding, done);
21837 DuplexWrapper.prototype._read = function _read() {
21840 while ((buf = this._readable.read()) !== null) {
21845 this._waiting = true;
21848 module2.exports = function duplex2(options, writable, readable) {
21849 return new DuplexWrapper(options, writable, readable);
21851 module2.exports.DuplexWrapper = DuplexWrapper;
21855 // node_modules/unzipper/lib/parseOne.js
21856 var require_parseOne = __commonJS({
21857 "node_modules/unzipper/lib/parseOne.js"(exports2, module2) {
21858 var Stream2 = require("stream");
21859 var Parse = require_parse3();
21860 var duplexer2 = require_duplexer2();
21861 var BufferStream = require_BufferStream();
21862 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
21863 Stream2 = require_readable();
21864 function parseOne(match, opts) {
21865 var inStream = Stream2.PassThrough({ objectMode: true });
21866 var outStream = Stream2.PassThrough();
21867 var transform = Stream2.Transform({ objectMode: true });
21868 var re = match instanceof RegExp ? match : match && new RegExp(match);
21870 transform._transform = function(entry, e, cb) {
21871 if (found || re && !re.exec(entry.path)) {
21876 out.emit("entry", entry);
21877 entry.on("error", function(e2) {
21878 outStream.emit("error", e2);
21880 entry.pipe(outStream).on("error", function(err) {
21882 }).on("finish", function(d) {
21887 inStream.pipe(Parse(opts)).on("error", function(err) {
21888 outStream.emit("error", err);
21889 }).pipe(transform).on("error", Object).on("finish", function() {
21891 outStream.emit("error", new Error("PATTERN_NOT_FOUND"));
21895 var out = duplexer2(inStream, outStream);
21896 out.buffer = function() {
21897 return BufferStream(outStream);
21901 module2.exports = parseOne;
21905 // node_modules/fstream/lib/abstract.js
21906 var require_abstract = __commonJS({
21907 "node_modules/fstream/lib/abstract.js"(exports2, module2) {
21908 module2.exports = Abstract;
21909 var Stream2 = require("stream").Stream;
21910 var inherits2 = require_inherits();
21911 function Abstract() {
21912 Stream2.call(this);
21914 inherits2(Abstract, Stream2);
21915 Abstract.prototype.on = function(ev, fn) {
21916 if (ev === "ready" && this.ready) {
21917 process.nextTick(fn.bind(this));
21919 Stream2.prototype.on.call(this, ev, fn);
21923 Abstract.prototype.abort = function() {
21924 this._aborted = true;
21925 this.emit("abort");
21927 Abstract.prototype.destroy = function() {
21929 Abstract.prototype.warn = function(msg, code) {
21931 var er = decorate(msg, code, self2);
21932 if (!self2.listeners("warn")) {
21933 console.error("%s %s\npath = %s\nsyscall = %s\nfstream_type = %s\nfstream_path = %s\nfstream_unc_path = %s\nfstream_class = %s\nfstream_stack =\n%s\n", code || "UNKNOWN", er.stack, er.path, er.syscall, er.fstream_type, er.fstream_path, er.fstream_unc_path, er.fstream_class, er.fstream_stack.join("\n"));
21935 self2.emit("warn", er);
21938 Abstract.prototype.info = function(msg, code) {
21939 this.emit("info", msg, code);
21941 Abstract.prototype.error = function(msg, code, th) {
21942 var er = decorate(msg, code, this);
21946 this.emit("error", er);
21948 function decorate(er, code, self2) {
21949 if (!(er instanceof Error))
21950 er = new Error(er);
21951 er.code = er.code || code;
21952 er.path = er.path || self2.path;
21953 er.fstream_type = er.fstream_type || self2.type;
21954 er.fstream_path = er.fstream_path || self2.path;
21955 if (self2._path !== self2.path) {
21956 er.fstream_unc_path = er.fstream_unc_path || self2._path;
21958 if (self2.linkpath) {
21959 er.fstream_linkpath = er.fstream_linkpath || self2.linkpath;
21961 er.fstream_class = er.fstream_class || self2.constructor.name;
21962 er.fstream_stack = er.fstream_stack || new Error().stack.split(/\n/).slice(3).map(function(s) {
21963 return s.replace(/^ {4}at /, "");
21970 // node_modules/graceful-fs/polyfills.js
21971 var require_polyfills = __commonJS({
21972 "node_modules/graceful-fs/polyfills.js"(exports2, module2) {
21973 var constants = require("constants");
21974 var origCwd = process.cwd;
21976 var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
21977 process.cwd = function() {
21979 cwd = origCwd.call(process);
21986 var chdir = process.chdir;
21987 process.chdir = function(d) {
21989 chdir.call(process, d);
21991 module2.exports = patch;
21992 function patch(fs2) {
21993 if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
21996 if (!fs2.lutimes) {
21999 fs2.chown = chownFix(fs2.chown);
22000 fs2.fchown = chownFix(fs2.fchown);
22001 fs2.lchown = chownFix(fs2.lchown);
22002 fs2.chmod = chmodFix(fs2.chmod);
22003 fs2.fchmod = chmodFix(fs2.fchmod);
22004 fs2.lchmod = chmodFix(fs2.lchmod);
22005 fs2.chownSync = chownFixSync(fs2.chownSync);
22006 fs2.fchownSync = chownFixSync(fs2.fchownSync);
22007 fs2.lchownSync = chownFixSync(fs2.lchownSync);
22008 fs2.chmodSync = chmodFixSync(fs2.chmodSync);
22009 fs2.fchmodSync = chmodFixSync(fs2.fchmodSync);
22010 fs2.lchmodSync = chmodFixSync(fs2.lchmodSync);
22011 fs2.stat = statFix(fs2.stat);
22012 fs2.fstat = statFix(fs2.fstat);
22013 fs2.lstat = statFix(fs2.lstat);
22014 fs2.statSync = statFixSync(fs2.statSync);
22015 fs2.fstatSync = statFixSync(fs2.fstatSync);
22016 fs2.lstatSync = statFixSync(fs2.lstatSync);
22018 fs2.lchmod = function(path2, mode, cb) {
22020 process.nextTick(cb);
22022 fs2.lchmodSync = function() {
22026 fs2.lchown = function(path2, uid, gid, cb) {
22028 process.nextTick(cb);
22030 fs2.lchownSync = function() {
22033 if (platform === "win32") {
22034 fs2.rename = function(fs$rename) {
22035 return function(from, to, cb) {
22036 var start = Date.now();
22038 fs$rename(from, to, function CB(er) {
22039 if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
22040 setTimeout(function() {
22041 fs2.stat(to, function(stater, st) {
22042 if (stater && stater.code === "ENOENT")
22043 fs$rename(from, to, CB);
22058 fs2.read = function(fs$read) {
22059 function read(fd, buffer, offset, length, position, callback_) {
22061 if (callback_ && typeof callback_ === "function") {
22062 var eagCounter = 0;
22063 callback = function(er, _, __) {
22064 if (er && er.code === "EAGAIN" && eagCounter < 10) {
22066 return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
22068 callback_.apply(this, arguments);
22071 return fs$read.call(fs2, fd, buffer, offset, length, position, callback);
22073 read.__proto__ = fs$read;
22076 fs2.readSync = function(fs$readSync) {
22077 return function(fd, buffer, offset, length, position) {
22078 var eagCounter = 0;
22081 return fs$readSync.call(fs2, fd, buffer, offset, length, position);
22083 if (er.code === "EAGAIN" && eagCounter < 10) {
22092 function patchLchmod(fs3) {
22093 fs3.lchmod = function(path2, mode, callback) {
22094 fs3.open(path2, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
22100 fs3.fchmod(fd, mode, function(err2) {
22101 fs3.close(fd, function(err22) {
22103 callback(err2 || err22);
22108 fs3.lchmodSync = function(path2, mode) {
22109 var fd = fs3.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode);
22113 ret2 = fs3.fchmodSync(fd, mode);
22128 function patchLutimes(fs3) {
22129 if (constants.hasOwnProperty("O_SYMLINK")) {
22130 fs3.lutimes = function(path2, at, mt, cb) {
22131 fs3.open(path2, constants.O_SYMLINK, function(er, fd) {
22137 fs3.futimes(fd, at, mt, function(er2) {
22138 fs3.close(fd, function(er22) {
22145 fs3.lutimesSync = function(path2, at, mt) {
22146 var fd = fs3.openSync(path2, constants.O_SYMLINK);
22150 ret2 = fs3.futimesSync(fd, at, mt);
22165 fs3.lutimes = function(_a, _b, _c, cb) {
22167 process.nextTick(cb);
22169 fs3.lutimesSync = function() {
22173 function chmodFix(orig) {
22176 return function(target, mode, cb) {
22177 return orig.call(fs2, target, mode, function(er) {
22181 cb.apply(this, arguments);
22185 function chmodFixSync(orig) {
22188 return function(target, mode) {
22190 return orig.call(fs2, target, mode);
22192 if (!chownErOk(er))
22197 function chownFix(orig) {
22200 return function(target, uid, gid, cb) {
22201 return orig.call(fs2, target, uid, gid, function(er) {
22205 cb.apply(this, arguments);
22209 function chownFixSync(orig) {
22212 return function(target, uid, gid) {
22214 return orig.call(fs2, target, uid, gid);
22216 if (!chownErOk(er))
22221 function statFix(orig) {
22224 return function(target, options, cb) {
22225 if (typeof options === "function") {
22229 function callback(er, stats) {
22232 stats.uid += 4294967296;
22234 stats.gid += 4294967296;
22237 cb.apply(this, arguments);
22239 return options ? orig.call(fs2, target, options, callback) : orig.call(fs2, target, callback);
22242 function statFixSync(orig) {
22245 return function(target, options) {
22246 var stats = options ? orig.call(fs2, target, options) : orig.call(fs2, target);
22248 stats.uid += 4294967296;
22250 stats.gid += 4294967296;
22254 function chownErOk(er) {
22257 if (er.code === "ENOSYS")
22259 var nonroot = !process.getuid || process.getuid() !== 0;
22261 if (er.code === "EINVAL" || er.code === "EPERM")
22270 // node_modules/graceful-fs/legacy-streams.js
22271 var require_legacy_streams = __commonJS({
22272 "node_modules/graceful-fs/legacy-streams.js"(exports2, module2) {
22273 var Stream2 = require("stream").Stream;
22274 module2.exports = legacy;
22275 function legacy(fs2) {
22280 function ReadStream(path2, options) {
22281 if (!(this instanceof ReadStream))
22282 return new ReadStream(path2, options);
22283 Stream2.call(this);
22287 this.readable = true;
22288 this.paused = false;
22291 this.bufferSize = 64 * 1024;
22292 options = options || {};
22293 var keys = Object.keys(options);
22294 for (var index = 0, length = keys.length; index < length; index++) {
22295 var key = keys[index];
22296 this[key] = options[key];
22299 this.setEncoding(this.encoding);
22300 if (this.start !== void 0) {
22301 if (typeof this.start !== "number") {
22302 throw TypeError("start must be a Number");
22304 if (this.end === void 0) {
22305 this.end = Infinity;
22306 } else if (typeof this.end !== "number") {
22307 throw TypeError("end must be a Number");
22309 if (this.start > this.end) {
22310 throw new Error("start must be <= end");
22312 this.pos = this.start;
22314 if (this.fd !== null) {
22315 process.nextTick(function() {
22320 fs2.open(this.path, this.flags, this.mode, function(err, fd) {
22322 self2.emit("error", err);
22323 self2.readable = false;
22327 self2.emit("open", fd);
22331 function WriteStream(path2, options) {
22332 if (!(this instanceof WriteStream))
22333 return new WriteStream(path2, options);
22334 Stream2.call(this);
22337 this.writable = true;
22339 this.encoding = "binary";
22341 this.bytesWritten = 0;
22342 options = options || {};
22343 var keys = Object.keys(options);
22344 for (var index = 0, length = keys.length; index < length; index++) {
22345 var key = keys[index];
22346 this[key] = options[key];
22348 if (this.start !== void 0) {
22349 if (typeof this.start !== "number") {
22350 throw TypeError("start must be a Number");
22352 if (this.start < 0) {
22353 throw new Error("start must be >= zero");
22355 this.pos = this.start;
22359 if (this.fd === null) {
22360 this._open = fs2.open;
22361 this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
22369 // node_modules/graceful-fs/clone.js
22370 var require_clone = __commonJS({
22371 "node_modules/graceful-fs/clone.js"(exports2, module2) {
22373 module2.exports = clone2;
22374 function clone2(obj2) {
22375 if (obj2 === null || typeof obj2 !== "object")
22377 if (obj2 instanceof Object)
22378 var copy = { __proto__: obj2.__proto__ };
22380 var copy = Object.create(null);
22381 Object.getOwnPropertyNames(obj2).forEach(function(key) {
22382 Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj2, key));
22389 // node_modules/graceful-fs/graceful-fs.js
22390 var require_graceful_fs = __commonJS({
22391 "node_modules/graceful-fs/graceful-fs.js"(exports2, module2) {
22392 var fs2 = require("fs");
22393 var polyfills = require_polyfills();
22394 var legacy = require_legacy_streams();
22395 var clone2 = require_clone();
22396 var util = require("util");
22398 var previousSymbol;
22399 if (typeof Symbol === "function" && typeof Symbol.for === "function") {
22400 gracefulQueue = Symbol.for("graceful-fs.queue");
22401 previousSymbol = Symbol.for("graceful-fs.previous");
22403 gracefulQueue = "___graceful-fs.queue";
22404 previousSymbol = "___graceful-fs.previous";
22408 function publishQueue(context, queue2) {
22409 Object.defineProperty(context, gracefulQueue, {
22417 debug = util.debuglog("gfs4");
22418 else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
22419 debug = function() {
22420 var m = util.format.apply(util, arguments);
22421 m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
22424 if (!fs2[gracefulQueue]) {
22425 queue = global[gracefulQueue] || [];
22426 publishQueue(fs2, queue);
22427 fs2.close = function(fs$close) {
22428 function close(fd, cb) {
22429 return fs$close.call(fs2, fd, function(err) {
22433 if (typeof cb === "function")
22434 cb.apply(this, arguments);
22437 Object.defineProperty(close, previousSymbol, {
22442 fs2.closeSync = function(fs$closeSync) {
22443 function closeSync(fd) {
22444 fs$closeSync.apply(fs2, arguments);
22447 Object.defineProperty(closeSync, previousSymbol, {
22448 value: fs$closeSync
22452 if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
22453 process.on("exit", function() {
22454 debug(fs2[gracefulQueue]);
22455 require("assert").equal(fs2[gracefulQueue].length, 0);
22460 if (!global[gracefulQueue]) {
22461 publishQueue(global, fs2[gracefulQueue]);
22463 module2.exports = patch(clone2(fs2));
22464 if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs2.__patched) {
22465 module2.exports = patch(fs2);
22466 fs2.__patched = true;
22468 function patch(fs3) {
22470 fs3.gracefulify = patch;
22471 fs3.createReadStream = createReadStream;
22472 fs3.createWriteStream = createWriteStream;
22473 var fs$readFile = fs3.readFile;
22474 fs3.readFile = readFile;
22475 function readFile(path2, options, cb) {
22476 if (typeof options === "function")
22477 cb = options, options = null;
22478 return go$readFile(path2, options, cb);
22479 function go$readFile(path3, options2, cb2) {
22480 return fs$readFile(path3, options2, function(err) {
22481 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
22482 enqueue([go$readFile, [path3, options2, cb2]]);
22484 if (typeof cb2 === "function")
22485 cb2.apply(this, arguments);
22491 var fs$writeFile = fs3.writeFile;
22492 fs3.writeFile = writeFile;
22493 function writeFile(path2, data, options, cb) {
22494 if (typeof options === "function")
22495 cb = options, options = null;
22496 return go$writeFile(path2, data, options, cb);
22497 function go$writeFile(path3, data2, options2, cb2) {
22498 return fs$writeFile(path3, data2, options2, function(err) {
22499 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
22500 enqueue([go$writeFile, [path3, data2, options2, cb2]]);
22502 if (typeof cb2 === "function")
22503 cb2.apply(this, arguments);
22509 var fs$appendFile = fs3.appendFile;
22511 fs3.appendFile = appendFile;
22512 function appendFile(path2, data, options, cb) {
22513 if (typeof options === "function")
22514 cb = options, options = null;
22515 return go$appendFile(path2, data, options, cb);
22516 function go$appendFile(path3, data2, options2, cb2) {
22517 return fs$appendFile(path3, data2, options2, function(err) {
22518 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
22519 enqueue([go$appendFile, [path3, data2, options2, cb2]]);
22521 if (typeof cb2 === "function")
22522 cb2.apply(this, arguments);
22528 var fs$readdir = fs3.readdir;
22529 fs3.readdir = readdir;
22530 function readdir(path2, options, cb) {
22531 var args = [path2];
22532 if (typeof options !== "function") {
22533 args.push(options);
22537 args.push(go$readdir$cb);
22538 return go$readdir(args);
22539 function go$readdir$cb(err, files) {
22540 if (files && files.sort)
22542 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
22543 enqueue([go$readdir, [args]]);
22545 if (typeof cb === "function")
22546 cb.apply(this, arguments);
22551 function go$readdir(args) {
22552 return fs$readdir.apply(fs3, args);
22554 if (process.version.substr(0, 4) === "v0.8") {
22555 var legStreams = legacy(fs3);
22556 ReadStream = legStreams.ReadStream;
22557 WriteStream = legStreams.WriteStream;
22559 var fs$ReadStream = fs3.ReadStream;
22560 if (fs$ReadStream) {
22561 ReadStream.prototype = Object.create(fs$ReadStream.prototype);
22562 ReadStream.prototype.open = ReadStream$open;
22564 var fs$WriteStream = fs3.WriteStream;
22565 if (fs$WriteStream) {
22566 WriteStream.prototype = Object.create(fs$WriteStream.prototype);
22567 WriteStream.prototype.open = WriteStream$open;
22569 Object.defineProperty(fs3, "ReadStream", {
22573 set: function(val) {
22579 Object.defineProperty(fs3, "WriteStream", {
22581 return WriteStream;
22583 set: function(val) {
22589 var FileReadStream = ReadStream;
22590 Object.defineProperty(fs3, "FileReadStream", {
22592 return FileReadStream;
22594 set: function(val) {
22595 FileReadStream = val;
22600 var FileWriteStream = WriteStream;
22601 Object.defineProperty(fs3, "FileWriteStream", {
22603 return FileWriteStream;
22605 set: function(val) {
22606 FileWriteStream = val;
22611 function ReadStream(path2, options) {
22612 if (this instanceof ReadStream)
22613 return fs$ReadStream.apply(this, arguments), this;
22615 return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
22617 function ReadStream$open() {
22619 open(that.path, that.flags, that.mode, function(err, fd) {
22621 if (that.autoClose)
22623 that.emit("error", err);
22626 that.emit("open", fd);
22631 function WriteStream(path2, options) {
22632 if (this instanceof WriteStream)
22633 return fs$WriteStream.apply(this, arguments), this;
22635 return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
22637 function WriteStream$open() {
22639 open(that.path, that.flags, that.mode, function(err, fd) {
22642 that.emit("error", err);
22645 that.emit("open", fd);
22649 function createReadStream(path2, options) {
22650 return new fs3.ReadStream(path2, options);
22652 function createWriteStream(path2, options) {
22653 return new fs3.WriteStream(path2, options);
22655 var fs$open = fs3.open;
22657 function open(path2, flags, mode, cb) {
22658 if (typeof mode === "function")
22659 cb = mode, mode = null;
22660 return go$open(path2, flags, mode, cb);
22661 function go$open(path3, flags2, mode2, cb2) {
22662 return fs$open(path3, flags2, mode2, function(err, fd) {
22663 if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
22664 enqueue([go$open, [path3, flags2, mode2, cb2]]);
22666 if (typeof cb2 === "function")
22667 cb2.apply(this, arguments);
22675 function enqueue(elem) {
22676 debug("ENQUEUE", elem[0].name, elem[1]);
22677 fs2[gracefulQueue].push(elem);
22680 var elem = fs2[gracefulQueue].shift();
22682 debug("RETRY", elem[0].name, elem[1]);
22683 elem[0].apply(null, elem[1]);
22689 // node_modules/fstream/lib/get-type.js
22690 var require_get_type = __commonJS({
22691 "node_modules/fstream/lib/get-type.js"(exports2, module2) {
22692 module2.exports = getType;
22693 function getType(st) {
22705 if (st.type && types.indexOf(st.type) !== -1) {
22706 st[st.type] = true;
22709 for (var i = 0, l2 = types.length; i < l2; i++) {
22711 var is = st[type] || st["is" + type];
22712 if (typeof is === "function")
22725 // node_modules/fstream/lib/link-reader.js
22726 var require_link_reader = __commonJS({
22727 "node_modules/fstream/lib/link-reader.js"(exports2, module2) {
22728 module2.exports = LinkReader;
22729 var fs2 = require_graceful_fs();
22730 var inherits2 = require_inherits();
22731 var Reader = require_reader();
22732 inherits2(LinkReader, Reader);
22733 function LinkReader(props) {
22735 if (!(self2 instanceof LinkReader)) {
22736 throw new Error("LinkReader must be called as constructor.");
22738 if (!(props.type === "Link" && props.Link || props.type === "SymbolicLink" && props.SymbolicLink)) {
22739 throw new Error("Non-link type " + props.type);
22741 Reader.call(self2, props);
22743 LinkReader.prototype._stat = function(currentStat) {
22745 fs2.readlink(self2._path, function(er, linkpath) {
22747 return self2.error(er);
22748 self2.linkpath = self2.props.linkpath = linkpath;
22749 self2.emit("linkpath", linkpath);
22750 Reader.prototype._stat.call(self2, currentStat);
22753 LinkReader.prototype._read = function() {
22757 if (!self2._ended) {
22759 self2.emit("close");
22760 self2._ended = true;
22766 // node_modules/fstream/lib/dir-reader.js
22767 var require_dir_reader = __commonJS({
22768 "node_modules/fstream/lib/dir-reader.js"(exports2, module2) {
22769 module2.exports = DirReader;
22770 var fs2 = require_graceful_fs();
22771 var inherits2 = require_inherits();
22772 var path2 = require("path");
22773 var Reader = require_reader();
22774 var assert = require("assert").ok;
22775 inherits2(DirReader, Reader);
22776 function DirReader(props) {
22778 if (!(self2 instanceof DirReader)) {
22779 throw new Error("DirReader must be called as constructor.");
22781 if (props.type !== "Directory" || !props.Directory) {
22782 throw new Error("Non-directory type " + props.type);
22784 self2.entries = null;
22786 self2._paused = false;
22787 self2._length = -1;
22789 this.sort = props.sort;
22791 Reader.call(this, props);
22793 DirReader.prototype._getEntries = function() {
22795 if (self2._gotEntries)
22797 self2._gotEntries = true;
22798 fs2.readdir(self2._path, function(er, entries) {
22800 return self2.error(er);
22801 self2.entries = entries;
22802 self2.emit("entries", entries);
22804 self2.once("resume", processEntries);
22807 function processEntries() {
22808 self2._length = self2.entries.length;
22809 if (typeof self2.sort === "function") {
22810 self2.entries = self2.entries.sort(self2.sort.bind(self2));
22816 DirReader.prototype._read = function() {
22818 if (!self2.entries)
22819 return self2._getEntries();
22820 if (self2._paused || self2._currentEntry || self2._aborted) {
22824 if (self2._index >= self2.entries.length) {
22825 if (!self2._ended) {
22826 self2._ended = true;
22828 self2.emit("close");
22832 var p = path2.resolve(self2._path, self2.entries[self2._index]);
22833 assert(p !== self2._path);
22834 assert(self2.entries[self2._index]);
22835 self2._currentEntry = p;
22836 fs2[self2.props.follow ? "stat" : "lstat"](p, function(er, stat) {
22838 return self2.error(er);
22839 var who = self2._proxy || self2;
22841 stat.basename = path2.basename(p);
22842 stat.dirname = path2.dirname(p);
22843 var childProps = self2.getChildProps.call(who, stat);
22844 childProps.path = p;
22845 childProps.basename = path2.basename(p);
22846 childProps.dirname = path2.dirname(p);
22847 var entry = Reader(childProps, stat);
22848 self2._currentEntry = entry;
22849 entry.on("pause", function(who2) {
22850 if (!self2._paused && !entry._disowned) {
22854 entry.on("resume", function(who2) {
22855 if (self2._paused && !entry._disowned) {
22856 self2.resume(who2);
22859 entry.on("stat", function(props) {
22860 self2.emit("_entryStat", entry, props);
22861 if (entry._aborted)
22863 if (entry._paused) {
22864 entry.once("resume", function() {
22865 self2.emit("entryStat", entry, props);
22868 self2.emit("entryStat", entry, props);
22870 entry.on("ready", function EMITCHILD() {
22871 if (self2._paused) {
22872 entry.pause(self2);
22873 return self2.once("resume", EMITCHILD);
22875 if (entry.type === "Socket") {
22876 self2.emit("socket", entry);
22878 self2.emitEntry(entry);
22882 entry.on("close", onend);
22883 entry.on("disown", onend);
22888 self2.emit("childEnd", entry);
22889 self2.emit("entryEnd", entry);
22890 self2._currentEntry = null;
22891 if (!self2._paused) {
22895 entry.on("error", function(er2) {
22896 if (entry._swallowErrors) {
22899 entry.emit("close");
22901 self2.emit("error", er2);
22908 ].forEach(function(ev) {
22909 entry.on(ev, self2.emit.bind(self2, ev));
22913 DirReader.prototype.disown = function(entry) {
22914 entry.emit("beforeDisown");
22915 entry._disowned = true;
22916 entry.parent = entry.root = null;
22917 if (entry === this._currentEntry) {
22918 this._currentEntry = null;
22920 entry.emit("disown");
22922 DirReader.prototype.getChildProps = function() {
22924 depth: this.depth + 1,
22925 root: this.root || this,
22927 follow: this.follow,
22928 filter: this.filter,
22929 sort: this.props.sort,
22930 hardlinks: this.props.hardlinks
22933 DirReader.prototype.pause = function(who) {
22937 who = who || self2;
22938 self2._paused = true;
22939 if (self2._currentEntry && self2._currentEntry.pause) {
22940 self2._currentEntry.pause(who);
22942 self2.emit("pause", who);
22944 DirReader.prototype.resume = function(who) {
22946 if (!self2._paused)
22948 who = who || self2;
22949 self2._paused = false;
22950 self2.emit("resume", who);
22951 if (self2._paused) {
22954 if (self2._currentEntry) {
22955 if (self2._currentEntry.resume)
22956 self2._currentEntry.resume(who);
22960 DirReader.prototype.emitEntry = function(entry) {
22961 this.emit("entry", entry);
22962 this.emit("child", entry);
22967 // node_modules/fstream/lib/file-reader.js
22968 var require_file_reader = __commonJS({
22969 "node_modules/fstream/lib/file-reader.js"(exports2, module2) {
22970 module2.exports = FileReader;
22971 var fs2 = require_graceful_fs();
22972 var inherits2 = require_inherits();
22973 var Reader = require_reader();
22974 var EOF = { EOF: true };
22975 var CLOSE = { CLOSE: true };
22976 inherits2(FileReader, Reader);
22977 function FileReader(props) {
22979 if (!(self2 instanceof FileReader)) {
22980 throw new Error("FileReader must be called as constructor.");
22982 if (!(props.type === "Link" && props.Link || props.type === "File" && props.File)) {
22983 throw new Error("Non-file type " + props.type);
22985 self2._buffer = [];
22986 self2._bytesEmitted = 0;
22987 Reader.call(self2, props);
22989 FileReader.prototype._getStream = function() {
22991 var stream = self2._stream = fs2.createReadStream(self2._path, self2.props);
22992 if (self2.props.blksize) {
22993 stream.bufferSize = self2.props.blksize;
22995 stream.on("open", self2.emit.bind(self2, "open"));
22996 stream.on("data", function(c) {
22997 self2._bytesEmitted += c.length;
23000 } else if (self2._paused || self2._buffer.length) {
23001 self2._buffer.push(c);
23004 self2.emit("data", c);
23006 stream.on("end", function() {
23007 if (self2._paused || self2._buffer.length) {
23008 self2._buffer.push(EOF);
23013 if (self2._bytesEmitted !== self2.props.size) {
23014 self2.error("Didn't get expected byte count\nexpect: " + self2.props.size + "\nactual: " + self2._bytesEmitted);
23017 stream.on("close", function() {
23018 if (self2._paused || self2._buffer.length) {
23019 self2._buffer.push(CLOSE);
23022 self2.emit("close");
23025 stream.on("error", function(e) {
23026 self2.emit("error", e);
23030 FileReader.prototype._read = function() {
23032 if (self2._paused) {
23035 if (!self2._stream) {
23036 return self2._getStream();
23038 if (self2._buffer.length) {
23039 var buf = self2._buffer;
23040 for (var i = 0, l2 = buf.length; i < l2; i++) {
23044 } else if (c === CLOSE) {
23045 self2.emit("close");
23047 self2.emit("data", c);
23049 if (self2._paused) {
23050 self2._buffer = buf.slice(i);
23054 self2._buffer.length = 0;
23057 FileReader.prototype.pause = function(who) {
23061 who = who || self2;
23062 self2._paused = true;
23064 self2._stream.pause();
23065 self2.emit("pause", who);
23067 FileReader.prototype.resume = function(who) {
23069 if (!self2._paused)
23071 who = who || self2;
23072 self2.emit("resume", who);
23073 self2._paused = false;
23075 self2._stream.resume();
23081 // node_modules/fstream/lib/socket-reader.js
23082 var require_socket_reader = __commonJS({
23083 "node_modules/fstream/lib/socket-reader.js"(exports2, module2) {
23084 module2.exports = SocketReader;
23085 var inherits2 = require_inherits();
23086 var Reader = require_reader();
23087 inherits2(SocketReader, Reader);
23088 function SocketReader(props) {
23090 if (!(self2 instanceof SocketReader)) {
23091 throw new Error("SocketReader must be called as constructor.");
23093 if (!(props.type === "Socket" && props.Socket)) {
23094 throw new Error("Non-socket type " + props.type);
23096 Reader.call(self2, props);
23098 SocketReader.prototype._read = function() {
23102 if (!self2._ended) {
23104 self2.emit("close");
23105 self2._ended = true;
23111 // node_modules/fstream/lib/proxy-reader.js
23112 var require_proxy_reader = __commonJS({
23113 "node_modules/fstream/lib/proxy-reader.js"(exports2, module2) {
23114 module2.exports = ProxyReader;
23115 var Reader = require_reader();
23116 var getType = require_get_type();
23117 var inherits2 = require_inherits();
23118 var fs2 = require_graceful_fs();
23119 inherits2(ProxyReader, Reader);
23120 function ProxyReader(props) {
23122 if (!(self2 instanceof ProxyReader)) {
23123 throw new Error("ProxyReader must be called as constructor.");
23125 self2.props = props;
23126 self2._buffer = [];
23127 self2.ready = false;
23128 Reader.call(self2, props);
23130 ProxyReader.prototype._stat = function() {
23132 var props = self2.props;
23133 var stat = props.follow ? "stat" : "lstat";
23134 fs2[stat](props.path, function(er, current) {
23136 if (er || !current) {
23139 type = getType(current);
23141 props[type] = true;
23142 props.type = self2.type = type;
23143 self2._old = current;
23144 self2._addProxy(Reader(props, current));
23147 ProxyReader.prototype._addProxy = function(proxy) {
23149 if (self2._proxyTarget) {
23150 return self2.error("proxy already set");
23152 self2._proxyTarget = proxy;
23153 proxy._proxy = self2;
23166 ].forEach(function(ev) {
23167 proxy.on(ev, self2.emit.bind(self2, ev));
23169 self2.emit("proxy", proxy);
23170 proxy.on("ready", function() {
23171 self2.ready = true;
23172 self2.emit("ready");
23174 var calls = self2._buffer;
23175 self2._buffer.length = 0;
23176 calls.forEach(function(c) {
23177 proxy[c[0]].apply(proxy, c[1]);
23180 ProxyReader.prototype.pause = function() {
23181 return this._proxyTarget ? this._proxyTarget.pause() : false;
23183 ProxyReader.prototype.resume = function() {
23184 return this._proxyTarget ? this._proxyTarget.resume() : false;
23189 // node_modules/fstream/lib/reader.js
23190 var require_reader = __commonJS({
23191 "node_modules/fstream/lib/reader.js"(exports2, module2) {
23192 module2.exports = Reader;
23193 var fs2 = require_graceful_fs();
23194 var Stream2 = require("stream").Stream;
23195 var inherits2 = require_inherits();
23196 var path2 = require("path");
23197 var getType = require_get_type();
23198 var hardLinks = Reader.hardLinks = {};
23199 var Abstract = require_abstract();
23200 inherits2(Reader, Abstract);
23201 var LinkReader = require_link_reader();
23202 function Reader(props, currentStat) {
23204 if (!(self2 instanceof Reader))
23205 return new Reader(props, currentStat);
23206 if (typeof props === "string") {
23207 props = { path: props };
23211 if (props.type && typeof props.type === "function") {
23215 type = getType(props);
23216 ClassType = Reader;
23218 if (currentStat && !type) {
23219 type = getType(currentStat);
23220 props[type] = true;
23225 ClassType = require_dir_reader();
23229 ClassType = require_file_reader();
23231 case "SymbolicLink":
23232 ClassType = LinkReader;
23235 ClassType = require_socket_reader();
23238 ClassType = require_proxy_reader();
23241 if (!(self2 instanceof ClassType)) {
23242 return new ClassType(props);
23244 Abstract.call(self2);
23246 self2.error("Must provide a path", null, true);
23248 self2.readable = true;
23249 self2.writable = false;
23251 self2.props = props;
23252 self2.depth = props.depth = props.depth || 0;
23253 self2.parent = props.parent || null;
23254 self2.root = props.root || props.parent && props.parent.root || self2;
23255 self2._path = self2.path = path2.resolve(props.path);
23256 if (process.platform === "win32") {
23257 self2.path = self2._path = self2.path.replace(/\?/g, "_");
23258 if (self2._path.length >= 260) {
23259 self2._swallowErrors = true;
23260 self2._path = "\\\\?\\" + self2.path.replace(/\//g, "\\");
23263 self2.basename = props.basename = path2.basename(self2.path);
23264 self2.dirname = props.dirname = path2.dirname(self2.path);
23265 props.parent = props.root = null;
23266 self2.size = props.size;
23267 self2.filter = typeof props.filter === "function" ? props.filter : null;
23268 if (props.sort === "alpha")
23269 props.sort = alphasort;
23270 self2._stat(currentStat);
23272 function alphasort(a, b) {
23273 return a === b ? 0 : a.toLowerCase() > b.toLowerCase() ? 1 : a.toLowerCase() < b.toLowerCase() ? -1 : a > b ? 1 : -1;
23275 Reader.prototype._stat = function(currentStat) {
23277 var props = self2.props;
23278 var stat = props.follow ? "stat" : "lstat";
23280 process.nextTick(statCb.bind(null, null, currentStat));
23282 fs2[stat](self2._path, statCb);
23283 function statCb(er, props_) {
23285 return self2.error(er);
23286 Object.keys(props_).forEach(function(k2) {
23287 props[k2] = props_[k2];
23289 if (self2.size !== void 0 && props.size !== self2.size) {
23290 return self2.error("incorrect size");
23292 self2.size = props.size;
23293 var type = getType(props);
23294 var handleHardlinks = props.hardlinks !== false;
23295 if (handleHardlinks && type !== "Directory" && props.nlink && props.nlink > 1) {
23296 var k = props.dev + ":" + props.ino;
23297 if (hardLinks[k] === self2._path || !hardLinks[k]) {
23298 hardLinks[k] = self2._path;
23300 type = self2.type = self2.props.type = "Link";
23301 self2.Link = self2.props.Link = true;
23302 self2.linkpath = self2.props.linkpath = hardLinks[k];
23303 self2._stat = self2._read = LinkReader.prototype._read;
23306 if (self2.type && self2.type !== type) {
23307 self2.error("Unexpected type: " + type);
23309 if (self2.filter) {
23310 var who = self2._proxy || self2;
23311 if (!self2.filter.call(who, who, props)) {
23312 if (!self2._disowned) {
23315 self2.emit("close");
23320 var events = ["_stat", "stat", "ready"];
23323 if (self2._aborted) {
23325 self2.emit("close");
23328 if (self2._paused && self2.type !== "Directory") {
23329 self2.once("resume", go);
23332 var ev = events[e++];
23334 return self2._read();
23336 self2.emit(ev, props);
23341 Reader.prototype.pipe = function(dest) {
23343 if (typeof dest.add === "function") {
23344 self2.on("entry", function(entry) {
23345 var ret2 = dest.add(entry);
23346 if (ret2 === false) {
23351 return Stream2.prototype.pipe.apply(this, arguments);
23353 Reader.prototype.pause = function(who) {
23354 this._paused = true;
23356 this.emit("pause", who);
23358 this._stream.pause(who);
23360 Reader.prototype.resume = function(who) {
23361 this._paused = false;
23363 this.emit("resume", who);
23365 this._stream.resume(who);
23368 Reader.prototype._read = function() {
23369 this.error("Cannot read unknown type: " + this.type);
23374 // node_modules/fstream/node_modules/rimraf/rimraf.js
23375 var require_rimraf2 = __commonJS({
23376 "node_modules/fstream/node_modules/rimraf/rimraf.js"(exports2, module2) {
23377 module2.exports = rimraf;
23378 rimraf.sync = rimrafSync;
23379 var assert = require("assert");
23380 var path2 = require("path");
23381 var fs2 = require("fs");
23384 glob = require_glob();
23387 var _0666 = parseInt("666", 8);
23388 var defaultGlobOpts = {
23393 var isWindows = process.platform === "win32";
23394 function defaults(options) {
23403 methods.forEach(function(m) {
23404 options[m] = options[m] || fs2[m];
23406 options[m] = options[m] || fs2[m];
23408 options.maxBusyTries = options.maxBusyTries || 3;
23409 options.emfileWait = options.emfileWait || 1e3;
23410 if (options.glob === false) {
23411 options.disableGlob = true;
23413 if (options.disableGlob !== true && glob === void 0) {
23414 throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
23416 options.disableGlob = options.disableGlob || false;
23417 options.glob = options.glob || defaultGlobOpts;
23419 function rimraf(p, options, cb) {
23420 if (typeof options === "function") {
23424 assert(p, "rimraf: missing path");
23425 assert.equal(typeof p, "string", "rimraf: path should be a string");
23426 assert.equal(typeof cb, "function", "rimraf: callback function required");
23427 assert(options, "rimraf: invalid options argument provided");
23428 assert.equal(typeof options, "object", "rimraf: options should be object");
23431 var errState = null;
23433 if (options.disableGlob || !glob.hasMagic(p))
23434 return afterGlob(null, [p]);
23435 options.lstat(p, function(er, stat) {
23437 return afterGlob(null, [p]);
23438 glob(p, options.glob, afterGlob);
23440 function next(er) {
23441 errState = errState || er;
23445 function afterGlob(er, results2) {
23448 n = results2.length;
23451 results2.forEach(function(p2) {
23452 rimraf_(p2, options, function CB(er2) {
23454 if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
23456 var time = busyTries * 100;
23457 return setTimeout(function() {
23458 rimraf_(p2, options, CB);
23461 if (er2.code === "EMFILE" && timeout < options.emfileWait) {
23462 return setTimeout(function() {
23463 rimraf_(p2, options, CB);
23466 if (er2.code === "ENOENT")
23475 function rimraf_(p, options, cb) {
23478 assert(typeof cb === "function");
23479 options.lstat(p, function(er, st) {
23480 if (er && er.code === "ENOENT")
23482 if (er && er.code === "EPERM" && isWindows)
23483 fixWinEPERM(p, options, er, cb);
23484 if (st && st.isDirectory())
23485 return rmdir(p, options, er, cb);
23486 options.unlink(p, function(er2) {
23488 if (er2.code === "ENOENT")
23490 if (er2.code === "EPERM")
23491 return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
23492 if (er2.code === "EISDIR")
23493 return rmdir(p, options, er2, cb);
23499 function fixWinEPERM(p, options, er, cb) {
23502 assert(typeof cb === "function");
23504 assert(er instanceof Error);
23505 options.chmod(p, _0666, function(er2) {
23507 cb(er2.code === "ENOENT" ? null : er);
23509 options.stat(p, function(er3, stats) {
23511 cb(er3.code === "ENOENT" ? null : er);
23512 else if (stats.isDirectory())
23513 rmdir(p, options, er, cb);
23515 options.unlink(p, cb);
23519 function fixWinEPERMSync(p, options, er) {
23523 assert(er instanceof Error);
23525 options.chmodSync(p, _0666);
23527 if (er2.code === "ENOENT")
23533 var stats = options.statSync(p);
23535 if (er3.code === "ENOENT")
23540 if (stats.isDirectory())
23541 rmdirSync(p, options, er);
23543 options.unlinkSync(p);
23545 function rmdir(p, options, originalEr, cb) {
23549 assert(originalEr instanceof Error);
23550 assert(typeof cb === "function");
23551 options.rmdir(p, function(er) {
23552 if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
23553 rmkids(p, options, cb);
23554 else if (er && er.code === "ENOTDIR")
23560 function rmkids(p, options, cb) {
23563 assert(typeof cb === "function");
23564 options.readdir(p, function(er, files) {
23567 var n = files.length;
23569 return options.rmdir(p, cb);
23571 files.forEach(function(f) {
23572 rimraf(path2.join(p, f), options, function(er2) {
23576 return cb(errState = er2);
23578 options.rmdir(p, cb);
23583 function rimrafSync(p, options) {
23584 options = options || {};
23586 assert(p, "rimraf: missing path");
23587 assert.equal(typeof p, "string", "rimraf: path should be a string");
23588 assert(options, "rimraf: missing options");
23589 assert.equal(typeof options, "object", "rimraf: options should be object");
23591 if (options.disableGlob || !glob.hasMagic(p)) {
23595 options.lstatSync(p);
23598 results2 = glob.sync(p, options.glob);
23601 if (!results2.length)
23603 for (var i = 0; i < results2.length; i++) {
23604 var p = results2[i];
23606 var st = options.lstatSync(p);
23608 if (er.code === "ENOENT")
23610 if (er.code === "EPERM" && isWindows)
23611 fixWinEPERMSync(p, options, er);
23614 if (st && st.isDirectory())
23615 rmdirSync(p, options, null);
23617 options.unlinkSync(p);
23619 if (er.code === "ENOENT")
23621 if (er.code === "EPERM")
23622 return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er);
23623 if (er.code !== "EISDIR")
23625 rmdirSync(p, options, er);
23629 function rmdirSync(p, options, originalEr) {
23633 assert(originalEr instanceof Error);
23635 options.rmdirSync(p);
23637 if (er.code === "ENOENT")
23639 if (er.code === "ENOTDIR")
23641 if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
23642 rmkidsSync(p, options);
23645 function rmkidsSync(p, options) {
23648 options.readdirSync(p).forEach(function(f) {
23649 rimrafSync(path2.join(p, f), options);
23651 var retries = isWindows ? 100 : 1;
23656 var ret2 = options.rmdirSync(p, options);
23660 if (++i < retries && threw)
23668 // node_modules/mkdirp/index.js
23669 var require_mkdirp = __commonJS({
23670 "node_modules/mkdirp/index.js"(exports2, module2) {
23671 var path2 = require("path");
23672 var fs2 = require("fs");
23673 var _0777 = parseInt("0777", 8);
23674 module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
23675 function mkdirP(p, opts, f, made) {
23676 if (typeof opts === "function") {
23679 } else if (!opts || typeof opts !== "object") {
23680 opts = { mode: opts };
23682 var mode = opts.mode;
23683 var xfs = opts.fs || fs2;
23684 if (mode === void 0) {
23689 var cb = f || function() {
23691 p = path2.resolve(p);
23692 xfs.mkdir(p, mode, function(er) {
23695 return cb(null, made);
23699 if (path2.dirname(p) === p)
23701 mkdirP(path2.dirname(p), opts, function(er2, made2) {
23705 mkdirP(p, opts, cb, made2);
23709 xfs.stat(p, function(er2, stat) {
23710 if (er2 || !stat.isDirectory())
23719 mkdirP.sync = function sync(p, opts, made) {
23720 if (!opts || typeof opts !== "object") {
23721 opts = { mode: opts };
23723 var mode = opts.mode;
23724 var xfs = opts.fs || fs2;
23725 if (mode === void 0) {
23730 p = path2.resolve(p);
23732 xfs.mkdirSync(p, mode);
23735 switch (err0.code) {
23737 made = sync(path2.dirname(p), opts, made);
23738 sync(p, opts, made);
23743 stat = xfs.statSync(p);
23747 if (!stat.isDirectory())
23757 // node_modules/fstream/lib/collect.js
23758 var require_collect = __commonJS({
23759 "node_modules/fstream/lib/collect.js"(exports2, module2) {
23760 module2.exports = collect;
23761 function collect(stream) {
23762 if (stream._collected)
23764 if (stream._paused)
23765 return stream.on("resume", collect.bind(null, stream));
23766 stream._collected = true;
23768 stream.on("data", save);
23769 stream.on("end", save);
23772 if (typeof b === "string")
23774 if (Buffer.isBuffer(b) && !b.length)
23778 stream.on("entry", saveEntry);
23779 var entryBuffer = [];
23780 function saveEntry(e) {
23782 entryBuffer.push(e);
23784 stream.on("proxy", proxyPause);
23785 function proxyPause(p) {
23788 stream.pipe = function(orig) {
23789 return function(dest) {
23791 (function unblockEntry() {
23792 var entry = entryBuffer[e++];
23795 entry.on("end", unblockEntry);
23799 stream.emit("entry", entry);
23801 function resume() {
23802 stream.removeListener("entry", saveEntry);
23803 stream.removeListener("data", save);
23804 stream.removeListener("end", save);
23805 stream.pipe = orig;
23808 buf.forEach(function(b) {
23810 stream.emit("data", b);
23812 stream.emit("end");
23823 // node_modules/fstream/lib/dir-writer.js
23824 var require_dir_writer = __commonJS({
23825 "node_modules/fstream/lib/dir-writer.js"(exports2, module2) {
23826 module2.exports = DirWriter;
23827 var Writer = require_writer();
23828 var inherits2 = require_inherits();
23829 var mkdir = require_mkdirp();
23830 var path2 = require("path");
23831 var collect = require_collect();
23832 inherits2(DirWriter, Writer);
23833 function DirWriter(props) {
23835 if (!(self2 instanceof DirWriter)) {
23836 self2.error("DirWriter must be called as constructor.", null, true);
23838 if (props.type !== "Directory" || !props.Directory) {
23839 self2.error("Non-directory type " + props.type + " " + JSON.stringify(props), null, true);
23841 Writer.call(this, props);
23843 DirWriter.prototype._create = function() {
23845 mkdir(self2._path, Writer.dirmode, function(er) {
23847 return self2.error(er);
23848 self2.ready = true;
23849 self2.emit("ready");
23853 DirWriter.prototype.write = function() {
23856 DirWriter.prototype.end = function() {
23857 this._ended = true;
23860 DirWriter.prototype.add = function(entry) {
23863 if (!self2.ready || self2._currentEntry) {
23864 self2._buffer.push(entry);
23867 if (self2._ended) {
23868 return self2.error("add after end");
23870 self2._buffer.push(entry);
23872 return this._buffer.length === 0;
23874 DirWriter.prototype._process = function() {
23876 if (self2._processing)
23878 var entry = self2._buffer.shift();
23880 self2.emit("drain");
23885 self2._processing = true;
23886 self2.emit("entry", entry);
23890 pp = p._path || p.path;
23891 if (pp === self2.root._path || pp === self2._path || pp && pp.indexOf(self2._path) === 0) {
23892 self2._processing = false;
23893 if (entry._collected)
23895 return self2._process();
23901 root: self2.root || self2,
23903 depth: self2.depth + 1
23905 pp = entry._path || entry.path || entry.props.path;
23906 if (entry.parent) {
23907 pp = pp.substr(entry.parent._path.length + 1);
23909 props.path = path2.join(self2.path, path2.join("/", pp));
23910 props.filter = self2.filter;
23911 Object.keys(entry.props).forEach(function(k) {
23912 if (!props.hasOwnProperty(k)) {
23913 props[k] = entry.props[k];
23916 var child = self2._currentChild = new Writer(props);
23917 child.on("ready", function() {
23921 child.on("error", function(er) {
23922 if (child._swallowErrors) {
23925 child.emit("close");
23927 self2.emit("error", er);
23930 child.on("close", onend);
23936 self2._currentChild = null;
23937 self2._processing = false;
23944 // node_modules/fstream/lib/link-writer.js
23945 var require_link_writer = __commonJS({
23946 "node_modules/fstream/lib/link-writer.js"(exports2, module2) {
23947 module2.exports = LinkWriter;
23948 var fs2 = require_graceful_fs();
23949 var Writer = require_writer();
23950 var inherits2 = require_inherits();
23951 var path2 = require("path");
23952 var rimraf = require_rimraf2();
23953 inherits2(LinkWriter, Writer);
23954 function LinkWriter(props) {
23956 if (!(self2 instanceof LinkWriter)) {
23957 throw new Error("LinkWriter must be called as constructor.");
23959 if (!(props.type === "Link" && props.Link || props.type === "SymbolicLink" && props.SymbolicLink)) {
23960 throw new Error("Non-link type " + props.type);
23962 if (props.linkpath === "")
23963 props.linkpath = ".";
23964 if (!props.linkpath) {
23965 self2.error("Need linkpath property to create " + props.type);
23967 Writer.call(this, props);
23969 LinkWriter.prototype._create = function() {
23971 var hard = self2.type === "Link" || process.platform === "win32";
23972 var link = hard ? "link" : "symlink";
23973 var lp = hard ? path2.resolve(self2.dirname, self2.linkpath) : self2.linkpath;
23975 return clobber(self2, lp, link);
23976 fs2.readlink(self2._path, function(er, p) {
23978 return finish(self2);
23979 clobber(self2, lp, link);
23982 function clobber(self2, lp, link) {
23983 rimraf(self2._path, function(er) {
23985 return self2.error(er);
23986 create(self2, lp, link);
23989 function create(self2, lp, link) {
23990 fs2[link](lp, self2._path, function(er) {
23992 if ((er.code === "ENOENT" || er.code === "EACCES" || er.code === "EPERM") && process.platform === "win32") {
23993 self2.ready = true;
23994 self2.emit("ready");
23996 self2.emit("close");
23997 self2.end = self2._finish = function() {
24000 return self2.error(er);
24005 function finish(self2) {
24006 self2.ready = true;
24007 self2.emit("ready");
24008 if (self2._ended && !self2._finished)
24011 LinkWriter.prototype.end = function() {
24012 this._ended = true;
24014 this._finished = true;
24021 // node_modules/fstream/lib/file-writer.js
24022 var require_file_writer = __commonJS({
24023 "node_modules/fstream/lib/file-writer.js"(exports2, module2) {
24024 module2.exports = FileWriter;
24025 var fs2 = require_graceful_fs();
24026 var Writer = require_writer();
24027 var inherits2 = require_inherits();
24029 inherits2(FileWriter, Writer);
24030 function FileWriter(props) {
24032 if (!(self2 instanceof FileWriter)) {
24033 throw new Error("FileWriter must be called as constructor.");
24035 if (props.type !== "File" || !props.File) {
24036 throw new Error("Non-file type " + props.type);
24038 self2._buffer = [];
24039 self2._bytesWritten = 0;
24040 Writer.call(this, props);
24042 FileWriter.prototype._create = function() {
24047 if (self2.props.flags)
24048 so.flags = self2.props.flags;
24049 so.mode = Writer.filemode;
24050 if (self2._old && self2._old.blksize)
24051 so.bufferSize = self2._old.blksize;
24052 self2._stream = fs2.createWriteStream(self2._path, so);
24053 self2._stream.on("open", function() {
24054 self2.ready = true;
24055 self2._buffer.forEach(function(c) {
24057 self2._stream.end();
24059 self2._stream.write(c);
24061 self2.emit("ready");
24062 self2.emit("drain");
24064 self2._stream.on("error", function(er) {
24065 self2.emit("error", er);
24067 self2._stream.on("drain", function() {
24068 self2.emit("drain");
24070 self2._stream.on("close", function() {
24074 FileWriter.prototype.write = function(c) {
24076 self2._bytesWritten += c.length;
24077 if (!self2.ready) {
24078 if (!Buffer.isBuffer(c) && typeof c !== "string") {
24079 throw new Error("invalid write data");
24081 self2._buffer.push(c);
24084 var ret2 = self2._stream.write(c);
24085 if (ret2 === false && self2._stream._queue) {
24086 return self2._stream._queue.length <= 2;
24091 FileWriter.prototype.end = function(c) {
24095 if (!self2.ready) {
24096 self2._buffer.push(EOF);
24099 return self2._stream.end();
24101 FileWriter.prototype._finish = function() {
24103 if (typeof self2.size === "number" && self2._bytesWritten !== self2.size) {
24104 self2.error("Did not get expected byte count.\nexpect: " + self2.size + "\nactual: " + self2._bytesWritten);
24106 Writer.prototype._finish.call(self2);
24111 // node_modules/fstream/lib/proxy-writer.js
24112 var require_proxy_writer = __commonJS({
24113 "node_modules/fstream/lib/proxy-writer.js"(exports2, module2) {
24114 module2.exports = ProxyWriter;
24115 var Writer = require_writer();
24116 var getType = require_get_type();
24117 var inherits2 = require_inherits();
24118 var collect = require_collect();
24119 var fs2 = require("fs");
24120 inherits2(ProxyWriter, Writer);
24121 function ProxyWriter(props) {
24123 if (!(self2 instanceof ProxyWriter)) {
24124 throw new Error("ProxyWriter must be called as constructor.");
24126 self2.props = props;
24127 self2._needDrain = false;
24128 Writer.call(self2, props);
24130 ProxyWriter.prototype._stat = function() {
24132 var props = self2.props;
24133 var stat = props.follow ? "stat" : "lstat";
24134 fs2[stat](props.path, function(er, current) {
24136 if (er || !current) {
24139 type = getType(current);
24141 props[type] = true;
24142 props.type = self2.type = type;
24143 self2._old = current;
24144 self2._addProxy(Writer(props, current));
24147 ProxyWriter.prototype._addProxy = function(proxy) {
24149 if (self2._proxy) {
24150 return self2.error("proxy already set");
24152 self2._proxy = proxy;
24160 ].forEach(function(ev) {
24161 proxy.on(ev, self2.emit.bind(self2, ev));
24163 self2.emit("proxy", proxy);
24164 var calls = self2._buffer;
24165 calls.forEach(function(c) {
24166 proxy[c[0]].apply(proxy, c[1]);
24168 self2._buffer.length = 0;
24169 if (self2._needsDrain)
24170 self2.emit("drain");
24172 ProxyWriter.prototype.add = function(entry) {
24174 if (!this._proxy) {
24175 this._buffer.push(["add", [entry]]);
24176 this._needDrain = true;
24179 return this._proxy.add(entry);
24181 ProxyWriter.prototype.write = function(c) {
24182 if (!this._proxy) {
24183 this._buffer.push(["write", [c]]);
24184 this._needDrain = true;
24187 return this._proxy.write(c);
24189 ProxyWriter.prototype.end = function(c) {
24190 if (!this._proxy) {
24191 this._buffer.push(["end", [c]]);
24194 return this._proxy.end(c);
24199 // node_modules/fstream/lib/writer.js
24200 var require_writer = __commonJS({
24201 "node_modules/fstream/lib/writer.js"(exports2, module2) {
24202 module2.exports = Writer;
24203 var fs2 = require_graceful_fs();
24204 var inherits2 = require_inherits();
24205 var rimraf = require_rimraf2();
24206 var mkdir = require_mkdirp();
24207 var path2 = require("path");
24208 var umask = process.platform === "win32" ? 0 : process.umask();
24209 var getType = require_get_type();
24210 var Abstract = require_abstract();
24211 inherits2(Writer, Abstract);
24212 Writer.dirmode = parseInt("0777", 8) & ~umask;
24213 Writer.filemode = parseInt("0666", 8) & ~umask;
24214 var DirWriter = require_dir_writer();
24215 var LinkWriter = require_link_writer();
24216 var FileWriter = require_file_writer();
24217 var ProxyWriter = require_proxy_writer();
24218 function Writer(props, current) {
24220 if (typeof props === "string") {
24221 props = { path: props };
24223 var type = getType(props);
24224 var ClassType = Writer;
24227 ClassType = DirWriter;
24230 ClassType = FileWriter;
24233 case "SymbolicLink":
24234 ClassType = LinkWriter;
24238 ClassType = ProxyWriter;
24241 if (!(self2 instanceof ClassType))
24242 return new ClassType(props);
24243 Abstract.call(self2);
24245 self2.error("Must provide a path", null, true);
24246 self2.type = props.type;
24247 self2.props = props;
24248 self2.depth = props.depth || 0;
24249 self2.clobber = props.clobber === false ? props.clobber : true;
24250 self2.parent = props.parent || null;
24251 self2.root = props.root || props.parent && props.parent.root || self2;
24252 self2._path = self2.path = path2.resolve(props.path);
24253 if (process.platform === "win32") {
24254 self2.path = self2._path = self2.path.replace(/\?/g, "_");
24255 if (self2._path.length >= 260) {
24256 self2._swallowErrors = true;
24257 self2._path = "\\\\?\\" + self2.path.replace(/\//g, "\\");
24260 self2.basename = path2.basename(props.path);
24261 self2.dirname = path2.dirname(props.path);
24262 self2.linkpath = props.linkpath || null;
24263 props.parent = props.root = null;
24264 self2.size = props.size;
24265 if (typeof props.mode === "string") {
24266 props.mode = parseInt(props.mode, 8);
24268 self2.readable = false;
24269 self2.writable = true;
24270 self2._buffer = [];
24271 self2.ready = false;
24272 self2.filter = typeof props.filter === "function" ? props.filter : null;
24273 self2._stat(current);
24275 Writer.prototype._create = function() {
24277 fs2[self2.props.follow ? "stat" : "lstat"](self2._path, function(er) {
24279 return self2.warn("Cannot create " + self2._path + "\nUnsupported type: " + self2.type, "ENOTSUP");
24284 Writer.prototype._stat = function(current) {
24286 var props = self2.props;
24287 var stat = props.follow ? "stat" : "lstat";
24288 var who = self2._proxy || self2;
24290 statCb(null, current);
24292 fs2[stat](self2._path, statCb);
24293 function statCb(er, current2) {
24294 if (self2.filter && !self2.filter.call(who, who, current2)) {
24295 self2._aborted = true;
24297 self2.emit("close");
24300 if (er || !current2) {
24301 return create(self2);
24303 self2._old = current2;
24304 var currentType = getType(current2);
24305 if (currentType !== self2.type || self2.type === "File" && current2.nlink > 1) {
24306 return rimraf(self2._path, function(er2) {
24308 return self2.error(er2);
24316 function create(self2) {
24317 mkdir(path2.dirname(self2._path), Writer.dirmode, function(er, made) {
24319 return self2.error(er);
24320 self2._madeDir = made;
24321 return self2._create();
24324 function endChmod(self2, want, current, path3, cb) {
24325 var wantMode = want.mode;
24326 var chmod = want.follow || self2.type !== "SymbolicLink" ? "chmod" : "lchmod";
24329 if (typeof wantMode !== "number")
24331 var curMode = current.mode & parseInt("0777", 8);
24332 wantMode = wantMode & parseInt("0777", 8);
24333 if (wantMode === curMode)
24335 fs2[chmod](path3, wantMode, cb);
24337 function endChown(self2, want, current, path3, cb) {
24338 if (process.platform === "win32")
24340 if (!process.getuid || process.getuid() !== 0)
24342 if (typeof want.uid !== "number" && typeof want.gid !== "number")
24344 if (current.uid === want.uid && current.gid === want.gid)
24346 var chown = self2.props.follow || self2.type !== "SymbolicLink" ? "chown" : "lchown";
24349 if (typeof want.uid !== "number")
24350 want.uid = current.uid;
24351 if (typeof want.gid !== "number")
24352 want.gid = current.gid;
24353 fs2[chown](path3, want.uid, want.gid, cb);
24355 function endUtimes(self2, want, current, path3, cb) {
24356 if (!fs2.utimes || process.platform === "win32")
24358 var utimes = want.follow || self2.type !== "SymbolicLink" ? "utimes" : "lutimes";
24359 if (utimes === "lutimes" && !fs2[utimes]) {
24364 var curA = current.atime;
24365 var curM = current.mtime;
24366 var meA = want.atime;
24367 var meM = want.mtime;
24368 if (meA === void 0)
24370 if (meM === void 0)
24373 meA = new Date(meA);
24375 meA = new Date(meM);
24376 if (meA.getTime() === curA.getTime() && meM.getTime() === curM.getTime())
24378 fs2[utimes](path3, meA, meM, cb);
24380 Writer.prototype._finish = function() {
24382 if (self2._finishing)
24384 self2._finishing = true;
24386 var errState = null;
24389 self2._old.atime = new Date(0);
24390 self2._old.mtime = new Date(0);
24391 setProps(self2._old);
24393 var stat = self2.props.follow ? "stat" : "lstat";
24394 fs2[stat](self2._path, function(er, current) {
24396 if (er.code === "ENOENT" && (self2.type === "Link" || self2.type === "SymbolicLink") && process.platform === "win32") {
24397 self2.ready = true;
24398 self2.emit("ready");
24400 self2.emit("close");
24401 self2.end = self2._finish = function() {
24405 return self2.error(er);
24407 setProps(self2._old = current);
24411 function setProps(current) {
24413 endChmod(self2, self2.props, current, self2._path, next("chmod"));
24414 endChown(self2, self2.props, current, self2._path, next("chown"));
24415 endUtimes(self2, self2.props, current, self2._path, next("utimes"));
24417 function next(what) {
24418 return function(er) {
24422 er.fstream_finish_call = what;
24423 return self2.error(errState = er);
24430 if (!self2._madeDir)
24433 endMadeDir(self2, self2._path, end);
24434 function end(er2) {
24436 er2.fstream_finish_call = "setupMadeDir";
24437 return self2.error(er2);
24440 self2.emit("close");
24445 function endMadeDir(self2, p, cb) {
24446 var made = self2._madeDir;
24447 var d = path2.dirname(p);
24448 endMadeDir_(self2, d, function(er) {
24454 endMadeDir(self2, d, cb);
24457 function endMadeDir_(self2, p, cb) {
24459 Object.keys(self2.props).forEach(function(k) {
24460 dirProps[k] = self2.props[k];
24461 if (k === "mode" && self2.type !== "Directory") {
24462 dirProps[k] = dirProps[k] | parseInt("0111", 8);
24466 var errState = null;
24467 fs2.stat(p, function(er, current) {
24469 return cb(errState = er);
24470 endChmod(self2, dirProps, current, p, next);
24471 endChown(self2, dirProps, current, p, next);
24472 endUtimes(self2, dirProps, current, p, next);
24474 function next(er) {
24478 return cb(errState = er);
24483 Writer.prototype.pipe = function() {
24484 this.error("Can't pipe from writable stream");
24486 Writer.prototype.add = function() {
24487 this.error("Can't add to non-Directory type");
24489 Writer.prototype.write = function() {
24492 function objectToString(d) {
24493 return Object.prototype.toString.call(d);
24495 function isDate(d) {
24496 return typeof d === "object" && objectToString(d) === "[object Date]";
24501 // node_modules/fstream/fstream.js
24502 var require_fstream = __commonJS({
24503 "node_modules/fstream/fstream.js"(exports2) {
24504 exports2.Abstract = require_abstract();
24505 exports2.Reader = require_reader();
24506 exports2.Writer = require_writer();
24508 Reader: require_file_reader(),
24509 Writer: require_file_writer()
24512 Reader: require_dir_reader(),
24513 Writer: require_dir_writer()
24516 Reader: require_link_reader(),
24517 Writer: require_link_writer()
24520 Reader: require_proxy_reader(),
24521 Writer: require_proxy_writer()
24523 exports2.Reader.Dir = exports2.DirReader = exports2.Dir.Reader;
24524 exports2.Reader.File = exports2.FileReader = exports2.File.Reader;
24525 exports2.Reader.Link = exports2.LinkReader = exports2.Link.Reader;
24526 exports2.Reader.Proxy = exports2.ProxyReader = exports2.Proxy.Reader;
24527 exports2.Writer.Dir = exports2.DirWriter = exports2.Dir.Writer;
24528 exports2.Writer.File = exports2.FileWriter = exports2.File.Writer;
24529 exports2.Writer.Link = exports2.LinkWriter = exports2.Link.Writer;
24530 exports2.Writer.Proxy = exports2.ProxyWriter = exports2.Proxy.Writer;
24531 exports2.collect = require_collect();
24535 // node_modules/unzipper/lib/extract.js
24536 var require_extract = __commonJS({
24537 "node_modules/unzipper/lib/extract.js"(exports2, module2) {
24538 module2.exports = Extract;
24539 var Parse = require_parse3();
24540 var Writer = require_fstream().Writer;
24541 var path2 = require("path");
24542 var stream = require("stream");
24543 var duplexer2 = require_duplexer2();
24544 var Promise2 = require_bluebird();
24545 function Extract(opts) {
24546 opts.path = path2.resolve(path2.normalize(opts.path));
24547 var parser = new Parse(opts);
24548 var outStream = new stream.Writable({ objectMode: true });
24549 outStream._write = function(entry, encoding, cb) {
24550 if (entry.type == "Directory")
24552 var extractPath = path2.join(opts.path, entry.path);
24553 if (extractPath.indexOf(opts.path) != 0) {
24556 const writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
24557 entry.pipe(writer).on("error", cb).on("close", cb);
24559 var extract = duplexer2(parser, outStream);
24560 parser.once("crx-header", function(crxHeader) {
24561 extract.crxHeader = crxHeader;
24563 parser.pipe(outStream).on("finish", function() {
24564 extract.emit("close");
24566 extract.promise = function() {
24567 return new Promise2(function(resolve, reject) {
24568 extract.on("close", resolve);
24569 extract.on("error", reject);
24577 // node_modules/big-integer/BigInteger.js
24578 var require_BigInteger = __commonJS({
24579 "node_modules/big-integer/BigInteger.js"(exports2, module2) {
24580 var bigInt = function(undefined2) {
24582 var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
24583 var supportsNativeBigInt = typeof BigInt === "function";
24584 function Integer(v, radix, alphabet, caseSensitive) {
24585 if (typeof v === "undefined")
24587 if (typeof radix !== "undefined")
24588 return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
24589 return parseValue(v);
24591 function BigInteger(value, sign) {
24592 this.value = value;
24594 this.isSmall = false;
24596 BigInteger.prototype = Object.create(Integer.prototype);
24597 function SmallInteger(value) {
24598 this.value = value;
24599 this.sign = value < 0;
24600 this.isSmall = true;
24602 SmallInteger.prototype = Object.create(Integer.prototype);
24603 function NativeBigInt(value) {
24604 this.value = value;
24606 NativeBigInt.prototype = Object.create(Integer.prototype);
24607 function isPrecise(n) {
24608 return -MAX_INT < n && n < MAX_INT;
24610 function smallToArray(n) {
24614 return [n % 1e7, Math.floor(n / 1e7)];
24615 return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
24617 function arrayToSmall(arr) {
24619 var length = arr.length;
24620 if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
24627 return arr[0] + arr[1] * BASE;
24629 return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
24636 while (v[--i2] === 0)
24640 function createArray(length) {
24641 var x = new Array(length);
24643 while (++i2 < length) {
24648 function truncate(n) {
24650 return Math.floor(n);
24651 return Math.ceil(n);
24653 function add(a, b) {
24654 var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE, sum, i2;
24655 for (i2 = 0; i2 < l_b; i2++) {
24656 sum = a[i2] + b[i2] + carry;
24657 carry = sum >= base ? 1 : 0;
24658 r[i2] = sum - carry * base;
24661 sum = a[i2] + carry;
24662 carry = sum === base ? 1 : 0;
24663 r[i2++] = sum - carry * base;
24669 function addAny(a, b) {
24670 if (a.length >= b.length)
24674 function addSmall(a, carry) {
24675 var l2 = a.length, r = new Array(l2), base = BASE, sum, i2;
24676 for (i2 = 0; i2 < l2; i2++) {
24677 sum = a[i2] - base + carry;
24678 carry = Math.floor(sum / base);
24679 r[i2] = sum - carry * base;
24682 while (carry > 0) {
24683 r[i2++] = carry % base;
24684 carry = Math.floor(carry / base);
24688 BigInteger.prototype.add = function(v) {
24689 var n = parseValue(v);
24690 if (this.sign !== n.sign) {
24691 return this.subtract(n.negate());
24693 var a = this.value, b = n.value;
24695 return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
24697 return new BigInteger(addAny(a, b), this.sign);
24699 BigInteger.prototype.plus = BigInteger.prototype.add;
24700 SmallInteger.prototype.add = function(v) {
24701 var n = parseValue(v);
24702 var a = this.value;
24703 if (a < 0 !== n.sign) {
24704 return this.subtract(n.negate());
24708 if (isPrecise(a + b))
24709 return new SmallInteger(a + b);
24710 b = smallToArray(Math.abs(b));
24712 return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
24714 SmallInteger.prototype.plus = SmallInteger.prototype.add;
24715 NativeBigInt.prototype.add = function(v) {
24716 return new NativeBigInt(this.value + parseValue(v).value);
24718 NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
24719 function subtract(a, b) {
24720 var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE, i2, difference;
24721 for (i2 = 0; i2 < b_l; i2++) {
24722 difference = a[i2] - borrow - b[i2];
24723 if (difference < 0) {
24724 difference += base;
24728 r[i2] = difference;
24730 for (i2 = b_l; i2 < a_l; i2++) {
24731 difference = a[i2] - borrow;
24732 if (difference < 0)
24733 difference += base;
24735 r[i2++] = difference;
24738 r[i2] = difference;
24740 for (; i2 < a_l; i2++) {
24746 function subtractAny(a, b, sign) {
24748 if (compareAbs(a, b) >= 0) {
24749 value = subtract(a, b);
24751 value = subtract(b, a);
24754 value = arrayToSmall(value);
24755 if (typeof value === "number") {
24758 return new SmallInteger(value);
24760 return new BigInteger(value, sign);
24762 function subtractSmall(a, b, sign) {
24763 var l2 = a.length, r = new Array(l2), carry = -b, base = BASE, i2, difference;
24764 for (i2 = 0; i2 < l2; i2++) {
24765 difference = a[i2] + carry;
24766 carry = Math.floor(difference / base);
24767 difference %= base;
24768 r[i2] = difference < 0 ? difference + base : difference;
24770 r = arrayToSmall(r);
24771 if (typeof r === "number") {
24774 return new SmallInteger(r);
24776 return new BigInteger(r, sign);
24778 BigInteger.prototype.subtract = function(v) {
24779 var n = parseValue(v);
24780 if (this.sign !== n.sign) {
24781 return this.add(n.negate());
24783 var a = this.value, b = n.value;
24785 return subtractSmall(a, Math.abs(b), this.sign);
24786 return subtractAny(a, b, this.sign);
24788 BigInteger.prototype.minus = BigInteger.prototype.subtract;
24789 SmallInteger.prototype.subtract = function(v) {
24790 var n = parseValue(v);
24791 var a = this.value;
24792 if (a < 0 !== n.sign) {
24793 return this.add(n.negate());
24797 return new SmallInteger(a - b);
24799 return subtractSmall(b, Math.abs(a), a >= 0);
24801 SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
24802 NativeBigInt.prototype.subtract = function(v) {
24803 return new NativeBigInt(this.value - parseValue(v).value);
24805 NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
24806 BigInteger.prototype.negate = function() {
24807 return new BigInteger(this.value, !this.sign);
24809 SmallInteger.prototype.negate = function() {
24810 var sign = this.sign;
24811 var small = new SmallInteger(-this.value);
24812 small.sign = !sign;
24815 NativeBigInt.prototype.negate = function() {
24816 return new NativeBigInt(-this.value);
24818 BigInteger.prototype.abs = function() {
24819 return new BigInteger(this.value, false);
24821 SmallInteger.prototype.abs = function() {
24822 return new SmallInteger(Math.abs(this.value));
24824 NativeBigInt.prototype.abs = function() {
24825 return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
24827 function multiplyLong(a, b) {
24828 var a_l = a.length, b_l = b.length, l2 = a_l + b_l, r = createArray(l2), base = BASE, product, carry, i2, a_i, b_j;
24829 for (i2 = 0; i2 < a_l; ++i2) {
24831 for (var j = 0; j < b_l; ++j) {
24833 product = a_i * b_j + r[i2 + j];
24834 carry = Math.floor(product / base);
24835 r[i2 + j] = product - carry * base;
24836 r[i2 + j + 1] += carry;
24842 function multiplySmall(a, b) {
24843 var l2 = a.length, r = new Array(l2), base = BASE, carry = 0, product, i2;
24844 for (i2 = 0; i2 < l2; i2++) {
24845 product = a[i2] * b + carry;
24846 carry = Math.floor(product / base);
24847 r[i2] = product - carry * base;
24849 while (carry > 0) {
24850 r[i2++] = carry % base;
24851 carry = Math.floor(carry / base);
24855 function shiftLeft(x, n) {
24859 return r.concat(x);
24861 function multiplyKaratsuba(x, y) {
24862 var n = Math.max(x.length, y.length);
24864 return multiplyLong(x, y);
24865 n = Math.ceil(n / 2);
24866 var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n);
24867 var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
24868 var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
24872 function useKaratsuba(l1, l2) {
24873 return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;
24875 BigInteger.prototype.multiply = function(v) {
24876 var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs;
24883 return this.negate();
24886 return new BigInteger(multiplySmall(a, abs), sign);
24888 b = smallToArray(abs);
24890 if (useKaratsuba(a.length, b.length))
24891 return new BigInteger(multiplyKaratsuba(a, b), sign);
24892 return new BigInteger(multiplyLong(a, b), sign);
24894 BigInteger.prototype.times = BigInteger.prototype.multiply;
24895 function multiplySmallAndArray(a, b, sign) {
24897 return new BigInteger(multiplySmall(b, a), sign);
24899 return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
24901 SmallInteger.prototype._multiplyBySmall = function(a) {
24902 if (isPrecise(a.value * this.value)) {
24903 return new SmallInteger(a.value * this.value);
24905 return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
24907 BigInteger.prototype._multiplyBySmall = function(a) {
24912 if (a.value === -1)
24913 return this.negate();
24914 return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
24916 SmallInteger.prototype.multiply = function(v) {
24917 return parseValue(v)._multiplyBySmall(this);
24919 SmallInteger.prototype.times = SmallInteger.prototype.multiply;
24920 NativeBigInt.prototype.multiply = function(v) {
24921 return new NativeBigInt(this.value * parseValue(v).value);
24923 NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
24924 function square(a) {
24925 var l2 = a.length, r = createArray(l2 + l2), base = BASE, product, carry, i2, a_i, a_j;
24926 for (i2 = 0; i2 < l2; i2++) {
24928 carry = 0 - a_i * a_i;
24929 for (var j = i2; j < l2; j++) {
24931 product = 2 * (a_i * a_j) + r[i2 + j] + carry;
24932 carry = Math.floor(product / base);
24933 r[i2 + j] = product - carry * base;
24935 r[i2 + l2] = carry;
24940 BigInteger.prototype.square = function() {
24941 return new BigInteger(square(this.value), false);
24943 SmallInteger.prototype.square = function() {
24944 var value = this.value * this.value;
24945 if (isPrecise(value))
24946 return new SmallInteger(value);
24947 return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
24949 NativeBigInt.prototype.square = function(v) {
24950 return new NativeBigInt(this.value * this.value);
24952 function divMod1(a, b) {
24953 var a_l = a.length, b_l = b.length, base = BASE, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l2, q;
24954 if (remainder.length <= a_l)
24957 divisorMostSignificantDigit = divisor[b_l - 1];
24958 for (shift = a_l - b_l; shift >= 0; shift--) {
24959 quotientDigit = base - 1;
24960 if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
24961 quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
24965 l2 = divisor.length;
24966 for (i2 = 0; i2 < l2; i2++) {
24967 carry += quotientDigit * divisor[i2];
24968 q = Math.floor(carry / base);
24969 borrow += remainder[shift + i2] - (carry - q * base);
24972 remainder[shift + i2] = borrow + base;
24975 remainder[shift + i2] = borrow;
24979 while (borrow !== 0) {
24980 quotientDigit -= 1;
24982 for (i2 = 0; i2 < l2; i2++) {
24983 carry += remainder[shift + i2] - base + divisor[i2];
24985 remainder[shift + i2] = carry + base;
24988 remainder[shift + i2] = carry;
24994 result[shift] = quotientDigit;
24996 remainder = divModSmall(remainder, lambda)[0];
24997 return [arrayToSmall(result), arrayToSmall(remainder)];
24999 function divMod2(a, b) {
25000 var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE, guess, xlen, highx, highy, check;
25002 part.unshift(a[--a_l]);
25004 if (compareAbs(part, b) < 0) {
25008 xlen = part.length;
25009 highx = part[xlen - 1] * base + part[xlen - 2];
25010 highy = b[b_l - 1] * base + b[b_l - 2];
25012 highx = (highx + 1) * base;
25014 guess = Math.ceil(highx / highy);
25016 check = multiplySmall(b, guess);
25017 if (compareAbs(check, part) <= 0)
25021 result.push(guess);
25022 part = subtract(part, check);
25025 return [arrayToSmall(result), arrayToSmall(part)];
25027 function divModSmall(value, lambda) {
25028 var length = value.length, quotient = createArray(length), base = BASE, i2, q, remainder, divisor;
25030 for (i2 = length - 1; i2 >= 0; --i2) {
25031 divisor = remainder * base + value[i2];
25032 q = truncate(divisor / lambda);
25033 remainder = divisor - q * lambda;
25034 quotient[i2] = q | 0;
25036 return [quotient, remainder | 0];
25038 function divModAny(self2, v) {
25039 var value, n = parseValue(v);
25040 if (supportsNativeBigInt) {
25041 return [new NativeBigInt(self2.value / n.value), new NativeBigInt(self2.value % n.value)];
25043 var a = self2.value, b = n.value;
25046 throw new Error("Cannot divide by zero");
25047 if (self2.isSmall) {
25049 return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
25051 return [Integer[0], self2];
25055 return [self2, Integer[0]];
25057 return [self2.negate(), Integer[0]];
25058 var abs = Math.abs(b);
25060 value = divModSmall(a, abs);
25061 quotient = arrayToSmall(value[0]);
25062 var remainder = value[1];
25064 remainder = -remainder;
25065 if (typeof quotient === "number") {
25066 if (self2.sign !== n.sign)
25067 quotient = -quotient;
25068 return [new SmallInteger(quotient), new SmallInteger(remainder)];
25070 return [new BigInteger(quotient, self2.sign !== n.sign), new SmallInteger(remainder)];
25072 b = smallToArray(abs);
25074 var comparison = compareAbs(a, b);
25075 if (comparison === -1)
25076 return [Integer[0], self2];
25077 if (comparison === 0)
25078 return [Integer[self2.sign === n.sign ? 1 : -1], Integer[0]];
25079 if (a.length + b.length <= 200)
25080 value = divMod1(a, b);
25082 value = divMod2(a, b);
25083 quotient = value[0];
25084 var qSign = self2.sign !== n.sign, mod = value[1], mSign = self2.sign;
25085 if (typeof quotient === "number") {
25087 quotient = -quotient;
25088 quotient = new SmallInteger(quotient);
25090 quotient = new BigInteger(quotient, qSign);
25091 if (typeof mod === "number") {
25094 mod = new SmallInteger(mod);
25096 mod = new BigInteger(mod, mSign);
25097 return [quotient, mod];
25099 BigInteger.prototype.divmod = function(v) {
25100 var result = divModAny(this, v);
25102 quotient: result[0],
25103 remainder: result[1]
25106 NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
25107 BigInteger.prototype.divide = function(v) {
25108 return divModAny(this, v)[0];
25110 NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) {
25111 return new NativeBigInt(this.value / parseValue(v).value);
25113 SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
25114 BigInteger.prototype.mod = function(v) {
25115 return divModAny(this, v)[1];
25117 NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) {
25118 return new NativeBigInt(this.value % parseValue(v).value);
25120 SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
25121 BigInteger.prototype.pow = function(v) {
25122 var n = parseValue(v), a = this.value, b = n.value, value, x, y;
25130 return n.isEven() ? Integer[1] : Integer[-1];
25135 throw new Error("The exponent " + n.toString() + " is too large.");
25136 if (this.isSmall) {
25137 if (isPrecise(value = Math.pow(a, b)))
25138 return new SmallInteger(truncate(value));
25154 SmallInteger.prototype.pow = BigInteger.prototype.pow;
25155 NativeBigInt.prototype.pow = function(v) {
25156 var n = parseValue(v);
25157 var a = this.value, b = n.value;
25158 var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
25165 if (a === BigInt(-1))
25166 return n.isEven() ? Integer[1] : Integer[-1];
25167 if (n.isNegative())
25168 return new NativeBigInt(_0);
25170 var y = Integer[1];
25172 if ((b & _1) === _1) {
25183 BigInteger.prototype.modPow = function(exp, mod) {
25184 exp = parseValue(exp);
25185 mod = parseValue(mod);
25187 throw new Error("Cannot take modPow with modulus 0");
25188 var r = Integer[1], base = this.mod(mod);
25189 if (exp.isNegative()) {
25190 exp = exp.multiply(Integer[-1]);
25191 base = base.modInv(mod);
25193 while (exp.isPositive()) {
25197 r = r.multiply(base).mod(mod);
25198 exp = exp.divide(2);
25199 base = base.square().mod(mod);
25203 NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
25204 function compareAbs(a, b) {
25205 if (a.length !== b.length) {
25206 return a.length > b.length ? 1 : -1;
25208 for (var i2 = a.length - 1; i2 >= 0; i2--) {
25209 if (a[i2] !== b[i2])
25210 return a[i2] > b[i2] ? 1 : -1;
25214 BigInteger.prototype.compareAbs = function(v) {
25215 var n = parseValue(v), a = this.value, b = n.value;
25218 return compareAbs(a, b);
25220 SmallInteger.prototype.compareAbs = function(v) {
25221 var n = parseValue(v), a = Math.abs(this.value), b = n.value;
25224 return a === b ? 0 : a > b ? 1 : -1;
25228 NativeBigInt.prototype.compareAbs = function(v) {
25229 var a = this.value;
25230 var b = parseValue(v).value;
25231 a = a >= 0 ? a : -a;
25232 b = b >= 0 ? b : -b;
25233 return a === b ? 0 : a > b ? 1 : -1;
25235 BigInteger.prototype.compare = function(v) {
25236 if (v === Infinity) {
25239 if (v === -Infinity) {
25242 var n = parseValue(v), a = this.value, b = n.value;
25243 if (this.sign !== n.sign) {
25244 return n.sign ? 1 : -1;
25247 return this.sign ? -1 : 1;
25249 return compareAbs(a, b) * (this.sign ? -1 : 1);
25251 BigInteger.prototype.compareTo = BigInteger.prototype.compare;
25252 SmallInteger.prototype.compare = function(v) {
25253 if (v === Infinity) {
25256 if (v === -Infinity) {
25259 var n = parseValue(v), a = this.value, b = n.value;
25261 return a == b ? 0 : a > b ? 1 : -1;
25263 if (a < 0 !== n.sign) {
25264 return a < 0 ? -1 : 1;
25266 return a < 0 ? 1 : -1;
25268 SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
25269 NativeBigInt.prototype.compare = function(v) {
25270 if (v === Infinity) {
25273 if (v === -Infinity) {
25276 var a = this.value;
25277 var b = parseValue(v).value;
25278 return a === b ? 0 : a > b ? 1 : -1;
25280 NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
25281 BigInteger.prototype.equals = function(v) {
25282 return this.compare(v) === 0;
25284 NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
25285 BigInteger.prototype.notEquals = function(v) {
25286 return this.compare(v) !== 0;
25288 NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
25289 BigInteger.prototype.greater = function(v) {
25290 return this.compare(v) > 0;
25292 NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
25293 BigInteger.prototype.lesser = function(v) {
25294 return this.compare(v) < 0;
25296 NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
25297 BigInteger.prototype.greaterOrEquals = function(v) {
25298 return this.compare(v) >= 0;
25300 NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
25301 BigInteger.prototype.lesserOrEquals = function(v) {
25302 return this.compare(v) <= 0;
25304 NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
25305 BigInteger.prototype.isEven = function() {
25306 return (this.value[0] & 1) === 0;
25308 SmallInteger.prototype.isEven = function() {
25309 return (this.value & 1) === 0;
25311 NativeBigInt.prototype.isEven = function() {
25312 return (this.value & BigInt(1)) === BigInt(0);
25314 BigInteger.prototype.isOdd = function() {
25315 return (this.value[0] & 1) === 1;
25317 SmallInteger.prototype.isOdd = function() {
25318 return (this.value & 1) === 1;
25320 NativeBigInt.prototype.isOdd = function() {
25321 return (this.value & BigInt(1)) === BigInt(1);
25323 BigInteger.prototype.isPositive = function() {
25326 SmallInteger.prototype.isPositive = function() {
25327 return this.value > 0;
25329 NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
25330 BigInteger.prototype.isNegative = function() {
25333 SmallInteger.prototype.isNegative = function() {
25334 return this.value < 0;
25336 NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
25337 BigInteger.prototype.isUnit = function() {
25340 SmallInteger.prototype.isUnit = function() {
25341 return Math.abs(this.value) === 1;
25343 NativeBigInt.prototype.isUnit = function() {
25344 return this.abs().value === BigInt(1);
25346 BigInteger.prototype.isZero = function() {
25349 SmallInteger.prototype.isZero = function() {
25350 return this.value === 0;
25352 NativeBigInt.prototype.isZero = function() {
25353 return this.value === BigInt(0);
25355 BigInteger.prototype.isDivisibleBy = function(v) {
25356 var n = parseValue(v);
25361 if (n.compareAbs(2) === 0)
25362 return this.isEven();
25363 return this.mod(n).isZero();
25365 NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
25366 function isBasicPrime(v) {
25370 if (n.equals(2) || n.equals(3) || n.equals(5))
25372 if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5))
25377 function millerRabinTest(n, a) {
25378 var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x;
25380 b = b.divide(2), r++;
25382 for (i2 = 0; i2 < a.length; i2++) {
25383 if (n.lesser(a[i2]))
25385 x = bigInt(a[i2]).modPow(b, n);
25386 if (x.isUnit() || x.equals(nPrev))
25388 for (d = r - 1; d != 0; d--) {
25389 x = x.square().mod(n);
25392 if (x.equals(nPrev))
25399 BigInteger.prototype.isPrime = function(strict) {
25400 var isPrime = isBasicPrime(this);
25401 if (isPrime !== undefined2)
25403 var n = this.abs();
25404 var bits = n.bitLength();
25406 return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
25407 var logN = Math.log(2) * bits.toJSNumber();
25408 var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
25409 for (var a = [], i2 = 0; i2 < t; i2++) {
25410 a.push(bigInt(i2 + 2));
25412 return millerRabinTest(n, a);
25414 NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
25415 BigInteger.prototype.isProbablePrime = function(iterations, rng) {
25416 var isPrime = isBasicPrime(this);
25417 if (isPrime !== undefined2)
25419 var n = this.abs();
25420 var t = iterations === undefined2 ? 5 : iterations;
25421 for (var a = [], i2 = 0; i2 < t; i2++) {
25422 a.push(bigInt.randBetween(2, n.minus(2), rng));
25424 return millerRabinTest(n, a);
25426 NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
25427 BigInteger.prototype.modInv = function(n) {
25428 var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
25429 while (!newR.isZero()) {
25430 q = r.divide(newR);
25435 newT = lastT.subtract(q.multiply(newT));
25436 newR = lastR.subtract(q.multiply(newR));
25439 throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
25440 if (t.compare(0) === -1) {
25443 if (this.isNegative()) {
25448 NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
25449 BigInteger.prototype.next = function() {
25450 var value = this.value;
25452 return subtractSmall(value, 1, this.sign);
25454 return new BigInteger(addSmall(value, 1), this.sign);
25456 SmallInteger.prototype.next = function() {
25457 var value = this.value;
25458 if (value + 1 < MAX_INT)
25459 return new SmallInteger(value + 1);
25460 return new BigInteger(MAX_INT_ARR, false);
25462 NativeBigInt.prototype.next = function() {
25463 return new NativeBigInt(this.value + BigInt(1));
25465 BigInteger.prototype.prev = function() {
25466 var value = this.value;
25468 return new BigInteger(addSmall(value, 1), true);
25470 return subtractSmall(value, 1, this.sign);
25472 SmallInteger.prototype.prev = function() {
25473 var value = this.value;
25474 if (value - 1 > -MAX_INT)
25475 return new SmallInteger(value - 1);
25476 return new BigInteger(MAX_INT_ARR, true);
25478 NativeBigInt.prototype.prev = function() {
25479 return new NativeBigInt(this.value - BigInt(1));
25481 var powersOfTwo = [1];
25482 while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE)
25483 powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
25484 var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
25485 function shift_isSmall(n) {
25486 return Math.abs(n) <= BASE;
25488 BigInteger.prototype.shiftLeft = function(v) {
25489 var n = parseValue(v).toJSNumber();
25490 if (!shift_isSmall(n)) {
25491 throw new Error(String(n) + " is too large for shifting.");
25494 return this.shiftRight(-n);
25496 if (result.isZero())
25498 while (n >= powers2Length) {
25499 result = result.multiply(highestPower2);
25500 n -= powers2Length - 1;
25502 return result.multiply(powersOfTwo[n]);
25504 NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
25505 BigInteger.prototype.shiftRight = function(v) {
25507 var n = parseValue(v).toJSNumber();
25508 if (!shift_isSmall(n)) {
25509 throw new Error(String(n) + " is too large for shifting.");
25512 return this.shiftLeft(-n);
25514 while (n >= powers2Length) {
25515 if (result.isZero() || result.isNegative() && result.isUnit())
25517 remQuo = divModAny(result, highestPower2);
25518 result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
25519 n -= powers2Length - 1;
25521 remQuo = divModAny(result, powersOfTwo[n]);
25522 return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
25524 NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
25525 function bitwise(x, y, fn) {
25527 var xSign = x.isNegative(), ySign = y.isNegative();
25528 var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y;
25529 var xDigit = 0, yDigit = 0;
25530 var xDivMod = null, yDivMod = null;
25532 while (!xRem.isZero() || !yRem.isZero()) {
25533 xDivMod = divModAny(xRem, highestPower2);
25534 xDigit = xDivMod[1].toJSNumber();
25536 xDigit = highestPower2 - 1 - xDigit;
25538 yDivMod = divModAny(yRem, highestPower2);
25539 yDigit = yDivMod[1].toJSNumber();
25541 yDigit = highestPower2 - 1 - yDigit;
25545 result.push(fn(xDigit, yDigit));
25547 var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
25548 for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) {
25549 sum = sum.multiply(highestPower2).add(bigInt(result[i2]));
25553 BigInteger.prototype.not = function() {
25554 return this.negate().prev();
25556 NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
25557 BigInteger.prototype.and = function(n) {
25558 return bitwise(this, n, function(a, b) {
25562 NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
25563 BigInteger.prototype.or = function(n) {
25564 return bitwise(this, n, function(a, b) {
25568 NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
25569 BigInteger.prototype.xor = function(n) {
25570 return bitwise(this, n, function(a, b) {
25574 NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
25575 var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
25576 function roughLOB(n) {
25577 var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE | LOBMASK_BI;
25580 function integerLogarithm(value, base) {
25581 if (base.compareTo(value) <= 0) {
25582 var tmp = integerLogarithm(value, base.square(base));
25585 var t = p.multiply(base);
25586 return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 };
25588 return { p: bigInt(1), e: 0 };
25590 BigInteger.prototype.bitLength = function() {
25592 if (n.compareTo(bigInt(0)) < 0) {
25593 n = n.negate().subtract(bigInt(1));
25595 if (n.compareTo(bigInt(0)) === 0) {
25598 return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
25600 NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
25601 function max(a, b) {
25604 return a.greater(b) ? a : b;
25606 function min(a, b) {
25609 return a.lesser(b) ? a : b;
25611 function gcd(a, b) {
25612 a = parseValue(a).abs();
25613 b = parseValue(b).abs();
25620 var c = Integer[1], d, t;
25621 while (a.isEven() && b.isEven()) {
25622 d = min(roughLOB(a), roughLOB(b));
25627 while (a.isEven()) {
25628 a = a.divide(roughLOB(a));
25631 while (b.isEven()) {
25632 b = b.divide(roughLOB(b));
25634 if (a.greater(b)) {
25640 } while (!b.isZero());
25641 return c.isUnit() ? a : a.multiply(c);
25643 function lcm(a, b) {
25644 a = parseValue(a).abs();
25645 b = parseValue(b).abs();
25646 return a.divide(gcd(a, b)).multiply(b);
25648 function randBetween(a, b, rng) {
25651 var usedRNG = rng || Math.random;
25652 var low = min(a, b), high = max(a, b);
25653 var range = high.subtract(low).add(1);
25655 return low.add(Math.floor(usedRNG() * range));
25656 var digits = toBase(range, BASE).value;
25657 var result = [], restricted = true;
25658 for (var i2 = 0; i2 < digits.length; i2++) {
25659 var top = restricted ? digits[i2] : BASE;
25660 var digit = truncate(usedRNG() * top);
25661 result.push(digit);
25663 restricted = false;
25665 return low.add(Integer.fromArray(result, BASE, false));
25667 var parseBase = function(text, base, alphabet, caseSensitive) {
25668 alphabet = alphabet || DEFAULT_ALPHABET;
25669 text = String(text);
25670 if (!caseSensitive) {
25671 text = text.toLowerCase();
25672 alphabet = alphabet.toLowerCase();
25674 var length = text.length;
25676 var absBase = Math.abs(base);
25677 var alphabetValues = {};
25678 for (i2 = 0; i2 < alphabet.length; i2++) {
25679 alphabetValues[alphabet[i2]] = i2;
25681 for (i2 = 0; i2 < length; i2++) {
25685 if (c in alphabetValues) {
25686 if (alphabetValues[c] >= absBase) {
25687 if (c === "1" && absBase === 1)
25689 throw new Error(c + " is not a valid digit in base " + base + ".");
25693 base = parseValue(base);
25695 var isNegative = text[0] === "-";
25696 for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) {
25698 if (c in alphabetValues)
25699 digits.push(parseValue(alphabetValues[c]));
25700 else if (c === "<") {
25704 } while (text[i2] !== ">" && i2 < text.length);
25705 digits.push(parseValue(text.slice(start + 1, i2)));
25707 throw new Error(c + " is not a valid character");
25709 return parseBaseFromArray(digits, base, isNegative);
25711 function parseBaseFromArray(digits, base, isNegative) {
25712 var val = Integer[0], pow = Integer[1], i2;
25713 for (i2 = digits.length - 1; i2 >= 0; i2--) {
25714 val = val.add(digits[i2].times(pow));
25715 pow = pow.times(base);
25717 return isNegative ? val.negate() : val;
25719 function stringify(digit, alphabet) {
25720 alphabet = alphabet || DEFAULT_ALPHABET;
25721 if (digit < alphabet.length) {
25722 return alphabet[digit];
25724 return "<" + digit + ">";
25726 function toBase(n, base) {
25727 base = bigInt(base);
25728 if (base.isZero()) {
25730 return { value: [0], isNegative: false };
25731 throw new Error("Cannot convert nonzero numbers to base 0.");
25733 if (base.equals(-1)) {
25735 return { value: [0], isNegative: false };
25736 if (n.isNegative())
25738 value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0])),
25741 var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]);
25744 value: [].concat.apply([], arr),
25749 if (n.isNegative() && base.isPositive()) {
25753 if (base.isUnit()) {
25755 return { value: [0], isNegative: false };
25757 value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1),
25762 var left = n, divmod;
25763 while (left.isNegative() || left.compareAbs(base) >= 0) {
25764 divmod = left.divmod(base);
25765 left = divmod.quotient;
25766 var digit = divmod.remainder;
25767 if (digit.isNegative()) {
25768 digit = base.minus(digit).abs();
25769 left = left.next();
25771 out.push(digit.toJSNumber());
25773 out.push(left.toJSNumber());
25774 return { value: out.reverse(), isNegative: neg };
25776 function toBaseString(n, base, alphabet) {
25777 var arr = toBase(n, base);
25778 return (arr.isNegative ? "-" : "") + arr.value.map(function(x) {
25779 return stringify(x, alphabet);
25782 BigInteger.prototype.toArray = function(radix) {
25783 return toBase(this, radix);
25785 SmallInteger.prototype.toArray = function(radix) {
25786 return toBase(this, radix);
25788 NativeBigInt.prototype.toArray = function(radix) {
25789 return toBase(this, radix);
25791 BigInteger.prototype.toString = function(radix, alphabet) {
25792 if (radix === undefined2)
25795 return toBaseString(this, radix, alphabet);
25796 var v = this.value, l2 = v.length, str = String(v[--l2]), zeros = "0000000", digit;
25797 while (--l2 >= 0) {
25798 digit = String(v[l2]);
25799 str += zeros.slice(digit.length) + digit;
25801 var sign = this.sign ? "-" : "";
25804 SmallInteger.prototype.toString = function(radix, alphabet) {
25805 if (radix === undefined2)
25808 return toBaseString(this, radix, alphabet);
25809 return String(this.value);
25811 NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
25812 NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {
25813 return this.toString();
25815 BigInteger.prototype.valueOf = function() {
25816 return parseInt(this.toString(), 10);
25818 BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
25819 SmallInteger.prototype.valueOf = function() {
25822 SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
25823 NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() {
25824 return parseInt(this.toString(), 10);
25826 function parseStringValue(v) {
25827 if (isPrecise(+v)) {
25829 if (x === truncate(x))
25830 return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
25831 throw new Error("Invalid integer: " + v);
25833 var sign = v[0] === "-";
25836 var split = v.split(/e/i);
25837 if (split.length > 2)
25838 throw new Error("Invalid integer: " + split.join("e"));
25839 if (split.length === 2) {
25840 var exp = split[1];
25841 if (exp[0] === "+")
25842 exp = exp.slice(1);
25844 if (exp !== truncate(exp) || !isPrecise(exp))
25845 throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
25846 var text = split[0];
25847 var decimalPlace = text.indexOf(".");
25848 if (decimalPlace >= 0) {
25849 exp -= text.length - decimalPlace - 1;
25850 text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
25853 throw new Error("Cannot include negative exponent part for integers");
25854 text += new Array(exp + 1).join("0");
25857 var isValid = /^([0-9][0-9]*)$/.test(v);
25859 throw new Error("Invalid integer: " + v);
25860 if (supportsNativeBigInt) {
25861 return new NativeBigInt(BigInt(sign ? "-" + v : v));
25863 var r = [], max2 = v.length, l2 = LOG_BASE, min2 = max2 - l2;
25865 r.push(+v.slice(min2, max2));
25872 return new BigInteger(r, sign);
25874 function parseNumberValue(v) {
25875 if (supportsNativeBigInt) {
25876 return new NativeBigInt(BigInt(v));
25878 if (isPrecise(v)) {
25879 if (v !== truncate(v))
25880 throw new Error(v + " is not an integer.");
25881 return new SmallInteger(v);
25883 return parseStringValue(v.toString());
25885 function parseValue(v) {
25886 if (typeof v === "number") {
25887 return parseNumberValue(v);
25889 if (typeof v === "string") {
25890 return parseStringValue(v);
25892 if (typeof v === "bigint") {
25893 return new NativeBigInt(v);
25897 for (var i = 0; i < 1e3; i++) {
25898 Integer[i] = parseValue(i);
25900 Integer[-i] = parseValue(-i);
25902 Integer.one = Integer[1];
25903 Integer.zero = Integer[0];
25904 Integer.minusOne = Integer[-1];
25909 Integer.isInstance = function(x) {
25910 return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt;
25912 Integer.randBetween = randBetween;
25913 Integer.fromArray = function(digits, base, isNegative) {
25914 return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
25918 if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) {
25919 module2.exports = bigInt;
25921 if (typeof define === "function" && define.amd) {
25922 define(function() {
25929 // node_modules/unzipper/lib/Decrypt.js
25930 var require_Decrypt = __commonJS({
25931 "node_modules/unzipper/lib/Decrypt.js"(exports2, module2) {
25932 var bigInt = require_BigInteger();
25933 var Stream2 = require("stream");
25934 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
25935 Stream2 = require_readable();
25937 function generateTable() {
25938 var poly = 3988292384, c, n, k;
25940 for (n = 0; n < 256; n++) {
25942 for (k = 0; k < 8; k++)
25943 c = c & 1 ? poly ^ c >>> 1 : c = c >>> 1;
25944 table[n] = c >>> 0;
25947 function crc(ch, crc2) {
25951 ch = ch.charCodeAt(0);
25952 return bigInt(crc2).shiftRight(8).and(16777215).xor(table[bigInt(crc2).xor(ch).and(255)]).value;
25954 function Decrypt() {
25955 if (!(this instanceof Decrypt))
25956 return new Decrypt();
25957 this.key0 = 305419896;
25958 this.key1 = 591751049;
25959 this.key2 = 878082192;
25961 Decrypt.prototype.update = function(h) {
25962 this.key0 = crc(h, this.key0);
25963 this.key1 = bigInt(this.key0).and(255).and(4294967295).add(this.key1);
25964 this.key1 = bigInt(this.key1).multiply(134775813).add(1).and(4294967295).value;
25965 this.key2 = crc(bigInt(this.key1).shiftRight(24).and(255), this.key2);
25967 Decrypt.prototype.decryptByte = function(c) {
25968 var k = bigInt(this.key2).or(2);
25969 c = c ^ bigInt(k).multiply(bigInt(k ^ 1)).shiftRight(8).and(255);
25973 Decrypt.prototype.stream = function() {
25974 var stream = Stream2.Transform(), self2 = this;
25975 stream._transform = function(d, e, cb) {
25976 for (var i = 0; i < d.length; i++) {
25977 d[i] = self2.decryptByte(d[i]);
25984 module2.exports = Decrypt;
25988 // node_modules/unzipper/lib/Open/unzip.js
25989 var require_unzip = __commonJS({
25990 "node_modules/unzipper/lib/Open/unzip.js"(exports2, module2) {
25991 var Promise2 = require_bluebird();
25992 var Decrypt = require_Decrypt();
25993 var PullStream = require_PullStream();
25994 var Stream2 = require("stream");
25995 var binary = require_binary();
25996 var zlib2 = require("zlib");
25997 var parseExtraField = require_parseExtraField();
25998 var Buffer2 = require_Buffer();
25999 var parseDateTime = require_parseDateTime();
26000 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
26001 Stream2 = require_readable();
26002 module2.exports = function unzip(source, offset, _password, directoryVars) {
26003 var file = PullStream(), entry = Stream2.PassThrough();
26004 var req = source.stream(offset);
26005 req.pipe(file).on("error", function(e) {
26006 entry.emit("error", e);
26008 entry.vars = file.pull(30).then(function(data) {
26009 var vars = binary.parse(data).word32lu("signature").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").vars;
26010 vars.lastModifiedDateTime = parseDateTime(vars.lastModifiedDate, vars.lastModifiedTime);
26011 return file.pull(vars.fileNameLength).then(function(fileName) {
26012 vars.fileName = fileName.toString("utf8");
26013 return file.pull(vars.extraFieldLength);
26014 }).then(function(extraField) {
26015 var checkEncryption;
26016 vars.extra = parseExtraField(extraField, vars);
26017 if (directoryVars && directoryVars.compressedSize)
26018 vars = directoryVars;
26019 if (vars.flags & 1)
26020 checkEncryption = file.pull(12).then(function(header) {
26022 throw new Error("MISSING_PASSWORD");
26023 var decrypt = Decrypt();
26024 String(_password).split("").forEach(function(d) {
26027 for (var i = 0; i < header.length; i++)
26028 header[i] = decrypt.decryptByte(header[i]);
26029 vars.decrypt = decrypt;
26030 vars.compressedSize -= 12;
26031 var check = vars.flags & 8 ? vars.lastModifiedTime >> 8 & 255 : vars.crc32 >> 24 & 255;
26032 if (header[11] !== check)
26033 throw new Error("BAD_PASSWORD");
26036 return Promise2.resolve(checkEncryption).then(function() {
26037 entry.emit("vars", vars);
26042 entry.vars.then(function(vars) {
26043 var fileSizeKnown = !(vars.flags & 8) || vars.compressedSize > 0, eof;
26044 var inflater = vars.compressionMethod ? zlib2.createInflateRaw() : Stream2.PassThrough();
26045 if (fileSizeKnown) {
26046 entry.size = vars.uncompressedSize;
26047 eof = vars.compressedSize;
26049 eof = Buffer2.alloc(4);
26050 eof.writeUInt32LE(134695760, 0);
26052 var stream = file.stream(eof);
26054 stream = stream.pipe(vars.decrypt.stream());
26055 stream.pipe(inflater).on("error", function(err) {
26056 entry.emit("error", err);
26057 }).pipe(entry).on("finish", function() {
26060 else if (req.close)
26065 console.log("warning - unable to close stream");
26067 }).catch(function(e) {
26068 entry.emit("error", e);
26075 // node_modules/unzipper/lib/Open/directory.js
26076 var require_directory = __commonJS({
26077 "node_modules/unzipper/lib/Open/directory.js"(exports2, module2) {
26078 var binary = require_binary();
26079 var PullStream = require_PullStream();
26080 var unzip = require_unzip();
26081 var Promise2 = require_bluebird();
26082 var BufferStream = require_BufferStream();
26083 var parseExtraField = require_parseExtraField();
26084 var Buffer2 = require_Buffer();
26085 var path2 = require("path");
26086 var Writer = require_fstream().Writer;
26087 var parseDateTime = require_parseDateTime();
26088 var signature = Buffer2.alloc(4);
26089 signature.writeUInt32LE(101010256, 0);
26090 function getCrxHeader(source) {
26091 var sourceStream = source.stream(0).pipe(PullStream());
26092 return sourceStream.pull(4).then(function(data) {
26093 var signature2 = data.readUInt32LE(0);
26094 if (signature2 === 875721283) {
26096 return sourceStream.pull(12).then(function(data2) {
26097 crxHeader = binary.parse(data2).word32lu("version").word32lu("pubKeyLength").word32lu("signatureLength").vars;
26098 }).then(function() {
26099 return sourceStream.pull(crxHeader.pubKeyLength + crxHeader.signatureLength);
26100 }).then(function(data2) {
26101 crxHeader.publicKey = data2.slice(0, crxHeader.pubKeyLength);
26102 crxHeader.signature = data2.slice(crxHeader.pubKeyLength);
26103 crxHeader.size = 16 + crxHeader.pubKeyLength + crxHeader.signatureLength;
26109 function getZip64CentralDirectory(source, zip64CDL) {
26110 var d64loc = binary.parse(zip64CDL).word32lu("signature").word32lu("diskNumber").word64lu("offsetToStartOfCentralDirectory").word32lu("numberOfDisks").vars;
26111 if (d64loc.signature != 117853008) {
26112 throw new Error("invalid zip64 end of central dir locator signature (0x07064b50): 0x" + d64loc.signature.toString(16));
26114 var dir64 = PullStream();
26115 source.stream(d64loc.offsetToStartOfCentralDirectory).pipe(dir64);
26116 return dir64.pull(56);
26118 function parseZip64DirRecord(dir64record) {
26119 var vars = binary.parse(dir64record).word32lu("signature").word64lu("sizeOfCentralDirectory").word16lu("version").word16lu("versionsNeededToExtract").word32lu("diskNumber").word32lu("diskStart").word64lu("numberOfRecordsOnDisk").word64lu("numberOfRecords").word64lu("sizeOfCentralDirectory").word64lu("offsetToStartOfCentralDirectory").vars;
26120 if (vars.signature != 101075792) {
26121 throw new Error("invalid zip64 end of central dir locator signature (0x06064b50): 0x0" + vars.signature.toString(16));
26125 module2.exports = function centralDirectory(source, options) {
26126 var endDir = PullStream(), records = PullStream(), tailSize = options && options.tailSize || 80, sourceSize, crxHeader, startOffset, vars;
26127 if (options && options.crx)
26128 crxHeader = getCrxHeader(source);
26129 return source.size().then(function(size) {
26131 source.stream(Math.max(0, size - tailSize)).on("error", function(error) {
26132 endDir.emit("error", error);
26134 return endDir.pull(signature);
26135 }).then(function() {
26136 return Promise2.props({ directory: endDir.pull(22), crxHeader });
26137 }).then(function(d) {
26138 var data = d.directory;
26139 startOffset = d.crxHeader && d.crxHeader.size || 0;
26140 vars = binary.parse(data).word32lu("signature").word16lu("diskNumber").word16lu("diskStart").word16lu("numberOfRecordsOnDisk").word16lu("numberOfRecords").word32lu("sizeOfCentralDirectory").word32lu("offsetToStartOfCentralDirectory").word16lu("commentLength").vars;
26141 if (vars.numberOfRecords == 65535 || vars.numberOfRecords == 65535 || vars.offsetToStartOfCentralDirectory == 4294967295) {
26142 const zip64CDLSize = 20;
26143 const zip64CDLOffset = sourceSize - (tailSize - endDir.match + zip64CDLSize);
26144 const zip64CDLStream = PullStream();
26145 source.stream(zip64CDLOffset).pipe(zip64CDLStream);
26146 return zip64CDLStream.pull(zip64CDLSize).then(function(d2) {
26147 return getZip64CentralDirectory(source, d2);
26148 }).then(function(dir64record) {
26149 vars = parseZip64DirRecord(dir64record);
26152 vars.offsetToStartOfCentralDirectory += startOffset;
26154 }).then(function() {
26155 source.stream(vars.offsetToStartOfCentralDirectory).pipe(records);
26156 vars.extract = function(opts) {
26157 if (!opts || !opts.path)
26158 throw new Error("PATH_MISSING");
26159 return vars.files.then(function(files) {
26160 return Promise2.map(files, function(entry) {
26161 if (entry.type == "Directory")
26163 var extractPath = path2.join(opts.path, entry.path);
26164 if (extractPath.indexOf(opts.path) != 0) {
26167 var writer = opts.getWriter ? opts.getWriter({ path: extractPath }) : Writer({ path: extractPath });
26168 return new Promise2(function(resolve, reject) {
26169 entry.stream(opts.password).on("error", reject).pipe(writer).on("close", resolve).on("error", reject);
26171 }, opts.concurrency > 1 ? { concurrency: opts.concurrency || void 0 } : void 0);
26174 vars.files = Promise2.mapSeries(Array(vars.numberOfRecords), function() {
26175 return records.pull(46).then(function(data) {
26176 var vars2 = binary.parse(data).word32lu("signature").word16lu("versionMadeBy").word16lu("versionsNeededToExtract").word16lu("flags").word16lu("compressionMethod").word16lu("lastModifiedTime").word16lu("lastModifiedDate").word32lu("crc32").word32lu("compressedSize").word32lu("uncompressedSize").word16lu("fileNameLength").word16lu("extraFieldLength").word16lu("fileCommentLength").word16lu("diskNumber").word16lu("internalFileAttributes").word32lu("externalFileAttributes").word32lu("offsetToLocalFileHeader").vars;
26177 vars2.offsetToLocalFileHeader += startOffset;
26178 vars2.lastModifiedDateTime = parseDateTime(vars2.lastModifiedDate, vars2.lastModifiedTime);
26179 return records.pull(vars2.fileNameLength).then(function(fileNameBuffer) {
26180 vars2.pathBuffer = fileNameBuffer;
26181 vars2.path = fileNameBuffer.toString("utf8");
26182 vars2.isUnicode = vars2.flags & 17;
26183 return records.pull(vars2.extraFieldLength);
26184 }).then(function(extraField) {
26185 vars2.extra = parseExtraField(extraField, vars2);
26186 return records.pull(vars2.fileCommentLength);
26187 }).then(function(comment) {
26188 vars2.comment = comment;
26189 vars2.type = vars2.uncompressedSize === 0 && /[\/\\]$/.test(vars2.path) ? "Directory" : "File";
26190 vars2.stream = function(_password) {
26191 return unzip(source, vars2.offsetToLocalFileHeader, _password, vars2);
26193 vars2.buffer = function(_password) {
26194 return BufferStream(vars2.stream(_password));
26200 return Promise2.props(vars);
26206 // node_modules/unzipper/lib/Open/index.js
26207 var require_Open = __commonJS({
26208 "node_modules/unzipper/lib/Open/index.js"(exports2, module2) {
26209 var fs2 = require_graceful_fs();
26210 var Promise2 = require_bluebird();
26211 var directory = require_directory();
26212 var Stream2 = require("stream");
26213 if (!Stream2.Writable || !Stream2.Writable.prototype.destroy)
26214 Stream2 = require_readable();
26215 module2.exports = {
26216 buffer: function(buffer, options) {
26218 stream: function(offset, length) {
26219 var stream = Stream2.PassThrough();
26220 stream.end(buffer.slice(offset, length));
26224 return Promise2.resolve(buffer.length);
26227 return directory(source, options);
26229 file: function(filename, options) {
26231 stream: function(offset, length) {
26232 return fs2.createReadStream(filename, { start: offset, end: length && offset + length });
26235 return new Promise2(function(resolve, reject) {
26236 fs2.stat(filename, function(err, d) {
26245 return directory(source, options);
26247 url: function(request, params, options) {
26248 if (typeof params === "string")
26249 params = { url: params };
26251 throw "URL missing";
26252 params.headers = params.headers || {};
26254 stream: function(offset, length) {
26255 var options2 = Object.create(params);
26256 options2.headers = Object.create(params.headers);
26257 options2.headers.range = "bytes=" + offset + "-" + (length ? length : "");
26258 return request(options2);
26261 return new Promise2(function(resolve, reject) {
26262 var req = request(params);
26263 req.on("response", function(d) {
26265 if (!d.headers["content-length"])
26266 reject(new Error("Missing content length header"));
26268 resolve(d.headers["content-length"]);
26269 }).on("error", reject);
26273 return directory(source, options);
26275 s3: function(client, params, options) {
26278 return new Promise2(function(resolve, reject) {
26279 client.headObject(params, function(err, d) {
26283 resolve(d.ContentLength);
26287 stream: function(offset, length) {
26289 for (var key in params)
26290 d[key] = params[key];
26291 d.Range = "bytes=" + offset + "-" + (length ? length : "");
26292 return client.getObject(d).createReadStream();
26295 return directory(source, options);
26301 // node_modules/unzipper/unzip.js
26302 var require_unzip2 = __commonJS({
26303 "node_modules/unzipper/unzip.js"(exports2) {
26305 require_listenercount();
26306 require_buffer_indexof_polyfill();
26307 require_setImmediate();
26308 exports2.Parse = require_parse3();
26309 exports2.ParseOne = require_parseOne();
26310 exports2.Extract = require_extract();
26311 exports2.Open = require_Open();
26315 // node_modules/isexe/windows.js
26316 var require_windows = __commonJS({
26317 "node_modules/isexe/windows.js"(exports2, module2) {
26318 module2.exports = isexe;
26320 var fs2 = require("fs");
26321 function checkPathExt(path2, options) {
26322 var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
26326 pathext = pathext.split(";");
26327 if (pathext.indexOf("") !== -1) {
26330 for (var i = 0; i < pathext.length; i++) {
26331 var p = pathext[i].toLowerCase();
26332 if (p && path2.substr(-p.length).toLowerCase() === p) {
26338 function checkStat(stat, path2, options) {
26339 if (!stat.isSymbolicLink() && !stat.isFile()) {
26342 return checkPathExt(path2, options);
26344 function isexe(path2, options, cb) {
26345 fs2.stat(path2, function(er, stat) {
26346 cb(er, er ? false : checkStat(stat, path2, options));
26349 function sync(path2, options) {
26350 return checkStat(fs2.statSync(path2), path2, options);
26355 // node_modules/isexe/mode.js
26356 var require_mode = __commonJS({
26357 "node_modules/isexe/mode.js"(exports2, module2) {
26358 module2.exports = isexe;
26360 var fs2 = require("fs");
26361 function isexe(path2, options, cb) {
26362 fs2.stat(path2, function(er, stat) {
26363 cb(er, er ? false : checkStat(stat, options));
26366 function sync(path2, options) {
26367 return checkStat(fs2.statSync(path2), options);
26369 function checkStat(stat, options) {
26370 return stat.isFile() && checkMode(stat, options);
26372 function checkMode(stat, options) {
26373 var mod = stat.mode;
26374 var uid = stat.uid;
26375 var gid = stat.gid;
26376 var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
26377 var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
26378 var u = parseInt("100", 8);
26379 var g = parseInt("010", 8);
26380 var o = parseInt("001", 8);
26382 var ret2 = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
26388 // node_modules/isexe/index.js
26389 var require_isexe = __commonJS({
26390 "node_modules/isexe/index.js"(exports2, module2) {
26391 var fs2 = require("fs");
26393 if (process.platform === "win32" || global.TESTING_WINDOWS) {
26394 core = require_windows();
26396 core = require_mode();
26398 module2.exports = isexe;
26400 function isexe(path2, options, cb) {
26401 if (typeof options === "function") {
26406 if (typeof Promise !== "function") {
26407 throw new TypeError("callback not provided");
26409 return new Promise(function(resolve, reject) {
26410 isexe(path2, options || {}, function(er, is) {
26419 core(path2, options || {}, function(er, is) {
26421 if (er.code === "EACCES" || options && options.ignoreErrors) {
26429 function sync(path2, options) {
26431 return core.sync(path2, options || {});
26433 if (options && options.ignoreErrors || er.code === "EACCES") {
26443 // node_modules/which/which.js
26444 var require_which = __commonJS({
26445 "node_modules/which/which.js"(exports2, module2) {
26446 var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
26447 var path2 = require("path");
26448 var COLON = isWindows ? ";" : ":";
26449 var isexe = require_isexe();
26450 var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
26451 var getPathInfo = (cmd, opt) => {
26452 const colon = opt.colon || COLON;
26453 const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
26454 ...isWindows ? [process.cwd()] : [],
26455 ...(opt.path || process.env.PATH || "").split(colon)
26457 const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
26458 const pathExt = isWindows ? pathExtExe.split(colon) : [""];
26460 if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
26461 pathExt.unshift("");
26469 var which = (cmd, opt, cb) => {
26470 if (typeof opt === "function") {
26476 const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
26478 const step = (i) => new Promise((resolve, reject) => {
26479 if (i === pathEnv.length)
26480 return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
26481 const ppRaw = pathEnv[i];
26482 const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
26483 const pCmd = path2.join(pathPart, cmd);
26484 const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
26485 resolve(subStep(p, i, 0));
26487 const subStep = (p, i, ii) => new Promise((resolve, reject) => {
26488 if (ii === pathExt.length)
26489 return resolve(step(i + 1));
26490 const ext = pathExt[ii];
26491 isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
26494 found.push(p + ext);
26496 return resolve(p + ext);
26498 return resolve(subStep(p, i, ii + 1));
26501 return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
26503 var whichSync = (cmd, opt) => {
26505 const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
26507 for (let i = 0; i < pathEnv.length; i++) {
26508 const ppRaw = pathEnv[i];
26509 const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
26510 const pCmd = path2.join(pathPart, cmd);
26511 const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
26512 for (let j = 0; j < pathExt.length; j++) {
26513 const cur = p + pathExt[j];
26515 const is = isexe.sync(cur, { pathExt: pathExtExe });
26526 if (opt.all && found.length)
26530 throw getNotFoundError(cmd);
26532 module2.exports = which;
26533 which.sync = whichSync;
26537 // node_modules/@clangd/install/out/src/index.js
26538 var require_src = __commonJS({
26539 "node_modules/@clangd/install/out/src/index.js"(exports2) {
26541 var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
26542 function adopt(value) {
26543 return value instanceof P ? value : new P(function(resolve) {
26547 return new (P || (P = Promise))(function(resolve, reject) {
26548 function fulfilled(value) {
26550 step(generator.next(value));
26555 function rejected(value) {
26557 step(generator["throw"](value));
26562 function step(result) {
26563 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26565 step((generator = generator.apply(thisArg, _arguments || [])).next());
26568 var __asyncValues = exports2 && exports2.__asyncValues || function(o) {
26569 if (!Symbol.asyncIterator)
26570 throw new TypeError("Symbol.asyncIterator is not defined.");
26571 var m = o[Symbol.asyncIterator], i;
26572 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
26576 i[n] = o[n] && function(v) {
26577 return new Promise(function(resolve, reject) {
26578 v = o[n](v), settle(resolve, reject, v.done, v.value);
26582 function settle(resolve, reject, d, v) {
26583 Promise.resolve(v).then(function(v2) {
26584 resolve({ value: v2, done: d });
26588 Object.defineProperty(exports2, "__esModule", { value: true });
26589 var abort_controller_1 = require_abort_controller();
26590 var child_process = require("child_process");
26591 var fs2 = require("fs");
26592 var node_fetch_1 = (init_lib(), lib_exports);
26593 var os = require("os");
26594 var path2 = require("path");
26595 var readdirp = require_readdirp();
26596 var rimraf = require_rimraf();
26597 var semver = require_semver2();
26598 var stream = require("stream");
26599 var unzipper = require_unzip2();
26600 var util_1 = require("util");
26601 var which = require_which();
26602 function prepare2(ui, checkUpdate) {
26603 return __awaiter(this, void 0, void 0, function* () {
26605 var absPath = yield util_1.promisify(which)(ui.clangdPath);
26607 return { clangdPath: null, background: recover(ui) };
26610 clangdPath: absPath,
26611 background: checkUpdate ? checkUpdates2(false, ui) : Promise.resolve()
26615 exports2.prepare = prepare2;
26616 function installLatest2(ui) {
26617 return __awaiter(this, void 0, void 0, function* () {
26618 const abort = new abort_controller_1.AbortController();
26620 const release = yield Github.latestRelease();
26621 const asset = yield Github.chooseAsset(release);
26622 ui.clangdPath = yield Install.install(release, asset, abort, ui);
26623 ui.promptReload(`clangd ${release.name} is now installed.`);
26625 if (!abort.signal.aborted) {
26626 console.error("Failed to install clangd: ", e);
26627 const message = `Failed to install clangd language server: ${e}
26628 You may want to install it manually.`;
26629 ui.showHelp(message, installURL);
26634 exports2.installLatest = installLatest2;
26635 function checkUpdates2(requested, ui) {
26636 return __awaiter(this, void 0, void 0, function* () {
26638 var release = yield Github.latestRelease();
26639 yield Github.chooseAsset(release);
26640 var upgrade = yield Version.upgrade(release, ui.clangdPath);
26642 console.log("Failed to check for clangd update: ", e);
26644 ui.error(`Failed to check for clangd update: ${e}`);
26647 console.log("Checking for clangd update: available=", upgrade.new, " installed=", upgrade.old);
26648 if (!upgrade.upgrade) {
26650 ui.info(`clangd is up-to-date (you have ${upgrade.old}, latest is ${upgrade.new})`);
26653 ui.promptUpdate(upgrade.old, upgrade.new);
26656 exports2.checkUpdates = checkUpdates2;
26657 function recover(ui) {
26658 return __awaiter(this, void 0, void 0, function* () {
26660 const release = yield Github.latestRelease();
26661 yield Github.chooseAsset(release);
26662 ui.promptInstall(release.name);
26664 console.error("Auto-install failed: ", e);
26665 ui.showHelp("The clangd language server is not installed.", installURL);
26669 var installURL = "https://clangd.llvm.org/installation.html";
26670 var githubReleaseURL = "https://api.github.com/repos/clangd/clangd/releases/latest";
26671 function fakeGitHubReleaseURL(u) {
26672 githubReleaseURL = u;
26674 exports2.fakeGitHubReleaseURL = fakeGitHubReleaseURL;
26675 var lddCommand = "ldd";
26676 function fakeLddCommand(l2) {
26679 exports2.fakeLddCommand = fakeLddCommand;
26681 (function(Github2) {
26682 function latestRelease() {
26683 return __awaiter(this, void 0, void 0, function* () {
26684 const response = yield node_fetch_1.default(githubReleaseURL);
26685 if (!response.ok) {
26686 console.log(response.url, response.status, response.statusText);
26687 throw new Error(`Can't fetch release: ${response.statusText}`);
26689 return yield response.json();
26692 Github2.latestRelease = latestRelease;
26693 function chooseAsset(release) {
26694 return __awaiter(this, void 0, void 0, function* () {
26696 "win32": "windows",
26700 const variant = variants[os.platform()];
26701 if (variant == "linux") {
26702 const minGlibc = new semver.Range("2.18");
26703 const oldGlibc = yield Version.oldGlibc(minGlibc);
26705 throw new Error(`The clangd release is not compatible with your system (glibc ${oldGlibc.raw} < ${minGlibc.raw}). Try to install it using your package manager instead.`);
26708 if (variant && (os.arch() == "x64" || variant == "windows" || os.arch() == "arm64" && variant == "mac")) {
26709 const asset = release.assets.find((a) => a.name.indexOf(variant) >= 0);
26713 throw new Error(`No clangd ${release.name} binary available for ${os.platform()}/${os.arch()}`);
26716 Github2.chooseAsset = chooseAsset;
26717 })(Github || (Github = {}));
26719 (function(Install2) {
26720 function install2(release, asset, abort, ui) {
26721 return __awaiter(this, void 0, void 0, function* () {
26722 const dirs = yield createDirs(ui);
26723 const extractRoot = path2.join(dirs.install, release.tag_name);
26724 if (yield util_1.promisify(fs2.exists)(extractRoot)) {
26725 const reuse = yield ui.shouldReuse(release.name);
26726 if (reuse === void 0) {
26728 throw new Error(`clangd ${release.name} already installed!`);
26731 let files = (yield readdirp.promise(extractRoot)).map((e) => e.fullPath);
26732 return findExecutable(files);
26734 yield util_1.promisify(rimraf)(extractRoot);
26737 const zipFile = path2.join(dirs.download, asset.name);
26738 yield download(asset.browser_download_url, zipFile, abort, ui);
26739 const archive = yield unzipper.Open.file(zipFile);
26740 const executable = findExecutable(archive.files.map((f) => f.path));
26741 yield ui.slow(`Extracting ${asset.name}`, archive.extract({ path: extractRoot }));
26742 const clangdPath = path2.join(extractRoot, executable);
26743 yield fs2.promises.chmod(clangdPath, 493);
26744 yield fs2.promises.unlink(zipFile);
26748 Install2.install = install2;
26749 function createDirs(ui) {
26750 return __awaiter(this, void 0, void 0, function* () {
26751 const install3 = path2.join(ui.storagePath, "install");
26752 const download2 = path2.join(ui.storagePath, "download");
26753 for (const dir of [install3, download2])
26754 yield fs2.promises.mkdir(dir, { "recursive": true });
26755 return { install: install3, download: download2 };
26758 function findExecutable(paths) {
26759 const filename = os.platform() == "win32" ? "clangd.exe" : "clangd";
26760 const entry = paths.find((f) => path2.posix.basename(f) == filename || path2.win32.basename(f) == filename);
26762 throw new Error("Didn't find a clangd executable!");
26765 function download(url, dest, abort, ui) {
26766 return __awaiter(this, void 0, void 0, function* () {
26767 console.log("Downloading ", url, " to ", dest);
26768 return ui.progress(`Downloading ${path2.basename(dest)}`, abort, (progress) => __awaiter(this, void 0, void 0, function* () {
26769 const response = yield node_fetch_1.default(url, { signal: abort.signal });
26771 throw new Error(`Failed to download $url`);
26772 const size = Number(response.headers.get("content-length"));
26774 response.body.on("data", (chunk) => {
26775 read += chunk.length;
26776 progress(read / size);
26778 const out = fs2.createWriteStream(dest);
26779 yield util_1.promisify(stream.pipeline)(response.body, out).catch((e) => {
26780 fs2.unlink(dest, (_) => null);
26786 })(Install || (Install = {}));
26788 (function(Version2) {
26789 function upgrade(release, clangdPath) {
26790 return __awaiter(this, void 0, void 0, function* () {
26791 const releasedVer = released(release);
26792 const installedVer = yield installed(clangdPath);
26794 old: installedVer.raw,
26795 new: releasedVer.raw,
26796 upgrade: rangeGreater(releasedVer, installedVer)
26800 Version2.upgrade = upgrade;
26804 function installed(clangdPath) {
26805 return __awaiter(this, void 0, void 0, function* () {
26806 const output = yield run(clangdPath, ["--version"]);
26807 console.log(clangdPath, " --version output: ", output);
26808 const prefix = "clangd version ";
26809 if (!output.startsWith(prefix))
26810 throw new Error(`Couldn't parse clangd --version output: ${output}`);
26811 const rawVersion = output.substr(prefix.length).split(" ", 1)[0];
26812 return new semver.Range(rawVersion, loose);
26815 function released(release) {
26816 return !semver.validRange(release.tag_name, loose) && semver.validRange(release.name, loose) ? new semver.Range(release.name, loose) : new semver.Range(release.tag_name, loose);
26818 function oldGlibc(min) {
26819 return __awaiter(this, void 0, void 0, function* () {
26820 const output = yield run(lddCommand, ["--version"]);
26821 const line = output.split("\n", 1)[0];
26822 const match = line.match(/^ldd .*glibc.* (\d+(?:\.\d+)+)[^ ]*$/i);
26823 if (!match || !semver.validRange(match[1], loose)) {
26824 console.error(`Can't glibc version from ldd --version output: ${line}`);
26827 const version = new semver.Range(match[1], loose);
26828 console.log("glibc is", version.raw, "min is", min.raw);
26829 return rangeGreater(min, version) ? version : null;
26832 Version2.oldGlibc = oldGlibc;
26833 function run(command, flags) {
26835 return __awaiter(this, void 0, void 0, function* () {
26836 const child = child_process.spawn(command, flags, { stdio: ["ignore", "pipe", "ignore"] });
26839 for (var _b = __asyncValues(child.stdout), _c; _c = yield _b.next(), !_c.done; ) {
26840 const chunk = _c.value;
26844 e_1 = { error: e_1_1 };
26847 if (_c && !_c.done && (_a = _b.return))
26857 function rangeGreater(newVer, oldVer) {
26858 return semver.gtr(semver.minVersion(newVer), oldVer);
26860 })(Version || (Version = {}));
26865 __export(exports, {
26866 activate: () => activate2
26868 var import_coc9 = __toModule(require("coc.nvim"));
26871 var import_coc = __toModule(require("coc.nvim"));
26872 var fs = __toModule(require("fs"));
26873 var path = __toModule(require("path"));
26874 var SwitchSourceHeaderRequest;
26875 (function(SwitchSourceHeaderRequest2) {
26876 SwitchSourceHeaderRequest2.type = new import_coc.RequestType("textDocument/switchSourceHeader");
26877 })(SwitchSourceHeaderRequest || (SwitchSourceHeaderRequest = {}));
26878 var SymbolInfoRequest;
26879 (function(SymbolInfoRequest2) {
26880 SymbolInfoRequest2.type = new import_coc.RequestType("textDocument/symbolInfo");
26881 })(SymbolInfoRequest || (SymbolInfoRequest = {}));
26882 function switchSourceHeader(ctx) {
26883 return async (openCommand) => {
26887 const doc = await import_coc.workspace.document;
26894 const dest = await ctx.client.sendRequest(SwitchSourceHeaderRequest.type.method, params);
26896 import_coc.window.showMessage(`Didn't find a corresponding file.`);
26899 await import_coc.workspace.jumpTo(dest, null, openCommand);
26902 function symbolInfo(ctx) {
26903 return async () => {
26907 const doc = await import_coc.workspace.document;
26911 const position = await import_coc.window.getCursorPosition();
26913 textDocument: { uri: doc.uri },
26916 const details = await ctx.client.sendRequest(SymbolInfoRequest.type.method, params);
26917 if (!details.length) {
26920 const detail = details[0];
26921 import_coc.window.showMessage(`name: ${detail.name}, containerName: ${detail.containerName}, usr: ${detail.usr}`);
26924 function getUserConfigFile() {
26926 switch (process.platform) {
26928 dir = process.env.LOCALAPPDATA;
26931 dir = path.join(process.env.HOME, "Library", "Preferences");
26934 dir = process.env.XDG_CONFIG_HOME || path.join(process.env.HOME, ".config");
26939 return path.join(dir, "clangd", "config.yaml");
26941 async function openConfigFile(p) {
26942 if (!fs.existsSync(p)) {
26943 await import_coc.workspace.createFile(p);
26945 await import_coc.workspace.openResource(p);
26947 function userConfig() {
26948 const file = getUserConfigFile();
26950 openConfigFile(file);
26952 import_coc.window.showMessage("Couldn't get global configuration directory", "warning");
26955 function projectConfig() {
26956 if (import_coc.workspace.workspaceFolders.length > 0) {
26957 const folder = import_coc.workspace.workspaceFolders[0];
26958 openConfigFile(path.join(import_coc.Uri.parse(folder.uri).fsPath, ".clangd"));
26960 import_coc.window.showMessage("No project is open", "warning");
26965 var import_coc4 = __toModule(require("coc.nvim"));
26968 var import_coc2 = __toModule(require("coc.nvim"));
26969 var Config = class {
26971 this.cfg = import_coc2.workspace.getConfiguration("clangd");
26974 return this.cfg.get("enabled");
26976 get disableDiagnostics() {
26977 return this.cfg.get("disableDiagnostics");
26979 get disableSnippetCompletion() {
26980 return this.cfg.get("disableSnippetCompletion");
26982 get disableCompletion() {
26983 return this.cfg.get("disableCompletion");
26986 return this.cfg.get("arguments", []).map((arg) => import_coc2.workspace.expand(arg));
26989 return this.cfg.get("trace", { file: "", server: "off" });
26991 get fallbackFlags() {
26992 return this.cfg.get("fallbackFlags", []);
26994 get semanticHighlighting() {
26995 return this.cfg.get("semanticHighlighting");
26997 get showDBChangedNotification() {
26998 return this.cfg.get("showDBChangedNotification");
27000 get compilationDatabasePath() {
27001 return this.cfg.get("compilationDatabasePath");
27003 get serverCompletionRanking() {
27004 return this.cfg.get("serverCompletionRanking");
27008 // src/semantic-highlighting.ts
27009 var import_coc3 = __toModule(require("coc.nvim"));
27010 var import_vscode_languageserver_protocol = __toModule(require_main2());
27011 var SemanticHighlightingFeature = class {
27012 constructor(client, context) {
27013 this.scopeTable = [];
27014 this.bufTokens = {};
27015 context.subscriptions.push(client.onDidChangeState(({ newState }) => {
27016 if (newState === import_coc3.State.Running) {
27017 const notification = new import_vscode_languageserver_protocol.NotificationType("textDocument/semanticHighlighting");
27018 client.onNotification(notification.method, this.handleNotification.bind(this));
27024 initialize(capabilities) {
27025 const serverCapabilities = capabilities;
27026 if (!serverCapabilities.semanticHighlighting)
27028 this.scopeTable = serverCapabilities.semanticHighlighting.scopes;
27030 fillClientCapabilities(capabilities) {
27031 const textDocumentCapabilities = capabilities.textDocument;
27032 textDocumentCapabilities.semanticHighlightingCapabilities = {
27033 semanticHighlighting: true
27036 async handleNotification(params) {
27037 const doc = import_coc3.workspace.getDocument(params.textDocument.uri);
27038 if (!(doc.bufnr in this.bufTokens))
27039 this.bufTokens[doc.bufnr] = [];
27040 const lines = this.bufTokens[doc.bufnr];
27041 for (const line of params.lines) {
27042 while (line.line >= lines.length)
27044 lines[line.line] = this.decodeTokens(line.tokens);
27046 const symbols = [];
27047 const skipped = [];
27048 for (const [line, tokens] of lines.entries()) {
27049 for (const token of tokens) {
27050 if (token.kind === "InactiveCode") {
27051 skipped.push(import_vscode_languageserver_protocol.Range.create(line, token.character, line, token.character + token.length));
27056 ranges: [import_vscode_languageserver_protocol.Range.create(line, token.character, line, token.character + token.length)],
27057 parentKind: "Unknown",
27063 await import_coc3.workspace.nvim.call("lsp_cxx_hl#hl#notify_symbols", [doc.bufnr, symbols]);
27064 if (skipped.length) {
27065 await import_coc3.workspace.nvim.call("lsp_cxx_hl#hl#notify_skipped", [doc.bufnr, skipped]);
27068 decodeTokens(tokens) {
27069 const scopeMask = 65535;
27070 const lenShift = 16;
27071 const uint32Size = 4;
27072 const buf = Buffer.from(tokens, "base64");
27073 const retTokens = [];
27074 for (let i = 0, end = buf.length / uint32Size; i < end; i += 2) {
27075 const start = buf.readUInt32BE(i * uint32Size);
27076 const lenKind = buf.readUInt32BE((i + 1) * uint32Size);
27077 const scopeIndex = lenKind & scopeMask;
27078 const len = lenKind >>> lenShift;
27079 const kind = this.scopeTable[scopeIndex][0];
27080 retTokens.push({ character: start, scopeIndex, length: len, kind: this.decodeKind(kind) });
27086 case "entity.name.function.cpp":
27088 case "entity.name.function.method.cpp":
27090 case "entity.name.function.method.static.cpp":
27091 return "StaticMethod";
27092 case "variable.other.cpp":
27094 case "variable.other.local.cpp":
27095 return "LocalVariable";
27096 case "variable.parameter.cpp":
27097 return "Parameter";
27098 case "variable.other.field.cpp":
27100 case "variable.other.field.static.cpp":
27101 return "StaticField";
27102 case "entity.name.type.class.cpp":
27104 case "entity.name.type.enum.cpp":
27106 case "variable.other.enummember.cpp":
27107 return "EnumConstant";
27108 case "entity.name.type.typedef.cpp":
27110 case "entity.name.type.dependent.cpp":
27111 return "DependentType";
27112 case "entity.name.other.dependent.cpp":
27113 return "DependentName";
27114 case "entity.name.namespace.cpp":
27115 return "Namespace";
27116 case "entity.name.type.template.cpp":
27117 return "TemplateParameter";
27118 case "entity.name.type.concept.cpp":
27120 case "storage.type.primitive.cpp":
27121 return "Primitive";
27122 case "entity.name.function.preprocessor.cpp":
27124 case "meta.disabled":
27125 return "InactiveCode";
27133 var ClangdExtensionFeature = class {
27140 fillClientCapabilities(capabilities) {
27141 const extendedCompletionCapabilities = capabilities.textDocument.completion;
27142 if (extendedCompletionCapabilities) {
27143 extendedCompletionCapabilities.editsNearCursor = true;
27148 constructor(context) {
27149 this.context = context;
27150 this.client = null;
27151 this.config = new Config();
27153 async startServer(bin, ...features) {
27154 const old = this.client;
27160 args: this.config.arguments
27162 if (this.config.trace.file) {
27163 exec.options = { env: { CLANGD_TRACE: this.config.trace.file } };
27165 const serverOptions = exec;
27166 const initializationOptions = { clangdFileStatus: true, fallbackFlags: this.config.fallbackFlags };
27167 if (this.config.compilationDatabasePath) {
27168 initializationOptions.compilationDatabasePath = this.config.compilationDatabasePath;
27170 const clientOptions = {
27171 documentSelector: [
27172 { scheme: "file", language: "c" },
27173 { scheme: "file", language: "cpp" },
27174 { scheme: "file", language: "objc" },
27175 { scheme: "file", language: "objcpp" },
27176 { scheme: "file", language: "objective-c" },
27177 { scheme: "file", language: "objective-cpp" },
27178 { scheme: "file", language: "opencl" },
27179 { scheme: "file", language: "cuda" }
27181 initializationOptions,
27182 disableDiagnostics: this.config.disableDiagnostics,
27183 disableSnippetCompletion: this.config.disableSnippetCompletion,
27184 disableCompletion: this.config.disableCompletion,
27186 provideOnTypeFormattingEdits: (document2, position, ch, options, token, next) => {
27187 const line = document2.getText(import_coc4.Range.create(position.line, 0, position.line, position.character));
27188 if (!line.trim().length)
27192 return next(document2, position, ch, options, token);
27194 provideCompletionItem: async (document2, position, context, token, next) => {
27196 const list = await next(document2, position, context, token);
27199 if (!this.config.serverCompletionRanking)
27201 const tail = await import_coc4.workspace.nvim.eval(`strpart(getline('.'), col('.') - 1)`);
27202 const semicolon = /^\s*$/.test(tail);
27203 const items = Array.isArray(list) ? list : list.items;
27204 for (const item of items) {
27205 if (this.config.serverCompletionRanking) {
27206 const start = (_a = item.textEdit) == null ? void 0 : _a.range.start;
27208 const prefix = document2.getText(import_coc4.Range.create(start, position));
27210 item.filterText = prefix + "_" + item.filterText;
27213 if (semicolon && item.insertTextFormat === import_coc4.InsertTextFormat.Snippet && item.textEdit) {
27214 const { textEdit } = item;
27215 const { newText } = textEdit;
27216 if (item.kind === import_coc4.CompletionItemKind.Function || item.kind === import_coc4.CompletionItemKind.Text && newText.slice(-1) === ")") {
27217 item.textEdit = { range: textEdit.range, newText: newText + ";" };
27221 return Array.isArray(list) ? items : { items, isIncomplete: list.isIncomplete };
27223 provideWorkspaceSymbols: async (query, token, next) => {
27224 const symbols = await next(query, token);
27227 return symbols.map((symbol) => {
27228 if (query.includes("::")) {
27229 if (symbol.containerName) {
27230 symbol.name = `${symbol.containerName}::${symbol.name}`;
27232 symbol.containerName = "";
27239 const client = new import_coc4.LanguageClient("clangd", serverOptions, clientOptions);
27240 if (this.config.semanticHighlighting) {
27241 const lspCxx = await import_coc4.workspace.nvim.call("exists", "g:lsp_cxx_hl_loaded");
27242 if (lspCxx === 1) {
27243 client.registerFeature(new SemanticHighlightingFeature(client, this.context));
27246 for (const feature of features)
27247 client.registerFeature(feature);
27248 this.context.subscriptions.push(import_coc4.services.registLanguageClient(client));
27249 await client.onReady();
27250 this.client = client;
27252 get subscriptions() {
27253 return this.context.subscriptions;
27257 // src/file_status.ts
27258 var import_coc5 = __toModule(require("coc.nvim"));
27259 var FileStatus = class {
27261 this.statuses = new Map();
27262 this.statusBarItem = import_coc5.window.createStatusBarItem(0);
27264 onFileUpdated(status) {
27265 this.statuses.set(status.uri, status);
27266 this.updateStatus();
27268 async updateStatus() {
27269 const doc = await import_coc5.workspace.document;
27273 const status = this.statuses.get(doc.uri);
27274 if (!status || status.state === "idle") {
27275 this.statusBarItem.hide();
27278 this.statusBarItem.text = `clangd: ` + status.state;
27279 this.statusBarItem.show();
27282 this.statuses.clear();
27283 this.statusBarItem.hide();
27286 this.statusBarItem.dispose();
27291 var common = __toModule(require_src());
27292 var coc = __toModule(require("coc.nvim"));
27293 var import_os = __toModule(require("os"));
27295 constructor(context, config) {
27296 this.context = context;
27297 this.config = config;
27299 get storagePath() {
27300 return this.context.storagePath;
27302 slow(title, result) {
27303 coc.window.showMessage(title + "...");
27307 coc.window.showMessage(s, "error");
27310 coc.window.showMessage(s);
27312 progress(title, _cancel, body) {
27313 return this.slow(title, body(() => {
27316 async shouldReuse(release) {
27317 coc.window.showMessage(`Reusing existing ${release} installation in ${this.storagePath}`);
27320 async promptReload() {
27321 await coc.commands.executeCommand("editor.action.restart");
27323 showHelp(message, url) {
27324 message += ` See ${url}.`;
27325 coc.window.showMessage(message);
27327 async promptUpdate(oldVersion, newVersion) {
27328 const message = `clangd ${newVersion} is available (you have ${oldVersion}). :CocCommand clangd.install, or :CocSettings to disable clangd.checkUpdates.`;
27329 coc.window.showMessage(message);
27331 async promptInstall(version) {
27332 const message = `clangd was not found on your PATH. :CocCommand clangd.install will install ${version}.`;
27333 coc.window.showMessage(message);
27336 return coc.workspace.expand(this.config.get("path", ""));
27338 set clangdPath(p) {
27339 this.config.update("path", p.replace((0, import_os.homedir)(), "~"), true);
27342 async function activate(context) {
27343 const cfg = coc.workspace.getConfiguration("clangd");
27344 const ui = new UI(context, cfg);
27345 context.subscriptions.push(coc.commands.registerCommand("clangd.install", async () => common.installLatest(ui)));
27346 context.subscriptions.push(coc.commands.registerCommand("clangd.update", async () => common.checkUpdates(true, ui)));
27347 const status = await common.prepare(ui, cfg.get("checkUpdates", false));
27348 return status.clangdPath;
27352 var import_coc6 = __toModule(require("coc.nvim"));
27353 var import_path = __toModule(require("path"));
27354 var ReloadFeature = class {
27355 constructor(ctx, activate3) {
27357 this.activate = activate3;
27363 if ((_a = caps.compilationDatabase) == null ? void 0 : _a.automaticReload) {
27366 const fileWatcher = import_coc6.workspace.createFileSystemWatcher("**/{compile_commands.json,compile_flags.txt}");
27367 this.ctx.subscriptions.push(fileWatcher, fileWatcher.onDidChange((e) => this.reload(e.fsPath)), fileWatcher.onDidCreate((e) => this.reload(e.fsPath)));
27369 fillClientCapabilities() {
27371 async reload(url) {
27372 const notification = this.ctx.config.showDBChangedNotification;
27373 if (notification) {
27374 const msg = `${(0, import_path.basename)(url)} has changed, clangd is reloading...`;
27375 import_coc6.window.showMessage(msg);
27377 for (const sub of this.ctx.subscriptions) {
27386 import_coc6.window.showMessage(`clangd has reloaded`);
27390 // src/memory-usage.ts
27391 var import_coc7 = __toModule(require("coc.nvim"));
27392 var MemoryUsageRequest = new import_coc7.RequestType0("$/memoryUsage");
27393 function convert2(m, title) {
27394 const slash = Math.max(title.lastIndexOf("/"), title.lastIndexOf("\\"));
27397 isFile: slash >= 0,
27400 children: Object.keys(m).sort().filter((x) => !x.startsWith("_")).map((e) => convert2(m[e], e)).sort((x, y) => y.total - x.total)
27404 function format(c) {
27405 const msg = `${c.title} ${(c.total / 1024 / 1024).toFixed(2)} MB`;
27406 if (c.title === "clangd_server") {
27409 if (["background_index", "tuscheduler", "dynamic_index"].includes(c.title)) {
27410 results.push(" \u2514 " + msg);
27412 for (const child of c.children) {
27416 var MemoryUsageFeature = class {
27418 this.memoryUsageProvider = false;
27419 ctx.subscriptions.push(import_coc7.commands.registerCommand("clangd.memoryUsage", async () => {
27420 if (this.memoryUsageProvider) {
27421 const usage = await ctx.client.sendRequest(MemoryUsageRequest.method, {});
27422 results.length = 0;
27423 format(convert2(usage, "<root>"));
27424 import_coc7.window.echoLines(results);
27426 import_coc7.window.showMessage(`Your clangd doesn't support memory usage report, clangd 12+ is needed`, "warning");
27430 fillClientCapabilities() {
27432 fillInitializeParams() {
27434 initialize(capabilities) {
27435 this.memoryUsageProvider = "memoryUsageProvider" in capabilities;
27442 var import_coc8 = __toModule(require("coc.nvim"));
27443 var ASTRequestType = new import_coc8.RequestType("textDocument/ast");
27444 var ASTFeature = class {
27448 fillClientCapabilities() {
27450 initialize(capabilities) {
27451 if ("astProvider" in capabilities) {
27452 const adapter = new TreeAdapter();
27453 const tree = import_coc8.window.createTreeView("clangd.AST", { treeDataProvider: adapter });
27454 this.ctx.subscriptions.push(tree, adapter.onDidChangeTreeData((_) => {
27455 if (adapter.hasRoot()) {
27458 }), import_coc8.commands.registerCommand("clangd.ast", async () => {
27459 if (!this.ctx.client)
27462 const { document: document2, position } = await import_coc8.workspace.getCurrentState();
27463 const mode = await import_coc8.workspace.nvim.call("visualmode");
27465 range = await import_coc8.workspace.getSelectedRange(mode, import_coc8.workspace.getDocument(document2.uri));
27467 range = import_coc8.Range.create(position, position);
27469 textDocument: { uri: document2.uri },
27472 const item = await this.ctx.client.sendRequest(ASTRequestType, params);
27474 import_coc8.window.showInformationMessage("No AST node at selection");
27477 const winid = await import_coc8.workspace.nvim.eval("win_getid()");
27478 adapter.setRoot(item, import_coc8.Uri.parse(document2.uri), winid);
27486 function describe(role, kind) {
27487 if (role === "expression" || role === "statement" || role === "declaration" || role === "template name") {
27490 return kind + " " + role;
27492 var TreeAdapter = class {
27494 this._onDidChangeTreeData = new import_coc8.Emitter();
27495 this.onDidChangeTreeData = this._onDidChangeTreeData.event;
27498 return this.root !== void 0;
27500 setRoot(newRoot, newDoc, winid) {
27501 this.root = newRoot;
27503 this.winid = winid;
27504 this._onDidChangeTreeData.fire(null);
27506 getTreeItem(node) {
27507 const item = new import_coc8.TreeItem(describe(node.role, node.kind));
27508 if (node.children && node.children.length > 0) {
27509 item.collapsibleState = import_coc8.TreeItemCollapsibleState.Expanded;
27511 item.description = node.detail;
27512 item.tooltip = node.arcana;
27513 if (node.range && this.winid) {
27516 command: "workspace.openLocation",
27517 arguments: [this.winid, { uri: this.doc, range: node.range }]
27522 getChildren(element) {
27523 return element ? element.children || [] : this.root ? [this.root] : [];
27526 if (node === this.root)
27528 function findUnder(parent) {
27530 for (const child of (_a = parent == null ? void 0 : parent.children) != null ? _a : []) {
27531 const result = node === child ? parent : findUnder(child);
27537 return findUnder(this.root);
27542 async function activate2(context) {
27544 const ctx = new Ctx(context);
27545 if (!ctx.config.enabled) {
27548 const service = import_coc9.services.getService("clangd");
27550 import_coc9.window.showMessage(`Looks like you've configured clangd in coc-settings.json, you should remove it to use coc-clangd`, "warning");
27553 const clangdPath = await activate(context);
27558 const astFeature = new ASTFeature(ctx);
27559 const extFeature = new ClangdExtensionFeature();
27560 const reloadFeature = new ReloadFeature(ctx, () => activate2(context));
27561 const memoryUsageFeature = new MemoryUsageFeature(ctx);
27562 await ctx.startServer(clangdPath, ...[astFeature, extFeature, reloadFeature, memoryUsageFeature]);
27566 const fileStatus = new FileStatus();
27567 context.subscriptions.push(fileStatus, import_coc9.commands.registerCommand("clangd.switchSourceHeader", switchSourceHeader(ctx)), import_coc9.commands.registerCommand("clangd.symbolInfo", symbolInfo(ctx)), import_coc9.commands.registerCommand("clangd.userConfig", userConfig), import_coc9.commands.registerCommand("clangd.projectConfig", projectConfig), ctx.client.onDidChangeState((e) => {
27569 if (e.newState === import_coc9.State.Running) {
27570 (_a2 = ctx.client) == null ? void 0 : _a2.onNotification("textDocument/clangd.fileStatus", (status) => {
27571 fileStatus.onFileUpdated(status);
27573 } else if (e.newState === import_coc9.State.Stopped) {
27574 fileStatus.clear();
27576 }), import_coc9.workspace.onDidOpenTextDocument(() => {
27577 fileStatus.updateStatus();
27579 (_a = ctx.client) == null ? void 0 : _a.onNotification("textDocument/clangd.fileStatus", (status) => {
27580 fileStatus.onFileUpdated(status);
27583 // Annotate the CommonJS export names for ESM import in node:
27584 0 && (module.exports = {